]> granicus.if.org Git - strace/log
strace
12 years agoReindent preprocessor directives in util.c; fix style.
Denys Vlasenko [Sat, 25 Feb 2012 01:46:14 +0000 (02:46 +0100)]
Reindent preprocessor directives in util.c; fix style.

* util.c: Fix indentation of preprocessor directives broken by
automatic removal of non-Linux code. Fix style to use consistent
defined(FOO) instead of defined (FOO).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoReindent preprocessor directives in syscall.c; fix style.
Denys Vlasenko [Sat, 25 Feb 2012 01:44:25 +0000 (02:44 +0100)]
Reindent preprocessor directives in syscall.c; fix style.

* syscall.c: Fix indentation of preprocessor directives broken by
automatic removal of non-Linux code. Fix style to use consistent
defined(FOO) instead of defined (FOO).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoReindent defs.h preprocessor directives
Denys Vlasenko [Sat, 25 Feb 2012 01:42:32 +0000 (02:42 +0100)]
Reindent defs.h preprocessor directives

* defs.h: Fix indentation of preprocessor directives broken by
automatic removal of non-Linux code.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoCleanup after non-Linux code removal.
Denys Vlasenko [Sat, 25 Feb 2012 01:38:52 +0000 (02:38 +0100)]
Cleanup after non-Linux code removal.

Conditions such as defined(LINUX) are always true now,
defined(FREEBSD) etc are always false.
When if directive has them as subexpressions, it can be simplified.
Another trivial changes here are fixes for directive indentation.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoManual removal of non-Linux source, documentation, etc.
Denys Vlasenko [Sat, 25 Feb 2012 01:30:32 +0000 (02:30 +0100)]
Manual removal of non-Linux source, documentation, etc.

Remove non-Linux source directories: freebsd/, svr4/, sunos4/, svr4/.
Remove README-freebsd, README-sunos4, README-svr4, m4/procfs.m4.

