]> granicus.if.org Git - strace/log
strace
8 years agotime.c: move fallback definitions of SIGEV_* values to xlat/
Dmitry V. Levin [Wed, 16 Sep 2015 12:09:52 +0000 (12:09 +0000)]
time.c: move fallback definitions of SIGEV_* values to xlat/

* time.c: Move fallback definitions of SIGEV_* values ...
* xlat/sigev_value.in: ... here.

8 years agoSimplify use of mpers printers
Dmitry V. Levin [Tue, 15 Sep 2015 21:51:15 +0000 (21:51 +0000)]
Simplify use of mpers printers

* native_defs.h: New file.
* syscall.c: Include it.
* mpers_type.h [!IN_MPERS] (MPERS_DEFS): Change to "native_defs.h".
* defs.h (MPERS_PRINTER_NAME): Remove.
[SUPPORTED_PERSONALITIES > 1] (MPERS_PRINTER_NAME, printers): Move ...
* Makefile.am (printers.h): ... here.
Add macro definitions for mpers printers.
(m%_defs.h): Add redefinition of MPERS_PRINTER_NAME and inclusion
of "$(mpers_PREFIX)printer_decls.h".
(strace_SOURCES): Add native_defs.h.
* README-mpers: Update instructions for using mpers printers.
* ipc_msg.c (tprint_msgsnd, tprint_msgrcv): Call tprint_msgbuf directly.
* mq.c (sys_mq_open, mq_getsetattr): Call printmqattr directly.
* process.c (sys_ptrace): Call printsiginfo_at directly.
* signal.c (print_sigqueueinfo, sys_rt_sigtimedwait): Likewise.
* resource.c (sys_getrusage): Call printrusage directly.
* utimes.c (sys_utimensat): Call print_timespec_utime_pair directly.
(sys_utimes, sys_futimesat): Call print_timeval_pair directly.
* wait.c (printwaitn): Call printrusage directly.
(sys_waitid): Call printrusage and printsiginfo_at directly.

8 years agoAdd a new helper function umove_ulong_array_or_printaddr
Dmitry V. Levin [Tue, 15 Sep 2015 02:17:32 +0000 (02:17 +0000)]
Add a new helper function umove_ulong_array_or_printaddr

* defs.h (umove_ulong_array_or_printaddr): New prototype.
* util.c (umove_ulong_array_or_printaddr): New function.
* desc.c (sys_pselect6): Use it instead of open-coding
a proxy struct parser for different personalities.
* io.c (tprint_iov_upto): Use it instead of open-coding
a struct iovec parser for different personalities.
* kexec.c (print_kexec_segments): Use it instead of open-coding
a struct kexec_segment parser for different personalities.
(print_seg): Pass arguments using an array.

8 years agotests: add pselect6.test
Dmitry V. Levin [Tue, 15 Sep 2015 02:14:38 +0000 (02:14 +0000)]
tests: add pselect6.test

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

8 years agoRename umove_long_or_printaddr to umove_ulong_or_printaddr
Dmitry V. Levin [Mon, 14 Sep 2015 23:02:29 +0000 (23:02 +0000)]
Rename umove_long_or_printaddr to umove_ulong_or_printaddr

Rename the recently added function to reflect what kind of data type
it actually deals with: unsigned long int, without sign extension.

* defs.h (umove_long_or_printaddr): Rename to umove_ulong_or_printaddr,
chage 3rd argument to unsigned long *.
* util.c (umove_long_or_printaddr): Likewise.
* aio.c (sys_io_submit): Update callers.

8 years agoaarch64, ppc64, sparc64, tile: hook up mpers printers
Dmitry V. Levin [Mon, 14 Sep 2015 22:33:23 +0000 (22:33 +0000)]
aarch64, ppc64, sparc64, tile: hook up mpers printers

* defs.h [AARCH64 && HAVE_M32_MPERS]: Define PERSONALITY0_INCLUDE_FUNCS,
PERSONALITY0_INCLUDE_PRINTERS_DECLS,
and PERSONALITY0_INCLUDE_PRINTERS_DEFS.
[POWERPC64 && HAVE_M32_MPERS]: Define PERSONALITY1_INCLUDE_FUNCS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS,
and PERSONALITY1_INCLUDE_PRINTERS_DEFS.
[SPARC64 && HAVE_M32_MPERS]: Likewise.
[TILE && HAVE_M32_MPERS]: Likewise.

8 years agoAdd PowerPC specific ptrace constants
Anton Blanchard [Tue, 1 Sep 2015 21:55:37 +0000 (07:55 +1000)]
Add PowerPC specific ptrace constants

* xlat/ptrace_cmds.in: Add PowerPC specific ptrace constants.

8 years agoUpdate SCTP_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 17:24:09 +0000 (17:24 +0000)]
Update SCTP_* constants

* xlat/socksctpoptions.in: Add SCTP_GET_ASSOC_ID_LIST, SCTP_AUTO_ASCONF,
SCTP_PEER_ADDR_THLDS, SCTP_RECVRCVINFO, SCTP_RECVNXTINFO,
SCTP_DEFAULT_SNDINFO, SCTP_SOCKOPT_CONNECTX, SCTP_SOCKOPT_CONNECTX3,
and SCTP_GET_ASSOC_STATS.

8 years agoUpdate F_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 17:21:10 +0000 (17:21 +0000)]
Update F_* constants

* xlat/fcntlcmds.in: Add F_SETPIPE_SZ, F_GETPIPE_SZ, F_ADD_SEALS,
and F_GET_SEALS.

8 years agoUpdate RENAME_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 17:16:32 +0000 (17:16 +0000)]
Update RENAME_* constants

* xlat/rename_flags.in: Add RENAME_WHITEOUT.

8 years agoUpdate SO_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 17:04:22 +0000 (17:04 +0000)]
Update SO_* constants

* xlat/sockoptions.in: Add SO_ATTACH_BPF, SO_BPF_EXTENSIONS,
SO_BUSY_POLL, SO_DETACH_BPF, SO_GET_FILTER, SO_INCOMING_CPU,
SO_LOCK_FILTER, SO_MAX_PACING_RATE, SO_PEEK_OFF, SO_RXQ_OVFL,
SO_SELECT_ERR_QUEUE, and SO_WIFI_STATUS.

8 years agoUpdate INPUT_PROP_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 16:20:25 +0000 (16:20 +0000)]
Update INPUT_PROP_* constants

* xlat/evdev_prop.in: Add INPUT_PROP_ACCELEROMETER.

8 years agoUpdate KEY_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 16:19:25 +0000 (16:19 +0000)]
Update KEY_* constants

