From 13496d1e83af41fa67b5352ad8a08fee1da7fff2 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 27 Apr 2024 19:51:53 +0200 Subject: [PATCH] fcntl-h, stdio, unistd: Ensure off64_t is defined on all platforms. * lib/fcntl.in.h: Update comment regarding off64_t. * lib/stdio.in.h: Likewise. * lib/unistd.in.h: Likewise. * tests/test-fcntl-h.c: Verify that off64_t is defined. * tests/test-stdio.c: Likewise. * tests/test-unistd.c: Likewise. * doc/posix-headers/fcntl.texi: Mention the off64_t workaround. * doc/posix-headers/stdio.texi: Likewise. * doc/posix-headers/unistd.texi: Likewise. * doc/posix-headers/aio.texi: Mention the problem with off64_t. --- ChangeLog | 12 ++++++++++++ doc/posix-headers/aio.texi | 5 ++++- doc/posix-headers/fcntl.texi | 4 ++++ doc/posix-headers/stdio.texi | 9 ++++++--- doc/posix-headers/unistd.texi | 3 +++ lib/fcntl.in.h | 3 ++- lib/stdio.in.h | 3 ++- lib/unistd.in.h | 5 +++-- tests/test-fcntl-h.c | 1 + tests/test-stdio.c | 1 + tests/test-unistd.c | 1 + 11 files changed, 39 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8467f57a50..935ddbd1ba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2024-04-27 Bruno Haible + fcntl-h, stdio, unistd: Ensure off64_t is defined on all platforms. + * lib/fcntl.in.h: Update comment regarding off64_t. + * lib/stdio.in.h: Likewise. + * lib/unistd.in.h: Likewise. + * tests/test-fcntl-h.c: Verify that off64_t is defined. + * tests/test-stdio.c: Likewise. + * tests/test-unistd.c: Likewise. + * doc/posix-headers/fcntl.texi: Mention the off64_t workaround. + * doc/posix-headers/stdio.texi: Likewise. + * doc/posix-headers/unistd.texi: Likewise. + * doc/posix-headers/aio.texi: Mention the problem with off64_t. + sys_types: Ensure off64_t is defined on all platforms. * m4/off64_t.m4: New file. * m4/sys_types_h.m4 (gl_SYS_TYPES_H): Require gl_TYPE_OFF64_T. diff --git a/doc/posix-headers/aio.texi b/doc/posix-headers/aio.texi index b8c958756b..69b865b2ec 100644 --- a/doc/posix-headers/aio.texi +++ b/doc/posix-headers/aio.texi @@ -13,5 +13,8 @@ Portability problems not fixed by Gnulib: @itemize @item This header file is missing on some platforms: -NetBSD 3.0, OpenBSD 6.7, Minix 3.1.8, Cygwin, mingw, MSVC 14, Android 9.0. +NetBSD 3.0, OpenBSD 6.7, Minix 3.1.8, Cygwin, mingw, MSVC 14, Haiku, Android 9.0. +@item +The type @code{off64_t} is not defined on some platforms: +macOS 12.5, FreeBSD 10.4, NetBSD 10.0, OpenBSD 7.5, Minix 3.3. @end itemize diff --git a/doc/posix-headers/fcntl.texi b/doc/posix-headers/fcntl.texi index 0982ba9aa5..d7d95ba1ca 100644 --- a/doc/posix-headers/fcntl.texi +++ b/doc/posix-headers/fcntl.texi @@ -15,6 +15,10 @@ MSVC 14. The type @code{mode_t} is not defined on some platforms: MSVC 14. +@item +The type @code{off64_t} is not defined on some platforms: +macOS 12.5, FreeBSD 10.4, NetBSD 10.0, OpenBSD 7.5, MSVC 14, Cygwin, Haiku, Minix 3.3. + @item @samp{O_CLOEXEC} is not defined on some platforms: Mac OS X 10.6, FreeBSD 8.4, NetBSD 5.1, OpenBSD 4.9, Minix 3.1.8, AIX 7.1, HP-UX 11.31, Solaris 10, Cygwin 1.7.1, mingw, MSVC 14. diff --git a/doc/posix-headers/stdio.texi b/doc/posix-headers/stdio.texi index cb5a76f55d..9dc2e68b58 100644 --- a/doc/posix-headers/stdio.texi +++ b/doc/posix-headers/stdio.texi @@ -8,15 +8,18 @@ Gnulib module: stdio Portability problems fixed by Gnulib: @itemize @item -The type @code{off_t} is missing on some platforms: +The type @code{off_t} is not defined on some platforms: glibc 2.8, eglibc 2.11.2 and others. @item -The type @code{ssize_t} is missing on some platforms: +The type @code{ssize_t} is not defined on some platforms: glibc 2.8, Mac OS X 10.5, Solaris 10, MSVC 14, and others. @item -The type @code{va_list} is missing on some platforms: +The type @code{va_list} is not defined on some platforms: glibc 2.8, OpenBSD 4.0, Solaris 11.4, and others. @item +The type @code{off64_t} is not defined on some platforms: +macOS 12.5, FreeBSD 10.4, NetBSD 10.0, OpenBSD 7.5, MSVC 14, Cygwin, Haiku, Minix 3.3. +@item Some platforms provide a @code{NULL} macro that cannot be used in arbitrary expressions: NetBSD 5.0 diff --git a/doc/posix-headers/unistd.texi b/doc/posix-headers/unistd.texi index 2327e6ff4a..1f5312f8d0 100644 --- a/doc/posix-headers/unistd.texi +++ b/doc/posix-headers/unistd.texi @@ -11,6 +11,9 @@ Portability problems fixed by Gnulib: This header file is missing on some platforms: MSVC 14. @item +The type @code{off64_t} is not defined on some platforms: +macOS 12.5, FreeBSD 10.4, NetBSD 10.0, OpenBSD 7.5, MSVC 14, Cygwin, Haiku, Minix 3.3. +@item The SEEK_* macros are not defined in this file on some platforms: mingw. @item diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h index eea3b9542a..1465ce594d 100644 --- a/lib/fcntl.in.h +++ b/lib/fcntl.in.h @@ -51,7 +51,8 @@ #ifndef _@GUARD_PREFIX@_FCNTL_H /* Needed before . - May also define off_t to a 64-bit type on native Windows. */ + May also define off_t to a 64-bit type on native Windows. + Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */ #include /* On some systems other than glibc, is a prerequisite of . On glibc systems, we would like to avoid namespace pollution. diff --git a/lib/stdio.in.h b/lib/stdio.in.h index 35b9f74821..1c0c9661bf 100644 --- a/lib/stdio.in.h +++ b/lib/stdio.in.h @@ -77,7 +77,8 @@ /* Get off_t and ssize_t. Needed on many systems, including glibc 2.8 and eglibc 2.11.2. - May also define off_t to a 64-bit type on native Windows. */ + May also define off_t to a 64-bit type on native Windows. + Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */ #include /* Solaris 10 and NetBSD 7.0 declare renameat in , not in . */ diff --git a/lib/unistd.in.h b/lib/unistd.in.h index b412966367..fa99d7472f 100644 --- a/lib/unistd.in.h +++ b/lib/unistd.in.h @@ -159,8 +159,9 @@ #endif /* MSVC defines off_t in . - May also define off_t to a 64-bit type on native Windows. */ -/* Get off_t, ssize_t, mode_t. */ + May also define off_t to a 64-bit type on native Windows. + Also defines off64_t on macOS, NetBSD, OpenBSD, MSVC, Cygwin, Haiku. */ +/* Get off_t, off64_t, ssize_t, mode_t. */ #include /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ diff --git a/tests/test-fcntl-h.c b/tests/test-fcntl-h.c index d633167235..6020a11e72 100644 --- a/tests/test-fcntl-h.c +++ b/tests/test-fcntl-h.c @@ -35,6 +35,7 @@ int i = FD_CLOEXEC; pid_t t1; off_t t2; mode_t t3; +off64_t t4; int main (void) diff --git a/tests/test-stdio.c b/tests/test-stdio.c index 499695206b..44d58f0556 100644 --- a/tests/test-stdio.c +++ b/tests/test-stdio.c @@ -36,6 +36,7 @@ off_t t2; size_t t3; ssize_t t4; va_list t5; +off64_t t6; #include diff --git a/tests/test-unistd.c b/tests/test-unistd.c index 931d65e439..e131302ab6 100644 --- a/tests/test-unistd.c +++ b/tests/test-unistd.c @@ -46,6 +46,7 @@ pid_t t6; useconds_t t7; intptr_t t8; #endif +off64_t t9; int main (void) -- 2.39.5