sysctl.c 996 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. #include <sys/syscall.h>
  10. #if defined __NR__sysctl && (defined __USE_GNU || defined __USE_BSD)
  11. /* psm: including sys/sysctl.h would depend on kernel headers */
  12. extern int sysctl (int *__name, int __nlen, void *__oldval,
  13. size_t *__oldlenp, void *__newval, size_t __newlen) __THROW;
  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. static __always_inline
  24. _syscall1(int, _sysctl, struct __sysctl_args *, args)
  25. int sysctl(int *name, int nlen, void *oldval, size_t * oldlenp,
  26. void *newval, size_t newlen)
  27. {
  28. struct __sysctl_args args = {
  29. .name = name,
  30. .nlen = nlen,
  31. .oldval = oldval,
  32. .oldlenp = oldlenp,
  33. .newval = newval,
  34. .newlen = newlen
  35. };
  36. return _sysctl(&args);
  37. }
  38. #endif