]> granicus.if.org Git - strace/log
strace
8 years agoExport print_sockaddr function
Dmitry V. Levin [Tue, 21 Jun 2016 16:45:40 +0000 (16:45 +0000)]
Export print_sockaddr function

* defs.h (print_sockaddr): New prototype.
* net.c (print_sockaddr): Remove static keyword.
Change type of address pointer to "const void *".
(print_cmsg_ip_recverr, print_group_req): Remove redundant casts
in print_sockaddr invocations.

8 years agoxlat/addrfams.in: provide fallback definitions
Dmitry V. Levin [Tue, 21 Jun 2016 16:45:29 +0000 (16:45 +0000)]
xlat/addrfams.in: provide fallback definitions

* xlat/addrfams.in: add fallback definitions for constants.

8 years agoUpdate AF_* constants
Dmitry V. Levin [Tue, 21 Jun 2016 16:45:22 +0000 (16:45 +0000)]
Update AF_* constants

* xlat/addrfams.in: Add AF_QIPCRTR.

8 years agoAssume that libc provides inet_ntop and inet_pton
Dmitry V. Levin [Tue, 21 Jun 2016 16:44:50 +0000 (16:44 +0000)]
Assume that libc provides inet_ntop and inet_pton

* configure.ac (AC_CHECK_FUNCS): Remove inet_ntop and inet_pton.
* net.c (sockaddr_buf_t, print_sockaddr, print_mreq6): Remove
HAVE_INET_NTOP checks.
* tests/ip_mreq.c: Remove HAVE_INET_PTON check.

8 years agonet.c: use SO_LINGER unconditionally
Dmitry V. Levin [Tue, 21 Jun 2016 16:44:15 +0000 (16:44 +0000)]
net.c: use SO_LINGER unconditionally

* net.c (print_linger, print_getsockopt, print_setsockopt): Do not check
for SO_LINGER availability.

8 years agonet.c: use AF_BLUETOOTH unconditionally
Dmitry V. Levin [Tue, 21 Jun 2016 16:43:30 +0000 (16:43 +0000)]
net.c: use AF_BLUETOOTH unconditionally

* net.c (print_sockaddr, SYS_FUNC(socket)): Do not check
for AF_BLUETOOTH availability.

8 years agoConsistently use AF_UNIX over AF_LOCAL
Dmitry V. Levin [Mon, 20 Jun 2016 22:52:49 +0000 (22:52 +0000)]
Consistently use AF_UNIX over AF_LOCAL

As these constants have the same value 1, let's use and print only one
of them, e.g. AF_UNIX.

* xlat/addrfams.in (AF_LOCAL): Remove.
* tests/net-accept-connect.c (main): Replace AF_LOCAL with AF_UNIX.
* tests/net-y-unix.c: Likewise.
* tests/net-yy-unix.c: Likewise.
* tests/netlink_unix_diag.c: Likewise.

8 years agonet.c: fix printing AF_IPX sockets
Dmitry V. Levin [Sun, 19 Jun 2016 22:02:45 +0000 (22:02 +0000)]
net.c: fix printing AF_IPX sockets

* net.c (print_sockaddr): Print sockaddr_ipx as a regular structure.
(SYS_FUNC(socket)): Remove special handling of AF_IPX.

8 years agonet.c: use AF_IPX unconditionally
Dmitry V. Levin [Sun, 19 Jun 2016 22:02:45 +0000 (22:02 +0000)]
net.c: use AF_IPX unconditionally

* net.c (sockaddr_buf_t, print_sockaddr, SYS_FUNC(socket)): Do not check
for AF_IPX availability.

8 years agoCleanup netipx/ipx.h availability check
Dmitry V. Levin [Sun, 19 Jun 2016 22:02:45 +0000 (22:02 +0000)]
Cleanup netipx/ipx.h availability check

* configure.ac (AC_CHECK_HEADERS): Add netipx/ipx.h.
* net.c: Check for HAVE_NETIPX_IPX_H instead of __GLIBC__.

8 years agoMake getfdproto return enum instead of string
Fabien Siron [Fri, 17 Jun 2016 16:29:53 +0000 (16:29 +0000)]
Make getfdproto return enum instead of string

Introduce a new enum type sock_proto and use it instead of strings for socket
protocols identification.

* defs.h (sock_proto): New enum.
(get_proto_by_name): New function.
* socketutils.c (protocols): New static table.
(print_sockaddr_by_inode): Use it.  Change type of "proto" argument
to sock_proto.
(get_proto_by_name): New function.
* util.c (getfdproto): Use it.  Change return type to sock_proto.
(printfd): Update.

8 years agoSplit travis-ci.sh
Dmitry V. Levin [Sat, 18 Jun 2016 22:53:25 +0000 (22:53 +0000)]
Split travis-ci.sh

* travis-ci.sh: Split into travis-build.sh, travis-install.sh,
and travis-success.sh files.
* .travis.yml (before_install, after_success, git): New mappings.
(script): Change to travis-build.sh.
(addons, install): Remove.
(env): Remove matrix.
(matrix): Replace exclude list with include list.

