The _* headers are for structure definitions and should avoid
dependencies on other headers. This convention is violated by using
BEGIN_DECLS/END_DECLS.
Move the declarations to cpuset.h, I see no reason they can't be there.
Differential D56856
cpuset: Move userspace declarations out of _cpuset.h Authored by markj on Wed, May 6, 5:27 PM. Tags None Referenced Files
Details The _* headers are for structure definitions and should avoid Move the declarations to cpuset.h, I see no reason they can't be there.
Diff Detail
Event TimelineComment Actions I suspect the idea was that internal functions (prefixed by __) should be in an "internal" header sys/sys/_cpuset.h, except that's not the meaning of the _-prefixed header. Not sure why __cpuset_alloc() and __cpuset_free() are even provided. They are not used in the tree. Comment Actions There are some tests which use the CPU_ALLOC wrapper. glibc provides a similar macro so I guess it's to provide compatibility. Comment Actions Yes, I missed that we have a CPU_ALLOC() wrapper too. (glibc defines this macro as an alias to __sched_cpualloc().) Comment Actions I'm not sure though this header is standalone, as I see references to size_t. That API is documented in the man page to require sys/param.h, but perhaps it would be better to add sys/types.h in the !KERNEL section. Comment Actions Sure, I may try to fix that too. My larger goal is to land D56857 and the patch below (which I suspect will break a lot of code in the ports tree, so may take a lot of work). commit d6a6e4d6a7a7b2a4dc4222ce80850d3052573f56 (HEAD -> main-mount-pollution) Author: Mark Johnston <markj@FreeBSD.org> Date: Wed May 6 19:49:52 2026 +0000 ucred.h: Do not include audit.h unconditionally audit.h is included because struct ucred embeds a struct auditinfo_addr, which is defined in audit.h. But struct ucred is not visible to userspace by default, so we shouldn't be including audit.h by default either, especially since audit.h pulls in param.h, which pollutes the namespace. (In particular it pulls in machine/param.h, which #defines "MACHINE", which makes the QEMU build unhappy.) MFC after: 1 week diff --git a/sys/sys/ucred.h b/sys/sys/ucred.h index ba241cf9ff3a..0685e06f3f10 100644 --- a/sys/sys/ucred.h +++ b/sys/sys/ucred.h @@ -36,8 +36,8 @@ #if defined(_KERNEL) || defined(_WANT_UCRED) #include <sys/_lock.h> #include <sys/_mutex.h> -#endif #include <bsm/audit.h> +#endif #if defined(_KERNEL) || defined(_WANT_UCRED) /* Comment Actions I don't see any need to define these in all the headers that need type definitions.
| ||||||||||||||||||||||||||||||||||||||||