]> granicus.if.org Git - strace/log
strace
6 years agoxlat/gen.sh: introduce XLAT_MACROS_ONLY macro
Eugene Syromyatnikov [Mon, 7 May 2018 00:43:34 +0000 (02:43 +0200)]
xlat/gen.sh: introduce XLAT_MACROS_ONLY macro

Sometimes we need just fallback definitions and nothing else.
This change adds an interface of skipping xlat table prototypes
and definitions.

* xlat/gen.sh (gen_header): Place xlat table prototype or definition
under "#ifndef XLAT_MACROS_ONLY" guard.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agortnl_link: print IFLA_NEW_IFINDEX using decode_nla_ifindex
Eugene Syromyatnikov [Mon, 7 May 2018 06:38:18 +0000 (08:38 +0200)]
rtnl_link: print IFLA_NEW_IFINDEX using decode_nla_ifindex

As it is an interface index.

* rtnl_link.c (ifinfomsg_nla_decoders) <[IFLA_NEW_IFINDEX]>: Change
the value from decode_nla_s32 to decode_nla_ifindex.

6 years agoci: install libbluetooth-dev
Eugene Syromyatnikov [Sun, 6 May 2018 20:44:45 +0000 (22:44 +0200)]
ci: install libbluetooth-dev

* ci/install-dependencies.sh (common_packages): Add libbluetooth-dev.

6 years agoxlat: provide fallback definitions for HCI_CHANNEL_* constants
Eugene Syromyatnikov [Sun, 6 May 2018 18:10:59 +0000 (20:10 +0200)]
xlat: provide fallback definitions for HCI_CHANNEL_* constants

* xlat/hci_channels.in: Provide fallback definitions.

6 years agos390: simplify s390_runtime_instr command printing
Eugene Syromyatnikov [Sun, 15 Apr 2018 23:14:02 +0000 (01:14 +0200)]
s390: simplify s390_runtime_instr command printing

As the header with command definitions is now a part of UAPI (since
Linux commit v4.16-rc1~21^2~11), there's no need for a very special
printing routine for command names.

* s390.c (SYS_FUNC(s390_runtime_instr)): Use printxval_d to print
the command argument.
* tests/s390_runtime_instr.c: Update expected output.

6 years agotests/init.sh: add run_prog_match_grep
Eugene Syromyatnikov [Sun, 29 Apr 2018 18:46:45 +0000 (20:46 +0200)]
tests/init.sh: add run_prog_match_grep

* tests/init.sh (run_prog_match_grep): New function, similar
to run_prog_match_diff.

6 years agotests: add so_peercred variants with different xlat verbosity levels
Eugene Syromyatnikov [Wed, 11 Apr 2018 17:34:31 +0000 (19:34 +0200)]
tests: add so_peercred variants with different xlat verbosity levels

* tests/so_peercred-Xabbrev.c: New file.
* tests/so_peercred-Xraw.c: Likewise.
* tests/so_peercred-Xverbose.c: Likewise.
* tests/pure_executables.list: Add so_peercred-Xabbrev,
so_peercred-Xraw, and so_peercred-Xverbose.
* tests/.gitignore: Likewise.
* tests/so_peercred.c: Add handling of XLAT_RAW and XLAT_VERBOSE flags.
* tests/gen_tests.in (so_peercred-Xabbrev, so_peercred-Xraw,
so_peercred-Xverbose): New tests.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agotests: add personality variants with different xlat verbosity levels
Eugene Syromyatnikov [Wed, 11 Apr 2018 00:41:16 +0000 (02:41 +0200)]
tests: add personality variants with different xlat verbosity levels

* tests/personality-Xabbrev.c: New file.
* tests/personality-Xraw.c: Likewise.
* tests/personality-Xverbose.c: Likewise.
* tests/pure_executables.list: Add personality-Xabbrev,
personality-Xraw, and personality-Xverbose.
* tests/.gitignore: Likewise.
* tests/personality.c: Add handling of XLAT_RAW and XLAT_VERBOSE flags.
* tests/personality.test: Add support for accepting test arguments.
* tests/gen_tests.in (personality-Xabbrev, personality-Xraw,
personality-Xverbose): New tests.

6 years agotests: add fanotify_mark variants with different xlat verbosity levels
Eugene Syromyatnikov [Tue, 10 Apr 2018 13:10:44 +0000 (15:10 +0200)]
tests: add fanotify_mark variants with different xlat verbosity levels

* tests/fanotify_mark-Xabbrev.c: New file.
* tests/fanotify_mark-Xraw.c: Likewise.
* tests/fanotify_mark-Xverbose.c: Likewise.
* tests/pure_executables.list: Add fanotify_mark-Xabbev,
fanotify_mark-Xraw, and fanotify_mark-Xverbose.
* tests/.gitignore: Likewise.
* tests/fanotify_mark.c: Add handling of XLAT_RAW and XLAT_VERBOSE
flags.
* tests/gen_tests.in (fanotify_mark-Xabbev, fanotify_mark-Xraw,
fanotify_mark-Xverbose): New tests.

6 years agoxlat: provide fallback definitions for IFF_* constants
Eugene Syromyatnikov [Mon, 7 May 2018 07:15:45 +0000 (09:15 +0200)]
xlat: provide fallback definitions for IFF_* constants

* xlat/iffflags.in: Provide fallback definitions.  Mention that
the array is sorted.

6 years agoxlat: update IFF_* constants
Eugene Syromyatnikov [Mon, 7 May 2018 07:09:30 +0000 (09:09 +0200)]
xlat: update IFF_* constants

* xlat/iffflags.in (IFF_DYNAMIC): New constant, had been introduced
before the current git repository was conceived.
(IFF_LOWER_UP, IFF_DORMANT): New constants, introduced by Linux commit
v2.6.17-rc1~1175^2~206.
(IFF_ECHO): New constant, introduced by Linux commit
v2.6.25-rc1~1162^2~1415.

6 years agoxlat: provide fallback definitions for ARPHRD_* constants
Eugene Syromyatnikov [Sun, 6 May 2018 22:30:21 +0000 (00:30 +0200)]
xlat: provide fallback definitions for ARPHRD_* constants

* xlat/arp_hardware_types.in: Provide fallback definitions, sort.

6 years agotests: add more v4l2 checks
Eugene Syromyatnikov [Mon, 9 Apr 2018 15:12:32 +0000 (17:12 +0200)]
tests: add more v4l2 checks

* tests/ioctl_v4l2.c (main): Add more VIDIOC_S_EXT_CTRLS checks.

6 years agotests: add variants of IPC tests with different xlat verbosity levels
Eugene Syromyatnikov [Sat, 7 Apr 2018 00:30:43 +0000 (02:30 +0200)]
tests: add variants of IPC tests with different xlat verbosity levels

