]> granicus.if.org Git - strace/log
strace
9 years agodefs.h: do not include <signal.h>
Dmitry V. Levin [Fri, 17 Jul 2015 23:56:54 +0000 (23:56 +0000)]
defs.h: do not include <signal.h>

* printsiginfo.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h: Do not include <signal.h>.
(printsiginfo): Remove.
* printsiginfo.c: Include <signal.h> and "printsiginfo.h".
* strace.c: Likewise.
* sigaltstack.c: Include <signal.h>.
* signal.c: Likewise.
* sigreturn.c: Likewise.
* time.c: Likewise.

9 years agoresource.c: move printrusage and printrusage32 to a separate file
Dmitry V. Levin [Fri, 17 Jul 2015 23:50:02 +0000 (23:50 +0000)]
resource.c: move printrusage and printrusage32 to a separate file

* printrusage.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* resource.c (printrusage, [ALPHA] printrusage32): Move
to printrusage.c.

9 years agoopen.c: make use of RVAL_DECODED
Dmitry V. Levin [Fri, 17 Jul 2015 22:03:29 +0000 (22:03 +0000)]
open.c: make use of RVAL_DECODED

* open.c (decode_open, sys_creat): Update for RVAL_DECODED.

9 years agopersonality.c: make use of RVAL_DECODED
Dmitry V. Levin [Fri, 17 Jul 2015 21:53:45 +0000 (21:53 +0000)]
personality.c: make use of RVAL_DECODED

* personality.c (sys_personality): Update for RVAL_DECODED.

9 years agoprintsiginfo.c: use umove_or_printaddr
Dmitry V. Levin [Fri, 17 Jul 2015 21:58:18 +0000 (21:58 +0000)]
printsiginfo.c: use umove_or_printaddr

* printsiginfo.c (printsiginfo_at): Use umove_or_printaddr.

9 years agoprctl.c: make use of RVAL_DECODED
Dmitry V. Levin [Fri, 17 Jul 2015 21:49:17 +0000 (21:49 +0000)]
prctl.c: make use of RVAL_DECODED

* prctl.c (prctl_enter, prctl_exit): Merge into sys_prctl.
(sys_prctl, sys_arch_prctl): Update for RVAL_DECODED.

9 years agoprctl.c: use printaddr and umove_or_printaddr
Dmitry V. Levin [Fri, 17 Jul 2015 21:14:16 +0000 (21:14 +0000)]
prctl.c: use printaddr and umove_or_printaddr

* prctl.c (prctl_exit): Use printaddr and umove_or_printaddr.

9 years agoprocess.c: use printaddr
Dmitry V. Levin [Fri, 17 Jul 2015 21:12:05 +0000 (21:12 +0000)]
process.c: use printaddr

* process.c (sys_ptrace): Use printaddr.

9 years agoprocess_vm.c: make use of RVAL_DECODED
Dmitry V. Levin [Fri, 17 Jul 2015 20:39:49 +0000 (20:39 +0000)]
process_vm.c: make use of RVAL_DECODED

* process_vm.c (sys_process_vm_writev): Update for RVAL_DECODED.

9 years agoprocess_vm.c: use printaddr
Dmitry V. Levin [Fri, 17 Jul 2015 20:37:47 +0000 (20:37 +0000)]
process_vm.c: use printaddr

* process_vm.c (sys_process_vm_readv): Use printaddr.

9 years agoreboot.c: make use of RVAL_DECODED
Dmitry V. Levin [Fri, 17 Jul 2015 20:27:00 +0000 (20:27 +0000)]
reboot.c: make use of RVAL_DECODED

* reboot.c (sys_reboot): Update for RVAL_DECODED.

9 years agoEnhance quotactl decoding
Dmitry V. Levin [Fri, 17 Jul 2015 17:35:07 +0000 (17:35 +0000)]
Enhance quotactl decoding

* quota.c (decode_cmd_data): Use umove_or_printaddr.
(sys_quotactl): Do not disable the parser in verbose mode.
Decode all "set" commands on entering syscall.

9 years agoreadahead.c: make use of RVAL_DECODED
Dmitry V. Levin [Fri, 17 Jul 2015 17:26:27 +0000 (17:26 +0000)]
readahead.c: make use of RVAL_DECODED

* readahead.c (sys_readahead.c): Update for RVAL_DECODED.

9 years agoreadlink.c: use printaddr
Dmitry V. Levin [Fri, 17 Jul 2015 17:24:41 +0000 (17:24 +0000)]
readlink.c: use printaddr

* readlink.c (decode_readlink): Use printaddr.

9 years agorenameat.c: make use of RVAL_DECODED
Dmitry V. Levin [Fri, 17 Jul 2015 17:22:24 +0000 (17:22 +0000)]
renameat.c: make use of RVAL_DECODED

* renameat.c (sys_renameat, sys_renameat2): Update for RVAL_DECODED.

9 years agoresource.c: make use of RVAL_DECODED
Dmitry V. Levin [Fri, 17 Jul 2015 16:39:54 +0000 (16:39 +0000)]
resource.c: make use of RVAL_DECODED

* resource.c (sys_setrlimit, sys_getpriority, sys_setpriority):
Update for RVAL_DECODED.