linux/sparc/{errnoent1,ioctlent1,signalent1}.h used to point to svr4/ files -
replace their contents with copies of used (and now deleted) files.
Make linux/sparc64/{errnoent1,ioctlent1,signalent1}.h include these files
instead of svr4/* ones.

Makefile.am: remove references to deleted files.
configure.ac: Remove a few tests which make no sense on Linux.
Man page: remove non-Linux quirks information.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoAutomated removal of non-Linux code
Denys Vlasenko [Sat, 25 Feb 2012 01:24:03 +0000 (02:24 +0100)]
Automated removal of non-Linux code

This change is generated by running every source through the following command:

unifdef -DLINUX -Dlinux -USUNOS4 -USVR4 -UUNIXWARE -UFREEBSD
-USUNOS4_KERNEL_ARCH_KLUDGE -UHAVE_MP_PROCFS
-UHAVE_POLLABLE_PROCFS -UHAVE_PR_SYSCALL -UUSE_PROCFS file.c

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoWhen accessing data blocks, truncate addr to wordsize
Denys Vlasenko [Fri, 24 Feb 2012 23:43:22 +0000 (00:43 +0100)]
When accessing data blocks, truncate addr to wordsize

* util.c (umoven): Truncate addr to wordsize before use.

12 years agostrace.1: fix a typo
Dmitry V. Levin [Wed, 22 Feb 2012 00:29:44 +0000 (00:29 +0000)]
strace.1: fix a typo

* strace.1: Fix a typo in example description.
This fixes Debian bug #653309.

12 years agoFix sockaddr_un.sun_path name in decoded output
Dmitry V. Levin [Wed, 22 Feb 2012 00:23:52 +0000 (00:23 +0000)]
Fix sockaddr_un.sun_path name in decoded output

* net.c (printsock): Show sockaddr_un.sun_path as "sun_path".
This fixes Debian bug #554946.

12 years agoAvoid potential core file clobbering on exit
Dmitry V. Levin [Wed, 22 Feb 2012 00:15:27 +0000 (00:15 +0000)]
Avoid potential core file clobbering on exit

* strace.c (main): Set RLIMIT_CORE to zero before terminating itself
with a deadly signal.
This fixes Debian bug #656398.

12 years agoEliminate native_scno and known_scno
Dmitry V. Levin [Mon, 20 Feb 2012 21:44:53 +0000 (21:44 +0000)]
Eliminate native_scno and known_scno

* defs.h (known_scno): Remove.
(sysent): Remove native_scno field.
* process.c [IA64]: Replace known_scno(tcp) with tcp->scno.
(internal_fork) [USE_PROCFS || !LINUX]: Likewise.
* syscall.c: Do not define NR_SYSCALL_BASE.
(known_scno): Remove.
(syscall_fixup_on_sysenter) [USE_PROCFS]: Replace known_scno(tcp)
with tcp->scno.
(trace_syscall_entering) [SVR4 || FREEBSD || SUNOS4]: Likewise.
(syscall_fixup_on_sysexit) [SUNOS4]: Likewise.

12 years agoRemove initialization of native_scno field
Dmitry V. Levin [Mon, 20 Feb 2012 21:17:58 +0000 (21:17 +0000)]
Remove initialization of native_scno field

* linux/i386/syscallent.h: Remove native_scno initialization for clone,
fork and vfork.
* linux/ia64/syscallent.h (sys_fork, sys_vfork): Remove redirections
to printargs.
* linux/syscall.h [IA64]: Do not define SYS_fork and SYS_vfork.
* util.c (printcall) [IA64]: Likewise.
(setbpt): Use sys_func to check for clone, fork and vfork syscalls.

12 years agoDo not use SYS_ipc and SYS_socketcall
Dmitry V. Levin [Mon, 20 Feb 2012 17:02:38 +0000 (17:02 +0000)]
Do not use SYS_ipc and SYS_socketcall

* linux/dummy.h (sys_ipc, sys_socketcall): Remove redirections to
printargs.
* linux/ia64/syscallent.h: Likewise.
* linux/i386/syscallent.h: Remove native_scno initialization for "ipc"
and "socketcall".
* linux/syscall.h (sys_ipc, sys_socketcall): New prototypes.
(SYS_ipc, SYS_socketcall): Remove no longer used constants.
[IA64]: Remove undefining of ipc and socket SYS_* constants.
[SPARC || SPARC64]: Remove unused ipc SYS_* constants.
* ipc.c (sys_ipc): New function.
* sock.c (sys_socketcall): Likewise.
* syscall.c (trace_syscall_entering): Use sys_func to check for ipc and
socket subcalls.

12 years agoRemove initialization of native_scno field for most of syscalls
Dmitry V. Levin [Fri, 10 Feb 2012 22:33:36 +0000 (22:33 +0000)]
Remove initialization of native_scno field for most of syscalls

The native_scno field is not so much used in the code than before.
In many cases sys_func is checked instead, and for most of syscall
entries there is no need to initialize native_scno.

* linux/i386/syscallent.h: Remove native_scno initialization for
_exit, read, write, waitpid, execve, wait4, sysfs, readv, writev,
pread64, pwrite64, exit_group, waitid, send, recv, sendto and
recvfrom syscall entries.
* linux/syscall.h: Do not define no longer used SYS_waitid and
SYS_sub_* constants.
[IA64]: Do not define SYS_waitpid and SYS32_* constants.
* defs.h: Do not define no longer used  __NR_exit_group constant.
* strace.c [USE_PROCFS] (proc_open): Use sys_func to check for execve.

12 years agoutil: check for process_vm_readv in C library
Mike Frysinger [Tue, 14 Feb 2012 13:38:28 +0000 (14:38 +0100)]
util: check for process_vm_readv in C library

glibc-2.15 provides process_vm_readv, so trying to provide it ourselves
with that version fails.

* configure.ac (AC_CHECK_FUNCS): Add process_vm_readv.
* util.c: Handle HAVE_PROCESS_VM_READV.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agoREADME-linux-ptrace: correct the description of suppressed signals
Denys Vlasenko [Thu, 9 Feb 2012 18:57:52 +0000 (19:57 +0100)]
README-linux-ptrace: correct the description of suppressed signals

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agostrace -P: fix handling of invalid syscalls
Dmitry V. Levin [Mon, 6 Feb 2012 17:13:59 +0000 (17:13 +0000)]
strace -P: fix handling of invalid syscalls

* pathtrace.c (pathtrace_match): Check the given syscall number using
SCNO_IN_RANGE.

12 years agoSkip the syscall entry if the sys_func field is NULL
H.J. Lu [Fri, 3 Feb 2012 18:19:55 +0000 (10:19 -0800)]
Skip the syscall entry if the sys_func field is NULL

Avoid NULL dereference when there are holes in sysent tables.
It can happen with syscall (number, ...) and number is in those holes.
There are no targets with holey systent tables so far, but at least
one such a target, x32, is already on the horizon.

* defs.h (SCNO_IN_RANGE): Also check the sys_func field.

12 years agoDefine RLIM64_INFINITY only if not defined
H.J. Lu [Fri, 3 Feb 2012 18:17:01 +0000 (10:17 -0800)]
Define RLIM64_INFINITY only if not defined

* resource.c (RLIM64_INFINITY): Define only if it isn't defined.

12 years agoCast to long for %l in printf
H.J. Lu [Fri, 3 Feb 2012 18:16:03 +0000 (10:16 -0800)]
Cast to long for %l in printf

Cast a value to long for %l in printf to avoid compiler warning
on systems where it may be long long.

* count.c (call_summary_pers): Cast to long.
* ipc.c (sys_mq_open, printmqattr): Likewise.
* quota.c (decode_cmd_data): Likewise.
* resource.c (sys_sysinfo): Likewise.
* time.c (tprint_timex): Likewise.

12 years agoCheck HAVE_LONG_LONG_OFF_T when printing offset
H.J. Lu [Fri, 3 Feb 2012 18:12:10 +0000 (10:12 -0800)]
Check HAVE_LONG_LONG_OFF_T when printing offset

When HAVE_LONG_LONG_OFF_T is defined, we need to use %llu to print
offset.

* io.c (sys_sendfile): Check HAVE_LONG_LONG_OFF_T when printing
offset.

12 years agoDefine old stat functions only if needed
H.J. Lu [Fri, 3 Feb 2012 18:10:30 +0000 (10:10 -0800)]
Define old stat functions only if needed

When HAVE_LONG_LONG_OFF_T is defined, those old stat functions aren't
used and strace won't link since they use realprintstat which isn't
defined when HAVE_LONG_LONG_OFF_T is defined.

* file.c (convertoldstat, sys_oldstat, sys_oldfstat, sys_oldlstat):
Define only if HAVE_LONG_LONG_OFF_T isn't defined.

12 years agoPrint NULL for zero address in sys_mmap64
H.J. Lu [Fri, 3 Feb 2012 18:07:42 +0000 (10:07 -0800)]
Print NULL for zero address in sys_mmap64

* mem.c (sys_mmap64): Print NULL for zero address so that it is
consistent with sys_mmap.

12 years agoRemove unused sys_pread64 and sys_pwrite64 parsers on Linux
Dmitry V. Levin [Sat, 4 Feb 2012 15:17:43 +0000 (15:17 +0000)]
Remove unused sys_pread64 and sys_pwrite64 parsers on Linux

* io.c [HAVE_LONG_LONG_OFF_T]: Remove sys_pread64 and sys_pwrite64
aliases.
(sys_pread64, sys_pwrite64): Define these functions only on
[SVR4 && _LFS64_LARGEFILE] platform.
* linux/mips/syscallent.h: Use sys_pread and sys_pwrite to handle
appropriate syscalls.
* linux/syscall.h (sys_pread64, sys_pwrite64): Remove.
* syscall.c (dumpio): Check sys_pread64 and sys_pwrite64 only on
[SVR4 && _LFS64_LARGEFILE] platform.

12 years agoTrivial changes to help text. No code changes.
Denys Vlasenko [Fri, 3 Feb 2012 11:17:57 +0000 (12:17 +0100)]
Trivial changes to help text. No code changes.

* strace.c (usage): Tweak help text: remove unpaired closing brackets,
make -V and -h sit on separate lines (hard to see them otherwise).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoSimple optimizations
Denys Vlasenko [Sun, 29 Jan 2012 21:38:35 +0000 (22:38 +0100)]
Simple optimizations

   text    data     bss     dec     hex filename
 239474     672   20484  260630   3fa16 strace.before
 239234     668   19044  258946   3f382 strace

* file.c (sprint_open_modes): Reduce static buffer size.
Simplify separator printing.
* signal.c (sprintsigmask): Reduce static buffer size.
Simplify separator printing and printing of almost full masks.
Use stpcpy instead of sprintf and strcpy+strlen.
* strace.c (startup_child): Don't strchr() for ':' twice in a row.
* util.c (sprintflags): Exit loop early if possible.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoTrivial optimization
Denys Vlasenko [Sun, 29 Jan 2012 20:17:56 +0000 (21:17 +0100)]
Trivial optimization

* strace.c (cleanup): Read 'interrupted' volatile variable only once.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoMake interactive-ness directly controllable via command line option
Denys Vlasenko [Sun, 29 Jan 2012 15:53:03 +0000 (16:53 +0100)]
Make interactive-ness directly controllable via command line option

Defaults are often ok, but when they are not, people get confused.
"Why can't I kill strace?" and "Why strace dies on ^C when I want
to _tracee_ to die instead?" are typical complaints.

* strace.c: Replace 'interactive' variable with 'opt_intr' variable.
Define INTR_foo constants for its possible values.
Define 'interactive' as a macro.
(usage): Document -I n option.
(main): Parse -I n option, modify signal handling to accomidate new
-I 1 and -I 4 modes.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoSuppress compiler warning
Denys Vlasenko [Sun, 29 Jan 2012 15:46:46 +0000 (16:46 +0100)]
Suppress compiler warning

* strace.c (trace): Frame potentially unused label with ifdef/endif.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoOn Ctrl-C induced detach, send SIGINT to child tracee, not SIGTERM.
Denys Vlasenko [Sun, 29 Jan 2012 15:43:51 +0000 (16:43 +0100)]
On Ctrl-C induced detach, send SIGINT to child tracee, not SIGTERM.

* strace.c (interrupt): Remember signal number.
(cleanup): If we exiting due to signal, send that signal to child tracee.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoAdd experimental code to use PTRACE_SEIZE, disabled by default
Denys Vlasenko [Sun, 29 Jan 2012 01:01:44 +0000 (02:01 +0100)]
Add experimental code to use PTRACE_SEIZE, disabled by default

All new code is predicated on "ifdef USE_SEIZE". If it is not defined,
behavior is not changed.

If USE_SEIZE is enabled and run-time check shows that PTRACE_SEIZE works, then:
- All attaching is done with PTRACE_SEIZE + PTRACE_INTERRUPT.
  This means that we no longer generate (and possibly race with) SIGSTOP.
- PTRACE_EVENT_STOP will be generated if tracee is group-stopped.
  When we detect it, we issue PTRACE_LISTEN instead of PTRACE_SYSCALL.
  This leaves tracee stopped. This fixes the inability to SIGSTOP or ^Z
  a straced process.

* defs.h: Add commented-out "define USE_SEIZE 1" and define PTRACE_SEIZE
and related constants.
* strace.c: New variable post_attach_sigstop shows whether we age going
to expect SIGSTOP on attach (IOW: are we going to use PTRACE_SEIZE).
(ptrace_attach_or_seize): New function. Uses PTRACE_ATTACH or
PTRACE_SEIZE + PTRACE_INTERRUPT to attach to given pid.
(startup_attach): Use ptrace_attach_or_seize() instead of ptrace(PTRACE_ATTACH).
(startup_child): Conditionally use alternative attach method using PTRACE_SEIZE.
(test_ptrace_setoptions_followfork): More robust parameters to PTRACE_TRACEME.
(test_ptrace_seize): New function to test whether PTRACE_SEIZE works.
(main): Call test_ptrace_seize() while initializing.
(trace): If PTRACE_EVENT_STOP is seen, restart using PTRACE_LISTEN in order
to not let tracee run.
* process.c: Decode PTRACE_SEIZE, PTRACE_INTERRUPT, PTRACE_LISTEN.
* util.c (ptrace_restart): Add "LISTEN" to a possible error message.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoprocess_vm_readv gets EINVAL if process is gone (SIGKILLed). Don't complain.
Denys Vlasenko [Sat, 28 Jan 2012 01:49:48 +0000 (02:49 +0100)]
process_vm_readv gets EINVAL if process is gone (SIGKILLed). Don't complain.

* util.c (umoven): Don't complain on EINVAL from process_vm_readv.
(umovestr): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoRevert last change. Add a comment to prevent further misunderstanding
Denys Vlasenko [Sat, 28 Jan 2012 01:29:36 +0000 (02:29 +0100)]
Revert last change. Add a comment to prevent further misunderstanding

* time.c (sys_nanosleep): Display remaining time only on interrupt.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoFix nanosleep decoding: second argument was not shown after success
Denys Vlasenko [Sat, 28 Jan 2012 01:16:06 +0000 (02:16 +0100)]
Fix nanosleep decoding: second argument was not shown after success

* time.c (sys_nanosleep): Fix bug - inverted is_restart_error() check.
* syscall.c (is_restart_error): Remove redundant check.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoUse process_vm_readv instead of PTRACE_PEEKDATA to read data blocks
Denys Vlasenko [Sat, 28 Jan 2012 00:46:33 +0000 (01:46 +0100)]
Use process_vm_readv instead of PTRACE_PEEKDATA to read data blocks

Currently, we use PTRACE_PEEKDATA to read things like filenames and
data passed by I/O syscalls.
PTRACE_PEEKDATA gets one word per syscall. This is VERY expensive.
For example, in order to print fstat syscall, we need to perform
more than twenty trips into kernel to fetch one struct stat!

Kernel 3.2 got a new syscall, process_vm_readv(), which can be used to
copy data blocks out of process' address space.

This change uses it in umoven() and umovestr() functions if possible,
with fallback to old method if process_vm_readv() fails.
If it returns ENOSYS, we don't try to use it anymore, eliminating
overhead of trying it on older kernels.

Result of "time strace -oLOG ls -l /usr/lib >/dev/null":
before patch: 0.372s
After patch:  0.262s

* util.c (process_vm_readv): Wrapper to call process_vm_readv syscall.
(umoven): Use process_vm_readv for block reads of tracee memory.
(umovestr): Likewise.
* linux/syscall.h: Declare new function sys_process_vm_readv.
* process.c (sys_process_vm_readv): Decoder for new syscall.
* linux/i386/syscallent.h: Add process_vm_readv, process_vm_writev syscalls.
* linux/x86_64/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoFix a case of broken output if last seen syscall was exit
Denys Vlasenko [Sat, 28 Jan 2012 00:25:03 +0000 (01:25 +0100)]
Fix a case of broken output if last seen syscall was exit

* defs.h: Rename tcp_last to printing_tcp. Explain what it means.
Remove printtrailer() function.
* process.c (sys_exit): Convert printtrailer() call to "printing_tcp = NULL".
* strace.c: Add new variable printing_tcp.
(cleanup): Convert printtrailer() call to "printing_tcp = NULL".
(trace): Likewise.
(trace): Fix checks for incomplete line - it was working wrongly if last syscall was exit.
(printleader): Set printing_tcp.
(printtrailer): Remove this function.
* syscall.c: Remove tcp_last variable.
(trace_syscall_entering): Don't set printing_tcp, printleader call now does it.
(trace_syscall_exiting): Convert printtrailer() call to "printing_tcp = NULL".

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoFix handling of test/threaded_execve.c testcase
Denys Vlasenko [Sat, 28 Jan 2012 00:16:02 +0000 (01:16 +0100)]
Fix handling of test/threaded_execve.c testcase

Since 3.0, Linux has a way to identify which thread execve'ed.
This patch makes use of it in order to properly dispose
of disappeared ("superseded") thread leader,
and replace it with execve'ed thread.

Before this patch, strace was "leaking" thread which exec'ed.
It was thinking that it still runs. It would look like this:

18460 pause( <unfinished ...>     <=== thread leader
18466 execve("/proc/self/exe", ["exe", "exe"], [/* 47 vars */] <unfinished ...>
18465 +++ exited with 0 +++       <=== exits from other threads
18460 <... pause resumed> )             = 0

