]> granicus.if.org Git - strace/log
strace
9 years agotests: fix unix domain socket decoding availability test
Dmitry V. Levin [Thu, 25 Dec 2014 00:11:40 +0000 (00:11 +0000)]
tests: fix unix domain socket decoding availability test

Since inet_diag and unix_diag interfaces are implemented by different
kernel modules, they have to be tested separately.

* tests/netlink_unix_diag.c: New file.
* tests/unix-yy.test: Use it.
* tests/Makefile.am (check_PROGRAMS): Add it.
* tests/.gitignore: Likewise.

9 years agotests: add a test for decoding unix domain socket addresses
Masatake YAMATO [Wed, 24 Dec 2014 11:59:32 +0000 (20:59 +0900)]
tests: add a test for decoding unix domain socket addresses

* tests/unix-yy-accept.awk: New file.
* tests/unix-yy-connect.awk: New file.
* tests/unix-yy.test: New test.
* tests/Makefile.am (TESTS): Add it.
(EXTRA_DIST): Add unix-yy-accept.awk and unix-yy-connect.awk.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoSupport unix domain sockets in -yy option
Masatake YAMATO [Wed, 24 Dec 2014 11:59:31 +0000 (20:59 +0900)]
Support unix domain sockets in -yy option

This change extends -yy option to handle unix domain sockets:
their peer addresses will be printed, similar to inet sockets.

For a listening socket, its socket inode and socket path are printed.
For an accepted socket, its socket inode, the peer inode, and the
socket path are printed.
For a client socket, its socket inode and the peer inode are printed.

An example of a server side communication using netcat:

