]> granicus.if.org Git - strace/log
strace
13 years agoAdd TRACE_DESC|TRACE_FILE flags to fanotify_* sysentries
Dmitry V. Levin [Sun, 20 Feb 2011 20:24:52 +0000 (20:24 +0000)]
Add TRACE_DESC|TRACE_FILE flags to fanotify_* sysentries

* linux/*/syscallent.h: Add TD flag to fanotify_init.  Add TD|TF flags
to fanotify_mark.

13 years agoFix flags of fallocate sysentries
Dmitry V. Levin [Sun, 20 Feb 2011 20:17:00 +0000 (20:17 +0000)]
Fix flags of fallocate sysentries

* linux/*/syscallent.h: Fix sys_fallocate flags.

13 years agoAdd TRACE_DESC flag to epoll_create* sysentries
Dmitry V. Levin [Sun, 20 Feb 2011 19:58:09 +0000 (19:58 +0000)]
Add TRACE_DESC flag to epoll_create* sysentries

* linux/*/syscallent.h: Add TD flag to sys_epoll_create and
sys_epoll_create1.

13 years agoAdd TRACE_DESC flag to fgetxattr, flistxattr, and fremovexattr sysentries
Dmitry V. Levin [Sun, 20 Feb 2011 19:50:28 +0000 (19:50 +0000)]
Add TRACE_DESC flag to fgetxattr, flistxattr, and fremovexattr sysentries

* linux/*/syscallent.h: Add TD flag to sys_fgetxattr, sys_flistxattr,
and fremovexattr.

13 years agoAdd TRACE_FILE flag to swapoff sysentries
Dmitry V. Levin [Sun, 20 Feb 2011 19:14:10 +0000 (19:14 +0000)]
Add TRACE_FILE flag to swapoff sysentries

* linux/*/syscallent.h: Add TF flag to sys_swapoff.

13 years agoAdd TRACE_DESC flag to fadvise64* sysentries
Dmitry V. Levin [Sun, 20 Feb 2011 15:23:22 +0000 (15:23 +0000)]
Add TRACE_DESC flag to fadvise64* sysentries

* linux/*/syscallent.h: Add TD flag to sys_fadvise64 and
sys_fadvise64_64.

13 years agoAdd TRACE_DESC flag to mmap, mmap2, and old_mmap sysentries
Dmitry V. Levin [Sun, 20 Feb 2011 15:10:32 +0000 (15:10 +0000)]
Add TRACE_DESC flag to mmap, mmap2, and old_mmap sysentries

* linux/*/syscallent.h: Add TD flag to sys_mmap and sys_old_mmap.

13 years agoDo not initialize native_scno on platforms with only one personality
Dmitry V. Levin [Sun, 20 Feb 2011 13:25:04 +0000 (13:25 +0000)]
Do not initialize native_scno on platforms with only one personality

* linux/bfin/syscallent.h: Remove redundant native_scno initialization.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.

13 years agoAdd LOOP_* ioctls defined in linux/loop.h
Dmitry V. Levin [Sun, 20 Feb 2011 12:25:12 +0000 (12:25 +0000)]
Add LOOP_* ioctls defined in linux/loop.h

* linux/ioctlent.sh: Add LOOP_* ioctls (0x4C..) defined in linux/loop.h
header file.
* linux/ioctlent.h: Regenerated.
Reported by Mike Frysinger.

13 years agoFix PTRACE_GETEVENTMSG usage and enhance test_ptrace_setoptions()
Dmitry V. Levin [Sat, 19 Feb 2011 21:33:50 +0000 (21:33 +0000)]
Fix PTRACE_GETEVENTMSG usage and enhance test_ptrace_setoptions()

* strace.c (handle_ptrace_event): Fix PTRACE_GETEVENTMSG usage.
(test_ptrace_setoptions): Test that PTRACE_GETEVENTMSG works properly.

13 years agolinux/sparc: move to common syscall.h
Mike Frysinger [Sat, 19 Feb 2011 20:48:52 +0000 (15:48 -0500)]
linux/sparc: move to common syscall.h

Rather than constantly deal with the sparc/syscall.h going stale, merge
the few sparc-specific pieces into the linux/syscall.h header.

* linux/syscall.h: Add sparc-specific pieces from sparc/syscall.h.
* Makefile.am (EXTRA_DIST): Remove linux/sparc/syscall.h and
linux/sparc64/syscall.h.
* linux/sparc/syscall.h, linux/sparc64/syscall.h: Deleted.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
13 years agosparc: add new funcs to syscall.h
Mike Frysinger [Sat, 19 Feb 2011 20:32:07 +0000 (15:32 -0500)]
sparc: add new funcs to syscall.h

Sync missing defs from the common syscall.h here.

* linux/sparc/syscall.h: Add sys_setfsuid, sys_pread64, and
sys_pwrite64 prototypes.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
13 years agosparc: punt unused syscall.h.2
Mike Frysinger [Sat, 19 Feb 2011 20:13:05 +0000 (15:13 -0500)]
sparc: punt unused syscall.h.2

I can't find any mention of this header actually being used.
Seems to be a really old copy of the common syscall.h.

* Makefile.am (EXTRA_DIST): Remove linux/sparc/syscall.h.2.
* linux/sparc/syscall.h.2: Deleted.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
13 years agoFix raw exit_group(2) decoding
Dmitry V. Levin [Sat, 19 Feb 2011 00:02:27 +0000 (00:02 +0000)]
Fix raw exit_group(2) decoding

* syscall.c (trace_syscall_entering): Check for sys_exit instead of
SYS_exit to handle exit_group(2) as well as _exit(2).

13 years agoOptimize known_scno()
Dmitry V. Levin [Fri, 18 Feb 2011 23:19:47 +0000 (23:19 +0000)]
Optimize known_scno()

* syscall.c (known_scno): Do not check for native_scno field on
platforms that support only one personality.

13 years ago* process.c (internal_exit) [IA64]: Remove redundant check.
Dmitry V. Levin [Fri, 18 Feb 2011 23:16:20 +0000 (23:16 +0000)]
* process.c (internal_exit) [IA64]: Remove redundant check.

13 years agoFix biarch support in IO dumping
Dmitry V. Levin [Wed, 9 Feb 2011 00:39:47 +0000 (00:39 +0000)]
Fix biarch support in IO dumping

* syscall.c (dumpio): Switch on tcp->sys_func instead of tcp->scno
for more reliable results.

13 years agoSimplify tprintf() declaration
Dmitry V. Levin [Tue, 7 Sep 2010 01:13:13 +0000 (01:13 +0000)]
Simplify tprintf() declaration

* defs.h (tprintf): Simplify declaration.

13 years ago* defs.h (SYSCALL_NEVER_FAILS): Fix typo.
Dmitry V. Levin [Sat, 5 Feb 2011 01:07:08 +0000 (01:07 +0000)]
* defs.h (SYSCALL_NEVER_FAILS): Fix typo.

13 years agoFix decoding of get[ug]id, gete[ug]id and setfs[ug]id return values
Dmitry V. Levin [Tue, 18 Jan 2011 17:36:20 +0000 (17:36 +0000)]
Fix decoding of get[ug]id, gete[ug]id and setfs[ug]id return values

* defs.h (SYSCALL_NEVER_FAILS): New syscall flag.
* linux/dummy.h: Change redirection for sys_get[ug]id, sys_gete[ug]id
and setfs[ug]id.
* linux/*/syscallent.h: Set SYSCALL_NEVER_FAILS flag for get[ug]id,
gete[ug]id and setfs[ug]id syscalls.
* process.c [LINUX] (sys_getuid, sys_setfsuid): New functions.
* syscall.c (NF): New shorthand macro for use in syscallent.h files.
(get_error): Check SYSCALL_NEVER_FAILS flag.
Reported by Марк Коренберг <socketpair@gmail.com>.