The last line is wrong: it's not pause resumed, it's execve resumed.
If thread leader would do exit instead of pause, it is much worse:
strace panics because it thinks it sees return from exit syscall!

And strace isn't aware 18466 (exec'ed thread) is gone.
It still thinks it's executes execve syscall.

* strace.c: New variable "static char *os_release".
(get_os_release): New static function.
(main): Call get_os_release to retrieve Linux version.
(trace): If we see PTRACE_EVENT_EXEC, retrieve old pid, and if it
differs from new one, free one of tcbs and print correct messages.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoFix readlink result display - was printing bogus "..." semi-randomly
Denys Vlasenko [Fri, 27 Jan 2012 16:24:26 +0000 (17:24 +0100)]
Fix readlink result display - was printing bogus "..." semi-randomly

* file.c (decode_readlink): Use printstr() instead of printpathn().

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoAdd new test program: test/threaded_execve.c
Denys Vlasenko [Fri, 27 Jan 2012 14:37:13 +0000 (15:37 +0100)]
Add new test program: test/threaded_execve.c

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoMake pid2tcb static
Denys Vlasenko [Fri, 27 Jan 2012 14:24:48 +0000 (15:24 +0100)]
Make pid2tcb static

* defs.h: Remove pid2tcb declaration.
* strace.c (pid2tcb): Make this function static.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoPer Dmitry's request, remove paranoid check in verror_msg()
Denys Vlasenko [Tue, 24 Jan 2012 11:48:02 +0000 (12:48 +0100)]
Per Dmitry's request, remove paranoid check in verror_msg()

