]> granicus.if.org Git - strace/log
strace
10 years agoAdd -k option to print stack trace after each syscall
Luca Clementi [Tue, 23 Jul 2013 07:11:35 +0000 (00:11 -0700)]
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.

10 years agosysctl: update CTL_*, KERN_*, NET_*, and VM_* constants
Dmitry V. Levin [Sat, 26 Apr 2014 13:54:12 +0000 (13:54 +0000)]
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.

10 years agoCheck for constants used by waitid function
Dmitry V. Levin [Sat, 26 Apr 2014 15:22:08 +0000 (15:22 +0000)]
Check for constants used by waitid function

* configure.ac (AC_CHECK_DECLS): Add P_* constants.

10 years agoCheck for LO_FLAGS_READ_ONLY constant
Dmitry V. Levin [Sat, 26 Apr 2014 14:12:33 +0000 (14:12 +0000)]
Check for LO_FLAGS_READ_ONLY constant

* configure.ac (AC_CHECK_DECLS): Add LO_FLAGS_READ_ONLY.

10 years agoCompress blank lines
Dmitry V. Levin [Sat, 26 Apr 2014 18:10:19 +0000 (18:10 +0000)]
Compress blank lines

Suppress empty lines left after automated xlat conversion.

10 years agoxlat: cleanup the aftermath of automatic conversion
Dmitry V. Levin [Sat, 26 Apr 2014 15:35:02 +0000 (15:35 +0000)]
xlat: cleanup the aftermath of automatic conversion