13 years ago* linux/*/syscallent.h: Fix typo in sys_newfstatat syscall flags.
Dmitry V. Levin [Wed, 19 Jan 2011 00:21:07 +0000 (00:21 +0000)]
* linux/*/syscallent.h: Fix typo in sys_newfstatat syscall flags.

13 years agoBlackfin: update ioctl list
Mike Frysinger [Mon, 17 Jan 2011 23:48:30 +0000 (18:48 -0500)]
Blackfin: update ioctl list

* linux/bfin/ioctlent.h: Sync with latest kernel sources.

13 years agoFix stat64 decoding on mips
Dmitry V. Levin [Mon, 17 Jan 2011 23:24:54 +0000 (23:24 +0000)]
Fix stat64 decoding on mips

* linux/mips/syscallent.h: Use sys_stat64() to decode stat64 syscall.
This fixes Debian bug #599028.

13 years agoUpdate linux/*/syscallent.h files to match Linux kernel v2.6.37
Dmitry V. Levin [Mon, 17 Jan 2011 22:39:33 +0000 (22:39 +0000)]
Update linux/*/syscallent.h files to match Linux kernel v2.6.37

* linux/alpha/syscallent.h: Add hooks for fanotify_init, fanotify_mark,
and prlimit64.
* 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/x86_64/syscallent.h: Likewise.
* linux/arm/syscallent.h: Add hooks for accept4, fanotify_init,
fanotify_mark, and prlimit64.
* linux/hppa/syscallent.h: Add hook for prlimit64.

13 years agoblock.c: cleanup
Dmitry V. Levin [Sun, 16 Jan 2011 23:07:51 +0000 (23:07 +0000)]
block.c: cleanup

* block.c: Include <inttypes.h>.
(print_blkpg_req): Always decode struct blkpg_ioctl_arg.
Robustify decoding of strings.
(block_ioctl): Do not decode return values passed by pointers on exit
from failed syscalls.
Use format macros from inttypes.h to print values of type uint64_t.

13 years agoAdd block ioctl support
Dmitry V. Levin [Sat, 15 Jan 2011 20:15:31 +0000 (20:15 +0000)]
Add block ioctl support

* block.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h [LINUX] (block_ioctl): New function.
* ioctl.c (ioctl_decode) [LINUX]: Use it to decode HDIO_* and BLK*
ioctls.
Patch by Jeff Mahoney <jeffm@suse.com>

13 years agoParse SOL_SCTP socket options
Holger Hans Peter Freyther [Fri, 14 Jan 2011 10:08:12 +0000 (11:08 +0100)]
Parse SOL_SCTP socket options

* configure.ac (AC_CHECK_HEADERS): Add netinet/sctp.h.
* net.c [HAVE_NETINET_SCTP_H]: Include <netinet/sctp.h>.
[SOL_SCTP] (socksctpoptions): New xlat structure.
(sys_getsockopt, printsockopt): Parse SOL_SCTP options.

13 years ago* net.c (socketlayers): Add more SOL_* constants from linux/socket.h
Holger Hans Peter Freyther [Fri, 14 Jan 2011 10:08:11 +0000 (11:08 +0100)]
* net.c (socketlayers): Add more SOL_* constants from linux/socket.h

13 years agostrace.1: fix misleading italics
Dmitry V. Levin [Fri, 14 Jan 2011 17:17:20 +0000 (17:17 +0000)]
strace.1: fix misleading italics

