]> granicus.if.org Git - strace/log
strace
8 years agoFix decoding and dumping of readv syscall in case of short read
Dmitry V. Levin [Wed, 20 Jan 2016 00:17:02 +0000 (00:17 +0000)]
Fix decoding and dumping of readv syscall in case of short read

* defs.h (dumpiov_upto): New prototype.
(dumpiov): Change to a wrapper around dumpiov_upto.
* util.c (dumpiov): Rename to dumpiov_upto, add and check data_size
argument.
* io.c (SYS_FUNC(readv)): Call tprint_iov_upto instead
of tprint_iov and specify syscall return value as a data size limit.
* syscall.c (dumpio): In case of SEN_readv, call dumpiov_upto instead
of dumpiov and specify syscall return value as a data size limit.
* NEWS: Mention this fix.
* tests/readv.c: New file.
* tests/readv.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add readv.
(TESTS): Add readv.test.
* tests/.gitignore: Add readv.

8 years agotests/tests.h: add ARRAY_SIZE and LENGTH_OF macros
Dmitry V. Levin [Wed, 20 Jan 2016 05:08:04 +0000 (05:08 +0000)]
tests/tests.h: add ARRAY_SIZE and LENGTH_OF macros

* tests/tests.h (ARRAY_SIZE, LENGTH_OF): New macros.
* tests/aio.c (ARRAY_SIZE): Remove.
* tests/mmsg.c (LENGTH_OF): Remove.

8 years agotests: add hexdump_strdup function to libtests
Dmitry V. Levin [Wed, 20 Jan 2016 05:26:43 +0000 (05:26 +0000)]
tests: add hexdump_strdup function to libtests

* tests/tests.h (hexdump_strdup): New prototype.
* tests/hexdump_strdup.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.

8 years agotests: add tprintf function to libtests
Dmitry V. Levin [Wed, 20 Jan 2016 02:06:59 +0000 (02:06 +0000)]
tests: add tprintf function to libtests

* tests/tests.h (tprintf): New prototype.
* tests/tprintf.c: New file.
* tests/Makefile.am (libtests_a_SOURCES): Add it.
* tests/mmsg.c: Use tprintf.

8 years agoquotactl: add Q_XGETQSTATV command decoding
Dmitry V. Levin [Tue, 19 Jan 2016 21:48:59 +0000 (21:48 +0000)]
quotactl: add Q_XGETQSTATV command decoding

* quota.c (fs_qfilestatv, fs_quota_statv): New structures.
(decode_cmd_data): Handle Q_XGETQSTATV case.

8 years agoquotactl: add decoding of if_dqinfo.dqi_flags constants
Dmitry V. Levin [Tue, 19 Jan 2016 02:10:23 +0000 (02:10 +0000)]
quotactl: add decoding of if_dqinfo.dqi_flags constants

* xlat/if_dqinfo_flags.in: New file.
* quota.c: Include "xlat/if_dqinfo_flags.h".
(decode_cmd_data): Print struct if_dqinfo.dqi_flags using printflags.

8 years agoquotactl: consistenly decode all write and unknown commands on entering
Dmitry V. Levin [Tue, 19 Jan 2016 01:15:49 +0000 (01:15 +0000)]
quotactl: consistenly decode all write and unknown commands on entering

* quota.c (decode_cmd_data): Change return type to int.
Return 0 on entering Q_GETQUOTA, Q_V1_GETQUOTA, Q_V2_GETQUOTA,
Q_XGETQUOTA, Q_GETFMT, Q_GETINFO, Q_V2_GETINFO, Q_V1_GETSTATS,
Q_V2_GETSTATS, and Q_XGETQSTAT commands, return RVAL_DECODED
for any other command.
(SYS_FUNC(quotactl)): On entering, print third argument of any command.
For any command except Q_QUOTAON and Q_V1_QUOTAON, call decode_cmd_data
and forward its return value.

8 years agoquotactl: fix Q_QUOTAON command decoding
Dmitry V. Levin [Mon, 18 Jan 2016 21:53:54 +0000 (21:53 +0000)]
quotactl: fix Q_QUOTAON command decoding

* quota.c (SYS_FUNC(quotactl)): Print Q_QUOTAON 4th argument as a path.

8 years agoquotactl: print third argument as unsigned int
Dmitry V. Levin [Mon, 18 Jan 2016 21:47:04 +0000 (21:47 +0000)]
quotactl: print third argument as unsigned int

* quota.c (SYS_FUNC(quotactl)): Consistently print the third
argument using "%u" format.

8 years agoquotactl: fix Q_XQUOTAOFF command decoding
Dmitry V. Levin [Mon, 18 Jan 2016 21:41:22 +0000 (21:41 +0000)]
quotactl: fix Q_XQUOTAOFF command decoding

* quota.c (decode_cmd_data): Print xfs quota flags argument.