10 years agoGenerate xlat/*.in files
Dmitry V. Levin [Fri, 25 Apr 2014 23:30:54 +0000 (23:30 +0000)]
Generate xlat/*.in files

Automatically convert xlat structures from *.c files to xlat/*.in files
using "./generate_xlat_in.sh *.c" command.

10 years agoRename several xlat structures to avoid collisions
Dmitry V. Levin [Fri, 25 Apr 2014 23:39:20 +0000 (23:39 +0000)]
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.

10 years agoEnhance xlat generator
Dmitry V. Levin [Fri, 25 Apr 2014 23:04:13 +0000 (23:04 +0000)]
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.

10 years agoUse bootstrap script consistently
Dmitry V. Levin [Fri, 25 Apr 2014 22:52:06 +0000 (22:52 +0000)]
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.

10 years agoImplement xlat generator
Mike Frysinger [Sun, 16 Feb 2014 06:59:20 +0000 (01:59 -0500)]
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.

10 years agotests: fix SCM_RIGHTS test for big-endian systems
Dmitry V. Levin [Fri, 30 May 2014 15:18:00 +0000 (15:18 +0000)]
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.

10 years agoDecode file descriptors passed via SCM_RIGHTS control messages
Dmitry V. Levin [Thu, 29 May 2014 21:35:34 +0000 (21:35 +0000)]
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.

10 years agotests: add a test for -c and -w options
Dmitry V. Levin [Thu, 29 May 2014 21:14:14 +0000 (21:14 +0000)]
tests: add a test for -c and -w options

* tests/count.test: New test.
* tests/Makefile.am (TESTS): Add it.

10 years agoOptionally produce stats on syscall latency
Mark Hills [Wed, 28 May 2014 16:52:40 +0000 (17:52 +0100)]
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.

Signed-off-by: Mark Hills <mark.hills@framestore.com>
10 years agoConstify count_syscall function
Dmitry V. Levin [Thu, 29 May 2014 18:10:00 +0000 (18:10 +0000)]
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.

10 years agoConstify tv_* functions
Dmitry V. Levin [Thu, 29 May 2014 17:59:01 +0000 (17:59 +0000)]
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.

10 years agoUse printstr for sethostname, setdomainname, and gethostname decoding
Dmitry V. Levin [Wed, 28 May 2014 16:38:44 +0000 (16:38 +0000)]
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.

10 years agoFix {get,set}rlimit decoding with unreliable SIZEOF_RLIM_T
James Hogan [Fri, 2 May 2014 13:15:41 +0000 (14:15 +0100)]
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.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
10 years agoEnhance setns syscall decoding
Masatake YAMATO [Tue, 13 May 2014 16:46:04 +0000 (01:46 +0900)]
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.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
10 years agomips: fix syscall entries that should have TP flag set
Dmitry V. Levin [Tue, 29 Apr 2014 18:15:43 +0000 (18:15 +0000)]
mips: fix syscall entries that should have TP flag set

10 years agoxtensa: fix unshare syscall entry
Dmitry V. Levin [Tue, 29 Apr 2014 18:15:43 +0000 (18:15 +0000)]
xtensa: fix unshare syscall entry

10 years agoalpha, hppa, mips n64: fix waitid syscall entry
Dmitry V. Levin [Tue, 29 Apr 2014 18:15:43 +0000 (18:15 +0000)]
alpha, hppa, mips n64: fix waitid syscall entry

10 years agoAdd TM flag to shmat and shmdt syscall entries
Dmitry V. Levin [Tue, 29 Apr 2014 18:15:43 +0000 (18:15 +0000)]
Add TM flag to shmat and shmdt syscall entries

10 years agoAlias sys_vfork to sys_fork
Dmitry V. Levin [Mon, 12 May 2014 13:43:10 +0000 (13:43 +0000)]
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.

10 years agoepoll_ctl: fix EPOLL_CTL_DEL argument decoding
Dmitry V. Levin [Thu, 17 Apr 2014 14:33:59 +0000 (14:33 +0000)]
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>
10 years agoUpdate CLOCK_* constants
Dmitry V. Levin [Thu, 17 Apr 2014 14:01:42 +0000 (14:01 +0000)]
Update CLOCK_* constants

* time.c (clocknames): Add CLOCK_BOOTTIME, CLOCK_REALTIME_ALARM,
CLOCK_BOOTTIME_ALARM, CLOCK_SGI_CYCLE, and CLOCK_TAI.
Fixes RH#1088455.

10 years agoFix preadv/pwritev offset decoding
Dmitry V. Levin [Thu, 17 Apr 2014 13:32:47 +0000 (13:32 +0000)]
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>
10 years agotests: add a test for pread/pwrite and preadv/pwritev offset decoding
Dmitry V. Levin [Wed, 16 Apr 2014 23:28:29 +0000 (23:28 +0000)]
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.

10 years agoRefactor LDT decoding
Dmitry V. Levin [Thu, 10 Apr 2014 14:10:17 +0000 (14:10 +0000)]
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.

10 years agoMake int3 example in comments more cut-n-pastable
Denys Vlasenko [Thu, 10 Apr 2014 07:57:17 +0000 (09:57 +0200)]
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.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
10 years agomips: enable decoding of set_thread_area
Dmitry V. Levin [Wed, 9 Apr 2014 13:14:44 +0000 (13:14 +0000)]
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.

10 years agox86_64, x32: enable decoding of modify_ldt, get_thread_area, and set_thread_area
Dmitry V. Levin [Wed, 9 Apr 2014 12:46:05 +0000 (12:46 +0000)]
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.

10 years agox32: decode clone LDT user_desc entries for x86 processes
Dmitry V. Levin [Wed, 9 Apr 2014 12:30:38 +0000 (12:30 +0000)]
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.

10 years agox86-64: decode clone LDT user_desc entries for x86 processes
Elliott Hughes [Sat, 5 Apr 2014 18:56:17 +0000 (11:56 -0700)]
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.

Signed-off-by: Elliott Hughes <enh@google.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
10 years agox32: fix clone(2) argument order for x86 processes
Dmitry V. Levin [Wed, 9 Apr 2014 12:34:58 +0000 (12:34 +0000)]
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.

10 years agox86-64: fix clone(2) argument order for x86 processes
Elliott Hughes [Sat, 5 Apr 2014 18:56:17 +0000 (11:56 -0700)]
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.

Signed-off-by: Elliott Hughes <enh@google.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
10 years agoaarch64: Fix decoding of arm struct stat64
Elliott Hughes [Fri, 4 Apr 2014 00:50:14 +0000 (17:50 -0700)]
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.

Signed-off-by: Elliott Hughes <enh@google.com>
10 years agoARM EABI: disable OABI support by default
Dmitry V. Levin [Tue, 18 Mar 2014 23:37:43 +0000 (23:37 +0000)]
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.

10 years agoFix stat decoding for LP64 bionic
Elliott Hughes [Wed, 12 Mar 2014 17:31:04 +0000 (10:31 -0700)]
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.

Signed-off-by: Elliott Hughes <enh@google.com>
10 years agoDecode protocol argument for PF_NETLINK sockets
Masatake YAMATO [Tue, 11 Mar 2014 14:37:37 +0000 (23:37 +0900)]
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.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Acked-by: Mike Frysinger <vapier@gentoo.org>
10 years agoCleanup socketpair decoding
Dmitry V. Levin [Tue, 11 Mar 2014 22:50:39 +0000 (22:50 +0000)]
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.

10 years agoprintsiginfo: add SIGSYS decoding
Dmitry V. Levin [Tue, 11 Mar 2014 22:18:40 +0000 (22:18 +0000)]
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.

10 years agoUpdate siginfo codes
Dmitry V. Levin [Tue, 11 Mar 2014 01:57:02 +0000 (01:57 +0000)]
Update siginfo codes

* signal.c (siginfo_codes): Add SI_DETHREAD.

10 years agoFactor out printing of si_pid and si_uid members of siginfo_t
Dmitry V. Levin [Tue, 11 Mar 2014 00:05:19 +0000 (00:05 +0000)]
Factor out printing of si_pid and si_uid members of siginfo_t

* signal.c (printsigsource): New function.
(printsiginfo): Use it.

10 years agoImprove SI_TIMER decoding
Elliott Hughes [Mon, 10 Mar 2014 19:27:22 +0000 (19:27 +0000)]
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.

Signed-off-by: Elliott Hughes <enh@google.com>
10 years agoaarch64: fix decoding of arm syscall numbers
Elliott Hughes [Mon, 3 Mar 2014 23:45:26 +0000 (23:45 +0000)]
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.

Signed-off-by: Elliott Hughes <enh@google.com>
10 years agoFix fcntl decoding
Dmitry V. Levin [Mon, 3 Mar 2014 23:09:47 +0000 (23:09 +0000)]
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.

10 years agosys_fcntl: remove F_FREESP and F_FREESP64 support
Dmitry V. Levin [Sat, 1 Mar 2014 21:17:17 +0000 (21:17 +0000)]
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.

10 years agoAdd multi-personality support to struct old_sigaction decoding
Elliott Hughes [Fri, 28 Feb 2014 23:21:35 +0000 (23:21 +0000)]
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.

Signed-off-by: Elliott Hughes <enh@google.com>
10 years agoFix decoding of arm struct stat64 by aarch64 strace.
Elliott Hughes [Fri, 28 Feb 2014 23:16:32 +0000 (23:16 +0000)]
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.

Signed-off-by: Elliott Hughes <enh@google.com>
10 years agoRemove obsolete ioctlsort.c
Dmitry V. Levin [Fri, 28 Feb 2014 22:44:43 +0000 (22:44 +0000)]
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>
10 years agoAdd multi-personality support to stack_t decoding
Dmitry V. Levin [Wed, 26 Feb 2014 22:29:27 +0000 (22:29 +0000)]
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>
10 years agoRewrite signal mask decoding without sigset_t
Dmitry V. Levin [Wed, 26 Feb 2014 16:51:28 +0000 (16:51 +0000)]
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.

10 years agoFix build with Bionic libc
Dmitry V. Levin [Wed, 26 Feb 2014 00:01:00 +0000 (00:01 +0000)]
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>
10 years agopowerpc64: fix 64-bit process detection on embedded
James Yang [Tue, 18 Feb 2014 21:32:43 +0000 (15:32 -0600)]
powerpc64: fix 64-bit process detection on embedded

* syscall.c (get_scno) [POWERPC64]: Fix 64-bit process detection
on embedded powerpc.

Signed-off-by: James Yang <james.yang@freescale.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
10 years agoDo not compile scsi ioctl decoding if <scsi/sg.h> is not available
Dmitry V. Levin [Tue, 25 Feb 2014 23:04:55 +0000 (23:04 +0000)]
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>
10 years agoRevert "Add support for Altera's Nios-II softcore architecture"
Dmitry V. Levin [Fri, 14 Feb 2014 22:31:10 +0000 (22:31 +0000)]
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.

10 years agotests: tighten sigaction check
Dmitry V. Levin [Sat, 8 Feb 2014 00:37:48 +0000 (00:37 +0000)]
tests: tighten sigaction check

* tests/sigaction.awk: Check that input conatins all expected lines.

10 years agoFix sigaction reporting on non-x86 architectures
Dmitry V. Levin [Sat, 8 Feb 2014 00:26:06 +0000 (00:26 +0000)]
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.

10 years agoCheck for SA_RESTORER definition in <asm/signal.h>
Dmitry V. Levin [Sat, 8 Feb 2014 00:15:52 +0000 (00:15 +0000)]
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>.

10 years agoarm: fix compilation warning
Dmitry V. Levin [Fri, 7 Feb 2014 18:02:39 +0000 (18:02 +0000)]
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.

10 years agokexec: fix typo
Dmitry V. Levin [Thu, 6 Feb 2014 21:13:36 +0000 (21:13 +0000)]
kexec: fix typo

* kexec.c (print_kexec_segments) [SUPPORTED_PERSONALITIES == 1]: Fix typo.

10 years agoAdd support for Altera's Nios-II softcore architecture
Ezequiel Garcia [Thu, 6 Feb 2014 17:53:54 +0000 (14:53 -0300)]
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.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Acked-by: Mike Frysinger <vapier@gentoo.org>
10 years agoImplement add_key, keyctl, and request_key decoding
Dmitry V. Levin [Wed, 5 Feb 2014 22:41:45 +0000 (22:41 +0000)]
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.

10 years agoImplement ioprio_get and ioprio_set decoding
Dmitry V. Levin [Wed, 5 Feb 2014 17:27:43 +0000 (17:27 +0000)]
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.

10 years agoImplement finit_module decoding
Dmitry V. Levin [Wed, 5 Feb 2014 16:17:02 +0000 (16:17 +0000)]
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.

10 years agoCleanup inotify syscalls decoding
Dmitry V. Levin [Wed, 5 Feb 2014 15:43:04 +0000 (15:43 +0000)]
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.

10 years agoEnhance reboot decoding
Dmitry V. Levin [Wed, 5 Feb 2014 14:51:19 +0000 (14:51 +0000)]
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.

10 years agoImplement kexec_load decoding
Dmitry V. Levin [Wed, 5 Feb 2014 13:48:26 +0000 (13:48 +0000)]
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.

10 years agoUse prepared editions of recently imported linux headers
Dmitry V. Levin [Wed, 5 Feb 2014 12:56:26 +0000 (12:56 +0000)]
Use prepared editions of recently imported linux headers

* linux/fanotify.h: Replace with edition prepared with headers_install.sh.
* linux/personality.h: Likewise.

10 years agoImplement fanotify_init and fanotify_mark decoding
Dmitry V. Levin [Wed, 5 Feb 2014 04:13:18 +0000 (04:13 +0000)]
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.

10 years agoUse XLAT_END macro
Dmitry V. Levin [Wed, 5 Feb 2014 02:20:51 +0000 (02:20 +0000)]
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/

10 years agoItroduce XLAT_END macro to make xlat structures more compact
Dmitry V. Levin [Wed, 5 Feb 2014 02:18:52 +0000 (02:18 +0000)]
Itroduce XLAT_END macro to make xlat structures more compact

* defs.h (XLAT_END): New macro.

10 years agoConvert personality_options to XLAT form
Dmitry V. Levin [Wed, 5 Feb 2014 02:09:49 +0000 (02:09 +0000)]
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.

10 years agoConvert futexops to XLAT form
Dmitry V. Levin [Wed, 5 Feb 2014 02:01:16 +0000 (02:01 +0000)]
Convert futexops to XLAT form

* process.c: Define FUTEX_*_PRIVATE macros.
(futexops): Convert to XLAT form.

10 years agoConvert sigev_value to XLAT form
Dmitry V. Levin [Wed, 5 Feb 2014 01:46:10 +0000 (01:46 +0000)]
Convert sigev_value to XLAT form

* time.c (sigev_value): Convert to XLAT form.
(printsigevent32, printsigevent): Update use of sigev_value.

10 years agoUse XLAT macro
Dmitry V. Levin [Wed, 5 Feb 2014 01:33:50 +0000 (01:33 +0000)]
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)/

10 years agoIntroduce XLAT macro to ease maintenance of xlat structures
Dmitry V. Levin [Wed, 5 Feb 2014 01:28:45 +0000 (01:28 +0000)]
Introduce XLAT macro to ease maintenance of xlat structures

* defs.h (XLAT): New macro.

Suggested-by: Mike Frysinger <vapier@gentoo.org>
10 years agoDecode ptp ioctls
Stefan Sørensen [Fri, 31 Jan 2014 11:01:01 +0000 (12:01 +0100)]
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.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
10 years agoDecode dynamic posix clocks
Stefan Sørensen [Mon, 3 Feb 2014 09:01:27 +0000 (10:01 +0100)]
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.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
10 years agoUpdate ADJ_* constants
Stefan Sørensen [Fri, 31 Jan 2014 11:01:02 +0000 (12:01 +0100)]
Update ADJ_* constants

* time.c (adjtimex_modes): Add ADJ_TAI, ADJ_SETOFFSET, ADJ_MICRO,
ADJ_NANO, ADJ_OFFSET_SS_READ.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
10 years agoAdd decoding of sockets descriptor 'paths' for network calls
Philippe Ombredanne [Sat, 1 Feb 2014 17:57:45 +0000 (09:57 -0800)]
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.

Signed-off-by: Philippe Ombredanne <pombredanne@nexb.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
10 years agotests: rename all tests so that their names end in .test suffix
Dmitry V. Levin [Sun, 2 Feb 2014 15:20:11 +0000 (15:20 +0000)]
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.

10 years agonet: add more sockopt options
Mike Frysinger [Thu, 30 Jan 2014 23:53:43 +0000 (18:53 -0500)]
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.

10 years agomips: fix sigaction reporting
Chris Dearman [Tue, 10 Dec 2013 03:58:42 +0000 (19:58 -0800)]
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.

Signed-off-by: Chris Dearman <chris.dearman@imgtec.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
10 years agoFactor out struct sigaction printing code
Dmitry V. Levin [Tue, 7 Jan 2014 22:41:30 +0000 (22:41 +0000)]
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.

10 years agotests: add a test for rt_sigaction output
Dmitry V. Levin [Tue, 7 Jan 2014 19:32:32 +0000 (19:32 +0000)]
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.

10 years agomem: add missed MAP_HUGETLB mmap flag
Kirill A. Shutemov [Thu, 2 Jan 2014 11:15:32 +0000 (13:15 +0200)]
mem: add missed MAP_HUGETLB mmap flag

* mem.c (mmap_flags): Add MAP_HUGETLB mmap flag.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
10 years agoDelete old PTRACE_{PEEK,POKE}USR logic
Mike Frysinger [Tue, 31 Dec 2013 07:43:17 +0000 (02:43 -0500)]
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.

10 years agoDecode the O_PATH flag
Mike Frysinger [Tue, 31 Dec 2013 06:13:27 +0000 (01:13 -0500)]
Decode the O_PATH flag

* file.c (open_mode_flags): Add O_PATH.

10 years agoRemove unused configure checks
Dmitry V. Levin [Wed, 13 Nov 2013 22:50:32 +0000 (22:50 +0000)]
Remove unused configure checks

* configure.ac (AC_CHECK_FUNCS): Remove _sys_siglist and sys_siglist.
(AC_CHECK_DECLS): Likewise.

10 years agoAssume that <sys/ptrace.h> provides a valid ptrace prototype
Dmitry V. Levin [Wed, 13 Nov 2013 18:09:04 +0000 (18:09 +0000)]
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.

10 years agoStop using _LFS64_LARGEFILE
Dmitry V. Levin [Tue, 12 Nov 2013 22:34:42 +0000 (22:34 +0000)]
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.

10 years agoDefine truncate64, ftruncate64, and getdents64 decoders unconditionally
Dmitry V. Levin [Tue, 12 Nov 2013 22:25:06 +0000 (22:25 +0000)]
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.

10 years agoDefine printflock64 only if it is referenced by other code
Dmitry V. Levin [Tue, 12 Nov 2013 21:49:03 +0000 (21:49 +0000)]
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.

10 years agoMake PTRACE_PEEKUSER/PTRACE_POKEUSER checks less glibc specific
Dmitry V. Levin [Tue, 12 Nov 2013 21:20:50 +0000 (21:20 +0000)]
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.

10 years agoRemove unneeded redefinitions of IPPROTO_* macros
Dmitry V. Levin [Tue, 12 Nov 2013 16:13:43 +0000 (16:13 +0000)]
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.

10 years agoRemove unused AC_OFF_T_IS_LONG_LONG configure check
Dmitry V. Levin [Tue, 12 Nov 2013 15:43:06 +0000 (15:43 +0000)]
Remove unused AC_OFF_T_IS_LONG_LONG configure check

* configure.ac: Remove AC_OFF_T_IS_LONG_LONG.
* m4/long_long.m4: Likewise.

10 years agoRemove unused code
Dmitry V. Levin [Tue, 12 Nov 2013 15:39:09 +0000 (15:39 +0000)]
Remove unused code

* configure.ac (AC_CHECK_TYPES): Remove struct opthdr and
struct t_opthdr.
* net.c (print_sock_optmgmt): Remove.