Page MenuHomeFreeBSD

kern/sched: Hide scheduler selection from C++
ClosedPublic

Authored by des on Wed, Aug 19, 4:48 PM.
Tags
None
Referenced Files
F167315944: D58991.diff
Thu, Aug 20, 8:55 PM
Unknown Object (File)
Wed, Aug 19, 5:16 PM
Unknown Object (File)
Wed, Aug 19, 5:16 PM

Details

Summary

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.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

des requested review of this revision.Wed, Aug 19, 4:48 PM
siderop1_netapp.com added inline comments.
sys/sys/sched.h
287

What's the concern/issue with just renaming these members to something like classifier or whatnot?

sys/sys/sched.h
287

The entire scheduler API is generated by macros based on these fields. Changing class and throw here forces us to also rename sched_class() and sched_throw(), which have been part of the published scheduler API for years.

des marked an inline comment as done.Wed, Aug 19, 5:33 PM
siderop1_netapp.com added inline comments.
sys/sys/sched.h
287

Thanks for the explanation.

This revision is now accepted and ready to land.Wed, Aug 19, 5:42 PM

This is fine. The only other viable change would be to use class_ or something like that when C++ is defined, but that's a bit too ugly absent some better articulated use case. C++ in the kernel isn't officially supported, though I know of various people that have made it kinda work over the years.

This revision was automatically updated to reflect the committed changes.