8 years agoquotactl: fix Q_GETFMT and Q_XQUOTAON commands decoding
Dmitry V. Levin [Mon, 18 Jan 2016 21:34:42 +0000 (21:34 +0000)]
quotactl: fix Q_GETFMT and Q_XQUOTAON commands decoding

* quota.c (decode_cmd_data): As quota format value and xfs quota flags
are in-memory constants, print it like an array of one element instead
of a structure.

8 years agoUpdate quotactl constants
Dmitry V. Levin [Sun, 17 Jan 2016 22:30:54 +0000 (22:30 +0000)]
Update quotactl constants

* xlat/quota_formats.in: Add QFMT_OCFS2 and QFMT_VFS_V1.
* xlat/quotacmds.in: Add Q_XGETQSTATV.
* xlat/quotatypes.in: Add PRJQUOTA.
* xlat/xfs_quota_flags.in: Add FS_QUOTA_PDQ_ACCT and FS_QUOTA_PDQ_ENFD.

8 years agoReplace u_int{8,16,32,64} with uint{8,16,32,64}
Dmitry V. Levin [Sat, 16 Jan 2016 22:50:09 +0000 (22:50 +0000)]
Replace u_int{8,16,32,64} with uint{8,16,32,64}

* util.c: Replace u_int{32,64} with uint{32,64}.
* quota.c: Replace u_int{8,16,32,64} with uint{8,16,32,64}.

8 years agoMove definitions of quotactl constants to xlat files
Dmitry V. Levin [Sat, 16 Jan 2016 22:50:09 +0000 (22:50 +0000)]
Move definitions of quotactl constants to xlat files

* quota.c (Q_*): Move to xlat/quotacmds.in.
(USRQUOTA, GRPQUOTA): Move to xlat/quotatypes.in.
(QFMT_VFS_OLD, QFMT_VFS_V0): Move to xlat/quota_formats.in.
(XFS_QUOTA_*): Move to xlat/xfs_quota_flags.in.
(XFS_*_QUOTA): Move to xlat/xfs_dqblk_flags.in.
(QIF_*): Move to xlat/if_dqblk_valid.in.
(IIF_*): Move to xlat/if_dqinfo_valid.in.

8 years agollseek.test: robustify against libcs invoking _llseek syscall on their own
Dmitry V. Levin [Fri, 15 Jan 2016 00:10:00 +0000 (00:10 +0000)]
llseek.test: robustify against libcs invoking _llseek syscall on their own

* tests/llseek.test: Filter out _llseek calls made with non-negative
descriptor arguments.

8 years agolseek.test: robustify against libcs invoking lseek syscall on their own
Dmitry V. Levin [Fri, 15 Jan 2016 00:09:48 +0000 (00:09 +0000)]
lseek.test: robustify against libcs invoking lseek syscall on their own

* tests/lseek.test: Filter out lseek calls made with non-negative
descriptor arguments.

8 years agommsg.test: fix regression introduced by commit v4.11-138-g6e815ce
Dmitry V. Levin [Thu, 14 Jan 2016 00:06:20 +0000 (00:06 +0000)]
mmsg.test: fix regression introduced by commit v4.11-138-g6e815ce

This fixes the test on platforms where both __NR_sendmmsg and
HAVE_SENDMMSG are defined but the former is not implemented by the
kernel and the second is implemented as an indirect syscall.

* tests/mmsg.c (LENGTH_OF): New macro.
(send_mmsg, recv_mmsg): Print expected output in case of ENOSYS.
(main): Redirect stdout to a new descriptor.  Use LENGTH_OF.
Print expected output.
* tests/mmsg.test: Update.
* tests/mmsg.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove mmsg.expected.

8 years agoaio.test: check memory access by aio decoders
Dmitry V. Levin [Wed, 13 Jan 2016 22:06:18 +0000 (22:06 +0000)]
aio.test: check memory access by aio decoders

* tests/aio.c (main): Place all objects passed to io_* syscalls
at the end of memory pages followed by inaccessible pages.

8 years agos390, s390x: fix printing of syscalls unknown to the kernel
Dmitry V. Levin [Wed, 13 Jan 2016 20:53:41 +0000 (20:53 +0000)]
s390, s390x: fix printing of syscalls unknown to the kernel

On s390/s390x, syscalls with NR up to 255 can be implemented
directly using "svc NR", for NR >= 256 "svc 0" with %r1=NR is used.
The latter method is allowed for NR < 256, too.

When the syscall number specified directly or indirectly is recognized
by the kernel, i.e. it is less than its NR_syscalls value, it is stored
in %r2 and is available to arch_get_scno via s390_regset.gprs[2].
For syscall numbers >= NR_syscalls this register is set to 0,
but %r1 remains unchanged and could be used by arch_get_scno
via s390_regset.gprs[1] to decide what the syscall number is.

* linux/s390/get_scno.c (arch_get_scno): If s390_regset.gprs[2] is zero,
take syscall number from s390_regset.gprs[1].
* NEWS: Mention this fix.