$ ./strace -yy -e network nc -l -U /tmp/example.sock
socket(PF_LOCAL, SOCK_STREAM, 0)        = 3
setsockopt(3<UNIX:[14728348]>, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
bind(3<UNIX:[14728348]>, {sa_family=AF_LOCAL, sun_path="/tmp/example.sock"}, 19) = 0
listen(3<UNIX:[14728348,"/tmp/example.sock"]>, 10) = 0
accept(3<UNIX:[14728348,"/tmp/example.sock"]>, {sa_family=AF_LOCAL, NULL}, [2]) = 4<UNIX:[14727246->14727245,"/tmp/example.sock"]>
recvfrom(4<UNIX:[14727246->14727245,"/tmp/example.sock"]>, "INPUT\n", 8192, 0, NULL, NULL) = 6
INPUT

An example of a client side communication using netcat:

$ ./strace -yy -e network nc -U /tmp/example.sock
socket(PF_LOCAL, SOCK_STREAM, 0)        = 3
connect(3<UNIX:[14727245]>, {sa_family=AF_LOCAL, sun_path="/tmp/example.sock"}, 19) = 0
getsockopt(3<UNIX:[14727245]>, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
INPUT
...
sendto(3<UNIX:[14727245->14727246]>, "INPUT\n", 6, 0, NULL, 0) = 6

* linux/unix_diag.h: New file.
* socketutils.c (send_query): Rename to inet_send_query.
(parse_response): Rename to inet_parse_response.
(unix_print, unix_send_query, unix_parse_response): New functions.
(receive_responses): Add a new argument named parser: a function for
handling protocol specific data parts of diag messages.
(print_sockaddr_by_inode): Call unix_print.
Replace NETLINK_INET_DIAG with NETLINK_SOCK_DIAG, they are equal
but NETLINK_SOCK_DIAG looks more generic.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoUse the protocol name of a socket as a hint for peer address resolution
Masatake YAMATO [Wed, 10 Dec 2014 03:55:06 +0000 (12:55 +0900)]
Use the protocol name of a socket as a hint for peer address resolution

To resolve the peer address of socket, all combinations of families
(AF_INET, AF_INET6) and protocols(IPPROTO_TCP, IPPROTO_UDP) were tried.
This change utilizes the protocol name obtained via getxattr to specify
the right combination.

* socketutils.c (inet_print): New helper function.
(print_sockaddr_by_inode): Use it.  Utilize the protocol name
associated with the given inode for resolving the peer socket
address.  If the protocol name is NULL, resolve the address
by trying combinations of families and protocols as before.
* defs.h (print_sockaddr_by_inode): Update prototype.
* util.c (printfd): Pass the protocol name associated with
the given path to print_sockaddr_by_inode as the 2nd argument.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoFix decoding of getgroups, getgroups32, setgroups, and setgroups32 syscalls
Dmitry V. Levin [Sun, 14 Dec 2014 13:30:54 +0000 (13:30 +0000)]
Fix decoding of getgroups, getgroups32, setgroups, and setgroups32 syscalls

Convert parsers of these syscalls to the same scheme as were applied to
parsers of other uid/gid related syscalls.
That is, define two sets of parsers on architectures that support
(either directly or via multiarch) 16-bit and 32-bit gid getgroups
and setgroups syscalls simultaneously, and reuse essentially the same
code by parametrizing uid_t and names of parser functions.

* groups.c: Remove.
(sys_getgroups, sys_setgroups): Move ...
* uid.c: ... here and parametrize their names.
* Makefile.am (strace_SOURCES): Remove groups.c.
* linux/syscall.h (sys_getgroups32, sys_setgroups32): Remove.
[NEED_UID16_PARSERS] (sys_getgroups16, sys_setgroups16): New prototypes.
* linux/arm/syscallent.h: Rename sys_[gs]etgroups to sys_[gs]etgroups16,
rename sys_[gs]etgroups32 to sys_[gs]etgroups.
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* tests/uid.c: Test for getgroups.
* tests/uid16.c: Likewise.
* tests/uid32.c: Test for getgroups32.
* tests/uid.awk: Test for getgroups/getgroups32 decoding.
* tests/uid.test: Trace getgroups/getgroups32 syscalls.

9 years agoFix decoding of 16-bit *chown and [gs]et*[gu]id syscalls
Dmitry V. Levin [Sat, 13 Dec 2014 21:49:01 +0000 (21:49 +0000)]
Fix decoding of 16-bit *chown and [gs]et*[gu]id syscalls

Define two sets of parsers on architectures that support (either
directly or via multiarch) 16-bit and 32-bit uid/gid syscalls
simultaneously.  Since the code in these two sets is essentially
the same and the key difference between them is the size of uid_t,
implement it by parametrizing uid_t and names of parser functions.

* defs.h (NEED_UID16_PARSERS): New macro.
* linux/syscall.h [NEED_UID16_PARSERS] (sys_chown16, sys_fchown16,
sys_getresuid16, sys_getuid16, sys_setfsuid16, sys_setresuid16,
sys_setreuid16, sys_setuid16): New prototypes.
* linux/dummy.h (sys_geteuid16): Alias to sys_getuid16.
(sys_getegid16, sys_getgid16, sys_getresgid16, sys_setfsgid16,
sys_setgid16, sys_setregid16, sys_setresgid16): Alias to corresponding
sys_*uid16 functions.
* uid.c: Stop including <asm/posix_types.h>.
Parametrize uid_t and names of all exported functions.
(get_print_uid): New function.
(sys_getresuid): Use it.
(printuid): Check for (uid_t) -1.
* uid16.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/arm/syscallent.h: Use sys_chown16, sys_fchown16, sys_getegid16,
sys_geteuid16, sys_getgid16, sys_getresgid16, sys_getresuid16,
sys_getuid16, sys_setfsgid16, sys_setfsuid16, sys_setgid16,
sys_setregid16, sys_setresgid16, sys_setresuid16, sys_setreuid16,
and sys_setuid16 parsers for *chown and [gs]et*[gu]id syscall entries.
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* tests/uid16.c: New file.
* tests/uid16.test: New test.
* tests/Makefile.am (CHECK_PROGRAMS): Add uid16.
(TESTS): Add uid16.test.
* tests/.gitignore: Add uid16.

9 years agosh, sh64: fix uid/gid syscall entries
Dmitry V. Levin [Tue, 16 Dec 2014 00:31:53 +0000 (00:31 +0000)]
sh, sh64: fix uid/gid syscall entries

* linux/sh/syscallent.h: Replace printargs with real syscall
parsers in *chown32 and [gs]et*[gu]id32 syscall entries.
* linux/sh64/syscallent.h: Likewise.

9 years agos390: fix uid/gid syscall entries
Dmitry V. Levin [Tue, 16 Dec 2014 00:41:50 +0000 (00:41 +0000)]
s390: fix uid/gid syscall entries

* linux/s390/syscallent.h: Add "32" suffix to names of *chown32
and [gs]et*[gu]id32 syscalls #198..216.

9 years agosparc: fix uid/gid syscall entries
Dmitry V. Levin [Tue, 16 Dec 2014 00:25:36 +0000 (00:25 +0000)]
sparc: fix uid/gid syscall entries

* linux/sparc/syscallent.h: Add "32" suffix to names
of [gs]etres[gu]id32 syscalls #108..112.
Fix entry for syscall #112 from setresgid32 to setregid32.

9 years agochown.c: split into separate files
Dmitry V. Levin [Sat, 13 Dec 2014 16:20:44 +0000 (16:20 +0000)]
chown.c: split into separate files

This will make further uid/gid fixes simpler.

* fchownat.c: New file.
* chown.c (sys_fchownat: Move to fchownat.c.
(sys_chown, sys_fchown): Move to uid.c.
* Makefile.am (strace_SOURCES): Remove chown.c, add fchownat.c.

9 years agoutil.c: move printuid to uid.c
Dmitry V. Levin [Sat, 13 Dec 2014 16:02:22 +0000 (16:02 +0000)]
util.c: move printuid to uid.c

This will make further uid/gid fixes simpler.

* util.c (printuid): Move
* uid.c: ... here.

9 years agotests/uid.awk: rewrite in a more maintainable style
Dmitry V. Levin [Mon, 15 Dec 2014 23:44:31 +0000 (23:44 +0000)]
tests/uid.awk: rewrite in a more maintainable style

Since the test is virtually a FSM, rewrite it as a FSM.

9 years agoprintuid: fix uid_t decoding on 64-bit architectures
Dmitry V. Levin [Sat, 13 Dec 2014 18:24:13 +0000 (18:24 +0000)]
printuid: fix uid_t decoding on 64-bit architectures

It was not a good idea to treat uid_t as a long int type because
the latter is twice larger than uid_t on 64-bit architectures.

* defs.h (printuid): Change uid argument type from "unsigned long"
to "unsigned int".
* util.c (printuid): Likewise.  When uid equals to -1, print "-1".
* tests/uid.awk: New file.
* tests/uid.c: New file.
* tests/uid32.c: Likewise.
* tests/uid.test: New test.
* tests/uid32.test: Likewise.
* tests/Makefile.am (CHECK_PROGRAMS): Add uid and uid32.
(TESTS): Add uid.test and uid32.test.
(EXTRA_DIST): Add uid.awk.
* tests/.gitignore: Add uid and uid32.

9 years agoUpdate PTRACE_* constants
Dmitry V. Levin [Sat, 13 Dec 2014 01:56:56 +0000 (01:56 +0000)]
Update PTRACE_* constants

* xlat/ptrace_cmds.in: Add PTRACE_PEEKSIGINFO, PTRACE_GETSIGMASK,
and PTRACE_SETSIGMASK.

9 years agoUpdate SWAP_FLAG_* constants
Dmitry V. Levin [Sat, 13 Dec 2014 01:34:47 +0000 (01:34 +0000)]
Update SWAP_FLAG_* constants

* swapon.c: Ensure that SWAP_FLAG_DISCARD_ONCE and
SWAP_FLAG_DISCARD_PAGES are defined.
* xlat/swap_flags.in: Add SWAP_FLAG_DISCARD_ONCE and
SWAP_FLAG_DISCARD_PAGES.

9 years agoUpdate SCHED_* constants
Dmitry V. Levin [Thu, 11 Dec 2014 21:32:52 +0000 (21:32 +0000)]
Update SCHED_* constants

* xlat/schedulers.in: Add SCHED_BATCH, SCHED_ISO, SCHED_IDLE, and
SCHED_DEADLINE.

9 years agoUpdate prctl PR_* constants
Dmitry V. Levin [Thu, 11 Dec 2014 20:54:34 +0000 (20:54 +0000)]
Update prctl PR_* constants

* xlat/prctl_options.in: Add PR_SET_THP_DISABLE, PR_GET_THP_DISABLE,
PR_MPX_ENABLE_MANAGEMENT, and PR_MPX_DISABLE_MANAGEMENT.

9 years agoAlways compile sys_prctl parser
Dmitry V. Levin [Thu, 11 Dec 2014 20:44:10 +0000 (20:44 +0000)]
Always compile sys_prctl parser

Since sys_prctl is referenced by syscallent files unconditionally,
conditional compilation of sys_prctl depending on prctl availability is
pointless.

* prctl.c (unalignctl_string, sys_prctl): Compile unconditionally.

9 years agoprocess.c: split struct_user_offsets into architecture-specific include files
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: split struct_user_offsets into architecture-specific include files

* Makefile.am (EXTRA_DIST): Add linux/alpha/userent.h,
linux/arm/userent.h, linux/avr32/userent.h, linux/bfin/userent.h,
linux/crisv10/userent.h, linux/crisv32/userent.h,
linux/i386/userent.h, linux/i386/userent0.h, linux/ia64/userent.h,
linux/m68k/userent.h, linux/microblaze/userent.h,
linux/mips/userent.h, linux/or1k/userent.h, linux/powerpc/userent.h,
linux/s390/userent.h, linux/s390/userent0.h, linux/s390/userent1.h,
linux/s390x/userent.h, linux/sh/userent.h, linux/sh/userent0.h,
linux/sh64/userent.h, linux/sparc/userent.h, linux/sparc64/userent.h,
linux/tile/userent.h, linux/userent.h, linux/userent0.h,
linux/x32/userent.h, linux/x86_64/userent.h, and
linux/xtensa/userent.h.
* process.c (struct_user_offsets): Split into architecture-specific
include files, inculde userent.h.

9 years agoprocess.c: include less headers
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: include less headers

* process.c: Do not include <fcntl.h> and <sys/stat.h>.
Reorder inclusion of xlat header files.

9 years agoUnexport struct_user_offsets
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
Unexport struct_user_offsets

* defs.h (struct_user_offsets): Remove.
* process.c (struct_user_offsets): Make static.

9 years agoprocess.c: introduce XLAT_UOFF macro
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: introduce XLAT_UOFF macro

Introduce XLAT_UOFF macro and use it to automatically transform
struct_user_offsets array into a more readable and compact form.

for n in $(sed -n 's/^[[:space:]]*{[[:space:]]*uoff(\([a-z_0-9]\+\)),.*/\1/p' process.c |sort -u); do
sed -i 's/^\([[:space:]]*\){[[:space:]]*uoff('"$n"'),[[:space:]]*"offsetof(struct user,[[:space:]]*'"$n"')"[[:space:]]*},$/\1XLAT_UOFF('"$n"'),/' process.c
done

* process.c (XLAT_UOFF): New macro.
(struct_user_offsets): Use it.

9 years agoprocess.c: move sethostname and gethostname parsers to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: move sethostname and gethostname parsers to a separate file

* hostname.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_sethostname, sys_gethostname): Move to hostname.c.

9 years agoprocess.c: move exit parser to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: move exit parser to a separate file

* exit.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_exit): Move to exit.c.

9 years agoprocess.c: move clone, setns, unshare, and fork parsers to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: move clone, setns, unshare, and fork parsers to a separate file

* clone.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c: Move sys_clone, sys_setns, sys_unshare, sys_fork, and
related code to clone.c.

9 years agoprocess.c: move get*uid and set*uid parsers to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: move get*uid and set*uid parsers to a separate file

* uid.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_getuid, sys_setfsuid, sys_setuid, sys_getresuid,
sys_setreuid, sys_setresuid): Move to uid.c.

