diff options
| author | Olivier Certner <olce@FreeBSD.org> | 2026-02-13 17:20:13 +0000 |
|---|---|---|
| committer | Olivier Certner <olce@FreeBSD.org> | 2026-02-16 10:29:04 +0000 |
| commit | 4ccca2100887943b11187787004bc8efc2a149c6 (patch) | |
| tree | 04b6f66ed990d2d0d3fed09594b91f21d1fa0f58 | |
| parent | 7c2fc4419db43a8a7d1886b0b8e08aa97bfa31e4 (diff) | |
sys/abi_types.h: time32_t is 64-bit on non-x86 architectures
As long as 'sys/compat/freebsd32/freebsd32.h' is used unconditionally on
all platforms (in 'kern_umtx.c' at least), the rule of thumb is to
ensure that 'struct foo32' on a 32-bit arch is type-compatible with
'struct foo' on the same arch. In practice, this is very simple to
achieve: All 'foo32' types should be compatible with 'foo' on 32-bit
architectures, which is what we are supposed to do already for compat'
structures by design. The recently introduced 'freebsd32_uint64_t' type
typically supports that.
This change fixes commit 87632ddf67b0 ("openzfs sys/types32.h: use
abi_compat.h for time32_t") which was defining 'time32_t' to 'in32_t'
for all 32-bit architectures, which is wrong but on i386. By luck, this
did not change the size of whole 'struct ffclock_estimate32' (whose size
is compile-time asserted) because 'struct bintime32''s one would stay
the same, as even if its field 'sec' was incorrectly sized after that
commit, the 'frac' one is 64-bit and 64-bit aligned on all non-x86
architectures so its offset in 'struct bintime32' would stay the same.
Reviewed by: kib
Fixes: 87632ddf67b0 ("openzfs sys/types32.h: use abi_compat.h for time32_t")
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D55283
| -rw-r--r-- | sys/sys/abi_types.h | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/sys/sys/abi_types.h b/sys/sys/abi_types.h index e449c86323f7..44d1bd733bbd 100644 --- a/sys/sys/abi_types.h +++ b/sys/sys/abi_types.h @@ -25,15 +25,11 @@ typedef struct { #endif } freebsd32_uint64_t; -#if __SIZEOF_LONG__ == 8 -#if defined __amd64__ +#if defined(__amd64__) || defined(__i386__) typedef __int32_t time32_t; #else typedef __int64_t time32_t; #endif -#else -typedef __int32_t time32_t; -#endif #define __HAVE_TIME32_T #endif |