This fixes Debian bug #485979 and Fedora bug #1298294.

8 years agos390, s390x: print all syscall arguments for syscall number 0
Dmitry V. Levin [Wed, 13 Jan 2016 20:51:42 +0000 (20:51 +0000)]
s390, s390x: print all syscall arguments for syscall number 0

* linux/s390/syscallent.h [0]: Set nargs to MA.
* linux/s390x/syscallent.h: Likewise.

8 years agomips o32: alias sys_syscall to printargs
Dmitry V. Levin [Wed, 13 Jan 2016 20:47:52 +0000 (20:47 +0000)]
mips o32: alias sys_syscall to printargs

* linux/dummy.h (sys_syscall): Alias to printargs.
* syscall.c [LINUX_MIPSO32] (SYS_FUNC(syscall)): Remove.

8 years agotravis-ci: update build matrix
Dmitry V. Levin [Wed, 13 Jan 2016 12:12:33 +0000 (12:12 +0000)]
travis-ci: update build matrix

Add clang-3.6/x86_64, clang-3.6/x86, and musl-gcc/x86_64 to the matrix.

* .travis.yml (compiler): Add gcc, clang-3.6, and musl-gcc.
(env): Add matrix, remove global ENABLE_GCC_WERROR.
(matrix): Add exclude, remove include.
* travis-ci.sh: Add support for clang and musl-gcc.
Use --enable-gcc-Werror for gcc build unconditionally.

8 years agompers.awk: add support for DWARF files generated by clang
Dmitry V. Levin [Wed, 13 Jan 2016 02:31:12 +0000 (02:31 +0000)]
mpers.awk: add support for DWARF files generated by clang

* mpers.awk: Define default_pointer_size.  Initialize byte_size
for DW_TAG_pointer_type to default_pointer_size.  Set parent
for DW_TAG_member only.  Handle DW_AT_count as an alternative
to DW_AT_upper_bound.

8 years agoconfigure.ac: reorder some statements for better readability
Dmitry V. Levin [Tue, 12 Jan 2016 21:27:36 +0000 (21:27 +0000)]
configure.ac: reorder some statements for better readability

* configure.ac: Sort and group together AC_PROG_*, AC_C_*, AC_TYPE_*,
AC_HEADER_*, AC_CHECK_FUNCS, AC_CHECK_TYPES, AC_CHECK_MEMBERS,
and AC_CHECK_HEADERS.

8 years agoscm_rights-fd.test: rewrite without fork
Dmitry V. Levin [Tue, 12 Jan 2016 14:47:12 +0000 (14:47 +0000)]
scm_rights-fd.test: rewrite without fork

* tests/scm_rights.c (main): Rewrite without fork.
Place all objects passed to sendmsg and recvmsg at the end
of memory pages followed by inaccessible pages.
* tests/scm_rights-fd.test: Update.

8 years agotests: fix clang "duplicate 'const' declaration specifier" warnings
Dmitry V. Levin [Tue, 12 Jan 2016 05:02:08 +0000 (05:02 +0000)]
tests: fix clang "duplicate 'const' declaration specifier" warnings

* tests/ksysent.c (pstr_t): Remove second const specifier.
* tests/mmsg.c (main): Remove second const specifier from one[], two[],
and three[].

8 years agotests/times.c: fix clang compilation warning
Dmitry V. Levin [Tue, 12 Jan 2016 04:27:22 +0000 (04:27 +0000)]
tests/times.c: fix clang compilation warning

* tests/times.c (main): Initialize dummy variable.

8 years agotests/mmsg.c: fix build on rhel6/ppc
Dmitry V. Levin [Tue, 12 Jan 2016 04:37:06 +0000 (04:37 +0000)]
tests/mmsg.c: fix build on rhel6/ppc

There are weird platforms that define __NR_sendmmsg but at the same time
do not define __NR_recvmmsg.  Add a workaround for them.

* configure.ac (AC_CHECK_FUNCS): Add recvmmsg.
* tests/mmsg.c: Check for __NR_recvmmsg || HAVE_RECVMMSG.

8 years agos390: fix sigreturn decoding on recent kernels
Dmitry V. Levin [Tue, 12 Jan 2016 02:52:16 +0000 (02:52 +0000)]
s390: fix sigreturn decoding on recent kernels

Linux kernel commit v4.3-rc1-50-g8d4bd0e corrected uc_sigmask
of the compat signal frame, so remove the old workaround.

* linux/s390/arch_sigreturn.c (arch_sigreturn) [S390]: Remove.

8 years agoUpdate PTRACE_* constants
Dmitry V. Levin [Tue, 12 Jan 2016 02:04:44 +0000 (02:04 +0000)]
Update PTRACE_* constants

* ptrace.h (PTRACE_SECCOMP_GET_FILTER): Define.
* xlat/ptrace_cmds.in: Add PTRACE_SECCOMP_GET_FILTER.

