]> granicus.if.org Git - strace/log
strace
9 years agoscsi: add bsg support
Bart Van Assche [Fri, 6 Feb 2015 12:37:03 +0000 (13:37 +0100)]
scsi: add bsg support

The Linux kernel supports two different versions of the SG_IO API,
namely v3 and v4. This patch adds support for version 4 of this API.
At least the sg3_utils package supports version 4 of this API.  Version
4 of this API is used if /dev/bsg/H:C:I:L is used as device name.

This patch has been tested by inspecting the output of the following
commands:

modprobe scsi_debug dev_size_mb=16 delay=0
dev=$(lsscsi | sed -n '/ scsi_debug /s,^[^/]*,,p')
./strace -eioctl -s256 sg_inq $dev
echo 'Test XDWRITEREAD(10)'
bsg=/dev/bsg/$(lsscsi | sed -n '/ scsi_debug /s,^\[\([^]]\+\)\].*,\1,p')
dd if=/dev/zero bs=512 count=1 |
  ./strace -eioctl -s256 sg_raw -s 512 -r 1024 $bsg 53 00 00 00 00 01 00 00 01 00

* configure.ac (AC_CHECK_HEADERS): Add linux/bsg.h.
* xlat/bsg_protocol.in: New file.
* xlat/bsg_subprotocol.in: Likewise.
* scsi.c: Include them and <linux/bsg.h>.
(print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req,
print_sg_io_v4_res): New functions.
(print_sg_io_req, print_sg_io_res): Use them.
(scsi_ioctl): Update callers.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoscsi: Add iovec support
Bart Van Assche [Fri, 6 Feb 2015 12:36:26 +0000 (13:36 +0100)]
scsi: Add iovec support

* scsi.c (print_sg_io_req, print_sg_io_res): Add support for decoding
iovecs passed via the SG I/O v3 interface.  Decode the "data in" and
"data out" buffers in hex instead of in ASCII.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoscsi: on exit, print only initialized part of the buffer
Bart Van Assche [Fri, 6 Feb 2015 12:36:26 +0000 (13:36 +0100)]
scsi: on exit, print only initialized part of the buffer

* scsi.c (print_sg_io_res): Only print that part of the data in buffer
that has been initialized by the SCSI LLD driver.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoscsi: make print_sg_io_buffer() print square brackets instead of its callers
Bart Van Assche [Fri, 6 Feb 2015 12:36:26 +0000 (13:36 +0100)]
scsi: make print_sg_io_buffer() print square brackets instead of its callers

* scsi.c (print_sg_io_buffer): Print square brackets in this function.
(print_sg_io_req, print_sg_io_res): Update callers.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agoscsi: improve consistency with other decoding functions
Bart Van Assche [Fri, 6 Feb 2015 12:36:26 +0000 (13:36 +0100)]
scsi: improve consistency with other decoding functions

Pass pointers to tracee's memory as integers instead of pointers.

* scsi.c (print_sg_io_buffer): Change second argument's type to
unsigned long.
(print_sg_io_req, print_sg_io_res): Update callers.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
9 years agotests: extend getdents to support all filesystems regardless of file order
Dmitry V. Levin [Sun, 8 Feb 2015 01:34:08 +0000 (01:34 +0000)]
tests: extend getdents to support all filesystems regardless of file order

* tests/getdents.awk: Include all 6 possible permutations of 3
direntries to regexps.

9 years agoprint_setsockopt: fix fall-through bug in SOL_IP switch case
Dmitry V. Levin [Sun, 8 Feb 2015 01:19:06 +0000 (01:19 +0000)]
print_setsockopt: fix fall-through bug in SOL_IP switch case

This fixes the bug introduced by commit v4.9-250-ga0a4909.

* net.c (print_setsockopt): Separate SOL_IP case from SOL_PACKET.

Reported-by: Ben Noordhuis <info@bnoordhuis.nl>
9 years agoDo not watch for post-execve SIGTRAP if PTRACE_O_TRACEEXEC is enabled
Dmitry V. Levin [Sat, 7 Feb 2015 23:26:44 +0000 (23:26 +0000)]
Do not watch for post-execve SIGTRAP if PTRACE_O_TRACEEXEC is enabled

If PTRACE_O_TRACEEXEC option is enabled, then post-execve SIGTRAPs are
suppressed and we can safely skip -ENOSYS heuristics.  This partially
reverts commits v4.9-258-g8e398b6 and v4.9-261-gd70c41d.

* syscall.c (syscall_fixup_on_sysenter): Skip if PTRACE_O_TRACEEXEC
flag is set in ptrace_setoptions.  Remove all SECCOMP_RET_ERRNO
workarounds as they are not needed when PTRACE_O_TRACEEXEC is not
supported by the kernel.

9 years agoWhen the process stared by strace exits/terminates, forget its pid
Dmitry V. Levin [Sat, 7 Feb 2015 19:41:48 +0000 (19:41 +0000)]
When the process stared by strace exits/terminates, forget its pid

The process stared by strace can exit/terminate only once.  When this
happens, forget its pid, so that any other event or action related to a
process with the same pid as the pid of that first process would not be
confused with that first process.

* strace.c (print_signalled, print_exited): Clear strace_child when it
equals to the given pid.

9 years ago-b execve: avoid misleading warning about unknown pid
Dmitry V. Levin [Sat, 7 Feb 2015 18:48:55 +0000 (18:48 +0000)]
-b execve: avoid misleading warning about unknown pid

* strace.c (maybe_allocate_tcb): If detach_on_execve is set, do not warn
about !WIFSTOPPED process with pid == strace_child.
* tests/bexecve.test: New test.
* tests/Makefile.am (TESTS): Add it.

9 years ago-b execve: do not use struct tcb after detach
Dmitry V. Levin [Sat, 7 Feb 2015 17:47:53 +0000 (17:47 +0000)]
-b execve: do not use struct tcb after detach

* strace.c (trace): Do not proceed after detach.

9 years agotrace: split into several functions
Dmitry V. Levin [Sat, 7 Feb 2015 17:31:54 +0000 (17:31 +0000)]
trace: split into several functions

This change moves the main loop back to main() and splits trace()
into several functions.  There are no algorithmic changes.

* strace.c (print_debug_info, maybe_allocate_tcb, maybe_switch_tcbs,
print_signalled, print_exited, print_stopped, startup_tcb): New
functions.
(trace) Use them.  Move the main loop ...
(main): ... here.

9 years agoprintsiginfo: constify the first argument
Dmitry V. Levin [Sat, 7 Feb 2015 15:47:24 +0000 (15:47 +0000)]
printsiginfo: constify the first argument

* signal.c (printsiginfo): Make the first argument a pointer to a const type.
* defs.h (printsiginfo): Likewise.
(printsiginfo, printsiginfo_at): Always define these prototypes.
* configure.ac (AC_CHECK_TYPES): Remove siginfo_t, as HAVE_SIGINFO_T
is no longer used.

9 years agotest: add a manual test for seccomp decoding
Dmitry V. Levin [Fri, 6 Feb 2015 01:52:59 +0000 (01:52 +0000)]
test: add a manual test for seccomp decoding

* test/.gitignore: Add seccomp.
* test/Makefile (PROGS): Likewise.
* test/seccomp.c: New file.
* test/README: Mention ../tests/.

9 years agoImplement seccomp decoding
Dmitry V. Levin [Wed, 4 Feb 2015 23:50:50 +0000 (23:50 +0000)]
Implement seccomp decoding