8 years agoIntroduce HAVE_STRUCT_TCB_EXT_ARG macro
Dmitry V. Levin [Fri, 17 Jun 2016 16:12:13 +0000 (16:12 +0000)]
Introduce HAVE_STRUCT_TCB_EXT_ARG macro

Check for "if HAVE_STRUCT_TCB_EXT_ARG" instead of
"if defined LINUX_MIPSN32 || defined X32".

* defs.h (HAVE_STRUCT_TCB_EXT_ARG): Define for LINUX_MIPSN32 || X32.
(struct tcb): Check it instead of LINUX_MIPSN32 || X32.
(RVAL_LUDECIMAL): Likewise.
* io.c (print_lld_from_low_high_val): Likewise.
* lseek.c (SYS_FUNC(lseek)): Likewise.
* mem.c (SYS_FUNC(mmap)): Likewise.
* syscall.c (trace_syscall_exiting): Likewise.
* util.c (getllval): Likewise.

8 years agobtrfs: fix build with fresh linux/btrfs.h
Dmitry V. Levin [Fri, 17 Jun 2016 00:44:44 +0000 (00:44 +0000)]
btrfs: fix build with fresh linux/btrfs.h

Fix build with fresh <linux/btrfs.h> that provides a slightly different
definition of struct btrfs_ioctl_defrag_range_args.

* btrfs.c (btrfs_ioctl): Cast "len" member of
struct btrfs_ioctl_defrag_range_args to uint64_t.
* tests/btrfs.c (btrfs_print_defrag_range_args): Cast "start" and "len"
members of struct btrfs_ioctl_defrag_range_args to uint64_t.

8 years agobtrfs: provide fallback definitions for BTRFS_IOC_QUOTA_RESCAN*
Dmitry V. Levin [Fri, 17 Jun 2016 00:02:46 +0000 (03:02 +0300)]
btrfs: provide fallback definitions for BTRFS_IOC_QUOTA_RESCAN*

<linux/btrfs.h> was introduced in linux v3.9-rc1 while some
of btrfs ioctls were added later, e.g. BTRFS_IOC_QUOTA_RESCAN
and BTRFS_IOC_QUOTA_RESCAN_STATUS in v3.10-rc2,
or BTRFS_IOC_QUOTA_RESCAN_WAIT in v3.11-rc1.

* btrfs.c [!BTRFS_IOC_QUOTA_RESCAN]
(struct btrfs_ioctl_quota_rescan_args): New structure.
(BTRFS_IOC_QUOTA_RESCAN, BTRFS_IOC_QUOTA_RESCAN_STATUS): New macros.
[!BTRFS_IOC_QUOTA_RESCAN_WAIT] (BTRFS_IOC_QUOTA_RESCAN_WAIT): New macro.
* tests/btrfs.c: Likewise.

Reported-by: Li Er <phoooyb@gmail.com>
8 years agoconfigure.ac: fix checks for btrfs specific structures
Dmitry V. Levin [Thu, 16 Jun 2016 23:21:57 +0000 (23:21 +0000)]
configure.ac: fix checks for btrfs specific structures

* configure.ac (AC_CHECK_MEMBERS): Fix typo in the check for
struct btrfs_ioctl_defrag_range_args.start and
struct btrfs_ioctl_search_args_v2.buf_size.

8 years agoREADME: add system requirements and beautify the file
Elvira Khabirova [Thu, 16 Jun 2016 17:17:59 +0000 (20:17 +0300)]
README: add system requirements and beautify the file

8 years agotests: add signal_receive.test
Fei Jie [Thu, 16 Jun 2016 02:42:14 +0000 (10:42 +0800)]
tests: add signal_receive.test

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

8 years agotests: add signal2name function to libtests
Fei Jie [Thu, 16 Jun 2016 02:42:13 +0000 (10:42 +0800)]
tests: add signal2name function to libtests

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

8 years agonet.c: use AF_INET6 unconditionally
Dmitry V. Levin [Wed, 15 Jun 2016 21:56:58 +0000 (21:56 +0000)]
net.c: use AF_INET6 unconditionally

* net.c (SYS_FUNC(socket)): Do not check for AF_INET6 availability.

8 years agoconfigure.ac: do not check for linux/in6.h
Dmitry V. Levin [Wed, 15 Jun 2016 21:49:27 +0000 (21:49 +0000)]
configure.ac: do not check for linux/in6.h

The last user of <linux/in6.h> was removed by commit v4.9-252-gf362a33.

* configure.ac (AC_CHECK_HEADERS): Remove linux/in6.h.

8 years agonet.c: use AF_PACKET unconditionally
Dmitry V. Levin [Wed, 15 Jun 2016 21:42:30 +0000 (21:42 +0000)]
net.c: use AF_PACKET unconditionally

* net.c: Do not check for AF_PACKET availability.

8 years agonet.c: include <linux/if_packet.h> unconditionally
Dmitry V. Levin [Wed, 15 Jun 2016 21:35:48 +0000 (21:35 +0000)]
net.c: include <linux/if_packet.h> unconditionally

* configure.ac (AC_CHECK_HEADERS): Remove linux/if_packet.h.
* net.c: Include <linux/if_packet.h> unconditionally.

