[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: another stdio patch for UnixWare
From: |
Tim Rice |
Subject: |
Re: another stdio patch for UnixWare |
Date: |
Sun, 11 Oct 2020 11:56:33 -0700 (PDT) |
User-agent: |
Alpine 2.11 (UW2 23 2013-08-11) |
Hi Bruno,
On Sun, 11 Oct 2020, Bruno Haible wrote:
> Tim Rice wrote:
> > ./gnulib-tool --create-testdir --dir=/var/tmp --with-tests \
> > --single-configure --avoid=havelib-tests fseterr freadable fwritable \
> > fbufmode freading fwriting freadptr freadseek freadahead fpurge fseeko
> > ftello fpending fflush
>
> Yes, this is the way to test these modules.
>
> > and the attached patch, I am down to 2 failures in the stdio tests.
>
> Hmm, there are three things I find suspicious:
>
> 1) __freadable is defined in a way that is inconsistent with Gnulib:
> #define __freadable(p) (__freading(p) && __fpending(p))
> [in Gnulib, a stream that is not reading nor writing is considered
> to be readable]
> but you don't ensure that freadable doesn't get defined other than
> __freadable.
>
> 2) Likewise for __fwritable, which is defined in a way inconsistent with
> Gnulib:
> #define __fwritable(p) (__fwriting(p) && __fpending(p) < __fbufsiz(p))
Indeed. And after the post with the defines I found tests for
for __freadable and __fwritable were failing.
It looks like we just need to check for _IOREAD, _IORW, _IOWRT flags.
Sorry I didn't update the post with the defines. This is what I'm working
with now which does pass __freadable and __fwritable tests.
#define __freadable(p) ((void)sizeof(__filbuf(p)), ((FILE *)(p))->__flag &
(_IOREAD | _IORW))
#define __fwritable(p) ((void)sizeof(__filbuf(p)), ((FILE *)(p))->__flag &
(_IOWRT | _IORW))
> 3) In freadahead.c you add:
> return __fpending(fp_);
> But __fpending looks at the pending output, whereas freadahead shall look
> at the available input. Should be different things, no?
I had that change for so long I had to research why it was done that way.
Looking back at a 2009 an e-mail from one of the SCO engineers, I see
"... using the __fpending(), which in our libc.so.1 will work for
both input or output files."
>
> Bruno
>
--
Tim Rice Multitalents
tim@multitalents.net