]> granicus.if.org Git - strace/log
strace
8 years agoRename sprintflags64 to sprintflags.
Dmitry V. Levin [Sun, 15 May 2016 14:26:03 +0000 (14:26 +0000)]
Rename sprintflags64 to sprintflags.

* defs.h (sprintflags): Remove.
(sprintflags64): Rename to sprintflags.
* util.c (sprintflags64): Rename to sprintflags.

8 years agoPrepare for transition from sprintflags64 to sprintflags
Dmitry V. Levin [Sun, 15 May 2016 14:23:06 +0000 (14:23 +0000)]
Prepare for transition from sprintflags64 to sprintflags

* fcntl.c (print_fcntl): Cast 3rd argument of sprintflags
to unsigned long.
* membarrier.c (SYS_FUNC(membarrier)): Likewise.
* prctl.c (SYS_FUNC(prctl)): Likewise.
* poll.c (decode_poll_exiting): Cast 3rd argument of sprintflags
to unsigned short.

8 years agoRename xlookup64 to xlookup
Dmitry V. Levin [Sat, 14 May 2016 21:55:35 +0000 (21:55 +0000)]
Rename xlookup64 to xlookup

* defs.h (xlookup): Remove.
(xlookup64): Rename to xlookup.
* util.c (xlookup64): Rename to xlookup.

8 years agoPrepare for transition from xlookup64 to xlookup
Dmitry V. Levin [Sat, 14 May 2016 21:46:05 +0000 (21:46 +0000)]
Prepare for transition from xlookup64 to xlookup

* fcntl.c (print_fcntl, SYS_FUNC(fcntl), SYS_FUNC(fcntl64)):
Cast 2nd argument of xlookup to unsigned long.
* prctl.c (SYS_FUNC(prctl)): Likewise.
* sched.c (SYS_FUNC(sched_getscheduler)): Likewise.
* time.c (do_adjtimex): Likewise.
* ioprio.c (sprint_ioprio): Change type of the argument
and local variables from int to unsigned int.
* keyctl.c (print_keyring_serial_number): Cast 2nd argument
of xlookup to unsigned int.
* net.c (tprint_sock_type): Change type of the argument to unsigned int.
* printmode.c (sprintmode): Likewise.
* printsiginfo.c (printsigval):  Change type of si_code argument
to unsigned int.

8 years agov4l2: fix build with old kernel headers
Dmitry V. Levin [Sat, 14 May 2016 00:36:27 +0000 (00:36 +0000)]
v4l2: fix build with old kernel headers

Prior to v2.6.25-rc3, <linux/videodev2.h> didn't include all
required headers, resulting to omission of V4L2_* constants.

This issue doesn't arise in v4l2.c and tests/ioctl_v4l2.c files
because they already include all necessary headers themselves.

* configure.ac (AC_CHECK_DECLS): Include <sys/time.h>, <linux/ioctl.h>,
and <linux/types.h> before <linux/videodev2.h>.

8 years agoconfigure.ac: do not check for sys/ioctl.h and ioctls.h
Dmitry V. Levin [Fri, 13 May 2016 20:26:11 +0000 (20:26 +0000)]
configure.ac: do not check for sys/ioctl.h and ioctls.h

Since sys/ioctl.h is included unconditionally when needed
and ioctls.h doesn't exist, these checks are redundant.

* configure.ac (AC_CHECK_HEADERS): Remove ioctls.h and sys/ioctl.h.

8 years agosock.c: include <linux/ioctl.h> instead of <sys/ioctl.h> or <ioctls.h>
Dmitry V. Levin [Fri, 13 May 2016 20:22:18 +0000 (20:22 +0000)]
sock.c: include <linux/ioctl.h> instead of <sys/ioctl.h> or <ioctls.h>

Include <linux/ioctl.h> for <linux/sockios.h> on alpha, sh, and sh64
architectures because their <asm/sockios.h> use _IOR and _IOW macros
but don't include anything that would define these macros.

Being a wrapper around <linux/ioctl.h>, <sys/ioctl.h> brings
no benefits in this case.  <ioctls.h> simply doesn't exist.

* sock.c [ALPHA || SH || SH64]: Include <linux/ioctl.h>
instead of <sys/ioctl.h> or <ioctls.h>.

8 years agov4l2: include <linux/ioctl.h> instead of <sys/ioctl.h>
Dmitry V. Levin [Fri, 13 May 2016 20:15:12 +0000 (20:15 +0000)]
v4l2: include <linux/ioctl.h> instead of <sys/ioctl.h>

Being a wrapper around <linux/ioctl.h>, <sys/ioctl.h> brings
no benefits for parser of VIDIOC_* ioctls.

* v4l2.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.

8 years agoprintsiginfo: remove "verbose" argument
Dmitry V. Levin [Fri, 13 May 2016 14:16:12 +0000 (14:16 +0000)]
printsiginfo: remove "verbose" argument

Remove erroneous use of verbose(tcp) as a printing limit
for already fetched members of siginfo_t structure.

* printsiginfo.h (printsiginfo): Remove boolean argument.
* printsiginfo.c (printsigval): Remove boolean argument, print
si_int and si_ptr members unconditionally.  All callers changed.
(print_si_info): Remove boolean argument, print si_utime and si_stime
members unconditionally.  All callers changed.
(printsiginfo): Remove boolean argument.  All callers changed.

8 years agotests/ptrace.c: tweak magic constants to make the test more reliable
Dmitry V. Levin [Fri, 13 May 2016 09:37:10 +0000 (09:37 +0000)]
tests/ptrace.c: tweak magic constants to make the test more reliable

* tests/ptrace.c (main): Change bad_request and bad_data to make they
lower 32-bit parts closer to -1U.