* tests/.gitignore: Add ipc_msg-Xabbrev, ipc_msg-Xraw, ipc_msg-Xverbose,
ipc_msgbuf-Xabbrev, ipc_msgbuf-Xraw, ipc_msgbuf-Xverbose,
ipc_sem-Xabbrev, ipc_sem-Xraw, ipc_sem-Xverbose, ipc_shm-Xabbrev,
ipc_shm-Xraw, and ipc_shm-Xverbose.
* tests/pure_executables.list: Likewise.
* tests/gen_tests.in (ipc_msg-Xabbrev, ipc_msg-Xraw, ipc_msg-Xverbose,
ipc_msgbuf-Xabbrev, ipc_msgbuf-Xraw, ipc_msgbuf-Xverbose,
ipc_sem-Xabbrev, ipc_sem-Xraw, ipc_sem-Xverbose, ipc_shm-Xabbrev,
ipc_shm-Xraw, ipc_shm-Xverbose): New tests.
* tests/ipc_msg-Xabbrev.c: New file.
* tests/ipc_msg-Xraw.c: Likewise.
* tests/ipc_msg-Xverbose.c: Likewise.
* tests/ipc_msgbuf-Xabbrev.c: Likewise.
* tests/ipc_msgbuf-Xraw.c: Likewise.
* tests/ipc_msgbuf-Xverbose.c: Likewise.
* tests/ipc_sem-Xabbrev.c: Likewise.
* tests/ipc_sem-Xraw.c: Likewise.
* tests/ipc_sem-Xverbose.c: Likewise.
* tests/ipc_shm-Xabbrev.c: Likewise.
* tests/ipc_shm-Xraw.c: Likewise.
* tests/ipc_shm-Xverbose.c: Likewise.
* tests/ipc.sh: Add support for accepting test arguments.
* tests/ipc_msgbuf.test: Likewise.
* tests/ipc_msg.c: Add handling of XLAT_RAW and XLAT_VERBOSE flags.
* tests/ipc_msgbuf.c: Likewise.
* tests/ipc_sem.c: Likewise.
* tests/ipc_shm.c: Likewise.

6 years agotests: make ipc tests a bit more strict
Eugene Syromyatnikov [Sat, 7 Apr 2018 00:25:59 +0000 (02:25 +0200)]
tests: make ipc tests a bit more strict

* tests/gen_tests.in (ipc_msg, ipc_sem, ipc_shm): Add -a option.
* tests/ipc_msg.c: Replace " +" with " " in expected output.
* tests/ipc_sem.c: Likewise.
* tests/ipc_shm.c: Likewise.

6 years agoipc_shm: print SHM_HUGE_SHIFT using print_xlat_u
Eugene Syromyatnikov [Sat, 7 Apr 2018 00:12:10 +0000 (02:12 +0200)]
ipc_shm: print SHM_HUGE_SHIFT using print_xlat_u

* ipc_shm.c (SYS_FUNC(shmget)): Print SHM_HUGE_SHIFT using print_xlat_u.

6 years agotests: check all bits of mtype in ipc_msgbuf test
Eugene Syromyatnikov [Fri, 6 Apr 2018 17:03:04 +0000 (19:03 +0200)]
tests: check all bits of mtype in ipc_msgbuf test

* tests/ipc_msgbuf.c: Include <unistd.h> and <asm/unistd.h>.
(sys_msgrcv): New function.
(msgrcv): Use it instead of msgrcv.  Add bits to mtype,
check for -mtype in msgrcv.

6 years agotests: print expected output by ipc_msgbuf test itself
Eugene Syromyatnikov [Fri, 6 Apr 2018 17:01:39 +0000 (19:01 +0200)]
tests: print expected output by ipc_msgbuf test itself

* tests/ipc_msgbuf.expected: Remove.
* tests/Makefile.am (EXTRA_DIST): Remove tests/ipc_msgbuf.expected.
* tests/ipc_msgbuf.c: Add expected output.
* tests/ipc_msgbuf.test: Add -a31.  Redirect output to $EXP.  Call
match_grep with $LOG and $EXP arguments.

6 years agoxlat: provide fallback definitions for SKF_*_OFF constants
Dmitry V. Levin [Mon, 7 May 2018 10:52:16 +0000 (10:52 +0000)]
xlat: provide fallback definitions for SKF_*_OFF constants

* xlat/skf_off.in: New file.
* bpf_sock_filter.c: Include "xlat/skf_off.h".

6 years agoxlat: provide fallback definitions for BPF_* constants
Dmitry V. Levin [Mon, 7 May 2018 10:52:16 +0000 (10:52 +0000)]
xlat: provide fallback definitions for BPF_* constants

* xlat/bpf_class.in: Add default values for constants.
* 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.

6 years agoxlat: fix F_* fallback definitions on mips64
Dmitry V. Levin [Sun, 6 May 2018 23:28:24 +0000 (23:28 +0000)]
xlat: fix F_* fallback definitions on mips64

* xlat/fcntlcmds.in (F_GETLK64, F_SETLK64, F_SETLKW64) [__mips64]: Fix
default values.

Fixes: v4.22-122-gfa8f486 ("xlat: fix F_* fallback definitions on alpha, hppa, mips, and sparc")
6 years agoxlat: add fallback definitions to SO_* constants
Eugene Syromyatnikov [Fri, 4 May 2018 16:19:07 +0000 (18:19 +0200)]
xlat: add fallback definitions to SO_* constants

Regenerate xlat/sockoptions.in using the following script:

  sed -n 's/^\(SO_[^[:space:]]*\).*/\1/p' xlat/sockoptions.in |
  uniq |
  while read name; do
    sed -rn 's/#define[[:space:]]+('"$name"')[[:space:]]+([[:digit:]]+)$/\2\t\1/p' \
      /path/to/linux/include/uapi/asm-generic/socket.h
  done |
  sort -n |
  while read def name; do
    grep -EH '#define[[:space:]]+'"$name"'[[:space:]]+(0x[[:xdigit:]]+|[[:digit:]]+)' \
      /path/to/linux/arch/*/include/uapi/asm/socket.h |
    sed -rn 's|^[^#]*/arch/([^/]+)/include/uapi/asm/socket\.h:#define[[:space:]]+'"$name"'[[:space:]]+([^[:space:]]+)([[:space:]].*)?$|\1\t\2|p' |
    sed s/parisc/hppa/ |sort |
    awk -vname="$name" -vdef="$def" '
      {
        i=strtonum($2)
        if (i == def) next
        if (a[i])
          a[i]=a[i] " || defined __" $1 "__"
        else
          a[i]="defined __" $1 "__"
      }
      END {
        iftext="#if"
        for (i in a) {
          printf("%s %s\n%s %u\n",iftext,a[i],name,i)
          iftext="#elif"
        }
        if (iftext != "#if")
          print "#else"
        printf("%s %s\n", name, def)
        if (iftext == "#if")
          print ""
        else
          print "#endif\n"
      }'
  done

* xlat/sockoptions.in: Add fallback definitions.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agoxlat: remove socket options with duplicate names
Eugene Syromyatnikov [Fri, 4 May 2018 16:01:48 +0000 (18:01 +0200)]
xlat: remove socket options with duplicate names

* xlat/sockoptions.in (SO_GET_FILTER): Remove as it is defined
to SO_ATTACH_FILTER.
(SO_DETACH_BPF): Remove as it is defined to SO_DETACH_FILTER.

6 years agoxlat: remove socket options that do not exist in Linux
Eugene Syromyatnikov [Fri, 4 May 2018 16:00:00 +0000 (18:00 +0200)]
xlat: remove socket options that do not exist in Linux

* xlat/sockoptions.in (SO_ALLRAW, SO_ICS, SO_IMASOCKET, SO_LISTENING,
SO_MGMT, SO_ORDREL, SO_PARALLELSVR, SO_PROTOTYPE, SO_RDWRSO_SEMA,
SO_USELOOPBACK): Remove.