* configure.ac (AC_CHECK_HEADERS): Add linux/filter.h
and linux/seccomp.h.
* defs.h (print_seccomp_filter): New prototype.
* linux/dummy.h (sys_seccomp): Remove.
* linux/syscall.h (sys_seccomp): New prototype.
* prctl.c: Include <linux/seccomp.h>.
(sys_prctl): Decode PR_SET_SECCOMP.
* seccomp.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* xlat/bpf_class.in: New file.
* xlat/bpf_miscop.in: Likewise.
* xlat/bpf_mode.in: Likewise.
* xlat/bpf_op_alu.in: Likewise.
* xlat/bpf_op_jmp.in: Likewise.
* xlat/bpf_rval.in: Likewise.
* xlat/bpf_size.in: Likewise.
* xlat/bpf_src.in: Likewise.
* xlat/seccomp_filter_flags.in: Likewise.
* xlat/seccomp_mode.in: Likewise.
* xlat/seccomp_ops.in: Likewise.
* xlat/seccomp_ret_action.in: Likewise.

9 years agois_negated_errno: support large errno values
Dmitry V. Levin [Thu, 5 Feb 2015 23:47:36 +0000 (23:47 +0000)]
is_negated_errno: support large errno values

Thanks to SECCOMP_RET_DATA == 0xffff, abnormally large errno
values could be easily seen when a seccomp filter is used, e.g.
BPF_STMT(BPF_RET, SECCOMP_RET_ERRNO | SECCOMP_RET_DATA)

* syscall.c (is_negated_errno): Allow errno values as large as 0xffff.

9 years agox86, x32, x86_64: print SECCOMP_RET_ERRNO filtered syscalls
Dmitry V. Levin [Thu, 5 Feb 2015 23:43:06 +0000 (23:43 +0000)]
x86, x32, x86_64: print SECCOMP_RET_ERRNO filtered syscalls

This is required to process SECCOMP_RET_ERRNO filtered syscalls on
systems where linux kernel does not change the syscall number to -1.

* syscall.c (is_negated_errno): Move before syscall_fixup_on_sysenter.
(syscall_fixup_on_sysenter) [I386 || X32 || X86_64] : Use it to check
AX register.

9 years agois_negated_errno: merge x86_64 and x32 definitions
Dmitry V. Levin [Thu, 5 Feb 2015 18:50:24 +0000 (18:50 +0000)]
is_negated_errno: merge x86_64 and x32 definitions

* syscall.c (kernel_long_t, kernel_ulong_t): New types.
(is_negated_errno): Merge [X32] and [!X32] definitions.
(get_error): Merge [X86_64] and [X32] code.

9 years agox32: rename is_negated_errno_x32 to is_negated_errno
Dmitry V. Levin [Thu, 5 Feb 2015 18:04:36 +0000 (18:04 +0000)]
x32: rename is_negated_errno_x32 to is_negated_errno

Use the same function name on all architectures.

* syscall.c [X32] (is_negated_errno_x32): Rename to is_negated_errno.
(get_error) [X32]: Update callers.

9 years agox86, x32, x86_64: do not skip syscall number -1
Dmitry V. Levin [Thu, 5 Feb 2015 19:31:13 +0000 (19:31 +0000)]
x86, x32, x86_64: do not skip syscall number -1

Syscall number -1 might be a side effect of SECCOMP_RET_ERRNO filtering.

* syscall.c (syscall_fixup_on_sysenter) [I386 || X32 || X86_64]:
Do not skip syscalls that have number -1.

9 years agox86_64: do not interpet syscall number -1 as a x32 personality syscall
Dmitry V. Levin [Thu, 5 Feb 2015 16:15:46 +0000 (16:15 +0000)]
x86_64: do not interpet syscall number -1 as a x32 personality syscall

Syscall number -1 might be a side effect of SECCOMP_RET_ERRNO filtering.

* syscall.c (get_scno) [X86_64]: Handle the case of scno == -1.

9 years agoImplement getrandom syscall decoding
Dmitry V. Levin [Wed, 4 Feb 2015 16:38:09 +0000 (16:38 +0000)]
Implement getrandom syscall decoding

* getrandom.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_getrandom): Remove.
* linux/syscall.h (sys_getrandom): New prototype.
* xlat/getrandom_flags.in: New file.
* tests/getrandom.c: New file.
* tests/getrandom.awk: New file.
* tests/getrandom.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add getrandom.
(TESTS): Add getrandom.test.
(EXTRA_DIST): Add getrandom.awk.
* tests/.gitignore: Add getrandom.

9 years agotests: add a test for select syscall decoding
Dmitry V. Levin [Wed, 4 Feb 2015 02:09:52 +0000 (02:09 +0000)]
tests: add a test for select syscall decoding

Convert test/select.c into a regular test.

* test/Makefile (PROGS): Remove select.
* test/.gitignore: Likewise.
* test/select.c: Rewrite to ...
* tests/select.c: ... new file.
* tests/select.awk: New file.
* tests/select.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add select.
(TESTS): Add select.test.
(EXTRA_DIST): Add select.awk.
* tests/.gitignore: Add select.

9 years agotests: add a test for the latest dumpio fix
Dmitry V. Levin [Sun, 1 Feb 2015 00:20:32 +0000 (00:20 +0000)]
tests: add a test for the latest dumpio fix

* tests/dumpio.expected: New file.
* tests/unix-pair-send-recv.c: New file.
* tests/dumpio.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add unix-pair-send-recv.
(TESTS): Add dumpio.test.
(EXTRA_DIST): Add dumpio.expected.
* tests/.gitignore: Add unix-pair-send-recv.

9 years agoFix simultaneous -e read and -e write usage
Aurelien Jacobs [Sat, 31 Jan 2015 22:57:00 +0000 (23:57 +0100)]
Fix simultaneous -e read and -e write usage

This allows using both -e read=FD and -e write=FD at the same time
with the same FD.
Without this patch, the -e write=FD is ignored if -e read=FD is used
at the same time.

Signed-off-by: Aurelien Jacobs <aurel@gnuage.org>
9 years agonet.c: remove unused HAVE_SIN6_SCOPE_ID_LINUX-based code
Dmitry V. Levin [Sat, 31 Jan 2015 01:14:39 +0000 (01:14 +0000)]
net.c: remove unused HAVE_SIN6_SCOPE_ID_LINUX-based code

The AC_SIN6_SCOPE_ID autoconf macro that was able to define
HAVE_SIN6_SCOPE_ID_LINUX was removed by commit v4.4-98-g64f793a.

* net.c [HAVE_SIN6_SCOPE_ID_LINUX]: Remove.

9 years agoprintsock: do not fetch sockaddr.sa_data twice
Dmitry V. Levin [Fri, 30 Jan 2015 13:36:49 +0000 (13:36 +0000)]
printsock: do not fetch sockaddr.sa_data twice

* net.c (printsock): Print addrbuf.sa.sa_data using print_quoted_string.

9 years agosetsockopt: add decoding of MCAST_JOIN_GROUP and MCAST_LEAVE_GROUP
Dmitry V. Levin [Fri, 30 Jan 2015 01:55:20 +0000 (01:55 +0000)]
setsockopt: add decoding of MCAST_JOIN_GROUP and MCAST_LEAVE_GROUP

* net.c (print_group_req): New function.
(print_setsockopt): Use it.

9 years agotests: add a test for sockaddr_un.sun_path decoding
Dmitry V. Levin [Thu, 29 Jan 2015 15:19:21 +0000 (15:19 +0000)]
tests: add a test for sockaddr_un.sun_path decoding

* tests/net-accept-connect.c: Allow long socket addresses.
* tests/sun_path.test: New test.
* tests/Makefile.am (TESTS): Add it.

9 years agoprintsock: print the whole sockaddr_un.sun_path
Dmitry V. Levin [Thu, 29 Jan 2015 15:19:21 +0000 (15:19 +0000)]
printsock: print the whole sockaddr_un.sun_path