8 years agonet.c: use ICMP_FILTER unconditionally
Dmitry V. Levin [Wed, 15 Jun 2016 21:29:07 +0000 (21:29 +0000)]
net.c: use ICMP_FILTER unconditionally

* net.c: Do not check for ICMP_FILTER availability.

8 years agonet.c: include <linux/icmp.h> unconditionally
Dmitry V. Levin [Wed, 15 Jun 2016 21:27:41 +0000 (21:27 +0000)]
net.c: include <linux/icmp.h> unconditionally

* configure.ac (AC_CHECK_HEADERS): Remove linux/icmp.h.
* net.c: Follow the example of tests/net-icmp_filter.c and include
<linux/icmp.h> unconditionally.

8 years agonet.c: use AF_NETLINK unconditionally
Dmitry V. Levin [Tue, 14 Jun 2016 13:53:47 +0000 (13:53 +0000)]
net.c: use AF_NETLINK unconditionally

* net.c: Do not check for AF_NETLINK availability.

8 years agonet.c: include <linux/netlink.h> unconditionally
Dmitry V. Levin [Tue, 14 Jun 2016 13:53:47 +0000 (13:53 +0000)]
net.c: include <linux/netlink.h> unconditionally

* configure.ac (AC_CHECK_HEADERS): Remove linux/netlink.h.
* net.c: Follow the example of socketutils.c and include
<linux/netlink.h> unconditionally.

8 years agoRemove UNDEFINED_SCNO
Elvira Khabirova [Sun, 12 Jun 2016 16:11:43 +0000 (19:11 +0300)]
Remove UNDEFINED_SCNO

Since UNDEFINED_SCNO is set if and only if !SCNO_IS_VALID
and since tcp->s_ent can only be set to &sysent[tcp->scno]
(or to &unknown, but only when !SCNO_IS_VALID), there is no need
to check for UNDEFINED_SCNO before calling syscall_name(tcp->scno).

* defs.h (UNDEFINED_SCNO): Remove.
* syscall.c (get_scno, trace_syscall_entering, trace_syscall_exiting):
Remove checks for UNDEFINED_SCNO.

8 years agotests/attach-f-p.c: fix typo in comment
Dmitry V. Levin [Mon, 13 Jun 2016 22:15:49 +0000 (22:15 +0000)]
tests/attach-f-p.c: fix typo in comment

8 years agostrace.c: fix style in function definition
Elvira Khabirova [Sun, 12 Jun 2016 22:43:15 +0000 (01:43 +0300)]
strace.c: fix style in function definition

* strace.c (kill_save_errno): Move the type of return value
to another line.

8 years agoTurn on more compiler warnings
Elvira Khabirova [Sun, 12 Jun 2016 22:41:02 +0000 (01:41 +0300)]
Turn on more compiler warnings

* configure.ac (gl_WARN_ADD): Add -Wempty-body, -Wformat-security,
-Wignored-qualifiers, -Winit-self, -Wlogical-op,
-Wmissing-parameter-type, -Wnested-externs, -Wold-style-declaration,
-Wold-style-definition, -Wtype-limits.

8 years agostrace.c: fix a warning reported by -Wold-style-definition
Elvira Khabirova [Sun, 12 Jun 2016 22:41:33 +0000 (01:41 +0300)]
strace.c: fix a warning reported by -Wold-style-definition

* strace.c (usage): Add void to the list of function argments.

8 years agotests/ioctl_evdev.c: fix typo in comment
Dmitry V. Levin [Sun, 12 Jun 2016 22:12:33 +0000 (22:12 +0000)]
tests/ioctl_evdev.c: fix typo in comment

8 years agoMove printargs* functions to util.c
Elvira Khabirova [Sun, 12 Jun 2016 13:39:02 +0000 (16:39 +0300)]
Move printargs* functions to util.c

* syscall.c (printargs, printargs_u, printargs_d): Move ...
* util.c: ... here.

8 years agotests/xgetrlimit.c: fix a warning reported by -Wtype-limits
Elvira Khabirova [Sat, 11 Jun 2016 17:27:16 +0000 (20:27 +0300)]
tests/xgetrlimit.c: fix a warning reported by -Wtype-limits

* tests/xgetrlimit.c (sprint_rlim): Explicitly cast constants
to the type of argument.

8 years agoConsistently use printaddr for printing addresses
Dmitry V. Levin [Sat, 11 Jun 2016 01:28:21 +0000 (01:28 +0000)]
Consistently use printaddr for printing addresses

* bjm.c (SYS_FUNC(init_module)): Use printaddr.
* clone.c (SYS_FUNC(clone)): Likewise.
* evdev.c (ff_effect_ioctl): Likewise.
* mtd.c (decode_mtd_oob_buf): Likewise.
* net.c (SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg), SYS_FUNC(getsockopt)):
Likewise.
* print_sigevent.c (print_sigevent): Likewise.
* printsiginfo.c (printsigval, print_si_info): Likewise.
* signal.c (decode_new_sigaction): Likewise.
* sysmips.c (SYS_FUNC(sysmips)): Likewise.
* util.c (printpathn, printstr, umoven_or_printaddr): Likewise.
* v4l2.c (print_v4l2_buffer, print_v4l2_framebuffer,
umoven_or_printaddr_ignore_syserror): Likewise.
* tests/net-icmp_filter.c (main): Update.