* strace.c (verror_msg): Remove redundant check for msg != NULL.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoMore robust error check for vasprintf
Denys Vlasenko [Tue, 24 Jan 2012 10:40:45 +0000 (11:40 +0100)]
More robust error check for vasprintf

* strace.c (verror_msg): More robust error check for vasprintf.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoSlightly more compact handling of argv[]
Denys Vlasenko [Tue, 24 Jan 2012 10:37:03 +0000 (11:37 +0100)]
Slightly more compact handling of argv[]

   text    data     bss     dec     hex filename
 238274     672   20484  259430   3f566 strace.before
 238226     672   20484  259382   3f536 strace

* strace.c (main): Slightly more compact handling of argv[]

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoTrivial optimization
Denys Vlasenko [Tue, 24 Jan 2012 10:35:38 +0000 (11:35 +0100)]
Trivial optimization

* strace.c: Set default interactive = 1 statically instead
of doing it in main().

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoAllocate -o OUTFILE buffer only if needed
Denys Vlasenko [Tue, 24 Jan 2012 10:31:51 +0000 (11:31 +0100)]
Allocate -o OUTFILE buffer only if needed

   text    data     bss     dec     hex filename
 238258     668   28676  267602   41552 strace.before
 238274     668   20484  259426   3f562 strace

* strace.c (main): Allocate -o OUTFILE buffer only if needed:
unused buffer in bss is not entirely free.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoUse single fprintf in verror_msg()
Denys Vlasenko [Tue, 24 Jan 2012 09:17:18 +0000 (10:17 +0100)]
Use single fprintf in verror_msg()

This change partially reverts commit 44d0532.

In code before commit 44d0532, single fprintf was used on purpose:
we want to send entire message as one write() call. Since stderr
is unbuffered, separate fprintf's to it always result in separate
writes, they are not coalesced. If we aren't the only program
which writes to this particular stderr, this may result
in interleaved messages.

Since this function is not performance critical, I guess
it's ok to make it less efficient.

* strace.c (verror_msg): Attempt to print the message in single
write operation. Use separate fprintfs as a fallback if malloc fails.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoImprove code readability (logic is unchanged)
Denys Vlasenko [Sat, 21 Jan 2012 03:01:56 +0000 (04:01 +0100)]
Improve code readability (logic is unchanged)

* util.c (umoven): Move assignment out of function call. Make assignment
to a flag variable later, closer to the place where it will be used.
(umovestr): Likewise.
(uload): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoChange umovestr API: return > 0 instead of 0 if NUL was seen
Denys Vlasenko [Fri, 20 Jan 2012 10:56:00 +0000 (11:56 +0100)]
Change umovestr API: return > 0 instead of 0 if NUL was seen