9 years agoresource.c: use umove_or_printaddr
Dmitry V. Levin [Fri, 17 Jul 2015 16:25:21 +0000 (16:25 +0000)]
resource.c: use umove_or_printaddr

* resource.c (print_rlimit64, print_rlimit32, printrusage32,
printrusage, sys_times): Use umove_or_printaddr.
(decode_rlimit64): Remove.
(decode_rlimit): Remove redundant checks.
[defined(current_wordsize) && current_wordsize != 4] (decode_rlimit):
Define to print_rlimit64.
(sys_prlimit64): Replace decode_rlimit64 with print_rlimit64.

9 years agosched.c: make use of RVAL_DECODED
Dmitry V. Levin [Fri, 17 Jul 2015 16:16:24 +0000 (16:16 +0000)]
sched.c: make use of RVAL_DECODED

* sched.c (sys_sched_setscheduler, sys_sched_setparam,
sys_sched_get_priority_min): Update for RVAL_DECODED.

9 years agosched.c: use printnum_int and printaddr
Dmitry V. Levin [Fri, 17 Jul 2015 16:12:22 +0000 (16:12 +0000)]
sched.c: use printnum_int and printaddr

* sched.c (sys_sched_setscheduler, sys_sched_getparam,
sys_sched_setparam): Use printnum_int for sched_param decoding.
(sched_rr_get_interval): Use printaddr.

9 years agoscsi.c: use printaddr
Dmitry V. Levin [Fri, 17 Jul 2015 16:00:18 +0000 (16:00 +0000)]
scsi.c: use printaddr

* scsi.c (print_sg_io_buffer): Use printaddr.

9 years agoseccomp.c: make use of RVAL_DECODED
Dmitry V. Levin [Fri, 17 Jul 2015 01:14:51 +0000 (01:14 +0000)]
seccomp.c: make use of RVAL_DECODED

* seccomp.c (sys_seccomp): Update for RVAL_DECODED.

9 years agoseccomp.c: use printaddr and umove_or_printaddr
Dmitry V. Levin [Fri, 17 Jul 2015 01:10:45 +0000 (01:10 +0000)]
seccomp.c: use printaddr and umove_or_printaddr

* seccomp.c (decode_fprog, decode_seccomp_set_mode_strict):
Use printaddr.
(print_seccomp_filter): Use umove_or_printaddr.

9 years agosigaltstack.c: use printaddr and umove_or_printaddr
Dmitry V. Levin [Fri, 17 Jul 2015 01:05:46 +0000 (01:05 +0000)]
sigaltstack.c: use printaddr and umove_or_printaddr

* sigaltstack.c (print_stack_t): Use umove_or_printaddr and printaddr.

9 years agosignal.c: make use of RVAL_DECODED
Dmitry V. Levin [Fri, 17 Jul 2015 00:51:45 +0000 (00:51 +0000)]
signal.c: make use of RVAL_DECODED

* signal.c (sys_sigsuspend, sys_kill, sys_tgkill, sys_rt_sigsuspend,
sys_rt_sigqueueinfo, sys_rt_tgsigqueueinfo, sys_restart_syscall,
do_signalfd): Update for RVAL_DECODED.

9 years agosignal.c: use printaddr and umove_or_printaddr
Dmitry V. Levin [Fri, 17 Jul 2015 00:37:39 +0000 (00:37 +0000)]
signal.c: use printaddr and umove_or_printaddr

* signal.c (print_sigset_addr_len, decode_old_sigaction):
Use printaddr and umove_or_printaddr.
(sys_signal): Use printaddr.
(sys_sigprocmask, sys_sigpending, sys_rt_sigprocmask,
sys_rt_sigpending): Remove redundant checks for syserror.
(decode_new_sigaction): Use umove_or_printaddr.

9 years agosram_alloc.c: make use of RVAL_DECODED
Dmitry V. Levin [Thu, 16 Jul 2015 23:40:40 +0000 (23:40 +0000)]
sram_alloc.c: make use of RVAL_DECODED

* sram_alloc.c [BFIN] (sys_sram_alloc): Update for RVAL_DECODED.

9 years agostatfs.c: use umove_or_printaddr
Dmitry V. Levin [Thu, 16 Jul 2015 23:32:12 +0000 (23:32 +0000)]
statfs.c: use umove_or_printaddr

* statfs.c (printstatfs, printstatfs64, printcompat_statfs64):
Use umove_or_printaddr.

9 years agoswapon.c: make use of RVAL_DECODED
Dmitry V. Levin [Thu, 16 Jul 2015 23:28:07 +0000 (23:28 +0000)]
swapon.c: make use of RVAL_DECODED

* swapon.c (sys_swapon): Update for RVAL_DECODED.

9 years agoswapon.c: move fallback definitions of swap options to xlat/
Dmitry V. Levin [Thu, 16 Jul 2015 23:25:36 +0000 (23:25 +0000)]
swapon.c: move fallback definitions of swap options to xlat/

* swapon.c: Move definitions of SWAP_FLAG_* flags ...
* xlat/swap_flags.in: ... here.

