git: 87632ddf67b0 - main - openzfs sys/types32.h: use abi_compat.h for time32_t
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 09 Feb 2026 19:07:04 UTC
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=87632ddf67b01f3d4787d10332afc1eeece52e2d
commit 87632ddf67b01f3d4787d10332afc1eeece52e2d
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-02-06 23:47:13 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-02-09 18:57:20 +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
---
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 5b7131923460..cb2ef27cf933 100644
--- a/sys/contrib/openzfs/include/os/freebsd/spl/sys/types32.h
+++ b/sys/contrib/openzfs/include/os/freebsd/spl/sys/types32.h
@@ -30,9 +30,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 1bcae20187ad..850435b29f2a 100644
--- a/sys/contrib/openzfs/lib/libspl/include/sys/types32.h
+++ b/sys/contrib/openzfs/lib/libspl/include/sys/types32.h
@@ -63,7 +63,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)