6 years agoxlat: treat socketlayers as a sorted array
Eugene Syromyatnikov [Wed, 11 Apr 2018 14:32:30 +0000 (16:32 +0200)]
xlat: treat socketlayers as a sorted array

* xlat/socketlayers.in: Add a comment that the xlat is sorted.
* net.c (print_sockopt_fd_level_name): Use printxval_search
instead of printxval for decoding socket layer name.

6 years agonet: decode Bluetooth protocol names unconditionally
Eugene Syromyatnikov [Wed, 11 Apr 2018 11:53:54 +0000 (13:53 +0200)]
net: decode Bluetooth protocol names unconditionally

As we have all BTPROTO_* constant definitions now, there is no need
to rely on bluetooth.h header anymore.

* net.c (AF_BLUETOOTH): Provide a fallback definition.
[HAVE_BLUETOOTH_BLUETOOTH_H]: Do not include <bluetooth/bluetooth.h>.
[!HAVE_BLUETOOTH_BLUETOOTH_H]: Include "xlat/bt_protocols.h".
[!HAVE_BLUETOOTH_BLUETOOTH_H] (decode_sockbuf): Decode AF_BLUETOOTH.
(decode_sockbuf) <case AF_BLUETOOTH>: Use printxval_index.
* xlat/bt_protocols.in: Add "#value_indexed" directive.

6 years agoxlat/gen.sh: invoke the shell interpreter with -e -u options
Eugene Syromyatnikov [Thu, 26 Apr 2018 23:27:45 +0000 (01:27 +0200)]
xlat/gen.sh: invoke the shell interpreter with -e -u options

* xlat/gen.sh: Change interpreter from "/bin/sh" to "/bin/sh -eu".

6 years agoxlat: update FPE_* constants
Eugene Syromyatnikov [Sun, 15 Apr 2018 23:17:51 +0000 (01:17 +0200)]
xlat: update FPE_* constants

* xlat/sigfpe_codes.in (FPE_FLTUNK): New constant, introduced by Linux
commit v4.17-rc1~107^2~2.
(FPE_CONDTRAP): New constant, introduced by Linux commit
v4.17-rc1~31^2~3.

6 years agoxlat: add MAP_FIXED_NOREPLACE
Eugene Syromyatnikov [Sun, 15 Apr 2018 21:38:33 +0000 (23:38 +0200)]
xlat: add MAP_FIXED_NOREPLACE

* xlat/mmap_flags.in (MAP_FIXED_NOREPLACE): New constant, introduced
by Linux commit v4.17-rc1~52^2~14.

6 years agoxlat: provide fallback definitions for BTPROTO_* constants
Eugene Syromyatnikov [Wed, 11 Apr 2018 11:52:14 +0000 (13:52 +0200)]
xlat: provide fallback definitions for BTPROTO_* constants

As they are architecture-independent.

* xlat/bt_protocols.in: Add values to constants.

6 years agoxlat: add NETLINK_SMC
Eugene Syromyatnikov [Wed, 11 Apr 2018 11:49:03 +0000 (13:49 +0200)]
xlat: add NETLINK_SMC

* xlat/netlink_protocols.in (NETLINK_SMC): New constant, introduced
by Linux commit v4.11-rc1~94^2~43^2.

6 years agoxlat: provide fallback definitions for V4L2_CID_* constants
Eugene Syromyatnikov [Tue, 10 Apr 2018 06:52:25 +0000 (08:52 +0200)]
xlat: provide fallback definitions for V4L2_CID_* constants

* xlat/v4l2_control_id_bases.in: New file with fallback definitions.
* xlat/v4l2_control_ids.in: Add fallback definitions.
* v4l2.c: Reorder includes, include "xlat/v4l2_control_id_bases.h",
remove legacy V4L2_CID_* constant definitions.

6 years agoxlat: update V4L2_CID_* constants
Eugene Syromyatnikov [Mon, 9 Apr 2018 15:20:12 +0000 (17:20 +0200)]
xlat: update V4L2_CID_* constants

Synchronise v4l2_control_ids list with the one provided by kernel's
include/uapi/linux/v4l2-controls.h.  A few notes:
 - V4L2_CID_CHROMA_GAIN and V4L2_CID_COLORFX_CBCR moved in accordance
   with their position/values.
 - V4L2_CID_WHITENESS is removed as it has the same value as
   V4L2_CID_GAMMA.
 - V4L2_CID_PRIVATE_BASE is removed.
 - V4L2_CID_HCENTER and V4L2_CID_VCENTER that were removed by Linux
   commit v3.9-rc1~93^2~237, are retained for historical reasons.

* xlat/v4l2_control_ids.in: Update.

6 years agoxlat: provide fallback definitions for V4L2_CTRL_CLASS_* constants
Eugene Syromyatnikov [Mon, 9 Apr 2018 14:39:27 +0000 (16:39 +0200)]
xlat: provide fallback definitions for V4L2_CTRL_CLASS_* constants

As those are architecture-independant.  Also note that the xlat
is sorted.

* xlat/v4l2_control_classes.in: Add values.

6 years agoxlat: update V4L2_CTRL_CLASS_* constants
Eugene Syromyatnikov [Mon, 9 Apr 2018 14:34:33 +0000 (16:34 +0200)]
xlat: update V4L2_CTRL_CLASS_* constants

* xlat/v4l2_control_classes.in (V4L2_CTRL_CLASS_DV): New constant,
introduced by Linux commit v3.7-rc1~101^2^2~322.
(V4L2_CTRL_CLASS_RF_TUNER): New constant, introduced by Linux commit
v3.15-rc1~85^2~192.
(V4L2_CTRL_CLASS_DETECT): New constant, introduced by Linux commit
v3.17-rc1~112^2~340.

6 years agoxlat: update BPF_F_* constants
Eugene Syromyatnikov [Sun, 8 Apr 2018 21:06:17 +0000 (23:06 +0200)]
xlat: update BPF_F_* constants

Apparently, BPF_F_RDONLY and BPF_F_WRONLY are also used in map_flags.
Moreover, set of flags depends on the type of map, but let's leave that
for another day.

* xlat/bpf_map_flags.in (BPF_F_RDONLY, BPF_F_WRONLY): New constants.
(BPF_F_STACK_BUILD_ID): New constant, introduced by Linux commit
v4.17-rc1~148^2~156^2~3^2~1.
* xlat/bpf_map_flags.in: Update expected output.

6 years agoxlat: add V4L2_PIX_FMT_HEVC
Eugene Syromyatnikov [Mon, 9 Apr 2018 14:07:50 +0000 (16:07 +0200)]
xlat: add V4L2_PIX_FMT_HEVC

* xlat/v4l2_pix_fmts.in (V4L2_PIX_FMT_HEVC): New constant, introduced
by Linux commit v4.17-rc1~143^2~60.

6 years agoxlat: add ETH_P_PREAUTH
Eugene Syromyatnikov [Sun, 8 Apr 2018 21:29:35 +0000 (23:29 +0200)]
xlat: add ETH_P_PREAUTH

* xlat/ethernet_protocols.in (ETH_P_PREAUTH): New constant, introduced
by Linux commit v4.17-rc1~148^2~379^2~3.

6 years agoxlat: update SCTP_* constants
Eugene Syromyatnikov [Sun, 8 Apr 2018 21:18:37 +0000 (23:18 +0200)]
xlat: update SCTP_* constants