* strace.1: Use bold instead of italics for "-e trace=" keywords.
This fixes Debian bug #589323.

13 years agoUpdate linux/ioctlent.h
Dmitry V. Levin [Fri, 14 Jan 2011 16:09:40 +0000 (16:09 +0000)]
Update linux/ioctlent.h

* linux/ioctlent.h: Regenerate using linux v2.6.37 headers.

13 years agoAdd HDIO_* ioctls defined in linux/hdreg.h
Dmitry V. Levin [Fri, 14 Jan 2011 15:30:10 +0000 (15:30 +0000)]
Add HDIO_* ioctls defined in linux/hdreg.h

* linux/ioctlent.sh: Add HDIO_* ioctls (0x03..) defined in
linux/hdreg.h header file.
This fixes Debian bug #450953.

13 years agoTest PTRACE_O_TRACECLONE and PTRACE_O_TRACEVFORK along with PTRACE_O_TRACEFORK
Dmitry V. Levin [Thu, 13 Jan 2011 14:49:39 +0000 (14:49 +0000)]
Test PTRACE_O_TRACECLONE and PTRACE_O_TRACEVFORK along with PTRACE_O_TRACEFORK

* strace.c (test_ptrace_setoptions): Add PTRACE_O_TRACECLONE and
PTRACE_O_TRACEVFORK to PTRACE_SETOPTIONS call, to test exactly
the same set of options that is going to be used later in trace().

13 years ago* net.c (protocols): Add more IPPROTO_* constants defined in netinet/in.h
Dmitry V. Levin [Mon, 10 Jan 2011 01:14:38 +0000 (01:14 +0000)]
* net.c (protocols): Add more IPPROTO_* constants defined in netinet/in.h

13 years ago* net.c (protocols): Add IPPROTO_GRE, IPPROTO_SCTP and IPPROTO_UDPLITE.
Holger Hans Peter Freyther [Fri, 7 Jan 2011 18:10:41 +0000 (19:10 +0100)]
* net.c (protocols): Add IPPROTO_GRE, IPPROTO_SCTP and IPPROTO_UDPLITE.

13 years agosh: Add entry for not-multiplexed accept4
Carmelo AMOROSO [Tue, 4 Jan 2011 15:30:40 +0000 (16:30 +0100)]
sh: Add entry for not-multiplexed accept4

* linux/sh/syscallent.h: Add specific entry for not-multiplexed accept4
available in kernel mainline since v2.6.37-rc6, see
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=21b6e4c7106b2d68a6710506d8706608272fd78b

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
13 years agosh: Add entries for not-multiplexed socket calls
Carmelo AMOROSO [Mon, 13 Dec 2010 10:39:48 +0000 (11:39 +0100)]
sh: Add entries for not-multiplexed socket calls

* linux/sh/syscallent.h: Add specific entries for not-multiplexed
socket calls (available in kernel mainline since v2.6.37-rc1)

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
13 years agosh: Fix compilation warning in do_pipe due to missing prototype
Carmelo AMOROSO [Mon, 13 Dec 2010 07:48:28 +0000 (08:48 +0100)]
sh: Fix compilation warning in do_pipe due to missing prototype

* defs.h [SH]: Make getrval2 prototype visible to do_pipe
and fix the following compiler warning:
.../net.c: In function 'do_pipe':
.../net.c:1632: warning: implicit declaration of function 'getrval2'
.../net.c:1632: warning: format '%lu' expects type 'long unsigned int',
but argument 3 has type 'int'

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
13 years agoFix build on uClibc
Dmitry V. Levin [Tue, 14 Dec 2010 00:02:35 +0000 (00:02 +0000)]
Fix build on uClibc

* defs.h [LINUX]: Define PTRACE_GETEVENTMSG macro.
Patch by Douglas Mencken <dougmencken@gmail.com>.

13 years agoFix strace -f -o '|command' hangup
Dmitry V. Levin [Tue, 7 Dec 2010 12:50:49 +0000 (12:50 +0000)]
Fix strace -f -o '|command' hangup

* strace.c (main): Call test_ptrace_setoptions() before parsing
-o option, otherwise a forked command will cause a hangup inside
test_ptrace_setoptions().

13 years agoOutput diagnostics to stderr
Dmitry V. Levin [Thu, 2 Dec 2010 23:38:13 +0000 (23:38 +0000)]
Output diagnostics to stderr

* syscall.c (get_scno): Output information about changes in
personality mode to stderr.  Reported by Pádraig Brady.

13 years agoRecognize more clone flags
Dmitry V. Levin [Fri, 3 Dec 2010 17:19:51 +0000 (17:19 +0000)]
Recognize more clone flags

* process.c (CLONE_*): Define more flags from linux v2.6.25.
(clone_flags): Add entries for them.
Proposed by <zhangyanfei@cn.fujitsu.com>.

13 years agoDecode struct ucred for getsockopt SO_PEERCRED
Dmitry V. Levin [Fri, 3 Dec 2010 16:54:53 +0000 (16:54 +0000)]
Decode struct ucred for getsockopt SO_PEERCRED

* net.c (sys_getsockopt): Decode SO_PEERCRED.
Proposed by Arkadiusz Miśkiewicz <arekm@maven.pl>.

13 years agosh: Add support for tracing sys_cacheflush system call
Carmelo AMOROSO [Wed, 1 Dec 2010 13:27:07 +0000 (14:27 +0100)]
sh: Add support for tracing sys_cacheflush system call