8 years agoFix struct sigevent decoding for musl
Dmitry V. Levin [Tue, 12 Jan 2016 01:13:48 +0000 (01:13 +0000)]
Fix struct sigevent decoding for musl

Do not rely on "struct sigevent.__pad" being located at the same address
as "struct sigevent.sigev_notify_thread_id", it's not the case with musl
libc.  Do not rely on struct sigevent definition at all to access
sigev_notify_thread_id.

* configure.ac (AC_CHECK_MEMBERS): Remove struct sigevent._sigev_un._pad
and struct sigevent.__pad.
* sigevent.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* print_sigevent.c: Include it.
* print_sigevent.c (struct_sigevent): Remove.
(print_sigevent): Update all struct_sigevent users.
* tests/timer_create.c: Include "sigevent.h".
(main): Use struct_sigevent instead of struct sigevent,
all struct sigevent clients changed.

8 years agosyscall.c: include <signal.h>
Dmitry V. Levin [Tue, 12 Jan 2016 00:04:30 +0000 (00:04 +0000)]
syscall.c: include <signal.h>

All users of NSIG macro must include <signal.h>.
This complements commit v4.10-184-g0e946ab.

* syscall.c: Include <signal.h>.

8 years agosignal.c: fix musl libc compilation warning
Dmitry V. Levin [Tue, 12 Jan 2016 00:04:15 +0000 (00:04 +0000)]
signal.c: fix musl libc compilation warning

musl libc defines SIGRTMAX to a function that returns signed int,
which obviously makes gcc -Wsign-compare unhappy.

* signal.c (signame): Cast ASM_SIGRTMAX to unsigned int.

8 years agotests: fix TEST_SYSCALL_{NR,STR} and STRUCT_STAT_STR macros for musl
Dmitry V. Levin [Tue, 12 Jan 2016 00:03:41 +0000 (00:03 +0000)]
tests: fix TEST_SYSCALL_{NR,STR} and STRUCT_STAT_STR macros for musl

The contents of TEST_SYSCALL_NAME and STRUCT_STAT macros was subject
to macro expansion when used in definitions of TEST_SYSCALL_NR,
TEST_SYSCALL_STR, and STRUCT_STAT_STR macros.

As some libcs, e.g. musl libc, define lfs64 names as macros
(stat64 as stat, lstat64 as lstat, etc.), this might result to incorrect
expansion of TEST_SYSCALL_NR, TEST_SYSCALL_STR, and STRUCT_STAT_STR
macros.  To avoid this problem, define these macros directly and remove
TEST_SYSCALL_NAME macro.

* tests/_newselect.c (TEST_SYSCALL_NAME): Remove.
(TEST_SYSCALL_NR, TEST_SYSCALL_STR): New macros.
* tests/fcntl.c: Likewise.
* tests/fcntl64.c: Likewise.
* tests/fstat.c: Likewise.
* tests/fstatat64.c: Likewise.
* tests/lstat.c: Likewise.
* tests/newfstatat.c: Likewise.
* tests/select.c: Likewise.
* tests/stat.c: Likewise.
* tests/fstat64.c (TEST_SYSCALL_NAME): Remove.
(TEST_SYSCALL_NR, TEST_SYSCALL_STR, STRUCT_STAT_STR): New macros.
* tests/lstat64.c: Likewise.
* tests/stat64.c: Likewise.
* tests/fstatx.c (TEST_SYSCALL_NR, nrify, nrify_): Remove.
* tests/lstatx.c: Likewise.
* tests/struct_flock.c (TEST_SYSCALL_NR, TEST_SYSCALL_STR, nrify,
nrify_, stringify, stringify_): Remove.
* tests/xselect.c: Likewise.
* tests/xstatx.c: Check TEST_SYSCALL_STR instead of TEST_SYSCALL_NAME.
(STRUCT_STAT_STR, TEST_SYSCALL_STR, stringify, stringify_): Remove.
[!STRUCT_STAT] (STRUCT_STAT_STR): New macro.

8 years agotests/struct_flock.c: fix musl libc compilation warnings
Dmitry V. Levin [Tue, 12 Jan 2016 00:02:56 +0000 (00:02 +0000)]
tests/struct_flock.c: fix musl libc compilation warnings

The size of off_t is not something one can rely upon.  For example,
musl libc unconditionally defines it as an int64_t type on x86.
A cast to the target type helps to avoid these libc differences.

* configure.ac: Call AC_C_TYPEOF.
* tests/struct_flock.c (TYPEOF_FLOCK_OFF_T): New macro.
(test_flock_einval): Use it instead of off_t.

8 years agotests/inet-cmsg.c: fix musl libc compilation warnings
Dmitry V. Levin [Tue, 12 Jan 2016 00:00:47 +0000 (00:00 +0000)]
tests/inet-cmsg.c: fix musl libc compilation warnings

