summaryrefslogtreecommitdiff
path: root/libgcompat/sysctl.c
blob: a14c2b85edda50ee0e5313f674a2f8f82d76eecb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <unistd.h>	/* size_t */
#include <sys/syscall.h>


#ifdef SYS__sysctl

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);
}

#endif /* SYS__sysctl */