Based on patch by Eugene Syromyatnikov <evgsyr@gmail.com>.

8 years agotests/attach-p-cmd-p.c: cleanup
Dmitry V. Levin [Fri, 10 Jun 2016 14:20:25 +0000 (14:20 +0000)]
tests/attach-p-cmd-p.c: cleanup

* attach-p-cmd-p.c (handler): Move code ...
(main): ... here.  Unblock SIGALRM only.
Use alarm() instead of setitimer().
Replace endless loop with a pause() call.
Check that chdir() returns ENOENT.

8 years agotests: enhance test coverage of SIGCHLD siginfo_t
Dmitry V. Levin [Fri, 10 Jun 2016 09:22:12 +0000 (09:22 +0000)]
tests: enhance test coverage of SIGCHLD siginfo_t

* tests/siginfo.c: New file.
* tests/siginfo.test: New test.
* tests/wait.c: Remove.
* tests/wait.expected: Remove.
* tests/wait.test: Remove.
* tests/.gitignore: Add siginfo, remove wait.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add siginfo.test, remove wait.test.
(EXTRA_DIST): Remove wait.expected.

8 years agotests: extend test coverage of waitid syscall
Dmitry V. Levin [Fri, 10 Jun 2016 09:16:10 +0000 (09:16 +0000)]
tests: extend test coverage of waitid syscall

* tests/waitid.c: New file.
* tests/waitid-v.c: Likewise.
* tests/waitid.test: New test.
* tests/waitid-v.test: Likewise.
* tests/.gitignore: Add waitid and waitid-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add waitid.test and waitid-v.test.

8 years agotests: extend test coverage of wait4 syscall
Dmitry V. Levin [Fri, 10 Jun 2016 09:15:59 +0000 (09:15 +0000)]
tests: extend test coverage of wait4 syscall

* tests/wait4.c: New file.
* tests/wait4-v.c: Likewise.
* tests/wait4.test: New test.
* tests/wait4-v.test: Likewise.
* tests/.gitignore: Add wait4 and wait4-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add wait4.test and wait4-v.test.

8 years agotests: add widen_to_ull macro to tests.h
Dmitry V. Levin [Fri, 10 Jun 2016 09:13:32 +0000 (09:13 +0000)]
tests: add widen_to_ull macro to tests.h

* tests.h (widen_to_ull): New macro, copied from defs.h

8 years agoFix sign extension issues in the parser of struct rusage
Dmitry V. Levin [Fri, 10 Jun 2016 01:27:45 +0000 (01:27 +0000)]
Fix sign extension issues in the parser of struct rusage

* printrusage.c (printrusage): Do not cast members of struct rusage
to type long, use widen_to_ull instead.

8 years agotests: check decoding of waitpid syscall
Dmitry V. Levin [Thu, 9 Jun 2016 01:29:45 +0000 (01:29 +0000)]
tests: check decoding of waitpid syscall

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

8 years agotests: add strace-E.test
Fei Jie [Wed, 8 Jun 2016 02:31:29 +0000 (10:31 +0800)]
tests: add strace-E.test

* tests/strace-E.expected: New file.
* tests/strace-E.test: New test.
* tests/Makefile.am (MISC_TESTS): Add it.
(EXTRA_DIST): Add strace-E.expected.

8 years agostrace.spec.in: enable libunwind on more platforms
Dmitry V. Levin [Wed, 8 Jun 2016 10:02:42 +0000 (10:02 +0000)]
strace.spec.in: enable libunwind on more platforms

* strace.spec.in: Add libunwind-devel to BuildRequires for RHEL8 family.

8 years agomake-dist: generate strace-*.tar.gz, strace.dsc, and strace.spec
Dmitry V. Levin [Wed, 8 Jun 2016 00:32:22 +0000 (00:32 +0000)]
make-dist: generate strace-*.tar.gz, strace.dsc, and strace.spec

Change make-dist to generate strace-*.tar.gz, strace.dsc,
and strace.spec in addition to strace-*.tar.xz.

* configure.ac (AM_INIT_AUTOMAKE): Remove no-dist-gzip.
* make-dsc: New file.
* make-dist: Use it.
* .gitignore: Add strace-*.tar.gz, strace.dsc, and strace.spec.

8 years agoParametrize debian/changelog
Dmitry V. Levin [Wed, 8 Jun 2016 00:32:09 +0000 (00:32 +0000)]
Parametrize debian/changelog

* configure.ac (CHANGELOGTIME): Rename to RPM_CHANGELOGTIME.
(DEB_CHANGELOGTIME): New variable.
(AC_CONFIG_FILES): Add debian/changelog.
* strace.spec.in: Rename CHANGELOGTIME to RPM_CHANGELOGTIME.
* debian/changelog: Rename to ...
* debian/changelog.in: ... this file.  Add parametrized entry.
* debian/.gitignore: New file.

