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
This commit is contained in:
Konstantin Belousov
2026-02-07 01:47:13 +02:00
parent 31fab77361
commit 87632ddf67
3 changed files with 13 additions and 2 deletions
@@ -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 */
@@ -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 {
+6 -1
View File
@@ -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)