]> granicus.if.org Git - strace/log
strace
12 years agoRemove unused PTRACE_WRITE{TEXT,DATA} constants (they are from SunOS)
Denys Vlasenko [Sat, 17 Mar 2012 11:11:10 +0000 (12:11 +0100)]
Remove unused PTRACE_WRITE{TEXT,DATA} constants (they are from SunOS)

* util.c: Remove unused PTRACE_WRITE{TEXT,DATA} constants.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoReindent case labels. No code changes
Denys Vlasenko [Sat, 17 Mar 2012 03:42:07 +0000 (04:42 +0100)]
Reindent case labels. No code changes

* net.c (printsockopt): Reindent case labels.
* signal.c (sys_signal): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoRemove unused constants. No code changes
Denys Vlasenko [Sat, 17 Mar 2012 02:17:15 +0000 (03:17 +0100)]
Remove unused constants. No code changes

* syscall.c: Remove unused ENOIOCTLCMD constant. Fix indentation.
* util.c: Remove unused CLONE_STOPPED constant.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoMove change_syscall() to its only user and make it static
Denys Vlasenko [Sat, 17 Mar 2012 01:17:51 +0000 (02:17 +0100)]
Move change_syscall() to its only user and make it static

* defs.h: Remove declaration of change_syscall().
* process.c (change_syscall): Remove definition of this function.
* util.c (change_syscall): Add definition of change_syscall().

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoMAP_ANON is the same as MAP_ANONYMOUS, no need to have the former
Denys Vlasenko [Sat, 17 Mar 2012 00:29:40 +0000 (01:29 +0100)]
MAP_ANON is the same as MAP_ANONYMOUS, no need to have the former

* mem.c: Do not allocate string for MAP_ANON if it is the same as
MAP_ANONYMOUS.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoIndentation and whitespace fixes. No code changes.
Denys Vlasenko [Sat, 17 Mar 2012 00:27:37 +0000 (01:27 +0100)]
Indentation and whitespace fixes. No code changes.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agotest/threaded_execve: make it also test a case when leader is not in syscall
Denys Vlasenko [Sat, 17 Mar 2012 00:24:25 +0000 (01:24 +0100)]
test/threaded_execve: make it also test a case when leader is not in syscall

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoImplement prlimit64 decoding, rewrite [gs]etrlimit decoding
Dmitry V. Levin [Fri, 16 Mar 2012 19:05:21 +0000 (23:05 +0400)]
Implement prlimit64 decoding, rewrite [gs]etrlimit decoding

* configure.ac: Remove AC_RLIM_T_IS_LONG_LONG call.
Define SIZEOF_RLIM_T.
* m4/long_long.m4 (AC_RLIM_T_IS_LONG_LONG): Remove.
* linux/dummy.h (sys_prlimit64): Remove.
* linux/syscall.h (sys_prlimit64): New prototype.
* resource.c (resources): Reindent, add RLIMIT_RTTIME.
(sprintrlim, print_rlimit32, sys_getrlimit, sys_setrlimit): Remove.
[HAVE_LONG_LONG_RLIM_T]: Remove dead code.
[_LFS64_LARGEFILE || HAVE_LONG_LONG_RLIM_T]: Likewise.
(sprint_rlim64, print_rlimit64, decode_rlimit64, sprint_rlim32,
print_rlimit32, decode_rlimit, sys_getrlimit, sys_setrlimit,
sys_prlimit64): New functions.

12 years agoRemove another "interrupt to quit" message
Denys Vlasenko [Fri, 16 Mar 2012 14:21:49 +0000 (15:21 +0100)]
Remove another "interrupt to quit" message

* strace.c (startup_attach): Remove another "interrupt to quit" message.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoFix "strace -oFILE -ff -p<nonexistant_pid>" behavior
Denys Vlasenko [Fri, 16 Mar 2012 14:15:14 +0000 (15:15 +0100)]
Fix "strace -oFILE -ff -p<nonexistant_pid>" behavior

* strace.c (newoutf): Set tcp->outf in non-ff mode too.
(alloctcb): This define is removed.
(alloc_tcb): Renamed to alloctcb. Does not set tcp->outf anymore.
Lost 'command_options_parsed' flag parameter.
(startup_attach): Do not say "interrupt to quit" in attach message -
^C does not work in all cases, we mislead users.
Call newoutf(tcp) after successful attach.
(startup_child): Call newoutf(tcp) after successful attach.
(trace): Call newoutf(tcp) when we picked up already attached child.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoMake alloc_tcb and droptcb static. No code changes.
Denys Vlasenko [Fri, 16 Mar 2012 14:11:34 +0000 (15:11 +0100)]
Make alloc_tcb and droptcb static. No code changes.

The change is trivial. Diff is large because it is confused
by function definitions being moved around.

* defs.h: Remove declarations of alloc_tcb and droptcb.
* strace.c: Make alloc_tcb and droptcb static.
Shuffle functions around to make compiler happy.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoTidy up includes and copyright notices, fix indentation
Denys Vlasenko [Fri, 16 Mar 2012 11:02:22 +0000 (12:02 +0100)]
Tidy up includes and copyright notices, fix indentation

The files not mentioned in changelog below had only
copyright notices fixes and indentation fixes.