* xlat/socksctpoptions.in (SCTP_AUTH_DEACTIVATE_KEY): New constant,
introduced by Linux commit v4.17-rc1~148^2~191^2~2.
(SCTP_SENDMSG_CONNECT): New constant, introduced by Linux commit
v4.17-rc1~96^2~9.

6 years agoxlat: add SPARC ADI-related SIGSEGV codes
Eugene Syromyatnikov [Sun, 8 Apr 2018 20:55:29 +0000 (22:55 +0200)]
xlat: add SPARC ADI-related SIGSEGV codes

* xlat/sigsegv_codes.in (SEGV_ACCADI, SEGV_ADIDERR, SEGV_ADIPERR): New
constants, introduced by Linux commit v4.17-rc1~147^2~4^2~10.

6 years agoxlat: add PROT_ADI
Eugene Syromyatnikov [Sun, 8 Apr 2018 20:52:31 +0000 (22:52 +0200)]
xlat: add PROT_ADI

* xlat/mmap_prot.in (PROT_ADI): New constant, introduced by Linux commit
v4.17-rc1~147^2~4^2~1.

6 years agobuild: rewrite libdw detection without pkg-config
Dmitry V. Levin [Sat, 5 May 2018 14:38:38 +0000 (14:38 +0000)]
build: rewrite libdw detection without pkg-config

pkg-config expected to be more convenient way to configure libdw,
but in practice it appeared to be less portable than good old
AC_CHECK_HEADERS and AC_CHECK_LIB.

* ci/install-dependencies.sh (common_packages): Remove pkg-config.
(STACKTRACE == "libdw"): Do not install libz-dev and liblzma-dev.
* debian/control (Build-Depends): Remove pkg-config.
* m4/st_libdw.m4 (st_ARG_LIBDW, st_LIBDW): Rewrite without pkg-config.

6 years agoci: add more variants of unwinder to test matrices
Dmitry V. Levin [Fri, 4 May 2018 23:13:45 +0000 (23:13 +0000)]
ci: add more variants of unwinder to test matrices

Check x86_64 builds with libdw, with libunwind, and without stacktrace.
As Travis CI doesn't provide a suitable libdw, do not test libdw there.

* ci/install-dependencies.sh (common_packages): Remove libdw-dev.
Install libdw-dev or libunwind8-dev depending on $STACKTRACE.
* ci/run-build-and-tests.sh: Specify --with-libdw=yes,
--with-libunwind=yes, or --without-stacktrace depending on $STACKTRACE.
* .gitlab-ci.yml (gcc-x86_64): Rename to gcc-x86_64-libdw,
add STACKTRACE=libdw.
(gcc-x86): Rename to gcc-x86-nounwind, add STACKTRACE=no.
(clang-x86_64): Rename to clang-x86_64-libdw, add STACKTRACE=libdw.
(clang-x86): Rename to clang-x86-nounwind, add STACKTRACE=no.
(gcc-x86_64-libunwind, gcc-x86_64-nounwind, gcc-x86-nounwind,
clang-x86_64-libunwind, clang-x86_64-nounwind, clang-x86-nounwind):
New test matrix entries.
* .travis.yml: Add STACKTRACE=libunwind to all x86_64 test matrix
entries except musl-gcc, add STACKTRACE=no to other matrix entries,
add test matrix entries with STACKTRACE=no variants on x86_64.

6 years agoxlat: update af_packet_types
Eugene Syromyatnikov [Fri, 4 May 2018 17:16:05 +0000 (19:16 +0200)]
xlat: update af_packet_types

* xlat/af_packet_types.in: Add values.
(PACKET_USER, PACKET_KERNEL): New constants, introduced by Linux commit
v3.14-rc1~94^2~349.

6 years agoxlat: add values to adjtimex_state, adjtimex_status, advise xlats
Eugene Syromyatnikov [Fri, 4 May 2018 17:15:22 +0000 (19:15 +0200)]
xlat: add values to adjtimex_state, adjtimex_status, advise xlats

* xlat/adjtimex_state.in: Add values.
* xlat/adjtimex_status.in: Likewise.
* xlat/advise.in: Likewise.

6 years agoxlat: update adjtimex_modes
Eugene Syromyatnikov [Fri, 4 May 2018 17:12:48 +0000 (19:12 +0200)]
xlat: update adjtimex_modes

* xlat/adjtimex_modes.in: Add values to constants.
(0): Remove.
(ADJ_OFFSET_SS_READ): Move to the first place.
(ADJ_OFFSET_SINGLESHOT): Move to the second place.

6 years agommap_cache: do not activate unless requested
Dmitry V. Levin [Fri, 4 May 2018 14:45:44 +0000 (14:45 +0000)]
mmap_cache: do not activate unless requested

Do not call mmap_cache functions until mmap_cache_enable is invoked.
Change struct mmap_cache_t into a proxy structure, move all mmap_cache
data from struct tcb inside this new structure.

* Makefile.am (strace_SOURCES): Move mmap_cache.c and mmap_cache.h
to libstrace_a_SOURCES.
* defs.h (struct tcb): Remove mmap_cache_size and mmap_cache_generation
* fields.
* mmap_cache.h (struct mmap_cache_t): Rename
to struct mmap_cache_entry_t, create a new struct mmap_cache_t,
all users updated.
(mmap_cache_delete): Remove.
* mmap_cache.c (mmap_cache_delete): Rename to delete_mmap_cache,
add static qualifier.
(build_mmap_cache): Merge into mmap_cache_rebuild_if_invalid.
* strace.c (droptcb): Replace mmap_cache_delete invocation
with tcp->mmap_cache->free_fn.

6 years agommap_cache: remove mmap_cache_is_enabled
Dmitry V. Levin [Thu, 3 May 2018 23:43:38 +0000 (23:43 +0000)]
mmap_cache: remove mmap_cache_is_enabled

This function is no longer used and could be removed.

* mmap_cache.c (mmap_cache_is_enabled): Remove.
* mmap_cache.h: Likewise.

6 years agounwind-libdw: use the mmap_notify subsystem
Masatake YAMATO [Sun, 29 Apr 2018 21:45:40 +0000 (06:45 +0900)]
unwind-libdw: use the mmap_notify subsystem

The unwind subsystem uses the mmap_cache subsystem even it uses
unwind-libdw as backend. unwind-libdw doesn't need the full set of the
mmap_cache subsystem; libdw has a feature for caching a memory
mapping.

This commit does three things.

(1) Make the unwind subsystem not use the mmap_cache subsystem.
The unwind subsystem never concern the memory mapping of the target.
It becomes a thin layer.

(2) Make unwind-libunwind use the mmap_cache subsystem directly.

(3) Make unwind-libdw use the mmap_notify subsystem to know when it
should call dwfl_linux_proc_report/dwfl_report_end for updating the
cache.

Here is a subsystem structure that this patch
introduces:

+-------------------------------------+
|            unwind subsys            |
+------------------+------------------+
| unwind-libunwind |   unwind-libdw   |
+------------------+------------------+
|    mmap_cache    |                  |
+------------------+                  |
|               mmap_notify           |
+-------------------------------------+
|                syscall              |
+-------------------------------------+
               mmap/munmap/mprotect/brk...

* unwind.c: Don't include "mmap_cache.h".
(unwind_init): Don't call mmap_cache_enable.
(unwind_tcb_print, unwind_tcb_capture): Don't call mmap_cache related
functions, just invoke unwinder.tcb_walk.
* unwind.h (struct unwind_unwinder_t): Remove tcb_flush_cache field.

