diff options
| author | Ryan Libby <rlibby@FreeBSD.org> | 2026-05-08 19:37:24 +0000 |
|---|---|---|
| committer | Ryan Libby <rlibby@FreeBSD.org> | 2026-05-08 19:37:24 +0000 |
| commit | 94323513dd5070bf1fc3c191c560bd7e17da8931 (patch) | |
| tree | d4566f2b099264b6084ccc93f8710f2d4cd79540 | |
| parent | d9b272a19d39f71665b529860bfed731bcfd99f5 (diff) | |
types: provide __SIZEOF_{INT{8,16,32,64},TIME,TIME32}_T
Suggested by: kib
Reviewed by: imp, kib
Discussed with: emaste, jrtc27
Differential Revision: https://reviews.freebsd.org/D56783
| -rw-r--r-- | sys/arm/include/_types.h | 1 | ||||
| -rw-r--r-- | sys/arm64/include/_types.h | 1 | ||||
| -rw-r--r-- | sys/powerpc/include/_types.h | 1 | ||||
| -rw-r--r-- | sys/riscv/include/_types.h | 1 | ||||
| -rw-r--r-- | sys/sys/_types.h | 5 | ||||
| -rw-r--r-- | sys/sys/abi_types.h | 2 | ||||
| -rw-r--r-- | sys/x86/include/_types.h | 2 |
7 files changed, 13 insertions, 0 deletions
diff --git a/sys/arm/include/_types.h b/sys/arm/include/_types.h index 7319d950443b..9fde5fc5d7c9 100644 --- a/sys/arm/include/_types.h +++ b/sys/arm/include/_types.h @@ -57,6 +57,7 @@ typedef __int64_t __int_fast64_t; typedef __int32_t __register_t; typedef __int32_t __segsz_t; /* segment size (in pages) */ typedef __int64_t __time_t; /* time()... */ +#define __SIZEOF_TIME_T __SIZEOF_INT64_T typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; diff --git a/sys/arm64/include/_types.h b/sys/arm64/include/_types.h index 98f7dea67520..c46f64b2b252 100644 --- a/sys/arm64/include/_types.h +++ b/sys/arm64/include/_types.h @@ -55,6 +55,7 @@ typedef __int64_t __int_fast64_t; typedef __int64_t __register_t; typedef __int64_t __segsz_t; /* segment size (in pages) */ typedef __int64_t __time_t; /* time()... */ +#define __SIZEOF_TIME_T __SIZEOF_INT64_T typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; diff --git a/sys/powerpc/include/_types.h b/sys/powerpc/include/_types.h index 33cc6e731b50..746f9a4837c6 100644 --- a/sys/powerpc/include/_types.h +++ b/sys/powerpc/include/_types.h @@ -66,6 +66,7 @@ typedef __int32_t __register_t; typedef __int32_t __segsz_t; /* segment size (in pages) */ #endif typedef __int64_t __time_t; /* time()... */ +#define __SIZEOF_TIME_T __SIZEOF_INT64_T typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; diff --git a/sys/riscv/include/_types.h b/sys/riscv/include/_types.h index 3e9abd27a156..a9f95d4b6839 100644 --- a/sys/riscv/include/_types.h +++ b/sys/riscv/include/_types.h @@ -51,6 +51,7 @@ typedef __int64_t __int_fast64_t; typedef __int64_t __register_t; typedef __int64_t __segsz_t; /* segment size (in pages) */ typedef __int64_t __time_t; /* time()... */ +#define __SIZEOF_TIME_T __SIZEOF_INT64_T typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; diff --git a/sys/sys/_types.h b/sys/sys/_types.h index a2ee83a862da..bc438c17c8c0 100644 --- a/sys/sys/_types.h +++ b/sys/sys/_types.h @@ -40,18 +40,23 @@ */ typedef signed char __int8_t; typedef unsigned char __uint8_t; +#define __SIZEOF_INT8_T __SIZEOF_CHAR__ typedef short __int16_t; typedef unsigned short __uint16_t; +#define __SIZEOF_INT16_T __SIZEOF_SHORT__ typedef int __int32_t; typedef unsigned int __uint32_t; +#define __SIZEOF_INT32_T __SIZEOF_INT__ #if __SIZEOF_LONG__ == 8 typedef long __int64_t; typedef unsigned long __uint64_t; +#define __SIZEOF_INT64_T __SIZEOF_LONG__ #elif __SIZEOF_LONG__ == 4 __extension__ typedef long long __int64_t; __extension__ typedef unsigned long long __uint64_t; +#define __SIZEOF_INT64_T __SIZEOF_LONG_LONG__ #else #error unsupported long size #endif diff --git a/sys/sys/abi_types.h b/sys/sys/abi_types.h index 44d1bd733bbd..ddacd08ff011 100644 --- a/sys/sys/abi_types.h +++ b/sys/sys/abi_types.h @@ -27,8 +27,10 @@ typedef struct { #if defined(__amd64__) || defined(__i386__) typedef __int32_t time32_t; +#define __SIZEOF_TIME32_T __SIZEOF_INT32_T #else typedef __int64_t time32_t; +#define __SIZEOF_TIME32_T __SIZEOF_INT64_T #endif #define __HAVE_TIME32_T diff --git a/sys/x86/include/_types.h b/sys/x86/include/_types.h index b33dc0bfc7af..2630af1257c7 100644 --- a/sys/x86/include/_types.h +++ b/sys/x86/include/_types.h @@ -71,10 +71,12 @@ typedef __int64_t __int_fast64_t; typedef __int64_t __register_t; typedef __int64_t __segsz_t; /* segment size (in pages) */ typedef __int64_t __time_t; /* time()... */ +#define __SIZEOF_TIME_T __SIZEOF_INT64_T #else typedef __int32_t __register_t; typedef __int32_t __segsz_t; typedef __int32_t __time_t; +#define __SIZEOF_TIME_T __SIZEOF_INT32_T #endif typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; |
