[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gnulib portability issues
From: |
Bruno Haible |
Subject: |
Re: gnulib portability issues |
Date: |
Sun, 17 Jun 2012 23:03:49 +0200 |
User-agent: |
KMail/4.7.4 (Linux/3.1.10-1.9-desktop; KDE/4.7.4; x86_64; ; ) |
Hi Paul,
> > They're purposefully opaque so that they can be changed if an
> > alternate implementation proves better.
>
> Dragonfly BSD attacked this problem by supplying a
> function __sreadahead that returns the value in question.
> Perhaps musl could do something similar? That would fix
> the problem while preserving opacity.
Yes, exactly.
> Another possibility is something like the following patch,
> which may fix this particular problem, though I expect that there are
> other problems with the opacity that would still be in
> there somewhere.
>
> Also, I don't like this patch because it adds runtime overhead
> in the non-musl case, but presumably this could be fixed.
> (Right now I'm just trying to think through possible solutions.)
>
> diff --git a/lib/freadahead.c b/lib/freadahead.c
> index 2ba8b34..db6b68b 100644
> --- a/lib/freadahead.c
> +++ b/lib/freadahead.c
> @@ -84,10 +84,7 @@ freadahead (FILE *fp)
> if (fp->state == 4 /* WR */ || fp->rp >= fp->wp)
> return 0;
> return fp->wp - fp->rp;
> -#elif defined SLOW_BUT_NO_HACKS /* users can define this */
> - abort ();
> - return 0;
> #else
> - #error "Please port gnulib freadahead.c to your platform! Look at the
> definition of fflush, fread, ungetc on your system, then report this to
> bug-gnulib."
> + return -1;
> #endif
> }
I don't much like this patch because it gives up too early. freadahead()
is much like fpending(): Every platform has a reasonable implementation of
it. If fpending() returned some "don't know" indicator, some programs would
sensibly misbehave. Likewise for freadahead().
Bruno
- Re: gnulib portability issues, (continued)
- Re: gnulib portability issues, Eric Blake, 2012/06/11
- Re: gnulib portability issues, Rich Felker, 2012/06/11
- Re: gnulib portability issues, Ben Pfaff, 2012/06/12
- Re: gnulib portability issues, Eric Blake, 2012/06/12
- Re: gnulib portability issues, Rich Felker, 2012/06/12
- Re: gnulib portability issues, Eric Blake, 2012/06/12
- Re: gnulib portability issues, Rich Felker, 2012/06/10
- Re: gnulib portability issues, Paul Eggert, 2012/06/10
- Re: gnulib portability issues, Rich Felker, 2012/06/10
- Re: gnulib portability issues, Paul Eggert, 2012/06/11
- Re: gnulib portability issues,
Bruno Haible <=
- Re: gnulib portability issues, Eric Blake, 2012/06/11
- Re: gnulib portability issues, Rich Felker, 2012/06/11
- Re: gnulib portability issues, Eric Blake, 2012/06/11
- Re: gnulib portability issues, Rich Felker, 2012/06/11
- Re: gnulib portability issues, Eric Blake, 2012/06/11
- Re: stdioext to POSIX, Bruno Haible, 2012/06/17
Re: gnulib portability issues, Eric Blake, 2012/06/12