8 years agogit-version-gen: replace '-' with '.' in generated version
Dmitry V. Levin [Wed, 8 Jun 2016 00:23:28 +0000 (00:23 +0000)]
git-version-gen: replace '-' with '.' in generated version

* git-version-gen: Replace '-' with '.' so version conforms to policies
* configure.ac (SPEC_VERSION): Remove.
* strace.spec.in: Replace SPEC_VERSION with PACKAGE_VERSION.
Remove %srcname.

8 years agoParametrize strace.spec
Dmitry V. Levin [Tue, 7 Jun 2016 18:04:53 +0000 (18:04 +0000)]
Parametrize strace.spec

* configure.ac (SPEC_VERSION, CHANGELOGTIME): Define.
(AC_CONFIG_FILES): Add strace.spec.
* strace.spec: Rename to ...
* strace.spec.in: ... this file.  Parametrize Version, srcname,
and the last %changelog entry.  Initialize .tarball-version file.

8 years agostrace.spec: adopt for OBS
Dmitry V. Levin [Tue, 7 Jun 2016 18:03:21 +0000 (18:03 +0000)]
strace.spec: adopt for OBS

* strace.spec: Parametrize libunwind-devel BRs, BuildRoot, and %defattr.

8 years agotests: remove obsolete strace-f.test
Dmitry V. Levin [Tue, 7 Jun 2016 17:52:53 +0000 (17:52 +0000)]
tests: remove obsolete strace-f.test

strace-f.test is too inexact while fork-f.test does the right thing.

* tests/strace-f.test: Remove.
* tests/Makefile.am (MISC_TESTS): Remove it.
* strace.spec (BuildRequires): Remove time.

8 years agotests: always distribute strace-k.test
Dmitry V. Levin [Tue, 7 Jun 2016 09:32:17 +0000 (09:32 +0000)]
tests: always distribute strace-k.test

Fix distribution of tests/strace-k.test file when configured
without libunwind.

* tests/Makefile.am (EXTRA_DIST): Add strace-k.test.

8 years agomake-dist: skip news-check for non-releases
Dmitry V. Levin [Tue, 7 Jun 2016 09:17:12 +0000 (09:17 +0000)]
make-dist: skip news-check for non-releases

* make-dist: Run news-check only when the commit being built
matches a release tag.

8 years agotests: check decoding of setrlimit, getrlimit, and ugetrlimit syscalls
Dmitry V. Levin [Mon, 6 Jun 2016 21:26:08 +0000 (21:26 +0000)]
tests: check decoding of setrlimit, getrlimit, and ugetrlimit syscalls

* tests/getrlimit.c: New file.
* tests/setrlimit.c: Likewise.
* tests/ugetrlimit.c: Likewise.
* tests/xgetrlimit.c: Likewise.
* tests/getrlimit.test: New test.
* tests/setrlimit.test: Likewise.
* tests/ugetrlimit.test: Likewise.
* tests/.gitignore: Add getrlimit, setrlimit, and ugetrlimit.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add getrlimit.test, setrlimit.test,
and ugetrlimit.test.
(EXTRA_DIST): Add xgetrlimit.c.

8 years agotests: check decoding of prlimit64 syscall
Dmitry V. Levin [Mon, 6 Jun 2016 21:25:54 +0000 (21:25 +0000)]
tests: check decoding of prlimit64 syscall

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

8 years agoFix decoding of pid_t argument of prlimit64 syscall
Dmitry V. Levin [Mon, 6 Jun 2016 21:25:36 +0000 (21:25 +0000)]
Fix decoding of pid_t argument of prlimit64 syscall

* resource.c (SYS_FUNC(prlimit64)): Print pid_t syscall
argument using %d format.

8 years agoDo not check for old sysctl enums
Dmitry V. Levin [Mon, 6 Jun 2016 15:39:11 +0000 (15:39 +0000)]
Do not check for old sysctl enums

Assume that sysctl enums defined since linux v2.6 are always defined,
with a signle exception: check for CTL_PROC which definition was removed
in v2.6.18 and restored later in v2.6.23.

* configure.ac (AC_CHECK_DECLS): Remove old constants.
* xlat/sysctl_kern.in: Mark constants older than KERN_PRINTK_RATELIMIT
as unconditional.
* xlat/sysctl_net.in: Mark constants older than NET_LLC
as unconditional.
* xlat/sysctl_net_core.in: Mark constants older than NET_CORE_BUDGET
as unconditional.
* xlat/sysctl_net_ipv4.in: Mark constants older than
NET_IPV4_IGMP_MAX_MSF as unconditional.
* xlat/sysctl_net_ipv4_conf.in: Mark constants older than
NET_IPV4_CONF_FORCE_IGMP_VERSION as unconditional.
* xlat/sysctl_net_ipv4_route.in: Mark constants older than
NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS as unconditional.
* xlat/sysctl_net_ipv6.in: Mark constants older than
NET_IPV6_MLD_MAX_MSF as unconditional.
* xlat/sysctl_net_ipv6_route.in: Mark constants older than
NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS as unconditional.
* xlat/sysctl_net_unix.in: Mark all constants as unconditional.
* xlat/sysctl_root.in: Mark constants older than CTL_ARLAN
as unconditional.
* xlat/sysctl_vm.in: Mark constants older than VM_MAX_MAP_COUNT
as unconditional.