8 years agotests/ioctl_v4l2.c: fix build on older systems
Dmitry V. Levin [Fri, 13 May 2016 04:04:08 +0000 (04:04 +0000)]
tests/ioctl_v4l2.c: fix build on older systems

Fix build on systems without HAVE_DECL_V4L2_CTRL_TYPE_STRING or
V4L2_CTRL_CLASS_CAMERA.

* tests/ioctl_v4l2.c (main) [VIDIOC_S_EXT_CTRLS]: Disable part of the
test if [!HAVE_DECL_V4L2_CTRL_TYPE_STRING].
Replace V4L2_CTRL_CLASS_CAMERA with V4L2_CTRL_CLASS_USER.

8 years agoDo not use htole32 function
Dmitry V. Levin [Fri, 13 May 2016 03:51:43 +0000 (03:51 +0000)]
Do not use htole32 function

htole32 function is not portable enough.

* v4l2.c (print_pixelformat): Rewrite initialization of pixel format
union without using of htole32.
* tests/ioctl_v4l2.c (main): Likewise.

8 years agotests/ioctl_v4l2.c: fix typo
Dmitry V. Levin [Fri, 13 May 2016 03:20:58 +0000 (03:20 +0000)]
tests/ioctl_v4l2.c: fix typo

* tests/ioctl_v4l2.c (main)
[!HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE]: Fix typo in expected
output string.

8 years agotests: check decoding of ptrace syscall
Dmitry V. Levin [Thu, 12 May 2016 16:59:59 +0000 (16:59 +0000)]
tests: check decoding of ptrace syscall

* tests/ptrace.c: New file.
* tests/ptrace.test: New test.
* tests/.gitignore: Add ptrace.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ptrace.

8 years agoptrace: decode data argument of PTRACE_PEEKSIGINFO request
Dmitry V. Levin [Fri, 13 May 2016 02:33:33 +0000 (02:33 +0000)]
ptrace: decode data argument of PTRACE_PEEKSIGINFO request

The data argument of PTRACE_PEEKSIGINFO request is a pointer
to siginfo_t array.

* printsiginfo.c (print_siginfo_t): New function.
(print_siginfo_array): New mpers printer.
* process.c (SYS_FUNC(ptrace)): Print data argument of
PTRACE_PEEKSIGINFO request using print_siginfo_array.

8 years agoptrace: decode data argument of PTRACE_SECCOMP_GET_FILTER request
Dmitry V. Levin [Thu, 12 May 2016 16:58:38 +0000 (16:58 +0000)]
ptrace: decode data argument of PTRACE_SECCOMP_GET_FILTER request

* process.c (SYS_FUNC(ptrace)): Print data argument of
PTRACE_SECCOMP_GET_FILTER request on exiting using print_seccomp_fprog.

8 years agoptrace: decode argument of PTRACE_GETEVENTMSG request
Dmitry V. Levin [Thu, 12 May 2016 16:56:30 +0000 (16:56 +0000)]
ptrace: decode argument of PTRACE_GETEVENTMSG request

* process.c (SYS_FUNC(ptrace)): Print data argument of
PTRACE_GETEVENTMSG request on exiting using printnum_ulong.

8 years agoptrace: decode arguments of PTRACE_[GS]ETSIGMASK requests
Dmitry V. Levin [Thu, 12 May 2016 16:52:49 +0000 (16:52 +0000)]
ptrace: decode arguments of PTRACE_[GS]ETSIGMASK requests

* process.c (SYS_FUNC(ptrace)): Print arguments of PTRACE_GETSIGMASK
and PTRACE_SETSIGMASK requests using print_sigset_addr_len.

8 years agoptrace: return RVAL_DECODED for requests decoded on entering
Dmitry V. Levin [Thu, 12 May 2016 16:49:34 +0000 (16:49 +0000)]
ptrace: return RVAL_DECODED for requests decoded on entering

* process.c (SYS_FUNC(ptrace)): Return RVAL_DECODED on entering for all
ptrace requests except those that are partially decoded in exiting,

8 years agoptrace: print PTRACE_O_* flags using printflags64
Dmitry V. Levin [Thu, 12 May 2016 16:35:54 +0000 (16:35 +0000)]
ptrace: print PTRACE_O_* flags using printflags64

As flags argument has a long integer type, print it using printflags64
because printflags takes unsigned int argument.

* process.c (SYS_FUNC(ptrace)): Print PTRACE_O_* flags
using printflags64.

8 years agoptrace: print data argument of PTRACE_SEIZE et al requests as flags
Dmitry V. Levin [Thu, 12 May 2016 15:53:28 +0000 (15:53 +0000)]
ptrace: print data argument of PTRACE_SEIZE et al requests as flags

* process.c (SYS_FUNC(ptrace)): Print data argument of
PTRACE_SEIZE and PTRACE_OLDSETOPTIONS as PTRACE_O_* flags.

8 years agoptrace: print data argument of PTRACE_SINGLEBLOCK et al requests as signo
Dmitry V. Levin [Thu, 12 May 2016 15:50:43 +0000 (15:50 +0000)]
ptrace: print data argument of PTRACE_SINGLEBLOCK et al requests as signo

* process.c (SYS_FUNC(ptrace)): Print data argument of
PTRACE_SINGLEBLOCK, PTRACE_SYSEMU, and PTRACE_SYSEMU_SINGLESTEP requests
as a signal number.

8 years agoptrace: decode addr argument of PTRACE_PEEKSIGINFO request
Dmitry V. Levin [Thu, 12 May 2016 15:45:24 +0000 (15:45 +0000)]
ptrace: decode addr argument of PTRACE_PEEKSIGINFO request

The addr argument of PTRACE_PEEKSIGINFO request is a pointer to
a struct ptrace_peeksiginfo_args.

