]> granicus.if.org Git - strace/log
strace
13 years agoFix decoding of file descriptors
Dmitry V. Levin [Fri, 4 Mar 2011 02:08:02 +0000 (05:08 +0300)]
Fix decoding of file descriptors

* defs.h (printfd): New function prototype.
* util.c (printfd): New function.
* file.c (print_dirfd): Update prototype to use printfd().
(sys_openat, sys_faccessat, sys_newfstatat, sys_mkdirat, sys_linkat,
sys_unlinkat, sys_readlinkat, sys_renameat, sys_fchownat, sys_fchmodat,
sys_futimesat, sys_utimensat, sys_mknodat): Update use of print_dirfd().
(sys_lseek, sys_llseek, sys_readahead, sys_ftruncate, sys_ftruncate64,
sys_fstat, sys_fstat64, sys_oldfstat, sys_fstatfs, sys_fstatfs64,
sys_fchdir, sys_fchroot, sys_linkat, sys_fchown, sys_fchmod, sys_fsync,
sys_readdir, sys_getdents, sys_getdirentries, sys_fsetxattr,
sys_fgetxattr, sys_flistxattr, sys_fremovexattr, sys_fadvise64,
sys_fadvise64_64, sys_inotify_add_watch, sys_inotify_rm_watch,
sys_fallocate): Use printfd() for decoding of file descriptors.
* desc.c (sys_fcntl, sys_flock, sys_close, sys_dup, do_dup2,
decode_select, sys_epoll_ctl, epoll_wait_common): Use printfd() for
decoding of file descriptors.
* io.c (sys_read, sys_write, sys_readv, sys_writev, sys_pread,
sys_pwrite, sys_sendfile, sys_sendfile64, sys_pread64, sys_pwrite64,
sys_ioctl): Likewise.
* mem.c (print_mmap, sys_mmap64): Likewise.
* signal.c (do_signalfd): Likewise.
* stream.c (decode_poll): Likewise.
* time.c (sys_timerfd_settime, sys_timerfd_gettime): Likewise.
Based on patch from Grant Edwards <grant.b.edwards@gmail.com>.

13 years agoPrint shutdown(2) modes as SHUT_* constants
Sebastian Pipping [Thu, 3 Mar 2011 00:12:25 +0000 (01:12 +0100)]
Print shutdown(2) modes as SHUT_* constants

* net.c (shutdown_modes): New xlat structure.
(sys_shutdown): Use shutdown_modes to decode 2nd syscall argument.

13 years agoFix decoding of inotify_init1() flags
Sebastian Pipping [Wed, 2 Mar 2011 23:50:55 +0000 (00:50 +0100)]
Fix decoding of inotify_init1() flags

* file.c (inotify_init_flags): New xlat structure.
(sys_inotify_init1): Use it instead of open_mode_flags.

13 years agoFix struct xlat initialization bugs
Dmitry V. Levin [Thu, 3 Mar 2011 01:02:41 +0000 (01:02 +0000)]
Fix struct xlat initialization bugs

* file.c (inotify_modes): Terminate with NULL entry.
* net.c (sock_type_flags): Make this array static.
(socketlayers): Add a comment that this array should remain not
NULL-terminated.

13 years agotests: avoid SIGPIPE
Dmitry V. Levin [Thu, 3 Mar 2011 00:10:20 +0000 (00:10 +0000)]
tests: avoid SIGPIPE

* tests/ptrace_setoptions: Replace "grep -q" with "grep > /dev/null".
The former may result to strace being killed by SIGPIPE, which in
certain configuratons may lead to generation of a core file.
Suggested by Mike Frysinger.

13 years agotests: do not make missing /usr/bin/time a failure
Mike Frysinger [Tue, 1 Mar 2011 00:57:24 +0000 (19:57 -0500)]
tests: do not make missing /usr/bin/time a failure

* tests/init.sh (framework_skip_): New function.
(check_prog): Use it instead of framework_failure_.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
13 years agoGenerate an xz tar archive of the distribution
Dmitry V. Levin [Sun, 27 Feb 2011 14:05:58 +0000 (14:05 +0000)]
Generate an xz tar archive of the distribution

* configure.ac (AM_INIT_AUTOMAKE): Replace dist-bzip2 with dist-xz.
* Makefile.am: Update srpm target.
* make-dist: Update for dist-xz.
* strace.spec: Update Source tag.
* debian/watch: Update regexp.
* .gitignore: Add strace-*.tar.xz.

13 years agoUse "make check" in debian/rules and strace.spec
Dmitry V. Levin [Sun, 27 Feb 2011 10:16:41 +0000 (10:16 +0000)]
Use "make check" in debian/rules and strace.spec

* debian/control: Update Build-Depends.
* debian/rules: Run "make check".
* strace.spec: Update BuildRequires. Run "make check" in %check section.

13 years agoImplement two basic "strace -f" tests
Dmitry V. Levin [Sun, 27 Feb 2011 00:28:50 +0000 (00:28 +0000)]
Implement two basic "strace -f" tests

* Makefile.am (SUBDIRS): Add tests.
* configure.ac (AC_CONFIG_FILES): Add tests/Makefile.
* tests/.gitignore: New file.
* tests/Makefile.am: Likewise.
* tests/init.sh: Likewise.
* tests/ptrace_setoptions: Likewise.
* tests/strace-f: Likewise.