* unwind-libdw.c: Include "mmap_notify.h" instead of "mmap_cache.h".
(struct ctx): Add last_proc_updating field to record the generation
of memory mapping that is cached by dwfl_linux_proc_report
and dwfl_report_end.
(mapping_generation): A variable counting how many times the memory
mapping of targets has been changed.
(updating_mapping_generation): New utility function for updating
mapping_generation.
(init): New function for registering updating_mapping_generation
in the mmap_notify subsystem as a callback function.
(tcb_init): Initialize ctx::last_proc_updating.
(tcb_flush_cache): Rename to flush_cache_maybe.  Rebuild the cache data
only if the data is stale.
(tcb_walk): Call flush_cache_maybe for avoiding referring staled cache data.
(unwinder): Set init function, remove tcb_flush_cache field.
* unwind-libunwind.c (init): Enable the mmap_cache subsystem.
(tcb_walk): Call mmap_cache_rebuild_if_invalid and unw_flush_cache for
updating the cache of the memory mapping before walking the stack.
(tcb_walk): Rename to walk.
(unwinder): Remove tcb_flush_cache field.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 years agounwind-libdw: introduce indirect data structure for storing unwinding context
Masatake YAMATO [Sun, 29 Apr 2018 21:45:39 +0000 (06:45 +0900)]
unwind-libdw: introduce indirect data structure for storing unwinding context

unwind-libdw uses Dwfl as the data structure for storing unwinding
context.  It is raw data that come from libdw.

This commit introduces "struct ctx" file local data type for allowing
unwind-libdw to attach strace side data to the unwinding context.

* unwind-libdw.c (struct ctx): New struct definition.
(tcb_init, tcb_fin, tcb_walk, tcb_flush_cache): Use struct ctx instead
of Dwfl directly.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 years agommap_notify: rename the macro for tracking memory mapping
Masatake YAMATO [Sun, 29 Apr 2018 21:45:38 +0000 (06:45 +0900)]
mmap_notify: rename the macro for tracking memory mapping

* sysent.h (STACKTRACE_INVALIDATE_CACHE): Rename to
MEMORY_MAPPING_CHANGE.  All users updated.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 years agommap_cache: use the mmap_notify subsystem
Masatake YAMATO [Sun, 29 Apr 2018 21:45:37 +0000 (06:45 +0900)]
mmap_cache: use the mmap_notify subsystem

* mmap_cache.c: Include mmap_notify.h.
(mmap_cache_enable): Call mmap_notify_register_client to use
the mmap_notify subsystem, mmap_cache_invalidate is specified
to handle the change of memory mapping.
(mmap_cache_invalidate): Add static qualifier.
* mmap_cache.h (mmap_cache_invalidate): Remove.
* syscall.c: Include mmap_notify.h instead of mmap_cache.h.
(syscall_exiting_decode): Call mmap_notify_report instead
of mmap_cache_invalidate.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 years agommap_notify: new subsystem for tracking the changes of memory mappings
Masatake YAMATO [Sun, 29 Apr 2018 21:45:36 +0000 (06:45 +0900)]
mmap_notify: new subsystem for tracking the changes of memory mappings

This subsystem is a spin-off of the mmap_cache subsystem.

The mmap_cache subsystem had two features: (1) tracking the change
of memory mapping, and (2) maintaining the cache of memory mapping.

mmap_notify is a subsystem specialized to provide feature (2).
unwind-libdw itself has the feature (1).  It needs only (2).

* mmap_notify.h: New file.
* mmap_notify.c: Likewise.
* Makefile.am (strace_SOURCES): Add them.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 years agobtrfs: add missing braces
Eugene Syromyatnikov [Wed, 2 May 2018 20:41:28 +0000 (22:41 +0200)]
btrfs: add missing braces

Reported by Coverity.

* btrfs.c (MPERS_PRINTER_DECL(btrfs_ioctl)) <case
BTRFS_IOC_TREE_SEARCH_V2>: Add missing braces.

Fixes: v4.22-76-gf766447 "btrfs: use PRINT_FIELD_*"
6 years agostrace.c: check return code of never failing fcntl call
Eugene Syromyatnikov [Wed, 2 May 2018 18:59:32 +0000 (20:59 +0200)]
strace.c: check return code of never failing fcntl call

Because the kernel cannot be trusted.

* strace.c (set_cloexec_flag): Call perror_msg_and_die if fcntl(F_SETFD)
has failed.

6 years agosock: use error_func_msg for printing function name
Eugene Syromyatnikov [Wed, 2 May 2018 18:58:49 +0000 (20:58 +0200)]
sock: use error_func_msg for printing function name

* sock.c (decode_ifconf): Use error_func_msg instead of error_msg with
manual function name printing.

6 years agoutil.c: add len sanity checks to dumpstr
Eugene Syromyatnikov [Wed, 2 May 2018 18:57:58 +0000 (20:57 +0200)]
util.c: add len sanity checks to dumpstr

Reported by clang.

* util.c (dumpstr): Check that len is sane.

6 years agommap_cache: fool-proofing build_mmap_cache
Eugene Syromyatnikov [Wed, 2 May 2018 18:20:38 +0000 (20:20 +0200)]
mmap_cache: fool-proofing build_mmap_cache

Let's try to handle better the situation when build_mmap_cache is called
without mmap_cache/mmap_cache_size being reset prior to the call.

Reported by Coverity scan.

* mmap_cache.c (build_mmap_cache): Set cache_head to tcp->mmap_cache.
Reset tcp->mmap_cache_size to 0.

6 years agoerror_prints: add missing va_end() calls
Eugene Syromyatnikov [Wed, 2 May 2018 18:08:19 +0000 (20:08 +0200)]
error_prints: add missing va_end() calls

These missing va_end() calls are followed by die() calls that never
return, so the only practical effect of this change is appeasement
of code checking tools.

Reported by cppcheck.

* error_prints.c (error_msg_and_die, error_msg_and_help,
perror_msg_and_die): Add va_end().

6 years agomem: handle potential error from sysconf(_SC_PAGESIZE)
Eugene Syromyatnikov [Wed, 2 May 2018 18:04:23 +0000 (20:04 +0200)]
mem: handle potential error from sysconf(_SC_PAGESIZE)

Reported by Coverity scan.

* mem.c (get_pagesize): Handle the case when sysconf(_SC_PAGESIZE)
returns an error.

6 years agoxlat: merge fcntl64cmds into fcntlcmds
Dmitry V. Levin [Wed, 2 May 2018 15:23:46 +0000 (15:23 +0000)]
xlat: merge fcntl64cmds into fcntlcmds

Since we don't have to workaround old F_[GS]ETOWN_EX == F_[SG]ETLK64
kernel bug any longer, there is a room for cleanup.

* xlat/fcntlcmds.in (F_GETLK64, F_SETLK64, F_SETLKW64): Add from
xlat/fcntl64cmds.in.
* xlat/fcntl64cmds.in: Remove.
* fcntl.c: Do not include "xlat/fcntl64cmds.h".
(SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): Do not use fcntl64cmds, call
printxval instead of printxvals.

6 years agotests: check decoding of F_GETOWN_EX and F_SETOWN_EX fcntl commands
Zhibin Li [Wed, 2 May 2018 15:16:57 +0000 (23:16 +0800)]
tests: check decoding of F_GETOWN_EX and F_SETOWN_EX fcntl commands