8 years agoxlat: extend syntax
Dmitry V. Levin [Mon, 6 Jun 2016 15:08:45 +0000 (15:08 +0000)]
xlat: extend syntax

* xlat/gen.sh: Implement #conditional directive that turns on
preprocessor checks turned off earlier by #unconditional directive.

8 years agompers.awk: remove unnecessary type attribute retrieval
Elvira Khabirova [Mon, 6 Jun 2016 01:57:59 +0000 (04:57 +0300)]
mpers.awk: remove unnecessary type attribute retrieval

* mpers.awk (what_is): Do not retrieve "type" attribute
for "enumeration_type".

8 years agotests/ptrace.c: fix fork() return value check
Elvira Khabirova [Sun, 5 Jun 2016 23:39:59 +0000 (02:39 +0300)]
tests/ptrace.c: fix fork() return value check

* tests/ptrace.c (test_peeksiginfo): Explicitly cast fork() return value
to pid_t.

8 years ago.gitignore: add missing files that should be ignored
Elvira Khabirova [Mon, 6 Jun 2016 00:24:19 +0000 (03:24 +0300)]
.gitignore: add missing files that should be ignored

* .gitignore: Add ioctl_redefs[12].h and libstrace.a.

8 years agodebian: sync with the package
Dmitry V. Levin [Sun, 5 Jun 2016 23:08:58 +0000 (23:08 +0000)]
debian: sync with the package

* debian/control (Build-Depends) [amd64]: Remove libunwind-dev.
* debian/changelog: Sync with 4.12-3.
* debian/rules: Likewise.

8 years agotests/strace-S.test: fix testing 64-bit strace using a 32-bit userspace
Dmitry V. Levin [Sat, 4 Jun 2016 23:40:40 +0000 (23:40 +0000)]
tests/strace-S.test: fix testing 64-bit strace using a 32-bit userspace

* tests/strace-S.test: Measure wall clock time instead of system time.
Use local "./readv" instead of system "date" as a sample executable.

Reported-by: Steve McIntyre <steve@einval.com>
8 years agotests/strace-S.test: enhance error diagnostics
Dmitry V. Levin [Fri, 3 Jun 2016 23:46:27 +0000 (23:46 +0000)]
tests/strace-S.test: enhance error diagnostics

* tests/strace-S.test: If strace output does not meet expectations,
print the output.

8 years ago.gitignore: sort the list of ignored patterns
Dmitry V. Levin [Thu, 2 Jun 2016 22:59:20 +0000 (22:59 +0000)]
.gitignore: sort the list of ignored patterns

* .gitignore: Sort.

8 years agomaint: post-release administrivia
Dmitry V. Levin [Wed, 1 Jun 2016 23:56:14 +0000 (23:56 +0000)]
maint: post-release administrivia

* NEWS: Add header line for the next release.

8 years agoPrepare for 4.12 release v4.12
Dmitry V. Levin [Tue, 31 May 2016 11:12:13 +0000 (11:12 +0000)]
Prepare for 4.12 release

* NEWS: Update for 4.12 release.
* debian/changelog: 4.12-1.
* strace.spec: 4.12-1.

8 years agoSync strace.spec and debian/changelog with packages
Dmitry V. Levin [Tue, 31 May 2016 10:47:53 +0000 (10:47 +0000)]
Sync strace.spec and debian/changelog with packages

* debian/changelog: Sync with 4.11-1.
* strace.spec: Sync with 4.11.0.163.9720-2.

8 years agoMpersify hdio.c
Dmitry V. Levin [Mon, 30 May 2016 00:25:03 +0000 (00:25 +0000)]
Mpersify hdio.c

* defs.h (hdio_ioctl): Remove.
* hdio.c: Mpersify struct hd_geometry.
(hdio_ioctl): Mpersify.

8 years agoloop.c: decode LOOP_SET_DIRECT_IO
Dmitry V. Levin [Sun, 29 May 2016 22:58:56 +0000 (22:58 +0000)]
loop.c: decode LOOP_SET_DIRECT_IO

* loop.c (loop_ioctl) [LOOP_SET_DIRECT_IO] : Handle LOOP_SET_DIRECT_IO.

8 years agoloop.c: fix printing of arrays
Dmitry V. Levin [Sun, 29 May 2016 22:34:30 +0000 (22:34 +0000)]
loop.c: fix printing of arrays

* loop.c (decode_loop_info): Use square brackets to print
struct loop_info.lo_init and struct loop_info.reserved arrays.
(decode_loop_info64): Use square brackets to print
struct loop_info64.lo_init array.

8 years agoloop.c: fix printing of structure members' names
Dmitry V. Levin [Sun, 29 May 2016 22:28:28 +0000 (22:28 +0000)]
loop.c: fix printing of structure members' names

* loop.c (decode_loop_info, decode_loop_info64): Do not strip "lo_"
prefix from printed names.