The types that are used to define msg_namelen member of struct msghdr
and cmsg_len member of struct cmsghdr differ between libcs.
For example, glibc defines them as size_t, while musl libc - as type
socklen_t.  Print these fields using %lu format to avoid issues caused
by libc differences.

* tests/inet-cmsg.c (main): Cast mh.msg_controllen and c->cmsg_len
to unsigned long and print them using %lu format.

8 years agoaio.test: include <fcntl.h> instead of <sys/fcntl.h>
Dmitry V. Levin [Mon, 11 Jan 2016 02:20:04 +0000 (02:20 +0000)]
aio.test: include <fcntl.h> instead of <sys/fcntl.h>

* tests/aio.c: Include <fcntl.h> instead of <sys/fcntl.h>.

8 years agommsg.test: check memory access by sendmmsg and recvmmsg decoders
Dmitry V. Levin [Mon, 11 Jan 2016 00:17:36 +0000 (00:17 +0000)]
mmsg.test: check memory access by sendmmsg and recvmmsg decoders

* tests/tests.h (tail_memdup): New prototype.
* tests/tail_alloc.c (tail_memdup): New function.
* tests/mmsg.c (main): Place all objects passed to sendmmsg and recvmmsg
at the end of memory pages followed by inaccessible pages.

8 years agommsg.test: check decoding of flags passed to sendmmsg and recvmmsg
Dmitry V. Levin [Mon, 11 Jan 2016 00:17:13 +0000 (00:17 +0000)]
mmsg.test: check decoding of flags passed to sendmmsg and recvmmsg

* tests/mmsg.c (main): Pass MSG_DONTROUTE|MSG_NOSIGNAL to sendmmsg.
Pass MSG_DONTWAIT to recvmmsg.
* tests/mmsg.expected: Update.

8 years agommsg.test: prefer direct sendmmsg/recvmmsg syscalls to libc wrappers
Dmitry V. Levin [Mon, 11 Jan 2016 00:16:39 +0000 (00:16 +0000)]
mmsg.test: prefer direct sendmmsg/recvmmsg syscalls to libc wrappers

* tests/mmsg.c: Include <sys/syscall.h>.
Check for __NR_sendmmsg as an alternative to HAVE_SENDMMSG.
[!HAVE_STRUCT_MMSGHDR] (struct mmsghdr): Define.
(send_mmsg, recv_mmsg): New functions.
(main): Use them instead of sendmmsg and recvmmsg.

Reported-by: Szabolcs Nagy <nsz@port70.net>
8 years agosigreturn.test: use RT_5 signal number instead of RT_2
Dmitry V. Levin [Sun, 10 Jan 2016 22:48:51 +0000 (22:48 +0000)]
sigreturn.test: use RT_5 signal number instead of RT_2

Make the test compatible with musl libc that uses RT_2 internally.

* tests/sigreturn.c (main): Replace RT_2 with RT_5.
* tests/sigreturn.test: Likewise.

Reported-by: Szabolcs Nagy <nsz@port70.net>
8 years agoavr32: wire up accept4 syscall
Dmitry V. Levin [Sun, 10 Jan 2016 21:38:03 +0000 (21:38 +0000)]
avr32: wire up accept4 syscall

* linux/avr32/syscallent.h [321]: Add accept4 entry.

8 years agosparc64: fix names of {s,g}etres{u,g}id syscalls
Dmitry V. Levin [Sat, 9 Jan 2016 22:54:53 +0000 (22:54 +0000)]
sparc64: fix names of {s,g}etres{u,g}id syscalls

* linux/sparc64/syscallent.h [108 ... 111]: Use sparc64 syscall names.

8 years agosparc64: remove sparc32 syscall entries
Dmitry V. Levin [Sat, 9 Jan 2016 22:49:09 +0000 (22:49 +0000)]
sparc64: remove sparc32 syscall entries

* linux/sparc64/syscallent.h [31, 32, 35, 44, 53, 56, 69, 70, 72, 77,
82, 84, 87, 89, 91, 94, 112, 115, 155, 231]: Unassign.

8 years agosparc: remove sparc64 syscall entries
Dmitry V. Levin [Sat, 9 Jan 2016 22:47:25 +0000 (22:47 +0000)]
sparc: remove sparc64 syscall entries

* linux/sparc/syscallent.h [52, 163]: Unassign.

8 years agosparc64: clone syscallent.h from sparc
Dmitry V. Levin [Sat, 9 Jan 2016 22:44:00 +0000 (22:44 +0000)]
sparc64: clone syscallent.h from sparc

* linux/sparc64/syscallent.h: Clone from linux/sparc/syscallent.h.

8 years agosparc: fix mlock2 sysentry, wire up bind, listen, and setsockopt syscalls
Dmitry V. Levin [Sat, 9 Jan 2016 21:50:30 +0000 (21:50 +0000)]
sparc: fix mlock2 sysentry, wire up bind, listen, and setsockopt syscalls