* tests/fcntl.c (TEST_F_OWNER_EX): New macro.
[TEST_F_OWNER_EX]: Include "f_owner_ex.h".
[TEST_F_OWNER_EX] (test_f_owner_ex_type_pid,
test_f_owner_ex_umove_or_printaddr, test_f_owner_ex): New functions.
(main) [TEST_F_OWNER_EX]: Use test_f_owner_ex.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agoIntroduce f_owner_ex.h
Dmitry V. Levin [Wed, 2 May 2018 15:23:46 +0000 (15:23 +0000)]
Introduce f_owner_ex.h

Some headers define struct f_owner_ex, some struct __kernel_f_owner_ex,
we have to support both variants.

* configure.ac (AC_CHECK_TYPES): Check for "struct f_owner_ex"
and "struct __kernel_f_owner_ex" in <linux/fcntl.h>.
* f_owner_ex.h: New file.
* Makefile.am (strace_SOURCES): Add it.

6 years agotests/ioctl_kvm_run.c: handle cpuid at the end of vcpu dentry
Masatake YAMATO [Wed, 2 May 2018 08:11:07 +0000 (17:11 +0900)]
tests/ioctl_kvm_run.c: handle cpuid at the end of vcpu dentry

Since Linux 4.16, kernel appends the cpuid as suffix to the entry
for a kvm vcpu in /proc/$pid/fd like:

    anon_inode:kvm-vcpu:0

That was

    anon_inode:kvm-vcpu

This kernel change causes the test case failure on newer kernels.
Update the test to deal with the new name as well as the old one.

* tests/ioctl_kvm_run.c: Include unistd.h for using readlink(2).
(vcpu_dev_should_have_cpuid): New function for detecting whether
a proc entry for given fd has the cpuid suffix or not.
(main): Trim vcpu_dev to remove the cpuid suffix if needed.
(vcpu_dev): Remove const modifier.

6 years agoxlat: check that system definitions match fallback definitions
Dmitry V. Levin [Sun, 29 Apr 2018 21:59:55 +0000 (21:59 +0000)]
xlat: check that system definitions match fallback definitions

For each constant that is accompanied by a fallback definition,
generate a sanity check that the definition provided by system headers
matches the fallback definition.

* gcc_compat.h (DIAG_PUSH_IGNORE_TAUTOLOGICAL_COMPARE,
DIAG_POP_IGNORE_TAUTOLOGICAL_COMPARE): New macros.
* xlat/gen.sh (cond_def): Generate a code that checks the system
definition against the default.
(gen_header): Generate a code that includes "gcc_compat.h" and
"static_assert.h".

Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
6 years agoxlat: override values of F_SETOWN_EX and F_GETOWN_EX constants
Dmitry V. Levin [Sun, 29 Apr 2018 21:59:55 +0000 (21:59 +0000)]
xlat: override values of F_SETOWN_EX and F_GETOWN_EX constants

Linux kernel commit v2.6.32-rc7~23 has changed values of F_SETOWN_EX
and F_GETOWN_EX constants introduced by commit v2.6.32-rc1~96 to fix
the conflict with F_GETLK64 and F_SETLK64 constants.

Looks like the best way to handle this situation is to pretend that
old values of F_SETOWN_EX and F_GETOWN_EX didn't exist.

* xlat/fcntlcmds.in (F_SETOWN_EX, F_GETOWN_EX): Undefine.

6 years agoxlat: fix F_* fallback definitions on alpha, hppa, mips, and sparc
Dmitry V. Levin [Sun, 29 Apr 2018 21:59:55 +0000 (21:59 +0000)]
xlat: fix F_* fallback definitions on alpha, hppa, mips, and sparc

* xlat/fcntlcmds.in (F_GETLK, F_SETLK, F_SETLKW, F_SETOWN, F_GETOWN,
F_SETSIG, F_GETSIG) [alpha || hppa || mips || sparc]: Fix definitions.
* xlat/fcntl64cmds.in (F_GETLK64, F_SETLK64, F_SETLKW64) [hppa || mips]:
Likewise.

6 years agoxlat: fix SI_* fallback definitions on mips
Dmitry V. Levin [Sun, 29 Apr 2018 21:59:55 +0000 (21:59 +0000)]
xlat: fix SI_* fallback definitions on mips

* xlat/siginfo_codes.in [mips] (SI_ASYNCIO, SI_TIMER, SI_MESGQ): Define
to -2, -3, and -4, respectively.

6 years agoxlat: override values of KEY_RFKILL and KEY_BRIGHTNESS_MIN constants
Dmitry V. Levin [Sun, 29 Apr 2018 21:59:55 +0000 (21:59 +0000)]
xlat: override values of KEY_RFKILL and KEY_BRIGHTNESS_MIN constants

KEY_RFKILL and KEY_NUMERIC_A constants were introduced by Linux kernel
commits v2.6.33~17^2~2 and v4.1-rc1~150^2~1^10~6, respectively.
Apparently, RHEL6 introduced an alternative KEY_RFKILL constant
with the same value as upstream KEY_NUMERIC_A.

KEY_BRIGHTNESS_MIN and KEY_BRIGHTNESS_MAX constants were introduced
by Linux kernel commit v3.16-rc1~30^2~6^2~1^2~7.
Apparently, RHEL7 introduced an alternative KEY_BRIGHTNESS_MIN constant
with the same value as upstream KEY_BRIGHTNESS_MAX.

Downstream vendors are *not* allowed to do this.
Ignore the system value of KEY_RFKILL and KEY_BRIGHTNESS_MIN.

* xlat/evdev_keycode.in (KEY_RFKILL, KEY_BRIGHTNESS_MIN): Undefine.

6 years agoxlat: override the value of KEY_DATA constant
Dmitry V. Levin [Sun, 29 Apr 2018 21:59:55 +0000 (21:59 +0000)]
xlat: override the value of KEY_DATA constant

Linux kernel commit v4.9-rc8~12^2 has changed the value of KEY_DATA
constant introduced by commit v4.7-rc6~32^2~6^2 because the old value
was already used by KEY_FASTREVERSE.

Looks like the best way to handle this situation is to pretend that
the old value of KEY_DATA didn't exist.

* xlat/evdev_keycode.in (KEY_DATA): Undefine.

6 years agoxlat: override the value of AUDIT_FEATURE_CHANGE constant
Dmitry V. Levin [Sun, 29 Apr 2018 21:59:55 +0000 (21:59 +0000)]
xlat: override the value of AUDIT_FEATURE_CHANGE constant

Linux kernel commit v3.15-rc1~18^2~1 has changed the value
of AUDIT_FEATURE_CHANGE constant introduced by commit v3.13-rc1~19^2~20
which is of course an ABI breakage that affected 3.13 and 3.14 kernel
releases as well as their LTS derivatives.

Linux kernel commit v3.15-rc1~18^2~1 also claims that the old value
of AUDIT_FEATURE_CHANGE was ignored by userspace because of the
established convention how netlink messages for the audit system
are divided into blocks.

Looks like the best way to handle this situation is to pretend that
the old value of AUDIT_FEATURE_CHANGE didn't exist.