9 years agosync_file_range2: fix typo in flags decoding
Dmitry V. Levin [Thu, 16 Jul 2015 23:20:33 +0000 (23:20 +0000)]
sync_file_range2: fix typo in flags decoding

* sync_file_range.c (sys_sync_file_range2): Fix typo in flags decoding.

9 years agosync_file_range.c: make use of RVAL_DECODED
Dmitry V. Levin [Thu, 16 Jul 2015 23:15:46 +0000 (23:15 +0000)]
sync_file_range.c: make use of RVAL_DECODED

* sync_file_range.c (sys_sync_file_range, sys_sync_file_range2): Update
for RVAL_DECODED.

9 years agosyslog.c: use umove_or_printaddr and RVAL_DECODED
Dmitry V. Levin [Thu, 16 Jul 2015 23:11:23 +0000 (23:11 +0000)]
syslog.c: use umove_or_printaddr and RVAL_DECODED

* sysctl.c (sys_sysctl): Use umove_or_printaddr and RVAL_DECODED.

9 years agosysinfo.c: use umove_or_printaddr
Dmitry V. Levin [Thu, 16 Jul 2015 22:08:02 +0000 (22:08 +0000)]
sysinfo.c: use umove_or_printaddr

* sysinfo.c (sys_sysinfo): Use umove_or_printaddr.

9 years agosyslog.c: make use of RVAL_DECODED
Dmitry V. Levin [Thu, 16 Jul 2015 22:03:03 +0000 (22:03 +0000)]
syslog.c: make use of RVAL_DECODED

* syslog.c (sys_syslog): Update for RVAL_DECODED.

9 years agosyslog.c: use printaddr
Dmitry V. Levin [Thu, 16 Jul 2015 21:59:53 +0000 (21:59 +0000)]
syslog.c: use printaddr

* syslog.c (sys_syslog): Use printaddr.

9 years agosysmips.c: cleanup
Dmitry V. Levin [Thu, 16 Jul 2015 21:46:05 +0000 (21:46 +0000)]
sysmips.c: cleanup

* sysmips.c [MIPS] (sys_sysmips): Use switch statement.  Use printaddr.
Fix misprinted ", " delimiter.

9 years agosysmips.c: make use of RVAL_DECODED
Dmitry V. Levin [Thu, 16 Jul 2015 21:35:41 +0000 (21:35 +0000)]
sysmips.c: make use of RVAL_DECODED

* sysmips.c [MIPS] (sys_sysmips): Update for RVAL_DECODED.

9 years agotime.c: make use of RVAL_DECODED
Dmitry V. Levin [Thu, 16 Jul 2015 21:07:06 +0000 (21:07 +0000)]
time.c: make use of RVAL_DECODED

* time.c (sys_settimeofday, sys_osf_settimeofday, sys_clock_settime,
sys_timerfd, sys_timerfd_create, sys_timerfd_settime): Update
for RVAL_DECODED.
(timerfd_gettime): Decode struct itimerspec argument on exiting syscall.

9 years agotime.c: use printaddr, printnum_int, and umoven_or_printaddr
Dmitry V. Levin [Thu, 16 Jul 2015 18:18:09 +0000 (18:18 +0000)]
time.c: use printaddr, printnum_int, and umoven_or_printaddr

