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
+21
View File
@@ -0,0 +1,21 @@
dnl #
dnl # ZFS_AC_CONFIG_USER_LARGEFILE
dnl #
dnl # Ensure off_t is 64-bit for large file support in userspace.
dnl # This is required for OpenZFS to handle files larger than 2GB.
dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER_LARGEFILE], [
AC_SYS_LARGEFILE
AC_CHECK_SIZEOF([off_t])
AC_MSG_CHECKING([for 64-bit off_t])
AS_IF([test "$ac_cv_sizeof_off_t" -ne 8], [
AC_MSG_RESULT([no, $ac_cv_sizeof_off_t bytes])
AC_MSG_FAILURE([
*** OpenZFS userspace requires 64-bit off_t support for large files.
*** Please ensure your system supports large file operations.
*** Current off_t size: $ac_cv_sizeof_off_t bytes])
], [
AC_MSG_RESULT([yes, $ac_cv_sizeof_off_t bytes])
])
])
+1
View File
@@ -3,6 +3,7 @@ dnl # Default ZFS user configuration
dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER], [
ZFS_AC_CONFIG_USER_GETTEXT
ZFS_AC_CONFIG_USER_LARGEFILE
ZFS_AC_CONFIG_USER_MOUNT_HELPER
ZFS_AC_CONFIG_USER_SYSVINIT
ZFS_AC_CONFIG_USER_DRACUT