* xlat/evdev_keycode.in: Add KEY_ROTATE_DISPLAY, KEY_NUMERIC_A,
KEY_NUMERIC_B, KEY_NUMERIC_C, and KEY_NUMERIC_D.

8 years agoUpdate FALLOC_FL_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 16:04:17 +0000 (16:04 +0000)]
Update FALLOC_FL_* constants

* xlat/falloc_flags.in: Add FALLOC_FL_INSERT_RANGE.

8 years agoUpdate AF_* and PF_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 16:00:39 +0000 (16:00 +0000)]
Update AF_* and PF_* constants

* xlat/addrfams.in: Add AF_IB and AF_MPLS.
* xlat/domains.in: Add PF_IB and PF_MPLS.

8 years agoUpdate TCP_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 15:50:44 +0000 (15:50 +0000)]
Update TCP_* constants

* xlat/socktcpoptions.in: Add TCP_NOTSENT_LOWAT, TCP_CC_INFO,
TCP_SAVE_SYN, and TCP_SAVED_SYN.

8 years agoUpdate PACKET_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 15:46:47 +0000 (15:46 +0000)]
Update PACKET_* constants

* xlat/sockpacketoptions.in: Add PACKET_VNET_HDR, PACKET_TX_TIMESTAMP,
PACKET_TIMESTAMP, PACKET_FANOUT, PACKET_TX_HAS_OFF, PACKET_QDISC_BYPASS,
PACKET_ROLLOVER_STATS, and PACKET_FANOUT_DATA.

8 years agoUpdate BPF_MAP_TYPE_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 15:40:17 +0000 (15:40 +0000)]
Update BPF_MAP_TYPE_* constants

* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_PERF_EVENT_ARRAY.

8 years agoUpdate IPPROTO_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 15:29:41 +0000 (15:29 +0000)]
Update IPPROTO_* constants

* xlat/inet_protocols.in: Add IPPROTO_MPLS.

8 years agoUpdate IP_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 15:01:02 +0000 (15:01 +0000)]
Update IP_* constants

* xlat/sockipoptions.in: Add IP_CHECKSUM and IP_BIND_ADDRESS_NO_PORT.

8 years agoUpdate PTRACE_O_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 14:42:28 +0000 (14:42 +0000)]
Update PTRACE_O_* constants

* ptrace.h: Define PTRACE_O_SUSPEND_SECCOMP.
* xlat/ptrace_setoptions_flags.in: Add it.

8 years agoUpdate PR_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 13:25:24 +0000 (13:25 +0000)]
Update PR_* constants

* xlat/prctl_options.in: Add PR_SET_FP_MODE, PR_GET_FP_MODE,
and PR_CAP_AMBIENT.

8 years agoUpdate SECBIT_* constants
Dmitry V. Levin [Mon, 14 Sep 2015 13:21:01 +0000 (13:21 +0000)]
Update SECBIT_* constants

* xlat/secbits.in: Add SECBIT_NO_CAP_AMBIENT_RAISE
and SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED.

9 years agompers.m4: workaround missing gnu/stubs-*.h files
Dmitry V. Levin [Thu, 27 Aug 2015 19:51:05 +0000 (19:51 +0000)]
mpers.m4: workaround missing gnu/stubs-*.h files

On some systems missing gnu/stubs-*.h files make -m32/-mx32 compilation
checks fail.  As we want to support multiple personalities despite of
this limitation, workaround the check by creating empty gnu stub files
if necessary.

* m4/mpers.m4 (st_MPERS): Check for the gnu stub file.  Create an empty
gnu stub file if the system one is missing.
* Makefile.am (DISTCLEANFILES): Add gnu/stubs-32.h and gnu/stubs-x32.h.

9 years agotests: add times-fail.test
Elvira Khabirova [Thu, 20 Aug 2015 21:09:32 +0000 (00:09 +0300)]
tests: add times-fail.test

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

9 years agotests: add times.test
Eugene Syromyatnikov [Tue, 4 Aug 2015 12:52:55 +0000 (15:52 +0300)]
tests: add times.test

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

9 years agoMpersify parser of times syscall
Elvira Khabirova [Mon, 3 Aug 2015 04:26:53 +0000 (07:26 +0300)]
Mpersify parser of times syscall

Fix multiple personalities support in parser of times syscall by
mpersifying struct tms.

* times.c (tms_t): New typedef.  Mpersify it.
(sys_times): Use it instead of struct tms.

9 years agotests: add sysinfo.test
Elvira Khabirova [Mon, 3 Aug 2015 03:30:49 +0000 (06:30 +0300)]
tests: add sysinfo.test

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

9 years agoMpersify parser of sysinfo syscall
Elvira Khabirova [Mon, 3 Aug 2015 03:27:48 +0000 (06:27 +0300)]
Mpersify parser of sysinfo syscall

Fix multiple personalities support in parser of sysinfo syscall by
mpersifying struct sysinfo.

* sysinfo.c (sysinfo_t): New typedef.  Mpersify it.
(sys_sysinfo): Use it instead of struct sysinfo.

9 years agoEnhance msgctl syscall decoding
Elvira Khabirova [Mon, 17 Aug 2015 23:01:26 +0000 (02:01 +0300)]
Enhance msgctl syscall decoding

Make parser of msgctl syscall print struct msqid_ds.

* ipc_msgctl.c (msqid_ds_t): New typedef.  Mpersify it.
(print_msqid_ds): New function.  Use msqid_ds_t.
(sys_msgctl): Use print_msqid_ds.
* tests/ipc_msg.c: Update for struct msqid_ds support.

9 years agoEnhance shmctl syscall decoding
Elvira Khabirova [Fri, 31 Jul 2015 15:43:21 +0000 (18:43 +0300)]
Enhance shmctl syscall decoding

Make parser of shmctl syscall print struct shmid_ds.

* ipc_shmctl.c (shmid_ds_t): New typedef.  Mpersify it.
(print_shmid_ds): New function.  Use shmid_ds_t.
(sys_shmctl): Use print_shmid_ds.
* tests/ipc_shm.c: Update for struct shmid_ds support.

9 years agotests: add ipc_msgbuf.test
Elvira Khabirova [Mon, 3 Aug 2015 09:40:46 +0000 (12:40 +0300)]
tests: add ipc_msgbuf.test

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

9 years agoMpersify tprint_msgsnd and tprint_msgrcv
Elvira Khabirova [Wed, 19 Aug 2015 02:33:34 +0000 (05:33 +0300)]
Mpersify tprint_msgsnd and tprint_msgrcv