* defs.h: Include <stdint.h> and <inttypes.h>.
* file.c: Do not include <inttypes.h>.
Move struct kernel_dirent declaration below top include block.
* block.c: Do not include <stdint.h> and <inttypes.h>.
* quota.c: Likewise.
* desc.c: Likewise.
* signal.c: Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoscsi.c: add copyright header
Dmitry V. Levin [Fri, 16 Mar 2012 10:43:32 +0000 (10:43 +0000)]
scsi.c: add copyright header

* scsi.c: This file was added back in 2007 without a copyright header.
Add it now.

12 years agoEnhance capget and capset syscalls decoding
Dmitry V. Levin [Thu, 15 Mar 2012 22:58:39 +0000 (22:58 +0000)]
Enhance capget and capset syscalls decoding

* system.c (cap_version): New xlat structure.
(print_cap_header, print_cap_data): New functions.
(sys_capget, sys_capset): Use them.

12 years agoRemove unused code
Dmitry V. Levin [Thu, 15 Mar 2012 22:08:55 +0000 (22:08 +0000)]
Remove unused code

* syscall.c (subcall_style, decode_subcall): Remove.
[SYS_socket_subcall] (decode_socket_subcall): New function, based on
decode_subcall in deref_style.
[SYS_ipc_subcall] (decode_ipc_subcall): New function, based on
decode_subcall in shift_style.
(trace_syscall_entering): Use decode_socket_subcall and
decode_ipc_subcall instead of decode_subcall.

12 years agoFix IPC decoding on alpha and arm
Dmitry V. Levin [Thu, 15 Mar 2012 21:19:36 +0000 (21:19 +0000)]
Fix IPC decoding on alpha and arm

* ipc.c (indirect_ipccall): Return 0 on ALPHA and ARM EABI.
(sys_shmat): Use indirect_ipccall for proper return value decoding.

12 years agoarm: fix compilation warnings
Dmitry V. Levin [Thu, 15 Mar 2012 20:42:46 +0000 (20:42 +0000)]
arm: fix compilation warnings

* configure.ac: Define SIZEOF_LONG.
* signal.c (sys_rt_sigaction) [SUPPORTED_PERSONALITIES > 1]: Help
compiler to optimize out unreachable code that is not expected to work
on platforms where sizeof(long) <= 4.

12 years agotests: robustify again buggy shells
Dmitry V. Levin [Thu, 15 Mar 2012 20:17:49 +0000 (20:17 +0000)]
tests: robustify again buggy shells

* tests/init.sh (check_strace): Use "${parameter:-word}" shell syntax
instead of "${parameter-word}".

Reported-by: Mike Frysinger <vapier@gentoo.org>
12 years agoimprove ifdef check with decode_subcall
Mike Frysinger [Thu, 15 Mar 2012 05:09:19 +0000 (01:09 -0400)]
improve ifdef check with decode_subcall

Use the same ifdef logic around the call sites of decode_subcall()
to protect the definition of the func itself.  This fixes warnings
for targets like hppa which don't use this func.

* syscall.c (decode_subcall): Wrap in SYS_socket_subcall and
SYS_ipc_subcall define checks.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agoalpha: fix decode of osf_sigprocmask
Mike Frysinger [Thu, 15 Mar 2012 04:45:33 +0000 (00:45 -0400)]
alpha: fix decode of osf_sigprocmask

The alpha sigprocmask syscall is special in that it comes from OSF rather
than the style that everyone else uses.

Tested with this simple code:
$ cat test.c
#include <signal.h>
main() {
sigset_t set, oldset;
sigemptyset(&set);
sigaddset(&set, SIGINT);
sigaddset(&set, SIGHUP);
sigprocmask(SIG_SETMASK, &set, &oldset);
sigprocmask(SIG_UNBLOCK, &oldset, &set);
sleep(3);
}
$ gcc test.c && ./strace ./a.out
...
osf_sigprocmask(SIG_SETMASK, [HUP INT]) = 0 (old mask [])
osf_sigprocmask(SIG_UNBLOCK, [])        = 0x3 (old mask [HUP INT])
osf_sigprocmask(SIG_BLOCK, [CHLD])      = 0x3 (old mask [HUP INT])
...

* linux/alpha/syscallent.h: Call sys_sigprocmask for osf_sigprocmask,
and change number of arguments to two.
* signal.c (sys_sigprocmask): Fix decoding of alpha osf sigprocmask.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agoFix array size calculation in previous commit
Denys Vlasenko [Thu, 15 Mar 2012 17:11:51 +0000 (18:11 +0100)]
Fix array size calculation in previous commit

* pathtrace.c (getfdpath): Fix array size calculation.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agopathtrace_select() is never called with NULL, remove dead code
Denys Vlasenko [Thu, 15 Mar 2012 17:03:56 +0000 (18:03 +0100)]
pathtrace_select() is never called with NULL, remove dead code

pathtrace_select() is only called for -P FILE options,
and FILE is never a NULL pointer.

   text    data     bss     dec     hex filename
 239453     672   19012  259137   3f441 strace.before
 239329     672   19012  259013   3f3c5 strace