13 years agoppc, s390, sparc: regenerate ioctlent.h files
Dmitry V. Levin [Sat, 26 Feb 2011 14:39:21 +0000 (14:39 +0000)]
ppc, s390, sparc: regenerate ioctlent.h files

* linux/powerpc/ioctlent.h: Regenerated using Fedora 15 kernel headers.
* linux/s390/ioctlent.h: Likewise.
* linux/sparc/ioctlent.h: Likewise.

13 years agoRemove redundant ioctlent.h files
Dmitry V. Levin [Sat, 26 Feb 2011 14:32:12 +0000 (14:32 +0000)]
Remove redundant ioctlent.h files

* linux/s390x/ioctlent.h: Replace old contents with include of
s390/ioctlent.h file.
* linux/sparc64/ioctlent.h: Replace old contents with include of
sparc/ioctlent.h file.

13 years agoioctlsort: sync with ioctl_lookup()
Dmitry V. Levin [Fri, 25 Feb 2011 23:29:01 +0000 (23:29 +0000)]
ioctlsort: sync with ioctl_lookup()

* linux/ioctlsort.c (main): Use NR and TYPE bits only, to sync with
ioctl_lookup() which looks at these bits only.

13 years agoRemove obsolete .cvsignore files
Dmitry V. Levin [Fri, 25 Feb 2011 16:53:50 +0000 (16:53 +0000)]
Remove obsolete .cvsignore files

* test/.cvsignore: Rename to test/.gitignore.
* */.cvsignore, */*/.cvsignore: Removed.

13 years agoIgnore generated intermediate header files
Dmitry V. Levin [Fri, 25 Feb 2011 16:47:51 +0000 (16:47 +0000)]
Ignore generated intermediate header files

* .gitignore: Add ioctls.h and ioctldefs.h.

13 years agoGenerate much of the CREDITS file from git log
Dmitry V. Levin [Thu, 24 Feb 2011 01:51:15 +0000 (01:51 +0000)]
Generate much of the CREDITS file from git log

* CREDITS.in: New file, derived from CREDITS, without names of
those who are listed as git log 'Author:'s.
* CREDITS: Remove file.
* Makefile.am [MAINTAINER_MODE] (CREDITS): New rule.
* .gitignore: Add CREDITS.
* .mailmap: New file, required to map git author names and email
addresses to canonical/preferred form.

13 years agosparc: fix compilation warning
Dmitry V. Levin [Wed, 23 Feb 2011 16:16:50 +0000 (16:16 +0000)]
sparc: fix compilation warning

* file.c [!HAVE_LONG_LONG_OFF_T] (realprintstat): Cast st_size
to unsigned long.

13 years agoUpdate the list of files that must be distributed
Dmitry V. Levin [Wed, 23 Feb 2011 12:43:46 +0000 (12:43 +0000)]
Update the list of files that must be distributed

* Makefile.am (EXTRA_DIST): Add debian/source/format, debian/watch,
linux/ia64/signalent.h, linux/powerpc/ioctlent1.h,
linux/powerpc/syscallent1.h, linux/powerpc/errnoent1.h,
linux/powerpc/signalent1.h.

13 years agoFix compilation warning reported by gcc -Wunused-but-set-variable
Dmitry V. Levin [Wed, 23 Feb 2011 00:27:12 +0000 (00:27 +0000)]
Fix compilation warning reported by gcc -Wunused-but-set-variable

* process.c (printwaitn) [!SUNOS4]: Do not define "exited" variable.

13 years agoioctlsort: zero pad ioctl codes to 4 places
Mike Frysinger [Tue, 22 Feb 2011 04:52:42 +0000 (23:52 -0500)]
ioctlsort: zero pad ioctl codes to 4 places

Zero padding the ioctl number will allow simple sorting via shell scripts.

* linux/ioctlsort.c (main): Output ioctl codes zero padded.
* linux/ioctlent.h: Regenerated.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
13 years agoUpdate mount flags to latest linux
Mike Frysinger [Tue, 22 Feb 2011 04:04:30 +0000 (23:04 -0500)]
Update mount flags to latest linux

* system.c (MS_RELATIME, MS_KERNMOUNT, MS_I_VERSION,
MS_STRICTATIME, MS_BORN): Define.
(mount_flags): Add MS_RELATIME, MS_KERNMOUNT, MS_I_VERSION,
MS_STRICTATIME, MS_BORN.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
13 years agoSync debian/changelog and strace.spec with packages
Dmitry V. Levin [Mon, 21 Feb 2011 23:22:34 +0000 (23:22 +0000)]
Sync debian/changelog and strace.spec with packages

* debian/changelog: Sync with 4.5.20-2.
* strace.spec: Likewise.

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>
13 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.

13 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>
13 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.

13 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.

13 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.

13 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>
13 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>
13 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>
13 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>
13 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>
13 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).

13 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.

13 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.

13 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.

13 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.

13 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 *".

13 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>
13 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>
13 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.

13 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.

13 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>
13 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>
13 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.

13 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>
13 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>
13 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.

13 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.