9 years agoprocess.c: move getgroups* and setgroups* parsers to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: move getgroups* and setgroups* parsers to a separate file

* groups.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c: Move sys_setgroups, sys_getgroups, sys_setgroups32,
sys_getgroups32, and related code to groups.c.

9 years agoprocess.c: move execve and execv parsers to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: move execve and execv parsers to a separate file

* execve.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c: Move sys_execve, sys_execv, and related code to execve.c.

9 years agoprocess.c: move waitpid, wait4, osf_wait4, and waitid parsers to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: move waitpid, wait4, osf_wait4, and waitid parsers to a separate file

* wait.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c: Move sys_waitpid, sys_wait4, sys_osf_wait4, sys_waitid and
related code to wait.c.

9 years agoprocess.c: move uname parser to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: move uname parser to a separate file

* uname.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_uname): Move to uname.c.

9 years agoprocess.c: move futex parser to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: move futex parser to a separate file

* futex.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c: Move sys_futex and related code to futex.c.

9 years agoprocess.c: move get_robust_list parser to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: move get_robust_list parser to a separate file

* get_robust_list.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_get_robust_list): Move to get_robust_list.c.

9 years agoprocess.c: move sched_* parsers to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: move sched_* parsers to a separate file

* sched.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c: Move sys_sched_getscheduler, sys_sched_setscheduler,
sys_sched_getparam, sys_sched_setparam, sys_sched_get_priority_min,
sys_sched_rr_get_interval, and related code to sched.c.

