Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 16 Feb 2026 10:30:16 +0000
From:      Olivier Certner <olce@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 4ccca2100887 - main - sys/abi_types.h: time32_t is 64-bit on non-x86 architectures
Message-ID:  <6992f1b8.25378.59b9bc83@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=4ccca2100887943b11187787004bc8efc2a149c6

commit 4ccca2100887943b11187787004bc8efc2a149c6
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2026-02-13 17:20:13 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2026-02-16 10:29:04 +0000

    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
---
 sys/sys/abi_types.h | 6 +-----
 1 file changed, 1 insertion(+), 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


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6992f1b8.25378.59b9bc83>