On Tue, Oct 9, 2012 at 9:27 AM, Gregor Best <g...@ring0.de> wrote: > This patch moves struct schedstate_percpu to kernel land, which I think > is cleaner than exposing structures for scheduler state to userland, > especially since grepping for 'schedstate' in /usr/src yielded no > results outside of /usr/src/sys.
I think this is a misunderstanding about the intent of _KERNEL. There are, IMO, two reasons to condition parts of header files on _KERNEL: 1) the header's contents have been specified by a de facto or de jure standard, but for its own reasons the kernel wants to place additional info there. 2) the header defines kernel data structures that tools may need (for crash dump debugging, for example) as well as external symbols like functions and variables, declarations that can't be used by userspace. <sys/sched.h> isn't a standardized header and isn't pulled in by a standardized header, so (1) isn't an issue. So, only a non-standard program is going to be pulling in <sys/sched.h> anyway. Unless there's a reason otherwise, all types and #defines be exposed to it. (Yeah, the use of CP_* and CPUSTATES by the KERN_CPTIME* sysctl()s is less than ideal, but this isn't the right way to fix that, IMO.) Philip Guenther