* m4/off64_t.m4: New file.
* m4/sys_types_h.m4 (gl_SYS_TYPES_H): Require gl_TYPE_OFF64_T.
* lib/sys_types.in.h (off64_t): New type.
(GNULIB_defined_off64_t): New macro.
* modules/sys_types (Files): Add m4/off64_t.m4.
(configure.ac-early): Require AC_USE_SYSTEM_EXTENSIONS.
(Makefile.am): Substitute HAVE_OFF64_T.
* tests/test-sys_types.c: Verify that off64_t is defined.
* doc/posix-headers/sys_types.texi: Mention the off64_t workaround.
+2024-04-27 Bruno Haible <bruno@clisp.org>
+
+ 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.
+ * lib/sys_types.in.h (off64_t): New type.
+ (GNULIB_defined_off64_t): New macro.
+ * modules/sys_types (Files): Add m4/off64_t.m4.
+ (configure.ac-early): Require AC_USE_SYSTEM_EXTENSIONS.
+ (Makefile.am): Substitute HAVE_OFF64_T.
+ * tests/test-sys_types.c: Verify that off64_t is defined.
+ * doc/posix-headers/sys_types.texi: Mention the off64_t workaround.
+
2024-04-27 Paul Eggert <eggert@cs.ucla.edu>
nullptr: work around GCC 14 nullptr sentinel bug
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
Some systems leak definitions of @code{major}, @code{minor}, and
@code{makedev} through this header; however, when
@file{sys/sysmacros.h} exists, that file should also be included to
# define _GL_WINDOWS_64_BIT_OFF_T 1
#endif
+/* Define the off64_t type. */
+#if !@HAVE_OFF64_T@
+# if !GNULIB_defined_off64_t
+/* Define off64_t to int64_t always. */
+typedef long long off64_t;
+# define GNULIB_defined_off64_t 1
+# endif
+#endif
+
/* Override dev_t and ino_t if distinguishable inodes support is requested
on native Windows. */
#if @WINDOWS_STAT_INODES@
--- /dev/null
+# off64_t.m4
+# serial 1
+dnl Copyright (C) 2024 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+dnl Check whether <sys/types.h> defines the 'off64_t' type.
+dnl Set HAVE_OFF64_T.
+
+AC_DEFUN([gl_TYPE_OFF64_T],
+[
+ dnl Persuade glibc <sys/types.h>, <stdio.h>, <fcntl.h>, <unistd.h>, <aio.h>
+ dnl to define off64_t.
+ AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
+ AC_CACHE_CHECK([for off64_t], [gl_cv_off64_t],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/types.h>]],
+ [[int x = sizeof (off64_t *) + sizeof (off64_t);
+ return !x;]])],
+ [gl_cv_off64_t=yes], [gl_cv_off64_t=no])])
+
+ if test $gl_cv_off64_t != no; then
+ HAVE_OFF64_T=1
+ else
+ HAVE_OFF64_T=0
+ fi
+ AC_SUBST([HAVE_OFF64_T])
+])
# sys_types_h.m4
-# serial 13
+# serial 14
dnl Copyright (C) 2011-2024 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl Whether to override the 'off_t' type.
AC_REQUIRE([gl_TYPE_OFF_T])
+ dnl Whether to define the 'off64_t' type.
+ AC_REQUIRE([gl_TYPE_OFF64_T])
+
dnl Whether to override the 'dev_t' and 'ino_t' types.
m4_ifdef([gl_WINDOWS_STAT_INODES], [
AC_REQUIRE([gl_WINDOWS_STAT_INODES])
lib/sys_types.in.h
m4/sys_types_h.m4
m4/off_t.m4
+m4/off64_t.m4
m4/pid_t.m4
Depends-on:
include_next
ssize_t
+configure.ac-early:
+AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+
configure.ac:
gl_SYS_TYPES_H
gl_SYS_TYPES_H_REQUIRE_DEFAULTS
-e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
-e 's|@''NEXT_SYS_TYPES_H''@|$(NEXT_SYS_TYPES_H)|g' \
-e 's|@''WINDOWS_64_BIT_OFF_T''@|$(WINDOWS_64_BIT_OFF_T)|g' \
+ -e 's|@''HAVE_OFF64_T''@|$(HAVE_OFF64_T)|g' \
-e 's|@''WINDOWS_STAT_INODES''@|$(WINDOWS_STAT_INODES)|g' \
$(srcdir)/sys_types.in.h > $@-t
$(AM_V_at)mv $@-t $@
ssize_t t3;
off_t t4;
mode_t t5;
+off64_t t6;
int
main (void)