* linux/sh/syscallent.h: Update sys_cacheflush entry.
* linux/syscall.h [SH] (sys_cacheflush): New function declaration.
* system.c [SH] (cacheflush_flags): New xlat structure.
[SH] (sys_cacheflush): New function.

Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Reviewed-by: Angelo Castello <angelo.castello@st.com>
13 years agoCleanup test_ptrace_setoptions()
Dmitry V. Levin [Thu, 2 Dec 2010 20:56:43 +0000 (20:56 +0000)]
Cleanup test_ptrace_setoptions()

* strace.c (test_ptrace_setoptions): Cleanup.
(main): Fix test_ptrace_setoptions() error diagnostics message.
Print ptrace_setoptions value in debug mode.

13 years agoHandle followfork using ptrace_setoptions if available
Wang Chao [Fri, 12 Nov 2010 09:26:08 +0000 (17:26 +0800)]
Handle followfork using ptrace_setoptions if available

If PTRACE_O_TRACECLONE et al options are supported by kernel,
use them to do followfork rather than the original setbpt
method that changes registers ourselves.

* defs.h [LINUX] (handle_new_child): New function prototype.
* process.c [LINUX] (handle_new_child): New function based on the
code from internal_fork(), with a trivial change: do reparent only
for sys_clone.
[LINUX] (internal_fork): Use handle_new_child().  Do nothing if
ptrace_setoptions is in effect.
* strace.c [LINUX] (handle_ptrace_event): New function.
[LINUX] (trace): If ptrace_setoptions is in effect, then
call the new function to handle PTRACE_EVENT_* status, and
set PTRACE_SETOPTIONS when we see the initial stop of tracee.

Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
13 years agoTest how PTRACE_SETOPTIONS support works
Wang Chao [Fri, 12 Nov 2010 09:25:19 +0000 (17:25 +0800)]
Test how PTRACE_SETOPTIONS support works

