summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/unistd.h1
-rw-r--r--lib/libc/gen/sysconf.c9
-rw-r--r--sys/kern/sched_ule.c11
3 files changed, 21 insertions, 0 deletions
diff --git a/include/unistd.h b/include/unistd.h
index 4ae6917..34f187c 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -288,6 +288,7 @@ typedef __useconds_t useconds_t;
#if __BSD_VISIBLE
#define _SC_NPROCESSORS_CONF 57
#define _SC_NPROCESSORS_ONLN 58
+#define _SC_CPUSET_SIZE 122
#endif
/* Extensions found in Solaris and Linux. */
diff --git a/lib/libc/gen/sysconf.c b/lib/libc/gen/sysconf.c
index 4618f32..7539d61 100644
--- a/lib/libc/gen/sysconf.c
+++ b/lib/libc/gen/sysconf.c
@@ -597,6 +597,15 @@ yesno:
return (lvalue);
#endif
+#ifdef _SC_CPUSET_SIZE
+ case _SC_CPUSET_SIZE:
+ len = sizeof(lvalue);
+ if (sysctlbyname("kern.sched.cpusetsize", &lvalue, &len, NULL,
+ 0) == -1)
+ return (-1);
+ return (lvalue);
+#endif
+
default:
errno = EINVAL;
return (-1);
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index 4765c1c..641979d 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -2712,6 +2712,8 @@ sysctl_kern_sched_topology_spec(SYSCTL_HANDLER_ARGS)
sbuf_delete(topo);
return (err);
}
+
+static size_t _kern_cpuset_size = sizeof(cpuset_t);
#endif
SYSCTL_NODE(_kern, OID_AUTO, sched, CTLFLAG_RW, 0, "Scheduler");
@@ -2748,6 +2750,15 @@ SYSCTL_INT(_kern_sched, OID_AUTO, steal_thresh, CTLFLAG_RW, &steal_thresh, 0,
SYSCTL_PROC(_kern_sched, OID_AUTO, topology_spec, CTLTYPE_STRING |
CTLFLAG_RD, NULL, 0, sysctl_kern_sched_topology_spec, "A",
"XML dump of detected CPU topology");
+
+/*
+ * Return the size of cpuset_t at the kernel level
+ *
+ * XXX (gcooper): replace ULONG with SIZE once CTLTYPE_SIZE is implemented.
+ */
+SYSCTL_ULONG(_kern_sched, OID_AUTO, cpusetsize, CTLFLAG_RD,
+ &_kern_cpuset_size, 0, "Kernel-level cpuset_t struct size");
+
#endif
/* ps compat. All cpu percentages from ULE are weighted. */
OpenPOWER on IntegriCloud