bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: musl compatibility


From: Paolo Bonzini
Subject: Re: musl compatibility
Date: Sat, 23 Jun 2012 17:10:54 +0200

On Sun, Jun 17, 2012 at 6:15 PM, Bruno Haible <address@hidden> wrote:
> Paul Eggert wrote:
>> On 06/12/2012 04:21 AM, Paolo Bonzini wrote:
>> > perhaps we can follow the suggestion and
>> > replace "if (freadahead (f))" with "if (freading(f) && !feof(f))" in
>> > closein.c.
>>
>> Yes, thanks, I like this idea the best of those suggested so far.
>> Here's a proposed patch to gnulib.
>
> Unfortunately, this idea will cause extra system calls for programs which
> terminate without having read from stdin.

A wrongly-nonzero freadahead is a correctness problem indeed.
However, in the case of close_stdin, is this important for something
that happens rarely, and even then at most once in a run (and
usually the time the lseek will happen anyway, because in general
stdin is read in its entirety)?

Not to mention that lseek(0, 0, SEEK_CUR) is one of the most optimized
system calls in the kernel, possibly beaten only by
gettimeofday/clock_gettime.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]