git: 7320170ff210 - stable/14 - openzfs sys/types32.h: use abi_compat.h for time32_t
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 12 Apr 2026 05:57:17 UTC
The branch stable/14 has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=7320170ff210cc1da1f36e73130de7e2e62a867b
commit 7320170ff210cc1da1f36e73130de7e2e62a867b
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-02-06 23:47:13 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-04-12 05:56:46 +0000
openzfs sys/types32.h: use abi_compat.h for time32_t
The time32_t typedef leaks into openzfs compilation environment
through sys/event.h. Simultaneously, openzfs provides its own
definition that is only correct for amd64 on FreeBSD.
Try to fix it by using sys/abi_compat.h directly. Since toolchain build
from the make buildworld uses host abi_compat.h, add a preprocessor
symbol __HAVE_TIME32_T to signal consumers that time32_t is typedef'ed.
If not defined, fall back to old and wrong time32_t, which is enough for
bootstraping toolchain.
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D55135
(cherry picked from commit 87632ddf67b01f3d4787d10332afc1eeece52e2d)
---
sys/contrib/openzfs/include/os/freebsd/spl/sys/types32.h | 3 ++-
sys/contrib/openzfs/lib/libspl/include/sys/types32.h | 5 +++++
sys/sys/abi_compat.h | 7 ++++++-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/sys/contrib/openzfs/include/os/freebsd/spl/sys/types32.h b/sys/contrib/openzfs/include/os/freebsd/spl/sys/types32.h
index 907b667e5d80..1b84f84a2ee7 100644
--- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/types32.h
+++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/types32.h
@@ -29,9 +29,10 @@
#ifndef _SPL_TYPES32_H
#define _SPL_TYPES32_H
+#include <sys/abi_compat.h>
+
typedef uint32_t caddr32_t;
typedef int32_t daddr32_t;
-typedef int32_t time32_t;
typedef uint32_t size32_t;
#endif /* _SPL_TYPES32_H */
diff --git a/sys/contrib/openzfs/lib/libspl/include/sys/types32.h b/sys/contrib/openzfs/lib/libspl/include/sys/types32.h
index d065ebed03b7..81e7f3d7886a 100644
--- a/sys/contrib/openzfs/lib/libspl/include/sys/types32.h
+++ b/sys/contrib/openzfs/lib/libspl/include/sys/types32.h
@@ -62,7 +62,12 @@ typedef uint32_t dev32_t;
typedef int32_t pid32_t;
typedef uint32_t size32_t;
typedef int32_t ssize32_t;
+#ifdef __FreeBSD__
+#include <sys/abi_compat.h>
+#endif
+#ifndef __HAVE_TIME32_T
typedef int32_t time32_t;
+#endif
typedef int32_t clock32_t;
typedef struct timespec32 {
diff --git a/sys/sys/abi_compat.h b/sys/sys/abi_compat.h
index 69fb349edc7a..f190dcda9b68 100644
--- a/sys/sys/abi_compat.h
+++ b/sys/sys/abi_compat.h
@@ -52,11 +52,16 @@ typedef struct {
#endif
} freebsd32_uint64_t;
-#ifdef __amd64__
+#if __SIZEOF_LONG__ == 8
+#if defined __amd64__
typedef __int32_t time32_t;
#else
typedef __int64_t time32_t;
#endif
+#else
+typedef __int32_t time32_t;
+#endif
+#define __HAVE_TIME32_T
#define PTRIN(v) (void *)(uintptr_t)(v)
#define PTROUT(v) (uintptr_t)(v)