* pathtrace.c (pathtrace_select): Remove "if (path == NULL)...".
(pathtrace_select): Remove code which only executes if path == NULL.
The code was also buggy, it can free non-malloced pointer.
(getfdpath): Simplify snprintf to sprintf.
(pathmatch): Use strcmp() == 0 idiom for string equality test.
(pathtrace_match): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agomanpage: remove bugs which are fixed
Denys Vlasenko [Thu, 15 Mar 2012 16:32:56 +0000 (17:32 +0100)]
manpage: remove bugs which are fixed

"A traced process ignores SIGSTOP" - fixed, expected to be in linux-3.4.x.
"A traced process which tries to block SIGTRAP will be sent a SIGSTOP
in an attempt to force continuation of tracing." - not needed
and no longer done.
"On Linux, exciting as it would be, tracing the init process is forbidden"
- not true anymore.
"When a traced process receives a SIGTRAP signal not
associated with tracing, strace will not report that signal correctly."
- not true anymore.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoSimplify SIGCHLD handler setting
Denys Vlasenko [Thu, 15 Mar 2012 16:27:49 +0000 (17:27 +0100)]
Simplify SIGCHLD handler setting

* strace.c (init): Set SIGCHLD to SIG_DFL earlier.
(startup_child): Do not bother restoring SIGCHLD handler.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoWhen reporting signals, use short signal names (SIGfoo) instead of strerror
Denys Vlasenko [Thu, 15 Mar 2012 16:24:49 +0000 (17:24 +0100)]
When reporting signals, use short signal names (SIGfoo) instead of strerror

* defs.h: Remove strsignal declaration.
* signal.c: Better check for SI_FROMUSER define.
* strace.c (strerror): Remove this function.
(trace): Use short signal names (SIGfoo) instead of strerror.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoRemove TODO file: it's eleven years old and completely outdated
Denys Vlasenko [Thu, 15 Mar 2012 14:55:33 +0000 (15:55 +0100)]
Remove TODO file: it's eleven years old and completely outdated

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoClean up defs.h order. No code changes
Denys Vlasenko [Thu, 15 Mar 2012 14:02:49 +0000 (15:02 +0100)]
Clean up defs.h order. No code changes

* defs.h: Group together related declarations. No code changes.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoFix lame kernel version checking code
Denys Vlasenko [Thu, 15 Mar 2012 13:36:28 +0000 (14:36 +0100)]
Fix lame kernel version checking code

The code "os_release[0] >= '3'" is not good for any
finer-grained checks such as "kernel >= 3.2.1".
Let's proactively fix it.

* strace.c: Change os_release from string to integer.
(get_os_release): Parse uname.release to KERNEL_VERSION
representation.
(init): Convert kernel version check to KERNEL_VERSION.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoExperimental support for "detach on execve" feature
Denys Vlasenko [Thu, 15 Mar 2012 12:44:17 +0000 (13:44 +0100)]
Experimental support for "detach on execve" feature

* strace.c: Define new detach_on_execve, skip_startup_execve bool variables.
(init): Set detach_on_execve on -b, set skip_startup_execve if
"strace PROG" form is used.
(trace): Detach from process if -b and we see PTRACE_EVENT_EXEC event.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoSimple fixes.
Denys Vlasenko [Thu, 15 Mar 2012 12:39:05 +0000 (13:39 +0100)]
Simple fixes.

* strace.c (usage): Document -d; document that -F is deprecated.
(droptcb): Print "<detached ...>" correctly for non-ff mode too.
(detach): Suppress a warning.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoRemove an outdated comment
Denys Vlasenko [Thu, 15 Mar 2012 12:02:31 +0000 (13:02 +0100)]
Remove an outdated comment

* defs.h: Remove an outdated comment.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoRemove extra include directives. No code changes.
Denys Vlasenko [Thu, 15 Mar 2012 11:56:25 +0000 (12:56 +0100)]
Remove extra include directives. No code changes.

* defs.h: Include <signal.h> unconditionally.
Other files were doing it unconditionally, so no harm done.
* bjm.c: Remove system includes which are already included by defs.h.
* pathtrace.c: Likewise.
* process.c: Likewise.
* signal.c: Likewise.
* strace.c: Likewise.
* stream.c: Likewise.
* syscall.c: Likewise.
* system.c: Likewise.
* util.c: Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoTidy up order of includes; make bool variables explicit.
Denys Vlasenko [Thu, 15 Mar 2012 11:49:52 +0000 (12:49 +0100)]
Tidy up order of includes; make bool variables explicit.

Bool variables are more compact in data and (on x86) on code too:

   text    data     bss     dec     hex filename
 237950     676   19044  257670   3ee86 strace.before
 237838     676   19012  257526   3edf6 strace

* defs.h: Group library includes at the top of the file.
Rename dtime to Tflag, debug to debug_flag.
Change debug_flag,Tflag,qflag,not_failing_only,show_fd_path,tracing_paths
variable declarations from int to bool.
* strace.c: Change corresponding definitions. Do the same for static
variables iflag,rflag,print_pid_pfx.
Rename dtime to Tflag, debug to debug_flag.
* syscall.c: Rename dtime to Tflag, debug to debug_flag.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoFix compiler warnings about breaking strict-aliasing rules
Dmitry V. Levin [Thu, 15 Mar 2012 02:03:36 +0000 (02:03 +0000)]
Fix compiler warnings about breaking strict-aliasing rules

* system.c (sys_capget, sys_capset): Use proxy unions to cast long*
pointers to cap_user_header_t and cap_user_data_t pointers without
breaking strict-aliasing rules.

