diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-10-22 00:43:19 -0400 |
---|---|---|
committer | Austin Foxley <austinf@cetoncorp.com> | 2009-11-09 15:43:08 -0800 |
commit | c7e422bb73ab4ee374817fc8e51d49f4964745ca (patch) | |
tree | 59c05aae7f893285b1551d50b422c2044b348865 /libc/sysdeps/linux/common/sysctl.c | |
parent | fc88e8a6091ee0b8d238635fb5328f552741ccc9 (diff) | |
download | uClibc-alpine-c7e422bb73ab4ee374817fc8e51d49f4964745ca.tar.bz2 uClibc-alpine-c7e422bb73ab4ee374817fc8e51d49f4964745ca.tar.xz |
sysctl: avoid inline initialization
Assign each field one by one rather than stack initialization as gcc will
call memset() to zero out the rest of the structure -- which we don't care
about as the field is unused and not seen outside of the libc.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
Diffstat (limited to 'libc/sysdeps/linux/common/sysctl.c')
-rw-r--r-- | libc/sysdeps/linux/common/sysctl.c | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/libc/sysdeps/linux/common/sysctl.c b/libc/sysdeps/linux/common/sysctl.c index 11d53cd8e..f65a3eaa2 100644 --- a/libc/sysdeps/linux/common/sysctl.c +++ b/libc/sysdeps/linux/common/sysctl.c @@ -10,10 +10,6 @@ #include <sys/syscall.h> #if defined __NR__sysctl && (defined __USE_GNU || defined __USE_BSD) -/* psm: including sys/sysctl.h would depend on kernel headers */ -extern int sysctl (int *__name, int __nlen, void *__oldval, - size_t *__oldlenp, void *__newval, size_t __newlen) __THROW; - struct __sysctl_args { int *name; int nlen; @@ -24,21 +20,17 @@ struct __sysctl_args { unsigned long __unused[4]; }; -static __always_inline -_syscall1(int, _sysctl, struct __sysctl_args *, args) - 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 _sysctl(&args); + /* avoid initializing on the stack as gcc will call memset() */ + struct __sysctl_args args; + args.name = name; + args.nlen = nlen; + args.oldval = oldval; + args.oldlenp = oldlenp; + args.newval = newval; + args.newlen = newlen; + return INLINE_SYSCALL(_sysctl, 1, &args); } #endif |