8 years agoloop.c: optimize decoding of paired ioctls
Dmitry V. Levin [Sun, 29 May 2016 22:15:53 +0000 (22:15 +0000)]
loop.c: optimize decoding of paired ioctls

* loop.c (loop_ioctl): Optimize decoding of LOOP_[GS]ET_STATUS
and LOOP_[GS]ET_STATUS64 ioctl pairs.

8 years agotests/ioctl_evdev.c: check EVIOCGUNIQ decoding
Dmitry V. Levin [Sat, 28 May 2016 22:12:32 +0000 (22:12 +0000)]
tests/ioctl_evdev.c: check EVIOCGUNIQ decoding

* tests/ioctl_evdev.c (main): Check EVIOCGUNIQ(0) decoding.

8 years agotests/ioctl_mtd.c: fix build with musl
Dmitry V. Levin [Sat, 28 May 2016 19:55:01 +0000 (19:55 +0000)]
tests/ioctl_mtd.c: fix build with musl

* tests/ioctl_mtd.c: Include <linux/ioctl.h>.

8 years agotests: check decoding of 'M' type ioctls
Dmitry V. Levin [Sat, 28 May 2016 18:49:47 +0000 (18:49 +0000)]
tests: check decoding of 'M' type ioctls

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

8 years agoMpersify mtd.c
Dmitry V. Levin [Sat, 28 May 2016 18:46:39 +0000 (18:46 +0000)]
Mpersify mtd.c

* defs.h (mtd_ioctl): Remove.
* mtd.c: Mpersify struct mtd_oob_buf and ioctl numbers.
(mtd_ioctl): Mpersify.

8 years agomtd.c: refactor
Dmitry V. Levin [Sat, 28 May 2016 18:42:50 +0000 (18:42 +0000)]
mtd.c: refactor

* mtd.c (mtd_ioctl): Move parsers of structures to separate functions.

8 years agoMove parser of UBI_* ioctls to a separate file
Dmitry V. Levin [Sat, 28 May 2016 10:29:30 +0000 (10:29 +0000)]
Move parser of UBI_* ioctls to a separate file

* mtd.c (ubi_ioctl): Move to ...
* ubi.c: ... new file.
* Makefile.am (strace_SOURCES): Add it.

8 years agotests: check decoding of EVIOC* ioctls
Dmitry V. Levin [Sat, 28 May 2016 00:51:45 +0000 (00:51 +0000)]
tests: check decoding of EVIOC* ioctls

* tests/ioctl_evdev.c: New file.
* tests/ioctl_evdev-v.c: Likewise.
* tests/ioctl_evdev.test: New test.
* tests/ioctl_evdev-v.test: Likewise.
* tests/.gitignore: Add ioctl_evdev and ioctl_evdev-v.
* tests/Makefile.am (check_PROGRAMS): Likewise.
(DECODER_TESTS): Add ioctl_evdev.test and ioctl_evdev-v.test.

8 years agoMpersify EVIOC* ioctl parser
Dmitry V. Levin [Fri, 27 May 2016 00:49:08 +0000 (00:49 +0000)]
Mpersify EVIOC* ioctl parser

* defs.h (evdev_abs): New xlat prototype.
(evdev_ioctl): Remove.
* evdev.c: Do not include "xlat/evdev_abs.h".
Mpersify struct ff_effect and ioctl numbers.
(evdev_ioctl): Mpersify.
* NEWS: Mention this enhancement.

8 years agoevdev.c: fix printing of unrecognized event type passed to EVIOCGBIT
Dmitry V. Levin [Sat, 28 May 2016 00:49:17 +0000 (00:49 +0000)]
evdev.c: fix printing of unrecognized event type passed to EVIOCGBIT

* evdev.c (bit_ioctl): If event type is not unrecognized,
print the argument as an address.

8 years agoevdev.c: fix printing of EV_PWR's argument
Dmitry V. Levin [Sat, 28 May 2016 00:12:01 +0000 (00:12 +0000)]
evdev.c: fix printing of EV_PWR's argument

* evdev.c (bit_ioctl): Fix printing of comma before EV_PWR's argument.

8 years agoevdev.c: fix indentation
Dmitry V. Levin [Fri, 27 May 2016 00:42:25 +0000 (00:42 +0000)]
evdev.c: fix indentation

* evdev.c: Fix indentation of print formats.

8 years agoevdev.c: fix decoding of EVIOCGNAME, EVIOCGPHYS, and EVIOCGUNIQ
Dmitry V. Levin [Fri, 27 May 2016 00:42:18 +0000 (00:42 +0000)]
evdev.c: fix decoding of EVIOCGNAME, EVIOCGPHYS, and EVIOCGUNIQ

* evdev.c (evdev_read_ioctl): Fix printing of the string returned
in response to EVIOCGNAME, EVIOCGPHYS, and EVIOCGUNIQ requests.

8 years agoevdev.c: fix EVIOCGVERSION decoding
Dmitry V. Levin [Fri, 27 May 2016 00:42:07 +0000 (00:42 +0000)]
evdev.c: fix EVIOCGVERSION decoding

* evdev.c (evdev_read_ioctl): Print EVIOCGVERSION's argument
using #x format.

