The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=ecadac729a1b855fe0d77a682ee424c3da1eb3db
commit ecadac729a1b855fe0d77a682ee424c3da1eb3db Author: Konstantin Belousov <[email protected]> AuthorDate: 2026-02-09 20:13:21 +0000 Commit: Konstantin Belousov <[email protected]> CommitDate: 2026-02-10 02:10:11 +0000 sys/event.h: reduce namespace pollution from sys/abi_compat.h Split out types definitions into sys/abi_types.h, and only include abi_types.h into sys/event.h. Tested and reviewed by: bz Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D55202 --- sys/dev/mfi/mfi.c | 5 +++-- sys/sys/abi_compat.h | 30 +----------------------------- sys/sys/abi_types.h | 39 +++++++++++++++++++++++++++++++++++++++ sys/sys/event.h | 2 +- 4 files changed, 44 insertions(+), 32 deletions(-) diff --git a/sys/dev/mfi/mfi.c b/sys/dev/mfi/mfi.c index 474afcff60a7..8ad343d6d813 100644 --- a/sys/dev/mfi/mfi.c +++ b/sys/dev/mfi/mfi.c @@ -52,11 +52,12 @@ * SUCH DAMAGE. */ -#include <sys/cdefs.h> #include "opt_mfi.h" -#include <sys/param.h> #include <sys/systm.h> +#ifdef COMPAT_FREEBSD32 +#include <sys/abi_compat.h> +#endif #include <sys/sysctl.h> #include <sys/malloc.h> #include <sys/kernel.h> diff --git a/sys/sys/abi_compat.h b/sys/sys/abi_compat.h index f190dcda9b68..e696f0bae9db 100644 --- a/sys/sys/abi_compat.h +++ b/sys/sys/abi_compat.h @@ -4,11 +4,6 @@ * Copyright (c) 2001 Doug Rabson * All rights reserved. * - * Copyright 2026 The FreeBSD Foundation - * - * Portions of this software were developed by Konstantin Belousov - * under sponsorship from the FreeBSD Foundation. - * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -34,35 +29,12 @@ #ifndef _ABI_COMPAT_H_ #define _ABI_COMPAT_H_ -#include <sys/_types.h> +#include <sys/abi_types.h> /* * Helper types and macros for translating objects between different ABIs. */ -/* - * i386 is the only arch with a 32-bit time_t. - * Also it is the only arch with (u)int64_t having 4-bytes alignment. - */ -typedef struct { -#ifdef __amd64__ - __uint32_t val[2]; -#else - __uint64_t val; -#endif -} freebsd32_uint64_t; - -#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) diff --git a/sys/sys/abi_types.h b/sys/sys/abi_types.h new file mode 100644 index 000000000000..e449c86323f7 --- /dev/null +++ b/sys/sys/abi_types.h @@ -0,0 +1,39 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2026 The FreeBSD Foundation + * + * Portions of this software were developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + */ + +#ifndef _ABI_TYPES_H_ +#define _ABI_TYPES_H_ + +#include <sys/_types.h> + +/* + * i386 is the only arch with a 32-bit time_t. + * Also it is the only arch with (u)int64_t having 4-bytes alignment. + */ +typedef struct { +#ifdef __amd64__ + __uint32_t val[2]; +#else + __uint64_t val; +#endif +} freebsd32_uint64_t; + +#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 + +#endif diff --git a/sys/sys/event.h b/sys/sys/event.h index 0ba8e4796208..70d2926d1943 100644 --- a/sys/sys/event.h +++ b/sys/sys/event.h @@ -104,7 +104,7 @@ struct freebsd11_kevent { #endif #if defined(_WANT_KEVENT32) || defined(_KERNEL) -#include <sys/abi_compat.h> +#include <sys/abi_types.h> struct kevent32 { __uint32_t ident; /* identifier for this event */
