Commit Graph

4275 Commits

Author SHA1 Message Date
64906b8f0a printsock: fix zero padding of sockaddr buffer
Before this change printsock used to erroneously clear the last byte
of sockaddr buffer.

* net.c (printsock): Use struct sockaddr_storage as a sockaddr buffer.
Reserve additional byte after the sockaddr buffer for zero padding.
Do not clear memory that is going to be overwritten by umoven.
Clear the tail of sockaddr buffer that was not overwritten by umoven.
2016-06-22 00:21:47 +00:00
Fabien Siron
0a1ce62062 Change printsock to return socket family
* defs.h (printsock): Change return type to int.
* net.c (printsock): Likewise.  Return socket family on success
and -1 in case of an error.
2016-06-21 23:38:05 +00:00
7ae67f572b Unexport addrfams
* defs.h (addrfams): Remove.
2016-06-21 16:56:21 +00:00
e0896b0dc5 sock.c: use print_sockaddr
* sock.c (print_ifreq_addr): Remove.
(PRINT_IFREQ_ADDR): New macro.
(print_ifreq, decode_ifconf): Use it instead of print_ifreq_addr.
2016-06-21 16:56:21 +00:00
3bf9c190f1 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.
2016-06-21 16:55:22 +00:00
72fd77a483 xlat/addrfams.in: provide fallback definitions
* xlat/addrfams.in: add fallback definitions for constants.
2016-06-21 16:45:29 +00:00
b01b384871 Update AF_* constants
* xlat/addrfams.in: Add AF_QIPCRTR.
2016-06-21 16:45:22 +00:00
b5f1fd926a 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.
2016-06-21 16:44:50 +00:00
f8ed94b53a net.c: use SO_LINGER unconditionally
* net.c (print_linger, print_getsockopt, print_setsockopt): Do not check
for SO_LINGER availability.
2016-06-21 16:44:15 +00:00
43369fc103 net.c: use AF_BLUETOOTH unconditionally
* net.c (print_sockaddr, SYS_FUNC(socket)): Do not check
for AF_BLUETOOTH availability.
2016-06-21 16:43:30 +00:00
e139cbe969 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.
2016-06-20 22:52:49 +00:00
bc4102e81d 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.
2016-06-19 22:02:45 +00:00
eb1c22b8c2 net.c: use AF_IPX unconditionally
* net.c (sockaddr_buf_t, print_sockaddr, SYS_FUNC(socket)): Do not check
for AF_IPX availability.
2016-06-19 22:02:45 +00:00
ebda41a44a 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__.
2016-06-19 22:02:45 +00:00
Fabien Siron
802cc28f39 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.
2016-06-19 23:01:14 +00:00
cb7409c87a 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.
2016-06-18 22:53:25 +00:00
b0c51131a3 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.
2016-06-17 16:12:13 +00:00
d4bdff69fc 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.
2016-06-17 01:06:55 +00:00
fe7a451e5a 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>
2016-06-17 01:06:55 +00:00
7c0e8875a4 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.
2016-06-17 01:06:33 +00:00
Elvira Khabirova
e547035d29 README: add system requirements and beautify the file 2016-06-16 20:50:17 +03:00
Fei Jie
3fd419f9cd 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.
2016-06-16 12:39:56 +00:00
Fei Jie
0d8eaa9c01 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.
2016-06-16 12:39:56 +00:00
5e26ee2221 net.c: use AF_INET6 unconditionally
* net.c (SYS_FUNC(socket)): Do not check for AF_INET6 availability.
2016-06-16 01:00:38 +00:00
a8d467e7a2 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.
2016-06-16 01:00:24 +00:00
c981b1f858 net.c: use AF_PACKET unconditionally
* net.c: Do not check for AF_PACKET availability.
2016-06-16 01:00:24 +00:00
4f689a1407 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.
2016-06-16 01:00:24 +00:00
fba9db299c net.c: use ICMP_FILTER unconditionally
* net.c: Do not check for ICMP_FILTER availability.
2016-06-16 01:00:23 +00:00
d06010b3c4 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.
2016-06-16 01:00:23 +00:00
9457304b4c net.c: use AF_NETLINK unconditionally
* net.c: Do not check for AF_NETLINK availability.
2016-06-14 13:53:47 +00:00
b10ee4e0eb 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.
2016-06-14 13:53:47 +00:00
Elvira Khabirova
ed37c8d64b 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.
2016-06-14 16:26:20 +00:00
21e3ff8d46 tests/attach-f-p.c: fix typo in comment 2016-06-14 16:11:09 +00:00
Elvira Khabirova
7429dcab47 strace.c: fix style in function definition
* strace.c (kill_save_errno): Move the type of return value
to another line.
2016-06-14 16:11:09 +00:00
Elvira Khabirova
dc427d50d9 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.
2016-06-14 15:48:33 +00:00
Elvira Khabirova
45a5a62318 strace.c: fix a warning reported by -Wold-style-definition
* strace.c (usage): Add void to the list of function argments.
2016-06-14 15:48:32 +00:00
219dfda2a2 tests/ioctl_evdev.c: fix typo in comment 2016-06-14 15:48:32 +00:00
Elvira Khabirova
3c1105d49c Move printargs* functions to util.c
* syscall.c (printargs, printargs_u, printargs_d): Move ...
* util.c: ... here.
2016-06-14 15:48:32 +00:00
Elvira Khabirova
be06426625 tests/xgetrlimit.c: fix a warning reported by -Wtype-limits
* tests/xgetrlimit.c (sprint_rlim): Explicitly cast constants
to the type of argument.
2016-06-14 15:48:25 +00:00
484326dbd8 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>.
2016-06-11 09:26:49 +00:00
87baaec12e 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.
2016-06-10 14:34:32 +00:00
056e304d04 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.
2016-06-10 09:56:53 +00:00
176c568a6a 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.
2016-06-10 09:16:10 +00:00
1f68abfed3 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.
2016-06-10 09:15:59 +00:00
af0d066dc2 tests: add widen_to_ull macro to tests.h
* tests.h (widen_to_ull): New macro, copied from defs.h
2016-06-10 09:14:20 +00:00
70ea46756e 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.
2016-06-10 01:29:46 +00:00
e9c1ee9c63 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.
2016-06-09 01:29:45 +00:00
Fei Jie
ef9900e7c1 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.
2016-06-09 01:28:33 +00:00
7700272844 strace.spec.in: enable libunwind on more platforms
* strace.spec.in: Add libunwind-devel to BuildRequires for RHEL8 family.
2016-06-08 10:02:42 +00:00
2afa76e29a 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.
2016-06-08 09:28:25 +00:00