* xlat/nl_audit_types.in (AUDIT_FEATURE_CHANGE): Undefine.

Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>
6 years agoxlat: fix MCL_* fallback definitions on alpha, ppc, ppc64, and sparc
Dmitry V. Levin [Sun, 29 Apr 2018 21:59:55 +0000 (21:59 +0000)]
xlat: fix MCL_* fallback definitions on alpha, ppc, ppc64, and sparc

On these architectures, MCL_* constants are different.

* xlat/socketlayers.in [__alpha__ || __powerpc__ || __powerpc64__
|| __sparc__] (MCL_CURRENT, MCL_FUTURE, MCL_ONFAULT): Define to 0x2000,
0x4000, and 0x8000, respectively.

6 years agoxlat: fix SOL_SOCKET fallback definition on alpha, hppa, mips, and sparc
Eugene Syromyatnikov [Fri, 20 Apr 2018 13:19:18 +0000 (15:19 +0200)]
xlat: fix SOL_SOCKET fallback definition on alpha, hppa, mips, and sparc

On these architectures, SOL_SOCKET is 0xffff and not 1.

* xlat/socketlayers.in [__alpha__ || __hppa__ || __mips__ || __sparc__]
(SOL_SOCKET): Define to 0xffff.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agotests: add more mount checks
Eugene Syromyatnikov [Wed, 4 Apr 2018 21:25:19 +0000 (23:25 +0200)]
tests: add more mount checks

* tests/gen_tests.in (mount, mount-Xabbrev, mount-Xraw, mount-Xverbose):
Add -a33 option.
* tests/mount.c: Check printing of flags and pointers.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agotests: use sprintrc in mount test
Dmitry V. Levin [Sat, 28 Apr 2018 20:48:52 +0000 (20:48 +0000)]
tests: use sprintrc in mount test

* tests/mount.c (main): Use sprintrc.

6 years agotests: add mount variants with different xlat verbosity levels
Eugene Syromyatnikov [Wed, 4 Apr 2018 21:03:26 +0000 (23:03 +0200)]
tests: add mount variants with different xlat verbosity levels

* tests/mount-Xabbrev.c: New file.
* tests/mount-Xraw.c: Likewise.
* tests/mount-Xverbose.c: Likewise.
* tests/mount.c: Add handling of XLAT_RAW and XLAT_VERBOSE macros.
* tests/pure_executables.list: Add mount-Xabbrev, mount-Xraw,
and mount-Xverbose.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (mount-Xabbrev, mount-Xraw, mount-Xverbose): New
tests.

6 years agotests: add old_mmap variants with different xlat verbosity levels
Eugene Syromyatnikov [Wed, 4 Apr 2018 16:44:44 +0000 (18:44 +0200)]
tests: add old_mmap variants with different xlat verbosity levels

* tests/old_mmap-Xabbrev.c: New file.
* tests/old_mmap-Xraw.c: Likewise.
* tests/old_mmap-Xverbose.c: Likewise.
* tests/old_mmap.c (main): Add handling of XLAT_RAW and XLAT_VERBOSE
macros.
* tests/pure_executables.list: Add old_mmap-Xabbrev, old_mmap-Xraw,
and old_mmap-Xverbose.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (old_mmap-Xabbrev, old_mmap-Xraw,
old_mmap-Xverbose): New tests.

6 years agotests: add mmap/mmap64 variants different xlat verbosity levels
Eugene Syromyatnikov [Wed, 4 Apr 2018 15:38:53 +0000 (17:38 +0200)]
tests: add mmap/mmap64 variants different xlat verbosity levels

* tests/tests.h [!XLAT_RAW] (XLAT_RAW): Define.
[!XLAT_VERBOSE] (XLAT_VERBOSE): Likewise.
* tests/mmap-Xabbrev.c: New file.
* tests/mmap-Xraw.c: Likewise.
* tests/mmap-Xverbose.c: Likewise.
* tests/mmap64-Xabbrev.c: Likewise.
* tests/mmap64-Xraw.c: Likewise.
* tests/mmap64-Xverbose.c: Likewise.
* tests/mmap.c (main): Add handling of XLAT_RAW and XLAT_VERBOSE macros.
* tests/mmap.test: Add handling of optional test arguments that set
alignment and xlat verbosity options.
* tests/Makefile.am (mmap64_Xabbrev_CPPFLAGS, mmap64_Xraw_CPPFLAGS,
mmap64_Xverbose_CPPFLAGS): New variables, analogous to mmap64_CPPFLAGS.
* tests/pure_executables.list: Add mmap-Xabbrev, mmap-Xraw,
mmap-Xverbose, mmap64-Xabbrev, mmap64-Xraw, and mmap64-Xverbose.
* tests/.gitignore: Likewise.
* tests/gen_tests.in (mmap-Xabbrev, mmap-Xraw, mmap-Xverbose,
mmap64-Xabbrev, mmap64-Xraw, mmap64-Xverbose): New tests.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agoFix fallback definition of MSG_ZEROCOPY
Dmitry V. Levin [Fri, 27 Apr 2018 07:19:52 +0000 (07:19 +0000)]
Fix fallback definition of MSG_ZEROCOPY

* xlat/msg_flags.in (MSG_ZEROCOPY): Set fallback definition to 0x4000000.

Fixes: v4.21~316 ("Update MSG_* constants")
6 years agobuild: try to use _Static_assert if static_assert is not available
Dmitry V. Levin [Fri, 27 Apr 2018 07:19:52 +0000 (07:19 +0000)]
build: try to use _Static_assert if static_assert is not available

* configure.ac: Check for _Static_assert if static_assert
is not available.
* static_assert.h [!HAVE_STATIC_ASSERT && HAVE__STATIC_ASSERT]
(static_assert): Define to _Static_assert.

6 years agoprintmode: add xlat style support to print_symbolic_mode_t
Eugene Syromyatnikov [Wed, 4 Apr 2018 13:32:05 +0000 (15:32 +0200)]
printmode: add xlat style support to print_symbolic_mode_t

* printmode.c (print_symbolic_mode_t): Set ifmt to an empty string,
print raw and decoded values based on current xlat_verbosity setting.

6 years agoevdev: remove XT_NORMAL
Eugene Syromyatnikov [Mon, 2 Apr 2018 19:13:42 +0000 (21:13 +0200)]
evdev: remove XT_NORMAL

It is no longer used.

* evdev.c (enum xlat_type) <XT_NORMAL>: Remove.
(printxval_dispatch) <case XT_NORMAL>: Remove.

6 years agoSwitch to use of value-indexed xlats for evdev constants
Eugene Syromyatnikov [Mon, 2 Apr 2018 19:09:15 +0000 (21:09 +0200)]
Switch to use of value-indexed xlats for evdev constants

* xlat/evdev_abs.in: Add "#value_indexed" directive.
* xlat/evdev_autorepeat.in: Likewise.
* xlat/evdev_ff_status.in: Likewise.
* xlat/evdev_keycode.in: Likewise.
* xlat/evdev_leds.in: Likewise.
* xlat/evdev_misc.in: Likewise.
* xlat/evdev_prop.in: Likewise.
* xlat/evdev_relative_axes.in: Likewise.
* xlat/evdev_snd.in: Likewise.
* xlat/evdev_switch.in: Likewise.
* xlat/evdev_sync.in: Likewise.
* xlat/evdev_ff_types.in: Add a comment about sorting.
* evdev.c (keycode_ioctl, keycode_V2_ioctl): Use printxval_index
instead of printxval.
(bit_ioctl): Use XT_SORTED for evdev_ff_types, use XT_INDEXED
for other xlats.
(evdev_read_ioctl): Use XT_INDEXED for all xlats.
* ioctl.c (evdev_decode_number): Use printxval_indexn instead of
printxval for evdev_abs.