Fix multiple personalities support in tprint_msgsnd and tprint_msgrcv
by converting tprint_msgbuf into a mpersified printer.

* print_msgbuf.c (msgbuf_t): New typedef.  Mpersify it.
(tprint_msgbuf): Use it instead of long.
Wrap function name into MPERS_PRINTER_DECL.
* ipc_msg.c (tprint_msgsnd, tprint_msgrcv): Use mpersified
tprint_msgbuf.

9 years agotests: add mq.test
Elvira Khabirova [Wed, 19 Aug 2015 02:28:48 +0000 (05:28 +0300)]
tests: add mq.test

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

9 years agoMpersify parsers of mq_open and mq_getsetattr syscalls
Elvira Khabirova [Thu, 20 Aug 2015 18:15:41 +0000 (21:15 +0300)]
Mpersify parsers of mq_open and mq_getsetattr syscalls

Fix multiple personalities support in parsers of mq_open and
mq_getsetattr by converting printmqattr into a mpersified printer.

* print_mq_attr.c (mq_attr_t): New typedef.  Mpersify it.
(printmqattr): Use it instead of struct mq_attr.  Wrap function name
into MPERS_PRINTER_DECL.
* mq.c (mq_open, mq_getsetattr): Use mpersified printmqattr.

9 years agotests: add wait.test
Dmitry V. Levin [Wed, 15 Jul 2015 01:50:27 +0000 (01:50 +0000)]
tests: add wait.test

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

9 years agoMpersify parsers of getrusage, waitpid, wait4, and waitid syscalls
Dmitry V. Levin [Sat, 18 Jul 2015 00:19:50 +0000 (00:19 +0000)]
Mpersify parsers of getrusage, waitpid, wait4, and waitid syscalls

Fix multiple personalities support in parsers of getrusage, waitpid,
wait4, and waitid syscalls by converting printrusage into a mpersified
printer.

* defs.h (printrusage): Remove.
* printrusage.c (rusage_t): New typedef.  Mpersify it.
(printrusage): Use it instead of struct rusage.
Wrap function name into MPERS_PRINTER_DECL.
* resource.c (sys_getrusage): Use mpersified printrusage.
* wait.c (printwaitn, sys_waitid): Likewise.

9 years agotests: add rt_sigqueueinfo.test
Elvira Khabirova [Fri, 21 Aug 2015 15:49:14 +0000 (18:49 +0300)]
tests: add rt_sigqueueinfo.test

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

9 years agoMpersify printsiginfo_at printer
Elvira Khabirova [Mon, 3 Aug 2015 23:16:40 +0000 (02:16 +0300)]
Mpersify printsiginfo_at printer

Fix multiple personalities support in parsers of ptrace,
rt_sigqueueinfo, rt_tgsigqueueinfo, rt_sigtimedwait and waitid syscalls
by converting printsiginfo_at into a mpersified printer.

* printsiginfo.c (siginfo_t): Mpersify.
(printsiginfo_at): Wrap function name into MPERS_PRINTER_DECL.
* defs.h (printsiginfo_at): Remove.
* signal.c (print_sigqueueinfo, sys_rt_sigtimedwait): Use mpersified
printsiginfo_at.
* process.c (sys_ptrace): Likewise.
* wait.c (sys_waitid): Likewise.

9 years agoMpersify parser of sigaltstack syscall
Elvira Khabirova [Mon, 3 Aug 2015 23:16:29 +0000 (02:16 +0300)]
Mpersify parser of sigaltstack syscall

Fix multiple personalities support in parser of sigaltstack syscall by
mpersifying stack_t typedef.

* sigaltstack.c (stack_t): Mpersify.
(print_stack_t): Use it.

9 years agoMpersify parser of utime syscall
Elvira Khabirova [Mon, 3 Aug 2015 23:16:20 +0000 (02:16 +0300)]
Mpersify parser of utime syscall

Fix multiple personalities support in parser of utime syscall by using
mpersified utimbuf_t typedef.

* utime.c (utimbuf_t): New typedef.  Mpersify it.
(sys_utime): Use it instead of a locally defined union.

9 years agotests: add utimensat.test
Dmitry V. Levin [Wed, 15 Jul 2015 15:34:59 +0000 (15:34 +0000)]
tests: add utimensat.test

* tests/utimensat.c: New file.
* tests/utimensat.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add utimensat.
(TESTS): Add utimensat.test.
* configure.ac (AC_CHECK_FUNCS): Add utimensat.
* tests/.gitignore: Add utimensat.

9 years agoMpersify parsers of utimes, futimesat, and utimensat syscalls
Dmitry V. Levin [Mon, 3 Aug 2015 22:52:40 +0000 (01:52 +0300)]
Mpersify parsers of utimes, futimesat, and utimensat syscalls

Fix multiple personalities support in parsers of utimes, futimesat,
and utimensat syscalls by introducing two mpersified printers:
print_timeval_pair and print_timespec_utime_pair.

* print_time.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* utimes.c (decode_utimes): Remove.
(sys_utimes, sys_futimesat): Use print_timeval_pair instead
of decode_utimes.
(sys_utimensat): Use print_timespec_utime_pair instead of decode_utimes.

9 years agoAdd mpers support
Elvira Khabirova [Mon, 3 Aug 2015 22:47:02 +0000 (01:47 +0300)]
Add mpers support

Add a subsystem for semi-automatical definition of how parsers should
work with personality-dependent (mpers) types of tracee's data.  Create
auxiliary libraries containing mpers syscall parsers and printer
functions, one library for each possible nonnative target personality.

Currently some parsers do not handle differences in definitions of data
types between personalities, namely LP64 and ILP32.  When
this is the case, long integers, pointers, and all compound
types containing long and pointer members may be printed incorrectly,
because of differences in sizes, offsets and alignments.

Since in most cases these are the only differences in desired behaviour
of parsers and printers for different personalities, a correct way
would be to compile one source code into multiple parsers, differing
only in definitions of mpers types.

To get a definition of a given type for nonnative personality
a very basic .c file containing a declaration of a variable of this type
is being compiled for this personality (using -m32 or -mx32 compiler
flag).  Information about the type is then being extracted from
this binary's DWARF debug info with an awk script and put
into a corresponding header file.  Resulting headers are being used to
compile mpers variations of syscall parsers and printer functions.

In addition to syscall parsers, there can occur a need to create mpers
printing functions, which then can be called from many places
in the code (for example, printsiginfo_at).  Such functions (printers)
are marked in a special manner.

For each possible nonnative target personality a library is being
created, containing mpers variations of syscall parsers and printers.
Only syscall parsers from files marked in a special manner and specially
marked functions from such files are being recompiled and included
in these libraries.