9 years agoprocess.c: move sched_setaffinity and sched_getaffinity parsers to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: move sched_setaffinity and sched_getaffinity parsers to a separate file

* affinity.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_sched_setaffinity, sys_sched_getaffinity): Move
to affinity.c.

9 years agoprocess.c: move prctl and arch_prctl parsers to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:25:02 +0000 (19:25 +0000)]
process.c: move prctl and arch_prctl parsers to a separate file

* prctl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c: Move sys_prctl, sys_arch_prctl, and related code to prctl.c.

9 years agoprocess.c: move getcpu parser to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:21:54 +0000 (19:21 +0000)]
process.c: move getcpu parser to a separate file

* getcpu.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_getcpu): Move to getcpu.c.

9 years agoprocess.c: move process_vm_readv and process_vm_writev parsers to a separate file
Dmitry V. Levin [Thu, 11 Dec 2014 19:21:54 +0000 (19:21 +0000)]
process.c: move process_vm_readv and process_vm_writev parsers to a separate file

* process_vm.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_process_vm_readv, sys_process_vm_writev): Move
to process_vm.c.

9 years agoImplement decoding of fallocate FALLOC_FL_* flags
Dmitry V. Levin [Thu, 11 Dec 2014 19:21:54 +0000 (19:21 +0000)]
Implement decoding of fallocate FALLOC_FL_* flags

* xlat/falloc_flags.in: New file.
* configure.ac (AC_CHECK_HEADERS): Add linux/falloc.h.
* fallocate.c [HAVE_LINUX_FALLOC_H]: Include <linux/falloc.h>.
Include xlat/falloc_flags.h.
(sys_fallocate): Decode flags.

9 years agoFix decoding of renameat2 RENAME_* flags
Dmitry V. Levin [Thu, 11 Dec 2014 18:55:43 +0000 (18:55 +0000)]
Fix decoding of renameat2 RENAME_* flags

* renameat.c: Include <linux/fs.h> where RENAME_NOREPLACE,
RENAME_EXCHANGE, and RENAME_WHITEOUT are usually defined.

9 years agofile.c: move open, openat, and creat parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move open, openat, and creat parsers to a separate file

* open.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_open, sys_openat, sys_creat, and related code
to open.c.

9 years agofile.c: move access and faccessat parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move access and faccessat parsers to a separate file

* access.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_access, sys_faccessat and related code to access.c.

9 years agofile.c: move umask parser to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move umask parser to a separate file

* umask.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_umask): Move to umask.c.

9 years agofile.c: move lseek and llseek parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move lseek and llseek parsers to a separate file

* lseek.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_lseek, sys_llseek, and related code to lseek.c.

9 years agofile.c: move readahead parser to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move readahead parser to a separate file

* readahead.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_readahead): Move to readahead.c.

9 years agofile.c: move truncate, truncate64, ftruncate, and ftruncate64 parsers to a separate...
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move truncate, truncate64, ftruncate, and ftruncate64 parsers to a separate file

* truncate.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_truncate, sys_truncate64, sys_ftruncate, sys_ftruncate64):
Move to truncate.c.

9 years agofile.c: move chdir parser to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move chdir parser to a separate file

* chdir.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_chdir): Move to chdir.c.

9 years agofile.c: move link, linkat, unlinkat, and symlinkat parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move link, linkat, unlinkat, and symlinkat parsers to a separate file

* link.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_link, sys_linkat, sys_unlinkat, sys_symlinkat, and
related code to link.c.

9 years agofile.c: move readlink and readlinkat parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move readlink and readlinkat parsers to a separate file

* readlink.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (decode_readlink, sys_readlink, sys_readlinkat): Move
to readlink.c.

9 years agofile.c: move renameat and renameat2 parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move renameat and renameat2 parsers to a separate file

* renameat.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_renameat, sys_renameat2, and related code
to renameat.c.

9 years agofile.c: move chown, fchown, and fchownat parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move chown, fchown, and fchownat parsers to a separate file

* chown.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_chown, sys_fchownat, sys_fchown): Move to chown.c.

9 years agoExport at_flags
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
Export at_flags

* defs.h (at_flags): New prototype.

9 years agofile.c: move chmod, fchmod, and fchmodat parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move chmod, fchmod, and fchmodat parsers to a separate file

* chmod.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_chmod, sys_fchmodat, sys_fchmod): Move to chmod.c.

9 years agofile.c: move utimes, futimesat, utimensat, and osf_utimes parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move utimes, futimesat, utimensat, and osf_utimes parsers to a separate file

* utimes.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (decode_utimes, sys_utimes, sys_futimesat, sys_utimensat,
sys_osf_utimes): Move to utimes.c.

9 years agofile.c: move utime parser to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move utime parser to a separate file

* utime.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_utime): Move to utime.c.

9 years agoExport sprinttime
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
Export sprinttime

* defs.h (sprinttime): New prototype.
* file.c (sprinttime): Make global and move to util.c.

9 years agofile.c: move mknod, mknodat, and xmknod parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move mknod, mknodat, and xmknod parsers to a separate file

* mknod.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_mknod, sys_mknodat, sys_xmknod, and related code
to mknod.c.

9 years agofile.c: export sprintmode and move it to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: export sprintmode and move it to a separate file

