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