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
+1 -1
View File
@@ -86,6 +86,6 @@ extern void kstat_delete(kstat_t *);
extern void kstat_set_raw_ops(kstat_t *ksp,
int (*headers)(char *buf, size_t size),
int (*data)(char *buf, size_t size, void *data),
void *(*addr)(kstat_t *ksp, loff_t index));
void *(*addr)(kstat_t *ksp, off_t index));
#endif /* _SYS_KSTAT_H */
-15
View File
@@ -50,19 +50,4 @@ typedef int projid_t;
#include <sys/param.h> /* for NBBY */
#ifdef __FreeBSD__
typedef off_t loff_t;
#endif
/*
* On musl, loff_t is a macro within fcntl.h when _GNU_SOURCE is defined.
* If no macro is defined, a typedef fallback is provided.
*/
#if defined(__linux__) && !defined(__GLIBC__)
#include <fcntl.h>
#ifndef loff_t
typedef off_t loff_t;
#endif
#endif
#endif
+1 -1
View File
@@ -58,7 +58,7 @@ void
kstat_set_raw_ops(kstat_t *ksp,
int (*headers)(char *buf, size_t size),
int (*data)(char *buf, size_t size, void *data),
void *(*addr)(kstat_t *ksp, loff_t index))
void *(*addr)(kstat_t *ksp, off_t index))
{
(void) ksp, (void) headers, (void) data, (void) addr;
}