Ensure 64-bit off_t is used in user space instead of loff_t

Use 64-bit POSIX off_t in user space instead of the Linux kernel type
loff_t. This is enforced at configure time via AC_SYS_LARGEFILE and
AC_CHECK_SIZEOF([off_t]). loff_t remains in shared headers where they
mirror Linux VFS interfaces, and on FreeBSD we typedef loff_t to off_t
in those headers since libc does not provide it.

Reviewed-by: Rob Norris <robn@despairlabs.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Alexander Moch <mail@alexmoch.com>
Closes #18020
This commit is contained in:
Alexander Moch
2025-12-10 17:45:39 +00:00
committed by GitHub
parent 48842c0a41
commit ff47dd35e2
9 changed files with 55 additions and 34 deletions
+4 -3
View File
@@ -36,12 +36,13 @@
#include <string.h>
#include <unistd.h>
#ifdef __FreeBSD__
#define loff_t off_t
#if defined(_GNU_SOURCE) && defined(__linux__)
_Static_assert(sizeof (loff_t) == sizeof (off_t),
"loff_t and off_t must be the same size");
#endif
ssize_t
copy_file_range(int, loff_t *, int, loff_t *, size_t, unsigned int)
copy_file_range(int, off_t *, int, off_t *, size_t, unsigned int)
__attribute__((weak));
static void *