* printmode.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (sprintmode): New prototype.
* file.c (sprintmode): Make global and move to printmode.c.

9 years agofile.c: move getcwd parser to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move getcwd parser to a separate file

* getcwd.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_getcwd): Move to getcwd.c.

9 years agofile.c: move *xattr parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move *xattr parsers to a separate file

* xattr.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_setxattr, sys_fsetxattr, sys_getxattr, sys_fgetxattr,
sys_listxattr, sys_flistxattr, sys_removexattr, sys_fremovexattr,
and related code to xattr.c.

9 years agofile.c: move fadvise64 and fadvise64_64 parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move fadvise64 and fadvise64_64 parsers to a separate file

* fadvise.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_fadvise64, sys_fadvise64_64, and related code
to fadvise.c.

9 years agofile.c: move sync_file_range and sync_file_range2 parsers to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move sync_file_range and sync_file_range2 parsers to a separate file

* sync_file_range.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_sync_file_range, sys_sync_file_range2, and related
code to sync_file_range.c.

9 years agofile.c: move fallocate parser to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move fallocate parser to a separate file

* fallocate.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_fallocate): Move to fallocate.c.

9 years agofile.c: move swapon parser to a separate file
Dmitry V. Levin [Sat, 6 Dec 2014 03:53:16 +0000 (03:53 +0000)]
file.c: move swapon parser to a separate file

* swapon.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_swapon and related code to swapon.c.

9 years agoImplement full decoding of 64-bit capabilities
Dmitry V. Levin [Fri, 5 Dec 2014 00:21:23 +0000 (00:21 +0000)]
Implement full decoding of 64-bit capabilities

Unlike v1 capabilities which are 32-bit, v2 and v3 are 64-bit, but
before this change only lower 32 capability bits were decoded for
v2 and v3.

* xlat/capabilities1.in: New file.
* capability.c: Define v2/v3 CAP_* constants.
Include xlat/capabilities1.h.
(get_cap_header): New function.
(print_cap_header): Update to use get_cap_header result.
(print_cap_data): Decoder higher capability bits for v2 and v3.
(sys_capget, sys_capset): Use get_cap_header, update print_cap_header
and print_cap_data calls.
* tests/caps.c: New file.
* tests/caps.awk: New file.
* tests/caps.test: New test.
* tests/Makefile.am (CHECK_PROGRAMS): Add caps.
(TESTS): Add caps.test.
(EXTRA_DIST): Add caps.awk.

9 years agoMake parsers of capget and capset syscalls self-contained
Dmitry V. Levin [Wed, 3 Dec 2014 20:39:20 +0000 (20:39 +0000)]
Make parsers of capget and capset syscalls self-contained

Various versions of <linux/capability.h> used to require different
workarounds to avoid conflicts with types defined by libc headers.
Define all required types and constants locally to fix this issue.

* configure.ac (AC_CHECK_HEADERS): Remove linux/capability.h.
* capability.c: Do not include <linux/capability.h>, remove workarounds
for problematic versions of <linux/capability.h> file.
Define CAP_* and _LINUX_CAPABILITY_VERSION_* constants as enums.
(struct __user_cap_header_struct, struct __user_cap_data_struct): Define.
* xlat/cap_version.in: Add #unconditional.
* xlat/capabilities.in: Likewise.

9 years agoRemove system.c
Dmitry V. Levin [Wed, 3 Dec 2014 21:17:01 +0000 (21:17 +0000)]
Remove system.c

All disjoint parts of system.c have been moved to separate files.

* system.c: Remove.
* Makefile.am (strace_SOURCES): Remove it.

9 years agoMove mount parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 21:12:07 +0000 (21:12 +0000)]
Move mount parser to a separate file

* mount.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move sys_mount and related code to mount.c.

9 years agoMove umount2 parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 21:09:26 +0000 (21:09 +0000)]
Move umount2 parser to a separate file

* umount.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move sys_umount2 and related code to umount.c.

9 years agoMove personality parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 21:06:11 +0000 (21:06 +0000)]
Move personality parser to a separate file

* personality.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move sys_personality and related code to personality.c.

9 years agoMove syslog parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 21:01:35 +0000 (21:01 +0000)]
Move syslog parser to a separate file

* syslog.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move sys_syslog and related code to syslog.c.

9 years agoMove cacheflush parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 20:50:08 +0000 (20:50 +0000)]
Move cacheflush parser to a separate file

* cacheflush.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move inclusion of <asm/cachectl.h> to cacheflush.c.
[M68K, BFIN, SH]: Move to cacheflush.c.

9 years agobfin: move sram_alloc parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 20:56:36 +0000 (20:56 +0000)]
bfin: move sram_alloc parser to a separate file

* sram_alloc.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c [BFIN]: Move sys_sram_alloc and related code to sram_alloc.c.

9 years agoMove capget and capset parsers to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 20:30:15 +0000 (20:30 +0000)]
Move capget and capset parsers to a separate file

* capability.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move inclusion of headers and macro definitions related
to capget and capset decoding to capability.c.
(print_cap_header, print_cap_data, sys_capget, sys_capset): Move
to capability.c.

9 years agoMove sysctl parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 20:20:52 +0000 (20:20 +0000)]
Move sysctl parser to a separate file

* sysctl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move sys_sysctl and related code to sysctl.c.

9 years agomips: move sysmips parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 20:08:44 +0000 (20:08 +0000)]
mips: move sysmips parser to a separate file

* sysmips.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Fix typo in the check for <linux/utsname.h>.
Move inclusions of <linux/utsname.h> and <asm/sysmips.h> to sysmips.c.
[MIPS]: Likewise.

9 years agoor1k: move or1k_atomic parser to a separate file
Dmitry V. Levin [Wed, 3 Dec 2014 20:00:42 +0000 (20:00 +0000)]
or1k: move or1k_atomic parser to a separate file

