blob: dde00be46c8a2f151480c667171d96cd2fc4b840 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/* 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 */
14struct __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};
23extern int sysctl (int *__name, int __nlen, void *__oldval,
24 size_t *__oldlenp, void *__newval, size_t __newlen) __THROW;
25int 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