generate_mpers_am.sh is called by bootstrap to find the files
from strace_SOURCES which include MPERS_DEFS.  During compilation,
these files are being inspected for inclusions of DEF_MPERS_TYPE,
and nonnative variations of each included type are being generated
by an awk script.

Mpers parser names are being modified during inclusions of syscallent
headers for nonnative personalities.  Pointers to printers are
being stored in structs struct_printers, and a master
pointer printers is being updated on every set_personality.

* README-mpers: New README explaining how to use mpers support.
* empty.h: New empty file.
* generate_mpers_am.sh: New file.
* mpers.awk: Likewise.
* mpers.sh: Likewise.
* mpers_test.sh: Likewise.
* mpers_type.h: Likewise.
* Makefile.am (strace_SOURCES): Add empty.h and mpers_type.h.
(strace_CPPFLAGS, strace_LDFLAGS, strace_LDADD): Move to the beginning
of the file.
(strace_LDADD, noinst_LIBRARIES): Add libmpers-%.a.
(EXTRA_DIST): Add mpers.awk, mpers.sh, mpers_test.sh.
(BUILT_SOURCES, CLEANFILES): Add new generated files:
native_printer_decls.h, native_printer_defs.h, printers.h,
[HAVE_M32_MPERS] $(mpers_m32_targets), and [HAVE_MX32_MPERS]
$(mpers_mx32_targets).
(mpers_NAME, mpers_PREFIX, mpers_DEFS, mpers_INCLUDES, mpers_CPPFLAGS,
mpers_sh_opts, libmpers_CPPFLAGS, libmpers_m[x]32_a_SOURCES,
libmpers_m[x]32_a_CPPFLAGS, mpers_m[x]32_targets): New variables.
(mpers-m[x]32.stamp, m[x]32_defs.h, m[x]32_funcs.h, printers.h,
%_printer_decls.h, %_printer_defs.h, clean-local,
native_printer_decls.h, native_printer_defs.h, $mpers_m[x]32_targets):
New targets.
* bootstrap: Add generate_mpers_am.sh.
* configure.ac: Add AC_PROG_RANLIB.
* m4/mpers.m4: Add HAVE_MPERS variable.  Add $st_cv_mpers checks.
* defs.h: Include mpers_type.h.
Include printers.h, native_printer_decls.h, define MPERS_PRINTER_NAME.
Redefine SYS_FUNC_NAME.  Define MPERS_PRINTER_DECL.
[HAVE_M32_MPERS]: define PERSONALITY1_INCLUDE_FUNCS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS
for X86_64, X32.
[HAVE_MX32_MPERS]: define PERSONALITY2_INCLUDE_FUNCS,
PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS
for X86_64.
Add fallback definitions of
PERSONALITY1_INCLUDE_FUNCS, PERSONALITY2_INCLUDE_FUNCS,
PERSONALITY0_INCLUDE_PRINTERS_DECLS, PERSONALITY0_INCLUDE_PRINTERS_DEFS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS,
PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS.
* syscall.c: Include PERSONALITY1_INCLUDE_FUNCS,
PERSONALITY2_INCLUDE_FUNCS,
PERSONALITY0_INCLUDE_PRINTERS_DECLS, PERSONALITY0_INCLUDE_PRINTERS_DEFS,
PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS,
PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS.
(printers): New struct.  Update it when needed.
* .gitignore: Add libmpers-m32.a, libmpers-mx32.a, m32_defs.h,
m32_funcs.h, m32_printer_decls.h, m32_printer_defs.h, mpers-m32,
mpers-m32.stamp, mpers-mx32, mpers-mx32.stamp, mpers.am, mx32_defs.h,
mx32_funcs.h, mx32_printer_decls.h, mx32_printer_defs.h,
native_printer_decls.h, native_printer_defs.h, and printers.h.

9 years agotests: convert readlink.test and readlinkat.test from match_awk to match_diff
Dmitry V. Levin [Fri, 28 Aug 2015 08:43:57 +0000 (08:43 +0000)]
tests: convert readlink.test and readlinkat.test from match_awk to match_diff

* tests/readlink.c (main): Print expected output.
* tests/readlinkat.c (main): Likewise.
* tests/readlink.test: Use match_diff instead of match_awk.
* tests/readlinkat.test: Likewise.
* tests/readlink.awk: Remove.
* tests/readlinkat.awk: Likewise.
* tests/Makefile.am (EXTRA_DIST): Remove readlink.awk and readlinkat.awk.

9 years agotests: convert getrandom.test from match_awk to match_diff
Dmitry V. Levin [Fri, 28 Aug 2015 07:11:17 +0000 (07:11 +0000)]
tests: convert getrandom.test from match_awk to match_diff

* tests/getrandom.c (main): Print expected output.
* tests/getrandom.test: Use match_diff instead of match_awk.
* tests/getrandom.awk: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove getrandom.awk.

9 years agotests: convert select.test from match_awk to match_diff
Dmitry V. Levin [Thu, 27 Aug 2015 08:24:39 +0000 (08:24 +0000)]
tests: convert select.test from match_awk to match_diff

* tests/select.c (main): Print expected output.
* tests/select.test: Use match_diff instead of match_awk.
* tests/select.awk: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove select.awk.

9 years agotests: convert several tests from match_grep to match_diff
Dmitry V. Levin [Wed, 26 Aug 2015 23:25:06 +0000 (23:25 +0000)]
tests: convert several tests from match_grep to match_diff

* tests/sendfile.test: Use match_diff instead of match_grep.
* tests/sendfile64.test: Likewise.
* tests/time.test: Likewise.
* tests/utime.test: Likewise.
* tests/xet_robust_list.test: Likewise.
* tests/sendfile.c (main): Update match patterns for match_diff.
* tests/sendfile64.c (main): Likewise.
* tests/time.c (main): Likewise.
* tests/utime.c (main): Likewise.
* tests/xet_robust_list.c (main): Likewise.

9 years agotests: fix match_diff usage
Dmitry V. Levin [Wed, 26 Aug 2015 22:29:41 +0000 (22:29 +0000)]
tests: fix match_diff usage

The first argument of match_diff should be the file with expected
output, the second argument - the file with actual output.

* tests/aio.test: Swap match_diff arguments.
* tests/restart_syscall.test: Likewise.
* tests/seccomp.test: Likewise.
* tests/umovestr2.test: Likewise.

9 years agobuild: fix -I options
Dmitry V. Levin [Wed, 26 Aug 2015 22:50:58 +0000 (22:50 +0000)]
build: fix -I options