* time.c (sys_nanosleep): Use printaddr.
(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
printsigevent): Use umoven_or_printaddr.
(sys_timer_create): Use printnum_int.
(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
redundant checks for syserror.

9 years agosprinttv: do not fetch data in case of syserror
Dmitry V. Levin [Thu, 16 Jul 2015 16:22:07 +0000 (16:22 +0000)]
sprinttv: do not fetch data in case of syserror

* time.c (sprinttv): Do not fetch data in case syserror.
Print address instead of {...} in case of umove failure.
(sys_gettimeofday, sys_osf_gettimeofday, sys_adjtime, sys_clock_gettime,
clock_nanosleep): Remove now redundant checks for syserror.

9 years agotruncate.c: make use of RVAL_DECODED
Dmitry V. Levin [Thu, 16 Jul 2015 21:29:28 +0000 (21:29 +0000)]
truncate.c: make use of RVAL_DECODED

* truncate.c (sys_truncate, sys_truncate64, sys_ftruncate,
sys_ftruncate64): Update for RVAL_DECODED.

9 years agoumask.c: make use of RVAL_DECODED
Dmitry V. Levin [Thu, 16 Jul 2015 21:27:12 +0000 (21:27 +0000)]
umask.c: make use of RVAL_DECODED

* umask.c (sys_umask): Update for RVAL_DECODED.

9 years agoumount.c: make use of RVAL_DECODED
Dmitry V. Levin [Thu, 16 Jul 2015 21:13:27 +0000 (21:13 +0000)]
umount.c: make use of RVAL_DECODED

* umount.c (sys_umount2): Update for RVAL_DECODED.

9 years agoutimes.c: make use of RVAL_DECODED
Dmitry V. Levin [Thu, 16 Jul 2015 21:21:09 +0000 (21:21 +0000)]
utimes.c: make use of RVAL_DECODED

* utimes.c (decode_utimes): Change to return void.
Update for RVAL_DECODED.
(sys_utimes, sys_futimesat, sys_utimensat, sys_osf_utimes):
Update callers.  Update for RVAL_DECODED.

9 years agotests/uid.test: adopt for alpha
Dmitry V. Levin [Thu, 16 Jul 2015 09:09:11 +0000 (09:09 +0000)]
tests/uid.test: adopt for alpha

Make the test work on alpha that has getxuid syscall instead of getuid.

* tests/uid.awk (BEGIN): Update getuid regexp to match both getuid
and getxuid syscalls.
* tests/uid.c (main): Allow __NR_getxuid as an alternative
to __NR_getuid.
* tests/uid.test: If getuid syscall is not available, probe for
getxuid syscall.

9 years agouid.c: make use of RVAL_DECODED
Dmitry V. Levin [Thu, 16 Jul 2015 00:01:25 +0000 (00:01 +0000)]
uid.c: make use of RVAL_DECODED

* uid.c (sys_setuid, sys_setreuid, sys_setresuid, sys_chown, sys_fchown,
sys_setgroups): Update for RVAL_DECODED.

9 years agouid.c: use printaddr and umoven_or_printaddr
Dmitry V. Levin [Wed, 15 Jul 2015 23:37:31 +0000 (23:37 +0000)]
uid.c: use printaddr and umoven_or_printaddr

* uid.c (get_print_uid): Use umoven_or_printaddr.
(sys_getresuid): Do not check for syserror, get_print_uid now does
the right thing.
(sys_setgroups, sys_getgroups): Add const qualifier to local variables
that are assigned once.  Use printaddr.

9 years agoia64: wire up utimensat syscall
Dmitry V. Levin [Wed, 15 Jul 2015 23:03:15 +0000 (23:03 +0000)]
ia64: wire up utimensat syscall

* linux/ia64/syscallent.h (utimensat): New entry.

9 years agodecode_utimes: enclose timespec array in square brackets
Dmitry V. Levin [Wed, 15 Jul 2015 14:52:47 +0000 (14:52 +0000)]
decode_utimes: enclose timespec array in square brackets

* utimes.c (decode_utimes): enclose timespec array in square brackets
instead of curly brackets.

9 years agouname.c: use umove_or_printaddr
Dmitry V. Levin [Wed, 15 Jul 2015 09:25:34 +0000 (09:25 +0000)]
uname.c: use umove_or_printaddr

* uname.c (sys_uname): Use umove_or_printaddr.

9 years agotests: add utime.test
Dmitry V. Levin [Wed, 15 Jul 2015 09:02:17 +0000 (09:02 +0000)]
tests: add utime.test

* tests/utime.c: New file.
* tests/utime.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add utime.
(TESTS): Add utime.test.
* tests/.gitignore: Add utime.

9 years agoutime.c: make use of RVAL_DECODED
Dmitry V. Levin [Wed, 15 Jul 2015 08:29:56 +0000 (08:29 +0000)]
utime.c: make use of RVAL_DECODED

* utime.c (sys_utime): Update for RVAL_DECODED.

9 years agoutime.c: use umoven_or_printaddr
Dmitry V. Levin [Wed, 15 Jul 2015 08:27:18 +0000 (08:27 +0000)]
utime.c: use umoven_or_printaddr

* utime.c (sys_utime): Use umoven_or_printaddr.

9 years agowait.c: use printaddr and umove_or_printaddr
Dmitry V. Levin [Wed, 15 Jul 2015 00:36:20 +0000 (00:36 +0000)]
wait.c: use printaddr and umove_or_printaddr

* wait.c (waitid): Do not check for NULL the address passed
to printrusage.
(printwaitn): Likewise.
Use printaddr and umove_or_printaddr for fetching wait status.

9 years agowait: move fallback definitions of wait options to xlat/
Dmitry V. Levin [Wed, 15 Jul 2015 00:33:20 +0000 (00:33 +0000)]
wait: move fallback definitions of wait options to xlat/

* wait.c: Move definitions of __W* flags ...
* xlat/wait4_options.in: ... here.

9 years agotests: add xattr.test
Dmitry V. Levin [Wed, 15 Jul 2015 00:09:08 +0000 (00:09 +0000)]
tests: add xattr.test

* tests/xattr.c: New file.
* tests/xattr.expected: Likewise.
* tests/xattr.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add xattr.
(TESTS): Add xattr.test.
(EXTRA_DIST): Add xattr.expected.
* tests/.gitignore: Add xattr.

9 years agoxattr.c: make use of RVAL_DECODED
Dmitry V. Levin [Tue, 14 Jul 2015 23:38:58 +0000 (23:38 +0000)]
xattr.c: make use of RVAL_DECODED

* xattr.c (sys_setxattr, sys_fsetxattr, sys_removexattr,
sys_fremovexattr): Update for RVAL_DECODED.

9 years agoprint_xattr_val: do not fetch data in case of !verbose || syserror
Dmitry V. Levin [Tue, 14 Jul 2015 23:34:06 +0000 (23:34 +0000)]
print_xattr_val: do not fetch data in case of !verbose || syserror

* xattr.c (print_xattr_val): Do not fetch data in case
of !verbose || syserror.   Use printaddr.

9 years agoprint_xattr_list: use printaddr
Dmitry V. Levin [Tue, 14 Jul 2015 23:31:35 +0000 (23:31 +0000)]
print_xattr_list: use printaddr

* xattr.c (print_xattr_list): Use printaddr.

9 years agoprint_xattr_val: remove unused argument
Dmitry V. Levin [Tue, 14 Jul 2015 23:25:15 +0000 (23:25 +0000)]
print_xattr_val: remove unused argument

* xattr.c (print_xattr_val): Remove unused "failed" argument.
(sys_setxattr, sys_fsetxattr, sys_getxattr, sys_fgetxattr): Update
all callers.

9 years agoprint_xattr_list: remove redundant address check
Dmitry V. Levin [Tue, 14 Jul 2015 23:27:21 +0000 (23:27 +0000)]
print_xattr_list: remove redundant address check

* xattr.c (print_xattr_list): Do not check for NULL the address passed
to printstr.

9 years agoipc.c: make use of RVAL_DECODED
Dmitry V. Levin [Mon, 13 Jul 2015 21:06:48 +0000 (21:06 +0000)]
ipc.c: make use of RVAL_DECODED

* ipc.c (sys_mq_notify, sys_mq_open, sys_mq_timedreceive,
sys_mq_timedsend, sys_msgctl, sys_msgget, sys_msgsnd, sys_semctl,
sys_semget, sys_semop, sys_semtimedop, sys_shmctl, sys_shmdt,
sys_shmget): Update for RVAL_DECODED.
(sys_shmat): Decode all arguments on entering syscall.

9 years agoumoven_or_printaddr: do not fetch data if not in verbose mode
Dmitry V. Levin [Tue, 14 Jul 2015 22:03:55 +0000 (22:03 +0000)]
umoven_or_printaddr: do not fetch data if not in verbose mode

After this change, umoven_or_printaddr and its callers, including
printnum_* and printpair_*, will not fetch data in !verbose mode.

* util.c (umoven_or_printaddr): Do not call umoven if !verbose.

9 years agoChange printnum_* printers to honor syserror
Dmitry V. Levin [Mon, 13 Jul 2015 20:44:01 +0000 (20:44 +0000)]
Change printnum_* printers to honor syserror

With this change, printnum_* printers will not attempt to fetch data
in case of exiting(tcp) && syserror(tcp).
All "at exiting" decoders that call these printers have been made
ready for this change in previous commits.

* util.c (DEF_PRINTNUM, DEF_PRINTPAIR): Use umove_or_printaddr.
* prctl.c (prctl_exit): Use printnum_int and printnum_long.
(sys_arch_prctl): Do not check for syserror.

9 years agoterm.c: enhance tty ioctl parser
Dmitry V. Levin [Mon, 13 Jul 2015 20:10:20 +0000 (20:10 +0000)]
term.c: enhance tty ioctl parser

Decode as much data on entering syscall as possible.

* term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize,
decode_modem_flags): New functions.
(term_ioctl): Use them.  Update for RVAL_DECODED.

