[PATCH v2 5/6] Remove usage of "unlocked" variant of stdio print functions
Mark Wielaard
mark@klomp.org
Thu Oct 17 13:00:35 GMT 2024
Hi Michael,
On Wed, 2024-10-16 at 19:53 +0000, Michael Pratt wrote:
> These "unlocked" Linux Standard Base variants of standard functions
> are not available on some systems that are still capable
> of building Linux and ELFs.
>
> The difference is negligible for simple printing to stdout.
>
> POSIX also states for the similar putc_unlocked():
>
> These functions can safely be used in a multi-threaded program
> if and only if they are called while the invoking thread owns
> the (FILE *) object, as is the case after a successful call
> to the flockfile() or ftrylockfile() functions.
>
> ...
>
> These unlocked versions can be safely used
> only within explicitly locked program regions,
> using exported locking primitives.
>
> and these precautions were never done.
>
> Use the standard forms of these print functions.
>
> There is inconsistent use of fputc_unlocked() with putc_unlocked(),
> so consistently use the safer fputc() instead.
Looks good. Pushed.
Thanks,
Mark
More information about the Elfutils-devel
mailing list