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.
