If you call glibc's syscall wrapper like so: static int name[] = { CTL_NET, NET_IPV4, NET_IPV4_LOCAL_PORT_RANGE }; int buffer[2] = { 32768, 61000 }; size_t size = sizeof(buffer); sysctl(name, 3, 0, 0, buffer, size); (note that oldval/oldlenp are NULL). The current strace code complains like so: _sysctl({{CTL_NET, NET_IPV4, NET_IPV4_LOCAL_PORT_RANGE, 38}, 3, process_vm_readv: Bad address (nil), 0, 0x7fffe23c3960, 8}) = -1 EACCES (Permission denied) Since passing NULL for the old values is valid, handle that explicitly. This also simplifies the code a bit by splitting up the handling of the new and old args so that we only handle the new args once. Now the output looks like: _sysctl({{CTL_NET, NET_IPV4, NET_IPV4_LOCAL_PORT_RANGE, 38}, 3, NULL, 0, 0x7fff8c0c91b0, 8) = -1 EACCES (Permission denied) * system.c (sys_sysctl): Check if info.oldval is NULL first. Move the processing of oldlen/info.newval/info.newlen out so they always get executed. Fix the format strings so we use %lu for unsigned long rather than a mix of %ld and %lu. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
This is strace, a system call tracer for Linux. strace is released under a Berkeley-style license at the request of Paul Kranenburg; see the file COPYRIGHT for details. See the file CREDITS for a list of authors and other contributors. See the file INSTALL for compilation and installation instructions. See the file NEWS for information on what has changed in recent versions. You can get the latest version of strace from its homepage at http://sourceforge.net/projects/strace/ . Please send bug reports and enhancements to the strace mailinglist at strace-devel@lists.sourceforge.net.
Description
Languages
C
92.2%
Shell
3.4%
M4
1.4%
Makefile
0.8%
Roff
0.7%
Other
1.5%