* configure.ac (AM_INIT_AUTOMAKE): Add nostdinc.
* Makefile.am (AM_CPPFLAGS): Append -I$(builddir) and -I$(srcdir).
* tests/Makefile.am (AM_CPPFLAGS): Likewise.

9 years agoaio: rewrite from libaio.h to linux/aio_abi.h
Dmitry V. Levin [Wed, 26 Aug 2015 17:48:40 +0000 (17:48 +0000)]
aio: rewrite from libaio.h to linux/aio_abi.h

* configure.ac (AC_CHECK_HEADERS): Remove libaio.h.
* aio.c: Assume that <linux/aio_abi.h> is available,
include it instead of <libaio.h>.
[!IOCB_RESFD]: Remove.
(enum iocb_sub): Remove SUB_POLL.
(tprint_lio_opcode): Update.
(print_common_flags): Use IOCB_FLAG_RESFD instead of IOCB_RESFD,
rename fields of struct iocb.
(iocb_is_valid, print_iocb_header, print_iocb): New functions.
(sys_io_submit): Use print_iocb.
(print_io_event): Fix struct io_event decoding.
(sys_io_cancel): Use print_iocb_header.
* strace.spec (BuildRequires): Remove libaio-devel.
* tests/aio.c (main): Test IOCB_CMD_PREADV, io_cancel,
and struct io_event decoding.
* tests/aio.test (syscalls): Add io_cancel.

9 years agoFix multiple personalities support in parser of io_submit syscall
Dmitry V. Levin [Wed, 26 Aug 2015 12:49:07 +0000 (12:49 +0000)]
Fix multiple personalities support in parser of io_submit syscall

Introduce a new helper function to fetch tracee's long integers
and use it to fix multiple personalities support in io_submit parser.

* defs.h (umove_long_or_printaddr): New prototype.
* util.c (umove_long_or_printaddr): New function.
* aio.c (sys_io_submit): Use it to fetch tracee's pointers.
* tests/aio.c: New file.
* tests/aio.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add aio.
(TESTS): Add aio.test.
* tests/.gitignore: Add aio.

9 years agotests: fix build on systems that lack O_CLOEXEC definition
Dmitry V. Levin [Wed, 26 Aug 2015 21:02:04 +0000 (21:02 +0000)]
tests: fix build on systems that lack O_CLOEXEC definition

* tests/epoll_create1.c (main): Check that O_CLOEXEC is defined.
* tests/eventfd.c (main): Likewise.
* tests/signalfd.c (main): Likewise.

9 years agotests: fix build on systems that lack AT_FDCWD definition
Dmitry V. Levin [Wed, 26 Aug 2015 20:20:38 +0000 (20:20 +0000)]
tests: fix build on systems that lack AT_FDCWD definition

* tests/readlinkat.c: Stop including <fcntl.h>.
(main): Replace AT_FDCWD with -100.

9 years agoFix printing of io_getevents first argument
Dmitry V. Levin [Wed, 26 Aug 2015 16:15:46 +0000 (16:15 +0000)]
Fix printing of io_getevents first argument

* aio.c (sys_io_getevents): Print first argument using "%lu" format.

9 years agodecode extend getsockopt/setsockopt options
Mike Frysinger [Wed, 19 Aug 2015 17:29:27 +0000 (13:29 -0400)]
decode extend getsockopt/setsockopt options

Currently the code assumes the set of valid options between getsockopt
and setsockopt are exactly the same and thus maintains one list.  The
kernel unfortunately does not do this -- it allows for different opts
between the get and set functions.  See the {g,s}et_opt{min,max} fields
in the various netfilter subcores.

To support this, extend the printxval function to take multiple sets of
xlats as varargs.  Then we add the new get/set lists, and pass them down
in the net code when decoding things.

A simple example is iptables; before:
getsockopt(4, SOL_IP, 0x40 /* IP_??? */, ...) = 0
getsockopt(4, SOL_IP, 0x41 /* IP_??? */, ...) = 0
after:
getsockopt(4, SOL_IP, IPT_SO_GET_INFO, ...) = 0
getsockopt(4, SOL_IP, IPT_SO_GET_ENTRIES, ...) = 0

If these were setsockopt calls, then 0x40 & 0x41 would be
IPT_SO_SET_REPLACE & IPT_SO_SET_ADD_COUNTERS.

* configure.ac: Check for netfilter headers.
* defs.h (printxvals): New prototype.
(printxval): Change to a define.
* net.c: Include netfilter headers and new sockopts headers.
(print_sockopt_fd_level_name): Add a is_getsockopt argument.  Change SOL_IP
and SOL_IPV6 decoding to use printxvals, and use is_getsockopt to pass more
xlats down.
(getsockopt): Call print_sockopt_fd_level_name with is_getsockopt as true.
(setsockopt): Call print_sockopt_fd_level_name with is_getsockopt as false.
* util.c (printxval): Rename to ...
(printxvals): ... this.  Rewrite to be varargs based.
* xlat/getsockipoptions.in: New xlat list.
* xlat/getsockipv6options.in, xlat/setsockipoptions.in,
xlat/setsockipv6options.in: Likewise.

9 years agoFix build on systems that lack VIDIOC_CREATE_BUFS definition
Dmitry V. Levin [Wed, 26 Aug 2015 11:55:05 +0000 (11:55 +0000)]
Fix build on systems that lack VIDIOC_CREATE_BUFS definition

* v4l2.c (v4l2_ioctl): Check that v4l2_ioctl is defined.

9 years agoFix build on systems that lack EM_ARM/EM_OPENRISC definitions
Dmitry V. Levin [Tue, 25 Aug 2015 21:56:02 +0000 (21:56 +0000)]
Fix build on systems that lack EM_ARM/EM_OPENRISC definitions

* xlat/audit_arch.in: Guard AUDIT_ARCH_ARM and AUDIT_ARCH_ARMEB
with EM_ARM check.  Guard AUDIT_ARCH_OPENRISC with EM_OPENRISC check.

9 years agoFix build on systems that lack UBI_IOCVOLCRBLK/UBI_IOCVOLRMBLK definitions
Dmitry V. Levin [Tue, 25 Aug 2015 21:48:36 +0000 (21:48 +0000)]
Fix build on systems that lack UBI_IOCVOLCRBLK/UBI_IOCVOLRMBLK definitions

* mtd.c (ubi_ioctl): Check that UBI_IOCVOLCRBLK and UBI_IOCVOLRMBLK
are defined.

9 years agoFix build on systems that lack O_CLOEXEC definition
Dmitry V. Levin [Mon, 24 Aug 2015 09:38:03 +0000 (09:38 +0000)]
Fix build on systems that lack O_CLOEXEC definition

