Commit Graph

60 Commits

Author SHA1 Message Date
63bae232d2 swapon.c: move fallback definitions of swap options to xlat/
* swapon.c: Move definitions of SWAP_FLAG_* flags ...
* xlat/swap_flags.in: ... here.
2015-07-16 23:44:57 +00:00
f6026b6e65 wait: move fallback definitions of wait options to xlat/
* wait.c: Move definitions of __W* flags ...
* xlat/wait4_options.in: ... here.
2015-07-15 00:33:20 +00:00
eddefd64c3 mtd.c: enhance mtd and ubi ioctl parsers
Decode as much data on entering syscall as possible.

* xlat/mtd_file_mode_options.in: New file.
* mtd.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
Include "xlat/mtd_file_mode_options.h".
Update for RVAL_DECODED.
(mtd_ioctl, ubi_ioctl): Use printnum_int and umove_or_printaddr.
2015-07-10 22:52:58 +00:00
1dbe6839eb blkpg_ops: add BLKPG_RESIZE_PARTITION constant
* xlat/blkpg_ops.in: Add BLKPG_RESIZE_PARTITION.

Reported-by: Christian Neukirchen <chneukirchen@gmail.com>
2015-07-09 11:57:18 +00:00
0c5619538f xattr: move fallback definitions of xattr flags to xlat/
* xattr.c: Include <sys/xattr.h> insread of <linux/xattr.h>.
Move definitions of XATTR_* flags ...
* xlat/xattrflags.in: ... here.
2015-06-17 19:56:11 +00:00
f64a4395d9 link: move fallback definitions of AT_* constants to xlat/
* link.c: Move definitions of AT_* constants ...
* xlat/at_flags.in: ... here.
2015-06-17 19:45:26 +00:00
fddeeba9b8 net: move fallback definitions of SOL_* constants to xlat/
* net.c: Move definitions of SOL_* constants ...
* xlat/socketlayers.in: ... here.
2015-06-17 19:23:30 +00:00
003cc9f66a futex: move fallback definitions of futex constants to xlat/
* futex.c: Move definitions of FUTEX_OP_CMP_* constants ...
* xlat/futexwakecmps.in: ... here.
* futex.c: Move definitions of other FUTEX_OP_* constants ...
* xlat/futexwakeops.in: ... here.
* futex.c: Move definitions of remaining FUTEX_* constants except
FUTEX_PRIVATE_FLAG and FUTEX_CLOCK_REALTIME flags ...
* xlat/futexops.in: ... here.
2015-06-17 19:23:25 +00:00
14f4038ad7 clone: move definitions of cloning flags to xlat/
* clone.c: Include <sched.h>.  Move definitions of CLONE_* flags ...
* xlat/clone_flags.in: ... here.
2015-06-17 18:36:53 +00:00
cf7ee30c6b Update mount flags constants
* mount.c: Remove definitions of mount flags constants.
* xlat/mount_flags.in: Update from linux v4.0, add default values.
2015-06-16 10:55:19 +00:00
0b95590ee2 Update IPV6 socket options constants
* xlat/sockipv6options.in: Update from linux v4.0.
2015-06-08 23:02:27 +00:00
f7430b7065 Update siginfo_t constants
* xlat/sigbus_codes.in: Add BUS_MCEERR_AR and BUS_MCEERR_AO,
add default values.
* xlat/sigtrap_codes.in: Add TRAP_BRANCH and TRAP_HWBKPT,
add default values.
* xlat/sigsegv_codes.in: Add SEGV_BNDERR, add default values.
* xlat/sigchld_codes.in: Add default values.
* xlat/sigemt_codes.in: Likewise.
* xlat/sigfpe_codes.in: Likewise.
* xlat/sigill_codes.in: Likewise.
* xlat/siginfo_codes.in: Likewise.
* xlat/sigpoll_codes.in: Likewise.
* xlat/sigsys_codes.in: Likewise.
2015-03-27 22:51:51 +00:00
174bb2b36e signal.c: move sigaltstack parser to a separate file
* sigaltstack.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* signal.c (print_stack_t, sys_sigaltstack): Move to sigaltstack.c.
* xlat/sigaltstack_flags.in: Add default values.
2015-03-26 15:43:07 +00:00
7e6556711e Add arch-specific PTRACE_* constants
* xlat/ptrace_cmds.in: Add arch-specific ptrace commands.
* xlat/ptrace_events.in: Add PTRACE_EVENT_MIGRATE for tile.
* xlat/ptrace_setoptions_flags.in: Add PTRACE_O_TRACEMIGRATE for tile.