Reported-by: Mike Frysinger <vapier@gentoo.org>
12 years agoppc64: drop unused pid variable
Mike Frysinger [Thu, 15 Mar 2012 00:16:13 +0000 (20:16 -0400)]
ppc64: drop unused pid variable

* syscall.c (get_scno) [POWERPC64]: Delete unused pid variable.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
12 years agoia64: fix compilation warnings
Dmitry V. Levin [Thu, 15 Mar 2012 01:01:25 +0000 (01:01 +0000)]
ia64: fix compilation warnings

* linux/ia64/syscallent.h: Remove improper defines and undefs.

Reported-by: Mike Frysinger <vapier@gentoo.org>
12 years agoEnsure that SWAP_FLAG_* constants are defined
Dmitry V. Levin [Thu, 15 Mar 2012 00:52:22 +0000 (00:52 +0000)]
Ensure that SWAP_FLAG_* constants are defined

* file.c: Define those of SWAP_FLAG_* constants which are not yet
provided by <sys/swap.h>.

Reported-by: Mike Frysinger <vapier@gentoo.org>
12 years agoEnhance *listxattr syscalls decoding
Dmitry V. Levin [Wed, 14 Mar 2012 16:34:32 +0000 (16:34 +0000)]
Enhance *listxattr syscalls decoding

* file.c (print_xattr_list): New function.
(sys_listxattr, sys_flistxattr): Use it.

12 years agoFix *at syscalls flags decoding
Dmitry V. Levin [Tue, 13 Mar 2012 23:26:01 +0000 (23:26 +0000)]
Fix *at syscalls flags decoding

Several *at decoders were defining own incomplete *atflags xlat
structures.  That was error prone, and fchownat decoder actually
failed to recognize AT_EMPTY_PATH.  Merging these incomplete
structures into the single at_flags xlat structure will fix
flags handling in all these decoders altogether.

* file.c: Define all AT_* constants used by *at decoders.
(at_flags): New xlat structure, with records for all AT_* constants.
(fstatatflags, linkat_flags, unlinkatflags): Remove.
(sys_newfstatat, sys_linkat, sys_unlinkat, sys_fchownat,
sys_utimensat):  Use at_flags.

12 years agoFix linkat flags decoding
Dmitry V. Levin [Tue, 13 Mar 2012 23:16:37 +0000 (23:16 +0000)]
Fix linkat flags decoding

* file.c (linkat_flags): New xlat structure.
(sys_linkat): Decode flags using linkat_flags.

12 years agoImplement sys_rt_tgsigqueueinfo syscall decoder
Dmitry V. Levin [Tue, 13 Mar 2012 15:51:13 +0000 (15:51 +0000)]
Implement sys_rt_tgsigqueueinfo syscall decoder

* linux/dummy.h (sys_rt_tgsigqueueinfo): Remove.
* linux/syscall.h (sys_rt_tgsigqueueinfo): New prototype.
* signal.c (print_sigqueueinfo): New function, based on
sys_rt_sigqueueinfo.
(sys_rt_sigqueueinfo): Use print_sigqueueinfo.
(sys_rt_tgsigqueueinfo): New function.

12 years agoImplement syslog syscall decoder
Dmitry V. Levin [Tue, 13 Mar 2012 15:28:01 +0000 (15:28 +0000)]
Implement syslog syscall decoder

* linux/dummy.h (sys_syslog): Remove.
* linux/syscall.h (sys_syslog): New prototype.
* system.c (syslog_action_type): New xlat structure.
(sys_syslog): New function.

12 years agoLess ugly debug display of ptrace events
Denys Vlasenko [Tue, 13 Mar 2012 11:05:27 +0000 (12:05 +0100)]
Less ugly debug display of ptrace events

* strace.c (trace): Less ugly debug display of ptrace events.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoMake manpage mention that -p "`pidof PROG`" works
Denys Vlasenko [Tue, 13 Mar 2012 10:48:22 +0000 (11:48 +0100)]
Make manpage mention that -p "`pidof PROG`" works

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoFix logging for "strace -o FILE -ff test/threaded_execve" test case
Denys Vlasenko [Tue, 13 Mar 2012 10:44:31 +0000 (11:44 +0100)]
Fix logging for "strace -o FILE -ff test/threaded_execve" test case

Our logic which was deciding whether to print "<unfinished ...>"
thingy wasn't working properly for -ff case.

* defs.h: Group log generation-related declarations together.
Add a large comment which explains how it works.
Add declaration of line_ended() function.
* strace.c (line_ended): New function which sets up internal data
to indicate that previous line was finished.
(printleader): Change logic to fix log generation in -ff mode.
(newoutf): Make check for -ff mode consistent with other places.
(droptcb): Print "<detached ...>" if last line for this tcp wasn't finished.
(cleanup): Remove code to print "<unfinished ...>", printleader()
or detach() will do it instead.
(trace): Remove code to print "<unfinished ...>".
Add code which finishes threaded execve's incomplete line
with " <pid changed to PID ...>" message. Replace printing_tcp = NULL
followed by fflush() by line_ended() call.
* process.c (sys_exit): Call line_ended() to indicate that we finished priting.
* syscall.c (trace_syscall_exiting): Set printing_tcp to current tcp.
Call line_ended() to indicate that we finished priting.
Remove call to fflush(), it is done by line_ended() now.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agonet.c: recognize MSG_WAITFORONE
Dmitry V. Levin [Tue, 13 Mar 2012 01:26:26 +0000 (01:26 +0000)]
net.c: recognize MSG_WAITFORONE