* linux/sparc/syscallent.h [353]: Move mlock2 entry to 356.
[353, 354, 355]: Add bind, listen, and setsockopt entries.
* NEWS: Mention this.

8 years agotests: do not use settimeofday wrapper provided by libc
Dmitry V. Levin [Sat, 9 Jan 2016 01:47:42 +0000 (01:47 +0000)]
tests: do not use settimeofday wrapper provided by libc

Workaround limitations of settimeofday wrapper provided by musl libc.

* tests/xettimeofday.c (main): Call settimeofday using syscall().

Reported-by: Szabolcs Nagy <nsz@port70.net>
8 years agoioctl.test: robustify against libcs invoking ioctl syscall on their own
Dmitry V. Levin [Sat, 9 Jan 2016 01:36:54 +0000 (01:36 +0000)]
ioctl.test: robustify against libcs invoking ioctl syscall on their own

* tests/ioctl.test: Filter out from the log ioctl calls with standard
descriptor arguments.

Reported-by: Szabolcs Nagy <nsz@port70.net>
8 years agoalpha: enhance decoding of getxpid, getxuid, and getxgid syscalls
Dmitry V. Levin [Sat, 9 Jan 2016 00:06:06 +0000 (00:06 +0000)]
alpha: enhance decoding of getxpid, getxuid, and getxgid syscalls

Print the second return value of getxpid, getxuid, and getxgid syscalls
that return a pair of values using the same mechanism as pipe syscall.

* alpha.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/alpha/syscallent.h [20]: Change SEN(getpid) to SEN(getxpid).
[24]: Change SEN(getuid) to SEN(getxuid).
[47]: Change SEN(getgid) to SEN(getxgid).
* NEWS: Mention this enhancement.
* tests/uid.awk: Update for getxgid output change.
* tests/uid.test: Cleanup.
* tests/getxxid.c: New file.
* tests/getxxid.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add getxxid.
(TESTS): Add getxxid.test.
* tests/.gitignore: Add getxxid.

8 years agoCleanup parser of getpagesize syscall
Dmitry V. Levin [Fri, 8 Jan 2016 19:20:05 +0000 (19:20 +0000)]
Cleanup parser of getpagesize syscall

* mem.c (SYS_FUNC(getpagesize)): Decode on entering syscall.

8 years agoalpha: alias getdtablesize to printargs
Dmitry V. Levin [Fri, 8 Jan 2016 18:52:05 +0000 (18:52 +0000)]
alpha: alias getdtablesize to printargs

* linux/dummy.h [ALPHA] (sys_getdtablesize): Alias to printargs.
* desc.c [ALPHA] (SYS_FUNC(getdtablesize)): Remove.

8 years agotests: change text marker in fork-f and vfork-f tests
Dmitry V. Levin [Fri, 8 Jan 2016 00:44:04 +0000 (00:44 +0000)]
tests: change text marker in fork-f and vfork-f tests

Use chdir syscalls instead of pwrite64 syscalls as a method of inserting
text markers into strace output because the former are more portable.

* tests/fork-f.c (logit): Rename to logit_. Use chdir instead of pwrite.
(logit): New macro wrapper around logit_.
(main): Update expected output.
* tests/vfork-f.c: Likewise.
* tests/fork-f.test: Update.

8 years agoFix printing of 32-bit times syscall return value on 64-bit architectures
Dmitry V. Levin [Thu, 7 Jan 2016 14:20:17 +0000 (14:20 +0000)]
Fix printing of 32-bit times syscall return value on 64-bit architectures

This change complements commit v4.9-359-gd93d9f8 by fixing
RVAL_UDECIMAL case.
The only syscall that appears to be affected is the times syscall.

* syscall.c (trace_syscall_exiting): In case of RVAL_UDECIMAL,
when current personality is 32-bit, print 32-bit return code.
* NEWS: Mention this fix.

Reported-by: Steve McIntyre <steve@einval.com>
8 years agotests/vfork-f.c: support platforms without vfork
Dmitry V. Levin [Thu, 7 Jan 2016 01:42:05 +0000 (01:42 +0000)]
tests/vfork-f.c: support platforms without vfork

On some platforms, e.g. hppa glibc, vfork() is implemented using fork
syscall, so the test cannot rely on the parent process remaining blocked
until the child process either terminates or calls execve.

* tests/vfork-f.c (main): Explicitly block the parent until the child
either terminates or calls execve.

8 years agoFix and enhance decoding of sched_[gs]etaffinity syscalls
Dmitry V. Levin [Thu, 7 Jan 2016 00:31:33 +0000 (00:31 +0000)]
Fix and enhance decoding of sched_[gs]etaffinity syscalls

Print cpu_set_t as a set of integers, similar to the way
fd_set is printed as a set of descriptors.