* net.c (printsock): If sockaddr_un.sun_path is not NUL-terminated,
do not omit the last byte of sockaddr_un.sun_path array.

9 years agoprintsock: do not fetch sockaddr_un.sun_path twice
Dmitry V. Levin [Thu, 29 Jan 2015 07:34:40 +0000 (07:34 +0000)]
printsock: do not fetch sockaddr_un.sun_path twice

* net.c (printsock): Print addrbuf.sau.sun_path using
print_quoted_string.

9 years agonet: define all SOL_* constants
Dmitry V. Levin [Thu, 29 Jan 2015 04:42:37 +0000 (04:42 +0000)]
net: define all SOL_* constants

Ensure that all known SOL_* constants are defined.
Sync the list of known SOL_* constants with linux/socket.h.

* net.c: Provide definitions for all SOL_* constants.
Remove all SOL_* preprocessor conditionals.
(socketlayers): Disconnect from inet_protocols.
* xlat/socketlayers.in: Remove SOL_ICMP, add SOL_ALG and SOL_NFC.

9 years agosetsockopt: decode PACKET_ADD_MEMBERSHIP
Dmitry V. Levin [Thu, 29 Jan 2015 03:26:53 +0000 (03:26 +0000)]
setsockopt: decode PACKET_ADD_MEMBERSHIP

* xlat/packet_mreq_type.in: New file.
* net.c: Include "xlat/packet_mreq_type.h".
(print_packet_mreq): New function.
(print_setsockopt): Use it.

9 years agogetsockopt, setsockopt: do not decode structures in non-verbose mode
Dmitry V. Levin [Thu, 29 Jan 2015 03:11:41 +0000 (03:11 +0000)]
getsockopt, setsockopt: do not decode structures in non-verbose mode

Move the code that is common between getsockopt and setsockopt parsers
to a separate function.
Move printers specific to getsockopt and setsockopt to separate
functions, choose appropriate parsers depending on verbose mode.
Move parsers of specific socket options to separate functions.

* net.c (printicmpfilter): Rename to print_icmp_filter.
(printsockopt): Remove.
(print_sockopt_fd_level_name, print_linger, print_ucred,
print_tpacket_stats, print_getsockopt, print_tpacket_req,
print_packet_mreq, print_setsockopt): New functions.
(sys_getsockopt, sys_setsockopt): Use them.

9 years agosendmsg: do not decode msghdr in non-verbose mode
Dmitry V. Levin [Wed, 28 Jan 2015 01:52:25 +0000 (01:52 +0000)]
sendmsg: do not decode msghdr in non-verbose mode

* net.c (printmsghdr): Do not decode struct msghdr in non-verbose mode.

9 years agodecode_select: do not allocate unused memory
Dmitry V. Levin [Wed, 28 Jan 2015 01:26:04 +0000 (01:26 +0000)]
decode_select: do not allocate unused memory

* desc.c (decode_select): On entering syscall, do not allocate memory
in non-verbose mode.

9 years agoxattr: quote using print_quoted_string
Dmitry V. Levin [Mon, 26 Jan 2015 04:21:20 +0000 (04:21 +0000)]
xattr: quote using print_quoted_string

* xattr.c (print_xattr_val): Drop local quoting code, use
print_quoted_string.

9 years agov4l2: quote pixelformat
Dmitry V. Levin [Sun, 25 Jan 2015 00:27:00 +0000 (00:27 +0000)]
v4l2: quote pixelformat

* v4l2.c (print_pixelformat): Output in quoted v4l2_fourcc() format.

9 years agov4l2: quote strings
Dmitry V. Levin [Mon, 26 Jan 2015 02:45:09 +0000 (02:45 +0000)]
v4l2: quote strings

* v4l2.c (v4l2_ioctl): Print strings using print_quoted_string.

9 years agomips: quote sysmips nodename
Dmitry V. Levin [Sat, 24 Jan 2015 22:33:55 +0000 (22:33 +0000)]
mips: quote sysmips nodename

* sysmips.c (sys_sysmips): Print nodename using print_quoted_string.

9 years agoblock_ioctl: quote strings
Dmitry V. Levin [Sun, 25 Jan 2015 01:04:01 +0000 (01:04 +0000)]
block_ioctl: quote strings

* block.c (print_blkpg_req): Print blkpg_partition.devname and
blkpg_partition.volname using print_quoted_string.
(block_ioctl): Print blk_user_trace_setup.name using print_quoted_string.

9 years agosys_uname: quote struct utsname members
Dmitry V. Levin [Sat, 24 Jan 2015 22:08:07 +0000 (22:08 +0000)]
sys_uname: quote struct utsname members

* uname.c (PRINT_UTS_MEMBER): New macro.
(sys_uname): Use them.

9 years agosock_ioctl: quote network interface names
Dmitry V. Levin [Sat, 24 Jan 2015 20:58:23 +0000 (20:58 +0000)]
sock_ioctl: quote network interface names

* sock.c (print_ifname): New function.
(sock_ioctl): Use it to quote ifr_name, ifru_newname, and ifru_slave.

9 years agoprintsock: quote network interface names
Dmitry V. Levin [Sat, 24 Jan 2015 20:23:02 +0000 (20:23 +0000)]
printsock: quote network interface names

* net.c (printsock): Print network interface names returned by
if_indextoname() using print_quoted_string.

9 years agogetdents, getdents64: quote filenames
Dmitry V. Levin [Sun, 25 Jan 2015 00:04:20 +0000 (00:04 +0000)]
getdents, getdents64: quote filenames

* dirent.c (print_old_dirent): Fix quoting.
(sys_getdents): Print d_name using print_quoted_string.
(sys_getdents64): Likewise.
* tests/getdents.test: Test it.
* tests/getdents.awk: Update.

9 years agoprintfd: quote pathnames
Dmitry V. Levin [Sat, 24 Jan 2015 19:51:39 +0000 (19:51 +0000)]
printfd: quote pathnames

Change printfd() behaviour in show_fd_path mode to quote pathnames
the same way printpathn() does.

* util.c (printfd): Print non-socket paths using print_quoted_string.
* tests/scm_rights-fd.test: Test it.
* tests/scm_rights.c: Update.

9 years agoRework string_quote API
Dmitry V. Levin [Mon, 26 Jan 2015 01:17:08 +0000 (01:17 +0000)]
Rework string_quote API

string_quote() has proven to be too hard to use, replace it with
print_quoted_string() that does memory allocation and prints the result.

* defs.h (string_quote): Remove.
(QUOTE_0_TERMINATED, QUOTE_OMIT_LEADING_TRAILING_QUOTES): New macros.
(print_quoted_string): New prototype.
* util.c (string_quote): Make static; take "style" flags instead
of "len", treat QUOTE_0_TERMINATED style flag as former (len == -1);
add QUOTE_OMIT_LEADING_TRAILING_QUOTES style flag support.
(ALLOCA_CUTOFF, use_alloca): New macros.
(print_quoted_string): New function.
(printpathn, printstr): Update to new API.
* loop.c (loop_ioctl): Likewise.
* mtd.c (ubi_ioctl): Likewise.
* net.c (print_scm_security): Likewise.
* socketutils.c (unix_parse_response): Likewise.

9 years agoavr32: fix typo in sys_timerfd syscall entry
Dmitry V. Levin [Sat, 24 Jan 2015 16:40:00 +0000 (16:40 +0000)]
avr32: fix typo in sys_timerfd syscall entry

* linux/avr32/syscallent.h (timerfd): Change sys_name to "timerfd".

9 years agohppa: fix typos in getresuid and getresgid syscall entries
Dmitry V. Levin [Sat, 24 Jan 2015 16:37:36 +0000 (16:37 +0000)]
hppa: fix typos in getresuid and getresgid syscall entries