* net.c (msg_flags): Add MSG_WAITFORONE.

12 years agoTreat -ff without -o FILE as single -f
Denys Vlasenko [Mon, 12 Mar 2012 22:34:13 +0000 (23:34 +0100)]
Treat -ff without -o FILE as single -f

* strace.c (init): Treat -ff without -o FILE as single -f.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoStyle fix. No code changes
Denys Vlasenko [Mon, 12 Mar 2012 22:32:16 +0000 (23:32 +0100)]
Style fix. No code changes

* strace.c (process_opt_p_list): Style fix.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoReduce stack usage by ~0.5k
Denys Vlasenko [Mon, 12 Mar 2012 22:05:25 +0000 (23:05 +0100)]
Reduce stack usage by ~0.5k

main() uses ~0.5k of stack for local variables and such. When we enter
main tracing loop, most of these variables are no longer used.
But they still take up stack for the entire life of strace.
We can avoid this wastage if we move init code into a separate function.
(Need to be careful and not allow automatic inlining).

* strace.c (init): New function. Most of pre-existing code of
main is now living here.
(main): Call init() to do initialization.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoPreparatory cosmetic changes for the next commit
Denys Vlasenko [Mon, 12 Mar 2012 22:02:26 +0000 (23:02 +0100)]
Preparatory cosmetic changes for the next commit

* strace.c (tprintf): Move function up in the source file. No code changes.
(tprints): Likewise.
(printleader): Likewise.
(tabto): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoImplement sendmmsg syscall decoder
Dmitry V. Levin [Sun, 11 Mar 2012 23:59:29 +0000 (23:59 +0000)]
Implement sendmmsg syscall decoder

* linux/dummy.h (sys_sendmmsg): Remove.
* linux/syscall.h (sys_sendmmsg): New prototype.
* net.c (printmmsghdr): Add index argument specifying the element in
mmsghdr array to print.
(decode_mmsg): New function, prints the whole mmsghdr array, its length
and message flags.
(sys_sendmmsg): New function.
(sys_recvmmsg): Use decode_mmsg to fix mmsghdr array decoding.

12 years agoImplement sched_rr_get_interval syscall decoder
Dmitry V. Levin [Sun, 11 Mar 2012 23:00:11 +0000 (23:00 +0000)]
Implement sched_rr_get_interval syscall decoder

* linux/dummy.h (sys_sched_rr_get_interval): Remove.
* linux/syscall.h (sys_sched_rr_get_interval): New prototype.
* process.c (sys_sched_rr_get_interval): New function.

12 years agoImplement migrate_pages syscall decoder
Dmitry V. Levin [Sun, 11 Mar 2012 22:44:14 +0000 (22:44 +0000)]
Implement migrate_pages syscall decoder

* linux/dummy.h (sys_migrate_pages): Remove.
* linux/syscall.h (sys_migrate_pages): New prototype.
* mem.c (sys_migrate_pages): New function.

12 years agoImplement get_robust_list syscall decoder
Dmitry V. Levin [Sun, 11 Mar 2012 22:32:26 +0000 (22:32 +0000)]
Implement get_robust_list syscall decoder

* linux/dummy.h (sys_get_robust_list): Remove.
* linux/syscall.h (sys_get_robust_list): New prototype.
* process.c (sys_get_robust_list): New function.

12 years agoDefine sys_set_robust_list as an alias to sys_munmap
Dmitry V. Levin [Sun, 11 Mar 2012 21:57:57 +0000 (21:57 +0000)]
Define sys_set_robust_list as an alias to sys_munmap

* linux/dummy.h (sys_set_robust_list): Redefine to sys_munmap.

12 years agoImplement clock_adjtime syscall decoder
Dmitry V. Levin [Sun, 11 Mar 2012 21:25:51 +0000 (21:25 +0000)]
Implement clock_adjtime syscall decoder

* linux/dummy.h (sys_clock_adjtime): Remove.
* linux/syscall.h (sys_clock_adjtime): New prototype.
* time.c (do_adjtimex): New function, based on sys_adjtimex.
(sys_adjtimex): Use it.
(sys_clock_adjtime): New function.

12 years agoDefine sys_setns as an alias to sys_inotify_rm_watch
Dmitry V. Levin [Sun, 11 Mar 2012 15:45:20 +0000 (15:45 +0000)]
Define sys_setns as an alias to sys_inotify_rm_watch

* linux/dummy.h (sys_setns): Redefine to sys_inotify_rm_watch.

12 years agoSort definitions of dummy parsers. No code changes
Dmitry V. Levin [Sun, 11 Mar 2012 15:43:04 +0000 (15:43 +0000)]
Sort definitions of dummy parsers.  No code changes

* linux/dummy.h: Sort definitions of parsers implemented as aliases.

12 years agoCorrect inotify_rm_watch decoder
Dmitry V. Levin [Sun, 11 Mar 2012 15:33:34 +0000 (15:33 +0000)]
Correct inotify_rm_watch decoder

* file.c (sys_inotify_rm_watch): Print second argument as int.

