]>
granicus.if.org Git - strace/log
Dmitry V. Levin [Sun, 22 Nov 2015 21:29:32 +0000 (21:29 +0000)]
Implement name_to_handle_at and open_by_handle_at syscalls decoding
* file_handle.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_name_to_handle_at, sys_open_by_handle_at):
Remove stub aliases.
* pathtrace.c (pathtrace_match): Add SEN_name_to_handle_at.
* tests/file_handle.c: New file.
* tests/file_handle.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add file_handle.
(TESTS): Add file_handle.test.
* tests/.gitignore: Add file_handle.
Dmitry V. Levin [Sun, 22 Nov 2015 19:28:17 +0000 (19:28 +0000)]
Implement lookup_dcookie syscall decoding
* lookup_dcookie.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_lookup_dcookie): Remove stub alias.
Dmitry V. Levin [Sun, 22 Nov 2015 18:51:05 +0000 (18:51 +0000)]
Implement kexec_file_load syscall decoding
* xlat/kexec_file_load_flags.in: New file.
* kexec.c: Include "xlat/kexec_file_load_flags.h".
(SYS_FUNC(kexec_file_load)): New function.
* linux/dummy.h (sys_kexec_file_load): Remove stub alias.
* pathtrace.c (pathtrace_match): Add SEN_kexec_file_load.
Dmitry V. Levin [Sun, 22 Nov 2015 18:35:27 +0000 (18:35 +0000)]
Implement kcmp syscall decoding
* kcmp.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_kcmp): Remove stub alias.
* xlat/kcmp_types.in: New file.
Dmitry V. Levin [Sun, 22 Nov 2015 18:21:54 +0000 (18:21 +0000)]
Implement iopl syscall decoding
* iopl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_iopl): Remove stub alias.
Dmitry V. Levin [Sun, 22 Nov 2015 18:18:43 +0000 (18:18 +0000)]
Implement ioperm syscall decoding
* ioperm.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_ioperm): Remove stub alias.
Dmitry V. Levin [Sun, 22 Nov 2015 23:07:52 +0000 (23:07 +0000)]
net: fix printing of IP_RECVOPTS/IP_RETOPTS cmsg options
* net.c (print_cmsg_ip_opts): Print each byte as unsigned char.
Dmitry V. Levin [Sun, 22 Nov 2015 19:56:00 +0000 (19:56 +0000)]
userfaultfd: fix pathtrace support
* pathtrace.c (pathtrace_match): Add SEN_userfaultfd.
Dmitry V. Levin [Sat, 21 Nov 2015 00:03:54 +0000 (03:03 +0300)]
Implement IPPROTO_IP control messages decoding
* net.c: Include "xlat/ip_cmsg_types.h".
(print_cmsg_ip_pktinfo, print_cmsg_ip_ttl, print_cmsg_ip_tos,
print_cmsg_ip_opts, print_cmsg_ip_recverr, print_cmsg_ip_checksum,
print_cmsg_ip_origdstaddr): New functions.
(print_cmsg_type_data): Add generic SOL_IP level decoding.
Use these functions for decoding of IP_PKTINFO, IP_TTL, IP_TOS,
IP_RECVOPTS, IP_RETOPTS, IP_RECVERR, IP_ORIGDSTADDR, IP_CHECKSUM,
and SCM_SECURITY type messages.
* xlat/ip_cmsg_types.in: New file.
* xlat/sockipoptions.in: Move IP_RETOPTS before IP_RECVRETOPTS.
* tests/inet-cmsg.c: New file.
* tests/inet-cmsg.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add inet-cmsg.
(TESTS): Add inet-cmsg.test.
* tests/.gitignore: Add inet-cmsg.
Suggested-by: Orion Poplawski <orion@cora.nwra.com>
Dmitry V. Levin [Sat, 21 Nov 2015 03:59:09 +0000 (03:59 +0000)]
Simplify control messages printers
Do not pass sizeof(struct cmsghdr) to every cmsg printer.
* net.c (printcmsghdr): Pass pointer to cmsg_data and length
of cmsg_data to print_cmsg_type_data.
(print_cmsg_type_data): Update prototype. Pass pointer to cmsg_data
and length of cmsg_data to cmsg printers.
(print_scm_rights, print_scm_creds, print_scm_security): Update.
Dmitry V. Levin [Sat, 21 Nov 2015 02:38:59 +0000 (02:38 +0000)]
net: factor out address printing code to a separate function
* net.c (sockaddr_buf_t): New type.
(print_sockaddr): New function.
(printsock, print_group_req): Use it.
Dmitry V. Levin [Fri, 20 Nov 2015 01:43:12 +0000 (01:43 +0000)]
mpers: skip xlat struct definitions in mpers mode
Avoid duplicate definitions of xlat structures in files
compiled in mpers mode.
Each xlat file defines the corresponding xlat struct with
either global or local visibility using the following rules:
- if xlat struct declaration is available in defs.h,
a global definition is provided in regular mode,
and nothing is provided in mpers mode;
- otherwise, if xlat file is included by a mpers source file,
a global definition is provided in regular mode
(unless no mpers mode is supported on this architecture,
in that case, a local definition is provided instead),
and a declaration is provided in mpers mode;
- otherwise, a local definition is provided in regular mode,
and an error message is printed in mpers mode.
Fallback definitions of constants provided by xlat files
remain available in all modes.
* bootstrap: Invoke generate_mpers_am.sh before xlat/gen.sh.
* defs.h (adjtimex_modes, adjtimex_status, sigev_value): Remove.
* generate_mpers_am.sh: Generate mpers_xlat.h.
* Makefile.am (EXTRA_DIST): Add mpers_xlat.h.
* print_sigevent.c: Include "xlat/sigev_value.h" unconditionally.
* print_timex.c: Include "xlat/adjtimex_modes.h" and
"xlat/adjtimex_status.h" unconditionally.
* xlat/gen.sh (cond_xlat): Move printing of fallback definitions ...
(cond_def): ... here.
(gen_header): Check also mpers_xlat.h for global declarations
of xlat structures.
Process input file twice, first time print directives
only, second time print everything.
Wrap struct xlat into #ifdef IN_MPERS ... #else ... #endif.
* xlat/getrandom_flags.in: Cleanup.
Dmitry V. Levin [Thu, 19 Nov 2015 16:39:32 +0000 (16:39 +0000)]
tests: rewrite getdents test in C for better coverage
* tests/getdents.awk: Remove.
* tests/getdents.out: Remove.
* tests/getdents.c: New file.
* tests/getdents.test: Rewrite.
* tests/getdents64.c: New file.
* tests/getdents64.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add getdents and getdents64.
(TESTS): Add getdents64.test.
(EXTRA_DIST): Remove getdents.awk and getdents.out.
* tests/.gitignore: Add getdents and getdents64.
Dmitry V. Levin [Thu, 19 Nov 2015 19:04:32 +0000 (19:04 +0000)]
tests: add readdir.test
* tests/readdir.c: New file.
* tests/readdir.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add readdir.
(TESTS): Add readdir.test.
* tests/.gitignore: Add readdir.
Dmitry V. Levin [Thu, 19 Nov 2015 18:13:53 +0000 (18:13 +0000)]
Mpersify parsers of readdir and getdents syscalls
* defs.h (dirent_types): New xlat prototype.
* dirent.c: Stop including "xlat/direnttypes.h".
(kernel_dirent): New typedef. Mpersify it.
(print_old_dirent): Use it instead of old_dirent_t.
(SYS_FUNC(getdents)): Use it instead of struct kernel_dirent.
Rename direnttypes to dirent_types.
(SYS_FUNC(getdents64)): Move ...
* dirent64.c: ... here. Rename direnttypes to dirent_types.
Include "xlat/dirent_types.h".
* Makefile.am (strace_SOURCES): Add dirent64.c.
* xlat/direnttypes.in: Rename to xlat/dirent_types.in.
Gabriel Laskar [Thu, 19 Nov 2015 10:44:30 +0000 (11:44 +0100)]
getdents: fix typos in array output
Array should be enclosed by square brakets, and elements should be
separated by commas.
* dirent.c (SYS_FUNC(getdents), SYS_FUNC(getdents64)): Fix typos
in array output.
* tests/getdents.awk: Update regexps to match fixed output.
* tests/getdents.out: Update output.
Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Dmitry V. Levin [Thu, 19 Nov 2015 00:29:19 +0000 (00:29 +0000)]
printcmsghdr: move type and data decoders to a separate function
* net.c (print_scm_rights, print_scm_creds, print_scm_security): Change
to return void. Move printing of struct cmsghdr closing '}' ...
(printcmsghdr): ... here. Move type and data decoders to ...
(print_cmsg_type_data): ... new function.
Dmitry V. Levin [Wed, 18 Nov 2015 23:18:17 +0000 (23:18 +0000)]
Assume that libc provides sendmsg
Starting with commit
v4.6-281-g7af9f35 , we implicitly assume that
HAVE_SENDMSG is always defined. Therefore, the check for sendmsg
availability is redundant and could be safely removed.
* configure.ac (AC_CHECK_FUNCS): Remove sendmsg.
* linux/dummy.h [!HAVE_SENDMSG] (sys_recvmsg, sys_sendmsg): Remove
stub aliases.
* net.c [HAVE_SENDMSG]: Define unconditionally.
* syscall.c (dumpio) [HAVE_SENDMSG]: Likewise.
Dmitry V. Levin [Wed, 18 Nov 2015 23:11:34 +0000 (23:11 +0000)]
net.c: move fallback definition of SCM_SECURITY to xlat/
* net.c: Move fallback definition of SCM_SECURITY ...
* xlat/scmvals.in: ... here.
Dmitry V. Levin [Sun, 15 Nov 2015 02:35:57 +0000 (02:35 +0000)]
Implement mlock2 syscall decoding
* mem.c: Include "xlat/mlock_flags.h".
(SYS_FUNC(mlock2)): New function.
* xlat/mlock_flags.in: New file.
* xlat/mlockall_flags.in: Add MCL_ONFAULT, add default values.
* linux/dummy.h (mlock2): Remove.
* tests/mlock2.c: New file.
* tests/mlock2.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add mlock2.
(TESTS): Add mlock2.test.
* tests/.gitignore Add mlock2.
Dmitry V. Levin [Sun, 15 Nov 2015 02:29:29 +0000 (02:29 +0000)]
Implement membarrier syscall decoding
* membarrier.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* xlat/membarrier_cmds.in: New file.
* linux/dummy.h (membarrier): Remove.
* tests/membarrier.c: New file.
* tests/membarrier.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add membarrier.
(TESTS): Add membarrier.test.
* tests/.gitignore: Add membarrier.
Dmitry V. Levin [Sun, 15 Nov 2015 02:22:44 +0000 (02:22 +0000)]
Implement userfaultfd syscall decoding
* userfaultfd.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* xlat/uffd_flags.in: New file.
* linux/dummy.h (userfaultfd): Remove.
* tests/userfaultfd.c: New file.
* tests/userfaultfd.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add userfaultfd.
(TESTS): Add userfaultfd.test.
* tests/.gitignore: Add userfaultfd.
Dmitry V. Levin [Sun, 15 Nov 2015 16:57:15 +0000 (16:57 +0000)]
ia64: wire up kcmp syscall
ia64 has kcmp syscall starting with linux kernel commit
v4.3-rc7-1-gd305c47 .
* linux/ia64/syscallent.h (kcmp): New entry.
Dmitry V. Levin [Sun, 15 Nov 2015 02:49:03 +0000 (02:49 +0000)]
powerpc: wire up direct sysv ipc syscalls
Starting with linux commit
v4.3-rc3-33-ga342361 , powerpc has
direct sysv ipc syscalls in addition to traditional ipc syscall.
* linux/powerpc/syscallent.h (semop, semget, semctl, semtimedop, msgsnd,
msgrcv, msgget, msgctl, shmat, shmdt, shmget, shmctl): New entries.
Dmitry V. Levin [Sun, 15 Nov 2015 02:37:51 +0000 (02:37 +0000)]
Wire up userfaultfd, membarrier, and mlock2 syscalls
* linux/dummy.h (membarrier, mlock2, userfaultfd): New stub aliases.
* linux/32/syscallent.h (userfaultfd, membarrier, mlock2): New entries.
* linux/64/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/arm/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/hppa/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/i386/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/ia64/syscallent.h (userfaultfd, membarrier): Likewise.
* linux/m68k/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/microblaze/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/mips/syscallent-n32.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/mips/syscallent-n64.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/mips/syscallent-o32.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/powerpc/syscallent.h (userfaultfd, membarrier): Likewise.
* linux/s390/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/s390x/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/sparc/syscallent.h (membarrier, userfaultfd, mlock2): Likewise.
* linux/x32/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
* linux/x86_64/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
Dmitry V. Levin [Sun, 15 Nov 2015 20:44:13 +0000 (20:44 +0000)]
sprintflags: skip zero flags
Tweak sprintflags behaviour to match printflags.
* util.c (sprintflags): Skip zero flags unless the value passed
to sprintflags is also zero.
Mike Frysinger [Sat, 31 Oct 2015 04:47:59 +0000 (00:47 -0400)]
printflags: handle empty xlats
If the set of headers are unable to produce a valid list, printflags
will try to pass NULL to tprints which crashes. Add a sanity check
for this edge case.
* util.c (printflags): Check xlat->str is not NULL.
Dmitry V. Levin [Mon, 16 Nov 2015 01:12:18 +0000 (01:12 +0000)]
mpers: forward mpers_DEFS to mpers.sh
mpers_DEFS has to be forwarded to mpers.sh so that config.h would be
properly included by defs.h at preprocessor stage.
* Makefile.am (mpers-m%.stamp): Add the whole $(mpers_sh_opts) set of
options to mpers.sh's CPPFLAGS.
Dmitry V. Levin [Mon, 16 Nov 2015 01:53:43 +0000 (01:53 +0000)]
tests/ioctl: workaround glibc ioctl wrapper on powerpc
* tests/ioctl.c (main) [POWERPC] Disable TCGETS test.
Dmitry V. Levin [Sun, 15 Nov 2015 16:51:55 +0000 (16:51 +0000)]
powerpc: wire up switch_endian syscall
powerpc has switch_endian syscall starting with linux commit
v4.0-rc4-67-g529d235 .
* linux/powerpc/syscallent.h (switch_endian): New entry.
Dmitry V. Levin [Sun, 15 Nov 2015 16:48:50 +0000 (16:48 +0000)]
sparc: reserve more space for new syscalls
Move socket subcalls further down the table to make room
for new syscalls.
* linux/sparc/syscallent.h (SYS_socket_subcall): Raise from 353 to 400.
Dmitry V. Levin [Sun, 15 Nov 2015 01:46:51 +0000 (01:46 +0000)]
m68k: wire up direct socket syscalls
Starting with linux commit
v4.3-rc3-1-g5b3f33e , m68k has direct
socket syscalls in addition to traditional socketcall syscall.
* linux/m68k/syscallent.h (socket, socketpair, bind, connect, listen,
accept4, getsockopt, setsockopt, getsockname, getpeername, sendto,
sendmsg, recvfrom, recvmsg, shutdown, recvmmsg, sendmmsg): New entries.
Dmitry V. Levin [Sun, 15 Nov 2015 01:40:26 +0000 (01:40 +0000)]
i386: wire up direct socket syscalls
Starting with linux commit
v4.2-rc1-64-g9dea5dc , x86 has direct
socket syscalls in addition to traditional socketcall syscall.
* linux/i386/syscallent.h (socket, socketpair, bind, connect, listen,
accept4, getsockopt, setsockopt, getsockname, getpeername, sendto,
sendmsg, recvfrom, recvmsg, shutdown): New entries.
Heiko Carstens [Tue, 10 Nov 2015 11:39:41 +0000 (12:39 +0100)]
s390, s390x: update syscall tables
* linux/s390/syscallent.h: Add new syscalls available with kernel 4.3.0.
* linux/s390x/syscallent.h: Likewise.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Dmitry V. Levin [Sat, 7 Nov 2015 23:22:24 +0000 (23:22 +0000)]
Fix *_printer_defs.h rules ambiguousness
There is an ambiguousness in *_printer_defs.h rules definition:
$ grep '^[^ ]*_defs\.h: ' Makefile.am
m%_defs.h: $(srcdir_mpers_source_files)
%_printer_defs.h: $(srcdir_mpers_source_files)
While it appears to work with GNU make, it has to be fixed nevertheless.
* Makefile.am (m%_defs.h): Rename to m%_type_defs.h.
(mpers_m32_targets): Rename m32_defs.h to m32_type_defs.h.
(mpers_mx32_targets): Rename mx32_defs.h to mx32_type_defs.h.
* mpers_type.h: Rename m32_defs.h to m32_type_defs.h,
mx32_defs.h to mx32_type_defs.h.
* .gitignore: Likewise.
Reported-by: Elliott Hughes <enh@google.com>
Dmitry V. Levin [Fri, 9 Oct 2015 01:55:46 +0000 (01:55 +0000)]
fcntl.c: make use of RVAL_DECODED
* fcntl.c (SYS_FUNC(fcntl)): Return RVAL_DECODED for write-only operations.
Dmitry V. Levin [Thu, 1 Oct 2015 12:24:01 +0000 (12:24 +0000)]
desc.c: move parser of fcntl syscall to a separate file
* fcntl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* desc.c (printflock64, printflock, SYS_FUNC(fcntl)): Move to fcntl.c.
Dmitry V. Levin [Thu, 1 Oct 2015 12:20:11 +0000 (12:20 +0000)]
desc.c: move parser of flock syscall to a separate file
* flock.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* desc.c (SYS_FUNC(flock)): Move to flock.c.
Dmitry V. Levin [Thu, 8 Oct 2015 14:44:15 +0000 (14:44 +0000)]
tests: fix false uio.test failures
* tests/uio.c (main): Use descriptor number 0 in pread/pwrite
and preadv/pwritev syscalls.
* tests/uio.expected: Update regexps.
Reported-by: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>
Gabriel Laskar [Thu, 1 Oct 2015 12:49:25 +0000 (14:49 +0200)]
Fix make -j builds
In files generated by mpers scripts, includes directives are taken from
original files where the type definition was done. This causes to
include defs.h in multiple files. defs.h includes printers.h header,
which is a generated header.
This patch add an explicit dependency to printers.h for the mpers
scripts.
* Makefile.am (mpers-m%.stamp): Add printers.h to order-only
prerequisites.
Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Mike Frysinger [Tue, 29 Sep 2015 19:02:35 +0000 (15:02 -0400)]
mpers: fix shell code to conform better to POSIX
The `echo -n` behavior is non-portable, so use printf instead.
* generate_mpers_am.sh: Change `echo -n` to `printf`.
Gabriel Laskar [Wed, 23 Sep 2015 08:11:55 +0000 (10:11 +0200)]
ioctl: fix ioctl command number decoding in case of conflicts
When a command number was decoded through ioctl_decode_command_number(),
there was no check for conflicts with other potential ioctls numbers.
For example:
ioctl(fd, MCE_GET_RECORD_LEN, &i);
output:
ioctl(3, MIXER_READ(1), 0x7ffddce74a58) = 0
instead of:
ioctl(3, MIXER_READ(1) or MCE_GET_RECORD_LEN, 0x7ffee435ce08) = 0
* ioctl.c (SYS_FUNC(ioctl)): Fix ioctl command number decoding
in case of conflicts.
* tests/ioctl.c (main): Add a case for command number conflicts.
Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Dmitry V. Levin [Tue, 22 Sep 2015 21:22:37 +0000 (21:22 +0000)]
tests: convert ioctl.test from match_grep to match_diff
* tests/ioctl.c (main): Print expected output.
* tests/ioctl.test: Use match_diff instead of match_grep.
* tests/ioctl.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove ioctl.expected.
Dmitry V. Levin [Sat, 19 Sep 2015 21:28:23 +0000 (21:28 +0000)]
Convert parser of seccomp filter program to new mpers infrastructure
* seccomp_fprog.h: New file.
* fetch_seccomp_fprog.c: New file.
* Makefile.am (strace_SOURCES): Add them.
* seccomp.c: Include "seccomp_fprog.h".
(print_seccomp_filter): Use fetch_seccomp_fprog.
Dmitry V. Levin [Sat, 19 Sep 2015 00:11:07 +0000 (00:11 +0000)]
tests/init.sh: enhance match_grep error diagnostics
* tests/init.sh (match_grep): Check patterns one by one,
output only those patterns that didn't match.
Dmitry V. Levin [Sat, 19 Sep 2015 00:01:35 +0000 (00:01 +0000)]
tests/init.sh: fix comment
* tests/init.sh (match_awk): Fix usage description.
Dmitry V. Levin [Fri, 18 Sep 2015 21:54:52 +0000 (21:54 +0000)]
tests: add one more case to select.test
* tests/select.c (main): Check how timeout is printed
on exiting syscall.
Dmitry V. Levin [Fri, 18 Sep 2015 21:45:36 +0000 (21:45 +0000)]
tests: uncouple pselect6 from select.test
* tests/select.c Do not include <string.h>.
Include <sys/syscall.h>.
[!__NR_select]: Skip the test.
(main): Remove pselect6 support, test just select syscall.
* tests/select.test: Remove all pselect6 checks, test just
select syscall.
Dmitry V. Levin [Fri, 18 Sep 2015 21:37:09 +0000 (21:37 +0000)]
tests: robustify select test
* tests/select.c: Do not include <assert.h>.
(main): Skip the test instead of assertions.
Add some padding to the timeval structure.
Dmitry V. Levin [Fri, 18 Sep 2015 21:20:56 +0000 (21:20 +0000)]
tests: add one more case to pselect6.test
* tests/pselect6.c (main): Check how timeout is printed
on exiting syscall.
Dmitry V. Levin [Fri, 18 Sep 2015 21:20:56 +0000 (21:20 +0000)]
tests: robustify pselect6 test
* tests/pselect6.c: Do not include <assert.h> and <string.h>.
Include <sys/syscall.h>.
[!__NR_pselect6]: Skip the test.
(main): Skip the test instead of assertions.
Add some padding to the timespec structure.
Dmitry V. Levin [Fri, 18 Sep 2015 18:02:50 +0000 (18:02 +0000)]
Convert another parser of struct timeval to new mpers infrastructure
* print_time.c (sprint_timeval): New mpers printer.
[ALPHA] (sprint_timeval32): New function.
* defs.h [ALPHA] (sprint_timeval32): New prototype.
(bitness_t, TIMEVAL_TEXT_BUFSIZE, printtv_bitness, sprinttv): Remove.
* desc.c (decode_select): Replace bitness parameter with two printers.
Use them instead of printtv_bitness and sprinttv.
(sys_oldselect, sys_select): Pass print_timeval and sprint_timeval
to decode_select.
[ALPHA] (sys_osf_select): Pass print_timeval32 and sprint_timeval32
to decode_select.
(pselect6): Pass print_timespec and sprint_timespec to decode_select.
* time.c (UTIME_NOW, UTIME_OMIT, current_time_t_is_compat,
struct timeval32, printtv_bitness, do_sprinttv, sprinttv): Remove.
Dmitry V. Levin [Fri, 18 Sep 2015 17:44:16 +0000 (17:44 +0000)]
Convert another parser of struct timespec to new mpers infrastructure
* print_time.c (sprint_timespec): New mpers printer.
* defs.h (TIMESPEC_TEXT_BUFSIZE): Update.
(sprint_timespec): Remove.
* time.c (sprint_timespec): Remove.
* net.c (sys_recvmmsg): Update callers.
* poll.c (decode_poll_exiting): Likewise.
Dmitry V. Levin [Fri, 18 Sep 2015 17:05:35 +0000 (17:05 +0000)]
tests: add another case to pselect6 test
* tests/pselect6.c: Include <sys/time.h>.
(handler): New function.
(main): Install an interval timer.
Use it to check how ERESTARTNOHAND is printed.
Dmitry V. Levin [Fri, 18 Sep 2015 16:15:49 +0000 (16:15 +0000)]
Fix decoding of gettimeofday and settimeofday
* time.c (print_timezone): new function.
(sys_gettimeofday, sys_settimeofday): Use it instead of print_timeval
to print struct timezone.
[ALPHA] (sys_osf_gettimeofday, sys_osf_settimeofday): Use it
instead of print_timeval32 to print struct timezone.
* tests/xettimeofday.c: New file.
* tests/xettimeofday.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add xettimeofday.
(TESTS): Add xettimeofday.
* tests/.gitignore: Add xettimeofday.
Dmitry V. Levin [Fri, 18 Sep 2015 15:16:11 +0000 (15:16 +0000)]
Convert parser of struct timeval to new mpers infrastructure
* defs.h (printtv, printtv_special): Remove.
[ALPHA] (print_timeval32, print_timeval32_pair): New prototypes.
* print_time.c (print_timeval): New mpers printer.
[ALPHA] (print_timeval32, print_timeval32_pair): New functions.
* time.c (sys_gettimeofday, sys_settimeofday): Use print_timeval
instead of printtv.
[ALPHA] (sys_osf_gettimeofday, sys_osf_settimeofday):
Use print_timeval32 instead of printtv_bitness.
* utimes.c [ALPHA] (sys_osf_utimes): Use print_timeval32_pair
instead of printtv_bitness.
Dmitry V. Levin [Fri, 18 Sep 2015 15:16:11 +0000 (15:16 +0000)]
Convert parser of struct timespec to new mpers infrastructure
* defs.h (print_timespec): Remove.
* print_time.c (print_timespec): New mpers printer.
* futex.c (sys_futex): Use print_timespec instead of printtv.
* ipc_sem.c (sys_semtimedop): Likewise.
* mq.c (sys_mq_timedsend, sys_mq_timedreceive): Likewise.
* time.c (clock_settime, clock_gettime, clock_nanosleep): Likewise.
(print_timespec): Remove.
Dmitry V. Levin [Fri, 18 Sep 2015 15:47:29 +0000 (15:47 +0000)]
Remove unused parser of adjtime syscall
* time.c (sys_adjtime): Remove.
Dmitry V. Levin [Fri, 18 Sep 2015 14:24:51 +0000 (14:24 +0000)]
Fix decoding of clock_nanosleep
* time.c (sys_clock_nanosleep): Use is_erestart,
temporarily_clear_syserror, and restore_cleared_syserror.
* tests/clock_nanosleep.c: New file.
* tests/clock_nanosleep.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add clock_nanosleep.
(TESTS): Add clock_nanosleep.test.
* tests/.gitignore: Add clock_nanosleep.
Dmitry V. Levin [Fri, 18 Sep 2015 01:54:59 +0000 (01:54 +0000)]
Add is_erestart helper function
* defs.h (is_erestart): New prototype.
* syscall.c (is_erestart): New function.
* time.c (sys_nanosleep): Use is_erestart,
temporarily_clear_syserror, and restore_cleared_syserror.
Dmitry V. Levin [Fri, 18 Sep 2015 01:54:59 +0000 (01:54 +0000)]
Add helper functions to clear/restore syserror
* defs.h (temporarily_clear_syserror, restore_cleared_syserror):
New prototypes.
* syscall.c (saved_u_error): New variable.
(temporarily_clear_syserror, restore_cleared_syserror): New functions.
* aio.c (sys_io_getevents): Use temporarily_clear_syserror
and restore_cleared_syserror.
* mq.c (sys_mq_timedreceive): Likewise.
* signal.c (sys_rt_sigtimedwait): Likewise.
Dmitry V. Levin [Fri, 18 Sep 2015 02:18:03 +0000 (02:18 +0000)]
tests: add nanosleep.test
* tests/nanosleep.c: New file.
* tests/nanosleep.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add nanosleep.
(TESTS): Add nanosleep.test.
* tests/.gitignore: Add nanosleep.
Dmitry V. Levin [Fri, 18 Sep 2015 11:27:11 +0000 (11:27 +0000)]
tests: rewrite restart_syscall in C
* tests/restart_syscall.c: New file.
* tests/restart_syscall.expected: Remove.
* tests/restart_syscall_unknown.expected: Remove.
* tests/restart_syscall.test: Update to use restart_syscall.
* tests/Makefile.am (check_PROGRAMS): Add restart_syscall.
(EXTRA_DIST): Remove restart_syscall.expected
and restart_syscall_unknown.expected.
* tests/.gitignore: Add restart_syscall.
Dmitry V. Levin [Fri, 18 Sep 2015 13:04:02 +0000 (13:04 +0000)]
Properly initialize siginfo_t object passed to print_stopped function
* strace.c (trace): Clear the whole siginfo_t variable before passing it
to ptrace(PTRACE_GETSIGINFO) because the latter may initialize only a
part of the structure.
Dmitry V. Levin [Thu, 17 Sep 2015 21:57:22 +0000 (21:57 +0000)]
tests: add clock_xettime.test
* tests/clock_xettime.c: New file.
* tests/clock_xettime.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add clock_xettime.
(TESTS): Add clock_xettime.test.
* tests/.gitignore: Add clock_xettime.
Dmitry V. Levin [Thu, 17 Sep 2015 20:23:31 +0000 (20:23 +0000)]
Convert parser of struct itimerval to new mpers infrastructure
* defs.h [ALPHA] (print_itimerval32): New prototype.
* print_time.c (print_itimerval): New mpers printer.
[ALPHA] (timeval32_t): New typedef.
[ALPHA] (print_timeval32_t, print_itimerval32): New functions.
* time.c (sys_getitimer, sys_setitimer): Use print_itimerval instead
of printitv.
[ALPHA] (sys_osf_getitimer, sys_osf_setitimer): Use print_itimerval32
instead of printitv_bitness.
(tprint_timeval32, tprint_timeval, printitv_bitness, printitv): Remove.
Dmitry V. Levin [Thu, 17 Sep 2015 20:44:22 +0000 (20:44 +0000)]
tests: add xetitimer.test
* tests/xetitimer.c: New file.
* tests/xetitimer.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add xetitimer.
(TESTS): Add xetitimer.test.
* tests/.gitignore: Add xetitimer.
Dmitry V. Levin [Thu, 17 Sep 2015 16:47:03 +0000 (16:47 +0000)]
Convert parser of struct itimerspec to new mpers infrastructure
* print_time.c (print_itimerspec): New mpers printer.
* time.c (sys_timer_settime, sys_timer_gettime, sys_timerfd,
sys_timerfd_settime, sys_timerfd_gettime): Use it instead of printitv.
Dmitry V. Levin [Thu, 17 Sep 2015 16:47:03 +0000 (16:47 +0000)]
print_time.c: introduce print_timespec_t helper
* print_time.c (time_fmt): New constant string.
(print_timeval_t): Use it.
(print_timespec_t): New function.
(print_timespec_t_utime): Use it.
Dmitry V. Levin [Thu, 17 Sep 2015 20:05:20 +0000 (20:05 +0000)]
tests: add timerfd_xettime.test
* tests/timerfd_xettime.c: New file.
* tests/timerfd_xettime.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add timerfd_xettime.
(TESTS): Add timerfd_xettime.test.
* tests/.gitignore: Add timerfd_xettime.
Dmitry V. Levin [Thu, 17 Sep 2015 18:25:12 +0000 (18:25 +0000)]
tests: add timer_xettime.test
* tests/timer_xettime.c: New file.
* tests/timer_xettime.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add timer_xettime.
(TESTS): Add timer_xettime.test.
* tests/.gitignore: Add timer_xettime.
Dmitry V. Levin [Thu, 17 Sep 2015 16:10:53 +0000 (16:10 +0000)]
time.c: move parser of time syscall to print_time.c
* time.c (current_time_t_is_int32): Remove.
(sys_time): Move ...
* print_time.c: ... here. Mpersify time_t.
Dmitry V. Levin [Thu, 17 Sep 2015 15:12:42 +0000 (15:12 +0000)]
print_time.c: remove unused function parameters
* print_time.c (print_timespec_t_utime, print_timeval_t): Remove
"struct tcb *" parameter.
(print_timespec_utime_pair, print_timeval_pair): Update callers.
Dmitry V. Levin [Wed, 16 Sep 2015 23:15:55 +0000 (23:15 +0000)]
Add struct timex.tai support
* configure.ac (AC_CHECK_MEMBERS): Add struct timex.tai.
* print_timex.c (print_timex) [HAVE_STRUCT_TIMEX_TAI]: Print tai field.
* tests/adjtimex.c (main) [HAVE_STRUCT_TIMEX_TAI]: Likewise.
Dmitry V. Levin [Wed, 16 Sep 2015 21:58:36 +0000 (21:58 +0000)]
Convert parser of struct timex to new mpers infrastructure
* defs.h (adjtimex_modes, adjtimex_status): New xlat prototypes.
* print_timex.c (struct_timex): New typedef. Mpersify it.
[IN_MPERS]: Do not include "xlat/adjtimex_modes.h"
and "xlat/adjtimex_status.h".
[SUPPORTED_PERSONALITIES > 1]: Remove.
(tprint_timeval): Remove.
(tprint_timex): Rename to print_timex. Mpersify it.
* time.c (do_adjtimex): Rename tprint_timex to print_timex.
* tests/adjtimex.c: New file.
* tests/adjtimex.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add adjtimex.
(TESTS): Add adjtimex.test.
* tests/.gitignore: Add adjtimex.
Dmitry V. Levin [Wed, 16 Sep 2015 21:47:48 +0000 (21:47 +0000)]
Move parser of struct timex to a separate file
* print_timex.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* time.c (tprint_timex32, tprint_timex): Move to print_timex.c.
Dmitry V. Levin [Wed, 16 Sep 2015 16:31:43 +0000 (16:31 +0000)]
Enhance parser of struct sigevent
* print_sigevent.c (print_sigevent): Always print names
of struct_sigevent fields along with their values.
Print signal name of sigev_signo for those sigev_notify values
that require valid signal numbers.
* tests/timer_create.c: New file.
* tests/timer_create.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add timer_create.
(TESTS): Add timer_create.test.
* tests/.gitignore: Add timer_create.
Dmitry V. Levin [Wed, 16 Sep 2015 16:31:43 +0000 (16:31 +0000)]
Convert parser of struct sigevent to new mpers infrastructure
* defs.h (sigev_value): New prototype.
(printsigevent): Remove.
* print_sigevent.c (struct_sigevent): New typedef. Mpersify it.
[IN_MPERS]: Do not include "xlat/sigev_value.h".
(printsigevent32): Remove.
(printsigevent): Rename to print_sigevent. Mpersify it.
* mq.c (sys_mq_notify): Rename printsigevent to print_sigevent.
* time.c (sys_timer_create): Likewise.
Dmitry V. Levin [Wed, 16 Sep 2015 18:05:43 +0000 (18:05 +0000)]
Move parser of struct sigevent to a separate file
* print_sigevent.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* time.c (printsigevent32, printsigevent): Move to print_sigevent.c.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Dmitry V. Levin [Mon, 14 Sep 2015 17:16:32 +0000 (17:16 +0000)]
Update RENAME_* constants
* xlat/rename_flags.in: Add RENAME_WHITEOUT.
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.
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.
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.
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.
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.
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.
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.
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.
Dmitry V. Levin [Mon, 14 Sep 2015 15:29:41 +0000 (15:29 +0000)]
Update IPPROTO_* constants
* xlat/inet_protocols.in: Add IPPROTO_MPLS.
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.
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.