* process.c: Include "xlat/ptrace_peeksiginfo_flags.h".
(SYS_FUNC(ptrace)): Print addr argument of PTRACE_PEEKSIGINFO request
as a struct ptrace_peeksiginfo_args.
* xlat/ptrace_peeksiginfo_flags.in: New file.

8 years agoptrace: fix printing addr argument of PTRACE_GETSIGMASK et al requests
Dmitry V. Levin [Thu, 12 May 2016 15:38:35 +0000 (15:38 +0000)]
ptrace: fix printing addr argument of PTRACE_GETSIGMASK et al requests

For PTRACE_GETSIGMASK and PTRACE_SETSIGMASK requests, addr argument
contains the size of the buffer pointed to by data argument.
For PTRACE_SECCOMP_GET_FILTER request, addr argument contains
an offset counter.

* process.c (SYS_FUNC(ptrace)): Print addr argument of
PTRACE_GETSIGMASK, PTRACE_SETSIGMASK, and PTRACE_SECCOMP_GET_FILTER
requests using %lu format.

8 years agoptrace: do not print data argument of some requests on sparc
Dmitry V. Levin [Thu, 12 May 2016 15:18:05 +0000 (15:18 +0000)]
ptrace: do not print data argument of some requests on sparc

On sparc, kernel ignores data argument of PTRACE_GETREGS,
PTRACE_SETREGS, PTRACE_GETFPREGS, and PTRACE_SETFPREGS requests.

* process.c (SYS_FUNC(ptrace)) [SPARC || SPARC64]: Return RVAL_DECODED
right after printing addr argument if request is one of PTRACE_GETREGS,
PTRACE_SETREGS, PTRACE_GETFPREGS, or PTRACE_SETFPREGS.

8 years agoptrace: do not print addr and data arguments of PTRACE_ATTACH-like requests
Dmitry V. Levin [Thu, 12 May 2016 15:10:41 +0000 (15:10 +0000)]
ptrace: do not print addr and data arguments of PTRACE_ATTACH-like requests

As kernel ignores addr and data arguments of PTRACE_ATTACH,
PTRACE_INTERRUPT, PTRACE_KILL, and PTRACE_LISTEN request,
we do not print them either.

* process.c (SYS_FUNC(ptrace)): After printing pid argument, return
RVAL_DECODED if request is one of PTRACE_ATTACH, PTRACE_INTERRUPT,
PTRACE_KILL, or PTRACE_LISTEN.

8 years agoptrace: do not print arguments of PTRACE_TRACEME request
Dmitry V. Levin [Thu, 12 May 2016 15:03:58 +0000 (15:03 +0000)]
ptrace: do not print arguments of PTRACE_TRACEME request

As kernel ignores arguments of PTRACE_TRACEME request,
we do not print them either.

* process.c (SYS_FUNC(ptrace)): If request is PTRACE_TRACEME,
return early with RVAL_DECODED.

8 years agoptrace: print request using printxval64
Dmitry V. Levin [Thu, 12 May 2016 14:45:38 +0000 (14:45 +0000)]
ptrace: print request using printxval64

As first argument of ptrace syscall has a long integer type, print
it using printxval64 because printxval takes unsigned int argument.

* process.c (SYS_FUNC(ptrace)): Change type of "request" variable
from "long" to "unsigned long", print it using printxval64 instead
of printxval.

8 years agoDo not sign-extend siginfo_t.si_syscall
Dmitry V. Levin [Thu, 12 May 2016 14:27:49 +0000 (14:27 +0000)]
Do not sign-extend siginfo_t.si_syscall

* printsiginfo.c (print_si_info): Explicitly cast si_syscall member
of siginfo_t that has type "int" to "unsigned int", to avoid sign
extension when passed to syscall_name function.

8 years agoExport print_seccomp_fprog for further use in parser of ptrace syscall
Dmitry V. Levin [Thu, 12 May 2016 14:23:50 +0000 (14:23 +0000)]
Export print_seccomp_fprog for further use in parser of ptrace syscall

* defs.h (print_seccomp_fprog): New prototype.
* seccomp.c (print_seccomp_fprog): Remove "static" keyword.
Move printing of struct seccomp_fprog fields ...
(print_seccomp_filter): ... here.

8 years agotests: add munlockall.test
Fei Jie [Wed, 11 May 2016 07:07:29 +0000 (15:07 +0800)]
tests: add munlockall.test

* tests/munlockall.c: New file.
* tests/munlockall.test: New test.
* tests/.gitignore: Add munlockall.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add munlockall.test.

8 years agotests: add link.test
Fei Jie [Wed, 11 May 2016 07:07:28 +0000 (15:07 +0800)]
tests: add link.test

* tests/link.c: New file.
* tests/link.test: New test.
* tests/.gitignore: Add link.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add link.test.

8 years agotests: check decoding and dumping of preadv2 and pwritev2 syscalls
Dmitry V. Levin [Wed, 11 May 2016 01:34:09 +0000 (01:34 +0000)]
tests: check decoding and dumping of preadv2 and pwritev2 syscalls

* tests/preadv2-pwritev2.c: New file.
* tests/preadv2-pwritev2.test: New test.
* tests/.gitignore: Add preadv2-pwritev2.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add preadv2-pwritev2.

8 years agoImplement decoding of preadv2 and pwritev2 syscalls
Dmitry V. Levin [Wed, 11 May 2016 00:42:10 +0000 (00:42 +0000)]
Implement decoding of preadv2 and pwritev2 syscalls