12 years agoAlias sys_fsync to sys_close
Dmitry V. Levin [Sun, 11 Mar 2012 15:28:03 +0000 (15:28 +0000)]
Alias sys_fsync to sys_close

* file.c (sys_fsync): Remove.
* linux/syscall.h (sys_fsync): Likewise.
* linux/dummy.h (sys_fsync): Alias to sys_close.
* linux/m68k/syscallent.h: Add TD flag to fsync entry.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent.h: Likewise.

12 years agoUpdate ioctl entries
Dmitry V. Levin [Sat, 10 Mar 2012 21:15:58 +0000 (21:15 +0000)]
Update ioctl entries

* linux/ioctlent.h.in: Regenerate from v3.3 headers.
* linux/i386/ioctlent.h.in: Likewise.

12 years agostrace-log-merge: cleanup
Dmitry V. Levin [Sat, 10 Mar 2012 16:10:06 +0000 (16:10 +0000)]
strace-log-merge: cleanup

* strace-log-merge: Redirect usage to stderr, make the check
for numeric suffix simpler.

12 years agoAdd syscall entries for new linux syscalls
Dmitry V. Levin [Sat, 10 Mar 2012 15:04:16 +0000 (15:04 +0000)]
Add syscall entries for new linux syscalls

* linux/i386/syscallent.h: Update process_vm_writev handler.
* linux/powerpc/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/alpha/syscallent.h: Add entries for accept4 and sendmmsg.
* linux/arm/syscallent.h: Add entries for process_vm_readv and
process_vm_writev.
* linux/m68k/syscallent.h: Likewise.
* linux/mips/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/ia64/syscallent.h: Add entries for process_vm_readv,
process_vm_writev and accept4.
* linux/microblaze/syscallent.h: Add entries for sendmmsg,
process_vm_readv and process_vm_writev.

12 years agoImplement process_vm_writev decoder
Dmitry V. Levin [Sat, 10 Mar 2012 14:14:49 +0000 (14:14 +0000)]
Implement process_vm_writev decoder

* process.c (sys_process_vm_writev): New function.
* linux/syscall.h (sys_process_vm_writev): New prototype.

12 years agoOutput iovec length in vmsplice and process_vm_readv decoders
Dmitry V. Levin [Sat, 10 Mar 2012 14:03:25 +0000 (14:03 +0000)]
Output iovec length in vmsplice and process_vm_readv decoders

* io.c (sys_vmsplice): Output iovec length.
* process.c (sys_process_vm_readv): Likewise.

12 years agoswapon: decode swap flags
Dmitry V. Levin [Fri, 9 Mar 2012 21:02:19 +0000 (21:02 +0000)]
swapon: decode swap flags

* file.c: Include <sys/swap.h>.
(swap_flags): New xlat structure.
(sys_swapon): New function.
* linux/dummy.h (sys_swapon): Remove.
* linux/syscall.h (sys_swapon): New declaration.

12 years agoTrivial simplification
Denys Vlasenko [Fri, 9 Mar 2012 14:34:16 +0000 (15:34 +0100)]
Trivial simplification

* strace.c (detach): Use waitpid instead of wait4.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoDon't consider PROG to be our child in "strace -D PROG" case
Denys Vlasenko [Fri, 9 Mar 2012 14:29:45 +0000 (15:29 +0100)]
Don't consider PROG to be our child in "strace -D PROG" case

TCB_STRACE_CHILD is used for the case when "strace PROG" is ^C-ed
or something like that. strace should not just exit - it should
do something with its child (such as signal it too).

In -D case, PROG is not really a child of _strace_, it is a child
of strace's parent. It's ok to handle it exactly as an attached process.

While we are at it, remove nonsensical special-casing of TCB_STRACE_CHILD
in printing of "<unfinished ...>" message.

* strace.c (startup_attach): Don't set TCB_STRACE_CHILD if -D.
(trace): Print "<unfinished ...>" on error regardless of TCB_STRACE_CHILD.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoFix the case where we try to detach unattached processes
Denys Vlasenko [Fri, 9 Mar 2012 14:15:24 +0000 (15:15 +0100)]
Fix the case where we try to detach unattached processes

Before this change:
$ strace -D -p1
strace: -D and -p are mutually exclusive options
Process 1 detached  <==== WRONG! (and we try to SIGSTOP it!!!)

* defs.h: Change the meaning of TCB_ATTACHED: now it means "this tracee
is attached to us". Add TCB_STRACE_CHILD: "this tracee is our child".
* strace.c (kill_save_errno): Move up. No code changes.
(process_opt_p_list): Don't set TCB_ATTACHED on new tcb.
(startup_attach): Change how we work with TCB_ATTACHED.
Set TCB_STRACE_CHILD on -D.
(startup_child): Use kill_save_errno instead of kill.
Set TCB_ATTACHED and TCB_STRACE_CHILD on attached strace child.
If we are in -D case, don't set TCB_ATTACHED (we aren't attached yet).
(detach): do not do PTRACE_DETACH if TCB_ATTACHED is not set.
(cleanup): Check TCB_STRACE_CHILD instead of TCB_ATTACHED.
(trace): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoCall PTRACE_CONT with addr=0
Denys Vlasenko [Fri, 9 Mar 2012 14:11:21 +0000 (15:11 +0100)]
Call PTRACE_CONT with addr=0