* affinity.c: Include <sched.h>.
(get_cpuset_size): New function.
(print_affinitylist): Rewrite using get_cpuset_size and next_set_bit.
(sched_getaffinity, sched_setaffinity): Print first two args as ints.
* NEWS: Mention this enhancement.
* tests/sched_xetaffinity.c: New file.
* tests/sched_xetaffinity.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add sched_xetaffinity.
(TESTS): Add sched_xetaffinity.test.
* tests/.gitignore: Add sched_xetaffinity.

Reported-by: Joe Korty <joe.korty@ccur.com>
8 years agotests: convert epoll_create1.test from match_grep to match_diff
Dmitry V. Levin [Wed, 6 Jan 2016 16:08:07 +0000 (16:08 +0000)]
tests: convert epoll_create1.test from match_grep to match_diff

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

8 years agotests/struct_flock.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 16:03:23 +0000 (16:03 +0000)]
tests/struct_flock.c: use libtests

* tests/struct_flock.c (create_sample): Return void,
all callers changed.  Use perror_msg_and_fail.
* tests/fcntl.c: Use SKIP_MAIN_UNDEFINED.
* tests/fcntl64.c: Likewise.

8 years agotests/file_handle.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 16:01:46 +0000 (16:01 +0000)]
tests/file_handle.c: use libtests

* tests/file_handle.c: Use SKIP_MAIN_UNDEFINED.
(main): Use assert and perror_msg_and_skip.

8 years agotests/uid32.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 15:58:14 +0000 (15:58 +0000)]
tests/uid32.c: use libtests

* tests/uid32.c: Use SKIP_MAIN_UNDEFINED.

8 years agotests/uid16.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 15:57:45 +0000 (15:57 +0000)]
tests/uid16.c: use libtests

* tests/uid16.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

8 years agotests/uid.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 15:57:17 +0000 (15:57 +0000)]
tests/uid.c: use libtests

* tests/uid.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

8 years agotests/netlink_unix_diag.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 15:55:12 +0000 (15:55 +0000)]
tests/netlink_unix_diag.c: use libtests

* tests/netlink_unix_diag.c (send_query, check_responses, main):
Use perror_msg_and_skip.

8 years agotests/netlink_inet_diag.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 15:53:45 +0000 (15:53 +0000)]
tests/netlink_inet_diag.c: use libtests

* tests/netlink_inet_diag.c (send_query, check_responses, main):
Use perror_msg_and_skip.

8 years agotests/readdir.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 12:03:57 +0000 (12:03 +0000)]
tests/readdir.c: use libtests

* tests/readdir.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

8 years agotests/getdents64.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 12:03:37 +0000 (12:03 +0000)]
tests/getdents64.c: use libtests

* tests/getdents64.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

8 years agotests/getdents.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 12:02:55 +0000 (12:02 +0000)]
tests/getdents.c: use libtests

* tests/getdents.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

8 years agotests/ipc_shm.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:59:58 +0000 (11:59 +0000)]
tests/ipc_shm.c: use libtests

* tests/ipc_shm.c (cleanup): New function.
(main): Use it and perror_msg_and_skip.

8 years agotests/ipc_sem.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:59:29 +0000 (11:59 +0000)]
tests/ipc_sem.c: use libtests

* tests/ipc_sem.c (cleanup): New function.
(main): Use it and perror_msg_and_skip.

8 years agotests/ipc_msg.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:59:06 +0000 (11:59 +0000)]
tests/ipc_msg.c: use libtests

* tests/ipc_msg.c (cleanup): New function.
(main): Use it and perror_msg_and_skip.

8 years agotests/ipc_msgbuf.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:55:13 +0000 (11:55 +0000)]
tests/ipc_msgbuf.c: use libtests

* tests/ipc_msgbuf.c (cleanup): New function.
(main): Use it and perror_msg_and_skip.

8 years agotests/mq.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:52:43 +0000 (11:52 +0000)]
tests/mq.c: use libtests

* tests/mq.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

8 years agotests/utimensat.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:49:27 +0000 (11:49 +0000)]
tests/utimensat.c: use libtests

* tests/utimensat.c: Use SKIP_MAIN_UNDEFINED.
(main): Use assert and perror_msg_and_skip.

8 years agotests/ppoll.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:44:32 +0000 (11:44 +0000)]
tests/ppoll.c: use libtests

* tests/ppoll.c (main): Use assert, perror_msg_and_skip,
and perror_msg_and_fail.

8 years agotests/mmsg.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:43:08 +0000 (11:43 +0000)]
tests/mmsg.c: use libtests

* tests/mmsg.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

8 years agotests/ip_mreq.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:42:10 +0000 (11:42 +0000)]
tests/ip_mreq.c: use libtests

* tests/ip_mreq.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

8 years agotests/ioctl.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:40:00 +0000 (11:40 +0000)]
tests/ioctl.c: use libtests

* tests/ioctl.c: Use SKIP_MAIN_UNDEFINED.
(main): Use %m printf format specifier.

8 years agotests/pipe.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:38:05 +0000 (11:38 +0000)]
tests/pipe.c: use libtests

