git: 9213578be26b - stable/15 - kern/sched: Hide scheduler selection from C++
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 27 Aug 2026 06:34:32 UTC
The branch stable/15 has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=9213578be26bea80095a7e6c624c76480c4ed2e6
commit 9213578be26bea80095a7e6c624c76480c4ed2e6
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-08-20 13:57:56 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-08-27 06:33:50 +0000
kern/sched: Hide scheduler selection from C++
The scheduler selection interface uses names that are reserved words in
C++, causing problems for downstream projects that use C++ in the
kernel. Work around this by hiding the interface from C++ compilers
until we can come up with a better solution.
Fixes: ce38acee8d0b ("Add kern/sched_shim.c")
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: siderop1_netapp.com, imp, kib
Differential Revision: https://reviews.freebsd.org/D58991
(cherry picked from commit f2366851616083f923e8101363802678a03dc0b9)
---
sys/sys/sched.h | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/sys/sys/sched.h b/sys/sys/sched.h
index c7b7b849947c..cd0f3d77b39c 100644
--- a/sys/sys/sched.h
+++ b/sys/sys/sched.h
@@ -272,6 +272,13 @@ bool sched_do_timer_accounting(void);
*/
int sched_find_l2_neighbor(int cpu);
+/*
+ * The scheduler selection interface uses names that are reserved words in
+ * C++, causing problems for downstream projects that use C++ in the
+ * kernel.
+ */
+#ifndef __cplusplus
+
struct sched_instance {
int (*load)(void);
int (*rr_interval)(void);
@@ -337,6 +344,8 @@ struct sched_selection {
void sched_instance_select(void);
+#endif /* !__cplusplus */
+
#endif /* _KERNEL */
/* POSIX 1003.1b Process Scheduling */
@@ -363,7 +372,7 @@ struct sched_param {
#ifndef _PID_T_DECLARED
typedef __pid_t pid_t;
#define _PID_T_DECLARED
-#endif
+#endif /* !_PID_T_DECLARED */
__BEGIN_DECLS
int sched_get_priority_max(int);
@@ -376,5 +385,6 @@ int sched_setscheduler(pid_t, int, const struct sched_param *);
int sched_yield(void);
__END_DECLS
-#endif
+#endif /* !_KERNEL */
+
#endif /* !_SCHED_H_ */