* strace.c (trace): Call PTRACE_CONT with addr=0.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoinstall strace-log-merge by "make install"
Denys Vlasenko [Fri, 9 Mar 2012 13:21:59 +0000 (14:21 +0100)]
install strace-log-merge by "make install"

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agostrace_log_merge: new file. Helper to merge timestamped strace -ff logs
Denys Vlasenko [Fri, 9 Mar 2012 12:43:44 +0000 (13:43 +0100)]
strace_log_merge: new file. Helper to merge timestamped strace -ff logs

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoFix PID prefix printing in "strace -oLOG -ff -p1 -p2 -p3" case
Denys Vlasenko [Fri, 9 Mar 2012 12:03:41 +0000 (13:03 +0100)]
Fix PID prefix printing in "strace -oLOG -ff -p1 -p2 -p3" case

In this case we were printing PIDs to LOG.* files
even though it is not necessary.

The fix is in the addition of "&& followfork < 2" condition.

* strace.c: Remove pflag_seen variable, add print_pid_pfx one.
(process_opt_p_list): Do not pflag_seen++.
(main): Use "nprocs != 0" condition instead of "pflag_seen != 0".
Set print_pid_pfx before entering main tracing loop.
(printleader): Use print_pid_pfx to decide whether to print pid prefix.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoAllow -p PID to take comma or whitespace-separated list of PIDs
Denys Vlasenko [Fri, 9 Mar 2012 12:01:04 +0000 (13:01 +0100)]
Allow -p PID to take comma or whitespace-separated list of PIDs

* defs.h: Clarify meaning of TCB_ATTACHED. No code changes.
* strace.c (process_opt_p_list): New function.
(main): Call process_opt_p_list to process -p PIDs argument.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoPass addr=0 instead of 1 into restarting ptrace calls
Denys Vlasenko [Thu, 8 Mar 2012 11:13:44 +0000 (12:13 +0100)]
Pass addr=0 instead of 1 into restarting ptrace calls

While we are at it, fold do_ptrace into its lone caller.
We no longer set tcp->ptrace_errno = ESRCH on ESRC error in upeek.
Other code paths where ptrace fails wern't doing it, and the code which
checks tcp->ptrace_errno even assumes it is never set to ESRCH.
(It was me who added this code sometime ago, so it was my fault
that it was a bit messy)

I ran sigkill_rain test and verified that unfinished syscalls are
still handled correctly.

* util.c (ptrace_restart): Do not pass addr=1 to ptrace(), pass 0 instead.
I have no idea why we were passing 1. Ptrace documentation says
that addr parameter is ignored.
(do_ptrace): Remove this function.
(upeek): Use ptrace() instead of do_ptrace().
* defs.h: Remove do_ptrace() declaration.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoTrivial tweaks to error messages
Denys Vlasenko [Thu, 8 Mar 2012 10:54:10 +0000 (11:54 +0100)]
Trivial tweaks to error messages

* strace.c (test_ptrace_setoptions_followfork): Use kill_save_errno
instead of kill.
(trace): Use perror_msg instead of perror.
* count.c (set_sortby): Use error_msg_and_die instead of fprintf.
* syscall.c (qualify): Likewise.
* util.c (ptrace_restart): Expand error message.
(umoven): Likewise.
(umovestr): Likewise.
(upeek): Use perror_msg instead of sprintf + perror.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoRemove stray sys_swapon() declaration
Denys Vlasenko [Tue, 28 Feb 2012 15:39:44 +0000 (16:39 +0100)]
Remove stray sys_swapon() declaration

* linux/syscall.h: Remove stray sys_swapon() declaration.
* linux/mips/syscallent.h: Include dummy.h with correct relative path.
* linux/dummy.h: Tweak one place where spaces are used instead of tabs.
* linux/dummy_check.sh: New script. It helps in finding stray syscall
handler declarations.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoCorrect syscall entries for t[g]kill
Denys Vlasenko [Mon, 27 Feb 2012 13:58:06 +0000 (14:58 +0100)]
Correct syscall entries for t[g]kill

* linux/hppa/syscallent.h: Make tgkill use sys_tgkill, not printargs.
* linux/sh/syscallent.h: Change tkill type TD -> TS.
* linux/sh64/syscallent.h: Likewise.
* linux/mips/syscallent.h: Change tkill type 0 -> TS.
* linux/x86_64/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoAssorted trivial optimizations
Denys Vlasenko [Mon, 27 Feb 2012 13:37:48 +0000 (14:37 +0100)]
Assorted trivial optimizations

   text    data     bss     dec     hex filename
 236448     672   19044  256164   3e8a4 strace.before
 236360     672   19044  256076   3e84c strace

* file.c (sprintmode): Use smaller static buffer, eliminate strlen call.
(sprinttime): Use smaller static buffer.
(printstat_sparc64): Coalesce two printing calls into one.
(printstat_powerpc32): Likewise.
(printcompat_statfs6): Likewise.
(sys_utime): Do not fetch personality_wordsize[current_personality]
repeatedly - cache it in local variable instead.
* process.c (printargv): Likewise.
* resource.c (sprintrlim): Return const char*, not char*. This allows
to eliminate sprintf(buf, "RLIM_INFINITY"). Use smaller static buffer.
(sprintrlim64): Likewise.
* strace.c (strerror): Use smaller static buffer.
(strsignal): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoAlias a few more syscall printing functions
Denys Vlasenko [Mon, 27 Feb 2012 13:18:02 +0000 (14:18 +0100)]
Alias a few more syscall printing functions

   text    data     bss     dec     hex filename
 237384     672   19044  257100   3ec4c strace.before
 236448     672   19044  256164   3e8a4 strace