6 years agoevdev: support various types of xlats in decode_bitset
Eugene Syromyatnikov [Mon, 2 Apr 2018 18:32:19 +0000 (20:32 +0200)]
evdev: support various types of xlats in decode_bitset

* evdev.c (enum xlat_type): New enumeration.
(printxval_dispatch): New function.
(decode_bitset_): Rename from decode_bitset, add decode_nr_size
and xt arguments, call printxval_dispatch instead of printxval.
(decode_bitset): Add a decode_bitset_ wrapper that derives
decode_nr_size from the ARRAY_SIZE of decode_nr.
(bit_ioctl, evdev_read_ioctl): Update decode_bitset calls.

6 years agoMove xlat/evdev_abs.h inclusion from ioctl.c to evdev.c
Eugene Syromyatnikov [Mon, 2 Apr 2018 18:16:00 +0000 (20:16 +0200)]
Move xlat/evdev_abs.h inclusion from ioctl.c to evdev.c

Also introduce evdev_abs_size constant, which will be needed later.

* defs.h (evdev_abs_size): New declaration.
* ioctl.c: Move xlat/evdev_abs.h inclusion ...
* evdev.c: ... here.
(evdev_abs_size): New constant variable.

6 years agoAdd support for value-indexed xlats
Eugene Syromyatnikov [Mon, 2 Apr 2018 18:01:56 +0000 (20:01 +0200)]
Add support for value-indexed xlats

There are quite a few xlats that start from 0 and not too sparse,
we can push the search time for them down to O(1).

* defs.h (printxval_indexn_ex): New declaration.
(printxval_indexn, printxval_index, printxval_index_ex): New macros.
* xlat.c (printxval_sized): Rename from printxval_searchn_ex,
add fn argument, call it instead of xlat_search.
(printxval_searchn_ex): Implement as a thin wrapper around
printxval_sized using xlat_search as a search function.
(xlat_idx): New function.
(printxval_indexn_ex): New function, a thin wrapper around
printxval_sized using xlat_idx as a search function.
* xlat/gen.sh: Add support for "#value_indexed" directive.

6 years agosocketcall: use printxval_d for printing call argument
Eugene Syromyatnikov [Wed, 4 Apr 2018 13:52:36 +0000 (15:52 +0200)]
socketcall: use printxval_d for printing call argument

* socketcall.c (SYS_FUNC(socketcall)): Use printxval_d instead of manual
call argument decoding.

6 years agosignal: use print_xlat_ex in print_sa_handler
Eugene Syromyatnikov [Wed, 4 Apr 2018 13:51:36 +0000 (15:51 +0200)]
signal: use print_xlat_ex in print_sa_handler

* signal.c (print_sa_handler): Call print_xlat_ex instead of tprints
in order to respect current xlat style setting.

6 years agos390: use printxvals_ex for command printing in s390_runtime_instr
Eugene Syromyatnikov [Wed, 4 Apr 2018 13:42:00 +0000 (15:42 +0200)]
s390: use printxvals_ex for command printing in s390_runtime_instr

* s390.c (SYS_FUNC(s390_runtime_instr)): Replace manual command argument
decoding with a printxvals_ex call.

6 years agoprintsiginfo: use print_xlat_ex in print_si_code
Eugene Syromyatnikov [Wed, 4 Apr 2018 13:36:29 +0000 (15:36 +0200)]
printsiginfo: use print_xlat_ex in print_si_code

In order to respect current xlat style setting.

* printsiginfo.c (print_si_code): Use print_xlat_ex instead of manual
string/value printing.

6 years agoopen: use print_xlat_ex for printing open modes
Eugene Syromyatnikov [Wed, 4 Apr 2018 12:54:06 +0000 (14:54 +0200)]
open: use print_xlat_ex for printing open modes

In order to respect xlat style setting.

* open.c (tprint_open_modes): Use print_xlat_ex instead of
tprint_open_modes.

6 years agonetlink: use print_xlat_ex in decode_nlmsg_type_netfilter
Eugene Syromyatnikov [Wed, 4 Apr 2018 12:39:42 +0000 (14:39 +0200)]
netlink: use print_xlat_ex in decode_nlmsg_type_netfilter

In order to respect current xlat style setting.

* netlink.c (decode_nlmsg_type_netfilter): Use print_xlat_ex
instead of tprints.

6 years agonet: use print_xlat_ex in tprint_sock_type
Eugene Syromyatnikov [Wed, 4 Apr 2018 12:38:22 +0000 (14:38 +0200)]
net: use print_xlat_ex in tprint_sock_type

In order to respect current xlat style setting.

* next.c (tprint_sock_type): Use print_xlat_ex instead of tprints
for socket type printing.

6 years agokeyctl: use printxval_d for printing keyring serial number
Eugene Syromyatnikov [Wed, 4 Apr 2018 12:31:09 +0000 (14:31 +0200)]
keyctl: use printxval_d for printing keyring serial number

* keyctl.c (print_keyring_serial_number): Use printxval_d instead of
looking up and printing xlat value manually.
* xlat/key_spec.in: Add "#val_type int" so the xlat values have sign
bit propagated.

6 years agoipc: use printxval_u instead of manual xlat value printing
Eugene Syromyatnikov [Wed, 4 Apr 2018 12:28:34 +0000 (14:28 +0200)]
ipc: use printxval_u instead of manual xlat value printing

* ipc.c (SYS_FUNC(ipc)): Decode call argument using printxval_u.

6 years agoioprio: use sprintxval instead of xlookup and string/value printing
Eugene Syromyatnikov [Wed, 4 Apr 2018 12:19:50 +0000 (14:19 +0200)]
ioprio: use sprintxval instead of xlookup and string/value printing

In order to respect current xlat style.

* ioprio.c (sprint_ioprio): Use sprintxval for producing string
representation of ioprio class, use the produced string representation
in resulting xsprintf.

6 years agoxlat: handle NULL str in print_xlat_ex
Eugene Syromyatnikov [Wed, 4 Apr 2018 11:29:58 +0000 (13:29 +0200)]
xlat: handle NULL str in print_xlat_ex

It allows to use the following code pattern:

print_xlat_ex(val, xlookup(xlat, val), XLAT_STYLE_FMT_D);

* xlat.c (print_xlat_ex): Handle str being NULL: print val instead.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
6 years agostrace.1.in: fix typo (Ronald -> Roland)
Eugene Syromyatnikov [Thu, 26 Apr 2018 15:26:22 +0000 (17:26 +0200)]
strace.1.in: fix typo (Ronald -> Roland)

A very unfortunate one, though.

6 years agoNEWS: mention that -X option addresses Debian bug #692915
Eugene Syromyatnikov [Tue, 24 Apr 2018 15:19:19 +0000 (17:19 +0200)]
NEWS: mention that -X option addresses Debian bug #692915

6 years agoioctl: do not include linux/input.h
Eugene Syromyatnikov [Mon, 2 Apr 2018 18:13:37 +0000 (20:13 +0200)]
ioctl: do not include linux/input.h

All the ABS_* and EV_* values are now available internally,
there's no need to include the header.

* ioctl.c [HAVE_LINUX_INPUT_H]: Do not include linux/input.h.