2025-09-05 Paul Eggert <eggert@cs.ucla.edu>
+ unlocked-io: also deal with fileno
+ This shouldn’t affect performance on glibc, where fileno and
+ fileno_unlocked are aliases under the theory that no locking is needed.
+ However, it might help a bit on platforms like FreeBSD where
+ fileno_unlocked is inline and does not lock.
+ * lib/unlocked-io.h (fileno, fileno_unlocked):
+ Define as needed, similarly to fgets etc.
+ * m4/unlocked-io.m4 (gl_FUNC_GLIBC_UNLOCKED_IO):
+ Also check fileno_unlocked.
+
progname: static check instead of dynamic
* lib/progname.c: Don’t include stdio.h or stdlib.h.
(set_program_name): Omit dynamic check that (with current glibc
# define fgets_unlocked(x,y,z) fgets (x,y,z)
# endif
+# if HAVE_DECL_FILENO_UNLOCKED || defined fileno_unlocked
+# undef fileno
+# define fileno(x) fileno_unlocked (x)
+# else
+# define fileno_unlocked(x) fileno (x)
+# endif
+
# if HAVE_DECL_FPUTC_UNLOCKED || defined fputc_unlocked
# undef fputc
# define fputc(x,y) fputc_unlocked (x,y)
# unlocked-io.m4
-# serial 16
+# serial 17
dnl Copyright (C) 1998-2006, 2009-2025 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_CHECK_DECLS_ONCE([ferror_unlocked])
AC_CHECK_DECLS_ONCE([fflush_unlocked])
AC_CHECK_DECLS_ONCE([fgets_unlocked])
+ AC_CHECK_DECLS_ONCE([fileno_unlocked])
AC_CHECK_DECLS_ONCE([fputc_unlocked])
AC_CHECK_DECLS_ONCE([fputs_unlocked])
AC_CHECK_DECLS_ONCE([fread_unlocked])