* defs.h: Declare new functions printargs_lu(), printargs_ld()
which simply print syscall all args as unsigned or signed longs.
* desc.c (sys_epoll_create): Call printargs_ld() instead of open-coding it.
* linux/syscall.h: Remove declarations of the following functions:
sys_alarm, sys_getresgid, sys_getsid, sys_nice, sys_setgid, sys_setpgid,
sys_setpgrp, sys_setregid, sys_setresgid.
* process.c (sys_setgid): Delete this function: now aliased to sys_setuid().
(sys_getresgid): Delete this function: now aliased to sys_getresuid().
(sys_setregid): Delete this function: now aliased to sys_setreuid().
(sys_setresgid): Delete this function: now aliased to sys_setresuid().
(sys_setpgrp): Delete this function: now aliased to printargs_lu().
(sys_getsid): Likewise.
(sys_setpgid): Likewise.
(sys_alarm): Likewise.
(sys_getpgrp): Delete this function: was unused - was already shadowed
by a define in linux/dummy.h.
(sys_setsid): Likewise.
(sys_getpgid): Likewise.
* resource.c (sys_nice): Delete this function: now aliased to printargs_ld().
* linux/dummy.h: Define new aliases (see above for the list).
* syscall.c (printargs_lu): New function.
(printargs_ld): New function.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoStyle fixes, no code changes
Denys Vlasenko [Mon, 27 Feb 2012 12:56:59 +0000 (13:56 +0100)]
Style fixes, no code changes

* desc.c (sys_io_getevents): Indentation fix.
* file.c (sys_xstat): Remove space after function name.
(decode_mknod): Indentation fix.
* net.c (printsockopt): Indentation fix.
* process.c (unalignctl_string): Indentation fix.
(sys_sched_getscheduler): Remove space after ! operator.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoCompress blank lines
Dmitry V. Levin [Sat, 25 Feb 2012 15:41:21 +0000 (15:41 +0000)]
Compress blank lines

Suppress repeated empty lines left after automated code removal.
This change was made by filtering every source code file through
"cat -s".

12 years agoRemove parts of automake machinery which are not needed on Linux
Dmitry V. Levin [Sat, 25 Feb 2012 14:34:10 +0000 (15:34 +0100)]
Remove parts of automake machinery which are not needed on Linux

This change is a verbatim part of Dmitry's changes to remove support
for non-Linux architectures.

* Makefile.am: Don't install PORTING file. Install README-linux-ptrace file.
Set OS variable to linux unconditionally.
* configure.ac: Remove code to set opsys variable, and its usage.
Remove checks for headers which are never present on Linux.
* m4/stat.m4: Remove 'ifdef LINUX' check.
* m4/statfs.m4: Likewise.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoRemove and update documentation
Dmitry V. Levin [Sat, 25 Feb 2012 14:29:21 +0000 (15:29 +0100)]
Remove and update documentation

This change is a verbatim part of Dmitry's changes to remove support
for non-Linux architectures.

* PORTING: Deleted.
* INSTALL: Modified.
* README: Modified.
* strace.1: Modified: bugs should be reported to mailing list, not Debian.
* strace.spec: do not install PORTING file.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoRemove a few more code parts which are unused on Linux
Denys Vlasenko [Sat, 25 Feb 2012 14:19:02 +0000 (15:19 +0100)]
Remove a few more code parts which are unused on Linux

This change is abapted from Dmitry's changes to remove support for
non-Linux architectures.

* Makefile.am: Remove if LINUX/endif pairs.
* defs.h: Remove stream_ioctl() declaration.
* ioctl.c (ioctl_decode): Remove 'ifdef HAVE_SYS_STREAM_H' block.
* resource.c: Use 'defined(FOO)' instead of 'defined FOO' form.
* util.c: Likewise.
* signal.c: Remove conditional includes which are never used on Linux.
* stream.c: Likewise.
* file.c: Remove excessive empty lines.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoBuild fixes after non-Linux code removal
Denys Vlasenko [Sat, 25 Feb 2012 01:54:34 +0000 (02:54 +0100)]
Build fixes after non-Linux code removal

* configure.ac: Remove calls to proc-based ptrace checks.
* proc.c: Remove, it's empty now.
* Makefile.am: Remove reference to proc.c.
* net.c: Remove trailing newlines.
* quota.c: Likewise
* resource.c: Likewise
* strace.c: Likewise
* stream.c: Likewise
* time.c: Likewise

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 years agoFix defined(FOO) style
Denys Vlasenko [Sat, 25 Feb 2012 01:47:15 +0000 (02:47 +0100)]
Fix defined(FOO) style

* file.c: Consistently use defined(FOO) instead of defined (FOO).
* mem.c: Likewise.
* net.c: Likewise.
* signal.c: Likewise.
* sock.c: Likewise.
* linux/mips/syscallent.h: Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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.