2019-05-22  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for 5.1 release.
	* NEWS: Update for 5.1 release.

	Update copyright headers.
	Headers updated automatically using maint/update_copyright_years.sh
	script.

2019-05-22  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Use xzalloc(sz) instead of xcalloc(1, sz)
	* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD)): Use xzalloc
	instead of xcalloc of one-item-sized array.
	* kvm.c (vcpu_alloc): Likewise.
	* perf.c (fetch_perf_event_attr): Likewise.
	* syscall.c (ptrace_get_scno): Likewise.

2019-05-22  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xmalloc: introduce xzalloc.
	* xmalloc.h (xmalloc, xcalloc, xreallocarray): Document.
	(xzalloc): New function, a thin wrapper around xcalloc with xmalloc
	interface.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2019-05-22  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Rename the stat struct used internally by strace to strace_stat_t.
	* largefile_wrappers.h (struct_stat): Rename to strace_stat_t.
	* strace.c (startup_child): Rename struct_stat to strace_stat_t.
	* util.c (printdev): Likewise.

	Move open_file to largefile_wrappers.h.
	* util.c (open_file): Move it ...
	* largefile_wrappers.h: ... here.

2019-05-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify bpf-obj_get_info_by_fd test against future kernels.
	* tests/bpf-obj_get_info_by_fd.c (print_prog_load, main): Change
	log_level from 42 to 7, to placate Linux kernels containing commit
	v5.2-rc1~133^2~193^2~18^2~9.

	bpf: add support for new fields in struct bpf_prog_info.
	* bpf_attr.h (struct bpf_prog_info_struct): Add run_time_ns and run_cnt
	fields.
	* bpf.c (print_bpf_prog_info): Decode run_time_ns and run_cnt fields
	introduced by Linux kernel commit v5.1-rc1~178^2~17^2~15^2~2.
	* NEWS: Mention it.
	* tests/bpf-obj_get_info_by_fd.c (main): Update expected output.

	xlat: update FAN_* constants.
	* xlat/fan_mark_flags.in (FAN_MARK_FILESYSTEM): New constant
	introduced by Linux kernel commit v4.20-rc1~75^2~10.
	* tests/fanotify_mark.c (main): Update expected output.

	xlat: update IPV6_* constants.
	* xlat/sock_ipv6_options.in (IPV6_MULTICAST_ALL): New constant
	introduced by Linux kernel commit v4.20-rc1~14^2~384.
	(IPV6_ROUTER_ALERT_ISOLATE): New constant introduced
	by Linux kernel commit v5.1-rc1~178^2~22.
	* NEWS: Mention this.

	xlat: update F_SEAL_* constants.
	* xlat/f_seals.in (F_SEAL_FUTURE_WRITE): New constant introduced
	by Linux kernel commit v5.1-rc1~152^2~49.
	* NEWS: Mention this.

2019-05-21  Dmitry V. Levin  <ldv@altlinux.org>

	btrfs: implement decoding of BTRFS_IOC_FORGET_DEV argument.
	... introduced by Linux kernel commit v5.1-rc1~47^2~47.

	* btrfs.c (btrfs_ioctl) [BTRFS_IOC_FORGET_DEV]: Handle
	BTRFS_IOC_FORGET_DEV.
	* tests/btrfs.c (btrfs_test_device_ioctls) [BTRFS_IOC_FORGET_DEV]:
	Check it.

2019-05-21  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Update ioctl entries from linux v5.1.
	* linux/32/ioctls_inc_align16.h: Update from linux v5.1
	using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* NEWS: Mention this.
	* tests/ioctl_random.c (main): Update expected output.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2019-05-20  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: update FAN_* constants.
	* xlat/fan_init_flags.in (FAN_REPORT_FID): New constant introduced
	by Linux kernel commit v5.1-rc1~139^2~18.
	* xlat/fan_event_flags.in (FAN_ATTRIB, FAN_MOVED_FROM, FAN_MOVED_TO,
	FAN_CREATE, FAN_DELETE, FAN_DELETE_SELF, FAN_MOVE_SELF): New constants
	introduced by Linux kernel commit v5.1-rc1~139^2~9.
	* NEWS: Mention this.
	* tests/fanotify_init.c (main): Update expected output.
	* tests/fanotify_mark.c (main): Likewise.

	xlat: update PR_SPEC_* constants.
	* xlat/pr_spec_get_store_bypass_flags.in (PR_SPEC_DISABLE_NOEXEC):
	New constant introduced by Linux kernel commit v5.1-rc1~168^2.
	* xlat/pr_spec_set_store_bypass_flags.in: Likewise.
	* NEWS: Mention this.
	* tests/prctl-spec-inject.c (get_strs, set_strs): Update.

	xlat: update BPF_* constants.
	* xlat/ebpf_class.in (BPF_JMP32): New constant introduced
	by Linux kernel commit v5.1-rc1~178^2~404^2~4^2~15.
	* xlat/bpf_map_update_elem_flags.in (BPF_F_LOCK): New constant
	introduced by Linux kernel commit v5.1-rc1~178^2~375^2~4^2~3.
	* NEWS: Mention this.

	xlat: update V4L2_* constants.
	* xlat/v4l2_control_ids.in
	(V4L2_CID_MPEG_VIDEO_H264_CONSTRAINED_INTRA_PREDICTION): New constant
	introduced by Linux kernel commit v5.1-rc1~88^2~261.
	(V4L2_CID_MPEG_VIDEO_H264_CHROMA_QP_INDEX_OFFSET): New constant
	introduced by Linux kernel commit v5.1-rc1~88^2~260.
	* xlat/v4l2_pix_fmts.in (V4L2_PIX_FMT_AYUV32, V4L2_PIX_FMT_XYUV32,
	V4L2_PIX_FMT_VUYA32, V4L2_PIX_FMT_VUYX32): New constants
	introduced by Linux kernel commit v5.1-rc1~88^2~90.
	* NEWS: Mention this.

	xlat: update NT_* constants.
	* xlat/nt_descriptor_types.in (NT_ARM_PACA_KEYS, NT_ARM_PACG_KEYS): New
	constants introduced by Linux kernel commit v5.1-rc1~82^2~44.
	* NEWS: Mention this.

2019-05-19  Dmitry V. Levin  <ldv@altlinux.org>

	Implement decoding of io_uring_* syscalls.
	... introduced by Linux kernel commits v5.1-rc1~99^2~14,
	v5.1-rc1~99^2~7, and v5.1-rc7~24^2.

	* configure.ac (AC_CHECK_HEADERS): Add linux/io_uring.h.
	* io_uring.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* pathtrace.c (pathtrace_match_set): Add SEN_io_uring_enter,
	SEN_io_uring_register, and SEN_io_uring_setup.
	* xlat/uring_enter_flags.in: New file.
	* xlat/uring_register_opcodes.in: Likewise.
	* linux/32/syscallent.h [425, 426, 427]: Wire up io_uring_setup,
	io_uring_enter, and io_uring_register.
	* linux/64/syscallent.h: Likewise.
	* linux/arm/syscallent.h: Likewise.
	* linux/hppa/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/powerpc64/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/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.
	* linux/alpha/syscallent.h [535, 536, 537]: Likewise.
	* linux/ia64/syscallent.h [1024 + 425, 1024 + 426, 1024 + 427]: Likewise.
	* linux/mips/syscallent-n32.h [6425, 6426, 6427]: Likewise.
	* linux/mips/syscallent-n64.h [5425, 5426, 5427]: Likewise.
	* linux/mips/syscallent-o32.h [4425, 4426, 4427]: Likewise.
	* NEWS: Mention this change.
	* tests/io_uring_enter.c: New file.
	* tests/io_uring_register.c: Likewise.
	* tests/io_uring_setup.c: Likewise.
	* tests/gen_tests.in (io_uring_enter, io_uring_register,
	io_uring_setup): New entries.
	* tests/pure_executables.list: Add io_uring_enter, io_uring_register,
	and io_uring_setup.
	* tests/.gitignore: Likewise.

2019-05-18  Dmitry V. Levin  <ldv@altlinux.org>

	Implement decoding of pidfd_send_signal syscall.
	... introduced by Linux kernel commit v5.1-rc1~6^2~1.

	* signal.c (SYS_FUNC(pidfd_send_signal)): New function.
	* linux/32/syscallent.h [424]: Wire up pidfd_send_signal.
	* linux/64/syscallent.h: Likewise.
	* linux/arm/syscallent.h: Likewise.
	* linux/hppa/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/powerpc64/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/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.
	* linux/alpha/syscallent.h [534]: Likewise.
	* linux/ia64/syscallent.h [1024 + 424]: Likewise.
	* linux/mips/syscallent-n32.h [6424]: Likewise.
	* linux/mips/syscallent-n64.h [5424]: Likewise.
	* linux/mips/syscallent-o32.h [4424]: Likewise.
	* NEWS: Mention this change.
	* tests/pidfd_send_signal.c: New file.
	* tests/gen_tests.in (pidfd_send_signal): New entry.
	* tests/pure_executables.list: Add pidfd_send_signal.
	* tests/.gitignore: Likewise.

2019-05-17  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of SO_TIMESTAMP*_NEW control messages.
	* configure.ac (AC_CHECK_TYPES): Check for struct __kernel_timespec
	and struct __kernel_sock_timeval.
	* tests/msg_control.c [HAVE_STRUCT___KERNEL_SOCK_TIMEVAL ||
	HAVE_STRUCT___KERNEL_TIMESPEC]: Include <linux/time_types.h>.
	(test_scm_timestamp): Rename to test_scm_timestamp_old.
	(test_scm_timestampns): Rename to test_scm_timestampns_old.
	(test_scm_timestamping): Rename to test_scm_timestamping_old.
	[HAVE_STRUCT___KERNEL_SOCK_TIMEVAL] (test_scm_timestamp_new): New
	function.
	[HAVE_STRUCT___KERNEL_TIMESPEC] (test_scm_timestampns_new,
	test_scm_timestamping_new): New functions.
	(test_sol_socket): Use them.
	* tests/sockopt-timestamp.c [HAVE_STRUCT___KERNEL_SOCK_TIMEVAL ||
	HAVE_STRUCT___KERNEL_TIMESPEC]: Include <linux/time_types.h>.
	Include "xlat/sock_options.h" in XLAT_MACROS_ONLY mode.
	(print_timestampns_old): Define unconditionally.
	[HAVE_STRUCT___KERNEL_SOCK_TIMEVAL] (print_timestamp_new): New function.
	[HAVE_STRUCT___KERNEL_TIMESPEC] (print_timestampns_new): Likewise.
	(main): Test SO_TIMESTAMPNS_OLD unconditionally.
	[HAVE_STRUCT___KERNEL_SOCK_TIMEVAL]: Test SO_TIMESTAMP_NEW.
	[HAVE_STRUCT___KERNEL_TIMESPEC]: Test SO_TIMESTAMPNS_NEW.

	Implement decoding of SO_TIMESTAMP*_NEW control messages.
	* print_timeval64.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (print_timeval64_data_size): New prototype.
	* msghdr.c (print_scm_timestamp_new, print_scm_timestampns_new,
	print_scm_timestamping_new): New functions.
	(cmsg_socket_printers): Add SO_TIMESTAMP_NEW, SO_TIMESTAMPNS_NEW,
	and SO_TIMESTAMPING_NEW.
	* NEWS: Mention this change.

2019-05-17  Dmitry V. Levin  <ldv@altlinux.org>

	print_timespec.h: parametrize TIMESPEC_T.tv_nsec.
	This is going to be used to implement a parser of SO_TIMESTAMP_NEW
	control message.

	* print_timespec.h [!TIMESPEC_NSEC] (TIMESPEC_NSEC): Define to tv_sec.
	(TIMESPEC_TO_SEC_NSEC, timespec_fmt, print_timespec_t_utime): Use
	TIMESPEC_NSEC instead of tv_sec.

2019-05-17  Dmitry V. Levin  <ldv@altlinux.org>

	print_timespec.h: conditionalize printers.
	This allows to implement a parser of SO_TIMESTAMP_NEW control message
	without implementing extra unused printers.

	* print_timespec.h (PRINT_TIMESPEC_DATA_SIZE,
	PRINT_TIMESPEC_ARRAY_DATA_SIZE, PRINT_TIMESPEC, SPRINT_TIMESPEC,
	PRINT_TIMESPEC_UTIME_PAIR, PRINT_ITIMERSPEC): Conditionalize.

2019-05-17  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: add SO_TIMESTAMP*_NEW constants.
	* xlat/sock_options.in (SO_TIMESTAMP_NEW, SO_TIMESTAMPNS_NEW,
	SO_TIMESTAMPING_NEW): New constants introduced by Linux commits
	v5.1-rc1~178^2~363^2~4 and v5.1-rc1~178^2~363^2~3.
	* xlat/scmvals.in: Likewise.

2019-05-16  Dmitry V. Levin  <ldv@altlinux.org>

	Use kernel_timeval64_t in definition of kernel_timex64_t.
	* kernel_timex.h: Include "kernel_timeval.h".
	(kernel_timex64_t): Change the type of "time" field from a locally
	defined structure to its equivalent kernel_timeval64_t.

2019-05-16  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce kernel_timeval64_t type.
	This type is going to be used to implement parsers of SO_TIMESTAMP*_NEW
	control messages.

	* kernel_timeval.h: New file.
	* Makefile.am (strace_SOURCES): Add it.

2019-05-15  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: add _OLD suffixes to SO_RCVTIMEO and SO_SNDTIMEO.
	Follow the Linux kernel commit v5.1-rc1~178^2~363^2~1 and rename
	these constants.

	* xlat/sock_options.in (SO_RCVTIMEO): Rename to SO_RCVTIMEO_OLD.
	(SO_SNDTIMEO): Rename to SO_SNDTIMEO_OLD.

2019-05-15  Dmitry V. Levin  <ldv@altlinux.org>

	Rename SO_TIMESTAMP* to SO_TIMESTAMP*_OLD.
	Follow the Linux kernel commit v5.1-rc1~178^2~363^2~8 and rename
	these constants everywhere.

	* xlat/scmvals.in (SO_TIMESTAMP): Rename to SO_TIMESTAMP_OLD.
	(SO_TIMESTAMPNS): Rename to SO_TIMESTAMPNS_OLD.
	(SO_TIMESTAMPING): Rename to SO_TIMESTAMPING_OLD.
	* xlat/sock_options.in: Likewise.
	* xlat/sock_rds_options.in: Likewise.
	* msghdr.c (cmsg_socket_printers): Likewise.
	(print_scm_timestamp): Rename to print_scm_timestamp_old.
	(print_scm_timestampns): Rename to print_scm_timestampns_old.
	(print_scm_timestamping): Rename to print_scm_timestamping_old.
	* tests/msg_control.c (test_scm_timestamp): Rename SO_TIMESTAMP
	to SO_TIMESTAMP_OLD.
	(test_scm_timestampns): Rename SO_TIMESTAMPNS to SO_TIMESTAMPNS_OLD.
	(test_scm_timestamping): Rename SO_TIMESTAMPING to SO_TIMESTAMPING_OLD.
	* tests/sockopt-timestamp.c (main): Rename SO_TIMESTAMP and
	SO_TIMESTAMPNS to SO_TIMESTAMP_OLD and SO_TIMESTAMPNS_OLD, respectively.

2019-05-15  Dmitry V. Levin  <ldv@altlinux.org>

	Replace SCM_TIMESTAMP* constants with SO_TIMESTAMP*
	Besides the fact that SO_TIMESTAMP* constants appear to be more
	standardized than SCM_TIMESTAMP*, new SO_TIMESTAMP*_OLD and
	SO_TIMESTAMP*_NEW constants introduced in Linux 5.1 have no
	SCM_TIMESTAMP*_OLD and SCM_TIMESTAMP*_NEW analogues.

	* xlat/scmvals.in: Replace SCM_WIFI_STATUS, SCM_TXTIME, SCM_TIMESTAMP,
	SCM_TIMESTAMPNS, and SCM_TIMESTAMPING with SO_WIFI_STATUS, SO_TXTIME,
	SO_TIMESTAMP, SO_TIMESTAMPNS, and SO_TIMESTAMPING, respectively.
	* msghdr.c: Include "xlat/sock_options.h" in XLAT_MACROS_ONLY mode.
	(cmsg_socket_printers): Replace SCM_TIMESTAMP, SCM_TIMESTAMPNS, and
	SCM_TIMESTAMPING with SO_TIMESTAMP, SO_TIMESTAMPNS, and SO_TIMESTAMPING,
	respectively.
	* tests/msg_control.c: Include "xlat/sock_options.h" in XLAT_MACROS_ONLY
	mode.
	(test_scm_timestamp): Replace SCM_TIMESTAMP with SO_TIMESTAMP.
	(test_scm_timestampns): Replace SCM_TIMESTAMPNS with SO_TIMESTAMPNS.
	(test_scm_timestamping): Replace SCM_TIMESTAMPING with SO_TIMESTAMPING.
	* tests/sockopt-timestamp.c (main): Replace SCM_TIMESTAMP and
	SCM_TIMESTAMPNS with SO_TIMESTAMP and SO_TIMESTAMPNS, respectively.

2019-05-15  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add another test of SO_TIMESTAMP and SO_TIMESTAMPNS decoding.
	Unlike msg_control test, this new test makes the kernel generate
	SO_TIMESTAMP and SO_TIMESTAMPNS messages.

	* tests/sockopt-timestamp.c: New file.
	* tests/gen_tests.in (sockopt-timestamp): New entry.
	* tests/pure_executables.list: Add sockopt-timestamp.
	* tests/.gitignore: Likewise.

2019-05-12  Dmitry V. Levin  <ldv@altlinux.org>

	print_timespec.c: remove unused printers.
	* print_timespec.c (PRINT_TIMESPEC, SPRINT_TIMESPEC,
	PRINT_TIMESPEC_UTIME_PAIR, PRINT_ITIMERSPEC): Remove.
	(print_timespec, sprint_timespec, print_timespec_utime_pair,
	print_itimerspec): Remove.

	Implement and use new parsers of utimensat syscall.
	* utimes.c (SYS_FUNC(utimensat)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(utimensat_time32)): New function.
	* pathtrace.c (pathtrace_match_set): Replace SEN_utimensat with
	SEN_utimensat_time32.
	* linux/64/syscallent.h: Replace SEN(utimensat) with
	SEN(utimensat_time64).
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/32/syscallent.h: Replace SEN(utimensat) with
	SEN(utimensat_time32).
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Implement and use new parsers of timerfd_gettime and timerfd_settime syscalls
	* time.c (SYS_FUNC(timerfd_gettime), SYS_FUNC(timerfd_settime)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(timerfd_gettime32),
	SYS_FUNC(timerfd_settime32)): New functions.
	* pathtrace.c (pathtrace_match_set): Replace SEN_timerfd_gettime and
	SEN_timerfd_settime with SEN_timerfd_gettime32 and
	SEN_timerfd_settime32, respectively.
	* linux/64/syscallent.h: Replace SEN(timerfd_gettime) and
	SEN(timerfd_settime) with SEN(timerfd_gettime64) and
	SEN(timerfd_settime64), respectively.
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/32/syscallent.h: Replace SEN(timerfd_gettime) and
	SEN(timerfd_settime) with SEN(timerfd_gettime32) and
	SEN(timerfd_settime32), respectively.
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Implement and use new parsers of timer_gettime and timer_settime syscalls
	* time.c (SYS_FUNC(timer_gettime), SYS_FUNC(timer_settime)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(timer_gettime32),
	SYS_FUNC(timer_settime32)): New functions.
	* linux/64/syscallent.h: Replace SEN(timer_gettime) and
	SEN(timer_settime) with SEN(timer_gettime64) and SEN(timer_settime64),
	respectively.
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/32/syscallent.h: Replace SEN(timer_gettime) and
	SEN(timer_settime) with SEN(timer_gettime32) and SEN(timer_settime32),
	respectively.
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Implement and use new parsers of nanosleep syscall.
	* time.c (SYS_FUNC(nanosleep)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS || HAVE_ARCH_OLD_TIME64_SYSCALLS]
	(do_nanosleep): New function.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(nanosleep_time32)): Likewise.
	[HAVE_ARCH_OLD_TIME64_SYSCALLS] (SYS_FUNC(nanosleep_time64)): Likewise.
	* linux/64/syscallent.h: Replace SEN(nanosleep) with
	SEN(nanosleep_time64).
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/32/syscallent.h: Replace SEN(nanosleep) with
	SEN(nanosleep_time32).
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Implement and use new parsers of clock_nanosleep syscall.
	* time.c (SYS_FUNC(clock_nanosleep)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(clock_nanosleep_time32)): New
	function.
	* linux/64/syscallent.h: Replace SEN(clock_nanosleep) with
	SEN(clock_nanosleep_time64).
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/32/syscallent.h: Replace SEN(clock_nanosleep) with
	SEN(clock_nanosleep_time32).
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Implement and use new parsers of clock_gettime and clock_settime syscalls
	* time.c (SYS_FUNC(clock_gettime), SYS_FUNC(clock_settime)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(clock_gettime32),
	SYS_FUNC(clock_settime32)): New functions.
	* linux/dummy.h (sys_clock_getres): Remove.
	(sys_clock_getres_time32): Redirect to sys_clock_gettime32.
	* linux/64/syscallent.h: Replace SEN(clock_gettime), SEN(clock_settime),
	and SEN(clock_getres) with SEN(clock_gettime64), SEN(clock_settime64),
	and SEN(clock_getres_time64), respectively.
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/32/syscallent.h: Replace SEN(clock_gettime), SEN(clock_settime),
	and SEN(clock_getres) with SEN(clock_gettime32), SEN(clock_settime32),
	and SEN(clock_getres_time32), respectively.
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Implement and use new parsers of mq_timedsend and mq_timedreceive syscalls
	* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(mq_timedsend_time32),
	SYS_FUNC(mq_timedreceive_time32)): New functions.
	* pathtrace.c (pathtrace_match_set): Replace SEN_mq_timedsend and
	SEN_mq_timedreceive with SEN_mq_timedsend_time32 and
	SEN_mq_timedreceive_time32, respectively.
	* syscall.c (dumpio): Likewise.
	* linux/64/syscallent.h: Replace SEN(mq_timedsend) and
	SEN(mq_timedreceive) with SEN(mq_timedsend_time64) and
	SEN(mq_timedreceive_time64), respectively.
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/32/syscallent.h: Replace SEN(mq_timedsend) and
	SEN(mq_timedreceive) with SEN(mq_timedsend_time32) and
	SEN(mq_timedreceive_time32), respectively.
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Implement and use new parsers of rt_sigtimedwait syscall.
	* signal.c (SYS_FUNC(rt_sigtimedwait)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(rt_sigtimedwait_time32)): New
	function.
	* linux/64/syscallent.h: Replace SEN(rt_sigtimedwait) with
	SEN(ppoll_time64).
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/32/syscallent.h: Replace SEN(rt_sigtimedwait) with
	SEN(ppoll_time32).
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Implement and use new parsers of sched_rr_get_interval syscall.
	* sched.c (SYS_FUNC(sched_rr_get_interval)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(sched_rr_get_interval_time32)):
	New function.
	* linux/64/syscallent.h: Replace SEN(sched_rr_get_interval) with
	SEN(sched_rr_get_interval_time64).
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/32/syscallent.h: Replace SEN(sched_rr_get_interval) with
	SEN(sched_rr_get_interval_time32).
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Implement and use new parsers of poll syscall.
	* poll.c (SYS_FUNC(poll)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS || HAVE_ARCH_OLD_TIME64_SYSCALLS] (do_poll):
	New function.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(poll_time32)): Likewise.
	[HAVE_ARCH_OLD_TIME64_SYSCALLS] (SYS_FUNC(poll_time64)): Likewise.
	* pathtrace.c (pathtrace_match_set): Replace SEN_poll with
	SEN_poll_time32 and SEN_poll_time64.
	* linux/aarch64/syscallent.h: Replace SEN(poll) with SEN(poll_time64).
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/arm/syscallent.h: Replace SEN(poll) with SEN(poll_time32).
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/hppa/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Implement and use new parsers of ppoll syscall.
	* poll.c (SYS_FUNC(ppoll)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(ppoll_time32)): New function.
	* pathtrace.c (pathtrace_match_set): Replace SEN_ppoll with
	SEN_ppoll_time32.
	* linux/64/syscallent.h: Replace SEN(ppoll) with SEN(ppoll_time64).
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/32/syscallent.h: Replace SEN(ppoll) with SEN(ppoll_time32).
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Implement and use new parsers of recvmmsg syscall.
	* mmsghdr.c (SYS_FUNC(recvmmsg)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(recvmmsg_time32)): New function.
	* syscall.c (dumpio): Handle SEN_recvmmsg_time32.
	* linux/subcall32.h (sys_recvmmsg): Redirect to sys_recvmmsg_time32.
	* linux/subcall64.h (sys_recvmmsg): Redirect to sys_recvmmsg_time64.
	* linux/64/syscallent.h: Replace SEN(recvmmsg) with SEN(recvmmsg_time64).
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/32/syscallent.h: Replace SEN(recvmmsg) with SEN(recvmmsg_time32).
	* linux/arm/syscallent.h: Likewise.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/hppa/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Implement and use new parsers of semtimedop syscall.
	* ipc_sem.c (SYS_FUNC(semtimedop)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(semtimedop_time32)): New function.
	* linux/subcall32.h (sys_semtimedop): Redirect to sys_semtimedop_time32.
	* linux/subcall64.h (sys_semtimedop): Redirect to sys_semtimedop_time64.
	* linux/64/syscallent.h: Replace SEN(semtimedop) with
	SEN(semtimedop_time64).
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/32/syscallent.h: Replace SEN(semtimedop) with
	SEN(semtimedop_time32).
	* linux/arm/syscallent.h: Likewise.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/hppa/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

2019-05-12  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce subcall32.h and subcall64.h wrappers.
	They are going to be used to implement new parsers for indirect
	time-related syscalls.

	* linux/subcall32.h: New file.
	* linux/subcall64.h: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.
	* linux/arm/syscallent.h: Replace "subcall.h" with "subcall32.h".
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Replace "subcall.h" with "subcall64.h".
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.

2019-05-12  Dmitry V. Levin  <ldv@altlinux.org>

	Implement and use new parsers of futex syscall.
	* futex.c (SYS_FUNC(futex)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(futex_time32)): New function.
	* linux/64/syscallent.h: Replace SEN(futex) with SEN(futex_time64).
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/32/syscallent.h: Replace SEN(futex) with SEN(futex_time32).
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Implement and use new parsers of pselect6 syscall.
	* desc.c (SYS_FUNC(pselect6)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(pselect6_time32)): New function.
	* pathtrace.c (pathtrace_match_set): Replace SEN_pselect6 with
	SEN_pselect6_time32.
	* linux/64/syscallent.h: Replace SEN(pselect6) with
	SEN(pselect6_time64).
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/32/syscallent.h: Replace SEN(pselect6) with
	SEN(pselect6_time32).
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Implement and use new parsers of io_pgetevents syscall.
	* aio.c (SYS_FUNC(io_pgetevents)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(io_pgetevents_time32)): New
	function.
	* linux/64/syscallent.h: Replace SEN(io_pgetevents) with
	SEN(io_pgetevents_time64).
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/32/syscallent.h: Replace SEN(io_pgetevents) with
	SEN(io_pgetevents_time32).
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Implement and use new parsers of io_getevents syscall.
	* aio.c (SYS_FUNC(io_getevents)): Remove.
	[HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(io_getevents_time32)): New
	function.
	[HAVE_ARCH_OLD_TIME64_SYSCALLS] (SYS_FUNC(io_getevents_time64)):
	Likewise.
	* linux/64/syscallent.h: Replace SEN(io_getevents) with
	SEN(io_getevents_time64).
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/32/syscallent.h: Replace SEN(io_getevents) with
	SEN(io_getevents_time32).
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

2019-05-11  Dmitry V. Levin  <ldv@altlinux.org>

	Wire up *time64 system calls.
	* linux/32/syscallent.h [403...423]: Wire up clock_gettime64,
	clock_settime64, clock_adjtime64, clock_getres_time64,
	clock_nanosleep_time64, timer_gettime64, timer_settime64,
	timerfd_gettime64, timerfd_settime64, utimensat_time64, pselect6_time64,
	ppoll_time64, io_pgetevents_time64, recvmmsg_time64,
	mq_timedsend_time64, mq_timedreceive_time64, semtimedop_time64,
	rt_sigtimedwait_time64, futex_time64, and sched_rr_get_interval_time64
	introduced by linux commit v5.1-rc1~160^2~2^2.
	* linux/arm/syscallent.h [403...423]: Likewise.
	* linux/hppa/syscallent.h [403...423]: Likewise.
	* linux/i386/syscallent.h [403...423]: Likewise.
	* linux/m68k/syscallent.h [403...423]: Likewise.
	* linux/microblaze/syscallent.h [403...423]: Likewise.
	* linux/mips/syscallent-n32.h [6403...6423]: Likewise.
	* linux/mips/syscallent-o32.h [4403...4423]: Likewise.
	* linux/powerpc/syscallent.h [403...423]: Likewise.
	* linux/s390/syscallent.h [403...423]: Likewise.
	* linux/sh/syscallent.h [403...423]: Likewise.
	* linux/sparc/syscallent.h [403...423]: Likewise.
	* linux/xtensa/syscallent.h [403...423]: Likewise.
	* linux/64/syscallent.h: Add a comment about syscall numbers
	reserved to sync up with other architectures.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* pathtrace.c (pathtrace_match_set): Handle SEN_utimensat_time64,
	SEN_pselect6_time64, SEN_ppoll_time64, SEN_mq_timedreceive_time64,
	SEN_mq_timedsend_time64, SEN_timerfd_gettime64, and
	SEN_timerfd_settime64.
	* syscall.c (dumpio): Handle SEN_mq_timedsend_time64,
	SEN_mq_timedreceive_time64, and SEN_recvmmsg_time64.
	* NEWS: Mention this.

	Implement parsers of new *time64 system calls.
	* aio.c (SYS_FUNC(io_pgetevents_time64)): New function.
	* desc.c (SYS_FUNC(pselect6_time64)): Likewise.
	* futex.c (SYS_FUNC(futex_time64)): Likewise.
	* ipc_sem.c (SYS_FUNC(semtimedop_time64)): Likewise.
	* mmsghdr.c (SYS_FUNC(recvmmsg_time64)): Likewise.
	* mq.c (SYS_FUNC(mq_timedsend_time64),
	SYS_FUNC(mq_timedreceive_time64)): Likewise.
	* poll.c (SYS_FUNC(ppoll_time64)): Likewise.
	* sched.c (SYS_FUNC(sched_rr_get_interval_time64)): Likewise.
	* signal.c (SYS_FUNC(rt_sigtimedwait_time64)): Likewise.
	* time.c (SYS_FUNC(clock_settime64), SYS_FUNC(clock_gettime64),
	SYS_FUNC(clock_nanosleep_time64), SYS_FUNC(timer_settime64),
	SYS_FUNC(timer_gettime64), SYS_FUNC(timerfd_settime64),
	SYS_FUNC(timerfd_gettime64)): Likewise.
	* utimes.c (SYS_FUNC(utimensat_time64)): Likewise.
	* linux/dummy.h (sys_clock_getres_time64): Redirect
	to sys_clock_gettime64.

	Use new parsers of adjtimex and clock_adjtime syscalls.
	* print_timex.c (struct_timex, print_timex): Remove.
	* time.c (SYS_FUNC(adjtimex), SYS_FUNC(clock_adjtime)): Remove.
	* linux/alpha/syscallent.h [303]: Replace SEN(adjtimex)
	with SEN(adjtimex32).
	[366]: Replace SEN(adjtimex) with SEN(adjtimex64).
	[499]: Replace SEN(clock_adjtime) with SEN(clock_adjtime64).
	* linux/32/syscallent.h: Replace SEN(adjtimex) and SEN(clock_adjtime)
	with SEN(adjtimex32) and SEN(clock_adjtime32), respectively.
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.
	* linux/64/syscallent.h: Replace SEN(adjtimex) and SEN(clock_adjtime)
	with SEN(adjtimex64) and SEN(clock_adjtime64), respectively.
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* tests/adjtimex.c: Include <stddef.h>.
	(main): Print struct timex.tai unconditionally.

	Implement parsers of 64-bit adjtimex and clock_adjtime syscalls.
	* time.c (SYS_FUNC(clock_adjtime64)): New function.
	[SPARC64] (SYS_FUNC(clock_sparc64_adjtime)): Likewise.
	[HAVE_ARCH_OLD_TIME64_SYSCALLS] (SYS_FUNC(adjtimex64)): Likewise.

	Implement parsers of 32-bit adjtimex and clock_adjtime syscalls.
	* time.c [HAVE_ARCH_TIME32_SYSCALLS] (SYS_FUNC(adjtimex32),
	SYS_FUNC(clock_adjtime32)): New functions.

2019-05-10  Dmitry V. Levin  <ldv@altlinux.org>

	sparc64: implement printer for sparc64-specific struct timex.
	According to Linux kernel commit v5.1-rc1~160^2~2^2~8, sparc64 is the
	only architecture on Linux that has a 'timeval' definition with a 32-bit
	tv_usec but a 64-bit tv_sec.

	* defs.h [SPARC64] (print_sparc64_timex): New prototype.
	* kernel_timex.h [SPARC64] (kernel_sparc64_timex_t): New type.
	* print_timex.c [SPARC64] (print_sparc64_timex): New function.

2019-05-10  Dmitry V. Levin  <ldv@altlinux.org>

	Implement printer for kernel_timex64_t.
	This is going to be used to implement clock_adjtime64 parser.

	* defs.h (kernel_timex64_t): New prototype.
	* print_timex.c (print_timex64): New function.

2019-05-10  Dmitry V. Levin  <ldv@altlinux.org>

	Implement printer for kernel_timex32_t.
	This is going to be used to re-implement parsers of syscalls that deal
	with 32-bit struct timex.

	* print_timex.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (print_timex32): New prototype.
	* print_timex.c: Include "kernel_timex.h".
	[HAVE_ARCH_TIME32_SYSCALLS] (print_timex32): New function.

2019-05-10  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce kernel_timex64_t.
	This is going to be used to implement clock_adjtime64 parser.

	* kernel_timex.h (kernel_timex64_t): New type.

2019-05-10  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce kernel_timex32_t.
	Currently existing parsers of syscalls that deal with 32-bit timex
	rely upon struct timex being defined in libc and match the definition
	used by the kernel.  Given the upcoming y2038 changes in glibc,
	this new type is going to be used instead.

	* kernel_timex.h: New file.
	* Makefile.am (strace_SOURCES): Add it.

2019-05-09  Dmitry V. Levin  <ldv@altlinux.org>

	Re-implement mpersified timespec printers using timespec32/timespec64 printers
	* print_timespec.c (UTIME_NOW, UTIME_OMIT, TIMESPEC_TO_SEC_NSEC,
	timespec_fmt, print_sec_nsec, print_timespec_t, print_timespec_t_utime):
	Remove.
	(TIMESPEC_IS_32BIT, PRINT_TIMESPEC_DATA_SIZE,
	PRINT_TIMESPEC_ARRAY_DATA_SIZE, PRINT_TIMESPEC, SPRINT_TIMESPEC,
	PRINT_TIMESPEC_UTIME_PAIR,PRINT_ITIMERSPEC): New macros.
	(print_struct_timespec_data_size): Invoke PRINT_TIMESPEC_DATA_SIZE.
	(print_struct_timespec_array_data_size): Invoke
	PRINT_TIMESPEC_ARRAY_DATA_SIZE.
	(print_timespec): Invoke PRINT_TIMESPEC.
	(sprint_timespec): Invoke SPRINT_TIMESPEC.
	(print_timespec_utime_pair): Invoke PRINT_TIMESPEC_UTIME_PAIR.
	(print_itimerspec): Invoke PRINT_ITIMERSPEC.

2019-05-09  Dmitry V. Levin  <ldv@altlinux.org>

	Implement printers for kernel_timespec64_t.
	They are going to be used to re-implement parsers of syscalls that deal
	with 64-bit timespec, and to implement parsers of new *time64 syscalls.

	* defs.h (print_timespec64_data_size, print_timespec64_array_data_size,
	print_timespec64, sprint_timespec64, print_timespec64_utime_pair,
	print_itimerspec64): New prototypes.
	* print_timespec64.c: New file.
	* Makefile.am (strace_SOURCES): Add it.

2019-05-09  Dmitry V. Levin  <ldv@altlinux.org>

	Implement printers for kernel_timespec32_t.
	They are going to be used to re-implement parsers of syscalls that deal
	with 32-bit timespec.

	* defs.h (print_timespec32_data_size, print_timespec32_array_data_size,
	print_timespec32, sprint_timespec32, print_timespec32_utime_pair,
	print_itimerspec32): New prototypes.
	* print_timespec.h: New file based on print_timespec.c.
	* print_timespec32.c: New file.
	* Makefile.am (strace_SOURCES): Add them.

2019-05-09  Dmitry V. Levin  <ldv@altlinux.org>

	print_timespec.c: introduce helper macros and functions.
	They are going to be used to implement printers of other timespec
	flavours, e.g. kernel_timespec32_t and kernel_timespec64_t.

	* print_timespec.c (TIMESPEC_TO_SEC_NSEC): New macro.
	(print_timespec_t_utime, sprint_timespec): Use it.
	(print_sec_nsec): New function.
	(print_timespec_t): Use it.

2019-05-05  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce kernel_timespec64_t type.
	This type ais going to be used to implement parsers of syscalls
	that deal with 64-bit timespec.

	* kernel_timespec.h (kernel_timespec64_t): New type.

2019-05-05  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce kernel_timespec32_t type.
	Currently existing parsers of syscalls that deal with 32-bit timespec
	rely upon struct timespec being defined in libc and match the definition
	used by the kernel.  Given the upcoming y2038 changes in glibc,
	this new type is going to be used instead.

	* kernel_timespec.h: New file.
	* Makefile.am (strace_SOURCES): Add it.

2019-05-05  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce ARCH_TIMESIZE.
	This is going to be used to implement new timespec parsers.

	* linux/arch_defs_.h [!ARCH_TIMESIZE] (ARCH_TIMESIZE): Define
	to SIZEOF_LONG.
	* linux/x32/arch_defs_.h (ARCH_TIMESIZE): Define to 8.

2019-05-05  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce HAVE_ARCH_TIME32_SYSCALLS and HAVE_ARCH_OLD_TIME64_SYSCALLS.
	These are going to control whether to compile parsers of 32-bit and
	old 64-bit time syscalls.

	* linux/arch_defs_.h [!MIN_WORDSIZE] (MIN_WORDSIZE): Define.
	[!HAVE_ARCH_TIME32_SYSCALLS] (HAVE_ARCH_TIME32_SYSCALLS): Define.
	[!HAVE_ARCH_OLD_TIME64_SYSCALLS] (HAVE_ARCH_OLD_TIME64_SYSCALLS):
	Define.
	* linux/alpha/arch_defs_.h (HAVE_ARCH_TIME32_SYSCALLS): Define.
	* linux/x32/arch_defs_.h (HAVE_ARCH_OLD_TIME64_SYSCALLS): Define.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	time.c: introduce do_timerfd_gettime and do_timerfd_settime.
	These are going to be used to implement parsers of timerfd_gettime64
	and timerfd_settime64 syscalls.

	* time.c (do_timerfd_settime, do_timerfd_gettime): New functions.
	((SYS_FUNC(timerfd_settime)): Turn into a thin wrapper around
	do_timerfd_settime.
	((SYS_FUNC(timerfd_gettime)): Turn into a thin wrapper around
	do_timerfd_gettime.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	time.c: introduce do_timer_gettime and do_timer_settime.
	These are going to be used to implement parsers of timer_gettime64 and
	timer_settime64 syscalls.

	* time.c (do_timer_settime, do_timer_gettime): New functions.
	((SYS_FUNC(timer_settime)): Turn into a thin wrapper around
	do_timer_settime.
	((SYS_FUNC(timer_gettime)): Turn into a thin wrapper around
	do_timer_gettime.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	time.c: introduce do_clock_gettime, do_clock_settime, and do_clock_nanosleep
	These are going to be used to implement parsers of clock_gettime64,
	clock_settime64, and clock_nanosleep_time64 syscalls.

	* time.c (do_clock_settime, do_clock_gettime, do_clock_nanosleep): New
	functions.
	((SYS_FUNC(clock_settime)): Turn into a thin wrapper around
	do_clock_settime.
	((SYS_FUNC(clock_gettime)): Turn into a thin wrapper around
	do_clock_gettime.
	((SYS_FUNC(clock_nanosleep)): Turn into a thin wrapper around
	do_clock_nanosleep.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	time.c: introduce do_clock_adjtime.
	This is going to be used to implement a parser of clock_adjtime64
	syscall.

	* time.c (do_clock_adjtime): New function.
	((SYS_FUNC(clock_adjtime)): Turn into a thin wrapper around
	do_clock_adjtime.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	do_adjtimex: parametrize print_timex.
	This is going to be used to implement a parser of clock_adjtime64
	syscall.

	* time.c (do_adjtimex): Add print_tx argument, invoke it
	instead of print_timex.
	(SYS_FUNC(adjtimex), SYS_FUNC(clock_adjtime)): Pass print_timex
	to do_adjtimex.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	utimes.c: introduce do_utimensat.
	This is going to be used to implement a parser of utimensat_time64
	syscall.

	* utimes.c (do_utimensat): New function.
	(SYS_FUNC(utimensat)): Turn into a thin wrapper around do_utimensat.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	signal.c: introduce do_rt_sigtimedwait.
	This is going to be used to implement a parser of rt_sigtimedwait_time64
	syscall.

	* signal.c (do_rt_sigtimedwait): New function.
	(SYS_FUNC(rt_sigtimedwait)): Turn into a thin wrapper around
	do_rt_sigtimedwait.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	sched.c: introduce do_sched_rr_get_interval.
	This is going to be used to implement a parser of
	sched_rr_get_interval_time64 syscall.

	* sched.c (do_sched_rr_get_interval): New function.
	(SYS_FUNC(sched_rr_get_interval)): Turn into a thin wrapper around
	do_sched_rr_get_interval.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	poll.c: introduce do_ppoll.
	This is going to be used to implement a parser of ppoll_time64 syscall.

	* poll.c (decode_poll_exiting): Add sprint_ts argument.
	(SYS_FUNC(poll)): Pass sprint_timespec to decode_poll_exiting.
	(do_ppoll): New function.
	(SYS_FUNC(ppoll)): Turn into a thin wrapper around do_ppoll.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	mq.c: introduce do_mq_timedsend and do_mq_timedreceive.
	These are going to be used to implement parsers of mq_timedsend_time64
	and mq_timedreceive_time64 syscalls.

	* mq.c (do_mq_timedsend, do_mq_timedreceive): New functions.
	(SYS_FUNC(mq_timedsend)): Turn into a thin wrapper around
	do_mq_timedsend.
	(SYS_FUNC(mq_timedreceive)): Turn into a thin wrapper around
	do_mq_timedreceive.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	mmsghdr.c: introduce do_recvmmsg.
	This is going to be used to implement a parser of recvmmsg_time64
	syscall.

	* mmsghdr.c (do_recvmmsg): New function.
	(SYS_FUNC(recvmmsg)): Turn into a thin wrapper around do_recvmmsg.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	ipc_sem.c: introduce do_semtimedop.
	This is going to be used to implement a parser of semtimedop_time64
	syscall.

	* ipc_sem.c (do_semtimedop): New function.
	(SYS_FUNC(semtimedop)): Turn into a thin wrapper around do_semtimedop.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	futex.c: introduce do_futex.
	This is going to be used to implement a parser of futex_time64 syscall.

	* futex.c (do_futex): New function.
	(SYS_FUNC(futex)): Turn into a thin wrapper around do_futex.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	desc.c: introduce do_pselect6.
	This is going to be used to implement a parser of pselect6_time64
	syscall.

	* dec.c (do_pselect6): New function.
	(SYS_FUNC(pselect6)): Turn into a thin wrapper around do_pselect6.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	print_io_getevents: parametrize print_timespec.
	This is going to be used to implement a parser of io_pgetevents_time64
	syscall.

	* aio.c (print_io_getevents): Add print_ts argument, invoke it
	instead of print_timespec.
	(SYS_FUNC(io_getevents), SYS_FUNC(io_pgetevents)): Pass print_timespec
	to print_io_getevents.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce print_obj_by_addr_fn and sprint_obj_by_addr_fn.
	These types are going to be used in signatures of functions that take
	print_*time* functions as parameters.

	* defs.h (print_obj_by_addr_fn, sprint_obj_by_addr_fn): New types.
	* desc.c (decode_select): Use them.

2019-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	Change signatures of print_*time* functions to match print_timex.
	Make all these functions that print time by address return -1 when
	umove_or_printaddr() returns non-zero.

	This helps to use these functions as parameters to other functions.

	* defs.h [ALPHA] (print_timeval32, print_timeval32_utimes,
	print_itimerval32): Change return type to int.
	* desc.c (decode_select): Change return type of print_tv_ts to int.
	* print_timespec.c (print_timespec, print_timespec_utime_pair,
	print_itimerspec): Change return type to int, return -1 when
	umove_or_printaddr() returns non-zero.
	* print_timeval.c (print_timeval, print_timeval_utimes,
	print_itimerval): Likewise.
	[ALPHA] (print_timeval32, print_timeval32_utimes, print_itimerval32):
	Likewise.

2019-04-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify umount and umount2 tests against future kernel changes.
	Prepare for the rename of umount syscall to umount2 introduced by linux
	kernel commits v5.1-rc1~160^2~3^2~12 and v5.1-rc1~160^2~3^2~16 on alpha
	and ia64 architectures, respectively.

	* tests/umount.c: Check for __NR_umount == __NR_umount2.
	* tests/umount2.c: Likewise.

2019-04-15  Dmitry V. Levin  <ldv@altlinux.org>

	alpha: wire up getegid, geteuid, and getppid syscalls.
	* linux/alpha/syscallent.h [530..532]: Wire up getegid, geteuid,
	and getppid syscalls introduced on this architecture by linux commit
	v5.1-rc1~160^2~3^2~1.
	* NEWS: Mention this.

	alpha: wire up statfs64 and fstatfs64 syscalls.
	* linux/alpha/syscallent.h [528..529]: Wire up statfs64 and fstatfs64
	syscalls introduced on this architecture by linux commit
	v5.1-rc1~160^2~3^2~2.
	* NEWS: Mention this.

	Wire up pkey_* and rseq syscalls on remaining architectures.
	* linux/alpha/syscallent.h [524..527]: Wire up pkey_mprotect,
	pkey_alloc, pkey_free, and rseq syscalls introduced on this architecture
	by linux commit v5.1-rc1~160^2~3^2~3.
	* linux/hppa/syscallent.h [351..354]: Likewise.
	* linux/ia64/syscallent.h [1024 + 330..333]: Likewise.
	* linux/m68k/syscallent.h [381..384]: Likewise.
	* linux/sh/syscallent.h [384..387]: Likewise.
	* linux/sparc/syscallent.h [362..365]: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/s390/syscallent.h [384..386]: Wire up pkey_mprotect,
	pkey_alloc, and pkey_free syscalls introduced on this architecture
	by linux commit v5.1-rc1~160^2~3^2~3.
	* linux/s390x/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h [352]: Wire up rseq syscall introduced
	on this architecture by linux commit v5.1-rc1~160^2~3^2~3.
	* NEWS: Mention this.

	Wire up direct ipc syscalls on m68k, mips, powerpc*, s390*, sh, sparc*, x86
	* linux/i386/syscallent.h [393..402]: Wire up semget, semctl, shmget,
	shmctl, shmat, shmdt, msgget, msgsnd, msgrcv, and msgctl syscalls
	introduced on this architecture by linux commit v5.1-rc1~160^2~3^2~4.
	* linux/m68k/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/mips/syscallent-o32.h [4393..4402]: Wire up semget, semctl,
	shmget, shmctl, shmat, shmdt, msgget, msgsnd, msgrcv, and msgctl syscalls
	introduced on this architecture by linux commit v5.1-rc1~160^2~3^2~4.
	* linux/powerpc64/syscallent.h [392..402]: Wire up semtimedop, semget,
	semctl, shmget, shmctl, shmat, shmdt, msgget, msgsnd, msgrcv, and msgctl
	syscalls introduced on this architecture by linux commit
	v5.1-rc1~160^2~3^2~4.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* NEWS: Mention this.

	powerpc, powerpc64: remove direct ipc syscall entries.
	* linux/powerpc/syscallent.h [366..377]: Remove entries reserved for
	direct ipc syscalls, they were added by linux kernel commit
	v4.4-rc1~98^2~32 and removed by linux kernel commit v4.4-rc6~5^2~2.
	* linux/powerpc64/syscallent.h: Likewise.

	sh: wire up statx syscall.
	* linux/sh/syscallent.h [380]: Wire up statx syscall
	introduced on sh by linux commit v5.1-rc1~160^2~3^2~7.
	* NEWS: Mention this.

	m68k: wire up seccomp syscall.
	* linux/m68k/syscallent.h [380]: Wire up seccomp syscall
	introduced on m68k by linux commit v5.1-rc1~160^2~3^2~9.
	* NEWS: Mention this.

	arm: wire up kexec_file_load syscall.
	* linux/arm/syscallent.h [401]: Wire up kexec_file_load syscall
	introduced on arm by linux commit v5.1-rc1~160^2~3^2~10.
	* NEWS: Mention this.

	arm: wire up migrate_pages syscall.
	* linux/arm/syscallent.h [400]: Wire up migrate_pages syscall
	introduced on arm by linux commit v5.1-rc1~160^2~3^2~11.
	* NEWS: Mention this.

	alpha: wire up io_pgetevents syscall.
	* linux/alpha/syscallent.h [523]: Wire up io_pgetevents syscall
	introduced on alpha by linux commit v5.1-rc1~160^2~3^2~13.
	* NEWS: Mention this.

	ia64: wire up perf_event_open and seccomp syscalls.
	* linux/ia64/syscallent.h [1024 + 327..328]: Wire up perf_event_open
	and seccomp syscalls introduced on ia64 by linux commit
	v5.1-rc1~160^2~3^2~14.
	* NEWS: Mention this.

	ia64: wire up statx and io_pgetevents syscalls.
	* linux/ia64/syscallent.h [1024 + 326..327]: Wire up statx and
	io_pgetevents syscalls introduced on ia64 by linux commit
	v5.1-rc1~160^2~3^2~15.
	* NEWS: Mention this.

	ia64: make syscall entry table numbers more readable.
	* linux/ia64/syscallent.h: Format syscall numbers using base+offset form.
	* scno.am (SCNO_SED): Update to handle this format.

2019-03-24  Guo Ren  <ren_guo@c-sky.com>

	Add C-SKY architecture support.
	This is port of C-SKY architecture for strace.  There is a little
	difference between abiv1 and abiv2, we use __CSKYABIV2__ from GCC-csky
	to distinguish.

	Reviewed-By: Dmitry V. Levin <ldv@altlinux.org>

	* cacheflush.c [CSKY] (cacheflush_flags, SYS_FUNC(cacheflush)): Define.
	* clone.c [CSKY] (ARG_*): Define.
	* configure.ac [$host_cpu == csky*]: Define CSKY.
	* linux/csky/arch_regs.c: New file.
	* linux/csky/get_error.c: Likewise.
	* linux/csky/get_scno.c: Likewise.
	* linux/csky/get_syscall_args.c: Likewise.
	* linux/csky/ioctls_arch0.h: Likewise.
	* linux/csky/ioctls_inc0.h: Likewise.
	* linux/csky/raw_syscall.h: Likewise.
	* linux/csky/set_error.c: Likewise.
	* linux/csky/set_scno.c: Likewise.
	* linux/csky/syscallent.h: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.
	* NEWS: Mention this change.

2019-03-24  Guo Ren  <ren_guo@c-sky.com>

	riscv: Fixup wrong clone's arguments define.
	In linux kernel riscv select CLONE_BACKWARDS in
	linux/arch/riscv/Kconfig, and in linux/kernel/fork.c:

	ifdef CONFIG_CLONE_BACKWARDS
	SYSCALL_DEFINE5(clone, unsigned long, clone_flags, unsigned long, newsp,
			 int __user *, parent_tidptr,
			 unsigned long, tls,
			 int __user *, child_tidptr)
	elif ...

	So we must make the riscv clone-arguments' sequence to be:
	  define ARG_FLAGS	0
	  define ARG_STACK	1
	  define ARG_PTID	2
	  define ARG_TLS	3
	  define ARG_CTID	4

	Reviewed-By: Dmitry V. Levin <ldv@altlinux.org>

	* clone.c [RISCV]: Use default definitions for ARG_* macros.
	* NEWS: Mention this fix.

2019-03-20  Dmitry V. Levin  <ldv@altlinux.org>

	Post-release administrivia.
	* NEWS: Add a header line for the next release.
	* debian/changelog.in: Add a changelog entry for 5.0-1.
	* strace.spec.in: Likewise.

2019-03-19  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for 5.0 release.
	* NEWS: Update for 5.0 release.

	.mailmap: add more entries to avoid duplication in CREDITS.

2019-03-18  Dmitry V. Levin  <ldv@altlinux.org>

	strace.spec.in: do not define Group tag for modern distros.
	* strace.spec.in (Group): Conditionalize on distro version.

	References: https://fedoraproject.org/wiki/Changes/Remove_Group_Tag

2019-03-18  Dmitry V. Levin  <ldv@altlinux.org>

	strace-log-merge: enhance pid formatting.
	* strace-log-merge (max_suffix_length): New variable.
	(iterate_logfiles, process_suffix, process_logfile): New functions.
	Use them to choose the optimum width for pid column.
	* NEWS: Mention this enhancement.
	* tests/strace-log-merge-suffix.test: New test.
	* tests/Makefile.am (MISC_TESTS): Add it.

2019-03-18  Dmitry V. Levin  <ldv@altlinux.org>

	strace-log-merge: fix error diagnostics.
	* strace-log-merge: Print error diagnostics and exit with a non-zero
	status in case of no strace output.
	* NEWS: Mention this fix.
	* tests/strace-log-merge-error.test: New test.
	* tests/Makefile.am (MISC_TESTS): Add it.

	Fixes: v4.21~287 "strace-log-merge: work around corner cases of strace -ttt parsing"

2019-03-18  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update NEWS.

2019-03-18  Dmitry V. Levin  <ldv@altlinux.org>

	Update copyright year number range.
	* COPYING: Update copyright year number range.
	* tests/COPYING: Likewise.
	* debian/copyright: Likewise.

	Update copyright headers.
	Headers updated automatically using maint/update_copyright_years.sh
	script.

2019-03-18  Dmitry V. Levin  <ldv@altlinux.org>

	Fix preprocessor indentation.
	Indent the C preprocessor directives to reflect their nesting
	using the following script:

	$ cppi -l $(git grep -El '^[[:space:]]*#[[:space:]]*(if|ifdef|ifndef|elif|else|endif|define|pragma)[[:space:]]' |grep -v '\.sh$') |while read f; do
		cppi < "$f" > "$f".cppi; mv "$f".cppi "$f"
	done

2019-03-17  Shankara Pailoor  <shankarapailoor@gmail.com>

	Honor xlat styles when decoding mac addresses.
	* defs.h (print_mac_addr): Add xlat_style support, move ...
	* print_mac.c: ... here.
	* tests/sockaddr_xlat.c [HAVE_BLUETOOTH_BLUETOOTH_H]: Include
	<bluetooth/bluetooth.h>, <bluetooth/hci.h>, <bluetooth/l2cap.h>
	<bluetooth/rfcomm.h>, and <bluetooth/sco.h>.
	[HAVE_BLUETOOTH_BLUETOOTH_H] (check_sco, check_rc): New functions.
	(main) [HAVE_BLUETOOTH_BLUETOOTH_H]: Call them to verify
	new xlat_style support in print_mac_addr().
	* tests/net-packet_mreq.c: Handle XLAT_RAW, XLAT_ABBREV,
	and XLAT_VERBOSE macros.
	* tests/net-packet_mreq-Xabbrev.c: New test.
	* tests/net-packet_mreq-Xraw.c: Likewise.
	* tests/net-packet_mreq-Xverbose.c: Likewise.
	* tests/gen_tests.in (net-packet_mreq-Xabbrev, net-packet_mreq-Xraw,
	net-packet_mreq-Xverbose): New tests.
	* tests/pure_executables.list: Add net-packet_mreq-Xabbrev,
	net-packet_mreq-Xraw, and et-packet_mreq-Xverbose.
	* tests/.gitignore: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2019-03-17  Shankara Pailoor  <shankarapailoor@gmail.com>

	net: print mac address consistently.
	* net.c (print_packet_mreq): Call PRINT_FIELD_MAC_SZ instead of custom
	print.
	* tests/net-packet_mreq.c (test_packet_mreq): Update expected output.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2019-03-17  Dmitry V. Levin  <ldv@altlinux.org>

	Change -D option to imply -I4.
	* strace.c (init) [daemonized_tracer && !opt_intr]: Set opt_intr
	to INTR_BLOCK_TSTP_TOO.
	* strace.1.in: Document this.
	* NEWS: Mention this change.

	Resolves: https://github.com/strace/strace/issues/96

2019-03-15  Tuan Hoang  <tmhoang@linux.ibm.com>

	s390: fix SIGNAL_FRAMESIZE macro.
	Since __SIGNAL_FRAMESIZE is in private name space, it is better not to
	use it directly. This macro has been stable on s390/s390x so it is safe
	to use the integer value.

	* linux/s390/arch_sigreturn.c [!SIGNAL_FRAMESIZE] (SIGNAL_FRAMESIZE):
	Define to 96.
	* linux/s390x/arch_sigreturn.c (arch_sigreturn == s390_arch_sigreturn):
	Remove S390_SIGNAL_FRAMESIZE and SIGNAL_FRAMESIZE.
	(arch_sigreturn == s390x_arch_sigreturn): Define SIGNAL_FRAMESIZE.
	* linux/s390/rt_sigframe.h (SIGNAL_FRAMESIZE): Define.
	(struct_rt_sigframe): Replace __SIGNAL_FRAMESIZE with SIGNAL_FRAMESIZE.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2019-03-14  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: add support for new seven fields in BPF_PROG_LOAD.
	* bpf_attr.h (struct BPF_PROG_LOAD_struct): Add prog_btf_fd,
	func_info_rec_size, func_info, func_info_cnt, line_info_rec_size,
	line_info, and line_info_cnt fields.
	* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)): Decode these fields
	introduced by Linux commits v5.0-rc1~129^2~209^2~16^2~8 and
	v5.0-rc1~129^2~114^2~5^2~6.
	* tests/bpf.c (BPF_PROG_LOAD_checks): Check it.
	* tests/kernel_version.c (print_bpf_attr): Update expected output.
	* tests/bpf-obj_get_info_by_fd.c (print_prog_load): Likewise.

2019-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: implement decoding of BPF_TASK_FD_QUERY command.
	BPF_TASK_FD_QUERY command was introduced by Linux commit
	v4.18-rc1~114^2~148^2~1^2~5.

	* bpf_attr.h (struct BPF_TASK_FD_QUERY_struct): New type.
	(BPF_TASK_FD_QUERY_struct_size,
	expected_BPF_TASK_FD_QUERY_struct_size): New macros.
	* bpf.c: Include "xlat/bpf_task_fd_type.h".
	(BEGIN_BPF_CMD_DECODER(BPF_TASK_FD_QUERY)): New bpf command decoder.
	(SYS_FUNC(bpf)) <bpf_cmd_decoders[]>: Add
	BPF_CMD_ENTRY(BPF_TASK_FD_QUERY).
	* xlat/bpf_task_fd_type.in: New file.
	* tests/bpf.c (union bpf_attr_data): Add
	BPF_ATTR_DATA_FIELD(BPF_TASK_FD_QUERY).
	(BPF_TASK_FD_QUERY_checks): New checks array.
	(main) <checks>: Add CHK(BPF_TASK_FD_QUERY).

2019-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: implement decoding of BPF_MAP_LOOKUP_AND_DELETE_ELEM command.
	BPF_MAP_LOOKUP_AND_DELETE_ELEM command was introduced by Linux commit
	v4.20-rc1~151^2~32^2~11^2~2.

	* bpf.c (decode_BPF_MAP_LOOKUP_AND_DELETE_ELEM): Alias
	to decode_BPF_MAP_LOOKUP_ELEM.
	(SYS_FUNC(bpf)) <bpf_cmd_decoders[]>: Add
	BPF_CMD_ENTRY(BPF_MAP_LOOKUP_AND_DELETE_ELEM).
	* tests/bpf.c (BPF_MAP_LOOKUP_AND_DELETE_ELEM_checks): Alias
	to BPF_MAP_LOOKUP_ELEM_checks.
	(main) <checks>: Add CHK(BPF_MAP_LOOKUP_AND_DELETE_ELEM).

2019-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: implement decoding of BPF_BTF_GET_FD_BY_ID command.
	BPF_BTF_GET_FD_BY_ID command was introduced by Linux commit
	v4.18-rc1~114^2~223^2~21^2~4.

	* bpf_attr.h (struct BPF_BTF_GET_FD_BY_ID_struct): New type.
	(BPF_BTF_GET_FD_BY_ID_struct_size,
	expected_BPF_BTF_GET_FD_BY_ID_struct_size): New macros.
	* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_BTF_GET_FD_BY_ID)): New bpf command
	decoder.
	(SYS_FUNC(bpf)) <bpf_cmd_decoders[]>: Add
	BPF_CMD_ENTRY(BPF_BTF_GET_FD_BY_ID).
	* tests/bpf.c (union bpf_attr_data): Add
	BPF_ATTR_DATA_FIELD(BPF_BTF_GET_FD_BY_ID).
	(BPF_BTF_GET_FD_BY_ID_checks): New checks array.
	(main) <checks>: Add CHK(BPF_BTF_GET_FD_BY_ID).

2019-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: implement decoding of BPF_BTF_LOAD command.
	BPF_BTF_LOAD command was introduced by Linux commit
	v4.18-rc1~114^2~417^2~1^2~5.

	* bpf_attr.h (struct BPF_BTF_LOAD_struct): New type.
	(BPF_BTF_LOAD_struct_size, expected_BPF_BTF_LOAD_struct_size): New
	macros.
	* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_BTF_LOAD)): New bpf command decoder.
	(SYS_FUNC(bpf)) <bpf_cmd_decoders[]>: Add BPF_CMD_ENTRY(BPF_BTF_LOAD).
	* tests/bpf.c (union bpf_attr_data): Add
	BPF_ATTR_DATA_FIELD(BPF_BTF_LOAD).
	(init_BPF_BTF_LOAD_attr): New function.
	(BPF_BTF_LOAD_checks): New checks array.
	(main) <checks>: Add CHK(BPF_BTF_LOAD).

2019-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: make decoders of BPF_*_GET_FD_BY_ID commands return RVAL_FD.
	These bpf commands return file descriptors.

	* bpf.c (BPF_PROG_GET_FD_BY_ID, BPF_MAP_GET_FD_BY_ID): Add RVAL_FD
	to END_BPF_CMD_DECODER.

2019-03-12  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: add support for new twelve fields in struct bpf_prog_info.
	* bpf_attr.h (struct bpf_prog_info_struct): Add btf_id,
	func_info_rec_size, func_info, nr_func_info, nr_line_info, line_info,
	jited_line_info, nr_jited_line_info, line_info_rec_size,
	jited_line_info_rec_size, nr_prog_tags, and prog_tags fields.
	* bpf.c (struct obj_get_info_saved): Add func_info_rec_size,
	nr_func_info, nr_line_info, jited_line_info, nr_jited_line_info,
	line_info_rec_size, jited_line_info_rec_size, and nr_prog_tags fields.
	(print_bpf_prog_info): Decode the twelve fields introduced by Linux
	commits v5.0-rc1~129^2~209^2~16^2~8, v5.0-rc1~129^2~114^2~5^2~6,
	v5.0-rc1~129^2~114^2^2~2, and v5.0-rc1~129^2~15^2~22.
	* NEWS: Mention the latest bpf decoding enhancements.
	* tests/bpf-obj_get_info_by_fd.c (main): Update expected output.

	Resolves: https://github.com/strace/strace/issues/94

2019-03-12  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: add support for *jited_ksyms and *jited_func_lens fields in struct bpf_prog_info
	* bpf_attr.h (struct bpf_prog_info_struct): Add nr_jited_ksyms,
	nr_jited_func_lens, jited_ksyms, and jited_func_lens fields.
	* bpf.c (struct obj_get_info_saved): Likewise.
	(print_bpf_prog_info): Decode these fields introduced by Linux commits
	v4.18-rc1~114^2~148^2~3^2~6 and v4.18-rc1~114^2~148^2~3^2~2.
	* tests/bpf-obj_get_info_by_fd.c (main): Update expected output.

	bpf: add support for btf_* fields in struct bpf_map_info.
	* bpf_attr.h (struct bpf_map_info_struct): Add btf_fd, btf_key_type_id,
	and btf_value_type_id fields.
	* bpf.c (print_bpf_map_info): Decode btf_fd, btf_key_type_id,
	and btf_value_type_id fields introduced by Linux commits
	v4.18-rc1~114^2~223^2~21^2~4 and v4.18-rc1~114^2~148^2~7^2~2.
	* tests/bpf-obj_get_info_by_fd.c (main): Update expected output.

	bpf: add support for btf_* fields in BPF_MAP_CREATE.
	* bpf_attr.h (struct BPF_MAP_CREATE_struct): Add btf_fd,
	btf_key_type_id, and btf_value_type_id fields.
	* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_MAP_CREATE)): Decode btf_fd,
	btf_key_type_id, and btf_value_type_id fields introduced by Linux
	commits v4.18-rc1~114^2~417^2~1^2~3 and v4.18-rc1~114^2~148^2~7^2~2.
	* tests/bpf.c (BPF_MAP_CREATE_checks): Check it.
	* tests/bpf-obj_get_info_by_fd.c (print_map_create): Update expected
	output.

2019-03-12  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: print struct bpf_prog_info.gpl_compatible.
	This bit field was added by Linux commit v4.18-rc1~114^2~376^2~6.

	* bpf_attr.h (struct bpf_prog_info_struct): Add gpl_compatible field.
	* bpf.c (print_bpf_prog_info): Print gpl_compatible field.
	* tests/bpf-obj_get_info_by_fd.c (main): Update expected output.

2019-03-12  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: exclude bit fields from the check.
	Currently we have no instruments to check the size and offsets
	of bit fields.

	* gen_bpf_attr_check.sh: Do not print bit fields.
	* m4/gen_bpf_attr_m4.awk: Likewise.

2019-03-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Implement queueing of threads before dispatching them.
	It is possible that some tracees call a lot of cheap syscalls too fast,
	and that can stress the tracer to the point some tracees are not served
	for indefinite amount of time.  In order to avoid that unfairness, try
	to collect all the pending tracees first along with the relevant
	information and only then dispatch the events.

	* defs.h: Include "list.h".
	(struct tcb): Add wait_data_idx, delayed_wait_data, and wait_list
	fields.
	* strace.c (struct tcb_wait_data): Add "msg" field.
	(tcb_wait_tab, tcb_wait_tab_size): New static variables.
	(alloctcb): Initialize wait_list.
	(droptcb): Remove tcp from wait_list.
	(maybe_switch_tcbs): Get old pid from
	tcb_wait_tab[tcp->wait_data_idx].msg instead of calling
	ptrace(PTRACE_GETEVENTMSG).
	(trace_wait_data_size, init_trace_wait_data, copy_trace_wait_data,
	free_trace_wait_data, tcb_wait_tab_check_size): New functions, in order
	to allow the code outside next_event to operate with wait_data as with
	an opaque object (needed for dispatch_event and restart_delayed_tcb).
	(next_event): Add pending_tcps, extra_tcp, wait_nohang, elem, and
	wait_tab_pos variables; check for elements in pending_tcps and skip
	waiting if the list is not empty; check for extra_tcp and skip waiting
	along with swapping wait_data_idx with wait_extra_data_idx;
	after the initial wait4(), call wait4() in loop with WNOHANG flag set;
	fetch siginfo on signal and eventmsg on PTRACE_EVENT_EXEC;
	return the first tcp in pending_tcps list.
	(dispatch_event): Store a pointer to a copy of tcb_wait_data in
	tcp->delayed_wait_data if tcp's restart has to be delayed.
	(restart_delayed_tcb): Use tcp->delayed_wait_data, create a stub
	tcb_wait_data if it is NULL, free temporary trace_wait_data.
	* tests/Makefile.am (XFAIL_TEST): Remove looping_threads.test.

	Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=478419
	Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=526740
	Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=851457
	Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1609318
	Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1610774
	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
	Co-Authored-by: Denys Vlasenko <dvlasenk@redhat.com>
	Co-Authored-by: Andreas Schwab <aschwab@redhat.com>
	Co-Authored-by: Jeff Law <law@redhat.com>
	Co-Authored-by: DJ Delorie <dj@redhat.com>

2019-03-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add a generic list implementation.
	Similar to the one used in the Linux kernel.

	* macros.h (cast_ptr, containerof): New macros.
	* list.h: New file.
	* Makefile.am (strace_SOURCES): Add it.

2019-03-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check tracing of looping threads.
	* test/many_looping_threads.c: Remove.
	* test/.gitignore: Remove many_looping_threads.
	* test/Makefile (PROGS): Likewise.
	(many_looping_threads): Remove.
	* tests/looping_threads.c: New file.
	* tests/looping_threads.test: New test.
	* tests/.gitignore: Add looping_threads.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(looping_threads_LDADD): New variable.
	(MISC_TESTS, XFAIL_TESTS): Add looping_threads.test.

2019-03-06  Dmitry V. Levin  <ldv@altlinux.org>

	Bump SYS_socket_subcall from 400 to 500.
	Make room for syscalls that are going to be introduced in Linux 5.1.

	* linux/i386/syscallent.h (SYS_socket_subcall): Raise from 400 to 500.
	* linux/m68k/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/powerpc64/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/sparc64/syscallent.h: Likewise.
	* linux/mips/syscallent-o32.h (SYS_socket_subcall): Raise from 4400
	to 4500.
	* linux/mips/syscallent-n64.h (SYS_socket_subcall): Raise from 5400
	to 5500.
	* linux/mips/syscallent-n32.h (SYS_socket_subcall): Raise from 6400
	to 6500.

2019-03-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check tracing of orphaned process group.
	* tests/orphaned_process_group.c: New file.
	* tests/.gitignore: Add orphaned_process_group.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	* tests/gen_tests.in (orphaned_process_group): New test.

2019-03-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests: move PTRACE_SEIZE check to a separate file.
	The check is going to be used by another test soon.

	* tests/PTRACE_SEIZE.sh: New file.
	* tests/detach-stopped.test: Use it.
	* tests/Makefile.am (EXTRA_DIST): Add PTRACE_SEIZE.sh.

2019-02-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.c: fix up formatting after commit v4.24~48.
	The commit v4.24~48 "Implement -e kvm= option on all architectures",
	while removing #ifdef, left formatting of the help message string a bit
	inconsistent.

	* strace.c (usage): Move "\n\" bit after "kvm", remove double quotes.

	Complements: v4.24~48 "Implement -e kvm= option on all architectures"

2019-02-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: fix xgetrlimit output when syscall returns an error.
	* tests/xgetrlimit.c (main): Expect pointer to rlimit as the second
	argument when syscall returns an error.  Use sprintrc().

	strace.c: pass signal number to cleanup()
	* strace.c (die): Pass 0 as an argument to cleanup().
	(cleanup): Add fatal_sig parameter, remove the local variable
	of the same name, do not use interrupted.
	(terminate): Initialise a new local variable "sig" with "interrupted",
	pass it to cleanup() and use it instead of "interrupted" for exit_code
	initialisation.

2019-02-25  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Update ioctl entries from linux v5.0.
	* linux/32/ioctls_inc_align16.h: Update from linux v5.0-rc8
	using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* linux/aarch64/ioctls_arch0.h: Likewise.
	* linux/arm/ioctls_arch0.h: Likewise.
	* linux/mips/ioctls_arch0.h: Likewise.
	* linux/powerpc/ioctls_arch0.h: Likewise.
	* linux/s390/ioctls_arch0.h: Likewise.
	* linux/s390x/ioctls_arch0.h: Likewise.
	* NEWS: Mention this.

	maint: update for linux 5.0-rc8.
	* maint/ioctls_sym.sh (x86_list): Add KVM_GET_SUPPORTED_HV_CPUID.

2019-02-24  Dmitry V. Levin  <ldv@altlinux.org>

	xlat/gen.sh: disable file name globbing by default.
	As the script uses file name globbing only in one place,
	disable it by default and enable it when necessary.

	* xlat/gen.sh: Add -f to shebang.
	(main): Enable file name globbing to generate the list of input files.

2019-02-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat/gen.sh: speedup, part 5.
	* xlat/gen.sh (gen_header): Process xlat line with sed only when "/*"
	substring is present in it.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2019-02-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat/gen.sh: speedup, part 4.
	* xlat/gen.sh (cond_xlat): Use read instead of sed for xlat entry
	parsing.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2019-02-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat/gen.sh: speedup, part 3.
	* xlat/gen.sh (cond_def): Use parameter substitution instead of sed
	for xlat line parsing.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2019-02-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat/gen.sh: speedup, part 2.
	* xlat/gen.sh (gen_header): Use "grep -q" instead of "grep > /dev/null".

	xlat/gen.sh: speedup, part 1.
	* xlat/gen.sh (cond_def, cond_xlat): Use printf builtin instead of cat.

	xlat/gen.sh: cleanup.
	* xlat/gen.sh: Export LC_ALL=C so it could be omitted from individual
	invocations.
	(cond_def): Remove LC_ALL=C from sed invocation.
	(gen_header): Remove LC_COLLATE=C.

2019-02-22  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Makefile.am: pass D variable to shell scripts' environment.
	And set -x if D is set to 1, so the commands called by various shell scripts
	are easier to see during debugging.

	* Makefile.am (bpf_attr_check.c, sen.h, mpers-m%.stamp, $(srcdir)/CREDITS): Pass
	D variable in the environment to the shell script call.
	* gen_bpf_attr_check.sh: Set -x if D is set to 1.
	* generate_mpers_am.sh: Likewise.
	* generate_sen.sh: Likewise.
	* maint/gen-contributors-list.sh: Likewise.
	* mpers.sh: Likewise.
	* mpers_test.sh: Likewise.

2019-02-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add checks for dumpstr output into read-write test.
	util.c:dumpstr() now aligns offsets in accordance with the total length
	of the dump and also may perform only partial dump, so let's add checks
	for these cases.

	* tests/fill_memory.c (fill_memory_ex): Change the type of the period
	argument from unsigned char to unsigned int.
	* tests/tests.h (fill_memory_ex): Likewise.
	* tests/read-write.c (dump_str_ex): Rename from dump_str, add idx_w
	argument, support len greater than 240 bytes.
	(dump_str): New function, wrapper for dump_str_ex with the default index
	width.
	(print_hex): Add checks for dumpstr output, close fd 1 later.

2019-02-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util: update dumpstr.
	Use a buffer of a limited size, use proper type for dump amount, avoid
	hard-coding of byte counts, calculate output buffer size more accurately
	and minimise its rewriting, pad offset with zeros in accordance
	with expected output amount.

	* defs.h (dumpstr): Change the type of len argument from int to
	kernel_ulong_t.
	* macros.h (ROUNDUP_DIV): New macro.
	(ROUNDUP): Rewrite using ROUNDUP_DIV.
	* util.c (ILOG2_ITER_): New macro.
	(ilog2_64, ilog2_32): New functions.
	(ilog2_klong): New macro, wrapper around ilog2_32/ilog2_64, so (potentially
	more expensive) ilog2_64 is not used for ilog2 calculation
	of a kernel_ulong_t-typed variable on architectures with 32-bit kernel long.
	(dumpstr): Update.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2019-02-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Generalise UUID printing.
	It was open-coded (using yet another open-coded hexadecimal character
	printing) in btrfs.c and can be used in other places (like dm.c or
	rtnl_link.c).

	* defs.h (print_uuid): New declaration.
	* print_fields.h (PRINT_FIELD_UUID): New macro.
	* util.c (print_uuid): New function.
	* btrfs.c (prnibble, UUID_STRING_SIZE, btrfs_unparse_uuid): Remove.
	(btrfs_ioctl): Use PRINT_FIELD_UUID for UUID printing.

2019-02-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Generalise some printing primitives.
	Character class checks and hexadecimal number formatting are open-coded
	all over the place, let's try to de-duplicate them a bit.

	* print_utils.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* util.c: Include "print_utils.h".
	(string_quote, dumpstr): Use sprint_byte_hex and is_print.
	* v4l2.c: Include "print_utils.h".
	(print_pixelformat): Use is_print and BYTE_HEX_CHARS_PRINTF_QUOTED,
	add a note that the routine is rather generic.

2019-02-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Move call_summary() from cleanup() to terminate()
	cleanup() has exactly two call sites, die() and terminate(), and the
	first one resets cflag in order to prevent call_summary() invocation.
	Move the call to terminate() in order to avoid bogus cflag reset.

	* strace.c (die): Remove cflag reset.
	(cleanup): Move call_summary() call ...
	(terminate): ... here.

2019-02-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	defs.h: define stack_trace_enabled to 0 is stack tracing is not enabled.
	This allows avoiding ifdefs sometimes.

	* defs.h [!ENABLE_STACKTRACE] (stack_trace_enabled): Define as 0.
	* strace.c (init): Remove #ifdef ENABLE_STACKTRACE around -c/-k check.

2019-02-19  Dmitry V. Levin  <ldv@altlinux.org>

	build: fix --with-libiberty.
	* m4/st_demangle.m4 (st_DEMANGLE): Move the check for cplus_demangle
	out of AC_CHECK_HEADERS because the latter checks for demangle.h in two
	different places and an absence of demangle.h in one of these places
	would cause a build error in --with-libiberty=yes mode.
	* NEWS: Mention this fix.

	Resolves: https://github.com/strace/strace/issues/92

2019-02-18  Shankara Pailoor  <shankarapailoor@gmail.com>

	Honor xlat styles when decoding ioprio_get and ioprio_set.
	* ioprio.c (SYS_FUNC(ioprio_get), SYS_FUNC(ioprio_set)): Add xlat_style
	support.
	* tests/ioprio-Xabbrev.c: New file.
	* tests/ioprio-Xraw.c: Likewise.
	* tests/ioprio-Xverbose.c: Likewise.
	* tests/ioprio.c: Handle XLAT_RAW, XLAT_ABBREV, and XLAT_VERBOSE macros.
	* tests/gen_tests.in (ioprio-Xabbrev, ioprio-Xraw, ioprio-Xverbose): New
	tests.
	* tests/pure_executables.list: Add ioprio-Xabbrev, ioprio-Xraw, and
	ioprio-Xverbose.
	* tests/.gitignore: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2019-02-18  Shankara Pailoor  <shankarapailoor@gmail.com>

	move_pages: honor xlat styles.
	* numa.c (print_status): Add xlat_style support for status argument.
	* tests/move_pages-Xabbrev.c: New file.
	* tests/move_pages-Xraw.c: Likewise.
	* tests/move_pages-Xverbose.c: Likewise.
	* tests/move_pages.c: Handle XLAT_RAW, XLAT_ABBREV, and XLAT_VERBOSE
	macros.
	* tests/gen_tests.in (move_pages-Xabbrev, move_pages-Xraw,
	move_pages-Xverbose): New tests.
	* tests/pure_executables.list: Add move_pages-Xabbrev, move_pages-Xraw,
	and move_pages-Xverbose.
	* tests/.gitignore: Likewise.

2019-02-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify threads-execve test against the odds.
	Give threads-execve.test more chances to succeed.

	* tests/threads-execve.test: Retry the test until run out of time.

2019-02-17  Shankara Pailoor  <shankarapailoor@gmail.com>

	Honor xlat styles when decoding resource limits.
	* resource.c (sprint_rlim64, sprint_rlim32): Remove.
	(print_rlim64_t, print_rlim32_t): New functions.
	(print_rlimit64, print_rlimit32): Use them.
	* tests/setrlimit-Xabbrev.c: New file.
	* tests/setrlimit-Xraw.c: Likewise.
	* tests/setrlimit-Xverbose.c: Likewise.
	* tests/setrlimit.c (main): Handle XLAT_ABBREV, XLAT_RAW,
	and XLAT_VERBOSE macros.
	* tests/xgetrlimit.c (sprint_rlim): Likewise.
	* tests/gen_tests.in (setrlimit-Xabbrev, setrlimit-Xraw,
	setrlimit-Xverbose): New tests.
	* tests/pure_executables.list: Add setrlimit-Xabbrev, setrlimit-Xraw,
	and setrlimit-Xverbose.
	* tests/.gitignore: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2019-02-17  Dmitry V. Levin  <ldv@altlinux.org>

	hppa: workaround kernel bug in syscall number tampering.
	Linux kernel commit v4.6-rc2~20^2 introduced a regression:
	when tracer changes syscall number to -1, the kernel fails
	to initialize %r28 with -ENOSYS and subsequently fails
	to return the error code of the failed syscall to userspace.
	Workaround this by initializing %r28 ourselves.

	* linux/arch_defs_.h (ARCH_NEEDS_SET_ERROR_FOR_SCNO_TAMPERING): Define
	to 0.
	* linux/hppa/arch_defs_.h (ARCH_NEEDS_SET_ERROR_FOR_SCNO_TAMPERING):
	Define to 1.
	* syscall.c (tamper_with_syscall_entering)
	[ARCH_NEEDS_SET_ERROR_FOR_SCNO_TAMPERING]: When changing syscall number
	to -1, set the return value as well.

2019-02-16  Dmitry V. Levin  <ldv@altlinux.org>

	hppa: define PT_* constants as offsets inside struct pt_regs.
	Define constants passed to upeek and upoke using a method that works
	with different wordsize values.

	* linux/hppa/arch_regs.c (PT_GR26, PT_GR30, PT_IAOQ0, PT_IAOQ1): Remove.
	(PT_GR20, PT_GR28, ARCH_PC_PEEK_ADDR, ARCH_SP_PEEK_ADDR): Redefine using
	offsets inside struct pt_regs.
	* linux/hppa/get_syscall_args.c (arch_get_syscall_args): Replace PT_GR26
	with offsets inside struct pt_regs.

2019-02-16  Dmitry V. Levin  <ldv@altlinux.org>

	hppa: enhance decoding of PTRACE_PEEKUSER and PTRACE_POKEUSER.
	Print symbolic constants corresponding to numeric arguments
	of PTRACE_PEEKUSER and PTRACE_POKEUSER requests.

	* linux/hppa/userent.h: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* NEWS: Mention this.

2019-02-15  Dmitry V. Levin  <ldv@altlinux.org>

	mips o32: fix 7th syscall argument with PTRACE_GET_SYSCALL_INFO API.
	As PTRACE_GET_SYSCALL_INFO API supports 6 syscall arguments,
	all architectures that have syscalls with more than 6 arguments
	(i.e. mips o32) have to fetch extra arguments manually when using
	PTRACE_GET_SYSCALL_INFO API.

	* linux/mips/get_syscall_args.c [LINUX_MIPSO32]
	(arch_get_syscall_args_extra): New function.
	* syscall.c (get_syscall_args) [MAX_ARGS > 6]: Use it.

	Fixes: v4.26~49 "Introduce PTRACE_GET_SYSCALL_INFO support"

2019-02-15  Dmitry V. Levin  <ldv@altlinux.org>

	mips: update comment.
	* linux/mips/get_syscall_args.c (decode_syscall_subcall): Update comment.

	Complements: v4.26-27-g2c8b6de91 "mips o32: fix build"

2019-02-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add kill_child test.
	This tests repeatedly creates and kills children, so some corner
	cases in handling of not-quite-existing processes can be observed.

	Previously, strace was crashing in the following situation:

	    13994 ????( <unfinished ...>
	    ...
	    13994 <... ???? resumed>) = ?

	as tcp->s_ent wasn't initialised on syscall entering and
	strace.c:print_event_exit segfaulted when tried to access
	tcp->s_ent->sys_name.

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

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2019-02-11  Dmitry V. Levin  <ldv@altlinux.org>

	Wire up kexec_file_load syscall on architectures that use generic unistd.h
	* linux/32/syscallent.h [294]: Wire up kexec_file_load syscall
	introduced by linux commit v5.0-rc1~35^2~41^2~15.
	* linux/64/syscallent.h [294]: Likewise.
	* NEWS: Mention this.

	Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1676045

2019-02-11  Dmitry V. Levin  <ldv@altlinux.org>

	Wire up rseq syscall on architectures that use generic unistd.h.
	* linux/32/syscallent.h [293]: Wire up rseq syscall introduced by linux
	commit v4.19-rc1~109^2~47.
	* linux/64/syscallent.h [293]: Likewise.
	* NEWS: Mention this.

2019-02-11  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify preadv2-pwritev2 test against odd kernels.
	The test used to assume that either both preadv2 and pwritev2 syscalls
	are implemented or both are not implemented, but, apparently, there are
	kernels in the wild that implement just preadv2 syscall without
	pwritev2.

	* tests/preadv2-pwritev2.c (main): Skip the dumpio part of the test
	if either preadv2 or pwritev2 syscall is not implemented.

	Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1668750

2019-02-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ptrace_restart: do not print diagnostics when ptrace returns ESRCH.
	After some discussion, it was decided that the situation
	when the tracee is gone does not worth reporting.

	* strace.c (ptrace_restart): Return early if ptrace returned ESRCH.

	Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1662936

2019-02-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ptrace_restart: use xlat-based approach for printing ptrace requests.
	* defs.h (ptrace_cmds): New prototype.
	* strace.c (ptrace_op_str): New function.
	(ptrace_restart): Use it.

2019-02-10  Dmitry V. Levin  <ldv@altlinux.org>

	Fix whitespace issues.
	* Makefile.am (strace_SOURCES, EXTRA_DIST): Replace SPACE symbol followed
	by TAB symbol with TAB symbol.
	* kvm.c (is_map_for_file): Likewise.
	* tests/gen_tests.in (ioctl_ptp, printsignal-Xverbose): Likewise.
	* xlat/skf_ad.in: Likewise.

2019-02-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Make inline message on failed restart attempt more verbose.
	Hopefully, now it is less confusing.

	* strace.c (ptrace_restart): Provide intent and pid in the inline error
	message.

	References: https://bugzilla.redhat.com/show_bug.cgi?id=1662936

2019-02-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	syscall.c: set MEMORY_MAPPING_CHANGE in stub sysent.
	As unknown syscalls may incur unknown side effects.

	* syscall.c (stub_sysent): Set sys_flags to MEMORY_MAPPING_CHANGE.

2019-02-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Use accessors for tcp->s_ent, return a stub struct if it is NULL.
	Since code paths are non-trivial, it's an attempt to future-proof
	and prevent improper access of tcp->s_ent fields.

	* defs.h (struct tcb): Update the description of s_ent field.
	(stub_sysent): New declaration.
	(tcp_sysent, n_args): New macro functions.
	(indirect_ipccall): Use tcp_sysent() instead of tcp->s_ent.
	* ipc.c (SYS_FUNC(ipc)): Use n_args() instead of tcp->s_ent->nargs.
	* linux/alpha/get_syscall_args.c (get_syscall_args): Likewise.
	* linux/bfin/get_syscall_args.c (get_syscall_args): Likewise.
	* linux/hppa/get_syscall_args.c (get_syscall_args): Likewise.
	* linux/ia64/get_syscall_args.c (get_syscall_args): Likewise.
	* linux/microblaze/get_syscall_args.c (get_syscall_args): Likewise.
	* linux/mips/get_syscall_args.c (get_syscall_args): Likewise.
	* linux/sh/get_syscall_args.c (get_syscall_args): Likewise.
	* linux/sh64/get_syscall_args.c (get_syscall_args): Likewise.
	* linux/x86_64/get_syscall_args.c (get_syscall_args): Likewise.
	* linux/xtensa/get_syscall_args.c (get_syscall_args): Likewise.
	* prctl.c (print_prctl_args): Likewise.
	* signal.c (SYS_FUNC(sgetmask)): Likewise.
	* util.c (printargs, printargs_u, printargs_d): Likewise.
	* syscall.c (decode_ipc_subcall, decode_syscall_subcall: Likewise.
	(dumpio, tamper_with_syscall_exiting, syscall_entering_decode,
	syscall_entering_decode, syscall_entering_trace, syscall_entering_trace,
	syscall_exiting_decode, print_syscall_resume, syscall_exiting_trace,
	get_syscall_result): Use tcp_sysent() instead of tcp->s_ent.
	(stub_sysent): New stub sysent.
	(get_scno): Reset scno, s_ent, qual_flg; initialise s->ent from
	stub_sysent.
	* pathtrace.c (pathtrace_match_set): Use tcp_sysent() instead of
	tcp->s_ent.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2019-02-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	syscall.c: remove arch check for SEN_execv usage.
	SEN_* declarations are always present and can be used regardless
	of architecture.

	* syscall.c (syscall_entering_trace): Remove "#if defined SPARC ||
	defined SPARC64" guard.

2019-02-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Merge "<... resumed>" printing.
	Apparently, it was slightly different with no apparent reason.
	Use a single routine to print this message now.

	* defs.h (print_syscall_resume): New function declaration.
	* strace.c (print_event_exit): Replace open-coding of "<... resumed>"
	message printing with a print_syscall_resume() call.
	* syscall.c (syscall_exiting_trace): Likewise.
	(print_syscall_resume): New function.
	* tests/threads-execve.c: Update expected output.

2019-01-09  Shankara Pailoor  <shankarapailoor@gmail.com>

	sockaddr: print sin6_flowinfo field before sin6_addr.
	The sin6_flowinfo field comes before sin6_addr in the sockaddr_in6
	defintion, but for some reason we switch the order when decoding.
	This patch fixes the order of decoding.

	* sockaddr.c (print_sockaddr_data_in6): Print sin6_flowinfo field
	before sin6_addr.
	* NEWS: Mention this fix.
	* tests/group_req.c (main): Update expected output.
	* tests/net-sockaddr.c (check_in6_linklocal, check_in6): Likewise.
	* tests/net-yy-inet6.c (INADDR_STR, SA_FIELDS): Likewise.
	* tests/sockaddr_xlat.c (validate_in6): Likewise.

2019-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	mips o32: fix build.
	Commit 917c2ccf3a67 "Refactor stack pointers" moved mips_REG_* macros
	from linux/mips/arch_regs.h to linux/mips/arch_regs.c because these
	macros are no longer used outside syscall.c or files included by
	syscall.c, but this caused a build regression on mips o32 because
	decode_syscall_subcall() uses mips_REG_SP prior to its definition.

	* syscall.c (decode_syscall_subcall): Move ...
	* linux/mips/get_syscall_args.c: ... here.
	* NEWS: Mention this fix.

	Reported-by: Baruch Siach <baruch@tkos.co.il>
	Fixes: v4.26~61 "Refactor stack pointers"

2019-01-08  Baruch Siach  <baruch@tkos.co.il>

	Fix build for no-MMU targets.
	Commit 7488ce9e23f1 "Check whether PTRACE_GET_SYSCALL_INFO is supported
	by the kernel" added a fork() call in test_ptrace_get_syscall_info()
	which is included in the main strace executable code.  Although the
	test_ptrace_get_syscall_info() routine is not called on no-MMU targets,
	the compiler can't optimize it out because it is a global symbol.
	So build for no-MMU targets currently fails:

	strace-ptrace_syscall_info.o: In function `test_ptrace_get_syscall_info':
	ptrace_syscall_info.c:(.text+0x1c): undefined reference to `fork'

	* ptrace_syscall_info.c (test_ptrace_get_syscall_info): Make
	the definition depend on HAVE_FORK.
	* strace.c (init): Call test_ptrace_get_syscall_info unconditionally.
	* NEWS: Mention this fix.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
	Fixes: v4.26~50 "Check whether PTRACE_GET_SYSCALL_INFO is supported by the kernel"

2019-01-08  Baruch Siach  <baruch@tkos.co.il>

	linux/mips/.gitignore: drop copyright header.
	The '/*' in the first line of the copyright header matches all files in
	that directory.  No other .gitignore file has this header.  Drop it.

	* linux/mips/.gitignore: Remove copyright header.

	Fixes: v4.26~23 "Add copyright headers to some files that lack them"

2019-01-08  Shankara Pailoor  <shankarapailoor@gmail.com>

	Honor xlat styles when decoding sockaddr_in, sockaddr_in6, and sockaddr_ll
	* print_fields.h (PRINT_FIELD_NET_PORT): Handle xlat styles.
	* sockaddr.c (print_sll_protocol): New function.
	(print_sockaddr_data_ll, print_inet_addr, print_sockaddr_data_in6):
	Handle xlat styles.
	* NEWS: Mention this.
	* tests/sockaddr_xlat.c: New file.
	* tests/sockaddr_xlat-Xabbrev.c: Likewise.
	* tests/sockaddr_xlat-Xraw.c: Likewise.
	* tests/sockaddr_xlat-Xverbose.c: Likewise.
	* tests/Makefile.am (EXTRA_DIST): Add sockaddr_xlat.c.
	* tests/gen_tests.in (sockaddr_xlat-Xabbrev, sockaddr_xlat-Xraw,
	sockaddr_xlat-Xverbose): New tests.
	* tests/pure_executables.list: Add sockaddr_xlat-Xabbrev,
	sockaddr_xlat-Xraw, and sockaddr_xlat-Xverbose.
	* tests/.gitignore: Likewise.

2019-01-07  Dmitry V. Levin  <ldv@altlinux.org>

	Remove PRINT_FIELD_INET4_ADDR.
	Reduce code duplication by removing PRINT_FIELD_INET4_ADDR
	and using PRINT_FIELD_INET_ADDR instead.

	* print_fields.h (PRINT_FIELD_INET4_ADDR): Remove.
	* msghdr.c (print_cmsg_ip_pktinfo): Use PRINT_FIELD_INET_ADDR
	instead of PRINT_FIELD_INET4_ADDR.
	* net.c (print_mreq): Likewise.
	* sockaddr.c (print_sockaddr_data_in): Likewise.

2019-01-05  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: update REL_* constants.
	* xlat/evdev_relative_axes.in (REL_HWHEEL_HI_RES): New constant
	introduced by Linux kernel commit v5.0-rc1~18^2^7~7.
	* NEWS: Mention this.

	xlat: update UDP_* constants.
	* xlat/sock_udp_options.in (UDP_GRO): New constant introduced
	by Linux kernel commit v5.0-rc1~129^2~379^2~8.
	* NEWS: Mention this.

	xlat: update FAN_* constants.
	* xlat/fan_event_flags.in (FAN_OPEN_EXEC, FAN_OPEN_EXEC_PERM): New
	constants introduced by Linux kernel commits v5.0-rc1~124^2~5
	and v5.0-rc1~124^2~3, respectively.
	* NEWS: Mention this.
	* tests/fanotify_mark.c (main): Update expected output.

	xlat: update SCTP_* constants.
	* xlat/sock_sctp_options.in (SCTP_EVENT): New constant introduced
	by Linux kernel commit v5.0-rc1~129^2~255^2.
	* NEWS: Mention this.

	xlat: update IFLA_* constants.
	* xlat/rtnl_ifla_info_data_bridge_attrs.in (IFLA_BR_MULTI_BOOLOPT): New
	constant introduced by Linux kernel commit v5.0-rc1~129^2~207^2~2.
	* NEWS: Mention this.
	* tests/nlattr_ifla_linkinfo.c (main): Update.

	xlat: update NETNSA_* constants.
	* xlat/rtnl_nsid_attrs.in (NETNSA_TARGET_NSID, NETNSA_CURRENT_NSID): New
	constants introduced by Linux kernel commits v5.0-rc1~129^2~201^2~2
	and v5.0-rc1~129^2~201^2, respectively.
	* rtnl_nsid.c (rtgenmsg_nla_decoders): Add NETNSA_TARGET_NSID
	and NETNSA_CURRENT_NSID.
	* NEWS: Mention this.

	xlat: update SECCOMP_* constants.
	* xlat/seccomp_ops.in (SECCOMP_GET_NOTIF_SIZES): New constant introduced
	by Linux kernel commit v5.0-rc1~66^2~1^2~1.
	* xlat/seccomp_ret_action.in (SECCOMP_RET_USER_NOTIF): Likewise.
	* xlat/seccomp_filter_flags.in (SECCOMP_FILTER_FLAG_NEW_LISTENER):
	Likewise.
	* NEWS: Mention this.
	* tests/seccomp-filter.c (main): Update expected output.
	* tests/seccomp-filter-v.c (main): Likewise.
	* tests/seccomp_get_action_avail.c (main): Check SECCOMP_RET_USER_NOTIF.

	xlat: update NT_* constants.
	* xlat/nt_descriptor_types.in (NT_ARM_PAC_MASK, NT_MIPS_MSA): New
	constants introduced by Linux kernel commits v5.0-rc1~35^2~21
	and v5.0-rc1~30^2~58, respectively.
	* NEWS: Mention this.

	xlat: update PR_* constants.
	* xlat/prctl_options.in (PR_PAC_RESET_KEYS): New constant introduced
	by Linux kernel commit v5.0-rc1~35^2~19.
	* NEWS: Mention this.

	xlat: update V4L2_* constants.
	* xlat/v4l2_buf_types.in (V4L2_BUF_TYPE_META_OUTPUT): New constant
	introduced by Linux kernel commit v5.0-rc1~181^2~21.
	* xlat/v4l2_device_capabilities_flags.in (V4L2_CAP_META_OUTPUT):
	Likewise.
	* xlat/v4l2_pix_fmts.in (V4L2_PIX_FMT_CNF4): New constant introduced
	by Linux kernel commit v5.0-rc1~182^2~120.
	* NEWS: Mention this.

	xlat: update KVM_CAP_* constants.
	* xlat/kvm_cap.in (KVM_CAP_MANUAL_DIRTY_LOG_PROTECT,
	KVM_CAP_HYPERV_CPUID): New constants introduced by Linux kernel commits
	v5.0-rc1~156^2~115 and v5.0-rc1~156^2~74, respectively.
	* NEWS: Mention this.

	xlat: update NDA_* constants.
	* xlat/rtnl_neigh_attrs.in (NDA_PROTOCOL): New constant introduced
	by Linux kernel commit v5.0-rc1~129^2~79.
	* rtnl_neigh.c (ndmsg_nla_decoders): Add NDA_PROTOCOL.
	* NEWS: Mention this.

	xlat: update BTRFS_FEATURE_INCOMPAT_* constants.
	* xlat/btrfs_features_incompat.in
	(BTRFS_FEATURE_INCOMPAT_METADATA_UUID): New constant introduced by Linux
	kernel commit v5.0-rc1~126^2~64.
	* NEWS: Mention this.

	xlat: update *_MAGIC constants.
	* xlat/fsmagic.in (BINDERFS_SUPER_MAGIC): New constant introduced
	by Linux kernel commit v5.0-rc1~95^2~15.
	* NEWS: Mention this.

	xlat: update KERN_* constants.
	* xlat/sysctl_kern.in (KERN_PANIC_ON_WARN, KERN_PANIC_PRINT): New
	constants introduced by Linux kernel commits v3.19-rc1~135^2~91
	and v5.0-rc1~38^2~16, respectively.
	* configure.ac (AC_CHECK_DECLS): Add them.
	* NEWS: Mention this.

	xlat: update BPF_F_* constants.
	* xlat/bpf_map_flags.in (BPF_F_ZERO_SEED): New constant introduced
	by Linux kernel commit v5.0-rc1~129^2~114^2~18^2~3.
	* xlat/bpf_prog_flags.in (BPF_F_ANY_ALIGNMENT): New constant introduced
	by Linux kernel commit v5.0-rc1~129^2~209^2~17^2~3.
	* NEWS: Mention this.
	* tests/bpf.c (BPF_MAP_CREATE_checks, BPF_PROG_LOAD_checks,
	print_BPF_PROG_LOAD_attr3, print_BPF_PROG_LOAD_attr4): Update.

2019-01-05  Martin Lau  <kafai@fb.com>

	tests: fix prog_info initialization in bpf-obj_get_info_by_fd-prog*
	The sys_bpf(BPF_OBJ_GET_INFO_BY_FD, &bpf_prog_get_info_attr, ...) is
	called in a loop.  The bpf_prog_get_info_attr.info object is in size 104
	but bpf_prog_get_info_attr.info_len is in size 168.  Hence, if the prog
	is jited, the second iteration onwards will have nr_jited_ksyms == 1
	which is asking the kernel to fill the
	bpf_prog_get_info_attr.info.jited_ksyms and it is NULL.

	* tests/bpf-obj_get_info_by_fd.c (main): Clear memory beyond prog_info
	at the start of every iteration.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2019-01-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use tail_alloc instead of calloc in bpf-obj_get_info_by_fd-prog*
	This guarantees that map_info and prog_info objects are not accessed
	out of bounds.

	* tests/bpf-obj_get_info_by_fd.c: Include <string.h>.
	(main): Use tail_alloc instead of calloc for map_info and prog_info.

2019-01-02  Dmitry V. Levin  <ldv@altlinux.org>

	Bring lists back to the sorted order.
	* .gitignore: Make the list sorted again.
	* Makefile.am (strace_SOURCES): Likewise.
	* tests/.gitignore: Likewise.
	* tests/gen_tests.in: Likewise.
	* tests/Makefile.am (check_PROGRAMS, DECODER_TESTS, EXTRA_DIST):
	Likewise.

2019-01-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix strace-k.test on alpha.
	Change strace-k.test to use chdir syscall instead of getpid syscall
	because the latter is not universally available, e.g. there is no getpid
	syscall on alpha.

	* tests/stack-fcall-3.c (f3) <default>: Replace getpid with chdir.
	* tests/strace-k.test: Likewise.
	* tests/strace-k.expected: Likewise.
	* tests/strace-k-demangle.expected: Likewise.
	* NEWS: Mention this.

2018-12-30  Dmitry V. Levin  <ldv@altlinux.org>

	Fix preprocessor indentation.
	Indent the C preprocessor directives to reflect their nesting
	using the following script:

	$ cppi -l $(git grep -El '^[[:space:]]*#[[:space:]]*(if|ifdef|ifndef|elif|else|endif|define|pragma)[[:space:]]' |grep -v '\.sh$') |while read f; do
		cppi < "$f" > "$f".cppi; mv "$f".cppi "$f"
	done

2018-12-30  Dmitry V. Levin  <ldv@altlinux.org>

	Post-release administrivia.
	* NEWS: Add a header line for the next release.
	* debian/changelog.in: Add a changelog entry for 4.26-1.
	* strace.spec.in: Likewise.

2018-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for 4.26 release.
	* NEWS: Update for 4.26 release.

	strace.spec.in: add a comment about the license.

2018-12-26  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Update ioctl entries from linux v4.20.
	* linux/32/ioctls_inc_align16.h: Update from linux v4.20
	using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* linux/mips/ioctls_arch0.h: Likewise.
	* linux/powerpc/ioctls_arch0.h: Likewise.
	* linux/s390/ioctls_arch0.h: Likewise.
	* linux/s390x/ioctls_arch0.h: Likewise.
	* NEWS: Mention this.

	maint: update for linux 4.20.
	* maint/ioctls_sym.sh: Include linux/compiler_attributes.h in every
	processed file.
	Use asm/ioctls.h workaround for asm-generic/ioctls.h too.

2018-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: update BPF_* constants.
	* xlat/bpf_map_types.in (BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE): New
	constant introduced by Linux kernel commit v4.20-rc1~14^2~124^2~12^2~7.
	(BPF_MAP_TYPE_QUEUE, BPF_MAP_TYPE_STACK): New constants introduced
	by Linux kernel commit v4.20-rc1~151^2~32^2~11^2~3.
	* xlat/bpf_commands.in (BPF_MAP_LOOKUP_AND_DELETE_ELEM): New constant
	introduced by Linux kernel commit v4.20-rc1~151^2~32^2~11^2~2.
	* tests/bpf.c (BPF_MAP_CREATE_checks): Update.

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add PR_SPEC_INDIRECT_BRANCH to pr_spec_cmds.
	* xlat/pr_spec_cmds.in (PR_SPEC_INDIRECT_BRANCH): New constant,
	introduced by Linux commit v4.20-rc5~4^2~3.
	* prctl.c (SYS_FUNC(prctl)) <case PR_GET_SPECULATION_CTRL, case
	PR_SET_SPECULATION_CTRL>: Add PR_SPEC_INDIRECT_BRANCH handling.
	* tests/prctl-spec-inject.c (main): Add PR_SPEC_INDIRECT_BRANCH decoding
	checks, update expected output.
	* NEWS: Mention this.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update V4L2_CID_* and V4L2_PIX_FMT_* constants.
	* xlat/v4l2_control_ids.in (V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS,
	V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION): New constants, introduced
	by Linux commit v4.20-rc1~51^2~4.
	* xlat/v4l2_pix_fmts.in (V4L2_PIX_FMT_MPEG2_SLICE): Likewise.
	(V4L2_PIX_FMT_SUNXI_TILED_NV12): New constant, introduced by Linux
	commit v4.20-rc1~51^2~3.
	* NEWS: Mention this.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add ABS_RESERVED to evdev_abs.
	* xlat/evdev_abs.in (ABS_RESERVED): New constant, introduced by Linux
	commit v4.20-rc1~133^2~2^2.
	* NEWS: Mention this.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add REL_RESERVED and REL_WHEEL_HI_RES to evdev_relative_axes.
	* xlat/evdev_relative_axes.in (REL_RESERVED): New constant, introduced
	by Linux commit v4.20-rc1~133^2~2^2.
	(REL_WHEEL_HI_RES): New constant, introduced by Linux commit
	v4.20-rc1~133^2~2^2~6 and updated by Linux commit v4.20-rc1~133^2~2^2.
	* NEWS: Mention this.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update kvm_cap.
	* xlat/kvm_cap.in (KVM_CAP_NESTED_STATE): New constant, introduced
	by Linux commit v4.19-rc1~87^2~62.
	(KVM_CAP_ARM_INJECT_SERROR_ESR): New constant, introduced by Linux
	commit v4.19-rc1~55^2~12^2~14, merged with its final value
	in v4.19-rc1~55^2~12.
	(KVM_CAP_MSR_PLATFORM_INFO): New constant, introduced by Linux commit
	v4.19-rc5~8^2~2.
	(KVM_CAP_PPC_NESTED_HV): New constant, introduced by Linux commit
	v4.20-rc1~113^2~107^2~1.
	(KVM_CAP_HYPERV_SEND_IPI): New constant, introduced by Linux commit
	v4.20-rc1~113^2~72.
	KVM_CAP_COALESCED_PIO): New constant, introduced by Linux commit
	v4.20-rc1~113^2~31.
	(KVM_CAP_HYPERV_ENLIGHTENED_VMCS): New constant, introduced by Linux
	commit v4.20-rc1~113^2~25.
	(KVM_CAP_EXCEPTION_PAYLOAD): New constant, introduced by Linux commit
	v4.20-rc1~113^2~8.
	(KVM_CAP_ARM_VM_IPA_SIZE): New constant, introduced by Linux commit
	v4.20-rc1~113^2~5^2~8 and updated by Linux commit
	v4.20-rc1~113^2~5.
	* NEWS: Mention this.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add IFA_TARGET_NETNSID to rtnl_addr_attrs.
	* xlat/rtnl_addr_attrs.in (IFA_TARGET_NETNSID): New constant, introduced
	by Linux commit v4.20-rc1~14^2~428^2~7.
	* NEWS: Mention this.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update neighbor_cache_entry_flags.
	* xlat/neighbor_cache_entry_flags.in (NTF_OFFLOADED): New constant,
	introduced by Linux commit v4.13-rc1~157^2~252^2~13.
	(NTF_STICKY): New constant, introduced by Linux commit
	v4.20-rc1~14^2~392.
	(NTF_USE, NTF_SELF, NTF_MASTER, NTF_PROXY, NTF_EXT_LEARNED, NTF_ROUTER):
	Add fallback definitions.
	* NEWS: Mention this.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add flow dissector bpf program type constants.
	* xlat/bpf_attach_type.in (BPF_FLOW_DISSECTOR): New constant
	introduced by Linux commit v4.20-rc1~14^2~259^2~9^2~4.
	* xlat/bpf_prog_types.in (BPF_PROG_TYPE_FLOW_DISSECTOR): Likewise.
	* NEWS: Mention this.
	* tests/bpf.c (BPF_PROG_LOAD_checks, BPF_PROG_QUERY_checks): Update.
	* tests/kernel_version.c (print_bpf_attr): Update.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	rtnl_tc: add TCA_STATS_BASIC_HW.
	* xlat/rtnl_tca_stats_attrs.in (TCA_STATS_BASIC_HW): New constant,
	introduced by Linux commit v4.20-rc1~14^2~274^2~1.
	* rtnl_tc.c (tca_stats_nla_decoders): Add TCA_STATS_BASIC_HW.
	* NEWS: Mention this.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add NETLINK_DUMP_STRICT_CHK to sock_netlink_options.
	* xlat/sock_netlink_options.in (NETLINK_DUMP_STRICT_CHK): New constant,
	introduced by Linux commit v4.20-rc1~14^2~130^2~17.
	* NEWS: Mention this.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add IFLA_BR_VLAN_STATS_PER_PORT to rtnl_ifla_info_data_bridge_attrs
	* xlat/rtnl_ifla_info_data_bridge_attrs.in
	(IFLA_BR_VLAN_STATS_PER_PORT): New constant, introduced by Linux commit
	v4.20-rc1~14^2~90.
	* rtnl_link.c (ifla_info_data_bridge_nla_decoders): Add
	IFLA_BR_VLAN_STATS_PER_PORT.
	* NEWS: Mention this.
	* tests/nlattr_ifla_linkinfo.c (main): Check it.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add TCP_CLOSE to netlink_states.
	* xlat/netlink_states.in: Decode state 7 as TCP_CLOSE, since that's what
	net core sets socket's initial state to.

	xlat: add fallback definitions to setsock_ipv6_options.
	* xlat/setsock_ipv6_options.in: Add fallback definitions.

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add SOL_CAN_* to socketlayers.
	* xlat/socketlayers.in (SOL_CAN_BASE): New constant, introduced by Linux
	commit v2.6.25-rc1~1162^2~1414.
	(SOL_CAN_RAW): New constant, introduced by Linux commit
	v2.6.25-rc1~1162^2~1413.
	* NEWS: Mention this.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add FAN_ENABLE_AUDIT and FAN_REPORT_TID to fan_init_flags.
	* xlat/fan_init_flags.in (FAN_ENABLE_AUDIT): New constant, introduced
	by Linux commit v4.15-rc1~130^2^2~11.
	(FAN_REPORT_TID): New constant, introduced by Linux commit
	v4.20-rc1~75^2~2.
	* NEWS: Mention this.
	* tests/fanotify_init.c (main): Update expected output.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update siginfo_codes.
	* xlat/siginfo_codes.in (SI_LWP): Remove, as it is not present on Linux.
	(SI_NOINFO): Define only on SPARC, provide fallback value.

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	loop: use XLAT_MACROS_ONLY instead of #stop.
	As the former allows controlling presence of xlat definitions
	during the inclusion and not header generation.

	* xlat/loop_cmds.in: Remove #stop.
	* loop.c: Wrap "xlat/loop_cmds.h" inclusion in XLAT_MACROS_ONLY.
	* tests/ioctl_loop.c: Likewise.

2018-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	syslog: move constant definitions to xlat.
	* syslog.c (enum): Remove.
	* xlat/syslog_action_type.in: Add fallback definitions.

2018-12-24  Dmitry V. Levin  <ldv@altlinux.org>

	Add copyright headers to some files that lack them.
	We do our best to keep copyright headers up to date, yet
	git history provides better information on this subject
	and is more accurate than copyright headers.

	Update copyright headers.

	Update NEWS.

2018-12-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1.in: consistently use CTRL-combinations.

	strace.1.in: print names of entities in bold, provide man page sections.
	* strace.1.in (.SH DESCRIPTION, .SH OPTIONS): Add man page section
	numbers.  Make mentions of strace and other entities bold.

2018-12-24  Dmitry V. Levin  <ldv@altlinux.org>

	strace.1.in: document %net.
	* strace.1.in: Mention %net as a synonym to %network.

	Complements: v4.25-21-g97c3deca5 "basic_filters: add %net as a possible designation for network syscalls"

2018-12-24  Shankara Pailoor  <shankarapailoor@gmail.com>

	quotactl: add xlat styles support.
	* quota.c (print_qcmd): New function.
	(SYS_FUNC(quotactl)): Use it to print the quotactl command.
	* tests/quotactl.c (print_dqinfo, print_dqfmt): Handle XLAT_RAW
	and XLAT_VERBOSE.
	(QUOTA_STR, QUOTA_ID_STR, QUOTA_STR_INVALID): New macros.
	(gen_quotacmd, gen_quotaid): New functions.
	(main): Use them.
	* tests/quotactl-Xabbrev.c: New file.
	* tests/quotactl-Xraw.c: Likewise.
	* tests/quotactl-Xverbose.c: Likewise.
	* tests/gen_tests.in (quotactl-Xabbrev, quotactl-Xraw,
	quotactl-Xverbose): New tests.
	* tests/pure_executables.list: Add quotactl-Xabbrev, quotactl-Xraw,
	and quotactl-Xverbose.
	* tests/.gitignore: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-24  Dmitry V. Levin  <ldv@altlinux.org>

	xlat_idx: do not issue warnings for holes in indices.
	Some xlat indices like evdev_abs have holes, avoid issuing warnings
	about them.

	* xlat.c (xlat_idx): Do not issue warnings for holes in the index.

2018-12-23  Dmitry V. Levin  <ldv@altlinux.org>

	rtnl_link: fix off-by-one errors in indexed and sorted xlat lookups.
	* rtnl_link.c (decode_nla_tun_type, decode_ifla_xdp_attached,
	decode_ifla_inet_conf, decode_ifla_inet6_flags, decode_ifla_inet6_conf,
	decode_ifla_inet6_stats, decode_ifla_inet6_icmp6_stats,
	decode_ifla_inet6_agm): Decrement xlat size by one to account
	for XLAT_END as other users of indexed and sorted xlats do.

	Fixes: v4.25~71 "rtnl_link: decode named constants for IFLA_XDP_ATTACHED attribute value"
	Fixes: v4.23~41 "rtnl_link: decode IFLA_AF_SPEC"
	Fixes: v4.23~37 "rtnl_link: implement IFLA_INFO_DATA for tun devices"

2018-12-23  Dmitry V. Levin  <ldv@altlinux.org>

	net: fix off-by-one error in sorted xlat lookup.
	* net.c (ax25_protocols): Decrement xlat size by one to account
	for XLAT_END as other users of sorted xlats do.

	Fixes: v4.25~28 "net: add support for AX.25 protocols and socket option names decoding"

2018-12-23  Dmitry V. Levin  <ldv@altlinux.org>

	netlink_smc_diag: fix off-by-one error in xlat lookup.
	* netlink_smc_diag.c (decode_smc_diag_shutdown): Decrement xlat size
	by one to account for XLAT_END as other users of xlats do.

	Fixes: v4.25~54 "netlink_smc_diag: decode SMC_DIAG_SHUTDOWN attribute value"

2018-12-23  Dmitry V. Levin  <ldv@altlinux.org>

	aio: fix off-by-one error in indexed xlat lookup.
	* aio.c (tprint_lio_opcode): Decrement xlat size by one to account
	for XLAT_END as other users of indexed xlats do.

	Fixes: v4.24~71 "aio: print IOCB_CMD_* using xlat"

2018-12-23  Dmitry V. Levin  <ldv@altlinux.org>

	nlattr: fix off-by-one error in indexed xlat lookup.
	* nlattr.c (decode_nla_meminfo): Decrement xlat size by one
	to account for XLAT_END as other users of indexed xlats do.

	Fixes: v4.23~89 "nlattr: print index names in netlink meminfo array"

2018-12-23  Eugene Syromiatnikov  <esyr@redhat.com>

	evdev: fix off-by-one error in decode_bitset.
	* evdev.c (decode_bitset): Decrement sorted/indexed xlat's size by one
	in order to account for guarding XLAT_END, as other sorted/indexed xlat
	wrappers do.

	Fixes: v4.23~261 "evdev: support various types of xlats in decode_bitset"

2018-12-22  Dmitry V. Levin  <ldv@altlinux.org>

	strace: terminate itself if interrupted by a signal.
	* strace.c (terminate): Terminate itself if interrupted by a signal.
	* NEWS: Mention this change.
	* tests/detach-running.test: Check it.
	* tests/detach-sleeping.test: Likewise.
	* tests/detach-stopped.test: Likewise.

2018-12-17  Shankara Pailoor  <shankarapailoor@gmail.com>

	tests: check that printsignal handles xlat styles properly.
	* tests/printsignal.c: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	* tests/printsignal-Xabbrev.c: New file.
	* tests/printsignal-Xraw.c: Likewise.
	* tests/printsignal-Xverbose.c: Likewise.
	* tests/gen_tests.in (printsignal-Xabbrev, printsignal-Xraw,
	printsignal-Xverbose): New tests.
	* tests/pure_executables.list: Add printsignal-Xabbrev,
	* printsignal-Xraw, and printsignal-Xverbose.
	* tests/.gitignore: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	signal: return NULL if signal number has no string representation.
	Also return NULL if signal number is 0.

	* signal.c (signame): Return NULL if signal name has not been found.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-17  Dmitry V. Levin  <ldv@altlinux.org>

	filter_qualify: prepare for the change of signame semantics.
	* filter_qualify.c (sigstr_to_uint): Check signame return value.

2018-12-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Use sprintsigname for converting signal number to string.
	As signame is being converted to an xlookup-like function, a separate
	routine is needed in order to get string representation of signal.

	* defs.h (sprintsigname): New prototype.
	* signal.c (sprintsigname): New function.
	* strace.c (print_debug_info, print_signalled, print_stopped): Use it
	instead of signame.
	* wait.c (printstatus): Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Use printsignal instead of signame.
	As the former respects xlat styles while the latter doesn't.

	* clone.c (SYS_FUNC(clone)): Use printsignal for printing termination
	signal in printflags.
	* fcntl.c (print_fcntl) <case F_SETSIG>: Use printsignal.
	* prctl.c (SYS_FUNC(prctl)) <case PR_GET_PDEATHSIG,
	case PR_SET_PDEATHSIG>: Likewise.
	* print_sigevent.c (print_sigevent): Likewise.
	* s390.c (s390_runtime_instr): Likewise.
	* signal.c (SYS_FUNC(kill), SYS_FUNC(tgkill)): Likewise.

2018-12-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	signal: make printisgnal honor xlat style.
	* signal.c (printsignal): Respect current xlat style.

2018-12-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Always define WCOREDUMP.
	wait.c does it already, now strace.c also does.

	* wait.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* strace.c: Replace <sys/wait.h> with "wait.h".
	[!WCOREDUMP]: Remove.
	* wait.c: Replace <sys/wait.h> with "wait.h".
	[!WCOREFLAG] (WCOREFLAG), [!WCOREDUMP] (WCOREDUMP): Move to wait.h,
	rework.
	[!W_STOPCODE] (W_STOPCODE), [!W_EXITCODE] (W_EXITCODE),
	[!W_CONTINUED] (W_CONTINUED): Move to wait.h.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-17  Masatake YAMATO  <yamato@redhat.com>

	net: enhance decoding of getsockopt(SO_ERROR)
	* net.c (print_get_error): New function decoding error
	number returned as option value for SO_ERROR option.
	(print_getsockopt) <case SO_ERROR>: Call print_get_error.

	* tests/so_error.c: New test.
	* tests/gen_tests.in (so_error): Likewise.
	* tests/pure_executables.list: Add so_error.
	* tests/.gitignore: Likewise.

2018-12-17  Dmitry V. Levin  <ldv@altlinux.org>

	ia64: do not clobber r12 for raw syscalls.
	According to
	https://sourceware.org/ml/libc-alpha/2018-12/msg00470.html
	GCC mainline now gives errors for an asm that clobbers the stack
	pointer.

	According to
	https://gcc.gnu.org/ml/gcc-patches/2018-12/msg00932.html>
	GCC previously ignored such a clobber; thus, this patch removes it
	from the clobbers for ia64 raw syscalls.

	* linux/ia64/raw_syscall.h (raw_syscall_0): Remove "r12" from clobbers.

2018-12-17  Dmitry V. Levin  <ldv@altlinux.org>

	block: decode BLKGETZONESZ and BLKGETNRZONES ioctls.
	These ioctls were introduced by linux kernel commits v4.20-rc1~17^2~16
	and v4.20-rc1~17^2~15, respectively.

	* block.c (block_ioctl): Handle BLKGETZONESZ and BLKGETNRZONES.
	* xlat/block_ioctl_cmds.in (BLKGETZONESZ, BLKGETNRZONES): New entries.

2018-12-13  Dmitry V. Levin  <ldv@altlinux.org>

	Implement PTRACE_GET_SYSCALL_INFO decoder.
	* defs.h (audit_arch): New prototype.
	* process.c: Include "ptrace_syscall_info.h".
	(SYS_FUNC(ptrace)) <PTRACE_GET_SYSCALL_INFO>: Call
	print_ptrace_syscall_info on exiting syscall.
	* ptrace_syscall_info.h (print_ptrace_syscall_info): New prototype.
	* ptrace_syscall_info.c: Include "print_fields.h" and
	"xlat/ptrace_syscall_info_op.h".
	(print_ptrace_syscall_info): New function.
	* xlat/ptrace_syscall_info_op.in: New file.
	* tests/ptrace_syscall_info.c: New file.
	* tests/gen_tests.in (ptrace_syscall_info): New test.
	* tests/pure_executables.list: Add ptrace_syscall_info.
	* tests/.gitignore: Likewise.

2018-12-13  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce PTRACE_GET_SYSCALL_INFO support.
	When PTRACE_GET_SYSCALL_INFO API works,
	use it instead of traditional upeek/get_regs API.

	Tested on x86_64 and x86.

	* get_personality.c: New file.
	* get_personality.h: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* linux/aarch64/arch_get_personality.c: New file.
	* linux/powerpc64/arch_get_personality.c: Likewise.
	* linux/riscv/arch_get_personality.c: Likewise.
	* linux/s390x/arch_get_personality.c: Likewise.
	* linux/sparc64/arch_get_personality.c: Likewise.
	* linux/tile/arch_get_personality.c: Likewise.
	* linux/x32/arch_get_personality.c: Likewise.
	* linux/x86_64/arch_get_personality.c: Likewise.
	* linux/check_scno.c: Likewise.
	* linux/x32/check_scno.c: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.
	* linux/ia64/arch_getrval2.c (getrval2): Invoke get_regs()
	if ptrace_syscall_info is in use.
	* linux/mips/arch_getrval2.c: Likewise.
	* linux/sparc/arch_getrval2.c: Likewise.
	* defs.h (get_personality_from_syscall_info): New prototype.
	* syscall.c: Include "get_personality.h" and "ptrace_syscall_info.h".
	(get_regs_error): Define unconditionally.
	(ptrace_sci): New static variable.
	(clear_regs): Reset ptrace_sci.op.
	(ptrace_syscall_info_is_valid, ptrace_get_syscall_info,
	get_syscall_regs): New functions.
	(get_syscall_result_regs): Change to get_syscall_regs.
	(get_instruction_pointer, get_stack_pointer, get_scno, get_syscall_args,
	get_error, set_error, set_success): Add ptrace_syscall_info support.
	* tests/int_0x80.test: New test.
	* tests/Makefile.am (DECODER_TESTS): Add int_0x80.test.
	(XFAIL_TESTS_x86_64, XFAIL_TESTS_x32): Remove.
	* tests/gen_tests.in (int_0x80): Remove.

2018-12-13  Dmitry V. Levin  <ldv@altlinux.org>

	Check whether PTRACE_GET_SYSCALL_INFO is supported by the kernel.
	The result of this check is going to be used by subsequent commits.

	* ptrace_syscall_info.c: New file.
	* ptrace_syscall_info.h: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* strace.c: Include "ptrace_syscall_info.h".
	(init): Call test_ptrace_get_syscall_info.

2018-12-13  Dmitry V. Levin  <ldv@altlinux.org>

	Add definitions for PTRACE_GET_SYSCALL_INFO API.
	Provide fallback definitions for PTRACE_GET_SYSCALL_INFO API.
	Add very basic PTRACE_GET_SYSCALL_INFO support in the parser
	of ptrace syscall.

	* ptrace.h: Include <stdint.h>.
	[!PTRACE_GET_SYSCALL_INFO] (PTRACE_GET_SYSCALL_INFO,
	PTRACE_SYSCALL_INFO_NONE, PTRACE_SYSCALL_INFO_ENTRY,
	PTRACE_SYSCALL_INFO_EXIT, PTRACE_SYSCALL_INFO_SECCOMP,
	struct ptrace_syscall_info): Define.
	* xlat/ptrace_cmds.in: Add PTRACE_GET_SYSCALL_INFO.
	* process.c (SYS_FUNC(ptrace)): Handle it.

2018-12-10  Dmitry V. Levin  <ldv@altlinux.org>

	Change the license of strace to LGPL-2.1-or-later.
	strace is now provided under the terms of the GNU Lesser General
	Public License version 2.1 or later, see COPYING for more details.

	strace test suite is now provided under the terms of the GNU General
	Public License version 2 or later, see tests/COPYING for more details.

2018-12-10  Dmitry V. Levin  <ldv@altlinux.org>

	tests: change the license to GPL-2.0-or-later.
	strace test suite is now provided under the terms of the GNU General
	Public License version 2 or later, see tests/COPYING for more details.

2018-12-10  Shankara Pailoor  <shankarapailoor@gmail.com>

	bpf: honor xlat styles when printing kernel version.
	* print_kernel_version.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (print_kernel_version): New prototype.
	* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)):
	Use print_kernel_version.
	* tests/kernel_version.c: New file.
	* tests/kernel_version-Xabbrev.c: Likewise.
	* tests/kernel_version-Xraw.c: Likewise.
	* tests/kernel_version-Xverbose.c: Likewise.
	* tests/gen_tests.in (kernel_version, kernel_version-Xabbrev,
	kernel_version-Xraw, kernel_version-Xverbose): New tests.
	* tests/pure_executables.list: Add kernel_version,
	kernel_version-Xabbrev, kernel_version-Xraw, and kernel_version-Xverbose.
	* tests/.gitignore: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-10  Shankara Pailoor  <shankarapailoor@gmail.com>

	print_dev_t: add xlat styles support.
	* print_dev_t.c (print_dev_t): Respect xlat_verbosity.
	* tests/btrfs.c (sprint_makedev): New function.
	(btrfs_print_balance_args, btrfs_test_dev_info_ioctl,
	btrfs_test_dev_replace_ioctl, btrfs_test_get_dev_stats_ioctl,
	btrfs_test_scrub_ioctls): Use it to update expected output.
	* tests/xstatx.c (print_st_mode, sprint_makedev): New functions.
	(print_stat): Use them.
	* tests/fstat-Xabbrev.c: New file.
	* tests/fstat-Xraw.c: Likewise.
	* tests/fstat-Xverbose.c: Likewise.
	* tests/fstat64-Xabbrev.c: Likewise.
	* tests/fstat64-Xraw.c: Likewise.
	* tests/fstat64-Xverbose.c: Likewise.
	* tests/gen_tests.in (fstat-Xabbrev, fstat-Xraw, fstat-Xverbose,
	fstat64-Xabbrev, fstat64-Xraw, fstat64-Xverbose): New entries.
	* tests/trace_fstat.in: Likewise.
	* tests/trace_stat_like.in: Likewise.
	* tests/pure_executables.list: Add fstat-Xabbrev, fstat-Xraw,
	fstat-Xverbose, fstat64-Xabbrev, fstat64-Xraw, and fstat64-Xverbose.
	* tests/.gitignore: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	i386, x32: use upoke() instead of set_regs()
	This brings i386 and x32 in line with x86_64
	and removes redundant HAVE_GETREGS_OLD checks.
	Besides that, use of PTRACE_GET_SYSCALL_INFO would require
	an extra get_regs() invocation before set_regs().

	* syscall.c (ARCH_MIGHT_USE_SET_REGS): Define to 1.
	[HAVE_GETREGS_OLD] (ARCH_MIGHT_USE_SET_REGS): Redefine to 0.
	(ptrace_setregset_or_setregs): Check ARCH_MIGHT_USE_SET_REGS instead
	of HAVE_GETREGS_OLD.
	* linux/i386/arch_regs.c (ARCH_MIGHT_USE_SET_REGS): Redefine to 0.
	* linux/powerpc/arch_regs.c: Likewise.
	* linux/x86_64/arch_regs.c: Likewise.
	* linux/i386/set_error.c (arch_set_error, arch_set_success)
	[!HAVE_GETREGS_OLD]: Remove.
	* linux/i386/set_scno.c (arch_set_scno) [!HAVE_GETREGS_OLD]: Remove.
	* linux/powerpc/set_error.c (arch_set_error, arch_set_success)
	[!HAVE_GETREGS_OLD]: Remove.
	* linux/powerpc/set_scno.c (arch_set_scno) [!HAVE_GETREGS_OLD]: Remove.
	* linux/x86_64/set_error.c [!HAVE_GETREGS_OLD]: Remove.
	* linux/x86_64/set_scno.c: Likewise.

2018-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	upoke: workaround crippled x32.
	As PTRACE_POKEUSER is crippled on x32 by design from the very first
	linux kernel commit v3.4-rc1~33^2~2 when it was introduced,
	workaround this by using the raw x86_64 syscall instead.

	* linux/ptrace_pokeuser.c: New file.
	* linux/x32/ptrace_pokeuser.c: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.
	* upoke.c: Include "ptrace_pokeuser.c".
	(upoke): Use ptrace_pokeuser instead of ptrace.

2018-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	x86_64: remove some annoying pieces of unused code.
	* linux/x86_64/get_scno.c (X32_PERSONALITY_NUMBER): Remove.
	(arch_get_scno): Remove ifdefed archeological artefacts.

2018-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	Refactor tamper_with_syscall_exiting()
	Move the code than deals with updating the return and error values
	to separate functions.

	* syscall.c (set_error, set_success): New functions.
	(tamper_with_syscall_exiting): Use them.

2018-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	Refactor get_syscall_args() and get_error()
	* linux/*/get_error.c: Rename all arch-specific implementations
	of get_error() to arch_get_error().
	* linux/*/get_syscall_args.c: Rename all arch-specific implementations
	of get_syscall_args() to arch_get_syscall_args().
	* syscall.c (get_syscall_args, get_error): New functions.
	(tamper_with_syscall_exiting, get_syscall_result): Do not clear
	tcp->u_error before get_error() invocation as the latter does it now.

2018-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	Refactor stack pointers.
	Change all linux/*/arch_regs.c to provide either ARCH_SP_REG
	or ARCH_SP_PEEK_ADDR.  Introduce get_stack_pointer(), rewrite
	all code accessing stack pointers to use get_stack_pointer().
	On some architectures stack pointers were referred to as frame pointers,
	clean up this confusion.

	* defs.h (get_stack_pointer): New prototype.
	* syscall.c (get_stack_pointer): New function.
	* linux/arch_rt_sigframe.c: New file.
	* linux/aarch64/arch_regs.c (aarch64_sp_ptr, arm_sp_ptr): Remove.
	(ARCH_SP_REG): New macro.
	* linux/alpha/arch_regs.c: Import linux/alpha/arch_regs.h.
	(REG_FP): Rename to REG_SP.
	(ARCH_SP_PEEK_ADDR): New macro.
	* linux/alpha/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
	* linux/arc/arch_regs.c (arc_sp_ptr): Remove.
	(ARCH_SP_REG): New macro.
	* linux/arm/arch_regs.c (arm_sp_ptr): Remove.
	(ARCH_SP_REG): New macro.
	* linux/arm/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
	* linux/avr32/arch_regs.c (avr32_sp_ptr): Remove.
	(ARCH_SP_REG): New macro.
	* linux/bfin/arch_regs.c (ARCH_SP_PEEK_ADDR): New macro.
	* linux/hppa/arch_regs.c: Import linux/hppa/arch_regs.h.
	(PT_GR30, ARCH_SP_PEEK_ADDR): New macros.
	* linux/hppa/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
	get_stack_pointer.
	* linux/i386/arch_regs.c (i386_esp_ptr): Remove.
	(ARCH_SP_REG): New macro.
	* linux/i386/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
	get_stack_pointer.
	* linux/i386/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/ia64/arch_regs.c (ia64_frame_ptr): Remove.
	(ARCH_SP_REG): New macro.
	* linux/ia64/arch_regs.h (ia64_frame_ptr): Remove.
	* linux/ia64/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
	get_stack_pointer.
	* linux/m68k/arch_regs.c (m68k_usp_ptr): Remove.
	(ARCH_SP_REG): New macro.
	* linux/m68k/arch_rt_sigframe.c: Link to i386/arch_rt_sigframe.c.
	* linux/m68k/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
	* linux/metag/arch_regs.c (metag_sp_ptr): Remove.
	(ARCH_SP_REG): New macro.
	* linux/metag/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
	get_stack_pointer.
	* linux/microblaze/arch_regs.c (ARCH_SP_PEEK_ADDR): New macro.
	* linux/mips/arch_regs.c: Import linux/mips/arch_regs.h.
	(mips_regs): Add static qualifier.
	(ARCH_SP_REG): New macro.
	* linux/mips/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
	* linux/nios2/arch_regs.c (nios2_sp_ptr): Remove.
	(ARCH_SP_REG): New macro.
	* linux/or1k/arch_regs.c (or1k_sp_ptr): Remove.
	(ARCH_SP_REG): New macro.
	* linux/powerpc/arch_regs.c (ppc_regs): Add static qualifier.
	(ARCH_SP_REG): New macro.
	* linux/powerpc/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
	get_stack_pointer.
	* linux/powerpc/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
	* linux/powerpc64/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
	get_stack_pointer.
	* linux/riscv/arch_regs.c (riscv_sp_ptr): Remove.
	(ARCH_SP_REG): New macro.
	* linux/s390/arch_regs.c (s390_frame_ptr): Remove.
	(ARCH_SP_REG): New macro.
	* linux/s390/arch_sigreturn.c (S390_FRAME_PTR): Remove.
	(arch_sigreturn): Use get_stack_pointer.
	* linux/s390x/arch_regs.c (s390_frame_ptr, s390x_frame_ptr): Remove.
	(ARCH_SP_REG): New macro.
	* linux/s390x/arch_sigreturn.c (S390_FRAME_PTR): Remove.
	* linux/sh/arch_regs.c (ARCH_SP_PEEK_ADDR): New macro.
	* linux/sh64/arch_regs.c: Likewise.
	* linux/sparc/arch_regs.c: Import linux/sparc/arch_regs.h.
	(sparc_regs): Add static qualifier.
	(ARCH_SP_REG): New macro.
	* linux/sparc/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
	* linux/sparc64/arch_rt_sigframe.c (FUNC_GET_RT_SIGFRAME_ADDR): Use
	get_stack_pointer.
	* linux/tile/arch_regs.c (tile_regs): Add static qualifier.
	(ARCH_SP_REG): New macro.
	* linux/tile/arch_sigreturn.c (arch_sigreturn): Use get_stack_pointer.
	* linux/x86_64/arch_regs.c (i386_esp_ptr, x86_64_rsp_ptr): Remove.
	(ARCH_SP_REG): New macro.
	* linux/x86_64/arch_regs.h (i386_esp_ptr, x86_64_rsp_ptr): Remove.
	* linux/x86_64/arch_rt_sigframe.c: Link to i386/arch_rt_sigframe.c.
	* linux/xtensa/arch_regs.c (ARCH_SP_PEEK_ADDR): New macro.
	* linux/aarch64/arch_regs.h: Remove.
	* linux/aarch64/arch_rt_sigframe.c: Remove.
	* linux/alpha/arch_regs.h: Remove.
	* linux/alpha/arch_rt_sigframe.c: Remove.
	* linux/arc/arch_regs.h: Remove.
	* linux/arc/arch_rt_sigframe.c: Remove.
	* linux/arm/arch_regs.h: Remove.
	* linux/arm/arch_rt_sigframe.c: Remove.
	* linux/avr32/arch_regs.h: Remove.
	* linux/avr32/arch_rt_sigframe.c: Remove.
	* linux/bfin/arch_rt_sigframe.c: Remove.
	* linux/hppa/arch_regs.h: Remove.
	* linux/i386/arch_regs.h: Remove.
	* linux/m68k/arch_regs.h: Remove.
	* linux/metag/arch_regs.h: Remove.
	* linux/microblaze/arch_rt_sigframe.c: Remove.
	* linux/mips/arch_regs.h: Remove.
	* linux/mips/arch_rt_sigframe.c: Remove.
	* linux/nios2/arch_regs.h: Remove.
	* linux/nios2/arch_rt_sigframe.c: Remove.
	* linux/or1k/arch_regs.h: Remove.
	* linux/or1k/arch_rt_sigframe.c: Remove.
	* linux/powerpc/arch_regs.h: Remove.
	* linux/powerpc64/arch_regs.h: Remove.
	* linux/riscv/arch_regs.h: Remove.
	* linux/riscv/arch_rt_sigframe.c: Remove.
	* linux/s390/arch_regs.h: Remove.
	* linux/s390/arch_rt_sigframe.c: Remove.
	* linux/s390x/arch_regs.h: Remove.
	* linux/s390x/arch_rt_sigframe.c: Remove.
	* linux/sh/arch_rt_sigframe.c: Remove.
	* linux/sh64/arch_rt_sigframe.c: Remove.
	* linux/sparc/arch_regs.h: Remove.
	* linux/sparc/arch_rt_sigframe.c: Remove.
	* linux/sparc64/arch_regs.h: Remove.
	* linux/tile/arch_regs.h: Remove.
	* linux/tile/arch_rt_sigframe.c: Remove.
	* linux/xtensa/arch_rt_sigframe.c: Remove.
	* Makefile.am (EXTRA_DIST): Remove them, add linux/arch_rt_sigframe.c.

2018-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	Refactor print_pc()
	Split print_pc() into arch-independent print_instruction_pointer()
	and arch-specific get_instruction_pointer().

	* print_instruction_pointer.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (print_pc): Remove.
	(get_instruction_pointer, print_instruction_pointer): New prototypes.
	* syscall.c (print_pc): Remove.
	(get_instruction_pointer): New function.
	* strace.c (printleader): Replace print_pc with
	print_instruction_pointer.

2018-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	ppc64: remove redundant redefinition.
	* linux/powerpc64/arch_regs.c (ARCH_PC_REG): Remove.

2018-12-05  Shankara Pailoor  <shankarapailoor@gmail.com>

	print_dev_t: print major and minor numbers in hex like stat(1)
	* print_dev_t.c (print_dev_t): Print major and minor numbers in hex.
	* strace.1.in: Update makedev example.
	* tests/bpf-obj_get_info_by_fd.c (main): Update expected output.
	* tests/btrfs.c (btrfs_print_balance_args, btrfs_test_scrub_ioctls,
	btrfs_test_dev_info_ioctl, btrfs_test_get_dev_stats_ioctl,
	btrfs_test_dev_replace_ioctl): Update expected output.
	* tests/ioctl_dm.c (main): Likewise.
	* tests/ioctl_loop.c (print_loop_info, print_loop_info64): Likewise.
	* tests/mknod.c (main): Likewise.
	* tests/mknodat.c (main): Likewise.
	* tests/nlattr_unix_diag_msg.c (main): Likewise.
	* tests/ustat.c (main): Likewise.
	* tests/xstatx.c (print_stat): Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-12-05  Janosch Frank  <frankja@linux.ibm.com>

	s390x: beautify sthyi data tail prints.
	The test already expects a ", " before the print of struct
	padding. Let's add it to s390.c to make the output look a bit nicer and
	fix test runs on z/VM that have padding at the end of the STHYI structs.

	* s390.c (decode_ebcdic): Add missing comma.

2018-11-27  Dmitry V. Levin  <ldv@altlinux.org>

	Stop using SIG_0.
	Number 0 is not a valid signal number, and SIG_0 is not a valid
	description for a signal.

	* linux/signalent.h: Replace SIG_0 with 0.
	* linux/alpha/signalent.h: Likewise.
	* linux/hppa/signalent.h: Likewise.
	* linux/mips/signalent.h: Likewise.
	* linux/sparc/signalent.h: Likewise.
	* filter_qualify.c (sigstr_to_uint): Start iterations with number 1.
	* tests/fcntl-common.c (test_fcntl_others): Update expected output.
	* tests/kill.c (main): Likewise.
	* tests/ptrace.c (test_peeksiginfo): Likewise.
	* tests/s390_runtime_instr.c (main): Likewise.

2018-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	mem: fix build on architectures where kernel_ulong_t is bigger than long
	* mem.c (print_mmap_flags): Fix format string.

	Fixes: v4.25-26-g0933b3086 "mem: add xlat styles support to print_mmap_flags"

2018-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add remap_file_pages test variants with different xlat verbosity levels
	* tests/remap_file_pages-Xabbrev.c: New file.
	* tests/remap_file_pages-Xraw.c: Likewise.
	* tests/remap_file_pages-Xverbose.c: Likewise.
	* tests/remap_file_pages.c: Add handling of XLAT_RAW and XLAT_VERBOSE flags.
	* tests/pure_executables.list: Add remap_file_pages-Xabbrev,
	remap_file_pages-Xraw, and remap_file_pages-Xverbose.
	* tests/.gitignore: Likewise.
	* tests/gen_tests.in (remap_file_pages-Xabbrev, remap_file_pages-Xraw,
	remap_file_pages-Xverbose): New tests.

2018-11-26  Shankara Pailoor  <shankarapailoor@gmail.com>

	mem: add xlat styles support to print_mmap_flags.
	* mem.c (print_mmap_flags): Respect xlat_verbosity.
	* tests/mmap.c (main): Update expected output.
	* tests/old_mmap.c (main): Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add memfd_create test variants with different xlat verbosity levels
	* tests/memfd_create-Xabbrev.c: New file.
	* tests/memfd_create-Xraw.c: Likewise.
	* tests/memfd_create-Xverbose.c: Likewise.
	* tests/memfd_create.c: Add handling of XLAT_RAW and XLAT_VERBOSE flags.
	* tests/pure_executables.list: Add memfd_create-Xabbrev, memfd_create-Xraw,
	and memfd_create-Xverbose.
	* tests/.gitignore: Likewise.
	* tests/gen_tests.in (memfd_create-Xabbrev, memfd_create-Xraw,
	memfd_create-Xverbose): New tests.

2018-11-26  Shankara Pailoor  <shankarapailoor@gmail.com>

	memfd_create: add xlat styles support.
	* memfd_create.c (SYS_FUNC(memfd_create)): Respect xlat_verbosity.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-11-24  Dmitry V. Levin  <ldv@altlinux.org>

	Enhance error diagnostics when the first exec fails.
	When the first exec fails, strace used to print the trace of the child
	process till its end, producing a lot of confusing output.
	Enhance the diagnostics by hiding irrelevant parts of the trace.

	* defs.h (TCB_CHECK_EXEC_SYSCALL): New macro.  Change values of TCB_*
	macros listed after TCB_CHECK_EXEC_SYSCALL.
	(check_exec_syscall): New macro.
	* strace.c (dispatch_event) <TE_STOP_BEFORE_EXECVE>: Clear
	TCB_CHECK_EXEC_SYSCALL flag.
	* syscall.c (syscall_entering_trace): Do not clear TCB_HIDE_LOG when
	TCB_CHECK_EXEC_SYSCALL is set, set TCB_CHECK_EXEC_SYSCALL along with
	clearing TCB_HIDE_LOG.
	(syscall_exiting_decode): Set TCB_HIDE_LOG if TCB_CHECK_EXEC_SYSCALL
	is set.
	* tests/first_exec_failure.test: New file.
	* tests/Makefile.am (MISC_TESTS): Add first_exec_failure.test.

	Closes: https://github.com/strace/strace/issues/88

2018-11-24  Dmitry V. Levin  <ldv@altlinux.org>

	build: use more traditional git options.
	The support of --no-patch alias to -s option in "git diff" and related
	git commands was added in git v1.8.4.

	* copyright-year-gen: Use "git show -s" instead of "git show --no-patch".
	* file-date-gen: Use "git log -s" instead of "git log --no-patch".

	Closes: https://github.com/strace/strace/issues/80

2018-11-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	basic_filters: add %net as a possible designation for network syscalls.
	* basic_filters.c (lookup_class) <syscall_class>: Add %net as an alias
	for TRACE_NETWORK.

2018-11-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	hppa: add a comment about old name of syscall number 102.
	Also, remove empty definition.

	* linux/hppa/syscallent.h ([102]): Remove empty definition,
	add a comment that it was socketcall.

2018-11-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	mips: update syscall entry for reserved221 syscall.
	The syscall number 4221 is actually called "reserved221" on mips.

	* linux/mips/syscallent-o32.h ([4221]): Set to "reserved221".

2018-11-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	arm: add a comment that __ARM_NR_cmpxchg was removed in 4.4.
	* linux/arm/syscallent.h: Add a comment about __ARM_NR_cmpxchg.

	arm: replace empty syscall entry definitions with comments.
	* linux/arm/syscallent.h ([222]): Remove definition, add a comment
	that it was tux syscall.
	([223]): Remove definition, add comment that it was unused.
	([254]): Remove definition, add comment that it was reserved
	for set_thread_area.
	([255]): Remove definition, add comment that it was reserved
	for get_thread_area.

	linux/dummy.h: remove unused sys_phys definition.
	* linux/dummy.h (sys_phys): Remove.

	numa: use already existing array item printing function.
	* numa.c (print_int): Remove.
	(SYS_FUNC(move_pages)): Use print_int32_array_member instead of
	print_int.

	net: use already existing array item printing function.
	* net.c (print_uint32): Remove.
	(print_getsockopt): Use print_uint32_array_member instead of
	print_uint32.

2018-11-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Remove HAVE_LINUX_GENETLINK_H ifdefs.
	<linux/netlink.h> is available since Linux 2.6.15 (commit
	v2.6.15-rc1~53^2).

	* configure.ac (AC_CHECK_HEADERS): Remove linux/genetlink.h.
	* socketutils.c [!HAVE_LINUX_GENETLINK_H]: Remove.
	* tests/netlink_generic.c [!HAVE_LINUX_GENETLINK_H]: Likewise.

2018-11-21  Dmitry V. Levin  <ldv@altlinux.org>

	Document -X option in strace -h output.
	* strace.c (usage): Mention -X option.

	Reported-by: Dmitry Vyukov <dvyukov@google.com>
	Complements: v4.23~308 "Add user interface for configuring xlat output style"

2018-11-21  Dmitry V. Levin  <ldv@altlinux.org>

	Move kill_save_errno to a separate header file.
	This function is going to be used outside strace.c,
	so make it globally available and move it to a separate header file.

	* strace.c (kill_save_errno): Add "inline" keyword, change return type
	from "void" to "int", move the function ...
	* kill_save_errno.h: ... to this new file.
	* Makefile.am (strace_SOURCES): Add it.

2018-11-20  Dmitry V. Levin  <ldv@altlinux.org>

	syscall_entering_trace: set TCB_FILTERED along with TCB_HIDE_LOG.
	This allows to remove some of hide_log() checks that became redundant.

	* syscall.c (syscall_entering_trace): Set TCB_FILTERED along with
	TCB_HIDE_LOG, remove now redundant hide_log(tcp) check.
	(syscall_exiting_decode): Replace "filtered(tcp) || hide_log(tcp)"
	with "filtered(tcp)".

2018-11-20  Dmitry V. Levin  <ldv@altlinux.org>

	syscall_entering_trace: optimize clearing of TCB_HIDE_LOG flag.
	* syscall.c (syscall_entering_trace): Since we check for TCB_HIDE_LOG
	flag anyway, do not clean it unless it is set.

2018-11-12  Dmitry V. Levin  <ldv@altlinux.org>

	print_inet_addr: print nameless and named addresses using the same style
	* sockaddr.c (print_inet_addr): Handle var_name == NULL case in a more
	structured way: use inet_addr("%s") form to print AF_INET addresses
	in structureless contexts where no structure field name is available.
	Likewise, use inet_pton(AF_INET6, "%s") that case.
	* tests/nlattr_ifaddrmsg.c (main): Update expected output.
	* tests/nlattr_ifla_af_spec.c (main): Likewise.

	Complements: v4.19~76 "print_inet_addr: add support of invocations without field name"

2018-11-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: extend test coverage of RND* ioctl commands.
	* tests/ioctl_random.c (main): Check the error path of RNDADDENTROPY
	parser.  Check decoding of unrecognized RND* ioctl commands.

2018-11-05  Rasmus Villemoes  <rasmus.villemoes@prevas.dk>

	Add support for /dev/[u]random ioctls.
	* random_ioctl.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (DECL_IOCTL): Add random.
	* ioctl.c (ioctl_decode): Add 'R' case.
	* xlat/random_ioctl_cmds.in: New file.
	* tests/ioctl_random.c: New file.
	* tests/.gitignore: Add ioctl_random.
	* tests/pure_executables.list: Likewise.
	* tests/gen_tests.in (ioctl_random): New entry.

2018-11-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add dist/INSTALL.
	* dist/INSTALL: New file.
	* bootstrap: Copy it.
	* .gitignore: Add /INSTALL.

	References: https://github.com/strace/strace/issues/17
	References: https://github.com/strace/strace/issues/55
	Closes: https://github.com/strace/strace/issues/67

2018-11-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Rename INSTALL to README-configure.
	* INSTALL-git.md: Replace INSTALL with README-configure.
	* maint/install.texi: Likewise.
	* INSTALL: Rename to README-configure, regenerate.
	* Makefile.am (EXTRA_DIST): Add README-configure.

	References: https://github.com/strace/strace/issues/85
	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-11-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	dist/README: add more references.
	* dist/README: Mention README-hacking, add links to repositories
	and the mailing list archive.

	Suggested-by: Jamal Hadi Salim <jhs@mojatatu.com>
	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-11-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	README.md: add a link to the new contributors guide.
	* README.md: Add a link to the Guide of new contributors.

	Suggested-by: Jamal Hadi Salim <jhs@mojatatu.com>

2018-10-30  Dmitry V. Levin  <ldv@altlinux.org>

	Post-release administrivia.
	* NEWS: Add a header line for the next release.
	* debian/changelog.in: Add a changelog entry for 4.25-1.
	* strace.spec.in: Likewise.

	Prepare for 4.25 release.
	* NEWS: Update for 4.25 release.

	Update copyright headers.
	Headers updated automatically using maint/update_copyright_years.sh
	script.

2018-10-25  Dmitry V. Levin  <ldv@altlinux.org>

	Update NEWS.

2018-10-25  Elvira Khabirova  <lineprinter@altlinux.org>

	Implement decoding of NBD_* ioctl commands.
	* nbd_ioctl.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (DECL_IOCTL): Add nbd.
	* ioctl.c (ioctl_decode): Add 0xab (nbd) case.
	* xlat/nbd_ioctl_cmds.in: Likewise.
	* xlat/nbd_ioctl_flags.in: Likewise.
	* tests/ioctl_nbd.c: Likewise.
	* tests/.gitignore: Add ioctl_nbd.
	* tests/pure_executables.list: Likewise.
	* tests/gen_tests.in (ioctl_nbd): New entry.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-10-25  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix build with recent kernel headers.
	Linux commit v4.19-rc2-5-g2ecefa0a15fd0ef88b9cd5d15ceb813008136431
	changed the definition of struct keyctl_dh_params in an incompatible
	way again.  Workaround this issue by using designated initializers.

	* tests/keyctl.c (main): Use designated initializers for
	struct keyctl_dh_params.

2018-10-24  Dmitry V. Levin  <ldv@altlinux.org>

	arm, sparc, sparc64: wire up io_pgetevents.
	* linux/arm/syscallent.h ([399]): Wire up io_pgetevents syscall
	introduced by Linux commit v4.19-rc7~24^2~1.
	(ARM_FIRST_SHUFFLED_SYSCALL, SYS_socket_subcall): Raise from 400 to 500,
	to make room for new syscalls.
	* linux/sparc/syscallent.h ([361]): Wire up io_pgetevents syscall
	introduced by Linux commit v4.19~31^2~5.
	* linux/sparc64/syscallent.h: Likewise.

2018-10-24  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Update ioctl entries from linux v4.19.
	* linux/32/ioctls_inc_align16.h: Update from linux v4.19-rc8
	using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* linux/i386/ioctls_arch0.h: Likewise.
	* linux/x86_64/ioctls_arch0.h: Likewise.
	* NEWS: Mention this.

	maint: update for linux 4.19-rc8.
	* maint/ioctls_sym.sh (x86_list): Add KVM_[GS]ET_NESTED_STATE.

2018-10-24  Dmitry V. Levin  <ldv@altlinux.org>

	Remove redundant VIDIOC_SUBDEV_* constants.
	Remove those of VIDIOC_SUBDEV_* constants are defined exactly the same
	way by the Linux kernel as their VIDIOC_* origins.

	Linux kernel commit v4.19-rc1~137^2~248 introduced more of such
	duplicates, forward remove them as well.

	* linux/32/ioctls_inc_align16.h: Remove VIDIOC_SUBDEV_DV_TIMINGS_CAP,
	VIDIOC_SUBDEV_ENUM_DV_TIMINGS, VIDIOC_SUBDEV_G_DV_TIMINGS,
	VIDIOC_SUBDEV_G_EDID, VIDIOC_SUBDEV_QUERY_DV_TIMINGS,
	VIDIOC_SUBDEV_S_DV_TIMINGS, and VIDIOC_SUBDEV_S_EDID.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* maint/ioctls_sym.sh: Remove VIDIOC_SUBDEV_DV_TIMINGS_CAP,
	VIDIOC_SUBDEV_ENUM_DV_TIMINGS, VIDIOC_SUBDEV_ENUMSTD,
	VIDIOC_SUBDEV_G_DV_TIMINGS, VIDIOC_SUBDEV_G_EDID, VIDIOC_SUBDEV_G_STD,
	VIDIOC_SUBDEV_QUERY_DV_TIMINGS, VIDIOC_SUBDEV_QUERYSTD,
	VIDIOC_SUBDEV_S_DV_TIMINGS, VIDIOC_SUBDEV_S_EDID, and
	VIDIOC_SUBDEV_S_STD.

2018-09-27  Dmitry V. Levin  <ldv@altlinux.org>

	xtensa: fix typo in pkey_alloc syscall number.
	* linux/xtensa/syscallent.h (pkey_alloc): Change from 249 to 349.

2018-09-23  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: print _IOC_NONE in symbolic form even if it is equal to 0.
	On some architectures _IOC_NONE equals to 1, on others it is 0.
	Change the way how ioctl direction flags are printed so that
	_IOC_NONE is printed in symbolic form even if it is equal to 0.

	* xlat/ioctl_dirs.in (_IOC_NONE): Move to the head of the list.
	* tests/ioctl_inotify.c (main): Update expected output.
	* tests/ioctl_loop. (main): Likewise.c
	* tests/ioctl_perf.c (main): Likewise.
	* tests/ioctl_scsi.c (main): Likewise.

2018-09-18  Dmitry V. Levin  <ldv@altlinux.org>

	Disable git-archive.
	Since configure uses git-version-gen which in turn depends
	on "git describe" or  a .tarball-version file, raw archives
	generated by "git archive" cannot be built.

	* .gitattributes: New file.
	* README-github_gitlab-autogenerated-archives.txt: Likewise.

2018-09-16  Dmitry V. Levin  <ldv@altlinux.org>

	Workaround signedness bugs in system NLMSG_OK reported by -Wsign-compare
	Introduce a replacement for NLMSG_OK provided by <linux/netlink.h> since
	that system macro contains signedness bugs that are not going to be fixed.

	* netlink.h: Include <stdbool.h>.
	(is_nlmsg_ok): New static inline function.
	* socketutils.c (receive_responses): Use it instead of NLMSG_OK.
	* tests/netlink_inet_diag.c (check_responses): Likewise.
	* tests/netlink_netlink_diag.c (check_responses): Likewise.
	* tests/netlink_unix_diag.c (check_responses): Likewise.

	Closes: https://github.com/strace/strace/issues/79

2018-09-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests/sprintrc.c: drop redundant check.
	* tests/sprintrc.c (sprintrc_ex): Remove fmt check, this also fixes the
	warning reported by clang -Wtautological-constant-out-of-range-compare.

	build: enable gcc -Woverride-init and clang -Winitializer-overrides.
	* m4/st_warn_cflags.m4 (gl_WARN_ADD): Add -Winitializer-overrides
	and -Woverride-init.

2018-09-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: exclude arm_sync_file_range from ksysent test.
	arm_sync_file_range is better known as sync_file_range2.

	* tests/ksysent.sed: Filter out arm_sync_file_range.

2018-09-16  Dmitry V. Levin  <ldv@altlinux.org>

	Ignore warnings about overridden initialization of hwaddr_sizes.
	As hwaddr_sizes array is explicitly initialized this way,
	ignore potential warnings reported by gcc -Woverride-init
	and clang -Winitializer-overrides.

	* gcc_compat.h (CLANG_PREREQ): New macro.
	(DIAG_PUSH_IGNORE_OVERRIDE_INIT, DIAG_POP_IGNORE_OVERRIDE_INIT): New
	macros non-trivially defined for gcc >= 4.2 and clang >= 2.8.
	* sock.c (print_ifreq): Use them to ignore warnings about overridden
	initialization of hwaddr_sizes array.

	Closes: https://github.com/strace/strace/issues/77

2018-09-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: workaround clang -Wunneeded-internal-declaration bug.
	* tests/execve.c (main): Explicitly mark q_envp variable as used
	to workaround clang -Wunneeded-internal-declaration bug.
	* tests/execveat.c (main): Likewise.
	* tests/nsyscalls.c (main): Explicitly mark syscallent variable as used
	to workaround clang -Wunneeded-internal-declaration bug.

	Closes: https://github.com/strace/strace/issues/78

2018-09-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	process: honor xlat style in print_user_offset_addr.
	* process.c (print_user_offset_addr): Print in accordance with xlat
	verbosity setting.

	time: add xlat styles support to printclockname.
	* time.c (printclockname): Respectl xlat_verbosity.

	perf: rewrite print_perf_event_attr using PRINT_FIELD_* macros.
	* perf.c: Include "print_fields.h".
	(PRINT_XLAT): Remove.
	(print_perf_event_attr): Use PRINT_FIELD_* macros.

2018-09-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check stack unwinding for signals.
	* tests/stack-fcall-3.c: Include <signal.h>.
	(f3): Call getpid or kill depending on the argument, store getpid result.
	* tests/stack-fcall.c (main): Remove arguments, call f0(0) and f0(1).
	* tests/strace-k-demangle.expected: Update expected output.
	* tests/strace-k.expected: Likewise.
	* tests/strace-k.test: Rewrite pattern matching code.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-09-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Print stack traces on signals.
	I don't know why it hasn't been done earlier.

	* strace.c (print_stopped) [ENABLE_STACKTRACE]: Call unwind_tcb_print
	if stack trace printing is enabled.

2018-09-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: provide fallback definitions for open_access_modes constants.
	* xlat/open_access_modes.in: Add fallback values.

	xlat: update resources.
	* xlat/resources.in: Declare as #value indexed, provide fallback values.
	(RLIMIT_VMEM): Remove.

	nlattr: ignore nla_type flags when selecting nlattr decoder.
	* nlattr.c (decode_nlattr_with_data): Apply NLA_TYPE_MASK to nla_type
	before decoder selection.

2018-09-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	netlink_packet_diag: assorted decoding fixes.
	* xlat/af_packet_versions.in: New file.
	* netlink_packet_diag.c: Include "xlat/af_packet_versions.h".
	(decode_packet_diag_req): sdiag_protocol shouldn't be decoded as a protocol,
	currently it should be set to 0.
	(decode_packet_diag_info): Decode pdi_version field using af_packet_versions
	xlat; decode pdi_index field as an interface index.
	(packet_diag_msg_nla_decoders) <PACKET_DIAG_UID>: Decode using
	decode_nla_uid.
	(decode_packet_diag_msg): Decode pdiag_num as an low-level protocol.
	* tests/netlink_sock_diag.c: Update expected output.
	* tests/nlattr_packet_diag_msg.c: Likewise.

	sockaddr: add X.25 socket address decoding support.
	* sockaddr.c: Include <linux/x25.h>.
	(print_sockaddr_data_x25): New function.
	(sa_printers) <[AF_X25]>: New socket address handler.
	* tests/net-sockaddr.c (check_x25): New function.
	(main): Use it to check X.25 socket address decoding.

	net: add support for AX.25 protocols and socket option names decoding.
	* xlat/ax25_protocols.in: New file.
	* xlat/sock_ax25_options.in: Likewise.
	* net.c: Include "xlat/ax25_protocols.h" and "xlat/sock_ax25_options.h".
	* (SYS_FUNC(socket)): <[AF_AX25]>: Print protocol name using
	ax25_protocols xlat.
	(print_sockopt_fd_level_name) <[SOL_AX25]>: Print socket option name
	using sock_ax25_options xlat.

	sockaddr: decode AX.25 socket addresses.
	* defs.h (print_ax25_addr): New prototype.
	* print_fields.h (PRINT_FIELD_AX25_ADDR): New macro.
	* sockaddr.c: Include <linux/ax25.h>.
	(check_ax25_address, ax25_addr2str, print_ax25_addr_raw,
	print_ax25_addr, print_sockaddr_data_ax25): New functions.
	(sa_printers) <[AF_AX25]>: New printer.
	* tests/net-sockaddr.c (AX25_ADDR): New macro.
	(check_ax25): New function.
	(main): Use it to check AX.25 socket address decoding.

	macros: add ROUNDUP macro.
	* macros.h (ROUNDUP): New macro.

2018-09-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	futex: recognise FUTEX_BITSET_MATCH_ANY bitmask.
	* xlat/futexbitset.in: New file.
	* futex.c: Include "xlat/futexbitset.h".
	(futex) <FUTEX_WAIT_BITSET, FUTEX_WAKE_BITSET>: Decode val3 using
	futexbitset xlat.
	* tests/futex.c: Add checks for 0xffffffff bitset mask printing.

	Closes: Linux commit v4.16-rc1~166^2^2~2

2018-09-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ioprio: move constant definitions to xlat.
	* xlat/ioprio_class.in: Add fallback values.
	* xlat/ioprio_who.in: Likewise.
	* ioprio.c: Remove IOPRIO_WHO_* and IOPRIO_CLASS_* enums.

	net: decode AF_PACKET protocols in socket syscall.
	* net.c: Include "xlat/ethernet_protocols.h" in XLAT_MACROS_ONLY mode.
	(SYS_FUNC(socket)) <AF_PACKET>: Decode using ethernet_protocols xlat.

2018-09-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	print_ifindex: add public get_ifname method.
	In order to be able to obtain sanitised device name internally.

	* defs.h (get_ifname): New declaration.
	* print_ifindex.c (get_ifname): Refactor, leaving out addition
	of if_nametoindex("") part.
	(sprint_ifname): New function, adds if_nametoindex("")
	to get_ifname's output.
	(print_ifindex): Use sprint_ifname instead of get_ifname.

2018-09-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	socketutils: introduce get_family_by_proto.
	Add a helper function that returns address family based on the internal
	notion of the socket protocol using protocols table.

	* defs.h (get_family_by_proto): New declaration.
	* socketutils.c (get_family_by_proto): New function.

2018-09-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	socketutils: add more IP/IPv6 transport protocols.
	* defs.h (sock_proto): Add SOCK_PROTO_UDPLITE, SOCK_PROTO_DCCP,
	SOCK_PROTO_SCTP, SOCK_PROTO_L2TP_IP, SOCK_PROTO_PING, SOCK_PROTO_RAW,
	SOCK_PROTO_UDPLITEv6, SOCK_PROTO_DCCPv6, SOCK_PROTO_L2TP_IPv6,
	SOCK_PROTO_SCTPv6, SOCK_PROTO_PINGv6, and SOCK_PROTO_RAWv6.
	* socketutils.c: Include "xlat/inet_protocols.h" in XLAT_MACROS_ONLY
	mode.
	(protocols): Add protocol descriptions for them.

2018-09-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	socketutils: store more information in protocols table.
	This also allows getting rid of all these *_v[46]_get calls.

	* socketutils.c (unix_get, inet_get, netlink_gen): Add family, protocol,
	and proto_name paramteres, use them where appropriate.
	(tcp_v4_get, udp_v4_get, tcp_v6_get, udp_v6_get): Remove.
	(protocols): Add family and proto fields to the structure, call inet_get
	for IP/IPv6 protocols.
	(get_sockaddr_by_inode_uncached): Update protocols->get calls.

2018-09-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	sockaddr: whitespace cleanup, fix typo in comment.
	* sockaddr.c (print_sockaddr_data_bt): Fix typo, remove excess
	indentation from the switch statement.

	tests: add utimensat test variants with different xlat verbosity levels.
	* tests/utimensat-Xabbrev.c: New file.
	* tests/utimensat-Xraw.c: Likewise.
	* tests/utimensat-Xverbose.c: Likewise.
	* tests/utimensat.c: Add handling of XLAT_RAW and XLAT_VERBOSE flags.
	* tests/pure_executables.list: Add utimensat-Xabbrev, utimensat-Xraw,
	and utimensat-Xverbose.
	* tests/.gitignore: Likewise.
	* tests/gen_tests.in (utimensat-Xabbrev, utimensat-Xraw, utimensat-Xverbose): New
	tests.

	print_timespec: make print_timespec_t_utime respect xlat style setting.
	* print_timespec.c (print_timespec_t_utime): Print raw timespec value
	in accordance with xlat style setting.

2018-09-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	netlink: honor custom xlat style setting during nlmsg flags printing.
	Commit v4.23~343 introduced xlat style argument to printflags_ex, but
	XLAT_STYLE_DEFAULT was introduced only in the next commit v4.23~342,
	which led to missing out fixing the sole external user of this
	peculiar extended interface.

	* netlink.c (decode_nlmsg_flags): Use XLAT_STYLE_DEFAULT instead of
	XLAT_STYLE_ABBREV in printflags_ex call.

	Fixes: v4.23~342 "Introduce XLAT_STYLE_DEFAULT"

2018-09-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	netlink_netfilter: use xlat styles for res_id workaround printing.
	* netlink_netfilter.c (decode_netlink_netfilter): Call print_xlat_ex
	in order to respect xlat style setting.

	xlat: provide fallback definitions for epollevents.
	* xlat/epollevents.in: Provide fallback definitions, add EPOLLNVAL
	constant (introduced by Linux commit v4.16-rc1~3^2~3).

	xlat: provide fallback definitions to pollflags.
	* xlat/pollflags.in: Add fallback definitions for POLLWRNORM,
	POLLWRBAND, POLLMSG, POLLREMOVE, and POLLRDHUP.

	xlat: provide fallback values for socktypes.
	* xlat/socktypes.in: Provide fallback values.

	xlat: provide fallback values to route_nexthop_flags.
	* xlat/route_nexthop_flags.in: Add fallback values.

2018-09-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	block: move fallback definitions for ioctl commands to xlat.
	* xlat/block_ioctl_cmds.in: New file.
	* block.c: Include "xlat/block_ioctl_cmds.h" in XLAT_MACROS_ONLY mode.
	(BLKPG, BLKTRACESETUP, BLKTRACESTART, BLKTRACESTOP, BLKTRACETEARDOWN,
	BLKDISCARD, BLKIOMIN, BLKIOOPT, BLKALIGNOFF, BLKPBSZGET,
	BLKDISCARDZEROES, BLKSECDISCARD, BLKROTATIONAL, BLKZEROOUT): Remove
	fallback definitions as those are porvided by block_ioctl_cmds xlat now.

2018-09-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Decode BLKGETSIZE64 unconditionally.
	It is available on all supported kernel versions.

	* block.c (block_ioctl): Remove #ifdef HAVE_BLKGETSIZE64.
	* configure.ac: Remove BLKGETSIZE64 check.

2018-09-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add ability to specify a default string to print_xlat_ex.
	In order to avoid dealing with xlat verbosity styles outside xlat code
	as much as possible.

	* defs.h (xlat_style_private_flag_bits): Rename from
	print_array_flag_bits, add PXF_DEFAULT_STR_BIT.
	(xlat_style_private_flags): Rename from print_array_flags, add
	FLAG_(PXF_DEFAULT_STR).
	* xlat.c (print_xlat_ex): Handle PXF_DEFAULT_STR by interpreting str
	as a default value (print both value and str in XLAT_STYLE_ABBREV).

2018-09-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	nlattr: provide common AF_INET{,6} address decoders.
	Rename decode_ifla_inet6_token to decode_nla_in6_addr,
	add a sister function decode_nla_in_addr for future use.

	* nlattr.c (decode_nla_in_addr, decode_nla_in6_addr): New functions.
	* nlattr.h (DECL_NLA(in_addr), DECL_NLA(in6_addr)): New declarations.
	* rtnl_link.c (decode_ifla_inet6_token): Remove.
	(ifla_inet6_nla_decoders) <[IFLA_INET6_TOKEN]>: Use decode_nla_in6_addr.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	net: decode SOL_XDP socket option names.
	* xlat/sock_xdp_options.in: New file.
	* net.c: Include "xlat/sock_xdp_options.h".
	(print_sockopt_fd_level_name) <case SOL_XDP>: Print SOL_XDP socket
	option names.

	xlat: add SOL_XDP to socketlayers.in.
	* xlat/socketlayers.in (SOL_XDP): New constant, introduced by Linux
	commit v4.18-rc1~114^2~304^2~4^2~14.

	xlat: add AF_XDP to addrfams.in.
	* xlat/addrfams.in (AF_XDP): New constant, introduced by Linux commit
	v4.18-rc1~114^2~304^2~4^2~14.

	netlink_smc_diag: decode SMC_DIAG_SHUTDOWN attribute value.
	* xlat/sock_shutdown_flags.in: New file.
	* netlink_smc_diag.c: Include "xlat/sock_shutdown_flags.h".
	(decode_smc_diag_shutdown): New function.
	(smc_diag_msg_nla_decoders) <[SMC_DIAG_SHUTDOWN]>: Use
	decode_smc_diag_shutdown.
	* tests/nlattr_smc_diag_msg.c: Add checks for SMC_DIAG_SHUTDOWN.

	tests/ioctl_v4l2: do not calculate page end address each time.
	* tests/ioctl_v4l2.c (main): Replace page + size with page_end.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	print_fields: simplify UINT64_MAX printing.
	As we have print_xlat_u now.

	* print_fields.h (PRINT_FIELD_U64): Use print_xlat_u for UINT64_MAX
	printing.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	nsfs: simplify auxstr logic.
	There's no need to check whether non-NULL value is being assigned to
	auxstr; syscall_exiting_trace does it itself.

	* nsfs.c (nsfs_ioctl) <case NS_GET_NSTYPE>: Simply assign result of
	xlookup to auxstr if syserror(tcp) is false.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add BPF_PROG_TYPE_SK_REUSEPORT to bpf_prog_types.in.
	* xlat/bpf_prog_types.in (BPF_PROG_TYPE_SK_REUSEPORT): New constant,
	introduced by Linux commit v4.19-rc1~140^2~24^2~2^2~5.
	* tests/bpf.c: Update expected output.

	xlat: add IPSTATS_MIB_REASM_OVERLAPS to snmp_ip_stats_mib.in.
	* xlat/snmp_ip_stats.in (IPSTATS_MIB_REASM_OVERLAPS): New constant,
	introduced by Linux commit v4.19-rc1~140^2~128^2~2.

	xlat: update bpf_map_types.in.
	* xlat/bpf_map_types.in (BPF_MAP_TYPE_CGROUP_STORAGE): New constant,
	introduced by Linux commit v4.19-rc1~140^2~108^2~3^2~12.
	(BPF_MAP_TYPE_REUSEPORT_SOCKARRAY): New constant, introduced by Linux
	commit v4.19-rc1~140^2~24^2~2^2~6.
	* tests/bpf.c: Update expected output.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	rtnl_link: add IFLA_MIN_MTU and IFLA_MAX_MTU attributes.
	Introduced by Linux commit v4.19-rc1~140^2~205^2~1.

	* rtnl_link.c (ifinfomsg_nla_decoders) <[IFLA_MIN_MTU], [IFLA_MAX_MTU]>:
	New decoder, calls decode_nla_u32.
	* xlat/rtnl_link_attrs.in (IFLA_MIN_MTU, IFLA_MAX_MTU): New constant.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add IPV4_DEVCONF_BC_FORWARDING-1 to inet_devconf_indices.in.
	* xlat/inet_devconf_indices.in (IPV4_DEVCONF_BC_FORWARDING-1): New
	constant, introduced by Linux commit v4.19-rc1~140^2~208^2~1.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	rtnl_netconf: add NETCONFA_BC_FORWARDING attribute.
	Introduced by Linux commit v4.19-rc1~140^2~208^2~1.

	* rtnl_netconf.c (netconfmsg_nla_decoders) <[NETCONFA_BC_FORWARDING]>:
	New decoder, calls decode_nla_s32.
	* xlat/rtnl_netconf_attrs.in (NETCONFA_BC_FORWARDING): New constant.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	netlink_smc_diag: add SMC_DIAG_FALLBACK attribute support.
	Introduced by Linux commit v4.19-rc1~140^2~253^2~1.

	* linux/smc_diag.h (SMC_DIAG_FALLBACK): New enumeration item.
	(struct smc_diag_fallback): New type definition.
	* netlink_smc_diag.c: Include "xlat/smc_decl_codes.h".
	(decode_smc_diag_fallback): New function.
	(smc_diag_msg_nla_decoders) <[SMC_DIAG_FALLBACK]>: New decoder, calls
	decode_smc_diag_fallback.
	* tests/nlattr_smc_diag_msg.c: Add checks for SMC_DIAG_FALLBACK
	attribute decoding.
	* xlat/smc_decl_codes.in: New file.
	* xlat/smc_diag_attrs.in (SMC_DIAG_FALLBACK): New constant.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	defs.h: add style argument to printxval_search_ex macro.
	It is identical to printxval_search otherwise.

	* defs.h (printxval_search_ex): Add style argument.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update v4l2_pix_fmts.in.
	* xlat/v4l2_pix_fmts.in (V4L2_PIX_FMT_FWHT): New constant, introduced by
	Linux commit v4.19-rc1~137^2~221.
	(V4L2_PIX_FMT_SBGGR14P, V4L2_PIX_FMT_SGBRG14P, V4L2_PIX_FMT_SGRBG14P,
	V4L2_PIX_FMT_SRGGB14P): New constants, introduced by Linux commit
	v4.19-rc1~137^2~97.
	(V4L2_PIX_FMT_Y10P): New constant, introduced by Linux commit
	v4.19-rc1~137^2~95.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	netlink_smc_diag: decode smc_diag_msg.diag_fallback constant names.
	Introduced by Linux commit v4.19-rc1~140^2~285^2~4.

	* xlat/smc_diag_mode.in: New file.
	* netlink_smc_diag.c: Include "xlat/smc_diag_mode.h".
	(decode_smc_diag_msg): Print diag_fallback field using smc_diag_mode
	xlat.
	* tests/netlink_sock_diag.c (test_smc_diag_msg): Update expected output.
	* tests/nlattr_smc_diag_msg.c (print_smc_diag_msg): Likewise.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	rtnl_link: add IFLA_BRPORT_BACKUP_PORT attribute.
	Introduced by Linux commit v4.19-rc1~140^2~288^2.

	* xlat/rtnl_ifla_brport_attrs.in (IFLA_BRPORT_BACKUP_PORT): New
	constant.
	* rtnl_link.c (ifla_brport_nla_decoders) <[IFLA_BRPORT_BACKUP_PORT]>:
	New decoder.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update nt_descriptor_types.in.
	* xlat/nt_descriptor_types.in (NT_VMCOREDD): New named constant,
	introduced by Linux commit v4.18-rc1~114^2~252^2~2.
	(NT_MIPS_DSP): New named constant, introduced by Linux commit
	v4.19-rc1~42^2~63.
	(NT_MIPS_FP_MODE): New named constant, introduced by Linux commit
	v4.19-rc1~42^2~62.

	xlat: add AUDIT_INTEGRITY_POLICY_RULE to nl_audit_types.in.
	* xlat/nl_audit_types.in (AUDIT_INTEGRITY_POLICY_RULE): New constant,
	introduced by Linux commit v4.19-rc1~124^2~5.

	rtnl_link: decode named constants for IFLA_XDP_ATTACHED attribute value.
	* xlat/rtnl_ifla_xdp_attached_mode.in: New file.
	* rtnl_link.c: Include "xlat/rtnl_ifla_xdp_attached_mode.h".
	(decode_ifla_xdp_attached): New function.
	(ifla_xdp_nla_decoders) <[IFLA_XDP_ATTACHED]>: Use
	decode_ifla_xdp_attached instead of decode_nla_u8.
	* tests/nlattr_ifla_xdp.c: Add checks for IFLA_XDP_ATTACHED decoding.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	rtnl_link: add new IFLA_XDP_* attributes.
	Introduced by Linux commit v4.19-rc1~140^2~364^2~6^2~6.

	* xlat/rtnl_ifla_xdp_attrs.in (IFLA_XDP_DRV_PROG_ID,
	IFLA_XDP_SKB_PROG_ID, IFLA_XDP_HW_PROG_ID): New constants.
	* rtnl_link.c (ifla_xdp_nla_decoders): Add decoders for
	IFLA_XDP_DRV_PROG_ID, IFLA_XDP_SKB_PROG_ID, and IFLA_XDP_HW_PROG_ID.
	* tests/nlattr_ifla_xdp.c: Add checks for new attributes.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update v4l2_control_ids.in.
	* xlat/v4l2_control_ids.in (V4L2_CID_MPEG_VIDEO_VP8_PROFILE): Renamed
	from V4L2_CID_MPEG_VIDEO_VPX_PROFILE (the latter is now a synonym),
	by Linux commit v4.19-rc1~137^2~270.
	(V4L2_CID_MPEG_VIDEO_VP9_PROFILE): New constant, introduced by Linux
	commit v4.19-rc1~137^2~269.

	xlat: add SO_TXTIME to sock_options.in.
	* xlat/sock_options.in (SO_TXTIME): New constant, introduced by Linux
	commit v4.19-rc1~140^2~465^2~12.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	netlink_smc_diag: implement SMC_DIAG_DMBINFO decoding.
	The message has been added by Linux commit v4.19-rc1~140^2~507^2~1.

	* linux/smc_diag.h: Include "gcc_compat.h".
	(enum): Add SMC_DIAG_DMBINFO.
	(struct smcd_diag_dmbinfo): New type definition.
	* xlat/smc_diag_attrs.in (SMC_DIAG_DMBINFO): New constant.
	* netlink_smc_diag.c (decode_smc_diag_dmbinfo): New function.
	(smc_diag_msg_nla_decoders) [SMC_DIAG_DMBINFO]: New decoder, calls
	decode_smc_diag_dmbinfo.
	* tests/nlattr_smc_diag_msg.c: Add SMC_DIAG_DMBINFO check.

2018-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add SCTP_REUSE_PORT to sock_sctp_options.in.
	* xlat/sock_sctp_options.in (SCTP_REUSE_PORT): New constant, introduced
	by Linux commit v4.19-rc1~140^2~518.

	xlat: add IN_MASK_CREATE to inotify_flags.in.
	* xlat/inotify_flags.in (IN_MASK_CREATE): New constant, introduced by
	Linux commit v4.19-rc1~115^2.
	* tests/inotify.c (main): Update expected output.

2018-08-22  Dmitry V. Levin  <ldv@altlinux.org>

	tests: workaround systemd-nspawn habit of disabling unimplemented syscalls
	* tests/nsyscalls.c (test_syscall): Do not assume that unimplemented
	syscalls always fail with ENOSYS.

	tests: workaround systemd-nspawn habit of disabling mlockall syscall.
	* tests/mmap.c (main): Do not assume that mlockall syscall always
	succeeds.

	tests: workaround systemd-nspawn habit of disabling munlockall syscall.
	* tests/munlockall.c (main): Do not assume that munlockall syscall
	always succeeds.

2018-08-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Decode AF_SMC netlink messages unconditionally.
	As smc_diag.h is bundled, there is little sense to build AF_SMC support
	conditionally.

	* netlink_smc_diag.c [!AF_SMC]: Include xlat/addrfams.h under
	XLAT_MACROS_ONLY, enable the rest of file.
	* netlink_sock_diag.c: Include xlat/addrfams.h under XLAT_MACROS_ONLY.
	(diag_decoders): Remove "ifdef AF_SMC" condition for [AF_SMC], reorder
	in accordance with address family values.
	* tests/nlattr_smc_diag_msg.c [!AF_SMC]: Define AF_SMC to 43, enable
	the rest of test.

2018-08-19  Dmitry V. Levin  <ldv@altlinux.org>

	strace.c: introduce struct tcb_wait_data.
	Introduce a new structure to pass information between next_event(),
	restart_delayed_tcb(), and dispatch_event().

	This is going to be used by a subsequent change of next_event().

	* strace.c (struct tcb_wait_data): New type.
	(next_event): Remove parameters, return a pointer
	to const struct tcb_wait_data.  Return NULL instead of TE_BREAK.
	(dispatch_event): Replace all parameters with a pointer
	to const struct tcb_wait_data, obtain the trace event, siginfo,
	and status from its fields.
	(restart_delayed_tcb): Add local struct tcb_wait_data variable
	with te field set to TE_RESTART, pass it to dispatch_event().
	(main): Remove status and si variables, update next_event()
	and dispatch_event() invocations.

	Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>

2018-08-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: fix typo in smc_protocols.in.
	* xlat/smc_protocols.in: s/^MCPROTO_SMC/SMCPROTO_SMC/.

2018-08-19  Dmitry V. Levin  <ldv@altlinux.org>

	ci: add a test with the latest gcc and mainline headers.
	* .gitlab-ci.yml (gcc-x86_64-libdw-mainline): New entry.
	* .travis.yml (CC=gcc-8, KHEADERS=torvalds/linux): Likewise.

	ci: update gitlab ubuntu image.
	* .gitlab-ci.yml (image): Replace "ubuntu:17.10" with "ubuntu:18.04".

	ci: install kernel headers after compiler dependencies.
	* ci/install-dependencies.sh: Install kernel headers after compiler
	dependencies to avoid a needless attempt to install $common_packages.

	ci: fix kernel headers version diagnostics.
	* ci/run-build-and-tests.sh: Honor $CPPFLAGS when printing
	kernel headers version.

2018-08-19  Zhibin Li  <08826794brmt@gmail.com>

	tests: enhance test coverage of evdev ioctl.
	* tests/ioctl_evdev.c (main): Test EVIOCGMTSLOTS(8) command.

	tests: check decoding of successful evdev ioctl.
	* tests/ioctl_evdev-success.c: New file.
	* tests/ioctl_evdev-success-v.c: Likewise.
	* tests/ioctl_evdev-success.test: New test.
	* tests/ioctl_evdev-success-v.test: Likewise.
	* tests/.gitignore: Add ioctl_evdev-success and ioctl_evdev-success-v.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add the two tests mentioned above.

2018-08-19  Zhibin Li  <08826794brmt@gmail.com>

	evdev: fix decoding of EVIOCGBIT(0, ...)
	There is a comment in drivers/input/evdev.c which says:
	/* EV_SYN==0 is EV_CNT, _not_ SYN_CNT, see EVIOCGBIT */

	That is, EVIOCGBIT(0, ...) should return a bit mask with supported
	event types instead of SYN_* event codes.

	* defs.h (evdev_ev): New prototype.
	* evdev.c: Include "xlat/evdev_ev.h" and remove "xlat/evdev_sync.h".
	(bit_ioctl) <case EV_SYN>: Replace EV_SYN with 0, use evdev_ev
	with XT_SORTED in decode_bitset invocation instead.
	* ioctl.c: Do not include "xlat/evdev_ev.h".
	(evdev_decode_number): Print nr == 0x20 as "0" instead of "EV_SYN".
	* tests/ioctl_evdev.c (main): Use 0 instead of EV_SYN in EVIOCGBIT
	output.
	* xlat/evdev_sync.in: Remove.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
	Fixes: v4.10~89 "Add decoding for evdev ioctls"

2018-08-19  Zhibin Li  <08826794brmt@gmail.com>

	evdev: fix decoding of bit sets.
	According to drivers/input/evdev.c:bits_to_user(),
	the Linux kernel returns the number of bytes, not bits.

	* evdev.c (decode_bitset_): Treat syscall return value as the number
	of bytes.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
	Fixes: v4.10~89 "Add decoding for evdev ioctls"

2018-08-19  Pierre Marsais  <pierre.marsais@lse.epita.fr>

	kvm: decode the argument of KVM_CHECK_EXTENSION.
	xlat/kvm_cap.in has been generated using the following command line:

	grep '#define\s\+KVM_CAP' $linux/include/uapi/linux/kvm.h |
	sed -E -e 's/^#define\s+([^ \t]+)\s*([0-9]+).*$/printf "%-40s%s\n" \1 \2/e' \
	       -e 's/ {8}/\t/g; s/ +/\t/g'

	* xlat/kvm_cap.in: New file.
	* kvm.c: Include "xlat/kvm_cap.h".
	(kvm_ioctl_decode_check_extension): New function.
	(kvm_ioctl): Use it.
	* tests/ioctl_kvm_run_common.c (main): Check decoding
	of KVM_CHECK_EXTENSION command.

2018-08-19  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: update V4L2_CID_USER_*_BASE constants.
	* xlat/v4l2_control_id_bases.in (V4L2_CID_USER_S2255_BASE,
	V4L2_CID_USER_SI476X_BASE, V4L2_CID_USER_SAA7134_BASE,
	V4L2_CID_USER_ADV7180_BASE, V4L2_CID_USER_TC358743_BASE,
	V4L2_CID_USER_MAX217X_BASE): New constants.

2018-08-19  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: workaround V4L2_CID_USER_IMX_BASE Linux kernel ABI breakage.
	Linux kernel commit v4.18-rc2-106-g421860b9d47053badce4b247576fa48df9ab4c48
	has changed the value of V4L2_CID_USER_IMX_BASE constant introduced
	by commit v4.13-rc1~141^2~121 because the old value was already used
	by V4L2_CID_USER_MAX217X_BASE.

	This is of course an ABI breakage that affects Linux kernels starting
	with 4.13 and up to 4.18, as well as their LTS derivatives.

	Since the imx driver didn't provide any public control ID definitions,
	it looks like the best way to handle this situation is to pretend that
	the old value of V4L2_CID_USER_IMX_BASE didn't exist.

	* xlat/v4l2_control_id_bases.in (V4L2_CID_USER_IMX_BASE): Redefine.

	Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>

2018-08-14  Dmitry V. Levin  <ldv@altlinux.org>

	Post-release administrivia.
	* NEWS: Add a header line for the next release.
	* debian/changelog.in: Add a changelog entry for 4.24-1.
	* strace.spec.in: Likewise.

	Prepare for 4.24 release.
	* NEWS: Update for 4.24 release.

2018-08-12  Dmitry V. Levin  <ldv@altlinux.org>

	Update copyright headers.
	Headers updated automatically using maint/update_copyright_years.sh
	script.

2018-08-12  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Update ioctl entries from linux v4.18.
	* linux/32/ioctls_inc_align16.h: Update from linux v4.18-rc8
	using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* linux/s390x/ioctls_arch0.h: Likewise.
	* NEWS: Mention this.

	maint: update for linux v4.18.
	* maint/ioctls_sym.sh: Add workaround for linux/omap3isp.h file.

2018-08-12  Dmitry V. Levin  <ldv@altlinux.org>

	Replace BTRFS_IOC_[GS]ET_FSLABEL with FS_IOC_[GS]ETFSLABEL.
	Linux kernel commit v4.18-rc1~37^2~66 introduced FS_IOC_[GS]ETFSLABEL
	ioctl constants as generalized copies of BTRFS_IOC_[GS]ET_FSLABEL.

	* linux/32/ioctls_inc_align16.h: Replace BTRFS_IOC_[GS]ET_FSLABEL
	with FS_IOC_[GS]ETFSLABEL.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* maint/ioctls_sym.sh: Remove BTRFS_IOC_[GS]ET_FSLABEL.
	* tests/btrfs.c (FS_IOC_GETFSLABEL, FS_IOC_SETFSLABEL): Add fallback
	definitions.
	(btrfs_test_label_ioctls, btrfs_test_read_ioctls): Replace
	BTRFS_IOC_[GS]ET_FSLABEL with FS_IOC_[GS]ETFSLABEL.

2018-08-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	open.c: use __O_TMPFILE.
	As it is the flag kernel actually checks against,
	and it is now guaranteed to have a fallback definition.

	* open.c (STRACE_O_TMPFILE): Remove.
	(decode_open): Use __O_TMPFILE instead of STRACE_O_TMPFILE.

2018-08-05  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: regenerate sock_options.in.
	* xlat/sock_options.in: Regenerate using maint/gen_xlat_defs.sh script.
	* xlat/sock_options.sh: Remove.

2018-08-05  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: add fallback definitions to open_mode_flags.
	* xlat/open_mode_flags.in: Regenerate using maint/gen_xlat_defs.sh script
	to provide fallback definitions.  Implement a workaround for O_NDELAY.

	Co-Authored-by: Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>

2018-08-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: remove non-Linux flags from open_mode_flags.
	* xlat/open_mode_flags.in (O_PRIV, FNDELAY, FAPPEND, FMARK, FDEFER,
	FSHLOCK, FEXLOCK, FCREAT, FTRUNC, FEXCL, FNBIO, FSYNC, FNOCTTY,
	O_SHLOCK, O_EXLOCK): Remove flags that are not present in Linux.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-08-05  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: add fallback definitions to madvise_cmds.
	* xlat/madvise_cmds.in: Regenerate using maint/gen_xlat_defs.sh script
	to provide fallback definitions.

	Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>

2018-08-05  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: add fallback definitions to mmap_flags.
	* xlat/mmap_flags.in: Regenerate using maint/gen_xlat_defs.sh script
	to provide fallback definitions.  Implement a workaround for MAP_RENAME.

	Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>

2018-08-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	maint: add a Linux UAPI headers crawler.
	This script is going to be used to generate xlat fallback values.

	* maint/gen_xlat_defs.sh: New file.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-08-05  Dmitry V. Levin  <ldv@altlinux.org>

	strace.spec.in: use $RPM_OPT_FLAGS when building auxiliary programs.
	* strace.spec.in: Set CFLAGS_FOR_BUILD to "$RPM_OPT_FLAGS" so that
	$RPM_OPT_FLAGS is honored when building auxiliary programs like
	ioctlsort.

2018-08-05  Dmitry V. Levin  <ldv@altlinux.org>

	strace.spec.in: compress changelog files.
	Some say uncompressed changelog files are too big.

	* strace.spec.in: Compress ChangeLog and ChangeLog-CVS using gzip -9n.

2018-08-05  Dmitry V. Levin  <ldv@altlinux.org>

	strace.spec.in: use a SUSE-specific group name for SUSE.
	Since, apparently, it isn't quite happy with a simple group name
	"Development/Debuggers".

	* strace.spec.in (Group): Add %{?suse_version:/Tools}.

2018-08-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.spec.in: use a SUSE-specific license name for SUSE.
	Since, apparently, it isn't quite happy with a simple "BSD".

	* strace.spec.in (License): Add %{?suse_version:-3-Clause}.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-08-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: allow any error code when trying to set time.
	Lower expectations of particular error code numbers when trying to set
	time.  This helps to workaround issues with unexpected return codes
	in some exotic environments where EPERM is returned instead of EINVAL
	(e.g. mock that uses systemd-nspawn).

	* tests/clock_xettime.c (main): Do not hardcode EINVAL, print return
	codes using sprintrc.
	* tests/xettimeofday.c (main): Likewise.
	* NEWS: Mention this fix.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-08-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	s390x: fix build with old kernel headers.
	Avoid defining psw_compat_t and s390_compat_regs if their definitions
	are provided by kernel.  Before Linux commit v3.10-rc1~201^2~11,
	these definition were available in <asm/ptrace.h>.

	* configure.ac (AC_CHECK_TYPES): Check for s390_compat_regs.
	* linux/s390x/arch_regs.c [HAVE_S390_COMPAT_REGS]: Do not define
	psw_compat_t and s390_compat_regs.
	* NEWS: Mention this fix.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-08-05  Dmitry V. Levin  <ldv@altlinux.org>

	strace.spec.in: minor updates here and there.
	* strace.spec.in: Add descriptive comments to build requirements.
	Introduce %maybe_use_defattr and use it instead of %defattr.
	Add output of ld --version to the build environment information.
	Use printf instead of echo -e.

2018-08-05  Dmitry V. Levin  <ldv@altlinux.org>

	strace.spec.in: remove strace64 subpackage.
	strace64 subpackage used to be installed into ppc32 and sparc32
	userspace running by a 64-bit kernel to trace 64-bit processes.

	As simultaneous decoding of processes running both in 64-bit and 32-bit
	personality is fully supported on every architecture with compat kernel
	support for quite some time, one can just install a 64-bit strace and
	there is no more need for that strace64 kludge.

	* strace.spec.in (strace64_arches, copy64, %ifarch %{strace64_arches}):
	Remove.

2018-08-04  Dmitry V. Levin  <ldv@altlinux.org>

	Update NEWS.

	Update NEWS.

	rtnl_route: decode new RTA_* attributes.
	* rtnl_route.c (rtmsg_nla_decoders): Add entries for RTA_IP_PROTO,
	RTA_SPORT, and RTA_DPORT.

	xlat: update RTA_* constants.
	* xlat/rtnl_route_attrs.in: Add RTA_IP_PROTO, RTA_SPORT, and RTA_DPORT
	* constants introduced by Linux kernel commit v4.18-rc1~114^2~165^2~2.

	rtnl_link: decode new IFLA_BRPORT_* attributes.
	* rtnl_link.c (ifla_brport_nla_decoders): Add entries for
	IFLA_BRPORT_GROUP_FWD_MASK, IFLA_BRPORT_NEIGH_SUPPRESS, and
	IFLA_BRPORT_ISOLATED.

	xlat: update IFLA_BRPORT_* constants.
	* xlat/rtnl_ifla_brport_attrs.in: Add IFLA_BRPORT_GROUP_FWD_MASK
	constant introduced by Linux kernel commit v4.15-rc1~84^2~607.
	Add IFLA_BRPORT_NEIGH_SUPPRESS constant introduced by Linux kernel
	commit v4.15-rc1~84^2~523^2~2.
	Add IFLA_BRPORT_ISOLATED constant introduced by Linux kernel commit
	v4.18-rc1~114^2~142.

	xlat: update IFA_* constants.
	* xlat/rtnl_addr_attrs.in: Add IFA_RT_PRIORITY constant introduced
	by Linux kernel commit v4.18-rc1~114^2~108^2~3

	xlat: update RTPROT_* constants.
	* xlat/routing_protocols.in: Add RTPROT_BGP, RTPROT_ISIS, RTPROT_OSPF,
	RTPROT_RIP, and RTPROT_EIGRP constants introduced by Linux kernel commit
	v4.18-rc1~114^2~90.

2018-08-01  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: save the script used to generate xlat/sock_options.in.
	* xlat/sock_options.sh: New file from commit message of commit v4.23~199.

2018-08-01  Zhibin Li  <08826794brmt@gmail.com>

	tests: check decoding of getsockopt(PACKET_STATISTICS)
	* tests/net-tpacket_stats.c: New file.
	* tests/net-tpacket_stats-success.c: Likewise.
	* tests/gen_tests.in (net-tpacket_stats): New test.
	* tests/net-tpacket_stats-success.test: Likewise.
	* tests/.gitignore: Add net-tpacket_stats and net-tpacket_stats-success.
	* tests/Makefile.am (check_PROGRAMS): Add net-tpacket_stats-success.
	(DECODER_TESTS): Add net-tpacket_stats-success.test.
	* tests/pure_executables.list: Add net-tpacket_stats.

	tests: check decoding of setsockopt(PACKET_[R|T]X_RING)
	* tests/net-tpacket_req.c: New file.
	* tests/.gitignore: Add net-tpacket_req.
	* tests/pure_executables.list: Likewise.
	* tests/gen_tests.in (net-tpacket_req): New test.

	tests: check decoding of setsockopt(PACKET_[ADD|DROP]_MEMBERSHIP)
	* tests/net-packet_mreq.c: New file.
	* tests/.gitignore: Add net-packet_mreq.
	* tests/pure_executables.list: Likewise.
	* tests/gen_tests.in (net-packet_mreq): New test.

2018-07-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: bring lists back to the sorted order.
	* tests/.gitignore: Make the list sorted again.
	* tests/pure_executables.list: Likewise.
	* tests/Makefile.am (check_PROGRAMS, DECODER_TESTS, MISC_TESTS):
	Likewise.

2018-07-20  Zhibin Li  <08826794brmt@gmail.com>

	tests: check decoding of successful quotactl.
	* tests/quotactl-success.c: New file.
	* tests/quotactl-success-v.c: Likewise.
	* tests/quotactl-xfs-success.c: Likewise.
	* tests/quotactl-xfs-success-v.c: Likewise.
	* tests/quotactl-success.test: New test.
	* tests/quotactl-success-v.test: Likewise.
	* tests/quotactl-xfs-success.test: Likewise.
	* tests/quotactl-xfs-success-v.test: Likewise.
	* tests/.gitignore: Add quotactl-success, quotactl-success-v,
	quotactl-xfs-success and quotactl-xfs-success-v.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add four new tests listed above.
	* tests/quotactl.h: [INJECT_RETVAL] (check_quota): Use errstr instead of
	sprintrc; check that returned value is equivalent to the injected one;
	append "(INJECTED)" string to errstr.
	* tests/quotactl.c: Changed condition rc != 0 to rc < 0 in callback
	functions and value of opaque pointer addr_cb_arg in order to check
	successful injection.
	* tests/quotactl-xfs.c: Likewise.

2018-07-18  Dmitry V. Levin  <ldv@altlinux.org>

	net: enhance decoding of getsockopt(PACKET_STATISTICS)
	* net.c (print_tpacket_stats): Change decoder to match the kernel
	behaviour: getsockopt syscall accepts any non-negative *optlen and
	writes either MIN(sizeof(struct tpacket_stats), *optlen) or
	MIN(sizeof(struct tpacket_stats_v3), *optlen) bytes of data.

	net: compile SO_PEERCRED/SO_ATTACH_FILTER/SO_ATTACH_REUSEPORT_CBPF code unconditionally
	* net.c: Remove checks for SO_PEERCRED, SO_ATTACH_FILTER, and
	SO_ATTACH_REUSEPORT_CBPF macros as they are defined unconditionally
	since commit v4.23~199.

	net: enhance decoding of getsockopt(SO_PEERCRED)
	* net.c (print_ucred): Rename to print_get_ucred, change decoder
	to match the kernel behaviour: getsockopt syscall accepts any
	non-negative *optlen and writes MIN(sizeof(struct ucred), *optlen)
	bytes of data.
	(print_getsockopt): Replace print_ucred with print_get_ucred.
	* tests/so_percred.c: Include <string.h>.
	(main): Update expected output.

	net: enhance decoding of getsockopt(SO_LINGER)
	* net.c (print_get_linger): Change decoder to match the kernel
	behaviour: getsockopt syscall accepts any non-negative *optlen
	and writes MIN(sizeof(struct linger), *optlen) bytes of data.
	(print_set_linger): Move after definition of SYS_FUNC(getsockopt).
	* tests/so_linger.c: Include <stddef.h> and <string.h>.
	(main): Update expected output.

	net: generalize getsockopt length check.
	* net.c (print_getsockopt): Apply (ulen < 0 || rlen < 0) check for all
	cases.  As the kernel neither accepts nor returns a negative length
	in case of successful getsockopt syscall invocation, these negative
	values must have been forged by userspace.

2018-07-15  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix build with fresh glibc.
	Workaround additional incompatibility between <sys/stat.h> and
	<asm/stat.h> introduced by glibc-2.27.9000-566-gfd70af4.

	* tests/xstatx.c (statx, statx_timestamp): Redefine before the inclusion
	of <sys/stat.h> to avoid conflicts between definitions provided by the
	linux kernel headers and the GNU libc.

2018-07-15  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/quotactl.h: document check_quota.
	* tests/quotactl.h (check_quota): Add a comment describing the function
	usage.

2018-07-15  Zhibin Li  <08826794brmt@gmail.com>

	tests/quotactl-xfs.c: fix indentation.

2018-07-15  Zhibin Li  <08826794brmt@gmail.com>

	tests: use check_quota for invalid quotactl commands.
	Use check_quota function for invalid commands instead of manual quotactl
	syscall invocations. In this way successful injection can also be checked
	for these commands in the next commit.

	* tests/quotactl.c (main): Add invalid_cmd_str and invalid_id_str local
	variables, remove unused variable rc, use check_quota instead of manual
	quotactl syscall invocations.
	* tests/quotaclt.c (main): Add invalid_cmd_str variable, remove unused
	variable rc, use check_quota instead of manual quotactl syscall invocations.

2018-07-15  Zhibin Li  <08826794brmt@gmail.com>

	tests: enhance test coverage of quotactl syscall parser.
	* tests/quotactl.c (print_dqfmt): New function.
	(main): Use print_dqfmt to print flags of quota format, improve existing
	tests and add more tests for Q_GETFMT.
	* tests/quotactl-xfs.c: Improve existing tests and add more tests for
	Q_XGETQSTAT and Q_XGETQSTATV.

	tests/quotactl-xfs.c: fix typos in QCMD.
	* tests/quotactl-xfs.c (main): fix typos of sub-commands in QCMD.

	Mpersify decoder of struct xfs_dqstats.
	* xfs_quota_stat.h: New file.
	* fetch_struct_xfs_quotastat.c: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* quota.c: Include xfs_quota_stat.h
	(struct fs_qfilestat, struct xfs_dqstats): Moved to xfs_quota_stat.h.
	(decode_cmd_data) <case Q_XGETQSTAT>: Use fetch_struct_quotastat.

	quota: fix disorder of PRINT_FIELD invocations.
	* quota.c (decode_cmd_data) <case Q_XGETQSTAT>: Print fields
	of struct xfs_dqstats in the structure order.

2018-07-12  Zhibin Li  <08826794brmt@gmail.com>

	tests: extend coverage for other fcntl flags.
	* tests/fcntl-common.c: Include <assert.h>.
	(struct fcntl_cmd_check): New structure.
	(print_retval_flags, test_other_set_cmd, test_other_get_cmd,
	print_flags_getfd, print_flags_getsig, print_flags_getlease,
	test_fcntl_others): New functions.
	(main): Use test_fcntl_others.

2018-07-11  Dmitry V. Levin  <ldv@altlinux.org>

	Implement -e kvm= option on all architectures.
	Make -e kvm= interface available on all architectures by adding a stub
	on those architectures that do not have <linux/kvm.h>.

	* filter_qualify.c (qualify_kvm): Define unconditionally.
	(qual_options): Define qualify_kvm entry unconditionally.
	* strace.c (usage): Mention kvm argument of -e option unconditionally.

2018-07-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update bpf(2)-related constants.
	* xlat/bpf_attach_type.in (BPF_CGROUP_UDP4_SENDMSG,
	BPF_CGROUP_UDP6_SENDMSG): New constant, introduced by Linux commit
	v4.18-rc1~114^2~9^2~20^2~4.
	(BPF_LIRC_MODE2): New constant, introduced by Linux commit
	v4.18-rc1~114^2~9^2~15^2~1.
	* xlat/bpf_commands.in (BPF_BTF_LOAD): New constant, introduced by Linux
	commit v4.18-rc1~114^2~417^2~1^2~5.
	(BPF_BTF_GET_FD_BY_ID): New constant, introduced by Linux commit
	v4.18-rc1~114^2~223^2~21^2~4.
	(BPF_TASK_FD_QUERY): New constant, introduced by Linux commit
	v4.18-rc1~114^2~148^2~1^2~5.
	* xlat/bpf_map_types.in (BPF_MAP_TYPE_XSKMAP): New constant, introduced
	by Linux commit v4.18-rc1~114^2~304^2~4^2~8.
	(BPF_MAP_TYPE_SOCKHASH): New constant, introduced by Linux commit
	v4.18-rc1~114^2~223^2~5^2~2.
	* xlat/bpf_prog_types.in (BPF_PROG_TYPE_LWT_SEG6LOCAL): New constant,
	introduced by Linux commit v4.18-rc1~114^2~148^2~2^2~1.
	(BPF_PROG_TYPE_LIRC_MODE2): New constant, introduced by Linux commit
	v4.18-rc1~114^2~9^2~15^2~1.
	* tests/bpf.c: Update expected output.

2018-07-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Wire up io_pgetevents and rseq on hppa, microblaze, mips, powerpc, and s390
	* linux/hppa/syscallent.h ([350]): Wire up io_pgetevents syscall
	introduced by Linux commit v4.18-rc3~7^2~2.
	* linux/microblaze/syscallent.h ([399], [400]): Wire up io_pgetevents
	and rseq syscalls introduced by Linux commit v4.18-rc3~33^2~2.
	* linux/mips/syscallent-n32.h ([6331], [6332]): Wire up rseq and
	io_pgetevents syscalls introduced by Linux commits v4.18-rc2~11^2~2
	and v4.18-rc2~11^2, respectively.
	* linux/mips/syscallent-n64.h ([5327], [5328]): Likewise.
	* linux/mips/syscallent-o32.h ([4367], [4368]): Likewise.
	* linux/powerpc/syscallent.h ([388]): Wire up io_pgetevents syscall
	introduced by Linux commit v4.18-rc3~14^2~2.
	* linux/powerpc64/syscallent.h ([388]): Likewise.
	* linux/s390/syscallent.h ([382], [383]): Wire up io_pgetevents
	and rseq syscalls introduced by Linux commits v4.18-rc4~18^2~1
	and v4.18-rc4~18^2, respectively.
	* linux/s390x/syscallent.h([382], [383]): Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-07-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	maint: improve the tag message.
	* maint/gen-tag-message.sh: Align the wording of the changes section
	header with the one used in NEWS, add a reference to CREDITS in
	"Contributors" section.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-07-10  Dmitry V. Levin  <ldv@altlinux.org>

	Upgrade invalid -e kvm= argument to a fatal error.
	* filter_qualify.c (qualify_kvm): Call error_msg_and_die instead of
	error_msg in case of invalid -e kvm= argument.
	* tests/options-syntax.test: Check it.

	Mention -e inject option in "strace -h" output.
	* strace.c (usage): Mention inject argument of -e option.

2018-07-07  Masatake YAMATO  <yamato@redhat.com>

	tests: check decoding of vcpu auxstr.
	* tests/ioctl_kvm_run_common.c: Rename from ioctl_kvm_run.c.
	(run_kvm): Parametrize printing of KVM_RUN ioctl with print_KVM_RUN
	invocation.
	(main): Invoke optional KVM_NO_CPUID_CALLBACK macro when the old kernel
	behavior is detected.
	* tests/Makefile.am (EXTRA_DIST): Add ioctl_kvm_run_common.c.
	* tests/ioctl_kvm_run.c: New file, a wrapper around
	ioctl_kvm_run_common.c.
	* ioctl_kvm_run_auxstr_vcpu.c: Likewise.
	* tests/gen_tests.in (ioctl_kvm_run_auxstr_vcpu): New test.
	* tests/pure_executables.list: Add ioctl_kvm_run_auxstr_vcpu.
	* tests/.gitignore: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-07-07  Masatake YAMATO  <yamato@redhat.com>

	strace.1.in: document -e kvm=vcpu option.
	* strace.1.in (-e kvm=vcpu): Document new option.
	* NEWS: Mention -e kvm=vcpu option.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-07-07  Masatake YAMATO  <yamato@redhat.com>

	kvm: attach the exit reason of vcpu as auxstr to KVM_RUN output.
	In KVM, a virtual machine implementation like Qemu can access a vcpu
	via ioctl.  KVM_RUN is an ioctl command to enter vcpu.  The command
	returns control for various reasons: needs of device emulation or
	consuming time slices are the typical ones.  The vmi takes a different
	action for the reason.

	We, strace users, want to know the reason to understand kvm.  This
	change prints the reason as auxstr if "-e kvm=vcpu" option is given,
	and if strace runs on Linux 4.16.0 or higher, which includes commit
	e46b469278a59781f9b25ff608af84892963821b, "kvm: embed vcpu id to dentry
	of vcpu anon inode."

	The way to get the reason is a bit complicated because the ioctl does
	not return it to the userspace directly.  Instead, the vmi and kvm
	communicate via an area of the process virtual memory where the fd of
	vcpu is mmap'ed.  strace must peek the area to know the reason.

	The change does three things: (1) recording the area for the given vcpu
	when the target calls VCPU_CREATE to vcpu_info_list per tcb data field,
	(2) verifying the data recorded in vcpu_info_list before doing (3), and
	(3) decoding the exit reason field of the area.

	The change is complicated because there is a case that strace
	does not have a chance to do (1) if -p option is used.
	In this case, vcpu_info data created in the step (2).

	The area has more fields than "exit reason",
	dumping them may be implemented in the future.

	* defs.h (struct tcb) [HAVE_LINUX_KVM_H]: Add vcpu_info_list field.
	[HAVE_LINUX_KVM_H]: (kvm_run_structure_decoder_init,
	kvm_vcpu_info_free): New declarations.
	* strace.c (usage): Add "kvm" as a new expression for -e option.
	(droptcb): Call kvm_vcpu_info_free.
	* filter_qualify.c (qualify_kvm): New function calling
	kvm_run_structure_decoder_init to enable for attaching the exit
	reason to auxstr.
	(qual_options): Add "kvm" as an entry.
	* xlat/kvm_exit_reason.in: New file.
	* kvm.c: Include xmalloc.h and mmap_cache.h.
	(dump_kvm_run_structure): New static variable.
	(kvm_run_structure_decoder_init): New function.
	(vcpu_info): New struct definition representing the 3-tuple: vcpu file
	descriptor, id of the vcpu, and mmap'ed entry.
	(vcpu_find, vcpu_alloc, vcpu_register, vcpu_getinfo,
	kvm_vcpu_info_free): New functions to access tcb's vcpu_info_list
	field and vcpu_info data type.
	(is_map_for_file, map_len): New helper functions.
	(kvm_ioclt_run_attach_auxstr, kvm_ioctl_decode_run): New functions
	decoding vcpu exit reason and attaching the decoded data to auxstr
	field of tcb.
	(kvm_ioctl_create_vcpu): Call vcpu_register to make an entry mapping
	a file descriptor and the vcpu id associated with the fd.
	(kvm_ioctl): Call kvm_ioctl_decode_run.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-07-07  Masatake YAMATO  <yamato@redhat.com>

	mmap_cache: add customizable search function.
	* mmap_cache.c (mmap_cache_search_custom): New function.
	* mmap_cache.h (mmap_cache_search_fn): New type.
	(mmap_cache_search_custom): New function prototype.

2018-07-07  Pierre Marsais  <pierre.marsais@lse.epita.fr>

	tests: check verbose decoding of kvm ioctl.
	* tests/ioctl_kvm_run-v.c: New file.
	* tests/ioctl_kvm_run.c: Include xlat.h and xlat/kvm_cpuid_flags.h.
	(print_kvm_segment, print_kvm_sregs, print_kvm_regs): New functions.
	(run_kvm): Use them.
	(print_cpuid_ioctl) [VERBOSE]: Print verbose ioctl decoding.
	* tests/gen_tests.in (ioctl_kvm_run-v): New entry.
	* tests/pure_executables.list: Add ioctl_kvm_run-v.
	* tests/.gitignore: Likewise.

	tests: check decoding of kvm ioctls related to struct kvm_cpuid2.
	* tests/ioctl_kvm_run.c [!HAVE_STRUCT_KVM_CPUID2]: Skip the test.
	(KVM_MAX_CPUID_ENTRIES): New macro.
	(print_cpuid_ioctl): New function.
	(main): Add tests for cpuid related ioctl.

2018-07-07  Pierre Marsais  <pierre.marsais@lse.epita.fr>

	kvm: decode the argument of KVM_SET_CPUID2 and KVM_GET_*_CPUID ioctl commands
	* configure.ac (AC_CHECK_TYPES): Add struct kvm_cpuid2.
	* xlat/kvm_cpuid_flags.in: New file.
	* kvm.c [HAVE_STRUCT_KVM_CPUID2]: Include "xlat/kvm_cpuid_flags.h".
	[HAVE_STRUCT_KVM_CPUID2] (print_kvm_cpuid_entry, kvm_ioctl_decode_cpuid2):
	New functions.
	(kvm_ioctl) [HAVE_STRUCT_KVM_CPUID2]: Use kvm_ioctl_decode_cpuid2.
	* NEWS: Mention this improvement.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-07-07  Zhibin Li  <08826794brmt@gmail.com>

	net: fix a typo in print_tpacket_stats.

2018-07-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix race condition in aio.test.
	* tests/aio.c (main): Print aio_key fields before the io_submit syscall
	invocation to avoid races with the kernel.

2018-07-03  Dmitry V. Levin  <ldv@altlinux.org>

	ci: robustify network-related operations.
	Reduce false positives by wrapping network-related operations into a loop.

	* ci/install-dependencies.sh (retry_if_failed): New function.
	Use it to invoke apt-get update, apt-get install, git clone,
	add-apt-repository, and pip install.

2018-06-29  Zhibin Li  <08826794brmt@gmail.com>

	.gitignore: ignore linux/linux.
	Ignore directory linux/linux created by workaround from commit
	v4.23-11-g15003d4.

	* .gitignore: Add /linux/linux.

2018-06-18  Dmitry V. Levin  <ldv@altlinux.org>

	Fix build on systems where libc relies on <linux/signal.h>
	Commit v4.23~10 has broken the build with Android's libc because it
	relies on the UAPI headers (such as <linux/signal.h>) to define various
	types, rather than copying them into the libc headers (such as <signal.h>)
	like most other Linux C libraries.

	* linux/linux/signal.h: Rename to linux/signal.h.in.
	* Makefile.am (strace_SOURCES): Remove linux/linux/signal.h.
	(EXTRA_DIST): Add linux/signal.h.in.
	(DISTCLEANFILES): Add linux/linux/signal.h.
	* configure.ac (AC_CACHE_CHECK): Check whether <linux/signal.h>
	can be used along with <signal.h>, install linux/linux/signal.h
	workaround if they cannot be used together.

	Reported-by: Elliott Hughes <enh@google.com>
	Closes: https://github.com/strace/strace/issues/72

2018-06-18  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add AUDIT_INTEGRITY_EVM_XATTR to nl_audit_types.
	* xlat/nl_audit_types.in (AUDIT_INTEGRITY_EVM_XATTR): New constant,
	introduced by Linux commit v4.18-rc1~100^2~9.

	xlat: add UDP_SEGMENT to sock_udp_options.
	* xlat/sock_udp_options.in (UDP_SEGMENT): New constant, introduced by
	Linux commit v4.18-rc1~114^2~377^2~8.

2018-06-17  Dmitry V. Levin  <ldv@altlinux.org>

	Remove redundant range initializers in syscallent files.
	* linux/aarch64/syscallent.h: Remove redundant range initializers.
	* linux/x32/syscallent.h: Likewise.

2018-06-17  Chen Jingpiao  <chenjingpiao@gmail.com>

	x32: move rseq syscall entry to a suitable place.
	As rseq syscall is not x32-specific, move it after the previous one
	that is not x32-specific.  Fix the unused syscall number range.

	* linux/x32/syscallent.h ([334]): Move it after [333].
	([335 ... 511]): Update the range.

2018-06-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	aio: make iocb array output more strucutred.
	* aio.c (print_iocb): Print curly brackets.
	(print_iocbp): Do not print curly brackets.
	* tests/aio.c: Update expected output.

	aio: print IOCB_CMD_* using xlat.
	* xlat/aio_cmds.in: New file.
	* aio.c (tprint_lio_opcode): Change array of structs "cmds" to array of
	enums "subs", use printxval_indexn_ex for printing cmd, return sub type
	using subs array.

	xlat/sock_tcp_options.in: add #value_indexed.
	* xlat/sock_tcp_options.in: Add #value_indexed, provide fallback
	definitions.
	* net.c (print_sockopt_fd_level_name) <case SOL_TCP>: Use
	printxval_index instead of printxval.

	xlat/sock_tcp_options.in: update.
	* xlat/sock_tcp_options.in (TCP_ZEROCOPY_RECEIVE): New constant,
	introduced by Linux commit v4.18-rc1~114^2~351^2~1.
	(TCP_INQ): New constant, introduced by Linux commit v4.18-rc1~114^2~330.

	xlat/sigtrap_codes.in: add TRAP_UNK.
	* xlat/sigtrap_codes.in (TRAP_UNK): New constant, introduced by Linux
	commit v4.17-rc1-15-gdb78e6a.

2018-06-15  Dmitry V. Levin  <ldv@altlinux.org>

	Post-release administrivia.
	* NEWS: Add a header line for the next release.
	* debian/changelog.in: Add a changelog entry for 4.23-1.
	* strace.spec.in: Likewise.

2018-06-14  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for 4.23 release.
	* NEWS: Update for 4.23 release.

	Update copyright headers.
	Headers updated automatically using maint/update_copyright_years.sh
	script.

	tests: add missing copyright headers.
	* tests/prctl-spec-inject.test: Add copyright header.
	* tests/qualify_personality.sh: Likewise.

	maint: document release procedure.
	* maint/README-release: New file.
	* maint/gen-release-notes.sh: Likewise.
	* maint/gen-release-github.sh: Likewise.
	* maint/gen-release-gitlab.sh: Likewise.

	maint: prepend contributor names in tag messages with an asterisk.
	* maint/gen-tag-message.sh: Prepend every line of
	gen-contributors-list.sh output with an asterisk.

2018-06-14  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update NEWS.

2018-06-13  Dmitry V. Levin  <ldv@altlinux.org>

	Wire up rseq syscall.
	This new syscall was introduced by Linux commit v4.17-1308-gd7822b1.

	* linux/dummy.h (sys_rseq): New macro.
	* linux/arm/syscallent.h (398): Add rseq entry.
	* linux/i386/syscallent.h (386): Likewise.
	* linux/powerpc/syscallent.h (387): Likewise.
	* linux/powerpc64/syscallent.h (387): Likewise.
	* linux/x32/syscallent.h (334): Likewise.
	* linux/x86_64/syscallent.h (334): Likewise.

2018-06-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of io_pgetevents syscall.
	* configure.ac (AC_CHECK_TYPES): Check for struct __aio_sigset
	in <linux/aio_abi.h>.
	* tests/aio_pgetevents.c: New file.
	* tests/.gitignore: Add aio_pgetevents.
	* tests/pure_executables.list: Likewise.
	* tests/gen_tests.in (aio_pgetevents): New test.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-06-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Implement io_pgetevents syscall decoding.
	Introduced by Linux commit v4.17-rc3-7-g7a074e9.

	* print_aio_sigset.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* aio.c (print_io_getevents): Rename from SYS_FUNC(io_getevents), add
	has_usig flag, print user sigset on exiting if has_usig is set to true.
	(SYS_FUNC(io_getevents), SYS_FUNC(io_pgetevents)): New functions,
	wrappers for print_io_getevents.
	* linux/32/syscallent.h ([292]): Wire up io_pgetevents.
	* linux/64/syscallent.h ([292]): Likewise.
	* linux/i386/syscallent.h ([385]): Likewise.
	* linux/x32/syscallent.h ([333]): Likewise.
	* linux/x86_64/syscallent.h ([333]): Likewise.
	* NEWS: Mention this improvement.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-06-13  Dmitry V. Levin  <ldv@altlinux.org>

	travis: re-enable testing with the latest mainline kernel headers.
	As <linux/signal.h> is out of the game now, the Linux commit
	v4.17-rc3-7-g7a074e9 should not cause harm anymore, so let's enable
	testing with the latest mainline kernel headers again.

	* .travis.yml (matrix): Do not specify KBRANCH for KHEADERS=torvalds/linux.

2018-06-13  Dmitry V. Levin  <ldv@altlinux.org>

	Workaround incompatibility between <linux/signal.h> and libc headers.
	Override <linux/signal.h> with <signal.h> so that those few linux
	headers that include <linux/signal.h> could be included along with libc
	headers.

	* linux/linux/signal.h: New file.
	* Makefile.am (strace_SOURCES): Add it.

2018-06-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add personality specification syntax checks.
	* tests/options-syntax.test: Add personality specification syntax
	checks.

	tests: add basic checks for personality designation support.
	* tests/qualify_personality.sh: New file.
	* tests/qualify_personality_empty.in: Likewise.
	* tests/trace_personality_32.in: Likewise.
	* tests/trace_personality_64.in: Likewise.
	* tests/trace_personality_regex_32.in: Likewise.
	* tests/trace_personality_regex_64.in: Likewise.
	* tests/trace_personality_regex_x32.in: Likewise.
	* tests/trace_personality_x32.in: Likewise.
	* tests/Makefile.am (EXTRA_DIST): Add them.
	* tests/gen_tests.in (trace_personality_32, trace_personality_64,
	trace_personality_x32, trace_personality_regex_32,
	trace_personality_regex_64, trace_personality_regex_x32): New tests.

2018-06-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add support for personality designation in regex qualifications.
	* basic_filters.c (qualify_syscall_regex): Copy syscall name
	to a temporary buffer, append the personality designation to it,
	and check it against regular expression if the syscall name
	hasn't been matched already.

	References: https://github.com/strace/strace/issues/35

2018-06-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add support for personality designation in syscall qualifications.
	* syscall.c (personality_designators): New array.
	* defs.h (personality_designators): New declaration.
	* basic_filters.c (qualify_syscall_separate_personality,
	qualify_syscall_number_personality): New functions.
	(qualify_syscall_number): Use qualify_syscall_separate_personality for
	checking for a personality specification, call
	qualify_syscall_number_personality for setting number set for specific
	personality.
	(qualify_syscall_name_personality): New function.
	(qualify_syscall_name): Use qualify_syscall_separate_personality for
	checking for a personality specification, call
	qualify_syscall_name_personality for setting number set for specific
	personality.
	* strace.1.in (.SS Filtering): Document it.
	* NEWS: Mention it.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
	Closes: https://github.com/strace/strace/issues/35

2018-06-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add basic checks for inject=SET:syscall= expression syntax.
	* tests/qual_fault-syscall.test: New test.
	* tests/qual_inject-error-signal-syscall.test: Likewise.
	* tests/qual_inject-retval-syscall.test: Likewise.
	* tests/qual_inject-signal-syscall.test: Likewise.
	* tests/Makefile.am (MISC_TESTS): Add them.
	* tests/qual_fault-syntax.test: Add checks for inject=SET:syscall=
	expression syntax.
	* tests/qual_inject-syntax.test: Likewise.
	* tests/qual_fault.test: Append $suffix to -e fault arguments, override
	$NAME with $name_override if the latter is set.
	* tests/qual_inject-error-signal.test: Append $suffix to -e inject
	arguments, override $NAME with $name_override if the latter is set.
	* tests/qual_inject-retval.test: Likewise.
	* tests/qual_inject-signal.test: Likewise.

2018-06-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Implement injection of syscalls with no side effects as an alternative to -1
	* defs.h (INJECT_F_SYSCALL, INJECT_ACTION_FLAGS, TCB_TAMPERED_NO_FAIL,
	syscall_tampered_nofail): New macros.
	(inject_data): Add scno field.
	* filter_qualify.c (struct inject_personality_data): New type.
	(parse_inject_token): Add "pdata" argument, parse "syscall=" option.
	(parse_inject_expression): Add "pdata" argument, forward it to
	parse_inject_token.
	(qualify_inject_common) <pdata>: New variable array, pass it to
	parse_inject_expression, copy it into inject_vec.
	* syscall.c (tamper_with_syscall_entering): Inject the specified syscall
	if INJECT_F_SYSCALL is set.
	(tamper_with_syscall_exiting): Update the check for a failed syscall
	injection.
	(get_syscall_result): Update get_error invocation.
	* strace.1.in: Document new syscall injection expression.
	* NEWS: Mention it.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
	Closes: https://github.com/strace/strace/issues/26

2018-06-13  Dmitry V. Levin  <ldv@altlinux.org>

	ia64: remove legacy i386 entries from the syscall entry table.
	Remove the last piece of IA-32 mode support.  Besides being obsolete,
	these bogus syscall entries cause problems with syscall name resolution.

	* linux/ia64/syscallent.h [CST > 0]: Remove.

	Complements: v4.21~17 "linux/ia64: remove IA-32 mode support"

2018-06-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	linux: set error flags in arch_set_error on POWER and Alpha.
	* alpha/set_error.c (arch_set_error): Set alpha_r3 to 1, update tracee's
	REG_A3.
	* powerpc/set_error.c (arch_set_error): Set bit 28 in CCR register,
	update tracee's PT_CCR.

	Fixes: v4.15~126 "Implement arch specific methods of changing syscall number and error code"

2018-06-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of IFLA_LINKINFO netlink attribute.
	* tests/nlattr_ifla_linkinfo.c: New file.
	* tests/pure_executables.list: Add nlattr_ifla_linkinfo.
	* tests/.gitignore: Likewise.
	* tests/gen_tests.in (nlattr_ifla_linkinfo): New test.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-06-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add print_quoted_stringn to print string with a size limit.
	This is similar to print_quoted_cstring, but not quite the same.

	* tests/print_quoted_string.c (print_quoted_stringn): New function.
	* tests/tests.h (print_quoted_stringn): New declaration.

2018-06-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add fallback_func argument to TEST_NESTED_NLATTR_OBJECT_EX_
	* tests/test_nlattr.h (TEST_NESTED_NLATTR_OBJECT_EX_): Add fallback_func
	argument, call it instead of print_quoted_hex.
	(TEST_NESTED_NLATTR_OBJECT_EX, TEST_NESTED_NLATTR_OBJECT): Specify
	print_quoted_hex as a fallback_func.
	* tests/nlattr_ifla_af_spec.c: Specify print_quoted_hex as
	a fallback_func in TEST_NESTED_NLATTR_OBJECT_EX_ calls.

	tests/test_nlattr.h: add ability to provide additional nlattr payload.
	* tests/test_nlattr.h (print_nlattr): Add add_data argument, print
	opening square bracket if add_data is set to true.
	(TEST_NLATTR_EX_): Rename from TEST_NLATTR_, add nla_total_len_
	argument, use it for msg_len calculation, print square brackets
	if nla_total_len_ is greater than nla_data_len_.
	(TEST_NLATTR_): New macro, a wrapper for TEST_NLATTR_EX_.

2018-06-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	rtnl_link: decode struct ifla_bridge_id unconditionally.
	Since it is relatively simple.

	* rtnl_link.c (decode_ifla_bridge_id): Provide struct definition for
	the id variable.
	[!HAVE_STRUCT_IFLA_BRIDGE_ID] (decode_ifla_bridge_id): Decode struct
	ifla_bridge_id.

2018-06-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	nlattr: specify size for ethernet protocol.
	Otherwise it tries to decode payload of size 1, which makes little
	sense.

	* nlattr.c (decode_nla_ether_proto) <opts>: Specify size field.

	Fixes: v4.22-321-gfd0cd65 "nlattr: add ethernet protocol decoder"

2018-06-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	rtnl_link: use ARRSZ_PAIR where appropriate.
	It reduces code duplication somewhat and allows avoiding errors like
	the one fixed in the previous commit.

	* rtnl_link.c (decode_ifla_protinfo, decode_nla_linkinfo_data_bridge,
	decode_nla_linkinfo_data_tun, decode_ifla_linkinfo, decode_ifla_port,
	decode_ifla_vf_ports, decode_ifla_xdp,
	DECL_NETLINK_ROUTE_DECODER(decode_ifinfomsg)): Use ARRSZ_PAIR in
	decode_nlattr call arguments.

2018-06-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	rtnl_link: fix incorrect variable names in ARRAY_SIZE arguments.
	* rtnl_link.c (decode_nla_linkinfo_data_bridge): Change
	rtnl_ifla_info_data_bridge_attrs to ifla_info_data_bridge_nla_decoders
	in ARRAY_SIZE call.
	(decode_nla_linkinfo_data_tun): Change rtnl_ifla_info_data_tun_attrs
	to ifla_info_data_tun_nla_decoders in ARRAY_SIZE call.

	Fixes: v4.22-328-g1e6d5a8 "rtnl_link: implement IFLA_INFO_DATA for bridges"
	Fixes: v4.22-329-g4eab3a4 "rtnl_link: implement IFLA_INFO_DATA for tun devices"

2018-06-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	mips: add missing pure flag to syscall entries.
	* linux/mips/syscallent-n32.h ([6038], [6100], [6102], [6105], [6106],
	[6108], [6109], [6178]): Add pure flag to getpid, getuid, getgid, geteuid,
	getegid, getpgid, getpgrp, and gttid syscall descriptors.
	* linux/mips/syscallent-n64.h ([5038], [5100], [5102], [5105], [5106],
	[5108], [5109], [5178]): Likewise.
	* linux/mips/syscallent-o32.h ([4020], [4024], [4047], [4049], [4050],
	[4064], [4065], [4222]): Likewise.

	Complements: v4.21~29 "Add pure syscall flag"

2018-06-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	mips: add missing "never fails" flag to getpgrp syscall entries.
	* linux/mips/syscallent-n32.h ([6109]): Add NF flag.
	* linux/mips/syscallent-n64.h ([5109]): Likewise.
	* linux/mips/syscallent-o32.h ([4065]): Likewise.

	Complements: v4.21~46 "Add SYSCALL_NEVER_FAILS flag to getpgrp"

2018-06-07  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update NEWS.
	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

	xlat: describe IPV4_DEVCONF_* weirdness.
	* xlat/inet_devconf_indices.in: Add a comment about fallback definitions.

2018-06-07  Dmitry V. Levin  <ldv@altlinux.org>

	configure.ac: fix the check for struct tc_sizespec on old kernel headers
	* configure.ac (AC_CHECK_TYPES): Include <linux/types.h> before
	<linux/pkt_sched.h> to check for struct tc_sizespec on linux kernel
	headers without v2.6.29-rc4~77^2~26 fix.

2018-06-06  Dmitry V. Levin  <ldv@altlinux.org>

	travis: use kernel headers from v4.17.
	There is too much noise when using unreleased kernel uapi.

	* ci/install-dependencies.sh (clone_repo): Add optional "branch"
	argument, pass it to "git clone".
	($KHEADERS): Pass $KBRANCH as branch argument of clone_repo.
	* .travis.yml (matrix): Specify KBRANCH=v4.17 for
	KHEADERS=torvalds/linux.

2018-06-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of IFLA_AF_SPEC netlink attribute.
	* configure.ac (AC_CHECK_TYPES): Check for struct ifla_cacheinfo in
	<linux/rtnetlink.h>
	(AC_CHECK_DECLS): Check for IFLA_AF_SPEC in <linux/rtnetlink.h>.
	* tests/nlattr_ifla_af_spec.c: New file.
	* tests/pure_executables.list: Add nlattr_ifla_af_spec.
	* tests/.gitignore: Likewise.
	* tests/gen_tests.in (nlattr_ifla_af_spec): New test.

2018-06-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add TEST_NESTED_NLATTR_ARRAY_EX to test_nlattr.h.
	An ability to specify custom depth is going to be needed later to check
	IFLA_AF_SPEC decoding.

	* configure.ac (AC_CHECK_DECLS): Check for TCA_STAB_DATA in
	<linux/pkt_sched.h>.
	* tests/test_nlattr.h (TEST_NESTED_NLATTR_ARRAY_EX): Rename from
	TEST_NESTED_NLATTR_ARRAY, add depth_ argument, perform padding and
	output accordingly.
	(TEST_NESTED_NLATTR_ARRAY): New macro, a thin wrapper around
	TEST_NESTED_NLATTR_ARRAY_EX.
	* tests/nlattr_tca_stab.c [!HAVE_DECL_TCA_STAB_DATA] (TCA_STAB_DATA):
	New enumeration declaration.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-06-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: pass index to print_elem_ callback in TEST_NLATTR_NESTED_ARRAY.
	* tests/test_nlattr.h (TEST_NLATTR_NESTED_ARRAY): Pass array index
	to the print_elem_ callback.
	* tests/nlattr_tca_stab.c (print_uint16): Add index argument.

	tests: move common ifinfomsg boilerplate into a separate header.
	* configure.ac (AC_CHECK_DECLS): Check for IFLA_PORT_SELF, IFLA_PROTINFO, and
	IFLA_XDP in <linux/rtnetlink.h>.
	* tests/nlattr_ifla.h: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	* tests/nlattr_ifla_brport.c [!HAVE_DECL_IFLA_PROTINFO] (IFLA_PROTINFO):
	New declaration.
	(hdrlen, init_ifinfomsg, print_ifinfomsg): Remove.
	(IFLA_ATTR): Define to IFLA_PROTINFO.
	Include nlattr_ifla.h.
	* tests/nlattr_ifla_port.c [!HAVE_DECL_IFLA_PORT_SELF] (IFLA_PORT_SELF):
	New declaration.
	(hdrlen, init_ifinfomsg, print_ifinfomsg): Remove.
	(IFLA_ATTR): Define to IFLA_PORT_SELF.
	Include nlattr_ifla.h.
	* tests/nlattr_ifla_xdp.c
	* tests/nlattr_ifla_xdp.c [!HAVE_DECL_IFLA_XDP] (IFLA_XDP): New
	declaration.
	(hdrlen, init_ifinfomsg, print_ifinfomsg): Remove.
	(IFLA_ATTR): Define to IFLA_XDP.
	Include nlattr_ifla.h.

	rtnl_link: implement IFLA_INFO_DATA for tun devices.
	* xlat/rtnl_ifla_info_data_tun_attrs.in: New file.
	* xlat/tun_device_types.in: Likewise.
	* rtnl_link.c: Include xlat/rtnl_ifla_info_data_tun_attrs.h and
	xlat/tun_device_types.h.
	(decode_nla_tun_type, decode_nla_linkinfo_data_tun): New functions.
	(ifla_info_data_tun_nla_decoders): New decoder dispatcher table.
	(decode_nla_linkinfo_data): Use decode_nla_linkinfo_data_tun if kind
	is
	"tun".

	rtnl_link: implement IFLA_INFO_DATA for bridges.
	* xlat/rtnl_ifla_info_data_bridge_attrs.in: New file.
	* rtnl_link.c: Include xlat/rtnl_ifla_info_data_bridge_attrs.h.
	(ifla_info_data_bridge_nla_decoders): New decoder dispatcher table.
	(decode_nla_linkinfo_data_bridge, decode_nla_linkinfo_data): New
	functions.
	(ifla_linkinfo_nla_decoders) <IFLA_INFO_DATA>: Use
	decode_nla_linkinfo_data as a decoder.

2018-06-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	rtnl_link: implement IFLA_INFO_XSTATS decoding.
	So far, only CAN provides it.

	* rtnl_link.c (decode_nla_linkinfo_xstats_can,
	decode_nla_linkinfo_xstats): New function.
	(ifla_linkinfo_nla_decoders) <IFLA_INFO_XSTATS>: Use
	decode_nla_linkinfo_xstats as a decoder.

2018-06-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	rtnl_link: add basic IFLA_INFO_* handling.
	Dispatch for IFLA_INFO_* attributes should be performed based on the
	string provided in a IFLA_INFO_KIND attribute.

	* nlattr.h (struct ifla_linkinfo_ctx): New type definition.
	* rtnl_link.c (decode_nla_linkinfo_kind): New function.
	(ifla_linkinfo_nla_decoders) <IFLA_INFO_KIND>: Use
	decode_nla_linkinfo_kind as decoder.
	(decode_ifla_linkinfo): Add struct ifla_linkinfo_ctx context, pass it to
	the decode_nlattr call as opaque data.

2018-06-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	rtnl_link: decode IFLA_AF_SPEC.
	* xlat/in6_addr_gen_mode.in: New file.
	* xlat/inet6_devconf_indices.in: Likewise.
	* xlat/inet6_if_flags.in: Likewise.
	* xlat/inet_devconf_indices.in: Likewise.
	* xlat/rtnl_ifla_af_spec_inet6_attrs.in: Likewise.
	* xlat/rtnl_ifla_af_spec_inet_attrs.in: Likewise.
	* xlat/snmp_icmp6_stats.in: Likewise.
	* xlat/snmp_ip_stats.in: Likewise.
	* rtnl_link.c: Include netinet/in.h, xlat/in6_addr_gen_mode.h,
	xlat/inet_devconf_indices.h, xlat/inet6_devconf_indices.h,
	xlat/inet6_if_flags.h, xlat/rtnl_ifla_af_spec_inet_attrs.h,
	xlat/rtnl_ifla_af_spec_inet6_attrs.h, xlat/snmp_icmp6_stats.h,
	and xlat/snmp_ip_stats.h.
	(decode_ifla_inet_conf, decode_ifla_inet6_flags,
	decode_ifla_inet6_conf, decode_ifla_inet6_stats,
	decode_ifla_inet6_cacheinfo, decode_ifla_inet6_icmp6_stats,
	decode_ifla_inet6_token, decode_ifla_inet6_agm, decode_ifla_af,
	decode_ifla_af_spec): New functions.
	(ifla_inet_nla_decoders, ifla_inet6_nla_decoders,
	nla_decoder_table_desc): New static constant variables.
	(ifinfomsg_nla_decoders) <[IFLA_AF_SPEC]>: Change value from NULL to
	decode_ifla_af_spec.

2018-06-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	nlattr: add size check to decode_nla_xval and decode_nla_flags.
	If the field size is known, do not print as valid numbers those
	attributes that are too short, and ignore extra data.

	This change puts xval/flags printing in line with the reset of attribute
	decoders.

	* nlattr.h (struct decode_nla_xlat_opts): Add size field.
	* nlattr.c (decode_nla_xval, decode_nla_flags): Check that len is at
	least opts->size, limit len to opts->size.
	(decode_nla_ip_proto): Specify size of 1.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-06-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	nlattr: add UID/GID netlink attribute decoders.
	* nlattr.h (DECL_NLA(uid), DECL_NLA(gid)): New declarations.
	* nlattr.c (decode_nla_uid, decode_nla_gid): New functions.

	nlattr: add unsigned int decoders that print in hex form.
	* nlattr.h (DECL_NLA(x8), DECL_NLA(x16), DECL_NLA(x32), DECL_NLA(x64)):
	New declarations.
	* nlattr.c (DECODE_NLA_INTEGER(x8, uint8_t, "%#" PRIx8),
	DECODE_NLA_INTEGER(x16, uint16_t, "%#" PRIx16),
	DECODE_NLA_INTEGER(x32, uint32_t, "%#" PRIx32),
	DECODE_NLA_INTEGER(x64, uint64_t, "%#" PRIx64)): New decoders.

	nlattr: add ethernet protocol decoder.
	* nlattr.h (DECL_NLA(ether_proto)): New declaration.
	* nlattr.c (process_host_order, decode_nla_ether_proto): New functions.

2018-06-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	nlattr: add value processing support for xlat/flags nlattr decoders.
	Needed for upcoming decoder of ethernet proto which is stored in the
	host order and has to be converted to the network order before printing
	as an xval constant.  This change also adds ability to provide
	prefix/suffix in order to enclose the printed value in something that
	describes the performed conversion.

	* nlattr.h (struct decode_nla_xlat_opts): Add prefix, suffix, and
	process_fn fields.
	* nlattr.c (decode_nla_xval, decode_nla_flags): Handle process_fn,
	prefix, snd uffix parameters.

2018-06-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	nlattr: introduce decode_nla_flags.
	Similar to decode_nla_xval.

	* nlattr.c (decode_nla_flags): New function.
	* nlattr.h: (DECL_NLA(flags)): New declaration.

2018-06-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	nlattr: add ability to pass nla_type to decoder in decode_nlattr.
	As of now, it's impossible to introduce a dispatching nlattr decoder
	that performs actions based on the type of the message, so let's use
	a combination of zero decoder list size and non-zero decoder pointer
	for this.

	This is going to be used later in IFLA_AF_SPEC decoding.

	* nlattr.c (decode_nlattr_with_data): Handle zero size and non-NULL
	decoders in a special way.
	(decode_nlattr): Add an error message about ignoring of opaque_data
	argument when zero size and non-NULL decoders are provided.
	* nlattr.h (decode_nlattr): Add a comment about the new special case.

2018-06-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use STRINGIFY instead of _STR.
	Remove _STR which is essentially the same as STRINGIFY but from
	the namespace where we should not introduce new identifiers.

	* tests/tests.h (_STR): Remove.
	* tests/add_key.c (main): Replace _STR with STRINGIFY.
	* tests/keyctl.c (XARG_STR): Likewise.
	* tests/request_key.c (main): Likewise.

2018-06-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of IFLA_EVENT netlink attribute.
	* tests/nlattr_ifinfomsg.c (main): Add a check for IFLA_EVENT attribute
	decoding.

2018-06-05  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: handle xlat constants that are not identifiers.
	Extend xlat generator to support such input lines as
		IPV4_DEVCONF_FORWARDING-1	0

	This is going to be used later in IFLA_AF_SPEC decoding.

	* xlat/gen.sh (cond_def): If the xlat value is not an identifier name,
	extract an identifier name from the beginning of xlat value.

2018-06-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat.c: handle NULL xlat in lookup routines as incremental search.
	This is going to be used later in IFLA_AF_SPEC decoding.

	* xlat.c (xlookup): Add static variable pos, store xlat there when it is
	non-NULL, use pos for lookup.
	(xlat_search, xlat_idx): Add static variables pos and memb_left, store
	xlat and nmemb there when xlat is non-NULL, use them for lookup.
	(printxvals_ex): Store the last non-NULL xlat in static variable "last".
	If the first xlat argument is NULL, use "last" instead.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-06-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat.c: cleanup printxvals_ex a bit.
	* xlat.c (printxvals_ex): Change "str" variable visibility to the whole
	function, jump to va_end instead of duplicating call and return, return
	!!str.

	Leverage the fact that inet_protocols xlat is sorted.
	* defs.h (inet_protocols): Move up, add description.
	(inet_protocols_size): New declaration.
	* net.c (inet_protocols_size): New constant variable.
	* nlattr.c (decode_nla_ip_proto): Specify xlat_size, set xt to XT_SORTED.

2018-06-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Print arp_hardware_types as a sorted xlat.
	* rtnl_link.c (DECL_NETLINK_ROUTE_DECODER(decode_ifinfomsg)): Use
	PRINT_FIELD_XVAL_SORTED_SIZED instead of PRINT_FIELD_XVAL for
	arp_hardware_types.
	* sock.c (print_ifreq): Likewise.

	Provide a value for arp_hardware_types_size array.
	* defs.h (arp_hardware_types_size): New declaration.
	* sockaddr.c (arp_hardware_types_size): New variable.

2018-06-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	print_fields.h: introduce PRINT_FIELD_XVAL_SORTED_SIZED.
	For those cases when array definition is not readily available
	and should be provided separately.

	* print_fields.h (PRINT_FIELD_XVAL_SORTED_SIZED): New macro.

2018-06-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/opipe.test: remove unneeded run_prog call.
	There is no need to invoke grep using run_prog.

	* tests/opipe.test: Remove run_prog decoration for the grep invocation.

2018-06-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check BPF_OBJ_GET_INFO_BY_FD decoding.
	* tests/bpf-obj_get_info_by_fd-prog-v.c: New file.
	* tests/bpf-obj_get_info_by_fd-prog.c: Likewise.
	* tests/bpf-obj_get_info_by_fd-v.c: Likewise.
	* tests/bpf-obj_get_info_by_fd.c: Likewise.
	* configure.ac (AC_CHECK_HEADERS): Check for struct bpf_insn,
	struct bpf_map_info, and struct bpf_prog_info.
	* tests/pure_executables.list: Add bpf-obj_get_info_by_fd,
	bpf-obj_get_info_by_fd-v, bpf-obj_get_info_by_fd-prog, and
	bpf-obj_get_info_by_fd-prog-v.
	* tests/.gitignore: Likewise.
	* tests/gen_tests.in (bpf-obj_get_info_by_fd,
	bpf-obj_get_info_by_fd-v, bpf-obj_get_info_by_fd-prog,
	bpf-obj_get_info_by_fd-prog-v): New tests.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-06-04  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: enhance BPF_OBJ_GET_INFO_BY_FD decoder further.
	* bpf.c (print_ebpf_prog): Remove "decode" argument, all users updated.
	(print_bpf_prog_info): Use the minimum of xlated_prog_len values on
	entering and exiting syscall as the size of xlated_prog_insns array
	to be decoded.  Likewise, use the minimum of nr_map_ids values on entering
	and exiting syscall as the size of map_ids array to be decoded.

2018-06-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: enhance BPF_OBJ_GET_INFO_BY_FD decoder.
	* bpf.c (print_bpf_map_info): Print only those fields that are
	present in the structure, as it has been growing over time.
	(print_bpf_prog_info): Likewise.  Print map_ids field as an array
	of uint32_t instead of uint64_t; print "name" field.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-06-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: move handling of the saved state to BPF_OBJ_GET_INFO_BY_FD decoder.
	As it is needed for proper info_len printing on exiting.

	* bpf.c (print_bpf_obj_info_fn): Change return type to void, add "saved"
	argument.
	(struct obj_get_info_saved): New type definition.
	(print_bpf_map_info, print_bpf_prog_info): Change return type to void,
	add "saved" argument, do not handle private tcb data allocation and
	obtainment.
	(print_bpf_obj_info_addr): Change return type to void, add tcb argument,
	print the address only on exiting.
	(print_bpf_obj_info): Change return type to void, add "saved" argument.
	(BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD)): Handle private data
	allocation/saving/restoring, use it for storing/printing info_len field.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-06-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: print log_buf field as a string.
	* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)): Print log_buf field
	as a string.
	* tests/bpf.c: Update expected output.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-06-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: print xlated_prog_insns only when xlated_prog_len had not been 0.
	If xlated_prog_len is zero on entering syscall and non-zero on exiting,
	the program itself is not written into xlated_prog_insns.

	* bpf.c (print_ebpf_prog): Add decode argument, print the address only
	if decode is false.
	(BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)): Specify decode == true argument
	to print_ebpf_prog.
	(print_bpf_prog_info): Specify saved xlated_prog_len as decode argument
	to print_ebpf_prog.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-06-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: move print_big_u64_addr inside print_ebpf_prog.
	* bpf.c (print_ebpf_prog): Add static qualifier.  Change the type
	of "addr" argument from kernel_ulong_t to uint64_t, print it using
	print_big_u64_addr.
	(BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD), print_bpf_prog_info): Do not call
	print_big_u64_addr before print_ebpf_prog.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-06-02  Dmitry V. Levin  <ldv@altlinux.org>

	bpf_attr.h: add ATTRIBUTE_ALIGNED(8) to all fields of type uint64_t.
	Our policy is that all fields of type uint64_t in this header file
	must have this attribute.

	This shouldn't cause any contradictions with <linux/bpf.h>
	unless the latter is buggy.

	By word "buggy" I mean containing such changes as Linux kernel commit
	v4.16-rc1~123^2~109^2~5^2~4.

	* bpf_attr.h (struct BPF_MAP_UPDATE_ELEM_struct): Add
	ATTRIBUTE_ALIGNED(8) to "flags" field.
	(struct bpf_prog_info_struct): Add ATTRIBUTE_ALIGNED(8) to "load_time"
	field.

2018-06-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: cast printf arguments to short when %h format qualifier is used.
	Reported by clang.

	* tests/mknod.c (main): Cast printf argument for %#03ho format to short.
	* tests/mknodat.c (main): Likewise.
	* tests/net-sockaddr.c (main): Cast printf argument for %hu format
	to short.
	* tests/semop.c (main): Likewise.

2018-06-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat/evdev_keycode.in: remove constants with duplicating values.
	Those are used for describing input device category and not specific
	button.

	Reported by clang.

	* xlat/evdev_keycode.in (BTN_MOUSE, BTN_JOYSTICK, BTN_GAMEPAD, BTN_DIGI,
	BTN_WHEEL, BTN_TRIGGER_HAPPY): Remove.

2018-06-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	configure.ac: include <sys/socket.h> before <linux/rtnetlink.h>
	This is needed for old Linux UAPI headers that do no contain commit
	v3.1-rc2~19^2~29.

	* configure.ac: Include <sys/socket.h> before <linux/rtnetlink.h>
	in AC_CHECK_* invocations.

2018-06-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	configure.ac: check for linux/rtnetlink.h instead of linux/if_link.h for declarations
	Historically, type definitions and declarations related to netlink route
	interface attributes were in linux/rtnetlink.h, later they were moved
	elsewhere (first linux/if.h, then linux/if_link.h) with the inclusion
	of the corresponding header file in linux/rtnetlink.h.

	* configure.ac: Use <linux/rtnetlink.h> instead of <linux/if_link.h>
	in checks for interface netlink attributes-related declarations
	and definitions.

2018-06-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	m4: move the gawk script from m4/gen_bpf_attr_m4.sh into a separate file
	As it turns out, old versions of gawk do not support -e option.

	* m4/gen_bpf_attr_m4.sh: Move the gawk script ...
	* m4/gen_bpf_attr_m4.awk: ... here.

2018-06-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	s390: wire up kexec_file_load syscall.
	* linux/s390/syscallent.h ([381]): Add kexec_file_load syscall.
	* linux/s390/syscallent.h ([381]): Likewise.

2018-06-01  Zhibin Li  <08826794brmt@gmail.com>

	tests: check short read of struct flock/flock64.
	* tests/fcntl-common.c (test_flock_einval): Check short read
	of struct flock.
	(test_flock64_einval): Check short read of struct flock64.

2018-06-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests: extend struct flock/flock64 decoding checks.
	* tests/fcntl-common.c (test_flock_einval, test_flock): Create
	struct_kernel_flock object using tail_alloc.
	(test_flock64_einval): Create struct_kernel_flock64 object using
	tail_alloc.
	* tests/fcntl64.c (test_flock64_lk64): Likewise.

2018-06-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests: extend F_OFD_* decoding checks.
	Check that non-faulty F_OFD_* fcntl operations are decoded properly.

	* tests/fcntl-common.c: Include <string.h>.
	(test_flock64_ofd): New function.
	(test_flock64): Invoke it, remove [F_OFD_SETLK].

2018-06-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests/fcntl-common.c: define and initialize errstr.
	Initialize errstr inside invoke_test_syscall so that its users
	won't have to go into trouble of caring about clobbering errno.

	* tests/fcntl-common.c (errstr): New variable.
	(invoke_test_syscall): Initialize it.
	(test_flock_einval, test_flock64_einval, test_flock,
	test_f_owner_ex_type_pid): Use it.
	* tests/fcntl.c (test_flock64_undecoded): Likewise.
	* tests/fcntl64.c (test_flock64_lk64): Likewise.

2018-06-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests/fcntl-common.c: add fd argument to invoke_test_syscall.
	Extend invoke_test_syscall for later use with different file
	descriptors.

	* tests/fcntl-common.c (invoke_test_syscall): Add fd argument, pass it
	to TEST_SYSCALL_NR syscall.  All users updated.

2018-06-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests: move F_OFD_SETLK* checks from fcntl64.c to fcntl-common.c.
	This change enables F_OFD_SETLK* tests for fcntl as well.

	* tests/fcntl64.c (test_flock64): Rename to test_flock64_lk64.
	[F_OFD_SETLK]: Remove.
	(test_flock64_einval): Move ...
	* tests/fcntl-common.c: ... here.
	(test_flock64_lk64): New protype.
	(test_flock64_einval, test_flock64): New functions.
	* tests/fcntl.c (test_flock64_einval): Rename to test_flock64_undecoded.
	(TEST_FLOCK64_UNDECODED): New macro.
	(test_flock64): Rename to test_flock64_lk64, replace TEST_FLOCK64_EINVAL
	with TEST_FLOCK64_UNDECODED.

2018-06-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests: move F_OWNER_* tests to fcntl-common.c.
	This change enables F_OWNER_* tests for fcntl64 as well.

	* tests/fcntl.c: Move main, [TEST_FLOCK64_EINVAL],
	and [TEST_F_OWNER_EX] ...
	* tests/fcntl-common.c: ... here.
	(test_flock64): New prototype.
	* tests/fcntl64.c (main): Remove.

2018-06-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rename struct_flock.c to fcntl-common.c.
	It is not limited to struct flock, more fcntl tests are going to land
	in this file.

	* tests/struct_flock.c: Rename to fcntl-common.c.
	* tests/Makefile.am (EXTRA_DIST): Rename struct_flock.c
	to fcntl-common.c.
	* tests/fcntl.c: Likewise.
	* tests/fcntl64.c: Likewise.

2018-05-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of new FRA_* netlink attributes.
	* configure.ac (AC_CHECK_TYPES): Check for struct fib_rule_port_range
	in <linux/fib_rules.h>.
	* tests/nlattr_fib_rule_hdr.c: Include <linux/in.h>.
	(FRA_PROTOCOL, FRA_IP_PROTO, FRA_SPORT_RANGE, FRA_DPORT_RANGE): New
	macro constants.
	[!HAVE_STRUCT_FIB_RULE_PORT_RANGE] (struct fib_rule_port_range): New
	type.
	(main): Check decoding of new FRA_* netlink attributes.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	rtnl_rule: decode new FRA_* attributes.
	* nlattr.h (DECL_NLA(ip_proto), DECL_NLA(rt_proto)): New declarations.
	* nlattr.c (decode_nla_ip_proto): New function.
	* rtnl_route.c (decode_nla_rt_proto): Likewise.
	* rtnl_rule.c (decode_rule_port_rang): Likewise.
	(fib_rule_hdr_nla_decoders) <[FRA_PROTOCOL]>: New attribute, introduced
	by Linux commit v4.17-rc1~148^2~371.
	(fib_rule_hdr_nla_decoders) <[FRA_IP_PROTO], [FRA_SPORT_RANGE],
	[FRA_DPORT_RANGE]>: New attributes, introduced by Linux commit
	v4.17-rc1~148^2~328^2~4.
	* xlat/rtnl_rule_attrs.in (FRA_PROTOCOL, FRA_IP_PROTO, FRA_SPORT_RANGE,
	FRA_DPORT_RANGE): New constants.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	nlattr: introduce decode_nla_xval helper.
	* nlattr.c (decode_nla_xval): New function.
	* nlattr.h: Include "xlat.h".
	(struct decode_nla_xlat_opts): New type.
	(DECL_NLA(xval)): New declaration.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-30  Dmitry V. Levin  <ldv@altlinux.org>

	Move definitions of xlat_type and xlat_style from defs.h to xlat.h.
	* defs.h (enum xlat_type, enum xlat_style, XLAT_STYLE_FORMAT_SHIFT,
	XLAT_STYLE_VERBOSITY_MASK, XLAT_STYLE_FORMAT_MASK, XLAT_STYLE_SPEC_BITS,
	XLAT_STYLE_MASK): Move ...
	* xlat.h: ... here.

	travis: switch from gcc-7 to gcc-8.
	* .travis.yml (matrix): Change gcc-7 to gcc-8.

2018-05-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: use syscall() for ioctl() calls with oversized arguments.
	* tests/ioctl_inotify.c (sys_ioctl): New function.
	(main): Use sys_ioctl for ioctl calls with oversized arguments.
	* tests/ioctl_loop.c: Likewise.
	* tests/ioctl_perf.c: Likewise.

2018-05-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	print_ifindex: respect xlat style settings.
	Print interface indices according to the preferred xlat style settings.

	* print_ifindex.c (INI_PFX, INI_SFX): New helper macros.
	[HAVE_IF_INDEXTONAME] (get_ifname): New function.
	[HAVE_IF_INDEXTONAME] (print_ifindex): Implement as a wrapper around
	get_ifname and print_xlat_ex.

2018-05-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/test_nlattr.h: fix pointer calculation in TEST_NLATTR_ARRAY, take 2
	The old code works only when an array contains exactly two items.

	* tests/test_nlattr.h (TEST_NLATTR_ARRAY): Fix pointer address
	for the case of incomplete read.

2018-05-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	nlattr: print index names in netlink meminfo array.
	* xlat/netlink_sk_meminfo_indices.in: New file.
	* nlattr.c: Include xlat/netlink_sk_meminfo_indices.h.
	(decode_nla_meminfo): Use print_array_ex, pass
	netlink_sk_meminfo_indices as index xlat table.
	* tests/nlattr_inet_diag_msg.c: Update expected output.

2018-05-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Introduce ARRSZ_PAIR macro.
	A shorthand similar to ARG_STR in its purpose: it provides and ability
	to pass an array an its size without variable name duplication.

	* macros.h (ARRSZ_PAIR): New macro.

2018-05-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	print_array: add support for printing array indices.
	* defs.h (XLAT_STYLE_SPEC_BITS, XLAT_STYLE_MASK): New macro constants.
	(tfetch_mem_fn, print_fn): New typedefs.
	(enum print_array_flag_bits, enum print_array_flags): New enumerations.
	(print_array_ex): Rename from print_array, add flags, index_xlat,
	index_xlat_size, and index_dflt arguments.
	(print_array): New static inline function, a thin wrapper around
	print_array_ex.
	util.c: Include "xlat.h".
	(print_array): Rename to print_array_ex, add flags, index_xlat,
	index_xlat_size, and index_dflt arguments.  Print array indices
	according to the style settings specified by flags if PAF_PRINT_INDICES
	is set.

2018-05-29  Dmitry V. Levin  <ldv@altlinux.org>

	Enhance printing of unfetchable object addresses in sequences and arrays
	* btrfs.c (btrfs_print_tree_search): Print the address of unfetchable
	object inside the sequence using printaddr_comment.
	* msghdr.c (decode_msg_control): Likewise.
	* execve.c (printargv): Print the address of unfetchable object inside
	the array using printaddr_comment.
	* netlink.c (fetch_nlmsghdr): Add in_array argument.  When in_array
	is true, print the address of unfetchable object using
	printaddr_comment.
	* nlattr.c (fetch_nlattr): Likewise.
	* tests/execve.c (main): Update expected output.
	* tests/execveat.c (main): Likewise.
	* tests/msg_control.c (test_scm_rights1, test_scm_rights2,
	test_scm_security): Likewise.
	* tests/netlink_protocol.c (send_query): Likewise.
	* tests/nlattr.c (test_nlattr): Likewise.

2018-05-29  Dmitry V. Levin  <ldv@altlinux.org>

	print_array: enhance printing of unfetchable object addresses.
	When umoven_func invocation fails to fetch data, it prints the faulty
	address.  If this happens to a subsequent umoven_func invocation,
	the printed address may be undistinguishable from a valid data printed
	by print_func, e.g. when the data is printed in a numeric form like
	[0x1, 0x2, 0x3, 0xdefaced].

	Fix this source of confusion by moving the printing of the faulty
	address from umoven_func to print_array itself.  This change renames
	umoven_func to tfetch_mem_func and changes its semantics, so that
	 - tfetch_mem_func never prints anything;
	 - tfetch_mem_func returns true if the fetch succeeded,
	   and false otherwise.

	* defs.h (print_array): Replace umoven_func argument with
	tfetch_mem_func.
	* util.c (print_array): Replace umoven_func argument with
	tfetch_mem_func, document expected tfetch_mem_func return value
	semantics.  When tfetch_mem_func returns false, print either addr
	or "... /* addr */" depending on the context (inside the array or not).
	* bpf.c (print_ebpf_prog, print_bpf_prog_info,
	BEGIN_BPF_CMD_DECODER(BPF_PROG_QUERY)): Replace umoven_or_printaddr
	argument of print_array with tfetch_mem.
	* bpf_filter.c (print_bpf_fprog): Likewise.
	* btrfs.c (btrfs_print_logical_ino_container,
	btrfs_print_ino_path_container, btrfs_print_qgroup_inherit,
	btrfs_ioctl): Likewise.
	* dm.c (dm_decode_dm_target_deps): Likewise.
	* epoll.c (epoll_wait_common): Likewise.
	* file_ioctl.c (file_ioctl): Likewise.
	* ipc_sem.c (tprint_sembuf_array): Likewise.
	* kexec.c (print_kexec_segments): Likewise.
	* mem.c (SYS_FUNC(subpage_prot)): Likewise.
	* net.c (print_getsockopt): Likewise.
	* netlink.c (decode_nlmsgerr_attr_cookie): Likewise.
	* netlink_netlink_diag.c (decode_netlink_diag_groups): Likewise.
	* netlink_packet_diag.c (decode_packet_diag_mclist): Likewise.
	* netlink_unix_diag.c (decode_unix_diag_inode): Likewise.
	* nlattr.c (decode_nla_meminfo): Likewise.
	* numa.c (print_nodemask, SYS_FUNC(move_pages),
	* perf_ioctl.c (perf_ioctl_query_bpf): Likewise.
	* poll.c (decode_poll_entering): Likewise.
	* printsiginfo.c (print_siginfo_array): Likewise.
	* rtnl_tc.c (decode_tca_stab_data): Likewise.
	* sock.c (decode_ifconf): Likewise.
	* uid.c (print_groups): Likewise.
	* io.c (SYS_FUNC(io_submit), SYS_FUNC(io_getevents)): Replace
	umoven_or_printaddr argument of print_array with tfetch_mem.
	(tprint_iov_upto): Replace umoven_or_printaddr_ignore_syserror
	with tfetch_mem_ignore_syserror.
	* v4l2.c (print_v4l2_format_fmt): Replace umoven_or_printaddr argument
	of print_array with tfetch_mem.
	(print_v4l2_ext_controls): Replace umoven_or_printaddr_ignore_syserror
	with tfetch_mem_ignore_syserror.
	* mmsghdr.c (fetch_struct_mmsghdr_or_printaddr): Rename
	to fetch_struct_mmsghdr_for_print, do not print address, return bool.
	(decode_mmsgvec): Replace fetch_struct_mmsghdr_or_printaddr
	with fetch_struct_mmsghdr_for_print.
	* tests/aio.c (main): Update expected output.
	* tests/bpf.c (print_BPF_PROG_QUERY_attr5): Likewise.
	* tests/ioctl_perf-success.c (main): Likewise.
	* tests/ioctl_v4l2.c (main): Update expected output.
	* tests/kexec_load.c (main): Likewise.
	* tests/mmsg_name.c (test_mmsg_name): Update expected output.
	* tests/move_pages.c (print_page_array, print_node_array): Likewise.
	* tests/poll.c (print_pollfd_array_entering): Likewise.
	* tests/preadv-pwritev.c (main): Likewise.
	* tests/preadv2-pwritev2.c (dumpio): Likewise.
	* tests/process_vm_readv_writev.c (print_iov): Likewise.
	* tests/pwritev.c (print_iovec): Likewise.
	* tests/readv.c (main): Likewise.
	* tests/seccomp-filter-v.c
	* tests/semop.c (main): Likewise.
	* tests/set_mempolicy.c (print_nodes): Likewise.
	* tests/setgroups.c (main): Likewise.
	* tests/test_nlattr.h (print_nlattr) Likewise.

	Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>

2018-05-29  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce tfetch_* family of functions and macros.
	These new functions are going to be used instead of umove_or_printaddr*
	as umoven_func argument of print_array.

	* defs.h (tfetch_mem64, tfetch_mem64_ignore_syserror): New
	function prototypes.
	(tfetch_mem, tfetch_mem_ignore_syserror): New static inline
	wrappers.
	(tfetch_obj): New macro wrapper around tfetch_mem.
	* util.c (tfetch_mem64, tfetch_mem64_ignore_syserror): New
	functions.
	(umoven_or_printaddr64, umoven_or_printaddr64_ignore_syserror): Use
	them.

2018-05-29  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce printaddr_comment.
	* defs.h (printaddr_comment): New static inline wrapper around
	tprintf_comment.

	Turn printaddr into a thin wrapper around printaddr64.
	* util.c (printaddr): Move ...
	* defs.h: ... here, add "static inline" qualifiers.

2018-05-29  Eugene Syromyatnikov  <evgsyr@gmail.com>

	defs.h: add comments about umove* return values.
	* defs.h (umoven, umoven_or_printaddr64,
	umoven_or_printaddr64_ignore_syserror, umovestr): Add comments about
	return values.

2018-05-28  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use TAIL_ALLOC_OBJECT_CONST_PTR where appropriate.
	* tests/kcmp.c (main): Use TAIL_ALLOC_OBJECT_CONST_PTR.
	* tests/modify_ldt.c (main): Likewise.
	* tests/netlink_protocol.c (send_query): Likewise.
	* tests/ptrace.c (test_peeksiginfo, main): Likewise.
	* tests/s390_guarded_storage.c (main): Likewise.
	* tests/s390_sthyi.c (main): Likewise.
	* tests/xet_thread_area_x86.c (main): Likewise.

2018-05-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: decode bpf_attr.info field used by BPF_OBJ_GET_INFO_BY_FD command.
	* bpf_attr.h [!BPF_TAG_SIZE] (BPF_TAG_SIZE): Define.
	[BPF_TAG_SIZE]: Check that BPF_TAG_SIZE is 8.
	(struct bpf_map_info_struct, struct bpf_prog_info_struct): New
	structures.
	(bpf_map_info_struct_size, expected_bpf_map_info_struct_size,
	bpf_prog_info_struct_size, expected_bpf_prog_info_struct_size): New
	macro constants.
	* bpf.c (print_bpf_obj_info_fn): New type.
	(print_bpf_map_info, print_bpf_prog_info, fetch_bpf_obj_info,
	print_bpf_obj_info_addr, print_bpf_obj_info): New functions.
	(BEGIN_BPF_CMD_DECODER(BPF_OBJ_GET_INFO_BY_FD)): Print bpf_fd and info_len
	fields only on entering, call print_bpf_obj_info for printing info field.
	* tests/bpf.c (BPF_OBJ_GET_INFO_BY_FD_checks): Print info field
	as a pointer.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: add support for checking structures outside union bpf_attr.
	struct bpf_prog_info and bpf_map_info need essentially the same handling
	as union bpf_attr.

	* gen_bpf_attr_check.sh: Derive type_name from $struct if it doesn't
	start with "BPF_", derive TYPE_NAME from type_name, use them in code
	generation.
	* m4/gen_bpf_attr_m4.sh: Rewrite parsing/generation code into awk,
	add support for structures outside union bpf_attr.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-28  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: remove bpf_priv_data.
	As various bpf commands need different data to save between entering
	and exiting of the syscall, do not emulate union bpf_attr approach.

	* bpf.c (struct bpf_priv_data): Remove.
	(DECL_BPF_CMD_DECODER): Remove "struct bpf_priv_data *" argument.
	(BEGIN_BPF_CMD_DECODER(BPF_PROG_QUERY)): Use set_tcb_priv_ulong
	and get_tcb_priv_ulong to keep bpf_attr.query.prog_cnt field.
	(SYS_FUNC(bpf)): Remove priv variable, do not initialize it,
	and do not pass it to bpf_cmd_decoders.

2018-05-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add union bpf_attr.query.prog_ids field decoding checks.
	* tests/bpf-success-v.c: New file.
	* tests/bpf-success.c: Likewise.
	* tests/bpf-success-v.test: New test.
	* tests/bpf-success.test: Likewise.
	* tests/.gitignore: Add bpf-success and bpf-success-v.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add bpf-success.test and bpf-success-v.test.
	* tests/bpf.c [INJECT_RETVAL] (sys_bpf): Check that retuned value
	is equivalent to the injected one; append "(INJECTED)" string to errstr.
	(prog_load_ids, prog_load_ids_ptr): New variables.
	(init_BPF_PROG_QUERY_attr4, print_BPF_PROG_QUERY_attr4,
	init_BPF_PROG_QUERY_attr5, print_BPF_PROG_QUERY_attr5): New functions.
	(BPF_PROG_QUERY_checks): Drop "const" qualifier, add new checks.

	bpf: BPF_PROG_QUERY bpf_attr.query.prog_ids printing fixes.
	* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_PROG_QUERY)): Use
	print_uint32_array_member instead of print_uint64_array_member for
	printing prog_ids elements (and change the type of prog_id_buf from
	uint64_t to uint32_t), as they are 32-bit; use common trick with
	print_big_u64_addr for handling possible ambiguity with prog_ids
	address.
	* tests/bpf.c (BIG_ADDR_MAYBE): New macro.
	(BPF_PROG_QUERY_checks): Update expected output.

	bpf: add support for instruction decoding.
	* xlat/ebpf_regs.in: New file.
	* bpf.c (struct ebpf_insn, struct ebpf_insns_data): New type definitions.
	(print_ebpf_insn, print_ebpf_prog): New functions.
	(DEF_BPF_CMD_DECODER(BPF_PROG_LOAD)): Use them.

2018-05-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of successful PERF_EVENT_IOC_{ID,QUERY_BPF} ioctls
	As these have some argument output on the exit path.

	* tests/ioctl_perf-success.c: New file.
	* tests/ioctl_perf-success.test: New test.
	* tests/Makefile.am (DECODER_TESTS): Add it.
	(check_PROGRAMS): Add ioctl_perf-success.
	* tests/.gitignore: Likewise.
	* tests/ioctl_perf.c: Remove TODO.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Implement PERF_EVENT_IOC_* decoding.
	* perf.c (fetch_perf_event_attr, print_perf_event_attr): Remove "static"
	qualifier.
	* defs.h (fetch_perf_event_attr, print_perf_event_attr): New
	declarations.
	* perf_event_struct.h (struct perf_event_query_bpf): New type
	definition.
	* perf_ioctl.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* xlat/perf_ioctl_cmds.in: New file.
	* xlat/perf_ioctl_flags.in: Likewise.
	* ioctl.c (ioctl_decode) <case '$'>: Call perf_ioctl.
	* tests/gen_tests.in (ioctl_perf): New test.
	* tests/ioctl_perf.c: New file.
	* tests/pure_executables.list: ioctl_perf.
	* tests/.gitignore: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-28  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix ipc_msgbuf.test.
	* tests/ipc_msgbuf.test: Fix -a argument.

2018-05-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update IPPROTO_* constants.
	* xlat/inet_protocols.in (IPPROTO_GGP, IPPROTO_HELLO, IPPROTO_ND):
	Remove, not defined in Linux.
	(IPPROTO_BEETPH): New constant, introduced by Linux commit
	v2.6.19-rc1~33^2.
	(IPPROTO_L2TP): New constant, introduced by Linux commit
	v2.6.35-rc1~473^2~594.
	(IPPROTO_MH): New constant, introduced by Linux commit
	v2.6.19-rc1~1272^2~157.
	Add default values to constants, sort the file.

	xlat: add fallback definitions to RTPROT_* constants.
	* xlat/routing_protocols.in: Add default values to constants.

	xlat: add SECCOMP_FILTER_FLAG_SPEC_ALLOW.
	* xlat/seccomp_filter_flags.in (SECCOMP_FILTER_FLAG_SPEC_ALLOW): New
	constant, introduced by Linux commit v4.17-rc3-24-g00a02d0.
	* tests/seccomp-filter.c: Update expected output.
	* tests/seccomp-filter-v.c: Likewise.

	prctl: add PR_GET_SPECULATION_CTRL/PR_SET_SPECULATION_CTRL decoding.
	* xlat/pr_spec_cmds.in: New fille.
	* xlat/pr_spec_get_store_bypass_flags.in: Likewise.
	* xlat/pr_spec_set_store_bypass_flags.in: Likewise.
	* xlat/prctl_options.in (PR_GET_SPECULATION_CTRL,
	PR_SET_SPECULATION_CTRL): New constants, introduced by Linux commit
	v4.17-rc3-15-gb617cfc.
	* prctl.c (SYS_FUNC(prctl)) <case PR_GET_SPECULATION_CTRL,
	case PR_SET_SPECULATION_CTRL>: Implement decoding of new prctl options.
	* tests/Makefile.am (check_PROGRAMS): Add prctl-spec-inject.
	(DECODER_TESTS): Add prctl-spec-inject.test.
	* tests/prctl-spec-inject.c: New file.
	* tests/prctl-spec-inject.test: New test.
	* tests/.gitignore: Add prctl-spec-inject.

	tests: add keyctl variants with different xlat verbosity levels.
	* tests/keyctl-Xabbrev.c: New file.
	* tests/keyctl-Xraw.c: Likewise.
	* tests/keyctl-Xverbose.c: Likewise.
	* tests/keyctl.c (XARG_STR): New macro.
	(do_keyctl): Print command in accordance with XLAT_RAW/XLAT_VERBOSE settings.
	(main): Update expected output.
	* tests/pure_executables.list: Add keyctl-Xabbrev, keyctl-Xraw,
	and keyctl-Xverbose.
	* tests/.gitignore: Likewise.
	* tests/gen_tests.in (keyctl-Xabbrev, keyctl-Xraw, keyctl-Xverbose): New
	tests.

	keyctl: print KEYCTL_SET_REQKEY_KEYRING argument as an integer.
	* xlat/key_reqkeys.in: Add #val_type int.
	* keyctl.c (SYS_FUNC(keyctl)) <case KEYCTL_SET_REQKEY_KEYRING>: Print
	arg2 as an integer.
	* tests/keyctl.c: Update expected output.

	keyctl: respect xlat style when printing errno.
	* keyctl.c (keyctl_reject_key): Use print_xlat_ex for printing error
	argument.

2018-05-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	syscall.c: unify error value printing.
	There's little reason not to decode error code for syscalls printed in
	raw; moreover, it creates inconsistencies for unknown syscall printing.

	Another issue was with error numbers unknown to strace: previously, they
	were printed as "... = -1 1234 (Unknown error 1234)" which looked kinda
	weird.

	* syscall.c (print_err_ret): New function.
	(syscall_exiting_trace): Remove u_error variable, use tcp->u_error
	instead. Remove u_error_str variable.
	(syscall_exiting_trace) <if (raw(tcp))>: Call print_err_ret if u_error
	is non-zero.
	(syscall_exiting_trace) <if (!(sys_res & RVAL_NONE) && tcp->u_error)>:
	Use print_err_ret for default error printing.
	* tests/nsyscalls.c [!LINUX_MIPSO32] (test_syscall): Update expected
	output.
	* tests/qual_fault.c (invoke) <if (is_raw)>: Likewise.
	* strace.1.in (.SH DESCIPTION): Update unknown syscall example.

2018-05-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ioctl: implement INOTIFY_IOC_SETNEXTWD decoding.
	* inotify_ioctl.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (DECL_IOCTL(inotify)): New declaration.
	* ioctl.c (ioctl_decode) <case 'I'>: Call inotify_ioctl.
	* tests/ioctl_inotify.c: New file.
	* tests/.gitignore: Add ioctl_inotify.
	* tests/pure_executables.list: Likewise.
	* tests/gen_tests.in (ioctl_inotify): New test.

	tests/test_nlattr.h: avoid testing cropped objects of size 1.
	* tests/test_nlattr.h (TEST_NLATTR_OBJECT_EX_): Check
	"len < sizeof(obj_)" case only if "sizeof(obj_) > 1".

	tests: pass index to print_elem_ callback in TEST_NLATTR_ARRAY.
	* tests/test_nlattr.h (TEST_NLATTR_ARRAY): Pass array index to the
	print_elem_ callback.
	* tests/nlattr_inet_diag_msg.c (print_uint): Add index argument.
	* tests/nlattr_netlink_diag_msg.c (print_xlong): Likewise.
	* tests/nlattr_packet_diag_msg.c (print_packet_diag_mclist,
	print_sock_filter): Likewise.
	* tests/nlattr_unix_diag_msg.c (print_uint): Likewise.

2018-05-24  Dmitry V. Levin  <ldv@altlinux.org>

	tests: further cleanup bpf big address checks.
	Replace BIG_ADDR_IS_64BIT and BIG_ADDR_IS_32BIT with BIG_ADDR().

	* tests/bpf.c (BIG_ADDR): New macro.
	(BIG_ADDR_IS_64BIT, BIG_ADDR_IS_32BIT): Remove.
	(BPF_PROG_LOAD_checks, BPF_OBJ_PIN_checks,
	BPF_RAW_TRACEPOINT_OPEN_checks): Use BIG_ADDR() instead of
	BIG_ADDR_IS_64BIT and BIG_ADDR_IS_32BIT.

2018-05-23  Dmitry V. Levin  <ldv@altlinux.org>

	tests: cleanup bpf big address checks.
	Introduce BIG_ADDR_IS_64BIT and BIG_ADDR_IS_32BIT to reduce redundancy.

	* tests/bpf.c (BIG_ADDR_IS_64BIT, BIG_ADDR_IS_32BIT): New macros.
	(BPF_PROG_LOAD_checks, BPF_OBJ_PIN_checks,
	BPF_RAW_TRACEPOINT_OPEN_checks): Use them.

2018-05-23  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: add support for BPF_RAW_TRACEPOINT_OPEN command decoding.
	* bpf_attr.h (struct BPF_RAW_TRACEPOINT_OPEN_struct): New type
	definition.
	(BPF_RAW_TRACEPOINT_OPEN_struct_size,
	expected_BPF_RAW_TRACEPOINT_OPEN_struct_size): New macros.
	* xlat/bpf_commands.in (BPF_RAW_TRACEPOINT_OPEN): New constant,
	introduced by Linux commit v4.17-rc1~148^2~19^2~4^2~3.
	* xlat/bpf_prog_types.in (BPF_PROG_TYPE_RAW_TRACEPOINT): Likewise.
	* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_RAW_TRACEPOINT_OPEN)): New bpf
	command decoder.
	(SYS_FUNC(bpf)) <bpf_cmd_decoders[]>: Add
	BPF_CMD_ENTRY(BPF_RAW_TRACEPOINT_OPEN).
	* tests/bpf.c (union bpf_attr_data): Add
	BPF_ATTR_DATA_FIELD(BPF_RAW_TRACEPOINT_OPEN).
	(BPF_PROG_LOAD_checks): Update.
	(init_BPF_RAW_TRACEPOINT_attr2): New function.
	(BPF_RAW_TRACEPOINT_OPEN_checks): New checks array.
	(main) <checks>: Add CHK(BPF_RAW_TRACEPOINT_OPEN).

	bpf: add support for decoding struct bpf_attr.expected_attach_type field
	* bpf_attr.h (struct BPF_PROG_LOAD_struct): Add expected_attach_type
	field.
	(BPF_PROG_LOAD_struct_size): Update to offsetofend of
	expected_attach_type field.
	(expected_BPF_PROG_LOAD_struct_size): Update to 72.
	* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)): Decode
	expected_attach_type field.
	* tests/bpf.c: Update expected output.

2018-05-23  Eugene Syromyatnikov  <evgsyr@gmail.com>

	nlattr: do not assume that SK_MEMINFO_VARS is constant.
	SK_MEMINFO_VARS changes over time (as it was in Linux commit
	v4.7-rc1~154^2~354^2~4, for example), so we cannot use it
	for sanity checks.

	* nlattr.c (print_meminfo): Remove.
	(decode_nla_meminfo): Use generic print_uint32_array_member element
	printer callback.
	* tests/nlattr_inet_diag_msg.c (main): Update expected output.

2018-05-23  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Introduce print_uint32_array_member helper function.
	Analogous to print_int32_array_member, this helper is going to be used
	in various decoders, including BPF_PROG_QUERY, PERF_EVENT_IOC_*,
	and netlink meminfo.

	* defs.h (print_uint32_array_member): New declaration.
	* util.c (print_uint32_array_member): New function.

2018-05-23  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Introduce print_int32_array_member helper function.
	Analogous to print_uint64_array_member, this helper is going to be used
	for IFLA_AF_SPEC decoding.

	* defs.h (print_int32_array_member): New declaration.
	* util.c (print_int32_array_member): New function.

2018-05-23  Eugene Syromyatnikov  <evgsyr@gmail.com>

	defs.h: move print_uint64_array_member and print_array declarations down
	In preparation for the forthcoming changes.

2018-05-23  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/test_nlattr.h: fix pointer calculation in TEST_NLATTR_ARRAY.
	The old code works only when an array contains exactly two items.

	* tests/test_nlattr.h (TEST_NLATTR_ARRAY): Fix pointer address
	for the case of incomplete read.

2018-05-23  Eugene Syromyatnikov  <evgsyr@gmail.com>

	sockaddr: add support for sockaddr_l2 without l2_bdaddr_type.
	Apparently, struct sockaddr_l2 changed over time: the l2_bdaddr_type
	field was added only by commit v3.5-rc1~35^2~3^2~18^2^2~39.

	* configure.ac (AC_CHECK_HEADERS): Move bluetooth/bluetooth.h check into
	a separate check.
	(AC_CHECK_HEADERS([bluetooth/bluetooth.h])): New check, also checks for
	struct sockaddr_l2.l2_bdaddr_type member in case of success.
	* sockaddr.c (print_sockaddr_data_bt) <case offsetof(struct sockaddr_l2,
	l2_bdaddr_type)>: Add to sizeof(struct sockaddr_l2) case. Print
	l2_bdaddr_type field only if the provided sockaddr is big enough.
	* tests/net-sockaddr.c (check_l2): Put l2_bdaddr_type usage/printing
	under HAVE_STRUCT_SOCKADDR_L2_L2_BDADDR_TYPE ifdef, add a check for the
	sockaddr_l2 structure without the l2_bdaddr_type field.

2018-05-23  Eugene Syromyatnikov  <evgsyr@gmail.com>

	sock: guess ifr_hwaddr size in SIOCSIFHWADDR/SIOCGIFHWADDR.
	And make the output more structured.

	* sock.c: Include xlat/arp_hardware_types.h in XLAT_MACROS_ONLY mode.
	(print_ifreq) <case SIOCSIFHWADDR, case SIOCGIFHWADDR>: Introduce
	hwaddr_sizes array, print ifr_hwaddr.sa_family, print ifr_hwaddr.sa_data
	using hwaddr_sizes and PRINT_FIELD_MAC_SZ.

2018-05-22  Dmitry V. Levin  <ldv@altlinux.org>

	Simplify errnoent and signalent.
	Remove personality support for errnoent and signalent as
	there is nothing personality-specific in these files.

	* linux/aarch64/errnoent1.h: Remove.
	* linux/aarch64/signalent1.h: Likewise.
	* linux/powerpc64/errnoent1.h: Likewise.
	* linux/powerpc64/signalent1.h: Likewise.
	* linux/riscv/errnoent1.h: Likewise.
	* linux/riscv/signalent1.h: Likewise.
	* linux/s390x/errnoent1.h: Likewise.
	* linux/s390x/signalent1.h: Likewise.
	* linux/sparc64/errnoent1.h: Likewise.
	* linux/sparc64/signalent1.h: Likewise.
	* linux/tile/errnoent1.h: Likewise.
	* linux/tile/signalent1.h: Likewise.
	* linux/x32/errnoent1.h: Likewise.
	* linux/x32/signalent1.h: Likewise.
	* linux/x86_64/errnoent1.h: Likewise.
	* linux/x86_64/errnoent2.h: Likewise.
	* linux/x86_64/signalent1.h: Likewise.
	* linux/x86_64/signalent2.h: Likewise.
	* Makefile.am (EXTRA_DIST): Remove them.
	* defs.h (errnoent0): Rename to errnoent.
	(signalent0): Rename signalent.
	(nerrnos, nsignals): Change to const variables unconditionally.
	* syscall.c (errnoent0): Rename to errnoent.
	(signalent0): Rename signalent.
	(nerrnos, nsignals): Change to const variables unconditionally.
	(nerrnos0, nsignals0): Remove.
	[SUPPORTED_PERSONALITIES > 1] (errnoent1, signalent1, nerrnos1,
	nsignals1): Remove.
	[SUPPORTED_PERSONALITIES > 2] (errnoent2, signalent2, nerrnos2,
	nsignals2): Likewise.
	(set_personality): Do not assign errnoent, signalent, nerrnos,
	and nsignals.

2018-05-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1.in: mention -Xraw in -eraw description.
	* strace.1.in (\fB\-e\ raw\fR=\,\fIset\fR): Mention -X raw.

2018-05-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1.in: display -k option description only if it is enabled.
	Leverage the fact that manpage is generated and add condition statements
	around mentions of -k option.

	* strace.1.in (.SH SYNOPSIS): Put option list inside an
	".if '@ENABLE_STACKTRACE_TRUE@'#' .ig end_unwind_opt ... .end_unwind_opt"
	condition; add a second list of options without -k and put it inside
	".if '@ENABLE_STACKTRACE_FALSE@'#' .ig end_no_unwind_opt ... .end_no_unwind_opt"
	condition.
	(.SS Output format) <-k>: Put it inside
	".if '@ENABLE_STACKTRACE_TRUE@'#' .ig end_unwind ... .end_unwind"
	condition, remove the mention of --enable-stacktrace configuration
	option requirement.

2018-05-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1.in: format a reference to "open" syscall using bold font.
	* strace.1.in (.SH DESCRIPTION): Format a reference to "open" syscall
	using bold font.

	tests/qual_fault.test: add -efu arguments to the interpreter.
	* tests/qual_fault.test (#!/bin/sh): Add -efu arguments.

2018-05-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/qual_fault.test: swap expected/output files in match_diff calls.
	match_diff expects the first argument as strace output and the second
	argument as expected output.

	* tests/qual_fault.test (check_fault_injection): Swap arguments
	in match_diff calls.

2018-05-21  Dmitry V. Levin  <ldv@altlinux.org>

	defs.h: convert some macro wrappers into static inline functions.
	* defs.h (pathtrace_select, pathtrace_match, printxval_searchn,
	printxval_indexn, sprintxval, sprintflags, printnum_slong,
	printnum_ulong, printnum_ptr, printnum_kptr): Convert macro wrappers
	into static inline functions.

2018-05-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add support for xlat_styles in printxval_dispatch.
	* defs.h (printxval_dispatch_ex): Rename from printxval_dispatch, add
	style argument.
	(printxval_dispatch): New static inline function, a thin wrapper around
	printxval_dispatch_ex.
	* xlat.c (printxval_dispatch): Rename to printxval_dispatch_ex, add
	style argument, handle it.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Make printxval_dispatch publicly available.
	* evdev.c (enum xlat_type, printxval_dispatch): Move elsewhere.
	* defs.h (enum_xlat_type): Move from evdev.c.
	(printxval_dispatch): New declaration.
	* xlat.c (printxval_dispatch): Move from evdev.c, drop static qualifier.

2018-05-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Revert "evdev: remove XT_NORMAL"
	This reverts commit cc52da10c6f13feba577a83088f34916c6350165
	in preparation for printxval_dispatch generalisation.

	* evdev.c (enum xlat_type): Add XT_NORMAL back.
	(printxval_dispatch): Handle XT_NORMAL again.

2018-05-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	defs.h: introduce is_bigendian macro.
	This macro is going to be used in inline checks.

	* defs.h (is_bigendian): New macro constant.

2018-05-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util.c: make memory allocation error messages more informative.
	As those are pretty unusual, let's add some additional information
	that can be reported by users.

	* util.c (print_quoted_string_ex, dumpstr): Add reasons for memory
	allocation errors.
	(sizeof_iov): Change type from size_t to unsigned int.
	(dumpiov_upto): Rewrite size initialisation similarly to the way it's
	done in print_quoted_string_ex, add reasons for memory allocation errors.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1.in: fix -A description.
	* strace.1.in (.SS Output format) <-A>: Add missing .B.

	strace.1.in: document x32 64-bit syscall peculiarity.
	* strace.1.in (.SH NOTES): Document "#64" suffix for 64-bit syscalls on
	x32.

2018-05-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	linux/x32/syscallent.h: change 64-bit syscall designation.
	The current way of designation of 64-bit specific syscalls in x32
	personality not only conflicts with fault injection specification
	syntax, but also makes it impossible to specify such syscalls at all
	(since everything that starts from a digit is considered a syscall
	number specification).  So, let's change prefix to suffix and use
	octothorpe instead of colon as a separator.

	* linux/x32/syscallent.h (13, 15, 16, 19, 20, 45, 46, 47, 54, 55, 59,
	101, 127, 128. 129, 131, 134, 156, 174, 177, 178, 180, 205, 206, 209,
	211, 214, 215, 222, 236, 244, 246, 247, 273, 274, 278, 279, 295, 296,
	297, 299, 307, 310, 311, 32, 327, 328): Change "64:" prefix to "#64"
	suffix in syscall name.

	Closes: https://github.com/strace/strace/issues/36

2018-05-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add BPF_PROG_TYPE_SK_MSG.
	* xlat/bpf_prog_types.in (BPF_PROG_TYPE_SK_MSG): New constant,
	introduced by Linux commit v4.17-rc1~148^2~156^2~1^2~13.
	* tests/bpf.c (BPF_PROG_LOAD_checks): Update expected output.

	xlat: update bpf_attach_type constants.
	* xlat/bpf_attach_type.in (BPF_SK_MSG_VERDICT): New constant,
	introduced by Linux commit v4.17-rc1~148^2~156^2~1^2~13.
	(BPF_CGROUP_INET4_BIND, BPF_CGROUP_INET6_BIND): New constants,
	introduced by Linux commit v4.17-rc1~148^2~19^2^2~6.
	(BPF_CGROUP_INET4_CONNECT, BPF_CGROUP_INET6_CONNECT): New constants,
	introduced by Linux commit v4.17-rc1~148^2~19^2^2~3.
	(BPF_CGROUP_INET4_POST_BIND, BPF_CGROUP_INET6_POST_BIND): New constants,
	introduced by Linux commit v4.17-rc1~148^2~19^2^2~1.
	* tests/bpf.c (BPF_PROG_QUERY_checks): Update expected output.

2018-05-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat/sock_rds_options.in: make it sorted.
	Define SO_TIMESTAMP twice, for PA-RISC and all the other architectures.

	* xlat/sock_rds_options.in [!__hppa__] (SO_TIMESTAMP): Define to 29.
	[__hppa__] (SO_TIMESTAMP): Define to 0x4012.
	* net.c (print_sockopt_fd_level_name) <case SOL_RDS>: Use
	printxval_search instead of printxval.

2018-05-17  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Update ioctl entries from linux v4.17.
	* linux/32/ioctls_inc_align16.h: Update from linux v4.17-rc5
	using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* linux/i386/ioctls_arch0.h: Likewise.
	* linux/x86_64/ioctls_arch0.h: Likewise.
	* NEWS: Mention this.

	maint: update for linux 4.17-rc5.
	* maint/ioctls_sym.sh: (x86_list): Add KVM_HYPERV_EVENTFD.

2018-05-16  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: use indexed lookups where appropriate.
	* xlat/bpf_attach_type.in: Add "#value_indexed" directive.
	* xlat/bpf_class.in: Likewise.
	* xlat/bpf_map_types.in: Likewise.
	* xlat/bpf_map_update_elem_flags.in: Likewise.
	* xlat/bpf_prog_types.in: Likewise.
	* xlat/ebpf_class.in: Likewise.
	* bpf_filter.c (print_bpf_filter_code): Use printxval_index
	instead of printxval for decoding bpf_class and ebpf_class.
	* print_fields.h (PRINT_FIELD_XVAL_INDEX): New macro.
	* bpf.c: Use it instead of PRINT_FIELD_XVAL for decoding bpf_attach_type,
	bpf_map_types, bpf_map_update_elem_flags, and bpf_prog_types.

2018-05-15  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: use printxval_index lookup instead of printxval.
	* xlat/bpf_commands.in: Add "#value_indexed" directive.
	* bpf.c (SYS_FUNC(bpf)): Use printxval_index instead of printxval.

	time: use indexed lookups.
	* defs.h (xlat_idx): New prototype.
	* xlat.c (xlat_idx): Remove static qualifier.
	* time.c (do_adjtimex): Use xlat_idx instead of xlookup.
	(SYS_FUNC(getitimer), SYS_FUNC(setitimer)): Use printxval_index
	instead of printxval.
	[ALPHA] (SYS_FUNC(osf_getitimer), SYS_FUNC(osf_setitimer)): Likewise.
	(printclockname) [CLOCKID_TO_FD]: Likewise.
	* xlat/adjtimex_state.in: Add "#value_indexed" directive.
	* xlat/clocknames.in: Likewise.
	* xlat/cpuclocknames.in: Add "#value_indexed" directive, add default
	values to constants.
	* xlat/itimer_which.in: Likewise.

2018-05-15  Andre McCurdy  <armccurdy@gmail.com>

	linux/arm/raw_syscall.h: avoid r7 specified register variables with Thumb
	If Thumb code is being generated and frame pointers are enabled, the
	Thumb frame pointer in r7 clashes with any local variable which may
	need to be assigned to r7 (e.g. the syscall NR when making a raw
	syscall).

	With gcc, the double use of r7 results in a build error, e.g.

	  strace-4.22/tests/inject-nf.c:86:1: error: r7 cannot be used in asm here

	With clang, the double use of r7 can result in the compiler silently
	generating broken code which crashes at run time due to frame pointer
	corruption:

	  https://bugs.llvm.org/show_bug.cgi?id=34165

	In most cases the problem isn't visible as frame pointers will be
	disabled automatically due to optimisation level. However to handle
	cases where frame pointers are enabled (e.g. when CFLAGS etc are set
	to support a debug build, etc) provide a version of raw_syscall_0
	which manually saves and restores the frame pointer value in r7
	to a temporary register before setting up the syscall NR in r7
	and invoking the syscall.

	* linux/arm/raw_syscall.h (raw_syscall_0) [__thumb__]: Provide
	an alternative version.

2018-05-15  Dmitry V. Levin  <ldv@altlinux.org>

	sockaddr: use printxval_index lookup instead of printxval.
	* xlat/addrfams.in: Add "#value_indexed" directive.
	* xlat/af_packet_types.in: Likewise.
	* xlat/hci_channels.in: Likewise.
	* sockaddr.c (print_sockaddr_data_bt, print_sockaddr,
	* print_sockaddr_data_ll): Use printxval_index instead of printxval.

2018-05-15  Eugene Syromyatnikov  <evgsyr@gmail.com>

	sockaddr: use printxval_search for ARPHRD_* constants.
	This xlat table is quite big.

	* sockaddr.c (print_sockaddr_data_ll): Replace printxval call with
	printxval_search for printing of struct sockaddr_ll.sll_hatype field.

2018-05-15  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add a common MAC address printing routine.
	* print_mac.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (sprint_mac_addr): New declaration.
	(print_mac_addr): New function, a thin wrapper around sprint_mac_addr.
	* print_fields.h (PRINT_FIELD_MAC, PRINT_FIELD_MAC_SZ): New macros.
	* rtnl_link.c (decode_ifla_bridge_id): Use PRINT_FIELD_MAC for bridge
	address printing.
	* sock.c (print_ifreq) <case SIOCGIFHWADDR>: Use print_mac_addr for
	ifr_hwaddr printing.
	* sockaddr.c (print_sockaddr_data_bt): Use print_mac_addr for
	{sco,rc,l2}_bdaddr field printing.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-15  Eugene Syromyatnikov  <evgsyr@gmail.com>

	sockaddr: decode Bluetooth L2 CID values.
	* xlat/bluetooth_l2_cid.in: New file.
	* sockaddr.c: Include xlat/bluetooth_l2_cid.h.
	(print_bluetooth_l2_cid): New function.
	(print_sockaddr_data_bt): Use it to decode struct sockaddr_l2.l2_cid
	field.
	* tests/net-sockaddr.c (check_l2): Update expected output.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-15  Eugene Syromyatnikov  <evgsyr@gmail.com>

	sockaddr: decode Bluetooth L2 PSM values.
	* xlat/bluetooth_l2_psm.in: New file.
	* sockaddr.c: Include xlat/bluetooth_l2_psm.h.
	(print_bluetooth_l2_psm): New function.
	(print_sockaddr_data_bt): Use it to decode struct sockaddr_l2.l2_psm
	field.
	* tests/net-sockaddr.c (check_l2): Update expected output.

	sockaddr: decode bluetooth address type names.
	* xlat/bdaddr_types.in: New file.
	* sockaddr.c: Include xlat/bdaddr_types.h.
	(print_sockaddr_data_bt): Decode struct sockaddr_l2.l2_bdaddr_type field
	using constants from bdaddr_types xlat.
	* tests/net-sockaddr.c (check_l2): Check decoding
	of struct sockaddr_l2.l2_bdaddr_type field.

2018-05-15  Eugene Syromyatnikov  <evgsyr@gmail.com>

	sockaddr: decode Bluetooth socket address unconditionally.
	* sockaddr.c [HAVE_BLUETOOTH_BLUETOOTH_H]: Do not include
	bluetooth/bluetooth.h, bluetooth/hci.h, bluetooth/l2cap.h,
	bluetooth/rfcomm.h, and bluetooth/sco.h.
	[!HAVE_BLUETOOTH_BLUETOOTH_H]: Include xlat/hci_channels.h.
	(btohs): New function.
	(print_sockaddr_data_bt): Define unconditionally, add definitions
	of struct sockaddr_hci, struct bdaddr, struct sockaddr_sco,
	struct sockaddr_rc, and struct sockaddr_l2.
	(sa_printers) <AF_BLUETOOTH>: Define unconditionally.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-15  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Avoid using print_array as a local variable name.
	We have a function with the same name.

	* netlink.c (decode_netlink) <print_array>: Rename to is_array, all
	users updated.
	* nlattr.c (decode_nlattr) <print_array>: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-15  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update MSG_* constants.
	Sync them with kernel's include/linux/socket.h, since syscalls perform
	almost no checks for incorrect flags.

	* xlat/msg_flags.in (MSG_OOB, MSG_PEEK, MSG_DONTROUTE, MSG_CTRUNC,
	MSG_PROBE, MSG_TRUNC, MSG_DONTWAIT, MSG_EOR, MSG_WAITALL, MSG_FIN,
	MSG_SYN, MSG_CONFIRM, MSG_RST, MSG_ERRQUEUE, MSG_NOSIGNAL, MSG_MORE,
	MSG_WAITFORONE, MSG_FASTOPEN, MSG_CMSG_CLOEXEC): Add default values
	to all constants.
	(MSG_SENDPAGE_NOTLAST, MSG_NO_SHARED_FRAGS): New constants.  It is
	an internal one, but, apparently, nothing prohibits passing it
	to the kernel.
	(MSG_CMSG_COMPAT): New constant.  Override the value provided
	by system headers.
	(MSG_EOF): Commented out, as it is a synonym for MSG_FIN.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-14  Dmitry V. Levin  <ldv@altlinux.org>

	socketutils: use exact match of unix domain sockets on fresh kernels.
	* socketutils.c (unix_send_query): Do not add NLM_F_DUMP to nlmsg_flags
	when kernel version is 4.4.4 or later, initialize udiag_cookie
	unconditionally.

	Complements: v4.12~536 ("Change unix_diag requests back to use full dump instead of exact match")

2018-05-14  Eugene Syromyatnikov  <evgsyr@gmail.com>

	socketutils: do not request NDIAG_SHOW_MEMINFO.
	This information is not used and it looks like it negatively affects
	ability to find the socket under high load.

	* socketutils.c (netlink_send_query) <req>: Remove NDIAG_SHOW_MEMINFO
	flag from netlink_diag_req.ndiag_show field.
	* tests/netlink_netlink_diag.c (send_query) <req>: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: introduce midtail_alloc and use it in netlink tests.
	netlink tests happen to access memory located before the tail_malloc'ed
	pointers, a practice that doesn't go well with the latest compilers
	because tail_malloc is marked with ATTRIBUTE_MALLOC.
	For example, glibc in -D_FORTIFY_SOURCE=2 mode and gcc 8 with
	-Warray-bounds enabled complain about negative offsets out of bounds.
	Fix this issue by introducing midtail_alloc.

	* tests/tests.h (midtail_alloc): New macro.
	* tests/netlink_crypto.c: Use it instead of tail_malloc for nlh0 allocation.
	* tests/netlink_netfilter.c: Likewise.
	* tests/netlink_protocol.c: Likewise.
	* tests/netlink_route.c: Likewise.
	* tests/netlink_selinux.c: Likewise.
	* tests/netlink_sock_diag.c: Likewise.
	* tests/nlattr_br_port_msg.c: Likewise.
	* tests/nlattr_crypto_user_alg.c: Likewise.
	* tests/nlattr_dcbmsg.c: Likewise.
	* tests/nlattr_fib_rule_hdr.c: Likewise.
	* tests/nlattr_ifaddrlblmsg.c: Likewise.
	* tests/nlattr_ifaddrmsg.c: Likewise.
	* tests/nlattr_ifinfomsg.c: Likewise.
	* tests/nlattr_ifla_brport.c: Likewise.
	* tests/nlattr_ifla_port.c: Likewise.
	* tests/nlattr_ifla_xdp.c: Likewise.
	* tests/nlattr_inet_diag_msg.c: Likewise.
	* tests/nlattr_inet_diag_req_compat.c: Likewise.
	* tests/nlattr_inet_diag_req_v2.c: Likewise.
	* tests/nlattr_mdba_mdb_entry.c: Likewise.
	* tests/nlattr_mdba_router_port.c: Likewise.
	* tests/nlattr_ndmsg.c: Likewise.
	* tests/nlattr_ndtmsg.c: Likewise.
	* tests/nlattr_netconfmsg.c: Likewise.
	* tests/nlattr_netlink_diag_msg.c: Likewise.
	* tests/nlattr_nlmsgerr.c: Likewise.
	* tests/nlattr_packet_diag_msg.c: Likewise.
	* tests/nlattr_rtgenmsg.c: Likewise.
	* tests/nlattr_rtmsg.c: Likewise.
	* tests/nlattr_smc_diag_msg.c: Likewise.
	* tests/nlattr_tc_stats.c: Likewise.
	* tests/nlattr_tca_stab.c: Likewise.
	* tests/nlattr_tcamsg.c: Likewise.
	* tests/nlattr_tcmsg.c: Likewise.
	* tests/nlattr_unix_diag_msg.c: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Use MIN where appropriate.
	* netlink.c (decode_nlmsghdr_with_payload): Use MIN.
	* netlink_packet_diag.c (print_packet_diag_mclist): Likewise.
	* nlattr.c (decode_nlattr_with_data): Likewise.
	* rtnl_route.c (decode_rta_multipath): Likewise.

2018-05-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add fallback definitions to {msg,sem,shm}ctl command constants.
	* xlat/msgctl_flags.in: Add default values to all constants, reorder
	to make them sorted by value.
	* xlat/semctl_flags.in: Likewise.
	* xlat/shmctl_flags.in: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add MSG_STAT_ANY.
	* xlat/msgctl_flags.in (MSG_STAT_ANY): New constant, introduced
	by Linux commit v4.17-rc1~52^2~21.
	* tests/ipc_msg.c: Check it.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add SEM_STAT_ANY.
	* xlat/semctl_flags.in (SEM_STAT_ANY): New constant, introduced
	by Linux commit v4.17-rc1~52^2~22.
	* tests/ipc_sem.c: Check it.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add SHM_STAT_ANY.
	* xlat/shmctl_flags.in (SHM_STAT_ANY): New constant, introduced
	by Linux commit v4.17-rc1~52^2~23.
	* tests/ipc_shm.c: Check it.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	net: print SO_GET_FILTER in getsockopt.
	SO_ATTACH_FILTER and SO_GET_FILTER have the same value; the former
	constant is intended for use in setsockopt, and the latter is for
	getsockopt.  Handle that the same way as similar SOL_IP/SOL_IPV6 socket
	options are handled.

	* xlat/getsock_options.in: New file.
	* xlat/setsock_options.in: Likewise.
	* xlat/sockoptions.in (SO_ATTACH_FILTER): Move to
	xlat/setsock_options.in.
	* net.c: Include "xlat/setsock_options.h" and "xlat/getsock_options.h".
	(print_sockopt_fd_level_name) <case SOL_SOCKET>: Use
	getsock_options or setsock_options as auxiliary xlats based on the value
	of is_getsockopt flag.
	* tests/sock_filter-v.c: Update expected output.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add sock_filtrer-v variants with different xlat verbosity levels.
	* tests/sock_filter-v-Xabbrev.c: New file.
	* tests/sock_filter-v-Xraw.c: Likewise.
	* tests/sock_filter-v-Xverbose.c: Likewise.
	* tests/sock_filter-v.c (PRINT_STMT_SYM, PRINT_STMT_SYM_,
	PRINT_STMT_VAL, PRINT_STMT_VAL_, PRINT_JUMP_): Remove.
	(HEX_FMT, XLAT_FMT, XLAT_ARGS, PRINT_STMT): New macros.
	(PRINT_JUMP): Rewrite.
	(print_filter): Rewrite using PRINT_STMT and new PRINT_JUMP.
	(main): Print SOL_SOCKET, SO_ATTACH_FILTER, and SO_ATTACH_REUSEPORT_CBPF
	using XLAT_FMT/XLAT_ARGS macros.
	* tests/pure_executables.list: Add sock_filter-v-Xabbrev,
	sock_filter-v-Xraw, and sock_filter-v-Xverbose.
	* tests/.gitignore: Likewise.
	* tests/gen_tests.in (sock_filter-v-Xabbrev, sock_filter-v-Xraw,
	sock_filter-v-Xverbose): New tests.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	defs.h: fix ethernet_protocols comment.
	Starting with commit v4.22~109, sorted xlat tables are terminated
	with XLAT_END.

	* defs.h (ethernet_protocols): Remove the "unterminated" part from
	description.

2018-05-08  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: rename *sock*options xlat tables.
	Such names as sockrxrpcoptions are incomprehensible.

	* xlat/getsockipoptions.in: Rename to xlat/getsock_ip_options.in.
	* xlat/getsockipv6options.in: Rename to xlat/getsock_ipv6_options.in.
	* xlat/setsockipoptions.in: Rename to xlat/setsock_ip_options.in.
	* xlat/setsockipv6options.in: Rename to xlat/setsock_ipv6_options.in.
	* xlat/sockalgoptions.in: Rename to xlat/sock_alg_options.in.
	* xlat/sockbluetoothoptions.in: Rename to xlat/sock_bluetooth_options.in.
	* xlat/sockcaifoptions.in: Rename to xlat/sock_caif_options.in.
	* xlat/sockdccpoptions.in: Rename to xlat/sock_dccp_options.in.
	* xlat/sockipoptions.in: Rename to xlat/sock_ip_options.in.
	* xlat/sockipv6options.in: Rename to xlat/sock_ipv6_options.in.
	* xlat/sockipxoptions.in: Rename to xlat/sock_ipx_options.in.
	* xlat/sockirdaoptions.in: Rename to xlat/sock_irda_options.in.
	* xlat/sockiucvoptions.in: Rename to xlat/sock_iucv_options.in.
	* xlat/sockkcmoptions.in: Rename to xlat/sock_kcm_options.in.
	* xlat/sockllcoptions.in: Rename to xlat/sock_llc_options.in.
	* xlat/socknetlinkoptions.in: Rename to xlat/sock_netlink_options.in.
	* xlat/socknfcllcpoptions.in: Rename to xlat/sock_nfcllcp_options.in.
	* xlat/sockoptions.in: Rename to xlat/sock_options.in.
	* xlat/sockpacketoptions.in: Rename to xlat/sock_packet_options.in.
	* xlat/sockpnpoptions.in: Rename to xlat/sock_pnp_options.in.
	* xlat/sockpppol2tpoptions.in: Rename to xlat/sock_pppol2tp_options.in.
	* xlat/sockrawoptions.in: Rename to xlat/sock_raw_options.in.
	* xlat/sockrdsoptions.in: Rename to xlat/sock_rds_options.in.
	* xlat/sockrxrpcoptions.in: Rename to xlat/sock_rxrpc_options.in.
	* xlat/socksctpoptions.in: Rename to xlat/sock_sctp_options.in.
	* xlat/socktcpoptions.in: Rename to xlat/sock_tcp_options.in.
	* xlat/socktipcoptions.in: Rename to xlat/sock_tipc_options.in.
	* xlat/socktlsoptions.in: Rename to xlat/sock_tls_options.in.
	* xlat/sockudpoptions.in: Rename to xlat/sock_udp_options.in.
	* net.c: Update.

2018-05-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	net: decode more SOL_* socket options.
	* xlat/sockalgoptions.in: New file.
	* xlat/sockbluetoothoptions.in: Likewise.
	* xlat/sockcaifoptions.in: Likewise.
	* xlat/sockdccpoptions.in: Likewise.
	* xlat/sockiucvoptions.in: Likewise.
	* xlat/sockkcmoptions.in: Likewise.
	* xlat/sockllcoptions.in: Likewise.
	* xlat/socknfcllcpoptions.in: Likewise.
	* xlat/sockpnpoptions.in: Likewise.
	* xlat/sockpppol2tpoptions.in: Likewise.
	* xlat/sockrdsoptions.in: Likewises.
	* xlat/sockrxrpcoptions.in: Likewise.
	* xlat/socktipcoptions.in: Likewise.
	* xlat/socktlsoptions.in: Likewise.
	* xlat/sockudpoptions.in: Likewise.
	* net.c: Include "xlat/sockalgoptions.h", "xlat/sockbluetoothoptions.h",
	"xlat/sockcaifoptions.h", "xlat/sockdccpoptions.h",
	"xlat/sockiucvoptions.h", "xlat/sockkcmoptions.h",
	"xlat/sockllcoptions.h", "xlat/socknfcllcpoptions.h",
	"xlat/sockpnpoptions.h", "xlat/sockpppol2tpoptions.h",
	"xlat/sockrdsoptions.h", "xlat/sockrxrpcoptions.h",
	"xlat/socktipcoptions.h", "xlat/socktlsoptions.h",
	and "xlat/sockudpoptions.h".
	(print_sockopt_fd_level_name): Decode SOL_UDP, SOL_IRDA, SOL_LLC,
	SOL_DCCP, SOL_TIPC, SOL_RXRPC, SOL_PPPOL2TP, SOL_BLUETOOTH, SOL_PNPIPE,
	SOL_RDS, SOL_IUCV, SOL_CAIF, SOL_ALG, SOL_NFC, SOL_KCM, and SOL_TLS
	socket option names.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	net: decode more AF_* protocol names.
	* xlat/caif_protocols.in: New file.
	* xlat/can_protocols.in: Likewise.
	* xlat/irda_protocols.in: Likewise.
	* xlat/isdn_protocols.in: Likewise.
	* xlat/kcm_protocols.in: Likewise.
	* xlat/nfc_protocols.in: Likewise.
	* xlat/phonet_protocols.in: Likewise.
	* xlat/smc_protocols.in: Likewise.
	* net.c: Include "xlat/irda_protocols.h", "xlat/can_protocols.h",
	"xlat/isdn_protocols.h", "xlat/phonet_protocols.h",
	"xlat/caif_protocols.h", "xlat/nfc_protocols.h",
	"xlat/kcm_protocols.h", and "xlat/smc_protocols.h".
	(SYS_FUNC(socket)): Decode AF_IRDA, AF_CAN, AF_RXRPC, AF_ISDN,
	AF_PHONET, AF_CAIF, AF_NFC, AF_KCM, and AF_SMC protocol names.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Remove some duplicate fallback definitions.
	There is no need to provide duplicate fallback definitions anymore,
	inclusion of the appropriate xlat header in XLAT_MACROS_ONLY mode
	does the right thing.

	* btrfs.c [!BTRFS_FIRST_FREE_OBJECTID] (BTRFS_FIRST_FREE_OBJECTID):
	Remove, a fallback definition is already provided by included
	"xlat/btrfs_tree_objectids.h".
	* net.c: Include "xlat/addrfams.h" in XLAT_MACROS_ONLY mode.
	[!AF_BLUETOOTH] (AF_BLUETOOTH): Remove.
	* syscall.c: Include "xlat/nt_descriptor_types.h" in XLAT_MACROS_ONLY
	mode.
	[!NT_PRSTATUS] (NT_PRSTATUS): Remove.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-05-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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>

2018-05-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-05-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

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

	xlat: provide fallback definitions for HCI_CHANNEL_* constants.
	* xlat/hci_channels.in: Provide fallback definitions.

2018-05-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-05-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

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

2018-05-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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>

2018-05-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

	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.

2018-05-07  Eugene Syromyatnikov  <evgsyr@gmail.com>

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

	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.

	xlat: provide fallback definitions for ARPHRD_* constants.
	* xlat/arp_hardware_types.in: Provide fallback definitions, sort.

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

	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.

	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.

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

	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.

	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.

2018-05-07  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: provide fallback definitions for SKF_*_OFF constants.
	* xlat/skf_off.in: New file.
	* bpf_sock_filter.c: Include "xlat/skf_off.h".

	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.

2018-05-06  Dmitry V. Levin  <ldv@altlinux.org>

	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")

2018-05-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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>

2018-05-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

	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.

	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.

2018-05-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-05-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat/gen.sh: invoke the shell interpreter with -e -u options.
	* xlat/gen.sh: Change interpreter from "/bin/sh" to "/bin/sh -eu".

	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.

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

2018-05-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: provide fallback definitions for BTPROTO_* constants.
	As they are architecture-independent.

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

2018-05-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

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

	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.

2018-05-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-05-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-05-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-05-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-05-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

	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.

	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.

	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.

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

2018-05-05  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2018-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2018-05-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

	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.

	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.

2018-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2018-05-03  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2018-05-03  Masatake YAMATO  <yamato@redhat.com>

	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.

2018-05-03  Masatake YAMATO  <yamato@redhat.com>

	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.

2018-05-03  Masatake YAMATO  <yamato@redhat.com>

	mmap_notify: rename the macro for tracking memory mapping.
	* sysent.h (STACKTRACE_INVALIDATE_CACHE): Rename to
	MEMORY_MAPPING_CHANGE.  All users updated.

	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.

2018-05-03  Masatake YAMATO  <yamato@redhat.com>

	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.

2018-05-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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_*"

2018-05-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-05-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-05-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util.c: add len sanity checks to dumpstr.
	Reported by clang.

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

2018-05-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-05-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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().

2018-05-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-05-03  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2018-05-03  Zhibin Li  <08826794brmt@gmail.com>

	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>

2018-05-03  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2018-05-02  Masatake YAMATO  <yamato@redhat.com>

	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.

2018-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	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>

2018-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2018-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	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.

	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.

2018-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2018-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2018-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	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>

2018-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2018-04-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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>

2018-04-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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>

2018-04-28  Dmitry V. Levin  <ldv@altlinux.org>

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

2018-04-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

	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.

2018-04-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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>

2018-04-27  Dmitry V. Levin  <ldv@altlinux.org>

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

	Fixes: v4.21~316 ("Update MSG_* constants")

2018-04-27  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2018-04-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-04-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	evdev: remove XT_NORMAL.
	It is no longer used.

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

2018-04-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

	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.

2018-04-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-04-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-04-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

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

	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.

	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.

2018-04-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-04-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-04-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-04-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-04-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

	ipc: use printxval_u instead of manual xlat value printing.
	* ipc.c (SYS_FUNC(ipc)): Decode call argument using printxval_u.

2018-04-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-04-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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>

2018-04-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1.in: fix typo (Ronald -> Roland)
	A very unfortunate one, though.

	NEWS: mention that -X option addresses Debian bug #692915.

2018-04-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	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.

2018-04-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add more evdev ioctl checks.
	tests/ioctl_evdev.c (TEST_NULL_ARG_EX): Rename from TEST_NULL_ARG, add
	str argument, print it instead of #cmd.
	(TEST_NULL_ARG): Implement as a TEST_NULL_ARG_EX wrapper.
	(main): Add checks for EVIOCSABS and EVIOCGBIT ioctls.

	evdev: decode EV_SW unconditionally.
	* evdev.c (bit_ioctl): Remove [EV_SW] check.
	* tests/ioctl_evdev.c [!EV_SW] (EV_SW): Define.
	(main): Remove [EV_SW] check.

2018-04-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: provide fallback definitions for arch-independent evdev constants.
	* xlat/evdev_abs.in: Add constant values.
	* xlat/evdev_autorepeat.in: Likewise.
	* xlat/evdev_ev.in: Likewise.
	* xlat/evdev_ff_status.in: Likewise.
	* xlat/evdev_ff_types.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.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-04-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat/evdev_switch.in: update.
	* xlat/evdev_switch.in (SW_RADIO): Remove, as it was renamed to
	SW_RFKILL_ALL and marked as deprecated by Linux commit v2.6.26-rc5~32^2.
	(SW_PEN_INSERTED): New constant, was added by Linux commit v4.7~11^2~7.

2018-04-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util.c: make "Out of memory" messages a bit more informative.
	Since these are emitted in multiple places and are not expected during
	any normal operation, it makes sense to report the caller name.

	* util.c (print_quoted_string_ex, print_quoted_string_ex, dumpiov_upto,
	dumpstr): Replace error_msg with error_func_msg.

2018-04-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ci: reorder travis jobs.
	Run coverage check first as it is the longest one.

	* .travis.yml (matrix): Reorder.

2018-04-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add MS_SUBMOUNT constant.
	* xlat/mount_flags.in (MS_SUBMOUNT): New constant, introduced
	by Linux commit v4.11-rc1~82^2~7.

2018-04-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	fcntl: replace combinations of xlookup and printxval with printxvals.
	After all, that's what printxvals for.

	* fcntl.c (SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): Use printxvals for
	printing value with multiple xlat tables as constant sources.

2018-04-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Move xlat_verbose and xlat_format from xlat.c to defs.h.
	As it will be used elsewhere.

	* xlat.c (xlat_verbose, xlat_format): Move...
	* defs.h: ...here.

2018-04-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	btrfs: use printxval_u for error types printing.
	* btrfs.c (MPERS_PRINTER_DECL(btrfs_ioctl)) <case
	BTRFS_IOC_GET_DEV_STATS>: Use printxval_u for error type printing.
	* tests/btrfs.c (btrfs_test_get_dev_stats_ioctl): Update expected output.

	btrfs: print device IDs using PRINT_FIELD_DEV.
	* btrfs.c (btrfs_print_balance_args): Print devid field using
	PRINT_FIELD_DEV.
	(MPERS_PRINTER_DECL(btrfs_ioctl)) <case BTRFS_IOC_DEV_INFO,
	case BTRFS_IOC_GET_DEV_STATS, case BTRFS_IOC_SCRUB,
	case BTRFS_IOC_SCRUB_PROGRESS>: Likewise.
	(MPERS_PRINTER_DECL(btrfs_ioctl)) <case BTRFS_IOC_DEV_REPLACE>: Print
	start.srcdevid field using PRINT_FIELD_DEV.
	* tests/btrfs.c: Update expected output.

	btrfs: print cont_reading_from_srcdev_mode as xlat.
	* xlat/btrfs_cont_reading_from_srcdev_mode.in: New file.
	* btrfs.c: Include "xlat/btrfs_cont_reading_from_srcdev_mode.h".
	(MPERS_PRINTER_DECL(btrfs_ioctl)) <case BTRFS_IOC_DEV_REPLACE>: Print
	named values for the
	struct btrfs_ioctl_dev_replace_args.start.cont_reading_from_srcdev_mode
	field.
	* tests/btrfs.c: Include "xlat/btrfs_cont_reading_from_srcdev_mode.h".
	(btrfs_test_dev_replace_ioctl): Update expected output.

	btrfs: use PRINT_FIELD_*
	* btrfs.c (btrfs_print_balance_args, btrfs_print_balance,
	btrfs_print_features, btrfs_print_qgroup_limit,
	btrfs_print_data_container_header,
	print_btrfs_data_container_logical_ino, btrfs_print_qgroup_inherit,
	btrfs_print_tree_search, print_btrfs_ioctl_space_info, btrfs_ioctl):
	Use PRINT_FIELD_* macros for printing structure fields.

	btrfs: make BTRFS_IOC_GET_DEV_STATS error statistics output more structured
	* btrfs.c (MPERS_PRINTER_DECL(btrfs_ioctl)) <case
	BTRFS_IOC_GET_DEV_STATS>: Print array index in square brackets before
	the value in order to avoid confusion.
	* tests/btrfs.c (btrfs_test_get_dev_stats_ioctl): Update expected output.

	ioctl: print ioctl number in accordance with xlat verbosity setting.
	* ioctl.c (SYS_FUNC(ioctl)): Print ioctl command name in accordance
	with the current xlat_verbosity setting.
	* tests/btrfs.c (sprint_xlat_): New function.
	(ioc): New macro, a wrapper for sprint_xlat_.
	Update expected output.

	file_ioctl: make abbreviated output more structured.
	* file_ioctl.c (file_ioctl): Print fm_extents field name only in case
	of non-abbreviated output.
	* tests/btrfs.c (btrfs_test_ino_path_ioctls): Update expected output.

2018-04-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	btrfs: fix printing of struct btrfs_ioctl_quota_ctl_args.
	For some reason, he decoder of BTRFS_IOC_QUOTA_CTL command didn't print
	opening curly brace and field name, only the closing curly brace.

	* btrfs.c (MPERS_PRINTER_DECL(btrfs_ioctl)) <case BTRFS_IOC_QUOTA_CTL>:
	Print "{cmd=".
	* tests/btrfs.c (btrfs_test_quota_ctl_ioctl): Update expected output.

	Fixes: v4.12~100 "ioctl: add decoding support for btrfs ioctls"

2018-04-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	btrfs: consistently use PRINT_FIELD_U64.
	* btrfs.c (print_u64, print_member_u64, print_key_value_internal,
	print_key_value): Remove.
	(btrfs_print_balance_args): Use PRINT_FIELD_U64 instead of
	print_member_u64.
	(btrfs_print_tree_search): Use PRINT_FIELD_U64 instead of
	print_key_value.
	(MPERS_PRINTER_DECL(btrfs_ioctl)): Use PRINT_FIELD_U64 instead of manual
	UINT64_MAX printing.
	* tests/btrfs.c: Update expected output in order to account fields that
	are now affected by xlat_verbosity setting.

2018-04-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	btrfs: print {min,max}_{offset,transid} unconditionally.
	As it looks like there's no reason to skip their printing.

	* btrfs.c (print_key_value_internal): Do not check value argument
	for holding non-zero value.
	* tests/btrfs.c (btrfs_print_search_key): Update expected output.

2018-04-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/btrfs.c: accept possible failure of BTRFS_IOC_BALANCE_V2.
	BTRFS_IOC_BALANCE_V2 ioctl might fail sometimes (for example, if it
	decides that it doesn't have enough free space).

	* tests/btrfs.c (btrfs_test_balance_ioctls): Print expected output for
	the BTRFS_IOC_BALANCE_V2 call based on its return code.

2018-04-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/btrfs.c: support volumes with mixed data/metadata in BTRFS_IOC_BALANCE_V2
	For these volumes, pend/vend should be the same for data and meta.

	* tests/btrfs.c (btrfs_test_balance_ioctls): Set args.meta.pend and
	args.meta.vend to the same values as args.data.pend and args.data.vend,
	respectively.

2018-04-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/btrfs.c: check BTRFS_IOC_SUBVOL_CREATE_V2 result.
	Otherwise the subsequent openat call fails with a cryptic message.

	* tests/btrfs.c (btrfs_test_subvol_ioctls): Check return code of the
	BTRFS_IOC_SUBVOL_CREATE_V2 ioctl call that is supposed to be successful.

2018-04-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/btrfs.c: add pid suffix to the created directory, remove it on exit
	If multiple tests are running simultaneously in the same directory,
	conflicts (and test failures) may happen.

	* tests/btrfs.c (path, dir_name_fmt, dir_name): New variables.
	(btrfs_test_ino_path_ioctls): Use dir_name for printing directory name.
	(rm_test_dir): New function.
	(main): Generate dir_name, use it instead of fixed name, add rm_test_dir
	as an atexit handler.

2018-04-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	btrfs: duplicate printing of opening braces on entering/exiting.
	* btrfs.c (MPERS_PRINTER_DECL(btrfs_ioctl)): Print opening bracket
	on entering and exiting separately.

	btrfs: refactor timespec printing into print_btrfs_timespec.
	* btrfs.c (print_btrfs_timespec): New function.
	(MPERS_PRINTER_DECL(btrfs_ioctl)) <case BTRFS_IOC_SET_RECEIVED_SUBVOL>:
	Use print_btrfs_timespec for printing stime and rtime fields.
	* tests/btrfs.c (btrfs_test_set_received_subvol_ioctl): Update expected
	output.

	btrfs: print abbreviations and field names more consistently.
	* btrfs.c (btrfs_print_data_container_header): Do not print ", val=".
	(btrfs_print_ino_path_container): Print val field name only in case
	of non-abbreviated output.
	(btrfs_print_qgroup_inherit): Print qgroups field name only in case
	of non-abbreviated output.
	(btrfs_print_tree_search): Print buf field name only in case
	of non-abbreviated output.
	(MPERS_PRINTER_DECL(btrfs_ioctl)) <case BTRFS_IOC_SEND>: Print
	clone_sources field name only in case of non-abbreviated output.
	(MPERS_PRINTER_DECL(btrfs_ioctl)) <case BTRFS_IOC_SPACE_INFO>: Print
	spaces field name only in case of non-abbreviated output.
	* tests/btrfs.c: Update expected output.

	btrfs: move printing of the field name inside btrfs_print_qgroup_limit.
	* btrfs.c (btrfs_print_qgroup_limit): Print ", lim=".
	(btrfs_print_qgroup_inherit, MPERS_PRINTER_DECL(btrfs_ioctl)): Do not
	print ", lim=" before btrfs_print_qgroup_limit call.

	btrfs: convert btrfs_print_{objectid,key_type} to PRINT_FIELD_XVAL_U.
	* btrfs.c (btrfs_print_key_type, btrfs_print_objectid): Convert into
	thin wrappers around PRINT_FIELD_XVAL_U.
	(btrfs_print_data_container_header, btrfs_print_tree_search,
	MPERS_PRINTER_DECL(btrfs_ioctl)): Update calls to btrfs_print_key_type
	and btrfs_print_objectid in accordance with the new calling convention.
	(print_objectid_callback): Use printxvals_ex directly instead of
	btrfs_print_objectid call.
	* tests/btrfs.c (btrfs_print_objectid, btrfs_print_key_type): Update
	expected output.

	tests: add btrfs tests with verbose xlat decoding.
	* tests/btrfs-X.test: New test.
	* tests/btrfs-vX.test: Likewise.
	* tests/btrfs-vwX.test: Likewise.
	* tests/btrfs-wX.test: Likewise.
	* tests/Makefile.am (DECODER_TESTS): Add them.
	* tests/btrfs.c (verbose_xlat): New static variable.
	(prfl_btrfs, prxval_btrfs): New function.
	(btrfs_print_qgroup_inherit, btrfs_print_vol_args_v2,
	btrfs_print_balance_args, btrfs_test_balance_ioctls,
	btrfs_test_clone_ioctls, btrfs_test_defrag_ioctls,
	btrfs_test_space_info_ioctl, btrfs_print_defrag_range_args,
	btrfs_test_scrub_ioctls, btrfs_test_ino_path_ioctls,
	btrfs_test_send_ioctl, btrfs_test_send_ioctl,
	btrfs_test_quota_ctl_ioctl, btrfs_test_get_dev_stats_ioctl,
	btrfs_test_get_dev_stats_ioctl, btrfs_test_dev_replace_ioctl,
	btrfs_test_dev_replace_ioctl, btrfs_print_features): Use prfl_btrfs and
	prxval_btrfs instead of printflags and printxval, respectively.
	(btrfs_test_balance_ioctls, btrfs_test_ino_path_ioctls,
	btrfs_test_quota_ctl_ioctl, btrfs_test_dev_replace_ioctl,
	btrfs_test_dev_replace_ioctl): Update expected output based on
	verbose_xlat setting.
	(btrfs_print_defrag_range_args): Add compress_type_known arg, pass it
	to prxval_btrfs.
	(main): Handle -X option.

2018-04-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check -X option syntax.
	* tests/options-syntax.test: Add checks for -X option with invalid
	arguments.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-04-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add user interface for configuring xlat output style.
	* strace.c (init): Handle -X option, set xlat_verbosity
	according to -X argument.
	* strace.1.in: Document -X option.
	* NEWS: Mention it.

	Closes: https://github.com/strace/strace/issues/27
	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-04-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: print fields that interpreted as pointers using printaddr64.
	* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_MAP_LOOKUP_ELEM),
	BEGIN_BPF_CMD_DECODER(BPF_MAP_UPDATE_ELEM)): Print key and value
	fields using PRINT_FIELD_ADDR64.
	(BEGIN_BPF_CMD_DECODER(BPF_MAP_DELETE_ELEM)): Print key field using
	PRINT_FIELD_ADDR64.
	(BEGIN_BPF_CMD_DECODER(BPF_MAP_GET_NEXT_KEY)): Print key and next_key
	field using PRINT_FIELD_ADDR64.
	(BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)): Print insns and log_buf fields
	using PRINT_FIELD_ADDR64.
	(BEGIN_BPF_CMD_DECODER(BPF_PROG_TEST_RUN)): Print data_in and data_out
	fields using PRINT_FIELD_ADDR64.
	* tests/bpf.c: Update expected output.

2018-04-20  Dmitry V. Levin  <ldv@altlinux.org>

	build: make it even more reproducible.
	* Makefile.am (today): Consistently print the UTC date in C locale.
	* configure.ac (RPM_CHANGELOGTIME, DEB_CHANGELOGTIME): Likewise.
	* maint/update_copyright_years.sh: Likewise.
	* copyright-year-gen: Likewise.  When $SOURCE_DATE_EPOCH is non-empty,
	use it as fallback date before the current system date.

	References: https://github.com/strace/strace/pull/68

2018-04-19  Dmitry V. Levin  <ldv@altlinux.org>

	unwind: move unwind_tcb_init invocation to after_successful_attach.
	There is no need to call unwind_tcb_init before the tracee is attached.

	* strace.c (alloctcb) [ENABLE_STACKTRACE]: Move unwind_tcb_init
	invocation ...
	(after_successful_attach) [ENABLE_STACKTRACE]: ... here.
	(init) [ENABLE_STACKTRACE]: Remove unwind_tcb_init invocation loop.
	* unwind.c (unwind_tcb_fin): Skip if tcp->unwind_queue is NULL.

2018-04-19  Dmitry V. Levin  <ldv@altlinux.org>

	strace: move setting of post-attach flags inside after_successful_attach
	* strace.c (after_successful_attach): Add "flags" argument.
	Set TCB_ATTACHED, TCB_STARTUP, and "flags" in tcp->flags.
	All users updated.

2018-04-19  Dmitry V. Levin  <ldv@altlinux.org>

	strace: rename newoutf to after_successful_attach.
	This function is going to be used for other things that have to be done
	right after a successful attach, hence the rename.

	* strace.c (newoutf): Rename to after_successful_attach,
	all users updated.

2018-04-19  Dmitry V. Levin  <ldv@altlinux.org>

	unwind: remove stray newline in error diagnostics.
	* unwind-libdw.c (tcb_init): Do not pass trailing "\n" to error_msg
	as the latter prints newline itself.

2018-04-19  Dmitry V. Levin  <ldv@altlinux.org>

	build: make it more reproducible.
	* file-date-gen: Consistently print the UTC date in C locale.
	When $SOURCE_DATE_EPOCH is non-empty, use it as fallback date
	before the current system date.

	Reported-by: Chris Lamb <lamby@debian.org>
	Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=896016
	Closes: https://github.com/strace/strace/pull/68

2018-04-19  Masatake YAMATO  <yamato@redhat.com>

	unwind: initialize unwind context only if given tcb is initialized.
	With libdw based unwinder, following warnings are reported
	when -p is passed before -k:

	   $ ./strace -p 1 -k
	   ...
	   ./strace: dwfl_linux_proc_attach returned an error for process 0: No such file or directory
	   ...

	It seems that commit 54c7792b, "Fix libunwind segfault when -p is
	passed before -k" doesn't fix the original issue.

	* strace.c (init) [ENABLE_STACKTRACE]: Initialize unwind context only
	if given tcb is initialized.

2018-04-12  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: harmonize length checks.
	The rest of the decoder uses offsetof to check the length.

	* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_OBJ_PIN),
	BEGIN_BPF_CMD_DECODER(BPF_PROG_GET_NEXT_ID),
	BEGIN_BPF_CMD_DECODER(BPF_PROG_GET_FD_BY_ID),
	BEGIN_BPF_CMD_DECODER(BPF_MAP_GET_FD_BY_ID)): Use offsetof instead
	of offsetofend.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: add support for map_name and map_ifindex fields in BPF_MAP_CREATE.
	* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_MAP_CREATE)): Decode map_name
	and map_ifindex fields that were added in Linux commits
	v4.15-rc1~84^2~605^2~3 and v4.16-rc1~123^2~145^2~5^2~8, respectively.
	* bpf_attr.h (struct BPF_MAP_CREATE_struct): Add map_name
	and map_ifindex fields.
	* tests/bpf.c (init_BPF_MAP_CREATE_attr7): New function.
	(BPF_MAP_CREATE_checks): Remove const qualifier, add two more checks.

	bpf: improve handling of various sizes of BPF_MAP_CREATE attributes.
	* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_MAP_CREATE)): Skip printing
	the rest of the structure if len is less than the offset of the end
	of max_entries, map_flags, or inner_map_fd field.
	* tests/bpf.c (BPF_MAP_CREATE_checks): Add two more checks.

	tests: add checks for bpf BPF_MAP_CREATE arguments.
	* tests/bpf.c (BPF_MAP_CREATE_checks): Add two more checks.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: print numa_node using xlat.
	As the value of -1 has a special meaning.  The issue is complicated
	by the fact that this constant is not exported by UAPI.

	* xlat/numa_node.in: New file.
	* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_MAP_CREATE)): Print numa_node field
	using printxvals_ex with a special xlat style.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	btrfs: use umove_or_printaddr_ignore_syserror instead of u_error mangling
	* btrfs.c (MPERS_PRINTER_DECL(btrfs_ioctl)) <case
	BTRFS_IOC_TREE_SEARCH_V2>: Use umove_or_printaddr_ignore_syserror
	instead of tcp->u_error mangling around umove_or_printaddr call.

	defs.h: introduce umove_or_printaddr{,64}_ignore_syserror wrappers.
	* defs.h (umove_or_printaddr64_ignore_syserror): New macro, a thin
	wrapper around umoven_or_printaddr64_ignore_syserror.
	(umove_or_printaddr_ignore_syserror): New macro, a thin wrapper around
	umoven_or_printaddr_ignore_syserror.

	print_fields.h: add PRINT_FIELD_XVAL_U for printing xlat in %u format.
	* print_fields.h (PRINT_FIELD_XVAL_U): New macro.

	print_fields.h: add PRINT_FIELD_U64 for printing u64 with UINT64_MAX handling
	* print_fields.h (PRINT_FIELD_U64): New macro.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf_sock_filter: use print_xlat32.
	We can't simply use print_xlat here due to the way those SKF_*_OFF
	constants are defined.

	* bpf_sock_filter.c (print_sock_filter_k): Use print_xlat32 for printing
	SKF_AD_OFF, SKF_NET_OFF, and SKF_LL_OFF named constants.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	defs.h: add print_xlat32 macro.
	For those cases where inadvertent sign extension is possible.

	* defs.h (print_xlat32): New macro, a wrapper for print_xlat_ex.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	open: use print_xlat_d in print_dirfd.
	* open.c (print_dirfd): Use print_xlat_d for printing AT_FDCWD named
	constant.

	fanotify: use print_xlat_d.
	* fanotify.c (SYS_FUNC(fanotify_mark)): Use print_xlat_d for printing
	FAN_NOFD named constant.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add print_xlat_u and print_xlat_d shorthands.
	Add variants of print_xlat with various value printing formats.

	* defs.h (print_xlat_u, print_xlat_d): New macro, a wrapper for
	print_xlat_ex.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: introduce XLAT_STYLE_FMT_D.
	As there are some possible users for it, apparently.

	* defs.h (XLAT_STYLE_FORMAT_MASK): Update the value in order to
	accommodate XLAT_STYLE_FMT_D.
	(enum xlat_style) <XLAT_STYLE_FMT_D>: New enumeration entity.
	(printxval64_d, printxval_d): New function, a shorthand for
	printxvals_ex with a single xlat and XLAT_STYLE_FMT_D xlat style.
	* xlat.c (sprint_xlat_val): Handle XLAT_STYLE_FMT_D.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	defs.h: add shorthands for printing xval with XLAT_STYLE_FMT_U.
	* defs.h (printxval_u, printxval64_u): New function, a shorthand for
	printxvals_ex with a single xlat and XLAT_STYLE_FMT_U as a style.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add support for various xlat formats.
	Since xlat printing routines now have a notion of "style" that should be
	used for printing xlat values, we can also employ this argument for
	passing information about number printing format (unsigned decimal
	or hexadecimal, so far).

	* defs.h (XLAT_STYLE_FORMAT_SHIFT, XLAT_STYLE_FORMAT_MASK): New macro
	constant.
	(enum xlat_style) <XLAT_STYLE_FMT_X, XLAT_STYLE_FMT_U>: New enumeration
	entities.
	* xlat.c (xlat_verbose, xlat_format): New macro for checking specific
	aspect of style argument.
	(get_xlat_style): Use xlat_verbose for checking xlat verbosity style.
	(sprint_xlat_val, print_xlat_val): New function, for easing printing
	raw constant number with respect to printing format style.
	(printxvals_ex, sprintxval_ex, printxval_searchn_ex,
	printxval_searchn_ex, sprintflags_ex, printflags_ex, print_xlat_ex):
	Use xlat_verbose macro for xlat verbosity style checks. Use
	print_xlat_val instead of direct raw xlat value printing.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	v4l2: use print_xlat in print_v4l2_queryctrl.
	* v4la.c (print_v4l2_queryctrl): Use print_xlat for printing
	V4L2_CTRL_FLAG_NEXT_CTRL named constant.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	prctl: use print_xlat_ex to print PR_SET_PTRACER_ANY.
	We cannot simply use print_xlat as PR_SET_PTRACER_ANY is defined
	differently in kernel headers.

	* prctl.c (SYS_FUNC(prctl)) <case PR_SET_PTRACER>: Use print_xlat_ex
	for printing PR_SET_PTRACER_ANY named constant.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	nlattr: use print_xlat.
	* nlattr.c (print_nlattr): Use print_xlat for printing NLA_F_NESTED and
	NLA_F_NET_BYTEORDER named constants.

	ipc_defs.h: use print_xlat.
	* ipc_defs.h (PRINTCTL): Use print_xlat for printing IPC_64 named
	constant.

	futex: use print_xlat.
	* futex.c [!FUTEX_OP_OPARG_SHIFT] (FUTEX_OP_OPARG_SHIFT): New macro
	constant.
	(SYS_FUNC(futex)): Use print_xlat for printing FUTEX_OP_OPARG_SHIFT
	named constant.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ipc: use printxval for printing key.
	Convert explicit constant printing logic into a printxval call in order
	to account for xlat style setting.

	* defs.h (ipc_private): New xlat array declaration.
	* ipc_msg.c (SYS_FUNC(msgget)): Use printxval for printing IPC_PRIVATE.
	* ipc_sem.c (SYS_FUNC(semtimedop)): Likewise.
	* ipc_shm.c (SYS_FUNC(shmget)): Likewise.
	* xlat/ipc_private.in: New file.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	mount: use print_xlat for printing MS_MGC_VAL.
	* mount.c (SYS_FUNC(mount)): Use print_xlat for printing MS_MGC_VAL
	named constant.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Introduce print_xlat and print_xlat_ex.
	print_xlat_ex prints a named constant in accordance with xlat style
	provided, print_xlat is a thin wrapper around print_xlat_ex that passes
	stringified constant name as a string and XLAT_STYLE_DEFAULT as a style.

	* defs.h (print_xlat_ex): New function prototype.
	(print_xlat): New macro, a thin wrapper around print_xlat_ex.
	* xlat.c (print_xlat_ex): New function.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Introduce XLAT_STYLE_DEFAULT.
	This will be needed later, with the introduction of user-configurable
	xlat style setting (stored in xlat_verbosity variable).

	* defs.h (XLAT_STYLE_VERBOSITY_MASK): New macro constant.
	(enum xlat_style) <XLAT_STYLE_DEFAULT>: New enumeration entity.
	(xlat_verbosity): New external declaration.
	(printxvals, printxval_searchn, printxval_search_ex, sprintxval,
	sprintflags, printflags64): Use XLAT_STYLE_DEFAULT instead of
	XLAT_STYLE_ABBREV.
	* strace.c (xlat_verbosity): New variable.
	* xlat.c (get_xlat_style): New function.
	(printxvals_ex, sprintxval_ex, printxval_searchn_ex, sprintflags_ex,
	printflags_ex): Use it.

2018-04-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Introduce xlat verbosity styles.
	* defs.h (printxvals_ex): Rename from printxvals, add style argument.
	(enum xlat_style): New enumeration.
	(printxvals): New macro, a wrapper for printxvals_ex.
	(printxval_searchn_ex): Rename from printxval_searchn, add style
	argument.
	(printxval_searchn): New macro, a wrapper for printxval_searchn_ex.
	(printxval_search_ex): New macro, a wrapper for printxval_searchn_ex.
	(sprintxval_ex): Rename from sprintxval, add style argument.
	(sprintxval): New macro, a wrapper for sprintxval_ex.
	(printflags_ex): Add style argument.
	(sprintflags_ex): Rename from sprintflags, add style argument.
	(sprintflags): New macro, a wrapper for sprintflags_ex.
	(printflags64): Pass XLAT_STYLE_ABBREV as a style in printflags_ex call.
	* netlink.c (decode_nlmsg_flags): Pass XLAT_STYLE_ABBREV as a style in
	printflags_ex call.
	* xlat.c (printxvals_ex): Rename from printxvals, add style argument,
	handle it.
	(sprintxval_ex): Rename from sprintxval, add style argument, handle it.
	(printxval_searchn_ex): Rename from printxval_searchn, add style
	argument, handle it.
	(sprintflags_ex): Rename from sprintflags, add style argument,
	handle it.
	(printflags_ex): Add style argument, handle it.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
	References: https://github.com/strace/strace/issues/27

2018-04-11  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify signal delivery test against kernel bugs.
	Recent kernel siginfo changes, namely, v4.14-rc1~60^2^2~1,
	v4.16-rc1~159^2~37, and v4.16-rc1~159^2~39, introduced ABI regressions
	that render the whole siginfo interface unreliable.

	Looks like the kernel side is not eager to fix the breakage,
	so here is a workaround.

	* tests/signal_receive.c (s_sig, s_code, s_pid, s_uid): New volatile
	variables.
	(handler): Add siginfo_t parameter, save siginfo_t fields.
	(sig_print): Remove.
	(main): Rewrite.  Use variables saved by handler to print expected
	siginfo output. Print diagnostics in case of siginfo mismatch.
	* strace.spec.in (%check): Extract the diagnostics.

	Closes: https://github.com/strace/strace/issues/21

2018-04-11  Dmitry V. Levin  <ldv@altlinux.org>

	Lift experimental status from stack tracing feature.
	* strace.1.in (.SH OPTIONS) <.B \-k>: Remove " (experimental)".
	* strace.c (usage) [ENABLE_STACKTRACE]: Likewise.

2018-04-11  Dmitry V. Levin  <ldv@altlinux.org>

	Enable stack tracing in packages on all architectures.
	The stack tracing feature used to be enabled in packages on x86_64 only.
	This change enables -k option on all architectures.

	* debian/control (Build-Depends) [!amd64]: Add pkg-config, libdw-dev,
	and libiberty-dev.
	* strace.spec.in (BuildRequires) [!x86_64]: Add
	%buildrequires_stacktrace.

2018-04-11  Dmitry V. Levin  <ldv@altlinux.org>

	Use libdw-based unwinder in ci and packages.
	* ci/install-dependencies.sh (common_packages): Add pkg-config,
	replace libunwind8-dev with libdw-dev.
	* debian/control (Build-Depends) [amd64]: Add pkg-config,
	replace libunwind-dev with libdw-dev.
	* debian/rules (build-udeb/Makefile): Replace --without-libunwind
	with --without-stacktrace.
	* strace.spec.in (buildrequires_libunwind_devel): Rename
	to buildrequires_stacktrace, replace libunwind-devel with
	either elfutils-devel or libdw-devel.

	tests: skip -k tests on unsupported architectures.
	* tests/strace-k.test: When actual strace -k output doesn't match the
	expected output because of limited architecture support, skip the test
	on architectures that are not currently supported by libdw.

2018-04-11  Masatake YAMATO  <yamato@redhat.com>

	unwind: add libdw as an unwinder.
	Implement alternative libdw-based unwinder for stack tracing.
	Add --with-libdw configure option to control whether libdw can be used
	as an unwinder.

	* m4/st_libdw.m4: New file.
	* m4/st_stacktrace.m4 (st_STACKTRACE): Invoke st_ARG_LIBDW and st_LIBDW,
	check for mutually exclusive configure options,
	(AM_CONDITIONAL): Add USE_LIBDW.
	* unwind-libdw.c: New file.
	* Makefile.am [USE_LIBDW] (strace_SOURCES): Append unwind-libdw.c.
	[USE_LIBDW] (strace_CPPFLAGS): Append $(libdw_CPPFLAGS).
	[USE_LIBDW] (strace_CFLAGS): Append $(libdw_CFLAGS).
	[USE_LIBDW] (strace_LDFLAGS): Append $(libdw_LDFLAGS).
	[USE_LIBDW] (strace_LDADD): Append $(libdw_LIBS).
	* NEWS: Mention this improvement.

	Closes: https://github.com/strace/strace/issues/12
	Closes: https://github.com/strace/strace/issues/13
	Co-Authored-by: Mark Wielaard <mjw@redhat.com>
	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-04-11  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check corner cases of udev_monitor_netlink_header decoding.
	* tests/netlink_kobject_uevent.c (test_nlmsg_type_kernel): Create
	a tail-allocated udev_monitor_netlink_header object and pass it
	to sys_send.
	(test_nlmsg_type_udev): Likewise.  Check decoding of
	udev_monitor_netlink_header object that ends in unmapped memory region.

2018-04-11  Harsha Sharma  <harshasharmaiitr@gmail.com>

	tests: check decoding of udev_monitor_netlink_header.
	* tests/netlink_kobject_uevent.c: Include <string.h>, <arpa/inet.h>,
	and "netlink_kobject_uevent.h".
	(test_nlmsg_type_udev, test_nlmsg_type_kernel): New functions.
	(main): Use them.

2018-04-11  Harsha Sharma  <harshasharmaiitr@gmail.com>

	netlink: decode libudev netlink header.
	* defs.h (decode_netlink_kobject_uevent): New prototype.
	* netlink.c (decode_netlink): Decode family kobject_uevent.
	* netlink_kobject_uevent.h: New file.
	* netlink_kobject_uevent.c: Likewise.
	* Makefile.am (strace_SOURCES): Add them.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-04-11  Harsha Sharma  <harshasharmaiitr@gmail.com>

	tests: check basic decoding of PTP_* ioctl commands.
	* tests/ioctl_ptp.c: New file.
	* tests/gen_tests.in (ioctl_ptp): New entry.
	* tests/pure_executables.list: Add ioctl_ptp.
	* tests/.gitignore: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-04-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: decode BPF_PROG_QUERY command.
	BPF_PROG_QUERY was introduced in Linux commit v4.15-rc1~84^2~558^2~6.

	* xlat/bpf_commands.in (BPF_PROG_QUERY): New constant.
	* xlat/bpf_query_flags.in: New file.
	* bpf.c: Include it.
	(DECL_BPF_CMD_DECODER): Add priv argument for passing tcb private data.
	(BEGIN_BPF_CMD_DECODER(BPF_PROG_QUERY)): New function.
	(SYS_FUNC(bpf)) <bpf_cmd_decoders>: Add BPF_PROG_QUERY entry.
	(SYS_FUNC(bpf)): Fetch buf on entering and exiting, pass buf on exiting,
	retrieve private data on exiting, pass it to decoder as well, explicitly
	rework rc handling logic for size argument printing.
	* bpf_attr.h (struct BPF_PROG_QUERY_struct): New structure declaration.
	(BPF_PROG_QUERY_struct_size, expected_BPF_PROG_QUERY_struct_size): New
	macro.
	* tests/bpf.c: Add checks for BPF_PROG_QUERY command.

2018-04-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Make print_uint64 from btrfs.c globally available.
	And rename it to print_uint64_array_member to make the name sensible
	without additional context.

	* defs.h (print_uint64_array_member): New function prototype.
	* btrfs.c (print_uint64): Move...
	* util.c (print_uint64_array_member): ...here, drop "static" qualifier.

2018-04-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Introduce umoven_or_printaddr64* functions.
	Counterparts for umoven_or_printaddr/umoven_or_printaddr_ignore_syserror
	that always print 64 bits of addr (as this is needed in bpf and btrfs
	decoders).

	* util.c (umoven_or_printaddr64): Rename from umoven_or_printaddr,
	change addr argument type to uint64_t, call printaddr64 instead of
	printaddr.
	(umoven_or_printaddr64_ignore_syserror): Rename from
	umoven_or_printaddr_ignore_syserror, change addr argument type to
	uint64_t, call printaddr64 instead of printaddr.
	* defs.h (umoven_or_printaddr64): Rename from umoven_or_printaddr,
	change addr argument type to uint64_t.
	(umoven_or_printaddr64_ignore_syserror): Rename from
	umoven_or_printaddr_ignore_syserror, change addr argument type to
	uint64_t.
	(umove_or_printaddr64): New macro, a wrapper for umoven_or_printaddr64.
	(umoven_or_printaddr): New function, a wrapper for
	umoven_or_printaddr64.
	(umoven_or_printaddr_ignore_syserror): New function, a wrapper for
	umoven_or_printaddr64_ignore_syserror.

2018-04-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf_filter.c: add support for decoding eBPF instruction codes.
	* bpf_filter.c (print_bpf_filter_code): Add extended argument, remove
	static qualifier.  Add support for decoding eBPF instruction code.
	* defs.h (print_bpf_filter_code): New declaration.
	* xlat/ebpf_class.in: New file.
	* xlat/ebpf_mode.in: Likewise.
	* xlat/ebpf_op_alu.in: Likewise.
	* xlat/ebpf_op_jmp.in: Likewise.
	* xlat/ebpf_size.in: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-04-08  Dmitry V. Levin  <ldv@altlinux.org>

	unwind: prepare configure subsystem for alternative unwinders.
	Introduce --enable-stacktrace configure option to control whether
	-k option support is compiled in, --with-libunwind option remains
	available to control whether libunwind can be used as an unwinder.

	* m4/st_demangle.m4: New file.
	* m4/st_libunwind.m4: Likewise.
	* m4/st_stacktrace.m4: Likewise.
	* configure.ac: Replace all libunwind and libiberty checks
	with a single st_STACKTRACE invocation.
	* Makefile.am: Conditionalize checks for USE_LIBUNWIND and USE_DEMANGLE
	on ENABLE_STACKTRACE.
	[ENABLE_STACKTRACE] (strace_SOURCES): Append unwind.c and unwind.h.
	* strace.1.in: Replace libunwind with an unwinder-agnostic wording.
	* defs.h: Replace USE_LIBUNWIND with ENABLE_STACKTRACE.
	* strace.c: Likewise.
	(print_version): Print stack-trace instead of stack-unwind.
	* syscall.c: Replace USE_LIBUNWIND with ENABLE_STACKTRACE.
	* tests/Makefile.am: Likewise.  Replace LIBUNWIND_TESTS
	with STACKTRACE_TESTS.
	* tests/strace-V.test: Update expected output.

2018-04-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: implement decoding of prog_name and prog_ifindex fields.
	* bpf.c (BEGIN_BPF_CMD_DECODER(BPF_PROG_LOAD)): Add support for decoding
	of prog_name (introduced in Linux commit v4.15-rc1~84^2~605^2~4) and
	prog_ifindex (introduced as prog_target_ifindex in v4.15-rc1~84^2~127^2~13,
	renamed in v4.15-rc1~15^2~5^2~3^2~7).
	* bpf_attr.h [!BPF_OBJ_NAME_LEN] (BPF_OBJ_NAME_LEN): New macro constant.
	[BPF_OBJ_NAME_LEN]: Check that BPF_OBJ_NAME_LEN is equal to 16.
	(struct BPF_PROG_LOAD_struct): Add prog_name and prog_ifindex fields.
	(BPF_PROG_LOAD_struct_size, expected_BPF_PROG_LOAD_struct_size): Update.
	* tests/bpf.c (init_BPF_PROG_LOAD_attr): Rename
	to init_BPF_PROG_LOAD_attr3.
	(print_BPF_PROG_LOAD_attr): Rename to print_BPF_PROG_LOAD_attr3.
	(init_BPF_PROG_LOAD_attr4, print_BPF_PROG_LOAD_attr4): New functions.
	(BPF_PROG_LOAD_checks): Check new decoding features.

2018-04-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: add support for array fields.
	* gen_bpf_attr_check.sh: Ignore field array size definition.
	* m4/gen_bpf_attr_m4.sh (filter_entries): Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-04-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify strace -k tests.
	Allow __getpid as an alternative name for getpid,
	allow __kernel_vsyscall after getpid.

	* tests/strace-k.expected: New file.
	* tests/strace-k-demangle.expected: Likewise.
	* tests/Makefile.am (EXTRA_DIST): Add them.
	* tests/strace-k-demangle.test (expected): Remove.
	* tests/strace-k.test: Likewise.  Use grep to check the output.

2018-04-07  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ipc_msg: sign extend msgtyp in m32 personality.
	msgtyp has to be treated as a signed type all the way from fetching
	to printing.

	* ipc_msg.c (fetch_msgrcv_args): Sign extend msgtyp when fetching.

2018-04-05  Dmitry V. Levin  <ldv@altlinux.org>

	strace.spec.in: update Source URL.
	* strace.spec.in (Source): Change to https://strace.io/files/.

	debian: enable mpers support for ppc64el and s390x.
	* debian/control (Build-Depends) [ppc64el, s390x]: Add gcc-multilib.

	Post-release administrivia.
	* NEWS: Add a header line for the next release.
	* debian/changelog.in: Add a changelog entry for 4.22-1.
	* strace.spec.in: Likewise.

	Prepare for 4.22 release.
	* NEWS: Update for 4.22 release.

	Update copyright headers.
	Headers updated automatically using maint/update_copyright_years.sh
	script.

2018-04-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update NEWS.

2018-04-05  Masatake YAMATO  <yamato@redhat.com>

	unwind: split unwind code into front-end and back-end.
	This opens the way for alternative unwinder back-ends.

	* unwind.h: New file, defines the unwinder back-end interface.
	* unwind.c: Move all libunwind related code ...
	* unwind-libunwind.c: ... here.
	* Makefile.am [USE_LIBUNWIND] (strace_SOURCES): Add unwind.h
	and unwind-libunwind.c.

2018-04-05  Masatake YAMATO  <yamato@redhat.com>

	unwind: rename public functions in an object-oriented fashion.
	This change renames functions exported to strace core part from unwind
	subsystem.

	The new names imply that unwind subsystem exports two types of
	functions.  One is for manipulating back-end itself, "unwind_" prefix
	is used for this type.  Another is for manipulating back-end private data
	structure (unwind_ctx) attached to tcb, "unwind_tcb_" is used for this
	type.

	This naming should help people to understand unwind subsystem
	and the relation between unwind subsystem and back-ends.

	* defs.h (unwind_print_stacktrace): Rename to unwind_tcb_print.
	(unwind_capture_stacktrace): Rename to unwind_tcb_capture.
	* unwind.c: Ditto.
	* syscall.c (syscall_entering_trace, syscall_exiting_trace): Use
	new names.

2018-04-05  Masatake YAMATO  <yamato@redhat.com>

	unwind: add unwind_ prefix to struct tcb.queue field and its type.
	The names given to struct tcb.queue field and its type are too common,
	this may cause conflicts in the future if new fields are added
	to struct tcb.

	* defs.h (struct tcb): Rename queue field to unwind_queue,
	rename its type queue_t to unwind_queue_t.
	* unwind.c (struct unwind_queue_t): Rename to unwind_queue_t.
	All users updated.

2018-04-05  Masatake YAMATO  <yamato@redhat.com>

	unwind: make the field type of struct tcb independent from libunwind.
	Narrowing the area where the code refers to names associated with
	libunwind is needed to utilize libdw of elfutils as an alternative
	unwinder.

	* defs.h (struct tcb): Rename libunwind_ui field to unwind_ctx, change
	its type to "void *".
	* unwind.c (unwind_tcb_init, unwind_tcb_fin, stracetrace_walk): Reflect
	* the above field renaming.

2018-04-04  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify options-syntax.test against ash.
	* tests/options-syntax.test: Do not assume that shell provides $UID,
	use "id -u" if it doesn't.

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.c: add support for opening output file in append mode.
	* strace.c (open_append): New variable.
	(init): Handle -A option.
	(strace_fopen): Open file in "a" mode if open_append is set to true.
	* strace.1.in: Document this.
	* NEWS: Mention this.

	Suggested-by: Philipp Marek <philipp.marek@emerion.com>
	Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=528488

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.c: support simultaneous usage of -r and -t options.
	* strace.c (init): Do not set tflag when rflag is set.
	(printleader): Handle rflag and tflag separately.
	* strace.1.in (.SH OPTIONS): Add a note about differences between
	the monotonic clock time  and the wall clock time.
	* tests/options-syntax.test: Remove the check for
	"-tt has no effect with -r" warning.
	* NEWS: Mention this.

	Suggested-by: Josh Triplett <josh@freedesktop.org>
	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
	Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=466195

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	syscall.c: dump write I/O even if error is returned.
	It makes sense to try to dump the argument of write syscalls as they can
	be readily available despite the fact that error has been returned.

	* syscall.c (dumpio): Move check for syserror and check for fd in
	read_set to the end of the function.
	* tests/read-write.c: Add a check for this behaviour.
	* tests/pread64-pwrite64.c: Update expected output.
	* NEWS: Mention this.

	Suggested-by: J. Bruce Fields <bfields@fieldses.org>
	Closes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=436284

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace: handle possible NULL from localtime() call.
	* strace.c (printleader): Print raw tv_sec value if localtime() returned
	NULL.
	* tests/localtime.c: New file.
	* tests/localtime.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add localtime.
	(MISC_TESTS): Add localtime.test.
	(localtime_LDADD): New variable.
	* tests/.gitignore: Add localtime.
	* ci/install-dependencies.sh (common_packages): Add faketime.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
	Closes: https://github.com/strace/strace/issues/42

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Return RVAL_STR unconditionally.
	There is no reason to check for auxstr being non-NULL
	because syscall_exiting_trace already does the check.

	* sched.c (SYS_FUNC(sched_getscheduler)): Do not check tcp->auxstr,
	return RVAL_STR unconditionally.
	* time.c (do_adjtimex): Likewise.

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	dist/README: s/linux/Linux/
	* dist/README: Replace "linux" with "Linux".

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1.in: fix formatting of -e trace class descriptions.
	Use .TP instead .PP as it is ought to be.

	* strace.1.in (.SS Filtering): Use .TP instead .PP as it is ought to be.

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	nlattr: check NLA_TYPE_MASK at compile time.
	* nlattr.c: Include "static_assert.h"
	(print_nlattr): Check the expectations about NLA_TYPE_MASK.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: add a comment about bpf_attr decoding.
	* bpf.c: Add comment.

2018-04-04  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of bpf_attr of size 1.
	* tests/bpf.c (BPF_PROG_GET_NEXT_ID_checks): New entry.

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: use print_big_u64_addr.
	Since pointers stored in the bpf_attr union are 64-bit regardless
	of architecture bitness.

	* bpf.c (DEF_BPF_CMD_DECODER(BPF_PROG_LOAD)): Call print_big_u64_addr
	for attr.license.
	(DEF_BPF_CMD_DECODER(BPF_OBJ_PIN)): Call print_big_u64_addr
	for attr.pathname.
	* tests/bpf.c (BPF_OBJ_PIN_checks): Check it.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: add support for file mode flags.
	These were introduced by Linux commit v4.15-rc1~84^2~384^2~4.

	* bpf_attr.h (struct BPF_OBJ_PIN_struct): Add file_flags field.
	(struct BPF_PROG_GET_NEXT_ID_struct, struct BPF_PROG_GET_FD_BY_ID_struct,
	struct BPF_MAP_GET_FD_BY_ID_struct): Add open_flags field.
	(BPF_OBJ_PIN_struct_size, expected_BPF_OBJ_PIN_struct_size,
	expected_BPF_PROG_GET_NEXT_ID_struct_size,
	expected_BPF_PROG_GET_FD_BY_ID_struct_size,
	expected_BPF_MAP_GET_FD_BY_ID_struct_size): Update.
	* bpf.c (DEF_BPF_CMD_DECODER(BPF_OBJ_PIN)): Check the length, skip
	printing the rest of attributes if it is less than offset of the
	end of the bpf_fd field, print file_flags field otherwise.
	(DEF_BPF_CMD_DECODER(BPF_PROG_GET_NEXT_ID),
	DEF_BPF_CMD_DECODER(BPF_PROG_GET_FD_BY_ID),
	DEF_BPF_CMD_DECODER(BPF_MAP_GET_FD_BY_ID)): Check the length, skip
	printing the rest of attributes if it is less than offset of the
	end of the next_id field, print open_flags field otherwise.
	* xlat/bpf_file_mode_flags.in: New file.
	* tests/bpf.c (BPF_OBJ_PIN_checks, BPF_PROG_GET_NEXT_ID_checks,
	BPF_PROG_GET_FD_BY_ID_checks, BPF_MAP_GET_FD_BY_ID_checks): Check it.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: refactor bpf test.
	The aim of this change is to introduce an ability to perform multiple
	checks for a specific bpf command.  In order to achieve so, all the
	related data is stored in check descriptor, and test_bpf iterates over
	it.  There are also some provisions made in regard to future changes
	(specifically, the way bpf_attr_data union is defined).

	* tests/bpf.c (print_bpf_attr): New function, a wrapper around
	struct bpf_check.printer.
	(test_bpf_): Rename to...
	(test_bpf): ...this.  Replace arguments with struct bpf_check pointer.
	Iterate over possible attribute variants. Account for changes in
	attribute initialisation routine: provide a pointer to locally defined
	union bpf_attr_data and perform memcpy afterwards. Initialise memory
	from data each time before a bpf call.
	(TEST_BPF, DEF_*, init_*, print_*): Remove.
	(init_BPF_PROG_LOAD_attr, print_BPF_PROG_LOAD_attr,
	init_BPF_OBJ_PIN_attr): New functions.
	(license, pathname): New variables.
	(BPF_MAP_CREATE_checks, BPF_MAP_LOOKUP_ELEM_checks,
	BPF_MAP_UPDATE_ELEM_checks, BPF_MAP_DELETE_ELEM_checks,
	BPF_MAP_GET_NEXT_KEY_checks, BPF_PROG_LOAD_checks, BPF_OBJ_PIN_checks,
	BPF_PROG_ATTACH_checks, BPF_PROG_DETACH_checks,
	BPF_PROG_TEST_RUN_checks, BPF_PROG_GET_NEXT_ID_checks,
	BPF_PROG_GET_FD_BY_ID_checks, BPF_MAP_GET_FD_BY_ID_checks,
	BPF_OBJ_GET_INFO_BY_FD_checks): New arrays.
	(BPF_OBJ_GET_checks, BPF_MAP_GET_NEXT_ID_checks): New macros.
	(CHK): New macro, a shorthand for initialising array of struct bpf_check.
	(main): New static constant checks, iterate over checks and run test_bpf
	with each element.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	print_fields.h: introduce PRINT_FIELD_ADDR and PRINT_FIELD_ADDR64 macros
	* print_fields.h (PRINT_FIELD_ADDR, PRINT_FIELD_ADDR64): New macro.

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	print_fields.h: introduce PRINT_FIELD_CSTRING_SZ macro.
	A variant of PRINT_FIELD_CSTRING with an ability to pass string size
	explicitly.

	* print_fields.h (PRINT_FIELD_CSTRING_SZ): New macro.

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	print_fields.h: check whether passed field is an array in PRINT_FIELD_CSTRING
	* print_fields.h (PRINT_FIELD_CSTRING): Add MUST_BE_ARRAY to the size
	value in order to check whether (where_).field_ is an array in compile
	time.

	print_fields.h: whitespace fix in PRINT_FIELD_HEX_ARRAY.

2018-04-04  Dmitry V. Levin  <ldv@altlinux.org>

	bpf_attr: add more size checks.
	* bpf_attr.h: Add expected sizes of structures.
	* gen_bpf_attr_check.sh: Check them.

	tests: check bpf syscall decoder unconditionally.
	* configure.ac (AC_CHECK_HEADERS([linux/bpf.h])): Check for
	struct bpf_insn.
	* tests/bpf.c: Remove the test guard, include "scno.h", "bpf_attr.h",
	"xlat.h", and "xlat/bpf_commands.h".  Conditionalize inclusion of
	<linux/bpf.h> on HAVE_LINUX_BPF_H.  Remove all HAVE_UNION_* checks.
	(BPF_ATTR_DATA_FIELD): New macro.
	(bpf_attr_data): New union.  Note that it is larger than modern
	union bpf_attr, this allows more checks to be implemented in the future.
	(sizeof_attr, test_bpf_): Replace union bpf_attr with
	union bpf_attr_data.
	(DEF_BPF_INIT_FIRST): Replace union bpf_attr with the corresponding
	structure.
	(init_BPF_MAP_CREATE_attr): Replace union bpf_attr with
	struct BPF_MAP_CREATE_struct.
	(init_BPF_MAP_LOOKUP_ELEM_attr): Replace union bpf_attr with
	struct BPF_MAP_LOOKUP_ELEM_struct.
	(init_BPF_MAP_UPDATE_ELEM_attr): Replace union bpf_attr with
	struct BPF_MAP_UPDATE_ELEM_struct.
	(init_BPF_MAP_DELETE_ELEM_attr): Replace union bpf_attr with
	struct BPF_MAP_DELETE_ELEM_struct.
	(init_BPF_MAP_GET_NEXT_KEY_attr): Replace union bpf_attr with
	struct BPF_MAP_GET_NEXT_KEY_struct.
	(init_BPF_PROG_LOAD_attr): Replace union bpf_attr with
	struct BPF_PROG_LOAD_struct.
	(init_BPF_OBJ_PIN_attr): Replace union bpf_attr with
	struct BPF_OBJ_PIN_struct.
	(init_BPF_PROG_ATTACH_attr): Replace union bpf_attr with
	struct BPF_PROG_ATTACH_struct.
	(init_BPF_PROG_DETACH_attr): Replace union bpf_attr with
	struct BPF_PROG_DETACH_struct.
	(init_BPF_PROG_GET_NEXT_ID_attr): Replace union bpf_attr with
	struct BPF_PROG_GET_NEXT_ID_struct.
	(sample_BPF_PROG_TEST_RUN_attr): Change type from union bpf_attr to
	struct BPF_PROG_TEST_RUN_struct, all users updated.
	(sample_BPF_OBJ_GET_INFO_BY_FD_attr): Change type from union bpf_attr
	to struct BPF_OBJ_GET_INFO_BY_FD_struct, all users updated.

	Check that structures defined by bpf_attr.h match system union bpf_attr.
	* gen_bpf_attr_check.sh: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	(strace_SOURCES_check): New variable.
	(strace_SOURCES): Add $(strace_SOURCES_check).
	(BUILT_SOURCES, CLEANFILES): Add bpf_attr_check.c.
	(bpf_attr_check.c): New rule.
	(sys_func_h_sources): New variable.
	(sys_func.h): Use it instead of strace_SOURCES_c.
	* .gitignore: Add /bpf_attr_check.c.

2018-04-04  Dmitry V. Levin  <ldv@altlinux.org>

	build: generate all union bpf_attr checks automatically.
	Rather than list by hand some members of union bpf_attr that we check
	for availability, automatically list all members of union bpf_attr we
	are aware of.

	* m4/gen_bpf_attr_m4.sh: New file.
	* bootstrap: Invoke it.
	* configure.ac (AC_CHECK_HEADERS([linux/bpf.h])): Use st_BPF_ATTR.
	* m4/.gitignore: New file.

2018-04-04  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: move definitions of bpf_attr structures to separate header file.
	This also unifies decoders of bpf commands by moving common code
	to new macros.

	* bpf_attr.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* bpf.c: Include it.
	(DEF_BPF_CMD_DECODER): Rename to BEGIN_BPF_CMD_DECODER, add code common
	to all decoders.  All users updated.
	(END_BPF_CMD_DECODER): New macro, add its invocation to all users
	of BEGIN_BPF_CMD_DECODER macro.

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Introduce print_big_u64_addr.
	This is needed at least for bpf, btrfs, and sg_io, as 32-bit tracer
	cannot figure out whether the kernel is 32-bit or 64-bit,
	and its behaviour differs when it handles u64 as a pointer.

	* linux/arch_defs_.h [!CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL]
	(CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL): New definition, default to 0.
	* linux/arm/arch_defs_.h (CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL):
	Define to 1.
	* linux/i386/arch_defs_.h (CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL):
	Likewise.
	* linux/mips/arch_defs_.h (CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL):
	Likewise.
	* linux/powerpc/arch_defs_.h (CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL):
	Likewise.
	* linux/riscv/arch_defs_.h (CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL):
	Likewise.
	* linux/s390/arch_defs_.h (CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL):
	Likewise.
	* linux/sparc/arch_defs_.h (CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL):
	Likewise.
	* linux/tile/arch_defs_.h (CAN_ARCH_BE_COMPAT_ON_64BIT_KERNEL):
	Likewise.
	* defs.h (print_big_u64_addr): New function.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	defs.h: introduce max_addr and max_kaddr macros.
	In order to check an address against maximum addr/kaddr value
	for the current personality.

	* degs.h (max_addr, max_kaddr): New macros.

2018-04-04  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce static_assert.
	We are going to use static_assert provided by <assert.h> or,
	if it doesn't work, our cheap imitation that doesn't display
	the message specified as the second argument of static_assert.

	* configure.ac (AC_CACHE_CHECK): Check for static_assert in <assert.h>,
	define HAVE_STATIC_ASSERT if it is available.
	* static_assert.h: New file.
	* Makefile.am (strace_SOURCES): Add it.

2018-04-04  Dmitry V. Levin  <ldv@altlinux.org>

	tests: forward SIZEOF_KERNEL_LONG_T and SIZEOF_LONG to C preprocessor.
	* tests/Makefile.am (AM_CPPFLAGS): Forward SIZEOF_KERNEL_LONG_T
	and SIZEOF_LONG as TESTS_SIZEOF_KERNEL_LONG_T and TESTS_SIZEOF_LONG.
	* tests/tests.h [TESTS_SIZEOF_KERNEL_LONG_T] (SIZEOF_KERNEL_LONG_T):
	Redefine to TESTS_SIZEOF_KERNEL_LONG_T.
	[TESTS_SIZEOF_LONG] (SIZEOF_LONG): Redefine to TESTS_SIZEOF_LONG.

	Complements: v4.21~5 ("Export SIZEOF_LONG and SIZEOF_KERNEL_LONG_T to tests")

2018-04-04  Dmitry V. Levin  <ldv@altlinux.org>

	tests/tests.h: fix indentation.

	tests: fix potential errno clobbering in netlink_kobject_uevent.test.
	* tests/netlink_kobject_uevent.c (errstr): New variable.
	(sys_send): New function.
	(main): Use them.

2018-04-03  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Restore kvm ioctl definitions for aarch64 and mips architectures.
	* maint/ioctls_sym.sh: Add aarch64 and mips architectures to the list
	of kvm-capable architectures.
	* linux/aarch64/ioctls_arch0.h: Regenerate.
	* linux/mips/ioctls_arch0.h: Regenerate.

	Fixes: v4.15~92 ("Move KVM_* ioctl entries from ioctls_inc*.h to ioctls_arch*.h")

2018-04-03  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Update ioctl entries from linux v4.16.
	* linux/32/ioctls_inc_align16.h: Update from linux v4.16
	using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* linux/arm/ioctls_arch0.h: Likewise.
	* linux/i386/ioctls_arch0.h: Likewise.
	* linux/powerpc/ioctls_arch0.h: Likewise.
	* linux/s390/ioctls_arch0.h: Likewise.
	* linux/s390x/ioctls_arch0.h: Likewise.
	* linux/x86_64/ioctls_arch0.h: Likewise.
	* NEWS: Mention this.

	maint: update for linux 4.16.
	* maint/ioctls_sym.sh: Add workaround for linux/ndctl.h file.
	Update workaround for media/v4l2-common.h file.
	(x86_list): Add KVM_GET_MSR_FEATURE_INDEX_LIST.

2018-04-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util.c: amend sprinttime_ex description a bit.
	* util.c (sprinttime_ex): Document return value.

	tests/bpf.c: add a check for NULL bpf_attr pointer.
	* tests/bpf.c (main): Add a check with 0 passed in the third argument.

2018-04-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: print byte range for extra data.
	As it could be not entirely clear what bytes are printed.

	* bpf.c (decode_attr_extra_data): Print a comment about the byte range
	to be printed.
	* tests/bpf.c: Update expected output.

2018-04-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Remove addflags.
	It has only single user and implementation of xlat styles for it would
	lead to lots of code duplication.

	* defs.h (addflags): Remove declaration.
	* mem.c (print_mmap_flags): Convert addflags call into printflags64 with
	non-zeroeness flags check.
	* xlat.c (addflags): Remove.

2018-04-01  Dmitry V. Levin  <ldv@altlinux.org>

	Add i18n support.
	Let's make a step towards the growing strace userbase all around
	the world and translate something to the language of their choice.

	This change enables translation of error messages corresponding
	to errno codes, making it consistent with error diagnostics of other
	i18n-aware tools, e.g.

	$ LANG=es_ES strace -qq -a38 -P /missing unlink /missing
	unlink("/missing")                    = -1 ENOENT (No existe el fichero o el directorio)
	unlink: no se puede deshacer el enlace '/missing': No existe el fichero o el directorio

	* strace.c: Include <locale.h>.
	(main): Invoke setlocale.
	* tests/init.sh: Export LC_ALL=C.
	* NEWS: Mention this enhancement.

2018-03-29  Dmitry V. Levin  <ldv@altlinux.org>

	Remove RVAL_PRINT_ERR_VAL.
	* defs.h (RVAL_PRINT_ERR_VAL): Remove.
	* ldt.c (SYS_FUNC(modify_ldt)): Return 0.
	* syscall.c (syscall_exiting_trace): When printing an error,
	always print struct tcb.u_rval as if RVAL_PRINT_ERR_VAL was set.

2018-03-29  Dmitry V. Levin  <ldv@altlinux.org>

	Treat RVAL_DECIMAL the same way as RVAL_UDECIMAL.
	Assuming that syscalls may return negative values only as error codes,
	always print non-error syscall return codes as unsigned.

	* defs.h (RVAL_UDECIMAL): Remove.
	(RVAL_DECIMAL): Rename to RVAL_UDECIMAL.
	* syscall.c (syscall_exiting_trace) <case RVAL_DECIMAL>: Remove.
	* clone.c (SYS_FUNC(fork)): Remove RVAL_UDECIMAL.
	* lseek.c (SYS_FUNC(lseek)): Likewise.
	* prctl.c (SYS_FUNC(prctl)): Likewise.
	* uid.c (SYS_FUNC(getuid), SYS_FUNC(setfsuid)): Likewise.
	* times.c (SYS_FUNC(times)): Always return 0.
	* tests/inject-nf.c (main): Update expected output.

2018-03-29  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check handling of some invalid delay injection parameters.
	* tests/qual_inject-syntax.test: Check for negative delay injection
	parameters.  Check for overriding delay injection parameters.

2018-03-29  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Implement injection of negative return values.
	Extend the range of injected return value to the maximum, print warnings
	if negative injection value can be clipped in compat personality or can
	inadvertently turn into a fault injection.

	* defs.h (INJECT_F_ERROR): New macro.
	* filter_qualify.c (parse_inject_token): Revert type of intval local
	variable back to int, check INJECT_F_ERROR along with INJECT_F_RETVAL,
	use strtoull to parse retval argument, print warnings in case of retval
	clipping and inadvertent fault injection.
	(qualify_inject_common): Set INJECT_F_ERROR instead of INJECT_F_RETVAL.
	* syscall.c (tamper_with_syscall_exiting): Check inject_data.flags
	to determine whether a fault injection or retval injection has to be
	performed.
	(syscall_exiting_trace) <case RVAL_DECIMAL>: Explicitly print
	tcp->u_rval as int if current_klongsize < sizeof(tcp->u_rval).
	* tests/inject-nf.c (main): Update.
	* tests/inject-nf.test: Test injection of negative return values.
	* tests/qual_inject-syntax.test: Remove retval=-1 check as it is now
	allowed, add checks for invalid retval parameters.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-28  Dmitry V. Levin  <ldv@altlinux.org>

	arch_defs.h: fix typo in comment.

	Move delay interface from defs.h to delay.h.
	* defs.h (alloc_delay_data, fill_delay_data, is_delay_timer_armed,
	delay_timer_expired, arm_delay_timer, delay_tcb): Move...
	* delay.h: ... to new file.
	* Makefile.am (strace_SOURCES): Add it.
	* filter_qualify.c: Include it.
	* strace.c: Likewise.
	* syscall.c: Likewise.

2018-03-28  Dmitry V. Levin  <ldv@altlinux.org>

	Turn struct inject_data.rval into an index.
	Add one level of indirection to decrease the size of struct inject_data
	as hundreds of these structures are created for each process when
	injection mechanism is activated.

	* retval.h: New file.
	* retval.c: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* defs.h (struct inject_data): Replace rval field with rval_idx.
	* filter_qualify.c: Include "retval.h".
	(parse_inject_token, qualify_inject_common): Initialize
	struct inject_data.rval_idx using retval_new.
	* syscall.c: Include "retval.h".
	(tamper_with_syscall_exiting): Obtain the value that has to be injected
	using retval_get.

2018-03-27  Dmitry V. Levin  <ldv@altlinux.org>

	defs.h: update comment.
	* defs.h (struct inject_data): Update comment about flags.

	Complements: v4.21-108-gba8e768 ("Implement delay injection")

2018-03-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: cleanup mmap_flags.in.
	* xlat/mmap_flags.in (_MAP_NEW): Remove SunOS-specific comment, add
	a comment that this is a SPARC-specific constant (from
	arch/sparc/include/uapi/asm/mman.h).
	(MAP_GROWSUP): IA-64-specific constant (from
	arch/ia64/include/uapi/asm/mman.h).
	(MAP_INHERIT): Add a comment that this is a SPARC-specific constant
	(from arch/sparc/include/uapi/asm/mman.h).
	(_MAP_INHERIT): Add a comment that this is an Alpha-specific constant
	(from arch/alpha/include/uapi/asm/mman.h).
	(MAP_ANON): Remove, FreeBSD-specific constant.
	(MAP_HASSEMAPHORE): Rename to...
	(_MAP_HASSEMAPHORE): ...this, add a comment that this is an
	Alpha-specific constant (from arch/alpha/include/uapi/asm/mman.h).
	(MAP_NOSYNC, MAP_NOCORE): Remove.
	(MAP_AUTOGROW, MAP_AUTORSRV, MAP_LOCAL): Add a comment that this is
	an architecture-specific constant (from
	arch/mips/include/uapi/asm/mman.h, arch/xtensa/include/uapi/asm/mman.h).
	(_MAP_UNALIGNED): Add a comment that this is an Alpha-specific constant
	(from arch/alpha/include/uapi/asm/mman.h).

2018-03-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of kern_features syscall.
	* tests/kern_features.c: New file.
	* tests/kern_features-fault.test: New test.
	* tests/gen_tests.in (kern_features): New entry.
	* tests/Makefile.am (DECODER_TESTS): Add kern_features-fault.test.
	* tests/pure_executables.list: Add kern_features.
	* tests/.gitignore: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	sparc, sparc64: implement kern_features decoder.
	* sparc.c: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* linux/sparc/syscallent.h ([340]): Remove NF flag, set kern_features
	decoder.
	* linux/sparc64/syscallent.h ([340]): Likewise.
	* xlat/sparc_kern_features.in: New file.
	* NEWS: Mention this enhancement.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-27  Dmitry V. Levin  <ldv@altlinux.org>

	evdev: move mpers-specific parsers to a separate file.
	This change reduces binary code duplication on mpers platforms
	and prepares evdev parsers to use printxval_bsearch.

	* defs.h (evdev_ioctl, print_evdev_ff_type): New prototypes.
	* evdev.c (evdev_ioctl): Un-mpersify.
	(evdev_write_ioctl) Remove EVIOCSFF case, forward default case
	to evdev_write_ioctl_mpers.
	(decode_envelope, ff_effect_ioctl): Move to...
	* evdev_mpers.c: ... new file.
	* Makefile.am (strace_SOURCES): Add evdev_mpers.c.

2018-03-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ci: install libunwind8-dev.
	While in debian/control we use libunwind-dev in Build-Depends, in case
	of ci we have to be more conservative and use the name portable across
	different ci implementations.

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

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-23  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check injection of return values into a "never fails" syscall.
	* tests/inject-nf.c: New file.
	* tests/inject-nf.test: New test.
	* tests/.gitignore: Add inject-nf.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(MISC_TESTS): Add inject-nf.test.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-23  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce raw syscall invocation wrappers.
	Unfortunately, syscall(3) provided by libc is too smart
	for some of our needs.

	* linux/raw_syscall.h: New file.
	* linux/aarch64/raw_syscall.h: Likewise.
	* linux/alpha/raw_syscall.h: Likewise.
	* linux/arc/raw_syscall.h: Likewise.
	* linux/arm/raw_syscall.h: Likewise.
	* linux/avr32/raw_syscall.h: Likewise.
	* linux/bfin/raw_syscall.h: Likewise.
	* linux/hppa/raw_syscall.h: Likewise.
	* linux/i386/raw_syscall.h: Likewise.
	* linux/ia64/raw_syscall.h: Likewise.
	* linux/m68k/raw_syscall.h: Likewise.
	* linux/metag/raw_syscall.h: Likewise.
	* linux/microblaze/raw_syscall.h: Likewise.
	* linux/mips/raw_syscall.h: Likewise.
	* linux/nios2/raw_syscall.h: Likewise.
	* linux/or1k/raw_syscall.h: Likewise.
	* linux/powerpc/raw_syscall.h: Likewise.
	* linux/powerpc64/raw_syscall.h: Likewise.
	* linux/riscv/raw_syscall.h: Likewise.
	* linux/s390/raw_syscall.h: Likewise.
	* linux/s390x/raw_syscall.h: Likewise.
	* linux/sh/raw_syscall.h: Likewise.
	* linux/sh64/raw_syscall.h: Likewise.
	* linux/sparc/raw_syscall.h: Likewise.
	* linux/sparc64/raw_syscall.h: Likewise.
	* linux/tile/raw_syscall.h: Likewise.
	* linux/x32/raw_syscall.h: Likewise.
	* linux/x86_64/raw_syscall.h: Likewise.
	* linux/xtensa/raw_syscall.h: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.

2018-03-23  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix potentially unbound variable in kernel_version_code.
	Fix the following use case:

		$ sh -uc '. tests/init.sh; kernel_version_code 4.5'
		tests/init.sh: line 242: 3: unbound variable

	* tests/init.sh (kernel_version_code): Fix potentially unbound variable.

2018-03-23  Dmitry V. Levin  <ldv@altlinux.org>

	strace: further optimize unblocking of the delay signal handler.
	Do not unblock the delay signal handler unless the delay timer is armed.

	* defs.h (is_delay_timer_created): Remove.
	(is_delay_timer_armed, delay_timer_expired): New prototypes.
	* delay.c (delay_timer_is_armed): New static variable.
	(is_delay_timer_created): Add static qualifier.
	(is_delay_timer_armed, delay_timer_expired): New functions.
	(arm_delay_timer): Set delay_timer_is_armed.
	* strace.c (next_event): Use is_delay_timer_armed instead of
	is_delay_timer_created to check whether the delay signal handler
	has to be unblocked.
	(timer_sighandler): Invoke delay_timer_expired.

2018-03-23  Dmitry V. Levin  <ldv@altlinux.org>

	strace: rewrite restart error handling without sigsetjmp/siglongjmp.
	Further simplify and optimize error handling of the delay signal handler
	by replacing sigsetjmp/siglongjmp mechanism with an error flag.

	* strace.c: Do not include <setjmp.h>.
	(restart_failed): New volatile variable.
	(timer_jmp_buf): Remove.
	(next_event): Cache is_delay_timer_created() return value,
	remove sigsetjmp invocation, check restart_failed instead.
	(timer_sighandler): Replace siglongjmp with setting restart_failed.

2018-03-23  Dmitry V. Levin  <ldv@altlinux.org>

	strace: do not call sigsetjmp without a delay timer.
	As sigsetjmp costs a syscall, do not call it unless a delay timer
	is already created and its signal handler is going to be unblocked.

	* strace.c (next_event): Move sigsetjmp invocation under
	is_delay_timer_created() condition.

	Optimizes: v4.21-108-gba8e768 ("Implement delay injection")

2018-03-22  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/bpf.c: convert TEST_BPF_ macro to a function.
	As it looks like there's no compelling reason to keep it as a macro and
	leaving it so quite complicates modification of the routine and makes
	them error-prone.

	* tests/bpf.c (TEST_BPF_): Convert it to...
	(test_bpf): ...this.  Rename cmd_ to cmd, cmd_str_ to cmd_str,
	init_first_ to init_first, print_first_ to print_first, init_attr_
	to init_attr, print_attr_ to print_attr.
	(TEST_BPF): Call test_bpf_ instead of TEST_BPF_.

2018-03-22  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: btrfs.c whitespace cleanup.
	* tests/btrfs.c: Add spaces after PRI* format specifiers.

2018-03-22  Elvira Khabirova  <lineprinter@altlinux.org>

	tests: check delay injection.
	* tests/delay.c: New file.
	* tests/delay.test: New test.
	* tests/.gitignore: Add delay.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(delay_LDADD): New variable.
	(MISC_TESTS): Add delay.test.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-22  Elvira Khabirova  <lineprinter@altlinux.org>

	Implement delay injection.
	Add -e inject=SET:delay_enter= and -e inject=SET:delay_exit= options.

	* configure.ac (AC_SEARCH_LIBS): Check for timer_create -lrt.
	* delay.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	(strace_LDADD): Add $(timer_LIBS).
	* defs.h (INJECT_F_DELAY_ENTER, INJECT_F_DELAY_EXIT,
	TCB_INJECT_DELAY_EXIT, TCB_DELAYED, inject_delay_exit, syscall_delayed):
	New macros.
	(alloc_delay_data, fill_delay_data, is_delay_timer_created,
	arm_delay_timer, delay_tcb): New prototypes.
	(struct inject_data): Replace reserved field with delay_idx.
	(struct tcb): Add delay_expiration_time field.
	* filter_qualify.c (parse_delay_token): New function.
	(parse_inject_token): Use it.
	(qualify_inject_common): Initialize struct inject_opts.data.delay_idx.
	* strace.c: Include <setjmp.h>
	(timer_jmp_buf, timer_set): New static variables.
	(timer_sighandler, restart_delayed_tcb, restart_delayed_tcbs): New
	functions.
	(init): Block SIGALRM, set SIGALRM handler.
	(dispatch_event): Do not restart delayed syscalls.
	(next_event): Unblock SIGALRM during wait4 invocation.
	* syscall.c (tamper_with_syscall_entering): Arm delay timer if
	INJECT_F_DELAY_ENTER injection flag is set, set TCB_INJECT_DELAY_EXIT
	flag if INJECT_F_DELAY_EXIT injection flag is set.
	tamper_with_syscall_exiting): Arm delay timer if inject_delay_exit.
	(syscall_exiting_trace): Call tamper_with_syscall_exiting in case of
	inject_delay_exit.
	(syscall_exiting_finish): Clear TCB_INJECT_DELAY_EXIT flag.
	* strace.1.in: Document delay injection.
	* NEWS: Mention this improvement.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-22  Dmitry V. Levin  <ldv@altlinux.org>

	Do not block handled signals in interactive mode.
	Let these signals be handled asynchronously as they are acted on
	only when waiting for process state changes.

	* strace.c (start_set, blocked_set): Remove.
	(set_sighandler): Do not update blocked_set.
	(startup_attach, init, next_event): Remove all sigprocmask calls.

2018-03-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: improve handling of various sizes of bpf_prog_attr structure.
	As program attributes have been added gradually over kernel versions,
	attribute size less than expected should be printed accordingly.

	* bpf.c (DEF_BPF_CMD_DECODER(BPF_PROG_LOAD)): Do not print structure
	fields if their size is less than the initially introduced (in Linux
	commit v3.18-rc1~52^2~1^2~7) version.  Print fields of union bpf_attr
	introduced in various kernel versions when the length is big enough
	(new fields were introduced in Linux commits v3.18-rc1~52^2~1^2~4,
	v4.1-rc1~84^2~50, and v4.12-rc2~34^2~29^2~2).
	* tests/bpf.c (print_BPF_PROG_LOAD_first): Update expected output.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	btrfs: print struct btrfs_ioctl_logical_ino_args.reserved if non-zero.
	* btrfs.c (btrfs_ioctl) <case BTRFS_IOC_LOGICAL_INO>: Print
	struct btrfs_ioctl_logical_ino_args.reserved field if it is not zero.
	* tests/btrfs.c (btrfs_test_ino_path_ioctls): Check it.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Move is_filled and IS_ZERO to macros.h, rename IS_ZERO to IS_ARRAY_ZERO.
	* s390.c: Replace all IS_ZERO invocations with IS_ARRAY_ZERO.
	(is_filled, IS_ZERO): Move...
	* macros.h: ...here.
	(is_filled): Add inline qualifier, add const qualifier to ptr.
	(IS_ZERO): Rename to IS_ARRAY_ZERO, cast arr_ to "const char *".

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-20  Dmitry V. Levin  <ldv@altlinux.org>

	mpers.m4: enhance workaround for missing gnu/stubs-*.h files.
	Make generated empty gnu stub files available for mpers_test.sh check.

	* m4/mpers.m4 (st_MPERS): Add $IFLAG to CPPFLAGS for mpers_test.sh
	invocation.

	Complements: v4.11~223 ("mpers.m4: workaround missing gnu/stubs-*.h files")

2018-03-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	README.md: add references to binary strace packages.
	* README.md: Add references to binary strace packages in OBS,
	Fedora rawhide, and Sisyphus.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	INSTALL-git.md: enhance phrasing.
	* INSTALL-git.md: Enhance phrasing.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-20  Dmitry V. Levin  <ldv@altlinux.org>

	bootstrap: distribute README.
	* bootstrap: Install README before invoking autoreconf to get README
	included into distributed tarball.

	Fixes: v4.21-93-g4bb8454 ("Move README to dist subdirectory")

2018-03-20  Dmitry V. Levin  <ldv@altlinux.org>

	Replace struct timeval with struct timespec in time measurements.
	This is required to implement more precise time measurements.

	* Makefile.am (strace_LDADD): Add $(clock_LIBS).
	* defs.h (struct tcb): Change the type of stime, dtime, and etime fields
	from struct timeval to struct timespec, all users updated.
	(syscall_exiting_decode, syscall_exiting_trace, count_syscall): Change
	the type of "struct timeval *" argument to "struct timespec *", all
	users updated.
	(tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_div, tv_mul): Rename to
	ts_nz, ts_cmp, ts_float, ts_add, ts_sub, ts_div, and ts_mul.  Change
	the type of all "struct timeval *" arguments to "struct timespec *",
	all users updated.
	* util.c (tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_div, tv_mul):
	Rename to ts_nz, ts_cmp, ts_float, ts_add, ts_sub, ts_div, and ts_mul.
	Change the type of all "struct timeval *" arguments to "struct timespec *".
	* count.c (struct call_counts): Change the type of "time" field
	from struct timeval to struct timespec, all users updated.
	(overhead): Change type from struct timeval to struct timespec, all
	users updated.
	(count_syscall): Change the type of "struct timeval *" argument to
	"struct timespec *".
	* strace.c (printleader): Change the type of struct timeval variables
	to struct timespec, call clock_gettime instead of gettimeofday.
	(next_event, trace_syscall): Change the type of struct timeval variables
	to struct timespec.
	* syscall.c (syscall_entering_finish, syscall_exiting_decode): Call
	clock_gettime instead of gettimeofday.

2018-03-20  Dmitry V. Levin  <ldv@altlinux.org>

	Fix -O option handling.
	Fast syscalls usually take less than a microsecond of system cpu time
	nowadays, making -O option almost useless.

	* count.c (call_summary_pers): Avoid negative time counts.
	* tests/count.test: Check it.
	* NEWS: Mention it.

2018-03-16  Dmitry V. Levin  <ldv@altlinux.org>

	count: cleanup count_syscall.
	* count.c (shortest): Remove.
	(overhead): Initialize to zero.
	(call_summary_pers): Remove shortest handling.
	(count_syscall): Remove dead code.  The remaining code does the same
	wrong calculations as before the change, though.

	printleader: cleanup tflag handling.
	* strace.c (printleader): Move declarations of variables closer
	to their first use.

2018-03-16  Dmitry V. Levin  <ldv@altlinux.org>

	Move install.texi to maint subdirectory.
	This file comes from GNU Autoconf and is used to generate INSTALL file.

	* install.texi: Move...
	* maint/install.texi: ...here.

2018-03-16  Eugene Syromyatnikov  <evgsyr@gmail.com>

	doc: update commit requirements.
	* README-hacking (Requirements): Enhance phrasing.
	(Commit log requirements): Rename to "Commit requirements",
	describe "absence of whitespace errors" requirement, add references
	to the Linux kernel coding style and scripts/checkpatch.pl script.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-16  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Move README to dist subdirectory.
	README was originally written for users of distribution tarballs.
	Nowadays it appears to be confusing for those who build strace
	using a GIT version of strace source code.

	* README: Move...
	* dist/README: ...here.
	* bootstrap: Copy README from dist subdirectory to the toplevel
	directory after successful autoreconf.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
	References: https://github.com/strace/strace/issues/56

2018-03-15  Eugene Syromyatnikov  <evgsyr@gmail.com>

	README: synchronise with README.md.
	* README: Extend description, reference COPYING.

2018-03-15  Eugene Syromyatnikov  <evgsyr@gmail.com>

	poll.c: remove special INFTIM handling.
	On Linux, poll syscall interprets any negative timeout value as an
	infinite timeout, so no need to handle BSD-specific INFTIM.

	* poll.c (SYS_FUNC(poll)): Remove INFTIM handling.

2018-03-14  Dmitry V. Levin  <ldv@altlinux.org>

	build: do not hardcode -lrt.
	Depending on libc implementation, various -lrt functions can be
	implemented either in -lc or in -lrt.  For example, starting with
	glibc-2.17 the clock_* suite of functions is available directly in -lc.

	Check whether clock_* and mq_* suites of functions are provided
	by -lrt or by the main C library, do not link with -lrt unnecessarily.

	This change affects only tests yet, but this is going to be
	more important as soon as strace starts using clock_gettime.

	* configure.ac (AC_SEARCH_LIBS): Check for clock_gettime and mq_open
	in -lrt.
	(AC_SUBST): Add clock_LIBS and mq_LIBS.
	* tests/Makefile.am (mq_LDADD): Replace -lrt with $(mq_LIBS).
	(threads_execve_LDADD, times_LDADD): Replace -lrt with $(clock_LIBS).

2018-03-14  Dmitry V. Levin  <ldv@altlinux.org>

	tests: do not link with -lrt unnecessarily.
	* tests/Makefile.am (attach_f_p_LDADD): Remove -lrt.
	(clock_xettime_LDADD, mq_sendrecv_LDADD, mq_sendrecv_read_LDADD,
	mq_sendrecv_write_LDADD): Remove.

2018-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	Optimize pid2tcb.
	Introduce an internal cache of pid2tcb translations.
	This can save more than 80% of CPU user time spent by strace.

	Tested using the following setup:

		#include <unistd.h>
		#include <sys/stat.h>
		#include <sys/wait.h>
		int main()
		{
			int i;
			sleep(1);
			for (i = 1; i < 1000; ++i) {
				pid_t pid = fork();
				if (pid < 0)
					return 2;
				if (pid)
					return wait(&i) != pid || i;
			}
			sleep(1);
			for (i = 0; i < 10000000; ++i)
				umask(0777);
			return 0;
		}

		old$ ./set_ptracer_any ./pid2tcb >pid2tcb.wait & \
		  while [ ! -s pid2tcb.wait ]; do sleep 0.1; done; \
		  time -f '%Uuser %Ssystem %eelapsed %PCPU' \
		  ../strace -qq -enone -esignal=none -f -p $!
		5.51user 104.90system 122.45elapsed 90%CPU

		new$ ./set_ptracer_any ./pid2tcb >pid2tcb.wait & \
		  while [ ! -s pid2tcb.wait ]; do sleep 0.1; done; \
		  time -f '%Uuser %Ssystem %eelapsed %PCPU' \
		  ../strace -qq -enone -esignal=none -f -p $!
		1.29user 102.78system 114.97elapsed 90%CPU

2018-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	Enable USE_SEIZE code unconditionally.
	It is by no means an experimental code.

	* defs.h (USE_SEIZE): Remove.
	* strace.c [!USE_SEIZE]: Remove.

2018-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	ci: clone musl from the local server.
	Assume that strace project on the local server contains an appropriate
	musl repository, use this repository instead of hardcoded github
	location.

	* ci/install-dependencies.sh (clone_repo): Use local server by default.
	(musl-gcc): Un-hardcode the location of musl repository.

2018-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	ci: refactor cloning of additional repositories.
	* ci/install-dependencies.sh (clone_repo): New function.
	Use it instead of direct invocations of git clone.

	ci: extend error diagnostics when configure invocation fails.
	* ci/run-build-and-tests.sh: Include $CC -dumpspecs output in addition
	to config.log when ./configure fails.

	ci: rename travis-build.sh and travis-install.sh scripts.
	* travis-build.sh: Rename to ci/run-build-and-tests.sh, all callers
	updated.
	* travis-install.sh: Rename to ci/install-dependencies.sh, all callers
	updated.

	tests: extend ioctl.test libc protection to -y output.
	* tests/ioctl.test: Extend the filter of ioctl calls with standard
	descriptor arguments to -y output.

2018-03-12  Harsha Sharma  <harshasharmaiitr@gmail.com>

	ptp.c: print field names and use macros form print_fields.h.
	* ptp.c: Include "print_fields.h".
	(ptp_ioctl): Print field names with field values for PTP_PEROUT_REQUEST,
	use macros from print_fields.h.

2018-03-11  Chen Jingpiao  <chenjingpiao@gmail.com>

	tests: add check for decoding of netfilter subsystem.
	* tests/netlink_netfilter.c(test_nfgenmsg): Add check for decoding
	of netfilter subsystem.

	nfnetlink: introduce generic netfilter subsystem decoder.
	* netlink_netfilter.c: Include "nlattr.h".
	(decode_netlink_netfilter): Call decode_nlattr.

2018-03-11  Chen Jingpiao  <chenjingpiao@gmail.com>

	Move nl_netfilter_msg_types definition from netlink.c to netlink_netfilter.c
	The side effect of #include "xlat/nl_netfilter_msg_types.h" is
	NFNL_MSG_BATCH_* constants properly defined in that header file.
	While netlink.c does not use these constants itself,
	netlink_netfilter.c is going to need them soon.

	* defs.h (nl_netfilter_msg_types): New xlat prototype.
	* netlink.c: Move inclusion of "xlat/nl_netfilter_msg_types.h" ...
	* netlink_netfilter.c: ... here.

2018-03-11  Chen Jingpiao  <chenjingpiao@gmail.com>

	tests: add check for NETLINK_NETFILTER parser.
	* tests/netlink_netfilter.c: Include <netinet/in.h>, <arpa/inet.h>
	and <linux/netfilter/nf_tables.h>.
	Replace "netlink.h" with "test_netlink.h".
	(NFNL_SUBSYS_NFTABLES, NFT_MSG_NEWTABLE): New macros.
	(test_nlmsg_done, test_nfgenmsg): New functions.
	(main): Use them.

	netlink: introduce NETLINK_NETFILTER parser.
	* netlink_netfilter.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (decode_netlink_netfilter): New prototype.
	* netlink.c (netlink_decoders): Add NETLINK_NETFILTER.
	* xlat/netfilter_versions.in: New file.

2018-03-11  Chen Jingpiao  <chenjingpiao@gmail.com>

	xlat: remove NFNL_SUBSYS_COUNT constant.
	NFNL_SUBSYS_COUNT is not a symbol with some constant value, it changes
	with time, just print it as an unrecognized number.

	* xlat/nl_netfilter_subsys_ids.in (NFNL_SUBSYS_COUNT): Remove.

2018-03-10  Dmitry V. Levin  <ldv@altlinux.org>

	inject_data: make room for more injection features.
	* defs.h (struct inject_data): Squeeze flags and signo fields from
	uint16_t to uint8_t to make room for more injection features.

2018-03-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: sort v4l2_pix_fmts.in and v4l2_sdr_fmts.in.
	* xlat/v4l2_pix_fmts.in: Sort by value, add a comment about sorting.
	* xlat/v4l2_sdr_fmts.in: Likewise.

2018-03-09  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: add comments to all sorted xlat files.
	Add a short comment describing the method used to sort entries.

	* xlat/ethernet_protocols.in: Update the comment about sorting.
	* xlat/fsmagic.in: Likewise.
	* xlat/evdev_keycode.in: Add a comment about sorting.
	* xlat/hw_breakpoint_type.in: Likewise.
	* xlat/perf_hw_cache_id.in: Likewise.
	* xlat/perf_hw_cache_op_id.in: Likewise.
	* xlat/perf_hw_cache_op_result_id.in: Likewise.
	* xlat/perf_hw_id.in: Likewise.
	* xlat/perf_sw_ids.in: Likewise.
	* xlat/perf_type_id.in: Likewise.

2018-03-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: remove page size caching.
	get_pagesize() has a static cache anyway, no need to duplicate it.

	* bpf.c (SYS_FUNC(bpf)): Remove static size_t page_size and its
	initialisation, use get_pagesize() as the size of buf directly.

2018-03-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf_filter: fix indentation of the switch clause.
	* bpf_filter.c (print_bpf_filter_code): Fix switch clause indentation.

2018-03-08  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: provide fallback definitions for arch-independent mmap flags.
	This is important for recently introduced MAP_SHARED_VALIDATE flag.

	* xlat/mmap_flags.in (MAP_SHARED, MAP_PRIVATE, MAP_SHARED_VALIDATE):
	Add constant values.

	Fixes: v4.21-67-g8c209d1 ("tests: fix remap_file_pages.test breakage on hppa")

2018-03-07  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bpf: print kern_version in the form of KERNEL_VERSION macro.
	* bpf.c (DEF_BPF_CMD_DECODER(BPF_PROG_LOAD)): Print
	union bpf_attr.kern_version in the form of KERNEL_VERSION macro call.
	* tests/bpf.c: Update expected output.

2018-03-07  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: fix remap_file_pages.test breakage on hppa.
	Apparently, hppa is the only architecture that has MAP_TYPE
	defined to 0x3 instead of 0xf, and the tests hit that corner case.

	* tests/remap_file_pages.c (main) [MAP_HUGETLB]: Print the value
	of mapping type depending on the architecture (MAP_SHARED_VALIDATE
	for hppa and unknown value for other architectures).

	Fixes: v4.21~59 ("xlat: update MAP_* constants")

2018-03-07  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Sort Ethernet protocols xlat.
	* defs.h (ethernet_protocols_size): New declaration.
	* netlink_packet_diag.c (decode_packet_diag_req): Use
	printxval_searchnn to print Ethernet protocols.
	* sockaddr.c (ethernet_protocols_size): New constant, item count
	in ethernet_protocols array.
	(print_sockaddr_data_ll): Use printxval_search instead of
	printxval to print Ethernet protocols.
	* xlat/ethernet_protocols.in: Sort it by value, add comment
	about the fact.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-07  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Change sorted arrays to be terminated with XLAT_END like unsorted arrays
	It is quite unwieldy to have this distinction between sorted and
	unsorted arrays when we can just decrement the size in a wrapper.

	* defs.h (printxval_search): Decrement array size.
	* xlat/fsmagic.in (#unterminated): Remove.
	* xlat/hw_breakpoint_type.in (#unterminated): Remove.
	* xlat/perf_hw_cache_id.in (#unterminated): Remove.
	* xlat/perf_hw_cache_op_id.in (#unterminated): Remove.
	* xlat/perf_hw_cache_op_result_id.in (#unterminated): Remove.
	* xlat/perf_hw_id.in (#unterminated): Remove.
	* xlat/perf_sw_ids.in (#unterminated): Remove.
	* xlat/perf_type_id.in (#unterminated): Remove.
	* xlat/gen.sh (gen_header): Remove #unterminated support.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1.in: add a note about tracing of scripts without shebang.
	* strace.1.in (.SH NOTES): Note that tracing of scripts without shebang
	won't work.

	Reported-by: Mike Parker
	Closes: https://github.com/strace/strace/issues/46

2018-03-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1.in: mention that -c suppresses regular output.
	As the note that -C makes strace "also print regular output" can be
	easily overlooked.

	* strace.1.in (.SS Statistics) <.TP .B \-c>: Mention that -c supresses
	regular output.

2018-03-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	errnoent.h: add ERECALLCONFLICT.
	* linux/errnoent.h ([530]): Add ERECALLCONFLICT error introduced by
	Linux commit v4.7-rc1~40^2~6.
	* linux/alpha/errnoent.h ([530]): Likewise.
	* linux/hppa/errnoent.h ([530]): Likewise.
	* linux/mips/errnoent.h ([530]): Likewise.
	* linux/sparc/errnoent.h ([530]): Likewise.

	xlat: add BPF_F_ALLOW_MULTI constant.
	* xlat/bpf_attach_flags.in (BPF_F_ALLOW_MULTI): New constant, introduced
	by Linux commit v4.15-rc1~84^2~558^2~7.

	xlat: add BPF_MAP_TYPE_CPUMAP constant.
	* xlat/bpf_map_types.in (BPF_MAP_TYPE_CPUMAP): New constant, introduced
	by Linux commit v4.15-rc1~84^2~427^2~4.

	tests/test_printstrn.c: do not declare i again.

2018-03-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/s390_sthyi.c: make utility functions inline.
	When built with --enable-gcc-Werror, s390_sthyi test build fails
	with the following error:

		s390_sthyi.c:63:1: error: ‘print_u8’ defined but not used [-Werror=unused-function]
		 print_u8(const char *prefix, unsigned char *buf, unsigned int offs, bool zero)
		 ^~~~~~~~

	Apparently, after some back and forth, all occurrences of printing u8
	values landed under verbose printing, so this function is no longer
	used in non-verbose mode.  Let's avoid this in the future by inlining
	all the utility functions in this test.

	* tests/s390_sthyi.c (print_0x8, print_u8, print_u16, print_x32,
	print_weight, ebcdic2ascii, is_empty, print_ebcdic): Add inline
	qualifier.
	[!VERBOSE] (is_empty): Remove "# if VERBOSE" guard.

2018-03-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	btrfs: print struct btrfs_ioctl_logical_ino_args.flags field.
	The field has been introduced in Linux commit v4.15-rc1~135^2~17.

	* btrfs.c: Implement decoding of
	struct btrfs_ioctl_logical_ino_args.flags field.
	* configure.ac: Check for struct btrfs_ioctl_logical_ino_args.flags
	presence in linux/btrfs.h.
	* tests/btrfs.c: Update expected output, add additional checks.
	* xlat/btrfs_logical_ino_args_flags.in: New file.

2018-03-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	btrfs.c: print __u64 fields with pointer semantics using printaddr64.
	* btrfs.c (btrfs_ioctl) <case BTRFS_IOC_INO_PATHS>: Print fspath field
	with printaddr64.
	(btrfs_ioctl) <case BTRFS_IOC_LOGICAL_INO>: Print inodes field with
	printaddr64.
	* tests/btrfs.c: Add checks for NULL in fspath and inodes fields.
	* NEWS: Mention it.

2018-03-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util.c: introduce printaddr64.
	Sometimes, 64-bit value is expected to be interpreted as an address
	(in BTRFS ioctl interface, for example).

	* defs.h (printaddr64): New declaration.
	* util.c (printaddr64): Rename from printaddr, change argument type
	to uint64_t.
	(printaddr): Turn into a thin wrapper around printaddr64.
	(printnum_addr_int, printnum_addr_int64): Use printaddr64 instead of
	printaddr.  printnum_addr_int64 is not used outside the cases where
	kernel_long is less or equal than 64 bit currently, so this change
	should be safe.

2018-03-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	prctl: add decoding of PR_SVE_SET_VL and PR_SVE_GET_VL commands.
	These commands were introduced in Linux commit v4.15-rc1~110^2~9.

	* xlat/pr_sve_vl_flags.in: New file.
	* xlat/prctl_options.in: Likewise.
	* prctl.c: Include "xstring.h" and "xlat/pr_sve_vl_flags.h".
	[!PR_SVE_VL_LEN_MASK] (PR_SVE_VL_LEN_MASK): New macro constant.
	(sprint_sve_val): New function.
	(SYS_FUNC(prctl)): Add decoding for PR_SVE_GET_VL and PR_SVE_SET_VL
	commands.
	* NEWS: Mention it.

2018-03-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Implement PTRACE_SECCOMP_GET_METADATA ptrace request decoding.
	* defs.h (seccomp_filter_flags): New declaration.
	* process.c (SYS_FUNC(ptrace)): Implement PTRACE_SECCOMP_GET_METADATA
	request decoding.
	* ptrace.h [!PTRACE_SECCOMP_GET_METADATA] (PTRACE_SECCOMP_GET_METADATA):
	New macro constant.
	* xlat/ptrace_cmds.in (PTRACE_SECCOMP_GET_METADATA): New constant.
	* tests/ptrace.c (main): Add some checks for PTRACE_SECCOMP_GET_METADATA
	request decoding.
	* NEWS: Mention it.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-06  Dmitry V. Levin  <ldv@altlinux.org>

	build: prepare for -Wimplicit-fallthrough=5.
	* gcc_compat.h (ATTRIBUTE_FALLTHROUGH): New macro.
	* block.c (block_ioctl): Use it instead of "fall through" comment.
	* btrfs.c (btrfs_ioctl): Likewise.
	* loop.c (loop_ioctl): Likewise.
	* mtd.c (mtd_ioctl): Likewise.
	* rtc.c (rtc_ioctl): Likewise.
	* v4l2.c (v4l2_ioctl): Likewise.
	* dm.c (dm_decode_values): Likewise.
	* process.c (SYS_FUNC(ptrace)): Likewise.
	* quota.c (decode_cmd_data): Likewise.
	* ucopy.c (umovestr): Likewise.
	* unwind.c (unwind_print_stacktrace, unwind_capture_stacktrace)):
	Likewise.
	* term.c (term_ioctl): Add ATTRIBUTE_FALLTHROUGH.
	* ioctl.c (ioctl_decode) [ALPHA || POWERPC]: Likewise.
	* m4/st_warn_cflags.m4 (gl_WARN_ADD): Add -Wimplicit-fallthrough=5.
	* tests/ioctl_v4l2.c (init_v4l2_format): Reorganize the switch statement
	without implicit fallthrough.

2018-03-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add eBPF-based device controller constants.
	Add new BPF_PROG_TYPE_CGROUP_DEVICE eBPF program type and new
	BPF_CGROUP_DEVICE eBPF program attach type, added in Linux commit
	v4.15-rc1~84^2~120^2~2.

	* xlat/bpf_attach_type.in (BPF_CGROUP_DEVICE): New constant.
	* xlat/bpf_prog_types.in (BPF_PROG_TYPE_CGROUP_DEVICE): Likewise.
	* NEWS: Mention it.

2018-03-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: provide fallback definitions for input event constants.
	Values added using the following pair of commands:

		$ cat xlat/evdev_keycode.in |
			while read r; do [ -n "$r" ] &&
				sed -rn 's/^#define[[:space:]]+('$r'[[:space:]]+[^[:space:]]+).*/\1/p' \
				~/dev/linux/include/uapi/linux/input-event-codes.h || echo;
			done > xlat/evdev_keycode.in.new
		$ sort -s -n -k1,1 \
			<(awk '{if (NF>1) {last = strtonum($2)}; printf("%d %s\n", last, $0)}' \
				xlat/evdev_keycode.in.new) \
			| sed 's/^[0-9]* //'  > xlat/evdev_keycode.in

	It also verifies that the values are sorted and bsearch-ready.

	* xlat/evdev_keycode.in: Add constant values.

2018-03-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update the list of input event constants.
	Remove some duplicating definitions and add the new ones.

	* xlat/evdev_keycode.in (KEY_HANGUEL): Remove, an alternative name for
	KEY_HANGEUL.
	(KEY_DIRECTION): Remove, an alternative name for KEY_ROTATE_DISPLAY.
	(KEY_BRIGHTNESS_ZERO): Remove, an alternative name for
	KEY_BRIGHTNESS_AUTO.
	(KEY_WIMAX): Remove, an alternative name for KEY_WWAN.
	(BTN_A): Remove, an alternative name for BTN_SOUTH.
	(BTN_B): Remove, an alternative name for BTN_EAST.
	(BTN_X): Remove, an alternative name for BTN_NORTH.
	(BTN_Y): Remove, an alternative name for BTN_WEST.
	(BTN_STYLUS3): New constant, added in Linux commit v4.15-rc1~114^2^2~1.
	(KEY_BRIGHTNESS_TOGGLE): Remove, an alternative name for
	KEY_DISPLAYTOGGLE.
	(KEY_ROTATE_LOCK_TOGGLE): New constant, added in Linux commit
	v4.16-rc1~54^2~67.
	(KEY_DATA): New constant, added in Linux commit v4.9-rc8~12^2.
	(KEY_ONSCREEN_KEYBOARD): New constant, added in Linux commit
	v4.12-rc1~126^2~2^12~5.
	* NEWS: Mention it.

2018-03-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: provide fallback definitions for SCTP socket option constants.
	Values for SCTP_GET_PEER_ADDRS_NUM_OLD, SCTP_GET_PEER_ADDRS_OLD,
	SCTP_GET_LOCAL_ADDRS_NUM_OLD, SCTP_GET_LOCAL_ADDRS_OLD are reconstructed
	from Linux commit v2.6.33-rc1~388^2~167^2~7.

	xlat/socksctpoptions.in: Add constant values.

2018-03-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update the list of SCTP socket option constants.
	* xlat/socksctpoptions.in (SCTP_DELAYED_ACK): Rename to...
	(SCTP_DELAYED_SACK): ...this, per Linux commit v2.6.38-rc2~33^2.
	(SCTP_SOCKOPT_PEELOFF_FLAGS): New constant, introduced in Linux commit
	v4.13-rc1~157^2~39.
	(SCTP_STREAM_SCHEDULER): New constant, introduced in Linux commit
	v4.15-rc1~84^2~567^2~3.
	(SCTP_STREAM_SCHEDULER_VALUE): New constant, introduced in Linux commit
	v4.15-rc1~84^2~567^2~2.
	(SCTP_INTERLEAVING_SUPPORTED): New constant, introduced in Linux commit
	 v4.16-rc1~123^2~384^2~11.
	* NEWS: Mention it.

2018-03-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: provide fallback definitions for Ethernet protocol constants.
	As those are not architecture-specific.

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

2018-03-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update the list of Ethernet protocol constants.
	* xlat/ethernet_protocols.in (ETH_P_ERSPAN2): New constant, introduced
	in Linux commit v4.16-rc1~123^2~355^2~2.
	(ETH_P_IBOE): New constant, introduced in commit v4.11-rc1~73^2~74.
	* NEWS: Mention it.

	v4l2: print known pixel/SDR formats.
	* xlat/v4l2_pix_fmts.in: New file.
	* xlat/v4l2_sdr_fmts.in: Likewise.
	* v4l2.c [!v4l2_fourcc_be] (v4l2_fourcc_be): New macro.
	(print_pixelformat): Add xlat parameter, print constant name
	as a comment if it has been found in xlat.
	(print_v4l2_fmtdesc, print_v4l2_frmivalenum): Pass v4l2_pix_fmts
	to print_pixelformat.
	(print_v4l2_format_fmt) <case V4L2_BUF_TYPE_VIDEO_CAPTURE, case
	V4L2_BUF_TYPE_VIDEO_OUTPUT, case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
	case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, case V4L2_BUF_TYPE_VBI_CAPTURE,
	case V4L2_BUF_TYPE_VBI_OUTPUT>: Pass v4l2_pix_fmts to print_pixelformat.
	(print_v4l2_format_fmt) <case V4L2_BUF_TYPE_SDR_OUTPUT, case
	V4L2_BUF_TYPE_SDR_CAPTURE>: Pass v4l2_sdr_fmts to print_pixelformat.
	* tests/v4l2.c: Test it, update expected output.
	* NEWS: Mention it.

2018-03-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	v4l2: v4l2_fourcc is endianness-agnostic.
	v4l2_fourcc(a, b, c, d) is defined as (a | (b << 8) | (c << 16) | (d << 24)
	regardless of endianness (no mnemonic on big-endian architectures),
	so we don't need special handling for WORDS_BIGENDIAN both in decoder
	and in the test.

	* v4l2.c (print_pixelformat): Change initialisation to a simple
	assignment of character array.
	* tests/ioctl_v4l2.c [WORDS_BIGENDIAN]: Remove.
	* NEWS: Mention this fix.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
	Fixes: v4.10~371 "Implement Video4Linux video-input ioctls decoder"

2018-03-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests: do not include <stdbool.h> in files that include "tests.h"
	Starting with commit v4.21-37-g4f63bc70ca95012d72e288fc3c1eeb3ba26068a4,
	<stdbool.h> is included by tests.h, so all tests that already include
	"tests.h" do not need to include <stdbool.h>.

	* tests/btrfs.c: Do not include <stdbool.h>.
	* tests/file_handle.c: Likewise.
	* tests/futex.c: Likewise.
	* tests/ioctl_dm.c: Likewise.
	* tests/ioctl_loop.c: Likewise.
	* tests/ioctl_sock_gifconf.c: Likewise.
	* tests/keyctl.c: Likewise.
	* tests/mq_sendrecv.c: Likewise.
	* tests/perf_event_open.c: Likewise.
	* tests/s390_guarded_storage.c: Likewise.
	* tests/s390_pci_mmio_read_write.c: Likewise.
	* tests/s390_sthyi.c: Likewise.
	* tests/xet_thread_area_x86.c: Likewise.

2018-03-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check printing of block/char device numbers in -yy mode.
	* tests/dev-yy.c: New file.
	* tests/pure_executables.list: Add dev-yy.
	* tests/.gitignore: Likewise.
	* tests/gen_tests.in (dev-yy): New test.

2018-03-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	printfd: print character/block device number in -yy mode.
	* util.c: Include <sys/stat.h>, <sys/sysmacros.h>,
	and "largefile_wrappers.h".
	(printsocket, printdev): New functions.
	(printfd): Move socket matching/printing logic to printsocket.  Check
	also for printdev.  Escape opening angle bracket in addition to closing angle
	bracket as it can show up as a separator in printdev.
	* tests/fsync-y.c: Update expected output.
	* strace.1.in: Mention this.
	* NEWS: Likewise.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util.c: escape closing angle bracket in printfd.
	* util.c (printfd): Use print_quoted_string_ex instead of
	print_quoted_string, specify ">" as escape_chars argument.
	* tests/fsync-y.c (main): Update expected output.
	* NEWS: Mention it.

2018-03-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util.c: add support for additional escape characters in string_quote.
	Quotes are not always used to denote string limits; printfd uses angle
	brackets for that, for example.  As result, mechanism for supplying
	set of additional characters in order to avoid ambiguities regarding
	the end of the quoted string is needed.

	* defs.h (string_quote): Add escape_chars parameter.
	(print_quoted_string_ex): New function prototype.
	* util.c (string_quote): Add escape_chars parameter.
	(print_quoted_string_ex): Rename from print_quoted_string, add
	escape_chars parameter, pass it to string_quote call.
	(print_quoted_string): Turn into a thin wrapper around
	print_quoted_string_ex.
	(printstr_ex): Pass NULL as escape_chars argument of string_quote call.
	* socketutils.c (unix_parse_response): Pass NULL as escape_chars
	argument of string_quote call.
	* tests/print_quoted_string.c (print_octal): New function.
	print_quoted_memory_ex): Use it.  Add escape_chars parameter.
	(print_quoted_memory): Pass NULL as escape_chars argument
	of print_quoted_memory_ex call.
	* tests/tests.h (print_quoted_string_ex, print_quoted_memory_ex): Add
	escape_chars parameter.
	* tests/fsync-y.c: Pass NULL as escape_chars argument of
	print_quoted_string_ex call.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check file name printing in strace -y mode.
	* tests/fsync-y.c: New file.
	* tests/.gitignore: Add fsync-y.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	* tests/gen_tests.in (fsync-y): New test.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-03-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add print_quoted_string_ex and print_quoted_memory_ex functions.
	* tests/tests.h (print_quoted_string_ex, print_quoted_memory_ex): New
	declarations.
	* tests/print_quoted_string.c (print_quoted_string_ex): New function,
	a thin wrapper around print_quoted_memory_ex wrapper.
	(print_quoted_memory_ex): Rename from print_quoted_memory, add quote
	argument.
	(print_quoted_memory): Turn into a thin wrapper around
	print_quoted_memory_ex.

	tests: check escaping in string printing.
	* tests/test_printstrn.c (test_print_memory): New function.
	(test_printstrn): Use it.

	Do not go full octal if the next char is '8' or '9'
	* util.c (string_quote): Change the upper limit for the next character
	in unabbreviated octal printing from '9' to '7'.
	* tests/print_quoted_string.c (print_quoted_memory): Likewise.

	tests: fix abbreviated octal escape check in print_quoted_memory.
	* tests/print_quoted_string.c (print_quoted_memory): Check the next
	character after octal-escaped one instead of the first one in the
	string.

2018-03-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util.c: reduce indentation in non-hexadecimal case in string_quote.
	As it is already too deep there.

	* util.c (string_quote): Add string_ended label, jump there
	after the loop in "if (usehex)" case.

2018-03-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util.c: fix switch statement indentation in string_quote.
	While we are here, let's also remove unnecessary break statement
	in the default case.

2018-02-27  Dmitry V. Levin  <ldv@altlinux.org>

	Replace fopen_for_input and fopen_for_output with fopen_stream.
	* largefile_wrappers.h (fopen_for_input, fopen_for_output): Replace
	with fopen_stream.
	* mmap_cache.c (fopen_for_input) Likewise.
	* strace.c (fopen_for_output): Likewise.

2018-02-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update the list of INET_DIAG_BC_* operators.
	* linux/inet_diag.h (INET_DIAG_BC_S_EQ, INET_DIAG_BC_D_EQ): New
	enumeration items introduced by linux kernel commit v4.16-rc1~123^2~259.
	* xlat/inet_diag_bytecodes.in (INET_DIAG_BC_S_EQ, INET_DIAG_BC_D_EQ): New
	constants.
	* NEWS: Mention it.

	xlat: update the list of SCHED_FLAG_* constants.
	* xlat/sched_flags.in (SCHED_FLAG_RECLAIM, SCHED_FLAG_DL_OVERRUN): New
	constants introduced by linux kernel commits v4.13-rc1~205^2~27 and
	v4.16-rc1~164^2~8, respectively.
	(SCHED_FLAG_RESET_ON_FORK): Add constant value.
	* tests/sched_xetattr.c: Update expected output.
	* NEWS: Mention it.

	xlat: provide fallback definitions for arch-independent poll event flags
	* xlat/pollflags.in (POLLIN, POLLPRI, POLLOUT, POLLRDNORM, POLLRDBAND,
	POLLERR, POLLHUP, POLLNVAL, POLL_BUSY_LOOP): Add constant values.

2018-02-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update the list of poll event flags.
	POLL_BUSY_LOOP was introduced by linux kernel commit v3.11-rc1~64^2~129
	as POLL_LL and then renamed in v3.11-rc1~64^2~9.  POLLRDHUP was
	introduced by linux kernel commit v2.6.17-rc1~796.  POLLMSG and
	POLLREMOVE predate git repository.  POLLFREE was introduced by linux
	kernel commit v3.3-rc5~8 for internal use only.

	* xlat/pollflags.in (POLLMSG, POLLREMOVE, POLLRDHUP, POLL_BUSY_LOOP):
	New constants.
	* NEWS: Mention it.

2018-02-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add arch-specific si_codes constants.
	Based on Linux commits v4.16-rc1~159^2~17, v4.16-rc1~159^2~16,
	v4.16-rc1~159^2~15, and v4.16-rc1~159^2~14.

	* xlat/sigbus_codes.in (BUS_OPFETCH): New constant.
	* xlat/sigfpe_codes.in (FPE_MDAOVF, __FPE_DECOVF, __FPE_DECDIV,
	__FPE_DECERR, __FPE_INVASC, __FPE_INVDEC): New constants.
	* xlat/sigill_codes.in (ILL_ILLPARAOP, ILL_ILLEXCPT, ILL_CPLB_VI,
	ILL_CPLB_MISS, ILL_CPLB_MULHIT, ILL_DBLFLT, ILL_HARDWALL, ILL_BADIADDR,
	__ILL_BREAK, __ILL_BNDMOD): Likewise.
	* xlat/sigsegv_codes.in (SEGV_STACKFLOW, __SEGV_PSTKOVF): Likewise.
	* xlat/sigtrap_codes.in (TRAP_STEP, TRAP_TRACEFLOW, TRAP_WATCHPT,
	TRAP_ILLTRAP): Likewise.
	* NEWS: Mention it.

2018-02-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	rtnl_tc: support new TCA_* attributes.
	* xlat/rtnl_tc_attrs.in (TCA_HW_OFFLOAD, TCA_INGRESS_BLOCK,
	TCA_EGRESS_BLOCK): New constants introduced by linux kernel commits
	v4.15-rc4~13^2~5^2~2 and v4.16-rc1~123^2~139^2~5.
	* rtnl_tc.c (tcmsg_nla_decoders) <TCA_HW_OFFLOAD, TCA_INGRESS_BLOCK,
	TCA_EGRESS_BLOCK>: New items.

	rtnl_link: add decoding of new IFLA_* attributes.
	* xlat/rtnl_link_attrs.in (IFLA_NEW_NETNSID, IFLA_IF_NETNSID,
	IFLA_CARRIER_UP_COUNT, IFLA_CARRIER_DOWN_COUNT, IFLA_NEW_IFINDEX): New
	constants introduced by linux kernel commits v4.15-rc1~84^2~557,
	v4.15-rc1~84^2~133^2, v4.16-rc1~123^2~91, and v4.16-rc1~123^2~24^2.
	* rtnl_link.c (ifinfomsg_nla_decoders) <IFLA_NEW_NETNSID,
	IFLA_IF_NETNSID, IFLA_CARRIER_UP_COUNT, IFLA_CARRIER_DOWN_COUNT,
	IFLA_NEW_IFINDEX>: New items.

	rtnl_link: implement IFLA_EVENT_* decoding.
	* rtnl_link.c (decode_ifla_event): New function.
	(ifinfomsg_nla_decoders) <[IFLA_EVENT]>: Use it.
	* xlat/rtnl_ifla_events.in: New file.
	* NEWS: Mention it.

	xlat: update the list of RWF_* constants.
	* xlat/rwf_flags.in (RWF_APPEND): New constant introduced by linux
	kernel commit v4.16-rc1~145^2~7.
	* NEWS: Mention it.

	tests: check decoding of ip6:port pairs associated with socket descriptors
	* tests/net-yy-inet.c: Generalise test.
	* tests/net-yy-inet6.c: New file.
	* tests/pure_executables.list: Add net-yy-inet6.
	* tests/.gitignore: Likewise.
	* tests/gen_tests.in (net-yy-inet6): New entry.

2018-02-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Print IPv6 addresses in brackets.
	Follow a common practice for printing address:port pair to distinguish
	address parts delimiter from address/port delimiter.

	* socketutils.c (inet_parse_response) <ob, cb>: New variables,
	initialise them to open/closing brackets or empty strings based
	on address family.
	(inet_parse_response): Print ob and cb around src_buf and dst_buf.
	* NEWS: Mention this improvement.

2018-02-26  Dmitry V. Levin  <ldv@altlinux.org>

	strace.spec.in: add gcc to build requirements.
	There are rumors in circulation that some rpm-based distributions
	are going to exclude gcc from their default build environments.
	Workaround this policy silliness by adding gcc to build requirements.

	* strace.spec.in (BuildRequires): Add gcc.

2018-02-26  Dmitry V. Levin  <ldv@altlinux.org>

	Move definitions of fopen_for_input to largefile_wrappers.h.
	* largefile_wrappers.h (fopen_for_input): Define along with
	fopen_for_output.
	* mmap_cache.c: Include "largefile_wrappers.h".
	(fopen_for_input): Remove.

2018-02-26  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce mmap_cache.h.
	Let's avoid bloating defs.h and introduce a separate header for
	mmap_cache.

	* defs.h (struct mmap_cache_t, enum mmap_cache_protection,
	enum mmap_cache_rebuild_result, mmap_cache_enable, mmap_cache_is_enabled,
	mmap_cache_invalidate, mmap_cache_delete, mmap_cache_rebuild_if_invalid,
	mmap_cache_search): Move ...
	* mmap_cache.h: ... to this new file.
	* Makefile.am (strace_SOURCES): Add mmap_cache.h.
	* mmap_cache.c: Include mmap_cache.h.
	* strace.c: Likewise.
	* syscall.c: Likewise.
	* unwind.c: Likewise.

2018-02-26  Masatake YAMATO  <yamato@redhat.com>

	mmap_cache: record device major and minor numbers.
	* defs.h (struct mmap_cache_t): Add major and minor fields.
	* mmap_cache.c (build_mmap_cache): Record device major and minor numbers.

2018-02-26  Masatake YAMATO  <yamato@redhat.com>

	mmap_cache: add function to enable mmap_cache.
	mmap_cache was enabled indirectly via unwind feature.  As now mmap_cache
	can be used by other part of strace, a way to enable mmap_cache directly
	is needed.

	* defs.h (mmap_cache_enable, mmap_cache_is_enabled): New function
	prototypes.
	* mmap_cache.c (use_mmap_cache): New file local variable.
	(mmap_cache_enable, mmap_cache_is_enabled): New functions.
	* syscall.c (syscall_exiting_decode): Use mmap_cache_is_enabled()
	instead of stack_trace_enabled.
	* unwind.c (unwind_init): Invoke mmap_cache_enable.

2018-02-26  Masatake YAMATO  <yamato@redhat.com>

	mmap_cache, unwind: lift up mmap_cache_delete invocation from unwind.c.
	mmap_cache_delete function used to be called by destructor of unwind
	related code.  Now that other parts can use mmap cache,
	mmap_cache_delete is called separately from unwind_tcb_fin.

	* unwind.c (unwind_tcb_fin): Move mmap_cache_delete invocation ...
	* strace.c (droptcb): ... here.

2018-02-26  Masatake YAMATO  <yamato@redhat.com>

	mmap_cache: record protection bits.
	To make mmap_cache reusable, records protection bits of mmap entries.

	* defs.h (mmap_cache_protection): New enum.
	* mmap_cache.c (build_mmpa_cache): Don't ignore entries that are not
	executable, just record the protection bits here.
	* unwind.c (print_stack_frame): Ignore entries that are not executable.

2018-02-26  Masatake YAMATO  <yamato@redhat.com>

	mmap_cache: move code for searching a mmap cache from unwind.
	print_stack_frame function in unwind.c searches a mmap entry in mmap
	cache.  The found entry is then used for unwinding.  However, a function
	searching for a mmap entry may be useful for other purposes than
	unwinding.

	This change re-factors the function; code for searching an entry is
	now defined as a stand-alone function named mmap_cache_search.

	* defs.h (mmap_cache_search): New function prototype.
	print_stack_frame.
	* mmap_cached.c (mmap_cache_search): New function derived from
	print_stack_frame.
	* unwind.c (print_stack_frame): Use it.

2018-02-26  Masatake YAMATO  <yamato@redhat.com>

	mmap_cache: new subsystem derived from unwind.c.
	For making mmap cache code reusable from other areas in strace than
	unwind, mmap cache related code and unwind related code should be
	separated.

	This change moves the most of mmap cache code from unwind.c
	to mmap_cache.c, a new file.

	* unwind.c: Move mmap_cache implementation ...
	* mmap_cache.c: ... to this new file.
	* Makefile.am (strace_SOURCES): add mmap_cache.c.
	* defs.h (struct tcb): Move mmap_cache, mmap_cache_size, and
	mmap_cache_generation fields out of [USE_LIBUNWIND] condition.
	(mmap_cache_invalidate, mmap_cache_delete,
	mmap_cache_rebuild_if_invalid): New function prototypes.
	(struct mmap_cache_t, enum mmap_cache_rebuild_result): Move from
	unwind.c.
	* syscall.c (syscall_exiting_decode): Replace unwind_cache_invalidate
	with mmap_cache_invalidate.

2018-02-26  Masatake YAMATO  <yamato@redhat.com>

	unwind: lift up unw_flush_cache from mmap cache management code.
	For making mmap cache code reusable from other areas in strace
	than unwind, mmap cache related code and unwind related code
	should be separated.

	This change is one of the steps for the separation.  It moves
	unw_flush_cache function call from the core of mmap cache code
	to upper level code.

	* unwind.c (mmap_cache_rebuild_result): New enum.
	(rebuild_cache_if_invalid): Return MMAP_CACHE_REBUILD_* instead of
	a bool value.
	(build_mmap_cache): Don't call unw_flush_cache here.
	(unwind_print_stacktrace, unwind_capture_stacktrace): Call
	unw_flush_cache here instead.

2018-02-25  Dmitry V. Levin  <ldv@altlinux.org>

	debian: sync with 4.21-1 package.
	Versioned dependency on debhelper is not updated for backwards
	compatibility.

	* debian/changelog.in: Fix ancient changelog entries.
	* debian/control (Build-Depends): Add dependency on libbluetooth-dev.
	(Standards-Version): Update to 4.1.3.
	(Vcs-Git, Vcs-Browser): Move from alioth to salsa.d.o.
	(strace, strace-udeb) <Architecture>: Change to linux-any.
	(strace64, strace-udeb) <Priority>: Change to optional.
	* debian/rules: Use /usr/share/dpkg/architecture.mk instead of manually
	setting build variables.
	(configure): New target.
	(build/Makefile, build-udeb/Makefile, build64/Makefile): Depend on it.
	(binary-arch): Use build64/strace.1 for strace64 subpackage.
	* debian/strace.manpages: Add build/ prefix.
	* debian/strace64.manpages: Add build64/ prefix.

2018-02-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	m4/mpers.m4: fix mpers name in comments added to config.h.
	* m4/mpers.m4 (st_MPERS_STRUCT_STAT): Use mpers_name instead of
	MPERS_NAME in comments generated by AC_DEFINE.

	Fixes: v4.14~169 ("mpers.m4: check for struct stat64, struct stat, and their members")

2018-02-24  Dmitry V. Levin  <ldv@altlinux.org>

	mpers.awk: use stdint.h instead of inttypes.h.
	As <inttypes.h> is included in files generated by mpers.awk to obtain
	definitions of uintNN_t types provided by <stdint.h>, replace the former
	header with the latter.

	* mpers.awk: Use <stdint.h> instead of <inttypes.h>.
	* mpers_test.sh: Update expected output.

2018-02-23  Dmitry V. Levin  <ldv@altlinux.org>

	Wipe out references to defunct sourceforge.
	The old location of strace-devel mailing list is defunct, it used to
	lose email messages and sometimes did not deliver any mails for days.

	The mailing list has been moved to strace-devel@lists.strace.io.

	* CREDITS.in: Update the mailing list address.
	(Zhang Le): Update email address.
	* README: Update the mailing list address.
	* README.md: Likewise.
	* configure.ac (AC_INIT): Likewise.
	* strace.1.in (.SH REPORTING BUGS): Likewise.
	* strace-log-merge.1.in (.SH REPORTING BUGS): Likewise.
	* sched.c (SYS_FUNC(sched_getattr)): Update the mailing list reference.
	* tests/scno_tampering.sh: Likewise.
	* qemu_multiarch_testing/README: Update git repository address.
	* NEWS: Mention the change of the mailing list address.

	Closes: https://github.com/strace/strace/issues/38

2018-02-21  Dmitry V. Levin  <ldv@altlinux.org>

	m68k: fix build.
	When <sys/reg.h> is included after <linux/ptrace.h>, the build fails
	on m68k with the following diagnostics:

	  In file included from /usr/include/linux/ptrace.h:101:0,
	                   from ptrace.h:51,
	                   from sigreturn.c:2:
	  /usr/include/m68k-linux-gnu/sys/reg.h:26:3: error: expected identifier
	  before numeric constant
	     PT_D1 = 0,
	     ^

	Apparently, the only architecture where strace needs definitions
	provided by <sys/reg.h> is x86_64, other three (m68k, tile, and x86)
	are fine with definitions already provided by <linux/ptrace.h>.

	Fix the issue by getting rid of <sys/reg.h> and defining necessary
	macros in linux/x86_64/arch_regs.h file.

	* configure.ac (AC_CHECK_HEADERS): Remove sys/reg.h.
	* regs.h: Do not include <sys/reg.h>.
	* linux/x86_64/arch_regs.h (R15, R14, R13, R12, RBP, RBX, R11, R10,
	R9, R8, RAX, RCX, RDX, RSI, RDI, ORIG_RAX, RIP, CS, EFLAGS, RSP, SS,
	FS_BASE, GS_BASE, DS, ES, FS, GS): New macros.
	* NEWS: Mention this fix.

	Fixes: v4.21~21 ("Include <sys/ptrace.h> early")

2018-02-15  Dmitry V. Levin  <ldv@altlinux.org>

	Demote sourceforge.net.
	https://sourceforge.net/p/strace/code/ is defunct: it doesn't accept
	new commits for too long.
	Likewise, https://sourceforge.net/projects/strace/files/ doesn't accept
	new files for too long.

	* README.md: Remove sourceforge.net URL.
	* debian/copyright: Replace the sourceforge.net based strace project URL
	with a github based one.
	* strace.spec.in (Source): Likewise.

2018-02-15  Dmitry V. Levin  <ldv@altlinux.org>

	Update copyright headers.
	* COPYING: Update copyright year number range.
	* debian/copyright: Sync with COPYING.

2018-02-14  Dmitry V. Levin  <ldv@altlinux.org>

	Post-release administrivia.
	* NEWS: Add a header line for the next release.
	* debian/changelog.in: Add a changelog entry for 4.21-1.
	* strace.spec.in: Likewise.

2018-02-13  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for 4.21 release.
	* NEWS: Update for 4.21 release.

2018-02-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/s390_sthyi.c: skip the test if s390_sthyi returns an error.
	tests/s390_sthyi.c (main): replace error_msg_and_fail with
	error_msg_and_skip if rc is non-zero.

2018-02-13  Dmitry V. Levin  <ldv@altlinux.org>

	Update copyright headers.
	Headers updated automatically using maint/update_copyright_years.sh
	script.

2018-02-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Remove old and unused maintenance scripts.
	Firewell, last witnesses of bygone era.

	* linux/sparc/gen.pl: Remove.
	* linux/x86_64/gentab.pl: Likewise.
	* xlate.el: Likewise.
	* Makefile.am (EXTRA_DIST): Remove them.

	Suggested-by: Elvira Khabirova <lineprinter@altlinux.org>
	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-02-13  Dmitry V. Levin  <ldv@altlinux.org>

	Consistently use MAX_ERRNO_VALUE.
	* filter_qualify.c (parse_inject_token): Replace 4095
	with MAX_ERRNO_VALUE.
	* negated_errno.h (is_negated_errno): Likewise.  Remove redundant
	comment.

	Export SIZEOF_LONG and SIZEOF_KERNEL_LONG_T to tests.
	* configure.ac (AC_SUBST): Add SIZEOF_LONG and SIZEOF_KERNEL_LONG_T.
	* tests/Makefile.am (SIZEOF_LONG, SIZEOF_KERNEL_LONG_T): New variables.
	(AM_TEST_LOG_FLAGS): Pass them.
	* bootstrap: Substitute them.

2018-02-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: avoid ioctl_kvm_run test failure when built with gcc -O0.
	When built with -O0, gcc (rightfully) generates function prologue, which
	results in writing %rbp to the stack, causing premature KVM_EXIT_MMIO.
	It could be possible to avoid such problems by "naked" attribute but,
	unfortunately, the latter is not available on x86 with older GCC.
	A trick suggested in [1] is used instead: assembly is moved
	to the global scope.

	[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50242#c3

	* tests/ioctl_kvm_run.c (code): Remove function.
	Add globally scoped __asm__ with the function code and its size.
	(code, code_size): New extern symbols declarations.
	(run_kvm): Remove code_size definition and initialization.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-02-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/ioctl_kvm_run.c: add KVM_EXIT_MMIO diagnostics.
	As it has proven itself useful.

	* tests/ioctl_kvm_run.c (run_kvm) <case KVM_EXIT_MMIO:>: Fail
	on unexpected KVM_EXIT_MMIO, providing relevant diagnostics.

2018-02-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add compatibility layer for accept call.
	Recent glibc (since version 2.26) uses accept4 syscall for implementing
	accept call on sparc.  Unfortunately, it's impossible to simply fall
	back on raw syscall as it had not been wired up until linux commit
	v4.4-rc8~4^2~1.

	* tests/accept_compat.h: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	* tests/net-y-unix.c: Include accept_compat.h, use do_accept()
	instead of accept() calls.
	* tests/net-yy-inet.c: Likewise.
	* tests/net-yy-unix.c: Likewise.
	* tests/net.expected: Allow accept4.

2018-02-12  Dmitry V. Levin  <ldv@altlinux.org>

	debian: build strace-udeb separately.
	* debian/rules (extra_build_targets): Add build-udeb-stamp.
	(build-udeb/Makefile): New rule.
	(clean): Remove build-udeb.
	* debian/strace-udeb.install: Update.

	Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=826223

2018-02-12  Dmitry V. Levin  <ldv@altlinux.org>

	Enable symbol demangling in deb- and rpm-driven builds.
	* debian/control (Build-Depends) [amd64]: Add libiberty-dev.
	* strace.spec.in (buildrequires_libunwind_devel): Add binutils-devel.

2018-02-12  Dmitry V. Levin  <ldv@altlinux.org>

	debian: re-enable -k option on x86_64.
	This partially reverts commit v4.13~177.

	* debian/control (Build-Depends) [amd64]: Add libunwind-dev.

2018-02-12  Dmitry V. Levin  <ldv@altlinux.org>

	Add "strace -V" output to build log.
	* strace.spec.in (%check): Print "strace -V" output before
	running the test suite.
	* debian/rules (%-stamp): Likewise.

2018-02-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update NT_* constants.
	* xlat/nt_descriptor_types.in (NT_PPC_PKEY): New constant introduced
	by linux kernel commit v4.16-rc1~93^2~72.

	Update the list of PKEY_* constants.
	* xlat/pkey_access.in (PKEY_DISABLE_EXECUTE): New constant introduced
	by linux kernel commit v4.16-rc1~93^2~85.
	* tests/pkey_alloc.c: Update expected output.
	* NEWS: Mention it.

	powerpc, powerpc64: wire up pkey_* syscalls.
	* linux/powerpc/syscallent.h [384..386]: Add pkey_alloc,
	pkey_free, and pkey_mprotect syscalls introduced by linux kernel
	commits v4.16-rc1~93^2~70 and v4.16-rc1~93^2~69, respectively.
	* linux/powerpc64/syscallent.h: Likewise.
	* NEWS: Mention it.

	Update NEWS.

2018-02-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	linux/ia64: remove IA-32 mode support.
	There is no compat support in strace and there are no systems
	within reach that would allow to test it.

	* linux/ia64/arch_regs.c (IA64_PSR_IS, ia64_ia32mode): Remove.
	* linux/ia64/get_error.c (get_error): Remove ia64_ia32mode branch.
	* linux/ia64/get_scno.c (arch_get_scno): Likewise.
	* linux/ia64/get_syscall_args.c (get_syscall_args): Likewise.
	* linux/ia64/set_error.c (arch_set_error, arch_set_success): Likewise.
	* linux/ia64/set_scno.c (arch_set_scno): Likewise.

2018-02-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	syscall.c: parse return code second time after injecting.
	In order to have the same view as tracee has, with regards to
	"never fail" syscalls.

	* syscall.c (tamper_with_syscall_exiting): Call get_error after the
	return value tampering to re-initialise u_rval and u_error fields
	of struct tcb.

2018-02-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	sparc: mark as an architecture that has a dedicated error register.
	* linux/sparc/arch_defs_.h (HAVE_ARCH_DEDICATED_ERR_REG): New macro,
	define to 1.

	strace.1.in: ffix.

2018-02-11  Dmitry V. Levin  <ldv@altlinux.org>

	Include <sys/ptrace.h> early.
	Include "ptrace.h" before any header that can include <signal.h>
	because on some architectures the latter may include <asm/sigcontext.h>
	which in turn may include <asm/ptrace.h> with potentially devastating
	effect on <sys/ptrace.h>.

	* process.c: Include "ptrace.h" before "regs.h".
	* rt_sigframe.c: Likewise.
	* sigreturn.c: Include "ptrace.h" before "nsig.h".
	* syscall.c: Likewise.
	* wait.c: Include "ptrace.h" before <sys/wait.h>.
	* strace.c: Include "ptrace.h" before <signal.h>.
	* tests/ptrace.c: Likewise.
	* tests/test_ucopy.c: Include <sys/ptrace.h> before <signal.h>.

2018-02-11  Dmitry V. Levin  <ldv@altlinux.org>

	Include <limits.h> instead of <sys/param.h>
	Do not include <sys/param.h> unnecessarily as it includes <signal.h>.

	* pathtrace.c: Include <limits.h> instead of <sys/param.h>.
	* strace.c: Likewise.
	* syscall.c: Likewise.
	* util.c: Likewise.
	* tests/getcwd.c: Likewise.
	* tests/group_req.c: Likewise.
	* tests/inode_of_sockfd.c: Likewise.
	* tests/ip_mreq.c: Likewise.
	* tests/printpath-umovestr.c: Likewise.
	* tests/qual_fault.c: Likewise.
	* tests/test_printpath.c: Likewise.
	* tests/umovestr3.c: Likewise.
	* tests/net-y-unix.c: Do not include <sys/param.h>.
	* tests/net-yy-unix.c: Likewise.

2018-02-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	basic_filters.c: introduce scno_by_name.
	As it will be used elsewhere.

	* basic_filters.c (scno_by_name): New function.
	(qualify_syscall_name): Use it.
	* defs.h (scno_by_name): New declaration.

2018-02-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xstring.h: rephrase xappendstr description a bit.

2018-02-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat.c: return NULL in sprintflags if there are no flags.
	Otherwise the auxstr is rather ugly at times.

	* xlat.c (sprintflags): Return NULL if no flags were printed.

2018-02-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Change type of injected rval to kernel_long_t.
	* defs.h (struct inject_data): Change type of rval field to
	kernel_ulong_t.
	* filter_qualify.c (parse_inject_token): Use string_to_kulong instead of
	string_to_uint for rval parsing.  Warn if retval is clipped in compat
	personality.

	Mark architectures that indicate syscall error in a dedicated register.
	* linux/alpha/arch_defs_.h (HAVE_ARCH_DEDICATED_ERR_REG): New macro,
	define to 1.
	* linux/ia64/arch_defs_.h: Likewise.
	* linux/mips/arch_defs_.h: Likewise.
	* linux/powerpc/arch_defs_.h: Likewise.
	* linux/powerpc64/arch_defs_.h: Likewise.
	* linux/sparc64/arch_defs_.h: Likewise.
	* linux/arch_defs_.h [!HAVE_ARCH_DEDICATED_ERR_REG]
	(HAVE_ARCH_DEDICATED_ERR_REG): New macro, define to 0.
	* linux/nios2/arch_defs_.h: New file.
	* Makefile.am (EXTRA_DIST): Add it.

2018-02-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Make string_to_uint_ex more universal.
	And add support for reading of various types.

	* string_to_uint.c (string_to_uint_ex): Change to work with long long.
	(string_to_uint): Move it...
	* string_to_uint.h (string_to_uint): ...here.
	(string_to_uint_upto): Accept long long as max_val, return long long.
	(string_to_ulong, string_to_kulong, string_to_ulonglong): New functions,
	for completeness.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-02-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add pure syscall flag.
	* basic_filters.c (lookup_class) <syscall_class>: Add "%pure" for
	TRACE_PURE.
	* sysent.h (TRACE_PURE): New syscall flag.
	* sysent_shorthand_defs.h (PU): New shorthand macro.
	* linux/32/syscallent.h ([172], [173], [174], [175], [176], [177],
	[178]): Add PU flag to getpid, getppid, getuid, geteuid, getgid,
	getegid, gettid syscalls.
	* linux/64/syscallent.h ([172], [173], [174], [175], [176], [177],
	[178]): Add PU flag to getpid, getppid, getuid, geteuid, getgid,
	getegid, gettid syscalls.
	* linux/aarch64/syscallent.h ([1060]): Add PU flag to getpgrp syscalls.
	* linux/alpha/syscallent.h ([20], [24], [47], [63], [64], [89],
	[378]): Add PU flag to getxpid, getxuid, getxgid, getpgrp, getpagesize,
	getdtablesize, gettid syscalls.
	* linux/arc/syscallent.h ([246]): Add PU flag to arc_gettls syscalls.
	* linux/arm/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
	[199], [200], [201], [202], [224], [ARM_FIRST_SHUFFLED_SYSCALL+1+6]):
	Add PU flag to getpid, getuid, getgid, geteuid, getegid, getppid,
	getpgrp, getuid32, getgid32, geteuid32, getegid32, gettid, get_tls
	syscalls.
	* linux/avr32/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
	[176]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
	getppid, getpgrp, gettid syscalls.
	* linux/bfin/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
	[199], [200], [201], [202], [224]): Add PU flag to getpid, getuid,
	getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
	geteuid32, getegid32, gettid syscalls.
	* linux/hppa/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
	[206]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
	getppid, getpgrp, gettid syscalls.
	* linux/i386/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
	[199], [200], [201], [202], [224]): Add PU flag to getpid, getuid,
	getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
	geteuid32, getegid32, gettid syscalls.
	* linux/ia64/syscallent.h ([1041], [1042], [1046], [1047], [1062],
	[1063], [1105], [1171]): Add PU flag to getpid, getppid, getuid,
	geteuid, getgid, getegid, gettid, getpagesize syscalls.
	* linux/m68k/syscallent.h ([20], [24], [47], [49], [50], [64],
	[65], [166], [199], [200], [201], [202], [221], [333]): Add PU flag
	to getpid, getuid, getgid, geteuid, getegid, getppid, getpgrp,
	getpagesize, getuid32, getgid32, geteuid32, getegid32, gettid,
	get_thread_area syscalls.
	* linux/metag/syscallent.h ([248]): Add PU flag to metag_get_tls
	syscalls.
	* linux/microblaze/syscallent.h ([20], [24], [47], [49], [50], [64],
	[65], [199], [200], [201], [202], [224]): Add PU flag to getpid,
	getuid, getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
	geteuid32, getegid32, gettid syscalls.
	* linux/powerpc64/syscallent.h ([20], [24], [47], [49], [50], [64],
	[65], [207]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
	getppid, getpgrp, gettid syscalls.
	* linux/powerpc/syscallent.h ([20], [24], [47], [49], [50], [64],
	[65], [207]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
	getppid, getpgrp, gettid syscalls.
	* linux/s390/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
	[199], [200], [201], [202], [236]): Add PU flag to getpid, getuid,
	getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
	geteuid32, getegid32, gettid syscalls.
	* linux/s390x/syscallent.h ([20], [64], [65], [199], [200], [201],
	[202], [236]): Add PU flag to getpid, getppid, getpgrp, getuid,
	getgid, geteuid, getegid, gettid syscalls.
	* linux/sh64/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
	[199], [200], [201], [202], [252]): Add PU flag to getpid, getuid,
	getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
	geteuid32, getegid32, gettid syscalls.
	* linux/sh/syscallent.h ([20], [24], [47], [49], [50], [64], [65],
	[199], [200], [201], [202], [224]): Add PU flag to getpid, getuid,
	getgid, geteuid, getegid, getppid, getpgrp, getuid32, getgid32,
	geteuid32, getegid32, gettid syscalls.
	* linux/sparc64/syscallent.h ([20], [24], [47], [49], [50], [64], [81],
	[143], [197], [340]): Add PU flag to getpid, getuid, getgid, geteuid,
	getegid, getpagesize, getpgrp, gettid, getppid, kern_features syscalls.
	* linux/sparc/syscallent.h ([20], [24], [44], [47], [49], [50], [53],
	[64], [69], [70], [81], [143], [197], [340]): Add PU flag to getpid,
	getuid, getuid32, getgid, geteuid, getegid, getgid32, getpagesize,
	geteuid32, getegid32, getpgrp, gettid, getppid, kern_features syscalls.
	* linux/x32/syscallent.h ([39], [102], [104], [107], [108], [110],
	[111], [186]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
	getppid, getpgrp, gettid syscalls.
	* linux/x86_64/syscallent.h ([39], [102], [104], [107], [108], [110],
	[111], [186]): Add PU flag to getpid, getuid, getgid, geteuid, getegid,
	getppid, getpgrp, gettid syscalls.
	* linux/xtensa/syscallent.h ([120], [127], [137], [139], [140], [141],
	[150], [151]): Add PU flag to getpid, gettid, getuid, getgid, geteuid,
	getegid, getppid, getpgrp syscalls.
	* strace.1.in (.SS Filtering): Document it.
	* NEWS: Mention it.

	syscall.c: warn if tampering failed.

	syscall.c: set errno if syscall is tampered.

2018-02-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/nsyscall-d.test: swap exp and log in diff calls.
	In line with the rest of the tests.

	* tests/nsyscalls-d.test: swap arguments of match_diff calls.

2018-02-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	linux/arm/get_scno.c: use debug_msg.
	* linux/arm/get_scno.c (arch_get_scno): replace if (debug_flag) {
	error_msg() } with debug_msg() call.

2018-02-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Do not shuffle scno inside syscall_name.
	This makes interface a bit irregular otherwise.

	* defs.h (syscall_name): Clarify description.
	* syscall.c (syscall_name): Do not call shuffle_scno.
	* printsiginfo.c (print_si_info) <case SIGSYS>: Use shuffle_scno.

2018-02-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Handle very special __ARM_NR_-prefixed syscalls.
	* linux/aarch64/nr_prefix.c: New file.
	* linux/arm/nr_prefix.c: Likewise.
	* linux/nr_prefix.c: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.
	* printsiginfo.c: Include nr_prefix.c
	(print_si_info): Use nr_prefix.

	Make shuffle_scno globally available.
	* syscall.c (shuffle_scno): Move the declaration...
	* defs.h (shuffle_scno): ...here. Remove static qualifier.
	* linux/aarch64/shuffle_scno.c (shuffle_scno): Remove static qualifier.
	* linux/arm/shuffle_scno.c: Likewise.
	* linux/shuffle_scno.c: Likewise.
	* linux/x32/shuffle_scno.c: Likewise.
	* linux/x86_64/shuffle_scno.c: Likewise.

2018-02-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	syscall.c: use shuffle_scno in syscall_name.
	syscall_name() is used only in printsiginfo.c:print_si_info currently,
	and is supplied with raw syscall number (that's why it has this ugly
	__X32_SYSCALL_BIT hack). But since it handled only __X32_SYSCALL_BIT and
	not shuffle_scno(), it was broken on ARM.  Let's replace it with shuffle_scno
	call, as it handles both the case of shuffled ARM syscalls and the
	__X32_SYSCALL_BIT.

	* syscall.c (syscall_name): Call shuffle_scno instead of custom
	__X32_SYSCALL_BIT handling.

2018-02-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Use shuffle_scno for x32 syscall numbers.
	This changes behaviour of printing of unknown syscall.

	* linux/x32/shuffle_scno.c: New file.
	* linux/x86_64/shuffle_scno.c: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.
	* linux/x86_64/get_scno.c (arch_get_scno): Do not clear
	__X32_SYSCALL_BIT.
	* tests/nsyscalls.c: Update expected output.

2018-02-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Move shuffle_scno() invocation to get_scno.
	* linux/aarch64/get_scno.c (arch_get_scno): Remove shuffle_scno call.
	* linux/arm/get_scno.c (arch_get_scno): Remove shuffle_scno calls.
	* syscall.c (get_scno): Call shuffle_scno after arch_get_scno.

2018-02-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Move shuffle_scno to arch-specific file.
	While we are here, let's fix AArch64 by limiting scno shuffling
	to compat personality only.

	* syscall.c: Include shuffle_scno.c.
	(shuffle_scno): Move it to a...
	* linux/arm/shuffle_scno.c: New file.
	* linux/aarch64/shuffle_scno.c: New file, define arm's shuffle_scno
	as arm_shuffle_scno and call it only for personality 1.
	* linux/shuffle_scno.c: New file, fallback trivial shuffle_scno
	definition.
	* Makefile.am (EXTRA_DIST): Add them.

2018-02-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Print unknown syscall number in hexadecimal.
	* syscall.c (struct sysent_buf): Update buf field size.
	(get_scno): Print unknown syscall number in hexadecimal form.
	* tests/nsyscalls.c: Update expected output.
	* strace.1.in: Document it.
	* NEWS: Mention it.

	tests/accept.c: call accept syscall directly, if available.
	* tests/accept.c [__NR_accept && !TEST_SYSCALL_NAME]: Define a wrapper that
	calls accept directly.
	* tests/sockname.c [TEST_SYSCALL_STR]: Do not define TEST_SYSCALL_STR.

	printsiginfo.c: add a comment about personality detection for SIGSYS.
	Looks like it is not necessary, after all.

2018-02-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	linux/x86_64/set_error.c: update eax for compat personality.
	Since this is where get_error gets the return value from in the compat case.

	linux/x86_64/set_error.c (set_error, set_success): Update i386_regs.eax
	if tracee is in compat personality.

2018-02-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Mark various arch-specific syscalls with SYSCALL_NEVER_FAILS.
	* linux/alpha/syscallent.h (getpagesize, getdtablesize): Add NF flag.
	* linux/arc/syscallent.h (arc_gettls): Likewise.
	* linux/arm/syscallent.h (get_tls): Likewise.
	* linux/ia64/syscallent.h (getpagesize): Likewise.
	* linux/m68k/syscallent.h (getpagesize, get_thread_area): Likewise.
	* linux/sparc/syscallent.h (getpagesize): Likewise.
	* linux/sparc64/syscallent.h (getpagesize): Likewise.

2018-02-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add SYSCALL_NEVER_FAILS flag to getpgrp.
	As glibc, at least, treats it this way.

	* linux/aarch64/syscallent.h (getpgrp): Add NF flag.
	* linux/alpha/syscallent.h: Likewise.
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/powerpc64/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/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

2018-02-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	linux/x86_64/get_error.c: do not sign-extend if no error happened.

2018-02-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/membarrier.c: fix expected output on nohz_full systems.
	If nohz_full is enabled, MEMBARRIER_CMD_GLOBAL is not available.

	* tests/membarrier.c: check availability of MEMBARRIER_CMD_GLOBAL
	separately.

2018-02-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update MEMBARRIER_CMD_* constants.
	* xlat/membarrier_cmds.in: Add new constants, rename
	MEMBARRIER_CMD_SHARED to MEMBARRIER_CMD_GLOBAL.
	* NEWS: Mention this.
	* tests/membarrier.c (main): Update expected output.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-02-07  Eugene Syromyatnikov  <evgsyr@gmail.com>

	perf.c: print group_fd argument of perf_event_open syscall as fd.
	* perf.c (SYS_FUNC(perf_event_open)): Print 4th argument using printfd.

	syscall.c: print higher bits of syscall return value on x32 personality.
	* syscall.c (syscall_exiting_trace): Check for current_klongsize instead
	of current_wordsize to determine the size of tcp->u_rval.

	strace.1.in: history update.
	strace.1.in (.SH HISTORY): Some amendments based on
	https://github.com/strace/strace-talks/blob/master/2012-ossdevconf-obninsk-strace_from_upstream_PoV/ossdevconf_2012-slides-strace_from_upstream_PoV.tex

	strace.1.in: minor changes.
	* strace.1.in (.SH DESCRIPTION): s/a passion/passion/,
	s/Here the/Here, the/, s/Where traditional/Where the traditional/,
	s/output has proven/output is proven/, s/In all cases/In most cases,/¸
	embolden st_mode, lstat, SIGCHLD, and SIGTTOU mentions,
	s/In some cases /In some cases, /
	(.SS Output format) <-o>: de-italicize dot in "filename.pid", convert
	the sentence's voice to passive, some other rephrasing.  Mention
	incompatibility of output piping with -ff mode.
	(.SS Output options) <-t>: s/time of day/wall clock time/.
	(.SS Statistics) <-c>: Remove "on Linux" mention, -F option mention.

	README.md: add information about git repository location.
	* README.md: Mention URLs for SourceForge, GitHub, and GitLab
	repositories.

2018-02-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rewrite net-accept-connect.c without strncpy.
	gcc8 -Wall -Werror rejects our method of struct sockaddr_un.sun_path
	initialization because the field lacks __nonstring__ attribute.

	As we calculate the length of the string being copied anyway,
	workaround this gcc+glibc bug by changing the code to use this
	pre-calculated length and get rid of strncpy completely.

	* tests/net-accept-connect.c (main): Use memcpy to initialize sun_path.

2018-02-06  Dmitry V. Levin  <ldv@altlinux.org>

	Use kernel's fcntl.h header instead of libc's for open_mode_flags.
	As definitions of O_* macros provided by various libc implementations
	are usually less reliable than those provided by kernel headers, switch
	to use kernel's fcntl.h header.

	* open.c: Include <asm/fcntl.h> instead of <fcntl.h>.  Remove
	O_LARGEFILE fallback definitions assuming that the kernel headers
	provide them.
	* xlat/open_mode_flags.in: Add __O_SYNC after O_SYNC.  Add O_TMPFILE
	and __O_TMPFILE before O_DIRECTORY.  Remove "O_TMPFILE & ~O_DIRECTORY".
	* tests/open.c: Include <asm/fcntl.h> instead of <fcntl.h>.  Remove
	workarounds for libc O_TMPFILE implementations.
	* tests/openat.c: Include <asm/fcntl.h> instead of <fcntl.h>.
	(test_mode_flag): New function.
	(main): Use it to check decoding of all access modes and file flags.
	* tests/gen_tests.in (openat): Add -a option.

	Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>

2018-02-06  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: update TCP_* constants.
	* xlat/socktcpoptions.in: Add TCP_FASTOPEN_KEY and
	TCP_FASTOPEN_NO_COOKIE introduced by linux kernel commits
	v4.15-rc1~84^2~387 and v4.15-rc1~84^2~339, respectively.
	* NEWS: Mention this.

	xlat: update IPV6_* constants.
	* xlat/sockipv6options.in: Add IPV6_FREEBIND introduced by linux kernel
	commit v4.15-rc1~84^2~601.
	* NEWS: Mention this.

	xlat: update MAP_* constants.
	* xlat/mmap_flags.in: Add MAP_SHARED_VALIDATE and MAP_SYNC introduced
	by linux kernel commits v4.15-rc1~71^2^2~23 and v4.15-rc1~71^2^2~12,
	respectively.
	* NEWS: Mention this.

2018-02-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: avoid triggering -Wstringop-truncation in ioctl_dm.c.
	* tests/ioctl_dm.c: Replace strncpy calls with memcpy as the character
	arrays being copied are not C strings.

	Makefile.am: minor EXTRA_DIST formatting changes.

	Move large file-related wrappers to a separate header.
	* strace.c [_LARGEFILE64_SOURCE]: Move the definitions under it to a...
	* largefile_wrappers.h: ... new file.
	* Makefile.am (strace_SOURCES): Add it.

2018-01-29  Dmitry V. Levin  <ldv@altlinux.org>

	strace.1: fix wording about setuid installation.
	* strace.1.in (SETUID INSTALLATION): Fix wording.

	Closes: https://github.com/strace/strace/issues/24

2018-01-29  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Add KVM_PPC_GET_CPU_CHAR ioctl definition from linux v4.15.
	* linux/powerpc/ioctls_arch0.h: Update from linux v4.15
	using ioctls_gen.sh.

2018-01-29  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update NEWS.

	tests: check s390_pci_mmio_read and s390_pci_mmio_write decoders.
	* tests/s390_pci_mmio_read_write.c: New file.
	* tests/.gitignore: Add s390_pci_mmio_read_write.
	* tests/pure_executables.list: Likewise.
	* tests/gen_tests.in (s390_pci_mmio_read_write): New test.

	Introduce s390_pci_mmio_read, s390_pci_mmio_write system call decoders.
	* linux/s390/syscallent.h ([352]): Change decoder to s390_pci_mmio_write.
	([353]): Change decoder to s390_pci_mmio_read.
	* linux/s390x/syscallent.h: Likewise.
	* s390.c (SYS_FUNC(s390_pci_mmio_write), SYS_FUNC(s390_pci_mmio_read)):
	New function.

	tests: check s390_runtime_instr system call decoder.
	* tests/s390_runtime_instr.c: New file.
	* tests/.gitignore: Add s390_runtime_instr.
	* tests/pure_executables.list: Likewise.
	* tests/gen_tests.in (s390_runtime_instr): New test.

	Introduce s390_runtime_instr system call decoder.
	* linux/s390/syscallent.h ([342]): Change decoder to s390_runtime_instr.
	* linux/s390x/syscallent.h: Likewise.
	* s390.c (SYS_FUNC(s390_runtime_instr)): New function.
	* xlat/s390_runtime_instr_commands.in: New file.

	tests: check s390_guarded_storage system call decoder.
	* configure.ac (AC_CHECK_HEADERS): Add asm/guarded_storage.h.
	* tests/s390_guarded_storage-v.c: New file.
	* tests/s390_guarded_storage.c: Likewise.
	* tests/.gitignore: Add s390_guarded_storage, s390_guarded_storage-v.
	* tests/pure_executables.list: Likewise.
	* tests/gen_tests.in (s390_guarded_storage, s390_guarded_storage-v):
	New tests.

	Introduce s390_guarded_storage system call decoder.
	* linux/s390/syscallent.h ([378]): Change decoder to s390_guarded_storage.
	* linux/s390x/syscallent.h: Likewise.
	* s390.c (struct guard_storage_control_block,
	struct guard_storage_event_parameter_list): New structure type
	definition.
	(guard_storage_print_gsepl, guard_storage_print_gscb,
	SYS_FUNC(s390_guarded_storage)): New function.
	(DIV_ROUND_UP): New macro.
	* xlat/s390_guarded_storage_commands.in: New file.

	tests: check s390_sthyi system call decoder.
	* configure.ac (AC_CHECK_FUNCS): Add iconv_open.
	(AC_CHECK_HEADERS): Add iconv.h.
	* tests/s390_sthyi-v.c: New file.
	* tests/s390_sthyi.c: Likewise.
	* tests/.gitignore: Add s390_sthyi, s390_sthyi-v.
	* tests/pure_executables.list: Likewise.
	* tests/gen_tests.in (s390_sthyi, s390_sthyi): New tests.

	Introduce s390_sthyi system call decoder.
	* s390.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* linux/s390/syscallent.h ([380]): Change decoder to s390_sthyi.
	* linux/s390x/syscallent.h: Likewise.
	* xlat/s390_sthyi_function_codes.in: New file.

	print_fields.h: add macro to print hexadecimal array field.
	* print_fields.h (PRINT_FIELD_HEX_ARRAY): New macro, prints target
	array with QUOTE_FORCE_HEX.

2018-01-29  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add print_quoted_string flag to generate comment.
	Because there are never enough print_quoted_string flags.

	* defs.h (QUOTE_EMIT_COMMENT): New quoting flag macro constant.
	* util.c (string_quote): Emit " /* " in the beginning and " */" in the
	end if QUOTE_EMIT_COMMENT is passed.
	(print_quoted_string): Increase alloc_size by 7 if QUOTE_EMIT_COMMENT is
	passed.

2018-01-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: make ioctl.test more flexible, use it for the rest of ioctl tests
	As the remaining non-generated ioctl tests differ from ioctl.test only
	in strace options, and since gen_tests.sh can pass arguments to sourced
	tests, replace the remaining non-generated ioctl tests with invocations
	of ioctl.test with appropriate parameters.

	* tests/ioctl.test: Pass script arguments to the strace invocation.
	* tests/gen_tests.in (ioctl_dm): New entry, invoke ioctl.test with -s9.
	(ioctl_dm-v): New entry, invoke ioctl.test with -v -s9.
	(ioctl_kvm_run): New entry, invoke ioctl.test with -a36 -y.
	(ioctl_loop-nv): New entry, invoke ioctl.test with -a22 -e verbose=none.
	(ioctl_nsfs): New entry, invoke ioctl.test with -esignal=none.
	(ioctl_sock_gifconf): New entry, invoke ioctl.test with -a28 -s1.
	(ioctl_evdev-v, ioctl_loop-v, ioctl_rtc-v): Invoke ioctl.test
	with -v option instead of ioctl-v.sh.
	* tests/ioctl_dm-v.test: Remove.
	* tests/ioctl_dm.test: Likewise.
	* tests/ioctl_kvm_run.test: Likewise.
	* tests/ioctl_loop-nv.test: Likewise.
	* tests/ioctl_nsfs.test: Likewise.
	* tests/ioctl_sock_gifconf.test: Likewise.
	* tests/ioctl-v.sh: Likewise.
	* tests/Makefile.am (DECODER_TESTS, EXTRA_DIST): Remove them.

2018-01-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/gen_tests.sh: enable passing arguments to sourced tests.
	* tests/gen_tests.sh: Read first argument separately, put it in $arg0,
	and the rest of the arguments in $args.
	(case "$arg0" in) <+*)>: Set command line to $args and source $arg0.

	xlat/gen.sh: add some rudimentary support for comments.
	* xlat/gen.sh: Trim parts of the string abbreviated in "/*" and "*/"

	configure.ac: sort architectures in lexicographical order.
	* configure.ac (case "$host_cpu"): sort architectures in alphabetical
	order.

2018-01-25  Dmitry V. Levin  <ldv@altlinux.org>

	Drop non-functional CRIS architecture support.
	From the very first commit when CRIS architecture support was introduced
	and up to this comment that ends the agony of this non-functional code,
	this support was incomplete and could never be compiled.

	* Makefile.am (EXTRA_DIST): Remove linux/crisv*.
	* clone.c: Remove CRISV* checks.
	* configure.ac ($host_cpu == cris*): Remove.
	* linux/crisv10: Remove.
	* linux/crisv32: Likewise.

	Fixes: v4.5.18-77-gea0e6e8 ("CRIS support by Hinko Kocevar ...")

2018-01-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update futex test in accordance with kernel's v4.15-rc7-202-gfbe0e83.
	* futex.c (VALP, VALP_PR, VAL2P, VAL2P_PR): New macro definitions.
	(main): Allow EINVAL on *REQUEUE* checks with VAL/VAL2 with higher bit
	being set, check that the existing behaviour preserved with VALP/VAL2P
	where higher bit is unset.

	tests/futex.c: improve error diagnostics.
	* tests/futex.c (futex_error): Add func and line arguments, print them.
	(CHECK_FUTEX_GENERIC): Pass __func__ and __LINE__ to futex_error.

	Add syscall entry for ARM-specific get_tls syscall.
	* linux/arm/syscallent.h ([ARM_FIRST_SHUFFLED_SYSCALL+1+6]): New entry.
	(ARM_LAST_SPECIAL_SYSCALL): Update to 6.
	* NEWS: Mention it.

2018-01-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Fix syscall descriptions for ARM-specific system calls.
	Based on an analysis of arm_syscall in arch/arm/kernel/traps.c.

	* linux/arm/syscallent.h ([ARM_FIRST_SHUFFLED_SYSCALL+1+2]): Update
	argument number, add TM flag.
	([ARM_FIRST_SHUFFLED_SYSCALL+1+1], [ARM_FIRST_SHUFFLED_SYSCALL+1+3],
	[ARM_FIRST_SHUFFLED_SYSCALL+1+4], [ARM_FIRST_SHUFFLED_SYSCALL+1+5]):
	Update argument number.

2018-01-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check riscv_flush_icache syscall decoder.
	* tests/riscv_flush_icache.c: New file.
	* tests/.gitignore: Add riscv_flush_icache.
	* tests/gen_tests.in: Likewise.
	* tests/pure_executables.list: Likewise.

	Implement decoding of riscv_flush_icache syscall.
	* linux/riscv/syscallent.h ([259]): Add riscv_flush_icache entry.
	* riscv.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* xlat/riscv_flush_icache_flags.in: New file.
	* NEWS: Mention it.

2018-01-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Workaround stray PTRACE_EVENT_EXEC.
	We (apparently) had a long-standing test failure inside strace-ff.test
	with the symptom that it misses exit_group call.  As it turned out, it
	was PTRACE_EVENT_EXEC followed by execve syscall exiting stop.  That
	behaviour indeed screwed all the syscall state tracking for the tracee.
	Let's try to patch it up by calling trace_syscall when we receive
	PTRACE_EVENT_EXEC outside syscall.

	* defs.h (TCB_RECOVERING): New tcb flag.
	* strace.c (dispatch_event) <case TE_STOP_BEFORE_EXECVE>: Invoke
	trace_syscall with TCB_RECOVERING flag being set for the current_tcp
	if the tracee is not on exiting syscall.
	* syscall.c (get_scno): Set QUAL_RAW if we are recovering.
	(tamper_with_syscall_entering): Do not perform actual tampering during
	recovery as it's already too late.
	* NEWS: Mention it.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-01-24  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify set_ptracer_any.
	* tests/set_ptracer_any.c (main) [HAVE_PRCTL]: Provide fallback
	definitions for PR_SET_PTRACER and PR_SET_PTRACER_ANY constants,
	set all unused prctl arguments to 0.

2018-01-24  Dmitry V. Levin  <ldv@altlinux.org>

	ia64: do not bail out in get_syscall_args if umove fails with EPERM.
	If the kernel contains commit 84d77d3f06e7e8dea057d10e8ec77ad71f721be3,
	both PTRACE_PEEKDATA and process_vm_readv become unavailable when the
	process dumpable flag is cleared, on ia64 this results to all syscall
	arguments being unavailable.

	Recognize this situation and do not treat it as get_syscall_args error
	because the latter leaves the tracee in a ptrace stop.

	This condition used to be triggered by prctl-dumpable test that caused
	strace to hang indefinitely.

	* linux/ia64/get_syscall_args.c (get_syscall_args): Do not bail out
	if umove fails.
	* tests/prctl-dumpable.c [__ia64__]: Skip the test.

2018-01-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.c: reset printing_tcp on print_event_exit.
	print_event_exit should have printing_tcp setup analogous to printleader and
	syscall_exit_trace before printing its part, otherwise it spuriously resets
	curcol in line_ended for the stale printing_tcp if followfork == 2.

	* strace.c (print_event_exit): Set printing_tcp to tcp before printing
	exiting event line and calling line_ended.

2018-01-23  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check path tracing of old select syscall.
	* tests/xselect.c [xselect] (xselect): Turn into prototype.
	* tests/oldselect-P.c: New file.
	* tests/oldselect-efault-P.c: Likewise.
	* tests/oldselect-efault.c: Likewise.
	* tests/oldselect.c: Use xselect.c
	* tests/pure_executables.list: Add oldselect-efault.
	* tests/gen_tests.in (oldselect, oldselect-P, oldselect-efault,
	oldselect-efault-P): New entries.
	* tests/oldselect.expected: Remove.
	* tests/oldselect.test: Remove.
	* tests/Makefile.am (check_PROGRAMS): Add oldselect-P
	and oldselect-efault-P.
	(DECODER_TESTS): Remove oldselect.test.
	(EXTRA_DIST): Remove oldselect.expected.
	* tests/.gitignore: Add oldselect-P, oldselect-efault,
	and oldselect-efault-P.

	tests: check path tracing of select/_newselect syscalls.
	* tests/xselect.c (main) [PATH_TRACING_FD]: Skip if /proc/self/fd/
	is not available.  Add test calls that use PATH_TRACING_FD.
	(main): Conditionalize expected output for those calls
	that do not use PATH_TRACING_FD with [!PATH_TRACING_FD].
	* tests/_newselect-P.c: New file.
	* tests/select-P.c: Likewise.
	* tests/Makefile.am (check_PROGRAMS): Add _newselect-P and select-P.
	* tests/.gitignore: Likewise.
	* tests/gen_tests.in (_newselect-P, select-P): New entries.

	tests: extend the check of select/_newselect syscalls decoding.
	* tests/xselect.c: Rewrite for better coverage.

2018-01-23  Dmitry V. Levin  <ldv@altlinux.org>

	tests: redirect stdin to /dev/null.
	Ensure that stdin descriptor is not available for output
	by reopening it to input from /dev/null.

	* tests/run.sh: Redirect test's stdin to /dev/null.

2018-01-23  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add file:line to perror_msg_and_fail/error_msg_and_fail output.
	* tests/tests.h [!perror_msg_and_fail] (perror_msg_and_fail): New macro
	wrapper around the homonymous function.
	[!error_msg_and_fail] (error_msg_and_fail): Likewise.
	* tests/error_msg.c (perror_msg_and_fail, error_msg_and_fail): New
	macros defined to themselves.

	Rework decoding and pathtrace of old select syscall.
	* linux/arch_defs_.h [!HAVE_ARCH_OLD_SELECT] (HAVE_ARCH_OLD_SELECT): New
	macro.
	* linux/aarch64/arch_defs_.h (HAVE_ARCH_OLD_SELECT): Likewise.
	* linux/arm/arch_defs_.h: Likewise.
	* linux/bfin/arch_defs_.h: Likewise.
	* linux/i386/arch_defs_.h: Likewise.
	* linux/m68k/arch_defs_.h: Likewise.
	* linux/microblaze/arch_defs_.h: Likewise.
	* linux/powerpc64/arch_defs_.h: Likewise.
	* linux/sh/arch_defs_.h: Likewise.
	* linux/x32/arch_defs_.h: Likewise.
	* linux/x86_64/arch_defs_.h: Likewise.
	* linux/powerpc/arch_defs_.h: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* desc.c (SYS_FUNC(oldselect)): Rewrite using
	fetch_indirect_syscall_args, move under [HAVE_ARCH_OLD_SELECT].
	* pathtrace.c (match_xselect_args): New function.
	(pathtrace_match_set): Use it.

2018-01-23  Dmitry V. Levin  <ldv@altlinux.org>

	Transform fetch_old_mmap_args into fetch_indirect_syscall_args.
	As there are more than one old style syscall that take their arguments
	via array, generalize fetch_old_mmap_args into a function that could
	fetch variable number of arguments.

	* mem.c (fetch_old_mmap_args): Transform into ...
	* fetch_indirect_syscall_args.c: ... fetch_indirect_syscall_args
	in this new file.
	* Makefile.am (libstrace_a_SOURCES): Add it.
	* defs.h [HAVE_ARCH_OLD_MMAP] (fetch_old_mmap_args): Remove.
	(fetch_indirect_syscall_args): New prototype.
	* pathtrace.c (pathtrace_match_set) [HAVE_ARCH_OLD_MMAP]: Use
	fetch_indirect_syscall_args instead of fetch_old_mmap_args.

2018-01-23  Eugene Syromyatnikov  <evgsyr@gmail.com>

	signal.c: remove excess semicolon after the end of the function.
	* signal.c (rt_sigtimedwait): Remove semicolon after the function body.

	Use char * for pointer arithmetics.
	* netlink_inet_diag.c (decode_inet_diag_req_compat,
	decode_inet_diag_req_v2, decode_inet_diag_msg): Cast to char *
	instead of void *.
	* netlink_netlink_diag.c (decode_netlink_diag_req,
	decode_netlink_diag_msg): Likewise.
	* netlink_packet_diag.c (decode_packet_diag_req,
	decode_packet_diag_msg): Likewise.
	* netlink_unix_diag.c (decode_unix_diag_req, decode_unix_diag_msg):
	Likewise.
	* rtnl_addr.c (decode_ifaddrmsg): Likewise.
	* rtnl_addrlabel.c (decode_ifaddrlblmsg): Likewise.
	* rtnl_dcb.c (decode_dcbmsg): Likewise.
	* rtnl_link.c (decode_ifinfomsg): Likewise.
	* rtnl_mdb.c (decode_br_port_msg): Likewise.
	* rtnl_neigh.c (decode_ndmsg): Likewise.
	* rtnl_route.c (decode_rtmsg): Likewise.
	* rtnl_rule.c (decode_fib_rule_hdr): Likewise.
	* rtnl_tc.c (decode_tcmsg): Likewise.

2018-01-23  Eugene Syromyatnikov  <evgsyr@gmail.com>

	netlink_inet_diag.c: remove unnecessary return.
	decode_inet_diag_req, as well as the functions it calls, returns void.

	* netlink_inet_diag.c (decode_inet_diag_req): Do not return anything.

2018-01-21  Dmitry V. Levin  <ldv@altlinux.org>

	Move decoder of getpagesize syscall to libstrace.
	As only five architectures have getpagesize syscall, moving the decoder
	to libstrace allows to get rid of getpagesize related ifdefs and check
	build of getpagesize decoder on other architectures.

	* mem.c (SYS_FUNC(getpagesize)): Move ...
	* getpagesize.c: ... to this new file.
	* Makefile.am (libstrace_a_SOURCES): Add it.

2018-01-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	mpers: implement gawk 3 support.
	Some old systems that still make some sense to be supported have only
	gawk 3, so let's support them for now.

	In order to achieve that, multiple changes have been implemented:
	 - Multidimensional arrays are replaced with single-dimensional ones.
	   In most places it's a "][" -> ", " replacement, as awk allows some
	   kind of emulation of multidimensional arrays that way, but in several
	   occasions (specifically for storing name and special fields) we have
	   to iterate over them later, so we store that information in
	   additional arrays in order to get the keys.
	 - "switch" statements are replaced with sets of "if ... else if ...
	   else" statements.  This change is trivial, except we've added
	   a temporary variable in what_is order to store expression value, for
	   readability purposes.
	 - No support for array iteration ordering.  This one is most ugly of
	   them all.  Luckily, not that ugly, we've just had to process index a
	   bit in order to make it lexicographically sortable and add two
	   temporary arrays containing sorted indices in order to sort over them
	   instead of those two arrays that we've added in order to work around
	   lack of multidimensional array support.

	* mpers.awk (compare_indices): Remove unused function.
	(array_get, update_upper_bound, /^DW_AT_data_member_location/,
	/^DW_AT_byte_size/, /^DW_AT_encoding/): Replace multidimensional array
	access with comma-concatenated index.
	(norm_idx): New function.
	(array_seq): Replace multidimensional array access with
	comma-concatenated index.  Use comma-concatenated pair of (array_idx,
	"seq") in order to check presence of the item in an array.
	(what_is): Add enc and i local variables.  Store the value of
	array[what_idx, "encoding"] in it.  Replace "switch" statements with
	sets of "if ... else if ... else" statements.  Replace multidimensional
	array access with comma-concatenated index. Use for (... ; ...; ...)
	iteration over aparents_keys instead of iteration over array.
	(/^<[[:xdigit:]]+>/): Store idx as norm_idx(matches[2]).  Replace
	multidimensional array access with comma-concatenated index.  Store an
	additional flag in array_names array.
	(/^DW_AT_name/): Replace multidimensional array access with
	comma-concatenated index.  Add a flag to array_names for that idx.
	(/^DW_AT_type/): Do not capture "0x" as a part of a group, normalise
	the captured group.  Replace multidimensional array access with
	comma-concatenated index.
	(/^Abbrev Number:[^(]+\(DW_TAG_/): Replace multidimensional array access
	with comma-concatenated index.  Store additional flags in
	array_special and array_parents arrays.
	(END): Remove PROCINFO["sorted_in"] setup.  Sort array_parents.  Replace
	multidimensional array access with comma-concatenated index.  Iterate
	over array_special to go over all the items that have "special" field.
	Iterate over array_names to go over all items that have "name" field.
	* NEWS: Mention it.

2018-01-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	dm: add support for event_nr in DM_LIST_DEVICES result.
	Commit v4.13-rc1~137^2~13 (and a follow-up fix v4.14-rc4~20^2~3
	that changed alignment) introduced an additional hidden field
	in the structure returned by DM_LIST_DEVICES ioctl command
	that contains event_nr information.

	Unfortunately, we can't test it for now, but looks like it kinda works:

	  # ./strace -v -eioctl -y dmsetup ls
	  ioctl(3</dev/mapper/control>, DM_VERSION, {version=4.0.0,
	  data_size=16384, flags=DM_EXISTS_FLAG} => {version=4.37.0,
	  data_size=16384, flags=DM_EXISTS_FLAG}) = 0
	  ioctl(3</dev/mapper/control>, DM_LIST_DEVICES, {version=4.0.0,
	  data_size=16384, data_start=312, flags=DM_EXISTS_FLAG} =>
	  {version=4.37.0, data_size=408, data_start=312, flags=DM_EXISTS_FLAG,
	  {dev=makedev(253, 1), name="fedoratesting--30-swap", event_nr=0},
	  {dev=makedev(253, 0), name="fedoratesting--30-root"}}) = 0
	  fedoratesting--30-swap	(253:1)
	  fedoratesting--30-root	(253:0)

	* dm.c (dm_decode_dm_name_list): Obtain the amount of bytes copied
	during printing device name, print event number if there's a suitable
	gap present and the DM version is high enough.
	* NEWS: Mention it.

2018-01-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Move definition of personality macros to arch_defs_.h.
	* supported_personalities.h: Remove.
	* defs.h: Do not include it.
	* linux/arch_defs_.h [!DEFAULT_PERSONALITY] (DEFAULT_PERSONALITY): New
	macro.
	[!SUPPORTED_PERSONALITIES] (SUPPORTED_PERSONALITIES): Likewise.
	* linux/aarch64/arch_defs_.h (SUPPORTED_PERSONALITIES): New macro.
	* linux/riscv/arch_defs_.h: Likewise.
	* linux/s390x/arch_defs_.h: Likewise.
	* linux/sparc64/arch_defs_.h: Likewise.
	* linux/x32/arch_defs_.h: Likewise.
	* linux/x86_64/arch_defs_.h: Likewise.
	* linux/powerpc64/arch_defs_.h: New file.
	* linux/tile/arch_defs_.h: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.
	(strace_SOURCES): Remove supported_personalities.h.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-01-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Introduce HAVE_ARCH_SA_RESTORER.
	In order to simplify HAVE_SA_RESTORER logic a bit.

	* linux/ia64/arch_defs_.h (HAVE_ARCH_SA_RESTORER): New macro.
	* linux/m68k/arch_defs_.h: Likewise.
	* linux/sparc/arch_defs_.h: Likewise.
	* linux/sparc64/arch_defs_.h: Likewise.
	* linux/hppa/arch_defs_.h: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* signal.c [HAVE_ARCH_SA_RESTORER]: Define HAVE_SA_RESTORER to it.
	[!HAVE_ARCH_SA_RESTORER && SA_RESTORER]: Define HAVE_SA_RESTORER to 1.
	[!HAVE_ARCH_SA_RESTORER && !SA_RESTORER]: Define HAVE_SA_RESTORER to 0.

2018-01-21  Dmitry V. Levin  <ldv@altlinux.org>

	Replace NEED_UID16_PARSERS with HAVE_ARCH_UID16_SYSCALLS.
	* linux/arch_defs_.h [!HAVE_ARCH_UID16_SYSCALLS]
	(HAVE_ARCH_UID16_SYSCALLS): New macro.
	* linux/aarch64/arch_defs_.h (HAVE_ARCH_UID16_SYSCALLS): New macro.
	* linux/arm/arch_defs_.h: Likewise.
	* linux/i386/arch_defs_.h: Likewise.
	* linux/ia64/arch_defs_.h: Likewise.
	* linux/m68k/arch_defs_.h: Likewise.
	* linux/s390/arch_defs_.h: Likewise.
	* linux/s390x/arch_defs_.h: Likewise.
	* linux/sh/arch_defs_.h: Likewise.
	* linux/sparc/arch_defs_.h: Likewise.
	* linux/sparc64/arch_defs_.h: Likewise.
	* linux/syscall.h: Likewise.
	* linux/x32/arch_defs_.h: Likewise.
	* linux/x86_64/arch_defs_.h: Likewise.
	* linux/bfin/arch_defs_.h: New file.
	* linux/microblaze/arch_defs_.h: Likewise.
	* linux/riscv/arch_defs_.h: Likewise.
	* linux/sh64/arch_defs_.h: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.
	* defs.h (NEED_UID16_PARSERS): Remove.
	* linux/syscall.h: Check for HAVE_ARCH_UID16_SYSCALLS instead of
	NEED_UID16_PARSERS.
	* uid.c: Likewise.

	Replace HAVE_GETRVAL2 with HAVE_ARCH_GETRVAL2.
	* linux/arch_defs_.h [!HAVE_ARCH_GETRVAL2] (HAVE_ARCH_GETRVAL2): New
	macro.
	* linux/alpha/arch_defs_.h: New file.
	* linux/ia64/arch_defs_.h: Likewise.
	* linux/mips/arch_defs_.h: Likewise.
	* linux/sh/arch_defs_.h: Likewise.
	* linux/sparc/arch_defs_.h: Likewise.
	* linux/sparc64/arch_defs_.h: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.
	* defs.h (HAVE_GETRVAL2): Remove.
	(getrval2): Check for HAVE_ARCH_GETRVAL2 instead of arch checks.
	* net.c (SYS_FUNC(pipe)): Check for HAVE_ARCH_GETRVAL2 instead of
	HAVE_GETRVAL2.
	* syscall.c: Likewise.

	Use #if idiom instead of #ifdef for HAVE_ARCH_* macros.
	* linux/arch_defs_.h [!HAVE_ARCH_OLD_MMAP] (HAVE_ARCH_OLD_MMAP): New
	macro.
	[!HAVE_ARCH_OLD_MMAP_PGOFF] (HAVE_ARCH_OLD_MMAP_PGOFF): Likewise.
	* defs.h: Use #if instead of #ifdef to check HAVE_ARCH_OLD_MMAP.
	* mem.c: Use #if instead of #ifdef to check HAVE_ARCH_OLD_MMAP
	and HAVE_ARCH_OLD_MMAP_PGOFF
	* pathtrace.c: Likewise.

2018-01-21  Dmitry V. Levin  <ldv@altlinux.org>

	Rename arch-specific arch_defs.h files to arch_defs_.h.
	Introduce a new arch_defs.h header that includes the corresponding
	arch-specific arch_defs_.h file followed by generic arch_defs_.h file.

	* linux/arch_defs.h: Rename to linux/arch_defs_.h.
	* linux/aarch64/arch_defs.h: Rename to linux/aarch64/arch_defs_.h.
	* linux/arm/arch_defs.h: Rename to linux/arm/arch_defs_.h.
	* linux/i386/arch_defs.h: Rename to linux/i386/arch_defs_.h.
	* linux/m68k/arch_defs.h: Rename to linux/m68k/arch_defs_.h.
	* linux/s390/arch_defs.h: Rename to linux/s390/arch_defs_.h.
	* linux/s390x/arch_defs.h: Rename to linux/s390x/arch_defs_.h.
	* linux/x32/arch_defs.h: Rename to linux/x32/arch_defs_.h.
	* linux/x86_64/arch_defs.h: Rename to linux/x86_64/arch_defs_.h.
	* arch_defs.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	(EXTRA_DIST): Rename linux/*/arch_defs.h to linux/*/arch_defs_.h.

2018-01-19  Dmitry V. Levin  <ldv@altlinux.org>

	Fix ANY_WORDSIZE_LESS_THAN_KERNEL_LONG definition.
	* defs.h (ANY_WORDSIZE_LESS_THAN_KERNEL_LONG): Rewrite without undefined
	behaviour.

	Fixes: f916793 ("Introduce ANY_WORDSIZE_LESS_THAN_KERNEL_LONG macro")

2018-01-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util: return string size in printstr.
	As umovestr now returns something useful, let's propagate it further.

	* defs.h (printstr_ex, printpathn, printpath): Change return type from
	void to int.
	(printstrn, printstr): Change return type from void to int, return
	printstr_ex result.
	* util.c (printpathn): Return -1 on NULL addr, nul_seen (exit code of
	umovestr) on success.
	(printpath): Return printpathn result.
	(printstr_ex): Return -1 on NULL addr, umoven/umovestr result otherwise.

2018-01-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ucopy: return string size in umovestr.
	We return the size that includes \0 in order to preserve existing
	behaviour (return 0 when \0 haven't been seen, return positive number
	when it has been seen).

	* ucopy.c (umovestr_peekdata, umovestr): Return string length
	including \0 instead of 1 when \0 is found.

2018-01-19  Dmitry V. Levin  <ldv@altlinux.org>

	mpers.awk: avoid redefinition of mpers_ptr_t.
	Older versions of gcc like those found in RHEL6 fail with the following
	diagnostics:

	  In file included from block.c:32:
	  ./mpers-m32/struct_blk_user_trace_setup.h:2: error: redefinition of typedef ‘mpers_ptr_t’
	  mpers_type.h:44: note: previous declaration of ‘mpers_ptr_t’ was here

	* mpers.awk (END): Add #ifndef guard to mpers_ptr_t typedef.
	* mpers_test.sh: Update expected output.

2018-01-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add support for --enable-mpers=m32|mx32.
	* configure.ac (AC_ARG_ENABLE([mpers])): Allow m32 and mx32 values
	for --enable-mpers option.
	* m4/mpers.m4 (st_MPERS): Check for personality support if personality
	name is provided as an option.  Fail if the requested personality
	support is not available.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-01-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: improve setugid error diagnostics a bit.
	* tests/setugid.c (main): Print unexpected code returned by syscall.

2018-01-19  Dmitry V. Levin  <ldv@altlinux.org>

	v4l2: do not mpersify struct v4l2_create unless it is used by other code
	This fixes build with mpers support on older systems that lack
	definition of struct v4l2_create.

	* v4l2.c: Wrap references to struct v4l2_create with
	[VIDIOC_CREATE_BUFS].

2018-01-18  Dmitry V. Levin  <ldv@altlinux.org>

	btrfs: use uint32_t instead of __u32.
	* btrfs.c (btrfs_ioctl) [!HAVE_STRUCT_BTRFS_IOCTL_FS_INFO_ARGS_NODESIZE]:
	Replace __u32 with uint32_t.  Remove useless cast.

2018-01-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1.in: clarify mpers flags in strace -V output.
	The previous description was a bit dated.

	* strace.1.in (.SH "MULTIPLE PERSONALITY SUPPORT"): Remove "no-m32" and
	"no-mx32", describe the situation when some of mpers flags are not
	present in strace -V output.

2018-01-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add compat support for s390x.
	By very popular demand.

	While we are here, let's refactor the condition for old_mmap_pgoff into
	an arch-specific one, as it is used more than in one place.

	* NEWS: Mention this.
	* strace.1.in (.SH "MULTIPLE PERSONALITY SUPPORT"): Likewise.
	* configure.ac (case "$host_cpu" in) <s390x>: Set arch_m32 to s390, set
	cc_flags_m32 to -m31.
	(st_MPERS([m32])): Add s390x.
	* defs.h [S390X]: Define NEED_UID16_PARSERS.
	* linux/s390/arch_sigreturn.c [!S390_FRAME_PTR] (S390_FRAME_PTR): New
	macro, define to s390_frame_ptr.
	[!SIGNAL_FRAMESIZE] (SIGNAL_FRAMESIZE): New macro, define to
	__SIGNAL_FRAMESIZE.
	[!PTR_TYPE] (PTR_TYPE): New macro, define to unsigned long.
	(arch_sigreturn): Use S390_FRAME_PTR, SIGNAL_FRAMESIZE, and PTR_TYPE
	instead of s390_frame_ptr, __SIGNAL_FRAMESIZE, and pointer-sized type,
	respectively.
	* linux/s390/get_error.c [!ARCH_REGSET] (ARCH_REGSET): New macro, define
	* to s390_regset.
	(get_error): Use it instead of s390_regset.
	* linux/s390/get_scno.c (arch_get_scno): Likewise.
	* linux/s390/get_syscall_args.c (get_syscall_args): Likewise.
	* linux/s390/set_error.c (arch_set_error, arch_set_success): Likewise.
	* linux/s390/set_scno.c (arch_set_scno): Likewise.
	* linux/s390x/arch_regs.c (psw_compat_t, s390_compat_regs,
	s390x_regs_union, s390_frame_ptr, s390x_frame_ptr, s390x_io): New
	variables.
	(s390_regset, s390x_regset, ARCH_REGS_FOR_GETREGSET,
	ARCH_IOVEC_FOR_GETREGSET, ARCH_PC_REG, ARCH_PERSONALITY_0_IOV_SIZE,
	ARCH_PERSONALITY_1_IOV_SIZE): New macros.
	* linux/s390x/arch_regs.h (s390_frame_ptr, s390x_frame_ptr): New
	prototypes.
	* linux/s390x/arch_rt_sigframe.c: Conditionalize on tcp->currpers.
	* linux/s390x/arch_sigreturn.c: Likewise.
	* linux/s390x/get_error.c: Likewise.
	* linux/s390x/get_scno.c: Likewise.
	* linux/s390x/get_syscall_args.c: Likewise.
	* linux/s390x/set_error.c: Likewise.
	* linux/s390x/set_scno.c: Likewise.
	* linux/s390x/errnoent1.h: New file.
	* linux/s390x/ioctls_arch1.h: Likewise.
	* linux/s390x/ioctls_inc1.h: Likewise.
	* linux/s390x/signalent1.h: Likewise.
	* linux/s390x/syscallent1.h: Likewise.
	* Makefile.am (EXTRA_DIST): Add new files added to linux/s390x.
	* supported_personalities.h [S390X] (SUPPORTED_PERSONALITIES): Define
	to 2.
	* tests/strace-V.test: Add s390 to the list of architectures that have
	m32 personality.
	* linux/s390/arch_defs.h (HAVE_ARCH_OLD_MMAP_PGOFF): New macro.
	* linux/s390x/arch_defs.h: Likewise.
	* mem.c: Replace #ifdef S390 with #ifdef HAVE_ARCH_OLD_MMAP_PGOFF.
	* pathtrace.c: Likewise.

2018-01-18  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update NEWS.

2018-01-17  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check path tracing of ppoll syscall.
	* tests/ppoll.c (main) [PATH_TRACING_FD]: Skip if /proc/self/fd/
	is not available.  Add a test call that use PATH_TRACING_FD.
	(main): Conditionalize expected output for those calls
	that do not use PATH_TRACING_FD with [!PATH_TRACING_FD].
	* tests/ppoll-P.c: New file.
	* tests/pure_executables.list: Add ppoll-P.
	* tests/.gitignore: Likewise.
	* tests/gen_tests.in (ppoll-P): New entry.

	tests: check path tracing of poll syscall.
	* tests/poll.c (main) [PATH_TRACING_FD]: Skip if /proc/self/fd/
	is not available.  Add tests calls that use PATH_TRACING_FD.
	(main): Conditionalize expected output for those calls
	that do not use PATH_TRACING_FD with [!PATH_TRACING_FD].
	* tests/poll-P.c: New file.
	* tests/pure_executables.list: Add poll-P.
	* tests/.gitignore: Likewise.
	* tests/poll-P.test: New test.
	* tests/Makefile.am (DECODER_TESTS): Add poll-P.test.

2018-01-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: enable old_mmap-P.test on s390x.
	As s390x is the only 64-bit architecture that has old_mmap,
	the test needs some adjustments there.

	* tests/old_mmap.c: Update condition.
	(main): Change int types to long, extend numerals to 64 bit, change
	printing format qualifiers to corresponding long types.

	Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>

2018-01-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check path tracing of old mmap syscall.
	* tests/old_mmap.c [!TEST_FD]: Define TEST_FD.
	(main) <args1_c>: Replace 5th argument with TEST_FD.
	(main): Wrap the output for the calls that do not use TEST_FD
	with #ifndef PATH_TRACING.
	* tests/old_mmap-P.c: New file.
	* tests/pure_executables.list: Add old_mmap-P.
	* tests/.gitignore: Likewise.
	* tests/gen_tests.in: Add old_mmap-P test.

2018-01-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Fix pathtrace for old_mmap/old_mmap_pgoff.
	As these system calls have only one argument that points to the
	location in memory containing actual arguments, current path tracing
	implementation is incorrect.  In order to fix this, let's use recently
	introduced fetch_old_mmap_args in order to get actual arguments suitable
	for path matching.

	* pathtrace.c [HAVE_ARCH_OLD_MMAP] <case SEN_old_mmap,
	case SEN_old_mmap_pgoff>: Retrieve actual old_mmap arguments with
	fetch_old_mmap_args, pass the value from the retrieved args if it's
	available.

2018-01-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Test non-verbose old_mmap output.
	* tests/old_mmap-v-none.c: New file.  Include old_mmap.c.
	* tests/pure_executables.list: Add old_mmap-v-none.
	* tests/.gitignore: Likewise.
	* tests/gen_tests.in (old_mmap-v-none): New entry.

2018-01-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	mem.c: use runtime check in fetch_old_mmap_args.
	This makes code a bit cleaner and makes it compatible with the upcoming
	s390x compat support.

	* mem.c [HAVE_ARCH_OLD_MMAP] (fetch_old_mmap_args): Replace
	ANY_WORDSIZE_LESS_THAN_KERNEL_LONG check with current_wordsize == 4
	check.

2018-01-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	mem.c: introduce fetch_old_mmap_args.
	Move common old_mmap/old_mmap_pgoff argument fetching code into a
	separate function.

	As it is, it also fixes the case of non-verbose printing of old_mmap
	arguments (see the new test in the next commit).  Also, it is a
	preparation for the fix of path tracing for these syscalls.

	* defs.h [HAVE_ARCH_OLD_MMAP] (fetch_old_mmap_args): New prototype.
	* mem.c [HAVE_ARCH_OLD_MMAP] (fetch_old_mmap_args): New function.
	[HAVE_ARCH_OLD_MMAP] (old_mmap, old_mmap_pgoff): Use it.

	Fixes: 3db07f11 "Fix old_mmap output when mmap arguments are unfetchable"
	Suggested-by: Dmitry V. Levin <ldv@altlinux.org>

2018-01-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Introduce arch-specific define HAVE_ARCH_OLD_MMAP.
	* linux/arch_defs.h: New file.
	* linux/aarch64/arch_defs.h: New file.  Define HAVE_ARCH_OLD_MMAP.
	* linux/arm/arch_defs.h: Likewise.
	* linux/i386/arch_defs.h: Likewise.
	* linux/m68k/arch_defs.h: Likewise.
	* linux/s390/arch_defs.h: Likewise.
	* linux/s390x/arch_defs.h: Likewise.
	* linux/x32/arch_defs.h: Likewise.
	* linux/x86_64/arch_defs.h: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.
	* defs.h: Include "arch_defs.h"
	* mem.c: Replace condition for SYS_FUNC(old_mmap) with #ifdef
	HAVE_ARCH_OLD_MMAP.

	Suggested-by: Dmitry V. Levin <ldv@altlinux.org>

2018-01-17  Dmitry V. Levin  <ldv@altlinux.org>
	    Nikolay Marchuk  <marchuk.nikolay.a@gmail.com>

	tests: improve descriptor set syntax testing.
	* tests/filtering_fd-syntax.test: New file.
	* tests/options-syntax.test: Move descriptor set syntax testing
	to filtering_fd-syntax.test.
	* tests/Makefile.am (MISC_TESTS): Add filtering_fd-syntax.test.

2018-01-16  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.c: print correct out file name in error messages in case of -ff.
	* strace.c (outf_perror): New function.
	(tvprintf, tprints, flush_tcp_output): Use it.

	aarch64: use ARCH_SET_PERSONALITY_FROM_IOV_SIZE.
	* linux/aarch64/arch_regs.c (ARCH_PERSONALITY_0_IOV_SIZE,
	ARCH_PERSONALITY_1_IOV_SIZE): New macros.
	* linux/aarch64/get_scno.c (arch_get_scno): Do not call
	update_personality as it is handled by the generic get_regs code now.

2018-01-16  Eugene Syromyatnikov  <evgsyr@gmail.com>

	syscall.c: add ability to set personality based on GETREGSET iov size.
	Some architectures (aarch64, s390x) use only PTRACE_GETREGSET interface
	and use its size to detect current personality. Let's generalise this
	approach and also avoid subtle errors when we get register but forget to
	update personality, at least for those architectures.

	Note that in order to employ this behaviour, architecture has to use
	PTRACE_GETREGSET exclusively (no HAVE_GETREGS_OLD) and should declare
	appropriate ARCH_PERSONALITY_*_IOV_SIZE macros.

	* syscall.c (get_regs) [ptrace_getregset_or_getregs &&
	!HAVE_GETREGS_OLD]: Call update_personality based on the value returned
	in the iov_len field by PTRACE_GETREGSET.  Warn once if the returned
	iov_len is unknown.

2018-01-16  Eugene Syromyatnikov  <evgsyr@gmail.com>

	syscall.c: add sanity check for the target personality number.
	We can never be cautious enough.

	* defs.h (set_personality): Change argument type to unsigned int.
	* syscall.c (set_personality): Change argument type to unsigned int,
	check whether requested personality is sane, die otherwise.

2018-01-16  Eugene Syromyatnikov  <evgsyr@gmail.com>

	syscall.c: move current_personality check to set_personality.
	As all the personality-dependent entries are initially in sync, we can
	move the check whether we are setting the same personality as we
	currently are inside set_personality out of update_personality.

	* syscall.c (current_wordsize, current_klongsize): Initialise to 0'th
	personality value in order to make the statement about "all the
	personality-dependent entries are initially in sync" true.
	(set_personality): Check whether requested personality differs from
	current_personality.
	(update_personality): Call set_personality unconditionally.

2018-01-16  Eugene Syromyatnikov  <evgsyr@gmail.com>

	syscall.c: always update tcp->currpers in update_personality.
	Sometimes (for example, switching from a process with one personality
	to a process that previously had different personality but returning
	from execve to that same personality into) it is possible that
	current_personality is not changed, but tcp->currpers is different.
	So, let's not return from update_personality and always update
	tcp->currpers if it differs from the target personality.

	* syscall.c (update_personality): Do not exit early if personality ==
	current_personality.

2018-01-16  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update current_personality on tcb switch.
	* strace.c (set_current_tcp): New function.
	(printleader, droptcb, print_event_exit, next_event, dispatch_event):
	Call set_current_tcp instead of setting current_tcp manually.

2018-01-16  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add support for specifying compiler options for mpers builds.
	Because some architectures are very, very special.

	* configure.ac (cc_flags_m32, cc_flags_mx32): New variables. AC_SUBST
	them.
	* m4/mpers.m4 (MPERS_CFLAGS): Use instead of CFLAG, pushdef as
	$cc_flags_$1.
	Use mpers_name instead of CFLAG in AC_CACHE_CHECK messages.
	Pass MPERS_CFLAGS as the second argument to mpers_test.sh
	* mpers.sh: Add CC_ARCH_FLAGS as the second argument (PARSER_FILE
	is moved to the third one). Do not expect leading dash in ARCH_FLAG
	anymore.
	* mpers_test.sh (mpers_cc_flags): New variable, initialise to the second
	command line argument.
	Pass $mpers_name without leading dash to mpers.sh.
	Pass $mpers_cc_flags as the second argument to mpers.sh ($sample is
	the third argument now).
	* Makefile.am (mpers-m%.stamp:): Pass $(mpers_CC_FLAGS) as the second
	argument to mpers.sh ($$f is now the third argument).
	($(mpers_m32_targets)): Define target variable mpers_CC_FLAGS with the
	value of @cc_flags_m32@
	($(mpers_mx32_targets)): Define target variable mpers_CC_FLAGS with the
	value of @cc_flags_mx32@
	* tests/Makefile.am (MERS_CC_FLAGS): New variable.
	* bootstrap: Append @cc_flags_$1@ to MPERS_CC_FLAGS. Append
	$(MPERS_CC_FLAGS) to ARCH_MFLAGS.

2018-01-16  Dmitry V. Levin  <ldv@altlinux.org>
	    Nikolay Marchuk  <marchuk.nikolay.a@gmail.com>

	tests: improve syscall set syntax testing.
	* tests/filtering_syscall-syntax.test: New file.
	* tests/options-syntax.test: Move syscall set syntax testing
	to filtering_syscall-syntax.test.
	* tests/qual_fault-syntax.test: Likewise.
	* tests/qual_inject-syntax.test: Likewise.
	* tests/Makefile.am (MISC_TESTS): Add filtering_syscall-syntax.test.

2018-01-16  Dmitry V. Levin  <ldv@altlinux.org>

	Enhance error diagnostics about invalid syscalls in fault injection syntax
	Validate syscall set before the whole fault injection syntax.

	* filter_qualify.c (parse_inject_expression): Add const qualifier to
	return type.  Return an empty string when no syscall set is specified.
	(qualify_inject_common): Add const qualifier to "name".  Move
	qualify_syscall_tokens invocation right after parse_inject_expression.
	* tests/qual_fault-syntax.test: Update expected output.
	* tests/qual_inject-syntax.test: Likewise.

2018-01-16  Dmitry V. Levin  <ldv@altlinux.org>

	basic_filters: use loop initial declarations.
	* basic_filters.c (qualify_syscall_number, qualify_syscall_regex,
	lookup_class, qualify_syscall_class, qualify_syscall_tokens,
	qualify_tokens): Use "for" loop initial declarations.

	filter_qualify: use loop initial declarations.
	* filter_qualify.c (sigstr_to_uint, find_errno_by_name,
	parse_inject_expression, qualify_inject_common, qualify): Use "for" loop
	initial declarations.

	configure: try to set the C compiler mode to accept ISO Standard C.
	* configure.ac: Use AC_PROG_CC_STDC.
	* NEWS: Mention this.

2018-01-15  Dmitry V. Levin  <ldv@altlinux.org>

	pathtrace: update the list of unrelated syscalls.
	* pathtrace.c (pathtrace_match_set) <SEN_accept4, SEN_accept,
	SEN_signalfd4, SEN_signalfd>: Skip matching.

	basic_filters: move legacy tracing class names to the end of table.
	* basic_filters.c (lookup_class) <syscall_class>: Move names that do not
	start with % to the end of table.

	Enhance decoding of mq_* syscalls.
	* mq.c (SYS_FUNC(mq_open)): Add RVAL_FD to return value.
	(SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive), SYS_FUNC(mq_notify),
	SYS_FUNC(mq_getsetattr)): Print the first argument using printfd.
	* NEWS: Mention this change.
	* pathtrace.c (pathtrace_match_set) <SEN_mq_getsetattr, SEN_mq_notify,
	SEN_mq_open, SEN_mq_timedreceive, SEN_mq_timedsend>: Skip matching.
	* linux/32/syscallent.h (mq_getsetattr, mq_notify, mq_open,
	mq_timedreceive, mq_timedsend): Add TD flag.
	* linux/64/syscallent.h: Likewise.
	* linux/alpha/syscallent.h: Likewise.
	* linux/arm/syscallent.h: Likewise.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/crisv10/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/powerpc64/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/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Enhance error diagnostics about invalid syscalls in fault injection syntax
	* basic_filters.c (qualify_syscall_tokens): Remove "name" argument,
	assume its value is "system call".
	* filter.h (qualify_syscall_tokens): Remove "name" argument.
	All callers updated.
	* tests/qual_fault-syntax.test: Update expected output.

	basic_filters: handle "all" in a more readable way.
	* basic_filters.c (qualify_syscall_tokens, qualify_tokens): Remove
	handle_inversion label, handle "all" by invoking invert_number_set_array
	directly.

	filter: remove redundant braces around single line expressions.
	* basic_filters.c (qualify_syscall_class, qualify_syscall_name):
	Rearrange the inner loop body.
	(qualify_syscall_number, lookup_class, qualify_syscall_tokens,
	qualify_tokens): Remove redundant braces around single line expressions.
	* filter_qualify.c (qualify_inject_common): Likewise.

	filter_qualify: move memory allocation from parse_inject_expression.
	* filter_qualify.c (parse_inject_expression): Replace "s" and "buf"
	arguments with "str" argument, use it instead of "s" and "*buf".
	(qualify_inject_common): Rename "buf" to "copy", initialize it to a copy
	of "str", pass "copy" to parse_inject_expression instead of "str" and
	"buf".

2018-01-14  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update NT_* constants.
	Update NT_* descriptor types with the values borrowed from
	kernel's include/uapi/linux/elf.h and glibc's elf.h.

	* xlat/nt_descriptor_types.in (NT_PRSTATUS, NT_FPREGSET, NT_PRPSINFO,
	NT_PRXREG, NT_TASKSTRUCT, NT_PLATFORM, NT_AUXV, NT_GWINDOWS, NT_ASRS,
	NT_PSTATUS, NT_PSINFO, NT_PRCRED, NT_UTSNAME, NT_LWPSTATUS,
	NT_LWPSINFO, NT_PRFPXREG, NT_PRXFPREG, NT_PPC_VMX, NT_PPC_SPE,
	NT_PPC_VSX, NT_386_TLS, NT_386_IOPERM, NT_X86_XSTATE): Add fallback
	definitions.
	(NT_SIGINFO, NT_FILE, NT_PPC_*, NT_S390_*, NT_ARM_*, NT_METAG_*,
	NT_ARC_V2): New constants.
	* NEWS: Mention this.

2018-01-13  Dmitry V. Levin  <ldv@altlinux.org>

	configure: use AC_MSG_ERROR and AC_MSG_FAILURE consistently.
	* configure.ac [$arch = mips]: Use AC_MSG_FAILURE instead of
	AC_MSG_ERROR when _MIPS_SIM cannot be determined.  Use AC_MSG_ERROR
	instead of AC_MSG_FAILURE when syscallent stubs cannot be generated.

2018-01-11  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	configure: add --disable-mpers and --enable-mpers=check options.
	On architectures supporting multiple personalities, multiple
	personalities support in strace is required for proper decoding of
	structures used by tracees with personalities that differ from the
	personality of strace.

	New configure options control whether multiple personalities support
	in strace is mandatory, optional, or disabled.

	The default is changed from what is now equivalent of
	--enable-mpers=check (automatically detect whether required mpers
	support could be enabled) to --enable-mpers (terminate the build
	if required mpers support could not be enabled).

	* configure.ac (AC_ARG_ENABLE([mpers])): New option.
	* m4/mpers.m4 (st_MPERS): Use enable_mpers.  Terminate the build
	if mpers could not be enabled and enable_mpers==yes.
	* strace.spec.in: Specify --enable-mpers=check to %configure.
	* debian/rules (build/Makefile, build64/Makefile): Specify
	--enable-mpers=check to configure.

	Suggested-by: DJ Delorie <dj@redhat.com>

2018-01-11  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Update ioctl entries from linux v4.15-rc7.
	* linux/32/ioctls_inc_align16.h: Update from linux v4.15-rc7 using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* NEWS: Mention this.

2018-01-11  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	Issue a warning when strace lacks tracee personality support.
	* defs.h (HAVE_PERSONALITY_1_MPERS, HAVE_PERSONALITY_2_MPERS): New
	macros.
	* syscall.c (update_personality): Add need_mpers_warning array
	initialized with mpers support data.  Use it for printing the mpers
	unavailability warning once per personality.

2018-01-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add more checks of reboot syscall decoding.
	In particular, check for the recent fixes in reboot syscall decoder.

	* tests/gen_tests.in (reboot): Provide -s 256 option.
	* tests/reboot.c (STR32, STR128): New macros.
	(main): Add more checks.

2018-01-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: use sprintrc in reboot.test.
	* test/reboot.c (main): Use sprintrc instead of old-style manual
	printing of return code.

2018-01-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	reboot.c: limit printing of the fourth argument to 255 bytes.
	The size of kernel buffer is 256 bytes and the last byte is always zero.

	* reboot.c (SYS_FUNC(reboot)): Replace printstr call with printstr_ex
	with size of 255 and style flag QUOTE_0_TERMINATED.

2018-01-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	reboot.c: use printxval instead of printflags.
	Numeric arguments of reboot syscall are not flags but magic values.

	* reboot.c (SYS_FUNC(reboot)): Replace printflags with printxval.

2018-01-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Search for <libiberty/demangle.h> in addition to <demangle.h>
	This is the location where this header is installed on Debian-based
	systems.

	* configure.ac: Check for libiberty/demangle.h in addition to
	demangle.h.
	* unwind.c [USE_DEMANGLE]: Include either <demangle.h> or
	<libiberty_demangle.h> based on the presence of HAVE_DEMANGLE_H and
	HAVE_LIBIBERTY_DEMANGLE_H macros.

2018-01-11  Dmitry V. Levin  <ldv@altlinux.org>

	strace.1: fix typo.
	* strace.1.in (.SH NOTES): Replace prlimit with prlimit64.

2018-01-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Document multiple personalities support.
	* strace.1.in (.SH "MULTIPLE PERSONALITY SUPPORT"): New section.

	Add indication of mpers support to strace -V output.
	* strace.c (print_version): Append information about m32 and mx32
	decoding support.
	* tests/strace-V.test: Update expected output.

	Provide strace's native arch to the test framework.
	* configure.ac (arch_native): New variable, set to arch.
	* tests/Makefile.am (NATIVE_ARCH): New variable, set to @arch_native@.
	(AM_TEST_LOG_FLAGS): Pass NATIVE_ARCH as STRACE_NATIVE_ARCH environment
	variable.

	Add indication of optional demangle feature strace -V output.
	* strace.c (print_version) [USE_DEMANGLE]: Append " stack-demangle"
	to the features string.
	* tests/strace-V.test: Update expected output.

	configure.ac: check for mpers support on RISC-V.
	* confgure.ac (st_MPERS([m32])): Add riscv.

2018-01-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Use xappendstr instead of xsnprintf where suitable.
	Replace occurrences of

	    outptr += xsnprintf(outptr, sizeof(outstr) - (outptr - outstr), ...)

	with much more sleek

	    outptr = xappendstr(outstr, outptr, ...)

	* desc.c (decode_select): Replace xsnprintf with xappendstr.
	* open.c (sprint_open_modes): Likewise.
	* poll.c (decode_poll_exiting): Likewise.
	* signal.c (sprintsigmask_n): Likewise.
	* xlat.c (sprintflags): Likewise.

2018-01-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xstring.h: add xappendstr.
	Introduce a macro for handling common case of partial writes
	to a character array.

	* xstring.h (get_pos_diff_): New function.
	(xappendstr): New macro.

2018-01-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update perf-related flags.
	 - PERF_SAMPLE_BRANCH_TYPE_SAVE, added in v4.14-rc1~173^2~33^2~6
	 - PERF_SAMPLE_PHYS_ADDR, added in v4.14-rc1~173^2~2

	* xlat/perf_branch_sample_type.in (PERF_SAMPLE_BRANCH_TYPE_SAVE): New
	flag.
	* xlat/perf_event_sample_format.in (PERF_SAMPLE_PHYS_ADDR): Likewise.
	* tests/perf_event_open.c: Update expected output.

2018-01-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	perf.c: add support for struct perf_event_attr.namespaces.
	This field was introduced by linux kernel commit v4.12-rc1~152^2~42^2~10.

	* configure.ac (AC_CHECK_MEMBERS): Add  perf_event_attr.namespaces.
	* perf_event_struct.h (struct perf_event_attr): Add namespaces field.
	* perf.c (print_perf_event_attr): Print namespaces field.
	Update comment for __reserved_1 field.
	* tests/perf_event_open.c (struct pea_flags): Add namespaces field.
	(print_event_attr): Update expected output.

2018-01-11  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of [gs]et_thread_area syscalls on x86.
	* tests/xet_thread_area_x86.c: New file.
	* tests/xet_thread_area_x86.test: New test.
	* tests/Makefile.am (DECODER_TESTS): Add it.
	* tests/.gitignore: Add xet_thread_area_x86.
	* tests/pure_executables.list: Likewise.

2018-01-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of modify_ldt with for 4-byte-available user_desc.
	Since there is possibility now that strace read only entry_number field
	of the user_desc struct, let's check that it doesn't do it with
	modify_ldt syscall.

	* tests/modify_ldt.c (main): Add 4-byte-sized tail_alloc'ed variable.
	Try to provide it as an argument to modify_ldt.

2018-01-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Allow separate printing of struct user_desc.entry_number.
	Kernel reads only entry_number field in the beginning of the
	get_thread_area syscall handler.  Let's replicate this behaviour.

	* defs.h (enum user_desc_print_filter): New enumeration.
	(print_user_desc): Add an argument for signalling which part of the
	structure should be printed.
	* clone.c (print_tls_arg): Update print_user_desc call.
	* ldt.c (print_user_desc): Add filter argument.  Print entry_number on
	entering and the rest on exiting. Store entering value of the
	entry_number field in order to print the updated value in the impossible
	case of changed entry_number value.
	(SYS_FUNC(modify_ldt), SYS_FUNC(set_thread_area)): Update
	print_user_desc call.
	(SYS_FUNC(get_thread_area)): Call print_user_desc with
	USER_DESC_ENTERING format argument on entering and with
	USER_DESC_EXITING on exiting.

2018-01-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: move struct user_desc printing function into a separate file.
	As part of preparation for the introduction of [gs]et_thread_area test.

	* tests/modify_ldt.c (print_user_desc): Move it ...
	* tests/print_user_desc.c: ... to new file.
	* tests/Makefile.am (EXTRA_DIST): Add print_user_desc.c.

2018-01-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of modify_ldt syscall.
	* tests/modify_ldt.c: New file.
	* tests/gen_tests.in: Add modify_ldt test.
	* tests/pure_executables.list: Add modify_ldt.
	* tests/.gitignore: Likewise.

	ldt.c: manually set modify_ldt's error code.
	* ldt.c (modify_ldt): Move parsing under entering(tcp). Check whether
	return code is erroneous and set tcp->u_error appropriately along with
	RVAL_PRINT_ERR_VAL flag.

2018-01-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	syscall.c: add support for printing return value and error code.
	Some weird syscalls (like modify_ldt) return value that doesn't indicate
	an error (less than -4096), but it is, in fact, erroneous (because they
	decide to clip the return value to 32-bit, for example).

	Add a flag to print decoded error code along with syscall return value.

	* defs.h (RVAL_PRINT_ERR_VAL): New rval flag.
	* syscall.c (syscall_exiting_trace): Handle it.

2018-01-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ldt.c: print the first argument of modify_ldt as int.
	* ldt.c (SYS_FUNC(modify_ldt)): Print the first argument as %d.

	ldt.c: print lm field for 64-bit tracees.
	* configure.ac (AC_CHECK_MEMBERS): Add struct user_desc.lm.
	* ldt.c (print_user_desc) [HAVE_STRUCT_USER_DESC_LM]: Print lm field
	for non-compat tracees (it is ignored for compat ones).

2018-01-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ldt.c: make struct user_desc output more structured.
	Also, while we are here, let's fix print qualifiers (which should be %u
	and not %d).

	* ldt.c (print_user_desc): Use PRINT_FIELD_* macros for printing
	structure.
	(SYS_FUNC(set_thread_area)): Change field key-value separator from ":"
	to "=", change print format qualifier from %d to %u.

2018-01-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	print_fields.h: add PRINT_FIELD_U_CAST.
	Add a macro for printing fields explicitly casted to specific type.
	This is useful for bit fields, as otherwise the magic of *_extend_to_*
	macros breaks.

	* print_field.h (PRINT_FIELD_U_CAST): New macro.

2018-01-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	print_fields.h: rename PRINT_FIELD_UID to PRINT_FIELD_ID.
	As uid is not the only thing that has a special treatment of the -1
	value (and, as a result, needs special care), let's rename
	PRINT_FIELD_UID to PRINT_FIELD_ID and make PRINT_FIELD_UID its alias.

	* print_fields.h (PRINT_FIELD_ID): Rename from PRINT_FIELD_UID.
	(PRINT_FIELD_UID): Define to PRINT_FIELD_ID.

2018-01-07  Dmitry V. Levin  <ldv@altlinux.org>

	Fix build on systems without linux/genetlink.h.
	* socketutils.c [!HAVE_LINUX_GENETLINK_H] (genl_families_xlat): Add
	tcp argument.

	Fixes: v4.20-134-gc46fefc ("Add tcp arguments to netlink calls")

2018-01-07  Eugene Syromyatnikov  <evgsyr@gmail.com>

	count.c: whitespace.

	count.c: cleanup types and sizeof usage.
	* count.c (call_summary_pers): Change the type of sorted_count
	to "unsigned int *".  Replace sizeof(int) with  sizeof(sorted_count[0]).
	Change the type of idx to unsigned int.

2018-01-07  Eugene Syromyatnikov  <evgsyr@gmail.com>

	count.c: collect definitions of format strings in one place.
	In an attempt to make it more readable.

	* count.c (call_summary_pers): Put all format strings in static
	constants. Use them.

2018-01-07  Eugene Syromiatnikov  <esyr@redhat.com>

	Add tcp arguments to netlink calls.
	Since they call tracee-specific socket/sendmsg/recvmsg, we'd like to
	pass tcp there.

	* defs.h (genl_families_xlat): Add tcp argument.
	* netlink.c (decode_nlmsg_type_default, decode_nlmsg_type_generic,
	decode_nlmsg_type_netfilter, typedef nlmsg_types_decoder_t): Likewise.
	(decode_nlmsg_type): Add tcp argument. Pass tcp to decoder call.
	(print_nlmsghdr): Pass tcp to the decode_nlmsg_type call.
	* socketutils.c (send_query, receive_responses): Add tcp argument.
	(inet_send_query, unix_send_query, netlink_send_query, ): Add tcp argument.
	Pass tcp to the send_query call.
	(unix_get): Add tcp argument. Pass tcp to the unix_send_query and
	receive_responses calls.
	(inet_get): Add tcp argument. Pass tcp to the inet_send_query and
	receive_responses calls.
	(tcp_v4_get, udp_v4_get, tcp_v6_get, udp_v6_get): Add tcp argument. Pass
	tcp to the inet_get call.
	(netlink_get): Add tcp argument. Pass tcp to the netlink_send_query and
	receive_responses calls.
	(protocols): Add tcp argument to the get field.
	(get_sockaddr_by_inode_uncached): Add tcp argument. Pass tcp to
	the protocols[].get calls.
	(print_sockaddr_by_inode_uncached): Add tcp argument. Pass tcp to
	the get_sockaddr_by_inode_uncached call.
	(get_sockaddr_by_inode): Pass tcp to the get_sockaddr_by_inode_uncached
	call.
	(print_sockaddr_by_inode): Pass tcp to the
	print_sockaddr_by_inode_uncached call.
	(genl_send_dump_families): Add tcp argument. Pass tcp to the send_query
	call.
	(genl_families_xlat): Add tcp argument. Pass tcp to the
	genl_send_dump_families and receive_responses calls.

2018-01-07  Eugene Syromiatnikov  <esyr@redhat.com>

	Add tcp argument to clear_regs.
	* defs.h (clear_regs): Add argument struct tcb *tcp.
	* syscall.c (clear_regs): Likewise.
	* strace.c (next_event): Pass tcp to clear_regs() call.

2018-01-07  Eugene Syromiatnikov  <esyr@redhat.com>

	Pass tcp argument to get_optmem_max/read_int_from_file.
	In preparation to passing tcp to all tracee-related syscalls.

	* defs.h (read_int_from_file): Add "struct tcb *" as the first argument.
	* util.c (read_int_from_file): Likewise.
	* msghdr.c (get_optmem_max): Add "struct tcb *tcp" as the first
	argument, pass it to read_int_from_file call.
	(decode_msg_control): Pass tcp to get_optmem_max.

2018-01-07  Eugene Syromiatnikov  <esyr@redhat.com>

	Include paths.h if it is available.
	Use the OS definition of _PATH_BSHELL macro if it is available.

	* configure.ac (AC_CHECK_HEADERS): Add paths.h.
	* strace.c [HAVE_PATHS_H]: Include paths.h.

2018-01-07  Eugene Syromiatnikov  <esyr@redhat.com>

	strace.c: avoid duplication of a format string in attach_tcb.
	* strace.c (attach_tcb): Add task_path variable with the output format.
	Use it for the procdir declaration and xsprintf format string argument.

2018-01-07  Elvira Khabirova  <lineprinter@altlinux.org>

	Move syscall_tampered to defs.h.
	* syscall.c (syscall_tampered): Move ...
	* defs.h: ... here.

2018-01-07  Elvira Khabirova  <lineprinter@altlinux.org>

	strace.c: rename set_sigaction to set_sighandler.
	Since set_sigaction() actually specifies sa_handler and not sa_sigaction,
	rename set_sigaction() to set_sighandler() for future definition of
	set_sigaction() function as specifying sa_sigaction.

	* strace.c (set_sigaction): Rename to set_sighandler.
	All callers updated.

2018-01-07  Elvira Khabirova  <lineprinter@altlinux.org>

	.gitignore: ignore "gnu" directory created by st_MPERS m4 macro.

	Update .mailmap.
	* .mailmap (Elvira Khabirova): Add @altlinux.org.

2018-01-07  Chen Jingpiao  <chenjingpiao@gmail.com>

	.mailmap: add canonical name for Chen Jingpiao.
	* .mailmap: Add canonical name for Chen Jingpiao.

2018-01-07  Dmitry V. Levin  <ldv@altlinux.org>

	personality.c: use sprintxval.
	* personality.c (SYS_FUNC(personality)): Use sprintxval instead of local
	implementation.

2018-01-07  Eugene Syromiatnikov  <esyr@redhat.com>

	xlat.c: add sprintxval for printing xval to string.
	* defs.h (sprintxval): New declaration.
	(sprintxval): New function.

2018-01-07  Dmitry V. Levin  <ldv@altlinux.org>

	desc.c: use xsnprintf instead of sprintf.
	* desc.c: Include "xstring.h".
	(decode_select): Replace sprintf with xsnprintf.

	xlat.c: use xsnprintf instead of sprintf.
	* xlat.c: Include "xstring.h".
	(sprintflags): Replace sprintf with xsnprintf.

	open.c: use xsnprintf instead of sprintf.
	* open.c: Include "xstring.h".
	(sprint_open_modes): Replace sprintf with xsnprintf.

	poll.c: use xs*printf instead of sprintf.
	* poll.c: Include "xstring.h".
	(decode_poll_exiting): Replace sprintf with xsnprintf and xsprintf.

	signal.c: use xs*printf instead of sprintf.
	* signal.c: Include "xstring.h".
	(signame): Replace sprintf with xsprintf.
	(sprintsigmask_n): Replace sprintf with xsnprintf.

	print_timeval.c: use xsprintf instead of snprintf.
	* print_timeval.c: Include "xstring.h".
	(sprint_timeval, sprint_timeval32): Replace snprintf with xsprintf.

	print_timespec.c: use xsprintf instead of snprintf.
	* print_timespec.c: Include "xstring.h".
	(sprint_timespec): Replace snprintf with xsprintf.

	mmsghdr.c: use xsprintf instead of snprintf.
	* mmsghdr.c: Include "xstring.h".
	(SYS_FUNC(recvmmsg)): Replace snprintf with xsprintf.

	socketutils.c: use xsprintf instead of snprintf.
	* socketutils.c: Include "xstring.h".
	(unix_parse_response): Replace snprintf with xsprintf.

	alpha.c: use xsprintf instead of snprintf.
	* alpha.c: Include "xstring.h".
	(decode_getxxid): Replace snprintf with xsprintf.

	v4l2.c: use xsprintf instead of sprintf.
	* v4l2.c: Include "xstring.h".
	(print_v4l2_create_buffers): Replace sprintf with xsprintf.

	util.c: use x*sprintf instead of s*printf.
	* util.c: Include "xstring.h".
	(sprinttime_ex): Replace snprintf with xsnprintf.
	(getfdproto): Replace sprintf with xsprintf.

	unwind.c: use xsprintf instead of sprintf.
	* unwind.c: Include "xstring.h".
	(build_mmap_cache): Replace sprintf with xsprintf.

	syscall.c: use xsprintf instead of sprintf.
	* syscall.c: Include "xstring.h".
	(get_scno): Replace sprintf with xsprintf.

	resource.c: use xsprintf instead of sprintf.
	* resource.c: Include "xstring.h".
	(sprint_rlim64, sprint_rlim32): Replace sprintf with xsprintf.

	pathtrace.c: use xsprintf instead of sprintf.
	* pathtrace.c: Include "xstring.h".
	(getfdpath): Replace sprintf with xsprintf.

2018-01-07  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ldt.c: replace sprintf with xsprintf.
	* ldt.c: Include "xstring.h".
	(SYS_FUNC(set_thread_area)): Replace sprintf with xsprintf.

2018-01-05  Dmitry V. Levin  <ldv@altlinux.org>

	strace.c: use xsprintf instead of sprintf.
	* strace.c: Include "xstring.h".
	(strerror, newoutf, attach_tcb, print_debug_info): Replace sprintf
	with xsprintf.

2018-01-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ioprio.c: use xsprintf instead of sprintf.
	* ioprio.c: Include "xstring.h".
	(sprint_ioprio): Replace sprintf with xsprintf.

2018-01-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Introduce hardened xsprintf/xsnprintf macros.
	Let's try to future/fool-proof code a bit by introducing variants
	of sprintf/snprintf that die if an overflow (or an error) occurs.
	They are deemed to be the default choice for printing to some local
	string buffer where no sensible error handling is implemented.

	* xstring.h: New file.
	* Makefile.am (strace_SOURCES): Add it.

2018-01-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	count.c: use %9.u conversion specification.
	Instead of printing to a temporary string.  This also fixes a subtle bug
	when the output for a billion errors and more is cut and shown
	incorrectly.

	* count.c (struct call_counts): Change type of calls and errors fields
	to unsigned int since they are used and printed as unsigned anyway.
	(call_summary_pers): Remove error_str.  Print cc->errors
	and error_cum using %9.u conversion specification.

2018-01-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	count.c: use personality_names in call_summary report caption.
	Otherwise the title is quite misleading for x32 personality.

	* count.c (call_summary): Use personality_names.

2018-01-05  Victor Krapivensky  <krapivenskiy.va@phystech.edu>

	Move personality names to a global variable.
	This is a part of "Prepare for adding support for Lua scripting"
	commit.

	* defs.h (personality_names): New external constant declaration.
	* syscall.c: (personality_names): New global variable.
	(update_personality): Use personality_names for reporting personality
	name.

	Co-Authored-by: Eugene Syromyatnikov <evgsyr@gmail.com>

2018-01-04  Lubomir Rintel  <lkundrak@v3.sk>

	strace.spec.in: include Bluetooth headers for AF_BLUETOOTH sockets decoding
	* strace.spec.in (BuildRequires): Add pkgconfig(bluez).

2018-01-04  Dmitry V. Levin  <ldv@altlinux.org>

	Lift artificial limit on output file names in -ff mode.
	Starting with commit v4.5.19~88 strace imposed an artificial limit
	on output file names in -ff mode, leading to the following absurd
	behaviour:

	$ strace -ff -o"$(perl -e 'print "/" x 510')/$PWD/log" /bin/true
	strace: Can't fopen ' .12345': Permission denied

	* strace.c (newoutf): Raise buffer size to PATH_MAX.
	(init) <followfork >= 2>: Check output file name prefix length.
	* tests/options-syntax.test: Check it.

2018-01-04  Dmitry V. Levin  <ldv@altlinux.org>

	configure.ac: fix typo.
	* configure.ac: Replace CPPFALGS with CPPFLAGS.

	Fixes: v4.20-85-gf9c8e8a ("unwind: demangle symbol names")

2018-01-03  Eugene Syromiatnikov  <esyr@redhat.com>

	Change the first argument of upeek from pid to tcp.
	All users were changed automatically by:

		for i in `git grep -l 'upeek(tcp->pid'`; do \
			sed -i 's/upeek(tcp->pid/upeek(tcp/g' "$i"; \
		done

	* upeek.c (upeek): Change the first argument from pid_t pid to struct
	tcb *tcp. Use tcp->pid instead of pid in the function's body.
	* defs.h (upeek): Update declaration.
	* linux/alpha/arch_getrval2.c: Pass tcp instead of tcp->pid to the
	upeek calls.
	* linux/alpha/arch_rt_sigframe.c: Likewise.
	* linux/alpha/arch_sigreturn.c: Likewise.
	* linux/alpha/get_scno.c: Likewise.
	* linux/alpha/get_syscall_args.c: Likewise.
	* linux/alpha/get_syscall_result.c: Likewise.
	* linux/bfin/arch_rt_sigframe.c: Likewise.
	* linux/bfin/get_scno.c: Likewise.
	* linux/bfin/get_syscall_args.c: Likewise.
	* linux/bfin/get_syscall_result.c: Likewise.
	* linux/crisv10/arch_rt_sigframe.c: Likewise.
	* linux/crisv10/get_scno.c: Likewise.
	* linux/crisv10/get_syscall_args.c: Likewise.
	* linux/crisv10/get_syscall_result.c: Likewise.
	* linux/hppa/arch_rt_sigframe.c: Likewise.
	* linux/hppa/get_scno.c: Likewise.
	* linux/hppa/get_syscall_args.c: Likewise.
	* linux/hppa/get_syscall_result.c: Likewise.
	* linux/microblaze/arch_rt_sigframe.c: Likewise.
	* linux/microblaze/arch_sigreturn.c: Likewise.
	* linux/microblaze/get_scno.c: Likewise.
	* linux/microblaze/get_syscall_args.c: Likewise.
	* linux/microblaze/get_syscall_result.c: Likewise.
	* linux/powerpc/getregs_old.c: Likewise.
	* linux/sh/arch_getrval2.c: Likewise.
	* linux/sh/arch_rt_sigframe.c: Likewise.
	* linux/sh/get_scno.c: Likewise.
	* linux/sh/get_syscall_args.c: Likewise.
	* linux/sh/get_syscall_result.c: Likewise.
	* linux/sh64/get_scno.c: Likewise.
	* linux/sh64/get_syscall_args.c: Likewise.
	* linux/sh64/get_syscall_result.c: Likewise.
	* linux/xtensa/arch_rt_sigframe.c: Likewise.
	* linux/xtensa/get_scno.c: Likewise.
	* linux/xtensa/get_syscall_args.c: Likewise.
	* linux/xtensa/get_syscall_result.c: Likewise.
	* syscall.c: Likewise.

2018-01-03  Eugene Syromiatnikov  <esyr@redhat.com>

	Change argument of getregs_old from pid to tcp.
	* linux/powerpc/getregs_old.c (getregs_old): Change the first argument
	from pid_t pid to struct tcb *tcp. Replace all instances of pid with
	tcp->pid.
	* linux/x86_64/getregs_old.c (getregs_old): Likewise.
	* linux/x86_64/getregs_old.h (getregs_old): Update declaration.
	* syscall.c (get_regs) [HAVE_GETREGS_OLD]: Pass tcp to the getregs_old
	call instead of tcp->pid.

2018-01-03  Eugene Syromiatnikov  <esyr@redhat.com>

	Change the first argument of upoke from pid to tcp.
	Users were updated automatically by:

		for i in `git grep -l 'upoke(tcp->pid'`; do \
			sed -i 's/upoke(tcp->pid/upoke(tcp/g' "$i"; \
		done

	* upoke.c (upoke): Change the first argument from pid_t pid to struct
	tcb *tcp. Use tcp->pid instead of pid in the function's body.
	* defs.h (upoke): Update declaration.
	* linux/alpha/set_error.c (arch_set_error, arch_set_success): Provide
	tcp in the first argument of the upoke call instead of tcp->pid.
	* linux/alpha/set_scno.c (arch_set_scno): Likewise.
	* linux/bfin/set_error.c (arch_set_error, arch_set_success): Likewise.
	* linux/bfin/set_scno.c (arch_set_scno): Likewise.
	* linux/crisv10/set_error.c (arch_set_error, arch_set_success):
	Likewise.
	* linux/crisv10/set_scno.c (arch_set_scno): Likewise.
	* linux/hppa/set_error.c (arch_set_error, arch_set_success): Likewise.
	* linux/hppa/set_scno.c (arch_set_scno): Likewise.
	* linux/i386/set_error.c (arch_set_error, arch_set_success): Likewise.
	* linux/i386/set_scno.c (arch_set_scno): Likewise.
	* linux/microblaze/set_error.c (arch_set_error, arch_set_success):
	Likewise.
	* linux/microblaze/set_scno.c (arch_set_scno): Likewise.
	* linux/powerpc/set_error.c (arch_set_error, arch_set_success):
	Likewise.
	* linux/powerpc/set_scno.c (arch_set_scno): Likewise.
	* linux/sh/set_error.c (arch_set_error, arch_set_success): Likewise.
	* linux/sh/set_scno.c (arch_set_scno): Likewise.
	* linux/sh64/set_error.c (arch_set_error, arch_set_success): Likewise.
	* linux/sh64/set_scno.c (arch_set_scno): Likewise.
	* linux/x86_64/set_error.c (arch_set_error, arch_set_success): Likewise.
	* linux/x86_64/set_scno.c (arch_set_scno): Likewise.
	* linux/xtensa/set_error.c (arch_set_error, arch_set_success): Likewise.
	* linux/xtensa/set_scno.c (arch_set_scno): Likewise.

2018-01-03  Eugene Syromiatnikov  <esyr@redhat.com>

	Move enum trace_event into a separate header.
	As it will have users outside strace.c in the future.

	* trace_event.h (enum trace_event): Move it from...
	* strace.c (enum trace_event): ...here.
	(#include "trace_event.h"): New header, for enum trace_event.
	* Makefile.am (strace_SOURCES): Add trace_event.h.

2018-01-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Call get_scno during startup_tcb only for forcibly attached processes.
	Otherwise it makes little sense on most arches to try to get syscall
	number.

	* defs.h (TCB_GRABBED): New tcb flag.
	* strace.c (attach_tcb): Set TCB_GRABBED for the tcb.
	(startup_tcb): Call get_scno() only if process is grabbed and its
	registers may contain syscall number information.

	Reported-by: Dmitry V. Levin <ldv@altlinux.org>
	Closes: https://github.com/strace/strace/issues/22

2018-01-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.c: sort getopt switch branches alphabetically.
	There's no reason to have them out of order. This also (almost) matches
	their order in the getopt call argument, introduced in
	v4.20-64-g61c03be.

	* strace.c (init): Sort branches in the getopt switch routine.

2018-01-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.c: check for (non)zero argc instead of argv[0]
	Since we can never be sure that we have NULL behind the last entry of
	the argv array.

	* strace.c (init): Check for non-zero argc before/instead of argv[0].

2018-01-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1: advertise strace-log-merge.
	In order to raise awareness about strace-log-merge, mention it in
	SEE ALSO section and -ff option description.

	* strace.1.in (.SS Filtering) <.TP .B \-ff>: Mention strace-log-merge.
	(.SH "SEE ALSO"): Likewise.

2017-12-29  Dmitry V. Levin  <ldv@altlinux.org>

	unwind: demangle function arguments.
	* unwind.c (print_stack_frame): Specify demangling style.
	* tests/strace-k.test (result): Update regexp.
	* tests/strace-k-demangle.test (expected): Update expected output.

	tests: check strace -k symbol names demangling.
	* tests/strace-k-demangle.test: New test.
	* tests/stack-fcall-mangled.c: New file.
	* tests/stack-fcall-mangled-0.c: Likewise.
	* tests/stack-fcall-mangled-1.c: Likewise.
	* tests/stack-fcall-mangled-2.c: Likewise.
	* tests/stack-fcall-mangled-3.c: Likewise.
	* tests/stack-fcall.h [MANGLE] (f0, f1, f2, f3): New macros.
	* tests/.gitignore: Add stack-fcall-mangled.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(stack_fcall_mangled_SOURCES): New variable.
	(EXTRA_DIST): Add strace-k-demangle.test.
	[USE_LIBUNWIND && USE_DEMANGLE] (LIBUNWIND_TESTS): Likewise.

2017-12-29  Dmitry V. Levin  <ldv@altlinux.org>

	tests: parametrize strace-k.test.
	Prepare for the check of strace -k symbol names demangling.

	* tests/strace-k.test: Parametrize $test_prog and $expected.
	* tests/stack-fcall.h: New file.
	* tests/stack-fcall.c: Include "stack-fcall.h"
	* tests/stack-fcall-0.c: Likewise.
	* tests/stack-fcall-1.c: Likewise.
	* tests/stack-fcall-2.c: Likewise.
	* tests/stack-fcall-3.c: Likewise.
	* tests/Makefile.am (EXTRA_DIST): Add stack-fcall.h.

2017-12-26  Masatake YAMATO  <yamato@redhat.com>

	unwind: demangle symbol names.
	Implement demangling of C++ symbol names in stack trace
	using cplus_demangle function from GNU libiberty library.

	This is an example demangled stack trace output:

	fstat(5, {st_mode=S_IFREG|0664, st_size=0, ...}) = 0
	 > /usr/lib64/libc-2.25.so(__fxstat64+0x12) [0xffd62]
	 > /usr/lib64/libc-2.25.so(_IO_file_doallocate+0x5f) [0x717ff]
	 > /usr/lib64/libc-2.25.so(_IO_doallocbuf+0x79) [0x81699]
	 > /usr/lib64/libc-2.25.so(_IO_file_overflow+0x198) [0x807b8]
	 > /usr/lib64/libc-2.25.so(_IO_file_xsputn+0xbd) [0x7ed5d]
	 > /usr/lib64/libc-2.25.so(fwrite_unlocked+0x60) [0x7d800]
	 > /usr/lib64/libleveldb.so.1.18(leveldb::EnvWrapper::StartThread+0x3b6) [0x48656]
	 > /usr/lib64/libleveldb.so.1.18(leveldb::log::Writer::EmitPhysicalRecord+0x89) [0x28bc9]
	 > /usr/lib64/libleveldb.so.1.18(leveldb::log::Writer::AddRecord+0x9e) [0x28d9e]
	 > /usr/lib64/libleveldb.so.1.18(leveldb::DBImpl::Write+0x208) [0x1ce18]
	 > /usr/lib64/libleveldb.so.1.18(leveldb::DB::Put+0x59) [0x192b9]
	 > /usr/lib64/libleveldb.so.1.18(leveldb::DBImpl::Put+0x1d) [0x1931d]
	 > /home/yamato/var/leveldb/doc/a.out(main+0x120) [0x1107]
	 > /usr/lib64/libc-2.25.so(__libc_start_main+0xea) [0x2088a]
	 > /home/yamato/var/leveldb/doc/a.out(_start+0x2a) [0xf3a]

	* Makefile.am [USE_DEMANGLE] (strace_CPPFLAGS, strace_LDFLAGS,
	libiberty_LDADD): Append libiberty_CPPFLAGS, strace_LDFLAGS, and
	libiberty_LIBS, respectively.
	* configure.ac: Add --with-libiberty option.  Check cplus_demangle
	support in libiberty.
	* unwind.c [USE_DEMANGLE]: Include <demangle.h>.
	(print_stack_frame) [USE_DEMANGLE]: Use cplus_demangle.

2017-12-26  Masatake YAMATO  <yamato@redhat.com>

	Define macros for renaming xmalloc and xcalloc.
	I'm planning to link strace with libiberty for mangling C++
	symbol names in stack trace enabled with -k option.

	Both names, xmalloc and xcalloc, are already defined and used
	in libiberty, and they conflict with functions in strace.
	Rename xmalloc and xcalloc functions defined in strace
	to strace_xmalloc and strace_xcalloc, respectively,
	to avoid this conflict.

	* xmalloc.h (xcalloc, xmalloc): New macros.

2017-12-24  Dmitry V. Levin  <ldv@altlinux.org>

	syscall: move a sparc specific include to an arch specific file.
	* syscall.c [SPARC64]: Do not include <asm/psrcompat.h>.
	[SPARC]: Do not include <asm/psr.h>.
	* linux/sparc/get_error.c: Include <asm/psr.h>.

	syscall: move all ia64 specific includes to an arch specific file.
	* syscall.c [IA64]: Remove.
	* linux/ia64/get_syscall_args.c: Include <asm/rse.h>.

	syscall: simplify get_syscall_result.
	* syscall.c [ptrace_getregset_or_getregs] (get_syscall_result_regs):
	Define to get_regs.
	(get_syscall_result): Use get_syscall_result_regs unconditionally.

2017-12-24  Dmitry V. Levin  <ldv@altlinux.org>

	syscall: change get_regs argument type.
	This opens the way for future changes related to get_regs.

	* syscall.c (get_regs): Change argument type from "pid_t"
	to "struct tcb *", all callers changed.

2017-12-24  Dmitry V. Levin  <ldv@altlinux.org>

	syscall: move get_regs call from syscall_exiting_decode to get_syscall_result
	This make the code less confusing and opens the way for future changes
	related to get_regs.

	* syscall.c (syscall_exiting_decode): Move get_regs invocation ...
	(get_syscall_result) [ptrace_getregset_or_getregs]: ... here.

2017-12-24  Dmitry V. Levin  <ldv@altlinux.org>

	syscall: rework subcall decoding on mips o32.
	Move syscall subcall handling to the same switch statement that
	handles ipc and socket subcalls.

	* linux/mips/syscallent-o32.h [LINUX_MIPSO32] (SYS_syscall_subcall):
	Define.
	* syscall.c (decode_mips_subcall): Rename to decode_syscall_subcall,
	conditionalize on SYS_syscall_subcall instead of LINUX_MIPSO32.
	(syscall_entering_decode) [LINUX_MIPSO32]: Remove.
	(syscall_entering_decode) [SYS_syscall_subcall]: Handle SEN_syscall
	using decode_syscall_subcall.

2017-12-24  Dmitry V. Levin  <ldv@altlinux.org>

	syscall: tweak shuffle_scno ifdefery.
	* syscall.c (shuffle_scno): Check for ARM_FIRST_SHUFFLED_SYSCALL
	instead of ARM || AARCH64.  This does not result to any code change
	but looks more comprehensible.

	syscall: change get_regs to return an error code.
	* syscall.c (get_regs_error) [!ptrace_getregset_or_getregs]: Do not
	define.
	(clear_regs) [!ptrace_getregset_or_getregs]: Do not set get_regs_error.
	(get_regs) [ptrace_getregset_or_getregs]: Return get_regs_error, all
	callers changed to test get_regs return code instead of get_regs_error
	static variable, which is now internally used by get_regs() and
	clear_regs() only.
	(USE_GET_SYSCALL_RESULT_REGS): Do not define.
	Use "#ifndef ptrace_getregset_or_getregs"
	instead of "#ifdef USE_GET_SYSCALL_RESULT_REGS".

2017-12-24  Harsha Sharma  <harshasharmaiitr@gmail.com>

	tests: enhance run.sh usage error diagnostics.
	* tests/run.sh: Execute timeout command only when invoked with
	an argument, otherwise print an error message.

2017-12-23  Dmitry V. Levin  <ldv@altlinux.org>

	tests: skip nsyscalls-d.test on mips o32.
	On mips o32, nsyscalls test is implemented using syscall #4000,
	so nsyscalls-d cannot work there.

	* tests/nsyscalls-d.test: Skip on mips o32.

2017-12-23  Dmitry V. Levin  <ldv@altlinux.org>

	Remove linux/ptp_clock.h.
	As linux kernel provides a compatible linux/ptp_clock.h header since
	commit v3.8-rc1~139^2~514, there is no need for a local copy.

	* linux/ptp_clock.h: Remove.
	* Makefile.am (EXTRA_DIST): Remove it.
	* configure.ac (AC_CHECK_TYPES): Check for struct ptp_sys_offset
	in <linux/ptp_clock.h>.
	* ioctl.c (ioctl_decode) <case '='>: Conditionalize
	on [HAVE_STRUCT_PTP_SYS_OFFSET].
	* ptp.c: Likewise.

2017-12-23  Dmitry V. Levin  <ldv@altlinux.org>

	Remove linux/ubi-user.h.
	As linux kernel provides a compatible mtd/ubi-user.h header since
	commit v3.7-rc1~85^2~17, there is no need for a local copy.

	* linux/ubi-user.h: Remove.
	* Makefile.am (EXTRA_DIST): Remove it.
	* configure.ac (AC_CHECK_MEMBERS): Check
	for struct ubi_attach_req.max_beb_per1024 in <mtd/ubi-user.h>.
	* ioctl.c (ioctl_decode) <case 'o', case 'O'>: Conditionalize
	on HAVE_STRUCT_UBI_ATTACH_REQ_MAX_BEB_PER1024.
	* ubi.c: Likewise.

2017-12-23  Dmitry V. Levin  <ldv@altlinux.org>

	Remove linux/mtd-abi.h.
	As linux kernel provides a compatible mtd/mtd-abi.h header since
	commit v3.2-rc1~14^2~33, there is no need for a local copy.

	* linux/mtd-abi.h: Remove.
	* Makefile.am (EXTRA_DIST): Remove it.
	* configure.ac (AC_CHECK_TYPES): Check for struct mtd_write_req
	in <mtd/mtd-abi.h>.
	* ioctl.c (ioctl_decode) <case 'M'>: Conditionalize
	on [HAVE_STRUCT_MTD_WRITE_REQ].
	* mtd.c: Likewise.
	* tests/ioctl_mtd.c: Likewise.
	* tests/ioctl.c (main): Likewise.

2017-12-23  Dmitry V. Levin  <ldv@altlinux.org>

	Remove linux/personality.h.
	* linux/personality.h: Remove.
	* Makefile.am (EXTRA_DIST): Remove it.
	* personality.c: Do not include <linux/personality.h>, include
	"xlat/personality_flags.h" before "xlat/personality_types.h".
	* xlat/personality_flags.in: Provide fallback definitions.
	* xlat/personality_types.in: Likewise.

2017-12-23  Dmitry V. Levin  <ldv@altlinux.org>

	travis: switch from clang-3.8 to clang.
	As travis provides a relatively fresh clang by default nowadays,
	it makes sense to use default clang in clang-based test builds.

	* .travis.yml (matrix): Change clang-3.8 to clang.

2017-12-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1.in: mention perf and ftrace in SEE ALSO.
	* strace.1.in (.SH SEE ALSO): Add references to perf-trace(1) and
	trace-cmd(1).

	strace.1.in: clarify -F option behaviour.
	* strace.1.in <.TP \-F>: Extend deprecation warning.  Describe behaviour
	of multiple instances of -F and interoperability of -F and -f.

2017-12-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: consistently use $STRACE_EXE instead of local alternatives.
	* tests/get_regs.test: Replace "${STRACE##* }" with "$STRACE_EXE".
	* tests/options-syntax.test: Replace "$strace_exp" with "$STRACE_EXE".
	* tests/syntax.sh: Likewise.

2017-12-20  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	strace.c: inform the user about -F option obsolescence.
	* strace.c (init): Print an error message if the option is used.

2017-12-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.c: sort option arguments alphabetically.
	Except for the ones that enabled by configure options.

	While we are here, let's also change the indentation of while expression
	continuation in order to separate it from the following switch clause.

	* strace.c (init): Reorder options in getopt() call.

2017-12-20  Eugene Syromiatnikov  <esyr@redhat.com>

	strace.c: use _exit() instead of exit() in child's die()
	Let's keep child's death routine as minimalistic as possible for the
	cases when vfork() is used instead of fork() on systems that lack MMU.

	* strace.c (die) <!(strace_tracer_pid == getpid())>: Call _exit().

2017-12-20  Harsha Sharma  <harshasharmaiitr@gmail.com>

	syscall: replace if (debug_flag) ... with debug_msg macro.
	* syscall.c (get_scno): Use debug_msg instead of
	"if (debug_flag) error_msg".

2017-12-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check (some) debugging output generated during nsyscalls test.
	* tests/nsyscalls-d.c: New file.
	* tests/.gitignore: Add it.
	* tests/nsyscalls-d.test: New test, variant of nsyscalls.test with debug
	output check.
	* tests/nsyscalls-nd.test: Likewise.
	* tests/nsyscalls.c: Add expected debug output.
	* tests/Makefile.am (check_PROGRAMS): Add nsyscalls-d.
	(DECODER_TESTS): Add nsyscalls-d.test and nsyscalls-nd.test.

2017-12-20  Eugene Syromiatnikov  <esyr@redhat.com>

	pathtrace.c: use xgrowarray.
	* defs.h <struct path_set>: Change type of num_selected field to size_t.
	Add size field.
	* pathtrace.c (storepath): Rewrite to utilise xgrowarray.

2017-12-14  Dmitry V. Levin  <ldv@altlinux.org>

	dyxlat: use xgrowarray.
	* dyxlat.c (dyxlat_alloc): Use xgrowarray instead of xcalloc.
	(dyxlat_add_pair): Use xgrowarray instead of xreallocarray.

	unwind: use xgrowarray.
	* unwind.c (get_symbol_name): Use xgrowarray instead of manual
	dynamic array management using xreallocarray.

2017-12-14  Eugene Syromiatnikov  <esyr@redhat.com>

	strace.c: use xgrowarray.
	* strace.c (tcbtabsize): Change type to size_t.
	(expand_tcbtab): Rewrite in order to utilise xgrowarray
	instead of manual dynamic array management.

	unwind: use xgrowarray.
	* unwind.c (build_mmap_cache): Use xgrowarray instead of manual dynamic
	array management.

2017-12-14  Eugene Syromiatnikov  <esyr@redhat.com>

	xmalloc.c: introduce xgrowarray helper function.
	In order to simplify dynamic array management code.

	* xmalloc.h (xgrowarray): New declaration.
	* xmalloc.c (xgrowarray): New function.

2017-12-14  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check error diagnostics when exec file name is too long.
	* tests/options-syntax.test: Check error diagnostics when
	exec file name length equals to PATH_MAX.

2017-12-13  Eugene Syromiatnikov  <esyr@redhat.com>

	strace.c: minor style fixes.
	* strace.c (test_ptrace_seize): Remove excess braces.
	(init): Wrap overly long string literal.  Add braces
	to the else if branch.

2017-12-13  Eugene Syromiatnikov  <esyr@redhat.com>

	strace.c: use *_func_* message printing macros where appropriate.
	In order to provide some additional bits of information in weird error
	cases or just replace existing usages of __func__/literal function name.

	* strace.c (detach): Use perror_func_msg() instead of perror_msg().
	(startup_attach, open_dummy_desc, startup_child, test_ptrace_seize): Use
	perror_func_msg_and_die() instead of perror_msg_and_die().
	(test_ptrace_seize): Use error_func_msg_and_die() instead of
	error_msg_and_die().

2017-12-13  Eugene Syromiatnikov  <esyr@redhat.com>

	unwind.c: more verbose mapping overlapping diagnostic message.
	* unwind.c (build_mmap_cache): Change error_msg() to debug_msg(), add
	information about region names and the respective start and end
	addresses.

2017-12-13  Eugene Syromiatnikov  <esyr@redhat.com>

	unwind.c: non-fatal handling of asprintf error.
	An error returned by asprintf is a poor excuse for dying.

	* unwind.c (asprintf_error_str): New string constant.
	(sprint_call_or_error): Replace error_msg_and_die() with
	perror_func_msg() and usage of asprintf_error_str for a return value.
	(queue_print): Free tmp->output line only if it is not
	asprintf_error_str.

2017-12-13  Eugene Syromiatnikov  <esyr@redhat.com>

	unwind.c: eliminate DPRINTF.
	Since DPRINTF is simply a macro that provides debugging information
	along with some information about printing routine call site, now standard
	debug_func_* macros are deemed to be a suitable replacement.

	* unwind.c (DPRINTF): Remove.
	(build_mmap_cache, delete_mmap_cache, unwind_cache_invalidate,
	unwind_print_stacktrace, unwind_captiure_stacktrace): Replace
	DPRINTF(fmt, str, ...) with debug_func_msg(fmt, ...)/

2017-12-13  Eugene Syromiatnikov  <esyr@redhat.com>

	strace.c: replace if (debug_flag) ... with suitable debug printing macros
	* strace.c (alloc_tcb, droptcb, detach, attach_tcb, test_ptrace_seize,
	init, startup_tcb): Replace if (debug_flag) error_msg(...) occurrences
	with debug_error_msg(...).
	(attach_tcb): Replace if (debug_flag) perror_msg(...) with
	debug_perror_msg(...).
	(cleanup, startup_tcb): Replace if (debug_flag) error_msg(...)
	occurrences with debug_func_msg() in attempt to provide additional
	information.

2017-12-13  Eugene Syromiatnikov  <esyr@redhat.com>

	error_prints.h: add *_func_* printing macros.
	In order to reduce boilerplate for the cases when __func__ is desired
	to be printed.

	* error_prints.h (error_func_msg, perror_func_msg, debug_func_msg,
	debug_func_perror_msg, error_func_msg_and_die, perror_func_msg_and_die):
	New macro definitions.

2017-12-13  Eugene Syromiatnikov  <esyr@redhat.com>

	error_prints.h: add debug print macros.
	* defs.h (debug_flag): Move the declaration...
	* error_prints.h (debug_flag): ... here.
	(debug_msg, debug_perror_msg): New macro definitions.
	Include <stdbool.h> for the debug_flag declaration.

2017-12-04  Masatake YAMATO  <yamato@redhat.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of KVM ioctl commands.
	* tests/ioctl_kvm_run.c: New file.
	* tests/ioctl_kvm_run.test: New test.
	* tests/Makefile.am (DECODER_TESTS): Add ioctl_kvm_run.test.
	* tests/pure_executables.list: Add ioctl_kvm_run.
	* tests/.gitignore: Likewise.

2017-12-04  Masatake YAMATO  <yamato@redhat.com>

	kvm: decode the argument of KVM_{SET, GET}_SREGS ioctl command.
	* configure.ac (AC_CHECK_TYPES): Add struct kvm_sregs.
	* kvm.c [HAVE_STRUCT_KVM_SREGS] (kvm_ioctl_decode_sregs): New function.
	(kvm_ioctl) [HAVE_STRUCT_KVM_SREGS] <KVM_SET_SREGS, KVM_GET_SREGS>:
	Use it.
	* linux/arch_kvm.c (arch_print_kvm_sregs): New function.
	* linux/x86_64/arch_kvm.c (PRINT_FIELD_KVM_SREGS_STRUCT): New macro.
	(kvm_ioctl_decode_regs_dtable, kvm_ioctl_decode_regs_segment,
	arch_print_kvm_sregs): New functions.

	kvm: decode the argument of KVM_{SET, GET}_REGS ioctl command.
	* configure.ac (AC_CHECK_TYPES): Add struct kvm_regs.
	* linux/arck_kvm.c: New file.
	* linux/x86_64/arch_kvm.c: Likewise.
	* linux/i386/arch_kvm.c: Likewise.
	* linux/x32/arch_kvm.c: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.
	* kvm.c: Include "arch_kvm.c".
	[HAVE_STRUCT_KVM_REGS] (kvm_ioctl_decode_regs): New function.
	(kvm_ioctl) [HAVE_STRUCT_KVM_REGS] <KVM_SET_REGS, KVM_GET_REGS>: Use it.

	kvm: decode the argument of KVM_SET_USER_MEMORY_REGION ioctl command.
	* configure.ac (AC_CHECK_TYPES): Add struct kvm_userspace_memory_region.
	* xlat/kvm_mem_flags.in: New file.
	* kvm.c: Include print_fields.h.
	[HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION]: Include xlat/kvm_mem_flags.h,
	(kvm_ioctl_set_user_memory_region): New function.
	(kvm_ioctl) [HAVE_STRUCT_KVM_USERSPACE_MEMORY_REGION]
	<KVM_SET_USER_MEMORY_REGION>: Use it.

2017-12-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add strace mascot.
	* strace.svg: New file.

	Co-Authored-by: Vitaly Chaykovsky <mgspeker@gmail.com>

2017-12-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify attach-p-cmd.test against buggy kernels.
	From time to time various kernels, old and new, just go nuts
	and fail attach-p-cmd.test with the following diagnostics:

	 12345 --- SIGALRM {si_signo=SIGALRM, si_code=SI_KERNEL} ---
	-12345 chdir("attach-p-cmd.test -p") = -1 ENOENT (No such file or directory)
	+12345 syscall_4294967295(0xffe60934, 0x1c0, 0xffe60934, 0x1, 0xffe609b4, 0xffe60a58) = -1 (errno 38)
	+12345 chdir("attach-p-cmd.test -p") = -1 ENOSYS (Function not implemented)

	Let's workaround this kernel madness by rewriting the test
	without use of SIGALRM.

	* tests/attach-p-cmd.h: New file.
	* tests/Makefile.am (EXTRA_DIST): Add attach-p-cmd.h.
	* tests/attach-p-cmd-cmd.c: Include "attach-p-cmd.h".
	(write_pidfile, wait_for_peer_invocation): New functions.
	(main): Use them.
	* tests/attach-p-cmd-p.c: Include <time.h> and "attach-p-cmd.h".
	(wait_for_peer_invocation, wait_for_peer_termination): New functions.
	(main): Use them.  Do not raise SIGALRM, use nanosleep after peer
	termination.

2017-12-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify ipc_msgbuf.test against broken libc.
	glibc between commits glibc-2.25~130 and glibc-2.26~740 had broken
	msgctl(IPC_RMID) on hppa: this operation always failed with EINVAL
	because of inappropriate use of IPC_64 flag.  Similar issues were
	fixed on other niche architectures.  Let's workaround these issues
	by skipping the test in case of msgctl(IPC_RMID) failure.

	* tests/ipc_msgbuf.c (cleanup): Change return type to int,
	return 77 in case of msgctl(IPC_RMID) failure.
	(main): Explicitly invoke cleanup() at the end.

2017-12-01  Masatake YAMATO  <yamato@redhat.com>

	kvm: decode the argument of KVM_CREATE_VCPU ioctl command.
	* kvm.c (kvm_ioctl_create_vcpu): New function.
	(kvm_ioctl) <KVM_CREATE_VCPU>: Use it.

	kvm: handle KVM_CREATE_VM ioctl command.
	* kvm.c (kvm_ioctl): Handle KVM_CREATE_VM command.

	kvm: handle KVM_RUN, KVM_GET_VCPU_MMAP_SIZE, and KVM_GET_API_VERSION ioctl commands
	* kvm.c (kvm_ioctl): Handle KVM_RUN, KVM_GET_VCPU_MMAP_SIZE,
	and KVM_GET_API_VERSION commands.

	ioctl: add a stub for decoding kvm related ioctls.
	* kvm.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* configure.ac (AC_CHECK_HEADERS): Add linux/kvm.h.
	* defs.h (kvm_ioctl): New prototype.
	* ioctl.c (ioctl_decode) HAVE_LINUX_KVM_H]: Use kvm_ioctl.

2017-11-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace-log-merge: work around corner cases of strace -ttt parsing.
	Employing strace -ttt for the logs destined to be fed to
	strace-log-merge is ultimately the best solution except for the logs
	that pass the following dates:

	Thu Jan  1 00:00:09 UTC 1970
	Thu Jan  1 00:01:39 UTC 1970
	Thu Jan  1 00:16:39 UTC 1970
	Thu Jan  1 02:46:39 UTC 1970
	Fri Jan  2 03:46:39 UTC 1970
	Mon Jan 12 13:46:39 UTC 1970
	Sun Apr 26 17:46:39 UTC 1970
	Sat Mar  3 09:46:39 UTC 1973
	Sun Sep  9 01:46:39 UTC 2001
	Sat Nov 20 17:46:39 UTC 2286
	Wed Nov 16 09:46:39 UTC 5138
	Fri Sep 27 01:46:39 UTC 33658
	Sun May 20 17:46:39 UTC 318857
	Sat Nov  7 09:46:39 UTC 3170843
	Sun Jul  5 01:46:39 UTC 31690708
	Sat Jan 25 17:46:39 UTC 316889355

	Let's lift this limitation.

	* strace-log-merge: Generate numeric-only key for sorting, use sort -n
	option.

2017-11-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	debian: add strace-log-merge to the list of installed files.
	* debian/strace.install: Add strace-log-merge.

	Add strace-log-merge man page.
	* strace-log-merge.1.in: New file.
	* NEWS: Mention this.
	* .gitignore: Add strace-log-merge.1.
	* Makefile.am (man_MANS): Likewise.
	* configure.ac (AC_CONFIG_FILES): Likewise.
	* debian/strace.manpages: Likewise.

	strace-log-merge: add copyright header.

2017-11-29  Dmitry V. Levin  <ldv@altlinux.org>

	Add initial GitLab CI support.
	* .gitlab-ci.yml: New file.
	* travis-build.sh: Print $CC -print-multi-lib.  Print config.log
	in case of configure failure.
	* travis-install.sh: Check sudo availability.  Install autoconf,
	automake, file, gawk, gcc-multilib, git, gzip, make, and xz-utils
	for all targets.
	(musl-gcc): Install ca-certificates.

2017-11-25  Dmitry V. Levin  <ldv@altlinux.org>

	mpers: fix cross-compiling.
	In cross builds, a target version of readelf has to be used
	instead of a native one.

	* configure.ac (AC_CHECK_TOOL): Add readelf.
	* Makefile.am (READELF): New variable.
	(mpers-m%.stamp): Pass it to $(srcdir)/mpers.sh.
	* m4/mpers.m4 (st_MPERS): Pass READELF environment variable
	to $srcdir/mpers_test.sh.
	* mpers.sh (READELF): New variable.
	Use it instead of readelf.
	* maint/ioctls_sym.sh: Likewise.
	* NEWS: Mention this fix.

	Reported-by: Rolf Eike Beer <eb@emlix.com>

2017-11-22  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix llseek test.
	* tests/llseek.test: Fix typo.

	INSTALL-git.md: fix typo.

	tests: simplify bpf test a bit.
	* tests/bpf.c (DEF_BPF_INIT_FIRST): New macro.
	(init_BPF_MAP_CREATE_first, init_BPF_MAP_LOOKUP_ELEM_first,
	init_BPF_PROG_LOAD_first, init_BPF_OBJ_PIN_first,
	init_BPF_PROG_ATTACH_first, init_BPF_PROG_TEST_RUN_first,
	init_BPF_PROG_GET_NEXT_ID_first, init_BPF_OBJ_GET_INFO_BY_FD_first):
	Use it.

2017-11-21  Dmitry V. Levin  <ldv@altlinux.org>

	Implement decoding of BPF_OBJ_GET_INFO_BY_FD command of bpf syscall.
	* configure.ac (AC_CHECK_MEMBERS): Add union bpf_attr.info.info.
	* bpf.c (decode_BPF_OBJ_GET_INFO_BY_FD): New function.
	(SYS_FUNC(bpf)) <bpf_cmd_decoders>: Use it.
	* NEWS: Mention this.
	* tests/bpf.c: Add macro guard for BPF_OBJ_GET_INFO_BY_FD decoder test.
	[HAVE_UNION_BPF_ATTR_INFO_INFO] (sample_BPF_OBJ_GET_INFO_BY_FD_attr):
	New variable.
	[HAVE_UNION_BPF_ATTR_INFO_INFO] (init_BPF_OBJ_GET_INFO_BY_FD_first,
	print_BPF_OBJ_GET_INFO_BY_FD_first, init_BPF_OBJ_GET_INFO_BY_FD_attr,
	print_BPF_OBJ_GET_INFO_BY_FD_attr): New functions.
	(main) [HAVE_UNION_BPF_ATTR_INFO_INFO]: Use them.

	Simplify union bpf_attr field checks.
	* configure.ac: Use AC_CHECK_MEMBERS instead of st_CHECK_UNION_BPF_ATTR
	for union bpf_attr field checks as the former seems to be enough
	for the case.
	* m4/st_bpf.m4: Remove.

	Implement decoding of BPF_*_GET_*_ID commands of bpf syscall.
	* configure.ac: Check for union bpf_attr.next_id.
	* bpf.c (decode_BPF_PROG_GET_NEXT_ID, decode_BPF_PROG_GET_FD_BY_ID,
	* decode_BPF_MAP_GET_FD_BY_ID): New functions.
	(decode_BPF_MAP_GET_NEXT_ID): New macro.
	(SYS_FUNC(bpf)) <bpf_cmd_decoders>: Use them.
	* NEWS: Mention this.
	* tests/bpf.c: Add macro guard for BPF_*_GET_*_ID decoder tests.
	[HAVE_UNION_BPF_ATTR_NEXT_ID] (init_BPF_PROG_GET_NEXT_ID_first,
	print_BPF_PROG_GET_NEXT_ID_first, init_BPF_PROG_GET_NEXT_ID_attr,
	print_BPF_PROG_GET_NEXT_ID_attr, print_BPF_PROG_GET_FD_BY_ID_first,
	print_BPF_PROG_GET_FD_BY_ID_attr, print_BPF_MAP_GET_NEXT_ID_first,
	print_BPF_MAP_GET_NEXT_ID_attr): New functions.
	(init_BPF_MAP_GET_NEXT_ID_first, print_BPF_MAP_GET_NEXT_ID_first,
	init_BPF_MAP_GET_NEXT_ID_attr, print_BPF_MAP_GET_NEXT_ID_attr,
	init_BPF_PROG_GET_FD_BY_ID_first, init_BPF_PROG_GET_FD_BY_ID_attr,
	init_BPF_MAP_GET_FD_BY_ID_first, init_BPF_MAP_GET_FD_BY_ID_attr):
	New macros.
	(main) [HAVE_UNION_BPF_ATTR_NEXT_ID]: Use them.

2017-11-20  Dmitry V. Levin  <ldv@altlinux.org>

	Implement decoding of BPF_PROG_TEST_RUN command of bpf syscall.
	* configure.ac: Check for union bpf_attr.test.duration.
	* bpf.c (decode_BPF_PROG_TEST_RUN): New function.
	(SYS_FUNC(bpf)) <bpf_cmd_decoders>: Use it.
	* NEWS: Mention this.
	* tests/bpf.c: Include "print_fields.h".
	Add macro guard for BPF_PROG_TEST_RUN decoder test.
	[HAVE_UNION_BPF_ATTR_TEST_DURATION] (sample_BPF_PROG_TEST_RUN_attr):
	New variable.
	[HAVE_UNION_BPF_ATTR_TEST_DURATION] (init_BPF_PROG_TEST_RUN_first,
	print_BPF_PROG_TEST_RUN_first, init_BPF_PROG_TEST_RUN_attr,
	print_BPF_PROG_TEST_RUN_attr): New functions.
	(main) [HAVE_UNION_BPF_ATTR_TEST_DURATION]: Use them.

2017-11-20  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: update BPF_MAP_CREATE decoding.
	Implement decoding of union bpf_attr.numa_node field for BPF_MAP_CREATE
	command introduced by linux kernel commit v4.14-rc1~130^2~196^2~1.

	* configure.ac: Check for numa_node member of union bpf_attr
	instead of inner_map_fd.
	(decode_BPF_MAP_CREATE): Add numa_node field to the structure, print it.
	* NEWS: Mention this.
	* tests/bpf.c: Update macro guards of BPF_MAP_CREATE decoder test.
	(init_BPF_MAP_CREATE_first, print_BPF_MAP_CREATE_attr): Update expected
	output.
	(init_BPF_MAP_CREATE_attr): Initialize numa_node field, update offset.

2017-11-20  Eugene Syromiatnikov  <esyr@redhat.com>

	unwind.c: cleanup.
	* unwind.c (rebuild_cache_if_invalid): Simplify return statement.

	unwind.c: fix typo in comment.
	* unwind.c (unwind_cache_invalidate, unwind_print_stacktrace,
	unwind_capture_stacktrace): Replace strack with stack.

2017-11-18  Dmitry V. Levin  <ldv@altlinux.org>

	ipc_shm: decode hugetlb page size in shmget flags.
	Decode alternative hugetlb page sizes introduced by kernel commit
	v3.8-rc1~175^2~36.

	* ipc_shm.c [!SHM_HUGE_SHIFT] (SHM_HUGE_SHIFT): New macro.
	[!SHM_HUGE_MASK] (SHM_HUGE_MASK): Likewise.
	(SYS_FUNC(shmget)): Print hugetlb page size.
	* tests/ipc_shm.c: Check it.

2017-11-18  Dmitry V. Levin  <ldv@altlinux.org>

	memfd_create: decode hugetlb page size.
	Decode alternative hugetlb page sizes introduced by kernel commit
	v4.14-rc1~126^2~17.

	* configure.ac (AC_CHECK_HEADERS): Add linux/memfd.h.
	* memfd_create.c [HAVE_LINUX_MEMFD_H]: Include it.
	[!MFD_HUGE_SHIFT] (MFD_HUGE_SHIFT): New macro.
	[!MFD_HUGE_MASK] (MFD_HUGE_MASK): Likewise.
	(SYS_FUNC(memfd_create)): Print hugetlb page size.
	* tests/memfd_create.c: Check it.

2017-11-18  Dmitry V. Levin  <ldv@altlinux.org>

	Print the first argument of memfd_create syscall as a path.
	The limit imposed by the kernel on the length of memfd_create first
	argument is NAME_MAX - strlen("memfd:").

	* memfd_create.c (SYS_FUNC(memfd_create)): Print the first argument
	using printpathn.
	* tests/memfd_create.c: Check it.

2017-11-17  Dmitry V. Levin  <ldv@altlinux.org>

	mem: decode hugetlb page size in mmap flags.
	Decode alternative hugetlb page sizes introduced by kernel commit
	v3.8-rc1~175^2~36.

	* mem.c [!MAP_HUGE_SHIFT] (MAP_HUGE_SHIFT): New macro.
	[!MAP_HUGE_MASK] (MAP_HUGE_MASK): Likewise.
	(print_mmap_flags): Print hugetlb page size.
	* NEWS: Mention it.
	* tests/remap_file_pages.c: Check it.

2017-11-17  Dmitry V. Levin  <ldv@altlinux.org>

	mem: assume that MAP_TYPE is defined.
	Since linux kernel provided a definition of MAP_TYPE in <asm/mman.h>
	as long ago as in v2.4.0, it's safe to assume that MAP_TYPE is defined.

	* mem.c (print_mmap_flags) [!MAP_TYPE]: Remove.

2017-11-17  Dmitry V. Levin  <ldv@altlinux.org>

	mem: move printing of mmap_flags to a separate function.
	* mem.c (print_mmap_flags): New function.
	(print_mmap, SYS_FUNC(remap_file_pages)): Use it.

2017-11-17  Dmitry V. Levin  <ldv@altlinux.org>

	Provide fallback definitions for SHM_EXEC constant.
	Although SHM_EXEC is available in <linux/shm.h> since kernel commit
	v2.6.9-rc2~23^2~93^2~78, the glibc version of <sys/shm.h> did not
	provide SHM_EXEC until commit glibc-2.10~238.

	* xlat/shm_flags.in (SHM_EXEC): Add fallback definition.
	* tests/shmxt.c (SHM_EXEC): Likewise.

2017-11-17  Dmitry V. Levin  <ldv@altlinux.org>

	Update SHM_* constants.
	* xlat/shm_flags.in: Add SHM_EXEC introduced by kernel commit
	v2.6.9-rc2~23^2~93^2~78.
	* xlat/shm_resource_flags.in: Add SHM_NORESERVE introduced by kernel
	commit v2.6.15-rc1~622.
	* NEWS: Mention this.
	* tests/ipc_shm.c (main): Update expected output.
	* tests/shmxt.c (main): Update expected output, check SHM_EXEC decoding.

2017-11-17  Dmitry V. Levin  <ldv@altlinux.org>

	Remove fallback definitions for SHM_STAT and SHM_INFO constants.
	These constants are universally available for quite a long time
	and are used unconditionally in tests without any complaints.

	* xlat/shmctl_flags.in: Remove fallback definitions.

2017-11-16  Dmitry V. Levin  <ldv@altlinux.org>

	net: fix SOL_NETLINK NETLINK_LIST_MEMBERSHIPS decoding.
	NETLINK_LIST_MEMBERSHIPS, unlike all other SOL_NETLINK options, requests
	not just a single integer but an array of integers.  The kernel also
	supports a zero optlen NETLINK_LIST_MEMBERSHIPS request.

	* net.c (print_uint32): New function.
	(print_getsockopt): Add ulen argument, rename len argument to rlen,
	<SOL_NETLINK> Handle NETLINK_LIST_MEMBERSHIPS using print_array
	and print_uint32.
	(SYS_FUNC(getsockopt)): Pass ulen to print_getsockopt.
	* tests/sockopt-sol_netlink.c (main): Check NETLINK_LIST_MEMBERSHIPS
	decoding.

2017-11-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check [gs]etsockopt SOL_NETLINK decoding.
	* tests/sockopt-sol_netlink.c: New file.
	* tests/gen_tests.in (sockopt-sol_netlink): New entry.
	* tests/pure_executables.list: Add sockopt-sol_netlink.
	* tests/.gitignore: Likewise.

2017-11-16  Dmitry V. Levin  <ldv@altlinux.org>

	net: fix decoding of optval argument of [gs]etsockopt SOL_NETLINK.
	Tweak the parser to follow the kernel behaviour.

	* net.c (print_getsockopt, print_setsockopt) <SOL_NETLINK>: Fetch and
	print returned value as integer iff the length is >= sizeof(int),
	otherwise print the address.
	* NEWS: Mention this.

2017-11-15  Dmitry V. Levin  <ldv@altlinux.org>

	net: decode optname argument of [gs]etsockopt for SOL_NETLINK level.
	* xlat/socknetlinkoptions.in: New file.
	* net.c: Include "xlat/socknetlinkoptions.h".
	(print_sockopt_fd_level_name) <SOL_NETLINK>: Print name using
	socknetlinkoptions.
	* NEWS: Metnion this.

	Update MSG_* constants.
	* xlat/msg_flags.in: Add MSG_ZEROCOPY introduced by kernel commit
	v4.14-rc1~130^2~376^2~6.
	* NEWS: Mention this.

	netlink: print descriptor attributes using printfd.
	* nlattr.h (DECL_NLA(fd)): New prototype.
	* nlattr.c (decode_nla_fd): New function.
	* rtnl_link.c (ifla_xdp_nla_decoders) <IFLA_XDP_FD>: Use it.
	(ifinfomsg_nla_decoders) <IFLA_NET_NS_FD>: Likewise.
	* rtnl_nsid.c (rtgenmsg_nla_decoders) <NETNSA_FD>: Likewise.
	* NEWS: Mention this.

2017-11-14  Eugene Syromyatnikov  <evgsyr@gmail.com>

	maint/update_copyright_years.sh: implement concurrent execution.
	Analogous to the way it is done in xlat/gen.sh.

	* maint/update_copyright_years.sh (MAX_JOBS): New variable, initialize
	it to double the CPU count.
	<while [ -n "${1:-}" ]; do case "$1" in>: Add -j option parsing.
	(jobs, pids): New variables.
	<git ls-files -- "$@" | grep -vFx "$IGNORED_FILES" | while read f; do>:
	Execute process_file in background, count background jobs and wait
	if there are too many.

2017-11-14  Eugene Syromyatnikov  <evgsyr@gmail.com>

	maint/update_copyright_years.sh: use -efu shell mode.
	* maint/update_copyright_years.sh: Add -efu to shebang.  Adjust
	the script for -efu shell mode.

2017-11-14  Dmitry V. Levin  <ldv@altlinux.org>

	Post-release administrivia.
	* NEWS: Add a header line for the next release.
	* debian/changelog.in: Add a changelog entry for 4.20-1.
	* strace.spec.in: Likewise.

2017-11-13  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for 4.20 release.
	* NEWS: Update for 4.20 release.

	CREDITS.in: remove entries listed by maint/gen-contributors-list.sh.

2017-11-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Makefile.am: use gen-contributors-list.sh for CREDITS.
	* Makefile.am ($(srcdir)/CREDITS): Employ maint/gen-contributors-list.sh
	for the contributor list generation.

2017-11-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	maint: make gen-contributors-list.sh suitable for generation of CREDITS.
	Implement various features in order to make it suitable for the
	generation of the CREDITS file:
	- add an option for including contributor e-mail;
	- add an option to read additional list of contributors from stdin;
	- add shorthand for referring to the initial commit of the branch;
	- document all of the above in a help message.

	* maint/gen-contributors-list.sh (print_help): New function.
	(script): Rename to SCRIPT.
	(SCRIPT_NORM_EMAILS, MATCH_OUT, OUT_EMAILS, OUT_NO_EMAILS, read_stdin,
	include_email): New variables.
	Add parsing of options, rewrite input processing.

2017-11-13  Dmitry V. Levin  <ldv@altlinux.org>

	.mailmap: add more entries to avoid duplication in CREDITS.

	.mailmap: sort entries.

2017-11-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	.mailmap: more deduplication.
	Of course there are no two persons in the whole world that share
	the same name.

2017-11-13  Dmitry V. Levin  <ldv@altlinux.org>

	CREDITS.in: use UTF-8 consistently.
	In particular, do not use " symbols in names.

2017-11-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	CREDITS.in: add Jiri Slaby as a contributor.
	Unfortunately, he wasn't mentioned in the message of the commit
	v4.19-68-g48cb633, so let's fix that omission.

	References: https://github.com/strace/strace/pull/16

2017-11-13  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	s390, s390x: update ioctl entries from linux 4.14.
	* linux/s390/ioctls_arch0.h: Update from linux v4.14 using ioctls_gen.sh.
	* linux/s390x/ioctls_arch0.h: Likewise.

	s390x: remove some of non-s390 KVM ioctls.
	* linux/s390x/ioctls_arch0.h: Regenerate.

	maint: remove KVM_PPC_CONFIGURE_V3_MMU ioctl from non-powerpc arches.
	* maint/ioctls_sym.sh (ppc_list): Update.

2017-11-12  Dmitry V. Levin  <ldv@altlinux.org>

	Update copyright headers.
	Headers updated semi-automatically using
	maint/update_copyright_years.sh script.

	* m4/mpers.m4: Update copyright years.
	* tests/kcmp.c: Likewise.
	* tests/membarrier.c: Likewise.

2017-11-11  Dmitry V. Levin  <ldv@altlinux.org>

	maint/update_copyright_years.sh: fix typo in help output.
	* maint/update_copyright_years.sh (print_help): Fix typo, disable
	here-document expansion.

2017-11-10  Eugene Syromiatnikov  <esyr@redhat.com>

	Move MIN, MAX, and CLAMP to macros.h.
	We shouldn't have to include the whole defs.h to get them.

	* defs.h (MIN, MAX, CLAMP): Move ...
	* macros.h: ... here.

2017-11-10  Eugene Syromiatnikov  <esyr@redhat.com>

	Update .mailmap.
	* .mailmap (Eugene Syromyatnikov): Add work address.

2017-11-07  Steve McIntyre  <steve@einval.com>

	debian: update debhelper compat level to 10, replace -s with -a in some calls

	debian: update Standards-Version to 3.9.8.

2017-11-06  Dmitry V. Levin  <ldv@altlinux.org>

	mpers.m4: check for size of long and kernel_long_t.
	The primary purpose of this new check is diagnostics.

	* m4/mpers.m4 (st_MPERS): Check for size of long and kernel_long_t.

2017-11-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat/gen.sh: speedup xlat generation.
	This commit implements the following changes:
	- increases the number of concurrent jobs to twice the CPU count;
	- creates a circular buffer, so instead of running multiple jobs
	  at once, the generator tries to keep about the same number of jobs
	  being run concurrently;
	- runs gen_git and gen_make concurrently in order to squeeze in
	  one more bit of concurrency.

	With my deeply scientific measurements, this approach achieves
	up to 15% speedup with dash and about 30-40% with bash as /bin/sh
	on a 4-core machine.

	* xlat/gen.sh (main): Declare pids local variable, append pid of every
	run job to it; increase the limit of jobs to ncpus * 2; when the limit
	is reached, wait for the first pid in pids instead of resetting jobs
	to zero and waiting for all the run jobs; put gen_git and gen_make
	into background.

2017-11-05  Dmitry V. Levin  <ldv@altlinux.org>

	hppa: wire up statx syscall.
	* linux/hppa/syscallent.h [349]: Add statx entry.

2017-11-04  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check signal mask transparency.
	Starting with commit v4.17-5-gf83b49b strace is expected
	to forward the signal mask to tracees unchanged.

	* tests/check_sigblock.c: New file.
	* tests/set_sigblock.c: Likewise.
	* tests/sigblock.test: New test.
	* tests/.gitignore: Add check_sigblock and set_sigblock.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(MISC_TESTS): Add sigblock.test.

2017-11-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check signal disposition transparency.
	Starting with commit v4.17-8-ge97a66f strace is expected
	to forward the signal disposition to tracees unchanged.

	* tests/check_sigign.c: New file.
	* tests/list_sigaction_signum.c: Likewise.
	* tests/set_sigign.c: Likewise.
	* tests/sigign.test: New test.
	* tests/.gitignore: Add check_sigign, list_sigaction_signum,
	and set_sigign.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(MISC_TESTS): Add sigign.test.

2017-11-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: update futex test to accommodate the recent kernel change.
	Kernel commit v4.14-rc1~162^2~8 refactored futex implementation and
	introduced checks for invalid shift sizes.  Accommodate this change
	by allowing EINVAL in the corresponding futex checks.

	* tests/futex.c (CHECK_FUTEX_GENERIC): Reset errno before the syscall.
	(main) <wake_ops>: Add err2 field, describe err/err2 fields.
	Add EINVAL as a possible errno to the checks that contain invalid
	shift values.
	Update return value check so it checks that values are strictly
	as expected.

	Closes: https://github.com/strace/strace/pull/16

2017-11-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: cleanup futex test.
	* tests/futex.c (main) <wake_ops>: Remove unused errstr field
	from the structure type definition.

2017-11-02  Dmitry V. Levin  <ldv@altlinux.org>

	seccomp: decode SECCOMP_GET_ACTION_AVAIL operation.
	* defs.h (seccomp_ret_action): New xlat prototype.
	* seccomp.c (decode_seccomp_set_mode_strict): Remove.
	(SYS_FUNC(seccomp)): Decode SECCOMP_GET_ACTION_AVAIL operation.
	* NEWS: Mention this.
	* tests/seccomp_get_action_avail.c: New file.
	* tests/gen_tests.in (seccomp_get_action_avail): New entry.
	* tests/pure_executables.list: Add seccomp_get_action_avail.
	* tests/.gitignore: Likewise.

2017-11-01  Dmitry V. Levin  <ldv@altlinux.org>

	Add SECCOMP_RET_KILL_PROCESS decoding support.
	* bpf_seccomp_filter.c [!SECCOMP_RET_ACTION]: Remove.
	[!SECCOMP_RET_ACTION_FULL] (SECCOMP_RET_ACTION_FULL): Define.
	(print_seccomp_filter_k): Use SECCOMP_RET_ACTION_FULL
	instead of SECCOMP_RET_ACTION.
	* xlat/seccomp_ret_action.in: Add SECCOMP_RET_KILL_PROCESS introduced
	by linux kernel commit v4.14-rc2~15^2~3.

2017-11-01  Dmitry V. Levin  <ldv@altlinux.org>

	Rename SECCOMP_RET_KILL to SECCOMP_RET_KILL_THREAD.
	Follow linux kernel commit v4.14-rc2~15^2~4 and rename SECCOMP_RET_KILL
	to SECCOMP_RET_KILL_THREAD.

	* xlat/seccomp_ret_action.in (SECCOMP_RET_KILL): Rename
	to SECCOMP_RET_KILL_THREAD.
	* tests/prctl-seccomp-filter-v.c (main): Update expected output.
	* tests/seccomp-filter-v.c (main): Likewise.

2017-11-01  Dmitry V. Levin  <ldv@altlinux.org>

	Update SECCOMP_* constants.
	* xlat/seccomp_filter_flags.in: Add SECCOMP_FILTER_FLAG_LOG introduced
	by kernel commit v4.14-rc2~15^2~6.
	* xlat/seccomp_ops.in: Add SECCOMP_GET_ACTION_AVAIL introduced
	by kernel commit v4.14-rc2~15^2~9.
	* xlat/seccomp_ret_action.in: Add SECCOMP_RET_LOG introduced
	by kernel commit v4.14-rc2~15^2~5.
	* NEWS: Mention this.
	* tests/seccomp-filter.c (main): Update expected output.
	* tests/seccomp-filter-v.c (main): Likewise.

	Provide fallback definitions for SECCOMP_RET_* constants.
	* xlat/seccomp_ret_action.in: Add fallback definitions.

2017-11-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify options-syntax.test against inquisitive musl.
	Workaround musl >= 1.1.17 ability to use AT_EXECFN during
	program_invocation_name initialization.

	* tests/options-syntax.test: Check for two valid variants
	of "zeroargc strace" expected output.

2017-11-01  Dmitry V. Levin  <ldv@altlinux.org>

	Update MEMBARRIER_CMD_* constants.
	* xlat/membarrier_cmds.in: Add MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED
	introduced by kernel commit v4.14-rc6~26.
	* tests/membarrier.c (main): Update expected output.

2017-10-31  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NFNL_SUBSYS_NFT_COMPAT netlink message flags.
	* tests/nfnetlink_nft_compat.c (test_nlmsg_flags): New function.
	(main): Use it.

	tests: check decoding of NFNL_SUBSYS_NFTABLES netlink message flags.
	* tests/nfnetlink_nftables.c (test_nlmsg_flags): New function.
	(main): Use it.

	tests: check decoding of NFNL_SUBSYS_CTHELPER netlink message flags.
	* tests/nfnetlink_cthelper.c (test_nlmsg_flags): New function.
	(main): Use it.

	tests: check decoding of NFNL_SUBSYS_CTNETLINK_TIMEOUT netlink message flags
	* tests/nfnetlink_cttimeout.c (test_nlmsg_flags): New function.
	(main): Use it.

	tests: check decoding of NFNL_SUBSYS_ACCT netlink message flags.
	* tests/nfnetlink_acct.c (test_nlmsg_flags): New function.
	(main): Use it.

	tests: check decoding of NFNL_SUBSYS_CTNETLINK_EXP netlink message flags
	* tests/nfnetlink_ctnetlink_exp.c (test_nlmsg_flags): New function.
	(main): Use it.

	tests: check decoding of NFNL_SUBSYS_CTNETLINK netlink message flags.
	* tests/nfnetlink_ctnetlink.c (test_nlmsg_flags): New function.
	(main): Use it.

2017-10-26  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink: decode NETLINK_NETFILTER netlink message flags.
	* netlink.c (decode_nlmsg_flags_netfilter): New function.
	(nlmsg_flags): Add NETLINK_NETFILTER.
	* NEWS: Mention this.

	netlink: decode netlink message delete flags.
	* netlink.c: Include "xlat/netlink_delete_flags.h".
	(decode_nlmsg_flags_crypto, decode_nlmsg_flags_route,
	decode_nlmsg_flags_xfrm): Decode delete flags.
	* netlink.h (NLM_F_NONREC): New macro.
	* xlat/netlink_delete_flags.in: New file.
	* tests/netlink_crypto.c (test_nlmsg_flags): Check this.
	* tests/netlink_route.c (test_nlmsg_flags): Likewise.
	* tests/netlink_xfrm.c (test_nlmsg_flags): Likewise.

2017-10-26  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink: refactor decode_nlmsg_flags.
	Refactor decode_nlmsg_flags to make it family-specific, just like
	decode_nlmsg_type and decode_payload.

	* netlink.c (decode_nlmsg_flags_crypto, decode_nlmsg_flags_route,
	decode_nlmsg_flags_sock_diag, decode_nlmsg_flags_xfrm): New functions.
	(nlmsg_flags_decoder_t): New typedef.
	(nlmsg_flags): New array.
	(decode_nlmsg_flags): Use it.

2017-10-14  JingPiao Chen  <chenjingpiao@gmail.com>

	Workaround historic linux/netfilter/xt_osf.h deficiencies.
	When using linux kernel headers without commit v4.5-rc1~128^2~115^2~22
	("netfilter: fix include files for compilation"), both <linux/ip.h>
	and <linux/tcp.h> have to be included before <linux/netfilter/xt_osf.h>.

	* configure.ac (AC_CHECK_HEADERS): Include <linux/ip.h>
	and <linux/tcp.h> when checking for linux/netfilter/xt_osf.h header.
	* tests/nfnetlink_osf.c: Include <linux/ip.h> and <linux/tcp.h>
	before <linux/netfilter/xt_osf.h>.

2017-09-24  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NFNL_SUBSYS_NFT_COMPAT netlink message types.
	* configure.ac (AC_CHECK_HEADERS): Add
	linux/netfilter/nf_tables_compat.h.
	* tests/nfnetlink_nft_compat.c: New file.
	* tests/gen_tests.in (nfnetlink_nft_compat): New entry.
	* tests/pure_executables.list: Add nfnetlink_nft_compat.
	* tests/.gitignore: Likewise.

	tests: check decoding of NFNL_SUBSYS_NFTABLES netlink message types.
	* configure.ac (AC_CHECK_HEADERS): Add linux/netfilter/nf_tables.h.
	* tests/nfnetlink_nftables.c: New file.
	* tests/gen_tests.in (nfnetlink_nftables): New entry.
	* tests/pure_executables.list: Add nfnetlink_nftables.
	* tests/.gitignore: Likewise.

	tests: check decoding of NFNL_SUBSYS_CTHELPER netlink message types.
	* configure.ac (AC_CHECK_HEADERS): Add
	linux/netfilter/nfnetlink_cthelper.h.
	* tests/nfnetlink_cthelper.c: New file.
	* tests/gen_tests.in (nfnetlink_cthelper): New entry.
	* tests/pure_executables.list: Add nfnetlink_cthelper.
	* tests/.gitignore: Likewise.

	tests: check decoding of NFNL_SUBSYS_CTNETLINK_TIMEOUT netlink message types
	* configure.ac (AC_CHECK_HEADERS): Add
	linux/netfilter/nfnetlink_cttimeout.h.
	* tests/nfnetlink_cttimeout.c: New file.
	* tests/gen_tests.in (nfnetlink_cttimeout): New entry.
	* tests/pure_executables.list: Add nfnetlink_cttimeout.
	* tests/.gitignore: Likewise.

	tests: check decoding of NFNL_SUBSYS_ACCT netlink message types.
	* configure.ac (AC_CHECK_HEADERS): Add
	linux/netfilter/nfnetlink_acct.h.
	* tests/nfnetlink_acct.c: New file.
	* tests/gen_tests.in (nfnetlink_acct): New entry.
	* tests/pure_executables.list: Add nfnetlink_acct.
	* tests/.gitignore: Likewise.

	tests: check decoding of NFNL_SUBSYS_IPSET netlink message types.
	* configure.ac (AC_CHECK_HEADERS): Add linux/netfilter/ipset/ip_set.h.
	* tests/nfnetlink_ipset.c: New file.
	* tests/gen_tests.in (nfnetlink_ipset): New entry.
	* tests/pure_executables.list: Add nfnetlink_ipset.
	* tests/.gitignore: Likewise.

	tests: check decoding of NFNL_SUBSYS_OSF netlink message types.
	* configure.ac (AC_CHECK_HEADERS): Add linux/netfilter/xt_osf.h.
	* tests/nfnetlink_osf.c: New file.
	* tests/gen_tests.in (nfnetlink_osf): New entry.
	* tests/pure_executables.list: Add nfnetlink_osf.
	* tests/.gitignore: Likewise.

	tests: check decoding of NFNL_SUBSYS_ULOG netlink message types.
	* configure.ac (AC_CHECK_HEADERS): Add
	linux/netfilter/nfnetlink_log.h.
	* tests/nfnetlink_ulog.c: New file.
	* tests/gen_tests.in (nfnetlink_ulog): New entry.
	* tests/pure_executables.list: Add nfnetlink_ulog.
	* tests/.gitignore: Likewise.

	tests: check decoding of NFNL_SUBSYS_QUEUE netlink message types.
	* configure.ac (AC_CHECK_HEADERS): Add
	linux/netfilter/nfnetlink_queue.h.
	* tests/nfnetlink_queue.c: New file.
	* tests/gen_tests.in (nfnetlink_queue): New entry.
	* tests/pure_executables.list: Add nfnetlink_queue.
	* tests/.gitignore: Likewise.

	tests: check decoding of NFNL_SUBSYS_CTNETLINK_EXP netlink message types
	* tests/nfnetlink_ctnetlink_exp.c: New file.
	* tests/gen_tests.in (nfnetlink_ctnetlink_exp): New entry.
	* tests/pure_executables.list: Add nfnetlink_ctnetlink_exp.
	* tests/.gitignore: Likewise.

	tests: check decoding of NFNL_SUBSYS_CTNETLINK netlink message types.
	* configure.ac (AC_CHECK_HEADERS): Add
	linux/netfilter/nfnetlink_conntrack.h.
	* tests/nfnetlink_ctnetlink.c: New file.
	* tests/gen_tests.in (nfnetlink_ctnetlink): New entry.
	* tests/pure_executables.list: Add nfnetlink_ctnetlink.
	* tests/.gitignore: Likewise.

	netlink: decode NETLINK_NETFILTER netlink message types.
	* netlink.c: Include "xlat/nf_acct_msg_types.h",
	"xlat/nf_cthelper_msg_types.h", "xlat/nf_ctnetlink_exp_msg_types.h",
	"xlat/nf_ctnetlink_msg_types.h", "xlat/nf_cttimeout_msg_types.h",
	"xlat/nf_ipset_msg_types.h", "xlat/nf_nft_compat_msg_types.h",
	"xlat/nf_nftables_msg_types.h", "xlat/nf_osf_msg_types.h",
	"xlat/nf_queue_msg_types.h", and "xlat/nf_ulog_msg_types.h".
	(nf_nlmsg_types): New array.
	(decode_nlmsg_type_netfilter): Use it.
	* NEWS: Mention this.
	* xlat/nf_acct_msg_types.in: New file.
	* xlat/nf_cthelper_msg_types.in: Likewise.
	* xlat/nf_ctnetlink_exp_msg_types.in: Likewise.
	* xlat/nf_ctnetlink_msg_types.in: Likewise.
	* xlat/nf_cttimeout_msg_types.in: Likewise.
	* xlat/nf_ipset_msg_types.in: Likewise.
	* xlat/nf_nft_compat_msg_types.in: Likewise.
	* xlat/nf_nftables_msg_types.in: Likewise.
	* xlat/nf_osf_msg_types.in: Likewise.
	* xlat/nf_queue_msg_types.in: Likewise.
	* xlat/nf_ulog_msg_types.in: Likewise.
	* tests/netlink_netfilter.c (test_nlmsg_type): Update expected output.

2017-09-20  Dmitry V. Levin  <ldv@altlinux.org>

	ppc64: fix sigreturn parser for ppc personality.
	* linux/powerpc/arch_sigreturn.c (arch_sigreturn) [POWERPC64]: Rewrite.

	ppc64: truncate syscall args for 32-bit personality tracees.
	* linux/powerpc/get_syscall_args.c (get_syscall_args): Clear upper
	32 bits of syscall args for 32-bit personality tracees.
	* NEWS: Mention this fix.

	ppc64: fix PRI__64 macro definition when compiled with -m32.
	* kernel_types.h [SIZEOF_LONG != 4]: Check for __powerpc64__ instead
	of POWERPC to handle -m32 case properly.

2017-09-19  Dmitry V. Levin  <ldv@altlinux.org>

	loop: decode LOOP_SET_BLOCK_SIZE.
	* loop.c (loop_ioctl) <LOOP_SET_BLOCK_SIZE>: Handle LOOP_SET_BLOCK_SIZE.
	* tests/ioctl_loop.c (main): Check it.

	Update ioctl entries from linux v4.14-rc1.
	* linux/32/ioctls_inc_align16.h: Update from linux v4.14-rc1
	using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* xlat/loop_cmds.in: Add LOOP_SET_BLOCK_SIZE introduced
	by kernel commit v4.13-rc7-176-g89e4fde.
	* NEWS: Mention this.
	* tests/ioctl_loop.c (main): Update.

2017-09-19  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	maint: generate ioctl entries without target architecture code execution
	ioctls_sym.sh used to generate and invoke target architecture
	executables that limited its applicability.
	After this change, the generated code is just compiled to the target
	architecture object files and all required information is obtained
	from the dwarf sections.
	This approach allows to generate ioctl entries for any target
	architecture supported by compiler.

	* maint/ioctls_sym.awk: New file.
	* maint/ioctls_sym.sh (LC_ALL): Define to C and export.
	(uname_m): Make configurable.
	(CFLAGS): Add -gdwarf-2.
	(LDFLAGS): Remove.
	Do not use print_ioctlent.c.
	Change asm-generic/ioctl.h and asm/ioctl.h hook.
	Dump and process dwarf sections of generated object files.
	* maint/print_ioctlent.c: Remove.

2017-09-18  Dmitry V. Levin  <ldv@altlinux.org>

	Remove KVM_S390_* ioctls from non-s390 architectures.
	* maint/ioctls_sym.sh <linux/kvm.h> (s390_list): New variable.
	Use it to exclude KVM_S390_* ioctls on non-s390 architectures.
	* linux/arm/ioctls_arch0.h: Regenerate.
	* linux/i386/ioctls_arch0.h: Likewise.
	* linux/powerpc/ioctls_arch0.h: Likewise.
	* linux/s390/ioctls_arch0.h: Likewise.
	* linux/x86_64/ioctls_arch0.h: Likewise.

2017-09-17  Dmitry V. Levin  <ldv@altlinux.org>

	Remove some of arch-specific KVM ioctls from non-matching architectures.
	* maint/ioctls_sym.sh (arm_list, ppc_list, x86_list): Use bracket
	expressions to generalize arch-specific regular expressions.
	* linux/arm/ioctls_arch0.h: Regenerate.
	* linux/i386/ioctls_arch0.h: Likewise.
	* linux/powerpc/ioctls_arch0.h: Likewise.
	* linux/s390/ioctls_arch0.h: Likewise.
	* linux/x86_64/ioctls_arch0.h: Likewise.

2017-09-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	dm: add support for DM_DEV_ARM_POLL.
	Added in Linux commit v4.13-rc1~137^2~14.

	* dm.c [!DM_LIST_VERSIONS] (DM_LIST_VERSIONS): Add leading zero.
	[!DM_TARGET_MSG] (DM_TARGET_MSG): Likewise.
	[!DM_DEV_SET_GEOMETRY_CMD] (DM_DEV_SET_GEOMETRY_CMD): Likewise.
	[!DM_DEV_ARM_POLL] (DM_DEV_ARM_POLL): New macro.
	(dm_ioctl_has_params, dm_ioctl): Handle DM_DEV_ARM_POLL.
	* tests/ioctl_dm.c [!DM_DEV_ARM_POLL] (DM_DEV_ARM_POLL): New macro.
	(main) <dummy_check_cmds>: Add DM_DEV_ARM_POLL.

2017-09-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	kcmp: add KCMP_EPOLL_TFD support.
	* configure.ac (AC_CHECK_TYPES): Add check for struct kcmp_epoll_slot.
	* kcmp.c (SYS_FUNC(kcmp)) <case KCMP_EPOLL_TFD>: Implement idx1/idx2
	argument parsing.
	* tests/kcmp.c: Update test.
	* xlat/kcmp_types.in (KCMP_EPOLL_TFD): New entry.

2017-09-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add kcmp-y test.
	It is not very useful as of now, but it will allow tracking changes
	in fd output once they are implemented.

	* tests/gen_tests.in (kcmp-y): New test.
	* tests/kcmp-y.c: New file, wrapper for kcmp.c
	* tests/kcmp.c: Add opening of some files for which info may be printed
	in the future.
	* tests/pure_executables.list: Add kcmp-y.
	* tests/.gitignore: Likewise.

2017-09-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	kcmp: output fds using a separate function.
	This is a preparation for the future introduction of cross-NS PID
	derivation, which would enable us to print fd information for fds
	related to all processes, not just traced ones.

	Note the change in output type for idx1/idx2 in KCMP_FILE command from
	unsigned to int, it follows printfd output format.

	* kcmp.c (printpidfd): New function.
	(PRINT_FIELD_PIDFD): New macro.
	(SYS_FUNC(kcmp)) <case KCMP_FILE>: Use printpidfd for printing
	idx1/idx2, as they are fds, after all.

2017-09-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/kcmp: add more checks.
	Let's check all kcmp commands that they indeed do not print idx1/idx2.
	Also, check that upper bits of pid arguments are ignored.

	* tests/gen_tests.in (kcmp): Decrease -a argument's value from 27 to 22.
	* tests/kcmp.c: Add checks for upper bits of pid1/pid2 and for all
	kcmp types not tested before.

2017-09-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/kcmp: use <linux/kcmp.h> if it is available.
	I see it as a good idea to stick to system headers whenever possible
	in order to also check for possible discrepancies between strace's
	internal definitions and definitions present in the system headers.

	* configure.ac (AC_CHECK_HEADERS): Add linux/kcmp.h.
	* tests/kcmp.h [HAVE_LINUX_KCMP_H]: Include <linux/kcmp.h>,
	do not define KCMP_FILE and KCMP_SYSVSEM.

2017-09-17  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of MDBA_ROUTER_PORT netlink attribute.
	* tests/nlattr_mdba_router_port.c: New file.
	* tests/gen_tests.in (nlattr_mdba_router_port): New entry.
	* tests/pure_executables.list: Add nlattr_mdba_router_port.
	* tests/.gitignore: Likewise.

	tests: check decoding of MDBA_MDB_ENTRY_INFO netlink attributes.
	* tests/nlattr_mdba_mdb_entry.c: New file.
	* tests/gen_tests.in (nlattr_mdba_mdb_entry): New entry.
	* tests/pure_executables.list: Add nlattr_mdba_mdb_entry.
	* tests/.gitignore: Likewise.

2017-09-17  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: extend TEST_NESTED_NLATTR_OBJECT macro.
	Extend TEST_NESTED_NLATTR_OBJECT macro for multi-nested netlink
	attributes, such as

		[MDBA_MDB] = {
			[MDBA_MDB_ENTRY] = {
				[MDBA_MDB_ENTRY_INFO] {
					struct br_mdb_entry
					[MDBA_MDB_EATTR attributes]
				}
			}
		}

	* tests/test_nlattr.h (TEST_NESTED_NLATTR_OBJECT_EX_,
	TEST_NESTED_NLATTR_OBJECT_EX): New macros.
	(TEST_NESTED_NLATTR_OBJECT): Use TEST_NESTED_NLATTR_OBJECT_EX_.

2017-09-17  JingPiao Chen  <chenjingpiao@gmail.com>

	rtnl_mdb: decode br_port_msg netlink attributes.
	* configure.ac (AC_CHECK_TYPES): Check for struct br_mdb_entry
	in <linux/if_bridge.h>.
	(AC_CHECK_MEMBERS): Check for flags and vid fields in struct br_mdb_entry.
	* rtnl_mdb.c: Include "xlat/mdb_flags.h", "xlat/mdb_states.h",
	"xlat/rtnl_mdba_mdb_attrs.h", "xlat/rtnl_mdba_mdb_eattr_attrs.h",
	"xlat/rtnl_mdba_mdb_entry_attrs.h" ,"xlat/rtnl_mdba_router_attrs.h"
	and "xlat/rtnl_mdba_router_pattr_attrs.h".
	(decode_mdba_mdb_entry_info, decode_mdba_mdb_entry,
	decode_mdba_mdb, decode_multicast_router_type,
	decode_mdba_router_port, decode_mdba_router): New functions.
	(mdba_mdb_eattr_nla_decoders, mdba_mdb_entry_nla_decoders,
	mdba_mdb_nla_decoders, mdba_router_pattr_nla_decoders,
	mdba_router_nla_decoders, br_port_msg_nla_decoders): New arrays.
	(decode_br_port_msg): Use br_port_msg_nla_decoders.
	* xlat/mdb_flags.in: New file.
	* xlat/mdb_states.in: Likewise.
	* xlat/multicast_router_types.in: Likewise.
	* xlat/rtnl_mdba_mdb_attrs.in: Likewise.
	* xlat/rtnl_mdba_mdb_eattr_attrs.in: Likewise.
	* xlat/rtnl_mdba_mdb_entry_attrs.in: Likewise.
	* xlat/rtnl_mdba_router_attrs.in: Likewise.
	* xlat/rtnl_mdba_router_pattr_attrs.in: Likewise.

2017-09-17  Dmitry V. Levin  <ldv@altlinux.org>

	netlink: implement decoding of INET_DIAG_CLASS_ID attribute.
	This is a new netlink attribute introduced by linux kernel commit
	v4.14-rc1~130^2~207.

	* linux/inet_diag.h (INET_DIAG_CLASS_ID): New enum.
	* netlink_inet_diag.c (inet_diag_msg_nla_decoders): Add
	INET_DIAG_CLASS_ID.
	* xlat/inet_diag_attrs.in: Add INET_DIAG_CLASS_ID.
	* xlat/inet_diag_extended_flags.in: Add 1<<(INET_DIAG_CLASS_ID-1).
	* tests/nlattr_inet_diag_msg.c (main): Check INET_DIAG_CLASS_ID
	decoding.

2017-09-17  Dmitry V. Levin  <ldv@altlinux.org>

	Update MEMBARRIER_CMD_* constants.
	* xlat/membarrier_cmds.in: Add MEMBARRIER_CMD_PRIVATE_EXPEDITED
	introduced by kernel commit v4.14-rc1~174^2^2^4.
	* NEWS: Mention this.
	* tests/membarrier.c (main): Update expected output.

	Update UFFD_FEATURE_* constants.
	* xlat/memfd_create_flags.in: Remove UFFD_FEATURE_EVENT_EXIT removed
	by kernel commit v4.11-rc2~15^2~18.
	Add UFFD_FEATURE_SIGBUS and UFFD_FEATURE_THREAD_ID introduced by kernel
	commits v4.14-rc1~126^2~28 and v4.14-rc1~126^2~23, repsectively.
	* NEWS: Mention this.

	Update MFD_* constants.
	* xlat/memfd_create_flags.in: Add MFD_HUGETLB introduced
	by kernel commit v4.14-rc1~126^2~17.
	* NEWS: Mention this.
	* tests/memfd_create.c (main): Update expected output.

	Update ETH_P_* constants.
	* xlat/ethernet_protocols.in: Add ETH_P_ERSPAN, ETH_P_NSH, ETH_P_IFE,
	and ETH_P_MAP introduced by kernel commits v4.14-rc1~130^2~164,
	v4.14-rc1~130^2~89^2~3, v4.14-rc1~130^2~90^2~2, and
	v4.14-rc1~130^2~78^2~2, respectively.
	* NEWS: Mention this.

	Update ARPHRD_* constants.
	* xlat/arp_hardware_types.in: Add ARPHRD_RAWIP introduced
	by kernel commit v4.14-rc1~130^2~78^2~1.
	* NEWS: Mention this.

	Update BPF_* constants.
	* xlat/bpf_attach_type.in: Add BPF_SK_SKB_STREAM_PARSER
	and BPF_SK_SKB_STREAM_VERDICT introduced by kernel commit
	v4.14-rc1~130^2~123^2~8.
	* xlat/bpf_map_flags.in: Add BPF_F_NO_COMMON_LRU and BPF_F_NUMA_NODE
	introduced by kernel commits v4.10-rc1~202^2~271^2~2
	and v4.14-rc1~130^2~196^2~1, respectively.
	* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_DEVMAP
	and BPF_MAP_TYPE_SOCKMAP introduced by kernel commits
	v4.14-rc1~130^2~497^2~4 and v4.14-rc1~130^2~234^2~4,
	respectively.
	* xlat/bpf_op_jmp.in: Add BPF_JLT, BPF_JLE, BPF_JSLT, and BPF_JSLE
	introduced by kernel commit v4.14-rc1~130^2~309^2~8.
	* xlat/bpf_prog_types.in: Add BPF_PROG_TYPE_SK_SKB introduced
	by kernel commit v4.14-rc1~130^2~234^2~6.
	* NEWS: Mention this.

	Update SO_* constants.
	* xlat/sockoptions.in: Add SO_ZEROCOPY introduced by kernel commit
	v4.14-rc1~130^2~376^2~5.
	* NEWS: Mention this.

	Update MADV_* constants.
	* xlat/madvise_cmds.in: Add MADV_WIPEONFORK and MADV_KEEPONFORK
	introduced by kernel commit v4.14-rc1~126^2.
	* NEWS: Mention this.

2017-09-08  Baruch Siach  <baruch@tkos.co.il>

	error_prints: fix potential program_invocation_name type conflict.
	uClibc-ng declares program_invocation_name as const.
	This causes the build failure below:

	error_prints.c:40:14: error: conflicting types for ‘program_invocation_name’
	 extern char *program_invocation_name;
	              ^~~~~~~~~~~~~~~~~~~~~~~
	In file included from error_prints.c:32:0:
	.../output/host/x86_64-buildroot-linux-uclibc/sysroot/usr/include/errno.h:54:20: note: previous declaration of ‘program_invocation_name’ was here
	 extern const char *program_invocation_name, *program_invocation_short_name;
	                    ^~~~~~~~~~~~~~~~~~~~~~~

	* error_prints.c (program_invocation_name): Declare only in case
	of [!HAVE_PROGRAM_INVOCATION_NAME].

2017-09-07  JingPiao Chen  <chenjingpiao@gmail.com>

	rtnl_tc_action: decode tcamsg netlink attributes.
	* rtnl_tc_action.c (tcamsg_nla_decoders): New array.
	(decode_tcamsg): Use it.

	tests: check decoding of TCA_STAB netlink attribute of tcmsg.
	* tests/test_nlattr.h (TEST_NESTED_NLATTR_ARRAY): New macro.
	* tests/nlattr_tca_stab.c: New file.
	* tests/gen_tests.in (nlattr_tca_stab): New entry.
	* tests/pure_executables.list: Add nlattr_tca_stab.
	* tests/.gitignore: Likewise.

	tests: check decoding of TCA_STATS2 netlink attribute of tcmsg.
	* tests/nlattr_tc_stats.c: New file.
	* tests/gen_tests.in (nlattr_tc_stats): New entry.
	* tests/pure_executables.list: Add nlattr_tc_stats.
	* tests/.gitignore: Likewise.

	tests: check decoding of tcmsg netlink attributes.
	* tests/nlattr_tcmsg.c: Include <stddef.h> and <linux/pkt_sched.h>.
	(main): Check decoding of TCA_STATS and TCA_RATE.

	rtnl_tc: decode tcmsg netlink attributes.
	* configure.ac (AC_CHECK_TYPES): Check for gnet_stats_basic,
	gnet_stats_queue, gnet_stats_rate_est,
	and gnet_stats_rate_est64 structures in <linux/gen_stats.h>.
	And check for struct tc_sizespec in <linux/pkt_sched.h>.
	* nlattr.h (tc_stats): New prototype.
	* rtnl_tc.c: Include <linux/gen_stats.h>, <linux/pkt_sched.h>,
	"xlat/rtnl_tca_stab_attrs.h" and "xlat/rtnl_tca_stats_attrs.h".
	(decode_tc_stats, decode_tc_estimator, decode_gnet_stats_basic,
	decode_gnet_stats_rate_est, decode_gnet_stats_queue,
	decode_gnet_stats_rate_est64, decode_nla_tc_stats,
	decode_tc_sizespec, print_stab_data, decode_tca_stab_data,
	decode_tca_stab): New functions.
	(tca_stats_nla_decoders, tca_stab_nla_decoders,
	tcmsg_nla_decoders): New arrays.
	(decode_tcmsg): Use tcmsg_nla_decoders.
	* xlat/rtnl_tca_stab_attrs.in: New file.
	* xlat/rtnl_tca_stats_attrs.in: Likewise.

2017-09-07  Dmitry V. Levin  <ldv@altlinux.org>

	Update TCP_* constants.
	* xlat/socktcpoptions.in: Add TCP_ULP and TCP_MD5SIG_EXT.
	* NEWS: Mention this.

	Update SOL_* constants.
	* xlat/socketlayers.in: Add SOL_TLS.
	* NEWS: Mention this.

2017-09-06  Dmitry V. Levin  <ldv@altlinux.org>

	Post-release administrivia.
	* NEWS: Add a header line for the next release.
	* debian/changelog.in: Add a changelog entry for 4.19-1.
	* strace.spec.in: Likewise.

2017-09-05  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for 4.19 release.
	* NEWS: Update for 4.19 release.

	.mailmap: add canonical name and address of Edgar Kaziakhmedov.
	* .mailmap: Add canonical name and address of Edgar Kaziakhmedov here
	to avoid duplications in CREDITS file.

	maint: add gen-tag-message.sh script.
	* maint/gen-tag-message.sh: New file.

	maint: add gen-contributors-list.sh script.
	* maint/gen-contributors-list.sh: New file.

2017-09-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update copyright headers.
	Headers updated automatically with

	    maint/update_copyright_headers.sh -c

2017-09-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	update_copyright_years.sh: add ability to automatically commit results.
	* maint/update_copyright_years.sh (DEFAULT_GIT_COMMIT_MESSAGE,
	GIT_COMMIT_MESSAGE): New variables.
	<-c>: New option, implies -a, calls git commit with GIT_COMMIT_TEMPLATE string
	as a template.

2017-09-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	configure.ac: specify minimal GNU Automake version.
	In order to provide better diagnostics.

	* configure.ac (AM_INIT_AUTOMAKE): Specify minimal GNU Automake version as
	1.13 due to usage of AM_EXTRA_RECURSIVE_TARGETS macro.

	Closes: https://github.com/strace/strace/issues/11

2017-09-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update NEWS.

2017-09-03  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of IFLA_XDP netlink attribute of ifinfomsg.
	* tests/nlattr_ifla_xdp.c: New file.
	* tests/gen_tests.in (nlattr_ifla_xdp): New entry.
	* tests/pure_executables.list: Add nlattr_ifla_xdp.
	* tests/.gitignore: Likewise.

	tests: check decoding of IFLA_PORT_SELF netlink attribute of ifinfomsg.
	* tests/nlattr_ifla_port.c: New file.
	* tests/gen_tests.in (nlattr_ifla_port): New entry.
	* tests/pure_executables.list: Add nlattr_ifla_port.
	* tests/.gitignore: Likewise.

	tests: check decoding of more ifinfomsg netlink attributes.
	* tests/nlattr_ifinfomsg.c (IFLA_LINKINFO, IFLA_VF_PORTS,
	IFLA_INFO_KIND, IFLA_VF_PORT): New macros.
	(main): Check decoding of IFLA_LINKINFO and IFLA_VF_PORTS.

	rtnl_link: decode more ifinfomsg netlink attributes.
	* configure.ac (AC_CHECK_TYPES): Check for struct ifla_port_vsi
	in <linux/if_link.h>.
	* rtnl_link.c: Include "xlat/rtnl_ifla_info_attrs.h",
	"xlat/rtnl_ifla_port_attrs.h", "xlat/rtnl_ifla_port_attrs.h",
	"xlat/rtnl_ifla_xdp_attrs.h", and "xlat/xdp_flags.h".
	(decode_ifla_linkinfo, decode_ifla_port_vsi,
	decode_ifla_port, decode_ifla_vf_ports,
	decode_ifla_xdp_flags, decode_ifla_xdp): New functions.
	(ifla_linkinfo_nla_decoders, ifla_port_nla_decoders,
	ifla_vf_port_nla_decoders, ifla_xdp_nla_decoders): New arrays.
	(ifinfomsg_nla_decoders) <IFLA_LINKINFO>: Use decode_ifla_linkinfo.
	<IFLA_VF_PORTS>: Use decode_ifla_vf_ports.
	<IFLA_PORT_SELF>: Use decode_ifla_port.
	<IFLA_XDP>: Use decode_ifla_xdp.
	* xlat/rtnl_ifla_info_attrs.in: New file.
	* xlat/rtnl_ifla_port_attrs.in: Likewise.
	* xlat/rtnl_ifla_vf_port_attrs.in: Likewise.
	* xlat/rtnl_ifla_xdp_attrs.in: Likewise.
	* xlat/xdp_flags.in: Likewise.

2017-09-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	keyctl: add support for KDF parameters decoding in KEYCTL_DH_COMPUTE.
	* fetch_struct_keyctl_kdf_params.c: New file.
	* keyctl_kdf_params.h: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* configure.ac: Add check for struct keyctl_kdf_params presence in
	<linux/keyctl.h>.
	* defs.h (struct strace_keyctl_kdf_params): Add forward declaration.
	* keyctl.c (keyctl_dh_compute): Add new parameter kdf_addr, print it
	on exiting.
	(SYS_FUNC(keyctl)) <case KEYCTL_DH_COMPUTE>: Pass arg5 to
	keyctl_dh_compute.
	* tests/keyctl.c: Include assert.h.
	(struct keyctl_kdf_params) [!HAVE_STRUCT_KEYCTL_KDF_PARAMS]: New
	definition.
	(STR32): New definition, copied from ioctl_dm.c.
	(append_str, kckdfp_to_str): New functions.
	(main): Update expected output, add checks for struct keyctl_kdf_params
	decoding.

	tests/keyctl: improve readability.
	* tests/keyctl.c: Since do_keyctl() has so convoluted calling convention
	and keyctl test is so complex, let's try to improve readability a bit
	with some conventions regarding do_keyctl() call formatting: arguments
	representing single keyctl argument should be put on the separate line,
	continuations of arguments related to the same keyctl argument should
	have additional indentation and termination 0UL should always be
	on a separate line.  Also, while we are here, let's add spaces
	to two type casts that are missing them.

2017-09-01  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	s390: update ioctl entries from linux 4.13.
	* linux/s390/ioctls_arch0.h: Update from linux v4.13-rc7 using ioctls_gen.sh.

2017-09-01  Dmitry V. Levin  <ldv@altlinux.org>

	mpers.awk: fix regression introduced by the previous cleanup.
	* mpers.awk (what_is): Remove returned_size from local variables.

	Fixes: v4.18-308-gfd3447b5 ("mpers.awk: declare local variables consistently")

2017-09-01  Dmitry V. Levin  <ldv@altlinux.org>

	rtnl_link: enhance decoding of struct rtnl_link_stats{,64}
	Enhance runtime detection of struct rtnl_link_stats.rx_nohandler
	and struct rtnl_link_stats64.rx_nohandler.

	* rtnl_link.c (decode_rtnl_link_stats): Do not accept structure length
	greater than min_size but less than sizeof(struct rtnl_link_stats).
	(decode_rtnl_link_stats64): Likewise, so not accept structure length
	greater than min_size but less than sizeof(struct rtnl_link_stats64).

2017-09-01  Dmitry V. Levin  <ldv@altlinux.org>

	rtnl_neightbl: enhance decoding of struct ndt_stats.
	Add support of kernels that operate with older definition of
	struct ndt_stats than the definition used to build strace.

	* rtnl_neightbl.c (decode_ndt_stats): Add runtime detection
	of struct ndt_stats.ndts_table_fulls field, print the field
	when it is available.

2017-09-01  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of IFLA_PROTINFO netlink attribute of ifinfomsg.
	* tests/nlattr_ifla_brport.c: New file.
	* tests/gen_tests.in (nlattr_ifla_brport): New entry.
	* tests/pure_executables.list: Add nlattr_ifla_brport.
	* tests/.gitignore: Likewise.
	* tests/test_nlattr.h (TEST_NESTED_NLATTR_OBJECT): New macro.

	rtnl_link: decode IFLA_PROTINFO netlink attribute of ifinfomsg.
	* configure.ac (AC_CHECK_TYPES): Check for ifla_bridge_id
	and rtnl_link_stats64 structures in <linux/if_link.h>.
	* rtnl_link.c: Include "xlat/rtnl_ifla_brport_attrs.h".
	(decode_ifla_bridge_id, decode_ifla_protinfo): New functions.
	(ifla_brport_nla_decoders): New array.
	(ifinfomsg_nla_decoders) <IFLA_PROTINFO>: Use decode_ifla_protinfo.
	* xlat/rtnl_ifla_brport_attrs.in: New file.

	tests: check decoding of ndtmsg netlink attributes.
	* tests/nlattr_ndtmsg.c (NDTA_PARMS, NDTPA_IFINDEX): New macros.
	(main): Check decoding of NDTA_CONFIG, NDTA_PARMS and NDTA_STATS.

	rtnl_neightbl: decode ndtmsg netlink attributes.
	* configure.ac (AC_CHECK_TYPES): Check for ndt_config
	and ndt_stats structures in <linux/neighbour.h>.
	(AC_CHECK_MEMBERS): Check for ndts_table_fulls field in struct ndt_stats.
	* rtnl_neightbl.c: Include "xlat/rtnl_neightbl_parms_attrs.h".
	(decode_ndt_config, decode_ndta_parms, decode_ndta_parms): New functions.
	(ndt_parms_nla_decoders, ndtmsg_nla_decoders): New arrays.
	(decode_ndtmsg): Use ndtmsg_nla_decoders.
	* xlat/rtnl_neightbl_parms_attrs.in: New file.

	tests: check decoding of ifaddrlblmsg netlink attributes.
	* tests/nlattr_ifaddrlblmsg.c (main): Check decoding of IFAL_ADDRESS.

	rtnl_addrlabel: decode ifaddrlblmsg netlink attributes.
	* rtnl_addrlabel.c (decode_ifal_address): New function.
	(ifaddrlblmsg_nla_decoders): New array.
	(decode_ifaddrlblmsg): Use it.

2017-09-01  Dmitry V. Levin  <ldv@altlinux.org>

	alpha: wire up new syscalls.
	* linux/alpha/syscallent.h [514..522]: New entries.

2017-08-31  JingPiao Chen  <chenjingpiao@gmail.com>

	tests/.gitignore: add missing files that should be ignored.
	* tests/.gitignore: Add is_linux_mips_n64.

2017-08-31  Dmitry V. Levin  <ldv@altlinux.org>

	mpers.awk: declare local variables consistently.
	* mpers.awk (compare_indices): Make c1 and c2 variables local.
	(enter): Make item variable local.
	(what_is): Make loc_diff, returned_size, and to_return local.

2017-08-30  Dmitry V. Levin  <ldv@altlinux.org>

	mpers.awk: separate local variables from real parameters by newline.
	* mpers.awk (array_get, update_upper_bound): Separate local variables
	from real parameters by newline.

2017-08-29  Dmitry V. Levin  <ldv@altlinux.org>

	rtnl_rule: enhance FRA_TABLE decoding.
	The attribute of FRA_TABLE is not just a 32-bit integer, some constants
	have well-known symbolic names like RT_TABLE_DEFAULT.

	* rtnl_rule.c (fib_rule_hdr_nla_decoders) <FRA_TABLE>:
	Use decode_nla_rt_class.
	* tests/nlattr_fib_rule_hdr.c (FRA_TABLE): New macro.
	(main): Check FRA_TABLE decoding.

2017-08-29  Dmitry V. Levin  <ldv@altlinux.org>

	rtnl_route: enhance RTA_TABLE decoding.
	The attribute of RTA_TABLE is not just a 32-bit integer, some constants
	have well-known symbolic names like RT_TABLE_DEFAULT.

	* nlattr.h (decode_nla_rt_class): New prototype.
	* rtnl_route.c (decode_nla_rt_class): New function.
	(rtmsg_nla_decoders) <RTA_TABLE>: Use it.
	* tests/nlattr_rtmsg.c (main): Check RTA_TABLE decoding.

2017-08-29  JingPiao Chen  <chenjingpiao@gmail.com>

	rtnl_nsid: decode rtgenmsg netlink attributes.
	* rtnl_nsid.c (rtgenmsg_nla_decoders): New array.
	(decode_rtgenmsg): Use it.

	rtnl_netconf: decode netconfmsg netlink attributes.
	* rtnl_netconf.c (netconfmsg_nla_decoders): New array.
	(decode_netconfmsg): Use it.

	tests: check decoding of ndmsg netlink attributes.
	* tests/nlattr_ndmsg.c: Include <netinet/in.h> and <arpa/inet.h>.
	(NDA_PORT): New macro.
	(main): Check decoding of NDA_DST, NDA_CACHEINFO and NDA_PORT.

	rtnl_neigh: decode ndmsg netlink attributes.
	* nlattr.c: Include <netinet/in.h> and <arpa/inet.h>.
	(decode_nla_be16): New function.
	* nlattr.h (decode_nla_be16): New prototype.
	* rtnl_neigh.c (decode_neigh_addr,
	decode_nda_cacheinfo): New functions.
	(ndmsg_nla_decoders): New array.
	(decode_ndmsg): Use it.

	tests: check decoding of fib_rule_hdr netlink attributes.
	* tests/nlattr_fib_rule_hdr.c: Include <inttypes.h>.
	(FRA_TUN_ID, FRA_UID_RANGE): New macros.
	(main): Check decoding of FRA_DST, FRA_UID_RANGE and FRA_TUN_ID.

	rtnl_rule: decode fib_rule_hdr netlink attributes.
	* configure.ac (AC_CHECK_FUNCS): Add be64toh.
	(AC_CHECK_TYPES): Check for struct fib_rule_uid_range
	in <linux/fib_rules.h>.
	* nlattr.c: Include <endian.h>.
	(decode_nla_be64): New function.
	* nlattr.h (decode_nla_be64): New prototype.
	* rtnl_rule.c (decode_rule_addr,
	decode_fib_rule_uid_range): New functions.
	(fib_rule_hdr_nla_decoders): New array.
	(decode_fib_rule_hdr): Use it.

	rtnl_neigh: fix ndm_type field decode in struct ndmsg.
	* defs.h (routing_types): New xlat prototype.
	* rtnl_neigh.c (decode_ndmsg): Fix ndm_type decode.
	* xlat/nda_types.in: Remove it.
	* tests/netlink_route.c (test_rtnl_neigh): Update the test.
	* tests/nlattr_ndmsg.c (init_ndmsg, print_ndmsg): Likewise.

2017-08-28  Dmitry V. Levin  <ldv@altlinux.org>

	Disallow more than one signal= specification in an injection expression.
	Specifying several signal= specifications in an injection expressions
	makes no sense.

	* filter_qualify.c (parse_inject_token): Disallow second
	signal= specification.
	* strace.1.in: Document it.
	* tests/qual_inject-syntax.test: Check it.

2017-08-28  Dmitry V. Levin  <ldv@altlinux.org>

	Add "flags" field to struct inject_data.
	Introduce "flags" field to struct inject_data and use it instead
	of magic rval and signo constants.
	Due to layout of struct inject_data, this new field does not change
	sizeof(struct inject_data).

	* defs.h (INJECT_F_RETVAL, INJECT_F_SIGNAL): New macros.
	(INJECT_OPTS_RVAL_DEFAULT): Remove macro.
	(struct inject_data): Add "flags" field.
	* filter_qualify.c (parse_inject_token, qualify_inject_common): Check
	struct inject_data.flags instead of inject_data.rval
	and inject_data.signo, do not initialize inject_opts.data.
	* syscall.c (tamper_with_syscall_entering): Check struct
	inject_data.flags instead of inject_data.rval and inject_data.signo.

2017-08-28  Dmitry V. Levin  <ldv@altlinux.org>
	    Victor Krapivensky  <krapivenskiy.va@phystech.edu>

	Move inject data of struct inject_opts to inject_data substructure.
	* defs.h (inject_data): New structure.
	(struct inject_opts): Replace "signo" and "rval" fields with "data"
	field of type "struct inject_data".
	* filter_qualify.c (parse_inject_token, qualify_inject_common): Update
	for the new layout of struct inject_opts.
	* syscall.c (tamper_with_syscall_entering, tamper_with_syscall_exiting):
	Likewise.

2017-08-28  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Update ioctl entries from linux v4.13-rc7.
	* linux/32/ioctls_inc_align16.h: Update from linux v4.13-rc7 using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* linux/arm/ioctls_arch0.h: Likewise.
	* linux/i386/ioctls_arch0.h: Likewise.
	* linux/powerpc/ioctls_arch0.h: Likewise.
	* linux/s390x/ioctls_arch0.h: Likewise.
	* linux/x86_64/ioctls_arch0.h: Likewise.
	* NEWS: Mention this.

2017-08-28  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of ifinfomsg netlink attributes.
	* tests/nlattr_ifinfomsg.c: Include <stddef.h> and <linux/if_link.h>.
	(IFLA_LINK_NETNSID): New macro.
	(main): Check decoding of IFLA_LINK_NETNSID,
	IFLA_STATS, IFLA_MAP and IFLA_STATS64.

	rtnl_link: decode ifinfomsg netlink attributes.
	* configure.ac (AC_CHECK_HEADERS): Add linux/if_link.h.
	(AC_CHECK_TYPES): Check for struct rtnl_link_stats64
	in <linux/if_link.h>.
	(AC_CHECK_MEMBERS): Check for rx_nohandler field
	in struct rtnl_link_stats/rtnl_link_stats64.
	* rtnl_link.c: Include <linux/if_link.h>.
	(decode_rtnl_link_stats, decode_rtnl_link_ifmap,
	decode_rtnl_link_stats64): New functions.
	(ifinfomsg_nla_decoders): New array.
	(decode_ifinfomsg): Use it.

2017-08-28  Dmitry V. Levin  <ldv@altlinux.org>
	    Eugene Syromyatnikov  <evgsyr@gmail.com>

	Imply RVAL_DECODED when RVAL_IOCTL_PARSED is returned on entering.
	Also, rename RVAL_IOCTL_PARSED to RVAL_IOCTL_DECODED as the latter
	is a more suitable name.

	* defs.h (RVAL_IOCTL_PARSED): Rename to RVAL_IOCTL_DECODED.
	* ioctl.c (ioctl_decode): Update comment.
	(SYS_FUNC(ioctl)): Replace RVAL_IOCTL_PARSED with RVAL_IOCTL_DECODED,
	add convertation of RVAL_IOCTL_DECODED to RVAL_DECODED.
	* block.c (block_ioctl): Replace RVAL_DECODED | RVAL_IOCTL_PARSED
	with RVAL_IOCTL_DECODED on entering.  Replace RVAL_IOCTL_PARSED
	with RVAL_IOCTL_DECODED on exiting.
	* btrfs.c (btrfs_ioctl): Likewise.
	* evdev.c: Likewise.
	* file_ioctl.c: Likewise.
	* fs_x_ioctl.c: Likewise.
	* hdio.c: Likewise.
	* loop.c: Likewise.
	* mtd.c: Likewise.
	* nsfs.c: Likewise.
	* print_sg_req_info.c: Likewise.
	* ptp.c: Likewise.
	* rtc.c: Likewise.
	* scsi.c: Likewise.
	* sg_io_v3.c: Likewise.
	* sg_io_v4.c: Likewise.
	* sock.c: Likewise.
	* term.c: Likewise.
	* ubi.c: Likewise.
	* userfaultfd.c: Likewise.
	* dm.c (dm_known_ioctl): Return RVAL_IOCTL_DECODED on exiting and 0
	on entering.  Replace RVAL_IOCTL_PARSED with RVAL_IOCTL_DECODED
	on exiting.
	* v4l2.c: Likewise.

2017-08-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Replace return 1 ioctl sub-decoder hack with proper flag.
	* defs.h (RVAL_IOCTL_PARSED): Introduce new flag for ioctl sub-decoders
	* to signalise that they have successfully printed argument.
	* ioctl.c (SYS_FUNC(ioctl)): Check for RVAL_IOCTL_PARSED flag, remove
	un-set it before returning the value.
	* block.c: Use RVAL_IOCTL_PARSED instead of 1.
	* btrfs.c: Likewise.
	* dm.c: Likewise.
	* evdev.c: Likewise.
	* file_ioctl.c: Likewise.
	* fs_x_ioctl.c: Likewise.
	* hdio.c: Likewise.
	* loop.c: Likewise.
	* mtd.c: Likewise.
	* nsfs.c: Likewise.
	* print_sg_req_info.c: Likewise.
	* ptp.c: Likewise.
	* rtc.c: Likewise.
	* scsi.c: Likewise.
	* sg_io_v3.c: Likewise.
	* sg_io_v4.c: Likewise.
	* sock.c: Likewise.
	* term.c: Likewise.
	* ubi.c: Likewise.
	* userfaultfd.c: Likewise.
	* v4l2.c: Likewise.

2017-08-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	v4l2: streamline logic.
	Move exiting path out of if (entering(tcp)) { ... return 0; } else,
	provide common exit point in v4l2_ioctl handler, use break instead of
	return in specific command handlers.

	* v4l2.c (print_v4l2_format, print_v4l2_buffer, print_v4l2_standard,
	print_v4l2_input, print_v4l2_frmivalenum): Move exiting path out of else
	par of the entering(tcp) condition.
	(v4l2_ioctl): Add return RVAL_DECODED | 1 at the end of function.
	(v4l2_ioctl) <case VIDIOC_S_STD, case VIDIOC_S_INPUT>: Replace return
	with break.

2017-08-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	v4l2: reorder field printing in order to avoid auxstr usage.
	Also rework flow a little in order to reduce amount of indentation.

	* v4l2.c (print_v4l2_requestbuffers): Print count as the last field on
	entering, append it with updated value on exiting.
	* tests/ioctl_v4l2.c: Update expected output.

2017-08-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	userfaultfd: streamline logic.
	Make userfaultfd ioctl handling more in line with other ioctl decoders.

	* userfaultfd.c (uffdio_ioctl): Return RVAL_DECODED | 1, break instead
	of returning in specific command handlers, return 0 on entering paths,
	move exiting paths out of else branch of entering(tcp) condition.

2017-08-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Do not return RVAL_DECODED on exiting path of ioctl decoders.
	* print_sg_req_info.c (decode_sg_req_info): Return 1 instead of
	RVAL_DECODED | 1 on exiting path.
	* scsi.c (decode_sg_scsi_id): Likewise.
	* sg_io_v3.c (decode_response): Likewise.
	* sg_io_v4.c (decode_response): Likewise.

2017-08-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	dm: return RVAL_DECODED instead of 0 if we can't decode command.
	Return RVAL_DECODED if we can't decode command in order to avoid being
	called on exiting.

	* dm.c (dm_ioctl): Return RVAL_DECODED instead of 0 if command can't be
	decoded.

2017-08-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	Return 0 instead of 1 on entering path of ioctl decoders.
	As returning 1 (without RVAL_DECODED) on entering makes no sense.

	* block.c (block_ioctl) <case BLKTRACESETUP>: Replace return 1 with
	return 0 on entering path.
	* ptp.c (ptp_ioctl) <case PTP_SYS_OFFSET>: Likewise.
	* sg_io_v3.c (decode_request): Likewise.
	* sg_io_v4.c (decode_request): Likewise.
	* sock.c (decode)ifconf, sock_ioctl) <case SIOCGIFMAP>: Likewise.
	* ubi.c (ubi_ioctl) <case UBI_IOCMKVOL, case UBI_IOCATT>: Likewise.
	* v4l2.c (print_v4l2_ext_controls): Likewise.

2017-08-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ioctl: simplify ioctl_decode handling, document its return value semantics
	* ioctl.s (SYS_FUNC(ioctl.c)): Unconditionally unset 1, simply print arg
	when (ret & RVAL_DECODED) && !(ret & 1).

2017-08-28  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	syscall.c: define personality names for all multi-personality architectures
	I see no reason for not having these definitions for SPARC64 and RISC-V.
	Also, borrow the check template from supported_personalities.h.

	* syscall.c (update_personality) [defined RISCV, defined SPARC64]
	<PERSONALITY_NAMES>: Define it for these architectures.

2017-08-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	copyright-year-gen: workaround for old git versions.
	Apply the same treatment to this script as the one in
	v4.18-278-g295cf32.

	* copyright-year-gen <year>: Change format to format:%cD, remove --date,
	supply output as a -d option argument to date +%Y.

2017-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ubi: trim overly long lines.

	term: use print_quoted_string.
	* term.c (decode_termios): Use print_quoted_string for printing c_cc field
	instead of writing the printing code by hand.

2017-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	update_copyright_years.sh: workaround for old git versions.
	Old git versions (like the one shipped in Debian 8) do not support setting
	date format with --date, working this around by processing git log output
	with date +%Y.

	* main/update_copyright_years.sh (process_file) <first_commit_year,
	last_commit_year>: Change format to format:%aD, remove --date, supply
	output as a -d option argument to date +%Y.

2017-08-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	syscall: use spaces in tile personality names, de-duplicate definition.
	As Chris Metcalf, the author of v4.7-40-g0b99a8a, told in private, there
	is no strong reason for having tile's personality name different from
	personality names on other architectures, so let's use spaces instead of
	dashes here. And, while we are here, remove duplication of personality
	name definitions for various architectures.

	* syscall.c (update_personality) [defined TILE]: Change dashes to spaces
	in personality names.

2017-08-26  JingPiao Chen  <chenjingpiao@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of rtmsg netlink attributes.
	* tests/nlattr_rtmsg.c: Include <netinet/in.h> and <arpa/inet.h>.
	(LWTUNNEL_ENCAP_NONE, RTA_ENCAP_TYPE): New macros.
	(main): Check decoding of RTA_DST, RTA_OIF, RTA_METRICS, RTA_MULTIPATH,
	RTA_CACHEINFO, RTA_MFC_STATS, RTA_VIA, and RTA_ENCAP_TYPE.

	rtnl_route: decode rtmsg netlink attributes.
	* configure.ac (AC_CHECK_TYPES): Check for
	rta_mfc_stats and rtvia structures in <linux/rtnetlink.h>.
	* nlattr.c (decode_nla_ifindex): New function.
	* nlattr.h (decode_nla_ifindex): New prototype.
	* rtnl_route.c (decode_route_addr, decode_rta_metrics,
	decode_rta_multipath, decode_rta_cacheinfo,
	decode_rta_mfc_stats, decode_rtvia,
	decode_rta_encap_type): New functions.
	(rta_metrics_nla_decoders, rtmsg_nla_decoders): New arrays.
	(decode_rtmsg): Use rtmsg_nla_decoders.
	* xlat/lwtunnel_encap_types.in: New file.
	* xlat/route_nexthop_flags.in: Likewise.
	* xlat/rtnl_rta_metrics_attrs.in: Likewise.

2017-08-25  Dmitry V. Levin  <ldv@altlinux.org>

	s390: wire up s390_guarded_storage syscall.
	* linux/s390/syscallent.h [378]: Add s390_guarded_storage entry.
	* linux/s390x/syscallent.h: Likewise.

	microblaze: wire up statx syscall.
	* linux/microblaze/syscallent.h [398]: Add statx entry.

2017-08-24  Dmitry V. Levin  <ldv@altlinux.org>

	alloc_number_set_array: add ATTRIBUTE_MALLOC.
	* number_set.h: Include "gcc_compat.h".
	(alloc_number_set_array): Add ATTRIBUTE_MALLOC.

2017-08-24  Nikolay Marchuk  <marchuk.nikolay.a@gmail.com>

	Add macros for testing QUAL_* flags.
	* defs.h (traced, raw, inject): Add macros for testing QUAL_TRACE,
	QUAL_RAW, and QUAL_INJECT flags.
	* syscall.c (syscall_entering_trace, syscall_exiting_trace): Use them.

2017-08-24  Dmitry V. Levin  <ldv@altlinux.org>

	Remove QUAL_SIGNAL, QUAL_READ and QUAL_WRITE.
	Remove these flags that are unused since commit v4.15~26.
	They might be introduced later with a different meaning.

	* defs.h (QUAL_SIGNAL, QUAL_READ, QUAL_WRITE): Remove.

2017-08-24  Eugene Syromiatnikov  <evgsyr@gmail.com>

	xstrdup, xtrndup: allow NULL argument.
	Accept NULL argument in xstrdup and xtrndup functions to allow use
	of "xstrdup(str)" instead of "str ? xstrdup(str) : NULL".

	* xmalloc.c (xstrdup, xstrndup): Handle NULL argument.
	* xmalloc.h: Add comment regarding this deviation from the behaviour
	of the POSIX counterparts of these functions.

2017-08-23  Dmitry V. Levin  <ldv@altlinux.org>

	tests: really skip mips o32 scno tampering tests on mips n64.
	* tests/is_linux_mips_n64.c: New file.
	* tests/Makefile.am (check_PROGRAMS): Add it.
	* tests/scno_tampering.sh <$STRACE_ARCH == mips>:
	In case of mips o32 abi, skip the test if is_linux_mips_n64 says
	that the kernel is mips n64, even if "uname -m" claims it's mips.

2017-08-22  Dmitry V. Levin  <ldv@altlinux.org>

	Hide struct number_set implementation details from users.
	* number_set.h (number_slot_t, struct number_set): Move to number_set.c.
	(struct number_set): Add forward declaration.
	(read_set, write_set, signal_set): Change prototypes from objects
	to pointers.
	* filter_qualify.c (read_set, write_set, signal_set): Change definitions
	from objects to pointers.
	(abbrev_set, inject_set, raw_set, trace_set, verbose_set): Change
	definitions from arrays to pointers.
	(qualify_read): Initialize read_set before first use.
	(qualify_write): Initialize write_set before first use.
	(qualify_signals): Initialize signal_set before first use.
	(qualify_trace): Initialize trace_set before first use.
	(qualify_abbrev): Initialize abbrev_set before first use.
	(qualify_verbose): Initialize verbose_set before first use.
	(qualify_raw): Initialize raw_set before first use.
	(qualify_inject_common): Initialize inject_set before first use.
	* strace.c (print_signalled, print_stopped): Update signal_set usage.
	* syscall.c (dumpio): Update usage of read_set and write_set.

	Extend number_set interface.
	* number_set.h (number_set_array_is_empty, is_number_in_set_array,
	add_number_to_set_array, clear_number_set_array,
	invert_number_set_array, alloc_number_set_array, free_number_set_array):
	New function prototypes.
	* number_set.c (number_set_array_is_empty, is_number_in_set_array,
	add_number_to_set_array, clear_number_set_array,
	invert_number_set_array, alloc_number_set_array, free_number_set_array):
	New functions.
	* basic_filters.c (qualify_syscall_number, qualify_syscall_regex,
	qualify_syscall_class, qualify_syscall_name): Use
	add_number_to_set_array.
	(qualify_syscall_tokens, qualify_tokens): Use
	clear_number_set_array and invert_number_set_array.
	* filter_qualify.c (qualify_inject_common): Use alloc_number_set_array,
	number_set_array_is_empty, is_number_in_set_array,
	add_number_to_set_array, and free_number_set_array.
	(qual_flags): Use is_number_in_set_array.

	Move number_set interface to separate files.
	* number_set.c: New file.
	* number_set.h: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* basic_filters.c: Include "number_set.h".
	(number_slot_t, struct number_set): Move to number_set.h.
	(BITS_PER_SLOT, number_setbit, number_isset, reallocate_number_set,
	add_number_to_set, is_number_in_set): Move to number_set.c.
	* defs.h (struct number_set): Remove forward declaration.
	(read_set, write_set, signal_set, is_number_in_set): Move to number_set.h.
	* filter.h (add_number_to_set): Move to number_set.h.
	* filter_qualify.c: Include "number_set.h".
	(number_slot_t, struct number_set): Remove.
	* strace.c: Include "number_set.h".
	* syscall.c: Likewise.

2017-08-22  Edgar Kaziakhmedov  <edgar.kaziakhmedov@virtuozzo.com>

	Move SUPPORTED_PERSONALITIES to a separate file.
	Since the defs.h contains unrelated declarations which are
	redundant (and sometimes conflicting) for other binaries included
	in the strace package, move SUPPORTED_PERSONALITIES defintions
	to a separate file.

	* defs.h: Include "supported_personalities.h".
	(SUPPORTED_PERSONALITIES): Move ...
	* supported_personalities.h: ... to the new file.
	* Makefile.am (strace_SOURCES): Add it.

2017-08-22  Edgar Kaziakhmedov  <edgar.kaziakhmedov@virtuozzo.com>

	Move string_to_uint* functions to a separate file.
	Make string_to_uint* functions available to other binaries
	included in the strace package.

	* string_to_uint.h: New file.
	* defs.h: Include it.
	(string_to_uint_ex, string_to_uint_upto, string_to_uint): Move
	to string_to_uint.h.
	* util.c (string_to_uint_ex, string_to_uint): Move ...
	* string_to_uint.c: ... to the new file.
	* Makefile.am (strace_SOURCES): Add string_to_uint.h and string_to_uint.c.

2017-08-22  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of ifaddrmsg netlink attributes.
	* tests/nlattr_ifaddrmsg.c: Include <arpa/inet.h>.
	(IFA_FLAGS, SET_IFA_FAMILY): New macros.
	(init_ifaddrmsg): Set ifaddrmsg.ifa_family field from ifa_family.
	(print_ifaddrmsg): Print ifaddrmsg.ifa_family field using ifa_family_str.
	(main): Check decoding of IFA_ADDRESS, IFA_CACHEINFO, and IFA_FLAGS.

	rtnl_addr: decode ifaddrmsg netlink attributes.
	* rtnl_addr.c (decode_ifa_address,
	decode_ifa_cacheinfo, decode_ifa_flags): New functions.
	(ifaddrmsg_nla_decoders): New array.
	(decode_ifaddrmsg): Use it.

2017-08-22  Dmitry V. Levin  <ldv@altlinux.org>

	Export decode_inet_addr.
	* defs.h (decode_inet_addr): New prototype.
	* netlink_inet_diag.c (decode_inet_addr): Remove static keyword, move ...
	* sockaddr.c: ... here.

	netlink_inet_diag: prepare decode_inet_addr for export.
	* netlink_inet_diag.c (decode_inet_addr): Change return type to bool,
	parametrize field name using new var_name argument.
	(decode_inet_diag_hostcond): Specify "addr" field name
	to decode_inet_addr.

2017-08-20  Dmitry V. Levin  <ldv@altlinux.org>

	print_inet_addr: add support of invocations without field name.
	Prepare print_inet_addr for use in structureless contexts where
	no structure field name is available.

	* sockaddr.c (print_inet_addr): Handle var_name == NULL.

2017-08-19  Dmitry V. Levin  <ldv@altlinux.org>

	print_inet_addr: print address of unsupported family in hex.
	* sockaddr.c (print_inet_addr): Specify QUOTE_FORCE_HEX
	to print_quoted_string.

2017-08-18  Dmitry V. Levin  <ldv@altlinux.org>

	mips o32: do not bail out in get_syscall_args if umoven fails.
	If the kernel contains commit 84d77d3f06e7e8dea057d10e8ec77ad71f721be3,
	both PTRACE_PEEKDATA and process_vm_readv become unavailable when the
	process dumpable flag is cleared.  As the first 4 syscall arguments are
	still available via registers, do not treat this as get_syscall_args
	error.

	This condition is triggered and therefore tested by prctl-dumpable test.

	* linux/mips/get_syscall_args.c (get_syscall_args) [LINUX_MIPSO32]:
	Do not bail out if umoven fails.

2017-08-17  Dmitry V. Levin  <ldv@altlinux.org>

	configure: cleanup struct statfs/statfs64 member checks.
	* configure.ac <AC_CHECK_TYPES([struct statfs])>: Merge several
	AC_CHECK_MEMBERS checks of struct statfs members into a single check.
	<AC_CHECK_TYPES([struct statfs64])>: Likewise, for checks
	of struct statfs64 members.

2017-08-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix a few harmless -Woverflow compilation warnings.
	Fix the following compilation warnings on platforms where
	sizeof(struct timeval.tv_usec) < sizeof(long):

	xettimeofday.c: In function ‘main’:
	xettimeofday.c:76:16: warning: overflow in implicit constant conversion [-Woverflow]
	  tv->tv_usec = (long) 0xbadc0dedfacefeedLL;
	xetitimer.c: In function ‘main’:
	xetitimer.c:170:28: warning: overflow in implicit constant conversion [-Woverflow]
	  p_new->it_value.tv_usec = (long) 0xbadc0dedfacefeedLL;
	In file included from utimes.c:38:0:
	xutimes.c: In function ‘main’:
	xutimes.c:110:18: warning: overflow in implicit constant conversion [-Woverflow]
	  tv[1].tv_usec = (long) 0xbadc0dedfacefeedLL;
	futimesat.c: In function ‘main’:
	futimesat.c:121:18: warning: overflow in implicit constant conversion [-Woverflow]
	  tv[1].tv_usec = (long) 0xbadc0dedfacefeedLL;
	In file included from _newselect.c:35:0:
	xselect.c: In function ‘main’:
	xselect.c:94:16: warning: overflow in implicit constant conversion [-Woverflow]
	  tv->tv_usec = (long) 0xbadc0dedfacefeedLL;
	                ^
	* tests/futimesat.c (main): In initialization of struct timeval.tv_usec,
	change explicit cast from (long) to (suseconds_t).
	* tests/xetitimer.c: Likewise.
	* tests/xettimeofday.c: Likewise.
	* tests/xselect.c: Likewise.
	* tests/xutimes.c: Likewise.

	Reported-by: Anatoly Pugachev <matorola@gmail.com>

2017-08-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix sigaction.test on sparc.
	On sparc, the first argument of old sigaction syscall has negated
	semantics, compared to other architectures.  While sigaction.test
	was aware about this arch-specific detail from the beginning, in one
	of many sigaction syscall invocations a non-negative signal number
	was erroneously passed on sparc.

	* tests/sigaction.c (ADDR_INT, SIGNO_INT): New arch-specific macros.
	(signo, addr): Use them.

2017-08-16  Dmitry V. Levin  <ldv@altlinux.org>

	nlattr: fix printing of unrecognized attribute data.
	Do not print more than "nlattr.nla_len - NLA_HDRLEN" bytes
	of unrecognized attribute data.

	* nlattr.c (decode_nlattr_with_data): Specify "nla_len - NLA_HDRLEN"
	instead of "len - NLA_HDRLEN" as the size of unrecognized attribute
	data.
	* tests/nlattr.c (test_nlattr): Check it.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_ROUTE rtgenmsg attributes.
	* tests/nlattr_rtgenmsg.c: New file.
	* tests/gen_tests.in (nlattr_rtgenmsg): New entry.
	* tests/pure_executables.list: Add nlattr_rtgenmsg.
	* tests/.gitignore: Likewise.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: add basic decoding of NETLINK_ROUTE rtgenmsg attributes.
	* rtnl_nsid.c: Include "nlattr.h" and "xlat/rtnl_nsid_attrs.h".
	(decode_rtgenmsg): Call decode_nlattr.
	* xlat/rtnl_nsid_attrs.in: New file.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_ROUTE br_port_msg attributes.
	* tests/nlattr_br_port_msg.c: New file.
	* tests/gen_tests.in (nlattr_br_port_msg): New entry.
	* tests/pure_executables.list: Add nlattr_br_port_msg.
	* tests/.gitignore: Likewise.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: add basic decoding of NETLINK_ROUTE br_port_msg attributes.
	* rtnl_mdb.c: Include "netlink.h", "nlattr.h".
	and "xlat/rtnl_mdb_attrs.h".
	(decode_br_port_msg): Call decode_nlattr.
	* xlat/rtnl_mdb_attrs.in: New file.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_ROUTE netconfmsg attributes.
	* tests/nlattr_netconfmsg.c: New file.
	* tests/gen_tests.in (nlattr_netconfmsg): New entry.
	* tests/pure_executables.list: Add nlattr_netconfmsg.
	* tests/.gitignore: Likewise.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: add basic decoding of NETLINK_ROUTE netconfmsg attributes.
	* rtnl_netconf.c: Include "netlink.h", "nlattr.h",
	and "xlat/rtnl_netconf_attrs.h".
	(decode_netconfmsg): Call decode_nlattr.
	* xlat/rtnl_netconf_attrs.in: New file.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_ROUTE dcbmsg attributes.
	* tests/nlattr_dcbmsg.c: New file.
	* tests/gen_tests.in (nlattr_dcbmsg): New entry.
	* tests/pure_executables.list: Add nlattr_dcbmsg.
	* tests/.gitignore: Likewise.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: add basic decoding of NETLINK_ROUTE dcbmsg attributes.
	* rtnl_dcb.c: Include "netlink.h", "nlattr.h",
	and "xlat/rtnl_dcb_attrs.h".
	(decode_dcbmsg): Call decode_nlattr.
	* xlat/rtnl_dcb_attrs.in: New file.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_ROUTE ifaddrlblmsg attributes.
	* tests/nlattr_ifaddrlblmsg.c: New file.
	* tests/gen_tests.in (nlattr_ifaddrlblmsg): New entry.
	* tests/pure_executables.list: Add nlattr_ifaddrlblmsg.
	* tests/.gitignore: Likewise.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: add basic decoding of NETLINK_ROUTE ifaddrlblmsg attributes.
	* rtnl_addrlabel.c: Include "netlink.h", "nlattr.h",
	and "xlat/rtnl_addrlabel_attrs.h".
	(decode_ifaddrlblmsg): Call decode_nlattr.
	* xlat/rtnl_addrlabel_attrs.in: New file.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_ROUTE tcamsg attributes.
	* tests/nlattr_tcamsg.c: New file.
	* tests/gen_tests.in (nlattr_tcamsg): New entry.
	* tests/pure_executables.list: Add nlattr_tcamsg.
	* tests/.gitignore: Likewise.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: add basic decoding of NETLINK_ROUTE tcamsg attributes.
	* rtnl_tc_action.c: Include "nlattr.h" and "xlat/rtnl_tc_action_attrs.h".
	(decode_tcamsg): Call decode_nlattr.
	* xlat/rtnl_tc_action_attrs.in: New file.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_ROUTE tcmsg attributes.
	* tests/nlattr_tcmsg.c: New file.
	* tests/gen_tests.in (nlattr_tcmsg): New entry.
	* tests/pure_executables.list: Add nlattr_tcmsg.
	* tests/.gitignore: Likewise.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: add basic decoding of NETLINK_ROUTE tcmsg attributes.
	* rtnl_tc.c: Include "nlattr.h" and "xlat/rtnl_tc_attrs.h".
	(decode_tcmsg): Call decode_nlattr.
	* xlat/rtnl_tc_attrs.in: New file.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_ROUTE ndtmsg attributes.
	* tests/nlattr_ndtmsg.c: New file.
	* tests/gen_tests.in (nlattr_ndtmsg): New entry.
	* tests/pure_executables.list: Add nlattr_ndtmsg.
	* tests/.gitignore: Likewise.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: add basic decoding of NETLINK_ROUTE ndtmsg attributes.
	* rtnl_neightbl.c: Include "nlattr.h" and "xlat/rtnl_neightbl_attrs.h".
	(decode_ndtmsg): Call decode_nlattr.
	* xlat/rtnl_neightbl_attrs.in: New file.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_ROUTE ndmsg attributes.
	* tests/nlattr_ndmsg.c: New file.
	* tests/gen_tests.in (nlattr_ndmsg): New entry.
	* tests/pure_executables.list: Add nlattr_ndmsg.
	* tests/.gitignore: Likewise.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: add basic decoding of NETLINK_ROUTE ndmsg attributes.
	* rtnl_neigh.c: Include "nlattr.h" and "xlat/rtnl_neigh_attrs.h".
	(decode_ndmsg): Call decode_nlattr.
	* xlat/rtnl_neigh_attrs.in: New file.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_ROUTE fib_rule_hdr attributes.
	* tests/nlattr_fib_rule_hdr.c: New file.
	* tests/gen_tests.in (nlattr_fib_rule_hdr): New entry.
	* tests/pure_executables.list: Add nlattr_fib_rule_hdr.
	* tests/.gitignore: Likewise.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: add basic decoding of NETLINK_ROUTE fib_rule_hdr attributes.
	* rtnl_rule.c: Include "nlattr.h" and "xlat/rtnl_rule_attrs.h".
	(decode_fib_rule_hdr): Call decode_nlattr.
	* xlat/rtnl_rule_attrs.in: New file.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_ROUTE rtmsg attributes.
	* tests/nlattr_rtmsg.c: New file.
	* tests/gen_tests.in (nlattr_rtmsg): New entry.
	* tests/pure_executables.list: Add nlattr_rtmsg.
	* tests/.gitignore: Likewise.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: add basic decoding of NETLINK_ROUTE rtmsg attributes.
	* rtnl_route.c: Include "nlattr.h" and "xlat/rtnl_route_attrs.h".
	(decode_rtmsg): Call decode_nlattr.
	* xlat/rtnl_route_attrs.in: New file.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_ROUTE ifaddrmsg attributes.
	* tests/nlattr_ifaddrmsg.c: New file.
	* tests/gen_tests.in (nlattr_ifaddrmsg): New entry.
	* tests/pure_executables.list: Add nlattr_ifaddrmsg.
	* tests/.gitignore: Likewise.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: add basic decoding of NETLINK_ROUTE ifaddrmsg attributes.
	* rtnl_addr.c: Include "nlattr.h" and "xlat/rtnl_addr_attrs.h".
	(decode_ifaddrmsg): Call decode_nlattr.
	* xlat/rtnl_addr_attrs.in: New file.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_ROUTE ifinfomsg attributes.
	* tests/nlattr_ifinfomsg.c: New file.
	* tests/gen_tests.in (nlattr_ifinfomsg): New entry.
	* tests/pure_executables.list: Add nlattr_ifinfomsg.
	* tests/.gitignore: Likewise.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: add basic decoding of NETLINK_ROUTE ifinfomsg attributes.
	* rtnl_link.c: Include "nlattr.h" and "xlat/rtnl_link_attrs.h".
	(decode_ifinfomsg): Call decode_nlattr.
	* xlat/rtnl_link_attrs.in: New file.

2017-08-15  Dmitry V. Levin  <ldv@altlinux.org>

	tests/test_nlattr.h: include <stdint.h>
	* tests/test_nlattr.h: Include <stdint.h> for definition of uint16_t
	used by init_nlattr.

	tests: use ifindex_lo and IFINDEX_LO_STR.
	* tests/netlink_route.c: Do not check for HAVE_IF_INDEXTONAME.
	(if_nametoindex, IFINDEX_LO): Remove.
	(test_rtnl_link, test_rtnl_addr, test_rtnl_neigh, test_rtnl_tc,
	test_rtnl_addrlabel, test_rtnl_mdb): Use ifindex_lo instead
	of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
	* tests/netlink_sock_diag.c: Do not check for HAVE_IF_INDEXTONAME.
	(if_nametoindex, IFINDEX_LO): Remove.
	(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
	test_inet_diag_msg, test_smc_diag_req): Use ifindex_lo instead
	of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.
	* tests/nlattr_inet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
	(if_nametoindex, IFINDEX_LO): Remove.
	(init_inet_diag_msg): Use ifindex_lo instead of if_nametoindex.
	(print_inet_diag_msg): Use IFINDEX_LO_STR instead of hardcoded string.
	* tests/nlattr_inet_diag_req_compat.c: Do not check
	for HAVE_IF_INDEXTONAME.
	(if_nametoindex, IFINDEX_LO): Remove.
	(init_inet_diag_req): Use ifindex_lo instead of if_nametoindex.
	(print_inet_diag_req): Use IFINDEX_LO_STR instead of hardcoded string.
	* tests/nlattr_inet_diag_req_v2.c: Do not check for HAVE_IF_INDEXTONAME.
	(if_nametoindex, IFINDEX_LO): Remove.
	(init_inet_diag_req_v2, print_inet_diag_req_v2,
	test_inet_diag_bc_dev_cond): Use ifindex_lo instead of if_nametoindex,
	use IFINDEX_LO_STR instead of hardcoded string.
	* tests/nlattr_packet_diag_msg.c: Do not check for HAVE_IF_INDEXTONAME.
	(if_nametoindex, IFINDEX_LO): Remove.
	(main): Use ifindex_lo instead of if_nametoindex.
	(print_packet_diag_mclist): Use IFINDEX_LO_STR instead of hardcoded
	string.

	tests/net-sockaddr: use ifindex_lo and IFINDEX_LO_STR.
	* tests/net-sockaddr.c (if_nametoindex): Remove declaration.
	(check_in6_linklocal, check_ll): Remove HAVE_IF_INDEXTONAME checks,
	Use ifindex_lo instead of if_nametoindex, use IFINDEX_LO_STR instead
	of hardcoded string.

	tests/msg_control: use ifindex_lo and IFINDEX_LO_STR.
	* tests/msg_control.c (test_ip_pktinfo): Use ifindex_lo instead
	of if_nametoindex, use IFINDEX_LO_STR instead of hardcoded string.

	tests/inet-cmsg: use IFINDEX_LO_STR.
	* tests/inet-cmsg.c (print_pktinfo): Use IFINDEX_LO_STR instead
	of hardcoded string.

	tests/ip_mreq: use ifindex_lo and IFINDEX_LO_STR.
	* tests/ip_mreq.c: Do not check for HAVE_IF_INDEXTONAME.
	(main): Use ifindex_lo instead of if_nametoindex, use IFINDEX_LO_STR
	instead of hardcoded string.

	tests/group_req: use ifindex_lo and IFINDEX_LO_STR.
	* tests/group_req.c: Do not check for HAVE_IF_INDEXTONAME.
	(main): Use ifindex_lo instead of if_nametoindex, use IFINDEX_LO_STR
	instead of hardcoded string.

	tests: add ifindex_lo function and IFINDEX_LO_STR macro to libtests.
	* tests/ifindex.c: New file.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.
	* tests/tests.h (ifindex_lo): New prototype.
	(IFINDEX_LO_STR): New macro.

2017-08-15  JingPiao Chen  <chenjingpiao@gmail.com>

	configure.ac: remove redundant linux/dcbnl.h header check.
	* configure.ac (AC_CHECK_HEADERS): Remove linux/dcbnl.h.
	* rtnl_dcb.c: Replace HAVE_LINUX_DCBNL_H with HAVE_STRUCT_DCBMSG.
	* tests/netlink_route.c: Likewise.

2017-08-14  Eugene Syromyatnikov  <evgsyr@gmail.com>

	pathtrace: fix typo in comment.

	pathtrace: limit amount of checked poll fds similarly to select limit.
	* pathtrace.c (pathtrace_match_set): Limit the maximum descriptor number
	checked for fd match in poll family syscalls to 1024 * 1024.

	pathtrace: fail poll path match on first failed umove.
	* pathtrace.c (pathtrace_match_set): When checking descriptors of poll
	family syscalls for fd match, break the loop on first failed umove call.

2017-08-14  JingPiao Chen  <chenjingpiao@gmail.com>

	Update NEWS.

2017-08-14  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	tests: check decoding of rtnetlink nsid messages.
	* tests/netlink_route.c (test_rtnl_nsid): New function.
	(main): Use it.

	netlink: add a basic rtnetlink parser of nsid messages.
	* rtnl_nsid.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* netlink_route.h (decode_rtgenmsg): New prototype.
	* netlink_route.c (route_decoders): Add RTM_DELNSID, RTM_GETNSID,
	and RTM_NEWNSID.

	tests: check decoding of rtnetlink mdb messages.
	* tests/netlink_route.c: Include <netinet/in.h>
	and <linux/if_bridge.h>.
	(test_rtnl_mdb): New function.
	(main): Use it.

	netlink: add a basic rtnetlink parser of mdb messages.
	* rtnl_mdb.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* netlink_route.h (decode_br_port_msg): New prototype.
	* configure.ac (AC_CHECK_TYPES): Check for struct br_port_msg
	in <linux/if_bridge.h>.
	* netlink_route.c (route_decoders): Add RTM_DELMDB, RTM_GETMDB,
	and RTM_NEWMDB.

	tests: check decoding of rtnetlink netconf messages.
	* tests/netlink_route.c: Include <linux/netconf.h>.
	(test_rtnl_netconf): New function.
	(main): Use it.

	netlink: add a basic rtnetlink parser of netconf messages.
	* rtnl_netconf.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* netlink_route.h (decode_netconfmsg): New prototype.
	* configure.ac (AC_CHECK_TYPES): Check for struct netconfmsg
	in <linux/netconf.h>.
	* netlink_route.c (route_decoders): Add RTM_GETNETCONF
	and RTM_NEWNETCONF.

	tests: check decoding of rtnetlink dcb messages.
	* tests/netlink_route.c: Include <linux/dcbnl.h>.
	(test_rtnl_dcb): New function.
	(main): Use it.

	netlink: add a basic rtnetlink parser of dcb messages.
	* rtnl_dcb.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* netlink_route.h (decode_dcbmsg): New prototype.
	* configure.ac (AC_CHECK_HEADERS): Add linux/dcbnl.h.
	(AC_CHECK_TYPES): Check for struct dcbmsg in <linux/dcbnl.h>.
	* netlink_route.c (route_decoders): Add RTM_GETDCB and RTM_SETDCB.
	* xlat/dcb_commands.in: New file.

	tests: check decoding of rtnetlink addrlabel messages.
	* tests/netlink_route.c: Include <linux/if_addrlabel.h>.
	(test_rtnl_addrlabel): New function.
	(main): Use it.

	netlink: add a basic rtnetlink parser of addrlabel messages.
	* rtnl_addrlabel.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* netlink_route.h (decode_ifaddrlblmsg): New prototype.
	* configure.ac (AC_CHECK_TYPES): Check for struct ifaddrlblmsg
	in <linux/if_addrlabel.h>.
	* netlink_route.c (route_decoders): Add RTM_DELADDRLABEL,
	RTM_GETADDRLABEL, and RTM_NEWADDRLABEL.

	tests: check decoding of rtnetlink tc action messages.
	* tests/netlink_route.c (test_rtnl_tca): New function.
	(main): Use it.

	netlink: add a basic rtnetlink parser of tc action messages.
	* rtnl_tc_action.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* netlink_route.h (decode_tcamsg): New prototype.
	* netlink_route.c (route_decoders): Add RTM_DELACTION, RTM_GETACTION,
	and RTM_NEWACTION.

	tests: check decoding of rtnetlink tc messages.
	* tests/netlink_route.c (test_rtnl_tc): New function.
	(main): Use it.

	netlink: add a basic rtnetlink parser of tc messages.
	* rtnl_tc.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* netlink_route.h (decode_tcmsg): New prototype.
	* netlink_route.c (route_decoders): Add RTM_DELQDISC,
	RTM_GETQDISC, RTM_NEWQDISC, RTM_DELTCLASS, RTM_GETTCLASS,
	RTM_NEWTCLASS, RTM_DELTFILTER, RTM_GETTFILTER, and RTM_NEWTFILTER.

	tests: check decoding of rtnetlink neightbl messages.
	* tests/netlink_route.c (test_rtnl_neightbl): New function.
	(main): Use it.

	netlink: add a basic rtnetlink parser of neightbl messages.
	* rtnl_neightbl.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* netlink_route.h (decode_ndtmsg): New prototype.
	* netlink_route.c (route_decoders): Add RTM_GETNEIGHTBL,
	RTM_NEWNEIGHTBL, and RTM_SETNEIGHTBL.

	tests: check decoding of rtnetlink neigh messages.
	* tests/netlink_route.c: Include <linux/neighbour.h>.
	(test_rtnl_neigh): New function.
	(main): Use it.

	netlink: add a basic rtnetlink parser of neigh messages.
	* rtnl_neigh.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* netlink_route.h (decode_ndmsg, decode_rtm_getneigh): New prototypes.
	* configure.ac (AC_CHECK_HEADERS): Add linux/neighbour.h.
	* netlink_route.c (route_decoders): Add RTM_DELNEIGH, RTM_DELNEIGH,
	and RTM_NEWNEIGH.
	* xlat/nda_types.in: New file.
	* xlat/neighbor_cache_entry_flags.in: Likewise.
	* xlat/neighbor_cache_entry_states.in: Likewise.

	tests: check decoding of rtnetlink rule messages.
	* tests/netlink_route.c: Include <linux/fib_rules.h>.
	(test_rtnl_rule): New function.
	(main): Use it.

	netlink: add a basic rtnetlink parser of rule messages.
	* defs.h (routing_table_ids): New xlat prototype.
	* rtnl_rule.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (ip_type_of_services, routing_table_ids): New xlat prototypes.
	* netlink_route.h (decode_fib_rule_hdr): New prototype.
	* configure.ac (AC_CHECK_HEADERS): Add linux/fib_rules.h.
	* netlink_route.c (route_decoders): Add RTM_DELRULE, RTM_GETRULE,
	and RTM_NEWRULE.
	* xlat/fib_rule_actions.in: New file.
	* xlat/fib_rule_flags.in: Likewise.

	tests: check decoding of rtnetlink route messages.
	* tests/netlink_route.c: Include <linux/ip.h>.
	(test_rtnl_route): New function.
	(main): Use it.

	netlink: add a basic rtnetlink parser of route messages.
	* defs.h (routing_scopes): New xlat prototype.
	* rtnl_route.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* netlink_route.h (decode_rtmsg): New prototype.
	* netlink_route.c (route_decoders): Add RTM_DELROUTE, RTM_GETROUTE,
	and RTM_NEWROUTE.
	* xlat/ip_type_of_services.in: New file.
	* xlat/routing_flags.in: Likewise.
	* xlat/routing_protocols.in: Likewise.
	* xlat/routing_table_ids.in: Likewise.
	* xlat/routing_types.in: Likewise.

	tests: check decoding of rtnetlink addr messages.
	* tests/netlink_route.c: Include <linux/if_addr.h>.
	(test_rtnl_addr): New function.
	(main): Use it.

2017-08-13  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: add a basic rtnetlink parser of addr messages.
	* rtnl_addr.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* configure.ac (AC_CHECK_HEADERS): Add linux/if_addr.h.
	* netlink_route.h (decode_ifaddrmsg): New prototype.
	* netlink_route.c (route_decoders): Add RTM_DELADDR,
	RTM_GETADDR, RTM_GETANYCAST, RTM_GETMULTICAST, and RTM_NEWADDR.
	* xlat/ifaddrflags.in: New file.
	* xlat/routing_scopes.in: Likewise.

2017-08-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Make description of discrepancies between libc and kernel APIs more relevant
	Looks like this part was untouched since the days strace supported OSes
	other than Linux. Well, it's time to make it more contemporary.

	* strace.1.in (.SH NOTES): Use faccessat(2) and setrlimit(2)/prlimit(2)
	instead of time(2) and stat(2)/xstat(2) as examples of libc/kernel API
	discrepancies.

2017-08-11  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NLMSG_DONE messages of NETLINK_ROUTE.
	* tests/netlink_route.c (test_nlmsg_done): New function.
	(main): Use it.

2017-08-11  Nikolay Marchuk  <marchuk.nikolay.a@gmail.com>

	Add TF flag to inotify_add_watch syscall entries.
	The second argument of the inotify_add_watch syscall is a file name,
	but inotify_add_watch has no TF flag set.

	* linux/32/syscallent.h (inotify_add_watch): Add TF flag.
	* linux/64/syscallent.h: Likewise.
	* linux/alpha/syscallent.h: Likewise.
	* linux/arm/syscallent.h: Likewise.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/crisv10/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/powerpc64/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/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

2017-08-11  Nikolay Marchuk  <marchuk.nikolay.a@gmail.com>

	pathtrace: fix matching of execveat syscall.
	* pathtrace.c (pathtrace_match_set): Add testing of SEN_execveat.

2017-08-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1: add indentation to examples.
	* strace.1 (.de CW): Add .in +4n.
	(.de CE): Add .in.

	Generate date for the man page.
	* Makefile.am (dist-hook): Add .strace.1.in.date generation.
	* strace.spec.in (%setup): Likewise.
	* configure.ac (manpage_date): New m4 define.
	(MANPAGE_DATE): New define/subst.
	* strace.1 (.TH): Add manpage date and strace's version.

	Add script for generating date of the last commit for specific file.
	* file-date-gen: New auxiliary script.

	Make strace.1 generated.
	* .gitignore (/strace.1): New entry.
	* configure.ac (AC_CONFIG_FILES): Add strace.1.
	* strace.1.in: Rename from strace.1.

2017-08-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1: format synopsis using .SY/.OP macros.
	Also, add .OM and .OR macros and use { ... | ... } syntax for indicating
	possible options regarding mandatory arguments.

	* strace.1 (.OM, .OR): New macro definitions, based on .OP
	(.SH SYNOPSYS): Format using .SY/.OP/.OM/.OR. Put -p/command inside
	{ ... | ... } block.

2017-08-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1: remove date from .TH, as it is no longer relevant.
	* strace.1 (.TH): Remove date.

2017-08-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1: remove .IX definition.
	It is present in groff macros nowadays.

	* strace.1 (.de IX): Remove.

2017-08-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1: replace .TP with .TQ between command-line option variants.
	In order to eliminate unneeded space between them.

	* strace.1 (Filtering): Replace .TP with .TQ between different variants
	of the same option.

2017-08-09  Dmitry V. Levin  <ldv@altlinux.org>

	rtnl_link: include "netlink.h" before <linux/rtnetlink.h>
	<sys/socket.h> has to be included before <linux/netlink.h> because
	the latter used to be incomplete in older kernel headers.

	As a local wrapper file called netlink.h was introduced earlier
	to workaround this and related portability issues, include it before
	<linux/rtnetlink.h> that in turn includes <linux/netlink.h>.

	This fixes build on systems with older kernel headers.

	* rtnl_link.c: Include "netlink.h" before <linux/rtnetlink.h>.

2017-08-09  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	tests: check decoding of rtnetlink link messages.
	* tests/netlink_route.c: Include <linux/if_arp.h>.
	(TEST_NL_ROUTE): New macro.
	(test_rtnl_link): New function.
	(main): Use it.

	netlink: add a basic rtnetlink parser of link messages.
	* netlink_route.h: New file.
	* rtnl_link.c: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* defs.h (arp_hardware_types, iffflags): New xlat prototypes.
	* netlink_route.c: Include "netlink_route.h"
	and <linux/rtnetlink.h>.
	(netlink_route_decoder_t): New typedef.
	(route_decoders): New array.
	(decode_netlink_route): Use it.

2017-08-09  JingPiao Chen  <chenjingpiao@gmail.com>

	Move nl_route_types definition from netlink.c to netlink_route.c.
	The side effect of #include "xlat/nl_route_types.h" is
	RTM_* constants properly defined in that header file.
	While netlink.c does not use these constants itself,
	netlink_route.c is going to need them soon.

	* defs.h (nl_route_types): New xlat prototype.
	* netlink.c: Move inclusion of "xlat/nl_route_types.h" ...
	* netlink_route.c: ... here.

2017-08-09  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	tests: check netlink family specific decoder of NETLINK_ROUTE.
	* tests/netlink_route.c: Include <stdint.h>,
	include "test_netlink.h" instead of "netlink.h".
	(test_rtnl_unspec): New function.
	(main): Use it.

	netlink: introduce family specific decoder of NETLINK_ROUTE.
	* netlink_route.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (decode_netlink_route): New prototype.
	* netlink.c (netlink_decoders): Add NETLINK_ROUTE.

2017-08-08  JingPiao Chen  <chenjingpiao@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of NETLINK_KOBJECT_UEVENT messages.
	* tests/netlink_kobject_uevent.c: New file.
	* tests/gen_tests.in (netlink_kobject_uevent): New entry.
	* tests/pure_executables.list: Add netlink_kobject_uevent.
	* tests/.gitignore: Likewise.

2017-08-08  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink: add decoding of NETLINK_KOBJECT_UEVENT messages.
	* netlink.c (decode_netlink): Print NETLINK_KOBJECT_UEVENT messages
	as a string using printstrn.

2017-08-08  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink: call get_fd_nl_family before nlmsghdr decoding.
	Prepare for decoding of NETLINK_KOBJECT_UEVENT.  Messages of the latter,
	unlike traditional netlink families, don't contain a header at all.

	* netlink.c (NL_FAMILY_*): Remove enum.
	(get_fd_nl_family): Replace NL_FAMILY_ERROR with -1.
	(decode_nlmsg_type): Update the comment.
	Skip family specific type decoders for type < NLMSG_MIN_TYPE.
	(decode_nlmsghdr_with_payload): Skip family specific decoders
	for type < NLMSG_MIN_TYPE && type != NLMSG_DONE.
	(print_nlmsghdr): Move get_fd_nl_family invocation ...
	(decode_nlmsghdr_with_payload): ... here.

2017-08-07  Dmitry V. Levin  <ldv@altlinux.org>

	Make sysent_shorthand_defs.h suitable for tests.
	* sysent_shorthand_defs.h [STRACE_TESTS_H]: Add shorthand notations from
	tests/ksysent.c and tests/nsyscalls.c.
	* tests/ksysent.c: Remove shorthand notations.
	* tests/nsyscalls.c: Likewise.

2017-08-07  Edgar Kaziakhmedov  <edgar.kaziakhmedov@virtuozzo.com>

	Move sysent shorthand notations to separate files.
	Avoid proliferation of exactly the same definitions of shorthand
	notations for macros defined in sysent.h by moving definitions
	and undefs of these shorthand notations to separate files.

	* sysent_shorthand_defs.h: New file.
	* sysent_shorthand_undefs.h: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* syscall.c: Use them.

2017-08-07  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink.c: fix indentation.
	* netlink.c (print_cookie): Fix indentation.

2017-08-07  Edgar Kaziakhmedov  <edgar.kaziakhmedov@virtuozzo.com>

	Move err/mem subroutines to separate files.
	In order to allow usage of utility functions by other binaries
	included in the strace package (like the upcoming asinfo utility),
	these functions should be moved to separate files.

	* error_prints.h: New file.
	* xmalloc.h: Likewise.
	* defs.h: Include "xmalloc.h" and "error_prints.h".
	(error_msg, error_msg_and_die, error_msg_and_help, perror_msg,
	perror_msg_and_die): Move to error_prints.h.
	(xcalloc, xmalloc, xreallocarray, xstrdup, xstrndup): Move to xmalloc.h.
	* strace.c (die): Remove static quialifier to make visible
	by error_prints.c.
	(error_msg, error_msg_and_die, error_msg_and_help, perror_msg,
	perror_msg_and_die, verror_msg): Move ...
	* error_prints.c: ... to the new file.
	* xmalloc.c: Include "config.h", <stdlib.h>, <string.h>,
	"error_prints.h", and "xmalloc.h" instead of "defs.h".
	Use int instead of bool.  Fix codestyle.
	* Makefile.am (strace_SOURCES): Add error_prints.c, error_prints.h,
	and xmalloc.h.

2017-08-07  Nikolay Marchuk  <marchuk.nikolay.a@gmail.com>

	tests: move check_* functions from options-syntax.test to separate file.
	* tests/options-syntax.test: Move check_* functions to ...
	* tests/syntax.sh: ... new file.
	* tests/Makefile.am (EXTRA_DIST): Add syntax.sh.

2017-08-07  Nikolay Marchuk  <marchuk.nikolay.a@gmail.com>

	Split qualify.c into basic_filters.c and filter_qualify.c.
	This change also exports add_number_to_set, qualify_tokens,
	and qualify_syscall_tokens.

	* basic_filters.c: New file, part of qualify.c.
	* filter_qualify.c: Likewise.
	* filter.h: New file.
	* qualify.c: Remove.
	* Makefile.am (strace_SOURCES): Add new files, remove qualify.c.

2017-08-06  Dmitry V. Levin  <ldv@altlinux.org>

	Simplify handling of unexpected tracees.
	* strace.c (maybe_allocate_tcb) <WIFSTOPPED(status) && !followfork>:
	Remove the dance around possible re-injection of WSTOPSIG(status)
	as the only observable stop here is the initial ptrace-stop.

	Fix handling of unexpected tracees when PTRACE_SEIZE is not in use.
	* strace.c (maybe_allocate_tcb) <WIFSTOPPED(status) && !followfork>:
	The expected ptrace stop signal in case of !use seize is not
	syscall_trap_sig but SIGSTOP.  An idea of using PTRACE_GETSIGINFO to
	distinguish signal stops that should be re-injected from other kinds
	of stops didn't work out due to kernel implementation peculiarities
	of initial ptrace-stop.

	pathtrace: fix matching of symlinkat syscall.
	* pathtrace.c (pathtrace_match_set) <SEN_symlinkat>: The first argument
	of symlinkat syscall is not a path but an arbitrary string, ignore it.

2017-08-06  Nikolay Marchuk  <marchuk.nikolay.a@gmail.com>

	pathtrace: fix missing syscalls.
	* pathtrace.c (pathtrace_match_set): Fix symlink decoding,
	disable pathtracing for inotify_init.

2017-08-06  Dmitry V. Levin  <ldv@altlinux.org>

	Enhance fflush error diagnostics.
	* strace.c (flush_tcp_output): New function.
	(line_ended, droptcb, print_event_exit): Use it to flush tcp->outf.
	* tests/fflush.c: New file.
	* tests/fflush.test: New test.
	* tests/Makefile.am (MISC_TESTS): Add it.
	* tests/.gitignore: Add fflush.
	* tests/pure_executables.list: Likewise.

	tests: check handling of CLONE_PARENT'ed and CLONE_PTRACE'ed processes.
	* tests/clone_parent.c: New file.
	* tests/clone_ptrace.c: Likewise.
	* tests/clone_parent.test: New test.
	* tests/clone_ptrace.test: Likewise.
	* tests/.gitignore: Add clone_parent and clone_ptrace.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(MISC_TESTS): Add clone_parent.test and clone_ptrace.test.

	tests: export a path to the trace executable to check_PROGRAMS.
	* tests/init.sh (STRACE_EXE): Initialize from $STRACE and export.

2017-08-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Makefile.am: build top directory first.
	This solves potential issues when tests run first and strace is rebuilt
	only after they have finished.  As noted in [1], providing the current
	directory explicitly should help.

	[1] https://www.gnu.org/software/automake/manual/html_node/Subdirectories.html

	* Makefile.am (SUBDIRS): Prepend the current directory.

2017-08-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Improve handling of unexpected tracees.
	When receiving a ptrace stop of an unexpected child, handle it
	in the most transparent way possible:
	- detach it instead of PTRACE_CONT'ing;
	- send it the signal with which it has been stopped.
	This should hopefully help to deal with processes that have been created
	with misused CLONE_PTRACE flag set.

	* strace.c (maybe_allocate_tcb) <WIFSTOPPED(status) && !followfork>:
	Calculate the signal similarly to the way next_event does,
	forward it to the unexpected tracee, and detach the tracee.

2017-08-04  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix unaligned access in nlattr.test.
	* tests/nlattr.c (test_nlattr): Use SET_STRUCT
	to initialize potentially unaligned struct nlattr.

	tests: fix unaligned access in nlattr_packet_diag_msg.test.
	* tests/nlattr_packet_diag_msg.c (init_packet_diag_msg): Use SET_STRUCT
	to initialize potentially unaligned struct packet_diag_msg.

2017-08-04  Dmitry V. Levin  <ldv@altlinux.org>

	sparc64: do not bail out in get_scno if PTRACE_PEEKTEXT fails.
	If the kernel contains commit 84d77d3f06e7e8dea057d10e8ec77ad71f721be3,
	PTRACE_PEEKTEXT becames unavailable when the process dumpable flag is
	cleared.  As this is not a fatal condition for get_scno, do not bail out
	if PTRACE_PEEKTEXT fails.

	This condition is triggered and therefore tested by prctl-dumpable test.

	* linux/sparc64/get_scno.c (arch_get_scno): Do not bail out
	if PTRACE_PEEKTEXT fails.

2017-08-02  Dmitry V. Levin  <ldv@altlinux.org>

	tests: enhance test coverage of printstrn and umoven.
	* tests/printstrn-umoven.c: New file.
	* tests/printstrn-umoven-peekdata.c: Likewise.
	* tests/printstrn-umoven-undumpable.c: Likewise.
	* tests/printstrn-umoven-legacy.test: New test.
	* tests/Makefile.am (MISC_TESTS): Add printstrn-umoven-legacy.test.
	* tests/gen_tests.in (printstrn-umoven, printstrn-umoven-peekdata,
	printstrn-umoven-undumpable): New entries.
	* tests/pure_executables.list: Add printstrn-umoven,
	printstrn-umoven-peekdata, and printstrn-umoven-undumpable.
	* tests/.gitignore: Likewise.

	tests: add test_printstrn function to libtests.
	* tests/test_ucopy.h (test_printstrn): New prototype.
	* tests/test_printstrn.c: New file.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.

2017-08-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests: enhance test coverage of printpath and umovestr.
	* tests/init.sh (TIMEOUT_DURATION): Raise from 300 to 600.
	* tests/printpath-umovestr.c: New file.
	* tests/printpath-umovestr-peekdata.c: Likewise.
	* tests/printpath-umovestr-undumpable.c: Likewise.
	* tests/printpath-umovestr-legacy.test: New test.
	* tests/Makefile.am (MISC_TESTS): Add printpath-umovestr-legacy.test.
	* tests/gen_tests.in (printpath-umovestr, printpath-umovestr-peekdata,
	printpath-umovestr-undumpable): New entries.
	* tests/pure_executables.list: Add printpath-umovestr,
	printpath-umovestr-peekdata, and printpath-umovestr-undumpable.
	* tests/.gitignore: Likewise.

	tests: add test_printpath function to libtests.
	* tests/test_ucopy.h (test_printpath): New prototype.
	* tests/test_printpath.c: New file.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.

	tests: add test_process_vm_readv and test_ptrace_peekdata to libtests.
	* tests/test_ucopy.c: New file.
	* tests/test_ucopy.h: Likewise.
	* tests/Makefile.am (libtests_a_SOURCES): Add them.

2017-08-01  Dmitry V. Levin  <ldv@altlinux.org>

	printpath: do not fetch more than PATH_MAX bytes from tracee's memory.
	The kernel does not copy more than PATH_MAX bytes from userspace
	pathnames, treating non-NUL-terminated pathnames as ENAMETOOLONG.

	* util.c (printpathn): Decrease buffer size to PATH_MAX.
	(printpath): Specify PATH_MAX - 1 as the maximum pathname length
	to match the kernel behaviour.  The underlying umovestr call will fetch
	up to PATH_MAX bytes from tracee's memory, but no more than first
	PATH_MAX - 1 bytes will be printed.

2017-07-31  Dmitry V. Levin  <ldv@altlinux.org>

	ucopy: cleanup umoven_peekdata and umovestr_peekdata.
	* ucopy.c (umoven_peekdata, umovestr_peekdata): Merge aligned
	and unaligned tracee address cases.

2017-07-31  Dmitry V. Levin  <ldv@altlinux.org>

	ucopy: move legacy fallbacks of umoven and umovestr to separate functions
	Move legacy PTRACE_PEEKDATA-based support to separate functions.

	* ucopy.c (umoven_peekdata, umovestr_peekdata): New functions.
	(umoven, umovestr): Use them.

2017-07-31  Dmitry V. Levin  <ldv@altlinux.org>

	ucopy: move process_vm_readv ENOSYS check to vm_read_mem.
	* ucopy.c (vm_read_mem): Set process_vm_readv_not_supported in case
	of ENOSYS.
	* ucopy.c (umoven, umovestr): Do not set process_vm_readv_not_supported.

2017-07-31  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Print enabled optional features in strace version output.
	In order to provide information to user what optionally built features
	are available.

	* strace.c (print_version): New variable "features".  Print features string
	after non-liability disclaimer (or "(none)" in case it is empty).
	(print_version) [USE_LIBUNWIND]: Concatenate "stack-unwind" into features
	string.
	* tests/strace-V.tests (getoption): New function.
	Update check in accordance with updated output.

2017-07-31  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/strace-V.test: rename getval to getstr.
	As this name is more suitable.

	* tests/strace-V (getval): Rename to getstr, update all call sites.

2017-07-30  Dmitry V. Levin  <ldv@altlinux.org>

	ucopy: refactor the check for invalid tracee addresses.
	* ucopy.c (tracee_addr_is_invalid): New function.
	* ucopy.c (umoven, umovestr): Use it.

	ucopy: enhance vm_read_mem error diagnostics.
	* ucopy.c (umoven, umovestr): Enhance vm_read_mem error diagnostics
	to match PTRACE_PEEKDATA case.

2017-07-29  Dmitry V. Levin  <ldv@altlinux.org>

	ucopy: skip redundant tracee address truncation check.
	* ucopy.c (vm_read_mem): Skip raddr != truncated_raddr check
	if these variables have the same data size.

2017-07-28  Dmitry V. Levin  <ldv@altlinux.org>

	util: move umoven and umovestr to a separate file.
	These functions are more kernel-specific compared to all other functions
	defined in util.c.

	* ucopy.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* util.c (umoven, umovestr): Move to ucopy.c.

2017-07-27  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: enhance decoding of BPF_MAP_LOOKUP_ELEM and BPF_MAP_GET_NEXT_KEY.
	Print union bpf_attr.value field of BPF_MAP_LOOKUP_ELEM command
	and union bpf_attr.next_key field of BPF_MAP_GET_NEXT_KEY command
	on entering syscall.  These fields are addresses specified to the
	kernel from userspace.  The amount of data written by the kernel
	to these addresses is specified at the map creation time
	by BPF_MAP_CREATE command and is not available at this point.

	* bpf.c (decode_BPF_MAP_LOOKUP_ELEM): Print union bpf_attr.value
	on entering syscall.
	(decode_BPF_MAP_GET_NEXT_KEY): Print union bpf_attr.next_key
	on entering syscall.
	(bpf_map_io): Remove.
	* tests/bpf.c (print_BPF_MAP_DELETE_ELEM_first,
	print_BPF_MAP_DELETE_ELEM_attr, print_BPF_MAP_GET_NEXT_KEY_first,
	print_BPF_MAP_GET_NEXT_KEY_attr): Replace macro redirects with
	new functions.
	(print_BPF_MAP_LOOKUP_ELEM_first, print_BPF_MAP_LOOKUP_ELEM_attr,

2017-07-27  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: update BPF_MAP_CREATE decoding.
	Implement decoding of map_flags and inner_map_fd fields of union bpf_attr
	for BPF_MAP_CREATE command introduced by linux kernel commits
	v4.6-rc1~91^2~108^2~6 and v4.12-rc1~64^3~373^2~2, respectively.

	* configure.ac: Check for inner_map_fd member of union bpf_attr
	instead of max_entries.
	* xlat/bpf_map_flags.in: New file.
	* bpf.c: Include "xlat/bpf_map_flags.h".
	(decode_BPF_MAP_CREATE): Add map_flags and inner_map_fd fields
	to the structure, print them.
	* tests/bpf.c: Update macro guards of BPF_MAP_CREATE decoder test.
	(init_BPF_MAP_CREATE_first, print_BPF_MAP_CREATE_attr): Update expected
	output.
	(init_BPF_MAP_CREATE_attr): Initialize map_flags and inner_map_fd
	fields, update offset.

2017-07-27  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: update BPF_PROG_LOAD decoding.
	Implement decoding of union bpf_attr.prog_flags field for BPF_PROG_LOAD
	command introduced by linux kernel commit v4.12-rc2~34^2~29^2~2.

	* configure.ac: Check for prog_flags member of union bpf_attr
	instead of kern_version.
	* xlat/bpf_prog_flags.in: New file.
	* bpf.c: Include "xlat/bpf_prog_flags.h".
	(decode_BPF_PROG_LOAD): Add prog_flags field to the structure, print it.
	* tests/bpf.c: Update macro guards of BPF_PROG_LOAD decoder test.
	(init_BPF_PROG_LOAD_first, print_BPF_PROG_LOAD_attr): Update expected
	output.
	(init_BPF_PROG_LOAD_attr): Initialize prog_flags field, update offset.

2017-07-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests: enhance test coverage of bpf syscall parser.
	* configure.ac: Update union bpf_attr member checks.
	* tests/bpf.c: Rewrite.
	* tests/bpf-v.c: New file.
	* tests/gen_tests.in (bpf-v): New entry.
	* tests/pure_executables.list: Add bpf-v.
	* tests/.gitignore: Likewise.

	m4: macroize union bpf_attr field checks.
	* m4/st_bpf.m4: New file.
	* configure.ac: Use st_CHECK_UNION_BPF_ATTR.

	Move offsetofend from defs.h to macros.h.
	* defs.h (offsetofend): Move ...
	* macros.h: ... here.

2017-07-26  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: print unused fields of union bpf_attr if one of them is non-zero.
	When the size argument specifies more data than necessary for the given
	command, kernel checks that all unused fields of union bpf_attr are
	zero.  Print this extra data when it contains non-zero bytes to enhance
	debugging experience.

	* bpf.c (decode_attr_extra_data): New function.
	(decode_BPF_MAP_CREATE, decode_BPF_MAP_UPDATE_ELEM,
	decode_BPF_MAP_DELETE_ELEM, bpf_map_io, decode_BPF_PROG_LOAD,
	decode_BPF_OBJ_PIN, decode_BPF_OBJ_GET, decode_BPF_PROG_ATTACH,
	decode_BPF_PROG_DETACH): Use it to print extra data passed
	via bpf_attr pointer.
	(bpf_obj_manage, bpf_prog_attach_detach): Remove.
	* tests/bpf.c (map_delete_elem): New function.
	(main): Use it.

2017-07-26  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: change handling of big and unaccessible data to match the kernel.
	When the size argument exceeds PAGE_SIZE, the kernel fails with E2BIG
	without parsing union bpf_attr.
	When the whole chunk of memory specified by addr and size arguments is
	not readable, the kernel fails with EFAULT.

	* bpf.c (DECL_BPF_CMD_DECODER) <bpf_cmd_decoder>: Add const qualifier
	to size argument, add data argument.
	(decode_BPF_MAP_CREATE, decode_BPF_MAP_UPDATE_ELEM,
	decode_BPF_MAP_DELETE_ELEM, bpf_map_io, decode_BPF_PROG_LOAD,
	bpf_obj_manage, bpf_prog_attach_detach): Move size argument check and
	memory fetching ...
	(SYS_FUNC(bpf)) ... here, add PAGE_SIZE check, pass fetched memory
	to command-specific parsers.

2017-07-25  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: replace big switch statement with a dispatch table.
	* bpf.c (DECL_BPF_CMD_DECODER, DEF_BPF_CMD_DECODER, BPF_CMD_ENTRY):
	New macros.
	(bpf_cmd_decoder_t): New typedef.
	Rename static parser functions using DEF_BPF_CMD_DECODER.
	(decode_BPF_MAP_LOOKUP_ELEM, decode_BPF_MAP_GET_NEXT_KEY): New proxy
	functions.
	(SYS_FUNC(bpf)): Replace big switch statement with a dispatch table.

	bpf: use PRINT_FIELD_* macros.
	* print_fields.h (PRINT_FIELD_STR, PRINT_FIELD_PATH): New macros.
	* bpf.c: Include "print_fields.h".
	(bpf_map_create): Use PRINT_FIELD_U and PRINT_FIELD_XVAL.
	(bpf_map_update_elem): Use PRINT_FIELD_FD, PRINT_FIELD_X, and
	PRINT_FIELD_XVAL.
	(bpf_map_delete_elem, bpf_map_io): Use PRINT_FIELD_FD and PRINT_FIELD_X.
	(bpf_prog_load): Use PRINT_FIELD_STR, PRINT_FIELD_U, PRINT_FIELD_X,
	and PRINT_FIELD_XVAL.
	(bpf_obj_manage): Use PRINT_FIELD_FD and PRINT_FIELD_PATH.
	(bpf_prog_attach_detach): Use PRINT_FIELD_FD, PRINT_FIELD_FLAGS,
	and PRINT_FIELD_XVAL.

2017-07-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add terminating comment after each DECL_* macro definition.
	In an attempt to improve readability.

	* defs.h (DECL_IOCTL, DECL_NETLINK, DECL_PRINTNUM, DECL_PRINTNUM_ADDR,
	ATTRIBUTE_FORMAT): Add comment that marks end of macro definition.
	* netlink_sock_diag (DECL_NETLINK_DIAG_DECODER): Likewise.
	* nlattr.h (DECL_NLA): Likewise.

2017-07-24  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce print_quoted_cstring.
	In many places where kernel expects a NUL-terminated string of length
	up to a known fixed limit, e.g. when a NUL-terminated string is
	a fixed-size field of a structure, strace does not print the last byte
	assuming it is NUL, which is not always the case.

	Change output format for such strings to distinguish NUL-terminated
	strings from non-NUL-terminated ones: append ellipsis to the output
	when the string is not NUL-terminated.

	* defs.h (print_quoted_cstring): New prototype.
	* util.c (print_quoted_cstring): New function.
	(printpathn): Use it instead of print_quoted_string with
	QUOTE_0_TERMINATED argument.
	* print_fields.h (PRINT_FIELD_CSTRING): Likewise.
	* btrfs.c (btrfs_ioctl): Likewise.
	* dirent.c (SYS_FUNC(getdents)): Likewise.
	* dirent64.c (SYS_FUNC(getdents64)): Likewise.
	* print_ifindex.c (print_ifindex): Likewise.
	* sysmips.c (SYS_FUNC(sysmips)): Likewise.
	* ubi.c (ubi_ioctl): Likewise.
	* tests/tests.h (print_quoted_cstring): New prototype.
	* tests/print_quoted_string.c (print_quoted_cstring): New function.
	* tests/ioctl_block.c (main): Update expected output.
	* tests/ioctl_dm.c (main): Likewise.
	* tests/ioctl_loop.c (print_loop_info, print_loop_info64): Likewise.
	* tests/netlink_crypto.c (test_crypto_msg_newalg): Likewise.

2017-07-24  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_CRYPTO crypto_user_alg attributes.
	* tests/nlattr_crypto_user_alg.c: New file.
	* tests/gen_tests.in (nlattr_crypto_user_alg): New entry.
	* tests/pure_executables.list: Add nlattr_crypto_user_alg.
	* tests/.gitignore: Likewise.

	tests: extend TEST_NLATTR_OBJECT macro.
	* tests/test_nlattr.h (TEST_NLATTR_OBJECT_EX_,
	TEST_NLATTR_OBJECT_EX): New macros.
	(TEST_NLATTR_OBJECT): Use TEST_NLATTR_OBJECT_EX_.

	netlink: decode NETLINK_CRYPTO crypto_user_alg netlink attributes.
	* configure.ac (AC_CHECK_TYPES): Check for crypto_report_aead,
	crypto_report_blkcipher, crypto_report_cipher, crypto_report_hash,
	and crypto_report_rng structures in <linux/cryptouser.h>.
	* netlink_crypto.c (decode_crypto_report_generic,
	decode_crypto_report_hash, decode_crypto_report_blkcipher,
	decode_crypto_report_aead, decode_crypto_report_rng,
	decode_crypto_report_cipher): New functions.
	(crypto_user_alg_nla_decoders): New array.
	(decode_crypto_user_alg): Use it.
	* xlat/crypto_nl_attrs.in: New file.
	* NEWS: Mention this.

	tests: check decoding of NETLINK_CRYPTO messages.
	* tests/netlink_crypto.c: Include "test_netlink.h"
	instead of "netlink.h".
	(test_crypto_msg_newalg, test_crypto_msg_unspec): New functions.
	(main): Use them.

2017-07-24  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: extend TEST_NETLINK_OBJECT macro.
	As the first field of NETLINK_CRYPTO messages is a string, print
	unrecognized data as a string.  Extend TEST_NETLINK_OBJECT macro
	to test this case.

	* tests/test_netlink.h (TEST_NETLINK_OBJECT_EX_,
	TEST_NETLINK_OBJECT_EX): New macros.
	(TEST_NETLINK_OBJECT): Use TEST_NETLINK_OBJECT_EX_.

2017-07-24  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink: add a basic parser of NETLINK_CRYPTO messages.
	* netlink_crypto.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (decode_netlink_crypto): New prototype.
	* netlink.c (netlink_decoders): Add NETLINK_CRYPTO.
	* NEWS: Mention this.

2017-07-23  Dmitry V. Levin  <ldv@altlinux.org>

	Unify PRINT_FIELD_XVAL and PRINT_FIELD_XVAL64.
	* print_fields.h (PRINT_FIELD_XVAL64): Unify with PRINT_FIELD_XVAL.

	Unify PRINT_FIELD_FLAGS and PRINT_FIELD_FLAGS64.
	* print_fields.h (PRINT_FIELD_FLAGS64): Unify with PRINT_FIELD_FLAGS.
	* userfaultfd.c (uffdio_ioctl): Replace PRINT_FIELD_FLAGS64 with
	PRINT_FIELD_FLAGS.

2017-07-23  Nikolay Marchuk  <marchuk.nikolay.a@gmail.com>

	pathtrace: fix fanotify_mark path tracing on 32-bit architectures.
	The fanotify_mark syscall takes a 64-bit mask, and on 32-bit
	architectures it is split up into two syscall arguments.

	* pathtrace.c (pathtrace_match_set): Use getllval to properly decode
	arguments after mask.

2017-07-22  Dmitry V. Levin  <ldv@altlinux.org>

	travis: add valgrind check support.
	* travis-build.sh [CHECK == valgrind]: Pass --enable-valgrind
	to configure and appropriate check-valgrind-* to make.
	* travis-install.sh [CHECK == valgrind]: Install valgrind.

2017-07-22  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink_sock_diag: replace NLA_ALIGN with NLMSG_ALIGN.
	In several netlink_sock_diag parsers NLA_ALIGN was used instead of
	NLMSG_ALIGN to align the length of netlink messages.  Fortunately,
	both macros round the given length to the closest multiple of 4,
	so technically there is no difference, but the use of wrong macro
	is misleading.

	* netlink_inet_diag.c (decode_inet_diag_req_compat,
	decode_inet_diag_req_v2, decode_inet_diag_msg): Replace
	NLA_ALIGN with NLMSG_ALIGN.
	* netlink_netlink_diag.c (decode_netlink_diag_msg): Likewise.
	* netlink_packet_diag.c (decode_packet_diag_msg): Likewise.
	* netlink_smc_diag.c (decode_smc_diag_msg): Likewise.

2017-07-22  Dmitry V. Levin  <ldv@altlinux.org>

	travis: configure build with dependency tracking disabled.
	Dependency tracking is completely useless for one-time builds,
	so configure build with dependency tracking disabled.

	* travis-build.sh (DISTCHECK_CONFIGURE_FLAGS): Add
	--disable-dependency-tracking.

2017-07-22  Eugene Syromyatnikov  <evgsyr@gmail.com>

	m4: remove equal sign from define directive in ax_valgrind_check.m4.
	Support for providing equal sign in define directives has been added
	only in GNU Make 3.82 [1] and it provides the same semantics (variables
	should be recursively expanded) as when it is omitted at all, so let's
	remove it in order to preserve compatibility with older GNU Make
	versions (like the one used on Travis).

	[1] https://git.savannah.gnu.org/cgit/make.git/tree/ChangeLog?h=3.82#n766

	* m4/ax_valgrind_check.m4 <define valgrind_tool_rule>: Remove equal
	sign.

2017-07-21  Dmitry V. Levin  <ldv@altlinux.org>

	keyctl: add support for KEYCTL_RESTRICT_KEYRING operation.
	* keyctl.c (keyctl_restrict_keyring): New function.
	(SYS_FUNC(keyctl)): Use it to implement KEYCTL_RESTRICT_KEYRING support.
	* NEWS: Mention this.
	* tests/keyctl.c (main): Check KEYCTL_RESTRICT_KEYRING decoding.

2017-07-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify strace-t.test.
	If strace -t is running too long, it might happen that time stamps
	before and after its invocation differ for more than a second.
	Adjust expected output to handle this rare but possible case.

	* tests/strace-t.test: Allow any time stamp between start and finish
	of strace invocation.

2017-07-21  Dmitry V. Levin  <ldv@altlinux.org>

	x86: wire up arch_prctl syscall.
	* linux/i386/syscallent.h [384]: Add arch_prctl entry.
	* xlat/archvals.in: Add fallback definitions for constants.
	* prctl.c: Stop including <asm/prctl.h>.
	(SYS_FUNC(arch_prctl)): Enable for [I386].
	* NEWS: Mention this.

2017-07-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: tweak strace-ff.test for slow startup case.
	strace starts up much slower when invoked under valgrind control.
	Increase the tracee's sleep delay to let strace more time to attach.

	* tests/strace-ff.test: Increase sleep delay.

2017-07-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: update valgrind suppressions.
	* tests/strace.supp: Add a suppression for the memleak before
	error_msg_and_die in qualify_tokens.

2017-07-21  Dmitry V. Levin  <ldv@altlinux.org>

	Do not copy optarg unnecessarily.
	There is no need to copy the optarg string since it is a pointer
	into the original argv array, not into a static area
	that might be overwritten.

	* strace.c (username, outfname): Add const qualifier.
	(init): Do not xstrdup optarg to initialize outfname and username.

2017-07-20  Dmitry V. Levin  <ldv@altlinux.org>

	travis: add build environment information to the travis log.
	* travis-build.sh: Print build environment information.

2017-07-20  Dmitry V. Levin  <ldv@altlinux.org>

	build: add check-valgrind-* to recursive targets.
	As make -j$N check-valgrind cannot parallelize properly, add
	recursive targets for each of valgrind checks.  This way one can run
		for t in $valgrind_enabled_tools; do
			make -k check-valgrind-$n || rc=$?
		done
	in $top_builddir.

	* configure.ac (AM_EXTRA_RECURSIVE_TARGETS): Remove.
	* m4/ax_valgrind_check.m4 (AX_VALGRIND_CHECK): Add check-valgrind
	and check-valgrind-* to AM_EXTRA_RECURSIVE_TARGETS.

2017-07-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add check-valgrind-local make rule.
	This guarantees that $(check_LIBRARIES) and $(check_PROGRAMS)
	are made on 'make check-valgrind' before its recipe is processed.

	* tests/Makefile.am (check-valgrind-local): New rule.
	(.PHONY): Add it.

2017-07-20  Dmitry V. Levin  <ldv@altlinux.org>

	Add ksysent.h and scno.h to BUILT_SOURCES.
	This guarantees that ksysent.h and scno.h, along with other targets
	listed in BUILT_SOURCES, are made on 'make all', 'make check',
	and 'make check-valgrind' before other targets are processed.

	* scno.am (BUILT_SOURCES): Add scno.h.
	* tests/Makefile.am (BUILT_SOURCES): Add ksysent.h.

2017-07-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix valgrind suppression file path.
	* tests/Makefile.am (VALGRIND_SUPPRESSIONS_FILES): Replace srcdir
	with abs_srcdir.

	Fixes: v4.16-74-g16036030 ("tests: run every test except ksysent.test in its own subdirectory")

2017-07-19  Dmitry V. Levin  <ldv@altlinux.org>

	Update AX_VALGRIND_CHECK.
	* m4/ax_valgrind_check.m4: Update to serial 15.  In particular,
	this version does not eat check-valgrind errors.

	Update AX_CODE_COVERAGE.
	* m4/ax_code_coverage.m4: Update to serial 24.  In particular,
	this version has no lcov version check.
	* Makefile.am (strace_LDADD): Rename CODE_COVERAGE_LDFLAGS
	to CODE_COVERAGE_LIBS.

	Update input event KEY_* constants.
	* xlat/evdev_keycode.in: Add KEY_ASSISTANT introduced by linux kernel
	commit v4.13-rc1~13^2~1^2~1.
	* NEWS: Mention this.

	Update fs *_MAGIC constants.
	* xlat/fsmagic.in: Add AAFS_MAGIC introduced by linux kernel commit
	v4.13-rc1~161^2~87.
	* NEWS: Mention this.

2017-07-19  Dmitry V. Levin  <ldv@altlinux.org>

	Move family-specific NETLINK_SOCK_DIAG parsers to separate files.
	Split netlink_sock_diag.c that grew too big.

	* defs.h (tcp_states, tcp_state_flags): New xlat prototypes.
	* netlink_sock_diag.h: New file.
	* netlink_inet_diag.c: Likewise.
	* netlink_netlink_diag.c: Likewise.
	* netlink_packet_diag.c: Likewise.
	* netlink_smc_diag.c: Likewise.
	* netlink_unix_diag.c: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* netlink_sock_diag.c: Move family-specific parsers and associated
	header includes to separate files.
	* nlattr.h (DECL_NLA(meminfo)): New prototype.
	* nlattr.c: Include <linux/sock_diag.h>.
	(print_meminfo, decode_nla_meminfo): New functions from
	netlink_sock_diag.c.

2017-07-19  Dmitry V. Levin  <ldv@altlinux.org>

	Adjust prototypes of netlink parsing functions.
	Change the type of "len" argument that is based
	on struct nlmsghdr.nlmsg_len from kernel_ulong_t to unsigned int.

	* defs.h (netlink_decoder_t, DECL_NETLINK): Change "len" argument type
	from kernel_ulong_t to unsigned int.
	* netlink.c (decode_nlmsgerr_attr_cookie, decode_nlmsgerr,
	decode_payload): Likewise.
	* netlink_selinux.c (decode_netlink_selinux): Likewise.
	* netlink_sock_diag.c (decode_family, decode_unix_diag_req,
	decode_meminfo, decode_unix_diag_vfs, decode_unix_diag_inode,
	decode_unix_diag_rqlen, decode_unix_diag_msg, decode_netlink_diag_req,
	print_group, decode_netlink_diag_ring, decode_netlink_diag_flags,
	decode_netlink_diag_msg, decode_packet_diag_req,
	decode_packet_diag_info, decode_packet_diag_mclist,
	decode_packet_diag_ring, decode_packet_diag_filter,
	decode_packet_diag_msg, decode_inet_addr, decode_inet_diag_hostcond,
	decode_inet_diag_markcond, decode_bytecode_data, decode_inet_diag_bc_op,
	decode_inet_diag_req_compat, decode_inet_diag_req_v2,
	decode_inet_diag_req, decode_inet_diag_meminfo, decode_tcpvegas_info,
	decode_tcp_dctcp_info, decode_tcp_bbr_info, decode_inet_diag_msg,
	decode_smc_diag_req, decode_smc_diag_conninfo, decode_smc_diag_lgrinfo,
	decode_smc_diag_msg, netlink_diag_decoder_t, decode_netlink_sock_diag):
	Likewise.
	* nlattr.c (fetch_nlattr, decode_nlattr_with_data, decode_nlattr,
	decode_nla_str, decode_nla_strn, DECODE_NLA_INTEGER): Likewise.
	* nlattr.h (nla_decoder_t, DECL_NLA, decode_nlattr): Likewise.

2017-07-19  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of nlmsgerr attributes.
	* tests/nlattr_nlmsgerr.c: New file.
	* tests/gen_tests.in (nlattr_nlmsgerr): New entry.
	* tests/pure_executables.list: Add nlattr_nlmsgerr.
	* tests/.gitignore: Likewise.

	netlink: decode nlmsgerr attributes.
	* netlink.c: Include "nlattr.h" and "xlat/nlmsgerr_attrs.h".
	(print_cookie, decode_nlmsgerr_attr_cookie): New functions.
	(nlmsgerr_nla_decoders): New array.
	(decode_nlmsgerr): Use it.
	* xlat/nlmsgerr_attrs.in: New file.
	* NEWS: Mention this.

2017-07-19  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink: adjust decode_nlmsgerr for extended ACK reporting.
	Extended ACK reporting introduced by linux kernel commit
	v4.11-rc5-1382-g2d4bc93.

	* netlink.h (NLM_F_CAPPED): New macro.
	* netlink.c (decode_payload): Pass
	nlmsghdr->nlmsg_flags & NLM_F_CAPPED to decode_nlmsgerr.
	(decode_nlmsgerr): Adjust the length pass to
	decode_nlmsghdr_with_payload.

2017-07-19  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink: decode netlink message ack flags.
	* netlink.c: Include "xlat/netlink_ack_flags.h".
	(decode_nlmsg_flags): Decode ack flags when type == NLMSG_ERROR.
	* xlat/netlink_ack_flags.in: New file.
	* NEWS: Mention this.
	* tests/netlink_protocol.c (test_ack_flags): New function, check this.
	(main): Use it.

2017-07-19  Dmitry V. Levin  <ldv@altlinux.org>

	tests: enhance error diagnostics.
	* tests/init.sh (dump_log_and_fail_with): Dump $LOG to stderr instead
	of stdout as the latter is more likely to be redirected to a temporary
	file in the context where this function is called.

	tests: enhance timeout diagnostics.
	* tests/init.sh: Trap SIGXCPU.
	* tests/run.sh: Send SIGXCPU instead of SIGKILL in case of timeout, send
	SIGKILL if the command is still running 5 seconds after SIGXCPU.

	userfaultfd: decode struct uffdio_api.features as flags.
	* xlat/uffd_api_features.in: New file.
	* userfaultfd.c: Include "xlat/uffd_api_features.h".
	(uffdio_ioctl): Print struct uffdio_api.features using
	PRINT_FIELD_FLAGS64 and uffd_api_features.
	* NEWS: Mention this.
	* tests/ioctl_uffdio.c: Include "xlat.h" and "xlat/uffd_api_features.h".
	(main): Update expected output.

2017-07-19  Dmitry V. Levin  <ldv@altlinux.org>

	userfaultfd: enhance decoding of struct uffdio_api.features.
	As struct uffdio_api.features has read-write semantics,
	print the value returned by the kernel only when it differs
	from the value passed to the kernel.

	* userfaultfd.c (uffdio_ioctl) <UFFDIO_API>: On entering syscall,
	save the value of struct uffdio_api.features.  On exiting syscall, do
	not print struct uffdio_api.features when it's the same as on entering.
	* tests/ioctl_uffdio.c (main): Update expected output.

2017-07-18  Dmitry V. Levin  <ldv@altlinux.org>

	userfaultfd: use PRINT_FIELD_* macros.
	This also fixes output correctness for struct uffdio_api.features.

	* userfaultfd.c: Include "print_fields.h".
	(tprintf_uffdio_range): Use PRINT_FIELD_X.
	(PRINT_FIELD_UFFDIO_RANGE): New macro.
	(uffdio_ioctl): Use it, PRINT_FIELD_FLAGS64, and PRINT_FIELD_X.
	* tests/ioctl_uffdio.c (main): Update expected output.

2017-07-18  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce PRINT_FIELD_FLAGS64 and PRINT_FIELD_XVAL64.
	* print_fields.h (PRINT_FIELD_FLAGS64, PRINT_FIELD_XVAL64): New macros.

2017-07-17  Dmitry V. Levin  <ldv@altlinux.org>

	Update NEWS.

	aio: change struct iocb.aio_lio_opcode output format.
	* aio.c (tprint_lio_opcode): Change opcode output format to match
	the kernel.
	* tests/aio.c (main): Update expected output.

2017-07-17  Dmitry V. Levin  <ldv@altlinux.org>

	aio: use PRINT_FIELD_* macros.
	This also fixes output correctness for struct iocb.

	* aio.c: Include "print_fields.h".
	(print_common_flags, print_iocb_header, print_iocb, print_io_event):
	Use PRINT_FIELD_D, PRINT_FIELD_U, PRINT_FIELD_X, PRINT_FIELD_FD,
	and PRINT_FIELD_STRN.
	* tests/aio.c (main): Update expected output.

2017-07-17  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce PRINT_FIELD_FD and PRINT_FIELD_STRN.
	* print_fields.h (PRINT_FIELD_FD, PRINT_FIELD_STRN): New macros.

2017-07-16  Dmitry V. Levin  <ldv@altlinux.org>

	Update BPF_* constants.
	* xlat/bpf_commands.in: Add BPF_PROG_TEST_RUN, BPF_PROG_GET_NEXT_ID,
	BPF_MAP_GET_NEXT_ID, BPF_PROG_GET_FD_BY_ID, BPF_MAP_GET_FD_BY_ID,
	and BPF_OBJ_GET_INFO_BY_FD introduced by linux kernel commits
	v4.12-rc1~64^3~287^2~5, v4.13-rc1~157^2~271^2~5,
	v4.13-rc1~157^2~271^2~4, v4.13-rc1~157^2~271^2~3, and
	v4.13-rc1~157^2~271^2~1, respectively.
	* xlat/bpf_attach_type.in: Add BPF_CGROUP_SOCK_OPS introduced
	by linux kernel commit v4.13-rc1~157^2~37^2~15.
	* xlat/bpf_prog_types.in: Add BPF_PROG_TYPE_SOCK_OPS introduced
	by the same commit.

	Update SO_* constants.
	* xlat/sockoptions.in: Add SO_PEERGROUPS introduced by linux kernel
	commit v4.13-rc1~157^2~124.

	Update SCM_* constants.
	* xlat/scmvals.in: Add SCM_TIMESTAMPING_PKTINFO introduced
	by linux kernel commit v4.13-rc1~157^2~405^2~3.

2017-07-16  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_SELINUX protocol.
	* test_netlink.h (TEST_NETLINK_OBJECT): New macro.
	* tests/netlink_selinux.c: Include "test_netlink.h"
	instead of "netlink.h".
	(test_selnl_msg_unspec, test_selnl_msg_setenforce,
	test_selnl_msg_policyload): New functions.
	(main): Use them.

	netlink: decode NETLINK_SELINUX protocol.
	* netlink_selinux.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (decode_netlink_selinux): New prototype.
	* netlink.c (netlink_decoders): Add NETLINK_SELINUX.

2017-07-15  Dmitry V. Levin  <ldv@altlinux.org>

	sg_io_v3: use PRINT_FIELD_* macros.
	* sg_io_v3.c: Include "print_fields.h".
	(PRINT_FIELD_SG_IO_BUFFER): New macro.
	(decode_request, decode_response): Use it, PRINT_FIELD_D, PRINT_FIELD_U,
	PRINT_FIELD_X, PRINT_FIELD_PTR, PRINT_FIELD_FLAGS, and PRINT_FIELD_XVAL.

	Introduce PRINT_FIELD_PTR.
	* print_fields.h (PRINT_FIELD_PTR): New macro.

2017-07-15  Dmitry V. Levin  <ldv@altlinux.org>

	Provide mpers_ptr_t definition for non-mpers case.
	In mpers case, mpers_ptr_t is already defined by DEF_MPERS_TYPE(...).
	This allows use of mpers_ptr_t regardless of IN_MPERS state.

	* mpers_type.h [!IN_MPERS] (mpers_ptr_t): New typedef.

2017-07-14  Lazar Trsic  <Lazar.Trsic@imgtec.com>

	Move is_negated_errno() to new header negated_errno.h.
	Move is_negated_errno() to a separate new header file negated_errno.h
	and include it just for architectures which require it.

	is_negated_errno() is not used on those architectures
	that have a dedicated register to signal a syscall error.

	The issue was raised when compiling with clang, which is more
	strict regarding semantics of unused static inline functions
	defined in C files and will issue a -Wunused-function warrning
	if they are not used anywhere.

	* syscall.c (is_negated_errno): Move to ...
	* negated_errno.h: ... new file.
	* Makefile.am (strace_SOURCES): Add it.
	* linux/aarch64/get_error.c: Include it.
	* linux/arc/get_error.c: Likewise.
	* linux/arm/get_error.c: Likewise.
	* linux/avr32/get_error.c: Likewise.
	* linux/bfin/get_error.c: Likewise.
	* linux/crisv10/get_error.c: Likewise.
	* linux/hppa/get_error.c: Likewise.
	* linux/i386/get_error.c: Likewise.
	* linux/ia64/get_error.c: Likewise.
	* linux/m68k/get_error.c: Likewise.
	* linux/metag/get_error.c: Likewise.
	* linux/microblaze/get_error.c: Likewise.
	* linux/or1k/get_error.c: Likewise.
	* linux/riscv/get_error.c: Likewise.
	* linux/s390/get_error.c: Likewise.
	* linux/sh/get_error.c: Likewise.
	* linux/sh64/get_error.c: Likewise.
	* linux/tile/get_error.c: Likewise.
	* linux/x86_64/get_error.c: Likewise.
	* linux/xtensa/get_error.c: Likewise.

2017-07-14  Dmitry V. Levin  <ldv@altlinux.org>

	sg_io_v4: use PRINT_FIELD_* macros.
	* sg_io_v4.c: Include "print_fields.h".
	(PRINT_FIELD_SG_IO_BUFFER): New macro.
	(decode_request, decode_response): Use it, PRINT_FIELD_D, PRINT_FIELD_U,
	PRINT_FIELD_X, PRINT_FIELD_FLAGS, and PRINT_FIELD_XVAL.

	dm: use PRINT_FIELD_* macros.
	* dm.c (dm_decode_values, dm_decode_dm_target_spec,
	dm_decode_dm_target_deps, dm_decode_dm_target_msg, dm_known_ioctl): Use
	PRINT_FIELD_D, PRINT_FIELD_U, and PRINT_FIELD_FLAGS.

2017-07-13  Dmitry V. Levin  <ldv@altlinux.org>

	Move macros related to kernel types to kernel_types.h.
	Some macros related to kernel types are defined both in defs.h and
	tests/tests.h.  Avoid this redundancy by moving these definitions
	to kernel_types.h.

	* defs.h (PRI_kl, PRI_kld, PRI_klu, PRI_klx, PRI__64, PRI__d64,
	PRI__u64, PRI__x64): Move ...
	* kernel_types.h: ... here.
	* tests/tests.h (PRI__64, PRI__d64, PRI__u64, PRI__x64): Remove.

2017-07-13  Lazar Trsic  <Lazar.Trsic@imgtec.com>

	mips64: fix PRI__64 macro definition when compiled for Android.
	By default for MIPS64 in Android __u64 type is exported
	as unsigned long long.  This caused compilation -Wformat warnings
	and would break the build if -Werror is used.

	* defs.h [SIZEOF_LONG != 4 && MIPS && __ANDROID__] (PRI__64): Change
	from "l" to "ll".

2017-07-13  Dmitry V. Levin  <ldv@altlinux.org>

	block: use PRINT_FIELD_* macros.
	This also fixes output correctness for struct blkpg_ioctl_arg.

	* block.c (print_blkpg_req): Use PRINT_FIELD_D and PRINT_FIELD_XVAL.
	(block_ioctl): Use PRINT_FIELD_U.
	* tests/ioctl_block.c (main): Update expected output.

2017-07-12  Dmitry V. Levin  <ldv@altlinux.org>

	netlink_sock_diag: enhance decoding of long meminfo arrays.
	Print trailing dots instead of silent truncation if the array
	is too long.

	* netlink_sock_diag.c (decode_meminfo): Do not apply SK_MEMINFO_VARS
	limit to nmemb, specify element count to print_array instead.
	(print_meminfo): Check element count and terminate printing
	if the element count exceeds SK_MEMINFO_VARS.
	* tests/nlattr_inet_diag_msg.c (main): Check it.

2017-07-12  Dmitry V. Levin  <ldv@altlinux.org>

	tests: extend coverage of netlink_diag_req decoder.
	Add one more NETLINK_SOCK_DIAG check to ressurrect full coverage
	of netlink_diag_req decoder that was lost after commit
	v4.18-58-g37ef2d0d.

	* tests/netlink_sock_diag.c (test_netlink_diag_req): Add a check for
	sdiag_protocol != NDIAG_PROTO_ALL.

2017-07-12  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_CRYPTO nlmsg_flags.
	* tests/netlink_crypto.c (test_nlmsg_flags): New function.
	(main): Use it.

	netlink: add decoding of NETLINK_CRYPTO nlmsg_flags.
	* netlink.c (decode_nlmsg_flags): Add NETLINK_CRYPTO.

	tests: check decoding of NETLINK_CRYPTO message types.
	* configure.ac (AC_CHECK_HEADERS): Add linux/cryptouser.h.
	* tests/netlink_crypto.c: New file.
	* tests/gen_tests.in (netlink_crypto): New entry.
	* tests/pure_executables.list: Add netlink_crypto.
	* tests/.gitignore: Likewise.

	netlink: add decoding of NETLINK_CRYPTO message types.
	* xlat/nl_crypto_types.in: New file.
	* netlink.c: Include "xlat/nl_crypto_types.h".
	(nlmsg_types): Add NETLINK_CRYPTO.

	tests: introduce TEST_NETLINK and TEST_NETLINK_ macros.
	* tests/test_netlink.h: New file.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.
	* tests/netlink_sock_diag.c: Include "test_netlink.h"
	instead of "netlink.h".
	(TEST_SOCK_DIAG): New macro.
	(test_unix_diag_req, test_unix_diag_msg,
	test_netlink_diag_req, test_netlink_diag_msg,
	test_packet_diag_req, test_packet_diag_msg,
	test_inet_diag_req, test_inet_diag_req_v2,
	test_inet_diag_msg, test_smc_diag_req,
	test_smc_diag_msg): Use it.
	(test_odd_family_req, test_odd_family_msg,
	test_inet_diag_sockid): Use TEST_NETLINK macro.

2017-07-11  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of nlattr_inet_diag_req_v2 attributes.
	* tests/nlattr_inet_diag_req_v2.c: New file.
	* tests/gen_tests.in (nlattr_inet_diag_req_v2): New entry.
	* tests/pure_executables.list: Add nlattr_inet_diag_req_v2.
	* tests/.gitignore: Likewise.

	tests: check decoding of nlattr_inet_diag_req_compat attributes.
	* tests/nlattr_inet_diag_req_compat.c: New file.
	* tests/gen_tests.in (nlattr_inet_diag_req_compat): New entry.
	* tests/pure_executables.list: Add nlattr_inet_diag_req_compat.
	* tests/.gitignore: Likewise.

	netlink: decode AF_INET inet_diag_req_* attributes.
	* linux/inet_diag.h (inet_diag_bc_op, inet_diag_hostcond,
	inet_diag_markcond): New structures.
	(INET_DIAG_BC_*): New enum.
	* netlink_sock_diag.c: Include "xlat/inet_diag_bytecodes.h".
	(decode_inet_addr, decode_inet_diag_hostcond,
	print_inet_diag_bc_op, decode_inet_diag_markcond,
	decode_bytecode_data, decode_inet_diag_bc_op): New functions.
	(inet_diag_req_nla_decoders): New array.
	(decode_inet_diag_req_compat, decode_inet_diag_req_v2): Use it.
	* xlat/inet_diag_bytecodes.in: New file.

2017-07-11  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce PRINT_FIELD_CSTRING.
	* print_fields.h (PRINT_FIELD_CSTRING): New macro.
	* block.c (print_blkpg_req, block_ioctl): Use PRINT_FIELD_CSTRING
	instead of print_quoted_string.
	* btrfs.c (btrfs_ioctl): Likewise.
	* dm.c (dm_decode_device, dm_decode_dm_target_spec): Likewise.
	* loop.c (decode_loop_info, decode_loop_info64): Likewise.
	* v4l2.c (print_v4l2_capability, print_v4l2_fmtdesc,
	print_v4l2_standard, print_v4l2_input, print_v4l2_tuner,
	print_v4l2_queryctrl): Likewise.
	* netlink_sock_diag.c (decode_smc_diag_lgrinfo): Use PRINT_FIELD_CSTRING
	instead of PRINT_FIELD_STRING.
	* uname.c (PRINT_UTS_MEMBER): Remove.
	(SYS_FUNC(uname)): Use PRINT_FIELD_CSTRING instead of PRINT_UTS_MEMBER.

2017-07-11  Dmitry V. Levin  <ldv@altlinux.org>

	Rename PRINT_FIELD_QUOTED_STRING to PRINT_FIELD_STRING.
	As string fields are always qouted when printed, choose a shorter name
	for the helper macro.

	* print_fields.h (PRINT_FIELD_QUOTED_STRING): Rename
	to PRINT_FIELD_STRING.  All callers updated.

2017-07-10  Dmitry V. Levin  <ldv@altlinux.org>

	Update RWF_* constants.
	* xlat/rwf_flags.in: Add RWF_NOWAIT introduced by linux kernel
	commit v4.12-rc5-150-gb745fafa.

	Intorduce PRINT_FIELD_0X.
	* print_fields.h (PRINT_FIELD_0X): New macro.
	* sockaddr.c (print_sockaddr_data_ipx, print_sockaddr_data_nl): Use it
	instead of manual tprintf statements.
	* netlink_sock_diag.c (PRINT_FIELD_SMC_DIAG_CONNINFO_FLAGS): Remove.
	(decode_smc_diag_conninfo): Replace it with PRINT_FIELD_0X.

	print_inet_addr: use inet_addr-based output format for IPv4.
	* sockaddr.c (print_inet_addr): Remove af_name variable.
	<AF_INET>: Use inet_addr-based output format.
	* tests/netlink_sock_diag.c (test_inet_diag_sockid, test_inet_diag_req,
	test_inet_diag_req_v2, test_inet_diag_msg, test_smc_diag_req,
	test_smc_diag_msg): Update expected output.
	* tests/nlattr_inet_diag_msg.c (print_inet_diag_msg): Likewise.
	* tests/nlattr_smc_diag_msg.c (print_smc_diag_msg): Likewise.

2017-07-10  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of netlink smc_diag_msg attributes.
	* tests/nlattr_smc_diag_msg.c: New file.
	* tests/gen_tests.in (nlattr_smc_diag_msg): New entry.
	* tests/pure_executables.list: Add nlattr_smc_diag_msg.
	* tests/.gitignore: Likewise.

	netlink: decode AF_SMC smc_diag_msg attributes.
	* linux/smc_diag.h (smc_diag_cursor, smc_diag_conninfo
	smc_diag_linkinfo, smc_diag_lgrinfo): New structures.
	* netlink_sock_diag.c: Include "xlat/smc_link_group_roles.h".
	(decode_smc_diag_conninfo, decode_smc_diag_lgrinfo): New functions.
	(smc_diag_msg_nla_decoders): New array.
	(decode_smc_diag_msg): Use it.
	* xlat/smc_link_group_roles.in: New file.

2017-07-10  Nikolay Marchuk  <marchuk.nikolay.a@gmail.com>

	pathtrace.c: introduce user-provided sets of paths.
	* defs.h (struct path_set): New structure.
	(global_path_set): New variable prototype.
	(tracing_paths): Change macro body to use global_path_set variable.
	(pathtrace_select_set): Add "struct path_set *" argument.
	(pathtrace_match_set): Likewise.  Change return type to bool.
	(pathtrace_select, pathtrace_match): Change into thin macro wrappers
	around pathtrace_select_set and pathtrace_match_set, repsectively.
	* pathtrace.c (global_path_set): New variable.
	(storepath, pathtrace_select_set): Add "struct path_set *" argument.
	(pathmatch, upathmatch, fdmatch, pathtrace_match_set): Likewise.
	Change return type to bool.

2017-07-09  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of MCAST_JOIN_GROUP/MCAST_LEAVE_GROUP.
	* tests/group_req.c: New file.
	* tests/gen_tests.in (group_req): New entry.
	* tests/pure_executables.list: Add group_req.
	* tests/.gitignore: Likewise.

2017-07-09  Dmitry V. Levin  <ldv@altlinux.org>

	Mpersify struct group_req.
	The size of struct group_req depends on alignment of long and therefore
	has to be mpersified.

	* print_group_req.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* net.c (print_group_req): Move to print_group_req.c, wrap into
	MPERS_PRINTER_DECL.

2017-07-09  Dmitry V. Levin  <ldv@altlinux.org>

	net: enhance decoding of MCAST_JOIN_GROUP/MCAST_LEAVE_GROUP.
	* net.c (print_group_req): Allow option length greater than
	sizeof(struct group_req) to match the kernel behaviour.
	When the option length is invalid, print the address.
	* NEWS: Mention this.

2017-07-09  Dmitry V. Levin  <ldv@altlinux.org>

	net: hook up MCAST_JOIN_GROUP/MCAST_LEAVE_GROUP decoding for SOL_IPV6.
	As multicast socket options are shared between IPv4 and IPv6,
	they should be decoded both for SOL_IP and SOL_IPV6.

	* net.c (print_setsockopt) <SOL_IPV6> [MCAST_JOIN_GROUP]: Handle
	MCAST_JOIN_GROUP and MCAST_LEAVE_GROUP.

2017-07-09  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: add MCAST_* to sockipv6options.
	Multicast socket options are shared between IPv4 and IPv6.

	* xlat/sockipv6options.in: Add MCAST_JOIN_GROUP, MCAST_BLOCK_SOURCE,
	MCAST_UNBLOCK_SOURCE, MCAST_LEAVE_GROUP, MCAST_JOIN_SOURCE_GROUP,
	MCAST_LEAVE_SOURCE_GROUP, and MCAST_MSFILTER.

2017-07-09  Dmitry V. Levin  <ldv@altlinux.org>

	net: enhance decoding of IP_ADD_MEMBERSHIP et al socket options.
	* net.c (print_mreq, print_mreq6): Treat negative option length
	as invalid to match the kernel behaviour.  When the option length
	is invalid, print the address.
	* NEWS: Mention it.
	* tests/ip_mreq.c (main): Check it.  Update expected output.

	net: enhance decoding of setsockopt's SO_LINGER negative option length.
	* net.c (print_set_linger): Treat negative option length as invalid
	to match the kernel behaviour.
	* tests/so_linger.c (main): Check it.

	msghdr: use PRINT_FIELD_* macros.
	* msghdr.c (print_scm_creds): Use PRINT_FIELD_U and PRINT_FIELD_UID.
	(print_cmsg_ip_recverr): Use PRINT_FIELD_U.
	(print_struct_msghdr): Use PRINT_FIELD_U and PRINT_FIELD_FLAGS.

	Intorduce PRINT_FIELD_SOCKADDR.
	* print_fields.h (PRINT_FIELD_SOCKADDR): New macro.
	* msghdr.c (print_cmsg_ip_recverr): Use it instead of print_sockaddr.
	* net.c (print_group_req): Likewise.
	* sock.c (PRINT_IFREQ_ADDR): Remove.
	(print_ifreq, print_ifconf_ifreq): Use PRINT_FIELD_SOCKADDR
	instead of PRINT_IFREQ_ADDR.

2017-07-09  Dmitry V. Levin  <ldv@altlinux.org>

	print_sockaddr: remove "struct tcb *" argument.
	print_sockaddr does not use its first argument, remove it.

	* defs.h (print_sockaddr): Remove argument.
	* sockaddr.c (print_sockaddr): Remove argument.  All callers updated.
	* sock.c (PRINT_IFREQ_ADDR): Likewise.

2017-07-09  Dmitry V. Levin  <ldv@altlinux.org>

	net: use PRINT_FIELD_* macros.
	* net.c (print_tpacket_stats, print_tpacket_req): Use PRINT_FIELD_U.
	(print_group_req): Use PRINT_FIELD_IFINDEX.
	(print_packet_mreq): Use PRINT_FIELD_IFINDEX, PRINT_FIELD_U,
	and PRINT_FIELD_XVAL.

	netlink_sock_diag: introduce PRINT_FIELD_INET_DIAG_SOCKID.
	* netlink_sock_diag.c (PRINT_FIELD_INET_DIAG_SOCKID): New macro.
	(decode_inet_diag_req_compat, decode_inet_diag_req_v2,
	decode_inet_diag_msg, decode_smc_diag_req, decode_smc_diag_msg): Use it
	instead of print_inet_diag_sockid.

	Intorduce PRINT_FIELD_DEV.
	* print_fields.h (PRINT_FIELD_DEV): New macro.
	* dm.c (dm_decode_device, dm_decode_dm_name_list): Use it
	instead of print_dev_t.
	* loop.c (decode_loop_info, decode_loop_info64): Likewise.
	* netlink_sock_diag.c (decode_unix_diag_vfs): Likewise.

	Intorduce PRINT_FIELD_INET4_ADDR.
	* print_fields.h (PRINT_FIELD_INET4_ADDR): New macro.
	* msghdr.c (print_cmsg_ip_pktinfo): Use it instead of manual
	tprintf statements.
	* net.c (print_mreq): Likewise.
	* sockaddr.c (print_sockaddr_data_in): Likewise.

	Intorduce PRINT_FIELD_NET_PORT.
	* print_fields.h (PRINT_FIELD_NET_PORT): New macro.
	* netlink_sock_diag.c (print_inet_diag_sockid): Use it
	instead of a manual tprintf statement.
	* sockaddr.c (print_sockaddr_data_in, print_sockaddr_data_in6,
	print_sockaddr_data_ipx): Likewise.

	Intorduce PRINT_FIELD_IFINDEX.
	* print_fields.h (PRINT_FIELD_IFINDEX): New macro.
	* msghdr.c (print_cmsg_ip_pktinfo): Use it instead of print_ifindex.
	* net.c (print_mreq6): Likewise.
	* netlink_sock_diag.c (print_packet_diag_mclist,
	print_inet_diag_sockid): Likewise.
	* sockaddr.c (print_sockaddr_data_in6, print_sockaddr_data_ll):
	Likewise.

	Intorduce PRINT_FIELD_INET_ADDR.
	* print_fields.h (PRINT_FIELD_INET_ADDR): New macro.
	* net.c (print_mreq6): Use it instead of print_inet_addr.
	* netlink_sock_diag.c (print_inet_diag_sockid): Likewise.
	* sockaddr.c (print_sockaddr_data_in6): Likewise.

	net: move print_ifindex to a separate file.
	* print_ifindex.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* net.c (print_ifindex): Move to print_ifindex.c.

	net: move parsers of bind, listen, and shutdown to separate files.
	* bind.c: New file.
	* listen.c: Likewise.
	* shutdown.c: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* net.c (SYS_FUNC(bind)): Move to bind.c.
	(SYS_FUNC(listen)): Move to listen.c.
	(SYS_FUNC(shutdown)): Move to shutdown.c.

2017-07-09  JingPiao Chen  <chenjingpiao@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of packet_diag_msg attributes.
	* tests/netlink_sock_diag-v.sh: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	* tests/nlattr_packet_diag_msg.c: New file.
	* tests/gen_tests.in (nlattr_packet_diag_msg): New entry.
	* tests/pure_executables.list: Add nlattr_packet_diag_msg.
	* tests/.gitignore: Likewise.

	netlink: decode AF_PACKET packet_diag_msg attributes.
	* linux/packet_diag.h (packet_diag_info, packet_diag_mclist,
	packet_diag_ring): New structures.
	(PDI_*): New macros.
	* netlink_sock_diag.c: Include <linux/filter.h>
	and "xlat/packet_diag_info_flags.h".
	(decode_packet_diag_info, decode_packet_diag_mclist,
	decode_packet_diag_ring, decode_packet_diag_filter): New functions.
	(packet_diag_msg_nla_decoders): New array.
	(decode_packet_diag_msg): Use it.
	* print_fields.h (PRINT_FIELD_QUOTED_STRING): New macro.
	* xlat/packet_diag_info_flags.in: New file.

2017-07-09  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: fix TEST_NLATTR_OBJECT and TEST_NLATTR_ARRAY for large objects.
	commit v4.17-161-gdbd0605 that adjusted TEST_NLATTR_OBJECT and
	TEST_NLATTR_ARRAY for large objects, only changed the pattern
	print length, large length still can be specified as nla_data_len,
	resulting to output mismatch.

	* tests/test_nlattr.h (TEST_NLATTR_OBJECT): Pass "plen"
	both as nla_data_len and slen arguments of TEST_NLATTR_
	in len < sizeof(object) case.
	(TEST_NLATTR_ARRAY): Likewise, Pass "plen" both as nla_data_len
	and slen arguments of TEST_NLATTR_ in len < sizeof(object[0]) case.

2017-07-09  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: introduce TEST_NLATTR_nla macro in test_nlattr.h.
	Explicitly make struct nlattr * pointer which is internal
	to TEST_NLATTR_ macro available to its varadic arguments.

	* tests/test_nlattr.h (TEST_NLATTR_): Rename nla to TEST_NLATTR_nla.

2017-07-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of SO_PEERCRED socket option.
	* tests/so_peercred.c: New file.
	* tests/gen_tests.in (so_peercred): New entry.
	* tests/pure_executables.list: Add so_peercred.
	* tests/.gitignore: Likewise.

	net: accept arbitrary option length for getsockopt's SO_PEERCRED.
	* print_fields.h (PRINT_FIELD_UID): New macro.
	* net.c (print_ucred): Rewrite to match the kernel behaviour.
	* NEWS: Mention this.

	tests: check decoding of socket filters.
	* tests/sock_filter-v.c: New file.
	* tests/gen_tests.in (sock_filter-v): New entry.
	* tests/pure_executables.list: Add sock_filter-v.
	* tests/.gitignore: Likewise.

	Implement decoding of linux socket filter programs.
	* bpf_sock_filter.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* xlat/skf_ad.in: New file.
	* defs.h (decode_sock_fprog, print_sock_fprog): New prototypes.
	* fetch_bpf_fprog.c (get_bpf_fprog_size): New mpers printer.
	* net.c (print_getsockopt): Use decode_sock_fprog to print
	socket filter programs for SO_GET_FILTER socket option.
	(print_setsockopt): Use decode_sock_fprog and get_bpf_fprog_size
	to print socket filter programs for SO_ATTACH_FILTER
	and SO_ATTACH_REUSEPORT_CBPF socket options.
	* NEWS: Mention this.

	tests: check decoding of SO_LINGER socket option.
	* tests/so_linger.c: New file.
	* tests/gen_tests.in (so_linger): New entry.
	* tests/pure_executables.list: Add so_linger.
	* tests/.gitignore: Likewise.

	tests: fix print_quoted_hex output of bytes with high bit set.
	* tests/tests.h (print_quoted_memory, print_quoted_hex): Change the type
	of first argument from "const char *" to "const void *".
	* tests/print_quoted_string.c: Likewise.
	(print_quoted_hex): Print bytes as unsigned char objects to avoid
	unwanted sign extension.
	* tests/netlink_protocol.c (send_query): Remove the cast of print_quoted_hex
	first argument which is now redundant.

	net: accept arbitrary option length for getsockopt's SO_LINGER.
	* net.c (print_linger): Rename to print_set_linger.
	(print_setsockopt): Replace print_linger with print_set_linger.
	(print_get_linger): New function that accepts arbitrary option length
	to match the kernel behaviour.
	(print_getsockopt): Replace print_linger with print_get_linger.
	* NEWS: Mention this.

	net: accept large option length for SO_LINGER.
	* net.c (print_linger): Allow len > sizeof(struct linger) to match
	the kernel behaviour.

	net: fix printing of struct linger's field names.
	* net.c: Include "print_fields.h".
	(print_linger): Print fields of struct linger using PRINT_FIELD_D.

2017-07-08  Dmitry V. Levin  <ldv@altlinux.org>

	net: enhance decoding of getsockopt's optlen argument.
	As the last argument of getsockopt syscall has read-write semantics,
	print both user and kernel values when they differ.

	* net.c (SYS_FUNC(getsockopt)): On entering syscall, fetch and save
	the length specified to the kernel.  On error, print the length saved
	on entering.  When the saved length and the length returned by the
	kernel differ, print both values.
	* NEWS: Mention this.
	* tests/net-icmp_filter.c (main): Update expected output.

2017-07-08  Dmitry V. Levin  <ldv@altlinux.org>

	net: move printing of [gs]etsockopt's socklen argument to toplevel parsers
	* net.c (print_getsockopt, print_setsockopt): Remove "done" label,
	replace "goto done" statement with "return".
	Move printing of "len" argument ...
	(SYS_FUNC(getsockopt), SYS_FUNC(setsockopt)): ... here.

2017-07-08  Dmitry V. Levin  <ldv@altlinux.org>

	Generalize seccomp filter parser.
	Linux socket filter uses almost the same classic BPF as seccomp filter,
	The only difference noticeable from strace PoV is the meaning of generic
	multiuse field.

	Transform the parser of seccomp filters to a more generic parser
	of classic BPF, parametrized with a method of parsing the generic
	multiuse field in BPF_STMT.

	* bpf_filter.c: New file.
	* bpf_filter.h: Likewise.
	* bpf_fprog.h: Likewise.
	* bpf_seccomp_filter.c: Likewise.
	* fetch_bpf_fprog.c: Likewise.
	* fetch_seccomp_fprog.c: Remove.
	* seccomp_fprog.h: Likewise.
	* Makefile.am (strace_SOURCES): Add bpf_filter.c, bpf_filter.h,
	bpf_fprog.h, bpf_seccomp_filter.c, and fetch_bpf_fprog.c.
	Remove fetch_seccomp_fprog.c and seccomp_fprog.h.
	* seccomp.c: Do not include linux/filter.h and xlat header files.
	Do not define SECCOMP_RET_ACTION.
	(bpf_filter, decode_bpf_code, decode_bpf_stmt, decode_bpf_jump,
	print_bpf_filter, print_seccomp_fprog, print_seccomp_filter): Remove.
	* defs.h (print_seccomp_filter): Rename to decode_seccomp_fprog.
	(SYS_FUNC(seccomp)): Replace print_seccomp_filter
	with decode_seccomp_fprog.
	* prctl.c (SYS_FUNC(prctl)): Likewise.

2017-07-08  Dmitry V. Levin  <ldv@altlinux.org>

	Assume that <linux/filter.h> is always available.
	<linux/filter.h> was introduced in linux 2.1.75, way before
	the minimal kernel version supported by strace.

	* configure.ac (AC_CHECK_HEADERS): Remove linux/filter.h.
	* seccomp.c: Assume HAVE_LINUX_FILTER_H.
	* tests/prctl-seccomp-filter-v.c: Likewise.
	* tests/seccomp-filter-v.c: Likewise.
	* tests/seccomp-filter.c: Likewise.

2017-07-07  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: add BPF_END to BPF_ALU opcode list.
	BPF_END is one of three eBPF-only opcodes for BPF_ALU class.
	Other two (BPF_MOV and BPF_ARSH) has been added earlier.

	* xlat/bpf_op_alu.in: Add BPF_END.

2017-07-07  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink_sock_diag: print unrecognized data in hex.
	* netlink_sock_diag.c (decode_family): Replace printstrn with
	printstr_ex and set QUOTE_FORCE_HEX flag.
	* tests/netlink_sock_diag.c (test_odd_family_req,
	test_odd_family_msg): Update expected output.

	netlink: print unrecognized nlattr in hex.
	* nlattr.c (fetch_nlattr): Replace printstrn
	with printstr_ex and set QUOTE_FORCE_HEX flag.
	* tests/nlattr.c (test_nlattr): Update expected output.

	netlink: print unrecognized netlink messages in hex.
	* netlink.c (fetch_nlmsghdr): Replace printstrn
	with printstr_ex and set QUOTE_FORCE_HEX flag.
	* tests/netlink_protocol.c (send_query): Update expected output.

	netlink: print unrecognized netlink payload in hex.
	* netlink.c (decode_payload): Replace printstrn
	with printstr_ex and set QUOTE_FORCE_HEX flag.
	* tests/netlink_protocol.c (send_query, test_nlmsgerr,
	test_nlmsg_done): Update expected output.
	* tests/netlink_generic.c (test_nlmsg_type): Likewise.

	netlink: print unrecognized nlmsgerr in hex.
	* netlink.c (decode_nlmsgerr): Replace printstrn
	with printstr_ex and set QUOTE_FORCE_HEX flag.
	* tests/netlink_protocol.c (test_nlmsgerr): Update expected output.

	netlink: print unrecognized attribute data in hex.
	* nlattr.c (decode_nlattr_with_data): Replace printstrn
	with printstr_ex and set QUOTE_FORCE_HEX flag.
	* tests/tests.h (print_quoted_hex): New prototype.
	* tests/print_quoted_string.c (print_quoted_hex): New function.
	* tests/test_nlattr.h (TEST_NLATTR_OBJECT, TEST_NLATTR_ARRAY): Use it
	for updated expected output.  Change the type of "plen" variable
	to unsigned int.
	* tests/nlattr.c (test_nlattr): Update expected output.

	tests: print quotation marks in print_quoted_memory.
	* tests/print_quoted_string.c (print_quoted_memory): Print opening
	and closing quotation marks.
	* tests/getcwd.c (main): Do not print quotation marks around
	print_quoted_string.
	* tests/uname.c (main): Likewise.
	* tests/keyctl.c (print_quoted_string_limit): Do not print quotation
	marks around print_quoted_memory.
	* tests/netlink_protocol.c (send_query): Likewise.
	* tests/xattr.c (main): Likewise.

2017-07-06  Dmitry V. Levin  <ldv@altlinux.org>

	strace.1: remove misleading remark that -i option is weakly supported.
	Given that -i functionality is covered by pc.test, the remark that
	it is weakly supported is wrong.

	* strace.1 (BUGS): Remove the remark about weakly supported -i option.

2017-07-06  Dmitry V. Levin  <ldv@altlinux.org>

	Post-release administrivia.
	* NEWS: Add a header line for the next release.
	* debian/changelog.in: Add a changelog entry for 4.18-1.
	* strace.spec.in: Likewise.

2017-07-05  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for 4.18 release.
	* NEWS: Update for 4.18 release.

2017-07-04  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify create_nl_socket based tests against the race condition
	There is a race condition between the moment a netlink socket is created
	and the moment it is reported via SOCK_DIAG_BY_FAMILY interface.
	Add one more operation on the socket created by create_nl_socket
	to increase chances of winning the race.

	* tests/create_nl_socket.c (create_nl_socket_ext): Add a getsockopt call
	with the created socket.

2017-07-04  Dmitry V. Levin  <ldv@altlinux.org>

	Update NEWS.

2017-07-04  Romain Naour  <romain.naour@smile.fr>

	nios2: fix wrong access to "SP" register in user_pt_regs.
	Starting with linux commit v4.0-rc4~21^2, "SP" register
	is available via regs[PTR_SP] member of struct user_pt_regs.

	* linux/nios2/arch_regs.h (nios2_sp_ptr): Change type
	to "unsigned int *".
	* linux/nios2/arch_regs.c (nios2_sp_ptr): Likewise.
	Replace .sp with .regs[PTR_SP].

	Fixes: http://autobuild.buildroot.net/results/b9f/b9fc25b82f3280872fe1593ac252a8529ba83576
	Fixes: v4.16-34-g6117728a ("nios2: export nios2_sp_ptr")

2017-07-03  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	tests: add multi-process check to qual_fault.test.
	Check that syscall counters used for tampering are per-tcb.

	* tests/qual_fault.c: Include <fcntl.h> for open(),
	<sys/param.h> for PATH_MAX, and <sys/wait.h> for wait().
	(expfd): Rename to exp_fd, remove const qualifier and initialization.
	(gotfd): Rename to got_fd, remove const qualifier and initialization.
	(out_fd): New variable, for the expected strace output.
	(open_file): New helper function.
	(main): Remove st, add num_procs, proc, exp_prefix, got_prefix,
	out_prefix, pid_prefix.  Remove stat asserts, update argc assert.
	Add num_procs, exp_prefix, got_prefix, out_prefix, pid_prefix
	initialization.  Add per-process loop, open expfd, gotfd, out_fd, pidfd
	in each one, print process's pid to pidfd, print exit message to out_fd.
	Add wait() call for each forked process.
	* tests/qual_fault.test (N): increase to 100 in order to check
	concurrent process execution.
	(check_fault_injection): Take additional argument for the process
	count, pass it to qual_fault, add filename variables for expected strace
	output and pid file, pass them to qual_fault.
	Specify -ff parameter to strace invocation.
	Compare write and strace output for the each process.
	Update all check_fault_injection invocation with process count argument,
	add an invocation with 4 concurrent processes.
	* tests/init.sh (TIMEOUT_DURATION): Raise from 120 to 300.

2017-07-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: adjust TEST_NLATTR_OBJECT and TEST_NLATTR_ARRAY for large objects
	* tests/test_nlattr.h (TEST_NLATTR_OBJECT, TEST_NLATTR_ARRAY): Add
	support for objects larger than DEFAULT_STRLEN.
	* tests/nlattr_inet_diag_msg.c (main): Change pattern size
	from DEFAULT_STRLEN to 4096.
	* tests/nlattr_netlink_diag_msg.c: Likewise.
	* tests/nlattr_unix_diag_msg.c: Likewise.

	Reported-by: JingPiao Chen <chenjingpiao@gmail.com>

2017-07-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: move DEFAULT_STRLEN macro to tests.h.
	* tests/tests.h [!DEFAULT_STRLEN] (DEFAULT_STRLEN): New macro.
	* tests/mincore.c (DEFAULT_STRLEN): Remove.
	* tests/mmsg_name.c: Likewise.
	* tests/msg_control.c: Likewise.
	* tests/netlink_protocol.c: Likewise.
	* tests/nlattr.c: Likewise.
	* tests/nlattr_inet_diag_msg.c: Likewise.
	* tests/nlattr_netlink_diag_msg.c: Likewise.
	* tests/nlattr_unix_diag_msg.c: Likewise.
	* tests/printstr.c: Likewise.
	* tests/xattr.c: Likewise.
	* tests/execve.c: Likewise.
	(main): Initialize str_a and str_b arrays at run time.
	* tests/execveat.c: Likewise.

	Suggested-by: JingPiao Chen <chenjingpiao@gmail.com>

2017-07-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: use unified diff in order to improve test log readability.
	* tests/init.sh (match_diff): Add -u option to the diff invocation.

2017-07-02  Dmitry V. Levin  <ldv@altlinux.org>

	Fix error diagnostics in case of zero argc.
	* strace.c (init): Adjust argc along with argv,
	check that adjusted argc is sane.
	* tests/zeroargc.c: New file.
	* tests/.gitignore: Add zeroargc.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	* tests/options-syntax.test: Check strace error diagnostics
	in case of zero argc.

2017-07-02  Dmitry V. Levin  <ldv@altlinux.org>

	Use program_invocation_name instead of a local progname variable.
	Emulate program_invocation_name only if it is not provided by libc.

	* configure.ac: Check for program_invocation_name variable.
	* strace.c (progname): Remove.
	[!HAVE_PROGRAM_INVOCATION_NAME] (program_invocation_name): New variable.
	(verror_msg, error_msg_and_help): Use it instead of progname.
	(init): Initialize program_invocation_name instead of progname.

2017-07-02  Dmitry V. Levin  <ldv@altlinux.org>
	    Victor Krapivensky  <krapivenskiy.va@phystech.edu>

	Introduce generic STRINGIFY and STRINGIFY_VAL macros.
	* macros.h (STRINGIFY, STRINGIFY_VAL): New macros.
	* mpers_type.h: Include "macros.h".
	[IN_MPERS] (STRINGIFY): Remove.
	* tests/sockname.c (TEST_SYSCALL_STR__, TEST_SYSCALL_STR_): Remove.
	(TEST_SYSCALL_STR): Use STRINGIFY_VAL.

2017-07-02  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce macros.h.
	Introduce a separate header file for generic macros shared between
	strace and its tests.  Start this unification with ARRAY_SIZE macro.

	* defs.h: Include "macros.h".
	(ARRAY_SIZE): Move ...
	* macros.h: ... to new file.
	* Makefile.am (strace_SOURCES): Add it.
	* tests/tests.h: Include "macros.h".
	(ARRAY_SIZE): Remove.  All callers updated.

2017-07-01  Dmitry V. Levin  <ldv@altlinux.org>

	quota: use PRINT_FIELD_FLAGS.
	* quota.c (struct xfs_dqblk): Change d_flags field's type from int8_t
	to uint8_t.
	(decode_cmd_data): Use PRINT_FIELD_FLAGS.

2017-07-01  Dmitry V. Levin  <ldv@altlinux.org>

	Unify different generic PRINT_FIELD_* implementations.
	Create a new header print_fields.h and move generic PRINT_FIELD_*
	macros there.

	* print_fields.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* netlink_sock_diag.c: Include "print_fields.h".
	(PRINT_FIELD_U, PRINT_FIELD_X, PRINT_FIELD_COOKIE, PRINT_FIELD_FLAGS,
	PRINT_FIELD_XVAL): Move to print_fields.h file.
	* quota.c: Include "print_fields.h".
	(PRINT_FIELD_D): Move to print_fields.h file.
	(PRINT_FIELD_U, PRINT_FIELD_X): Remove.
	* statx.c: Include "print_fields.h".
	(PRINT_FIELD_U): Remove.
	(SYS_FUNC(statx)): Update PRINT_FIELD_U callers.
	* tests/quotactl.h: Include "print_fields.h".
	* tests/quotactl-xfs.c: Update callers of PRINT_FIELD_* macros.
	* tests/quotactl.c: Likewise.
	(PRINT_FIELD_D, PRINT_FIELD_U, PRINT_FIELD_X): Remove.
	* tests/test_nlattr.h: Include "print_fields.h".
	(PRINT_FIELD_U, PRINT_FIELD_X): Remove.
	* tests/xstatx.c: Include "print_fields.h".
	(PRINT_FIELD_U): Remove.
	(print_stat): Update PRINT_FIELD_U callers.
	* tests/tests.h [!STRACE_PRINTF] (STRACE_PRINTF): Define to printf.

2017-07-01  Eugeniy Paltsev  <Eugeniy.Paltsev@synopsys.com>

	arc: fix wrong access to "sp" member in user_regs_struct.
	"sp" register is a member of "scratch" structure (which is nested
	in user_regs_struct)

	* linux/arc/arch_regs.c: Replace .sp with .scratch.sp .

	Fixes: v4.16-31-g134042a5 ("arc: export arc_sp_ptr")

2017-07-01  Khem Raj  <raj.khem@gmail.com>

	aarch64, tile: replace struct ucontext with ucontext_t.
	glibc >= 2.26 has dropped the tag struct ucontext from ucontext_t type.

	* linux/arm/arch_sigreturn.c (arch_sigreturn) [AARCH64]: Replace
	struct ucontext with ucontext_t.
	* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.

2017-07-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests: enhance nlattr_unix_diag_msg test.
	* tests/nlattr_unix_diag_msg.c: Include "test_nlattr.h".
	(test_unix_diag_vfs, test_unix_diag_icons, test_unix_diag_rqlen):
	Remove.
	(init_unix_diag_msg): Add const qualifier to arguments and variables.
	(print_unix_diag_msg, print_uint): New functions.
	(main): Use them and macros from test_nlattr.h file.

2017-07-01  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of netlink unix_diag_msg attributes.
	* tests/nlattr_unix_diag_msg.c: New file.
	* tests/gen_tests.in (nlattr_unix_diag_msg): New entry.
	* tests/pure_executables.list: Add nlattr_unix_diag_msg.
	* tests/.gitignore: Likewise.

2017-07-01  Dmitry V. Levin  <ldv@altlinux.org>

	netlink_sock_diag: ensure that structure field names are printed properly
	* netlink_sock_diag.c (decode_unix_diag_vfs, decode_unix_diag_rqlen):
	Use PRINT_FIELD_U to print structure fields.

2017-07-01  Dmitry V. Levin  <ldv@altlinux.org>

	netlink_sock_diag: add const qualifiers.
	Add const qualifiers to auto variables and function arguments.
	This change does not affect the code generated by the compiler,
	the purpose of these "const" qualifiers is to highlight the intent.

	* netlink_sock_diag.c (decode_unix_diag_vfs, decode_unix_diag_inode,
	decode_unix_diag_rqlen): Add const qualifier to tcp, addr, and len
	arguments.

2017-07-01  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink: decode AF_UNIX unix_diag_msg attributes.
	* netlink_sock_diag.c (unix_diag_msg_nla_decoders): New array.
	(decode_unix_diag_msg): Use it.
	* linux/unix_diag.h (unix_diag_vfs, unix_diag_rqlen): New structures.

2017-07-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests: enhance nlattr_netlink_diag_msg test.
	* tests/nlattr_netlink_diag_msg.c: Include "test_nlattr.h".
	(test_netlink_diag_groups, test_netlink_diag_rx_ring,
	test_netlink_diag_flags): Remove.
	(init_netlink_diag_msg): Add const qualifier to arguments and variables.
	(print_netlink_diag_msg, print_xlong): New functions.
	(main): Use them and macros from test_nlattr.h file.

2017-07-01  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of netlink_diag_msg attributes.
	* tests/nlattr_netlink_diag_msg.c: New file.
	* tests/gen_tests.in (nlattr_netlink_diag_msg): New entry.
	* tests/pure_executables.list: Add nlattr_netlink_diag_msg.
	* tests/.gitignore: Likewise.

2017-07-01  Dmitry V. Levin  <ldv@altlinux.org>

	netlink_sock_diag: ensure that structure field names are printed properly
	* netlink_sock_diag.c (decode_netlink_diag_ring): Use PRINT_FIELD_U
	to print structure fields.

2017-07-01  Dmitry V. Levin  <ldv@altlinux.org>

	netlink_sock_diag: add const qualifiers.
	Add const qualifiers to auto variables and function arguments.
	This change does not affect the code generated by the compiler,
	the purpose of these "const" qualifiers is to highlight the intent.

	* netlink_sock_diag.c (print_group, decode_netlink_diag_groups,
	decode_netlink_diag_ring, decode_netlink_diag_flags): Add const
	qualifier to tcp, addr, and len arguments.

2017-07-01  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink: decode AF_NETLINK netlink_diag_msg attributes.
	* linux/netlink_diag.h (netlink_diag_ring): New structure.
	(NDIAG_FLAG_*): New macros.
	* netlink_sock_diag.c: Include "xlat/netlink_socket_flags.h".
	(print_group, decode_netlink_diag_groups, decode_netlink_diag_ring,
	decode_netlink_diag_flags): New functions.
	(netlink_diag_msg_nla_decoders): New array.
	(decode_netlink_diag_msg): Use it.
	* xlat/netlink_socket_flags.in: New file.

2017-07-01  Dmitry V. Levin  <ldv@altlinux.org>

	netlink_sock_diag: print inet_diag_sockid.idiag_if as an interface index
	* netlink_sock_diag.c (print_inet_diag_sockid): Print idiag_if field
	using print_ifindex.
	* tests/nlattr_inet_diag_msg.c: Include <net/if.h>.
	(IFINDEX_LO): New macro.
	(init_inet_diag_msg): Set inet_diag_sockid.idiag_if field.
	(print_inet_diag_msg): Update expected output.

2017-07-01  Dmitry V. Levin  <ldv@altlinux.org>
	    JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of several standard netlink attributes.
	* tests/nlattr_inet_diag_msg.c (main): Check decoding of uint32_t,
	uint8_t, and zero-terminated string attributes.

2017-06-30  Dmitry V. Levin  <ldv@altlinux.org>

	tests: enhance nlattr_inet_diag_msg test.
	* tests/test_nlattr.h: New file.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.
	* tests/nlattr_inet_diag_msg.c: Include "test_nlattr.h".
	(test_inet_diag_meminfo, test_inet_diag_vegasinfo,
	test_inet_diag_dctcpinfo, test_inet_diag_bbrinfo): Remove.
	(address): New variable.
	(init_inet_diag_msg): Remove "address" argument, add const qualifier
	to all remaining arguments.
	(print_inet_diag_msg, print_uint): New functions.
	(main): Use macros from test_nlattr.h file.

2017-06-30  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of netlink inet_diag_msg attributes.
	* tests/nlattr_inet_diag_msg.c: New file.
	* tests/gen_tests.in (nlattr_inet_diag_msg): New entry.
	* tests/pure_executables.list: Add nlattr_inet_diag_msg.
	* tests/.gitignore: Likewise.

2017-06-30  Dmitry V. Levin  <ldv@altlinux.org>

	netlink_sock_diag: ensure that structure field names are printed properly
	* netlink_sock_diag.c (PRINT_FIELD_X): New macro.
	(decode_inet_diag_meminfo, decode_tcpvegas_info, decode_tcp_dctcp_info,
	decode_tcp_bbr_info): Use it and PRINT_FIELD_U to print structure
	fields.

2017-06-30  Dmitry V. Levin  <ldv@altlinux.org>

	netlink_sock_diag: add const qualifiers.
	Add const qualifiers to auto variables and function arguments.
	This change does not affect the code generated by the compiler,
	the purpose of these "const" qualifiers is to highlight the intent.

	* netlink_sock_diag.c (print_meminfo, decode_meminfo,
	decode_inet_diag_meminfo, decode_tcpvegas_info, decode_tcp_dctcp_info,
	decode_tcp_bbr_info): Add const qualifier to tcp, addr, and len
	arguments.

2017-06-30  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink: decode AF_INET inet_diag_msg attributes.
	* linux/inet_diag.h (inet_diag_meminfo, tcpvegas_info,
	tcp_dctcp_info, tcp_bbr_info): New structures.
	* linux/sock_diag.h (SK_MEMINFO_VARS): New macro.
	* netlink_sock_diag.c: Include  <linux/sock_diag.h>.
	(print_meminfo, decode_meminfo, decode_inet_diag_meminfo,
	decode_tcpvegas_info, decode_tcp_dctcp_info, decode_tcp_bbr_info):
	New functions.
	(inet_diag_msg_nla_decoders): New array.
	(decode_inet_diag_msg): Use it.

2017-06-30  Dmitry V. Levin  <ldv@altlinux.org>

	nlattr: add const qualifiers to auto variables and function arguments.
	This change does not affect the code generated by the compiler,
	the purpose of these "const" qualifiers is to highlight the intent.

	* nlattr.c (decode_nlattr_with_data, decode_nla_str, decode_nla_strn,
	decode_nla_##name): Add const qualifier to tcp, addr, and len arguments.

2017-06-30  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: introduce nla_decoder_t to parse netlink attributes data.
	* nlattr.h (nla_decoder_t): New typedef.
	(DECL_NLA): New macro.
	(decode_nlattr): Add decoders, size and opaque_data argument.
	* nlattr.c: (decode_nlattr_with_data): Likewise.
	(decode_nla_*): New functions.
	* netlink_sock_diag.c (decode_inet_diag_req_compat)
	(decode_inet_diag_req_v2, decode_inet_diag_msg)
	(decode_netlink_diag_msg, (decode_packet_diag_msg)
	(decode_smc_diag_msg, decode_unix_diag_msg): Add decoders,
	size and opaque_data arguments. All callers updated.

2017-06-30  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink: add a basic netlink attribute parser of AF_SMC diag.
	* netlink_sock_diag.c: Include "xlat/smc_diag_attrs.h".
	(decode_smc_diag_msg): Use decode_nlattr.
	* xlat/smc_diag_attrs.in: New file.

2017-06-30  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: add a basic netlink attribute parser of AF_INET diag.
	* linux/inet_diag.h (INET_DIAG_REQ_*): New enum.
	* netlink_sock_diag.c: Include "xlat/inet_diag_attrs.h"
	and "xlat/inet_diag_req_attrs.h".
	(decode_inet_diag_req_compat, decode_inet_diag_req_v2,
	 decode_inet_diag_msg): Use decode_nlattr.
	* xlat/inet_diag_attrs.in: New file.
	* xlat/inet_diag_req_attrs.in: Likewise.

	netlink: add a basic netlink attribute parser of AF_PACKET diag.
	* linux/packet_diag.h (PACKET_DIAG_*): New enum.
	* netlink_sock_diag.c: Include "xlat/packet_diag_attrs.h".
	(decode_packet_diag_msg): Use decode_nlattr.
	* xlat/packet_diag_attrs.in: New file.

	netlink: add a basic netlink attribute parser of AF_NETLINK diag.
	* linux/netlink_diag.h (NETLINK_DIAG_*): New enum.
	* netlink_sock_diag.c: Include "xlat/netlink_diag_attrs.h".
	(decode_netlink_diag_msg): Use decode_nlattr.
	* xlat/netlink_diag_attrs.in: New file.

2017-06-29  Dmitry V. Levin  <ldv@altlinux.org>

	netlink_sock_diag: ensure that structure field names are printed properly
	* netlink_sock_diag.c (PRINT_FIELD_U, PRINT_FIELD_COOKIE,
	PRINT_FIELD_FLAGS, PRINT_FIELD_XVAL): New macros.
	(decode_unix_diag_req, decode_unix_diag_msg, decode_netlink_diag_req,
	decode_netlink_diag_msg, decode_packet_diag_req, decode_packet_diag_msg,
	print_inet_diag_sockid, decode_inet_diag_req_compat,
	decode_inet_diag_req_v2, decode_inet_diag_msg, decode_smc_diag_req,
	decode_smc_diag_msg): Use them to print structure fields.

2017-06-29  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Update ioctl entries from linux v4.12-rc7.
	* linux/32/ioctls_inc_align16.h: Update from linux v4.12-rc7
	(with f7a320ff commit applied on top) using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* NEWS: Mention this.

2017-06-29  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	maint: fix ioctls_sym.sh premature termination.
	When the list of headers do not fit into the command line, xargs splits
	it into several lists and then passes them to grep.  If no headers from
	a list match the grep pattern, grep exits with a non-zero status that
	causes xargs to exit with a non-zero status, too.

	* maint/ioctls_sym.sh: Use "find -exec +" instead of xargs,
	ignore its exit status.

2017-06-27  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: introduce NLMSG_ATTR macro.
	* tests/tests.h (NLMSG_ATTR): New macro.
	* tests/nlattr.c (test_nlattr, test_nla_type): Use it.

2017-06-27  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink: pass NLMSG_DONE messages to family specific payload decoders.
	While many NLMSG_DONE messages indeed have payload containing
	just one integer, there are exceptions. Handle this by passing
	payloads of NLMSG_DONE messages to family specific netlink
	payload decoders.

	* netlink.c (print_nlmsghdr): Do not skip family detection
	for nlmsg_type == NLMSG_DONE.
	(decode_nlmsg_type): Skip family specific type decoders
	for type == NLMSG_DONE.
	(decode_nlmsg_flags): Skip family specific decoding of flags
	for type == NLMSG_DONE.
	(decode_netlink_sock_diag): Skip for nlmsg_type == NLMSG_DONE.

2017-06-26  Dmitry V. Levin  <ldv@altlinux.org>

	Unexport die_out_of_memory.
	Print more specific error diagnostics than a generic "Out of memory"
	when an error happens outside xmalloc.c.

	* defs.h (die_out_of_memory): Remove prototype.
	* strace.c (strace_popen, init): Call perror_msg_and_die instead
	of die_out_of_memory.
	* unwind.c (unwind_tcb_init): Likewise.
	* xmalloc.c (die_out_of_memory): Add static qualifier.

2017-06-26  Dmitry V. Levin  <ldv@altlinux.org>

	Check -s argument early.
	* util.c (printstr_ex): Move the check that -s argument
	does not exceed -1U / 4 ...
	* strace.c (init): ... here.
	* tests/options-syntax.test: Check it.

2017-06-25  Dmitry V. Levin  <ldv@altlinux.org>

	Include "netlink.h" instead of <linux/netlink.h>
	* net.c: Include "netlink.h" instead of <linux/netlink.h>.
	* sockaddr.c: Likewise.
	* tests/create_nl_socket.c: Likewise.
	* tests/net-sockaddr.c: Likewise.
	* tests/netlink_audit.c: Likewise.
	* tests/netlink_generic.c: Likewise.
	* tests/netlink_inet_diag.c: Likewise.
	* tests/netlink_netfilter.c: Likewise.
	* tests/netlink_route.c: Likewise.
	* tests/netlink_selinux.c: Likewise.
	* tests/netlink_xfrm.c: Likewise.
	* tests/net-yy-netlink.c: Include "netlink.h" instead
	of <linux/netlink.h>, remove fallback definition of NETLINK_SOCK_DIAG.
	* tests/netlink_netlink_diag.c: Likewise.
	* tests/netlink_protocol.c: Likewise.
	* tests/netlink_sock_diag.c: Likewise.
	* tests/netlink_unix_diag.c: Likewise.
	* tests/nlattr.c: Likewise.

2017-06-24  Dmitry V. Levin  <ldv@altlinux.org>

	netlink: provide a fallback definition of NETLINK_SOCK_DIAG.
	Add a fallback definition of NETLINK_SOCK_DIAG to netlink.h
	instead of adding these fallback definitions to every file.

	* netlink.h: Provide a fallback definition of NETLINK_SOCK_DIAG.
	* socketutils.c: Include "netlink.h" instead of <linux/netlink.h>,
	remove fallback definition of NETLINK_SOCK_DIAG.

2017-06-23  Dmitry V. Levin  <ldv@altlinux.org>

	Update prctl ARCH_* constants.
	* xlat/archvals.in: Add ARCH_GET_CPUID and ARCH_SET_CPUID
	introduced by linux kernel commit v4.12-rc1~153^2~2.

2017-06-22  Dmitry V. Levin  <ldv@altlinux.org>

	Update V4L2_* constants.
	* xlat/v4l2_buf_types.in: Add V4L2_BUF_TYPE_META_CAPTURE introduced
	by linux kernel commit v4.12-rc1~85^2~71.
	* xlat/v4l2_device_capabilities_flags.in: Add V4L2_CAP_META_CAPTURE
	introduced by the same commit.
	* xlat/v4l2_control_flags.in: Add V4L2_CTRL_FLAG_HAS_PAYLOAD,
	V4L2_CTRL_FLAG_EXECUTE_ON_WRITE, and V4L2_CTRL_FLAG_MODIFY_LAYOUT
	introduced by linux kernel commits v3.17-rc1~112^2~363,
	v4.1-rc1~59^2~1^2~63, and v4.12-rc1~85^2~62, respectively.
	* xlat/v4l2_control_types.in: Add V4L2_CTRL_TYPE_U8, V4L2_CTRL_TYPE_U16,
	and V4L2_CTRL_TYPE_U32 introduced by linux kernel commits
	v3.17-rc1~112^2~343 and v3.17-rc1~112^2~112.

	Update SCTP_* constants.
	* xlat/socksctpoptions.in: Add SCTP_ENABLE_STREAM_RESET,
	SCTP_RESET_STREAMS, SCTP_RESET_ASSOC, SCTP_ADD_STREAMS,
	SCTP_RECONFIG_SUPPORTED, and SCTP_PR_STREAM_STATUS introduced
	by linux kernel commits v4.11-rc1~124^2~387^2~1, v4.11-rc1~124^2~387^2,
	v4.11-rc1~124^2~166^2~2, v4.11-rc1~124^2~166^2, v4.12-rc1~64^3~469^2,
	and v4.12-rc1~64^3~276, respectively.

	Update RTM_* constants.
	* xlat/nl_route_types.in: Add RTM_DELNETCONF introduced
	by linux kernel commit v4.12-rc1~64^3~312^2~6.

	Update NDIAG_SHOW_* constants.
	* linux/netlink_diag.h (NDIAG_SHOW_FLAGS): New constant introduced
	by linux kernel commit v4.12-rc1~64^3~260.
	* xlat/netlink_diag_show.in: Add it.

	Update KEYCTL_* constants.
	* xlat/keyctl_commands.in: Add KEYCTL_RESTRICT_KEYRING introduced
	by linux kernel commit v4.12-rc1~123^2~7^2~2^2~3.

	Update ARPHRD_* constants.
	* xlat/arp_hardware_types.in: Add ARPHRD_VSOCKMON introduced
	by linux kernel commit v4.12-rc1~129^2~118^2~2.

	Update SO_* constants.
	* xlat/sockoptions.in: Add SO_MEMINFO, SO_INCOMING_NAPI_ID,
	and SO_COOKIE introduced by linux kernel commits v4.12-rc1~64^3~389,
	v4.12-rc1~64^3~341^2, and v4.12-rc1~64^3~221^2~1, respectively.

2017-06-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check more corner cases of nlattr decoding.
	* tests/nlattr.c (test_nlattr): Check decoding in case of invalid
	struct nlattr.nla_len.

2017-06-21  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of netlink attribute.
	* tests/nlattr.c: New file.
	* tests/gen_tests.in (nlattr): New entry.
	* tests/pure_executables.list: Add nlattr.
	* tests/.gitignore: Likewise.

2017-06-21  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: introduce a basic netlink attributes parser.
	* linux/unix_diag.h (UNIX_DIAG_*): New enum.
	* nlattr.c: New file.
	* nlattr.h: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* netlink_sock_diag.c: Include "nlattr.h" and "xlat/unix_diag_attrs.h".
	(decode_unix_diag_msg): Use decode_nlattr.
	* xlat/unix_diag_attrs.in: New file.

2017-06-21  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink: introduce netlink.h.
	* netlink.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* netlink_sock_diag.c: Include "netlink.h",
	remove <sys/socket.h> and <linux/netlink.h>.
	* netlink.c: Likewise.
	(NLMSG_HDRLEN): Move to netlink.h.
	* tests/netlink_protocol.c: Replace <linux/netlink.h> with "netlink.h".
	* tests/netlink_sock_diag.c: Likewise.

2017-06-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add SET_STRUCT macro to tests.h.
	* tests/netlink_sock_diag.c (INIT_STRUCT): Rename to SET_STRUCT,
	all callers updated.  Move ...
	* tests/tests.h: ... here.

2017-06-19  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix potential unaligned access in netlink_sock_diag.test.
	Despite our efforts made to avoid unaligned access, gcc appears to be
	generating instructions that might cause unaligned access when copying
	structures to unaligned addresses.

	Fix this issue by replacing copying of structures to unaligned addresses
	with memcpy calls.

	* tests/netlink_sock_diag.c (INIT_STRUCT): New macro.
	(test_odd_family_req, test_odd_family_msg, test_unix_diag_req,
	test_unix_diag_msg, test_netlink_diag_req, test_netlink_diag_msg,
	test_packet_diag_req, test_packet_diag_msg, test_inet_diag_sockid,
	test_inet_diag_req, test_inet_diag_req_v2, test_inet_diag_msg,
	test_smc_diag_req, test_smc_diag_msg): Use it to initialize potentially
	unaligned struct nlmsghdr.  Do not access nlh->nlmsg_len.

2017-06-19  Masatake YAMATO  <yamato@redhat.com>

	tests: check decoding of NETLINK_GENERIC message types.
	* tests/netlink_generic.c: New file.
	* tests/gen_tests.in (netlink_generic): New entry.
	* tests/pure_executables.list: Add netlink_generic.
	* tests/.gitignore: Likewise.

2017-06-19  Masatake YAMATO  <yamato@redhat.com>

	netlink: add decoding of NETLINK_GENERIC protocol families.
	NETLINK_GENERIC is a protocol stacked on netlink protocol.

	When a NETLINK_GENERIC subsystem registers its "family" name in the
	kernel at run time, an integer value associated with this name is
	assigned by the kernel.  This integer value is specified in struct
	nlmsghdr.nlmsg_type of subsequent communications with the
	NETLINK_GENERIC subsystem.

	This change implements decoding of NETLINK_GENERIC message types in
	symbolic form, for example:

	  $ ./strace -yy -e 'sendto' ip tcp_metrics > /dev/null
	  sendto(4<NETLINK:[GENERIC:12345]>, {{len=20, type=tcp_metrics, ...
	  +++ exited with 0 +++

	Note that type= specifying the NETLINK_GENERIC protocol family
	is decoded properly.

	* netlink.c (decode_nlmsg_type_generic): New function.
	(nlmsg_types): Add NETLINK_GENERIC entry.

2017-06-19  Masatake YAMATO  <yamato@redhat.com>

	socketutils: build a dynamic xlat table for NETLINK_GENERIC decoding.
	* configure.ac (AC_CHECK_HEADERS): Add linux/genetlink.h.
	* defs.h (genl_families_xlat): New prototype.
	* socketutils.c [HAVE_LINUX_GENETLINK_H]: Include <linux/genetlink.h>.
	[HAVE_LINUX_GENETLINK_H] (genl_send_dump_families,
	genl_parse_families_response): New helper functions.
	(genl_families_xlat): New function for building the xlat table
	for NETLINK_GENERIC decoding.

2017-06-19  Masatake YAMATO  <yamato@redhat.com>

	dyxlat: new interface for building xlat tables dynamically.
	xlat tables are usually generated at build time.

	printxval is suitable for printing struct nlmsghdr.nlmsg_type for
	NETLINK_GENERIC protocol.  However, the corresponding xlat table
	cannot be defined at build time because the values are registered
	by the kernel at run time.

	This change introduces dyxlat functions for building xlat tables
	dynamically.  The primary use case is decoding nlmsg_type but this
	interface can be used for other purposes.

	* defs.h (struct dyxlat): New opaque data type.
	(dyxlat_alloc, dyxlat_free, dyxlat_add_pair): New function declarations.
	* dyxlat.c: New file.
	* Makefile.am (strace_SOURCES): Add it.

2017-06-19  Masatake YAMATO  <yamato@redhat.com>

	Introduce xstrndup function.
	* configure.ac (AC_CHECK_FUNCS): Add strndup.
	* defs.h (xstrndup): New prototype.
	* xmalloc.c (xstrndup): New function.

2017-06-18  Dmitry V. Levin  <ldv@altlinux.org>

	netlink: do not print extra braces around payloadless nlmsghdr.
	* netlink.c (decode_nlmsghdr_with_payload): Print braces before
	print_nlmsghdr and after decode_payload iff decode_payload is invoked.
	* tests/netlink_audit.c (test_nlmsg_type): Update expected output.
	* tests/netlink_netfilter.c: Likewise.
	* tests/netlink_selinux.c: Likewise.
	* tests/netlink_protocol.c (send_query): Likewise.
	* tests/netlink_route.c (test_nlmsg_type, test_nlmsg_flags): Likewise.
	* tests/netlink_sock_diag.c: Likewise.
	* tests/netlink_xfrm.c: Likewise.

2017-06-17  Dmitry V. Levin  <ldv@altlinux.org>

	Strip argument name of type "struct tcb *" from function prototypes.
	"struct tcb *" was used in most prototypes along with "struct tcb *tcp",
	this change converts the latter form to the former for consistency.

	Fix a few spacing style issues.
	Reported by kernel's checkpatch.pl script.

2017-06-17  Dmitry V. Levin  <ldv@altlinux.org>

	Strip redundant trailing semicolons.
	Strip trailing semicolons from macro definitions.
	Strip extra semicolons from statements terminations.

	Reported by kernel's checkpatch.pl script.

2017-06-17  Dmitry V. Levin  <ldv@altlinux.org>

	Fix macros encosure in a do/while loop.
	Enclose macros with multiple statements and macros starting
	with "if" statement in a do/while loop.
	Do not enclose single statement macros in a do/while loop.

	Reported by kernel's checkpatch.pl script.

2017-06-17  Dmitry V. Levin  <ldv@altlinux.org>

	Use __func__ instead of gcc specific __FUNCTION__
	Reported by kernel's checkpatch.pl script.

2017-06-17  Dmitry V. Levin  <ldv@altlinux.org>

	Fix a few initialization style issues.
	Do not initialise statics and globals to 0, NULL, or false.

	Reported by kernel's checkpatch.pl script.

2017-06-17  Dmitry V. Levin  <ldv@altlinux.org>

	Fix function prototypes with unspecified arguments.
	Change functions declared as taking unspecified number of arguments
	of unspecified type to functions that take no arguments.

	Reported by kernel's checkpatch.pl script.

2017-06-17  Dmitry V. Levin  <ldv@altlinux.org>

	Fix a few sizeof style issues.
	Reported by kernel's checkpatch.pl script.

	Fix a few misspellings in comments.
	Reported by kernel's checkpatch.pl script.

2017-06-16  Dmitry V. Levin  <ldv@altlinux.org>

	print_mreq: remove superfluous print_quoted_string calls.
	The string returned by inet_ntoa(3) has IPv4 dotted-decimal notation,
	no need to quote it.

	* net.c (print_mreq): Remove print_quoted_string calls.

2017-06-15  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of incomplete SCM_TIMESTAMP* control messages.
	* tests/msg_control.c (test_scm_timestamp, test_scm_timestampns,
	test_scm_timestamping): Check decoding of incomplete control messages.

2017-06-15  Miroslav Lichvar  <mlichvar@redhat.com>

	msghdr: print SCM_TIMESTAMP* control messages.
	Add support for printing control messages containing software and/or
	hardware timestamps, which are typically enabled by NTP and PTP
	implementations.

	* print_timeval.c (print_struct_timeval_data_size): New mpers printer.
	* print_timespec.c (print_struct_timespec_data_size,
	print_struct_timespec_array_data_size): Likewise.
	* msghdr.c (print_scm_timestamp, print_scm_timestampns,
	print_scm_timestamping): New functions.
	(cmsg_socket_printers): Add them.
	* NEWS: Mention this change.
	* tests/msg_control.c: Include "xlat.h" and "xlat/scmvals.h".
	(test_scm_timestamp, test_scm_timestampns, test_scm_timestamping):
	New functions.
	(test_sol_socket): Use them.

2017-06-15  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_SOCK_DIAG AF_SMC messages.
	* tests/netlink_sock_diag.c: Include <linux/smc_diag.h>.
	(SMC_ACTIVE): New macro.
	(test_smc_diag_req, test_smc_diag_msg): New functions.
	(main): Use them.

	netlink: add a basic socket diag parser of AF_SMC messages.
	* linux/smc_diag.h: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* netlink_sock_diag.c: Include <linux/smc_diag.h>,
	"xlat/smc_diag_extended_flags.h" and "xlat/smc_states.h".
	(decode_smc_diag_req, decode_smc_diag_msg): New functions.
	(diag_decoders): Add AF_SMC.
	* xlat/smc_diag_extended_flags.in: New file.
	* xlat/smc_states.in: Likewise.

2017-06-15  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	tests: check decoding of NETLINK_SOCK_DIAG AF_INET messages.
	* tests/netlink_sock_diag.c: Include <arpa/inet.h>
	and <linux/inet_diag.h>.
	(test_inet_diag_sockid, test_inet_diag_req, test_inet_diag_req_v2,
	test_inet_diag_msg): New functions.
	(mian): Use them.

	netlink: add a basic socket diag parser of AF_INET and AF_INET6 messages
	* defs.h (inet_protocols): New xlat prototype.
	* linux/inet_diag.h (inet_diag_req): New structure.
	(INET_DIAG_*): New enum.
	* netlink_sock_diag.c: Include <arpa/inet.h>, <linux/inet_diag.h>
	and "xlat/inet_diag_extended_flags.h".
	(print_inet_diag_sockid, decode_inet_diag_req_compat)
	(decode_inet_diag_req_v2, decode_inet_diag_req)
	(decode_inet_diag_msg): New functions.
	(diag_decoders): Add AF_INET and AF_INET6;
	* xlat/inet_diag_extended_flags.in: New file.

2017-06-15  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce print_inet_addr.
	* defs.h (print_inet_addr): New prototype.
	* sockaddr.c (print_inet_addr): New function.
	(print_sockaddr_data_in6): Use it.
	* net.c (print_mreq6): Likewise.
	* tests/ip_mreq.c (main): Update expected output.

2017-06-15  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>

	tests: check decoding of NETLINK_SOCK_DIAG AF_PACKET messages.
	* tests/netlink_sock_diag.c: Include <linux/if_ether.h>
	and <linux/packet_diag.h>.
	(test_packet_diag_req, test_packet_diag_msg): New functions.
	(main): Use them.

	netlink: add a basic socket diag parser of AF_PACKET messages.
	* linux/packet_diag.h: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* defs.h (ethernet_protocols): New xlat prototype.
	* netlink_sock_diag.c: Include <linux/packet_diag.h>
	and "xlat/packet_diag_show.h".
	(decode_packet_diag_req, decode_packet_diag_msg): New functions.
	(diag_decoders): Add AF_PACKET.
	* xlat/packet_diag_show.in: New file.

	tests: check decoding of NETLINK_SOCK_DIAG AF_NETLINK messages.
	* tests/netlink_sock_diag.c: Include <linux/netlink_diag.h>.
	(test_netlink_diag_req, test_netlink_diag_msg): New functions.
	(main): Use them.

	netlink: add a basic socket diag parser of AF_NETLINK messages.
	* linux/netlink_diag.h (NDIAG_SHOW_GROUPS, NDIAG_SHOW_RING_CFG):
	New macros.
	* netlink_sock_diag.c: Include <linux/netlink_diag.h>,
	"xlat/netlink_diag_show.h" and "xlat/netlink_states.h".
	(decode_netlink_diag_req, decode_netlink_diag_msg): New functions.
	(diag_decoders): Add AF_NETLINK.
	* xlat/netlink_diag_show.in: New file.
	* xlat/netlink_states.in: Likewise.

2017-06-15  Dmitry V. Levin  <ldv@altlinux.org>
	    Fabien Siron  <fabien.siron@epita.fr>
	    JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_SOCK_DIAG AF_UNIX messages.
	* tests/netlink_sock_diag.c: Include <netinet/tcp.h>
	and <linux/unix_diag.h>.
	(test_odd_family_req, test_odd_family_msg, test_unix_diag_req,
	test_unix_diag_msg): New functions.
	(main): Use them.

	netlink: add a basic socket diag parser of AF_UNIX messages.
	* defs.h (socktypes): New xlat prototype.
	* linux/unix_diag.h (UDIAG_SHOW_VFS, UDIAG_SHOW_ICONS, UDIAG_SHOW_RQLEN,
	UDIAG_SHOW_MEMINFO): New macros.
	* netlink_sock_diag.c: Include <sys/socket.h>, <linux/netlink.h>,
	<linux/unix_diag.h>, "xlat/tcp_states.h", "xlat/tcp_state_flags.h",
	and "xlat/unix_diag_show.h".
	(decode_unix_diag_req, decode_unix_diag_msg): New functions.
	(netlink_diag_decoder_t): New typedef.
	(diag_decoders): New array.
	(decode_netlink_sock_diag): Use it.
	* xlat/tcp_state_flags.in: New file.
	* xlat/tcp_states.in: Likewise.
	* xlat/unix_diag_show.in: Likewise.

	netlink: introduce family specific payload decoders.
	* defs.h (netlink_decoder_t): New typedef.
	(DECL_NETLINK): New macro.
	(decode_netlink_sock_diag): New prototype.
	* netlink.c (netlink_decoders): New array.
	(decode_payload): Use it to invoke netlink family specific decoders.
	* netlink_sock_diag.c: New file.
	* Makefile.am (strace_SOURCES): Add it.

2017-06-15  Dmitry V. Levin  <ldv@altlinux.org>

	Update SCM_* constants.
	* xlat/scmvals.in: Add SCM_TIMESTAMP, SCM_TIMESTAMPNS, SCM_TIMESTAMPING,
	SCM_WIFI_STATUS, and SCM_TIMESTAMPING_OPT_STATS.

2017-06-14  Dmitry V. Levin  <ldv@altlinux.org>

	netlink: refactor decode_nlmsg_type.
	* netlink.c (decode_nlmsg_type_default, decode_nlmsg_type_netfilter):
	New functions.
	(nlmsg_types_decoder_t): New typedef.
	(nlmsg_types): Add decoder field.
	(decode_nlmsg_type): Use it.

2017-06-14  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: extend printstr test.
	* tests/printstr.c (main): Add a case for short read.

2017-06-13  Dmitry V. Levin  <ldv@altlinux.org>

	v4l2: fix preprocessor checks.
	Fix checks for struct v4l2_window.global_alpha and struct
	v4l2_sdr_format.buffersize.

	* v4l2.c (print_v4l2_format_fmt): Do not assume that
	HAVE_STRUCT_V4L2_WINDOW_GLOBAL_ALPHA and
	HAVE_STRUCT_V4L2_SDR_FORMAT_BUFFERSIZE are defined.
	* tests/ioctl_v4l2.c (init_v4l2_format, dprint_ioctl_v4l2): Likewise.

2017-06-12  Dmitry V. Levin  <ldv@altlinux.org>

	Move xlat related functions to a separate file.
	* util.c (xlookup, xlat_bsearch_compare, xlat_search, printxvals,
	printxval_searchn, addflags, sprintflags, printflags_ex): Move ...
	* xlat.c: ... to this new file.
	* Makefile.am (strace_SOURCES): Add it.

2017-06-12  Masatake YAMATO  <yamato@redhat.com>

	socketeutils: extend receive_responses further.
	This is the second patch in series of implementing NETLINK_GENERIC
	protocol decoder.

	This change allows passing of opaque user data to the callback function.

	* socketutils.c (receive_responses): Change the type of proto_name
	argument from "const char *" to "void *" to allow passing
	of arbitrary data to the callback function.
	Rename proto_name to opaque_data, make it the last argument.
	Pass it to the callback function as the last argument.
	(inet_parse_response, unix_parse_response, netlink_parse_response):
	Change the type of proto_name argument from "const char *" to "void *",
	rename it to opaque_data, make it the last argument.
	Introduce a local variable proto_name to convert the type
	of opaque_data argument from "void *" to "const char *".
	(unix_get, inet_get, netlink_get): Cast the protocol name from
	"const char *" to "void *" for passing to the callback function.

2017-06-12  Masatake YAMATO  <yamato@redhat.com>

	socketeutils: extend receive_responses to handle other netlink types.
	This is the first patch in series of implementing NETLINK_GENERIC
	protocol decoder.

	receive_responses was written for decoding kernel responses of type
	SOCK_DIAG_BY_FAMILY, other types were ignored.

	This change makes the type of netlink response a parameter
	so the function can be used for other types of communication.

	* socketutils.c (receive_responses): add a new parameter
	expected_msg_type to handle types other than SOCK_DIAG_BY_FAMILY.

2017-06-12  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: fix typo.
	* tests/dup3.c (SKIP_MAIN_UNDEFINED): Remove duplicated &&.

2017-06-08  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce printflags_ex function.
	Add printflags_ex extension over printflags64 that, similar
	to printxvals, takes a NULL-terminated sequence of xlat pointers.

	* defs.h (printflags_ex): New prototype.
	(printflags64): Turn into a thin wrapper around printflags_ex.
	* netlink.c (decode_nlmsg_flags): Use printflags_ex.
	* util.c (printflags_ex): New function.
	(printflags64): Remove.
	* xlat/netlink_get_flags.in: Remove entries listed
	in xlat/netlink_flags.in file.
	* xlat/netlink_new_flags.in: Likewise.

2017-06-08  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: add check for decoding netlink get and new flags.
	* tests/netlink_route.c (test_nlmsg_flags): New function, checks
	decoding of NETLINK_ROUTE get and new flags.
	(main): Use it.
	* tests/netlink_sock_diag.c (test_nlmsg_flags): New function, checks
	decoding of NETLINK_SOCK_DIAG get flags.
	(main): Use it.
	* tests/netlink_xfrm.c: (test_nlmsg_flags): New function, checks
	decoding of NETLINK_XFRM get and new flags.
	(main): Use it.

2017-06-08  JingPiao Chen  <chenjingpiao@gmail.com>
	    Fabien Siron  <fabien.siron@epita.fr>
	    Dmitry V. Levin  <ldv@altlinux.org>

	netlink: implement generic nlmsg_flags decoding.
	* netlink.c: Include "xlat/netlink_get_flags.h"
	and "xlat/netlink_new_flags.h".
	(decode_nlmsg_flags): New function.
	(print_nlmsghdr): Use it.
	* xlat/netlink_get_flags.in: New file.
	* xlat/netlink_new_flags.in: Likewise.

2017-06-08  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: provide fallback definitions for XFRM_MSG_* constants.
	Some of XFRM_MSG_* constants were introduced later than the header file
	where they are defined.

	* xlat/nl_xfrm_types.in: Add default values for constants.

2017-06-05  Victor Krapivensky  <krapivenskiy.va@phystech.edu>

	syscall.c: split trace_syscall() into 6 functions.
	This change removes the trace_syscall function.  Now, the code that uses
	syscall.c trace functions is expected to check whether it is a syscall
	entry or exit (with entering(tcp)/exiting(tcp)) itself, and then make
	an appropriate sequence of function calls.

	* defs.h: Update comment on TCB_INSYSCALL.
	(trace_syscall): Remove prototype.
	(syscall_entering_decode, syscall_entering_trace,
	syscall_entering_finish, syscall_exiting_decode, syscall_exiting_trace,
	syscall_exiting_finish): New prototypes.
	* strace.c (trace_syscall): New static replacement for old trace_syscall.
	* syscall.c (trace_syscall): Remove.
	(trace_syscall_entering): Split into ...
	(syscall_entering_decode, syscall_entering_trace,
	syscall_entering_finish): ... new functions.
	(trace_syscall_exiting): Split into ...
	(syscall_exiting_decode, syscall_exiting_trace,
	syscall_exiting_finish): ... new functions.

2017-06-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: guard against missing linux/netfilter/nfnetlink.h.
	nfnetlink was introduced in linux by commit v2.6.14-rc1~1035^2~217,
	add a guard for the case when system headers are not fresh enough.

	* configure.ac (AC_CHECK_HEADERS): Add linux/netfilter/nfnetlink.h.
	* tests/netlink_netfilter.c: Check for HAVE_LINUX_NETFILTER_NFNETLINK_H.

2017-06-05  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: check decoding of NETLINK_XFRM message types.
	* tests/netlink_xfrm.c: New file.
	* tests/gen_tests.in (netlink_xfrm): New entry.
	* tests/pure_executables.list: Add netlink_xfrm.
	* tests/.gitignore: Likewise.

	tests: check decoding of NETLINK_SELINUX message types.
	* tests/netlink_selinux.c: New file.
	* tests/gen_tests.in (netlink_selinux): New entry.
	* tests/pure_executables.list: Add netlink_selinux.
	* tests/.gitignore: Likewise.

	tests: check decoding of NETLINK_NETFILTER message types.
	* tests/netlink_netfilter.c: New file.
	* tests/gen_tests.in (netlink_netfilter): New entry.
	* tests/pure_executables.list: Add netlink_netfilter.
	* tests/.gitignore: Likewise.

	tests: check decoding of NETLINK_AUDIT message types.
	* tests/netlink_audit.c: New file.
	* tests/gen_tests.in (netlink_audit): New entry.
	* tests/pure_executables.list: Add netlink_audit.
	* tests/.gitignore: Likewise.

	tests: check decoding of NETLINK_ROUTE message types.
	* tests/netlink_route.c: New file.
	* tests/gen_tests.in (netlink_route): New entry.
	* tests/pure_executables.list: Add netlink_route.
	* tests/.gitignore: Likewise.

	tests: check decoding of NETLINK_SOCK_DIAG message types.
	* tests/netlink_sock_diag.c: New file.
	* tests/netlink_sock_diag.test: New test.
	* tests/pure_executables.list: Add netlink_sock_diag.
	* tests/.gitignore: Likewise.
	* tests/Makefile.am (DECODER_TESTS): Add netlink_sock_diag.test.

2017-06-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use create_nl_socket in netlink_protocol.test.
	* tests/netlink_protocol.c (main): Use create_nl_socket.

	tests: change netlink_protocol.test to trace sendto syscalls only.
	* tests/gen_tests.in (netlink_protocol): Replace %network with sendto.
	* tests/netlink_protocol.c (main): Update expected output.

	tests: enhance create_nl_socket diagnostics messages.
	* tests/tests.h (create_nl_socket): Rename to create_nl_socket_ext,
	add a string argument.
	(create_nl_socket): New macro wrapper around create_nl_socket_ext.
	* tests/create_nl_socket.c (create_nl_socket): Rename
	to create_nl_socket_ext, add a string argument, include it
	in diagnostic messages.

	tests: use const and designated initializers in create_nl_socket.c.
	* tests/create_nl_socket.c: Stop including <string.h>.
	(create_nl_socket): Use const and designated initializers.

2017-06-05  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: add create_nl_socket function to libtests.
	* tests/create_nl_socket.c: New file.
	* tests/tests.h (create_nl_socket): New prototype.
	* tests/Makefile.am (libtests_a_SOURCES): Add create_nl_socket.c.

2017-06-05  Dmitry V. Levin  <ldv@altlinux.org>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: add decoding of NETLINK_NETFILTER message types.
	* xlat/nl_netfilter_msg_types.in: New file.
	* xlat/nl_netfilter_subsys_ids.in: Likewise.
	* netlink.c: Include "xlat/nl_netfilter_msg_types.h"
	and "xlat/nl_netfilter_subsys_ids.h".
	(nlmsg_types): Add NETLINK_NETFILTER.
	(decode_nlmsg_type): Handle NETLINK_NETFILTER.

	netlink: add decoding of NETLINK_XFRM message types.
	* xlat/nl_xfrm_types.in: New file.
	* netlink.c: Include "xlat/nl_xfrm_types.h".
	(nlmsg_types): Add NETLINK_XFRM.

	netlink: add decoding of NETLINK_SELINUX message types.
	* xlat/nl_selinux_types.in: New file.
	* netlink.c: Include "xlat/nl_selinux_types.h".
	(nlmsg_types): Add NETLINK_SELINUX.

	netlink: add decoding of NETLINK_ROUTE message types.
	* xlat/nl_route_types.in: New file.
	* netlink.c: Include <linux/rtnetlink.h> and "xlat/nl_route_types.h".
	(nlmsg_types): Add NETLINK_ROUTE.

	netlink: add decoding of NETLINK_AUDIT message types.
	* xlat/nl_audit_types.in: New file.
	* netlink.c: Include <linux/audit.h> and "xlat/nl_audit_types.h".
	(nlmsg_types): Add NETLINK_AUDIT.

2017-06-05  Dmitry V. Levin  <ldv@altlinux.org>
	    Fabien Siron  <fabien.siron@epita.fr>

	netlink: implement generic nlmsg_type decoding.
	Implement a pluggable mechanism of nlmsg_type decoding.
	Add decoding of NETLINK_SOCK_DIAG types.

	* linux/sock_diag.h (SOCK_DESTROY): New macro.
	* xlat/nl_sock_diag_types.in: New file.
	* netlink.c: Include xlat/nl_sock_diag_types.h.
	(get_fd_nl_family, decode_nlmsg_type): New functions.
	(print_nlmsghdr): Use them for nlmsg_type decoding.

2017-06-05  Dmitry V. Levin  <ldv@altlinux.org>

	netlink: add netlink family argument to printers and decoders.
	* netlink.c (NL_FAMILY_ERROR, NL_FAMILY_DEFAULT): New constants.
	(print_nlmsghdr): Add netlink family argument, change return type
	to int, return family.
	(decode_nlmsghdr_with_payload, decode_nlmsgerr, decode_payload): Add
	netlink family argument.  All callers updated.

2017-06-05  Fabien Siron  <fabien.siron@epita.fr>
	    Dmitry V. Levin  <ldv@altlinux.org>

	Add file descriptor argument to decode_netlink.
	* defs.h (decode_netlink): Add file descriptor argument.
	* io.c (print_iovec): Specify file descriptor to decode_netlink.
	* net.c (decode_sockbuf): Likewise.
	* netlink.c (print_nlmsghdr, decode_nlmsghdr_with_payload,
	decode_nlmsgerr, decode_payload, decode_nlmsghdr_with_payload,
	decode_netlink): Likewise.
	All callers updated.

	Introduce getfdinode to obtain inode from fd.
	* defs.h (getfdinode): New prototype.
	* utils.c (getfdinode): New function.

2017-06-05  Fabien Siron  <fabien.siron@epita.fr>
	    Dmitry V. Levin  <ldv@altlinux.org>

	Introduce get_sockaddr_by_inode.
	Add a way to get socket information without printing it.

	* defs.h (get_sockaddr_by_inode): New prototype.
	* socketutils.c (get_sockaddr_by_inode): New function.

2017-06-05  Dmitry V. Levin  <ldv@altlinux.org>

	socketutils.c: introduce get_sockaddr_by_inode_uncached.
	* socketutils.c (get_sockaddr_by_inode_uncached): New function.
	(print_sockaddr_by_inode_uncached): Use it.

2017-06-05  Fabien Siron  <fabien.siron@epita.fr>
	    Dmitry V. Levin  <ldv@altlinux.org>

	socketutils.c: use get_sockaddr_by_inode_cached.
	* socketutils.c (unix_print, inet_print, tcp_v4_print, tcp_v6_print,
	udp_v4_print, udp_v6_print, netlink_print): Remove.
	(unix_get, inet_get, tcp_v4_get, tcp_v6_get, udp_v4_get,
	udp_v6_get, netlink_get): New functions.
	(protocols): Update.

2017-06-05  Dmitry V. Levin  <ldv@altlinux.org>

	socketutils.c: move inet_print closer to its first use.
	* socketutils.c (inet_print): Move right before tcp_v4_print.

2017-06-05  Fabien Siron  <fabien.siron@epita.fr>
	    Dmitry V. Levin  <ldv@altlinux.org>

	socketutils.c: introduce cache_inode_details.
	cache_inode_details gives a way to obtain cache information without
	printing it.

	* socketutils.c (cache_and_print_inode_details): Rename
	to cache_inode_details.  Do not print cached information.
	(inet_parse_response, unix_parse_response, netlink_parse_response):
	Use cache_inode_details instead of cache_and_print_inode_details.
	(inet_print, unix_print, netlink_print): Call
	print_sockaddr_by_inode_cached.

2017-06-05  Victor Krapivensky  <krapivenskiy.va@phystech.edu>

	strace.c: move termination code to a separate function.
	This will be needed for the pull-style API.

	* strace.c (terminate): New function.
	(main): Use it.

2017-06-04  Dmitry V. Levin  <ldv@altlinux.org>

	tests: avoid hitting SO_SNDBUF limit in sendfile/sendfile64 tests.
	Do not assume that an executable is small enough and SO_SNDBUF is large
	enough so that the executable could be sendfile'ed into a socket pair.

	* tests/sendfile.c (main): Create a regular file of the right size
	to avoid hitting SO_SNDBUF limit.
	* tests/sendfile64.c: Likewise.

	Reported-by: Andreas Schwab <schwab@linux-m68k.org>

2017-06-04  Dmitry V. Levin  <ldv@altlinux.org>

	Move netlink_protocols definition from net.c to netlink.c.
	The side effect of #include "xlat/netlink_protocols.h" is
	NETLINK_* constants properly defined in that header file.
	While net.c does not use these constants itself, netlink.c
	is going to need them soon.

	* net.c: Move inclusion of "xlat/netlink_protocols.h" ...
	* netlink.c: ... here.

2017-06-04  Dmitry V. Levin  <ldv@altlinux.org>

	travis: switch from gcc-6 to gcc-7.
	* .travis.yml (matrix): Change gcc-6 to gcc-7.

	tests: extend checking of NLMSG_DONE decoding.
	* tests/netlink_protocol.c (test_nlmsg_done):  Use designated
	initializers.  Check decoding of messages with non-integer payload.

2017-06-04  JingPiao Chen  <chenjingpiao@gmail.com>

	netlink: decode NLMSG_DONE messages.
	* netlink.c (decode_payload): Decode NLMSG_DONE messages.
	* tests/netlink_protocol.c (test_nlmsg_done): New function
	for checking decoding of NLMSG_DONE messages.
	(main): Use it.

2017-06-04  Dmitry V. Levin  <ldv@altlinux.org>

	socketutils.c: introduce get_sockaddr_by_inode_cached.
	* socketutils.c (get_sockaddr_by_inode_cached): New function.
	(print_sockaddr_by_inode_cached): Use it.

2017-06-03  Dmitry V. Levin  <ldv@altlinux.org>

	Unexport print_sockaddr_by_inode_cached.
	Change print_sockaddr_by_inode to be the only function exposed,
	hide print_sockaddr_by_inode_cached as a part of implementation.

	* defs.h (print_sockaddr_by_inode_cached): Remove prototype.
	(print_sockaddr_by_inode): Add struct tcb * and descriptor arguments.
	* socketutils.c (print_sockaddr_by_inode_cached): Make static.
	(print_sockaddr_by_inode): Rename to print_sockaddr_by_inode_uncached,
	make static.
	(print_sockaddr_by_inode): New function.
	* util.c (printfd): Update to use new print_sockaddr_by_inode.

2017-06-03  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce str_strip_prefix_len function and STR_STRIP_PREFIX macro.
	Address proliferation of string prefix check implementations.

	* defs.h (str_strip_prefix_len): New inline function.
	(STR_STRIP_PREFIX): New macro.
	* qualify.c (strip_prefix): Remove.
	(parse_inject_token): Use STR_STRIP_PREFIX instead of strip_prefix.
	(qualify): Use str_strip_prefix_len.
	* socketutils.c (netlink_parse_response): Likewise.
	* util.c (printfd): Likewise.

2017-06-02  Dmitry V. Levin  <ldv@altlinux.org>

	netlink: move NLMSG_ERROR payload length check to nlmsgerr decoder.
	Move decoder specific check to the decoder.

	* netlink.c (decode_payload): Move NLMSG_ERROR payload length check ...
	(decode_nlmsgerr): ... here.

2017-06-02  Dmitry V. Levin  <ldv@altlinux.org>

	strace.c: handle PTRACE_EVENT_EXEC like other events.
	There is nothing unusual about PTRACE_EVENT_EXEC that would require
	a special treatment.

	* strace.c (next_event): Move PTRACE_EVENT_EXEC handling to the main
	switch statement.

2017-06-02  Dmitry V. Levin  <ldv@altlinux.org>

	strace.c: remove dead code.
	As strace does not use WCONTINUED flag, there is no need to handle
	WIFCONTINUED status.

	* strace.c (print_debug_info) [WIFCONTINUED]: Remove.
	(next_event): Remove redundant !WIFSTOPPED check.

2017-06-02  Victor Krapivensky  <krapivenskiy.va@phystech.edu>

	strace.c: refactor trace into two functions.
	This change decouples waiting for next event from reacting to it.  This
	makes the control flow easier to understand, and serves as a preparation
	for implementing a pull-style API for LuaJIT.

	* strace.c (enum trace_event): New enum.
	(trace): Split into ...
	(next_event, dispatch_event): ... new functions.
	(main): Use them.

2017-05-30  Dmitry V. Levin  <ldv@altlinux.org>

	scno.am: include config.h before syscallent.h.
	This fixes generation of syscallent.i and subsequent scno.h files
	on mips where syscallent.h checks macros defined in config.h.

	* scno.am (syscallent.i): Add $(top_builddir)/config.h
	to prerequisites, include it.
	* NEWS: Mention this fix.

	Reported-by: David Robins <dbrobins@i4031.net>

2017-05-28  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of sigaction syscall.
	* tests/sigaction.c: New file.
	* tests/gen_tests.in (sigaction): New entry.
	* tests/pure_executables.list: Add sigaction.
	* tests/.gitignore: Likewise.

	tests: rename sigaction.test to rt_sigaction.test.
	* tests/sigaction.awk: Rename to rt_sigaction.awk.
	* tests/sigaction.c: Rename to tests/rt_sigaction.c.
	* tests/sigaction.test: Rename to tests/rt_sigaction.test.
	* tests/.gitignore: Replace sigaction with rt_sigaction.
	* tests/pure_executables.list: Likewise.
	* tests/Makefile.am (DECODER_TESTS): Replace sigaction.test
	with rt_sigaction.test.
	(EXTRA_DIST): Replace sigaction.awk with rt_sigaction.awk.

2017-05-28  Dmitry V. Levin  <ldv@altlinux.org>

	sparc: enhance decoding of signal number argument of sigaction syscall.
	On sparc, unlike all other architectures, old sigaction syscall takes
	a negated signal number.

	* signal.c (SYS_FUNC(sigaction)) [SPARC || SPARC64]: Enhance printing
	of negative signal number argument.

2017-05-28  Dmitry V. Levin  <ldv@altlinux.org>

	signal: enhance printing of old_sigaction.mask.
	* signal.c (decode_old_sigaction): Print old_sigaction.mask
	using tprint_old_sigmask_val.

	signal: limit scope of struct old_sigaction32 definition.
	* signal.c (struct old_sigaction32): Define only if [!current_wordsize].

2017-05-28  Dmitry V. Levin  <ldv@altlinux.org>

	signal: fix decoding of struct old_sigaction on some architectures.
	On alpha, struct old_sigaction.sa_flags has a 32-bit type.

	On mips, only first word of old_sigaction.sa_mask is read.

	On all architectures except alpha and mips that have old sigaction
	syscall, struct old_sigaction has sa_restorer field that has to be
	decoded.

	* signal.c (struct old_sigaction) [ALPHA]: Change sa_flags type
	to unsigned int, add ATTRIBUTE_PACKED.
	[MIPS]: Dhrink sa_mask array to 1 element.
	[!ALPHA && !MIPS]: Define sa_restorer field unconditionally.
	(struct old_sigaction32): Likewise.
	(decode_old_sigaction) [!current_wordsize]: Initialize sa_restorer field
	from old_sigaction32.sa_restorer unconditionally.
	[!ALPHA && !MIPS]: Print old_sigaction.sa_restorer if SA_RESTORER flag
	is set.
	* NEWS: Mention this change.

2017-05-28  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: rename SA_STACK to SA_ONSTACK.
	SA_ONSTACK is the standard name while its alias SA_STACK is not even
	defined on many platforms.

	* xlat/sigact_flags.in (SA_STACK): Rename to SA_ONSTACK.

2017-05-28  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of sigpending syscall.
	* tests/sigpending.c: New file.
	* tests/gen_tests.in (sigpending): New entry.
	* tests/pure_executables.list: Add sigpending.
	* tests/.gitignore: Likewise.

	tests: check decoding of sigprocmask syscall.
	* tests/sigprocmask.c: New file.
	* tests/gen_tests.in (sigprocmask): New entry.
	* tests/pure_executables.list: Add sigprocmask.
	* tests/.gitignore: Likewise.

2017-05-28  Dmitry V. Levin  <ldv@altlinux.org>

	alpha: rename sys_sigprocmask to sys_osf_sigprocmask.
	Parsers of sigprocmask and osf_sigprocmask syscalls are different
	anyway, so rename the function to match the syscall name.

	* signal.c [ALPHA] (SYS_FUNC(sigprocmask)): Rename
	to SYS_FUNC(osf_sigprocmask).
	* linux/alpha/syscallent.h: Update sys_func.

2017-05-27  Dmitry V. Levin  <ldv@altlinux.org>

	Enable coverage when strace is self terminated by signal.
	The data collected by -fprofile-arcs during program run is saved
	on program exit.  When program is terminated by signal, the data
	is not saved.  However, libgcov provides an interface to dump
	the data at runtime.

	* m4/ax_code_coverage.m4 (AX_CODE_COVERAGE): Add -DENABLE_COVERAGE_GCOV
	to CODE_COVERAGE_CPPFLAGS.
	* strace.c [ENABLE_COVERAGE_GCOV] (__gcov_flush): New prototype.
	(main) [ENABLE_COVERAGE_GCOV]: Call __gcov_flush() before raise()
	and sigprocmask() calls that might cause program termination.

2017-05-27  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check termination signal forwarding.
	* tests/run_expect_termsig.c: New file.
	* tests/unblock_reset_raise.c: Likewise.
	* tests/termsig.test: New test.
	* tests/.gitignore: Add run_expect_termsig and unblock_reset_raise.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(MISC_TESTS): Add termsig.test.

2017-05-27  Dmitry V. Levin  <ldv@altlinux.org>

	Fix termination signal forwarding.
	When traced command is terminated by a blocked signal, unblock
	that signal to ensure strace termination with the same signal.

	* strace.c (main): Unblock the signal raised for strace termination.
	* NEWS: Mention this change.

2017-05-27  Dmitry V. Levin  <ldv@altlinux.org>

	Do not reset SIGCHLD handler in tracees to SIG_DFL.
	While strace resets SIGCHLD handler to the default action so that
	waitpid definitely works without losing track of children, tracees
	should not inherit this change.

	* strace.c (struct exec_params): Add child_sa field.
	(init): When setting SIGCHLD handler to SIG_DFL, save the old handler.
	(exec_or_die): Restore SIGCHLD handler if it was different from SIG_DFL
	at startup.
	* NEWS: Mention this change.

2017-05-27  Dmitry V. Levin  <ldv@altlinux.org>

	Refactor setting of signal handlers to reduce redundancy.
	* strace.c (set_sigaction): New function.
	(init): Use it instead of sigaction with sigaddset.

	tests: check how signals are unblocked in interactive mode.
	* tests/block_reset_raise_run.c: New file.
	* tests/interactive_block.test: New test.
	* tests/.gitignore: Add block_reset_raise_run.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(MISC_TESTS): Add interactive_block.test.

2017-05-27  Dmitry V. Levin  <ldv@altlinux.org>

	Fix unblocking of signals in interactive mode.
	In interactive mode (-I2), those signals that were blocked at startup
	will remain blocked for the whole period of strace execution.

	* strace.c (empty_set): Rename to start_set.  All users changed.
	(init): Initialize start_set and blocked_set to the set of currently
	blocked signals.
	(startup_attach, trace): Use SIG_SETMASK instead of SIG_BLOCK.
	* NEWS: Mention this change.

2017-05-26  Dmitry V. Levin  <ldv@altlinux.org>

	Cleanup interactive check.
	* strace.c (init): Check for INTR_WHILE_WAIT mode the same way
	as in other places.

	tests: check decoding of signal syscall.
	* tests/signal.c: New file.
	* tests/gen_tests.in (signal): New entry.
	* tests/pure_executables.list: Add signal.
	* tests/.gitignore: Likewise.

2017-05-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Unify capitalisation of (c) in copyright notices.

2017-05-25  Dmitry V. Levin  <ldv@altlinux.org>

	Post-release administrivia.
	* NEWS: Add a header line for the next release.
	* debian/changelog.in: Add a changelog entry for 4.17-1.
	* strace.spec.in: Likewise.

2017-05-24  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for 4.17 release.
	* NEWS: Update for 4.17 release.

	powerpc64, sparc, sparc64: wire up statx syscall.
	* linux/powerpc64/syscallent.h [383]: Add statx entry.
	* linux/sparc/syscallent.h [360]: Likewise.
	* linux/sparc64/syscallent.h [360]: Likewise.

2017-05-23  Dmitry V. Levin  <ldv@altlinux.org>

	Fix compat personality support for sgetmask syscall.
	* signal.c (SYS_FUNC(sgetmask)): Replace sprintsigmask_val
	with sprint_old_sigmask_val.
	* tests/sxetmask.c (main): Check decoding of signal mask containing
	RT signals.

2017-05-22  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of sgetmask and ssetmask syscalls.
	Old ssetmask syscall takes an argument and returns a value of type int.
	Old sgetmask syscall may return an error.

	* signal.c (SYS_FUNC(ssetmask)): Explicitly convert the argument
	and return value to unsigned int, print it using sprint_old_sigmask_val.
	(SYS_FUNC(sgetmask)): Do not print the mask in case of syserror.
	* tests/sxetmask.c: New file.
	* tests/gen_tests.in (sxetmask): New entry.
	* tests/pure_executables.list: Add sxetmask.
	* tests/.gitignore: Likewise.
	* NEWS: Mention this fix.

2017-05-22  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add copyright headers.

2017-05-22  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Elvira Khabirova  <lineprinter0@gmail.com>

	Add scripts for automating copyright notices update.
	* maint/update_copyright_years.awk: New file.
	* maint/update_copyright_years.sh: Likewise.

2017-05-22  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Fix typos in copyright notices.

	unwind.c: remove non-ASCII character from comment.

2017-05-21  Dmitry V. Levin  <ldv@altlinux.org>

	Rename sys_sig[gs]etmask to sys_s[gs]etmask to match syscall names.
	* signal.c (SYS_FUNC(sigsetmask)): Rename to SYS_FUNC(ssetmask).
	(SYS_FUNC(siggetmask)): Rename to SYS_FUNC(sgetmask).
	* linux/arm/syscallent.h (sgetmask, ssetmask): Update sys_func.
	* linux/bfin/syscallent.h: Likewise.
	* linux/crisv10/syscallent.h: Likewise.
	* linux/hppa/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.

	tests: enhance sigsuspend.test.
	* tests/sigsuspend.c (sigtxt): New variable.
	(main): Change signal masks to contain all signals except USR1 and USR2.

2017-05-20  Dmitry V. Levin  <ldv@altlinux.org>

	Fix compat personality support for old sigsuspend syscall.
	* signal.c (sprint_old_sigmask_val): New function.
	(tprint_old_sigmask_val): New macro.
	(SYS_FUNC(sigsuspend)): Use it.

2017-05-16  Dmitry V. Levin  <ldv@altlinux.org>

	Move errnoent.sh, signalent.sh, and syscallent.sh to maint subdirectory.
	Also do not include them into release tarballs.  These files are
	intended for developers who are expected to use a git repository.

	* errnoent.sh: Move to maint subdirectory.
	* signalent.sh: Likewise.
	* syscallent.sh: Likewise.
	* HACKING-scripts: Update.
	* Makefile.am (EXTRA_DIST): Remove errnoent.sh, signalent.sh,
	and syscallent.sh.

2017-05-16  Dmitry V. Levin  <ldv@altlinux.org>

	Do not include maint subdirectory into release tarballs.
	These files are intended for developers who are expected to use
	a git repository.

	* Makefile.am (EXTRA_DIST): Remove maint/ioctls_gen.sh,
	maint/ioctls_hex.sh, maint/ioctls_sym.sh, and maint/print_ioctlent.c.

2017-05-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	linux/ia64/syscallent.h: remove tabulation, add spaces in file comment.

	linux/mtd-abi.h: remove non-ASCII character from file comment.

2017-05-01  Dmitry V. Levin  <ldv@altlinux.org>

	alpha, cris, mips, ppc, sh, sparc: fix decoding of sigsuspend syscall.
	On some architectures old sigsuspend syscall takes the signal mask from
	the 3rd argument, on some from the 1st.  And, if it wasn't peculiar
	enough, the signal mask is passed by value on all architectures except
	mips where it's passed by reference.

	* signal.c (SYS_FUNC(sigsuspend)): Take the signal mask from the last
	argument.
	* linux/alpha/syscallent.h (sigsuspend): Set nargs to 1.
	* linux/crisv10/syscallent.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* tests/sigsuspend.c: New file.
	* tests/gen_tests.in (sigsuspend): New entry.
	* tests/pure_executables.list: Add sigsuspend.
	* tests/.gitignore: Likewise.
	* NEWS: Mention this fix.

2017-05-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests: raise default timeout for individual tests.
	Recently added tests based on pure_executables.list are quite slow
	by their nature, the one minute default timeout is no longer enough
	for some of not so fast architectures.

	* tests/init.sh (TIMEOUT_DURATION): Raise from 60 to 120.

2017-05-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update NEWS.

2017-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	Update TCP_* constants.
	* xlat/socktcpoptions.in: Add TCP_FASTOPEN_CONNECT introduced
	by linux kernel commit v4.11-rc1~124^2~321^2.

2017-04-28  Dmitry V. Levin  <ldv@altlinux.org>

	Update AF_* constants.
	* xlat/addrfams.in: Add AF_SMC introduced by linux kernel
	commit v4.11-rc1~94^2~43^2~13.

2017-04-27  Dmitry V. Levin  <ldv@altlinux.org>

	tests: enhance madvise decoder check.
	* tests/mmap.c (main): Remove madvise check.
	* tests/madvise.c: New file.
	* tests/gen_tests.in (madvise): New entry.
	* tests/.gitignore: Add madvise.
	* tests/pure_executables.list: Likewise.

2017-04-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add -etrace=?... test.
	Check for some architecture-specific syscalls which are not present
	on most architectures.

	* gen_tests.in: Add trace_question test.
	* tests/trace_question.in: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.

2017-04-25  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add more information to generated header comments.
	* tests/gen_tests.sh: Update header comment with the source string
	used for test generation.

	tests: move generated common header comment into a variable.
	* tests/gen_tests.sh: Move generated file header comment
	into a variable, use it in all cases.

2017-04-25  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use TAIL_ALLOC_OBJECT_CONST_PTR in v4l2 test.
	* tests/ioctl_v4l2.c (main): Use TAIL_ALLOC_OBJECT_CONST_PTR.

2017-04-25  Edgar Kaziahmedov  <edos@linux.com>

	tests: Check decoding of VIDIOC_G/S_TUNER's arg.
	* tests/ioctl_v4l2.c (main): Add checks for VIDIOC_G/S_TUNER's arg.

	v4l2: Add decoding for VIDIOC_G/S_TUNER's arg.
	* v4l2.c: Include "xlat/v4l2_tuner_types.h", "xlat/v4l2_tuner_capabilities.h",
	"xlat/v4l2_tuner_rxsubchanses.h", and "xlat/v4l2_tuner_audmodes.h".
	(print_v4l2_tuner): New function. Add decoding for VIDIOC_G/S_TUNER's arg.
	(v4l2_ioctl): Add new cases for decoding VIDIOC_G/S_TUNER's arg.
	* xlat/v4l2_tuner_types.in: Add V4L2_TUNER_RADIO and
	V4L2_TUNER_ANALOG_TV introduced by linux kernel commit
	2.5.46~39^2~23^2~4.
	Add V4L2_TUNER_DIGITAL_TV introduced by linux kernel
	commit v2.6.11-rc4~55^2~20.
	Add V4L2_TUNER_ADC and V4L2_TUNER_RF introduced by linux kernel commit
	v3.15-rc1~85^2~215.
	Add V4L2_TUNER_SDR introduced by linux kernel commit v4.4-rc1~118^2~17
	(as the replacement of V4L2_TUNER_ADC).
	* xlat/v4l2_tuner_capabilities.in: Add V4L2_TUNER_CAP_LOW,
	V4L2_TUNER_CAP_NORM, V4L2_TUNER_CAP_STEREO, V4L2_TUNER_CAP_LANG2,
	V4L2_TUNER_CAP_SAP, and V4L2_TUNER_CAP_LANG1 introduced by linux kernel
	commit 2.5.46~39^2~23^2~4.
	Add V4L2_TUNER_CAP_HWSEEK_BOUNDED and V4L2_TUNER_CAP_HWSEEK_WRAP
	introduced by linux kernel commit v3.6-rc1~28^2~306.
	Add V4L2_TUNER_CAP_RDS introduced by linux commit v2.6.32-rc1~679^2~189.
	Add V4L2_TUNER_CAP_RDS_BLOCK_IO and V4L2_TUNER_CAP_RDS_CONTROLS
	introduced by linux kernel commit v2.6.37-rc1~64^2~110.
	Add V4L2_TUNER_CAP_FREQ_BANDS introduced by linux kernel commit
	v3.6-rc1~28^2~46.
	Add V4L2_TUNER_CAP_HWSEEK_PROG_LIM introduced by linux kernel commit
	v3.6-rc1~28^2~40.
	Add V4L2_TUNER_CAP_1HZ introduced by linux kernel commit
	v3.15-rc1~85^2~214.
	* xlat/v4l2_tuner_audmodes.in: Add V4L2_TUNER_MODE_MONO,
	V4L2_TUNER_MODE_STEREO, V4L2_TUNER_MODE_LANG2, V4L2_TUNER_MODE_SAP, and
	V4L2_TUNER_MODE_LANG1 introduced by linux kernel commit
	2.5.46~39^2~23^2~4.
	Add V4L2_TUNER_MODE_LANG1_LANG2 introduced by linux kernel commit
	v2.6.17-rc1~739^2~9.
	* xlat/v4l2_tuner_rxsubchanses.in: Add V4L2_TUNER_SUB_MONO,
	V4L2_TUNER_SUB_STEREO, V4L2_TUNER_SUB_LANG2, V4L2_TUNER_SUB_SAP, and
	V4L2_TUNER_SUB_LANG1 introduced by linux kernel commit
	2.5.46~39^2~23^2~4.
	Add V4L2_TUNER_SUB_RDS introduced by linux kernel commit
	v2.6.32-rc1~679^2~189.

2017-04-24  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of invalid tv_sec and tv_usec values.
	* tests/futimesat.c (main): Check decoding of invalid tv_sec and tv_usec
	values.
	* tests/xetitimer.c (main): Likewise.
	* tests/xettimeofday.c (main): Likewise.
	* tests/xselect.c (main): Likewise.
	* tests/xutimes.c (main): Likewise.

	tests: check decoding of invalid tv_sec and tv_nsec values.
	* tests/aio.c (main): Check decoding of invalid tv_sec and tv_nsec
	values.
	* tests/clock_nanosleep.c (main): Likewise.
	* tests/clock_xettime.c (main): Likewise.
	* tests/futex.c (main): Likewise.
	* tests/nanosleep.c (main): Likewise.
	* tests/ppoll.c (main): Likewise.
	* tests/pselect6.c (main): Likewise.
	* tests/recvmmsg-timeout.c (main): Likewise.
	* tests/rt_sigtimedwait.c (main): Likewise.
	* tests/semop.c (main): Likewise.
	* tests/timer_xettime.c (main): Likewise.
	* tests/timerfd_xettime.c (main): Likewise.
	* tests/utimensat.c (main): Likewise.

2017-04-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Print time in ISO 8601 format in time syscall decoder.
	* print_time.c (SYS_FUNC(time)): Print timestamp stringification
	(via sprinttime) for the value stored in the argument and return value
	(return RVAL_STR in the latter case).
	* tests/time.c (main): Update expected output.

2017-04-24  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	Print string representation of timestamps in parsers of *utime* syscalls
	* print_timespec.c (print_timespec_t_utime): Use sprinttime_nsec
	to format a string representation of time, use tprints_comment
	to print it as a comment.
	* print_timeval.c (print_timeval_t_utime): New function.
	(print_timeval_utimes): Use it instead of print_timeval_t.
	[ALPHA] (print_timeval32_t_utime): New function.
	[ALPHA] (print_timeval32_utimes): Use it instead of print_timeval32_t.
	* tests/futimesat.c (print_tv): Update expected output.
	* tests/utimensat.c (print_ts): Likewise.
	* tests/xutimes.c (print_tv): Likewise.

2017-04-24  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add support for printing timestamp with microsecond precision.
	It will be needed later.

	* tests/tests.h (print_time_t_usec): New prototype.
	* tests/print_time.c (print_time_t_usec): New function, a thin wrapper
	around print_time_t_ex.

2017-04-24  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	Print microseconds/nanoseconds as non-negative.
	Negative micro/nanoseconds values are treated as invalid by kernel
	anyway, and in one case (timespec_valid in include/linux/time.h)
	it is even checked by conversion to unsigned long.

	* print_timespec.c (timespec_fmt): Change tv_sec format to %lld and
	tv_nsec format to %llu.
	(print_timespec_t): Cast tv_sec to long long and process tv_nsec with
	zero_extend_signed_to_ull.
	(sprint_timespec): Likewise.
	* print_timeval.c (timeval_fmt): Change tv_sec format to %lld and
	tv_usec format to %llu.
	(print_timeval_t): Cast tv_sec to long long and process tv_nsec with
	zero_extend_signed_to_ull.
	(sprint_timeval, print_timeval32_t, sprint_timeval32): Likewise.
	* defs.h (TIMESPEC_TEXT_BUFSIZE): Update.
	* tests/adjtimex.c (main): Change tv_sec printing format to %lld, cast
	it to long long; change tv_usec printing format to %llu, process it with
	zero_extend_signed_to_ull.
	* tests/clock_nanosleep.c (main): Change tv_sec printing format to %lld,
	cast it to long long; change tv_nsec printing format to %llu, process it
	with zero_extend_signed_to_ull.
	* tests/clock_xettime.c (main): Likewise.
	* tests/futex.c (main): Likewise.
	* tests/futimesat.c (print_tv): Likewise.
	* tests/getrusage.c (invoke_print): Likewise.
	* tests/mq_sendrecv.c (do_send, do_recv, main): Likewise.
	* tests/nanosleep.c (main): Likewise.
	* tests/pselect6.c (main): Likewise.
	* tests/restart_syscall.c (main): Likewise.
	* tests/rt_sigtimedwait.c (iterate, main): Likewise.
	* tests/sched_rr_get_interval.c (main): Likewise.
	* tests/semop.c (main): Likewise.
	* tests/timer_xettime.c (main): Likewise.
	* tests/timerfd_xettime.c (main): Likewise.
	* tests/waitid.c (main): Likewise.
	* tests/xetitimer.c (main): Likewise.
	* tests/xettimeofday.c (main): Likewise.
	* tests/xselect.c (main): Likewise.
	* tests/xutimes.c (print_tv): Likewise.
	* tests/wait4.c (sprint_rusage): Likewise.
	* tests/waitid.c (sprint_rusage): Likewise.
	* tests/utimensat.c (print_ts): Likewise.
	(main): Add check for higher bits of tv_sec/tv_nsec.

2017-04-24  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	Always print raw values of time data fields.
	Refactor sprinttime: implement sprinttime_nsec and sprinttime_usec
	that handle nanoseconds and microseconds, respectively.
	Always print raw values of time data fields, format string
	representations of time as comments.

	* defs.h (sprinttime): Change argument type from time_t to long long.
	(sprinttime_nsec, sprinttime_usec): New prototypes.
	* util.c (sprinttime_ex, sprinttime_nsec, sprinttime_usec): New
	functions.
	(sprinttime): Turn into a thin wrapper around sprinttime_ex.
	* stat.h (struct strace_stat): Add has_nsec field.
	* fetch_struct_stat.c (HAVE_NSEC): New macro.
	(fetch_struct_stat): Initialize has_nsec field with HAVE_NSEC.
	* fetch_struct_stat64.c (HAVE_NSEC): New macro.
	(fetch_struct_stat64): Initialize has_nsec field with HAVE_NSEC.
	* print_struct_stat.c (print_struct_stat) <PRINT_ST_TIME>:
	Print raw values of time fields, use sprinttime_nsec to format a string
	representation of time, use tprints_comment to print it as a comment.
	* statx.c (SYS_FUNC(statx)) <PRINT_FIELD_TIME>: Likewise.
	* utime.c (SYS_FUNC(utime)): Print raw values of struct utimbuf.actime
	and struct utimbuf.modtime fields, use sprinttime to format a string
	representation of time, use tprints_comment to print it as a comment.
	* tests/tests.h (print_time_t_nsec): Add int argument.
	* tests/print_time.c (print_time_t_ex): New function.
	(print_time_t_nsec): Add int argument, turn into a thin wrapper around
	print_time_t_ex.
	* tests/utime.c (main): Update expected output.
	* tests/xstatx.c [!IS_STATX] (HAVE_NSEC): New macro.
	[!IS_STATX] (PRINT_ST_TIME), [IS_STATX] (PRINT_FIELD_TIME): Update
	expected output.
	* NEWS: Mention this timestamps representation improvement.

2017-04-24  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce tprintf_comment and tprints_comment functions.
	* defs.h (tprintf_comment, tprints_comment): New prototypes.
	* strace.c (tvprintf): New function.
	(tprintf): Use it.
	(tprintf_comment, tprints_comment): New functions.
	* aio.c (tprint_lio_opcode): Use tprints_comment.
	* dm.c (dm_decode_dm_target_spec, dm_decode_dm_target_deps,
	dm_decode_dm_name_list, dm_decode_dm_target_versions,
	dm_decode_dm_target_msg, dm_decode_string, dm_known_ioctl): Likewise.
	* futex.c (SYS_FUNC(futex)): Likewise.
	* perf.c (print_perf_event_attr): Likewise.
	* seccomp.c (decode_bpf_code): Likewise.
	* util.c (printxvals, printxval_searchn, printflags64): Likewise.
	* btrfs.c (print_u64, btrfs_print_key_type, btrfs_print_objectid,
	print_key_value_internal): Likewise.
	(btrfs_ioctl): Use tprints_comment and tprintf_comment.
	* dirent.c (SYS_FUNC(getdents)): Likewise.
	* dirent64.c (SYS_FUNC(getdents64)): Likewise.
	* execve.c (printargc): Use tprintf_comment.
	* tests/btrfs.c (btrfs_test_get_dev_stats_ioctl,
	btrfs_test_features_ioctls): Update expected output.

	Make output of execve/execveat syscall parsers more structured.
	* execve.c (printargc): Always print the address, format the number
	of variables as a comment.
	* tests/execve.c: Update expected output.
	* tests/execveat.c: Likewise.
	* tests/qual_syscall.test: Likewise.
	* tests/strace-r.expected: Likewise.
	* tests/strace-t.test: Likewise.
	* tests/strace-tt.test: Likewise.
	* tests/strace-ttt.test: Likewise.
	* tests/threads-execve.c: Likewise.
	* tests/threads-execve.test: Likewise.

	dm: fix diagnostics about misplaced parts of struct dm_ioctl.
	* dm.c (dm_decode_dm_target_spec, dm_decode_dm_target_deps,
	dm_decode_dm_name_list, dm_decode_dm_target_versions,
	dm_decode_dm_target_msg, dm_decode_string, dm_known_ioctl): Fix
	diagnostics about various misplaced parts of struct dm_ioctl.
	* tests/ioctl_dm.c: Update expected output.

	print_mq_attr: fix typo.
	* print_mq_attr.c (printmqattr): Fix the last argument of printflags64.

2017-04-23  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add faulty pointer check to time test.
	* tests/time.c (main): Add check for an inaccessible pointer.

2017-04-22  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix print_time_t_nsec usage in xstatx.c.
	* tests/xstatx.c (print_stat): Pass tv_nsec field through
	zero_extend_signed_to_ull before feeding it to print_time_t_nsec.

2017-04-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix netlink_protocol on sparc.
	* tests/netlink_protocol.c (test_nlmsgerr): Do not access fields of an
	unaligned structure, this makes architectures like sparc very unhappy.

2017-04-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util: return pointer to string literal directly in sprinttime.
	There is no sense to copy it to static buffer first.

	* util.c (sprinttime): Just return "0", do not copy it to internal
	buffer first.

2017-04-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: remove stat.sample creation from gen_tests.in.
	stat.sample is created by appropriate executables and never removed.

	* tests/gen_tests.in (trace_fstat, trace_lstat, trace_stat,
	trace_stat_like): Remove stat.sample creation.

2017-04-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: tabulate fstat.test.
	* tests/gen_tests.in (fstat): New entry.
	(fstat64, oldfstat): Update.
	* tests/fstat.test: Remove.
	* tests/Makefile.am (DECODER_TESTS): Remove fstat.test.

2017-04-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Implement -e trace=%stat option.
	linux/*/syscallent*.h part is updated automatically by:

	    sed -i '/statx/! s/TF|TSTA,/TF|TST|TSTA,/' linux/*/syscallent*.h

	* sysent.h (TRACE_STAT): New macro.
	* syscall.c: Alias LST to TRACE_STAT around syscallent.h inclusion.
	* qualify.c (lookup_class): Add TRACE_STAT for "%stat".
	* strace.1 (.SS Filtering): Add information about %stat syscall class.
	* NEWS: Mention this change.
	* linux/aarch64/syscallent.h (stat): Add TST flag.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/arm/syscallent.h (oldstat, stat, stat64): Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/crisv10/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/avr32/syscallent.h (stat, stat64): Likewise.
	* linux/hppa/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.
	* linux/powerpc64/syscallent.h (oldstat, stat): Likewise.
	* linux/alpha/syscallent.h (osf_old_stat, osf_stat, stat, stat64): Likewise.
	* linux/mips/syscallent-compat.h (bsd43_oldstat, bsd43_stat, posix_stat,
	svr4_stat, svr4_xstat, sysv_stat, sysv_xstat): Likewise.
	* tests/gen_tests.in (trace_stat): New entry.
	* tests/trace_stat.in: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	* tests/ksysent.c (TST): New macro, defined to 0.
	* tests/nsyscalls.c: Likewise.

2017-04-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Implement -e trace=%lstat option.
	linux/*/syscallent*.h part is updated automatically by:

	    sed -i '/TSTA,.*lx\?stat/ s/TSTA,/TLST|&/' linux/*/syscallent*.h

	* sysent.h (TRACE_LSTAT): New macro.
	* syscall.c: Alias TLST to TRACE_LSTAT around syscallent.h inclusion.
	* qualify.c (lookup_class): Add TRACE_LSTAT for "%lstat".
	* strace.1 (.SS Filtering): Add information about %lstat syscall class.
	* NEWS: Mention this change.
	* linux/aarch64/syscallent.h (lstat): Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/arm/syscallent.h (lstat, lstat64, oldlstat): Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/crisv10/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/avr32/syscallent.h (lstat, lstat64): Likewise.
	* linux/hppa/syscallent.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.
	* linux/alpha/syscallent.h (lstat, lstat64, osf_lstat, osf_old_lstat): Likewise.
	* linux/mips/syscallent-compat.h (bsd43_lstat, posix_lstat, svr4_lstat,
	sysv_lstat): Likewise.
	* tests/gen_tests.in (trace_lstat): New entry.
	* tests/trace_lstat.in: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	* tests/ksysent.c (TLST): New macro, defined to 0.
	* tests/nsyscalls.c: Likewise.

2017-04-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Implement -e trace=%fstat option.
	linux/*/syscallent*.h part is updated automatically by:

	    sed -i -e '/TSTA.*fx\?stat/ s/TSTA,/TFST|&/' \
	           -e 's/\(TD|TF|TFST|TSTA,\)[[:space:]]/\1/' linux/*/syscallent*.h

	* sysent.h (TRACE_FSTAT): New macro.
	* syscall.c: Alias TFST to TRACE_FSTAT around syscallent.h inclusion.
	* qualify.c (lookup_class): Add TRACE_FSTAT for "%fstat".
	* strace.1 (.SS Filtering): Add information about %fstat syscall class.
	* NEWS: Mention this change.
	* linux/32/syscallent.h (fstat64, fstatat64): Add TFST flag.
	* linux/64/syscallent.h (fstat, newfstatat): Likewise.
	* linux/aarch64/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/arm/syscallent.h (fstat, fstat64, fstatat64, oldfstat): Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/crisv10/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/avr32/syscallent.h (fstat, fstat64, fstatat64): Likewise.
	* linux/hppa/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.
	* linux/alpha/syscallent.h (fstat, fstat64, fstatat64, osf_fstat,
	osf_old_fstat): Likewise.
	* linux/powerpc64/syscallent.h (fstat, newfstatat, oldfstat): Likewise.
	* linux/mips/syscallent-compat.h (bsd43_fstat, bsd43_oldfstat, posix_fstat,
	svr4_fstat, sysv_fstat): Likewise.
	* tests/gen_tests.in (trace_fstat): New entry.
	* tests/trace_fstat.in: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	* tests/ksysent.c (TFST): New macro, defined to 0.
	* tests/nsyscalls.c: Likewise.

2017-04-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Implement -e trace=%%stat option.
	linux/*/syscallent*.h part is updated automatically by:

	    sed -i '/TSFA\|stat[iu]s/! s/,[[:space:]]\?\([[:space:]]*SEN(.*stat\)/|TSTA,\1/' \
	        linux/*/syscallent*.h

	* sysent.h (TRACE_STAT_LIKE): New macro.
	* syscall.c: Alias TSTA to TRACE_STAT_LIKE around syscallent.h inclusion.
	* qualify.c (lookup_class): Add TRACE_STAT_LIKE for "%%stat".
	* strace.1 (.SS Filtering): Add information about %%stat syscall class.
	* NEWS: Mention this change.
	* linux/32/syscallent.h (fstat64, fstatat64, statx): Add TSTA flag.
	* linux/64/syscallent.h (fstat, newfstatat, statx): Likewise.
	* linux/aarch64/syscallent.h (fstat, lstat, newfstatat, stat): Likewise.
	* linux/alpha/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
	osf_fstat, osf_lstat, osf_old_fstat, osf_old_lstat, osf_old_stat, osf_stat,
	stat, stat64): Likewise.
	* linux/arm/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
	oldlstat, oldstat, stat, stat64, statx): Likewise.
	* linux/avr32/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, stat,
	stat64): Likewise.
	* linux/bfin/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
	oldfstat, oldlstat, oldstat, stat, stat64): Likewise.
	* linux/crisv10/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
	oldfstat, oldlstat, oldstat, stat, stat64): Likewise.
	* linux/hppa/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, stat,
	stat64): Likewise.
	* linux/i386/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
	oldlstat, oldstat, stat, stat64, statx): Likewise.
	* linux/ia64/syscallent.h (fstat, lstat, newfstatat, stat): Likewise.
	* linux/m68k/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
	oldlstat, oldstat, stat, stat64, statx): Likewise.
	* linux/microblaze/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
	oldfstat, oldlstat, oldstat, stat, stat64): Likewise.
	* linux/mips/syscallent-compat.h (bsd43_fstat, bsd43_lstat, bsd43_oldfstat,
	bsd43_oldstat, bsd43_stat, posix_fstat, posix_lstat, posix_stat, svr4_fstat,
	svr4_fxstat, svr4_lstat, svr4_lxstat, svr4_stat, svr4_xstat, sysv_fstat,
	sysv_fxstat, sysv_lstat, sysv_lxstat, sysv_stat, sysv_xstat): Likewise.
	* linux/mips/syscallent-n32.h (fstat, lstat, newfstatat, stat, statx): Likewise.
	* linux/mips/syscallent-n64.h (fstat, lstat, newfstatat, stat, statx): Likewise.
	* linux/mips/syscallent-o32.h (fstat, fstat64, fstatat64, lstat, lstat64,
	oldfstat, oldlstat, oldstat, stat, stat64, statx): Likewise.
	* linux/powerpc64/syscallent.h (fstat, lstat, newfstatat, oldfstat, oldlstat,
	oldstat, stat): Likewise.
	* linux/powerpc/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
	oldfstat, oldlstat, oldstat, stat, stat64, statx): Likewise.
	* linux/s390/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, stat,
	stat64, statx): Likewise.
	* linux/s390x/syscallent.h (fstat, lstat, newfstatat, stat, statx): Likewise.
	* linux/sh64/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
	oldlstat, oldstat, stat, stat64): Likewise.
	* linux/sh/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, oldfstat,
	oldlstat, oldstat, stat, stat64): Likewise.
	* linux/sparc64/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
	oldlstat, stat, stat64): Likewise.
	* linux/sparc/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64,
	oldlstat, stat, stat64): Likewise.
	* linux/x32/syscallent.h (fstat, lstat, newfstatat, stat, statx): Likewise.
	* linux/x86_64/syscallent.h (fstat, lstat, newfstatat, stat, statx): Likewise.
	* linux/xtensa/syscallent.h (fstat, fstat64, fstatat64, lstat, lstat64, stat,
	stat64, statx): Likewise.
	* tests/gen_tests.in (trace_stat_like): New entry.
	* tests/trace_stat_like.in: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	* tests/ksysent.c (TSTA): New macro, defined to 0.
	* tests/nsyscalls.c: Likewise.

2017-04-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	qualify: add syntax for optional non-matching syscall qualification.
	It may be useful in case syscall is not present on the target
	architecture.

	* qualify.c (qualify_syscall): Add ignore_fail flag, set it to true
	in case syscall qualification is led by a question mark(s).
	* strace.1 (.SS Filtering): Document ability to use question marks
	in syscall qualification.

2017-04-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	linux/alpha/syscallent.h: add TSFA flag to osf_getfsstat.
	In accordance with [1].

	[1] https://www.freebsd.org/cgi/man.cgi?query=getfsstat&sektion=2

	* linux/alpha/syscallent.h (osf_getfsstat): Add TSFA flag.
	* strace.1 (.SS Filtering) <%%statfs>: Update equivalent regexp.

2017-04-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	linux/mips/syscallent-compat.h: add some TD/TF flags for *stat* variants
	*xstat syscalls are, according to [1], like their *stat counterparts,
	but with additional argument with fixed value.

	[1] http://math-atlas.sourceforge.net/devel/assembly/mipsabi32.pdf

	* linux/mips/syscallent-compat.h (*_xstat, *_lxstat, bsd43_oldstat):
	Add TF flag.
	(*_fxstat, bsd43_oldfstat): Add TD flag.

2017-04-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Implement -e trace=%%statfs option.
	linux/*/syscallent*.h part is updated automatically by:

	    sed -i 's/\(TSF\),[[:space:]]\?/\1|TSFA,/' linux/*/syscallent*.h
	    sed -i 's/\(TFSF\),/\1|TSFA,/' linux/*/syscallent*.h
	    sed -i 's/0\(,.*ustat\)/TSFA\1/' linux/*/syscallent*.h

	* sysent.h (TRACE_STATFS_LIKE): New macro.
	* syscall.c: Alias TSFA to TRACE_STATFS_LIKE around syscallent.h inclusion.
	* qualify.c (lookup_class): Add SCHED_STATFS_LIKE for "%%statfs".
	* strace.1 (.SS Filtering): Add information about %%statfs syscall class.
	* NEWS: Mention this change.
	* linux/32/syscallent.h (statfs64, fstatfs64): Add TSFA flag.
	* linux/64/syscallent.h (statfs, fstatfs): Likewise.
	* linux/aarch64/syscallent.h (statfs, fstatfs, ustat): Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/arm/syscallent.h (statfs, statfs64, fstatfs, fstatfs64, ustat):
	Likewise.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/crisv10/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-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/powerpc64/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/sparc64/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.
	* linux/alpha/syscallent.h (osf_statfs, osf_statfs64, statfs,
	ofs_fstatfs, osf_fstatfs64, ustat): Likewise.
	* linux/mips/syscallent-compat.h (*_statfs, *_statvfs, *_fstatfs): Likewise.
	* tests/gen_tests.in (trace_statfs_like): New entry.
	* tests/trace_statfs_like.in: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	* tests/ksysent.c (TSFA): New macro, defined to 0.
	* tests/nsyscalls.c: Likewise.

2017-04-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Implement -e trace=%fstatfs option.
	linux/*/syscallent*.h part is updated automatically by:

	    sed -i 's/TD,[[:space:]]\([[:space:]]*SEN.*[_"]fstatv\?fs\)/TD|TFSF,\1/' \
	           linux/*/syscallent*.h

	* sysent.h (TRACE_FSTATFS): New macro.
	* syscall.c: Alias TFSF to TRACE_FSTATFS around syscallent.h inclusion.
	* qualify.c (lookup_class): Add SCHED_FSTATFS for "%fstatfs".
	* strace.1 (.SS Filtering): Add information about %fstatfs syscall class.
	* NEWS: Mention this change.
	* linux/32/syscallent.h (fstatfs64): Add TFSF flag.
	* linux/64/syscallent.h (fstatfs): Likewise.
	* linux/aarch64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/arm/syscallent.h (fstatfs, fstatfs64):
	Likewise.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/crisv10/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-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/powerpc64/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/sparc64/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.
	* linux/alpha/syscallent.h (ofs_fstatfs, osf_fstatfs64): Likewise.
	* linux/mips/syscallent-compat.h (*_fstatfs, *_fstatvfs): Likewise.
	* tests/gen_tests.in (trace_fstatfs): New entry.
	* tests/trace_fstatfs.in: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	* tests/ksysent.c (TFSF): New macro, defined to 0.
	* tests/nsyscalls.c: Likewise.

2017-04-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	sysent.h: format syscall flag macros.
	Add some tabulation and leading zeroes to the values.

2017-04-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: tabulate sched.test.
	Rewrite sched.test using test_trace_expr().

	* tests/gen_tests.in (sched): New entry.
	* tests/sched.in: New file, derived from a set of tests in sched.test.
	* tests/sched.test: Remove.
	* tests/Makefile.am (DECODER_TESTS): Remove sched.test.
	(EXTRA_DIST): Add sched.in.

2017-04-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: tabulate regex.test.
	Rewrite regex.test using test_trace_expr().

	* tests/gen_tests.in (regex): New entry.
	* tests/regex.in: New file, derived from a set of tests in regex.test.
	* tests/regex.test: Remove.
	* tests/Makefile.am (DECODER_TESTS): Remove regex.test.
	(EXTRA_DIST): Add regex.in.

2017-04-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: tabulate clock.test.
	Rewrite clock.test using test_trace_expr().

	* tests/gen_tests.in (clock): New entry.
	* tests/clock.in: New file, derived from a set of tests in clock.test.
	* tests/clock.test: Remove.
	* tests/Makefile.am (DECODER_TESTS): Remove clock.test.
	(EXTRA_DIST): Add clock.in.

2017-04-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: tabulate trace_statfs.test.
	Rewrite trace_statfs.test using test_trace_expr().

	* tests/gen_tests.in (trace_statfs): New entry.
	* tests/trace_statfs.in: New file, derived from a set of tests
	in trace_statfs.test.
	* tests/trace_statfs.test: Remove.
	* tests/Makefile.am (DECODER_TESTS): Remove trace_statfs.test.
	(EXTRA_DIST): Add trace_statfs.in.

2017-04-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/init.sh: add helpers for running set of programs.
	This introduces three new helpers:
	prog_set_subtract subtracts one program set from another,
	test_pure_prog_set runs strace check on a set of programs,
	test_trace_expr tests trace expressions.

	* tests/init.sh (prog_set_subtract, test_pure_prog_set,
	test_trace_expr): New functions.

2017-04-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: extend gen_tests.sh further.
	* tests/gen_tests.sh: Extend support of arbitrary rules.

2017-04-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/xstat.c: do not remove sample file after test.
	As tests are executed in separate directories now, there is no need to
	remove sample file.

	* tests/xstat.c (main): Remove unlink calls.

2017-04-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: use fixed name for stat tests sample file.
	As tests are now run in separate directories.

	* tests/xstatx.c: Use fixed "stat.sample" name for sample file.
	* tests/fstat.test: Use it as an argument for -P option.
	* tests/gen_tests.in (fstat64, lstat, lstat64, newfstatat, oldlstat,
	oldstat, stat, stat64, statx): Likewise.

2017-04-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Derive copyright year from the git commit date.
	This solves problems like the need to update test suite on every
	New Year's Eve.

	* Makefile.am (dist-hook): Generate .year.
	* copyright-year-gen: New file.
	* configure.ac (copyright_year): New m4 variable, defined as the output
	of copyright-year-gen script.
	(AC_COPYRIGHT): Use it.
	(COPYRIGHT_YEAR): New output variable and preprocessor macro.
	* strace.c (print_version): Use COPYRIGHT_YEAR.
	* strace.spec.in (%prep): Save the value of COPYRIGHT_YEAR autoconf
	variable to .year file.
	* tests/strace-V.test (config_year): New variable, derived from config.h.
	Add sanity checks for $config_year and use it in expected output.

	Reported-by: Andreas Schwab <schwab@suse.de>

2017-04-19  Dmitry V. Levin  <ldv@altlinux.org>

	tests: move /proc/ checks from scripts to executables.
	Move most of /proc/self/task/ and /proc/self/fd/ checks from scripts
	to xecutables.

	* tests/attach-f-p.test: Move /proc/self/task/ check ...
	* tests/attach-f-p-cmd.c (main): ... here.
	* tests/fstat.test: Move /proc/self/fd/ check ...
	* tests/xstatx.c (main): ... here.
	* tests/net-y-unix.test: Move /proc/self/fd/ check ...
	* tests/net-y-unix.c (main): ... here.
	* tests/net-yy-inet.test: Move /proc/self/fd/ check ...
	* tests/net-yy-inet.c (main): ... here.
	* tests/net-yy-netlink.test: Move /proc/self/fd/ check ...
	* tests/net-yy-netlink.c (main): ... here.
	* tests/net-yy-unix.test: Move /proc/self/fd/ check ...
	* tests/net-yy-unix.c (main): ... here.

2017-04-19  Dmitry V. Levin  <ldv@altlinux.org>

	tests: tabulate pread64-pwrite64.test.
	* tests/gen_tests.in (pread64-pwrite64): New entry.
	* tests/pread64-pwrite64.c: (main): Skip the test if /proc/self/fd/
	is not available.
	* tests/pread64-pwrite64.test: Remove.
	* tests/Makefile.am (DECODER_TESTS): Remove pread64-pwrite64.test.

	tests: tabulate read-write.test.
	* tests/gen_tests.in (read-write): New entry.
	* tests/read-write.c: (main): Skip the test if /proc/self/fd/
	is not available.
	* tests/read-write.test: Remove.
	* tests/Makefile.am (DECODER_TESTS): Remove read-write.test.

	tests: add skip_if_unavailable function to libtests.
	* tests/skip_unavailable.c: New file.
	* tests/tests.h (skip_if_unavailable): New prototype.
	* tests/Makefile.am (libtests_a_SOURCES): Add skip_unavailable.c.

	tests: tabulate netlink_protocol.test.
	* tests/gen_tests.in (netlink_protocol): New entry.
	* tests/netlink_protocol.test: Remove.
	* tests/Makefile.am (DECODER_TESTS): Remove netlink_protocol.test.

	tests: tabulate statfs.test.
	* tests/gen_tests.in (statfs): New entry.
	(fstatfs, fstatfs64, statfs64): Update.
	* tests/statfs.test: Remove.
	* tests/Makefile.am (DECODER_TESTS): Remove statfs.test.

2017-04-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: skip statfs related tests if their sample files are not available
	* tests/xstatfsx.c (print_statfs): Skip the test if open failed.

	tests: extend gen_tests.sh to support arbitrary test_* rules.
	* tests/gen_tests.sh: Add support of arbitrary test_* rules.

	tests: change gen_tests.sh to read its input as raw input.
	* tests/gen_tests.sh: Specify -r option to read.
	* tests/gen_tests.in (shmxt): Update.

2017-04-18  Eugene Syromyatnikov  <evgsyr@gmail.com>

	strace.1: s/regex expression/regular expression/

2017-04-17  Dmitry V. Levin  <ldv@altlinux.org>

	strace.1: enhance %statfs description.
	* strace.1 (.SS Filtering) <%statfs>: Fix the list of syscalls,
	add an equivalent regex expression.

	netlink: decode NLMSG_ERROR messages.
	* netlink.c (decode_nlmsgerr, decode_payload): New functions.
	(decode_nlmsghdr_with_payload): Use decode_payload.
	* tests/netlink_protocol.c (send_query): Check decoding
	of NLMSG_ERROR messages.
	* NEWS: Mention this change.

	netlink: avoid using unaligned sizeof(struct nlmsghdr) unnecessarily.
	* netlink.c (NLMSG_HDRLEN): Redefine.
	(decode_nlmsghdr_with_payload, decode_netlink): Use it instead
	of sizeof(struct nlmsghdr).

	Fix the length argument passed from print_iovec to decode_netlink.
	* io.c (print_iovec): Pass the actual length to decode_netlink
	instead of the original length.
	* NEWS: Mention this fix.

	numa: fix printing of error values in move_pages status array.
	* numa.c (print_status): Do not lose a minus sign when printing
	a symbolic error code.
	* tests/move_pages.c (print_status_array): Update expected output.

	tests: generate pure_executables part of check_PROGRAMS automatically.
	* tests/gen_pure_executables.sh: New file.
	* bootstrap: Invoke it.
	* tests/Makefile.am: Include pure_executables.am.
	(check_PROGRAMS): Add $(PURE_EXECUTABLES).  Remove everything listed
	in pure_executables.list.
	(EXTRA_DIST): Add gen_pure_executables.sh.
	* tests/.gitignore: Add pure_executables.am.

	tests: make EXTRA_DIST sorted.
	* tests/Makefile.am (EXTRA_DIST): Sort.

	tests: check decoding of alpha specific osf_utimes syscall.
	* tests/osf_utimes.c: New file.
	* tests/gen_tests.in (osf_utimes): New entry.
	* tests/Makefile.am (check_PROGRAMS): Add osf_utimes.
	* tests/pure_executables.list: Likewise.
	* tests/.gitignore: Likewise.

	tests: parametrize utimes.c.
	* tests/xutimes.c: New file, based on utimes.c.
	* tests/utimes.c [__NR_utimes] (TEST_SYSCALL_NR, TEST_SYSCALL_STR,
	TEST_STRUCT): New macros.
	[__NR_utimes]: Replace all the rest with include "xutimes.c".
	* tests/Makefile.am (EXTRA_DIST): Add xutimes.c.

2017-04-16  Dmitry V. Levin  <ldv@altlinux.org>

	alpha: fix tracing flags of osf_select and osf_utimes syscalls.
	* linux/alpha/syscallent.h (osf_select): Add TD flag.
	(osf_utimes): Add TF flag.
	* NEWS: Mention alpha specific fixes.

2017-04-16  Dmitry V. Levin  <ldv@altlinux.org>

	alpha: rename print_timeval32_pair to print_timeval32_utimes.
	This follows the rename of print_timeval_item to print_timeval_utimes.

	* defs.h [ALPHA] (print_timeval32_pair): Rename
	to print_timeval32_utimes.
	* print_timeval.c [ALPHA] (print_timeval32_pair): Likewise.
	* utimes.c [ALPHA] (SYS_FUNC(osf_utimes)): Replace print_timeval32_pair
	with print_timeval32_utimes.

2017-04-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: do more rigorous testing of utimes syscall parser.
	* tests/utimes.c (errstr): New variable.
	(print_ts, k_utimes): New functions.
	(main): Use them to do more rigorous testing of utimes syscall parser.
	* tests/gen_tests.in (utimes): Update -a option.

	tests: do more rigorous testing of futimesat syscall parser.
	* tests/futimesat.c (errstr): New variable.
	(print_ts, k_futimesat): New functions.
	(main): Use them to do more rigorous testing of futimesat syscall parser.

2017-04-16  Dmitry V. Levin  <ldv@altlinux.org>

	Fix printing of inaccessible times argument of utimes and futimesat syscalls
	When the whole pair of struct timeval structures cannot be fetched from
	tracee's memory, print the address.  This behavior follows the kernel's
	that uses copy_from_user for the whole pair, too.

	* print_timeval.c (print_timeval_item): Remove.
	(print_timeval_pair): Rename to print_timeval_utimes, all callers
	updated.  Fetch the whole timeval_t array with a single
	umove_or_printaddr call.
	* tests/futimesat.c (main): Update expected output.
	* tests/utimes.c (main): Likewise.

2017-04-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rewrite utimensat.test without relying on libc utimensat wrapper.
	The new test also does more rigorous testing.

	* tests/utimensat.c: Stop including <assert.h> and <errno.h>, include
	<unistd.h> and <asm/unistd.h>, check __NR_utimensat instead
	of HAVE_UTIMENSAT.
	(errstr): New variable.
	(k_utimensat): New function, a thin wrapper around
	syscall(__NR_utimensat).
	(main): Use them instead of utimensat.
	* tests/gen_tests.in (utimensat): New entry.
	* tests/utimensat.test: Remove.
	* tests/Makefile.am (DECODER_TESTS): Remove it.

2017-04-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use fixed timestamps in utime related tests.
	* tests/clock.test: Remove futimesat, utime, utimensat, and utimes tests
	from the list of exceptions.
	* tests/utime.c (main): Do not use time(), use fixed timestamp instead.
	* tests/futimesat.c (main): Do not use gettimeofday(), use fixed
	timestamps instead.
	* tests/utimensat.c (main): Likewise.
	* tests/utimes.c (main): Likewise.

2017-04-15  Dmitry V. Levin  <ldv@altlinux.org>

	xtensa: wire up new syscalls.
	* linux/xtensa/syscallent.h [348..350]: New pkey_* entries.

	Reported-by: Victor Krapivensky <krapivenskiy.va@phystech.edu>

2017-04-15  Victor Krapivensky  <krapivenskiy.va@phystech.edu>

	Update statx parser and syscall entries lists to the upstream.
	* linux/32/syscallent.h [291]: Add statx entry.
	* linux/64/syscallent.h [291]: Likewise.
	* linux/arm/syscallent.h [397]: Likewise.
	* linux/m68k/syscallent.h [379]: Likewise.
	* linux/mips/syscallent-n32.h [6330]: Likewise.
	* linux/mips/syscallent-n64.h [5326]: Likewise.
	* linux/mips/syscallent-o32.h [4366]: Likewise.
	* linux/powerpc/syscallent.h [383]: Likewise.
	* linux/s390/syscallent.h [379]: Likewise.
	* linux/s390x/syscallent.h [379]: Likewise.
	* linux/xtensa/syscallent.h [351]: Likewise.
	* statx.h (struct_statx): Update.
	* statx.c (SYS_FUNC(statx)): Print struct_statx.stx_attributes_mask.
	* tests/xstatx.c (print_stat, main): Update to test decoding
	of struct_statx.stx_attributes_mask.

2017-04-14  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add more regex match checks.
	* tests/qual_syscall.test: Add regex match checks.

	tests: make mq_sendrecv* test executables reenterable.
	* tests/mq_sendrecv.c (MQ_NAME): Remove.
	(mq_name): New static variable.
	(cleanup): Use it instead of MQ_NAME.
	(main): Initialize it dynamically using the pid of process.  Use it
	instead of MQ_NAME.

	tests: make mq test executable reenterable.
	* tests/mq.c (NAME): Remove.
	(main): Replace the fixed message queue name with a dynamically
	made name containing the pid of process.
	* tests/gen_tests.in (mq): Update -a option.

	tests: make net-yy-netlink test executable reenterable.
	* tests/net-yy-netlink.c (main): Use getpid() instead of a fixed
	magic number.

	tests: tabulate shmxt.test.
	* tests/gen_tests.in (shmxt): New entry.
	* tests/shmxt.test: Remove.
	* tests/Makefile.am (DECODER_TESTS): Remove shmxt.test.

2017-04-14  Dmitry V. Levin  <ldv@altlinux.org>

	Revert "Implement -e trace=%sched option"
	-e trace=%sched became redundant as -e trace=/sched does the same.

	This reverts commit 811638e9c1805438a63c14f9704b8b00ac922623.

	* syscall.c (TSC): Remove.
	* sysent.h (TRACE_SCHED): Remove.
	* qualify.c (lookup_class): Remove %sched.
	* strace.1 (.SS Filtering): Likewise.
	* NEWS: Likewise.
	* linux/32/syscallent.h: Remove TSC flag from sched* syscalls.
	* linux/64/syscallent.h: Likewise.
	* linux/alpha/syscallent.h: Likewise.
	* linux/arm/syscallent.h: Likewise.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/crisv10/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/powerpc64/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/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.
	* tests/sched.test: Replace trace=%sched with trace=/sched.
	* tests/ksysent.c (TSC): Remove.
	* tests/nsyscalls.c: Likewise.

2017-04-14  Dmitry V. Levin  <ldv@altlinux.org>

	Revert "Implement -e trace=%clock option"
	-e trace=%clock became redundant as -e trace=/clock does the same.

	This reverts commit 0a13d2391c413e3847b71ec0c1d38f56e353b1b5.

	* syscall.c (TCL): Remove.
	* sysent.h (TRACE_CLOCK): Remove.
	* qualify.c (lookup_class): Remove %clock.
	* strace.1 (.SS Filtering): Likewise.
	* NEWS: Likewise.
	* linux/32/syscallent.h: Remove TCL flag from clock_* syscalls.
	* linux/64/syscallent.h: Likewise.
	* linux/alpha/syscallent.h: Likewise.
	* linux/arm/syscallent.h: Likewise.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/crisv10/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/powerpc64/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/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.
	* tests/clock.test: Replace trace=%clock with trace=/clock.
	* tests/ksysent.c (TCL): Remove.
	* tests/nsyscalls.c: Likewise.

2017-04-14  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify regex.test.
	* tests/regex.test: Use trace_statfs.test as a template instead
	of clock.test and sched.test, not because of more interesting
	regular expressions but to fix build on platforms where
	clock.test and sched.test are not reenterable.

2017-04-14  JingPiao Chen  <chenjingpiao@gmail.com>

	Implement -e trace=/regex option.
	* qualify.c: Include <regex.h>.
	(qualify_syscall_regex): New function.
	(qualify_syscall): Use it.
	* strace.1: Document -e trace=/regex option.
	* NEWS: Mention -e trace=/regex option.
	* tests/regex.test: New test.
	* tests/Makefile.am (DECODER_TESTS): Add it.
	* tests/options-syntax.test: Add checks for invaild regexp
	and for regexp that doesn't match a syscall.

2017-04-14  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix ioctl_nsfs.test on hppa.
	* tests/ioctl_nsfs.c (test_user_namespace): Specify an address
	in the middle of a mapped page as child_stack address argument
	of the clone call.
	[IA64] (clone): Update.

2017-04-14  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix ioctl_nsfs.test on ia64.
	glibc on ia64 provides no clone() function, but there is a __clone2
	function instead.  It is documented but no prototype is provided by
	glibc.

	* tests/ioctl_nsfs.c [IA64] (__clone2): New prototype.
	[IA64] (clone): New macro wrapper around __clone2.

2017-04-13  Edgar Kaziahmedov  <edos@linux.com>

	tests: check decoding of the remaining V4L2_BUF_TYPE_* types.
	* tests/ioctl_v4l2.c (init_v4l2_format, print_ioctl_v4l2): New functions
	to avoid code duplication in VIDIOC_S_FMT and VIDIOC_TRY_FMT tests.
	(main) <VIDIOC_G_FMT, VIDIOC_S_FMT, VIDIOC_TRY_FMT>: Use them.  Add
	checks for remaining V4L2_BUF_TYPE_* types.

	v4l2: Implement decoding of the remaining V4L2_BUF_TYPE_* types.
	* v4l2.c: Include "xlat/v4l2_vbi_flags.h" and "xlat/v4l2_sliced_flags.h".
	(struct_v4l2_clip): New typedef.  Mpersify it.
	(print_v4l2_clip): New function.
	(print_v4l2_format_fmt): Use it.  Add struct tcb argument.  Implement
	decoding of the remaining V4L2_BUF_TYPE_* types.
	* xlat/v4l2_vbi_flags.in: Add V4L2_VBI_UNSYNC and V4L2_VBI_INTERLACED
	introduced by linux kernel commit v2.5.46~39^2~23^2~4.
	Add V4L2_VBI_ITU_525_F1_START, V4L2_VBI_ITU_525_F2_START,
	V4L2_VBI_ITU_625_F1_START, and V4L2_VBI_ITU_625_F2_START introduced by
	linux kernel commit v3.17-rc1~112^2~217.
	* xlat/v4l2_sliced_flags.in: Add V4L2_SLICED_TELETEXT_B, V4L2_SLICED_VPS,
	V4L2_SLICED_CAPTION_525, V4L2_SLICED_WSS_625, V4L2_SLICED_VBI_525, and
	V4L2_SLICED_VBI_625 introduced by linux kernel commit v2.6.14-rc2~64.
	* configure.ac (AC_CHECK_DECLS): Add V4L2_BUF_TYPE_SDR_CAPTURE and
	V4L2_BUF_TYPE_SDR_OUTPUT.
	(AC_CHECK_MEMBERS): Add struct v4l2_window.global_alpha and
	struct v4l2_sdr_format.buffersize.
	* NEWS: Mention this change.

2017-04-13  Dmitry V. Levin  <ldv@altlinux.org>

	travis: use mainline kernel uapi headers for coverage.
	* .travis.yml (matrix) <CHECK=coverage>: Add KHEADERS=torvalds/linux.
	* travis-build.sh: Handle $KHEADERS.
	* travis-install.sh: Likewise.

	travis: switch from clang-3.6 to clang-3.8.
	* .travis.yml (matrix): Change clang-3.6 to clang-3.8.

2017-04-13  Nikolay Marchuk  <marchuk.nikolay.a@gmail.com>

	Implement decoding of NS_* ioctl commands.
	* configure.ac (AC_CHECK_HEADERS): Add linux/nsfs.h.
	* defs.h (DECL_IOCTL(nsfs)): New prototype.
	(setns_types): Make global.
	* ioctl.c (ioctl_decode): Call nsfs_ioctl for 0xb7 code.
	* nsfs.c: New file.
	* nsfs.h: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* tests/ioctl_nsfs.c: New file.
	* tests/ioctl_nsfs.test: Likewise.
	* tests/.gitignore: Add ioctl_nsfs.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add ioctl_nsfs.test.
	* NEWS: Mention this change.

2017-04-13  Dmitry V. Levin  <ldv@altlinux.org>

	travis: copy coverage test suite log to the travis log.
	* travis-build.sh (coverage): Print tests*/test-suite.log
	and tests*/ksysent.log.

2017-04-12  Dmitry V. Levin  <ldv@altlinux.org>

	travis: add gcc-6.
	* .travis.yml (matrix): Add gcc-6 entries.
	* travis-build.sh: Handle gcc*.
	* travis-install.sh: Handle gcc-*.

2017-04-11  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify gen_tests.sh against in-tree builds.
	* tests/gen_tests.sh: Use abs_srcdir instead of srcdir to construct
	a path to gen_tests.sh in implicit make rules.

2017-04-11  Dmitry V. Levin  <ldv@altlinux.org>

	trace_syscall_exiting: do not call get_regs for filtered syscalls.
	This saves up to 25% of ptrace syscalls in case of trace filtering.

	* syscall.c (trace_syscall_exiting): Do not call gettimeofday
	and get_regs for filtered syscalls.
	* NEWS: Mention this change.
	* tests/get_regs.test: New test.
	* tests/Makefile.am (MISC_TESTS): Add it.

2017-04-11  Dmitry V. Levin  <ldv@altlinux.org>

	Delay get_regs invocation.
	strace used to call get_regs on every stop of a tracee, including cases
	when the result is going to be discarded.  Prepare to change this lavish
	practice by delaying get_regs invocation until its result is actually
	needed.

	* defs.h (get_regs): Remove.
	* strace.c (trace): Do not call get_regs.
	* syscall.c (get_regs): Add static qualifier.
	(trace_syscall_exiting, print_pc, get_scno): Call get_regs.

2017-04-11  Dmitry V. Levin  <ldv@altlinux.org>

	startup_tcb: move get_scno invocation to a more convenient place.
	* strace.c (trace): Move get_scno invocation ...
	(startup_tcb): ... here.  This is a no-op change that slightly improves
	readability.

2017-04-11  Dmitry V. Levin  <ldv@altlinux.org>

	get_regs: guard against subsequent invocations.
	At this moment there is only one call to get_regs,
	but there is going to be more of them, so a guard is needed.

	This change also adds a clear_regs call before get_regs,
	which essentially reverts commit v4.9-288-ge9bfff6.

	* strace.c (trace): Call clear_regs before get_regs.
	* syscall.c (get_regs): Skip if get_regs_error != -1.

2017-04-11  Dmitry V. Levin  <ldv@altlinux.org>

	syscall: move definitions of automatic variables closer to their use.
	* syscall.c (trace_syscall_entering, trace_syscall_exiting): Move
	definitions of automatic variables closer to their first use.  This
	change slightly improves readability.

	tests: check decoding of gettid syscall.
	* tests/gettid.c: New file.
	* tests/.gitignore: Add gettid.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	* tests/gen_tests.in (gettid): New entry.

2017-04-11  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix build on alpha.
	* tests/getpid.c: Skip if __NR_getpid is not defined.
	* tests/getppid.c: Skip if __NR_getppid is not defined.

	Fixes: fd1041f6 ("tests: add tests for getpid and getppid syscalls")

2017-04-11  Dmitry V. Levin  <ldv@altlinux.org>

	Fix build with old linux/netlink.h.
	* socketutils.c: Provide a fallback definition of NETLINK_SOCK_DIAG.

	Fixes: 5c256356 ("Do not include xlat/netlink_protocols.h twice")

2017-04-10  Dmitry V. Levin  <ldv@altlinux.org>

	Do not include xlat/netlink_protocols.h twice.
	Make netlink_protocols a global xlat array defined in net.c file.

	* defs.h (netlink_protocols): New prototype.
	* socketutils.c: Stop including "xlat/netlink_protocols.h".

2017-04-10  Dmitry V. Levin  <ldv@altlinux.org>

	Do not include xlat/clocknames.h twice.
	Make clocknames a global xlat array defined in time.c file.

	* defs.h (clocknames): New prototype.
	* perf.c: Stop including "xlat/clocknames.h".

2017-04-10  Dmitry V. Levin  <ldv@altlinux.org>

	Remove unused xlat/openmodessol.in.
	* xlat/openmodessol.in: Remove file unused since commit
	v4.10-45-gdf4dd8b.

	Remove unused xlat/aclipc.in.
	* xlat/aclipc.in: Remove file unused since commit v4.9-46-g681452b.

2017-04-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests: remove statfs.expected.
	statfs.expected is unused since commit v4.11-515-g67c2f67.

	* tests/statfs.expected: Remove.
	* tests/Makefile.am (EXTRA_DIST): Remove it.

2017-04-07  Sandhya Bankar  <bankarsandhya512@gmail.com>

	tests: add tests for getpid and getppid syscalls.

	[ldv: rewritten everything]

	* tests/getpid.c: New file.
	* tests/getppid.c: Likewise.
	* tests/.gitignore: Add getpid and getppid.
	* tests/pure_executables.list: Likewise.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	* tests/gen_tests.in (getpid, getppid): New entries.

2017-04-07  Edgar Kaziahmedov  <edos@linux.com>

	Update V4L2_* constants.
	* xlat/v4l2_buf_flags.in: Add V4L2_BUF_FLAG_PREPARED,
	V4L2_BUF_FLAG_NO_CACHE_INVALIDATE, and V4L2_BUF_FLAG_NO_CACHE_CLEAN
	introduced by linux kernel commit v3.2-rc1~63^2~55.
	Add V4L2_BUF_FLAG_TIMESTAMP_MASK, V4L2_BUF_FLAG_TIMESTAMP_UNKNOWN,
	and V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC introduced by linux kernel commit
	v3.9-rc1~93^2~536.
	Add V4L2_BUF_FLAG_TIMESTAMP_COPY introduced by linux kernel commit
	v3.10-rc1~136^2~560.
	Add V4L2_BUF_FLAG_TSTAMP_SRC_MASK, V4L2_BUF_FLAG_TSTAMP_SRC_EOF,
	and V4L2_BUF_FLAG_TSTAMP_SRC_SOE introduced by linux kernel commit
	v3.15-rc1~85^2~186.
	Add V4L2_BUF_FLAG_LAST introduced by linux kernel commit
	v4.2-rc1~107^2~389.
	* xlat/v4l2_buf_types.in: Add V4L2_BUF_TYPE_SDR_CAPTURE
	and V4L2_BUF_TYPE_SDR_OUTPUT introduced by linux kernel commits
	v3.15-rc1~85^2~213 and v4.4-rc1~118^2~14, respectively.
	* xlat/xlat/v4l2_colorspaces.in: Add V4L2_COLORSPACE_ADOBERGB
	and V4L2_COLORSPACE_BT2020 introduced by linux kernel commit
	v3.19-rc1~29^2~72.
	Add V4L2_COLORSPACE_RAW and V4L2_COLORSPACE_DCI_P3 introduced by linux
	kernel commits v4.2-rc1~107^2~182 and v4.4-rc1~118^2~120, respectively.
	* xlat/v4l2_device_capabilities_flags.in: Add V4L2_CAP_SDR_CAPTURE,
	V4L2_CAP_EXT_PIX_FORMAT, and V4L2_CAP_SDR_OUTPUT introduced by linux
	kernel commits v3.15-rc1~85^2~210, v3.17-rc1~112^2~327,
	and v4.4-rc1~118^2~14, respectively.
	* xlat/v4l2_memories.in: Add V4L2_MEMORY_OVERLAY introduced
	in linux 2.5.46.  Add V4L2_MEMORY_DMABUF introduced by linux kernel
	commit v3.8-rc1~115^2^2~52.

2017-04-07  Abhishek Tiwari  <erabhishektiwarics@gmail.com>

	Implement -e trace=%statfs option.
	linux/*/syscallent*.h part is modified automatically by:

		sed -i 's/TF\(,[[:space:]]*SEN.*[_"]statv\?fs\)/TF|TSF\1/' \
			linux/*/syscallent*.h

	[ldv: rewritten trace_statfs.test using sched.test as a template]

	* sysent.h (TRACE_STATFS): New macro.
	* syscall.c: Alias TSF to TRACE_STATFS around syscallent.h inclusion.
	* qualify.c (lookup_class): Add SCHED_STATFS for "%statfs".
	* strace.1 (.SS Filtering): Add information about %statfs syscall class.
	* NEWS: Mention this change.
	* linux/64/syscallent.h (statfs): Add TSF flag.
	* linux/aarch64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/32/syscallent.h (statfs64): Likewise.
	* linux/arm/syscallent.h (statfs, statfs64): Likewise.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/crisv10/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-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/powerpc64/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/sparc64/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.
	* linux/alpha/syscallent.h (osf_statfs, osf_statfs64, statfs): Likewise.
	* linux/mips/syscallent-compat.h (*_statfs, *_statvfs): Likewise.
	* tests/trace_statfs.test: New test.
	* tests/Makefile.am (DECODER_TESTS): Add it.
	* tests/ksysent.c (TSF): New macro, defined to 0.
	* tests/nsyscalls.c: Likewise.

2017-04-06  Rishi Bhatt  <bhatt.rishi062@gmail.com>

	Implement -e trace=%clock option.
	linux/*/syscallent.h part is modified automatically by
	sed -i 's/0\(,[[:space:]]*SEN(clock_\)/TCL\1/' linux/*/syscallent*.h

	[ldv: rewritten clock.test using sched.test as a template]

	* sysent.h (TRACE_CLOCK): New macro.
	* syscall.c: Alias TCL to TRACE_CLOCK around syscallent.h inclusion.
	* qualify.c (lookup_class): Add TRACE_CLOCK for "%clock".
	* strace.1 (.SS Filtering): Add information about %clock syscall class.
	* NEWS: Mention this change.
	* linux/32/syscallent.h: Add TCL flag for clock_* syscalls.
	* linux/64/syscallent.h: Likewise.
	* linux/alpha/syscallent.h: Likewise.
	* linux/arm/syscallent.h: Likewise.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/crisv10/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/powerpc64/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/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.
	* tests/clock.test: New test.
	* tests/Makefile.am (DECODER_TESTS): Add it.
	* tests/ksysent.c (TCL): New macro, defined to 0.
	* tests/nsyscalls.c: Likewise.

2017-04-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests: tabulate xattr.test.
	* tests/gen_tests.in (xattr): New entry.
	* tests/xattr.test: Remove.
	* tests/Makefile.am (DECODER_TESTS): Remove xattr.test.

2017-04-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: generalize scripts that check non-abbreviated decoding of ioctls.
	* tests/ioctl-v.sh: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	(DECODER_TESTS): Remove ioctl_evdev-v.test, ioctl_loop-v.test,
	and ioctl_rtc-v.test.
	* tests/gen_tests.in (ioctl_evdev-v, ioctl_loop-v, ioctl_rtc-v):
	New entries.
	* tests/ioctl_evdev-v.test: Remove.
	* tests/ioctl_loop-v.test: Ditto.
	* tests/ioctl_rtc-v.test: Ditto.

2017-04-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: tabulate stereotypical test scripts.
	Convert test scripts that follow simple testing patterns to a table.
	Generate all these scripts from gen_tests.in file using gen_tests.sh
	script at bootstrap time.

	The largest set of test scripts has been converted using
	the following command:

	grep -l ^run_strace_match_diff *.test |while read f; do
		n="${f%.test}"
		grep '^[^#]' "$f" |
		grep -Evq '^(\. "\${srcdir=\.}/init\.sh"|run_strace_match_diff)' ||
		sed -n 's/^run_strace_match_diff\(.*\)/'$n'\1/p' "$f"
	done

	The second largest set of test scripts has been converted using
	the following command:

	grep -l srcdir= *.test |while read f; do
		n="${f%.test}"
		grep '^[^#]' "$f" |
		grep -Fvq srcdir= ||
		sed -n 's/^. "\${srcdir=.}\/\([^"]\+\)".*/'$n'\t+\1/p' "$f"
	done

	* tests/gen_tests.in: New file.
	* tests/gen_tests.sh: New file.
	* bootstrap: Invoke it.
	* tests/.gitignore: Add *.gen.test and gen_tests.am.
	* tests/_newselect.test: Remove.
	* tests/accept.test: Ditto.
	* tests/accept4.test: Ditto.
	* tests/access.test: Ditto.
	* tests/acct.test: Ditto.
	* tests/add_key.test: Ditto.
	* tests/adjtimex.test: Ditto.
	* tests/aio.test: Ditto.
	* tests/alarm.test: Ditto.
	* tests/bpf.test: Ditto.
	* tests/btrfs.test: Ditto.
	* tests/chmod.test: Ditto.
	* tests/chown.test: Ditto.
	* tests/chown32.test: Ditto.
	* tests/chroot.test: Ditto.
	* tests/clock_adjtime.test: Ditto.
	* tests/clock_nanosleep.test: Ditto.
	* tests/clock_xettime.test: Ditto.
	* tests/copy_file_range.test: Ditto.
	* tests/creat.test: Ditto.
	* tests/delete_module.test: Ditto.
	* tests/dup.test: Ditto.
	* tests/dup2.test: Ditto.
	* tests/dup3.test: Ditto.
	* tests/epoll_create.test: Ditto.
	* tests/epoll_create1.test: Ditto.
	* tests/epoll_ctl.test: Ditto.
	* tests/epoll_pwait.test: Ditto.
	* tests/epoll_wait.test: Ditto.
	* tests/erestartsys.test: Ditto.
	* tests/execveat-v.test: Ditto.
	* tests/execveat.test: Ditto.
	* tests/faccessat.test: Ditto.
	* tests/fadvise64_64.test: Ditto.
	* tests/fallocate.test: Ditto.
	* tests/fanotify_init.test: Ditto.
	* tests/fanotify_mark.test: Ditto.
	* tests/fchdir.test: Ditto.
	* tests/fchmod.test: Ditto.
	* tests/fchmodat.test: Ditto.
	* tests/fchown.test: Ditto.
	* tests/fchown32.test: Ditto.
	* tests/fchownat.test: Ditto.
	* tests/fcntl.test: Ditto.
	* tests/fcntl64.test: Ditto.
	* tests/fdatasync.test: Ditto.
	* tests/file_handle.test: Ditto.
	* tests/file_ioctl.test: Ditto.
	* tests/finit_module.test: Ditto.
	* tests/flock.test: Ditto.
	* tests/fork-f.test: Ditto.
	* tests/fstat64.test: Ditto.
	* tests/fstatat64.test: Ditto.
	* tests/fstatfs.test: Ditto.
	* tests/fstatfs64.test: Ditto.
	* tests/fsync.test: Ditto.
	* tests/ftruncate.test: Ditto.
	* tests/ftruncate64.test: Ditto.
	* tests/futimesat.test: Ditto.
	* tests/get_mempolicy.test: Ditto.
	* tests/getcpu.test: Ditto.
	* tests/getcwd.test: Ditto.
	* tests/getdents.test: Ditto.
	* tests/getdents64.test: Ditto.
	* tests/getegid.test: Ditto.
	* tests/getegid32.test: Ditto.
	* tests/geteuid.test: Ditto.
	* tests/geteuid32.test: Ditto.
	* tests/getgid.test: Ditto.
	* tests/getgid32.test: Ditto.
	* tests/getgroups.test: Ditto.
	* tests/getgroups32.test: Ditto.
	* tests/getpeername.test: Ditto.
	* tests/getpgrp.test: Ditto.
	* tests/getrandom.test: Ditto.
	* tests/getresgid.test: Ditto.
	* tests/getresgid32.test: Ditto.
	* tests/getresuid.test: Ditto.
	* tests/getresuid32.test: Ditto.
	* tests/getrlimit.test: Ditto.
	* tests/getrusage.test: Ditto.
	* tests/getsid.test: Ditto.
	* tests/getsockname.test: Ditto.
	* tests/getuid32.test: Ditto.
	* tests/getxxid.test: Ditto.
	* tests/inet-cmsg.test: Ditto.
	* tests/init_module.test: Ditto.
	* tests/inotify.test: Ditto.
	* tests/inotify_init1.test: Ditto.
	* tests/int_0x80.test: Ditto.
	* tests/ioctl_block.test: Ditto.
	* tests/ioctl_evdev.test: Ditto.
	* tests/ioctl_loop.test: Ditto.
	* tests/ioctl_mtd.test: Ditto.
	* tests/ioctl_rtc.test: Ditto.
	* tests/ioctl_scsi.test: Ditto.
	* tests/ioctl_sg_io_v3.test: Ditto.
	* tests/ioctl_sg_io_v4.test: Ditto.
	* tests/ioctl_uffdio.test: Ditto.
	* tests/ioctl_v4l2.test: Ditto.
	* tests/ioperm.test: Ditto.
	* tests/iopl.test: Ditto.
	* tests/ioprio.test: Ditto.
	* tests/ip_mreq.test: Ditto.
	* tests/ipc.test: Ditto.
	* tests/ipc_msg.test: Ditto.
	* tests/ipc_sem.test: Ditto.
	* tests/ipc_shm.test: Ditto.
	* tests/kcmp.test: Ditto.
	* tests/kexec_file_load.test: Ditto.
	* tests/kexec_load.test: Ditto.
	* tests/keyctl.test: Ditto.
	* tests/kill.test: Ditto.
	* tests/lchown.test: Ditto.
	* tests/lchown32.test: Ditto.
	* tests/link.test: Ditto.
	* tests/linkat.test: Ditto.
	* tests/lookup_dcookie.test: Ditto.
	* tests/lstat.test: Ditto.
	* tests/lstat64.test: Ditto.
	* tests/mbind.test: Ditto.
	* tests/membarrier.test: Ditto.
	* tests/memfd_create.test: Ditto.
	* tests/migrate_pages.test: Ditto.
	* tests/mincore.test: Ditto.
	* tests/mkdir.test: Ditto.
	* tests/mkdirat.test: Ditto.
	* tests/mknod.test: Ditto.
	* tests/mknodat.test: Ditto.
	* tests/mlock.test: Ditto.
	* tests/mlock2.test: Ditto.
	* tests/mlockall.test: Ditto.
	* tests/mmap64.test: Ditto.
	* tests/mmsg-silent.test: Ditto.
	* tests/mmsg.test: Ditto.
	* tests/mmsg_name-v.test: Ditto.
	* tests/mmsg_name.test: Ditto.
	* tests/mount.test: Ditto.
	* tests/move_pages.test: Ditto.
	* tests/mq.test: Ditto.
	* tests/mq_sendrecv-read.test: Ditto.
	* tests/mq_sendrecv-write.test: Ditto.
	* tests/mq_sendrecv.test: Ditto.
	* tests/msg_control-v.test: Ditto.
	* tests/msg_control.test: Ditto.
	* tests/msg_name.test: Ditto.
	* tests/munlockall.test: Ditto.
	* tests/nanosleep.test: Ditto.
	* tests/net-icmp_filter.test: Ditto.
	* tests/net-sockaddr.test: Ditto.
	* tests/newfstatat.test: Ditto.
	* tests/old_mmap.test: Ditto.
	* tests/oldfstat.test: Ditto.
	* tests/oldlstat.test: Ditto.
	* tests/oldstat.test: Ditto.
	* tests/open.test: Ditto.
	* tests/openat.test: Ditto.
	* tests/pause.test: Ditto.
	* tests/perf_event_open.test: Ditto.
	* tests/perf_event_open_nonverbose.test: Ditto.
	* tests/perf_event_open_unabbrev.test: Ditto.
	* tests/pipe2.test: Ditto.
	* tests/pkey_alloc.test: Ditto.
	* tests/pkey_free.test: Ditto.
	* tests/pkey_mprotect.test: Ditto.
	* tests/ppoll-v.test: Ditto.
	* tests/ppoll.test: Ditto.
	* tests/preadv-pwritev.test: Ditto.
	* tests/preadv.test: Ditto.
	* tests/preadv2-pwritev2.test: Ditto.
	* tests/printstr.test: Ditto.
	* tests/prlimit64.test: Ditto.
	* tests/process_vm_readv.test: Ditto.
	* tests/process_vm_writev.test: Ditto.
	* tests/pselect6.test: Ditto.
	* tests/ptrace.test: Ditto.
	* tests/pwritev.test: Ditto.
	* tests/quotactl-v.test: Ditto.
	* tests/quotactl-xfs-v.test: Ditto.
	* tests/quotactl-xfs.test: Ditto.
	* tests/quotactl.test: Ditto.
	* tests/readahead.test: Ditto.
	* tests/readdir.test: Ditto.
	* tests/readlink.test: Ditto.
	* tests/readlinkat.test: Ditto.
	* tests/reboot.test: Ditto.
	* tests/recvfrom.test: Ditto.
	* tests/recvmmsg-timeout.test: Ditto.
	* tests/recvmsg.test: Ditto.
	* tests/remap_file_pages.test: Ditto.
	* tests/rename.test: Ditto.
	* tests/renameat.test: Ditto.
	* tests/renameat2.test: Ditto.
	* tests/request_key.test: Ditto.
	* tests/rmdir.test: Ditto.
	* tests/rt_sigpending.test: Ditto.
	* tests/rt_sigprocmask.test: Ditto.
	* tests/rt_sigqueueinfo.test: Ditto.
	* tests/rt_sigreturn.test: Ditto.
	* tests/rt_sigsuspend.test: Ditto.
	* tests/rt_sigtimedwait.test: Ditto.
	* tests/rt_tgsigqueueinfo.test: Ditto.
	* tests/sched_get_priority_mxx.test: Ditto.
	* tests/sched_rr_get_interval.test: Ditto.
	* tests/sched_xetaffinity.test: Ditto.
	* tests/sched_xetattr.test: Ditto.
	* tests/sched_xetparam.test: Ditto.
	* tests/sched_xetscheduler.test: Ditto.
	* tests/sched_yield.test: Ditto.
	* tests/seccomp-filter-v.test: Ditto.
	* tests/seccomp-filter.test: Ditto.
	* tests/select.test: Ditto.
	* tests/semop.test: Ditto.
	* tests/sendfile.test: Ditto.
	* tests/sendfile64.test: Ditto.
	* tests/set_mempolicy.test: Ditto.
	* tests/setdomainname.test: Ditto.
	* tests/setfsgid.test: Ditto.
	* tests/setfsgid32.test: Ditto.
	* tests/setfsuid.test: Ditto.
	* tests/setfsuid32.test: Ditto.
	* tests/setgid.test: Ditto.
	* tests/setgid32.test: Ditto.
	* tests/setgroups.test: Ditto.
	* tests/setgroups32.test: Ditto.
	* tests/sethostname.test: Ditto.
	* tests/setns.test: Ditto.
	* tests/setregid.test: Ditto.
	* tests/setregid32.test: Ditto.
	* tests/setresgid.test: Ditto.
	* tests/setresgid32.test: Ditto.
	* tests/setresuid.test: Ditto.
	* tests/setresuid32.test: Ditto.
	* tests/setreuid.test: Ditto.
	* tests/setreuid32.test: Ditto.
	* tests/setrlimit.test: Ditto.
	* tests/setuid.test: Ditto.
	* tests/setuid32.test: Ditto.
	* tests/shutdown.test: Ditto.
	* tests/siginfo.test: Ditto.
	* tests/signal_receive.test: Ditto.
	* tests/signalfd4.test: Ditto.
	* tests/sigreturn.test: Ditto.
	* tests/socketcall.test: Ditto.
	* tests/splice.test: Ditto.
	* tests/stat.test: Ditto.
	* tests/stat64.test: Ditto.
	* tests/statfs64.test: Ditto.
	* tests/statx.sh: Ditto.
	* tests/statx.test: Ditto.
	* tests/swap.test: Ditto.
	* tests/symlink.test: Ditto.
	* tests/symlinkat.test: Ditto.
	* tests/sync.test: Ditto.
	* tests/sync_file_range.test: Ditto.
	* tests/sync_file_range2.test: Ditto.
	* tests/sysinfo.test: Ditto.
	* tests/syslog.test: Ditto.
	* tests/tee.test: Ditto.
	* tests/time.test: Ditto.
	* tests/timer_create.test: Ditto.
	* tests/timer_xettime.test: Ditto.
	* tests/timerfd_xettime.test: Ditto.
	* tests/times-fail.test: Ditto.
	* tests/times.test: Ditto.
	* tests/truncate.test: Ditto.
	* tests/truncate64.test: Ditto.
	* tests/ugetrlimit.test: Ditto.
	* tests/umask.test: Ditto.
	* tests/umoven-illptr.test: Ditto.
	* tests/umovestr-illptr.test: Ditto.
	* tests/umovestr3.test: Ditto.
	* tests/unlink.test: Ditto.
	* tests/unlinkat.test: Ditto.
	* tests/unshare.test: Ditto.
	* tests/userfaultfd.test: Ditto.
	* tests/ustat.test: Ditto.
	* tests/utime.test: Ditto.
	* tests/utimes.test: Ditto.
	* tests/vfork-f.test: Ditto.
	* tests/vhangup.test: Ditto.
	* tests/vmsplice.test: Ditto.
	* tests/wait4-v.test: Ditto.
	* tests/wait4.test: Ditto.
	* tests/waitid-v.test: Ditto.
	* tests/waitid.test: Ditto.
	* tests/waitpid.test: Ditto.
	* tests/xattr-strings.test: Ditto.
	* tests/xet_robust_list.test: Ditto.
	* tests/xetitimer.test: Ditto.
	* tests/xetpgid.test: Ditto.
	* tests/xetpriority.test: Ditto.
	* tests/xettimeofday.test: Ditto.
	* tests/Makefile.am (DECODER_TESTS, MISC_TESTS): Remove them.
	Include gen_tests.am.
	(TESTS): Add $(GEN_TESTS).
	(XFAIL_TESTS_x86_64, XFAIL_TESTS_x32): Rename int_0x80.test
	to int_0x80.gen.test.
	(EXTRA_DIST): Add gen_tests.in and gen_tests.sh, remove statx.sh.
	(clean-local-check): Remove $(GEN_TESTS:.gen.test=.dir).

2017-04-04  Dmitry V. Levin  <ldv@altlinux.org>

	tests: handle test scripts with .gen.test suffix.
	* tests/init.sh: If script name ends with .gen.test,
	set NAME variable with .gen.test suffix stripped.

2017-04-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	mpers.awk: add support for multidimensional arrays.
	* mpers.awk (update_upper_bound): New function, which maintains new "count"
	property for storing total element count and updates "upper_bound"
	property which now contains string with array dimensions.
	(/^DW_AT_upper_bound/, /^DW_AT_count/): Use it.
	(what_is) <case "array_type">: Use "count" property in order to calculate
	returned_size, do not embody returned string in square brackets.
	* mpers_test.sh: Add checks for multidimensional arrays.

2017-04-04  Dmitry V. Levin  <ldv@altlinux.org>

	mpers.awk: prepare for adding support of multidimensional arrays.
	* mpers.awk (what_is) <case "structure_type", case "union_type">:
	Move formatting of array upper_bound ...
	<case "array_type">: ... here.

2017-04-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: cleanup temporary files removals.
	As every test now runs in its own subdirectory, there is no need
	to remove leftover files manually by each test.

	* tests/init.sh (run_strace_match_diff): Do not remove $EXP.
	* tests/brk.test: Likewise.
	* tests/options-syntax.test: Likewise.
	* tests/qual_inject-retval.test (check_injection): Likewise.
	* tests/qual_signal.test (test_one_sig): Likewise.
	* tests/sched.test: Likewise.
	* tests/seccomp-strict.test: Likewise.
	* tests/strace-V.test: Likewise.
	* tests/strace-tt.test: Likewise.
	* tests/strace-ttt.test: Likewise.
	* tests/threads-execve.test: Likewise.
	* tests/attach-f-p.test: Use $EXP instead of $OUT, do not remove it.
	* tests/personality.test: Likewise.
	* tests/poll.test: Likewise.
	* tests/fstat.test: Likewise.
	* tests/ipc.sh: Likewise.
	* tests/restart_syscall.test: Likewise.
	* tests/utimensat.test: Likewise.
	* tests/attach-p-cmd.test: Likewise.  Do not remove
	attach-p-cmd.test-lock.
	* tests/detach-running.test: Do not remove $LOG.
	* tests/detach-sleeping.test: Likewise.
	* tests/detach-stopped.test: Likewise.
	* tests/redirect.test: Do not remove $OUT.
	* tests/strace-S.test: Likewise.
	* tests/getdents.test: Do not remove $LOG.dir.
	* tests/getdents64.test: Likewise.
	* tests/readdir.test: Likewise.
	* tests/btrfs-v.test: Do not remove $EXP and $OUT.
	* tests/btrfs-vw.test: Likewise.
	* tests/btrfs-w.test: Likewise.
	* tests/execve-v.test: Likewise.
	* tests/execve.test: Likewise.
	* tests/fadvise64.test: Likewise.
	* tests/getuid.test: Likewise.
	* tests/ioctl.test: Likewise.
	* tests/ioctl_dm-v.test: Likewise.
	* tests/ioctl_dm.test: Likewise.
	* tests/ioctl_evdev-v.test: Likewise.
	* tests/ioctl_loop-nv.test: Likewise.
	* tests/ioctl_loop-v.test: Likewise.
	* tests/ioctl_loop.test: Likewise.
	* tests/ioctl_rtc-v.test: Likewise.
	* tests/ioctl_sock_gifconf.test: Likewise.
	* tests/llseek.test: Likewise.
	* tests/lseek.test: Likewise.
	* tests/mmap.test: Likewise.
	* tests/net-y-unix.test: Likewise.
	* tests/net-yy-inet.test: Likewise.
	* tests/net-yy-netlink.test: Likewise.
	* tests/net-yy-unix.test: Likewise.
	* tests/opipe.test: Likewise.
	* tests/prctl-arg2-intptr.test: Likewise.
	* tests/prctl-dumpable.test: Likewise.
	* tests/prctl-name.test: Likewise.
	* tests/prctl-no-args.test: Likewise.
	* tests/prctl-pdeathsig.test: Likewise.
	* tests/prctl-seccomp-filter-v.test: Likewise.
	* tests/prctl-seccomp-strict.test: Likewise.
	* tests/prctl-securebits.test: Likewise.
	* tests/prctl-tid_address.test: Likewise.
	* tests/prctl-tsc.test: Likewise.
	* tests/umovestr2.test: Likewise.
	* tests/uname.test: Likewise.
	* tests/pread64-pwrite64.test: Do nore remove pread64-pwrite64-tmpfile.
	* tests/read-write.test: Do nore remove read-write-tmpfile.
	* tests/qual_fault.test (check_fault_injection): Do not remove $EXP,
	$outexp, and $outgot.
	* tests/redirect-fds.test (check_fd): Reorder removal of work files.
	* tests/pc.test: Use $EXP instead of $EXPECTED, do not remove it.
	* tests/strace-t.test: Likewise.
	* tests/scm_rights-fd.test: Likewise.  Use dir instead of $LOG.dir,
	do not remove it.
	* tests/strace-ff.test: Do not remove $OUT and $LOG.* files.

2017-04-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: enhance sched.test negative check.
	* tests/sched.test: Test that trace=%sched doesn't match
	anything besides sched_* syscalls by checking it against all test
	executables without side effects listed in pure_executables.list
	except sched_* and times.

2017-04-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add a list of executables without side effects.
	These are executables that could be used by several different tests
	simultaneously.

	* tests/pure_executables.list: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.

2017-04-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use fixed socket address in net-yy-unix.test.
	This allows net-yy-unix invocation without arguments.

	* tests/net-yy-unix.c (TEST_SOCKET): New macro.
	(void): Use it instead of av[1].
	* tests/net-yy-unix.test: Do not specify arguments for the test
	executable.

2017-04-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use fixed socket address in net-y-unix.test.
	This allows net-y-unix invocation without arguments.

	* tests/net-y-unix.c (TEST_SOCKET): New macro.
	(void): Use it instead of av[1].
	* tests/net-y-unix.test: Do not specify arguments for the test
	executable.

2017-04-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: run every test except ksysent.test in its own subdirectory.
	Many test executables create temporary files in the current work
	directory for the duration of their execution.
	This level of test isolation allows more test executables to be invoked
	several times simultaneously.

	* tests/.gitignore: Add *.dir, remove *.log.*, *.tmp, *.tmp-*,
	and *.tmp.* patterns.
	* tests/Makefile.am (clean-local, clean-local-check): New rules.
	(.PHONY): Add clean-local-check.
	(CLEANFILES): Remove all but ksysent.h.
	* tests/init.sh: Strip test-specific prefix from LOG, OUT, and EXP
	variables.  When invoked from a test, create a new test-specific
	directory, chdir into it, and add more ../ prefix to STRACE variable.
	(run_prog): Replace "./" with "../".
	* tests/attach-f-p.test: Replace "./" with "../".
	* tests/attach-p-cmd.test: Likewise.
	* tests/bexecve.test: Likewise.
	* tests/btrfs-v.test: Likewise.
	* tests/btrfs-vw.test: Likewise.
	* tests/btrfs-w.test: Likewise.
	* tests/count.test: Likewise.
	* tests/detach-running.test: Likewise.
	* tests/detach-sleeping.test: Likewise.
	* tests/detach-stopped.test: Likewise.
	* tests/mmap.test: Likewise.
	* tests/net-y-unix.test: Likewise.
	* tests/net-yy-inet.test: Likewise.
	* tests/net-yy-netlink.test: Likewise.
	* tests/net-yy-unix.test: Likewise.
	* tests/net.test: Likewise.
	* tests/opipe.test: Likewise.
	* tests/poll.test: Likewise.
	* tests/prctl-seccomp-strict.test: Likewise.
	* tests/qual_fault-exit_group.test: Likewise.
	* tests/qual_fault.test: Likewise.
	* tests/qual_inject-error-signal.test: Likewise.
	* tests/qual_inject-retval.test: Likewise.
	* tests/qual_inject-signal.test: Likewise.
	* tests/qual_signal.test: Likewise.
	* tests/qual_syscall.test: Likewise.
	* tests/readv.test: Likewise.
	* tests/redirect-fds.test: Likewise.
	* tests/sched.test: Likewise.
	* tests/scm_rights-fd.test: Likewise.
	* tests/seccomp-strict.test: Likewise.
	* tests/strace-C.test: Likewise.
	* tests/strace-E.expected: Likewise.
	* tests/strace-E.test: Likewise.
	* tests/strace-S.test: Likewise.
	* tests/strace-T.test: Likewise.
	* tests/strace-V.test: Likewise.
	* tests/strace-ff.test: Likewise.
	* tests/strace-k.test: Likewise.
	* tests/strace-r.expected: Likewise.
	* tests/strace-r.test: Likewise.
	* tests/strace-t.test: Likewise.
	* tests/strace-tt.test: Likewise.
	* tests/strace-ttt.test: Likewise.
	* tests/sun_path.test: Likewise.
	* tests/uname.test: Likewise.
	* tests/unix-pair-send-recv.test: Likewise.
	* tests/unix-pair-sendto-recvfrom.test: Likewise.

2017-04-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: make test executables invocable outside current work directory.
	Most of test executables were ready for the upcoming change,
	this change prepares all the rest.

	* tests/getdents.c (main): Use fixed name for the sample directory.
	* tests/getdents64.c (main): Likewise.
	* tests/readdir.c (main): Likewise.
	* tests/mknod.c (sample): Change to a pointer.
	(main): Use av[0] as a sample.
	* tests/symlink.c (main): Use av[0] as a linkpath.
	* tests/umode_t.c (sample): Change to a pointer.
	(test_syscall): Fix expected output.
	(main): Use av[0] as a sample.

2017-03-31  Dmitry V. Levin  <ldv@altlinux.org>

	tests: cleanup access.test.
	* tests/access.test: Use run_strace_match_diff.
	* tests/access.c (main): Update expected output.

2017-03-30  Dmitry V. Levin  <ldv@altlinux.org>

	tests: cleanup oldfstat.test.
	* tests/oldfstat.test: Use fstat.test.

2017-03-29  Dmitry V. Levin  <ldv@altlinux.org>

	aarch64: workaround gcc+kernel bug.
	Due to a subtle gcc bug that leads to miscompiled aarch64 kernels,
	the 3rd argument of sched_getattr syscall is not quite 32-bit
	on aarch64 as on other architectures.  For more details see
	https://sourceforge.net/p/strace/mailman/message/35721703/

	* defs.h (print_abnormal_hi): New prototype.
	* util.c (print_abnormal_hi): New function.
	* sched.c (SYS_FUNC(sched_getattr)) [AARCH64]: Use it.
	* tests/sched_xetattr.c (main) [__arm64__ || __aarch64__]: Test it.

2017-03-29  Abhishek Tiwari  <erabhishektiwarics@gmail.com>

	alpha, mips: fix missing flags in stat related compatibility syscalls.
	Following commands do the fix:

	Add TF flag, fixed by:
		git grep -Fl '_stat' linux/*/syscallent* | xargs sed -i \
	  		's/0\(,[[:space:]]*SEN(.*_l\?stat[^i]\)/TF\1/'

	Add TD flag, fixed by:
		git grep -Fl '_stat' linux/*/syscallent* | xargs sed -i \
		  's/0\(,[[:space:]]*SEN(.*_fstat\)/TD\1/'

	* linux/alpha/syscallent.h: Add TF and TD flags to stat related
	compat syscall entries.
	* linux/mips/syscallent-compat.h: Likewise.

2017-03-24  Dmitry V. Levin  <ldv@altlinux.org>

	alpha: fix the number of arguments in alpha specific syscalls.
	* linux/alpha/syscallent.h (getxgid, osf_stat, osf_lstat, osf_fstat,
	osf_sysinfo, sethae): Set nargs according to arch/alpha/kernel/osf_sys.c
	from linux v4.10.

	alpha: update comments about not implemented syscalls.
	* linux/alpha/syscallent.h: Sync "not implemented" comments
	with arch/alpha/kernel/systbls.S from linux v4.10.

2017-03-23  Quentin Monnet  <quentin.monnet@6wind.com>

	Update BPF_MAP_TYPE_* constants.
	* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_ARRAY_OF_MAPS
	and BPF_MAP_TYPE_HASH_OF_MAPS constants.

2017-03-23  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Update ioctl entries from linux v4.11-rc3.
	* linux/32/ioctls_inc_align16.h: Update from linux v4.11-rc3 using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* linux/arm/ioctls_arch0.h: Likewise.
	* linux/i386/ioctls_arch0.h: Likewise.
	* linux/powerpc/ioctls_arch0.h: Likewise.
	* linux/s390/ioctls_arch0.h: Likewise.
	* linux/s390x/ioctls_arch0.h: Likewise.
	* linux/x86_64/ioctls_arch0.h: Likewise.
	* NEWS: Mention this.

	maint: update for linux 4.11.
	* maint/ioctls_sym.sh (ppc_list): Add KVM_PPC_GET_RMMU_INFO
	and KVM_PPC_CONFIGURE_V3_MMU.

2017-03-19  Dmitry V. Levin  <ldv@altlinux.org>

	test: rename README to README.md.
	* test/README: Rename to README.md, turn ../tests reference into an URL.

	test: update README.
	* test/README: Tell the reader what this directory is actually for.

	test: rewrite skodic.c demo.
	* test/skodic.c: Rewrite this demo to simplify its use.

2017-03-18  Victor Krapivensky  <krapivenskiy.va@phystech.edu>

	Implement decoding of statx syscall.
	* linux/i386/syscallent.h [383]: Add statx entry.
	* linux/x32/syscallent.h [332]: Likewise.
	* linux/x86_64/syscallent.h [332]: Likewise.
	* pathtrace.c (pathtrace_match): Handle SEN_statx.
	* statx.c: New file.
	* statx.h: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* tests/.gitignore: Add statx.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add statx.test.
	* tests/statx.c: New file.
	* tests/statx.test: Likewise.
	* tests/xstatx.c: Modify to support statx.
	* xlat/at_statx_sync_types.in: New file.
	* xlat/statx_attrs.in: Likewise.
	* xlat/statx_masks.in: Likewise.
	* NEWS: Mention this change.

2017-03-17  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check for out of bounds fetch in parsers of stat family syscalls.
	* tests/xstatx.c (main): Create STRUCT_STAT object using
	TAIL_ALLOC_OBJECT_CONST_PTR.

	tests: check unexpected syscall errors returned by stat family syscalls.
	* tests/xstatx.c (main) [!OLD_STAT]: Do not skip the test
	in case of EOVERFLOW.
	Treat errors other than ENOSYS and EOVERFLOW as fatal.

2017-03-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: move try_run_prog to init.sh.
	Looks like try_run_prog may be of general use by other syscall class
	tests.

	* tests/sched.test (try_run_prog): Move it...
	* tests/init: ... here.

2017-03-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/sched.test: rc should be a local variable in try_run_prog.
	* tests/sched.test (try_run_prog): Add local rc.

2017-03-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of int 0x80 on x86_64, x32, and x86.
	* tests/int_0x80.c: New file.
	* tests/int_0x80.test: New test.
	* tests/.gitignore: Add int_0x80.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(MISC_TESTS, XFAIL_TESTS_x86_64, XFAIL_TESTS_x32): Add int_0x80.test.
	(XFAIL_TESTS): Add $(XFAIL_TESTS_$(ARCH)).
	(CLEANFILES): Add $(TESTS:=.tmp.out) and $(TESTS:=.tmp.exp).

2017-03-16  Damien Profeta  <damien.profeta@amadeus.com>

	strace-graph: handle pid looping.
	* strace-graph: On long running process or heavily forking one (like
	compilation), it can happen that a parent get 2 different children with
	the same pid.  By tracking the currently runnig pid and adding the start
	timestamp to the pid, the graph can now handle that case.

	Closes: https://github.com/strace/strace/pull/7

2017-03-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use TAIL_ALLOC_OBJECT_CONST_PTR.
	Automatically convert tests to use TAIL_ALLOC_OBJECT_CONST_PTR macro
	with the following sed expression:

	sed -ri \
	's/^([[:space:]]*)(([^*]+[[:alnum:]_])( \*)?) *\*( *const )?([^ =]+) = tail_alloc\(sizeof\((\2|\*\6)\)\);/\1TAIL_ALLOC_OBJECT_CONST_PTR(\2, \6);/' \
	tests/*.c

2017-03-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use TAIL_ALLOC_OBJECT_VAR_PTR.
	Automatically convert tests to use TAIL_ALLOC_OBJECT_VAR_PTR macro
	with the following sed expression:

	sed -ri \
	's/^([[:space:]]*)(([^*]+[[:alnum:]_])( \*)?) *\*([^ =]+) = tail_alloc\(sizeof\((\2|\*\5)\)\);/\1TAIL_ALLOC_OBJECT_VAR_PTR(\2, \5);/' \
	tests/{move_pages,net-sockaddr,sendfile}.c

2017-03-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add TAIL_ALLOC_OBJECT_{CONST,VAR}_PTR to tests.h.
	Introduce a new macros for the most widespread use of tail_alloc.

	* tests/tests.h (TAIL_ALLOC_OBJECT_CONST_PTR,
	TAIL_ALLOC_OBJECT_VAR_PTR): New macros.

2017-03-16  Victor Krapivensky  <krapivenskiy.va@phystech.edu>

	Decode RUSAGE_THREAD.
	* xlat/usagewho.in: Add values for existing entities, add
	RUSAGE_THREAD.
	* tests/getrusage.c: Test decoding of RUSAGE_THREAD.

2017-03-15  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/sched.test: use heredoc in order to avoid spawning of subprocess.
	Pipelined commands executed in subprocesses (some shells have special
	provision for last command in the pipeline, but it is not guaranteed
	and not POSIX), so exit codes of these subprocesses can be lost.
	In order to avoid creating subprocesses, input for read commands
	is better to supply via heredoc and not pipe.

	* tests/sched.test: Move test cases to heredoc.

2017-03-15  Dmitry V. Levin  <ldv@altlinux.org>

	tests: do not skip sched.test if one of its subtests skips.
	* tests/sched.test (try_run_prog): New function.
	Use it instead of run_prog.

2017-03-15  Dmitry V. Levin  <ldv@altlinux.org>

	tests: do not check decoding of setitimer syscall outside xetitimer.test
	xetitimer.test already implements a comprehensive test of setitimer
	syscall parser, no need to duplicate its parts in other tests.

	* tests/clock_nanosleep.c (main): Remove setitimer expected output.
	* tests/nanosleep.c (main): Likewise.
	* tests/clock_nanosleep.test: Remove setitimer from the trace set.
	* tests/nanosleep.test: Likewise.

2017-03-14  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of getitimer and setitimer corner cases.
	* tests/sched_xetattr.c: Include <unistd.h> and <asm/unistd.h>.
	(main): Check that pointer and integer arguments of getitimer
	and setitimer syscalls are decoded properly.
	* tests/xetitimer.test: Add -a option.

2017-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rewrite sigreturn syscall decoding check from match_grep to match_diff
	Unlike the former test that was based on match_grep,
	the new one uses match_diff and does more rigorous testing.

	* tests/sigreturn.c: Rewrite.
	* tests/sigreturn.test: Likewise.

2017-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	ia64, mips, x86_64: remove no longer used parsers of sigreturn syscalls.
	As there is no sigreturn syscall on ia64, mips n32, mips n64, x32,
	and x86_64, no longer used parsers could be safely removed.

	* linux/ia64/arch_sigreturn.c: Remove.
	* Makefile.am (EXTRA_DIST): Remove it.
	* linux/mips/arch_sigreturn.c (arch_sigreturn): Remove [!LINUX_MIPSO32].
	* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Remove.

2017-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	Move sigreturn parser to libstrace.
	All architectures have rt_sigreturn, but only old ones also have
	sigreturn.  Since not all architectures need a parser of sigreturn
	syscall, remove the warning and move the parser to libstrace.

	* Makefile.am (strace_SOURCES): Move sigreturn.c ...
	(libstrace_a_SOURCES): ... here.
	* linux/arch_sigreturn.c: Remove warning.

2017-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of rt_sigreturn syscall.
	* tests/rt_sigreturn.c: New file.
	* tests/rt_sigreturn.test: New test.
	* tests/.gitignore: Add rt_sigreturn.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add rt_sigreturn.test.

	Implement proper decoding of rt_sigreturn syscall.
	* rt_sigreturn.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* linux/dummy.h (sys_rt_sigreturn): Remove.
	* linux/64/syscallent.h (rt_sigreturn): Change sys_func to rt_sigreturn.
	* linux/hppa/syscallent.h (rt_sigreturn): Likewise.
	* linux/ia64/syscallent.h (rt_sigreturn): Likewise.
	* linux/s390/syscallent.h (rt_sigreturn): Likewise.
	* linux/s390x/syscallent.h (rt_sigreturn): Likewise.
	* linux/x86_64/syscallent.h (rt_sigreturn): Likewise.
	* linux/x32/syscallent.h (rt_sigreturn, 64:rt_sigreturn): Likewise.
	* NEWS: Mention this change.

2017-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce get_rt_sigframe_addr function.
	Add get_rt_sigframe_addr function for all supported architectures.
	It is going to be used in a parser of rt_sigreturn syscall.

	* defs.h (get_rt_sigframe_addr): New function prototype.
	* rt_sigframe.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* linux/aarch64/arch_rt_sigframe.c: New file.
	* linux/alpha/arch_rt_sigframe.c: Likewise.
	* linux/arc/arch_rt_sigframe.c: Likewise.
	* linux/arm/arch_rt_sigframe.c: Likewise.
	* linux/avr32/arch_rt_sigframe.c: Likewise.
	* linux/bfin/arch_rt_sigframe.c: Likewise.
	* linux/crisv10/arch_rt_sigframe.c: Likewise.
	* linux/crisv32/arch_rt_sigframe.c: Likewise.
	* linux/hppa/arch_rt_sigframe.c: Likewise.
	* linux/i386/arch_rt_sigframe.c: Likewise.
	* linux/ia64/arch_rt_sigframe.c: Likewise.
	* linux/m68k/arch_rt_sigframe.c: Likewise.
	* linux/metag/arch_rt_sigframe.c: Likewise.
	* linux/microblaze/arch_rt_sigframe.c: Likewise.
	* linux/mips/arch_rt_sigframe.c: Likewise.
	* linux/nios2/arch_rt_sigframe.c: Likewise.
	* linux/or1k/arch_rt_sigframe.c: Likewise.
	* linux/powerpc/arch_rt_sigframe.c: Likewise.
	* linux/powerpc64/arch_rt_sigframe.c: Likewise.
	* linux/riscv/arch_rt_sigframe.c: Likewise.
	* linux/s390/arch_rt_sigframe.c: Likewise.
	* linux/s390x/arch_rt_sigframe.c: Likewise.
	* linux/sh/arch_rt_sigframe.c: Likewise.
	* linux/sh64/arch_rt_sigframe.c: Likewise.
	* linux/sparc/arch_rt_sigframe.c: Likewise.
	* linux/sparc64/arch_rt_sigframe.c: Likewise.
	* linux/tile/arch_rt_sigframe.c: Likewise.
	* linux/x32/arch_rt_sigframe.c: Likewise.
	* linux/x86_64/arch_rt_sigframe.c: Likewise.
	* linux/xtensa/arch_rt_sigframe.c: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.

2017-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce struct_rt_sigframe type.
	Add rt_sigframe.h files with definitions of struct_rt_sigframe type
	for all supported architectures.
	These definitions are going to be used in a parser of rt_sigreturn
	syscall.

	* linux/rt_sigframe.h: New file.
	* linux/bfin/rt_sigframe.h: Likewise.
	* linux/crisv10/rt_sigframe.h: Likewise.
	* linux/crisv32/rt_sigframe.h: Likewise.
	* linux/hppa/rt_sigframe.h: Likewise.
	* linux/i386/rt_sigframe.h: Likewise.
	* linux/ia64/rt_sigframe.h: Likewise.
	* linux/m68k/rt_sigframe.h: Likewise.
	* linux/mips/rt_sigframe.h: Likewise.
	* linux/powerpc64/rt_sigframe.h: Likewise.
	* linux/s390/rt_sigframe.h: Likewise.
	* linux/s390x/rt_sigframe.h: Likewise.
	* linux/sh64/rt_sigframe.h: Likewise.
	* linux/sparc/rt_sigframe.h: Likewise.
	* linux/sparc64/rt_sigframe.h: Likewise.
	* linux/tile/rt_sigframe.h: Likewise.
	* linux/x32/rt_sigframe.h: Likewise.
	* linux/x86_64/rt_sigframe.h: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.

2017-03-13  Victor Krapivensky  <krapivenskiy.va@phystech.edu>

	unwind.c: fix a possible buffer overflow.
	Linux does not prevent a user from creating a lot of nested directories
	with length of the absolute path of the deepest one exceeding PATH_MAX,
	then chdir'ing into it, creating a file there and mmap'ing it. Since the
	length of the prefix preceding the pathname in /proc/[pid]/maps is not
	necessary 80 (it's 73 on my machine), an overflow is possible.

	* unwind.c (build_mmap_cache): Fix a possible buffer overflow.

2017-03-13  Victor Krapivensky  <krapivenskiy.va@phystech.edu>

	util.c: remove a wrong comment.
	4924dbd6d750665cf383b20ab4fd67e48219ab91 modified the return type, but
	not the comment.

2017-03-10  Dmitry V. Levin  <ldv@altlinux.org>

	riscv: export riscv_sp_ptr.
	Export SP register for later use by get_rt_sigframe_addr.

	* linux/riscv/arch_regs.h: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* linux/riscv/arch_regs.c (riscv_sp_ptr): New variable.

2017-03-10  Dmitry V. Levin  <ldv@altlinux.org>

	or1k: export or1k_sp_ptr.
	Export SP register for later use by get_rt_sigframe_addr.

	* linux/or1k/arch_regs.h: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* linux/or1k/arch_regs.c (or1k_sp_ptr): New variable.

2017-03-10  Dmitry V. Levin  <ldv@altlinux.org>

	nios2: export nios2_sp_ptr.
	Export SP register for later use by get_rt_sigframe_addr.

	* linux/nios2/arch_regs.h: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* linux/nios2/arch_regs.c (nios2_sp_ptr): New variable.

2017-03-10  Dmitry V. Levin  <ldv@altlinux.org>

	metag: export metag_sp_ptr.
	Export SP register for later use by get_rt_sigframe_addr.

	* linux/metag/arch_regs.h: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* linux/metag/arch_regs.c (metag_sp_ptr): New variable.

2017-03-10  Dmitry V. Levin  <ldv@altlinux.org>

	avr32: export avr32_sp_ptr.
	Export SP register for later use by get_rt_sigframe_addr.

	* linux/avr32/arch_regs.h: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* linux/avr32/arch_regs.c (avr32_sp_ptr): New variable.

2017-03-10  Dmitry V. Levin  <ldv@altlinux.org>

	arc: export arc_sp_ptr.
	Export SP register for later use by get_rt_sigframe_addr.

	* linux/arc/arch_regs.h: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* linux/arc/arch_regs.c (arc_sp_ptr): New variable.

2017-03-09  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce print_sigset_addr function.
	As the definition of NSIG_BYTES is based on NSIG defined in <signal.h>,
	NSIG_BYTES cannot be used in files that use kernel sigset_t.

	Add another wrapper around print_sigset_addr_len_limit function that
	takes one argument less than print_sigset_addr_len wrapper.  This new
	wrapper is going to be used in cases when the length argument is equal
	to NSIG_BYTES.

	* defs.h (print_sigset_addr): New function prototype.
	* signal.c (print_sigset_addr): New function.
	* linux/alpha/arch_sigreturn.c (arch_sigreturn): Replace
	print_sigset_addr_len with print_sigset_addr.
	* linux/arm/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/crisv10/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/ia64/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/mips/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Likewise.

2017-03-08  Dmitry V. Levin  <ldv@altlinux.org>

	README.md: rework guidelines about sending bug reports.

2017-03-08  Abhishek Tiwari  <erabhishektiwarics@gmail.com>

	Update information on how to build strace from git repository.
	* INSTALL-git.md: Describe how to build strace from git repository.
	* README.md: Add reference to INSTALL-git.md.
	* README-hacking: Likewise.

2017-03-05  Dmitry V. Levin  <ldv@altlinux.org>

	README.md: fix references to in-tree files.
	* README.md: Change references to COPYING and NEWS files from absolute
	to relative.

2017-03-05  Dmitry V. Levin  <ldv@altlinux.org>

	INSTALL: regenerate from install.texi.
	Regenerate INSTALL from install.texi using the following command:
	makeinfo --plaintext install.texi > INSTALL

	* INSTALL: Regenerate from install.texi.

2017-03-05  Dmitry V. Levin  <ldv@altlinux.org>

	install.texi: remove irrelevant sections.
	Remove "Multiple Architectures" and "Particular Systems" sections using
	the following filter script:

	awk '/^@node (Multiple Architectures|Particular Systems)/{skip=1;next}
	/^@node/{skip=0} {if(!skip)print}'

	* install.texi (Multiple Architectures, Particular Systems): Remove.

2017-03-05  Dmitry V. Levin  <ldv@altlinux.org>

	install.texi: import from GNU Autoconf.
	install.texi from GNU Autoconf is the ultimate source of INSTALL file.
	This edition of install.texi has been downloaded from
	https://git.savannah.gnu.org/cgit/autoconf.git/plain/doc/install.texi?id=63f3c78cdb0ccc85751543e387ef2a7252d5f0a2

	* install.texi: Import from GNU Autoconf.

2017-03-05  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Md Haris Iqbal  <haris.phnx@gmail.com>

	Implement -e trace=%sched option for tracing sched_* syscalls.
	Based on the patch by Md Haris Iqbal
	(https://sourceforge.net/p/strace/mailman/message/35111320/)

	linux/*/syscallent.h part is modified automatically by:

	    git grep -Fl 'SEN(sched_' linux/ | xargs sed -i \
	        's/0\(,[[:space:]]*SEN(sched_\)/TSC\1/'

	* sysent.h (TRACE_SCHED): New definition.
	* syscall.c: Alias TSC to TRACE_SCHED around syscallent.h inclusion.
	* linux/32/syscallent.h: Add TSC flag for sched_* sycalls.
	* linux/64/syscallent.h: Likewise.
	* linux/alpha/syscallent.h: Likewise.
	* linux/arm/syscallent.h: Likewise.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/crisv10/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/powerpc64/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/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.
	* qualify.c (lookup_class): Add TRACE_SCHED for "%sched".
	* tests/ksysent.c: Define TSC to 0.
	* tests/nsyscalls.c: Likewise.
	* tests/sched.test: New test.
	* tests/Makefile.am (DECODER_TESTS): Add sched.test.
	* strace.1 (.SS Filtering): Add information about %sched syscall class.
	* NEWS: Mention this change.

2017-03-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add "%" prefix for syscall classes in qualify.
	(as suggested in
	https://www.mail-archive.com/strace-devel@lists.sourceforge.net/msg05147.html )

	In order to move them to a different namespace than syscall names. This is
	already a problem in case of ipc class which shadows ipc syscall.

	Old behaviour is retained in order to preserve backwards compatibility.

	* qualify.c (lookup_class) <syscall_class>: Add %-prefixed class definitions.
	* strace.1 (.SS Filtering): Add information regarding %-prefixed class
	syntax, declare legacy class syntax deprecated.
	* tests/net.test: Update to use %-prefixed syscall class name.
	* tests/netlink_protocol.test: Likewise.
	* tests/qual_fault-exit_group.test: Likewise.
	* tests/qual_syscall.test: Likewise.
	* tests/scm_rights-fd.test: Likewise.
	* tests/sigreturn.test: Likewise.
	* tests/uio.test: Likewise.
	* NEWS: Mention this change.

2017-02-28  Dmitry V. Levin  <ldv@altlinux.org>

	tests: simplify print_time_t.
	* tests/print_time.c (print_time_t): Treat localtime errors as fatal.

2017-02-27  Dmitry V. Levin  <ldv@altlinux.org>

	Update homepage URL.
	* README: Change homepage URL to https://strace.io
	* debian/control: Likewise.
	* strace.spec.in: Likewise.

2017-02-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests: transform print_time_t into print_time_t_nsec.
	* tests/print_time.c (print_time_t): Rename to print_time_t_nsec,
	take second argument and print it.
	* tests/tests.h (print_time_t): Rename to print_time_t_nsec,
	add second argument.
	* tests/utime.c (main): Use print_time_t_nsec instead of print_time_t.
	* tests/xstatx.c (print_stat): Likewise.  Pass nanoseconds
	to print_time_t_nsec instead of printing them.

	tests: use print_time_t in utime.test.
	* tests/utime.c (print_tm): Remove.
	(main): Use print_time_t instead of print_tm.

2017-02-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests: move print_time function to libtests.
	Rename print_time function to print_time_t and move it to libtests.

	* tests/print_time.c: New file.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.
	* tests/tests.h (print_time_t): New prototype.
	* tests/print_time.c (print_time): Remove.
	(print_stat): Replace print_time with print_time_t.

2017-02-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests: macroize printing of atime, mtime, and ctime fields in xstatx.c.
	Introduce a macro for printing similar time related fields.

	* print_struct_stat.c (PRINT_ST_TIME): New macro.
	(print_stat): Use it.

2017-02-26  Dmitry V. Levin  <ldv@altlinux.org>

	print_struct_stat.c: macroize printing of atime, mtime, and ctime fields
	Introduce a macro for printing similar time related fields.

	* print_struct_stat.c (PRINT_ST_TIME): New macro.
	(print_struct_stat): Use it.

2017-02-25  Dmitry V. Levin  <ldv@altlinux.org>

	x32: fix decoding of flags argument of preadv2 and pwritev2 syscalls.
	x32 is the only linux architecture where preadv2 and pwritev2 syscalls
	take 5 arguments instead of 6.

	* io.c (PREADV2_PWRITEV2_FLAGS_ARG_NO): New macro.
	(SYS_FUNC(preadv2), SYS_FUNC(pwritev2)): Use it.
	* linux/x32/syscallent.h (preadv2, pwritev2): Change nargs to 5.
	* NEWS: Mention this fix.
	* tests/preadv2-pwritev2.c (main): Fix invocation of preadv2
	and pwritev2 syscalls on x32.

2017-02-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rewrite ppoll syscall decoding check from match_grep to match_diff
	Unlike the former test that was based on match_grep,
	the new one uses match_diff and does more rigorous testing.

	* tests/ppoll-v.c: New file.
	* tests/ppoll-v.test: New test.
	* tests/ppoll.c: Rewrite.
	* tests/ppoll.test: Likewise.
	* tests/ppoll.expected: Remove.
	* tests/ppoll-v.expected: Remove.
	* tests/.gitignore: Add ppoll-v.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add ppoll-v.test.
	(EXTRA_DIST): Remove ppoll.expected and ppoll-v.expected.

2017-02-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: move get_sigset_size function to libtests.
	* tests/get_sigset_size.c: New file.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.
	* tests/tests.h (get_sigset_size): New prototype.
	* tests/ptrace.c: Do not check for __NR_rt_sigprocmask.
	(main): Use get_sigset_size.
	* tests/signalfd4.c: Do not check for __NR_rt_sigprocmask.
	(get_sigset_size): Remove.

2017-02-19  Dmitry V. Levin  <ldv@altlinux.org>

	sched: enhance decoding of sched_setattr syscall.
	Implement read/write semantics of struct sched_attr.size argument
	of sched_setattr syscall.  Do not print members of struct sched_attr
	besides sched_attr.size when the specified structure size is less than
	the minimal size allowed by the kernel.

	* sched.c (print_sched_attr): Fetch struct sched_attr.size and use it
	as the structure size.  Print struct sched_attr.size only when the
	structure size is less than SCHED_ATTR_MIN_SIZE.
	(SYS_FUNC(sched_setattr)): Call print_sched_attr with zero size
	argument.  Print struct sched_attr.size returned by the kernel
	on exiting syscall in case of E2BIG. Print the last syscall argument
	on exiting syscall.
	(SYS_FUNC(sched_getattr)): Do not call print_sched_attr with zero size
	argument.
	* NEWS: Mention it.
	* tests/sched_xetattr.c (main): Check it.

2017-02-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of sched_[gs]etattr corner cases.
	* tests/sched_xetattr.c (main): Check that integer arguments
	of sched_getattr and sched_setattr syscalls are decoded properly
	by adding a few cases with filled higher 32 bits.
	Check that pointer argument is decoded properly
	on F8ILL_KULONG_SUPPORTED architectures.

2017-02-18  Dmitry V. Levin  <ldv@altlinux.org>

	Move definition of struct sched_attr to a separate header file.
	Avoid multiple defintions of struct sched_attr by creating a separate
	header file with its definition and using it in other places.

	* sched_attr.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* sched.c: Include it.
	(print_sched_attr): Use it.
	* tests/sched_xetattr.c: Include it.
	(main): Use it.

2017-02-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rewrite sched_xetattr.test from match_grep to match_diff.
	Unlike the previous edition of the test that was based on match_grep,
	the new one is match_diff based and does more rigorous testing.

	* tests/adjtimex.c: Include "xlat.h" and "xlat/schedulers.h",
	(sys_sched_getattr, sys_sched_setattr): New functions.
	(main): Use them.  Update expected output.
	* tests/adjtimex.test: Use run_strace_match_diff.

2017-02-17  Dmitry V. Levin  <ldv@altlinux.org>

	Use tprints instead of tprintf in a few more places.
	* bpf.c (bpf_obj_manage, bpf_prog_attach_detach): Replace tprintf
	with tprints for printing strings without format specifiers.
	* dm.c (dm_decode_dm_target_spec): Likewise.
	* mq.c (SYS_FUNC(mq_timedreceive)): Likewise.
	* perf.c (print_perf_event_attr): Likewise.
	* syscall.c (trace_syscall_exiting): Likewise.

2017-02-17  Dmitry V. Levin  <ldv@altlinux.org>

	bpf: update BPF_PROG_ATTACH decoding.
	Implement decoding of BPF_F_ALLOW_OVERRIDE flag of BPF_PROG_ATTACH
	command introduced by linux kernel commit v4.10-rc7-174-g7f67763.

	* configure.ac: Check for union bpf_attr.attach_flags
	instead of union bpf_attr.attach_type.
	* xlat/bpf_attach_flags.in: New file.
	* bpf.c: Include "xlat/bpf_attach_flags.h".
	(bpf_prog_attach_detach): Rename print_attach_bpf_fd argument
	to print_attach.  Add attach_flags field to the structure,
	print it in case of BPF_PROG_ATTACH.
	* tests/bpf.c: Check for HAVE_UNION_BPF_ATTR_ATTACH_FLAGS
	instead of HAVE_UNION_BPF_ATTR_ATTACH_TYPE.
	(prog_cgroup): Initialize attach_flags field.
	(main): Update expected output.

2017-02-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rewrite adjtimex.test from match_grep to match_diff.
	Unlike the previous edition of the test that was based on match_grep,
	the new one is match_diff based and does more rigorous testing.

	* tests/adjtimex.c: Include "xlat.h", "xlat/adjtimex_state.h",
	and "xlat/adjtimex_status.h".
	(main): Update expected output.
	* tests/adjtimex.test: Use run_strace_match_diff.

2017-02-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: replace casts of 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
	* tests/init_delete_module.h (bogus_zero): Remove.
	* tests/delete_module.c (main): Replace bogus_zero and
	(kernel_ulong_t) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
	* tests/finit_module.c (main): Replace bogus_zero
	with F8ILL_KULONG_MASK.
	* tests/init_module.c (main): Likewise.
	* tests/pipe2.c (main): Likewise.
	* tests/epoll_ctl.c (invoke_syscall): Replace
	(unsigned long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
	* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo): Likewise.
	* tests/fanotify_init.c (main): Likewise.
	* tests/xetpgid.c (main): Likewise.
	* tests/xetpriority.c (main): Likewise.
	(kernel_ulong_t) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.
	* tests/fanotify_mark.c (main): Likewise.
	* tests/file_handle.c (main): Likewise.
	* tests/kexec_load.c (main): Likewise.
	* tests/setfsugid.c (main): Likewise.
	* tests/getgroups.c (main): Replace (long) 0xffffffff00000000ULL
	with F8ILL_KULONG_MASK.
	* tests/setgroups.c (main): Replace (long) 0xffffffff00000000ULL
	and (unsigned long) 0xffffffff00000000ULL with F8ILL_KULONG_MASK.

2017-02-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fill higher bits of integer arguments of fcntl* syscalls.
	Check that integer arguments of fcntl and fcntl64 syscalls are decoded
	properly by casting them to kernel_ulong_t and filling higher bits.

	* tests/struct_flock.c (invoke_test_syscall): Cast "fd" and "cmd"
	syscall arguments to kernel_ulong_t, fill their higher 32 bits.

2017-02-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use sprintrc in tests of fcntl and fcntl64 syscalls.
	* tests/struct_flock.c (EINVAL_STR): Remove.
	(test_flock_einval, test_flock): Use sprintrc instead of EINVAL_STR.
	* tests/fcntl.c (test_flock64_einval): Likewise.
	* tests/fcntl64.c (test_flock64_einval, test_flock64): Likewise.

2017-02-15  Dmitry V. Levin  <ldv@altlinux.org>

	Post-release administrivia.
	* NEWS: Add a header line for the next release.
	* debian/changelog.in: Add a changelog entry for 4.16-1.
	* strace.spec.in: Likewise.

2017-02-14  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for 4.16 release.
	* NEWS: Update for 4.16 release.

2017-02-13  Dmitry V. Levin  <ldv@altlinux.org>

	.mailmap: add addresses of JingPiao Chen.
	* .mailmap: Add both addresses of JingPiao Chen here to avoid
	duplications in CREDITS file.

	tests: skip scno tampering tests on compat mips abi.
	* tests/scno_tampering.sh: In case of mips abi, skip the test
	unless it is the native abi.

2017-02-12  Dmitry V. Levin  <ldv@altlinux.org>

	Fix -Werror=duplicate-decl-specifier compilation issues.
	capability.c:82:28: error: duplicate "const" declaration specifier
	capability.c:110:33: error: duplicate "const" declaration specifier
	rt_tgsigqueueinfo.c:42:61: error: duplicate "const" declaration specifier
	utime.c:66:23: error: duplicate "const" declaration specifier
	waitid.c:147:20: error: duplicate "const" declaration specifier

	* capability.c (cap_user_header_t, cap_user_data_t): Remove.
	(get_cap_header): Change return type
	to "const struct user_cap_header_struct *".
	(print_cap_header, print_cap_data): Change the type of last argument
	to "const struct user_cap_header_struct * const".
	(SYS_FUNC(capget)): Change type of "h" variable
	to "const struct user_cap_header_struct *".
	(SYS_FUNC(capset)): Change type of "h" variable
	to "const struct user_cap_header_struct * const".
	* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo): Change the type of last
	argument to "const void *const".
	* tests/utime.c (main): Change the type of "tail_u" variable
	to "const struct utimbuf *const".
	* tests/waitid.c (do_waitid): Change the type of 3rd argument
	to "const siginfo_t *const".

2017-02-12  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rewrite pipe syscall decoding check from match_grep to match_diff
	* configure.ac (AC_CHECK_FUNCS): Remove pipe2.
	* tests/pipe.c: Include <asm/unistd.h>, skip the test if [!__NR_pipe]
	instead of [!HAVE_PIPE2].
	(main): Do not call pipe2.
	* tests/pipe.test: Skip the test if libc pipe wrapper does not use
	pipe syscall, rewrite from match_grep to match_diff.
	* tests/pipe.expected: Update expected output.

2017-02-11  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rewrite pipe2 syscall decoding check from match_grep to match_diff
	Unlike pipe.test that is based on match_grep, the new test
	is based on match_diff and does more rigorous testing.

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

2017-02-10  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rewrite mq.test from match_grep to match_diff.
	Unlike the previous edition of the test that was based on match_grep,
	the new one is match_diff based and does more rigorous testing.

	* tests/mq.c: Include <stdio.h>.
	(NAME): New macro.
	(main): Use it.  Print expected output.
	* tests/mq.expected: Remove.
	* tests/Makefile.am (EXTRA_DIST): Remove mq.expected.
	* tests/mq.test: Use run_strace_match_diff.

2017-02-09  Dmitry V. Levin  <ldv@altlinux.org>

	Simplify struct inject_opts.rval semantics.
	Drop use of INJECT_OPTS_RVAL_DISABLE special inject_opts.rval value,
	INJECT_OPTS_RVAL_DEFAULT is enough.

	* defs.h (INJECT_OPTS_RVAL_DISABLE): Remove.
	* qualify.c (qualify_inject_common): Do not replace
	INJECT_OPTS_RVAL_DEFAULT with INJECT_OPTS_RVAL_DISABLE
	in inject_opts.rval.
	* syscall.c (tamper_with_syscall_entering): Check
	for INJECT_OPTS_RVAL_DEFAULT instead of INJECT_OPTS_RVAL_DISABLE.

2017-02-09  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check signal injection along with fault injection.
	* tests/qual_inject-error-signal.c: New file.
	* tests/qual_inject-error-signal.expected: Likewise.
	* tests/qual_inject-error-signal.test: New test.
	* tests/.gitignore: Add qual_inject-error-signal.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(MISC_TESTS): Add qual_inject-error-signal.test.
	(EXTRA_DIST): Add qual_inject-error-signal.expected.

	tests: simplify qual_inject-signal.test.
	* tests/qual_inject-signal.test: Use $NAME instead of qual_inject-signal.

2017-02-09  Dmitry V. Levin  <ldv@altlinux.org>

	Make symbolic errno values match case-insensitive.
	Follow the example of case-insensitive symbolic signal values in signal
	and inject expressions and make symbolic errno values in inject
	expressions case-insensitive.

	* qualify.c (find_errno_by_name): Use strcasecmp instead of strcmp
	to match symbolic errno values.
	* tests/qual_fault.c (main): Likewise.
	* tests/qual_fault.test: Test case-insensitive symbolic errno match.

2017-02-09  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check case-insensitive symbolic signal match.
	* tests/qual_signal.test: Test case-insensitive symbolic signal match.

2017-02-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update NEWS.

2017-02-08  Dmitry V. Levin  <ldv@altlinux.org>

	Update NEWS.

2017-02-08  Dmitry V. Levin  <ldv@altlinux.org>

	strace.spec.in: fix dist version checks.
	* strace.spec.in: Fix libunwind availability check.

	Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>

2017-02-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests: update ipc_sem.test for new glibc.
	Starting with commit glibc-2.24-553-g40c0a78, glibc may pass NULL
	address to semctl like other libcs.

	* tests/ipc_sem.c (main) [__GLIBC__]: Remove.

2017-02-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix typo in bpf.test.
	* tests/bpf.c (main): Add missing semicolon.

	Fixes: ad427721 ("tests: rewrite bpf.test from match_grep to match_diff")

2017-02-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check signal injection.
	* tests/qual_inject-signal.c: New file.
	* tests/qual_inject-signal.expected: Likewise.
	* tests/qual_inject-signal.test: New test.
	* tests/.gitignore: Add qual_inject-signal.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(MISC_TESTS): Add qual_inject-signal.test.
	(EXTRA_DIST): Add qual_inject-signal.expected.

2017-02-08  Dmitry V. Levin  <ldv@altlinux.org>

	Implement -e inject= option.
	Introduce -e inject= as a general injection option,
	limit -e fault= option to syscall fault injection.

	Change default return code of syscall fault injection to ENOSYS.

	* qualify.c (parse_inject_token): Add fault_tokens_only argument,
	do not accept retval= and signal= tokens when fault_tokens_only
	is set to true.
	(parse_inject_expression): Add fault_tokens_only argument,
	forward it to parse_inject_token.
	(qualify_inject_common): New function.
	(qualify_fault): Use it.
	(qualify_inject): New function.
	(qual_options): New entry.
	* strace.1: Describe -e inject= option.
	* NEWS: Mention -e inject= option.
	* tests/qual_fault-syntax.test: Test that -e fault= option does not
	support retval=, signal=, and multiple error= tokens.
	* tests/qual_fault.c (DEFAULT_ERRNO): Set to ENOSYS unconditionally.
	* tests/qual_inject-retval.test: Replace -e fault= option
	with -e inject= option.
	* tests/qual_inject-syntax.test: New test.
	* tests/Makefile.am (MISC_TESTS): Add it.

2017-02-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests: prepare for introduction of -e inject= option.
	Rename files related to fault injection to avoid further confusion.

	* tests/fault_injection-exit_group.expected: Rename
	to tests/qual_fault-exit_group.expected.
	* tests/fault_injection-exit_group.test: Rename
	to tests/qual_fault-exit_group.test.
	* tests/fault_syntax.test: Rename to tests/qual_fault-syntax.test.
	* tests/fault_injection.c: Rename to tests/qual_fault.c.
	* tests/fault_injection.test: Rename to tests/qual_fault.test.
	* tests/fault_injection-retval.c: Rename to tests/qual_inject-retval.c.
	* tests/fault_injection-retval.test: Rename
	to tests/qual_inject-retval.test.
	* tests/fault_injection.sh: Rename to tests/scno_tampering.sh.
	* tests/.gitignore: Update.
	* tests/Makefile.am (check_PROGRAMS, DECODER_TESTS, MISC_TESTS,
	EXTRA_DIST): Update.

2017-02-08  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for introduction of -e inject= option.
	As -e fault= injection syntax has been extended to configure various
	kinds of injections besides fault injection, the original option name
	bacame too narrow.

	This change renames internal constants, types, and functions from
	"fault" to more generic inject/tamper ones.

	* defs.h (fault_opts): Rename to inject_opts.
	(FAULT_OPTS_RVAL_DEFAULT): Rename to INJECT_OPTS_RVAL_DEFAULT.
	(FAULT_OPTS_RVAL_DISABLE): Rename to INJECT_OPTS_RVAL_DISABLE.
	(struct tcb): Rename fault_vec field to inject_vec.
	(TCB_FAULT_INJ): Rename to TCB_TAMPERED.
	(QUAL_FAULT): Rename to QUAL_INJECT.
	(fault_vec): Rename to inject_vec.
	All users changed.
	* qualify.c (fault_set): Rename to inject_set.
	(parse_fault_token): Rename to parse_inject_token.
	(parse_fault_expression): Rename to parse_inject_expression.
	All callers changed.
	* syscall.c (fault_vec): Rename to inject_vec.
	(tcb_fault_opts): Rename to tcb_inject_opts.
	(inject_syscall_fault_entering): Rename to tamper_with_syscall_entering.
	(update_syscall_fault_exiting): Rename to tamper_with_syscall_exiting.
	(syscall_fault_injected): Rename to syscall_tampered.
	All callers changed.

2017-02-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests: make Makefile.am lists sorted in C locale.
	* tests/Makefile.am (check_PROGRAMS, DECODER_TESTS, MISC_TESTS,
	EXTRA_DIST): Make sorted in C locale.

2017-02-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use ARG_STR in msg_control.test.
	Drop local VAL_STR macro in favour of ARG_STR macro from tests/tests.h.

	* tests/msg_control.c (VAL_STR): Remove.
	(test_sol_socket, test_sol_ip): Replace VAL_STR with ARG_STR.

2017-02-07  Dmitry V. Levin  <ldv@altlinux.org>

	powerpc, powerpc64: wire up new syscalls.
	* linux/powerpc/syscallent.h [382]: Add kexec_file_load entry.
	* linux/powerpc64/syscallent.h [382]: Likewise.

	microblaze: wire up new syscalls.
	* linux/microblaze/syscallent.h [392..397]: New entries.

	avr32: wire up new syscalls.
	* linux/avr32/syscallent.h [328..330]: New entries.

2017-02-06  Dmitry V. Levin  <ldv@altlinux.org>

	Update IPV6_* constants.
	* xlat/sockipv6options.in: Add IPV6_RECVFRAGSIZE introduced
	by linux kernel commit v4.10-rc1~202^2~340^2~1.

	Update IP_* constants.
	* xlat/sockipoptions.in: Add IP_RECVFRAGSIZE introduced
	by linux kernel commit v4.10-rc1~202^2~340^2~2.

2017-02-06  Jacob Goense  <dugo@xs4all.nl>

	or1k: fix build.
	This fixes a typo in the arch_set_success for the or1k architecture.

	* linux/or1k/set_error.c (arch_setsuccess): Rename to arch_set_success.

	Fixes: 41d647c ("Implement success injection")
	Closes: https://github.com/strace/strace/pull/6

2017-02-04  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Update ioctl entries from linux 4.10.
	* linux/32/ioctls_inc_align16.h: Update from linux v4.10 using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* NEWS: Mention this.

	maint: update for linux 4.10.
	* maint/ioctls_sym.sh: Update workaround for linux/if_pppox.h file.

	maint: add workaround for m68k.
	* maint/ioctls_sym.sh: Skip asm/amigayle.h.

2017-01-31  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of bpf corner cases.
	* tests/bpf.c (bogus_bpf): New function.
	(BOGUS_BPF): New macro.
	(main): Use them.
	* tests/bpf.test: Add -a option.

2017-01-29  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rewrite bpf.test from match_grep to match_diff.
	* tests/bpf.c (errstr): New variable.
	(sys_bpf): New function.
	(map_create, map_any, prog_load, obj_manage, prog_cgroup): Use it.
	(main): Update expected output.
	* tests/bpf.test: Use run_strace_match_diff.

	bpf: move common code to a separate function.
	* bpf.c (bpf_prog_attach_detach): New function.
	(bpf_prog_attach, bpf_prog_detach): Use it.

2017-01-29  Quentin Monnet  <quentin.monnet@6wind.com>

	Update bpf syscall decoding.
	Implement decoding of BPF_OBJ_PIN, BPF_OBJ_GET, BPF_PROG_ATTACH,
	and BPF_PROG_DETACH commands.

	* bpf.c: Include "xlat/bpf_attach_type.h".
	(bpf_obj_manage, bpf_prog_attach, bpf_prog_detach): New functions.
	(SYS_FUNC(bpf)): Use them.
	* configure.ac: Check for union bpf_attr.bpf_fd and union
	bpf_attr.attach_type.
	* xlat/bpf_attach_type.in: New file.
	* xlat/bpf_commands.in: Update list of BPF_* command constants.
	* xlat/bpf_map_types.in: Update list of BPF_MAP_TYPE_* constants.
	* xlat/bpf_prog_types.in: Update list of BPF_PROG_TYPE_* constants.
	* tests/bpf.c [HAVE_UNION_BPF_ATTR_BPF_FD] (obj_manage): New function.
	[HAVE_UNION_BPF_ATTR_ATTACH_TYPE] (prog_cgroup): Likewise.
	(main): Use them.

2017-01-28  Elvira Khabirova  <lineprinter0@gmail.com>

	tests: check success injection.
	* tests/fault_injection-retval.c: New file.
	* tests/fault_injection-retval.test: New test.
	* tests/.gitignore: Add fault_injection-retval.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(MISC_TESTS): Add fault_injection-retval.test.

2017-01-28  Elvira Khabirova  <lineprinter0@gmail.com>

	Implement success injection.
	This extends fault injection syntax with :retval= option.
	When :retval=VALUE is specified, the syscall number is replaced by -1
	and a bogus success VALUE is returned to the callee.

	* defs.h (fault_opts): Remove err field, add rval field.
	(MAX_ERRNO_VALUE, FAULT_OPTS_RVAL_DEFAULT, FAULT_OPTS_RVAL_DISABLE):
	New macros.
	* qualify.c (parse_fault_token): Handle retval= token.
	(qualify_fault): Update fault_opts initialization after the move
	from struct fault_opts.err to struct fault_opts.rval.
	* syscall.c (arch_set_success): New prototype.
	(inject_syscall_fault_entering): Check opts->rval instead of opts->err.
	(update_syscall_fault_exiting): Implement retval injection.
	* strace.1: Update the section on fault injection.
	* NEWS: Mention retval= option.
	* linux/aarch64/set_error.c (arch_set_success): New function.
	* linux/alpha/set_error.c: Likewise.
	* linux/arc/set_error.c: Likewise.
	* linux/arm/set_error.c: Likewise.
	* linux/avr32/set_error.c: Likewise.
	* linux/bfin/set_error.c: Likewise.
	* linux/crisv10/set_error.c: Likewise.
	* linux/hppa/set_error.c: Likewise.
	* linux/i386/set_error.c: Likewise.
	* linux/ia64/set_error.c: Likewise.
	* linux/m68k/set_error.c: Likewise.
	* linux/metag/set_error.c: Likewise.
	* linux/microblaze/set_error.c: Likewise.
	* linux/mips/set_error.c: Likewise.
	* linux/nios2/set_error.c: Likewise.
	* linux/or1k/set_error.c: Likewise.
	* linux/powerpc/set_error.c: Likewise.
	* linux/riscv/set_error.c: Likewise.
	* linux/s390/set_error.c: Likewise.
	* linux/sh/set_error.c: Likewise.
	* linux/sh64/set_error.c: Likewise.
	* linux/sparc/set_error.c: Likewise.
	* linux/sparc64/set_error.c: Likewise.
	* linux/tile/set_error.c: Likewise.
	* linux/x86_64/set_error.c: Likewise.
	* linux/xtensa/set_error.c: Likewise.

	Closes: https://github.com/strace/strace/issues/3

2017-01-26  Dmitry V. Levin  <ldv@altlinux.org>

	mips: rewrite configure check without sgidefs.h.
	Use builtin macros provided by gcc >= 3.4 instead of sgidefs.h macros.

	* configure.ac <mips>: Do not include <asm/sgidefs.h>, use _ABIO32
	instead of _MIPS_SIM_ABI32, _ABIN32 instead of _MIPS_SIM_NABI32,
	and _ABI64 instead of _MIPS_SIM_ABI64.

2017-01-20  Elvira Khabirova  <lineprinter0@gmail.com>

	.gitignore: add missing files that should be ignored.
	* .gitignore: Add /ioctl_iocdef.[ih].

	Fixes: 5679fad ("ioctlsort: get ioctl definitions from host, not build")

2017-01-20  Andre McCurdy  <armccurdy@gmail.com>

	mips: use <asm/sgidefs.h>
	Build fix for MIPS with musl libc.

	The MIPS specific header <sgidefs.h> is provided by glibc and uclibc
	but not by musl. Regardless of the libc, the kernel headers provide
	<asm/sgidefs.h> which provides the same definitions, so use that
	instead.

	* configure.ac: Replace <sgidefs.h> with <asm/sgidefs.h>.

2017-01-20  JingPiao Chen  <chenjingpiao@gmail.com>

	Implement decoding of ustat syscall.
	* configure.ac (AC_CHECK_HEADERS): Add ustat.h.
	* ustat.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* linux/dummy.h: Remove sys_ustat.
	* tests/ustat.c: New file.
	* tests/ustat.test: New test.
	* tests/.gitignore: Add ustat.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add ustat.test.

	Makefile.am: allow indented DEF_MPERS_TYPE includes.
	* Makefile.am (m%_type_defs.h): Change sed regular expression to allow
	arbitrary number of whitespace characters between "#" symbol
	and "include" directive.

	strace.1: fix formatting.
	* strace.1: Remove misplaced .TP macros.

2017-01-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests: drop non-USE_ASM_STAT case support.
	With the switch of fstatat family tests to USE_ASM_STAT variant,
	there are no non-USE_ASM_STAT users left.  Remove support of unused
	non-USE_ASM_STAT case.

	* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_mtim.tv_nsec.
	* tests/fstatat.c (USE_ASM_STAT): Remove.
	* tests/fstatx.c: Likewise.
	* tests/lstatx.c: Likewise.
	* tests/xstatx.c: Assume USE_ASM_STAT.
	[!USE_ASM_STAT]: Remove.

2017-01-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests: call newfstatat and fstatat64 syscalls directly.
	Do not use glibc wrappers to call newfstatat and fstatat64.
	These wrappers have various problems, e.g. they segfault on sparc64
	and mips64 if BOGUS_STRUCT_STAT is not disabled, and they do wrong
	conversion of timestamps on mips64.

	* tests/fstatat.c (TEST_SYSCALL_INVOKE): Invoke the relevant syscall
	directly.
	(USE_ASM_STAT): Define.
	* tests/fstatat64.c (TEST_BOGUS_STRUCT_STAT): Remove.
	(STRUCT_STAT, STRUCT_STAT_STR, STRUCT_STAT_IS_STAT64): Define.

	Based on patch by James Cowgill <james410@cowgill.org.uk>.

2017-01-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests: remove redundant SAMPLE_SIZE definitions.
	Remove all definitions of SAMPLE_SIZE that are identical to the fallback
	definition in tests/xstatx.c.

	* tests/fstat64.c (SAMPLE_SIZE): Remove.
	* tests/lstat64.c (SAMPLE_SIZE): Remove.
	* tests/stat64.c (SAMPLE_SIZE): Remove.

2017-01-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests: change SAMPLE_SIZE type to libc_off_t.
	As ftruncate libc function and our create_sample function that calls
	ftruncate both take size argument of type libc_off_t, change the type
	of SAMPLE_SIZE constant to libc_off_t.

	* tests/fstat.c (SAMPLE_SIZE): Cast to libc_off_t.
	* tests/lstat.c (SAMPLE_SIZE): Likewise.
	* tests/oldfstat.c (SAMPLE_SIZE): Likewise.
	* tests/oldlstat.c (SAMPLE_SIZE): Likewise.
	* tests/oldstat.c (SAMPLE_SIZE): Likewise.
	* tests/stat.c (SAMPLE_SIZE): Likewise.
	* tests/xstatx.c (SAMPLE_SIZE): Likewise.

2017-01-13  Alexey Neyman  <stilor@att.net>

	ioctlsort: get ioctl definitions from host, not build.
	When cross-compiling, ioctlsort must obtain _IOC_* values from the
	host, build's values may be incompatible.

	* ioctl_iocdef.c: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	(ioctl_iocdef.i, ioctl_iocdef.h): New rules.
	(ioctlsort%.o): Depend on ioctl_iocdef.h.
	(CLEANFILES): Add ioctl_iocdef.h and ioctl_iocdef.i.
	* ioctlsort.c: Include "ioctl_iocdef.h" instead of <linux/ioctl.h>.

2017-01-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests: treat struct stat mismatch as an error.
	If the test detects struct stat mismatch, this is likely an error
	in definitions of a stat structure that might affect strace as well.
	Fail the test instead of skipping it to attract more attention.

	* tests/xstatx.c (main): Return 1 instead of 77
	in case of struct stat mismatch.

2017-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rewrite diagnostics about struct stat mismatch.
	* tests/xstatx.c (LOG_STAT_OFFSETOF_SIZEOF): New macro.
	(main): Use it to print struct stat mismatch details.

	tests: fix typo in tests/xstatx.c.
	* tests/xstatx.c [!IS_FSTAT]: Define IS_FSTAT instead of IS_STAT.

2017-01-12  JingPiao Chen  <chenjingpiao@gmail.com>

	tests: fix typo in mlock.c.
	* tests/mlock.c [!(__NR_mlock && __NR_munlock)]: Fix spelling
	of SKIP_MAIN_UNDEFINED.

2017-01-12  JingPiao Chen  <chenjingpiao@gmail.com>

	strace: move description of -k option to the appropriate place.
	Follow the example of strace.1 and put the description of -k option
	into the  output format group.

	* strace.c (usage): Move description of -k option to the output
	format group.

2017-01-11  Dmitry V. Levin  <ldv@altlinux.org>

	Remove redundant commas at the end of structure initializers.
	Automatically remove redundant commas using the following
	sed expression:

	git grep -El ',[[:space:]]+}' |xargs sed -ri 's/,([[:space:]]+\})/\1/'

	* linux/32/syscallent.h: Remove redundant commas at the end of structure
	initializers.
	* linux/64/syscallent.h: Likewise.
	* linux/alpha/syscallent.h: Likewise.
	* linux/arm/syscallent.h: Likewise.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/crisv10/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/microblaze/userent.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/powerpc64/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/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.
	* tests/kexec_file_load.c: Likewise.

	Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>

2017-01-10  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of scsi ioctl commands.
	* tests/ioctl_scsi.c: New file.
	* tests/ioctl_scsi.test: New test.
	* tests/.gitignore: Add ioctl_scsi.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add ioctl_scsi.test.

	scsi: implement decoding of all SG_* ioctl commands.
	* print_sg_req_info.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* xlat/sg_scsi_reset.in: New file.
	* scsi.c: Include "xlat/sg_scsi_reset.h".
	(scsi_ioctl): Implement decoding of all SG_* ioctl commands.

	scsi: prepare for decoding of other SG_* ioctl commands.
	* scsi.c (scsi_ioctl): Introduce a switch statement.

	tests: check decoding of ioctl SG_IO v3 commands.
	* tests/ioctl_sg_io_v3.c: New file.
	* tests/ioctl_sg_io_v3.test: New test.
	* tests/.gitignore: Add ioctl_sg_io_v3.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add ioctl_sg_io_v3.test.

	tests: check decoding of ioctl SG_IO v4 commands.
	* tests/ioctl_sg_io_v4.c: New file.
	* tests/ioctl_sg_io_v4.test: New test.
	* tests/.gitignore: Add ioctl_sg_io_v4.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add ioctl_sg_io_v4.test.

2017-01-10  Dmitry V. Levin  <ldv@altlinux.org>

	scsi: add fallback definitions for SG_* ioctl command constants.
	Unfortunately, <scsi/sg.h> from libc does not provide all constants
	recognized by the kernel.

	* xlat/scsi_sg_commands.in: New file.
	* scsi.c: Include "xlat/scsi_sg_commands.h" instead of providing
	a fallback definition of SG_IO.

2017-01-10  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: provide fallback definitions for BSG_FLAG_* constants.
	BSG_FLAG_* constants were introduced later than the header file where
	they are defined.

	* xlat/bsg_flags.in: Add default values for constants.

2017-01-10  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: provide fallback definitions for SG_FLAG_* constants.
	Unfortunately, <scsi/sg.h> from libc does not provide all constants
	recognized by the kernel.

	* xlat/sg_io_flags.in: Add default values for constants.

2017-01-10  Dmitry V. Levin  <ldv@altlinux.org>

	sg_io_v4: print din_resid and dout_resid fields as signed integers.
	* sg_io_v4.c (decode_response): Print din_resid and dout_resid fields
	using %d format.

2017-01-10  Dmitry V. Levin  <ldv@altlinux.org>

	sg_io: cleanup printing of sg_io buffers.
	Turn print_sg_io_buffer into a universal sg_io buffer printer.

	* sg_io_v3.c (print_sg_io_buffer): Add iovec_count argument.
	Call tprint_iov_upto when iovec_count is non-zero.
	(decode_request, decode_response): Do not call tprint_iov_upto directly,
	use print_sg_io_buffer instead.
	* sg_io_v4.c: Likewise.

2017-01-10  Dmitry V. Levin  <ldv@altlinux.org>

	sg_io: decode structures on exiting syscall in case of syserror.
	The SCSI driver, starting with kernel commit v2.6.25-rc1~1230^2~78,
	translates its "struct request.errors" to ioctl errors after
	filling in all the output members of the SG_IO header structure.

	As there is no easy way to tell SCSI layer errors from other syscall
	errors, decode the structure on exiting syscall in case of syserror,
	too.

	* scsi.c (scsi_ioctl): Do not call set_tcb_priv_ulong, use
	get_tcb_priv_data instead of get_tcb_priv_ulong, call decode_sg_io
	unconditionally.
	* sg_io_v3.c (decode_request): Save a copy of struct_sg_io_hdr using
	set_tcb_priv_data.
	(decode_response): Restore it using get_tcb_priv_data.  Print its i/o
	fields when umove call fails.  Pass IOV_DECODE_STR to tprint_iov_upto
	unconditionally.
	* sg_io_v4.c (decode_request): Save a copy of struct sg_io_v4 using
	set_tcb_priv_data.
	(decode_response): Restore it using get_tcb_priv_data.  Print its i/o
	fields when umove call fails.  Pass IOV_DECODE_STR to tprint_iov_upto
	unconditionally.

2017-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	sg_io: reorder printing of fields to follow structure order.
	* sg_io_v4.c (decode_request): Print timeout, flags, and usr_ptr fields
	after dout_xferp field.

	sg_io_v3: print sg_io_hdr.duration field as unsigned integer.
	* sg_io_v3.c (decode_response): Print duration field using %u format.

	sg_io_v3: print msg_status field.
	* sg_io_v3.c (decode_response): Print msg_status field.

	sg_io: print names of array fields and corresponding length fields.
	* sg_io_v3.c (decode_request): Print names of cmd_len, cmdp,
	and dxferp fields.
	(decode_response): Print names of dxferp, sb_len_wr, and sbp fields.
	* sg_io_v4.c (decode_request): Print names of request_len, request,
	dout_xfer_len, and dout_xferp fields.
	(decode_response): Print names of response_len, response,
	and din_xferp fields.

2017-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	sg_io_v3: print status fields using %#x format specifier.
	The formerly used format string %02x led to misleading output as there
	was no clear indication sometimes whether the printed integer was
	decimal or hexadecimal.

	* sg_io_v3.c (decode_response): Print status and masked_status fields
	using %#x format specifier instead of %02x.

2017-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	sg_io_v4: print status fields in a hexadecimal form.
	The tradition is to print scsi status codes in a hexadecimal form.

	* sg_io_v4.c (decode_response): Print driver_status, transport_status,
	and device_status fields using %#x format specifier instead of %u.

2017-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	sg_io_v4: print request_tag and generated_tag fields in hex.
	The tradition is to print scsi tags in a hexadecimal form.

	* sg_io_v4.c (decode_request): Print request_tag field
	using ("%#" PRI__x64) format string.
	(decode_response): Print generated_tag field using ("%#" PRI__x64)
	format string.

2017-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	sg_io_v4: print usr_ptr field in a hexadecimal form.
	As the nature of this field is pointer-like, print it
	in a hexadecimal form.

	* sg_io_v4.c (decode_request): Print usr_ptr field
	using ("%#" PRI__x64) format string.

2017-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	sg_io_v4: do not print spare_in and spare_out fields.
	As the kernel does not touch these fields, there is no use
	to print them.

	* sg_io_v4.c (decode_request): Do not print spare_in field.
	(decode_response): Do not print spare_out field.

2017-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	sg_io: decode struct sg_io_hdr.info and struct sg_io_v4.info.
	Print struct sg_io_hdr.info and struct sg_io_v4.info using printflags.

	* xlat/sg_io_info.in: New file.
	* defs.h (sg_io_info): New xlat prototype.
	* sg_io_v3.c: Include "xlat/sg_io_info.h".
	(decode_response): Print struct_sg_io_hdr.info using printflags.
	* sg_io_v4.c: (decode_response): Print struct sg_io_v4.info
	using printflags.

2017-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	sg_io: decode struct sg_io_hdr.flags and struct sg_io_v4.flags.
	Print struct sg_io_hdr.flags and struct sg_io_v4.flags using printflags.

	* xlat/sg_io_flags.in: New file.
	* sg_io_v3.c: Include "xlat/sg_io_flags.h".
	(decode_request): Print struct_sg_io_hdr.flags using printflags.
	* xlat/bsg_flags.in: New file.
	* sg_io_v4.c: Include "xlat/bsg_flags.h".
	(decode_request): Print struct sg_io_v4.flags using printflags.

2017-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	Mpersify struct sg_io_hdr.
	struct sg_io_hdr contains pointers and therefore has to be mpersified.

	* defs.h (decode_sg_io_v3): Remove prototype.
	* sg_io_v3.c (struct_sg_io_hdr): Typedef to struct sg_io_hdr.
	Mpersify it.
	(decode_sg_io_v3): Wrap into MPERS_PRINTER_DECL.

2017-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	Split scsi.c.
	Move decoders of SG_IO v3 and v4 APIs into separate files,
	compile generic SG_IO decoder unconditionally.

	* sg_io_v3.c: New file.
	* sg_io_v4.c: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* defs.h (decode_sg_io_v3, decode_sg_io_v4): New prototypes.
	* ioctl.c (ioctl_decode): Remove [HAVE_SCSI_SG_H] condition.
	* scsi.c: (print_sg_io_res): Remove.
	(print_sg_io_req): Rename to decode_sg_io, replace print_sg_io_v3_req
	with decode_sg_io_v3, replace print_sg_io_v4_req with decode_sg_io_v4,
	compile uncoditionally.
	(scsi_ioctl): Replace print_sg_io_req and print_sg_io_res
	with decode_sg_io, compile uncoditionally.
	Move [HAVE_SCSI_SG_H] code to sg_io_v3.c.
	Move [HAVE_LINUX_BSG_H] code to sg_io_v4.c.

2017-01-07  Dmitry V. Levin  <ldv@altlinux.org>

	scsi: detect and print changes of interface id.
	* scsi.c (print_sg_io_v3_res): Detect and print changes
	of struct sg_io_hdr.interface_id field between entering and exiting
	syscall.
	(print_sg_io_v4_res): Detect and print changes of struct sg_io_v4.guard
	field between entering and exiting syscall.

	scsi: print field names of all fields being printed.
	* scsi.c (print_sg_io_v3_req): Always print the name
	of struct sg_io_hdr.interface_id field.
	(print_sg_io_v4_req): Always print the name of struct sg_io_v4.guard
	field.
	(print_sg_io_req): Print unknown interface id as an integer.
	(scsi_ioctl): Save interface id on entering syscall and use it
	on exiting syscall.

	scsi: print struct sg_io_hdr.dxfer_direction field name.
	* scsi.c (print_sg_io_v3_req): Print struct sg_io_hdr.dxfer_direction
	field name.

	scsi: print "protocol" and "subprotocol" field names of struct sg_io_v4.
	* scsi.c (print_sg_io_v4_req): Print field names
	of struct sg_io_v4.protocol and struct sg_io_v4.subprotocol.

2017-01-07  Dmitry V. Levin  <ldv@altlinux.org>

	Print hexadecimal integer in error diagnostics using %#x.
	The formerly used format string %x led to misleading output as there was
	no clear indication sometimes whether the printed integer was decimal or
	hexadecimal.

	* aio.c (startup_child, test_ptrace_seize): Print status
	using %#x format specifier instead of %x.

2017-01-07  Dmitry V. Levin  <ldv@altlinux.org>

	aio: print hexadecimal integer using %#x.
	The formerly used format string %x led to misleading output as there was
	no clear indication sometimes whether the printed integer was decimal or
	hexadecimal.

	* aio.c (print_common_flags): Print struct iocb.aio_flags using %#x
	format specifier instead of %x.
	* tests/aio.c (main): Likewise.

2017-01-06  Dmitry V. Levin  <ldv@altlinux.org>

	scsi: rewrite print_sg_io_buffer using printstr_ex(QUOTE_FORCE_HEX)
	As printstr_ex has got QUOTE_FORCE_HEX flag support, there is no need
	to implement it manually any longer.

	* scsi.c (print_uchar): Remove.
	(print_sg_io_buffer): Rewrite using printstr_ex(QUOTE_FORCE_HEX).

2017-01-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	getrandom: print string as hex-escaped.
	Since there is no reason to interpret the value returned by getrandom as
	ASCII string, it makes sense to always print it as a hex-escaped string.

	* getrandom.c (SYS_FUNC(getrandom)): Use printstr_ex instead
	of printstrn, set QUOTE_FORCE_HEX in user_style parameter in order
	to force hex-escaped string formatting.
	* tests/getrandom.test: Remove no longer needed -xx flag as the string
	is always printed in hexadecimal format now.

	Suggested-by: JingPiao Chen <chenjingpiao@gmail.com>

2017-01-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util: add support for forcing printing string as hex-escaped.
	This could be useful in cases when some binary data should not be
	interpreted as an ASCII string, but rather as an array of byte values.

	* defs.h (QUOTE_FORCE_HEX): New macro constant.
	* util.c (quote_string): Enable use_hex when QUOTE_FORCE_HEX is set
	in user_style parameter.

2017-01-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	term: do not abort decoding in case of non-verbose output.
	The case of unset verbose is handled by umoven_or_printaddr, moreover,
	exiting at this point is plain wrong and leads to last argument not
	being printed while it should be.

	* term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize,
	decode_modem_flags): Do not check verbose flags explicitly and do not
	exit early if it is not set.

2017-01-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: skip fault injection tests on hppa if the kernel is too old.
	* tests/fault_injection.sh: Add the minimal kernel version for hppa.

2017-01-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: skip readahead.test on MIPS n64 when built with glibc < 2.25.
	Due to a bug in glibc readahead syscall wrapper on MIPS n64,
	this wrapper cannot be used in readahead.test.

	* tests/readahead.c [HAVE_READAHEAD && LINUX_MIPSN64 && glibc < 2.25]:
	Undefine HAVE_READAHEAD.

	Reported-by: James Cowgill <james410@cowgill.org.uk>

2017-01-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: replace init_magic with fill_memory.
	Use the same fill_memory/fill_memory_ex interface in all affected tests.

	* tests/ioctl_block.c (init_magic): Remove.
	(main): Replace init_magic with fill_memory.
	* tests/ioctl_evdev.c: Likewise.
	* tests/ioctl_v4l2.c: Likewise.
	* tests/ioctl_mtd.c (magic, init_magic): Remove.
	(main): Replace init_magic with fill_memory.
	* tests/ioctl_rtc.c: Likewise.

2017-01-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rewrite ioctl_v4l2 test without reliance on init_magic.
	* tests/ioctl_v4l2.c (cc0, cc1, cc2, cc3, fourcc): New macros.
	(main): Use them.  Rewrite expected output without assumptions
	on any particular magic data.

2017-01-04  Dmitry V. Levin  <ldv@altlinux.org>

	tests: remove redundant casts in fill_memory{,_ex} invocations.
	* tests/ioctl_loop.c (main): Remove redundant casts of fill_memory
	first argument.
	* tests/kexec_load.c (main): Likewise.
	* tests/perf_event_open.c (main): Likewise.
	* tests/quotactl.c (main): Likewise.
	* tests/mq_sendrecv.c (main): Remove redundant casts of fill_memory_ex
	first argument.
	* tests/quotactl-xfs.c (main): Likewise.

2017-01-04  Dmitry V. Levin  <ldv@altlinux.org>

	tests: change the type of fill_memory{,_ex} first argument to void *
	As these functions behave like memset, it's more convenient to have
	the first argument of type void * like memset.

	* tests/fill_memory.c (fill_memory, fill_memory_ex): Change the type
	of first argument from "char *" to "void *".
	* tests/tests.h (fill_memory, fill_memory_ex): Likewise.

2017-01-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check non-verbose decoding of LOOP_* ioctls.
	* tests/ioctl_loop-nv.c: New file.
	* tests/ioctl_loop-nv.test: New test.
	* tests/ioctl_loop.c [!ABBREV] (ABBREV): Define to 0.
	(print_loop_info, print_loop_info64): Handle [ABBREV != 0] case.
	* tests/.gitignore: Add ioctl_loop-nv.
	* tests/Makefile.am (check_PROGRAMS): Likewise.

	tests: add more checks of LOOP_* ioctls decoding.
	* tests/ioctl_loop.c: Include <linux/ioctl.h>.
	(magic, lmagic): Move static constants ...
	(main): ... here.  Change types of magic constants to kernel_ulong_t.
	Add more checks.

2017-01-04  JingPiao Chen  <chenjingpiao@gmail.com>
	    Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of LOOP_* ioctls.
	* tests/ioctl_loop.c: New file.
	* tests/ioctl_loop-v.c: Likewise.
	* tests/ioctl_loop.test: New test.
	* tests/ioctl_loop-v.test: Likewise.
	* tests/.gitignore: Add ioctl_loop and ioctl_loop-v.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add ioctl_loop.test and ioctl_loop-v.test.

2017-01-04  Dmitry V. Levin  <ldv@altlinux.org>

	Drop vsprintf.c.
	Drop custom vfprintf implementation that was disabled by default.
	Apparently nobody tests strace with this vfprintf enabled, otherwise
	multiple uses of format specifiers not supported by this custom vfprintf
	would not left unnoticed.

	The GNU C library is not the only libc available, so those who want
	faster implementations of libc functions are encouraged to try building
	strace with other libc implementations.

	* vsprintf.c: Remove.
	* Makefile.am (strace_SOURCES): Remove vsprintf.c.
	* defs.h (USE_CUSTOM_PRINTF, strace_vfprintf): Remove.
	* strace.c (tprintf): Replace strace_vfprintf with vfprintf.

2017-01-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	loop: remove unnecessary verbose check.
	The verbose flag is responsible for dereferencing of addresses, and it
	is perfectly handled by umove_or_printaddr; moreover, this early exit
	leads to incorrect formatting of last argument.

	* loop.c (loop_ioctl): Do not check verbose flag explicitly and do not
	exit early if it is not set.

2017-01-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	loop: fix lo_encrypt_key field output.
	lo_encrypt_key is a sized string with its size specified by
	lo_encrypt_key_size field, so take lo_encrypt_key_size into account.

	* loop.c (decode_loop_info, decode_loop_info64): Use minimum of
	LO_KEY_SIZE and lo_encrypt_key_size field value as lo_encrypt_key size.

2017-01-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	loop: print lo_encrypt_key_size field of struct loop_info as unsigned.
	It is converted to an unsigned value in kernel (see loop_info64_from_old
	in drivers/block/loop.c), so let's print it that way despite its type.

	* loop.c (decode_loop_info): Print lo_encrypt_key_size as an uint32_t
	value.

2017-01-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add more checks of unknown ioctl command formatting.
	* tests/ioctl.c (main): Additional check for unknown ioctl command
	decoding.
	* tests/ioctl_evdev.c (main): Likewise.
	* tests/ioctl_dm.c: Include <linux/ioctl.h> for _IOC_SIZE and _IOC_NR.
	(main) <dummy_dm_ioctl1, dummy_dm_ioctl2, dummy_dm_arg>: New constants.
	Add more checks for unknown command formatting.

2017-01-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ioctl: do not print explicit 0x prefix and do not specify minimum width.
	Specifying output width for size argument is rather misleading - it can
	be up to 14 bits in size.  The use of explicit "0x" prefix is
	discouraged because 0x0 looks ugly.  Usage of width specification along
	with alternate form flag leads to inconsistent output for 0.
	Let's use just plain %#x qualifiers instead.

	* ioctl.c (ioctl_print_code): Change printf qualifiers for ioctl command
	type, number and size to "%#x".
	* tests/ioctl.c (main): Update expected test output.
	* tests/ioctl_dm.c (main): Likewise.
	* tests/ioctl_evdev.c (main): Likewise.

2017-01-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	loop: fix printing of the reserved field array items.
	They are of char type, so "hh" length modifier should be used (otherwise
	they are printed incorrectly as they are sign extended implicitly when
	passed as printf arguments in case char is a signed type which is true
	for most compilers).

	* loop.c (decode_loop_info): Change "%#x" printf qualifier to "%#hhx"
	in printing routine for array elements of the "reserved" field of
	loop_info structure.

2017-01-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check ioctl(SIOCGIFCONF) decoding.
	* tests/ioctl_sock_gifconf.c: New file.
	* tests/ioctl_sock_gifconf.test: New test.
	* tests/.gitignore: Add ioctl_sock_gifconf.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add ioctl_sock_gifconf.test.

	dm.c: add copyright notice.

2017-01-04  Dmitry V. Levin  <ldv@altlinux.org>

	Add scno.h and syscallent.i to .gitignore files.
	* .gitignore: Add /scno.h and /syscallent.i.
	* tests/.gitignore: Add scno.h and syscallent.i.

2017-01-04  JingPiao Chen  <chenjingpiao@gmail.com>

	tests/.gitignore: add generated files that should be ignored.
	* tests/.gitignore: Replace addkey with add_key, add attach-f-p-cmd.

2017-01-03  Dmitry V. Levin  <ldv@altlinux.org>

	Remove checks of __NR_* availability from strace source code.
	* strace.c: Remove __NR_tkill checks, assume it is always defined.
	* util.c: Remove __NR_process_vm_readv checks and fallback definitions,
	assume it is always defined.

	Include "scno.h" in files that check __NR_* constants.
	* strace.c: Include "scno.h".
	* util.c: Likewise.

	Generate scno.h for use during the build of strace itself.
	* Makefile.am: Include scno.am.
	($(strace_OBJECTS)): New rule.

2017-01-01  Dmitry V. Levin  <ldv@altlinux.org>

	Generate scno.h without invoking a generated executable helper.
	Generate scno.h using only those tools that are available for cross
	build.  This allows to use scno.h during the build of strace itself.

	* scno.am: New file.
	* scno.head: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* tests/generate_scno.c: Remove.
	* tests/.gitignore: Remove generate_scno.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(CLEANFILES): Remove scno.h.
	(scno.h, $(scno_dependants)): Remove rules.
	(scno_dependants): Remove.
	($(objects)): New rule.
	Include ../scno.am.

2017-01-01  Dmitry V. Levin  <ldv@altlinux.org>

	Update all publicly shown copyright year number ranges.
	* COPYING: Update copyright year number range.
	* configure.ac: Likewise.
	* strace.c: Likewise.
	* tests/strace-V.test: Use the current year for the check.

2016-12-31  Dmitry V. Levin  <ldv@altlinux.org>

	defs.h: stop including <asm/unistd.h>
	Limit the number of files where <asm/unistd.h> is included
	to only those few that need it.

	* defs.h: Do not include <asm/unistd.h>.
	* clone.c: Include <asm/unistd.h>.
	* strace.c: Likewise.
	* syscall.c: Likewise.
	* util.c: Likewise.

2016-12-30  Dmitry V. Levin  <ldv@altlinux.org>

	tests: do not use BUILT_SOURCES.
	* tests/Makefile.am (ksysent.$(OBJEXT)): New rule.
	(BUILT_SOURCES): Remove.

2016-12-30  Dmitry V. Levin  <ldv@altlinux.org>

	Fix cross build.
	This fixes cross build regression introduced by commit
	v4.15-39-g605a705a63d533dceb3c2d489468fcd3aed3963c.

	* tests/Makefile.am (BUILT_SOURCES): Remove scno.h
	(objects, scno_dependants): New variables.
	($(scno_dependants)): New rule.

	Reported-by: Joakim Bech <joakim.bech@linaro.org>

2016-12-30  Dmitry V. Levin  <ldv@altlinux.org>

	tests: do not use defs.h and syscall.h.
	* tests/generate_scno.c: Include "tests.h", "sysent.h", <stdio.h>,
	<string.h>, and <asm/unistd.h> instead of "defs.h" and "syscall.h".
	* tests/ksysent.c: Likewise.
	* tests/nsyscalls.c: Include "tests.h", "sysent.h", <errno.h>,
	<stdio.h>, and <unistd.h> instead of "defs.h" and "syscall.h".

	Move definition of struct sysent and trace flags to a separate file.
	* sysent.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h: Include it.
	(struct sysent, TRACE_FILE, TRACE_IPC, TRACE_NETWORK, TRACE_PROCESS,
	TRACE_SIGNAL, TRACE_DESC, TRACE_MEMORY, SYSCALL_NEVER_FAILS,
	STACKTRACE_INVALIDATE_CACHE, STACKTRACE_CAPTURE_ON_ENTER,
	TRACE_INDIRECT_SUBCALL, COMPAT_SYSCALL_TYPES): Remove.

2016-12-29  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Mpersify SIOC* ioctls.
	struct ifreq and struct ifconf are ABI-dependent and should have been
	mpersified.

	* defs.h (sock_ioctl): Remove prototype.
	* sock.c (struct_ifconf, struct_ifreq): New typedefs.
	(DEF_MPERS_TYPE(struct_ifconf), DEF_MPERS_TYPE(struct_ifreq),
	MPERS_DEFS): New includes.
	(print_ifreq, print_ifc_len, print_ifconf_ifreq): Replace struct ifreq
	with struct_ifreq.
	(decode_ifconf): Replace struct ifconf with struct_ifconf, struct ifreq
	with struct_fireq.
	(sock_ioctl): Wrap into MPERS_PRINTER_DECL.

2016-12-29  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	sock: rewrite decode_ifconf.
	* sock.c (decode_ifconf): Rewrite.

2016-12-29  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: update LOOP_* ioctl flags constants.
	* configure.ac (AC_CHECK_DECLS): Add LO_FLAGS_USE_AOPS
	and LO_FLAGS_DIRECT_IO.
	* xlat/loop_flags_options.in: Likewise.  Add default values
	for constants.

2016-12-29  Eugene Syromyatnikov  <evgsyr@gmail.com>

	loop: add fallback definitions for LOOP_* ioctl command constants.
	Since these are architecture-independent and have been added over the
	kernel's lifetime, it makes sense to have these definitions in strace
	itself.

	* xlat/loop_cmds.in: New file.
	* loop.c: Include "xlat/loop_cmds.h".
	(loop_ioctl): Eliminate conditional compilation based on availability
	of LOOP_* constant definitions.

2016-12-29  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: extend syntax.
	* xlat/gen.sh: Implement #stop directive that stops preprocessor
	at the line it has been encountered during the first pass.  This could
	be used, for example, to provide fallback definitions for constants
	without defining xlat tables.

2016-12-29  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	loop: mpersify struct loop_info and loop_ioctl function.
	struct loop_info contains fields of type long, so it definitely should
	have been mpersified.

	* defs.h (loop_ioctl): Remove prototype.
	* loop.c (struct_loop_info): New typedef.
	Include DEF_MPERS_TYPE(struct_loop_info) and MPERS_DEFS.
	(decode_loop_info): Replace struct loop_info with struct_loop_info.
	Cast lo_inode, lo_init[0], and lo_init[1] to kernel_ulong_t and print
	them using appropriate format specifiers.
	(loop_ioctl): Wrap into MPERS_PRINTER_DECL.

2016-12-29  Eugene Syromyatnikov  <evgsyr@gmail.com>

	loop: print lo_device and lo_rdevice fields using print_dev_t.
	* loop.c (decode_loop_info, decode_loop_info64): Use print_dev_t
	for printing lo_device and lo_rdevice fields.

2016-12-29  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	Move device number printing code into a separate routine.
	* print_dev_t.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (print_dev_t): New prototype.
	* dm.c: Do not include <sys/sysmacros.h>.
	(dm_decode_device, dm_print_dev, dm_decode_dm_name_list): Use
	print_dev_t function for printing device numbers.
	* mknod.c: Do not include <sys/sysmacros.h>.
	(decode_mknod): Use print_dev_t function for printing device number.
	* print_struct_stat.c: Do not include <sys/sysmacros.h>.
	(print_struct_stat): Use print_dev_t function for printing device
	numbers.

2016-12-28  Dmitry V. Levin  <ldv@altlinux.org>

	tests: enhance invalid address decoding check in seccomp-strict.test.
	* tests/seccomp-strict.c (main): Change the type of addr variable
	containg the invalid address from unsigned long to kernel_ulong_t,
	print it using %#llx format.

2016-12-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of prctl PR_GET_TID_ADDRESS operation.
	* tests/prctl-tid_address.c: New file.
	* tests/prctl-tid_address.test: New test.
	* tests/.gitignore: Add prctl-tid_address.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add prctl-tid_address.test.

2016-12-28  Dmitry V. Levin  <ldv@altlinux.org>

	Update the publicly shown copyright information.
	Set the publicly shown copyright holder to "The strace developers.".

	* COPYING: Update copyright information.
	* configure.ac: Add AC_COPYRIGHT.
	* strace.c (print_version): New function.
	(init): Use it.
	* tests/strace-V.test: Update expected output.

2016-12-28  Dmitry V. Levin  <ldv@altlinux.org>

	configure: specify project URL.
	* configure.ac (AC_INIT): Add URL.

2016-12-28  Seraphime Kirkovski  <kirkseraph@gmail.com>

	Document signal injection.
	* strace.1: Describe :signal=SIG option of the fault injection syntax.
	* NEWS: Mention signal injection.

2016-12-28  Seraphime Kirkovski  <kirkseraph@gmail.com>

	Implement signal injection.
	This extends the fault injection capability with :signal=SIG option
	which injects a signal on entering each syscall from the specified set.

	:signal and :error options are complementary, if they are both specified
	the syscall will be fault injected as usual and the specified signal
	will be delivered to the tracee.

	* defs.h (struct fault_opts): Change the type of err field to int16_t,
	add signo field.
	(trace_syscall): Add a pointer argument.
	* qualify.c: Include "nsig.h".
	(parse_fault_token): Handle signal= option.
	(qualify_fault): Update default fault_opts.
	* strace.c (trace): Forward signal number from trace_syscall
	to ptrace_restart(PTRACE_SYSCALL).
	* syscall.c (inject_syscall_fault_entering): Add pointer argument,
	save there the signal number specified by fault options.  Do not inject
	a syscall fault unless instructed by fault options.
	(update_syscall_fault_exiting): Update the error code injection check.
	(trace_syscall_entering): Add pointer argument, forward it to
	inject_syscall_fault_entering.
	(trace_syscall): Add pointer argument, forward it to
	trace_syscall_entering.

2016-12-28  Dmitry V. Levin  <ldv@altlinux.org>

	Update README.md.
	* README.md: Update homepage URL, mention command-line interface
	and tampering capabilities in the description.

2016-12-28  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify prctl-arg2-intptr.test.
	Robustify prctl-arg2-intptr.test against unrelated prctl invocations.

	* tests/prctl-arg2-intptr.test: Filter out unrelated PR_GET_*
	and PR_SET_* prctl calls.

2016-12-27  Dmitry V. Levin  <ldv@altlinux.org>

	signal: remove redundant checks around NSIG.
	* signal.c (struct old_sigaction, struct new_sigaction,
	struct new_sigaction32): Remove safety checks for NSIG >= sizeof(long).

	Introduce NSIG_BYTES.
	* nsig.h (NSIG_BYTES): New macro.
	* desc.c: Use it in comments instead of NSIG.
	* epoll.c: Likewise.
	* poll.c: Likewise.
	* signalfd.c: Likewise.
	* signal.c: Likewise.
	(sprintsigmask_n, print_sigset_addr_len_limit): Use it instead of NSIG.
	* linux/alpha/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/arm/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/crisv10/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/ia64/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/m68k/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/mips/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/powerpc/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/s390/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/sparc/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Likewise.
	* tests/pselect6.c (main): Likewise.

	Move NSIG ifdefery to a separate header file.
	* nsig.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* signal.c: Include "nsig.h" instead of <signal.h>, remove
	NSIG workarounds.
	* sigreturn.c: Likewise.
	* syscall.c: Likewise.
	* tests/pselect6.c: Likewise.

	Introduce ANY_WORDSIZE_LESS_THAN_KERNEL_LONG macro.
	* defs.h (ANY_WORDSIZE_LESS_THAN_KERNEL_LONG): New macro.
	(truncate_klong_to_current_wordsize,
	truncate_kulong_to_current_wordsize): Use it.
	* mem.c (SYS_FUNC(old_mmap)): Likewise.
	* util.c (umoven, umovestr, dumpiov_upto): Likewise.
	* syscall.c (trace_syscall_exiting): Likewise.

	Simplify personality checks in msghdr.c and signal.c.
	* msghdr.c: Check for [!current_wordsize] instead
	of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4].
	* signal.c: Likewise.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	Replace widen_to_long with truncate_klong_to_current_wordsize.
	* defs.h (widen_to_long): Remove.
	(truncate_klong_to_current_wordsize): New static inline function.
	* aio.c (SYS_FUNC(io_submit), SYS_FUNC(io_getevents): Use it
	instead of widen_to_long.
	* linux/sparc64/get_syscall_args.c (get_syscall_args): Update comment.
	* linux/x86_64/get_syscall_args.c (get_syscall_args): Likewise.

	Replace widen_to_ulong with truncate_kulong_to_current_wordsize.
	* defs.h (widen_to_ulong): Remove.
	(truncate_kulong_to_current_wordsize): New static inline function.
	* io.c (do_preadv, do_pwritev): Use it instead of widen_to_ulong.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	Simplify print_lld_from_low_high_val ifdefery.
	The demise of HAVE_STRUCT_TCB_EXT_ARG opens the way for a simpler
	implementation.

	* io.c (print_lld_from_low_high_val): Merge [SIZEOF_LONG > 4
	&& SIZEOF_LONG == SIZEOF_LONG_LONG]
	and [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] cases
	into a single [SIZEOF_KERNEL_LONG_T > 4] case.
	[SIZEOF_KERNEL_LONG_T == 4]: Use direct casts to long long
	instead of zero_extend_signed_to_ull.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	Simplify getllval ifdefery.
	The demise of HAVE_STRUCT_TCB_EXT_ARG opens the way for a simpler
	implementation.

	* util.c (getllval): Merge [SIZEOF_LONG > 4
	&& SIZEOF_LONG == SIZEOF_LONG_LONG]
	and [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] cases
	into a single [SIZEOF_KERNEL_LONG_T > 4] case.

2016-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	prctl: print pointer returned by PR_GET_TID_ADDRESS as kernel long.
	Since there is no compat handler for x32/n32, kernel returns kernel's
	long as a result of the call.

	Interesting, does any callee out there actually care to have enough room
	allocated for kernel long?

	* prctl.c (SYS_FUNC(prctl)): Use printnum_kptr instead of printnum_ptr
	to print the value stored at address pointed by addr2 argument
	of PR_GET_TID_ADDRESS operation.

2016-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add functions for printing pointers of kernel_ulong_t size.
	In cases where no compat for x32/n32 is implemented, pointer is of
	kernel's long size, so it should be printed appropriately.

	* defs.h [!current_klongsize] (printnum_addr_klong_int): New prototype.
	(printnum_kptr): New macro.
	* util.c [!current_klongsize] (printnum_addr_klong_int): New function.

2016-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	Print indirect pointers as pointers.
	Originally, printnum_long_int was used, but it prints NULL incorrectly.

	* defs.h (DECL_PRINTNUM_ADDR): New macro.
	(DECL_PRINTNUM_ADDR(int), DECL_PRINTNUM_ADDR(int64)): New prototypes.
	[!current_wordsize] (printnum_addr_long_int): New prototype.
	[!current_wordsize] (printnum_ptr): Use it.
	[current_wordsize > 4] (printnum_ptr): Use printnum_addr_int64.
	[current_wordsize == 4] (printnum_ptr) Use printnum_addr_int.
	* util.c (DEF_PRINTNUM_ADDR): New macro.
	(DEF_PRINTNUM_ADDR(int, unsigned int),
	DEF_PRINTNUM_ADDR(int64, uint64_t)): New macro instantiations that
	provide printnum_addr_int and printnum_addr_int64, accordingly.
	[!current_wordsize] (printnum_addr_long_int): New function.
	* xet_robust_list.c (sprintaddr): New function.
	(main): Use it, update expected output.
	* tests/ipc_sem.c (main): Update expected output.

2016-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ipc_sem: print 4th argument of semctl syscall as an address.
	* ipc_sem.c (SYS_FUNC(semctl)): Print 4th argument using printaddr.
	* tests/ipc_sem.c (cleanup): Update expected output.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	Do not define printnum_long_int on systems with constant current_wordsize
	* defs.h: Check [!current_wordsize] instead
	of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] to select
	definitions of printnum_slong, printnum_ulong, and printnum_ptr.
	* util.c: Check [!current_wordsize] instead
	of [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] to decide
	whether to compile printnum_long_int.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	umoven: detect invalid addresses.
	Do not silently truncate tracee addresses to current_wordsize.
	After transition from long to kernel_ulong_t there should be no sign
	extension issues with tracee addresses, and invalid addresses should
	be printed properly.

	* util.c (umoven): Check [SIZEOF_KERNEL_LONG_T > 4] instead
	of [SIZEOF_LONG > 4], reject addresses that do not fit into
	current_wordsize.
	* tests/umoven-illptr.c: New file.
	* tests/umoven-illptr.test: New test.
	* tests/.gitignore: Add umoven-illptr.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add umoven-illptr.test.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	umovestr: detect invalid addresses.
	Do not silently truncate tracee addresses to current_wordsize.
	After transition from long to kernel_ulong_t there should be no sign
	extension issues with tracee addresses, and invalid addresses should
	be printed properly.

	* util.c (umovestr): Check [SIZEOF_KERNEL_LONG_T > 4] instead
	of [SIZEOF_LONG > 4], reject addresses that do not fit into
	current_wordsize.
	* tests/umovestr-illptr.c: New file.
	* tests/umovestr-illptr.test: New test.
	* tests/.gitignore: Add umovestr-illptr.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add umovestr-illptr.test.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	lseek: simplify _llseek syscall decoder.
	After transition from long to kernel_ulong_t the implementation
	could be made a bit simpler.

	* lseek.c (SYS_FUNC(llseek)): Use direct cast to long long instead
	of zero_extend_signed_to_ull.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	lseek: merge two different implementations of lseek syscall decoder.
	After transition from long to kernel_ulong_t there are no mo
	complications that required to keep a separate implementation
	for x32 and mips n32.

	* lseek.c (SYS_FUNC(lseek)): Merge two different implementations
	into a single one.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	Remove HAVE_STRUCT_TCB_EXT_ARG, ext_arg, and u_lrval.
	After transition from long to kernel_ulong_t these fields
	are no longer needed.

	* defs.h (HAVE_STRUCT_TCB_EXT_ARG): Remove.
	(struct tcb) [HAVE_STRUCT_TCB_EXT_ARG]: Remove.
	[HAVE_STRUCT_TCB_EXT_ARG]: Remove.
	(RVAL_MASK): Update.
	* io.c (print_lld_from_low_high_val): Check
	[SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
	instead of [HAVE_STRUCT_TCB_EXT_ARG].
	Use u_arg instead of ext_arg.
	* linux/mips/get_error.c (get_error) [LINUX_MIPSN32]: Remove.
	* linux/mips/get_syscall_args.c (get_syscall_args) [LINUX_MIPSN32]:
	Remove.
	[LINUX_MIPSN64]: Extend to [LINUX_MIPSN32].
	* linux/x86_64/get_error.c (get_error) [X32]: Remove.
	* linux/x86_64/get_syscall_args.c (get_syscall_args) [X32]: Remove.
	* lseek.c: Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
	instead of [HAVE_STRUCT_TCB_EXT_ARG].
	[SIZEOF_KERNEL_LONG_T > SIZEOF_LONG] (SYS_FUNC(lseek)): Use u_arg
	instead of ext_arg.  Use RVAL_UDECIMAL instead of RVAL_LUDECIMAL.
	* mem.c (SYS_FUNC(mmap)): Pass offset syscall argument directly
	to print_mmap.
	* syscall.c (trace_syscall_exiting) [HAVE_STRUCT_TCB_EXT_ARG]: Remove.
	* times.c (SYS_FUNC(times)): Use RVAL_UDECIMAL instead
	of RVAL_LUDECIMAL.
	* util.c (getllval): Check [SIZEOF_KERNEL_LONG_T > SIZEOF_LONG]
	instead of [HAVE_STRUCT_TCB_EXT_ARG].  Use u_arg instead of ext_arg.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	Remove getarg_klu.
	After transition from long to kernel_ulong_t we no longer need
	tcp->ext_arg, and therefore a function to access it is also no longer
	needed.

	* defs.h (getarg_klu): Remove prototype.
	* util.c (getarg_klu): Remove.
	(printargs): Access tcp->u_arg directly
	* bjm.c (SYS_FUNC(init_module)): Likewise.
	* clone.c (SYS_FUNC(unshare)): Likewise.
	* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
	* kcmp.c (SYS_FUNC(kcmp)): Likewise.
	* kexec.c (SYS_FUNC(kexec_file_load)): Likewise.
	* keyctl.c (SYS_FUNC(keyctl)): Likewise.
	* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
	* mem.c (do_mprotect): Likewise.
	* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
	* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
	* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
	Likewise.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	Remove printaddr_klu.
	After transition from long to kernel_ulong_t we no longer need
	two versions of printaddr function.

	* defs.h (printaddr): Remove.
	(printaddr_klu): Rename to printaddr.
	* util.c (printaddr_klu): Likewise.
	* bjm.c (SYS_FUNC(init_module)): Replace printaddr_klu with printaddr.
	* mem.c (do_mprotect): Likewise.

2016-12-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of a subset of prctl operations.
	Check decoding of prctl operations that take the second syscall argument
	as a pointer to an integer.

	* tests/prctl-arg2-intptr.c: New file.
	* tests/prctl-arg2-intptr.test: New test.
	* tests/.gitignore: Add prctl-arg2-intptr.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add prctl-arg2-intptr.test.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	Automatically replace PRI_kr[dux] with PRI_kl[dux]
	Remove temporary macros created for transition from long
	to kernel_ulong_t.

	Automatically replace PRI_kr[dux] with PRI_kl[dux] using
	$ git grep -l 'PRI_kr[dux]' | xargs sed -ri 's/PRI_kr([dux])/PRI_kl\1/g'

	* defs.h (PRI_krd, PRI_kru, PRI_krx): Remove.  All users updated.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	Automatically replace kernel_(scno|ureg)_t with kernel_ulong_t.
	Remove temporary types created for transition from long
	to kernel_ulong_t.

	Automatically replace kernel_scno_t and kernel_ureg_t with
	kernel_ulong_t using
	$ git grep -El 'kernel_(scno|ureg)_t' |
	  xargs sed -ri 's/kernel_(scno|ureg)_t/kernel_ulong_t/g'

	* kernel_types.h (kernel_scno_t, kernel_ureg_t): Remove.
	All users updated.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	Redirect kernel_ureg_t and kernel_scno_t from unsigned long to kernel_ulong_t
	* defs.h (struct tcb): Change u_rval type from long to kernel_long_t.
	(PRI_krd, PRI_kru, PRI_krx): Redirect to PRI_kld, PRI_klu, and PRI_klx.
	* kernel_types.h (kernel_scno_t, kernel_ureg_t): Redirect
	to kernel_ulong_t.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	Print kernel_ureg_t and kernel_scno_t using dedicated format strings.
	Prepare for the change of kernel_ureg_t and kernel_scno_t from
	unsigned long to kernel_ulong_t.

	* defs.h (PRI_krd, PRI_kru, PRI_krx): New temporary macros.
	All users updated.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	vm_read_mem: detect address truncation.
	When sizeof(kernel_ureg_t) > sizeof(long), the tracee address passed
	to vm_read_mem could be silently truncated.  Detect this situation
	and return EIO when the tracee address does not fit into unsigned long.

	* util.c (vm_read_mem): Save raddr argument into a temporary variable
	truncated_raddr of type unsigned long.  Set errno to EIO and return -1
	when truncated_raddr does not equal to raddr.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	trace_syscall_exiting: prepare personality check for u_rval type change.
	* syscall.c (trace_syscall_exiting): Check for sizeof(tcp->u_rval)
	instead of sizeof(long) when deciding how to print tcp->u_rval.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	Use ptr_to_kulong instead of explicit casts of pointers to kernel_ureg_t
	Direct casts to kernel_ureg_t will not work after the change
	of kernel_ureg_t from unsigned long to kernel_ulong_t.

	* defs.h (ptr_to_kulong): New macro.
	* block.c (print_blkpg_req): Use it instead of explicit casts
	to kernel_ureg_t.
	* btrfs.c (btrfs_ioctl): Likewise.
	* evdev.c (ff_effect_ioctl): Likewise.
	* mmsghdr.c (dumpiov_in_mmsghdr): Likewise.
	* msghdr.c (print_struct_msghdr, dumpiov_in_msghdr): Likewise.
	* mtd.c (decode_mtd_oob_buf): Likewise.
	* printsiginfo.c (printsigval, print_si_info): Likewise.
	* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res): Likewise.
	* sigaltstack.c (print_stack_t): Likewise.
	* sock.c (decode_ifconf): Likewise.
	* sysctl.c (SYS_FUNC(sysctl)): Likewise.
	* util.c (dumpiov_upto): Likewise.
	* v4l2.c (print_v4l2_framebuffer, print_v4l2_ext_control,
	print_v4l2_ext_controls): Likewise.

2016-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	umove*: remove redundant casts.
	* util.c (umoven, umovestr): Remove casts from unsigned long to pointer.

	upoke: remove redundant casts.
	* upoke.c (upoke): Remove casts from unsigned long to pointer.

2016-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	signal: cleanup decoding of sa_handler and sa_restorer.
	Change type of sa_handler and sa_restorer fields from function pointers
	to unsigned long.  This saves the code from a lot of casts between
	pointers and integers.

	Rename __sa_handler to sa_handler__ as names starting with underscore
	symbol are reserved and should not be used.

	* signal.c (old_sigaction): Rename __sa_handler to sa_handler__,
	all users updated.  Change the type of sa_handler__ and sa_restorer
	from pointer to unsigned long.
	(old_sigaction32): Rename __sa_handler to sa_handler__, all users
	updated.
	(decode_old_sigaction): Remove now redundant casts from
	old_sigaction32.sa_handler__ to old_sigaction.sa_handler__,
	from old_sigaction32.sa_restorer to old_sigaction.sa_restorer,
	and from old_sigaction.sa_handler__ to unsigned long.  Print
	old_sigaction.sa_restorer using printaddr.
	* signal.c (new_sigaction): Rename __sa_handler to sa_handler__,
	all users updated.  Change the type of sa_handler__ and sa_restorer
	from pointer to unsigned long.
	(new_sigaction32): Rename __sa_handler to sa_handler__, all users
	updated.
	(decode_new_sigaction): Remove now redundant casts from
	new_sigaction32.sa_handler__ to new_sigaction.sa_handler__,
	from new_sigaction32.sa_restorer to new_sigaction.sa_restorer,
	and from new_sigaction.sa_handler__ to unsigned long.  Print
	new_sigaction.sa_restorer using printaddr.

2016-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	signal: change signal handler address type from unsigned long to kernel_ureg_t
	* signal.c (get_sa_handler_str, print_sa_handler): Change handler type
	from unsigned long to kernel_ureg_t.

	quota: change address argument type from unsigned long to kernel_ureg_t.
	* quota.c (decode_cmd_data): Change the type of data argument
	from unsigned long to kernel_ureg_t.

	execve: prepare for handling big pointers.
	* execve.c (printargv): Change cp.p64 type from unsigned long
	to kernel_ulong_t so it could handle wordsize > sizeof(long) properly.

2016-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	clone: print clone flags without truncation.
	The flags argument is defined in kernel as unsigned long,
	so change its decoding to avoid truncation.

	* clone.c (SYS_FUNC(clone)): Change flags type from unsigned long
	to kernel_ureg_t, print it using printflags64 instead of printflags.

2016-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	Use printxval64 instead of printxval_long.
	After the change of tcb.u_arg type from long to kernel_ureg_t it is safe
	to stop using printxval_long proxy and pass syscall arguments directly
	to printxval64.

	* defs.h (printxval_long): Remove.
	* fcntl.c (print_fcntl): Replace printxval_long with printxval64.
	* mtd.c (mtd_ioctl): Likewise.
	* numa.c (SYS_FUNC(mbind)): Likewise.
	* or1k_atomic.c [OR1K] (SYS_FUNC(or1k_atomic)): Likewise.
	* sysmips.c [MIPS] (SYS_FUNC(sysmips)): Likewise.
	* term.c (term_ioctl): Likewise.

2016-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	Use printflags64 instead of printflags_long.
	After the change of tcb.u_arg type from long to kernel_ureg_t it is safe
	to stop using printflags_long proxy and pass syscall arguments directly
	to printflags64.

	* defs.h (printflags_long): Remove.
	* fcntl.c (print_fcntl): Replace printflags_long with printflags64.
	* numa.c (SYS_FUNC(get_mempolicy)): Likewise.
	* perf.c (SYS_FUNC(perf_event_open)): Likewise.
	* sram_alloc.c [BFIN] (SYS_FUNC(sram_alloc)): Likewise.

2016-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	upeek, upoke: change argument types from long to unsigned long.
	* defs.h (upeek, upoke): Change offset argument type from long
	to unsigned long.  Change res argument type from long to kernel_ureg_t.
	* upeek.c (upeek): Likewise.
	* upoke.c (upoke.c): Likewise.
	* syscall.c (print_pc) [ARCH_PC_PEEK_ADDR]: Change pc type from long
	to kernel_ureg_t.
	* linux/aarch64/arch_regs.c (arm_sp_ptr): Remove redundant cast.
	* linux/metag/get_syscall_args.c (get_syscall_args): Likewise.
	* linux/sh/get_syscall_result.c (get_syscall_result_regs): Likewise.
	* linux/sh64/get_syscall_result.c (get_syscall_result_regs): Likewise.
	* linux/powerpc/getregs_old.c (getregs_old): Remove redundant casts.
	* linux/alpha/arch_getrval2.c (getrval2): Change r20 type from long
	to unsigned long.
	* linux/alpha/arch_regs.c (alpha_r0, alpha_a3): Change type from long
	to unsigned long.
	* linux/bfin/arch_regs.c (bfin_r0): Likewise.
	* linux/crisv10/arch_regs.c (cris_r10): Likewise.
	* linux/hppa/arch_regs.c (hppa_r28): Likewise.
	* linux/ia64/arch_regs.c (IA64_PSR_IS): Likewise.
	* linux/microblaze/arch_regs.c (microblaze_r3): Likewise.
	* linux/sh/arch_regs.c (sh_r0): Likewise.
	* linux/sh64/arch_regs.c (sh64_r9): Likewise.
	* linux/xtensa/arch_regs.c (xtensa_a2): Likewise.
	* linux/alpha/arch_sigreturn.c (arch_sigreturn): Change addr type
	from long to unsigned long.
	* linux/microblaze/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/alpha/get_scno.c (arch_get_scno): Update for the change
	of signedness.
	* linux/arc/get_syscall_args.c (get_syscall_args): Change arc_args type
	from pointer to long to pointer to unsigned long.
	* linux/arm/arch_regs.c (arm_sp_ptr): Change type from pointer to long
	to pointer to unsigned long.
	* linux/arm/arch_regs.h (arm_sp_ptr): Likewise.
	* linux/i386/arch_regs.c (i386_esp_ptr): Likewise.
	* linux/i386/arch_regs.h (i386_esp_ptr): Likewise.
	* linux/m68k/arch_regs.c (m68k_usp_ptr): Likewise.
	* linux/m68k/arch_regs.h (m68k_usp_ptr): Likewise.
	* linux/ia64/get_syscall_args.c (get_syscall_args): Use umove
	instead of umoven.
	* linux/sh/arch_getrval2.c (getrval2): Change val type from long
	to unsigned long.

	arch_sigreturn: change tracee address type from long to unsigned long.
	* linux/arm/arch_sigreturn.c (arch_sigreturn): Change addr variable
	type from long to unsigned long.
	* linux/ia64/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/m68k/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/powerpc/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/s390/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/sparc/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/tile/arch_sigreturn.c (arch_sigreturn): Likewise.
	* linux/crisv10/arch_sigreturn.c (arch_sigreturn): Change the type
	of addr and regs variables from long to unsigned long.
	* linux/mips/arch_sigreturn.c (arch_sigreturn): Change addr variable
	type from long to kernel_ureg_t.
	* linux/x86_64/arch_sigreturn.c (arch_sigreturn): Change the type
	of offset and addr variables from long to kernel_ureg_t.

	kexec: change flags type from unsigned long to kernel_ureg_t.
	* kexec.c (SYS_FUNC(kexec_load)): Change n variable type
	from unsigned long to kernel_ureg_t.  Use printxval64 instead
	of printxval_long.  Use printflags64 instead of printflags_long.

	kexec: change types of pointers and sizes to kernel_ureg_t.
	* kexec.c (print_seg): Change the type of *seg and seg_buf variables
	from unsigned long to kernel_ureg_t.
	(print_kexec_segments): Change len argument type from unsigned long
	to kernel_ureg_t.  Change seg variable type from unsigned long
	to kernel_ureg_t.

	printsiginfo: change len argument type from unsigned long to kernel_ureg_t
	* printsiginfo.c (print_siginfo_array): Change len argument type
	from unsigned long to kernel_ureg_t.

	signal: change address argument type from unsigned long to kernel_ureg_t
	* signal.c (print_sigqueueinfo): Change address argument type
	from unsigned long to kernel_ureg_t.

	statfs64: change size argument type from unsigned long to kernel_ureg_t.
	* defs.h (print_struct_statfs64): Change size argument type
	from unsigned long to kernel_ureg_t.
	* print_statfs.c (print_struct_statfs64): Likewise.
	* fetch_struct_statfs.c (fetch_struct_statfs64): Likewise.
	* fstatfs64.c (SYS_FUNC(fstatfs64)): Pass size argument directly
	to print_struct_statfs64.
	* statfs64.c (SYS_FUNC(statfs64)): Likewise.

	Cast tcp->u_rval to kernel_ureg_t instead of unsigned long.
	* fcntl.c (print_fcntl): Cast tcp->u_rval to kernel_ureg_t instead
	of unsigned long.
	* membarrier.c (SYS_FUNC(membarrier)): Likewise.
	* prctl.c (SYS_FUNC(prctl)): Likewise.
	* sched.c (SYS_FUNC(sched_getscheduler)): Likewise.
	* time.c (do_adjtimex): Likewise.

	decode_sockbuf: change addrlen argument type from long to kernel_ureg_t.
	* net.c (decode_sockbuf): Change addrlen argument type from long
	to kernel_ureg_t.

	netlink: change size types from unsigned long to kernel_ureg_t.
	* defs.h (decode_netlink): Change len argument type from unsigned long
	to kernel_ureg_t.
	* netlink.c (fetch_nlmsghdr): Likewise.
	(decode_nlmsghdr_with_payload): Likewise.  Change nlmsg_len variable
	type from unsigned long to unsigned int.
	(decode_netlink): Change the type of len argument and next_len variable
	from unsigned long to kernel_ureg_t.  Change nlmsg_len variable type
	from unsigned long to unsigned int.

	ipc_msg: change size types from unsigned long to kernel_ureg_t.
	* ipc_msg.c (tprint_msgsnd): Change count argument type
	from unsigned long to kernel_ureg_t.  Change flags argument type
	from unsigned long to unsigned int.
	(tprint_msgrcv): Change the type of count and msgtyp arguments
	from unsigned long to kernel_ureg_t.
	(fetch_msgrcv_args): Change *pair type from unsigned long
	to kernel_ureg_t.
	(SYS_FUNC(msgrcv)): Change pair type from unsigned long
	to kernel_ureg_t.
	* print_msgbuf.c (tprint_msgbuf): Change count argument type
	from unsigned long to kernel_ureg_t.

	dumpiov_upto: change size types from unsigned long to kernel_ureg_t.
	* defs.h (dumpiov_upto): Change data_size argument type
	from unsigned long to kernel_ureg_t.
	* util.c (dumpiov_upto): Change the type of data_size argument
	and iov_len variable from unsigned long to kernel_ureg_t.

2016-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	msghdr: change cmsghdr size types from size_t to unsigned int.
	As the kernel does not accept control messages longer than the value
	of int sysctl_optmem_max kernel variable exported as
	/proc/sys/net/core/optmem_max, we do not print them either.

	Since unsigned int has enough room to contain any valid control message
	size, change all internal cmsghdr size types from size_t
	to unsigned int.

	* msghdr.c (print_scm_rights, print_scm_creds, print_scm_security,
	print_cmsg_ip_pktinfo, print_cmsg_uint, print_cmsg_uint8_t,
	print_cmsg_ip_opts, print_cmsg_ip_recverr, print_cmsg_ip_origdstaddr,
	cmsg_printer, print_cmsg_type_data): Change data_len argument type
	from size_t to unsigned int.
	(cmsg_socket_printers): Change min_len type from size_t to unsigned int.
	(decode_msg_control): Change the type of in_control_len argument,
	cmsg_len, and len variables from size_t to kernel_ureg_t.
	Change the type of cmsg_size, control_len, and buf_len variables
	from size_t to unsigned int.

2016-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	msghdr: change register based size types from unsigned long to kernel_ureg_t
	* defs.h (dumpiov_in_msghdr): Change data_size argument type
	from unsigned long to kernel_ureg_t.
	* msghdr.h (print_struct_msghdr): Likewise.
	* msghdr.c (print_struct_msghdr): Likewise.  Cast msghdr.msg_iovlen
	and msghdr.msg_controllen to kernel_ureg_t instead of unsigned long.
	(decode_msghdr, dumpiov_in_msghdr): Change data_size argument type
	from unsigned long to kernel_ureg_t.
	(SYS_FUNC(sendmsg)): Pass -1 instead of -1UL as data_size argument
	to decode_msghdr.
	* mmsghdr.c (print_struct_mmsghdr): Pass (kernel_ureg_t) -1 instead
	of -1UL as data_size argument to print_struct_msghdr.
	(dumpiov_in_mmsghdr): Cast msghdr.msg_iovlen to kernel_ureg_t instead
	of unsigned long.
	* syscall.c (dumpio): Pass -1 instead of -1UL as data_size argument
	to dumpiov_in_msghdr

	mq: remove redundant u_rval check.
	* mq.c (SYS_FUNC(mq_timedreceive)): Do not check for tcp->u_rval < 0,
	syserror(tcp) is enough, and printstrn can handle len < 0 anyway.

	io: change size types from unsigned long to kernel_ureg_t.
	* defs.h (tprint_iov_upto): Change the type of len and data_size
	arguments from unsigned long to kernel_ureg_t.
	(tprint_iov): Change the type of len argument from unsigned long
	to kernel_ureg_t.
	* io.c (print_iovec_config): Change data_size type from unsigned long
	to kernel_ureg_t.
	(print_iovec): Change the type of *iov, iov_buf, and len variables
	from unsigned long to kernel_ureg_t.
	(tprint_iov_upto): Change the type of len and data_size arguments, and
	the type of iov variable from unsigned long to kernel_ureg_t.

	mount: change flags type from unsigned long to kernel_ureg_t.
	* mount.c (SYS_FUNC(mount)): Change the type of flags from unsigned long
	to kernel_ureg_t, use printflags64 instead of printflags_long
	to print it.

	mem: change mmap arguments type from unsigned long to kernel_ureg_t.
	* mem.c (print_mmap): Change the type of len, prot, and flags
	from unsigned long to kernel_ureg_t.  Use printflags64 instead
	of printflags_long.  Use printxval64 instead of printxval_long.
	(SYS_FUNC(old_mmap)): Check for current_klongsize instead
	of [AARCH64 || X86_64] to take X32 into account.
	(SYS_FUNC(mremap)): Use printflags64 instead of printflags_long.
	(SYS_FUNC(remap_file_pages)): Change the type of size, prot, pgoff, and
	flags from unsigned long to kernel_ureg_t.  Use printflags64 instead
	of printflags_long.  Use printxval64 instead of printxval_long.
	[POWERPC] (SYS_FUNC(subpage_prot)): Change the type of len and nmemb
	from unsigned long to kernel_ureg_t.

	numa: change size arguments type from unsigned long to kernel_ureg_t.
	* numa.c (print_node, print_addr): Add kernel_ureg_t support.
	(print_nodemask): Change type of maxnodes argument from unsigned long
	to kernel_ureg_t.
	(SYS_FUNC(move_pages)): Change npages type from unsigned long
	to kernel_ureg_t.  Change buf type from long to kernel_ureg_t.

	print_sigset_addr_len: change len argument type from long to kernel_ureg_t
	* defs.h (print_sigset_addr_len): Change len argument type from long
	to kernel_ureg_t.
	* signal.c (print_sigset_addr_len_limit, print_sigset_addr_len): Likewise.

	process_vm: change size arguments type from unsigned long to kernel_ureg_t
	* process_vm.c (SYS_FUNC(process_vm_readv),
	SYS_FUNC(process_vm_writev)): Change the type of local_iovcnt,
	remote_iovcnt, and flags from unsigned long to kernel_ureg_t.

	printstr*: change len argument type from long to kernel_ureg_t.
	* defs.h (printstr_ex, printstrn): Change len argument type from long
	to kernel_ureg_t.
	* util.c (printstr_ex): Likewise.

	xattr: change size arguments type from unsigned long to kernel_ureg_t.
	* xattr.c (print_xattr_val): Change type of insize and size arguments
	from unsigned long to kernel_ureg_t.
	(print_xattr_list): Change type of size argument from unsigned long
	to kernel_ureg_t.

2016-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	printstr_ex: fix decoding of non-NUL-terminated strings when len == -1.
	Do not treat len == -1 in any special way.  All users who need the
	string to be handled as a NUL-terminated string set QUOTE_0_TERMINATED
	bit in user_style flags already.

	* util.c (printstr_ex): Remove (len == -1) check.
	* tests/printstr.c: New file.
	* tests/printstr.test: New test.
	* tests/.gitignore: Add printstr.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add printstr.test.

2016-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of sethostname syscall.
	The second argument of sethostname syscall is not an unsigned long but
	unsigned int.  The kernel does not look at the string argument when
	the length argument is too long.

	* hostname.c [HAVE_LINUX_UTSNAME_H]: Include <linux/utsname.h>.
	[!__NEW_UTS_LEN] (__NEW_UTS_LEN): Define.
	(SYS_FUNC(sethostname)): Treat the second argument as unsigned int.
	Print the first argument as a pointer when the second argument exceeds
	__NEW_UTS_LEN.
	* tests/sethostname.c [HAVE_LINUX_UTSNAME_H]: Include <linux/utsname.h>.
	[!__NEW_UTS_LEN] (__NEW_UTS_LEN): Define.
	(main): Use it.  Check that the second argument of sethostname
	is handled as unsigned int.  Check that the first argument is printed
	as a pointer when the second argument exceeds __NEW_UTS_LEN.

2016-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add F8ILL_KULONG_* and f8ill_ptr_to_kulong to tests.h.
	* tests/tests.h (F8ILL_KULONG_SUPPORTED, F8ILL_KULONG_MASK): New macros.
	(f8ill_ptr_to_kulong): New static inline function.

2016-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	printstr: rename to printstrn, add printstr as a thin wrapper.
	As about half of all printstr uses cases are invocations with the last
	argument set to -1, create a dedicated function for this use case.

	* defs.h (printstr): Rename to printstrn.  All callers updated.
	(printstr): New static inline function.  All callers updated.

2016-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	process: change ptrace arguments type from unsigned long to kernel_ureg_t
	(SYS_FUNC(ptrace)): Change type of request and data arguments
	from unsigned long to kernel_ureg_t.

	process: change tracee address type from unsigned long to kernel_ureg_t.
	* process.c (print_user_offset_addr): Change address argument type
	from unsigned long to kernel_ureg_t.
	(SYS_FUNC(ptrace)): Change addr variable type from unsigned long
	to kernel_ureg_t.

	net: change address argument type from long to kernel_ureg_t.
	* net.c (decode_sockbuf, decode_pair_fd, print_linger, print_ucred,
	print_tpacket_stats, print_icmp_filter, print_getsockopt, print_mreq,
	print_mreq6, print_group_req, print_tpacket_req, print_packet_mreq,
	print_setsockopt): Change address argument type from long
	to kernel_ureg_t.

	print_mq_attr: change address argument type from long to kernel_ureg_t.
	* print_mq_attr.c (printmqattr): Change address argument type from long
	to kernel_ureg_t.

	ipc_*: change address argument type from long to kernel_ureg_t.
	* ipc_msg.c (tprint_msgsnd, tprint_msgrcv, fetch_msgrcv_args): Change
	address argument type from long to kernel_ureg_t.
	* ipc_msgctl.c (print_msqid_ds): Likewise.
	* ipc_sem.c (tprint_sembuf_array): Likewise.
	* ipc_shmctl.c (print_shmid_ds): Likewise.

	print_msgbuf: change address argument type from long to kernel_ureg_t.
	* print_msgbuf.c (tprint_msgbuf): Change address argument type
	from long to kernel_ureg_t.

	desc: change tracee address type from long to kernel_ureg_t.
	* desc.c (decode_select): Rename arg to addr, change its type
	from long to kernel_ureg_t.

	uid: change address argument type from long to kernel_ureg_t.
	* uid.c (get_print_uid): Change address argument type
	from long to kernel_ureg_t.

	time: change address argument type from long to kernel_ureg_t.
	* time.c (print_timezone, do_adjtimex): Change address argument type
	from long to kernel_ureg_t.

	sched: change address argument type from long to kernel_ureg_t.
	* sched.c (print_sched_attr): Change address argument type
	from long to kernel_ureg_t.

	printsiginfo: change address argument type from long to kernel_ureg_t.
	* printsiginfo.c (printsiginfo_at): Change address argument type
	from long to kernel_ureg_t.

	print_timex: change address argument type from long to kernel_ureg_t.
	* print_timex.c (print_timex): Change address argument type
	from long to kernel_ureg_t.

	print_sigevent: change address argument type from long to kernel_ureg_t.
	* print_sigevent.c (print_sigevent): Change address argument type
	from long to kernel_ureg_t.

	poll: change address argument type from long to kernel_ureg_t.
	* poll.c (decode_poll_exiting): Change tracee address argument type
	from long to kernel_ureg_t.

	printrusage*: change tracee address argument type from long to kernel_ureg_t
	* defs.h [ALPHA] (printrusage32): Change address argument type
	from long to kernel_ureg_t.
	* printrusage.c (printrusage): Likewise.
	[ALPHA] (printrusage32): Likewise.
	* wait.c (printwaitn): Change the type of tracee address argument
	of print_rusage from long to kernel_ureg_t.

	print_time*: change tracee address argument type from long to kernel_ureg_t
	* defs.h [ALPHA] (sprint_timeval32, print_timeval32,
	print_timeval32_pair, print_itimerval32): Change address argument type
	from long to kernel_ureg_t.
	* desc.c (decode_select): Change the type of tracee address argument
	of print_tv_ts and sprint_tv_ts from long to kernel_ureg_t.
	* print_timespec.c (print_timespec, sprint_timespec,
	print_timespec_utime_pair, print_itimerspec): Change address argument
	type from long to kernel_ureg_t.
	* print_timeval.c (print_timeval, print_timeval_pair, sprint_timeval,
	print_itimerval, print_timeval32, print_timeval32_pair,
	print_itimerval32, sprint_timeval32): Likewise.

	rtc: change type of ioctl 3rd argument from long to kernel_ureg_t.
	* rtc.c (decode_rtc_time, decode_rtc_wkalrm, decode_rtc_pll_info):
	Change addr type from long to kernel_ureg_t.
	(rtc_ioctl): Change arg type from long to kernel_ureg_t.

	mtd: change type of ioctl 3rd argument from long to kernel_ureg_t.
	* mtd.c (decode_erase_info_user, decode_erase_info_user64,
	decode_mtd_oob_buf, decode_mtd_oob_buf64, decode_otp_info,
	decode_otp_select, decode_mtd_write_req, decode_mtd_info_user,
	decode_nand_oobinfo, decode_nand_ecclayout_user, decode_mtd_ecc_stats):
	Change addr type from long to kernel_ureg_t.
	(mtd_ioctl): Change arg type from long to kernel_ureg_t.

	hdio: change type of ioctl 3rd argument from long to kernel_ureg_t.
	* hdio.c (hdio_ioctl): Change arg type from long to kernel_ureg_t.

	v4l2: change type of ioctl 3rd argument from long to kernel_ureg_t.
	* v4l2.c (print_v4l2_capability, print_v4l2_fmtdesc, print_v4l2_format,
	print_v4l2_requestbuffers, print_v4l2_buffer, print_v4l2_framebuffer,
	print_v4l2_buf_type, print_v4l2_streamparm, print_v4l2_standard,
	print_v4l2_input, print_v4l2_control, print_v4l2_queryctrl,
	print_v4l2_cropcap, print_v4l2_crop, print_v4l2_ext_controls,
	print_v4l2_frmsizeenum, print_v4l2_frmivalenum,
	print_v4l2_create_buffers, v4l2_ioctl): Change arg type from long
	to kernel_ureg_t.

	evdev: change type of ioctl 3rd argument from long to kernel_ureg_t.
	* evdev.c (ff_effect_ioctl, abs_ioctl, keycode_ioctl, keycode_V2_ioctl,
	getid_ioctl, decode_bitset, mtslots_ioctl, repeat_ioctl, bit_ioctl,
	evdev_read_ioctl, evdev_write_ioctl, evdev_ioctl): Change arg type
	from long to kernel_ureg_t.

	btrfs: change type of ioctl 3rd argument from long to kernel_ureg_t.
	* btrfs.c (btrfs_print_balance, btrfs_ioctl): Change arg type from long
	to kernel_ureg_t.

	block: change type of ioctl 3rd argument from long to kernel_ureg_t.
	* block.c (block_ioctl): Change arg type from long to kernel_ureg_t.

	Change type of ioctl 3rd argument from long to kernel_ureg_t.
	* defs.h (DECL_IOCTL): Change arg type from long to kernel_ureg_t.
	* dm.c (dm_known_ioctl, dm_ioctl): Likewise.
	* file_ioctl.c (file_ioctl): Likewise.
	* fs_x_ioctl.c (fs_x_ioctl): Likewise.
	* ioctl.c (ioctl_decode): Likewise.
	* loop.c (decode_loop_info, decode_loop_info64): Change addr type
	from long to kernel_ureg_t.
	(loop_ioctl): Change arg type from long to kernel_ureg_t.
	* ptp.c (ptp_ioctl): Likewise.
	* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req,
	print_sg_io_v4_res, scsi_ioctl): Likewise.
	* sock.c (print_ifreq, sock_ioctl): Likewise.
	(decode_ifconf): Change addr type from long to kernel_ureg_t.
	* term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize,
	decode_modem_flags): Likewise.
	(term_ioctl): Change arg type from long to kernel_ureg_t.
	* ubi.c (ubi_ioctl): Likewise.
	* userfaultfd.c (uffdio_ioctl): Likewise.

	ldt: change address argument type from long to kernel_ureg_t.
	* defs.h [HAVE_STRUCT_USER_DESC] (print_user_desc): Change address
	argument type from long to kernel_ureg_t.
	* ldt.c [HAVE_STRUCT_USER_DESC] (print_user_desc): Likewise.

	fcntl: change address argument type from long to kernel_ureg_t.
	* fcntl.c (printflock64, printflock, print_f_owner_ex): Change
	address argument type from long to kernel_ureg_t.

	execve: change address argument type from long to kernel_ureg_t.
	* execve.c (printargv, printargc): Change address argument type
	from long to kernel_ureg_t.

	dirent: change address argument type from long to kernel_ureg_t.
	* dirent.c (print_old_dirent): Change address argument type from long
	to kernel_ureg_t.

	bpf: change address argument type from long to kernel_ureg_t.
	* bpf.c (bpf_map_create, bpf_map_update_elem, bpf_map_delete_elem,
	bpf_map_io, bpf_prog_load, SYS_FUNC(bpf)): Change address argument
	type from long to kernel_ureg_t.

	dump*: change address argument type from long to kernel_ureg_t.
	* defs.h (dumpiov_in_msghdr, dumpiov_in_mmsghdr, dumpiov_upto, dumpstr):
	Change address argument type from long to kernel_ureg_t.
	* mmsghdr.c (dumpiov_in_mmsghdr): Likewise.
	* msghdr.c (fetch_msghdr_namelen, decode_msghdr, dumpiov_in_msghdr):
	Likewise.
	* util.c (dumpiov_upto, dumpstr): Likewise.

	print_sigset_addr_len: change address argument type from long to kernel_ureg_t
	* defs.h (print_sigset_addr_len) Change address argument type from long
	to kernel_ureg_t.
	* signal.c (print_sigset_addr_len_limit, print_sigset_addr_len,
	decode_old_sigaction, decode_new_sigaction): Likewise.

	decode_sockaddr: change address argument type from long to kernel_ureg_t
	* defs.h (decode_sockaddr) Change tracee address argument type from long
	to kernel_ureg_t.
	* sockaddr.c (decode_sockaddr): Likewise.

	print_struct_statfs*: change address argument type from long to kernel_ureg_t
	* defs.h (print_struct_statfs, print_struct_statfs64): Change address
	argument type from long to kernel_ureg_t.
	* print_statfs.c (print_struct_statfs, print_struct_statfs64): Likewise.
	* fetch_struct_statfs.c (fetch_struct_statfs, fetch_struct_statfs64):
	Likewise.

	fetch_struct_flock: change address argument type from long to kernel_ureg_t
	* fetch_struct_flock.c (fetch_struct_flock, fetch_struct_flock64):
	Change address argument type from long to kernel_ureg_t.

	fetch_seccomp_fprog: change address argument type from long to kernel_ureg_t
	* fetch_seccomp_fprog.c (fetch_seccomp_fprog): Change address argument
	type from long to kernel_ureg_t.

	printnum_*, printpair_*: change address argument type from long to kernel_ureg_t
	* defs.h (DECL_PRINTNUM, DECL_PRINTPAIR, printnum_long_int): Change
	address argument type from long to kernel_ureg_t.
	* util.c (DEF_PRINTNUM, DEF_PRINTPAIR, printnum_long_int): Likewise.

	printpath*: change address argument type from long to kernel_ureg_t.
	* defs.h (printpath, printpathn): Change address argument type
	from long to kernel_ureg_t.
	* util.c (printpath, printpathn): Likewise.

	printstr*: change address argument type from long to kernel_ureg_t.
	* defs.h (printstr_ex, printstr_ex): Change address argument type
	from long to kernel_ureg_t.
	* util.c (printstr_ex): Likewise.

	umove*: change tracee address argument type from long to kernel_ureg_t.
	* defs.h (umovestr, umoven, umoven_or_printaddr,
	umoven_or_printaddr_ignore_syserror): Change tracee address argument
	type from long to kernel_ureg_t.
	(print_array): Change the type of tracee address argument of umoven_func
	from long to kernel_ureg_t.
	* util.c (vm_read_mem, umovestr, umoven, umoven_or_printaddr,
	umoven_or_printaddr_ignore_syserror): Change tracee address argument
	type from long to kernel_ureg_t.
	(print_array): Change the type of tracee address argument of umoven_func
	from long to kernel_ureg_t.
	* desc.c (umove_kulong_array_or_printaddr): Change tracee address
	argument type from long to kernel_ureg_t.
	* mmsghdr.c (fetch_struct_mmsghdr_or_printaddr): Likewise.

	futex: change address type from long to kernel_ureg_t.
	* futex.c (SYS_FUNC(futex)): Change address type from long
	to kernel_ureg_t.

	file_handle: change address type from long to kernel_ureg_t.
	* file_handle.c (SYS_FUNC(name_to_handle_at),
	SYS_FUNC(open_by_handle_at)): Change address type from long
	to kernel_ureg_t.

	printsiginfo: cast pointers to kernel_ureg_t instead of unsigned long.
	* printsiginfo.c (printsigval): Cast siginfo.si_ptr pointer
	to kernel_ureg_t instead of unsigned long.
	(print_si_info): Cast siginfo.si_addr and siginfo.si_call_addr pointers
	to kernel_ureg_t instead of unsigned long.

	sigaltstack: cast pointers and sizes to kernel_ureg_t instead of unsigned long
	* sigaltstack.c (print_stack_t): Cast sigaltstack.ss_sp pointer
	and sigaltstack.ss_size to kernel_ureg_t instead of unsigned long.

	v4l2: cast pointers to kernel_ureg_t instead of long.
	* v4l2.c (print_v4l2_ext_control): Cast v4l2_ext_control.string pointer
	to kernel_ureg_t instead of long.

	v4l2: cast pointers to kernel_ureg_t instead of unsigned long.
	* v4l2.c (print_v4l2_buffer): Remove redundant cast.
	(print_v4l2_framebuffer): Cast v4l2_framebuffer.base pointer
	to kernel_ureg_t instead of unsigned long.
	(print_v4l2_ext_controls): Cast v4l2_ext_controls.controls pointer
	to kernel_ureg_t instead of unsigned long.

2016-12-24  Dmitry V. Levin  <ldv@altlinux.org>

	sysctl: cast pointers to kernel_ureg_t instead of size_t.
	* sysctl.c (SYS_FUNC(sysctl)): Cast __sysctl_args.oldval and
	__sysctl_args.newval pointers to kernel_ureg_t instead of size_t.

	sysctl: cast pointers to kernel_ureg_t instead of long.
	* sysctl.c (SYS_FUNC(sysctl)): Cast __sysctl_args.oldlenp pointer
	to kernel_ureg_t instead of long.

	block: cast pointers to kernel_ureg_t instead of long.
	* block.c (print_blkpg_req): Cast blkpg_ioctl_arg.data pointer
	to kernel_ureg_t instead of long.

	dumpiov_upto: cast pointers to kernel_ureg_t instead of long.
	* util.c  (dumpiov_upto): Cast iovec.iov_base pointer to kernel_ureg_t
	instead of long.

	msghdr: cast pointers to kernel_ureg_t instead of long.
	* msghdr.c (print_struct_msghdr): Cast msghdr.msg_name pointer
	to kernel_ureg_t instead of long.
	(dumpiov_in_msghdr): Cast msghdr.msg_iov pointer to kernel_ureg_t
	instead of long.

	mmsghdr: cast pointers to kernel_ureg_t instead of long.
	* mmsghdr.c (dumpiov_in_mmsghdr): Cast msghdr.msg_iov pointer
	to kernel_ureg_t instead of long.

	Remove redundant casts of ptrace arguments.
	* strace.c (maybe_switch_tcbs, trace): Do not cast ptrace 4th argument
	from pointer to long type.

	ptrace_restart: cleanup.
	* strace.c (ptrace_restart): Replace the sequence of "if" statements
	with a "switch" statement.

	ptrace_restart: change types of integer arguments to unsigned.
	* strace.c (ptrace_restart): Change types of "op" and "sig"
	from int to unsigned int.

	process: remove redundant syserror checks.
	* process.c (SYS_FUNC(ptrace)): Remove syserror checks as both
	print_siginfo_array and print_seccomp_fprog do the right thing
	by using umoven_or_printaddr.

	sparc64: remove redundant casts.
	* linux/sparc64/get_syscall_args.c (get_syscall_args): Remove
	redundant casts from uint32_t to long.

2016-12-23  Dmitry V. Levin  <ldv@altlinux.org>

	numa: change address argument type from unsigned long to kernel_ureg_t.
	* numa.c (print_nodemask): Change address argument type from
	unsigned long to kernel_ureg_t.

	net: change address argument type from unsigned long to kernel_ureg_t.
	* net.c (fetch_socklen): Change address argument type from
	unsigned long to kernel_ureg_t.

	mem: change tracee address type from unsigned long to kernel_ureg_t.
	* mem.c (print_mmap, SYS_FUNC(remap_file_pages),
	SYS_FUNC(subpage_prot)): Change the type of variables containing tracee
	addresses from unsigned long to kernel_ureg_t.

	kexec: change address argument type from unsigned long to kernel_ureg_t.
	* kexec.c (print_kexec_segments): Change address argument type
	from unsigned long to kernel_ureg_t.

	poll: change counter type from unsigned long to unsigned int.
	* poll.c (decode_poll_exiting): Change the type of printed and
	max_printed counters from unsigned long to unsigned int.

	xattr: change address argument type from unsigned long to kernel_ureg_t.
	* xattr.c (print_xattr_val, print_xattr_list): Change address
	argument type from unsigned long to kernel_ureg_t.

	uid: change address argument type from unsigned long to kernel_ureg_t.
	* uid.c (print_groups): Change address argument type
	from unsigned long to kernel_ureg_t.

	stat64: change address argument type from unsigned long to kernel_ureg_t
	* stat64.c (decode_struct_stat64): Change address argument type
	from unsigned long to kernel_ureg_t.

	stat: change address argument type from unsigned long to kernel_ureg_t.
	* stat.c (decode_struct_stat): Change address argument type
	from unsigned long to kernel_ureg_t.

	sigaltstack: change address argument type from unsigned long to kernel_ureg_t
	* sigaltstack.c (print_stack_t): Change address argument type
	from unsigned long to kernel_ureg_t.

	resource: change address argument type from unsigned long to kernel_ureg_t
	* resource.c (print_rlimit64, print_rlimit32, decode_rlimit): Change
	address argument type from unsigned long to kernel_ureg_t.

	printsiginfo: change address argument type from unsigned long to kernel_ureg_t
	* printsiginfo.c (print_siginfo_array): Change address argument type
	from unsigned long to kernel_ureg_t.

	poll: change tracee address type from unsigned long to kernel_ureg_t.
	* poll.c (decode_poll_entering, decode_poll_exiting): Change the type
	all tracee address variables from unsigned long to kernel_ureg_t.

	perf: change address argument type from unsigned long to kernel_ureg_t.
	* perf.c (fetch_perf_event_attr, print_perf_event_attr): Change
	address argument type from unsigned long to kernel_ureg_t.

	pathtrace: change tracee address type from unsigned long to kernel_ureg_t
	* pathtrace.c (upathmatch): Change address argument type
	from unsigned long to kernel_ureg_t.
	(pathtrace_match): Change the type of all tracee address variables
	from unsigned long to kernel_ureg_t.

	scsi: change address argument type from unsigned long to kernel_ureg_t.
	* scsi.c (print_sg_io_buffer): Change address argument type
	from unsigned long to kernel_ureg_t.

	dm: change address argument type from unsigned long to kernel_ureg_t.
	* dm.c (dm_decode_dm_target_spec, dm_decode_dm_target_deps,
	dm_decode_dm_name_list, dm_decode_dm_target_versions,
	dm_decode_dm_target_msg, dm_decode_string): Change address argument type
	from unsigned long to kernel_ureg_t.

	oldstat: change address argument type from unsigned long to kernel_ureg_t
	* oldstat.c (print_old_kernel_stat): Change address argument type
	from unsigned long to kernel_ureg_t.

	capability: change address argument type from unsigned long to kernel_ureg_t
	* capability.c (get_cap_header, print_cap_header, print_cap_data):
	Change address argument type from unsigned long to kernel_ureg_t.

	btrfs: change address argument type from unsigned long to kernel_ureg_t.
	* btrfs.c (btrfs_print_qgroup_inherit): Change address argument type
	from unsigned long to kernel_ureg_t.

	affinity: change address argument type from unsigned long to kernel_ureg_t
	* affinity.c (print_affinitylist): Change address argument type from
	unsigned long to kernel_ureg_t.

	aio: change address type from unsigned long to kernel_ureg_t.
	* aio.c (print_iocb): Remove casts to unsigned long.
	(print_iocbp,  SYS_FUNC(io_submit)): Change address type
	from unsigned long to kernel_ureg_t.

	mmsghdr: change address argument type from unsigned long to kernel_ureg_t
	* mmsghdr.c (save_mmsgvec_namelen, decode_mmsgvec): Change
	address argument type from unsigned long to kernel_ureg_t.

	msghdr: change address argument type from unsigned long to kernel_ureg_t
	* msghdr.c (decode_msg_control): Change address argument type
	from unsigned long to kernel_ureg_t.

	fetch_struct_stat64: change address argument type from unsigned long to kernel_ureg_t
	* fetch_struct_stat64.c (fetch_struct_stat64): Change address argument
	type from unsigned long to kernel_ureg_t.

	fetch_struct_stat: change address argument type from unsigned long to kernel_ureg_t
	* fetch_struct_stat.c (fetch_struct_stat): Change address argument
	type from unsigned long to kernel_ureg_t.

	fetch_struct_msghdr: change address argument type from unsigned long to kernel_ureg_t
	* fetch_struct_msghdr.c (fetch_struct_msghdr): Change
	address argument type from unsigned long to kernel_ureg_t.

	fetch_struct_mmsghdr: change address argument type from unsigned long to kernel_ureg_t
	* fetch_struct_mmsghdr.c (fetch_struct_mmsghdr): Change
	address argument type from unsigned long to kernel_ureg_t.

	decode_netlink: change address argument type from unsigned long to kernel_ureg_t
	* defs.h (decode_netlink) Change address argument type
	from unsigned long to kernel_ureg_t.
	* netlink.c (fetch_nlmsghdr, decode_nlmsghdr_with_payload,
	decode_netlink): Likewise.

	print_seccomp_*: change address argument type from unsigned long to kernel_ureg_t
	* defs.h (print_seccomp_filter, print_seccomp_fprog): Change
	address argument type from unsigned long to kernel_ureg_t.
	* seccomp.c (print_seccomp_filter, print_seccomp_fprog,
	decode_seccomp_set_mode_strict): Likewise.

	tprint_iov*: change address argument type from unsigned long to kernel_ureg_t
	* defs.h (tprint_iov, tprint_iov_upto): Change address argument type
	from unsigned long to kernel_ureg_t.
	* io.c (tprint_iov, tprint_iov_upto): Likewise.

	print_array: change tracee address type from unsigned long to kernel_ureg_t
	* defs.h (print_array): Change start_addr type from unsigned long
	to kernel_ureg_t.
	* util.c (print_array): Likewise.  Change the type of all tracee
	address variables from unsigned long to kernel_ureg_t.

2016-12-23  Dmitry V. Levin  <ldv@altlinux.org>

	Rename LONG_LONG to ULONG_LONG and change it to return unsigned long long
	In all places where LONG_LONG is used the destination already has type
	unsigned long long, so it is quite natural to change LONG_LONG as well.

	* defs.h (LONG_LONG): Rename to ULONG_LONG, change return type
	from long long to unsigned long long.  All callers updated.

2016-12-23  Dmitry V. Levin  <ldv@altlinux.org>

	mem: remove redundant casts.
	* mem.c (SYS_FUNC(old_mmap)): Remove redundant cast
	from kernel_ureg_t to unsigned long.
	[S390] (SYS_FUNC(old_mmap_pgoff)): Remove redundant cast
	from unsigned int to unsigned long.

	desc: remove redundant casts.
	* desc.c (umove_kulong_array_or_printaddr): Remove redundant cast
	from uint32_t to kernel_ulong_t.
	(SYS_FUNC(pselect6)): Remove redundant casts from kernel_ulong_t
	to unsigned long.

2016-12-22  Dmitry V. Levin  <ldv@altlinux.org>

	print_sigevent: remove redundant cast.
	* print_sigevent.c (print_sigevent): Remove redundant cast from
	struct_sigevent.sigev_value.sival_ptr to unsigned long as the former
	is not a pointer but an unsigned integer.

	tests: fix xattr.test for the case when listxattr returns a long list.
	* tests/xattr.c (DEFAULT_STRLEN): New macro.
	(main): Use it to limit the length passed to print_quoted_memory.
	Print ellipsis when the list returned by listxattr is too long.

2016-12-22  Gabriel Laskar  <gabriel@lse.epita.fr>

	tests: test for correct ellipsis with -s in xattr.
	* tests/xattr-strings.c: New file.
	* tests/xattr-strings.test: New test.
	* tests/.gitignore: Add xattr-string.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add xattr-string.test.

2016-12-22  Gabriel Laskar  <gabriel@lse.epita.fr>

	xattr: use printstr_ex instead of print_quoted_string.
	This fixes the display when using `-s` to limit the string size
	of the values displayed by {get,set}xattr.

	* xattr.c (print_xattr_val): Remove static buffer.  Use printstr_ex
	instead of print_quoted_string.

	Reported-by: Марк Коренберг <socketpair@gmail.com>

2016-12-22  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: use scno.h in finit_module, kcmp, renameat2 tests.
	* tests/finit_module.c: Include "scno.h".
	* tests/kcmp.c: Likewise.
	* tests/renameat2.c: Likewise.

2016-12-21  Dmitry V. Levin  <ldv@altlinux.org>

	sock: cast pointers to kernel_ureg_t instead of unsigned long.
	* sock.c (decode_ifconf): Cast ifconf.ifc_buf pointer to kernel_ureg_t
	instead of unsigned long.

	scsi: cast pointers to kernel_ureg_t instead of unsigned long.
	* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res): Cast sg_io_hdr.cmdp,
	sg_io_hdr.dxferp, and sg_io_hdr.sbp pointers to kernel_ureg_t instead
	of unsigned long.

	mtd: cast pointers to kernel_ureg_t instead of unsigned long.
	* mtd.c (decode_mtd_oob_buf): Cast mtd_oob_buf.ptr pointer
	to kernel_ureg_t instead of unsigned long.

	msghdr: cast pointers to kernel_ureg_t instead of unsigned long.
	* msghdr.c (print_struct_msghdr): Cast msghdr.msg_iov and
	msghdr.msg_control pointers to kernel_ureg_t instead of unsigned long.

	evdev: cast tcp->u_rval to kernel_ureg_t instead of unsigned long.
	* evdev.c (decode_bitset): Cast tcp->u_rval to kernel_ureg_t
	instead of unsigned long.

	evdev: cast pointers to kernel_ureg_t instead of unsigned long.
	* evdev.c (ff_effect_ioctl): Cast ff_periodic_effect.custom_data
	pointer to kernel_ureg_t instead of unsigned long.

	btrfs: cast pointers to kernel_ureg_t instead of unsigned long.
	* btrfs.c (btrfs_ioctl): Cast btrfs_ioctl_send_args.clone_sources
	and btrfs_ioctl_vol_args_v2.qgroup_inherit pointers to kernel_ureg_t
	instead of unsigned long.

	Rework ifdefery around print_user_desc.
	* configure.ac (AC_CHECK_TYPES): Check for struct user_desc
	in <asm/ldt.h>.
	* clone.c (print_tls_arg): New function.
	(SYS_FUNC(clone)): Use it.
	(print_user_desc): Move prototype ...
	* defs.h [HAVE_STRUCT_USER_DESC]: ... here.
	* ldt.c: Check for HAVE_STRUCT_USER_DESC instead of architectures.
	* linux/dummy.h: Likewise.

	Introduce DECL_IOCTL macro to declare *_ioctl functions.
	* defs.h (DECL_IOCTL): New macro.
	(dm_ioctl, file_ioctl, fs_x_ioctl, loop_ioctl, ptp_ioctl, scsi_ioctl,
	sock_ioctl, term_ioctl, ubi_ioctl, uffdio_ioctl): Rewrite prototypes
	using DECL_IOCTL.

	Introduce DECL_PRINT* macros to declare printnum_* and printpair_*
	* defs.h (DECL_PRINTNUM, DECL_PRINTPAIR): New macros.
	(printnum_short, printnum_int, printnum_int64): Rewrite prototypes
	using DECL_PRINTNUM.
	(printpair_int, printpair_int64): Rewrite prototypes
	using DECL_PRINTPAIR.

	ioctl: use uintptr_t for casts between 32-bit integers and pointers.
	* ioctl.c (compare): Cast pointer to uintptr_t before assigning
	it to an integer.
	(ioctl_lookup): Cast integer to uintptr_t before passing it
	as a pointer.

	scsi: use umove_or_printaddr.
	* scsi.c (scsi_ioctl): Use umove_or_printaddr.

	Remove dumpiov wrapper.
	* defs.h (dumpiov): Remove.
	* syscall.c (dumpio): Use dumpiov_upto instead of dumpiov.

	travis: fix enabling of gcc -Werror builds.
	* travis-build.sh: Use DISTCHECK_CONFIGURE_FLAGS instead
	of CHECK_CONFIGURE_FLAGS and ENABLE_GCC_WERROR.
	[$CC == gcc]: Add --enable-gcc-Werror to DISTCHECK_CONFIGURE_FLAGS
	instead of ENABLE_GCC_WERROR.
	[$CHECK == coverage]: Add --enable-code-coverage
	to DISTCHECK_CONFIGURE_FLAGS instead of CHECK_CONFIGURE_FLAGS.

	printaddr: change argument type to kernel_ureg_t.
	* defs.h (printaddr): Change argument type from unsigned long
	to kernel_ureg_t.

	tests: check decoding of unreadable ip_mreq and ipv6_mreq structures.
	* tests/ip_mreq.c (main): Check short read.

	tests: rewrite ip_mreq.c using arrays and iterators.
	* tests/ip_mreq.c (main): Create arrays of setsockopt arguments to test.
	Iterate over these arrays invoking setsockopt and printing expected
	output.

	tests: rewrite ip_mreq.c using tail_alloc.
	* tests/ip_mreq.c (main): Allocate objects of struct ip_mreq
	and struct ipv6_mreq using tail_alloc instead of using stack.

	tests: rewrite ip_mreq.c without asserts.
	* tests/ip_mreq.c: Do not include <assert.h>.
	(main): Do not use assert.  Use sprintrc instead of errno2name.

2016-12-20  Dmitry V. Levin  <ldv@altlinux.org>

	Remove NEED_PTRACE_PROTOTYPE_WORKAROUND.
	Remove the workaround for broken ptrace prototypes
	that seems to be unneeded for quite a long time.

	* defs.h [NEED_PTRACE_PROTOTYPE_WORKAROUND]: Remove.

2016-12-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use scno.h in tests of relatively new syscalls.
	* tests/add_key.c: Include "scno.h" after <asm/unistd.h>.
	* tests/copy_file_range.c: Likewise.
	* tests/execveat.c: Likewise.
	* tests/kexec_file_load.c: Likewise.
	* tests/membarrier.c: Likewise.
	* tests/memfd_create.c: Likewise.
	* tests/mlock2.c: Likewise.
	* tests/pkey_alloc.c: Likewise.
	* tests/pkey_free.c: Likewise.
	* tests/pkey_mprotect.c: Likewise.
	* tests/preadv2-pwritev2.c: Likewise.
	* tests/userfaultfd.c: Likewise.

2016-12-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: generate scno.h from syscallent.h for use by other tests.
	Provide scno.h with fallback definitions of all __NR_* constants known
	to strace for the personbality being tested.

	Some tests need just __NR_* constants without any kernel support.
	Such tests can include "scno.h" after <asm/unistd.h> to get definitions
	of these constants when system headers are too old.

	* tests/generate_scno.c: New file.
	* tests/.gitignore: Add generate_scno.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(scno.h): New rule.
	(BUILT_SOURCES, CLEANFILES): Add scno.h.

2016-12-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix potential errno clobbering in membarrier test.
	* tests/membarrier.c (main): Save errno.

2016-12-20  Dmitry V. Levin  <ldv@altlinux.org>

	Do not use widen_to_ulong in kexec.c and process_vm.c.
	Automatic argument truncation makes use of this function redundant.

	* kexec.c (SYS_FUNC(kexec_load)): Do not invoke widen_to_ulong.
	* process_vm.c (SYS_FUNC(process_vm_readv),
	SYS_FUNC(process_vm_writev)): Likewise.

2016-12-20  Dmitry V. Levin  <ldv@altlinux.org>

	x32: implement automatic argument truncation for compat syscalls.
	x32 syscalls starting with number 512 are compat syscalls that operate
	on compat types.  Set COMPAT_SYSCALL_TYPES flag to these syscall entries
	and make get_syscall_args truncate arguments of syscalls that have this
	flag set, to avoid unpleasant alternative of adding multiple
	widen_to_ulong invocations to individual syscall parsers.

	preadv, pwritev, preadv2, and pwritev2 are exceptions: while these
	syscalls operate on compat types, the offset argument has a regular
	64-bit type, so the automatic argument truncation cannot be applied.

	* defs.h (COMPAT_SYSCALL_TYPES): New macro.
	* syscall.c (CST): New macro, defined to COMPAT_SYSCALL_TYPES.
	* linux/ia64/syscallent.h: Do not include "../i386/syscallent.h"
	unless [CST > 0].
	* linux/x32/syscallent.h [512..533, 536..545]: Add CST flag.
	* linux/x86_64/get_syscall_args.c (get_syscall_args): Truncate arguments
	of compat syscalls to 32-bit values.
	* tests/ksysent.c (CST): New macro, defined to 0.
	* tests/nsyscalls.c (CST): Likewise.

2016-12-20  Dmitry V. Levin  <ldv@altlinux.org>

	x32: fix decoding of mprotect and pkey_mprotect syscall arguments.
	As there are no compat versions of mprotect or pkey_mprotect syscalls
	in x32 personality, "addr", "len", and "prot" syscall arguments have
	kernel_ulong_t type and should be printed accordingly.

	* mem.c (do_mprotect): Retrieve 1st, 2nd and 3rd arguments using
	getarg_klu, print them using printaddr_klu, PRI_klu format,
	and printflags64, correspondingly.

2016-12-20  Dmitry V. Levin  <ldv@altlinux.org>

	Make tprint_iov function a static inline wrapper.
	* io.c (tprint_iov): Move ...
	* defs.h: ... here, add static inline keywords.

2016-12-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	x32: fix decoding of 3rd argument of preadv* and pwritev* syscalls.
	In x32 personality these syscalls use compat type for the 3rd argument,
	therefore it has to be truncated there.

	* io.c (do_preadv, do_pwritev): Truncate tcp->u_arg[2] using
	widen_to_ulong.

2016-12-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: fix preadv2-pwritev2 test on x32.
	On x32 p(read|write)v(|2) syscalls are implemented via compat, which
	truncates len argument to unsigned int.

	* tests/preadv2-pwritev2.c (main): Print vlen argument as unsigned long.

2016-12-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	kexec: fix for the x32 ABI.
	There is no compat (and no 32-bit version, ever) for x32 ABI, so
	kernel's long type should be used for arguments' values.

	The only remaining thing is a pointer to cmdline string, but it is
	currently broken on x32 anyway.

	* kexec.c (SYS_FUNC(kexec_file_load)): Print the cmdline_len argument
	as kernel long, retrieve it via getarg_klu; use printflags64 for
	printing the flags argument, retrieve it via getarg_klu.

2016-12-19  Dmitry V. Levin  <ldv@altlinux.org>

	Check for current_klongsize instead of current_personality where appropriate
	current_klongsize checks are more universal, therefore they are usually
	shorter and easier to comprehend.

	* desc.c (umove_kulong_array_or_printaddr): Check for current_klongsize
	instead of current_personality and current_wordsize.
	* io.c (print_lld_from_low_high_val): Likewise.
	* lseek.c (SYS_FUNC(lseek)): Likewise.
	* resource.c (decode_rlimit): Likewise.
	* syscall.c (is_negated_errno): Likewise.
	* util.c (getllval, getarg_klu): Likewise.

2016-12-19  Dmitry V. Levin  <ldv@altlinux.org>

	Use kernel_ulong_t instead of unsigned long long where appropriate.
	* defs.h (printaddr_ull): Rename to printaddr_klu, change argument
	type from unsigned long long to kernel_ulong_t.  All callers updated.
	(getarg_ull): Rename to getarg_klu, change return value type
	from unsigned long long to kernel_ulong_t.  All callers updated.
	(PRI_kl, PRI_kld, PRI_klu, PRI_klx): New macros.
	* bjm.c (SYS_FUNC(init_module)): Print kernel_ulong_t type using
	PRI_klu format.
	* desc.c (SYS_FUNC(pselect6)): Likewise.
	* fadvise.c (SYS_FUNC(fadvise64)): Likewise.
	* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Likewise.
	* mq.c (SYS_FUNC(mq_timedsend), SYS_FUNC(mq_timedreceive)): Likewise.
	* kcmp.c (SYS_FUNC(kcmp)): Print kernel_ulong_t type using
	PRI_klx format.
	* keyctl.c (SYS_FUNC(keyctl)): Likewise.
	* pkeys.c (SYS_FUNC(pkey_alloc)): Likewise.
	* prctl.c (print_prctl_args, SYS_FUNC(prctl), SYS_FUNC(arch_prctl)):
	Print kernel_ulong_t type using PRI_kld, PRI_klu, or PRI_klx format.
	* util.c (printaddr_ull): Rename to printaddr_klu, change argument
	type from unsigned long long to kernel_ulong_t, print it using
	PRI_klx format.
	(getarg_ull): Rename to getarg_klu, change return value type
	from unsigned long long to kernel_ulong_t, print it using
	PRI_klx format.

	fcntl.c: print 64-bit fields of struct_kernel_flock64 using PRId64 format
	* fcntl.c (print_struct_flock64): Print l_start and l_len fields
	of struct_kernel_flock64 using PRId64 format.

	v4l2.c: print v4l2_ext_control.value64 using PRId64 format.
	* v4l2.c (print_v4l2_ext_control): Print value64 field
	of struct_v4l2_ext_control using PRId64 format.

	perf.c: print perf_event_attr.__reserved_1 using PRIx64 format.
	* perf.c (print_perf_event_attr): Print __reserved_1 field
	of perf_event_attr using PRIx64 format.

	btrfs.c: print 64-bit fields of btrfs_ioctl_vol_args_v2 using PRIu64 format
	* block.c (btrfs_ioctl): Print size and transid fields
	of struct_btrfs_ioctl_vol_args_v2 using PRIu64 format.

	block.c: change type of long long fileds to int64_t.
	* block.c (struct_blkpg_partition): Change type of start and length
	fields from long long to int64_t.
	(print_blkpg_req): Print them using PRId64 format.

2016-12-19  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Introduce current_klongsize in addition to current_wordsize.
	Subsequent commits are going to use current_klongsize
	as the tracee's size of kernel_ulong_t type.

	* defs.h (PERSONALITY0_KLONGSIZE): New macro.
	[X86_64] (PERSONALITY2_KLONGSIZE): Likewise.
	[SUPPORTED_PERSONALITIES > 1] (PERSONALITY1_KLONGSIZE): Likewise.
	[SUPPORTED_PERSONALITIES == 1] (current_klongsize): Likewise.
	[SUPPORTED_PERSONALITIES == 2 && PERSONALITY0_KLONGSIZE ==
	PERSONALITY1_KLONGSIZE] (current_klongsize): Likewise.
	[SUPPORTED_PERSONALITIES != 1 && (SUPPORTED_PERSONALITIES != 2 ||
	PERSONALITY0_KLONGSIZE != PERSONALITY1_KLONGSIZE)] (current_klongsize):
	New variable prototype.
	* syscall.c [!current_klongsize] (current_klongsize): New variable.
	[!current_klongsize] (personality_klongsize): New array.
	(set_personality) [!current_klongsize]: Update current_klongsize
	with the appropriate value from personality_klongsize.

2016-12-19  Dmitry V. Levin  <ldv@altlinux.org>

	configure: define SIZEOF_KERNEL_LONG_T macro.
	Provide SIZEOF_KERNEL_LONG_T macro in addition to SIZEOF_LONG and
	SIZEOF_LONG_LONG for checking of kernel_long_t and kernel_ulong_t
	types at the time of preprocessing.

	* configure.ac (AC_CHECK_SIZEOF): Add kernel_long_t.

2016-12-19  Dmitry V. Levin  <ldv@altlinux.org>

	Remove getarg_ll.
	This function has never been used in the code, and in perspective
	the whole ext_arg thing will go away.

	* defs.h (getarg_ll): Remove prototype.
	* util.c (getarg_ll): Remove.

2016-12-19  Dmitry V. Levin  <ldv@altlinux.org>

	struct tcb: make types of syscall arguments unsigned.
	This is the first step in the direction of revisiting current practice
	of indiscriminate use of signed types for syscall arguments and memory
	addresses.

	* kernel_types.h (kernel_ureg_t): New type, typedef to unsigned long.
	* defs.h (struct tcb): Change type of u_arg from long to kernel_ureg_t.
	[HAVE_STRUCT_TCB_EXT_ARG]: Change type of ext_arg from long long
	to unsigned long long.
	* desc.c (decode_select): Change type of syscall arguments from long
	to kernel_ureg_t.
	(SYS_FUNC(oldselect)): Change type of select_args from long
	to kernel_ureg_t.
	* io.c (print_lld_from_low_high_val): Remove no longer needed cast
	of syscall arguments to unsigned long.
	* lseek.c (SYS_FUNC(lseek)): Cast syscall argument from unsigned long
	to long.
	* mem.c (print_mmap): Change type of syscall arguments from long
	to kernel_ureg_t.
	(SYS_FUNC(old_mmap), SYS_FUNC(old_mmap_pgoff)): Change type of u_arg
	from long to kernel_ureg_t.
	(SYS_FUNC(mmap), SYS_FUNC(mmap_pgoff), SYS_FUNC(mmap_pgoff)): Remove
	no longer needed cast of syscall arguments to unsigned long.
	* pathtrace.c (pathtrace_match): Change type of args and select_args
	from long to kernel_ureg_t.
	* util.c (getarg_ull): Remove no longer needed casts of syscall
	arguments to unsigned types.

2016-12-19  Dmitry V. Levin  <ldv@altlinux.org>

	s390: fix decoding of mmap2 syscall when arguments are not available.
	* mem.c [S390] (SYS_FUNC(old_mmap_pgoff)): Use umove_or_printaddr
	instead of umoven to fetch mmap arguments, fix return value when this
	fetch fails.

	Fix pathmatch of oldselect syscall on 64-bit architectures.
	* pathtrace.c (pathtrace_match): Fix fetching of 32-bit oldselect
	arguments on 64-bit architectures.

	Cleanup oldselect.
	* desc.c (SYS_FUNC(oldselect)): Rewrite without use of macros.

2016-12-18  Dmitry V. Levin  <ldv@altlinux.org>

	Change scno type from long to unsigned long.
	Use an unsigned type for syscall numbers as they are not intended
	for signed arithmetics.  Introduce kernel_scno_t as a typedef
	to unsigned long, that could be changed later to kernel_ulong_t.

	* kernel_types.h (kernel_scno_t): New type, typedef to unsigned long.
	* defs.h (struct tcb): Change type of scno field from long
	to kernel_scno_t.
	(syscall_name): Change argument type from long to kernel_scno_t.
	(scno_in_range, scno_is_valid): Change argument type from unsigned long
	to kernel_scno_t.
	* linux/aarch64/set_scno.c (arch_set_scno): Change scno argument type
	from long to kernel_scno_t.
	* linux/alpha/set_scno.c (arch_set_scno): Likewise.
	* linux/arc/set_scno.c (arch_set_scno): Likewise.
	* linux/arm/set_scno.c (arch_set_scno): Likewise.
	* linux/avr32/set_scno.c (arch_set_scno): Likewise.
	* linux/bfin/set_scno.c (arch_set_scno): Likewise.
	* linux/crisv10/set_scno.c (arch_set_scno): Likewise.
	* linux/hppa/set_scno.c (arch_set_scno): Likewise.
	* linux/i386/set_scno.c (arch_set_scno): Likewise.
	* linux/ia64/set_scno.c (arch_set_scno): Likewise.
	* linux/m68k/set_scno.c (arch_set_scno): Likewise.
	* linux/metag/set_scno.c (arch_set_scno): Likewise.
	* linux/microblaze/set_scno.c (arch_set_scno): Likewise.
	* linux/mips/set_scno.c (arch_set_scno): Likewise.
	* linux/nios2/set_scno.c (arch_set_scno): Likewise.
	* linux/or1k/set_scno.c (arch_set_scno): Likewise.
	* linux/powerpc/set_scno.c (arch_set_scno): Likewise.
	* linux/riscv/set_scno.c (arch_set_scno): Likewise.
	* linux/s390/set_scno.c (arch_set_scno): Likewise.
	* linux/sh/set_scno.c (arch_set_scno): Likewise.
	* linux/sh64/set_scno.c (arch_set_scno): Likewise.
	* linux/sparc/set_scno.c (arch_set_scno): Likewise.
	* linux/tile/set_scno.c (arch_set_scno): Likewise.
	* linux/x86_64/set_scno.c (arch_set_scno): Likewise.
	* linux/xtensa/set_scno.c (arch_set_scno): Likewise.
	* linux/aarch64/get_scno.c (arch_get_scno): Change scno variable type
	from long to kernel_scno_t.
	* linux/alpha/get_scno.c (arch_get_scno): Likewise.
	* linux/arm/get_scno.c (arch_get_scno): Likewise.
	* linux/sh/get_scno.c (arch_get_scno): Likewise.
	* linux/x86_64/get_scno.c (arch_get_scno): Likewise.
	* syscall.c (arch_set_scno): Likewise.
	(shuffle_scno): Change return type from long to kernel_scno_t.
	(syscall_name): Change argument type from long to kernel_scno_t.

2016-12-18  Dmitry V. Levin  <ldv@altlinux.org>

	Lowercase SCNO_IN_RANGE and SCNO_IS_VALID.
	* defs.h (SCNO_IN_RANGE): Rename to scno_in_range.  All callers updated.
	(SCNO_IS_VALID): Rename to scno_is_valid.  All callers updated.

	Turn SCNO_IN_RANGE and SCNO_IS_VALID into static inline functions.
	* defs.h (SCNO_IN_RANGE, SCNO_IS_VALID): Transform into static inline
	functions.

	count.c: use syserror instead of direct u_error access.
	* count.c (count_syscall): Use syserror instead of u_error.

	Replace "(unsigned long) -1L" with -1UL.
	* defs.h (dumpiov): Replace "(unsigned long) -1L" with -1UL.
	* io.c (print_iovec, tprint_iov): Likewise.
	* msghdr.c (SYS_FUNC(sendmsg)): Likewise.
	* syscall.c (dumpio): Likewise.
	* poll.c (decode_poll_exiting): Replace "(unsigned int) -1" with -1U.

	Add toplevel recursive check-valgrind rule.
	* Makefile.am (.PHONY): Add check-valgrind-local.
	(check-valgrind): New rule.
	* configure.ac (AM_EXTRA_RECURSIVE_TARGETS): Add it.

	m4: fix check-valgrind-* rules generated by AX_VALGRIND_CHECK.
	* m4/ax_valgrind_check.m4 (check-valgrind-$(1)): Depend
	on $(BUILT_SOURCES), honor $(AM_MAKEFLAGS), build check-am
	instead of check-TESTS.

	travis: do coverage using a dedicated build.
	* .travis.yml (after_success): Remove.
	(matrix): Create an entry for the regular x86_64 target.
	* travis-success.sh: Merge into ...
	* travis-build.sh: ... this file.  Disable optimization
	for coverage builds.
	* travis-install.sh: Rename COVERAGE=true to CHECK=coverage.

2016-12-17  Dmitry V. Levin  <ldv@altlinux.org>

	mips n32: provide fallback definitions of kernel_long_t/kernel_ulong_t.
	* kernel_types.h [!(HAVE___KERNEL_LONG_T && HAVE___KERNEL_ULONG_T) &&
	LINUX_MIPSN32] (kernel_long_t, kernel_ulong_t): Define to long long types.

2016-12-17  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util: simplify definitions of bit mask constants in umovestr.
	* util.c (umovestr): Do not check for SIZEOF_LONG in definitions
	of bit mask constants.

	tests: check decoding of prctl operations without arguments.
	* tests/prctl-no-args.c: New file.
	* tests/prctl-no-args.test: New test.
	* tests/.gitignore: Add prctl-no-args.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add prctl-no-args.test.

	tests: check decoding of prctl PR_[GS]ET_SECUREBITS operations.
	* tests/prctl-securebits.c: New file.
	* tests/prctl-securebits.test: New test.
	* tests/.gitignore: Add prctl-securebits.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add prctl-securebits.test.

	tests: check decoding of prctl PR_[GS]ET_DUMPABLE operations.
	* tests/prctl-dumpable.c: New file.
	* tests/prctl-dumpable.test: New test.
	* tests/.gitignore: Add prctl-dumpable.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add prctl-dumpable.test.

	prctl: implement decoding of SUID_DUMP_* constants in PR_[GS]ET_DUMPABLE
	* xlat/pr_dumpable.in: New file.
	* prctl.c: Include "xlat/pr_dumpable.h".
	(SYS_FUNC(prctl)): Decode returned value of PR_GET_DUMPABLE operation
	and the second syscall argument of PR_SET_DUMPABLE operation
	as SUID_DUMP_* constants.

2016-12-16  Dmitry V. Levin  <ldv@altlinux.org>

	Include "kernel_types.h" in defs.h and tests/tests.h.
	As kernel_ulong_t type is going to be used in the definition
	of struct tcb and in many function prototypes, make it readily
	available for every source file by including "kernel_types.h"
	in defs.h and tests/tests.h files.

	* defs.h: Include "kernel_types.h".
	* tests/tests.h: Likewise.
	* desc.c: Do not include "kernel_types.h".
	* dirent.c: Likewise.
	* keyctl.c: Likewise.
	* syscall.c: Likewise.
	* linux/asm_stat.h: Likewise.
	* tests/answer.c: Likewise.
	* tests/epoll_pwait.c: Likewise.
	* tests/fanotify_init.c: Likewise.
	* tests/fanotify_mark.c: Likewise.
	* tests/file_handle.c: Likewise.
	* tests/ftruncate.c: Likewise.
	* tests/getdents.c: Likewise.
	* tests/init_delete_module.h: Likewise.
	* tests/inotify.c: Likewise.
	* tests/inotify_init1.c: Likewise.
	* tests/ioprio.c: Likewise.
	* tests/ipc_msgbuf.c: Likewise.
	* tests/kcmp.c: Likewise.
	* tests/kexec_file_load.c: Likewise.
	* tests/kexec_load.c: Likewise.
	* tests/keyctl.c: Likewise.
	* tests/lookup_dcookie.c: Likewise.
	* tests/lseek.c: Likewise.
	* tests/mq_sendrecv.c: Likewise.
	* tests/nsyscalls.c: Likewise.
	* tests/pkey_alloc.c: Likewise.
	* tests/pkey_free.c: Likewise.
	* tests/pkey_mprotect.c: Likewise.
	* tests/prctl-pdeathsig.c: Likewise.
	* tests/prctl-tsc.c: Likewise.
	* tests/preadv2-pwritev2.c: Likewise.
	* tests/process_vm_readv_writev.c: Likewise.
	* tests/read-write.c: Likewise.
	* tests/setfsugid.c: Likewise.
	* tests/setns.c: Likewise.
	* tests/truncate.c: Likewise.
	* tests/unshare.c: Likewise.
	* tests/xgetrlimit.c: Likewise.

2016-12-15  Dmitry V. Levin  <ldv@altlinux.org>

	Post-release administrivia.
	* NEWS: Add a header line for the next release.
	* debian/changelog.in: Add a changelog entry for 4.15-1.
	* strace.spec.in: Likewise.

2016-12-14  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: provide fallback definitions for NETLINK_* constants.
	As new constants have been added gradually over kernel releases, define
	all constant values to make newer constants decoded properly when strace
	is built with older kernel headers.

	* xlat/netlink_protocols.in: Add default values for constants.
	* net.c [!NETLINK_SOCK_DIAG && NETLINK_INET_DIAG]: Remove.
	* socketutils.c: Likewise.

2016-12-14  Dmitry V. Levin  <ldv@altlinux.org>

	tests: relax getaffinity return value check in tests/sched_xetaffinity.c
	* tests/sched_xetaffinity.c (errstr): New variable.
	(getaffinity, setaffinity): Initialize it.
	(main): Use it.  Allow getaffinity return value to be less than
	its cpusetsize argument.

	tests: fix threads-execve.test for large pids.
	* tests/threads-execve.c (main): Fix expected output for large pids.

2016-12-13  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for 4.15 release.
	* NEWS: Update for 4.15 release.

	.mailmap: add addresses of Thomas De Schampheleire.
	* .mailmap: Add both addresses of Thomas De Schampheleire here to avoid
	duplications in CREDITS file.

	Sync strace.spec and debian/ with packages.
	* debian/control: Add Vcs-* metadata from 4.13-0.1.
	* debian/watch: Sync with 4.13-0.1.
	* strace.spec.in: Sync with 4.14.0.100.622a-1.

2016-12-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests: workaround a bug in GNU grep.
	Workaround a bug introduced in GNU grep 2.27, for details see
	https://lists.gnu.org/archive/html/bug-grep/2016-12/msg00011.html

	* tests/init.sh (grep_pid_status): New function.
	* tests/detach-running.test: Use it instead of grep to search
	in /proc/$pid/status.
	* tests/detach-sleeping.test: Likewise.
	* tests/detach-stopped.test: Likewise.

2016-12-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: fix typo in comment inside prctl-tsc.c.

2016-12-13  Sean Stangl  <sstangl@mozilla.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	Fix libunwind segfault when -p is passed before -k.
	* strace.c (init) [USE_LIBUNWIND]: Call unwind_tcb_init after
	unwind_init for all allocated tcb structures if stack trace is enabled.
	* unwind.c (unwind_tcb_init): Skip if tcb is already initialized.

2016-12-13  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Dmitry V. Levin  <ldv@altlinux.org>

	Update NEWS.

2016-12-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests: skip fault injection tests on unsupported platforms.
	* tests/fault_injection.sh: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	* tests/fault_injection-exit_group.test: Use it.
	* tests/fault_injection.test: Likewise.

	tests: introduce require_min_kernel_version_or_skip function.
	* tests/init.sh (kernel_version_code,
	require_min_kernel_version_or_skip): New functions.
	* tests/threads-execve.test: Use require_min_kernel_version_or_skip.

2016-12-07  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add descriptions to prctl-pdeathsig and prctl-tsc tests.

2016-12-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify prctl-pdeathsig.test and prctl-tsc.test.
	Rrobustify remaining prctl tests against unrelated prctl invocations

	* tests/prctl-pdeathsig.test: Filter out unrelated PR_GET_* and PR_SET_*
	prctl calls.
	* tests/prctl-tsc.test: Likewise.

2016-12-07  Thomas De Schampheleire  <thomas.de_schampheleire@nokia.com>

	Makefile.am: don't confuse CFLAGS and CFLAGS_FOR_BUILD.
	Commit dc427d50d96b15c9a64d7e78d97ce4d194622a63 enabled a number of extra
	warning flags through configure.ac.  The configure script will determine
	dynamically if CC supports these flags before adding them to WARN_CFLAGS.

	ioctlsort is compiled with CC_FOR_BUILD, rather than CC.  Nevertheless,
	the flags passed to this compilation also include WARN_CFLAGS (through
	AM_CFLAGS).  This is incorrect: in a cross-compilation use case, CC
	and CC_FOR_BUILD are not the same.  The former is the cross-compiler,
	the latter is the host compiler.  Both may be of different versions
	and support different warning flags.

	In particular, this posed a problem when cross-compiling with a host
	compiler gcc 4.1, which does not support all the new flags:

	    /usr/bin/gcc -DHAVE_CONFIG_H   -I./linux/arm -I./linux/arm -I./linux
	    -I./linux -I. -I. -I/host-sysroot/usr/include -Wall -Wempty-body
	    -Wformat-security -Wignored-qualifiers -Winit-self -Wlogical-op
	    -Wmissing-parameter-type -Wnested-externs -Wold-style-declaration
	    -Wold-style-definition -Wsign-compare -Wtype-limits -Wwrite-strings -O2
	    -I/host-sysroot/usr/include -DIOCTLSORT_INC=\"ioctls_all0.h\" -c -o
	    ioctlsort0.o ./ioctlsort.c
	    cc1: error: unrecognized command line option "-Wempty-body"
	    cc1: error: unrecognized command line option "-Wignored-qualifiers"
	    cc1: error: unrecognized command line option "-Wlogical-op"
	    cc1: error: unrecognized command line option "-Wmissing-parameter-type"
	    cc1: error: unrecognized command line option "-Wold-style-declaration"
	    cc1: error: unrecognized command line option "-Wtype-limits"
	    make[2]: *** [ioctlsort0.o] Error 1

	* Makefile.am (AM_CFLAGS_FOR_BUILD, AM_CPPFLAGS_FOR_BUILD): New
	variables.
	(ioctlsort_CPPFLAGS): Use AM_CPPFLAGS_FOR_BUILD instead of AM_CPPFLAGS.
	(ioctlsort_CFLAGS): Use AM_CFLAGS_FOR_BUILD instead of AM_CFLAGS.
	(ioctlsort_LDFLAGS): Use AM_LDFLAGS_FOR_BUILD instead of AM_LDFLAGS.
	* m4/ax_prog_cc_for_build.m4 (AX_PROG_CC_FOR_BUILD): Redirect
	WARN_CFLAGS and gl_unknown_warnings_are_errors, call st_WARN_CFLAGS,
	substitute WARN_CFLAGS_FOR_BUILD.

2016-12-07  Dmitry V. Levin  <ldv@altlinux.org>

	m4: prepare gl_WARN_ADD for simultaneous use of multiple compilers.
	* m4/warnings.m4 (gl_COMPILER_OPTION_IF): Change gl_Flags to use
	_AC_LANG_PREFIX[]FLAGS in unquoted form.  Change gl_Warn to use gl_Flags
	instead of _AC_LANG_ABBREV.  Change notification message to mention
	the variable name of the compiler.
	(gl_UNKNOWN_WARNINGS_ARE_ERRORS): Do nothing if
	gl_unknown_warnings_are_errors is set.
	(gl_WARN_ADD): Change the use of gl_UNKNOWN_WARNINGS_ARE_ERRORS from
	AC_REQUIRE to a regular call.

2016-12-07  Dmitry V. Levin  <ldv@altlinux.org>

	AX_PROG_CC_FOR_BUILD: redirect more variables related to C compiler.
	Some of these variables cannot be redirected using traditional
	pushdef/popdef mechanism because of complex constructions like
	[ac_cv_[]_AC_LANG_ABBREV[]_compiler_gnu] employed by autoconf macros.
	Use st_SAVE_VAR/st_RESTORE_VAR to workaround this issue.

	* m4/ax_prog_cc_for_build.m4: Redirect ac_cv_prog_cc_stdc,
	ac_cv_prog_cc_c11, ac_cv_prog_cc_c99, ac_cv_prog_cc_c89,
	am_cv_prog_cc_c_o, and am_cv_CC_dependencies_compiler_type using
	pushdef/popdef.
	Redirect ac_c_decl_warn_flag, ac_c_preproc_warn_flag, ac_c_werror_flag,
	ac_compile, ac_compiler_gnu, ac_cpp, ac_cv_c_compiler_gnu,
	ac_cv_c_decl_report, and ac_link using st_SAVE_VAR/st_RESTORE_VAR.

2016-12-07  Dmitry V. Levin  <ldv@altlinux.org>

	Move all gl_WARN_ADD calls to a separate m4 macro.
	This is going to be needed for the upcoming AX_PROG_CC_FOR_BUILD
	change.

	* configure.ac: Call st_WARN_CFLAGS before AX_PROG_CC_FOR_BUILD.
	Move all gl_WARN_ADD calls ...
	* m4/st_warn_cflags.m4: ... here.

2016-12-07  Dmitry V. Levin  <ldv@altlinux.org>

	m4: introduce st_SAVE_VAR and st_RESTORE_VAR macros.
	These new macros are going to be needed for the upcoming
	AX_PROG_CC_FOR_BUILD change.

	* m4/st_save_restore_var.m4: New file.

2016-12-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add valgrind support to "make check"
	* m4/ax_valgrind_check.m4: Import from the autoconf-archive package.
	* configure.ac: Invoke AX_VALGRIND_CHECK.
	* valgrind.supp: Move to tests/strace.supp.
	* Makefile.am (EXTRA_DIST): Remove valgrind.supp.
	* tests/Makefile.am: Add @VALGRIND_CHECK_RULES@.
	(VALGRIND_FLAGS, VALGRIND_SUPPRESSIONS_FILES): New variables.
	(EXTRA_DIST): Add strace.supp.
	* tests/init.sh: Add valgrind command prefix to $STRACE when appropriate.

2016-12-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify threads-execve.test against race conditions.
	Due to probabilistic nature of the test, try it several times.

	* tests/threads-execve.c (NUMBER_OF_ITERATIONS): Change to 1.
	* tests/threads-execve.test: Iterate up to 10 times.

2016-12-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix expected output in strace-ttt.test.
	If strace -ttt is running too long, it might happen that time stamps
	before and after its invocation differ for more than a second.
	Adjust expected output to handle this rare but possible case.

	* tests/strace-ttt.test: Allow any time stamp between start and finish
	of strace invocation.

2016-12-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix expected output in strace-tt.test.
	If strace -tt is running too long, it might happen that time stamps
	before and after its invocation differ for more than a second.
	Adjust expected output to handle this rare but possible case.

	* tests/strace-tt.test: Allow any time stamp between start and finish
	of strace invocation.

2016-12-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify redirect.test against race conditions.
	Introduce a synchronization mechanism between the tracee and its peer.

	* tests/redirect.test: Change timeout file to $OUT.  Let the tracee
	remove $LOG, wait for $LOG removal in its peer.

2016-12-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify attach-f-p.test against race conditions.
	Introduce a synchronization mechanism between attach-f-p and strace.

	* tests/attach-f-p-cmd.c: New file.
	* tests/Makefile.am (check_PROGRAMS): Add attach-f-p-cmd.
	* tests/attach-f-p.c: Include <sys/stat.h>.
	(main): Write to stdout instead of descriptor 3.  Wait for the peer
	writing to stdout.
	* tests/attach-f-p.test: Assume that ./attach-f-p-cmd works.
	Use $OUT for expected output.  Use attach-f-p-cmd for unlocking $OUT.

2016-12-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify attach-p-cmd.test against race conditions.
	Introduce a synchronization mechanism between attach-p-cmd-p
	and attach-p-cmd-cmd processes.

	* tests/attach-p-cmd-cmd.c: Include <errno.h> and <sys/stat.h>.
	(main): Wait for the lock directory creation by attach-p-cmd-p.
	* tests/attach-p-cmd-p.c: Include <errno.h> and <sys/stat.h>.
	(main): Create a lock directory and wait for its removal
	by attach-p-cmd-cmd.
	* tests/attach-p-cmd.test: Assume that test programs work.

2016-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	Rewrite remaining qual_* parsers using bit sets.
	* defs.h (struct fault_opts): Replace forward declaration
	with a definition.
	(qualbits_t, qualify_read, qualify_write, qualify_signals): Remove.
	(qual_flags): New function prototype.
	(nsyscall_vec, sysent_vec, fault_vec): New variable prototypes.
	* qualify.c (abbrev_set, fault_set, raw_set, trace_set, verbose_set):
	New variables.
	(qualify_read, qualify_write, qualify_signals): Add static qualifier.
	(find_errno_by_name, lookup_class, parse_fault_expression,
	parse_fault_token, qual_flags, qualify, qualify_abbrev, qualify_fault,
	qualify_raw, qualify_syscall, qualify_syscall_class,
	qualify_syscall_name, qualify_syscall_number, qualify_syscall_tokens,
	qualify_trace, qualify_verbose, strip_prefix): New functions.
	* syscall.c (nsyscall_vec, nsysent_vec): Remove static qualifier.
	(MAX_NSYSCALLS1, MAX_NSYSCALLS2, MAX_NSYSCALLS, qual_vec, qual_flags,
	qual_fault, qual_syscall, qual_options, fault_opts, qualify_one,
	qualify_scno, lookup_class, qualify_syscall_class, qualify_syscall_name,
	qual_syscall_ex, qual_syscall, strip_prefix, find_errno_by_name,
	parse_fault_token, parse_fault_expression, qual_fault, qualify): Remove.
	(decode_socket_subcall, decode_ipc_subcall, decode_mips_subcall,
	get_scno): Update use of qual_flags.
	(inject_syscall_fault_entering): Update per-personality allocation
	of tcp->fault_vec.
	* tests/fault_injection-exit_group.test: Check parsing of inversed
	fault sets.
	* tests/fault_injection.test: Check parsing of -efault=none.
	* tests/options-syntax.test: Check parsing of invalid syscall numbers.

	Change qual_vec/qual_fault into static fixed size arrays.
	* defs.h (qual_vec, num_quals): Remove.
	(qual_flags): Move ...
	* syscall.c: ... here.
	(num_quals, num_faults, MIN_QUALS, reallocate_vec, reallocate_qual,
	reallocate_fault): Remove.
	(qual_vec, qual_fault): Change into static fixed size arrays.
	(qualify_one): Remove reallocate_qual and reallocate_fault calls.
	(qualify): Likewise.  Replace num_quals and num_faults with
	MAX_NSYSCALLS.

	Rewrite qual_signal using bit sets.
	* defs.h (signal_set): New variable prototypes.
	(qualify_signals): New function prototypes.
	(QUAL_SIGNAL): Change to a value greater than 0xff.
	(QUAL_FAULT): Change to a lower value.
	* qualify.c (signal_set): New variable.
	(sigstr_to_uint, qualify_signals): New functions.
	* syscall.c (qual_signal): Remove.
	(qual_options): Replace qual_signal with NULL.
	(qualify): Use qualify_signals.
	* strace.c (print_signalled, print_stopped): Use is_number_in_set
	with signal_set argument.

2016-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	Rewrite qual_desc using bit sets.
	As a side effect, this also fixes support of negated sets
	of descriptors.

	* defs.h (struct number_set): New forward declaration.
	(read_set, write_set): New variable prototypes.
	(is_number_in_set, qualify_read, qualify_write): New function
	prototypes.
	(QUAL_READ, QUAL_WRITE): Change to values greater than 0xff.
	* qualify.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* syscall.c (qual_desc): Remove.
	(qual_options): Replace qual_desc with NULL.
	(qualify): Use qualify_read and qualify_write.
	(dumpio): Use is_number_in_set.
	* tests/options-syntax.test: Check invalid sets of descriptors.
	* tests/readv.test: Check dumping of negated sets of descriptors.

2016-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: skip redirect-fds.test when strace is wrapped with valgrind.
	valgrind is not as transparent as strace wrt standard descriptors,
	so if strace is wrapped with valgrind, the test would check valgrind
	transparency properties and fail imminently.

	* tests/redirect-fds.test: Skip the test when $STRACE shows a presence
	of valgrind.

2016-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	Add valgrind.supp.
	As valgrind is not quite happy about the way how get_cpuset_size uses
	sched_getaffinity, add a suppression file for this case.

	* valgrind.supp: New file.
	* Makefile.am (EXTRA_DIST): Add it.

2016-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	affinity: pass 0 as a pid to sched_getaffinity.
	* affinity.c (get_cpuset_size): Pass 0 instead of getpid()
	to sched_getaffinity.

	affinity: document the method of finding out the cpuset size.
	* affinity.c (get_cpuset_size): Add a comment about sched_getaffinity.

2016-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: make options-syntax.test tolerant of strace wrappers.
	Change the test to allow wrappers like STRACE="valgrind ./strace".

	* tests/options-syntax.test: Strip all words but last from $STRACE
	variable in all contexts where the name of strace executable is expected
	in its output.

2016-12-04  Dmitry V. Levin  <ldv@altlinux.org>

	Do not allocate memory for line buffered output.
	libc is perfectly capable of allocating memory for its buffers,
	so let it do its job.

	* strace.c (init): Do not allocate memory for setvbuf invocation.

2016-12-04  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update NEWS.

	tests: use kernel_ulong_t as argument type in setfsuid/setfsgid tests.
	* setfsugid.c: Include "kernel_types.h".
	(main): Change type of entries of the "tests" array from long to
	kernel_ulong_t.

2016-12-04  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Elvira Khabirova  <lineprinter0@gmail.com>

	uid: print size as signed in setgroups/getgroups.
	As this is the type used in kernel.

	* uid.c (SYS_FUNC(setgroups), SYS_FUNC(getgroups)): Print size parameter
	as "%d".
	* tests/getgroups.c: Update expected output.
	* tests/setgroups.c: Likewise.

2016-12-04  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Elvira Khabirova  <lineprinter0@gmail.com>

	uid: use printuid for printing UID/GID value.
	* uid.c (setfsuid, get_print_uid, print_gid): Use printuid.
	* tests/setfsugid.c (printuid): New function.
	(main): Use it to print UID/GID values.
	* tests/setgroups.c: Likewise.
	* tests/setugid.c (ugid2int): Remove.
	(printuid): New function.
	(main): Use it to print UID/GID values.

2016-12-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: additional check for PTRACE_SETSIGINFO ptrace command.
	* tests/ptrace.c (main): Add an additional PTRACE_SETSIGINFO check.

2016-12-01  Dmitry V. Levin  <ldv@altlinux.org>

	syscall_name: clear __X32_SYSCALL_BIT from syscall number on x32.
	* linux/x86_64/get_scno.c (X32_PERSONALITY_NUMBER): New macro.
	* syscall.c (syscall_name) [X32_PERSONALITY_NUMBER && __X32_SYSCALL_BIT]:
	Clear __X32_SYSCALL_BIT from scno on x32 personality.

2016-12-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Print syscall names only for defined syscalls.
	The string literal "__NR_syscall_4294967295" is semantically incorrect
	as there is no such constant defined.

	* syscall.c (syscall_name): Return NULL if there is no syscall
	corresponding to the given number.
	* defs.h (syscall_name): Document this behaviour.
	* printsiginfo.c (print_si_info): Print syscall name with "__NR_" prefix
	only if there is a syscall corresponding to si_syscall number; print
	a plain syscall number otherwise.
	* tests/ptrace.c (main): Update expected output.

2016-12-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	affinity: print cpu set as an array.
	* affinity.c: Add comma between elements of cpu set.
	* tests/sched_xetaffinity.c (main): Update expected output.

	statfs: fix printing format of f_fsid field.
	* print_statfs.c: Print f_fsid as a structure containing field "val"
	which, in turn, is an array of two elements that used to be printed
	as members of f_fsid structure.
	* tests/statfs.expected: Update expected output.
	* tests/xstatfsx.c (print_statfs): Likewise.

	swap: always print priority value.
	* swapon.c (SYS_FUNC(swapon)): Do not check for non-zero the value
	of the prio variable in order to print it.
	* tests/swap.c (main): Update expected output.

2016-12-01  Elvira Khabirova  <lineprinter0@gmail.com>

	tests: show pattern line number in match_grep.
	This makes debugging of failing test  a bit easier.

	* tests/init.sh (match_grep): Add the cnt variable, increment it on every
	pattern line read, print it as a prefix for non-matched pattern.

2016-11-30  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Elvira Khabirova  <lineprinter0@gmail.com>

	futex: make output of the val3 argument of the FUTEX_WAKE_OP command more structured
	It is a number which consists of several xlat values, not a structure.

	* futex.c (SYS_FUNC(futex)): Modify output of the val3 argument
	of the FUTEX_WAKE_OP futex syscall command.
	* tests/futex.c (main): Update expected output.

2016-11-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: additional checks for prctl-* tests.
	* tests/prctl-pdeathsig.c (main): Additional checks.
	* tests/prctl-tsc.c (main): Likewise.
	* tests/prctl-pdeathsig.test: Update value of -a argument.
	* tests/prctl-tsc.test: Likewise.

2016-11-30  JingPiao Chen  <chenjingpiao@foxmail.com>

	tests: add prctl-pdeathsig.test and prctl-tsc.test.
	* tests/prctl-pdeathsig.c: New file.
	* tests/prctl-tsc.c: Likewise.
	* tests/prctl-pdeathsig.test: New test.
	* tests/prctl-tsc.test: Likewise.
	* tests/.gitignore: Add prctl-pdeathsig and prctl-tsc.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add prctl-pdeathsig.test and prctl-tsc.test.

2016-11-30  Dmitry V. Levin  <ldv@altlinux.org>

	syscall: Simplify strip_prefix.
	* syscall.c (strip_prefix): Use strncmp instead of strlen+memcmp.

	util: fix integer overflow check in string_to_uint_ex.
	* util.c (string_to_uint_ex): Fix the check for integer overflow
	on systems where LONG_MAX == INT_MAX.

	Check dumping of io syscalls when descriptor arguments are sensibly large
	* tests/tests.h (pipe_maxfd): New prototype.
	* tests/pipe_maxfd.c: New file.
	* tests/print_maxfd.c: Likewise.
	* tests/.gitignore: Add print_maxfd.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(libtests_a_SOURCES): Add pipe_maxfd.c.
	* tests/readv.c (main): Use pipe_maxfd() instead of pipe(),
	fds[0] instead of 0, fds[1] instead of 1.
	* tests/readv.test: Use print_maxfd to specify dump descriptor numbers.

	dumpio: remove useless check.
	* syscall.c (dumpio): Remove SEN_printargs check.  Use tcp->s_ent->sen
	directly.

2016-11-29  Dmitry V. Levin  <ldv@altlinux.org>

	Fix dumping of io syscalls when descriptor argument has unused bits set.
	* syscall.c (dumpio): Explicitly cast the first argument of syscall
	to "int", the same way as the kernel does.
	* tests/read-write.c: Include <asm/unistd.h> and "kernel_types.h".
	(k_read, k_write): New functions.
	(test_dump, main): Use them.

	x32: fix preadv2-pwritev2.test.
	* tests/preadv2-pwritev2.c: Include "kernel_types.h".
	(main): Use kernel_ulong_t instead of unsigned long as types
	of arguments of preadv2 and pwritev2 syscalls.

	x32: wire up preadv2 and pwritev2 syscalls.
	* linux/x32/syscallent.h [546]: Add preadv2 entry.
	[547]: Add pwritev2 entry.

2016-11-29  Eugene Syromyatnikov  <evgsyr@gmail.com>
	    Elvira Khabirova  <lineprinter0@gmail.com>

	signal: fix omission of field names in sigaction printers.
	* signal.c (decode_old_sigaction, decode_new_sigaction): Add printing
	of the field names.
	* tests/sigaction.awk: Update expected output.

2016-11-29  Elvira Khabirova  <lineprinter0@gmail.com>

	Make date output format conform to ISO 8601.
	* util.c (sprinttime): Make date output conform to ISO 8601.
	* tests/utime.c (print_tm): Update expected output.
	* tests/xstatx.c (print_time): Likewise.

2016-11-29  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rewrite utime.test without relying on libc utime wrapper.
	* tests/utime.c (k_utime): New function, a thin wrapper around
	syscall(__NR_utime).
	(main): Use it instead of utime.
	* tests/utime.test: Update.

2016-11-29  Dmitry V. Levin  <ldv@altlinux.org>

	Fix meaning of negated sets in fault expressions.
	Change the parser of fault expression to follow the POLA:
	-e fault=!SET
	means that all syscalls except those from SET are subject to fault
	injection;
	-e fault=!SET1:error=ERRNO1, -e fault=!SET2:error=ERRNO2
	means that all syscalls except those from SET2 are subject to fault
	injection with error code ERRNO2, and all syscalls from SET2 that are
	not in SET1 are subject to fault injection with error code ERRNO1.

	* syscall.c (qualify_scno, qualify_syscall_class, qualify_syscall_name):
	Handle negated QUAL_FAULT case differently.
	* tests/fault_syntax.test: Add checks of negated sets.

2016-11-29  Eugene Syromyatnikov  <evgsyr@gmail.com>

	print_sigevent: fix field names of sigev_value structure.
	* print_sigevent.c (print_sigevent): Change "int" to "sival_int", "ptr"
	to "sival_ptr".
	* tests/mq_sendrecv.c (main): Update expected output in accordance with
	fixed field names.
	* tests/timer_create.c (main): Likewise.

	tests: add more utime checks.
	* tests/utime.c: Include <unistd.h> and <asm/unistd.h>.
	(main): Add checks for invalid pointers.

	utime: fix omission of field names in utimbuf structure printing.
	* utime.c (SYS_FUNC(utime)): Print struct utimbuf as a structure,
	not as an array (use curly brackets instead of square ones).
	Add field names to the output.
	* tests/utime.c (main): Update expected output.

	mem: print mincore output as an array.
	* mem.c (SYS_FUNC(minore)): Print commas between elements.
	* tests/mincore.c (print_mincore): Update expected output in accordance
	with syscall decoder formatting change.

2016-11-29  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util: provide information whether xlat value has been found.
	This is necessary for the upcoming change in the output format
	of the val3 argument of the FUTEX_WAKE_OP futex command.

	* defs.h (printxvals, printxval_searchn): Change return type to int.
	(printxval64, printxval, printxval_long): Likewise.  Forward the value
	returned by printxvals call.
	* util.c (printxvals, printxval_searchn): Change return type to int,
	return 1 if xlat value has been found, 0 otherwise.

2016-11-29  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util: check dflt argument for NULL in printxvals.
	This is necessary for the upcoming change in the output format
	of the val3 argument of the FUTEX_WAKE_OP futex command.

	* util.c (printxvals): Do not print dflt if it is NULL.

2016-11-29  Eugene Syromyatnikov  <evgsyr@gmail.com>

	capability: fix omission of capability structure field names.
	* capability.c (print_cap_header, print_cap_data): Add field names
	to the output.
	* tests/caps.awk: Update test output.

2016-11-28  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix "comparison between signed and unsigned" compilation warnings
	* tests/readv.c (main): Cast r_len to int.
	* tests/preadv2-pwritev2.c (dumpio): Likewise.

	aarch64, arm, sparc: add comments on fault injection support in kernel.
	* linux/aarch64/set_scno.c: Note the kernel commit that introduced
	NT_ARM_SYSTEM_CALL support.
	* linux/arm/set_scno.c: Note the kernel commit that introduced
	PTRACE_SET_SYSCALL support.
	* linux/sparc/set_scno.c: Note the kernel commit that introduced
	reloading from the syscall number register.

	tests: check -C option.
	* tests/strace-C.expected: New file.
	* tests/strace-C.test: New test.
	* tests/Makefile.am (MISC_TESTS): Add strace-C.test.
	(EXTRA_DIST): Add strace-C.expected.

	tests: check basic options syntax.
	* tests/options-syntax.test: New file.
	* tests/Makefile.am (MISC_TESTS): Add it.

2016-11-28  Dmitry V. Levin  <ldv@altlinux.org>

	Fix -r option syntax.
	While -r option implies -t, it should not literally have the effect
	of -t option, e.g. -rr should not increment tflag twice.

	* strace.c (init): In the getopt loop, do not increment tflag for each
	occurrence of -r option.  After the getopt loop, if rflag is set, set
	tflag to 1.  Issue a warning that -tt has no effect with -r.

2016-11-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Print timeval pair as an array of timeval entries.
	* print_timeval.c (print_timeval_item): New function.
	(print_timeval_pair): Use it as a print_function in print_array call.
	* tests/futimesat.c (main): Update to test new behaviour.
	* tests/utimes.c (main): Likewise.

	tests: treat tv_sec/tv_usec as signed types in futimesat and utimes tests
	* tests/futimesat.c: Print tv_sec and tv_usec fields as signed types.
	* tests/utimes.c: Likewise.

2016-11-28  Dmitry V. Levin  <ldv@altlinux.org>

	alpha: print struct timeval32 consistently.
	* defs.h [ALPHA] (timeval32_t): New type.
	[ALPHA] (print_timeval32_t): New prototype.
	* print_timeval.c [ALPHA] (timeval32_t): Remove.
	[ALPHA] (print_timeval32_t): Remove static keyword.
	* printrusage.c [ALPHA] (printrusage32): Use timeval32_t instead
	of local definition of struct timeval32.  Use print_timeval32_t.

2016-11-28  Dmitry V. Levin  <ldv@altlinux.org>

	Print struct timeval consistently.
	Use print_struct_timeval interface to print struct timeval.

	* print_timeval.c (print_struct_timeval): New mpers printer.
	* print_timex.c (print_timex): Use it.
	* printrusage.c (printrusage): Likewise.
	* v4l2.c (print_v4l2_buffer): Likewise.
	* tests/getrusage.c (main): Print tv_sec and tv_usec fields as signed.
	* tests/waitid.c (sprint_rusage): Likewise.

	Suggested-by: Eugene Syromyatnikov <evgsyr@gmail.com>

2016-11-28  Dmitry V. Levin  <ldv@altlinux.org>

	Split print_time.c.
	After commit v4.14-136-g151d1d1 that removed the last object common
	for timespec and timeval parsers there is no need to keep them all
	in a single file.

	* print_timespec.c: New file.
	* print_timeval.c: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* print_time.c: Move all timespec related code to print_timespec.c.
	Move all timeval related code to print_timeval.c.

2016-11-28  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of threads when a non-leader thread invokes execve
	* tests/threads-execve.c: New file.
	* tests/threads-execve.test: New test.
	* tests/.gitignore: Add threads-execve.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(threads_execve_LDADD): New variable.
	(MISC_TESTS): Add threads-execve.test.

2016-11-27  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of fault injected exit_group syscall.
	* tests/answer.c: New file.
	* tests/fault_injection-exit_group.expected: Likewise.
	* tests/fault_injection-exit_group.test: New test.
	* tests/.gitignore: Add answer.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add fault_injection-exit_group.test.
	(EXTRA_DIST): Add fault_injection-exit_group.expected.

2016-11-27  Dmitry V. Levin  <ldv@altlinux.org>

	Set PTRACE_O_TRACEEXIT option and handle PTRACE_EVENT_EXIT events.
	Do not assume that some syscalls do not generate syscall-exit-stops.
	When syscalls fail for any reason they may generate syscall-exit-stops.

	The solution is to wait for an actual exit reported by PTRACE_EVENT_EXIT
	and print the end of unfinished exiting syscall properly.

	* exit.c: Remove.
	* Makefile.am (strace_SOURCES): Remove exit.c.
	* linux/dummy.h (sys_exit): Alias to printargs_d.
	* strace.c (ptrace_setoptions): Add PTRACE_O_TRACEEXIT bit.
	(print_event_exit): New function.
	(trace): Use it in case of PTRACE_EVENT_EXIT.
	* syscall.c (trace_syscall_entering): Remove special handling
	of SEN_exit.

2016-11-27  Dmitry V. Levin  <ldv@altlinux.org>

	Change printargs to return RVAL_DECODED.
	As printargs is invoked as a generic syscall decoder only and
	it is not supposed to print anything on exiting, change printargs
	to return RVAL_DECODED so it would not be called on exiting at all.

	* util.c (printargs): Print args unconditionally, return RVAL_DECODED.

2016-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	Enhance error diagnostics of exit/exit_group decoder.
	* exit.c (SYS_FUNC(exit)): Print the name of syscall that has returned.

2016-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	Restrain from fault injection while the trace executes strace code.
	There is little use in injections of faults into syscalls made by strace.

	* syscall.c (trace_syscall_entering): Clear QUAL_FAULT bit from
	tcp->qual_flg when tcp->flags has TCB_HIDE_LOG bit set.

2016-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	Move two global flags to tracee scope.
	A simultaneous use of -p option and tracing of a command available
	since commit v4.11-183-gfa8c286 introduces a race condition because
	the flags whether the first exec has happened are global.

	Fix the race by moving hide_log_until_execve and hide_log_until_execve
	global variables to TCB_HIDE_LOG and TCB_SKIP_DETACH_ON_FIRST_EXEC bits
	in struct tcb.flags, correspondingly.

	* defs.h (TCB_HIDE_LOG, TCB_SKIP_DETACH_ON_FIRST_EXEC, hide_log):
	New macros.
	(hide_log_until_execve): Remove prototype.
	* strace.c (skip_one_b_execve, hide_log_until_execve): Remove.
	(startup_child): Set TCB_HIDE_LOG and TCB_SKIP_DETACH_ON_FIRST_EXEC bits
	in the allocated tcb structure.
	(init): Remove initialization of hide_log_until_execve and
	skip_one_b_execve.
	(print_stopped): Use hide_log() instead of hide_log_until_execve.
	(trace): Check and clear TCB_SKIP_DETACH_ON_FIRST_EXEC flag instead
	of skip_one_b_execve.
	* syscall.c (trace_syscall_entering): Clear TCB_HIDE_LOG flag instead of
	hide_log_until_execve.
	(trace_syscall_entering, trace_syscall_exiting): Check hide_log()
	instead of hide_log_until_execve.

2016-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	Treat execveat as an execve family syscall.
	* syscall.c (trace_syscall_entering): Clear hide_log_until_execve flag
	also when SEN_execveat is encountered.

2016-11-25  Dmitry V. Levin  <ldv@altlinux.org>

	Change parser of fault expressions to conform the documentation.
	Make expressions like fault=SYSCALL1,SYSCALL2:error=EPERM work
	as documented, i.e. fail both SYSCALL1 and SYSCALL2 with EPERM.

	* syscall.c (parse_fault_expression): Remove const qualifier from
	"name" and "token: variables, as well as from the return value.
	(qual_fault): Remove const qualifier from "name" variables.
	Split "name" into comma delimited tokens and pass each token
	to individual qual_syscall_ex call.
	(qualify): For QUAL_FAULT options, pass the whole option value
	to their qualify methods without prior splitting into comma
	delimited tokens.
	* tests/fault_injection.test: Check it.
	* tests/fault_syntax.test: Check empty syscall sets.

2016-11-24  Dmitry V. Levin  <ldv@altlinux.org>

	Simplify parse_fault_expression.
	* syscall.c (parse_fault_expression): Rewrite iterator over strtok_r
	in a more concise way.

2016-11-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Fix omission of field names in printers of timeval structure.
	* print_time.c (time_fmt): Remove.
	(timeval_fmt): New constant.
	(print_timeval_t, sprint_timeval, print_timeval32_t, sprint_timeval32):
	Use it instead of time_fmt.
	* print_timex.c (print_timex): Print field names of the time field.
	* printrusage.c (printrusage, printrusage32): Print field names
	of ru_utime and ru_stime fields.
	* tests/adjtimex.c (main): Add field names to expected output.
	* tests/clock_nanosleep.c (main): Likewise.
	* tests/futimesat.c (main): Likewise.
	* tests/getrusage.c (main): Likewise.
	* tests/nanosleep.c (main): Likewise.
	* tests/oldselect.expected: Likewise.
	* tests/utimes.c (main): Likewise.
	* tests/wait4.c (sprint_rusage): Likewise.
	* tests/waitid.c (sprint_rusage): Likewise.
	* tests/xetitimer.c (main): Likewise.
	* tests/xettimeofday.c (main): Likewise.
	* tests/xselect.c (main): Likewise.

	Fix omission of field names in printers of timespec structure.
	* print_time.c (timespec_fmt): New constant.
	(print_timespec_t, sprint_timespec): Use it instead of time_fmt.
	* tests/aio.c: Add field names to expected output.
	* tests/clock_nanosleep.c (main): Likewise.
	* tests/clock_xettime.c (main): Likewise.
	* tests/futex.c (main): Likewise.
	* tests/mq_sendrecv.c (do_send, do_recv): Likewise.
	* tests/nanosleep.c (main): Likewise.
	* tests/ppoll-v.expected: Likewise.
	* tests/ppoll.expected: Likewise.
	* tests/pselect6.c (main): Likewise.
	* tests/recvmmsg-timeout.c (main): Likewise.
	* tests/restart_syscall.c (main): Likewise.
	* tests/rt_sigtimedwait.c (iterate, main): Likewise.
	* tests/sched_rr_get_interval.c (main): Likewise.
	* tests/semop.c (main): Likewise.
	* tests/strace-T.expected: Likewise.
	* tests/timer_xettime.c (main): Likewise.
	* tests/timerfd_xettime.c (main): Likewise.
	* tests/utimensat.c (print_ts): Likewise.

2016-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify prctl-name.test against unrelated prctl invocations.
	* tests/prctl-name.test: Filter out unrelated PR_GET_* prctl calls.

2016-11-22  Dmitry V. Levin  <ldv@altlinux.org>

	tests: cleanup prctl-name.c.
	* tests/prctl-name.c (main): Remove "len" variable, rename "len1"
	to "len".  Remove "name1" variable, use "name" instead.

	Move KVM_* ioctl entries from ioctls_inc*.h to ioctls_arch*.h.
	* linux/32/ioctls_inc_align32.h: Regenerate.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/arm/ioctls_arch0.h: Likewise.
	* linux/i386/ioctls_arch0.h: Likewise.
	* linux/powerpc/ioctls_arch0.h: Likewise.
	* linux/s390/ioctls_arch0.h: Likewise.
	* linux/s390x/ioctls_arch0.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* linux/x86_64/ioctls_arch0.h: Likewise.

	maint: add more workarounds for alpha and powerpc.
	* maint/ioctls_sym.sh: Skip asm/core_*.h.  Filter out from
	asm-generic/ioctls.h those macros that are defined using unavailable
	struct termios2 on alpha and powerpc.

2016-11-22  Andreas Schwab  <schwab@linux-m68k.org>

	Add ioctl definitions for 16-bit alignment.
	* Makefile.am (EXTRA_DIST): Add linux/32/ioctls_inc_align16.h.
	* linux/32/ioctls_inc_align16.h: New file.
	* linux/32/ioctls_inc.h [M68K]: Include it.

2016-11-22  Dmitry V. Levin  <ldv@altlinux.org>

	maint: move KVM_* constants from ioctls_inc.h to ioctls_arch.h.
	* maint/ioctls_gen.sh: Place constants defined in linux/kvm.h
	into ioctls_arch.h instead of ioctls_inc.h.

2016-11-21  Dmitry V. Levin  <ldv@altlinux.org>

	maint: harmonize use of ioctls_sym.sh.
	* maint/ioctls_gen.sh: Consistently specify INCLUDES for all
	ioctls_sym.sh invocations.  Use $mydir to specify ioctls_sym.sh
	location.

	maint: rework workarounds for linux/kvm.h.
	* maint/ioctls_sym.sh: Remove pre-include linux/kvm.h workarounds.
	Skip linux/kvm.h on those architectures that have no asm/kvm.h file.
	Introduce post-process workarounds, add post-process workarounds
	for linux/kvm.h.

2016-11-20  Elvira Khabirova  <lineprinter0@gmail.com>

	Restructure strace.1.
	* strace.1 (OPTIONS): Add subsections.
	(PROBLEMS): Rename to REPORTING BUGS.
	(SEE ALSO): Move to the bottom.

2016-11-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	prctl: implement decoding of PR_SET_FP_MODE and PR_GET_FP_MODE options.
	* xlat/pr_fp_mode.in: New file.
	* prctl.c: Include "xlat/pr_fp_mode.h".
	(SYS_FUNC(prctl)): Add handling for PR_SET_FP_MODE and PR_GET_FP_MODE
	options.

	prctl: add braces for conditional blocks with else/else-if blocks having braces

2016-11-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	prctl: cast arg2 to int in PR_SET_PTRACER handler.
	Kernel code does this when compares it with -1 (apart from comparing it with
	PR_SET_PTRACER_ANY, which is also -1) in security/yama/yama_lsm.c.

	* prctl.c (SYS_FUNC(prctl)) <PR_SET_PTRACER>: Cast arg2 to int before
	comparing it with -1.

2016-11-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	prctl: use getarg_ull for option value retrieval.
	The prctl syscall does not use compat on x32/n32, so argument types
	are in fact kernel_ulong_t.

	* prctl.c (print_prctl_args): Use getarg_ull, print as "%#llx" instead
	of "%#lx".
	(SYS_FUNC(prctl)): Use getarg_ull to store call arguments in arg2, arg3,
	arg4, arg5 variables of type unsigned long long.  Use them in printing
	routines.
	(SYS_FUNC(arch_prctl)): Use getarg_ull to store call argument in addr
	variable of type unsigned long long.  Print it as "%#llx" instead of
	"%#lx".

2016-11-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	block: add some definitions from <linux/blkpg.h>
	This is done in order to fix build error on old distributions where
	struct blkpg_ioctl_arg declaration is broken:

	In file included from block.c:35:
	/usr/include/linux/blkpg.h:36: error: expected ':', ',', ';', '}' or '__attribute__' before '*' token
	block.c: In function 'print_blkpg_req':
	block.c:113: error: 'struct_blkpg_ioctl_arg' has no member named 'data'

	(from SLE10)

	* block.c: Include <linux/ioctl.h> instead of <linux/blkpg.h>.
	(BLKPG, BLKPG_DEVNAMELTH, BLKPG_VOLNAMELTH): New macros.
	(struct_blkpg_ioctl_arg, struct_blkpg_partition): New definitions,
	copied from blkpg_ioctl_arg and blkpg_partition structures defined
	in <linux/blkpg.h>.

2016-11-20  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add values to new ARCH_* constants.
	Since UAPI header declares them under CONFIG_CHECKPOINT_RESTORE
	and they would never be defined in user space.

	* xlat/archvals.in: Add numeric values to ARCH_MAP_VDSO_* constants.

2016-11-20  Dmitry V. Levin  <ldv@altlinux.org>

	prctl: include <linux/prctl.h> instead of <sys/prctl.h>
	There are no users of prctl function in prctl.c, and all the rest
	is provided by <linux/prctl.h> anyway.

	* prctl.c: Include <linux/prctl.h> instead of <sys/prctl.h>.

2016-11-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of prctl PR_GET_NAME/PR_SET_NAME operations.
	* tests/prctl-name.c: New file.
	* tests/prctl-name.test: New test.
	* tests/.gitignore: Add prctl-name.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add prctl-name.test.

	prctl: fix printing of PR_SET_NAME's argument.
	* prctl.c (SYS_FUNC(prctl)): Use printstr_ex with QUOTE_0_TERMINATED
	instead of printstr to print the argument of PR_SET_NAME and PR_GET_NAME
	operations.

	printstr_ex: fix handling of last byte when QUOTE_0_TERMINATED bit set.
	* util.c (printstr_ex): Simplify handling of size == 0 case.
	Do not artificially decrement size when QUOTE_0_TERMINATED bit is set.
	Ensure that str[size] byte is non-zero if it hasn't been fetched.

2016-11-19  Dmitry V. Levin  <ldv@altlinux.org>

	printstr_ex: handle QUOTE_0_TERMINATED bit consistently.
	When user_style has QUOTE_0_TERMINATED bit set, printstr_ex prints
	the fetched string as a NUL-terminated.
	After this change, the string is being fetched as a NUL-terminated, too.

	* util.c (printstr_ex): Use umovestr instead of umoven
	if QUOTE_0_TERMINATED bit is set.

2016-11-19  Dmitry V. Levin  <ldv@altlinux.org>

	Cleanup fetch part of printstr_ex.
	* util.c (printstr_ex): Initialize "style" early, unify error handling.

2016-11-18  Dmitry V. Levin  <ldv@altlinux.org>

	Update prctl ARCH_* constants.
	* xlat/archvals.in: Add ARCH_MAP_VDSO_X32, ARCH_MAP_VDSO_32, and
	ARCH_MAP_VDSO_64 introduced by linux kernel commit v4.9-rc1~155^2~6.

	Update V4L2_* constants.
	* xlat/v4l2_device_capabilities_flags.in: Add V4L2_CAP_TOUCH introduced
	by linux kernel commit v4.9-rc4~7^2~422.
	* xlat/v4l2_input_types.in: Add V4L2_CAP_TOUCH introduced
	by linux kernel commit v4.9-rc4~7^2~422.

	Update fs *_MAGIC constants.
	* xlat/fsmagic.in: Add DAXFS_MAGIC introduced by linux kernel commit
	v4.9-rc1~45^2^2~5.

	Update MS_* constants.
	* xlat/mount_flags.in: Add MS_NOREMOTELOCK introduced
	by linux kernel commit v4.9-rc1~57^2~1^2~7.

	Update FALLOC_* constants.
	* xlat/falloc_flags.in: Add FALLOC_FL_UNSHARE_RANGE introduced
	by linux kernel commit v4.9-rc1~31^2~69.

	Update BTRFS_* constants.
	* xlat/btrfs_features_compat_ro.in: Add
	BTRFS_FEATURE_COMPAT_RO_FREE_SPACE_TREE_VALID introduced
	by linux kernel commit v4.9-rc1~7^2^2~4.

	Update BPF_* constants.
	* xlat/bpf_prog_types.in: Add BPF_PROG_TYPE_PERF_EVENT introduced
	by linux kernel commit v4.9-rc1~127^2~302^2~4.

2016-11-18  Eugene Syromyatnikov  <evgsyr@gmail.com>

	make-dist: use HEAD for making distribution package.
	* make-dist: Use HEAD commit instead of master branch by default.

2016-11-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix btrfs build error on some old systems.
	Fix the following build error on SLE 11 SP4:

	btrfs.c: In function 'btrfs_test_dev_replace_ioctl':
	btrfs.c:1570: error: unknown field 'start' specified in initializer

	* tests/btrfs.c (btrfs_test_dev_replace_ioctl): Move initialization
	of struct btrfs_ioctl_dev_replace_args.start.srcdevid out of the
	designated initializer.

2016-11-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of ERESTARTSYS error code.
	* tests/erestartsys.c: New file.
	* tests/erestartsys.test: New test.
	* tests/.gitignore: Add erestartsys.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add erestartsys.test.

2016-11-18  Dmitry V. Levin  <ldv@altlinux.org>

	Fix signame usage in qual_signal.
	Do not assume that the string returned by signame starts with "SIG"
	prefix, this is not always the case.

	* syscall.c (qual_signal): Skip signame return value
	when it does not have "SIG" prefix.

2016-11-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check -e signal=set syntax.
	* tests/qual_signal.c: New file.
	* tests/qual_signal.test: New test.
	* tests/.gitignore: Add qual_signal.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(MISC_TESTS): Add qual_signal.test.

2016-11-17  Dmitry V. Levin  <ldv@altlinux.org>

	Make -e fault= expressions cumulative.
	Change the way how subsequent -e fault= expressions are interpreted
	to implement a cumulative behavior.  For example,
	-e fault=file:when=3+ -e fault=chdir
	now specifies that all chdir syscalls and 3+ file related syscalls
	except chdir are subject for fault injection.

	* syscall.c (qualify): Do not reset qual_vec for QUAL_FAULT.
	* tests/fault_injection.test: Check it.

2016-11-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check syscall fault injection.
	* tests/fault_injection.c: New file.
	* tests/fault_injection.test: New test.
	* tests/fault_syntax.test: Likewise.
	* tests/.gitignore: Add fault_injection.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(MISC_TESTS): Add fault_injection.test and fault_syntax.test.

2016-11-16  Dmitry V. Levin  <ldv@altlinux.org>

	Implement syscall fault injection.
	Introduce new -e fault=EXPR syntax that can be used to specify a subset
	of syscalls that are subject of syscall fault injection, an error code
	that has to be injected, and a frequency of injection.

	The expression specifying syscall fault injection has the following
	format: SET[:error=ERRNO][:when=FIRST[+[STEP]]]
	where only SET is a required part and all the rest is optional.

	The method used to implement syscall fault injection is the following:
	on entering syscall the syscall number is substituted by an invalid
	syscall number -1, and on exiting syscall the error code returned by
	the kernel is substituted with the error code specified in the fault
	expression.

	This implementaion is based on the prototype developed
	by Nahim El Atmani as a part of his GSoC 2016 strace project.

	* defs.h (struct fault_opts): New forward declaration.
	(struct tcb): Add fault_vec field.
	(TCB_FAULT_INJ, QUAL_FAULT): New macros.
	* strace.1: Document -e fault expression syntax.
	* strace.c (usage): Mention -e fault expression.
	(droptcb): Deallocate fault_vec member.
	* syscall.c (qual_fault, arch_set_scno, arch_set_error): New prototypes.
	(qual_options): Add "fault" option.
	(struct fault_opts): New structure.
	(num_faults): New variable.
	(fault_vec): New array.
	(syscall_fault_injected, tcb_fault_opts, reallocate_fault,
	find_errno_by_name, qual_syscall_ex, strip_prefix, parse_fault_token,
	parse_fault_expression, qual_fault, inject_syscall_fault_entering,
	update_syscall_fault_exiting): New functions.
	(qual_syscall): Use qual_syscall_ex.
	(qualify_one): Add argument: a pointer to struct fault_opts, all callers
	changed.  Copy struct fault_opts from the pointer to fault_vec.
	Use reallocate_fault.
	(qualify_scno, qualify_syscall_class, qualify_syscall_name): Add
	argument: a pointer to struct fault_opts.
	(qualify): Use reallocate_fault.  Do not check "all" class for
	QUAL_FAULT qualifier.
	(lookup_class): Check for "all" class.
	(trace_syscall_entering): Use inject_syscall_fault_entering.
	(trace_syscall_exiting): Use update_syscall_fault_exiting.  Clear
	TCB_FAULT_INJ flag along with TCB_INSYSCALL.  Print " (INJECTED)" suffix
	when the syscall has been injected successfully.
	[ARCH_REGS_FOR_GETREGSET && !HAVE_GETREGS_OLD]
	(ptrace_setregset): New function.
	(ptrace_setregset_or_setregs): Define to ptrace_setregset.
	[ARCH_REGS_FOR_GETREGS && !HAVE_GETREGS_OLD]
	(ptrace_setregs): New function.
	(ptrace_setregset_or_setregs): Define to ptrace_setregs.
	[ptrace_setregset_or_setregs] (set_regs): New function.
	Include "set_scno.c" and "set_error.c"
	* NEWS: Mention this enhancement.

2016-11-16  Dmitry V. Levin  <ldv@altlinux.org>

	Implement arch specific methods of changing syscall number and error code
	This introduces arch_set_error and arch_set_scno functions for each
	supported architecture, needed to implement syscall fault injection.

	* linux/aarch64/set_error.c: New file.
	* linux/aarch64/set_scno.c: Likewise.
	* linux/alpha/set_error.c: Likewise.
	* linux/alpha/set_scno.c: Likewise.
	* linux/arc/set_error.c: Likewise.
	* linux/arc/set_scno.c: Likewise.
	* linux/arm/set_error.c: Likewise.
	* linux/arm/set_scno.c: Likewise.
	* linux/avr32/set_error.c: Likewise.
	* linux/avr32/set_scno.c: Likewise.
	* linux/bfin/set_error.c: Likewise.
	* linux/bfin/set_scno.c: Likewise.
	* linux/crisv10/set_error.c: Likewise.
	* linux/crisv10/set_scno.c: Likewise.
	* linux/crisv32/set_error.c: Likewise.
	* linux/crisv32/set_scno.c: Likewise.
	* linux/hppa/set_error.c: Likewise.
	* linux/hppa/set_scno.c: Likewise.
	* linux/i386/set_error.c: Likewise.
	* linux/i386/set_scno.c: Likewise.
	* linux/ia64/set_error.c: Likewise.
	* linux/ia64/set_scno.c: Likewise.
	* linux/m68k/set_error.c: Likewise.
	* linux/m68k/set_scno.c: Likewise.
	* linux/metag/set_error.c: Likewise.
	* linux/metag/set_scno.c: Likewise.
	* linux/microblaze/set_error.c: Likewise.
	* linux/microblaze/set_scno.c: Likewise.
	* linux/mips/set_error.c: Likewise.
	* linux/mips/set_scno.c: Likewise.
	* linux/nios2/set_error.c: Likewise.
	* linux/nios2/set_scno.c: Likewise.
	* linux/or1k/set_error.c: Likewise.
	* linux/or1k/set_scno.c: Likewise.
	* linux/powerpc/set_error.c: Likewise.
	* linux/powerpc/set_scno.c: Likewise.
	* linux/powerpc64/set_error.c: Likewise.
	* linux/powerpc64/set_scno.c: Likewise.
	* linux/riscv/set_error.c: Likewise.
	* linux/riscv/set_scno.c: Likewise.
	* linux/s390/set_error.c: Likewise.
	* linux/s390/set_scno.c: Likewise.
	* linux/s390x/set_error.c: Likewise.
	* linux/s390x/set_scno.c: Likewise.
	* linux/sh/set_error.c: Likewise.
	* linux/sh/set_scno.c: Likewise.
	* linux/sh64/set_error.c: Likewise.
	* linux/sh64/set_scno.c: Likewise.
	* linux/sparc/set_error.c: Likewise.
	* linux/sparc/set_scno.c: Likewise.
	* linux/sparc64/set_error.c: Likewise.
	* linux/sparc64/set_scno.c: Likewise.
	* linux/tile/set_error.c: Likewise.
	* linux/tile/set_scno.c: Likewise.
	* linux/x32/set_error.c: Likewise.
	* linux/x32/set_scno.c: Likewise.
	* linux/x86_64/set_error.c: Likewise.
	* linux/x86_64/set_scno.c: Likewise.
	* linux/xtensa/set_error.c: Likewise.
	* linux/xtensa/set_scno.c: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.

2016-11-16  Dmitry V. Levin  <ldv@altlinux.org>

	cris: add syscall tables.
	The incomplete CRIS support introduced by commit v4.5.18-77-gea0e6e8
	should not have been merged because it lacks essential parts, e.g.
	syscall tables.

	This change adds missing syscall tables for crisv10 and crisv32.

	* linux/crisv10/syscallent.h: New file.
	* linux/crisv32/syscallent.h: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.

2016-11-16  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce string_to_uint_ex and string_to_uint_upto functions.
	* defs.h (string_to_uint_ex): New prototype.
	(string_to_uint_upto): New function, a thin wrapper around
	string_to_uint_ex.
	* util.c (string_to_uint_ex): New function.
	(string_to_uint): Change into a thin wrapper around string_to_uint_upto.
	* strace.c (init): Use string_to_uint_upto.
	* syscall.c (qualify_scno, qual_signal, qual_desc): Use
	string_to_uint_upto instead of string_to_uint.

2016-11-16  Dmitry V. Levin  <ldv@altlinux.org>

	Split qual_syscall into separate functions.
	Split qual_syscall into qualify_scno, qualify_syscall_class,
	and qualify_syscall_name.
	This might be needed later to implement syscall fault injection.

	* syscall.c (qualify_scno, qualify_syscall_class, qualify_syscall_name):
	New functions.
	(qual_syscall): Use them.

2016-11-15  Dmitry V. Levin  <ldv@altlinux.org>

	xtensa: wire up new syscalls.
	* linux/xtensa/syscallent.h [342..347]: New entries.

2016-11-14  Dmitry V. Levin  <ldv@altlinux.org>

	arc: wire up new syscalls.
	* linux/arc/syscallent.h [247, 248]: New entries.

2016-11-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix potential compilation warning in ioctl_block.c.
	ioctl_block.c:48: warning: 'init_magic' defined but not used

	* tests/ioctl_block.c (init_magic): Define only for
	[BLKTRACESETUP && HAVE_STRUCT_BLK_USER_TRACE_SETUP].

2016-11-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add support for pkey_mprotect, pkey_alloc, pkey_free syscalls.
	* linux/32/syscallent.h: Add syscall entries for pkey_* calls.
	* linux/64/syscallent.h: Likewise.
	* linux/arm/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* mem.c (do_mprotect): New function, common handler for mprotect and
	pkey_mprotect.
	(SYS_FUNC(mprotect)): Convert to wrapper around do_mprotect.
	(SYS_FUNC(pkey_mprotect)): New function.
	* xlat/pkey_access.in: New file.
	* pkeys.c: New file containing implementation of pkey_alloc and
	pkey_free.
	* Makefile.am: Add it.
	* NEWS: Mention this enhancement.
	* tests/.gitignore: Add pkey_alloc, pkey_free, and pkey_mprotect.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add pkey_alloc.test, pkey_free.test, and
	pkey_mprotect.test.
	* tests/pkey_alloc.c: New file.
	* tests/pkey_free.c: Likewise.
	* tests/pkey_mprotect.c: Likewise.
	* tests/pkey_alloc.test: New test.
	* tests/pkey_free.test: Likewise.
	* tests/pkey_mprotect.test: Likewise.

2016-11-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: fix "constant is too large" compilation warnings.
	alarm.c: In function 'main':
	alarm.c:41: warning: integer constant is too large for 'long' type
	aio.c: In function 'main':
	aio.c:162: warning: integer constant is too large for 'long' type
	btrfs.c: In function 'btrfs_test_sync_ioctls':
	btrfs.c:202: warning: integer constant is too large for 'long' type
	btrfs.c: In function 'btrfs_test_subvol_ioctls':
	btrfs.c:289: warning: integer constant is too large for 'long' type
	btrfs.c:290: warning: integer constant is too large for 'long' type
	dup2.c: In function 'main':
	dup2.c:12: warning: integer constant is too large for 'long' type
	dup2.c:13: warning: integer constant is too large for 'long' type
	dup3.c: In function 'main':
	dup3.c:13: warning: integer constant is too large for 'long' type
	dup3.c:14: warning: integer constant is too large for 'long' type
	epoll_create.c: In function 'main':
	epoll_create.c:12: warning: integer constant is too large for 'long' type
	epoll_ctl.c: In function 'invoke_syscall':
	epoll_ctl.c:14: warning: integer constant is too large for 'long' type
	faccessat.c: In function 'main':
	faccessat.c:13: warning: integer constant is too large for 'long' type
	fchdir.c: In function 'main':
	fchdir.c:12: warning: integer constant is too large for 'long' type
	struct_flock.c: In function 'invoke_test_syscall':
	struct_flock.c:48: warning: integer constant is too large for 'long' type
	struct_flock.c: In function 'test_flock_einval':
	struct_flock.c:58: warning: integer constant is too large for 'long' type
	struct_flock.c:59: warning: integer constant is too large for 'long' type
	fcntl64.c: In function 'test_flock64_einval':
	fcntl64.c:44: warning: integer constant is too large for 'long' type
	fcntl64.c:45: warning: integer constant is too large for 'long' type
	fcntl.c: In function 'test_flock64_einval':
	fcntl.c:44: warning: integer constant is too large for 'long' type
	fcntl.c:45: warning: integer constant is too large for 'long' type
	fdatasync.c: In function 'main':
	fdatasync.c:12: warning: integer constant is too large for 'long' type
	flock.c: In function 'main':
	flock.c:13: warning: integer constant is too large for 'long' type
	xstatx.c: In function 'main':
	xstatx.c:255: warning: integer constant is too large for 'long' type
	xstatx.c:290: warning: integer constant is too large for 'long' type
	xstatx.c:290: warning: integer constant is too large for 'long' type
	xstatx.c:290: warning: integer constant is too large for 'long' type
	xstatx.c:290: warning: integer constant is too large for 'long' type
	xstatx.c:290: warning: integer constant is too large for 'long' type
	xstatx.c:290: warning: integer constant is too large for 'long' type
	xstatx.c:290: warning: integer constant is too large for 'long' type
	xstatx.c:290: warning: integer constant is too large for 'long' type
	xstatx.c:290: warning: integer constant is too large for 'long' type
	xstatx.c:294: warning: integer constant is too large for 'long' type
	xstatx.c:294: warning: integer constant is too large for 'long' type
	xstatx.c:294: warning: integer constant is too large for 'long' type
	xstatx.c:294: warning: integer constant is too large for 'long' type
	xstatx.c:294: warning: integer constant is too large for 'long' type
	xstatx.c:294: warning: integer constant is too large for 'long' type
	xstatx.c:294: warning: integer constant is too large for 'long' type
	xstatx.c:294: warning: integer constant is too large for 'long' type
	xstatx.c:294: warning: integer constant is too large for 'long' type
	xstatfsx.c: In function 'main':
	xstatfsx.c:113: warning: integer constant is too large for 'long' type
	fsync.c: In function 'main':
	fsync.c:12: warning: integer constant is too large for 'long' type
	ftruncate64.c: In function 'main':
	ftruncate64.c:39: warning: integer constant is too large for 'long' type
	futimesat.c: In function 'main':
	futimesat.c:52: warning: integer constant is too large for 'long' type
	futimesat.c:59: warning: integer constant is too large for 'long' type
	get_mempolicy.c: In function 'main':
	get_mempolicy.c:83: warning: integer constant is too large for 'long' type
	get_mempolicy.c:84: warning: integer constant is too large for 'long' type
	get_mempolicy.c:85: warning: integer constant is too large for 'long' type
	get_mempolicy.c:86: warning: integer constant is too large for 'long' type
	getdents.c: In function 'main':
	getdents.c:109: warning: integer constant is too large for 'long' type
	getdents.c:110: warning: integer constant is too large for 'long' type
	getdents.c:114: warning: integer constant is too large for 'long' type
	getdents64.c: In function 'main':
	getdents64.c:114: warning: integer constant is too large for 'long' type
	getdents64.c:115: warning: integer constant is too large for 'long' type
	getdents64.c:119: warning: integer constant is too large for 'long' type
	xgetrlimit.c: In function 'main':
	xgetrlimit.c:71: warning: integer constant is too large for 'long' type
	ioctl_block.c:44: warning: integer constant is too large for 'long' type
	ioctl_block.c: In function 'main':
	ioctl_block.c:136: warning: integer constant is too large for 'long' type
	ioctl_block.c:137: warning: integer constant is too large for 'long' type
	ioctl_block.c:161: warning: integer constant is too large for 'long' type
	ioctl_block.c:170: warning: integer constant is too large for 'long' type
	ioctl_block.c:171: warning: integer constant is too large for 'long' type
	ioctl_evdev.c:42: warning: integer constant is too large for 'long' type
	ioctl_mtd.c:46: warning: integer constant is too large for 'long' type
	ioctl_rtc.c:40: warning: integer constant is too large for 'long' type
	ioperm.c: In function 'main':
	ioperm.c:12: warning: integer constant is too large for 'long' type
	ioctl_v4l2.c: In function 'main':
	ioctl_v4l2.c:409: warning: integer constant is too large for 'long' type
	ipc.c: In function 'ipc_call':
	ipc.c:52: warning: integer constant is too large for 'long' type
	kill.c: In function 'main':
	kill.c:59: warning: integer constant is too large for 'long' type
	kill.c:62: warning: integer constant is too large for 'long' type
	kill.c:63: warning: integer constant is too large for 'long' type
	kill.c:68: warning: integer constant is too large for 'long' type
	linkat.c: In function 'main':
	linkat.c:14: warning: integer constant is too large for 'long' type
	linkat.c:15: warning: integer constant is too large for 'long' type
	mbind.c: In function 'main':
	mbind.c:41: warning: integer constant is too large for 'long' type
	mbind.c:43: warning: integer constant is too large for 'long' type
	mbind.c:44: warning: integer constant is too large for 'long' type
	migrate_pages.c: In function 'main':
	migrate_pages.c:41: warning: integer constant is too large for 'long' type
	In file included from mkdirat.c:10:
	umode_t.c: In function 'test_syscall':
	umode_t.c:47: warning: integer constant is too large for 'long' type
	mknod.c: In function 'call_mknod':
	mknod.c:16: warning: integer constant is too large for 'long' type
	mknod.c: In function 'main':
	mknod.c:23: warning: integer constant is too large for 'long' type
	mknod.c:49: warning: integer constant is too large for 'long' type
	mknod.c:56: warning: integer constant is too large for 'long' type
	mknodat.c:12: warning: integer constant is too large for 'long' type
	mknodat.c: In function 'call_mknodat':
	mknodat.c:17: warning: integer constant is too large for 'long' type
	mknodat.c: In function 'main':
	mknodat.c:24: warning: integer constant is too large for 'long' type
	mknodat.c:50: warning: integer constant is too large for 'long' type
	mknodat.c:57: warning: integer constant is too large for 'long' type
	mmap.c: In function 'main':
	mmap.c:51: warning: integer constant is too large for 'long' type
	move_pages.c: In function 'print_stat_pages':
	move_pages.c:139: warning: integer constant is too large for 'long' type
	move_pages.c: In function 'print_move_pages':
	move_pages.c:166: warning: integer constant is too large for 'long' type
	move_pages.c: In function 'main':
	move_pages.c:188: warning: integer constant is too large for 'long' type
	mq_sendrecv.c: In function 'main':
	mq_sendrecv.c:238: warning: integer constant is too large for 'long' type
	mq_sendrecv.c:401: warning: integer constant is too large for 'long' type
	mq_sendrecv.c:403: warning: integer constant is too large for 'long' type
	nsyscalls.c: In function 'test_syscall':
	nsyscalls.c:64: warning: integer constant is too large for 'long' type
	nsyscalls.c:65: warning: integer constant is too large for 'long' type
	nsyscalls.c:66: warning: integer constant is too large for 'long' type
	nsyscalls.c:67: warning: integer constant is too large for 'long' type
	nsyscalls.c:68: warning: integer constant is too large for 'long' type
	nsyscalls.c:69: warning: integer constant is too large for 'long' type
	preadv-pwritev.c: In function 'main':
	preadv-pwritev.c:162: warning: comparison between signed and unsigned
	prlimit64.c: In function 'main':
	prlimit64.c:65: warning: integer constant is too large for 'long' type
	prlimit64.c:70: warning: integer constant is too large for 'long' type
	remap_file_pages.c: In function 'main':
	remap_file_pages.c:42: warning: integer constant is too large for 'long' type
	remap_file_pages.c:43: warning: integer constant is too large for 'long' type
	remap_file_pages.c:45: warning: integer constant is too large for 'long' type
	renameat.c: In function 'main':
	renameat.c:15: warning: integer constant is too large for 'long' type
	renameat.c:16: warning: integer constant is too large for 'long' type
	rt_sigqueueinfo.c: In function 'main':
	rt_sigqueueinfo.c:41: warning: integer constant is too large for 'long' type
	rt_tgsigqueueinfo.c: In function 'k_tgsigqueueinfo':
	rt_tgsigqueueinfo.c:45: warning: integer constant is too large for 'long' type
	rt_tgsigqueueinfo.c:46: warning: integer constant is too large for 'long' type
	rt_tgsigqueueinfo.c:47: warning: integer constant is too large for 'long' type
	rt_tgsigqueueinfo.c: In function 'main':
	rt_tgsigqueueinfo.c:67: warning: integer constant is too large for 'long' type
	sendfile.c: In function 'main':
	sendfile.c:110: warning: integer constant is too large for 'long' type
	sendfile64.c: In function 'main':
	sendfile64.c:100: warning: integer constant is too large for 'long' type
	set_mempolicy.c: In function 'main':
	set_mempolicy.c:129: warning: integer constant is too large for 'long' type
	set_mempolicy.c:130: warning: integer constant is too large for 'long' type
	setrlimit.c: In function 'main':
	setrlimit.c:44: warning: integer constant is too large for 'long' type
	socketcall.c: In function 'test_socketcall':
	socketcall.c:58: warning: integer constant is too large for 'long' type
	splice.c: In function 'main':
	splice.c:41: warning: integer constant is too large for 'long' type
	splice.c:42: warning: integer constant is too large for 'long' type
	splice.c:45: warning: integer constant is too large for 'long' type
	splice.c:46: warning: integer constant is too large for 'long' type
	symlinkat.c: In function 'main':
	symlinkat.c:12: warning: integer constant is too large for 'long' type
	sync_file_range.c: In function 'main':
	sync_file_range.c:42: warning: integer constant is too large for 'long' type
	sync_file_range.c:43: warning: integer constant is too large for 'long' type
	syslog.c: In function 'main':
	syslog.c:14: warning: integer constant is too large for 'long' type
	tee.c: In function 'main':
	tee.c:41: warning: integer constant is too large for 'long' type
	tee.c:42: warning: integer constant is too large for 'long' type
	timer_create.c: In function 'main':
	timer_create.c:52: warning: integer constant is too large for 'long' type
	timer_create.c:84: warning: integer constant is too large for 'long' type
	timer_create.c:85: warning: integer constant is too large for 'long' type
	truncate64.c: In function 'main':
	truncate64.c:41: warning: integer constant is too large for 'long' type
	xgetrlimit.c: In function 'main':
	xgetrlimit.c:71: warning: integer constant is too large for 'long' type
	umode_t.c: In function 'test_syscall':
	umode_t.c:46: warning: integer constant is too large for 'long' type
	unlinkat.c: In function 'main':
	unlinkat.c:13: warning: integer constant is too large for 'long' type
	waitpid.c: In function 'main':
	waitpid.c:43: warning: integer constant is too large for 'long' type
	waitid.c: In function 'poison':
	waitid.c:141: warning: integer constant is too large for 'long' type
	xetpriority.c: In function 'main':
	xetpriority.c:15: warning: integer constant is too large for 'long' type
	xetpriority.c:19: warning: integer constant is too large for 'long' type
	xetpriority.c:20: warning: integer constant is too large for 'long' type
	xetpgid.c: In function 'main':
	xetpgid.c:43: warning: integer constant is too large for 'long' type
	xetpgid.c:47: warning: integer constant is too large for 'long' type
	xetpgid.c:48: warning: integer constant is too large for 'long' type

	(SLES 11SP4, i386)

	* tests/alarm.c (main): Add proper suffix to integer constant.
	* tests/aio.c (main): Likewise.
	* tests/btrfs.c (btrfs_test_sync_ioctls, btrfs_test_subvol_ioctls): Likewise.
	* tests/dup2.c (main): Likewise.
	* tests/dup3.c (main): Likewise.
	* tests/epoll_create.c (main): Likewise.
	* tests/epoll_ctl.c (invoke_syscall): Likewise.
	* tests/faccessat.c (main): Likewise.
	* tests/fchdir.c (main): Likewise.
	* tests/fcntl.c (test_flock64_einval): Likewise.
	* tests/fcntl64.c (test_flock64_einval): Likewise.
	* tests/fdatasync.c (main): Likewise.
	* tests/flock.c (main): Likewise.
	* tests/fstat64.c (SAMPLE_SIZE): Likewise.
	* tests/fstat.c (SAMPLE_SIZE): Likewise.
	* tests/fsync.c (main): Likewise.
	* tests/ftruncate64.c (main): Likewise.
	* tests/futimesat.c (main): Likewise.
	* tests/get_mempolicy.c (main): Likewise.
	* tests/getdents.c (main): Likewise.
	* tests/getdents64.c (main): Likewise.
	* tests/ioctl_block.c (lmagic, main): Likewise.
	* tests/ioctl_evdev.c (lmagic): Likewise.
	* tests/ioctl_mtd.c (lmagic): Likewise.
	* tests/ioctl_rtc.c (lmagic): Likewise.
	* tests/ioctl_v4l2.c (main): Likewise.
	* tests/ioperm.c (main): Likewise.
	* tests/ipc.c (ipc_call): Likewise.
	* tests/kill.c (main): Likewise.
	* tests/linkat.c (main): Likewise.
	* tests/lstat64.c (SAMPLE_SIZE): Likewise.
	* tests/lstat.c (SAMPLE_SIZE): Likewise.
	* tests/mbind.c (main): Likewise.
	* tests/migrate_pages.c (main): Likewise.
	* tests/mkdirat.c (TEST_SYSCALL_PREFIX_ARGS): Likewise.
	* tests/mknod.c (call_mknod, main): Likewise.
	* tests/mknodat.c (fd, call_mknodat, main): Likewise.
	* tests/mmap.c (main): Likewise.
	* tests/move_pages.c (print_stat_pages, print_move_pages): Likewise.
	* tests/mq_sendrecv.c (main): Likewise.
	* tests/nsyscalls.c (test_syscall): Likewise.
	* tests/prlimit64.c (main): Likewise.
	* tests/remap_file_pages.c (main): Likewise.
	* tests/renameat.c (main): Likewise.
	* tests/rt_sigqueueinfo.c (main): Likewise.
	* tests/rt_tgsigqueueinfo.c (k_tgsigqueueinfo, main): Likewise.
	* tests/sendfile.c (main): Likewise.
	* tests/sendfile64.c (main): Likewise.
	* tests/set_mempolicy.c (main): Likewise.
	* tests/setrlimit.c (main): Likewise.
	* tests/socketcall.c (test_socketcall): Likewise.
	* tests/splice.c (main): Likewise.
	* tests/stat64.c (SAMPLE_SIZE): Likewise.
	* tests/stat.c (SAMPLE_SIZE): Likewise.
	* tests/struct_flock.c (invoke_test_syscall, test_flock_einval): Likewise.
	* tests/symlinkat.c (main): Likewise.
	* tests/sync_file_range.c (main): Likewise.
	* tests/syslog.c (main): Likewise.
	* tests/tee.c (main): Likewise.
	* tests/timer_create.c (main): Likewise.
	* tests/truncate64.c (main): Likewise.
	* tests/umode_t.c (test_syscall): Likewise.
	* tests/unlinkat.c (main): Likewise.
	* tests/waitid.c (main): Likewise.
	* tests/waitpid.c (main): Likewise.
	* tests/xetpgid.c (main): Likewise.
	* tests/xetpriority.c (main): Likewise.
	* tests/xgetrlimit.c (main): Likewise.
	* tests/xstatfsx.c (main) [CHECK_ODD_SIZE]: Likewise.
	* tests/xstatx.c (main): Likewise.

2016-11-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: fix "comparison between signed and unsigned" compilation warnings
	preadv-pwritev.c: In function 'main':
	preadv-pwritev.c:162: warning: comparison between signed and unsigned
	readv.c: In function 'main':
	readv.c:148: warning: comparison between signed and unsigned
	recvmsg.c: In function 'main':
	recvmsg.c:148: warning: comparison between signed and unsigned

	* tests/preadv-pwritev.c (main): Cast r_len to int.
	* tests/readv.c (main): Likewise.
	* tests/recvmsg.c (main): Likewise.

2016-11-13  Dmitry V. Levin  <ldv@altlinux.org>

	syscall.c: refactor getregs_old fallback in get_regs.
	This change moves remaining arch specific getregs_old code into
	appropriate arch subdirectories and removes unnecessary code
	duplication.

	* linux/getregs_old.h: New file.
	* linux/powerpc/getregs_old.h: Likewise.
	* linux/powerpc64/getregs_old.h: Likewise.
	* linux/x86_64/getregs_old.h: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.
	* syscall.c: Include "getregs_old.h".
	[X86_64 || POWERPC]: Remove.
	[ARCH_REGS_FOR_GETREGSET] (ptrace_getregset_or_getregs): Define
	to ptrace_getregset.
	[ARCH_REGS_FOR_GETREGS] (ptrace_getregset_or_getregs): Define
	to ptrace_getregs.
	(get_regs): Check for ptrace_getregset_or_getregs instead
	of ARCH_REGS_FOR_GETREGSET and ARCH_REGS_FOR_GETREGS.  Use
	ptrace_getregset_or_getregs instead of ptrace_getregset and
	ptrace_getregs.  Check for HAVE_GETREGS_OLD instead of X86_64
	and POWERPC.  Use use_getregs_old instead of getregset_support
	and old_kernel.

2016-11-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Rename BUILD_BUG_ON_ZERO macro.
	In order to avoid name clash on distributions which decide to include
	kernel headers instead of UAPI ones.  For example, on SLES 11SP4:

	gcc -DHAVE_CONFIG_H -I./linux/x86_64 -I./linux -I. -Wall -O2 -c net.c
	In file included from /usr/include/linux/sysctl.h:25:0,
	                 from /usr/include/linux/netfilter.h:6,
	                 from /usr/include/linux/netfilter_arp.h:8,
	                 from /usr/include/linux/netfilter_arp/arp_tables.h:14,
	                 from net.c:60:
	net.c: In function 'print_packet_mreq':
	gcc_compat.h:59:27: error: negative width in bit-field '<anonymous>'
	 # define MUST_BE_ARRAY(a) BUILD_BUG_ON_ZERO(!SAME_TYPE((a), &(a)[0]))
	                           ^
	defs.h:76:53: note: in expansion of macro 'MUST_BE_ARRAY'
	 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]) + MUST_BE_ARRAY(a))
	                                                     ^
	net.c:747:22: note: in expansion of macro 'ARRAY_SIZE'
	   if (mreq.mr_alen > ARRAY_SIZE(mreq.mr_address))
	                      ^
	due to the fact BUILD_BUG_ON_ZERO is already defined in <linux/kernel.h>.

	* gcc_compat.h (BUILD_BUG_ON_ZERO): Rename to FAIL_BUILD_ON_ZERO.
	(MUST_BE_ARRAY): Update usage.

2016-11-12  Dmitry V. Levin  <ldv@altlinux.org>

	syscall.c: factor out ptrace_getregs from get_regs.
	Move the code that calls ptrace(PTRACE_GETREGS) to a separate function.

	* syscall.c (ptrace_getregs): New function.
	(get_regs): Use it.

2016-11-12  Dmitry V. Levin  <ldv@altlinux.org>

	syscall.c: rename get_regset to ptrace_getregset.
	* syscall.c (get_regset): Rename to ptrace_getregset.
	(get_regs): Rename get_regset to ptrace_getregset.

2016-11-12  Andreas Schwab  <schwab@linux-m68k.org>

	m68k: switch to PTRACE_GETREGS.
	* Makefile.am (EXTRA_DIST): Add linux/m68k/arch_regs.h, remove
	linux/m68k/get_syscall_result.c.
	* linux/m68k/arch_regs.c (m68k_d0, ARCH_PC_PEEK_ADDR): Don't
	define.
	(m68k_regs, m68k_usp_ptr, ARCH_PC_REG, ARCH_REGS_FOR_GETREGS):
	Define.
	* linux/m68k/arch_regs.h: New file.
	* linux/m68k/arch_sigreturn.c (arch_sigreturn): Use m68k_usp_ptr.
	* linux/m68k/get_error.c (get_error): Use m68k_regs.d0.
	* linux/m68k/get_scno.c (arch_get_scno): Use m68k_regs.orig_d0.
	* linux/m68k/get_syscall_args.c (get_syscall_args): Use m68k_regs.
	* linux/m68k/get_syscall_result.c: Remove.

	tests: do not run old_mmap test on m68k.
	* tests/old_mmap.c: Skip test on m68k.

2016-11-12  Dmitry V. Levin  <ldv@altlinux.org>

	syscall.c: introduce reallocate_vec function.
	This might be needed later to implement syscall fault injection.

	* syscall.c (reallocate_vec): New function.
	(reallocate_qual): Use it.

2016-11-12  Dmitry V. Levin  <ldv@altlinux.org>

	Fix prototypes of qual_desc, qual_signal, and qual_syscall functions.
	* syscall.c (qual_desc, qual_signal, qual_syscall): Fix prototypes.
	(struct qual_options): Fix type of "qualify" member.

2016-11-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	linux/x32/syscallent.h: fix syscallent array initialisation on x32.
	Why gcc didn't complain about it? It is definitely an index clash.

	* linux/x32/syscallent.h: Change initializer indices for empty records from
	[327 ... 511] to [329 ... 511].

2016-11-11  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce upoke function.
	This will be needed to implement fault injection on those architectures
	that lack PTRACE_SETREGSET/PTRACE_SETREGS support.

	* defs.h (upoke): New prototype.
	* upoke.c: New file.
	* Makefile.am (libstrace_a_SOURCES): Add it.

2016-11-11  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	Update ioctl entries from linux 4.9.
	* linux/32/ioctls_inc_align32.h: Update from linux v4.9 using ioctls_gen.sh.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* linux/64/ioctls_inc.h: Likewise.
	* linux/x32/ioctls_inc0.h: Likewise.
	* NEWS: Mention this.

2016-11-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Update NEWS.

2016-11-10  Mikulas Patocka  <mpatocka@redhat.com>
	    Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add support for decoding of DM_* ioctl commands.
	* dm.c: New file.
	* xlat/dm_flags.in: Likewise.
	* Makefile.am (strace_SOURCES): Add dm.c.
	* configure.ac (AC_CHECK_HEADERS): Add linux/dm-ioctl.h.
	* defs.h (dm_ioctl): New prototype.
	* ioctl.c (ioctl_decode) [HAVE_LINUX_DM_IOCTL_H]: Call dm_ioctl
	for 0xfd ioctl type.
	* tests/ioctl_dm.c: New file.
	* tests/ioctl_dm-v.c: Likewise.
	* tests/ioctl_dm.test: New test.
	* tests/ioctl_dm-v.test: Likewise.
	* tests/.gitignore: Add ioctl_dm and ioctl_dm-v.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add ioctl_dm.test and ioctl_dm-v.test.

2016-11-10  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce ALIGNOF macro.
	* gcc_compat.h (ALIGNOF): New macro.

2016-11-10  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util: add support for QUOTE_0_TERMINATED in user_style to ptrintstr_ex.
	This enables printing size-limited (expectedly) ASCIZ strings.

	This is done by increasing umoven size limit for sized strings by one
	byte above max_strlen (enabling copying possible NUL byte in case len is
	greater than max_strlen) and decreasing size after copying by one byte
	in case QUOTE_0_TERMINATED is set (due to user_style or usage of len of
	-1).  As a result, there is one excess byte for string_quote in case
	QUOTE_0_TERMINATED is set so string_quote can check for NUL termination
	of strings up to size bytes in size (which is len or max_strlen, whatever
	is greater).

	The catch here is that when string is not properly NUL-terminated and
	QUOTE_0_TERMINATED is provided in user_style and len is less than
	max_strlen then last non-NUL byte is not printed.  But ellipsis is
	printed instead, being indication that string is not terminated
	properly.  QUOTE_OMIT_TRAILING_0 should be used instead in case this
	behaviour is not intended.

	* util.c (printstr_ex): Copy one excess byte in case of non-negative len
	provided and it is more than max_strlen; handle case of max_strlen of 0
	in case QUOTE_0_TERMINATED is set separately; check for need of printing
	ellipsis by checking resulting style against QUOTE_0_TERMINATED.

2016-11-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of mq_{notify,open,timedreceive,timedsend,unlink}
	* tests/mq_sendrecv.c: New file.
	* tests/mq_sendrecv-read.c: Likewise.
	* tests/mq_sendrecv-write.c: Likewise.
	* tests/mq_sendrecv.test: New test.
	* tests/mq_sendrecv-read.test: Likewise.
	* tests/mq_sendrecv-write.test: Likewise.
	* tests/.gitignore: Add mq_sendrecv, mq_sendrecv-read,
	and mq_sendrecv-write.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(mq_sendrecv_LDADD, mq_sendrecv_read_LDADD, mq_sendrecv_write_LDADD):
	New variables.
	(DECODER_TESTS): Add mq_sendrecv.test, mq_sendrecv-read.test,
	and mq_sendrecv-write.test.

2016-11-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests: skip times.test if CLOCK_PROCESS_CPUTIME_ID does not work.
	* tests/times.c (main): Skip if clock_gettime consistenly returns zero
	for CLOCK_PROCESS_CPUTIME_ID timer.

2016-10-31  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add tests for perf_event_attr structure decoding in perf_event_open
	* configure.ac: Add checks for presence of various fields of struct
	perf_event_attr defined in kernel headers.
	* tests/perf_event_open.c: New file.
	* tests/perf_event_open_unabbrev.c: Likewise.
	* tests/perf_event_open.test: New test.
	* tests/perf_event_open_unabbrev.test: Likewise.
	* tests/.gitignore: Add perf_event_open, perf_event_open_unabbrev.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add perf_event_open.test, perf_event_open_unabbrev.test.

	Implement decoding of perf_event_attr structure in perf_event_open syscall
	* linux/perf_event_struct.h: New file, definition of struct perf_event_attr
	from Linux 4.8
	* Makefile.am (strace_SOURCES): Add it.
	* xlat/hw_breakpoint_len.in: New file.
	* xlat/hw_breakpoint_type.in: Likewise.
	* xlat/perf_attr_size.in: Likewise.
	* xlat/perf_branch_sample_type.in: Likewise.
	* xlat/perf_event_read_format.in: Likewise.
	* xlat/perf_event_sample_format.in: Likewise.
	* xlat/perf_hw_cache_id.in: Likewise.
	* xlat/perf_hw_cache_op_id.in: Likewise.
	* xlat/perf_hw_cache_op_result_id.in: Likewise.
	* xlat/perf_hw_id.in: Likewise.
	* xlat/perf_sw_ids.in: Likewise.
	* xlat/perf_type_id.in: Likewise.
	* perf.c [HAVE_LINUX_PERF_EVENT_H]: Remove inclusion of
	<linux/perf_event.h>.
	(PRINT_XLAT): New macro for simplifying printing values from
	sorted xlat.
	(printxlat_search): New function, wrapper for xlat_search with behaviour
	similar to printval.
	(print_perf_event_attr): New print_event_attr structure fetching and
	printing function.
	(SYS_FUNC(perf_event_open)): Use print_perf_event_attr for displaying
	attr argument contents.
	* tests/perf_event_open.c: Renamed to
	tests/perf_event_open_nonverbose.c.
	* tests/perf_event_open.test: add -e verbose=none in order to preserve
	output format being checked (in case verbose output is enabled,
	contents of attr arguments are shown now); rename to
	tests/perf_event_open_nonverbose.test; add -e trace=perf_event_open.

	tests: fix name spelling.

2016-10-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: fix name spelling.

	Update NEWS.

	Fix typo in comment in tests/quotactl.h.

	tests: fix invalid pointer checks in quotactl test.
	* tests/quotactl.h (bogus_special, bogus_addr): Move it...
	* tests/quotactl.c (main): ... here; remove static and const qualifiers,
	use memory after tail_alloc instead of magic numbers.
	* tests/quotactl-xfs.c (main): Likewise.

	tests: fix invalid pointer checks in getcpu test.
	* test/getcpu.c (main): Replace magic numbers deemed invalid pointers
	with addresses after memory returned by tail_alloc.

	tests: fix invalid pointer checks in request_key test.
	* test/request_key.c (main): Replace magic numbers deemed invalid pointers
	with addresses after memory returned by tail_alloc.

	tests: fix invalid pointer checks in add_key test.
	* test/add_key.c (main): Replace magic numbers deemed invalid pointers
	with addresses after memory returned by tail_alloc.

	statfs: use printxval_search.
	* print_statfs.c (print_statfs_type): Use printxval_search for printing
	FS magic xlat value.

	util: add printing helper for sorted xlat arrays.
	* util.c (printxval_searchn): New function.
	* defs.h (printxval_searchn): New prototype.
	(printxval_search): New helper macro useful in conjunction with static
	xlat arrays.

	defs: add check for argument being array to ARRAY_SIZE macro.
	* gcc_compat.h [GNUC_PREREQ(3, 0)] (BUILD_BUG_ON_ZERO): New macro.
	(SAME_TYPE, MUST_BE_ARRAY): Likewise.
	* defs.h (ARRAY_SIZE): Add MUST_BE_ARRAY for build-time type check.

	tests: check decoding of oldfstat, oldlstat, and oldstat syscalls.
	* tests/oldfstat.c: New file.
	* tests/oldlstat.c: Likewise.
	* tests/oldstat.c: Likewise.
	* tests/oldfstat.test: New test.
	* tests/oldlstat.test: Likewise.
	* tests/oldstat.test: Likewise.
	* tests/xstatx.c [!OLD_STAT]: define OLD_STAT to 0.
	(print_stat) [OLD_STAT]: Print predefined values for
	st_blksize/st_blocks.
	(print_stat): Check for !OLD_STAT in nanosecond precision checks.
	(main) [OLD_STAT]: Ignore EOVERFLOW.
	(main): Test for successful rc in returned size value check;
	print address only on non-successful rc.
	* tests/.gitignore: Add oldfstat, oldlstat, and oldstat.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add oldfstat.test, oldlstat.test, and oldstat.test.

	tests: additional tests of stat decoders.
	* tests/fstatx.c (IS_FSTAT): Define to 1.
	* tests/fstatat64.c [__GLIBC__ && __sparc64__] (TEST_BOGUS_STRUCT_STAT):
	Define to 0.
	* tests/xstatx.c [!IS_STAT] (IS_STAT): Define to 0.
	[!TEST_BOGUS_STRUCT_STAT] (TEST_BOGUS_STRUCT_STAT): Define to 1.
	(main): Add a check for non-available pointer and a check
	for block device file.
	* tests/statx.sh: Add tracing of /dev/full file, specify alignment.
	* tests/fstat.test: Specify alignment.

2016-10-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: prepare for additional tests of stat decoders.
	PRINT_SYSCALL_HEADER/PRINT_SYSCALL_FOOTER now contain open/close brace
	pair in order to save errno.  PRINT_SYSCALL_FOOTER now uses sprintrc for
	printing rc/errno.

	* tests/xstatx.c: Include <errno.h>.
	(main): Update PRINT_SYSCALL_FOOTER call convention.
	* tests/fstatat.c (PRINT_SYSCALL_HEADER): Add errno saving.
	(PRINT_SYSCALL_FOOTER): Restore errno.
	* tests/fstatx.c: Likewise.
	* tests/lstatx.c: Likewise.

2016-10-28  Dmitry V. Levin  <ldv@altlinux.org>

	Provide a safe definition of O_ACCMODE.
	Some libcs e.g. musl are guilty of messing up with O_ACCMODE.

	* open.c (O_ACCMODE): Redefine to 03.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Implement dumping of mq_timedsend and mq_timedreceive syscalls.
	* syscall.c (dumpio): Add SEN_mq_timedreceive and SEN_mq_timedsend.

	mq: print msg_prio as a pointer, not as an immediate value.
	* mq.c (SYS_FUNC(mq_timedreceive)): Use printnum_int for printing
	msg_prio argument.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	mq: print msg payload only in case of successful mq_timedreceive call.
	Also, use u_rval for determining message size.

	* mq.c (SYS_FUNC(mq_timedreceive)): Check for syserror and non-negative
	u_rval before calling printstr on msg_ptr argument, or use printaddr otherwise;
	provide u_rval as string size.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	mq: Print msg_prio parameter as unsigned int in mq_timedsend.
	* mq.c (SYS_FUNC(mq_timedsend)): Change conversion specifier from "%ld"
	to "%u", cast argument value to unsigned int.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	mq: Properly print mq_flags field.
	mq_flags field of struct mq_attr can contain only O_NONBLOCK flag (other
	flags are treated as invalid by mq_getsetattr). Moreover, this field is
	ignored by mq_open at all (O_NONBLOCK is set via oflag, not via attr
	attribute).

	* xlat/mq_attr_flags.in: New file.
	* print_mq_attr.c: Include xlat/mq_attr_flags.h.
	(printmqattr): New parameter, bool decode_flags; cast members of struct
	mq_attr to long long type; use mq_attr_flags xlat for printing mq_flags;
	print mq_flags as flags only in case decode_flags parameter is set
	to true.
	* mq.c (SYS_FUNC(mq_open)): Specify value of false for decode_flags
	parameter of printmqattr call.
	(SYS_FUNC(mq_getsetattr)): Specify value of true for decode_flags
	parameter of printmqattr call.
	* tests/mq.expected: Update expected output.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	mq: Print msg_len parameter as kernel_ulong_t.
	* mq.c (SYS_FUNC(mq_timedsend)): Change conversion specifier from "%lu"
	to "%llu", use getarg_ull for obtaining msg_len parameter.
	(SYS_FUNC(mq_timedreceive)): Likewise.

	print_mq_attr: fix typo.
	* print_mq_attr.c (printmqattr): Print field name "mq_curmsgs"
	instead of "mq_curmsg".
	* tests/mq.expected: Update expected output.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	mq: print mqdes parameter as int.
	It is defined as int in <linux/posix_types.h>.

	* mq.c (SYS_FUNC(mq_timedsend)): Use "%d" conversion specifier instead
	of "%ld" for printing mqdes (0th parameter), cast parameter value to
	int.
	(SYS_FUNC(mq_timedreceive)): Likewise.
	(SYS_FUNC(mq_notify)): Likewise.
	(SYS_FUNC(mq_getsetattr)): Likewise.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	mq: curly brackets usage fix.
	Use curly brackets for denoting blocks in both of if branches if they
	are already used in at least one branch.

	tests: additional name_to_handle_at/open_by_handle_at checks.
	* tests/file_handle.c: Additional name_to_handle_at/open_by_handle_at
	checks.

	tests: require only presence of __NR_* macros for file_handle test.
	* tests/file_handle.c: replace fcntl.h include with asm/unistd.h.
	[MAX_HANDLE_SZ]: change to defined __NR_name_to_handle_at
	&& defined __NR_open_by_handle_at, add fcntl.h include
	[!MAX_HANDLE_SZ]: Add definition of MAX_HANDLE_SZ and struct
	file_handle.
	(main): Change name_to_handle_at and open_by_handle_at calls to syscall.

	tests: proper type conversion in keyctl test.
	* tests/keyctl.c (printarg): Add intermediate conversion of arg to uintptr_t
	since kernel_ulong_t may be of different size.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	file_handle: use separate xlat for name_ta_handle_at flags.
	Since the only two flags supported are AT_SYMLINK_FOLLOW and
	AT_EMPTY_PATH.

	* xlat/name_to_handle_at_flags.in: New file.
	* file_handle.c (SYS_FUNC(name_to_handle_at)): Use name_to_handle_at_flags
	for printing flags parameter.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of kexec_file_load and kexec_load syscalls.
	* tests/kexec_file_load.c: New file.
	* tests/kexec_load.c: Likewise.
	* tests/kexec_file_load.test: New test.
	* tests/kexec_load.test: Likewise.
	* tests/.gitignore: Add kexec_file_load and kexec_load.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add kexec_file_load.test and kexec_load.test.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	kexec: use widen_to_ulong since kexec_load has compat on x32/n32.
	Curiously, kexec_load uses compat on x32/n32, so its parameters should
	be 4 bytes in size on these ABIs.

	* kexec.c (SYS_FUNC(kexec_load)): Use widen_to_ulong for casting
	parameters to proper size on x32/n32.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	kexec: fix zeroing of higher bits of flags parameter in kexec_load.
	* kexec.c (SYS_FUNC(kexec_load)): Perform type conversion before
	negation in order to properly negate higher bits of KEXEC_ARCH_MASK.

	kexec: add printing of struct kexec_segment field names.
	* kexec.c (print_seg): Print field names of the kexec_segment structure.

	tests: check decoding of unshare syscall.
	* tests/unshare.c: New file.
	* tests/unshare.test: New test.
	* tests/.gitignore: Add unshare.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add unshare.test.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	clone: use kernel_ulong_t as type of flags parameter of unshare call.
	Kernel declares flags parameter as long and looks like x32 and n32
	implement no compat for this call.

	* clone.c (SYS_FUNC(unshare)): Use getarg_ull and printflags64 for
	obtaining and parsing flags parameter.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	clone: use separate flag list for unshare.
	Not all clone flags could be passed to unshare (see check_unshare_flags
	function in kernel/fork.c).

	* xlat/unshare_flags.in: New file.
	* clone.c (SYS_FUNC(unshare)): Use unshare_flags for printing flags
	parameter.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of setns syscall.
	* tests/setns.c: New file.
	* tests/setns.test: New test.
	* tests/.gitignore: Add setns.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setns.test.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	clone: use separate xlat for nstype parameter of setns syscall.
	nstype is not flag set but specific type value against which it is
	compared in kernel (see kernel/nsproxy.c, SYSCALL_DEFINE2(setns, ...)).

	* xlat/setns_types.in: New file.
	* clone.c: Use printxval and setns_types for nstype parameter.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check non-verbose capget/capset output.
	* tests/caps-abbrev.awk: New file.
	* tests/caps-abbrev.c: Likewise.
	* tests/caps-abbrev.test: New test.
	* tests/.gitignore: Add caps-abbrev.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add caps-abbrev.test.
	(EXTRA_DIST): Add caps-abbrev.awk.

	tests: additional capset decoder checks.
	* tests/caps.awk: Add patterns for additional checks.
	* tests/caps.c: Implement additional checks.

	tests: check decoding of fanotify_init syscall.
	* tests/fanotify_init.c: New file.
	* tests/fanotify_init.test: New test.
	* tests/.gitignore: Add fanotify_init.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add fanotify_init.test.

	tests: some additional checks for fanotify_mark.
	* tests/fanotify_mark.c (do_call): New function.
	(main): Use it.

	tests: use sprintrc in tests/fanotify_mark.c.
	* tests/fanotify.c (main): Use sprintrc.

	tests: check decoding of {init,finit,delete}_module syscalls.
	* tests/delete_module.c: New file.
	* tests/finit_module.c: Likewise.
	* tests/init_delete_module.h: Likewise.
	* tests/init_module.c: Likewise.
	* tests/delete_module.test: New test.
	* tests/finit_module.test: Likewise.
	* tests/init_module.test: Likewise.
	* tests/.gitignore: Add delete_nodule, finit_module, and init_module.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add delete_module.test, finit_module.test,
	and init_module.test.
	(EXTRA_DIST): Add init_delete_module.h.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	bjm: use getarg_ull for retrieving first two parameters of init_module syscall
	As init_module has no compat wrapper, its first parameter is a pointer
	and the second is length, they both have the same size as kernel_ulong_t
	type.

	* bjm.c (SYS_FUNC(init_module)): Obtain first two parameters using
	getarg_ull, print address argument using printaddr_ull, print length
	argument using "%llu" conversion specifier.

2016-10-28  Dmitry V. Levin  <ldv@altlinux.org>

	Add printaddr_ull, change printaddr into a thin wrapper around it.
	* defs.h (printaddr_ull): New prototype.
	(printaddr): Change to a static inline wrapper around printaddr_ull.
	* util.c (printaddr): Rename to printaddr_ull, change argument type
	to unsigned long long, change print format to %#llx.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add values for MODULE_INIT_* constants.
	* bjm.c (MODULE_INIT_IGNORE_MODVERSIONS, MODULE_INIT_IGNORE_VERMAGIC):
	Remove.
	* xlat/module_init_flags.in: Add values for
	MODULE_INIT_IGNORE_MODVERSIONS and MODULE_INIT_IGNORE_VERMAGIC records.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Remove parser of create_module syscall.
	Since create_module syscall is present only in kernels before Linux 2.6
	and strace does not support those kernels, there is no use to keep this
	parser any longer.

	* bjm.c (SYS_FUNC(create_module)): Remove.
	* linux/dummy.h (sys_create_module): Add stub alias.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of process_vm_readv and process_vm_writev syscalls
	* tests/process_vm_readv.c: New file.
	* tests/process_vm_readv_writev.c: Likewise.
	* tests/process_vm_writev.c: Likewise.
	* tests/process_vm_readv.test: New test.
	* tests/process_vm_writev.test: Likewise.
	* tests/.gitignore: Add process_vm_readv and process_vm_writev.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add process_vm_readv.test and process_vm_writev.test.
	(EXTRA_DIST): Add process_vm_readv_writev.c.

	process_vm: use widen_to_ulong for local_iovcnt, renote_iovcnt, and flags
	* process_vm.c (SYS_FUNC(process_vm_readv),
	SYS_FUNC(process_vm_writev)): Use widen_to_ulong for local_iovcnt,
	renote_iovcnt, and flags parameters.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	defs: add widen_to_ulong macro.
	This is similar to widen_to_long, but for unsigned values.

	* defs.h (widen_to_ulong): New macro.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	process_vm: print pid argument as int.
	* process_vm.c (SYS_FUNC(process_vm_readv),
	SYS_FUNC(process_vm_writev)): Change conversion specifier for pid
	argument from "%ld" to "%d".

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	process_vm: remove syserror check for iovec printing.
	This check had been done by print_array inside tprint_iov anyway.

	* process_vm.c (SYS_FUNC(process_vm_readv)): Use tprint_iov_upto for
	printing local_iov; do not check for syserror, provide decode_iov
	parameter to tprint_iov{,_upto} based on its value instead.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	io: use umoven_or_printaddr_ignore_syserror as umove function in tprint_iov_upto
	This enables printing of iovec arrays even in case of failed syscall
	(failed syscall doesn't mean that iovec itself is inaccessible and
	useless).  One caveat here is that we should explicitly provide proper
	IOV_DECODE_* value based on syserror value in case printing is performed
	on exiting; we can't simply override it to IOV_DECODE_ADDR on exiting
	when syserror is up, since this may be called by code which tries to
	print iovec containing local data, which should be perfectly accessible
	(on the other hand, there are no cases of such behaviour at the moment).

	Since iovecs themselves are printed even if syscall has failed now,
	preadv test is updated to reflect this.  It is notable, though, that this
	is the only place where this case is checked.

	* io.c (tprint_iov_upto): Specify umoven_or_printaddr_ignore_syserror
	instead of umoven_or_printaddr as umoven_func parameter.
	(SYS_FUNC(readv), do_preadv): Specify decode_iov parameter value
	based on syserror(tcp) value.
	* scsi.c: (print_sg_io_v3_res, print_sg_io_v4_res): Likewise.
	* tests/preadv.c: Update expected output for the case when preadv
	with singe-item iovec failed.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Move umoven_or_printaddr_ignore_syserror to util.c.
	* defs.h (umoven_or_printaddr_ignore_syserror): New prototype.
	* v4l2.c (umoven_or_printaddr_ignore_syserror): Move ...
	* util.c: ... here.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	v4l2: check for verbose flag in umoven_or_printaddr_ignore_syserror.
	This change makes behaviour of umoven_or_printaddr_ignore_syserror in
	line with umoven_or_printaddr when verbose flag is disabled.

	* v4l2.c (umoven_or_printaddr_ignore_syserror): Simply call printaddr
	when verbose flag is unset.

2016-10-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of kcmp syscall.
	* tests/kcmp.c: New file.
	* tests/kcmp.test: New test.
	* tests/.gitignore: Add kcmp.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add kcmp.test.

2016-10-28  Dmitry V. Levin  <ldv@altlinux.org>

	kcmp: print index parameters of unknown commands as kernel_ulong_t.
	* lookup_dcookie.c (SYS_FUNC(kcmp)): Use getarg_ull to retrieve idx1
	and idx2, print them using %#llx format in case of unknown command.

2016-10-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of inotify family syscalls.
	* tests/inotify.c: New file.
	* tests/inotify_init1.c: Likewise.
	* tests/inotify.test: New test.
	* tests/inotify_init1.test: Likewise.
	* tests/.gitignore: Add inotify and inotify_init1.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add inotify.test and inotify_init1.test.

	xlat: use IN_* prefix for inotify_init1 flag constants.
	* xlat/inotify_init_flags.in: Replace O_* prefix with IN_* prefix for
	O_NONBLOCK and O_CLOEXEC constants, provide fallback definitions.

	tests: check decoding of lookup_dcookie syscall.
	* tests/lookup_dcookie.c: New file.
	* tests/lookup_dcookie.test: New test.
	* tests/.gitignore: Add lookup_dcookie.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add lookup_dcookie.test.

2016-10-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	lookup_dcookie: print len parameter as kernel_ulong_t.
	It is size_t and without compat on x32/n32.

	* lookup_dcookie.c (SYS_FUNC(lookup_dcookie)): Change conversion
	specifier from "%lu" to "%llu", use getarg_ull for len argument
	retrieval.

2016-10-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	defs.h: add offsetofend macro.
	Analogous to offsetof but returns structure offset after the specified
	field.  Useful for checking whether specific field is present in obtained
	data or specifying amount of data to copy based on the (last) field needed.

	* defs.h (offsetofend): New macro.

2016-10-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: move ARG_STR and similar macros to tests.h.
	* tests/add_key.c (_STR, ARG_STR): Move ...
	* tests/tests.h: ... here.
	(ARG_ULL_STR): New macro.
	* tests/keyctl.c (ARG_STR): Remove.
	* tests/quotactl.h (ARG_STR): Likewise.
	* tests/request_key.c (ARG_STR): Likewise.

	tests: move LL_PAIR and LL_VAL_TO_PAIR macros to tests.h.
	* tests/fadvise.h (LL_PAIR, LL_VAL_TO_PAIR): Move ...
	* tests/tests.h: ... here.

	tests: check decoding of ioprio_get and ioprio_set syscalls.
	* tests/ioprio.c: New file.
	* tests/ioprio.test: New test.
	* tests/.gitignore: Add ioprio.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add ioprio.test.

2016-10-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: provide fallback definitions for CLOCK_* constants.
	Since new values have been added gradually over various kernel versions,
	it's better to define them explicitly in order to avoid situations when
	strace built with older kernel headers cannot decode some recently
	defined values.

	* xlat/clocknames.in: Add values for constants.

2016-10-26  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: move fill_memory and fill_memory_ex into a separate file.
	* tests/fill_memory.c: New file.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.
	* tests/quotactl.h (fill_memory, fill_memory_ex): Move to fill_memory.c.
	* tests/tests.h (fill_memory, fill_memory_ex): New prototypes.

	tests: add period parameter to fill_memory_ex.
	* tests/quotactl.h (fill_memory_ex): Add period parameter,
	use it as a divisor in non-constant part of value.
	(fill_memory): Specify period of 0x80 to fill_memory_ex call.
	* tests/quotactl-xfs.c (main): Likewise.

2016-10-05  Dmitry V. Levin  <ldv@altlinux.org>

	Post-release administrivia.
	* NEWS: Add a header line for the next release.
	* debian/changelog.in: Add a changelog entry for 4.14-1.
	* strace.spec.in: Likewise.

2016-10-04  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for 4.14 release.
	* NEWS: Update for 4.14 release.

	Generate SEN numbers in a locale independent order.
	* generate_sen.sh: Sort SEN numbers using C collation rules.

2016-10-04  Dmitry V. Levin  <ldv@altlinux.org>

	Assume that offsetof is provided by stddef.h.
	According to C89, <stddef.h> shall define offsetof macro.

	* defs.h: Include <stddef.h> unconditionally.
	[!offsetof]: Remove.

2016-10-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of add_key, keyctl, and request_key syscalls.
	* tests/add_key.c: New file.
	* tests/keyctl.c: Likewise.
	* tests/request_key.c: Likewise.
	* tests/add_key.test: New test.
	* tests/keyctl.test: Likewise.
	* tests/request_key.test: Likewise.
	* tests/.gitignore: Add add_key, keyctl, and request_key.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add add_key.test, keyctl.test, and request_key.test.

2016-10-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	keyctl: use kernel_ulong_t and getarg_ull instead of long.
	This potentially fixes keyctl decoder for x32 personality.

	* keyctl.c (keyctl_update_key, keyctl_read_key, keyctl_instantiate_key,
	keyctl_instantiate_key_iov, keyctl_dh_compute): Change addr and len
	arguments to kernel_ulong_t.  Print len using %llu format.
	(keyctl_keyring_search): Change addr1 and addr2 arguments
	to kernel_ulong_t.
	(print_dh_params): Change addr argument to kernel_ulong_t.
	(SYS_FUNC(keyctl)): Retrieve arguments via getarg_ull, pass them
	to the appropriate handlers.

2016-10-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	keyctl: fix parameter signedness.
	* keyctl.c (keyctl_update_key): Change addr and len arguments
	to unsigned.
	(keyctl_read_key): Likewise.
	(keyctl_instantiate_key): Likewise.
	(keyctl_instantiate_key_iov): Likewise.
	(keyctl_dh_compute): Likewise.
	(keyctl_keyring_search): Change addr1 and addr2 arguments to unsigned.
	(keyctl_chown_key): Change user and group arguments to unsigned.
	(keyctl_get_persistent): Change uid argument to unsigned.

2016-10-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	keyctl: use printstr_ex for printing out buffer.
	keyctl_read_key had subtle bug by treating out buffer in KEYCTL_READ
	as NUL-terminated, which is not true.  We fix it by adding parameter to
	keyctl_read_key signalising whether buffer is NUL-terminated and using
	printstr_ex for printing (expectedly) NUL-terminated strings.

	* keyctl.c (keyctl_read_key): Add has_nul parameter.  Do not use -1 as
	string len.  Use printstr_ex for buffer output with user style depending
	on has_nul value.
	(SYS_FUNC(keyctl)): Specify has_nul parameter to keyctl_read_key
	by comparing cmd value with KEYCTL_READ.

2016-10-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Add printstr_ex which allows for providing user quotation style.
	This is useful for providing QUOTE_OMIT_TRAILING_0 and maybe other
	flags.

	* defs.h (printstr_ex): New prototype.
	(printstr): Change to a wrapper around printstr_ex with zero user style.
	* util.c (printstr): Rename to ...
	(printstr_ex) ... new function, add user_style argument which is or'ed
	with computed style.

2016-10-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util: add quote_string flag signalising that string is NUL-terminated.
	It is useful in cases strings with size provided are expected to be
	NUL-terminated but are not trustworthy enough to call just plain
	printstr(str, -1).

	* defs.h (QUOTE_OMIT_TRAILING_0): New constant definition.
	* util.c (string_quote): Swallow terminating NUL if
	QUOTE_OMIT_TRAILING_0 is set.

2016-10-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	keyctl: add support for KEYCTL_DH_COMPUTE.
	* keyctl.c (struct keyctl_dh_params): New structure.
	(print_dh_params, keyctl_dh_compute): New functions.
	(SYS_FUNC(keyctl)): Add support for KEYCTL_DH_COMPUTE cmd value.

2016-10-03  Dmitry V. Levin  <ldv@altlinux.org>

	x86_64: fix is_negated_errno for x32 personality.
	* syscall.c (is_negated_errno) [X86_64]: Do not truncate kernel_ulong_t
	to uint32_t for x32 personality.

	tests: fix another regression in qual_syscall.test.
	* tests/qual_syscall.test: Fix pattern_nonabbrev_verbose pattern.
	(check_output_mismatch): Print the pattern that triggered match failure.

	Use err_name, print unrecognized errno values as numbers.
	* syscall.c (trace_syscall_exiting): Use err_name() instead
	of open-coding it.  Print unrecognized errno values using %lu format
	instead of ERRNO_%lu as the latter prodices an invalid constant.

2016-10-03  Eugene Syromyatnikov  <evgsyr@gmail.com>

	keyctl: print errno name in KEYCTL_REJECT in case it is available.
	* keyctl.c (keyctl_reject_key): Get errno string via err_name
	and print it if it is not NULL.

	Add function for getting errno string.
	* defs.h (err_name): New prototype.
	* syscall.c (err_name): New function.

2016-10-03  Dmitry V. Levin  <ldv@altlinux.org>

	struct tcb: change the type of u_error field from int to unsigned long.
	This is the type actually used for the error code on architectures
	that use a dedicated register.

	* defs.h (struct tcb): Change the type of u_error to unsigned long.
	* syscall.c (trace_syscall_exiting): Change the type of u_error variable
	to unsigned long, print it using %lu format, drop no longer needed
	explicit cast to unsigned long.
	(saved_u_error): Change type to unsigned long.

2016-10-02  Dmitry V. Levin  <ldv@altlinux.org>

	Use tprints instead of tprintf in a few more places.
	* btrfs.c (btrfs_print_qgroup_inherit, btrfs_print_tree_search,
	btrfs_ioctl): Replace tprintf with tprints for printing strings without
	format specifiers.
	* net.c (print_group_req): Likewise.
	* scsi.c (scsi_ioctl): Likewise.
	* term.c (decode_termios, decode_termio): Likewise.
	* userfaultfd.c (uffdio_ioctl): Likewise.

2016-10-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	keyctl: do not print comma for KEYCTL_SESSION_TO_PARENT command.
	Since this command doesn't have any additional arguments, the comma does
	not needed.  Since this is the only command which lacks additional
	arguments, it's better to add special case for it rather than add
	printing of comma to all other commands.

	* keyctl.c (SYS_FUNC(keyctl)): Add check for command not being
	KEYCTL_SESSION_TO_PARENT when printing comma dividing cmd argument
	from the rest.

2016-10-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	keyctl: use getarg_ull for printing generic arguments.
	Otherwise it is erroneous on x32, for example.

	* keyctl.c (SYS_FUNC(keyctl)): Use "%#llx" conversion specifier
	and getarg_ull for fallback argument printing.

2016-10-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	keyctl: use printuid for printing UID/GID.
	UID/GID are unsigned except special -1 value (which is also special in
	context of specific keyctl commands), so special printing function
	should be used.

	* keyctl.c (keyctl_chown_key, keyctl_get_persistent): Use printuid
	instead of printf with "%d" conversion for printing UID/GID.

2016-10-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	io: handle data_size of -1 as unlimited data in print_iovec.
	Otherwise it can be depleted and print_iovec starts printing empty
	strings.

	* io.c (print_iovec): Interpret c->data_size of -1 as unlimited data
	and do not decrease it in this case.

2016-10-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix typo in qual_syscall.test.
	Fix test regression introduced by commit v4.13-225-g55334ef.

	* tests/qual_syscall.test: Fix typo.

2016-09-30  Dmitry V. Levin  <ldv@altlinux.org>

	Enhance -e abbrev=set, -e raw=set, and -e verbose=set.
	Enhance abbrev=, raw=, and verbose= to accept the same syntax as trace=.
	For example, this allows such syntax as -e verbose=file.

	* syscall.c (lookup_class): Define before qual_syscall.
	(qualify): Move the loop based on lookup_class ...
	(qual_syscall): ... here.
	* tests/qual_syscall.test: Check it.

2016-09-30  Dmitry V. Levin  <ldv@altlinux.org>

	tests/qual_syscall.test: rewrite without ls.
	* tests/qual_syscall.test: Invoke ./umovestr instead of ls.
	Update expected output.

2016-09-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of fadvise64 and fadvise64_64 syscalls.
	* tests/fadvise.h: New file.
	* tests/fadvise64.c: Likewise.
	* tests/fadvise64_64.c: Likewise.
	* tests/fadvise64.test: New test.
	* tests/fadvise64_64.test: Likewise.
	* tests/.gitignore: Add fadvise64 and fadvise64_64.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add fadvise64.test, fadvise64_64.test.
	(EXTRA_DIST): Add fadvise.h.

2016-09-28  Dmitry V. Levin  <ldv@altlinux.org>

	mips o32: implement fetching the 7th subcall argument.
	* syscall.c [LINUX_MIPSO32] (decode_mips_subcall): Fetch the last
	argument of 7-arg syscalls.

2016-09-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	x32: use proper decoder for fadvise64 syscall.
	fadvise_64_64 decoder used before this change prints different sign
	of the "len" argument (loff_t vs size_t).

	* linux/x32/syscallent.h (fadvise64): Replace SEN(fadvise64_64)
	with SEN(fadvise64).

2016-09-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	fadvise: use getarg_ull for obtaining len argument of fadvise64 syscall.
	Since its type is size_t, it is 64-bit wide on x32 and special care
	should be taken in order to obtain it.

	* fadvise.c (SYS_FUNC(fadvise64)): Use getarg_ull for obtaining value
	of "len" syscall argument.

2016-09-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	util: add getarg_ll and getarg_ull functions.
	These allow retrieving specific argument in full taking into account
	peculiarities of runtimes which employ tcp->ext_arg (e.g. x32).

	* defs.h (getarg_ll, getarg_ull): New prototypes.
	* util.c (getarg_ll, getarg_ull): New functions.
	(printargs): Use getarg_ull.

2016-09-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	fadvise: change printing of len argument to unsigned in fadvise64 syscall
	The kernel declares fadvise64 as
	long sys_fadvise64(int fd, loff_t offset, size_t len, int advice);

	* fadvise.c (SYS_FUNC(fadvise64)): Change conversion specifier from
	"%ld" to "%lu" for printing len argument since kernel expects argument
	of type size_t.

2016-09-28  Dmitry V. Levin  <ldv@altlinux.org>

	sh64, sparc64: use proper decoder for fadvise64_64 syscall.
	This change is no-op yet, but things will change when decoder
	of fadvise64 syscall get fixed.

	* linux/sh64/syscallent.h (fadvise64_64): Replace SEN(fadvise64)
	with SEN(fadvise64_64).
	* linux/sparc64/syscallent.h (fadvise64_64): Likewise.

2016-09-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of fallocate syscall.
	* configure.ac (AC_CHECK_FUNCS): Add fallocate.
	* tests/fallocate.c: New file.
	* tests/fallocate.test: New test.
	* tests/.gitignore: Add fallocate.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add fallocate.test.

2016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	fallocate: change print format of offset and len arguments to signed.
	Since types of these arguments are off_t and kernel actually expects
	signed values in order to fail when negative values are provided,
	lets display these values as signed.

	* fallocate.c (SYS_FUNC(fallocate)): Change conversion specifier for
	printing "offset" and "len" syscall arguments from %llu to %lld.

2016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add default values for falloc_flags constants.
	In order to avoid dependence of declared constants to headers available
	on build system.

	* xlat/falloc_flags.in: Add default values for constants.

2016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of getcpu syscall.
	* tests/getcpu.c: New file.
	* tests/getcpu.test: New test.
	* tests/.gitignore: Add getcpu.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add getcpu.test.

	tests: make magic values in ioctl_block test distinctive.
	* tests/ioctl.block (init_magic): Add iterator value to magic value
	in order to enable detection of potential 4-byte aligned shifts.

	tests: additional getcwd decoding checks.
	* tests/getcwd.c (main): Add more checks for getcwd arguments decoding.

	tests: check decoding of quotactl syscall.
	* configure.ac (AC_CHECK_HEADERS): Add linux/dqblk_xfs.h, linux/quota.h,
	and sys/quota.h.
	* tests/.gitignore: Add quotactl, quotactl-v, quotactl-xfs,
	and quotactl-xfs-v.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add quotactl.test, quotactl-v.test,
	quotactl-xfs.test, and quotactl-xfs-v.test.
	(EXTRA_DIST): Add quotactl.h
	* quotactl.h: New file.
	* quotactl.c: Likewise.
	* quotactl-v.c: Likewise.
	* quotactl-xfs.c: Likewise.
	* quotactl-xfs-v.c: Likewise.
	* quotactl.test: New test.
	* quotactl-v.test: Likewise.
	* quotactl-xfs.test: Likewise.
	* quotactl-xfs-v.test: Likewise.

2016-09-27  Dmitry V. Levin  <ldv@altlinux.org>

	quota: ensure that names of structure fields are printed properly.
	* quota.c (PRINT_FIELD_D, PRINT_FIELD_U, PRINT_FIELD_X): New macros.
	(decode_cmd_data): Use them to print structure fields.

	Enhance zero_extend_signed_to_ull and sign_extend_unsigned_to_ll macros.
	* defs.h (zero_extend_signed_to_ull, sign_extend_unsigned_to_ll):
	Add support of char types.
	* tests/tests.h (zero_extend_signed_to_ull, sign_extend_unsigned_to_ll):
	Likewise.

	quota: move Q_QUOTAON handling to subcommand switch statement.
	* quota.c (SYS_FUNC(quotactl)): Move handling of Q_QUOTAON subcommand ...
	(decode_cmd_data): ... here.

2016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	quota: remove legacy subcommand decoding support code.
	Support for these quota subcommands by linux kernels has been dropped
	long time ago (between 2.5.16 and 2.5.17), so lets drop it in order
	to minimize amount of code which should be subjected to testing and
	structured conversion.

	* quota.c (struct v1_dqblk, struct v2_dqblk, struct v2_dqinfo,
	struct v1_dqstats, struct v2_dqstats): Remove.
	(decode_cmd_data): Remove handling of Q_V1_GETQUOTA, Q_V1_SETQUOTA,
	Q_V2_GETQUOTA, Q_V2_SETQUOTA, Q_V2_GETINFO, Q_V2_SETINFO, Q_V1_GETSTATS,
	and Q_V2_GETSTATS subcommands.
	(SYS_FUNC(quotactl)): Remove handling of Q_V1_QUOTAON subcommand.

2016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	quota: add realtime block limits fields to XFS disk quota printing code.
	* quota.c (decode_cmd_data): Add printing of d_rtb_hardlimit
	and d_rtb_softlimit fields to struct xfs_dqblk printing code.

2016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	quota: add packed attribute to struct if_dqblk definition.
	Since the only difference between 32-bit and 64-bit environments
	regarding this structure is its padding, lets just add packed attribute
	to its definition instead of going full mpers.

	* quota.c (struct if_dqblk): Add ATTRIBUTE_PACKED.

2016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	quota: Add decoding for Q_XQUOTARM subcommand.
	* quota.c (decode_cmd_data): Add Q_XQUOTARM handling to subcommand
	  switch.

2016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	quota: add dispatch of SYNC subcommands.
	Q_XQUOTASYNC is no-op, but it does not require id/addr arguments anyway.

	* quota.c (decode_cmd_data): Add Q_SYNC and Q_XQUOTASYNC to subcommand
	dispatch switch since id/addr arguments for these subcommands are known
	to be ignored.

2016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	quota: add missing prefixes to struct field names.
	* quota.c (decode_cmd_data): Print field names in accordance with
	their definition.

	quota: fix indentation inside subcommand dispatching switch statement.

2016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	quota: avoid printing id argument for those commands that ignore it.
	As id argument is not used for Q_QUOTAOFF, Q_GETFMT, Q_V2_GETINFO,
	Q_GETINFO, Q_V2_SEETINFO, Q_SETINFO, Q_SYNC, Q_XQUOTAON, Q_XQUOTAOFF,
	Q_XQUOTARM, Q_XGETQSTAT, Q_XGETQSTATV, Q_XQUOTASYNC, Q_V1_GETSTATS, and
	Q_V2_GETSTATS subcommands, do not print it for these subcommands.

	* quota.c (decode_cmd_data): Add id argument parameter, add printing
	of id argument for Q_GETQUOTA, Q_SETQUOTA, Q_GETNEXTQUOTA,
	Q_V1_GETQUOTA, Q_V1_SETQUOTA, Q_V2_GETQUOTA, Q_V2_SETQUOTA,
	Q_XGETQUOTA, Q_XGETNEXTQUOTA, Q_XSETQLIM, and unknown subcommands.
	(SYS_FUNC(quotactl)): Remove printing of id argument, pass it
	to decode_cmd_data.

2016-09-27  Eugene Syromyatnikov  <evgsyr@gmail.com>

	quota: use printuid for id parameter printing.
	* quota.c (SYS_FUNC(quotactl)): Since id call argument is used for
	user/group/project ID which all have special semantics for -1,
	print it the same way as UIDs are printed.

	quota: display quota subcommand as a macro.
	* quota.c (SYS_FUNC(quotactl)): Replace disjunction of two xlat values
	(which also lacks shift of the left part) with QCMD macro call.

2016-09-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use VERBOSE macro in waitid and waitid-v tests.
	* tests/waitid-v.c (VERBOSE_RUSAGE): Remove.
	(VERBOSE): Define to 1.
	* tests/waitid.c (sprint_rusage): Check VERBOSE instead
	of VERBOSE_RUSAGE.

	tests: use VERBOSE macro in wait4 and wait4-v tests.
	* tests/wait4-v.c (VERBOSE_RUSAGE): Remove.
	(VERBOSE): Define to 1.
	* tests/wait4.c (sprint_rusage): Check VERBOSE instead
	of VERBOSE_RUSAGE.

	tests: use VERBOSE macro in msg_control and msg_control-v tests.
	* tests/msg_control-v.c (VERBOSE_MSGHDR): Remove.
	(VERBOSE): Define to 1.
	* tests/msg_control.c (print_fds, print_ip_opts): Check VERBOSE instead
	of VERBOSE_MSGHDR.

	tests: use VERBOSE macro in mmsg_name and mmsg_name-v tests.
	* tests/mmsg_name-v.c (VERBOSE_MMSGHDR): Remove.
	(VERBOSE): Define to 1.
	* tests/mmsg_name.c (test_mmsg_name): Check VERBOSE instead
	of VERBOSE_MMSGHDR.

	tests: use VERBOSE macro in ioctl_rtc and ioctl_rtc-v tests.
	* tests/ioctl_rtc-v.c (VERBOSE_IOCTL): Remove.
	(VERBOSE): Define to 1.
	* tests/ioctl_rtc.c (print_rtc_time): Check VERBOSE instead
	of VERBOSE_IOCTL.

	tests: use VERBOSE macro in ioctl_evdev and ioctl_evdev-v tests.
	* tests/ioctl_evdev-v.c (VERBOSE_IOCTL): Remove.
	(VERBOSE): Define to 1.
	* tests/ioctl_evdev.c: Check VERBOSE instead of VERBOSE_IOCTL.

	tests: use VERBOSE macro in execveat and execveat-v tests.
	* tests/execveat-v.c (VERBOSE_EXECVEAT): Remove.
	(VERBOSE): Define to 1.
	* tests/execveat.c (main): Check VERBOSE instead of VERBOSE_EXECVEAT.

	tests: use VERBOSE macro in execve and execve-v tests.
	* tests/execve-v.c (VERBOSE_EXECVE): Remove.
	(VERBOSE): Define to 1.
	* tests/execve.c (main): Check VERBOSE instead of VERBOSE_EXECVE.

2016-09-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add VERBOSE macro.
	Introduce VERBOSE macro (defaults to 0) that is expected to be defined
	to 1 by code testing "strace -v" output.

	* tests/tests.h [!VERBOSE] (VERBOSE): New macro.

2016-09-20  Dmitry V. Levin  <ldv@altlinux.org>

	decode_open: print the mode argument when O_TMPFILE flag is set.
	O_TMPFILE reqires the mode argument (just like O_CREAT), so print it.

	* open.c (STRACE_O_TMPFILE): New macro.
	(decode_open): Print the mode argument when O_TMPFILE flag is set.
	* tests/open.c (main): Check it.
	Fixes RH#1377846.

2016-09-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use sprintrc in tests/ptrace.c.
	* tests/ptrace.c (errstr): New static variable.
	(do_ptrace): Initialize it using sprintrc.
	(test_peeksiginfo, main): Use errstr.

	tests: use sprintrc in tests/netlink_protocol.c.
	* tests/netlink_protocol.c (main): Use sprintrc.

	tests: use sprintrc in tests/fchownat.c.
	* tests/fchownat.c (main): Use sprintrc.

	tests: use sprintrc in tests/fchmodat.c.
	* tests/fchmodat.c (main): Use sprintrc.  Add more fchmodat decoding tests.

	tests: use sprintrc in tests/fchmod.c.
	* tests/fchmod.c (main): Use sprintrc.  Add more fchmod decoding tests.
	* tests/fchmod.test: Update the value specified for strace -a parameter.

	tests: use sprintrc in tests/getgroups.c.
	* tests/getgroups.c (main): Use sprintrc.

	tests: use sprintrc in tests/setgroups.c.
	* tests/setgroups.c (main): Use sprintrc.

2016-09-19  Dmitry V. Levin  <ldv@altlinux.org>

	tests/utime.c: rewrite without assert.
	* tests/utime.c: Do not include <assert.h>.
	(main): Use sprintrc instead of assert.

	tests/xattr.c: rewrite without assert.
	* tests/xattr.c: Do not include <assert.h>.
	(main): Use sprintrc instead of assert.

	tests: use sprintrc in tests/xchownx.c.
	* tests/xchownx.c (main): Do not include <errno.h>.  Use sprintrc.

	tests/xstatfsx.c: fix potential errno clobbering.
	* tests/xstatfsx.c (main): Use sprintrc.

2016-09-19  Dmitry V. Levin  <ldv@altlinux.org>

	Add more fs magic constants.
	Add *_MAGIC constants defined for some relatively widespread
	non-mainline filesystems.

	* xlat/fsmagic.in: Add AUFS_SUPER_MAGIC, GPFS_SUPER_MAGIC,
	VZFS_SUPER_MAGIC, and ZFS_SUPER_MAGIC constants.

2016-09-15  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: fix whitespace for explicit type casts in futex test.

2016-09-14  Dmitry V. Levin  <ldv@altlinux.org>

	Add more fs magic constants.
	Add *_MAGIC constants defined inside linux fs but not explicitly
	exported via linux uapi.

	* xlat/fsmagic.in: Add HFS_SUPER_MAGIC, HFSPLUS_SUPER_MAGIC,
	EXOFS_SUPER_MAGIC, CEPH_SUPER_MAGIC, UBIFS_SUPER_MAGIC, JFS_SUPER_MAGIC,
	BEFS_SUPER_MAGIC, NTFS_SB_MAGIC, XFS_SB_MAGIC, CONFIGFS_MAGIC,
	FUSE_CTL_SUPER_MAGIC, FUSE_SUPER_MAGIC, AFS_FS_MAGIC, OCFS2_SUPER_MAGIC,
	VXFS_SUPER_MAGIC, LOGFS_MAGIC, SMB2_MAGIC_NUMBER, and CIFS_MAGIC_NUMBER
	constants.

2016-09-14  Dmitry V. Levin  <ldv@altlinux.org>

	Update fs *_MAGIC constants.
	Add fs *_MAGIC constants exported by linux uapi.

	* xlat/fsmagic.in: Add BFS_MAGIC, GFS2_MAGIC, and ROMFS_MAGIC constants
	defined in linux/bfs_fs.h, linux/gfs2_ondisk.h, and linux/romfs_fs.h,
	respectively.

2016-09-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests: workaround limited semctl implementation in musl.
	musl libc forwards semctl command argument for 8 known commands only,
	for all the rest it passes 0 instead.

	* tests/ipc_sem.c (main): Update semctl expected output.

2016-09-13  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add more IPC decoding checks.
	* tests/ipc_msg.c: Additional msgget (parameter format) and msgctl
	(parameter format, decoding of struct msqid_ds in IPC_SET/IPC_STAT
	commands) checks.
	* tests/ipc_sem.c: Additional semget and semctl checks.
	* tests/ipc_shm.c: Additional shmget and shmctl checks.
	* tests/semop.c: Additional semop checks.  Add checks for semtimedop.
	* tests/semop.test: Add explicit -e parameter in order to trace both
	semop and semtimedop.
	* tests/shmxt.c: Additional shmat and shmdt checks.

2016-09-12  Dmitry V. Levin  <ldv@altlinux.org>

	.mailmap: add addresses of Dr. David Alan Gilbert.
	* .mailmap: Add both addresses of Dr. David Alan Gilbert here to avoid
	duplications in CREDITS file.

2016-09-12  Eugene Syromyatnikov  <evgsyr@gmail.com>

	.mailmap: add canonical name for Eugene Syromyatnikov.
	This is needed due to apparent deviation in spelling of commit author
	name in several commits.

	* .mailmap: Add canonical name for Eugene Syromyatnikov.

2016-09-12  Dmitry V. Levin  <ldv@altlinux.org>

	Update generic ioctl entries from linux 4.8.
	* linux/64/ioctls_inc.h: Update from linux v4.8 using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.

2016-09-12  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	x32: update ioctl entries from linux 4.8.
	* linux/x32/ioctls_inc0.h: Update from linux v4.8 using ioctls_gen.sh.

	maint: update for linux 4.8.
	* maint/ioctls_sym.sh: Add workarounds for linux/atm_zatm.h and
	xen/evtchn.h files.

2016-09-12  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use sprintrc_grep in tests/ipc_shm.c.
	* tests/ipc_shm.c (main): Use sprintrc_grep.

	tests: use sprintrc_grep in tests/ipc_sem.c.
	* tests/ipc_sem.c (main): Use sprintrc_grep.

2016-09-11  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use sprintrc_grep in tests/ipc_msg.c.
	* tests/ipc_msg.c (main): Use sprintrc_grep.

2016-09-10  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use sprintrc in tests/chmod.c.
	* tests/chmod.c (main): Use sprintrc.  Add more chmod decoding tests.

2016-09-09  Dmitry V. Levin  <ldv@altlinux.org>

	ipc: fix printing of nsops argument of semop and semtimedop syscalls.
	According to POSIX, nsops argument of semop syscall has type size_t,
	but the kernel treats nsops argument of semop and semtimedop syscalls
	as unsigned int.

	* ipc_sem.c (tprint_sembuf_array): Change type of "count" argument
	from unsigned long to unsigned int, print it using %u format.

2016-09-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests/aio.c: bring indentation in conformance with the rest of the file.

2016-09-09  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: use predefined constant in aio_context_t checks in aio test.
	Also fix io_cancel and io_destroy checks which did not check correct
	printing of context argument properly.

	* tests/aio.c (main): Update syscall checks in order to use newly
	defined bogus_ctx constant.

2016-09-09  Dmitry V. Levin  <ldv@altlinux.org>

	Mark io_setup and io_destroy as memory mapping related syscalls.
	As io_setup syscall allocates some memory using do_mmap_pgoff, and
	io_destroy deallocates this memory using vm_munmap, set TRACE_MEMORY
	flag for all sysentries of io_setup and io_destroy using the following
	oneliner:
	sed -ri '/io_setup|io_destroy/ s/0,/TM,/' linux/*/syscallent*.h

	* linux/*/syscallent*.h (io_setup, io_destroy): Change sys_flags to TM.

2016-09-08  Dmitry V. Levin  <ldv@altlinux.org>

	travis: add x86 musl.
	* .travis.yml (matric): Add musl-gcc/x86.
	* travis-build.sh [TARGET == x86]: Specify --target along with --build
	to configure.
	* travis-install.sh [CC == musl-gcc && TARGET == x32]: Add -mx32 to $CC.
	[CC == musl-gcc && TARGET == x86]: Add -m32 to $CC.  Specify --build
	and --target to musl configure invocation.

2016-09-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: use PRI__*64 macros in aio test.
	It was incorrectly assumed that __*64 types are long long on all
	platforms, despite strace having specially crafted macros in order
	to handle precisely this architecture discrepancy.
	The commit fixes this oversight.

	* tests/aio.c (main): Use PRI__*64 macros for correct format conversion
	specifiers for __*64-typed values.

2016-09-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	ipc: fix printing of integer arguments.
	* ipc_msgctl.c (SYS_FUNC(msgctl)): As msqid argument is treated as int
	by the kernel, cast it to int and print it using %d format.
	* ipc_sem.c (SYS_FUNC(semop), SYS_FUNC(semtimedop)): Likewise,
	for semid argument.
	(SYS_FUNC(semget)): Likewise, for nsems argument.
	(SYS_FUNC(semctl)): Likewise, for semid and semnum arguments.
	* ipc_shm.c (SYS_FUNC(shmat)): Likewise, for shmid argument.
	* ipc_shmctl.c (SYS_FUNC(shmctl)): Likewise.

2016-09-08  Dmitry V. Levin  <ldv@altlinux.org>

	ipc: fix printing key_t arguments of msgget, semget, and shmget syscalls
	* ipc_msg.c (SYS_FUNC(msgget)): As key_t type in the kernel
	is __kernel_key_t (i.e. int), cast key_t argument to int
	and print it using %#x format.
	* ipc_sem.c (SYS_FUNC(semget)): Likewise.
	* ipc_shm.c (SYS_FUNC(shmget)): Likewise.
	* tests/ipc_msg.c (main): Test it.
	* tests/ipc_sem.c (main): Likewise.
	* tests/ipc_shm.c (main): Likewise.

2016-09-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add more sched_getattr and sched_setattr decoding checks.
	* tests/sched_xetattr.c (main): Add more sched_getattr and sched_setattr
	decoding checks.

2016-09-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: change type of sched_nice field to signed in sched_xetattr test.
	Kernel headers declare this field as s32, and strace prints it with %d
	specifier.

	* tests/sched_xetattr.c (main): Change type of sched_nice field of struct
	sched_attr to int32_t, update format specifiers accordingly.

2016-09-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add sprintrc_grep function to libtests.
	New sprintrc_grep function is sprintrc function equivalent suitable for
	tests where grep-base pattern matching is employed.

	* tests/tests.h (sprintrc_grep): New prototype.
	* tests/sprintrc.c (enum sprintrc_fmt): New sprintrc format enumeration.
	(sprintrc_ex): New function, renamed from sprintrc and updated to
	support different formats.
	(sprintrc): Change to use sprintrc_ex with SPRINTRC_FMT_RAW.
	(sprintrc_grep): New function, calls sprintrc_ex with SPRINTRC_FMT_GREP.

2016-09-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: perform more strict structure allocation in sched_xetattr test.
	Use tail_alloc with precise size of the structure.

	* tests/sched_xetattr.c (main): Eliminate usage of anonymous union type.
	Rename sched to sched_attr.  Change type of sched_attr to struct
	pointer.  Use tail_alloc for sched_attr allocation, update printf
	statements accrodingly.

2016-09-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: split long lines in sched_xetattr test.
	* tests/sched_xetattr.c (main): Split long lines.

2016-09-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests/aio.c: fix for x32 personality.
	* tests/aio.c (main): Do not pass 64-bit aio_context_t to io_submit
	and io_getevents until strace learns how to print 64-bit pointers on x32
	and on x86_64 for x32 personality.

2016-09-07  Dmitry V. Levin  <ldv@altlinux.org>

	aio: print aio_context_t as a pointer type.
	As aio_context_t is treated by the kernel as a pointer,
	print it using printaddr.

	* aio.c (SYS_FUNC(io_setup)): Print the pointer to aio_context_t
	argument using printnum_ptr.
	(SYS_FUNC(io_destroy), SYS_FUNC(io_submit), SYS_FUNC(io_cancel),
	SYS_FUNC(io_getevents)): Print aio_context_t argument using printaddr.
	* tests/aio.c (sprint_aio_context_t): Remove.
	(main): Update expected output.

2016-09-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests/aio.c: rewrite without assert.
	* tests/aio.c: Do not include <assert.h>.
	(main): Use sprintrc instead of assert.

2016-09-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add more aio decoding checks.
	* tests/aio.c (sprint_aio_context_t): New function.
	(main): Use it; add more checks.

2016-09-06  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add suffix and cast to 64-bit constants in aio test.
	This helps to avoid warnings like
	"integer constant is too large for ‘long’ type"
	reported by some versions of gcc on 32-bit platforms.

	* tests/aio.c (main): Add ULL suffix to 64-bit constants
	and cast them to unsigned long.

2016-09-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of perf_event_open syscall.
	* tests/perf_event_open.c: New file.
	* tests/perf_event_open.test: New test.
	* tests/.gitignore: Add perf_event_open.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add perf_event_open.test.

	Makefile.am: use pwd instead of realpath.
	* Makefile.am (CODE_COVERAGE_GENHTML_OPTIONS): Use standard pwd(1)
	instead of less widespread realpath(1) utility from GNU coreutils.

2016-09-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use sprintrc in tests/xetpriority.c.
	* tests/xetpriority.c (main): Use sprintrc.

	tests: use sprintrc in vhangup.test.
	* tests/vhangup.c (main): Use sprintrc.

	tests: use sprintrc in tests/sockname.c.
	* tests/sockname.c (test_sockname_syscall): Use sprintrc.

	tests: use sprintrc in signalfd4.test.
	* tests/signalfd4.c (main): Use sprintrc.

	tests: use sprintrc in setrlimit.test.
	* tests/setrlimit.c (main): Use sprintrc.

	tests: use sprintrc in set_mempolicy.test.
	* tests/set_mempolicy.c (main, print_nodes): Use sprintrc.

	tests: use sprintrc in openat.test.
	* tests/openat.c (main): Use sprintrc.

	tests: use sprintrc in open.test.
	* tests/open.c (main): Use sprintrc.

	tests: use sprintrc in move_pages.test.
	* tests/move_pages.c (print_stat_pages, print_move_pages): Use sprintrc.

	tests: use sprintrc in mlockall.test.
	* tests/mlockall.c (main): Use sprintrc.

	tests: use sprintrc in mlock.test.
	* tests/mlock.c (main): Use sprintrc.

	tests: use sprintrc in epoll_create1.test.
	* tests/epoll_create1.c (main): Use sprintrc.

2016-09-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: fix printing of min_nr and nr arguments of io_getevents syscall.
	* tests/aio.c (main): Change output format for min_nr and nr arguments
	in io_getevents check to %ld, cast these arguments to long.

	tests: use sprintrc for return code output in aio test.
	* tests/aio.c (main): Use sprintrc for return code output.

	tests: add more tests for ched_rr_get_interval decoding.
	* tests/sched_rr_get_interval.c (main): Check decoding of invalid
	timespec pointer and successful syscall invocation.

	tests: use sprintrc for return code output in sched_rr_get_interval test
	* tests/sched_rr_get_interval.c (main): Use sprintrc for return code
	output.

	tests: add more tests for sched_getscheduler and sched_xetscheduler.
	* tests/sched_xetscheduler.c (main): Check for decoding of invalid PID
	in sched_getscheduler and sched_setscheduler, invalid address
	of sched_param structure, and invalid policy value.

	tests: use sprintrc for return code output in sched_xetscheduler test.
	* tests/sched_xetscheduler.c (main): Use sprintrc for return code output.

2016-09-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	aio: use printfd for fd printing.
	struct iocb contains two fields with fd semantics: aio_fildes and
	aio_resfd.  It is quite reasonable to use the appropriate function for
	printing them (apart from just "%d").

	* aio.c (print_common_flags): Add struct tcb pointer to parameter list;
	use printfd for printing aio_resfd field.
	(print_iocb_header): Add struct tcb pointer to parameter list;
	use printfd for printing aio_fildes field.
	(print_iocb): Provide tcp argument to print_iocb_header
	and print_common_flags.
	(SYS_FUNC(io_cancel)): Likewise.

2016-09-05  Dmitry V. Levin  <ldv@altlinux.org>

	sh64: wire up new syscalls.
	* linux/sh64/syscallent.h [380..393]: New entries.

2016-09-02  Dmitry V. Levin  <ldv@altlinux.org>

	sh: wire up new syscalls.
	* linux/sh/syscallent.h [369..382]: New entries.

2016-09-05  Dmitry V. Levin  <ldv@altlinux.org>

	avr32: wire up preadv2 and pwritev2 syscalls.
	* linux/avr32/syscallent.h [326]: Add preadv2 entry.
	[327]: Add pwritev2 entry.

2016-09-05  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: check decoding of readahead syscall.
	* configure.ac (AC_CHECK_FUNCS): Add readahead.
	* tests/readahead.c: New file.
	* tests/readahead.test: New test.
	* tests/.gitignore: Add readahead.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add readahead.test.

2016-09-02  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: move sprintrc function to libtests.
	* tests/tests.h (sprintrc): New prototype.
	* tests/futex.c (sprintrc): Move to ...
	* tests/sprintrc.c: ... new file.
	* tests/Makefile.am (libtests_a_SOURCES): Add sprintrc.c.

	tests/futex: add support to sprintrc for return codes other than 0 and -1
	* tests/futex.c (sprintrc): Print the actual return code provided,
	not just "0".  Check snprintf return code.

	tests/futex: increase sprintrc static buffer size.
	* tests/futex.c (sprintrc): Increase buffer size from 256 to 4096.

	tests/futex: rename retstr to sprintrc.
	* tests/futex.c (retstr): Rename to sprintrc.
	(main): Convert all retstr calls to sprintrc.

2016-09-01  Eugene Syromyatnikov  <evgsyr@gmail.com>

	readahead: fix print format for the "count" argument.
	According to documentation and kernel's syscalls.h, its type is size_t,
	so "%lu" format should be used instead of "%ld".

	* readahead.c (SYS_FUNC(readahead)): Fix conversion specifier
	for the "count" argument.

2016-08-31  Dmitry V. Levin  <ldv@altlinux.org>

	tests/xstatx.c: use zero_extend_signed_to_ull/sign_extend_unsigned_to_ll
	Use zero_extend_signed_to_ull and sign_extend_unsigned_to_ll macros
	instead of explicit casts with unpredictable sign extension semantics.

	* tests/xstatx.c (print_time, main): Use zero_extend_signed_to_ull
	instead of explicit cast.
	(print_stat): Use zero_extend_signed_to_ull and
	sign_extend_unsigned_to_ll instead of explicit casts.

2016-08-31  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add sign_extend_unsigned_to_ll macro.
	* tests/tests.h (sign_extend_unsigned_to_ll): New macro from defs.h.

2016-08-31  Eugene Syromiatnikov  <evgsyr@gmail.com>

	Refactor common sa_handler printing code.
	* xlat/sa_handler_values.in: New file.
	* signal.c: Include "xlat/sa_handler_values.h".
	(get_sa_handler_str, print_sa_handler): New functions.
	(SYS_FUNC(sigsetmask), SYS_FUNC(signal), decode_new_sigaction): Use them.

2016-08-31  Dmitry V. Levin  <ldv@altlinux.org>

	Update TCP* constants.
	* xlat/socktcpoptions.in: Add TCP_REPAIR_WINDOW introduced by linux
	kernel commit v4.8-rc1~140^2~226.

2016-08-30  Dmitry V. Levin  <ldv@altlinux.org>

	Update SCTP_* constants.
	* xlat/socksctpoptions.in: Add SCTP_PR_SUPPORTED, SCTP_DEFAULT_PRINFO,
	and SCTP_PR_ASSOC_STATUS introduced by linux kernel commits
	v4.8-rc1~140^2~148^2~5, v4.8-rc1~140^2~148^2~4, and
	v4.8-rc1~140^2~148^2~3, respectively.

	Update fs *_MAGIC constants.
	* xlat/fsmagic.in: Add BALLOON_KVM_MAGIC and ZSMALLOC_MAGIC introduced
	by linux kernel commits v4.8-rc1~147^2~82 and v4.8-rc1~147^2~74,
	respectively.

	Update KEXEC_ARCH_* constants.
	* xlat/kexec_arch_values.in: Add KEXEC_ARCH_AARCH64 introduced by linux
	kernel commit v4.8-rc1~16^2~41.

	Update ETH_P_* constants.
	* xlat/ethernet_protocols.in: Add ETH_P_NCSI introduced by linux kernel
	commit v4.8-rc1~140^2~65^2~8.

	Update BPF_* constants.
	* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_CGROUP_ARRAY introduced
	by linux kernel commit v4.8-rc1~140^2~212^2~2.
	* xlat/bpf_prog_types.in: Add BPF_PROG_TYPE_XDP introduced
	by linux kernel commit v4.8-rc1~140^2~64^2~10.

2016-08-30  Dmitry V. Levin  <ldv@altlinux.org>

	Remove HAVE_SIGACTION checks.
	The syscall parsers guarded by HAVE_SIGACTION check have to be compiled
	regardless of libc sigaction function availability.

	* configure.ac (AC_CHECK_FUNCS): Remove sigaction.
	* signal.c: Remove HAVE_SIGACTION checks.

2016-08-30  Dmitry V. Levin  <ldv@altlinux.org>

	Remove obsolescent autoconf macro AC_TYPE_SIGNAL.
	All supported systems are expected to have C89 conforming sematics.

	* configure.ac (AC_TYPE_SIGNAL): Remove.

2016-08-30  Dmitry V. Levin  <ldv@altlinux.org>

	Remove obsolescent autoconf macro AC_C_CONST.
	All supported systems are expected to have the 'const' keyword.

	* configure.ac (AC_C_CONST): Remove.

2016-08-30  Eugene Syromiatnikov  <evgsyr@gmail.com>

	tests: check decoding of futex syscall.
	* tests/futex.c: New file.
	* tests/futex.test: New test.
	* tests/.gitignore: Add futex.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add futex.test.

2016-08-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	futex: do not pretend <linux/futex.h> is included.
	As configure.ac does not check for linux/futex.h, HAVE_LINUX_FUTEX_H is
	never defined and therefore the inclusion of <linux/futex.h> guarded by
	HAVE_LINUX_FUTEX_H makes no sense.

	Moreover, <linux/futex.h> used to have an incorrect definition
	of FUTEX_WAIT_BITSET_PRIVATE and FUTEX_WAKE_BITSET_PRIVATE:
	since kernel commit v2.6.24-6320-gcd68998 where these definitions
	were initially introduced and up to v2.6.31-7082-gf8d1e54 where they
	were finally fixed these macros had been incorrectly defined via
	FUTEX_WAIT_BITS and FUTEX_WAKE_BITS instead of FUTEX_WAIT_BITSET
	and FUTEX_WAKE_BITSET, and these incorrect definitions made their way
	into some distributions still in use.

	* futex.c [HAVE_LINUX_FUTEX_H]: Remove.

2016-08-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	futex: avoid printing val when it is not used by the futex command.
	This is analogous to timeout argument omitting in FUTEX_WAKE_BITSET
	command.

	* futex.c (SYS_FUNC(futex)): Remove common printing of val argument.
	Add printing of val argument for all futex commands except
	FUTEX_LOCK_PI, FUTEX_UNLOCK_PI, and FUTEX_TRYLOCK_PI.

2016-08-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	xlat: add FUTEX_WAIT* commands with FUTEX_CLOCK_REALTIME bit set.
	* xlat/futexops.in: Add FUTEX_WAIT|FUTEX_CLOCK_REALTIME and
	FUTEX_WAIT_PRIVATE|FUTEX_CLOCK_REALTIME values supported by linux kernel
	since commit v4.5-rc1~172^2.

2016-08-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	futex: fix formatting of unknown command argument.
	Use alternate form for printing hexadecimal numbers to avoid confusion.
	Use printaddr to print uaddr as the latter is interpreted as a pointer
	in all currently supported futex operations.

	* futex.c (SYS_FUNC(futex)): Fix formatting of unknown command
	argument.

2016-08-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	futex: add handling of FUTEX_FD command.
	Since obsolete FUTEX_FD command is known and used to have some expected
	argument format, print FUTEX_FD using that format.

	* futex.c (SYS_FUNC(futex)): Handle FUTEX_FD command.

2016-08-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	futex: fix formatting of val3 hexadecimal argument.
	* futex.c (SYS_FUNC(futex)): In FUTEX_WAIT_BITSET and FUTEX_WAKE_BITSET,
	print hexadecimal val3 argument in alternate form to avoid confusion.

2016-08-30  Eugene Syromyatnikov  <evgsyr@gmail.com>

	futex: fix FUTEX_WAKE_OP compare function mask.
	According to the initial and current (v4.7) kernel implementations,
	in FUTEX_WAKE_OP case the compare function does not have
	FUTEX_OP_OPARG_SHIFT flag and occupies 4 bits starting with bit 24.

	* futex.c (SYS_FUNC(futex)): Do not print FUTEX_OP_OPARG_SHIFT
	for 27th bit of val3 in FUTEX_WAKE_OP case.

2016-08-30  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use correct m32/mx32 st_mtime_nsec checks in tests/xstatx.c.
	* bootstrap: Add -DMPERS_IS_$(MPERS_NAME) to ARCH_MFLAGS.
	* tests/xstatx.c [USE_ASM_STAT && STRUCT_STAT_IS_STAT64 && MPERS_IS_m32]:
	Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
	to HAVE_M32_STRUCT_STAT64_ST_MTIME_NSEC.
	[USE_ASM_STAT && STRUCT_STAT_IS_STAT64 && MPERS_IS_mx32]:
	Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
	to HAVE_MX32_STRUCT_STAT64_ST_MTIME_NSEC.
	[USE_ASM_STAT && !STRUCT_STAT_IS_STAT64 && MPERS_IS_m32]:
	Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
	to HAVE_M32_STRUCT_STAT_ST_MTIME_NSEC.
	[USE_ASM_STAT && !STRUCT_STAT_IS_STAT64 && MPERS_IS_mx32]:
	Redefine HAVE_STRUCT_STAT_ST_MTIME_NSEC
	to HAVE_MX32_STRUCT_STAT_ST_MTIME_NSEC.

	Based on patch by James Clarke <jrtc27@jrtc27.com>.

2016-08-30  Dmitry V. Levin  <ldv@altlinux.org>

	Remove redundant check for PTRACE_LISTEN availability.
	As ptrace.h already ensures that PTRACE_LISTEN is defined,
	there is no need to check this fact in other places.

	* strace.c (ptrace_restart): Do not check that PTRACE_LISTEN is defined.

2016-08-30  Dmitry V. Levin  <ldv@altlinux.org>

	Remove unused autoconf macro AC_TYPE_GETGROUPS.
	strace code does not use GETGROUPS_T.

	* configure.ac (AC_TYPE_GETGROUPS): Remove.

2016-08-30  Dmitry V. Levin  <ldv@altlinux.org>

	Remove unused autoconf macro AC_TYPE_MODE_T.
	strace code already redefines mode_t.

	* configure.ac (AC_TYPE_MODE_T): Remove.

2016-08-30  James Clarke  <jrtc27@jrtc27.com>

	Use PTRACE_SUNDETACH everywhere on SPARC and SPARC64.
	SPARC has a different PTRACE_DETACH value correctly defined in
	sys/ptrace.h, but linux/ptrace.h clobbers it with the standard one.
	PTRACE_SUNDETACH is also defined to the correct value by sys/ptrace.h,
	so use that instead.

	* strace.c (detach) [SPARC]: Move redefinition of PTRACE_DETACH
	to PTRACE_SUNDETACH ...
	* ptrace.h [SPARC || SPARC64]: ... here.

2016-08-29  Dmitry V. Levin  <ldv@altlinux.org>

	Remove obsolescent autoconf macro AC_HEADER_STDC.
	All systems supported by strace are expected to have C89 conforming
	header files.

	* configure.ac (AC_HEADER_STDC): Remove.

2016-08-29  Dmitry V. Levin  <ldv@altlinux.org>

	Remove unneeded autoconf macro AC_HEADER_DIRENT.
	strace code already includes <dirent.h> unconditionally.

	* configure.ac (AC_HEADER_DIRENT): Remove.

2016-08-28  Dmitry V. Levin  <ldv@altlinux.org>

	Remove unneeded autoconf macro AC_HEADER_STDBOOL.
	strace code assumes C99.

	* configure.ac (AC_HEADER_STDBOOL): Remove.
	* defs.h: Include <stdbool.h> unconditionally.

2016-08-27  Dmitry V. Levin  <ldv@altlinux.org>

	Remove obsolescent autoconf macro AC_HEADER_STAT.
	No systems supported by strace are expected to have the bug workarounded
	by AC_HEADER_STAT macro.

	* configure.ac (AC_HEADER_STAT): Remove.

2016-08-29  Dmitry V. Levin  <ldv@altlinux.org>

	Do not use AC_HEADER_MAJOR, include <sys/sysmacros.h> unconditionally.
	glibc, starting with commit glibc-2.24-28-gdbab657, has deprecated
	inclusion of <sys/sysmacros.h> by <sys/types.h>.  The method used
	for deprecation breaks AC_HEADER_MAJOR: this autoconf macro no longer
	defines MAJOR_IN_SYSMACROS, which consequently breaks build.

	Let's assume that all systems supported by strace provide major, minor,
	and makedev macros via <sys/sysmacros.h>.

	* configure.ac (AC_HEADER_MAJOR): Remove.
	* mknod.c [MAJOR_IN_SYSMACROS, MAJOR_IN_MKDEV]: Remove.
	Include <sys/sysmacros.h> unconditionally.
	* print_struct_stat.c: Likewise.
	* tests/mknod.c: Likewise.
	* tests/mknodat.c: Likewise.
	* tests/xstatx.c: Likewise.

2016-08-29  Dmitry V. Levin  <ldv@altlinux.org>

	btrfs: mpersify struct btrfs_ioctl_vol_args_v2.
	This complements commit v4.11-719-gfb0c609.

	* btrfs.c (struct_btrfs_ioctl_vol_args_v2): New type.  Mpersify it.
	(btrfs_print_qgroup_inherit): Change qgi_addr type to unsigned long.
	(btrfs_ioctl): Replace struct btrfs_ioctl_vol_args_v2 with
	struct_btrfs_ioctl_vol_args_v2.

2016-08-29  Elvira Khabirova  <lineprinter0@gmail.com>

	mpers.awk: relax union member name absence check.
	This fixes mpersing of unions containing nameless members,
	e.g. struct btrfs_ioctl_vol_args_v2.

	* mpers.awk (what_is): Print names of union_type members as is.

2016-08-24  Dmitry V. Levin  <ldv@altlinux.org>

	Revert "tests/xstatx.c: fix stat syscall tests on mips64"
	Previous commit effectively changed types of st_atime, st_ctime, and
	st_mtime members of struct stat and struct stat64 to signed integers,
	making the mips64 workaround obsolete.

	This reverts commit 3fb84bfc79949c145197c61fbf04ce18464e9112.

	* tests/xstatx.c (create_sample) [__mips64]: Remove.

2016-08-24  Dmitry V. Levin  <ldv@altlinux.org>

	Mpersify parsers of struct stat and struct stat64.
	On many architectures that support multiple personalities,
	struct stat differ between personalities.  While old code could handle
	these differences, there are some architectures, e.g. sparc64, that also
	have different struct stat64.  Rewrite parsers using mpers functionality
	to fix these issues.

	* fetch_struct_stat.c: New file.
	* fetch_struct_stat64.c: Likewise.
	* print_struct_stat.c: Likewise.
	* oldstat.c: Likewise.
	* stat.c: Likewise.
	* stat.h: Likewise.
	* stat64.c: Likewise.
	* file.c: Remove.
	* printstat.h: Likewise.
	* linux/aarch64/stat32.h: Likewise.
	* linux/powerpc64/stat32.h: Likewise.
	* linux/riscv/stat32.h: Likewise.
	* linux/sparc64/stat32.h: Likewise.
	* linux/tile/stat32.h: Likewise.
	* linux/x32/stat32.h: Likewise.
	* linux/x86_64/stat32.h: Likewise.
	* Makefile.am (strace_SOURCES): Add fetch_struct_stat.c,
	fetch_struct_stat64.c, print_struct_stat.c, oldstat.c, stat.c, stat.h,
	and stat64.c.  Remove file.c, printstat.h, linux/aarch64/stat32.h,
	linux/powerpc64/stat32.h, linux/riscv/stat32.h, linux/sparc64/stat32.h,
	linux/tile/stat32.h, linux/x32/stat32.h, and linux/x86_64/stat32.h.
	* configure.ac (AC_CHECK_MEMBERS): Add struct stat64.st_mtime_nsec.
	* defs.h (struct strace_stat): New declaration.
	(print_struct_stat): New prototype.
	* linux/dummy.h (sys_fstatat64): Remove.

2016-08-24  Dmitry V. Levin  <ldv@altlinux.org>

	mpers.m4: check for struct stat64, struct stat, and their members.
	* m4/mpers.m4 (st_MPERS_STRUCT_STAT): New macro.
	(st_MPERS): Use it.

2016-08-24  Dmitry V. Levin  <ldv@altlinux.org>

	mpers: add MPERS_IS_* to CFLAGS passed to mpers.sh.
	This allows testing of MPERS_IS_* macros in pre-MPERS_DEFS parts
	of source code.

	* Makefile.am (mpers-m%.stamp): Add -DMPERS_IS_$(mpers_NAME) to CFLAGS
	passed to mpers.sh.
	* mpers_test.sh: Likewise.

2016-08-24  Dmitry V. Levin  <ldv@altlinux.org>

	Move redefinition of stat types to asm_stat.h.
	* file.c: Move redefinition of types that might be used
	to define struct stat ...
	* linux/asm_stat.h: ... here.
	* tests/xstatx.c: Remove redefinition of stat types.

2016-08-24  Dmitry V. Levin  <ldv@altlinux.org>

	x86_64: provide a replacement of <asm/stat.h> for x32 personality.
	For the reason described in commit v4.10-517-gcfde1e3, a correct
	definition of struct stat for x32 personality is necessary to enable
	"asm_stat.h" with -mx32 on x86_64.

	* linux/x32/asm_stat.h: Rename to ...
	* linux/x86_64/asm_stat.h: ... new file.
	* Makefile.am (strace_SOURCES): Add it.
	* linux/x32/asm_stat.h: New file, include "x86_64/asm_stat.h".

2016-08-24  Dmitry V. Levin  <ldv@altlinux.org>

	x32/asm_stat.h: provide definitions for i386 personality.
	This enables x32/asm_stat.h with -m32.

	* linux/x32/asm_stat.h [__x86_64__ && __ILP32__]: Redirect stat.
	Include "linux/asm_stat.h".
	(struct stat): Define for [__x86_64__ && __ILP32__] only.
	(struct __old_kernel_stat): Remove.

2016-08-23  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce a separate SEN entry for fstatat64 syscall.
	* linux/dummy.h (sys_fstatat64): Redirect to sys_newfstatat.
	* linux/32/syscallent.h: Replace SEN(newfstatat) with SEN(fstatat64).
	* linux/alpha/syscallent.h: Likewise.
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.
	* pathtrace.c (pathtrace_match): Handle SEN_fstatat64.

2016-08-23  Dmitry V. Levin  <ldv@altlinux.org>

	Do not check for struct stat.st_{a,c}time_nsec.
	Assume that the check for struct stat.st_mtime_nsec is enough.
	Likewise, do not check for struct stat.st_{a,c}tim.tv_nsec.

	* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_atime_nsec,
	struct stat.st_ctime_nsec, struct stat.st_atim.tv_nsec,
	and struct stat.st_ctim.tv_nsec.
	* file.c (HAVE_STRUCT_STAT_ST_ATIME_NSEC,
	HAVE_STRUCT_STAT_ST_CTIME_NSEC): Remove.
	* printstat.h (HAVE_STRUCT_STAT_ST_ATIME_NSEC,
	HAVE_STRUCT_STAT_ST_CTIME_NSEC): Replace with
	HAVE_STRUCT_STAT_ST_MTIME_NSEC.
	* tests/xstatx.c: Likewise.

2016-08-23  Dmitry V. Levin  <ldv@altlinux.org>

	Add sign_extend_unsigned_to_ll macro.
	* defs.h (sign_extend_unsigned_to_ll): New macro, mirrors
	zero_extend_signed_to_ull.

	zero_extend_signed_to_ull: add short int support.
	* defs.h (zero_extend_signed_to_ull): Add short int support.
	* tests/tests.h: Likewise.

	Rename widen_to_ull to zero_extend_signed_to_ull.
	* defs.h (widen_to_ull): Rename to zero_extend_signed_to_ull.
	All callers changed.
	* tests/tests.h: Likewise.

2016-08-23  Dmitry V. Levin  <ldv@altlinux.org>

	sparc, sparc64: remove obsolete code.
	Remove remains of solaris personality support.
	This complements commit v4.10-45-gdf4dd8b.

	* file.c [SPARC || SPARC64] (SYS_FUNC(xstat), SYS_FUNC(fxstat)): Remove.

2016-08-22  Dmitry V. Levin  <ldv@altlinux.org>

	sparc64: fix decoding of struct stat64 related syscalls.
	For some reason, struct stat and struct stat64 are different on sparc64.
	This change fixes decoding of struct stat64 related syscalls for sparc64
	personality, sparc32 personality on sparc64 needs more work.

	* file.c (printstat64) [SPARC64]: Do not use printstat.
	(SYS_FUNC(newfstatat)): Likewise.

2016-08-22  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: fill old_value argument in timer{,fd}_xettime tests.
	This is needed in order to differentiate it from the value returned
	by the call.  As a consequence, it enables revealing possible bugs
	in syscall parsers, for example, when the value read on syscall
	entering and not on syscall exiting, as it was the case with
	timerfd_settime parser.

	* tests/timer_xettime.c (main): Fill old.its field with value different
	from the expected one upon call return.
	* tests/timerfd_xettime.c: Likewise.

2016-08-22  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Fix old_value argument retrieval in timerfd_settime parser.
	This is done similar to timer_settime syscall parser.

	* time.c (SYS_FUNC(timerfd_settime)): Retrieve old_value argument
	on exiting and not on entering.  Return 0 instead of RVAL_DECODED
	since the call hasn't been decoded in full on entering.

2016-08-21  Richard W.M. Jones  <rjones@redhat.com>

	Add RISC-V architecture support.
	The original port of strace was done by Palmer Dabbelt
	(eecs.berkeley.edu), based on strace 4.9.

	* configure.ac: Define RISCV for riscv*.
	* clone.c [RISCV]: Define ARG_* macros as for OR1K.
	* defs.h [RISCV] (SUPPORTED_PERSONALITIES): Define to 2.
	[RISCV] (NEED_UID16_PARSERS): Define to 1.
	* linux/riscv/arch_regs.c: New file.
	* linux/riscv/errnoent1.h: Likewise.
	* linux/riscv/get_error.c: Likewise.
	* linux/riscv/get_scno.c: Likewise.
	* linux/riscv/get_syscall_args.c: Likewise.
	* linux/riscv/ioctls_arch0.h: Likewise.
	* linux/riscv/ioctls_arch1.h: Likewise.
	* linux/riscv/ioctls_inc0.h: Likewise.
	* linux/riscv/ioctls_inc1.h: Likewise.
	* linux/riscv/signalent1.h: Likewise.
	* linux/riscv/stat32.h: Likewise.
	* linux/riscv/syscallent.h: Likewise.
	* linux/riscv/syscallent1.h: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.

2016-08-21  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Move SH-specific argument number calculation to getllval.
	This change prevents scattering of ll-related hacks and simplifies
	pread/pwrite syscalls parsers' logic a bit.

	* util.c (getllval): Add fixup for arg_no for SuperH when argument
	number is equal to 3.
	* io.c (PREAD_OFFSET_ARG): Remove.
	(SYS_FUNC(pread)): Always use argument number 3 for "count" argument
	printing.
	(SYS_FUNC(pwrite)): Likewise.

2016-08-21  Dmitry V. Levin  <ldv@altlinux.org>

	sparc64: fix sigreturn decoding for sparc personality.
	* linux/sparc/arch_sigreturn.c (arch_sigreturn): Parametrize
	member types of struct signal_frame.
	* linux/sparc64/arch_sigreturn.c (sparc64_arch_sigreturn,
	sparc32_arch_sigreturn): New functions.
	(arch_sigreturn): Use them.

2016-08-20  Dmitry V. Levin  <ldv@altlinux.org>

	Fix compat decoding of struct sigaction.sa_mask on big endian architectures
	* signal.c (decode_new_sigaction) [SUPPORTED_PERSONALITIES > 1 &&
	SIZEOF_LONG > 4]: Use LONG_LONG to convert sa_mask from 32-bit
	struct sigaction to 64-bit struct sigaction.

2016-08-19  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of indirect shmat's return code for non-native personalities
	* ipc_shm.c (SYS_FUNC(shmat)): Fetch current_wordsize bytes of data
	to obtain return code of indirect shmat subcall.

2016-08-18  Dmitry V. Levin  <ldv@altlinux.org>

	sparc64: fix sparc personality decoding of mmap64's offset argument.
	* linux/sparc64/syscallent1.h: Remove redirection of sys_mmap_4koff.

2016-08-19  Dmitry V. Levin  <ldv@altlinux.org>

	sparc64: fix decoding of the forth argument of semctl syscall.
	On sparc64, unlike all other architectures where semctl is an indirect
	ipc subcall, the forth argument is passed directly.

	* ipc_sem.c (SYS_FUNC(semctl)) [SPARC64]: Print 4th argument without
	indirection in case of native personality.

2016-08-16  Dmitry V. Levin  <ldv@altlinux.org>

	Add sparc64 specific ptrace constants.
	* xlat/ptrace_cmds.in: Add PTRACE_GETREGS64, PTRACE_SETREGS64,
	PTRACE_GETFPREGS64, and PTRACE_SETFPREGS64.

	sparc64: fix sign extension bug of syscall args for sparc personality.
	* linux/sparc64/get_syscall_args.c (get_syscall_args): Zero-extend
	syscall args from 32 bit for sparc personality.

2016-08-16  Dmitry V. Levin  <ldv@altlinux.org>

	sparc64: fix tty ioctl numbers.
	The structures defined in asm/termbits.h have the same size
	on sparc and sparc64.

	* linux/sparc64/ioctls_arch0.h (TCGETS, TCGETS2, TCSETS, TCSETS2,
	TCSETSF, TCSETSF2, TCSETSW, TCSETSW2): Sync with
	linux/sparc/ioctls_arch0.h

2016-08-15  Dmitry V. Levin  <ldv@altlinux.org>

	evdev.c: fix typo in comment.

2016-08-15  Dmitry V. Levin  <ldv@altlinux.org>

	Drop support of dummy members of struct stat.
	As st_flags, st_fstype, and st_gen members of struct stat are not filled
	by the kernel, there is no use supporting them.

	* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_flags,
	struct stat.st_fstype, and struct stat.st_gen.
	* file.c [STAT32_PERSONALITY, HAVE_STRUCT_STAT64]: Do not undefine
	HAVE_STRUCT_STAT_ST_FLAGS, HAVE_STRUCT_STAT_ST_FSTYPE,
	and HAVE_STRUCT_STAT_ST_GEN.
	* printstat.h (DO_PRINTSTAT): Do not check for
	HAVE_STRUCT_STAT_ST_FLAGS, HAVE_STRUCT_STAT_ST_FSTYPE,
	and HAVE_STRUCT_STAT_ST_GEN.

2016-08-15  Dmitry V. Levin  <ldv@altlinux.org>

	Assume that struct stat contains st_blksize, st_blocks, and st_rdev.
	Our test suite already assumes that struct stat contains st_blksize,
	st_blocks, and st_rdev members, and there haven't been any complaints.

	* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_blksize,
	struct stat.st_blocks, and struct stat.st_rdev.
	* printstat.h (DO_PRINTSTAT): Do not check for
	HAVE_STRUCT_STAT_ST_BLKSIZE, HAVE_STRUCT_STAT_ST_BLOCKS,
	and HAVE_STRUCT_STAT_ST_RDEV.

2016-08-15  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix pause.test when pause syscall is not available.
	* tests/pause.c (main): Fix expected output when pause syscall
	is not available.

2016-08-14  Dmitry V. Levin  <ldv@altlinux.org>

	powerpc64, sparc64: fix redefinitions of ARCH_PC_REG.
	This fixes compilation warning that ARCH_PC_REG is redefined.

	* linux/powerpc64/arch_regs.c (ARCH_PC_REG): Undefine before
	the new definition.
	* linux/sparc64/arch_regs.c (ARCH_PC_REG): Likewise.

2016-08-14  Dmitry V. Levin  <ldv@altlinux.org>

	s390x, x32: remove redundant definitions of ARCH_PC_REG.
	* linux/s390x/arch_regs.c (ARCH_PC_REG): Remove, it is already defined
	in just included linux/s390/arch_regs.c.
	* linux/x32/arch_regs.c (ARCH_PC_REG): Remove, it is already defined
	in just included linux/x86_64/arch_regs.c.

2016-08-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check for leaks of placeholder descriptors.
	* tests/redirect-fds.c: New file.
	* tests/redirect-fds.test: New test.
	* tests/.gitignore: Add redirect-fds.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(MISC_TESTS): Add redirect-fds.test.

	tests/init.sh: print exit code of failed commands.
	* init.sh (run_prog, run_prog_skip_if_failed): When the program fails,
	add its exit code to the diagnostic message.
	(run_strace): When strace fails, add its exit code to the diagnostic
	message.
	(run_strace_merge): When strace-log-merge fails, add its exit code
	to the diagnostic message.

2016-08-13  Dmitry V. Levin  <ldv@altlinux.org>

	Fix leakage of placeholder descriptors to tracees.
	As a side effect of commit v4.11-211-g0736d4e, strace used to leak
	placeholders for standard descriptors to tracees thus affecting their
	behaviour.  Fix this by setting close-on-exec flag on placeholder
	descriptors.

	* strace.c (open_dummy_desc): Set close-on-exec flag on the descriptor
	that is going to be returned to the caller.
	(fd_is_placeholder): New array.
	(ensure_standard_fds_opened, redirect_standard_fds): New functions.
	(startup_child): Use redirect_standard_fds.
	(init): Use ensure_standard_fds_opened.

2016-08-12  Dmitry V. Levin  <ldv@altlinux.org>

	sparc64: fix decoding of uid and gid-related syscalls.
	sparc64 has no native 16-bit uid/gid syscalls.

	* linux/sparc64/syscallent.h (chown, lchown, setuid, getuid, setgid,
	getgid, geteuid, getegid, getgroups, setgroups, fchown, setreuid,
	setregid, setfsuid, setfsgid): Change handlers from 16-bit to 32-bit.

2016-08-12  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix *stat64 tests on alpha.
	On some architectures including alpha, <asm/stat.h> provides a
	definition of struct stat that has no st_atime_nsec, st_mtime_nsec, and
	st_ctime_nsec fields.  At the same time, struct stat64 always has these
	fields.  Fix tests to take this difference into account.

	* tests/fstat64.c (STRUCT_STAT_IS_STAT64): New macro, defined to 1.
	* tests/lstat64.c (STRUCT_STAT_IS_STAT64): Likewise.
	* tests/stat64.c (STRUCT_STAT_IS_STAT64): Likewise.
	* tests/xstatx.c [!STRUCT_STAT] (STRUCT_STAT_IS_STAT64): New macro,
	defined to 0.
	[USE_ASM_STAT && STRUCT_STAT_IS_STAT64]:
	(HAVE_STRUCT_STAT_ST_ATIME_NSEC, HAVE_STRUCT_STAT_ST_CTIME_NSEC,
	HAVE_STRUCT_STAT_ST_MTIME_NSEC): Redefine to 1.

2016-08-11  Dmitry V. Levin  <ldv@altlinux.org>

	tests: skip rt_tgsigqueueinfo.test when the syscall is not available.
	* tests/rt_tgsigqueueinfo.c (main): Skip the test when the syscall
	is not available.

2016-08-11  James Cowgill  <james410@cowgill.org.uk>

	tests/fcntl.c: fix fcntl test on mips64.
	On mips64 the F_GETLK and F_SETLKW64 constants have identical values which
	causes the "wrong" constant to be printed by strace.

	tests/fcntl.c (test_flock64): Do not test F_SETLKW64 on mips64.

2016-08-11  James Cowgill  <james410@cowgill.org.uk>

	tests/nsyscalls.test: only trace the "syscall" syscall on mips o32.
	The "syscall" syscall only exists on o32 and causes strace to error out on
	64-bit mips ABIs. Pass MIPS_ABI from the configure script through to
	nsyscalls.test so the MIPS ABI can be checked.

	* configure.ac (MIPS_ABI): Substitute into output files.
	* tests/Makefile.am (MIPS_ABI): Export via AM_TEST_LOG_FLAGS.
	* tests/nsyscalls.test: Restrict special mips handling to mips o32.

2016-08-11  James Cowgill  <james410@cowgill.org.uk>

	tests/xstatx.c: fix stat syscall tests on mips64.
	For historical reasons the kernel struct stat represents times as unsigned
	32-bit integers on mips64. Therefore, while it's possible to give a file a
	timestamp before 1970 with futimens, reading the same timestamp through
	struct stat will give a positive time (around 2106).
	Workaround by using positive timestamps for testing on mips64.

	* tests/xstatx.c (create_sample): Use positive timestamps on mips64.

2016-08-11  Dmitry V. Levin  <ldv@altlinux.org>

	tests/mlock2.c: fix test failure on mips64.
	* tests/mlock2.c (main): Pass unsigned long arguments to mlock2 syscall
	explicitly, to avoid unwanted sign extension issues.

	Based on patch by James Cowgill <james410@cowgill.org.uk>

2016-08-09  Dmitry V. Levin  <ldv@altlinux.org>

	Use <asm/unistd.h> instead of <sys/syscall.h>
	There are no users of SYS_* macros provided by <sys/syscall.h>,
	and definitions of __NR_* macros could be obtained directly
	from <asm/unistd.h>.

	* defs.h: Include <asm/unistd.h> instead of <sys/syscall.h>.
	* test/seccomp.c: Likewise.
	* test/threaded_execve.c: Likewise.
	* test/x32_lseek.c: Likewise.
	* test/x32_mmap.c: Likewise.
	* tests/_newselect.c: Likewise.
	* tests/access.c: Likewise.
	* tests/acct.c: Likewise.
	* tests/aio.c: Likewise.
	* tests/alarm.c: Likewise.
	* tests/attach-f-p.c: Likewise.
	* tests/bpf.c: Likewise.
	* tests/brk.c: Likewise.
	* tests/chmod.c: Likewise.
	* tests/chown.c: Likewise.
	* tests/chown32.c: Likewise.
	* tests/chroot.c: Likewise.
	* tests/clock_adjtime.c: Likewise.
	* tests/clock_nanosleep.c: Likewise.
	* tests/clock_xettime.c: Likewise.
	* tests/copy_file_range.c: Likewise.
	* tests/creat.c: Likewise.
	* tests/dup2.c: Likewise.
	* tests/dup3.c: Likewise.
	* tests/epoll_create.c: Likewise.
	* tests/epoll_create1.c: Likewise.
	* tests/epoll_ctl.c: Likewise.
	* tests/epoll_pwait.c: Likewise.
	* tests/epoll_wait.c: Likewise.
	* tests/eventfd.c: Likewise.
	* tests/execveat.c: Likewise.
	* tests/faccessat.c: Likewise.
	* tests/fchdir.c: Likewise.
	* tests/fchmod.c: Likewise.
	* tests/fchmodat.c: Likewise.
	* tests/fchown.c: Likewise.
	* tests/fchown32.c: Likewise.
	* tests/fchownat.c: Likewise.
	* tests/fcntl.c: Likewise.
	* tests/fcntl64.c: Likewise.
	* tests/fdatasync.c: Likewise.
	* tests/flock.c: Likewise.
	* tests/fstat.c: Likewise.
	* tests/fstat64.c: Likewise.
	* tests/fstatat64.c: Likewise.
	* tests/fstatfs.c: Likewise.
	* tests/fstatfs64.c: Likewise.
	* tests/fsync.c: Likewise.
	* tests/ftruncate.c: Likewise.
	* tests/ftruncate64.c: Likewise.
	* tests/futimesat.c: Likewise.
	* tests/get_mempolicy.c: Likewise.
	* tests/getcwd.c: Likewise.
	* tests/getdents.c: Likewise.
	* tests/getdents64.c: Likewise.
	* tests/getegid.c: Likewise.
	* tests/getegid32.c: Likewise.
	* tests/geteuid.c: Likewise.
	* tests/geteuid32.c: Likewise.
	* tests/getgid.c: Likewise.
	* tests/getgid32.c: Likewise.
	* tests/getgroups.c: Likewise.
	* tests/getgroups32.c: Likewise.
	* tests/getpgrp.c: Likewise.
	* tests/getrandom.c: Likewise.
	* tests/getresgid.c: Likewise.
	* tests/getresgid32.c: Likewise.
	* tests/getresuid.c: Likewise.
	* tests/getresuid32.c: Likewise.
	* tests/getrlimit.c: Likewise.
	* tests/getrusage.c: Likewise.
	* tests/getuid.c: Likewise.
	* tests/getuid32.c: Likewise.
	* tests/getxxid.c: Likewise.
	* tests/ioctl_uffdio.c: Likewise.
	* tests/ioperm.c: Likewise.
	* tests/iopl.c: Likewise.
	* tests/ipc.c: Likewise.
	* tests/kill.c: Likewise.
	* tests/lchown.c: Likewise.
	* tests/lchown32.c: Likewise.
	* tests/libmmsg.c: Likewise.
	* tests/libsocketcall.c: Likewise.
	* tests/link.c: Likewise.
	* tests/linkat.c: Likewise.
	* tests/llseek.c: Likewise.
	* tests/lseek.c: Likewise.
	* tests/lstat.c: Likewise.
	* tests/lstat64.c: Likewise.
	* tests/mbind.c: Likewise.
	* tests/membarrier.c: Likewise.
	* tests/memfd_create.c: Likewise.
	* tests/migrate_pages.c: Likewise.
	* tests/mkdir.c: Likewise.
	* tests/mkdirat.c: Likewise.
	* tests/mknod.c: Likewise.
	* tests/mknodat.c: Likewise.
	* tests/mlock.c: Likewise.
	* tests/mlock2.c: Likewise.
	* tests/move_pages.c: Likewise.
	* tests/newfstatat.c: Likewise.
	* tests/nsyscalls.c: Likewise.
	* tests/old_mmap.c: Likewise.
	* tests/oldselect.c: Likewise.
	* tests/open.c: Likewise.
	* tests/openat.c: Likewise.
	* tests/pause.c: Likewise.
	* tests/poll.c: Likewise.
	* tests/prctl-seccomp-filter-v.c: Likewise.
	* tests/prctl-seccomp-strict.c: Likewise.
	* tests/preadv2-pwritev2.c: Likewise.
	* tests/prlimit64.c: Likewise.
	* tests/pselect6.c: Likewise.
	* tests/ptrace.c: Likewise.
	* tests/readdir.c: Likewise.
	* tests/readlink.c: Likewise.
	* tests/readlinkat.c: Likewise.
	* tests/reboot.c: Likewise.
	* tests/remap_file_pages.c: Likewise.
	* tests/rename.c: Likewise.
	* tests/renameat.c: Likewise.
	* tests/renameat2.c: Likewise.
	* tests/rmdir.c: Likewise.
	* tests/rt_sigpending.c: Likewise.
	* tests/rt_sigprocmask.c: Likewise.
	* tests/rt_sigsuspend.c: Likewise.
	* tests/rt_sigtimedwait.c: Likewise.
	* tests/rt_tgsigqueueinfo.c: Likewise.
	* tests/sched_get_priority_mxx.c: Likewise.
	* tests/sched_rr_get_interval.c: Likewise.
	* tests/sched_xetaffinity.c: Likewise.
	* tests/sched_xetattr.c: Likewise.
	* tests/sched_xetparam.c: Likewise.
	* tests/sched_xetscheduler.c: Likewise.
	* tests/sched_yield.c: Likewise.
	* tests/seccomp-filter-v.c: Likewise.
	* tests/seccomp-filter.c: Likewise.
	* tests/seccomp-strict.c: Likewise.
	* tests/select.c: Likewise.
	* tests/sendfile.c: Likewise.
	* tests/sendfile64.c: Likewise.
	* tests/set_mempolicy.c: Likewise.
	* tests/setdomainname.c: Likewise.
	* tests/setfsgid.c: Likewise.
	* tests/setfsgid32.c: Likewise.
	* tests/setfsuid.c: Likewise.
	* tests/setfsuid32.c: Likewise.
	* tests/setgid.c: Likewise.
	* tests/setgid32.c: Likewise.
	* tests/setgroups.c: Likewise.
	* tests/setgroups32.c: Likewise.
	* tests/sethostname.c: Likewise.
	* tests/setregid.c: Likewise.
	* tests/setregid32.c: Likewise.
	* tests/setresgid.c: Likewise.
	* tests/setresgid32.c: Likewise.
	* tests/setresuid.c: Likewise.
	* tests/setresuid32.c: Likewise.
	* tests/setreuid.c: Likewise.
	* tests/setreuid32.c: Likewise.
	* tests/setrlimit.c: Likewise.
	* tests/setuid.c: Likewise.
	* tests/setuid32.c: Likewise.
	* tests/signalfd4.c: Likewise.
	* tests/socketcall.c: Likewise.
	* tests/splice.c: Likewise.
	* tests/stat.c: Likewise.
	* tests/stat64.c: Likewise.
	* tests/statfs.c: Likewise.
	* tests/statfs64.c: Likewise.
	* tests/swap.c: Likewise.
	* tests/symlink.c: Likewise.
	* tests/symlinkat.c: Likewise.
	* tests/sync.c: Likewise.
	* tests/sync_file_range.c: Likewise.
	* tests/sync_file_range2.c: Likewise.
	* tests/syslog.c: Likewise.
	* tests/tee.c: Likewise.
	* tests/time.c: Likewise.
	* tests/timer_create.c: Likewise.
	* tests/timer_xettime.c: Likewise.
	* tests/timerfd_xettime.c: Likewise.
	* tests/times-fail.c: Likewise.
	* tests/times.c: Likewise.
	* tests/truncate.c: Likewise.
	* tests/truncate64.c: Likewise.
	* tests/ugetrlimit.c: Likewise.
	* tests/umount.c: Likewise.
	* tests/umount2.c: Likewise.
	* tests/uname.c: Likewise.
	* tests/unix-pair-send-recv.c: Likewise.
	* tests/unlink.c: Likewise.
	* tests/unlinkat.c: Likewise.
	* tests/userfaultfd.c: Likewise.
	* tests/utimes.c: Likewise.
	* tests/vhangup.c: Likewise.
	* tests/vmsplice.c: Likewise.
	* tests/waitid.c: Likewise.
	* tests/waitpid.c: Likewise.
	* tests/xet_robust_list.c: Likewise.
	* tests/xetpgid.c: Likewise.
	* tests/xetpriority.c: Likewise.
	* tests/xettimeofday.c: Likewise.

2016-08-09  Dmitry V. Levin  <ldv@altlinux.org>

	ia64: replace SYS_clone2 with __NR_clone2.
	Migrate to __NR_* the last user of SYS_* macros provided
	by <sys/syscall.h>.

	* clone.c [IA64] (ARG_STACKSIZE, ARG_PTID, ARG_CTID, ARG_TLS): Replace
	SYS_clone2 with __NR_clone2.

2016-08-09  Dmitry V. Levin  <ldv@altlinux.org>

	Make sure that tcp->s_ent and tcp->s_prev_ent do not point to freed memory
	This complements commit v4.13-33-g60d7ec8.

	* syscall.c (sysent_buf): New structure.
	(free_sysent_buf): New function.
	(get_scno): Use them.

2016-08-09  Dmitry V. Levin  <ldv@altlinux.org>

	file.c: move definitions of struct stat32 to separate files.
	* linux/aarch64/stat32.h: New file.
	* linux/powerpc64/stat32.h: Likewise.
	* linux/sparc64/stat32.h: Likewise.
	* linux/tile/stat32.h: Likewise.
	* linux/x32/stat32.h: Likewise.
	* linux/x86_64/stat32.h: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.
	* file.c [SUPPORTED_PERSONALITIES > 1]: Remove arch specific definitions
	of struct stat32, include "stat32.h" instead.

2016-08-09  Dmitry V. Levin  <ldv@altlinux.org>

	sparc, sparc64: remove obsolete code.
	Remove remains of solaris personality support.
	This complements commit v4.10-45-gdf4dd8b.

	* file.c [SPARC || SPARC64]: Remove the code related to struct solstat.
	(printstat, printoldstat) [SPARC || SPARC64]: Remove.

2016-08-09  Dmitry V. Levin  <ldv@altlinux.org>

	sparc64: fix decoding of stat family syscalls.
	This complements commit v4.13-28-gaebfe83.

	* file.c [SPARC64]: Change STAT32_PERSONALITY to 1.

2016-08-09  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of invalid syscalls mapped to indirect subcalls.
	When the syscall number returned by arch_get_scno is a mapped indirect
	subcall (i.e. mapped subcall of socketcall or ipc syscall), do not
	mistakenly treat it as a valid indirect subcall.

	* defs.h (SCNO_IS_VALID): Treat scno with TRACE_INDIRECT_SUBCALL flag
	as invalid.
	* syscall.c (syscall_name): Do no shuffle scno.
	(trace_syscall_entering, trace_syscall_exiting): Use
	tcp->s_ent->sys_name instead of syscall_name.
	(get_scno): In case of invalid syscall, allocate a dynamic struct sysent
	containing an appropriate .sys_name.
	* tests/nsyscalls.c (main) [SYS_socket_subcall]: Check decoding
	of direct syscall number SYS_socket_subcall+1.
	(main) [SYS_ipc_subcall]: Check decoding of direct syscall number
	SYS_ipc_subcall+1.

2016-08-08  Dmitry V. Levin  <ldv@altlinux.org>

	linux/subcall.h: remove redundant definitions.
	* linux/subcall.h: Remove definitions of non-existent socket
	and ipc subcalls.

	defs.h: simplify SUPPORTED_PERSONALITIES definition.
	* defs.h: Group definition of SUPPORTED_PERSONALITIES by value.

2016-08-08  Dmitry V. Levin  <ldv@altlinux.org>

	defs.h: simplify PERSONALITY1_WORDSIZE definition.
	Move definition of PERSONALITY1_WORDSIZE macro outside arch specific
	ifdefs.

	* defs.h [SPARC64 || X86_64 || X32 || AARCH64 || POWERPC64 || TILE]
	(PERSONALITY1_WORDSIZE): Remove.
	[SUPPORTED_PERSONALITIES > 1] (PERSONALITY1_WORDSIZE): Define to 4
	unconditionally.

2016-08-08  Dmitry V. Levin  <ldv@altlinux.org>

	defs.h: simplify PERSONALITY0_WORDSIZE definition.
	Move definition of PERSONALITY0_WORDSIZE macro outside arch specific
	ifdefs.

	* defs.h (PERSONALITY0_WORDSIZE): Define to SIZEOF_LONG unconditionally.

2016-08-08  Dmitry V. Levin  <ldv@altlinux.org>

	sparc64: swap personality numbers.
	Fix inconsistency between syscall and ioctl entries on sparc64.
	Make layout of personalities on sparc64 the same as on other
	architectures that support two personalities.

	* defs.h [SPARC64] (PERSONALITY0_WORDSIZE): Change to 8.
	[SPARC64] (PERSONALITY1_WORDSIZE): Change to 4.
	* linux/sparc64/get_scno.c (arch_get_scno): Swap personality numbers.
	* linux/sparc64/ioctls_arch1.h: Rename to ioctls_arch0.h.
	* linux/sparc64/ioctls_arch0.h: Rename to ioctls_arch1.h.
	* linux/sparc64/ioctls_inc0.h: Rename to ioctls_inc1.h.
	* linux/sparc64/ioctls_inc1.h: Rename to ioctls_inc0.h.

2016-08-08  Dmitry V. Levin  <ldv@altlinux.org>

	defs.h: cleanup personality specific macro definitions.
	Move the code that defines PERSONALITY[12]_INCLUDE_FUNCS,
	PERSONALITY[12]_INCLUDE_PRINTERS_DECLS,
	PERSONALITY[12]_INCLUDE_PRINTERS_DEFS, and MPERS_{m,mx}32_IOCTL_MACROS
	macros outside arch specific ifdefs.

	* defs.h [SPARC] (PERSONALITY0_WORDSIZE): Remove.
	[SPARC64 && HAVE_M32_MPERS]: Remove.
	[X86_64 && HAVE_M32_MPERS]: Remove.
	[X86_64 && HAVE_MX32_MPERS]: Remove.
	[X32 && HAVE_M32_MPERS]: Remove.
	[AARCH64 && HAVE_M32_MPERS]: Remove.
	[POWERPC64 && HAVE_M32_MPERS]: Remove.
	[TILE && HAVE_M32_MPERS]: Remove.
	(PERSONALITY0_INCLUDE_PRINTERS_DECLS,
	PERSONALITY0_INCLUDE_PRINTERS_DEFS): Define unconditionally.
	[SUPPORTED_PERSONALITIES > 1 && HAVE_M32_MPERS]
	(PERSONALITY1_INCLUDE_PRINTERS_DECLS,
	PERSONALITY1_INCLUDE_PRINTERS_DEFS, PERSONALITY1_INCLUDE_FUNCS,
	MPERS_m32_IOCTL_MACROS): Define for
	[SUPPORTED_PERSONALITIES > 1 && HAVE_M32_MPERS] case.
	(PERSONALITY2_INCLUDE_PRINTERS_DECLS,
	PERSONALITY2_INCLUDE_PRINTERS_DEFS, PERSONALITY2_INCLUDE_FUNCS,
	MPERS_mx32_IOCTL_MACROS): Define for
	[SUPPORTED_PERSONALITIES > 2 && HAVE_MX32_MPERS] case.

2016-08-07  Dmitry V. Levin  <ldv@altlinux.org>

	Change #include guard trailing part comments.
	* defs.h: Change comment of the trailing part of #include guard.
	* flock.h: Likewise.
	* gcc_compat.h: Likewise.
	* ipc_defs.h: Likewise.
	* kernel_types.h: Likewise.
	* mpers_type.h: Likewise.
	* msghdr.h: Likewise.
	* printsiginfo.h: Likewise.
	* ptrace.h: Likewise.
	* regs.h: Likewise.
	* seccomp_fprog.h: Likewise.
	* sigevent.h: Likewise.
	* statfs.h: Likewise.
	* xlat.h: Likewise.

2016-08-08  Eugene Syromyatnikov  <evgsyr@gmail.com>

	Unify usage of #include guards.
	This commit is an attempt to unify usage of include guards (in top-level
	headers, at least).  As a side note, different files with *.h extension
	have different semantics: for example, printargs.h is included multiple
	times in order to generate slightly varying code depending on values of
	macro definitions - maybe it's better to change extension of such files
	to something like *.inc.

	* defs.h: Add #include guard.
	* flock.h: Likewise.
	* ipc_defs.h: Likewise.
	* mpers_type.h: Likewise.
	* printsiginfo.h: Likewise.
	* ptrace.h: Likewise.
	* regs.h: Likewise.
	* seccomp_fprog.h: Likewise.
	* gcc_compat.h: Rename the macro used for #include guard.
	* msghdr.h: Likewise.
	* sigevent.h: Likewise.
	* kernel_types.h: Comment the trailing part of #include guard.
	* xlat.h: Add missing macro definition for #include guard.

2016-08-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add #include guards.
	* tests/tests.h: Add #include guard.

2016-08-05  Dmitry V. Levin  <ldv@altlinux.org>

	linux: add #include guards.
	* linux/dummy.h: Add #include guard.
	* linux/inet_diag.h: Likewise.
	* linux/netlink_diag.h: Likewise.
	* linux/sock_diag.h: Likewise.
	* linux/syscall.h: Likewise.
	* linux/unix_diag.h: Likewise.

2016-08-04  Dmitry V. Levin  <ldv@altlinux.org>

	tests/umode_t.c: guard against libc printf format errors.
	* tests/umode_t.c (test_syscall): Use different printf format specifiers
	to detect libc printf format errors.

2016-08-04  Dmitry V. Levin  <ldv@altlinux.org>

	travis: use a suitable musl revision.
	There seems to be no readily available binary packages of musl that are
	sufficiently up to date to be used to build and test strace, so prepare
	a suitable musl from source.

	* travis-install.sh (musl-gcc): Do not add an extra repository,
	do not install musl-tools and linux-musl-dev packages.
	Download, build, and install a suitable musl revision instead.

2016-08-03  Dmitry V. Levin  <ldv@altlinux.org>

	Fix printing of mode_t, umode_t, and umask types.
	Print numeric umode_t type using %#03ho format.
	Print return value of umask syscall using %#03lo format.
	When printing symbolic mode_t type, always print lower 9 bits,
	and print the numeric part using %#03o format.

	* defs.h (sprintmode): Remove.
	(print_symbolic_mode_t, print_numeric_umode_t,
	print_numeric_long_umask): New prototypes.
	* printmode.c (sprintmode): Remove.
	(print_symbolic_mode_t, print_numeric_umode_t,
	print_numeric_long_umask): New functions.
	* chmod.c (decode_chmod): Use print_numeric_umode_t.
	* ipc_msg.c (SYS_FUNC(msgget)): Likewise.
	* ipc_msgctl.c (print_msqid_ds): Likewise.
	* ipc_sem.c (SYS_FUNC(semget)): Likewise.
	* ipc_shm.c (SYS_FUNC(shmget)): Likewise.
	* ipc_shmctl.c (print_shmid_ds): Likewise.
	* mq.c (SYS_FUNC(mq_open)): Likewise.
	* open.c (decode_open, SYS_FUNC(creat)): Likewise.
	* umask.c (SYS_FUNC(umask)): Likewise.
	* mknod.c (decode_mknod): Use print_symbolic_mode_t.
	* printstat.h (DO_PRINTSTAT): Likewise.
	* syscall.c (trace_syscall_exiting): Use print_numeric_long_umask.
	* tests/umode_t.c: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	* tests/creat.c: Rewrite as a thin wrapper around umode_t.c
	* tests/mkdir.c: Likewise.
	* tests/mkdirat.c: Likewise.
	* tests/mknod.c: Extend test coverage of mknod syscall.
	* tests/mknodat.c: Extend test coverage of mknodat syscall.
	* tests/umask.c: Extend test coverage of umask syscall.
	* tests/creat.test: Update the value specified for strace -a parameter.
	* tests/mkdir.test: Likewise.
	* tests/mkdirat.test: Likewise.
	* tests/mknodat.test: Likewise.

2016-08-02  Dmitry V. Levin  <ldv@altlinux.org>

	tests: simplify attach-f-p.test.
	* tests/attach-f-p.c Simplify communications between threads
	by replacing per-thread timers with pipes.
	* tests/attach-f-p.test: Do not ignore signals.

	tests: cleanup attach-p-cmd.test.
	* tests/attach-p-cmd-cmd.c (main): Cleanup expected output.
	* tests/attach-p-cmd-p.c (main): Print expected output.
	* tests/attach-p-cmd.test: Do not print expected output.

	ip_mreq.test: rewrite from match_grep to match_diff.
	* tests/ip_mreq.c (main): Print expected output.
	* tests/ip_mreq.test: Use run_strace_match_diff.
	* tests/ip_mreq.expected: Remove.
	* tests/Makefile.am (EXTRA_DIST): Remove it.

	fanotify_mark.test: rewrite from match_grep to match_diff.
	* tests/fanotify_mark.c (main): Print expected output.
	* tests/fanotify_mark.test: Use run_strace_match_diff.
	* tests/fanotify_mark.expected: Remove.
	* tests/Makefile.am (EXTRA_DIST): Remove it.

	signalfd4.test: rewrite from match_grep to match_diff.
	* tests/signalfd4.c (get_sigset_size): New function.
	(main): Use it.  Print expected output.
	* tests/signalfd4.test: Use run_strace_match_diff.
	* tests/signalfd4.expected: Remove.
	* tests/Makefile.am (EXTRA_DIST): Remove it.

2016-07-31  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rename signalfd.test to signalfd4.test.
	* tests/signalfd.c: Rename to signalfd4.c.
	* tests/signalfd.test: Rename to signalfd4.test.
	* tests/signalfd.expected: Rename to signalfd4.expected.
	* tests/.gitignore: Replace signalfd with signalfd4.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Replace signalfd.test with signalfd4.test.
	(EXTRA_DIST): Replace signalfd.expected with signalfd4.expected.

2016-07-30  Dmitry V. Levin  <ldv@altlinux.org>

	memfd_create.test: rewrite from match_grep to match_diff.
	* tests/memfd_create.c (main): Print expected output.
	* tests/memfd_create.test: Use run_strace_match_diff.
	* tests/memfd_create.expected: Remove.
	* tests/Makefile.am (EXTRA_DIST): Remove it.

2016-07-29  Dmitry V. Levin  <ldv@altlinux.org>

	Set exit status to 1 if strace has not traced any processes.
	* strace.c (main): Initialize exit_code with 1 when no processes
	has been attached.
	* strace.1: Document it.
	* NEWS: Mention this change.

	Attach to the target process before attempting to attach to its siblings
	* strace.c (attach_tcb): Attach to tcp->pid first.

	Report the name of ptrace command when ptrace_attach_or_seize fails.
	* strace.c (ptrace_attach_cmd): New variable.
	(ptrace_attach_or_seize): Save last ptrace command's name
	to ptrace_attach_cmd.
	(attach_tcb, startup_child): Use it in error diagnostics.

	strace.c: refactor startup_attach.
	* strace.c (startup_attach): Move the inner part of the big loop
	over tcbtab elements ...
	(attach_tcb): ... to this new function.

	startup_attach: do not use atoi.
	* strace.c (startup_attach): Replace atoi with string_to_uint.

2016-07-28  Dmitry V. Levin  <ldv@altlinux.org>

	Do not enable mpers runtime checks if mpers is not enabled.
	* m4/mpers.m4 (HAVE_RUNTIME): Enable iff both mpers and runtime
	work properly.

2016-07-28  Dmitry V. Levin  <ldv@altlinux.org>

	linux/dummy_check.sh: remove obsolete script.
	Starting with commit v4.10-62-ga0bd374, function prototypes
	of syscall parsers are generated at build time.

	* linux/dummy_check.sh: Remove.

2016-07-28  Dmitry V. Levin  <ldv@altlinux.org>

	generate_xlat_in.sh: remove obsolete script.
	This script has been created by commit v4.8-180-g0ed617b
	for the one-shot job of automatic convertion of xlat structures
	from *.c files to xlat/*.in files.

	* generate_xlat_in.sh: Remove.

2016-07-28  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use terse notation in designated initializers where appropriate.
	* tests/btrfs.c (btrfs_test_dev_replace_ioctl): Initialize
	struct btrfs_ioctl_dev_replace_args using terse notation.
	* tests/clock_nanosleep.c (main): Initialize struct timespec
	using terse notation.
	* tests/nanosleep.c (main): Likewise.

2016-07-28  Dmitry V. Levin  <ldv@altlinux.org>

	Consistently use extended regular expressions where appropriate.
	When grep or sed is used with basic regular expressions containing
	'(', ')', '{', '}', '|', '?', and '+' special characters, convert them
	to extended regular expressions for better portability and readability.

	* generate_mpers_am.sh: Convert grep and sed BREs to EREs.
	* Makefile.am (ioctl_redefs%.h, m%_type_defs.h, m%_funcs.h,
	mpers_printer_decl_pattern, printers.h, %_printer_decls.h,
	%_printer_defs.h): Convert sed BREs to EREs.
	* generate_sen.sh: Likewise.
	* linux/mips/genstub.sh: Likewise.
	* make-dsc: Likewise.
	* mpers.sh: Likewise.
	* xlat/gen.sh: Likewise.
	* tests/Makefile.am (ksysent.h): Likewise.
	* tests/ksysent.sed: Likewise.
	* tests/pc.test: Likewise.
	* tests/strace-S.test: Likewise.
	* tests/strace-V.test: Likewise.
	* tests/strace-k.test: Likewise.

2016-07-28  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix extended regexps.
	* tests/adjtimex.c (main): Consistently quote curly braces
	in expected output.
	* tests/uio.expected: Likewise.

2016-07-27  Dmitry V. Levin  <ldv@altlinux.org>

	Post-release administrivia.
	* NEWS: Add header line for the next release.
	* debian/changelog.in: Add a changelog entry for 4.13-1.
	* strace.spec.in: Likewise.

2016-07-26  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for 4.13 release.
	* NEWS: Update for 4.13 release.

	Fix one more code pattern that might break gcc strict aliasing rules.
	* btrfs.c (btrfs_ioctl): Add one more expicit cast to "void *",
	to avoid breaking strict-aliasing rules reported by some gcc compilers.
	* syscall.c (decode_socket_subcall): Likewise.
	* util.c (next_set_bit): Likewise.
	* tests/btrfs.c (btrfs_test_send_ioctl): Likewise.

	Fix casts of ptrace's third argument.
	* strace.c (maybe_allocate_tcb): Replace "(char *) 0" with NULL
	as ptrace's third argument.
	* linux/sparc64/get_scno.c (arch_get_scno): Cast third argument
	of ptrace to "void *'.
	* syscall.c (get_regs): Likewise.
	* upeek.c (upeek): Likewise.
	* util.c (umoven): Likewise.

	tests/btrfs.c: do not include the same header file twice.
	* tests/btrfs.c: Do not include <sys/fcntl.h>, <fcntl.h> is enough.

	tests: fix accept4.test on systems that lack SOCK_CLOEXEC definition.
	* tests/accept4.c: Check that O_CLOEXEC is defined.  Use O_CLOEXEC
	instead of SOCK_CLOEXEC.

2016-07-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix vhangup.test.
	* tests/vhangup.c (main): Fix expected output for the case when
	the calling process has CAP_SYS_TTY_CONFIG capability.

	Reported-by: Yun-Chih Chen <b03902074@ntu.edu.tw>

2016-07-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix chown.test.
	* tests/chown.test: Fix the value specified for strace -a parameter.

	Reported-by: Yun-Chih Chen <b03902074@ntu.edu.tw>

2016-07-25  Dmitry V. Levin  <ldv@altlinux.org>

	x32: fix syscall entries for x86_64 variants of io_setup and io_submit.
	* linux/x32/syscallent.h (64:io_setup, 64:io_submit): Change handler
	to printargs.

	tests/ipc.c: fix typo.

2016-07-24  Dmitry V. Levin  <ldv@altlinux.org>

	NEWS: Prepare for 4.13 release.

2016-07-23  Dmitry V. Levin  <ldv@altlinux.org>

	debian: add gcc-multilib to Build-Depends for relevant architectures.
	* debian/control (Build-Depends) [amd64, ppc64, sparc64, x32]:
	Add gcc-multilib to enable multiple personalities support.

2016-07-22  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of ipc syscall.
	* tests/ipc.c: New file.
	* tests/ipc.test: New test.
	* tests/.gitignore: Add ipc.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add ipc.test.

	Fix corner cases of ipc syscall decoding.
	* xlat/ipccalls.in: New file.
	* ipc.c: New file.
	* Makefile.am (libstrace_a_SOURCES): Add it.
	* linux/dummy.h (sys_ipc): Remove stub alias.
	* syscall.c (decode_ipc_subcall): Treat 1st argument of ipc syscall
	as "unsigned int".
	[S390 || S390X]: Skip ipc cubcalls that have non-zero version.
	[SPARC64]: Likewise, for the native personality.
	Save ipc cubcall version for later use by specific ipc parsers.
	* ipc_msg.c (SYS_FUNC(msgrcv)): Handle non-zero ipc subcall version.
	[SPARC64]: Handle non-ipc_kludge case for the native personality.
	* linux/subcall.h (msgrcv): Change nargs from 4 to 5.
	* linux/s390/syscallent.h (ipc): Change nargs from 6 to 5.
	* linux/s390x/syscallent.h (ipc): Likewise.

2016-07-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: skip netlink_protocol.test on old systems.
	* tests/netlink_protocol.c: Check that HAVE_SYS_XATTR_H is defined.
	Include <stdlib.h> and <sys/xattr.h>.
	(main): Check that system.sockprotoname attribute is supported.

	Do not print too many arguments of socketcall syscall.
	* socketcall.c (SYS_FUNC(socketcall)): Print just "call" and "args"
	syscall arguments.
	* tests/socketcall.c (test_socketcall): Update expected output.
	* tests/socketcall.test: Likewise.

2016-07-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests/nsyscalls.c: change the type of syscall arguments to kernel_ulong_t
	As most syscalls on x32 and mips n32 are actually 64-bit,
	check that 64-bit syscall arguments are decoded properly.

	This also workarounds x32 gcc sign extension bug
	reported by Eugene Syromyatnikov at
	https://sourceforge.net/p/strace/mailman/message/35150860/

	* tests/nsyscalls.c: Include "kernel_types.h".
	(main): Change the type of syscall arguments to kernel_ulong_t.

2016-07-20  Dmitry V. Levin  <ldv@altlinux.org>

	x32, mips n32: make printargs print full 64-bit syscall arguments.
	As most of x32 syscalls are regular x86_64 syscalls, they should be
	printed by default as 64-bit syscalls, and syscall parsers at their
	discretion might print syscalls differently.  This is already
	implemented in 64-bit strace tracing x32 personality processes,
	and now x32 strace will also behave this way.

	Similar reasoning applies to mips n32.

	* util.c (printargs) [HAVE_STRUCT_TCB_EXT_ARG]: Print syscall arguments
	from ext_arg array using %llx format.

2016-07-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of socketcall syscall.
	* tests/socketcall.c: New file.
	* tests/socketcall.test: New test.
	* tests/.gitignore: Add socketcall.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add socketcall.test.

	Fix corner cases of socketcall syscall.
	* xlat/socketcalls.in: New file.
	* socketcall.c: New file.
	* Makefile.am (libstrace_a_SOURCES): Add it.
	* linux/dummy.h (sys_socketcall): Remove stub alias.
	* syscall.c (decode_socket_subcall): Treat 1st argument of socketcall
	as "int".  Do not substitute syscall until all socketcall arguments
	have been fetched successfully.

2016-07-19  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding and dumping of send and recv syscalls.
	* tests/unix-pair-send-recv.c: New file.
	* tests/unix-pair-send-recv.expected: Likewise.
	* tests/unix-pair-send-recv.test: New test.
	* tests/.gitignore: Add unix-pair-send-recv.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add unix-pair-send-recv.test.
	(EXTRA_DIST): Add unix-pair-send-recv.expected.

	tests: rename unix-pair-send-recv to unix-pair-sendto-recvfrom.
	* dumpio.expected: Rename to unix-pair-sendto-recvfrom.expected.
	* dumpio.test: Rename to unix-pair-sendto-recvfrom.test.
	* unix-pair-send-recv.c: Rename to unix-pair-sendto-recvfrom.c
	* .gitignore: Rename unix-pair-send-recv to unix-pair-sendto-recvfrom.
	* Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add unix-pair-sendto-recvfrom.test.
	(MISC_TESTS): Remove dumpio.test.
	(EXTRA_DIST): Rename dumpio.expected
	to unix-pair-sendto-recvfrom.expected.

	tests: check decoding of shutdown syscall.
	* tests/shutdown.c: New file.
	* tests/shutdown.test: New test.
	* tests/.gitignore: Add shutdown.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add shutdown.test.

	xlat/shutdown_modes.in: convert to modern syntax.
	* xlat/shutdown_modes.in: Replace open-coded xlat table with a list
	of constants.

	tests: check silent decoding of sendmmsg and recvmmsg syscalls.
	* tests/mmsg-silent.c: New file.
	* tests/mmsg-silent.test: New test.
	* tests/.gitignore: Add mmsg-silent.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add mmsg-silent.test.

	Print unsent messages of failed sendmmsg syscall.
	* mmsghdr.c (decode_mmsgvec): Clear syserror for the time of printing
	struct mmsghdr array in !use_msg_len case.
	(SYS_FUNC(sendmmsg)): As failed sendmmsg syscall does not
	set msg_len fields, tell this to decode_mmsgvec.
	* tests/mmsg_name.c (test_mmsg_name): Check it.

	Print unsent messages of sendmmsg syscall.
	* defs.h (decode_mmsgvec): Add int argument.
	* mmsghdr.c (print_struct_mmsghdr_config): Add msg_len_vlen field.
	(print_struct_mmsghdr): Print struct mmsghdr.msg_len only for
	msg_len_vlen first elements of struct mmsghdr array.
	(decode_mmsgvec): Add msg_len_vlen argument.
	(SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg)): Pass to decode_mmsgvec
	the number of elements of struct mmsghdr array that contain meaningful
	struct mmsghdr.msg_len.
	* tests/mmsg_name.c (test_mmsg_name): Check it.

	tests: check verbose decoding of msg_name* fields of struct mmsghdr array
	* tests/mmsg_name-v.c: New file.
	* tests/mmsg_name-v.test: New test.
	* tests/.gitignore: Add mmsg_name-v.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add mmsg_name-v.test.

	tests: check decoding of msg_name* fields of struct mmsghdr array.
	* tests/mmsg_name.c: New file.
	* tests/mmsg_name.test: New test.
	* tests/.gitignore: Add mmsg_name.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add mmsg_name.test.

2016-07-19  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of msg_name* fields of recvmmsg syscall's msghdr array argument
	As msg_namelen fields of recvmmsg syscall's struct msghdr array have
	the same read-write semantics as struct msghdr argument of recvmsg
	syscall, parser of recvmmsg syscall needs a similar fix.

	* mmsghdr.c (print_struct_mmsghdr): Increment p_user_msg_namelen field.
	(mmsgvec_data): New structure.
	(free_mmsgvec_data, save_mmsgvec_namelen): New functions.
	(decode_mmsgvec): Take into account the data saved
	by save_mmsgvec_namelen function.
	(SYS_FUNC(recvmmsg)): Use save_mmsgvec_namelen.

2016-07-19  Dmitry V. Levin  <ldv@altlinux.org>

	mmsghdr.c: rewrite decode_mmsgvec using print_array.
	* fetch_struct_mmsghdr.c (sizeof_struct_mmsghdr): New mpers printer.
	* mmsghdr.c: Include <limits.h>.
	(print_struct_mmsghdr_config): New structure.
	(fetch_struct_mmsghdr_or_printaddr, print_struct_mmsghdr): New functions.
	(decode_mmsgvec): Rewrite using them and print_array.

	tests: check decoding of timeout argument of recvmmsg syscall.
	* tests/recvmmsg-timeout.c: New file.
	* tests/recvmmsg-timeout.test: New test.
	* tests/.gitignore: Add recvmmsg-timeout.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add recvmmsg-timeout.test.

	Fix printing of remaining timeout of recvmmsg syscall.
	* mmsghdr.c (SYS_FUNC(recvmmsg)): Do not print remaining timeout
	when the 5th syscall argument is NULL.
	* tests/mmsg.c (main): Update expected output.

	Remove configure checks for recvmmsg and sendmmsg.
	* configure.ac (AC_CHECK_FUNCS): Remove recvmmsg and sendmmsg.

	tests: add recv_mmsg and send_mmsg functions to libtests.
	* tests/tests.h (recv_mmsg, send_mmsg): New prototype.
	* tests/libmmsg.c: New file.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.
	* tests/mmsg.c Do not check for __NR_sendmmsg, __NR_recvmmsg,
	HAVE_SENDMMSG, and HAVE_RECVMMSG.  Do not include unused headers.
	(recv_mmsg, send_mmsg): Remove.

	tests: add socketcall function to libtests.
	* tests/tests.h (socketcall): New prototype.
	* tests/libsocketcall.c: New file.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.

2016-07-18  Dmitry V. Levin  <ldv@altlinux.org>

	Use IOV_MAX instead of UIO_MAXIOV.
	IOV_MAX appears to be more portable than UIO_MAXIOV.

	* msghdr.c: Include <limits.h>. Remove fallback defintion of UIO_MAXIOV.
	(get_optmem_max): Replace UIO_MAXIOV with IOV_MAX.
	* tests/msg_control.c: Likewise.

2016-07-18  Dmitry V. Levin  <ldv@altlinux.org>

	Unabuse struct tcb.auxstr.
	As we've got a proper mechanism that parsers can use for storing private
	data between entering and exiting stages, all cases of struct tcb.auxstr
	abuse should go.

	* btrfs.c (btrfs_ioctl): Use set_tcb_priv_ulong and get_tcb_priv_ulong
	instead of abusing tcp->auxstr.
	* file_handle.c (SYS_FUNC(name_to_handle_at)): Likewise.
	* msghdr.c (SYS_FUNC(recvmsg)): Likewise.
	* net.c (decode_sockname, SYS_FUNC(recvfrom)): Likewise.
	* v4l2.c (print_v4l2_queryctrl): Likewise.

2016-07-18  Dmitry V. Levin  <ldv@altlinux.org>

	Fix race condition in decoding timeout argument of recvmmsg syscall.
	As the value returned by sprint_timespec points to a static area and may
	be overwritten by subsequent calls to sprint_timespec, it is not safe to
	save this value on entering syscall and use it later on exiting.

	* mmsghdr.c (SYS_FUNC(recvmmsg)): On entering syscall, copy the value
	returned by sprint_timespec to a dynamically allocated memory, and save
	the pointer using set_tcb_priv_data.  On exiting, restore it using
	get_tcb_priv_data.

2016-07-18  Dmitry V. Levin  <ldv@altlinux.org>

	Fix race condition in decoding rt_sigtimedwait's timeout argument.
	As the value returned by sprint_timespec points to a static area and may
	be overwritten by subsequent calls to sprint_timespec, it is not safe to
	save this value on entering syscall and use it later on exiting.

	* signal.c (SYS_FUNC(rt_sigtimedwait)): On entering syscall, copy the
	value returned by sprint_timespec to a dynamically allocated memory,
	and save the pointer using set_tcb_priv_data.  On exiting, restore it
	using get_tcb_priv_data.

2016-07-18  Patrik Jakobsson  <patrik.jakobsson@linux.intel.com>

	Add private data field to struct tcb.
	We need to be able to store private data in the struct tcb across it's
	lifetime.  To ensure proper deallocation of this stored data a callback
	must be provided along with the data.  The callback is executed
	automatically on exiting syscall, and when the life of the tcb ends.

	* defs.h (struct tcb): Add _priv_data and _free_priv_data fields.
	(get_tcb_priv_data, set_tcb_priv_data, free_tcb_priv_data):
	New prototypes.
	(get_tcb_priv_ulong, set_tcb_priv_ulong): New static inline functions.
	* strace.c (get_tcb_priv_data, set_tcb_priv_data, free_tcb_priv_data):
	New functions.
	(droptcb): Call free_tcb_priv_data.
	* syscall.c (trace_syscall_exiting): Call free_tcb_priv_data
	when clearing TCB_INSYSCALL flag.

2016-07-18  Dmitry V. Levin  <ldv@altlinux.org>

	net.c: move parsers of sendmsg and recvmsg syscalls to msghdr.c.
	* defs.h (fetch_msghdr_namelen, decode_msghdr): Remove.
	* net.c (SYS_FUNC(sendmsg), SYS_FUNC(recvmsg)): Move ...
	* msghdr.c: ... here.
	(fetch_msghdr_namelen, decode_msghdr): Add static qualifier.

	net.c: move parsers of sendmmsg and recvmmsg syscalls to mmsghdr.c.
	* defs.h (decode_mmsgvec): Remove.
	* net.c: Do not include "msghdr.h".
	(SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg)): Move ...
	* mmsghdr.c: ... here.
	(decode_mmsgvec): Add static qualifier.

	msghdr.c: move all mmsghdr parsers to a separate file.
	* msghdr.h (print_struct_msghdr): New prototype.
	* msghdr.c (print_msghdr): Rename to print_struct_msghdr, remove
	static qualifier, all callers changed.
	(decode_mmsghdr, decode_mmsgvec, dumpiov_in_mmsghdr): Move to ...
	* mmsghdr.c: ... new file.
	* Makefile.am (strace_SOURCES): Add it.

2016-07-14  Dmitry V. Levin  <ldv@altlinux.org>

	tests: disable part of msg_name test on non-glibc systems.
	Sadly, musl recvmsg wrapper blindly dereferences 2nd argument,
	so limit the affected part of the test to glibc that doesn't.

	* tests/msg_name.c (test_msg_name) [!__GLIBC__]: Do not test
	with inaccessible 2nd argument.

2016-07-13  Dmitry V. Levin  <ldv@altlinux.org>

	Print struct iovec as a regular structure.
	* io.c (print_iovec): Print names of iov_base and iov_len fields.
	* tests/aio.c (main): Update expected output.
	* tests/inet-cmsg.c (main): Likewise.
	* tests/mmsg.c (main): Likewise.
	* tests/msg_name.c (test_msg_name): Likewise.
	* tests/preadv-pwritev.c (main): Likewise.
	* tests/preadv2-pwritev2.c (main): Likewise.
	* tests/preadv.c (main): Likewise.
	* tests/pwritev.c (main): Likewise.
	* tests/readv.c (main): Likewise.
	* tests/recvmsg.c (main): Likewise.
	* tests/vmsplice.c (main): Likewise.
	* tests/scm_rights-fd.test: Likewise.
	* tests/uio.expected: Likewise.

	tests: check decoding of msghdr.msg_name* arguments of recvmsg syscall.
	* tests/msg_name.c: New file.
	* tests/msg_name.test: New test.
	* tests/.gitignore: Add msg_name.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add msg_name.test.

2016-07-13  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of struct msghdr.msg_name* arguments of recvmsg syscall.
	As the msghdr.msg_namelen argument of recvmsg syscall has the same
	read-write semantics as the address length argument of recvfrom syscall,
	parser of recvmsg syscall needs a similar fix.

	* defs.h (fetch_msghdr_namelen): New prototype.
	(decode_msghdr): Add "int *" argument.
	* msghdr.c (print_msghdr): Likewise.  Treat it as a pointer to struct
	msghdr.msg_namelen passed to the kernel.  Pass to decode_sockaddr
	the size of socket address actually returned by the kernel.
	Print both user and kernel address lengths when the value changes.
	(decode_msghdr, decode_mmsghdr): Add "int *" argument,
	forward it to print_msghdr.
	(decode_mmsgvec): Update decode_mmsghdr invocation.
	(fetch_msghdr_namelen): New function.
	* net.c (SYS_FUNC(sendmsg)): Update decode_msghdr invocation.
	(SYS_FUNC(recvmsg)): Use fetch_msghdr_namelen on entering to save
	struct msghdr.msg_namelen.  On exiting, pass the saved value
	to decode_msghdr.

2016-07-12  Dmitry V. Levin  <ldv@altlinux.org>

	Update generic ioctl entries from linux 4.7.
	* linux/64/ioctls_inc.h: Update from linux v4.7 using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.

2016-07-12  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	x32: update ioctl entries from linux 4.7.
	* linux/x32/ioctls_inc0.h: Update from linux v4.7 using ioctls_gen.sh.

	maint: update for linux 4.7.
	* maint/ioctls_sym.sh: Drop obsolete workarounds for linux/btrfs.h.

2016-07-12  Dmitry V. Levin  <ldv@altlinux.org>

	block.c: remove BLKDAXGET support.
	BLKDAXGET was removed by linux kernel commit v4.7-rc1~78^2^2~4.

	* block.c: Do not define BLKDAXGET.
	(block_ioctl): Remove BLKDAXGET support.
	* tests/ioctl_block.c (main): Remove BLKDAXGET test.

2016-07-12  Dmitry V. Levin  <ldv@altlinux.org>

	Fix printing of socklen argument of bind and sendto syscalls.
	* net.c (SYS_FUNC(bind)): Print 3rd syscall argument using %d format.
	(SYS_FUNC(sendto)): Print 6th syscall argument using %d format.

	tests: check decoding of sockaddr related arguments of recvfrom syscall.
	* configure.ac (AC_CHECK_FUNCS): Add recvfrom.
	* tests/recvfrom.c: New file.
	* tests/recvfrom.test: New test.
	* tests/.gitignore: Add recvfrom.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add recvfrom.test.

	Fix decoding of sockaddr related arguments of recvfrom syscall.
	* net.c (SYS_FUNC(recvfrom)): Use fetch_socklen.  Save the address
	length passed to the kernel and print it on error.  Do not print more
	bytes of the socket address than actually returned by the kernel.
	Print both user and kernel address lengths when the returned address
	is truncated.

	tests: check decoding of accept4 syscall.
	* configure.ac (AC_CHECK_FUNCS): Add accept4.
	* tests/accept4.c: New file.
	* tests/accept4.test: New test.
	* tests/.gitignore: Add accept4.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add accept4.test.

	tests: check decoding of accept syscall.
	* tests/accept.c: New file.
	* tests/accept.test: New test.
	* tests/.gitignore: Add accept.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add accept.test.

	tests: check decoding of getpeername syscall.
	* tests/getpeername.c: New file.
	* tests/getpeername.test: New test.
	* tests/.gitignore: Add getpeername.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add getpeername.test.

	tests: check decoding of getsockname syscall.
	* tests/getsockname.c: New file.
	* tests/getsockname.test: New test.
	* tests/sockname.c: New file.
	* tests/.gitignore: Add getsockname.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add getsockname.test.
	(EXTRA_DIST): Add sockname.c.

	Print both values of changing address length in sockname family syscalls
	* net.c (decode_sockname): Print both user and kernel address lengths
	when the value changes.
	* tests/net-y-unix.c (main): Update expected output.
	* tests/net-yy-unix.c (main): Likewise.
	* tests/net.expected: Likewise.

	Enhance diagnostics of address truncation in sockname family syscalls.
	* net.c (decode_sockname): Print both user and kernel address lengths
	when the returned address is truncated.
	* tests/sun_path.expected: Update expected output.

	Fix decoding of getsockname, getpeername, accept, and accept4 syscalls.
	* net.c (fetch_socklen): New function.
	(decode_sockname): Use it.  On entering syscall, decode early
	and return RVAL_DECODED when possible.  On error, print the address
	length passed to the kernel.  Do not print more bytes of the socket
	address than actually returned by the kernel.

2016-07-11  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare parsers of sockname family syscalls for the upcoming fix.
	* net.c (do_sockname): Rename to decode_sockname, drop second argument,
	do not print sock_type_flags, return RVAL_DECODED on exiting.
	(SYS_FUNC(accept), SYS_FUNC(getsockname)): Use decode_sockname instead
	of do_sockname, take its return code into account.
	(SYS_FUNC(accept4)): Likewise.  Print sock_type_flags when
	decode_sockname returns RVAL_DECODED.

2016-07-08  Dmitry V. Levin  <ldv@altlinux.org>

	netlink: handle multipart netlink messages.
	Handle multipart netlink messages made of multiple struct nlmsghdr
	headers with associated payload in one byte stream.

	* netlink.c (fetch_nlmsghdr, print_nlmsghdr,
	decode_nlmsghdr_with_payload): New functions.
	(decode_netlink): Use them.
	* tests/netlink_parsing.c (send_query): Check them.

2016-07-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests: extend netlink protocol check.
	* tests/netlink_protocol.c (send_query): Check that no part
	of netlink message is fetched beyond the end of message.
	Check decoding of zero address and zero length messages.
	Check decoding of messages with nlmsg_len exceeding message length.

2016-07-07  Fabien Siron  <fabien.siron@epita.fr>

	tests: check decoding of netlink protocol.
	* tests/netlink_protocol.test: New test.
	* tests/netlink_protocol.c: New file.
	* tests/.gitignore: Add netlink_protocol.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add netlink_protocol.test.

2016-07-07  Fabien Siron  <fabien.siron@epita.fr>

	Add a general netlink socket parser.
	Introduce a general socket netlink parser which prints the header and
	a string for the remaining part of the buffer.  It doesn't handle all
	the netlink flags and types yet because the parser needs more
	information, this will be implemented later.

	* net.c (decode_sockbuf): New function.
	(SYS_FUNC(send), SYS_FUNC(sendto), SYS_FUNC(recv), SYS_FUNC(recvfrom)):
	Use it instead of printstr.
	* msghdr.c (print_msghdr): Pass IOV_DECODE_NETLINK to tprint_iov_upto()
	for netlink sockets.
	* netlink.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (decode_netlink, getfdproto): New prototypes.
	(iov_decode): Add IOV_DECODER_NETLINK.
	* io.c (print_iovec): Use decode_netlink().
	* util.c (getfdproto): Remove static keyword.
	* xlat/netlink_flags.in: New file.
	* xlat/netlink_types.in: New file.

2016-07-07  Dmitry V. Levin  <ldv@altlinux.org>

	Update sigaltstack SS_* constants.
	* xlat/sigaltstack_flags.in: Add SS_AUTODISARM introduced
	by linux kernel commit v4.7-rc1~195^2.

	Update fs *_MAGIC constants.
	* xlat/fsmagic.in: Add NSFS_MAGIC, TRACEFS_MAGIC, BPF_FS_MAGIC,
	and UDF_SUPER_MAGIC introduced by linux kernel commits
	v3.19-rc1~53^2~7^2~1, v4.1-rc1~147^2~4, v4.4-rc1~141^2~17^2~1,
	and v4.7-rc1~161^2, respectively.

2016-07-05  Dmitry V. Levin  <ldv@altlinux.org>

	Update KEYCTL_* constants.
	* xlat/keyctl_commands.in: Add KEYCTL_DH_COMPUTE introduced
	by linux kernel commit v4.7-rc1~124^2~2^2~2^2.

	Update input event constants.
	* xlat/evdev_keycode.in: Add KEY_* constants introduced
	by linux kernel commit v4.7-rc6~32^2~6^2.

2016-07-04  Dmitry V. Levin  <ldv@altlinux.org>

	Update RWF_* constants.
	* xlat/rwf_flags.in: Add RWF_DSYNC and RWF_SYNC introduced
	by linux kernel commit v4.7-rc1~158^2~1.

2016-07-07  Dmitry V. Levin  <ldv@altlinux.org>

	Update BPF_MAP_TYPE_* constants.
	* xlat/bpf_prog_types.in: Add BPF_PROG_TYPE_TRACEPOINT introduced
	by linux kernel commit v4.7-rc1~154^2~332^2~6.

2016-07-03  Dmitry V. Levin  <ldv@altlinux.org>

	msghdr.c: limit output when printing excessively large messages.
	Limit output of struct msghdr.msg_control when
	struct msghdr.msg_controllen is greater than the maximum ancillary
	buffer size specified in /proc/sys/net/core/optmem_max file.

	* configure.ac (AC_CHECK_FUNCS): Add open64.
	* defs.h (read_int_from_file): New prototype.
	* util.c (read_int_from_file): New function.
	* msghdr.c (get_optmem_max): New function based on read_int_from_file.
	(decode_msg_control): Use it to check control_len argument.
	* tests/msg_control.c (test_big_len): New function.
	(main): Use it to test printing of excessively large messages.

2016-07-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add read_int_from_file function to libtests.
	* tests/overflowuid.c (read_int_from_file): New function.
	(check_overflow_id): Use it.
	* tests/tests.h (read_int_from_file): New prototype.

2016-07-02  Dmitry V. Levin  <ldv@altlinux.org>

	msghdr.c: limit IP_RECVOPTS/IP_RETOPTS output in abbrev mode.
	* msghdr.c (print_cmsg_ip_opts): Do not print more than max_strlen
	bytes of ip options in abbrev mode.
	* tests/msg_control.c (print_ip_opts): Use DEFAULT_STRLEN.
	(test_sol_ip): Test IP_RETOPTS output in abbrev mode.

	msghdr.c: limit SCM_RIGHTS output in abbrev mode.
	* msghdr.c (print_scm_rights): Do not print more than max_strlen
	descriptors in abbrev mode.
	* tests/msg_control.c (DEFAULT_STRLEN): New macro.
	(print_fds): Use it.
	(test_scm_rights3): New function.
	(main): Use it to test SCM_RIGHTS output in abbrev mode.
	* tests/msg_control-v.c: New file.
	* tests/msg_control-v.test: New test.
	* tests/.gitignore: Add msg_control-v.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add msg_control-v.test.

2016-07-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of struct msghdr ancillary data.
	* tests/msg_control.c: New file.
	* tests/msg_control.test: New test.
	* tests/.gitignore: Add msg_control.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add msg_control.test.

2016-06-30  Dmitry V. Levin  <ldv@altlinux.org>

	msghdr.c: reorganize struct cmsghdr handler.
	* msghdr.c (sock_ee): New structure.
	(print_scm_rights, print_scm_creds, print_scm_security,
	print_cmsg_ip_pktinfo, print_cmsg_uint, print_cmsg_ip_opts,
	print_cmsg_ip_recverr, print_cmsg_ip_origdstaddr): Remove data_len
	argument validity check, don't print ", cmsg_data=" prefix here.
	(print_cmsg_ip_tos): Likewise.  Rename to print_cmsg_uint8_t.
	(cmsg_printer): New type.
	(cmsg_socket_printers, cmsg_ip_printers): New arrays.
	(print_cmsg_type_data): Use them to handle struct cmsghdr
	and its cmsg_data.

	msghdr.c: merge print_cmsg_ip_ttl and print_cmsg_ip_checksum.
	* msghdr.c (print_cmsg_ip_ttl): Rename to print_cmsg_uint.
	(print_cmsg_ip_checksum): Remove.
	(print_cmsg_type_data): Replace print_cmsg_ip_ttl
	and print_cmsg_ip_checksum with print_cmsg_uint.

	msghdr.c: enhance representation of unprintable part of msg_control array
	* msghdr.c (decode_msg_control): When msg_control array has an
	unprintable part, print its address.

	msghdr.c: apply a sane limit to the length of IP_ORIGDSTADDR address.
	* msghdr.c (print_cmsg_ip_origdstaddr): Limit address length to the size
	of struct sockaddr_storage.

	msghdr.c: fix printing SCM_RIGHTS array.
	* msghdr.c (print_scm_rights): Do not print array elements outside
	bounds defined by struct cmsghdr.cmsg_len.

	msghdr.c: print unrecognized struct cmsghdr.cmsg_type in hex.
	* msghdr.c (print_cmsg_type_data): Use %#x format when printing
	struct cmsghdr.cmsg_type as an integer.

	msghdr.c: fix printing of struct in_pktinfo.
	* msghdr.c (print_cmsg_ip_pktinfo): Fix printing
	of struct in_pktinfo.ipi_addr.

	msghdr.c: fix representation of struct cmsghdr.cmsg_data integer arrays.
	* msghdr.c (print_cmsg_ip_opts): Print struct cmsghdr.cmsg_data
	as an array of hexadecimal integers.
	* tests/inet-cmsg.c (print_opts): Update expected output.

	msghdr.c: fix representation of integer struct cmsghdr.cmsg_data values.
	* msghdr.c (print_cmsg_ip_ttl, print_cmsg_ip_tos,
	print_cmsg_ip_checksum): Print struct cmsghdr.cmsg_data value as an
	array element.
	* tests/inet-cmsg.c (print_ttl, print_tos): Update expected output.

	msghdr.c: when printing struct struct cmsghdr.cmsg_data, also print its name
	* msghdr.c (print_scm_rights, print_scm_creds, print_scm_security,
	print_cmsg_ip_pktinfo, print_cmsg_ip_ttl, print_cmsg_ip_tos,
	print_cmsg_ip_checksum, print_cmsg_ip_opts, print_cmsg_ip_recverr,
	print_cmsg_ip_origdstaddr): Print "cmsg_data=" before its contents.
	* tests/inet-cmsg.c (print_pktinfo, print_ttl, print_tos, print_opts,
	print_origdstaddr): Update expected output.
	* tests/scm_rights-fd.test: Likewise.

2016-06-27  Dmitry V. Levin  <ldv@altlinux.org>

	msghdr.c: print struct mmsghdr as a regular structure.
	* msghdr.c (decode_mmsghdr): Print names of msg_hdr and msg_len fields.
	* tests/mmsg.c (main): Update expected output.

	net.c: move all msghdr and mmsghdr parsers to a separate file.
	* defs.h (msg_flags, socketlayers, decode_msghdr, decode_mmsg):
	New prototypes.
	* msghdr.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* net.c: Move all msghdr and mmsghdr parsers to msghdr.c.

	Mpersify fetchers of struct msghdr and struct mmsghdr.
	* fetch_struct_msghdr.c: New file.
	* fetch_struct_mmsghdr.c: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* net.c (struct msghdr32, struct mmsghdr32, copy_from_msghdr32,
	fetch_msghdr, fetch_mmsghdr): Remove.
	(decode_msghdr, dumpiov_in_msghdr): Use fetch_struct_msghdr instead
	of fetch_msghdr.
	(decode_mmsghdr): Change msg_len argument to use_msg_len.
	Use fetch_struct_mmsghdr instead of fetch_mmsghdr.
	Return fetch_struct_mmsghdr's return code.
	(decode_mmsg): Rename to decode_mmsgvec.  Take addr and len arguments.
	Do not print vlen and flags.  Check decode_mmsghdr's return code.
	Print mmsghdr array using square brackets.
	(dumpiov_in_mmsghdr): Use fetch_struct_mmsghdr instead of fetch_mmsghdr.
	(SYS_FUNC(sendmmsg), SYS_FUNC(recvmmsg)): Use decode_mmsgvec instead
	of decode_mmsg.  Print vlen and flags.
	* tests/mmsg.c (main): Update expected output.

	net.c: move fallback definition of struct mmsghdr to a separate file.
	* msghdr.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* net.c: Include it.  Move fallback definition of struct mmsghdr there.
	* tests/mmsg.c: Include "msghdr.h".  Remove fallback definition
	of struct mmsghdr.

2016-06-26  Dmitry V. Levin  <ldv@altlinux.org>

	net.c: print struct msghdr as a regular structure.
	* net.c (print_msghdr): Print msg_name, msg_namelen, msg_iov,
	and msg_iovlen fields like other regular fields.
	* tests/inet-cmsg.c (main): Update expected output.
	* tests/mmsg.c (main): Likewise.
	* tests/recvmsg.c (main): Likewise.
	* tests/scm_rights-fd.test: Likewise.

	net.c: rename some internal functions for consistency and readability.
	* net.c (printcmsghdr): Rename to decode_msg_control.
	(do_msghdr): Rename to print_msghdr.
	(extractmsghdr): Rename to fetch_msghdr.
	(extractmmsghdr): Rename to fetch_mmsghdr.
	(printmsghdr): Rename to decode_msghdr.
	(printmmsghdr): Rename to decode_mmsghdr.
	All callers updated.

	net.c: when printing struct msghdr.msg_control, also print its name.
	* net.c (printcmsghdr): Skip control messages of zero length.
	Always print "msg_control=" before the control message.
	(do_msghdr): Print control message before its length, not after.
	* tests/inet-cmsg.c (main): Update expected output.
	* tests/scm_rights-fd.test: Likewise.

	Assume that libc provides struct msghdr.msg_control.
	* configure.ac (AC_CHECK_MEMBERS): Remove struct msghdr.msg_control.
	* net.c (do_msghdr): Remove HAVE_STRUCT_MSGHDR_MSG_CONTROL check.

2016-06-25  Dmitry V. Levin  <ldv@altlinux.org>

	net.c: move all sockaddr parsers to a separate file.
	* sockaddr_ll.c: Rename to sockaddr.c
	(print_sockaddr_data_ll): Add static keyword.
	* Makefile.am (strace_SOURCES): Likewise.
	* defs.h (print_sockaddr_data_ll): Remove.
	(addrfams): New prototype.
	* net.c: Move all sockaddr parsers to sockaddr.c.

	net.c: rename printsock to decode_sockaddr.
	* defs.h (printsock): Rename to decode_sockaddr.
	* net.c (printsock): Likewise.
	(do_msghdr, SYS_FUNC(bind), do_sockname, SYS_FUNC(sendto),
	SYS_FUNC(recvfrom)): Replace printsock with decode_sockaddr.

	defs.h: remove unused prototype.
	* defs.h (print_sock_optmgmt): Remove.

	tests: check decoding of sockaddr structures.
	* tests/net-sockaddr.c: New file.
	* tests/net-sockaddr.test: New test.
	* tests/.gitignore: Add net-sockaddr.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add net-sockaddr.test.

2016-06-24  Dmitry V. Levin  <ldv@altlinux.org>

	net.c: fix printing AF_PACKET socket addresses.
	* defs.h (print_ifindex, print_sockaddr_data_ll): New prototypes.
	* net.c: Stop including "xlat/af_packet_types.h".
	(print_ifindex): Remove static keyword.
	(print_sockaddr_data_l): Remove.
	* sockaddr_ll.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* xlat/arp_hardware_types.in: New file.
	* xlat/ethernet_protocols.in: Likewise.

	net.c: skip details of too short socket addresses, part 2.
	* net.c (sa_printers): Add minimal address length for each socket family.
	(print_sockaddr): Call socket family specific sockaddr printer
	only when socket address length is greater or equal
	the minimal address length for the socket family.

	net.c: fix printing AF_BLUETOOTH socket addresses.
	* xlat/hci_channels.in: New file.
	* net.c (print_sockaddr_data_raw): New function.
	(print_sockaddr): Use it.
	[HAVE_BLUETOOTH_BLUETOOTH_H]: Include "xlat/hci_channels.h".
	[HAVE_BLUETOOTH_BLUETOOTH_H] (print_sockaddr_data_bt): Fix printing
	sockaddr_hci, sockaddr_sco, sockaddr_rc, and sockaddr_l2 structures.

	net.c: fix printing AF_IPX sockets addresses, part 2.
	* net.c (print_sockaddr_data_ipx): Print sockaddr_ipx.sipx_network
	using %#08x format.  Print elements of sockaddr_ipx.sipx_node array
	and sockaddr_ipx.sipx_type using %#02x format.

2016-06-24  Dmitry V. Levin  <ldv@altlinux.org>

	net.c: fix printing AF_UNIX abstract socket addresses.
	AF_UNIX abstract socket address specified by sockaddr_un.sun_path
	is not a NUL-terminated string.

	* net.c (SIZEOF_SA_FAMILY): New macro.
	(print_sockaddr_data_un): Use it.  Specify actual address length
	in print_quoted_string calls.  Do not set QUOTE_0_TERMINATED flag
	when printing an abstract socket address.

2016-06-24  Dmitry V. Levin  <ldv@altlinux.org>

	net.c: fix printing field names of struct sockaddr_nl.
	* net.c (print_sockaddr_data_nl): Change "pid" to "nl_pid", "groups"
	to "nl_groups".  Print sockaddr_nl.nl_groups using %#08x format.
	* tests/net-yy-netlink.c (main): Update.

	net.c: fix printing struct sockaddr_in6.sin6_flowinfo.
	* net.c (print_sockaddr_data_in6): Convert sockaddr_in6.sin6_flowinfo
	from network order to host order before printing.

2016-06-23  Dmitry V. Levin  <ldv@altlinux.org>

	net.c: do not print sockaddr_in6.sin6_scope_id unnecessarily.
	Prior to RFC2553, struct sockaddr_in6 had no sin6_scope_id field.
	As the kernel still accepts RFC2133 editions of struct sockaddr_in6,
	print sockaddr_in6.sin6_scope_id only when it is specified.

	* net.c (SIN6_MIN_LEN): New macro.
	(print_sockaddr_data_in6): Print sockaddr_in6.sin6_scope_id only when
	socket address length exceeds SIN6_MIN_LEN.

2016-06-23  Dmitry V. Levin  <ldv@altlinux.org>

	net.c: fix printing raw data of socket addresses.
	* net.c (print_sockaddr): When printing socket address raw data, read
	exactly the number of data bytes specified for the socket addess.

	net.c: skip details of too short socket addresses.
	* net.c (print_sockaddr): Print socket address details only when
	the address size is greater than sizeof(struct sockaddr.sa_family).
	(print_sockaddr_data_un): Remove handling of addrlen == 2.
	* tests/net-y-unix.c (main): Update expected pattern.
	* tests/net-yy-unix.c (main): Likewise.
	* tests/net.expected: Likewise.

2016-06-22  Dmitry V. Levin  <ldv@altlinux.org>

	Assume that libc provides struct sockaddr_in6.sin6_scope_id.
	* configure.ac (AC_CHECK_MEMBERS): Remove
	struct sockaddr_in6.sin6_scope_id.
	* net.c (print_sockaddr_data_in6): Remove
	HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID check.

	Split print_sockaddr.
	* net.c (sockaddr_buf_t): Remove.
	(sockaddr_printer): New type.
	(sa_printers): New array of sockaddr_printer.
	(print_sockaddr): Use it.  Move printers of family specific
	sockaddr data to separate funcions.

2016-06-22  Fabien Siron  <fabien.siron@epita.fr>

	Add a enum for decoding to tprint_iov() and tprint_iov_upto()
	Introduce a new type iov_decode which will be used instead of the integer
	"decode" as a parameter.

	* defs.h (iov_decode): New enum.
	(tprint_iov, tprint_iov_upto): Change type of "decode_iov" to enum iov_decode.
	* aio.c (print_iocb): Change type of "decode_iov" to enum iov_decode in
	tprint_iov() call.
	* keyctl.c (keyctl_instantiate_key_iov): Likewise.
	* process.c (ptrace): Likewise.
	* process_vm.c (process_vm_readv, process_vm_writev): Likewise.
	* io.c (writev, do_pwritev, vmsplice): Likewise.
	(print_iovec): Replace the condition with a switch.
	(tprint_iov_upto): Change type of "decode_iov" to enum iov_decode.
	(readv, do_preadv): Change type of "decode_iov" to enum iov_decode in
	tprint_iov_upto() call.
	* scsi.c (print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req,
	print_sg_io_v4_res): Likewise.
	* net.c (do_msghdr): Adapt call of tprint_iov_upto().

2016-06-22  Dmitry V. Levin  <ldv@altlinux.org>

	printsock: fix zero padding of sockaddr buffer.
	Before this change printsock used to erroneously clear the last byte
	of sockaddr buffer.

	* net.c (printsock): Use struct sockaddr_storage as a sockaddr buffer.
	Reserve additional byte after the sockaddr buffer for zero padding.
	Do not clear memory that is going to be overwritten by umoven.
	Clear the tail of sockaddr buffer that was not overwritten by umoven.

2016-06-21  Fabien Siron  <fabien.siron@epita.fr>

	Change printsock to return socket family.
	* defs.h (printsock): Change return type to int.
	* net.c (printsock): Likewise.  Return socket family on success
	and -1 in case of an error.

2016-06-21  Dmitry V. Levin  <ldv@altlinux.org>

	Unexport addrfams.
	* defs.h (addrfams): Remove.

	sock.c: use print_sockaddr.
	* sock.c (print_ifreq_addr): Remove.
	(PRINT_IFREQ_ADDR): New macro.
	(print_ifreq, decode_ifconf): Use it instead of print_ifreq_addr.

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

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

	Update AF_* constants.
	* xlat/addrfams.in: Add AF_QIPCRTR.

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

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

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

2016-06-20  Dmitry V. Levin  <ldv@altlinux.org>

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

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

2016-06-19  Dmitry V. Levin  <ldv@altlinux.org>

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

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

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

2016-06-19  Fabien Siron  <fabien.siron@epita.fr>

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

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

2016-06-18  Dmitry V. Levin  <ldv@altlinux.org>

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

2016-06-17  Dmitry V. Levin  <ldv@altlinux.org>

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

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

2016-06-17  Dmitry V. Levin  <ldv@altlinux.org>

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

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

2016-06-17  Dmitry V. Levin  <ldv@altlinux.org>

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

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

	Reported-by: Li Er <phoooyb@gmail.com>

2016-06-17  Dmitry V. Levin  <ldv@altlinux.org>

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

2016-06-16  Elvira Khabirova  <lineprinter0@gmail.com>

	README: add system requirements and beautify the file.

2016-06-16  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

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

2016-06-16  Dmitry V. Levin  <ldv@altlinux.org>

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

2016-06-16  Dmitry V. Levin  <ldv@altlinux.org>

	configure.ac: do not check for linux/in6.h.
	The last user of <linux/in6.h> was removed by commit v4.9-252-gf362a33.

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

2016-06-16  Dmitry V. Levin  <ldv@altlinux.org>

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

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

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

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

2016-06-14  Dmitry V. Levin  <ldv@altlinux.org>

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

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

2016-06-14  Elvira Khabirova  <lineprinter0@gmail.com>

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

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

2016-06-14  Dmitry V. Levin  <ldv@altlinux.org>

	tests/attach-f-p.c: fix typo in comment.

2016-06-14  Elvira Khabirova  <lineprinter0@gmail.com>

	strace.c: fix style in function definition.
	* strace.c (kill_save_errno): Move the type of return value
	to another line.

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

	strace.c: fix a warning reported by -Wold-style-definition.
	* strace.c (usage): Add void to the list of function argments.

2016-06-14  Dmitry V. Levin  <ldv@altlinux.org>

	tests/ioctl_evdev.c: fix typo in comment.

2016-06-14  Elvira Khabirova  <lineprinter0@gmail.com>

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

	tests/xgetrlimit.c: fix a warning reported by -Wtype-limits.
	* tests/xgetrlimit.c (sprint_rlim): Explicitly cast constants
	to the type of argument.

2016-06-11  Dmitry V. Levin  <ldv@altlinux.org>

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

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

2016-06-10  Dmitry V. Levin  <ldv@altlinux.org>

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

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

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

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

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

	Fix sign extension issues in the parser of struct rusage.
	* printrusage.c (printrusage): Do not cast members of struct rusage
	to type long, use widen_to_ull instead.

2016-06-09  Dmitry V. Levin  <ldv@altlinux.org>

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

2016-06-09  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

2016-06-08  Dmitry V. Levin  <ldv@altlinux.org>

	strace.spec.in: enable libunwind on more platforms.
	* strace.spec.in: Add libunwind-devel to BuildRequires for RHEL8 family.

2016-06-08  Dmitry V. Levin  <ldv@altlinux.org>

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

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

2016-06-08  Dmitry V. Levin  <ldv@altlinux.org>

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

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

2016-06-07  Dmitry V. Levin  <ldv@altlinux.org>

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

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

2016-06-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests: remove obsolete strace-f.test.
	strace-f.test is too inexact while fork-f.test does the right thing.

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

2016-06-07  Dmitry V. Levin  <ldv@altlinux.org>

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

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

2016-06-07  Dmitry V. Levin  <ldv@altlinux.org>

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

2016-06-06  Dmitry V. Levin  <ldv@altlinux.org>

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

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

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

2016-06-06  Dmitry V. Levin  <ldv@altlinux.org>

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

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

2016-06-06  Dmitry V. Levin  <ldv@altlinux.org>

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

2016-06-06  Elvira Khabirova  <lineprinter0@gmail.com>

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

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

	.gitignore: add missing files that should be ignored.
	* .gitignore: Add ioctl_redefs[12].h and libstrace.a.

2016-06-06  Dmitry V. Levin  <ldv@altlinux.org>

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

2016-06-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests/strace-S.test: fix testing 64-bit strace using a 32-bit userspace.
	* tests/strace-S.test: Measure wall clock time instead of system time.
	Use local "./readv" instead of system "date" as a sample executable.

	Reported-by: Steve McIntyre <steve@einval.com>

2016-06-06  Dmitry V. Levin  <ldv@altlinux.org>

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

2016-06-02  Dmitry V. Levin  <ldv@altlinux.org>

	.gitignore: sort the list of ignored patterns.
	* .gitignore: Sort.

2016-06-01  Dmitry V. Levin  <ldv@altlinux.org>

	maint: post-release administrivia.
	* NEWS: Add header line for the next release.

2016-05-31  Dmitry V. Levin  <ldv@altlinux.org>

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

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

2016-05-30  Dmitry V. Levin  <ldv@altlinux.org>

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

2016-05-29  Dmitry V. Levin  <ldv@altlinux.org>

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

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

	loop.c: fix printing of structure members' names.
	* loop.c (decode_loop_info, decode_loop_info64): Do not strip "lo_"
	prefix from printed names.

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

2016-05-28  Dmitry V. Levin  <ldv@altlinux.org>

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

	tests/ioctl_mtd.c: fix build with musl.
	* tests/ioctl_mtd.c: Include <linux/ioctl.h>.

	tests: check decoding of 'M' type ioctls.
	* tests/ioctl_mtd.c: New file.
	* tests/ioctl_mtd.test: New test.
	* tests/.gitignore: Add ioctl_mtd.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add ioctl_mtd.test.

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

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

	Move parser of UBI_* ioctls to a separate file.
	* mtd.c (ubi_ioctl): Move to ...
	* ubi.c: ... new file.
	* Makefile.am (strace_SOURCES): Add it.

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

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

	evdev.c: fix printing of unrecognized event type passed to EVIOCGBIT.
	* evdev.c (bit_ioctl): If event type is not unrecognized,
	print the argument as an address.

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

	evdev.c: fix indentation.
	* evdev.c: Fix indentation of print formats.

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

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

	evdev.c: fix EVIOCGMTSLOTS decoding.
	* evdev.c (mtslots_ioctl): Use umove_or_printaddr.

	evdev.c: fix bitset decoding.
	* evdev.c (decode_bitset): Use umove_or_printaddr.

	evdev.c: fix decoding of struct input_id.
	* evdev.c (getid_ioctl): Use umove_or_printaddr.

	evdev.c: fix decoding of struct input_keymap_entry.
	* evdev.c (keycode_V2_ioctl): Use umove_or_printaddr.

	evdev.c: fix decoding of EVIOCGKEYCODE/EVIOCSKEYCODE.
	* evdev.c (keycode_ioctl): Use umove_or_printaddr.

	evdev.c: fix decoding of struct input_absinfo.
	* evdev.c (abs_ioctl): Use umove_or_printaddr.

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

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

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

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

	evdev.c: move handling of EVIOCGBIT to a separate function.
	* evdev.c (evdev_read_ioctl): Move EVIOCGBIT handling to ...
	(bit_ioctl): ... new function.

2016-05-28  Dmitry V. Levin  <ldv@altlinux.org>

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

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

2016-05-28  Dmitry V. Levin  <ldv@altlinux.org>

	evdev.c: decode all directions except _IOC_READ on entering syscall.
	* evdev.c (evdev_write_ioctl): Remove exiting check.
	(evdev_read_ioctl): Move entering check ...
	(evdev_ioctl): ... here.  Add RVAL_DECODED to return code in _IOC_WRITE
	and default cases.

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

2016-05-28  Jeff Mahoney  <jeffm@suse.com>

	file_ioctl.c: print first two extents for FIDEDUPERANGE in abbrev mode.
	* file_ioctl.c (file_ioctl, print_file_dedupe_range_info): Print first
	two elements of info array in abbrev mode.
	* tests/btrfs.c (btrfs_test_extent_same_ioctl): Handle newly
	printed elements.

2016-05-27  Dmitry V. Levin  <ldv@altlinux.org>

	ioctl.c: fix typo in decoding of EVIOCSABS's parameter.
	* ioctl.c (evdev_decode_number): Fix typo in printxval default value.

2016-05-27  Jeff Mahoney  <jeffm@suse.com>

	tests: check decoding of btrfs RDWR ioctls returned data.
	* tests/btrfs-vw.test: New file.
	* tests/btrfs-w.test: New file.
	* tests/Makefile.am (DECODER_TESTS): Add them.

	tests/btrfs.c: fix live btrfs_test_search_ioctls output.
	* tests/btrfs.c (btrfs_test_search_ioctls): Use print_tree_search_buf
	for BTRFS_IOC_TREE_SEARCH and fix missing whitespace.

	btrfs.c: don't use print_array in btrfs_print_tree_search.
	* btrfs.c (btrfs_print_tree_search): Don't use print_array.  The buffer
	represents a series of variable sized records, not an array.

	btrfs.c: fix print_array usage in btrfs_print_logical_ino_container.
	* btrfs.c: (btrfs_print_logical_ino_container) Fix the element count
	to reflect the number of records rather than the number of items.

2016-05-26  Jeff Mahoney  <jeffm@suse.com>

	tests/btrfs.c: fix btrfs-v for BTRFS_IOC_TREE_SEARCH.
	* tests/btrfs.c (btrfs_test_send_ioctl): Assign key_reference
	to search_args for BTRFS_IOC_TREE_SEARCH ioctl tests.

2016-05-26  Fabien Siron  <fabien.siron@epita.fr>

	Fix -yy documentation.
	* strace.c (usage): Fix description of -yy option.
	* strace.1: Likewise.

2016-05-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests/ioctl_block.c: tweak magic constants to make the test more reliable
	* tests/ioctl_block.c (main): Change bad pointer to make
	its lower 32-bit part closer to -1U.

	tests/btrfs.c: check basic decoding of read-only ioctls.
	* tests/btrfs.c (btrfs_test_read_ioctls): New function.
	(main): Use it.

	tests: check decoding of BLK* ioctls.
	* configure.ac (AC_CHECK_TYPES): Add struct blk_user_trace_setup.
	* tests/ioctl_block.c: New file.
	* tests/ioctl_block.test: New test.
	* tests/.gitignore: Add ioctl_block.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add ioctl_block.test.

	Mpersify BLK* ioctl parser.
	* defs.h (block_ioctl): Remove.
	* block.c: Mpersify struct blk_user_trace_setup,
	struct blkpg_ioctl_arg, struct blkpg_partition, and ioctl numbers.
	(block_ioctl): Mpersify.
	* NEWS: Mention this enhancement.

	block.c: optimize decoding of paired ioctls.
	* block.c (block_ioctl): Optimize decoding of commands that return
	a signed int.

	block.c: fix printing of uint64_t pairs.
	* block.c (block_ioctl): Print uint64_t values using PRIu64 format.

	block.c: fix printing of struct blk_user_trace_setup.
	* block.c (block_ioctl): Fix printing of comma before
	struct blk_user_trace_setup.name on exiting syscall.

	Move parser of 'X' type ioctls to a separate file.
	* fs_x_ioctl.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* block.c: (block_ioctl): Move parser of FITRIM, FIFREEZE, and FITHAW
	to fs_x_ioctl.c.
	* defs.h (fs_x_ioctl): New prototype.
	* ioctl.c (ioctl_decode): Call fs_x_ioctl for ioctl type 'X'.

	Move parser of HDIO_* ioctls to a separate file.
	* hdio.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* block.c: Do not include <linux/hdreg.h>.
	(block_ioctl): Move parser of HDIO_GETGEO to hdio.c.
	* defs.h (hdio_ioctl): New prototype.
	* ioctl.c (ioctl_decode): Call hdio_ioctl for ioctl type 0x03.

	Fix explicit casts of signed integer types to unsigned long long.
	* defs.h (widen_to_ull): New macro.
	* dirent.c (print_old_dirent, SYS_FUNC(getdents)): Use it in place
	of explicit casts to unsigned long long.
	* io.c (print_lld_from_low_high_val): Likewise.
	* lseek.c (SYS_FUNC(llseek)): Likewise.
	* printsiginfo.c (print_si_info): Likewise.
	* printstat.h (DO_PRINTSTAT): Likewise.
	* sysinfo.c (SYS_FUNC(sysinfo)): Likewise.
	* times.c (SYS_FUNC(times)): Likewise.
	* fetch_struct_statfs.c (ASSIGN_NUMBER): Remove.
	(fetch_struct_statfs, fetch_struct_statfs64): Replace ASSIGN_NUMBER
	with widen_to_ull.

	scsi.c: print __u64 types using PRI__u64 format.
	* scsi.c (print_sg_io_v4_req, print_sg_io_v4_res): Remove explicit casts
	to unsigned long long, print fields of type __u64 using PRI__u64 format.

2016-05-25  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of RTC_* ioctls.
	* configure.ac (AC_CHECK_FUNCS): Add ioctl_rtc.
	* tests/ioctl_rtc.c: New file.
	* tests/ioctl_rtc-v.c: Likewise.
	* tests/ioctl_rtc.test: New test.
	* tests/ioctl_rtc-v.test: Likewise.
	* tests/.gitignore: Add ioctl_rtc and ioctl_rtc-v.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add ioctl_rtc.test and ioctl_rtc-v.test.

	Mpersify RTC_* ioctl parser.
	* defs.h (rtc_ioctl): Remove.
	* rtc.c: Mpersify struct rtc_pll_info and ioctl numbers.
	(rtc_ioctl): Mpersify.
	* NEWS: Mention this enhancement.

	rtc.c: fix decoding of struct rtc_wkalrm.
	* rtc.c (decode_rtc_wkalrm): Print field name of struct rtc_wkalrm.time.

	file_ioctl.c: print file descriptors using printfd.
	* file_ioctl.c (print_file_dedupe_range_info): Print
	struct file_dedupe_range_info.dest_fd using printfd.
	(file_ioctl): Print struct file_clone_range.src_fd using printfd.

	rtc.c: do not print argument of ioctls that have no arguments.
	* rtc.c (rtc_ioctl): Do not print argument of RTC_{A,U,P,W}IE_{ON,OFF}
	and RTC_VL_CLR ioctls.

	rtc.c: decode RTC_PLL_GET and RTC_PLL_SET.
	* rtc.c (rtc_ioctl): Decode RTC_PLL_GET and RTC_PLL_SET

	rtc.c: optimize decoding of paired ioctls.
	* rtc.c (rtc_ioctl): Optimize decoding of RTC_ALM_READ/RTC_ALM_SET,
	RTC_RD_TIME/RTC_SET_TIME, and RTC_WKALM_RD/RTC_WKALM_SET ioctl pairs.

	block.c: handle BLKDAXGET.
	* block.c [!BLKDAXGET] (BLKDAXGET): Define.
	(block_ioctl): Handle it.

	tests: check decoding of mount syscall.
	* tests/mount.c: New file.
	* tests/mount.test: New test.
	* tests/.gitignore: Add mount.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add mount.

2016-05-24  Dmitry V. Levin  <ldv@altlinux.org>

	tests/vhangup.c: diassociate from the controlling terminal first.
	* tests/vhangup.c (main): Call setsid before vhangup.

2016-05-24  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

2016-05-24  Dmitry V. Levin  <ldv@altlinux.org>

	NEWS: Prepare for 4.12 release.

2016-05-24  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	tests/btrfs.c: fix build on x32.
	* tests/btrfs.c (btrfs_test_ino_path_ioctls): Fix printing of st_ino.

2016-05-24  Dmitry V. Levin  <ldv@altlinux.org>

	tests/btrfs.c: fix build with u64 based BTRFS_IOC_DEFAULT_SUBVOL.
	* tests/btrfs.c: Fix build on systems where BTRFS_IOC_DEFAULT_SUBVOL
	is defined using unexported type "u64".

	btrfs.c: fix build on systems without BTRFS_IOC_FILE_EXTENT_SAME.
	* btrfs.c (btrfs_ioctl): Skip BTRFS_IOC_FILE_EXTENT_SAME case
	if this constant is not defined.
	* tests/btrfs.c (btrfs_test_extent_same_ioctl): Skip this part
	of the test if BTRFS_IOC_FILE_EXTENT_SAME is not defined.

	tests/btrfs.c: fix printing struct btrfs_ioctl_clone_range_args.
	* tests/btrfs.c (btrfs_test_clone_ioctls): Print __u64 members
	of struct btrfs_ioctl_clone_range_args using PRI__u64 format.

	tests/btrfs.c: tweak magic constants to make the test more reliable.
	* tests/btrfs.c (btrfs_test_sync_ioctls): Change u64val
	to 0xdeadbeefbadc0ded.
	(btrfs_test_subvol_ioctls): Likewise.  Change bad_pointer
	to make their lower 32-bit parts closer to -1U.

	btrfs.c: print file descriptors using printfd.
	* btrfs.c (btrfs_ioctl): Print struct btrfs_ioctl_send_args.send_fd,
	struct btrfs_ioctl_vol_args.fd, and struct btrfs_ioctl_vol_args_v2.fd
	using printfd.
	* tests/btrfs.c (btrfs_print_vol_args_v2, btrfs_test_subvol_ioctls,
	btrfs_test_device_ioctls, btrfs_test_clone_ioctls,
	btrfs_test_send_ioctl): Update.

	tests/btrfs.c: do not print errno in case of fs type mismatch.
	* tests/btrfs.c (main): Use error_msg_and_fail instead of
	perror_msg_and_fail when the fs type of the given directory
	is not BTRFS_SUPER_MAGIC.

	tests/btrfs.c: fix indentation.
	* tests/btrfs.c: Fix indentation of preprocessor directives
	and function prototypes.

	tests/btrfs.c: sort included headers.
	* tests/btrfs.c: Sort included headers.

	tests/btrfs.c: do not use alloca.
	* tests/btrfs.c: Don't include <alloca.h>.
	(btrfs_test_subvol_ioctls): Allocate
	struct btrfs_ioctl_vol_args_v2.qgroup_inherit using tail_alloc.

	tests/btrfs.c: fix build on systems without <linux/btrfs.h> or <linux/fiemap.h>
	* tests/btrfs.c: Include "tests.h" first.
	Skip the test if [!HAVE_LINUX_BTRFS_H].  Skip parts of the test
	that use struct fiemap if [!HAVE_LINUX_FIEMAP_H].

2016-05-24  Jeff Mahoney  <jeffm@suse.com>

	tests: add testing for btrfs ioctls.
	* tests/btrfs.c: New file.
	* tests/btrfs.test: New test.
	* tests/btrfs-v.test: Likewise.
	* tests/.gitignore: Add btrfs.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add btrfs.test and btrfs-v.test.

2016-05-24  Dmitry V. Levin  <ldv@altlinux.org>

	tests/file_ioctl.c: use tail_alloc.
	* tests/file_ioctl.c (main): Allocate struct fiemap using tail_alloc.

	tests/file_ioctl.c: fix build on systems without <linux/fiemap.h>
	* tests/file_ioctl.c: Include "tests.h" first.
	Skip the test if [!HAVE_LINUX_FIEMAP_H].

2016-05-24  Jeff Mahoney  <jeffm@suse.com>

	tests: add testing for FS_IOC_FIEMAP.
	This is limited to FIEMAP.  FICLONE* and FIDEDUPERANGE originated in
	btrfs and will be tested there.

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

2016-05-24  Dmitry V. Levin  <ldv@altlinux.org>

	Mpersify btrfs.c.
	* btrfs.c: Mpersify 3 arch-specific structures
	and corresponding ioctl numbers.
	(btrfs_ioctl): Mpersify.
	* defs.h (btrfs_ioctl): Remove.

	btrfs.c: use print_array.
	* btrfs.c (print_btrfs_data_container_logical_ino,
	print_btrfs_data_container_ino_path, print_uint64,
	print_btrfs_ioctl_search_header, print_objectid_callback,
	print_btrfs_ioctl_space_info): New functions.
	(btrfs_print_logical_ino_container, btrfs_print_ino_path_container):
	Rewrite printers of struct btrfs_data_container.val array
	using print_array.
	(btrfs_print_qgroup_inherit): Rewrite printer of
	struct btrfs_qgroup_inherit.qgroups array using print_array.
	(btrfs_print_tree_search): Rewrite printer of
	struct btrfs_ioctl_search_header array using print_array.
	(btrfs_ioctl): Rewrite printer of
	struct btrfs_ioctl_send_args.clone_sources and
	struct btrfs_ioctl_space_args.spaces using print_array.

	btrfs.c: simplify BTRFS_IOC_GET_FSLABEL parser.
	* btrfs.c (btrfs_ioctl): Share code of parser of BTRFS_IOC_SET_FSLABEL
	with parser of BTRFS_IOC_GET_FSLABEL only on BTRFS_IOC_GET_FSLABEL's
	entering.

	btrfs.c: fix BTRFS_IOC_TREE_SEARCH_V2 output.
	* btrfs.c (btrfs_ioctl): Fix BTRFS_IOC_TREE_SEARCH_V2 output
	in case of EOVERFLOW and failed umove.

	btrfs.c: cleanup use of tcp->auxstr.
	* btrfs.c (btrfs_ioctl): Reset tcp->auxstr only if it is set.

	btrfs.c: cleanup struct btrfs_ioctl_get_dev_stats.nr_items check.
	* btrfs.c (btrfs_ioctl): Cleanup check of iterator of
	btrfs_ioctl_get_dev_stats.values array.

	btrfs.c: do not use BTRFS_SUBVOL_NAME_MAX.
	* btrfs.c [BTRFS_SUBVOL_NAME_MAX]: Remove.
	(btrfs_ioctl): Use sizeof(struct btrfs_ioctl_vol_args_v2.name)
	instead of BTRFS_SUBVOL_NAME_MAX + 1.

	btrfs.c: mark some function arguments as const.
	* btrfs.c (btrfs_print_balance_args, btrfs_print_features,
	btrfs_print_qgroup_limit, btrfs_print_data_container_header,
	btrfs_print_logical_ino_container, btrfs_print_ino_path_container,
	btrfs_print_qgroup_inherit): Mark some function arguments as const.

	btrfs.c: use umove instead of umoven.
	* btrfs.c: Use umove instead of umoven and umove_or_printaddr
	instead of umoven_or_printaddr.

	btrfs.c: remove unused variable.
	* btrfs.c (btrfs_ioctl): Remove "ret" variable.

	btrfs.c: use printxval/printxval64 instead of printxvals.
	* btrfs.c (btrfs_ioctl): Do not call printxvals directly,
	use printxval/printxval64 wrappers that do the right thing.

	btrfs.c: fix indentation.
	* btrfs.c: Fix indentation of preprocessor directives and print formats.

	xlat/btrfs_dev_stats_values.in: cleanup.
	* xlat/btrfs_dev_stats_values.in: Remove HAVE_DECL_* defines,
	use #unconditional instead.

	file_ioctl.c: use print_array.
	* file_ioctl.c (file_ioctl): Rewrite printers of
	struct file_dedupe_range_info and struct fiemap_extent arrays
	using print_array.

	file_ioctl.c: fix indentation.
	* file_ioctl.c: Fix indentation of preprocessor directives
	and print formats.

2016-05-24  Dmitry V. Levin  <ldv@altlinux.org>

	file_ioctl.c: include <linux/ioctl.h> instead of <sys/ioctl.h>
	Being a wrapper around <linux/ioctl.h>, <sys/ioctl.h> brings
	no benefits for this parser.

	* file_ioctl.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.

2016-05-24  Dmitry V. Levin  <ldv@altlinux.org>

	file_ioctl.c: fix build on systems without <linux/fiemap.h>
	* configure.ac (AC_CHECK_HEADERS): Add linux/fiemap.h.
	* file_ioctl.c: Do not include <linux/fiemap.h> and xlat/fiemap_*.h
	if [!HAVE_LINUX_FIEMAP_H].
	(file_ioctl): Do not parse FS_IOC_FIEMAP if [!HAVE_LINUX_FIEMAP_H].

	ioctl.c: fix build.
	* ioctl.c (ioctl_decode): Move definition of "ret" variable
	to [ALPHA || POWERPC] case.
	[ALPHA || POWERPC]: Fix syntax error.

2016-05-24  Jeff Mahoney  <jeffm@suse.com>

	ioctl: add decoding for FS_IOC_FIEMAP.
	* file_ioctl.c: Include <linux/fiemap.h>, "xlat/fiemap_flags.h",
	and "xlat/fiemap_extent_flags.h".
	(file_ioctl): Handle FS_IOC_FIEMAP.
	* ioctl.c (ioctl_decode): Use file_ioctl for decoding 'f' code ioctls.

2016-05-24  Dmitry V. Levin  <ldv@altlinux.org>

	Add xlat/fiemap_flags.in and xlat/fiemap_extent_flags.in.
	* xlat/fiemap_flags.in: New file.
	* xlat/fiemap_extent_flags.in: Likewise.

2016-05-24  Jeff Mahoney  <jeffm@suse.com>

	ioctl: add decoding support for btrfs ioctls.
	* btrfs.c: New file.
	* file_ioctl.c: Likewise.
	* Makefile.am (strace_SOURCES): Add them.
	* configure.ac (AC_CHECK_HEADERS): Add linux/btrfs.h.
	(AC_CHECK_MEMBERS): Add struct btrfs_ioctl_feature_flags.compat_flags,
	struct btrfs_ioctl_fs_info_args.nodesize,
	struct btrfs_ioctl_defrag_range_args.start,
	and struct btrfs_ioctl_search_args_v2.buf_size.
	(AC_CHECK_DECLS): Add BTRFS_COMPRESS_* enums.
	* defs.h (btrfs_ioctl, file_ioctl): New prototypes.
	* ioctl.c (ioctl_decode) [HAVE_LINUX_BTRFS_H]: Use btrfs_ioctl.
	* xlat/btrfs_balance_args.in: New file.
	* xlat/btrfs_balance_ctl_cmds.in: Likewise.
	* xlat/btrfs_balance_flags.in: Likewise.
	* xlat/btrfs_balance_state.in: Likewise.
	* xlat/btrfs_compress_types.in: Likewise.
	* xlat/btrfs_defrag_flags.in: Likewise.
	* xlat/btrfs_dev_replace_cmds.in: Likewise.
	* xlat/btrfs_dev_replace_results.in: Likewise.
	* xlat/btrfs_dev_replace_state.in: Likewise.
	* xlat/btrfs_dev_stats_flags.in: Likewise.
	* xlat/btrfs_dev_stats_values.in: Likewise.
	* xlat/btrfs_features_compat.in: Likewise.
	* xlat/btrfs_features_compat_ro.in: Likewise.
	* xlat/btrfs_features_incompat.in: Likewise.
	* xlat/btrfs_key_types.in: Likewise.
	* xlat/btrfs_qgroup_ctl_cmds.in: Likewise.
	* xlat/btrfs_qgroup_inherit_flags.in: Likewise.
	* xlat/btrfs_qgroup_limit_flags.in: Likewise.
	* xlat/btrfs_qgroup_status_flags.in: Likewise.
	* xlat/btrfs_scrub_flags.in: Likewise.
	* xlat/btrfs_send_flags.in: Likewise.
	* xlat/btrfs_snap_flags_v2.in: Likewise.
	* xlat/btrfs_space_info_flags.in: Likewise.
	* xlat/btrfs_tree_objectids.in: Likewise.

2016-05-24  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	x32: update ioctl entries from linux 4.6.
	* linux/x32/ioctls_inc0.h: Update from linux v4.6 using ioctls_gen.sh.

2016-05-24  Dmitry V. Levin  <ldv@altlinux.org>

	tests/attach-f-p.c: sleep a bit more to let the tracer catch up.
	On noticeably lagging systems, the parent process may invoke its chdir
	call before the tracer gets notified about completion of its last child
	process.  Add extra sleep in the parent process to win the race.

	* tests/attach-f-p.c (main): Change timerid into a static array.
	Arm a timer in the parent process and wait for it.

2016-05-23  Dmitry V. Levin  <ldv@altlinux.org>

	tests/attach-p-cmd-cmd.c: fix potential errno clobbering.
	* tests/attach-p-cmd-cmd.c (main): Call getpid before chdir.

	tests/net-yy-netlink.c: robustify against libc specific issues.
	* tests/net-yy-netlink.c (main): Use getsockname instead of recvmsg
	as the latter has notible implementation differences that make
	the test unreliable.

	tests/net-yy-netlink.c: robustify against os specific issues.
	* tests/net-yy-netlink.c (main): Pass a pointer to a real struct msghdr
	as NULL doesn't work well on some systems.

	tests/net-yy-{inet,netlink}.test: cleanup.
	* tests/net-yy-inet.test: Do not pass arguments to net-yy-inet
	as the latter does not accept them.
	* tests/net-yy-netlink.test: Do not pass arguments to net-yy-netlink
	as the latter does not accept them.

2016-05-22  Jeff Mahoney  <jeffm@suse.com>

	tests: define PRI__[dux]64 macros to print __s64 and __u64 values.
	Rather than cast every __u64 or __s64 before printing,
	define printing helpers for those types directly.

	This complements commit 1f3482bedad505a41caf1d61b3a4e7e09a2f4330.

	* tests/tests.h (PRI__d64, PRI__u64, PRI__x64): New macros.

2016-05-22  Dmitry V. Levin  <ldv@altlinux.org>

	tests: remove manual creation of memory mapping holes.
	We used to call tail_alloc(1) to create memory mapping holes around
	regular tail_alloc allocations.  This is no longer needed since regular
	tail_alloc allocations create additional memory mapping holes.

	* tests/clock_adjtime.c (main): Remove creation of memory mapping holes
	using tail_alloc(1).
	* tests/futimesat.c (main): Likewise.
	* tests/get_mempolicy.c (print_nodes, main): Likewise.
	* tests/getgroups.c (main): Likewise.
	* tests/getresugid.c (main): Likewise.
	* tests/ioctl_uffdio.c (main): Likewise.
	* tests/ioctl_v4l2.c (main): Likewise.
	* tests/move_pages.c (main): Likewise.
	* tests/net-icmp_filter.c (main): Likewise.
	* tests/ptrace.c (test_peeksiginfo, main): Likewise.
	* tests/pwritev.c (main): Likewise.
	* tests/set_mempolicy.c (print_nodes): Likewise.
	* tests/setgroups.c (main): Likewise.
	* tests/umovestr3.c (main): Likewise.
	* tests/utimes.c (main): Likewise.
	* tests/xattr.c (main): Likewise.

2016-05-22  Dmitry V. Levin  <ldv@altlinux.org>

	tests: make tail_alloc create additional memory mapping holes.
	* tests/tail_alloc.c (tail_alloc): Create additional memory mapping
	holes before and after the allocated memory.

2016-05-21  Dmitry V. Levin  <ldv@altlinux.org>

	mpers: add support of conditionally compiled printers.
	We used to declare and define all printers marked with
	MPERS_PRINTER_DECL, including ifdef'ed ones.  That approach left us
	no way to conditionally compile mpersified printers, which was not
	a problem until btrfs ioctls appeared on the horizon.

	With this change, those mpersified printers that are not going
	to be compiled are also won't be declared and won't be added to
	struct_printers.

	This is implemented by filtering all source files containing
	MPERS_PRINTER_DECL markers through CPP.  As a nice side effect, this
	also lifts an ugly requirement of writing all MPERS_PRINTER_DECL
	declarations in a single line.

	* README-mpers: Update description of MPERS_PRINTER_DECL syntax.
	* defs.h [IN_MPERS_BOOTSTRAP] (MPERS_PRINTER_DECL): Turn into
	a recursive variadic macro.
	[!IN_MPERS_BOOTSTRAP] (MPERS_PRINTER_DECL): Turn into a variadic macro.
	All callers changed.
	* Makefile.am (mpers_preproc_files, mpers_printer_decl_pattern):
	New variables.
	(CLEANFILES): Add $(mpers_preproc_files).
	(%.c.mpers.i): New rule.
	(printers.h, %_printer_decls.h, %_printer_defs.h): Use
	mpers_preproc_files instead of srcdir_mpers_source_files,
	use mpers_printer_decl_pattern.
	* .gitignore: Add /*.mpers.i.

2016-05-20  Dmitry V. Levin  <ldv@altlinux.org>

	Remove redundant declaration of v4l2_ioctl.
	There is no need to declare mpers printers in defs.h because
	they are already declared in printers.h or native_printer_decls.h.

	This complements commit 1e56814f77594a22a74ddee629639eb0bb7edf3a.

	* defs.h (v4l2_ioctl): Remove.

2016-05-21  Dmitry V. Levin  <ldv@altlinux.org>

	Fix one more code pattern that might break gcc strict aliasing rules.
	* socketutils.c (receive_responses): Turn static buffer into a union
	to avoid breaking of gcc strict aliasing rules.
	* tests/netlink_inet_diag.c (check_responses): Likewise.
	* tests/netlink_netlink_diag.c (check_responses): Likewise.
	* tests/netlink_unix_diag.c (check_responses): Likewise.

2016-05-21  Fabien Siron  <fabien.siron@epita.fr>

	tests: add check for netlink protocol decoding with -yy option.
	* tests/netlink_netlink_diag.c: New file.
	* tests/net-yy-netlink.c: New file.
	* tests/net-yy-netlink.test: New test.
	* tests/.gitignore: Add net-yy-netlink and netlink_netlink_diag
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add net-yy-netlink.test.

2016-05-18  Fabien Siron  <fabien.siron@epita.fr>

	Add netlink domain sockets support to socketutils.
	* linux/netlink_diag.h: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* socketutils.c: Include it and "xlat/netlink_protocols.h".
	(netlink_send_query, netlink_parse_response, netlink_print): New
	functions.
	(print_sockaddr_by_inode): Hook up netlink_print.

2016-05-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests/pread64-pwrite64.c: robustify against os specific issues.
	Do not assume that pwrite64 syscall fails when only part of the
	specified memory buffer is accessible.  With some kernels, one
	accessible byte at the end of page is enough for pwrite64 syscall
	to return 1.

	* tests/pread64-pwrite64.c (main): Tweak the test that can lead
	to a partial write.

2016-05-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests/read-write.c: robustify against os specific issues.
	Do not assume that write syscall fails when only part of the specified
	memory buffer is accessible.  With some kernels, one accessible byte
	at the end of page is enough for write syscall to return 1.

	* tests/read-write.c (main): Tweak the test that can lead to a partial
	write.

2016-05-18  Dmitry V. Levin  <ldv@altlinux.org>

	umovestr3.test: extend test coverage.
	* tests/umovestr3.c: Include <sys/param.h>.
	(main): Test with each number between PATH_MAX-1 and 0.

	tests/timer_create.c: robustify against os specific issues.
	* tests/timer_create.c (main): Do not assume any specific error code
	returned by timer_create, print whatever it is.

	Fix some compilation warnings on older systems.
	* print_statfs.c (print_statfs_flags): Define only
	for [HAVE_STRUCT_STATFS_F_FLAGS || HAVE_STRUCT_STATFS64_F_FLAGS].
	* tests/inet-cmsg.c (print_origdstaddr): Define only
	for [IP_ORIGDSTADDR].

	Update generic ioctl entries from linux 4.6.
	* linux/64/ioctls_inc.h: Update from linux v4.6 using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* NEWS: Mention this.

	maint: update for linux 4.6.
	* maint/ioctls_sym.sh: Update workarounds for linux/kvm.h.

	Update SOL_* constants.
	* xlat/socketlayers.in: Add SOL_KCM.

	Update MSG_* constants.
	* xlat/msg_flags.in: Add MSG_BATCH.

	Update AF_* constants.
	* xlat/addrfams.in: Add AF_KCM.

2016-05-17  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

2016-05-17  Dmitry V. Levin  <ldv@altlinux.org>

	Fix printing of invalid arguments of term ioctls.
	* term.c (term_ioctl): Print arguments of TCXONC and TCFLSH ioctls
	using printxval_long.

	mips: fix printing of invalid operations argument of sysmips syscall.
	* sysmips.c (SYS_FUNC(sysmips)): Print 1st argument of syscall using
	printxval_long.

	bfin: fix printing of invalid flags argument of sram_alloc syscall.
	* sram_alloc.c (SYS_FUNC(sram_alloc)): Print 2nd argument using
	printflags_long.

2016-05-16  Dmitry V. Levin  <ldv@altlinux.org>

	Fix printing of invalid arguments of prctl syscall.
	* prctl.c (SYS_FUNC(prctl)): Print 2nd syscall argument
	of PR_CAPBSET_DROP, PR_CAPBSET_READ, PR_CAP_AMBIENT, PR_MCE_KILL,
	and PR_SET_SECCOMP using printxval_long.
	Print 2nd syscall argument of PR_SET_SECUREBITS using printflags_long.
	Print 3rd syscall argument of PR_CAP_AMBIENT and PR_MCE_KILL using
	printxval_long.
	* tests/prctl-seccomp-strict.c (main): Update.

	Fix printing of invalid flags argument of perf_event_open syscall.
	* numa.c (SYS_FUNC(perf_event_open)): Print 5th argument of syscall
	using printflags_long.

	or1k: fix printing of invalid 1st argument of or1k_atomic syscall.
	* or1k_atomic.c (SYS_FUNC(or1k_atomic)): Print 1st argument using
	printxval_long.

	Fix printing of invalid flags argument of get_mempolicy syscall.
	* numa.c (SYS_FUNC(get_mempolicy)): Print 5th argument of syscall
	using printxval_long.

	Fix printing of invalid mode argument of mbind syscall.
	* numa.c (SYS_FUNC(mbind)): Print 3rd argument of syscall
	using printxval_long.
	* tests/mbind.c (main): Update.

	Fix printing of invalid argument of MTDFILEMODE ioctl.
	* mtd.c (mtd_ioctl): Print 3rd argument of MTDFILEMODE ioctl
	using printflags_long.

	Fix printing of invalid flags argument of mount syscall.
	* mount.c (SYS_FUNC(mount)): Print 1st argument using printflags_long.

	Fix printing of invalid arguments of memory mapping related syscalls.
	* mem.c (print_mmap): Print 3rd and 4th arguments of syscall
	using printflags_long.
	(SYS_FUNC(mprotect)): Print 3rd argument of syscall using
	printflags_long.
	(SYS_FUNC(mremap)): Print 4th argument of syscall using printflags_long.
	(SYS_FUNC(remap_file_pages)): Print 3rd and 4th arguments of syscall
	using printflags_long.
	* tests/remap_file_pages.c (main): Update.

	Fix printing of invalid flags argument of kexec_load and kexec_file_load
	* kexec.c (SYS_FUNC(kexec_load), SYS_FUNC(kexec_file_load)): Print
	flags argument using printflags_long.

	Fix printing of invalid 3rd argument of fcntl/fcntl64 syscall.
	* fcntl.c (print_fcntl): Print 3rd argument of F_NOTIFY, F_SETLEASE, and
	F_ADD_SEALS operations using printflags_long.

	Fix printing of invalid flags argument of unshare syscall.
	* clone.c (SYS_FUNC(unshare)): Print 1st argument using printflags_long.

	Introduce printflags_long and printxval_long.
	* defs.h (printflags_long, printxval_long): New static inline functions.

	Fix printing of invalid struct xfs_dqblk.d_flags.
	* quota.c (decode_cmd_data): Explicitly cast struct xfs_dqblk.d_flags
	to uint8_t to avoid potential sign-extension bug when printing
	invalid struct xfs_dqblk.d_flags.

	Fix printing of invalid struct ubi_mkvol_req.vol_type.
	* mtd.c (ubi_ioctl): Explicitly cast struct ubi_mkvol_req.vol_type
	to unsigned short to avoid potential sign-extension bug when printing
	invalid struct ubi_mkvol_req.vol_type.

2016-05-16  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of prctl/arch_prctl operation argument.
	Consistently treat operation argument of prctl/arch_prctl syscalls
	as int to match the kernel behaviour.

	* prctl.c (SYS_FUNC(prctl), SYS_FUNC(arch_prctl)): Assign 1st argument
	of syscalls to a variable of type unsigned int and use it in all
	subsequent checks and lookups.

2016-05-16  Dmitry V. Levin  <ldv@altlinux.org>

	Fix printing of struct sched_attr.sched_flags.
	* sched.c (print_sched_attr): Print sched_flags using printflags64.

	Fix printing of struct statfs.f_flags.
	* print_statfs.c (print_statfs_flags): Print flags using printflags64.

	Fix printing of invalid struct ifreq.ifr_flags.
	* sock.c (print_ifreq): Explicitly cast struct ifreq.ifr_flags
	to unsigned short to avoid potential sign-extension bug when printing
	invalid struct ifreq.ifr_flags.

	Fix printing of invalid struct pollfd.events.
	* poll.c (print_pollfd): Explicitly cast struct pollfd.events
	to unsigned short to avoid potential sign-extension bug when printing
	invalid struct pollfd.events.

	Fix printing of invalid struct sembuf.sem_flg.
	* ipc_sem.c (print_sembuf): Explicitly cast struct sembuf.sem_flg
	to unsigned short to avoid potential sign-extension bug when printing
	invalid struct sembuf.sem_flg.

	Fix printing of invalid l_type and l_whence in fcntl/fcntl64 syscalls.
	* fcntl.c (print_struct_flock64): Explicitly cast l_type and l_whence
	fields to unsigned short to avoid potential sign-extension bug when
	printing invalid l_type or l_whence fields.

	Fix printing of fanotify_mark mask argument.
	* fanotify.c (SYS_FUNC(fanotify_mark)): Print mask using printflags64.

2016-05-16  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of epoll_ctl operation argument.
	Consistently treat operation argument of epoll_ctl syscall as int
	to match the kernel behaviour.

	* epoll.c (SYS_FUNC(epoll_ctl)): Assign 2nd argument of syscall
	to a variable of type unsigned int and use it in all subsequent
	checks and lookups.
	* tests/epoll_ctl.c (invoke_syscall): New function.
	(main): Use it.

2016-05-16  Dmitry V. Levin  <ldv@altlinux.org>

	Fix printing of invalid d_type in getdents syscall.
	* dirent.c (SYS_FUNC(getdents)): Treat d_type as unsigned char to avoid
	potential sign-extension bug when printing invalid d_type.

	bfin: fix decoding of cacheflush syscall.
	* cacheflush.c (SYS_FUNC(cacheflush)): Print 2nd argument
	using %lu format.  Print 3rd argument as flags.

	Fix decoding of BPF_MAP_UPDATE_ELEM flags.
	* bpf.c (bpf_map_update_elem): Print attr.flags using printxval64.

2016-05-16  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of fcntl/fcntl64 operation argument.
	Consistently treat operation argument of fcntl/fcntl64 syscalls as int
	to match the kernel behaviour.

	* fcntl.c (print_fcntl, SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): Assign
	2nd argument of syscall to a variable of type unsigned int
	and use it in all subsequent checks and lookups.
	* tests/struct_flock.c (invoke_test_syscall): New function.
	(test_flock_einval, test_flock): Use it.
	* tests/fcntl.c (test_flock64_einval): Use it.
	* tests/fcntl64.c (test_flock64_einval, test_flock64): Use it.

2016-05-15  Dmitry V. Levin  <ldv@altlinux.org>

	Rename sprintflags64 to sprintflags.
	* defs.h (sprintflags): Remove.
	(sprintflags64): Rename to sprintflags.
	* util.c (sprintflags64): Rename to sprintflags.

	Prepare for transition from sprintflags64 to sprintflags.
	* fcntl.c (print_fcntl): Cast 3rd argument of sprintflags
	to unsigned long.
	* membarrier.c (SYS_FUNC(membarrier)): Likewise.
	* prctl.c (SYS_FUNC(prctl)): Likewise.
	* poll.c (decode_poll_exiting): Cast 3rd argument of sprintflags
	to unsigned short.

2016-05-14  Dmitry V. Levin  <ldv@altlinux.org>

	Rename xlookup64 to xlookup.
	* defs.h (xlookup): Remove.
	(xlookup64): Rename to xlookup.
	* util.c (xlookup64): Rename to xlookup.

	Prepare for transition from xlookup64 to xlookup.
	* fcntl.c (print_fcntl, SYS_FUNC(fcntl), SYS_FUNC(fcntl64)):
	Cast 2nd argument of xlookup to unsigned long.
	* prctl.c (SYS_FUNC(prctl)): Likewise.
	* sched.c (SYS_FUNC(sched_getscheduler)): Likewise.
	* time.c (do_adjtimex): Likewise.
	* ioprio.c (sprint_ioprio): Change type of the argument
	and local variables from int to unsigned int.
	* keyctl.c (print_keyring_serial_number): Cast 2nd argument
	of xlookup to unsigned int.
	* net.c (tprint_sock_type): Change type of the argument to unsigned int.
	* printmode.c (sprintmode): Likewise.
	* printsiginfo.c (printsigval):  Change type of si_code argument
	to unsigned int.

2016-05-14  Dmitry V. Levin  <ldv@altlinux.org>

	v4l2: fix build with old kernel headers.
	Prior to v2.6.25-rc3, <linux/videodev2.h> didn't include all
	required headers, resulting to omission of V4L2_* constants.

	This issue doesn't arise in v4l2.c and tests/ioctl_v4l2.c files
	because they already include all necessary headers themselves.

	* configure.ac (AC_CHECK_DECLS): Include <sys/time.h>, <linux/ioctl.h>,
	and <linux/types.h> before <linux/videodev2.h>.

2016-05-13  Dmitry V. Levin  <ldv@altlinux.org>

	configure.ac: do not check for sys/ioctl.h and ioctls.h.
	Since sys/ioctl.h is included unconditionally when needed
	and ioctls.h doesn't exist, these checks are redundant.

	* configure.ac (AC_CHECK_HEADERS): Remove ioctls.h and sys/ioctl.h.

2016-05-13  Dmitry V. Levin  <ldv@altlinux.org>

	sock.c: include <linux/ioctl.h> instead of <sys/ioctl.h> or <ioctls.h>
	Include <linux/ioctl.h> for <linux/sockios.h> on alpha, sh, and sh64
	architectures because their <asm/sockios.h> use _IOR and _IOW macros
	but don't include anything that would define these macros.

	Being a wrapper around <linux/ioctl.h>, <sys/ioctl.h> brings
	no benefits in this case.  <ioctls.h> simply doesn't exist.

	* sock.c [ALPHA || SH || SH64]: Include <linux/ioctl.h>
	instead of <sys/ioctl.h> or <ioctls.h>.

2016-05-13  Dmitry V. Levin  <ldv@altlinux.org>

	v4l2: include <linux/ioctl.h> instead of <sys/ioctl.h>
	Being a wrapper around <linux/ioctl.h>, <sys/ioctl.h> brings
	no benefits for parser of VIDIOC_* ioctls.

	* v4l2.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.

2016-05-13  Dmitry V. Levin  <ldv@altlinux.org>

	printsiginfo: remove "verbose" argument.
	Remove erroneous use of verbose(tcp) as a printing limit
	for already fetched members of siginfo_t structure.

	* printsiginfo.h (printsiginfo): Remove boolean argument.
	* printsiginfo.c (printsigval): Remove boolean argument, print
	si_int and si_ptr members unconditionally.  All callers changed.
	(print_si_info): Remove boolean argument, print si_utime and si_stime
	members unconditionally.  All callers changed.
	(printsiginfo): Remove boolean argument.  All callers changed.

2016-05-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests/ptrace.c: tweak magic constants to make the test more reliable.
	* tests/ptrace.c (main): Change bad_request and bad_data to make they
	lower 32-bit parts closer to -1U.

2016-05-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests/ioctl_v4l2.c: fix build on older systems.
	Fix build on systems without HAVE_DECL_V4L2_CTRL_TYPE_STRING or
	V4L2_CTRL_CLASS_CAMERA.

	* tests/ioctl_v4l2.c (main) [VIDIOC_S_EXT_CTRLS]: Disable part of the
	test if [!HAVE_DECL_V4L2_CTRL_TYPE_STRING].
	Replace V4L2_CTRL_CLASS_CAMERA with V4L2_CTRL_CLASS_USER.

2016-05-13  Dmitry V. Levin  <ldv@altlinux.org>

	Do not use htole32 function.
	htole32 function is not portable enough.

	* v4l2.c (print_pixelformat): Rewrite initialization of pixel format
	union without using of htole32.
	* tests/ioctl_v4l2.c (main): Likewise.

2016-05-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests/ioctl_v4l2.c: fix typo.
	* tests/ioctl_v4l2.c (main)
	[!HAVE_DECL_V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE]: Fix typo in expected
	output string.

	tests: check decoding of ptrace syscall.
	* tests/ptrace.c: New file.
	* tests/ptrace.test: New test.
	* tests/.gitignore: Add ptrace.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add ptrace.

2016-05-13  Dmitry V. Levin  <ldv@altlinux.org>

	ptrace: decode data argument of PTRACE_PEEKSIGINFO request.
	The data argument of PTRACE_PEEKSIGINFO request is a pointer
	to siginfo_t array.

	* printsiginfo.c (print_siginfo_t): New function.
	(print_siginfo_array): New mpers printer.
	* process.c (SYS_FUNC(ptrace)): Print data argument of
	PTRACE_PEEKSIGINFO request using print_siginfo_array.

2016-05-13  Dmitry V. Levin  <ldv@altlinux.org>

	ptrace: decode data argument of PTRACE_SECCOMP_GET_FILTER request.
	* process.c (SYS_FUNC(ptrace)): Print data argument of
	PTRACE_SECCOMP_GET_FILTER request on exiting using print_seccomp_fprog.

	ptrace: decode argument of PTRACE_GETEVENTMSG request.
	* process.c (SYS_FUNC(ptrace)): Print data argument of
	PTRACE_GETEVENTMSG request on exiting using printnum_ulong.

	ptrace: decode arguments of PTRACE_[GS]ETSIGMASK requests.
	* process.c (SYS_FUNC(ptrace)): Print arguments of PTRACE_GETSIGMASK
	and PTRACE_SETSIGMASK requests using print_sigset_addr_len.

	ptrace: return RVAL_DECODED for requests decoded on entering.
	* process.c (SYS_FUNC(ptrace)): Return RVAL_DECODED on entering for all
	ptrace requests except those that are partially decoded in exiting,

2016-05-12  Dmitry V. Levin  <ldv@altlinux.org>

	ptrace: print PTRACE_O_* flags using printflags64.
	As flags argument has a long integer type, print it using printflags64
	because printflags takes unsigned int argument.

	* process.c (SYS_FUNC(ptrace)): Print PTRACE_O_* flags
	using printflags64.

2016-05-12  Dmitry V. Levin  <ldv@altlinux.org>

	ptrace: print data argument of PTRACE_SEIZE et al requests as flags.
	* process.c (SYS_FUNC(ptrace)): Print data argument of
	PTRACE_SEIZE and PTRACE_OLDSETOPTIONS as PTRACE_O_* flags.

	ptrace: print data argument of PTRACE_SINGLEBLOCK et al requests as signo
	* process.c (SYS_FUNC(ptrace)): Print data argument of
	PTRACE_SINGLEBLOCK, PTRACE_SYSEMU, and PTRACE_SYSEMU_SINGLESTEP requests
	as a signal number.

2016-05-12  Dmitry V. Levin  <ldv@altlinux.org>

	ptrace: decode addr argument of PTRACE_PEEKSIGINFO request.
	The addr argument of PTRACE_PEEKSIGINFO request is a pointer to
	a struct ptrace_peeksiginfo_args.

	* process.c: Include "xlat/ptrace_peeksiginfo_flags.h".
	(SYS_FUNC(ptrace)): Print addr argument of PTRACE_PEEKSIGINFO request
	as a struct ptrace_peeksiginfo_args.
	* xlat/ptrace_peeksiginfo_flags.in: New file.

2016-05-12  Dmitry V. Levin  <ldv@altlinux.org>

	ptrace: fix printing addr argument of PTRACE_GETSIGMASK et al requests.
	For PTRACE_GETSIGMASK and PTRACE_SETSIGMASK requests, addr argument
	contains the size of the buffer pointed to by data argument.
	For PTRACE_SECCOMP_GET_FILTER request, addr argument contains
	an offset counter.

	* process.c (SYS_FUNC(ptrace)): Print addr argument of
	PTRACE_GETSIGMASK, PTRACE_SETSIGMASK, and PTRACE_SECCOMP_GET_FILTER
	requests using %lu format.

2016-05-12  Dmitry V. Levin  <ldv@altlinux.org>

	ptrace: do not print data argument of some requests on sparc.
	On sparc, kernel ignores data argument of PTRACE_GETREGS,
	PTRACE_SETREGS, PTRACE_GETFPREGS, and PTRACE_SETFPREGS requests.

	* process.c (SYS_FUNC(ptrace)) [SPARC || SPARC64]: Return RVAL_DECODED
	right after printing addr argument if request is one of PTRACE_GETREGS,
	PTRACE_SETREGS, PTRACE_GETFPREGS, or PTRACE_SETFPREGS.

2016-05-12  Dmitry V. Levin  <ldv@altlinux.org>

	ptrace: do not print addr and data arguments of PTRACE_ATTACH-like requests
	As kernel ignores addr and data arguments of PTRACE_ATTACH,
	PTRACE_INTERRUPT, PTRACE_KILL, and PTRACE_LISTEN request,
	we do not print them either.

	* process.c (SYS_FUNC(ptrace)): After printing pid argument, return
	RVAL_DECODED if request is one of PTRACE_ATTACH, PTRACE_INTERRUPT,
	PTRACE_KILL, or PTRACE_LISTEN.

2016-05-12  Dmitry V. Levin  <ldv@altlinux.org>

	ptrace: do not print arguments of PTRACE_TRACEME request.
	As kernel ignores arguments of PTRACE_TRACEME request,
	we do not print them either.

	* process.c (SYS_FUNC(ptrace)): If request is PTRACE_TRACEME,
	return early with RVAL_DECODED.

2016-05-12  Dmitry V. Levin  <ldv@altlinux.org>

	ptrace: print request using printxval64.
	As first argument of ptrace syscall has a long integer type, print
	it using printxval64 because printxval takes unsigned int argument.

	* process.c (SYS_FUNC(ptrace)): Change type of "request" variable
	from "long" to "unsigned long", print it using printxval64 instead
	of printxval.

2016-05-12  Dmitry V. Levin  <ldv@altlinux.org>

	Do not sign-extend siginfo_t.si_syscall.
	* printsiginfo.c (print_si_info): Explicitly cast si_syscall member
	of siginfo_t that has type "int" to "unsigned int", to avoid sign
	extension when passed to syscall_name function.

	Export print_seccomp_fprog for further use in parser of ptrace syscall.
	* defs.h (print_seccomp_fprog): New prototype.
	* seccomp.c (print_seccomp_fprog): Remove "static" keyword.
	Move printing of struct seccomp_fprog fields ...
	(print_seccomp_filter): ... here.

2016-05-11  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

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

2016-05-11  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding and dumping of preadv2 and pwritev2 syscalls.
	* tests/preadv2-pwritev2.c: New file.
	* tests/preadv2-pwritev2.test: New test.
	* tests/.gitignore: Add preadv2-pwritev2.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add preadv2-pwritev2.

	Implement decoding of preadv2 and pwritev2 syscalls.
	* io.c: Include "xlat/rwf_flags.h".
	(do_preadv, do_pwritev, SYS_FUNC(preadv2), SYS_FUNC(pwritev2)):
	New functions.
	(SYS_FUNC(preadv)): Use do_preadv.
	(SYS_FUNC(pwritev)): Use do_pwritev.
	* linux/32/syscallent.h (preadv2, pwritev2): New entries.
	* linux/64/syscallent.h: Likewise.
	* linux/arm/syscallent.h: Likewise.
	* linux/hppa/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/m68k/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/powerpc64/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* syscall.c (dumpio): Handle SEN_preadv2 and SEN_pwritev2.
	* xlat/rwf_flags.in: New file.
	* NEWS: Mention parsers of new syscalls.

2016-05-10  Dmitry V. Levin  <ldv@altlinux.org>

	tests: extend test coverage of xattr family syscalls.
	* tests/xattr.c: Check decoding of all xattr family syscalls.
	* tests/xattr.test: Use run_strace_match_diff.
	* tests/xattr.expected: Remove.
	* tests/Makefile.am (EXTRA_DIST): Remove it.

	tests: add print_quoted_memory function to libtests.
	* tests/print_quoted_string.c (print_quoted_memory): New function.
	(print_quoted_string): Use it.
	* tests/tests.h (print_quoted_memory): New prototype.

	Fix corner cases of xattr family syscalls decoding.
	* xattr.c (print_xattr_val): Do not take insize into account, print it
	as unsigned long.
	Do not decode xattr values of size larger than XATTR_SIZE_MAX.
	Use static buffer for fetching xattr values.
	(print_xattr_list): Do not decode string when size is zero.

2016-05-10  Dr. David Alan Gilbert  <dgilbert@redhat.com>

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

2016-05-10  Dr. David Alan Gilbert  <dgilbert@redhat.com>

	Decode UFFDIO_* ioctls.
	Decode the ioctls associated with the userfaultfd fd.
	Note that they tend to read from and also return result in it's data
	structure.

	* configure.ac (AC_CHECK_HEADERS): Add linux/userfaultfd.h.
	* userfaultfd.c [HAVE_LINUX_USERFAULTFD_H]: Add ioctl decoder.
	* defs.h (uffdio_ioctl): New prototype.
	* ioctl.c (ioctl_decode) [HAVE_LINUX_USERFAULTFD_H]: Wire in
	uffdio_ioctl.
	* xlat/uffd_*.in: Create flag xlat for all the IOCTLs.

2016-05-10  Dmitry V. Levin  <ldv@altlinux.org>

	Update AX_CODE_COVERAGE.
	* m4/ax_code_coverage.m4: Update to serial 16.
	* Makefile.am (CODE_COVERAGE_LCOV_OPTIONS): Remove.
	(CODE_COVERAGE_GENHTML_OPTIONS): Update, add prefix.
	(CODE_COVERAGE_BRANCH_COVERAGE): Set to 1.

	strace-ff.test: fix race condition.
	* tests/strace-ff.test: Wait for completion of PR_SET_PTRACER command.

	tests/epoll_pwait.c: fix for x32.
	* tests/epoll_pwait.c (main): Explicitly cast last syscall argument
	to kernel_ulong_t.

	strace-S.test: check "-S name"
	* tests/strace-S.test: Add a check for "-c -S name" output.

	Fix NULL dereference in "-S name" when syscall table has holes.
	* count.c (syscall_cmp): Do not pass NULL to strcmp.

	strace-S.test: cleanup.
	* tests/strace-S.test: Rewrite using sed.

2016-05-09  Fei Jie  <feij.fnst@cn.fujitsu.com>

	tests: add strace-S.test.
	* tests/strace-S.test: New test.
	* tests/Makefile.am (MISC_TESTS): Add it.

2016-05-09  Dmitry V. Levin  <ldv@altlinux.org>

	strace-ff.test: check that -ff does not create unexpected output files.
	* tests/strace-ff.expected: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	* tests/strace-ff.test: Use it.  Check that no other output files
	have been created.

2016-05-09  Fei Jie  <feij.fnst@cn.fujitsu.com>

	tests: add strace-ff.test.
	* tests/strace-ff.test: New test.
	* tests/Makefile.am (MISC_TESTS): Add it.

2016-05-09  Dmitry V. Levin  <ldv@altlinux.org>

	strace-V.test: cleanup.
	* tests/strace-V.test: Move config.h parser to a function.
	Rename $OUT to $EXP, swap arguments passed to match_diff.

2016-05-09  Fei Jie  <feij.fnst@cn.fujitsu.com>

	tests: add strace-V.test.
	* tests/strace-V.test: New test.
	* tests/Makefile.am (MISC_TESTS): Add it.

2016-05-09  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of epoll_pwait syscall.
	* tests/epoll_pwait.c: New file.
	* tests/epoll_pwait.test: New test.
	* tests/.gitignore: Add epoll_pwait.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add epoll_pwait.test.

2016-05-09  Dmitry V. Levin  <ldv@altlinux.org>

	Assume that sys/epoll.h exists.
	This header file was added in glibc-2.3.2,
	so it's safe to assume its availability.

	* configure.ac (AC_CHECK_HEADERS): Remove sys/epoll.h.
	* epoll.c: Include <sys/epoll.h> unconditionally.
	Compile [HAVE_SYS_EPOLL_H] code unconditionally.
	* tests/epoll_ctl.c: Do not check for HAVE_SYS_EPOLL_H.
	* tests/epoll_wait.c: Likewise.

2016-05-08  Fabien Siron  <fabien.siron@epita.fr>

	Factorize send_query functions.
	* socketutils.c (send_query): New function.
	(inet_send_query, unix_send_query): Use it.

2016-05-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests: relax timings.
	Allow nanosleep(2) to spend 10% more time to make the test suite
	more reliable on slow systems.

	* tests/count.test: Treat 1.1 seconds as valid output.
	* tests/strace-T.expected: Likewise.
	* tests/strace-r.expected: Likewise.

2016-05-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests/attach-f-p.c: increase timeouts.
	Increase timeouts to make the test more reliable on slow systems.

	* tests/attach-f-p.c (its): Increase timeouts to 1, 2, and 3 seconds,
	respectively.

2016-05-07  Dmitry V. Levin  <ldv@altlinux.org>

	Remove unused functions.
	* defs.h (umove_ulong_or_printaddr, umove_ulong_array_or_printaddr):
	Remove.
	* util.c (umove_ulong_or_printaddr, umove_ulong_array_or_printaddr):
	Likewise.

	v4l2.c: use print_array function.
	* v4l2.c (print_v4l2_ext_control, umoven_or_printaddr_ignore_syserror):
	New functions.
	(print_v4l2_ext_controls): Use them via print_array.

	uid.c: use print_array function.
	* uid.c (print_gid): New function.
	(print_groups): Use it via print_array.

	seccomp.c: use print_array function.
	* seccomp.c (decode_filter, decode_seccomp_fprog): Remove.
	(print_bpf_filter): New function.
	(print_seccomp_fprog): Use it via print_array.
	* tests/seccomp-filter-v.c (main): Update.

	scsi.c: use print_array function.
	* scsi.c (print_uchar): New function.
	(print_sg_io_buffer): Use it via print_array.

	poll.c: use print_array function.
	* poll.c (print_pollfd): Change for use as print_array callback.
	(decode_poll_entering): Use print_array.
	* tests/poll.c: Update.
	* tests/poll.test: Update.

	numa.c: use print_array function.
	* numa.c (print_node): New function.
	(print_nodemask): Use it via print_array.
	(print_page_array, print_int_array): Remove.
	(print_addr): New function.
	(print_status, print_int): Change for use as print_array callback.
	(SYS_FUNC(move_pages)): Use print_addr, print_int, and print_status
	via print_array.
	* tests/move_pages.c: Update.
	* tests/set_mempolicy.c: Likewise.
	* tests/set_mempolicy.test: Likewise.

	mem.c: use print_array function.
	* mem.c [POWERPC] (print_protmap_entry): New function.
	[POWERPC] (SYS_FUNC(subpage_prot)): Use it via print_array.

	kexec.c: use print_array function.
	* kexec.c (print_seg): Change for use as print_array callback.
	(print_kexec_segments): Use print_array.

	ipc_sem.c: use print_array function.
	* ipc_sem.c (tprint_sembuf): Rename to print_sembuf, change signature
	for use as print_array callback.
	(tprint_sembuf_array): Use print_array.

	io.c: use print_array function.
	* io.c (print_iovec_config): New structure.
	(print_iovec): New function.
	(tprint_iov_upto): Use print_array.
	* tests/preadv.c (main): Update.
	* tests/pwritev.c (print_iovec, main): Likewise.

	epoll.c: use print_array function.
	* epoll.c (print_epoll_event): Change signature for use as print_array
	callback, all users updated.
	(print_epoll_event_array): Remove.
	(epoll_wait_common): Change to use print_array instead
	of print_epoll_event_array.

	aio.c: use print_array function.
	* aio.c (print_iocbp): New function.
	(SYS_FUNC(io_submit)): Use it via print_array.  Use widen_to_long
	to process long int argument.
	(print_io_event): Change to print struct io_event fetched elsewhere.
	(SYS_FUNC(io_cancel)): Update use of print_io_event.
	(SYS_FUNC(io_getevents)): Use print_io_event via print_array.
	Use widen_to_long to print long int arguments.
	* tests/aio.c (main): Check decoding of io_submit with negative "nr".

	Introduce print_array function for consistent decoding of arrays.
	* defs.h (print_array): New prototype.
	* util.c (print_array): New function.

2016-05-06  Dmitry V. Levin  <ldv@altlinux.org>

	Fix corner cases of ICMP_FILTER decoding.
	* net.c (print_icmp_filter): Print icmp_filter for any positive length.
	* tests/net-icmp_filter.c: New file.
	* tests/net-icmp_filter.test: New test.
	* tests/.gitignore: Add net-icmp_filter.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add net-icmp_filter.test.

2016-05-05  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: do not strip "1<<" prefix from xlat strings.
	* xlat/gen.sh (cond_xlat, gen_header): Do not strip "1<<" prefix
	from xlat strings to fix incorrect output.
	* tests/caps.awk: Update.

	Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

2016-05-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests/xstatfsx.c: fix mips o32 support.
	mips o32 differs from all other 32-bit architectures by defining
	__kernel_fsid_t structure as an array of long ints.

	* tests/xstatfsx.c (print_statfs): Explicitly cast elements
	of PRINT_F_FSID array to unsigned int.

2016-05-05  Dmitry V. Levin  <ldv@altlinux.org>

	Mpersify VIDIOC_* ioctl parser.
	* v4l2.c: Mpersify arch-specific structures.
	(v4l2_ioctl): Mpersify.
	* tests/ioctl_v4l2.c: New file.
	* tests/ioctl_v4l2.test: New test.
	* tests/.gitignore: Add ioctl_v4l2.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add ioctl_v4l2.test.

2016-05-05  Dmitry V. Levin  <ldv@altlinux.org>

	Mpersify ioctl macros.
	As values of some ioctl macros differ between personalities, these
	personality specific ioctl macros should be properly defined for
	mpersified code.  Implement this by redefining personality specific
	ioctl macros from ioctlent*.h for each file that includes MPERS_DEFS.

	* Makefile.am (ioctl_macros_h): New variable.
	(ioctl_macros%.h): New rule.
	(BUILT_SOURCES, CLEANFILES): Add $(ioctl_macros_h).
	(m%_type_defs.h): #include MPERS_$(mpers_PREFIX)IOCTL_MACROS.
	* defs.h [HAVE_M32_MPERS] (MPERS_m32_IOCTL_MACROS): New macro.
	[HAVE_MX32_MPERS] (MPERS_mx32_IOCTL_MACROS): Likewise.

	Acked-by: Elvira Khabirova <lineprinter0@gmail.com>

2016-05-05  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of VIDIOC_* ioctls.
	* v4l2.c: Fix numerous bugs in decoding of VIDIOC_* ioctls.
	* tests/ioctl.c (main): Update.

2016-05-05  Dmitry V. Levin  <ldv@altlinux.org>

	nsyscalls.test: add mips o32 support.
	Out-of-range syscalls looks differently on mips o32.

	* tests/nsyscalls.c (main): Handle LINUX_MIPSO32.
	* tests/nsyscalls.test: Trace syscall called "syscall" on mips.

2016-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	Remove initialization of big holes in syscallent.h files.
	There is no need to explicitly initialize big holes after conversion
	of syscallent.h files to use designated initializers.  For architectures
	that have some data at the end of syscallent.h this initialization of
	big holes is no-op, for others it just inflates the table unnecessarily.

	* linux/arc/syscallent.h: Remove initialization of arch specific block
	at the end of table.
	* linux/metag/syscallent.h: Likewise.
	* linux/nios2/syscallent.h: Likewise.
	* linux/or1k/syscallent.h: Likewise.
	* linux/tile/syscallent.h: Likewise.
	* linux/tile/syscallent1.h: Likewise.
	* linux/arm/syscallent.h: Remove explicit initialization of a big hole
	before socket subcalls.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/powerpc64/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/sparc64/syscallent.h: Likewise.
	* linux/mips/syscallent-compat.h: Remove explicit initialization
	of big holes between different mips ABIs.
	* linux/mips/syscallent-n64.h: Remove explicit initialization
	of big holes before socket subcalls and between different mips ABIs.
	* linux/mips/syscallent-o32.h: Likewise.

2016-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: make "1<<val" syntax work with 64-bit values.
	* xlat/gen.sh(cond_xlat, gen_header): Generate 1UUL<<val
	for 1<<val syntax.

	Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

2016-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	Fix typo in XLAT_TYPE_PAIR.
	* xlat.h (XLAT_TYPE_PAIR): Take "type" parameter.

	Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

2016-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of move_pages syscall.
	* numa.c (print_page_array, print_status, print_int, print_int_array):
	New functions.
	(SYS_FUNC(move_pages)): Rewrite using these functions.
	* tests/move_pages.c: New file.
	* tests/move_pages.test: New test.
	* tests/.gitignore: Add move_pages.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add move_pages.test.

	tests: check decoding of mbind syscall.
	* tests/mbind.c: New file.
	* tests/mbind.test: New test.
	* tests/.gitignore: Add mbind.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add mbind.test.

2016-04-29  Jeff Mahoney  <jeffm@suse.com>

	Change type of struct xlat.val to uint64_t.
	Some ioctls have flags fields that are 64-bit.  A 32-bit val means
	these flags will never be matched or printed.

	* xlat.h: Include <stdint.h>.
	(struct xlat): Change type of val to uint64_t.

2016-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: extend syntax with #val_type directive.
	When #val_type directive is encountered, gen.sh starts using
	XLAT_TYPE/XLAT_TYPE_PAIR macros instead of XLAT/XLAT_PAIR,
	with #val_type's argument as a type.

	For example, "#val_type uint64_t" means values of type uint64_t.

	* xlat/gen.sh (gen_header, print_xlat, print_xlat_pair):
	Add val_type support.

2016-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	xlat/gen.sh: prepare for adding #val_type directive support.
	This is essentially a no-op change that makes the following change
	easier to read.

	* xlat/gen.sh (print_xlat, print_xlat_pair): New functions.
	(cond_xlat, gen_header): Use them.

2016-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce XLAT_TYPE and XLAT_TYPE_PAIR macros.
	* xlat.h (XLAT_TYPE): New macro, similar to XLAT but casts
	to the specified type instead of unsigned int.
	(XLAT_TYPE_PAIR): New macro, similar to XLAT_PAIR but casts
	to the specified type instead of unsigned int.

2016-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	xlat: generate xlat pairs using new XLAT_PAIR macro.
	Before this change there were two forms of xlat entries: those that use XLAT
	or XLAT_END macros, and others verbatim entries.  This change converts
	the latter to use new XLAT_PAIR macro.

	This is necessary for the upcoming change of xlat.val type.

	* xlat.h (XLAT_PAIR): New macro.
	* xlat/gen.sh (cond_xlat, gen_header): Use it.

2016-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	Explicitly cast argument of XLAT macro to unsigned int.
	This is necessary for the upcoming change of xlat.val type.

	* xlat.h (XLAT): Cast the argument to unsigned int.

2016-04-29  Dmitry V. Levin  <ldv@altlinux.org>

	Change type of {s,t}print_open_modes's argument to unsigned.
	As "flags" argument of sprint_open_modes and tprint_open_modes is
	involved only in bit operations, change its type to unsigned.

	* defs.h.c (sprint_open_modes, tprint_open_modes): Change type
	to unsigned int.
	* open.c (sprint_open_modes, tprint_open_modes): Likewise.

2016-04-28  Dmitry V. Levin  <ldv@altlinux.org>

	tests/remap_file_pages.c: fix for the upcoming change of xlat.val type.
	The "flags" argument of remap_file_page syscall has type "unsigned
	long", so it is not correct to load most significant bits with garbage
	ans assume they are going to be ignored.

	* tests/remap_file_pages.c (main): Remove artificial garbage from flags.

2016-04-28  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce printflags64 function.
	This is necessary for the upcoming change of xlat.val type.

	* defs.h (printflags): Rename to printflags64, change type of integer
	argument to uint64_t.
	(printflags): New static inline function.
	* util.c (printflags): Rename to printflags64, change type of integer
	argument to uint64_t.  Print it using PRIx64 format.
	Based on patch by Jeff Mahoney <jeffm@suse.com>.

2016-04-28  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce sprintflags64 function.
	This is necessary for the upcoming change of xlat.val type.

	* defs.h (sprintflags): Rename to sprintflags64, change type of integer
	argument to uint64_t.
	(sprintflags): New static inline function.
	* util.c (sprintflags): Rename to sprintflags64, change type of integer
	argument to uint64_t.  Print it using PRIx64 format.
	Based on patch by Jeff Mahoney <jeffm@suse.com>.

2016-04-28  Dmitry V. Levin  <ldv@altlinux.org>

	printxvals: change type of integer argument to uint64_t.
	This is necessary for the upcoming change of xlat.val type.
	All users of printxvals are already prepared for this change.

	* defs.h (printxvals): Change type of integer argument to uint64_t.
	* util.c (printxvals): Likewise.  Print it using PRIx64 format.
	Patch by Jeff Mahoney <jeffm@suse.com>.

2016-04-28  Dmitry V. Levin  <ldv@altlinux.org>

	xlat_search: change type of integer argument to uint64_t.
	This is necessary for the upcoming change of xlat.val type.
	All users of addflags are already prepared for this change.

	* defs.h (xlat_search): Change type of integer argument to uint64_t.
	* util.c (xlat_search): Likewise.  Pass it by pointer.
	(xlat_bsearch_compare): Treat first argument as a pointer.
	Patch by Jeff Mahoney <jeffm@suse.com>.

2016-04-28  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce xlookup64 function.
	This is necessary for the upcoming change of xlat.val type.

	* defs.h (xlookup): Rename to xlookup64, change type of integer argument
	to uint64_t.
	(xlookup): New static inline function.
	* util.c (xlookup): Rename to xlookup64, change type of integer
	argument to uint64_t.
	Based on patch by Jeff Mahoney <jeffm@suse.com>.

2016-04-28  Dmitry V. Levin  <ldv@altlinux.org>

	addflags: change type of integer argument to uint64_t.
	This is necessary for the upcoming change of xlat.val type.
	All users of addflags are already prepared for this change.

	* defs.h (addflags): Change type of integer argument to uint64_t.
	* util.c (addflags): Likewise.  Print it using PRIx64 format.
	Based on patch by Jeff Mahoney <jeffm@suse.com>.

2016-04-28  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce printxval64 wrapper.
	This is necessary for the upcoming change of xlat.val type.

	* defs.h (printxval64): New static inline function.

2016-04-28  Dmitry V. Levin  <ldv@altlinux.org>

	Turn printxval macro into a static inline function.
	This is necessary for the upcoming change of xlat.val type.

	* defs.h (printxval): Change to static inline function.

2016-04-28  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of migrate_pages syscall.
	* tests/migrate_pages.c: New file.
	* tests/migrate_pages.test: New test.
	* tests/.gitignore: Add migrate_pages.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add migrate_pages.test.

	Fix decoding of migrate_pages syscall.
	* numa.c (SYS_FUNC(migrate_pages)): Print syscall arguments
	in the right order.

	tests: check decoding of set_mempolicy syscall.
	* tests/set_mempolicy.c: New file.
	* tests/set_mempolicy.test: New test.
	* tests/.gitignore: Add set_mempolicy.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add set_mempolicy.test.

	tests: check decoding of get_mempolicy syscall.
	* tests/get_mempolicy.c: New file.
	* tests/get_mempolicy.test: New test.
	* tests/.gitignore: Add get_mempolicy.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add get_mempolicy.test.

	numa: fix decoding of nodemask arrays.
	* numa.c (get_nodes): Rewrite an rename to print_nodemask.
	All callers updated.
	(SYS_FUNC(mbind), SYS_FUNC(set_mempolicy), SYS_FUNC(get_mempolicy)):
	Print a delimiter before nodemask argument.

2016-04-27  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of policy argument of get_mempolicy syscall.
	* numa.c (SYS_FUNC(get_mempolicy)): Print policy argument in square
	brackets to indicate indirect access.

	Fix decoding of pid_t argument of migrate_pages syscall.
	* numa.c (SYS_FUNC(migrate_pages)): Print pid_t syscall
	argument using %d format.

	tests: add printxval function to libtests.
	* tests/tests.h (printxval): New prototype.
	* tests/printxval.c: New file.
	* tests/Makefile.am  (libtests_a_SOURCES): Add it.

	tests: check decoding of remap_file_pages syscall.
	* tests/remap_file_pages.c: New file.
	* tests/remap_file_pages.test: New test.
	* tests/.gitignore: Add remap_file_pages.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add remap_file_pages.test.

2016-04-27  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

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

2016-04-27  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of pid_t arguments of kill and tgkill syscalls.
	* signal.c (SYS_FUNC(kill), SYS_FUNC(tgkill)): Print pid_t syscall
	arguments using %d format.

2016-04-27  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

2016-04-27  Dmitry V. Levin  <ldv@altlinux.org>

	Move parsers of NUMA related syscalls to numa.c.
	* mem.c (get_nodes, SYS_FUNC(mbind), SYS_FUNC(set_mempolicy),
	SYS_FUNC(get_mempolicy), SYS_FUNC(migrate_pages), SYS_FUNC(move_pages)):
	Move ...
	* numa.c: ... here.
	* Makefile.am (strace_SOURCES): Add numa.c

	tests/umovestr3.c: robustify against os specific issues.
	* tests/umovestr3.c (main): Create extra gap before unreadable page.

	tests: extend test coverage of umovestr short read condition.
	* tests/umovestr3.c: New file.
	* tests/umovestr3.test: New test.
	* tests/.gitignore: Add umovestr3.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add umovestr3.test.

	tests: check decoding of out-of-range syscalls.
	* tests/nsyscalls.c: New file.
	* tests/nsyscalls.test: New test.
	* tests/.gitignore: Add nsyscalls.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add nsyscalls.test.

2016-04-26  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of 3rd argument of getdents/getdents64 syscalls.
	* dirent.c (SYS_FUNC(getdents)): Always print 3rd syscall argument
	as unsigned int.
	* dirent64.c (SYS_FUNC(getdents64)): Likewise.
	* tests/getdents.c (main): Check it.
	* tests/getdents64.c (main): Likewise.

	Fix decoding of LINUX_REBOOT_CMD_RESTART2 argument.
	* reboot.c (SYS_FUNC(reboot)): Cast numeric arguments to unsigned int.

2016-04-26  Dmitry V. Levin  <ldv@altlinux.org>

	.travis.yml: raise sleep delay.
	Previous sleep delay value seems to be not enough nowadays.

	.travis.yml (SLEEP_A_BIT): Raise sleep delay.

2016-04-26  Dmitry V. Levin  <ldv@altlinux.org>

	Move definitions of MPOL_* constants to xlat files.
	* mem.c (MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, MPOL_INTERLEAVE):
	Move to xlat/policies.in.
	(MPOL_F_NODE, MPOL_F_ADDR): Move to xlat/mempolicyflags.in.
	(MPOL_MF_STRICT, MPOL_MF_MOVE, MPOL_MF_MOVE_ALL): Move
	to xlat/mbindflags.in.

	tests: check decoding of renameat2 syscall.
	* tests/renameat2.c: New file.
	* tests/renameat2.test: New test.
	* tests/.gitignore: Add renameat2.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add renameat2.test.

	Add default values for RENAME_* constants.
	* xlat/rename_flags.in: Add default values.

	tests: check decoding of utimes syscall.
	* tests/utimes.c: New file.
	* tests/utimes.test: New test.
	* tests/.gitignore: Add utimes.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add utimes.test.

	tests: check decoding of futimesat syscall.
	* tests/futimesat.c: New file.
	* tests/futimesat.test: New test.
	* tests/.gitignore: Add futimesat.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add futimesat.test.

	tests: extend test coverage of mknod syscall.
	* mknod.c (main): Check more corner cases of mode_t parser.
	* mknod.test: Update.

2016-04-26  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

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

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

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

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

2016-04-26  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of statfs family syscalls.
	Fix decoders of fstatfs, fstatfs64, statfs, and statfs64 syscalls
	by rewriting them using mpers infrastructure.

	* fetch_struct_statfs.c: New file.
	* fstatfs.c: Likewise.
	* fstatfs64.c: Likewise.
	* print_statfs.c: Likewise.
	* statfs.h: Likewise.
	* statfs64.c: Likewise.
	* statfs.c: Remove everything except SYS_FUNC(statfs).
	* configure.ac: Remove the check for struct statfs64 in <sys/vfs.h>.
	Add checks for struct statfs and struct statfs64 in <asm/statfs.h>.
	Add checks for f_frsize and f_flags members of these structures.
	* defs.h (struct strace_statfs): New forward declaration.
	(print_struct_statfs, print_struct_statfs64): New prototypes.
	* Makefile.am (libstrace_a_SOURCES): Add fstatfs.c, fstatfs64.c,
	statfs.c, and statfs64.c.
	(strace_SOURCES): Add fetch_struct_statfs.c, print_statfs.c,
	and statfs.h.
	* NEWS: Mention this fix.
	* tests/fstatfs.c: New file.
	* tests/fstatfs64.c: Likewise.
	* tests/statfs64.c: Likewise.
	* tests/xstatfs.c: Likewise.
	* tests/xstatfs64.c: Likewise.
	* tests/xstatfsx.c: Likewise.
	* tests/fstatfs.test: New test.
	* tests/fstatfs64.test: Likewise.
	* tests/statfs64.test: Likewise.
	* tests/statfs.c: Rewrite using xstatfs.c.
	* tests/statfs.test: Update.
	* tests/.gitignore: Add fstatfs, fstatfs64, and statfs64.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add  fstatfs.test, fstatfs64.test, and statfs64.test.
	(EXTRA_DIST): Add xstatfs.c, xstatfs64.c, and xstatfsx.c.

2016-04-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add printflags function to libtests.
	* tests/printflags.c: New file.
	* tests/tests.h (printflags): New prototype.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.

2016-04-26  Dmitry V. Levin  <ldv@altlinux.org>

	Move definition of struct xlat to a separate header file.
	Define struct xlat in a separate file so that it could be used later by
	tests without inclusion of defs.h header file.

	* defs.h (struct xlat, XLAT, XLAT_END): Move ...
	* xlat.h: ... here.
	* Makefile.am (strace_SOURCES): Add xlat.h.

2016-04-25  Dmitry V. Levin  <ldv@altlinux.org>

	alpha: decode osf_statfs64 and osf_fstatfs64 syscalls.
	* linux/alpha/syscallent.h (osf_statfs64, osf_fstatfs64): Set nargs
	and handler.

2016-04-25  Dmitry V. Levin  <ldv@altlinux.org>

	alpha: fix decoding of osf_statfs and osf_fstatfs syscalls.
	Do not attempt to print struct osf_statfs as if it was the same as
	struct statfs.  Since struct osf_statfs has never been decoded properly,
	it is probably too late to implement a decoder, so let's just print the
	pointer.

	* statfs.c [ALPHA] (SYS_FUNC(osf_statfs), SYS_FUNC(osf_fstatfs)): Move ...
	* alpha.c: ... here.  Replace printstatfs with printaddr.

2016-04-25  Dmitry V. Levin  <ldv@altlinux.org>

	statfs: print f_flags field only when ST_VALID flag is set.
	* statfs.c (print_statfs_flags): New function.
	(printstatfs, printstatfs64, printcompat_statfs64): Use it.
	* xlat/statfs_flags.in (ST_VALID): Move to the head of the list.
	* tests/statfs.expected: Update.

2016-04-25  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

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

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

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

2016-04-25  Dmitry V. Levin  <ldv@altlinux.org>

	statfs: decode f_flags field of struct statfs.
	* xlat/statfs_flags.in: New file.
	* statfs.c: Include "xlat/statfs_flags.h".
	(printstatfs) [_STATFS_F_FLAGS]: Print statbuf.f_flags as flags.
	(printstatfs64) [_STATFS_F_FLAGS]: Likewise.
	(printcompat_statfs64): Likewise.
	* tests/statfs.expected: Update.

2016-04-25  Zev Weiss  <zev@bewilderbeest.net>

	statfs: don't quote f_type macro names.
	* statfs.c (sprintfstype): Don't add double-quotes to fs magic macros.
	* tests/statfs.expected: Remove double-quotes.

2016-04-25  Dmitry V. Levin  <ldv@altlinux.org>

	tests/shmxt.c: robustify against arch specific issues.
	Do not treat failed shmat(SHM_RND) as a test failure.
	This change partially reverts commit
	bea707377d2ee3e1950bfa43537ef928163a5fa6.

	* tests/shmxt.c (main): Use SHM_RND in the second shmat call,
	do not treat its potential error as a test failure.

2016-04-23  Dmitry V. Levin  <ldv@altlinux.org>

	Rename PRI__s64 to PRI__d64.
	As PRI__*64 macros mirror PRI*64 macros from inttypes.h, follow the
	principle of least astonishment and name these macros the same way.

	* defs.h (PRI__s64): Rename to PRI__d64.

2016-04-23  Dmitry V. Levin  <ldv@altlinux.org>

	Fix old_mmap output when mmap arguments are unfetchable.
	* mem.c (SYS_FUNC(old_mmap)): Use umove_or_printaddr instead of umoven
	to fetch mmap arguments, return RVAL_DECODED when umove_or_printaddr
	fails.
	* tests/old_mmap.c (main): Check it.

2016-04-22  Dmitry V. Levin  <ldv@altlinux.org>

	aarch64: fix old_mmap output for arm personality.
	* mem.c (SYS_FUNC(old_mmap)) [AARCH64]: Fetch mmap arguments
	as 32-bit integers.

	Define old_mmap parser only on architectures that use it.
	* mem.c (SYS_FUNC(old_mmap)): Define only on AARCH64, ARM, I386, X86_64,
	X32, M68K, S390, and S390X.

2016-04-22  Dmitry V. Levin  <ldv@altlinux.org>

	tests: extend test coverage of mmap syscall.
	Check decoding of "old mmap" edition of mmap syscall
	on those architectures that define it.

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

2016-04-22  Dmitry V. Levin  <ldv@altlinux.org>

	tests: extend test coverage of mincore syscall.
	* tests/mincore.c (print_mincore): New function.
	(test_mincore): Use it.  Check mincore with invalid vec address.
	Check mincore with length argument not a multiple of the page size.
	(main): Check with DEFAULT_STRLEN pages.

2016-04-22  Dmitry V. Levin  <ldv@altlinux.org>

	Move parsers of sync_file_range and sync_file_range2 syscalls to libstrace
	For each given architecture only one of these two syscalls has a
	syscallent entry.  When each parser is placed into a separate file,
	moving to libstrace ensures that only one of them that is need
	is linked into strace executable.

	* sync_file_range.c (SYS_FUNC(sync_file_range2)): Move ...
	* sync_file_range2.c: ... here.
	* Makefile.am (strace_SOURCES): Move sync_file_range.c ...
	(libstrace_a_SOURCES): ... here.  Add sync_file_range2.c.
	(strace_SOURCES_c): Add filtered libstrace_a_SOURCES.

2016-04-22  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of clock_adjtime syscall.
	* tests/clock_adjtime.c: New file.
	* tests/clock_adjtime.test: New test.
	* tests/.gitignore: Add clock_adjtime.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add clock_adjtime.test.

2016-04-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: do not include <assert.h> unnecessarily.
	Automatically change tests/*.c files using the following script:

	for f in tests/*.c; do
		grep -q '\<assert(' "$f" ||
			sed -i '/# *include *<assert\.h>/d' "$f"
	done

2016-04-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: do not include <errno.h> unnecessarily.
	Automatically change tests/*.c files using the following script:

	for f in tests/*.c; do
		grep -Fv errno.h "$f" |
		grep -Ewq '(si_)?errno|SOCK_FILTER_DENY_SYSCALL' ||
			sed -i '/# *include *<errno\.h>/d' "$f"
	done

2016-04-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests/xetpriority.c: print syscall() result using %ld format.

	tests/xetpgid.c: print syscall() result using %ld format.

	tests/xchownx.c: use errno2name.

	tests/userfaultfd.c: stop using assert.

	tests/unlinkat.c: print syscall() result using %ld format.

	tests/umount.c: use errno2name.

	tests/truncate64.c: cleanup.
	* tests/truncate64.c (main): Use errno2name, stop using assert.

	tests/truncate.c: cleanup.
	* tests/truncate.c (main): Use errno2name, stop using assert.

	tests/tee.c: stop using assert.

	tests/syslog.c: use errno2name.

	tests/sync_file_range2.c: stop using assert.

	tests/sync_file_range.c: stop using assert.

	tests/symlinkat.c: cleanup.

	tests/swap.c: cleanup.
	* tests/swap.c (error_msg): Remove.
	(main): Use errno2name.

	tests/splice.c: stop using assert.

	tests/setugid.c: cleanup.

	tests/sethostname.c: use errno2name.

	tests/setgroups.c: use errno2name.
	* tests/setgroups.c (errno2str): Remove.
	(main): Use errno2name.

	tests/seccomp-strict.c: cleanup.
	* tests/seccomp-strict.c (main): Use errno2name, stop using assert.

	tests/seccomp-filter.c: cleanup.
	* tests/seccomp-filter.c (main): Use errno2name, stop using assert.

	tests/sched_xetscheduler.c: print syscall() result using %ld format.

	tests/sched_xetparam.c: print syscall() result using %ld format.

	tests/renameat.c: print syscall() result using %ld format.

	tests/rename.c: print syscall() result using %ld format.

	tests/readv.c: cleanup.

	tests/pwritev.c: use errno2name.

	tests/preadv-pwritev.c: cleanup.

	tests/prctl-seccomp-strict.c: cleanup.
	* tests/prctl-seccomp-strict.c (main): Use errno2name,
	stop using assert.

	tests/openat.c: use errno2name.

	tests/open.c: use errno2name.

	tests/mlockall.c: cleanup.

	tests/mlock2.c: stop using assert.

	tests/mknod.c: print syscall() result using %ld format.

	tests/mkdirat.c: print syscall() result using %ld format.

	tests/lseek.c: cleanup.
	* tests/lseek.c (main): Use errno2name, stop using assert.

	tests/llseek.c: cleanup.
	* tests/llseek.c (main): Use errno2name, stop using assert.

	tests/linkat.c: print syscall() result using %ld format.

	tests/iopl.c: use errno2name.

	tests/ioperm.c: use errno2name.

	tests/getgroups.c: use errno2name.
	* tests/getgroups.c (errno2str): Remove.
	(main): Use errno2name.

	tests/ftruncate64.c: cleanup.
	* tests/ftruncate64.c (main): Use errno2name, stop using assert.

	tests/ftruncate.c: cleanup.
	* tests/ftruncate.c (main): Use errno2name, stop using assert.

	tests/fsync.c: print syscall() result using %ld format.

	tests/flock.c: print syscall() result using %ld format.

	tests/file_handle.c: use errno2name.

	tests/fdatasync.c: print syscall() result using %ld format.

	tests/fchownat.c: use errno2name.

	tests/fchmodat.c: use errno2name.

	tests/fchmod.c: use errno2name.

	tests/faccessat.c: print syscall() result using %ld format.

	tests/epoll_wait.c: print syscall() result using %ld format.

	tests/epoll_ctl.c: print syscall() result using %ld format.

	tests/epoll_create1.c: cleanup.
	* tests/epoll_create1.c (main): Use errno2name, stop using assert.

	tests/epoll_create.c: print syscall() result using %ld format.

	tests/dup3.c: print syscall() result using %ld format.

	tests/dup2.c: print syscall() result using %ld format.

	tests/dup.c: cleanup.

	tests/creat.c: stop using sys/stat.h.

	tests/copy_file_range.c: stop using assert.

	tests/chroot.c: use errno2name.

	tests/aio.c: use errno2name.

	tests: cleanup acct.test.
	* tests/acct.c (main): Use errno2name, stop using assert,
	change sample file name.
	* tests/acct.test: Update.

	tests: use errno2name()
	Automatically change tests/*.c files using the following sed regexp:
	sed -i 's/errno == E[[:alnum:]]\+ ? "E[[:alnum:]]\+" : "E[[:alnum:]]\+"/errno2name()/g'

	tests/dup.c: include "tests.h"
	This is going to be necessary for the following commit.

2016-04-21  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

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

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

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

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

2016-04-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add errno2name function to libtests.
	Add a simple translator of errno to its name, so one could
	simply use errno2name() instead of complex expressions like
	errno == EINVAL ? "EINVAL" : "EFAULT".

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

2016-04-20  Dmitry V. Levin  <ldv@altlinux.org>

	hppa: rename ECANCELLED to ECANCELED.
	hppa seems to be the only architecture that defines ECANCELLED synonym
	for ECANCELED constant, other architectures just define ECANCELED.
	Change the way how this constant is printed on hppa to be in line
	with other architectures.

	* linux/hppa/errnoent.h [253]: Rename ECANCELLED to ECANCELED.

2016-04-20  Dmitry V. Levin  <ldv@altlinux.org>

	Remove parser of unimplemented timerfd syscall.
	timerfd syscall was introduced in v2.6.22-rc1, but in v2.6.25-rc1
	it was replaced by timerfd_* syscall family.

	* linux/avr32/syscallent.h (timerfd): Fix nargs.
	* linux/dummy.h (sys_timerfd): Add stub alias.
	* time.c (SYS_FUNC(timerfd)): Remove.

2016-04-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: workaround kernel bugs in seccomp-strict.test and prctl-seccomp-strict.test
	If kernel implementation of strict seccomp mode is buggy, test programs
	will be killed by SIGKILL.  This is a known problem at least on
	x32 and mips.  Skip affected tests if this is the case.

	This change partially revert commit 9c1a72cd3f3d52d573876ce474b620a5f141fb1b.

	* tests/seccomp-strict.c (main): Remove workaround for x32.
	* tests/prctl-seccomp-strict.c: Likewise.
	* tests/seccomp-strict.test: Skip the test if the test program
	has been killed by SIGKILL.
	* tests/prctl-seccomp-strict.test: Likewise.

2016-04-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests/shmxt.c: do not use SHM_RND, it is unreliable.
	* tests/shmxt.c (main): Do not set SHM_RND flag.

	tests/rt_sigpending.c: fix for systems where _NSIG > 16 * sizeof(long)
	* tests/rt_sigsuspend.c (iterate): Do not assume that size will be less
	than sizeof(long) on the second iteration.

	prctl-seccomp-strict.test: robustify against unrelated prctl invocations
	* tests/prctl-seccomp-strict.test: Filter out PR_GET_* prctl calls.

2016-04-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: adjust rt_sigpending to older kernels.
	With linux kernels older than v3.9-rc1, compat rt_sigpending syscall
	could fail with EFAULT in cases where on later kernels it succeeds.
	Adjust the test to handle both cases properly.

	* tests/rt_sigpending.c (iterate): Stop iterations if rt_sigpending
	failed with EFAULT.

2016-04-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: adjust readv/writev and preadv/pwritev tests to older kernels.
	With linux kernels older than v3.16-rc1, iovec based compat syscalls may
	return EINVAL in some cases where on later kernels they return EFAULT.
	Adjust tests to handle both cases properly.

	* tests/preadv-pwritev.c: Include <errno.h>.
	(main): Print either "EINVAL" or "EFAULT" depending on errno.
	* tests/pwritev.c: Likewise.
	* tests/readv.c: Likewise.

2016-04-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: remove obsolete non-strict uid tests.
	Recently added strict tests for uid/gid related syscalls
	made old uid tests obsolete.

	* tests/uid.awk: Remove.
	* tests/uid.c: Remove.
	* tests/uid.test: Remove.
	* tests/uid16.c: Remove.
	* tests/uid16.test: Remove.
	* tests/uid32.c: Remove.
	* tests/uid32.test: Remove.
	* tests/.gitignore: Remove uid, uid16, and uid32.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Remove uid.test, uid16.test, and uid32.test.
	(EXTRA_DIST): Remove uid.awk.

2016-04-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: extend test coverage of getuid/getgid family syscalls.
	Add strict tests for getuid, getuid32, getgid, getgid32, geteuid,
	geteuid32, getegid, and getegid32 syscalls.

	* tests/getegid.c: New file.
	* tests/getegid.test: New test.
	* tests/getegid32.c: New file.
	* tests/getegid32.test: New test.
	* tests/geteuid.c: New file.
	* tests/geteuid.test: New test.
	* tests/geteuid32.c: New file.
	* tests/geteuid32.test: New test.
	* tests/getgid.c: New file.
	* tests/getgid.test: New test.
	* tests/getgid32.c: New file.
	* tests/getgid32.test: New test.
	* tests/getuid.c: New file.
	* tests/getuid.test: New test.
	* tests/getuid32.c: New file.
	* tests/getuid32.test: New test.
	* tests/.gitignore: Add getuid, getuid32, getgid, getgid32, geteuid,
	* geteuid32, getegid, and getegid32.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add getegid.test, getegid32.test, geteuid.test,
	geteuid32.test, getgid.test, getgid32.test, getuid.test,
	and getuid32.test.

2016-04-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: extend test coverage of getresgid32 syscall.
	* tests/getresgid32.c: New file.
	* tests/getresgid32.test: New test.
	* tests/.gitignore: Add getresgid32.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add getresgid32.test.

	tests: extend test coverage of getresgid syscall.
	* tests/getresgid.c: New file.
	* tests/getresgid.test: New test.
	* tests/.gitignore: Add getresgid.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add getresgid.test.

	tests: extend test coverage of getresuid32 syscall.
	* tests/getresuid32.c: New file.
	* tests/getresuid32.test: New test.
	* tests/.gitignore: Add getresuid32.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add getresuid32.test.

	tests: extend test coverage of getresuid syscall.
	* tests/getresugid.c: New file.
	* tests/getresuid.c: New file.
	* tests/getresuid.test: New test.
	* tests/.gitignore: Add getresuid.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add getresuid.test.
	(EXTRA_DIST): Add getresugid.c.

2016-04-20  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

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

2016-04-20  Dmitry V. Levin  <ldv@altlinux.org>

	mips o32, powerpc, powerpc64: fix decoding of iopl syscall.
	* linux/mips/syscallent-o32.h (iopl): Fix nargs.
	* linux/powerpc/syscallent.h (iopl): Fix nargs and sys_func.
	* linux/powerpc64/syscallent.h (iopl): Likewise.

2016-04-20  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

2016-04-20  Dmitry V. Levin  <ldv@altlinux.org>

	Fix corner cases of getgroups and setgroups syscall decoders.
	* uid.c (print_groups): New function.
	(SYS_FUNC(setgroups), SYS_FUNC(getgroups)): Use it.
	Print first syscall argument using %u format.
	* tests/getgroups.c: New file.
	* tests/getgroups.test: New test.
	* tests/getgroups32.c: New file.
	* tests/getgroups32.test: New test.
	* tests/setgroups.c: New file.
	* tests/setgroups.test: New test.
	* tests/setgroups32.c: New file.
	* tests/setgroups32.test: New test.
	* tests/.gitignore: Add getgroups, getgroups32, setgroups,
	and setgroups32.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add getgroups.test, getgroups32.test,
	setgroups.test, and setgroups32.test.

	Cleanup setfsuid syscall decoder.
	* uid.c (SYS_FUNC(setfsuid)): Remove redundant check.

	tests: check decoding of setfsgid32 syscall.
	* tests/setfsgid32.c: New file.
	* tests/setfsgid32.test: New test.
	* tests/.gitignore: Add setfsgid32.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setfsgid32.test.

	tests: check decoding of setfsgid syscall.
	* tests/setfsugid.c: New file.
	* tests/setfsgid.c: New file.
	* tests/setfsgid.test: New test.
	* tests/.gitignore: Add setfsgid.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setfsgid.test.
	(EXTRA_DIST): Add setfsugid.c.

	tests: check decoding of setfsuid32 syscall.
	* tests/setfsuid32.c: New file.
	* tests/setfsuid32.test: New test.
	* tests/.gitignore: Add setfsuid32.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setfsuid32.test.

	tests: check decoding of setfsuid syscall.
	* tests/setfsugid.c: New file.
	* tests/setfsuid.c: New file.
	* tests/setfsuid.test: New test.
	* tests/.gitignore: Add setfsuid.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setfsuid.test.
	(EXTRA_DIST): Add setfsugid.c.

	tests: extend test coverage of setresgid32 syscall.
	* tests/setresgid32.c: New file.
	* tests/setresgid32.test: New test.
	* tests/.gitignore: Add setresgid32.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setresgid32.test.

	tests: extend test coverage of setresgid syscall.
	* tests/setresgid.c: New file.
	* tests/setresgid.test: New test.
	* tests/.gitignore: Add setresgid.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setresgid.test.

	tests: extend test coverage of setresuid32 syscall.
	* tests/setresuid32.c: New file.
	* tests/setresuid32.test: New test.
	* tests/.gitignore: Add setresuid32.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setresuid32.test.

	tests: extend test coverage of setresuid syscall.
	* tests/setresugid.c: New file.
	* tests/setresuid.c: New file.
	* tests/setresuid.test: New test.
	* tests/.gitignore: Add setresuid.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setresuid.test.
	(EXTRA_DIST): Add setresugid.c.

	tests: extend test coverage of setregid32 syscall.
	* tests/setregid32.c: New file.
	* tests/setregid32.test: New test.
	* tests/.gitignore: Add setregid32.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setregid32.test.

	tests: extend test coverage of setregid syscall.
	* tests/setregid.c: New file.
	* tests/setregid.test: New test.
	* tests/.gitignore: Add setregid.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setregid.test.

	tests: extend test coverage of setreuid32 syscall.
	* tests/setreuid32.c: New file.
	* tests/setreuid32.test: New test.
	* tests/.gitignore: Add setreuid32.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setreuid32.test.

	tests: extend test coverage of setreuid syscall.
	* tests/setreugid.c: New file.
	* tests/setreuid.c: New file.
	* tests/setreuid.test: New test.
	* tests/.gitignore: Add setreuid.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setreuid.test.
	(EXTRA_DIST): Add setreugid.c.

	tests: extend test coverage of setgid32 syscall.
	* tests/setgid32.c: New file.
	* tests/setgid32.test: New test.
	* tests/.gitignore: Add setgid32.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setgid32.test.

	tests: extend test coverage of setgid syscall.
	* tests/setgid.c: New file.
	* tests/setgid.test: New test.
	* tests/.gitignore: Add setgid.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setgid.test.

	tests: extend test coverage of setuid32 syscall.
	* tests/setuid32.c: New file.
	* tests/setuid32.test: New test.
	* tests/.gitignore: Add setuid32.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setuid32.test.

	tests: extend test coverage of setuid syscall.
	* tests/setugid.c: New file.
	* tests/setuid.c: New file.
	* tests/setuid.test: New test.
	* tests/.gitignore: Add setuid.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add setuid.test.
	(EXTRA_DIST): Add setugid.c.

2016-04-20  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

2016-04-20  Dmitry V. Levin  <ldv@altlinux.org>

	alpha: fix decoding of shmat syscall.
	On alpha, shmat syscall is known as osf_shmat.

	* linux/alpha/syscallent.h (osf_shmat): Fix sys_flags and sys_func.

2016-04-20  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

2016-04-18  Dmitry V. Levin  <ldv@altlinux.org>

	prctl-seccomp-filter-v.test: robustify against unrelated prctl invocations
	* tests/prctl-seccomp-filter-v.test: Filter out PR_GET_* prctl calls.

	Reported-by: Steve McIntyre <steve@einval.com>

2016-04-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests/pselect6.c: fix potential output mismatch.
	* tests/pselect6.c (main): In the last case of printing pselect6
	syscall, print the last argument the same way as in other cases.

	Reported-by: Steve McIntyre <steve@einval.com>

2016-04-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of fchown32 syscall.
	* tests/fchown32.c: New file.
	* tests/fchown32.test: New test.
	* tests/.gitignore: Add fchown32.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add fchown32.test.

	tests: check decoding of fchown syscall.
	* tests/fchown.c: New file.
	* tests/fchown.test: New test.
	* tests/.gitignore: Add fchown.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add fchown.test.

	tests: check decoding of lchown32 syscall.
	* tests/lchown32.c: New file.
	* tests/lchown32.test: New test.
	* tests/.gitignore: Add lchown32.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add lchown32.test.

	tests: check decoding of lchown syscall.
	* tests/lchown.c: New file.
	* tests/lchown.test: New test.
	* tests/.gitignore: Add lchown.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add lchown.test.

	tests: check decoding of chown32 syscall.
	* tests/chown32.c: New file.
	* tests/chown32.test: New test.
	* tests/.gitignore: Add chown32.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add chown32.test.

	tests: check decoding of chown syscall.
	* tests/chown.c: New file.
	* tests/chown.test: New test.
	* tests/xchownx.c: New file.
	* tests/.gitignore: Add chown.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add chown.test.
	(EXTRA_DIST): Add xchownx.c.

	Fix decoding of 16-bit uid_t/git_t.
	* uid.c (printuid): Always cast value to uid_t.

2016-04-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: move kernel uid overflow check to libtests.
	This code used in two different places, so move it to the library.

	* tests/overflowuid.c: New file.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.
	* tests/tests.h (check_overflowuid, check_overflowgid): New prototypes.
	* tests/uid.c (main): Use check_overflowuid.
	* tests/uid16.c (main): Likewise.

2016-04-12  Dmitry V. Levin  <ldv@altlinux.org>

	tests: skip seccomp-strict.test and prctl-seccomp-strict.test on x32.
	As x86_64 kernel does not support x32 syscall numbers in
	SECCOMP_MODE_STRICT, skip affected tests on x32.

	* tests/seccomp-strict.c (main) [__x86_64__ && __ILP32__]: Bail out
	using error_msg_and_skip.
	* tests/prctl-seccomp-strict.c: Likewise.

2016-04-12  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add seccomp-filter.test.
	* tests/seccomp-filter.c: New file.
	* tests/seccomp-filter.test: New test.
	* tests/.gitignore: Add seccomp-filter.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add seccomp-filter.test.

2016-04-12  Dmitry V. Levin  <ldv@altlinux.org>

	seccomp: fix decoding of sock_fprog and sock_filter structures.
	Always print struct sock_fprog.len.
	Fix printing of unfetchable elements in sock_filter array.
	Fix printing of large sock_filter arrays.

	* seccomp.c (decode_fprog): Rewrite into decode_seccomp_fprog and
	print_seccomp_fprog.
	(print_seccomp_filter): Replace decode_fprog with print_seccomp_fprog.
	* tests/prctl-seccomp-filter-v.c (main): Update.
	* tests/seccomp-filter-v.c: New file.
	* tests/seccomp-filter-v.test: New test.
	* tests/.gitignore: Add seccomp-filter-v.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add seccomp-filter-v.test.

2016-04-11  Dmitry V. Levin  <ldv@altlinux.org>

	seccomp: print SECCOMP_* and BPF_* constants in a more compact way.
	* seccomp.c (decode_bpf_code, decode_bpf_stmt): Replace " | " with "|".
	* tests/prctl-seccomp-filter-v.c: Update.

	tests: rename seccomp.test to prctl-seccomp-filter-v.test.
	* tests/.gitignore: Replace seccomp with prctl-seccomp-filter-v.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Replace seccomp.test with prctl-seccomp-filter-v.test.
	* tests/seccomp.c: Rename to tests/prctl-seccomp-filter-v.c.
	* tests/seccomp.test: Rename to tests/prctl-seccomp-filter-v.test.

	tests: add seccomp-strict.test.
	* tests/seccomp-strict.c: New file.
	* tests/seccomp-strict.test: New test.
	* tests/.gitignore: Add seccomp-strict.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add seccomp-strict.test.

	tests: add prctl-seccomp-strict.test.
	* tests/prctl-seccomp-strict.c: New file.
	* tests/prctl-seccomp-strict.test: New test.
	* tests/.gitignore: Add prctl-seccomp-strict.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add prctl-seccomp-strict.test.

	tests: bring lists back to the sorted order.

2016-04-10  Dmitry V. Levin  <ldv@altlinux.org>

	tests/epoll_create1.c: extend for the case of ENOSYS.
	* epoll_create1.c: Make the test work in case of epoll_create1
	returning ENOSYS.

	tests/epoll_ctl.c: extend epoll_ctl coverage.
	* tests/epoll_ctl.c (main): Check EPOLL_CTL_DEL decoding.  Check
	decoding of long int descriptors and NULL struct epoll_event pointer.

2016-04-09  Dmitry V. Levin  <ldv@altlinux.org>

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

2016-04-08  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

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

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

2016-04-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests/pread64-pwrite64.c: minor cleanup.
	* tests/pread64-pwrite64.c: Do not include <sys/uio.h>.

2016-04-07  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of swapon flags.
	* swapon.c (SYS_FUNC(swapon)): Print priority regardless
	of SWAP_FLAG_PREFER flag being set.
	* tests/swap.c (error_msg): Handle EINVAL.
	(main): Check decoding of swapon flags.

	tests/unlinkat.c: check AT_* decoding.
	* tests/unlinkat.c (main): Check decoding of AT_* constants.

	tests/linkat.c: check AT_* decoding.
	* tests/linkat.c (main): Check decoding of AT_* constants.

2016-04-06  Elliott Hughes  <enh@google.com>

	Improve decoding of Android's PR_SET_VMA prctl.
	Before:

	  prctl(0x53564d41 /* PR_??? */, 0, 0x7f8ab53000, 4096,
	        "atexit handlers") = 0

	After:

	  prctl(PR_SET_VMA, PR_SET_VMA_ANON_NAME, 0x7fa8cbd000, 4096,
	        "atexit handlers") = 0

	* prctl.c (SYS_FUNC(prctl)) [__ANDROID__]: Do not define PR_SET_VMA.
	* Hard-code PR_SET_VMA_ANON_NAME, the only current sub-option.
	* xlat/prctl_options.in: Add PR_SET_VMA.

2016-04-06  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

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

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

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

2016-04-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add sync_file_range.test and sync_file_range2.test.
	* configure.ac (AC_CHECK_FUNCS): Add sync_file_range.
	* tests/sync_file_range.c: New file.
	* tests/sync_file_range2.c: Likewise.
	* tests/sync_file_range.test: New test.
	* tests/sync_file_range2.test: Likewise.
	* tests/.gitignore: Add sync_file_range and sync_file_range2.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add sync_file_range.test and sync_file_range2.test.

2016-04-05  Dmitry V. Levin  <ldv@altlinux.org>

	Add default values for SYNC_FILE_RANGE_* constants.
	* xlat/sync_file_range_flags.in: Add default values.

2016-04-05  Elliott Hughes  <enh@google.com>

	Fix sync_file_range2 output.
	Before:

	  sync_file_range2(3SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE|
	    SYNC_FILE_RANGE_WAIT_AFTER|0xfffffff8, 0, 0, )

	After:

	  sync_file_range2(3, SYNC_FILE_RANGE_WAIT_BEFORE|SYNC_FILE_RANGE_WRITE|
	    SYNC_FILE_RANGE_WAIT_AFTER|0xfffffff8, 0, 0)

	* sync_file_range.c (SYS_FUNC(sync_file_range2)): Output the ", "
	in the right place.

2016-04-04  Dmitry V. Levin  <ldv@altlinux.org>

	Replace PF_* constants with AF_*
	AF_* constants appear to be more standardized, and in practice there's
	always a one to one relationship between AF_* and PF_*, so let's
	use AF_* instead of PF_*.

	* xlat/domains.in: Remove.
	* net.c: Do not define PF_UNSPEC.  Stop including "xlat/domains.h".
	Replace PF_* with AF_*.  Replace domains with addrfams.
	* tests/inet-cmsg.c: Replace PF_INET with AF_INET.
	* tests/net-yy-inet.c: Likewise.
	* tests/netlink_inet_diag.c: Likewise.
	* tests/net-accept-connect.c: Replace PF_LOCAL with AF_LOCAL.
	* tests/net-y-unix.c: Likewise.
	* tests/net-yy-unix.c: Likewise.
	* tests/netlink_unix_diag.c: Likewise.
	* tests/net.expected: Replace PF_ with AF_.

2016-04-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add read-write.test.
	* tests/read-write.c: New file.
	* tests/read-write.test: New test.
	* tests/.gitignore: Add read-write.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(DECODER_TESTS): Add read-write.test.

2016-04-02  Dmitry V. Levin  <ldv@altlinux.org>

	tests/pread64-pwrite64.test: extend dumpio coverage.
	* tests/pread64-pwrite64.c (dump_str, print_hex, test_dump):
	New functions.
	(main): Use them to test dumping of various data.
	* tests/pread64-pwrite64.test: Update.

	tests: add hexdump_memdup function to libtests.
	* tests/hexdump_strdup.c (hexdump_memdup): New function.
	(hexdump_strdup): Use it.
	* tests/tests.h (hexdump_memdup): New prototype.

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

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

	Fix printing of negative offsets in pread64 and pwrite64 syscalls.
	* io.c (SYS_FUNC(pread), SYS_FUNC(pwrite)): Print offset
	using %lld format string.
	* tests/pread64-pwrite64.c: New file.
	* tests/pread64-pwrite64.test: New test.
	* tests/.gitignore: Add pread64-pwrite64.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(pread64_pwrite64_CPPFLAGS): New variable.
	(DECODER_TESTS): Add pread64-pwrite64.

	tests/hexdump_strdup.c: add support for longer strings.
	* tests/hexdump_strdup.c (hexdump_strdup): Output extra space character
	before hexdumping of the 9th symbol.

	tests/preadv-pwritev.c: fix typo in error diagnostics.
	* tests/preadv-pwritev.c (main): Fix typo in error message.

2016-04-01  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

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

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

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

2016-04-01  Dmitry V. Levin  <ldv@altlinux.org>

	Consistently handle unsigned arguments of mmap* and remap_file_pages.
	Explicitly declare first 4 arguments of mmap* and all remap_file_pages
	arguments as unsigned to avoid potential sign extension issues.

	* mem.c (print_mmap, SYS_FUNC(remap_file_pages)): Assign syscall
	arguments to local variables of appropriate types.

2016-04-01  Dmitry V. Levin  <ldv@altlinux.org>

	Consistently handle 2nd and 3rd arguments of [gs]etsockopt as unsigned.
	The second (level) and third (optname) arguments of getsockopt and
	setsockopt syscalls are enums, so treat them consistently as enums:
	use "unsigned int" type to avoid potential sign extension issues.

	* net.c (print_sockopt_fd_level_name, print_getsockopt,
	print_setsockopt): Change type of "level" and "name" arguments
	from "int" to "unsigned int".

2016-04-01  Dmitry V. Levin  <ldv@altlinux.org>

	Add sentinel attribute to printxvals.
	* gcc_compat.h (ATTRIBUTE_SENTINEL): New macro.
	* defs.h (printxvals): Add ATTRIBUTE_SENTINEL.

	Cleanup parser of ptrace syscall.
	* process.c (print_user_offset_addr): New function for printing offset
	address in the tracee's USER area.
	(SYS_FUNC(ptrace)): Assign syscall arguments to local variables with
	appropriate types.  Print pid argument as int.  Use switch statement
	in the code that handles address argument.  Use print_user_offset_addr
	to print address in PTRACE_PEEKUSER and PTRACE_POKEUSER requests.

2016-03-31  Jeff Mahoney  <jeffm@suse.com>

	Define PRI__[uxs]64 macros to print __s64 and __u64 values.
	Rather than cast every __u64 or __s64 before printing,
	define printing helpers for those types directly.

	* defs.h (PRI__s64, PRI__u64, PRI__x64): New macros.

2016-03-31  Dmitry V. Levin  <ldv@altlinux.org>

	Implement dumping of preadv and pwritev syscalls.
	* syscall.c (dumpio): Add SEN_preadv and SEN_pwritev.
	* NEWS: Mention this.
	* tests/preadv-pwritev.c: New file.
	* tests/preadv-pwritev.test: New test.
	* tests/.gitignore: Add preadv-pwritev.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(preadv_pwritev_CPPFLAGS): New variable.
	(DECODER_TESTS): Add preadv-pwritev.

2016-03-30  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of preadv syscall in case of short read.
	* io.c (SYS_FUNC(preadv)): Call tprint_iov_upto instead
	of tprint_iov and specify syscall return value as a data size limit.
	* NEWS: Mention it.
	* tests/preadv.c (main): Add a test case for preadv short read.

	Fix printing of negative offsets in preadv and pwritev syscalls.
	* io.c (print_llu_from_low_high_val): Rename to
	print_lld_from_low_high_val, all callers changed.
	Print value as a signed integer.
	* tests/preadv.c: New file.
	* tests/preadv.test: New test.
	* tests/pwritev.c: New file.
	* tests/pwritev.test: New test.
	* tests/.gitignore: Add preadv and pwritev.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(preadv_CPPFLAGS, pwritev_CPPFLAGS): New variables.
	(DECODER_TESTS): Add preadv.test and pwritev.test.

	Fix printing of unreadable struct iovec.
	* io.c (tprint_iov_upto): If the first element of iovec array is
	unreadable, print its address without array markup.
	* tests/readv.c (main): Check it.

	tests: factor out a part common to many simply organized test scripts.
	* tests/init.sh (run_strace_match_diff): New function.
	* tests/acct.test: Rewrite using run_strace_match_diff.
	* tests/aio.test: Likewise.
	* tests/alarm.test: Likewise.
	* tests/chmod.test: Likewise.
	* tests/clock_nanosleep.test: Likewise.
	* tests/clock_xettime.test: Likewise.
	* tests/copy_file_range.test: Likewise.
	* tests/creat.test: Likewise.
	* tests/dup.test: Likewise.
	* tests/dup2.test: Likewise.
	* tests/dup3.test: Likewise.
	* tests/epoll_create1.test: Likewise.
	* tests/execveat-v.test: Likewise.
	* tests/execveat.test: Likewise.
	* tests/fchmod.test: Likewise.
	* tests/fcntl.test: Likewise.
	* tests/file_handle.test: Likewise.
	* tests/flock.test: Likewise.
	* tests/fork-f.test: Likewise.
	* tests/ftruncate.test: Likewise.
	* tests/ftruncate64.test: Likewise.
	* tests/getcwd.test: Likewise.
	* tests/getdents.test: Likewise.
	* tests/getdents64.test: Likewise.
	* tests/getrandom.test: Likewise.
	* tests/getrusage.test: Likewise.
	* tests/getxxid.test: Likewise.
	* tests/inet-cmsg.test: Likewise.
	* tests/init.sh: Likewise.
	* tests/membarrier.test: Likewise.
	* tests/mincore.test: Likewise.
	* tests/mknod.test: Likewise.
	* tests/mlock2.test: Likewise.
	* tests/mmsg.test: Likewise.
	* tests/nanosleep.test: Likewise.
	* tests/open.test: Likewise.
	* tests/openat.test: Likewise.
	* tests/pselect6.test: Likewise.
	* tests/readdir.test: Likewise.
	* tests/readlink.test: Likewise.
	* tests/readv.test: Likewise.
	* tests/recvmsg.test: Likewise.
	* tests/rename.test: Likewise.
	* tests/renameat.test: Likewise.
	* tests/rt_sigpending.test: Likewise.
	* tests/rt_sigprocmask.test: Likewise.
	* tests/rt_sigqueueinfo.test: Likewise.
	* tests/rt_sigsuspend.test: Likewise.
	* tests/rt_sigtimedwait.test: Likewise.
	* tests/rt_tgsigqueueinfo.test: Likewise.
	* tests/sched_get_priority_mxx.test: Likewise.
	* tests/sched_xetaffinity.test: Likewise.
	* tests/sched_xetparam.test: Likewise.
	* tests/sched_xetscheduler.test: Likewise.
	* tests/seccomp.test: Likewise.
	* tests/select.test: Likewise.
	* tests/sendfile.test: Likewise.
	* tests/sendfile64.test: Likewise.
	* tests/splice.test: Likewise.
	* tests/statx.sh: Likewise.
	* tests/sysinfo.test: Likewise.
	* tests/syslog.test: Likewise.
	* tests/tee.test: Likewise.
	* tests/time.test: Likewise.
	* tests/timer_create.test: Likewise.
	* tests/timer_xettime.test: Likewise.
	* tests/timerfd_xettime.test: Likewise.
	* tests/times-fail.test: Likewise.
	* tests/times.test: Likewise.
	* tests/truncate.test: Likewise.
	* tests/truncate64.test: Likewise.
	* tests/umask.test: Likewise.
	* tests/umount.test: Likewise.
	* tests/umount2.test: Likewise.
	* tests/userfaultfd.test: Likewise.
	* tests/vmsplice.test: Likewise.
	* tests/xet_robust_list.test: Likewise.
	* tests/xetitimer.test: Likewise.
	* tests/xetpgid.test: Likewise.
	* tests/xetpriority.test: Likewise.
	* tests/xettimeofday.test: Likewise.

	tests: introduce $NAME.
	* tests/init.sh (NAME): New variable, defined to ${ME_%.test}.
	(run_prog, match_awk, match_diff, match_grep): Replace ${ME_%.test}
	with $NAME.
	* tests/fcntl.test: Likewise.
	* tests/fstat.test: Likewise.
	* tests/mmap.test: Likewise.
	* tests/net-y-unix.test: Likewise.
	* tests/net-yy-inet.test: Likewise.
	* tests/net-yy-unix.test: Likewise.
	* tests/open.test: Likewise.
	* tests/openat.test: Likewise.
	* tests/poll.test: Likewise.
	* tests/ppoll.test: Likewise.
	* tests/readlink.test: Likewise.
	* tests/select.test: Likewise.
	* tests/statx.sh: Likewise.
	* tests/uname.test: Likewise.

2016-03-30  Dmitry V. Levin  <ldv@altlinux.org>

	tests: move definitions of $OUT and $ERR to init.sh.
	As virtually every test defines either one or both of OUT and ERR
	variables and these definitions are exactly the same, move definitions
	of these variables from individual tests to init.sh.

	* tests/init.sh (OUT, ERR): New variables.
	* tests/ipc.sh: Remove initialization of OUT variable.
	* tests/statx.sh: Likewise.
	* tests/*.test: Remove initialization of OUT and ERR variables.

2016-03-29  Dmitry V. Levin  <ldv@altlinux.org>

	tests: simplify sendfile.test and sendfile64.test.
	Use the executable itself for input by default.

	* tests/sendfile.c (main): Use av[0] instead of av[1] for input.
	* tests/sendfile64.c (main): Likewise.
	* tests/sendfile.test: Invoke run_prog without arguments.
	* tests/sendfile64.test: Likewise.

2016-03-29  Dmitry V. Levin  <ldv@altlinux.org>

	open.test, openat.test: lift /proc requirement.
	While -P option needs /proc to match descriptors, it does not use
	/proc to match pathnames.  As these tests do not need descriptor
	match, the /proc requirement can be safely lifted.

	* tests/open.test: Lift /proc/self/fd/ requirement.
	* tests/openat.test: Likewise.

2016-03-29  Dmitry V. Levin  <ldv@altlinux.org>

	quotactl: add decoding of Q_GETNEXTQUOTA and Q_XGETNEXTQUOTA.
	* quota.c (if_nextdqblk): New structure.
	(decode_cmd_data): Handle Q_GETNEXTQUOTA and Q_XGETNEXTQUOTA.

	Update Q_* constants.
	* xlat/quotacmds.in: Add Q_GETNEXTQUOTA and Q_XGETNEXTQUOTA introduced
	by linux kernel commits v4.6-rc1~65^2~9^2~5 and v4.6-rc1~65^2~9^2~6.

	Update CLONE_* constants.
	* xlat/clone_flags.in: Rename CLONE_STOPPED to CLONE_NEWCGROUP.
	The former was removed by linux kernel commit v2.6.38-rc1~217.
	The latter was introduced by linux kernel commit v4.6-rc1~67^2~8.

	Update BPF_MAP_TYPE_* constants.
	* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_PERCPU_HASH,
	BPF_MAP_TYPE_PERCPU_ARRAY, and BPF_MAP_TYPE_STACK_TRACE introduced by
	linux kernel commits v4.6-rc1~91^2~326^2~5, v4.6-rc1~91^2~326^2~4, and
	v4.6-rc1~91^2~212^2~1, respectively.

	Update SO_* constants.
	* xlat/sockoptions.in: Add SO_CNX_ADVICE introduced by linux kernel
	commit v4.6-rc1~91^2~176.

	Update SEGV_* constants.
	* xlat/sigsegv_codes.in: Add SEGV_PKUERR introduced by linux kernel
	commit v4.6-rc1~68^2~23.

	avr32: wire up copy_file_range syscall.
	* linux/avr32/syscallent.h [325]: Add copy_file_range entry.

2016-03-28  JayRJoshi  <jay.r.joshi100@gmail.com>

	tests/uname.test: check abbreviated output, use print_quoted_string.
	* tests/uname.c (main): Use print_quoted_string to print
	utsname members.  Add abbrev check.
	* tests/uname.test: Add abbrev check.

2016-03-28  Dmitry V. Levin  <ldv@altlinux.org>

	faccessat.test: robustify against libcs invoking faccessat syscall on their own
	* tests/faccessat.c (TMP_FILE): Rename to sample, change its value
	to "faccessat.sample".
	* tests/faccessat.test: Rewrite using openat.test.

	openat.test: robustify against libcs invoking openat syscall on their own
	* tests/openat.c (main): Rename fname to sample, change its value
	to "openat.sample".
	* tests/openat.test: Use -P option to filter out openat syscalls
	made by libc and dynamic linker.

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

2016-03-27  Dmitry V. Levin  <ldv@altlinux.org>

	Update generic ioctl entries from linux 4.5.
	* linux/64/ioctls_inc.h: Update from linux v4.5 using ioctls_gen.sh.
	* linux/32/ioctls_inc_align32.h: Likewise.
	* linux/32/ioctls_inc_align64.h: Likewise.
	* NEWS: Mention this.

2016-03-26  Dmitry V. Levin  <ldv@altlinux.org>

	maint: update for linux 4.5.
	* maint/ioctls_sym.sh: Update workarounds for drm/*_drm.h files.
	Add workarounds for xen/gntdev.h and net/nfc/nci_core.h files.
	Update path of saa6588.h and exynos-fimc.h files.

2016-03-25  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of device numbers in mknod and mknodat syscalls.
	* mknod.c (decode_mknod): Treat device number argument as unsigned int.
	* tests/mknod.c: Include <sys/sysmacros.h> or <sys/mkdev.h>
	for definition of makedev macro.
	(main): Add a check for a character special file.

2016-03-25  Dmitry V. Levin  <ldv@altlinux.org>

	sparc64: fix decoding of mknod and mknodat syscalls for sparc personality
	Remove remnants of solaris personality support in mknod parser
	that resulted to sparc personality being decoded as old solaris
	personality.  This complements commit v4.10-45-gdf4dd8b and fixes
	commit v4.10-46-g588a90f.

	* mknod.c (decode_mknod) [SPARC || SPARC64]: Remove.

2016-03-25  Katerina Koukiou  <k.koukiou@googlemail.com>

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

2016-03-25  Fei Jie  <feij.fnst@cn.fujitsu.com>

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

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

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

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

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

2016-03-23  JayRJoshi  <jay.r.joshi100@gmail.com>

	tests/scm_rights-fd.test: fix pathname regex.
	Pathname containing >, }, or non-printable characters was resulting
	in failing of the test.

	* tests/scm_rights-fd.test: Fix pathname regex and simplify things.

2016-03-24  Dmitry V. Levin  <ldv@altlinux.org>

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

	tests: add strace-ttt.test.
	* tests/strace-ttt.test: New test.
	* tests/Makefile.am (MISC_TESTS): Add it.

	tests: add strace-tt.test.
	* tests/strace-tt.test: New test.
	* tests/Makefile.am (MISC_TESTS): Add it.

	tests: add strace-t.test.
	* tests/strace-t.test: New test.
	* tests/Makefile.am (MISC_TESTS): Add it.

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

2016-03-23  Dmitry V. Levin  <ldv@altlinux.org>

	tests: split out tests of specific decoders.
	Split TESTS into three groups: tests of specific decoders, libunwind
	tests, and all other tests.

	* tests/Makefile.am (TESTS): Move attach-f-p.test, attach-p-cmd.test,
	bexecve.test, count-f.test, count.test, detach-running.test,
	detach-sleeping.test, detach-stopped.test, dumpio.test,
	filter-unavailable.test, fork-f.test, ksysent.test, opipe.test,
	pc.test, qual_syscall.test, redirect.test, restart_syscall.test,
	strace-f.test, and vfork-f.test to MISC_TESTS.
	Move remaining tests except $(LIBUNWIND_TESTS) to DECODER_TESTS.
	Add $(DECODER_TESTS) and $(MISC_TESTS).

2016-03-23  JayRJoshi  <jay.r.joshi100@gmail.com>

	tests: add getcwd.test.
	* tests/getcwd.c: New file.
	* tests/getcwd.test: New test.
	* tests/.gitignore: Add getcwd.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add getcwd.test.

	tests: add print_quoted_string function to libtests.
	* tests/tests.h (print_quoted_string): New prototype.
	* tests/print_quoted_string.c: New file.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.

2016-03-17  Fei Jie  <feij.fnst@cn.fujitsu.com>

	tests: add xetpriority.test.
	* resource.c (SYS_FUNC(getpriority), SYS_FUNC(setpriority)): Print
	the second syscall argument using %d format.
	* tests/xetpriority.c: New file.
	* tests/xetpriority.test: New test.
	* tests/.gitignore: Add xetpriority.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add xetpriority.test.

2016-03-15  Fei Jie  <feij.fnst@cn.fujitsu.com>

	tests: add flock.test.
	* tests/flock.c: New file.
	* tests/flock.test: New test.
	* tests/.gitignore: Add flock.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add flock.test.

	tests: add sched_xetscheduler.test.
	* tests/sched_xetscheduler.c: New file.
	* tests/sched_xetscheduler.test: New test.
	* tests/.gitignore: Add sched_xetscheduler.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add sched_xetscheduler.test.

2016-03-15  Dmitry V. Levin  <ldv@altlinux.org>

	alpha: fix SOCK_DIAG_BY_FAMILY tests.
	This complements commit v4.9-368-g301c65c.

	* tests/netlink_inet_diag.c (check_responses): Align "buf"
	on sizeof(long) boundary.
	* tests/netlink_unix_diag.c (check_responses): Likewise.

2016-03-14  Dmitry V. Levin  <ldv@altlinux.org>

	Update EPOLL* constants.
	* xlat/epollevents.in: Add EPOLLWAKEUP and EPOLLEXCLUSIVE.

2016-03-12  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add count-f.test.
	* tests/count-f.c: New file.
	* tests/count-f.expected: Likewise.
	* tests/count-f.test: New test.
	* tests/.gitignore: Add count-f.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(count_f_LDADD): New variable.
	(EXTRA_DIST): Add count-f.expected.
	(TESTS): Add count-f.test.

2016-02-21  Dmitry V. Levin  <ldv@altlinux.org>

	hppa: wire up copy_file_range syscall.
	* linux/hppa/syscallent.h [346]: Add copy_file_range entry.

2016-03-11  Fei Jie  <feij.fnst@cn.fujitsu.com>

	tests: filter strace output in uname test.
	* tests/uname.test: Use uniq to filter strace output.

2016-03-10  Fei Jie  <feij.fnst@cn.fujitsu.com>

	tests: add sched_xetparam.test.
	* tests/sched_xetparam.c: New file.
	* tests/sched_xetparam.test: New test.
	* tests/.gitignore: Add sched_xetparam.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add sched_xetparam.test.

	tests: add sched_get_priority_mxx.test.
	* tests/sched_get_priority_mxx.c: New file.
	* tests/sched_get_priority_mxx.test: New test.
	* tests/.gitignore: Add sched_get_priority_mxx.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add sched_get_priority_mxx.test.

	tests: add dup.test, dup2.test, and dup3.test.
	* tests/dup.c: New file.
	* tests/dup.test: New test.
	* tests/dup2.c: New file.
	* tests/dup2.test: New test.
	* tests/dup3.c: New file.
	* tests/dup3.test: New test.
	* tests/.gitignore: Add dup, dup2, and dup3.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add dup.test, dup2.test, and dup3.test.

2016-03-10  Fabien Siron  <fabien.siron@epita.fr>

	tests: add fchmod.test.
	* tests/fchmod.c: New file.
	* tests/fchmod.test: New test.
	* tests/.gitignore: Add fchmod.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add fchmod.test.

2016-03-09  Fei Jie  <feij.fnst@cn.fujitsu.com>

	tests: add acct.test.
	* tests/acct.c: New file.
	* tests/acct.test: New test.
	* tests/.gitignore: Add acct.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add acct.test.

2016-03-07  Anchit Jain  <anchitjain1234@gmail.com>

	tests: add chmod.test.
	* tests/chmod.c: New file.
	* tests/chmod.test: New test.
	* tests/.gitignore: Add chmod.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add chmod.test.

2016-03-05  Nahim El Atmani  <naam@lse.epita.fr>

	Reduce memory usage while managing tcbs allocation.
	* strace.c (init):  Remove initial memory allocation for tcbtab.
	(expand_tcbtab): Do initial memory allocation when tcbtabsize == 0.

	Reviewed-By: Gabriel Laskar <gabriel@lse.epita.fr>
	Reported-by: haris iqbal <haris.phnx@gmail.com>

2016-03-01  Fei Jie  <feij.fnst@cn.fujitsu.com>

	tests: add umask.test.
	* tests/umask.c: New file.
	* tests/umask.test: New test.
	* tests/.gitignore: Add umask.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add umask.test.

	tests: add rename.test.
	* tests/rename.c: New file.
	* tests/rename.test: New test.
	* tests/.gitignore: Add rename.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add rename.test.

	tests: add uname.test.
	* tests/uname.c: New file.
	* tests/uname.test: New test.
	* tests/.gitignore: Add uname.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add uname.test.

2016-02-20  Dmitry V. Levin  <ldv@altlinux.org>

	mips: wire up copy_file_range syscall.
	* linux/mips/syscallent-n32.h [6324]: Add copy_file_range entry.
	* linux/mips/syscallent-n64.h [5320]: Likewise.
	* linux/mips/syscallent-o32.h [4360]: Likewise.

2016-02-19  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add rt_sigsuspend.test.
	* tests/rt_sigsuspend.c: New file.
	* tests/rt_sigsuspend.test: New test.
	* tests/.gitignore: Add rt_sigsuspend.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add rt_sigsuspend.test.

	Print pid_t arguments of rt_sigqueueinfo and rt_tgsigqueueinfo as int.
	* signal.c (SYS_FUNC(rt_sigqueueinfo)): Print first syscall argument
	using %d format.
	(SYS_FUNC(rt_tgsigqueueinfo)): Print first and second syscall arguments
	using %d format.
	* tests/rt_tgsigqueueinfo.c: New file.
	* tests/rt_tgsigqueueinfo.test: New test.
	* tests/.gitignore: Add rt_tgsigqueueinfo.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add rt_tgsigqueueinfo.test.

	getrusage.test: fix build on x32.
	* tests/getrusage.c: Include <stdint.h>
	(main): Print members of struct timeval using %ju format.

2016-02-19  Dmitry V. Levin  <ldv@altlinux.org>

	getrusage.test: check that getrusage parser does not access extra memory
	Place struct rusage at the end of an allocated memory page followed by
	an inaccessible page.

	* tests/getrusage.c (main): Use tail_alloc.

2016-02-19  Fei Jie  <feij.fnst@cn.fujitsu.com>

	tests: add getrusage.test.
	* tests/getrusage.c: New file.
	* tests/getrusage.test: New test.
	* tests/.gitignore: Add getrusage.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add getrusage.test.

2016-02-19  Dmitry V. Levin  <ldv@altlinux.org>

	Print rt_sigtimedwait return value as a signal name.
	* signal.c (SYS_FUNC(rt_sigtimedwait)): Decode return value.
	* tests/rt_sigtimedwait.c: New file.
	* tests/rt_sigtimedwait.test: New test.
	* tests/.gitignore: Add rt_sigtimedwait.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add rt_sigtimedwait.test.

	tests: add rt_sigprocmask.test.
	* tests/rt_sigprocmask.c: New file.
	* tests/rt_sigprocmask.test: New test.
	* tests/.gitignore: Add rt_sigprocmask.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add rt_sigprocmask.test.

	Fix corner cases of rt_sigpending syscall decoder.
	* signal (print_sigset_addr_len_limit): New function, cloned from
	print_sigset_addr_len with added minimal length argument.
	Treat length less than minimal length or greater than NSIG/8 as invalid.
	Do not align length to 4-byte boundary.  Align destination buffer
	to 4-byte boundary and initialize it with zeroes so that subsequent
	call to sprintsigmask_n will not access uninitialized data.
	(print_sigset_addr_len): Turn into a wrapper around
	print_sigset_addr_len_limit with current_wordsize
	as a minimal length argument.
	(SYS_FUNC(rt_sigpending)): Call print_sigset_addr_len_limit
	instead of print_sigset_addr_len with 1 as a minimal length argument.
	* tests/rt_sigpending.c: New file.
	* tests/rt_sigpending.test: New test.
	* tests/.gitignore: Add rt_sigpending.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add rt_sigpending.test.

2016-02-19  Dmitry V. Levin  <ldv@altlinux.org>

	Change unix_diag requests back to use full dump instead of exact match.
	Unfortunately, 64-bit linux kernel has a bug in matching inode numbers
	greater than INT_MAX, so unix_diag exact match is not reliable.

	This partially reverts commit 69bfc89770152033d4aa0bc5673fc46e65d89838.

	* socketutils.c (unix_send_query): Add NLM_F_DUMP to nlmsg_flags,
	remove initialization of udiag_cookie.
	* tests/netlink_unix_diag.c (send_query): Remove "inode" argument,
	add NLM_F_DUMP to nlmsg_flags, remove initialization of udiag_ino
	and udiag_cookie.
	(check_responses): Remove "inode" argument and its use.
	(main): Remove invocation of inode_of_sockfd and passing of listening
	socket inode to send_query and check_responses.

2016-02-19  Michael Shigorin  <mike@altlinux.org>

	tests: avoid using cpp -dD.
	-dD is less portable across some peculiar preprocessors.

	tests/Makefile.am (ksysent.h): Use cpp -dM instead of cpp -dD.

2016-02-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add poll.test.
	* tests/poll.c: New file.
	* tests/poll.test: New test.
	* tests/.gitignore: Add poll.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add poll.test.

	Fix abbreviated output of poll and ppoll decoders.
	* poll.c (decode_poll_entering, decode_poll_exiting): Fix corner cases
	of abbreviated output.
	* tests/ppoll-v.expected: Update.
	* tests/ppoll.expected: Update.
	* tests/ppoll.test: Update.

	Print unfetchable address in poll and ppoll decoders.
	* poll.c (decode_poll_entering): Replace umove call with
	umove_or_printaddr.
	(decode_poll_exiting): Print unfetchable address when umove call fails.

	Print offsets in lseek and _llseek syscalls as signed integers.
	* lseek.c (SYS_FUNC(lseek)): Print offset using %lld format.
	(SYS_FUNC(llseek)): Likewise.  Treat high and low components of offset
	as unsigned long integers.
	* tests/llseek.c (main): Check that negative offset is printed properly.
	* tests/lseek.c (main): Likewise.

2016-02-14  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add xetpgid.test.
	* tests/xetpgid.c: New file.
	* tests/xetpgid.test: New test.
	* tests/.gitignore: Add xetpgid.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add xetpgid.test.

	tests: add alarm.test.
	* tests/alarm.c: New file.
	* tests/alarm.test: New test.
	* tests/.gitignore: Add alarm.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add alarm.test.

	Replace printargs_lu and printargs_ld with printargs_u and printargs_d.
	* defs.h (printargs_lu): Rename to printargs_u.
	(printargs_ld): Rename to printargs_d.
	* syscall.c (printargs_lu): Rename to printargs_u.  Replace %lu with %u.
	(printargs_ld): Rename to printargs_d.  Replace %ld with %d.
	* linux/dummy.h (sys_getpgrp): Change to printargs.
	(sys_alarm): Change to printargs_u.
	(sys_getpgid, sys_getsid, sys_nice, sys_setpgid, sys_setpgrp,
	sys_timer_delete, sys_timer_getoverrun): Change to printargs_d.

	Change printargs_lu and printargs_ld to return RVAL_DECODED.
	* syscall.c (printargs_lu, printargs_ld): Return RVAL_DECODED.

	redirect.test: fix the way how strace output is discarded.
	* tests/redirect.test: Disable tracing of syscalls, signals,
	and exit status instead of redirecting strace output to /dev/null.

	tests: extend coverage of struct iovec arrays.
	* tests/readv.c (main): Check decoding of empty, inaccessible,
	and partially inaccessible iovec arrays.
	* tests/readv.test: Update.

	Implement dumping of vmsplice syscall.
	* syscall.c (dumpio): Add SEN_vmsplice.
	* NEWS: Mention this.
	* tests/vmsplice.c: New file.
	* tests/vmsplice.test: New test.
	* tests/.gitignore: Add vmsplice.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add vmsplice.test.

	tests: add tee.test.
	* tests/tee.c: New file.
	* tests/tee.test: New test.
	* tests/.gitignore: Add tee.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add tee.test.

	Fix printing of negative offsets in splice syscall.
	* io.c (SYS_FUNC(splice)): Use PRId64 instead of PRIu64 for printing
	offsets.
	* tests/splice.c: New file.
	* tests/splice.test: New test.
	* tests/.gitignore: Add splice.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add splice.test.

	Implement copy_file_range syscall decoding.
	* copy_file_range.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* linux/32/syscallent.h (copy_file_range): New entry.
	* linux/64/syscallent.h: Likewise.
	* linux/arm/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/sparc64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* pathtrace.c (pathtrace_match): Add SEN_copy_file_range.
	* NEWS: Mention new syscall parser.
	* tests/copy_file_range.c: New file.
	* tests/copy_file_range.test: New test.
	* tests/.gitignore: Add copy_file_range.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add copy_file_range.test.

	Update fs *_MAGIC constants.
	* xlat/fsmagic.in: Add CGROUP2_SUPER_MAGIC and OVERLAYFS_SUPER_MAGIC.

	Update IPV6_* constants.
	* xlat/sockipv6options.in: Add IPV6_HDRINCL.

	Update SO_* constants.
	* xlat/sockoptions.in: Add SO_ATTACH_REUSEPORT_CBPF
	and SO_ATTACH_REUSEPORT_EBPF.

	Update MADV_* constants.
	* xlat/madvise_cmds.in: Add MAD_FREE.

2016-02-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify execve and execveat tests.
	* tests/execve.c (main): Use one page gap between two mapped regions
	for an address that is more likely to be not yet mapped.
	* tests/execveat.c (main): Likewise.

	tests: simplify execve test.
	* tests/execve.c (main): Simplify the test assuming that execve syscall
	never returns ENOSYS.

2016-02-13  Dmitry V. Levin  <ldv@altlinux.org>

	Fix numbers of syscall arguments in syscall tables.
	This semi-automatic change brings syscall tables in sync with kernel's
	include/linux/syscalls.h file.

	* linux/aarch64/syscallent.h (recv): Fix nargs.
	* linux/alpha/syscallent.h (sigaltstack, init_module,
	sched_getscheduler, settimeofday): Likewise.
	* linux/arm/syscallent.h (signal, pciconfig_iobase, msgrcv, msgctl,
	shmat, shmdt, shmctl, semtimedop, get_mempolicy, set_mempolicy,
	timerfd_create): Likewise.
	* linux/bfin/syscallent.h (signal, delete_module): Likewise.
	* linux/hppa/syscallent.h (init_module, munlockall, sched_getscheduler,
	io_cancel, set_tid_address, listxattr, llistxattr, flistxattr,
	removexattr, lremovexattr, fremovexattr): Likewise.
	* linux/i386/syscallent.h (signal, mmap): Likewise.
	* linux/ia64/syscallent.h (init_module, readv, writev,
	sched_getscheduler): Likewise.
	* linux/m68k/syscallent.h (signal, request_key): Likewise.
	* linux/microblaze/syscallent.h (signal, clone, fstatfs64, vmsplice):
	Likewise.
	* linux/mips/syscallent-n32.h (getpgid, statfs, fstatfs, init_module,
	delete_module): Likewise.
	* linux/mips/syscallent-n64.h (getpgid, statfs, fstatfs, init_module,
	delete_module): Likewise.
	* linux/mips/syscallent-o32.h (signal, statfs, fstatfs, ioperm,
	fstatfs64): Likewise.
	* linux/powerpc/syscallent.h (signal, spu_run, spu_create): Likewise.
	* linux/powerpc64/syscallent.h (signal, pread64, pwrite64, readahead,
	fadvise64, lookup_dcookie, spu_run, spu_create, sync_file_range2,
	fallocate, preadv, pwritev, fanotify_mark): Likewise.
	* linux/s390/syscallent.h (signal, mmap, lookup_dcookie, ipc): Likewise.
	* linux/s390x/syscallent.h (signal, ipc): Likewise.
	* linux/sh/syscallent.h (signal, ipc, munlockall, fstatfs64, vmsplice):
	Likewise.
	* linux/sh64/syscallent.h (signal, ipc, msgrcv, msgctl, shmat, shmdt,
	shmctl, fstatfs64, vmsplice): Likewise.
	* linux/sparc/syscallent.h (ptrace, dup, signal, ipc): Likewise.
	* linux/sparc64/syscallent.h (ptrace, dup, signal, pread64, pwrite64,
	readahead, lookup_dcookie, fadvise64, fadvise64_64, ipc,
	sync_file_range, fallocate, preadv, pwritev, fanotify_mark): Likewise.
	* linux/x32/syscallent.h (64:recvmsg): Likewise.
	* linux/xtensa/syscallent.h (mremap, futex, reboot, init_module,
	delete_module, request_key, getcpu, ioprio_set, ioprio_get, utimensat,
	futimesat, fchmodat, faccessat): Likewise.
	* NEWS: Mention this fix.

2016-02-13  Dmitry V. Levin  <ldv@altlinux.org>

	s390: decode fadvise64 and fadvise64_64.
	* linux/s390/syscallent.h (fadvise64): Set sys_func.
	(fadvise64_64): Set nargs and sys_func.

	mips n64: use the most optimal parser for fadvise64 syscall.
	* linux/mips/syscallent-n64.h (fadvise64): Replace SEN(fadvise64_64)
	with SEN(fadvise64).

	ia64: decode fstatfs64 and statfs64.
	* linux/ia64/syscallent.h (fstatfs64, statfs64): Set nargs and sys_func.

2016-02-13  Dmitry V. Levin  <ldv@altlinux.org>

	alpha, ia64, mips, sh, sh64: fix the number of pipe syscall arguments.
	On alpha, ia64, mips, sh, sh64, sparc, and sparc64 architectures
	pipe syscall does not take arguments.

	* linux/alpha/syscallent.h (pipe): Change nargs to 0.
	* linux/ia64/syscallent.h (pipe): Likewise.
	* linux/mips/syscallent-n32.h (pipe): Likewise.
	* linux/mips/syscallent-n64.h (pipe): Likewise.
	* linux/mips/syscallent-o32.h (pipe): Likewise.
	* linux/sh/syscallent.h (pipe): Likewise.
	* linux/sh64/syscallent.h (pipe): Likewise.

2016-02-13  Dmitry V. Levin  <ldv@altlinux.org>

	alpha, ia64, mips, sh*, sparc*: fix error path decoding of pipe syscall.
	* net.c (do_pipe) [HAVE_GETRVAL2]: Remove.
	Always call decode_pair_fd on exiting.
	(SYS_FUNC(pipe)) [HAVE_GETRVAL2]: Call printpair_fd instead of do_pipe.

	Fix pathtrace match for pipe2 syscall.
	* pathtrace.c (pathtrace_match): As pipe2 syscall has no descriptors
	or paths to test, move SEN_pipe2 to the appropriate category.

	avr32: wire up missing syscalls.
	* linux/avr32/syscallent.h [322..324]: Add userfaultfd, membarrier,
	and mlock2 entries.

2016-02-12  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check decoding of madvise, mlockall, mremap, and msync syscalls.
	* tests/mmap.c (main): Change output format from regexp to verbatim.
	Add tests for madvise, mlockall, mremap, and msync syscalls.
	* tests/mmap.test: Convert from match_grep to match_diff.
	Add madvise, mlockall, mremap, and msync syscalls to syscall filter.

2016-02-11  Dmitry V. Levin  <ldv@altlinux.org>

	Simplify decoding of waitpid and wait4 syscalls.
	* wait.c (printwaitn): Replace "n" and "bitness" integer arguments
	with a single print_rusage function pointer.  All callers updated.

	waitid: print pid argument as int.
	* wait.c (SYS_FUNC(waitid)): As the type of second syscall argument
	in the kernel is pid_t, print it as int.

	waitid: always print 5th argument.
	* wait.c (SYS_FUNC(waitid)): Do not check for tcp->s_ent->nargs
	as waitid syscall has 5 arguments.

	socketutils: add const qualifier to variables.
	* socketutils.c (cache_and_print_inode_details): Make "details"
	parameter const.
	(print_sockaddr_by_inode_cached): Make "e" variable const.
	(inet_send_query): Make struct nlmsghdr and struct inet_diag_req_v2
	members const.  Make "msg" variable const.
	(inet_parse_response): Make "data" parameter and diag_msg variable const.
	(receive_responses): Make "h" and "rc" variables const.
	(unix_send_query): Make struct nlmsghdr and struct unix_diag_req
	members const.  Make "msg" variable const.
	(unix_print): Make all parameters const.
	(print_sockaddr_by_inode): Make proto_name parameter const.

	print_sockaddr_by_inode: cleanup protocol lookup.
	* socketutils.c (tcp_v4_print, udp_v4_print, tcp_v6_print,
	udp_v6_print): New functions.
	(print_sockaddr_by_inode): Make "protocols" array static, replace
	"family" and "protocol" members with "print" in its underlying
	structure.  Iterate through protocols array when the protocol name
	is specified.

2016-02-09  Dmitry V. Levin  <ldv@altlinux.org>

	tests: check that -f -p attaches to threads properly.
	Check that -f -p attaches and follows all threads of the given pid.

	* tests/attach-f-p.c: New file.
	* tests/attach-f-p.test: New test.
	* tests/.gitignore: Add attach-f-p.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(attach_f_p_LDADD): New variable.
	(TESTS): Add attach-f-p.test.

2016-02-09  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce libstrace.a for potentially conditional compilation units.
	Some files are used conditionally depending on architecture and
	configuration.  Create a library for the purpose of keeping such
	compilation units.

	* Makefile.am (strace_LDADD, noinst_LIBRARIES): Add libstrace.a.
	(libstrace_a_CPPFLAGS): New variable, set to $(strace_CPPFLAGS).
	(libstrace_a_CFLAGS): New variable, set to $(strace_CFLAGS).
	(libstrace_a_SOURCES): New variable, set to upeek.c.
	* util.c (upeek): Move ...
	* upeek.c: ... here.

2016-02-08  Dmitry V. Levin  <ldv@altlinux.org>

	travis-ci: pass more gcov arguments to codecov.

	tests: extend coverage of struct itimerspec.
	* tests/timer_xettime.c (main): Check decoding of NULL struct itimerspec
	pointer.

	tests: extend coverage of utimensat syscall.
	* tests/utimensat.c (main): Check decoding of NULL struct timespec
	pointer.

	tests: extend coverage of time syscall.
	* tests/time.c (main): Check decoding of NULL time_t pointer.

	tests: extend coverage of struct sigevent.
	* tests/timer_create.c (main): Check decoding of NULL struct sigevent
	pointer.  Check decoding of invalid sigev_notify value.

2016-02-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests: extend coverage of execve and execveat syscalls.
	Check decoding of inaccessible or partially inaccessible arrays.

	* tests/execve-v.c: New file.
	* tests/execveat-v.c: Likewise.
	* tests/execve-v.test: New test.
	* tests/execveat-v.test: Likewise.
	* tests/execve.c: Rewrite.
	* tests/execveat.c: Likewise.
	* tests/execve.test: Likewise.
	* tests/execveat.test: Likewise.
	* tests/execve.expected: Remove.
	* tests/execve-v.expected: Likewise.
	* tests/execveat.expected: Likewise.
	* tests/execveat-v.expected: Likewise.
	* tests/.gitignore: Add execve-v and execveat-v.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add execve-v.test and execveat-v.test.
	(EXTRA_DIST): Remove execve.expected, execve-v.expected,
	execveat.expected, and execveat-v.expected.

2016-02-08  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of execve and execveat syscalls with invalid input.
	* execve.c (printargv): Fix decoding of inaccessible or partially
	inaccessible array.
	(printargc): Diagnose inaccessible or partially inaccessible array.
	(decode_execve, SYS_FUNC(execv)): Update printargv and printargc callers.

	tests: extend coverage of capget syscall.
	* tests/caps.c (main): Check decoding of inaccessible cap_user_header_t
	and/or cap_user_data_t.
	* tests/caps.awk: Update match patterns.
	* tests/caps.test: Update.

	tests: extend coverage of sched_getaffinity syscall.
	* tests/sched_xetaffinity.c (main): Check decoding of pointer
	to inaccessible cpu_set_t.

	tests: extend coverage of utime syscall.
	* tests/utime.c (main): Check decoding of NULL struct utimbuf pointer.
	Check decoding of struct utimbuf located at the end of page boundary.
	* tests/utime.test: Update.

	tests: extend coverage of sysinfo syscall.
	* tests/sysinfo.c (main): Check decoding of NULL struct sysinfo pointer.
	Check decoding of struct sysinfo located at the end of page boundary.
	* tests/sysinfo.test: Update.

	tests: extend coverage of adjtimex syscall.
	* tests/adjtimex.c (main): Check decoding of NULL struct timex pointer.
	Check decoding of struct timex located at the end of page boundary.
	* tests/adjtimex.test: Update.

	tests: check that strace does not retain stdin and stdout descriptors.
	* tests/redirect.test: New test.
	* tests/Makefile.am (TESTS): Add it.

	Create a dummy pipe descriptor instead of opening /dev/null.
	* strace.c (open_dev_null): Rename to open_dummy_desc.  All callers
	changed.  Create a pipe and return its first descriptor instead of
	opening /dev/null.

2016-02-08  Denys Vlasenko  <dvlasenk@redhat.com>

	If stdin/stdout aren't open on startup, open them to /dev/null.
	Otherwise, -oLOGFILE may end up using one of them. This conflicts
	with the previous change, which closes stdin/out in strace.

	* strace.c (init): If fcntl(F_GETFD) fails on stdin or stdout,
	sanitize them: open /dev/null and dup it until fds 0,1,2
	are all used up.

2016-02-08  Denys Vlasenko  <dvlasenk@redhat.com>

	Close stdin/out after child is forked.
	Testcase:

	{ sleep 1; yes | head -n99999; } | strace -o/dev/null sh -c 'exec <&-; sleep 9'

	The writer (head) will be able to perform writes to write end of the pipe.
	With strace call removed, head will immediately get SIGPIPE.

	This change fixes this: now writer immediately gets SIGPIPE with strace too.

	* strace.c (startup_child): Close stdin/out and reopen them to /dev/null.

2016-02-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add opipe.test.
	Check that -o |pipe_command works.  In particular, check that
	strace waits for completion of piped command.

	* tests/opipe.test: New test.
	* tests/Makefile.am (TESTS): Add it.

2016-02-05  Keith Owens  <kaos.ocs@gmail.com>

	strace-graph: print the pid in the graph.
	* strace-graph: Prefix each command with its pid.

	strace-graph: cope with clone immediately followed by exit.
	* strace-graph: A clone() followed by exit() with no intervening fork
	or execve resulted in the new pid having no seq key.  That breaks when
	trying to use seq as an array reference.  Ensure that clone populates
	the new pid with an empty seq entry.

	strace-graph: handle recent strace output.
	* strace-graph: Fix regex for --SIG.  Ignore '+++ exited with <n> +++'
	lines.  Handle exit_group syscall as well as _exit.

	strace-graph: handle strace -T.
	* strace-graph: Ignore extra ' <time.spent>' field added by strace -T.

	strace-graph: use "strict" and "warnings" pragmas.
	* strace-graph: Set "use strict" and "use warnings" options.  Fix errors
	detected by strict/warnings.  $result is really a string, it can be "-1"
	followed by an error text.

2016-02-04  Dmitry V. Levin  <ldv@altlinux.org>

	Add README.md file with links to build status and test coverage.

	travis-ci: prepare and submit test coverage report.

	tests: extend readlink and readlinkat coverage.
	* tests/readlink.c (PREFIX, TARGET, LINKPATH): New macros.
	(main): Allocate memory for string and buffer passed to the syscall
	being tested using tail_alloc mechanism.  Create and cleanup test
	symlink.  Test syscall error path output.  Print hexquoted strings
	using hexquote_strndup.
	* tests/readlinkat.c: Likewise.
	* tests/readlink.test: Remove creation and cleanup of test symlinks.

	tests: add hexquote_strndup function to libtests.
	* tests/tests.h (hexquote_strndup): New prototype.
	* tests/hexquote_strndup.c: New file.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.

	readlinkat.test: use readlink.test.
	* tests/readlink.test (syscall): Initialize from $0.
	* tests/readlinkat.test: Source readlink.test.

2016-02-04  Gabriel Laskar  <gabriel@lse.epita.fr>

	Add configure --enable-code-coverage option.
	* m4/ax_code_coverage.m4: New file.
	* configure.ac: Use AX_CODE_COVERAGE.
	* Makefile.am: Add @CODE_COVERAGE_RULES@.
	(CODE_COVERAGE_LCOV_OPTIONS, CODE_COVERAGE_GENHTML_OPTIONS,
	CODE_COVERAGE_IGNORE_PATTERN): New variables.
	(strace_CPPFLAGS): Add $(CODE_COVERAGE_CPPFLAGS).
	(strace_CFLAGS): Add $(CODE_COVERAGE_CFLAGS).
	(strace_LDADD): Add $(CODE_COVERAGE_LDFLAGS).
	* .gitignore: Add *.gcda and *.gcno.

2016-02-03  Dmitry V. Levin  <ldv@altlinux.org>

	Makefile.am: introduce strace_CFLAGS and derivatives.
	* Makefile.am (strace_CFLAGS): New variable, set to $(AM_CFLAGS).
	(libmpers_CFLAGS): New variable, set to $(strace_CFLAGS).
	(libmpers_m32_a_CFLAGS, libmpers_mx32_a_CFLAGS): New variables,
	set to $(libmpers_CFLAGS).

	Makefile.am: use strace_CPPFLAGS consistently.
	* Makefile.am (libmpers_CPPFLAGS): Replace $(AM_CPPFLAGS)
	with $(strace_CPPFLAGS).

2016-02-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: replace net-fd.test with net-y-unix.test.
	Unlike the former test that was based on match_grep,
	the new one uses match_diff and does more rigorous testing.

	* tests/net-y-unix.c: New file.
	* tests/net-y-unix.test: New test.
	* tests/net-fd.test: Remove.
	* tests/net-fd.expected: Remove.
	* tests/.gitignore: Add net-y-unix.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Replace net-fd.test with net-y-unix.test.
	(net-fd.log): Remove.
	(EXTRA_DIST): Remove net-fd.expected.

2016-02-03  Dmitry V. Levin  <ldv@altlinux.org>

	Implement caching of print_sockaddr_by_inode.
	As -yy parser, compared to -y, needs to do at least 5 extra syscalls
	(getxattr, socket, sendmsg, recvmsg, close) to print socket details,
	caching results of netlink conversations between strace and kernel
	noticeably reduces amount of system time spent by strace.

	The caching is safe since sockets do not change their addresses after
	successful bind or connect syscall.

	* defs.h (string_quote, print_sockaddr_by_inode_cached): New prototypes.
	* socketutils.c (cache_entry): New type.
	(CACHE_SIZE, CACHE_MASK): New macros.
	(cache): New static array.
	(cache_and_print_inode_details): New static function.
	(print_sockaddr_by_inode_cached): New function.
	(inet_parse_response, unix_parse_response): Use
	cache_and_print_inode_details.
	* util.c (printfd): Use string_quote and print_sockaddr_by_inode_cached.
	(string_quote): Remove static qualifier.
	* NEWS: Mention this improvement.
	* tests/unix-yy.c (main): Update.

2016-02-03  Dmitry V. Levin  <ldv@altlinux.org>

	Change unix_diag requests to use exact match instead of full dump.
	* socketutils.c (unix_send_query): Remove NLM_F_DUMP from nlmsg_flags,
	initialize udiag_cookie.
	* tests/netlink_unix_diag.c (send_query): Remove "family" and "proto"
	arguments, add "inode" argument, remove NLM_F_DUMP from nlmsg_flags,
	initialize udiag_ino and udiag_cookie.
	(check_responses): Add "inode" argument, check inode match.
	(main): Pass listening socket inode to send_query and check_responses.

	Robustify netlink response parsers.
	* socketutils.c (inet_parse_response, unix_parse_response): Change
	return type from bool to int, return -1 on all parse errors except
	inode mismatch.
	(receive_responses): Stop on the first nlmsg_type that is not
	SOCK_DIAG_BY_FAMILY, also stop when the parser returns -1.
	* tests/netlink_inet_diag.c (check_responses): Stop on short messages,
	on first nlmsg_type that is not SOCK_DIAG_BY_FAMILY, print more verbose
	diagnostics for NLMSG_ERROR.
	* tests/netlink_unix_diag.c (check_responses): Likewise.

	inet_parse_response: add a safety check.
	* socketutils.c (inet_parse_response): Check that netlink message
	is large enough to contain a inet_diag_msg structure.

	receive_responses: avoid potential hangup.
	* socketutils.c (receive_responses): Pass MSG_DONTWAIT to recvmsg after
	the first recvmsg call to avoid potential hangup.

2016-02-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: replace net-yy.test with net-yy-inet.test.
	Unlike the former test that was based on match_awk,
	the new one uses match_diff and does more rigorous testing.

	* tests/net-yy-inet.c: New file.
	* tests/net-yy-inet.test: New test.
	* tests/net-yy.test: Remove.
	* tests/net-yy-accept.awk: Remove.
	* tests/net-yy-connect.awk: Remove.
	* tests/inet-accept-connect-send-recv.c: Remove.
	* tests/.gitignore: Replace inet-accept-connect-send-recv
	with net-yy-inet.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Replace net-yy.test with net-yy-inet.test.
	(EXTRA_DIST): Remove net-yy-accept.awk and net-yy-connect.awk.

2016-02-03  Dmitry V. Levin  <ldv@altlinux.org>

	tests: replace unix-yy.test with net-yy-unix.test.
	Unlike the former test that was based on match_awk,
	the new one uses match_diff and does more rigorous testing.

	* tests/net-yy-unix.c: New file.
	* tests/net-yy-unix.test: New test.
	* tests/unix-yy.test: Remove.
	* tests/unix-yy-accept.awk: Remove.
	* tests/unix-yy-connect.awk: Remove.
	* tests/.gitignore: Add net-yy-unix.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Replace unix-yy.test with net-yy-unix.test.
	(EXTRA_DIST): Remove unix-yy-accept.awk and unix-yy-connect.awk.

2016-02-02  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add inode_of_sockfd function to libtests.
	* tests/tests.h (inode_of_sockfd): New prototype.
	* tests/inode_of_sockfd.c: New file.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.

	unix_parse_response: add a safety check.
	* socketutils.c (unix_parse_response): Check that netlink message
	is large enough to contain a unix_diag_msg structure.

2016-01-29  Dmitry V. Levin  <ldv@altlinux.org>

	Fixed decoding of mincore syscall's last argument.
	* mem.c (SYS_FUNC(mincore)): Print only those bytes of the vector
	that were written by the kernel.
	* NEWS: Mention this fix.
	* tests/mincore.c: New file.
	* tests/mincore.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add mincore.
	(TESTS): Add mincore.test.
	* tests/.gitignore: Add mincore.

2016-01-23  Dmitry V. Levin  <ldv@altlinux.org>

	Move fallback -yy socket print from printfd to print_sockaddr_by_inode.
	* util.c (printfd): In -yy mode, move fallback print of proto:[inode] ...
	* socketutils.c (to print_sockaddr_by_inode): ... here.

2016-01-22  Dmitry V. Levin  <ldv@altlinux.org>

	Implement simultaneous use of -p option and tracing of a command.
	* strace.c (init): Allow -p option along with a command.
	(startup_child): In -D mode, record the parent of the tracer process
	as strace_child.
	(startup_attach): Save trace_tracer_pid before -D mode fork.
	When tracing a command in -f mode, do not check for the command's
	threads as it has no threads at this moment.
	Never attach to the tracer process.
	In -D mode, never attach to the parent of the tracer process,
	terminate that process only once at the end of startup_attach,
	and reset strace_child.
	* strace.1: Document that -p option can be used along with tracing
	of a command.
	* NEWS: Mention it.
	* tests/attach-p-cmd-cmd.c: New file.
	* tests/attach-p-cmd-p.c: Likewise.
	* tests/attach-p-cmd.test: New test.
	* tests/.gitignore: Add attach-p-cmd-cmd and attach-p-cmd-p.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	(TESTS): Add attach-p-cmd.test.

	This fixes Debian bug #549942.

2016-01-22  Dmitry V. Levin  <ldv@altlinux.org>

	strace.1: fix format of -P description.
	* strace.1 (-P): Write trailing using regular font.

2016-01-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use local nanosleep based sleep utility replacement.
	* tests/sleep.c: New file.
	* tests/.gitignore: Add sleep.
	* tests/Makefile.am (check_PROGRAMS): Likewise.
	* tests/count.test: Use it instead of system sleep utility.

	tests: add error_msg_and_fail function to libtests.
	* tests/tests.h (error_msg_and_fail): New prototype.
	* tests/error_msg.c (error_msg_and_fail): New function.

2016-01-20  Dmitry V. Levin  <ldv@altlinux.org>

	Fix dumping of recvmmsg syscall in case of short read.
	* net.c (dumpiov_in_mmsghdr): Call dumpiov_upto instead of dumpiov,
	pass data size limit to dumpiov_upto.
	* NEWS: Mention this fix.
	* tests/mmsg.c (main): Update.

	Fix dumping of recvmsg syscall in case of short read.
	* defs.h (dumpiov_in_msghdr): Add unsigned long argument.
	* net.c (dumpiov_in_msghdr): Add data_size argument.  Call dumpiov_upto
	instead of dumpiov, pass data_size to dumpiov_upto.
	* syscall.c (dumpio): Pass data size limit to dumpiov_in_msghdr.
	* NEWS: Mention this fix.
	* tests/recvmsg.c: New file.
	* tests/recvmsg.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add recvmsg.
	(TESTS): Add recvmsg.test.
	* tests/.gitignore: Add recvmsg.

	Fix decoding and dumping of readv syscall in case of short read.
	* defs.h (dumpiov_upto): New prototype.
	(dumpiov): Change to a wrapper around dumpiov_upto.
	* util.c (dumpiov): Rename to dumpiov_upto, add and check data_size
	argument.
	* io.c (SYS_FUNC(readv)): Call tprint_iov_upto instead
	of tprint_iov and specify syscall return value as a data size limit.
	* syscall.c (dumpio): In case of SEN_readv, call dumpiov_upto instead
	of dumpiov and specify syscall return value as a data size limit.
	* NEWS: Mention this fix.
	* tests/readv.c: New file.
	* tests/readv.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add readv.
	(TESTS): Add readv.test.
	* tests/.gitignore: Add readv.

	tests/tests.h: add ARRAY_SIZE and LENGTH_OF macros.
	* tests/tests.h (ARRAY_SIZE, LENGTH_OF): New macros.
	* tests/aio.c (ARRAY_SIZE): Remove.
	* tests/mmsg.c (LENGTH_OF): Remove.

	tests: add hexdump_strdup function to libtests.
	* tests/tests.h (hexdump_strdup): New prototype.
	* tests/hexdump_strdup.c: New file.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.

	tests: add tprintf function to libtests.
	* tests/tests.h (tprintf): New prototype.
	* tests/tprintf.c: New file.
	* tests/Makefile.am (libtests_a_SOURCES): Add it.
	* tests/mmsg.c: Use tprintf.

2016-01-19  Dmitry V. Levin  <ldv@altlinux.org>

	quotactl: add Q_XGETQSTATV command decoding.
	* quota.c (fs_qfilestatv, fs_quota_statv): New structures.
	(decode_cmd_data): Handle Q_XGETQSTATV case.

	quotactl: add decoding of if_dqinfo.dqi_flags constants.
	* xlat/if_dqinfo_flags.in: New file.
	* quota.c: Include "xlat/if_dqinfo_flags.h".
	(decode_cmd_data): Print struct if_dqinfo.dqi_flags using printflags.

	quotactl: consistenly decode all write and unknown commands on entering.
	* quota.c (decode_cmd_data): Change return type to int.
	Return 0 on entering Q_GETQUOTA, Q_V1_GETQUOTA, Q_V2_GETQUOTA,
	Q_XGETQUOTA, Q_GETFMT, Q_GETINFO, Q_V2_GETINFO, Q_V1_GETSTATS,
	Q_V2_GETSTATS, and Q_XGETQSTAT commands, return RVAL_DECODED
	for any other command.
	(SYS_FUNC(quotactl)): On entering, print third argument of any command.
	For any command except Q_QUOTAON and Q_V1_QUOTAON, call decode_cmd_data
	and forward its return value.

	quotactl: fix Q_QUOTAON command decoding.
	* quota.c (SYS_FUNC(quotactl)): Print Q_QUOTAON 4th argument as a path.

	quotactl: print third argument as unsigned int.
	* quota.c (SYS_FUNC(quotactl)): Consistently print the third
	argument using "%u" format.

	quotactl: fix Q_XQUOTAOFF command decoding.
	* quota.c (decode_cmd_data): Print xfs quota flags argument.

	quotactl: fix Q_GETFMT and Q_XQUOTAON commands decoding.
	* quota.c (decode_cmd_data): As quota format value and xfs quota flags
	are in-memory constants, print it like an array of one element instead
	of a structure.

2016-01-17  Dmitry V. Levin  <ldv@altlinux.org>

	Update quotactl constants.
	* xlat/quota_formats.in: Add QFMT_OCFS2 and QFMT_VFS_V1.
	* xlat/quotacmds.in: Add Q_XGETQSTATV.
	* xlat/quotatypes.in: Add PRJQUOTA.
	* xlat/xfs_quota_flags.in: Add FS_QUOTA_PDQ_ACCT and FS_QUOTA_PDQ_ENFD.

2016-01-19  Dmitry V. Levin  <ldv@altlinux.org>

	Replace u_int{8,16,32,64} with uint{8,16,32,64}
	* util.c: Replace u_int{32,64} with uint{32,64}.
	* quota.c: Replace u_int{8,16,32,64} with uint{8,16,32,64}.

	Move definitions of quotactl constants to xlat files.
	* quota.c (Q_*): Move to xlat/quotacmds.in.
	(USRQUOTA, GRPQUOTA): Move to xlat/quotatypes.in.
	(QFMT_VFS_OLD, QFMT_VFS_V0): Move to xlat/quota_formats.in.
	(XFS_QUOTA_*): Move to xlat/xfs_quota_flags.in.
	(XFS_*_QUOTA): Move to xlat/xfs_dqblk_flags.in.
	(QIF_*): Move to xlat/if_dqblk_valid.in.
	(IIF_*): Move to xlat/if_dqinfo_valid.in.

2016-01-15  Dmitry V. Levin  <ldv@altlinux.org>

	llseek.test: robustify against libcs invoking _llseek syscall on their own
	* tests/llseek.test: Filter out _llseek calls made with non-negative
	descriptor arguments.

	lseek.test: robustify against libcs invoking lseek syscall on their own.
	* tests/lseek.test: Filter out lseek calls made with non-negative
	descriptor arguments.

2016-01-14  Dmitry V. Levin  <ldv@altlinux.org>

	mmsg.test: fix regression introduced by commit v4.11-138-g6e815ce.
	This fixes the test on platforms where both __NR_sendmmsg and
	HAVE_SENDMMSG are defined but the former is not implemented by the
	kernel and the second is implemented as an indirect syscall.

	* tests/mmsg.c (LENGTH_OF): New macro.
	(send_mmsg, recv_mmsg): Print expected output in case of ENOSYS.
	(main): Redirect stdout to a new descriptor.  Use LENGTH_OF.
	Print expected output.
	* tests/mmsg.test: Update.
	* tests/mmsg.expected: Remove.
	* tests/Makefile.am (EXTRA_DIST): Remove mmsg.expected.

2016-01-13  Dmitry V. Levin  <ldv@altlinux.org>

	aio.test: check memory access by aio decoders.
	* tests/aio.c (main): Place all objects passed to io_* syscalls
	at the end of memory pages followed by inaccessible pages.

2016-01-13  Dmitry V. Levin  <ldv@altlinux.org>

	s390, s390x: fix printing of syscalls unknown to the kernel.
	On s390/s390x, syscalls with NR up to 255 can be implemented
	directly using "svc NR", for NR >= 256 "svc 0" with %r1=NR is used.
	The latter method is allowed for NR < 256, too.

	When the syscall number specified directly or indirectly is recognized
	by the kernel, i.e. it is less than its NR_syscalls value, it is stored
	in %r2 and is available to arch_get_scno via s390_regset.gprs[2].
	For syscall numbers >= NR_syscalls this register is set to 0,
	but %r1 remains unchanged and could be used by arch_get_scno
	via s390_regset.gprs[1] to decide what the syscall number is.

	* linux/s390/get_scno.c (arch_get_scno): If s390_regset.gprs[2] is zero,
	take syscall number from s390_regset.gprs[1].
	* NEWS: Mention this fix.

	This fixes Debian bug #485979 and Fedora bug #1298294.

2016-01-13  Dmitry V. Levin  <ldv@altlinux.org>

	s390, s390x: print all syscall arguments for syscall number 0.
	* linux/s390/syscallent.h [0]: Set nargs to MA.
	* linux/s390x/syscallent.h: Likewise.

	mips o32: alias sys_syscall to printargs.
	* linux/dummy.h (sys_syscall): Alias to printargs.
	* syscall.c [LINUX_MIPSO32] (SYS_FUNC(syscall)): Remove.

2016-01-13  Dmitry V. Levin  <ldv@altlinux.org>

	travis-ci: update build matrix.
	Add clang-3.6/x86_64, clang-3.6/x86, and musl-gcc/x86_64 to the matrix.

	* .travis.yml (compiler): Add gcc, clang-3.6, and musl-gcc.
	(env): Add matrix, remove global ENABLE_GCC_WERROR.
	(matrix): Add exclude, remove include.
	* travis-ci.sh: Add support for clang and musl-gcc.
	Use --enable-gcc-Werror for gcc build unconditionally.

2016-01-13  Dmitry V. Levin  <ldv@altlinux.org>

	mpers.awk: add support for DWARF files generated by clang.
	* mpers.awk: Define default_pointer_size.  Initialize byte_size
	for DW_TAG_pointer_type to default_pointer_size.  Set parent
	for DW_TAG_member only.  Handle DW_AT_count as an alternative
	to DW_AT_upper_bound.

2016-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	configure.ac: reorder some statements for better readability.
	* configure.ac: Sort and group together AC_PROG_*, AC_C_*, AC_TYPE_*,
	AC_HEADER_*, AC_CHECK_FUNCS, AC_CHECK_TYPES, AC_CHECK_MEMBERS,
	and AC_CHECK_HEADERS.

	scm_rights-fd.test: rewrite without fork.
	* tests/scm_rights.c (main): Rewrite without fork.
	Place all objects passed to sendmsg and recvmsg at the end
	of memory pages followed by inaccessible pages.
	* tests/scm_rights-fd.test: Update.

	tests: fix clang "duplicate 'const' declaration specifier" warnings.
	* tests/ksysent.c (pstr_t): Remove second const specifier.
	* tests/mmsg.c (main): Remove second const specifier from one[], two[],
	and three[].

	tests/times.c: fix clang compilation warning.
	* tests/times.c (main): Initialize dummy variable.

2016-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	tests/mmsg.c: fix build on rhel6/ppc.
	There are weird platforms that define __NR_sendmmsg but at the same time
	do not define __NR_recvmmsg.  Add a workaround for them.

	* configure.ac (AC_CHECK_FUNCS): Add recvmmsg.
	* tests/mmsg.c: Check for __NR_recvmmsg || HAVE_RECVMMSG.

2016-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	s390: fix sigreturn decoding on recent kernels.
	Linux kernel commit v4.3-rc1-50-g8d4bd0e corrected uc_sigmask
	of the compat signal frame, so remove the old workaround.

	* linux/s390/arch_sigreturn.c (arch_sigreturn) [S390]: Remove.

2016-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	Update PTRACE_* constants.
	* ptrace.h (PTRACE_SECCOMP_GET_FILTER): Define.
	* xlat/ptrace_cmds.in: Add PTRACE_SECCOMP_GET_FILTER.

2016-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	Fix struct sigevent decoding for musl.
	Do not rely on "struct sigevent.__pad" being located at the same address
	as "struct sigevent.sigev_notify_thread_id", it's not the case with musl
	libc.  Do not rely on struct sigevent definition at all to access
	sigev_notify_thread_id.

	* configure.ac (AC_CHECK_MEMBERS): Remove struct sigevent._sigev_un._pad
	and struct sigevent.__pad.
	* sigevent.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* print_sigevent.c: Include it.
	* print_sigevent.c (struct_sigevent): Remove.
	(print_sigevent): Update all struct_sigevent users.
	* tests/timer_create.c: Include "sigevent.h".
	(main): Use struct_sigevent instead of struct sigevent,
	all struct sigevent clients changed.

2016-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	syscall.c: include <signal.h>
	All users of NSIG macro must include <signal.h>.
	This complements commit v4.10-184-g0e946ab.

	* syscall.c: Include <signal.h>.

2016-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	signal.c: fix musl libc compilation warning.
	musl libc defines SIGRTMAX to a function that returns signed int,
	which obviously makes gcc -Wsign-compare unhappy.

	* signal.c (signame): Cast ASM_SIGRTMAX to unsigned int.

2016-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix TEST_SYSCALL_{NR,STR} and STRUCT_STAT_STR macros for musl.
	The contents of TEST_SYSCALL_NAME and STRUCT_STAT macros was subject
	to macro expansion when used in definitions of TEST_SYSCALL_NR,
	TEST_SYSCALL_STR, and STRUCT_STAT_STR macros.

	As some libcs, e.g. musl libc, define lfs64 names as macros
	(stat64 as stat, lstat64 as lstat, etc.), this might result to incorrect
	expansion of TEST_SYSCALL_NR, TEST_SYSCALL_STR, and STRUCT_STAT_STR
	macros.  To avoid this problem, define these macros directly and remove
	TEST_SYSCALL_NAME macro.

	* tests/_newselect.c (TEST_SYSCALL_NAME): Remove.
	(TEST_SYSCALL_NR, TEST_SYSCALL_STR): New macros.
	* tests/fcntl.c: Likewise.
	* tests/fcntl64.c: Likewise.
	* tests/fstat.c: Likewise.
	* tests/fstatat64.c: Likewise.
	* tests/lstat.c: Likewise.
	* tests/newfstatat.c: Likewise.
	* tests/select.c: Likewise.
	* tests/stat.c: Likewise.
	* tests/fstat64.c (TEST_SYSCALL_NAME): Remove.
	(TEST_SYSCALL_NR, TEST_SYSCALL_STR, STRUCT_STAT_STR): New macros.
	* tests/lstat64.c: Likewise.
	* tests/stat64.c: Likewise.
	* tests/fstatx.c (TEST_SYSCALL_NR, nrify, nrify_): Remove.
	* tests/lstatx.c: Likewise.
	* tests/struct_flock.c (TEST_SYSCALL_NR, TEST_SYSCALL_STR, nrify,
	nrify_, stringify, stringify_): Remove.
	* tests/xselect.c: Likewise.
	* tests/xstatx.c: Check TEST_SYSCALL_STR instead of TEST_SYSCALL_NAME.
	(STRUCT_STAT_STR, TEST_SYSCALL_STR, stringify, stringify_): Remove.
	[!STRUCT_STAT] (STRUCT_STAT_STR): New macro.

2016-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	tests/struct_flock.c: fix musl libc compilation warnings.
	The size of off_t is not something one can rely upon.  For example,
	musl libc unconditionally defines it as an int64_t type on x86.
	A cast to the target type helps to avoid these libc differences.

	* configure.ac: Call AC_C_TYPEOF.
	* tests/struct_flock.c (TYPEOF_FLOCK_OFF_T): New macro.
	(test_flock_einval): Use it instead of off_t.

2016-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	tests/inet-cmsg.c: fix musl libc compilation warnings.
	The types that are used to define msg_namelen member of struct msghdr
	and cmsg_len member of struct cmsghdr differ between libcs.
	For example, glibc defines them as size_t, while musl libc - as type
	socklen_t.  Print these fields using %lu format to avoid issues caused
	by libc differences.

	* tests/inet-cmsg.c (main): Cast mh.msg_controllen and c->cmsg_len
	to unsigned long and print them using %lu format.

2016-01-11  Dmitry V. Levin  <ldv@altlinux.org>

	aio.test: include <fcntl.h> instead of <sys/fcntl.h>
	* tests/aio.c: Include <fcntl.h> instead of <sys/fcntl.h>.

	mmsg.test: check memory access by sendmmsg and recvmmsg decoders.
	* tests/tests.h (tail_memdup): New prototype.
	* tests/tail_alloc.c (tail_memdup): New function.
	* tests/mmsg.c (main): Place all objects passed to sendmmsg and recvmmsg
	at the end of memory pages followed by inaccessible pages.

	mmsg.test: check decoding of flags passed to sendmmsg and recvmmsg.
	* tests/mmsg.c (main): Pass MSG_DONTROUTE|MSG_NOSIGNAL to sendmmsg.
	Pass MSG_DONTWAIT to recvmmsg.
	* tests/mmsg.expected: Update.

2016-01-11  Dmitry V. Levin  <ldv@altlinux.org>

	mmsg.test: prefer direct sendmmsg/recvmmsg syscalls to libc wrappers.
	* tests/mmsg.c: Include <sys/syscall.h>.
	Check for __NR_sendmmsg as an alternative to HAVE_SENDMMSG.
	[!HAVE_STRUCT_MMSGHDR] (struct mmsghdr): Define.
	(send_mmsg, recv_mmsg): New functions.
	(main): Use them instead of sendmmsg and recvmmsg.

	Reported-by: Szabolcs Nagy <nsz@port70.net>

2016-01-10  Dmitry V. Levin  <ldv@altlinux.org>

	sigreturn.test: use RT_5 signal number instead of RT_2.
	Make the test compatible with musl libc that uses RT_2 internally.

	* tests/sigreturn.c (main): Replace RT_2 with RT_5.
	* tests/sigreturn.test: Likewise.

	Reported-by: Szabolcs Nagy <nsz@port70.net>

2016-01-10  Dmitry V. Levin  <ldv@altlinux.org>

	avr32: wire up accept4 syscall.
	* linux/avr32/syscallent.h [321]: Add accept4 entry.

2016-01-09  Dmitry V. Levin  <ldv@altlinux.org>

	sparc64: fix names of {s,g}etres{u,g}id syscalls.
	* linux/sparc64/syscallent.h [108 ... 111]: Use sparc64 syscall names.

	sparc64: remove sparc32 syscall entries.
	* linux/sparc64/syscallent.h [31, 32, 35, 44, 53, 56, 69, 70, 72, 77,
	82, 84, 87, 89, 91, 94, 112, 115, 155, 231]: Unassign.

	sparc: remove sparc64 syscall entries.
	* linux/sparc/syscallent.h [52, 163]: Unassign.

	sparc64: clone syscallent.h from sparc.
	* linux/sparc64/syscallent.h: Clone from linux/sparc/syscallent.h.

	sparc: fix mlock2 sysentry, wire up bind, listen, and setsockopt syscalls
	* linux/sparc/syscallent.h [353]: Move mlock2 entry to 356.
	[353, 354, 355]: Add bind, listen, and setsockopt entries.
	* NEWS: Mention this.

2016-01-09  Dmitry V. Levin  <ldv@altlinux.org>

	tests: do not use settimeofday wrapper provided by libc.
	Workaround limitations of settimeofday wrapper provided by musl libc.

	* tests/xettimeofday.c (main): Call settimeofday using syscall().

	Reported-by: Szabolcs Nagy <nsz@port70.net>

2016-01-09  Dmitry V. Levin  <ldv@altlinux.org>

	ioctl.test: robustify against libcs invoking ioctl syscall on their own.
	* tests/ioctl.test: Filter out from the log ioctl calls with standard
	descriptor arguments.

	Reported-by: Szabolcs Nagy <nsz@port70.net>

2016-01-09  Dmitry V. Levin  <ldv@altlinux.org>

	alpha: enhance decoding of getxpid, getxuid, and getxgid syscalls.
	Print the second return value of getxpid, getxuid, and getxgid syscalls
	that return a pair of values using the same mechanism as pipe syscall.

	* alpha.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* linux/alpha/syscallent.h [20]: Change SEN(getpid) to SEN(getxpid).
	[24]: Change SEN(getuid) to SEN(getxuid).
	[47]: Change SEN(getgid) to SEN(getxgid).
	* NEWS: Mention this enhancement.
	* tests/uid.awk: Update for getxgid output change.
	* tests/uid.test: Cleanup.
	* tests/getxxid.c: New file.
	* tests/getxxid.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add getxxid.
	(TESTS): Add getxxid.test.
	* tests/.gitignore: Add getxxid.

2016-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	Cleanup parser of getpagesize syscall.
	* mem.c (SYS_FUNC(getpagesize)): Decode on entering syscall.

	alpha: alias getdtablesize to printargs.
	* linux/dummy.h [ALPHA] (sys_getdtablesize): Alias to printargs.
	* desc.c [ALPHA] (SYS_FUNC(getdtablesize)): Remove.

2016-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests: change text marker in fork-f and vfork-f tests.
	Use chdir syscalls instead of pwrite64 syscalls as a method of inserting
	text markers into strace output because the former are more portable.

	* tests/fork-f.c (logit): Rename to logit_. Use chdir instead of pwrite.
	(logit): New macro wrapper around logit_.
	(main): Update expected output.
	* tests/vfork-f.c: Likewise.
	* tests/fork-f.test: Update.

2016-01-07  Dmitry V. Levin  <ldv@altlinux.org>

	Fix printing of 32-bit times syscall return value on 64-bit architectures
	This change complements commit v4.9-359-gd93d9f8 by fixing
	RVAL_UDECIMAL case.
	The only syscall that appears to be affected is the times syscall.

	* syscall.c (trace_syscall_exiting): In case of RVAL_UDECIMAL,
	when current personality is 32-bit, print 32-bit return code.
	* NEWS: Mention this fix.

	Reported-by: Steve McIntyre <steve@einval.com>

2016-01-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests/vfork-f.c: support platforms without vfork.
	On some platforms, e.g. hppa glibc, vfork() is implemented using fork
	syscall, so the test cannot rely on the parent process remaining blocked
	until the child process either terminates or calls execve.

	* tests/vfork-f.c (main): Explicitly block the parent until the child
	either terminates or calls execve.

2016-01-07  Dmitry V. Levin  <ldv@altlinux.org>

	Fix and enhance decoding of sched_[gs]etaffinity syscalls.
	Print cpu_set_t as a set of integers, similar to the way
	fd_set is printed as a set of descriptors.

	* affinity.c: Include <sched.h>.
	(get_cpuset_size): New function.
	(print_affinitylist): Rewrite using get_cpuset_size and next_set_bit.
	(sched_getaffinity, sched_setaffinity): Print first two args as ints.
	* NEWS: Mention this enhancement.
	* tests/sched_xetaffinity.c: New file.
	* tests/sched_xetaffinity.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add sched_xetaffinity.
	(TESTS): Add sched_xetaffinity.test.
	* tests/.gitignore: Add sched_xetaffinity.

	Reported-by: Joe Korty <joe.korty@ccur.com>

2016-01-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests: convert epoll_create1.test from match_grep to match_diff.
	* tests/epoll_create1.c (main): Print expected output.
	* tests/epoll_create1.test: Use match_diff instead of match_grep.
	* tests/epoll_create1.expected: Remove.
	* tests/Makefile.am (EXTRA_DIST): Remove epoll_create1.expected.

	tests/struct_flock.c: use libtests.
	* tests/struct_flock.c (create_sample): Return void,
	all callers changed.  Use perror_msg_and_fail.
	* tests/fcntl.c: Use SKIP_MAIN_UNDEFINED.
	* tests/fcntl64.c: Likewise.

	tests/file_handle.c: use libtests.
	* tests/file_handle.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use assert and perror_msg_and_skip.

	tests/uid32.c: use libtests.
	* tests/uid32.c: Use SKIP_MAIN_UNDEFINED.

	tests/uid16.c: use libtests.
	* tests/uid16.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/uid.c: use libtests.
	* tests/uid.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/netlink_unix_diag.c: use libtests.
	* tests/netlink_unix_diag.c (send_query, check_responses, main):
	Use perror_msg_and_skip.

	tests/netlink_inet_diag.c: use libtests.
	* tests/netlink_inet_diag.c (send_query, check_responses, main):
	Use perror_msg_and_skip.

	tests/readdir.c: use libtests.
	* tests/readdir.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/getdents64.c: use libtests.
	* tests/getdents64.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/getdents.c: use libtests.
	* tests/getdents.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/ipc_shm.c: use libtests.
	* tests/ipc_shm.c (cleanup): New function.
	(main): Use it and perror_msg_and_skip.

	tests/ipc_sem.c: use libtests.
	* tests/ipc_sem.c (cleanup): New function.
	(main): Use it and perror_msg_and_skip.

	tests/ipc_msg.c: use libtests.
	* tests/ipc_msg.c (cleanup): New function.
	(main): Use it and perror_msg_and_skip.

	tests/ipc_msgbuf.c: use libtests.
	* tests/ipc_msgbuf.c (cleanup): New function.
	(main): Use it and perror_msg_and_skip.

	tests/mq.c: use libtests.
	* tests/mq.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/utimensat.c: use libtests.
	* tests/utimensat.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use assert and perror_msg_and_skip.

	tests/ppoll.c: use libtests.
	* tests/ppoll.c (main): Use assert, perror_msg_and_skip,
	and perror_msg_and_fail.

	tests/mmsg.c: use libtests.
	* tests/mmsg.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/ip_mreq.c: use libtests.
	* tests/ip_mreq.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/ioctl.c: use libtests.
	* tests/ioctl.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use %m printf format specifier.

	tests/pipe.c: use libtests.
	* tests/pipe.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_fail and perror_msg_and_skip.

	tests/getrandom.c: use libtests.
	* tests/getrandom.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/signalfd.c: use libtests.
	* tests/signalfd.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/pc.c: use libtests.
	* tests/pc.c (main): Use assert, get_page_size, perror_msg_and_fail,
	and perror_msg_and_skip.

	tests/uio.c: use libtests.
	* tests/uio.c: Use SKIP_MAIN_UNDEFINED.

	tests/bpf.c: use libtests.
	* tests/bpf.c: Use SKIP_MAIN_UNDEFINED.
	(main) Use perror_msg_and_skip.

	tests/aio.c: use libtests.
	* tests/aio.c: Use SKIP_MAIN_UNDEFINED.
	(main) Use perror_msg_and_skip.

	tests/sched_xetattr.c: use libtests.
	* tests/sched_xetattr.c: Use SKIP_MAIN_UNDEFINED.
	(main) Use perror_msg_and_skip.

	tests/wait.c: use libtests.
	* tests/wait.c (main): Use perror_msg_and_fail.

	tests/vfork-f.c: use libtests.
	* tests/vfork-f.c (main): Use assert and perror_msg_and_fail.

	tests/fork-f.c: use libtests.
	* tests/fork-f.c (main): Use assert and perror_msg_and_fail.

	tests/userfaultfd.c: use libtests.
	* tests/userfaultfd.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use assert.

	tests/mlock2.c: use libtests.
	* tests/mlock2.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use assert.

	tests/membarrier.c: use libtests.
	* tests/membarrier.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use assert.

	tests/nanosleep.c: use libtests.
	* tests/nanosleep.c (main): Use assert, perror_msg_and_fail,
	and perror_msg_and_skip.

	tests/timerfd_xettime.c: use libtests.
	* tests/timerfd_xettime.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/timer_xettime.c: use libtests.
	* tests/timer_xettime.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/timer_create.c: use libtests.
	* tests/timer_create.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/clock_xettime.c: use libtests.
	* tests/clock_xettime.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/clock_nanosleep.c: use libtests.
	* tests/clock_nanosleep.c (main): Use assert and perror_msg_and_skip.

	tests/truncate64.c: use libtests.
	* tests/truncate64.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use assert and perror_msg_and_skip.

	tests/truncate.c: use libtests.
	* tests/truncate.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use assert and perror_msg_and_skip.

	tests/ftruncate64.c: use libtests.
	* tests/ftruncate64.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use assert and perror_msg_and_skip.

	tests/ftruncate.c: use libtests.
	* tests/ftruncate.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use assert and perror_msg_and_skip.

2016-01-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests/llseek.c: use libtests.
	* tests/llseek.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use assert and perror_msg_and_skip.

	tests/lseek.c: use libtests.
	* tests/lseek.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use assert and perror_msg_and_skip.

	tests/readlinkat.c: use libtests.
	* tests/readlinkat.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/readlink.c: use libtests.
	* tests/readlink.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/xattr.c: use libtests.
	* tests/xattr.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/seccomp.c: use libtests.
	* tests/seccomp.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_fail and perror_msg_and_skip.

	tests/restart_syscall.c: use libtests.
	* tests/restart_syscall.c (main): Use assert, perror_msg_and_fail,
	and perror_msg_and_skip.

	tests/inet-cmsg.c: use libtests.
	* tests/inet-cmsg.c (main): Use perror_msg_and_skip.

	tests/eventfd.c: use libtests.
	* tests/eventfd.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip.

	tests/epoll_create1.c: use libtests.
	* tests/epoll_create1.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use assert and perror_msg_and_skip.

	tests/mmap.c: use libtests.
	* tests/mmap.c (main): Use get_page_size and perror_msg_and_fail.

	tests/fanotify_mark.c: use libtests.
	* tests/fanotify_mark.c: Use SKIP_MAIN_UNDEFINED.

	tests/inet-accept-connect-send-recv.c: use libtests.
	* tests/inet-accept-connect-send-recv.c (main): Use perror_msg_and_skip
	and perror_msg_and_fail.

	tests/net-accept-connect.c: use libtests.
	* tests/net-accept-connect.c (main): Use perror_msg_and_skip
	and perror_msg_and_fail.

	tests/unix-pair-send-recv.c: use libtests.
	* tests/unix-pair-send-recv.c (main): Use perror_msg_and_skip
	and perror_msg_and_fail.

2016-01-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests/xselect.c: use libtests.
	* tests/xselect.c (main): Use assert, perror_msg_and_fail,
	and perror_msg_and_skip.

	tests/pselect6.c: use libtests.
	* tests/pselect6.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use assert, perror_msg_and_fail, and perror_msg_and_skip.

2016-01-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests/oldselect.c: use libtests.
	* tests/oldselect.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_fail and perror_msg_and_skip.

	tests/select.c: use libtests.
	* tests/select.c: Use SKIP_MAIN_UNDEFINED.

	tests/_newselect.c: use libtests.
	* tests/_newselect.c: Use SKIP_MAIN_UNDEFINED.

	tests/fstatat.c: use libtests.
	* tests/fstatat.c: Use SKIP_MAIN_UNDEFINED.

	tests/newfstatat.c: use libtests.
	* tests/newfstatat.c: Use SKIP_MAIN_UNDEFINED.

	tests/fstatat64.c: use libtests.
	* tests/fstatat64.c: Use SKIP_MAIN_UNDEFINED.

	tests/xstatx.c: use libtests.
	* tests/xstatx.c: Use SKIP_MAIN_UNDEFINED.

	tests/stat64.c: use libtests.
	* tests/stat64.c: Use SKIP_MAIN_UNDEFINED.

	tests/stat.c: use libtests.
	* tests/stat.c: Use SKIP_MAIN_UNDEFINED.

	tests/lstat64.c: use libtests.
	* tests/lstat64.c: Use SKIP_MAIN_UNDEFINED.

	tests/lstat.c: use libtests.
	* tests/lstat.c: Use SKIP_MAIN_UNDEFINED.

	tests/fstat64.c: use libtests.
	* tests/fstat64.c: Use SKIP_MAIN_UNDEFINED.

	tests/fstat.c: use libtests.
	* tests/fstat.c: Use SKIP_MAIN_UNDEFINED.

	tests/statfs.c: use libtests.
	* tests/statfs.c (main): Use perror_msg_and_fail.

2016-01-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests/xettimeofday.c: use libtests.
	* tests/xettimeofday.c (main): Use assert and perror_msg_and_skip.

	tests/utime.c: use libtests.
	* tests/utime.c (main): Use assert and perror_msg_and_skip.

	tests/filter-unavailable.c: use libtests.
	* tests/filter-unavailable.c (main): Use perror_msg_and_fail.

	tests/scm_rights.c: use libtests.
	* tests/scm_rights.c (main): Use perror_msg_and_fail and perror_msg_and_skip.

	tests/caps.c: use libtests.
	* tests/caps.c (main): Use perror_msg_and_skip.

	tests/rt_sigqueueinfo.c: use libtests.
	* tests/rt_sigqueueinfo.c (main): Use assert and perror_msg_and_skip.

	tests/umount.c: use libtests.
	* tests/umount.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_fail.

	tests/umount2.c: use libtests.
	* tests/umount2.c (main): Use perror_msg_and_fail.

2016-01-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests/times.c: use libtests.
	* tests/times.c (main): Use perror_msg_and_fail and perror_msg_and_skip.

2016-01-04  Dmitry V. Levin  <ldv@altlinux.org>

	tests/times-fail.c: use assert.
	* tests/times-fail.c (main): Use assert.

	tests/memfd_create.c: use libtests.
	* tests/memfd_create.c: Use SKIP_MAIN_UNDEFINED.

	tests/execveat.c: use libtests.
	* tests/execveat.c: Use SKIP_MAIN_UNDEFINED.

	tests/xetitimer.c: use libtests.
	* tests/xetitimer.c (main): Use perror_msg_and_skip.

2016-01-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests/sysinfo.c: use libtests.
	* tests/sysinfo.c (main): Use perror_msg_and_skip.

	tests/sigaltstack.c: use libtests.
	* tests/sigaltstack.c (main): Use perror_msg_and_skip.

	tests/adjtimex.c: use libtests.
	* tests/adjtimex.c (main): Use perror_msg_and_skip.

	tests/xet_robust_list.c: use libtests.
	* tests/xet_robust_list.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip and tail_alloc.

	tests/umovestr2.c: use libtests.
	* tests/umovestr2.c (main): Use get_page_size and tail_alloc.

	tests/umovestr.c: use libtests.
	* tests/umovestr.c (main): Use perror_msg_and_skip and tail_alloc.

	tests/time.c: use libtests.
	* tests/time.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use perror_msg_and_skip and tail_alloc.

	tests/sendfile64.c: use libtests.
	* tests/sendfile64.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use assert, perror_msg_and_fail, perror_msg_and_skip,
	and tail_alloc.

	tests/sendfile.c: use libtests.
	* tests/sendfile.c: Use SKIP_MAIN_UNDEFINED.
	(main): Use assert, perror_msg_and_fail, perror_msg_and_skip,
	and tail_alloc.

2016-01-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: include tests.h instead of config.h.
	Automatically edit tests/*.c files using the following perl one-liner:

	perl -0777 -pi -e \
	's/#ifdef HAVE_CONFIG_H\n# include "config\.h"\n#endif\n*/#include "tests.h"\n/' \
	tests/*.c

2016-01-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: introduce libtests.
	Introduce tests/libtests.a with common functions for use in tests.

	* tests/tests.h: New file.
	* tests/error_msg.c: Likewise.
	* tests/tail_alloc.c: Likewise.
	* tests/get_page_size.c: Likewise.
	* tests/Makefile.am (libtests_a_SOURCES, libtests_a_CPPFLAGS,
	check_LIBRARIES, LDADD): New variables.
	(clock_xettime_LDADD, filter_unavailable_LDADD, mq_LDADD,
	pc_LDADD, times_LDADD): Add $(LDADD).
	* tests/.gitignore: Add libtests.a.

2016-01-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests: enable strace-k.test only for --with-libunwind configurations.
	Also, since -k option does not support multiple personalities,
	add strace-k.test to XFAIL_TESTS when running mpers tests.

	* tests/Makefile.am (MPERS_NAME, LIBUNWIND_TESTS, XFAIL_TESTS_,
	XFAIL_TESTS_m32, XFAIL_TESTS_mx32, XFAIL_TESTS): New variables.
	[USE_LIBUNWIND] (LIBUNWIND_TESTS): Add strace-k.test.
	(TESTS): Replace strace-k.test with $(LIBUNWIND_TESTS).
	* bootstrap: Substitute MPERS_NAME variable in tests-*/Makefile.am.
	* tests/strace-k.test: Do not check for -k option availability.

2016-01-02  Dmitry V. Levin  <ldv@altlinux.org>

	Move gcc compat macros to gcc_compat.h.
	* defs.h: Include "gcc_compat.h".
	(GNUC_PREREQ, ATTRIBUTE_NORETURN, ATTRIBUTE_FORMAT,
	ATTRIBUTE_ALIGNED, ATTRIBUTE_PACKED, ATTRIBUTE_MALLOC,
	ATTRIBUTE_NOINLINE, ATTRIBUTE_ALLOC_SIZE): Move ...
	* gcc_compat.h: ... here.
	* Makefile.am (strace_SOURCES): Add gcc_compat.h.

2015-12-31  Dmitry V. Levin  <ldv@altlinux.org>

	Move defs.h from noinst_HEADERS to strace_SOURCES.
	* Makefile.am (noinst_HEADERS): Move defs.h ...
	(strace_SOURCES): ... here.

2015-12-30  Dmitry V. Levin  <ldv@altlinux.org>

	test: remove fork.c and vfork.c.
	These manual tests are obsoleted by fork-f.test and vfork-f.test.

	* test/fork.c: Remove.
	* test/vfork.c: Remove.
	* test/Makefile (PROGS): Remove fork and vfork.
	* test/.gitignore: Remove fork and vfork.

2015-12-30  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add fork-f.test and vfork-f.test.
	Check how strace -f follows fork and vfork syscalls.

	* tests/fork-f.c: New file.
	* tests/fork-f.test: New test.
	* tests/vfork-f.c: New file.
	* tests/vfork-f.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add fork-f and vfork-f.
	(TESTS): Add fork-f.test and vfork-f.test.
	* tests/.gitignore: Add fork-f and vfork-f.

2015-12-29  Dmitry V. Levin  <ldv@altlinux.org>

	Set SYSCALL_NEVER_FAILS flag for getpid, getppid and gettid syscall.
	* linux/*/syscallent*.h (getpid, getppid, gettid): Set NF flag.

2015-12-29  Dmitry V. Levin  <ldv@altlinux.org>

	Set SYSCALL_NEVER_FAILS flag for umask syscall.
	Linux kernel always ANDs umask argument with 0700 and therefore
	this syscall never fails.

	* linux/*/syscallent*.h (umask): Set NF flag.

2015-12-27  Dmitry V. Levin  <ldv@altlinux.org>

	alpha, ia64, mips, nios2, powerpc, sparc: always check for syscall error
	On architectures that use dedicated registers to report syscall errors,
	check for syscall error condition regardless of SYSCALL_NEVER_FAILS flag
	in the syscall entry.  On architectures that use negated errno
	semantics, there is no way to distinguish a syscall error from a valid
	return code that looks like a syscall error, and the check for
	SYSCALL_NEVER_FAILS flag remains the only way to tell one case
	from another.

	* linux/alpha/get_error.c (get_error): Ignore check_errno.
	* linux/ia64/get_error.c: Likewise.
	* linux/mips/get_error.c: Likewise.
	* linux/nios2/get_error.c: Likewise.
	* linux/powerpc/get_error.c: Likewise.
	* linux/sparc/get_error.c: Likewise.
	* linux/sparc64/get_error.c: Likewise.

2015-12-27  Dmitry V. Levin  <ldv@altlinux.org>

	Handle unlikely errors from personality syscall.
	Despite being marked as SYSCALL_NEVER_FAILS, personality syscall still
	might report a failure on some architectures due to obscure kernel
	bugs.  Check for this unlikely case and let users know that their
	kernel has gone bananas.

	* personality.c (SYS_FUNC(personality)): Do not parse syscall return
	value in case of syserror.

2015-12-27  Dmitry V. Levin  <ldv@altlinux.org>

	Do not truncate return value of get{,e}[ug]id and setfs[ug]id syscalls.
	This should not be a user visible change unless the kernel does
	something completely unexpected.  In the latter case, let user see
	what is going on.

	* uid.c (SYS_FUNC(getuid), SYS_FUNC(setfsuid)): Do not truncate
	tcp->u_rval to uid_t on exiting syscall, return RVAL_DECODED.

2015-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	Enhance personality syscall decoding.
	* xlat/personality_options.in: Split into ...
	* xlat/personality_types.in: ... personality types and ...
	* xlat/personality_flags.in: ... personality flags.
	* personality.c: Include "xlat/personality_types.h"
	and "xlat/personality_flags.h" instead of "xlat/personality_options.h".
	(SYS_FUNC(personality)): Print PER_MASK part of personality as
	a symbolic value, and the rest of personality as a set of flags.
	* tests/personality.c (main): Add more test cases.
	* tests/personality.test: Update.

2015-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	sh, sh64: fix syscall flags in several syscall entries.
	* linux/sh/syscallent.h (geteuid32, getegid32, setfsuid32, setfsgid32):
	Set SYSCALL_NEVER_FAILS flag.
	(fchown32): Set TRACE_DESC flag.
	* linux/sh64/syscallent.h: Likewise.

2015-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	Print personality value 0xffffffff properly.
	Value 0xffffffff of personality syscall first argument has a special
	meaning, it is not a set of personality flags.

	* personality.c (SYS_FUNC(personality)): If personality equals
	to 0xffffffff, print it verbatim.
	* tests/personality.c (main): Test it.

2015-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add personality.test.
	* tests/personality.c: New file.
	* tests/personality.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add personality.
	(TESTS): Add personality.test.
	* tests/.gitignore: Add personality.

	Enhance personality syscall decoding.
	* personality.c (SYS_FUNC(personality)): On entering syscall,
	print first argument not as a hex value but as a set of flags.
	On exiting syscall, print return code as a set of flags.
	* NEWS: Mention this enhancement.

2015-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	Set SYSCALL_NEVER_FAILS flag for personality syscall.
	Starting with commit
	v2.6.29-6609-g11d06b2a1e5658f448a308aa3beb97bacd64a940, personality
	syscall never fails to set the personality, but before commit
	v2.6.35-rc1-372-g485d527 it still could return an error.
	Starting with that commit, personality syscall never returns an error.

	* linux/*/syscallent.h: Set SYSCALL_NEVER_FAILS flag in personality
	syscall entries.

2015-12-24  Dmitry V. Levin  <ldv@altlinux.org>

	Add personality emulation flags.
	* xlat/personality_options.in: Add UNAME26, ADDR_NO_RANDOMIZE,
	FDPIC_FUNCPTRS, MMAP_PAGE_ZERO, ADDR_COMPAT_LAYOUT, READ_IMPLIES_EXEC,
	ADDR_LIMIT_32BIT, SHORT_INODE, WHOLE_SECONDS, STICKY_TIMEOUTS,
	and ADDR_LIMIT_3GB.

2015-12-24  Dmitry V. Levin  <ldv@altlinux.org>

	arc, metag, nios2, or1k, tile: fix build.
	Fix build regression introduced by commit
	34683e3926d8c2daa368afb805da422ee7043396.

	* linux/32/syscallent.h: Add sys_ prefix to ARCH_mmap and mmap.
	* linux/arc/syscallent.h: Add sys_ prefix to ARCH_mmap and mmap_pgoff.
	* linux/nios2/syscallent.h: Likewise.
	* linux/or1k/syscallent.h: Likewise.
	* linux/tile/syscallent1.h: Add sys_ prefix to ARCH_mmap and sys_mmap_4koff.
	* pathtrace.c (pathtrace_match): Handle SEN_ARCH_mmap.
	* NEWS: Mention this build fix.

	Reported-by: Alexey Brodkin <Alexey.Brodkin@synopsys.com>

2015-12-24  Dmitry V. Levin  <ldv@altlinux.org>

	packages: remove acl development library from build dependencies.
	Starting with commit v4.9-46-g681452b that removed all references
	to acl.h, we no longer use acl development library.

	* .travis.yml (addons.apt.packages): Remove libacl1-dev.
	* strace.spec (BuildRequires): Remove libacl-devel.

2015-12-23  Dmitry V. Levin  <ldv@altlinux.org>

	packages/x86_64: enable experimental -k option.
	* debian/control (Build-Depends) [amd64]: Add libunwind-dev.
	* strace.spec (BuildRequires) [x86_64]: Add libunwind-devel.

	maint: post-release administrivia.
	* NEWS: Add header line for the next release.

2015-12-21  Dmitry V. Levin  <ldv@altlinux.org>

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

2015-12-20  Dmitry V. Levin  <ldv@altlinux.org>

	Sync strace.spec and debian/ with packages.
	* debian/changelog: Sync with 4.10-3.
	* debian/control: Likewise.
	* debian/rules: Likewise.
	* strace.spec: Sync with 4.10-3.

	.mailmap: add addresses of Kirill A. Shutemov.
	* .mailmap: Add both addresses of Kirill A. Shutemov here
	to avoid duplications in CREDITS file.

2015-12-19  Dmitry V. Levin  <ldv@altlinux.org>

	NEWS: Prepare for 4.11 release.

2015-12-18  Dmitry V. Levin  <ldv@altlinux.org>

	ia64: wire up mlock2 syscall.
	* linux/ia64/syscallent.h [1346]: Add mlock2 entry.

2015-12-17  Dmitry V. Levin  <ldv@altlinux.org>

	Add copyright headers to some files which lack them.
	Before this change, all files that exist since 20th century had
	copyright headers, while most files that appeared later didn't.  This
	change fixes the inconsistency by adding missing copyright headers.

	It doesn't mean that copyright headers became maintained.  In my view,
	git history provides much better information on this subject and is much
	more accurate than copyright headers.

2015-12-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests/aio.c: include <time.h>
	* tests/aio.c: Include <time.h> for struct timespec.

	Reported-by: Szabolcs Nagy <nsz@port70.net>

2015-12-16  Dmitry V. Levin  <ldv@altlinux.org>

	mpers.sh: switch to DWARF version 2 format for better portability.
	* mpers.sh (CFLAGS): Replace -gdwarf-4 with -gdwarf-2.

	mpers.awk: add support for DWARF version 2 format.
	* mpers.awk: Handle DW_AT_data_member_location in DWARF v2 format.

2015-12-16  Dmitry V. Levin  <ldv@altlinux.org>

	Replace %Ld/%Lu printf format specifiers with %lld/%llu.
	As %Ld and %Lu printf format specifiers are not quite portable,
	replace them with %lld and %llu, respectively.

	* desc.c (SYS_FUNC(pselect6)): Replace %Lu with %llu.
	* dirent.c (print_old_dirent, SYS_FUNC(getdents)): Likewise.
	* times.c (SYS_FUNC(times)): Likewise.
	* fcntl.c (print_struct_flock64): Replace %Ld with %lld.
	* tests/ftruncate.c (main): Replace %Lu with %llu.
	* tests/ftruncate64.c (main): Likewise.
	* tests/getdents.c (print_dirent): Likewise.
	* tests/llseek.c (main): Likewise.
	* tests/lseek.c (main): Likewise.
	* tests/truncate.c (main): Likewise.
	* tests/truncate64.c (main): Likewise.
	* tests/xstatx.c (main): Likewise.
	* tests/pselect6.c (main): Replace %Ld with %lld.
	* tests/xselect.c(main): Likewise.

	Reported-by: Szabolcs Nagy <nsz@port70.net>

2015-12-16  Szabolcs Nagy  <nsz@port70.net>

	Fix SYS_FUNC and SEN macros for musl.
	The syscall_name argument was subject to macro expansion because
	it was passed down to other macros before it was prefixed.

	musl libc defines lfs64 names as macros (e.g. fstat64 as fstat)
	so SYS_FUNC(fstat64) was expanded to sys_fstat.

	This change adds the prefix before the name is passed to other macros,
	i.e. the argument of SYS_FUNC_NAME is already prefixed with sys_.

	* defs.h (SYS_FUNC): Add sys_ prefix to SYS_FUNC_NAME's argument.
	(SYS_FUNC_NAME): Do not add sys_ prefix to MPERS_FUNC_NAME's argument.
	* linux/ia64/syscallent.h (SYS_FUNC_NAME): Do not add sys_ prefix
	to MPERS_FUNC_NAME's argument.
	* syscall.c (SEN_NAME): Remove.
	(SEN): Replace SEN_NAME call with its definition.  Add sys_ prefix
	to SYS_FUNC_NAME's argument.

2015-12-15  Dmitry V. Levin  <ldv@altlinux.org>

	tests/times.test: workaround libc bug on x32.
	As glibc times wrapper on x32 is known to wrongly truncate and then sign
	extend the syscall return value, invoke the syscall directly on x32.

	* tests/times.c (main) [__NR_times && __x86_64__ && __ILP32__]:
	Invoke times syscall using inline asm.

2015-12-15  Dmitry V. Levin  <ldv@altlinux.org>

	mpers.awk: make fillers added to the output structure more predictable.
	* mpers.awk (array_seq): New function.
	(what_is): Use it for printing filler names.  Tweak return types.
	* mpers_test.sh: Use a more complicated sample type to test mpers
	machinery.

2015-12-15  Dmitry V. Levin  <ldv@altlinux.org>

	Robustify mpers.awk against input containing index loops.
	Make mpers.awk check for potential index loops.  Such loops should not
	normally happen, but mpers.awk will not go into infinite recursion if
	they do.

	* mpers.awk (enter, leave): New functions.
	(what_is): Use them.

2015-12-15  Dmitry V. Levin  <ldv@altlinux.org>

	Robustify mpers.awk against invalid input.
	Make mpers.awk check that accessed elements of the main array that
	are expected to have non-empty values really meet this requirement.

	* mpers.awk (array_get): New function.
	(what_is, END): Use it.
	* mpers_test.sh: Use a more complicated type to test mpers machinery.

	Reported-by: Mike Frysinger <vapier@gentoo.org>

2015-12-14  Dmitry V. Levin  <ldv@altlinux.org>

	Replace HAVE_LITTLE_ENDIAN_LONG_LONG with WORDS_BIGENDIAN.
	* defs.h: Use WORDS_BIGENDIAN instead of HAVE_LITTLE_ENDIAN_LONG_LONG.
	* configure.ac (AC_LITTLE_ENDIAN_LONG_LONG): Remove.
	* m4/long_long.m4: Remove.

2015-12-14  Dmitry V. Levin  <ldv@altlinux.org>

	Remove unused parser of xmknod syscall.
	The last reference to this parser was removed by commit
	v4.10-45-gdf4dd8b.

	* mknod.c [SPARC || SPARC64] (SYS_FUNC(xmknod)): Remove.

2015-12-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests/restart_syscall: add a workaround for old arm kernels.
	As arm kernels used to overwrite ARM_r0 with -EINTR after
	ERESTART_RESTARTBLOCK, update regexp to workaround this.

	* tests/restart_syscall.c (main) [__arm__]: Add 0xfffffffc as a valid
	alternative value for the first argument of restarted nanosleep syscall.

2015-12-12  Dmitry V. Levin  <ldv@altlinux.org>

	tests/.gitignore: add ksysent.h.
	tests/ksysent.h is a generated file listed in CLEANFILES.
	This change complements commit v4.10-566-gbab4ef4.

	* tests/.gitignore: Add ksysent.h.

2015-12-11  Dmitry V. Levin  <ldv@altlinux.org>

	aarch64: make arm registers unsigned.
	Follow the x86_64 example and define registers in arm_pt_regs
	as unsigned, to avoid potential sign extension bugs.

	This also fixes --enable-gcc-Werror build.

	* linux/aarch64/arch_regs.c (arm_pt_regs): Change uregs's type
	from int to uint32_t.

	Reported-by: Sergey Bolshakov <sbolshakov@altlinux.org>

2015-12-10  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add ksysent.test.
	Check that syscall names and numbers defined in syscallent files
	match kernel __NR_* constants defined by <asm/unistd.h>.

	Tested on various platforms, including the following combinations
	of architectures and kernel headers:

	x86_64: 4.4-rc, 4.3, 4.2, 4.1, 3.19, 3.17, 3.16, 3.12, 3.11,
	3.10-rhel, 2.6.32-rhel, 2.6.27-sle, 2.6.18-rhel
	i386: 4.4-rc, 4.3, 4.2, 4.1, 3.19, 3.17, 3.16, 3.11,
	3.10-rhel, 2.6.32-rhel, 2.6.27-sle, 2.6.18-rhel
	aarch64: 4.4-rc
	alpha: 4.3
	arm eabi: 4.4-rc, 4.2, 4.1
	hppa: 3.18
	ia64: 3.18
	mips o32: 4.1
	ppc: 3.18
	ppc64: 3.10-rhel, 2.6.32-rhel
	s390: 3.18
	s390x: 3.18
	sparc: 4.1
	sparc: 3.18
	x32: 3.19

	The only platform which is known at this moment to fail the test
	is CentOS-5 provided by OBS.  On x86_64 instance it fails with
	error: "prlimit64" syscall #300 is "fanotify_init" in syscallent.h
	and on i586 it similarly fails with
	error: "prlimit64" syscall #338 is "fanotify_init" in syscallent.h
	So this is a real platform bug that is not likely to be worked around
	on the strace side.

	* tests/ksysent.c: New file.
	* tests/ksysent.sed: Likewise.
	* tests/ksysent.test: New test.
	* tests/Makefile.am (AM_CPPFLAGS): Add -I$(builddir).
	(check_PROGRAMS): Add ksysent.
	(TESTS): Add ksysent.test.
	(EXTRA_DIST): Add ksysent.sed.
	(ksysent.h): New rule.
	(BUILT_SOURCES, CLEANFILES): Add ksysent.h.
	* tests/.gitignore: Add ksysent.

2015-12-09  Dmitry V. Levin  <ldv@altlinux.org>

	Document that syscall names match kernel __NR_* constants.
	* strace.1: Note syscall naming difference between architectures
	and the rule of choosing the right syscall name in each case.

2015-12-09  Dmitry V. Levin  <ldv@altlinux.org>

	ia64: print all ia32 syscalls using printargs.
	Printing of ia32 syscalls on ia64 must have been broken for a long time.
	Do not pretend that it works, print ia32 syscalls using printargs
	instead.

	* linux/ia64/syscallent.h: Remove all redefinitions of sys_* macros.
	Stop including"../dummy.h".  Include "../i386/syscallent.h" with
	SYS_FUNC_NAME macro temporarily redirected to printargs.

2015-12-09  Dmitry V. Levin  <ldv@altlinux.org>

	Fix build on architectures for which arch_sigreturn is not implemented.
	This complements commit 527b42ff8da3f52fa7c48eb766b2b57fb0f0b977.

	* linux/arch_sigreturn.c (arch_sigreturn): Define.

2015-12-09  Dmitry V. Levin  <ldv@altlinux.org>

	aarch64: swap 64-bit and 32-bit personalities.
	Let native 64-bit personality be personality 0, and 32-bit personality
	be personality 1, to follow the traditional layout used for other
	architectures.

	* defs.h [AARCH64]: Swap PERSONALITY0_WORDSIZE and
	PERSONALITY1_WORDSIZE, remove DEFAULT_PERSONALITY.
	[AARCH64 && HAVE_M32_MPERS]: Rename PERSONALITY1_* to PERSONALITY0_*.
	* file.c [AARCH64 || defined X86_64 || defined X32]: Define
	STAT32_PERSONALITY for AARCH64 as well.
	* syscall.c (update_personality) [AARCH64]: Adjust PERSONALITY_NAMES.
	* linux/aarch64/errnoent1.h: Adjust comment.
	* linux/aarch64/get_error.c (get_error): Adjust tcp->currpers check.
	* linux/aarch64/get_syscall_args.c (get_syscall_args): Likewise.
	* linux/arm/arch_sigreturn.c (arch_sigreturn) [AARCH64]: Likewise.
	* linux/aarch64/get_scno.c (arch_get_scno): Adjust update_personality
	invocations.
	* linux/aarch64/ioctls_arch0.h: Swap with ...
	* linux/aarch64/ioctls_arch1.h: ... this file.
	* linux/aarch64/ioctls_inc0.h: Swap with ...
	* linux/aarch64/ioctls_inc1.h: ... this file.
	* linux/aarch64/syscallent.h: Swap with ...
	* linux/aarch64/syscallent1.h: ... this file.

2015-12-08  Dmitry V. Levin  <ldv@altlinux.org>

	mips: fix fadvise64 syscall entries.
	* linux/mips/syscallent-n32.h [6216]: Change syscall handler
	from fadvise64 to fadvise64_64.
	* linux/mips/syscallent-n64.h [5215]: Rename from "fadvise64_64"
	to "fadvise64"
	* linux/mips/syscallent-o32.h [4254]: Likewise.

	xtensa: wire up syncfs syscall.
	* linux/xtensa/syscallent.h [179]: Add syncfs entry.

	sh, sh64: fix syscall entries.
	* linux/sh/syscallent.h [322]: Fix timerfd_create entry.
	* linux/sh64/syscallent.h [350]: Likewise.
	[0]: Fix restart_syscall entry.

	powerpc, powerpc64: wire up mlock2 syscall.
	* linux/powerpc/syscallent.h [378]: Add mlock2 entry.
	* linux/powerpc64/syscallent.h: Likewise.

	hppa: fix syscall entries.
	* linux/hppa/syscallent.h: Swap [343] and [344] entries.

	avr32: update syscall entries.
	* linux/avr32/syscallent.h [0]: Rename from setup to restart_syscall.
	[284 ... 320]: New entries.

	m68k: fix syscall names.
	* linux/m68k/syscallent.h [335]: Rename "atomic_comxchg_32"
	to "atomic_cmpxchg_32".

	sparc: update syscall names.
	* linux/sparc/syscallent.h [160]: Rename "sched_setaffinity"
	to "sched_set_affinity".
	[161]: Rename "sched_getaffinity" to "sched_get_affinity".

	powerpc, powerpc64: update syscall names.
	* linux/powerpc/syscallent.h [201]: Rename "MOL" to "multiplexer".
	[225]: Rename "tux" to "tuxcall".
	[256]: Rename "debug_setcontext" to "sys_debug_setcontext".
	* linux/powerpc64/syscallent.h: Likewise.

	alpha: update syscall entries.
	* linux/alpha/syscallent.h [224 ... 228]: Add stub entries.
	[100]: Rename "osf_getpriority" to "getpriority".
	[255]: Rename "osf_subsysinfo" to "osf_subsys_info".
	[303]: Rename "adjtimex32" to "old_adjtimex".
	[319]: Rename "sysctl" to "_sysctl".
	[320]: Remove.

2015-12-08  Dmitry V. Levin  <ldv@altlinux.org>

	Fix mmap syscall entries.
	Change syscall names to match kernel __NR_* constants.

	* linux/avr32/syscallent.h [90]: Rename "mmap" to "mmap2".
	* linux/bfin/syscallent.h [90]: Rename "old_mmap" to "mmap".
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* tests/mmap.c (main): Remove old_mmap from expected output.
	* tests/mmap.test: Remove old_mmap from the list of mmap syscalls.

2015-12-08  Dmitry V. Levin  <ldv@altlinux.org>

	Fix select and _newselect syscall entries.
	Change syscall names to match kernel __NR_* constants.
	This reverts commit ddcf54969d253582ab2cfdcab8ede9cdae3fb171.

	* linux/arm/syscallent.h [82]: Rename "oldselect" to "select".
	[142]: Rename "select" to "_newselect".
	* linux/bfin/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h [82]: Likewise.
	* linux/powerpc64/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/hppa/syscallent.h [142]: Rename "select" to "_newselect".
	* linux/mips/syscallent-n32.h [6022]: Rename "select" to "_newselect".
	* linux/mips/syscallent-n64.h [5022]: Likewise.
	* linux/mips/syscallent-o32.h [4142]: Likewise.
	* linux/s390/syscallent.h [142]: Rename "select" to "_newselect".
	* linux/sparc/syscallent.h [230]: Rename "select" to "_newselect".
	* tests/oldselect.test: Rename oldselect to select.  Convert
	from match_grep to match_diff.
	* tests/oldselect.expected: Likewise.
	* xselect.c: New file, based on select.c.
	* tests/_newselect.c: New file.
	* tests/select.c: Replace with a wrapper around xselect.c.
	* tests/select.test: Parametrize.
	* tests/_newselect.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add _newselect.
	(TESTS): Add _newselect.test.
	(EXTRA_DIST): Add xselect.c.
	* tests/.gitignore: Add _newselect.

2015-12-08  Dmitry V. Levin  <ldv@altlinux.org>

	Fix exit syscall entries.
	Change syscall names to match kernel __NR_* constants.

	* linux/avr32/syscallent.h [1]: Rename "_exit" to "exit".
	* linux/bfin/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/x32/syscallent.h [60]: Rename "_exit" to "exit".
	* linux/x86_64/syscallent.h: Likewise.

2015-12-08  Dmitry V. Levin  <ldv@altlinux.org>

	Fix pread64 and pwrite64 syscall entries.
	Change syscall names to match kernel __NR_* constants.

	* linux/alpha/syscallent.h [349]: Rename "pread" to "pread64".
	[350]: Rename "pwrite" to "pwrite64".
	* linux/ia64/syscallent.h [1148]: Rename "pread" to "pread64".
	[1149]: Rename "pwrite" to "pwrite64".
	* linux/sh/syscallent.h [180]: Rename "pread" to "pread64".
	[181]: Rename "pwrite" to "pwrite64".
	* linux/sh64/syscallent.h: Likewise.
	* linux/x32/syscallent.h [17]: Rename "pread" to "pread64".
	[18]: Rename "pwrite" to "pwrite64".
	* linux/x86_64/syscallent.h: Likewise.

2015-12-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests: sort the list of tests.
	* tests/Makefile.am (TESTS): Sort the list of regular tests.
	* tests/.gitignore: Sort.

	ia64: fix remap_file_pages syscall entry.
	* linux/ia64/syscallent.h (1125): Set to remap_file_pages.

	bfin, i386: remove sysentry for nonexistent security syscall.
	* linux/bfin/syscallent.h (223): Remove.
	* linux/i386/syscallent.h: Likewise.

	build: add -D_FILE_OFFSET_BITS=64 to _CPPFLAGS instead of _CFLAGS.
	* tests/Makefile.am (fstat64_CFLAGS): Rename to fstat64_CPPFLAGS,
	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
	(fstatat64_CFLAGS): Rename to fstatat64_CPPFLAGS,
	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
	(ftruncate64_CFLAGS): Rename to ftruncate64_CPPFLAGS,
	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
	(lstat64_CFLAGS): Rename to lstat64_CPPFLAGS,
	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
	(mmap64_CFLAGS): Rename to mmap64_CPPFLAGS,
	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
	(newfstatat_CFLAGS): Rename to newfstatat_CPPFLAGS,
	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
	(stat64_CFLAGS): Rename to stat64_CPPFLAGS,
	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
	(statfs_CFLAGS): Rename to statfs_CPPFLAGS,
	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
	(truncate64_CFLAGS): Rename to truncate64_CPPFLAGS,
	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).
	(uio_CFLAGS): Rename to uio_CPPFLAGS,
	replace $(AM_CFLAGS) with $(AM_CPPFLAGS).

2015-12-08  Dmitry V. Levin  <ldv@altlinux.org>

	Move x32 <asm/stat.h> replacement to x32 specific directory.
	As tests-m*32/Makefile.am files now refer to proper arch specific
	directories, it's possible to relocate x32 <asm/stat.h> replacement
	to its arch specific directory.

	* linux/x86_64/asm_stat.h: Move ...
	* linux/x32/asm_stat.h: ... here, remove x32 guard.
	* Makefile.am (strace_SOURCES): Remove linux/x86_64/asm_stat.h.

2015-12-08  Dmitry V. Levin  <ldv@altlinux.org>

	build: set arch specific -m switches in tests-m*32/Makefile.am files properly
	* tests/Makefile.am (ARCH_MFLAGS, AM_LDFLAGS): New variables.
	(AM_CPPFLAGS): Use ARCH_MFLAGS.
	* bootstrap: In tests-m32/Makefile.am and tests-mx32/Makefile.am,
	add -m32 and -mx32, respectively, to ARCH_MFLAGS instead of AM_CFLAGS.

	build: initialize ARCH variable in tests-m*32/Makefile.am files properly
	* configure.ac (arch_m32): Set to sparc on sparc64, powerpc on
	powerpc64, arm on aarch64, i386 on x86_64 and x32, $arch in other cases.
	(arch_mx32): Set to x32 on x86_64, $arch in other cases.
	(AC_SUBST): Add arch_m32 and arch_mx32.
	* bootstrap: Substitute @arch@ with @arch_m32@ in tests-m32/Makefile.am.
	Substitute @arch@ with @arch_mx32@ in tests-mx32/Makefile.am.

2015-12-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add umount.test and umount2.test.
	* tests/umount.c: New file.
	* tests/umount2.c: Likewise.
	* tests/umount.test: New test.
	* tests/umount2.test: Likewise.
	* tests/Makefile.am (check_PROGRAMS): Add umount and umount2.
	(TESTS): Add umount.test and umount2.test.
	* tests/.gitignore: Add umount and umount2.

	avr32: fix umount2 syscall entry.
	* linux/avr32/syscallent.h: Rename umount to umount2.

	Update umount2 flags.
	* umount.c (MNT_FORCE, MNT_DETACH, MNT_EXPIRE): Move definitions ...
	* xlat/umount_flags.in: ... here.  Add UMOUNT_NOFOLLOW.

2015-12-07  Dmitry V. Levin  <ldv@altlinux.org>

	Print the first argument of umount2 syscall as a path.
	* umount.c (SYS_FUNC(umount2)): Use printpath instead of printstr.

	This fixes Debian bug #785050.

2015-12-06  Dmitry V. Levin  <ldv@altlinux.org>

	prctl: add PR_CAP_AMBIENT parser.
	* xlat/pr_cap_ambient.in: New file.
	* prctl.c: Include "xlat/pr_cap_ambient.h".
	(SYS_FUNC(prctl)): Handle PR_CAP_AMBIENT.

	prctl: finish decoding of several commands on entering syscall.
	* prctl.c (SYS_FUNC(prctl)): Return RVAL_DECODED after decoding of
	PR_GET_DUMPABLE, PR_GET_KEEPCAPS, PR_GET_SECCOMP, PR_GET_TIMERSLACK,
	PR_GET_TIMING, and PR_CAPBSET_READ commands.

	Fix build on systems that lack EM_FRV definition.
	* xlat/audit_arch.in: Guard AUDIT_ARCH_FRV with EM_FRV check.

	times.test: workaround buggy libc.
	* tests/times.c: Include <sys/syscall.h>.
	(main): On systems where user's and kernel's long types are the same,
	prefer direct times syscall over libc's times function because
	the latter is more prone to return value truncation.

	times.test: reduce cpu time consumption, increase struct tms diversity.
	* tests/times.c (main): Reduce cpu time consumption fourfold,
	make the parent process consume less cpu time than the child process
	so that members of the structure returned by times syscall would be
	more likely to contain different values.

2015-12-06  Dmitry V. Levin  <ldv@altlinux.org>

	mips n32, x32: fix printing of times syscall return value.
	As times syscall returns kernel's long value, it has to be printed as
	RVAL_LUDECIMAL on systems where long type is less than kernel's long.

	* times.c (SYS_FUNC(times)) [RVAL_LUDECIMAL && !IN_MPERS]:
	Return RVAL_LUDECIMAL instead of RVAL_UDECIMAL.

2015-12-06  Dmitry V. Levin  <ldv@altlinux.org>

	unix-yy.test: fix portability issue.
	* tests/unix-yy-connect.awk (r_close_listen): Quote square brackets
	that are not part of a bracket expression.

	inet-cmsg.test: skip the test when the network is not functional.
	* tests/inet-cmsg.c (main): Return 77 if inet datagram socket
	cannot be bound to INADDR_LOOPBACK.

2015-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	fcntl: skip F_GETLK64, F_SETLK64, and F_SETLKW64 in fcntl syscall parser
	As the kernel recognizes F_GETLK64, F_SETLK64, and F_SETLKW64 commands
	in fcntl64 syscall only, do not parse their structures in fcntl parser.

	* xlat/fcntlcmds.in: Move F_GETLK64, F_SETLK64, and F_SETLKW64 ...
	* xlat/fcntl64cmds.in: ... here.
	* fcntl.c: Include "xlat/fcntl64cmds.h".
	(print_fcntl): Move printing of first two syscall arguments
	and handling of F_GETLK64, F_SETLK64, and F_SETLKW64 commands ...
	(SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): ... here.
	* tests/fcntl.c: New file, based on struct_flock.c.
	* tests/fcntl64.c: Likewise.
	* tests/struct_flock.c (test_flock_einval, create_sample): New functions.
	(test_flock): Use test_flock_einval.
	(test_flock64, main): Remove.
	* tests/fcntl.test: New test.
	* tests/fcntl64.test: Likewise.
	* tests/struct_flock.test: Remove.
	* tests/Makefile.am (check_PROGRAMS): Add fcntl and fcntl64,
	remove struct_flock.
	(TESTS): Add fcntl.test and fcntl64.test, remove struct_flock.test.
	(EXTRA_DIST) Add struct_flock.c.
	* tests/.gitignore: Add fcntl and fcntl64, remove struct_flock.

2015-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	print_fcntl: finish with unrecognized commands on entering syscall.
	* fcntl.c (print_fcntl): Merge two switch statements.

2015-12-04  Elvira Khabirova  <lineprinter0@gmail.com>

	fcntl: create a separate parser for fcntl64 syscall.
	* fcntl.c(print_fcntl): New function, made from SYS_FUNC(fcntl).
	(SYS_FUNC(fcntl), SYS_FUNC(fcntl64)): Use it.
	* linux/32/syscallent.h: Change parser of fcntl64 to SEN(fcntl64).
	* 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/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

2015-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	travis-ci: add build matrix.

	tests: replace old stat tests with stat.test and stat64.test.
	* tests/stat.c: Replace with a wrapper around lstatx.c
	* tests/stat.test: Replace with a wrapper around statx.sh.
	* tests/stat32-v.test: Remove.
	* tests/stat32.c: Remove.
	* tests/stat64-v.test: Remove.
	* tests/stat64.c: New file.
	* tests/stat64.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Replace stat32 with stat64.
	(stat_CFLAGS): Rename to stat64_CFLAGS.
	(TESTS): Replace stat32-v.test and stat64-v.test with stat64.test.
	* tests/.gitignore: Replace stat32 with stat64.

	tests: add lstat.test and lstat64.test.
	* tests/lstat.c: New file.
	* tests/lstat64.c: Likewise.
	* tests/lstatx.c: Likewise.
	* tests/lstat.test: New test.
	* tests/lstat64.test: Likewise.
	* tests/Makefile.am (check_PROGRAMS): Add lstat and lstat64.
	(lstat64_CFLAGS): Define.
	(TESTS): Add lstat.test and lstat64.test.
	(EXTRA_DIST): Add lstatx.c.
	* tests/.gitignore: Add lstat and lstat64.

	tests: add fstat.test and fstat64.test.
	* tests/fstat.c: New file.
	* tests/fstat64.c: Likewise.
	* tests/fstatx.c: Likewise.
	* tests/fstat.test: New test.
	* tests/fstat64.test: Likewise.
	* tests/Makefile.am (check_PROGRAMS): Add fstat and fstat64.
	(fstat64_CFLAGS): Define.
	(TESTS): Add fstat.test and fstat64.test.
	(EXTRA_DIST): Add fstatx.c.
	* tests/.gitignore: Add fstat and fstat64.

2015-12-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: prepare for detailed testing of stat family syscalls.
	Parametrize code from fstatat.c to support <asm/stat.h>
	as an alternative to <sys/stat.h> and move it to a separate file.

	* tests/statx.sh: New file, based on fstatat64.test.
	* tests/fstatat64.test: Use it.
	* tests/newfstatat.test: Likewise.
	* tests/xstatx.c: New file, based on fstatat.c.
	* tests/fstatat.c: Use it.
	* tests/Makefile.am (EXTRA_DIST): Add statx.sh and xstatx.c.
	* tests/fstatat64.c (FSTATAT_NAME): Change to TEST_SYSCALL_NAME.
	* tests/newfstatat.c: Likewise.

2015-12-04  Gabriel Laskar  <gabriel@lse.epita.fr>

	ioctl: allow to stop decoding number.
	For some ioctls, like from drm, the identification of the correct ioctl
	is done by custom code.  Specifying IOCTL_NUMBER_STOP_LOOKUP on
	return of ioctl_decode_command_number() disables further calls to
	ioctl_lookup().

	* defs.h (IOCTL_NUMBER_UNKNOWN, IOCTL_NUMBER_HANDLED,
	IOCTL_NUMBER_STOP_LOOKUP): Add macros representing ioctl number state
	decoding.
	* ioctl.c (SYS_FUNC(ioctl)): Skip ioctl_lookup() when
	ioctl_decode_command_number() returns a value with
	IOCTL_NUMBER_STOP_LOOKUP flag is set.

	Suggested-by: Patrik Jakobsson <patrik.r.jakobsson@gmail.com>

2015-12-04  Dmitry V. Levin  <ldv@altlinux.org>

	tests: skip restart_syscall.test on x32.
	The syscall number of restart_syscall returned by the kernel in case
	of ERESTART_RESTARTBLOCK is broken on x32 from the beginning, see
	https://lkml.org/lkml/2015/11/30/790

	Until that improves, skip the test on x32.

	* tests/restart_syscall.c (main) [__x86_64__ && __ILP32__]: Return 77.

2015-12-04  Dmitry V. Levin  <ldv@altlinux.org>

	x32: fix decoding of i386 personality lseek syscall.
	On x32, tcp->ext_arg is not initialized for i386 personality,
	so tcp->u_arg has to be used instead.

	* lseek.c (SYS_FUNC(lseek)) [X32]: Handle "current_personality == 1" case.

2015-12-04  Dmitry V. Levin  <ldv@altlinux.org>

	x86_64, x32: add a replacement for <asm/stat.h>
	Some old kernel headers, Ubuntu 14.04 in particular, provide
	<asm/stat.h> editions that are completely wrong for x32.
	Workaround this issue by providing a replacement.

	* linux/x86_64/asm_stat.h: New file.
	* linux/x32/asm_stat.h: Likewise.
	* Makefile.am (strace_SOURCES): Add them.

2015-12-04  Dmitry V. Levin  <ldv@altlinux.org>

	Add a wrapper around <asm/stat.h>
	* linux/asm_stat.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c: Use it.

	kernel_types.h: protect from double inclusion.
	* kernel_types.h: Add #include guard.

2015-12-03  Dmitry V. Levin  <ldv@altlinux.org>

	fstatat64.test: lift /proc requirement.
	While -P option needs /proc to match descriptors, it does not use
	/proc to match pathnames.  As this test does not need descriptor
	match, the /proc requirement can be safely lifted.

	* tests/fstatat64.test: Lift /proc/self/fd/ requirement.

2015-12-02  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add fstatat64.test and newfstatat.test.
	* configure.ac (AC_CHECK_FUNCS): Add fstatat, ftruncate, and futimens.
	* tests/fstatat.c: New file.
	* tests/fstatat64.c: Likewise.
	* tests/newfstatat.c: Likewise.
	* tests/fstatat64.test: New test.
	* tests/newfstatat.test: Likewise.
	* tests/Makefile.am (check_PROGRAMS): Add fstatat64 and newfstatat.
	(fstatat64_CFLAGS, newstatat_CFLAGS): Define.
	(TESTS): Add fstatat64.test and newfstatat.test.
	(EXTRA_DIST): Add fstatat.c.
	* tests/.gitignore: Add fstatat64 and newfstatat.

2015-12-01  Dmitry V. Levin  <ldv@altlinux.org>

	alpha, ppc, sh, sh64: fix fstatat64 syscall entries.
	* linux/alpha/syscallent.h (newfstatat): Change sys_name to fstatat64.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.

	ppc64: clone syscallent.h from ppc.
	* linux/powerpc64/syscallent.h: Clone from linux/powerpc/syscallent.h
	with entries for numbers 192..197, 204, 226, and 254 unassigned.

	tests: add lseek.test and llseek.test.
	* tests/llseek.c: New file.
	* tests/lseek.c: Likewise.
	* tests/llseek.test: New test.
	* tests/lseek.test: Likewise.
	* tests/Makefile.am (check_PROGRAMS): Add llseek and lseek.
	(TESTS): Add llseek.test and lseek.test.
	* tests/.gitignore: Add llseek and lseek.

	tests: add ftruncate64.test and truncate64.test.
	* tests/ftruncate64.c: New file.
	* tests/truncate64.c: Likewise.
	* tests/ftruncate64.test: New test.
	* tests/truncate64.test: Likewise.
	* tests/Makefile.am (check_PROGRAMS): Add ftruncate64 and truncate64.
	(ftruncate64_CFLAGS, truncate64_CFLAGS): Define.
	(TESTS): Add ftruncate64.test and truncate64.test.
	* tests/.gitignore: Add ftruncate64 and truncate64.

	tests: add ftruncate.test and truncate.test.
	* tests/ftruncate.c: New file.
	* tests/truncate.c: Likewise.
	* tests/ftruncate.test: New test.
	* tests/truncate.test: Likewise.
	* tests/Makefile.am (check_PROGRAMS): Add ftruncate and truncate.
	(TESTS): Add ftruncate.test and truncate.test.
	* tests/.gitignore: Add ftruncate and truncate.

2015-11-30  Dmitry V. Levin  <ldv@altlinux.org>

	build: robustify linux/fcntl.h check.
	* configure.ac (AC_CHECK_TYPES): Support older linux kernel headers
	by including <sys/types.h> before <linux/fcntl.h>.

2015-11-30  Dmitry V. Levin  <ldv@altlinux.org>

	syscall.c: move inclusion of arch specific files to the end of file.
	Move inclusion of arch specific files that define static functions to
	the end of syscall.c.

	* syscall.c (get_syscall_result_regs, get_error, getregs_old):
	New forward declarations.
	(arch_get_scno): Move forward.
	Move inclusion of "get_scno.c", "get_syscall_args.c",
	"get_syscall_result.c", "get_error.c", and "getregs_old.c"
	to the end of file.

2015-11-30  Dmitry V. Levin  <ldv@altlinux.org>

	x86_64: change getregs_old to forward ptrace return code.
	* linux/x86_64/getregs_old.c (getregs_old): Change to return ptrace
	return code.
	* syscall.c (get_regs) [ARCH_REGS_FOR_GETREGSET && X86_64]: Use
	getregs_old return code.

2015-11-30  Dmitry V. Levin  <ldv@altlinux.org>

	Cleanup print_pc.
	Apparently, there are only two types of instruction pointer printers
	depending on the architecture: those that print a register that was
	fetched earlier, and those that fetch a register themselves using upeek.
	With this change, architectures of the first type have ARCH_PC_REG
	defined in their arch_regs.c file, architectures of the first type
	have ARCH_PC_PEEK_ADDR defined there, and the common code in syscall.c
	uses these macros to print the instruction pointer.

	* Makefile.am (EXTRA_DIST): Remove linux/*/print_pc.c.
	* linux/*/print_pc.c: Remove.
	* linux/aarch64/arch_regs.c(ARCH_PC_REG): Define macro.
	* linux/arc/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/arm/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/avr32/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/i386/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/ia64/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/metag/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/mips/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/nios2/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/or1k/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/powerpc64/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/powerpc/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/s390/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/s390x/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/sparc64/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/sparc/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/tile/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/x32/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/x86_64/arch_regs.c(ARCH_PC_REG): Likewise.
	* linux/alpha/arch_regs.c(ARCH_PC_PEEK_ADDR): Define macro.
	* linux/bfin/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
	* linux/crisv10/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
	* linux/crisv32/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
	* linux/hppa/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
	* linux/m68k/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
	* linux/microblaze/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
	* linux/sh64/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
	* linux/sh/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
	* linux/xtensa/arch_regs.c(ARCH_PC_PEEK_ADDR): Likewise.
	* syscall.c (print_pc): Stop including "print_pc.c".
	Use ARCH_PC_REG or ARCH_PC_PEEK_ADDR.

2015-11-30  Dmitry V. Levin  <ldv@altlinux.org>

	cleanup: make get_scno.c files more readable.
	Make get_scno.c files more self-contained.  While they are still
	being included by syscall.c, the latter no longer provides
	a function framework for them.

	* linux/aarch64/get_scno.c (arch_get_scno): Define.
	* linux/alpha/get_scno.c: Likewise.
	* linux/arc/get_scno.c: Likewise.
	* linux/arm/get_scno.c: Likewise.
	* linux/avr32/get_scno.c: Likewise.
	* linux/bfin/get_scno.c: Likewise.
	* linux/crisv10/get_scno.c: Likewise.
	* linux/hppa/get_scno.c: Likewise.
	* linux/i386/get_scno.c: Likewise.
	* linux/ia64/get_scno.c: Likewise.
	* linux/m68k/get_scno.c: Likewise.
	* linux/metag/get_scno.c: Likewise.
	* linux/microblaze/get_scno.c: Likewise.
	* linux/mips/get_scno.c: Likewise.
	* linux/nios2/get_scno.c: Likewise.
	* linux/or1k/get_scno.c: Likewise.
	* linux/powerpc/get_scno.c: Likewise.
	* linux/powerpc64/get_scno.c: Likewise.
	* linux/s390/get_scno.c: Likewise.
	* linux/sh/get_scno.c: Likewise.
	* linux/sh64/get_scno.c: Likewise.
	* linux/sparc/get_scno.c: Likewise.
	* linux/sparc64/get_scno.c: Likewise.
	* linux/tile/get_scno.c: Likewise.
	* linux/x86_64/get_scno.c: Likewise.
	* linux/xtensa/get_scno.c: Likewise.
	* syscall.c (arch_get_scno): New declaration.
	Include "get_scno.c" in file scope.
	(get_scno): Use arch_get_scno.

	Requested-by: Denys Vlasenko <dvlasenk@redhat.com>

2015-11-30  Dmitry V. Levin  <ldv@altlinux.org>

	cleanup: make get_syscall_args.c files more readable.
	Make get_syscall_args.c files more self-contained.  While they are
	still being included by syscall.c, the latter no longer defines
	get_syscall_args function.

	* linux/aarch64/get_syscall_args.c: Include "arm/get_syscall_args.c"
	with get_syscall_args temporarily defined to arm_get_syscall_args.
	(get_syscall_args): Define.
	* linux/alpha/get_syscall_args.c (get_syscall_args): Define.
	* linux/arc/get_syscall_args.c: Likewise.
	* linux/arm/get_syscall_args.c: Likewise.
	* linux/avr32/get_syscall_args.c: Likewise.
	* linux/bfin/get_syscall_args.c: Likewise.
	* linux/crisv10/get_syscall_args.c: Likewise.
	* linux/hppa/get_syscall_args.c: Likewise.
	* linux/i386/get_syscall_args.c: Likewise.
	* linux/ia64/get_syscall_args.c: Likewise.
	* linux/m68k/get_syscall_args.c: Likewise.
	* linux/metag/get_syscall_args.c: Likewise.
	* linux/microblaze/get_syscall_args.c: Likewise.
	* linux/mips/get_syscall_args.c: Likewise.
	* linux/nios2/get_syscall_args.c: Likewise.
	* linux/or1k/get_syscall_args.c: Likewise.
	* linux/powerpc/get_syscall_args.c: Likewise.
	* linux/s390/get_syscall_args.c: Likewise.
	* linux/sh/get_syscall_args.c: Likewise.
	* linux/sh64/get_syscall_args.c: Likewise.
	* linux/sparc/get_syscall_args.c: Likewise.
	* linux/tile/get_syscall_args.c: Likewise.
	* linux/x86_64/get_syscall_args.c: Likewise.
	* linux/xtensa/get_syscall_args.c: Likewise.
	* syscall.c (get_syscall_args): Remove.
	Include "get_syscall_args.c" in file scope.

	Requested-by: Denys Vlasenko <dvlasenk@redhat.com>

2015-11-30  Dmitry V. Levin  <ldv@altlinux.org>

	cleanup: make get_syscall_result.c files more readable.
	Make get_syscall_result.c files more self-contained.  While they are
	still being included by syscall.c, the latter no longer provides
	a function framework for them.

	* linux/alpha/get_syscall_result.c (get_syscall_result_regs): Define.
	* linux/bfin/get_syscall_result.c: Likewise.
	* linux/crisv10/get_syscall_result.c: Likewise.
	* linux/hppa/get_syscall_result.c: Likewise.
	* linux/m68k/get_syscall_result.c: Likewise.
	* linux/microblaze/get_syscall_result.c: Likewise.
	* linux/sh/get_syscall_result.c: Likewise.
	* linux/sh64/get_syscall_result.c: Likewise.
	* linux/xtensa/get_syscall_result.c: Likewise.
	* syscall.c [!ARCH_REGS_FOR_GETREGSET && !ARCH_REGS_FOR_GETREGS]:
	Define USE_GET_SYSCALL_RESULT_REGS macro.
	[USE_GET_SYSCALL_RESULT_REGS]: Include "get_syscall_result.c".
	(get_syscall_result) [USE_GET_SYSCALL_RESULT_REGS]: Stop including
	"get_syscall_result.c".  Call get_syscall_result_regs.

	Requested-by: Denys Vlasenko <dvlasenk@redhat.com>

2015-11-29  Dmitry V. Levin  <ldv@altlinux.org>

	cleanup: make get_error.c files more readable.
	Make get_error.c files more self-sustained.  While they are still being
	included by syscall.c, the latter no longer defines get_error function.

	* linux/aarch64/get_error.c: Include "arm/get_error.c" with get_error
	temporarily defined to arm_get_error.
	(get_error): Define.
	* linux/alpha/get_error.c (get_error): Define.
	* linux/arc/get_error.c: Likewise.
	* linux/arm/get_error.c: Likewise.
	* linux/avr32/get_error.c: Likewise.
	* linux/bfin/get_error.c: Likewise.
	* linux/crisv10/get_error.c: Likewise.
	* linux/hppa/get_error.c: Likewise.
	* linux/i386/get_error.c: Likewise.
	* linux/ia64/get_error.c: Likewise.
	* linux/m68k/get_error.c: Likewise.
	* linux/metag/get_error.c: Likewise.
	* linux/microblaze/get_error.c: Likewise.
	* linux/mips/get_error.c: Likewise.
	* linux/nios2/get_error.c: Likewise.
	* linux/or1k/get_error.c: Likewise.
	* linux/powerpc/get_error.c: Likewise.
	* linux/s390/get_error.c: Likewise.
	* linux/sh/get_error.c: Likewise.
	* linux/sh64/get_error.c: Likewise.
	* linux/sparc/get_error.c: Likewise.
	* linux/sparc64/get_error.c: Likewise.
	* linux/tile/get_error.c: Likewise.
	* linux/x86_64/get_error.c: Likewise.
	* linux/xtensa/get_error.c: Likewise.
	* syscall.c: Include "get_error.c" in file scope.
	(get_error): Remove.  Move arch independent code ...
	(get_syscall_result): ... here.  Update get_error invocation.

	Requested-by: Denys Vlasenko <dvlasenk@redhat.com>

2015-11-28  Dmitry V. Levin  <ldv@altlinux.org>

	cleanup: make arch_sigreturn.c files more readable.
	Make arch_sigreturn.c files more self-sustained.  While they are
	still being included by sigreturn.c, the latter no longer defines
	arch_sigreturn function.

	* linux/alpha/arch_sigreturn.c (arch_sigreturn): Define.
	* linux/arm/arch_sigreturn.c: Likewise.
	* linux/crisv10/arch_sigreturn.c: Likewise.
	* linux/i386/arch_sigreturn.c: Likewise.
	* linux/ia64/arch_sigreturn.c: Likewise.
	* linux/m68k/arch_sigreturn.c: Likewise.
	* linux/microblaze/arch_sigreturn.c: Likewise.
	* linux/mips/arch_sigreturn.c: Likewise.
	* linux/powerpc/arch_sigreturn.c: Likewise.
	* linux/s390/arch_sigreturn.c: Likewise.
	* linux/sparc/arch_sigreturn.c: Likewise.
	* linux/tile/arch_sigreturn.c: Likewise.
	* linux/x32/arch_sigreturn.c: Remove code.
	Include "x86_64/arch_sigreturn.c".
	* linux/x86_64/arch_sigreturn.c: Stop including "x32/arch_sigreturn.c".
	Include "i386/arch_sigreturn.c" with arch_sigreturn temporarily defined
	to i386_arch_sigreturn.
	(arch_sigreturn): Define.  Add x32 personality support there.
	* sigreturn.c: Remove arch_sigreturn header and footer.

	Requested-by: Denys Vlasenko <dvlasenk@redhat.com>

2015-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	Add initial Travis CI support.
	* .travis.yml: New file.
	* travis-ci.sh: Likewise.

2015-11-27  Dmitry V. Levin  <ldv@altlinux.org>

	tests: remove temporary files left after two tests.
	* tests/net-yy.test: Remove "$LOG"-connect and "$LOG"-accept.
	* tests/unix-yy.test: Likewise.

2015-11-27  Dmitry V. Levin  <ldv@altlinux.org>

	tests: skip stat32-v.test on x32.
	Explicitly skip 32-bit stat test on x32 even if libc pretends
	to support it.

	* tests/stat.c (main) [__x86_64__ && __ILP32__]: Skip.

2015-11-27  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix ipc_msgbuf.test on x32.
	* tests/ipc_msgbuf.c: Include "config.h" and "kernel_types.h".
	(main): Replace "long" with "kernel_long_t" in struct msgbuf.

	x32: fix pselect6 decoding.
	* desc.c: Include "kernel_types.h".
	(umove_kulong_array_or_printaddr): New function.
	(SYS_FUNC(pselect6)): Use it.

	x32: fix sigreturn decoding.
	* linux/x32/arch_sigreturn.c: Implement x32_rt_sigreturn decoding.
	* linux/x86_64/arch_sigreturn.c: Handle (current_personality == 0)
	case only.
	Include "x32/arch_sigreturn.c" instead of "i386/arch_sigreturn.c".

	x32: fix struct dirent decoding.
	* kernel_types.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* configure.ac (AC_CHECK_TYPES): Check for __kernel_long_t
	and __kernel_ulong_t in <asm/posix_types.h>.
	* dirent.c: Stop including <dirent.h>.
	(kernel_dirent): Remove.
	Include "kernel_types.h".
	(print_old_dirent, SYS_FUNC(getdents)): Print variables
	of kernel_ulong_t type using %Lu format.
	* syscall.c (kernel_long_t, kernel_ulong_t): Remove.
	Include "kernel_types.h".
	* tests/getdents.c (kernel_dirent): Remove.
	Include "kernel_types.h".
	(print_dirent): Print variables of kernel_ulong_t type using %Lu format.

2015-11-26  Elvira Khabirova  <lineprinter0@gmail.com>

	Refer to -h on incorrect usage.
	* defs.h (error_msg_and_help): New prototype.
	* strace.c (error_msg_and_help): New function.
	(error_opt_arg, init): Use it.
	(usage): Remove unnecessary arguments.
	* count.c: Use the new function.

	Rearrange flags descriptions in the usage text.
	* strace.c (usage): Rearrange descriptions.
	* tests/strace-k.test: Change the option detecting regexp accordingly.

2015-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests: run in "set -x" mode if VERBOSE variable is non-null.
	* tests/init.sh: Enter "set -x" mode if $VERBOSE is non-null.

2015-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix match_diff usage.
	Fix argument order in match_diff invocations:
	the first argument has to be actual output,
	the second argument has to be expected output.

	* tests/aio.test: Swap match_diff arguments.
	* tests/clock_nanosleep.test: Likewise.
	* tests/clock_xettime.test: Likewise.
	* tests/file_handle.test: Likewise.
	* tests/getdents.test: Likewise.
	* tests/getdents64.test: Likewise.
	* tests/getrandom.test: Likewise.
	* tests/inet-cmsg.test: Likewise.
	* tests/ioctl.test: Likewise.
	* tests/membarrier.test: Likewise.
	* tests/mlock2.test: Likewise.
	* tests/nanosleep.test: Likewise.
	* tests/pselect6.test: Likewise.
	* tests/readdir.test: Likewise.
	* tests/readlink.test: Likewise.
	* tests/readlinkat.test: Likewise.
	* tests/rt_sigqueueinfo.test: Likewise.
	* tests/seccomp.test: Likewise.
	* tests/select.test: Likewise.
	* tests/sendfile.test: Likewise.
	* tests/sendfile64.test: Likewise.
	* tests/struct_flock.test: Likewise.
	* tests/sysinfo.test: Likewise.
	* tests/time.test: Likewise.
	* tests/timer_create.test: Likewise.
	* tests/timer_xettime.test: Likewise.
	* tests/timerfd_xettime.test: Likewise.
	* tests/times-fail.test: Likewise.
	* tests/times.test: Likewise.
	* tests/umovestr2.test: Likewise.
	* tests/userfaultfd.test: Likewise.
	* tests/utime.test: Likewise.
	* tests/utimensat.test: Likewise.
	* tests/xet_robust_list.test: Likewise.
	* tests/xetitimer.test: Likewise.
	* tests/xettimeofday.test: Likewise.

2015-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	x86_64: fix x32 personality support in print_llu_from_low_high_val.
	x86 is the only personality supported on x86_64
	that has 32-bit syscall arguments.

	* io.c (print_llu_from_low_high_val) [X86_64]: Fix
	current_personality == 2 case.

2015-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	x86_64: fix x32 personality support in getllval.
	x86 is the only personality supported on x86_64
	that has 32-bit syscall arguments.

	* util.c (getllval) [X86_64]: Fix current_personality == 2 case.

2015-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests/file_handle: fix expected output.
	* tests/file_handle.c (main): Parametrize handle_type
	in open_by_handle_at parser output.

	startup_attach: fix compilation warning.
	* strace.c (startup_attach): Split single error_msg statement with
	variable number of arguments to silence a compilation warning.

2015-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	.gitignore: add mpers_xlat.h.
	Ignore mpers_xlat.h generated since commit v4.10-454-g5cb45b2.

	* .gitignore: Add /mpers_xlat.h.

	Reported-by: Elvira Khabirova <lineprinter0@gmail.com>

2015-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add struct_flock.test.
	* tests/struct_flock.c: New file.
	* tests/struct_flock.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add struct_flock.
	(TESTS): Add struct_flock.test.
	* tests/.gitignore: Add struct_flock.

	Convert parsers of flock structures to new mpers infrastructure.
	* fetch_struct_flock.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* fcntl.c (print_struct_flock64): New function.
	(printflock64): Use fetch_struct_flock64 and print_struct_flock64.
	(printflock): Use fetch_struct_flock and print_struct_flock64.

	fcntl.c: implement decoding for all known operations.
	* xlat/f_owner_types.in: New file.
	* xlat/f_seals.in: Likewise.
	* fcntl.c: Include "xlat/f_owner_types.h" and "xlat/f_seals.h".
	(print_f_owner_ex): New function.
	(SYS_FUNC(fcntl)): Use it.
	Handle F_SETPIPE_SZ, F_GETPIPE_SZ, F_OFD_SETLKW,
	F_OFD_SETLK, F_SETOWN_EX, F_ADD_SEALS, F_SETSIG,
	F_OFD_GETLK, F_GETOWN_EX, F_GET_SEALS, F_GETSIG.

	fcntl.c: mark F_DUPFD and F_DUPFD_CLOEXEC return code with RVAL_FD flag.
	* fcntl.c (SYS_FUNC(fcntl)): Set RVAL_FD flag in the return code
	for F_DUPFD and F_DUPFD_CLOEXEC operations.

	fcntl.c: remove redundant ifdefs.
	* fcntl.c (USE_PRINTFLOCK64): Remove macro.
	(printflock64): Define unconditionally.
	(SYS_FUNC(fcntl)): Do not check for USE_PRINTFLOCK64,
	F_DUPFD_CLOEXEC, F_NOTIFY, F_SETLEASE, and F_GETLEASE macros.

	Update F_* constants.
	* xlat/fcntlcmds.in: Add F_SETOWN_EX, F_GETOWN_EX, F_GETOWNER_UIDS,
	F_OFD_GETLK, F_OFD_SETLK, F_OFD_SETLKW, and F_CANCELLK.
	Remove F_ALLOCSP, F_BLKSIZE, F_BLOCKS, F_CHKFL, F_CNVT, F_DUP2FD,
	F_ISSTREAM, F_NPRIV, F_PRIV, F_QUOTACL, F_REVOKE, F_RGETLK, F_RSETLK,
	F_RSETLKW, F_SHARE, and F_UNSHARE.
	Add default values.

	Update LOCK_* constants.
	* xlat/flockcmds.in: Add LOCK_MAND, LOCK_READ, LOCK_WRITE, and LOCK_RW.
	Add default values.

2015-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	fcntl.c: use <linux/fcntl.h> instead of <fcntl.h>
	Include <linux/fcntl.h> for proper definitions of F_* constants
	and flock structures.

	* configure.ac (AC_CHECK_TYPES): Check for struct flock, struct flock64,
	struct __kernel_flock, and struct __kernel_flock64 in <linux/fcntl.h>.
	* flock.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* fcntl.c: Include it instead of <fcntl.h>.
	(struct flock64): Remove.
	(printflock): Use struct_kernel_flock instead of struct flock.
	(printflock64): Use struct_kernel_flock64 instead of struct flock64.

2015-11-26  Elvira Khabirova  <lineprinter0@gmail.com>

	mpers: fix compound types with arbitrary member alignments.
	* mpers.sh: Compound types are now represented as packed
	with character arrays as explicit fillers inbetween members
	and at the end.

2015-11-26  Mike Frysinger  <vapier@gentoo.org>

	Support C libraries without System V shared memory/ipc.
	Some systems (like Bionic) omit support for SysV related code.  That
	means no C library headers for strace to include.  Add configure tests
	to probe the headers from the kernel and use them when they are
	available.

	It might make more sense to never rely on the C library's headers as
	there is no guarantee or requirement that the structure layout between
	apps and the C library match that what is passed to the kernel.

	* configure.ac (AC_CHECK_HEADERS): Check for linux/ipc.h,
	linux/mqueue.h, linux/msg.h, linux/sem.h, linux/shm.h,
	sys/ipc.h, sys/msg.h, sys/sem.h, and sys/shm.h.
	* ipc_defs.h: Include <sys/ipc.h> or <linux/ipc.h> depending
	on what is available.
	* ipc_msg.c: Replace <sys/ipc.h> with "ipc_defs.h".
	Fallback to <linux/msg.h> when available.
	* ipc_msgctl.c: Include <sys/msg.h>, <asm/msgbuf.h>, or <linux/msg.h>
	based on what is available.  Note missing support for old ipc structs.
	* ipc_sem.c: Include <sys/sem.h> or <linux/sem.h> depending
	on what is available.  Only decode sembuf when available.
	* ipc_shm.c: Fallback to <linux/shm.h> when available.
	* ipc_shmctl.c: Include <sys/shm.h>, <asm/shmbuf.h>, or <linux/shm.h>
	based on what is available.  Note missing support for old ipc structs.
	* print_mq_attr.c: Fallback to <linux/mqueue.h> when available.

2015-11-25  Dmitry V. Levin  <ldv@altlinux.org>

	CREDITS.in: add Jian Zhen.
	Thanks to Jian Zhen for donation of https://github.com/strace/ and
	strace.io.

	* CREDITS.in: Add Jian Zhen.

2015-11-24  Dmitry V. Levin  <ldv@altlinux.org>

	Fix syscall entries of unimplemented getpmsg and putpmsg syscalls.
	* linux/ia64/syscallent.h (getpmsg): Change SEN(printargs)
	to SEN(getpmsg).
	(putpmsg): Change SEN(printargs) to SEN(putpmsg).
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/arm/syscallent.h (getpmsg, putpmsg): Set sys_flags to TN.
	* linux/bfin/syscallent.h (getpmsg, putpmsg): Likewise.
	* linux/hppa/syscallent.h (getpmsg, putpmsg): Likewise.
	* linux/i386/syscallent.h (getpmsg, putpmsg): Likewise.
	* linux/m68k/syscallent.h (getpmsg, putpmsg): Likewise.
	* linux/microblaze/syscallent.h (getpmsg, putpmsg): Likewise.
	* linux/powerpc/syscallent.h (getpmsg, putpmsg): Likewise.
	* linux/s390/syscallent.h (getpmsg, putpmsg): Likewise.
	* linux/s390x/syscallent.h (getpmsg, putpmsg): Likewise.
	* linux/x32/syscallent.h (getpmsg, putpmsg): Likewise.
	* linux/x86_64/syscallent.h (getpmsg, putpmsg): Likewise.

2015-11-24  Dmitry V. Levin  <ldv@altlinux.org>

	Remove parsers of getpmsg and putpmsg syscalls.
	These system calls are not implemented in the Linux kernel.

	* linux/dummy.h(getpmsg, putpmsg): Move to the list of deprecated
	syscalls.
	* Makefile.am (strace_SOURCES): Remove stream.c.
	* stream.c: Remove.
	* xlat/pmsgflags.in: Remove.

2015-11-24  Dmitry V. Levin  <ldv@altlinux.org>

	Remove parser of query_module syscall.
	Since query_module syscall is present only in kernels before Linux 2.6
	and strace does not support those kernels, there is no use to keep this
	parser any longer.

	* bjm.c: Do not include <sys/*>, "xlat/qm_which.h",
	and "xlat/modflags.h".
	(MOD_*, QM_*, module_symbol, module_info, SYS_FUNC(query_module)):
	Remove.
	* linux/dummy.h (sys_query_module): Add stub alias.
	* xlat/modflags.in: Remove.
	* xlat/qm_which.in: Remove.

2015-11-24  Dmitry V. Levin  <ldv@altlinux.org>

	Fix syscall entries of deprecated sysfs syscall.
	* linux/alpha/syscallent.h (sysfs): Change nargs from 5 to 3.
	* linux/hppa/syscallent.h (sysfs): Likewise.
	* linux/mips/syscallent-n32.h (sysfs): Likewise.
	* linux/mips/syscallent-n64.h (sysfs): Likewise.

	Move sysfs syscall to deprecated category.
	* linux/dummy.h (sys_sysfs): Move to the list of deprecated syscalls.

	Fix syscall entries of deprecated bdflush syscall.
	* linux/alpha/syscallent.h (bdflush): Change nargs from 0 to 2.
	* linux/arm/syscallent.h (bdflush): Likewise.
	* linux/avr32/syscallent.h (bdflush): Likewise.
	* linux/bfin/syscallent.h (bdflush): Likewise.
	* linux/hppa/syscallent.h (bdflush): Likewise.
	* linux/i386/syscallent.h (bdflush): Likewise.
	* linux/ia64/syscallent.h (bdflush): Likewise.
	* linux/m68k/syscallent.h (bdflush): Likewise.
	* linux/microblaze/syscallent.h (bdflush): Likewise.
	* linux/powerpc/syscallent.h (bdflush): Likewise.
	* linux/s390/syscallent.h (bdflush): Likewise.
	* linux/s390x/syscallent.h (bdflush): Likewise.
	* linux/sh/syscallent.h (bdflush): Likewise.
	* linux/sh64/syscallent.h (bdflush): Likewise.
	* linux/sparc/syscallent.h (bdflush): Likewise.

2015-11-22  Dmitry V. Levin  <ldv@altlinux.org>

	Implement name_to_handle_at and open_by_handle_at syscalls decoding.
	* file_handle.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* linux/dummy.h (sys_name_to_handle_at, sys_open_by_handle_at):
	Remove stub aliases.
	* pathtrace.c (pathtrace_match): Add SEN_name_to_handle_at.
	* tests/file_handle.c: New file.
	* tests/file_handle.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add file_handle.
	(TESTS): Add file_handle.test.
	* tests/.gitignore: Add file_handle.

	Implement lookup_dcookie syscall decoding.
	* lookup_dcookie.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* linux/dummy.h (sys_lookup_dcookie): Remove stub alias.

	Implement kexec_file_load syscall decoding.
	* xlat/kexec_file_load_flags.in: New file.
	* kexec.c: Include "xlat/kexec_file_load_flags.h".
	(SYS_FUNC(kexec_file_load)): New function.
	* linux/dummy.h (sys_kexec_file_load): Remove stub alias.
	* pathtrace.c (pathtrace_match): Add SEN_kexec_file_load.

	Implement kcmp syscall decoding.
	* kcmp.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* linux/dummy.h (sys_kcmp): Remove stub alias.
	* xlat/kcmp_types.in: New file.

	Implement iopl syscall decoding.
	* iopl.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* linux/dummy.h (sys_iopl): Remove stub alias.

	Implement ioperm syscall decoding.
	* ioperm.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* linux/dummy.h (sys_ioperm): Remove stub alias.

	net: fix printing of IP_RECVOPTS/IP_RETOPTS cmsg options.
	* net.c (print_cmsg_ip_opts): Print each byte as unsigned char.

	userfaultfd: fix pathtrace support.
	* pathtrace.c (pathtrace_match): Add SEN_userfaultfd.

2015-11-22  Dmitry V. Levin  <ldv@altlinux.org>

	Implement IPPROTO_IP control messages decoding.
	* net.c: Include "xlat/ip_cmsg_types.h".
	(print_cmsg_ip_pktinfo, print_cmsg_ip_ttl, print_cmsg_ip_tos,
	print_cmsg_ip_opts, print_cmsg_ip_recverr, print_cmsg_ip_checksum,
	print_cmsg_ip_origdstaddr): New functions.
	(print_cmsg_type_data): Add generic SOL_IP level decoding.
	Use these functions for decoding of IP_PKTINFO, IP_TTL, IP_TOS,
	IP_RECVOPTS, IP_RETOPTS, IP_RECVERR, IP_ORIGDSTADDR, IP_CHECKSUM,
	and SCM_SECURITY type messages.
	* xlat/ip_cmsg_types.in: New file.
	* xlat/sockipoptions.in: Move IP_RETOPTS before IP_RECVRETOPTS.
	* tests/inet-cmsg.c: New file.
	* tests/inet-cmsg.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add inet-cmsg.
	(TESTS): Add inet-cmsg.test.
	* tests/.gitignore: Add inet-cmsg.

	Suggested-by: Orion Poplawski <orion@cora.nwra.com>

2015-11-22  Dmitry V. Levin  <ldv@altlinux.org>

	Simplify control messages printers.
	Do not pass sizeof(struct cmsghdr) to every cmsg printer.

	* net.c (printcmsghdr): Pass pointer to cmsg_data and length
	of cmsg_data to print_cmsg_type_data.
	(print_cmsg_type_data): Update prototype.  Pass pointer to cmsg_data
	and length of cmsg_data to cmsg printers.
	(print_scm_rights, print_scm_creds, print_scm_security): Update.

2015-11-21  Dmitry V. Levin  <ldv@altlinux.org>

	net: factor out address printing code to a separate function.
	* net.c (sockaddr_buf_t): New type.
	(print_sockaddr): New function.
	(printsock, print_group_req): Use it.

2015-11-20  Dmitry V. Levin  <ldv@altlinux.org>

	mpers: skip xlat struct definitions in mpers mode.
	Avoid duplicate definitions of xlat structures in files
	compiled in mpers mode.

	Each xlat file defines the corresponding xlat struct with
	either global or local visibility using the following rules:

	- if xlat struct declaration is available in defs.h,
	  a global definition is provided in regular mode,
	  and nothing is provided in mpers mode;
	- otherwise, if xlat file is included by a mpers source file,
	  a global definition is provided in regular mode
	  (unless no mpers mode is supported on this architecture,
	  in that case, a local definition is provided instead),
	  and a declaration is provided in mpers mode;
	- otherwise, a local definition is provided in regular mode,
	  and an error message is printed in mpers mode.

	Fallback definitions of constants provided by xlat files
	remain available in all modes.

	* bootstrap: Invoke generate_mpers_am.sh before xlat/gen.sh.
	* defs.h (adjtimex_modes, adjtimex_status, sigev_value): Remove.
	* generate_mpers_am.sh: Generate mpers_xlat.h.
	* Makefile.am (EXTRA_DIST): Add mpers_xlat.h.
	* print_sigevent.c: Include "xlat/sigev_value.h" unconditionally.
	* print_timex.c: Include "xlat/adjtimex_modes.h" and
	"xlat/adjtimex_status.h" unconditionally.
	* xlat/gen.sh (cond_xlat): Move printing of fallback definitions ...
	(cond_def): ... here.
	(gen_header): Check also mpers_xlat.h for global declarations
	of xlat structures.
	Process input file twice, first time print directives
	only, second time print everything.
	Wrap struct xlat into #ifdef IN_MPERS ... #else ... #endif.
	* xlat/getrandom_flags.in: Cleanup.

2015-11-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rewrite getdents test in C for better coverage.
	* tests/getdents.awk: Remove.
	* tests/getdents.out: Remove.
	* tests/getdents.c: New file.
	* tests/getdents.test: Rewrite.
	* tests/getdents64.c: New file.
	* tests/getdents64.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add getdents and getdents64.
	(TESTS): Add getdents64.test.
	(EXTRA_DIST): Remove getdents.awk and getdents.out.
	* tests/.gitignore: Add getdents and getdents64.

2015-11-19  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add readdir.test.
	* tests/readdir.c: New file.
	* tests/readdir.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add readdir.
	(TESTS): Add readdir.test.
	* tests/.gitignore: Add readdir.

	Mpersify parsers of readdir and getdents syscalls.
	* defs.h (dirent_types): New xlat prototype.
	* dirent.c: Stop including "xlat/direnttypes.h".
	(kernel_dirent): New typedef.  Mpersify it.
	(print_old_dirent): Use it instead of old_dirent_t.
	(SYS_FUNC(getdents)): Use it instead of struct kernel_dirent.
	Rename direnttypes to dirent_types.
	(SYS_FUNC(getdents64)): Move ...
	* dirent64.c: ... here.  Rename direnttypes to dirent_types.
	Include "xlat/dirent_types.h".
	* Makefile.am (strace_SOURCES): Add dirent64.c.
	* xlat/direnttypes.in: Rename to xlat/dirent_types.in.

2015-11-19  Gabriel Laskar  <gabriel@lse.epita.fr>

	getdents: fix typos in array output.
	Array should be enclosed by square brakets, and elements should be
	separated by commas.

	* dirent.c (SYS_FUNC(getdents), SYS_FUNC(getdents64)): Fix typos
	in array output.
	* tests/getdents.awk: Update regexps to match fixed output.
	* tests/getdents.out: Update output.

2015-11-19  Dmitry V. Levin  <ldv@altlinux.org>

	printcmsghdr: move type and data decoders to a separate function.
	* net.c (print_scm_rights, print_scm_creds, print_scm_security): Change
	to return void.  Move printing of struct cmsghdr closing '}' ...
	(printcmsghdr): ... here.  Move type and data decoders to ...
	(print_cmsg_type_data): ... new function.

2015-11-18  Dmitry V. Levin  <ldv@altlinux.org>

	Assume that libc provides sendmsg.
	Starting with commit v4.6-281-g7af9f35, we implicitly assume that
	HAVE_SENDMSG is always defined.  Therefore, the check for sendmsg
	availability is redundant and could be safely removed.

	* configure.ac (AC_CHECK_FUNCS): Remove sendmsg.
	* linux/dummy.h [!HAVE_SENDMSG] (sys_recvmsg, sys_sendmsg): Remove
	stub aliases.
	* net.c [HAVE_SENDMSG]: Define unconditionally.
	* syscall.c (dumpio) [HAVE_SENDMSG]: Likewise.

2015-11-18  Dmitry V. Levin  <ldv@altlinux.org>

	net.c: move fallback definition of SCM_SECURITY to xlat/
	* net.c: Move fallback definition of SCM_SECURITY ...
	* xlat/scmvals.in: ... here.

2015-11-17  Dmitry V. Levin  <ldv@altlinux.org>

	Implement mlock2 syscall decoding.
	* mem.c: Include "xlat/mlock_flags.h".
	(SYS_FUNC(mlock2)): New function.
	* xlat/mlock_flags.in: New file.
	* xlat/mlockall_flags.in: Add MCL_ONFAULT, add default values.
	* linux/dummy.h (mlock2): Remove.
	* tests/mlock2.c: New file.
	* tests/mlock2.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add mlock2.
	(TESTS): Add mlock2.test.
	* tests/.gitignore Add mlock2.

	Implement membarrier syscall decoding.
	* membarrier.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* xlat/membarrier_cmds.in: New file.
	* linux/dummy.h (membarrier): Remove.
	* tests/membarrier.c: New file.
	* tests/membarrier.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add membarrier.
	(TESTS): Add membarrier.test.
	* tests/.gitignore: Add membarrier.

	Implement userfaultfd syscall decoding.
	* userfaultfd.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* xlat/uffd_flags.in: New file.
	* linux/dummy.h (userfaultfd): Remove.
	* tests/userfaultfd.c: New file.
	* tests/userfaultfd.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add userfaultfd.
	(TESTS): Add userfaultfd.test.
	* tests/.gitignore: Add userfaultfd.

2015-11-17  Dmitry V. Levin  <ldv@altlinux.org>

	ia64: wire up kcmp syscall.
	ia64 has kcmp syscall starting with linux kernel commit
	v4.3-rc7-1-gd305c47.

	* linux/ia64/syscallent.h (kcmp): New entry.

2015-11-17  Dmitry V. Levin  <ldv@altlinux.org>

	powerpc: wire up direct sysv ipc syscalls.
	Starting with linux commit v4.3-rc3-33-ga342361, powerpc has
	direct sysv ipc syscalls in addition to traditional ipc syscall.

	* linux/powerpc/syscallent.h (semop, semget, semctl, semtimedop, msgsnd,
	msgrcv, msgget, msgctl, shmat, shmdt, shmget, shmctl): New entries.

2015-11-17  Dmitry V. Levin  <ldv@altlinux.org>

	Wire up userfaultfd, membarrier, and mlock2 syscalls.
	* linux/dummy.h (membarrier, mlock2, userfaultfd): New stub aliases.
	* linux/32/syscallent.h (userfaultfd, membarrier, mlock2): New entries.
	* linux/64/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
	* linux/arm/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
	* linux/hppa/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
	* linux/i386/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
	* linux/ia64/syscallent.h (userfaultfd, membarrier): Likewise.
	* linux/m68k/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
	* linux/microblaze/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
	* linux/mips/syscallent-n32.h (userfaultfd, membarrier, mlock2): Likewise.
	* linux/mips/syscallent-n64.h (userfaultfd, membarrier, mlock2): Likewise.
	* linux/mips/syscallent-o32.h (userfaultfd, membarrier, mlock2): Likewise.
	* linux/powerpc/syscallent.h (userfaultfd, membarrier): Likewise.
	* linux/s390/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
	* linux/s390x/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
	* linux/sparc/syscallent.h (membarrier, userfaultfd, mlock2): Likewise.
	* linux/x32/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.
	* linux/x86_64/syscallent.h (userfaultfd, membarrier, mlock2): Likewise.

2015-11-16  Dmitry V. Levin  <ldv@altlinux.org>

	sprintflags: skip zero flags.
	Tweak sprintflags behaviour to match printflags.

	* util.c (sprintflags): Skip zero flags unless the value passed
	to sprintflags is also zero.

2015-11-16  Mike Frysinger  <vapier@gentoo.org>

	printflags: handle empty xlats.
	If the set of headers are unable to produce a valid list, printflags
	will try to pass NULL to tprints which crashes.  Add a sanity check
	for this edge case.

	* util.c (printflags): Check xlat->str is not NULL.

2015-11-16  Dmitry V. Levin  <ldv@altlinux.org>

	mpers: forward mpers_DEFS to mpers.sh.
	mpers_DEFS has to be forwarded to mpers.sh so that config.h would be
	properly included by defs.h at preprocessor stage.

	* Makefile.am (mpers-m%.stamp): Add the whole $(mpers_sh_opts) set of
	options to mpers.sh's CPPFLAGS.

2015-11-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests/ioctl: workaround glibc ioctl wrapper on powerpc.
	* tests/ioctl.c (main) [POWERPC] Disable TCGETS test.

2015-11-15  Dmitry V. Levin  <ldv@altlinux.org>

	powerpc: wire up switch_endian syscall.
	powerpc has switch_endian syscall starting with linux commit
	v4.0-rc4-67-g529d235.

	* linux/powerpc/syscallent.h (switch_endian): New entry.

2015-11-15  Dmitry V. Levin  <ldv@altlinux.org>

	sparc: reserve more space for new syscalls.
	Move socket subcalls further down the table to make room
	for new syscalls.

	* linux/sparc/syscallent.h (SYS_socket_subcall): Raise from 353 to 400.

2015-11-15  Dmitry V. Levin  <ldv@altlinux.org>

	m68k: wire up direct socket syscalls.
	Starting with linux commit v4.3-rc3-1-g5b3f33e, m68k has direct
	socket syscalls in addition to traditional socketcall syscall.

	* linux/m68k/syscallent.h (socket, socketpair, bind, connect, listen,
	accept4, getsockopt, setsockopt, getsockname, getpeername, sendto,
	sendmsg, recvfrom, recvmsg, shutdown, recvmmsg, sendmmsg): New entries.

2015-11-15  Dmitry V. Levin  <ldv@altlinux.org>

	i386: wire up direct socket syscalls.
	Starting with linux commit v4.2-rc1-64-g9dea5dc, x86 has direct
	socket syscalls in addition to traditional socketcall syscall.

	* linux/i386/syscallent.h (socket, socketpair, bind, connect, listen,
	accept4, getsockopt, setsockopt, getsockname, getpeername, sendto,
	sendmsg, recvfrom, recvmsg, shutdown): New entries.

2015-11-11  Heiko Carstens  <heiko.carstens@de.ibm.com>

	s390, s390x: update syscall tables.
	* linux/s390/syscallent.h: Add new syscalls available with kernel 4.3.0.
	* linux/s390x/syscallent.h: Likewise.

2015-11-07  Dmitry V. Levin  <ldv@altlinux.org>

	Fix *_printer_defs.h rules ambiguousness.
	There is an ambiguousness in *_printer_defs.h rules definition:

	$ grep '^[^ ]*_defs\.h: ' Makefile.am
	m%_defs.h: $(srcdir_mpers_source_files)
	%_printer_defs.h: $(srcdir_mpers_source_files)

	While it appears to work with GNU make, it has to be fixed nevertheless.

	* Makefile.am (m%_defs.h): Rename to m%_type_defs.h.
	(mpers_m32_targets): Rename m32_defs.h to m32_type_defs.h.
	(mpers_mx32_targets): Rename mx32_defs.h to mx32_type_defs.h.
	* mpers_type.h: Rename m32_defs.h to m32_type_defs.h,
	mx32_defs.h to mx32_type_defs.h.
	* .gitignore: Likewise.

	Reported-by: Elliott Hughes <enh@google.com>

2015-10-09  Dmitry V. Levin  <ldv@altlinux.org>

	fcntl.c: make use of RVAL_DECODED.
	* fcntl.c (SYS_FUNC(fcntl)): Return RVAL_DECODED for write-only operations.

2015-10-08  Dmitry V. Levin  <ldv@altlinux.org>

	desc.c: move parser of fcntl syscall to a separate file.
	* fcntl.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* desc.c (printflock64, printflock, SYS_FUNC(fcntl)): Move to fcntl.c.

	desc.c: move parser of flock syscall to a separate file.
	* flock.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* desc.c (SYS_FUNC(flock)): Move to flock.c.

2015-10-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix false uio.test failures.
	* tests/uio.c (main): Use descriptor number 0 in pread/pwrite
	and preadv/pwritev syscalls.
	* tests/uio.expected: Update regexps.

	Reported-by: Lennart Sorensen <lsorense@csclub.uwaterloo.ca>

2015-10-01  Gabriel Laskar  <gabriel@lse.epita.fr>

	Fix make -j builds.
	In files generated by mpers scripts, includes directives are taken from
	original files where the type definition was done.  This causes to
	include defs.h in multiple files.  defs.h includes printers.h header,
	which is a generated header.

	This patch add an explicit dependency to printers.h for the mpers
	scripts.

	* Makefile.am (mpers-m%.stamp): Add printers.h to order-only
	prerequisites.

2015-09-29  Mike Frysinger  <vapier@gentoo.org>

	mpers: fix shell code to conform better to POSIX.
	The `echo -n` behavior is non-portable, so use printf instead.

	* generate_mpers_am.sh: Change `echo -n` to `printf`.

2015-09-23  Gabriel Laskar  <gabriel@lse.epita.fr>

	ioctl: fix ioctl command number decoding in case of conflicts.
	When a command number was decoded through ioctl_decode_command_number(),
	there was no check for conflicts with other potential ioctls numbers.

	For example:
		ioctl(fd, MCE_GET_RECORD_LEN, &i);
	output:
		ioctl(3, MIXER_READ(1), 0x7ffddce74a58) = 0
	instead of:
		ioctl(3, MIXER_READ(1) or MCE_GET_RECORD_LEN, 0x7ffee435ce08) = 0

	* ioctl.c (SYS_FUNC(ioctl)): Fix ioctl command number decoding
	in case of conflicts.
	* tests/ioctl.c (main): Add a case for command number conflicts.

2015-09-23  Dmitry V. Levin  <ldv@altlinux.org>

	tests: convert ioctl.test from match_grep to match_diff.
	* tests/ioctl.c (main): Print expected output.
	* tests/ioctl.test: Use match_diff instead of match_grep.
	* tests/ioctl.expected: Remove.
	* tests/Makefile.am (EXTRA_DIST): Remove ioctl.expected.

2015-09-20  Dmitry V. Levin  <ldv@altlinux.org>

	Convert parser of seccomp filter program to new mpers infrastructure.
	* seccomp_fprog.h: New file.
	* fetch_seccomp_fprog.c: New file.
	* Makefile.am (strace_SOURCES): Add them.
	* seccomp.c: Include "seccomp_fprog.h".
	(print_seccomp_filter): Use fetch_seccomp_fprog.

2015-09-19  Dmitry V. Levin  <ldv@altlinux.org>

	tests/init.sh: enhance match_grep error diagnostics.
	* tests/init.sh (match_grep): Check patterns one by one,
	output only those patterns that didn't match.

	tests/init.sh: fix comment.
	* tests/init.sh (match_awk): Fix usage description.

	tests: add one more case to select.test.
	* tests/select.c (main): Check how timeout is printed
	on exiting syscall.

	tests: uncouple pselect6 from select.test.
	* tests/select.c Do not include <string.h>.
	Include <sys/syscall.h>.
	[!__NR_select]: Skip the test.
	(main): Remove pselect6 support, test just select syscall.
	* tests/select.test: Remove all pselect6 checks, test just
	select syscall.

	tests: robustify select test.
	* tests/select.c: Do not include <assert.h>.
	(main): Skip the test instead of assertions.
	Add some padding to the timeval structure.

	tests: add one more case to pselect6.test.
	* tests/pselect6.c (main): Check how timeout is printed
	on exiting syscall.

	tests: robustify pselect6 test.
	* tests/pselect6.c: Do not include <assert.h> and <string.h>.
	Include <sys/syscall.h>.
	[!__NR_pselect6]: Skip the test.
	(main): Skip the test instead of assertions.
	Add some padding to the timespec structure.

	Convert another parser of struct timeval to new mpers infrastructure.
	* print_time.c (sprint_timeval): New mpers printer.
	[ALPHA] (sprint_timeval32): New function.
	* defs.h [ALPHA] (sprint_timeval32): New prototype.
	(bitness_t, TIMEVAL_TEXT_BUFSIZE, printtv_bitness, sprinttv): Remove.
	* desc.c (decode_select): Replace bitness parameter with two printers.
	Use them instead of printtv_bitness and sprinttv.
	(sys_oldselect, sys_select): Pass print_timeval and sprint_timeval
	to decode_select.
	[ALPHA] (sys_osf_select): Pass print_timeval32 and sprint_timeval32
	to decode_select.
	(pselect6): Pass print_timespec and sprint_timespec to decode_select.
	* time.c (UTIME_NOW, UTIME_OMIT, current_time_t_is_compat,
	struct timeval32, printtv_bitness, do_sprinttv, sprinttv): Remove.

	Convert another parser of struct timespec to new mpers infrastructure.
	* print_time.c (sprint_timespec): New mpers printer.
	* defs.h (TIMESPEC_TEXT_BUFSIZE): Update.
	(sprint_timespec): Remove.
	* time.c (sprint_timespec): Remove.
	* net.c (sys_recvmmsg): Update callers.
	* poll.c (decode_poll_exiting): Likewise.

	tests: add another case to pselect6 test.
	* tests/pselect6.c: Include <sys/time.h>.
	(handler): New function.
	(main): Install an interval timer.
	Use it to check how ERESTARTNOHAND is printed.

	Fix decoding of gettimeofday and settimeofday.
	* time.c (print_timezone): new function.
	(sys_gettimeofday, sys_settimeofday): Use it instead of print_timeval
	to print struct timezone.
	[ALPHA] (sys_osf_gettimeofday, sys_osf_settimeofday): Use it
	instead of print_timeval32 to print struct timezone.
	* tests/xettimeofday.c: New file.
	* tests/xettimeofday.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add xettimeofday.
	(TESTS): Add xettimeofday.
	* tests/.gitignore: Add xettimeofday.

	Convert parser of struct timeval to new mpers infrastructure.
	* defs.h (printtv, printtv_special): Remove.
	[ALPHA] (print_timeval32, print_timeval32_pair): New prototypes.
	* print_time.c (print_timeval): New mpers printer.
	[ALPHA] (print_timeval32, print_timeval32_pair): New functions.
	* time.c (sys_gettimeofday, sys_settimeofday): Use print_timeval
	instead of printtv.
	[ALPHA] (sys_osf_gettimeofday, sys_osf_settimeofday):
	Use print_timeval32 instead of printtv_bitness.
	* utimes.c [ALPHA] (sys_osf_utimes): Use print_timeval32_pair
	instead of printtv_bitness.

	Convert parser of struct timespec to new mpers infrastructure.
	* defs.h (print_timespec): Remove.
	* print_time.c (print_timespec): New mpers printer.
	* futex.c (sys_futex): Use print_timespec instead of printtv.
	* ipc_sem.c (sys_semtimedop): Likewise.
	* mq.c (sys_mq_timedsend, sys_mq_timedreceive): Likewise.
	* time.c (clock_settime, clock_gettime, clock_nanosleep): Likewise.
	(print_timespec): Remove.

	Remove unused parser of adjtime syscall.
	* time.c (sys_adjtime): Remove.

	Fix decoding of clock_nanosleep.
	* time.c (sys_clock_nanosleep): Use is_erestart,
	temporarily_clear_syserror, and restore_cleared_syserror.
	* tests/clock_nanosleep.c: New file.
	* tests/clock_nanosleep.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add clock_nanosleep.
	(TESTS): Add clock_nanosleep.test.
	* tests/.gitignore: Add clock_nanosleep.

	Add is_erestart helper function.
	* defs.h (is_erestart): New prototype.
	* syscall.c (is_erestart): New function.
	* time.c (sys_nanosleep): Use is_erestart,
	temporarily_clear_syserror, and restore_cleared_syserror.

	Add helper functions to clear/restore syserror.
	* defs.h (temporarily_clear_syserror, restore_cleared_syserror):
	New prototypes.
	* syscall.c (saved_u_error): New variable.
	(temporarily_clear_syserror, restore_cleared_syserror): New functions.
	* aio.c (sys_io_getevents): Use temporarily_clear_syserror
	and restore_cleared_syserror.
	* mq.c (sys_mq_timedreceive): Likewise.
	* signal.c (sys_rt_sigtimedwait): Likewise.

	tests: add nanosleep.test.
	* tests/nanosleep.c: New file.
	* tests/nanosleep.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add nanosleep.
	(TESTS): Add nanosleep.test.
	* tests/.gitignore: Add nanosleep.

	tests: rewrite restart_syscall in C.
	* tests/restart_syscall.c: New file.
	* tests/restart_syscall.expected: Remove.
	* tests/restart_syscall_unknown.expected: Remove.
	* tests/restart_syscall.test: Update to use restart_syscall.
	* tests/Makefile.am (check_PROGRAMS): Add restart_syscall.
	(EXTRA_DIST): Remove restart_syscall.expected
	and restart_syscall_unknown.expected.
	* tests/.gitignore: Add restart_syscall.

	Properly initialize siginfo_t object passed to print_stopped function.
	* strace.c (trace): Clear the whole siginfo_t variable before passing it
	to ptrace(PTRACE_GETSIGINFO) because the latter may initialize only a
	part of the structure.

	tests: add clock_xettime.test.
	* tests/clock_xettime.c: New file.
	* tests/clock_xettime.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add clock_xettime.
	(TESTS): Add clock_xettime.test.
	* tests/.gitignore: Add clock_xettime.

	Convert parser of struct itimerval to new mpers infrastructure.
	* defs.h [ALPHA] (print_itimerval32): New prototype.
	* print_time.c (print_itimerval): New mpers printer.
	[ALPHA] (timeval32_t): New typedef.
	[ALPHA] (print_timeval32_t, print_itimerval32): New functions.
	* time.c (sys_getitimer, sys_setitimer): Use print_itimerval instead
	of printitv.
	[ALPHA] (sys_osf_getitimer, sys_osf_setitimer): Use print_itimerval32
	instead of printitv_bitness.
	(tprint_timeval32, tprint_timeval, printitv_bitness, printitv): Remove.

	tests: add xetitimer.test.
	* tests/xetitimer.c: New file.
	* tests/xetitimer.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add xetitimer.
	(TESTS): Add xetitimer.test.
	* tests/.gitignore: Add xetitimer.

	Convert parser of struct itimerspec to new mpers infrastructure.
	* print_time.c (print_itimerspec): New mpers printer.
	* time.c (sys_timer_settime, sys_timer_gettime, sys_timerfd,
	sys_timerfd_settime, sys_timerfd_gettime): Use it instead of printitv.

2015-09-17  Dmitry V. Levin  <ldv@altlinux.org>

	print_time.c: introduce print_timespec_t helper.
	* print_time.c (time_fmt): New constant string.
	(print_timeval_t): Use it.
	(print_timespec_t): New function.
	(print_timespec_t_utime): Use it.

	tests: add timerfd_xettime.test.
	* tests/timerfd_xettime.c: New file.
	* tests/timerfd_xettime.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add timerfd_xettime.
	(TESTS): Add timerfd_xettime.test.
	* tests/.gitignore: Add timerfd_xettime.

	tests: add timer_xettime.test.
	* tests/timer_xettime.c: New file.
	* tests/timer_xettime.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add timer_xettime.
	(TESTS): Add timer_xettime.test.
	* tests/.gitignore: Add timer_xettime.

	time.c: move parser of time syscall to print_time.c.
	* time.c (current_time_t_is_int32): Remove.
	(sys_time): Move ...
	* print_time.c: ... here.  Mpersify time_t.

	print_time.c: remove unused function parameters.
	* print_time.c (print_timespec_t_utime, print_timeval_t): Remove
	"struct tcb *" parameter.
	(print_timespec_utime_pair, print_timeval_pair): Update callers.

	Add struct timex.tai support.
	* configure.ac (AC_CHECK_MEMBERS): Add struct timex.tai.
	* print_timex.c (print_timex) [HAVE_STRUCT_TIMEX_TAI]: Print tai field.
	* tests/adjtimex.c (main) [HAVE_STRUCT_TIMEX_TAI]: Likewise.

	Convert parser of struct timex to new mpers infrastructure.
	* defs.h (adjtimex_modes, adjtimex_status): New xlat prototypes.
	* print_timex.c (struct_timex): New typedef.  Mpersify it.
	[IN_MPERS]: Do not include "xlat/adjtimex_modes.h"
	and "xlat/adjtimex_status.h".
	[SUPPORTED_PERSONALITIES > 1]: Remove.
	(tprint_timeval): Remove.
	(tprint_timex): Rename to print_timex.  Mpersify it.
	* time.c (do_adjtimex): Rename tprint_timex to print_timex.
	* tests/adjtimex.c: New file.
	* tests/adjtimex.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add adjtimex.
	(TESTS): Add adjtimex.test.
	* tests/.gitignore: Add adjtimex.

	Move parser of struct timex to a separate file.
	* print_timex.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* time.c (tprint_timex32, tprint_timex): Move to print_timex.c.

	Enhance parser of struct sigevent.
	* print_sigevent.c (print_sigevent): Always print names
	of struct_sigevent fields along with their values.
	Print signal name of sigev_signo for those sigev_notify values
	that require valid signal numbers.
	* tests/timer_create.c: New file.
	* tests/timer_create.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add timer_create.
	(TESTS): Add timer_create.test.
	* tests/.gitignore: Add timer_create.

2015-09-16  Dmitry V. Levin  <ldv@altlinux.org>

	Convert parser of struct sigevent to new mpers infrastructure.
	* defs.h (sigev_value): New prototype.
	(printsigevent): Remove.
	* print_sigevent.c (struct_sigevent): New typedef.  Mpersify it.
	[IN_MPERS]: Do not include "xlat/sigev_value.h".
	(printsigevent32): Remove.
	(printsigevent): Rename to print_sigevent.  Mpersify it.
	* mq.c (sys_mq_notify): Rename printsigevent to print_sigevent.
	* time.c (sys_timer_create): Likewise.

	Move parser of struct sigevent to a separate file.
	* print_sigevent.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* time.c (printsigevent32, printsigevent): Move to print_sigevent.c.

	time.c: move fallback definitions of SIGEV_* values to xlat/
	* time.c: Move fallback definitions of SIGEV_* values ...
	* xlat/sigev_value.in: ... here.

	Simplify use of mpers printers.
	* native_defs.h: New file.
	* syscall.c: Include it.
	* mpers_type.h [!IN_MPERS] (MPERS_DEFS): Change to "native_defs.h".
	* defs.h (MPERS_PRINTER_NAME): Remove.
	[SUPPORTED_PERSONALITIES > 1] (MPERS_PRINTER_NAME, printers): Move ...
	* Makefile.am (printers.h): ... here.
	Add macro definitions for mpers printers.
	(m%_defs.h): Add redefinition of MPERS_PRINTER_NAME and inclusion
	of "$(mpers_PREFIX)printer_decls.h".
	(strace_SOURCES): Add native_defs.h.
	* README-mpers: Update instructions for using mpers printers.
	* ipc_msg.c (tprint_msgsnd, tprint_msgrcv): Call tprint_msgbuf directly.
	* mq.c (sys_mq_open, mq_getsetattr): Call printmqattr directly.
	* process.c (sys_ptrace): Call printsiginfo_at directly.
	* signal.c (print_sigqueueinfo, sys_rt_sigtimedwait): Likewise.
	* resource.c (sys_getrusage): Call printrusage directly.
	* utimes.c (sys_utimensat): Call print_timespec_utime_pair directly.
	(sys_utimes, sys_futimesat): Call print_timeval_pair directly.
	* wait.c (printwaitn): Call printrusage directly.
	(sys_waitid): Call printrusage and printsiginfo_at directly.

2015-09-15  Dmitry V. Levin  <ldv@altlinux.org>

	Add a new helper function umove_ulong_array_or_printaddr.
	* defs.h (umove_ulong_array_or_printaddr): New prototype.
	* util.c (umove_ulong_array_or_printaddr): New function.
	* desc.c (sys_pselect6): Use it instead of open-coding
	a proxy struct parser for different personalities.
	* io.c (tprint_iov_upto): Use it instead of open-coding
	a struct iovec parser for different personalities.
	* kexec.c (print_kexec_segments): Use it instead of open-coding
	a struct kexec_segment parser for different personalities.
	(print_seg): Pass arguments using an array.

	tests: add pselect6.test.
	* tests/pselect6.c: New file.
	* tests/pselect6.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add pselect6.
	(TESTS): Add pselect6.test.
	* tests/.gitignore: Add pselect6.

2015-09-14  Dmitry V. Levin  <ldv@altlinux.org>

	Rename umove_long_or_printaddr to umove_ulong_or_printaddr.
	Rename the recently added function to reflect what kind of data type
	it actually deals with: unsigned long int, without sign extension.

	* defs.h (umove_long_or_printaddr): Rename to umove_ulong_or_printaddr,
	chage 3rd argument to unsigned long *.
	* util.c (umove_long_or_printaddr): Likewise.
	* aio.c (sys_io_submit): Update callers.

2015-09-14  Dmitry V. Levin  <ldv@altlinux.org>

	aarch64, ppc64, sparc64, tile: hook up mpers printers.
	* defs.h [AARCH64 && HAVE_M32_MPERS]: Define PERSONALITY0_INCLUDE_FUNCS,
	PERSONALITY0_INCLUDE_PRINTERS_DECLS,
	and PERSONALITY0_INCLUDE_PRINTERS_DEFS.
	[POWERPC64 && HAVE_M32_MPERS]: Define PERSONALITY1_INCLUDE_FUNCS,
	PERSONALITY1_INCLUDE_PRINTERS_DECLS,
	and PERSONALITY1_INCLUDE_PRINTERS_DEFS.
	[SPARC64 && HAVE_M32_MPERS]: Likewise.
	[TILE && HAVE_M32_MPERS]: Likewise.

2015-09-14  Anton Blanchard  <anton@samba.org>

	Add PowerPC specific ptrace constants.
	* xlat/ptrace_cmds.in: Add PowerPC specific ptrace constants.

2015-09-14  Dmitry V. Levin  <ldv@altlinux.org>

	Update SCTP_* constants.
	* xlat/socksctpoptions.in: Add SCTP_GET_ASSOC_ID_LIST, SCTP_AUTO_ASCONF,
	SCTP_PEER_ADDR_THLDS, SCTP_RECVRCVINFO, SCTP_RECVNXTINFO,
	SCTP_DEFAULT_SNDINFO, SCTP_SOCKOPT_CONNECTX, SCTP_SOCKOPT_CONNECTX3,
	and SCTP_GET_ASSOC_STATS.

	Update F_* constants.
	* xlat/fcntlcmds.in: Add F_SETPIPE_SZ, F_GETPIPE_SZ, F_ADD_SEALS,
	and F_GET_SEALS.

	Update RENAME_* constants.
	* xlat/rename_flags.in: Add RENAME_WHITEOUT.

	Update SO_* constants.
	* xlat/sockoptions.in: Add SO_ATTACH_BPF, SO_BPF_EXTENSIONS,
	SO_BUSY_POLL, SO_DETACH_BPF, SO_GET_FILTER, SO_INCOMING_CPU,
	SO_LOCK_FILTER, SO_MAX_PACING_RATE, SO_PEEK_OFF, SO_RXQ_OVFL,
	SO_SELECT_ERR_QUEUE, and SO_WIFI_STATUS.

	Update INPUT_PROP_* constants.
	* xlat/evdev_prop.in: Add INPUT_PROP_ACCELEROMETER.

	Update KEY_* constants.
	* xlat/evdev_keycode.in: Add KEY_ROTATE_DISPLAY, KEY_NUMERIC_A,
	KEY_NUMERIC_B, KEY_NUMERIC_C, and KEY_NUMERIC_D.

	Update FALLOC_FL_* constants.
	* xlat/falloc_flags.in: Add FALLOC_FL_INSERT_RANGE.

	Update AF_* and PF_* constants.
	* xlat/addrfams.in: Add AF_IB and AF_MPLS.
	* xlat/domains.in: Add PF_IB and PF_MPLS.

	Update TCP_* constants.
	* xlat/socktcpoptions.in: Add TCP_NOTSENT_LOWAT, TCP_CC_INFO,
	TCP_SAVE_SYN, and TCP_SAVED_SYN.

	Update PACKET_* constants.
	* xlat/sockpacketoptions.in: Add PACKET_VNET_HDR, PACKET_TX_TIMESTAMP,
	PACKET_TIMESTAMP, PACKET_FANOUT, PACKET_TX_HAS_OFF, PACKET_QDISC_BYPASS,
	PACKET_ROLLOVER_STATS, and PACKET_FANOUT_DATA.

	Update BPF_MAP_TYPE_* constants.
	* xlat/bpf_map_types.in: Add BPF_MAP_TYPE_PERF_EVENT_ARRAY.

	Update IPPROTO_* constants.
	* xlat/inet_protocols.in: Add IPPROTO_MPLS.

	Update IP_* constants.
	* xlat/sockipoptions.in: Add IP_CHECKSUM and IP_BIND_ADDRESS_NO_PORT.

	Update PTRACE_O_* constants.
	* ptrace.h: Define PTRACE_O_SUSPEND_SECCOMP.
	* xlat/ptrace_setoptions_flags.in: Add it.

	Update PR_* constants.
	* xlat/prctl_options.in: Add PR_SET_FP_MODE, PR_GET_FP_MODE,
	and PR_CAP_AMBIENT.

	Update SECBIT_* constants.
	* xlat/secbits.in: Add SECBIT_NO_CAP_AMBIENT_RAISE
	and SECBIT_NO_CAP_AMBIENT_RAISE_LOCKED.

2015-08-28  Dmitry V. Levin  <ldv@altlinux.org>

	mpers.m4: workaround missing gnu/stubs-*.h files.
	On some systems missing gnu/stubs-*.h files make -m32/-mx32 compilation
	checks fail.  As we want to support multiple personalities despite of
	this limitation, workaround the check by creating empty gnu stub files
	if necessary.

	* m4/mpers.m4 (st_MPERS): Check for the gnu stub file.  Create an empty
	gnu stub file if the system one is missing.
	* Makefile.am (DISTCLEANFILES): Add gnu/stubs-32.h and gnu/stubs-x32.h.

2015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>

	tests: add times-fail.test.
	* tests/times-fail.c: New file.
	* tests/times-fail.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add times-fail.
	(TESTS): Add times-fail.test.
	* tests/.gitignore: Add times-fail.

2015-08-28  Eugene Syromyatnikov  <evgsyr@gmail.com>

	tests: add times.test.
	* tests/times.c: New file.
	* tests/times.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add times.
	(TESTS): Add times.test.
	(times_LDADD): Define.
	* tests/.gitignore: Add times.

2015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>

	Mpersify parser of times syscall.
	Fix multiple personalities support in parser of times syscall by
	mpersifying struct tms.

	* times.c (tms_t): New typedef.  Mpersify it.
	(sys_times): Use it instead of struct tms.

2015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>

	tests: add sysinfo.test.
	* tests/sysinfo.c: New file.
	* tests/sysinfo.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add sysinfo.
	(TESTS): Add sysinfo.test.
	* tests/.gitignore: Add sysinfo.

2015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>

	Mpersify parser of sysinfo syscall.
	Fix multiple personalities support in parser of sysinfo syscall by
	mpersifying struct sysinfo.

	* sysinfo.c (sysinfo_t): New typedef.  Mpersify it.
	(sys_sysinfo): Use it instead of struct sysinfo.

2015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>

	Enhance msgctl syscall decoding.
	Make parser of msgctl syscall print struct msqid_ds.

	* ipc_msgctl.c (msqid_ds_t): New typedef.  Mpersify it.
	(print_msqid_ds): New function.  Use msqid_ds_t.
	(sys_msgctl): Use print_msqid_ds.
	* tests/ipc_msg.c: Update for struct msqid_ds support.

2015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>

	Enhance shmctl syscall decoding.
	Make parser of shmctl syscall print struct shmid_ds.

	* ipc_shmctl.c (shmid_ds_t): New typedef.  Mpersify it.
	(print_shmid_ds): New function.  Use shmid_ds_t.
	(sys_shmctl): Use print_shmid_ds.
	* tests/ipc_shm.c: Update for struct shmid_ds support.

2015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>

	tests: add ipc_msgbuf.test.
	* tests/ipc_msgbuf.c: New file.
	* tests/ipc_msgbuf.expected: Likewise.
	* tests/ipc_msgbuf.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add ipc_msgbuf.
	(TESTS): Add ipc_msgbuf.test.
	(EXTRA_DIST): Add ipc_msgbuf.expected.
	* tests/.gitignore: Add ipc_msgbuf.

2015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>

	Mpersify tprint_msgsnd and tprint_msgrcv.
	Fix multiple personalities support in tprint_msgsnd and tprint_msgrcv
	by converting tprint_msgbuf into a mpersified printer.

	* print_msgbuf.c (msgbuf_t): New typedef.  Mpersify it.
	(tprint_msgbuf): Use it instead of long.
	Wrap function name into MPERS_PRINTER_DECL.
	* ipc_msg.c (tprint_msgsnd, tprint_msgrcv): Use mpersified
	tprint_msgbuf.

2015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>

	tests: add mq.test.
	* tests/mq.c: New file.
	* tests/mq.expected: Likewise.
	* tests/mq.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add mq.
	(TESTS): Add mq.test.
	(EXTRA_DIST): Add mq.expected.
	(mq_LDADD): Add -lrt.
	* tests/.gitignore: Add mq.

2015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>

	Mpersify parsers of mq_open and mq_getsetattr syscalls.
	Fix multiple personalities support in parsers of mq_open and
	mq_getsetattr by converting printmqattr into a mpersified printer.

	* print_mq_attr.c (mq_attr_t): New typedef.  Mpersify it.
	(printmqattr): Use it instead of struct mq_attr.  Wrap function name
	into MPERS_PRINTER_DECL.
	* mq.c (mq_open, mq_getsetattr): Use mpersified printmqattr.

2015-08-28  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add wait.test.
	* tests/wait.c: New file.
	* tests/wait.expected: Likewise.
	* tests/wait.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add wait.
	(TESTS): Add wait.test.
	(EXTRA_DIST): Add wait.expected.
	* tests/.gitignore: Add wait.

2015-08-28  Dmitry V. Levin  <ldv@altlinux.org>

	Mpersify parsers of getrusage, waitpid, wait4, and waitid syscalls.
	Fix multiple personalities support in parsers of getrusage, waitpid,
	wait4, and waitid syscalls by converting printrusage into a mpersified
	printer.

	* defs.h (printrusage): Remove.
	* printrusage.c (rusage_t): New typedef.  Mpersify it.
	(printrusage): Use it instead of struct rusage.
	Wrap function name into MPERS_PRINTER_DECL.
	* resource.c (sys_getrusage): Use mpersified printrusage.
	* wait.c (printwaitn, sys_waitid): Likewise.

2015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>

	tests: add rt_sigqueueinfo.test.
	* tests/rt_sigqueueinfo.c: New file.
	* tests/rt_sigqueueinfo.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add rt_sigqueueinfo.
	(TESTS): Add rt_sigqueueinfo.test.
	* tests/.gitignore: Add rt_sigqueueinfo.

2015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>

	Mpersify printsiginfo_at printer.
	Fix multiple personalities support in parsers of ptrace,
	rt_sigqueueinfo, rt_tgsigqueueinfo, rt_sigtimedwait and waitid syscalls
	by converting printsiginfo_at into a mpersified printer.

	* printsiginfo.c (siginfo_t): Mpersify.
	(printsiginfo_at): Wrap function name into MPERS_PRINTER_DECL.
	* defs.h (printsiginfo_at): Remove.
	* signal.c (print_sigqueueinfo, sys_rt_sigtimedwait): Use mpersified
	printsiginfo_at.
	* process.c (sys_ptrace): Likewise.
	* wait.c (sys_waitid): Likewise.

2015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>

	Mpersify parser of sigaltstack syscall.
	Fix multiple personalities support in parser of sigaltstack syscall by
	mpersifying stack_t typedef.

	* sigaltstack.c (stack_t): Mpersify.
	(print_stack_t): Use it.

2015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>

	Mpersify parser of utime syscall.
	Fix multiple personalities support in parser of utime syscall by using
	mpersified utimbuf_t typedef.

	* utime.c (utimbuf_t): New typedef.  Mpersify it.
	(sys_utime): Use it instead of a locally defined union.

2015-08-28  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add utimensat.test.
	* tests/utimensat.c: New file.
	* tests/utimensat.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add utimensat.
	(TESTS): Add utimensat.test.
	* configure.ac (AC_CHECK_FUNCS): Add utimensat.
	* tests/.gitignore: Add utimensat.

2015-08-28  Dmitry V. Levin  <ldv@altlinux.org>

	Mpersify parsers of utimes, futimesat, and utimensat syscalls.
	Fix multiple personalities support in parsers of utimes, futimesat,
	and utimensat syscalls by introducing two mpersified printers:
	print_timeval_pair and print_timespec_utime_pair.

	* print_time.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* utimes.c (decode_utimes): Remove.
	(sys_utimes, sys_futimesat): Use print_timeval_pair instead
	of decode_utimes.
	(sys_utimensat): Use print_timespec_utime_pair instead of decode_utimes.

2015-08-28  Elvira Khabirova  <lineprinter0@gmail.com>

	Add mpers support.
	Add a subsystem for semi-automatical definition of how parsers should
	work with personality-dependent (mpers) types of tracee's data.  Create
	auxiliary libraries containing mpers syscall parsers and printer
	functions, one library for each possible nonnative target personality.

	Currently some parsers do not handle differences in definitions of data
	types between personalities, namely LP64 and ILP32.  When
	this is the case, long integers, pointers, and all compound
	types containing long and pointer members may be printed incorrectly,
	because of differences in sizes, offsets and alignments.

	Since in most cases these are the only differences in desired behaviour
	of parsers and printers for different personalities, a correct way
	would be to compile one source code into multiple parsers, differing
	only in definitions of mpers types.

	To get a definition of a given type for nonnative personality
	a very basic .c file containing a declaration of a variable of this type
	is being compiled for this personality (using -m32 or -mx32 compiler
	flag).  Information about the type is then being extracted from
	this binary's DWARF debug info with an awk script and put
	into a corresponding header file.  Resulting headers are being used to
	compile mpers variations of syscall parsers and printer functions.

	In addition to syscall parsers, there can occur a need to create mpers
	printing functions, which then can be called from many places
	in the code (for example, printsiginfo_at).  Such functions (printers)
	are marked in a special manner.

	For each possible nonnative target personality a library is being
	created, containing mpers variations of syscall parsers and printers.
	Only syscall parsers from files marked in a special manner and specially
	marked functions from such files are being recompiled and included
	in these libraries.

	generate_mpers_am.sh is called by bootstrap to find the files
	from strace_SOURCES which include MPERS_DEFS.  During compilation,
	these files are being inspected for inclusions of DEF_MPERS_TYPE,
	and nonnative variations of each included type are being generated
	by an awk script.

	Mpers parser names are being modified during inclusions of syscallent
	headers for nonnative personalities.  Pointers to printers are
	being stored in structs struct_printers, and a master
	pointer printers is being updated on every set_personality.

	* README-mpers: New README explaining how to use mpers support.
	* empty.h: New empty file.
	* generate_mpers_am.sh: New file.
	* mpers.awk: Likewise.
	* mpers.sh: Likewise.
	* mpers_test.sh: Likewise.
	* mpers_type.h: Likewise.
	* Makefile.am (strace_SOURCES): Add empty.h and mpers_type.h.
	(strace_CPPFLAGS, strace_LDFLAGS, strace_LDADD): Move to the beginning
	of the file.
	(strace_LDADD, noinst_LIBRARIES): Add libmpers-%.a.
	(EXTRA_DIST): Add mpers.awk, mpers.sh, mpers_test.sh.
	(BUILT_SOURCES, CLEANFILES): Add new generated files:
	native_printer_decls.h, native_printer_defs.h, printers.h,
	[HAVE_M32_MPERS] $(mpers_m32_targets), and [HAVE_MX32_MPERS]
	$(mpers_mx32_targets).
	(mpers_NAME, mpers_PREFIX, mpers_DEFS, mpers_INCLUDES, mpers_CPPFLAGS,
	mpers_sh_opts, libmpers_CPPFLAGS, libmpers_m[x]32_a_SOURCES,
	libmpers_m[x]32_a_CPPFLAGS, mpers_m[x]32_targets): New variables.
	(mpers-m[x]32.stamp, m[x]32_defs.h, m[x]32_funcs.h, printers.h,
	%_printer_decls.h, %_printer_defs.h, clean-local,
	native_printer_decls.h, native_printer_defs.h, $mpers_m[x]32_targets):
	New targets.
	* bootstrap: Add generate_mpers_am.sh.
	* configure.ac: Add AC_PROG_RANLIB.
	* m4/mpers.m4: Add HAVE_MPERS variable.  Add $st_cv_mpers checks.
	* defs.h: Include mpers_type.h.
	Include printers.h, native_printer_decls.h, define MPERS_PRINTER_NAME.
	Redefine SYS_FUNC_NAME.  Define MPERS_PRINTER_DECL.
	[HAVE_M32_MPERS]: define PERSONALITY1_INCLUDE_FUNCS,
	PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS
	for X86_64, X32.
	[HAVE_MX32_MPERS]: define PERSONALITY2_INCLUDE_FUNCS,
	PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS
	for X86_64.
	Add fallback definitions of
	PERSONALITY1_INCLUDE_FUNCS, PERSONALITY2_INCLUDE_FUNCS,
	PERSONALITY0_INCLUDE_PRINTERS_DECLS, PERSONALITY0_INCLUDE_PRINTERS_DEFS,
	PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS,
	PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS.
	* syscall.c: Include PERSONALITY1_INCLUDE_FUNCS,
	PERSONALITY2_INCLUDE_FUNCS,
	PERSONALITY0_INCLUDE_PRINTERS_DECLS, PERSONALITY0_INCLUDE_PRINTERS_DEFS,
	PERSONALITY1_INCLUDE_PRINTERS_DECLS, PERSONALITY1_INCLUDE_PRINTERS_DEFS,
	PERSONALITY2_INCLUDE_PRINTERS_DECLS, PERSONALITY2_INCLUDE_PRINTERS_DEFS.
	(printers): New struct.  Update it when needed.
	* .gitignore: Add libmpers-m32.a, libmpers-mx32.a, m32_defs.h,
	m32_funcs.h, m32_printer_decls.h, m32_printer_defs.h, mpers-m32,
	mpers-m32.stamp, mpers-mx32, mpers-mx32.stamp, mpers.am, mx32_defs.h,
	mx32_funcs.h, mx32_printer_decls.h, mx32_printer_defs.h,
	native_printer_decls.h, native_printer_defs.h, and printers.h.

2015-08-28  Dmitry V. Levin  <ldv@altlinux.org>

	tests: convert readlink.test and readlinkat.test from match_awk to match_diff
	* tests/readlink.c (main): Print expected output.
	* tests/readlinkat.c (main): Likewise.
	* tests/readlink.test: Use match_diff instead of match_awk.
	* tests/readlinkat.test: Likewise.
	* tests/readlink.awk: Remove.
	* tests/readlinkat.awk: Likewise.
	* tests/Makefile.am (EXTRA_DIST): Remove readlink.awk and readlinkat.awk.

	tests: convert getrandom.test from match_awk to match_diff.
	* tests/getrandom.c (main): Print expected output.
	* tests/getrandom.test: Use match_diff instead of match_awk.
	* tests/getrandom.awk: Remove.
	* tests/Makefile.am (EXTRA_DIST): Remove getrandom.awk.

2015-08-27  Dmitry V. Levin  <ldv@altlinux.org>

	tests: convert select.test from match_awk to match_diff.
	* tests/select.c (main): Print expected output.
	* tests/select.test: Use match_diff instead of match_awk.
	* tests/select.awk: Remove.
	* tests/Makefile.am (EXTRA_DIST): Remove select.awk.

	tests: convert several tests from match_grep to match_diff.
	* tests/sendfile.test: Use match_diff instead of match_grep.
	* tests/sendfile64.test: Likewise.
	* tests/time.test: Likewise.
	* tests/utime.test: Likewise.
	* tests/xet_robust_list.test: Likewise.
	* tests/sendfile.c (main): Update match patterns for match_diff.
	* tests/sendfile64.c (main): Likewise.
	* tests/time.c (main): Likewise.
	* tests/utime.c (main): Likewise.
	* tests/xet_robust_list.c (main): Likewise.

2015-08-27  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix match_diff usage.
	The first argument of match_diff should be the file with expected
	output, the second argument - the file with actual output.

	* tests/aio.test: Swap match_diff arguments.
	* tests/restart_syscall.test: Likewise.
	* tests/seccomp.test: Likewise.
	* tests/umovestr2.test: Likewise.

2015-08-27  Dmitry V. Levin  <ldv@altlinux.org>

	build: fix -I options.
	* configure.ac (AM_INIT_AUTOMAKE): Add nostdinc.
	* Makefile.am (AM_CPPFLAGS): Append -I$(builddir) and -I$(srcdir).
	* tests/Makefile.am (AM_CPPFLAGS): Likewise.

2015-08-26  Dmitry V. Levin  <ldv@altlinux.org>

	aio: rewrite from libaio.h to linux/aio_abi.h.
	* configure.ac (AC_CHECK_HEADERS): Remove libaio.h.
	* aio.c: Assume that <linux/aio_abi.h> is available,
	include it instead of <libaio.h>.
	[!IOCB_RESFD]: Remove.
	(enum iocb_sub): Remove SUB_POLL.
	(tprint_lio_opcode): Update.
	(print_common_flags): Use IOCB_FLAG_RESFD instead of IOCB_RESFD,
	rename fields of struct iocb.
	(iocb_is_valid, print_iocb_header, print_iocb): New functions.
	(sys_io_submit): Use print_iocb.
	(print_io_event): Fix struct io_event decoding.
	(sys_io_cancel): Use print_iocb_header.
	* strace.spec (BuildRequires): Remove libaio-devel.
	* tests/aio.c (main): Test IOCB_CMD_PREADV, io_cancel,
	and struct io_event decoding.
	* tests/aio.test (syscalls): Add io_cancel.

2015-08-26  Dmitry V. Levin  <ldv@altlinux.org>

	Fix multiple personalities support in parser of io_submit syscall.
	Introduce a new helper function to fetch tracee's long integers
	and use it to fix multiple personalities support in io_submit parser.

	* defs.h (umove_long_or_printaddr): New prototype.
	* util.c (umove_long_or_printaddr): New function.
	* aio.c (sys_io_submit): Use it to fetch tracee's pointers.
	* tests/aio.c: New file.
	* tests/aio.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add aio.
	(TESTS): Add aio.test.
	* tests/.gitignore: Add aio.

2015-08-26  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix build on systems that lack O_CLOEXEC definition.
	* tests/epoll_create1.c (main): Check that O_CLOEXEC is defined.
	* tests/eventfd.c (main): Likewise.
	* tests/signalfd.c (main): Likewise.

	tests: fix build on systems that lack AT_FDCWD definition.
	* tests/readlinkat.c: Stop including <fcntl.h>.
	(main): Replace AT_FDCWD with -100.

	Fix printing of io_getevents first argument.
	* aio.c (sys_io_getevents): Print first argument using "%lu" format.

2015-08-26  Mike Frysinger  <vapier@gentoo.org>

	decode extend getsockopt/setsockopt options.
	Currently the code assumes the set of valid options between getsockopt
	and setsockopt are exactly the same and thus maintains one list.  The
	kernel unfortunately does not do this -- it allows for different opts
	between the get and set functions.  See the {g,s}et_opt{min,max} fields
	in the various netfilter subcores.

	To support this, extend the printxval function to take multiple sets of
	xlats as varargs.  Then we add the new get/set lists, and pass them down
	in the net code when decoding things.

	A simple example is iptables; before:
		getsockopt(4, SOL_IP, 0x40 /* IP_??? */, ...) = 0
		getsockopt(4, SOL_IP, 0x41 /* IP_??? */, ...) = 0
	after:
		getsockopt(4, SOL_IP, IPT_SO_GET_INFO, ...) = 0
		getsockopt(4, SOL_IP, IPT_SO_GET_ENTRIES, ...) = 0

	If these were setsockopt calls, then 0x40 & 0x41 would be
	IPT_SO_SET_REPLACE & IPT_SO_SET_ADD_COUNTERS.

	* configure.ac: Check for netfilter headers.
	* defs.h (printxvals): New prototype.
	(printxval): Change to a define.
	* net.c: Include netfilter headers and new sockopts headers.
	(print_sockopt_fd_level_name): Add a is_getsockopt argument.  Change SOL_IP
	and SOL_IPV6 decoding to use printxvals, and use is_getsockopt to pass more
	xlats down.
	(getsockopt): Call print_sockopt_fd_level_name with is_getsockopt as true.
	(setsockopt): Call print_sockopt_fd_level_name with is_getsockopt as false.
	* util.c (printxval): Rename to ...
	(printxvals): ... this.  Rewrite to be varargs based.
	* xlat/getsockipoptions.in: New xlat list.
	* xlat/getsockipv6options.in, xlat/setsockipoptions.in,
	xlat/setsockipv6options.in: Likewise.

2015-08-26  Dmitry V. Levin  <ldv@altlinux.org>

	Fix build on systems that lack VIDIOC_CREATE_BUFS definition.
	* v4l2.c (v4l2_ioctl): Check that v4l2_ioctl is defined.

	Fix build on systems that lack EM_ARM/EM_OPENRISC definitions.
	* xlat/audit_arch.in: Guard AUDIT_ARCH_ARM and AUDIT_ARCH_ARMEB
	with EM_ARM check.  Guard AUDIT_ARCH_OPENRISC with EM_OPENRISC check.

2015-08-25  Dmitry V. Levin  <ldv@altlinux.org>

	Fix build on systems that lack UBI_IOCVOLCRBLK/UBI_IOCVOLRMBLK definitions
	* mtd.c (ubi_ioctl): Check that UBI_IOCVOLCRBLK and UBI_IOCVOLRMBLK
	are defined.

	Fix build on systems that lack O_CLOEXEC definition.
	* xlat/efd_flags.in: Check that O_CLOEXEC is defined.
	* xlat/epollflags.in: Likewise.
	* xlat/sfd_flags.in: Likewise.
	* xlat/timerfdflags.in: Fix O_CLOEXEC check.

2015-08-21  Elvira Khabirova  <lineprinter0@gmail.com>

	printsiginfo.c: fix integer conversions.
	* printsiginfo.c (printsigsource): Print si_pid and si_uid as unsigned
	integers.
	(printsigval): Print si_int as signed int.

2015-08-20  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of times syscall return value.
	Always print return value of successful times syscall
	as unsigned long integer.

	* times.c (sys_times): Return RVAL_UDECIMAL unless syserror.

2015-08-20  Elvira Khabirova  <lineprinter0@gmail.com>

	mq.c: remove repeated code.
	* mq.c (sys_mq_open): Use printmqattr instead of implementing it again.
	[HAVE_MQUEUE_H]: Remove.

2015-08-20  Elvira Khabirova  <lineprinter0@gmail.com>

	ipc_msg.c: fix multiple personalities support in msgrcv ipc subcall.
	When msgrcv syscall is an ipc subcall, msgp (pointer to struct msgbuf)
	and msgtyp (message type) syscall arguments are passed via proxy
	structure which definition significantly depends on tracee's
	wordsize.

	* ipc_msg.c (fetch_msgrcv_args): New function.
	(sys_msgrcv): Use it.

2015-08-20  Elvira Khabirova  <lineprinter0@gmail.com>

	ipc.c: split into separate files.
	In preparation for upcoming mpers-related changes,
	split ipc.c into independent groups of parsers.

	* ipc_defs.h: New file.
	* ipc_msg.c: Likewise.
	* ipc_msgctl.c: Likewise.
	* ipc_sem.c: Likewise.
	* ipc_shm.c: Likewise.
	* ipc_shmctl.c: Likewise.
	* mq.c: Likewise.
	* print_mq_attr.c: Likewise.
	* print_msgbuf.c: Likewise.
	* ipc.c: Remove.
	(sys_mq_open, sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify,
	sys_mq_getsetattr): Move to mq.c.
	(sys_msgget, tprint_msgsnd, sys_msgsnd, tprint_msgrcv, sys_msgrcv): Move
	to ipc_msg.c.
	(sys_msgctl): Move to ipc_msgctl.c.
	(tprint_sembuf, tprint_sembuf_array, sys_semop, sys_semtimedop,
	sys_semget, syssemctl): Move to ipc_sem.c.
	(sys_shmget, sys_shmat, sys_shmdt): Move to ipc_shm.c.
	(sys_shmctl): Move to ipc_shmctl.c.
	(printmqattr): Move to print_mq_attr.c.
	(tprint_msgbuf): Move to print_msgbuf.c.
	(IPC_64, PRINTCTL): Move to ipc_defs.h.
	* defs.h (struct xlat resource_flags): New prototype.
	* Makefile.am (strace_SOURCES): Remove ipc.c.  Add ipc_defs.h, mq.c,
	ipc_msg.c, ipc_msgctl.c, ipc_sem.c, ipc_shm.c, ipc_shmctl.c,
	print_mq_attr.c, and print_msgbuf.c.

2015-08-20  Elvira Khabirova  <lineprinter0@gmail.com>

	.gitignore: add sen.h and sys_func.h.

2015-08-19  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add sendfile.test and sendfile64.test.
	* tests/sendfile.c: New file.
	* tests/sendfile64.c: New file.
	* tests/sendfile.test: New test.
	* tests/sendfile64.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add sendfile and sendfile64.
	(TESTS): Add sendfile.test and sendfile64.test.
	* tests/.gitignore: Add sendfile and sendfile64.

2015-08-19  Dmitry V. Levin  <ldv@altlinux.org>

	sendfile: decode file offset both on entering and exiting syscall.
	When sendfile is called with a valid pointer to a file offset variable,
	kernel updates this variable on successfull exit from syscall.

	* sendfile.c (sys_sendfile, sys_sendfile64): Print tcp->u_arg[2]
	on exiting syscall as well as on entering.

2015-08-19  Dmitry V. Levin  <ldv@altlinux.org>

	io.c: move sendfile parsers to a separate file.
	* sendfile.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* io.c (sys_sendfile, sys_sendfile64): Move to sendfile.c

2015-08-19  Dmitry V. Levin  <ldv@altlinux.org>

	Make printnum_* functions return boolean status.
	With this change, printnum_* functions return true iff they
	successfully fetched necessary data from tracee's memory.

	* defs.h (printnum_short, printnum_int, printnum_int64,
	printnum_long_int, printpair_int, printpair_int64): Return bool.
	* util.c (DEF_PRINTNUM, DEF_PRINTPAIR, printnum_long_int): Likewise.

2015-08-19  Dmitry V. Levin  <ldv@altlinux.org>

	mips: print _MIPS_SIM in configure.ac for debug purposes.
	* configure.ac [MIPS]: Print _MIPS_SIM.

	xtensa: fix several syscall entries.
	* linux/xtensa/syscallent.h: Fix nargs in splice, tee, vmsplice,
	pselect6, ppoll, epoll_pwait, and set_robust_list syscall entries.

	ia64: fix syscall numbers for set_robust_list, get_robust_list, and splice syscalls
	* linux/ia64/syscallent.h: Place syscall entries for set_robust_list,
	get_robust_list, and splice in correct order.

2015-08-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add a test for get_robust_list and set_robust_list decoding.
	* tests/xet_robust_list.c: New file.
	* tests/xet_robust_list.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add xet_robust_list.
	(TESTS): Add xet_robust_list.test.
	* tests/.gitignore: Add xet_robust_list.

	Simplify printing of get_robust_list first argument.
	* get_robust_list.c (sys_get_robust_list): Print first argument
	using "%d" format.

2015-08-18  Elvira Khabirova  <lineprinter0@gmail.com>

	Fix io_setup first argument printing.
	* aio.c (sys_io_setup): Print first argument using "%u" format.

2015-08-18  Dmitry V. Levin  <ldv@altlinux.org>

	Fix printing tracee's long integers.
	Replace ambiguous printnum_long that used to fetch native long integers
	from tracee's memory with printnum_ptr, printnum_slong, and printnum_ulong
	that fetch tracee's pointer, signed long, and unsigned long integers.

	* defs.h (printnum_long, printpair_long): Remove prototypes.
	(printnum_int64, printpair_int64): Remove macros, declare functions
	unconditionally.
	[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (printnum_long_int):
	New prototype.
	(printnum_ptr, printnum_slong, printnum_ulong): New macros.
	* aio.c (sys_io_setup): Use printnum_ulong.
	* block.c (block_ioctl): Use printnum_slong and printnum_ulong.
	* get_robust_list.c (sys_get_robust_list): Use printnum_ptr
	and printnum_ulong.
	* io.c (print_off_t): Remove.
	(sys_sendfile): Use printnum_ulong.
	* ipc.c (sys_semctl): Use printnum_ptr.
	* prctl.c (sys_prctl): Likewise.
	* process.c (sys_ptrace): Likewise.
	* rtc.c (rtc_ioctl): Use printnum_ulong.
	* util.c (printnum_long, printpair_long): Remove.
	(printnum_int64, printpair_int64): Define unconditionally.
	[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (printnum_long_int):
	New function.

2015-08-18  Dmitry V. Levin  <ldv@altlinux.org>

	Fix time syscall decoding for some personalities.
	* time.c (current_time_t_is_int32): Define.
	(sys_time): Use it, printnum_int, and printnum_int64 instead
	of printnum_long.
	* tests/time.c: New file.
	* tests/time.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add time.
	(TESTS): Add time.test.
	* tests/.gitignore: Add time.

2015-08-18  Mike Frysinger  <vapier@gentoo.org>

	signal: SIGSYS: decode si_syscall & si_arch fields.
	When receiving SIGSYS, the si_syscall & si_arch fields are set to known
	values, so make sure we decode their values into the symbol settings.
	This makes stracing seccomp failures much easier.

	* defs.h (syscall_name): New prototype.
	* printsiginfo.c: Include linux/audit.h and xlat/audit_arch.h.
	(print_si_info): Decode si_syscall & si_arch for SIGSYS.
	* syscall.c (undefined_scno_name): Delete.
	(syscall_name): New function.
	(trace_syscall_entering): Change undefined_scno_name to syscall_name.
	(trace_syscall_exiting): Likewise.
	* xlat/audit_arch.in: New file.

2015-08-18  Elvira Khabirova  <lineprinter0@gmail.com>

	ipc.c: remove unnecesarry #ifdef IPC_64.
	* ipc.c (PRINTCTL): Remove #ifdef IPC_64 check as IPC_64 is always
	defined at this point.

2015-08-16  Elvira Khabirova  <lineprinter0@gmail.com>

	resource.c: move times parser to a separate file.
	* times.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* resource.c (sys_times): Move to times.c.

2015-08-16  Elvira Khabirova  <lineprinter0@gmail.com>

	sysctl.c: remove KERN_JAVA_* defines handling.
	This has been obsoleted by binfmt_misc since Linux 2.1.43.

	* sysctl.c (sys_sysctl): Remove KERN_JAVA_INTERPRETER
	and KERN_JAVA_APPLETVIEWER.

2015-08-16  Elvira Khabirova  <lineprinter0@gmail.com>

	sysinfo.c: remove obsolete code.
	struct sysinfo members totalhigh, freehigh and mem_unit are present
	since Linux 2.3.48.

	* configure.ac (AC_CHECK_MEMBERS): Remove struct sysinfo checks.
	* sysinfo.c (sys_sysinfo): Remove HAVE_STRUCT_SYSINFO_* checks.

2015-08-15  Gleb Fotengauer-Malinovskiy  <glebfm@altlinux.org>

	tests: add readlink.test and readlinkat.test.
	* tests/readlink.c: New file.
	* tests/readlink.awk: Likewise.
	* tests/readlinkat.c: Likewise.
	* tests/readlinkat.awk: Likewise.
	* tests/readlink.test: New test.
	* tests/readlinkat.test: Likewise.
	* tests/Makefile.am (check_PROGRAMS): Add readlink and readlinkat.
	(TESTS): Add readlink.test and readlinkat.test.
	(EXTRA_DIST): Add readlink.awk and readlinkat.awk.
	* tests/.gitignore: Add readlink and readlinkat.

2015-08-09  Dmitry V. Levin  <ldv@altlinux.org>

	Print nanoseconds along with seconds in stat family syscalls.
	* configure.ac (AC_CHECK_MEMBERS): Add stat.st_atim.tv_nsec,
	stat.st_ctim.tv_nsec, stat.st_mtim.tv_nsec, stat.st_atime_nsec,
	stat.st_atime_csec, and stat.st_mtime_nsec.
	* file.c: Explicitly define HAVE_STRUCT_STAT_ST_ATIME_NSEC,
	HAVE_STRUCT_STAT_ST_CTIME_NSEC and HAVE_STRUCT_STAT_ST_MTIME_NSEC
	for locally defined types.
	* printstat.h (DO_PRINTSTAT): Print st_atime_nsec, st_ctime_nsec,
	and st_mtime_nsec members.
	* tests/stat.c [_FILE_OFFSET_BITS == 64]: Use st_atime_nsec,
	st_ctime_nsec, and st_mtime_nsec via st_atim.tv_nsec, st_ctim.tv_nsec,
	and st_mtim.tv_nsec.
	(main): Print st_atime_nsec, st_ctime_nsec, and st_mtime_nsec members.

	This fixes Fedora bug #1251176.

2015-08-03  Dmitry V. Levin  <ldv@altlinux.org>

	signalfd4: fix flags decoding.
	* configure.ac (AC_CHECK_FUNCS): Add eventfd.
	(AC_CHECK_HEADERS): Add sys/signalfd.h.
	* signalfd.c: Include <fcntl.h>.
	[HAVE_SYS_SIGNALFD_H] Include <sys/signalfd.h>.
	Include "xlat/sfd_flags.h".
	(do_signalfd): Use sfd_flags for flags decoding.
	* xlat/sfd_flags.in: New file.
	* tests/signalfd.c: Likewise.
	* tests/signalfd.expected: Likewise.
	* tests/signalfd.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add signalfd.
	(TESTS): Add signalfd.test.
	(EXTRA_DIST): Add signalfd.expected.
	* tests/.gitignore: Add signalfd.

	signalfd, signalfd4: mark return code with RVAL_FD flag.
	* signalfd.c (do_signalfd): Set RVAL_FD flag in the return code.

	signal.c: move signalfd parsers to a separate file.
	* signalfd.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* signal.c (do_signalfd, sys_signalfd, sys_signalfd4): Move to signalfd.c

	perf_event_open: mark return code with RVAL_FD flag.
	* perf.c (sys_perf_event_open): Set RVAL_FD flag in the return code.

	pipe, pipe2, socketpair: print returned descriptors using printfd.
	* net.c (printpair_fd, decode_pair_fd): New functions.
	(do_pipe, sys_socketpair): Use them.

	socket: mark return code with RVAL_FD flag.
	* net.c (sys_socket): Set RVAL_FD flag in the return code.
	* tests/net-yy-accept.awk: Update socket and bind regexps.
	* tests/unix-yy-accept.awk: Likewise.
	* tests/net-yy-connect.awk: Update socket and connect regexps.
	* tests/unix-yy-connect.awk: Likewise.

	timerfd, timerfd_create: mark return code with RVAL_FD flag.
	* time.c (sys_timerfd, sys_timerfd_create): Set RVAL_FD flag
	in the return code.

2015-08-02  Dmitry V. Levin  <ldv@altlinux.org>

	inotify_init1: mark return code with RVAL_FD flag.
	* inotify.c (sys_inotify_init1): Set RVAL_FD flag in the return code.

	fanotify_init: mark return code with RVAL_FD flag.
	* fanotify.c (sys_fanotify_init): Set RVAL_FD flag in the return code.

	Fix epoll_create syscall decoding.
	* epoll.c (sys_epoll_create): New function.
	* linux/dummy.h (sys_epoll_create): Remove.

	epoll_create1: mark return code with RVAL_FD flag.
	* epoll.c (sys_epoll_create1): Set RVAL_FD flag in the return code.

	epoll_create1: fix pathtrace support.
	* pathtrace.c (pathtrace_match): Add SEN_epoll_create1.

	epoll_create1: fix flags decoding.
	* xlat/epollflags.in: Remove EPOLL_NONBLOCK, provide fallback definition
	for EPOLL_CLOEXEC.
	* tests/epoll_create1.c: New file.
	* tests/epoll_create1.expected: Likewise.
	* tests/epoll_create1.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add epoll_create1.
	(TESTS): Add epoll_create1.test.
	(EXTRA_DIST): Add epoll_create1.expected.
	* tests/.gitignore: Add epoll_create1.

2015-08-01  Dmitry V. Levin  <ldv@altlinux.org>

	desc.c: move epoll parsers to a separate file.
	* epoll.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* desc.c (sys_epoll_create1, print_epoll_event, sys_epoll_ctl,
	print_epoll_event_array, epoll_wait_common, epoll_wait, epoll_pwait):
	Move to epoll.c.

	eventfd2: fix flags decoding.
	* configure.ac (AC_CHECK_HEADERS): Add sys/eventfd.h.
	* eventfd.c: Include <fcntl.h>.
	[HAVE_SYS_EVENTFD_H] Include <sys/eventfd.h>.
	Include "xlat/efd_flags.h".
	(do_eventfd): Use efd_flags for flags decoding.
	* xlat/efd_flags.in: New file.
	* tests/eventfd.c: New file.
	* tests/eventfd.expected: Likewise.
	* tests/eventfd.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add eventfd.
	(TESTS): Add eventfd.test.
	(EXTRA_DIST): Add eventfd.expected.
	* tests/.gitignore: Add eventfd.

	eventfd: print first argument as unsigned int.
	* eventfd.c (do_eventfd): Explicitly cast initial value to unsigned int.

	Mark eventfd return code with RVAL_FD flag.
	* eventfd.c (do_eventfd): Set RVAL_FD flag in the return code.

	desc.c: move eventfd parsers to a separate file.
	* eventfd.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* desc.c (do_eventfd, sys_eventfd, sys_eventfd2): Move to eventfd.c.

	Update PERF_FLAG_* constants.
	* xlat/perf_event_open_flags.in: Add PERF_FLAG_FD_CLOEXEC,
	provide fallback definitions.

	desc.c: move perf_event_open parser to a separate file.
	* perf.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* desc.c (sys_perf_event_open): Move to perf.c.

2015-08-01  Elvira Khabirova  <lineprinter0@gmail.com>

	time.c: remove obsolete code from adjtimex parser.
	Linux versions 1.3.28 and below are not supported.

	* time.c (tprint_timex) [LINUX_VERSION_CODE < 66332]: Remove.

2015-08-01  Elvira Khabirova  <lineprinter0@gmail.com>

	ipc.c: move fallback definitions of msg, sem, and shm constants to xlat/
	* ipc.c: Move MSG_STAT and MSG_INFO definitions to xlat/msgctl_flags.in.
	Move SHM_STAT and SHM_INFO definitions to xlat/shmctl_flags.in.
	Move SEM_STAT and SEM_INFO definitions to xlat/semctl_flags.in.

2015-08-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests/ppoll: replace SIGABRT with SIGHUP.
	Use SIGHUP instead of SIGABRT, the number of the former
	is more portable across architectures.

	* tests/ppoll.c (test2): Replace SIGABRT with SIGHUP.
	* tests/ppoll.expected: Update regexp.
	* tests/ppoll-v.expected: Likewise.

2015-08-01  Dmitry V. Levin  <ldv@altlinux.org>

	decode_poll_exiting: reserve more space in output buffer.
	* poll.c (decode_poll_exiting): Reserve more space in output buffer.

2015-07-30  Dmitry V. Levin  <ldv@altlinux.org>

	Cleanup poll/ppoll decoders.
	* poll.c (decode_poll): Split into print_pollfd, decode_poll_entering,
	and decode_poll_exiting.
	(sys_poll, sys_ppoll): Update callers.
	* tests/ppoll.c: New file.
	* tests/ppoll.expected: Likewise.
	* tests/ppoll-v.expected: Likewise.
	* tests/ppoll.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add ppoll.
	(TESTS): Add ppoll.test.
	(EXTRA_DIST): Add ppoll.expected and ppoll-v.expected.
	* tests/.gitignore: Add ppoll.

	poll: print timeout argument as int.
	* poll.c (sys_poll): Explicitly cast timeout argument to int.

	stream.c: move poll and ppoll parsers to a separate file.
	* poll.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* stream.c (decode_poll, sys_poll, sys_ppoll): Move to poll.c.

	Assume that <poll.h> is available.
	* configure.ac (AC_CHECK_HEADERS): Remove poll.h and sys/poll.h.
	* pathtrace.c: Include <poll.h> unconditionally.
	* stream.c: Likewise.
	[HAVE_SYS_POLL_H]: Compile unconditionally.
	[!HAVE_SYS_POLL_H]: Remove.

	tests: add oldselect.test.
	* tests/oldselect.c: New file.
	* tests/oldselect.expected: Likewise.
	* tests/oldselect.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add oldselect.
	(TESTS): Add oldselect.test.
	(EXTRA_DIST): Add oldselect.expected.
	* tests/.gitignore: Add oldselect.

2015-07-30  Elvira Khabirova  <lineprinter0@gmail.com>

	Fix oldselect decoding on 64-bit architectures.
	As struct sel_arg_struct is an array of 32-bit values,
	fetch it using an intermediate array on 64-bit architectures.

	* desc.c (sys_oldselect): Rename args to long_args.
	[SIZEOF_LONG == 4] Alias oldselect_args to long_args.
	[SIZEOF_LONG != 4] Introduce oldselect_args to fetch oldselect args.
	* linux/sh64/syscallent.h (oldselect): Remove.

2015-07-30  Dmitry V. Levin  <ldv@altlinux.org>

	net.c: use printaddr.
	* net.c (printsock, sys_recvfrom): Use printaddr.

2015-07-30  Denys Vlasenko  <dvlasenk@redhat.com>

	net.c: recvfrom fixes.
	This change fixes these three problems (before/after is shown):

	On interrupted syscall, flags are not decoded:

	    -recvfrom(3, 0x7fff0a41e306, 10, 2, 0, 0) = ? ERESTARTSYS
	    +recvfrom(3, 0x7fff0a41e306, 10, MSG_PEEK, 0, 0) = ? ERESTARTSYS

	If peer address is unavalable (example: anon sockets from socketpair()),
	kernel returns socklen of 0, but we ignore that and show bogus sockaddr data:

	    -recvfrom(3, "123456789\0", 10, MSG_PEEK, {sa_family=0x7777 /* AF_??? */, sa_data="wwwwwwwwwwwwww"}, [0]) = 10
	    +recvfrom(3, "123456789\0", 10, MSG_PEEK, 0x7ffde6edf760, [0]) = 10

	SYS_FUNC(recvfrom) passes address of fromlen, not fromlen, to printsock():

	    -               printsock(tcp, tcp->u_arg[4], tcp->u_arg[5]);
	    +               printsock(tcp, tcp->u_arg[4], fromlen);

2015-07-29  Elliott Hughes  <enh@google.com>

	prctl: decode Android-specific PR_SET_VMA.
	Android kernels have a prctl to name VMAs.

	* prctl.c (sys_prctl) [__ANDROID__]: Decode PR_SET_VMA.

2015-07-29  Dmitry V. Levin  <ldv@altlinux.org>

	mips: fix stub files.
	This complements commit 140ecf876686d49085c6eb3a2306e2ea6ea641bc.

	* linux/mips/genstub.sh: Output SEN(printargs) instead of printargs.

	Reported-by: Elliott Hughes <enh@google.com>

2015-07-29  Dmitry V. Levin  <ldv@altlinux.org>

	tests/bpf: fix build with incompatibly old linux/bpf.h and/or gcc.
	* configure.ac: Check how union bpf_attr.log_buf initialization works.
	* tests/bpf.c: Check for HAVE_UNION_BPF_ATTR_LOG_BUF.

	Implement sched_getattr and sched_setattr syscalls decoding.
	* xlat/sched_flags.in: New file.
	* sched.c: Include "xlat/sched_flags.h".
	(print_sched_attr, sys_sched_setattr, sys_sched_getattr): New functions.
	* linux/dummy.h (sys_sched_getattr, sys_sched_setattr): Remove.
	* tests/sched_xetattr.c: New file.
	* tests/sched_xetattr.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add sched_xetattr.
	(TESTS): Add sched_xetattr.test.
	* tests/.gitignore: Add sched_xetattr.

	Implement memfd_create syscall decoding.
	* memfd_create.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* linux/dummy.h (sys_memfd_create): Remove.
	* pathtrace.c (pathtrace_match): Add SEN_memfd_create.
	* xlat/memfd_create_flags.in: New file.
	* tests/memfd_create.c: New file.
	* tests/memfd_create.expected: Likewise.
	* tests/memfd_create.test: New test.
	* tests/Makefile.am: (check_PROGRAMS): Add memfd_create.
	(TESTS): Add memfd_create.test.
	(EXTRA_DIST): Add memfd_create.expected.
	* tests/.gitignore: Add memfd_create.

2015-07-28  Elliott Hughes  <enh@google.com>

	Fix builds where HAVE_MQUEUE_H isn't defined.
	Android doesn't have <mqueue.h>.

	* ipc.c (sys_mq_open) [!HAVE_MQUEUE_H]: Fix printaddr invocation.

2015-07-27  Dmitry V. Levin  <ldv@altlinux.org>

	tests/restart_syscall: skip if nanosleep looks uninterrupted.
	* tests/restart_syscall.test: Skip if restart_syscall is not detected
	and nanosleep syscall looks uninterrupted.

	Implement execveat syscall decoding.
	* execve.c (decode_execve): New function.
	(sys_execve): Use it.
	(sys_execveat): New function.
	* linux/dummy.h (sys_execveat): Remove.
	* tests/execveat.c: New file.
	* tests/execveat.expected: Likewise.
	* tests/execveat-v.expected: Likewise.
	* tests/execveat.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add execveat.
	(TESTS): Add execveat.test.
	(EXTRA_DIST): Add execveat.expected and execveat-v.expected.
	* tests/.gitignore: Add execveat.

	execve: fix support of personalities with different word size.
	* execve.c (printargc): Do not assume that host and target pointers have
	the same size.
	* tests/execve.c: New file.
	* tests/execve.expected: Likewise.
	* tests/execve-v.expected: Likewise.
	* tests/execve.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add execve.
	(TESTS): Add execve.test.
	(EXTRA_DIST): Add execve.expected and execve-v.expected.
	* tests/.gitignore: Add execve.

	Implement bpf syscall decoding.
	* bpf.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* configure.ac (AC_CHECK_HEADERS): Add linux/bpf.h.
	* linux/dummy.h (sys_bpf): Remove.
	* pathtrace.c (pathtrace_match): Add SEN_bpf.
	* xlat/bpf_commands.in: New file.
	* xlat/bpf_map_types.in: New file.
	* xlat/bpf_map_update_elem_flags.in: New file.
	* xlat/bpf_prog_types.in: New file.
	* tests/bpf.c: New file.
	* tests/bpf.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add bpf.
	(TESTS): Add bpf.test.
	* tests/.gitignore: Add bpf.

2015-07-25  Dmitry V. Levin  <ldv@altlinux.org>

	prctl: fix decoding of unrecognized commands.
	The use of printargs introduced by commit v4.10-179-g210a6b6 is wrong:
	when the first argument is already printed, printargs cannot be called.

	* prctl.c (print_prctl_args): New function.
	(sys_prctl): Use it.

2015-07-23  Dmitry V. Levin  <ldv@altlinux.org>

	Macroize -m32/-mx32 configure checks.
	Prepare for additional configure checks that would be needed
	for new multiple personalities support.

	* m4/mpers.m4: New file.
	* configure.ac: Use it.

2015-07-22  Dmitry V. Levin  <ldv@altlinux.org>

	tests/uid: import uid overflow check from tests/uid16.
	* tests/uid.c (main): Skip if the uid returned by getuid matches
	/proc/sys/kernel/overflowuid.

2015-07-21  Dmitry V. Levin  <ldv@altlinux.org>

	sh64: fix inotify_{add,rm}_watch syscall entries.
	* linux/sh64/syscallent.h (inotify_add_watch, inotify_rm_watch):
	Set sys_func.

	microblaze: fix several syscall entries.
	* linux/microblaze/syscallent.h (signalfd4, eventfd2, epoll_create1,
	dup3, pipe2, inotify_init1, recvmmsg): Set sys_func.

	hppa: fix several syscall entries.
	* linux/hppa/syscallent.h (remap_file_pages, mq_open, mq_unlink,
	mq_timedsend, mq_timedreceive, mq_notify, mq_getsetattr,
	clock_nanosleep, signalfd, timerfd): Set sys_func.

	ia64: fix getpagesize syscall entry.
	* linux/ia64/syscallent.h (getpagesize): Fux nargs.

	avr32: fix fstatat64 syscall entry.
	* linux/avr32/syscallent.h (fstatat64): Set sys_func.

	alpha: fix 2 dummy osf syscall entries.
	* linux/alpha/syscallent.h (osf_set_program_attributes): Fix nargs.
	(osf_sigstack): Fix nargs and sys_name.

	alpha, arm, ia64, mips, sh64: fix semop syscall entries.
	* linux/alpha/syscallent.h (semop): Fix nargs, set sys_func.
	* linux/ia64/syscallent.h (semop): Set sys_func.
	* linux/mips/syscallent-n32.h (semop): Likewise.
	* linux/mips/syscallent-n64.h (semop): Likewise.
	* linux/arm/syscallent.h (semop): Fix nargs.
	* linux/sh64/syscallent.h (semop): Likewise.

	m68k: fix getpagesize decoding.
	* linux/m68k/syscallent.h (getpagesize): Set sys_func.
	* mem.c [M68K] (sys_getpagesize): Define.

	tests/ip_mreq: skip if basic setsockopt operations fail.
	* tests/ip_mreq.c (main): Return 77 if basic
	IP_ADD_MEMBERSHIP/IP_DROP_MEMBERSHIP options cannot be set.

2015-07-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: use -lpthread instead of -pthread.
	On some obscure systems, -lpthread is more likely to work than -pthread.

	* tests/Makefile.am (filter_unavailable_LDFLAGS): Rename to
	filter_unavailable_LDADD and change to -lpthread.

2015-07-21  Dmitry V. Levin  <ldv@altlinux.org>

	mips o32: fix utimensat syscall entry.
	* linux/mips/syscallent-o32.h (utimensat): set sys_flags and sys_func.

2015-07-21  Dmitry V. Levin  <ldv@altlinux.org>

	linux/mips/syscallent-compat.h: use designated initializers.
	Change linux/mips/syscallent-compat.h to use designated initializers
	like normal syscallent.h files.

	* linux/mips/syscallent-compat.h: Use designated initializers.

2015-07-21  Dmitry V. Levin  <ldv@altlinux.org>

	linux/mips/syscallent-compat.h: fix initalization of empty entries.
	This complements commit 140ecf876686d49085c6eb3a2306e2ea6ea641bc.

	* linux/mips/syscallent-compat.h: Fix initalization of empty entries.

2015-07-20  Dmitry V. Levin  <ldv@altlinux.org>

	Remove unused parsers of getmsg and putmsg.
	* stream.c [SPARC || SPARC64] (sys_putmsg, sys_getmsg): Remove.
	Stop including "xlat/msgflags.h".
	* xlat/msgflags.in: Remove.

	sigreturn: make use of RVAL_DECODED.
	* sigreturn.c (arch_sigreturn): New function.
	(sys_sigreturn): Use it.  Return RVAL_DECODED.
	* linux/alpha/arch_sigreturn.c: Update.
	* linux/crisv10/arch_sigreturn.c: Likewise.
	* linux/m68k/arch_sigreturn.c: Likewise.
	* linux/microblaze/arch_sigreturn.c: Likewise.
	* linux/x86_64/arch_sigreturn.c: Likewise.

	or1k_atomic.c: make use of RVAL_DECODED.
	* or1k_atomic.c (sys_or1k_atomic): Update for RVAL_DECODED.

	Update openat parser for the RVAL_DECODED change.
	* open.c (sys_openat): Update for RVAL_DECODED.

	bjm.c: make use of RVAL_DECODED.
	* bjm.c (sys_create_module, sys_delete_module, sys_init_module,
	sys_finit_module): Update for RVAL_DECODED.

	access.c: make use of RVAL_DECODED.
	* access.c (decode_access, sys_faccessat): Update for RVAL_DECODED.

	affinity.c: make use of RVAL_DECODED.
	* affinity.c (sys_sched_setaffinity): Update for RVAL_DECODED.

	affinity.c: use printaddr and umove_or_printaddr.
	* affinity.c (print_affinitylist): Use printaddr and umove_or_printaddr.
	(sys_sched_getaffinity): Remove redundant u_rval check.

	aio.c: enhance io_* syscalls decoding.
	* aio.c (sys_io_setup): Use printnum_int64 and printnum_long.
	(sys_io_destroy, sys_io_submit): Update for RVAL_DECODED.
	(sys_io_submit): Use umove_or_printaddr and printaddr.
	Enclose iocb array in square brackets.
	Change to traditional structure output format.
	(print_io_event): New function.
	(sys_io_cancel, sys_io_getevents): Use it.
	(sys_io_cancel): Use umove_or_printaddr and printaddr.
	(sys_io_getevents): Use printaddr.

	cacheflush.c: make use of RVAL_DECODED.
	* cacheflush.c (sys_cacheflush): Update for RVAL_DECODED.

	cacheflush.c: use printaddr.
	* cacheflush.c (sys_cacheflush): Use printaddr.

	capability.c: make use of RVAL_DECODED.
	* capability.c (sys_capset): Update for RVAL_DECODED.

	capability.c: use printaddr and umove_or_printaddr.
	* capability.c (get_cap_header): Use printaddr.
	(print_cap_data): Use printaddr and umove_or_printaddr.

	chdir.c: make use of RVAL_DECODED.
	* chdir.c (sys_chdir): Update for RVAL_DECODED.

	chmod.c: make use of RVAL_DECODED.
	* chmod.c (decode_chmod): Change to return void.
	(sys_chmod, sys_fchmodat): Update callers.  Update for RVAL_DECODED.
	(sys_fchmod): Update for RVAL_DECODED.

	clone.c: make use of RVAL_DECODED.
	* clone.c (sys_setns, sys_unshare, sys_fork): Update for RVAL_DECODED.

	Alias sys_epoll_create to printargs_ld.
	* desc.c (sys_epoll_create): Remove.
	* linux/dummy.h (sys_epoll_create): Alias to printargs_ld.

	desc.c: make use of RVAL_DECODED.
	* desc.c (sys_flock, sys_close, sys_dup, do_dup2, sys_epoll_create1,
	sys_epoll_ctl, do_eventfd, sys_perf_event_open): Update
	for RVAL_DECODED.

	desc.c: do not use xmalloc, use umove_or_printaddr and printaddr.
	* desc.c (printflock64, printflock): Use umove_or_printaddr.
	(decode_select): Do not use xmalloc.  Use umoven_or_printaddr
	and printaddr.
	(sys_oldselect): Use printaddr.
	(sys_epoll_ctl): Use umoven_or_printaddr and printaddr.
	(print_epoll_event_array): New function.
	(sys_epoll_wait_common): Use it.
	(sys_pselect6): Use umove_or_printaddr.
	(sys_eventfd2): Use printaddr.

	xlat/epollctls.in: add default values.
	* xlat/epollctls.in (EPOLL_CTL_ADD, EPOLL_CTL_DEL, EPOLL_CTL_MOD): Add
	default values.

	dirent.c: do not use xmalloc.
	* dirent.c (print_old_dirent): Use umove_or_printaddr.
	(sys_readdir): Use printaddr.
	(sys_getdents, sys_getdents64): Do not use xmalloc for dirents,
	treat malloc failure the same way as umoven failure.  Use printaddr.

	execve.c: make use of RVAL_DECODED.
	* execve.c (sys_execve, sys_execv): Update for RVAL_DECODED.

	execve.c: use printaddr and umove_or_printaddr.
	* execve.c (printargv): Use umoven_or_printaddr.
	(sys_execve, sys_execv): Use printaddr.

	fadvise.c: make use of RVAL_DECODED.
	* fadvise.c (sys_fadvise64, sys_fadvise64_64): Update for RVAL_DECODED.

	fallocate.c: make use of RVAL_DECODED.
	* fallocate.c (sys_fallocate): Update for RVAL_DECODED.

	fanotify.c: make use of RVAL_DECODED.
	* fanotify.c (sys_fanotify_init, sys_fanotify_mark): Update
	for RVAL_DECODED.

	fchownat.c: make use of RVAL_DECODED.
	* fchownat.c (sys_fchownat): Update for RVAL_DECODED.

	file.c: use umove_or_printaddr.
	* file.c (printstat32, printstatsol): Remove.
	(printstat, printstat64, printoldstat): Use umove_or_printaddr.

	futex.c: enhance futex syscall decoding.
	* futex.c (sys_futex): Use switch statement.  Use printaddr.
	Print uint32_t syscall arguments using %u format.
	Update for RVAL_DECODED.

	get_robust_list.c: use printnum_long.
	* get_robust_list.c (sys_get_robust_list): Use printnum_long.

	getcpu.c: use printnum_int and printaddr.
	* getcpu.c (sys_getcpu): Use printnum_int and printaddr.

	getcwd.c: use printaddr.
	* getcwd.c (sys_getcwd): Use printaddr.

	getrandom.c: use printaddr.
	* getrandom.c (sys_getrandom): Use printaddr.

	hostname.c: make use of RVAL_DECODED.
	* hostname.c (sys_sethostname): Update for RVAL_DECODED.

	hostname.c: use printaddr.
	* hostname.c (sys_gethostname): Use printaddr.

	inotify.c: make use of RVAL_DECODED.
	* inotify.c (sys_inotify_add_watch, sys_inotify_rm_watch,
	sys_inotify_init1): Update for RVAL_DECODED.

	io.c: make use of RVAL_DECODED.
	* io.c (sys_write, sys_writev, sys_pwrite, sys_pwritev, sys_sendfile,
	sys_sendfile64, sys_tee, sys_splice, sys_vmsplice): Update
	for RVAL_DECODED.

	Use printnum_int64 instead of print_loff_t.
	* defs.h (print_loff_t): Remove.
	* io.c (print_loff_t): Remove.
	(sys_sendfile64, sys_splice): Use printnum_int64 instead of print_loff_t.
	* mtd.c (mtd_ioctl): Likewise.

	io.c: use printaddr and umove_or_printaddr.
	* io.c (sys_read, sys_pread): Use printaddr.
	(tprint_iov_upto): Do not fetch data in case of syserror.
	Use printaddr.
	(sys_readv, sys_preadv): Remove redundant check for syserror.
	(print_off_t): Use printnum_int and printnum_long.
	(print_loff_t): Use umove_or_printaddr.

	ioprio.c: make use of RVAL_DECODED.
	* ioprio.c (sys_ioprio_set): Update for RVAL_DECODED.

	ipc.c: use printaddr and umove_or_printaddr.
	* ipc.c (sys_msgctl): Use printaddr.
	(tprint_msgbuf): New function.
	(tprint_msgsnd, tprint_msgrcv): Use it.
	(sys_msgrcv): Use umove_or_printaddr.
	(tprint_sembuf): Rename to tprint_sembuf_array.
	(tprint_sembuf): New function.
	(tprint_sembuf_array): Use it.
	(sys_semop, sys_semtimedop): Update callers.
	(sys_shmctl, sys_shmat, sys_shmdt): Use printaddr.
	(sys_mq_open, printmqattr): Use printaddr and umove_or_printaddr.
	* tests/ipc_msg.c (main): Update msgctl IPC_RMID regexp.
	* tests/ipc_shm.c (main): Update shmctl IPC_RMID regexp.

	kexec.c: use printaddr and umove_or_printaddr.
	* kexec.c (print_seg): New function.
	(print_kexec_segments): Use it.  Use printaddr and umove_or_printaddr.
	(kexec_load): Use printaddr.  Update for RVAL_DECODED.

	keyctl.c: make use of RVAL_DECODED.
	* keyctl.c (sys_add_key, sys_request_key): Update for RVAL_DECODED.
	(keyctl_join_session_keyring, keyctl_handle_key,
	keyctl_set_reqkey_keyring): Remove.
	(keyctl_get_keyring_id, keyctl_update_key, keyctl_handle_key_key,
	keyctl_read_key, keyctl_keyring_search, keyctl_chown_key,
	keyctl_instantiate_key, keyctl_instantiate_key_iov, keyctl_negate_key,
	keyctl_reject_key, keyctl_set_timeout, keyctl_get_persistent,
	keyctl_setperm_key): Change to return void.
	Update for RVAL_DECODED.
	(sys_keyctl): Update callers.  Update for RVAL_DECODED.

	keyctl.c: use printaddr.
	* keyctl.c (keyctl_read_key): Use printaddr.

	ldt.c: make use of RVAL_DECODED.
	* ldt.c (sys_modify_ldt, sys_set_thread_area, sys_get_thread_area):
	Update for RVAL_DECODED.

	ldt.c: use printaddr and umove_or_printaddr.
	* ldt.c [I386 || X86_64 || X32] (print_user_desc):
	Use umove_or_printaddr.
	[I386 || X86_64 || X32] (sys_modify_ldt): Use printaddr.
	[(M68K || MIPS] (set_thread_area): Likewise.
	[I386 || X86_64 || X32] (set_thread_area): Do not fetch data
	if !verbose.
	[I386 || X86_64 || X32] (get_thread_area): Remove redundant check
	for syserror.

	link.c: make use of RVAL_DECODED.
	* link.c (sys_link, sys_linkat, sys_unlinkat, sys_symlinkat): Update
	for RVAL_DECODED.

	lseek.c: make use of RVAL_DECODED.
	* lseek.c (sys_lseek): Update for RVAL_DECODED.

	lseek.c: use printnum_int64.
	* lseek.c (sys_llseek): Use printnum_int64.

	mem.c: make use of RVAL_DECODED.
	* mem.c (print_mmap): Change to return void.
	Update for RVAL_DECODED.
	(sys_old_mmap, sys_old_mmap_pgoff, sys_mmap, sys_mmap_pgoff,
	sys_mmap_4koff): Update callers.  Update for RVAL_DECODED.
	(sys_brk, sys_munmap, sys_mprotect, sys_mremap, sys_madvise,
	sys_mlockall, sys_msync, sys_remap_file_pages, sys_mbind,
	sys_set_mempolicy, sys_migrate_pages, [POWERPC] subpage_prot):
	Update for RVAL_DECODED.

	mem.c: use printaddr and umove_or_printaddr.
	* mem.c (sys_brk, print_mmap, sys_munmap, sys_mprotect, sys_mremap,
	sys_madvise, sys_msync, sys_mincore, sys_remap_file_pages, get_nodes,
	sys_mbind, [POWERPC] sys_subpage_prot): Use printaddr.
	(sys_get_mempolicy): Use printaddr and umove_or_printaddr.

	mknod.c: make use of RVAL_DECODED.
	* mknod.c (decode_mknod): Change to return void.
	Update for RVAL_DECODED.
	(sys_mknod, sys_mknodat): Update callers.  Update for RVAL_DECODED.
	[SPARC || SPARC64] (xmknod): Update for RVAL_DECODED.

	mount.c: make use of RVAL_DECODED.
	* mount.c (sys_mount): Update for RVAL_DECODED.

	mount.c: use printaddr.
	* mount.c (sys_mount): Use printaddr.

	Alias sys_connect to sys_bind.
	* linux/dummy.h (sys_connect): Alias to sys_bind.
	* net.c (sys_connect): Remove.

	net.c: make use of RVAL_DECODED.
	* net.c (sys_socket, sys_bind, sys_listen, sys_send, sys_sendto,
	sys_sendmsg, sys_shutdown, sys_setsockopt): Update for RVAL_DECODED.

	net.c: use printaddr and umove_or_printaddr.
	* net.c (printsock): Use printaddr and umove_or_printaddr.
	(printcmsghdr, printmsghdr, printmmsghdr, decode_mmsg, do_sockname,
	sys_recv, sys_recvfrom, sys_recvmsg, do_pipe, print_linger, print_ucred,
	print_tpacket_stats, print_icmp_filter, print_getsockopt,
	print_group_req, print_tpacket_req, print_packet_mreq,
	print_setsockopt): Use printaddr.
	(print_mreq, print_mreq6): Use umove_or_printaddr.

2015-07-18  Elvira Khabirova  <lineprinter0@gmail.com>

	tests: add sigaltstack.test.
	* tests/sigaltstack.c: New file.
	* tests/sigaltstack.expected: Likewise.
	* tests/sigaltstack.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add sigaltstack.
	(TESTS): Add sigaltstack.test.
	(EXTRA_DIST): sigaltstack.expected.
	* tests/.gitignore: Add sigaltstack.

	bootstrap: delete personality test directories beforehand.
	* bootstrap: Delete tests-m32 and tests-mx32 directories
	before creating them.

2015-07-18  Dmitry V. Levin  <ldv@altlinux.org>

	defs.h: do not include <signal.h>
	* printsiginfo.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h: Do not include <signal.h>.
	(printsiginfo): Remove.
	* printsiginfo.c: Include <signal.h> and "printsiginfo.h".
	* strace.c: Likewise.
	* sigaltstack.c: Include <signal.h>.
	* signal.c: Likewise.
	* sigreturn.c: Likewise.
	* time.c: Likewise.

	resource.c: move printrusage and printrusage32 to a separate file.
	* printrusage.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* resource.c (printrusage, [ALPHA] printrusage32): Move
	to printrusage.c.

	open.c: make use of RVAL_DECODED.
	* open.c (decode_open, sys_creat): Update for RVAL_DECODED.

	personality.c: make use of RVAL_DECODED.
	* personality.c (sys_personality): Update for RVAL_DECODED.

	printsiginfo.c: use umove_or_printaddr.
	* printsiginfo.c (printsiginfo_at): Use umove_or_printaddr.

	prctl.c: make use of RVAL_DECODED.
	* prctl.c (prctl_enter, prctl_exit): Merge into sys_prctl.
	(sys_prctl, sys_arch_prctl): Update for RVAL_DECODED.

	prctl.c: use printaddr and umove_or_printaddr.
	* prctl.c (prctl_exit): Use printaddr and umove_or_printaddr.

	process.c: use printaddr.
	* process.c (sys_ptrace): Use printaddr.

	process_vm.c: make use of RVAL_DECODED.
	* process_vm.c (sys_process_vm_writev): Update for RVAL_DECODED.

	process_vm.c: use printaddr.
	* process_vm.c (sys_process_vm_readv): Use printaddr.

	reboot.c: make use of RVAL_DECODED.
	* reboot.c (sys_reboot): Update for RVAL_DECODED.

	Enhance quotactl decoding.
	* quota.c (decode_cmd_data): Use umove_or_printaddr.
	(sys_quotactl): Do not disable the parser in verbose mode.
	Decode all "set" commands on entering syscall.

	readahead.c: make use of RVAL_DECODED.
	* readahead.c (sys_readahead.c): Update for RVAL_DECODED.

	readlink.c: use printaddr.
	* readlink.c (decode_readlink): Use printaddr.

	renameat.c: make use of RVAL_DECODED.
	* renameat.c (sys_renameat, sys_renameat2): Update for RVAL_DECODED.

	resource.c: make use of RVAL_DECODED.
	* resource.c (sys_setrlimit, sys_getpriority, sys_setpriority):
	Update for RVAL_DECODED.

	resource.c: use umove_or_printaddr.
	* resource.c (print_rlimit64, print_rlimit32, printrusage32,
	printrusage, sys_times): Use umove_or_printaddr.
	(decode_rlimit64): Remove.
	(decode_rlimit): Remove redundant checks.
	[defined(current_wordsize) && current_wordsize != 4] (decode_rlimit):
	Define to print_rlimit64.
	(sys_prlimit64): Replace decode_rlimit64 with print_rlimit64.

	sched.c: make use of RVAL_DECODED.
	* sched.c (sys_sched_setscheduler, sys_sched_setparam,
	sys_sched_get_priority_min): Update for RVAL_DECODED.

	sched.c: use printnum_int and printaddr.
	* sched.c (sys_sched_setscheduler, sys_sched_getparam,
	sys_sched_setparam): Use printnum_int for sched_param decoding.
	(sched_rr_get_interval): Use printaddr.

	scsi.c: use printaddr.
	* scsi.c (print_sg_io_buffer): Use printaddr.

2015-07-17  Dmitry V. Levin  <ldv@altlinux.org>

	seccomp.c: make use of RVAL_DECODED.
	* seccomp.c (sys_seccomp): Update for RVAL_DECODED.

	seccomp.c: use printaddr and umove_or_printaddr.
	* seccomp.c (decode_fprog, decode_seccomp_set_mode_strict):
	Use printaddr.
	(print_seccomp_filter): Use umove_or_printaddr.

	sigaltstack.c: use printaddr and umove_or_printaddr.
	* sigaltstack.c (print_stack_t): Use umove_or_printaddr and printaddr.

	signal.c: make use of RVAL_DECODED.
	* signal.c (sys_sigsuspend, sys_kill, sys_tgkill, sys_rt_sigsuspend,
	sys_rt_sigqueueinfo, sys_rt_tgsigqueueinfo, sys_restart_syscall,
	do_signalfd): Update for RVAL_DECODED.

	signal.c: use printaddr and umove_or_printaddr.
	* signal.c (print_sigset_addr_len, decode_old_sigaction):
	Use printaddr and umove_or_printaddr.
	(sys_signal): Use printaddr.
	(sys_sigprocmask, sys_sigpending, sys_rt_sigprocmask,
	sys_rt_sigpending): Remove redundant checks for syserror.
	(decode_new_sigaction): Use umove_or_printaddr.

2015-07-16  Dmitry V. Levin  <ldv@altlinux.org>

	sram_alloc.c: make use of RVAL_DECODED.
	* sram_alloc.c [BFIN] (sys_sram_alloc): Update for RVAL_DECODED.

	statfs.c: use umove_or_printaddr.
	* statfs.c (printstatfs, printstatfs64, printcompat_statfs64):
	Use umove_or_printaddr.

	swapon.c: make use of RVAL_DECODED.
	* swapon.c (sys_swapon): Update for RVAL_DECODED.

	swapon.c: move fallback definitions of swap options to xlat/
	* swapon.c: Move definitions of SWAP_FLAG_* flags ...
	* xlat/swap_flags.in: ... here.

	sync_file_range2: fix typo in flags decoding.
	* sync_file_range.c (sys_sync_file_range2): Fix typo in flags decoding.

	sync_file_range.c: make use of RVAL_DECODED.
	* sync_file_range.c (sys_sync_file_range, sys_sync_file_range2): Update
	for RVAL_DECODED.

	syslog.c: use umove_or_printaddr and RVAL_DECODED.
	* sysctl.c (sys_sysctl): Use umove_or_printaddr and RVAL_DECODED.

	sysinfo.c: use umove_or_printaddr.
	* sysinfo.c (sys_sysinfo): Use umove_or_printaddr.

	syslog.c: make use of RVAL_DECODED.
	* syslog.c (sys_syslog): Update for RVAL_DECODED.

	syslog.c: use printaddr.
	* syslog.c (sys_syslog): Use printaddr.

	sysmips.c: cleanup.
	* sysmips.c [MIPS] (sys_sysmips): Use switch statement.  Use printaddr.
	Fix misprinted ", " delimiter.

	sysmips.c: make use of RVAL_DECODED.
	* sysmips.c [MIPS] (sys_sysmips): Update for RVAL_DECODED.

	time.c: make use of RVAL_DECODED.
	* time.c (sys_settimeofday, sys_osf_settimeofday, sys_clock_settime,
	sys_timerfd, sys_timerfd_create, sys_timerfd_settime): Update
	for RVAL_DECODED.
	(timerfd_gettime): Decode struct itimerspec argument on exiting syscall.

	time.c: use printaddr, printnum_int, and umoven_or_printaddr.
	* time.c (sys_nanosleep): Use printaddr.
	(printitv_bitness, tprint_timex32, tprint_timex, printsigevent32,
	printsigevent): Use umoven_or_printaddr.
	(sys_timer_create): Use printnum_int.
	(sys_getitimer, sys_osf_getitimer, sys_setitimer, sys_osf_setitimer,
	do_adjtimex, sys_timer_settime, sys_timer_gettime): Remove
	redundant checks for syserror.

	sprinttv: do not fetch data in case of syserror.
	* time.c (sprinttv): Do not fetch data in case syserror.
	Print address instead of {...} in case of umove failure.
	(sys_gettimeofday, sys_osf_gettimeofday, sys_adjtime, sys_clock_gettime,
	clock_nanosleep): Remove now redundant checks for syserror.

	truncate.c: make use of RVAL_DECODED.
	* truncate.c (sys_truncate, sys_truncate64, sys_ftruncate,
	sys_ftruncate64): Update for RVAL_DECODED.

	umask.c: make use of RVAL_DECODED.
	* umask.c (sys_umask): Update for RVAL_DECODED.

	umount.c: make use of RVAL_DECODED.
	* umount.c (sys_umount2): Update for RVAL_DECODED.

	utimes.c: make use of RVAL_DECODED.
	* utimes.c (decode_utimes): Change to return void.
	Update for RVAL_DECODED.
	(sys_utimes, sys_futimesat, sys_utimensat, sys_osf_utimes):
	Update callers.  Update for RVAL_DECODED.

2015-07-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests/uid.test: adopt for alpha.
	Make the test work on alpha that has getxuid syscall instead of getuid.

	* tests/uid.awk (BEGIN): Update getuid regexp to match both getuid
	and getxuid syscalls.
	* tests/uid.c (main): Allow __NR_getxuid as an alternative
	to __NR_getuid.
	* tests/uid.test: If getuid syscall is not available, probe for
	getxuid syscall.

2015-07-16  Dmitry V. Levin  <ldv@altlinux.org>

	uid.c: make use of RVAL_DECODED.
	* uid.c (sys_setuid, sys_setreuid, sys_setresuid, sys_chown, sys_fchown,
	sys_setgroups): Update for RVAL_DECODED.

	uid.c: use printaddr and umoven_or_printaddr.
	* uid.c (get_print_uid): Use umoven_or_printaddr.
	(sys_getresuid): Do not check for syserror, get_print_uid now does
	the right thing.
	(sys_setgroups, sys_getgroups): Add const qualifier to local variables
	that are assigned once.  Use printaddr.

	ia64: wire up utimensat syscall.
	* linux/ia64/syscallent.h (utimensat): New entry.

	decode_utimes: enclose timespec array in square brackets.
	* utimes.c (decode_utimes): enclose timespec array in square brackets
	instead of curly brackets.

	uname.c: use umove_or_printaddr.
	* uname.c (sys_uname): Use umove_or_printaddr.

	tests: add utime.test.
	* tests/utime.c: New file.
	* tests/utime.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add utime.
	(TESTS): Add utime.test.
	* tests/.gitignore: Add utime.

	utime.c: make use of RVAL_DECODED.
	* utime.c (sys_utime): Update for RVAL_DECODED.

	utime.c: use umoven_or_printaddr.
	* utime.c (sys_utime): Use umoven_or_printaddr.

2015-07-15  Dmitry V. Levin  <ldv@altlinux.org>

	wait.c: use printaddr and umove_or_printaddr.
	* wait.c (waitid): Do not check for NULL the address passed
	to printrusage.
	(printwaitn): Likewise.
	Use printaddr and umove_or_printaddr for fetching wait status.

	wait: move fallback definitions of wait options to xlat/
	* wait.c: Move definitions of __W* flags ...
	* xlat/wait4_options.in: ... here.

	tests: add xattr.test.
	* tests/xattr.c: New file.
	* tests/xattr.expected: Likewise.
	* tests/xattr.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add xattr.
	(TESTS): Add xattr.test.
	(EXTRA_DIST): Add xattr.expected.
	* tests/.gitignore: Add xattr.

2015-07-14  Dmitry V. Levin  <ldv@altlinux.org>

	xattr.c: make use of RVAL_DECODED.
	* xattr.c (sys_setxattr, sys_fsetxattr, sys_removexattr,
	sys_fremovexattr): Update for RVAL_DECODED.

	print_xattr_val: do not fetch data in case of !verbose || syserror.
	* xattr.c (print_xattr_val): Do not fetch data in case
	of !verbose || syserror.   Use printaddr.

	print_xattr_list: use printaddr.
	* xattr.c (print_xattr_list): Use printaddr.

	print_xattr_val: remove unused argument.
	* xattr.c (print_xattr_val): Remove unused "failed" argument.
	(sys_setxattr, sys_fsetxattr, sys_getxattr, sys_fgetxattr): Update
	all callers.

	print_xattr_list: remove redundant address check.
	* xattr.c (print_xattr_list): Do not check for NULL the address passed
	to printstr.

	ipc.c: make use of RVAL_DECODED.
	* ipc.c (sys_mq_notify, sys_mq_open, sys_mq_timedreceive,
	sys_mq_timedsend, sys_msgctl, sys_msgget, sys_msgsnd, sys_semctl,
	sys_semget, sys_semop, sys_semtimedop, sys_shmctl, sys_shmdt,
	sys_shmget): Update for RVAL_DECODED.
	(sys_shmat): Decode all arguments on entering syscall.

2015-07-14  Dmitry V. Levin  <ldv@altlinux.org>

	umoven_or_printaddr: do not fetch data if not in verbose mode.
	After this change, umoven_or_printaddr and its callers, including
	printnum_* and printpair_*, will not fetch data in !verbose mode.

	* util.c (umoven_or_printaddr): Do not call umoven if !verbose.

2015-07-14  Dmitry V. Levin  <ldv@altlinux.org>

	Change printnum_* printers to honor syserror.
	With this change, printnum_* printers will not attempt to fetch data
	in case of exiting(tcp) && syserror(tcp).
	All "at exiting" decoders that call these printers have been made
	ready for this change in previous commits.

	* util.c (DEF_PRINTNUM, DEF_PRINTPAIR): Use umove_or_printaddr.
	* prctl.c (prctl_exit): Use printnum_int and printnum_long.
	(sys_arch_prctl): Do not check for syserror.

2015-07-13  Dmitry V. Levin  <ldv@altlinux.org>

	term.c: enhance tty ioctl parser.
	Decode as much data on entering syscall as possible.

	* term.c (decode_termios, decode_termio, decode_winsize, decode_ttysize,
	decode_modem_flags): New functions.
	(term_ioctl): Use them.  Update for RVAL_DECODED.

2015-07-12  Elvira Khabirova  <lineprinter0@gmail.com>

	Change comparisons with function pointers to comparisons with SENs.
	* pathtrace.c (pathtrace_match): Change all comparisons with function
	pointers to a single SEN based switch.
	* syscall.c (dumpio, trace_syscall_entering): Change all comparisons
	with function pointers to comparisons with SENs.
	* ipc.c (sys_ipc): Remove.
	* sock.c (sys_socketcall): Likewise.
	* linux/dummy.h (sys_ipc, sys_socketcall): New aliases.

	Add unique syscall entry numbers (SENs)
	* Makefile.am (BUILT_SOURCES, CLEANFILES): Add sen.h.
	(syscallent_names, syscallent_patterns, syscallent_files): New variables.
	(sen.h): New rule.
	* defs.h (struct sysent): Add sen field.
	* generate_sen.sh: New file.
	* linux/syscall.h: Include "sen.h".
	* syscall.c (SEN_NAME): New temporary macro.
	(SEN): Use it to prepend syscall entry number.

	Introduce SEN macro.
	* syscall.c (SEN): New temporary macro.
	* linux/dummy.h (sys_printargs): New macro.
	* linux/subcall.h: Wrap all sys_func entries using SEN.
	* linux/*/syscallent*.h: Likewise.

2015-07-10  Dmitry V. Levin  <ldv@altlinux.org>

	scsi.c: enhance SG_IO ioctl parser.
	Fix SG_IO ioctl output in case of failed umove

	* scsi.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
	Update for RVAL_DECODED.
	(print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req,
	print_sg_io_v4_res): Do not print address in case of failed umove.
	(scsi_ioctl): Use printaddr.

2015-07-10  Dmitry V. Levin  <ldv@altlinux.org>

	ptp.c: enhance ptp ioctl parser.
	* ptp.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
	Update for RVAL_DECODED.
	(ptp_ioctl): Use umove_or_printaddr.

2015-07-10  Dmitry V. Levin  <ldv@altlinux.org>

	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  Dmitry V. Levin  <ldv@altlinux.org>

	sock.c: enhance socket ioctl parser.
	Decode as much data on entering syscall as possible.

	* sock.c: Update for RVAL_DECODED.
	(print_addr): Remove.
	(print_ifreq_addr, print_ifreq, print_ifc_len, decode_ifconf): New
	functions.
	(sock_ioctl) Use them.  Use umove_or_printaddr.

2015-07-10  Dmitry V. Levin  <ldv@altlinux.org>

	block.c: enhance block ioctl parser.
	* block.c: Update for RVAL_DECODED.
	Define BLKROTATIONAL and BLKZEROOUT.
	(block_ioctl): Decode them.  Use printnum_short, printnum_int,
	printnum_long, printpair_int64, and umove_or_printaddr.
	(print_blkpg_req, block_ioctl): Use umove_or_printaddr.

2015-07-09  Dmitry V. Levin  <ldv@altlinux.org>

	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  Dmitry V. Levin  <ldv@altlinux.org>

	loop.c: enhance loop ioctl parser.
	Decode as much data on entering syscall as possible.

	* loop.c: Include <linux/ioctl.h> instead of <sys/ioctl.h>.
	Update for RVAL_DECODED.
	(decode_loop_info, decode_loop_info64): New functions.
	(loop_ioctl): Use them.  Decode LOOP_SET_STATUS, LOOP_SET_STATUS64,
	LOOP_SET_FD, LOOP_CHANGE_FD, LOOP_CTL_ADD and LOOP_CTL_REMOVE on
	entering syscall.
	Print LOOP_SET_FD and LOOP_CHANGE_FD arguments using printfd.

2015-07-09  Dmitry V. Levin  <ldv@altlinux.org>

	rtc.c: enhance rtc ioctl parser.
	* rtc.c: Update for RVAL_DECODED.
	(print_rtc): Rename to print_rtc_time.
	(decode_rtc_time, decode_rtc_wkalrm): New functions.
	(rtc_ioctl): Use them.
	[RTC_VL_READ]: Decode RTC_VL_READ.
	Use printnum_long for RTC_IRQP_READ and RTC_EPOCH_READ decoding.

	Use printpair_int.
	* evdev.c (repeat_ioctl): Use printpair_int.
	* net.c (do_pipe, sys_socketpair): Likewise.

2015-07-09  Dmitry V. Levin  <ldv@altlinux.org>

	Add several generic integer pairs printing functions.
	Add functions to fetch and print pairs of integer types.
	Note that these printers do not attempt to fetch data
	in case of exiting(tcp) && syserror(tcp).

	printnum_* printers will follow as soon as all callers are made ready
	for this change.

	* defs.h (printpair_int, printpair_long, printpair_int64): New
	prototypes.
	* util.c (DEF_PRINTPAIR): New macro.
	(printpair_int, printpair_long, printpair_int64): New functions.

2015-07-09  Dmitry V. Levin  <ldv@altlinux.org>

	Add two generic integer printing functions.
	Add printnum_short and printnum_int64 in addition to already existing
	printnum_int and printnum_long.

	* defs.h (printnum_short, printnum_int64): New prototypes.
	* util.c (DEF_PRINTNUM): New macro.
	(printnum_int, printnum_long): Use DEF_PRINTNUM.
	(printnum_short, printnum_int64): New functions.

2015-07-09  Dmitry V. Levin  <ldv@altlinux.org>

	Add address printing functions.
	printaddr is a simple function implementing "print NULL or address"
	idiom.
	umoven_or_printaddr is a wrapper around umoven that has the same return
	value semantics as umoven but also prints the address when the data
	is not going to be fetched (in case of exiting(tcp) && syserror(tcp))
	or cannot be fetched (umoven fails).
	umove_or_printaddr is a macro wrapper around umoven_or_printaddr that
	mirrors umove wrapper around umoven.

	* defs.h (printaddr, umoven_or_printaddr): New prototypes.
	(umove_or_printaddr): New macro.
	* util.c (printaddr, umoven_or_printaddr): New functions.

2015-07-09  Dmitry V. Levin  <ldv@altlinux.org>

	Implement RVAL_DECODED flag.
	Implement a method for "on entering" parsers to return
	"done with decoding" information to their callers.

	If a syscall parser called from trace_syscall_entering returns a value
	with RVAL_DECODED bit set, record this value in tcp->sys_func_rval
	and use it in trace_syscall_exiting instead of calling the parser on
	exiting syscall.

	If an ioctl parser returned RVAL_DECODED, this would tell
	SYS_FUNC(ioctl) that the decoding is finished but fallback printing of
	the ioctl command argument is needed, while e.g. RVAL_DONE+1 would mean
	that the decoding is finished and no fallback decoding is needed.

	* defs.h (struct tcb): Add sys_func_rval.
	(RVAL_DECODED): New macro.
	* syscall.c (trace_syscall_entering): Initialize tcp->sys_func_rval
	along with setting TCB_INSYSCALL flag.
	(trace_syscall_exiting): Use tcp->sys_func_rval instead of calling
	tcp->s_ent->sys_func when the former has RVAL_DECODED flag set.
	Reset tcp->sys_func_rval along with clearing TCB_INSYSCALL flag.
	* ioctl.c (sys_ioctl): Set RVAL_DECODED flag on exiting.
	Print ioctl argument iff RVAL_DECODED is set and fallback decoding
	is requested.

2015-07-05  Dmitry V. Levin  <ldv@altlinux.org>

	time.c: move rtc ioctl parser to a separate file.
	* rtc.c: new file
	* Makefile.am (strace_SOURCES): Add it.
	* time.c (print_rtc, rtc_ioctl): Move to rtc.c.

	term.c: fix typo.
	* term.c: Rename TCLFLSH to TCFLSH.

	Do not include sys/filio.h.
	* configure.ac (AC_CHECK_HEADERS): Remove sys/filio.h.
	* term.c: Do not include <sys/filio.h>.

2015-07-02  Dmitry V. Levin  <ldv@altlinux.org>

	ioctl: prepare ioctl_decode_command_number for future changes.
	* ioctl.c (ioctl_decode_command_number): Change 1st arg to struct tcb*.
	(sys_ioctl): Update callers.

	ioctl: simplify ioctl_decode signature.
	* ioctl.c (ioctl_decode): Remove 2nd and 3rd parameters.
	(sys_ioctl): Update callers.

	ioctl: consistently use name "code" for ioctl request code.
	* ioctl.c (evdev_decode_number, hiddev_decode_number,
	ioctl_decode_command_number): Rename "arg" to "code".

	Move ioctl syscall parser to ioctl.c.
	* io.c (sys_ioctl): Move ...
	* ioctl.c: ... here.
	(ioctl_lookup, ioctl_next_match, ioctl_print_code, ioctl_decode,
	ioctl_decode_command_number): Declare as static.
	* defs.h (ioctl_lookup, ioctl_next_match, ioctl_print_code,
	ioctl_decode, ioctl_decode_command_number): Remove.

	ioctl: remove obsolete registry of ioctl characters.
	* ioctl.c: Remove registry of ioctl characters.

2015-06-30  Dmitry V. Levin  <ldv@altlinux.org>

	Fix filtering of <unavailable> syscalls.
	* syscall.c (trace_syscall_exiting): Skip filtered syscalls also in case
	of get_regs or get_syscall_result failure.
	* tests/filter-unavailable.c: New file.
	* tests/filter-unavailable.expected: Likewise.
	* tests/filter-unavailable.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add filter-unavailable.
	(filter_unavailable_LDFLAGS): Add -pthread.
	(TESTS): Add filter-unavailable.test.
	(EXTRA_DIST): Add filter-unavailable.expected.
	* tests/.gitignore: Add filter-unavailable.

	Reported-by: Bryan Matsuo <bryan.matsuo@gmail.com>

2015-06-30  Dmitry V. Levin  <ldv@altlinux.org>

	Fix -qq option in conjunction with -o option.
	This change makes -qq option work in conjunction with -o option,
	thus complementing commit v4.7-222-g01997cf.

	* strace.c (init): Do not reset qflag.

2015-06-30  Dmitry V. Levin  <ldv@altlinux.org>

	xtensa: wire up new syscalls.
	* linux/xtensa/syscallent.h (bpf, execveat): New entries.

	bfin: wire up new syscalls.
	* linux/bfin/syscallent.h (kcmp, finit_module, sched_setattr,
	sched_getattr, renameat2, seccomp, getrandom, memfd_create,
	bpf, execveat): New entries.

	alpha: wire up new syscalls.
	* linux/alpha/syscallent.h (getrandom, memfd_create, execveat):
	New entries.

2015-06-17  Dmitry V. Levin  <ldv@altlinux.org>

	tests: skip stat32 test if struct stat is defined incorrectly.
	If stat.st_mode returned by syscall is 0, it means that the definition
	of struct stat in <asm/stat.h> is incorrect.  This is the case e.g. on
	mips n32 where the only available stat syscall is 64-bit but at the same
	time struct stat defined by <asm/stat.h> is 32-bit.

	* tests/stat.c (main) [NR_stat]: Return 77 if st_mode is 0.

2015-06-17  Dmitry V. Levin  <ldv@altlinux.org>

	Consistenly use #ifdef to check for AC_DEFINE'd macros.
	* aio.c (print_common_flags): Use #ifdef in the check for
	HAVE_STRUCT_IOCB_U_C_FLAGS.
	* defs.h: Use #ifdef in the check for HAVE_LITTLE_ENDIAN_LONG_LONG.
	* net.c: Use #ifdef in the check for HAVE_SENDMSG.
	* syscall.c (dumpio): Likewise.
	* printstat.h (DO_PRINTSTAT): Use #ifdef in checks for
	HAVE_STRUCT_STAT_ST_* macros.
	* util.c: Use #ifdef in checks for HAVE_SYS_XATTR_H.

	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.

	link: move fallback definitions of AT_* constants to xlat/
	* link.c: Move definitions of AT_* constants ...
	* xlat/at_flags.in: ... here.

	net: move fallback definitions of SOL_* constants to xlat/
	* net.c: Move definitions of SOL_* constants ...
	* xlat/socketlayers.in: ... here.

	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.

	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-16  Dmitry V. Levin  <ldv@altlinux.org>

	Update mount flags constants.
	* mount.c: Remove definitions of mount flags constants.
	* xlat/mount_flags.in: Update from linux v4.0, add default values.

	mount: update parser to match kernel behaviour.
	* mount.c (sys_mount): Do not decode type and data strings for
	MS_SHARED, MS_PRIVATE, MS_SLAVE, and MS_UNBINDABLE mount flags
	that do not imply valid strings.

	mount: robustify MS_MGC_VAL decoding.
	* mount.c (sys_mount): When printing mount flags, do not assume that
	(flags & MS_MGC_MSK) == MS_MGC_VAL.

2015-06-08  Dmitry V. Levin  <ldv@altlinux.org>

	net: decode setsockopt() multicast arguments.
	* configure.ac (AC_CHECK_FUNCS): Add inet_pton.
	* net.c (print_mreq, print_mreq6): New functions.
	(print_setsockopt): Use them to decode IP_ADD_MEMBERSHIP,
	IP_DROP_MEMBERSHIP, IPV6_ADD_MEMBERSHIP, IPV6_DROP_MEMBERSHIP,
	IPV6_JOIN_ANYCAST, and IPV6_LEAVE_ANYCAST.
	* tests/ip_mreq.c: New file.
	* tests/ip_mreq.expected: Likewise.
	* tests/ip_mreq.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add ip_mreq.
	(TESTS): Add ip_mreq.test.
	(EXTRA_DIST): ip_mreq.expected.
	* tests/.gitignore: Add ip_mreq.

	Based on patch by Ben Noordhuis <info@bnoordhuis.nl>.

2015-06-08  Dmitry V. Levin  <ldv@altlinux.org>

	Update IPV6 socket options constants.
	* xlat/sockipv6options.in: Update from linux v4.0.

2015-06-05  Dmitry V. Levin  <ldv@altlinux.org>

	net: factor out interface index printing code.
	* net.c (print_ifindex): New function.
	(printsock) [HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID]: Use it.

2015-05-25  Dmitry V. Levin  <ldv@altlinux.org>

	Consistently use error_msg instead of fprintf(stderr)
	* linux/alpha/get_scno.c: Use error_msg.
	* linux/arm/get_scno.c: Likewise.
	* linux/mips/get_scno.c: Likewise.
	* linux/sh/get_scno.c: Likewise.
	* linux/x86_64/get_scno.c: Likewise.
	* exit.c (sys_exit): Likewise.
	* pathtrace.c (pathtrace_select, pathtrace_match): Likewise.
	* strace.c (alloctcb, droptcb, detach, startup_attach,
	test_ptrace_seize, init, cleanup, print_debug_info,
	maybe_allocate_tcb, startup_tcb, trace): Likewise.
	* syscall.c (update_personality, trace_syscall_exiting,
	get_scno): Likewise.
	* unwind.c (DPRINTF): Likewise.
	* tests/bexecve.test: Update patterns.
	* tests/detach-stopped.test: Likewise.

	Consistently print OOM diagnostic messages.
	* bjm.c (sys_query_module): Use error_msg to print OOM diagnostics.
	* util.c (dumpiov, dumpstr): Likewise.

2015-05-25  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce memory allocation wrappers.
	Introduce wrappers to the following functions that do memory allocation:
	malloc, calloc, realloc, strdup.

	This commit is a follow-up to the related discussions in strace-devel ML:
	http://sourceforge.net/p/strace/mailman/message/33618180/
	http://sourceforge.net/p/strace/mailman/message/33733470/

	* defs.h (xmalloc, xcalloc, xreallocarray, xstrdup): New prototypes.
	* xmalloc.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* count.c (count_syscall, call_summary_pers): Use xcalloc.
	* desc.c (decode_select): Use xmalloc.
	* dirent.c (sys_getdents, sys_getdents64): Likewise.
	* net.c (sys_recvmmsg): Use xstrdup.
	* pathtrace.c (storepath): Use xreallocarray.
	(pathtrace_match): Use xmalloc.
	* strace.c (die_out_of_memory): Move to xmalloc.c.
	(expand_tcbtab): Use xcalloc and xreallocarray.
	(startup_child): Use xstrdup.
	(init): Use xmalloc, xcalloc, and xstrdup.
	* syscall.c (reallocate_qual): Use xreallocarray.
	(qualify): Use xstrdup.
	* unwind.c (unwind_tcb_init): Use xmalloc.
	(build_mmap_cache): Use xcalloc, xreallocarray, and xstrdup.
	(get_symbol_name): Use xreallocarray.
	(stacktrace_walk, queue_put): Use xmalloc.
	* util.c (printstr): Use xmalloc.
	* vsprintf.c (strace_vfprintf): Likewise.

2015-05-21  Dmitry V. Levin  <ldv@altlinux.org>

	Fix ioctl entries on 32-bit architectures with 64-bit aligned structures
	Some ioctl constants are defined to different values on those 32-bit
	architectures where structures containing a 64-bit field are aligned on
	a 8-byte boundary and have a size multiple of 8 bytes, and on other
	32-bit architectures.

	* configure.ac: Check the size of a structure containing a 64-bit field.
	* linux/32/ioctls_inc.h: Rename to ...
	* linux/32/ioctls_inc_align32.h: ... this.
	* linux/32/ioctls_inc_align64.h: New file.
	* linux/32/ioctls_inc.h: Include either 32/ioctls_inc_align32.h
	or ioctls_inc_align64.h depending on SIZEOF_STRUCT_I64_I32.
	* Makefile.am (EXTRA_DIST): Add linux/32/ioctls_inc_align32.h and
	* linux/32/ioctls_inc_align64.h.
	* tests/ioctl.c (main): Test for VIDIOC_ENUMINPUT.
	* tests/ioctl.expected: Check VIDIOC_ENUMINPUT decoding.

	Reported-by: Philippe De Muyter <phdm@macqel.be>

2015-05-21  Dmitry V. Levin  <ldv@altlinux.org>

	maint: make linux/kvm.h parseable on arm.
	* maint/ioctls_sym.sh [AARCH64 || ARM]: Add missing definitions for
	structures referenced from linux/kvm.h.

2015-05-21  Philippe De Muyter  <phdm@macqel.be>

	v4l2: add decoding for VIDIOC_S_CROP's arg.
	* v4l2.c (v4l2_ioctl): Add decoding for VIDIOC_S_CROP's arg.

2015-05-19  Ezequiel Garcia  <ezequiel@vanguardiasur.com.ar>

	Add support for Altera's Nios-II softcore architecture.
	This commit adds strace support for Altera's Nios-II.  The architecture
	is supported by Linux since v3.19, and it implements the generic syscall
	ABI.

	* configure.ac: Add nios2 support.
	* cacheflush.c [NIOS2] (sys_cacheflush): New function.
	* linux/nios2/*: New Nios-II specific files.
	* Makefile.am (EXTRA_DIST): Add them.

2015-05-19  Philippe De Muyter  <phdm@macqel.be>

	v4l2: VIDIOC_CROPCAP: add missing braces around arg printout.
	* v4l2.c (v4l2_ioctl): case VIDIOC_CROPCAP: add missing braces around arg
	printout.

2015-05-19  Dmitry V. Levin  <ldv@altlinux.org>

	maint: avoid effects of locale when sorting files.
	* maint/ioctls_gen.sh: Invoke sort with LC_COLLATE=C.
	* maint/ioctls_hex.sh: Likewise.
	* maint/ioctls_sym.sh: Likewise.

	Reported-by: Philippe De Muyter <phdm@macqel.be>

2015-04-18  Philippe De Muyter  <phdm@macqel.be>

	v4l2: add decoding for VIDIOC_CREATE_BUFS's arg.
	* v4l2.c (v4l2_ioctl): Add decoding for VIDIOC_CREATE_BUFS's arg.

2015-04-17  Dmitry V. Levin  <ldv@altlinux.org>

	mips o32: decode indirect syscall.
	Implement decoding of MIPS O32 specific indirect syscall.

	* syscall.c [LINUX_MIPSO32] (decode_mips_subcall, sys_syscall):
	New functions.
	(trace_syscall_entering) [LINUX_MIPSO32]: Use decode_mips_subcall.
	* linux/mips/syscallent-o32.h (4000): Change sys_func to sys_syscall.

	Reported-and-tested-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>

2015-04-14  Dmitry V. Levin  <ldv@altlinux.org>

	debian: add gawk to Build-Depends.
	* debian/control (Build-Depends): Add gawk.
	Patch by Reiner Herrmann <reiner@reiner-h.de>.

	This fixes Debian bug #780992.

2015-04-14  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix bexecve.test for the case of mixed personalities.
	Fix bexecve.test when the executable being run does not match the
	native architecture.

	* tests/bexecve.test: Use "set_ptracer_any" instead of "sh".
	Allow for a personality switch notification in the strace output.

2015-04-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add a test for "resuming interrupted nanosleep"
	* tests/restart_syscall.test: New test.
	* tests/restart_syscall.expected: New file.
	* tests/restart_syscall_unknown.expected: Likewise.
	* tests/Makefile.am (TESTS): Add restart_syscall.test.
	(EXTRA_DIST): Add restart_syscall.expected
	(TEST_LOG_COMPILER): Change to "env".
	(OS, ARCH, AM_TEST_LOG_FLAGS): Define.
	and restart_syscall_unknown.expected.

	tests: strip executable bit from *.expected files.

2015-04-07  Dmitry V. Levin  <ldv@altlinux.org>

	Declare syscall parsers using SYS_FUNC macro.
	Introduce SYS_FUNC macro to declare and define all syscall parsers.

	* Makefile.am (BUILT_SOURCES, CLEANFILES): Add sys_func.h.
	(sys_func.h): New rule.
	* defs.h (SYS_FUNC_NAME, SYS_FUNC): New macros.
	* linux/syscall.h: Include "sys_func.h".
	[NEED_UID16_PARSERS]: Use SYS_FUNC to declare uid16 syscall parsers.
	Remove other declarations.
	* linux/alpha/syscallent.h (160, 161): Add sys_ prefix to osf_statfs
	and osf_fstatfs syscall parsers.
	* *.c: Use SYS_FUNC to define syscall parsers.

2015-04-07  Denys Vlasenko  <dvlasenk@redhat.com>

	Fix confusing "resuming interrupted unknown" message.
	Dmitry reported seeing the following:

	    $ sleep 2 & sleep 1; ./strace -erestart_syscall -p $!
	    [1] 12345
	    Process 12345 attached
	    restart_syscall(<... resuming interrupted unknown ...>) = 0

	Fixing it by replacing "unknown" with "system call".

2015-04-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests: workaround old gawk versions that do not provide @include support
	Some of our tests use GNU awk @include extension, but not all currently
	used versions of GNU awk support it.  Skip these tests if gawk does not
	provide @include support.

	* tests/init.sh (check_gawk): New function.
	(match_awk): Use it.

2015-04-06  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rewrite umovestr2.test without using grep.
	The regular expression generated by umovestr2.c on systems with large
	page size is too big for GNU grep.  Rewrite the test to use diff
	instead of grep.

	* tests/umovestr2.test: Use match_diff instead of match_grep.
	* tests/umovestr2.c (main): Convert output from regexp to plain text.

2015-03-31  Dmitry V. Levin  <ldv@altlinux.org>

	Cleanup process_vm_writev syscall decoding.
	* process_vm.c (sys_process_vm_writev): Do not check for syserror,
	it is not applicable on entering syscall.

	umovestr: read chunks of memory up to pagesize at a time.
	* defs.h (get_pagesize): New prototype.
	* mem.c (get_pagesize) Make global.
	* util.c (PAGMASK): Remove.
	(vm_read_mem): New process_vm_readv proxy function.
	(umoven, umovestr): Use it.
	(umovestr): Read chunks up to pagesize at a time.

2015-03-31  Dmitry V. Levin  <ldv@altlinux.org>

	umovestr: fix short read bug.
	* util.c (umovestr): Check the right address.
	* tests/umovestr.c: New file.
	* tests/umovestr2.c: Likewise.
	* tests/umovestr.expected: Likewise.
	* tests/umovestr.test: New test.
	* tests/umovestr2.test: Likewise.
	* tests/Makefile.am (check_PROGRAMS): Add umovestr and umovestr2.
	(TESTS): Add umovestr.test and umovestr2.test.
	(EXTRA_DIST): Add umovestr.expected.
	* tests/.gitignore: Add umovestr and umovestr2.

	Reported-by: Josef T. Burger <bolo@cs.wisc.edu>

2015-03-31  Dmitry V. Levin  <ldv@altlinux.org>

	When process_vm_readv fails with EPERM, try PTRACE_PEEKDATA.
	process_vm_readv() and ptrace(PTRACE_PEEKDATA) have inconsistent access
	control rules wrt traced processes: process_vm_readv() is more likely to
	fail with EPERM than ptrace(PTRACE_PEEKDATA) when tracing a process that
	has execve'd a privileged executable.

	* util.c (umoven, umovestr): If process_vm_readv returned EPERM,
	fall back to ptrace(PTRACE_PEEKDATA).

	Reported-by: Andrew Guertin <lists@dolphinling.net>

2015-03-30  Dmitry V. Levin  <ldv@altlinux.org>

	Use macros for gcc attributes.
	* defs.h (error_msg, perror_msg, error_msg_and_die, perror_msg_and_die,
	die_out_of_memory, printllval, printnum_int, printnum_long, tprintf):
	Use ATTRIBUTE_* macros for gcc attributes.
	* file.c (struct stat64): Likewise.
	* statfs.c (struct compat_statfs64): Likewise.
	* strace.c (die, exec_or_die, init): Likewise.
	* linux/sparc/arch_sigreturn.c: Likewise.
	* linux/ubi-user.h: Likewise.

2015-03-30  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce macros for gcc attributes.
	Define macros for gcc attributes that are already in use
	or going to be used soon.

	* defs.h (GNUC_PREREQ, ATTRIBUTE_NORETURN, ATTRIBUTE_FORMAT,
	ATTRIBUTE_ALIGNED, ATTRIBUTE_PACKED, ATTRIBUTE_MALLOC,
	ATTRIBUTE_NOINLINE, ATTRIBUTE_ALLOC_SIZE): New macros.

2015-03-28  Felix Janda  <felix.janda@posteo.de>

	Include <linux/ioctl.h> for _IOC_* macros.
	Fix a compilation failure with musl libc.

	* evdev.c: Include <linux/ioctl.h>.
	* ioctl.c: Include <linux/ioctl.h> instead of <asm/ioctl.h>.
	* ioctlsort.c: Likewise.

	Reported-by: Dima Krasner <dima@dimakrasner.com>
	Acked-by: Mike Frysinger <vapier@gentoo.org>

2015-03-28  Felix Janda  <felix.janda@posteo.de>

	Include <sys/stat.h> for S_I* macros.
	Fix a compilation failure with musl libc.

	* mknod.c: Include <sys/stat.h>.
	* printmode.c: Likewise.

	Reported-by: Dima Krasner <dima@dimakrasner.com>
	Acked-by: Mike Frysinger <vapier@gentoo.org>

2015-03-27  Dmitry V. Levin  <ldv@altlinux.org>

	signal.c: move siginfo_t parsers to a separate file.
	* printsiginfo.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (printsiginfo): Change second argument's type from int to bool.
	* signal.c: Stop defining siginfo_t related constants.
	Move inclusion of xlat/sig*_codes.h files to printsiginfo.c
	(printsigsource, printsigval, printsiginfo_at): Move to printsiginfo.c.
	(printsiginfo): Change second argument's type from int to bool,
	split, and move to printsiginfo.c.

	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-26  Dmitry V. Levin  <ldv@altlinux.org>

	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-25  Denys Vlasenko  <dvlasenk@redhat.com>

	Move sparc64 get_scno() code where it belongs.

	sparc: rename personality 2 files to personality 1.
	Run-tested in qemu 32-bit sparc.

2015-03-25  Denys Vlasenko  <dvlasenk@redhat.com>

	sparc: delete personality 1.
	Personality 1 for sparc and sparc64 appears to be an old attempt
	to support stracing Solaris binaries.

	It stalled after the only syscall, solaris_open, was covered:
	all other solaris_foo's are printargs.

	This change deletes personality 1. Now sparc is an one-personality
	arch, and sparc64 is a two-personality one.

	For clarity, pure renaming of personality 2 files to personality 1 for sparc64
	is performed in the next commit - this prevents a state where syscallent1.h
	seems to indergo a lot of changes, where in fact in is deleted, and then
	replaced by syscallent2.h

	Therefore, tree at this commit will not build.

2015-03-24  Denys Vlasenko  <dvlasenk@redhat.com>

	qemu_multiarch_testing/*: make it easier to do debug in sandboxes.

2015-03-24  Denys Vlasenko  <dvlasenk@redhat.com>

	sparc: fix v4.10-25-g8497b62 fallout.
	Before:

	$ sleep 3 & ./strace -p $!
	Process 8703 attached
	syscall: unknown syscall trap 1a800003 00025d58
	syscall_516(0, 0x40080000, 0, 0xfc000f00, 0x28, 0xefc03b18) = 0
	exit_group(0)                           = ?
	+++ exited with 0 +++

	After:

	$ sleep 3 & ./strace -p $!
	Process 8725 attached
	restart_syscall(<... resuming interrupted nanosleep ...>) = 0
	exit_group(0)                           = ?
	+++ exited with 0 +++

2015-03-24  Dmitry V. Levin  <ldv@altlinux.org>

	get_scno: add diagnostics for invalid syscall numbers.
	* syscall.c (get_scno): Print a debug level message
	for !SCNO_IS_VALID syscall numbers.

2015-03-24  Dmitry V. Levin  <ldv@altlinux.org>

	arm: fix v4.10-25-g8497b62 fallout.
	Starting with commit v4.10-25-g8497b62,

	arm$ ./strace true
	pid 1234 stray syscall exit
	Segmentation fault

	Fix this by updating ARM syscall sanity check.
	In particular, get_scno() should not set TCB_INSYSCALL flag because
	other code assumes that s_ent is properly initialized when this flag
	is set.

	* linux/arm/get_scno.c: Check syscall number after fetching.
	Do not apply the check to SCNO_IN_RANGE syscalls.
	Do not set TCB_INSYSCALL flag.
	Extend diagnostics and move it to debug level.

2015-03-24  Dmitry V. Levin  <ldv@altlinux.org>

	mips: fix pipe syscall decoding.
	* linux/mips/arch_getrval2.c: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* defs.h [MIPS] (HAVE_GETRVAL2): Define.

2015-03-23  Dmitry V. Levin  <ldv@altlinux.org>

	sigreturn.c: split arch specific code into separate arch files.
	Split code that use arch-specific registers to separate arch files.

	* sigreturn.c (sys_sigreturn): Move arch-specific code
	to linux/*/arch_sigreturn.c, include "arch_sigreturn.c".
	* linux/arch_sigreturn.c: New file.
	* Makefile.am (EXTRA_DIST): Add linux/arch_sigreturn.c
	and linux/*/arch_sigreturn.c files.

2015-03-23  Dmitry V. Levin  <ldv@altlinux.org>

	syscall.c: split arch specific code into separate arch files.
	Split code that use arch-specific registers to separate arch files.

	* syscall.c: Move definitions of variables containing fetched registers
	to linux/*/arch_regs.c files.
	[HAVE_GETRVAL2] (getrval2): Move arch-specific code
	to linux/*/arch_getrval2.c, include "arch_getrval2.c".
	(print_pc): Move arch-specific code to linux/*/print_pc.c files,
	include "print_pc.c".
	[X86_64] (x86_64_getregs_old): Rename to getregs_old, move to
	linux/x86_64/getregs_old.c, include "getregs_old.c".
	[POWERPC] (powerpc_getregs_old): Rename to getregs_old, move to
	linux/powerpc/getregs_old.c, include "getregs_old.c".
	(get_regs) [X86_64, POWERPC]: Update callers.
	(get_scno): Move arch-specific code to linux/*/get_scno.c,
	include "get_scno.c".
	(get_syscall_args): Move arch-specific code
	to linux/*/get_syscall_args.c, include "get_syscall_args.c".
	(get_error): Move arch-specific code to linux/*/get_error.c,
	include "get_error.c".
	(get_syscall_result): Move arch-specific code
	to linux/*/get_syscall_result.c, include "get_syscall_result.c".
	* Makefile.am (EXTRA_DIST): Add new linux/*/*.c files.

2015-03-23  Dmitry V. Levin  <ldv@altlinux.org>

	syscall.c: prepare for the split.
	Move functions that use arch-specific registers to the end of file.

2015-03-23  Dmitry V. Levin  <ldv@altlinux.org>

	Move get_regs error check from trace_syscall_entering to get_scno.
	Starting with commit v4.10-25-g8497b62, get_scno() can be called outside
	trace_syscall_entering(), so move the get_regs_error check from
	trace_syscall_entering() to get_scno().

	* syscall.c (trace_syscall_entering): Move get_regs_error check ...
	(get_scno): ... here.

2015-03-23  Dmitry V. Levin  <ldv@altlinux.org>

	alpha, ia64, sh, sparc, sparc64: fix pipe and pipe2 syscalls decoding.
	Fix pipe syscall decoding on alpha.
	Fix pipe2 syscall decoding on ia64, sh, sparc, and sparc64.

	* configure.ac (AC_CHECK_FUNCS): Add pipe2.
	* defs.h [ALPHA || IA64 || SH || SPARC || SPARC64] (HAVE_GETRVAL2):
	Define.
	* net.c (do_pipe): Check HAVE_GETRVAL2 instead of architecture macros.
	Do not use getrval2 for pipe2 decoding.
	Print address if umove call fails.
	* syscall.c (getrval2): Check HAVE_GETRVAL2 instead of architecture
	macros.  Implement for [ALPHA].
	* tests/pipe.c: New file.
	* tests/pipe.expected: New file.
	* tests/pipe.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add pipe.
	(TESTS): Add pipe.test.
	(EXTRA_DIST): Add pipe.expected.
	* tests/.gitignore: Add pipe.

2015-03-22  Dmitry V. Levin  <ldv@altlinux.org>

	decode_socket_subcall: fetch all arguments with a single umoven call.
	* syscall.c (decode_socket_subcall): Replace umoven fetch loop
	with a single umoven call.

2015-03-21  Denys Vlasenko  <dvlasenk@redhat.com>

	New test: test/many_looping_threads.c.

	test/.gitignore: add missing test targets.

	Trivial optimization in sys_sigreturn()

	Change last parameter of umoven() from char* to void*
	Saves tons of casts.

	Remove unused struct tcb::inst field.
	It is unused since we dropped support for kernels without PTRACE_SETOPTIONS.

	test/Makefile: add missing test targets.

	Move the comment about termination logic where it belongs.

	startup_tcb() never fails, remove code which checks for failures.

2015-03-21  Denys Vlasenko  <dvlasenk@redhat.com>

	Show the syscall name in "resuming interrupted call" message.
	When signal is received, or if we have attached to a process,
	current syscall (if process is in one) gets restarted.

	Some syscalls are restarted via "restart_syscall()" mechanism.
	On such sycalls, we don't show _which_ syscall gets restarted.

	IOW: users want to see "resuming interrupted nanosleep"
	instead of "resuming interrupted call" when they attach to "sleep 999".

	Kernel does expose this information. The only thing we need is
	to fetch syscall# on attach, and save it.

	This patch does this. It adds tcp->s_prev_ent, which is
	a pointer to struct_sysent of the previous syscall of this tracee.
	It can be NULL.

	sys_restart_syscall() is made to use it when the message is generated.

	To similarly handle restart_syscall() *after signals*, not just
	on attach, on each syscall exit patch saves exited syscall's data
	in the same member (tcp->s_prev_ent).

	Example:

	    $ sleep 3 & strace -p $!
	    Process 8728 attached
	    restart_syscall(<... resuming interrupted nanosleep ...>) = 0
	    _exit(0)                                = ?
	    +++ exited with 0 +++

2015-03-20  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add a test for mmap/mprotect/munmap decoding.
	* tests/mmap.c: New file.
	* tests/mmap64.c: New file.
	* tests/mmap.test: New test.
	* tests/mmap64.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add mmap and mmap64.
	(mmap64_CFLAGS): Define.
	(TESTS): Add mmap.test and mmap64.test.
	* tests/.gitignore: Add mmap and mmap64.

	sparc, sparc64: fix decoding of mmap2.
	* linux/sparc/syscallent.h (mmap2): Decode with sys_mmap_4koff,
	not sys_mmap.
	* linux/sparc64/syscallent2.h (mmap2): Decode with sys_mmap_pgoff,
	not sys_mmap.

2015-03-19  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add a test for SECCOMP_MODE_FILTER decoding.
	* tests/seccomp.c: New file.
	* tests/seccomp.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add seccomp.
	(TESTS): Add seccomp.test.
	* tests/.gitignore: Add seccomp.

2015-03-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: factor out common awk code.
	Factor out awk code used in several tests to match.awk.

	* tests/match.awk: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	* tests/caps.awk: Use it.
	* tests/getdents.awk: Likewise.
	* tests/getrandom.awk: Likewise.
	* tests/select.awk: Likewise.
	* tests/sigaction.awk: Likewise.
	* tests/init.sh (match_awk): Use gawk not awk.  Define AWKPATH.
	* tests/getdents.test: Likewise.

2015-03-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: skip netlink based tests when resources are not available.
	* tests/netlink_inet_diag.c (main): Return 77 if socket, bind,
	or listen syscall fail.
	* tests/netlink_unix_diag.c (main): Likewise.

2015-03-18  Dmitry V. Levin  <ldv@altlinux.org>

	aarch64, arm: decode extra padded compat struct statfs64.
	According to arch/arm/kernel/sys_oabi-compat.c,
	struct statfs64 has extra padding with EABI.

	* statfs.c [AARCH64 || defined ARM] (COMPAT_STATFS64_PADDED_SIZE):
	Define.
	(do_statfs64_fstatfs64): New function, factored out from sys_statfs64.
	[COMPAT_STATFS64_PADDED_SIZE]: Check it in addition to
	sizeof(struct compat_statfs64).
	(sys_statfs64, sys_fstatfs64): Use do_statfs64_fstatfs64.

	Reported-and-tested-by: Elliott Hughes <enh@google.com>

2015-03-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: factor out common shell code to functions.
	Factor out shell code used in several tests to common functions.

	* tests/fanotify_mark.expected: New file.
	* tests/ioctl.expected: New file.
	* tests/net-fd.expected: New file.
	* tests/net.expected: New file.
	* tests/statfs.expected: New file.
	* tests/sun_path.expected: New file.
	* tests/uio.expected: New file.
	* tests/ipc.sh: New file.
	* tests/Makefile.am (EXTRA_DIST): Add them.
	* tests/init.sh (dump_log_and_fail_with, run_prog,
	run_prog_skip_if_failed, run_strace, run_strace_merge,
	match_awk, match_diff, match_grep): New functions.
	* tests/*.test: Use them.

2015-03-18  Elliott Hughes  <enh@google.com>

	Show f_flags field in printstatfs.
	printstatfs64 was right, but printstatfs was missing f_flags.
	Noticed on aarch64.

	* statfs.c (printstatfs) [_STATFS_F_FLAGS]: Print statfs.f_flags.

2015-03-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests/uid*: use fchown* instead of chown*
	Newer architectures have no chown syscall, so use fchown* syscalls
	for testing printuid.

	* tests/uid.test: Use fchown instead of chown.
	* tests/uid.c: Test __NR_fchown instead of __NR_chown.
	(main): Use __NR_fchown instead of __NR_chown.
	* tests/uid32.c: Test __NR_fchown32 instead of __NR_chown32.
	(main): Use __NR_fchown32 instead of __NR_chown32.
	* tests/uid16.c: Test __NR_fchown and __NR_fchown32 instead
	of __NR_chown and __NR_chown32.
	(main): Use __NR_fchown instead of __NR_chown.
	* tests/uid.awk: Update regexp.

2015-03-16  Dmitry V. Levin  <ldv@altlinux.org>

	stat64-v.test: add newfstatat syscall support.
	Newer architectures have no stat syscall, so stat() is implemented there
	using newfstatat syscall.

	* tests/stat.c (STAT_FNAME): Rename to STAT_PREFIX.  Update callers.
	[_FILE_OFFSET_BITS == 64] (STAT_PREFIX): Add newfstatat support.
	(main) [!NR_stat]: Add newfstatat support.

	Reported-by: Andreas Schwab <schwab@suse.de>

2015-03-16  Andreas Schwab  <schwab@suse.de>

	aarch64: properly decode generic syscalls.
	* linux/aarch64/syscallent1.h: Don't override entries 277 to 1023.

	tests: verify that all patterns match.
	* tests/ipc_msg.test: Count matches to verify that all patterns match.
	* tests/ipc_sem.test: Likewise.
	* tests/ipc_shm.test: Likewise.
	* tests/stat32-v.test: Likewise.
	* tests/stat64-v.test: Likewise.

2015-03-16  Dmitry V. Levin  <ldv@altlinux.org>

	Fix stat64 st_[acm]time decoding for personalities with 32-bit time_t.
	STRUCT_STAT.st_[acm]time are declared as unsigned int for some
	personalities, while time_t is signed.

	* printstat.h (DO_PRINTSTAT): If st_[acm]time have the same size as int,
	explicitly cast them to int.
	* tests/stat64-v.test: Test that negative time_t is decoded properly.

	Reported-by: Andreas Schwab <schwab@suse.de>

2015-03-16  Dmitry V. Levin  <ldv@altlinux.org>

	semctl: fix indirect syscall decoding.
	On architectures where the semctl call is implemented by the ipc syscall
	the 4th argument is passed by reference.

	* ipc.c (sys_semctl): Handle the indirect ipc subcall case.
	* tests/ipc_sem.c (main): Optionally match indirection
	in the 4th argument of semctl calls.

	Reported-by: Andreas Schwab <schwab@suse.de>

2015-03-16  Andreas Schwab  <schwab@suse.de>

	tests/ipc_*: match IPC_64 flag.
	* tests/ipc_msg.c (main): Optionally match "IPC_64|" in the third
	argument of the ipc call.
	* tests/ipc_sem.c (main): Likewise.
	* tests/ipc_shm.c (main): Likewise.

2015-03-16  Andreas Schwab  <schwab@suse.de>

	Fix crash in ipc_sem test.
	Properly use union semun as argument of semctl.

	* tests/ipc_sem.c (main): Properly use union semun as argument of
	semctl.  Don't handle EFAULT specially.
	* tests/ipc_sem.test: Revert last change.

2015-03-16  Andreas Schwab  <schwab@suse.de>

	m68k: fix sigreturn decoding.
	* sigreturn.c (sys_sigreturn) [M68K]: Fetch the words of the
	signal mask from the proper place.

	aarch64: fix ioctl decoding.
	* linux/aarch64/ioctls_inc0.h: Rename from ioctls_inc1.h.
	* linux/aarch64/ioctls_inc1.h: Rename from ioctls_inc0.h.
	* linux/aarch64/ioctls_arch0.h: Rename from ioctls_arch1.h.
	* linux/aarch64/ioctls_arch1.h: Rename from ioctls_arch0.h.

2015-03-12  Andreas Schwab  <schwab@suse.de>

	tests/select.test: handle architectures using pselect6 syscall.
	* tests/select.awk (BEGIN): Update regexps to match both select
	and pselect6 syscalls.
	* tests/select.test: Probe for both select and pselect6 syscall.

	Distribute linux/aarch64/arch_regs.h.
	* Makefile.am (EXTRA_DIST): Add linux/aarch64/arch_regs.h.

	Fix decoding of mmap2 for arm.
	* syscallent.h (mmap2): Decode with sys_mmap_4koff, not
	sys_mmap_pgoff.

2015-03-12  Andreas Schwab  <schwab@suse.de>

	m68k: define HAVE_SA_RESTORER.
	On m68k the kernel sigaction structure has the sa_restorer member for
	historical reasons.

	* signal.c (HAVE_SA_RESTORER): Define for M68K.

2015-03-11  Dmitry V. Levin  <ldv@altlinux.org>

	aarch64: fix rt_sigreturn decoding.
	* sigreturn.c (sys_sigreturn) [AARCH64]: Fix personality check.

2015-03-09  Dmitry V. Levin  <ldv@altlinux.org>

	maint: post-release administrivia.
	* NEWS: Add header line for next release.

2015-03-06  Dmitry V. Levin  <ldv@altlinux.org>

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

	Move sigreturn/rt_sigreturn parser to a separate file.
	* sigreturn.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (sprintsigmask_n): New prototype.
	(tprintsigmask_addr): New macro.
	* signal.c (sprintsigmask_n): Make global.
	(tprintsigmask_addr): Remove.
	(sys_sigreturn): Move to sigreturn.c.

2015-03-05  Dmitry V. Levin  <ldv@altlinux.org>

	ia64: use PTRACE_GETREGS to fetch registers.
	* linux/ia64/arch_regs.h: Stop including <asm/rse.h>.
	(ia64_frame_ptr): New declaration.
	* signal.c (sys_sigreturn) [IA64]: Use ia64_frame_ptr.
	* syscall.c [IA64]: Include <asm/rse.h>.
	[IA64] (ia64_regs, ia64_frame_ptr): New variable.
	[IA64] (ARCH_REGS_FOR_GETREGS): New macro.
	[IA64] (ia64_ia32mode): Convert to macro.
	[IA64] (ia64_r8, ia64_r10): Remove.
	(getrval2, print_pc, get_scno, get_syscall_args, get_error) [IA64]:
	Use ia64_regs.
	(get_syscall_result) [IA64]: Remove.

	s390, s390x: use PTRACE_GETREGSET to fetch registers.
	* linux/s390/arch_regs.h: New file.
	* linux/s390x/arch_regs.h: New file.
	* Makefile.am (EXTRA_DIST): Add them.
	* signal.c (sys_sigreturn) [S390 || S390X]: Use s390_frame_ptr.
	* syscall.c [S390 || S390X] (s390_regset, s390_frame_ptr): New variable.
	[S390 || S390X] (ARCH_REGS_FOR_GETREGSET): New macro.
	(print_pc) [S390 || S390X]: Use s390_regset.
	(get_scno) [S390 || S390X]: Likewise.
	(get_syscall_args) [S390 || S390X]: Likewise.
	(get_error) [S390 || S390X]: Likewise.
	(get_syscall_result) [S390 || S390X]: Remove.

	qemu_multiarch_testing: update.
	* qemu_multiarch_testing/README: Update statistics.

2015-03-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify unix-yy.test.
	Implement additional synchronization between parent and child processes
	to guarantee that the child starts closing connected socket only after
	exiting of the parent's accept() syscall.
	This guarantee seems to be necessary to reliably receive UNIX_DIAG_PEER
	messages from NETLINK_SOCK_DIAG interface.

	* tests/net-accept-connect.c: Implement additional synchronization
	between parent and child processes.
	* tests/unix-yy-connect.awk: Update.

2015-03-05  Dmitry V. Levin  <ldv@altlinux.org>

	Use SIGRTMIN from kernel headers.
	* configure.ac (ASM_SIGRTMIN): Define to SIGRTMIN from <asm/signal.h>.
	* signal.c: Use ASM_SIGRTMIN instead of constants provided by libc.
	* tests/sigreturn.c: Use ASM_SIGRTMIN instead of hardcoded value.
	Use lower RT_* numbers to support pre-3.18 hppa kernels.
	* tests/sigreturn.test: Update regexp.

2015-03-05  Dmitry V. Levin  <ldv@altlinux.org>

	ppc64: fix compilation warning.
	Fix compilation warning introduced by commit
	577be2593d4895ef941e1c4e5e1608f7dd13610d

	* signal.c (sys_sigreturn) [POWERPC64]: Fix initialization of signal
	mask on 32bit personality.

2015-03-05  Dmitry V. Levin  <ldv@altlinux.org>

	aarch64: fix compilation warnings.
	Fix compilation warnings introduced by commit
	5b9b7e1d347eb4556084cdccad75e8247c535ed5:

	signal.c:702:45: warning: signed and unsigned type in conditional expression [-Wsign-compare]
	syscall.c:746:34: warning: initialization from incompatible pointer type [enabled by default]

	* syscall.c [AARCH64] (aarch64_sp_ptr): Add explicit cast.
	[AARCH64] (arm_sp_ptr): Change pointer type to unsigned.
	* linux/aarch64/arch_regs.h (arm_sp_ptr): Update.

	Reported-by: Mike Frysinger <vapier@gentoo.org>

2015-03-05  Dmitry V. Levin  <ldv@altlinux.org>

	i386: simplify sigreturn decoding.
	* signal.c (sys_sigreturn) [X86_64 || X32 || I386]: Do not define
	i386_sigcontext_struct and i386_fpstate structures.

2015-03-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add a test for sigreturn/rt_sigreturn decoding.
	Convert test/sigreturn.c into a regular test.

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

2015-03-04  Dmitry V. Levin  <ldv@altlinux.org>

	sigreturn: print signal mask as a syscall argument.
	Although sigreturn takes signal mask via frame pointer,
	it's more convenient to display signal mask as a syscall argument
	rather than an outstanding object of unknown nature:

	Before this change:
	    sigreturn() (mask [USR2 CHLD RT_2 RT_3 RT_4 RT_31 RT_32]) = 0

	After this change:
	    sigreturn({mask=[USR2 CHLD RT_2 RT_3 RT_4 RT_31 RT_32]}) = 0

	* signal.c (sys_sigreturn): Display signal mask as a syscall argument.

2015-03-04  Dmitry V. Levin  <ldv@altlinux.org>

	aarch64: implement rt_sigreturn decoding.
	* linux/64/syscallent.h (139): Use sys_sigreturn for rt_sigreturn
	decoding.
	* syscall.c [ARM] (arm_regs): Make static.
	[ARM] (arm_sp_ptr): New variable.
	[AARCH64] (aarch64_sp_ptr, arm_sp_ptr): New variables.
	* linux/aarch64/arch_regs.h: New file.
	* linux/arm/arch_regs.h (arm_regs): Remove.
	(arm_sp_ptr): New declaration.
	* signal.c (sys_sigreturn) [ARM]: Use arm_sp_ptr.
	[AARCH64]: Print signal mask.

	arm: simplify sigreturn decoding.
	* signal.c (sys_sigreturn) [ARM]: Do not define sigcontext and ucontext
	structures, fetch signal mask only, use print_sigset_addr_len.

	s390: fix sigreturn decoding.
	* signal.c (sys_sigreturn) [S390]: Fix signal mask decoding.

	mips o32: fix sigreturn decoding.
	* signal.c (sys_sigreturn) [LINUX_MIPSO32]: Fix the address of signal mask.
	[MIPS] Use print_sigset_addr_len to print signal mask.

	x86_64, x32: implement rt_sigreturn decoding.
	* syscall.c [X86_64 || X32] (x86_64_rsp_ptr): New variable.
	* linux/x86_64/arch_regs.h (x86_64_rsp_ptr): New declaration.
	* linux/x86_64/syscallent.h (15): Use sys_sigreturn for rt_sigreturn
	decoding.
	* linux/x32/syscallent.h (513): Likewise.
	* signal.c (sys_sigreturn) [X86_64 || X32]: Print signal mask
	for non-i386 personalities.

	sparc, sparc64: fix sigreturn decoding.
	* linux/sparc/arch_regs.h (U_REG_FP): New macro.
	* signal.c (sys_sigreturn) [SPARC || SPARC64]: Fix decoding
	of upper 32 bits of the sigmask.

	ppc, ppc64: fix sigreturn decoding.
	* signal.c (sys_sigreturn) [POWERPC]: Fix decoding of upper 32 bits
	of the sigmask.

	sigreturn: issue a less innocuous warning.
	* signal.c (sys_sigreturn): Issue a less innocuous warning on
	architectures for which signal mask decoding is not implemented yet.

2015-03-04  Dmitry V. Levin  <ldv@altlinux.org>

	bootstrap: do not link Makefile* files.
	* bootstrap: Do not symlink any Makefile* files, not just Makefile.am
	and Makefile.in.

	Reported-by: Christopher Covington <cov@codeaurora.org>

2015-03-04  Dmitry V. Levin  <ldv@altlinux.org>

	ia64: fix sigreturn decoding.
	* signal.c (sys_sigreturn) [IA64]: Fix the address of signal mask.
	Use print_sigset_addr_len to print signal mask.

2015-03-04  Dmitry V. Levin  <ldv@altlinux.org>

	ia64: use generic signalent.
	This complements commit v4.9-321-gfcf7f8d.

	* linux/ia64/signalent.h: Remove.
	* Makefile.am (EXTRA_DIST): Remove it.

2015-03-04  Giedrius Statkevičius  <giedrius.statkevicius@gmail.com>

	Document that -k is available only with libunwind.
	Without this users might get confused why `man strace` describes
	an option that doesn't work.

	* strace.1: Note that -k is available only if strace is built
	with libunwind.

2015-03-03  Dmitry V. Levin  <ldv@altlinux.org>

	debian: update control file.
	* debian/control (strace, strace-udeb): Add mips64 and mips64el
	to architecture list.
	Patch by James Cowgill <james410@cowgill.org.uk>

	This fixes Debian bug #773375.

2015-03-03  Dmitry V. Levin  <ldv@altlinux.org>

	debian: sync with 4.9-2 package.
	* debian/changelog: Sync with 4.9-2.
	* debian/control: Likewise.

2015-03-03  Dmitry V. Levin  <ldv@altlinux.org>

	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  Mike Frysinger  <vapier@gentoo.org>

	Clarify bootstrap-vs-autoreconf usage.
	* README-hacking: Tell people to run ./bootstrap.

2015-03-03  Dmitry V. Levin  <ldv@altlinux.org>

	mips n32: fix preadv/pwritev offset decoding.
	In mips n32 abi, like in most of 32-bit architectures, offset
	is passed to preadv/pwritev syscalls using two syscall arguments.

	* io.c (print_llu_from_low_high_val) [LINUX_MIPSN32]: Remove.

2015-03-03  Mike Frysinger  <vapier@gentoo.org>

	tests: skip ipc_sem.test on broken kernels.
	Rather than trigger an ERROR which fails `make check`, go with SKIP
	instead.  We don't want the testsuite failing due to kernel bugs.

	* tests/ipc_sem.c (main): Change 99 to 77.

2015-03-03  Mike Frysinger  <vapier@gentoo.org>

	tests: skip pc.test on s390.
	The s390 hardware can't support an exact si_addr, and the current kernels
	don't handle text addresses correctly at all.  Until that improves, skip
	the test on s390.

	* tests/pc.c (main): Return 77 on s390 systems.

2015-03-03  Mike Frysinger  <vapier@gentoo.org>

	tests: note the kernel configs for -yy options.
	* tests/net-yy.test: Note CONFIG_INET_TCP_DIAG.
	* tests/unix-yy.test: Note CONFIG_UNIX_DIAG.

2015-03-02  Dmitry V. Levin  <ldv@altlinux.org>

	alpha: fix -yy decoding.
	* socketutils.c (receive_responses): Align buffer on a sizeof(long) boundary.

	Reported-and-tested-by: Mike Frysinger <vapier@gentoo.org>

2015-03-02  Dmitry V. Levin  <ldv@altlinux.org>

	aarch64, x32: fix decoding of compat personality statfs64/fstatfs64.
	* statfs.c (struct compat_statfs64) [AARCH64 || X32]: Apply the same
	attributes as on X86_64.

	mips: fix compilation warning.
	* syscall.c (get_scno) [MIPS]: Fix harmless compilation warning
	about comparison between signed and unsigned integer expressions.

	x32: fix compilation warnings.
	* sysinfo.c (sys_sysinfo): Use ll length format modifier
	instead of l and cast kernel ulong types to unsigned long long.

	aarch64: add -i option support.
	* syscall.c (print_pc): Add aarch64 support.

2015-03-02  Dmitry V. Levin  <ldv@altlinux.org>

	ioctl: use x32 specific ioctl entries on x32 personality.
	As ioctls_inc.h generated natively on x32 differs both from 32/ioctls_inc.h
	(by 45 entries) and from linux/64/ioctls_inc.h (by 322 entries), use x32
	specific ioctl entries on x32 personality.

	* linux/x32/ioctls_inc0.h: Generate from linux v3.19 using ioctls_gen.sh.
	* linux/x86_64/ioctlent2.h: Remove.
	* linux/x86_64/ioctls_arch2.h: New file.
	* linux/x86_64/ioctls_inc2.h: New file.
	* Makefile.am (EXTRA_DIST): Remove linux/x86_64/ioctlent2.h, add
	linux/x86_64/ioctls_arch2.h and linux/x86_64/ioctls_inc2.h.

2015-03-02  Dmitry V. Levin  <ldv@altlinux.org>

	tests/uid16: skip if real uid is larger than 16bit.
	* tests/uid16.c (main): Skip if the uid returned by getuid matches
	/proc/sys/kernel/overflowuid.

2015-03-02  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix uid tests on big endian architectures.
	* tests/uid.c (main): Ignore uids returned by getresuid to avoid
	16bit vs 32bit issues on big endian architectures.
	Change real UID instead of effective UID in setresuid test.
	* tests/uid16.c (main): Likewise.
	* tests/uid32.c (main): Change real UID instead of effective UID
	in setresuid test to match uid.c
	* tests/uid.awk: Update setresuid regexp.

	Reported-by: Mike Frysinger <vapier@gentoo.org>

2015-03-01  Mike Frysinger  <vapier@gentoo.org>

	tests/getdents: handle older getdents calls.
	If the tools we use call older getdents syscalls where d_type isn't
	passed back, or the arch is old (like Alpha) and can't pass back in
	either version, make sure we don't fail.

	* tests/getdents.awk (d_type_dir, d_type_reg): Accept DT_UNKNOWN.

2015-02-28  Dmitry V. Levin  <ldv@altlinux.org>

	Fix multiple personalities support in decoding syscall return values.
	* syscall.c (trace_syscall_exiting): When current personality is 32bit,
	print 32bit return code.

	Update generic 64-bit ioctlent from linux v3.19.
	* linux/64/ioctls_inc.h: Update from linux v3.19 using ioctls_gen.sh.

2015-02-28  Dmitry V. Levin  <ldv@altlinux.org>

	sparc, sparc64: fix rt_sigaction decoding.
	Fix regression introduced by commit v4.9-9-gc3a5c01.

	* signal.c (HAVE_SA_RESTORER): New macro.
	[HPPA || IA64]: Do not undefine SA_RESTORER.
	(old_sigaction, old_sigaction32, new_sigaction): Use HAVE_SA_RESTORER
	instead of SA_RESTORER to check whether to define sa_restorer.
	(decode_old_sigaction, decode_new_sigaction): Use HAVE_SA_RESTORER in
	addition to SA_RESTORER to check whether to use sa_restorer.

2015-02-28  Dmitry V. Levin  <ldv@altlinux.org>

	Fix stack buffer overflow when specified command is too long.
	* strace.c (startup_child): Check that the length of the command strace
	is going to execute does not exceed PATH_MAX limit.

	Reported-by: Cheolung Lee <chpie@grayhash.com>

2015-02-28  Dmitry V. Levin  <ldv@altlinux.org>

	build: include ptrace.h after regs.h.
	Restore the order of including <sys/reg.h> and <linux/ptrace.h>
	headers that was inadvertently changed by commit v4.9-280-g5503dd2.

	This should fix build on platforms like m68k where some constants
	are defined simultaneously as enums by <sys/reg.h> and as macros
	by <asm/ptrace.h>.

	* process.c: Include "ptrace.h" after "regs.h".
	* signal.c: Likewise.
	* syscall.c: Likewise.
	* util.c: Likewise.

2015-02-28  Dmitry V. Levin  <ldv@altlinux.org>

	x32: fix decoding of timeval, timespec, and timex structures.
	As time_t is a 64-bit type in x32 personality, it is not correct to
	treat it as a long int type.

	* time.c (current_time_t_is_compat): New macro.
	(sprinttv, sprint_timespec, printitv_bitness, tprint_timex): Use it.
	(tprint_timeval, do_sprinttv, sprint_timespec): Use j and uintmax_t
	when printing tv_sec/tv_usec.
	(tprint_timex): Use j and intmax_t/uintmax_t when printing struct timex
	members of type kernel_long_t.

2015-02-28  Mike Frysinger  <vapier@gentoo.org>

	tests/ipc_sem: detect broken kernels.
	When running 32bit ipc tests on ppc/sparc with a 64bit kernel, the ipc
	logic wrongly returns errors.  Detect that and throw an error.

	* tests/ipc_sem.c: Return 99 when errno is EFAULT.
	* tests/ipc_sem.test: Save output to $OUT and show it when failing.
	Handle exit status 99 to throw an ERROR.

2015-02-27  Dmitry V. Levin  <ldv@altlinux.org>

	build: do not link strace with -ldl.
	* configure.ac: Fix dladdr check.

2015-02-27  Mike Frysinger  <vapier@gentoo.org>

	Handle broken PTRACE_EVENT_STOP values.
	For a few linux releases (3.1 through 3.3), this define in the exported
	headers were broken.  Redefine if that's the case.

	* ptrace.h [PTRACE_EVENT_STOP]: Redefine if PTRACE_EVENT_STOP is 7.

2015-02-27  Mike Frysinger  <vapier@gentoo.org>

	bootstrap: always set up test dirs.
	When files get updated, the bootstrap script should make sure the
	parallel dirs are kept in sync.

	* bootstrap: Always generate the test$m.  Clean up symlinks first.
	Don't link in Makefile.in files.

2015-02-27  Mike Frysinger  <vapier@gentoo.org>

	Fix cross-compiling of ioctlsort.
	Use the AX_PROG_CC_FOR_BUILD helper to set up build settings when cross
	compiling.  This way ioctlsort uses the build tools all the time.

	* configure.ac: Call AX_PROG_CC_FOR_BUILD.
	* Makefile.am (ioctlsort_CC): Set to CC_FOR_BUILD.
	(ioctlsort_CPPFLAGS): Change CPPFLAGS to CPPFLAGS_FOR_BUILD.
	(ioctlsort_CFLAGS): Change CFLAGS to CFLAGS_FOR_BUILD.
	(ioctlsort_LDFLAGS): Change LDFLAGS to LDFLAGS_FOR_BUILD.
	(ioctlsort_LD): Delete.
	(ioctlsort%): Change to ioctlsort%$(BUILD_EXEEXT).  Use ioctlsort_CFLAGS.
	* m4/ax_prog_cc_for_build.m4: Import from the autoconf-archive package.

2015-02-27  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify pc.test.
	* configure.ac: Check for dladdr in -ldl.
	* tests/Makefile.am (pc_LDADD): Adde $(dl_LIBS).
	* tests/pc.c: Include "config.h" and <dlfcn.h>.
	(main): Use dladdr to find the address to unmap.

2015-02-27  Dmitry V. Levin  <ldv@altlinux.org>

	tests: drop support for alternative names of select syscall.
	This mostly reverts commit 4a00fc4867bde7a4c333f238851e5cb03f02c824.

	* tests/select.awk: Drop _newselect support.
	* tests/select.test: Skip if select syscall is not supported.

2015-02-27  Dmitry V. Levin  <ldv@altlinux.org>

	Rename _newselect to select.
	As an exception to the general rules that syscall names should match
	__NR_* constants defined in kernel headers, show select as "select"
	and old select as "oldselect".

	* linux/arm/syscallent.h (82): Change name to oldselect.
	* linux/hppa/syscallent.h (142): Change name to select.
	* linux/mips/syscallent-n32.h (6022): Likewise.
	* linux/mips/syscallent-n64.h (5022): Likewise.
	* linux/mips/syscallent-o32.h (4142): Likewise.
	* linux/sparc/syscallent.h (230): Likewise.

2015-02-27  Dmitry V. Levin  <ldv@altlinux.org>

	sparc: sync syscall entries with kernel headers.
	* linux/sparc/syscallent.h: Fix syscall entries for vmsplice,
	inotify_init, inotify_add_watch, inotify_rm_watch, inotify_rm_watch,
	ioprio_set, ioprio_get, splice, sync_file_range, sched_getaffinity, and
	sched_setaffinity.
	(67, 68, 202, 230): Change syscall names to match __NR_* constants
	defined in arch/sparc/include/uapi/asm/unistd.h.

2015-02-26  Dmitry V. Levin  <ldv@altlinux.org>

	s390, s390x: sync syscall entry names with kernel headers.
	* linux/s390/syscallent.h (1, 180, 181): Change syscall names to match
	__NR_* constants defined in arch/s390/include/uapi/asm/unistd.h.
	* linux/s390x/syscallent.h: Likewise.

2015-02-26  Mike Frysinger  <vapier@gentoo.org>

	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  Dmitry V. Levin  <ldv@altlinux.org>

	arm: sync syscall entry names with kernel.
	* linux/arm/syscallent.h (82, 90, 180, 181, 327):
	Change syscall names to match __NR_* constants defined
	in arch/arm/include/uapi/asm/unistd.h.

	arm: fix get_mempolicy, set_mempolicy, and timerfd_create syscall entries
	* linux/arm/syscallent.h (320, 321, 350): Fix names and handlers.

	hppa: sync syscall entry names with kernel.
	* linux/hppa/syscallent.h (18, 28, 59, 84, 108, 109, 280):
	Change syscall names to match __NR_* constants defined in
	arch/parisc/include/uapi/asm/unistd.h.

	subcall.h: add sendmmsg entry.
	* linux/subcall.h: Add sys_sendmmsg entry.
	(SYS_socket_nsubcalls): Update.

	arm: simplify ARM_FIRST_SHUFFLED_SYSCALL definition.
	* linux/arm/syscallent.h (ARM_FIRST_SHUFFLED_SYSCALL): Use SYS_ipc_subcall.

	ia64: parametrize i386 syscallent size check.
	* linux/ia64/syscallent.h: Use (SYS_ipc_subcall + SYS_ipc_nsubcalls)
	instead of numeric constant.

	Cleanup linux/subcall.h.
	* linux/subcall.h: Use SYS_ipc_subcall.

	alpha: fix statfs decoding.
	* statfs.c (printstatfs) [ALPHA]: Remove faulty code.

	x32: fix build regression.
	* linux/x32/arch_regs.h: New file.
	* Makefile.am (EXTRA_DIST): Add it.

2015-02-26  Mike Frysinger  <vapier@gentoo.org>

	hppa: fix fanotify_mark decoding.
	The parisc kernel has some legacy baggage here and decodes the 64bit
	field in the reverse order.  Handle it in strace too.

	* fanotify.c [HPPA] (sys_fanotify_mark): Reverse the mask bits.

2015-02-26  Mike Frysinger  <vapier@gentoo.org>

	ia64: fix decoding of getresuid/getresgid/setresgid.
	Looks like the similarity of these names caused confusion when generating
	the syscall table.  getresgid was wired to the wrong output while the other
	two were wired up to printargs instead of the real printer.

	* linux/ia64/syscallent.h: Connect getresuid to sys_getresuid, getresgid to
	sys_getresgid, and setresgid to sys_setresgid.

2015-02-26  Mike Frysinger  <vapier@gentoo.org>

	ia64: fix up builds after 16bit uid support.
	The ia64 port pulls in the i386 syscall table so it can decode
	32bit apps, so we need to enable the 16bit uid parsers for it.

	* defs.h (NEED_UID16_PARSERS): Define to 1 for IA64.
	* linux/ia64/syscallent.h: Undefine sys_stime to avoid redefine warnings.

2015-02-26  Mike Frysinger  <vapier@gentoo.org>

	v4l2: use uintmax_t for times.
	There is no guarantee that the backing value for the various time fields
	are ints or longs which makes printfs annoying.  Lets cast them to the
	uintmax_t type so we can use the j flag and not worry about truncation.

	* v4l2.c (v4l2_ioctl): Use j and uintmax_t when printing tv_sec/tv_usec.

2015-02-26  Mike Frysinger  <vapier@gentoo.org>

	ignore core/compile files.
	Newer autotools includes a compile helper script.

	* .gitignore: Add /compile and core.

2015-02-24  Dmitry V. Levin  <ldv@altlinux.org>

	NEWS: Prepare for 4.10 release.

2015-02-24  Dmitry V. Levin  <ldv@altlinux.org>

	Remove support for systems without PTRACE_SETOPTIONS.
	Assume that the kernel is v2.5.46 or newer, i.e. PTRACE_SETOPTIONS
	and PTRACE_O_TRACESYSGOOD|PTRACE_O_TRACEEXEC|PTRACE_O_TRACECLONE
	are universally available.

	This change removes all code that implemented post-execve SIGTRAP
	handling and fork/vfork/clone->CLONE_PTRACE substitution.

	* defs.h (TCB_BPTSET, TCB_WAITEXECVE): Remove macros.
	(need_fork_exec_workarounds, setbpt, clearbpt): Remove declarations.
	* strace.c (need_fork_exec_workarounds,
	test_ptrace_setoptions_followfork, test_ptrace_setoptions_for_all):
	Remove.
	(syscall_trap_sig): Set to (SIGTRAP | 0x80).
	(ptrace_setoptions): Set to (PTRACE_O_TRACESYSGOOD | PTRACE_O_TRACEEXEC).
	(detach): Do not test for TCB_BPTSET.
	(init): Do not call test_ptrace_setoptions_followfork and
	test_ptrace_setoptions_for_all.  Do not test for TCB_BPTSET.
	* syscall.c (syscall_fixup_on_sysenter, internal_fork, internal_exec,
	syscall_fixup_for_fork_exec, syscall_fixup_on_sysexit): Remove.
	(trace_syscall_entering): Do not test for TCB_WAITEXECVE.  Do not call
	syscall_fixup_on_sysenter and syscall_fixup_for_fork_exec.
	(trace_syscall_exiting): Do not call syscall_fixup_on_sysexit and
	syscall_fixup_for_fork_exec.
	[IA64] (ia64_ia32mode): Make static.
	* linux/ia64/arch_regs.h (ia64_ia32mode): Remove declaration.
	* util.c: Do not include "syscall.h".
	(arg_setup, get_arg0, get_arg1, set_arg0, set_arg1, restore_arg0,
	restore_arg1, arg_finish_change, change_syscall, setbpt, clearbpt):
	Remove.
	* tests/ptrace_setoptions.test: Remove.
	* tests/Makefile.am (TESTS): Remove it.

2015-02-24  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify pc.test.
	* tests/pc.c (main): Unmap larger memory region.
	Dump process map for debug purposes.
	* tests/pc.test: Update regexps to take CLD_DUMPED child process
	into account.

2015-02-23  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix "make dist" regression.
	* tests/Makefile.am (EXTRA_DIST): Add getrandom.awk.

	tests: workaround broken awk.
	* tests/getdents.out: New file.
	* tests/Makefile.am (EXTRA_DIST): Add it.
	* tests/getdents.test: Check whether awk is capable of matching long
	regular expressions.

2015-02-23  Dmitry V. Levin  <ldv@altlinux.org>

	Fix compilation warnings about incompatible print formats.
	On some platforms printing of __s64 types with "%lld" format,
	or __u64 types with "%llu" or "%llx" formats causes a warning
	that __s64/__u64 type is not compatible with long long format.
	From my PoV, this is nonsense, but the workaround costs nothing.

	* scsi.c (print_sg_io_v4_req, print_sg_io_v4_res): Cast __u64 types
	to (unsigned long long).
	* v4l2.c (v4l2_ioctl): Likewise.  Cast __s64 type to (long long).

2015-02-23  Dmitry V. Levin  <ldv@altlinux.org>

	powerpc64: fix build regression.
	* linux/powerpc64/arch_regs.h: New file.
	* Makefile.am (EXTRA_DIST): Add it.

	signalent: update from linux v3.19.
	* linux/alpha/signalent.h: Update from linux v3.19 signalent.sh.
	* linux/hppa/signalent.h: Likewise.
	* linux/mips/signalent.h: Likewise.
	* linux/sparc/signalent.h: Likewise.

	Cleanup auxiliary signalent files.
	* linux/aarch64/signalent1.h: Include "signalent.h".
	* linux/powerpc64/signalent1.h: Likewise.
	* linux/sparc64/signalent2.h: Likewise.
	* linux/tile/signalent1.h: Likewise.
	* linux/x32/signalent1.h: Likewise.
	* linux/x86_64/signalent1.h: Likewise.
	* linux/x86_64/signalent2.h: Likewise.
	* linux/sparc64/signalent.h: Include "sparc/signalent.h".
	* linux/sparc64/signalent1.h: Include "sparc/signalent1.h".
	* linux/x32/signalent.h: Remove.
	* Makefile.am (EXTRA_DIST): Remove linux/x32/signalent.h.

2015-02-23  Dmitry V. Levin  <ldv@altlinux.org>

	x86_64, x32: fix sys_sigreturn.
	On x86_64/x32, sys_sigreturn is defined only for i386 personality.

	* signal.c (sys_sigreturn): Define for X32.
	(sys_sigreturn) [X86_64 || X32]: Implement for i386 personality only.

2015-02-23  Dmitry V. Levin  <ldv@altlinux.org>

	sparc, x32: fix build regression.
	* syscall.c (print_pc): Use current_wordsize iff it is defined.

	Change errnoent.h files to use designated initializers.
	* signal.c (printsiginfo): Allow elements of errnoent array to be zero.
	* syscall.c (trace_syscall_exiting): Likewise.
	* errnoent.sh: Output designated initializers.
	* linux/errnoent.h: Regenerated.
	* linux/alpha/errnoent.h: Regenerated.
	* linux/hppa/errnoent.h: Regenerated.
	* linux/mips/errnoent.h: Regenerated.
	* linux/sparc/errnoent.h: Regenerated.
	* linux/sparc/errnoent1.h: Regenerated.
	* linux/powerpc/errnoent.h: New file.
	* linux/powerpc64/errnoent.h: Include "powerpc/errnoent.h".
	* Makefile.am (EXTRA_DIST): Add linux/powerpc/errnoent.h
	and linux/powerpc64/errnoent.h.

	errnoent: update from linux v3.19.
	* linux/errnoent.h: Update from linux v3.19 using errnoent.sh.
	* linux/alpha/errnoent.h: Likewise.
	* linux/hppa/errnoent.h: Likewise.
	* linux/mips/errnoent.h: Likewise.
	* linux/sparc/errnoent.h: Likewise.

	Cleanup auxiliary errnoent files.
	* linux/aarch64/errnoent1.h: Include "errnoent.h".
	* linux/powerpc64/errnoent1.h: Likewise.
	* linux/sparc64/errnoent2.h: Likewise.
	* linux/tile/errnoent1.h: Likewise.
	* linux/x32/errnoent1.h: Likewise.
	* linux/x86_64/errnoent1.h: Likewise.
	* linux/x86_64/errnoent2.h: Likewise.
	* linux/sparc64/errnoent.h: Include "sparc/errnoent.h".
	* linux/sparc64/errnoent1.h: Include "sparc/errnoent1.h".
	* linux/x32/errnoent.h: Remove.
	* Makefile.am (EXTRA_DIST): Remove linux/x32/errnoent.h.

2015-02-22  Dmitry V. Levin  <ldv@altlinux.org>

	evdev: update constants from linux v3.19.
	* xlat/evdev_keycode.in: Update from linux v3.19.
	* xlat/evdev_prop.in: Likewise.

	evdev: decode keycode value in EVIOC[GS]KEYCODE_V2 commands.
	* evdev.c (keycode_V2_ioctl): Use evdev_keycode to print
	input_keymap_entry.keycode.

	evdev: fix build with old kernel headers.
	* configure.ac: Check whether struct input_absinfo.resolution is defined
	in <linux/input.h>.
	* evdev.c (SYN_MAX): Add fallback definition.
	(abs_ioctl): Wrap use of struct input_absinfo.resolution in #ifdef check.
	(keycode_V2_ioctl, mtslots_ioctl, repeat_ioctl): Wrap in #ifdef checks.
	(evdev_read_ioctl): Wrap in #ifdef checks the code that uses EV_SW,
	EVIOCGREP, EVIOCGKEYCODE_V2, EVIOCGMTSLOTS, EVIOCGPROP, and EVIOCGSW.
	(evdev_write_ioctl): Wrap in #ifdef checks the code that uses EVIOCSREP,
	EVIOCSKEYCODE_V2, EVIOCSCLOCKID, and EVIOCREVOKE.

2015-02-22  Etienne Gemsa  <etienne.gemsa@lse.epita.fr>

	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.

2015-02-22  Dmitry V. Levin  <ldv@altlinux.org>

	Fix build with old kernel headers.
	* strace.c (print_debug_info, maybe_allocate_tcb, print_signalled,
	print_exited): Remove "const" qualifier from status variable to
	workaround some old implementations of WIFSIGNALED/WIFSTOPPED/WIFEXITED
	macros.
	* v4l2.c: Include <linux/types.h>.
	(v4l2_ioctl): Check that V4L2_CTRL_FLAG_NEXT_CTRL and VIDIOC_S_EXT_CTRLS
	macros are defined.
	* tests/Makefile.am (AM_CPPFLAGS): Define.

	Fix "make dist" regression.
	* Makefile.am (EXTRA_DIST): Remove README-linux.

2015-02-20  Elliott Hughes  <enh@google.com>

	test/sfd.c: add missing includes.

2015-02-19  Dmitry V. Levin  <ldv@altlinux.org>

	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.

	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.

	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.

	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.

	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.

	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  Dmitry V. Levin  <ldv@altlinux.org>

	is_negated_errno: sync MAX_ERRNO with the kernel.
	Linux kernel used to guarantee that the largest errno value will not
	exceed 4095, but SECCOMP_RET_ERRNO support introduced by kernel commit
	v3.4-rc2-13-gacf3b2c71ed20c53dc69826683417703c2a88059 inadvertently
	broke it.  The guarantee is back with kernel commit
	v3.19-8275-g580c57f1076872ebc2427f898b927944ce170f2d.

	* syscall.c (is_negated_errno): Set maximum errno value to 4095.

2015-02-19  Mike Frysinger  <vapier@gentoo.org>

	README-linux: punt.
	Considering we're requiring linux-2.6 era kernels, the discussion of
	header troubles that plagued 2.2 and 2.4 are no longer relevant.

	* README-linux: Delete.

2015-02-19  Dmitry V. Levin  <ldv@altlinux.org>

	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.

	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.

	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-18  Dmitry V. Levin  <ldv@altlinux.org>

	Declare all format printers with printf format attribute.
	* defs.h (printllval, printnum_int, printnum_long): Mark with
	format(printf) attribute.
	* sock.c (sock_ioctl): Fix format string.

2015-02-17  Dmitry V. Levin  <ldv@altlinux.org>

	Rename printnum to printnum_long to avoid confusion.
	* defs.h (printnum): Rename to printnum_long.
	* util.c (printnum): Likewise.
	* process.c (sys_ptrace): Likewise.
	* time.c (sys_time): Likewise.

	Use printnum_int consistently.
	* sock.c (sock_ioctl): Use printnum_int instead of printnum to print
	integer type.
	* stream.c (sys_getpmsg): Likewise.

2015-02-16  Dmitry V. Levin  <ldv@altlinux.org>

	print_pc: fix multiple personalities support.
	* syscall.c (print_pc): Choose instruction pointer format depending
	on current_wordsize, not the size of long integer type.
	* tests/pc.c: New file.
	* tests/pc.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add pc.
	(TESTS): Add pc.test.
	* tests/.gitignore: Add pc.

	mips: use PTRACE_GETREGS to fetch all registers.
	* linux/mips/arch_regs.h (struct mips_regs): New structure.
	(mips_REG_*): New macros.
	* signal.c (sys_sigreturn) [MIPS]: Use mips_REG_SP.
	* syscall.c [MIPS] (struct mips_regs): New variable.
	[MIPS] (ARCH_REGS_FOR_GETREGS): New macro.
	(mips_a3, mips_r2): Remove.
	(print_pc) [MIPS]: Use mips_REG_EPC.
	(get_scno) [MIPS]: Use mips_REG_V0 and mips_REG_A3.
	(get_syscall_args) [MIPS]: Use mips_REG_A[0-5].
	(get_syscall_result) [MIPS]: Remove.
	(get_error) [MIPS]: Use mips_REG_A3 and mips_REG_V0.

	mips: move ABI check to configure.ac.
	* configure.ac [MIPS]: Check for MIPS ABI.
	* defs.h [MIPS]: Remove MIPS ABI check.
	* ioctlsort.c: Likewise.

	tests: support alternative names of select syscall.
	* tests/select.awk: Recognize "_newselect" as another name of "select".
	* tests/select.test: Try alternative names of select syscall.

2015-02-15  Dmitry V. Levin  <ldv@altlinux.org>

	i386: fix compilation warning.
	Some gcc versions complain about assigning long* to uint32_t* on i386.

	* syscall.c [I386] (i386_esp_ptr): Change type from uint32_t* to long*.
	* linux/i386/arch_regs.h (i386_esp_ptr): Likewise.
	* linux/x86_64/arch_regs.h: Do not include "i386/arch_regs.h".
	(i386_esp_ptr): New prototype.

2015-02-14  Dmitry V. Levin  <ldv@altlinux.org>

	Do not reset get_regs_error unnecessarily.
	As get_regs() is now guaranteed to set get_regs_error,
	there is no need to reset get_regs_error before get_regs() call.

	* strace.c (trace): Call clear_regs() iff !WIFSTOPPED.

2015-02-14  Dmitry V. Levin  <ldv@altlinux.org>

	get_syscall_result: remove redundant ifdefs.
	As get_regs() is now guaranteed to fetch registers when either
	ARCH_REGS_FOR_GETREGSET or ARCH_REGS_FOR_GETREGS is defined, we can
	safely replace all checks for architectures where these macros are defined
	with a single check for these macros.

	* syscall.c (get_syscall_result): Check for [ARCH_REGS_FOR_GETREGSET ||
	ARCH_REGS_FOR_GETREGS].  Remove all checks for architectures where
	nothing has to be done after get_regs().

2015-02-14  Dmitry V. Levin  <ldv@altlinux.org>

	get_regs: define for all architectures.
	* defs.h (get_regs_error): Remove.
	(clear_regs): Update prototype, declare unconditionally.
	(get_regs): Declare unconditionally.
	* syscall.c (clear_regs): New function.
	(get_regs): Define unconditionally.
	(get_regs_error): Define unconditionally, change scope to static.

	get_regs: unify code for architectures that use PTRACE_GETREGS.
	* syscall.c [I386, POWERPC, ARM, AVR32, SPARC, SPARC64, TILE]
	(ARCH_REGS_FOR_GETREGS): New macro.
	(get_regs): Unify code for ARCH_REGS_FOR_GETREGS architectures.

	get_regset: define iff PTRACE_GETREGSET is used.
	* syscall.c [AARCH64, X86_64, X32] (ARCH_REGS_FOR_GETREGSET,
	ARCH_IOVEC_FOR_GETREGSET): New macros.
	(get_regset): Define iff ARCH_REGS_FOR_GETREGSET is defined; change
	return type to long, return ptrace() return code instead of assigning it
	to get_regs_error; do not list individual architectures, implement
	constant and variable iovec cases depending on ARCH_IOVEC_FOR_GETREGSET.
	(get_regs): Assign get_regset() return code to get_regs_error.

2015-02-14  Dmitry V. Levin  <ldv@altlinux.org>

	arm, i386: switch back to use PTRACE_GETREGS.
	PTRACE_GETREGSET and PTRACE_GETREGS methods are equally good on arm and
	i386 architectures, but PTRACE_GETREGSET with fallback to PTRACE_GETREGS
	is a bit more costly, so choose the method that costs less.
	This partially reverts commit v4.7-149-gfaa177e.

	* syscall.c [ARM, I386] (ARCH_REGS_FOR_GETREGSET): Remove.
	(get_regset) [ARM || I386]: Remove.
	(get_regs) [ARM || I386]: Use PTRACE_GETREGS unconditionally.

2015-02-14  Dmitry V. Levin  <ldv@altlinux.org>

	syscall.c: remove obsolete ifdefs.
	* syscall.c (get_regset, get_regs): Do not check for availability
	of PTRACE_GETREGSET and NT_PRSTATUS macros.

	syscall.c: ensure that NT_PRSTATUS is defined.
	* syscall.c: Do not include <elf.h>.
	(NT_PRSTATUS): New macro.

2015-02-13  Dmitry V. Levin  <ldv@altlinux.org>

	Move regs-related macros and declarations from defs.h to regs.h.
	* regs.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* linux/arch_regs.h: New file.
	* linux/alpha/arch_regs.h: Likewise.
	* linux/arm/arch_regs.h: Likewise.
	* linux/hppa/arch_regs.h: Likewise.
	* linux/i386/arch_regs.h: Likewise.
	* linux/ia64/arch_regs.h: Likewise.
	* linux/mips/arch_regs.h: Likewise.
	* linux/powerpc/arch_regs.h: Likewise.
	* linux/sh64/arch_regs.h: Likewise.
	* linux/sparc/arch_regs.h: Likewise.
	* linux/sparc64/arch_regs.h: Likewise.
	* linux/tile/arch_regs.h: Likewise.
	* linux/x86_64/arch_regs.h: Likewise.
	* Makefile.am (EXTRA_DIST): Add them.
	* defs.h: Remove definitions of PTRACE_*, REG_*, PT_*, U_REG_*,
	and ARM_* macros.
	Remove declarations of struct pt_regs variables.
	[SPARC]: Do not include <asm/psr.h>.
	[SPARC64]: Do not include <asm/psrcompat.h>.
	* bjm.c: Do not include <sys/user.h>.
	* process.c: Include "regs.h".
	Do not include <sys/user.h> and <sys/reg.h>.
	[IA64]: Do not include <asm/ptrace_offsets.h> and <asm/rse.h>.
	* util.c: Likewise.
	* syscall.c: Likewise.
	[AARCH64]: Define struct arm_pt_regs and ARM_* macros.
	[SPARC]: Include <asm/psr.h>.
	[SPARC64]: Include <asm/psrcompat.h>.
	* signal.c: Include "regs.h".
	Do not include <sys/user.h> and <sys/reg.h>.
	[IA64]: Do not include <asm/ptrace_offsets.h>.
	* strace.c [IA64]: Do not include <asm/ptrace_offsets.h>.

	Move all ptrace-related macros and declarations from defs.h to ptrace.h.
	* ptrace.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* configure.ac (AC_CHECK_HEADERS): Remove linux/ptrace.h and sys/ptrace.h.
	* defs.h: Do not include <sys/ptrace.h> and <asm/ptrace.h>.
	Remove definitions of PTRACE_* macros.
	* process.c: Remove <linux/ptrace.h> workarounds, include "ptrace.h".
	* signal.c: Likewise.
	* syscall.c: Likewise.
	* util.c: Likewise.
	* strace.c: Include "ptrace.h".
	* wait.c: Likewise.

2015-02-12  Dmitry V. Levin  <ldv@altlinux.org>

	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-08  Bart Van Assche  <bart.vanassche@sandisk.com>

	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.

2015-02-08  Bart Van Assche  <bart.vanassche@sandisk.com>

	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.

	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.

	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.

2015-02-08  Bart Van Assche  <bart.vanassche@sandisk.com>

	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.

2015-02-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests: extend getdents to support all filesystems regardless of file order
	* tests/getdents.awk: Include all 6 possible permutations of 3
	direntries to regexps.

2015-02-08  Dmitry V. Levin  <ldv@altlinux.org>

	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>

2015-02-07  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-02-07  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-02-07  Dmitry V. Levin  <ldv@altlinux.org>

	-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.

	-b execve: do not use struct tcb after detach.
	* strace.c (trace): Do not proceed after detach.

2015-02-07  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-02-07  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-02-06  Dmitry V. Levin  <ldv@altlinux.org>

	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/.

	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  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-02-06  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-02-06  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-02-06  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-02-06  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-02-06  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-02-05  Dmitry V. Levin  <ldv@altlinux.org>

	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-04  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-02-01  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-02-01  Aurelien Jacobs  <aurel@gnuage.org>

	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.

2015-01-31  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-01-30  Dmitry V. Levin  <ldv@altlinux.org>

	printsock: do not fetch sockaddr.sa_data twice.
	* net.c (printsock): Print addrbuf.sa.sa_data using print_quoted_string.

	setsockopt: add decoding of MCAST_JOIN_GROUP and MCAST_LEAVE_GROUP.
	* net.c (print_group_req): New function.
	(print_setsockopt): Use it.

2015-01-29  Dmitry V. Levin  <ldv@altlinux.org>

	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.

	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.

	printsock: do not fetch sockaddr_un.sun_path twice.
	* net.c (printsock): Print addrbuf.sau.sun_path using
	print_quoted_string.

2015-01-29  Dmitry V. Levin  <ldv@altlinux.org>

	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  Dmitry V. Levin  <ldv@altlinux.org>

	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  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-01-28  Dmitry V. Levin  <ldv@altlinux.org>

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

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

2015-01-26  Dmitry V. Levin  <ldv@altlinux.org>

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

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

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

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

	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.

	sys_uname: quote struct utsname members.
	* uname.c (PRINT_UTS_MEMBER): New macro.
	(sys_uname): Use them.

	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.

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

	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.

2015-01-26  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-01-26  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-01-24  Dmitry V. Levin  <ldv@altlinux.org>

	avr32: fix typo in sys_timerfd syscall entry.
	* linux/avr32/syscallent.h (timerfd): Change sys_name to "timerfd".

	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.

2015-01-24  Helge Deller  <deller@gmx.de>

	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".

2015-01-24  Dmitry V. Levin  <ldv@altlinux.org>

	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  Dmitry V. Levin  <ldv@altlinux.org>

	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  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-01-24  Dmitry V. Levin  <ldv@altlinux.org>

	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).

	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).

2015-01-22  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-01-21  Gabriel Laskar  <gabriel@lse.epita.fr>

	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.

2015-01-21  Dmitry V. Levin  <ldv@altlinux.org>

	Update auxiliary maintainer mode build tools.
	* git-set-file-times: Update from rsync.
	* git-version-gen: Update from gnulib.
	* gitlog-to-changelog: Likewise.

	Update warnings.m4.
	* m4/warnings.m4: Update from gnulib.

2015-01-21  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-01-21  Dmitry V. Levin  <ldv@altlinux.org>

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

	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-20  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-01-16  Dmitry V. Levin  <ldv@altlinux.org>

	ioctlent.sh: cleanup regexps that are used to fetch bases.

	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.

	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.

2015-01-14  Dmitry V. Levin  <ldv@altlinux.org>

	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.

	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.

	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.

	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.

	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.

	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.

	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.

	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.

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

2015-01-13  Dmitry V. Levin  <ldv@altlinux.org>

	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".

2015-01-13  Dmitry V. Levin  <ldv@altlinux.org>

	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.

	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.

	build: add $(builddir)/$(OS)/$(ARCH) to the headers search list.
	* Makefile.am (AM_CPPFLAGS): Add -I$(builddir)/$(OS)/$(ARCH) before
	-I$(srcdir)/$(OS)/$(ARCH).

	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.

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

	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.

2015-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	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.

	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.

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

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

	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.

	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.

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

	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.

2015-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	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.

2015-01-12  Dmitry V. Levin  <ldv@altlinux.org>

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

	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.

	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.

	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.

	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.

	arc: fix fanotify_mark syscall entry.
	* linux/arc/syscallent.h (fanotify_mark): Change nargs to 6.

	ia64: add fallocate syscall entry.
	* linux/ia64/syscallent.h (fallocate): Add syscall entry.

	Fix lookup_dcookie syscall entries.
	* linux/s390/syscallent.h (lookup_dcookie): Add syscall entry.
	* linux/s390x/syscallent.h (lookup_dcookie): Likewise.
	* linux/tile/syscallent.h (lookup_dcookie): Change nargs to 3.
	* linux/x32/syscallent.h (lookup_dcookie): Likewise.

	aarch64: fix syscall names for statfs, fstatfs, truncate, and ftruncate.
	* linux/aarch64/syscallent1.h (statfs, fstatfs, truncate, ftruncate):
	Use correct syscall names.

	aarch64: fix mlock syscall entry.
	* linux/aarch64/syscallent1.h (mlock): Change to mlock entry.

	sh, sh64: fix mlock syscall entry.
	* linux/sh/syscallent.h (mlock): Change nargs to 2.
	* linux/sh64/syscallent.h (mlock): Likewise.

	tile: fix swapon syscall entries.
	* linux/tile/syscallent.h (swapon): Change nargs to 2.
	* linux/tile/syscallent1.h (swapon): Likewise.

2015-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	ARM EABI: reserve some space for new syscalls.
	Reserve the same space for new syscalls on EABI as it is already
	reserved on OABI.

	* linux/arm/syscallent.h [__ARM_EABI__] (ARM_FIRST_SHUFFLED_SYSCALL):
	Raise to 400.

2015-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	arm: rewrite shuffle_scno in a bit more readable way.
	* linux/arm/syscallent.h: Define ARM_FIRST_SHUFFLED_SYSCALL instead of
	ARM_LAST_ORDINARY_SYSCALL.
	* syscall.c [ARM || AARCH64] (shuffle_scno): Update.

	tests: add tests for ipc syscalls decoding.
	* tests/ipc_msg.c: New file.
	* tests/ipc_sem.c: Likewise.
	* tests/ipc_shm.c: Likewise.
	* tests/ipc_msg.test: New test.
	* tests/ipc_sem.test: Likewise.
	* tests/ipc_shm.test: Likewise.
	* tests/Makefile.am (check_PROGRAMS): Add ipc_msg, ipc_sem, and ipc_shm.
	(TESTS): Add ipc_msg.test, ipc_sem.test, and ipc_shm.test.
	* tests/.gitignore: Add ipc_msg, ipc_sem, and ipc_shm.

2015-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	Fix indirect ipc subcall handling.
	indirect_ipccall used to guess whether currently decoded ipc syscall is
	an indirect subcall or not based on generic knowledge, while there is a
	robust method to identify indirect ipc subcalls.

	* defs.h (TRACE_INDIRECT_SUBCALL): New flag.
	* ipc.c (indirect_ipccall): Check it.
	* linux/subcall.h: Set it.

2015-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	Move socket and ipc subcall entries to subcall.h.
	Syscall entries for socket and ipc subcalls are the same on all
	architectures, or at least they should be the same, so move them
	to the single file.

	* linux/subcall.h: Add syscall entries for socket and ipc subcalls.
	* linux/arm/syscallent.h: Remove entries for socket and ipc subcalls.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/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.

2015-01-12  Dmitry V. Levin  <ldv@altlinux.org>

	sh: fix typo introduced by commit v4.9-121-gd535b8b.
	* linux/sh/syscallent.h (getresgid32): Fix typo in sys_func and sys_name.

2015-01-10  Dmitry V. Levin  <ldv@altlinux.org>

	Fix fanotify_mark decoding on 32-bit architectures.
	The fanotify_mark syscall takes a 64-bit mask, and on 32-bit
	architectures it is split up into two syscall arguments.

	* configure.ac (AC_CHECK_FUNCS): Add fanotify_mark.
	(AC_CHECK_HEADERS): Add sys/fanotify.h.
	* defs.h (getllval): New prototype.
	* util.c (getllval): New function based on printllval.
	(printllval): Use getllval.
	* fanotify.c (sys_fanotify_mark): Use getllval to properly decode
	64-bit mask and two syscall arguments followed by it.
	* tests/fanotify_mark.c: New file.
	* tests/fanotify_mark.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add fanotify_mark.
	(TESTS): Add fanotify_mark.test.
	* tests/.gitignore: Add fanotify_mark.

2015-01-09  Dmitry V. Levin  <ldv@altlinux.org>

	v4l2: fix build on systems with older kernel headers.
	* v4l2.c (print_v4l2_format_fmt): Do not use
	V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY unless it is defined.
	(v4l2_ioctl): Do not use VIDIOC_ENUM_FRAMESIZES and
	VIDIOC_ENUM_FRAMEINTERVALS unless they are defined.

2015-01-09  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix build with awk that does not support switch-case.
	The switch-case statement is a gawk-specific feature which is not
	necessarily available, let's use traditional if-else statements instead.

	* tests/uid.awk: Rewrite without switch-case statements.

2015-01-09  Dmitry V. Levin  <ldv@altlinux.org>

	Fix build on systems that lack O_CLOEXEC definition.
	* xlat/timerfdflags.in [!TFD_CLOEXEC]: Check that O_CLOEXEC is defined.

2015-01-09  Dmitry V. Levin  <ldv@altlinux.org>

	Fix build on systems that lack NETLINK_SOCK_DIAG definition.
	NETLINK_INET_DIAG was introduced in linux v2.6.14,
	NETLINK_SOCK_DIAG was added much later in linux v3.3.

	* net.c [!NETLINK_SOCK_DIAG && NETLINK_INET_DIAG]
	(NETLINK_SOCK_DIAG): Define.
	* socketutils.c: Likewise.
	* tests/netlink_unix_diag.c: Likewise.

2015-01-09  Dmitry V. Levin  <ldv@altlinux.org>

	Cleanup local copy of linux/fanotify.h.
	* linux/fanotify.h: Remove macros and structures not used by
	fanotify_init and fanotify_mark parsers.

	Fix "make dist" regression introduced by commit v4.9-125-g120e5db.
	* Makefile.am (EXTRA_DIST): Add linux/unix_diag.h.

2015-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix build with fresh glibc.
	* tests/netlink_unix_diag.c: Include <stdint.h>.

2015-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	ioctlent.sh: handle linux/aufs_type.h properly.
	Before this change, ioctlent.sh could not recognize unusual constants
	defined by linux/aufs_type.h, resulting to ioctls.h with references to
	these constants without appropriate definitions in ioctldefs.h.

	* linux/ioctlent.sh: Update the regexp that is used to lookup constants
	referenced by generated ioctls.h.

2015-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix distcheck.
	* tests/stat32-v.test: Remove work files if the test is skipped.

	Fix printing of time_t values set in the distant future.
	* util.c (sprinttime): Increase buffer size.
	* tests/stat64-v.test: Try to set modification time of the sample file
	to a value set in the distant future.

	Use AC_CHECK_TYPES to check for struct statfs64.
	* m4/statfs.m4: Remove.
	* configure.ac (AC_STATFS64): Remove.
	(AC_CHECK_TYPES): Add struct statfs64.
	* statfs.c: Replace HAVE_STATFS64 with HAVE_STRUCT_STATFS64.

	Use AC_CHECK_TYPES to check for struct stat64.
	* m4/stat.m4: Remove.
	* configure.ac (AC_STAT64): Remove.
	(AC_CHECK_TYPES): Add struct stat64.
	* file.c: Replace HAVE_STAT64 with HAVE_STRUCT_STAT64.

	file.c: fix 32-bit stat decoding on 64-bit architectures.
	* file.c [SPARC || SPARC64] (struct stat): Remove, use generic
	definition from <asm/stat.h>.
	[SPARC64] (struct stat_sparc64, printstat_sparc64): Remove.
	[AARCH64 || X86_64 || X32 || POWERPC64 || SPARC64] (struct stat32,
	STAT32_PERSONALITY): Define.
	[STAT32_PERSONALITY] (struct stat_powerpc32): Rename to struct stat32.
	[STAT32_PERSONALITY] (printstat_powerpc32): Rename to printstat32.
	(printstat) [STAT32_PERSONALITY]: Call printstat32 when
	current_personality == STAT32_PERSONALITY.
	[HAVE_STAT64] (printstat64) [STAT32_PERSONALITY]: Call printstat when
	current_personality != STAT32_PERSONALITY.
	[!HAVE_STAT64] (sys_stat64): Fallback to sys_stat.
	[!HAVE_STAT64] (sys_fstat64): Fallback to sys_fstat.

	sparc: reuse struct stat parser code for struct solstat decoding.
	* printstat.h: Parametrize major() and minor().
	* file.c [SPARC || SPARC64]: Define do_printstat_sol by instantiating
	printstat.h template.
	[SPARC || SPARC64] (printstatsol): Use do_printstat_sol.

	ppc64: reuse struct stat parser code for struct stat_powerpc32 decoding.
	* file.c [POWERPC64]: Define do_printstat32 by instantiating printstat.h
	template.
	[POWERPC64] (printstat_powerpc32): Use do_printstat32.

	file.c: group related parsers together.
	* file.c (sys_stat, sys_fstat): Collect in one place right before
	the definition of printstat64.
	(sys_stat64, sys_fstat64): Collect in one place right after the
	definition of printstat64.

	file.c: collect scattered __old_kernel_stat related code.
	* file.c [HAVE_STRUCT___OLD_KERNEL_STAT] (convertoldstat, printoldstat,
	sys_oldstat, sys_oldfstat): Collect functions in one place.

	Use the same source code for struct stat/stat64 decoding.
	* file.c: Define do_printstat64 by instantiating printstat.h template.
	(printstat64): Use do_printstat64.

	x32: use generic printstat/printstat64 parsers.
	* file.c (printstat) [X32]: Define.
	(printstat64) [X32]: Use "struct stat64" instead of "struct stat".
	Use printstat for x32 personality processes.
	(printstat64_x32): Remove.
	(sys_stat64, sys_fstat64) [X32]: Use printstat64 instead of
	printstat64_x32.

	x32: remove redundant definitions.
	* file.c [X32]: Do not define "struct stat" and "struct
	__old_kernel_stat" locally, use definitions provided by <asm/stat.h>.
	Do not define "struct stat64" exclusively, reuse another definition
	added earlier for X86_64.

	Convert do_printstat to a template function.
	* printstat.h: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c: Include "printstat.h".
	(do_printstat): Move to printstat.h, parametrize its name
	and struct stat.

	file.c: prepare realprintstat for parametrization.
	* file.c (realprintstat): Adjust format strings so that all 64-bit
	integer fields are printed with %llu format, and %u format is used for
	all the rest.  Rename to do_printstat.
	(printstat, printoldstat): Update callers.

	tests: cleanup stat.test.
	* tests/stat.test: Rewrite in a more readable way.

	tests: check verbose decoding of 32-bit and 64-bit struct stat.
	* tests/stat.c: New file.
	* tests/stat32.c: Likewise.
	* tests/stat32-v.test: New file.
	* tests/stat64-v.test: Likewise.
	* tests/Makefile.am (check_PROGRAMS): Add stat and stat32.
	(stat_CFLAGS): Define.
	(TESTS): Add stat32-v.test and stat64-v.test.
	* tests/.gitignore: Add stat and stat32.

2015-01-07  Dmitry V. Levin  <ldv@altlinux.org>

	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  Dmitry V. Levin  <ldv@altlinux.org>

	Drop struct stat.st_aclcnt and stat.st_level support.
	Remove the code that supports struct stat.st_aclcnt and stat.st_level
	decoding -- these fields are not defined in system headers.

	* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_aclcnt and
	struct stat.st_level.
	* file.c (realprintstat, printstat64)
	[HAVE_STRUCT_STAT_ST_ACLCNT || HAVE_STRUCT_STAT_ST_LEVEL]: Remove.

2015-01-07  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix race condition in net-accept-connect based tests.
	Change all net-accept-connect based tests to use different unix domain
	socket addresses, so that these tests could be safely run in parallel.

	* tests/net-accept-connect.c: Parametrize unix domain socket address.
	* tests/net-fd.test: Pass socket address to net-accept-connect.
	* tests/net.test: Likewise.
	* tests/unix-yy.test: Likewise.
	* tests/unix-yy-accept.awk: Update regexps.
	* tests/unix-yy-connect.awk: Likewise.

2014-12-31  Mike Frysinger  <vapier@gentoo.org>

	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-29  Dmitry V. Levin  <ldv@altlinux.org>

	sparc: fix fxstat decoding.
	* file.c [SPARC || SPARC64] (sys_fxstat): Print file descriptor
	using printfd.

2014-12-29  Dmitry V. Levin  <ldv@altlinux.org>

	sparc: drop _STAT64_VER support.
	Starting with commit v4.6-240-g5afdf12, nobody compiles this
	non-Linux code.

	* file.c [SPARC || SPARC64] (sys_xstat, sys_fxstat): Remove
	_STAT64_VER code.

2014-12-29  Dmitry V. Levin  <ldv@altlinux.org>

	sparc: remove redundant sys_lxstat.
	* file.c [SPARC || SPARC64] (sys_lxstat): Remove.
	* linux/sparc/dummy2.h (solaris_lxstat): Alias to sys_xstat.
	* linux/sparc64/dummy2.h (solaris_lxstat): Likewise.

2014-12-28  Dmitry V. Levin  <ldv@altlinux.org>

	file.c: do not include unused headers.
	* file.c: Do not include <fcntl.h>.

2014-12-27  Dmitry V. Levin  <ldv@altlinux.org>

	Cleanup UTIME_NOW/UTIME_OMIT decoding.
	Move the code that's present in two copies from sprinttv()
	to a new helper function.

	* time.c (do_sprinttv): New function.
	(sprinttv): Use it.

2014-12-27  Elliott Hughes  <enh@google.com>

	Fix UTIME_NOW/UTIME_OMIT decoding.
	The kernel doesn't actually care what tv_sec is set to --- it only checks
	tv_nsec when looking for the special values.

2014-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	Make -yy output for inet sockets consistent with unix domain sockets.
	Prepend -yy output generated for INET/INET6 TCP/UDP sockets with their
	protocol name obtained using getxattr.

	* socketutils.c (inet_parse_response): Add proto_name argument.
	Print proto_name for connected and unconnected sockets.
	(receive_responses): Add proto_name argument, pass it to the parser.
	(inet_print): Add proto_name argument, pass it to receive_responses.
	(unix_parse_response): Add proto_name argument.
	(print_sockaddr_by_inode): Pass protocol name to inet_print calls.
	* tests/net-yy-accept.awk: Update to match new output format.
	* tests/net-yy-connect.awk: Likewise.

2014-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify unix domain socket decoding test.
	Unix domain socket address family name is not universally decoded as
	AF_LOCAL, other names like AF_UNIX and AF_FILE are valid synonyms.
	Similarly, PF_UNIX and PF_FILE are valid synonyms for PF_LOCAL.

	Some test regexps have to be properly initialized before they could
	be used, so make sure they are initialized before use.

2014-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix unix domain socket decoding availability test.
	Since inet_diag and unix_diag interfaces are implemented by different
	kernel modules, they have to be tested separately.

	* tests/netlink_unix_diag.c: New file.
	* tests/unix-yy.test: Use it.
	* tests/Makefile.am (check_PROGRAMS): Add it.
	* tests/.gitignore: Likewise.

2014-12-25  Masatake YAMATO  <yamato@redhat.com>

	tests: add a test for decoding unix domain socket addresses.
	* tests/unix-yy-accept.awk: New file.
	* tests/unix-yy-connect.awk: New file.
	* tests/unix-yy.test: New test.
	* tests/Makefile.am (TESTS): Add it.
	(EXTRA_DIST): Add unix-yy-accept.awk and unix-yy-connect.awk.

2014-12-25  Masatake YAMATO  <yamato@redhat.com>

	Support unix domain sockets in -yy option.
	This change extends -yy option to handle unix domain sockets:
	their peer addresses will be printed, similar to inet sockets.

	For a listening socket, its socket inode and socket path are printed.
	For an accepted socket, its socket inode, the peer inode, and the
	socket path are printed.
	For a client socket, its socket inode and the peer inode are printed.

	An example of a server side communication using netcat:

		$ ./strace -yy -e network nc -l -U /tmp/example.sock
		socket(PF_LOCAL, SOCK_STREAM, 0)        = 3
		setsockopt(3<UNIX:[14728348]>, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
		bind(3<UNIX:[14728348]>, {sa_family=AF_LOCAL, sun_path="/tmp/example.sock"}, 19) = 0
		listen(3<UNIX:[14728348,"/tmp/example.sock"]>, 10) = 0
		accept(3<UNIX:[14728348,"/tmp/example.sock"]>, {sa_family=AF_LOCAL, NULL}, [2]) = 4<UNIX:[14727246->14727245,"/tmp/example.sock"]>
		recvfrom(4<UNIX:[14727246->14727245,"/tmp/example.sock"]>, "INPUT\n", 8192, 0, NULL, NULL) = 6
		INPUT

	An example of a client side communication using netcat:

		$ ./strace -yy -e network nc -U /tmp/example.sock
		socket(PF_LOCAL, SOCK_STREAM, 0)        = 3
		connect(3<UNIX:[14727245]>, {sa_family=AF_LOCAL, sun_path="/tmp/example.sock"}, 19) = 0
		getsockopt(3<UNIX:[14727245]>, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
		INPUT
		...
		sendto(3<UNIX:[14727245->14727246]>, "INPUT\n", 6, 0, NULL, 0) = 6

	* linux/unix_diag.h: New file.
	* socketutils.c (send_query): Rename to inet_send_query.
	(parse_response): Rename to inet_parse_response.
	(unix_print, unix_send_query, unix_parse_response): New functions.
	(receive_responses): Add a new argument named parser: a function for
	handling protocol specific data parts of diag messages.
	(print_sockaddr_by_inode): Call unix_print.
	Replace NETLINK_INET_DIAG with NETLINK_SOCK_DIAG, they are equal
	but NETLINK_SOCK_DIAG looks more generic.

2014-12-16  Masatake YAMATO  <yamato@redhat.com>

	Use the protocol name of a socket as a hint for peer address resolution.
	To resolve the peer address of socket, all combinations of families
	(AF_INET, AF_INET6) and protocols(IPPROTO_TCP, IPPROTO_UDP) were tried.
	This change utilizes the protocol name obtained via getxattr to specify
	the right combination.

	* socketutils.c (inet_print): New helper function.
	(print_sockaddr_by_inode): Use it.  Utilize the protocol name
	associated with the given inode for resolving the peer socket
	address.  If the protocol name is NULL, resolve the address
	by trying combinations of families and protocols as before.
	* defs.h (print_sockaddr_by_inode): Update prototype.
	* util.c (printfd): Pass the protocol name associated with
	the given path to print_sockaddr_by_inode as the 2nd argument.

2014-12-16  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of getgroups, getgroups32, setgroups, and setgroups32 syscalls
	Convert parsers of these syscalls to the same scheme as were applied to
	parsers of other uid/gid related syscalls.
	That is, define two sets of parsers on architectures that support
	(either directly or via multiarch) 16-bit and 32-bit gid getgroups
	and setgroups syscalls simultaneously, and reuse essentially the same
	code by parametrizing uid_t and names of parser functions.

	* groups.c: Remove.
	(sys_getgroups, sys_setgroups): Move ...
	* uid.c: ... here and parametrize their names.
	* Makefile.am (strace_SOURCES): Remove groups.c.
	* linux/syscall.h (sys_getgroups32, sys_setgroups32): Remove.
	[NEED_UID16_PARSERS] (sys_getgroups16, sys_setgroups16): New prototypes.
	* linux/arm/syscallent.h: Rename sys_[gs]etgroups to sys_[gs]etgroups16,
	rename sys_[gs]etgroups32 to sys_[gs]etgroups.
	* linux/bfin/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* tests/uid.c: Test for getgroups.
	* tests/uid16.c: Likewise.
	* tests/uid32.c: Test for getgroups32.
	* tests/uid.awk: Test for getgroups/getgroups32 decoding.
	* tests/uid.test: Trace getgroups/getgroups32 syscalls.

2014-12-16  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of 16-bit *chown and [gs]et*[gu]id syscalls.
	Define two sets of parsers on architectures that support (either
	directly or via multiarch) 16-bit and 32-bit uid/gid syscalls
	simultaneously.  Since the code in these two sets is essentially
	the same and the key difference between them is the size of uid_t,
	implement it by parametrizing uid_t and names of parser functions.

	* defs.h (NEED_UID16_PARSERS): New macro.
	* linux/syscall.h [NEED_UID16_PARSERS] (sys_chown16, sys_fchown16,
	sys_getresuid16, sys_getuid16, sys_setfsuid16, sys_setresuid16,
	sys_setreuid16, sys_setuid16): New prototypes.
	* linux/dummy.h (sys_geteuid16): Alias to sys_getuid16.
	(sys_getegid16, sys_getgid16, sys_getresgid16, sys_setfsgid16,
	sys_setgid16, sys_setregid16, sys_setresgid16): Alias to corresponding
	sys_*uid16 functions.
	* uid.c: Stop including <asm/posix_types.h>.
	Parametrize uid_t and names of all exported functions.
	(get_print_uid): New function.
	(sys_getresuid): Use it.
	(printuid): Check for (uid_t) -1.
	* uid16.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* linux/arm/syscallent.h: Use sys_chown16, sys_fchown16, sys_getegid16,
	sys_geteuid16, sys_getgid16, sys_getresgid16, sys_getresuid16,
	sys_getuid16, sys_setfsgid16, sys_setfsuid16, sys_setgid16,
	sys_setregid16, sys_setresgid16, sys_setresuid16, sys_setreuid16,
	and sys_setuid16 parsers for *chown and [gs]et*[gu]id syscall entries.
	* linux/bfin/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* tests/uid16.c: New file.
	* tests/uid16.test: New test.
	* tests/Makefile.am (CHECK_PROGRAMS): Add uid16.
	(TESTS): Add uid16.test.
	* tests/.gitignore: Add uid16.

2014-12-16  Dmitry V. Levin  <ldv@altlinux.org>

	sh, sh64: fix uid/gid syscall entries.
	* linux/sh/syscallent.h: Replace printargs with real syscall
	parsers in *chown32 and [gs]et*[gu]id32 syscall entries.
	* linux/sh64/syscallent.h: Likewise.

	s390: fix uid/gid syscall entries.
	* linux/s390/syscallent.h: Add "32" suffix to names of *chown32
	and [gs]et*[gu]id32 syscalls #198..216.

	sparc: fix uid/gid syscall entries.
	* linux/sparc/syscallent.h: Add "32" suffix to names
	of [gs]etres[gu]id32 syscalls #108..112.
	Fix entry for syscall #112 from setresgid32 to setregid32.

2014-12-15  Dmitry V. Levin  <ldv@altlinux.org>

	chown.c: split into separate files.
	This will make further uid/gid fixes simpler.

	* fchownat.c: New file.
	* chown.c (sys_fchownat: Move to fchownat.c.
	(sys_chown, sys_fchown): Move to uid.c.
	* Makefile.am (strace_SOURCES): Remove chown.c, add fchownat.c.

2014-12-15  Dmitry V. Levin  <ldv@altlinux.org>

	util.c: move printuid to uid.c.
	This will make further uid/gid fixes simpler.

	* util.c (printuid): Move
	* uid.c: ... here.

2014-12-15  Dmitry V. Levin  <ldv@altlinux.org>

	tests/uid.awk: rewrite in a more maintainable style.
	Since the test is virtually a FSM, rewrite it as a FSM.

2014-12-14  Dmitry V. Levin  <ldv@altlinux.org>

	printuid: fix uid_t decoding on 64-bit architectures.
	It was not a good idea to treat uid_t as a long int type because
	the latter is twice larger than uid_t on 64-bit architectures.

	* defs.h (printuid): Change uid argument type from "unsigned long"
	to "unsigned int".
	* util.c (printuid): Likewise.  When uid equals to -1, print "-1".
	* tests/uid.awk: New file.
	* tests/uid.c: New file.
	* tests/uid32.c: Likewise.
	* tests/uid.test: New test.
	* tests/uid32.test: Likewise.
	* tests/Makefile.am (CHECK_PROGRAMS): Add uid and uid32.
	(TESTS): Add uid.test and uid32.test.
	(EXTRA_DIST): Add uid.awk.
	* tests/.gitignore: Add uid and uid32.

2014-12-13  Dmitry V. Levin  <ldv@altlinux.org>

	Update PTRACE_* constants.
	* xlat/ptrace_cmds.in: Add PTRACE_PEEKSIGINFO, PTRACE_GETSIGMASK,
	and PTRACE_SETSIGMASK.

	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-11  Dmitry V. Levin  <ldv@altlinux.org>

	Update SCHED_* constants.
	* xlat/schedulers.in: Add SCHED_BATCH, SCHED_ISO, SCHED_IDLE, and
	SCHED_DEADLINE.

	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  Dmitry V. Levin  <ldv@altlinux.org>

	Always compile sys_prctl parser.
	Since sys_prctl is referenced by syscallent files unconditionally,
	conditional compilation of sys_prctl depending on prctl availability is
	pointless.

	* prctl.c (unalignctl_string, sys_prctl): Compile unconditionally.

2014-12-11  Dmitry V. Levin  <ldv@altlinux.org>

	process.c: split struct_user_offsets into architecture-specific include files
	* Makefile.am (EXTRA_DIST): Add linux/alpha/userent.h,
	linux/arm/userent.h, linux/avr32/userent.h, linux/bfin/userent.h,
	linux/crisv10/userent.h, linux/crisv32/userent.h,
	linux/i386/userent.h, linux/i386/userent0.h, linux/ia64/userent.h,
	linux/m68k/userent.h, linux/microblaze/userent.h,
	linux/mips/userent.h, linux/or1k/userent.h, linux/powerpc/userent.h,
	linux/s390/userent.h, linux/s390/userent0.h, linux/s390/userent1.h,
	linux/s390x/userent.h, linux/sh/userent.h, linux/sh/userent0.h,
	linux/sh64/userent.h, linux/sparc/userent.h, linux/sparc64/userent.h,
	linux/tile/userent.h, linux/userent.h, linux/userent0.h,
	linux/x32/userent.h, linux/x86_64/userent.h, and
	linux/xtensa/userent.h.
	* process.c (struct_user_offsets): Split into architecture-specific
	include files, inculde userent.h.

	process.c: include less headers.
	* process.c: Do not include <fcntl.h> and <sys/stat.h>.
	Reorder inclusion of xlat header files.

	Unexport struct_user_offsets.
	* defs.h (struct_user_offsets): Remove.
	* process.c (struct_user_offsets): Make static.

2014-12-11  Dmitry V. Levin  <ldv@altlinux.org>

	process.c: introduce XLAT_UOFF macro.
	Introduce XLAT_UOFF macro and use it to automatically transform
	struct_user_offsets array into a more readable and compact form.

	for n in $(sed -n 's/^[[:space:]]*{[[:space:]]*uoff(\([a-z_0-9]\+\)),.*/\1/p' process.c |sort -u); do
		sed -i 's/^\([[:space:]]*\){[[:space:]]*uoff('"$n"'),[[:space:]]*"offsetof(struct user,[[:space:]]*'"$n"')"[[:space:]]*},$/\1XLAT_UOFF('"$n"'),/' process.c
	done

	* process.c (XLAT_UOFF): New macro.
	(struct_user_offsets): Use it.

2014-12-11  Dmitry V. Levin  <ldv@altlinux.org>

	process.c: move sethostname and gethostname parsers to a separate file.
	* hostname.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* process.c (sys_sethostname, sys_gethostname): Move to hostname.c.

	process.c: move exit parser to a separate file.
	* exit.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* process.c (sys_exit): Move to exit.c.

	process.c: move clone, setns, unshare, and fork parsers to a separate file
	* clone.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* process.c: Move sys_clone, sys_setns, sys_unshare, sys_fork, and
	related code to clone.c.

	process.c: move get*uid and set*uid parsers to a separate file.
	* uid.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* process.c (sys_getuid, sys_setfsuid, sys_setuid, sys_getresuid,
	sys_setreuid, sys_setresuid): Move to uid.c.

	process.c: move getgroups* and setgroups* parsers to a separate file.
	* groups.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* process.c: Move sys_setgroups, sys_getgroups, sys_setgroups32,
	sys_getgroups32, and related code to groups.c.

	process.c: move execve and execv parsers to a separate file.
	* execve.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* process.c: Move sys_execve, sys_execv, and related code to execve.c.

	process.c: move waitpid, wait4, osf_wait4, and waitid parsers to a separate file
	* wait.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* process.c: Move sys_waitpid, sys_wait4, sys_osf_wait4, sys_waitid and
	related code to wait.c.

	process.c: move uname parser to a separate file.
	* uname.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* process.c (sys_uname): Move to uname.c.

	process.c: move futex parser to a separate file.
	* futex.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* process.c: Move sys_futex and related code to futex.c.

	process.c: move get_robust_list parser to a separate file.
	* get_robust_list.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* process.c (sys_get_robust_list): Move to get_robust_list.c.

	process.c: move sched_* parsers to a separate file.
	* sched.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* process.c: Move sys_sched_getscheduler, sys_sched_setscheduler,
	sys_sched_getparam, sys_sched_setparam, sys_sched_get_priority_min,
	sys_sched_rr_get_interval, and related code to sched.c.

	process.c: move sched_setaffinity and sched_getaffinity parsers to a separate file
	* affinity.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* process.c (sys_sched_setaffinity, sys_sched_getaffinity): Move
	to affinity.c.

	process.c: move prctl and arch_prctl parsers to a separate file.
	* prctl.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* process.c: Move sys_prctl, sys_arch_prctl, and related code to prctl.c.

	process.c: move getcpu parser to a separate file.
	* getcpu.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* process.c (sys_getcpu): Move to getcpu.c.

	process.c: move process_vm_readv and process_vm_writev parsers to a separate file
	* process_vm.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* process.c (sys_process_vm_readv, sys_process_vm_writev): Move
	to process_vm.c.

	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.

	Fix decoding of renameat2 RENAME_* flags.
	* renameat.c: Include <linux/fs.h> where RENAME_NOREPLACE,
	RENAME_EXCHANGE, and RENAME_WHITEOUT are usually defined.

	file.c: move open, openat, and creat parsers to a separate file.
	* open.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c: Move sys_open, sys_openat, sys_creat, and related code
	to open.c.

	file.c: move access and faccessat parsers to a separate file.
	* access.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c: Move sys_access, sys_faccessat and related code to access.c.

	file.c: move umask parser to a separate file.
	* umask.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c (sys_umask): Move to umask.c.

	file.c: move lseek and llseek parsers to a separate file.
	* lseek.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c: Move sys_lseek, sys_llseek, and related code to lseek.c.

	file.c: move readahead parser to a separate file.
	* readahead.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c (sys_readahead): Move to readahead.c.

	file.c: move truncate, truncate64, ftruncate, and ftruncate64 parsers to a separate file
	* truncate.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c (sys_truncate, sys_truncate64, sys_ftruncate, sys_ftruncate64):
	Move to truncate.c.

	file.c: move chdir parser to a separate file.
	* chdir.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c (sys_chdir): Move to chdir.c.

	file.c: move link, linkat, unlinkat, and symlinkat parsers to a separate file
	* link.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c: Move sys_link, sys_linkat, sys_unlinkat, sys_symlinkat, and
	related code to link.c.

	file.c: move readlink and readlinkat parsers to a separate file.
	* readlink.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c (decode_readlink, sys_readlink, sys_readlinkat): Move
	to readlink.c.

	file.c: move renameat and renameat2 parsers to a separate file.
	* renameat.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c: Move sys_renameat, sys_renameat2, and related code
	to renameat.c.

	file.c: move chown, fchown, and fchownat parsers to a separate file.
	* chown.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c (sys_chown, sys_fchownat, sys_fchown): Move to chown.c.

	Export at_flags.
	* defs.h (at_flags): New prototype.

	file.c: move chmod, fchmod, and fchmodat parsers to a separate file.
	* chmod.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c (sys_chmod, sys_fchmodat, sys_fchmod): Move to chmod.c.

	file.c: move utimes, futimesat, utimensat, and osf_utimes parsers to a separate file
	* utimes.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c (decode_utimes, sys_utimes, sys_futimesat, sys_utimensat,
	sys_osf_utimes): Move to utimes.c.

	file.c: move utime parser to a separate file.
	* utime.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c (sys_utime): Move to utime.c.

	Export sprinttime.
	* defs.h (sprinttime): New prototype.
	* file.c (sprinttime): Make global and move to util.c.

	file.c: move mknod, mknodat, and xmknod parsers to a separate file.
	* mknod.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c: Move sys_mknod, sys_mknodat, sys_xmknod, and related code
	to mknod.c.

	file.c: export sprintmode and move it to a separate file.
	* printmode.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h (sprintmode): New prototype.
	* file.c (sprintmode): Make global and move to printmode.c.

	file.c: move getcwd parser to a separate file.
	* getcwd.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c (sys_getcwd): Move to getcwd.c.

	file.c: move *xattr parsers to a separate file.
	* xattr.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c: Move sys_setxattr, sys_fsetxattr, sys_getxattr, sys_fgetxattr,
	sys_listxattr, sys_flistxattr, sys_removexattr, sys_fremovexattr,
	and related code to xattr.c.

	file.c: move fadvise64 and fadvise64_64 parsers to a separate file.
	* fadvise.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c: Move sys_fadvise64, sys_fadvise64_64, and related code
	to fadvise.c.

	file.c: move sync_file_range and sync_file_range2 parsers to a separate file
	* sync_file_range.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c: Move sys_sync_file_range, sys_sync_file_range2, and related
	code to sync_file_range.c.

	file.c: move fallocate parser to a separate file.
	* fallocate.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c (sys_fallocate): Move to fallocate.c.

	file.c: move swapon parser to a separate file.
	* swapon.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c: Move sys_swapon and related code to swapon.c.

2014-12-06  Dmitry V. Levin  <ldv@altlinux.org>

	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  Dmitry V. Levin  <ldv@altlinux.org>

	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-04  Dmitry V. Levin  <ldv@altlinux.org>

	Remove system.c.
	All disjoint parts of system.c have been moved to separate files.

	* system.c: Remove.
	* Makefile.am (strace_SOURCES): Remove it.

2014-12-04  Dmitry V. Levin  <ldv@altlinux.org>

	Move mount parser to a separate file.
	* mount.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* system.c: Move sys_mount and related code to mount.c.

	Move umount2 parser to a separate file.
	* umount.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* system.c: Move sys_umount2 and related code to umount.c.

	Move personality parser to a separate file.
	* personality.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* system.c: Move sys_personality and related code to personality.c.

	Move syslog parser to a separate file.
	* syslog.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* system.c: Move sys_syslog and related code to syslog.c.

	Move cacheflush parser to a separate file.
	* cacheflush.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* system.c: Move inclusion of <asm/cachectl.h> to cacheflush.c.
	[M68K, BFIN, SH]: Move to cacheflush.c.

	bfin: move sram_alloc parser to a separate file.
	* sram_alloc.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* system.c [BFIN]: Move sys_sram_alloc and related code to sram_alloc.c.

	Move capget and capset parsers to a separate file.
	* capability.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* system.c: Move inclusion of headers and macro definitions related
	to capget and capset decoding to capability.c.
	(print_cap_header, print_cap_data, sys_capget, sys_capset): Move
	to capability.c.

2014-12-03  Dmitry V. Levin  <ldv@altlinux.org>

	Move sysctl parser to a separate file.
	* sysctl.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* system.c: Move sys_sysctl and related code to sysctl.c.

	mips: move sysmips parser to a separate file.
	* sysmips.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* system.c: Fix typo in the check for <linux/utsname.h>.
	Move inclusions of <linux/utsname.h> and <asm/sysmips.h> to sysmips.c.
	[MIPS]: Likewise.

	or1k: move or1k_atomic parser to a separate file.
	* or1k_atomic.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* system.c [OR1K]: Move to or1k_atomic.c.

2014-12-02  Dmitry V. Levin  <ldv@altlinux.org>

	Alias sys_setdomainname to sys_sethostname.
	Since parsers for setdomainname and sethostname syscalls are identical,
	replace sys_setdomainname with an alias to sys_sethostname.

	* linux/dummy.h (sys_setdomainname): Alias to sys_sethostname.
	* linux/syscall.h (sys_setdomainname): Remove.
	* process.c (sys_setdomainname): Remove.

2014-12-02  Dmitry V. Levin  <ldv@altlinux.org>

	Alias sys_getpeername to sys_getsockname.
	Since parsers for getpeername and getsockname syscalls are identical,
	replace sys_getpeername with an alias to sys_getsockname.

	* linux/dummy.h (sys_getpeername): Alias to sys_getsockname.
	* linux/syscall.h (sys_getpeername): Remove.
	* net.c (sys_getpeername): Remove.

2014-12-02  Dmitry V. Levin  <ldv@altlinux.org>

	Alias sys_stime to sys_time.
	Since parsers for stime and time syscalls are identical,
	replace sys_stime with an alias to sys_time.

	* linux/dummy.h (sys_stime): Alias to sys_time.
	* linux/syscall.h (sys_stime): Remove.
	* time.c (sys_stime): Remove.

2014-12-02  Dmitry V. Levin  <ldv@altlinux.org>

	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-01  Dmitry V. Levin  <ldv@altlinux.org>

	Alias sys_mkdir and sys_mkdirat to sys_chmod and sys_fchmodat.
	Special parsers for mkdir and mkdirat are redundant because
	sys_chmod and sys_fchmodat implement the same decoding.

	* file.c (decode_mkdir, sys_mkdir, sys_mkdirat): Remove.
	* linux/dummy.h (sys_mkdir): Alias to sys_chmod.
	(sys_mkdirat): Alias to sys_fchmodat.
	* linux/syscall.h (sys_mkdir, sys_mkdirat): Remove.
	* pathtrace.c (pathtrace_match): Do not check for sys_mkdirat.

2014-12-01  Dmitry V. Levin  <ldv@altlinux.org>

	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  Dmitry V. Levin  <ldv@altlinux.org>

	Remove unused <sys/asynch.h> based code.
	Starting with commit v4.6-240-g5afdf12, nobody compiles this
	non-Linux code.

	* configure.ac (AC_CHECK_HEADERS): Remove sys/asynch.h.
	* file.c [HAVE_SYS_ASYNCH_H]: Remove.

2014-11-27  Masatake YAMATO  <yamato@redhat.com>

	Print protocol name of socket descriptors with -yy option.
	For those socket descriptors that have no associated ip:port pairs
	(or when this information is not available), -yy option prints
	the same <socket:[INODE]> information as -y option, e.g.

	$ strace -e sendto -yy ip l > /dev/null
	sendto(3<socket:[23456789]>, ...

	This change makes -yy output more informative: instead of just
	printing "socket", the name of protocol behind the socket descriptor
	will be printed, e.g.

	sendto(3<NETLINK:[23456789]>, ...

	* configure.ac (AC_CHECK_HEADERS): Add sys/xattr.h.
	* tests/net-yy-accept.awk: Update to support protocol names.
	* tests/net-yy-connect.awk: Likewise.
	* util.c [HAVE_SYS_XATTR_H]: Include <sys/xattr.h>.
	(getfdproto): New function.
	(printfd): Use it.

2014-11-21  Dmitry V. Levin  <ldv@altlinux.org>

	Replace MAXPATHLEN with PATH_MAX.
	MAXPATHLEN is defined to PATH_MAX, so replace the former with the latter.

	* strace.c (startup_child): Replace MAXPATHLEN with PATH_MAX.
	* util.c (printpathn, printpath): Likewise.

2014-11-21  Mike Frysinger  <vapier@gentoo.org>

	Decode FIFREEZE/FITHAW/FITRIM ioctls.
	The freeze/thaw ones are simple, but the trim is an interesting struct.

	* block.c (block_ioctl): Handle FIFREEZE/FITHAW/FITRIM.
	* ioctl.c (ioctl_decode): Pass 'X' ioctls to block_ioctl.

2014-11-21  Dmitry V. Levin  <ldv@altlinux.org>

	Include <sys/uio.h> unconditionally.
	Since <sys/uio.h> is standardized by POSIX and is present in all
	available versions of glibc, it's safe to assume that any usable
	libc implementation provides this header file.

	* configure.ac (AC_CHECK_HEADERS): Remove sys/uio.h.
	* io.c: Include <sys/uio.h> unconditionally.
	(tprint_iov_upto, tprint_iov, sys_readv, sys_writev,
	print_llu_from_low_high_val, sys_preadv, sys_pwritev): Define
	unconditionally.
	* net.c: Include <sys/uio.h> unconditionally.
	* util.c: Include <sys/uio.h> unconditionally.
	(dumpiov): Define unconditionally.

2014-11-21  Dmitry V. Levin  <ldv@altlinux.org>

	Consistently use C99 designated initializers in the new netlink code.
	* socketutils.c (send_query, receive_responses): Use designated
	initializers for sockaddr_nl, nlmsghdr, and inet_diag_req_v2 structures.
	* tests/netlink_inet_diag.c (send_query, check_responses): Likewise.

2014-11-20  Mike Frysinger  <vapier@gentoo.org>

	Decode open's O_TMPFILE.
	* xlat/open_mode_flags.in: Add O_TMPFILE definition.

2014-11-11  Helge Deller  <deller@gmx.de>

	hppa: update error codes and signal numbers.
	There are two important changes in here:

	1. EWOULDBLOCK has been up to kernel 3.14 errorcode #246. Since hppa
	folks had problems with EWOULDBLOCK != EAGAIN, this was changed in
	kernel 3.14.

	2. Starting with kernel 3.18, hppa folks changed some signal numbers in
	such a way that we end up with SIGRTMIN == 32, which brings hppa in sync
	with other linux ports.

	Both were incompatible changes which basically broke hppa ABI, but since
	they have been merged into the kernel, we have to follow.

2014-11-11  Thomas De Schampheleire  <thomas.de.schampheleire@gmail.com>

	stack trace support: fix check on symbol name presence.
	The output format of the stack trace is supposed to be different
	depending on whether symbol names are available in the build.

	However, the check only verified the validity of the pointer, not of the
	string pointed to (which could be empty).

	This commit fixes the check so that the original output:

	mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x5e000
	 > /lib/libc-2.10.1.so(_IO_file_doallocate+0x8c) [0x68a38]
	 > /lib/libc-2.10.1.so(_IO_doallocbuf+0x6c) [0x78574]
	 > /lib/libc-2.10.1.so(_IO_file_overflow+0x184) [0x7763c]
	 > /lib/libc-2.10.1.so(_IO_file_xsputn+0x88) [0x76aac]
	 > /lib/libc-2.10.1.so(_IO_puts+0xc8) [0x6b64c]
	 > /bin/busybox(+0x0) [0x62c60]
	 > /bin/busybox(+0x0) [0x4940]
	 > /bin/busybox(+0x0) [0x499c]
	 > /bin/busybox(+0x0) [0x4e08]
	 > /lib/libc-2.10.1.so(__libc_init_first+0x30c) [0x1f84c]
	 > /lib/libc-2.10.1.so(__libc_start_main+0xd8) [0x1f9f8]

	becomes:

	mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x5e000
	 > /lib/libc-2.10.1.so(_IO_file_doallocate+0x8c) [0x68a38]
	 > /lib/libc-2.10.1.so(_IO_doallocbuf+0x6c) [0x78574]
	 > /lib/libc-2.10.1.so(_IO_file_overflow+0x184) [0x7763c]
	 > /lib/libc-2.10.1.so(_IO_file_xsputn+0x88) [0x76aac]
	 > /lib/libc-2.10.1.so(_IO_puts+0xc8) [0x6b64c]
	 > /bin/busybox() [0x62c60]
	 > /bin/busybox() [0x4940]
	 > /bin/busybox() [0x499c]
	 > /bin/busybox() [0x4e08]
	 > /lib/libc-2.10.1.so(__libc_init_first+0x30c) [0x1f84c]
	 > /lib/libc-2.10.1.so(__libc_start_main+0xd8) [0x1f9f8]

	Acked-by: Masatake YAMATO <yamato@redhat.com>

2014-11-11  Masatake YAMATO  <yamato@redhat.com>

	tests: add a test for decoding and dumping of recvmmsg/sendmmsg.
	* configure (AC_CHECK_FUNCS): Add sendmmsg.
	* tests/mmsg.c: New file.
	* tests/mmsg.expected: New file.
	* tests/mmsg.test: New test.
	* tests/.gitignore: Add mmsg.
	* tests/Makefile.am (CHECK_PROGRAMS): Add mmsg.
	(TESTS): Add mmsg.test.
	(EXTRA_DIST): Add mmsg.expected.

2014-11-11  Masatake YAMATO  <yamato@redhat.com>

	Add functions for dumping iovecs in mmsghdr used in sendmmsg and recvmmsg
	This patch is similar to what I did in commit
	02f9f6b386741a52f58e1b31ad4e7fff60781ef8.
	That commit was for sendmsg and recvmsg system calls.
	This one is for sendmmsg and recvmmsg system calls.

	* defs.h (dumpiov_in_mmsghdr): New declaration.
	* net.c (extractmmsghdr): New function derived from printmmsghdr.
	(printmmsghdr): Use it.
	(dumpiov_in_mmsghdr): New function.
	* syscall.c (dumpio) [HAVE_SENDMSG]: Call dumpiov_in_mmsghdr
	for recvmmsg and sendmmsg syscalls.

2014-11-11  Masatake YAMATO  <yamato@redhat.com>

	Use the definition of struct mmsghdr if it is defined in build environment
	mmsghrd structure type is defined locally in printmmsghdr function.

	However, more functions will refer the definition in modifications for
	supporting "-e write=set" and "-e read=set" option for sendmmsg and
	recvmmsg system calls.

	After this change, the system definition of struct mmsghdr will be used
	if configure reports it is available, falling back to the old local
	definition.

	* configure.ac (AC_CHECK_TYPES): Add struct mmsghdr.
	* net.c [!HAVE_STRUCT_MMSGHDR] (struct mmsghdr): Define.
	(printmmsghdr): Use previously defined struct mmsghdr.

2014-11-11  Masatake YAMATO  <yamato@redhat.com>

	Introduce a separate function to copy from msghdr32 to msghdr.
	This patch is an initial step for supporting "-e write=set" and
	"-e read=set" option for sendmmsg and recvmmsg system calls.

	Coverting a data of msghdr32 to msghdr is needed both for
	{send,recv}msg and {send,recv}mmsg to decode parameters.
	To share the copying code in both decoders, a separate
	function named copy_from_msghdr32 is introduced.

	* net.c [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4]
	(copy_from_msghdr32): New function.
	(extractmsghdr) [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4]: Use it.

2014-11-11  Dmitry V. Levin  <ldv@altlinux.org>

	ioctlsort: rewrite build rules using noinst_PROGRAMS.
	* linux/ioctlsort.c: Rename to ioctlsort.c
	* Makefile.am (EXTRA_DIST): Rename linux/ioctlsort.c to ioctlsort.c.
	[MAINTAINER_MODE] (noinst_PROGRAMS): Add ioctlsort.
	(ioctlsort_SOURCES): Add ioctlsort.c.
	(nodist_ioctlsort_SOURCES): Add ioctls.h and ioctldefs.h.
	(CLEANFILES): Add $(nodist_ioctlsort_SOURCES).
	(ioctlsort.$(OBJEXT)): Likewise.
	(ioctlsort): Remove.

2014-11-11  Lubomir Rintel  <lkundrak@v3.sk>

	Makefile.am: look for ioctl definitions in the kernel build tree by default
	While most of ioctl-related kernel headers are now exported by kernel's
	headers_install, some are still modules_install only.  The kernel's
	headers installed into /usr/include/ are usually headers_install'ed and
	therefore don't contain some internal headers we need.  The solution is
	to look for modules_install'ed headers for the running kernel, and fall
	back to old behavior if they aren't found.

2014-11-04  Lubomir Rintel  <lkundrak@v3.sk>

	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.

2014-11-04  Philippe De Muyter  <phdm@macqel.be>

	Implement Video4Linux video-input ioctls decoder.
	Introduce v4l2.c, a decoder for the arguments of the video-input subset
	of the v4l2 ioctl's.  This is a combination of
	- previous work by Peter Zotov <whitequark@whitequark.org>, found at
	https://gist.githubusercontent.com/whitequark/1263207/raw/strace-4.6-v4l2-ioctls.patch
	- previous work by William Manley <will@williammanley.net>, found at
	http://marc.info/?l=strace&m=139395588520675
	- forward port, additions and fixes by Philippe De Muyter <phdm@macqel.be>

	As v4l2 is a moving target, I have made v4l2.c compilable with ancient
	linux kernels by testing the availability of some macros.  It has been
	succesfully compiled on linux 3.10, 3.1, 2.6.31 and 2.6.22, and
	succesfully used on linux 3.10 with a camera device.

	* configure.ac: Check for availabilty of V4L2_* enum constants.
	* Makefile.am (strace_SOURCES): Add v4l2.c.
	* defs.h (v4l2_ioctl): New prototype.
	* ioctl.c (ioctl_decode): Use v4l2_ioctl.
	* v4l2.c: New file.
	* xlat/v4l2_*.in: New files.

	Cc: Peter Zotov <whitequark@whitequark.org>
	Cc: William Manley <will@williammanley.net>

2014-11-04  Dmitry V. Levin  <ldv@altlinux.org>

	Update ioctl entries.
	* linux/ioctlent.h.in: Regenerate from v3.17 headers.

	Remove ioctl header file names from the executable.
	* defs.h (struct ioctlent): Remove "doth" field.
	* Makefile.am ($(ioctlent_h)): Remove 1st field.

2014-11-04  Dmitry V. Levin  <ldv@altlinux.org>

	Filter out redundant ioctl entries early.
	For two ioctl entries with the same code, if one's name is a prefix
	to another's name, keep the entry with a shorter name.  Filter out
	redundant ioctl entries at ioctlsort stage so that distributed
	ioctlent.h.in files will be already filtered.

	* linux/ioctlsort.c (is_not_prefix): New function.
	(main): Use it.
	* linux/ioctlent-filter.awk: Remove.
	* Makefile.am (EXTRA_DIST): Remove linux/ioctlent-filter.awk.
	($(ioctlent_h)): Don't use linux/ioctlent-filter.awk.

2014-11-03  Dmitry V. Levin  <ldv@altlinux.org>

	ioctlent.sh: update the list of directories exported by headers_install.
	* linux/ioctlent.sh: Add drm, mtd, rdma, video, and xen directories.

2014-11-01  Masatake YAMATO  <yamato@redhat.com>

	Add a function for dumping iovec in msghdr used in sendmsg and recvmsg.
	Here is an example session:

	    $ ./strace -e write=all ip link change dev enp0s25 mtu 1501 > /dev/null
	    sendmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"(...
	     * 40 bytes in buffer 0
	     | 00000  28 00 00 00 10 00 05 00  d0 d9 aa 53 00 00 00 00  (..........S.... |
	     | 00010  00 00 00 00 02 00 00 00  00 00 00 00 00 00 00 00  ................ |
	     | 00020  08 00 04 00 dd 05 00 00                           ........         |
	    ...

	    $ ./strace -e read=all ip link show > /dev/null
	    recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"...
	     * 8192 bytes in buffer 0
	     | 00000  34 00 00 00 02 00 00 00  00 00 00 00 ff 23 00 00  4............#.. |
	     | 00010  ff ff ff ff 20 00 00 00  10 00 05 00 00 00 00 00  .... ........... |
	    ...

	* defs.h (dumpiov_in_msghdr): New prototype.
	* net.c (extractmsghdr): New function derived from printmsghdr.
	(printmsghdr): Use extractmsghdr.
	(dumpiov_in_msghdr): New function.
	* syscall.c (dumpio) [HAVE_SENDMSG]: Call dumpiov_in_msghdr for recvmsg
	and sendmsg syscalls.

2014-10-31  Maarten ter Huurne  <maarten@treewalker.org>

	Include <linux/ptrace.h> regardless of <sys/reg.h> existence.
	This fixes compilation with musl libc.
	This approach was already used in process.c, so I assume it is safe.

	* signal.c: Move [HAVE_LINUX_PTRACE_H] code out of [HAVE_SYS_REG_H] check.
	* syscall.c: Likewise.
	* util.c: Likewise.

2014-10-31  Dmitry V. Levin  <ldv@altlinux.org>

	sock: decode SIOCSIFNAME on entering syscall.
	* sock.c (sock_ioctl): Handle SIOCSIFNAME on entering syscall.

2014-10-31  Mike Frysinger  <vapier@gentoo.org>

	sock: fix decoding of SIOCSIFNAME.
	The decoding of SIOCSIFNAME is incorrect.  It does not use
	the ifr_index field to look things up, but ifr_newname.

	* sock.c (sock_ioctl): Split out SIOCSIFNAME from SIOCGIFNAME and
	display ifr_newname.

2014-10-31  Mike Frysinger  <vapier@gentoo.org>

	sock: fix decoding of struct ifreq.ifr_name.
	The ifr name fields of the ifreq structure might not be NUL terminated.
	If the user makes an ioctl call where they aren't, then strace ends up
	reading random content from its own stack.  Limit the printf lengths.

	* sock.c (sock_ioctl): Add explicit length limits to ifr_name printfs.

2014-10-03  Elliott Hughes  <enh@google.com>

	Don't risk truncating open flags by using mode_t.
	On Android, 32-bit arm and x86 use __kernel_mode_t (an unsigned short)
	as their mode_t.  The open(2) flags are actually an int, so high ones
	like O_CLOEXEC get truncated if you coerce them to mode_t.

	* defs.h (tprint_open_modes, sprint_open_modes): Change argument type
	from mode_t to int.
	* file.c (tprint_open_modes, sprint_open_modes): Likewise.

2014-09-29  Dmitry V. Levin  <ldv@altlinux.org>

	Enhance sysinfo decoding.
	* configure.ac (AC_CHECK_MEMBERS): Check for struct sysinfo.totalhigh,
	struct sysinfo.freehigh, and struct sysinfo.mem_unit.
	* sysinfo.c (sys_sysinfo): Treat failed umove() call as syserror().
	Print totalhigh, freehigh, and mem_unit members when struct sysinfo
	supports them.

	Move sysinfo parser to a separate file.
	* sysinfo.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* resource.c (sys_sysinfo): Move to sysinfo.c.

2014-09-29  Dmitry V. Levin  <ldv@altlinux.org>

	Fix build with musl libc.
	* resource.c: Include <sys/sysinfo.h> for struct sysinfo definition.

	Reported-by: Steven Honeyman <stevenhoneyman@gmail.com>

2014-09-23  Dmitry V. Levin  <ldv@altlinux.org>

	tests: cleanup checks for basic programs.
	* tests/init.sh: Check for cat and rm.
	* tests/getdents.test: Check for awk.
	* tests/ptrace_setoptions.test: Check for grep.
	* tests/net-fd.test: Do not check for rm.
	* tests/net.test: Likewise.
	* tests/scm_rights-fd.test: Likewise.
	* tests/stat.test: Likewise.
	* tests/uio.test: Likewise.

	tests: add a test for -yy option.
	* tests/net-yy.test: New test.
	* tests/inet-accept-connect-send-recv.c: New file.
	* tests/netlink_inet_diag.c: Likewise.
	* tests/net-yy-accept.awk: Likewise.
	* tests/net-yy-connect.awk: Likewise.
	* tests/.gitignore: Add inet-accept-connect-send-recv,
	netlink_inet_diag, *.tmp-*, and *.tmp.*.
	* tests/Makefile.am (check_PROGRAMS): Add inet-accept-connect-send-recv
	and netlink_inet_diag.
	(TESTS): Add net-yy.test.
	(EXTRA_DIST): Add net-yy-accept.awk and net-yy-connect.awk.

2014-09-22  Dmitry V. Levin  <ldv@altlinux.org>

	Move statfs related parsers to a separate file.
	* statfs.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c (sprintfstype, printstatfs, sys_statfs, sys_fstatfs): Move
	to statfs.c.
	[HAVE_STATFS64] (printstatfs64, printcompat_statfs64, sys_statfs64,
	sys_fstatfs64): Likewise.
	[ALPHA] (osf_statfs, osf_fstatfs): Likewise.

	fsmagic: sort array by value and use bsearch for faster lookup.
	* defs.h (xlat_search): New prototype.
	* util.c (xlat_bsearch_compare, xlat_search): New functions.
	* file.c (sprintfstype): Use xlat_search for fsmagic lookup.
	* xlat/fsmagic.in: Sort by value and mark as not NULL-terminated.
	* tests/statfs.c: New file.
	* tests/statfs.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add statfs.
	(statfs_CFLAGS): Define.
	(TESTS): Add statfs.test.
	* tests/.gitignore: Add statfs.

2014-09-21  Dmitry V. Levin  <ldv@altlinux.org>

	fsmagic: update from <linux/magic.h>
	* xlat/fsmagic.in: Add new constants from <linux/magic.h>.
	Reported by Elliott Hughes.

2014-09-17  Dmitry V. Levin  <ldv@altlinux.org>

	Add -yy option: print ip and port associated with socket descriptors.
	When two ore more -y options are given, print local and remote ip:port
	pairs associated with socket descriptors.  This implementation uses
	NETLINK_INET_DIAG for sockaddr lookup; it's based on the patch
	prepared by Zubin Mithra as a part of his GSoC 2014 strace project.

	* Makefile.am (strace_SOURCES): Add socketutils.c
	(EXTRA_DIST): Add linux/inet_diag.h and linux/sock_diag.h.
	* defs.h (print_sockaddr_by_inode): New prototype.
	* linux/inet_diag.h: New file.
	* linux/sock_diag.h: Likewise.
	* socketutils.c: Likewise.
	* strace.1: Document -yy option.
	* strace.c (usage): Likewise.
	* util.c (printfd): Use print_sockaddr_by_inode.

2014-09-17  Vicente Olivert Riera  <vincent@gentoo.org>

	sigaction: wrap sa_restorer in #ifdef SA_RESTORER consistently.
	Wrap sa_restorer member definitions in #ifdef SA_RESTORER to be
	consistent with their use.
	If an architecture does not provide sa_restorer members but still
	defines SA_RESTORER macro, the latter has to be explicitly undefined.

	This change fixes compilation failures like this one:
	signal.c: In function 'decode_old_sigaction':
	signal.c:631:21: error: 'struct old_sigaction' has no member named 'sa_restorer'
	signal.c: In function 'decode_new_sigaction':
	signal.c:1224:21: error: 'struct new_sigaction' has no member named 'sa_restorer'

	* signal.c (struct old_sigaction, struct old_sigaction32,
	struct new_sigaction, struct new_sigaction32):
	Wrap sa_restorer member in #ifdef SA_RESTORER.
	(decode_old_sigaction, decode_new_sigaction):
	Wrap use of sa32.sa_restorer in #ifdef SA_RESTORER.

2014-09-17  Dmitry V. Levin  <ldv@altlinux.org>

	Fix compilation warnings reported by gcc -Wsign-compare.
	* configure.ac (gl_WARN_ADD): Add -Wsign-compare.
	* defs.h (struct tcb): Change 'currpers' type to unsigned.
	(struct xlat): Change 'val' type to unsigned
	(signame): Add 'const' qualifier to its argument.
	(xlookup, printxval): Add 'const' qualifier to the 2nd argument and
	change its type to unsigned.
	(printpathn): Change the 3rd argument type to unsigned.
	(ioctl_lookup): Change 1st argument type to unsigned.
	* count.c (call_summary_pers, call_summary): Change 'i' type to unsigned.
	* file.c (print_xattr_list): Fix comparisons between signed and unsigned
	long values.
	* ioctl.c (compare): Fix cast.
	(ioctl_lookup): Change 1st argument type to to unsigned.
	(ioctl_next_match): Change 'code' type to unsigned.
	* mem.c (sys_move_pages): Change 'i' type to unsigned.
	* mtd.c (mtd_ioctl): Change 'i' and 'j' types to unsigned.
	Print 'i' using %u format string.
	* process.c (sys_prctl): Change 'i' type to unsigned.
	(printargv): Change 'n' type to unsigned.
	(sys_ptrace): Change 'addr' type to unsigned.
	* scsi.c (print_sg_io_buffer): Add 'const' qualifier to 'len' argument
	and change its type to unsigned.  Change 'i' and 'allocated' types
	to unsigned.
	* signal.c (signame): Add 'const' qualifier to its argument.
	Fix comparisons between signed and unsigned values.
	(sprintsigmask_n, printsiginfo): Fix comparisons between signed and
	unsigned values.
	* sock.c (sock_ioctl): Change 'i' and 'nifra' types to unsigned.
	* strace.c (expand_tcbtab, alloctcb): Change 'i' type to unsigned.
	(detach): Change 'sig' type to unsigned.
	(startup_attach): Change 'tcbi' type to unsigned.
	(startup_child): Change 'm', 'n', and 'len' types to unsigned.
	(init): Use new variable to iterate 'tcbtab'.
	(pid2tcb): Change 'i' type to unsigned.
	(cleanup): Change 'i' and 'sig' types to unsigned.
	* syscall.c (update_personality): Change 'personality' argument type
	to unsigned.
	(struct qual_options): Change 'bitflag' type to unsigned.
	(reallocate_qual): Add 'const' qualifier to its argument and change its
	type to unsigned.
	(qualify_one): Change 'n' and 'bitflag' arguments types to unsigned.
	Add 'const' qualifier to 'n', 'not', and 'pers' arguments.
	Change 'p' type to signed int.
	(qual_syscall): Change 'bitflag' argument type to unsigned.
	Add 'const' qualifier to 'bitflag' and 'not' arguments.
	Change 'p' type to signed int.
	(qual_signal): Change 'bitflag' argument type to unsigned.
	Add 'const' qualifier to 'bitflag' and 'not' arguments.
	Change 'i' type to unsigned.
	(qual_desc): Change 'bitflag' argument type to unsigned.
	Add 'const' qualifier to 'bitflag' and 'not' arguments.
	(qualify): Change 'i' type to unsigned.
	(get_scno): Change 'currpers' type to unsigned.
	Fix a comparison between signed and unsigned values.
	* system.c (sys_sysctl): Change 'cnt' and 'max_cnt' types to unsigned.
	Fix comparisons between signed and unsigned values.
	* util.c (xlookup, printxval): Add 'const' qualifier to 'val' argument
	and change its type to unsigned.
	(printuid): Fix a comparison between signed and unsigned values.
	(printpathn): Change 'n' argument type to unsigned.
	(printstr): Change 'size' type to unsigned.
	Fix a comparison between signed and unsigned values.
	(setbpt): Change 'i' type to unsigned.
	* net.c (printsock): Silence a compilation warning.
	* reboot.c (sys_reboot): Likewise.

2014-09-11  Dmitry V. Levin  <ldv@altlinux.org>

	Move dirent related parsers to a separate file.
	* dirent.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* file.c (print_old_dirent, sys_readdir, sys_getdents, sys_getdents64):
	Move to dirent.c.

	getdents, getdents64: fix potential out-of-bounds read issues.
	* file.c (sys_getdents): Check for invalid d_reclen.
	Avoid reading from uninitialized memory.
	(sys_getdents64): Likewise.
	* tests/getdents.awk: New file.
	* tests/getdents.test: New test.
	* tests/Makefile.am (TESTS): Add it.
	(EXTRA_DIST): Add getdents.awk.

2014-09-10  Dmitry V. Levin  <ldv@altlinux.org>

	tprint_sock_type: remove unused parameter.
	* net.c (tprint_sock_type): Remove unused parameter 'tcp'.
	(sys_socket, sys_socketpair): Update callers.

	printsock: fix decoding of unrecognized AF_PACKET packet types.
	* net.c (printsock): Fix fallback string for AF_PACKET packet types.

2014-09-09  Dmitry V. Levin  <ldv@altlinux.org>

	decode_select: fix potential use of an uninitialized variable.
	A pointer to fd_set was used uninitialized when nfds == 0.

	* desc.c (decode_select): Initialize fds.

	Reported-by: Zubin Mithra <zubin.mithra@gmail.com>

2014-09-08  Dmitry V. Levin  <ldv@altlinux.org>

	Use external libaio.h.
	Stop using an outdated partial copy of libaio.h, switch back to external
	libaio.h from libaio.
	This partially reverts commit 2df03c494eb3c36c4178eba35c374831031d1a58.

	* aio.c: Drop a partial copy of libaio.h, include <libaio.h> instead.
	(print_common_flags): Check for HAVE_STRUCT_IOCB_U_C_FLAGS.
	(sys_io_submit): Check for HAVE_DECL_IO_CMD_PWRITE and
	HAVE_DECL_IO_CMD_PWRITEV.
	* configure.ac: Check for libaio.h and declaration it provides.

2014-08-19  Dmitry V. Levin  <ldv@altlinux.org>

	maint: post-release administrivia.
	* NEWS: Add header line for next release.

2014-08-15  Dmitry V. Levin  <ldv@altlinux.org>

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

	Sync strace.spec and debian/ with packages.
	* debian/changelog: Sync with 4.8-1.1.
	* debian/control: Likewise.
	* debian/rules: Likewise.
	* strace.spec: Sync with 4.8-5.

	NEWS: Update for 4.9 release.

2014-08-15  Mike Frysinger  <vapier@gentoo.org>

	Update syscall tables to the point where they include renameat2.
	* linux/dummy.h: Add printargs aliases for sys_sched_getattr and
	sys_sched_setattr.
	* linux/aarch64/syscallent1.h: Add kcmp/finit_module/sched_setattr/
	sched_getattr/renameat2.
	* linux/alpha/syscallent.h: Add kcmp/finit_module.
	* linux/arm/syscallent.h: Add sched_setattr/sched_getattr/renameat2.
	* linux/hppa/syscallent.h: Add sched_setattr/sched_getattr/utimes/renameat2.
	* linux/i386/syscallent.h: Add sched_setattr/sched_getattr/renameat2.
	* 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: Add getdents64/sched_setattr/sched_getattr/
	renameat2.
	* linux/mips/syscallent-o32.h: Add sched_setattr/sched_getattr/renameat2.
	* linux/powerpc/syscallent.h: Fix finit_module/kcmp order.  Add sched_setattr/
	sched_getattr/renameat2.
	* linux/s390/syscallent.h: Add sched_setattr/sched_getattr/renameat2.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Add sched_setattr/sched_getattr.

	renameat2: add decoding support.
	* file.c (decode_renameat, sys_renameat2): New functions.
	(sys_renameat): Use decode_renameat.
	* pathtrace.c (pathtrace_match): Handle sys_renameat2.
	* linux/syscall.h (sys_renameat2): New prototype.
	* xlat/rename_flags.in: New file.

2014-08-14  Mike Frysinger  <vapier@gentoo.org>

	CREDITS: fix generation in out of tree builds.
	The {...} code changes the working dir with `cd`, but the commands outside
	of that block expects to be in the original dir.  Change to a subshell so
	the path outside of this block remains unchanged.

	* Makefile.am ($(srcdir)/CREDITS): Change {...} to (...).

2014-08-14  Mike Frysinger  <vapier@gentoo.org>

	ia64: add missing syscalls.
	When the preadv/pwritev syscalls were added, the ones before it in the
	ia64 list were missed, so all the syscalls there and later were not in
	the right location (causing things to be decoded incorrectly).

	Add the missing syscalls before preadv which also re-aligns all the
	syscalls after that point.  This fixes the uio.test.

	* linux/ia64/syscallent.h: Add syscalls 1310 through 1318.

2014-08-14  Mike Frysinger  <vapier@gentoo.org>

	ia64: fix sigaction decoding.
	Looks like ia64 doesn't have sa_restorer either, yet still defines
	SA_RESTORER.  Deploy the same trick that HPPA is using to make the
	test pass.

	* signal.c (SA_RESTORER): Undefine when IA64 is defined.
	(struct new_sigaction) [IA64]: Disable sa_restorer.

2014-08-12  Dmitry V. Levin  <ldv@altlinux.org>

	tests: skip detach-stopped.test when PTRACE_SEIZE doesn't work.
	detach-stopped.test is known to fail when PTRACE_SEIZE is not available,
	so skip the test in that case.

	* tests/detach-stopped.test: Check for "strace -d" output and skip the
	test when it says that PTRACE_SEIZE doesn't work.

2014-08-11  Erik Johansson  <erik@ejohansson.se>

	sh: fix syscall numbering for recv and sendto.
	* linux/sh/syscallent.h: Swap recv and sendto syscall entries.

2014-08-11  Mike Frysinger  <vapier@gentoo.org>

	tests: fix uio building w/out preadv/pwritev.
	The preadv/pwritev symbols weren't added to glibc until the 2.10 release,
	so trying to build the uio test leads to link failures.  Add configure
	tests and update uio.test to handle this.

	* configure.ac (AC_CHECK_FUNCS): Add preadv/pwritev.
	* tests/uio.c: Include config.h.
	(main): Check for HAVE_PREADV and HAVE_PWRITEV.
	* tests/uio.test: Check exit status of uio helper.

2014-08-11  Mike Frysinger  <vapier@gentoo.org>

	tests: ignore *.tmp files.
	The tests like to generate random .tmp files, so ignore them.

	* tests/.gitignore: Add *.tmp.

2014-08-11  Mike Frysinger  <vapier@gentoo.org>

	tests: fix shell errors in detach tests.
	The current detach test code does:
		set -e
		...
		cleanup() {
			set +e
			kill ...
			wait ...
		}
		...
		cleanup
		exit 0

	The problem is that while `set -e` is disabled for the body of the
	cleanup function, it isn't necessarily disabled in the caller scope.
	So if the return value of the cleanup function (`wait` in this case)
	is non-zero, the script ends up failing overall.

	Add an explicit return 0 to the cleanup function so that we don't kill
	the overall test pipeline.

	* tests/detach-running.test (cleanup): Add return 0.
	* tests/detach-sleeping.test (cleanup): Likewise.
	* tests/detach-stopped.test (cleanup): Likewise.

2014-08-11  Mike Frysinger  <vapier@gentoo.org>

	set_ptracer_any: add a little documentation.
	This way I don't have to keep reading up on these options and wondering
	why the code isn't aborting when the call fails.

	* tests/set_ptracer_any.c (main): Note prctl failures are ok.

2014-08-10  Mike Frysinger  <vapier@gentoo.org>

	signal: fix thinko in sa_restorer.
	Previous commit here re-added the bugs trying to be fixed due to a
	logic thinko.  The patches were tested in isolation and hand merged
	later.  Oops.

	* signal.c (struct new_sigaction): Change || to &&.

2014-08-09  Mike Frysinger  <vapier@gentoo.org>

	sigaction test: support arches w/out SA_RESTORER and swapped args.
	Running Linux 3.15 (sparc64) and glibc 2.17 (sparc32) triggers a
	rt_sigaction call that does not use SA_RESTORER and has an order
	where it inserts a restorer and a size.  The current tests don't
	support that ordering, so add another regex.

	* tests/sigaction.awk: Support no SA_RESTORER and swapped args.

2014-08-09  Mike Frysinger  <vapier@gentoo.org>

	alpha/sparc: fix arg count for rt_sigaction.
	Both these arches have a rt_sigaction syscall that takes 5 args, not 4.

	* linux/alpha/syscallent.h (rt_sigaction): Change nargs to 5.
	* linux/sparc/syscallent.h (rt_sigaction): Change nargs to 5.

2014-08-09  Mike Frysinger  <vapier@gentoo.org>

	hppa: fix sigaction decoding.
	Since the rt_sigaction syscall on hppa doesn't have a sa_restorer,
	do not include it in the kernel struct.

	We also have to undefine SA_RESTORER so that code doesn't try to
	use it.  The headers will export this, but the syscall doesn't
	actually respect it.

	* signal.c (SA_RESTORER): Undefine when HPPA is defined.
	(struct new_sigaction): Disable sa_restorer on hppa.

2014-08-09  Mike Frysinger  <vapier@gentoo.org>

	alpha: fix sigaction decoding.
	Since the rt_sigaction syscall on alpha doesn't have a sa_restorer,
	do not include it in the kernel struct.

	* signal.c (struct new_sigaction): Disable sa_restorer on alpha.

2014-08-08  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for -yy option support.
	* defs.h (show_fd_path): Change type to unsigned int.
	* strace.c (show_fd_path): Likewise.
	(init): Handle repeated -y option.

2014-08-07  Dmitry V. Levin  <ldv@altlinux.org>

	Fix preadv/pwritev offset decoding on ILP32 architectures.
	This fixes regression introduced by the previous commit.

	* io.c (print_llu_from_low_high_val) [SIZEOF_LONG != SIZEOF_LONG_LONG]:
	Cast argument to unsigned long before casting it to unsigned long long.

2014-08-07  Dmitry V. Levin  <ldv@altlinux.org>

	Fix preadv/pwritev offset decoding on bigendian architectures.
	This partially reverts commit 7845a42b39e59e904d01e75e21f7bc7eb6462560.

	* util.c (printllval): Remove align argument.
	* defs.h (printllval): Update prototype.
	(printllval_aligned, printllval_unaligned): Remove.
	* file.c (sys_readahead, sys_truncate64, sys_ftruncate64, sys_fadvise64,
	sys_fadvise64_64, sys_sync_file_range, sys_sync_file_range2,
	sys_fallocate): Replace printllval_aligned call with printllval.
	* io.c (sys_pread, sys_pwrite): Likewise.
	(print_llu_from_low_high_val): New function.
	(sys_preadv, sys_pwritev): Use it instead of printllval_unaligned.

2014-08-06  Dmitry V. Levin  <ldv@altlinux.org>

	Decode file descriptors returned by accept and accept4 syscalls.
	* net.c (do_accept): Rename to do_sockname.
	(sys_accept, sys_accept4): Update callers, return RVAL_FD.
	(sys_getsockname, sys_getpeername): Call do_sockname directly.
	* tests/net-fd.test: Update.

2014-08-01  Mike Frysinger  <vapier@gentoo.org>

	x32: update io_{setup,submit} syscalls.
	Starting in 3.16, these two syscalls have gotten their own entry
	point for x32.  See linux 7fd44dacdd803c0bbf38bf478d51d280902bb0f1.

	* linux/x32/syscallent.h: Change existing io_{setup,submit} to 64bit,
	and add new entry points for x32 specifically.

2014-06-18  Max Filippov  <jcmvbkbc@gmail.com>

	xtensa: sort values in struct_user_offsets.
	Otherwise ptrace syscall argument decoding is wrong:
	  ptrace(PTRACE_PEEKUSER, 296, syscall_nr, [0x4048eb]) = 0
	  ptrace(PTRACE_PEEKUSER, 296, syscall_nr, [0x3fa6cd30]) = 0
	  ptrace(PTRACE_PEEKUSER, 296, syscall_nr, [0x8040676d]) = 0
	instead of
	  ptrace(PTRACE_PEEKUSER, 296, pc, [0x4048eb]) = 0
	  ptrace(PTRACE_PEEKUSER, 296, a1, [0x3fa6cd30]) = 0
	  ptrace(PTRACE_PEEKUSER, 296, a0, [0x8040676d]) = 0

	* process.c (struct_user_offsets) [XTENSA]: Sort values.

2014-06-18  Dmitry V. Levin  <ldv@altlinux.org>

	Document -k option as experimental.
	strace -k does not produce a reliable output on all supported
	configurations yet, even basic strace-k.test is known to fail
	on some of them.

	* strace.c (usage): Document -k option as experimental.
	* strace.1: Likewise.
	* NEWS: Likewise.

2014-06-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify -k test.
	Split stack-fcall.c into several compilation units so that intermediate
	function calls would not be optimized out by compiler.

	* tests/stack-fcall.c: Move intermediate functions to ...
	* tests/stack-fcall-*.c: ... new files.
	* tests/Makefile.am (stack_fcall_SOURCES): Add stack-fcall-*.c.

2014-06-13  Dmitry V. Levin  <ldv@altlinux.org>

	tests: enhance -k test.
	Add two more function calls to the stack.  Suggested by Masatake YAMATO.

	* tests/stack-fcall.c (f1): Rename to f3.
	(f1, f2): New functions.
	* tests/strace-k.test: Update.

2014-06-13  Dmitry V. Levin  <ldv@altlinux.org>

	unwind: ignore memory mappings that have no PROT_EXEC bit set.
	* unwind.c (build_mmap_cache): For each memory mapping being scanned,
	save its PROT_EXEC bit and skip the mapping if it is not set.

	unwind: cleanup build_mmap_cache.
	* unwind.c (build_mmap_cache): Move local variables to the code branch
	where they are used.  Check return code of sscanf and strdup.  Do not
	treat unusual memory mappings as fatal errors.  Do not skip memory
	mappings with path names starting with "[".

	unwind: remove unused field from mmap_cache_t.
	* unwind.c (mmap_cache_t): Remove "deleted" field.
	(build_mmap_cache): Remove initialization of "deleted" field.

2014-06-12  Dmitry V. Levin  <ldv@altlinux.org>

	unwind: refactor stacktrace_walk.
	* unwind.c (stacktrace_walk): Move stack frame printing code
	to separate function print_stack_frame.

	unwind: constify binary_filename and symbol_name functions arguments.
	* unwind.c (call_action_fn, print_call_cb, sprint_call_or_error,
	queue_put, queue_put_call): Add const qualifier to binary_filename and
	symbol_name arguments.

2014-06-11  Luca Clementi  <luca.clementi@gmail.com>

	unwind: disable stack trace with multiple personalities.
	* unwind.c (unwind_cache_invalidate, unwind_print_stacktrace,
	unwind_capture_stacktrace): Disable stack tracing of non-default
	personality processes.

2014-06-05  Dmitry V. Levin  <ldv@altlinux.org>

	unwind: rename function_off_set to function_offset.
	* unwind.c (call_action_fn, stacktrace_walk, STACK_ENTRY_SYMBOL_FMT,
	print_call_cb, sprint_call_or_error, queue_put, queue_put_call):
	Rename function_off_set to function_offset.

	unwind: fix a bug in range updating of binary search.
	* unwind.c (print_stacktrace): Fix another off-by-one error in binary search.

	unwind: use fopen64 instead of fopen.
	* unwind.c (fopen_for_input): Define to fopen64 iff
	[_LARGEFILE64_SOURCE && HAVE_FOPEN64], otherwise define it to fopen.
	(build_mmap_cache): Use fopen_for_input instead of fopen.

2014-06-05  Dmitry V. Levin  <ldv@altlinux.org>

	unwind: fix build on 32-bit architectures.
	Fix compilation warnings in unwind.c on 32-bit architectures.
	On some architectures getuid is actually getuid32, so change the test
	to use getpid instead of getuid.

	* unwind.c (STACK_ENTRY_SYMBOL_FMT): Explicitly cast function_off_set
	to unsigned long.
	(queue_put_error): Change the 3rd argument's type to unsigned long.
	* tests/stack-fcall.c (f1): Use getpid instead of getuid.
	* tests/strace-k.test: Likewise.

2014-06-05  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify -w option test.
	* tests/count.test: Allow nanosleep to spend a bit less time than 1 second.

2014-06-04  Dmitry V. Levin  <ldv@altlinux.org>

	Fix delete_module decoding.
	* xlat/delete_module_flags.in: New file.
	* file.c (sys_delete_module): Move ...
	* bjm.c (sys_delete_module): ... to here.
	Decode 1st argument using printstr instead of printpath.
	* NEWS: Mention it.

2014-06-04  Zubin Mithra  <zubin.mithra@gmail.com>

	Decode paths associated with file descriptors returned by syscalls.
	* defs.h (RVAL_FD): New macro.
	(RVAL_MASK, RVAL_STR, RVAL_NONE): Update.
	* desc.c (sys_dup, sys_delete_module): New functions.
	(do_dup2, decode_open, sys_creat): Change return value to RVAL_FD.
	* linux/dummy.h (sys_delete_module, sys_dup): Remove.
	* linux/syscall.h (sys_delete_module, sys_dup): New prototypes.
	* syscall.c (trace_syscall_exiting): Handle RVAL_FD.

2014-06-03  Dmitry V. Levin  <ldv@altlinux.org>

	NEWS: Prepare for 4.9 release.

	Warn about flags that have no effect with -c.
	* strace.c (init): Issue a warning if -i, -k, -r, -t, -T, or -y is used
	along with -c.
	This fixes Debian bug #443895.

	debian: enable security hardening features.
	* debian/rules: Follow the advice in https://wiki.debian.org/Hardening
	and enable maximum hardening as for programs that handle untrusted data.
	Patch by Markus <waldeck@gmx.de>.

2014-06-03  Dmitry V. Levin  <ldv@altlinux.org>

	debian: update control file.
	* debian/control (strace64): Fix a typo in package description.
	Patch by Pascal De Vuyst <pascal.devuyst@gmail.com>.
	(strace, strace-udeb): Add x32 to architecture list.
	Patch by Guillaume Morin <guillaume@morinfr.org>.
	(strace, strace-udeb): Add or1k to architecture list.
	Patch by Christian Svensson <debian@cmd.nu>.
	(strace, strace-udeb): Add arm64 to architecture list,
	and remove defunct arm.
	Patch by Wookey <wookey@debian.org>.

	This fixes Debian bugs: #697625, #727018, #742235, #749956.

2014-06-03  Dmitry V. Levin  <ldv@altlinux.org>

	manpage: minor corrections.
	$ groff -ww -mandoc -z strace.1
	strace.1:65: warning: macro `IX' not defined

	* strace.1: define IX macro as empty for groff.
	Change remaining '-' as minus to '\-'.
	Have two word spaces after a full stop as an end of sentence.
	Use extra space ('\,' or '\/') between roman and italic characters.
	Based on patch by Bjarni Ingi Gislason <bjarniig@rhi.hi.is>.
	This fixes Debian bug #725987.

2014-05-30  Masatake YAMATO  <yamato@redhat.com>

	unwind: tests: add a test for -k option.
	* tests/stack-fcall.c: New test target.
	* tests/strace-k.test: New test driver.
	* tests/Makefile.am (check_PROGRAMS): Add stack-fcall.
	(TESTS): Add strace-k.test.
	* tests/.gitignore: Add stack-fcall.

2014-05-30  Masatake YAMATO  <yamato@redhat.com>

	unwind: move stacktrace capturing and mmap cache invalidating to trace_syscall_entering
	Instead of handling stacktrace capturing and mmap cache invalidating in
	sys_* functions, handle them uniformly in trace_syscall_entering using
	new flags introduced by previous two commits.

	The patch is simpler than its older version(v3).  The value of
	hide_log_until_execve is just ignored.  I found the value is nothing
	to do with this patch.  unwind_cache_invalidate is mentioned only
	once in trace_syscall_exiting.
	Both are suggested by Dmitry Levin.

2014-05-30  Dmitry V. Levin  <ldv@altlinux.org>

	unwind: add SE and SI flags to syscall entries for all architectures.
	Add SE flag to execve, exit, and exit_group syscall entries.
	Add SI flag to brk, execve, mmap, mprotect, mremap, munmap,
	remap_file_pages, shmat, and shmdt syscall entries.

2014-05-30  Masatake YAMATO  <yamato@redhat.com>

	unwind: introduce markers specifying the needs of special care in unwinding
	Some system calls require capturing the stack trace before they are
	processed in kernel.  Typical one is execve.  Some system calls require
	invalidating mmap cache after they are processed in kernel.

	In current implementation these requirements are handled directly by
	appropriate syscall handlers.  However, it is difficult to keep the
	source code maintainable using this approach to cover all system calls
	which have such requirements.

	A more generic way to implement this is to flag all syscalls that
	require special processing, and handle these flags right in
	trace_syscall_entering instead of changing syscall handlers.

	This patch just defines new flags: STACKTRACE_INVALIDATE_CACHE and
	STACKTRACE_CAPTURE_ON_ENTER.

	The names of macros are suggested by Dmitry Levin.

2014-05-30  Masatake YAMATO  <yamato@redhat.com>

	unwind: enable dwarf cache of libunwind.
	Here is the benchmark of the dwarf cache.

	Target program:

	    #include <sched.h>
	    int main(void)
	    {
	      unsigned int max = 0x6fff, i;
	      for (i = 0; i < max; i++)
		sched_yield();
	      return 0;
	    }

	Command line:

		./strace -o /dev/null -k a.out

	With the dwarf cache:

	    real	0m12.081s
	    user	0m3.858s
	    sys 	0m8.194s

	Without the dwarf cache:

	    real	0m22.326s
	    user	0m5.218s
	    sys		0m16.952s

2014-05-30  Masatake YAMATO  <yamato@redhat.com>

	unwind: report expected backtracing error.
	When a file mmap'ed to the target process is unlink'ed, backtracing the
	stack would fail.  Current implementation reports it as
	"backtracing_error".  To avoid confusion, the message is changed to
	"expected_backtracing_error".

	Here is the reproducer:

	  $ cat ./p-deleted.c
	  #include <unistd.h>

	  int main(int argc, char **argv) {
	    return unlink(argv[0]) < 0;
	  }

	  $ strace -e unlink -k ./p-deleted
	  unlink("./p-deleted")                   = 0
	   > /usr/lib64/libc-2.18.so(unlink+0x7) [0xe7f17]
	   > /home/yamato/var/strace/t_unwind/p-deleted (deleted)(+0x0) [0x575]
	   > /usr/lib64/libc-2.18.so(__libc_start_main+0xf5) [0x21d65]
	   > backtracing_error [0x7ffff1365590]
	  +++ exited with 0 +++

	p-deleted is deleted therefore backtracing_error is reported.  This
	patch records the deleted marker when making mmap cache and refers the
	recorded information in the case "backtracing_error" to switch the
	message.

	Here is the output of this patch:

	  $ strace -e unlink -k ./p-deleted
	  unlink("./p-deleted")                   = 0
	   > /usr/lib64/libc-2.18.so(unlink+0x7) [0xe7f17]
	   > /home/yamato/var/strace/t_unwind/p-deleted (deleted)(+0x0) [0x575]
	   > /usr/lib64/libc-2.18.so(__libc_start_main+0xf5) [0x21d65]
	   > expected_backtracing_error [0x7ffff1365590]
	  +++ exited with 0 +++

	This solution is not perfect: if a file is unlink'ed after making the
	mmap cache and before unwinding, strace cannot have a chance to record
	the deleted marker.

	In this version of patch, hardcoded magic number used in comparing "(delete)"
	string is replaced with strlen as suggested by Dmitry Levin.

	In old version of patch, the deleted entry was thrown away from mmap
	cache to avoid to report "backtracing_error".  In this patch I keep it,
	and just switch the error message.
	Inspired by the review comment from Dmitry Levin.

2014-05-30  Masatake YAMATO  <yamato@redhat.com>

	unwind: call unwind_tcb_fin before printing detached message.
	captured stacktrace is printed in unwind_tcb_fin if tcp->queue is not
	empty.  This should happen before printing detached message, so
	unwind_tcb_fin is moved to the top of droptcb.

	This is implicitly suggested by Dmitry Levin in patch review process.

2014-05-30  Masatake YAMATO  <yamato@redhat.com>

	unwind: implement automatic mmap cache invalidation.
	A mmap cache belonging to a tcb was updated when a system call which
	changed the memory mapping was called.  This implementation was assumed
	the mapping was changed only by the tcb.  However, this assumption is
	incorrect if the target application is multi-threaded; more than two
	tcbs can shared the same memory mapping and a tcb can modify it without
	being noticed by the others.

	This change introduces a global integer variable mmap_cache_generation,
	and mmap_cache_generation field to struct tcb.  The variable
	is incremented each time a process enters a syscall that can modify its
	memory mapping.  Each tcb records the value of this variable at the
	moment if  building its mmap cache.  Every mmap cache associated with
	the given tcb can be validated by comparing its mmap_cache_generation
	field with the variable mmap_cache_generation.

	This implementation is inefficient.  If strace attaches two processes
	which don't share the memory mapping, rebuilding mmap cache of a tcb
	triggered by another tcb's mmap system call is not necessary.

2014-05-30  Masatake YAMATO  <yamato@redhat.com>

	unwind: introduce queue_t for capturing stacktrace.
	This is the second step for splitting capturing from printing.

	New `queue' field is added to tcb.  Captured stacktrace is stored here.
	The field is initialized/finalized at unwind_tcb_init/unwind_tcb_fin.

	New API function unwind_capture_stacktrace is added.  This function
	captures the currest stack using stracktrace_walker and records it in
	tcb.  It's printing is delayed to the next call of
	unwind_print_stacktrace.

	unwind_print_stacktrace is extended.  Now it checks queue field of
	the given tcb at the start of function.  If the function finds a
	captured stack trace, the latter is printed using stracktrace_walker.

	Currently unwind_capture_stacktrace invocations are added directly to
	handlers of mmap, munmap, mprotect, and execve.

	Here is the difference of output with/without patch:

	(without patch)
	  execve("./test-fork", ["./test-fork"], [/* 56 vars */]) = 0
	   > /usr/lib64/ld-2.18.so(check_one_fd.part.0+0x82) [0x11f0]

	(with patch)
	  execve("./test-fork", ["./test-fork"], [/* 54 vars */]) = 0
	   > /usr/lib64/libc-2.18.so(execve+0x7) [0xbcd27]
	   > /home/yamato/var/strace/strace(exec_or_die+0x10c) [0x26ac]
	   > /home/yamato/var/strace/strace(startup_child+0x346) [0x134f6]
	   > /home/yamato/var/strace/strace(init+0x89f) [0x13dff]
	   > /home/yamato/var/strace/strace(main+0xa) [0x26ca]
	   > /usr/lib64/libc-2.18.so(__libc_start_main+0xf5) [0x21d65]
	   > /home/yamato/var/strace/strace(_start+0x29) [0x2799]

	In older version output lines of captured elements were built when
	printing.  In this version they are built when capturing the stack.
	As result, unneeded dynamic memory allocations are avoided.
	Suggested by Luca Clementi.

	In older version the combination of snprintf and realloc were used.
	In this version they are replaced with asprintf.
	Suggested by Dmitry Levin.

2014-05-30  Masatake YAMATO  <yamato@redhat.com>

	unwind: introduce own debug macro.
	* unwind.c (DPRINTF): New macro, to be utilized in debugging cache
	management code.

2014-05-30  Masatake YAMATO  <yamato@redhat.com>

	unwind: introduce stacktrace_walker.
	In current implementation, the stack trace is captured and printed at
	the same time, in trace_syscall_exiting.  This approach cannot
	provide user expected information when a system call changes the
	memory mapping.  In such cases, the stack trace should be captured on
	entering syscall and printed on exiting.

	As the initial step for splitting capturing from printing, this change
	introduces stacktrace_walker utility function.  It can be used both for
	capturing in trace_syscall_entering and printing in
	trace_syscall_exiting.

2014-05-30  Masatake YAMATO  <yamato@redhat.com>

	unwind: give all exported functions "unwind_" prefix.
	* unwind.c (init_unwind_addr_space): Rename to unwind_init.
	(init_libunwind_ui): Rename to unwind_tcb_init.
	(free_libunwind_ui): Rename to unwind_tcb_fin.
	(delete_mmap_cache): Rename to unwind_cache_invalidate.
	(print_stacktrace): Rename to unwind_print_stacktrace.
	* defs.h: Update prototypes.
	* mem.c: All callers updated.
	* process.c: Likewise.
	* strace.c: Likewise.
	* syscall.c: Likewise.

2014-05-30  Masatake YAMATO  <yamato@redhat.com>

	unwind: delete mmap cache in free_libunwind_ui.
	free_libunwind_ui is expected to release all unwind related resources
	attached to tcp.

	* strace.c (droptcb): Move delete_mmap_cache call ...
	* unwind.c (free_libunwind_ui): ... to here.

2014-05-30  Masatake YAMATO  <yamato@redhat.com>

	unwind: make alloc_mmap_cache function local.
	* defs.h (alloc_mmap_cache): Remove.
	* unwind.c (alloc_mmap_cache): Add static qualifier.

	unwind: fix a bug in range updating of binary search.
	* unwind.c (print_stacktrace): Fix off-by-one error in binary search.

2014-05-30  Luca Clementi  <luca.clementi@gmail.com>

	Add -k option to print stack trace after each syscall.
	Print the stack trace of the traced process after each system call when
	-k option is specified.  It is implemented using libunwind to unwind the
	stack and to obtain the function name pointed by the IP.

	Based on the code that was originally taken from strace-plus
	of Philip J. Guo.

	* configure.ac: Add --with-libunwind option.  Check libunwind support.
	* Makefile.am: Add libunwind support.
	* defs.h (struct tcb) [USE_LIBUNWIND]: Append libunwind specific fields.
	[USE_LIBUNWIND] (stack_trace_enabled, alloc_mmap_cache,
	delete_mmap_cache, print_stacktrace): New prototypes.
	* mem.c (print_mmap, sys_munmap, sys_mprotect): Add libunwind support.
	* process.c (sys_execve): Likewise.
	* strace.c (usage, alloctcb, droptcb, init): Likewise.
	* syscall.c (trace_syscall_exiting): Likewise.
	* unwind.c: New file.
	* strace.1: Document -k option.

2014-05-30  Dmitry V. Levin  <ldv@altlinux.org>

	sysctl: update CTL_*, KERN_*, NET_*, and VM_* constants.
	* configure.ac (AC_CHECK_DECLS): Add CTL_*, KERN_*, NET_*, and
	VM_* constants.
	* system.c (CTL_PROC, CTL_CPU): Remove definitions.
	* xlat/sysctl_*.in: Update.

	Check for constants used by waitid function.
	* configure.ac (AC_CHECK_DECLS): Add P_* constants.

	Check for LO_FLAGS_READ_ONLY constant.
	* configure.ac (AC_CHECK_DECLS): Add LO_FLAGS_READ_ONLY.

	Compress blank lines.
	Suppress empty lines left after automated xlat conversion.

	xlat: cleanup the aftermath of automatic conversion.

	Generate xlat/*.in files.
	Automatically convert xlat structures from *.c files to xlat/*.in files
	using "./generate_xlat_in.sh *.c" command.

	Rename several xlat structures to avoid collisions.
	* bjm.c (which): Rename to qm_which.
	* ipc.c (msg_flags): Rename to ipc_msg_flags.
	* time.c (which): Rename to itimer_which.

	Enhance xlat generator.
	* xlat/gen.sh: Define all xlat structs not declared in defs.h as static.
	Some symbolic constants are not macros, extend #ifdef check to cover
	symbolic constants checked by AC_CHECK_DECLS.
	Handle complex symbolic constants in SYMBOL|... form.
	Handle symbolic constants in 1<<SYMBOL form.
	Handle numeric constants.
	Implement #unconditional directive that turns off preprocessor checks.
	Implement #unterminated directive that turns off adding XLAT_END.

2014-05-30  Dmitry V. Levin  <ldv@altlinux.org>

	Use bootstrap script consistently.
	Now that ./xlat/gen.sh has to be run before autoreconf,
	replace all autoreconf calls with ./bootstrap call.

	* bootstrap: Forward arguments to autoreconf.
	* build_static_example.sh: Replace autoreconf call with bootstrap call.
	* make-dist: Likewise.
	* qemu_multiarch_testing/README: Likewise.

2014-05-30  Mike Frysinger  <vapier@gentoo.org>

	Implement xlat generator.
	* bootstrap: New file.
	* xlat/gen.sh: Likewise.
	* Makefile.am: Include xlat/Makemodule.am
	(EXTRA_DIST): Add $(XLAT_INPUT_FILES), $(XLAT_HEADER_FILES), and
	xlat/gen.sh.

2014-05-30  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix SCM_RIGHTS test for big-endian systems.
	* tests/scm_rights.c (main): Send zero integer to avoid issues with
	endianness.
	* tests/scm_rights-fd.test: Update grep patterns.

	Decode file descriptors passed via SCM_RIGHTS control messages.
	* net.c (printcmsghdr): Print descriptors from SCM_RIGHTS control
	messages using printfd.
	* tests/scm_rights.c: New file.
	* tests/scm_rights-fd.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add scm_rights.
	(TESTS): Add scm_rights-fd.test.
	* tests/.gitignore: Add scm_rights and uio.

	tests: add a test for -c and -w options.
	* tests/count.test: New test.
	* tests/Makefile.am (TESTS): Add it.

2014-05-29  Mark Hills  <Mark.Hills@framestore.com>

	Optionally produce stats on syscall latency.
	Time spent in system time is not useful where a syscall depends on some
	non-CPU resource, eg. typically open() or stat() to a network drive.

	This patch adds a new flag (-w) to produce a summary of the time
	difference between beginning and end of the system call (ie. latency)

	This functionality has been useful to profile slow processes that
	are not CPU-bound.

2014-05-29  Dmitry V. Levin  <ldv@altlinux.org>

	Constify count_syscall function.
	* count.c (count_syscall): Add const qualifier to timeval argument and
	rename it.  Store the wall clock time spent while in syscall in separate
	timeval variable.
	* defs.h (count_syscall): Update prototype.
	* syscall.c (trace_syscall_exiting): Update count_syscall invocation.

	Constify tv_* functions.
	* defs.h (tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_mul, tv_div): Add
	const qualifier to read only arguments.
	* util.c (tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_mul, tv_div):
	Likewise.

2014-05-28  Dmitry V. Levin  <ldv@altlinux.org>

	Use printstr for sethostname, setdomainname, and gethostname decoding.
	The argument passed to sethostname and setdomainname syscalls, as well
	as the string returned by gethostname syscall, is not a pathname, so
	printpathn is not the right method for its decoding.

	* process.c (sys_sethostname, sys_setdomainname): Decode 1st argument
	using printstr instead of printpathn.
	[ALPHA] (sys_gethostname): Likewise.

2014-05-21  James Hogan  <james.hogan@imgtec.com>

	Fix {get,set}rlimit decoding with unreliable SIZEOF_RLIM_T.
	When strace is built with large file support definitions in CFLAGS (as
	may be provided by buildroot) the C library headers may expose a 64-bit
	rlim_t even though the struct rlimit fields used by the system call
	interface are only 32-bit.  The SIZEOF_RLIM_T will then be 8 which
	results in bad decoding of the getrlimit and setrlimit syscalls.

	This is fixed by replacing unreliable SIZEOF_RLIM_T based checks with
	checks for current_wordsize.

2014-05-13  Masatake YAMATO  <yamato@redhat.com>

	Enhance setns syscall decoding.
	* process.c (sys_setns): New function.
	Decode the 2nd syscall argument using clone_flags.
	* linux/syscall.h (sys_setns): New prototype.
	* linux/dummy.h (sys_setns): Remove.

2014-05-12  Dmitry V. Levin  <ldv@altlinux.org>

	mips: fix syscall entries that should have TP flag set.

	xtensa: fix unshare syscall entry.

	alpha, hppa, mips n64: fix waitid syscall entry.

	Add TM flag to shmat and shmdt syscall entries.

	Alias sys_vfork to sys_fork.
	* process.c (sys_vfork): Remove.
	* linux/syscall.h (sys_vfork): Likewise.
	* linux/dummy.h (sys_vfork): Alias to sys_fork.
	* linux/alpha/syscallent.h: Fix vfork entry.
	* util.c (setbpt): Do not check for sys_vfork.
	* syscall.c (syscall_fixup_for_fork_exec): Likewise.

2014-04-17  Dmitry V. Levin  <ldv@altlinux.org>

	epoll_ctl: fix EPOLL_CTL_DEL argument decoding.
	* desc.c (sys_epoll_ctl): Do not parse the event structure for
	EPOLL_CTL_DEL operation.

	Reported-by: Марк Коренберг <socketpair@gmail.com>

2014-04-17  Dmitry V. Levin  <ldv@altlinux.org>

	Update CLOCK_* constants.
	* time.c (clocknames): Add CLOCK_BOOTTIME, CLOCK_REALTIME_ALARM,
	CLOCK_BOOTTIME_ALARM, CLOCK_SGI_CYCLE, and CLOCK_TAI.
	Fixes RH#1088455.

2014-04-17  Dmitry V. Levin  <ldv@altlinux.org>

	Fix preadv/pwritev offset decoding.
	* util.c (printllval): Add align argument.
	* defs.h (printllval): Update prototype.
	(printllval_aligned, printllval_unaligned): New macros.
	* file.c (sys_readahead, sys_truncate64, sys_ftruncate64, sys_fadvise64,
	sys_fadvise64_64, sys_sync_file_range, sys_sync_file_range2,
	sys_fallocate): Replace printllval call with printllval_aligned.
	* io.c (sys_pread, sys_pwrite): Likewise.
	(sys_preadv, sys_pwritev): Replace printllval call with
	printllval_unaligned.
	* linux/arm/syscallent.h: Set the number of preadv and pwritev
	arguments to 5.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

	Reported-by: Dima Kogan <dima@secretsauce.net>

2014-04-16  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add a test for pread/pwrite and preadv/pwritev offset decoding.
	* tests/uio.c: New file.
	* tests/uio.test: New test.
	* tests/Makefile.am (check_PROGRAMS): Add uio.
	(uio_CFLAGS): Define.
	(TESTS): Add uio.test.

2014-04-10  Dmitry V. Levin  <ldv@altlinux.org>

	Refactor LDT decoding.
	* configure.ac (AC_CHECK_TYPES): Remove struct user_desc.
	* ldt.c: New file.
	* Makefile.am (strace_SOURCES): Add ldt.c.
	* mem.c: Do not include <asm/ldt.h>.
	(print_ldt_entry): Remove.
	(sys_modify_ldt, sys_set_thread_area, sys_get_thread_area): Move...
	* ldt.c: ... here.
	* process.c: Do not include <asm/ldt.h>.
	(sys_clone) [I386 || X86_64 || X32]: Use print_user_desc.

2014-04-10  Denys Vlasenko  <dvlasenk@redhat.com>

	Make int3 example in comments more cut-n-pastable.
	I found that I use it quite often. Lets make it so that
	after cut-n-pasting it into a file, there is no need
	to edit the result (e.g. no need to remove C comment
	chars from every line.

2014-04-09  Dmitry V. Levin  <ldv@altlinux.org>

	mips: enable decoding of set_thread_area.
	* linux/dummy.h [MIPS]: Do not redirect sys_set_thread_area to printargs.
	* mem.c [MIPS] (sys_set_thread_area): Define.

	x86_64, x32: enable decoding of modify_ldt, get_thread_area, and set_thread_area
	* linux/dummy.h [X86_64 || X32]: Do not redirect sys_modify_ldt,
	sys_get_thread_area, and sys_set_thread_area to printargs.

	x32: decode clone LDT user_desc entries for x86 processes.
	* mem.c [X32]: Include asm/ldt.h.
	[X32] (print_ldt_entry, sys_modify_ldt, sys_set_thread_area,
	sys_get_thread_area): Define.
	* process.c [X32]: Include asm/ldt.h.
	(sys_clone) [X32]: Decode LDT entry if current_personality == 1.

2014-04-09  Elliott Hughes  <enh@google.com>

	x86-64: decode clone LDT user_desc entries for x86 processes.
	* mem.c [X86_64]: Include asm/ldt.h.
	[X86_64] (print_ldt_entry, sys_modify_ldt, sys_set_thread_area,
	sys_get_thread_area): Define.
	* process.c [X86_64]: Include asm/ldt.h.
	(sys_clone) [X86_64]: Decode LDT entry if current_personality == 1.

2014-04-09  Dmitry V. Levin  <ldv@altlinux.org>

	x32: fix clone(2) argument order for x86 processes.
	Apply the same fix that was made for x86_64.

	* process.c [X32] (ARG_CTID, ARG_TLS): Take current
	personality into account.

2014-04-09  Elliott Hughes  <enh@google.com>

	x86-64: fix clone(2) argument order for x86 processes.
	Without this patch, strace claims that parent_tidptr == tls, which is
	clearly wrong.  It is expected that parent_tidptr == child_tidptr.

	* process.c [X86_64] (ARG_CTID, ARG_TLS): Take current
	personality into account.

2014-04-06  Elliott Hughes  <enh@google.com>

	aarch64: Fix decoding of arm struct stat64.
	We need to handle this situation more like x86-64.  32-bit arm and i386
	actually have a common struct stat64, except the arm one must not be
	packed.  Additionally, on aarch64 the 32-bit personality is personality 0.

2014-03-20  Dmitry V. Levin  <ldv@altlinux.org>

	ARM EABI: disable OABI support by default.
	OABI is rarely used in ARM EABI systems nowadays, so disable its support
	by default.  Add --enable-arm-oabi option to enable ARM OABI support.

	* configure.ac: New option --enable-arm-oabi.
	* syscall.c (get_scno) [ARM]: Check ENABLE_ARM_OABI macro defined by
	configure instead of undocumented STRACE_KNOWS_ONLY_EABI macro.

2014-03-12  Elliott Hughes  <enh@google.com>

	Fix stat decoding for LP64 bionic.
	Patch fb642bb6d63f7ffe2228bf48a6008bc8f56f67ff fixed building with
	HAVE_STAT64 for aarch64 with uapi kernel headers but not x86_64.
	The workaround needed to be applied to all LP64 architectures, not
	just aarch64.  This patch fixes that and adds an explanatory comment.

2014-03-11  Masatake YAMATO  <yamato@redhat.com>

	Decode protocol argument for PF_NETLINK sockets.
	* net.c (protocols): Rename to inet_protocols.
	[PF_NETLINK] (netlink_protocols): New xlat structure.
	(sys_socket): Rename protocols to inet_protocols.
	[PF_NETLINK]: Decode protocol argument using netlink_protocols.

	Acked-by: Mike Frysinger <vapier@gentoo.org>

2014-03-11  Dmitry V. Levin  <ldv@altlinux.org>

	Cleanup socketpair decoding.
	The only supported domain for socketpair syscall is AF_UNIX, so
	no decoding related to other domains is required for socketpair.

	* net.c (sys_socketpair): Remove support for PF_INET and PF_IPX domains,
	print the protocol argument as is.

2014-03-11  Dmitry V. Levin  <ldv@altlinux.org>

	printsiginfo: add SIGSYS decoding.
	* configure.ac (AC_CHECK_MEMBERS): Check for siginfo_t.si_syscall.
	* signal.c (SYS_SECCOMP): Define if not yet defined.
	(sigsys_codes): new xlat structure.
	(printsiginfo): Decode SIGSYS.

	Update siginfo codes.
	* signal.c (siginfo_codes): Add SI_DETHREAD.

	Factor out printing of si_pid and si_uid members of siginfo_t.
	* signal.c (printsigsource): New function.
	(printsiginfo): Use it.

2014-03-10  Elliott Hughes  <enh@google.com>

	Improve SI_TIMER decoding.
	Decode siginfo_t more clearly for si_code SI_TIMER.
	The 'pid' is actually a POSIX timer id, and the 'uid' is actually the
	overrun.
	Also factor out the si_value dumping so it's the same for every si_code.

2014-03-03  Elliott Hughes  <enh@google.com>

	aarch64: fix decoding of arm syscall numbers.
	If an aarch64 strace is tracing a process using the arm personality, it
	also needs to call the shuffle_scno function for the ARM-specific
	syscalls.

	* syscall.c (shuffle_scno): Define on AARCH64.
	(get_scno) [AARCH64]: Call shuffle_scno when the tracee is in 32-bit mode.

2014-03-03  Dmitry V. Levin  <ldv@altlinux.org>

	Fix fcntl decoding.
	Assume that F_SETLK64, F_SETLKW64, and F_GETLK64 are either defined or
	not defined altogether.
	Do not assume that sizeof(off_t) < sizeof(long long) when F_SETLK64 is
	undefined.

	This change fixes build with musl libc on x86.

	* configure.ac: Define SIZEOF_OFF_T.
	* desc.c (USE_PRINTFLOCK64): New macro.
	(struct flock64, printflock64): Do not define on X32.
	(printflock): Replace X32 specific workaround with SIZEOF_OFF_T check.
	Fix printing off_t members of struct flock.
	(sys_fcntl): Use USE_PRINTFLOCK64.

2014-03-01  Dmitry V. Levin  <ldv@altlinux.org>

	sys_fcntl: remove F_FREESP and F_FREESP64 support.
	F_FREESP and F_FREESP64 fcntl commands are not available in Linux
	and therefore the code implementing their decoding is useless.
	Besides that, F_FREESP64 decoding is too complicated to support.

	* desc.c (fcntlcmds): Remove F_FREESP and F_FREESP64.
	Remove F_FREESP64 from the check whether to define struct flock64.
	(sys_fcntl): Remove F_FREESP and F_FREESP64 support.

2014-02-28  Elliott Hughes  <enh@google.com>

	Add multi-personality support to struct old_sigaction decoding.
	struct sigaction is another structure that contains members
	whose size differs between 32-bit and 64-bit personalities.

	* signal.c [HAVE_SIGACTION] (old_sigaction32): New structure.
	[HAVE_SIGACTION] (decode_old_sigaction): Decode 32-bit struct
	old_sigaction on a 64-bit host.

2014-02-28  Elliott Hughes  <enh@google.com>

	Fix decoding of arm struct stat64 by aarch64 strace.
	aarch64's uapi header files have a struct stat but no struct stat64.
	To correctly decode a 32-bit process' s struct stat64 we need
	HAVE_STAT64, but then the build fails because there is no struct stat64.
	Luckily, the aarch64 struct stat is structurally equivalent to the arm
	struct stat64, so we can just reuse that.

	* file.c [AARCH64] (stat64): Define to stat.

2014-02-28  Dmitry V. Levin  <ldv@altlinux.org>

	Remove obsolete ioctlsort.c.
	The generic version of ioctlsort.c became obsolete after commit
	v4.6-240-g5afdf12 that removed its last non-Linux users.

	* ioctlsort.c: Remove.
	* Makefile.am (EXTRA_DIST): Remove ioctlsort.c.

	Reported-by: Elliott Hughes <enh@google.com>

2014-02-27  Dmitry V. Levin  <ldv@altlinux.org>

	Add multi-personality support to stack_t decoding.
	stack_t is one of many structures that contain members
	whose size differs between 32-bit and 64-bit personalities.

	* signal.c (print_stack_t): Decode 32-bit stack_t on a 64-bit host.

	Reported-by: Elliott Hughes <enh@google.com>

2014-02-27  Dmitry V. Levin  <ldv@altlinux.org>

	Rewrite signal mask decoding without sigset_t.
	The sigset_t provided by libc is not quite convenient.
	In glibc, sigset_t is an array with space for 1024 bits, which is much
	more than required: all architectures supported by Linux have only 64
	signals except MIPS, which has 128.
	In bionic libc, LP32 sigset_t is only 4 bytes long, which is less than
	necessary.

	With this change, signal mask is decoded without use of intermediate
	sigset_t structure, which saves us some cpu cycles in case of glibc with
	its inflated sigset_t, and enables build with libcs where sigset_t is
	broken.

	Old implementation used to check each signal number in the given signal
	mask twice using sigismember().
	New implementation is based on popcount and next_set_bit() so it's
	noticeably faster.

	* configure.ac: Check for __builtin_popcount.
	* signal.c: Ensure that NSIG >= 32.
	(sprintsigmask, sprintsigmask_long, printsigmask): Remove.
	(popcount32, sprintsigmask_n): New functions.
	(tprintsigmask_addr, sprintsigmask_val, tprintsigmask_val): New macros.
	(print_sigset_addr_len, sys_sigsetmask, sys_sigreturn, sys_siggetmask,
	sys_sigsuspend, sys_sigprocmask, decode_new_sigaction): Update to use
	new signal mask decoding interface.
	* tests/sigaction.c (main): Add a test with almost filled signal mask.
	* tests/sigaction.awk: Update.

2014-02-26  Dmitry V. Levin  <ldv@altlinux.org>

	Fix build with Bionic libc.
	Add generic tests for fopen64 and fputs_unlocked functions to fix build
	with Bionic libc that does not provide them.

	* configure.ac (AC_CHECK_FUNCS): Add fopen64 and fputs_unlocked.
	* strace.c [_LARGEFILE64_SOURCE]: Use fopen instead of fopen64
	if !HAVE_FOPEN64.
	Use fputs instead of fputs_unlocked if !HAVE_FPUTS_UNLOCKED.
	* vsprintf.c: Use fputs instead of fputs_unlocked
	if !HAVE_FPUTS_UNLOCKED.

	Reported-by: Elliott Hughes <enh@google.com>

2014-02-25  James Yang  <james.yang@freescale.com>

	powerpc64: fix 64-bit process detection on embedded.
	* syscall.c (get_scno) [POWERPC64]: Fix 64-bit process detection
	on embedded powerpc.

2014-02-25  Dmitry V. Levin  <ldv@altlinux.org>

	Do not compile scsi ioctl decoding if <scsi/sg.h> is not available.
	Add a generic test for <scsi/sg.h> availability to fix build with
	Bionic libc that does not provide <scsi/sg.h>.

	* configure.ac (AC_CHECK_HEADERS): Add scsi/sg.h.
	* ioctl.c (ioctl_decode): Do not call scsi_ioctl if !HAVE_SCSI_SG_H.
	* scsi.c: Do not compile scsi ioctl decoding if !HAVE_SCSI_SG_H.

	Reported-by: Elliott Hughes <enh@google.com>

2014-02-14  Dmitry V. Levin  <ldv@altlinux.org>

	Revert "Add support for Altera's Nios-II softcore architecture"
	The patch originally submitted by Ezequiel García was OK, but I somehow
	managed to mangle it so that most of the patch was not applied.

	According to Ezequiel García, an architecture port based on the generic
	syscall ABI is in progress.

	This reverts commit 61e426e87ac81be4b4ff9de581635b4ea585624f.

2014-02-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests: tighten sigaction check.
	* tests/sigaction.awk: Check that input conatins all expected lines.

2014-02-08  Dmitry V. Levin  <ldv@altlinux.org>

	Fix sigaction reporting on non-x86 architectures.
	If SA_RESTORER is not defined by libc headers but defined by kernel
	headers, use the definition provided by kernel headers for proper
	sigaction decoding.

	* signal.c [!SA_RESTORER]: Define to ASM_SA_RESTORER if the latter is
	defined, regardless of architecure.

2014-02-08  Dmitry V. Levin  <ldv@altlinux.org>

	Check for SA_RESTORER definition in <asm/signal.h>
	Kernel header <asm/signal.h> cannot be included from regular code
	because it conflicts with libc headers, but SA_RESTORER is needed in
	signal.c, so SA_RESTORER value is forwarded from <asm/signal.h> to
	config.h using a configure check.

	* configure.ac (ASM_SA_RESTORER): Define if SA_RESTORER is defined
	in <asm/signal.h>.

2014-02-07  Dmitry V. Levin  <ldv@altlinux.org>

	arm: fix compilation warning.
	Fix "dereferencing type-punned pointer will break strict-aliasing rules"
	warning introduced by commit v4.8-54-g670b21b.

	* signal.c (sys_sigreturn) [ARM]: Avoid dereferencing type-punned pointers.

2014-02-06  Dmitry V. Levin  <ldv@altlinux.org>

	kexec: fix typo.
	* kexec.c (print_kexec_segments) [SUPPORTED_PERSONALITIES == 1]: Fix typo.

2014-02-06  Ezequiel Garcia  <ezequiel@vanguardiasur.com.ar>

	Add support for Altera's Nios-II softcore architecture.
	This commit adds strace support for Altera's Nios-II official
	kernel port as found in git://git.rocketboards.org/linux-socfpga.git

	Notice that this an out-of-tree kernel architectural port, and uses the
	legacy (non-generic) system call ABI. In particular, the port doesn't
	support PTRACE_GETREGSET, so the implementation is based on PTRACE_GETREGS.

	Given it's mandatory for new architectures to support the generic
	syscall ABI and PTRACE_GETREGSET, if the nios2 architecure is ever
	mainlined, the strace support will have to be re-factored accordingly.

	* linux/nios2/ioctlent.h.in: New file.
	* linux/nios2/syscallent.h: Likewise.
	* Makefile.am (EXTRA_DIST): Add linux/nios2/ioctlent.h.in and
	linux/nios2/syscallent.h.
	* configure.ac: Add NIOS2 to the list of supported architectures.
	* defs.h [NIOS2]: Use register reading system.
	* process.c (struct_user_offsets): Add NIOS2 support.
	* syscall.c (get_regs, get_scno, get_syscall_args,
	get_syscall_result, get_error): Likewise.
	* util.c (change_syscall): Likewise.
	* mem.c (sys_getpagesize): Define on NIOS2.
	* system.c [NIOS2] (sys_cacheflush, sys_nios2cmpxchg): New functions.

	Acked-by: Mike Frysinger <vapier@gentoo.org>

2014-02-05  Dmitry V. Levin  <ldv@altlinux.org>

	Implement add_key, keyctl, and request_key decoding.
	* keyctl.c: New file.
	* linux/keyctl.h: Likewise.
	* Makefile.am (strace_SOURCES): Add keyctl.c.
	(EXTRA_DIST): Add linux/keyctl.h.
	* linux/dummy.h (sys_add_key, sys_keyctl, sys_request_key): Remove.
	* linux/syscall.h (sys_add_key, sys_keyctl, sys_request_key): New
	prototypes.

	Implement ioprio_get and ioprio_set decoding.
	* ioprio.c: New file.
	* Makefile.am (strace_SOURCES): Add ioprio.c.
	* linux/dummy.h (sys_ioprio_get, sys_ioprio_set): Remove.
	* linux/syscall.h (sys_ioprio_get, sys_ioprio_set): New prototypes.

	Implement finit_module decoding.
	* bjm.c (module_init_flags): New xlat structure.
	(sys_finit_module): New function.
	* linux/dummy.h (sys_finit_module): Remove.
	* linux/syscall.h (sys_finit_module): New prototype.

	Cleanup inotify syscalls decoding.
	* linux/inotify.h: New file.
	* file.c (inotify_modes, inotify_init_flags, sys_inotify_add_watch,
	sys_inotify_rm_watch, sys_inotify_init1): Move...
	* inotify.c: ... here.
	(inotify_modes): Rename to inotify_flags, convert to XLAT form.
	(inotify_init_flags): Convert to XLAT form.
	* Makefile.am (strace_SOURCES): Add inotify.c.
	(EXTRA_DIST): Add linux/inotify.h.

	Enhance reboot decoding.
	* linux/reboot.h: New file.
	* system.c (bootflags1, bootflags2, bootflags3, sys_reboot): Move...
	* reboot.c: ... here.
	(bootflags2, bootflags3): Update constants.
	* Makefile.am (strace_SOURCES): Add reboot.c.
	(EXTRA_DIST): Add linux/reboot.h.

	Implement kexec_load decoding.
	* kexec.c: New file.
	* linux/kexec.h: Likewise.
	* Makefile.am (strace_SOURCES): Add kexec.c.
	(EXTRA_DIST): Add linux/kexec.h.
	* linux/dummy.h (sys_kexec_load): Remove.
	* linux/syscall.h (sys_kexec_load): New prototype.

	Use prepared editions of recently imported linux headers.
	* linux/fanotify.h: Replace with edition prepared with headers_install.sh.
	* linux/personality.h: Likewise.

	Implement fanotify_init and fanotify_mark decoding.
	* fanotify.c: New file.
	* linux/fanotify.h: Likewise.
	* Makefile.am (strace_SOURCES): Add fanotify.c.
	(EXTRA_DIST): Add linux/fanotify.h.
	* defs.h (print_dirfd): New prototype.
	* file.c (print_dirfd): Export.
	* linux/dummy.h (sys_fanotify_init, sys_fanotify_mark): Remove.
	* linux/syscall.h (sys_fanotify_init, sys_fanotify_mark): New
	prototypes.
	* pathtrace.c (pathtrace_match): Handle sys_fanotify_init and
	sys_fanotify_mark.

	Use XLAT_END macro.
	Automatically update all xlat structures using the following sed regexp:
	s/^[[:space:]]*{[[:space:]]*0[[:space:]]*,[[:space:]]*NULL[[:space:]]*,\?[[:space:]]*}[[:space:]]*,\?[[:space:]]*/\tXLAT_END/

	Itroduce XLAT_END macro to make xlat structures more compact.
	* defs.h (XLAT_END): New macro.

	Convert personality_options to XLAT form.
	* linux/personality.h: New file.
	* Makefile.am (EXTRA_DIST): Add it.
	* system.c: Include <linux/personality.h>.
	(personality_options): Update PER_* constants, convert to XLAT form.

	Convert futexops to XLAT form.
	* process.c: Define FUTEX_*_PRIVATE macros.
	(futexops): Convert to XLAT form.

	Convert sigev_value to XLAT form.
	* time.c (sigev_value): Convert to XLAT form.
	(printsigevent32, printsigevent): Update use of sigev_value.

	Use XLAT macro.
	Automatically convert all xlat structures to XLAT form
	using the following sed regexp:
	s/^[[:space:]]*{[[:space:]]*\([^",}[:space:]]\+\)[[:space:]]*,[[:space:]]*"\1",\?[[:space:]]*}[[:space:]]*/\tXLAT(\1)/

2014-02-05  Dmitry V. Levin  <ldv@altlinux.org>

	Introduce XLAT macro to ease maintenance of xlat structures.
	* defs.h (XLAT): New macro.

	Suggested-by: Mike Frysinger <vapier@gentoo.org>

2014-02-04  Stefan Sørensen  <stefan.sorensen@spectralink.com>

	Decode ptp ioctls.
	* defs.h (ptp_ioctl): New prototype.
	* ioctl.c (ioctl_decode): Call ptp_ioctl when code is '='.
	* Makefile.am (strace_SOURCES): Add ptp.c.
	(EXTRA_DIST): Add linux/ptp_clock.h.
	* ptp.c: New file.
	* linux/ptp_clock.h: New file.

2014-02-03  Stefan Sørensen  <stefan.sorensen@spectralink.com>

	Decode dynamic posix clocks.
	* time.c (cpuclocknames): New xlat structure.
	(printclockname): New function that decodes posix clock names,
	including dynamic fd encoded clocks.
	(sys_clock_settime, sys_clock_gettime, sys_clock_nanosleep,
	sys_clock_adjtime, sys_timer_create, sys_timerfd, sys_timerfd_create):
	Use it.

	Update ADJ_* constants.
	* time.c (adjtimex_modes): Add ADJ_TAI, ADJ_SETOFFSET, ADJ_MICRO,
	ADJ_NANO, ADJ_OFFSET_SS_READ.

2014-02-02  Philippe Ombredanne  <pombredanne@nexb.com>

	Add decoding of sockets descriptor 'paths' for network calls.
	* net.c (sys_bind, sys_listen, do_accept, sys_send, sys_sendto,
	sys_sendmsg, sys_sendmmsg, sys_recv, sys_recvfrom, sys_recvmsg,
	sys_recvmmsg, sys_shutdown, sys_getsockopt, sys_setsockopt): Decode
	socket descriptor arguments using printfd.
	* pathtrace.c (pathtrace_match): Also check TRACE_NETWORK syscalls
	that take socket descriptor arguments.
	* tests/net-fd.test: New test for socket descriptor arguments decoding.
	* tests/Makefile.am (TESTS): Add net-fd.test.
	(net-fd.log): New dependency on net.log.

2014-02-02  Dmitry V. Levin  <ldv@altlinux.org>

	tests: rename all tests so that their names end in .test suffix.
	Due to automake limitations, some features work only for tests
	that end in one of the suffixes listed in TEST_EXTENSIONS.

	* tests/detach-running: Rename to detach-running.test.
	* tests/detach-sleeping: Rename to detach-sleeping.test.
	* tests/detach-stopped: Rename to detach-stopped.test.
	* tests/net: Rename to net.test.
	* tests/ptrace_setoptions: Rename to ptrace_setoptions.test.
	* tests/qual_syscall: Rename to qual_syscall.test.
	* tests/sigaction.sh: Rename to sigaction.test.
	* tests/stat: Rename to stat.test.
	* tests/strace-f: Rename to strace-f.test.
	* tests/Makefile.am (TESTS): Update.
	(LOG_COMPILER): Rename to TEST_LOG_COMPILER.

2014-01-31  Mike Frysinger  <vapier@gentoo.org>

	net: add more sockopt options.
	This syncs with the defines as available in linux-3.13.

	* net.c (sockipoptions): Add IP_IPSEC_POLICY, IP_XFRM_POLICY,
	IP_PASSSEC, IP_TRANSPARENT, IP_ORIGDSTADDR, IP_RECVORIGDSTADDR,
	IP_MINTTL, IP_NODEFRAG, IP_UNBLOCK_SOURCE, IP_BLOCK_SOURCE,
	IP_ADD_SOURCE_MEMBERSHIP, IP_DROP_SOURCE_MEMBERSHIP, MCAST_JOIN_GROUP,
	MCAST_BLOCK_SOURCE, MCAST_UNBLOCK_SOURCE, MCAST_LEAVE_GROUP,
	MCAST_JOIN_SOURCE_GROUP, MCAST_LEAVE_SOURCE_GROUP, IP_MULTICAST_ALL,
	IP_UNICAST_IF.

2014-01-08  Chris Dearman  <chris.dearman@imgtec.com>

	mips: fix sigaction reporting.
	MIPS userland uses the same sigaction structure with a full signal
	mask for old_sigaction and new_sigaction and does does not have
	an sa_restorer field.

	These changes have been tested on MIPS O32 big/little endian, MIPS N64
	big endian and x86-64.

	* signal.c (old_sigaction) [MIPS]: Add definition for MIPS.
	(decode_old_sigaction) [MIPS]: Print sa_mask according to its definition.
	(new_sigaction) [MIPS]: Add definition for MIPS.

2014-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	Factor out struct sigaction printing code.
	* signal.c [HAVE_SIGACTION] (decode_old_sigaction): New function.
	[HAVE_SIGACTION] (sys_sigaction): Use it.
	(decode_new_sigaction): New function.
	(sys_rt_sigaction): Use it.

2014-01-08  Dmitry V. Levin  <ldv@altlinux.org>

	tests: add a test for rt_sigaction output.
	Since "struct sigaction" varies between architectures, rt_sigaction
	decoding sometimes produces incorrect output.  This test is expected
	to catch basic rt_sigaction decoding bugs.

	Based on a patch proposed by Chris Dearman.

	* tests/sigaction.c: New file.
	* tests/sigaction.awk: Likewise.
	* tests/sigaction.sh: New test.
	* tests/Makefile.am (check_PROGRAMS): Add sigaction.
	(TESTS): Add sigaction.sh.
	(EXTRA_DIST): Add sigaction.awk.
	* tests/.gitignore: Add sigaction.

2014-01-05  Kirill A. Shutemov  <kirill.shutemov@linux.intel.com>

	mem: add missed MAP_HUGETLB mmap flag.
	* mem.c (mmap_flags): Add MAP_HUGETLB mmap flag.

	Acked-by: Mike Frysinger <vapier@gentoo.org>

2013-12-31  Mike Frysinger  <vapier@gentoo.org>

	Delete old PTRACE_{PEEK,POKE}USR logic.
	The code base has settled on PTRACE_{PEEK,POKE}USER (with an E) and has
	logic in defs.h to make sure it's set sanely.  Delete this old logic as
	the defs.h takes care of it now.

	* process.c: Delete PTRACE_PEEKUSR/PTRACE_POKEUSR defines.
	* signal.c: Likewise.
	* syscall.c: Delete PTRACE_PEEKUSR define.
	* util.c: Likewise.

2013-12-31  Mike Frysinger  <vapier@gentoo.org>

	Decode the O_PATH flag.
	* file.c (open_mode_flags): Add O_PATH.

2013-11-13  Dmitry V. Levin  <ldv@altlinux.org>

	Remove unused configure checks.
	* configure.ac (AC_CHECK_FUNCS): Remove _sys_siglist and sys_siglist.
	(AC_CHECK_DECLS): Likewise.

2013-11-13  Dmitry V. Levin  <ldv@altlinux.org>

	Assume that <sys/ptrace.h> provides a valid ptrace prototype.
	We used to explicitly list architectures where <sys/ptrace.h> from glibc
	is known to provide a valid prototype for ptrace, and use a homegrown
	replacement for all the rest.  Situation seems to be better nowadays,
	glibc is not the only libc available, so let's use ptrace prototype from
	<sys/ptrace.h> by default, leaving the replacement for rare broken cases
	if any.

	* defs.h: Use ptrace prototype workaround iff
	NEED_PTRACE_PROTOTYPE_WORKAROUND is defined.

2013-11-12  Dmitry V. Levin  <ldv@altlinux.org>

	Stop using _LFS64_LARGEFILE.
	There is only one place left in the code where strace guesses whether
	libc provides LFS64 functions and structures.  The most natural thing to
	do there is to check for _LARGEFILE64_SOURCE - the macro provided by
	glibc.  Other libc implementations that provide nondegenerate LFS64
	interfaces are expected to define this macro as well.

	* defs.h (_LFS64_LARGEFILE): Remove.
	* strace.c: Use _LARGEFILE64_SOURCE instead of _LFS64_LARGEFILE.

2013-11-12  Dmitry V. Levin  <ldv@altlinux.org>

	Define truncate64, ftruncate64, and getdents64 decoders unconditionally.
	These decoders are referenced by most architectures, there were no
	undefined references so far because _LFS64_LARGEFILE appears to be
	always defined by glibc when _GNU_SOURCE is defined.

	* file.c (sys_truncate64, sys_ftruncate64, sys_getdents64): Define
	unconditionally.

2013-11-12  Dmitry V. Levin  <ldv@altlinux.org>

	Define printflock64 only if it is referenced by other code.
	* configure.ac (AC_CHECK_TYPES): Add struct flock64.
	* desc.c (HAVE_F_SETLK64, HAVE_F_SETLKW64, HAVE_F_GETLK64): New macros.
	[!HAVE_STRUCT_FLOCK64] (struct flock64): Define.
	(printflock64): Define only if referenced by other code.
	(sys_fcntl): Handle F_FREESP64, F_SETLK64, F_SETLKW64, and F_GETLK64 iff
	these constants are defined and differ from their non-64bit versions.

2013-11-12  Dmitry V. Levin  <ldv@altlinux.org>

	Make PTRACE_PEEKUSER/PTRACE_POKEUSER checks less glibc specific.
	* configure.ac (AC_CHECK_DECLS): Add PTRACE_PEEKUSER and
	PTRACE_POKEUSER.
	* defs.h: Define PTRACE_PEEKUSER and PTRACE_POKEUSER only if
	they are not provided by <sys/ptrace.h>.

	Reported by John Spencer.

2013-11-12  Dmitry V. Levin  <ldv@altlinux.org>

	Remove unneeded redefinitions of IPPROTO_* macros.
	IPPROTO_* macros are defined by <netinet/in.h>, no need to redefine
	them.

	* net.c (IPPROTO_EGP, IPPROTO_PUP, IPPROTO_IDP, IPPROTO_IGMP,
	IPPROTO_RAW, IPPROTO_MAX): Remove.

	Reported by John Spencer.

2013-11-12  Dmitry V. Levin  <ldv@altlinux.org>

	Remove unused AC_OFF_T_IS_LONG_LONG configure check.
	* configure.ac: Remove AC_OFF_T_IS_LONG_LONG.
	* m4/long_long.m4: Likewise.

	Remove unused code.
	* configure.ac (AC_CHECK_TYPES): Remove struct opthdr and
	struct t_opthdr.
	* net.c (print_sock_optmgmt): Remove.

2013-11-12  Dmitry V. Levin  <ldv@altlinux.org>

	Use struct sigcontext instead of struct sigcontext_struct.
	* configure.ac (AC_CHECK_TYPES): Remove struct sigcontext_struct.
	* signal.c (sys_sigreturn) [S390 || S390X || POWERPC || ALPHA): Replace
	struct sigcontext_struct with struct sigcontext.

	Reported by John Spencer.

2013-11-12  Dmitry V. Levin  <ldv@altlinux.org>

	Use standard names of sched_param structure members.
	* process.c (sys_sched_setscheduler, sys_sched_getparam,
	sys_sched_setparam): Use portable struct sched_param member name
	sched_priority instead of glibc specific __sched_priority.

	Reported by John Spencer.

2013-11-12  Dmitry V. Levin  <ldv@altlinux.org>

	Make SIGEV_THREAD_ID decoding less glibc specific.
	SIGEV_THREAD_ID decoding requires access to an internal member of
	struct sigevent.  There seems to be no portable way to do it besides
	adding a configure check.

	* configure.ac (AC_CHECK_MEMBERS): Check for
	struct sigevent._sigev_un._pad and struct sigevent.__pad.
	* time.c (printsigevent): Use an appropriate struct sigevent member
	to print thread id.

	Reported by John Spencer.

2013-11-11  Dmitry V. Levin  <ldv@altlinux.org>

	Remove unused configure checks.
	* configure.ac (AC_CHECK_MEMBERS): Remove T_conn_res.QUEUE_ptr,
	T_conn_res.ACCEPTOR_id, dqblk.dqb_curblocks, sigcontext.sc_hi2.

2013-11-11  Dmitry V. Levin  <ldv@altlinux.org>

	Assume "long long" availability.
	Most of the code already uses long long types unconditionally.

	* configure.ac: Remove the check for long long.
	* file.c (printstat64): Remove HAVE_LONG_LONG checks, use %llu format
	string unconditionally.

2013-11-11  Dmitry V. Levin  <ldv@altlinux.org>

	Include <sys/poll.h> only if there is no <poll.h>
	* pathtrace.c: Do not include <sys/poll.h> if <poll.h> is available.
	* stream.c: Likewise.

	Move io_* syscalls decoding to a separate file.
	* desc.c (sys_io_setup, sys_io_destroy, sys_io_submit, sys_io_cancel,
	sys_io_getevents, declarations from libaio.h): Move to ...
	* aio.c: new file.
	* Makefile.am (strace_SOURCES): Add aio.c.

2013-11-11  Denys Vlasenko  <dvlasenk@redhat.com>

	Stop using external libaio.h.
	This change incorporates a partial copy instead
	of using external libaio.h.
	Why?
	Because we want to properly decode 32-bit aio calls
	by 64-bit strace. For that, we need more definitions than
	libaio.h provides.
	(These defs are not done yet, but will eventually be done).
	Keeping our local 32-bit compat defs in sync with libaio.h
	_without seeing libaio structs_ is hard/more bug prone.
	A smaller benefit is that we don't need libaio installed.

2013-11-11  Denys Vlasenko  <dvlasenk@redhat.com>

	sys_io_submit: simplify iocb_cmd_lookup() helper.
	This helper returns two values (a string and an enum).
	The caller prints the string. It's simpler to just print
	the string in the caller itself. This eliminates
	"return by reference" and more importantly, an intermediate
	static string buffer for the string result.

	Since function of the helper is different now,
	it is renamed to tprint_lio_opcode().

2013-11-11  Denys Vlasenko  <dvlasenk@redhat.com>

	sys_io_submit: stop traversing iocb vector after first failure.
	The program may use a very large nr but supply either outright
	invalid iocbpp[], or one with far fewer elements than nr.
	We used to try reading iocbpp[i] until i == nr.
	With this change, we stop on the first failure.

2013-11-09  Denys Vlasenko  <dvlasenk@redhat.com>

	Fix pathtrace_match() to match recent fixes to select decoding.

	Fix select decoding on e.g. 32-bit ppc process by 64-bit strace.
	Added next_set_bit() function which finds the next set bit,
	properly taking into account word size of the traced process.
	Use it in decode_select() instead of fd_isset().
	Also, properly round fdsize up to word size of traced process,
	not to strace's word size.

2013-11-06  Denys Vlasenko  <dvlasenk@redhat.com>

	Speed up and explain fd_isset()

2013-11-05  Dr. David Alan Gilbert  <dave@treblig.org>

	Add a test for the latest select decoding fix.
	* test/select.c (main): Add a test for nfds larger than FD_SETSIZE.

2013-11-05  Dmitry V. Levin  <ldv@altlinux.org>

	Fix select decoding for glibc in _FORTIFY_SOURCE mode.
	glibc in _FORTIFY_SOURCE mode raises SIGABRT when descriptor greater
	or equal to FD_SETSIZE is passed to FD_ISSET.  Select family syscalls,
	however, can legitimately accept such descriptors.  To overcome this
	limitation, we have to replace FD_ISSET with an equivalent that imposes
	no such restrictions.

	* desc.c (fd_isset): New function.
	(decode_select): Use it instead of FD_ISSET.

2013-11-05  Dmitry V. Levin  <ldv@altlinux.org>

	More select decoding fixes.
	* desc.c (decode_select): Actually print arg[0] as int on entering
	syscall.  When arg[0] is negative, do not attempt to fetch and decode
	descriptor sets on entering syscall, kernel will reject it anyway.
	On exiting syscall, stop checking descriptor sets as soon as all
	returned descriptors are found.

2013-11-05  Denys Vlasenko  <dvlasenk@redhat.com>

	Truncate arg[0] to int in select decoding.
	This matches kernel's behavior.

	test/select.c: make comment more understandable.

2013-11-05  Dr. David Alan Gilbert  <dave@treblig.org>

	Fix select decoding with bogus (huge or negative) nfds.
	We used to allocate and fetch bit arrays using a sanitized
	length, but then iterate over them with "j < arg[0]" condition,
	where arg[0] is not sanitized. This segfaults if arg[0] is huge
	or negative. This change fixes this.

	Add test/select.c to capture the case.

2013-09-26  Ali Polatel  <alip@exherbo.org>

	Work around conflict between <sys/ptrace.h> and <linux/ptrace.h>
	Since glibc-2.18~39 <sys/ptrace.h> defines ptrace_peeksiginfo_args
	which collides with <linux/ptrace.h>.

	* configure.ac: Check for `struct ptrace_peeksiginfo_args' in
	<sys/ptrace.h>.
	* process.c: Work around potential conflict between <sys/ptrace.h>
	and <linux/ptrace.h> by redefining ptrace_peeksiginfo_args.
	* signal.c: Likewise.
	* syscall.c: Likewise.
	* util.c: Likewise.

2013-09-11  Vineet Gupta  <Vineet.Gupta1@synopsys.com>

	Add support for ARC Cores from Synopsys.
	Take #2 on mainlining strace support for ARC (last one was 4.6 based back
	in March 2011), see
	http://sourceforge.net/p/strace/mailman/message/27210168/

	The syscall ABI is asm-generic/unistd.h based (so no legacy syscalls),
	hence very similar to metag port.

	test/* all seem to work well.

	* linux/arc/ioctlent.h.in: New file.
	* linux/arc/syscallent.h: Likewise.
	* Makefile.am (EXTRA_DIST): Add linux/arc/ioctlent.h.in and
	linux/arc/syscallent.h.
	* configure.ac: Add ARC to the list of supported architectures.
	* defs.h: Add ARC support.
	* process.c (struct_user_offsets): Likewise.
	* signal.c (sys_sigreturn): Likewise.
	* syscall.c (print_pc, get_regset, get_regs, get_scno, get_syscall_args,
	get_syscall_result, get_error): Likewise.
	* util.c (change_syscall): Likewise.

	Acked-by: Mike Frysinger <vapier@gentoo.org>

2013-09-11  William Manley  <william.manley@youview.com>

	Add support for decoding sync_file_range.
	* file.c (sync_file_range_flags): New xlat structure.
	(sys_sync_file_range, sys_sync_file_range2): New functions.
	* linux/syscall.h (sys_sync_file_range, sys_sync_file_range2): New
	prototypes.
	* linux/dummy.h (sys_sync_file_range, sys_sync_file_range2): Remove.
	* linux/mips/syscallent-o32.h: Set the number of sync_file_range
	arguments to 7.

2013-09-11  Mike Frysinger  <vapier@gentoo.org>

	fanotify_mark: fix number of args for 32bit arches.
	The fanotify_mark func takes a 64bit mask, so 32bit arches have to split
	it up into two fields.  When the syscall was added, it was listed as only
	having 5 fields total (since that's correct for 64bit systems).

	* linux/arm/syscallent.h: Set the number of fanotify_mark arguments to 6.
	* linux/bfin/syscallent.h: Likewise.
	* linux/hppa/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/metag/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/or1k/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/tile/syscallent1.h: Likewise.

	Acked-by: Chris Metcalf <cmetcalf@tilera.com> [for tile]

2013-09-11  Dmitry V. Levin  <ldv@altlinux.org>

	x86, x86_64: fix compilation warnings.
	Fix "dereferencing type-punned pointer will break strict-aliasing rules"
	warnings introduced by commit v4.8-52-gb51f364.

	* signal.c (sys_sigreturn): Avoid dereferencing type-punned pointers.

2013-07-18  Denys Vlasenko  <dvlasenk@redhat.com>

	Remove rt parameter from [s]printsigmask()
	In almost all cases, the parameter was 1 ("decode RT sigs too").
	This change hardwires it to be 1.

	The cases where it was 0 are, and why the change to "decode RT sigs too"
	is fine:

	IA64: 64-bit arch, all 64 signals fit in one word in any case.
	S390[x]: sc.oldmask is a sigset_t on kernel side,
		(sigset_t *)&sc.oldmask[0] does contain all 64 signals.
	TILE: uc.uc_sigmask is a sigset_t on kernel side,
		memcpy(&sigm, &uc.uc_sigmask, NSIG / 8) copies all 64 signals.

2013-07-18  Denys Vlasenko  <dvlasenk@redhat.com>

	Convert some uses of long_to_sigmask+printsigmask to sprintsigmask_long.
	This allows to drop long_to_sigmask function,
	and a whole bunch of sigset_t variables.

	Simplify some sigmask manipulations.

	Add compat support for sys_pselect6.

	I386: fix signedness mismatch warning.
	&i386_regs.esp is a pointer to long, not unsigned long.
	It needs a cast.

2013-07-18  Denys Vlasenko  <dvlasenk@redhat.com>

	Fix sigset printing via print_sigset().
	Replace print_sigset() with print_sigset_addr_len(),
	which takes not only addr, but also len parameter.
	This allows us to drop "do we need to print RT signals?" parameter,
	and this fixes RT signals printing in many syscalls.

	sys_epoll_pwait: print RT signals too, print sigmask size argument.

	sys_sigprocmask: print_sigset -> print_sigset_addr_len(current_wordsize),
	no change in functionality.

	sys_sigpending: use print_sigset_addr_len(current_wordsize)
	instead of open-coding it.

	sys_rt_sigprocmask: use print_sigset_addr_len instead of open-coding it.
	sys_rt_sigpending: ditto.
	sys_rt_sigsuspend: ditto.
	sys_rt_sigtimedwait: ditto.

	do_signalfd: print_sigset -> print_sigset_addr_len. This fixes
	RT signals printing (wasn't showing them before).

	sys_ppoll: ditto.

	copy_sigset_len() is folded into its only user, print_sigset_addr_len(),
	and copy_sigset() is gone.

	While at it, checked kernel sources and noted where kernel enforces
	sigset_size == NSIG / 8 (== sizeof(kernel_sigset_t)),
	and where it allows word-sized sigset_size ([rt_]sigpending).

2013-07-18  Denys Vlasenko  <dvlasenk@redhat.com>

	sys_rt_sigaction: fix sigset copying.
	In practice, we always copy as many bytes as syscall param says
	(8, or 16 on mips). However, malicious program can call sigaction
	with wrong sigset size. Such syscall will result in EINVAL,
	but we (strace) end up copying 128 bytes (sizeof(sigset_t)),
	which copyes some garbage from stack after struct sigaction.

	Now we always copy NSIG / 8 bytes (which is 8 bytes, or 16 on mips).

2013-07-18  Denys Vlasenko  <dvlasenk@redhat.com>

	ARM: remove wrong NSIG = 32 define.
	ARM in fact has 64 signals (1..64), and NSIG should be 65
	(as usual, rememebr that NSIG_libc == NSIG_kernel+1).

	I carefully reviewed all usages of NSIG. In syscall.c,
	the only usage is:
	        for (i = 0; i <= NSIG; i++)
	                if (strcasecmp(s, signame(i) + 3) == 0)...
	which is safe even if NSIG is way too big - signame(i)
	returns a well-formed string for any i.

	In signal.c, memcpy(&sigset, &sc.sc_mask, NSIG / 8) is used by
	IA64 and TILE code, so ARM change can't affect it. And final
	usage is:
	 struct new_sigaction::unsigned long sa_mask[NSIG / sizeof(long)];
	It will grow on ARM (and become correct in the process).
	Its only use is
	 memcpy(&sigset, &sa.sa_mask, NSIG / 8);
	 printsigmask(&sigset, 1);
	which used to copy garbage in high bits, now it will copy actual data.

2013-07-17  Denys Vlasenko  <dvlasenk@redhat.com>

	ARM: fix sigreturn decoding.
	Decoding of test/sigreturn testcase:
	Was:
	sigreturn() (mask [QUIT TRAP ABRT BUS SEGV USR2 PIPE STKFLT STOP XCPU VTALRM PROF WINCH IO PWR RTMIN]) = 0
	Now:
	sigreturn() (mask [CHLD RT_1 RT_3 RT_31 RT_32]) = 0

2013-07-16  Denys Vlasenko  <dvlasenk@redhat.com>

	Group USE_CUSTOM_PRINTF define with other tweakables.
	No code changes.

2013-07-16  Denys Vlasenko  <dvlasenk@redhat.com>

	Improve sigreturn decoding on x86 to show RT signal bits too.
	This includes decoding of 32-bit sigreturn by 64-bit strace,
	which previously wasn't done.

	Added a test for it.

2013-07-12  Anton Blanchard  <anton@samba.org>

	powerpc: enhance 32/64bit detection.
	We were using uname to determine if userspace was 32 or 64bit.
	This fails when we have a 64bit kernel and a 32bit userspace.

	* configure.ac (powerpc*): Similar to x86, use a runtime test
	to determine if we are 32 or 64bit.

2013-07-12  Anton Blanchard  <anton@samba.org>

	powerpc: fix some compiler warnings.
	Fix a number of differing signedness warnings when building on
	powerpc.

	powerpc: fix iflag build issue (static -> extern)

2013-07-10  Denys Vlasenko  <dvlasenk@redhat.com>

	PTRACE_SEIZE can set ptrace options immediately, use this feature.
	This eliminates some rare bugs, such as post-execve SIGTRAP
	generation when we attach to a process, and it manages to finish
	execve'ing before we set TRACEEXEC option to suppress that.

2013-07-08  Denys Vlasenko  <dvlasenk@redhat.com>

	If -o|logger is in use, exit trace loop if nprocs == 0.

	Exit trace loop if got ECHILD, not if nprocs == 0.
	Comment gives a testcase which wasn't handled correctly
	by the old code.

2013-07-07  Denys Vlasenko  <dvlasenk@redhat.com>

	s390[x]: get rid of syscall_mode, delete code which never triggers.
	Before this change, the logic was as follows:
	syscall entry:
	  get_scno:
	    syscall_mode = GPR2
	    scno = syscall_mode unless syscall_mode == -ENOSYS
	    (if -ENOSYS, scn is retrieved by decoding current insn)
	  fixup:
	    gpr2 = GPR2
	    syscall_mode = scno unless syscall_mode == -ENOSYS
	    if (gpr2 != syscall_mode) stray_entry
	syscall exit:
	  get_res:
	    gpr2 = GRP2
	  fixup:
	    syscall_mode = scno unless syscall_mode == -ENOSYS
	    if (WAITEXECVE && gpr2 in (-ENOSYS, scno)) gpr2 = 0;
	  get_error:
	    gpr2 is retval

	Entry fixup's if() can never trigger:
	regardless whether GPR2 is -ENOSYS or not, syscall_mode is always
	equal to GRP2 value there. So it can be removed.

	On sysexit path, syscall mode is never used.

	Therefore, syscall_mode variable is deleted. grp2 is read from
	GPR2 register in get_scno, redundant read in entry fixup is removed.
	As a result, entry fixup's s390 code block vanishes completely.

	gpr2 variable is renamed s390_gpr2 to match the convention used
	by other arches.

2013-07-04  Denys Vlasenko  <dvlasenk@redhat.com>

	ARM: add STRACE_KNOWS_ONLY_EABI define which can be used to omit OABI support

	Add paranoia check before passing a long to pid2tcb(int pid)

2013-07-02  Denys Vlasenko  <dvlasenk@redhat.com>

	In debug output, show waitpid status with 6 hex digits, not 4.
	This shows event byte values better (without variable offset):

	 [wait(0x01057f) = 29491] WIFSTOPPED,sig=SIGTRAP,EVENT_FORK (1)
	 [wait(0x80057f) = 29492] WIFSTOPPED,sig=SIGTRAP,EVENT_STOP (128)
	         ^^

2013-07-02  Denys Vlasenko  <dvlasenk@redhat.com>

	Replace suspicious popen_pid assignment with an obviously correct one.
	popen_pid = vfork() does work correctly, but for a subtle reason
	that wrong assignment of 0 happens in the child _first_,
	and _then_ correct value overwrites it in the parent.

	(And in a hyphothetical system where vfork = fork,
	popen_pid wouldn't be shared, so it will also be ok.)

	However, it's not necessary to be difficult.
	This change makes it so that assignment is done only in parent.

2013-07-01  Denys Vlasenko  <dvlasenk@redhat.com>

	Convert trace() from returning int to returning void.
	The cleanup sequence in error cases, and on normal code path
	was nearly the same, no point in duplicating it.

	Remove ia64-specific printing of current address on signal delivery.
	The address is printed anyway by printleader() if -i is active.

	Rename ia32 to ia64_ia32mode, and make it bool, not long.
	Grepping for just ia32 was turning up many false positives.

2013-06-30  Denys Vlasenko  <dvlasenk@redhat.com>

	Fold is_restart_error() into its sole user.

2013-06-29  Denys Vlasenko  <dvlasenk@redhat.com>

	Update qemu_multiarch_testing/README.

2013-06-28  Denys Vlasenko  <dvlasenk@redhat.com>

	sys_clone: add a comment about CLONE_PTRACE and CLONE_UNTRACED.
	No code changes.

	POWERPC: get rid of "static long ppc_result"

	POWERPC: read ppc_regs.nip if -i.

	POWERPC: if GETREGS fails with EIO, don't try it again.

	Get rid of powerpc_getreg(), it's a copy of upeek()

	Change upeek() to take pid, not full tcp.
	This will be used by next change.

2013-06-26  Anton Blanchard  <anton@samba.org>

	powerpc: Provide a fallback for old kernels without PTRACE_GETREGS.
	PTRACE_GETREGS was added to the ppc kernel in 2.6.23. In order to
	provide backward compatibility for very old kernels, add a manual
	fallback.

	* syscall.c (powerpc_getreg, powerpc_getregs_old): New functions.
	(get_regs): Call powerpc_getregs_old if PTRACE_GETREGS is not supported.

2013-06-26  Anton Blanchard  <anton@samba.org>

	powerpc: Use PTRACE_GETREGS to fetch all registers.
	* defs.h: declare ppc_regs and get_regs_error.
	* signal.c (sys_sigreturn): Use ppc_regs instead of upeek.
	* syscall.c: define ppc_regs.
	(printcall): Use ppc_regs instead of upeek.
	(get_scno): Replace multiple upeek calls with one PTRACE_GETREGS call.
	(get_syscall_result): Likewise.

2013-06-26  Denys Vlasenko  <dvlasenk@redhat.com>

	Another manpage tweak.

	Manpage update.

	Update build_static_example.sh.
	Now it also contains a tested example of i686 build on 64-bit host.

	In -f mode, do not assume that new pid is stopped - handle exits too.

2013-06-26  Denys Vlasenko  <dvlasenk@redhat.com>

	Set strace_child only in the right branch.
	"strace_child = pid" assignment was racing in NOMMU case
	because of vfork (no way to know which process would win).

	After this change, strace_child is set to nonzero only
	in one process after [v]fork.

2013-06-26  Denys Vlasenko  <dvlasenk@redhat.com>

	Get rid of TCB_INUSE and TCB_STRACE_CHILD.
	We can use tcb::pid == 0 as an indicator of free tcb,
	and we already have strace_child variable which holds
	pid of our child, if any.

2013-06-21  Denys Vlasenko  <dvlasenk@redhat.com>

	Fix debug output of wait4 result (was reusing buf[] on unknown events)

	Show PTRACE_EVENT_STOP correctly in debug output.

2013-06-21  Denys Vlasenko  <dvlasenk@redhat.com>

	Panic a bit less when we see an unknown pid.
	I stumbeld over this case when I used "exec stace ...".

	* strace.c (trace): Do not exit if we see an unknown pid in wait4.

2013-06-21  Denys Vlasenko  <dvlasenk@redhat.com>

	detach(): Reorganize code. Logic is the same.
	* strace.c (detach): Use goto's instead of excessive nesting.
	Drop sigstop_expected and interrupt_done variables.

	Eat pending SIGSTOP _before_ PTRACE_DETACH in detach()
	* strace.c (detach): If TCB_IGNORE_ONE_SIGSTOP is set,
	di not PTRACE_DETACH - wait for SIGSTOP first.

2013-06-20  Denys Vlasenko  <dvlasenk@redhat.com>

	detach(): warn if we see ECHILD from waitpid.
	* strace.c (detach): Warn if we see ECHILD from waitpid.
	Explain in comments that we don't normally expect !WIFSTOPPED
	either, and also that PTRACE_CONT failure isn't expected
	(the "break" there is a "I'm confused, bailing out" code style)..

	Improve error messages in detach()
	* strace.c (detach): Change return type from int to void.
	Improve error meesages: show PID, tell exactly which operation fails.

2013-06-20  Denys Vlasenko  <dvlasenk@redhat.com>

	Remove workarounds for ancient kernels lacking __WALL.
	__WALL is available and working at least since 2.4 kernels: 10 years ago.

	* strace (detach): Remove workarounds for ancient kernels lacking __WALL.
	Add missing EINTR check.
	(trace): Remove workarounds for ancient kernels lacking __WALL.
	Remove redundant double error printout.

2013-06-20  Denys Vlasenko  <dvlasenk@redhat.com>

	USE_SEIZE: fix detaching from stopped processes.
	V3: split SEIZE/!SEIZE code paths to reduce confusion.
	Extensively comment every possible case.
	Verified that all tests/detach* tests work in both SEIZE and !SEIZE
	cases.

	* strace.c (detach): If PTRACE_SEIZE API is in use, stop the tracee
	using PTRACE_INTERRUPT instead of sending it a SIGSTOP.
	In a subsequent waitpid loop, correctly wait and suppress SIGSTOP
	on detach if PTRACE_INTERRUPT wasn't used, or wait for any ptrace
	stop and detach without suppressing signals.

2013-06-19  Dmitry V. Levin  <ldv@altlinux.org>

	tests: disable /proc based checks when /proc is not mounted.
	* tests/detach-running: Disable /proc based checks when
	/proc/self/status is not available.
	* tests/detach-sleeping: Likewise.
	* tests/detach-stopped: Likewise.

2013-06-19  Denys Vlasenko  <dvlasenk@redhat.com>

	tests/detach-{running,sleeping,stopped}: check post-detach state.
	Check that traced process still exists and is in a right state
	after strace detached from it.

2013-06-19  Dmitry V. Levin  <ldv@altlinux.org>

	tests: ensure that strace can detach from running processes.
	* tests/detach-running: New test.
	* tests/Makefile.am (TESTS): Add it.

	tests: ensure that strace does not leave sleeping processes stopped.
	* tests/detach-sleeping: Do not send SIGCONT to the sleeping process.

2013-06-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: fix parallel-tests support in detach-* tests.
	* tests/detach-sleeping: Use $LOG file for set_ptracer_any output.
	* tests/detach-stopped: Likewise.

	tests: parametrize "sleep 1"
	* tests/init.sh (SLEEP_A_BIT): New variable.
	* tests/detach-sleeping: Use it.
	* tests/detach-stopped: Likewise.

	tests: ensure that strace can detach from sleeping and stopped processes
	* tests/set_ptracer_any.c: New file.
	* tests/detach-sleeping: New test.
	* tests/detach-stopped: Likewise.
	* tests/Makefile.am (check_PROGRAMS): Add set_ptracer_any.
	(TESTS): Add detach-sleeping and detach-stopped.
	* tests/.gitignore: Add set_ptracer_any.

2013-06-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: enhance timeout checks.
	Run each test using a wrapper that does all necessary timeout checks.

	* tests/run.sh: New file.
	* tests/Makefile.am (EXTRA_DIST, LOG_COMPILER): Add it.
	* tests/init.sh (check_strace, check_timeout): Remove.
	* tests/detach-stopped: Update callers.
	* tests/net: Likewise.
	* tests/ptrace_setoptions: Likewise.
	* tests/qual_syscall: Likewise.
	* tests/stat: Likewise.
	* tests/strace-f: Likewise.

2013-06-18  Dmitry V. Levin  <ldv@altlinux.org>

	tests: enable parallel-tests support.
	* configure.ac (AM_INIT_AUTOMAKE): Add parallel-tests.

	tests: prepare for parallel-tests support.
	* tests/Makefile.am (CLEANFILES): Calculate dynamically from TESTS.
	* tests/init.sh (LOG): New variable.
	* tests/detach-stopped: Use it.
	* tests/net: Likewise.
	* tests/qual_syscall: Likewise.
	* tests/stat: Likewise.
	* tests/strace-f: Likewise.

2013-06-18  Denys Vlasenko  <dvlasenk@redhat.com>

	Cleanups. No logic changes.
	* defs.h: Define new ptrace constants unconditionally.
	* strace.c (detach): Fix comment.
	(trace): Remove now unnecessary "if USE_SEIZE".

2013-06-05  Dmitry V. Levin  <ldv@altlinux.org>

	maint: post-release administrivia.
	* NEWS: Add header line for next release.

2013-06-03  Dmitry V. Levin  <ldv@altlinux.org>

	ioctlent: add UAPI support.
	* Makefile.am (IOCTLSORT_INCLUDEDIR): Define.
	(ioctlsort): Use it.
	* linux/ioctlent.sh (lookup_ioctls): Look into uapi directory tree.
	Strip "uapi/" prefix from output path names.
	* linux/ioctlent.h.in: Regenerate from v3.9 headers.
	* NEWS: Mention it.

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

2013-06-02  Dmitry V. Levin  <ldv@altlinux.org>

	Fix "make dist" on recently added architectures.
	* Makefile.am (EXTRA_DIST): Add linux/aarch64/errnoent1.h,
	linux/aarch64/ioctlent.h.in, linux/aarch64/ioctlent1.h,
	linux/aarch64/signalent1.h, linux/aarch64/syscallent.h,
	linux/aarch64/syscallent1.h, linux/metag/ioctlent.h.in,
	linux/metag/syscallent.h, linux/or1k/ioctlent.h.in,
	linux/or1k/syscallent.h, linux/tile/errnoent1.h, linux/tile/ioctlent1.h,
	linux/tile/signalent1.h, linux/tile/syscallent1.h, linux/ubi-user.h,
	linux/xtensa/ioctlent.h.in, and linux/xtensa/syscallent.h.

	Fix "make dist" regression introduced by commit v4.7-184-gd648f29.
	* Makefile.am (EXTRA_DIST): Add linux/ubi-user.h.

2013-05-28  Dmitry V. Levin  <ldv@altlinux.org>

	Do not suppress signal delivery messages with -qq.
	Current implementation of -qq does not allow suppressing exit status
	messages without suppressing signal delivery messages, which is not
	good.  There is a traditional "-e signal=none" syntax that can be used
	to suppress all signal delivery messages.
	This partially reverts commit v4.7-222-g01997cf.

	* strace.c (trace): Do not suppress signal delivery messages with -qq.
	* strace.1: Update documentation about -qq option.

2013-05-23  Chris Metcalf  <cmetcalf@tilera.com>

	tile: use siginfo_t, not struct siginfo.
	As of glibc 2.16, "struct siginfo" is no longer supported,
	and "siginfo_t" must be used instead.

	tile: remove MAP_CACHE_xxx support in mem.c.
	These flags support functionality in mmap() that has not been
	pushed back to the community, and which may or may not eventually
	end up being the final community model.  In the interim, having
	these flags unconditionally present for "#ifdef TILE" just means
	that the TILE build breaks if using the community versions of
	the kernel and glibc, so just revert the code until such time
	as it may end up in the community.

2013-05-17  Mike Frysinger  <vapier@gentoo.org>

	Rename COPYRIGHT to COPYING.
	The standard name people have adopted is "COPYING" rather than
	"COPYRIGHT".  Use that as a lot of license scanning tools look for it.

	* COPYRIGHT: Rename to ...
	* COPYING: ... this.
	* Makefile.am (EXTRA_DIST): Rename COPYRIGHT to COPYING.
	* README: Likewise.
	* strace.spec (%files): Likewise.

2013-05-17  Dmitry V. Levin  <ldv@altlinux.org>

	Sync strace.spec and debian/ with packages.
	* debian/changelog: Sync with 4.7-1.
	* debian/strace.docs: Likewise.
	* strace.spec: Sync with 4.7-3.

	Update PTRACE_O_* constants.
	* process.c (ptrace_setoptions_flags): Sync with Linux 3.9.

	Update AF_*, PF_*, MSG_*, and TCP_* constants.
	* net.c (domains, addrfams, protocols, socktcpoptions): Sync with
	Linux 3.9.

2013-05-14  Dmitry V. Levin  <ldv@altlinux.org>

	NOMMU: do not hide startup syscalls unless in -D mode.
	On NOMMU systems in "strace PROG" case, we have no way to attach to
	the tracee before it calls execve unless in -D mode.  That is, the
	first execve call is very likely to be missed, and setting
	hide_log_until_execve just results to empty log.

	* strace.c (init) [NOMMU_SYSTEM]: Do not set hide_log_until_execve
	unless in -D mode.

2013-05-14  Dmitry V. Levin  <ldv@altlinux.org>

	Make -D mode work when the Yama LSM is enabled.
	* strace.c [HAVE_PRCTL]: Include sys/prctl.h.
	(startup_child) [HAVE_PRCTL && PR_SET_PTRACER && PR_SET_PTRACER_ANY]:
	In -D mode, allow tracing the process that is going to become the
	tracee.

	Update PR_* constants.
	* process.c (prctl_options): Add PR_SET_PTRACER.

2013-05-14  Denys Vlasenko  <dvlasenk@redhat.com>

	Hide startup syscalls.
	Tested with "./strace [-D] [-q] [-bexecve] env true",
	all cases seem to work.

	* defs.h: Declare new variable: bool hide_log_until_execve.
	* strace.c: Define hide_log_until_execve.
	Rename skip_startup_execve to skip_one_b_execve.
	(startup_child): Do not set skip_one_b_execve = 1 here.
	(init): If "strace PROG" case (as opposed to "strace -pPID"),
	set skip_one_b_execve and hide_log_until_execve to 1.
	(trace): Don't print signal messages if hide_log_until_execve == 1.
	* syscall.c (trace_syscall_entering):
	Skip syscall printing if hide_log_until_execve == 1.
	Reset hide_log_until_execve if we enter execve syscall.
	(trace_syscall_exiting): Skip syscall printing if hide_log_until_execve == 1.

2013-05-13  Daniel P. Berrange  <berrange@redhat.com>

	Allow -q to be repeated for very quiet output.
	Even with the -q flag specified, tracing output is still mixed
	with messages about signals and process exit status, which is
	often irrelevant.  Allow the -q option to be repeated to force
	the suppression of signals / exit status info too.

	* defs.h: Change 'qflag' from 'bool' to 'unsigned int'.
	* strace.1: Document ability to repeat '-q' option.
	* strace.c: Allow '-q' to be repeated to quieten process
	exit status and signal messages.

2013-05-11  Dmitry V. Levin  <ldv@altlinux.org>

	mips o32: fix syscall table.
	* linux/mips/syscallent-o32.h: Add entries for getpmsg, putpmsg,
	get_mempolicy, set_mempolicy and vserver.  Fix names for umount,
	umount2, mmap, mmap2, pread64, pwrite64, sigaltstack and fstatat64
	syscalls.

2013-05-10  Dmitry V. Levin  <ldv@altlinux.org>

	mips n64: fix syscall table.
	* linux/mips/syscallent-n64.h: Add entries for get_mempolicy,
	set_mempolicy and timerfd syscalls.  Fix entry for socket syscall.
	Fix names for pread64, pwrite64, shmat, rt_sigsuspend, sigaltstack
	and umount2 syscalls.

	mips n32: fix syscall table.
	* linux/mips/syscallent-n32.h: Add entries for mbind, get_mempolicy,
	set_mempolicy and timerfd syscalls.  Fix entry for socket syscall.
	Fix handlers for truncate, ftruncate and getdents64 syscalls.
	Fix names for pread64, pwrite64, shmat, rt_sigsuspend, sigaltstack,
	umount2, and getdents64 syscalls.

2013-05-08  Dmitry V. Levin  <ldv@altlinux.org>

	sync_file_range: fix number of syscall arguments.
	* linux/avr32/syscallent.h: Set the number of sync_file_range arguments
	to 6.
	* linux/bfin/syscallent.h: Likewise.
	* linux/hppa/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/or1k/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h: Change sync_file_range to
	sync_file_range2, set the number of sync_file_range2 arguments to 6.
	* linux/tile/syscallent.h: Change sync_file_range to sync_file_range2,
	set the number of sync_file_range2 arguments to 4.
	* linux/tile/syscallent1.h: Change sync_file_range to sync_file_range2.
	update handler.
	* linux/xtensa/syscallent.h: Likewise.

	Add syscall entries for new linux syscalls.
	* linux/dummy.h: Add printargs aliases for sys_finit_module, sys_kcmp
	and sys_sync_file_range2.
	* linux/alpha/syscallent.h: Add entries for process_vm_readv
	and process_vm_writev.
	* linux/bfin/syscallent.h: Likewise.
	* linux/arm/syscallent.h: Add entries for sync_file_range2, kcmp
	and finit_module.
	* linux/hppa/syscallent.h: Add entries for process_vm_readv,
	process_vm_writev, kcmp and finit_module.
	* linux/tile/syscallent.h: Likewise.
	* linux/tile/syscallent1.h: Likewise.
	* linux/ia64/syscallent.h: Add entry for finit_module.
	* linux/i386/syscallent.h: Add entries for kcmp and finit_module.
	* linux/m68k/syscallent.h: Likewise.
	* linux/metag/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/or1k/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Add entries for s390_runtime_instr, kcmp
	and finit_module.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Add entries for kern_features, kcmp
	and finit_module.

	tests/net: fix portability issues.
	* tests/net-accept-connect.c: Fix address length passed to bind()
	and connect().
	* tests/net: Update regexps.

	tests: add a test for basic network syscalls.
	* tests/.gitignore: Add net-accept-connect, *.o and *.log.*.
	* tests/Makefile.am (AM_CFLAGS): New variable.
	(check_PROGRAMS): Add net-accept-connect.
	(TESTS): Add net.
	* tests/net-accept-connect.c: New file.
	* tests/net: New file.

	tests: do not skip tests when timeout utility is not available.
	* tests/init.sh (check_timeout): New function.
	* tests/ptrace_setoptions: Use it.
	* tests/qual_syscall: Likewise.
	* tests/stat: Likewise.
	* tests/strace-f: Likewise.

2013-05-07  Dmitry V. Levin  <ldv@altlinux.org>

	Move subcall decoding configuration out of the common code.
	* Makefile.am (EXTRA_DIST): Add linux/subcall.h.
	* linux/syscall.h (SYS_socket_subcall): Remove.
	(SYS_socket_nsubcalls, SYS_ipc_subcall, SYS_ipc_nsubcalls): Move to ...
	* linux/subcall.h: ... new file.
	* linux/arm/syscallent.h: Define SYS_socket_subcall, include subcall.h.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/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.

	Suggested by Mike Frysinger and Chris Metcalf.

2013-05-07  Dmitry V. Levin  <ldv@altlinux.org>

	sparc: remove some unused declarations and macros.
	* linux/syscall.h [SPARC || SPARC64] (sys_msgsys, sys_semsys,
	sys_shmsys): Remove declarations.
	[SPARC || SPARC64] (SYS_semsys_subcall, SYS_semsys_nsubcalls,
	SYS_msgsys_subcall, SYS_msgsys_nsubcalls, SYS_shmsys_subcall,
	SYS_shmsys_nsubcalls): Remove macros.

2013-05-07  Mike Frysinger  <vapier@gentoo.org>

	mips: fix build regression.
	The recent commit (2690fadc8b35190dddd29274a7405bac13adc469) shuffled
	the mips headers around causing it to check the ABI defines before it
	included the header which set those up.  Now all mips builds fail with:
		In file included from count.c:36:0:
		defs.h:48:4: error: #error Unsupported _MIPS_SIM

	* defs.h [MIPS]: Move sgidefs.h above _MIPS_SIM check.

2013-05-07  James Hogan  <james.hogan@imgtec.com>

	metag: rename llseek syscall to _llseek.
	The raw llseek syscall is called _llseek from userland, so fix the
	naming of it for metag to allow the stat test to pass.

	* linux/metag/syscallent.h: Rename llseek syscall to _llseek.

2013-05-07  James Hogan  <james.hogan@imgtec.com>

	metag: disable socket and ipc subcall support.
	The metag architecture also uses dedicated syscalls and doesn't need to
	multiplex ipc and socket subcalls.

	* linux/syscall.h [METAG]: Do not define SYS_socket_subcall and
	SYS_ipc_subcall.

2013-05-07  Dmitry V. Levin  <ldv@altlinux.org>

	pread, pwrite: fix number of syscall arguments.
	The number of pread and pwrite arguments depends on architecture and
	personality.  For 64bit and ilp32 it equals to 4, for unaligned
	32bit it equals to 5, and for aligned 32bit it equals to 6.

	* linux/aarch64/syscallent1.h: Change the number of pread and pwrite
	arguments to 4.
	* linux/alpha/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/tile/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/or1k/syscallent.h: Change the number of pread and pwrite
	arguments to 5.

2013-05-07  Dmitry V. Levin  <ldv@altlinux.org>

	preadv, pwritev: fix number of syscall arguments.
	The number of preadv and pwritev arguments depends on architecture and
	personality.  For 64bit and ilp32 it equals to 4, for unaligned 32bit
	it equals to 5, and for aligned 32bit it equals to 6.

	* linux/aarch64/syscallent1.h: Change the number of preadv and pwritev
	arguments to 4.
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/tile/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h: Change the number of preadv and pwritev
	arguments to 6.
	* linux/sh/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Likewise.

2013-05-07  Dmitry V. Levin  <ldv@altlinux.org>

	ftruncate64, truncate64: fix number of syscall arguments.
	The number of ftruncate64/truncate64 arguments depends on architecture
	and personality.  For 64bit and ilp32 it equals to 2, for unaligned
	32bit it equals to 3, and for aligned 32bit it equals to 4.

	* linux/or1k/syscallent.h: Change the number of ftruncate64 and
	truncate64 arguments to 3.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Change ftruncate64 and truncate64 handlers.
	* linux/sparc/syscallent.h: Change ftruncate64 handler, change the
	number of its arguments to 3.
	* linux/xtensa/syscallent.h: Change the number of ftruncate64 and
	truncate64 arguments to 4.

2013-05-07  Dmitry V. Levin  <ldv@altlinux.org>

	fallocate: fix number of syscall arguments.
	The number of fallocate arguments depends on architecture and
	personality.  For 64bit and ilp32 it equals to 4,
	for 32bit it equals to 6.

	* linux/aarch64/syscallent1.h: Change the number of fallocate arguments
	to 4.
	* linux/alpha/syscallent.h: Likewise.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/tile/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Set fallocate handler and flags.

2013-05-07  Dmitry V. Levin  <ldv@altlinux.org>

	fadvise64, fadvise64_64: fix handlers and number of syscall arguments.
	The number of fadvise64 arguments depends on architecture and
	personality.  For 64bit and ilp32 it equals to 4, for unaligned
	32bit it equals to 5, and for aligned 32bit it equals to 6.

	The number of fadvise64_64 arguments is 4 for 64bit and ilp32, for
	unaligned 32bit and most of aligned 32bit it equals to 6, and for
	mips o32 it equals to 7.

	* linux/alpha/syscallent.h: Set fadvise64 handler.
	* linux/s390/syscallent.h: Likewise.
	* linux/hppa/syscallent.h: Set fadvise64_64 handler, change the number
	of syscall arguments to 6.
	* linux/ia64/syscallent.h: Change the number of fadvise64 arguments
	to 4.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/tile/syscallent1.h: Change the number of fadvise64 arguments
	to 5.
	* linux/mips/syscallent-o32.h: Change the number of fadvise64_64
	arguments to 7.
	* linux/s390x/syscallent.h: Change fadvise64_64 handler.  Set fadvise64
	handler.  Change numbers of fadvise64 and fadvise64_64 arguments to 4.
	* linux/sh64/syscallent.h: Change fadvise64_64 handler.
	Change numbers of fadvise64 and fadvise64_64 arguments to 4.
	* linux/sparc/syscallent.h: Set fadvise64 and fadvise64_64 handlers,
	change numbers of their arguments to 5 and 6.
	* linux/x86_64/syscallent.h: Change fadvise64 handler.

2013-05-07  Dmitry V. Levin  <ldv@altlinux.org>

	mips o32: raise the max number of syscall arguments to 7.
	On mips o32, fadvise64_64 takes 7 arguments.

	* defs.h [LINUX_MIPSO32]: Raise MAX_ARGS to 7.

2013-05-07  Dmitry V. Levin  <ldv@altlinux.org>

	mips: split syscallent.h.
	linux/mips/syscallent.h consisted of several parts that had little in
	common.  Split them into separate files to ease maintenance.

	* linux/mips/syscallent-compat.h: New file.
	* linux/mips/syscallent-n32.h: Likewise.
	* linux/mips/syscallent-n64.h: Likewise.
	* linux/mips/syscallent-o32.h: Likewise.
	* linux/mips/syscallent.h: Include them.
	* Makefile.am (EXTRA_DIST): Add them.

2013-05-07  Dmitry V. Levin  <ldv@altlinux.org>

	readahead: fix number of syscall arguments.
	The number of readahead arguments depends on architecture and
	personality.  For 64bit and ilp32 it equals to 3, for unaligned 32bit it
	equals to 4, and for aligned 32bit it equals to 5.

	* linux/aarch64/syscallent1.h: Set number of readahead arguments to 3.
	* linux/alpha/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/or1k/syscallent.h: Set number of readahead arguments to 4.
	* linux/sh/syscallent.h: Likewise.
	* linux/tile/syscallent.h: Likewise.
	* linux/xtensa/syscallent.h: Set number of readahead arguments to 5.

2013-05-06  Dmitry V. Levin  <ldv@altlinux.org>

	linux/syscall.h: make subcall decoding configuration more readable.
	* linux/syscall.h: Inverse and sort the subcall ifdef,
	add a comment why subcall decoding support is not enabled
	on some architectures.

2013-05-06  Chris Zankel  <chris@zankel.net>

	xtensa: disable socket and ipc subcall support.
	The Xtensa architecture also uses dedicated syscalls and doesn't
	need to multiplex ipc and socket subcalls.

	* linux/syscall.h [XTENSA]: Do not define SYS_socket_subcall and
	SYS_ipc_subcall.

2013-05-06  Dmitry V. Levin  <ldv@altlinux.org>

	Fix syscall flags.
	* linux/aarch64/syscallent1.h: Fix syscall flags for send.
	* linux/alpha/syscallent.h: Fix syscall flags for fchdir, getcwd,
	oldumount, sigaltstack, umount, uselib, and utimes.
	* linux/arm/syscallent.h: Fix syscall flags for close, creat, dup, dup2,
	fchdir, fchmod, fchown, fchown32, fcntl, fcntl64, fdatasync, flock,
	fsetxattr, fsync, getdents, getdents64, ioctl, oldfstat, oldselect,
	open, pipe, poll, pread, pwrite, read, readahead, readdir, readv,
	select, socketcall, write, and writev.
	* linux/avr32/syscallent.h: Fix syscall flags for inotify_init and
	unshare.
	* linux/bfin/syscallent.h: Fix syscall flags for pread64 and pwrite64.
	* linux/hppa/syscallent.h: Fix syscall flags for fchdir, flistxattr,
	getcwd, pause, signal, umount2, uselib, utime, and vfork.
	* linux/ia64/syscallent.h: Fix syscall flags for creat, fchdir,
	lstat, umount, uselib, and utimes.  Fix syscall handlers for
	fgetxattr, flistxattr, fremovexattr, and fsetxattr.
	* linux/m68k/syscallent.h: Fix syscall flags for close, creat, dup,
	dup2, fchdir, fchmod, fchown, fchown32, fcntl, fcntl64, fdatasync,
	flock, fsetxattr, getdents, ioctl, oldfstat, oldselect, open, pipe,
	poll, pread64, pwrite64, read, readahead, readdir, readv, select,
	socketcall, write, and writev.
	* linux/metag/syscallent.h: Fix syscall flags for fanotify_init,
	prlimit64, process_vm_readv, process_vm_writev, and quotactl.
	* linux/microblaze/syscallent.h: Fix syscall flags for close, creat,
	dup, dup2, fchdir, fchmod, fchown, fchown32, fcntl, fcntl64,
	fdatasync, flock, fsetxattr, getdents, ioctl, oldfstat, oldselect,
	open, perf_event_open, pipe, poll, pread64, pwrite64, read, readahead,
	readdir, readv, select, socketcall, write, and writev.
	* linux/mips/syscallent.h: Fix syscall flags for close, creat, dup,
	dup2, fchdir, fchmod, fchown, fcntl, fcntl64, fdatasync, flock,
	fsetxattr, getdents, getdents64, getxattr, ioctl, lgetxattr,
	listxattr, llistxattr, lremovexattr, lsetxattr, oldfstat, open, pipe,
	pivot_root, poll, pread, pwrite, read, readahead, readv, removexattr,
	select, setxattr, socketcall, statfs, write, and writev.
	* linux/or1k/syscallent.h: Fix syscall flags for fchdir and quotactl.
	* linux/powerpc/syscallent.h: Fix syscall flags for fchdir.
	* linux/sh/syscallent.h: Fix syscall flags for getcwd.
	* linux/sparc/syscallent.h: Fix syscall flags for getresgid, getresuid,
	setresgid, setresgid32, and setresuid.
	* linux/xtensa/syscallent.h: Fix syscall flags for close, creat, dup,
	dup2, fallocate, fchdir, fchmod, fchown, fcntl, fcntl64, fdatasync,
	flock, fsetxattr, fstatfs, fstatfs64, fsync, getdents, getdents64,
	ioctl, open, pipe, pivot_root, poll, pread64, pwrite64, read,
	readahead, readv, rt_sigreturn, select, setfsgid, setfsuid, setuid,
	swapoff, times, utime, write, and writev.

	tests/stat: enhance regexps.
	* tests/stat: Enhance regexps that check tracing of stat/stat64 and
	fstatat/fstatat64 syscalls.

2013-05-06  Chris Metcalf  <cmetcalf@tilera.com>

	tests/stat: support fstatat syscall for stat()
	Newer Linux architectures don't support the stat/stat64 syscalls.
	Instead they use fstatat() with AT_FDCWD and an extra flags argument.
	Support seeing this output in the 'strace -efile' test.

	As part of this change, use "grep -E -x" syntax consistently for
	all stat tests, since the number of \(foo\)\? expressions was becoming
	pretty unwieldy.

	* tests/stat: Update stat/stat64 check regexp to handle architectures
	that use fstatat instead.  Use "grep -E -x" syntax consistently.

2013-05-06  Dmitry V. Levin  <ldv@altlinux.org>

	ARM OABI: fix 64-bit arguments decoding.
	ARM OABI and ARM EABI have different function parameters passing rules,
	see commit v4.6-11-g7a5b08f for details.

	* util.c (printllval): Do not align argument number in case of ARM OABI.
	* file.c (sys_fadvise64_64): Likewise.

2013-05-06  Mike Frysinger  <vapier@gentoo.org>

	printllval: fix 64bit unpacking on mips/o32 and xtensa.
	The mips/o32 ABI and xtensa arch also do 64bit aligning, so add it to the
	printllval list for this.

	Normally for sys_fadvise64_64 we'd handle the same list of arches, but
	mips/o32 ABI is funky and doesn't shift -- it has 7 args.  So just add
	xtensa to it.

	* file.c (sys_fadvise64_64): Add XTENSA to the shifted list.
	* util.c (printllval): Add LINUX_MIPSO32 and XTENSA to the shifted list.

2013-05-06  Chris Metcalf  <cmetcalf@tilera.com>

	tile: disable socket and ipc subcall support.
	The tile arch just has the dedicated syscalls, so disable
	the logic for parsing subcalls.

	* linux/syscall.h [TILE]: Do not define SYS_socket_subcall and
	SYS_ipc_subcall.

2013-05-06  Mike Frysinger  <vapier@gentoo.org>

	Blackfin: disable socketcall and ipc subcall support.
	The Blackfin arch does not have a socketcall or ipc subcall
	(it has dedicated syscalls broken out), so disable the logic for it.

	* linux/syscall.h [BFIN]: Do not define SYS_socket_subcall and
	SYS_ipc_subcall.

2013-05-05  Mike Frysinger  <vapier@gentoo.org>

	s390: fix # of args truncate64/ftruncate64 takes.
	* linux/s390/syscallent.h: Change nargs to 3 for truncate64/ftruncate64.

2013-05-05  Mike Frysinger  <vapier@gentoo.org>

	mtd: clamp ubi name strings.
	Since the length fields with the ubi volnames are signed 16bit values,
	make sure we clamp that number to the size of the buffer we've allocated
	on the stack to prevent buffer overflows.

	* mtd.c (ubi_ioctl): Clamp length to string_quote to 0/UBI_MAX_VOLUME_NAME.
	Check the return of string_quote and tweak the output accordingly.

2013-05-04  Dmitry V. Levin  <ldv@altlinux.org>

	printxval: support more architectures.
	* configure.ac: Define SIZEOF_LONG_LONG.
	* util.c (printllval): Handle all architectures with sizeof(long) > 4
	and sizeof(long) == sizeof(long long).

2013-05-04  Mike Frysinger  <vapier@gentoo.org>

	Fix building for sparc64 targets.
	* util.c (printllval): Handle SPARC64 define.

	Fix building for mips n64 targets.
	* util.c (printllval): Handle LINUX_MIPSN64 define.

2013-05-03  Dmitry V. Levin  <ldv@altlinux.org>

	hppa: fix stat64 and fstat64 decoding.
	* file.c [HPPA]: Do not redefine stat64 to hpux_stat64.

	arm, aarch64, ppc: fix printllval-based decoders.
	* util.c (printllval) [ARM || POWERPC]: Align argument number.
	[AARCH64]: Align argument number in 32bit mode.
	* file.c (sys_fadvise64_64) [ARM || POWERPC]: Remove no longer needed
	printllval workaround.
	[AARCH64]: Fix printing POSIX_FADV_* constants in 32bit mode.

2013-05-02  Mike Frysinger  <vapier@gentoo.org>

	Decode mtd/ubi ioctls.
	Been playing with UBI of late and it'd help if I could see what it was
	doing.  Not entirely sure about the decoding of UBI_IOCVOLUP -- it takes
	a pointer to a 64bit value, not a strict.

	* util.c (MAX, MIN): Move to ...
	* defs.h (MAX, MIN): ... here.
	(CLAMP): Define.
	(ubi_ioctl): New prototype.
	* ioctl.c (ioctl_decode): Call ubi_ioctl when code is 'o' or 'O'.
	* mtd.c: Include ubi user API header.
	(ubi_volume_types): New enum decode.
	(ubi_volume_props): Likewise.
	(ubi_ioctl): Define.
	* linux/ubi-user.h: Import from linux 3.8.

2013-05-02  Mike Frysinger  <vapier@gentoo.org>

	test: add mtd/ubi test helpers.
	I used these to develop the mtd/ubi ioctl decoders.

	* test/.gitignore: Add mtd/ubi.
	* test/Makefile: Declare all tests in a PROGS var.
	Declare build targets .PHONY.
	(all): Depend on $(PROGS) instead of hardcoded list.
	(clean): Remove $(PROGS) instead of hardcoded list.
	* test/mtd.c: New file.
	* test/ubi.c: Likewise.

2013-05-02  Mike Frysinger  <vapier@gentoo.org>

	test: include headers for used funcs.
	These funcs use things like wait/write/read/strcmp but sometimes
	don't include the right header for them.

	* test/Makefile: Add -Wall to CFLAGS.
	* test/clone.c: Include unistd.h.
	* test/fork.c: Include sys/wait.h.
	* test/sig.c: Include unistd.h.
	* test/sigkill_rain.c: Include sys/wait.h.
	* test/vfork.c: Include sys/wait.h.
	* test/wait_must_be_interruptible.c: Include string.h

2013-05-02  Dmitry V. Levin  <ldv@altlinux.org>

	ia64: fix compilation warnings introduced by commit v4.7-174-g44f0ed1.
	* linux/ia64/syscallent.h: Undefine sys_oldlstat, sys_lstat and
	sys_lstat64 before redefining them to printargs.

	Reported-by: Mike Frysinger <vapier@gentoo.org>

2013-05-02  Mike Frysinger  <vapier@gentoo.org>

	tests: stat: fix clean up of sample file.
	* tests/stat: Also rm the sample file at the end of the test.

	Ignore more files.
	* .gitignore: Add gdb related files.
	* tests/.gitignore: Ignore test logs.

2013-05-02  Dmitry V. Levin  <ldv@altlinux.org>

	x32: fix decoding of i386 truncate and ftruncate syscalls.
	* linux/x32/syscallent1.h: Remove sys_*truncate64 redirections.

	x32: fix printllval-based decoders of i386 syscalls.
	* util.c (printllval) [X32]: Handle i386 personality.

	tests: add basic test for ftruncate, lseek and stat family syscalls.
	* tests/stat: New test.
	* tests/Makefile.am (TESTS): Add stat.

2013-05-01  Dmitry V. Levin  <ldv@altlinux.org>

	x32: fix build regressions introduced by commit v4.7-96-g8435d67.
	* desc.c (printflock) [X32]: Add special handling required for
	this architecture with sizeof(long) < sizeof(off_t).
	* file.c [X32] (struct stat64): Add __attribute__((packed)).
	[X32] (HAVE_STAT64): Define.
	(printstat) [X32]: Redirect to printstat64.
	(printstat64) [X32]: Use "struct stat" instead of "struct stat64".
	[X32] (realprintstat64): Rename to printstat64_x32.
	(sys_stat64, sys_fstat64) [X32]: Remove second definitions of these
	functions.  Call printstat64_x32 instead of printstat64
	* linux/x32/syscallent.h: Fix handlers for truncate and ftruncate.

	Alias sys_*lstat* syscall printing functions.
	* file.c (sys_lstat, sys_lstat64, sys_oldlstat): Remove.
	* linux/dummy.h: Move !HAVE_STRUCT___OLD_KERNEL_STAT aliases forward.
	(sys_lstat): Alias to sys_stat.
	(sys_lstat64): Alias to sys_stat64.
	(sys_oldlstat): Alias to sys_oldstat.
	* linux/syscall.h (sys_lstat, sys_lstat64, sys_oldlstat): Remove.
	* linux/x32/syscallent1.h (sys_lstat64): Remove.

	x86_64: decode __old_kernel_stat based syscalls.
	* linux/x86_64/syscallent1.h: Remove sys_old*stat redirections.

	x32: fix decoding of __old_kernel_stat based syscalls.
	* file.c [X32] (struct __old_kernel_stat): Define.
	* linux/x32/syscallent1.h: Remove sys_old*stat redirections.

2013-05-01  James Hogan  <james.hogan@imgtec.com>

	test/threaded_execve: fix on metag.
	The metag ABI has stacks growing upwards so clone expects the stack
	argument to point at the bottom of the stack instead of the top.

	* test/threaded_execve.c [__metag__]: Define clone2 differently
	to avoid a segfault at runtime.

2013-05-01  James Hogan  <james.hogan@imgtec.com>

	test/skodic: make a bit more portable.
	* test/skodic.c (main): Don't use MAP_FIXED since valid virtual addresses
	vary between architectures (as far as I can tell the use of MAP_FIXED is
	not relevant to the test).  Also don't assume the file desriptor returned
	by open call is 3 when passing it to mmap.

2013-05-01  Mike Frysinger  <vapier@gentoo.org>

	printllval: handle s390x.
	This is a 64bit arch w/no personalities, so fix printing.
	It can now trace a simple call like readahead:
	$ cat test.c
	main(){readahead(-1, (unsigned long long)1 << 50, 0);}
	$ gcc test.c
	$ ./strace -ereadahead ./a.out
	readahead(-1, 1125899906842624, 0)      = -1 EBADF (Bad file descriptor)

	* util.c (printllval): Handle S390X define.

2013-05-01  Mike Frysinger  <vapier@gentoo.org>

	Stop using old AM_CONFIG_HEADER macro.
	Building with automake-1.13 throws an error:
	configure.ac:6: error: 'AM_CONFIG_HEADER': this macro is obsolete.
	    You should use the 'AC_CONFIG_HEADERS' macro instead.

	* configure.ac (AM_CONFIG_HEADER): Rename to AC_CONFIG_HEADERS.

2013-04-30  Dmitry V. Levin  <ldv@altlinux.org>

	build: introduce git-version-gen.
	* .gitignore: Add .version.
	* Makefile.am (EXTRA_DIST, BUILT_SOURCES): Add $(srcdir)/.version.
	Add rules to check NEWS, generate $(srcdir)/.version and
	$(distdir)/.tarball-version files.
	Change ChangeLog and CREDITS generation rules to depend on
	$(srcdir)/.version instead of $(srcdir)/.git/refs/heads/*.
	* NEWS: Add dates to recent releases.
	* configure.ac (AC_INIT): Use git-version-gen.
	(AM_INIT_AUTOMAKE): Remove check-news.
	* git-version-gen: Import from gnulib.
	* make-dist: Check NEWS.

	Makefile.am: sort long lists to ease maintenance.
	* Makefile.am (strace_SOURCES, EXTRA_DIST): Sort, place one list element
	per line.

	build: fix "make dist" regression introduced by commit v4.7-105-g7270de5
	* Makefile.am (EXTRA_DIST): Remove linux/arm/syscallent1.h,
	linux/arm/signalent1.h, linux/arm/ioctlent1.h and linux/arm/errnoent1.h.

	build: fix "make dist" regression introduced by commit v4.7-29-g17e3860.
	* Makefile.am (EXTRA_DIST): Add linux/ioctlent-filter.awk.

2013-04-30  Mike Frysinger  <vapier@gentoo.org>

	Blackfin: tweak sram_alloc syscall decode.
	* system.c (sys_sram_alloc): The 2nd argument of sram_alloc syscall
	is a bit field, not a specific value, so decode it as such.

2013-03-31  Zev Weiss  <zev@bewilderbeest.net>

	Print io_submit() offsets in decimal.
	This makes output formatting more consistent with pread()/pwrite(),
	which print their offset parameters in decimal.

	* desc.c (sys_io_submit): Change offset output format from %llx to %lld.

2013-03-30  Andreas Schwab  <schwab@suse.de>

	Fix building outside source directory.
	The file linux/ioctlent.h is generated in the build directory, so
	"../ioctlent.h" won't find it.

	* linux/aarch64/ioctlent1.h: Remove "../" from include file name.
	* linux/powerpc/ioctlent1.h: Likewise.
	* linux/tile/ioctlent1.h: Likewise.
	* linux/x32/ioctlent1.h: Likewise.
	* linux/x86_64/ioctlent1.h: Likewise.
	* linux/x86_64/ioctlent2.h: Likewise.

2013-03-30  Andreas Schwab  <schwab@suse.de>

	AArch64: Fix printing of long long value.
	* util.c (printllval): Fix printing of long long values on
	AArch64.

2013-03-27  Dmitry V. Levin  <ldv@altlinux.org>

	Update PR_* constants.
	* process.c (prctl_options): Add more PR_* constants from linux/prctl.h.

2013-03-25  Chris Zankel  <chris@zankel.net>

	Add support for the XTENSA architecture.
	* configure.ac: Add XTENSA to the list of supported architectures.
	* defs.h: Add XTENSA support.
	* linux/xtensa/syscallent.h: New file.
	* linux/xtensa/ioctlent.h.in: Likewise.
	* process.c (struct_user_offsets): Add XTENSA support.
	* signal.c (sys_sigreturn): Likewise.
	* syscall.c (printcall, get_scno, get_syscall_args,
	  get_syscall_result, get_error): Likewise.
	* util.c (change_syscall): Likewise.

2013-03-22  Denys Vlasenko  <vda.linux@googlemail.com>

	Add example script which builds static (possibly cross-compiled) strace.

2013-03-21  Dmitry V. Levin  <ldv@altlinux.org>

	Use 64-bit versions of stat, readdir and setrlimit functions when available
	strace already has a mechanism to use fopen64 for output when the 64-bit
	version of fopen is available on 32-bit architectures.  Apply this
	mechanism for other three functions to make strace fully adopted for
	64-bit types.

	* strace.c (struct_stat, stat_file, struct_dirent, read_dir,
	struct_rlimit, set_rlimit): New macros.
	(startup_attach): Use read_dir.
	(startup_child): Use struct_stat and stat_file.
	(main): Use struct_rlimit and set_rlimit.

2013-03-20  Dmitry V. Levin  <ldv@altlinux.org>

	Do not use struct dirent in readdir decoding.
	struct dirent from libc should not be used for umove'ing into because it
	contains fixed size d_name.

	* file.c (printdir): Rename to print_old_dirent.
	[SH64]: Decode using struct kernel_dirent.
	[!SH64]: Decode using an open-coded struct with 32-bit d_ino and d_off.
	(sys_readdir): Update.

2013-03-20  Dmitry V. Levin  <ldv@altlinux.org>

	Do not use off_t in sendfile decoding.
	sendfile parser used to decode off_t* parameter as a pointer to host
	off_t type.  With this change, it is decoded as a pointer to target long
	type.

	* io.c (print_off_t): New function.
	(sys_sendfile): Use it.
	* linux/aarch64/syscallent1.h: Use sys_sendfile64 for sendfile decoding.
	* linux/tile/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/hppa/syscallent.h: Use sys_sendfile64 for sendfile64 decoding.
	* linux/metag/syscallent.h: Correct sendfile syscall name.
	* linux/or1k/syscallent.h: Likewise.

2013-03-18  Dmitry V. Levin  <ldv@altlinux.org>

	Fix build with older versions of libaio.h.
	* configure.ac: When libaio.h is available, check for
	struct iocb.u.c.flags, IO_CMD_PWRITE and IO_CMD_PWRITEV.
	* desc.c (print_common_flags): Check for HAVE_STRUCT_IOCB_U_C_FLAGS.
	(sys_io_submit): Check for HAVE_DECL_IO_CMD_PWRITE and
	HAVE_DECL_IO_CMD_PWRITEV.

	Fix io_submit decoding.
	* desc.c (print_common_flags, sys_io_submit): Add missing ", " to
	SUB_COMMON output, remove extra ", " from SUB_VECTOR output.

2013-03-18  Maxin B. John  <maxin.john@enea.com>

	tests: relax check_prog to allow timeout command provided by busybox.
	Busybox version of timeout doesn't have --version option.
	Relax check_prog to handle those cases.

	* tests/init.sh (check_prog): Use type builtin to check program
	availability.

2013-03-18  Dmitry V. Levin  <ldv@altlinux.org>

	Reorganize get_regs code, hopefully without functional changes.
	* syscall.c [I386 || ARM || OR1K || METAG] (ARCH_REGS_FOR_GETREGSET):
	New macro.
	(get_regset): Implement for AARCH64, METAG, OR1K and X32.
	(get_regs) [AARCH64 || METAG || OR1K || X32]: Use it.

	arm, i386: use PTRACE_GETREGSET if available.
	* syscall.c [ARM || I386 || X86_64] (get_regset): New function.
	(get_regs) [ARM || I386 || X86_64]: Use it.

	Include <sys/uio.h> and <elf.h> on all architectures.
	* syscall.c: Include <sys/uio.h> and <elf.h> on all architectures.

	x86-64: enhance PTRACE_GETREGSET test.
	* syscall.c (get_regs) [X86_64]: Check whether PTRACE_GETREGSET
	works regardless of the kernel version.

	x32: use PTRACE_GETREGSET unconditionally.
	* syscall.c (get_regs) [X32]: Assume that PTRACE_GETREGSET always works
	regardless of the kernel version.

	x86-64, x32: do not include linux/ptrace.h unnecessarily.
	* syscall.c [X86_64 || X32]: Stop including linux/ptrace.h.

	i386, tile, x32: do not redefine ptrace prototype.
	* defs.h [I386 || TILE || X32]: Use ptrace prototype from sys/ptrace.h.

	ptrace: decode note segment descriptor types.
	* configure.ac (AC_CHECK_HEADERS): Add elf.h.
	* process.c: Include elf.h.
	(nt_descriptor_types): New xlat structure.
	(sys_ptrace): Use it.

2013-03-14  Dmitry V. Levin  <ldv@altlinux.org>

	Update MADV_* constants.
	* mem.c (madvise_cmds): Add more MADV_* constants from
	asm-generic/mman-common.h

	Reported-by: Robin Hack <hack.robin@gmail.com>

2013-03-07  Denys Vlasenko  <vda.linux@googlemail.com>

	Tweaks for -c: fixed setitimer/getitimer hack; optimized call_summary_pers()
	count_syscall() was calling setitimer/getitimer once in order to find
	smallest "tick" OS uses in time accounting, in order to use it
	for syscalls which apparently spent less than that time in syscall.
	The code assumed that this "tick" is not zero... but it is zero
	on linux-3.6.11. Which means that this hack doesn't work...

	At least this change prevents this measurement from being done
	_repeatedly_, by initializing one_tick to -1, not 0.

	While at it, added comments in count_syscall() explaining what we are doing.

	Optimized call_summary_pers() a bit, by eliminating redundant tv -> float
	conversions, and prevented 0.0/0.0 which was resulting in "% time"
	being shown as "-nan" if total CPU time spent was 0.000000
	(try "strace -c /bin/true").

	The code seems to seriously underestimate CPU usage:
	"strace -c ls -lR /usr/share >/dev/null" shows total time spent
	in syscalls to be only ~10..20% of what "time ls -lR /usr/share >/dev/null"
	shows.

	It might be useful to have a mode where we show wall clock time
	spent in syscalls, not CPU time. It might also be more accurate.

	   text	   data	    bss	    dec	    hex	filename
	 245019	    676	   5708	 251403	  3d60b	strace_old
	 244923	    684	   5676	 251283	  3d593	strace

2013-03-06  Denys Vlasenko  <vda.linux@googlemail.com>

	Open-code isprint(c) and isspace(c)
	We don't call setlocale, thus we always use C locale.
	But libc supports various other locales, and therefore
	its ctype interface is general and at times inefficient.
	For example, in glibc these macros result in function call,
	whereas for e.g. isprint(c) just c >= ' ' && c <= 0x7e
	suffices.

	By open-coding ctype checks (we have only 4 of them)
	we avoid function calls, we get smaller code:

	   text	   data	    bss	    dec	    hex	filename
	 245127	    680	   5708	 251515	  3d67b	strace_old
	 245019	    676	   5708	 251403	  3d60b	strace

	and we don't link in ctype tables (beneficial for static builds).

2013-03-06  Denys Vlasenko  <vda.linux@googlemail.com>

	Makefile: add commented-out tweak to generate link map.

	Stop using a large static buffer in getfdpath.
	   text	   data	    bss	    dec	    hex	filename
	 245075	    680	   9836	 255591	  3e667	strace_old
	 245143	    680	   5708	 251531	  3d68b	strace

2013-03-05  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix wrongly indented closing curly brace. No code changes.

	strace_vfprintf: if malloc fails, exit gracefully.

2013-03-05  Dmitry V. Levin  <ldv@altlinux.org>

	Use sysconf(_SC_PAGESIZE) instead of hardcoded PAGE_SHIFT.
	PAGE_SHIFT couldn't be reliably obtained at compile time,
	thanks to Chris Metcalf for the hint.

	* mem.c: Do not include <sys/user.h>.
	[SH64] Do not include <asm/page.h>.
	(get_pagesize): New function.
	(sys_mmap_pgoff, sys_old_mmap_pgoff): Use it.

2013-03-05  Denys Vlasenko  <vda.linux@googlemail.com>

	Emit better message for ERESTARTNOHAND return.

	Disable STREAMS syscalls for non-SPARC.
	   text	   data	    bss	    dec	    hex	filename
	   3002	      0	   1024	   4026	    fba	stream.o.old
	   1729	      0	   1024	   2753	    ac1	stream.o

	Fix printstrbufarg's address argument to be long, not int.

	Remove variable tracing_paths and check in pathtrace_match.

2013-03-05  Denys Vlasenko  <vda.linux@googlemail.com>

	Use dynamically-sized selected[] array for -P PATH.
	While at it, added a small optimization of not remembering
	the path twice if it happens to be the same.

	   text	   data	    bss	    dec	    hex	filename
	 245111	    680	  10860	 256651	  3ea8b	strace_old
	 245075	    680	   9804	 255559	  3e647	strace

2013-03-05  Denys Vlasenko  <vda.linux@googlemail.com>

	metag,or1k: whitesace style fix. no code changes.

	Assorted fixes to syscallent.h.
	or1k was missing TM on many memory-related syscalls
	sys_lookup_dcookie is 3-arg on 64-bit arches, and isn't TF
	sys_recvmsg is 3-arg on all arches
	sys_nfsservctl is 3-arg on all arches
	sys_timerfd_create is 2-arg on all arches
	sys_[f]truncate64 is 4-arg or 3-arg, never 5-arg
	truncate64 is TF
	sys_[l]lseek is TD
	fstat[64] is TD

2013-03-05  James Hogan  <james.hogan@imgtec.com>

	Add support for Imagination Technologies Meta.
	Add support for Imagination Technologies Meta architecture (the
	architecture/ABI is usually referred to as metag in code). The Meta
	Linux kernel port is in the process of being upstreamed for v3.9 so it
	uses generic system call numbers.

	sys_lookup_dcookie writes a filename to buffer argument, so I've set
	TF flag.
	nfsservctl appears to be set to sys_ni_syscall in asm-generic/unistd.h
	so I've left it blank.
	truncate64/ftruncate64/pread64/pwrite64/readahead have unaligned 64bit
	args which are packed tightly on metag, so less arguments on metag.
	fchdir/llseek takes a file descriptor so s/TF/TD/
	sync_file_range has 2 64bit args so uses 6 args, so s/4/6/
	timerfd_create/msgget/msgctl/msgrcv/semget/segtimedop/semop/shmget/
	shmctl/shmat/shmdt/recvmsg/migrate_pages have different number of args.
	oldgetrlimit is just getrlimit for metag.
	add TM flag to various memory syscalls.
	metag doesn't directly use sys_mmap_pgoff for mmap2.
	prlimit64/process_vm_readv/process_vm_writev take a pid so add TP flag.
	fanotify_init doesn't appear to take a file descriptor so remove TD.
	Add kcmp syscall.

	Cc: Christian Svensson <blue@cmd.nu>

2013-03-01  Denys Vlasenko  <vda.linux@googlemail.com>

	umovestr: speed up check for NUL byte in the fetched word.

2013-03-01  Dmitry V. Levin  <ldv@altlinux.org>

	Fix trace=set regression introduced by commit v4.7-111-g9cbc15b.
	* syscall.c (qual_syscall, qualify): Pass personality down to
	qualify_one.
	* tests/qual_syscall: New test.
	* tests/Makefile.am (TESTS): Add qual_syscall.

2013-03-01  Chris Metcalf  <cmetcalf@tilera.com>

	tile: handle printllval like x86_64 or powerpc64.
	Without this fix the tilegx build fails when it hits the new #error
	about SIZEOF_LONG > 4.

	* util.c (printllval): Fix printing of long long values on TILE.

2013-02-27  Denys Vlasenko  <vda.linux@googlemail.com>

	Make -b take SYSCALL param, document it in --help and in manpage.
	To not waste an option letter for just one trick,
	extend -b to take a parameter:
	"on which syscalls do you want to detach?".
	Currently supports only execve.

	While at it, fixed (by removing non-Linux and stale info)
	and extended manpage text about -f.

2013-02-26  Dmitry V. Levin  <ldv@altlinux.org>

	Cleanup umoven and umovestr.
	Cleanup sloppy error handling.

	First, EFAULT kind of errors from process_vm_readv by itself is not
	something unusual, so a warning message will not be issued unless a
	short read is detected.

	Second, clients of umoven and umovestr are not prepared to detect and
	handle short reads that can happen in these functions.  The most safe
	way to handle them is to return an error code.

	* util.c (umoven, umovestr): Cleanup handling of errors coming from
	process_vm_readv and PTRACE_PEEKDATA.

2013-02-26  Dmitry V. Levin  <ldv@altlinux.org>

	pathtrace: fix umovestr return code check.
	* pathtrace.c (upathmatch): Only NUL-terminated strings can be
	path-matched, so fix the umovestr return code check to filter out
	unsuitable strings.

2013-02-26  Dmitry V. Levin  <ldv@altlinux.org>

	Fix compilation errors uncovered by -Werror=enum-compare.
	This fixes regression introduced by commit v4.7-111-g9cbc15b.

	* syscall.c: Merge all nsyscalls* enums into single enum.
	Likewise merge nerrnos*, nsignals*, and nioctlents* into single enums.

2013-02-26  Denys Vlasenko  <vda.linux@googlemail.com>

	Mass replace error_msg("%s", "literal") -> error_msg("literal")
	There is no need to print literal strings through "%s".
	Only untrusted strings such as filenames need that.

2013-02-26  Ben Noordhuis  <info@bnoordhuis.nl>

	Make umoven report success as 0, not >=0, stop returning success on partial reads
	umoven() uses process_vm_readv() when available but it returns the
	return value of that syscall, which is the number of bytes copied,
	while its callers expect it to simply return zero on success.

	It was causing syscalls that take a user-space argument to print
	the abbreviated version, e.g.:

	  epoll_ctl(5, EPOLL_CTL_ADD, 10, {...})

	Instead of:

	  epoll_ctl(5, EPOLL_CTL_ADD, 10, {EPOLLIN, {u32=10, u64=10}})

	* util.c (umoven): Make umove[n] report success as 0, not >=0,
	stop returning "success" on partial reads.

2013-02-26  Denys Vlasenko  <vda.linux@googlemail.com>

	Assorted NOMMU fixes.
	With -D, strdup'ing of pathname is necessary only on NOMMU.

	Don't set skip_startup_execve to 1 if NOMMU and not in daemonized mode
	(try "strace [-D] -b env echo HI" to see whether we detach on correct execve).

	Fix test_ptrace_FOO shortcuts on NOMMU to always assume success
	and _properly_ set all variables.

2013-02-26  Denys Vlasenko  <vda.linux@googlemail.com>

	Shorten help text - no need to show deprecated option -F.

2013-02-23  Denys Vlasenko  <vda.linux@googlemail.com>

	Merge adjacent tprint's.

	Correct i > MAX_NSYSCALLS commparison: should be i >= MAX_NSYSCALLS.

2013-02-22  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix wrong offset display in dumpstr.
	BTW, the new code from prev commit is 5 times faster
	than old one :)

2013-02-22  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix a bug in dumpstr (no null termination). Essentially rewrote dumpstr.
	This is a 14 year old bug (!).

	It wasn't biting us merely because outstr[80] was static, thus ended up
	in bss and whatever was after it "accidentally" provided the NUL byte.
	When dumpstr was changed to use on-stack buffer, the bug reared its ugly head.

	This is a rewrite which is smaller and should be significantly faster
	for _long_ strings.

	   text	   data	    bss	    dec	    hex	filename
	 244627	    680	  10860	 256167	  3e8a7	strace.t9/strace
	 244563	    680	  10860	 256103	  3e867	strace.ta/strace

	* util.c (dumpstr): Rewrite to be faster and smaller.

2013-02-22  Denys Vlasenko  <vda.linux@googlemail.com>

	Eliminate MAX_QUALS, make qualifier array dynamic.
	MAX_QUALS was 2048, even though most arches used less than 500 entries
	in it. MAX_QUALS had to be maintained by hand to be higher than syscall
	count. It also limited the highest possible fd to track.

	This change makes qual_flagsN[] arrays start sized to the required minimum
	(number of syscalls) and grow dynamically if user requested
	-e read=BIGNUM. As a precaution, BIGNUM should be < 2^15, but this limit
	can be raised with no cost for normal strace invocations.

	qual_flags is now a define to qual_vec[current_personality].

	As a bonus, this patch aliases sysent, errnoent, signalent, ioctlent
	names in one-personality arches to their corresponding <foo>0 arrays,
	removing one indirection level.

	  text   data    bss    dec    hex filename
	244471    700  12928 258099  3f033 strace.t7/strace
	244627    680  10860 256167  3e8a7 strace.t8/strace

2013-02-22  Denys Vlasenko  <vda.linux@googlemail.com>

	Create and use struct_sysent and struct_ioctlent typedefs.
	This is a preparatory mass replace patch with no code changes.

	The future change will need to typedef sysent to sysent0,
	which results in compile failures when "struct sysent" string
	gets mangled into "struct sysent0".

2013-02-22  Denys Vlasenko  <vda.linux@googlemail.com>

	Use tcp->qual_flg instead of qual_flags[] in verbose() and abbrev()
	We have hundreds of uses of these macros.
	Result is more efficient and 1.1 kbyte shorter code:

	  text	   data	    bss	    dec	    hex	filename
	245579	    700	  12928	 259207	  3f487	strace.t5/strace
	244471	    700	  12928	 258099	  3f033	strace.t6/strace

2013-02-21  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove unused QUAL_FAULT code (was used by non-Linux code only).

2013-02-21  Denys Vlasenko  <vda.linux@googlemail.com>

	Use uint8_t for qual_flags[] instead of ints.
	Resulting bss reduction is ~6kbytes:

	   text	   data	    bss	    dec	    hex	filename
	 245703	    700	  19072	 265475	  40d03	strace.t4/strace
	 245687	    700	  12928	 259315	  3f4f3	strace.t5/strace

2013-02-21  Denys Vlasenko  <vda.linux@googlemail.com>

	Eliminate many SCNO_IS_VALID checks.
	By adding tcp->s_ent pointer tot syscall table entry,
	we can replace sysent[tcp->scno] references by tcp->s_ent.
	More importantly, we may ensure that tcp->s_ent is always valid,
	regardless of tcp->scno value. This allows us to drop
	SCNO_IS_VALID(tcp->scno) checks before we access syscall
	table entry.

	We can optimize (qual_flags[tcp->scno] & QUAL_foo) checks
	with a similar technique.

	Resulting code shrink:
	   text    data     bss     dec     hex filename
	 245975     700   19072  265747   40e13 strace.t3/strace
	 245703     700   19072  265475   40d03 strace.t4/strace

	* count.c (count_syscall): Use cheaper SCNO_IN_RANGE() check.
	* defs.h: Add "int qual_flg" and "const struct sysent *s_ent"
	to struct tcb. Remove "int u_nargs" from it.
	Add UNDEFINED_SCNO constant which will mark undefined scnos
	in tcp->qual_flg.
	* pathtrace.c (pathtrace_match): Drop SCNO_IS_VALID check.
	Use tcp->s_ent instead of sysent[tcp->scno].
	* process.c (sys_prctl): Use tcp->s_ent->nargs instead of tcp->u_nargs.
	(sys_waitid): Likewise.
	* strace.c (init): Add compile-time check that DEFAULT_QUAL_FLAGS
	constant is consistent with init code.
	* syscall.c (decode_socket_subcall): Use tcp->s_ent->nargs
	instead of tcp->u_nargs. Set tcp->qual_flg and tcp->s_ent.
	(decode_ipc_subcall): Likewise.
	(printargs): Use tcp->s_ent->nargs instead of tcp->u_nargs.
	(printargs_lu): Likewise.
	(printargs_ld): Likewise.
	(get_scno): [MIPS,ALPHA] Use cheaper SCNO_IN_RANGE() check.
	If !SCNO_IS_VALID, set tcp->s_ent and tcp->qual_flg to default values.
	(internal_fork): Use tcp->s_ent instead of sysent[tcp->scno].
	(syscall_fixup_for_fork_exec): Remove SCNO_IS_VALID check.
	Use tcp->s_ent instead of sysent[tcp->scno].
	(get_syscall_args): Likewise.
	(get_error): Drop SCNO_IS_VALID check where it is redundant.
	(dumpio): Drop SCNO_IS_VALID check where it is redundant.
	Use tcp->s_ent instead of sysent[tcp->scno].
	(trace_syscall_entering): Use (tcp->qual_flg & UNDEFINED_SCNO) instead
	of SCNO_IS_VALID check. Use tcp->s_ent instead of sysent[tcp->scno].
	Drop SCNO_IS_VALID check where it is redundant.
	Print undefined syscall name with undefined_scno_name(tcp).
	(trace_syscall_exiting): Likewise.
	* util.c (setbpt): Use tcp->s_ent instead of sysent[tcp->scno].

2013-02-21  Denys Vlasenko  <vda.linux@googlemail.com>

	ARM: make it one-personality arch.
	ARM in fact _is_ one personality.

	We had two personalities for it because it has a handful of
	syscalls with huge scnos (0x000f00xx).

	Extending syscall table to have [0x000f0005] index is of course
	not a good idea.

	Someone decided to handle that by having a separate personality
	just for these syscalls.

	But multi-personality arch does a bit more work in other parts.

	This patch is another alternative: "move" 0x000f00nn syscalls
	down to the entries just above last ordinary syscall,
	by manipulating scno if it falls into the 0x000f00xx range.

	In order to not worsen genuine undefined scnos' printing,
	the code remaps scno back to actual value before printing
	"syscall_NNN" string.

	* defs.h: Remove multi-reprsonality defines from ARM.
	* syscall.c (shuffle_scno): New function.
	(undefined_scno_name): New function.
	(get_scno): [ARM] Replace personality setting with scno shuffling.
	(trace_syscall_entering): Print unknown syscall name using
	undefined_scno_name().
	(trace_syscall_exiting): Likewise.
	* linux/arm/syscallent.h: Add ARM specific syscalls at the end.
	* linux/arm/errnoent1.h: Deleted.
	* linux/arm/ioctlent1.h: Deleted.
	* linux/arm/signalent1.h: Deleted.
	* linux/arm/syscallent1.h: Deleted.

2013-02-20  Denys Vlasenko  <vda.linux@googlemail.com>

	arm: shorten syscall table for EABI - no point in storing NULL entries.
	Also, reformatted ARM code in get_scno(), mostly improved comments,
	without code changes.

	Use the same style of includes in linux/*/* files.
	While at it, fix some comments which say
	"we use i386 syscalls/ioctls/errnos" but in reality
	common ones are used.

2013-02-19  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix compiler warnings.
	With constant current_wordsize == 4 and 32-bit longs,
	gcc was spooked by "1ul << (8 * current_wordsize)" = "1ul << 32".

	Make such places conditional on SIZEOF_LONG > 4.

2013-02-19  Denys Vlasenko  <vda.linux@googlemail.com>

	Improve comment text. No code changes.

2013-02-19  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix NOMMU + daemonized tracer SEGV.
	pathname[] was getting destroyed, execve of garbage pathname
	failing, and to top it off, the tracer's stack was also
	smashed and trecer segfaulted.

	* strace.c (exec_or_die): New function.
	(startup_child): Don't use pathname[] contents after vfork,
	make a malloced copy instead. Explain "NOMMU + -D bug"
	and how we work around it.

2013-02-19  Denys Vlasenko  <vda.linux@googlemail.com>

	Make it possible to to do test builds for NOMMU architectures.
	And while using it, I discovered that -D doesn't work too well
	on NOMMU. Added a comment about it.

2013-02-19  Denys Vlasenko  <vda.linux@googlemail.com>

	Clean up mmap decoding.
	Previous code merges too many similar, but different ways
	of decoding mmap. For example, sys_old_mmap is "params in memory"
	API... except SH[64], where it is "params in regs",
	i.e. what sys_mmap ("new mmap") function does on other arches!

	It's much simpler when every mmap handler has same API regardless
	of arch. Where API means whether params are in regs or in memory,
	and whether offset is in bytes, pages, or 4k blocks.

	Then we just insert correct function pointers into
	arch syscall tables.

	It turns out there are four common mmap APIs over
	all architectures which exist in Linux kernel,
	and one outlier for S390.

	A number of mmap decoders were plain wrong in arch tables.
	For example, BFIN has no old_mmap. It returns ENOSYS.
	I checked kernel sources for all arches nad fixed the tables.

	There was dead code for x86_64 for old_mmap:
	x86_64 has no old_mmap.

	* mem.c: Refactor mmap functions so that we have five mmap syscall
	handlers, each with the fixed API (not varying by arch).
	* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
	* linux/syscall.h: Declare new mmap syscall handler functions.
	* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
	* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
	* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
	* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
	* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
	* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
	* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
	* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
	* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
	* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
	* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
	* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
	* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
	* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc/syscallent1.h: mmap is TD|TM.
	* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.

2013-02-18  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove unused function sys_mmap64.
	No wonder that it is unused.
	It's code looked quite questionable.

	* mem.c (sys_mmap64): Remove this function.

2013-02-18  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove code which supports systems with long long off_t.
	While looking at mmap mess, did experimenting in order
	to figure out what gets used when.

	Tried building armv4tl, armv5l, armv6l, mips, mipsel, i686,
	x86_64 and none of they have long long off_t,
	which isn't suprprising: we aren't using glibc defines
	which enable that.

	Moreover, we SHOULD NOT use off_t in syscall decode!
	Its size depends on libc, not on arch! I.e. it is essentially
	unpredictable and can even in theory vary on the same arch
	with different libc.

	We should use longs or long longs, in a way which matches
	architectural ABI for the given syscall. There are usually
	*at most* two permutations, no need to add yet another variable
	(sizeof(off_t)) to the mix.

	This change removes almost all HAVE_LONG_LONG_OFF_T conditionals,
	which will reveal further possible simplifications.

	* mem.c: Remove code conditional on HAVE_LONG_LONG_OFF_T.
	As a result, never remap sys_mmap64 to sys_mmap.
	(print_mmap): Compile unconditionally.
	(sys_old_mmap): Compile unconditionally.
	(sys_mmap): Compile unconditionally.
	* io.c (sys_sendfile): Add a FIXME comment.
	* file.c: Remove code conditional on HAVE_LONG_LONG_OFF_T.
	As a result, never remap sys_*stat64 to sys_*stat etc.
	(sys_truncate): Compile unconditionally.
	(realprintstat): Likewise.
	(sys_stat): Likewise.
	(sys_fstat): Likewise.
	(sys_lstat): Likewise.
	* desc.c (printflock): Likewise.

2013-02-18  Denys Vlasenko  <vda.linux@googlemail.com>

	Fixes in "new" mmap.
	* mem.c (sys_mmap): Ensure unsigned expansion of tcp->u_arg[5].
	Add page shift of offset for I386.
	Use tcp->ext_arg[5] as offset for X32.
	(sys_old_mmap): [X32] Remove this function, X32 doesn't use is.

	Preliminary simplifications in mmap functions.
	* mem.c: Move "define sys_mmap64 sys_mmap" from the top
	to the only place it affects.
	(print_mmap): Make offset argument unsigned, for safer implicit conversions.
	(sys_old_mmap): [IA64] use unsigned narrow_arg[].
	Cast u_arg[5] (offset param) to unsigned long, to prevent erroneous signed
	expansion.

2013-02-17  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove broken HAVE_LONG_LONG conditionals.
	We use printllval without HAVE_LONG_LONG guards in many places,
	but define it only if HAVE_LONG_LONG. This means that
	on !HAVE_LONG_LONG systems we won't build for some time now.

	* defs.h: Remove HAVE_LONG_LONG guard around LONG_LONG() macro
	and printllval() function declaration.
	* util.c: Remove HAVE_LONG_LONG guard around printllval()
	function definition.
	(printllval): Add compile-time error check for using wrong
	if branch. Explain places where we deliberately use mismatched
	types for printf formats.

2013-02-17  Denys Vlasenko  <vda.linux@googlemail.com>

	Use explicit long type instead of off_t.
	* file.c (sys_lseek): Use long instead of off_t.

	Merge two identical tables.
	* defs.h: Declare whence_codes[].
	* desc.c: Delete static whence[].
	(printflock[64]): Use whence_codes.
	* file.c: Make whence_codes[] non-static.
	Add SEEK_DATA and SEEK_HOLE to them.

2013-02-17  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove wrong x32-specific lseek.
	Testing confirmed what I suspected: x32 lseek uses kernel-sized
	(i.e. wide) long for offset parameter.

	* file.c: Delete sys_lseek32.
	* linux/syscall.h: Likewise.
	* linux/x32/syscallent1.h: Likewise.
	* test/x32_lseek.c: New file.

2013-02-17  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix SEGV in lseek.
	I found hard way why the code was using "_whence" name.

	* file.c: Rename whence[] to whence_codes[].
	(sys_lseek): Fix printxval() to use whence_codes[].
	(sys_lseek32): Likewise.

2013-02-17  Denys Vlasenko  <vda.linux@googlemail.com>

	Comment inner workings of sys_[l]lseek.
	The code doesn't look fully correct to me, but I need to experiment
	on actual x32 machine before I start "fixing" things.
	For now, add comments, and optimize out one tprints() call...

	* file.c (sys_lseek): Rename '_whence' as 'whence'.
	Merge printing of ", " into subsequent tprintf.
	(sys_lseek32): Likewise.
	(sys_llseek): Likewise.

2013-02-17  Denys Vlasenko  <vda.linux@googlemail.com>

	Cosmetic fixes to syscall tables, no code changes.

2013-02-16  Denys Vlasenko  <vda.linux@googlemail.com>

	Make linux/mips/syscallent.h smaller.
	* linux/mips/syscallent.h: Remove trailing empty elements.
	Compactify huge stretches of NULL elements in the middle.

	Simple optimization in get_error.
	* defs.h: Define SCNO_IN_RANGE(scno) macro.
	* syscall.c (get_error): Change return type to void.
	Use SCNO_IN_RANGE instead of SCNO_IS_VALID.
	(trace_syscall_exiting): Stop checking get_error() return value.

	Mass rename of SCNO_IN_RANGE define to SCNO_IS_VALID.

	Finish prefixing regs struct names with arch_
	* defs: Rename regs -> sparc_regs.
	* signal.c (sys_sigreturn): Use new variable name.
	* syscall.c: Rename regs -> sparc_regs, regs -> avr32_regs.
	(getrval2): Use new variable names.
	(printcall): Likewise.

2013-02-15  Denys Vlasenko  <vda.linux@googlemail.com>

	Use the same type for i386_regs on 32-bit and 64-bit x86.
	* defs.h: Stop including <asm/ptrace.h> for x86.
	Change i386_regs from "struct pt_regs" to "struct user_regs_struct".
	* syscall.c: Likewise.

	Fix build error on Tile.
	* syscall.c (get_scno): [TILE] Remove TCB_WAITEXECVE check,
	it is never true on Tile, and stopped compiling when
	TCB_WAITEXECVE define was removed for Tile.

2013-02-15  Denys Vlasenko  <vda.linux@googlemail.com>

	x86: zero-extend 32-bit args in syscall entry instead of sign-extension.
	Zero-extension is slightly more common that sign-extension:
	all pointers are zero-extended, and some other params are unsigned.

	Whereas signed ones (fds, pids, etc) are often treated as
	_32-bit ints_ even by kernel, so just unconditionally casting
	such tcp->u_arg[N] to int works.

	* syscall.c (get_syscall_args): [X86] Zero-extend 32-bit args
	instead of sign-extension.

2013-02-15  Denys Vlasenko  <vda.linux@googlemail.com>

	Macroize conditional signed widening operation.
	* defs.h: Define widen_to_long() macro.
	* signal.c (sys_kill): Use it instead of open-coding it.
	(sys_tgkill): Use widen_to_long() on pids.
	* resource.c (decode_rlimit): Formatting fix.

2013-02-15  Denys Vlasenko  <vda.linux@googlemail.com>

	A better handling of current_wordsize.
	On x86_64:
	  text	   data	    bss	    dec	    hex	filename
	435661	  26628	  47424	 509713	  7c711	strace_old
	435501	  26612	  47440	 509553	  7c671	strace_new_clever_wordsize

	On x32 and arm it should be even better, current_wordsize becomes
	a constant there.

	* defs.h: Declare current_wordsize as a variable if needed,
	else declare as a constant define.
	Remove declatation of personality_wordsize[].
	* syscall.c: Make personality_wordsize[] static.
	Declare current_wordsize as a variable if needed.
	(set_personality): Set current_wordsize only if non-constant.

2013-02-15  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove unnecessary "return 0" statements.
	* util.c (change_syscall): Remove dummy "return 0"s.

2013-02-14  Denys Vlasenko  <vda.linux@googlemail.com>

	x86: fix required kernel version for GETREGSET.
	* syscall.c (get_regs): [X86] Use GETREGSET only if kernel >= 2.6.35

	Whitespace fix, no code changes.

2013-02-14  Christian Svensson  <blue@cmd.nu>

	Add support for the OpenRISC 1000 platform.
	* configure.ac: Added or1k architecture..
	* defs.h: Added or1k to use register reading system.
	* linux/or1k/ioctlent.h.in: Use i386 ioctls.
	* linux/or1k/syscallent.h: New file.
	* process.c: Added or1k register defs to struct_user_offsets[].
	* syscall.c: Added or1k_io iovec for or1k GETREGSET,
	  regset structure for or1k.
	  (printcall): Added handling for or1k.
	  (get_regs): Likewise.
	  (get_scno): Likewise.
	  (get_syscall_args): Likewise.
	  (get_syscall_result): Likewise.
	  (get_error): Likewise.
	* util.c (change_syscall): Added dummy handling for or1k.
	* system.c (sys_or1k_atomic): New function (or1k specific syscall).

2013-02-14  Denys Vlasenko  <vda.linux@googlemail.com>

	[X86] Use ptrace(PTRACE_GETREGSET, NT_PRSTATUS) to get registers.
	Unlike PTRACE_GETREGS, this new method detects 32-bit processes
	reliably, without checking segment register values which
	are undocumented and aren't part of any sort of API.
	While at it, also fixed x32 detection to use __X32_SYSCALL_BIT,
	as it should have been from the beginning.

	* defs.h: Declare os_release and KERNEL_VERSION.
	* strace.c: Make os_release non-static, remove KERNEL_VERSION define.
	* syscall.c: New struct i386_user_regs_struct,
	static union x86_regs_union and struct iovec x86_io.
	(printcall): Use i386_regs or x86_64_regs depending on x86_io.iov_len.
	(get_regs): On x86 and kernels 2.6.30+, use PTRACE_GETREGSET,
	on earlier kernels fall back to old method.
	(get_scno): [X86] Determine personality based on regset size
	on scno & __X32_SYSCALL_BIT.
	(syscall_fixup_on_sysenter): Use i386_regs or x86_64_regs depending
	on x86_io.iov_len.
	(get_syscall_args): Likewise.
	(get_error): Likewise.

2013-02-13  Denys Vlasenko  <vda.linux@googlemail.com>

	Rename some register statics by prefixing their names with arch.
	This makes it easier to grep for them.

	* syscall.c: Rename variables:
	r0 -> bfin_r0,alpha_r0,sh_r0.
	a3 -> mips_a3.
	r2 -> mips_r2.
	(get_scno): Use new variable names.
	(get_syscall_result): Likewise.
	(get_error): Likewise.

2013-02-13  Denys Vlasenko  <vda.linux@googlemail.com>

	Factor out code to check addr, fetch and print siginfo.
	* defs.h: Declare new function printsiginfo_at(tcp, addr).
	* process.c (sys_waitid): Use printsiginfo_at().
	(sys_ptrace): Likewise.
	* signal.c: (printsiginfo_at): Implement this new function.
	(sys_rt_sigsuspend): Use printsiginfo_at().
	(sys_rt_sigtimedwait): Likewise.

	Decode struct iov in PTRACE_GET/SETREGSET.
	* process.c (sys_ptrace): Decode struct iov in PTRACE_GET/SETREGSET.

2013-02-12  Denys Vlasenko  <vda.linux@googlemail.com>

	Unify representations of struct user fields for subarchitectures.
	* process.c: Unify MIPS and LINUX_MIPSN32, and SH and SH64 parts of
	struct_user_offsets[].

	Add start_code and start_data members of struct user.
	* process.c: Add start_code and start_data members of struct user
	in struct_user_offsets[], where appropriate.

	Remove hacks for old kernels for architectures which require new kernels
	* util.c (change_syscall): For MICROBLAZE, replace code
	with dummy "return 0" and a comment explaining why that is ok
	for this architecture.

2013-02-12  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove stray syscall result reading code on syscall entry for s390.
	This is a leftover from sysenter/sysexit split.
	I can't run-test it, but from code inspection it seems to be correct.

	* syscall.c (get_scno): Remove stray syscall result reading for s390[x].

2013-02-12  Denys Vlasenko  <vda.linux@googlemail.com>

	Deobfuscate definitions of struct user offsets.
	The maze of ifdefs/ifndefs was scaring new contributors.
	Format it so that every arch has its own ifdef block.

	* process.c: Deobfuscate definitions of struct user offsets.

2013-02-12  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove hacks for old kernels for architectures which require new kernels
	* defs.h: Do not define TCB_WAITEXECVE for AARCH64.
	* util.c (change_syscall): For AARCH64 and X32, replace code
	with dummy "return 0" and a comment explaining why that is ok
	for these architectures.

	Remove old kernel hacks for architectures which require new kernels.
	* defs.h: Do not define TCB_WAITEXECVE for AVR32, BFIN and TILE.
	* util.c (change_syscall): For AVR32, BFIN and TILE, replace code
	with dummy "return 0" and a comment explaining why that is ok
	for these architectures.

	Handle recv[m]msg for non-native 32-bit personality syscalls.
	* net.c (printmsghdr): If current_wordsize is 4 and long is wider than it,
	read 32-bit struct msghdr and expand it into a native one before using it.
	(printmmsghdr): Likewise for struct mmsghdr.

2013-02-12  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix is_negated_errno() check for X32.
	X32's return value is 64-bit. We were truncating it to 32-bit long
	before checking for -errno.

	* syscall.c (is_negated_errno_x32): New function.
	(get_error): Use is_negated_errno_x32 for X32 architecture.

2013-02-12  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove unused / ambiguously used defines.
	We sometimes use LINUXSPARC and sometimes (more often)
	use "defined(SPARC) || defined(SPARC64)". Better to use
	one construct consistently.
	LINUX_MIPS64 is altogether unused.

	* defs.h: Remove LINUXSPARC and LINUX_MIPS64 defines.
	Move PTRACE_xxx compat defines up, before arch-specific
	machinery. Use defined(SPARC) || defined(SPARC64)
	instead of LINUXSPARC.
	* file.c: Use defined(SPARC) || defined(SPARC64) instead of LINUXSPARC.
	* signal.c: Likewise.

2013-02-11  Denys Vlasenko  <vda.linux@googlemail.com>

	Preparatory patch for "new" x86 personality detection.
	* syscall.c: Move PT_FLAGS_COMPAT define to its only user, get_scno().
	Rename arm_regs_union's fields to names less likely to collide with
	system defines.
	(get_regs): Use sizeof(arm_regs_union) instead of sizeof(aarch64_regs).
	This should be the same, but htis way it's cleaner.
	Remove __X32_SYSCALL_MASK and use __X32_SYSCALL_BIT instead.
	Explain 64-bit check in X32 build better.

2013-02-09  Dmitry V. Levin  <ldv@altlinux.org>

	Fix sigaltstack decoder.
	strace used to hang when decoding sigaltstack called with invalid
	stack_t pointers because of mishandling umove() return code.

	* signal.c (print_stack_t): Handle unfetchable stack_t properly.
	Change return type to void.
	(sys_sigaltstack): Update print_stack_t() usage.

	Reported-by: kawillia@ucalgary.ca

2013-02-09  Mike Frysinger  <vapier@gentoo.org>

	Fix decoding of sysctl() when oldval fields are NULL.
	If you call glibc's syscall wrapper like so:
		static int name[] = { CTL_NET, NET_IPV4, NET_IPV4_LOCAL_PORT_RANGE };
		int buffer[2] = { 32768, 61000 };
		size_t size = sizeof(buffer);
		sysctl(name, 3, 0, 0, buffer, size);
	(note that oldval/oldlenp are NULL).

	The current strace code complains like so:
	_sysctl({{CTL_NET, NET_IPV4, NET_IPV4_LOCAL_PORT_RANGE, 38}, 3, process_vm_readv: Bad address
	(nil), 0, 0x7fffe23c3960, 8}) = -1 EACCES (Permission denied)

	Since passing NULL for the old values is valid, handle that explicitly.
	This also simplifies the code a bit by splitting up the handling of the
	new and old args so that we only handle the new args once.

	Now the output looks like:
	_sysctl({{CTL_NET, NET_IPV4, NET_IPV4_LOCAL_PORT_RANGE, 38}, 3, NULL, 0, 0x7fff8c0c91b0, 8) = -1 EACCES (Permission denied)

	* system.c (sys_sysctl): Check if info.oldval is NULL first.  Move the
	processing of oldlen/info.newval/info.newlen out so they always get
	executed.  Fix the format strings so we use %lu for unsigned long rather
	than a mix of %ld and %lu.

2013-02-08  Denys Vlasenko  <vda.linux@googlemail.com>

	If we are on a glibc system, assume it's at least glibc 2.1.
	It is not likely anyone uses glibc older that that:
	glibc 2.1.1 was released in 1999

	* net.c: Remove test for glibc >= 2.1.
	* signal.c: Remove code which is compiled only for glibc < 2.1.
	* util.c: Likewise.

2013-02-08  Denys Vlasenko  <vda.linux@googlemail.com>

	S390: stop using needlessly static long pc variable.
	* syscall.c: Remove "static long pc" variable.
	(get_scno): Use an automatic long variable instead of a static.

	Dying suddenly with abort() is rude, avoid if possible.
	* file.c (sys_utime): Don't call abort() if wordsize is strange.
	Instead, warn user about it.
	* desc.c (printflock): Use the same message string as in sys_utime.

	Remove vestigial hacks around non-Linux struct sigactions.
	* signal.c: Stop using __sighandler_t glibc'ism. Remove SA_HANDLER macro.
	Explain why we can't use "sa_handler" as a field name.
	(sys_sigaction): Use __sa_handler instead of SA_HANDLER macro.
	(sys_rt_sigaction): Likewise.

2013-02-08  Denys Vlasenko  <vda.linux@googlemail.com>

	Optimize AArch64 handling of 32-bit personality.
	By putting aarch64_regs and arm_regs into a union,
	register copying is eliminated.
	No need to check and change personality on syscall exit.

	* defs.h: Remove unused NUM_ARM_REGS define. Fix indentation.
	* syscall.c: Put aarch64_regs and arm_regs into a union.
	(update_personality): Shorten bitness message.
	(printcall): Add commented-out PC printing.
	(get_regs): Remove now-unnecessary 64-to-32 bits register copying.
	(get_syscall_result): Drop personality changing code.

2013-02-07  Denys Vlasenko  <vda.linux@googlemail.com>

	Rename some register statics by prefixing their names with arch.
	This makes it easier to grep for them.

	* syscall.c: Make IA64's r8, r10 global variables static.
	Rename variables:
	r8,r10 -> ia64_r8,ia64_r10.
	d0 -> m68k_d0.
	a3 -> alpha_a3.
	r28 -> hppa_r28.
	r9 -> sh64_r9.
	r10 -> cris_r10.
	r3 -> microblaze_r3.
	(get_scno): Use new variable names.
	(syscall_fixup_on_sysenter): Likewise.
	(get_syscall_result): Likewise.
	(get_error): Likewise.

2013-02-06  Denys Vlasenko  <vda.linux@googlemail.com>

	Rename ARM's regs structure to arm_regs.
	Compile-tested.

	* defs.h: Rename regs structure to arm_regs.
	* syscall.c: Likewise.
	(printcall): Use new name instead of old one.
	(get_regs): Likewise.
	(get_scno): Likewise.
	(get_syscall_args): Likewise.
	(get_error): Likewise.
	* signal.c (sys_sigreturn): Likewise.

2013-02-06  Denys Vlasenko  <vda.linux@googlemail.com>

	Stop needlessly using static variable.
	* syscall.c: Remove static long psr.
	(get_scno): Use local psr variable.
	(get_syscall_result): Likewise.

2013-02-06  Denys Vlasenko  <vda.linux@googlemail.com>

	Shortcut tests for fork/exec syscalls.
	This change should speed up strace by a tiny bit.

	More importantly, it makes it much more clear that
	fork and exec fixups are not necessary for any reasonably
	recent kernels. IOW: syscall_fixup_for_fork_exec() and its callees
	are all dead code.

	* defs.h: Declare new need_fork_exec_workarounds flag variable.
	* strace.c: Define need_fork_exec_workarounds flag variable.
	(test_ptrace_setoptions_followfork): Return 0/1 as success/fail indicator.
	(test_ptrace_setoptions_for_all): Likewise.
	(init): Set need_fork_exec_workarounds to TRUE if needed.
	* syscall.c: Rename internal_syscall() to syscall_fixup_for_fork_exec().
	(trace_syscall_entering): Call syscall_fixup_for_fork_exec() only if
	need_fork_exec_workarounds == TRUE.
	(trace_syscall_exiting): Likewise.

2013-02-05  Ben Noordhuis  <info@bnoordhuis.nl>

	Improve perf_event_open argument decoding.
	* configure.ac (AC_CHECK_HEADERS): Add linux/perf_event.h.
	* desc.c [HAVE_LINUX_PERF_EVENT_H]: Include <linux/perf_event.h>.
	(perf_event_open_flags): New xlat structure.
	(sys_perf_event_open): New function.
	* linux/dummy.h (sys_perf_event_open): Remove.
	* linux/syscall.h (sys_perf_event_open): New prototype.

2013-02-05  Chris Metcalf  <cmetcalf@tilera.com>

	tile: fix merge skew with new get_regs architecture.
	* defs.h [TILE]: Declare clear_regs(), get_regs() and get_regs_error.
	* syscall.c (get_regs) [TILE]: Fix merge skew.
	(printcall) [TILE]: fix a compiler warning about pt_reg_t in
	a printf expression.

2013-02-05  Bernhard Reutner-Fischer  <rep.dot.nop@gmail.com>

	mount: decode MS_NOSEC.
	* system.c (MS_NOSEC): Define.
	(mount_flags): Add MS_NOSEC.

	mmap: decode MAP_UNINITIALIZED.
	* mem.c (mmap_flags): Add MAP_UNINITIALIZED.

2013-02-05  Dmitry V. Levin  <ldv@altlinux.org>

	Print 64-bit instruction pointers zero padded.
	* syscall.c (printcall): Print 64-bit instruction pointers zero padded.

	x86_64: fix compilation warning introduced in previous commit.
	* syscall.c (printcall): Cast x86_64_regs.rip to the type being printed.

2013-02-05  Denys Vlasenko  <vda.linux@googlemail.com>

	Simple bug fix for x86_86.
	* syscall.c (printcall): Use x86_64_regs.rip, not x86_64_regs.ip.

2013-02-05  Chris Metcalf  <cmetcalf@tilera.com>

	Add tilegx support to strace.
	tilegx support has been in the kernel since 3.0.
	In addition, fix some issues with the tilepro support already
	present in strace, primarily the decision to use the
	<asm/unistd.h> numbering space for system calls.

	* defs.h [TILE]: Include <asm/ptrace.h> and provide an extern
	struct pt_regs tile_regs for efficiency.  Provide compat 32-bit
	personality via SUPPORTED_PERSONALITIES, PERSONALITY0_WORDSIZE,
	PERSONALITY1_WORDSIZE, and DEFAULT_PERSONALITY.
	* linux/tile/errnoent1.h: New file, includes linux/errnoent.h.
	* linux/tile/ioctlent1.h: New file, includes linux/ioctlent.h.
	* linux/tile/signalent1.h: New file, includes linux/signalent.h.
	* linux/tile/syscallent.h: Update with new asm-generic syscalls.
	The version previously committed was the from the first tile patch
	to LKML, which subsequently was changed to use <asm-generic/unistd.h>.
	* linux/tile/syscallent1.h: Copy from linux/tile/syscallent.h.
	* mem.c (addtileflags) [TILE]: use %ld properly for a "long" variable.
	* process.c [TILE]: Choose clone arguments correctly and properly
	suppress all "struct user" related offsets in user_struct_offsets.
	* signal.c [TILE]: Use tile_regs not upeek.
	* syscall.c (update_personality) [TILE]: Print mode.
	(PT_FLAGS_COMPAT) [TILE]: Provide if not in system headers.
	(tile_regs) [TILE]: Define 'struct pt_regs' variable to hold state.
	(get_regs) [TILE]: use PTRACE_GETREGS to set tile_regs rather than using upeek.
	(get_scno) [TILE]: Set personality.
	(get_syscall_args) [TILE]: Use tile_regs.
	(get_syscall_result) [TILE]: Update tile_regs.
	(get_error) [TILE]: Use tile_regs.
	(printcall) [TILE]: Print pc.
	(arg0_offset, arg1_offset, restore_arg0, restore_arg1) [TILE]:
	Properly handle tile call semantics and support tilegx.

2013-02-05  Denys Vlasenko  <vda.linux@googlemail.com>

	Small optimization for SPARC[64] get_scno.
	* syscall.c: Remove static unsigned long trap veriable.
	(get_scno): Use local trap variable.

	Do not compile getrval2() if not needed.
	* syscall.c (getrval2): Do not compile it for architetures where
	it isn't ever used.

2013-02-05  Denys Vlasenko  <vda.linux@googlemail.com>

	Optimize out PTRACE_PEEKUSER with -i.
	strace -i was fetching PC with a separate PEEKUSER
	despite having GETREGS data:

	ptrace(PTRACE_GETREGS, 22331, 0, 0x8087f00) = 0
	ptrace(PTRACE_PEEKUSER, 22331, 4*EIP, [0x80dd7b7]) = 0
	write(3, "[080dd7b7] ioctl(0, SNDCTL_TMR_T"..., 82) = 82
	ptrace(PTRACE_SYSCALL, 22331, 0, SIG_0) = 0

	Now it does this:

	ptrace(PTRACE_GETREGS, 22549, 0, 0x8087ea0) = 0
	write(3, "[080dd7b7] ioctl(0, SNDCTL_TMR_T"..., 82) = 82
	ptrace(PTRACE_SYSCALL, 22549, 0, SIG_0) = 0

	Analogous improvement in sys_sigreturn() is also implemented.

	* defs.h: Declare extern struct pt_regs regs for SPARC[64] and ARM.
	Declare clear_regs(), get_regs() and get_regs_error flag variable.
	* strace.c (trace): Call get_regs(pid) as soon as we know the tcb
	and that it is stopped.
	* syscall.c (get_regs): New function. Used to fetch registers early,
	just after tracee has stopped.
	(printcall): Move it here from util.c. Use global regs.REG data,
	if available on the arch, instead of re-fetching it.
	(get_scno): Use global regs.REG data.
	(get_syscall_result): Likewise.
	* signal.c (sys_sigreturn): Likewise.
	* util.c (printcall): Moved to syscall.c.

2012-12-15  Stanislav Brabec  <sbrabec@suse.cz>

	Fix sys_semtimedop decoding on s390x.
	The s390 and s390x pass semtimedop arguments differently from other
	architectures.  sys_semtimedop parser was fixed for s390 by commit
	v4.6-177-ge0f5fd8, and s390x requires the same fix.

	* linux/ipc.c (sys_semtimedop): Fix timespec decoding on s390x.

2012-12-08  Dmitry V. Levin  <ldv@altlinux.org>

	Fix *xattr decoding.
	* file.c (print_xattr_val): Do not attempt to decode a zero sized array.
	Fixes RH#885233.

2012-12-08  Stanislav Brabec  <sbrabec@suse.cz>

	sys_semtimedop: fix timeval argument index in wrapped call.
	Looking at the implementation of wrapped semtimedop() call inside glibc
	and kernel, I started to believe that timeval should be located in
	tcp->u_arg[4] and not tcp->u_arg[5].  Fortunately, tcp->u_arg[5] now
	works correctly as well, due to side effects of decode_ipc_subcall().

	declaration in header:
	int semtimedop(semid, *sops, nsops, *timeout);
	                 0      1      2        3

	sys_ipc arguments in glibc on all patforms except s390*:
	semid, (int) nsops, 0, CHECK_N (sops, nsops), timeout
	  0            1    2            3                4
	We have to use indexes: 0 3 1 4

	sys_ipc arguments on s390*:
	semid, (int) nsops, timeout, sops
	  0            1       2       3
	We have to use indexes: 0 3 1 2

	* ipc.c (sys_semtimedop) [!S390]: Fix timeval argument index in
	indirect_ipccall case.

2012-12-06  John Spencer  <maillist-strace@barfooze.de>

	Fix glibc version checks.
	* util.c: Check if __GLIBC__ is defined before using it.
	* signal.c: Likewise.  Fix __GLIBC_MINOR__ checks.

2012-11-29  James Hogan  <james.hogan@imgtec.com>

	Add state argument to change_syscall and fix SPARC.
	Add a state argument to change_syscall() so that SPARC can modify that
	instead of read-modify-writing the whole register set.  This function is
	always called within an arg_setup/arg_finish_change sequence which on
	certain architectures like SPARC will also be doing a read-modify-write.
	This prevents the second write (from arg_finish_change) from undoing the
	effects of the change_syscall call.

	* util.c (change_syscall): Move below definition of arg_setup_state.
	Add state argument.
	[SPARC || SPARC64] Change to set state->u_regs[U_REG_G1] rather than
	read-modify-writing it with PTRACE_GETREGS and PTRACE_SETREGS.
	(setbpt, clearbpt): Pass state argument to change_syscall.

2012-11-12  Steve McIntyre  <steve.mcintyre@linaro.org>

	Add support for tracing 32-bit ARM EABI binaries on AArch64.
	* defs.h [AARCH64]: Copy in the definition of arm_pt_regs and the
	accessor macros, so it's possible to build on AArch64 without
	ARM system headers.  Set SUPPORTED_PERSONALITIES to 2.
	Define PERSONALITY0_WORDSIZE and PERSONALITY1_WORDSIZE.
	Set DEFAULT_PERSONALITY to 1.
	* linux/aarch64/errnoent1.h: New file, includes generic errnoent.h.
	* linux/aarch64/ioctlent1.h: New file, includes generic ioctlent.h.
	* linux/aarch64/signalent1.h: New file, includes generic signalent.h.
	* linux/aarch64/syscallent1.h: Rename from linux/aarch64/syscallent.h.
	* linux/aarch64/syscallent.h: New file, includes arm/syscallent.h.
	* syscall.c [AARCH64]: Define aarch64_regs.
	(update_personality) [AARCH64]: Add debug output.
	(get_scno) [AARCH64]: Determine if we're in ARM or AArch64 mode by
	checking the size of the returned uio structure from PTRACE_GETREGSET
	and interpret the structure accordingly.
	(get_syscall_result): Likewise.
	(get_syscall_args): Merge the AArch64 and ARM sections so that on
	AArch64 we can fall back to supporting the ARM personality.
	(get_error): Likewise.

2012-11-12  Dmitry V. Levin  <ldv@altlinux.org>

	Move asm-generic ioctl definitions to linux/ioctlent.h.in.
	* linux/ioctlent.h.in: Add asm-generic ioctl entries from all
	linux/*/ioctlent.h.in files.
	* linux/bfin/ioctlent.h.in: Remove asm-generic ioctl entries.
	* linux/i386/ioctlent.h.in: Likewise.
	* linux/powerpc/ioctlent.h.in: Likewise.
	* linux/s390/ioctlent.h.in: Likewise.
	* linux/sparc/ioctlent.h.in: Likewise.

2012-10-27  Dmitry V. Levin  <ldv@altlinux.org>

	Filter out redundant "*32" ioctl entries.
	* linux/ioctlent-filter.awk: New file.
	* Makefile.am: Use it.
	* linux/ioctlent.h.in: Removed redundant "*32" entries.

2012-10-26  Dmitry V. Levin  <ldv@altlinux.org>

	Enhance quotactl decoding.
	* quota.c (sys_quotactl): Decode 2nd syscall argument using printpath.
	* pathtrace.c (pathtrace_match): Add quotactl support.
	* linux/*/syscallent.h: Add TF flag to quotactl entry.

2012-10-26  Steve McIntyre  <steve.mcintyre@linaro.org>

	Add AArch64 support to strace.
	AArch64 has been included in linux from 3.7 onwards.
	Add support for AArch64 in strace, tested on linux in a simulator.

	* configure.ac: Support AArch64.
	* defs.h [AARCH64]: Include <sys/ptrace.h>, define TCB_WAITEXECVE.
	* ipc.c (indirect_ipccall): Support AArch64.
	* process.c (struct_user_offsets): Likewise.
	* syscall.c [AARCH64]: Include <asm/ptrace.h>,  <sys/uio.h>, and
	<elf.h>.  Define struct user_pt_regs regs.
	(get_scno, get_syscall_result): Support AArch64 using PTRACE_GETREGSET.
	(get_syscall_args, get_error): Support AArch64.
	* linux/aarch64/ioctlent.h.in: New file.
	* linux/aarch64/syscallent.h: New file, based on linux 3.7 version of
	asm-generic/unistd.h.

2012-10-26  Steve McIntyre  <steve.mcintyre@linaro.org>

	linux: add new errno values for EPROBE_DEFER and EOPENSTALE.
	New definitions match updates in Linux 3.4 and Linux 3.5 respectively.

	* linux/errnoent.h (ERRNO_517): Change to EPROBE_DEFER.
	(ERRNO_518): Change to EOPENSTALE.

2012-10-26  Namhyung Kim  <namhyung.kim@lge.com>

	Add -e trace=memory option.
	Add a new 'memory' category for tracing memory mapping related syscalls.

	Affected syscalls are: break, brk, get_mempolicy, madvise, mbind,
	migrate_pages, mincore, mlock, mlockall, mmap, move_pages, mprotect,
	mremap, msync, munlock, munlockall, munmap, remap_file_pages, and
	set_mempolicy.

	* defs.h (TRACE_MEMORY): New macro.
	* syscall.c (lookup_class): Handle trace=memory option.
	* strace.1: Document it.
	* linux/alpha/syscallent.h: Add TM flag to memory mapping related syscalls.
	* 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.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/tile/syscallent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.

2012-09-28  Mike Frysinger  <vapier@gentoo.org>

	x32: add 64bit annotation too.
	Since someone can invoke these entry points directly with syscall(),
	at least decode their name and show that they're 64bit versions rather
	than just showing syscall_###.

	* linux/x32/syscallent.h: Sync all missing entries below 312 with x86_64.

2012-09-28  Dmitry V. Levin  <ldv@altlinux.org>

	Ignore fflush(3) return value.
	strace used to honor fflush(3) return value in trace_syscall_entering
	which resulted to tracees not being PTRACE_SYSCALL'ed which in turn
	caused nasty hangups like this one:

	$ strace -o'|:' pwd
	|:: Broken pipe

	There is little strace can do in case of fflush(3) returning EOF, and
	hangup is certainly not the best solution for the issue.

	* syscall.c (trace_syscall_entering): Ignore fflush(3) return value.

2012-09-28  Dmitry V. Levin  <ldv@altlinux.org>

	Use perror_msg instead of perror.
	* signal.c (sys_sigreturn): Use perror_msg instead of perror.
	* strace.c (tprintf, tprints, detach, startup_attach): Likewise.
	* syscall.c (get_scno): Likewise.
	* util.c (umoven, umovestr): Likewise.

2012-09-27  Denys Vlasenko  <vda.linux@googlemail.com>

	process_vm_readv may return ESRCH if tracee was killed, don't complain.
	Discovered by running test/sigkill_rain under strace.

	* util.c (umoven): Do not emit error message if process_vm_readv
	fails with ESRCH.
	(umovestr): LikeWise.

2012-09-13  Denys Vlasenko  <vda.linux@googlemail.com>

	Trivial fixes, no code changes.
	* strace.c: Fix compiler warning message about tgkill - we don't use it.
	Fix indentation of preprocessor directives.
	(trace): Remove outdated comment.

2012-08-24  Dmitry V. Levin  <ldv@altlinux.org>

	Always check setreuid return code.
	* strace.c (startup_child): Check setreuid return code.

2012-08-24  Mike Frysinger  <vapier@gentoo.org>

	x32: update {g,s}etsockopt syscall numbers.
	Starting with linux 3.6 (and backported to earlier kernels), these two
	syscalls have changed numbers (moving from native to compat entry points).
	Update the strace syscall list accordingly.

	* linux/x32/syscallent.h: Move setsockopt from 54 to 541, and move
	getsockopt from 55 to 542.

2012-08-16  Dmitry V. Levin  <ldv@altlinux.org>

	Decode file type returned by getdents system call.
	* file.c (sys_getdents): Decode d_type in unabbreviated mode.

2012-07-12  Dmitry V. Levin  <ldv@altlinux.org>

	Close pipe and wait for the pipe process termination.
	In case of normal strace termination, when the trace output is
	redirected to a file or a pipe, close it and wait for the pipe
	process termination.

	* strace.c (main): Before normal exit, close shared_log when it
	differs from stderr, and wait for popen_pid termination.

2012-07-10  Denys Vlasenko  <vda.linux@googlemail.com>

	Enable usage of PTRACE_SEIZE.
	* defs.h: Define USE_SEIZE to 1. Remove PTRACE_SEIZE_DEVEL
	and PTRACE_EVENT_STOP1.
	* strace.c (ptrace_attach_or_seize): Replace PTRACE_SEIZE_DEVEL
	with 0.
	(trace): Do not check for PTRACE_EVENT_STOP1.

2012-06-05  Mike Frysinger  <vapier@gentoo.org>

	x32: update syscall table.
	This syncs with the syscall table as it is in linux 3.4.

	* linux/x32/syscallent.h (59): Fix comment typo.
	(78): Add missing getdents entry.
	(174): Delete create_module entry (not in the kernel).
	(181, 182, 183, 184, 185): Add missing entries.
	(524, 536, 539, 540): Fix spacing.

2012-05-18  Denys Vlasenko  <vda.linux@googlemail.com>

	Merge adjacent printing operations in a few places.
	* file.c (sys_readahead): Merge tprints() with following printllval().
	(sys_ftruncate64): Likewise.
	(sys_fadvise64): Likewise.
	(sys_fadvise64_64): Likewise.
	(sys_fallocate): Merge tprints() with following tprintf().

2012-05-16  Denys Vlasenko  <vda.linux@googlemail.com>

	Use %d printf format instead of %i everywhere.
	* loop.c (loop_ioctl): Use %d instead of %i.
	* mtd.c (mtd_ioctl): Likewise.

	Fix a few goofs in sys_sysctl()
	* system.c (sys_sysctl): Cast pointer to long, not size_t,
	when we intend to use it as an address. Set oldlen to 0 prior
	to reading into it - we want to have deterministic result
	if read fails.

2012-05-16  Denys Vlasenko  <vda.linux@googlemail.com>

	Stop using non-standard %Zu and %Zd formats for size_t printing.
	The documented formats are %zu and %zd, but since our (normally disabled)
	"fast" printf code doesn't support those too, I convert them to %lu and %ld.

	* bjm.c (sys_query_module): Convert %Zd usages to %lu.
	* system.c (sys_sysctl): Likewise.

2012-05-15  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove outdated comment about suspending new tracees.
	We no longer track parent/child relationship between tracees.
	Therefore, we no longer suspend new tracee until parent is seen
	exiting form [v]fork/clone. The comment is obsolete.

	* strace.c (trace): Remove outdated comment.

2012-05-15  Denys Vlasenko  <vda.linux@googlemail.com>

	Make sure current_wordsize and PERSONALITY0_WORDSIZE are ints in all arches
	On 64bit systems with a single personality, they used to be sizeof(long),
	which has type "long", not "int", which complicates printf formats.

	* defs.h: Ensure that PERSONALITY0_WORDSIZE;s tyoe is int.
	This in turn makes sure current_wordsize is also an int.
	* count.c (call_summary): Revert the change which added cast to int.

2012-05-15  Dmitry V. Levin  <ldv@altlinux.org>

	Add configure --enable-gcc-Werror option.
	* configure.ac: New option --enable-gcc-Werror.

	Make x86-64 build free of artificial warnings.
	* signal.c (sys_sigreturn): Do not issue "no sys_sigreturn" warning
	on X86_64.

2012-05-14  Dmitry V. Levin  <ldv@altlinux.org>

	Fix kernel release string parsing.
	* strace.c (get_os_release): Handle "X.Y-something" utsname.release
	strings properly.

	Reported-by: Bryce Gibson <bryce@gibson-consulting.com.au>

2012-05-14  Denys Vlasenko  <vda.linux@googlemail.com>

	On clearing "breakpopint", restore syscall number too.
	This fixes Fedora bug 659382.
	Low risk: this code is not supposed to be used on any non-acient kernel.

	* util.c (clearbpt): Restore syscall number too.

2012-05-05  Mike Frysinger  <vapier@gentoo.org>

	util: fix building when glibc has a stub process_vm_readv.
	If you have a newer glibc which provides process_vm_readv, but it is built
	against older kernel headers which lack __NR_process_vm_readv, the library
	will contain a stub implementation that just returns ENOSYS.  Autoconf
	checks for this case explicitly and will declare it as unavailable.  So we
	end up in a case where the headers provide the prototype, but autoconf has
	not defined HAVE_PROCESS_VM_READV, so we hit the same build failure again:

	util.c:738:16: error: static declaration of 'process_vm_readv' follows non-static declaration
	/usr/include/bits/uio.h:58:16: note: previous declaration of 'process_vm_readv' was here

	So rename our local function to something unique, and add a define so the
	callers all hit the right place.

	* util.c (strace_process_vm_readv): Rename from process_vm_readv.
	(process_vm_readv): Define to strace_process_vm_readv.

2012-05-03  Dmitry V. Levin  <ldv@altlinux.org>

	doc: describe documentation policy.
	* README-hacking: Describe documentation policy.

2012-05-02  Dmitry V. Levin  <ldv@altlinux.org>

	maint: post-release administrivia.
	* NEWS: Add header line for next release.

	Prepare for 4.7 release.
	* configure.ac: Version 4.7.
	* debian/changelog: 4.7-1.
	* strace.spec: 4.7-1.

	Fix build with <linux/loop.h> from 2.6.18 kernel headers.
	* configure.ac: Check for LO_FLAGS_AUTOCLEAR and LO_FLAGS_PARTSCAN
	declarations.
	* loop.c (loop_flags_options): Use LO_FLAGS_AUTOCLEAR and
	LO_FLAGS_PARTSCAN only when appropriate declarations are available.
	(loop_ioctl): Use LOOP_SET_CAPACITY only when it is defined.

2012-05-01  Dmitry V. Levin  <ldv@altlinux.org>

	* vsprintf.c: Check for USE_CUSTOM_PRINTF earlier.

	Remove duplicate names from CREDITS.
	* .mailmap: Merge email addresses.
	* CREDITS.in: Remove a duplicate name.

2012-05-01  Dmitry V. Levin  <ldv@altlinux.org>

	tests: raise strace check timeout to 60 seconds.
	* tests/init.sh (check_timeout): New variable.
	* tests/ptrace_setoptions: Use it.
	* tests/strace-f: Likewise.

	Reported-by: Mike Frysinger <vapier@gentoo.org>

2012-05-01  Dmitry V. Levin  <ldv@altlinux.org>

	Update STA_* constants.
	* time.c (adjtimex_status): Add STA_NANO, STA_MODE, and STA_CLK.
	* NEWS (Improvements): Mention it.

	NEWS: update for release.
	* NEWS (Improvements): Mention recent recvmsg/recvmmsg decoders
	enhancements.
	(Portability): Add a recommendation for the minimum Linux kernel
	version to use.

	Make printing of utsname.domainname more portable.
	* configure.ac: Check for struct utsname.domainname field.
	* process.c (sys_uname): Print utsname.domainname when the field is
	available.

2012-05-01  Dmitry V. Levin  <ldv@altlinux.org>

	Fix recvmmsg decode: do not show more data than actually returned.
	This change complements recent fix for recvmsg decoding.

	* net.c (printmmsghdr): Add msg_len parameter to pass down to do_msghdr.
	When this parameter is zero, pass mmsghdr.msg_len to do_msghdr instead.
	(decode_mmsg): Add msg_len parameter, pass it down to printmmsghdr.
	(sys_sendmmsg): Call decode_mmsg with msg_len == (unsigned long) -1L.
	(sys_recvmmsg): Call decode_mmsg with msg_len == 0.

2012-05-01  Dmitry V. Levin  <ldv@altlinux.org>

	Remove recently introduced use of ULONG_MAX.
	* io.c: Remove limits.h inclusion.
	(tprint_iov): Use "(unsigned long) -1L" instead of "ULONG_MAX".
	* net.c: Remove limits.h inclusion.
	(printmmsghdr, sys_sendmsg): Use "(unsigned long) -1L" instead of
	"ULONG_MAX".

2012-04-28  Denys Vlasenko  <vda.linux@googlemail.com>

	Enable printing of uts.domainname in uname syscall.
	* process.c (sys_uname): Enable printing of uts.domainname

2012-04-28  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix printstr's len parameter width.
	We often pass syscall params and other long-sized values
	as printstr(len). Truncating them to int may be a bad thing.

	* defs.h: Change len parameter's type from int to long in
	string_quote and printstr function declarations.
	* util.c (string_quote): Special-case only len==-1, not all len<0.
	(printstr): Likewise.

2012-04-28  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix recvmsg decode: do not show more data than actually returned.
	I noticed that "hostname -d" talks over netlink and gets 20 bytes
	of response, but we show entire 1024 bytes of iov.
	This changes fixes that.

	* defs.h: New function tprint_iov_upto.
	* io.c (tprint_iov_upto): Definition of this function.
	(tprint_iov): Call tprint_iov_upto.
	* net.c (do_msghdr): Add data_size parameter, pass it down to tprint_iov_upto.
	(printmsghdr): Add data_size parameter, pass it down to do_msghdr.
	(printmmsghdr): Call do_msghdr with data_size==ULONG_MAX.
	(sys_sendmsg): Call printmsghdr with data_size==ULONG_MAX.
	(sys_recvmsg): Call printmsghdr with data_size==tcp->u_rval.

2012-04-27  Dmitry V. Levin  <ldv@altlinux.org>

	Package strace-log-merge.
	* strace.spec (%files): Add strace-log-merge.

2012-04-27  Mike Frysinger  <vapier@gentoo.org>

	NEWS: clarify & fix typo.

2012-04-27  Mike Frysinger  <vapier@gentoo.org>

	Cast current_wordsize to an int.
	On 64bit systems with a single personality, we see:
	count.c: In function 'call_summary':
	count.c:223:5: warning: format '%u' expects type 'unsigned int',
		but argument 3 has type 'long unsigned int'

	Since on multi-personality systems this is an array of ints, cast
	the multiplication to an int and update the printf format.

	* count.c (call_summary): Change %u to %d and cast first argument to int.

2012-04-20  Dmitry V. Levin  <ldv@altlinux.org>

	Update NEWS for upcoming 4.7 release.
	* NEWS: Update for 4.7 release.

	Sync strace.spec and debian/ with packages.
	* debian/changelog: Sync with 4.5.20-2.3.
	* debian/control: Likewise.
	* strace.spec: Sync with 4.6-2.

2012-04-18  Mike Frysinger  <vapier@gentoo.org>

	Decode /dev/loop ioctls.
	Needed to debug some losetup failures, and it's easier when you can see
	what the kernel is getting vs what you think you're sending, so add some
	decoders for those ioctls.

	* loop.c: New file.
	* Makefile.am (strace_SOURCES): Add loop.c.
	* defs.h (loop_ioctl): New prototype.
	(string_quote): Likewise.
	* ioctl.c (ioctl_decode): Call loop_ioctl when code is 'L'.
	* util.c (string_quote): Remove static keyword.

2012-04-18  H.J. Lu  <hongjiu.lu@intel.com>

	x32: add ia32 support.
	* Makefile.am (EXTRA_DIST): Add linux/x32/errnoent1.h,
	linux/x32/ioctlent1.h, linux/x32/signalent1.h and
	linux/x32/syscallent1.h.
	* configure.ac: Remove AC_GNU_SOURCE, obsoleted by
	AC_USE_SYSTEM_EXTENSIONS.
	* defs.h (SUPPORTED_PERSONALITIES): Set to 2 for X32.
	(PERSONALITY1_WORDSIZE): Set to 4 for X32.
	* file.c (stat64): New struct for X32.
	(sys_lseek32): New function for X32.
	(stat64): Undef.
	(sys_fstat64): Likewise.
	(sys_stat64): Likewise.
	(realprintstat64): New function for X32.
	(sys_fstat64): Likewise.
	(sys_stat64): Likewise.
	* mem.c (sys_old_mmap): New function for X32.
	* pathtrace.c (pathtrace_match): Also check sys_old_mmap for X32.
	* syscall.c (update_personality): Add X32 support.
	(get_scno): Support currpers == 1 for X32.
	* linux/syscall.h (sys_lseek32): New function prototype for X32.
	* linux/x32/errnoent1.h: New file.
	* linux/x32/ioctlent1.h: Likewise.
	* linux/x32/signalent1.h: Likewise.
	* linux/x32/syscallent1.h: Likewise.

2012-04-17  H.J. Lu  <hongjiu.lu@intel.com>

	Cast clock_t type to unsigned long long.
	* resource.c (sys_times): Cast clock_t type to unsigned long long.
	* signal.c (printsiginfo): Likewise.

2012-04-16  Denys Vlasenko  <vda.linux@googlemail.com>

	Add custom (faster) vfprintf implementation (disabled by default)
	* defs.h: Declare strace_vfprintf either as a alias to vfprintf
	or as a bona fide function. USE_CUSTOM_PRINTF define controls whether
	we use strace_vfprintf. By default, we don't.
	* strace.c (tprintf): Call strace_vfprintf instead of vfprintf.
	* vsprintf.c: New file, implements strace_vfprintf.

2012-04-16  Denys Vlasenko  <vda.linux@googlemail.com>

	Stop using %h[h]u format specifiers.
	This is needed for simplified printf, and reduces code size a bit.

	* block.c (block_ioctl): Cast the value to unsinged and use %u
	instead of using %hu.
	* desc.c (sys_io_cancel): Likewise.
	* resource.c (sys_sysinfo): Likewise.

2012-04-16  Denys Vlasenko  <vda.linux@googlemail.com>

	Trivial speed optimization.
	* strace.c (tprints): Use fputs_unlocked instead of fputs.

2012-04-16  H.J. Lu  <hongjiu.lu@intel.com>

	Fix a problem with sys_lseek on x32.
	* file.c (sys_lseek): Use MIPS-n32 variant also for x32

2012-04-16  H.J. Lu  <hongjiu.lu@intel.com>

	Add x32 support to strace.
	X32 support is added to Linux kernel 3.4. In a nutshell, x32 is x86-64 with
	32bit pointers.  At system call level, x32 is also identical to x86-64,
	as shown by many changes like "defined(X86_64) || defined(X32)".  The
	main differerence bewteen x32 and x86-64 is off_t in x32 is long long
	instead of long.

	This patch adds x32 support to strace.  Tested on Linux/x32.

	* configure.ac: Support X32.
	* defs.h: Set SUPPORTED_PERSONALITIES to 3 for X86_64,
	Set PERSONALITY2_WORDSIZE to 4 for X86_64.
	Add tcb::ext_arg for X32.
	* file.c (stat): New for X32.
	(sys_lseek): Use 64-bit version for X32.
	(printstat64): Check current_personality != 1 for X86_64.
	* ipc.c (indirect_ipccall): Check current_personality == 1
	for X86_64.
	* mem.c (sys_mmap64): Also use tcp->u_arg for X32.  Print NULL
	for zero address.  Call printllval for offset for X32.
	* pathtrace.c (pathtrace_match): Don't check sys_old_mmap for
	X32.
	* process.c (ARG_FLAGS): Defined for X32.
	(ARG_STACK): Likewise.
	(ARG_PTID): Likewise.
	(change_syscall): Handle X32.
	(struct_user_offsets): Support X32.
	(sys_arch_prctl): Likewise.
	* signal.c: Include <asm/sigcontext.h> for X32.
	(SA_RESTORER): Also define for X32.
	* syscall.c (update_personality): Support X32 for X86_64.
	(is_restart_error): Likewise.
	(syscall_fixup_on_sysenter): Likewise.
	(get_syscall_args): Likewise.
	(get_syscall_result): Likewise.
	(get_error): Likewise.
	(__X32_SYSCALL_BIT): Define if not defined.
	(__X32_SYSCALL_MASK): Likewise.
	(get_scno): Check DS register value for X32.  Use
	__X32_SYSCALL_MASK on X32 system calls.
	* util.c (printllval): Use ext_arg for X32.
	(printcall): Support X32.
	(change_syscall): Likewise.
	(arg0_offset): Likewise.
	(arg1_offset): Likewise.
	* Makefile.am (EXTRA_DIST): Add linux/x32/errnoent.h,
	linux/x32/ioctlent.h.in, linux/x32/signalent.h,
	linux/x32/syscallent.h, linux/x86_64/errnoent2.h,
	linux/x86_64/ioctlent2.h, linux/x86_64/signalent2.h and
	linux/x86_64/syscallent2.h.
	* linux/x32/errnoent.h: New.
	* linux/x32/ioctlent.h.in: Likewise.
	* linux/x32/signalent.h: Likewise.
	* linux/x32/syscallent.h: Likewise.
	* linux/x86_64/errnoent2.h: Likewise.
	* linux/x86_64/ioctlent2.h: Likewise.
	* linux/x86_64/signalent2.h: Likewise.
	* linux/x86_64/syscallent2.h: Likewise.

2012-04-16  H.J. Lu  <hongjiu.lu@intel.com>

	Restore tcb::u_lrval; fix lseek on MIPS-n32.
	Linux kernel v3.4 adds x32 support.  Both x32 and n32 use 64bit offset
	for lseek parameter and return value.  We need u_lrval to handle it
	properly.  Also we shouldn't check HAVE_LONG_LONG_OFF_T for n32 lseek.
	This patch fixes it properly and prepares lseek for x32.

	* defs.h (tcb): Restore tcb::u_lrval field, RVAL_Lfoo constants.
	Set RVAL_MASK to 7.
	* file.c (sys_lseek): Print 64bit offset and return RVAL_LUDECIMAL
	for n32.
	* syscall.c (get_error): Set u_lrval for MIPS-n32.
	(trace_syscall_exiting): Handle RVAL_Lfoo return value types.

2012-04-06  Mike Frysinger  <vapier@gentoo.org>

	Decode mtd ioctls.
	I got tired of figuring out mtd structures (which show up a lot
	in the embedded space), so add decoders for those ioctls.

	* defs.h (mtd_ioctl): New prototype.
	(print_loff_t): Likewise.
	* io.c (print_loff_t): Delete static keyword
	* ioctl.c (ioctl_decode): Call mtd_ioctl when code is 'M'.
	* Makefile.am (strace_SOURCES): Add mtd.c.
	(EXTRA_DIST): Add linux/mtd-abi.h.
	* mtd.c: New file.
	* linux/mtd-abi.h: New file.

2012-04-05  Mike Frysinger  <vapier@gentoo.org>

	Fix indefinite hang on no-mmu systems.
	The ptrace setoptions code will fork a child which goes to sleep and
	expects the parent to continue on to do tests.  Unfortunately, this
	does not work on no-mmu systems as fork() is actually vfork() and any
	vforked children will hang the parent until it exits or execs.

	We might be able to make this test work on no-mmu systems with a bit
	of work, but easier to just disable this for the release so it works
	now.

	* strace.c (test_ptrace_setoptions_for_all): Return if strace_vforked.

2012-03-29  Denys Vlasenko  <vda.linux@googlemail.com>

	Makefile.am: whitespace fix.

2012-03-27  Anton Blanchard  <anton@samba.org>

	powerpc: Add syscall entries for direct socket system calls.
	* linux/powerpc/syscallent.h: Add direct socket system calls.

2012-03-26  Dmitry V. Levin  <ldv@altlinux.org>

	qual_syscall: fix potential NULL dereference.
	Fix regression introduced by commit
	c1371ebc400fe9578908beca87f2bf407daf1506

	* syscall.c (qual_syscall): Handle null sys_name.

	Reported-by: Fr. Br. George <george@altlinux.org>

2012-03-26  Dmitry V. Levin  <ldv@altlinux.org>

	strace-log-merge: fix file suffix calculation.
	* strace-log-merge: Quote file prefix to fix file suffix calculation.

	Reported-by: Denys Vlasenko <vda.linux@googlemail.com>
	Suggested-by: Andreas Schwab <schwab@linux-m68k.org>

2012-03-26  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove unreachable code.
	* strace.c (process_opt_p_list): Remove unreachable code.

	manpage: remove false info about -p being limited to 32 processes.

	Tweak help text and manpage (added -In to manpage)

2012-03-25  Dmitry V. Levin  <ldv@altlinux.org>

	printstr: check for potential integer overflow.
	* util.c (printstr): Check for potential integer overflow during outstr
	buffer size calculation.

	Robustify parsing of numbers from strings.
	* defs.h (string_to_uint): New prototype.
	* util.c (string_to_uint): New function.
	* strace.c (error_opt_arg): New function.
	(process_opt_p_list): Use string_to_uint instead of atoi.
	Terminate in case of invalid process id.
	(init): Use string_to_uint instead of atoi.
	Use error_opt_arg in case of invalid option argument.
	* syscall.c (qual_syscall, qual_signal, qual_desc): Use string_to_uint
	instead of atoi.

	strace-log-merge: enhance usage error diagnostics.
	* strace-log-merge: Add --help option.  Check number of arguments.
	Issue an error message when no strace output was merged.

	configure.ac: sort lists and use m4_normalize to ease maintenance.
	* configure.ac (AC_CHECK_FUNCS, AC_CHECK_HEADERS, AC_CHECK_MEMBERS,
	AC_CHECK_DECLS): Sort lists, use m4_normalize.

2012-03-23  Denys Vlasenko  <vda.linux@googlemail.com>

	Simple optimizations.
	Why open-coding isdigit is a good idea?

	Before: call   __ctype_b_loc
	        movzbl (%ebx),%edx
	        mov    (%eax),%eax
	        testb  $0x8,0x1(%eax,%edx,2)
	        je     lbl

	After:  movzbl (%eax),%edx
	        sub    $0x30,%edx
	        cmp    $0x9,%dl
	        ja     lbl

	   text	   data	    bss	    dec	    hex	filename
	 236869	    704	  18944	 256517	  3ea05	strace.before
	 236719	    700	  18944	 256363	  3e96b	strace

	* defs.h: Alias sigemptyset to __sigemptyset on glibc.
	* syscall.c (qual_syscall): Open-code isdigit.
	(qual_desc): Likewise.
	(qual_signal): Open-code isdigit. Remove string copying
	which was done for no apparent reason.

2012-03-23  Denys Vlasenko  <vda.linux@googlemail.com>

	Reorder declarations in defs.h. No code changes.
	* defs.h: Reorder declarations (such as: keep all printing functions together).

2012-03-22  Denys Vlasenko  <vda.linux@googlemail.com>

	Simplify current tcp switching and current column handling.
	Instead of using "static FILE *outf and static unsigned int curcol"
	to cache current outfile and its position, we can simply
	remember current tcb and use its ->outf and ->curcol.
	This allows to drop numerous "tcp->curcol = curcol" ops in trace().

	Turns out we can't drop "static FILE *outf", but now its role is
	a bit clearer: it newer changes after init, stays == stderr or
	opened to shared log (which may be the same thing if neither -o
	nor -ff was specified). Let's rename it then.

	   text	   data	    bss	    dec	    hex	filename
	 236953	    704	  18944	 256601	  3ea59	strace.before.prev.commit
	 236905	    704	  18944	 256553	  3ea29	strace.before
	 236869	    704	  18944	 256517	  3ea05	strace

	* strace.c: Replace curcol static variable by struct tcb *current_tcp.
	Rename static FILE *outf to shared_log (since it no longer caches tcp->outf).
	(ptrace_restart): Use current_tcp->curcol instead of curcol.
	(tprintf): Check current_tcp != NULL instead of outf != NULL.
	Use current_tcp->outf instead of outf, current_tcp->curcol instead of curcol.
	(tprints): Likewise.
	(line_ended): Likewise.
	(printleader): Switch current tcb by "current_tcp = tcp" istead of
	assignments to outf and curcol.
	(droptcb): Set current_tcp to NULL if we dropped it.
	(startup_child): Rename outf to shared_log.
	(init): Likewise.
	(cleanup): Likewise.
	(trace): Simplify current tcp switching and current column handling.

2012-03-22  Denys Vlasenko  <vda.linux@googlemail.com>

	Make threaded execve handling code more reabable and somewhat simpler.
	* strace.c (droptcb): Remove outfname check in "outfname && followfork >= 2" -
	with recent changes, followfork >= 2 check guarantees that outfile
	was specified, and _is already opened_.
	(trace): Move tcb existence check before threaded execve handling.
	This allows to remove tcp != NULL checks in threaded execve handling.
	Rewrite threaded execve handling code to be less indented,
	keeping the same logic.

2012-03-21  Denys Vlasenko  <vda.linux@googlemail.com>

	simple cleanups in defs.h. No logic changes.
	* defs.h: Move offsetof macro definition into "libc stuff" section.
	Renumber TCB_foo constants (smaller constants -> sometimes smaller code).
	Remove uoff macro.
	* process.c: Move uoff macro here (sole user).

	Show "+++ exited..." with -C.
	* strace.c (trace): Show "+++ exited..." with -C too.
	Save tcp->curcol after PTRACE_LISTEN failure too, just in case.

	Slight tweak to qemu_multiarch_testing scripts.

2012-03-21  Denys Vlasenko  <vda.linux@googlemail.com>

	Replace reprinting decision logic.
	After this change, we no longer need to decide when we need
	to set TCB_REPRINT, and when we don't: it's never needed :)

	Well, almost. That pesky pid-changing execve needs special treatment.
	If not it, it'd be possible to nuke TCB_REPRINT...

	While at it, fix a case of mishandled -C.

	* strace.c (printleader): Do not set TCB_REPRINT.
	(trace): Set TCB_REPRINT only for execve with changing pid.
	Fix mishandling of -C.
	* syscall.c (trace_syscall_entering): Do not clear TCB_REPRINT.
	(trace_syscall_exiting): Replace reprinting decision logic.
	Remove call to printargs(): it is known to just return 0 here.

2012-03-21  Denys Vlasenko  <vda.linux@googlemail.com>

	Report some ptrace failures; nuke tcp->ptrace_errno.
	Report some (not all) ptrace errors, namely,
	errors on ptrace restart operations.

	Before: 10533 sendto(-1, 0x804895e, 17, 0, NULL, 0 <unfinished ...>
	After:  10533 sendto(-1, 0x804895e, 17, 0, NULL, 0 <ptrace(SYSCALL):No such process>

	This tells user that strace failed to let sendto syscall
	to be entered - process was dead at that point of time.
	It is (marginally) better than to always say "<unfinished ...>"

	While at it, patch removes tcp->ptrace_errno.
	I added it many months ago, and it looks that after all
	it is not needed for ptrace error detection: I failed to execute
	a single existing code path which is accessible
	through that variable only.

	* defs.h: Remove struct tcp::ptrace_errno field.
	* strace.c (ptrace_restart): Emit message to log on error.
	(printleader): Remove "if (printing_tcp->ptrace_errno)..." code.
	(trace): Remove !tcp->ptrace_errno check, it's always true.

2012-03-20  Denys Vlasenko  <vda.linux@googlemail.com>

	Eliminate redundant checks of res variable.
	* syscall.c (trace_syscall_entering): Eliminate redundant checks of res variable.
	(trace_syscall_exiting): Likewise.

	Rename POWERPC-specific static variable result to ppc_result.
	* syscall.c: Rename POWERPC-specific static variable result to ppc_result.

	Remove redundant checks in syscall entry/exit, rename badly named function
	* syscall.c (syscall_enter): Rename to get_syscall_args.
	Document its return values.
	(trace_syscall_entering): Don't check get_syscall_args() return
	value for 0, it never returns that.
	(syscall_fixup_on_sysexit): Make it return void.
	(trace_syscall_exiting): Fix up syscall_fixup_on_sysexit()
	call site accordingly.

	Trivial tweaks. No logic changes.
	* process.c (sys_ptrace): Remove unneeded line wrapping.
	* syscall.c (trace_syscall_entering): Use tprints() instead of tprintf().

	Make ptrace_restart() static. No code changes.
	* defs.h: Remove ptrace_restart() declaration.
	* strace.c (ptrace_restart): Move its definition here.
	* util.c (ptrace_restart): Remove its definition.

2012-03-20  Dmitry V. Levin  <ldv@altlinux.org>

	Do not include limits.h unnecessarily.
	* ioctl.c: Remove limits.h inclusion left after the reverted change.

2012-03-20  Denys Vlasenko  <vda.linux@googlemail.com>

	Partially revert last change.
	Thank you Dmitry for spotting it.

	* ioctl.c (compare): Partially revert last change - the new
	comparison logic was buggy.

2012-03-20  Denys Vlasenko  <vda.linux@googlemail.com>

	Simplify search in ioctl table.
	   text	   data	    bss	    dec	    hex	filename
	 236973	    704	  18944	 256621	  3ea6d	strace.before
	 236929	    704	  18944	 256577	  3ea41	strace

	* ioctl.c (compare): Simplify generation of compare result.
	(ioctl_lookup): Pass key directly, not as part of dummy struct.
	(ioctl_next_match): More readable code. No logic changes.

2012-03-19  Denys Vlasenko  <vda.linux@googlemail.com>

	Update qemu build script: now tries to upload result back to host.

2012-03-19  Denys Vlasenko  <vda.linux@googlemail.com>

	Shrink space needed by undefined syscalls in syscall tables.
	Undefined syscall looked like this before this change:
	{ 5,    0,      printargs,              "SYS_53"                },
	That is, "SYS_53" string had to be allocated and stored in strace binary.
	Since now SCNO_IN_RANGE() macro requires sysent[scno].sys_func != NULL
	for valid syscalls, we can replace printargs with NULL in such lines
	and make them "invalid", thus not requiring syscall name string.

	Savings on i386:
	   text	   data	    bss	    dec	    hex	filename
	 237389	    704	  18944	 257037	  3ec0d	strace.before
	 236973	    704	  18944	 256621	  3ea6d	strace
	Savings on mips:
	 336551  153692   38320  528563   810b3 strace.before
	 275543  153688   38320  467551   7225f strace

	Tested to still decode undefined syscalls correctly (syscall no. 222 on i386).

	* linux/*/syscallent.h: Replace 'printargs, "SYS_nnn"' with
	'NULL, NULL'.

2012-03-19  Denys Vlasenko  <vda.linux@googlemail.com>

	Optimize code if we have only one personality.
	On i386:
	   text	   data	    bss	    dec	    hex	filename
	 238025	    672	  18980	 257677	  3ee8d	strace.before
	 237389	    704	  18944	 257037	  3ec0d	strace

	* defs.h: Define PERSONALITY0_WORDSIZE as sizeof(long) if not defined.
	Introduce new define, current_wordsize as
	(personality_wordsize[current_personality]).
	Make set_personality() no-op, current_personality constant zero,
	current_wordsize as PERSONALITY0_WORDSIZE if we have only one personality.
	* count.c (call_summary): Use current_wordsize instead of
	personality_wordsize[current_personality].
	* desc.c (printflock): Likewise.
	* file.c (sys_utime): Likewise.
	* io.c (tprint_iov): Likewise.
	* process.c (printargv): Likewise.
	* resource.c (decode_rlimit): Likewise.
	* signal.c (sys_kill): Likewise.
	(sys_rt_sigaction): Likewise.
	* time.c (sprinttv): Likewise.
	(sprint_timespec): Likewise.
	(printitv_bitness): Likewise.
	(tprint_timex): Likewise.
	(printsigevent): Likewise.
	* util.c (dumpiov): Likewise.
	(umoven): Likewise.
	(umovestr): Likewise.
	* syscall.c: Initialize sysent to sysent0 etc.
	Make current_personality, personality_wordsize[], set_personality()
	conditional on SUPPORTED_PERSONALITIES > 1.

2012-03-18  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix mips64 build failure: sys_pwrite64 doesn't exist.
	sys_pwrite seems to do the same thing as sys_pwrite64
	which we deleted when we removed non-Linux code.

	* linux/mips/syscallent.h: s/sys_pwrite64/sys_pwrite/

2012-03-18  Denys Vlasenko  <vda.linux@googlemail.com>

	qemu_multiarch_testing/: a directory with scripts for build testing.

2012-03-18  Denys Vlasenko  <vda.linux@googlemail.com>

	Make internal_fork and internal_exec static.
	   text	   data	    bss	    dec	    hex	filename
	 237917	    672	  18980	 257569	  3ee21	strace
	 237845	    672	  18980	 257497	  3edd9	strace_new

	* defs.h: Remove declarations of internal_fork and internal_exec.
	* process.c: Remove definitions of internal_fork and internal_exec.
	* syscall.c: Move them here.
	(internal_syscall): Return void instead of int. We were always
	returning zero, and callers weren't checking it anyway.

2012-03-18  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove code which is not used on Linux.
	Compile tested in qemu on armv4l,armv4tl,armv5l,armv6l,i686,
	mipsel,mips,x86_64

	* syscall.c: Remove code which handles RVAL_Lfoo constants.
	* defs.h: Remove struct tcb::u_lrval member - it is never set.
	Remove RVAL_Lfoo constants which signify return of "long" result -
	they are never used.

2012-03-18  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove unused version of sys_lseek.
	It is buggy: it returns RVAL_LUDECIMAL, which means the return value
	is in tcp->u_lrval. But tcp->u_lrval is never set
	(on Linux - it used to be set on other OSes).

	* file.c (sys_lseek): Remove a version of this function which is
	supposed to be used if off_t is long long. It appears to be buggy
	and unused.

2012-03-17  Denys Vlasenko  <vda.linux@googlemail.com>

	Revert "Remove underscores from a few syscall names which have them"
	This reverts commit 31972d52b1059d8faca1c5f417c2db1a90b868ae.

2012-03-17  Denys Vlasenko  <vda.linux@googlemail.com>

	Simplify sys_lseek64 conditional compilation.
	It looks like sys_lseek64() is never used.
	For one, it is buggy (always shows 0 return value), and no one complains.

	From code inspection: sys_lseek64 name is not used anywhere.
	It is defined to sys_lseek if HAVE_LONG_LONG_OFF_T is true.
	Thus, if !HAVE_LONG_LONG_OFF_T, it is never used.
	Therefore "if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T"
	conditional it sits in can be simplified to
	"if HAVE_LONG_LONG_OFF_T".
	Therefore, we can move it a bit up and merge with
	"if !HAVE_LONG_LONG_OFF_T, use this sys_lseek()" code block,
	by addind an "else" clause to it.
	To simplify it more, drop define and just rename sys_lseek64 ->
	sys_lseek.

	Since the function is buggy, I think it is unused and we can
	just drop it. (I checked: at least I386 never uses it).

	* file.c (sys_lseek64): Rename to sys_lseek; don't compile it
	if _LFS64_LARGEFILE but !HAVE_LONG_LONG_OFF_T since in this case
	it is never used.

2012-03-17  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove underscores from a few syscall names which have them.
	Affected names are "_newselect", "_llseek", "_sysctl".
	I see no apparent reason why they have leading underscores.
	Moreover, some arches have underscored names and some have
	non-underscored ones. This is not consistent.

	I verified that every architectire I touched did not have
	a similarly named syscall without underscore, thus this change
	does not introduce new ambiquities.

	I left "_exit" untouched for now, but the same points stand for it too:
	some architectures use "exit" and no one complains. So why many
	arches are using "_exit"?

	* linux/*/syscallent.h: Remove underscores from displayed
	syscall names for _newselect, _llseek, _sysctl.

2012-03-17  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove unused struct tcb::baddr field.
	* defs.h: Remove unused struct tcb::baddr field.

	Remove unused PTRACE_WRITE{TEXT,DATA} constants (they are from SunOS)
	* util.c: Remove unused PTRACE_WRITE{TEXT,DATA} constants.

	Reindent case labels. No code changes.
	* net.c (printsockopt): Reindent case labels.
	* signal.c (sys_signal): Likewise.

	Remove unused constants. No code changes.
	* syscall.c: Remove unused ENOIOCTLCMD constant. Fix indentation.
	* util.c: Remove unused CLONE_STOPPED constant.

	Move change_syscall() to its only user and make it static.
	* defs.h: Remove declaration of change_syscall().
	* process.c (change_syscall): Remove definition of this function.
	* util.c (change_syscall): Add definition of change_syscall().

	MAP_ANON is the same as MAP_ANONYMOUS, no need to have the former.
	* mem.c: Do not allocate string for MAP_ANON if it is the same as
	MAP_ANONYMOUS.

	Indentation and whitespace fixes. No code changes.

	test/threaded_execve: make it also test a case when leader is not in syscall

2012-03-16  Dmitry V. Levin  <ldv@altlinux.org>

	Implement prlimit64 decoding, rewrite [gs]etrlimit decoding.
	* configure.ac: Remove AC_RLIM_T_IS_LONG_LONG call.
	Define SIZEOF_RLIM_T.
	* m4/long_long.m4 (AC_RLIM_T_IS_LONG_LONG): Remove.
	* linux/dummy.h (sys_prlimit64): Remove.
	* linux/syscall.h (sys_prlimit64): New prototype.
	* resource.c (resources): Reindent, add RLIMIT_RTTIME.
	(sprintrlim, print_rlimit32, sys_getrlimit, sys_setrlimit): Remove.
	[HAVE_LONG_LONG_RLIM_T]: Remove dead code.
	[_LFS64_LARGEFILE || HAVE_LONG_LONG_RLIM_T]: Likewise.
	(sprint_rlim64, print_rlimit64, decode_rlimit64, sprint_rlim32,
	print_rlimit32, decode_rlimit, sys_getrlimit, sys_setrlimit,
	sys_prlimit64): New functions.

2012-03-16  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove another "interrupt to quit" message.
	* strace.c (startup_attach): Remove another "interrupt to quit" message.

	Fix "strace -oFILE -ff -p<nonexistant_pid>" behavior.
	* strace.c (newoutf): Set tcp->outf in non-ff mode too.
	(alloctcb): This define is removed.
	(alloc_tcb): Renamed to alloctcb. Does not set tcp->outf anymore.
	Lost 'command_options_parsed' flag parameter.
	(startup_attach): Do not say "interrupt to quit" in attach message -
	^C does not work in all cases, we mislead users.
	Call newoutf(tcp) after successful attach.
	(startup_child): Call newoutf(tcp) after successful attach.
	(trace): Call newoutf(tcp) when we picked up already attached child.

2012-03-16  Denys Vlasenko  <vda.linux@googlemail.com>

	Make alloc_tcb and droptcb static. No code changes.
	The change is trivial. Diff is large because it is confused
	by function definitions being moved around.

	* defs.h: Remove declarations of alloc_tcb and droptcb.
	* strace.c: Make alloc_tcb and droptcb static.
	Shuffle functions around to make compiler happy.

2012-03-16  Denys Vlasenko  <vda.linux@googlemail.com>

	Tidy up includes and copyright notices, fix indentation.
	The files not mentioned in changelog below had only
	copyright notices fixes and indentation fixes.

	* defs.h: Include <stdint.h> and <inttypes.h>.
	* file.c: Do not include <inttypes.h>.
	Move struct kernel_dirent declaration below top include block.
	* block.c: Do not include <stdint.h> and <inttypes.h>.
	* quota.c: Likewise.
	* desc.c: Likewise.
	* signal.c: Likewise.

2012-03-16  Dmitry V. Levin  <ldv@altlinux.org>

	scsi.c: add copyright header.
	* scsi.c: This file was added back in 2007 without a copyright header.
	Add it now.

2012-03-15  Dmitry V. Levin  <ldv@altlinux.org>

	Enhance capget and capset syscalls decoding.
	* system.c (cap_version): New xlat structure.
	(print_cap_header, print_cap_data): New functions.
	(sys_capget, sys_capset): Use them.

	Remove unused code.
	* syscall.c (subcall_style, decode_subcall): Remove.
	[SYS_socket_subcall] (decode_socket_subcall): New function, based on
	decode_subcall in deref_style.
	[SYS_ipc_subcall] (decode_ipc_subcall): New function, based on
	decode_subcall in shift_style.
	(trace_syscall_entering): Use decode_socket_subcall and
	decode_ipc_subcall instead of decode_subcall.

	Fix IPC decoding on alpha and arm.
	* ipc.c (indirect_ipccall): Return 0 on ALPHA and ARM EABI.
	(sys_shmat): Use indirect_ipccall for proper return value decoding.

	arm: fix compilation warnings.
	* configure.ac: Define SIZEOF_LONG.
	* signal.c (sys_rt_sigaction) [SUPPORTED_PERSONALITIES > 1]: Help
	compiler to optimize out unreachable code that is not expected to work
	on platforms where sizeof(long) <= 4.

2012-03-15  Dmitry V. Levin  <ldv@altlinux.org>

	tests: robustify again buggy shells.
	* tests/init.sh (check_strace): Use "${parameter:-word}" shell syntax
	instead of "${parameter-word}".

	Reported-by: Mike Frysinger <vapier@gentoo.org>

2012-03-15  Mike Frysinger  <vapier@gentoo.org>

	improve ifdef check with decode_subcall.
	Use the same ifdef logic around the call sites of decode_subcall()
	to protect the definition of the func itself.  This fixes warnings
	for targets like hppa which don't use this func.

	* syscall.c (decode_subcall): Wrap in SYS_socket_subcall and
	SYS_ipc_subcall define checks.

2012-03-15  Mike Frysinger  <vapier@gentoo.org>

	alpha: fix decode of osf_sigprocmask.
	The alpha sigprocmask syscall is special in that it comes from OSF rather
	than the style that everyone else uses.

	Tested with this simple code:
	$ cat test.c
	#include <signal.h>
	main() {
		sigset_t set, oldset;
		sigemptyset(&set);
		sigaddset(&set, SIGINT);
		sigaddset(&set, SIGHUP);
		sigprocmask(SIG_SETMASK, &set, &oldset);
		sigprocmask(SIG_UNBLOCK, &oldset, &set);
		sleep(3);
	}
	$ gcc test.c && ./strace ./a.out
	...
	osf_sigprocmask(SIG_SETMASK, [HUP INT]) = 0 (old mask [])
	osf_sigprocmask(SIG_UNBLOCK, [])        = 0x3 (old mask [HUP INT])
	osf_sigprocmask(SIG_BLOCK, [CHLD])      = 0x3 (old mask [HUP INT])
	...

	* linux/alpha/syscallent.h: Call sys_sigprocmask for osf_sigprocmask,
	and change number of arguments to two.
	* signal.c (sys_sigprocmask): Fix decoding of alpha osf sigprocmask.

2012-03-15  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix array size calculation in previous commit.
	* pathtrace.c (getfdpath): Fix array size calculation.

2012-03-15  Denys Vlasenko  <vda.linux@googlemail.com>

	pathtrace_select() is never called with NULL, remove dead code.
	pathtrace_select() is only called for -P FILE options,
	and FILE is never a NULL pointer.

	   text	   data	    bss	    dec	    hex	filename
	 239453	    672	  19012	 259137	  3f441	strace.before
	 239329	    672	  19012	 259013	  3f3c5	strace

	* pathtrace.c (pathtrace_select): Remove "if (path == NULL)...".
	(pathtrace_select): Remove code which only executes if path == NULL.
	The code was also buggy, it can free non-malloced pointer.
	(getfdpath): Simplify snprintf to sprintf.
	(pathmatch): Use strcmp() == 0 idiom for string equality test.
	(pathtrace_match): Likewise.

2012-03-15  Denys Vlasenko  <vda.linux@googlemail.com>

	manpage: remove bugs which are fixed.
	"A traced process ignores SIGSTOP" - fixed, expected to be in linux-3.4.x.
	"A traced process which tries to block SIGTRAP will be sent a SIGSTOP
	in an attempt to force continuation of tracing." - not needed
	and no longer done.
	"On Linux, exciting as it would be, tracing the init process is forbidden"
	- not true anymore.
	"When a traced process receives a SIGTRAP signal not
	associated with tracing, strace will not report that signal correctly."
	- not true anymore.

	Simplify SIGCHLD handler setting.
	* strace.c (init): Set SIGCHLD to SIG_DFL earlier.
	(startup_child): Do not bother restoring SIGCHLD handler.

	When reporting signals, use short signal names (SIGfoo) instead of strerror
	* defs.h: Remove strsignal declaration.
	* signal.c: Better check for SI_FROMUSER define.
	* strace.c (strerror): Remove this function.
	(trace): Use short signal names (SIGfoo) instead of strerror.

	Remove TODO file: it's eleven years old and completely outdated.

	Clean up defs.h order. No code changes.
	* defs.h: Group together related declarations. No code changes.

2012-03-15  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix lame kernel version checking code.
	The code "os_release[0] >= '3'" is not good for any
	finer-grained checks such as "kernel >= 3.2.1".
	Let's proactively fix it.

	* strace.c: Change os_release from string to integer.
	(get_os_release): Parse uname.release to KERNEL_VERSION
	representation.
	(init): Convert kernel version check to KERNEL_VERSION.

2012-03-15  Denys Vlasenko  <vda.linux@googlemail.com>

	Experimental support for "detach on execve" feature.
	* strace.c: Define new detach_on_execve, skip_startup_execve bool variables.
	(init): Set detach_on_execve on -b, set skip_startup_execve if
	"strace PROG" form is used.
	(trace): Detach from process if -b and we see PTRACE_EVENT_EXEC event.

	Simple fixes.
	* strace.c (usage): Document -d; document that -F is deprecated.
	(droptcb): Print "<detached ...>" correctly for non-ff mode too.
	(detach): Suppress a warning.

	Remove an outdated comment.
	* defs.h: Remove an outdated comment.

	Remove extra include directives. No code changes.
	* defs.h: Include <signal.h> unconditionally.
	Other files were doing it unconditionally, so no harm done.
	* bjm.c: Remove system includes which are already included by defs.h.
	* pathtrace.c: Likewise.
	* process.c: Likewise.
	* signal.c: Likewise.
	* strace.c: Likewise.
	* stream.c: Likewise.
	* syscall.c: Likewise.
	* system.c: Likewise.
	* util.c: Likewise.

2012-03-15  Denys Vlasenko  <vda.linux@googlemail.com>

	Tidy up order of includes; make bool variables explicit.
	Bool variables are more compact in data and (on x86) on code too:

	   text	   data	    bss	    dec	    hex	filename
	 237950	    676	  19044	 257670	  3ee86	strace.before
	 237838	    676	  19012	 257526	  3edf6	strace

	* defs.h: Group library includes at the top of the file.
	Rename dtime to Tflag, debug to debug_flag.
	Change debug_flag,Tflag,qflag,not_failing_only,show_fd_path,tracing_paths
	variable declarations from int to bool.
	* strace.c: Change corresponding definitions. Do the same for static
	variables iflag,rflag,print_pid_pfx.
	Rename dtime to Tflag, debug to debug_flag.
	* syscall.c: Rename dtime to Tflag, debug to debug_flag.

2012-03-15  Dmitry V. Levin  <ldv@altlinux.org>

	Fix compiler warnings about breaking strict-aliasing rules.
	* system.c (sys_capget, sys_capset): Use proxy unions to cast long*
	pointers to cap_user_header_t and cap_user_data_t pointers without
	breaking strict-aliasing rules.

	Reported-by: Mike Frysinger <vapier@gentoo.org>

2012-03-15  Mike Frysinger  <vapier@gentoo.org>

	ppc64: drop unused pid variable.
	* syscall.c (get_scno) [POWERPC64]: Delete unused pid variable.

2012-03-15  Dmitry V. Levin  <ldv@altlinux.org>

	ia64: fix compilation warnings.
	* linux/ia64/syscallent.h: Remove improper defines and undefs.

	Reported-by: Mike Frysinger <vapier@gentoo.org>

2012-03-15  Dmitry V. Levin  <ldv@altlinux.org>

	Ensure that SWAP_FLAG_* constants are defined.
	* file.c: Define those of SWAP_FLAG_* constants which are not yet
	provided by <sys/swap.h>.

	Reported-by: Mike Frysinger <vapier@gentoo.org>

2012-03-14  Dmitry V. Levin  <ldv@altlinux.org>

	Enhance *listxattr syscalls decoding.
	* file.c (print_xattr_list): New function.
	(sys_listxattr, sys_flistxattr): Use it.

2012-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	Fix *at syscalls flags decoding.
	Several *at decoders were defining own incomplete *atflags xlat
	structures.  That was error prone, and fchownat decoder actually
	failed to recognize AT_EMPTY_PATH.  Merging these incomplete
	structures into the single at_flags xlat structure will fix
	flags handling in all these decoders altogether.

	* file.c: Define all AT_* constants used by *at decoders.
	(at_flags): New xlat structure, with records for all AT_* constants.
	(fstatatflags, linkat_flags, unlinkatflags): Remove.
	(sys_newfstatat, sys_linkat, sys_unlinkat, sys_fchownat,
	sys_utimensat):  Use at_flags.

2012-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	Fix linkat flags decoding.
	* file.c (linkat_flags): New xlat structure.
	(sys_linkat): Decode flags using linkat_flags.

	Implement sys_rt_tgsigqueueinfo syscall decoder.
	* linux/dummy.h (sys_rt_tgsigqueueinfo): Remove.
	* linux/syscall.h (sys_rt_tgsigqueueinfo): New prototype.
	* signal.c (print_sigqueueinfo): New function, based on
	sys_rt_sigqueueinfo.
	(sys_rt_sigqueueinfo): Use print_sigqueueinfo.
	(sys_rt_tgsigqueueinfo): New function.

	Implement syslog syscall decoder.
	* linux/dummy.h (sys_syslog): Remove.
	* linux/syscall.h (sys_syslog): New prototype.
	* system.c (syslog_action_type): New xlat structure.
	(sys_syslog): New function.

2012-03-13  Denys Vlasenko  <vda.linux@googlemail.com>

	Less ugly debug display of ptrace events.
	* strace.c (trace): Less ugly debug display of ptrace events.

	Make manpage mention that -p "`pidof PROG`" works.

2012-03-13  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix logging for "strace -o FILE -ff test/threaded_execve" test case.
	Our logic which was deciding whether to print "<unfinished ...>"
	thingy wasn't working properly for -ff case.

	* defs.h: Group log generation-related declarations together.
	Add a large comment which explains how it works.
	Add declaration of line_ended() function.
	* strace.c (line_ended): New function which sets up internal data
	to indicate that previous line was finished.
	(printleader): Change logic to fix log generation in -ff mode.
	(newoutf): Make check for -ff mode consistent with other places.
	(droptcb): Print "<detached ...>" if last line for this tcp wasn't finished.
	(cleanup): Remove code to print "<unfinished ...>", printleader()
	or detach() will do it instead.
	(trace): Remove code to print "<unfinished ...>".
	Add code which finishes threaded execve's incomplete line
	with " <pid changed to PID ...>" message. Replace printing_tcp = NULL
	followed by fflush() by line_ended() call.
	* process.c (sys_exit): Call line_ended() to indicate that we finished priting.
	* syscall.c (trace_syscall_exiting): Set printing_tcp to current tcp.
	Call line_ended() to indicate that we finished priting.
	Remove call to fflush(), it is done by line_ended() now.

2012-03-13  Dmitry V. Levin  <ldv@altlinux.org>

	net.c: recognize MSG_WAITFORONE.
	* net.c (msg_flags): Add MSG_WAITFORONE.

2012-03-12  Denys Vlasenko  <vda.linux@googlemail.com>

	Treat -ff without -o FILE as single -f.
	* strace.c (init): Treat -ff without -o FILE as single -f.

	Style fix. No code changes.
	* strace.c (process_opt_p_list): Style fix.

2012-03-12  Denys Vlasenko  <vda.linux@googlemail.com>

	Reduce stack usage by ~0.5k.
	main() uses ~0.5k of stack for local variables and such. When we enter
	main tracing loop, most of these variables are no longer used.
	But they still take up stack for the entire life of strace.
	We can avoid this wastage if we move init code into a separate function.
	(Need to be careful and not allow automatic inlining).

	* strace.c (init): New function. Most of pre-existing code of
	main is now living here.
	(main): Call init() to do initialization.

2012-03-12  Denys Vlasenko  <vda.linux@googlemail.com>

	Preparatory cosmetic changes for the next commit.
	* strace.c (tprintf): Move function up in the source file. No code changes.
	(tprints): Likewise.
	(printleader): Likewise.
	(tabto): Likewise.

2012-03-11  Dmitry V. Levin  <ldv@altlinux.org>

	Implement sendmmsg syscall decoder.
	* linux/dummy.h (sys_sendmmsg): Remove.
	* linux/syscall.h (sys_sendmmsg): New prototype.
	* net.c (printmmsghdr): Add index argument specifying the element in
	mmsghdr array to print.
	(decode_mmsg): New function, prints the whole mmsghdr array, its length
	and message flags.
	(sys_sendmmsg): New function.
	(sys_recvmmsg): Use decode_mmsg to fix mmsghdr array decoding.

	Implement sched_rr_get_interval syscall decoder.
	* linux/dummy.h (sys_sched_rr_get_interval): Remove.
	* linux/syscall.h (sys_sched_rr_get_interval): New prototype.
	* process.c (sys_sched_rr_get_interval): New function.

	Implement migrate_pages syscall decoder.
	* linux/dummy.h (sys_migrate_pages): Remove.
	* linux/syscall.h (sys_migrate_pages): New prototype.
	* mem.c (sys_migrate_pages): New function.

	Implement get_robust_list syscall decoder.
	* linux/dummy.h (sys_get_robust_list): Remove.
	* linux/syscall.h (sys_get_robust_list): New prototype.
	* process.c (sys_get_robust_list): New function.

	Define sys_set_robust_list as an alias to sys_munmap.
	* linux/dummy.h (sys_set_robust_list): Redefine to sys_munmap.

	Implement clock_adjtime syscall decoder.
	* linux/dummy.h (sys_clock_adjtime): Remove.
	* linux/syscall.h (sys_clock_adjtime): New prototype.
	* time.c (do_adjtimex): New function, based on sys_adjtimex.
	(sys_adjtimex): Use it.
	(sys_clock_adjtime): New function.

	Define sys_setns as an alias to sys_inotify_rm_watch.
	* linux/dummy.h (sys_setns): Redefine to sys_inotify_rm_watch.

	Sort definitions of dummy parsers.  No code changes.
	* linux/dummy.h: Sort definitions of parsers implemented as aliases.

	Correct inotify_rm_watch decoder.
	* file.c (sys_inotify_rm_watch): Print second argument as int.

	Alias sys_fsync to sys_close.
	* file.c (sys_fsync): Remove.
	* linux/syscall.h (sys_fsync): Likewise.
	* linux/dummy.h (sys_fsync): Alias to sys_close.
	* linux/m68k/syscallent.h: Add TD flag to fsync entry.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent.h: Likewise.

2012-03-10  Dmitry V. Levin  <ldv@altlinux.org>

	Update ioctl entries.
	* linux/ioctlent.h.in: Regenerate from v3.3 headers.
	* linux/i386/ioctlent.h.in: Likewise.

	strace-log-merge: cleanup.
	* strace-log-merge: Redirect usage to stderr, make the check
	for numeric suffix simpler.

	Add syscall entries for new linux syscalls.
	* linux/i386/syscallent.h: Update process_vm_writev handler.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/alpha/syscallent.h: Add entries for accept4 and sendmmsg.
	* linux/arm/syscallent.h: Add entries for process_vm_readv and
	process_vm_writev.
	* linux/m68k/syscallent.h: Likewise.
	* linux/mips/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/ia64/syscallent.h: Add entries for process_vm_readv,
	process_vm_writev and accept4.
	* linux/microblaze/syscallent.h: Add entries for sendmmsg,
	process_vm_readv and process_vm_writev.

	Implement process_vm_writev decoder.
	* process.c (sys_process_vm_writev): New function.
	* linux/syscall.h (sys_process_vm_writev): New prototype.

	Output iovec length in vmsplice and process_vm_readv decoders.
	* io.c (sys_vmsplice): Output iovec length.
	* process.c (sys_process_vm_readv): Likewise.

2012-03-09  Dmitry V. Levin  <ldv@altlinux.org>

	swapon: decode swap flags.
	* file.c: Include <sys/swap.h>.
	(swap_flags): New xlat structure.
	(sys_swapon): New function.
	* linux/dummy.h (sys_swapon): Remove.
	* linux/syscall.h (sys_swapon): New declaration.

2012-03-09  Denys Vlasenko  <vda.linux@googlemail.com>

	Trivial simplification.
	* strace.c (detach): Use waitpid instead of wait4.

2012-03-09  Denys Vlasenko  <vda.linux@googlemail.com>

	Don't consider PROG to be our child in "strace -D PROG" case.
	TCB_STRACE_CHILD is used for the case when "strace PROG" is ^C-ed
	or something like that. strace should not just exit - it should
	do something with its child (such as signal it too).

	In -D case, PROG is not really a child of _strace_, it is a child
	of strace's parent. It's ok to handle it exactly as an attached process.

	While we are at it, remove nonsensical special-casing of TCB_STRACE_CHILD
	in printing of "<unfinished ...>" message.

	* strace.c (startup_attach): Don't set TCB_STRACE_CHILD if -D.
	(trace): Print "<unfinished ...>" on error regardless of TCB_STRACE_CHILD.

2012-03-09  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix the case where we try to detach unattached processes.
	Before this change:
	$ strace -D -p1
	strace: -D and -p are mutually exclusive options
	Process 1 detached  <==== WRONG! (and we try to SIGSTOP it!!!)

	* defs.h: Change the meaning of TCB_ATTACHED: now it means "this tracee
	is attached to us". Add TCB_STRACE_CHILD: "this tracee is our child".
	* strace.c (kill_save_errno): Move up. No code changes.
	(process_opt_p_list): Don't set TCB_ATTACHED on new tcb.
	(startup_attach): Change how we work with TCB_ATTACHED.
	Set TCB_STRACE_CHILD on -D.
	(startup_child): Use kill_save_errno instead of kill.
	Set TCB_ATTACHED and TCB_STRACE_CHILD on attached strace child.
	If we are in -D case, don't set TCB_ATTACHED (we aren't attached yet).
	(detach): do not do PTRACE_DETACH if TCB_ATTACHED is not set.
	(cleanup): Check TCB_STRACE_CHILD instead of TCB_ATTACHED.
	(trace): Likewise.

2012-03-09  Denys Vlasenko  <vda.linux@googlemail.com>

	Call PTRACE_CONT with addr=0.
	* strace.c (trace): Call PTRACE_CONT with addr=0.

	install strace-log-merge by "make install"

	strace_log_merge: new file. Helper to merge timestamped strace -ff logs.

2012-03-09  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix PID prefix printing in "strace -oLOG -ff -p1 -p2 -p3" case.
	In this case we were printing PIDs to LOG.* files
	even though it is not necessary.

	The fix is in the addition of "&& followfork < 2" condition.

	* strace.c: Remove pflag_seen variable, add print_pid_pfx one.
	(process_opt_p_list): Do not pflag_seen++.
	(main): Use "nprocs != 0" condition instead of "pflag_seen != 0".
	Set print_pid_pfx before entering main tracing loop.
	(printleader): Use print_pid_pfx to decide whether to print pid prefix.

2012-03-09  Denys Vlasenko  <vda.linux@googlemail.com>

	Allow -p PID to take comma or whitespace-separated list of PIDs.
	* defs.h: Clarify meaning of TCB_ATTACHED. No code changes.
	* strace.c (process_opt_p_list): New function.
	(main): Call process_opt_p_list to process -p PIDs argument.

2012-03-08  Denys Vlasenko  <vda.linux@googlemail.com>

	Pass addr=0 instead of 1 into restarting ptrace calls.
	While we are at it, fold do_ptrace into its lone caller.
	We no longer set tcp->ptrace_errno = ESRCH on ESRC error in upeek.
	Other code paths where ptrace fails wern't doing it, and the code which
	checks tcp->ptrace_errno even assumes it is never set to ESRCH.
	(It was me who added this code sometime ago, so it was my fault
	that it was a bit messy)

	I ran sigkill_rain test and verified that unfinished syscalls are
	still handled correctly.

	* util.c (ptrace_restart): Do not pass addr=1 to ptrace(), pass 0 instead.
	I have no idea why we were passing 1. Ptrace documentation says
	that addr parameter is ignored.
	(do_ptrace): Remove this function.
	(upeek): Use ptrace() instead of do_ptrace().
	* defs.h: Remove do_ptrace() declaration.

2012-03-08  Denys Vlasenko  <vda.linux@googlemail.com>

	Trivial tweaks to error messages.
	* strace.c (test_ptrace_setoptions_followfork): Use kill_save_errno
	instead of kill.
	(trace): Use perror_msg instead of perror.
	* count.c (set_sortby): Use error_msg_and_die instead of fprintf.
	* syscall.c (qualify): Likewise.
	* util.c (ptrace_restart): Expand error message.
	(umoven): Likewise.
	(umovestr): Likewise.
	(upeek): Use perror_msg instead of sprintf + perror.

2012-02-28  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove stray sys_swapon() declaration.
	* linux/syscall.h: Remove stray sys_swapon() declaration.
	* linux/mips/syscallent.h: Include dummy.h with correct relative path.
	* linux/dummy.h: Tweak one place where spaces are used instead of tabs.
	* linux/dummy_check.sh: New script. It helps in finding stray syscall
	handler declarations.

2012-02-27  Denys Vlasenko  <vda.linux@googlemail.com>

	Correct syscall entries for t[g]kill.
	* linux/hppa/syscallent.h: Make tgkill use sys_tgkill, not printargs.
	* linux/sh/syscallent.h: Change tkill type TD -> TS.
	* linux/sh64/syscallent.h: Likewise.
	* linux/mips/syscallent.h: Change tkill type 0 -> TS.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/avr32/syscallent.h: Likewise.

2012-02-27  Denys Vlasenko  <vda.linux@googlemail.com>

	Assorted trivial optimizations.
	   text	   data	    bss	    dec	    hex	filename
	 236448	    672	  19044	 256164	  3e8a4	strace.before
	 236360	    672	  19044	 256076	  3e84c	strace

	* file.c (sprintmode): Use smaller static buffer, eliminate strlen call.
	(sprinttime): Use smaller static buffer.
	(printstat_sparc64): Coalesce two printing calls into one.
	(printstat_powerpc32): Likewise.
	(printcompat_statfs6): Likewise.
	(sys_utime): Do not fetch personality_wordsize[current_personality]
	repeatedly - cache it in local variable instead.
	* process.c (printargv): Likewise.
	* resource.c (sprintrlim): Return const char*, not char*. This allows
	to eliminate sprintf(buf, "RLIM_INFINITY"). Use smaller static buffer.
	(sprintrlim64): Likewise.
	* strace.c (strerror): Use smaller static buffer.
	(strsignal): Likewise.

2012-02-27  Denys Vlasenko  <vda.linux@googlemail.com>

	Alias a few more syscall printing functions.
	   text	   data	    bss	    dec	    hex	filename
	 237384	    672	  19044	 257100	  3ec4c	strace.before
	 236448	    672	  19044	 256164	  3e8a4	strace

	* defs.h: Declare new functions printargs_lu(), printargs_ld()
	which simply print syscall all args as unsigned or signed longs.
	* desc.c (sys_epoll_create): Call printargs_ld() instead of open-coding it.
	* linux/syscall.h: Remove declarations of the following functions:
	sys_alarm, sys_getresgid, sys_getsid, sys_nice, sys_setgid, sys_setpgid,
	sys_setpgrp, sys_setregid, sys_setresgid.
	* process.c (sys_setgid): Delete this function: now aliased to sys_setuid().
	(sys_getresgid): Delete this function: now aliased to sys_getresuid().
	(sys_setregid): Delete this function: now aliased to sys_setreuid().
	(sys_setresgid): Delete this function: now aliased to sys_setresuid().
	(sys_setpgrp): Delete this function: now aliased to printargs_lu().
	(sys_getsid): Likewise.
	(sys_setpgid): Likewise.
	(sys_alarm): Likewise.
	(sys_getpgrp): Delete this function: was unused - was already shadowed
	by a define in linux/dummy.h.
	(sys_setsid): Likewise.
	(sys_getpgid): Likewise.
	* resource.c (sys_nice): Delete this function: now aliased to printargs_ld().
	* linux/dummy.h: Define new aliases (see above for the list).
	* syscall.c (printargs_lu): New function.
	(printargs_ld): New function.

2012-02-27  Denys Vlasenko  <vda.linux@googlemail.com>

	Style fixes, no code changes.
	* desc.c (sys_io_getevents): Indentation fix.
	* file.c (sys_xstat): Remove space after function name.
	(decode_mknod): Indentation fix.
	* net.c (printsockopt): Indentation fix.
	* process.c (unalignctl_string): Indentation fix.
	(sys_sched_getscheduler): Remove space after ! operator.

2012-02-25  Dmitry V. Levin  <ldv@altlinux.org>

	Compress blank lines.
	Suppress repeated empty lines left after automated code removal.
	This change was made by filtering every source code file through
	"cat -s".

2012-02-25  Dmitry V. Levin  <ldv@altlinux.org>

	Remove parts of automake machinery which are not needed on Linux.
	This change is a verbatim part of Dmitry's changes to remove support
	for non-Linux architectures.

	* Makefile.am: Don't install PORTING file. Install README-linux-ptrace file.
	Set OS variable to linux unconditionally.
	* configure.ac: Remove code to set opsys variable, and its usage.
	Remove checks for headers which are never present on Linux.
	* m4/stat.m4: Remove 'ifdef LINUX' check.
	* m4/statfs.m4: Likewise.

2012-02-25  Dmitry V. Levin  <ldv@altlinux.org>

	Remove and update documentation.
	This change is a verbatim part of Dmitry's changes to remove support
	for non-Linux architectures.

	* PORTING: Deleted.
	* INSTALL: Modified.
	* README: Modified.
	* strace.1: Modified: bugs should be reported to mailing list, not Debian.
	* strace.spec: do not install PORTING file.

2012-02-25  Denys Vlasenko  <vda.linux@googlemail.com>

	Remove a few more code parts which are unused on Linux.
	This change is abapted from Dmitry's changes to remove support for
	non-Linux architectures.

	* Makefile.am: Remove if LINUX/endif pairs.
	* defs.h: Remove stream_ioctl() declaration.
	* ioctl.c (ioctl_decode): Remove 'ifdef HAVE_SYS_STREAM_H' block.
	* resource.c: Use 'defined(FOO)' instead of 'defined FOO' form.
	* util.c: Likewise.
	* signal.c: Remove conditional includes which are never used on Linux.
	* stream.c: Likewise.
	* file.c: Remove excessive empty lines.

2012-02-25  Denys Vlasenko  <vda.linux@googlemail.com>

	Build fixes after non-Linux code removal.
	* configure.ac: Remove calls to proc-based ptrace checks.
	* proc.c: Remove, it's empty now.
	* Makefile.am: Remove reference to proc.c.
	* net.c: Remove trailing newlines.
	* quota.c: Likewise
	* resource.c: Likewise
	* strace.c: Likewise
	* stream.c: Likewise
	* time.c: Likewise

	Fix defined(FOO) style.
	* file.c: Consistently use defined(FOO) instead of defined (FOO).
	* mem.c: Likewise.
	* net.c: Likewise.
	* signal.c: Likewise.
	* sock.c: Likewise.
	* linux/mips/syscallent.h: Likewise.

	Reindent preprocessor directives in util.c; fix style.
	* util.c: Fix indentation of preprocessor directives broken by
	automatic removal of non-Linux code. Fix style to use consistent
	defined(FOO) instead of defined (FOO).

	Reindent preprocessor directives in syscall.c; fix style.
	* syscall.c: Fix indentation of preprocessor directives broken by
	automatic removal of non-Linux code. Fix style to use consistent
	defined(FOO) instead of defined (FOO).

	Reindent defs.h preprocessor directives.
	* defs.h: Fix indentation of preprocessor directives broken by
	automatic removal of non-Linux code.

	Cleanup after non-Linux code removal.
	Conditions such as defined(LINUX) are always true now,
	defined(FREEBSD) etc are always false.
	When if directive has them as subexpressions, it can be simplified.
	Another trivial changes here are fixes for directive indentation.

2012-02-25  Denys Vlasenko  <vda.linux@googlemail.com>

	Manual removal of non-Linux source, documentation, etc.
	Remove non-Linux source directories: freebsd/, svr4/, sunos4/, svr4/.
	Remove README-freebsd, README-sunos4, README-svr4, m4/procfs.m4.

	linux/sparc/{errnoent1,ioctlent1,signalent1}.h used to point to svr4/ files -
	replace their contents with copies of used (and now deleted) files.
	Make linux/sparc64/{errnoent1,ioctlent1,signalent1}.h include these files
	instead of svr4/* ones.

	Makefile.am: remove references to deleted files.
	configure.ac: Remove a few tests which make no sense on Linux.
	Man page: remove non-Linux quirks information.

2012-02-25  Denys Vlasenko  <vda.linux@googlemail.com>

	Automated removal of non-Linux code.
	This change is generated by running every source through the following command:

	unifdef -DLINUX -Dlinux -USUNOS4 -USVR4 -UUNIXWARE -UFREEBSD
	-USUNOS4_KERNEL_ARCH_KLUDGE -UHAVE_MP_PROCFS
	-UHAVE_POLLABLE_PROCFS -UHAVE_PR_SYSCALL -UUSE_PROCFS file.c

2012-02-24  Denys Vlasenko  <vda.linux@googlemail.com>

	When accessing data blocks, truncate addr to wordsize.
	* util.c (umoven): Truncate addr to wordsize before use.

2012-02-22  Dmitry V. Levin  <ldv@altlinux.org>

	strace.1: fix a typo.
	* strace.1: Fix a typo in example description.
	This fixes Debian bug #653309.

	Fix sockaddr_un.sun_path name in decoded output.
	* net.c (printsock): Show sockaddr_un.sun_path as "sun_path".
	This fixes Debian bug #554946.

	Avoid potential core file clobbering on exit.
	* strace.c (main): Set RLIMIT_CORE to zero before terminating itself
	with a deadly signal.
	This fixes Debian bug #656398.

2012-02-20  Dmitry V. Levin  <ldv@altlinux.org>

	Eliminate native_scno and known_scno.
	* defs.h (known_scno): Remove.
	(sysent): Remove native_scno field.
	* process.c [IA64]: Replace known_scno(tcp) with tcp->scno.
	(internal_fork) [USE_PROCFS || !LINUX]: Likewise.
	* syscall.c: Do not define NR_SYSCALL_BASE.
	(known_scno): Remove.
	(syscall_fixup_on_sysenter) [USE_PROCFS]: Replace known_scno(tcp)
	with tcp->scno.
	(trace_syscall_entering) [SVR4 || FREEBSD || SUNOS4]: Likewise.
	(syscall_fixup_on_sysexit) [SUNOS4]: Likewise.

	Remove initialization of native_scno field.
	* linux/i386/syscallent.h: Remove native_scno initialization for clone,
	fork and vfork.
	* linux/ia64/syscallent.h (sys_fork, sys_vfork): Remove redirections
	to printargs.
	* linux/syscall.h [IA64]: Do not define SYS_fork and SYS_vfork.
	* util.c (printcall) [IA64]: Likewise.
	(setbpt): Use sys_func to check for clone, fork and vfork syscalls.

	Do not use SYS_ipc and SYS_socketcall.
	* linux/dummy.h (sys_ipc, sys_socketcall): Remove redirections to
	printargs.
	* linux/ia64/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Remove native_scno initialization for "ipc"
	and "socketcall".
	* linux/syscall.h (sys_ipc, sys_socketcall): New prototypes.
	(SYS_ipc, SYS_socketcall): Remove no longer used constants.
	[IA64]: Remove undefining of ipc and socket SYS_* constants.
	[SPARC || SPARC64]: Remove unused ipc SYS_* constants.
	* ipc.c (sys_ipc): New function.
	* sock.c (sys_socketcall): Likewise.
	* syscall.c (trace_syscall_entering): Use sys_func to check for ipc and
	socket subcalls.

2012-02-20  Dmitry V. Levin  <ldv@altlinux.org>

	Remove initialization of native_scno field for most of syscalls.
	The native_scno field is not so much used in the code than before.
	In many cases sys_func is checked instead, and for most of syscall
	entries there is no need to initialize native_scno.

	* linux/i386/syscallent.h: Remove native_scno initialization for
	_exit, read, write, waitpid, execve, wait4, sysfs, readv, writev,
	pread64, pwrite64, exit_group, waitid, send, recv, sendto and
	recvfrom syscall entries.
	* linux/syscall.h: Do not define no longer used SYS_waitid and
	SYS_sub_* constants.
	[IA64]: Do not define SYS_waitpid and SYS32_* constants.
	* defs.h: Do not define no longer used  __NR_exit_group constant.
	* strace.c [USE_PROCFS] (proc_open): Use sys_func to check for execve.

2012-02-14  Mike Frysinger  <vapier@gentoo.org>

	util: check for process_vm_readv in C library.
	glibc-2.15 provides process_vm_readv, so trying to provide it ourselves
	with that version fails.

	* configure.ac (AC_CHECK_FUNCS): Add process_vm_readv.
	* util.c: Handle HAVE_PROCESS_VM_READV.

2012-02-09  Denys Vlasenko  <vda.linux@googlemail.com>

	README-linux-ptrace: correct the description of suppressed signals.

2012-02-06  Dmitry V. Levin  <ldv@altlinux.org>

	strace -P: fix handling of invalid syscalls.
	* pathtrace.c (pathtrace_match): Check the given syscall number using
	SCNO_IN_RANGE.

2012-02-06  H.J. Lu  <hongjiu.lu@intel.com>

	Skip the syscall entry if the sys_func field is NULL.
	Avoid NULL dereference when there are holes in sysent tables.
	It can happen with syscall (number, ...) and number is in those holes.
	There are no targets with holey systent tables so far, but at least
	one such a target, x32, is already on the horizon.

	* defs.h (SCNO_IN_RANGE): Also check the sys_func field.

2012-02-06  H.J. Lu  <hongjiu.lu@intel.com>

	Define RLIM64_INFINITY only if not defined.
	* resource.c (RLIM64_INFINITY): Define only if it isn't defined.

2012-02-06  H.J. Lu  <hongjiu.lu@intel.com>

	Cast to long for %l in printf.
	Cast a value to long for %l in printf to avoid compiler warning
	on systems where it may be long long.

	* count.c (call_summary_pers): Cast to long.
	* ipc.c (sys_mq_open, printmqattr): Likewise.
	* quota.c (decode_cmd_data): Likewise.
	* resource.c (sys_sysinfo): Likewise.
	* time.c (tprint_timex): Likewise.

2012-02-06  H.J. Lu  <hongjiu.lu@intel.com>

	Check HAVE_LONG_LONG_OFF_T when printing offset.
	When HAVE_LONG_LONG_OFF_T is defined, we need to use %llu to print
	offset.

	* io.c (sys_sendfile): Check HAVE_LONG_LONG_OFF_T when printing
	offset.

2012-02-06  H.J. Lu  <hongjiu.lu@intel.com>

	Define old stat functions only if needed.
	When HAVE_LONG_LONG_OFF_T is defined, those old stat functions aren't
	used and strace won't link since they use realprintstat which isn't
	defined when HAVE_LONG_LONG_OFF_T is defined.

	* file.c (convertoldstat, sys_oldstat, sys_oldfstat, sys_oldlstat):
	Define only if HAVE_LONG_LONG_OFF_T isn't defined.

2012-02-06  H.J. Lu  <hongjiu.lu@intel.com>

	Print NULL for zero address in sys_mmap64.
	* mem.c (sys_mmap64): Print NULL for zero address so that it is
	consistent with sys_mmap.

2012-02-04  Dmitry V. Levin  <ldv@altlinux.org>

	Remove unused sys_pread64 and sys_pwrite64 parsers on Linux.
	* io.c [HAVE_LONG_LONG_OFF_T]: Remove sys_pread64 and sys_pwrite64
	aliases.
	(sys_pread64, sys_pwrite64): Define these functions only on
	[SVR4 && _LFS64_LARGEFILE] platform.
	* linux/mips/syscallent.h: Use sys_pread and sys_pwrite to handle
	appropriate syscalls.
	* linux/syscall.h (sys_pread64, sys_pwrite64): Remove.
	* syscall.c (dumpio): Check sys_pread64 and sys_pwrite64 only on
	[SVR4 && _LFS64_LARGEFILE] platform.

2012-02-03  Denys Vlasenko  <vda.linux@googlemail.com>

	Trivial changes to help text. No code changes.
	* strace.c (usage): Tweak help text: remove unpaired closing brackets,
	make -V and -h sit on separate lines (hard to see them otherwise).

2012-01-29  Denys Vlasenko  <vda.linux@googlemail.com>

	Simple optimizations.
	   text	   data	    bss	    dec	    hex	filename
	 239474	    672	  20484	 260630	  3fa16	strace.before
	 239234	    668	  19044	 258946	  3f382	strace

	* file.c (sprint_open_modes): Reduce static buffer size.
	Simplify separator printing.
	* signal.c (sprintsigmask): Reduce static buffer size.
	Simplify separator printing and printing of almost full masks.
	Use stpcpy instead of sprintf and strcpy+strlen.
	* strace.c (startup_child): Don't strchr() for ':' twice in a row.
	* util.c (sprintflags): Exit loop early if possible.

2012-01-29  Denys Vlasenko  <vda.linux@googlemail.com>

	Trivial optimization.
	* strace.c (cleanup): Read 'interrupted' volatile variable only once.

2012-01-29  Denys Vlasenko  <vda.linux@googlemail.com>

	Make interactive-ness directly controllable via command line option.
	Defaults are often ok, but when they are not, people get confused.
	"Why can't I kill strace?" and "Why strace dies on ^C when I want
	to _tracee_ to die instead?" are typical complaints.

	* strace.c: Replace 'interactive' variable with 'opt_intr' variable.
	Define INTR_foo constants for its possible values.
	Define 'interactive' as a macro.
	(usage): Document -I n option.
	(main): Parse -I n option, modify signal handling to accomidate new
	-I 1 and -I 4 modes.

2012-01-29  Denys Vlasenko  <vda.linux@googlemail.com>

	Suppress compiler warning.
	* strace.c (trace): Frame potentially unused label with ifdef/endif.

	On Ctrl-C induced detach, send SIGINT to child tracee, not SIGTERM.
	* strace.c (interrupt): Remember signal number.
	(cleanup): If we exiting due to signal, send that signal to child tracee.

2012-01-29  Denys Vlasenko  <vda.linux@googlemail.com>

	Add experimental code to use PTRACE_SEIZE, disabled by default.
	All new code is predicated on "ifdef USE_SEIZE". If it is not defined,
	behavior is not changed.

	If USE_SEIZE is enabled and run-time check shows that PTRACE_SEIZE works, then:
	- All attaching is done with PTRACE_SEIZE + PTRACE_INTERRUPT.
	  This means that we no longer generate (and possibly race with) SIGSTOP.
	- PTRACE_EVENT_STOP will be generated if tracee is group-stopped.
	  When we detect it, we issue PTRACE_LISTEN instead of PTRACE_SYSCALL.
	  This leaves tracee stopped. This fixes the inability to SIGSTOP or ^Z
	  a straced process.

	* defs.h: Add commented-out "define USE_SEIZE 1" and define PTRACE_SEIZE
	and related constants.
	* strace.c: New variable post_attach_sigstop shows whether we age going
	to expect SIGSTOP on attach (IOW: are we going to use PTRACE_SEIZE).
	(ptrace_attach_or_seize): New function. Uses PTRACE_ATTACH or
	PTRACE_SEIZE + PTRACE_INTERRUPT to attach to given pid.
	(startup_attach): Use ptrace_attach_or_seize() instead of ptrace(PTRACE_ATTACH).
	(startup_child): Conditionally use alternative attach method using PTRACE_SEIZE.
	(test_ptrace_setoptions_followfork): More robust parameters to PTRACE_TRACEME.
	(test_ptrace_seize): New function to test whether PTRACE_SEIZE works.
	(main): Call test_ptrace_seize() while initializing.
	(trace): If PTRACE_EVENT_STOP is seen, restart using PTRACE_LISTEN in order
	to not let tracee run.
	* process.c: Decode PTRACE_SEIZE, PTRACE_INTERRUPT, PTRACE_LISTEN.
	* util.c (ptrace_restart): Add "LISTEN" to a possible error message.

2012-01-28  Denys Vlasenko  <vda.linux@googlemail.com>

	process_vm_readv gets EINVAL if process is gone (SIGKILLed). Don't complain.
	* util.c (umoven): Don't complain on EINVAL from process_vm_readv.
	(umovestr): Likewise.

	Revert last change. Add a comment to prevent further misunderstanding.
	* time.c (sys_nanosleep): Display remaining time only on interrupt.

	Fix nanosleep decoding: second argument was not shown after success.
	* time.c (sys_nanosleep): Fix bug - inverted is_restart_error() check.
	* syscall.c (is_restart_error): Remove redundant check.

2012-01-28  Denys Vlasenko  <vda.linux@googlemail.com>

	Use process_vm_readv instead of PTRACE_PEEKDATA to read data blocks.
	Currently, we use PTRACE_PEEKDATA to read things like filenames and
	data passed by I/O syscalls.
	PTRACE_PEEKDATA gets one word per syscall. This is VERY expensive.
	For example, in order to print fstat syscall, we need to perform
	more than twenty trips into kernel to fetch one struct stat!

	Kernel 3.2 got a new syscall, process_vm_readv(), which can be used to
	copy data blocks out of process' address space.

	This change uses it in umoven() and umovestr() functions if possible,
	with fallback to old method if process_vm_readv() fails.
	If it returns ENOSYS, we don't try to use it anymore, eliminating
	overhead of trying it on older kernels.

	Result of "time strace -oLOG ls -l /usr/lib >/dev/null":
	before patch: 0.372s
	After patch:  0.262s

	* util.c (process_vm_readv): Wrapper to call process_vm_readv syscall.
	(umoven): Use process_vm_readv for block reads of tracee memory.
	(umovestr): Likewise.
	* linux/syscall.h: Declare new function sys_process_vm_readv.
	* process.c (sys_process_vm_readv): Decoder for new syscall.
	* linux/i386/syscallent.h: Add process_vm_readv, process_vm_writev syscalls.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.

2012-01-28  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix a case of broken output if last seen syscall was exit.
	* defs.h: Rename tcp_last to printing_tcp. Explain what it means.
	Remove printtrailer() function.
	* process.c (sys_exit): Convert printtrailer() call to "printing_tcp = NULL".
	* strace.c: Add new variable printing_tcp.
	(cleanup): Convert printtrailer() call to "printing_tcp = NULL".
	(trace): Likewise.
	(trace): Fix checks for incomplete line - it was working wrongly if last syscall was exit.
	(printleader): Set printing_tcp.
	(printtrailer): Remove this function.
	* syscall.c: Remove tcp_last variable.
	(trace_syscall_entering): Don't set printing_tcp, printleader call now does it.
	(trace_syscall_exiting): Convert printtrailer() call to "printing_tcp = NULL".

2012-01-28  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix handling of test/threaded_execve.c testcase.
	Since 3.0, Linux has a way to identify which thread execve'ed.
	This patch makes use of it in order to properly dispose
	of disappeared ("superseded") thread leader,
	and replace it with execve'ed thread.

	Before this patch, strace was "leaking" thread which exec'ed.
	It was thinking that it still runs. It would look like this:

	18460 pause( <unfinished ...>     <=== thread leader
	18466 execve("/proc/self/exe", ["exe", "exe"], [/* 47 vars */] <unfinished ...>
	18465 +++ exited with 0 +++       <=== exits from other threads
	18460 <... pause resumed> )             = 0

	The last line is wrong: it's not pause resumed, it's execve resumed.
	If thread leader would do exit instead of pause, it is much worse:
	strace panics because it thinks it sees return from exit syscall!

	And strace isn't aware 18466 (exec'ed thread) is gone.
	It still thinks it's executes execve syscall.

	* strace.c: New variable "static char *os_release".
	(get_os_release): New static function.
	(main): Call get_os_release to retrieve Linux version.
	(trace): If we see PTRACE_EVENT_EXEC, retrieve old pid, and if it
	differs from new one, free one of tcbs and print correct messages.

2012-01-27  Denys Vlasenko  <vda.linux@googlemail.com>

	Fix readlink result display - was printing bogus "..." semi-randomly.
	* file.c (decode_readlink): Use printstr() instead of printpathn().

	Add new test program: test/threaded_execve.c.

	Make pid2tcb static.
	* defs.h: Remove pid2tcb declaration.
	* strace.c (pid2tcb): Make this function static.

2012-01-24  Denys Vlasenko  <vda.linux@googlemail.com>

	Per Dmitry's request, remove paranoid check in verror_msg()
	* strace.c (verror_msg): Remove redundant check for msg != NULL.

	More robust error check for vasprintf.
	* strace.c (verror_msg): More robust error check for vasprintf.

2012-01-24  Denys Vlasenko  <vda.linux@googlemail.com>

	Slightly more compact handling of argv[]
	   text	   data	    bss	    dec	    hex	filename
	 238274	    672	  20484	 259430	  3f566	strace.before
	 238226	    672	  20484	 259382	  3f536	strace

	* strace.c (main): Slightly more compact handling of argv[]

2012-01-24  Denys Vlasenko  <vda.linux@googlemail.com>

	Trivial optimization.
	* strace.c: Set default interactive = 1 statically instead
	of doing it in main().

2012-01-24  Denys Vlasenko  <vda.linux@googlemail.com>

	Allocate -o OUTFILE buffer only if needed.
	   text	   data	    bss	    dec	    hex	filename
	 238258	    668	  28676	 267602	  41552	strace.before
	 238274	    668	  20484	 259426	  3f562	strace

	* strace.c (main): Allocate -o OUTFILE buffer only if needed:
	unused buffer in bss is not entirely free.

2012-01-24  Denys Vlasenko  <vda.linux@googlemail.com>

	Use single fprintf in verror_msg()
	This change partially reverts commit 44d0532.

	In code before commit 44d0532, single fprintf was used on purpose:
	we want to send entire message as one write() call. Since stderr
	is unbuffered, separate fprintf's to it always result in separate
	writes, they are not coalesced. If we aren't the only program
	which writes to this particular stderr, this may result
	in interleaved messages.

	Since this function is not performance critical, I guess
	it's ok to make it less efficient.

	* strace.c (verror_msg): Attempt to print the message in single
	write operation. Use separate fprintfs as a fallback if malloc fails.

2012-01-21  Denys Vlasenko  <vda.linux@googlemail.com>

	Improve code readability (logic is unchanged)
	* util.c (umoven): Move assignment out of function call. Make assignment
	to a flag variable later, closer to the place where it will be used.
	(umovestr): Likewise.
	(uload): Likewise.

2012-01-20  Denys Vlasenko  <vda.linux@googlemail.com>

	Change umovestr API: return > 0 instead of 0 if NUL was seen.
	* pathtrace.c (upathmatch): Adjust umovestr return value check for new API.
	* util.c (printpathn): Use umovestr() > 0 return value for more efficient
	(and robust - we don't depend on "no overwrote past NUL" behavior anymore)
	handling of terminating NUL.
	(printstr): Remove useless NUL placement before umovestr() call.
	Allocate 1 byte more to outstr[] array - for NUL.
	(umovestr): Change to return 1 if NUL was seen.

	umovestr result may have no NUL, use "%.*s" instead of "%s" to print it.
	* system.c (sys_mount): Be careful when printing umovestr result,
	it may have no terminating NUL.
	(sys_sysmips): Likewise.

2012-01-20  Denys Vlasenko  <vda.linux@googlemail.com>

	Eliminate code duplication in time printing, reduce a few static buffers
	   text	   data	    bss	    dec	    hex	filename
	 238454	    664	  28772	 267890	  41672	strace.before
	 238106	    664	  28676	 267446	  414b6	strace

	* defs.h: Add TIMESPEC_TEXT_BUFSIZE and TIMEVAL_TEXT_BUFSIZE defines.
	Add 'int special' parameter to sprinttv().
	* time.c (sprinttv): Add 'int special' parameter, and use it
	similarly to 'int special' parameter of printtv_bitness().
	(printtv_bitness): Use sprinttv() instead of duplicating its code.
	(print_timespec): Use sprint_timespec() instead of duplicating
	its code.
	* desc.c (decode_select): Use TIMEVAL_TEXT_BUFSIZE instead of 128
	when checking remaining buffer size.
	* net.c (sys_recvmsg): Use TIMESPEC_TEXT_BUFSIZE instead of 128
	for static buffer size.
	* stream.c (decode_poll): Use TIMESPEC_TEXT_BUFSIZE instead of 128
	when checking remaining buffer size.

2012-01-19  Denys Vlasenko  <dvlasenk@redhat.com>

	Reduce bss usage and speed up string printing.
	   text	   data	    bss	    dec	    hex	filename
	 237913	    660	  49284	 287857	  46471	strace.before
	 237973	    660	  28772	 267405	  4148d	strace

	This reduces L1 D-cache pressure a bit: instead of dirtying
	20k of bss, we will reuse already dirty stack area.

	* util.c (printpathn): Use on-stack buffers instead of static ones.
	Saves 5*MAXPATHLEN in bss.
	(printstr): Use tprints() instead of tprintf("%s") when printing
	formatted string. May be a bit faster, depending on libc.

2012-01-18  Andreas Schwab  <schwab@linux-m68k.org>

	Add support for compat_statfs64.
	* file.c (struct compat_statfs64, printcompat_statfs64): Define.
	(sys_statfs64, sys_fstatfs64): Use it.

	Add support for statfs64.f_flags.
	* file.c (printstatfs64): Print f_flags if available.

	Fix missing parens.
	* signal.c (sys_sigreturn): Add missing parens.

2012-01-18  Denys Vlasenko  <dvlasenk@redhat.com>

	Get rid of TCB_SIGTRAPPED.
	On attempts to block or set SIGTRAP handler,
	for example, using sigaction syscall, we generate
	an additional SIGSTOP.

	This change gets rid of this SIGSTOP sending/ignoring.
	It appears to work just fine.

	It also works if I force strace to not use PTRACE_O_TRACESYSGOOD,
	which means strace stops will be marked with SIGTRAP,
	not (SIGTRAP | 0x80) - I wondered maybe that's when
	this hack is needed.

	So, why we even have TCB_SIGTRAPPED? No one knows. It predates
	version control: this code was present in the initial commit,
	in 1999. No adequate comments, either.

	Moreover, TCB_SIGTRAPPED is not set in sys_rt_sigaction
	and sys_sigprocmask syscalls - the ones which are most usually
	used to implement signal blocking, it is only set in obsolete
	sys_signal, sys_sigaction, sys_sigsetmask, and in some dead
	non-Linux code.

	I think whatever bug it was fixing is gone long ago -
	at least as long as sys_rt_sigaction is used by glibc.
	Again, since glibc (and uclibc) uses sys_rt_sigaction
	and sys_sigprocmask, modified code paths are not used
	by most programs anyway.

	* defs.h: Remove definition of TCB_SIGTRAPPED.
	* signal.c (sys_sigvec): Don't set TCB_SIGTRAPPED and don't send SIGSTOP.
	(sys_sigsetmask): Likewise.
	(sys_sigaction): Likewise.
	(sys_signal): Likewise.
	* strace.c (trace): Remove code which executes if TCB_SIGTRAPPED is set.

2012-01-18  Denys Vlasenko  <dvlasenk@redhat.com>

	When we write log, flush output buffers in a few more cases.
	I observed a case when signal delivery message was buffered
	by stdio until it was flushed along with the next syscall
	entry message.

	* strace.c (trace): Flush output buffers in a few more cases.

2012-01-18  Denys Vlasenko  <dvlasenk@redhat.com>

	Fix old sigaction display.
	* signal.c (sys_sigaction): Fix display of sigaction with
	SIG_DFL/SIG_IGN handlers.

	Change x86_64_regs struct type from pt_regs to user_regs_struct.
	* syscall.c: Change x86_64_regs struct type from
	pt_regs to user_regs_struct, and explain the change in comment.

2012-01-17  Dmitry V. Levin  <ldv@altlinux.org>

	Fix struct pt_regs declaration on i386 and x86-64.
	* defs.h [I386] (i386_regs): Replace definition with declaration.
	[X86_64] (x86_64_regs): Remove.
	* syscall.c [X86_64] (x86_64_regs): Make static.

2012-01-12  Denys Vlasenko  <dvlasenk@redhat.com>

	Make ERESTARTxyz messages more descriptive.
	There is widespread confusion about exact meaning
	of ERESTARTxyz codes. Before this change, we were showing
	all four of them the same: as "(To be restarted)".

	This change prints better explanations for these codes,
	and contains verbose comments which explain *why* we display
	codes that way - or else someone confused
	is bound to come later and mangle them again.
	New messages are:

	ERESTARTSYS (To be restarted if SA_RESTART is set)
	ERESTARTNOINTR (To be restarted)
	ERESTARTNOHAND (Interrupted by signal)
	ERESTART_RESTARTBLOCK (Interrupted by signal)

	* syscall.c (trace_syscall_exiting): Make ERESTARTxyz messages
	more descriptive.

2012-01-10  Denys Vlasenko  <dvlasenk@redhat.com>

	Fix sigreturn arg count from 1 to 0 on all architectures.
	* linux/alpha/syscallent.h: Change [rt_]sigreturn's arg count to 0.
	* linux/arm/syscallent.h: Likewise.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/tile/syscallent.h: Likewise.

2012-01-10  Denys Vlasenko  <dvlasenk@redhat.com>

	Display mask on enter to sigreturn, not on exit.
	sys_sigreturn() performs ugly manipulations in order to show
	signal mask which is restored by this syscall: on syscall entry,
	fetches it from the stack, saves it in tcp->u_arg[]
	(where it used to overflow this array - fixed sometime ago),
	then retrieves the mask and displays it on syscall exit.

	Apparently, the motivation is to make it slightly more obvious
	to user that signal mask is restored only when this syscall returns.
	IMO, this hardly justifies the necessary hacks. It is much easier
	to display the mask at the point when we fetch it - on syscall entry.

	While at it, I made it so that we do display returned value/errno.
	I see no point in hiding it and showing uninformative "= ?" instead.

	Example of pause() being interrupted by ALRM which has installed handler
	which re-arms ALRM:

	Before the patch:

	rt_sigsuspend([INT])                    = ? ERESTARTNOHAND (To be restarted)
	--- {si_signo=SIGALRM, si_code=SI_KERNEL} (Alarm clock) ---
	alarm(1)                                = 0
	sigreturn()                             = ? (mask now [INT])

	After:

	rt_sigsuspend([INT])                    = ? ERESTARTNOHAND (To be restarted)
	--- {si_signo=SIGALRM, si_code=SI_KERNEL} (Alarm clock) ---
	alarm(1)                                = 0
	sigreturn() (mask [INT])                = -1 EINTR (Interrupted system call)

	* defs.h: Declare struct pt_regs i386_regs and struct pt_regs x86_64_regs.
	* syscall.c: Remove "static" keywork from these structures' definitions.
	* signal.c (sys_sigreturn): Display mask on enter, not on exit.

2012-01-04  Denys Vlasenko  <dvlasenk@redhat.com>

	Do not detach from tracee which experienced ptrace error.
	Before this patch, if a thread got nuked by exit in another thread
	and we happened to poke it at the same time, we print "????(" thingy
	and detach the thread. Since we removed "detach before death" logic,
	this no longer matches the behavior of other threads.
	Before patch:
	[pid  1780] exit_group(1)               = ?
	[pid  1778] ????( <unfinished ...>
	Process 1778 detached
	[pid  5860] +++ exited with 1 +++
	After:
	[pid 17765] exit_group(1)               = ?
	[pid 21680] ????( <unfinished ...>
	[pid 17791] +++ exited with 1 +++
	[pid 21680] +++ exited with 1 +++

	* strace (trace): Do not detach from tracee which experienced ptrace error.

2012-01-04  Denys Vlasenko  <dvlasenk@redhat.com>

	Remove sig parameter from detach()
	* strace.c (detach): Drop sig parameter - it is zero in all calls.
	(cleanup): Don't pass sig = 0 to detach() call.
	(detach): Ditto.

2011-12-26  Dmitry V. Levin  <ldv@altlinux.org>

	Enhance decoding for personalities with small wordsize.
	* util.c (umoven, umovestr) [SUPPORTED_PERSONALITIES > 1]: If current
	personality's wordsize is less than sizeof(long), use only significant
	bits of the given address.

2011-12-23  Dmitry V. Levin  <ldv@altlinux.org>

	Enhance personality switching.
	On syscall entry, save current personality in the tcb structure
	along with scno.
	On syscall exit, restore current personality from the tcb structure.
	* defs.h (struct tcb) [SUPPORTED_PERSONALITIES > 1]: Add currpers
	field.
	* strace.c (alloc_tcb) [SUPPORTED_PERSONALITIES > 1]: Initialize
	tcp->currpers.
	* syscall.c (update_personality) [SUPPORTED_PERSONALITIES > 1]: New
	function.
	(get_scno, trace_syscall_exiting): Use it.

	Reported-by: Michael A Fetterman <mafetter@nvidia.com>

2011-12-01  Dmitry V. Levin  <ldv@altlinux.org>

	* net.c (socktcpoptions): Add more TCP_* constants from linux/tcp.h.
	Reported-by: Rick Jones <rick.jones2@hp.com>

2011-12-01  Heiko Carstens  <heiko.carstens@de.ibm.com>

	Fix sys_ipc/sys_semtimedop decoding on s390.
	The s390 kernel sys_ipc system call only takes five arguments instead of
	six arguments which the common code sys_ipc implementation takes.
	One of the arguments of the sys_semtimedop subcall is therefore passed in
	a different register than in the common code implementation.
	This leads to broken decoding of the timespec argument:

	semtimedop(0, 0x3ffffb43832, 1, {...})  = -1 EAGAIN

	Fixed it looks like this:

	semtimedop(0, 0x3ffffc2c842, 1, {0, 10000000}) = -1 EINTR

	* linux/ipc.c (sys_semtimedop): Fix timespec decoding on s390.

2011-11-29  Dmitry V. Levin  <ldv@altlinux.org>

	strace.c (trace): Fix compilation warning.

2011-11-28  Dmitry V. Levin  <ldv@altlinux.org>

	linux/syscall.h: Remove redundant function declarations.
	Remove 51 function declarations aliased to other declarations in
	linux/dummy.h file.

	linux/syscall.h: Sort function declarations.

	linux/syscall.h: Place one function declaration per line.

	Remove redundant parsers.
	* desc.c (sys_dup): Remove.
	* file.c (sys_pivotroot, sys_rmdir, sys_fchdir, sys_chroot, sys_fchroot,
	sys_unlink, sys_symlink, sys_rename): Remove.
	* linux/syscall.h (sys_chroot, sys_dup, sys_fchdir, sys_pivotroot,
	sys_rename, sys_rmdir, sys_symlink, sys_unlink): Remove.
	* linux/dummy.h: Add aliases for sys_chroot, sys_dup, sys_pivotroot,
	sys_rename, sys_rmdir, sys_symlink, sys_unlink.
	* pathtrace.c (pathtrace_match): Update.
	* sunos4/dummy.h: Add aliases for sys_chroot, sys_dup, sys_fchdir,
	sys_fchroot, sys_rename, sys_rmdir, sys_symlink, sys_unlink.
	* svr4/dummy.h: Likewise.
	* sunos4/syscall.h (sys_chroot, sys_dup, sys_fchdir, sys_fchroot,
	sys_rename, sys_rmdir, sys_symlink, sys_unlink): Remove.
	* svr4/syscall.h (sys_chroot, sys_dup, sys_fchdir, sys_fchroot,
	sys_rename, sys_rmdir, sys_symlink, sys_unlink): Remove.

	Reflect the fact that nfsservctl syscall was removed from linux kernels.
	linux/dummy.h: Move nfsservctl to "unimplemented" section.

2011-11-27  Dmitry V. Levin  <ldv@altlinux.org>

	x86_64: add getcpu syscall entry.
	* linux/x86_64/syscallent.h: Add syscall entry for getcpu.

2011-11-26  Dmitry V. Levin  <ldv@altlinux.org>

	Add syscall entries for new linux syscalls.
	* linux/dummy.h: Add printargs parsers for new syscalls.
	* linux/arm/syscallent.h: Add entries for sys_clock_adjtime,
	sys_name_to_handle_at, sys_open_by_handle_at, sys_sendmmsg, sys_setns
	and sys_syncfs.
	* linux/i386/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/mips/syscallent.h: Likewise.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/alpha/syscallent.h: Add entries for sys_clock_adjtime,
	sys_name_to_handle_at, sys_open_by_handle_at, sys_setns and sys_syncfs.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/s390/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* linux/avr32/syscallent.h: Add entry for sys_setns.
	* linux/bfin/syscallent.h: Add entries for sys_sendmmsg and sys_setns.
	* linux/hppa/syscallent.h: Add entries for sys_clock_adjtime,
	fanotify_init, fanotify_mark, sys_name_to_handle_at,
	sys_open_by_handle_at, sys_sendmmsg, sys_setns and sys_syncfs.

	Fix prctl syscall entries.
	* linux/mips/syscallent.h: Fix prctl handler.
	* linux/tile/syscallent.h: Likewise.

	arm: fix io_* syscall entries.
	* linux/arm/syscallent.h: Fix handlers for io_setup, io_destroy,
	io_getevents, io_submit and io_cancel.

	Fix mincore syscall entries.
	* linux/arm/syscallent.h: Fix mincore handler.
	* linux/avr32/syscallent.h: Likewise.
	* linux/mips/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.

2011-11-25  Dmitry V. Levin  <ldv@altlinux.org>

	Fix sendmsg syscall entries.
	* linux/arm/syscallent.h: Fix number of sendmsg arguments.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/hppa/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/tile/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.

	Fix epoll_wait syscall entries.
	* linux/arm/syscallent.h: Fix epoll_wait flags and handler.
	* linux/m68k/syscallent.h: Fix epoll_wait flags.
	* linux/microblaze/syscallent.h: Fix number of epoll_wait arguments.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.

	Fix epoll_ctl syscall entries.
	* linux/arm/syscallent.h: Fix epoll_ctl flags and handler.
	* linux/m68k/syscallent.h: Fix epoll_ctl flags.
	* linux/x86_64/syscallent.h: Fix number of epoll_ctl arguments.

	arm: fix epoll_create syscall entry.
	* linux/arm/syscallent.h: Fix epoll_create handler.

	Fix mlockall syscall entries.
	* linux/arm/syscallent.h: Fix number of mlockall arguments.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/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/tile/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.

	Fix epoll_pwait syscall entries.
	* linux/alpha/syscallent.h: Fix number of epoll_pwait arguments.
	* linux/arm/syscallent.h: Likewise.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/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.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/tile/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.

	Fix reboot syscall entries.
	* linux/alpha/syscallent.h: Fix number of reboot arguments.
	* 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.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/tile/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.

	Fix swapon syscall entries.
	* linux/arm/syscallent.h: Fix number of swapon arguments.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/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/tile/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.
	* linux/alpha/syscallent.h: Fix number of swapon arguments, add TF flag.
	* linux/hppa/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.

	Fix sgetmask and ssetmask syscall entries.
	* linux/hppa/syscallent.h: Fix sgetmask and ssetmask entries.
	* linux/powerpc/syscallent.h: Likewise.
	* linux/sparc/syscallent.h: Likewise.
	* linux/tile/syscallent.h: Likewise.

	Rename siggetmask to sgetmask and sigsetmask to ssetmask.
	* linux/arm/syscallent.h: Rename siggetmask to sgetmask and
	sigsetmask to ssetmask.
	* linux/bfin/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Likewise.
	* linux/sh64/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Rename sys_sgetmask to sys_siggetmask,
	sys_ssetmask to sys_sigsetmask.

	Add TRACE_IPC flag to sys_ipc syscall entries.
	* linux/arm/syscallent.h: Add TI flag to sys_ipc entry.
	* linux/avr32/syscallent.h: Likewise.
	* linux/bfin/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/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.

2011-11-05  Dmitry V. Levin  <ldv@altlinux.org>

	gitlog-to-changelog: update from gnulib.
	* gitlog-to-changelog: Update from gnulib.
	* Makefile.am: Add --append-dot to gitlog-to-changelog invocation.

2011-10-22  Denys Vlasenko  <dvlasenk@redhat.com>

	Decode TIOCSCTTY's third parameter.
	* term.c (term_ioctl): Decode TIOCSCTTY's third parameter.

2011-10-14  Dmitry V. Levin  <ldv@altlinux.org>

	Remove useless and obsolete "#if DONE" sections.  No code changes.
	* linux/dummy.h: Remove "#if DONE" section.
	* linux/sparc/dummy2.h: Likewise.
	* linux/sparc64/dummy2.h: Likewise.
	* sunos4/dummy.h: Likewise.
	* svr4/dummy.h: Likewise.

	Add names for dummy parsers.  No code changes.
	* linux/dummy.h: Add aliases to printargs() for those of dummy parsers
	that had no own names before.
	* linux/*/syscallent.h: Use these new names instead of printargs.

	Sort definitions of dummy parsers.  No code changes.
	* linux/dummy.h: Sort definitions of parsers implemented as aliases
	to printargs().

2011-10-14  Mike Frysinger  <vapier@gentoo.org>

	sys_epoll_create1: decode flag arguments correctly.
	* desc.c (epollflags): Define.
	(sys_epoll_create1): Use epollflags to printflags. Change "O" to "EPOLL".

	Reported-by: Марк Коренберг <socketpair@gmail.com>

2011-10-11  Dmitry V. Levin  <ldv@altlinux.org>

	Implement decoding of splice, tee and vmsplice(2) syscalls.
	* io.c (print_loff_t): New function.
	(sys_sendfile64): Use it.
	(splice_flags): New xlat structure.
	(sys_tee, sys_splice, sys_vmsplice): New functions.
	* linux/syscall.h (sys_tee, sys_splice, sys_vmsplice): Declare them.
	* linux/*/syscallent.h: Use them.

2011-10-11  Dmitry V. Levin  <ldv@altlinux.org>

	Fix epoll_wait and epoll_pwait decoding.
	* desc.c (epoll_wait_common): Print "maxevents" and "timeout" arguments
	as integers.

	Reported-by: Марк Коренберг <socketpair@gmail.com>

2011-10-11  Dmitry V. Levin  <ldv@altlinux.org>

	Decode EPOLLRDHUP.
	* desc.c (epollevents): Add EPOLLRDHUP.

	Reported-by: Марк Коренберг <socketpair@gmail.com>

2011-10-11  Dmitry V. Levin  <ldv@altlinux.org>

	Remove unreachable code in umoven() and umovestr().
	* util.c (umoven, umovestr): Remove unreachable code.

	Reported-by: Weichuan Yan <wchyan@marvell.com>

2011-09-05  Denys Vlasenko  <dvlasenk@redhat.com>

	Do post-attach initialization earlier; fix "we ignore SIGSTOP on NOMMU" bug
	We set ptrace options when we see post-attach SIGSTOP.
	This is wrong: it's better to set them right away on the very first
	stop (whichever it will be). It also will make adding SEIZE support easier,
	since SEIZE has no post-attach SIGSTOP.

	We do it by adding a new bit, TCB_IGNORE_ONE_SIGSTOP, and treating
	TCB_STARTUP and TCB_IGNORE_ONE_SIGSTOP as two slightly different things.

	* defs.h: Add a new flag bit, TCB_IGNORE_ONE_SIGSTOP.
	* process.c (internal_fork): Set TCB_IGNORE_ONE_SIGSTOP on a newly added child.
	* strace.c (startup_attach): Set TCB_IGNORE_ONE_SIGSTOP after attach.
	Fix a case when "strace -p PID" found PID dead but sone other of its threads
	still alive.
	(startup_child): Set TCB_IGNORE_ONE_SIGSTOP after attach, _if needed_.
	This fixes a bogus case where we can ignore a _real_ SIGSTOP on NOMMU.
	(detach): Perform anti-SIGSTOP dance only if TCB_IGNORE_ONE_SIGSTOP is set,
	not if TCB_STARTUP is set.
	(trace): Set TCB_IGNORE_ONE_SIGSTOP after attach.
	Clear TCB_STARTUP and initialize tracee on the very first tracee stop.
	Clear TCB_IGNORE_ONE_SIGSTOP when SIGSTOP is seen.

2011-09-05  Denys Vlasenko  <dvlasenk@redhat.com>

	Get rid of TCB_ATTACH_DONE.
	* defs.h: Remove TCB_ATTACH_DONE constant.
	* strace.c (startup_attach): Use TCB_STARTUP instead of TCB_ATTACH_DONE
	to distinquish attached from not-yet-attached threads.

2011-09-05  Denys Vlasenko  <dvlasenk@redhat.com>

	Set TCB_STARTUP only _after_ we attached.
	This fixes logic in detach() which thinks that TCB_STARTUP
	means that we are already attached, but did not see SIGSTOP yet.
	This also allows to get rid of TCB_ATTACH_DONE flag.

	* process.c (internal_fork): Set TCB_STARTUP after attach.
	* strace.c (startup_attach): Likewise.
	(startup_child): Likewise.
	(alloc_tcb): Do not set TCB_STARTUP on tcb allocation - we are
	not attached yet.
	(trace): Set TCB_STARTUP when we detech an auto-attached child.

2011-09-02  Denys Vlasenko  <dvlasenk@redhat.com>

	Simple optimizations in trace()
	* strace.c (trace): Calculate WSTOPSIG(status) once,
	unify code paths to ptrace(PTRACE_SYSCALL).

	Trivial fixes on error paths.
	* strace.c (startup_attach): Emit message on fork() failure.
	(startup_child): Remove non-informative comment.
	* util.c (ptrace_restart): use perror_msg() on error instead of fprintf().

2011-09-01  Denys Vlasenko  <dvlasenk@redhat.com>

	Fix compile failure introduced by last commit.
	* desc.c (decode_select): Fix double definition of nfds.

2011-09-01  Denys Vlasenko  <dvlasenk@redhat.com>

	Roll back "die on malloc failure" behaviour a bit.
	After recent change, select(2^31-1, NULL, NULL, NULL)
	would make strace exit. This change caps fdsize so that
	it is always in [0, 1025*1024], IOW: we will try to allocate at most
	1 megabyte, which in practice will almost always work,
	unlike malloc(2Gig).

	* desc.c (decode_select): Cap fdsize to 1024*1024.
	* pathtrace.c (pathtrace_match): Cap fdsize to 1024*1024.
	* file.c (sys_getdents): Cap len to 1024*1024.
	(sys_getdents64): Cap len to 1024*1024.
	* util.c (dumpiov): Refuse to process iov with more than 1024*1024
	elements. Don't die on malloc failure.
	(dumpstr): Don't die on malloc failure.

2011-09-01  Denys Vlasenko  <dvlasenk@redhat.com>

	Add stpcpy to autoconf machinery.
	* configure.ac: Add stpcpy to AC_CHECK_FUNCS.
	* defs.h: Frame stpcpy with "if !defined HAVE_STPCPY".
	* util.c: Likewise.

	Simplify sprinttv()
	* time.c (sprinttv): Trivial simplifications.

	* desc.c (decode_select): Set tcp->auxstr as late as possible.

2011-09-01  Denys Vlasenko  <dvlasenk@redhat.com>

	Reformat setuid-ing code in startup_child()
	New code does the same as old one, but is more readable (I hope).

	* strace.c (startup_child): Reformat setuid-ing code.

2011-09-01  Denys Vlasenko  <dvlasenk@redhat.com>

	Minor tweaks in startup_child(). Logic isn't changed (but code is)
	* strace.c (startup_attach): Tweak comment.
	(startup_child): Move common code out of ifdef.
	Indent nested ifdefs. Tweak comments. Remove two
	unnecessary calls to getpid().

	Use tprints with literal strings, it may be faster than tprintf.
	* bjm.c: Replace tprintf("str") with tprints("str").
	* block.c: Likewise.
	* desc.c: Likewise.
	* file.c: Likewise.
	* io.c: Likewise.
	* ipc.c: Likewise.
	* mem.c: Likewise.
	* net.c: Likewise.
	* proc.c: Likewise.
	* process.c: Likewise.
	* quota.c: Likewise.
	* resource.c: Likewise.
	* scsi.c: Likewise.
	* signal.c: Likewise.
	* sock.c: Likewise.
	* strace.c: Likewise.
	* stream.c: Likewise.
	* syscall.c: Likewise.
	* system.c: Likewise.
	* term.c: Likewise.
	* time.c: Likewise.
	* util.c: Likewise.

	Fix "format not a string literal" warning caused by tprintf(str)
	* defs.h: Declare tprints().
	* strace.c: Define tprints().
	(tabto): Use tprints(str), since tprintf(str) was throwing a warning.
	* desc.c: Use tprints(str) instead of tprintf("%s", str).
	* file.c: Likewise.
	* io.c: Likewise.
	* net.c: Likewise.
	* process.c: Likewise.
	* signal.c: Likewise.
	* syscall.c: Likewise.
	* util.c: Likewise.

2011-08-31  Denys Vlasenko  <dvlasenk@redhat.com>

	Add README-linux-ptrace file.
	I tried to push this doc to Michael Kerrisk <mtk.manpages@gmail.com>,
	but got no reply. To avoid losing the document, let it live
	in strace tree for now.

2011-08-31  Denys Vlasenko  <dvlasenk@redhat.com>

	Make out-of-memory handling more uniform.
	This fixes one real bug in dumpstr().

	* defs.h: Declare die_out_of_memory().
	* strace.c (die_out_of_memory): New function.
	(strace_popen): If allocation fails, call die_out_of_memory().
	(main): Likewise.
	(expand_tcbtab): Likewise.
	(rebuild_pollv): Likewise.
	* count.c (count_syscall): Likewise.
	(call_summary_pers): Likewise.
	* desc.c (decode_select): Likewise.
	* file.c (sys_getdents): Likewise.
	(sys_getdents64): Likewise.
	(sys_getdirentries): Likewise.
	* pathtrace.c (pathtrace_match): Likewise.
	* syscall.c (qualify): Likewise.
	* util.c (printstr): Likewise.
	(dumpiov): Likewise.
	(dumpstr): Likewise.
	(fixvfork): Likewise.
	* mem.c (sys_mincore): Don't check free() parameter for NULL.

2011-08-31  Denys Vlasenko  <dvlasenk@redhat.com>

	Optimization: eliminate all remaining usages of strcat()
	After this change, we don't use strcat() anywhere.

	* defs.h: Change sprinttv() return type to char *.
	* time.c (sprinttv): Return pointer past last stored char.
	* desc.c (decode_select): Change printing logic in order to eliminate
	usage of strcat() - use stpcpy(), *outptr++ = ch, sprintf() instead.
	Also reduce usage of strlen().
	* stream.c (decode_poll): Likewise.

2011-08-31  Denys Vlasenko  <dvlasenk@redhat.com>

	Optimize string_quote() for speed.
	* util.c (string_quote): Speed up check for terminating NUL.
	Replace strintf() with open-coded binary to hex/oct conversions -
	we potentially do them for every single byte, need to be fast.

	Optimization: eliminate some usages of strcat()
	* defs.h: Declare stpcpy().
	* util.c: Define stpcpy().
	* file.c: Remove static str_append().
	(sprint_open_modes): Use stpcpy() instead of str_append().
	(sprintflags): Use stpcpy() instead of strcat().
	(printpathn): Eliminate usage of strcat().
	(printstr): Eliminate usage of strcat().

2011-08-30  Denys Vlasenko  <dvlasenk@redhat.com>

	Small optimization on AVR32.
	* syscall.c (syscall_enter): Optimize tcp->u_arg[i] setting
	from regs.FOO for AVR32.

2011-08-30  Denys Vlasenko  <dvlasenk@redhat.com>

	On X86_64 and I386, use PTRACE_GETREGS to fetch all registers.
	Before this change, registers were read with PTRACE_PEEKUSER
	ptrace operation, one per register. This is slower than
	fetching them all in one ptrace operation.

	* defs.h: include asm/ptrace.h on X86_64 and I386.
	* syscall.c: New static variables i386_regs and x86_64_regs.
	Remove static eax/rax variables.
	(get_scno): Fetch all registers with single PTRACE_GETREGS operation.
	(get_syscall_result): Likewise.
	(syscall_fixup_on_sysenter): Use PTRACE_GETREGS results in i386/x86_64_regs.
	(syscall_enter): Set tcp->u_arg[i] from PTRACE_GETREGS results.
	(get_error): Set tcp->u_rval, tcp->u_error from PTRACE_GETREGS results.

2011-08-30  Dmitry V. Levin  <ldv@altlinux.org>

	Do not include <limits.h>
	* strace.c: Do not include <limits.h> explicitly, it is already included
	implicitly by <sys/param.h>.

2011-08-30  Dmitry V. Levin  <ldv@altlinux.org>

	Include <sys/param.h> to get PATH_MAX definition.
	* pathtrace.c: Include <sys/param.h> instead of <limits.h> to get
	PATH_MAX definition.

	Reported-by: Steve Bennett <steveb@workware.net.au>

2011-08-26  Denys Vlasenko  <dvlasenk@redhat.com>

	Indent a large set of nested ifdefs/endifs. No code changes.
	* defs.h: Indent a large set of nested ifdefs/endifs

	Rename syscall_fixup to syscall_fixup_on_sysenter.
	* defs.h: Tweak comment.
	* syscall.c: Rename syscall_fixup to syscall_fixup_on_sysenter.
	(trace_syscall_entering): Use new finction name.

	Make syscall result reading more consistent among different arches.
	* syscall.c: Eliminate static flags variable for POWERPC.
	(syscall_fixup): Don't fetch syscall results. Affected arches:
	POWERPC, BFIN, HPPA.
	(syscall_fixup_on_sysexit): Move syscall results fetching code
	for this function to get_syscall_result. Affected arches:
	S390X, POWERPC, BFIN, M68K, HPPA, CRIS, MICROBLAZE.
	(get_syscall_result): Add syscall results fetching.

2011-08-25  Denys Vlasenko  <dvlasenk@redhat.com>

	Simplify syscall_fixup[_on_sysexit]
	* syscall.c (syscall_fixup): Remove checks for entering(tcp).
	Remove code which executes if exiting(tcp).
	(syscall_fixup_on_sysexit): Remove code which executes
	if entering(tcp). Remove checks for exiting(tcp).

	Split syscall_fixup into enter/exit pair of functions.
	* syscall.c: Create syscall_fixup_on_sysexit() which is a copy of
	syscall_fixup().
	(trace_syscall_exiting): Call syscall_fixup_on_sysexit() instead of
	syscall_fixup().

	Remove stray commas in struct initializers. No code changes.
	* process.c: Remove stray commas in struct initializers.

2011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>

	Optimize tabto()
	tabto is used in many lines of strace output.
	On glibc, tprintf("%*s", col - curcol, "") is noticeably slow
	compared to tprintf("                 "). Use the latter.
	Observed ~15% reduction of time spent in userspace.

	* defs.h: Drop extern declaration of acolumn. Make tabto()
	take no parameters.
	* process.c (sys_exit): Call tabto() with no parameters.
	* syscall.c (trace_syscall_exiting): Call tabto() with no parameters.
	* strace.c: Make acolumn static, add static char *acolumn_spaces.
	(main): Allocate acolumn_spaces as a string of spaces.
	(printleader): Call tabto() with no parameters.
	(tabto): Use simpler method to print lots of spaces.

2011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>

	* syscall.c (sys_indir): Use %ld for printing long, not %u.

2011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>

	Opotimize "scno >= 0 && scno < nsyscalls" check.
	gcc can't figure out on its own that this check can be done with
	single compare, and does two compares. We can help it by casting
	scno to unsigned long: ((unsigned long)(scno) < nsyscalls)

	* defs.h: New macro SCNO_IN_RANGE(long_var).
	* count.c (count_syscall): Use SCNO_IN_RANGE() instead of open-coded check.
	* syscall.c (getrval2): Use SCNO_IN_RANGE() instead of open-coded check.
	This fixes a bug: missing check for scno < 0 and scno > nsyscalls
	instead of scno >= nsyscalls.
	(get_scno): Use SCNO_IN_RANGE() instead of open-coded check.
	This fixes a bug: scno > nsyscalls instead of scno >= nsyscalls.
	(known_scno): Use SCNO_IN_RANGE() instead of open-coded check.
	(internal_syscall): Likewise.
	(syscall_enter): Likewise.
	(trace_syscall_entering): Likewise.
	(get_error): Likewise.
	(trace_syscall_exiting): Likewise.

2011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>

	Remove scno_good logic in syscall exit.
	* syscall.c (trace_syscall_exiting): Remove scno_good logic,
	it can't trigger in syscall exit.

	Remove redundant assignments.
	* syscall.c (get_error): Remove redundant "u_error = 0" and redundant
	and unclear comments.

	Group int-sized fields together in struct tcb.
	* defs.h: Group int-sized fields together in struct tcb.

2011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>

	Reorder functions in syscall.c. No code changes.
	Old order (basically "in no particular order"):
	    dumpio
	    decode_subcall
	    internal_syscall
	    get_scno
	    get_syscall_result
	    known_scno
	    syscall_fixup
	    is_negated_errno
	    get_error
	    syscall_enter
	    trace_syscall_entering
	    trace_syscall_exiting
	    trace_syscall
	    printargs
	    getrval2
	    sys_indir
	    is_restart_error

	New order:
	various utility functions:
	    decode_subcall
	    printargs
	    getrval2
	    sys_indir
	    is_restart_error
	syscall enter handling functions:
	    get_scno
	    known_scno
	    syscall_fixup (also used in syscall exit code)
	    internal_syscall (also used in syscall exit code)
	    syscall_enter
	    trace_syscall_entering
	syscall exit handling functions:
	    get_syscall_result
	    is_negated_errno
	    get_error
	    dumpio
	    trace_syscall_exiting
	main syscall enter/exit function:
	    trace_syscall

	* syscall.c: Reorder functions so that related ones are closer
	in the source.

2011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>

	Rename some functions, delete unused one. No code changes.
	* defs.h: Rename get_scno_on_sysenter() to get_scno();
	delete force_result() declaration.
	* strace.c (proc_open): Rename get_scno_on_sysenter() to get_scno().
	* syscall.c: Rename get_scno_on_sysenter() to get_scno().
	Rename get_scno_on_sysexit() to get_syscall_result().
	Delete unused force_result().

2011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>

	Unify per-architecture post-execve SIGTRAP check.
	Move post-execve SIGTRAP check from get_scno_on_sysenter
	(multitude of places on many architectures) to a single location
	in trace_syscall_entering. This loosens the logic for some arches,
	since many of them had additional checks such as scno == 0.
	However, on non-ancient Linux kernels we should never have post-execve
	SIGTRAP in the first place, by virtue of using PTRACE_O_TRACEEXEC.

	* syscall.c (get_scno_on_sysenter): Remove tcp->flags & TCB_WAITEXECVE checks.
	(trace_syscall_entering): Do tcp->flags & TCB_WAITEXECVE check here.
	(get_scno_on_sysexit): Tweak comment.
	(syscall_fixup): Likewise.
	(trace_syscall_exiting): Likewise.

2011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>

	Speed up x86 by avoiding EAX read on syscall entry.
	on x86, EAX read on syscall entry is not necessary if we know
	that post-execve SIGTRAP is disabled by PTRACE_O_TRACEEXEC ptrace option.
	This patch (a) moves EAX retrieval from syscall_fixup
	to get_scno_on_sysexit, and (b) perform EAX retrieval in syscall_fixup
	only if we are in syscall entry and PTRACE_O_TRACEEXEC option is not on.

	* syscall.c (get_scno_on_sysexit): On I386 and X86_64, read eax/rax
	which contain syscall return value.
	(syscall_fixup): On I386 and X86_64, read eax/rax only on syscall enter
	and only if PTRACE_O_TRACEEXEC is not in effect.

2011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>

	Do not read syscall no in get_scno_on_sysexit.
	* syscall.c (get_scno_on_sysexit): Remove scno retrieval code, since
	we don't save it anyway. This is the first real logic change
	which should make strace faster: for example, on x64 ORIG_EAX
	is no longer read in each syscall exit.

	Simplify get_scno_on_sysenter/sysexit.
	* syscall.c (get_scno_on_sysenter): Remove "if (exiting(tcp))" code,
	make "if (entering(tcp))" code unconditional.
	(get_scno_on_sysexit): Remove "if (entering(tcp))" code,
	make "if (exiting(tcp))" code unconditional.

2011-08-24  Denys Vlasenko  <dvlasenk@redhat.com>

	get_scno is an unholy mess, make it less horrible.
	Currently, get_scno does *much* more than "get syscall no".
	It checks for post-execve SIGTRAP. It checks for changes
	in personality. It retrieves params on entry and registers on exit.
	Worse still, it is different in different architectures: for example,
	for AVR32 regs are fetched in get_scno(), while for e.g. I386
	it is done in syscall_enter().

	Another problem is that get_scno() is called on both syscall entry and
	syscall exit, which is stupid: we don't need to know scno on syscall
	exit, it is already known from last syscall entry and stored in
	tcp->scno! In essence, get_scno() does two completely different things
	on syscall entry and on exit, they are just mixed into one bottle, like
	shampoo and conditioner.

	The following patches will try to improve this situation.

	This change duplicates get_scno into identical get_scno_on_sysenter,
	get_scno_on_sysexit functions. Call them in syscall enter and syscall
	exit, correspondingly.

	* defs.h: Rename get_scno to get_scno_on_sysenter; declare it only
	if USE_PROCFS.
	* strace.c (proc_open): Call get_scno_on_sysenter instead of get_scno.
	* syscall.c (get_scno): Split into two (so far identical) functions
	get_scno_on_sysenter and get_scno_on_sysexit.
	(trace_syscall_entering): Call get_scno_on_sysenter instead of get_scno.
	(trace_syscall_exiting): Call get_scno_on_sysexit instead of get_scno.

2011-08-23  Dmitry V. Levin  <ldv@altlinux.org>

	Reduce code redundancy in syscall_enter()
	* syscall.c [LINUX] (syscall_enter): Move tcp->u_nargs initialization
	from arch-specific ifdefs to common code.  Always cache tcp->u_nargs in
	a local variable and use it in for() loops.
	[IA64, AVR32] Rewrite tcp->u_arg[] initialization using a loop.

2011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Define MAX_ARGS to 6 for all Linux arches.
	* defs.h: Define MAX_ARGS to 6 for all Linux arches.
	* linux/ia64/syscallent.h: Change all 8-argument printargs
	to MA (MAX_ARGS).
	linux/mips/syscallent.h: Change all two 7-argument printargs
	to MA (MAX_ARGS).

	Fix argument printing in sys_mmap64.
	* mem.c (sys_mmap64): Fix a bug where we used tcp->u_args[i]
	instead of argument values copied from memory.

2011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Cache tcp->u_nargs in a local variable for for() loops.
	Loops of the form "for (i = 0; i < tcp->u_nargs; i++) ..."
	need to fetch tcp->u_nargs from memory on every iteration
	if "..." part has a function call (gcc doesn't know that
	tcp->u_nargs won't change). This can be sped up
	by putting tcp->u_nargs in a local variable, which might
	go into a CPU register.

	* syscall.c (decode_subcall): Cache tcp->u_nargs in a local variable
	as for() loop limit value.
	(syscall_enter): Likewise.

2011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Drop checks for sysent[i].nargs == -1.
	* defs.h: Declare nsyscalls, nerrnos, nioctlents, nsignals as unsigned.
	* syscall.c: Define nsyscalls, nerrnos, nioctlents, nsignals as unsigned.
	(decode_subcall): Drop checks for sysent[i].nargs == -1.
	(syscall_enter): Likewise.

2011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Stop using nargs == -1 in syscallent tables.
	Usage -1 as argument count in syscallent tables
	necessitates the check for it, a-la:
	if (sysent[tcp->scno].nargs != -1)
	    tcp->u_nargs = sysent[tcp->scno].nargs;
	else
	    tcp->u_nargs = MAX_ARGS;
	which is stupid: we waste cycles checking something which
	is constant and known at compile time.

	* defs.h: Make struct sysent::nargs unsigned.
	* freebsd/i386/syscallent.h: Replace nargs of -1 with MA.
	* linux/s390/syscallent.h: Likewise.
	* linux/s390x/syscallent.h: Likewise.
	* svr4/syscallent.h: Likewise.
	* freebsd/syscalls.pl: Likewise in generator script.
	* syscallent.sh: Likewise in generator script.
	* syscall.c: Add define MA MAX_ARGS / undef MA around includes
	of syscallent[N].h.

2011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Move trace_syscall_exiting below trace_syscall_entering. No code changes.
	Syscall enter happens before syscall exit. Having functions
	in opposite order in the source is confusing.

	* syscall.c: Move trace_syscall_exiting below trace_syscall_entering.

2011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Fix -z display.
	Before this patch, the following:
	    open("qwerty", O_RDONLY)    = -1 ENOENT
	    write(2, "wc: qwerty: No such file or dire"..., 38) = 38
	was shown totally wrongly with -z:
	    open("qwerty", O_RDONLY)    = 38
	(yes, that's right, write syscall is lost!)
	Now it is shown "less wrongly" as:
	    open("qwerty", O_RDONLY <unfinished ...>
	    write(2, "wc: qwerty: No such file or dire"..., 38) = 38

	* syscall.c (trace_syscall_exiting): Use common TCB_INSYSCALL clearing
	via "goto ret". This fixes totally broken display of -z, but even now
	it is not working as intended. Add a comment about that.
	(trace_syscall_entering): Use common TCB_INSYSCALL setting
	via "goto ret".

2011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Straighten up confused comments/messages about post-execve SIGTRAP handling
	* defs.h: Explain TCB_INSYSCALL and TCB_WAITEXECVE bits in detail.
	* strace.c (choose_pfd): Use entering/exiting macros instead of direct check
	for TCB_INSYSCALL.
	* syscall.c (get_scno): Use entering/exiting macros instead of direct check
	for TCB_INSYSCALL. Fix comments about post-execve SIGTRAP.
	(syscall_fixup): Use entering/exiting instead of direct check
	for TCB_INSYSCALL. Add a comment what "not a syscall entry" message
	usually means. Change wrong "stray syscall exit" messages into
	"not a syscall entry" ones.

	count_syscall() always returns 0, optimize it.
	* defs.h (count_syscall): Change return type from int to void.
	* count.c (count_syscall): Change return type from int to void.
	* syscall.c (trace_syscall_exiting): Change code around call
	to count_syscall accordingly.

	Optimize out dummy PC printing on signal delivery.
	* strace.c (trace): Optimize out dummy PC printing on signal delivery.
	While at it, tweak comments.

	Conditionally optimize out unused code.
	* syscall.c (internal_syscall): Call internal_exec only if
	SUNOS4 || (LINUX && TCB_WAITEXECVE).
	* process.c (internal_exec): Define this function only if
	SUNOS4 || (LINUX && TCB_WAITEXECVE).
	(printwaitn): Don't check wordsize if SUPPORTED_PERSONALITIES == 1.
	* signal.c (sys_kill): Likewise.
	* syscall.c (is_negated_errno): Likewise.
	(trace_syscall_exiting): Fold a tprintf into tprintfs which follow it.

	Cosmetic improvement in ifdefs. No code changes.
	* strace.c (proc_open): Change ifdefs so that braces are properly paired.

	Exclude tcp->pfd from non-procfs systems.
	* defs.h: Make struct tcb::pfd fields conditional on USE_PROCFS.
	* strace.c (alloc_tcb): Use tcp->pfd only if USE_PROCFS.
	(droptcb): Likewise.

	Small optimizations related to memory allocation.
	* strace (expand_tcbtab): Shorten "out of memory" message.
	(rebuild_pollv): Remove unnecessary NULL check before free().
	* util.c (dumpstr): Add a comment about likely bug.

	Improve code readability by avoiding assignments inside if()
	* desc.c (decode_select): Move assignment out of if() condition.
	* file.c (sprinttime): Likewise.
	(sys_getdirentries): Likewise.
	* io.c (sys_ioctl): Likewise.
	* strace.c (test_ptrace_setoptions_followfork): Likewise.
	(main): Likewise.
	(proc_open): Likewise.
	(detach): Likewise.
	(proc_poll): Likewise.
	(trace): Likewise.
	* syscall.c (qualify): Likewise.
	(sys_indir): Likewise.
	* test/procpollable.c (main): Likewise.
	* test/sfd.c (main): Likewise.
	* time.c (printtv_bitness): Likewise.
	(sprinttv): Likewise.
	(print_timespec): Likewise.
	(void sprint_timespec): Likewise.
	(printitv_bitness): Likewise.
	* util.c (dumpstr): Likewise.
	(umovestr): Likewise.
	(fixvfork): Likewise.

	Convert ioctl_next_match() to new-style C function definition.
	* ioctl.c (ioctl_next_match): Convert to new-style C function definition.

2011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Small optimization in signal and ioctl tables.
	Trivial shuffling of data tables puts them all in one file,
	allowing gcc to see their sizes and eliminate variables
	which store these sizes.

	Surprisingly, in C mode gcc does not optimize out static const int
	variables. Help it by using enums instead.

	* defs.h: Stop exporting ioctlent{0,1,2}, nioctlents{0,1,2},
	signalent{0,1,2}, nsignals{0,1,2}.
	* ioctl.c: Remove definitions of ioctlent{,0,1,2} and nioctlents{,0,1,2}.
	* signal.c: Remove definitions of signalent{,0,1,2} and nsignals{,0,1,2}.
	* syscall.c: Move above definitions to this file. Make them static const
	or enums if suitable.

2011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Don't return int from set_personality(), no one checks it.
	* defs.h (set_personality): Change return type to void.
	* syscall.c (set_personality): Change return type to void.

	Remove unused declaration.
	* defs.h: Remove unused declaration of handle_new_child().

	Use natural-sized integer field for tcb::flags.
	* defs: Change struct tcb::flags type from short to int.
	This results in smaller code at least on x86.

	Make needlessly static data local.
	* syscall.c (get_scno): For POWERPC64 and X86-64, variable currpers
	is declared static. But its old data is never used. Convert it
	to ordinary local variable.

	Optimize get_scno function.
	* syscall.c (get_scno): Make gpr_offset[] array static const.

	Optimize iocb_cmd_lookup.
	* desc.c (iocb_cmd_lookup): Make command table constant.
	Reduce size of static char buffer.

	Correct sys_sendfile[64] type and nargs.
	* freebsd/i386/syscallent.h: Correct sys_sendfile nargs 7->8
	* linux/mips/syscallent.h: Correct sys_sendfile64 nargs 5->4
	* linux/sh/syscallent.h: Correct sys_sendfile64 nargs 5->4
	* linux/sh64/syscallent.h: Correct sys_sendfile64 nargs 5->4
	* linux/m68k/syscallent.h: Correct sys_sendfile64 type TF->TD|TN
	* linux/microblaze/syscallent.h: Correct sys_sendfile64 type TF->TD|TN
	* linux/tile/syscallent.h: Correct sys_sendfile and sys_sendfile64 type TD->TD|TN

	Make addflags return void.
	* defs.h (addflags): Change return type from int to void.
	* util.c (addflags): Change return type from int to void.

2011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Set saner MAX_ARGS (6 or 8) for X86_64 and I386.
	I noticed that tcp->u_args[MAX_ARGS] array is way larger than
	I'd expect: for all arches except HPPA it has 32 (!) elements.

	I looked at the code and so far I spotted only one abuser of
	this fact: sys_sigreturn. On several arches, it saves sigset_t
	into tcp->u_args[1...N] on entry and prints it on exit, a-la

	memcpy(&tcp->u_arg[1], &sc.oldmask[0], sizeof(sigset_t))

	The problem here is that in glibc sigset_t is insanely large:
	128 bytes, and using sizeof(sigset_t) in memcpy will overrun
	&tcp->u_args[1] even with MAX_ARGS == 32:
	On 32 bits, sizeof(tcp->u_args) == 32*4 == 128 bytes!
	We may already have a bug there!

	This commit changes the code to save NSIG / 8 bytes only.
	NSIG can't ever be > 256, and in practice is <= 129,
	thus NSIG / 8 is <= 16 bytes == 4 32-bit words,
	and even MAX_ARGS == 5 should be enough for saving signal masks.

	* defs.h: Reduce MAX_ARGS for X86_64 and I386 from 32 to 8
	for FreeBSD and to 6 for everyone else. Add comment about current
	state of needed MAX_ARGS.
	* signal.c: Add comment about size of sigset_t.
	(sprintsigmask): Reduce static string buffer from 8k to 2k.
	(sys_sigreturn): Fix sigset saving to save only NSIG / 8 bytes,
	not sizeof(sigset_t) bytes.
	* linux/mips/syscallent.h: Reduce nargs of printargs-type syscall to 7.
	* linux/arm/syscallent.h: Reduce nargs of printargs-type syscall to 6.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/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.

2011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Optimize sys_old_mmap.
	* mem.c (sys_old_mmap): For Ia64 and 32-bit personality of x86-64,
	copy narrow parameters from userspace by single umove, not by six
	separate ones; then assign them to long u_arg[i]. For SH[64],
	avoid copying of tcp->u_arg.
	(sys_mmap): Add FIXME comment - SH64 and i386 seem to be handled
	differently for no apparent reason.
	* test/mmap_offset_decode.c: New test program, illustrates FIXME.

2011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Untangle ifdef forest in sys_mmap64. No code changes.
	After careful analysis, it looks like !LINUX and ALPHA
	pass all seven parameters in registers; and in all other cases
	parameters are on stack (pointed to by tcp->u_arg[0]).
	In light of this, reorganize ifdefs, making them simpler,
	without changing any logic.
	After this, it's apparent we use tcp->u_arg[4,5,6] and possibly
	[7] without checking that it's valid to do so.
	So far, just add a comment about this.

	* mem.c (sys_mmap64): Rewrite ifdefs in a much simpler way.
	Add comments about apparent bugs.

2011-08-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Style and comment fixes, no code changes.
	* mem.c: Indent includes to show nesting better.
	  (addtileflags): Fix style of this function definition;
	  correct wrong endif comment, add another endif comment.

	Use simpler rounding up to next multiple of 2.
	* util.c (printllval): simpler rounding up to next multiple of 2.

	Cosmetic fixes, no code changes.
	* defs.h: Add/reformat comments.
	* signal.c: Remove wrong comment. Add warning directive
	when we detect that NSIG is undefined. Add comment about
	NSIG on ARM. Fix typo in comment.
	(signame): Reformat code a bit without changes to logic.
	Shorten static buffer.
	(sys_rt_sigprocmask): Remove stray empty line.
	* syscall.c: Add warning directive when we detect that
	NSIG is undefined. Add comment about NSIG on ARM.

2011-08-23  Dmitry V. Levin  <ldv@altlinux.org>

	Fix PTRACE_SETOPTIONS tests.
	* strace.c [LINUX] (kill_save_errno): New function.
	(test_ptrace_setoptions_followfork): Change return type to void.
	Fix and harden error handling.  Use kill_save_errno() to avoid errno
	clobbering.  Treat EIO from ptrace() the same way as EINVAL.
	(test_ptrace_setoptions_for_all): Use kill_save_errno() to avoid errno
	clobbering.  Treat EIO from ptrace() the same way as EINVAL.
	(main): Update use of test_ptrace_setoptions_followfork().

	Fix compilation on linux 2.4.x.
	* configure.ac: Check for BLKGETSIZE64.
	* block.c (block_ioctl): Check for HAVE_BLKGETSIZE64.

2011-08-17  Denys Vlasenko  <dvlasenk@redhat.com>

	Remove tcp->parent and TCB_CLONE_THREAD.
	tcp->parent is used for only two things:
	(1) to send signal on detach via tgkill (need to know tgid).
	Solution: use tkill, it needs only tid.
	(2) to optimize out ptrace options setting for new tracees.
	Not a big deal if we drop this optimization: "set options" op is fast,
	doing it just one extra time once per each tracee is hardly measurable.

	TCB_CLONE_THREAD is a misnomer. It used only to flag sibling we attached to
	in startup_attach. This is used to prevent infinite recursive rescanning
	of /proc/PID/task.
	Despite the name, there is no guarantee it is set only on non-leader:
	if one would run "strace -f -p THREAD_ID" and THREAD_ID is *not*
	a thread leader, strace will happily attach to it and all siblings
	and will think that THREAD_ID is the leader! Which is a bug, but
	since we no longer detach when we think tracee is going to die,
	this bug no longer matters, because we do not use the knowledge
	about thread group leaders for anything. (We used it to delay
	leader's exit).

	IOW: after this patch strace has no need to know about threads, parents
	and children, and so on. Therefore it does not track that information.
	It treats all tracees as independent entities. Overall,
	this simplifies code a lot.

	* defs.h: Add TCB_ATTACH_DONE flag, remove TCB_CLONE_THREAD flag
	and struct tcb::parent field.
	* process.c (internal_fork): Don't set tcpchild->parent.
	* strace.c (startup_attach): Use TCB_ATTACH_DONE flag instead of
	TCB_CLONE_THREAD to avoid attach attempts on already-attached threads.
	Unlike TCB_CLONE_THREAD, TCB_ATTACH_DONE bit is used only temporarily,
	and only in this function. We clear it on every tcb before we return.
	(detach): Use tkill instead of tgkill.
	(trace): Set ptrace options on new tracees unconditionally,
	not only when tcp->parent == NULL.

2011-08-17  Denys Vlasenko  <dvlasenk@redhat.com>

	Remove TCB_SUSPENDED constant and related code.
	Since we no longer suspend waitpid'ing tracees, we have only one case when
	we suspend tracee: when we pick up a new tracee created by clone/fork/vfork.

	Background: on some other OSes, attach to child is done this way:
	get fork's result (pid), loop ptrace(PTRACE_ATTACH) until you hook up
	new process/thread. This is ugly and not safe, but what matters for us
	is that it doesn't require suspending. Suspending is required
	on Linux only, because on Linux attach to child is done differently.

	On Linux, we use two methods of catching new tracee:
	adding CLONE_THREAD bit to syscall (if needed, we change
	[v]fork into clone before that), or using ptrace options.
	In both cases, it may be so that new tracee appears before one which
	created it returns from syscall. In this case, current code
	suspends new tracee until its creator returns. Only then
	strace can determine who is its parent (it needs child's pid for this,
	which is visible in parent's [v]fork/clone result).
	This is inherently racy. For example, what if SIGKILL kills
	creator after it succeeded creating child, but before it returns?
	Looks like we will have child suspended forever.

	But after previous commit, we DO NOT NEED parent<->child link for anything.
	Therefore we do not need suspending too. Bingo!

	This patch removes suspending code. Now new tracees will be continued
	right away. Next patch will remove tcp->parent member.

	* defs.h: Remove TCB_SUSPENDED constant
	* process.c (handle_new_child): Delete this function.
	  (internal_fork): Do not call handle_new_child on syscall exit.
	* strace.c (handle_ptrace_event): Delete this function.
	  (trace): Do not suspend new child; remove all handling
	  of now impossible TCB_SUSPENDED condition.

2011-08-17  Denys Vlasenko  <dvlasenk@redhat.com>

	Do not detach when we think tracee is going to die.
	Current code plays some ungodly tricks, trying to not detach
	thread group leader until all threads exit.

	Also, it detaches from a tracee when signal delivery is detected
	which will cause tracee to exit.
	This operation is racy (not to mention the determination
	whether signal is set to SIG_DFL is a horrible hack):
	after we determined that this signal is indeed fatal
	but before we detach and let process die,
	*other thread* may set a handler to this signal, and
	we will leak the process, falsely displaying it as killed!

	I need to look in the past to figure out why we even do it.
	First guess is that it's a workaround for old kernel bugs:
	kernel used to deliver exit notifications to the tracer,
	not to real parent. These workarounds are ancient
	(internal_exit is from 1995).

	The patch deletes the hacks. We no longer need tcp->nclone_threads,
	TCB_EXITING and TCB_GROUP_EXITING. We also lose a few rather
	ugly functions.

	I also added a new message: "+++ exited with EXITCODE +++"
	which shows exact moment strace got exit notification.
	It is analogous to existing "+++ killed by SIG +++" message.

	* defs.h: Delete struct tcb::nclone_threads field,
	  TCB_EXITING and TCB_GROUP_EXITING constants,
	  declarations of sigishandled() and internal_exit().
	* process.c (internal_exit): Delete this function.
	  (handle_new_child): Don't ++tcp->nclone_threads.
	* signal.c (parse_sigset_t): Delete this function.
	  (sigishandled): Delete this function.
	* strace.c (startup_attach): Don't tcbtab[tcbi]->nclone_threads++.
	  (droptcb): Don't delay dropping if tcp->nclone_threads > 0,
	  don't drop parent if its nclone_threads reached 0:
	  just drop (only) this tcb unconditionally.
	  (detach): don't drop parent.
	  (handle_group_exit): Delete this function.
	  (handle_ptrace_event): Instead of handle_group_exit, just drop tcb;
	  do not panic if we see WIFEXITED from an attached pid;
	  print "+++ exited with EXITCODE +++" for every WIFEXITED pid.
	* syscall.c (internal_syscall):	Do not treat sys_exit specially -
	  don't call internal_exit on it.

2011-08-16  Sergei Trofimovich  <slyfox@gentoo.org>

	Declare printrusage32() on Alpha.
	* defs.h [ALPHA] (printrusage32): New declaration.

2011-08-15  Denys Vlasenko  <dvlasenk@redhat.com>

	Slight optimization and cleanup in trace()
	* strace.c (trace): Do not recalculate "cflag ? &ru : NULL"
	again and again. Do not clear errno unnecessarily.
	Consistently check wait errors as pid < 0, not pid == -1.
	Indent ifdefs for better readability.
	Remove comments after endif if ifdef/endif block is really tiny.

	Fix compilation on 2.4.20 kernel based system.
	* block.c (block_ioctl): add ifdef/endif around BLKGETSIZE64 usage
	* strace.c (trace): add ifdef/endif around WIFCONTINUED usage

2011-07-19  Dmitry V. Levin  <ldv@altlinux.org>

	Check for additional PTRACE_* constants.
	* configure.ac (AC_CHECK_DECLS): Add PTRACE_O_TRACESYSGOOD,
	PTRACE_O_TRACEEXEC, PTRACE_O_TRACEEXIT, PTRACE_EVENT_EXEC,
	PTRACE_EVENT_VFORK_DONE and PTRACE_EVENT_EXIT.
	* defs.h [LINUX]: Define these PTRACE_* constants when they are not
	provided by <sys/ptrace.h>.

	Reported-by: Douglas Mencken <dougmencken@gmail.com>
	Reported-by: Steve Bennett <steveb@workware.net.au>

2011-07-19  Denys Vlasenko  <dvlasenk@redhat.com>

	Remove superfluous backslash-continuation in configure.ac.
	* configure.ac: remove superfluous backslash continuation
	in AC_CHECK_DECLS

2011-06-24  Denys Vlasenko  <dvlasenk@redhat.com>

	Make IOCTL_WSTOP more readable.
	* defs.h: Make IOCTL_WSTOP more readable

	Trivial cleanups.
	* strace.c (trace): Change ifdef LINUX to make a bit more sense,
	  remove wrong comment at its endif. Slightly optimize
	  "+++ killed by SIG +++" message for systems without WCOREDUMP macro.

	Remove redundant include <stdarg.h>
	* strace.c: Remove redundant include <stdarg.h>

	Clean up two old comments.
	* strace.c (startup_attach): Remove misplaced comment.
	  (trace) Remove incomplete part of a comment.

	Make a few variables static.
	* defs.h: Remove tcbtab declaration.
	* strace.c: Make run_uid, run_gid, outf, tcbtab, progname
	  global variables static

	Add debug output in initial attachment code.
	* strace.c (startup_attach): If -d, report pid and success/failure
	  of every attach attempt.

	Better debug logging of allocations and waitpit results.
	* strace.c (alloc_tcb): Print number of allocated tcb's if -d.
	  (droptcb): Likewise.
	  (handle_ptrace_event): Remove PTRACE_EVENT_EXEC debug message.
	  (trace): Improve logging of waitpid: show WIFxxx, exitcode/signal,
	  ptrace event name, WCOREDUMP - all on one line.

2011-06-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Optimize arrays of register indexes in syscall_enter.
	* syscall.c (syscall_enter) [BFIN]: Make register no array "static const".
	  [SH]: Make register no array "const", pre-multiply it by 4.
	  [SH64]: Make register no array "const".
	  [X86_64]: Make register no array "const", pre-multiply it by 8.

2011-06-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Deindent syscall_enter by removing unnecessary braces. No code changes.
	syscall_enter has many long (>80 columns) lines.
	It is aggravated by the fact that it has a lot of {} blocks
	which are not necessary (the code is the same without them).
	This patch removes {}s and deindents affected lines.
	While at it, it indents ifdefs so that nesting is easier to track,
	and adds a few spaces in the expressions, such as
	"tcp->u_nargs*sizeof..." -> "tcp->u_nargs * sizeof...".
	There is no actual changes to the code here.

	* syscall.c (syscall_enter): Remove unnecessary {} blocks.

2011-06-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Remove dead "ifndef CLONE_PTRACE" branch.
	process.c defines CLONE_PTRACE for Linux, so it can't be undefined.
	Therefore ifndef CLONE_PTRACE code is dead (since at least 2004).
	This patch removes it.

	* process.c (handle_new_child): Remove ifdef CLONE_PTRACE/endif (but not
	  the code inside) and entire ifndef CLONE_PTRACE/endif block.

2011-06-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Add a comment about setbpt. No code changes.
	* defs.h: Add a comment about setbpt().

	Untangle a particularly badly obfuscated bit of code. No logic changes.
	* util.c (setbpt): Calculate new arg0 in more readable way.

2011-06-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Remove TCB_FOLLOWFORK.
	TCB_FOLLOWFORK flag seems to be unnecessary, because we either follow
	all [v]forks/clones or don't follow any, therefore global variable
	followfork is an already existing indicator of what we want to do.
	This patch drops all setting/clearing of TCB_FOLLOWFORK bit,
	and replaces checks for this bit by checks of followfork value.
	In internal_fork, check is moved to in front of if(), since
	the check is needed on both "entering" and "exiting" branch.

	* defs.h: Remove TCB_FOLLOWFORK define.
	* process.c (internal_fork): Do not set/clear TCB_FOLLOWFORK,
	  test followfork instead of tcp->flags & TCB_FOLLOWFORK.
	  (handle_new_child): Likewise.
	* strace.c (startup_attach): Likewise.

2011-06-23  Dmitry V. Levin  <ldv@altlinux.org>

	* system.c (sys_capget, sys_capset): Fix pointer arithmetics.

2011-06-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Make initial tcb allocation more readable. No logic changes.
	* strace.c (main): Make initial tcb allocation more readable.

2011-06-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Do not allocate tiny cap_user_header/data structures, place them on stack.
	This allows us to avoid having code to malloc them, and code to check
	for malloc failure. Resulting code decrease:
	   text	   data	    bss	    dec	    hex	filename
	  10175	      0	     16	  10191	   27cf	system.o.old
	   9797	      0	      0	   9797	   2645	system.o

	* system.c (sys_capget): Put cap_user_header_t and cap_user_data_t
	  on stack, rather than allocating them in heap. These structures
	  are very small (a few integer fields), stack is a better place
	  for them.
	  (sys_capset): Likewise.

2011-06-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Use [p]error_msg[_and_die] where appropriate. No logic changes.
	Resulting size changes:
	   text    data     bss     dec     hex filename
	  17445      16    8572   26033    65b1 strace.o.old
	  16850      16    8572   25438    635e strace.o

	* strace.c: Replace fprintf[+cleanup]+exit with [p]error_msg_and_die,
	  fprintf("progname: ...") with [p]error_msg where appropriate.

2011-06-22  Denys Vlasenko  <dvlasenk@redhat.com>

	Whitespace cleanups. No code changes.
	* count.c: Place opening curly brace after if (),
	  not on the next line. Almost all strace code alredy
	  uses this style.
	* desc.c: Likewise.
	* file.c: Likewise.
	* net.c: Likewise.
	* pathtrace.c: Likewise.
	* process.c: Likewise.
	* quota.c: Likewise.
	* signal.c: Likewise.
	* strace.c: Likewise.
	* syscall.c: Likewise.
	* time.c: Likewise.

2011-06-22  Denys Vlasenko  <dvlasenk@redhat.com>

	Make strace_fopen abort on error.
	Error from strace_fopen in main results in call to exit(1).
	Error from strace_fopen in newoutf is propagated to newoutf
	callers: startup_attach (where it results in exit(1))
	and alloc_tcb (where error is ignored). In second case,
	the behavior doesn't seem to be right: it means with -ff
	on open error for new LOGFILE.PID the output will continue
	to go into *the same file as the previous process* - which
	would be confusing. Moreover, on droptcb outf may be closed
	and the output of other, still running process outputting
	to the same outf will be lost. I don't think this is sane.
	IOW: in all cases, error in strace_fopen should be fatal.

	* strace.c (strace_fopen): Abort on error instead of returning NULL.
	  (newoutf): Change return type to void.
	  (startup_attach): Remove error check on newoutf return value.
	  (main): Remove error check on strace_fopen return value.

2011-06-22  Denys Vlasenko  <dvlasenk@redhat.com>

	Make set_cloexec_flag abort on error.
	set_cloexec_flag() may fail only if we pass it a bad fd,
	such as -1 or non-opened one. If we do, we have a bug
	in the caller. It makes no sense to try to continue
	running when we detect such a blatant bug in our own code.

	* strace (set_cloexec_flag): Abort instead of returning error
	  indicator. Change function to return void.
	  (strace_fopen): Remove error check on set_cloexec_flag return value.
	  (proc_open): Likewise.
	  (proc_poll_open): Likewise.

2011-06-22  Denys Vlasenko  <dvlasenk@redhat.com>

	Make strace_popen abort on error.
	It makes no sense to postpone abort on strace_popen error
	unti it returns. Moreover, out-of-memory error was exiting
	without any message.
	While at it, use 0 as "none" for popen_pid, as optimization.

	* strace: Initialize popen_pid to 0 - this puts it in bss.
	  (trace): Reset popen_pid to 0 instead of -1.
	  (strace_popen): Never return NULL as error indicator,
	  abort with good error message instead.
	  (main): Remove NULL check of strace_popen result.

2011-06-22  Denys Vlasenko  <dvlasenk@redhat.com>

	Delete fork_tcb()
	Get rid of fork_tcb() function. It used to do what the comment
	above it says, but now it doesn't do much:
	it only sets tcp->flags |= TCB_FOLLOWFORK and maybe calls
	expand_tcbtab(). The second operation is not necessary, since
	alloc_tcp() will do it itself when needed.
	This patch deletes fork_tcb(), open-coding tcp->flags |= TCB_FOLLOWFORK
	where it was formerly called. It also makes nprocs, tcbtabsize and
	expand_tcbtab() static. (While at it, I nuked redundant
	extern char **environ declaration: strace.c had *two* of them...)

	* defs.h: Remove declarations of nprocs, tcbtabsize and
	  expand_tcbtab.
	* process.c (fork_tcb): Remove this function.
	  (internal_fork): Open-code fork_tcb.
	  (handle_new_child): Likewise.
	* strace.c: Remove redundant "extern char **environ". Declare
	  nprocs and tcbtabsize static.
	  (expand_tcbtab): Make it static.

2011-06-22  Denys Vlasenko  <dvlasenk@redhat.com>

	Simplify expand_tcbtab and alloc_tcb.
	Get rid of a few intermediate variables, simplifies a few expressions,
	and uses error_msg_and_die instead of more verbose
	fprintf+cleanup+exit sequence.
	In alloc_tcp, I use memset to clear entire new tcp.
	This not only saves a few bytes of code, but lowers the chances
	of future bugs where some data "leaks out" into new tcb's
	from old ones because we forgot to re-initialize it.

	* strace.c (expand_tcbtab): Simplify this function. No logic changes.
	  (alloc_tcb): Likewise.

2011-06-21  Denys Vlasenko  <dvlasenk@redhat.com>

	Trivial fixes.
	* process.c (internal_fork): Remove conditionals which make no difference
	  (we return 0 on both branches of these ifs).
	* util.c: Fix indentation of an ifdef.

2011-06-21  Dmitry V. Levin  <ldv@altlinux.org>

	Fix build when libaio-devel is not available.
	* desc.c: Do not compile code that uses struct iocb unless
	HAVE_LIBAIO_H is set.

	Reported-by: Denys Vlasenko <dvlasenk@redhat.com>

2011-06-21  Dmitry V. Levin  <ldv@altlinux.org>

	tests: finish ptrace_setoptions_* merge.
	* tests/Makefile.am (TESTS): Merge ptrace_setoptions_*.
	* tests/ptrace_setoptions: Check for Linux kernel > 2.6.

2011-06-21  Denys Vlasenko  <dvlasenk@redhat.com>

	Remove write-only nchildren member from struct tcb.
	* defs.h: Remove nchildren member from struct tcb.
	* process.c (handle_new_child): Remove inc/decrements of tcp->nchildren.
	  (internal_fork): Likewise.
	* strace.c (startup_attach): Likewise.
	  (droptcb): Likewise.
	  (alloc_tcb): Remove initialization of tcp->nchildren.

	Fix tests/ptrace_setoptions_* to match last fix in ptrace options code.

	Remove write-only nzombies member from struct tcb.
	* defs.h: Remove nzombies member from struct tcb.
	* strace.c (droptcb): Remove "tcp->parent->nzombies++".
	  (alloc_tcb): Remove "tcp->nzombies = 0".

2011-06-21  Denys Vlasenko  <dvlasenk@redhat.com>

	Fix regression introduced by "Properly handle real SIGTRAPs" change.
	Commit 3454e4b463e6c22c7ea8c5461ef5a077f4650a54
	introduced a bug: sometimes, TRACECLONE/TRACE[V]FORK opts were not set.
	The check (tcp->parent == NULL) in old code was meant to check
	"if we are not a child created by auto-attach" - in this case,
	options need to be set on the child; otherwise they are inherited
	and do not need to be set.
	I misunderstood the check and if tcp->parent is not NULL, I was
	setting only ptrace_setoptions_for_all bits.
	This change fixes the problem. Since the fixed logic makes it
	unnecessary to keep two sets of options in separate variables,
	I merge them back into one variable, ptrace_setoptions.

	* defs.h: Merge ptrace_setoptions_followfork and ptrace_setoptions_for_all
	  into one variable, ptrace_setoptions.
	* strace.c: Likewise.
	  (test_ptrace_setoptions_followfork): Use ptrace_setoptions variable.
	  (test_ptrace_setoptions_for_all): Likewise.
	  (main): Likewise.
	* process.c (internal_fork): Likewise.
	  (internal_exec): Likewise.
	* strace.c (trace): Fix the bug where different options were set
	  depending on "tcp->parent == NULL" condition. Add a comment
	  which makes it more clear why this condition is checked.

2011-06-18  Denys Vlasenko  <dvlasenk@redhat.com>

	Do not suspend waitpid.
	strace used to suspend waitpid until there is a child
	for waitpid'ing process to collect status from.
	Apparently, it was done because in some very old kernels
	(circa 2002 or even earlier) there were ptrace bugs which
	were making waitpid in real parent to not see children.
	This kernel bug is fixed long ago. This change removes the workaround.
	test/wait_must_be_interruptible.c is a test program which
	illustrates why without this change strace changes
	programs's behavior.

	* defs.h: Delete waitpid and nclone_waiting members from from struct tcb.
	  Remove declaration of internal_wait().
	* process.c (internal_wait): Remove this function.
	* strace.c (alloc_tcb): Do not set tcp->nclone_waiting.
	  (resume): Remove this function.
	  (resume_from_tcp): Remove this function.
	  (detach): Do not call resume_from_tcp().
	  (handle_group_exit): Do not call resume_from_tcp().
	* syscall.c (internal_syscall): Do not call internal_wait().

2011-06-13  Andi Kleen  <ak@linux.intel.com>

	Enhance io_submit() decoding.
	strace didn't decode important fields in the iocb passed to io_submit.
	This patch changes the code to dump them all.  Also it prefixes the fields
	with names to make it easier to read.

	* desc.c (iocb_cmd_lookup, print_common_flags): New functions.
	(sys_io_submit): New iocb decoder.

2011-06-13  Dmitry V. Levin  <ldv@altlinux.org>

	Add argument to tprint_iov() specifying whether to decode each iovec.
	* defs.h (tprint_iov): Add decode_iov argument.
	* io.c (tprint_iov): Implement new decode_iov argument.
	(sys_readv, sys_writev, sys_sendfile, sys_preadv, sys_pwritev): Update
	tprint_iov calls.
	* net.c (do_msghdr): Likewise.

	Introduce ARRAY_SIZE() macro.
	* defs.h (ARRAY_SIZE): New macro.
	* ioctl.c: Use it.
	* pathtrace.c (pathmatch, storepath): Likewise.
	* process.c (printpriv): Likewise.
	* signal.c: Likewise.
	* syscall.c: Likewise.

2011-06-13  Andi Kleen  <ak@linux.intel.com>

	Fix decoding of timer id returned by timer_create.
	* time.c (sys_timer_create): The kernel returns a integer, not a
	pointer for the timer id in the memory pointed to by timer_id.

2011-06-09  Dmitry V. Levin  <ldv@altlinux.org>

	Add test for PTRACE_O_TRACESYSGOOD.
	* tests/ptrace_setoptions_for_all: New file.
	* tests/Makefile.am (TESTS): Add ptrace_setoptions_for_all.

	tests: update test for linux kernel version.
	* tests/ptrace_setoptions_followfork: Check for Linux kernel > 2.6.

2011-06-09  Dmitry V. Levin  <ldv@altlinux.org>

	Update ptrace_setoptions test.
	The test have to be adjusted after commit v4.6-5-g3454e4b.

	* ptrace_setoptions: Update grep pattern, rename to
	ptrace_setoptions_followfork.
	* tests/Makefile.am (TESTS): Rename ptrace_setoptions to
	ptrace_setoptions_followfork.

2011-06-09  Dmitry V. Levin  <ldv@altlinux.org>

	* strace.c (verror_msg): Rewrite without use of heap memory allocation.

2011-06-09  Dmitry V. Levin  <ldv@altlinux.org>

	Fix MIPS syscall entries.
	* linux/mips/syscallent.h: Remove duplicate entries for 4336, 4337,
	and 4338 syscall numbers.

	Reported-by: Denys Vlasenko <dvlasenk@redhat.com>

2011-06-08  Denys Vlasenko  <dvlasenk@redhat.com>

	Don't display bogus parameter for sigreturn syscall.
	* linux/*/syscallent.h: For those arches which use sys_sigreturn,
	not printargs, to show [rt_]sigreturn syscall, change number of arguments
	from 1 to 0: sys_sigreturn function doesn't use syscall parameters.
	(I guess kernel doesn't actually _have_ any parameters for this syscall,
	at least on these architectures). Do the same change for I386 and x86-64
	even though they use printargs: I looked at kernel code and syscall
	definitely doesn't have any parameters on these arches.
	(I hesitate to change 1 to 0 params for arches I don't know -
	it is remotely possible some of them do have a parameter for this syscall).

	Optimize sigreturn handling.
	* signal.c (sys_sigreturn): move stack pointer variables,
	and for SPARC and MIPS, stack pointer and sigmask reading code
	into "if (entering) ..." block, because it is only needed
	in this branch; load tcp->u_arg[1] into sigmask for display
	_after_ we know for sure u_arg[1] does contain valid sigmask
	(IOW: perform operation only when we know we will need the result)

	Do not call umoven to fetch parameters if we have zero params.
	* syscall.c [I386] (syscall_enter): Do not call umoven
	to fetch zero bytes. This is just an optimization.

	"Modernize" four old-style function parameter declarations.
	* signal.c (signame, long_to_sigset, printsigmask, printsignal):
	Convert old-style C function definitions to a "modern" form.
	This does not change any actual code.

2011-06-08  Denys Vlasenko  <dvlasenk@redhat.com>

	Fix sigreturn decoding on MIPS.
	The "return 0" line was accidentally deleted circa 2007,
	which made sigreturn on MIPS always display "= 0" return
	instead of more informative " = ? (mask now [MASK])".

	* strace.c (sys_sigreturn): Add wrongly deleted "return 0" line

2011-06-08  Denys Vlasenko  <dvlasenk@redhat.com>

	Print at least one space between SYSCALL(ARGS) and = RESULT if tracee is killed
	We already do it in the normal case, but in rare code path where
	tracee is gone (SIGKILLed?) sometimes we were printing this:
	"SYSCALL(ARGS <unavailable>)= ? <unavailable>" - note jammed together ")=".
	test/sigkill_rain.c can be used to verify the fix.

	* strace.c (printleader): add a space after ")" in " <unavailable>)"

2011-06-08  Denys Vlasenko  <dvlasenk@redhat.com>

	Add fflush after printf in test/sigkill_rain.c.

	Update test/* directory, it seem to be a bit bit-rotted.
	Added README; modified sigkill_rain.c to be more understandable,
	made clone.c compile; added wait_must_be_interruptible.c test;
	updated Makefile and .gitignore.

2011-06-07  Denys Vlasenko  <dvlasenk@redhat.com>

	Whitespace cleanups. no code changes.
	* bjm.c: Fix tabulation (such as extra spaces before tabs),
	convert punctuation where it deviates from prevalent form
	elsewhere in strace code, convert sizeof and offsetof where
	it deviates from from prevalent form, remove space between
	function/macro/array names and (parameters) or [index],
	add space between "if" and (condition), correct non-standard
	or wrong indentaion.
	* defs.h: Likewise
	* desc.c: Likewise
	* file.c: Likewise
	* ipc.c: Likewise
	* linux/arm/syscallent.h: Likewise
	* linux/avr32/syscallent.h: Likewise
	* linux/hppa/syscallent.h: Likewise
	* linux/i386/syscallent.h: Likewise
	* linux/ioctlsort.c: 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/tile/syscallent.h: Likewise
	* linux/x86_64/syscallent.h: Likewise
	* mem.c: Likewise
	* net.c: Likewise
	* pathtrace.c: Likewise
	* process.c: Likewise
	* signal.c: Likewise
	* sock.c: Likewise
	* strace.c: Likewise
	* stream.c: Likewise
	* sunos4/syscall.h: Likewise
	* sunos4/syscallent.h: Likewise
	* svr4/syscall.h: Likewise
	* svr4/syscallent.h: Likewise
	* syscall.c: Likewise
	* system.c: Likewise
	* test/childthread.c: Likewise
	* test/leaderkill.c: Likewise
	* test/skodic.c: Likewise
	* time.c: Likewise
	* util.c: Likewise

2011-05-30  Dmitry V. Levin  <ldv@altlinux.org>

	ARM EABI: fix 64-bit syscall's arguments decoding.
	ARM OABI and ARM EABI have different function parameters passing rules.
	With EABI, 64-bit function parameters passed in registers are aligned to
	an even-numbered register instead of using the next available pair, see
	http://lkml.org/lkml/2006/1/12/175
	This rule also applies to syscall's arguments.

	* linux/arm/syscallent.h (pread, pwrite, truncate64, ftruncate64,
	readahead, preadv, pwritev): Fix number of arguments.
	* util.c (printllval): Align 64bit argument to 64bit boundary on
	__ARM_EABI__.

	Reported-by: Damir Shayhutdinov <damir@altlinux.org>

2011-05-30  Damir Shayhutdinov  <damir@altlinux.ru>

	Linux: implement decoding of preadv and pwritev syscalls.
	* io.c [LINUX && HAVE_SYS_UIO_H] (sys_preadv, sys_pwritev): New functions.
	* linux/syscall.h (sys_preadv, sys_pwritev): Declare them.
	* linux/*/syscallent.h: Use them.

2011-05-30  Denys Vlasenko  <dvlasenk@redhat.com>

	"Modernize" all old-style function parameter declarations.
	* bjm.c: Convert all remaining old-style C function definitions
	to a "modern" form. This does not change any actual code.
	* io.c: Likewise
	* ioctl.c: Likewise
	* net.c: Likewise
	* proc.c: Likewise
	* process.c: Likewise
	* signal.c: Likewise
	* sock.c: Likewise
	* strace.c: Likewise
	* stream.c: Likewise
	* syscall.c: Likewise
	* system.c: Likewise
	* time.c: Likewise
	* util.c: Likewise

2011-05-27  Denys Vlasenko  <dvlasenk@redhat.com>

	Cleanups on top of "handle SIGTRAP properly" change, based on Dmitry's comments.
	* defs.h ([p]error_msg[_and_die]): Declare new functions.
	* strace.c (SYSCALLTRAP): Rename to syscall_trap_sig.
	([p]error_msg[_and_die]): Define new functions.
	(strace_tracer_pid): New variable, it controls which pid will
	do cleanup on exit via [p]error_msg_and_die.
	(main): Set strace_tracer_pid to our initial pid.
	(startup_attach): Change strace_tracer_pid if we are in -D mode.
	(test_ptrace_setoptions_for_all): Minor changes to logic,
	such as better diagnostic messages.

2011-05-25  Denys Vlasenko  <dvlasenk@redhat.com>

	Identifier "errno" may be a macro, it's unsafe to use it.
	* strace.c (strerror): Rename parameter errno to err_no

2011-05-24  Denys Vlasenko  <dvlasenk@redhat.com>

	Don't perform TCB_WAITEXECVE wait if not needed.
	* defs.h (ptrace_setoptions_for_all): Expose this variable.
	* strace.c (ptrace_setoptions_for_all): Remove "static".
	* process.c (internal_exec): Don't set TCB_WAITEXECVE bit
	if we know that post-execve SIGTRAP is not going to happen.

2011-05-23  Denys Vlasenko  <dvlasenk@redhat.com>

	Properly handle real SIGTRAPs.
	* defs.h (ptrace_setoptions): Variable renamed to ptrace_setoptions_followfork.
	* process.c (internal_fork): Ditto.
	* strace.c (ptrace_setoptions_for_all): New variable.
	(SYSCALLTRAP): New variable.
	(error_msg_and_die): New function.
	(test_ptrace_setoptions_for_all): New function.
	(main): Call test_ptrace_setoptions_for_all() at init.
	(handle_ptrace_event): Handle PTRACE_EVENT_EXEC (by ignoring it).
	(trace): Check events and set ptrace options without -f too.
	Check WSTOPSIG(status) not for SIGTRAP, but for SYSCALLTRAP.

2011-04-24  Mike Frysinger  <vapier@gentoo.org>

	Blackfin: update syscall list.

	* linux/bfin/syscallent.h: Add name_to_handle_at, open_by_handle_at,
	clock_adjtime, and syncfs syscalls.

2011-04-24  Mike Frysinger  <vapier@gentoo.org>

	linux: add new EHWPOISON errno.

	* linux/errnoent.h: Change ERRNO_133 to EHWPOISON.

2011-04-08  Grant Edwards  <grant.b.edwards@gmail.com>

	Add ability to print file descriptor paths and filter by those paths.
	* pathtrace.c: New file, implements matching syscall arguments to
	user-specified file paths.
	* Makefile.am (strace_SOURCES): Add pathtrace.c.
	* defs.h (TCB_FILTERED, filtered): New defines.
	(getfdpath, pathtrace_select, pathtrace_match, show_fd_path,
	tracing_paths): New declarations.
	* strace.c (show_fd_path, tracing_paths): New global variables.
	(usage, main): Implement handling of -y and -P options.
	* strace.1: Add descriptions of -y and -P options.
	* syscall.c (trace_syscall_entering): Add path matching logic to the
	print/noprint decision and set the TCB_FILTERED bit appropriately.
	(trace_syscall_exiting): Use filtered() macro that checks the
	TCB_FILTERED bit to determine print/noprint status.
	* util.c (printfd): Use getfdpath().

2011-04-07  Dmitry V. Levin  <ldv@altlinux.org>

	Fix BLKTRACESTOP definition.
	* block.c: Fix typo in the check for BLKTRACESTOP.
	Reported by Gabor Z. Papp.

2011-03-15  Dmitry V. Levin  <ldv@altlinux.org>

	Ensure that PTRACE_GETSIGINFO et al are always defined on Linux.
	* configure.ac (AC_CHECK_DECLS): Add PTRACE_* constants.
	* defs.h [LINUX]: Define those PTRACE_* constants that are not provided
	by <sys/ptrace.h>.

	* CREDITS.in: Fix typo.

2011-03-14  Dmitry V. Levin  <ldv@altlinux.org>

	Update PTRACE_* constants.
	* process.c (ptrace_cmds): Add PTRACE_GETREGSET and PTRACE_SETREGSET.

	Prepare for 4.6 release.
	* NEWS: Update for 4.6 release.
	* configure.ac: Version 4.6.
	* debian/changelog: 4.6-1.
	* strace.spec: 4.6-1.

2011-03-14  Mike Frysinger  <vapier@gentoo.org>

	linux/ioctlent: unify them all.
	This unifies all the ioctlent.h's in the linux subdir while still
	allowing each arch to maintain its own minor list.

	The basic method is:
	- each arch has linux/<arch>/ioctlent.h.in which defines only the
	arch-specific ioctls;
	- linux/ioctlent.h.in which defines only the common ioctls;
	- at build time, these two headers are combined and sorted to produce
	the linux/ioctlent.h file.

	This also requires a little tweaking of the include files since the
	common ioctlent.h is a built file.

	* linux/ioctlent.h: Split into linux/ioctlent.h.in and
	linux/i386/ioctlent.h.in, remove asm entries from the former, remove
	non-asm entries from the latter.
	* linux/alpha/ioctlent.h: Rename to linux/alpha/ioctlent.h.in, remove
	non-asm entries.
	* linux/bfin/ioctlent.h: Rename to linux/bfin/ioctlent.h.in, remove
	non-asm entries.
	* linux/hppa/ioctlent.h: Rename to linux/hppa/ioctlent.h.in, remove
	non-asm entries.
	* linux/ia64/ioctlent.h: Rename to linux/ia64/ioctlent.h.in, remove
	non-asm entries.
	* linux/mips/ioctlent.h: Rename to linux/mips/ioctlent.h.in, remove
	non-asm entries.
	* linux/powerpc/ioctlent.h: Rename to linux/powerpc/ioctlent.h.in,
	remove non-asm entries.
	* linux/s390/ioctlent.h: Rename to linux/s390/ioctlent.h.in, remove
	non-asm entries.
	* linux/sh/ioctlent.h: Rename to linux/sh/ioctlent.h.in, remove
	non-asm entries.
	* linux/sparc/ioctlent.h: Rename to linux/sparc/ioctlent.h.in, remove
	non-asm entries.
	* linux/arm/ioctlent.h.in: New file.
	* linux/avr32/ioctlent.h.in: Likewise.
	* linux/i386/ioctlent.h.in: Likewise.
	* linux/m68k/ioctlent.h.in: Likewise.
	* linux/microblaze/ioctlent.h.in: Likewise.
	* linux/tile/ioctlent.h.in: Likewise.
	* linux/x86_64/ioctlent.h.in: Likewise.
	* linux/s390x/ioctlent.h.in: Include ioctlent.h.in instead of
	ioctlent.h.
	* linux/sh64/ioctlent.h.in: Likewise.
	* linux/sparc64/ioctlent.h.in: Likewise.
	* linux/arm/ioctlent1.h: Update ioctlent.h include.
	* linux/powerpc/ioctlent1.h: Likewise.
	* linux/sparc/ioctlent1.h: Likewise.
	* linux/sparc64/ioctlent1.h: Likewise.
	* linux/x86_64/ioctlent1.h: Likewise.
	* Makefile.am (AM_CPPFLAGS): Add -I$(builddir)/$(OS).
	(EXTRA_DIST): Update.
	[MAINTAINER_MODE && LINUX]: Convert from ioctlent_h to ioctlent_h_in.
	[LINUX]: Add $(builddir)/$(OS)/ioctlent.h generation rules.
	* .gitignore: Add linux/ioctlent.h.

2011-03-10  Dmitry V. Levin  <ldv@altlinux.org>

	Show more details about signals received by traced processess.
	* strace.c [!USE_PROCFS] (trace): Differentiate output format depending
	on PTRACE_GETSIGINFO success or failure.  In the former case, use
	printsiginfo() to show more details about received signal.

	Get rid of PT_GETSIGINFO.
	* strace.c [!USE_PROCFS] (trace): Assume that PTRACE_GETSIGINFO is
	available.  Replace PT_GETSIGINFO with PTRACE_GETSIGINFO.  Use
	PTRACE_GETSIGINFO for all signals.

	Enhance decoding of kernel-generated signals.
	* signal.c (printsiginfo) [LINUX]: Do not print uninteresting
	zero-initialized fields.

	Fix decoding of user-generated signals.
	* signal.c [LINUX] (SI_FROMUSER): Define.
	[LINUX || SVR4] (printsiginfo) [SI_FROMUSER]: Enhance decoding.

	Recognize SI_KERNEL and SI_ASYNCNL.
	* signal.c [LINUX] (SI_KERNEL, SI_ASYNCNL): Define.
	[LINUX || SVR4] (siginfo_codes): Add entries for SI_KERNEL and
	SI_ASYNCNL, reorder entries.

2011-03-05  Sebastian Pipping  <sebastian@pipping.org>

	Take all git branches into account for generation of CREDITS file.
	* Makefile.am: Make CREDITS target depend on all git branches.

2011-03-04  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of file descriptors.
	* defs.h (printfd): New function prototype.
	* util.c (printfd): New function.
	* file.c (print_dirfd): Update prototype to use printfd().
	(sys_openat, sys_faccessat, sys_newfstatat, sys_mkdirat, sys_linkat,
	sys_unlinkat, sys_readlinkat, sys_renameat, sys_fchownat, sys_fchmodat,
	sys_futimesat, sys_utimensat, sys_mknodat): Update use of print_dirfd().
	(sys_lseek, sys_llseek, sys_readahead, sys_ftruncate, sys_ftruncate64,
	sys_fstat, sys_fstat64, sys_oldfstat, sys_fstatfs, sys_fstatfs64,
	sys_fchdir, sys_fchroot, sys_linkat, sys_fchown, sys_fchmod, sys_fsync,
	sys_readdir, sys_getdents, sys_getdirentries, sys_fsetxattr,
	sys_fgetxattr, sys_flistxattr, sys_fremovexattr, sys_fadvise64,
	sys_fadvise64_64, sys_inotify_add_watch, sys_inotify_rm_watch,
	sys_fallocate): Use printfd() for decoding of file descriptors.
	* desc.c (sys_fcntl, sys_flock, sys_close, sys_dup, do_dup2,
	decode_select, sys_epoll_ctl, epoll_wait_common): Use printfd() for
	decoding of file descriptors.
	* io.c (sys_read, sys_write, sys_readv, sys_writev, sys_pread,
	sys_pwrite, sys_sendfile, sys_sendfile64, sys_pread64, sys_pwrite64,
	sys_ioctl): Likewise.
	* mem.c (print_mmap, sys_mmap64): Likewise.
	* signal.c (do_signalfd): Likewise.
	* stream.c (decode_poll): Likewise.
	* time.c (sys_timerfd_settime, sys_timerfd_gettime): Likewise.
	Based on patch from Grant Edwards <grant.b.edwards@gmail.com>.

2011-03-03  Sebastian Pipping  <sebastian@pipping.org>

	Print shutdown(2) modes as SHUT_* constants.
	* net.c (shutdown_modes): New xlat structure.
	(sys_shutdown): Use shutdown_modes to decode 2nd syscall argument.

	Fix decoding of inotify_init1() flags.
	* file.c (inotify_init_flags): New xlat structure.
	(sys_inotify_init1): Use it instead of open_mode_flags.

2011-03-03  Dmitry V. Levin  <ldv@altlinux.org>

	Fix struct xlat initialization bugs.
	* file.c (inotify_modes): Terminate with NULL entry.
	* net.c (sock_type_flags): Make this array static.
	(socketlayers): Add a comment that this array should remain not
	NULL-terminated.

	tests: avoid SIGPIPE.
	* tests/ptrace_setoptions: Replace "grep -q" with "grep > /dev/null".
	The former may result to strace being killed by SIGPIPE, which in
	certain configuratons may lead to generation of a core file.
	Suggested by Mike Frysinger.

2011-03-01  Mike Frysinger  <vapier@gentoo.org>

	tests: do not make missing /usr/bin/time a failure.
	* tests/init.sh (framework_skip_): New function.
	(check_prog): Use it instead of framework_failure_.

2011-02-27  Dmitry V. Levin  <ldv@altlinux.org>

	Generate an xz tar archive of the distribution.
	* configure.ac (AM_INIT_AUTOMAKE): Replace dist-bzip2 with dist-xz.
	* Makefile.am: Update srpm target.
	* make-dist: Update for dist-xz.
	* strace.spec: Update Source tag.
	* debian/watch: Update regexp.
	* .gitignore: Add strace-*.tar.xz.

	Use "make check" in debian/rules and strace.spec.
	* debian/control: Update Build-Depends.
	* debian/rules: Run "make check".
	* strace.spec: Update BuildRequires. Run "make check" in %check section.

	Implement two basic "strace -f" tests.
	* Makefile.am (SUBDIRS): Add tests.
	* configure.ac (AC_CONFIG_FILES): Add tests/Makefile.
	* tests/.gitignore: New file.
	* tests/Makefile.am: Likewise.
	* tests/init.sh: Likewise.
	* tests/ptrace_setoptions: Likewise.
	* tests/strace-f: Likewise.

2011-02-26  Dmitry V. Levin  <ldv@altlinux.org>

	ppc, s390, sparc: regenerate ioctlent.h files.
	* linux/powerpc/ioctlent.h: Regenerated using Fedora 15 kernel headers.
	* linux/s390/ioctlent.h: Likewise.
	* linux/sparc/ioctlent.h: Likewise.

	Remove redundant ioctlent.h files.
	* linux/s390x/ioctlent.h: Replace old contents with include of
	s390/ioctlent.h file.
	* linux/sparc64/ioctlent.h: Replace old contents with include of
	sparc/ioctlent.h file.

2011-02-25  Dmitry V. Levin  <ldv@altlinux.org>

	ioctlsort: sync with ioctl_lookup()
	* linux/ioctlsort.c (main): Use NR and TYPE bits only, to sync with
	ioctl_lookup() which looks at these bits only.

	Remove obsolete .cvsignore files.
	* test/.cvsignore: Rename to test/.gitignore.
	* */.cvsignore, */*/.cvsignore: Removed.

	Ignore generated intermediate header files.
	* .gitignore: Add ioctls.h and ioctldefs.h.

2011-02-24  Dmitry V. Levin  <ldv@altlinux.org>

	Generate much of the CREDITS file from git log.
	* CREDITS.in: New file, derived from CREDITS, without names of
	those who are listed as git log 'Author:'s.
	* CREDITS: Remove file.
	* Makefile.am [MAINTAINER_MODE] (CREDITS): New rule.
	* .gitignore: Add CREDITS.
	* .mailmap: New file, required to map git author names and email
	addresses to canonical/preferred form.

2011-02-23  Dmitry V. Levin  <ldv@altlinux.org>

	sparc: fix compilation warning.
	* file.c [!HAVE_LONG_LONG_OFF_T] (realprintstat): Cast st_size
	to unsigned long.

	Update the list of files that must be distributed.
	* Makefile.am (EXTRA_DIST): Add debian/source/format, debian/watch,
	linux/ia64/signalent.h, linux/powerpc/ioctlent1.h,
	linux/powerpc/syscallent1.h, linux/powerpc/errnoent1.h,
	linux/powerpc/signalent1.h.

	Fix compilation warning reported by gcc -Wunused-but-set-variable.
	* process.c (printwaitn) [!SUNOS4]: Do not define "exited" variable.

2011-02-22  Mike Frysinger  <vapier@gentoo.org>

	ioctlsort: zero pad ioctl codes to 4 places.
	Zero padding the ioctl number will allow simple sorting via shell scripts.

	* linux/ioctlsort.c (main): Output ioctl codes zero padded.
	* linux/ioctlent.h: Regenerated.

2011-02-22  Mike Frysinger  <vapier@gentoo.org>

	Update mount flags to latest linux.
	* system.c (MS_RELATIME, MS_KERNMOUNT, MS_I_VERSION,
	MS_STRICTATIME, MS_BORN): Define.
	(mount_flags): Add MS_RELATIME, MS_KERNMOUNT, MS_I_VERSION,
	MS_STRICTATIME, MS_BORN.

2011-02-22  Dmitry V. Levin  <ldv@altlinux.org>

	Sync debian/changelog and strace.spec with packages.
	* debian/changelog: Sync with 4.5.20-2.
	* strace.spec: Likewise.

2011-02-20  Dmitry V. Levin  <ldv@altlinux.org>

	Add TRACE_DESC|TRACE_FILE flags to fanotify_* sysentries.
	* linux/*/syscallent.h: Add TD flag to fanotify_init.  Add TD|TF flags
	to fanotify_mark.

	Fix flags of fallocate sysentries.
	* linux/*/syscallent.h: Fix sys_fallocate flags.

	Add TRACE_DESC flag to epoll_create* sysentries.
	* linux/*/syscallent.h: Add TD flag to sys_epoll_create and
	sys_epoll_create1.

	Add TRACE_DESC flag to fgetxattr, flistxattr, and fremovexattr sysentries
	* linux/*/syscallent.h: Add TD flag to sys_fgetxattr, sys_flistxattr,
	and fremovexattr.

	Add TRACE_FILE flag to swapoff sysentries.
	* linux/*/syscallent.h: Add TF flag to sys_swapoff.

	Add TRACE_DESC flag to fadvise64* sysentries.
	* linux/*/syscallent.h: Add TD flag to sys_fadvise64 and
	sys_fadvise64_64.

	Add TRACE_DESC flag to mmap, mmap2, and old_mmap sysentries.
	* linux/*/syscallent.h: Add TD flag to sys_mmap and sys_old_mmap.

	Do not initialize native_scno on platforms with only one personality.
	* linux/bfin/syscallent.h: Remove redundant native_scno initialization.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.

	Add LOOP_* ioctls defined in linux/loop.h.
	* linux/ioctlent.sh: Add LOOP_* ioctls (0x4C..) defined in linux/loop.h
	header file.
	* linux/ioctlent.h: Regenerated.
	Reported by Mike Frysinger.

2011-02-19  Dmitry V. Levin  <ldv@altlinux.org>

	Fix PTRACE_GETEVENTMSG usage and enhance test_ptrace_setoptions()
	* strace.c (handle_ptrace_event): Fix PTRACE_GETEVENTMSG usage.
	(test_ptrace_setoptions): Test that PTRACE_GETEVENTMSG works properly.

2011-02-19  Mike Frysinger  <vapier@gentoo.org>

	linux/sparc: move to common syscall.h.
	Rather than constantly deal with the sparc/syscall.h going stale, merge
	the few sparc-specific pieces into the linux/syscall.h header.

	* linux/syscall.h: Add sparc-specific pieces from sparc/syscall.h.
	* Makefile.am (EXTRA_DIST): Remove linux/sparc/syscall.h and
	linux/sparc64/syscall.h.
	* linux/sparc/syscall.h, linux/sparc64/syscall.h: Deleted.

2011-02-19  Mike Frysinger  <vapier@gentoo.org>

	sparc: add new funcs to syscall.h.
	Sync missing defs from the common syscall.h here.

	* linux/sparc/syscall.h: Add sys_setfsuid, sys_pread64, and
	sys_pwrite64 prototypes.

2011-02-19  Mike Frysinger  <vapier@gentoo.org>

	sparc: punt unused syscall.h.2.
	I can't find any mention of this header actually being used.
	Seems to be a really old copy of the common syscall.h.

	* Makefile.am (EXTRA_DIST): Remove linux/sparc/syscall.h.2.
	* linux/sparc/syscall.h.2: Deleted.

2011-02-19  Dmitry V. Levin  <ldv@altlinux.org>

	Fix raw exit_group(2) decoding.
	* syscall.c (trace_syscall_entering): Check for sys_exit instead of
	SYS_exit to handle exit_group(2) as well as _exit(2).

2011-02-18  Dmitry V. Levin  <ldv@altlinux.org>

	Optimize known_scno()
	* syscall.c (known_scno): Do not check for native_scno field on
	platforms that support only one personality.

	* process.c (internal_exit) [IA64]: Remove redundant check.

2011-02-09  Dmitry V. Levin  <ldv@altlinux.org>

	Fix biarch support in IO dumping.
	* syscall.c (dumpio): Switch on tcp->sys_func instead of tcp->scno
	for more reliable results.

	Simplify tprintf() declaration.
	* defs.h (tprintf): Simplify declaration.

2011-02-05  Dmitry V. Levin  <ldv@altlinux.org>

	* defs.h (SYSCALL_NEVER_FAILS): Fix typo.

2011-01-19  Dmitry V. Levin  <ldv@altlinux.org>

	Fix decoding of get[ug]id, gete[ug]id and setfs[ug]id return values.
	* defs.h (SYSCALL_NEVER_FAILS): New syscall flag.
	* linux/dummy.h: Change redirection for sys_get[ug]id, sys_gete[ug]id
	and setfs[ug]id.
	* linux/*/syscallent.h: Set SYSCALL_NEVER_FAILS flag for get[ug]id,
	gete[ug]id and setfs[ug]id syscalls.
	* process.c [LINUX] (sys_getuid, sys_setfsuid): New functions.
	* syscall.c (NF): New shorthand macro for use in syscallent.h files.
	(get_error): Check SYSCALL_NEVER_FAILS flag.
	Reported by Марк Коренберг <socketpair@gmail.com>.

	* linux/*/syscallent.h: Fix typo in sys_newfstatat syscall flags.

2011-01-18  Mike Frysinger  <vapier@gentoo.org>

	Blackfin: update ioctl list.
	* linux/bfin/ioctlent.h: Sync with latest kernel sources.

2011-01-17  Dmitry V. Levin  <ldv@altlinux.org>

	Fix stat64 decoding on mips.
	* linux/mips/syscallent.h: Use sys_stat64() to decode stat64 syscall.
	This fixes Debian bug #599028.

	Update linux/*/syscallent.h files to match Linux kernel v2.6.37.
	* linux/alpha/syscallent.h: Add hooks for fanotify_init, fanotify_mark,
	and prlimit64.
	* linux/i386/syscallent.h: Likewise.
	* linux/ia64/syscallent.h: Likewise.
	* linux/m68k/syscallent.h: Likewise.
	* linux/microblaze/syscallent.h: Likewise.
	* linux/mips/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/x86_64/syscallent.h: Likewise.
	* linux/arm/syscallent.h: Add hooks for accept4, fanotify_init,
	fanotify_mark, and prlimit64.
	* linux/hppa/syscallent.h: Add hook for prlimit64.

2011-01-16  Dmitry V. Levin  <ldv@altlinux.org>

	block.c: cleanup.
	* block.c: Include <inttypes.h>.
	(print_blkpg_req): Always decode struct blkpg_ioctl_arg.
	Robustify decoding of strings.
	(block_ioctl): Do not decode return values passed by pointers on exit
	from failed syscalls.
	Use format macros from inttypes.h to print values of type uint64_t.

2011-01-15  Dmitry V. Levin  <ldv@altlinux.org>

	Add block ioctl support.
	* block.c: New file.
	* Makefile.am (strace_SOURCES): Add it.
	* defs.h [LINUX] (block_ioctl): New function.
	* ioctl.c (ioctl_decode) [LINUX]: Use it to decode HDIO_* and BLK*
	ioctls.
	Patch by Jeff Mahoney <jeffm@suse.com>

2011-01-14  Holger Hans Peter Freyther  <zecke@selfish.org>

	Parse SOL_SCTP socket options.
	* configure.ac (AC_CHECK_HEADERS): Add netinet/sctp.h.
	* net.c [HAVE_NETINET_SCTP_H]: Include <netinet/sctp.h>.
	[SOL_SCTP] (socksctpoptions): New xlat structure.
	(sys_getsockopt, printsockopt): Parse SOL_SCTP options.

	* net.c (socketlayers): Add more SOL_* constants from linux/socket.h.

2011-01-14  Dmitry V. Levin  <ldv@altlinux.org>

	strace.1: fix misleading italics.
	* strace.1: Use bold instead of italics for "-e trace=" keywords.
	This fixes Debian bug #589323.

	Update linux/ioctlent.h.
	* linux/ioctlent.h: Regenerate using linux v2.6.37 headers.

	Add HDIO_* ioctls defined in linux/hdreg.h.
	* linux/ioctlent.sh: Add HDIO_* ioctls (0x03..) defined in
	linux/hdreg.h header file.
	This fixes Debian bug #450953.

2011-01-13  Dmitry V. Levin  <ldv@altlinux.org>

	Test PTRACE_O_TRACECLONE and PTRACE_O_TRACEVFORK along with PTRACE_O_TRACEFORK
	* strace.c (test_ptrace_setoptions): Add PTRACE_O_TRACECLONE and
	PTRACE_O_TRACEVFORK to PTRACE_SETOPTIONS call, to test exactly
	the same set of options that is going to be used later in trace().

2011-01-10  Dmitry V. Levin  <ldv@altlinux.org>

	* net.c (protocols): Add more IPPROTO_* constants defined in netinet/in.h

2011-01-10  Holger Hans Peter Freyther  <holger@freyther.de>

	* net.c (protocols): Add IPPROTO_GRE, IPPROTO_SCTP and IPPROTO_UDPLITE.

2011-01-10  Carmelo AMOROSO  <carmelo.amoroso@st.com>

	sh: Add entry for not-multiplexed accept4.
	* linux/sh/syscallent.h: Add specific entry for not-multiplexed accept4
	available in kernel mainline since v2.6.37-rc6, see
	http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=21b6e4c7106b2d68a6710506d8706608272fd78b

2010-12-14  Carmelo AMOROSO  <carmelo.amoroso@st.com>

	sh: Add entries for not-multiplexed socket calls.
	* linux/sh/syscallent.h: Add specific entries for not-multiplexed
	socket calls (available in kernel mainline since v2.6.37-rc1)

	sh: Fix compilation warning in do_pipe due to missing prototype.
	* defs.h [SH]: Make getrval2 prototype visible to do_pipe
	and fix the following compiler warning:
	.../net.c: In function 'do_pipe':
	.../net.c:1632: warning: implicit declaration of function 'getrval2'
	.../net.c:1632: warning: format '%lu' expects type 'long unsigned int',
	but argument 3 has type 'int'

2010-12-14  Dmitry V. Levin  <ldv@altlinux.org>

	Fix build on uClibc.
	* defs.h [LINUX]: Define PTRACE_GETEVENTMSG macro.
	Patch by Douglas Mencken <dougmencken@gmail.com>.

2010-12-07  Dmitry V. Levin  <ldv@altlinux.org>

	Fix strace -f -o '|command' hangup.
	* strace.c (main): Call test_ptrace_setoptions() before parsing
	-o option, otherwise a forked command will cause a hangup inside
	test_ptrace_setoptions().

2010-12-03  Dmitry V. Levin  <ldv@altlinux.org>

	Output diagnostics to stderr.
	* syscall.c (get_scno): Output information about changes in
	personality mode to stderr.  Reported by Pádraig Brady.

	Recognize more clone flags.
	* process.c (CLONE_*): Define more flags from linux v2.6.25.
	(clone_flags): Add entries for them.
	Proposed by <zhangyanfei@cn.fujitsu.com>.

	Decode struct ucred for getsockopt SO_PEERCRED.
	* net.c (sys_getsockopt): Decode SO_PEERCRED.
	Proposed by Arkadiusz Miśkiewicz <arekm@maven.pl>.

2010-12-03  Carmelo AMOROSO  <carmelo.amoroso@st.com>

	sh: Add support for tracing sys_cacheflush system call.
	* linux/sh/syscallent.h: Update sys_cacheflush entry.
	* linux/syscall.h [SH] (sys_cacheflush): New function declaration.
	* system.c [SH] (cacheflush_flags): New xlat structure.
	[SH] (sys_cacheflush): New function.

	Reviewed-by: Angelo Castello <angelo.castello@st.com>

2010-11-30  Dmitry V. Levin  <ldv@altlinux.org>

	Cleanup test_ptrace_setoptions()
	* strace.c (test_ptrace_setoptions): Cleanup.
	(main): Fix test_ptrace_setoptions() error diagnostics message.
	Print ptrace_setoptions value in debug mode.

2010-11-30  Wang Chao  <wang.chao@cn.fujitsu.com>

	Handle followfork using ptrace_setoptions if available.
	If PTRACE_O_TRACECLONE et al options are supported by kernel,
	use them to do followfork rather than the original setbpt
	method that changes registers ourselves.

	* defs.h [LINUX] (handle_new_child): New function prototype.
	* process.c [LINUX] (handle_new_child): New function based on the
	code from internal_fork(), with a trivial change: do reparent only
	for sys_clone.
	[LINUX] (internal_fork): Use handle_new_child().  Do nothing if
	ptrace_setoptions is in effect.
	* strace.c [LINUX] (handle_ptrace_event): New function.
	[LINUX] (trace): If ptrace_setoptions is in effect, then
	call the new function to handle PTRACE_EVENT_* status, and
	set PTRACE_SETOPTIONS when we see the initial stop of tracee.

2010-11-30  Wang Chao  <wang.chao@cn.fujitsu.com>

	Test how PTRACE_SETOPTIONS support works.
	Currently test fork related options only.  Fork a child that uses
	PTRACE_TRACEME at startup and then does a fork so strace can test
	how the PTRACE_SETOPTIONS support works before it handles any real
	tracee.  Since PTRACE_O_TRACECLONE/*FORK were introduced to kernel
	at the same time, this test seems to be enough for these 3 options.

	* defs.h [LINUX]: Define PTRACE_O_TRACECLONE et al macros here.
	(ptrace_setoptions): New variable declaration.
	* strace.c [LINUX] (test_ptrace_setoptions): New function, tests
	whether kernel supports PTRACE_O_CLONE/*FORK, the result is stored
	in the new variable ptrace_setoptions for later use.
	(main): Call test_ptrace_setoptions() if followfork option is set.

2010-09-17  Dmitry V. Levin  <ldv@altlinux.org>

	Enable support for less verbose build rules.
	* configure.ac (AM_INIT_AUTOMAKE): Add silent-rules.

2010-09-17  Wang Chao  <wang.chao@cn.fujitsu.com>

	Do not trace children cloned with CLONE_UNTRACED flag.
	If clone is called with flag CLONE_UNTRACED, to be consistent with
	option PTRACE_O_TRACECLONE, we should not set CLONE_PTRACE flag on
	its arguments.

	* process.c [LINUX] (internal_fork): Check the syscall and arguments.

2010-09-17  Dmitry V. Levin  <ldv@altlinux.org>

	Update the list of CLOCK_* constants to match Linux kernel v2.6.32+
	* time.c (struct xlat clocknames[]): Add more RT clock IDs.
	Reported by Tommi Rantala.

2010-09-16  Dmitry V. Levin  <ldv@altlinux.org>

	Update linux/hppa/syscallent.h to match Linux kernel v2.6.35.
	* linux/hppa/syscallent.h: Add hooks for recvmmsg and accept4.

2010-09-15  Dmitry V. Levin  <ldv@altlinux.org>

	Pass less information to qualify_one and qual_*
	* syscall.c (qualify_one, qual_syscall, qual_signal, qual_fault,
	qual_desc): Take just a bitflag argument instead of pointer to the whole
	qual_options structure.
	(struct qual_options): Update prototype of "qualify" field.
	(qualify): Update use of qualify_one and qual_options->qualify.

2010-09-15  Wang Chao  <wang.chao@cn.fujitsu.com>

	Fix -e option with only one value in qualifier statement.
	Fix regression introduced by commit v4.5.20-19-g30145dd:
	if -e option is used with only one value in qualifier statement,
	e.g. 'strace -e trace=open ls', syscall information would not be
	printed properly.

	* syscall.c (qualify): Remove faulty optimization.

2010-09-15  Mike Frysinger  <vapier@gentoo.org>

	Fix off_t/rlim_t size checks when cross-compiling.
	The current off_t/rlim_t size checks (wrt size of long long) use AC_RUN
	which obviously doesn't work when cross-compiling.  While we don't hit
	any configure errors, the fall back code is pretty dumb (which is to say
	there isn't any).  Considering the code in question though, we can use
	some fun compiler tricks with sizeof and array lengths to turn it into
	a pure build test and avoid the RUN issue completely.

	* m4/long_long.m4 (AC_OFF_T_IS_LONG_LONG, AC_RLIM_T_IS_LONG_LONG):
	Convert from AC_RUN_IFELSE to AC_COMPILE_IFELSE.

2010-09-15  Mike Frysinger  <vapier@gentoo.org>

	Fix long long little endian detection when cross-compiling.
	The long long endian detection code does an AC_TRY_RUN() and since that
	doesn't work when cross-compiling, it sets a fallback value.  However,
	rather than do any sort of default endian detection, the code simply
	sets it to "no".  This probably breaks most little endian systems out
	there when cross-compiling for them.  It certainly breaks Blackfin
	systems.  So use the common endian detection code provided by autoconf
	and key off of that when cross-compiling.

	* configure.ac: Call AC_C_BIGENDIAN.
	* m4/long_long.m4 (AC_LITTLE_ENDIAN_LONG_LONG): Set cross-compiling
	logic based on ac_cv_c_bigendian.

2010-09-15  Mike Frysinger  <vapier@gentoo.org>

	Blackfin: decode new syscalls.
	* linux/bfin/syscallent.h: Add fanotify/prlimit/cacheflush syscalls.
	* linux/syscall.h: Add sys_cacheflush() decl.
	* system.c: Decode Blackfin's cacheflush syscall.

	* linux/ioctlent.sh: Search a few non-exported paths.

2010-09-15  Roland McGrath  <roland@redhat.com>

	Clean up pid2tcb usage.
	* strace.c (pid2tcb): Always match pid.  Fail for argument <= 0.
	[USE_PROCFS] (first_used_tcb): New function.
	[USE_PROCFS] (trace): Use that instead of pid2tcb(0).

2010-09-09  Dmitry V. Levin  <ldv@altlinux.org>

	Turn on more compiler warnings.
	* configure.ac: Enable gcc -Wwrite-strings.

	Import warnings.m4 from gnulib.
	* m4/warnings.m4: Replace with warnings.m4 from gnulib.
	* configure.ac: Use gl_WARN_ADD from new warnings.m4.
	* Makefile.am (AM_CFLAGS): Update for new warnings.m4.

	Split acinclude.m4.
	* Makefile.am (ACLOCAL_AMFLAGS): Add "-I m4".
	* acinclude.m4: Remove.
	* m4/includedir.m4: New file, with definition of AC_INCLUDEDIR from
	acinclude.m4.
	* m4/long_long.m4: New file, with definitions of AC_OFF_T_IS_LONG_LONG,
	AC_RLIM_T_IS_LONG_LONG and AC_LITTLE_ENDIAN_LONG_LONG from acinclude.m4.
	* m4/procfs.m4: New file, with definitions of AC_MP_PROCFS,
	AC_POLLABLE_PROCFS and AC_STRUCT_PR_SYSCALL from acinclude.m4.
	* m4/stat.m4: New file, with definition of AC_STAT64 from acinclude.m4.
	* m4/statfs.m4: New file, with definition of AC_STATFS64 from
	acinclude.m4.
	* m4/warnings.m4: New file, with definition of AC_WARNFLAGS from
	acinclude.m4.

	* process.c (sys_waitid): Remove unused variable.

2010-09-07  Dmitry V. Levin  <ldv@altlinux.org>

	Fix const-correctness issues uncovered by gcc -Wwrite-strings.
	* defs.h (struct xlat): Add const qualifier to the field of
	type "char *".
	(set_sortby, qualify, printnum, printnum_int): Add const qualifier to
	arguments of type "char *".
	* count.c (set_sortby): Add const qualifier to the argument and
	automatic variable of type "char *".
	* desc.c (decode_select): Add const qualifier to automatic variables of
	type "char *".
	* ioctlsort.c (struct ioctlent): Add const qualifier to fields of
	type "char *".
	(main):  Add const qualifier to argv.
	* process.c (printargv): Add const qualifier to the argument and
	automatic variable of type "char *".
	(printargc) Add const qualifier to argument of type "char *".
	* signal.c (sprintsigmask, parse_sigset_t): Add const qualifier to
	arguments of type "char *".
	* strace.c (progname): Add const qualifier.
	(detach): Add const qualifier to automatic variable of type "char *".
	* stream.c (struct strbuf): Add const qualifier to the field of
	type "char *".
	* syscall.c (struct qual_options): Add const qualifier to fields of
	type "char *".
	(qual_syscall, qual_fault, qual_desc, lookup_class): Add const qualifier
	to arguments of type "char *".
	(qual_signal): Add const qualifier to the argument of type "char *",
	avoid modification of constant argument.
	(qualify): Likewise.
	* util.c (printflags): Add const qualifier to automatic variable of
	type "char *".
	(printnum, printnum_int): Add const qualifier to arguments of
	type "char *".

2010-09-04  Wang Chao  <wang.chao@cn.fujitsu.com>

	Fix printing clone flags.
	When we trace clone() syscall with only exit signal as clone
	flags, strace would print an unnecessary OR operator.

	* process.c (sys_clone): Fix this.

2010-08-28  Wang Chao  <wang.chao@cn.fujitsu.com>

	Drop nclone_detached and related flags.
	Remove nclone_detached since CLONE_DETACHED flag was no-op for a very
	long time in kernel.

	* defs.h (struct tcb): Remove nclone_detached field.
	Remove TCB_CLONE_DETACHED flag.
	* process.c: Remove CLONE_DETACHED flag.
	(clone_flags): Remove CLONE_DETACHED entry.
	(internal_fork, internal_wait): Remove code dealing with CLONE_DETACHED
	flag and nclone_detached.
	* strace.c (startup_attach, alloc_tcb, droptcb, handle_group_exit):
	Likewise.

2010-08-09  Neil Campbell  <lists@thebatcave.org.uk>

	Correct get/set_robust_list syscall numbers for powerpc.
	* linux/powerpc/syscallent.h: Swap positions of get_ and set_robust_list.

2010-08-09  Wang Chao  <wang.chao@cn.fujitsu.com>

	Handle CLONE_PARENT flag.
	* process.c (internal_fork): The parent of new cloned process is the
	same of the calling process when CLONE_PARENT is set.

	Fix error when judging if process has children.
	* process.c (internal_wait): Processes counted in tcp->nclone_threads
	are tcp's threads, rather than tcp's children.

2010-08-09  Wang Chao  <wang.chao@cn.fujitsu.com>

	Forbid using mutually exclusive options -D and -p together.
	If we use -D and -p option together to trace a multi-thread program, in
	addition to the main thread, other threads could not be traced even if we
	present -f option. Moreover, when executing 'strace -D -p <non-exist pid>',
	strace could not terminate normally.

	* strace.c (main): Check it.

2010-08-05  David Daney  <ddaney@caviumnetworks.com>

	Update Linux MIPS syscalls to match 2.6.35-rc6+
	* linux/mips/syscallent.h: Add and update 405 hooks.

2010-08-05  Edgar E. Iglesias  <edgar.iglesias@gmail.com>

	Add support for the MicroBlaze architecture.
	* configure.ac: Recognize MicroBlaze.
	* linux/microblaze/syscallent.h: New file.
	* Makefile.am (EXTRA_DIST): Add linux/microblaze/syscallent.h
	* process.c (change_syscall, struct_user_offsets): Add MicroBlaze
	support.
	* signal.c (sys_sigreturn): Likewise.
	* syscall.c (internal_syscall, get_scno, syscall_fixup, get_error,
	syscall_enter): Likewise.

2010-08-05  Frederik Schüler  <fs@debian.org>

	linux/sparc: add missing syscall declarations.
	* linux/sparc/syscall.h: Sync with linux/syscall.h

2010-07-17  Andreas Schwab  <schwab@linux-m68k.org>

	Handle biarch get/setrlimit.
	* resource.c (print_rlimit32) [POWERPC64 || X86_64]: Define.
	(sys_getrlimit, sys_setrlimit) [POWERPC64 || X86_64]: Use it.

2010-07-13  Andreas Schwab  <schwab@linux-m68k.org>

	Add biarch support for powerpc64.
	* acinclude.m4 (AC_LITTLE_ENDIAN_LONG_LONG): Use int instead of
	long.
	* configure.ac [$host_cpu = powerpc*]: Also define POWERPC64 if
	$host_cpu = powerpc64.
	* defs.h (SUPPORTED_PERSONALITIES, PERSONALITY0_WORDSIZE)
	(PERSONALITY1_WORDSIZE) [POWERPC64]: Define.
	* file.c: (struct stat_powerpc32, printstat_powerpc32) [POWERPC64]:
	Define.
	(printstat) [LINUX && POWERPC64]: Use printstat_powerpc32 in
	32-bit personality.
	(sys_newfstatat) [POWERPC64]: Handle personalities.
	* signal.c (sys_sigreturn) [POWERPC64]: Likewise.
	* util.c (printllval) [POWERPC64]: Likewise.
	(printcall) [POWERPC64]: Use wider format for IP prefix.
	* syscall.c (get_scno) [POWERPC64]: Check for 64/32 bit mode.
	* linux/powerpc/errnoent1.h: New file.
	* linux/powerpc/ioctlent1.h: New file.
	* linux/powerpc/signalent1.h: New file.
	* linux/powerpc/syscallent1.h: New file.

2010-07-09  Andreas Schwab  <schwab@redhat.com>

	Balance braces.
	* strace.c (proc_open): Avoid unbalanced braces.
	(trace): Likewise.

2010-07-06  Andreas Schwab  <schwab@linux-m68k.org>

	Remove extern declaration at file scope.
	* defs.h (force_result): Declare.
	* process.c (internal_wait): Don't declare force_result.

2010-06-24  Andreas Schwab  <schwab@redhat.com>

	Document -C/-D.
	* strace.c (usage): Document -C.
	* strace.1: Document -D.

2010-06-13  Roland McGrath  <roland@redhat.com>

	Fix sourceforge download URL.

2010-06-05  Andreas Schwab  <schwab@linux-m68k.org>

	M68K: Fix fetching syscall arguments.
	* syscall.c (syscall_enter) [M68K]: Properly handle more than five
	syscall arguments.

2010-05-28  Andreas Schwab  <schwab@linux-m68k.org>

	Decode TLS syscalls on m68k.
	* linux/m68k/syscallent.h: Add entries for get_thread_area,
	set_thread_area, atomic_comxchg_32, atomic_barrier.
	* linux/dummy.h (sys_get_thread_area, sys_set_thread_area) [M68K]:
	Don't redefine.
	* mem.c (sys_get_thread_area, sys_set_thread_area) [LINUX && M68K]: New.

	Fix warning when compiling for m68k.
	* syscall.c (d0): Define as long.

2010-04-13  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for 4.5.20 release.
	* NEWS: Update for 4.5.20 release.
	* configure.ac: Version 4.5.20.
	* debian/changelog: 4.5.20-1.
	* strace.spec: 4.5.20-1.

2010-04-13  Frederik Schüler  <fs@debian.org>

	Update debian/* files for the upcoming release.
	* debian/control: update standards-version to 3.8.4.
	* debian/rules: allow parallel building.
	* debian/rules: comment out verbose build, only needed for debugging.
	* debian/rules: clean up clean: target, dh_clean does most of the work
	  already.
	* debian/rules: use *-stamp instead of stamp-*, so dh_clean can tidy
	  up for us.

2010-04-13  Heiko Carstens  <heiko.carstens@de.ibm.com>

	Fix s390 system call table list.
	* linux/s390/syscallent.h: Add the missing entries for preadv and
	pwritev to the system call table list.
	* linux/s390x/syscallent.h: Likewise.

2010-04-07  Dmitry V. Levin  <ldv@altlinux.org>

	Update linux/ioctlent.h.
	* linux/ioctlent.sh: Search in asm-generic directory as well.
	* linux/ioctlent.h: Regenerated.

	Update linux/*/syscallent.h files to match Linux kernel v2.6.33.
	* linux/alpha/syscallent.h: Add 47 hooks.
	* linux/arm/syscallent.h: Update hooks for pselect6, ppoll,
	epoll_pwait.  Add 11 hooks.
	* linux/bfin/syscallent.h: Update hooks for prctl, fallocate,
	signalfd4, eventfd2, epoll_create1, dup3, pipe2, perf_event_open.
	Hook up recvmmsg.
	* linux/hppa/syscallent.h: Update hooks for signalfd4, eventfd2,
	epoll_create1, dup3, pipe2, perf_event_open.
	* linux/i386/syscallent.h: Fix syscall name for the kexec_load hook.
	Add 5 hooks.
	* linux/ia64/syscallent.h: Fix syscall name for the kexec_load hook.
	Add 4 hooks.
	* linux/m68k/syscallent.h: Add 50 hooks.
	* linux/powerpc/syscallent.h: Fix hook for timerfd_create.  Fix
	6 syscall names to match the kernel.  Use sys_semop to parse semop.
	Add 14 hooks.
	* linux/s390/syscallent.h: Fix syscall name for the kexec_load hook.
	Add 14 hooks.
	* linux/s390x/syscallent.h: Likewise.
	* linux/sh/syscallent.h: Add 13 hooks.
	* linux/sh64/syscallent.h: Add 15 hooks.
	* linux/sparc/syscallent.h: Add 22 hooks.
	* linux/x86_64/syscallent.h: Add 5 hooks.

	Enhance recvmmsg parser.
	* net.c (sys_recvmmsg): Decode mmsghdr structure on exit from the
	syscall.  Decode timespec structure both on entrance and on exit.

2010-04-07  Andreas Schwab  <schwab@linux-m68k.org>

	Decode recvmmsg syscall.
	* net.c (do_msghr): New function to print struct msghdr.
	(printmsghdr): Use it.
	(printmmsghdr, sys_recvmmsg): New.
	* linux/syscall.h: Declare sys_recvmmsg.
	(SYS_sub_recvmmsg): Define.
	(SYS_socket_nsubcalls): Bump.
	* linux/sparc/syscall.h: Likewise.
	* linux/arm/syscallent.h: Add sys_recvmmsg.
	* linux/bfin/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/m68k/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/ia64/syscallent.h: Adjust.

2010-04-07  Dmitry V. Levin  <ldv@altlinux.org>

	* strace.1: Fix quoting of hyphens and formatting of strace options.

	Split trace_syscall() for better readability.
	* syscall.c (trace_syscall): Split into trace_syscall_exiting() and
	trace_syscall_entering().

	Implement -C option to combine regular and -c output.
	* defs.h (cflag_t): New enum.
	* strace.1: Document -C option.
	* strace.c (cflag): Update type.
	(main): Handle -C option.
	(trace): Update use of cflag.
	* count.c (count_syscall): Move clearing of TCB_INSYSCALL to ...
	* syscall.c (trace_syscall): ... here.  Update use of cflag.
	Based on patch by Adrien Kunysz.

	Fix "make dist" regression introduced by commit v4.5.19-12-g5078770.
	* Makefile.am (EXTRA_DIST): Rename linux/syscallent.h to linux/i386/syscallent.h

	* desc.c (sys_epoll_pwait): Fix output formatting bug.

	* desc.c (decode_select): Fix potential stack buffer overflow.

2010-03-31  Dmitry V. Levin  <ldv@altlinux.org>

	Fix msgsnd indirect ipccall decoding.
	This regression was introduced by commit v4.5.18-136-g783f5bc.
	* ipc.c (tprint_msgsnd): Add and use "flags" argument.
	(sys_msgsnd): Pass "flags" argument to tprint_msgsnd().
	Patch by Anton Blanchard.

2010-03-23  Mark Wielaard  <mjw@redhat.com>

	Hook up inotify_init1 open mode flags printer.
	* file.c [LINUX] (sys_inotify_init1): New function.
	* linux/syscall.h: Declare new sys_inotify_init1 handler.
	* linux/bfin/syscallent.h: Hook up new handler.
	* linux/hppa/syscallent.h: Likewise.
	* linux/i386/syscallent.h: Likewise.
	* linux/x86_64/syscallent.h: Likewise.

2010-03-09  Andreas Schwab  <schwab@redhat.com>

	Avoid spurious error when checking for linux/netlink.h.
	* configure.ac: Include <asm/types.h> when checking for
	linux/netlink.h.

2010-02-23  Andreas Schwab  <schwab@linux-m68k.org>

	Fix reporting signal mask by sigreturn on powerpc.
	* signal.c (sys_sigreturn) [POWERPC]: Skip dummy stack frame when
	locating signal context.

2010-02-09  David Daney  <ddaney@caviumnetworks.com>

	Fix MIPS N32/N64 compile error.
	* syscall.c [LINUX_MIPSN32 || LINUX_MIPSN64] (syscall_enter): Pass
	tcp->pid to ptrace().

2010-02-05  Chris Metcalf  <cmetcalf@tilera.com>

	Add support for the TILE architecture.
	* configure.ac: Add TILE to the list of supported architectures.
	* defs.h: Define TCB_WAITEXECVE for TILE.
	* linux/tile/syscallent.h: New file.
	* Makefile.am (EXTRA_DIST): Add linux/tile/syscallent.h
	* process.c (change_syscall, struct_user_offsets): Add TILE support.
	* syscall.c (get_scno, get_error, syscall_enter): Likewise.
	* mem.c (mmap_flags, print_mmap): Add MAP_CACHE_xxx TILE extensions
	support.
	* signal.c (sigact_flags): Add SA_NOPTRACE.
	(sys_sigreturn): Add TILE support.

2010-02-04  Dmitry V. Levin  <ldv@altlinux.org>

	Remove dead code.
	* defs.h (tv_tv): Remove.
	* net.c (sys_xsetsockaddr): Remove commented out dead code.
	* process.c (setarg, sys_execv, sys_execve, struct_user_offsets):
	Likewise.
	* signal.c (sys_sigsuspend): Likewise.
	* strace.c (reaper, trace): Likewise.
	* stream.c (internal_stream_ioctl): Likewise.
	* syscall.c (trace_syscall): Likewise.
	* term.c (term_ioctl): Likewise.
	* util.c (tv_tv, umoven, uload, getpc, fixvfork, setbpt, clearbpt):
	Likewise.

	Merge Linux internal_clone() into internal_fork()
	* defs.h (internal_clone): Remove.
	* process.c (internal_clone): Merge into internal_fork().
	(internal_fork) [!LINUX]: Remove dead code.
	* syscall.c (internal_syscall): Replace internal_clone() with
	internal_fork().

	* Makefile.am (INCLUDES): Remove redundant search directories.

2010-02-04  Frederik Schüler  <fs@debian.org>

	Update debian/* files.
	* debian/control: add sparc64 to the architectures list.
	This closes Debian bug #560062
	* Backport commit f0df31e71a58c6e79ba77c1a9d84b2f38d44bec7 to fix FTBFS.
	This closes Debian bug #560516
	* debian/control: Update standards-version to 3.8.3.
	* debian/control: Lower package priority to optional, matching
	the archive override.
	* debian/control: add ${misc:Depends} to Depends: lines where
	appropriate.
	* debian/watch: new file, allows automatic tracking of new
	upstream versions.
	* debian/source/format: new file, adapt to debian source format "quilt"
	* debian/rules: indentation cleanups; use dh_testroot and dh_prep
	in clean target.

2010-01-25  Andreas Schwab  <schwab@redhat.com>

	Fix spurious failure of AC_STAT64 test.
	* acinclude.m4 (AC_STAT64): Include <sys/types.h> first.

2010-01-12  Andreas Schwab  <schwab@redhat.com>

	Don't kill the process when detaching.
	* strace.c (detach): Call clearbpt when TCB_BPTSET is set.

2009-12-25  Dmitry V. Levin  <ldv@altlinux.org>

	Decode fifth argument of mremap syscall.
	* mem.c (sys_mremap): Decode fifth argument.
	* linux/*/syscallent.h: Update the number of mremap syscall arguments.

2009-12-24  Chris Metcalf  <cmetcalf@tilera.com>

	* mem.c (sys_mbind): Display first argument in hex.

	* mem.c (mremap_flags): Add MREMAP_FIXED.

2009-11-16  Mike Frysinger  <vapier@gentoo.org>

	Move i386-specific files out of common linux dir.
	* linux/syscallent.h: Moved to ...
	* linux/i386/syscallent.h: ... here.
	* linux/ia64/syscallent.h: Update i386 syscallent.h include.
	* linux/sparc/gen.pl: Likewise.
	* linux/x86_64/syscallent1.h: Likewise.

2009-11-16  Andreas Schwab  <schwab@redhat.com>

	Remove support for pre-C89.
	* defs.h: Remove references to __STDC__ and P macros.
	* strace.c: Likewise.

2009-11-13  Dmitry V. Levin  <ldv@altlinux.org>

	Decode more SOL_PACKET socket options.
	* net.c (sockpacketoptions): Add more PACKET_* entries.
	(sys_getsockopt): Decode PACKET_STATISTICS.
	(printsockopt): Decode PACKET_RX_RING and PACKET_TX_RING.
	Patch by Gabor Gombas.

2009-11-11  Andreas Schwab  <schwab@redhat.com>

	Ignore errors if a thread is killed.
	* util.c (clearbpt): Ignore ESRCH error.

2009-11-06  Bernhard Reutner-Fischer  <rep.dot.nop@gmail.com>

	Fix handling of Linux systems without struct statfs64.
	* acinclude.m4 (AC_STATFS64): New macro to check for struct statfs64.
	* configure.ac: Call AC_STATFS64.
	* file.c (printstatfs64, sys_statfs64, sys_fstatfs64): Compile only
	  if struct statfs64 is available.

2009-11-06  Dmitry V. Levin  <ldv@altlinux.org>

	Fix getsockopt decoding on architectures where sizeof(long) > sizeof(int)
	* net.c (sys_getsockopt): Optimize output a bit.
	Decode integer argument using printnum_int(), patch by Gabor Gombas.

	Check umove() return code.
	* bjm.c (sys_query_module): Print input parameters when entering
	syscall.  Fix handling of syscall error.  Handle unlikely umove()
	failures.
	* ipc.c (tprint_msgrcv): New function.  Move part of msgrcv parser code
	here, add check umove() return code.
	(sys_msgsnd): Print msqid parameter as int instead of long.
	(sys_msgrcv): Likewise.  Use tprint_msgrcv().
	* process.c (print_affinitylist): Check umove() return code.
	* sock.c (sock_ioctl): Handle unlikely umove() failure in the
	SIOCGIFCONF parser.

	Fix check for linux/netlink.h on Linux 2.6.32-rc5+
	* configure.ac (AC_CHECK_HEADERS): In check for linux/netlink.h, include
	sys/socket.h instead of linux/socket.h beforehand.

2009-11-04  Andreas Schwab  <schwab@redhat.com>

	Decode fallocate on PowerPC.
	* linux/powerpc/syscallent.h: Decode fallocate.

	Factor out printing of 64bit syscall argument.
	* defs.h (ALIGN64): Remove.
	(printllval): Declare.
	* util.c (printllval): Define.
	* file.c (sys_readahead): Use printllval.
	(sys_lseek64): Likewise.
	(sys_truncate64): Likewise.
	(sys_ftruncate64): Likewise.
	(sys_fadvise64): Likewise.
	(sys_fadvise64_64): Likewise.
	(sys_fallocate): Likewise.
	* io.c (sys_pread): Likewise.
	(sys_pwrite): Likewise.
	(sys_pread64): Likewise.
	(sys_pwrite64): Likewise.
	* mem.c (sys_mmap64): Likewise.

2009-11-03  Andreas Schwab  <schwab@redhat.com>

	Correct decoding of readahead and fadvice64(_64) on PowerPC.
	* file.c (sys_readahead): Align 64bit argument.  Handle PowerPC64
	like other 64bit architectures.
	(sys_fadvise64): Likewise.
	(sys_fadvise64_64): Handle PowerPC like ARM.
	* linux/powerpc/syscallent.h (sys_readahead): Account for 64bit
	argument alignment on PowerPC32.

2009-10-27  Andreas Schwab  <schwab@redhat.com>

	Maintain separate print column for each process.
	* defs.h (struct tcp): Add curcol.
	* strace.c: (alloc_tcb): Initialize it.
	(trace): Use curcol from current process and save it before
	continuing.
	(tprintf): Don't modify curcol on output error.

2009-10-21  Roland McGrath  <roland@redhat.com>

	* strace.spec: 4.5.19-1 release.

2009-10-21  Dmitry V. Levin  <ldv@altlinux.org>

	* file.c (printstat64): Cleanup trailing whitespace.

2009-10-16  Andreas Schwab  <schwab@redhat.com>

	Fix decoding of newfstatat syscall on x86-64.
	* file.c (printstat64) [LINUX && X68_64]: If tracing a 64-bit
	process redirect to printstat.
	Fixes RH#529316 "Field values shown for "newfstatat" system
	call are incorrect"

2009-10-12  Dmitry V. Levin  <ldv@altlinux.org>

	* configure.ac (AC_CHECK_HEADERS): Remove asm/reg.h.

2009-10-12  Mike Frysinger  <vapier@gentoo.org>

	sparc/linux: Rewrite to use asm/ptrace.h.
	The current sparc/linux code uses asm/reg.h, but recent Linux kernels
	dropped that header completely.  So switch over to the ptrace headers
	as those should stick around indefinitely as part of the ABI.

	* defs.h [LINUXSPARC] (U_REG_G1, U_REG_O0, U_REG_O1): Define.
	* process.c: Drop asm/regs.h include.
	[SPARC || SPARC64] (change_syscall): Change struct regs to struct pt_regs.
	* signal.c: Drop asm/regs.h include.
	(m_siginfo_t): Unify [SPARC || SPARC64] and [MIPS].
	[SPARC || SPARC64] (sys_sigreturn): Change struct regs to struct pt_regs.
	* syscall.c: Drop asm/regs.h include.
	[SPARC || SPARC64] (internal_syscall, get_scno, get_error, force_result,
	syscall_enter): Change struct regs to struct pt_regs.
	* util.c: Drop asm/regs.h include.
	(_hack_syscall5, _ptrace): Delete.
	[SPARC || SPARC64] (getpc, printcall, arg_setup_state): Change
	struct regs to struct pt_regs.

2009-10-11  Roland McGrath  <roland@redhat.com>

	* make-dist: Clean up.

	* configure.ac: Use AC_CONFIG_AUX_DIR([.]).

2009-10-09  Dmitry V. Levin  <ldv@altlinux.org>

	* make-dist: New script for preparing release tarballs.

	* git-set-file-times: Import from rsync.

	* Makefile.am [MAINTAINER_MODE]: Define and export TAR_OPTIONS.

2009-10-08  Dmitry V. Levin  <ldv@altlinux.org>

	Enhance msgsnd() parser.
	* ipc.c (tprint_msgsnd): New function.  Move msgsnd parser code here,
	add check for umove() return code.
	(sys_msgsnd): Use tprint_msgsnd().

	* NEWS: Update for 4.5.19 release.

	Enhance semop()/semtimedop() sembuf parser.
	* ipc.c (tprint_sembuf): New function. Move sembuf parser code here,
	add abbrev() support.
	(sys_semop, sys_semtimedop): Use tprint_sembuf().

2009-10-08  Jakub Bogusz  <qboosh@pld-linux.org>

	Add pretty printing of sembuf argument to semop() and semtimedop()
	* ipc.c (semop_flags): New xlat structure.
	(sys_semop, sys_semtimedop): Add pretty printing of sembuf argument.

2009-10-08  Mike Frysinger  <vapier@gentoo.org>

	Add support for Linux/no-mmu with vfork.
	* configure.ac (AC_CHECK_FUNCS): Add fork.
	* strace.c (strace_vforked): Define.
	(startup_child): Do not raise SIGSTOP if vforked.
	(trace): Skip first exec when starting up after vforked.
	* syscall.c [BFIN] (get_scno): Drop waitexec checks.

	Avoid malloc(0) in getdents parsers.
	On end of directory, getdents returns 0.  This return value is used to
	then try and do malloc(0), but on some systems this will always return
	NULL.  Since the code won't read the pointer in question if len is 0,
	then don't bother calling malloc(0) and set the pointer to NULL ourself.
	* file.c (sys_getdents, sys_getdents64): Avoid malloc(0) call.

2009-10-07  Mike Frysinger  <vapier@gentoo.org>

	Add sys_nanosleep() prototype for sparc.
	* linux/sparc/syscall.h (sys_nanosleep): New prototype.
	Reported by Frederik Schüler.

	Silence compiler warnings about implicit cast from pointer to integer.
	* util.c (do_ptrace): Cast ptrace() 4th arg to long.
	(ptrace_restart): Drop void* cast on ptrace() 4th arg.

	Ignore .gdb files from FLAT toolchains.
	* .gitignore: Add /*.gdb.

	* configure.ac (AC_CHECK_FUNCS): Sort and expand.

	Blackfin: Update ioctl/syscall lists.
	* linux/bfin/ioctlent.h: Sync list with latest kernel sources.
	* linux/bfin/syscallent.h: Likewise.

	ioctlsort: Check ppc hosts too.
	* linux/ioctlsort.c: Check for __powerpc__.

2009-10-07  Andreas Schwab  <schwab@redhat.com>

	Fix build on ia64.
	* linux/ia64/syscallent.h: Update for addition of accept4 syscall
	in ../syscallent.h.

2009-10-07  Roland McGrath  <roland@redhat.com>

	* strace.spec (%doc): Add ChangeLog-CVS.

	* Makefile.am (srpm): New phony target.

	* Makefile.am (EXTRA_DIST): Add ChangeLog.
	($(srcdir)/ChangeLog): New target, replaces gen-changelog phony target.
	Put it inside [MAINTAINER_MODE].

2009-10-06  Dmitry V. Levin  <ldv@altlinux.org>

	* NEWS: Update for 4.5.19 release.

2009-10-05  Frederik Schüler  <fs@debian.org>

	Prepare debian/* files for release.
	* debian/rules: Do not ship ChangeLog anymore.
	* debian/control: Update to Debian standards version 3.8.1, and remove
	Roland from the Maintainers list.  This closes Debian bug #521458.
	* debian/changelog: Document changes and prepare for release.

2009-10-05  Dmitry V. Levin  <ldv@altlinux.org>

	* defs.h [HPPA]: Lower MAX_ARGS from 32 to 6.

	* ipc.c [LINUX] (sys_shmat): HPPA does not use an IPC multiplexer.
	Based on patch from Carlos O'Donell.

2009-10-05  Carlos O'Donell  <carlos@systemhalted.org>

	* linux/hppa/syscallent.h: Update syscalls.
	Based on work by Kyle McMartin and Helge Deller.

	Fix SA_HANDLER function pointer comparisons for hppa.
	* signal.c (sys_sigaction): Cast SA_HANDLER function pointers to long.
	(sys_rt_sigaction): Likewise.

2009-10-05  Edgar E. Iglesias  <edgar.iglesias@gmail.com>

	CRIS: Correct first argument to upeek()
	This complements commit ea0e6e80260d2b1b7ad40282012b0e47869bcddf.
	* syscall.c [CRISV10 || CRISV32] (syscall_fixup, syscall_enter): Pass
	tcp pointer instead of pid to upeek().
	* util.c [CRISV10 || CRISV32] (printcall): Likewise.

2009-10-05  Dmitry V. Levin  <ldv@altlinux.org>

	* signal.c (do_signalfd): Fix typo in output format.

2009-09-21  Dmitry V. Levin  <ldv@altlinux.org>

	* Makefile.am (gen_changelog_start_date): Fix date.

2009-09-19  Dmitry V. Levin  <ldv@altlinux.org>

	Prepare for 4.5.19 release.
	* NEWS: Update for 4.5.19 release.
	* configure.ac: Version 4.5.19.
	* debian/changelog: 4.5.19-1.
	* strace.spec: 4.5.19-1.

	Update debian/* to 4.5.18-1.
	* debian/changelog: Update to 4.5.18-1.
	* debian/compat: Set compatibility level to 7.
	* debian/control (Build-Depends): Update debhelper requirement.
	(strace, strace64): Add Section and Priority tags.

2009-09-19  Kirill A. Shutemov  <kirill@shutemov.name>

	Fix fadvise64 decoding on ARM.
	* file.c (sys_fadvise64_64) [ARM]: Fix argument ordering.

2009-09-18  Dmitry V. Levin  <ldv@altlinux.org>

	Fix follow fork/vfork on Linux ARM OABI.
	__NR_SYSCALL_BASE eis 0 for EABI and is 0x900000 for OABI.
	* process (change_syscall) [LINUX && ARM]: Mask off the high order bits
	when changing syscall.

	Reviewed-by: Kirill A. Shutemov <kirill@shutemov.name>

2009-09-18  Mike Frysinger  <vapier@gentoo.org>

	Mark shell scripts as executable.

	Ignore ioctlsort helper program.
	* .gitignore: Add ioctlsort.

	linux/errno: Add ERFKILL.
	* linux/errnoent.h: Change ERRNO_132 to ERFKILL according to errno 132
	definition introduced in Linux 2.6.31.

2009-09-01  Paolo Bonzini  <pbonzini@redhat.com>

	Add accept4 socketcall.
	This second patch in the series adds support for accept4 as a socketcall
	sub-call.  Besides the need to renumber all system calls, this poses
	no problem.
	Tested on i686.

	* linux/arm/syscallent.h: Add accept4 socketcall.
	* linux/m68k/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/syscallent.h: Likewise.

	* linux/sparc/syscall.h (SYS_sub_accept4): Declare.
	(SYS_socket_nsubcalls): Update.
	* linux/syscall.h: Likewise.

2009-09-01  Paolo Bonzini  <pbonzini@redhat.com>

	Replace x86-64 paccept with accept4.
	This patch changes the paccept syscall to accept4 for x86-64, since
	the former was dropped in Linux kernel commit v2.6.27-rc7-14-g2d4c826.
	At the same time, it adds support for pretty printing its arguments.

	* linux/x86_64/syscallent.h: Replace paccept with accept4,
	hook in sys_accept4.
	* net.c (sys_accept): Leave a small stub calling the new...
	(do_accept): ... function, which also adds a flags_arg argument.
	(sys_accept4): New.

2009-08-28  Andreas Schwab  <schwab@redhat.com>

	Zero-extend 32-bit addresses when printing argv array.
	(printargv): Zero-extend 32-bit addresses.
	Fixes RH#519480 "64-bit strace is lazy on execve of 32-bit
	process".

2009-08-12  Andreas Schwab  <schwab@redhat.com>

	Add more futex decoding.
	* process.c (FUTEX_WAIT_REQUEUE_PI, FUTEX_CMP_REQUEUE_PI)
	(FUTEX_PRIVATE_FLAG, FUTEX_CLOCK_REALTIME): Define.
	(futexops): Add entries for them.
	(sys_futex): Decode FUTEX_CMP_REQUEUE_PI and
	FUTEX_WAIT_REQUEUE_PI.

2009-07-08  Dmitry V. Levin  <ldv@altlinux.org>

	Generate ChangeLog from git log.
	* .gitignore: Add ChangeLog
	* ChangeLog: Rename to ChangeLog-CVS.
	* Makefile.am (gen-changelog): New rule.
	(dist-hook): Depend on it.
	(EXTRA_DIST): Add ChangeLog-CVS.
	* README-hacking: Describe changes.
	* gitlog-to-changelog: Import from gnulib.


See ChangeLog-CVS for older changes.