* linux/hppa/syscallent.h (getresuid): Change sys_func to sys_getresuid.
(getresgid): Change sys_func to sys_getresgid.

9 years agohppa: fix typo in getpeername syscall entry
Helge Deller [Sat, 24 Jan 2015 16:34:31 +0000 (16:34 +0000)]
hppa: fix typo in getpeername syscall entry

This fixes an obvious typo which prints "lock" instead of "getpeername"
for the getpeername syscall.

* linux/hppa/syscallent.h (getpeername): Change sys_name to "getpeername".

9 years agoImpove struct cmsghdr decoding
Dmitry V. Levin [Sat, 24 Jan 2015 15:20:31 +0000 (15:20 +0000)]
Impove struct cmsghdr decoding

Print all cmsghdr structures in msg_control array,
not just the first one.
Change output format to be consistent with other parts of strace
where structures and arrays are printed.
Implement decoder for SCM_SECURITY message type.

* net.c (print_scm_rights, print_scm_creds, print_scm_security):
New functions.
(printcmsghdr): Use them.  Iterate over all members of the array.
* xlat/scmvals.in: Add SCM_SECURITY.
* tests/scm_rights.c (main): Pass one more descriptor to the receiver.
Set SO_PASSCRED on the receiver part.  Reserve enough space to receive
SCM_CREDENTIALS and SCM_RIGHTS.
* tests/scm_rights-fd.test: Update.

9 years agoUpdate SO_* constants
Dmitry V. Levin [Sat, 24 Jan 2015 15:16:23 +0000 (15:16 +0000)]
Update SO_* constants

* xlat/sockoptions.in: Add SO_DOMAIN, SO_MARK, SO_NOFCS, SO_PASSSEC,
SO_PROTOCOL, SO_RCVBUFFORCE, SO_SNDBUFFORCE, SO_TIMESTAMPING,
and SO_TIMESTAMPNS.

9 years agotests: run tests for each supported personality
Dmitry V. Levin [Fri, 23 Jan 2015 22:45:02 +0000 (22:45 +0000)]
tests: run tests for each supported personality

When strace supports more than one personality, run test suite
for each personality supported by the host system.

* bootstrap: Create tests-m32 and tests-mx32 subtrees from tests.
* configure.ac: Check for -m32 and -mx32 runtime support.
(AC_CONFIG_FILES): Add tests-m32/Makefile and tests-mx32/Makefile.
* Makefile.am [HAVE_M32_RUNTIME] (TESTS_M32): Define.
[HAVE_MX32_RUNTIME] (TESTS_MX32): Define.
(SUBDIRS): Add $(TESTS_M32) $(TESTS_MX32).
* .gitignore: Add /tests-m32 and /tests-mx32.

9 years agoFix ILP32 personality struct cmsghdr decoding on LP64 architectures
Dmitry V. Levin [Sat, 24 Jan 2015 01:08:57 +0000 (01:08 +0000)]
Fix ILP32 personality struct cmsghdr decoding on LP64 architectures

