summaryrefslogtreecommitdiff
path: root/libgcompat/sysctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgcompat/sysctl.c')
-rw-r--r--libgcompat/sysctl.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/libgcompat/sysctl.c b/libgcompat/sysctl.c
new file mode 100644
index 0000000..5671055
--- /dev/null
+++ b/libgcompat/sysctl.c
@@ -0,0 +1,28 @@
+#include <errno.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+
+
+struct __sysctl_args {
+ int *name;
+ int nlen;
+ void *oldval;
+ size_t *oldlenp;
+ void *newval;
+ size_t newlen;
+};
+
+
+int sysctl (int *name, int nlen, void *oldval, size_t *oldlenp, void *newval, size_t newlen) {
+ struct __sysctl_args args = {
+ .name = name,
+ .nlen = nlen,
+ .oldval = oldval,
+ .oldlenp = oldlenp,
+ .newval = newval,
+ .newlen = newlen
+ };
+
+ return syscall(SYS__sysctl, &args);
+}