tech-userlevel archive

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

Re: Patch to make <stdio.h> reentrant by default

On 28.04.2019 01:34, Joerg Sonnenberger wrote:
> On Fri, Apr 26, 2019 at 11:36:00PM +0200, Kamil Rytarowski wrote:
>> I propose a patch that:
> Too many different things at once. So the short version of the review:
> - I don't see any reason for providing unlocked versions of clearerr,
>   feof, ferror or fileno. No reason for inline functions either, they
>   shouldn't be performance sensitive on any reasonable code.

There are still potential users, but most of them in open source
packages are from copy-pasted GNU scripts.

One legitimate user of fileno_unlocked (from a feature point of view) is
in TSan, but it has been reimplemented inside the sanitizer for the
NetBSD case.

> - getc is performance sensitive. putc potentially is, but I don't have
>   clear evidence for the relevant use. Just dropping the inline
>   optimisation for getc results in a penalty between 3 and 10, depending
>   on the architecture, for single-threaded programs. That's clearly not
>   acceptable. (Conditionally) switching from getc macro to
>   getc_unlocked would be reasonable on platforms like AMD64, but still
>   include a 80% overhead (for static linking!) on HPPA.

OK, so if its considered as performance sensitive I will abandon that
part and enforce _REENTRANT in GCC too.

As we will keep using inline macros, no point in switching feof(3) and

> Joerg

OK, thanks!

Attachment: signature.asc
Description: OpenPGP digital signature

Home | Main Index | Thread Index | Old Index