8 years agoevdev.c: fix EVIOCGMTSLOTS decoding
Dmitry V. Levin [Fri, 27 May 2016 00:41:59 +0000 (00:41 +0000)]
evdev.c: fix EVIOCGMTSLOTS decoding

* evdev.c (mtslots_ioctl): Use umove_or_printaddr.

8 years agoevdev.c: fix bitset decoding
Dmitry V. Levin [Fri, 27 May 2016 00:41:51 +0000 (00:41 +0000)]
evdev.c: fix bitset decoding

* evdev.c (decode_bitset): Use umove_or_printaddr.

8 years agoevdev.c: fix decoding of struct input_id
Dmitry V. Levin [Fri, 27 May 2016 00:41:43 +0000 (00:41 +0000)]
evdev.c: fix decoding of struct input_id

* evdev.c (getid_ioctl): Use umove_or_printaddr.

8 years agoevdev.c: fix decoding of struct input_keymap_entry
Dmitry V. Levin [Fri, 27 May 2016 00:41:34 +0000 (00:41 +0000)]
evdev.c: fix decoding of struct input_keymap_entry

* evdev.c (keycode_V2_ioctl): Use umove_or_printaddr.

8 years agoevdev.c: fix decoding of EVIOCGKEYCODE/EVIOCSKEYCODE
Dmitry V. Levin [Fri, 27 May 2016 00:41:25 +0000 (00:41 +0000)]
evdev.c: fix decoding of EVIOCGKEYCODE/EVIOCSKEYCODE

* evdev.c (keycode_ioctl): Use umove_or_printaddr.

8 years agoevdev.c: fix decoding of struct input_absinfo
Dmitry V. Levin [Fri, 27 May 2016 00:41:14 +0000 (00:41 +0000)]
evdev.c: fix decoding of struct input_absinfo

* evdev.c (abs_ioctl): Use umove_or_printaddr.

8 years agoevdev.c: fix decoding of struct ff_effect
Dmitry V. Levin [Fri, 27 May 2016 00:41:02 +0000 (00:41 +0000)]
evdev.c: fix decoding of struct ff_effect

* evdev.c (ff_effect_ioctl): Use umove_or_printaddr.
Fix printing of struct ff_effect.u member names.

8 years agoevdev.c: fix printing of struct ff_envelope.fade_level
Dmitry V. Levin [Fri, 27 May 2016 00:40:53 +0000 (00:40 +0000)]
evdev.c: fix printing of struct ff_envelope.fade_level

* evdev.c (decode_envelope): Print struct ff_envelope.fade_level
using #x format.

8 years agoevdev.c: fix decoding of EVIOCGRAB and EVIOCREVOKE
Dmitry V. Levin [Fri, 27 May 2016 00:40:45 +0000 (00:40 +0000)]
evdev.c: fix decoding of EVIOCGRAB and EVIOCREVOKE

* evdev.c (evdev_write_ioctl): Print argument of EVIOCGRAB
and EVIOCREVOKE as unsigned long.

8 years agoevdev.c: fix EVIOCRMFF decoding
Dmitry V. Levin [Fri, 27 May 2016 00:40:27 +0000 (00:40 +0000)]
evdev.c: fix EVIOCRMFF decoding

* evdev.c (evdev_write_ioctl): Print EVIOCRMFF's argument as int.

8 years agoevdev.c: move handling of EVIOCGBIT to a separate function
Dmitry V. Levin [Fri, 27 May 2016 00:40:18 +0000 (00:40 +0000)]
evdev.c: move handling of EVIOCGBIT to a separate function

* evdev.c (evdev_read_ioctl): Move EVIOCGBIT handling to ...
(bit_ioctl): ... new function.

8 years agoevdev.c: reorder ioctl command checks
Dmitry V. Levin [Fri, 27 May 2016 00:40:10 +0000 (00:40 +0000)]
evdev.c: reorder ioctl command checks

Change the order of ioctl command cheks to match the kernel:
1st, check for fixed-number fixed-length commands,
2nd, check for fixed-number variable-length commands,
3rd, check for multi-number fixed-length commands,
4thm check for multi-number variable-length commands.

* evdev.c (evdev_read_ioctl, evdev_write_ioctl): Reorder
ioctl command checks.

8 years agoevdev.c: decode all directions except _IOC_READ on entering syscall
Dmitry V. Levin [Fri, 27 May 2016 00:40:02 +0000 (00:40 +0000)]
evdev.c: decode all directions except _IOC_READ on entering syscall

* evdev.c (evdev_write_ioctl): Remove exiting check.
(evdev_read_ioctl): Move entering check ...
(evdev_ioctl): ... here.  Add RVAL_DECODED to return code in _IOC_WRITE
and default cases.

8 years agoevdev.c: fix indentation of preprocessor directives
Dmitry V. Levin [Fri, 27 May 2016 00:39:33 +0000 (00:39 +0000)]
evdev.c: fix indentation of preprocessor directives

* evdev.c: Fix indentation of preprocessor directives.
Move inclusion of <linux/ioctl.h> into [HAVE_LINUX_INPUT_H].