* io.c: Include "xlat/rwf_flags.h".
(do_preadv, do_pwritev, SYS_FUNC(preadv2), SYS_FUNC(pwritev2)):
New functions.
(SYS_FUNC(preadv)): Use do_preadv.
(SYS_FUNC(pwritev)): Use do_pwritev.
* linux/32/syscallent.h (preadv2, pwritev2): New entries.
* linux/64/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* syscall.c (dumpio): Handle SEN_preadv2 and SEN_pwritev2.
* xlat/rwf_flags.in: New file.
* NEWS: Mention parsers of new syscalls.

8 years agotests: extend test coverage of xattr family syscalls
Dmitry V. Levin [Tue, 10 May 2016 18:18:32 +0000 (18:18 +0000)]
tests: extend test coverage of xattr family syscalls

* tests/xattr.c: Check decoding of all xattr family syscalls.
* tests/xattr.test: Use run_strace_match_diff.
* tests/xattr.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove it.

8 years agotests: add print_quoted_memory function to libtests
Dmitry V. Levin [Tue, 10 May 2016 22:05:53 +0000 (22:05 +0000)]
tests: add print_quoted_memory function to libtests

* tests/print_quoted_string.c (print_quoted_memory): New function.
(print_quoted_string): Use it.
* tests/tests.h (print_quoted_memory): New prototype.

8 years agoFix corner cases of xattr family syscalls decoding
Dmitry V. Levin [Tue, 10 May 2016 18:52:06 +0000 (18:52 +0000)]
Fix corner cases of xattr family syscalls decoding

* xattr.c (print_xattr_val): Do not take insize into account, print it
as unsigned long.
Do not decode xattr values of size larger than XATTR_SIZE_MAX.
Use static buffer for fetching xattr values.
(print_xattr_list): Do not decode string when size is zero.

8 years agouserfaultfd: Add ioctl tests
Dr. David Alan Gilbert [Tue, 10 May 2016 10:49:03 +0000 (11:49 +0100)]
userfaultfd: Add ioctl tests

* tests/ioctl_uffdio.c: New file.
* tests/ioctl_uffdio.test: New test.
* tests/.gitignore: Add ioctl_uffdio.
* tests/Makefile.am (check_PROGRAMS):  Likewise.
(DECODER_TESTS): Add ioctl_uffdio.test.

8 years agoDecode UFFDIO_* ioctls
Dr. David Alan Gilbert [Tue, 10 May 2016 10:49:02 +0000 (11:49 +0100)]
Decode UFFDIO_* ioctls

Decode the ioctls associated with the userfaultfd fd.
Note that they tend to read from and also return result in it's data
structure.

* configure.ac (AC_CHECK_HEADERS): Add linux/userfaultfd.h.
* userfaultfd.c [HAVE_LINUX_USERFAULTFD_H]: Add ioctl decoder.
* defs.h (uffdio_ioctl): New prototype.
* ioctl.c (ioctl_decode) [HAVE_LINUX_USERFAULTFD_H]: Wire in
uffdio_ioctl.
* xlat/uffd_*.in: Create flag xlat for all the IOCTLs.

8 years agoUpdate AX_CODE_COVERAGE
Dmitry V. Levin [Tue, 10 May 2016 02:08:56 +0000 (02:08 +0000)]
Update AX_CODE_COVERAGE

* m4/ax_code_coverage.m4: Update to serial 16.
* Makefile.am (CODE_COVERAGE_LCOV_OPTIONS): Remove.
(CODE_COVERAGE_GENHTML_OPTIONS): Update, add prefix.
(CODE_COVERAGE_BRANCH_COVERAGE): Set to 1.

8 years agostrace-ff.test: fix race condition
Dmitry V. Levin [Tue, 10 May 2016 09:29:11 +0000 (09:29 +0000)]
strace-ff.test: fix race condition

* tests/strace-ff.test: Wait for completion of PR_SET_PTRACER command.

8 years agotests/epoll_pwait.c: fix for x32
Dmitry V. Levin [Tue, 10 May 2016 01:10:51 +0000 (01:10 +0000)]
tests/epoll_pwait.c: fix for x32

* tests/epoll_pwait.c (main): Explicitly cast last syscall argument
to kernel_ulong_t.

8 years agostrace-S.test: check "-S name"
Dmitry V. Levin [Tue, 10 May 2016 00:03:59 +0000 (00:03 +0000)]
strace-S.test: check "-S name"

* tests/strace-S.test: Add a check for "-c -S name" output.

8 years agoFix NULL dereference in "-S name" when syscall table has holes
Dmitry V. Levin [Tue, 10 May 2016 00:16:20 +0000 (00:16 +0000)]
Fix NULL dereference in "-S name" when syscall table has holes

* count.c (syscall_cmp): Do not pass NULL to strcmp.

8 years agostrace-S.test: cleanup
Dmitry V. Levin [Mon, 9 May 2016 23:42:28 +0000 (23:42 +0000)]
strace-S.test: cleanup

* tests/strace-S.test: Rewrite using sed.

8 years agotests: add strace-S.test
Fei Jie [Thu, 5 May 2016 07:19:51 +0000 (15:19 +0800)]
tests: add strace-S.test

* tests/strace-S.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.

8 years agostrace-ff.test: check that -ff does not create unexpected output files
Dmitry V. Levin [Mon, 9 May 2016 23:15:52 +0000 (23:15 +0000)]
strace-ff.test: check that -ff does not create unexpected output files

* tests/strace-ff.expected: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/strace-ff.test: Use it.  Check that no other output files
have been created.

8 years agotests: add strace-ff.test
Fei Jie [Mon, 9 May 2016 06:19:56 +0000 (14:19 +0800)]
tests: add strace-ff.test

* tests/strace-ff.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.

8 years agostrace-V.test: cleanup
Dmitry V. Levin [Mon, 9 May 2016 23:19:37 +0000 (23:19 +0000)]
strace-V.test: cleanup