This fixes Debian bug #734554.
2015-03-03 23:12:22 +00:00
Mike Frysinger
48ceaee384 xlat: avoid fork bombing the build system
When there were fewer xlat headers, this didn't matter as much.
But now with >200, trying to run them all in parallel can easily
fork bomb smaller systems.

* xlat/gen.sh (main): Do not more jobs than # of cpus.
2015-02-26 23:14:04 +00:00
5b0819eab7 evdev: update constants from linux v3.19
* xlat/evdev_keycode.in: Update from linux v3.19.
* xlat/evdev_prop.in: Likewise.
2015-02-22 02:29:55 +00:00
Etienne Gemsa
4f750b9ad1 Add decoding for evdev ioctls
This patch introduces decoding for evdev ioctls.  For EVIOCSFF the five
first members are decoded, the union is not.  The code was compiled and
tested on x86_64 with Linux 3.13.

* evdev.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (evdev_ioctl): New prototype.
* ioctl.c (ioctl_decode): Call evdev_ioctl for 'E' ioctl commands.
* xlat/evdev_autorepeat.in: New file.
* xlat/evdev_ff_status.in: New file.
* xlat/evdev_ff_types.in: New file.
* xlat/evdev_keycode.in: New file.
* xlat/evdev_leds.in: New file.
* xlat/evdev_misc.in: New file.
* xlat/evdev_mtslots.in: New file.
* xlat/evdev_prop.in: New file.
* xlat/evdev_relative_axes.in: New file.
* xlat/evdev_snd.in: New file.
* xlat/evdev_switch.in: New file.
* xlat/evdev_sync.in: New file.

