diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2021-11-11 08:01:54 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2021-11-13 17:27:54 +0000 |
commit | 90fa9705d5cd29cf11c5dc7319299788dec2546a (patch) | |
tree | d525cef4353363429970178a4e1ec762cbe141dd /include | |
parent | ef396441ceb8bce4e5d7382ff7c76928721297a3 (diff) | |
download | src-90fa9705d5cd29cf11c5dc7319299788dec2546a.tar.gz src-90fa9705d5cd29cf11c5dc7319299788dec2546a.zip |
sched.h: Hide all Linux compat sched_* functions under _WITH_CPU_SET_T
Instead of only hiding cpu_set_t compat typedef itself.
Too many software packages assume that sched_getaffinity() presence
implies full source compatibility with glibc. We can (and should)
handle missing CPU_* macros, but then there are incompatible BIT_* uses
which cannot be fixed in src/.
So hide everything under _WITH_CPU_SET_T, in particular, do not expose
sched_getcpu(), sched_get/setaffinity(), as well as CPU_* and BIT_*
macros. Consumers that want sched* functions must opt-in.
Reported by: portmgr (antoine)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Diffstat (limited to 'include')
-rw-r--r-- | include/sched.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/include/sched.h b/include/sched.h index 1c41cda79046..460d3bfed154 100644 --- a/include/sched.h +++ b/include/sched.h @@ -33,11 +33,8 @@ #include <sys/types.h> #include <sys/sched.h> #if __BSD_VISIBLE -#include <sys/cpuset.h> -#endif /* __BSD_VISIBLE */ - -#if __BSD_VISIBLE #ifdef _WITH_CPU_SET_T +#include <sys/cpuset.h> struct _cpuset; typedef struct _cpuset cpu_set_t; #endif /* _WITH_CPU_SET_T */ @@ -45,9 +42,11 @@ typedef struct _cpuset cpu_set_t; __BEGIN_DECLS #if __BSD_VISIBLE +#ifdef _WITH_CPU_SET_T int sched_getaffinity(pid_t pid, size_t cpusetsz, cpuset_t *cpuset); int sched_setaffinity(int pid, size_t cpusetsz, const cpuset_t *cpuset); int sched_getcpu(void); +#endif /* _WITH_CPU_SET_T */ #endif /* __BSD_VISIBLE */ __END_DECLS |