* xlat/efd_flags.in: Check that O_CLOEXEC is defined.
* xlat/epollflags.in: Likewise.
* xlat/sfd_flags.in: Likewise.
* xlat/timerfdflags.in: Fix O_CLOEXEC check.

9 years agoprintsiginfo.c: fix integer conversions
Elvira Khabirova [Fri, 21 Aug 2015 17:46:35 +0000 (20:46 +0300)]
printsiginfo.c: fix integer conversions

* printsiginfo.c (printsigsource): Print si_pid and si_uid as unsigned
integers.
(printsigval): Print si_int as signed int.

9 years agoFix decoding of times syscall return value
Dmitry V. Levin [Thu, 20 Aug 2015 21:20:14 +0000 (21:20 +0000)]
Fix decoding of times syscall return value

Always print return value of successful times syscall
as unsigned long integer.

* times.c (sys_times): Return RVAL_UDECIMAL unless syserror.

9 years agomq.c: remove repeated code
Elvira Khabirova [Thu, 20 Aug 2015 18:14:29 +0000 (21:14 +0300)]
mq.c: remove repeated code

* mq.c (sys_mq_open): Use printmqattr instead of implementing it again.
[HAVE_MQUEUE_H]: Remove.

9 years agoipc_msg.c: fix multiple personalities support in msgrcv ipc subcall
Elvira Khabirova [Wed, 19 Aug 2015 03:06:29 +0000 (06:06 +0300)]
ipc_msg.c: fix multiple personalities support in msgrcv ipc subcall

When msgrcv syscall is an ipc subcall, msgp (pointer to struct msgbuf)
and msgtyp (message type) syscall arguments are passed via proxy
structure which definition significantly depends on tracee's
wordsize.

* ipc_msg.c (fetch_msgrcv_args): New function.
(sys_msgrcv): Use it.

9 years agoipc.c: split into separate files
Elvira Khabirova [Wed, 19 Aug 2015 02:06:26 +0000 (05:06 +0300)]
ipc.c: split into separate files

In preparation for upcoming mpers-related changes,
split ipc.c into independent groups of parsers.