9 years agoChange comparisons with function pointers to comparisons with SENs
Elvira Khabirova [Fri, 10 Jul 2015 19:24:58 +0000 (22:24 +0300)]
Change comparisons with function pointers to comparisons with SENs

* pathtrace.c (pathtrace_match): Change all comparisons with function
pointers to a single SEN based switch.
* syscall.c (dumpio, trace_syscall_entering): Change all comparisons
with function pointers to comparisons with SENs.
* ipc.c (sys_ipc): Remove.
* sock.c (sys_socketcall): Likewise.
* linux/dummy.h (sys_ipc, sys_socketcall): New aliases.

9 years agoAdd unique syscall entry numbers (SENs)
Elvira Khabirova [Fri, 10 Jul 2015 19:24:54 +0000 (22:24 +0300)]
Add unique syscall entry numbers (SENs)

* Makefile.am (BUILT_SOURCES, CLEANFILES): Add sen.h.
(syscallent_names, syscallent_patterns, syscallent_files): New variables.
(sen.h): New rule.
* defs.h (struct sysent): Add sen field.
* generate_sen.sh: New file.
* linux/syscall.h: Include "sen.h".
* syscall.c (SEN_NAME): New temporary macro.
(SEN): Use it to prepend syscall entry number.

9 years agoIntroduce SEN macro
Elvira Khabirova [Fri, 10 Jul 2015 19:24:48 +0000 (22:24 +0300)]
Introduce SEN macro