* net.c (union_cmsghdr): New union.
[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (cmsghdr32): New structure.
(printcmsghdr): Properly handle the case of current_wordsize < sizeof(long).

9 years agoFix ILP32 personality preadv/pwritev offset decoding on LP64 architectures
Dmitry V. Levin [Fri, 23 Jan 2015 20:04:37 +0000 (20:04 +0000)]
Fix ILP32 personality preadv/pwritev offset decoding on LP64 architectures

* io.c (print_llu_from_low_high_val) [SIZEOF_LONG == SIZEOF_LONG_LONG
&& SUPPORTED_PERSONALITIES > 1]: Properly handle the case of
current_wordsize < sizeof(long).

9 years agoioctl: take all 32 bits of ioctl commands into account
Dmitry V. Levin [Mon, 19 Jan 2015 17:02:16 +0000 (17:02 +0000)]
ioctl: take all 32 bits of ioctl commands into account

Historically, only 16 bits (8-bit number and 8-bit type) of 32-bit ioctl
commands were used for decoding, which was the source for numerous
annoying collisions like this:

ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
ioctl(0, MGSL_IOCGPARAMS or MMTIMER_GETRES or MTIOCTOP or SNDCTL_MIDI_MPUMODE, 0x7fffd47f7338) = -1 ENOTTY (Inappropriate ioctl for device)

The solution is to use all 32 bits for decoding, not just "number" and
"type", but also "size" and "direction".

As some architectures override defaults that come from asm-generic/ and
provide alternative definitions for some ioctl commands, we support
per-architecture ioctl definitions and merge them with common
definitions at build time.  During the merge, we used to keep both
generic and architecture-specific definitions, now architecture-specific
definitions have precedence over generic ones -- ioctlsort omits
definitions from asm-generic/ for those ioctl names that have different
definitions in asm/.

Additional bits of "direction" are architecture specific -- the number
of bits and their values differ between architectures.  To reduce
architecture differences in the source code, we keep "direction" in
symbolic form and compile it in ioctlsort.

Additional bits of "size" are also architecture specific -- not only the
number of bits differ between architectures, but sizes of many types
depend on sizeof(long).  To reduce architecture differences in the
source code, we keep 32-bit and 64-bit versions of common ioctl
definitions, and use the appropriate version for each architecture and
personality.

To implement this, the tools for generating ioctl definitions from
kernel headers have been rewritten, and the source format of ioctl
definitions has been extended.   The final ioctlent*.h files that are
included by syscall.c are now generated from source ioctls_inc*.h and
ioctls_arch*.h files at build time with ioctlsort.

* ioctl.c (ioctl_lookup): Use all 32 bits of ioctl command code.
* ioctlsort.c: Rewritten.
* linux/32/ioctls_inc.h: New file.
* linux/64/ioctls_inc.h: New file.
* linux/aarch64/ioctls_arch0.h: New file.
* linux/aarch64/ioctls_arch1.h: New file.
* linux/aarch64/ioctls_inc0.h: New file.
* linux/aarch64/ioctls_inc1.h: New file.
* linux/alpha/ioctls_arch0.h: New file.
* linux/alpha/ioctls_inc0.h: New file.
* linux/arc/ioctls_arch0.h: New file.
* linux/arc/ioctls_inc0.h: New file.
* linux/arm/ioctls_arch0.h: New file.
* linux/arm/ioctls_inc0.h: New file.
* linux/avr32/ioctls_arch0.h: New file.
* linux/avr32/ioctls_inc0.h: New file.
* linux/bfin/ioctls_arch0.h: New file.
* linux/bfin/ioctls_inc0.h: New file.
* linux/hppa/ioctls_arch0.h: New file.
* linux/hppa/ioctls_inc0.h: New file.
* linux/i386/ioctls_arch0.h: New file.
* linux/i386/ioctls_inc0.h: New file.
* linux/ia64/ioctls_arch0.h: New file.
* linux/ia64/ioctls_inc0.h: New file.
* linux/m68k/ioctls_arch0.h: New file.
* linux/m68k/ioctls_inc0.h: New file.
* linux/metag/ioctls_arch0.h: New file.
* linux/metag/ioctls_inc0.h: New file.
* linux/microblaze/ioctls_arch0.h: New file.
* linux/microblaze/ioctls_inc0.h: New file.
* linux/mips/ioctls_arch0.h: New file.
* linux/mips/ioctls_inc0.h: New file.
* linux/or1k/ioctls_arch0.h: New file.
* linux/or1k/ioctls_inc0.h: New file.
* linux/powerpc/ioctls_arch0.h: New file.
* linux/powerpc/ioctls_inc0.h: New file.
* linux/powerpc64/ioctls_arch0.h: New file.
* linux/powerpc64/ioctls_arch1.h: New file.
* linux/powerpc64/ioctls_inc0.h: New file.
* linux/powerpc64/ioctls_inc1.h: New file.
* linux/s390/ioctls_arch0.h: New file.
* linux/s390/ioctls_inc0.h: New file.
* linux/s390x/ioctls_arch0.h: New file.
* linux/s390x/ioctls_inc0.h: New file.
* linux/sh/ioctls_arch0.h: New file.
* linux/sh/ioctls_inc0.h: New file.
* linux/sh64/ioctls_arch0.h: New file.
* linux/sh64/ioctls_inc0.h: New file.
* linux/sparc/ioctls_arch0.h: New file.
* linux/sparc/ioctls_inc0.h: New file.
* linux/sparc64/ioctls_arch0.h: New file.
* linux/sparc64/ioctls_arch2.h: New file.
* linux/sparc64/ioctls_inc0.h: New file.
* linux/sparc64/ioctls_inc2.h: New file.
* linux/tile/ioctls_arch0.h: New file.
* linux/tile/ioctls_arch1.h: New file.
* linux/tile/ioctls_inc0.h: New file.
* linux/tile/ioctls_inc1.h: New file.
* linux/x32/ioctls_arch0.h: New file.
* linux/x32/ioctls_arch1.h: New file.
* linux/x32/ioctls_inc0.h: New file.
* linux/x32/ioctls_inc1.h: New file.
* linux/x86_64/ioctls_arch0.h: New file.
* linux/x86_64/ioctls_arch1.h: New file.
* linux/x86_64/ioctls_inc0.h: New file.
* linux/x86_64/ioctls_inc1.h: New file.
* linux/xtensa/ioctls_arch0.h: New file.
* linux/xtensa/ioctls_inc0.h: New file.
* linux/aarch64/ioctlent.h.in: Remove.
* linux/aarch64/ioctlent1.h: Remove.
* linux/alpha/ioctlent.h.in: Remove.
* linux/arc/ioctlent.h.in: Remove.
* linux/arm/ioctlent.h.in: Remove.
* linux/avr32/ioctlent.h.in: Remove.
* linux/bfin/ioctlent.h.in: Remove.
* linux/hppa/ioctlent.h.in: Remove.
* linux/i386/ioctlent.h.in: Remove.
* linux/ia64/ioctlent.h.in: Remove.
* linux/ioctlent.h.in: Remove.
* linux/ioctlent.sh: Remove.
* linux/m68k/ioctlent.h.in: Remove.
* linux/metag/ioctlent.h.in: Remove.
* linux/microblaze/ioctlent.h.in: Remove.
* linux/mips/ioctlent.h.in: Remove.
* linux/mips/ioctlent.sh: Remove.
* linux/or1k/ioctlent.h.in: Remove.
* linux/powerpc/ioctlent.h.in: Remove.
* linux/powerpc64/ioctlent.h: Remove.
* linux/powerpc64/ioctlent1.h: Remove.
* linux/s390/ioctlent.h.in: Remove.
* linux/s390x/ioctlent.h.in: Remove.
* linux/sh/ioctlent.h.in: Remove.
* linux/sh64/ioctlent.h.in: Remove.
* linux/sparc/ioctlent.h.in: Remove.
* linux/sparc64/ioctlent.h.in: Remove.
* linux/sparc64/ioctlent2.h: Remove.
* linux/tile/ioctlent.h.in: Remove.
* linux/tile/ioctlent1.h: Remove.
* linux/x32/ioctlent.h.in: Remove.
* linux/x32/ioctlent1.h: Remove.
* linux/x86_64/ioctlent.h.in: Remove.
* linux/x86_64/ioctlent1.h: Remove.
* linux/xtensa/ioctlent.h.in: Remove.
* linux/x86_64/ioctlent2.h: Include ioctlent0.h instead of ioctlent.h.
* syscall.c (struct_ioctlent ioctlent0): Likewise.
* Makefile.am: Remove all ioctlent-related definitions.
Define the list of ioctlent*.h files that have to be generated by
presence of $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h files.
Add rules for ioctlent*.h files generation.
(EXTRA_DIST): Update.
* maint/ioctls_gen.sh: New file.
* maint/ioctls_hex.sh: New file.
* maint/ioctls_sym.sh: New file.
* maint/print_ioctlent.c: New file.
* HACKING-scripts: Update for ioctlent.sh -> ioctls_gen.sh migration.
* .gitignore: Add ioctlent[012].h and ioctls_all[012].h.
* configure.ac (AC_CHECK_HEADERS): Add linux/hiddev.h
and linux/mmtimer.h for tests.
* tests/ioctl.c: New file.
* tests/ioctl.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add ioctl.
(TESTS): Add ioctl.test.
* tests/.gitignore: Add ioctl.

9 years agoioctl: add decoding for parametrized command names
Gabriel Laskar [Wed, 21 Jan 2015 22:35:27 +0000 (23:35 +0100)]
ioctl: add decoding for parametrized command names

Some ioctl commands from evdev, hiddev, mixer, uinput, spi, and joystick
are parametrized by a size or a number that are variable.  This change
implements printing of these parametrized ioctl command names.

* configure.ac (AC_CHECK_HEADERS): Add linux/input.h.
* defs.h (ioctl_decode_number): New prototype.
* io.c (sys_ioctl): Use ioctl_decode_number.
* ioctl.c (ioctl_decode_number): New function.
* xlat/evdev_abs.in: New file.
* xlat/evdev_ev.in: New file.

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
9 years agoUpdate auxiliary maintainer mode build tools
Dmitry V. Levin [Wed, 21 Jan 2015 20:50:32 +0000 (20:50 +0000)]
Update auxiliary maintainer mode build tools

* git-set-file-times: Update from rsync.
* git-version-gen: Update from gnulib.
* gitlog-to-changelog: Likewise.

9 years agoUpdate warnings.m4
Dmitry V. Levin [Wed, 21 Jan 2015 20:49:04 +0000 (20:49 +0000)]
Update warnings.m4

* m4/warnings.m4: Update from gnulib.

9 years agopowerpc64: maintain own linux/powerpc64 subdirectory
Dmitry V. Levin [Wed, 21 Jan 2015 17:04:31 +0000 (17:04 +0000)]
powerpc64: maintain own linux/powerpc64 subdirectory

Most architectures supported by strace have their own subdirectory in
linux directory, but powerpc64 didn't, causing inconveniences.

* configure.ac (arch): Define to "powerpc64" on powerpc64.
* linux/powerpc/errnoent1.h: Move to linux/powerpc64/.
* linux/powerpc/ioctlent1.h: Likewise.
* linux/powerpc/signalent1.h: Likewise.
* linux/powerpc/syscallent1.h: Likewise.
* linux/powerpc64/ioctlent.h: New file.
* linux/powerpc64/syscallent.h: Likewise.
* linux/powerpc64/userent.h: Likewise.
* Makefile.am (EXTRA_DIST): Remove linux/powerpc/ioctlent1.h,
linux/powerpc/syscallent1.h, linux/powerpc/errnoent1.h, and
linux/powerpc/signalent1.h; added linux/powerpc64/errnoent1.h,
linux/powerpc64/ioctlent.h, linux/powerpc64/ioctlent1.h,
linux/powerpc64/signalent1.h, linux/powerpc64/syscallent.h,
linux/powerpc64/syscallent1.h, and linux/powerpc64/userent.h.

9 years agoconfigure.ac: remove unused AC_INCLUDEDIR
Dmitry V. Levin [Wed, 21 Jan 2015 16:43:18 +0000 (16:43 +0000)]
configure.ac: remove unused AC_INCLUDEDIR

* configure.ac (AC_INCLUDEDIR): Remove.
* m4/includedir.m4: Remove.

9 years agoioctl: print unrecognized ioctl codes in _IOC(dir,type,nr,size) format
Dmitry V. Levin [Tue, 20 Jan 2015 00:24:36 +0000 (00:24 +0000)]
ioctl: print unrecognized ioctl codes in _IOC(dir,type,nr,size) format

* defs.h (ioctl_print_code): New prototype.
* ioctl.c: Include xlat/ioctl_dirs.h.
(ioctl_print_code): New function.
* io.c (sys_ioctl): Use it.
* xlat/ioctl_dirs.in: New file.

9 years agoioctl: assume that all ioctl commands have unsigned int type
Dmitry V. Levin [Mon, 19 Jan 2015 18:44:21 +0000 (18:44 +0000)]
ioctl: assume that all ioctl commands have unsigned int type

In linux, ioctl command number has a 32-bit unsigned integer type:
fs/ioctl.c:SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
If the kernel completely ignores other bits on 64-bit architectures,
why should strace care?
Let's follow the kernel and treat it as unsigned int.

* defs.h (struct_ioctlent): Change "code" type to "unsigned int".
(ioctl_decode, ioctl_lookup, block_ioctl, loop_ioctl, mtd_ioctl,
ubi_ioctl, ptp_ioctl, scsi_ioctl, sock_ioctl, term_ioctl, rtc_ioctl,
v4l2_ioctl): Likewise.
* ioctl.c (ioctl_decode, ioctl_lookup, compare, ioctl_next_match):
Likewise.
* block.c (block_ioctl): Likewise.
* loop.c (loop_ioctl): Likewise.
* mtd.c (mtd_ioctl, ubi_ioctl): Likewise.
* ptp.c (ptp_ioctl): Likewise.
* scsi.c (scsi_ioctl): Likewise.
* sock.c (sock_ioctl): Likewise.
* term.c (term_ioctl): Likewise.
* time.c (rtc_ioctl): Likewise.
* v4l2.c (v4l2_ioctl): Likewise.
* ioctlsort.c (struct ioctlent, compare, main): Likewise.

9 years agoioctlent.sh: cleanup regexps that are used to fetch bases
Dmitry V. Levin [Fri, 16 Jan 2015 20:19:39 +0000 (20:19 +0000)]
ioctlent.sh: cleanup regexps that are used to fetch bases

9 years agoioctlent.sh: sync lookup regexps that are used in grep and sed
Dmitry V. Levin [Fri, 16 Jan 2015 19:59:21 +0000 (19:59 +0000)]
ioctlent.sh: sync lookup regexps that are used in grep and sed

ioctlent.sh looks for ioctl command names using grep, and fetches them
with their definitions using sed.  Historically, lookup regexps used in
grep and sed are slightly different, which makes the script more
complicated than necessary.

9 years agoqemu_multiarch_testing: update
Dmitry V. Levin [Thu, 15 Jan 2015 17:01:32 +0000 (17:01 +0000)]
qemu_multiarch_testing: update

* qemu_multiarch_testing/.gitignore: New file.
* qemu_multiarch_testing/README: Update statistics.
* qemu_multiarch_testing/hdc.dir/init2: Run "make check".
* qemu_multiarch_testing/make-hdc-img.sh: Robustify,
automatically calculate hdc image size.
* qemu_multiarch_testing/parallel-build-hdc-img.sh: Reduce
hdb image size.  Report completion of each parallelized task.

9 years agotests: add IPC_STAT to ipc tests, workaround limitiations of old kernels
Dmitry V. Levin [Wed, 14 Jan 2015 16:52:28 +0000 (16:52 +0000)]
tests: add IPC_STAT to ipc tests, workaround limitiations of old kernels

* tests/ipc_msg.c: Include <errno.h>.
(main): Add a test call with IPC_STAT, handle old kernels MSG_STAT behaviour.
* tests/ipc_sem.c: Include <errno.h>.
(main): Add a test call with IPC_STAT, handle old kernels SEM_STAT behaviour.
* tests/ipc_shm.c: Include <errno.h>.
(main): Add a test call with IPC_STAT, handle old kernels SHM_STAT behaviour.

9 years agoChange length type of umoven and umovestr to unsigned
Dmitry V. Levin [Wed, 14 Jan 2015 08:05:45 +0000 (08:05 +0000)]
Change length type of umoven and umovestr to unsigned

* defs.h (umoven, umovestr): Change type of 3rd argument from "int"
to "unsigned int".
* util.c (umoven, umovestr): Likewise.  Adjust the code appropriately.

9 years agotests: skip sendmmsg/recvmmsg test if these syscalls are not implemented in kernel
Dmitry V. Levin [Wed, 14 Jan 2015 12:47:45 +0000 (12:47 +0000)]
tests: skip sendmmsg/recvmmsg test if these syscalls are not implemented in kernel

* tests/mmsg.c: #include <errno.h>
(main): Return 77 if sendmmsg failed with ENOSYS.

9 years agotests: skip ip network tests when the network is not functional
Dmitry V. Levin [Wed, 14 Jan 2015 11:32:38 +0000 (11:32 +0000)]
tests: skip ip network tests when the network is not functional

* tests/inet-accept-connect-send-recv.c (main): Return 77 if inet stream
socket cannot be created or it cannot be bound to INADDR_LOOPBACK.
* tests/net-yy.test: Skip the test if inet-accept-connect-send-recv
returns 77.

9 years agotests: handle the case when all 64 process capability bits are set
Dmitry V. Levin [Wed, 14 Jan 2015 10:36:57 +0000 (10:36 +0000)]
tests: handle the case when all 64 process capability bits are set

* tests/caps.awk: Handle the case when all bits of 64-bit capability
word are set.

9 years agotests: explicitly request gawk when using gawk features
Dmitry V. Levin [Wed, 14 Jan 2015 10:13:59 +0000 (10:13 +0000)]
tests: explicitly request gawk when using gawk features

* tests/uid.test: Check for gawk availability and invoke gawk instead of
plain awk because the test uses gawk's match() feature.

9 years agotests: skip detach tests if kill does not work
Dmitry V. Levin [Wed, 14 Jan 2015 08:08:56 +0000 (08:08 +0000)]
tests: skip detach tests if kill does not work

* tests/detach-running.test: Skip if "kill -0" does not work.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.

9 years agoARM OABI: fix potential compilation warning
Dmitry V. Levin [Wed, 14 Jan 2015 07:21:36 +0000 (07:21 +0000)]
ARM OABI: fix potential compilation warning

* syscall.c (get_scno) [!__ARM_EABI__ || ENABLE_ARM_OABI]: Fix
"comparison between signed and unsigned" warning reported by some
gcc versions.

9 years agopowerpc: fix potential compilation warning
Dmitry V. Levin [Wed, 14 Jan 2015 07:17:11 +0000 (07:17 +0000)]
powerpc: fix potential compilation warning

* mem.c [POWERPC] (sys_subpage_prot): Fix "comparison between signed
and unsigned" warning reported by some gcc versions.

9 years agosparc, sparc64: remove ioctl header file names from solaris ioctl entries
Dmitry V. Levin [Tue, 13 Jan 2015 16:33:28 +0000 (16:33 +0000)]
sparc, sparc64: remove ioctl header file names from solaris ioctl entries

Starting with commit v4.9-27-g3e252ca, header file names should not be
part of ioctlent files included by syscall.c

* linux/sparc/ioctlent1.h: Remove ioctl header file names.
* linux/sparc64/ioctlent2.h: Remove all entries, include "ioctlent.h".

9 years agomips: enable indirect ipc subcall support
Dmitry V. Levin [Tue, 13 Jan 2015 15:46:43 +0000 (18:46 +0300)]
mips: enable indirect ipc subcall support

* linux/mips/syscallent-n32.h [LINUX_MIPSN32]: Define SYS_socket_subcall,
include "subcall.h".
* linux/mips/syscallent-n64.h [LINUX_MIPSN64]: Likewise.
* linux/mips/syscallent-o32.h [LINUX_MIPSO32]: Likewise.

9 years agomips: remove stub entries from syscallent files, generate stubs at build time
Dmitry V. Levin [Tue, 13 Jan 2015 04:57:27 +0000 (04:57 +0000)]
mips: remove stub entries from syscallent files, generate stubs at build time

* linux/mips/genstub.sh: New file.
* Makefile.am (EXTRA_DIST): Add it.
* configure.ac [MIPS]: Use it to generate syscallent stubs.
* linux/mips/.gitignore: Add syscallent stubs.
* linux/mips/syscallent-n32.h: Remove stub entries, include
the stub file instead.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.

9 years agobuild: add $(builddir)/$(OS)/$(ARCH) to the headers search list
Dmitry V. Levin [Tue, 13 Jan 2015 06:12:16 +0000 (06:12 +0000)]
build: add $(builddir)/$(OS)/$(ARCH) to the headers search list

* Makefile.am (AM_CPPFLAGS): Add -I$(builddir)/$(OS)/$(ARCH) before
-I$(srcdir)/$(OS)/$(ARCH).

9 years agobuild: fix build if siginfo_t lacks si_timerid/si_overrun
Dmitry V. Levin [Tue, 13 Jan 2015 06:24:04 +0000 (09:24 +0300)]
build: fix build if siginfo_t lacks si_timerid/si_overrun

* configure.ac (AC_CHECK_MEMBERS): Check for siginfo_t.si_timerid and
siginfo_t.si_overrun.
* signal.c (printsiginfo) [SI_TIMER]: Check HAVE_SIGINFO_T_SI_TIMERID
and HAVE_SIGINFO_T_SI_OVERRUN.

9 years agoconfigure.ac: remove unused AM_CONDITIONAL expressions
Dmitry V. Levin [Tue, 13 Jan 2015 04:06:52 +0000 (04:06 +0000)]
configure.ac: remove unused AM_CONDITIONAL expressions

* configure.ac (AM_CONDITIONAL): Remove I386, X86_64, X32.

9 years agotests: portability fixes
Dmitry V. Levin [Tue, 13 Jan 2015 00:06:09 +0000 (00:06 +0000)]
tests: portability fixes

* tests/stat.test: dd obs= is not portable, use bs= instead.
* tests/stat32-v.test: Likewise.
* tests/stat64-v.test: Likewise.
* tests/net.test: Use $* instead of $@ in the quoted string.
* tests/net-fd.test: Likewise.
* tests/statfs.test: Quote { and } in regexps.
* tests/caps.awk: Likewise.
* tests/getdents.awk: Likewise.
* tests/net-yy-accept.awk: Likewise.
* tests/net-yy-connect.awk: Likewise.
* tests/sigaction.awk: Likewise.
* tests/unix-yy-accept.awk: Likewise.
* tests/unix-yy-connect.awk: Likewise.

9 years agoWire up new syscalls
Dmitry V. Levin [Mon, 12 Jan 2015 18:53:32 +0000 (18:53 +0000)]
Wire up new syscalls

* linux/dummy.h (sys_bpf, sys_execveat, sys_getrandom,
sys_kexec_file_load, sys_memfd_create, sys_seccomp): New stub aliases.
* linux/32/syscallent.h (seccomp, getrandom, memfd_create, bpf,
execveat): New entries.
* linux/64/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/microblaze/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/sparc/syscallent.h: Likewise.
* linux/ia64/syscallent.h (getrandom, memfd_create, bpf, execveat):
New entries.
* linux/m68k/syscallent.h: Likewise.
* linux/s390/syscallent.h: (seccomp, getrandom, memfd_create, bpf,
s390_pci_mmio_write, s390_pci_mmio_read, execveat): New entries.
* linux/s390x/syscallent.h: Likewise.
* linux/x86_64/syscallent.h (seccomp, getrandom, memfd_create,
kexec_file_load, bpf, execveat): New entries.
* linux/x32/syscallent.h: Likewise.
* linux/xtensa/syscallent.h (seccomp, getrandom, memfd_create):
New entries.

9 years agos390x: adjust some syscall entries
Dmitry V. Levin [Mon, 12 Jan 2015 17:17:14 +0000 (17:17 +0000)]
s390x: adjust some syscall entries

According to linux/arch/s390/include/uapi/asm/unistd.h, readdir is
defined both on s390 and s390x, while getrlimit, _llseek, sendfile64,
and fadvise64_64 are defined on s390 only.

* linux/s390x/syscallent.h (readdir): Add.
(getrlimit, _llseek, sendfile64, fadvise64_64): Remove.

9 years agoChange syscallent.h files to use designated initializers
Dmitry V. Levin [Sun, 11 Jan 2015 02:42:56 +0000 (02:42 +0000)]
Change syscallent.h files to use designated initializers

Automatically convert all linux syscallent.h files to a form that uses
designated initializers, with subsequent correction of whitespace
indentation.

* linux/alpha/syscallent.h: Use designated initializers.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/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/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/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.

9 years agoCreate generic 32-bit syscallent.h
Dmitry V. Levin [Sun, 11 Jan 2015 01:04:54 +0000 (04:04 +0300)]
Create generic 32-bit syscallent.h

Since arc/syscallent.h, metag/syscallent.h, or1k/syscallent.h, and
tile/syscallent1.h share a lot of identical syscall entries described in
<asm-generic/unistd.h>, move these entries to a new file 32/syscallent.h
using the following automated conversion with subsequent correction of
whitespace indentation:

sed -e 's|^[[:space:]]*\({[^}]\+},\)[[:space:]]*/\*[[:space:]]\([[:space:]]*[0-9]\+\)[[:space:]]*\*/|[\2] = \1|' -e '/^[[:space:]]*\[[[:space:]]*2\(4[4-9]\|5[0-9]\)/d' linux/arc/syscallent.h

* linux/32/syscallent.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/arc/syscallent.h: Include "32/syscallent.h",
remove generic 32-bit syscall entries, use designated initializers.
* linux/metag/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
* linux/tile/syscallent1.h: Likewise.

9 years agotile: fix syscall entries
Dmitry V. Levin [Sun, 11 Jan 2015 00:19:32 +0000 (03:19 +0300)]
tile: fix syscall entries

* linux/tile/syscallent1.h (truncate64, ftruncate64): Change nargs to 3.
(pread64, pwrite64): Change nargs to 5.
(llseek): Change sys_name to _llseek.

9 years agos390: fix fadvise64 and fadvise64_64 syscall entries
Dmitry V. Levin [Sun, 11 Jan 2015 00:15:24 +0000 (03:15 +0300)]
s390: fix fadvise64 and fadvise64_64 syscall entries

* linux/s390/syscallent.h (fadvise64, fadvise64_64): Change sys_func to
printargs until special parsers for 31-bit 31 s390 emulation wrappers
are written.

9 years agoalpha: fix fadvise64 syscall entry
Dmitry V. Levin [Sun, 11 Jan 2015 00:13:23 +0000 (03:13 +0300)]
alpha: fix fadvise64 syscall entry

* linux/alpha/syscallent.h (fadvise64): Change sys_name to fadvise64.

9 years agotile: fix fadvise64_64 syscall entry
Dmitry V. Levin [Sun, 11 Jan 2015 00:10:48 +0000 (03:10 +0300)]
tile: fix fadvise64_64 syscall entry

* linux/tile/syscallent1.h (fadvise64_64): Fix nargs, sys_func,
and sys_name.

9 years agoFix getrlimit and ugetrlimit syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 23:48:55 +0000 (02:48 +0300)]
Fix getrlimit and ugetrlimit syscall entries