* or1k_atomic.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c [OR1K]: Move to or1k_atomic.c.

9 years agoAlias sys_setdomainname to sys_sethostname
Dmitry V. Levin [Tue, 2 Dec 2014 21:42:34 +0000 (21:42 +0000)]
Alias sys_setdomainname to sys_sethostname

Since parsers for setdomainname and sethostname syscalls are identical,
replace sys_setdomainname with an alias to sys_sethostname.

* linux/dummy.h (sys_setdomainname): Alias to sys_sethostname.
* linux/syscall.h (sys_setdomainname): Remove.
* process.c (sys_setdomainname): Remove.

9 years agoAlias sys_getpeername to sys_getsockname
Dmitry V. Levin [Tue, 2 Dec 2014 21:36:04 +0000 (21:36 +0000)]
Alias sys_getpeername to sys_getsockname

Since parsers for getpeername and getsockname syscalls are identical,
replace sys_getpeername with an alias to sys_getsockname.

* linux/dummy.h (sys_getpeername): Alias to sys_getsockname.
* linux/syscall.h (sys_getpeername): Remove.
* net.c (sys_getpeername): Remove.

9 years agoAlias sys_stime to sys_time
Dmitry V. Levin [Tue, 2 Dec 2014 20:47:30 +0000 (20:47 +0000)]
Alias sys_stime to sys_time

Since parsers for stime and time syscalls are identical,
replace sys_stime with an alias to sys_time.

* linux/dummy.h (sys_stime): Alias to sys_time.
* linux/syscall.h (sys_stime): Remove.
* time.c (sys_stime): Remove.

9 years agoRemove unused sys_mctl
Dmitry V. Levin [Tue, 2 Dec 2014 16:00:58 +0000 (16:00 +0000)]
Remove unused sys_mctl

Starting with commit v4.6-240-g5afdf12, nobody compiles this
non-Linux code.

* mem.c [MC_SYNC]: Remove.
* xlat/mctl_funcs.in: Remove.
* xlat/mctl_lockas.in: Remove.

9 years agoAlias sys_mkdir and sys_mkdirat to sys_chmod and sys_fchmodat
Dmitry V. Levin [Mon, 1 Dec 2014 18:24:55 +0000 (18:24 +0000)]
Alias sys_mkdir and sys_mkdirat to sys_chmod and sys_fchmodat

Special parsers for mkdir and mkdirat are redundant because
sys_chmod and sys_fchmodat implement the same decoding.

* file.c (decode_mkdir, sys_mkdir, sys_mkdirat): Remove.
* linux/dummy.h (sys_mkdir): Alias to sys_chmod.
(sys_mkdirat): Alias to sys_fchmodat.
* linux/syscall.h (sys_mkdir, sys_mkdirat): Remove.
* pathtrace.c (pathtrace_match): Do not check for sys_mkdirat.

9 years agoRemove unused <sys/acl.h> based code
Dmitry V. Levin [Mon, 1 Dec 2014 19:08:44 +0000 (19:08 +0000)]
Remove unused <sys/acl.h> based code

Starting with commit v4.6-240-g5afdf12, nobody compiles this
non-Linux code.

* configure.ac (AC_CHECK_HEADERS): Remove sys/acl.h.
* file.c [HAVE_SYS_ACL_H]: Remove.
* xlat/aclcmds.in: Remove.

9 years agoRemove unused <sys/asynch.h> based code
Dmitry V. Levin [Mon, 1 Dec 2014 17:08:50 +0000 (17:08 +0000)]
Remove unused <sys/asynch.h> based code

Starting with commit v4.6-240-g5afdf12, nobody compiles this
non-Linux code.

* configure.ac (AC_CHECK_HEADERS): Remove sys/asynch.h.
* file.c [HAVE_SYS_ASYNCH_H]: Remove.

9 years agoPrint protocol name of socket descriptors with -yy option
Masatake YAMATO [Sat, 22 Nov 2014 10:03:33 +0000 (19:03 +0900)]
Print protocol name of socket descriptors with -yy option

For those socket descriptors that have no associated ip:port pairs
(or when this information is not available), -yy option prints
the same <socket:[INODE]> information as -y option, e.g.