Signed-off-by: Etienne Gemsa <etienne.gemsa@lse.epita.fr>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2015-02-22 02:29:54 +00:00
34bbcc6270 Remove linux/fanotify.h
* linux/fanotify.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* fanotify.c: Do not include <linux/fanotify.h>.
* xlat/fan_classes.in: Add default values.
* xlat/fan_event_flags.in: Likewise.
* xlat/fan_init_flags.in: Likewise.
* xlat/fan_mark_flags.in: Likewise.
2015-02-19 21:55:09 +00:00
2094573930 Remove linux/keyctl.h
* linux/keyctl.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* keyctl.c: Do not include <linux/keyctl.h>.
* xlat/key_perms.in: Add default values.
* xlat/key_reqkeys.in: Likewise.
* xlat/key_spec.in: Likewise.
* xlat/keyctl_commands.in: Likewise.
2015-02-19 21:42:31 +00:00
ff6a55dee9 Remove linux/kexec.h
* linux/kexec.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* kexec.c: Do not include <linux/kexec.h>.
* xlat/kexec_arch_values.in: Add default values.
* xlat/kexec_flags.in: Rename to kexec_load_flags.in, add default
values.
2015-02-19 21:29:01 +00:00
3a232997d8 Remove linux/inotify.h
* linux/inotify.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* inotify.c: Do not include <linux/inotify.h>.
* xlat/inotify_flags.in: Add default values.
2015-02-19 21:28:59 +00:00
3e6525ff4b Remove linux/reboot.h
* linux/reboot.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* reboot.c: Do not include <linux/reboot.h>.
* xlat/bootflags1.in: Add default values.
* xlat/bootflags2.in: Likewise.
* xlat/bootflags3.in: Likewise.
2015-02-19 20:47:36 +00:00
0a59454fb3 seccomp: fix fallback definitions of some SECCOMP_* constants
* seccomp.c (SECCOMP_SET_MODE_STRICT, SECCOMP_SET_MODE_FILTER,
SECCOMP_FILTER_FLAG_TSYNC): Remove fallback definitions.
* xlat/seccomp_filter_flags.in: Add default value.
* xlat/seccomp_ops.in: Add default values.
2015-02-19 20:30:01 +00:00
1e88073053 Improve prctl decoding
* configure.ac (AC_CHECK_HEADERS): Add linux/securebits.h.
* prctl.c (sys_prctl): Implement full decoding of all PR_* constants
as defined in linux v3.19.
(sys_arch_prctl): Fix decoding of unknown commands.
* xlat/cap.in: New file.
* xlat/pr_mce_kill.in: New file.
* xlat/pr_mce_kill_policy.in: New file.
* xlat/pr_set_mm.in: New file.
* xlat/pr_tsc.in: New file.
* xlat/pr_unalign_flags.in: New file.
* xlat/secbits.in: New file.
* xlat/prctl_options.in: Remove non-linux constants, add fallback
definitions.
* xlat/seccomp_mode.in: Add fallback definitions.
2015-02-19 01:54:38 +00:00
cff9f8aa94 xlat: extend syntax
* xlat/gen.sh (gen_header): If the name of constant is specified with a
value, generate a default definition for the constant using this value.
* xlat/timerfdflags.in: Use extended syntax.
2015-02-19 01:54:14 +00:00
2f0808b88e Move CAP_* definitions out to header files
* Makefile.am (strace_SOURCES): Add caps0.h and caps1.h.
* caps0.h: New file.
* caps1.h: New file.
* capability.c: Remove CAP_* definitions, include "caps0.h"
and "caps1.h" instead.
Include "xlat/cap_mask0.h" instead of "xlat/capabilities.h".
Include "xlat/cap_mask1.h" instead of "xlat/capabilities1.h".
(print_cap_bits): Update callers.
* xlat/capabilities.in: Rename to xlat/cap_mask0.in.
* xlat/capabilities1.in: Rename to xlat/cap_mask1.in.
2015-02-19 00:33:39 +00:00
d8b3404555 Enhance wait status decoding
* xlat/ptrace_events.in: New file.
* wait.c: Include "xlat/ptrace_events.h".
(printstatus): In case of WIFSTOPPED, print 0x80 flag separately from
the stop signal name.
[WIFCONTINUED]: Add WIFCONTINUED support.
Decode PTRACE_EVENT_* events.
2015-02-12 23:24:46 +00:00
Bart Van Assche
67d0a8ecfa 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>
2015-02-08 02:07:22 +00:00
2af6903f45 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.
2015-02-06 01:23:05 +00:00
fef09070d6 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.
2015-02-05 01:10:47 +00:00
6d31c7a6a9 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.
2015-01-29 05:21:08 +00:00
02f2f091d5 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.
2015-01-29 03:35:11 +00:00
b85a7f3b95 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.
2015-01-24 15:54:33 +00:00
778dfb270f 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.
2015-01-24 15:19:33 +00:00
Gabriel Laskar
6f9a01c721 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>
2015-01-21 23:10:38 +00:00
924996a41e 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.
2015-01-21 00:48:52 +00:00
75023a9381 Fix build on systems that lack O_CLOEXEC definition
* xlat/timerfdflags.in [!TFD_CLOEXEC]: Check that O_CLOEXEC is defined.
2015-01-09 03:47:23 +00:00
2928afe3b4 Cleanup struct stat.st_flags decoding
There are no symbolic constants defined for struct stat.st_flags,
so decode this rare field as unsigned int.

* xlat/fileflags.in: Remove.
* file.c (realprintstat, printstat64) [HAVE_STRUCT_STAT_ST_FLAGS]:
Decode struct stat.st_flags as unsigned int.
2015-01-07 22:05:38 +00:00
Mike Frysinger
f1639d8f51 timerfd: update flags decoding
The current code only decodes TFD_TIMER_ABSTIME when the kernel has
a bunch of newer flags.  We have to handle fallbacks for all of them
since the kernel doesn't currently export things to userspace.