* tests/strace-V.test: Move config.h parser to a function.
Rename $OUT to $EXP, swap arguments passed to match_diff.

8 years agotests: add strace-V.test
Fei Jie [Mon, 9 May 2016 06:19:55 +0000 (14:19 +0800)]
tests: add strace-V.test

* tests/strace-V.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.

8 years agotests: check decoding of epoll_pwait syscall
Dmitry V. Levin [Mon, 9 May 2016 22:11:24 +0000 (22:11 +0000)]
tests: check decoding of epoll_pwait syscall

* tests/epoll_pwait.c: New file.
* tests/epoll_pwait.test: New test.
* tests/.gitignore: Add epoll_pwait.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add epoll_pwait.test.

8 years agoAssume that sys/epoll.h exists
Dmitry V. Levin [Mon, 9 May 2016 21:46:17 +0000 (21:46 +0000)]
Assume that sys/epoll.h exists

This header file was added in glibc-2.3.2,
so it's safe to assume its availability.

* configure.ac (AC_CHECK_HEADERS): Remove sys/epoll.h.
* epoll.c: Include <sys/epoll.h> unconditionally.
Compile [HAVE_SYS_EPOLL_H] code unconditionally.
* tests/epoll_ctl.c: Do not check for HAVE_SYS_EPOLL_H.
* tests/epoll_wait.c: Likewise.

8 years agoFactorize send_query functions
Fabien Siron [Sun, 8 May 2016 10:45:52 +0000 (10:45 +0000)]
Factorize send_query functions

* socketutils.c (send_query): New function.
(inet_send_query, unix_send_query): Use it.

8 years agotests: relax timings
Dmitry V. Levin [Sun, 8 May 2016 00:00:18 +0000 (00:00 +0000)]
tests: relax timings

Allow nanosleep(2) to spend 10% more time to make the test suite
more reliable on slow systems.

* tests/count.test: Treat 1.1 seconds as valid output.
* tests/strace-T.expected: Likewise.
* tests/strace-r.expected: Likewise.

8 years agotests/attach-f-p.c: increase timeouts
Dmitry V. Levin [Sat, 7 May 2016 23:51:47 +0000 (23:51 +0000)]
tests/attach-f-p.c: increase timeouts

Increase timeouts to make the test more reliable on slow systems.

* tests/attach-f-p.c (its): Increase timeouts to 1, 2, and 3 seconds,
respectively.

8 years agoRemove unused functions
Dmitry V. Levin [Sat, 7 May 2016 23:17:29 +0000 (23:17 +0000)]
Remove unused functions

* defs.h (umove_ulong_or_printaddr, umove_ulong_array_or_printaddr):
Remove.
* util.c (umove_ulong_or_printaddr, umove_ulong_array_or_printaddr):
Likewise.

8 years agov4l2.c: use print_array function
Dmitry V. Levin [Sat, 7 May 2016 23:15:36 +0000 (23:15 +0000)]
v4l2.c: use print_array function

* v4l2.c (print_v4l2_ext_control, umoven_or_printaddr_ignore_syserror):
New functions.
(print_v4l2_ext_controls): Use them via print_array.

8 years agouid.c: use print_array function
Dmitry V. Levin [Sat, 7 May 2016 23:14:24 +0000 (23:14 +0000)]
uid.c: use print_array function

* uid.c (print_gid): New function.
(print_groups): Use it via print_array.

8 years agoseccomp.c: use print_array function
Dmitry V. Levin [Sat, 7 May 2016 23:11:52 +0000 (23:11 +0000)]
seccomp.c: use print_array function

* seccomp.c (decode_filter, decode_seccomp_fprog): Remove.
(print_bpf_filter): New function.
(print_seccomp_fprog): Use it via print_array.
* tests/seccomp-filter-v.c (main): Update.

8 years agoscsi.c: use print_array function
Dmitry V. Levin [Sat, 7 May 2016 23:10:50 +0000 (23:10 +0000)]
scsi.c: use print_array function

* scsi.c (print_uchar): New function.
(print_sg_io_buffer): Use it via print_array.

8 years agopoll.c: use print_array function
Dmitry V. Levin [Sat, 7 May 2016 23:09:09 +0000 (23:09 +0000)]
poll.c: use print_array function

* poll.c (print_pollfd): Change for use as print_array callback.
(decode_poll_entering): Use print_array.
* tests/poll.c: Update.
* tests/poll.test: Update.

8 years agonuma.c: use print_array function
Dmitry V. Levin [Sat, 7 May 2016 23:02:36 +0000 (23:02 +0000)]
numa.c: use print_array function

* numa.c (print_node): New function.
(print_nodemask): Use it via print_array.
(print_page_array, print_int_array): Remove.
(print_addr): New function.
(print_status, print_int): Change for use as print_array callback.
(SYS_FUNC(move_pages)): Use print_addr, print_int, and print_status
via print_array.
* tests/move_pages.c: Update.
* tests/set_mempolicy.c: Likewise.
* tests/set_mempolicy.test: Likewise.

8 years agomem.c: use print_array function
Dmitry V. Levin [Sat, 7 May 2016 23:00:52 +0000 (23:00 +0000)]
mem.c: use print_array function

* mem.c [POWERPC] (print_protmap_entry): New function.
[POWERPC] (SYS_FUNC(subpage_prot)): Use it via print_array.

8 years agokexec.c: use print_array function
Dmitry V. Levin [Sat, 7 May 2016 22:59:05 +0000 (22:59 +0000)]
kexec.c: use print_array function

* kexec.c (print_seg): Change for use as print_array callback.
(print_kexec_segments): Use print_array.