* linux/arm/syscallent.h (getrlimit, ugetrlimit): Fix sys_name.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/avr32/syscallent.h (getrlimit): Fix sys_name.
* linux/or1k/syscallent.h: Likewise.
* linux/s390/syscallent.h (ugetrlimit): Fix sys_name.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.

9 years agoFix umount and umount2 syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 23:16:39 +0000 (02:16 +0300)]
Fix umount and umount2 syscall entries

* linux/aarch64/syscallent1.h (umount): Change nargs to 1.
* linux/avr32/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/ia64/syscallent.h (umount2): Change nargs to 2.
* linux/arm/syscallent.h (umount, umount2): Fix sys_name.
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/powerpc/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/metag/syscallent.h: (umount2): Fix sys_name.
* linux/or1k/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.

9 years agoFix sendfile64 syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 22:41:25 +0000 (01:41 +0300)]
Fix sendfile64 syscall entries

* linux/arc/syscallent.h (sendfile64): Change sys_name to sendfile64.
* linux/metag/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Likewise.

9 years agoFix number of arguments in ipc family syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 20:51:40 +0000 (23:51 +0300)]
Fix number of arguments in ipc family syscall entries

* linux/64/syscallent.h (msgget, semget, semtimedop, semop, shmget,
shmctl, shmat, shmdt): Fix nargs for direct ipc syscalls.
* linux/alpha/syscallent.h (msgctl, msgget, msgrcv, semget, shmctl,
shmdt, shmget, semtimedop): Likewise.
* linux/avr32/syscallent.h (msgget, semget, semop, semtimedop, shmat,
shmget, shmdt, shmctl): Likewise.
* linux/bfin/syscallent.h (semget, semop, msgctl, msgget, msgrcv, shmat,
* shmctl, shmdt, shmget, semtimedop): Likewise.
* linux/hppa/syscallent.h (semop, semget, msgrcv, msgget, msgctl,
semtimedop): Likewise.
* linux/microblaze/syscallent.h (semtimedop, semget, semop, msgctl,
msgget, msgrcv, shmat, shmctl, shmdt, shmget): Likewise.
* linux/ia64/syscallent.h (semtimedop): Likewise.
* linux/mips/syscallent-n32.h (semtimedop): Likewise.
* linux/mips/syscallent-n64.h (semtimedop): Likewise.
* linux/or1k/syscallent.h (msgget, msgctl, msgrcv, semget, semtimedop,
semop, shmget, shmctl, shmat, shmdt): Likewise.
* linux/sh64/syscallent.h (semget, msgget, shmget): Likewise.
* linux/tile/syscallent1.h (msgget, semget, semtimedop, semop, shmget,
shmctl, shmat, shmdt): Likewise.
* linux/x32/syscallent.h (shmget, shmat, shmctl, semget, semop, shmdt,
msgget, semtimedop): Likewise.
* linux/x86_64/syscallent.h (shmget, shmat, shmctl, semget, semop,
shmdt, msgget, semtimedop): Likewise.
* linux/xtensa/syscallent.h (shmget, shmat, shmctl, shmdt, semtimedop,
semget, semop, msgget, msgrcv, msgctl): Likewise.