* pathtrace.c (upathmatch): Adjust umovestr return value check for new API.
* util.c (printpathn): Use umovestr() > 0 return value for more efficient
(and robust - we don't depend on "no overwrote past NUL" behavior anymore)
handling of terminating NUL.
(printstr): Remove useless NUL placement before umovestr() call.
Allocate 1 byte more to outstr[] array - for NUL.
(umovestr): Change to return 1 if NUL was seen.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoumovestr result may have no NUL, use "%.*s" instead of "%s" to print it
Denys Vlasenko [Fri, 20 Jan 2012 10:52:12 +0000 (11:52 +0100)]
umovestr result may have no NUL, use "%.*s" instead of "%s" to print it

* system.c (sys_mount): Be careful when printing umovestr result,
it may have no terminating NUL.
(sys_sysmips): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoEliminate code duplication in time printing, reduce a few static buffers
Denys Vlasenko [Fri, 20 Jan 2012 10:04:04 +0000 (11:04 +0100)]
Eliminate code duplication in time printing, reduce a few static buffers

   text    data     bss     dec     hex filename
 238454     664   28772  267890   41672 strace.before
 238106     664   28676  267446   414b6 strace

* defs.h: Add TIMESPEC_TEXT_BUFSIZE and TIMEVAL_TEXT_BUFSIZE defines.
Add 'int special' parameter to sprinttv().
* time.c (sprinttv): Add 'int special' parameter, and use it
similarly to 'int special' parameter of printtv_bitness().
(printtv_bitness): Use sprinttv() instead of duplicating its code.
(print_timespec): Use sprint_timespec() instead of duplicating
its code.
* desc.c (decode_select): Use TIMEVAL_TEXT_BUFSIZE instead of 128
when checking remaining buffer size.
* net.c (sys_recvmsg): Use TIMESPEC_TEXT_BUFSIZE instead of 128
for static buffer size.
* stream.c (decode_poll): Use TIMESPEC_TEXT_BUFSIZE instead of 128
when checking remaining buffer size.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoReduce bss usage and speed up string printing
Denys Vlasenko [Thu, 19 Jan 2012 16:20:23 +0000 (17:20 +0100)]
Reduce bss usage and speed up string printing

   text    data     bss     dec     hex filename
 237913     660   49284  287857   46471 strace.before
 237973     660   28772  267405   4148d strace

This reduces L1 D-cache pressure a bit: instead of dirtying
20k of bss, we will reuse already dirty stack area.

* util.c (printpathn): Use on-stack buffers instead of static ones.
Saves 5*MAXPATHLEN in bss.
(printstr): Use tprints() instead of tprintf("%s") when printing
formatted string. May be a bit faster, depending on libc.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
12 years agoAdd support for compat_statfs64
Andreas Schwab [Tue, 17 Jan 2012 17:14:22 +0000 (18:14 +0100)]
Add support for compat_statfs64

* file.c (struct compat_statfs64, printcompat_statfs64): Define.
(sys_statfs64, sys_fstatfs64): Use it.

12 years agoAdd support for statfs64.f_flags
Andreas Schwab [Tue, 17 Jan 2012 17:13:33 +0000 (18:13 +0100)]
Add support for statfs64.f_flags

* file.c (printstatfs64): Print f_flags if available.

12 years agoFix missing parens
Andreas Schwab [Tue, 17 Jan 2012 16:56:44 +0000 (17:56 +0100)]
Fix missing parens

* signal.c (sys_sigreturn): Add missing parens.

12 years agoGet rid of TCB_SIGTRAPPED
Denys Vlasenko [Wed, 18 Jan 2012 15:30:47 +0000 (16:30 +0100)]
Get rid of TCB_SIGTRAPPED

On attempts to block or set SIGTRAP handler,
for example, using sigaction syscall, we generate
an additional SIGSTOP.

This change gets rid of this SIGSTOP sending/ignoring.
It appears to work just fine.

It also works if I force strace to not use PTRACE_O_TRACESYSGOOD,
which means strace stops will be marked with SIGTRAP,
not (SIGTRAP | 0x80) - I wondered maybe that's when
this hack is needed.

So, why we even have TCB_SIGTRAPPED? No one knows. It predates
version control: this code was present in the initial commit,
in 1999. No adequate comments, either.

Moreover, TCB_SIGTRAPPED is not set in sys_rt_sigaction
and sys_sigprocmask syscalls - the ones which are most usually
used to implement signal blocking, it is only set in obsolete
sys_signal, sys_sigaction, sys_sigsetmask, and in some dead
non-Linux code.

I think whatever bug it was fixing is gone long ago -
at least as long as sys_rt_sigaction is used by glibc.
Again, since glibc (and uclibc) uses sys_rt_sigaction
and sys_sigprocmask, modified code paths are not used
by most programs anyway.

* defs.h: Remove definition of TCB_SIGTRAPPED.
* signal.c (sys_sigvec): Don't set TCB_SIGTRAPPED and don't send SIGSTOP.
(sys_sigsetmask): Likewise.
(sys_sigaction): Likewise.
(sys_signal): Likewise.
* strace.c (trace): Remove code which executes if TCB_SIGTRAPPED is set.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
12 years agoWhen we write log, flush output buffers in a few more cases
Denys Vlasenko [Wed, 18 Jan 2012 15:20:56 +0000 (16:20 +0100)]
When we write log, flush output buffers in a few more cases

I observed a case when signal delivery message was buffered
by stdio until it was flushed along with the next syscall
entry message.

* strace.c (trace): Flush output buffers in a few more cases.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
12 years agoFix old sigaction display
Denys Vlasenko [Wed, 18 Jan 2012 14:30:56 +0000 (15:30 +0100)]
Fix old sigaction display

* signal.c (sys_sigaction): Fix display of sigaction with
SIG_DFL/SIG_IGN handlers.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
12 years agoChange x86_64_regs struct type from pt_regs to user_regs_struct
Denys Vlasenko [Wed, 18 Jan 2012 10:07:24 +0000 (11:07 +0100)]
Change x86_64_regs struct type from pt_regs to user_regs_struct

* syscall.c: Change x86_64_regs struct type from
pt_regs to user_regs_struct, and explain the change in comment.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
12 years agoFix struct pt_regs declaration on i386 and x86-64
Dmitry V. Levin [Tue, 17 Jan 2012 18:37:13 +0000 (18:37 +0000)]
Fix struct pt_regs declaration on i386 and x86-64

* defs.h [I386] (i386_regs): Replace definition with declaration.
[X86_64] (x86_64_regs): Remove.
* syscall.c [X86_64] (x86_64_regs): Make static.

12 years agoMake ERESTARTxyz messages more descriptive
Denys Vlasenko [Thu, 12 Jan 2012 10:26:34 +0000 (11:26 +0100)]
Make ERESTARTxyz messages more descriptive

There is widespread confusion about exact meaning
of ERESTARTxyz codes. Before this change, we were showing
all four of them the same: as "(To be restarted)".

This change prints better explanations for these codes,
and contains verbose comments which explain *why* we display
codes that way - or else someone confused
is bound to come later and mangle them again.
New messages are:

ERESTARTSYS (To be restarted if SA_RESTART is set)
ERESTARTNOINTR (To be restarted)
ERESTARTNOHAND (Interrupted by signal)
ERESTART_RESTARTBLOCK (Interrupted by signal)

* syscall.c (trace_syscall_exiting): Make ERESTARTxyz messages
more descriptive.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
12 years agoFix sigreturn arg count from 1 to 0 on all architectures.
Denys Vlasenko [Tue, 10 Jan 2012 15:48:19 +0000 (16:48 +0100)]
Fix sigreturn arg count from 1 to 0 on all architectures.

* linux/alpha/syscallent.h: Change [rt_]sigreturn's arg count to 0.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
12 years agoDisplay mask on enter to sigreturn, not on exit
Denys Vlasenko [Tue, 10 Jan 2012 15:40:35 +0000 (16:40 +0100)]
Display mask on enter to sigreturn, not on exit

sys_sigreturn() performs ugly manipulations in order to show
signal mask which is restored by this syscall: on syscall entry,
fetches it from the stack, saves it in tcp->u_arg[]
(where it used to overflow this array - fixed sometime ago),
then retrieves the mask and displays it on syscall exit.

Apparently, the motivation is to make it slightly more obvious
to user that signal mask is restored only when this syscall returns.
IMO, this hardly justifies the necessary hacks. It is much easier
to display the mask at the point when we fetch it - on syscall entry.

While at it, I made it so that we do display returned value/errno.
I see no point in hiding it and showing uninformative "= ?" instead.

Example of pause() being interrupted by ALRM which has installed handler
which re-arms ALRM:

Before the patch:

rt_sigsuspend([INT])                    = ? ERESTARTNOHAND (To be restarted)
--- {si_signo=SIGALRM, si_code=SI_KERNEL} (Alarm clock) ---
alarm(1)                                = 0
sigreturn()                             = ? (mask now [INT])

After:

rt_sigsuspend([INT])                    = ? ERESTARTNOHAND (To be restarted)
--- {si_signo=SIGALRM, si_code=SI_KERNEL} (Alarm clock) ---
alarm(1)                                = 0
sigreturn() (mask [INT])                = -1 EINTR (Interrupted system call)

* defs.h: Declare struct pt_regs i386_regs and struct pt_regs x86_64_regs.
* syscall.c: Remove "static" keywork from these structures' definitions.
* signal.c (sys_sigreturn): Display mask on enter, not on exit.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
12 years agoDo not detach from tracee which experienced ptrace error.
Denys Vlasenko [Wed, 4 Jan 2012 14:15:26 +0000 (15:15 +0100)]
Do not detach from tracee which experienced ptrace error.

Before this patch, if a thread got nuked by exit in another thread
and we happened to poke it at the same time, we print "????(" thingy
and detach the thread. Since we removed "detach before death" logic,
this no longer matches the behavior of other threads.
Before patch:
[pid  1780] exit_group(1)               = ?
[pid  1778] ????( <unfinished ...>
Process 1778 detached
[pid  5860] +++ exited with 1 +++
After:
[pid 17765] exit_group(1)               = ?
[pid 21680] ????( <unfinished ...>
[pid 17791] +++ exited with 1 +++
[pid 21680] +++ exited with 1 +++

* strace (trace): Do not detach from tracee which experienced ptrace error.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
12 years agoRemove sig parameter from detach()
Denys Vlasenko [Wed, 4 Jan 2012 14:11:09 +0000 (15:11 +0100)]
Remove sig parameter from detach()

* strace.c (detach): Drop sig parameter - it is zero in all calls.
(cleanup): Don't pass sig = 0 to detach() call.
(detach): Ditto.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
12 years agoEnhance decoding for personalities with small wordsize
Dmitry V. Levin [Mon, 26 Dec 2011 20:12:02 +0000 (20:12 +0000)]
Enhance decoding for personalities with small wordsize

* util.c (umoven, umovestr) [SUPPORTED_PERSONALITIES > 1]: If current
personality's wordsize is less than sizeof(long), use only significant
bits of the given address.

12 years agoEnhance personality switching
Dmitry V. Levin [Fri, 23 Dec 2011 00:50:49 +0000 (00:50 +0000)]
Enhance personality switching

On syscall entry, save current personality in the tcb structure
along with scno.
On syscall exit, restore current personality from the tcb structure.
* defs.h (struct tcb) [SUPPORTED_PERSONALITIES > 1]: Add currpers
field.
* strace.c (alloc_tcb) [SUPPORTED_PERSONALITIES > 1]: Initialize
tcp->currpers.
* syscall.c (update_personality) [SUPPORTED_PERSONALITIES > 1]: New
function.
(get_scno, trace_syscall_exiting): Use it.

Reported-by: Michael A Fetterman <mafetter@nvidia.com>
12 years ago* net.c (socktcpoptions): Add more TCP_* constants from linux/tcp.h
Dmitry V. Levin [Thu, 1 Dec 2011 21:06:00 +0000 (21:06 +0000)]
* net.c (socktcpoptions): Add more TCP_* constants from linux/tcp.h

Reported-by: Rick Jones <rick.jones2@hp.com>
12 years agoFix sys_ipc/sys_semtimedop decoding on s390
Heiko Carstens [Wed, 30 Nov 2011 12:16:29 +0000 (13:16 +0100)]
Fix sys_ipc/sys_semtimedop decoding on s390

The s390 kernel sys_ipc system call only takes five arguments instead of
six arguments which the common code sys_ipc implementation takes.
One of the arguments of the sys_semtimedop subcall is therefore passed in
a different register than in the common code implementation.
This leads to broken decoding of the timespec argument:

semtimedop(0, 0x3ffffb43832, 1, {...})  = -1 EAGAIN

Fixed it looks like this:

semtimedop(0, 0x3ffffc2c842, 1, {0, 10000000}) = -1 EINTR

* linux/ipc.c (sys_semtimedop): Fix timespec decoding on s390.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
12 years agostrace.c (trace): Fix compilation warning
Dmitry V. Levin [Tue, 29 Nov 2011 00:15:59 +0000 (00:15 +0000)]
strace.c (trace): Fix compilation warning

12 years agolinux/syscall.h: Remove redundant function declarations
Dmitry V. Levin [Mon, 28 Nov 2011 23:54:36 +0000 (23:54 +0000)]
linux/syscall.h: Remove redundant function declarations

Remove 51 function declarations aliased to other declarations in
linux/dummy.h file.

12 years agolinux/syscall.h: Sort function declarations
Dmitry V. Levin [Mon, 28 Nov 2011 23:41:58 +0000 (23:41 +0000)]
linux/syscall.h: Sort function declarations

12 years agolinux/syscall.h: Place one function declaration per line
Dmitry V. Levin [Mon, 28 Nov 2011 23:25:13 +0000 (23:25 +0000)]
linux/syscall.h: Place one function declaration per line

12 years agoRemove redundant parsers
Dmitry V. Levin [Mon, 28 Nov 2011 22:48:53 +0000 (22:48 +0000)]
Remove redundant parsers

* desc.c (sys_dup): Remove.
* file.c (sys_pivotroot, sys_rmdir, sys_fchdir, sys_chroot, sys_fchroot,
sys_unlink, sys_symlink, sys_rename): Remove.
* linux/syscall.h (sys_chroot, sys_dup, sys_fchdir, sys_pivotroot,
sys_rename, sys_rmdir, sys_symlink, sys_unlink): Remove.
* linux/dummy.h: Add aliases for sys_chroot, sys_dup, sys_pivotroot,
sys_rename, sys_rmdir, sys_symlink, sys_unlink.
* pathtrace.c (pathtrace_match): Update.
* sunos4/dummy.h: Add aliases for sys_chroot, sys_dup, sys_fchdir,
sys_fchroot, sys_rename, sys_rmdir, sys_symlink, sys_unlink.
* svr4/dummy.h: Likewise.
* sunos4/syscall.h (sys_chroot, sys_dup, sys_fchdir, sys_fchroot,
sys_rename, sys_rmdir, sys_symlink, sys_unlink): Remove.
* svr4/syscall.h (sys_chroot, sys_dup, sys_fchdir, sys_fchroot,
sys_rename, sys_rmdir, sys_symlink, sys_unlink): Remove.

12 years agoReflect the fact that nfsservctl syscall was removed from linux kernels
Dmitry V. Levin [Mon, 28 Nov 2011 15:53:20 +0000 (15:53 +0000)]
Reflect the fact that nfsservctl syscall was removed from linux kernels

linux/dummy.h: Move nfsservctl to "unimplemented" section.

12 years agox86_64: add getcpu syscall entry
Dmitry V. Levin [Sun, 27 Nov 2011 22:49:04 +0000 (22:49 +0000)]
x86_64: add getcpu syscall entry

* linux/x86_64/syscallent.h: Add syscall entry for getcpu.

12 years agoAdd syscall entries for new linux syscalls
Dmitry V. Levin [Sat, 26 Nov 2011 23:37:23 +0000 (23:37 +0000)]
Add syscall entries for new linux syscalls

* linux/dummy.h: Add printargs parsers for new syscalls.
* linux/arm/syscallent.h: Add entries for sys_clock_adjtime,
sys_name_to_handle_at, sys_open_by_handle_at, sys_sendmmsg, sys_setns
and sys_syncfs.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/mips/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Add entries for sys_clock_adjtime,
sys_name_to_handle_at, sys_open_by_handle_at, sys_setns and sys_syncfs.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Add entry for sys_setns.
* linux/bfin/syscallent.h: Add entries for sys_sendmmsg and sys_setns.
* linux/hppa/syscallent.h: Add entries for sys_clock_adjtime,
fanotify_init, fanotify_mark, sys_name_to_handle_at,
sys_open_by_handle_at, sys_sendmmsg, sys_setns and sys_syncfs.

12 years agoFix prctl syscall entries
Dmitry V. Levin [Sat, 26 Nov 2011 23:14:40 +0000 (23:14 +0000)]
Fix prctl syscall entries

* linux/mips/syscallent.h: Fix prctl handler.
* linux/tile/syscallent.h: Likewise.

12 years agoarm: fix io_* syscall entries
Dmitry V. Levin [Sat, 26 Nov 2011 23:08:14 +0000 (23:08 +0000)]
arm: fix io_* syscall entries

* linux/arm/syscallent.h: Fix handlers for io_setup, io_destroy,
io_getevents, io_submit and io_cancel.

12 years agoFix mincore syscall entries
Dmitry V. Levin [Sat, 26 Nov 2011 23:03:35 +0000 (23:03 +0000)]
Fix mincore syscall entries

* linux/arm/syscallent.h: Fix mincore handler.
* linux/avr32/syscallent.h: Likewise.
* linux/mips/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.

12 years agoFix sendmsg syscall entries
Dmitry V. Levin [Fri, 25 Nov 2011 23:51:53 +0000 (23:51 +0000)]
Fix sendmsg syscall entries

* linux/arm/syscallent.h: Fix number of sendmsg arguments.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.

12 years agoFix epoll_wait syscall entries
Dmitry V. Levin [Fri, 25 Nov 2011 23:45:28 +0000 (23:45 +0000)]
Fix epoll_wait syscall entries

* linux/arm/syscallent.h: Fix epoll_wait flags and handler.
* linux/m68k/syscallent.h: Fix epoll_wait flags.
* linux/microblaze/syscallent.h: Fix number of epoll_wait arguments.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.

12 years agoFix epoll_ctl syscall entries
Dmitry V. Levin [Fri, 25 Nov 2011 23:40:16 +0000 (23:40 +0000)]
Fix epoll_ctl syscall entries

* linux/arm/syscallent.h: Fix epoll_ctl flags and handler.
* linux/m68k/syscallent.h: Fix epoll_ctl flags.
* linux/x86_64/syscallent.h: Fix number of epoll_ctl arguments.

12 years agoarm: fix epoll_create syscall entry
Dmitry V. Levin [Fri, 25 Nov 2011 23:34:12 +0000 (23:34 +0000)]
arm: fix epoll_create syscall entry

* linux/arm/syscallent.h: Fix epoll_create handler.

12 years agoFix mlockall syscall entries
Dmitry V. Levin [Fri, 25 Nov 2011 23:24:48 +0000 (23:24 +0000)]
Fix mlockall syscall entries

* linux/arm/syscallent.h: Fix number of mlockall arguments.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.

12 years agoFix epoll_pwait syscall entries
Dmitry V. Levin [Fri, 25 Nov 2011 23:19:47 +0000 (23:19 +0000)]
Fix epoll_pwait syscall entries

* linux/alpha/syscallent.h: Fix number of epoll_pwait arguments.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.

12 years agoFix reboot syscall entries
Dmitry V. Levin [Fri, 25 Nov 2011 23:13:15 +0000 (23:13 +0000)]
Fix reboot syscall entries

* linux/alpha/syscallent.h: Fix number of reboot arguments.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.

12 years agoFix swapon syscall entries
Dmitry V. Levin [Fri, 25 Nov 2011 23:04:04 +0000 (23:04 +0000)]
Fix swapon syscall entries

* linux/arm/syscallent.h: Fix number of swapon arguments.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Fix number of swapon arguments, add TF flag.
* linux/hppa/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.

12 years agoFix sgetmask and ssetmask syscall entries
Dmitry V. Levin [Fri, 25 Nov 2011 21:57:31 +0000 (21:57 +0000)]
Fix sgetmask and ssetmask syscall entries

* linux/hppa/syscallent.h: Fix sgetmask and ssetmask entries.
* linux/powerpc/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.

12 years agoRename siggetmask to sgetmask and sigsetmask to ssetmask
Dmitry V. Levin [Fri, 25 Nov 2011 21:43:01 +0000 (21:43 +0000)]
Rename siggetmask to sgetmask and sigsetmask to ssetmask

* linux/arm/syscallent.h: Rename siggetmask to sgetmask and
sigsetmask to ssetmask.
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Rename sys_sgetmask to sys_siggetmask,
sys_ssetmask to sys_sigsetmask.

12 years agoAdd TRACE_IPC flag to sys_ipc syscall entries
Dmitry V. Levin [Fri, 25 Nov 2011 19:27:23 +0000 (19:27 +0000)]
Add TRACE_IPC flag to sys_ipc syscall entries

* linux/arm/syscallent.h: Add TI flag to sys_ipc entry.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.

12 years agogitlog-to-changelog: update from gnulib
Dmitry V. Levin [Sat, 5 Nov 2011 13:32:27 +0000 (13:32 +0000)]
gitlog-to-changelog: update from gnulib

* gitlog-to-changelog: Update from gnulib.
* Makefile.am: Add --append-dot to gitlog-to-changelog invocation.

12 years agoDecode TIOCSCTTY's third parameter
Denys Vlasenko [Sat, 22 Oct 2011 02:52:18 +0000 (04:52 +0200)]
Decode TIOCSCTTY's third parameter

* term.c (term_ioctl): Decode TIOCSCTTY's third parameter.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
12 years agoRemove useless and obsolete "#if DONE" sections. No code changes
Dmitry V. Levin [Wed, 12 Oct 2011 23:22:06 +0000 (23:22 +0000)]
Remove useless and obsolete "#if DONE" sections.  No code changes

* linux/dummy.h: Remove "#if DONE" section.
* linux/sparc/dummy2.h: Likewise.
* linux/sparc64/dummy2.h: Likewise.
* sunos4/dummy.h: Likewise.
* svr4/dummy.h: Likewise.

12 years agoAdd names for dummy parsers. No code changes
Dmitry V. Levin [Wed, 12 Oct 2011 19:03:29 +0000 (19:03 +0000)]
Add names for dummy parsers.  No code changes

* linux/dummy.h: Add aliases to printargs() for those of dummy parsers
that had no own names before.
* linux/*/syscallent.h: Use these new names instead of printargs.

12 years agoSort definitions of dummy parsers. No code changes
Dmitry V. Levin [Wed, 12 Oct 2011 16:40:17 +0000 (16:40 +0000)]
Sort definitions of dummy parsers.  No code changes

* linux/dummy.h: Sort definitions of parsers implemented as aliases
to printargs().

12 years agosys_epoll_create1: decode flag arguments correctly
Mike Frysinger [Fri, 14 Oct 2011 02:33:45 +0000 (22:33 -0400)]
sys_epoll_create1: decode flag arguments correctly

* desc.c (epollflags): Define.
(sys_epoll_create1): Use epollflags to printflags. Change "O" to "EPOLL".

Reported-by: Марк Коренберг <socketpair@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agoImplement decoding of splice, tee and vmsplice(2) syscalls
Dmitry V. Levin [Tue, 11 Oct 2011 17:07:05 +0000 (17:07 +0000)]
Implement decoding of splice, tee and vmsplice(2) syscalls

* io.c (print_loff_t): New function.
(sys_sendfile64): Use it.
(splice_flags): New xlat structure.
(sys_tee, sys_splice, sys_vmsplice): New functions.
* linux/syscall.h (sys_tee, sys_splice, sys_vmsplice): Declare them.
* linux/*/syscallent.h: Use them.

12 years agoFix epoll_wait and epoll_pwait decoding
Dmitry V. Levin [Tue, 11 Oct 2011 16:05:57 +0000 (16:05 +0000)]
Fix epoll_wait and epoll_pwait decoding

* desc.c (epoll_wait_common): Print "maxevents" and "timeout" arguments
as integers.

Reported-by: Марк Коренберг <socketpair@gmail.com>
12 years agoDecode EPOLLRDHUP
Dmitry V. Levin [Tue, 11 Oct 2011 15:55:40 +0000 (15:55 +0000)]
Decode EPOLLRDHUP

* desc.c (epollevents): Add EPOLLRDHUP.

Reported-by: Марк Коренберг <socketpair@gmail.com>
12 years agoRemove unreachable code in umoven() and umovestr().
Dmitry V. Levin [Tue, 11 Oct 2011 15:26:15 +0000 (15:26 +0000)]
Remove unreachable code in umoven() and umovestr().

* util.c (umoven, umovestr): Remove unreachable code.

Reported-by: Weichuan Yan <wchyan@marvell.com>