8 years agoipc_sem.c: use print_array function
Dmitry V. Levin [Sat, 7 May 2016 22:56:59 +0000 (22:56 +0000)]
ipc_sem.c: use print_array function

* ipc_sem.c (tprint_sembuf): Rename to print_sembuf, change signature
for use as print_array callback.
(tprint_sembuf_array): Use print_array.

8 years agoio.c: use print_array function
Dmitry V. Levin [Sat, 7 May 2016 22:54:04 +0000 (22:54 +0000)]
io.c: use print_array function

* io.c (print_iovec_config): New structure.
(print_iovec): New function.
(tprint_iov_upto): Use print_array.
* tests/preadv.c (main): Update.
* tests/pwritev.c (print_iovec, main): Likewise.

8 years agoepoll.c: use print_array function
Dmitry V. Levin [Sat, 7 May 2016 22:49:39 +0000 (22:49 +0000)]
epoll.c: use print_array function

* epoll.c (print_epoll_event): Change signature for use as print_array
callback, all users updated.
(print_epoll_event_array): Remove.
(epoll_wait_common): Change to use print_array instead
of print_epoll_event_array.

8 years agoaio.c: use print_array function
Dmitry V. Levin [Sat, 7 May 2016 22:40:06 +0000 (22:40 +0000)]
aio.c: use print_array function

* aio.c (print_iocbp): New function.
(SYS_FUNC(io_submit)): Use it via print_array.  Use widen_to_long
to process long int argument.
(print_io_event): Change to print struct io_event fetched elsewhere.
(SYS_FUNC(io_cancel)): Update use of print_io_event.
(SYS_FUNC(io_getevents)): Use print_io_event via print_array.
Use widen_to_long to print long int arguments.
* tests/aio.c (main): Check decoding of io_submit with negative "nr".

8 years agoIntroduce print_array function for consistent decoding of arrays
Dmitry V. Levin [Fri, 6 May 2016 23:26:43 +0000 (23:26 +0000)]
Introduce print_array function for consistent decoding of arrays

* defs.h (print_array): New prototype.
* util.c (print_array): New function.

8 years agoFix corner cases of ICMP_FILTER decoding
Dmitry V. Levin [Fri, 6 May 2016 00:06:15 +0000 (00:06 +0000)]
Fix corner cases of ICMP_FILTER decoding

* net.c (print_icmp_filter): Print icmp_filter for any positive length.
* tests/net-icmp_filter.c: New file.
* tests/net-icmp_filter.test: New test.
* tests/.gitignore: Add net-icmp_filter.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add net-icmp_filter.test.

8 years agoxlat: do not strip "1<<" prefix from xlat strings
Dmitry V. Levin [Thu, 5 May 2016 21:50:23 +0000 (21:50 +0000)]
xlat: do not strip "1<<" prefix from xlat strings

* xlat/gen.sh (cond_xlat, gen_header): Do not strip "1<<" prefix
from xlat strings to fix incorrect output.
* tests/caps.awk: Update.

Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
8 years agotests/xstatfsx.c: fix mips o32 support
Dmitry V. Levin [Wed, 4 May 2016 21:43:18 +0000 (21:43 +0000)]
tests/xstatfsx.c: fix mips o32 support

mips o32 differs from all other 32-bit architectures by defining
__kernel_fsid_t structure as an array of long ints.

* tests/xstatfsx.c (print_statfs): Explicitly cast elements
of PRINT_F_FSID array to unsigned int.

8 years agoMpersify VIDIOC_* ioctl parser
Dmitry V. Levin [Tue, 3 May 2016 22:30:41 +0000 (22:30 +0000)]
Mpersify VIDIOC_* ioctl parser

* v4l2.c: Mpersify arch-specific structures.
(v4l2_ioctl): Mpersify.
* tests/ioctl_v4l2.c: New file.
* tests/ioctl_v4l2.test: New test.
* tests/.gitignore: Add ioctl_v4l2.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_v4l2.test.

8 years agoMpersify ioctl macros
Dmitry V. Levin [Mon, 2 May 2016 22:06:56 +0000 (22:06 +0000)]
Mpersify ioctl macros

As values of some ioctl macros differ between personalities, these
personality specific ioctl macros should be properly defined for
mpersified code.  Implement this by redefining personality specific
ioctl macros from ioctlent*.h for each file that includes MPERS_DEFS.

* Makefile.am (ioctl_macros_h): New variable.
(ioctl_macros%.h): New rule.
(BUILT_SOURCES, CLEANFILES): Add $(ioctl_macros_h).
(m%_type_defs.h): #include MPERS_$(mpers_PREFIX)IOCTL_MACROS.
* defs.h [HAVE_M32_MPERS] (MPERS_m32_IOCTL_MACROS): New macro.
[HAVE_MX32_MPERS] (MPERS_mx32_IOCTL_MACROS): Likewise.

Acked-by: Elvira Khabirova <lineprinter0@gmail.com>
8 years agoFix decoding of VIDIOC_* ioctls
Dmitry V. Levin [Sun, 1 May 2016 17:25:24 +0000 (17:25 +0000)]
Fix decoding of VIDIOC_* ioctls

* v4l2.c: Fix numerous bugs in decoding of VIDIOC_* ioctls.
* tests/ioctl.c (main): Update.

8 years agonsyscalls.test: add mips o32 support
Dmitry V. Levin [Sat, 30 Apr 2016 17:15:04 +0000 (17:15 +0000)]
nsyscalls.test: add mips o32 support

Out-of-range syscalls looks differently on mips o32.

* tests/nsyscalls.c (main): Handle LINUX_MIPSO32.
* tests/nsyscalls.test: Trace syscall called "syscall" on mips.

