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.

	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.

	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.

	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.

	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.

	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.

	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.

	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.

	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.

	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.

	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.

	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.

	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.

	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.

	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.

	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.

	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.

	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).

	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.

	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

	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