9 years agoCreate generic 64-bit syscallent.h
Dmitry V. Levin [Sat, 10 Jan 2015 17:51:37 +0000 (20:51 +0300)]
Create generic 64-bit syscallent.h

Since aarch64/syscallent1.h and tile/syscallent.h share a lot of
identical syscall entries described in <asm-generic/unistd.h>, move
these entries to a new file 64/syscallent.h using the following
automated conversion with subsequent correction of whitespace
indentation:

sed -e 's|^[[:space:]]*\({[^}]\+},\)[[:space:]]*/\*[[:space:]]\([[:space:]]*[0-9]\+\)[[:space:]]*\*/|[\2] = \1|' -e '/^\[[[:space:]]*2\(4[4-9]\|5[0-9]\)\]/d' linux/tile/syscallent.h

* linux/64/syscallent.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/aarch64/syscallent1.h: Include "64/syscallent.h",
remove generic 64-bit syscall entries, use designated initializers.
* linux/tile/syscallent.h: Likewise.

9 years agoFix nfsservctl syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 17:07:37 +0000 (20:07 +0300)]
Fix nfsservctl syscall entries

* linux/arc/syscallent.h (nfsservctl): Set nargs, sys_func, and sys_name.
* linux/metag/syscallent.h: Likewise.