8 years agoRemove initialization of big holes in syscallent.h files
Dmitry V. Levin [Fri, 29 Apr 2016 21:31:08 +0000 (21:31 +0000)]
Remove initialization of big holes in syscallent.h files

There is no need to explicitly initialize big holes after conversion
of syscallent.h files to use designated initializers.  For architectures
that have some data at the end of syscallent.h this initialization of
big holes is no-op, for others it just inflates the table unnecessarily.

* linux/arc/syscallent.h: Remove initialization of arch specific block
at the end of table.
* linux/metag/syscallent.h: Likewise.
* linux/nios2/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/tile/syscallent1.h: Likewise.
* linux/arm/syscallent.h: Remove explicit initialization of a big hole
before socket subcalls.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/powerpc64/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sparc64/syscallent.h: Likewise.
* linux/mips/syscallent-compat.h: Remove explicit initialization
of big holes between different mips ABIs.
* linux/mips/syscallent-n64.h: Remove explicit initialization
of big holes before socket subcalls and between different mips ABIs.
* linux/mips/syscallent-o32.h: Likewise.

8 years agoxlat: make "1<<val" syntax work with 64-bit values
Dmitry V. Levin [Fri, 29 Apr 2016 20:12:54 +0000 (20:12 +0000)]
xlat: make "1<<val" syntax work with 64-bit values

* xlat/gen.sh(cond_xlat, gen_header): Generate 1UUL<<val
for 1<<val syntax.

Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
8 years agoFix typo in XLAT_TYPE_PAIR
Dmitry V. Levin [Fri, 29 Apr 2016 20:04:38 +0000 (20:04 +0000)]
Fix typo in XLAT_TYPE_PAIR

* xlat.h (XLAT_TYPE_PAIR): Take "type" parameter.

Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
8 years agoFix decoding of move_pages syscall
Dmitry V. Levin [Fri, 29 Apr 2016 17:26:56 +0000 (17:26 +0000)]
Fix decoding of move_pages syscall

* numa.c (print_page_array, print_status, print_int, print_int_array):
New functions.
(SYS_FUNC(move_pages)): Rewrite using these functions.
* tests/move_pages.c: New file.
* tests/move_pages.test: New test.
* tests/.gitignore: Add move_pages.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add move_pages.test.

8 years agotests: check decoding of mbind syscall
Dmitry V. Levin [Fri, 29 Apr 2016 14:06:45 +0000 (14:06 +0000)]
tests: check decoding of mbind syscall

* tests/mbind.c: New file.
* tests/mbind.test: New test.
* tests/.gitignore: Add mbind.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add mbind.test.

8 years agoChange type of struct xlat.val to uint64_t
Jeff Mahoney [Thu, 28 Apr 2016 15:26:59 +0000 (11:26 -0400)]
Change type of struct xlat.val to uint64_t

Some ioctls have flags fields that are 64-bit.  A 32-bit val means
these flags will never be matched or printed.

* xlat.h: Include <stdint.h>.
(struct xlat): Change type of val to uint64_t.

8 years agoxlat: extend syntax with #val_type directive
Dmitry V. Levin [Fri, 29 Apr 2016 01:02:13 +0000 (01:02 +0000)]
xlat: extend syntax with #val_type directive

When #val_type directive is encountered, gen.sh starts using
XLAT_TYPE/XLAT_TYPE_PAIR macros instead of XLAT/XLAT_PAIR,
with #val_type's argument as a type.

For example, "#val_type uint64_t" means values of type uint64_t.

* xlat/gen.sh (gen_header, print_xlat, print_xlat_pair):
Add val_type support.

8 years agoxlat/gen.sh: prepare for adding #val_type directive support
Dmitry V. Levin [Fri, 29 Apr 2016 01:02:13 +0000 (01:02 +0000)]
xlat/gen.sh: prepare for adding #val_type directive support

This is essentially a no-op change that makes the following change
easier to read.

* xlat/gen.sh (print_xlat, print_xlat_pair): New functions.
(cond_xlat, gen_header): Use them.

8 years agoIntroduce XLAT_TYPE and XLAT_TYPE_PAIR macros
Dmitry V. Levin [Fri, 29 Apr 2016 00:03:48 +0000 (00:03 +0000)]
Introduce XLAT_TYPE and XLAT_TYPE_PAIR macros

* xlat.h (XLAT_TYPE): New macro, similar to XLAT but casts
to the specified type instead of unsigned int.
(XLAT_TYPE_PAIR): New macro, similar to XLAT_PAIR but casts
to the specified type instead of unsigned int.

8 years agoxlat: generate xlat pairs using new XLAT_PAIR macro
Dmitry V. Levin [Thu, 28 Apr 2016 23:58:34 +0000 (23:58 +0000)]
xlat: generate xlat pairs using new XLAT_PAIR macro

Before this change there were two forms of xlat entries: those that use XLAT
or XLAT_END macros, and others verbatim entries.  This change converts
the latter to use new XLAT_PAIR macro.

This is necessary for the upcoming change of xlat.val type.

* xlat.h (XLAT_PAIR): New macro.
* xlat/gen.sh (cond_xlat, gen_header): Use it.

8 years agoExplicitly cast argument of XLAT macro to unsigned int
Dmitry V. Levin [Thu, 28 Apr 2016 23:52:28 +0000 (23:52 +0000)]
Explicitly cast argument of XLAT macro to unsigned int

This is necessary for the upcoming change of xlat.val type.

* xlat.h (XLAT): Cast the argument to unsigned int.

8 years agoChange type of {s,t}print_open_modes's argument to unsigned
Dmitry V. Levin [Thu, 28 Apr 2016 23:40:37 +0000 (23:40 +0000)]
Change type of {s,t}print_open_modes's argument to unsigned

