1 /*
2 * _sysctl() for uClibc
3 *
4 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
5 *
6 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
7 */
8
9 #include <sys/syscall.h>
10 #if defined __NR__sysctl && (defined __USE_GNU || defined __USE_BSD)
11
12 /* psm: including sys/sysctl.h would depend on kernel headers */
13 struct __sysctl_args {
14 int *name;
15 int nlen;
16 void *oldval;
17 size_t *oldlenp;
18 void *newval;
19 size_t newlen;
20 unsigned long __uclibc_unused[4];
21 };
22 extern int sysctl (int *__name, int __nlen, void *__oldval,
23 size_t *__oldlenp, void *__newval, size_t __newlen) __THROW;
sysctl(int * name,int nlen,void * oldval,size_t * oldlenp,void * newval,size_t newlen)24 int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
25 void *newval, size_t newlen)
26 {
27 /* avoid initializing on the stack as gcc will call memset() */
28 struct __sysctl_args args;
29 args.name = name;
30 args.nlen = nlen;
31 args.oldval = oldval;
32 args.oldlenp = oldlenp;
33 args.newval = newval;
34 args.newlen = newlen;
35 return INLINE_SYSCALL(_sysctl, 1, &args);
36 }
37 #endif
38