* time.c: Include fcntl.h for O_* defines.
(TFD_TIMER_ABSTIME): Move to xlat/timerfdflags.in.
* xlat/timerfdflags.in: Add more definitions.
2014-12-31 00:27:57 +00:00
79fb4d6a9a Update PTRACE_* constants
* xlat/ptrace_cmds.in: Add PTRACE_PEEKSIGINFO, PTRACE_GETSIGMASK,
and PTRACE_SETSIGMASK.
2014-12-13 01:56:56 +00:00
825b524c8c Update SWAP_FLAG_* constants
* swapon.c: Ensure that SWAP_FLAG_DISCARD_ONCE and
SWAP_FLAG_DISCARD_PAGES are defined.
* xlat/swap_flags.in: Add SWAP_FLAG_DISCARD_ONCE and
SWAP_FLAG_DISCARD_PAGES.
2014-12-13 01:34:47 +00:00
719554d5eb Update SCHED_* constants
* xlat/schedulers.in: Add SCHED_BATCH, SCHED_ISO, SCHED_IDLE, and
SCHED_DEADLINE.
2014-12-11 23:33:02 +00:00
4bcce0ae6f Update prctl PR_* constants
* xlat/prctl_options.in: Add PR_SET_THP_DISABLE, PR_GET_THP_DISABLE,
PR_MPX_ENABLE_MANAGEMENT, and PR_MPX_DISABLE_MANAGEMENT.
2014-12-11 23:33:01 +00:00
52572b6fdd Implement decoding of fallocate FALLOC_FL_* flags
* xlat/falloc_flags.in: New file.
* configure.ac (AC_CHECK_HEADERS): Add linux/falloc.h.
* fallocate.c [HAVE_LINUX_FALLOC_H]: Include <linux/falloc.h>.
Include xlat/falloc_flags.h.
(sys_fallocate): Decode flags.
2014-12-11 21:40:23 +00:00
4b9c68b9a3 Implement full decoding of 64-bit capabilities
Unlike v1 capabilities which are 32-bit, v2 and v3 are 64-bit, but
before this change only lower 32 capability bits were decoded for
v2 and v3.

* xlat/capabilities1.in: New file.
* capability.c: Define v2/v3 CAP_* constants.
Include xlat/capabilities1.h.
(get_cap_header): New function.
(print_cap_header): Update to use get_cap_header result.
(print_cap_data): Decoder higher capability bits for v2 and v3.
(sys_capget, sys_capset): Use get_cap_header, update print_cap_header
and print_cap_data calls.
* tests/caps.c: New file.
* tests/caps.awk: New file.
* tests/caps.test: New test.
* tests/Makefile.am (CHECK_PROGRAMS): Add caps.
(TESTS): Add caps.test.
(EXTRA_DIST): Add caps.awk.
2014-12-06 03:53:12 +00:00
bf7fdfa96e Make parsers of capget and capset syscalls self-contained
Various versions of <linux/capability.h> used to require different
workarounds to avoid conflicts with types defined by libc headers.
Define all required types and constants locally to fix this issue.

* configure.ac (AC_CHECK_HEADERS): Remove linux/capability.h.
* capability.c: Do not include <linux/capability.h>, remove workarounds
for problematic versions of <linux/capability.h> file.
Define CAP_* and _LINUX_CAPABILITY_VERSION_* constants as enums.
(struct __user_cap_header_struct, struct __user_cap_data_struct): Define.
* xlat/cap_version.in: Add #unconditional.
* xlat/capabilities.in: Likewise.
2014-12-06 03:41:39 +00:00
6b82ba5b7f Remove unused sys_mctl
Starting with commit v4.6-240-g5afdf12, nobody compiles this
non-Linux code.

* mem.c [MC_SYNC]: Remove.
* xlat/mctl_funcs.in: Remove.
* xlat/mctl_lockas.in: Remove.
2014-12-02 20:39:13 +00:00
681452b0f8 Remove unused <sys/acl.h> based code
Starting with commit v4.6-240-g5afdf12, nobody compiles this
non-Linux code.

* configure.ac (AC_CHECK_HEADERS): Remove sys/acl.h.
* file.c [HAVE_SYS_ACL_H]: Remove.
* xlat/aclcmds.in: Remove.
2014-12-01 19:45:24 +00:00
Mike Frysinger
18901ea0ca Decode open's O_TMPFILE
* xlat/open_mode_flags.in: Add O_TMPFILE definition.
2014-11-20 02:21:57 +00:00
Lubomir Rintel
c400a1c70e Dump details for Bluetooth socket operations
* configure.ac (AC_CHECK_HEADERS): Add bluetooth/bluetooth.h.
* xlat/bt_protocols.in: New file.
* net.c [AF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Include bluetooth
headers.
[PF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Include "xlat/bt_protocols.h".
(printsock) [AF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Dump details
for AF_BLUETOOTH sockets.
(sys_socket) [PF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Decode
protocol for PF_BLUETOOTH sockets.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-11-04 15:38:39 +00:00