From: cheloha Date: Sun, 14 Jan 2024 17:11:55 +0000 (+0000) Subject: sys/sched.h: conceal struct schedstate_percpu definition from userspace X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=065d92b5dfff2cb2ac74d9d132047b58d687f233;p=openbsd sys/sched.h: conceal struct schedstate_percpu definition from userspace struct schedstate_perpcu contains struct clockintr pointers. struct clockintr is not defined in userspace, so move schedstate_percpu into the _KERNEL guard to hide it from userspace. Nothing in base userspace uses schedstate_percpu. Thread: https://marc.info/?l=openbsd-tech&m=169861224916185&w=2 ok claudio@ millert@ --- diff --git a/sys/sys/sched.h b/sys/sys/sched.h index 5a07f971893..e86d6b64727 100644 --- a/sys/sys/sched.h +++ b/sys/sys/sched.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sched.h,v 1.67 2023/10/24 13:20:11 claudio Exp $ */ +/* $OpenBSD: sched.h,v 1.68 2024/01/14 17:11:55 cheloha Exp $ */ /* $NetBSD: sched.h,v 1.2 1999/02/28 18:14:58 ross Exp $ */ /*- @@ -88,6 +88,15 @@ #define CP_IDLE 5 #define CPUSTATES 6 +struct cpustats { + uint64_t cs_time[CPUSTATES]; /* CPU state statistics */ + uint64_t cs_flags; /* see below */ +}; + +#define CPUSTATS_ONLINE 0x0001 /* CPU is schedulable */ + +#ifdef _KERNEL + #define SCHED_NQS 32 /* 32 run queues. */ struct clockintr; @@ -124,15 +133,6 @@ struct schedstate_percpu { u_char spc_smrgp; /* this CPU's view of grace period */ }; -struct cpustats { - uint64_t cs_time[CPUSTATES]; /* CPU state statistics */ - uint64_t cs_flags; /* see below */ -}; - -#define CPUSTATS_ONLINE 0x0001 /* CPU is schedulable */ - -#ifdef _KERNEL - /* spc_flags */ #define SPCF_SEENRR 0x0001 /* process has seen roundrobin() */ #define SPCF_SHOULDYIELD 0x0002 /* process should yield the CPU */