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