* tests/pipe.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_fail and perror_msg_and_skip.

8 years agotests/getrandom.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:36:54 +0000 (11:36 +0000)]
tests/getrandom.c: use libtests

* tests/getrandom.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

8 years agotests/signalfd.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:35:23 +0000 (11:35 +0000)]
tests/signalfd.c: use libtests

* tests/signalfd.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

8 years agotests/pc.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:33:13 +0000 (11:33 +0000)]
tests/pc.c: use libtests

* tests/pc.c (main): Use assert, get_page_size, perror_msg_and_fail,
and perror_msg_and_skip.

8 years agotests/uio.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:31:48 +0000 (11:31 +0000)]
tests/uio.c: use libtests

* tests/uio.c: Use SKIP_MAIN_UNDEFINED.

8 years agotests/bpf.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:29:16 +0000 (11:29 +0000)]
tests/bpf.c: use libtests

* tests/bpf.c: Use SKIP_MAIN_UNDEFINED.
(main) Use perror_msg_and_skip.

8 years agotests/aio.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:27:15 +0000 (11:27 +0000)]
tests/aio.c: use libtests

* tests/aio.c: Use SKIP_MAIN_UNDEFINED.
(main) Use perror_msg_and_skip.

8 years agotests/sched_xetattr.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:25:47 +0000 (11:25 +0000)]
tests/sched_xetattr.c: use libtests

* tests/sched_xetattr.c: Use SKIP_MAIN_UNDEFINED.
(main) Use perror_msg_and_skip.

8 years agotests/wait.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:23:21 +0000 (11:23 +0000)]
tests/wait.c: use libtests

* tests/wait.c (main): Use perror_msg_and_fail.

8 years agotests/vfork-f.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:22:59 +0000 (11:22 +0000)]
tests/vfork-f.c: use libtests

* tests/vfork-f.c (main): Use assert and perror_msg_and_fail.

8 years agotests/fork-f.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 11:22:25 +0000 (11:22 +0000)]
tests/fork-f.c: use libtests

* tests/fork-f.c (main): Use assert and perror_msg_and_fail.

8 years agotests/userfaultfd.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 10:01:20 +0000 (10:01 +0000)]
tests/userfaultfd.c: use libtests

* tests/userfaultfd.c: Use SKIP_MAIN_UNDEFINED.
(main): Use assert.

8 years agotests/mlock2.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 10:00:44 +0000 (10:00 +0000)]
tests/mlock2.c: use libtests

* tests/mlock2.c: Use SKIP_MAIN_UNDEFINED.
(main): Use assert.

8 years agotests/membarrier.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 09:59:46 +0000 (09:59 +0000)]
tests/membarrier.c: use libtests

* tests/membarrier.c: Use SKIP_MAIN_UNDEFINED.
(main): Use assert.

8 years agotests/nanosleep.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 09:56:09 +0000 (09:56 +0000)]
tests/nanosleep.c: use libtests

* tests/nanosleep.c (main): Use assert, perror_msg_and_fail,
and perror_msg_and_skip.

8 years agotests/timerfd_xettime.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 09:51:37 +0000 (09:51 +0000)]
tests/timerfd_xettime.c: use libtests

* tests/timerfd_xettime.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

8 years agotests/timer_xettime.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 09:50:44 +0000 (09:50 +0000)]
tests/timer_xettime.c: use libtests

* tests/timer_xettime.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

8 years agotests/timer_create.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 09:49:32 +0000 (09:49 +0000)]
tests/timer_create.c: use libtests

* tests/timer_create.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

8 years agotests/clock_xettime.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 09:48:05 +0000 (09:48 +0000)]
tests/clock_xettime.c: use libtests

* tests/clock_xettime.c: Use SKIP_MAIN_UNDEFINED.
(main): Use perror_msg_and_skip.

8 years agotests/clock_nanosleep.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 09:46:29 +0000 (09:46 +0000)]
tests/clock_nanosleep.c: use libtests

* tests/clock_nanosleep.c (main): Use assert and perror_msg_and_skip.

8 years agotests/truncate64.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 09:36:00 +0000 (09:36 +0000)]
tests/truncate64.c: use libtests

* tests/truncate64.c: Use SKIP_MAIN_UNDEFINED.
(main): Use assert and perror_msg_and_skip.

8 years agotests/truncate.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 09:35:39 +0000 (09:35 +0000)]
tests/truncate.c: use libtests

* tests/truncate.c: Use SKIP_MAIN_UNDEFINED.
(main): Use assert and perror_msg_and_skip.

8 years agotests/ftruncate64.c: use libtests
Dmitry V. Levin [Wed, 6 Jan 2016 09:35:23 +0000 (09:35 +0000)]
tests/ftruncate64.c: use libtests

* tests/ftruncate64.c: Use SKIP_MAIN_UNDEFINED.
(main): Use assert and perror_msg_and_skip.