9 years agoAdd missing syscall entries for sched_[gs]etattr and renameat2
Dmitry V. Levin [Sat, 10 Jan 2015 16:45:08 +0000 (19:45 +0300)]
Add missing syscall entries for sched_[gs]etattr and renameat2

* linux/alpha/syscallent.h (sched_setattr, sched_getattr, renameat2):
New syscall entries.
* linux/arc/syscallent.h: Likewise.
* linux/metag/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/tile/syscallent1.h: Likewise.

9 years agoFix NUMA related syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 16:32:43 +0000 (19:32 +0300)]
Fix NUMA related syscall entries

* linux/alpha/syscallent.h (mbind, get_mempolicy, set_mempolicy):
Set sys_func.
* linux/hppa/syscallent.h (mbind, get_mempolicy, set_mempolicy):
Fix nargs, set sys_func.
* linux/microblaze/syscallent.h (mbind): Fix nargs.
* linux/mips/syscallent-n32.h (move_pages): Set sys_func.
* linux/mips/syscallent-n64.h (move_pages): Likewise.
* linux/mips/syscallent-o32.h (mbind): Fix nargs.
* linux/or1k/syscallent.h (migrate_pages): Likewise.
* linux/powerpc/syscallent.h (migrate_pages): Likewise.
* linux/sh/syscallent.h (mbind): Likewise.
* linux/sh64/syscallent.h (mbind): Likewise.

9 years agoxtensa: fix syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 16:12:11 +0000 (19:12 +0300)]
xtensa: fix syscall entries

* linux/xtensa/syscallent.h (sendmmsg): Fix sys_func and sys_name.
(restart_syscall, io_setup, io_destroy, io_submit, io_getevents,
io_cancel, add_key, request_key, keyctl): Set sys_func.
(migrate_pages, mbind, get_mempolicy, set_mempolicy, move_pages,
fstatat64): Fix nargs.
(renameat2): New entry.

9 years agoFix sched_setparam syscall entries
Dmitry V. Levin [Sat, 10 Jan 2015 05:28:06 +0000 (08:28 +0300)]
Fix sched_setparam syscall entries

* linux/aarch64/syscallent1.h (sched_setparam): Change nargs to 2.
* linux/arm/syscallent.h (sched_setparam): Likewise.
* linux/avr32/syscallent.h (sched_setparam): Likewise.
* linux/bfin/syscallent.h (sched_setparam): Likewise.
* linux/i386/syscallent.h (sched_setparam): Likewise.
* linux/m68k/syscallent.h (sched_setparam): Likewise.
* linux/microblaze/syscallent.h (sched_setparam): Likewise.
* linux/s390/syscallent.h (sched_setparam): Likewise.
* linux/s390x/syscallent.h (sched_setparam): Likewise.
* linux/sh/syscallent.h (sched_setparam): Likewise.
* linux/sh64/syscallent.h (sched_setparam): Likewise.
* linux/tile/syscallent.h (sched_setparam): Likewise.
* linux/tile/syscallent1.h (sched_setparam): Likewise.
* linux/x32/syscallent.h (sched_setparam): Likewise.
* linux/x86_64/syscallent.h (sched_setparam): Likewise.