As "flags" argument of sprint_open_modes and tprint_open_modes is
involved only in bit operations, change its type to unsigned.

* defs.h.c (sprint_open_modes, tprint_open_modes): Change type
to unsigned int.
* open.c (sprint_open_modes, tprint_open_modes): Likewise.

8 years agotests/remap_file_pages.c: fix for the upcoming change of xlat.val type
Dmitry V. Levin [Thu, 28 Apr 2016 21:10:59 +0000 (21:10 +0000)]
tests/remap_file_pages.c: fix for the upcoming change of xlat.val type

The "flags" argument of remap_file_page syscall has type "unsigned
long", so it is not correct to load most significant bits with garbage
ans assume they are going to be ignored.

* tests/remap_file_pages.c (main): Remove artificial garbage from flags.

8 years agoIntroduce printflags64 function
Dmitry V. Levin [Thu, 28 Apr 2016 18:55:18 +0000 (18:55 +0000)]
Introduce printflags64 function

This is necessary for the upcoming change of xlat.val type.

* defs.h (printflags): Rename to printflags64, change type of integer
argument to uint64_t.
(printflags): New static inline function.
* util.c (printflags): Rename to printflags64, change type of integer
argument to uint64_t.  Print it using PRIx64 format.
Based on patch by Jeff Mahoney <jeffm@suse.com>.

8 years agoIntroduce sprintflags64 function
Dmitry V. Levin [Thu, 28 Apr 2016 18:49:36 +0000 (18:49 +0000)]
Introduce sprintflags64 function

This is necessary for the upcoming change of xlat.val type.

* defs.h (sprintflags): Rename to sprintflags64, change type of integer
argument to uint64_t.
(sprintflags): New static inline function.
* util.c (sprintflags): Rename to sprintflags64, change type of integer
argument to uint64_t.  Print it using PRIx64 format.
Based on patch by Jeff Mahoney <jeffm@suse.com>.

8 years agoprintxvals: change type of integer argument to uint64_t
Dmitry V. Levin [Thu, 28 Apr 2016 18:42:10 +0000 (18:42 +0000)]
printxvals: change type of integer argument to uint64_t

This is necessary for the upcoming change of xlat.val type.
All users of printxvals are already prepared for this change.

* defs.h (printxvals): Change type of integer argument to uint64_t.
* util.c (printxvals): Likewise.  Print it using PRIx64 format.
Patch by Jeff Mahoney <jeffm@suse.com>.

8 years agoxlat_search: change type of integer argument to uint64_t
Dmitry V. Levin [Thu, 28 Apr 2016 18:37:54 +0000 (18:37 +0000)]
xlat_search: change type of integer argument to uint64_t

This is necessary for the upcoming change of xlat.val type.
All users of addflags are already prepared for this change.

* defs.h (xlat_search): Change type of integer argument to uint64_t.
* util.c (xlat_search): Likewise.  Pass it by pointer.
(xlat_bsearch_compare): Treat first argument as a pointer.
Patch by Jeff Mahoney <jeffm@suse.com>.

8 years agoIntroduce xlookup64 function
Dmitry V. Levin [Thu, 28 Apr 2016 18:32:45 +0000 (18:32 +0000)]
Introduce xlookup64 function

This is necessary for the upcoming change of xlat.val type.

* defs.h (xlookup): Rename to xlookup64, change type of integer argument
to uint64_t.
(xlookup): New static inline function.
* util.c (xlookup): Rename to xlookup64, change type of integer
argument to uint64_t.
Based on patch by Jeff Mahoney <jeffm@suse.com>.

8 years agoaddflags: change type of integer argument to uint64_t
Dmitry V. Levin [Thu, 28 Apr 2016 18:19:27 +0000 (18:19 +0000)]
addflags: change type of integer argument to uint64_t

This is necessary for the upcoming change of xlat.val type.
All users of addflags are already prepared for this change.

* defs.h (addflags): Change type of integer argument to uint64_t.
* util.c (addflags): Likewise.  Print it using PRIx64 format.
Based on patch by Jeff Mahoney <jeffm@suse.com>.

8 years agoIntroduce printxval64 wrapper
Dmitry V. Levin [Thu, 28 Apr 2016 18:15:20 +0000 (18:15 +0000)]
Introduce printxval64 wrapper

This is necessary for the upcoming change of xlat.val type.

* defs.h (printxval64): New static inline function.

8 years agoTurn printxval macro into a static inline function
Dmitry V. Levin [Thu, 28 Apr 2016 17:50:51 +0000 (17:50 +0000)]
Turn printxval macro into a static inline function

This is necessary for the upcoming change of xlat.val type.

* defs.h (printxval): Change to static inline function.

8 years agotests: check decoding of migrate_pages syscall
Dmitry V. Levin [Thu, 28 Apr 2016 01:09:59 +0000 (01:09 +0000)]
tests: check decoding of migrate_pages syscall

* tests/migrate_pages.c: New file.
* tests/migrate_pages.test: New test.
* tests/.gitignore: Add migrate_pages.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add migrate_pages.test.

8 years agoFix decoding of migrate_pages syscall
Dmitry V. Levin [Thu, 28 Apr 2016 01:19:19 +0000 (01:19 +0000)]
Fix decoding of migrate_pages syscall

* numa.c (SYS_FUNC(migrate_pages)): Print syscall arguments
in the right order.

8 years agotests: check decoding of set_mempolicy syscall
Dmitry V. Levin [Wed, 27 Apr 2016 23:43:24 +0000 (23:43 +0000)]
tests: check decoding of set_mempolicy syscall

* tests/set_mempolicy.c: New file.
* tests/set_mempolicy.test: New test.
* tests/.gitignore: Add set_mempolicy.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add set_mempolicy.test.