Currently test fork related options only.  Fork a child that uses
PTRACE_TRACEME at startup and then does a fork so strace can test
how the PTRACE_SETOPTIONS support works before it handles any real
tracee.  Since PTRACE_O_TRACECLONE/*FORK were introduced to kernel
at the same time, this test seems to be enough for these 3 options.

* defs.h [LINUX]: Define PTRACE_O_TRACECLONE et al macros here.
(ptrace_setoptions): New variable declaration.
* strace.c [LINUX] (test_ptrace_setoptions): New function, tests
whether kernel supports PTRACE_O_CLONE/*FORK, the result is stored
in the new variable ptrace_setoptions for later use.
(main): Call test_ptrace_setoptions() if followfork option is set.

Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
14 years agoEnable support for less verbose build rules
Dmitry V. Levin [Sat, 16 Jan 2010 23:49:58 +0000 (23:49 +0000)]
Enable support for less verbose build rules

* configure.ac (AM_INIT_AUTOMAKE): Add silent-rules.

14 years agoDo not trace children cloned with CLONE_UNTRACED flag
Wang Chao [Thu, 16 Sep 2010 03:20:56 +0000 (11:20 +0800)]
Do not trace children cloned with CLONE_UNTRACED flag

If clone is called with flag CLONE_UNTRACED, to be consistent with
option PTRACE_O_TRACECLONE, we should not set CLONE_PTRACE flag on
its arguments.

* process.c [LINUX] (internal_fork): Check the syscall and arguments.

Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
14 years agoUpdate the list of CLOCK_* constants to match Linux kernel v2.6.32+
Dmitry V. Levin [Fri, 17 Sep 2010 09:19:49 +0000 (09:19 +0000)]
Update the list of CLOCK_* constants to match Linux kernel v2.6.32+

* time.c (struct xlat clocknames[]): Add more RT clock IDs.
Reported by Tommi Rantala.

14 years agoUpdate linux/hppa/syscallent.h to match Linux kernel v2.6.35
Dmitry V. Levin [Thu, 16 Sep 2010 16:48:45 +0000 (16:48 +0000)]
Update linux/hppa/syscallent.h to match Linux kernel v2.6.35

* linux/hppa/syscallent.h: Add hooks for recvmmsg and accept4.

14 years agoPass less information to qualify_one and qual_*
Dmitry V. Levin [Wed, 15 Sep 2010 16:18:20 +0000 (16:18 +0000)]
Pass less information to qualify_one and qual_*

* syscall.c (qualify_one, qual_syscall, qual_signal, qual_fault,
qual_desc): Take just a bitflag argument instead of pointer to the whole
qual_options structure.
(struct qual_options): Update prototype of "qualify" field.
(qualify): Update use of qualify_one and qual_options->qualify.

14 years agoFix -e option with only one value in qualifier statement
Wang Chao [Wed, 15 Sep 2010 03:37:38 +0000 (11:37 +0800)]
Fix -e option with only one value in qualifier statement

Fix regression introduced by commit v4.5.20-19-g30145dd:
if -e option is used with only one value in qualifier statement,
e.g. 'strace -e trace=open ls', syscall information would not be
printed properly.

* syscall.c (qualify): Remove faulty optimization.

Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
14 years agoFix off_t/rlim_t size checks when cross-compiling
Mike Frysinger [Sun, 12 Sep 2010 08:01:47 +0000 (04:01 -0400)]
Fix off_t/rlim_t size checks when cross-compiling

The current off_t/rlim_t size checks (wrt size of long long) use AC_RUN
which obviously doesn't work when cross-compiling.  While we don't hit
any configure errors, the fall back code is pretty dumb (which is to say
there isn't any).  Considering the code in question though, we can use
some fun compiler tricks with sizeof and array lengths to turn it into
a pure build test and avoid the RUN issue completely.

* m4/long_long.m4 (AC_OFF_T_IS_LONG_LONG, AC_RLIM_T_IS_LONG_LONG):
Convert from AC_RUN_IFELSE to AC_COMPILE_IFELSE.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
14 years agoFix long long little endian detection when cross-compiling
Mike Frysinger [Sun, 12 Sep 2010 07:39:55 +0000 (03:39 -0400)]
Fix long long little endian detection when cross-compiling

The long long endian detection code does an AC_TRY_RUN() and since that
doesn't work when cross-compiling, it sets a fallback value.  However,
rather than do any sort of default endian detection, the code simply
sets it to "no".  This probably breaks most little endian systems out
there when cross-compiling for them.  It certainly breaks Blackfin
systems.  So use the common endian detection code provided by autoconf
and key off of that when cross-compiling.

* configure.ac: Call AC_C_BIGENDIAN.
* m4/long_long.m4 (AC_LITTLE_ENDIAN_LONG_LONG): Set cross-compiling
logic based on ac_cv_c_bigendian.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
14 years agoBlackfin: decode new syscalls
Mike Frysinger [Sat, 11 Sep 2010 19:04:18 +0000 (15:04 -0400)]
Blackfin: decode new syscalls

* linux/bfin/syscallent.h: Add fanotify/prlimit/cacheflush syscalls.
* linux/syscall.h: Add sys_cacheflush() decl.
* system.c: Decode Blackfin's cacheflush syscall.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
14 years ago* linux/ioctlent.sh: Search a few non-exported paths.
Mike Frysinger [Sat, 11 Sep 2010 19:04:12 +0000 (15:04 -0400)]
* linux/ioctlent.sh: Search a few non-exported paths.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
14 years agoClean up pid2tcb usage
Roland McGrath [Wed, 15 Sep 2010 01:59:20 +0000 (18:59 -0700)]
Clean up pid2tcb usage

* strace.c (pid2tcb): Always match pid.  Fail for argument <= 0.
[USE_PROCFS] (first_used_tcb): New function.
[USE_PROCFS] (trace): Use that instead of pid2tcb(0).

14 years agoTurn on more compiler warnings
Dmitry V. Levin [Thu, 9 Sep 2010 17:42:28 +0000 (17:42 +0000)]
Turn on more compiler warnings

* configure.ac: Enable gcc -Wwrite-strings.

14 years agoImport warnings.m4 from gnulib
Dmitry V. Levin [Thu, 9 Sep 2010 17:41:15 +0000 (17:41 +0000)]
Import warnings.m4 from gnulib

* m4/warnings.m4: Replace with warnings.m4 from gnulib.
* configure.ac: Use gl_WARN_ADD from new warnings.m4.
* Makefile.am (AM_CFLAGS): Update for new warnings.m4.

14 years agoSplit acinclude.m4
Dmitry V. Levin [Thu, 9 Sep 2010 17:36:36 +0000 (17:36 +0000)]
Split acinclude.m4

* Makefile.am (ACLOCAL_AMFLAGS): Add "-I m4".
* acinclude.m4: Remove.
* m4/includedir.m4: New file, with definition of AC_INCLUDEDIR from
acinclude.m4.
* m4/long_long.m4: New file, with definitions of AC_OFF_T_IS_LONG_LONG,
AC_RLIM_T_IS_LONG_LONG and AC_LITTLE_ENDIAN_LONG_LONG from acinclude.m4.
* m4/procfs.m4: New file, with definitions of AC_MP_PROCFS,
AC_POLLABLE_PROCFS and AC_STRUCT_PR_SYSCALL from acinclude.m4.
* m4/stat.m4: New file, with definition of AC_STAT64 from acinclude.m4.
* m4/statfs.m4: New file, with definition of AC_STATFS64 from
acinclude.m4.
* m4/warnings.m4: New file, with definition of AC_WARNFLAGS from
acinclude.m4.

14 years ago* process.c (sys_waitid): Remove unused variable.
Dmitry V. Levin [Thu, 9 Sep 2010 23:08:59 +0000 (23:08 +0000)]
* process.c (sys_waitid): Remove unused variable.

14 years agoFix const-correctness issues uncovered by gcc -Wwrite-strings
Dmitry V. Levin [Mon, 6 Sep 2010 22:08:24 +0000 (22:08 +0000)]
Fix const-correctness issues uncovered by gcc -Wwrite-strings

* defs.h (struct xlat): Add const qualifier to the field of
type "char *".
(set_sortby, qualify, printnum, printnum_int): Add const qualifier to
arguments of type "char *".
* count.c (set_sortby): Add const qualifier to the argument and
automatic variable of type "char *".
* desc.c (decode_select): Add const qualifier to automatic variables of
type "char *".
* ioctlsort.c (struct ioctlent): Add const qualifier to fields of
type "char *".
(main):  Add const qualifier to argv.
* process.c (printargv): Add const qualifier to the argument and
automatic variable of type "char *".
(printargc) Add const qualifier to argument of type "char *".
* signal.c (sprintsigmask, parse_sigset_t): Add const qualifier to
arguments of type "char *".
* strace.c (progname): Add const qualifier.
(detach): Add const qualifier to automatic variable of type "char *".
* stream.c (struct strbuf): Add const qualifier to the field of
type "char *".
* syscall.c (struct qual_options): Add const qualifier to fields of
type "char *".
(qual_syscall, qual_fault, qual_desc, lookup_class): Add const qualifier
to arguments of type "char *".
(qual_signal): Add const qualifier to the argument of type "char *",
avoid modification of constant argument.
(qualify): Likewise.
* util.c (printflags): Add const qualifier to automatic variable of
type "char *".
(printnum, printnum_int): Add const qualifier to arguments of
type "char *".

14 years agoFix printing clone flags
Wang Chao [Thu, 2 Sep 2010 07:08:59 +0000 (15:08 +0800)]
Fix printing clone flags

When we trace clone() syscall with only exit signal as clone
flags, strace would print an unnecessary OR operator.

* process.c (sys_clone): Fix this.

Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
14 years agoDrop nclone_detached and related flags
Wang Chao [Fri, 27 Aug 2010 09:43:16 +0000 (17:43 +0800)]
Drop nclone_detached and related flags

Remove nclone_detached since CLONE_DETACHED flag was no-op for a very
long time in kernel.

* defs.h (struct tcb): Remove nclone_detached field.
Remove TCB_CLONE_DETACHED flag.
* process.c: Remove CLONE_DETACHED flag.
(clone_flags): Remove CLONE_DETACHED entry.
(internal_fork, internal_wait): Remove code dealing with CLONE_DETACHED
flag and nclone_detached.
* strace.c (startup_attach, alloc_tcb, droptcb, handle_group_exit):
Likewise.

Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
14 years agoCorrect get/set_robust_list syscall numbers for powerpc
Neil Campbell [Thu, 5 Aug 2010 22:53:29 +0000 (23:53 +0100)]
Correct get/set_robust_list syscall numbers for powerpc

* linux/powerpc/syscallent.h: Swap positions of get_ and set_robust_list.

14 years agoHandle CLONE_PARENT flag
Wang Chao [Thu, 5 Aug 2010 06:58:37 +0000 (14:58 +0800)]
Handle CLONE_PARENT flag

* process.c (internal_fork): The parent of new cloned process is the
same of the calling process when CLONE_PARENT is set.

14 years agoFix error when judging if process has children
Wang Chao [Thu, 5 Aug 2010 06:40:45 +0000 (14:40 +0800)]
Fix error when judging if process has children

* process.c (internal_wait): Processes counted in tcp->nclone_threads
are tcp's threads, rather than tcp's children.

Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
14 years agoForbid using mutually exclusive options -D and -p together
Wang Chao [Thu, 5 Aug 2010 06:30:11 +0000 (14:30 +0800)]
Forbid using mutually exclusive options -D and -p together

If we use -D and -p option together to trace a multi-thread program, in
addition to the main thread, other threads could not be traced even if we
present -f option. Moreover, when executing 'strace -D -p <non-exist pid>',
strace could not terminate normally.

* strace.c (main): Check it.

Signed-off-by: Wang Chao <wang.chao@cn.fujitsu.com>
14 years agoUpdate Linux MIPS syscalls to match 2.6.35-rc6+
David Daney [Thu, 29 Jul 2010 22:51:14 +0000 (15:51 -0700)]
Update Linux MIPS syscalls to match 2.6.35-rc6+

* linux/mips/syscallent.h: Add and update 405 hooks.

14 years agoAdd support for the MicroBlaze architecture
Edgar E. Iglesias [Tue, 6 Jul 2010 12:21:07 +0000 (14:21 +0200)]
Add support for the MicroBlaze architecture

* configure.ac: Recognize MicroBlaze.
* linux/microblaze/syscallent.h: New file.
* Makefile.am (EXTRA_DIST): Add linux/microblaze/syscallent.h
* process.c (change_syscall, struct_user_offsets): Add MicroBlaze
support.
* signal.c (sys_sigreturn): Likewise.
* syscall.c (internal_syscall, get_scno, syscall_fixup, get_error,
syscall_enter): Likewise.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>
14 years agolinux/sparc: add missing syscall declarations
Frederik Schüler [Wed, 28 Apr 2010 22:48:45 +0000 (00:48 +0200)]
linux/sparc: add missing syscall declarations

* linux/sparc/syscall.h: Sync with linux/syscall.h

Signed-off-by: Frederik Schüler <fs@debian.org>
14 years agoHandle biarch get/setrlimit
Andreas Schwab [Sat, 3 Jul 2010 21:17:28 +0000 (23:17 +0200)]
Handle biarch get/setrlimit

* resource.c (print_rlimit32) [POWERPC64 || X86_64]: Define.
(sys_getrlimit, sys_setrlimit) [POWERPC64 || X86_64]: Use it.

14 years agoAdd biarch support for powerpc64
Andreas Schwab [Mon, 12 Jul 2010 19:39:57 +0000 (21:39 +0200)]
Add biarch support for powerpc64

* acinclude.m4 (AC_LITTLE_ENDIAN_LONG_LONG): Use int instead of
long.
* configure.ac [$host_cpu = powerpc*]: Also define POWERPC64 if
$host_cpu = powerpc64.
* defs.h (SUPPORTED_PERSONALITIES, PERSONALITY0_WORDSIZE)
(PERSONALITY1_WORDSIZE) [POWERPC64]: Define.
* file.c: (struct stat_powerpc32, printstat_powerpc32) [POWERPC64]:
Define.
(printstat) [LINUX && POWERPC64]: Use printstat_powerpc32 in
32-bit personality.
(sys_newfstatat) [POWERPC64]: Handle personalities.
* signal.c (sys_sigreturn) [POWERPC64]: Likewise.
* util.c (printllval) [POWERPC64]: Likewise.
(printcall) [POWERPC64]: Use wider format for IP prefix.
* syscall.c (get_scno) [POWERPC64]: Check for 64/32 bit mode.
* linux/powerpc/errnoent1.h: New file.
* linux/powerpc/ioctlent1.h: New file.
* linux/powerpc/signalent1.h: New file.
* linux/powerpc/syscallent1.h: New file.

14 years agoBalance braces
Andreas Schwab [Fri, 9 Jul 2010 09:49:27 +0000 (11:49 +0200)]
Balance braces

* strace.c (proc_open): Avoid unbalanced braces.
(trace): Likewise.

14 years agoRemove extern declaration at file scope
Andreas Schwab [Sat, 3 Jul 2010 19:40:09 +0000 (21:40 +0200)]
Remove extern declaration at file scope

* defs.h (force_result): Declare.
* process.c (internal_wait): Don't declare force_result.

14 years agoDocument -C/-D
Andreas Schwab [Fri, 11 Jun 2010 13:49:36 +0000 (15:49 +0200)]
Document -C/-D

* strace.c (usage): Document -C.
* strace.1: Document -D.

14 years agoFix sourceforge download URL.
Roland McGrath [Wed, 14 Apr 2010 21:05:35 +0000 (14:05 -0700)]
Fix sourceforge download URL.

14 years agoM68K: Fix fetching syscall arguments
Andreas Schwab [Sat, 5 Jun 2010 19:50:30 +0000 (21:50 +0200)]
M68K: Fix fetching syscall arguments

* syscall.c (syscall_enter) [M68K]: Properly handle more than five
syscall arguments.

14 years agoDecode TLS syscalls on m68k
Andreas Schwab [Fri, 28 May 2010 20:28:51 +0000 (22:28 +0200)]
Decode TLS syscalls on m68k

* linux/m68k/syscallent.h: Add entries for get_thread_area,
set_thread_area, atomic_comxchg_32, atomic_barrier.
* linux/dummy.h (sys_get_thread_area, sys_set_thread_area) [M68K]:
Don't redefine.
* mem.c (sys_get_thread_area, sys_set_thread_area) [LINUX && M68K]: New.

14 years agoFix warning when compiling for m68k
Andreas Schwab [Fri, 28 May 2010 18:53:14 +0000 (20:53 +0200)]
Fix warning when compiling for m68k

* syscall.c (d0): Define as long.

14 years agoPrepare for 4.5.20 release v4.5.20
Dmitry V. Levin [Tue, 6 Apr 2010 23:46:43 +0000 (23:46 +0000)]
Prepare for 4.5.20 release

* NEWS: Update for 4.5.20 release.
* configure.ac: Version 4.5.20.
* debian/changelog: 4.5.20-1.
* strace.spec: 4.5.20-1.

14 years agoUpdate debian/* files for the upcoming release
Frederik Schüler [Tue, 13 Apr 2010 11:04:00 +0000 (13:04 +0200)]
Update debian/* files for the upcoming release

* debian/control: update standards-version to 3.8.4.
* debian/rules: allow parallel building.
* debian/rules: comment out verbose build, only needed for debugging.
* debian/rules: clean up clean: target, dh_clean does most of the work
  already.
* debian/rules: use *-stamp instead of stamp-*, so dh_clean can tidy
  up for us.

Signed-off-by: Frederik Schüler <fs@debian.org>
14 years agoFix s390 system call table list
Heiko Carstens [Tue, 13 Apr 2010 10:49:54 +0000 (12:49 +0200)]
Fix s390 system call table list

* linux/s390/syscallent.h: Add the missing entries for preadv and
pwritev to the system call table list.
* linux/s390x/syscallent.h: Likewise.

14 years agoUpdate linux/ioctlent.h
Dmitry V. Levin [Wed, 7 Apr 2010 11:22:28 +0000 (11:22 +0000)]
Update linux/ioctlent.h

* linux/ioctlent.sh: Search in asm-generic directory as well.
* linux/ioctlent.h: Regenerated.

14 years agoUpdate linux/*/syscallent.h files to match Linux kernel v2.6.33
Dmitry V. Levin [Mon, 5 Apr 2010 23:44:48 +0000 (23:44 +0000)]
Update linux/*/syscallent.h files to match Linux kernel v2.6.33

* linux/alpha/syscallent.h: Add 47 hooks.
* linux/arm/syscallent.h: Update hooks for pselect6, ppoll,
epoll_pwait.  Add 11 hooks.
* linux/bfin/syscallent.h: Update hooks for prctl, fallocate,
signalfd4, eventfd2, epoll_create1, dup3, pipe2, perf_event_open.
Hook up recvmmsg.
* linux/hppa/syscallent.h: Update hooks for signalfd4, eventfd2,
epoll_create1, dup3, pipe2, perf_event_open.
* linux/i386/syscallent.h: Fix syscall name for the kexec_load hook.
Add 5 hooks.
* linux/ia64/syscallent.h: Fix syscall name for the kexec_load hook.
Add 4 hooks.
* linux/m68k/syscallent.h: Add 50 hooks.
* linux/powerpc/syscallent.h: Fix hook for timerfd_create.  Fix
6 syscall names to match the kernel.  Use sys_semop to parse semop.
Add 14 hooks.
* linux/s390/syscallent.h: Fix syscall name for the kexec_load hook.
Add 14 hooks.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Add 13 hooks.
* linux/sh64/syscallent.h: Add 15 hooks.
* linux/sparc/syscallent.h: Add 22 hooks.
* linux/x86_64/syscallent.h: Add 5 hooks.

14 years agoEnhance recvmmsg parser
Dmitry V. Levin [Mon, 29 Mar 2010 16:45:48 +0000 (20:45 +0400)]
Enhance recvmmsg parser

* net.c (sys_recvmmsg): Decode mmsghdr structure on exit from the
syscall.  Decode timespec structure both on entrance and on exit.

14 years agoDecode recvmmsg syscall
Andreas Schwab [Fri, 12 Feb 2010 20:39:12 +0000 (21:39 +0100)]
Decode recvmmsg syscall

* net.c (do_msghr): New function to print struct msghdr.
(printmsghdr): Use it.
(printmmsghdr, sys_recvmmsg): New.
* linux/syscall.h: Declare sys_recvmmsg.
(SYS_sub_recvmmsg): Define.
(SYS_socket_nsubcalls): Bump.
* linux/sparc/syscall.h: Likewise.
* linux/arm/syscallent.h: Add sys_recvmmsg.
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/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/ia64/syscallent.h: Adjust.

14 years ago* strace.1: Fix quoting of hyphens and formatting of strace options.
Dmitry V. Levin [Wed, 31 Mar 2010 17:26:49 +0000 (17:26 +0000)]
* strace.1: Fix quoting of hyphens and formatting of strace options.

14 years agoSplit trace_syscall() for better readability
Dmitry V. Levin [Mon, 29 Mar 2010 17:51:02 +0000 (17:51 +0000)]
Split trace_syscall() for better readability

* syscall.c (trace_syscall): Split into trace_syscall_exiting() and
trace_syscall_entering().

14 years agoImplement -C option to combine regular and -c output
Dmitry V. Levin [Sun, 28 Mar 2010 19:24:54 +0000 (19:24 +0000)]
Implement -C option to combine regular and -c output

* defs.h (cflag_t): New enum.
* strace.1: Document -C option.
* strace.c (cflag): Update type.
(main): Handle -C option.
(trace): Update use of cflag.
* count.c (count_syscall): Move clearing of TCB_INSYSCALL to ...
* syscall.c (trace_syscall): ... here.  Update use of cflag.
Based on patch by Adrien Kunysz.

14 years agoFix "make dist" regression introduced by commit v4.5.19-12-g5078770
Dmitry V. Levin [Wed, 7 Apr 2010 10:17:24 +0000 (10:17 +0000)]
Fix "make dist" regression introduced by commit v4.5.19-12-g5078770

* Makefile.am (EXTRA_DIST): Rename linux/syscallent.h to linux/i386/syscallent.h

14 years ago* desc.c (sys_epoll_pwait): Fix output formatting bug.
Dmitry V. Levin [Tue, 6 Apr 2010 23:54:18 +0000 (23:54 +0000)]
* desc.c (sys_epoll_pwait): Fix output formatting bug.

14 years ago* desc.c (decode_select): Fix potential stack buffer overflow.
Dmitry V. Levin [Tue, 6 Apr 2010 23:50:49 +0000 (23:50 +0000)]
* desc.c (decode_select): Fix potential stack buffer overflow.

14 years agoFix msgsnd indirect ipccall decoding
Dmitry V. Levin [Wed, 31 Mar 2010 22:22:01 +0000 (22:22 +0000)]
Fix msgsnd indirect ipccall decoding

This regression was introduced by commit v4.5.18-136-g783f5bc.
* ipc.c (tprint_msgsnd): Add and use "flags" argument.
(sys_msgsnd): Pass "flags" argument to tprint_msgsnd().
Patch by Anton Blanchard.

14 years agoHook up inotify_init1 open mode flags printer
Mark Wielaard [Sun, 21 Mar 2010 13:41:26 +0000 (14:41 +0100)]
Hook up inotify_init1 open mode flags printer

* file.c [LINUX] (sys_inotify_init1): New function.
* linux/syscall.h: Declare new sys_inotify_init1 handler.
* linux/bfin/syscallent.h: Hook up new handler.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.

14 years agoAvoid spurious error when checking for linux/netlink.h
Andreas Schwab [Mon, 8 Mar 2010 15:07:52 +0000 (16:07 +0100)]
Avoid spurious error when checking for linux/netlink.h

* configure.ac: Include <asm/types.h> when checking for
linux/netlink.h.

14 years agoFix reporting signal mask by sigreturn on powerpc
Andreas Schwab [Mon, 22 Feb 2010 23:18:51 +0000 (00:18 +0100)]
Fix reporting signal mask by sigreturn on powerpc

* signal.c (sys_sigreturn) [POWERPC]: Skip dummy stack frame when
locating signal context.

14 years agoFix MIPS N32/N64 compile error
David Daney [Tue, 9 Feb 2010 21:22:30 +0000 (21:22 +0000)]
Fix MIPS N32/N64 compile error

* syscall.c [LINUX_MIPSN32 || LINUX_MIPSN64] (syscall_enter): Pass
tcp->pid to ptrace().

14 years agoAdd support for the TILE architecture
Chris Metcalf [Mon, 28 Dec 2009 15:00:15 +0000 (10:00 -0500)]
Add support for the TILE architecture

* configure.ac: Add TILE to the list of supported architectures.
* defs.h: Define TCB_WAITEXECVE for TILE.
* linux/tile/syscallent.h: New file.
* Makefile.am (EXTRA_DIST): Add linux/tile/syscallent.h
* process.c (change_syscall, struct_user_offsets): Add TILE support.
* syscall.c (get_scno, get_error, syscall_enter): Likewise.
* mem.c (mmap_flags, print_mmap): Add MAP_CACHE_xxx TILE extensions
support.
* signal.c (sigact_flags): Add SA_NOPTRACE.
(sys_sigreturn): Add TILE support.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
14 years agoRemove dead code
Dmitry V. Levin [Thu, 31 Dec 2009 22:50:49 +0000 (22:50 +0000)]
Remove dead code

* defs.h (tv_tv): Remove.
* net.c (sys_xsetsockaddr): Remove commented out dead code.
* process.c (setarg, sys_execv, sys_execve, struct_user_offsets):
Likewise.
* signal.c (sys_sigsuspend): Likewise.
* strace.c (reaper, trace): Likewise.
* stream.c (internal_stream_ioctl): Likewise.
* syscall.c (trace_syscall): Likewise.
* term.c (term_ioctl): Likewise.
* util.c (tv_tv, umoven, uload, getpc, fixvfork, setbpt, clearbpt):
Likewise.