* syscall.c (SEN): New temporary macro.
* linux/dummy.h (sys_printargs): New macro.
* linux/subcall.h: Wrap all sys_func entries using SEN.
* linux/*/syscallent*.h: Likewise.

9 years agoscsi.c: enhance SG_IO ioctl parser
Dmitry V. Levin [Tue, 7 Jul 2015 18:38:07 +0000 (21:38 +0300)]
scsi.c: enhance SG_IO ioctl parser

Fix SG_IO ioctl output in case of failed umove

* scsi.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
Update for RVAL_DECODED.
(print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req,
print_sg_io_v4_res): Do not print address in case of failed umove.
(scsi_ioctl): Use printaddr.

9 years agoptp.c: enhance ptp ioctl parser
Dmitry V. Levin [Tue, 7 Jul 2015 09:47:18 +0000 (12:47 +0300)]
ptp.c: enhance ptp ioctl parser

* ptp.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
Update for RVAL_DECODED.
(ptp_ioctl): Use umove_or_printaddr.

9 years agomtd.c: enhance mtd and ubi ioctl parsers
Dmitry V. Levin [Tue, 7 Jul 2015 01:12:12 +0000 (04:12 +0300)]
mtd.c: enhance mtd and ubi ioctl parsers

Decode as much data on entering syscall as possible.

* xlat/mtd_file_mode_options.in: New file.
* mtd.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
Include "xlat/mtd_file_mode_options.h".
Update for RVAL_DECODED.
(mtd_ioctl, ubi_ioctl): Use printnum_int and umove_or_printaddr.

9 years agosock.c: enhance socket ioctl parser
Dmitry V. Levin [Sat, 4 Jul 2015 11:01:08 +0000 (14:01 +0300)]
sock.c: enhance socket ioctl parser

Decode as much data on entering syscall as possible.

* sock.c: Update for RVAL_DECODED.
(print_addr): Remove.
(print_ifreq_addr, print_ifreq, print_ifc_len, decode_ifconf): New
functions.
(sock_ioctl) Use them.  Use umove_or_printaddr.

9 years agoblock.c: enhance block ioctl parser
Dmitry V. Levin [Sun, 5 Jul 2015 12:15:03 +0000 (15:15 +0300)]
block.c: enhance block ioctl parser

* block.c: Update for RVAL_DECODED.
Define BLKROTATIONAL and BLKZEROOUT.
(block_ioctl): Decode them.  Use printnum_short, printnum_int,
printnum_long, printpair_int64, and umove_or_printaddr.
(print_blkpg_req, block_ioctl): Use umove_or_printaddr.

9 years agoblkpg_ops: add BLKPG_RESIZE_PARTITION constant
Dmitry V. Levin [Sun, 5 Jul 2015 12:15:03 +0000 (15:15 +0300)]
blkpg_ops: add BLKPG_RESIZE_PARTITION constant

* xlat/blkpg_ops.in: Add BLKPG_RESIZE_PARTITION.

Reported-by: Christian Neukirchen <chneukirchen@gmail.com>
9 years agoloop.c: enhance loop ioctl parser
Dmitry V. Levin [Sat, 4 Jul 2015 14:40:02 +0000 (17:40 +0300)]
loop.c: enhance loop ioctl parser

Decode as much data on entering syscall as possible.

* loop.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
Update for RVAL_DECODED.
(decode_loop_info, decode_loop_info64): New functions.
(loop_ioctl): Use them.  Decode LOOP_SET_STATUS, LOOP_SET_STATUS64,
LOOP_SET_FD, LOOP_CHANGE_FD, LOOP_CTL_ADD and LOOP_CTL_REMOVE on
entering syscall.
Print LOOP_SET_FD and LOOP_CHANGE_FD arguments using printfd.

9 years agortc.c: enhance rtc ioctl parser
Dmitry V. Levin [Sat, 4 Jul 2015 12:07:35 +0000 (15:07 +0300)]
rtc.c: enhance rtc ioctl parser

* rtc.c: Update for RVAL_DECODED.
(print_rtc): Rename to print_rtc_time.
(decode_rtc_time, decode_rtc_wkalrm): New functions.
(rtc_ioctl): Use them.
[RTC_VL_READ]: Decode RTC_VL_READ.
Use printnum_long for RTC_IRQP_READ and RTC_EPOCH_READ decoding.

9 years agoUse printpair_int
Dmitry V. Levin [Mon, 6 Jul 2015 22:33:39 +0000 (22:33 +0000)]
Use printpair_int

* evdev.c (repeat_ioctl): Use printpair_int.
* net.c (do_pipe, sys_socketpair): Likewise.

9 years agoAdd several generic integer pairs printing functions
Dmitry V. Levin [Sun, 5 Jul 2015 22:09:29 +0000 (22:09 +0000)]
Add several generic integer pairs printing functions

Add functions to fetch and print pairs of integer types.
Note that these printers do not attempt to fetch data
in case of exiting(tcp) && syserror(tcp).

printnum_* printers will follow as soon as all callers are made ready
for this change.

* defs.h (printpair_int, printpair_long, printpair_int64): New
prototypes.
* util.c (DEF_PRINTPAIR): New macro.
(printpair_int, printpair_long, printpair_int64): New functions.

9 years agoAdd two generic integer printing functions
Dmitry V. Levin [Sun, 5 Jul 2015 22:09:29 +0000 (22:09 +0000)]
Add two generic integer printing functions

Add printnum_short and printnum_int64 in addition to already existing
printnum_int and printnum_long.

* defs.h (printnum_short, printnum_int64): New prototypes.
* util.c (DEF_PRINTNUM): New macro.
(printnum_int, printnum_long): Use DEF_PRINTNUM.
(printnum_short, printnum_int64): New functions.

9 years agoAdd address printing functions
Dmitry V. Levin [Sun, 5 Jul 2015 22:09:29 +0000 (22:09 +0000)]
Add address printing functions

printaddr is a simple function implementing "print NULL or address"
idiom.
umoven_or_printaddr is a wrapper around umoven that has the same return
value semantics as umoven but also prints the address when the data
is not going to be fetched (in case of exiting(tcp) && syserror(tcp))
or cannot be fetched (umoven fails).
umove_or_printaddr is a macro wrapper around umoven_or_printaddr that
mirrors umove wrapper around umoven.

* defs.h (printaddr, umoven_or_printaddr): New prototypes.
(umove_or_printaddr): New macro.
* util.c (printaddr, umoven_or_printaddr): New functions.

9 years agoImplement RVAL_DECODED flag
Dmitry V. Levin [Wed, 8 Jul 2015 14:10:56 +0000 (14:10 +0000)]
Implement RVAL_DECODED flag

Implement a method for "on entering" parsers to return
"done with decoding" information to their callers.

If a syscall parser called from trace_syscall_entering returns a value
with RVAL_DECODED bit set, record this value in tcp->sys_func_rval
and use it in trace_syscall_exiting instead of calling the parser on
exiting syscall.

If an ioctl parser returned RVAL_DECODED, this would tell
SYS_FUNC(ioctl) that the decoding is finished but fallback printing of
the ioctl command argument is needed, while e.g. RVAL_DONE+1 would mean
that the decoding is finished and no fallback decoding is needed.

* defs.h (struct tcb): Add sys_func_rval.
(RVAL_DECODED): New macro.
* syscall.c (trace_syscall_entering): Initialize tcp->sys_func_rval
along with setting TCB_INSYSCALL flag.
(trace_syscall_exiting): Use tcp->sys_func_rval instead of calling
tcp->s_ent->sys_func when the former has RVAL_DECODED flag set.
Reset tcp->sys_func_rval along with clearing TCB_INSYSCALL flag.
* ioctl.c (sys_ioctl): Set RVAL_DECODED flag on exiting.
Print ioctl argument iff RVAL_DECODED is set and fallback decoding
is requested.

9 years agotime.c: move rtc ioctl parser to a separate file
Dmitry V. Levin [Sat, 4 Jul 2015 08:56:21 +0000 (08:56 +0000)]
time.c: move rtc ioctl parser to a separate file

* rtc.c: new file
* Makefile.am (strace_SOURCES): Add it.
* time.c (print_rtc, rtc_ioctl): Move to rtc.c.

9 years agoterm.c: fix typo
Dmitry V. Levin [Sun, 5 Jul 2015 16:30:10 +0000 (16:30 +0000)]
term.c: fix typo

* term.c: Rename TCLFLSH to TCFLSH.

9 years agoDo not include sys/filio.h
Dmitry V. Levin [Sun, 5 Jul 2015 16:18:45 +0000 (16:18 +0000)]
Do not include sys/filio.h

* configure.ac (AC_CHECK_HEADERS): Remove sys/filio.h.
* term.c: Do not include <sys/filio.h>.

9 years agoioctl: prepare ioctl_decode_command_number for future changes
Dmitry V. Levin [Thu, 2 Jul 2015 22:31:11 +0000 (22:31 +0000)]
ioctl: prepare ioctl_decode_command_number for future changes

* ioctl.c (ioctl_decode_command_number): Change 1st arg to struct tcb*.
(sys_ioctl): Update callers.

9 years agoioctl: simplify ioctl_decode signature
Dmitry V. Levin [Thu, 2 Jul 2015 22:27:51 +0000 (22:27 +0000)]
ioctl: simplify ioctl_decode signature

* ioctl.c (ioctl_decode): Remove 2nd and 3rd parameters.
(sys_ioctl): Update callers.

9 years agoioctl: consistently use name "code" for ioctl request code
Dmitry V. Levin [Thu, 2 Jul 2015 22:23:53 +0000 (22:23 +0000)]
ioctl: consistently use name "code" for ioctl request code

* ioctl.c (evdev_decode_number, hiddev_decode_number,
ioctl_decode_command_number): Rename "arg" to "code".

9 years agoMove ioctl syscall parser to ioctl.c
Dmitry V. Levin [Thu, 2 Jul 2015 21:37:23 +0000 (21:37 +0000)]
Move ioctl syscall parser to ioctl.c

* io.c (sys_ioctl): Move ...
* ioctl.c: ... here.
(ioctl_lookup, ioctl_next_match, ioctl_print_code, ioctl_decode,
ioctl_decode_command_number): Declare as static.
* defs.h (ioctl_lookup, ioctl_next_match, ioctl_print_code,
ioctl_decode, ioctl_decode_command_number): Remove.

9 years agoioctl: remove obsolete registry of ioctl characters
Dmitry V. Levin [Thu, 2 Jul 2015 21:34:39 +0000 (21:34 +0000)]
ioctl: remove obsolete registry of ioctl characters

* ioctl.c: Remove registry of ioctl characters.

9 years agoFix filtering of <unavailable> syscalls
Dmitry V. Levin [Mon, 29 Jun 2015 11:57:44 +0000 (11:57 +0000)]
Fix filtering of <unavailable> syscalls

* syscall.c (trace_syscall_exiting): Skip filtered syscalls also in case
of get_regs or get_syscall_result failure.
* tests/filter-unavailable.c: New file.
* tests/filter-unavailable.expected: Likewise.
* tests/filter-unavailable.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add filter-unavailable.
(filter_unavailable_LDFLAGS): Add -pthread.
(TESTS): Add filter-unavailable.test.
(EXTRA_DIST): Add filter-unavailable.expected.
* tests/.gitignore: Add filter-unavailable.

Reported-by: Bryan Matsuo <bryan.matsuo@gmail.com>
9 years agoFix -qq option in conjunction with -o option
Dmitry V. Levin [Mon, 29 Jun 2015 14:37:26 +0000 (14:37 +0000)]
Fix -qq option in conjunction with -o option

This change makes -qq option work in conjunction with -o option,
thus complementing commit v4.7-222-g01997cf.

* strace.c (init): Do not reset qflag.

9 years agoxtensa: wire up new syscalls
Dmitry V. Levin [Tue, 30 Jun 2015 16:31:33 +0000 (16:31 +0000)]
xtensa: wire up new syscalls

* linux/xtensa/syscallent.h (bpf, execveat): New entries.

9 years agobfin: wire up new syscalls
Dmitry V. Levin [Tue, 30 Jun 2015 16:25:10 +0000 (16:25 +0000)]
bfin: wire up new syscalls

* linux/bfin/syscallent.h (kcmp, finit_module, sched_setattr,
sched_getattr, renameat2, seccomp, getrandom, memfd_create,
bpf, execveat): New entries.

9 years agoalpha: wire up new syscalls
Dmitry V. Levin [Tue, 30 Jun 2015 15:39:46 +0000 (15:39 +0000)]
alpha: wire up new syscalls

* linux/alpha/syscallent.h (getrandom, memfd_create, execveat):
New entries.

9 years agotests: skip stat32 test if struct stat is defined incorrectly
Dmitry V. Levin [Wed, 17 Jun 2015 20:58:33 +0000 (20:58 +0000)]
tests: skip stat32 test if struct stat is defined incorrectly

If stat.st_mode returned by syscall is 0, it means that the definition
of struct stat in <asm/stat.h> is incorrect.  This is the case e.g. on
mips n32 where the only available stat syscall is 64-bit but at the same
time struct stat defined by <asm/stat.h> is 32-bit.

* tests/stat.c (main) [NR_stat]: Return 77 if st_mode is 0.

9 years agoConsistenly use #ifdef to check for AC_DEFINE'd macros
Dmitry V. Levin [Wed, 17 Jun 2015 20:09:13 +0000 (20:09 +0000)]
Consistenly use #ifdef to check for AC_DEFINE'd macros

* aio.c (print_common_flags): Use #ifdef in the check for
HAVE_STRUCT_IOCB_U_C_FLAGS.
* defs.h: Use #ifdef in the check for HAVE_LITTLE_ENDIAN_LONG_LONG.
* net.c: Use #ifdef in the check for HAVE_SENDMSG.
* syscall.c (dumpio): Likewise.
* printstat.h (DO_PRINTSTAT): Use #ifdef in checks for
HAVE_STRUCT_STAT_ST_* macros.
* util.c: Use #ifdef in checks for HAVE_SYS_XATTR_H.

9 years agoxattr: move fallback definitions of xattr flags to xlat/
Dmitry V. Levin [Wed, 17 Jun 2015 19:54:21 +0000 (19:54 +0000)]
xattr: move fallback definitions of xattr flags to xlat/

* xattr.c: Include <sys/xattr.h> insread of <linux/xattr.h>.
Move definitions of XATTR_* flags ...
* xlat/xattrflags.in: ... here.

9 years agolink: move fallback definitions of AT_* constants to xlat/
Dmitry V. Levin [Wed, 17 Jun 2015 19:45:26 +0000 (19:45 +0000)]
link: move fallback definitions of AT_* constants to xlat/

* link.c: Move definitions of AT_* constants ...
* xlat/at_flags.in: ... here.

9 years agonet: move fallback definitions of SOL_* constants to xlat/
Dmitry V. Levin [Wed, 17 Jun 2015 19:22:10 +0000 (19:22 +0000)]
net: move fallback definitions of SOL_* constants to xlat/

* net.c: Move definitions of SOL_* constants ...
* xlat/socketlayers.in: ... here.

9 years agofutex: move fallback definitions of futex constants to xlat/
Dmitry V. Levin [Wed, 17 Jun 2015 19:00:17 +0000 (19:00 +0000)]
futex: move fallback definitions of futex constants to xlat/

* futex.c: Move definitions of FUTEX_OP_CMP_* constants ...
* xlat/futexwakecmps.in: ... here.
* futex.c: Move definitions of other FUTEX_OP_* constants ...
* xlat/futexwakeops.in: ... here.
* futex.c: Move definitions of remaining FUTEX_* constants except
FUTEX_PRIVATE_FLAG and FUTEX_CLOCK_REALTIME flags ...
* xlat/futexops.in: ... here.