$ strace -e sendto -yy ip l > /dev/null
sendto(3<socket:[23456789]>, ...

This change makes -yy output more informative: instead of just
printing "socket", the name of protocol behind the socket descriptor
will be printed, e.g.

sendto(3<NETLINK:[23456789]>, ...

* configure.ac (AC_CHECK_HEADERS): Add sys/xattr.h.
* tests/net-yy-accept.awk: Update to support protocol names.
* tests/net-yy-connect.awk: Likewise.
* util.c [HAVE_SYS_XATTR_H]: Include <sys/xattr.h>.
(getfdproto): New function.
(printfd): Use it.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoReplace MAXPATHLEN with PATH_MAX
Dmitry V. Levin [Fri, 21 Nov 2014 22:28:34 +0000 (22:28 +0000)]
Replace MAXPATHLEN with PATH_MAX

MAXPATHLEN is defined to PATH_MAX, so replace the former with the latter.

* strace.c (startup_child): Replace MAXPATHLEN with PATH_MAX.
* util.c (printpathn, printpath): Likewise.

9 years agoDecode FIFREEZE/FITHAW/FITRIM ioctls
Mike Frysinger [Fri, 21 Nov 2014 21:13:16 +0000 (16:13 -0500)]
Decode FIFREEZE/FITHAW/FITRIM ioctls

The freeze/thaw ones are simple, but the trim is an interesting struct.

* block.c (block_ioctl): Handle FIFREEZE/FITHAW/FITRIM.
* ioctl.c (ioctl_decode): Pass 'X' ioctls to block_ioctl.

9 years agoInclude <sys/uio.h> unconditionally
Dmitry V. Levin [Fri, 21 Nov 2014 20:46:16 +0000 (20:46 +0000)]
Include <sys/uio.h> unconditionally

Since <sys/uio.h> is standardized by POSIX and is present in all
available versions of glibc, it's safe to assume that any usable
libc implementation provides this header file.

* configure.ac (AC_CHECK_HEADERS): Remove sys/uio.h.
* io.c: Include <sys/uio.h> unconditionally.
(tprint_iov_upto, tprint_iov, sys_readv, sys_writev,
print_llu_from_low_high_val, sys_preadv, sys_pwritev): Define
unconditionally.
* net.c: Include <sys/uio.h> unconditionally.
* util.c: Include <sys/uio.h> unconditionally.
(dumpiov): Define unconditionally.

9 years agoConsistently use C99 designated initializers in the new netlink code
Dmitry V. Levin [Fri, 21 Nov 2014 19:59:16 +0000 (19:59 +0000)]
Consistently use C99 designated initializers in the new netlink code

* socketutils.c (send_query, receive_responses): Use designated
initializers for sockaddr_nl, nlmsghdr, and inet_diag_req_v2 structures.
* tests/netlink_inet_diag.c (send_query, check_responses): Likewise.

9 years agoDecode open's O_TMPFILE
Mike Frysinger [Thu, 20 Nov 2014 00:19:56 +0000 (19:19 -0500)]
Decode open's O_TMPFILE

* xlat/open_mode_flags.in: Add O_TMPFILE definition.

9 years agohppa: update error codes and signal numbers
Helge Deller [Sat, 8 Nov 2014 21:52:44 +0000 (22:52 +0100)]
hppa: update error codes and signal numbers

There are two important changes in here:

1. EWOULDBLOCK has been up to kernel 3.14 errorcode #246. Since hppa
folks had problems with EWOULDBLOCK != EAGAIN, this was changed in
kernel 3.14.

2. Starting with kernel 3.18, hppa folks changed some signal numbers in
such a way that we end up with SIGRTMIN == 32, which brings hppa in sync
with other linux ports.

Both were incompatible changes which basically broke hppa ABI, but since
they have been merged into the kernel, we have to follow.

9 years agostack trace support: fix check on symbol name presence
Thomas De Schampheleire [Thu, 6 Nov 2014 12:59:04 +0000 (13:59 +0100)]
stack trace support: fix check on symbol name presence

The output format of the stack trace is supposed to be different
depending on whether symbol names are available in the build.

However, the check only verified the validity of the pointer, not of the
string pointed to (which could be empty).

This commit fixes the check so that the original output:

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x5e000
 > /lib/libc-2.10.1.so(_IO_file_doallocate+0x8c) [0x68a38]
 > /lib/libc-2.10.1.so(_IO_doallocbuf+0x6c) [0x78574]
 > /lib/libc-2.10.1.so(_IO_file_overflow+0x184) [0x7763c]
 > /lib/libc-2.10.1.so(_IO_file_xsputn+0x88) [0x76aac]
 > /lib/libc-2.10.1.so(_IO_puts+0xc8) [0x6b64c]
 > /bin/busybox(+0x0) [0x62c60]
 > /bin/busybox(+0x0) [0x4940]
 > /bin/busybox(+0x0) [0x499c]
 > /bin/busybox(+0x0) [0x4e08]
 > /lib/libc-2.10.1.so(__libc_init_first+0x30c) [0x1f84c]
 > /lib/libc-2.10.1.so(__libc_start_main+0xd8) [0x1f9f8]

becomes:

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x5e000
 > /lib/libc-2.10.1.so(_IO_file_doallocate+0x8c) [0x68a38]
 > /lib/libc-2.10.1.so(_IO_doallocbuf+0x6c) [0x78574]
 > /lib/libc-2.10.1.so(_IO_file_overflow+0x184) [0x7763c]
 > /lib/libc-2.10.1.so(_IO_file_xsputn+0x88) [0x76aac]
 > /lib/libc-2.10.1.so(_IO_puts+0xc8) [0x6b64c]
 > /bin/busybox() [0x62c60]
 > /bin/busybox() [0x4940]
 > /bin/busybox() [0x499c]
 > /bin/busybox() [0x4e08]
 > /lib/libc-2.10.1.so(__libc_init_first+0x30c) [0x1f84c]
 > /lib/libc-2.10.1.so(__libc_start_main+0xd8) [0x1f9f8]

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Acked-by: Masatake YAMATO <yamato@redhat.com>
9 years agotests: add a test for decoding and dumping of recvmmsg/sendmmsg
Masatake YAMATO [Thu, 6 Nov 2014 16:23:27 +0000 (01:23 +0900)]
tests: add a test for decoding and dumping of recvmmsg/sendmmsg

* configure (AC_CHECK_FUNCS): Add sendmmsg.
* tests/mmsg.c: New file.
* tests/mmsg.expected: New file.
* tests/mmsg.test: New test.
* tests/.gitignore: Add mmsg.
* tests/Makefile.am (CHECK_PROGRAMS): Add mmsg.
(TESTS): Add mmsg.test.
(EXTRA_DIST): Add mmsg.expected.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoAdd functions for dumping iovecs in mmsghdr used in sendmmsg and recvmmsg
Masatake YAMATO [Thu, 6 Nov 2014 16:23:26 +0000 (01:23 +0900)]
Add functions for dumping iovecs in mmsghdr used in sendmmsg and recvmmsg

This patch is similar to what I did in commit
02f9f6b386741a52f58e1b31ad4e7fff60781ef8.
That commit was for sendmsg and recvmsg system calls.
This one is for sendmmsg and recvmmsg system calls.

* defs.h (dumpiov_in_mmsghdr): New declaration.
* net.c (extractmmsghdr): New function derived from printmmsghdr.
(printmmsghdr): Use it.
(dumpiov_in_mmsghdr): New function.
* syscall.c (dumpio) [HAVE_SENDMSG]: Call dumpiov_in_mmsghdr
for recvmmsg and sendmmsg syscalls.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoUse the definition of struct mmsghdr if it is defined in build environment
Masatake YAMATO [Thu, 6 Nov 2014 16:23:25 +0000 (01:23 +0900)]
Use the definition of struct mmsghdr if it is defined in build environment

mmsghrd structure type is defined locally in printmmsghdr function.

However, more functions will refer the definition in modifications for
supporting "-e write=set" and "-e read=set" option for sendmmsg and
recvmmsg system calls.

After this change, the system definition of struct mmsghdr will be used
if configure reports it is available, falling back to the old local
definition.

* configure.ac (AC_CHECK_TYPES): Add struct mmsghdr.
* net.c [!HAVE_STRUCT_MMSGHDR] (struct mmsghdr): Define.
(printmmsghdr): Use previously defined struct mmsghdr.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 years agoIntroduce a separate function to copy from msghdr32 to msghdr
Masatake YAMATO [Thu, 6 Nov 2014 16:23:24 +0000 (01:23 +0900)]
Introduce a separate function to copy from msghdr32 to msghdr

This patch is an initial step for supporting "-e write=set" and
"-e read=set" option for sendmmsg and recvmmsg system calls.

Coverting a data of msghdr32 to msghdr is needed both for
{send,recv}msg and {send,recv}mmsg to decode parameters.
To share the copying code in both decoders, a separate
function named copy_from_msghdr32 is introduced.

* net.c [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4]
(copy_from_msghdr32): New function.
(extractmsghdr) [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4]: Use it.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 years agoioctlsort: rewrite build rules using noinst_PROGRAMS
Dmitry V. Levin [Tue, 4 Nov 2014 01:40:42 +0000 (01:40 +0000)]
ioctlsort: rewrite build rules using noinst_PROGRAMS

* linux/ioctlsort.c: Rename to ioctlsort.c
* Makefile.am (EXTRA_DIST): Rename linux/ioctlsort.c to ioctlsort.c.
[MAINTAINER_MODE] (noinst_PROGRAMS): Add ioctlsort.
(ioctlsort_SOURCES): Add ioctlsort.c.
(nodist_ioctlsort_SOURCES): Add ioctls.h and ioctldefs.h.
(CLEANFILES): Add $(nodist_ioctlsort_SOURCES).
(ioctlsort.$(OBJEXT)): Likewise.
(ioctlsort): Remove.

9 years agoMakefile.am: look for ioctl definitions in the kernel build tree by default
Lubomir Rintel [Thu, 16 Oct 2014 10:05:43 +0000 (12:05 +0200)]
Makefile.am: look for ioctl definitions in the kernel build tree by default

While most of ioctl-related kernel headers are now exported by kernel's
headers_install, some are still modules_install only.  The kernel's
headers installed into /usr/include/ are usually headers_install'ed and
therefore don't contain some internal headers we need.  The solution is
to look for modules_install'ed headers for the running kernel, and fall
back to old behavior if they aren't found.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoDump details for Bluetooth socket operations
Lubomir Rintel [Fri, 3 Oct 2014 09:40:28 +0000 (11:40 +0200)]
Dump details for Bluetooth socket operations

* configure.ac (AC_CHECK_HEADERS): Add bluetooth/bluetooth.h.
* xlat/bt_protocols.in: New file.
* net.c [AF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Include bluetooth
headers.
[PF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Include "xlat/bt_protocols.h".
(printsock) [AF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Dump details
for AF_BLUETOOTH sockets.
(sys_socket) [PF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Decode
protocol for PF_BLUETOOTH sockets.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoImplement Video4Linux video-input ioctls decoder
Philippe De Muyter [Mon, 3 Nov 2014 20:27:40 +0000 (21:27 +0100)]
Implement Video4Linux video-input ioctls decoder

Introduce v4l2.c, a decoder for the arguments of the video-input subset
of the v4l2 ioctl's.  This is a combination of
- previous work by Peter Zotov <whitequark@whitequark.org>, found at
https://gist.githubusercontent.com/whitequark/1263207/raw/strace-4.6-v4l2-ioctls.patch
- previous work by William Manley <will@williammanley.net>, found at
http://marc.info/?l=strace&m=139395588520675
- forward port, additions and fixes by Philippe De Muyter <phdm@macqel.be>

As v4l2 is a moving target, I have made v4l2.c compilable with ancient
linux kernels by testing the availability of some macros.  It has been
succesfully compiled on linux 3.10, 3.1, 2.6.31 and 2.6.22, and
succesfully used on linux 3.10 with a camera device.

* configure.ac: Check for availabilty of V4L2_* enum constants.
* Makefile.am (strace_SOURCES): Add v4l2.c.
* defs.h (v4l2_ioctl): New prototype.
* ioctl.c (ioctl_decode): Use v4l2_ioctl.
* v4l2.c: New file.
* xlat/v4l2_*.in: New files.

Signed-off-by: Philippe De Muyter <phdm@macqel.be>
Cc: Peter Zotov <whitequark@whitequark.org>
Cc: William Manley <will@williammanley.net>
9 years agoUpdate ioctl entries
Dmitry V. Levin [Mon, 3 Nov 2014 21:08:44 +0000 (21:08 +0000)]
Update ioctl entries

* linux/ioctlent.h.in: Regenerate from v3.17 headers.