* ipc_defs.h: New file.
* ipc_msg.c: Likewise.
* ipc_msgctl.c: Likewise.
* ipc_sem.c: Likewise.
* ipc_shm.c: Likewise.
* ipc_shmctl.c: Likewise.
* mq.c: Likewise.
* print_mq_attr.c: Likewise.
* print_msgbuf.c: Likewise.
* ipc.c: Remove.
(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
sys_mq_getsetattr): Move to mq.c.
(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
to ipc_msg.c.
(sys_msgctl): Move to ipc_msgctl.c.
(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
sys_semget, syssemctl): Move to ipc_sem.c.
(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
(sys_shmctl): Move to ipc_shmctl.c.
(printmqattr): Move to print_mq_attr.c.
(tprint_msgbuf): Move to print_msgbuf.c.
(IPC_64, PRINTCTL): Move to ipc_defs.h.
* defs.h (struct xlat resource_flags): New prototype.
* Makefile.am (strace_SOURCES): Remove ipc.c.  Add ipc_defs.h, mq.c,
ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
print_mq_attr.c, and print_msgbuf.c.

9 years ago.gitignore: add sen.h and sys_func.h
Elvira Khabirova [Thu, 20 Aug 2015 17:32:22 +0000 (20:32 +0300)]
.gitignore: add sen.h and sys_func.h

9 years agotests: add sendfile.test and sendfile64.test
Dmitry V. Levin [Wed, 19 Aug 2015 01:25:39 +0000 (01:25 +0000)]
tests: add sendfile.test and sendfile64.test

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

9 years agosendfile: decode file offset both on entering and exiting syscall
Dmitry V. Levin [Tue, 18 Aug 2015 22:17:52 +0000 (22:17 +0000)]
sendfile: decode file offset both on entering and exiting syscall

When sendfile is called with a valid pointer to a file offset variable,
kernel updates this variable on successfull exit from syscall.

* sendfile.c (sys_sendfile, sys_sendfile64): Print tcp->u_arg[2]
on exiting syscall as well as on entering.

9 years agoio.c: move sendfile parsers to a separate file
Dmitry V. Levin [Tue, 18 Aug 2015 22:09:30 +0000 (22:09 +0000)]
io.c: move sendfile parsers to a separate file

* sendfile.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* io.c (sys_sendfile, sys_sendfile64): Move to sendfile.c

9 years agoMake printnum_* functions return boolean status
Dmitry V. Levin [Tue, 18 Aug 2015 21:57:27 +0000 (21:57 +0000)]
Make printnum_* functions return boolean status

With this change, printnum_* functions return true iff they
successfully fetched necessary data from tracee's memory.

* defs.h (printnum_short, printnum_int, printnum_int64,
printnum_long_int, printpair_int, printpair_int64): Return bool.
* util.c (DEF_PRINTNUM, DEF_PRINTPAIR, printnum_long_int): Likewise.

9 years agomips: print _MIPS_SIM in configure.ac for debug purposes
Dmitry V. Levin [Tue, 18 Aug 2015 22:53:22 +0000 (22:53 +0000)]
mips: print _MIPS_SIM in configure.ac for debug purposes

* configure.ac [MIPS]: Print _MIPS_SIM.

9 years agoxtensa: fix several syscall entries
Dmitry V. Levin [Wed, 19 Aug 2015 13:34:00 +0000 (13:34 +0000)]
xtensa: fix several syscall entries

* linux/xtensa/syscallent.h: Fix nargs in splice, tee, vmsplice,
pselect6, ppoll, epoll_pwait, and set_robust_list syscall entries.

9 years agoia64: fix syscall numbers for set_robust_list, get_robust_list, and splice syscalls
Dmitry V. Levin [Wed, 19 Aug 2015 13:31:42 +0000 (13:31 +0000)]
ia64: fix syscall numbers for set_robust_list, get_robust_list, and splice syscalls

* linux/ia64/syscallent.h: Place syscall entries for set_robust_list,
get_robust_list, and splice in correct order.

9 years agotests: add a test for get_robust_list and set_robust_list decoding
Dmitry V. Levin [Tue, 18 Aug 2015 19:21:36 +0000 (19:21 +0000)]
tests: add a test for get_robust_list and set_robust_list decoding

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

9 years agoSimplify printing of get_robust_list first argument
Dmitry V. Levin [Tue, 18 Aug 2015 18:33:44 +0000 (18:33 +0000)]
Simplify printing of get_robust_list first argument

* get_robust_list.c (sys_get_robust_list): Print first argument
using "%d" format.

9 years agoFix io_setup first argument printing
Elvira Khabirova [Tue, 18 Aug 2015 15:02:20 +0000 (18:02 +0300)]
Fix io_setup first argument printing

* aio.c (sys_io_setup): Print first argument using "%u" format.

9 years agoFix printing tracee's long integers
Dmitry V. Levin [Tue, 18 Aug 2015 14:58:27 +0000 (14:58 +0000)]
Fix printing tracee's long integers

Replace ambiguous printnum_long that used to fetch native long integers
from tracee's memory with printnum_ptr, printnum_slong, and printnum_ulong
that fetch tracee's pointer, signed long, and unsigned long integers.

* defs.h (printnum_long, printpair_long): Remove prototypes.
(printnum_int64, printpair_int64): Remove macros, declare functions
unconditionally.
[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (printnum_long_int):
New prototype.
(printnum_ptr, printnum_slong, printnum_ulong): New macros.
* aio.c (sys_io_setup): Use printnum_ulong.
* block.c (block_ioctl): Use printnum_slong and printnum_ulong.
* get_robust_list.c (sys_get_robust_list): Use printnum_ptr
and printnum_ulong.
* io.c (print_off_t): Remove.
(sys_sendfile): Use printnum_ulong.
* ipc.c (sys_semctl): Use printnum_ptr.
* prctl.c (sys_prctl): Likewise.
* process.c (sys_ptrace): Likewise.
* rtc.c (rtc_ioctl): Use printnum_ulong.
* util.c (printnum_long, printpair_long): Remove.
(printnum_int64, printpair_int64): Define unconditionally.
[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (printnum_long_int):
New function.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Elvira Khabirova <lineprinter0@gmail.com>
9 years agoFix time syscall decoding for some personalities
Dmitry V. Levin [Tue, 18 Aug 2015 13:25:36 +0000 (13:25 +0000)]
Fix time syscall decoding for some personalities

* time.c (current_time_t_is_int32): Define.
(sys_time): Use it, printnum_int, and printnum_int64 instead
of printnum_long.
* tests/time.c: New file.
* tests/time.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add time.
(TESTS): Add time.test.
* tests/.gitignore: Add time.

9 years agosignal: SIGSYS: decode si_syscall & si_arch fields
Mike Frysinger [Tue, 18 Aug 2015 07:24:59 +0000 (03:24 -0400)]
signal: SIGSYS: decode si_syscall & si_arch fields

When receiving SIGSYS, the si_syscall & si_arch fields are set to known
values, so make sure we decode their values into the symbol settings.
This makes stracing seccomp failures much easier.

* defs.h (syscall_name): New prototype.
* printsiginfo.c: Include linux/audit.h and xlat/audit_arch.h.
(print_si_info): Decode si_syscall & si_arch for SIGSYS.
* syscall.c (undefined_scno_name): Delete.
(syscall_name): New function.
(trace_syscall_entering): Change undefined_scno_name to syscall_name.
(trace_syscall_exiting): Likewise.
* xlat/audit_arch.in: New file.

9 years agoipc.c: remove unnecesarry #ifdef IPC_64
Elvira Khabirova [Mon, 17 Aug 2015 19:48:43 +0000 (22:48 +0300)]
ipc.c: remove unnecesarry #ifdef IPC_64

* ipc.c (PRINTCTL): Remove #ifdef IPC_64 check as IPC_64 is always
defined at this point.

9 years agoresource.c: move times parser to a separate file
Elvira Khabirova [Mon, 3 Aug 2015 04:09:34 +0000 (07:09 +0300)]
resource.c: move times parser to a separate file

* times.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* resource.c (sys_times): Move to times.c.

9 years agosysctl.c: remove KERN_JAVA_* defines handling
Elvira Khabirova [Mon, 3 Aug 2015 05:33:44 +0000 (08:33 +0300)]
sysctl.c: remove KERN_JAVA_* defines handling

This has been obsoleted by binfmt_misc since Linux 2.1.43.

* sysctl.c (sys_sysctl): Remove KERN_JAVA_INTERPRETER
and KERN_JAVA_APPLETVIEWER.

9 years agosysinfo.c: remove obsolete code
Elvira Khabirova [Mon, 3 Aug 2015 02:37:52 +0000 (05:37 +0300)]
sysinfo.c: remove obsolete code

struct sysinfo members totalhigh, freehigh and mem_unit are present
since Linux 2.3.48.

* configure.ac (AC_CHECK_MEMBERS): Remove struct sysinfo checks.
* sysinfo.c (sys_sysinfo): Remove HAVE_STRUCT_SYSINFO_* checks.

9 years agotests: add readlink.test and readlinkat.test
Gleb Fotengauer-Malinovskiy [Fri, 14 Aug 2015 15:49:27 +0000 (17:49 +0200)]
tests: add readlink.test and readlinkat.test

* tests/readlink.c: New file.
* tests/readlink.awk: Likewise.
* tests/readlinkat.c: Likewise.
* tests/readlinkat.awk: Likewise.
* tests/readlink.test: New test.
* tests/readlinkat.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add readlink and readlinkat.
(TESTS): Add readlink.test and readlinkat.test.
(EXTRA_DIST): Add readlink.awk and readlinkat.awk.
* tests/.gitignore: Add readlink and readlinkat.

9 years agoPrint nanoseconds along with seconds in stat family syscalls
Dmitry V. Levin [Sat, 8 Aug 2015 12:12:13 +0000 (12:12 +0000)]
Print nanoseconds along with seconds in stat family syscalls

* configure.ac (AC_CHECK_MEMBERS): Add stat.st_atim.tv_nsec,
stat.st_ctim.tv_nsec, stat.st_mtim.tv_nsec, stat.st_atime_nsec,
stat.st_atime_csec, and stat.st_mtime_nsec.
* file.c: Explicitly define HAVE_STRUCT_STAT_ST_ATIME_NSEC,
HAVE_STRUCT_STAT_ST_CTIME_NSEC and HAVE_STRUCT_STAT_ST_MTIME_NSEC
for locally defined types.
* printstat.h (DO_PRINTSTAT): Print st_atime_nsec, st_ctime_nsec,
and st_mtime_nsec members.
* tests/stat.c [_FILE_OFFSET_BITS == 64]: Use st_atime_nsec,
st_ctime_nsec, and st_mtime_nsec via st_atim.tv_nsec, st_ctim.tv_nsec,
and st_mtim.tv_nsec.
(main): Print st_atime_nsec, st_ctime_nsec, and st_mtime_nsec members.

This fixes Fedora bug #1251176.

9 years agosignalfd4: fix flags decoding
Dmitry V. Levin [Mon, 3 Aug 2015 09:47:25 +0000 (09:47 +0000)]
signalfd4: fix flags decoding

* configure.ac (AC_CHECK_FUNCS): Add eventfd.
(AC_CHECK_HEADERS): Add sys/signalfd.h.
* signalfd.c: Include <fcntl.h>.
[HAVE_SYS_SIGNALFD_H] Include <sys/signalfd.h>.
Include "xlat/sfd_flags.h".
(do_signalfd): Use sfd_flags for flags decoding.
* xlat/sfd_flags.in: New file.
* tests/signalfd.c: Likewise.
* tests/signalfd.expected: Likewise.
* tests/signalfd.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add signalfd.
(TESTS): Add signalfd.test.
(EXTRA_DIST): Add signalfd.expected.
* tests/.gitignore: Add signalfd.

9 years agosignalfd, signalfd4: mark return code with RVAL_FD flag
Dmitry V. Levin [Mon, 3 Aug 2015 09:14:28 +0000 (09:14 +0000)]
signalfd, signalfd4: mark return code with RVAL_FD flag

* signalfd.c (do_signalfd): Set RVAL_FD flag in the return code.

9 years agosignal.c: move signalfd parsers to a separate file
Dmitry V. Levin [Mon, 3 Aug 2015 09:12:26 +0000 (09:12 +0000)]
signal.c: move signalfd parsers to a separate file

* signalfd.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* signal.c (do_signalfd, sys_signalfd, sys_signalfd4): Move to signalfd.c

9 years agoperf_event_open: mark return code with RVAL_FD flag
Dmitry V. Levin [Mon, 3 Aug 2015 09:06:59 +0000 (09:06 +0000)]
perf_event_open: mark return code with RVAL_FD flag

* perf.c (sys_perf_event_open): Set RVAL_FD flag in the return code.

9 years agopipe, pipe2, socketpair: print returned descriptors using printfd
Dmitry V. Levin [Sun, 2 Aug 2015 01:54:48 +0000 (01:54 +0000)]
pipe, pipe2, socketpair: print returned descriptors using printfd

* net.c (printpair_fd, decode_pair_fd): New functions.
(do_pipe, sys_socketpair): Use them.

9 years agosocket: mark return code with RVAL_FD flag
Dmitry V. Levin [Sun, 2 Aug 2015 01:41:26 +0000 (01:41 +0000)]
socket: mark return code with RVAL_FD flag

* net.c (sys_socket): Set RVAL_FD flag in the return code.
* tests/net-yy-accept.awk: Update socket and bind regexps.
* tests/unix-yy-accept.awk: Likewise.
* tests/net-yy-connect.awk: Update socket and connect regexps.
* tests/unix-yy-connect.awk: Likewise.

9 years agotimerfd, timerfd_create: mark return code with RVAL_FD flag
Dmitry V. Levin [Sun, 2 Aug 2015 01:37:19 +0000 (01:37 +0000)]
timerfd, timerfd_create: mark return code with RVAL_FD flag

* time.c (sys_timerfd, sys_timerfd_create): Set RVAL_FD flag
in the return code.

9 years agoinotify_init1: mark return code with RVAL_FD flag
Dmitry V. Levin [Sun, 2 Aug 2015 01:34:57 +0000 (01:34 +0000)]
inotify_init1: mark return code with RVAL_FD flag

* inotify.c (sys_inotify_init1): Set RVAL_FD flag in the return code.

9 years agofanotify_init: mark return code with RVAL_FD flag
Dmitry V. Levin [Sun, 2 Aug 2015 01:31:40 +0000 (01:31 +0000)]
fanotify_init: mark return code with RVAL_FD flag

* fanotify.c (sys_fanotify_init): Set RVAL_FD flag in the return code.

9 years agoFix epoll_create syscall decoding
Dmitry V. Levin [Sat, 1 Aug 2015 23:11:43 +0000 (23:11 +0000)]
Fix epoll_create syscall decoding

* epoll.c (sys_epoll_create): New function.
* linux/dummy.h (sys_epoll_create): Remove.

9 years agoepoll_create1: mark return code with RVAL_FD flag
Dmitry V. Levin [Sat, 1 Aug 2015 23:08:39 +0000 (23:08 +0000)]
epoll_create1: mark return code with RVAL_FD flag

* epoll.c (sys_epoll_create1): Set RVAL_FD flag in the return code.

9 years agoepoll_create1: fix pathtrace support
Dmitry V. Levin [Sat, 1 Aug 2015 23:07:19 +0000 (23:07 +0000)]
epoll_create1: fix pathtrace support

* pathtrace.c (pathtrace_match): Add SEN_epoll_create1.

9 years agoepoll_create1: fix flags decoding
Dmitry V. Levin [Sat, 1 Aug 2015 23:04:32 +0000 (23:04 +0000)]
epoll_create1: fix flags decoding

* xlat/epollflags.in: Remove EPOLL_NONBLOCK, provide fallback definition
for EPOLL_CLOEXEC.
* tests/epoll_create1.c: New file.
* tests/epoll_create1.expected: Likewise.
* tests/epoll_create1.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add epoll_create1.
(TESTS): Add epoll_create1.test.
(EXTRA_DIST): Add epoll_create1.expected.
* tests/.gitignore: Add epoll_create1.

9 years agodesc.c: move epoll parsers to a separate file
Dmitry V. Levin [Sat, 1 Aug 2015 22:58:17 +0000 (22:58 +0000)]
desc.c: move epoll parsers to a separate file

* epoll.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* desc.c (sys_epoll_create1, print_epoll_event, sys_epoll_ctl,
print_epoll_event_array, epoll_wait_common, epoll_wait, epoll_pwait):
Move to epoll.c.

9 years agoeventfd2: fix flags decoding
Dmitry V. Levin [Sat, 1 Aug 2015 21:08:13 +0000 (21:08 +0000)]
eventfd2: fix flags decoding

* configure.ac (AC_CHECK_HEADERS): Add sys/eventfd.h.
* eventfd.c: Include <fcntl.h>.
[HAVE_SYS_EVENTFD_H] Include <sys/eventfd.h>.
Include "xlat/efd_flags.h".
(do_eventfd): Use efd_flags for flags decoding.
* xlat/efd_flags.in: New file.
* tests/eventfd.c: New file.
* tests/eventfd.expected: Likewise.
* tests/eventfd.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add eventfd.
(TESTS): Add eventfd.test.
(EXTRA_DIST): Add eventfd.expected.
* tests/.gitignore: Add eventfd.