Compare commits

...

884 Commits
v4.7 ... v4.10

Author SHA1 Message Date
dfabccf997 Prepare for 4.10 release
* NEWS: Update for 4.10 release.
* debian/changelog: 4.10-1.
* strace.spec: 4.10-1.
2015-03-06 13:14:15 +00:00
74219ea36f Move sigreturn/rt_sigreturn parser to a separate file
* sigreturn.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (sprintsigmask_n): New prototype.
(tprintsigmask_addr): New macro.
* signal.c (sprintsigmask_n): Make global.
(tprintsigmask_addr): Remove.
(sys_sigreturn): Move to sigreturn.c.
2015-03-06 02:19:01 +00:00
48f0890953 ia64: use PTRACE_GETREGS to fetch registers
* linux/ia64/arch_regs.h: Stop including <asm/rse.h>.
(ia64_frame_ptr): New declaration.
* signal.c (sys_sigreturn) [IA64]: Use ia64_frame_ptr.
* syscall.c [IA64]: Include <asm/rse.h>.
[IA64] (ia64_regs, ia64_frame_ptr): New variable.
[IA64] (ARCH_REGS_FOR_GETREGS): New macro.
[IA64] (ia64_ia32mode): Convert to macro.
[IA64] (ia64_r8, ia64_r10): Remove.
(getrval2, print_pc, get_scno, get_syscall_args, get_error) [IA64]:
Use ia64_regs.
(get_syscall_result) [IA64]: Remove.
2015-03-05 23:37:27 +00:00
20eca8a1c5 s390, s390x: use PTRACE_GETREGSET to fetch registers
* linux/s390/arch_regs.h: New file.
* linux/s390x/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add them.
* signal.c (sys_sigreturn) [S390 || S390X]: Use s390_frame_ptr.
* syscall.c [S390 || S390X] (s390_regset, s390_frame_ptr): New variable.
[S390 || S390X] (ARCH_REGS_FOR_GETREGSET): New macro.
(print_pc) [S390 || S390X]: Use s390_regset.
(get_scno) [S390 || S390X]: Likewise.
(get_syscall_args) [S390 || S390X]: Likewise.
(get_error) [S390 || S390X]: Likewise.
(get_syscall_result) [S390 || S390X]: Remove.
2015-03-05 22:10:15 +00:00
07d70f03ee qemu_multiarch_testing: update
* qemu_multiarch_testing/README: Update statistics.
2015-03-05 19:36:52 +00:00
da66e25779 tests: robustify unix-yy.test
Implement additional synchronization between parent and child processes
to guarantee that the child starts closing connected socket only after
exiting of the parent's accept() syscall.
This guarantee seems to be necessary to reliably receive UNIX_DIAG_PEER
messages from NETLINK_SOCK_DIAG interface.

* tests/net-accept-connect.c: Implement additional synchronization
between parent and child processes.
* tests/unix-yy-connect.awk: Update.
2015-03-05 17:44:32 +00:00
59f63d3106 Use SIGRTMIN from kernel headers
* configure.ac (ASM_SIGRTMIN): Define to SIGRTMIN from <asm/signal.h>.
* signal.c: Use ASM_SIGRTMIN instead of constants provided by libc.
* tests/sigreturn.c: Use ASM_SIGRTMIN instead of hardcoded value.
Use lower RT_* numbers to support pre-3.18 hppa kernels.
* tests/sigreturn.test: Update regexp.
2015-03-05 05:42:30 +00:00
67dab706cf ppc64: fix compilation warning
Fix compilation warning introduced by commit
577be2593d

* signal.c (sys_sigreturn) [POWERPC64]: Fix initialization of signal
mask on 32bit personality.
2015-03-05 04:29:37 +00:00
47e289bb9c aarch64: fix compilation warnings
Fix compilation warnings introduced by commit
5b9b7e1d34:

signal.c:702:45: warning: signed and unsigned type in conditional expression [-Wsign-compare]
syscall.c:746:34: warning: initialization from incompatible pointer type [enabled by default]

* syscall.c [AARCH64] (aarch64_sp_ptr): Add explicit cast.
[AARCH64] (arm_sp_ptr): Change pointer type to unsigned.
* linux/aarch64/arch_regs.h (arm_sp_ptr): Update.

Reported-by: Mike Frysinger <vapier@gentoo.org>
2015-03-05 04:10:52 +00:00
a1c5e0721f i386: simplify sigreturn decoding
* signal.c (sys_sigreturn) [X86_64 || X32 || I386]: Do not define
i386_sigcontext_struct and i386_fpstate structures.
2015-03-05 01:16:52 +00:00
30bcb792cf tests: add a test for sigreturn/rt_sigreturn decoding
Convert test/sigreturn.c into a regular test.

* test/Makefile (PROGS): Remove sigreturn.
* test/.gitignore: Likewise.
* test/sigreturn.c: Rewrite to ...
* tests/sigreturn.c: ... new file.
* tests/sigreturn.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add sigreturn.
(TESTS): Add sigreturn.test.
* tests/.gitignore: Add sigreturn.
2015-03-05 00:05:27 +00:00
f3582cd204 sigreturn: print signal mask as a syscall argument
Although sigreturn takes signal mask via frame pointer,
it's more convenient to display signal mask as a syscall argument
rather than an outstanding object of unknown nature:

Before this change:
    sigreturn() (mask [USR2 CHLD RT_2 RT_3 RT_4 RT_31 RT_32]) = 0

After this change:
    sigreturn({mask=[USR2 CHLD RT_2 RT_3 RT_4 RT_31 RT_32]}) = 0

* signal.c (sys_sigreturn): Display signal mask as a syscall argument.
2015-03-04 23:55:25 +00:00
5b9b7e1d34 aarch64: implement rt_sigreturn decoding
* linux/64/syscallent.h (139): Use sys_sigreturn for rt_sigreturn
decoding.
* syscall.c [ARM] (arm_regs): Make static.
[ARM] (arm_sp_ptr): New variable.
[AARCH64] (aarch64_sp_ptr, arm_sp_ptr): New variables.
* linux/aarch64/arch_regs.h: New file.
* linux/arm/arch_regs.h (arm_regs): Remove.
(arm_sp_ptr): New declaration.
* signal.c (sys_sigreturn) [ARM]: Use arm_sp_ptr.
[AARCH64]: Print signal mask.
2015-03-04 23:05:53 +00:00
26d16c8ade arm: simplify sigreturn decoding
* signal.c (sys_sigreturn) [ARM]: Do not define sigcontext and ucontext
structures, fetch signal mask only, use print_sigset_addr_len.
2015-03-04 22:27:35 +00:00
085411b806 s390: fix sigreturn decoding
* signal.c (sys_sigreturn) [S390]: Fix signal mask decoding.
2015-03-04 21:48:44 +00:00
fd6d2072b1 mips o32: fix sigreturn decoding
* signal.c (sys_sigreturn) [LINUX_MIPSO32]: Fix the address of signal mask.
[MIPS] Use print_sigset_addr_len to print signal mask.
2015-03-04 21:48:44 +00:00
ccb4fdac43 x86_64, x32: implement rt_sigreturn decoding
* syscall.c [X86_64 || X32] (x86_64_rsp_ptr): New variable.
* linux/x86_64/arch_regs.h (x86_64_rsp_ptr): New declaration.
* linux/x86_64/syscallent.h (15): Use sys_sigreturn for rt_sigreturn
decoding.
* linux/x32/syscallent.h (513): Likewise.
* signal.c (sys_sigreturn) [X86_64 || X32]: Print signal mask
for non-i386 personalities.
2015-03-04 17:54:25 +00:00
db19936861 sparc, sparc64: fix sigreturn decoding
* linux/sparc/arch_regs.h (U_REG_FP): New macro.
* signal.c (sys_sigreturn) [SPARC || SPARC64]: Fix decoding
of upper 32 bits of the sigmask.
2015-03-04 17:54:25 +00:00
577be2593d ppc, ppc64: fix sigreturn decoding
* signal.c (sys_sigreturn) [POWERPC]: Fix decoding of upper 32 bits
of the sigmask.
2015-03-04 16:06:05 +00:00
d46899286e sigreturn: issue a less innocuous warning
* signal.c (sys_sigreturn): Issue a less innocuous warning on
architectures for which signal mask decoding is not implemented yet.
2015-03-04 14:52:56 +00:00
dca5110aaa bootstrap: do not link Makefile* files
* bootstrap: Do not symlink any Makefile* files, not just Makefile.am
and Makefile.in.

Reported-by: Christopher Covington <cov@codeaurora.org>
2015-03-04 14:52:56 +00:00
1e8a454474 ia64: fix sigreturn decoding
* signal.c (sys_sigreturn) [IA64]: Fix the address of signal mask.
Use print_sigset_addr_len to print signal mask.
2015-03-04 12:11:31 +00:00
7abfd29834 ia64: use generic signalent
This complements commit v4.9-321-gfcf7f8d.

* linux/ia64/signalent.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
2015-03-04 12:06:26 +00:00
6a63bfa160 Document that -k is available only with libunwind
Without this users might get confused why `man strace` describes
an option that doesn't work.

* strace.1: Note that -k is available only if strace is built
with libunwind.
2015-03-04 00:56:33 +00:00
fde8fac036 debian: update control file
* debian/control (strace, strace-udeb): Add mips64 and mips64el
to architecture list.
Patch by James Cowgill <james410@cowgill.org.uk>

This fixes Debian bug #773375.
2015-03-03 23:12:22 +00:00
f3f136cd4b debian: sync with 4.9-2 package
* debian/changelog: Sync with 4.9-2.
* debian/control: Likewise.
2015-03-03 23:12:22 +00:00
7e6556711e Add arch-specific PTRACE_* constants
* xlat/ptrace_cmds.in: Add arch-specific ptrace commands.
* xlat/ptrace_events.in: Add PTRACE_EVENT_MIGRATE for tile.
* xlat/ptrace_setoptions_flags.in: Add PTRACE_O_TRACEMIGRATE for tile.

This fixes Debian bug #734554.
2015-03-03 23:12:22 +00:00
600eafb6ed Clarify bootstrap-vs-autoreconf usage
* README-hacking: Tell people to run ./bootstrap.
2015-03-03 01:45:30 +00:00
5a64656da6 mips n32: fix preadv/pwritev offset decoding
In mips n32 abi, like in most of 32-bit architectures, offset
is passed to preadv/pwritev syscalls using two syscall arguments.

* io.c (print_llu_from_low_high_val) [LINUX_MIPSN32]: Remove.
2015-03-03 01:36:29 +00:00
d79ed12376 tests: skip ipc_sem.test on broken kernels
Rather than trigger an ERROR which fails `make check`, go with SKIP
instead.  We don't want the testsuite failing due to kernel bugs.

* tests/ipc_sem.c (main): Change 99 to 77.
2015-03-03 01:13:23 +00:00
eb202baf41 tests: skip pc.test on s390
The s390 hardware can't support an exact si_addr, and the current kernels
don't handle text addresses correctly at all.  Until that improves, skip
the test on s390.

* tests/pc.c (main): Return 77 on s390 systems.
2015-03-03 01:13:10 +00:00
90c80c46b8 tests: note the kernel configs for -yy options
* tests/net-yy.test: Note CONFIG_INET_TCP_DIAG.
* tests/unix-yy.test: Note CONFIG_UNIX_DIAG.
2015-03-03 01:12:18 +00:00
301c65cbf0 alpha: fix -yy decoding
* socketutils.c (receive_responses): Align buffer on a sizeof(long) boundary.

Reported-and-tested-by: Mike Frysinger <vapier@gentoo.org>
2015-03-02 23:39:41 +00:00
d50949d21c aarch64, x32: fix decoding of compat personality statfs64/fstatfs64
* statfs.c (struct compat_statfs64) [AARCH64 || X32]: Apply the same
attributes as on X86_64.
2015-03-02 21:34:02 +00:00
f677715a9b mips: fix compilation warning
* syscall.c (get_scno) [MIPS]: Fix harmless compilation warning
about comparison between signed and unsigned integer expressions.
2015-03-02 15:06:51 +00:00
822892ba45 x32: fix compilation warnings
* sysinfo.c (sys_sysinfo): Use ll length format modifier
instead of l and cast kernel ulong types to unsigned long long.
2015-03-02 14:59:20 +00:00
d819fe88fb aarch64: add -i option support
* syscall.c (print_pc): Add aarch64 support.
2015-03-02 03:42:21 +00:00
4341373f2c ioctl: use x32 specific ioctl entries on x32 personality
As ioctls_inc.h generated natively on x32 differs both from 32/ioctls_inc.h
(by 45 entries) and from linux/64/ioctls_inc.h (by 322 entries), use x32
specific ioctl entries on x32 personality.

* linux/x32/ioctls_inc0.h: Generate from linux v3.19 using ioctls_gen.sh.
* linux/x86_64/ioctlent2.h: Remove.
* linux/x86_64/ioctls_arch2.h: New file.
* linux/x86_64/ioctls_inc2.h: New file.
* Makefile.am (EXTRA_DIST): Remove linux/x86_64/ioctlent2.h, add
linux/x86_64/ioctls_arch2.h and linux/x86_64/ioctls_inc2.h.
2015-03-02 02:55:14 +00:00
77e0d2dccc tests/uid16: skip if real uid is larger than 16bit
* tests/uid16.c (main): Skip if the uid returned by getuid matches
/proc/sys/kernel/overflowuid.
2015-03-02 02:26:02 +00:00
3a15bc8adf tests: fix uid tests on big endian architectures
* tests/uid.c (main): Ignore uids returned by getresuid to avoid
16bit vs 32bit issues on big endian architectures.
Change real UID instead of effective UID in setresuid test.
* tests/uid16.c (main): Likewise.
* tests/uid32.c (main): Change real UID instead of effective UID
in setresuid test to match uid.c
* tests/uid.awk: Update setresuid regexp.

Reported-by: Mike Frysinger <vapier@gentoo.org>
2015-03-02 02:23:55 +00:00
a8dcf253fa tests/getdents: handle older getdents calls
If the tools we use call older getdents syscalls where d_type isn't
passed back, or the arch is old (like Alpha) and can't pass back in
either version, make sure we don't fail.

* tests/getdents.awk (d_type_dir, d_type_reg): Accept DT_UNKNOWN.
2015-03-01 21:42:08 +00:00
d93d9f8d7f Fix multiple personalities support in decoding syscall return values
* syscall.c (trace_syscall_exiting): When current personality is 32bit,
print 32bit return code.
2015-02-28 23:58:08 +00:00
a4c9512294 Update generic 64-bit ioctlent from linux v3.19
* linux/64/ioctls_inc.h: Update from linux v3.19 using ioctls_gen.sh.
2015-02-28 18:52:02 +00:00
24b8eb0dee sparc, sparc64: fix rt_sigaction decoding
Fix regression introduced by commit v4.9-9-gc3a5c01.

* signal.c (HAVE_SA_RESTORER): New macro.
[HPPA || IA64]: Do not undefine SA_RESTORER.
(old_sigaction, old_sigaction32, new_sigaction): Use HAVE_SA_RESTORER
instead of SA_RESTORER to check whether to define sa_restorer.
(decode_old_sigaction, decode_new_sigaction): Use HAVE_SA_RESTORER in
addition to SA_RESTORER to check whether to use sa_restorer.
2015-02-28 17:55:25 +00:00
1dbd39e85f Fix stack buffer overflow when specified command is too long
* strace.c (startup_child): Check that the length of the command strace
is going to execute does not exceed PATH_MAX limit.

Reported-by: Cheolung Lee <chpie@grayhash.com>
2015-02-28 14:50:09 +00:00
7211dbcb2f build: include ptrace.h after regs.h
Restore the order of including <sys/reg.h> and <linux/ptrace.h>
headers that was inadvertently changed by commit v4.9-280-g5503dd2.

This should fix build on platforms like m68k where some constants
are defined simultaneously as enums by <sys/reg.h> and as macros
by <asm/ptrace.h>.

* process.c: Include "ptrace.h" after "regs.h".
* signal.c: Likewise.
* syscall.c: Likewise.
* util.c: Likewise.
2015-02-28 12:20:21 +00:00
e61086ff77 x32: fix decoding of timeval, timespec, and timex structures
As time_t is a 64-bit type in x32 personality, it is not correct to
treat it as a long int type.

* time.c (current_time_t_is_compat): New macro.
(sprinttv, sprint_timespec, printitv_bitness, tprint_timex): Use it.
(tprint_timeval, do_sprinttv, sprint_timespec): Use j and uintmax_t
when printing tv_sec/tv_usec.
(tprint_timex): Use j and intmax_t/uintmax_t when printing struct timex
members of type kernel_long_t.
2015-02-28 12:10:39 +00:00
4ed340bae6 tests/ipc_sem: detect broken kernels
When running 32bit ipc tests on ppc/sparc with a 64bit kernel, the ipc
logic wrongly returns errors.  Detect that and throw an error.

* tests/ipc_sem.c: Return 99 when errno is EFAULT.
* tests/ipc_sem.test: Save output to $OUT and show it when failing.
Handle exit status 99 to throw an ERROR.
2015-02-28 12:10:39 +00:00
856b7596b8 build: do not link strace with -ldl
* configure.ac: Fix dladdr check.
2015-02-27 05:01:25 +00:00
d32e1b9dde Handle broken PTRACE_EVENT_STOP values
For a few linux releases (3.1 through 3.3), this define in the exported
headers were broken.  Redefine if that's the case.

* ptrace.h [PTRACE_EVENT_STOP]: Redefine if PTRACE_EVENT_STOP is 7.
2015-02-27 04:43:11 +00:00
11cb0da472 bootstrap: always set up test dirs
When files get updated, the bootstrap script should make sure the
parallel dirs are kept in sync.

* bootstrap: Always generate the test$m.  Clean up symlinks first.
Don't link in Makefile.in files.
2015-02-27 04:43:11 +00:00
58c7fe9903 Fix cross-compiling of ioctlsort
Use the AX_PROG_CC_FOR_BUILD helper to set up build settings when cross
compiling.  This way ioctlsort uses the build tools all the time.

* configure.ac: Call AX_PROG_CC_FOR_BUILD.
* Makefile.am (ioctlsort_CC): Set to CC_FOR_BUILD.
(ioctlsort_CPPFLAGS): Change CPPFLAGS to CPPFLAGS_FOR_BUILD.
(ioctlsort_CFLAGS): Change CFLAGS to CFLAGS_FOR_BUILD.
(ioctlsort_LDFLAGS): Change LDFLAGS to LDFLAGS_FOR_BUILD.
(ioctlsort_LD): Delete.
(ioctlsort%): Change to ioctlsort%$(BUILD_EXEEXT).  Use ioctlsort_CFLAGS.
* m4/ax_prog_cc_for_build.m4: Import from the autoconf-archive package.
2015-02-27 04:43:06 +00:00
977550de79 tests: robustify pc.test
* configure.ac: Check for dladdr in -ldl.
* tests/Makefile.am (pc_LDADD): Adde $(dl_LIBS).
* tests/pc.c: Include "config.h" and <dlfcn.h>.
(main): Use dladdr to find the address to unmap.
2015-02-27 04:09:56 +00:00
599819dfd5 tests: drop support for alternative names of select syscall
This mostly reverts commit 4a00fc4867.

* tests/select.awk: Drop _newselect support.
* tests/select.test: Skip if select syscall is not supported.
2015-02-27 01:47:12 +00:00
ddcf54969d Rename _newselect to select
As an exception to the general rules that syscall names should match
__NR_* constants defined in kernel headers, show select as "select"
and old select as "oldselect".

* linux/arm/syscallent.h (82): Change name to oldselect.
* linux/hppa/syscallent.h (142): Change name to select.
* linux/mips/syscallent-n32.h (6022): Likewise.
* linux/mips/syscallent-n64.h (5022): Likewise.
* linux/mips/syscallent-o32.h (4142): Likewise.
* linux/sparc/syscallent.h (230): Likewise.
2015-02-27 01:25:24 +00:00
f4d6b37dfd sparc: sync syscall entries with kernel headers
* linux/sparc/syscallent.h: Fix syscall entries for vmsplice,
inotify_init, inotify_add_watch, inotify_rm_watch, inotify_rm_watch,
ioprio_set, ioprio_get, splice, sync_file_range, sched_getaffinity, and
sched_setaffinity.
(67, 68, 202, 230): Change syscall names to match __NR_* constants
defined in arch/sparc/include/uapi/asm/unistd.h.
2015-02-27 00:28:12 +00:00
6d9fa80918 s390, s390x: sync syscall entry names with kernel headers
* linux/s390/syscallent.h (1, 180, 181): Change syscall names to match
__NR_* constants defined in arch/s390/include/uapi/asm/unistd.h.
* linux/s390x/syscallent.h: Likewise.
2015-02-26 23:36:26 +00:00
48ceaee384 xlat: avoid fork bombing the build system
When there were fewer xlat headers, this didn't matter as much.
But now with >200, trying to run them all in parallel can easily
fork bomb smaller systems.

* xlat/gen.sh (main): Do not more jobs than # of cpus.
2015-02-26 23:14:04 +00:00
adee242dec arm: sync syscall entry names with kernel
* linux/arm/syscallent.h (82, 90, 180, 181, 327):
Change syscall names to match __NR_* constants defined
in arch/arm/include/uapi/asm/unistd.h.
2015-02-26 23:04:04 +00:00
ff865c67a6 arm: fix get_mempolicy, set_mempolicy, and timerfd_create syscall entries
* linux/arm/syscallent.h (320, 321, 350): Fix names and handlers.
2015-02-26 23:03:10 +00:00
566eb6c847 hppa: sync syscall entry names with kernel
* linux/hppa/syscallent.h (18, 28, 59, 84, 108, 109, 280):
Change syscall names to match __NR_* constants defined in
arch/parisc/include/uapi/asm/unistd.h.
2015-02-26 22:44:17 +00:00
4cd64fe29e subcall.h: add sendmmsg entry
* linux/subcall.h: Add sys_sendmmsg entry.
(SYS_socket_nsubcalls): Update.
2015-02-26 22:07:14 +00:00
d77f742fe6 arm: simplify ARM_FIRST_SHUFFLED_SYSCALL definition
* linux/arm/syscallent.h (ARM_FIRST_SHUFFLED_SYSCALL): Use SYS_ipc_subcall.
2015-02-26 22:05:45 +00:00
f8d75c5267 ia64: parametrize i386 syscallent size check
* linux/ia64/syscallent.h: Use (SYS_ipc_subcall + SYS_ipc_nsubcalls)
instead of numeric constant.
2015-02-26 22:03:19 +00:00
407f630374 Cleanup linux/subcall.h
* linux/subcall.h: Use SYS_ipc_subcall.
2015-02-26 21:45:47 +00:00
642447ef6e alpha: fix statfs decoding
* statfs.c (printstatfs) [ALPHA]: Remove faulty code.
2015-02-26 21:09:48 +00:00
19fcb27764 x32: fix build regression
* linux/x32/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
2015-02-26 20:40:43 +00:00
28e3d6fd1c hppa: fix fanotify_mark decoding
The parisc kernel has some legacy baggage here and decodes the 64bit
field in the reverse order.  Handle it in strace too.

* fanotify.c [HPPA] (sys_fanotify_mark): Reverse the mask bits.
2015-02-26 20:02:03 +00:00
761e31a8b4 ia64: fix decoding of getresuid/getresgid/setresgid
Looks like the similarity of these names caused confusion when generating
the syscall table.  getresgid was wired to the wrong output while the other
two were wired up to printargs instead of the real printer.

* linux/ia64/syscallent.h: Connect getresuid to sys_getresuid, getresgid to
sys_getresgid, and setresgid to sys_setresgid.
2015-02-26 20:02:03 +00:00
cc07f669f3 ia64: fix up builds after 16bit uid support
The ia64 port pulls in the i386 syscall table so it can decode
32bit apps, so we need to enable the 16bit uid parsers for it.

* defs.h (NEED_UID16_PARSERS): Define to 1 for IA64.
* linux/ia64/syscallent.h: Undefine sys_stime to avoid redefine warnings.
2015-02-26 20:01:35 +00:00
bfe6d04d9c v4l2: use uintmax_t for times
There is no guarantee that the backing value for the various time fields
are ints or longs which makes printfs annoying.  Lets cast them to the
uintmax_t type so we can use the j flag and not worry about truncation.

* v4l2.c (v4l2_ioctl): Use j and uintmax_t when printing tv_sec/tv_usec.
2015-02-26 20:00:03 +00:00
bf8dfe8aaf ignore core/compile files
Newer autotools includes a compile helper script.

* .gitignore: Add /compile and core.
2015-02-26 20:00:03 +00:00
a671a2c7b4 NEWS: Prepare for 4.10 release 2015-02-24 03:36:38 +00:00
23ce9e48b5 Remove support for systems without PTRACE_SETOPTIONS
Assume that the kernel is v2.5.46 or newer, i.e. PTRACE_SETOPTIONS
and PTRACE_O_TRACESYSGOOD|PTRACE_O_TRACEEXEC|PTRACE_O_TRACECLONE
are universally available.

This change removes all code that implemented post-execve SIGTRAP
handling and fork/vfork/clone->CLONE_PTRACE substitution.

* defs.h (TCB_BPTSET, TCB_WAITEXECVE): Remove macros.
(need_fork_exec_workarounds, setbpt, clearbpt): Remove declarations.
* strace.c (need_fork_exec_workarounds,
test_ptrace_setoptions_followfork, test_ptrace_setoptions_for_all):
Remove.
(syscall_trap_sig): Set to (SIGTRAP | 0x80).
(ptrace_setoptions): Set to (PTRACE_O_TRACESYSGOOD | PTRACE_O_TRACEEXEC).
(detach): Do not test for TCB_BPTSET.
(init): Do not call test_ptrace_setoptions_followfork and
test_ptrace_setoptions_for_all.  Do not test for TCB_BPTSET.
* syscall.c (syscall_fixup_on_sysenter, internal_fork, internal_exec,
syscall_fixup_for_fork_exec, syscall_fixup_on_sysexit): Remove.
(trace_syscall_entering): Do not test for TCB_WAITEXECVE.  Do not call
syscall_fixup_on_sysenter and syscall_fixup_for_fork_exec.
(trace_syscall_exiting): Do not call syscall_fixup_on_sysexit and
syscall_fixup_for_fork_exec.
[IA64] (ia64_ia32mode): Make static.
* linux/ia64/arch_regs.h (ia64_ia32mode): Remove declaration.
* util.c: Do not include "syscall.h".
(arg_setup, get_arg0, get_arg1, set_arg0, set_arg1, restore_arg0,
restore_arg1, arg_finish_change, change_syscall, setbpt, clearbpt):
Remove.
* tests/ptrace_setoptions.test: Remove.
* tests/Makefile.am (TESTS): Remove it.
2015-02-24 03:36:38 +00:00
1c5feadf75 tests: robustify pc.test
* tests/pc.c (main): Unmap larger memory region.
Dump process map for debug purposes.
* tests/pc.test: Update regexps to take CLD_DUMPED child process
into account.
2015-02-24 03:36:36 +00:00
e3e64a144b tests: fix "make dist" regression
* tests/Makefile.am (EXTRA_DIST): Add getrandom.awk.
2015-02-23 22:26:06 +00:00
7e79a8b485 tests: workaround broken awk
* tests/getdents.out: New file.
* tests/Makefile.am (EXTRA_DIST): Add it.
* tests/getdents.test: Check whether awk is capable of matching long
regular expressions.
2015-02-23 22:26:06 +00:00
d67ba3e434 Fix compilation warnings about incompatible print formats
On some platforms printing of __s64 types with "%lld" format,
or __u64 types with "%llu" or "%llx" formats causes a warning
that __s64/__u64 type is not compatible with long long format.
From my PoV, this is nonsense, but the workaround costs nothing.

* scsi.c (print_sg_io_v4_req, print_sg_io_v4_res): Cast __u64 types
to (unsigned long long).
* v4l2.c (v4l2_ioctl): Likewise.  Cast __s64 type to (long long).
2015-02-23 22:19:19 +00:00
7226c3a73d powerpc64: fix build regression
* linux/powerpc64/arch_regs.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
2015-02-23 21:54:07 +00:00
fcf7f8d51e signalent: update from linux v3.19
* linux/alpha/signalent.h: Update from linux v3.19 signalent.sh.
* linux/hppa/signalent.h: Likewise.
* linux/mips/signalent.h: Likewise.
* linux/sparc/signalent.h: Likewise.
2015-02-23 20:55:11 +00:00
6826f98bc4 Cleanup auxiliary signalent files
* linux/aarch64/signalent1.h: Include "signalent.h".
* linux/powerpc64/signalent1.h: Likewise.
* linux/sparc64/signalent2.h: Likewise.
* linux/tile/signalent1.h: Likewise.
* linux/x32/signalent1.h: Likewise.
* linux/x86_64/signalent1.h: Likewise.
* linux/x86_64/signalent2.h: Likewise.
* linux/sparc64/signalent.h: Include "sparc/signalent.h".
* linux/sparc64/signalent1.h: Include "sparc/signalent1.h".
* linux/x32/signalent.h: Remove.
* Makefile.am (EXTRA_DIST): Remove linux/x32/signalent.h.
2015-02-23 20:55:11 +00:00
5dd336bb4e x86_64, x32: fix sys_sigreturn
On x86_64/x32, sys_sigreturn is defined only for i386 personality.

* signal.c (sys_sigreturn): Define for X32.
(sys_sigreturn) [X86_64 || X32]: Implement for i386 personality only.
2015-02-23 16:21:55 +00:00
b2d9ff29d0 sparc, x32: fix build regression
* syscall.c (print_pc): Use current_wordsize iff it is defined.
2015-02-23 13:43:20 +00:00
b2f8c77d66 Change errnoent.h files to use designated initializers
* signal.c (printsiginfo): Allow elements of errnoent array to be zero.
* syscall.c (trace_syscall_exiting): Likewise.
* errnoent.sh: Output designated initializers.
* linux/errnoent.h: Regenerated.
* linux/alpha/errnoent.h: Regenerated.
* linux/hppa/errnoent.h: Regenerated.
* linux/mips/errnoent.h: Regenerated.
* linux/sparc/errnoent.h: Regenerated.
* linux/sparc/errnoent1.h: Regenerated.
* linux/powerpc/errnoent.h: New file.
* linux/powerpc64/errnoent.h: Include "powerpc/errnoent.h".
* Makefile.am (EXTRA_DIST): Add linux/powerpc/errnoent.h
and linux/powerpc64/errnoent.h.
2015-02-23 13:29:17 +00:00
313363fb7f errnoent: update from linux v3.19
* linux/errnoent.h: Update from linux v3.19 using errnoent.sh.
* linux/alpha/errnoent.h: Likewise.
* linux/hppa/errnoent.h: Likewise.
* linux/mips/errnoent.h: Likewise.
* linux/sparc/errnoent.h: Likewise.
2015-02-23 03:57:11 +00:00
789bc3ad99 Cleanup auxiliary errnoent files
* linux/aarch64/errnoent1.h: Include "errnoent.h".
* linux/powerpc64/errnoent1.h: Likewise.
* linux/sparc64/errnoent2.h: Likewise.
* linux/tile/errnoent1.h: Likewise.
* linux/x32/errnoent1.h: Likewise.
* linux/x86_64/errnoent1.h: Likewise.
* linux/x86_64/errnoent2.h: Likewise.
* linux/sparc64/errnoent.h: Include "sparc/errnoent.h".
* linux/sparc64/errnoent1.h: Include "sparc/errnoent1.h".
* linux/x32/errnoent.h: Remove.
* Makefile.am (EXTRA_DIST): Remove linux/x32/errnoent.h.
2015-02-23 03:56:06 +00:00
5b0819eab7 evdev: update constants from linux v3.19
* xlat/evdev_keycode.in: Update from linux v3.19.
* xlat/evdev_prop.in: Likewise.
2015-02-22 02:29:55 +00:00
7d8b41a4f7 evdev: decode keycode value in EVIOC[GS]KEYCODE_V2 commands
* evdev.c (keycode_V2_ioctl): Use evdev_keycode to print
input_keymap_entry.keycode.
2015-02-22 02:29:55 +00:00
19dadf9401 evdev: fix build with old kernel headers
* configure.ac: Check whether struct input_absinfo.resolution is defined
in <linux/input.h>.
* evdev.c (SYN_MAX): Add fallback definition.
(abs_ioctl): Wrap use of struct input_absinfo.resolution in #ifdef check.
(keycode_V2_ioctl, mtslots_ioctl, repeat_ioctl): Wrap in #ifdef checks.
(evdev_read_ioctl): Wrap in #ifdef checks the code that uses EV_SW,
EVIOCGREP, EVIOCGKEYCODE_V2, EVIOCGMTSLOTS, EVIOCGPROP, and EVIOCGSW.
(evdev_write_ioctl): Wrap in #ifdef checks the code that uses EVIOCSREP,
EVIOCSKEYCODE_V2, EVIOCSCLOCKID, and EVIOCREVOKE.
2015-02-22 02:29:55 +00:00
4f750b9ad1 Add decoding for evdev ioctls
This patch introduces decoding for evdev ioctls.  For EVIOCSFF the five
first members are decoded, the union is not.  The code was compiled and
tested on x86_64 with Linux 3.13.

* evdev.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (evdev_ioctl): New prototype.
* ioctl.c (ioctl_decode): Call evdev_ioctl for 'E' ioctl commands.
* xlat/evdev_autorepeat.in: New file.
* xlat/evdev_ff_status.in: New file.
* xlat/evdev_ff_types.in: New file.
* xlat/evdev_keycode.in: New file.
* xlat/evdev_leds.in: New file.
* xlat/evdev_misc.in: New file.
* xlat/evdev_mtslots.in: New file.
* xlat/evdev_prop.in: New file.
* xlat/evdev_relative_axes.in: New file.
* xlat/evdev_snd.in: New file.
* xlat/evdev_switch.in: New file.
* xlat/evdev_sync.in: New file.

Signed-off-by: Etienne Gemsa <etienne.gemsa@lse.epita.fr>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2015-02-22 02:29:54 +00:00
0f4ad30bdc Fix build with old kernel headers
* strace.c (print_debug_info, maybe_allocate_tcb, print_signalled,
print_exited): Remove "const" qualifier from status variable to
workaround some old implementations of WIFSIGNALED/WIFSTOPPED/WIFEXITED
macros.
* v4l2.c: Include <linux/types.h>.
(v4l2_ioctl): Check that V4L2_CTRL_FLAG_NEXT_CTRL and VIDIOC_S_EXT_CTRLS
macros are defined.
* tests/Makefile.am (AM_CPPFLAGS): Define.
2015-02-22 02:29:54 +00:00
87c715b32c Fix "make dist" regression
* Makefile.am (EXTRA_DIST): Remove README-linux.
2015-02-22 01:33:08 +00:00
5061ef20ef test/sfd.c: add missing includes 2015-02-20 13:21:40 +00:00
34bbcc6270 Remove linux/fanotify.h
* linux/fanotify.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* fanotify.c: Do not include <linux/fanotify.h>.
* xlat/fan_classes.in: Add default values.
* xlat/fan_event_flags.in: Likewise.
* xlat/fan_init_flags.in: Likewise.
* xlat/fan_mark_flags.in: Likewise.
2015-02-19 21:55:09 +00:00
2094573930 Remove linux/keyctl.h
* linux/keyctl.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* keyctl.c: Do not include <linux/keyctl.h>.
* xlat/key_perms.in: Add default values.
* xlat/key_reqkeys.in: Likewise.
* xlat/key_spec.in: Likewise.
* xlat/keyctl_commands.in: Likewise.
2015-02-19 21:42:31 +00:00
ff6a55dee9 Remove linux/kexec.h
* linux/kexec.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* kexec.c: Do not include <linux/kexec.h>.
* xlat/kexec_arch_values.in: Add default values.
* xlat/kexec_flags.in: Rename to kexec_load_flags.in, add default
values.
2015-02-19 21:29:01 +00:00
3a232997d8 Remove linux/inotify.h
* linux/inotify.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* inotify.c: Do not include <linux/inotify.h>.
* xlat/inotify_flags.in: Add default values.
2015-02-19 21:28:59 +00:00
3e6525ff4b Remove linux/reboot.h
* linux/reboot.h: Remove.
* Makefile.am (EXTRA_DIST): Remove it.
* reboot.c: Do not include <linux/reboot.h>.
* xlat/bootflags1.in: Add default values.
* xlat/bootflags2.in: Likewise.
* xlat/bootflags3.in: Likewise.
2015-02-19 20:47:36 +00:00
0a59454fb3 seccomp: fix fallback definitions of some SECCOMP_* constants
* seccomp.c (SECCOMP_SET_MODE_STRICT, SECCOMP_SET_MODE_FILTER,
SECCOMP_FILTER_FLAG_TSYNC): Remove fallback definitions.
* xlat/seccomp_filter_flags.in: Add default value.
* xlat/seccomp_ops.in: Add default values.
2015-02-19 20:30:01 +00:00
fb585db562 is_negated_errno: sync MAX_ERRNO with the kernel
Linux kernel used to guarantee that the largest errno value will not
exceed 4095, but SECCOMP_RET_ERRNO support introduced by kernel commit
v3.4-rc2-13-gacf3b2c71ed20c53dc69826683417703c2a88059 inadvertently
broke it.  The guarantee is back with kernel commit
v3.19-8275-g580c57f1076872ebc2427f898b927944ce170f2d.

* syscall.c (is_negated_errno): Set maximum errno value to 4095.
2015-02-19 16:58:52 +00:00
08aa56c780 README-linux: punt
Considering we're requiring linux-2.6 era kernels, the discussion of
header troubles that plagued 2.2 and 2.4 are no longer relevant.

* README-linux: Delete.
2015-02-19 10:11:47 +00:00
1e88073053 Improve prctl decoding
* configure.ac (AC_CHECK_HEADERS): Add linux/securebits.h.
* prctl.c (sys_prctl): Implement full decoding of all PR_* constants
as defined in linux v3.19.
(sys_arch_prctl): Fix decoding of unknown commands.
* xlat/cap.in: New file.
* xlat/pr_mce_kill.in: New file.
* xlat/pr_mce_kill_policy.in: New file.
* xlat/pr_set_mm.in: New file.
* xlat/pr_tsc.in: New file.
* xlat/pr_unalign_flags.in: New file.
* xlat/secbits.in: New file.
* xlat/prctl_options.in: Remove non-linux constants, add fallback
definitions.
* xlat/seccomp_mode.in: Add fallback definitions.
2015-02-19 01:54:38 +00:00
cff9f8aa94 xlat: extend syntax
* xlat/gen.sh (gen_header): If the name of constant is specified with a
value, generate a default definition for the constant using this value.
* xlat/timerfdflags.in: Use extended syntax.
2015-02-19 01:54:14 +00:00
2f0808b88e Move CAP_* definitions out to header files
* Makefile.am (strace_SOURCES): Add caps0.h and caps1.h.
* caps0.h: New file.
* caps1.h: New file.
* capability.c: Remove CAP_* definitions, include "caps0.h"
and "caps1.h" instead.
Include "xlat/cap_mask0.h" instead of "xlat/capabilities.h".
Include "xlat/cap_mask1.h" instead of "xlat/capabilities1.h".
(print_cap_bits): Update callers.
* xlat/capabilities.in: Rename to xlat/cap_mask0.in.
* xlat/capabilities1.in: Rename to xlat/cap_mask1.in.
2015-02-19 00:33:39 +00:00
f523f103cc Declare all format printers with printf format attribute
* defs.h (printllval, printnum_int, printnum_long): Mark with
format(printf) attribute.
* sock.c (sock_ioctl): Fix format string.
2015-02-18 02:44:43 +00:00
1c603a9e07 Rename printnum to printnum_long to avoid confusion
* defs.h (printnum): Rename to printnum_long.
* util.c (printnum): Likewise.
* process.c (sys_ptrace): Likewise.
* time.c (sys_time): Likewise.
2015-02-17 22:03:17 +00:00
f55cca729f Use printnum_int consistently
* sock.c (sock_ioctl): Use printnum_int instead of printnum to print
integer type.
* stream.c (sys_getpmsg): Likewise.
2015-02-17 22:00:45 +00:00
e96cb621fa print_pc: fix multiple personalities support
* syscall.c (print_pc): Choose instruction pointer format depending
on current_wordsize, not the size of long integer type.
* tests/pc.c: New file.
* tests/pc.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add pc.
(TESTS): Add pc.test.
* tests/.gitignore: Add pc.
2015-02-16 02:39:21 +00:00
4f2d1ae243 mips: use PTRACE_GETREGS to fetch all registers
* linux/mips/arch_regs.h (struct mips_regs): New structure.
(mips_REG_*): New macros.
* signal.c (sys_sigreturn) [MIPS]: Use mips_REG_SP.
* syscall.c [MIPS] (struct mips_regs): New variable.
[MIPS] (ARCH_REGS_FOR_GETREGS): New macro.
(mips_a3, mips_r2): Remove.
(print_pc) [MIPS]: Use mips_REG_EPC.
(get_scno) [MIPS]: Use mips_REG_V0 and mips_REG_A3.
(get_syscall_args) [MIPS]: Use mips_REG_A[0-5].
(get_syscall_result) [MIPS]: Remove.
(get_error) [MIPS]: Use mips_REG_A3 and mips_REG_V0.
2015-02-16 02:39:13 +00:00
047365efde mips: move ABI check to configure.ac
* configure.ac [MIPS]: Check for MIPS ABI.
* defs.h [MIPS]: Remove MIPS ABI check.
* ioctlsort.c: Likewise.
2015-02-16 02:35:58 +00:00
4a00fc4867 tests: support alternative names of select syscall
* tests/select.awk: Recognize "_newselect" as another name of "select".
* tests/select.test: Try alternative names of select syscall.
2015-02-16 02:35:58 +00:00
f97a4774d2 i386: fix compilation warning
Some gcc versions complain about assigning long* to uint32_t* on i386.

* syscall.c [I386] (i386_esp_ptr): Change type from uint32_t* to long*.
* linux/i386/arch_regs.h (i386_esp_ptr): Likewise.
* linux/x86_64/arch_regs.h: Do not include "i386/arch_regs.h".
(i386_esp_ptr): New prototype.
2015-02-15 00:08:11 +00:00
e9bfff6de6 Do not reset get_regs_error unnecessarily
As get_regs() is now guaranteed to set get_regs_error,
there is no need to reset get_regs_error before get_regs() call.

* strace.c (trace): Call clear_regs() iff !WIFSTOPPED.
2015-02-14 00:12:23 +00:00
5d09224f90 get_syscall_result: remove redundant ifdefs
As get_regs() is now guaranteed to fetch registers when either
ARCH_REGS_FOR_GETREGSET or ARCH_REGS_FOR_GETREGS is defined, we can
safely replace all checks for architectures where these macros are defined
with a single check for these macros.

* syscall.c (get_syscall_result): Check for [ARCH_REGS_FOR_GETREGSET ||
ARCH_REGS_FOR_GETREGS].  Remove all checks for architectures where
nothing has to be done after get_regs().
2015-02-14 00:12:21 +00:00
9a176c9290 get_regs: define for all architectures
* defs.h (get_regs_error): Remove.
(clear_regs): Update prototype, declare unconditionally.
(get_regs): Declare unconditionally.
* syscall.c (clear_regs): New function.
(get_regs): Define unconditionally.
(get_regs_error): Define unconditionally, change scope to static.
2015-02-14 00:12:18 +00:00
7abf2e8307 get_regs: unify code for architectures that use PTRACE_GETREGS
* syscall.c [I386, POWERPC, ARM, AVR32, SPARC, SPARC64, TILE]
(ARCH_REGS_FOR_GETREGS): New macro.
(get_regs): Unify code for ARCH_REGS_FOR_GETREGS architectures.
2015-02-14 00:12:03 +00:00
d6db1db2a4 get_regset: define iff PTRACE_GETREGSET is used
* syscall.c [AARCH64, X86_64, X32] (ARCH_REGS_FOR_GETREGSET,
ARCH_IOVEC_FOR_GETREGSET): New macros.
(get_regset): Define iff ARCH_REGS_FOR_GETREGSET is defined; change
return type to long, return ptrace() return code instead of assigning it
to get_regs_error; do not list individual architectures, implement
constant and variable iovec cases depending on ARCH_IOVEC_FOR_GETREGSET.
(get_regs): Assign get_regset() return code to get_regs_error.
2015-02-14 00:11:35 +00:00
82ae5b9e1b arm, i386: switch back to use PTRACE_GETREGS
PTRACE_GETREGSET and PTRACE_GETREGS methods are equally good on arm and
i386 architectures, but PTRACE_GETREGSET with fallback to PTRACE_GETREGS
is a bit more costly, so choose the method that costs less.
This partially reverts commit v4.7-149-gfaa177e.

* syscall.c [ARM, I386] (ARCH_REGS_FOR_GETREGSET): Remove.
(get_regset) [ARM || I386]: Remove.
(get_regs) [ARM || I386]: Use PTRACE_GETREGS unconditionally.
2015-02-14 00:11:32 +00:00
ebea3426bb syscall.c: remove obsolete ifdefs
* syscall.c (get_regset, get_regs): Do not check for availability
of PTRACE_GETREGSET and NT_PRSTATUS macros.
2015-02-14 00:11:28 +00:00
4c3f2ae2c8 syscall.c: ensure that NT_PRSTATUS is defined
* syscall.c: Do not include <elf.h>.
(NT_PRSTATUS): New macro.
2015-02-14 00:11:18 +00:00
5503dd28c6 Move regs-related macros and declarations from defs.h to regs.h
* regs.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/arch_regs.h: New file.
* linux/alpha/arch_regs.h: Likewise.
* linux/arm/arch_regs.h: Likewise.
* linux/hppa/arch_regs.h: Likewise.
* linux/i386/arch_regs.h: Likewise.
* linux/ia64/arch_regs.h: Likewise.
* linux/mips/arch_regs.h: Likewise.
* linux/powerpc/arch_regs.h: Likewise.
* linux/sh64/arch_regs.h: Likewise.
* linux/sparc/arch_regs.h: Likewise.
* linux/sparc64/arch_regs.h: Likewise.
* linux/tile/arch_regs.h: Likewise.
* linux/x86_64/arch_regs.h: Likewise.
* Makefile.am (EXTRA_DIST): Add them.
* defs.h: Remove definitions of PTRACE_*, REG_*, PT_*, U_REG_*,
and ARM_* macros.
Remove declarations of struct pt_regs variables.
[SPARC]: Do not include <asm/psr.h>.
[SPARC64]: Do not include <asm/psrcompat.h>.
* bjm.c: Do not include <sys/user.h>.
* process.c: Include "regs.h".
Do not include <sys/user.h> and <sys/reg.h>.
[IA64]: Do not include <asm/ptrace_offsets.h> and <asm/rse.h>.
* util.c: Likewise.
* syscall.c: Likewise.
[AARCH64]: Define struct arm_pt_regs and ARM_* macros.
[SPARC]: Include <asm/psr.h>.
[SPARC64]: Include <asm/psrcompat.h>.
* signal.c: Include "regs.h".
Do not include <sys/user.h> and <sys/reg.h>.
[IA64]: Do not include <asm/ptrace_offsets.h>.
* strace.c [IA64]: Do not include <asm/ptrace_offsets.h>.
2015-02-13 18:28:08 +00:00
fadf379b8e Move all ptrace-related macros and declarations from defs.h to ptrace.h
* ptrace.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* configure.ac (AC_CHECK_HEADERS): Remove linux/ptrace.h and sys/ptrace.h.
* defs.h: Do not include <sys/ptrace.h> and <asm/ptrace.h>.
Remove definitions of PTRACE_* macros.
* process.c: Remove <linux/ptrace.h> workarounds, include "ptrace.h".
* signal.c: Likewise.
* syscall.c: Likewise.
* util.c: Likewise.
* strace.c: Include "ptrace.h".
* wait.c: Likewise.
2015-02-13 18:27:58 +00:00
d8b3404555 Enhance wait status decoding
* xlat/ptrace_events.in: New file.
* wait.c: Include "xlat/ptrace_events.h".
(printstatus): In case of WIFSTOPPED, print 0x80 flag separately from
the stop signal name.
[WIFCONTINUED]: Add WIFCONTINUED support.
Decode PTRACE_EVENT_* events.
2015-02-12 23:24:46 +00:00
67d0a8ecfa scsi: add bsg support
The Linux kernel supports two different versions of the SG_IO API,
namely v3 and v4. This patch adds support for version 4 of this API.
At least the sg3_utils package supports version 4 of this API.  Version
4 of this API is used if /dev/bsg/H:C:I:L is used as device name.

This patch has been tested by inspecting the output of the following
commands:

modprobe scsi_debug dev_size_mb=16 delay=0
dev=$(lsscsi | sed -n '/ scsi_debug /s,^[^/]*,,p')
./strace -eioctl -s256 sg_inq $dev
echo 'Test XDWRITEREAD(10)'
bsg=/dev/bsg/$(lsscsi | sed -n '/ scsi_debug /s,^\[\([^]]\+\)\].*,\1,p')
dd if=/dev/zero bs=512 count=1 |
  ./strace -eioctl -s256 sg_raw -s 512 -r 1024 $bsg 53 00 00 00 00 01 00 00 01 00

* configure.ac (AC_CHECK_HEADERS): Add linux/bsg.h.
* xlat/bsg_protocol.in: New file.
* xlat/bsg_subprotocol.in: Likewise.
* scsi.c: Include them and <linux/bsg.h>.
(print_sg_io_v3_req, print_sg_io_v3_res, print_sg_io_v4_req,
print_sg_io_v4_res): New functions.
(print_sg_io_req, print_sg_io_res): Use them.
(scsi_ioctl): Update callers.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2015-02-08 02:07:22 +00:00
791145ee6e scsi: Add iovec support
* scsi.c (print_sg_io_req, print_sg_io_res): Add support for decoding
iovecs passed via the SG I/O v3 interface.  Decode the "data in" and
"data out" buffers in hex instead of in ASCII.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2015-02-08 01:42:00 +00:00
0014bb1b9d scsi: on exit, print only initialized part of the buffer
* scsi.c (print_sg_io_res): Only print that part of the data in buffer
that has been initialized by the SCSI LLD driver.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2015-02-08 01:42:00 +00:00
ea6972c162 scsi: make print_sg_io_buffer() print square brackets instead of its callers
* scsi.c (print_sg_io_buffer): Print square brackets in this function.
(print_sg_io_req, print_sg_io_res): Update callers.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2015-02-08 01:42:00 +00:00
c760251451 scsi: improve consistency with other decoding functions
Pass pointers to tracee's memory as integers instead of pointers.

* scsi.c (print_sg_io_buffer): Change second argument's type to
unsigned long.
(print_sg_io_req, print_sg_io_res): Update callers.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2015-02-08 01:42:00 +00:00
d07056f4d0 tests: extend getdents to support all filesystems regardless of file order
* tests/getdents.awk: Include all 6 possible permutations of 3
direntries to regexps.
2015-02-08 01:41:37 +00:00
3910d0f67c print_setsockopt: fix fall-through bug in SOL_IP switch case
This fixes the bug introduced by commit v4.9-250-ga0a4909.

* net.c (print_setsockopt): Separate SOL_IP case from SOL_PACKET.

Reported-by: Ben Noordhuis <info@bnoordhuis.nl>
2015-02-08 01:19:06 +00:00
85dc4a11c7 Do not watch for post-execve SIGTRAP if PTRACE_O_TRACEEXEC is enabled
If PTRACE_O_TRACEEXEC option is enabled, then post-execve SIGTRAPs are
suppressed and we can safely skip -ENOSYS heuristics.  This partially
reverts commits v4.9-258-g8e398b6 and v4.9-261-gd70c41d.

* syscall.c (syscall_fixup_on_sysenter): Skip if PTRACE_O_TRACEEXEC
flag is set in ptrace_setoptions.  Remove all SECCOMP_RET_ERRNO
workarounds as they are not needed when PTRACE_O_TRACEEXEC is not
supported by the kernel.
2015-02-07 23:38:25 +00:00
2cd488b259 When the process stared by strace exits/terminates, forget its pid
The process stared by strace can exit/terminate only once.  When this
happens, forget its pid, so that any other event or action related to a
process with the same pid as the pid of that first process would not be
confused with that first process.

* strace.c (print_signalled, print_exited): Clear strace_child when it
equals to the given pid.
2015-02-07 22:28:31 +00:00
aa80192e79 -b execve: avoid misleading warning about unknown pid
* strace.c (maybe_allocate_tcb): If detach_on_execve is set, do not warn
about !WIFSTOPPED process with pid == strace_child.
* tests/bexecve.test: New test.
* tests/Makefile.am (TESTS): Add it.
2015-02-07 22:28:27 +00:00
e69081359a -b execve: do not use struct tcb after detach
* strace.c (trace): Do not proceed after detach.
2015-02-07 17:47:53 +00:00
4b4ec12087 trace: split into several functions
This change moves the main loop back to main() and splits trace()
into several functions.  There are no algorithmic changes.

* strace.c (print_debug_info, maybe_allocate_tcb, maybe_switch_tcbs,
print_signalled, print_exited, print_stopped, startup_tcb): New
functions.
(trace) Use them.  Move the main loop ...
(main): ... here.
2015-02-07 17:31:54 +00:00
d8890b5c9d printsiginfo: constify the first argument
* signal.c (printsiginfo): Make the first argument a pointer to a const type.
* defs.h (printsiginfo): Likewise.
(printsiginfo, printsiginfo_at): Always define these prototypes.
* configure.ac (AC_CHECK_TYPES): Remove siginfo_t, as HAVE_SIGINFO_T
is no longer used.
2015-02-07 15:47:24 +00:00
35701997cf test: add a manual test for seccomp decoding
* test/.gitignore: Add seccomp.
* test/Makefile (PROGS): Likewise.
* test/seccomp.c: New file.
* test/README: Mention ../tests/.
2015-02-06 01:52:59 +00:00
2af6903f45 Implement seccomp decoding
* configure.ac (AC_CHECK_HEADERS): Add linux/filter.h
and linux/seccomp.h.
* defs.h (print_seccomp_filter): New prototype.
* linux/dummy.h (sys_seccomp): Remove.
* linux/syscall.h (sys_seccomp): New prototype.
* prctl.c: Include <linux/seccomp.h>.
(sys_prctl): Decode PR_SET_SECCOMP.
* seccomp.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* xlat/bpf_class.in: New file.
* xlat/bpf_miscop.in: Likewise.
* xlat/bpf_mode.in: Likewise.
* xlat/bpf_op_alu.in: Likewise.
* xlat/bpf_op_jmp.in: Likewise.
* xlat/bpf_rval.in: Likewise.
* xlat/bpf_size.in: Likewise.
* xlat/bpf_src.in: Likewise.
* xlat/seccomp_filter_flags.in: Likewise.
* xlat/seccomp_mode.in: Likewise.
* xlat/seccomp_ops.in: Likewise.
* xlat/seccomp_ret_action.in: Likewise.
2015-02-06 01:23:05 +00:00
0946052255 is_negated_errno: support large errno values
Thanks to SECCOMP_RET_DATA == 0xffff, abnormally large errno
values could be easily seen when a seccomp filter is used, e.g.
BPF_STMT(BPF_RET, SECCOMP_RET_ERRNO | SECCOMP_RET_DATA)

* syscall.c (is_negated_errno): Allow errno values as large as 0xffff.
2015-02-06 01:23:05 +00:00
d70c41ddad x86, x32, x86_64: print SECCOMP_RET_ERRNO filtered syscalls
This is required to process SECCOMP_RET_ERRNO filtered syscalls on
systems where linux kernel does not change the syscall number to -1.

* syscall.c (is_negated_errno): Move before syscall_fixup_on_sysenter.
(syscall_fixup_on_sysenter) [I386 || X32 || X86_64] : Use it to check
AX register.
2015-02-06 01:23:05 +00:00
f46ab5f169 is_negated_errno: merge x86_64 and x32 definitions
* syscall.c (kernel_long_t, kernel_ulong_t): New types.
(is_negated_errno): Merge [X32] and [!X32] definitions.
(get_error): Merge [X86_64] and [X32] code.
2015-02-06 01:23:05 +00:00
38b295569f x32: rename is_negated_errno_x32 to is_negated_errno
Use the same function name on all architectures.

* syscall.c [X32] (is_negated_errno_x32): Rename to is_negated_errno.
(get_error) [X32]: Update callers.
2015-02-06 01:23:05 +00:00
8e398b6c40 x86, x32, x86_64: do not skip syscall number -1
Syscall number -1 might be a side effect of SECCOMP_RET_ERRNO filtering.

* syscall.c (syscall_fixup_on_sysenter) [I386 || X32 || X86_64]:
Do not skip syscalls that have number -1.
2015-02-06 01:23:05 +00:00
c394832771 x86_64: do not interpet syscall number -1 as a x32 personality syscall
Syscall number -1 might be a side effect of SECCOMP_RET_ERRNO filtering.

* syscall.c (get_scno) [X86_64]: Handle the case of scno == -1.
2015-02-06 01:22:28 +00:00
fef09070d6 Implement getrandom syscall decoding
* getrandom.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/dummy.h (sys_getrandom): Remove.
* linux/syscall.h (sys_getrandom): New prototype.
* xlat/getrandom_flags.in: New file.
* tests/getrandom.c: New file.
* tests/getrandom.awk: New file.
* tests/getrandom.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add getrandom.
(TESTS): Add getrandom.test.
(EXTRA_DIST): Add getrandom.awk.
* tests/.gitignore: Add getrandom.
2015-02-05 01:10:47 +00:00
e837b14a53 tests: add a test for select syscall decoding
Convert test/select.c into a regular test.

* test/Makefile (PROGS): Remove select.
* test/.gitignore: Likewise.
* test/select.c: Rewrite to ...
* tests/select.c: ... new file.
* tests/select.awk: New file.
* tests/select.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add select.
(TESTS): Add select.test.
(EXTRA_DIST): Add select.awk.
* tests/.gitignore: Add select.
2015-02-04 02:21:13 +00:00
495f525d68 tests: add a test for the latest dumpio fix
* tests/dumpio.expected: New file.
* tests/unix-pair-send-recv.c: New file.
* tests/dumpio.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add unix-pair-send-recv.
(TESTS): Add dumpio.test.
(EXTRA_DIST): Add dumpio.expected.
* tests/.gitignore: Add unix-pair-send-recv.
2015-02-01 01:33:20 +00:00
dc52121cd0 Fix simultaneous -e read and -e write usage
This allows using both -e read=FD and -e write=FD at the same time
with the same FD.
Without this patch, the -e write=FD is ignored if -e read=FD is used
at the same time.

Signed-off-by: Aurelien Jacobs <aurel@gnuage.org>
2015-02-01 01:33:17 +00:00
f362a33660 net.c: remove unused HAVE_SIN6_SCOPE_ID_LINUX-based code
The AC_SIN6_SCOPE_ID autoconf macro that was able to define
HAVE_SIN6_SCOPE_ID_LINUX was removed by commit v4.4-98-g64f793a.

* net.c [HAVE_SIN6_SCOPE_ID_LINUX]: Remove.
2015-01-31 01:14:39 +00:00
d0dceaf0ff printsock: do not fetch sockaddr.sa_data twice
* net.c (printsock): Print addrbuf.sa.sa_data using print_quoted_string.
2015-01-30 13:36:49 +00:00
a0a4909988 setsockopt: add decoding of MCAST_JOIN_GROUP and MCAST_LEAVE_GROUP
* net.c (print_group_req): New function.
(print_setsockopt): Use it.
2015-01-30 01:55:20 +00:00
c9e2418827 tests: add a test for sockaddr_un.sun_path decoding
* tests/net-accept-connect.c: Allow long socket addresses.
* tests/sun_path.test: New test.
* tests/Makefile.am (TESTS): Add it.
2015-01-29 23:06:15 +00:00
f57bd11eb0 printsock: print the whole sockaddr_un.sun_path
* net.c (printsock): If sockaddr_un.sun_path is not NUL-terminated,
do not omit the last byte of sockaddr_un.sun_path array.
2015-01-29 15:19:21 +00:00
d9177dfc12 printsock: do not fetch sockaddr_un.sun_path twice
* net.c (printsock): Print addrbuf.sau.sun_path using
print_quoted_string.
2015-01-29 07:34:40 +00:00
6d31c7a6a9 net: define all SOL_* constants
Ensure that all known SOL_* constants are defined.
Sync the list of known SOL_* constants with linux/socket.h.

* net.c: Provide definitions for all SOL_* constants.
Remove all SOL_* preprocessor conditionals.
(socketlayers): Disconnect from inet_protocols.
* xlat/socketlayers.in: Remove SOL_ICMP, add SOL_ALG and SOL_NFC.
2015-01-29 05:21:08 +00:00
02f2f091d5 setsockopt: decode PACKET_ADD_MEMBERSHIP
* xlat/packet_mreq_type.in: New file.
* net.c: Include "xlat/packet_mreq_type.h".
(print_packet_mreq): New function.
(print_setsockopt): Use it.
2015-01-29 03:35:11 +00:00
0509c8ed6d getsockopt, setsockopt: do not decode structures in non-verbose mode
Move the code that is common between getsockopt and setsockopt parsers
to a separate function.
Move printers specific to getsockopt and setsockopt to separate
functions, choose appropriate parsers depending on verbose mode.
Move parsers of specific socket options to separate functions.

* net.c (printicmpfilter): Rename to print_icmp_filter.
(printsockopt): Remove.
(print_sockopt_fd_level_name, print_linger, print_ucred,
print_tpacket_stats, print_getsockopt, print_tpacket_req,
print_packet_mreq, print_setsockopt): New functions.
(sys_getsockopt, sys_setsockopt): Use them.
2015-01-29 03:35:07 +00:00
00244b94bb sendmsg: do not decode msghdr in non-verbose mode
* net.c (printmsghdr): Do not decode struct msghdr in non-verbose mode.
2015-01-28 01:52:25 +00:00
2fc5d80858 decode_select: do not allocate unused memory
* desc.c (decode_select): On entering syscall, do not allocate memory
in non-verbose mode.
2015-01-28 01:26:04 +00:00
73e98805dd xattr: quote using print_quoted_string
* xattr.c (print_xattr_val): Drop local quoting code, use
print_quoted_string.
2015-01-26 19:08:37 +00:00
f0a5b083c9 v4l2: quote pixelformat
* v4l2.c (print_pixelformat): Output in quoted v4l2_fourcc() format.
2015-01-26 19:08:37 +00:00
1de59cf746 v4l2: quote strings
* v4l2.c (v4l2_ioctl): Print strings using print_quoted_string.
2015-01-26 19:08:37 +00:00
8192cece19 mips: quote sysmips nodename
* sysmips.c (sys_sysmips): Print nodename using print_quoted_string.
2015-01-26 19:08:37 +00:00
0a87058640 block_ioctl: quote strings
* block.c (print_blkpg_req): Print blkpg_partition.devname and
blkpg_partition.volname using print_quoted_string.
(block_ioctl): Print blk_user_trace_setup.name using print_quoted_string.
2015-01-26 19:08:37 +00:00
50e1304775 sys_uname: quote struct utsname members
* uname.c (PRINT_UTS_MEMBER): New macro.
(sys_uname): Use them.
2015-01-26 19:08:37 +00:00
81e4515ad9 sock_ioctl: quote network interface names
* sock.c (print_ifname): New function.
(sock_ioctl): Use it to quote ifr_name, ifru_newname, and ifru_slave.
2015-01-26 19:08:37 +00:00
0e9d594caa printsock: quote network interface names
* net.c (printsock): Print network interface names returned by
if_indextoname() using print_quoted_string.
2015-01-26 19:08:37 +00:00
c92977118d getdents, getdents64: quote filenames
* dirent.c (print_old_dirent): Fix quoting.
(sys_getdents): Print d_name using print_quoted_string.
(sys_getdents64): Likewise.
* tests/getdents.test: Test it.
* tests/getdents.awk: Update.
2015-01-26 19:08:37 +00:00
c7235992dc printfd: quote pathnames
Change printfd() behaviour in show_fd_path mode to quote pathnames
the same way printpathn() does.

* util.c (printfd): Print non-socket paths using print_quoted_string.
* tests/scm_rights-fd.test: Test it.
* tests/scm_rights.c: Update.
2015-01-26 19:05:40 +00:00
513e96eb94 Rework string_quote API
string_quote() has proven to be too hard to use, replace it with
print_quoted_string() that does memory allocation and prints the result.

* defs.h (string_quote): Remove.
(QUOTE_0_TERMINATED, QUOTE_OMIT_LEADING_TRAILING_QUOTES): New macros.
(print_quoted_string): New prototype.
* util.c (string_quote): Make static; take "style" flags instead
of "len", treat QUOTE_0_TERMINATED style flag as former (len == -1);
add QUOTE_OMIT_LEADING_TRAILING_QUOTES style flag support.
(ALLOCA_CUTOFF, use_alloca): New macros.
(print_quoted_string): New function.
(printpathn, printstr): Update to new API.
* loop.c (loop_ioctl): Likewise.
* mtd.c (ubi_ioctl): Likewise.
* net.c (print_scm_security): Likewise.
* socketutils.c (unix_parse_response): Likewise.
2015-01-26 15:58:18 +00:00
a10b6feb44 avr32: fix typo in sys_timerfd syscall entry
* linux/avr32/syscallent.h (timerfd): Change sys_name to "timerfd".
2015-01-24 16:42:41 +00:00
ad66048592 hppa: fix typos in getresuid and getresgid syscall entries
* linux/hppa/syscallent.h (getresuid): Change sys_func to sys_getresuid.
(getresgid): Change sys_func to sys_getresgid.
2015-01-24 16:42:32 +00:00
7aa6134475 hppa: fix typo in getpeername syscall entry
This fixes an obvious typo which prints "lock" instead of "getpeername"
for the getpeername syscall.

* linux/hppa/syscallent.h (getpeername): Change sys_name to "getpeername".
2015-01-24 16:42:13 +00:00
b85a7f3b95 Impove struct cmsghdr decoding
Print all cmsghdr structures in msg_control array,
not just the first one.
Change output format to be consistent with other parts of strace
where structures and arrays are printed.
Implement decoder for SCM_SECURITY message type.

* net.c (print_scm_rights, print_scm_creds, print_scm_security):
New functions.
(printcmsghdr): Use them.  Iterate over all members of the array.
* xlat/scmvals.in: Add SCM_SECURITY.
* tests/scm_rights.c (main): Pass one more descriptor to the receiver.
Set SO_PASSCRED on the receiver part.  Reserve enough space to receive
SCM_CREDENTIALS and SCM_RIGHTS.
* tests/scm_rights-fd.test: Update.
2015-01-24 15:54:33 +00:00
778dfb270f Update SO_* constants
* xlat/sockoptions.in: Add SO_DOMAIN, SO_MARK, SO_NOFCS, SO_PASSSEC,
SO_PROTOCOL, SO_RCVBUFFORCE, SO_SNDBUFFORCE, SO_TIMESTAMPING,
and SO_TIMESTAMPNS.
2015-01-24 15:19:33 +00:00
679c47c348 tests: run tests for each supported personality
When strace supports more than one personality, run test suite
for each personality supported by the host system.

* bootstrap: Create tests-m32 and tests-mx32 subtrees from tests.
* configure.ac: Check for -m32 and -mx32 runtime support.
(AC_CONFIG_FILES): Add tests-m32/Makefile and tests-mx32/Makefile.
* Makefile.am [HAVE_M32_RUNTIME] (TESTS_M32): Define.
[HAVE_MX32_RUNTIME] (TESTS_MX32): Define.
(SUBDIRS): Add $(TESTS_M32) $(TESTS_MX32).
* .gitignore: Add /tests-m32 and /tests-mx32.
2015-01-24 03:39:34 +00:00
05884d866c Fix ILP32 personality struct cmsghdr decoding on LP64 architectures
* net.c (union_cmsghdr): New union.
[SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4] (cmsghdr32): New structure.
(printcmsghdr): Properly handle the case of current_wordsize < sizeof(long).
2015-01-24 03:39:30 +00:00
5de5a7abd5 Fix ILP32 personality preadv/pwritev offset decoding on LP64 architectures
* io.c (print_llu_from_low_high_val) [SIZEOF_LONG == SIZEOF_LONG_LONG
&& SUPPORTED_PERSONALITIES > 1]: Properly handle the case of
current_wordsize < sizeof(long).
2015-01-24 01:15:07 +00:00
df7aa2b19e ioctl: take all 32 bits of ioctl commands into account
Historically, only 16 bits (8-bit number and 8-bit type) of 32-bit ioctl
commands were used for decoding, which was the source for numerous
annoying collisions like this:

	ioctl(0, SNDCTL_TMR_TIMEBASE or SNDRV_TIMER_IOCTL_NEXT_DEVICE or TCGETS, {B38400 opost isig icanon echo ...}) = 0
	ioctl(0, MGSL_IOCGPARAMS or MMTIMER_GETRES or MTIOCTOP or SNDCTL_MIDI_MPUMODE, 0x7fffd47f7338) = -1 ENOTTY (Inappropriate ioctl for device)

The solution is to use all 32 bits for decoding, not just "number" and
"type", but also "size" and "direction".

As some architectures override defaults that come from asm-generic/ and
provide alternative definitions for some ioctl commands, we support
per-architecture ioctl definitions and merge them with common
definitions at build time.  During the merge, we used to keep both
generic and architecture-specific definitions, now architecture-specific
definitions have precedence over generic ones -- ioctlsort omits
definitions from asm-generic/ for those ioctl names that have different
definitions in asm/.

Additional bits of "direction" are architecture specific -- the number
of bits and their values differ between architectures.  To reduce
architecture differences in the source code, we keep "direction" in
symbolic form and compile it in ioctlsort.

Additional bits of "size" are also architecture specific -- not only the
number of bits differ between architectures, but sizes of many types
depend on sizeof(long).  To reduce architecture differences in the
source code, we keep 32-bit and 64-bit versions of common ioctl
definitions, and use the appropriate version for each architecture and
personality.

To implement this, the tools for generating ioctl definitions from
kernel headers have been rewritten, and the source format of ioctl
definitions has been extended.   The final ioctlent*.h files that are
included by syscall.c are now generated from source ioctls_inc*.h and
ioctls_arch*.h files at build time with ioctlsort.

* ioctl.c (ioctl_lookup): Use all 32 bits of ioctl command code.
* ioctlsort.c: Rewritten.
* linux/32/ioctls_inc.h: New file.
* linux/64/ioctls_inc.h: New file.
* linux/aarch64/ioctls_arch0.h: New file.
* linux/aarch64/ioctls_arch1.h: New file.
* linux/aarch64/ioctls_inc0.h: New file.
* linux/aarch64/ioctls_inc1.h: New file.
* linux/alpha/ioctls_arch0.h: New file.
* linux/alpha/ioctls_inc0.h: New file.
* linux/arc/ioctls_arch0.h: New file.
* linux/arc/ioctls_inc0.h: New file.
* linux/arm/ioctls_arch0.h: New file.
* linux/arm/ioctls_inc0.h: New file.
* linux/avr32/ioctls_arch0.h: New file.
* linux/avr32/ioctls_inc0.h: New file.
* linux/bfin/ioctls_arch0.h: New file.
* linux/bfin/ioctls_inc0.h: New file.
* linux/hppa/ioctls_arch0.h: New file.
* linux/hppa/ioctls_inc0.h: New file.
* linux/i386/ioctls_arch0.h: New file.
* linux/i386/ioctls_inc0.h: New file.
* linux/ia64/ioctls_arch0.h: New file.
* linux/ia64/ioctls_inc0.h: New file.
* linux/m68k/ioctls_arch0.h: New file.
* linux/m68k/ioctls_inc0.h: New file.
* linux/metag/ioctls_arch0.h: New file.
* linux/metag/ioctls_inc0.h: New file.
* linux/microblaze/ioctls_arch0.h: New file.
* linux/microblaze/ioctls_inc0.h: New file.
* linux/mips/ioctls_arch0.h: New file.
* linux/mips/ioctls_inc0.h: New file.
* linux/or1k/ioctls_arch0.h: New file.
* linux/or1k/ioctls_inc0.h: New file.
* linux/powerpc/ioctls_arch0.h: New file.
* linux/powerpc/ioctls_inc0.h: New file.
* linux/powerpc64/ioctls_arch0.h: New file.
* linux/powerpc64/ioctls_arch1.h: New file.
* linux/powerpc64/ioctls_inc0.h: New file.
* linux/powerpc64/ioctls_inc1.h: New file.
* linux/s390/ioctls_arch0.h: New file.
* linux/s390/ioctls_inc0.h: New file.
* linux/s390x/ioctls_arch0.h: New file.
* linux/s390x/ioctls_inc0.h: New file.
* linux/sh/ioctls_arch0.h: New file.
* linux/sh/ioctls_inc0.h: New file.
* linux/sh64/ioctls_arch0.h: New file.
* linux/sh64/ioctls_inc0.h: New file.
* linux/sparc/ioctls_arch0.h: New file.
* linux/sparc/ioctls_inc0.h: New file.
* linux/sparc64/ioctls_arch0.h: New file.
* linux/sparc64/ioctls_arch2.h: New file.
* linux/sparc64/ioctls_inc0.h: New file.
* linux/sparc64/ioctls_inc2.h: New file.
* linux/tile/ioctls_arch0.h: New file.
* linux/tile/ioctls_arch1.h: New file.
* linux/tile/ioctls_inc0.h: New file.
* linux/tile/ioctls_inc1.h: New file.
* linux/x32/ioctls_arch0.h: New file.
* linux/x32/ioctls_arch1.h: New file.
* linux/x32/ioctls_inc0.h: New file.
* linux/x32/ioctls_inc1.h: New file.
* linux/x86_64/ioctls_arch0.h: New file.
* linux/x86_64/ioctls_arch1.h: New file.
* linux/x86_64/ioctls_inc0.h: New file.
* linux/x86_64/ioctls_inc1.h: New file.
* linux/xtensa/ioctls_arch0.h: New file.
* linux/xtensa/ioctls_inc0.h: New file.
* linux/aarch64/ioctlent.h.in: Remove.
* linux/aarch64/ioctlent1.h: Remove.
* linux/alpha/ioctlent.h.in: Remove.
* linux/arc/ioctlent.h.in: Remove.
* linux/arm/ioctlent.h.in: Remove.
* linux/avr32/ioctlent.h.in: Remove.
* linux/bfin/ioctlent.h.in: Remove.
* linux/hppa/ioctlent.h.in: Remove.
* linux/i386/ioctlent.h.in: Remove.
* linux/ia64/ioctlent.h.in: Remove.
* linux/ioctlent.h.in: Remove.
* linux/ioctlent.sh: Remove.
* linux/m68k/ioctlent.h.in: Remove.
* linux/metag/ioctlent.h.in: Remove.
* linux/microblaze/ioctlent.h.in: Remove.
* linux/mips/ioctlent.h.in: Remove.
* linux/mips/ioctlent.sh: Remove.
* linux/or1k/ioctlent.h.in: Remove.
* linux/powerpc/ioctlent.h.in: Remove.
* linux/powerpc64/ioctlent.h: Remove.
* linux/powerpc64/ioctlent1.h: Remove.
* linux/s390/ioctlent.h.in: Remove.
* linux/s390x/ioctlent.h.in: Remove.
* linux/sh/ioctlent.h.in: Remove.
* linux/sh64/ioctlent.h.in: Remove.
* linux/sparc/ioctlent.h.in: Remove.
* linux/sparc64/ioctlent.h.in: Remove.
* linux/sparc64/ioctlent2.h: Remove.
* linux/tile/ioctlent.h.in: Remove.
* linux/tile/ioctlent1.h: Remove.
* linux/x32/ioctlent.h.in: Remove.
* linux/x32/ioctlent1.h: Remove.
* linux/x86_64/ioctlent.h.in: Remove.
* linux/x86_64/ioctlent1.h: Remove.
* linux/xtensa/ioctlent.h.in: Remove.
* linux/x86_64/ioctlent2.h: Include ioctlent0.h instead of ioctlent.h.
* syscall.c (struct_ioctlent ioctlent0): Likewise.
* Makefile.am: Remove all ioctlent-related definitions.
Define the list of ioctlent*.h files that have to be generated by
presence of $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h files.
Add rules for ioctlent*.h files generation.
(EXTRA_DIST): Update.
* maint/ioctls_gen.sh: New file.
* maint/ioctls_hex.sh: New file.
* maint/ioctls_sym.sh: New file.
* maint/print_ioctlent.c: New file.
* HACKING-scripts: Update for ioctlent.sh -> ioctls_gen.sh migration.
* .gitignore: Add ioctlent[012].h and ioctls_all[012].h.
* configure.ac (AC_CHECK_HEADERS): Add linux/hiddev.h
and linux/mmtimer.h for tests.
* tests/ioctl.c: New file.
* tests/ioctl.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add ioctl.
(TESTS): Add ioctl.test.
* tests/.gitignore: Add ioctl.
2015-01-22 00:27:38 +00:00
6f9a01c721 ioctl: add decoding for parametrized command names
Some ioctl commands from evdev, hiddev, mixer, uinput, spi, and joystick
are parametrized by a size or a number that are variable.  This change
implements printing of these parametrized ioctl command names.

* configure.ac (AC_CHECK_HEADERS): Add linux/input.h.
* defs.h (ioctl_decode_number): New prototype.
* io.c (sys_ioctl): Use ioctl_decode_number.
* ioctl.c (ioctl_decode_number): New function.
* xlat/evdev_abs.in: New file.
* xlat/evdev_ev.in: New file.

Signed-off-by: Gabriel Laskar <gabriel@lse.epita.fr>
2015-01-21 23:10:38 +00:00
63630746ef Update auxiliary maintainer mode build tools
* git-set-file-times: Update from rsync.
* git-version-gen: Update from gnulib.
* gitlog-to-changelog: Likewise.
2015-01-21 21:17:08 +00:00
174583df28 Update warnings.m4
* m4/warnings.m4: Update from gnulib.
2015-01-21 21:06:10 +00:00
af3ab5b854 powerpc64: maintain own linux/powerpc64 subdirectory
Most architectures supported by strace have their own subdirectory in
linux directory, but powerpc64 didn't, causing inconveniences.

* configure.ac (arch): Define to "powerpc64" on powerpc64.
* linux/powerpc/errnoent1.h: Move to linux/powerpc64/.
* linux/powerpc/ioctlent1.h: Likewise.
* linux/powerpc/signalent1.h: Likewise.
* linux/powerpc/syscallent1.h: Likewise.
* linux/powerpc64/ioctlent.h: New file.
* linux/powerpc64/syscallent.h: Likewise.
* linux/powerpc64/userent.h: Likewise.
* Makefile.am (EXTRA_DIST): Remove linux/powerpc/ioctlent1.h,
linux/powerpc/syscallent1.h, linux/powerpc/errnoent1.h, and
linux/powerpc/signalent1.h; added linux/powerpc64/errnoent1.h,
linux/powerpc64/ioctlent.h, linux/powerpc64/ioctlent1.h,
linux/powerpc64/signalent1.h, linux/powerpc64/syscallent.h,
linux/powerpc64/syscallent1.h, and linux/powerpc64/userent.h.
2015-01-21 17:34:37 +00:00
69099e714c configure.ac: remove unused AC_INCLUDEDIR
* configure.ac (AC_INCLUDEDIR): Remove.
* m4/includedir.m4: Remove.
2015-01-21 16:43:18 +00:00
924996a41e ioctl: print unrecognized ioctl codes in _IOC(dir,type,nr,size) format
* defs.h (ioctl_print_code): New prototype.
* ioctl.c: Include xlat/ioctl_dirs.h.
(ioctl_print_code): New function.
* io.c (sys_ioctl): Use it.
* xlat/ioctl_dirs.in: New file.
2015-01-21 00:48:52 +00:00
c7afb4881f ioctl: assume that all ioctl commands have unsigned int type
In linux, ioctl command number has a 32-bit unsigned integer type:
	fs/ioctl.c:SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
If the kernel completely ignores other bits on 64-bit architectures,
why should strace care?
Let's follow the kernel and treat it as unsigned int.

* defs.h (struct_ioctlent): Change "code" type to "unsigned int".
(ioctl_decode, ioctl_lookup, block_ioctl, loop_ioctl, mtd_ioctl,
ubi_ioctl, ptp_ioctl, scsi_ioctl, sock_ioctl, term_ioctl, rtc_ioctl,
v4l2_ioctl): Likewise.
* ioctl.c (ioctl_decode, ioctl_lookup, compare, ioctl_next_match):
Likewise.
* block.c (block_ioctl): Likewise.
* loop.c (loop_ioctl): Likewise.
* mtd.c (mtd_ioctl, ubi_ioctl): Likewise.
* ptp.c (ptp_ioctl): Likewise.
* scsi.c (scsi_ioctl): Likewise.
* sock.c (sock_ioctl): Likewise.
* term.c (term_ioctl): Likewise.
* time.c (rtc_ioctl): Likewise.
* v4l2.c (v4l2_ioctl): Likewise.
* ioctlsort.c (struct ioctlent, compare, main): Likewise.
2015-01-20 00:28:10 +00:00
74932976ba ioctlent.sh: cleanup regexps that are used to fetch bases 2015-01-16 20:20:45 +00:00
3d633bd302 ioctlent.sh: sync lookup regexps that are used in grep and sed
ioctlent.sh looks for ioctl command names using grep, and fetches them
with their definitions using sed.  Historically, lookup regexps used in
grep and sed are slightly different, which makes the script more
complicated than necessary.
2015-01-16 20:20:38 +00:00
868a66659c qemu_multiarch_testing: update
* qemu_multiarch_testing/.gitignore: New file.
* qemu_multiarch_testing/README: Update statistics.
* qemu_multiarch_testing/hdc.dir/init2: Run "make check".
* qemu_multiarch_testing/make-hdc-img.sh: Robustify,
automatically calculate hdc image size.
* qemu_multiarch_testing/parallel-build-hdc-img.sh: Reduce
hdb image size.  Report completion of each parallelized task.
2015-01-16 16:26:40 +00:00
7230d0a388 tests: add IPC_STAT to ipc tests, workaround limitiations of old kernels
* tests/ipc_msg.c: Include <errno.h>.
(main): Add a test call with IPC_STAT, handle old kernels MSG_STAT behaviour.
* tests/ipc_sem.c: Include <errno.h>.
(main): Add a test call with IPC_STAT, handle old kernels SEM_STAT behaviour.
* tests/ipc_shm.c: Include <errno.h>.
(main): Add a test call with IPC_STAT, handle old kernels SHM_STAT behaviour.
2015-01-14 16:57:37 +00:00
97e5996105 Change length type of umoven and umovestr to unsigned
* defs.h (umoven, umovestr): Change type of 3rd argument from "int"
to "unsigned int".
* util.c (umoven, umovestr): Likewise.  Adjust the code appropriately.
2015-01-14 13:18:05 +00:00
95cbf6ebfd tests: skip sendmmsg/recvmmsg test if these syscalls are not implemented in kernel
* tests/mmsg.c: #include <errno.h>
(main): Return 77 if sendmmsg failed with ENOSYS.
2015-01-14 13:18:05 +00:00
552bc3a09a tests: skip ip network tests when the network is not functional
* tests/inet-accept-connect-send-recv.c (main): Return 77 if inet stream
socket cannot be created or it cannot be bound to INADDR_LOOPBACK.
* tests/net-yy.test: Skip the test if inet-accept-connect-send-recv
returns 77.
2015-01-14 11:37:40 +00:00
878abbbd47 tests: handle the case when all 64 process capability bits are set
* tests/caps.awk: Handle the case when all bits of 64-bit capability
word are set.
2015-01-14 10:38:42 +00:00
d2a9ce61e7 tests: explicitly request gawk when using gawk features
* tests/uid.test: Check for gawk availability and invoke gawk instead of
plain awk because the test uses gawk's match() feature.
2015-01-14 10:15:49 +00:00
74697bd29b tests: skip detach tests if kill does not work
* tests/detach-running.test: Skip if "kill -0" does not work.
* tests/detach-sleeping.test: Likewise.
* tests/detach-stopped.test: Likewise.
2015-01-14 08:10:59 +00:00
03b4454129 ARM OABI: fix potential compilation warning
* syscall.c (get_scno) [!__ARM_EABI__ || ENABLE_ARM_OABI]: Fix
"comparison between signed and unsigned" warning reported by some
gcc versions.
2015-01-14 07:21:36 +00:00
3b64d99098 powerpc: fix potential compilation warning
* mem.c [POWERPC] (sys_subpage_prot): Fix "comparison between signed
and unsigned" warning reported by some gcc versions.
2015-01-14 07:17:11 +00:00
e5b672946e sparc, sparc64: remove ioctl header file names from solaris ioctl entries
Starting with commit v4.9-27-g3e252ca, header file names should not be
part of ioctlent files included by syscall.c

* linux/sparc/ioctlent1.h: Remove ioctl header file names.
* linux/sparc64/ioctlent2.h: Remove all entries, include "ioctlent.h".
2015-01-13 16:45:15 +00:00
b396bf63a5 mips: enable indirect ipc subcall support
* linux/mips/syscallent-n32.h [LINUX_MIPSN32]: Define SYS_socket_subcall,
include "subcall.h".
* linux/mips/syscallent-n64.h [LINUX_MIPSN64]: Likewise.
* linux/mips/syscallent-o32.h [LINUX_MIPSO32]: Likewise.
2015-01-13 16:03:55 +00:00
d59287dcac mips: remove stub entries from syscallent files, generate stubs at build time
* linux/mips/genstub.sh: New file.
* Makefile.am (EXTRA_DIST): Add it.
* configure.ac [MIPS]: Use it to generate syscallent stubs.
* linux/mips/.gitignore: Add syscallent stubs.
* linux/mips/syscallent-n32.h: Remove stub entries, include
the stub file instead.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
2015-01-13 10:55:32 +00:00
579836cd6b build: add $(builddir)/$(OS)/$(ARCH) to the headers search list
* Makefile.am (AM_CPPFLAGS): Add -I$(builddir)/$(OS)/$(ARCH) before
-I$(srcdir)/$(OS)/$(ARCH).
2015-01-13 06:41:44 +00:00
36ab3d520b build: fix build if siginfo_t lacks si_timerid/si_overrun
* configure.ac (AC_CHECK_MEMBERS): Check for siginfo_t.si_timerid and
siginfo_t.si_overrun.
* signal.c (printsiginfo) [SI_TIMER]: Check HAVE_SIGINFO_T_SI_TIMERID
and HAVE_SIGINFO_T_SI_OVERRUN.
2015-01-13 06:41:44 +00:00
8544681c73 configure.ac: remove unused AM_CONDITIONAL expressions
* configure.ac (AM_CONDITIONAL): Remove I386, X86_64, X32.
2015-01-13 04:06:52 +00:00
ed7ada24ac tests: portability fixes
* tests/stat.test: dd obs= is not portable, use bs= instead.
* tests/stat32-v.test: Likewise.
* tests/stat64-v.test: Likewise.
* tests/net.test: Use $* instead of $@ in the quoted string.
* tests/net-fd.test: Likewise.
* tests/statfs.test: Quote { and } in regexps.
* tests/caps.awk: Likewise.
* tests/getdents.awk: Likewise.
* tests/net-yy-accept.awk: Likewise.
* tests/net-yy-connect.awk: Likewise.
* tests/sigaction.awk: Likewise.
* tests/unix-yy-accept.awk: Likewise.
* tests/unix-yy-connect.awk: Likewise.
2015-01-13 00:33:56 +00:00
e78f02a166 Wire up new syscalls
* linux/dummy.h (sys_bpf, sys_execveat, sys_getrandom,
sys_kexec_file_load, sys_memfd_create, sys_seccomp): New stub aliases.
* linux/32/syscallent.h (seccomp, getrandom, memfd_create, bpf,
execveat): New entries.
* linux/64/syscallent.h: Likewise.
* linux/arm/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/ia64/syscallent.h (getrandom, memfd_create, bpf, execveat):
New entries.
* linux/m68k/syscallent.h: Likewise.
* linux/s390/syscallent.h: (seccomp, getrandom, memfd_create, bpf,
s390_pci_mmio_write, s390_pci_mmio_read, execveat): New entries.
* linux/s390x/syscallent.h: Likewise.
* linux/x86_64/syscallent.h (seccomp, getrandom, memfd_create,
kexec_file_load, bpf, execveat): New entries.
* linux/x32/syscallent.h: Likewise.
* linux/xtensa/syscallent.h (seccomp, getrandom, memfd_create):
New entries.
2015-01-12 19:05:34 +00:00
db613f0c47 s390x: adjust some syscall entries
According to linux/arch/s390/include/uapi/asm/unistd.h, readdir is
defined both on s390 and s390x, while getrlimit, _llseek, sendfile64,
and fadvise64_64 are defined on s390 only.

* linux/s390x/syscallent.h (readdir): Add.
(getrlimit, _llseek, sendfile64, fadvise64_64): Remove.
2015-01-12 17:32:16 +00:00
166b0bc71c Change syscallent.h files to use designated initializers
Automatically convert all linux syscallent.h files to a form that uses
designated initializers, with subsequent correction of whitespace
indentation.

* linux/alpha/syscallent.h: Use designated initializers.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
2015-01-12 17:32:16 +00:00
dee03a3c24 Create generic 32-bit syscallent.h
Since arc/syscallent.h, metag/syscallent.h, or1k/syscallent.h, and
tile/syscallent1.h share a lot of identical syscall entries described in
<asm-generic/unistd.h>, move these entries to a new file 32/syscallent.h
using the following automated conversion with subsequent correction of
whitespace indentation:

sed -e 's|^[[:space:]]*\({[^}]\+},\)[[:space:]]*/\*[[:space:]]\([[:space:]]*[0-9]\+\)[[:space:]]*\*/|[\2] = \1|' -e '/^[[:space:]]*\[[[:space:]]*2\(4[4-9]\|5[0-9]\)/d' linux/arc/syscallent.h

* linux/32/syscallent.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/arc/syscallent.h: Include "32/syscallent.h",
remove generic 32-bit syscall entries, use designated initializers.
* linux/metag/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
* linux/tile/syscallent1.h: Likewise.
2015-01-12 17:32:16 +00:00
ab4d89b319 tile: fix syscall entries
* linux/tile/syscallent1.h (truncate64, ftruncate64): Change nargs to 3.
(pread64, pwrite64): Change nargs to 5.
(llseek): Change sys_name to _llseek.
2015-01-12 17:32:16 +00:00
e9f77b2ff0 s390: fix fadvise64 and fadvise64_64 syscall entries
* linux/s390/syscallent.h (fadvise64, fadvise64_64): Change sys_func to
printargs until special parsers for 31-bit 31 s390 emulation wrappers
are written.
2015-01-12 17:32:16 +00:00
a7da52929c alpha: fix fadvise64 syscall entry
* linux/alpha/syscallent.h (fadvise64): Change sys_name to fadvise64.
2015-01-12 17:32:16 +00:00
f191352866 tile: fix fadvise64_64 syscall entry
* linux/tile/syscallent1.h (fadvise64_64): Fix nargs, sys_func,
and sys_name.
2015-01-12 17:32:16 +00:00
e56465cd3d Fix getrlimit and ugetrlimit syscall entries
* linux/arm/syscallent.h (getrlimit, ugetrlimit): Fix sys_name.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/avr32/syscallent.h (getrlimit): Fix sys_name.
* linux/or1k/syscallent.h: Likewise.
* linux/s390/syscallent.h (ugetrlimit): Fix sys_name.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
2015-01-12 17:32:16 +00:00
b873785089 Fix umount and umount2 syscall entries
* linux/aarch64/syscallent1.h (umount): Change nargs to 1.
* linux/avr32/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
* linux/ia64/syscallent.h (umount2): Change nargs to 2.
* linux/arm/syscallent.h (umount, umount2): Fix sys_name.
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/metag/syscallent.h: (umount2): Fix sys_name.
* linux/or1k/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
2015-01-12 17:32:16 +00:00
48a5b4e86e Fix sendfile64 syscall entries
* linux/arc/syscallent.h (sendfile64): Change sys_name to sendfile64.
* linux/metag/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
2015-01-12 17:32:16 +00:00
45cffe0834 Fix number of arguments in ipc family syscall entries
* linux/64/syscallent.h (msgget, semget, semtimedop, semop, shmget,
shmctl, shmat, shmdt): Fix nargs for direct ipc syscalls.
* linux/alpha/syscallent.h (msgctl, msgget, msgrcv, semget, shmctl,
shmdt, shmget, semtimedop): Likewise.
* linux/avr32/syscallent.h (msgget, semget, semop, semtimedop, shmat,
shmget, shmdt, shmctl): Likewise.
* linux/bfin/syscallent.h (semget, semop, msgctl, msgget, msgrcv, shmat,
* shmctl, shmdt, shmget, semtimedop): Likewise.
* linux/hppa/syscallent.h (semop, semget, msgrcv, msgget, msgctl,
semtimedop): Likewise.
* linux/microblaze/syscallent.h (semtimedop, semget, semop, msgctl,
msgget, msgrcv, shmat, shmctl, shmdt, shmget): Likewise.
* linux/ia64/syscallent.h (semtimedop): Likewise.
* linux/mips/syscallent-n32.h (semtimedop): Likewise.
* linux/mips/syscallent-n64.h (semtimedop): Likewise.
* linux/or1k/syscallent.h (msgget, msgctl, msgrcv, semget, semtimedop,
semop, shmget, shmctl, shmat, shmdt): Likewise.
* linux/sh64/syscallent.h (semget, msgget, shmget): Likewise.
* linux/tile/syscallent1.h (msgget, semget, semtimedop, semop, shmget,
shmctl, shmat, shmdt): Likewise.
* linux/x32/syscallent.h (shmget, shmat, shmctl, semget, semop, shmdt,
msgget, semtimedop): Likewise.
* linux/x86_64/syscallent.h (shmget, shmat, shmctl, semget, semop,
shmdt, msgget, semtimedop): Likewise.
* linux/xtensa/syscallent.h (shmget, shmat, shmctl, shmdt, semtimedop,
semget, semop, msgget, msgrcv, msgctl): Likewise.
2015-01-12 17:32:16 +00:00
200c02c1a7 Create generic 64-bit syscallent.h
Since aarch64/syscallent1.h and tile/syscallent.h share a lot of
identical syscall entries described in <asm-generic/unistd.h>, move
these entries to a new file 64/syscallent.h using the following
automated conversion with subsequent correction of whitespace
indentation:

sed -e 's|^[[:space:]]*\({[^}]\+},\)[[:space:]]*/\*[[:space:]]\([[:space:]]*[0-9]\+\)[[:space:]]*\*/|[\2] = \1|' -e '/^\[[[:space:]]*2\(4[4-9]\|5[0-9]\)\]/d' linux/tile/syscallent.h

* linux/64/syscallent.h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* linux/aarch64/syscallent1.h: Include "64/syscallent.h",
remove generic 64-bit syscall entries, use designated initializers.
* linux/tile/syscallent.h: Likewise.
2015-01-12 17:32:16 +00:00
d89890e074 Fix nfsservctl syscall entries
* linux/arc/syscallent.h (nfsservctl): Set nargs, sys_func, and sys_name.
* linux/metag/syscallent.h: Likewise.
2015-01-12 17:32:16 +00:00
d19f55fec9 Add missing syscall entries for sched_[gs]etattr and renameat2
* linux/alpha/syscallent.h (sched_setattr, sched_getattr, renameat2):
New syscall entries.
* linux/arc/syscallent.h: Likewise.
* linux/metag/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/tile/syscallent1.h: Likewise.
2015-01-12 17:32:16 +00:00
40ed3d2b69 Fix NUMA related syscall entries
* linux/alpha/syscallent.h (mbind, get_mempolicy, set_mempolicy):
Set sys_func.
* linux/hppa/syscallent.h (mbind, get_mempolicy, set_mempolicy):
Fix nargs, set sys_func.
* linux/microblaze/syscallent.h (mbind): Fix nargs.
* linux/mips/syscallent-n32.h (move_pages): Set sys_func.
* linux/mips/syscallent-n64.h (move_pages): Likewise.
* linux/mips/syscallent-o32.h (mbind): Fix nargs.
* linux/or1k/syscallent.h (migrate_pages): Likewise.
* linux/powerpc/syscallent.h (migrate_pages): Likewise.
* linux/sh/syscallent.h (mbind): Likewise.
* linux/sh64/syscallent.h (mbind): Likewise.
2015-01-12 17:32:16 +00:00
e7356c7049 xtensa: fix syscall entries
* linux/xtensa/syscallent.h (sendmmsg): Fix sys_func and sys_name.
(restart_syscall, io_setup, io_destroy, io_submit, io_getevents,
io_cancel, add_key, request_key, keyctl): Set sys_func.
(migrate_pages, mbind, get_mempolicy, set_mempolicy, move_pages,
fstatat64): Fix nargs.
(renameat2): New entry.
2015-01-12 17:32:16 +00:00
b9efc7d01a Fix sched_setparam syscall entries
* linux/aarch64/syscallent1.h (sched_setparam): Change nargs to 2.
* linux/arm/syscallent.h (sched_setparam): Likewise.
* linux/avr32/syscallent.h (sched_setparam): Likewise.
* linux/bfin/syscallent.h (sched_setparam): Likewise.
* linux/i386/syscallent.h (sched_setparam): Likewise.
* linux/m68k/syscallent.h (sched_setparam): Likewise.
* linux/microblaze/syscallent.h (sched_setparam): Likewise.
* linux/s390/syscallent.h (sched_setparam): Likewise.
* linux/s390x/syscallent.h (sched_setparam): Likewise.
* linux/sh/syscallent.h (sched_setparam): Likewise.
* linux/sh64/syscallent.h (sched_setparam): Likewise.
* linux/tile/syscallent.h (sched_setparam): Likewise.
* linux/tile/syscallent1.h (sched_setparam): Likewise.
* linux/x32/syscallent.h (sched_setparam): Likewise.
* linux/x86_64/syscallent.h (sched_setparam): Likewise.
2015-01-12 17:32:16 +00:00
2534cd8a62 arc: fix fanotify_mark syscall entry
* linux/arc/syscallent.h (fanotify_mark): Change nargs to 6.
2015-01-12 17:32:16 +00:00
fbc98c23f2 ia64: add fallocate syscall entry
* linux/ia64/syscallent.h (fallocate): Add syscall entry.
2015-01-12 17:32:16 +00:00
5b05361dcd Fix lookup_dcookie syscall entries
* linux/s390/syscallent.h (lookup_dcookie): Add syscall entry.
* linux/s390x/syscallent.h (lookup_dcookie): Likewise.
* linux/tile/syscallent.h (lookup_dcookie): Change nargs to 3.
* linux/x32/syscallent.h (lookup_dcookie): Likewise.
2015-01-12 17:32:16 +00:00
f8b7994900 aarch64: fix syscall names for statfs, fstatfs, truncate, and ftruncate
* linux/aarch64/syscallent1.h (statfs, fstatfs, truncate, ftruncate):
Use correct syscall names.
2015-01-12 17:32:16 +00:00
83eaf7b87f aarch64: fix mlock syscall entry
* linux/aarch64/syscallent1.h (mlock): Change to mlock entry.
2015-01-12 17:32:16 +00:00
41eb00de4c sh, sh64: fix mlock syscall entry
* linux/sh/syscallent.h (mlock): Change nargs to 2.
* linux/sh64/syscallent.h (mlock): Likewise.
2015-01-12 17:32:16 +00:00
7f31c22c2b tile: fix swapon syscall entries
* linux/tile/syscallent.h (swapon): Change nargs to 2.
* linux/tile/syscallent1.h (swapon): Likewise.
2015-01-12 17:32:16 +00:00
48ce4a3a52 ARM EABI: reserve some space for new syscalls
Reserve the same space for new syscalls on EABI as it is already
reserved on OABI.

* linux/arm/syscallent.h [__ARM_EABI__] (ARM_FIRST_SHUFFLED_SYSCALL):
Raise to 400.
2015-01-12 17:32:16 +00:00
cf7248d004 arm: rewrite shuffle_scno in a bit more readable way
* linux/arm/syscallent.h: Define ARM_FIRST_SHUFFLED_SYSCALL instead of
ARM_LAST_ORDINARY_SYSCALL.
* syscall.c [ARM || AARCH64] (shuffle_scno): Update.
2015-01-12 17:32:09 +00:00
12e2442784 tests: add tests for ipc syscalls decoding
* tests/ipc_msg.c: New file.
* tests/ipc_sem.c: Likewise.
* tests/ipc_shm.c: Likewise.
* tests/ipc_msg.test: New test.
* tests/ipc_sem.test: Likewise.
* tests/ipc_shm.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add ipc_msg, ipc_sem, and ipc_shm.
(TESTS): Add ipc_msg.test, ipc_sem.test, and ipc_shm.test.
* tests/.gitignore: Add ipc_msg, ipc_sem, and ipc_shm.
2015-01-12 16:24:20 +00:00
3b499ca870 Fix indirect ipc subcall handling
indirect_ipccall used to guess whether currently decoded ipc syscall is
an indirect subcall or not based on generic knowledge, while there is a
robust method to identify indirect ipc subcalls.

* defs.h (TRACE_INDIRECT_SUBCALL): New flag.
* ipc.c (indirect_ipccall): Check it.
* linux/subcall.h: Set it.
2015-01-12 14:27:11 +00:00
7c524f420f Move socket and ipc subcall entries to subcall.h
Syscall entries for socket and ipc subcalls are the same on all
architectures, or at least they should be the same, so move them
to the single file.

* linux/subcall.h: Add syscall entries for socket and ipc subcalls.
* linux/arm/syscallent.h: Remove entries for socket and ipc subcalls.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
2015-01-12 14:27:11 +00:00
cf4b7bba6c sh: fix typo introduced by commit v4.9-121-gd535b8b
* linux/sh/syscallent.h (getresgid32): Fix typo in sys_func and sys_name.
2015-01-12 14:24:44 +00:00
1ea64735fc Fix fanotify_mark decoding on 32-bit architectures
The fanotify_mark syscall takes a 64-bit mask, and on 32-bit
architectures it is split up into two syscall arguments.

* configure.ac (AC_CHECK_FUNCS): Add fanotify_mark.
(AC_CHECK_HEADERS): Add sys/fanotify.h.
* defs.h (getllval): New prototype.
* util.c (getllval): New function based on printllval.
(printllval): Use getllval.
* fanotify.c (sys_fanotify_mark): Use getllval to properly decode
64-bit mask and two syscall arguments followed by it.
* tests/fanotify_mark.c: New file.
* tests/fanotify_mark.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add fanotify_mark.
(TESTS): Add fanotify_mark.test.
* tests/.gitignore: Add fanotify_mark.
2015-01-10 00:40:10 +00:00
197db577e8 v4l2: fix build on systems with older kernel headers
* v4l2.c (print_v4l2_format_fmt): Do not use
V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY unless it is defined.
(v4l2_ioctl): Do not use VIDIOC_ENUM_FRAMESIZES and
VIDIOC_ENUM_FRAMEINTERVALS unless they are defined.
2015-01-09 04:53:19 +00:00
08b6397d13 tests: fix build with awk that does not support switch-case
The switch-case statement is a gawk-specific feature which is not
necessarily available, let's use traditional if-else statements instead.

* tests/uid.awk: Rewrite without switch-case statements.
2015-01-09 04:10:54 +00:00
75023a9381 Fix build on systems that lack O_CLOEXEC definition
* xlat/timerfdflags.in [!TFD_CLOEXEC]: Check that O_CLOEXEC is defined.
2015-01-09 03:47:23 +00:00
d9f7e7a439 Fix build on systems that lack NETLINK_SOCK_DIAG definition
NETLINK_INET_DIAG was introduced in linux v2.6.14,
NETLINK_SOCK_DIAG was added much later in linux v3.3.

* net.c [!NETLINK_SOCK_DIAG && NETLINK_INET_DIAG]
(NETLINK_SOCK_DIAG): Define.
* socketutils.c: Likewise.
* tests/netlink_unix_diag.c: Likewise.
2015-01-09 03:05:56 +00:00
75d62047ad Cleanup local copy of linux/fanotify.h
* linux/fanotify.h: Remove macros and structures not used by
fanotify_init and fanotify_mark parsers.
2015-01-09 02:27:57 +00:00
ce21ef02da Fix "make dist" regression introduced by commit v4.9-125-g120e5db
* Makefile.am (EXTRA_DIST): Add linux/unix_diag.h.
2015-01-09 02:02:39 +00:00
b653509746 tests: fix build with fresh glibc
* tests/netlink_unix_diag.c: Include <stdint.h>.
2015-01-08 22:29:12 +00:00
e11169a5ba ioctlent.sh: handle linux/aufs_type.h properly
Before this change, ioctlent.sh could not recognize unusual constants
defined by linux/aufs_type.h, resulting to ioctls.h with references to
these constants without appropriate definitions in ioctldefs.h.

* linux/ioctlent.sh: Update the regexp that is used to lookup constants
referenced by generated ioctls.h.
2015-01-08 20:59:44 +00:00
60cb10dd8f tests: fix distcheck
* tests/stat32-v.test: Remove work files if the test is skipped.
2015-01-08 18:46:30 +00:00
d4a9d83235 Fix printing of time_t values set in the distant future
* util.c (sprinttime): Increase buffer size.
* tests/stat64-v.test: Try to set modification time of the sample file
to a value set in the distant future.
2015-01-08 15:34:43 +00:00
9e6a7bf202 Use AC_CHECK_TYPES to check for struct statfs64
* m4/statfs.m4: Remove.
* configure.ac (AC_STATFS64): Remove.
(AC_CHECK_TYPES): Add struct statfs64.
* statfs.c: Replace HAVE_STATFS64 with HAVE_STRUCT_STATFS64.
2015-01-08 04:12:29 +00:00
7b9bc44e63 Use AC_CHECK_TYPES to check for struct stat64
* m4/stat.m4: Remove.
* configure.ac (AC_STAT64): Remove.
(AC_CHECK_TYPES): Add struct stat64.
* file.c: Replace HAVE_STAT64 with HAVE_STRUCT_STAT64.
2015-01-08 04:06:06 +00:00
f19836be02 file.c: fix 32-bit stat decoding on 64-bit architectures
* file.c [SPARC || SPARC64] (struct stat): Remove, use generic
definition from <asm/stat.h>.
[SPARC64] (struct stat_sparc64, printstat_sparc64): Remove.
[AARCH64 || X86_64 || X32 || POWERPC64 || SPARC64] (struct stat32,
STAT32_PERSONALITY): Define.
[STAT32_PERSONALITY] (struct stat_powerpc32): Rename to struct stat32.
[STAT32_PERSONALITY] (printstat_powerpc32): Rename to printstat32.
(printstat) [STAT32_PERSONALITY]: Call printstat32 when
current_personality == STAT32_PERSONALITY.
[HAVE_STAT64] (printstat64) [STAT32_PERSONALITY]: Call printstat when
current_personality != STAT32_PERSONALITY.
[!HAVE_STAT64] (sys_stat64): Fallback to sys_stat.
[!HAVE_STAT64] (sys_fstat64): Fallback to sys_fstat.
2015-01-08 03:34:04 +00:00
e6e475c60e sparc: reuse struct stat parser code for struct solstat decoding
* printstat.h: Parametrize major() and minor().
* file.c [SPARC || SPARC64]: Define do_printstat_sol by instantiating
printstat.h template.
[SPARC || SPARC64] (printstatsol): Use do_printstat_sol.
2015-01-08 03:17:53 +00:00
721de7887a ppc64: reuse struct stat parser code for struct stat_powerpc32 decoding
* file.c [POWERPC64]: Define do_printstat32 by instantiating printstat.h
template.
[POWERPC64] (printstat_powerpc32): Use do_printstat32.
2015-01-08 03:17:28 +00:00
c6ee0ecb5a file.c: group related parsers together
* file.c (sys_stat, sys_fstat): Collect in one place right before
the definition of printstat64.
(sys_stat64, sys_fstat64): Collect in one place right after the
definition of printstat64.
2015-01-08 01:14:53 +00:00
1fb1c13910 file.c: collect scattered __old_kernel_stat related code
* file.c [HAVE_STRUCT___OLD_KERNEL_STAT] (convertoldstat, printoldstat,
sys_oldstat, sys_oldfstat): Collect functions in one place.
2015-01-08 01:14:53 +00:00
b8ad393cec Use the same source code for struct stat/stat64 decoding
* file.c: Define do_printstat64 by instantiating printstat.h template.
(printstat64): Use do_printstat64.
2015-01-08 01:14:53 +00:00
553d8a2ae6 x32: use generic printstat/printstat64 parsers
* file.c (printstat) [X32]: Define.
(printstat64) [X32]: Use "struct stat64" instead of "struct stat".
Use printstat for x32 personality processes.
(printstat64_x32): Remove.
(sys_stat64, sys_fstat64) [X32]: Use printstat64 instead of
printstat64_x32.
2015-01-08 01:14:53 +00:00
8d411080ed x32: remove redundant definitions
* file.c [X32]: Do not define "struct stat" and "struct
__old_kernel_stat" locally, use definitions provided by <asm/stat.h>.
Do not define "struct stat64" exclusively, reuse another definition
added earlier for X86_64.
2015-01-08 01:14:53 +00:00
ab21a9489f Convert do_printstat to a template function
* printstat.h: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Include "printstat.h".
(do_printstat): Move to printstat.h, parametrize its name
and struct stat.
2015-01-08 01:14:53 +00:00
d01f0a85bc file.c: prepare realprintstat for parametrization
* file.c (realprintstat): Adjust format strings so that all 64-bit
integer fields are printed with %llu format, and %u format is used for
all the rest.  Rename to do_printstat.
(printstat, printoldstat): Update callers.
2015-01-08 01:14:53 +00:00
655633e6f9 tests: cleanup stat.test
* tests/stat.test: Rewrite in a more readable way.
2015-01-08 00:59:44 +00:00
7b01014080 tests: check verbose decoding of 32-bit and 64-bit struct stat
* tests/stat.c: New file.
* tests/stat32.c: Likewise.
* tests/stat32-v.test: New file.
* tests/stat64-v.test: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add stat and stat32.
(stat_CFLAGS): Define.
(TESTS): Add stat32-v.test and stat64-v.test.
* tests/.gitignore: Add stat and stat32.
2015-01-08 00:59:42 +00:00
2928afe3b4 Cleanup struct stat.st_flags decoding
There are no symbolic constants defined for struct stat.st_flags,
so decode this rare field as unsigned int.

* xlat/fileflags.in: Remove.
* file.c (realprintstat, printstat64) [HAVE_STRUCT_STAT_ST_FLAGS]:
Decode struct stat.st_flags as unsigned int.
2015-01-07 22:05:38 +00:00
65ea0d0647 Drop struct stat.st_aclcnt and stat.st_level support
Remove the code that supports struct stat.st_aclcnt and stat.st_level
decoding -- these fields are not defined in system headers.

* configure.ac (AC_CHECK_MEMBERS): Remove struct stat.st_aclcnt and
struct stat.st_level.
* file.c (realprintstat, printstat64)
[HAVE_STRUCT_STAT_ST_ACLCNT || HAVE_STRUCT_STAT_ST_LEVEL]: Remove.
2015-01-07 22:05:38 +00:00
c9cc4cbc50 tests: fix race condition in net-accept-connect based tests
Change all net-accept-connect based tests to use different unix domain
socket addresses, so that these tests could be safely run in parallel.

* tests/net-accept-connect.c: Parametrize unix domain socket address.
* tests/net-fd.test: Pass socket address to net-accept-connect.
* tests/net.test: Likewise.
* tests/unix-yy.test: Likewise.
* tests/unix-yy-accept.awk: Update regexps.
* tests/unix-yy-connect.awk: Likewise.
2015-01-07 22:05:38 +00:00
f1639d8f51 timerfd: update flags decoding
The current code only decodes TFD_TIMER_ABSTIME when the kernel has
a bunch of newer flags.  We have to handle fallbacks for all of them
since the kernel doesn't currently export things to userspace.

* time.c: Include fcntl.h for O_* defines.
(TFD_TIMER_ABSTIME): Move to xlat/timerfdflags.in.
* xlat/timerfdflags.in: Add more definitions.
2014-12-31 00:27:57 +00:00
e00a9571d4 sparc: fix fxstat decoding
* file.c [SPARC || SPARC64] (sys_fxstat): Print file descriptor
using printfd.
2014-12-29 03:18:36 +00:00
e6219fbdb1 sparc: drop _STAT64_VER support
Starting with commit v4.6-240-g5afdf12, nobody compiles this
non-Linux code.

* file.c [SPARC || SPARC64] (sys_xstat, sys_fxstat): Remove
_STAT64_VER code.
2014-12-29 03:08:53 +00:00
55ba9b30f0 sparc: remove redundant sys_lxstat
* file.c [SPARC || SPARC64] (sys_lxstat): Remove.
* linux/sparc/dummy2.h (solaris_lxstat): Alias to sys_xstat.
* linux/sparc64/dummy2.h (solaris_lxstat): Likewise.
2014-12-29 03:04:11 +00:00
ea77892aaa file.c: do not include unused headers
* file.c: Do not include <fcntl.h>.
2014-12-28 15:24:21 +00:00
ee21a5ba35 Cleanup UTIME_NOW/UTIME_OMIT decoding
Move the code that's present in two copies from sprinttv()
to a new helper function.

* time.c (do_sprinttv): New function.
(sprinttv): Use it.
2014-12-27 00:39:21 +00:00
6d5abd33ed Fix UTIME_NOW/UTIME_OMIT decoding
The kernel doesn't actually care what tv_sec is set to --- it only checks
tv_nsec when looking for the special values.
2014-12-27 00:39:20 +00:00
959205c2a8 Make -yy output for inet sockets consistent with unix domain sockets
Prepend -yy output generated for INET/INET6 TCP/UDP sockets with their
protocol name obtained using getxattr.

* socketutils.c (inet_parse_response): Add proto_name argument.
Print proto_name for connected and unconnected sockets.
(receive_responses): Add proto_name argument, pass it to the parser.
(inet_print): Add proto_name argument, pass it to receive_responses.
(unix_parse_response): Add proto_name argument.
(print_sockaddr_by_inode): Pass protocol name to inet_print calls.
* tests/net-yy-accept.awk: Update to match new output format.
* tests/net-yy-connect.awk: Likewise.
2014-12-26 23:29:26 +00:00
f0ed167ecc tests: robustify unix domain socket decoding test
Unix domain socket address family name is not universally decoded as
AF_LOCAL, other names like AF_UNIX and AF_FILE are valid synonyms.
Similarly, PF_UNIX and PF_FILE are valid synonyms for PF_LOCAL.

Some test regexps have to be properly initialized before they could
be used, so make sure they are initialized before use.
2014-12-25 01:13:33 +00:00
6b5df32955 tests: fix unix domain socket decoding availability test
Since inet_diag and unix_diag interfaces are implemented by different
kernel modules, they have to be tested separately.

* tests/netlink_unix_diag.c: New file.
* tests/unix-yy.test: Use it.
* tests/Makefile.am (check_PROGRAMS): Add it.
* tests/.gitignore: Likewise.
2014-12-25 01:01:13 +00:00
6077ad8cc6 tests: add a test for decoding unix domain socket addresses
* tests/unix-yy-accept.awk: New file.
* tests/unix-yy-connect.awk: New file.
* tests/unix-yy.test: New test.
* tests/Makefile.am (TESTS): Add it.
(EXTRA_DIST): Add unix-yy-accept.awk and unix-yy-connect.awk.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-12-25 01:01:11 +00:00
120e5dbcac Support unix domain sockets in -yy option
This change extends -yy option to handle unix domain sockets:
their peer addresses will be printed, similar to inet sockets.

For a listening socket, its socket inode and socket path are printed.
For an accepted socket, its socket inode, the peer inode, and the
socket path are printed.
For a client socket, its socket inode and the peer inode are printed.

An example of a server side communication using netcat:

	$ ./strace -yy -e network nc -l -U /tmp/example.sock
	socket(PF_LOCAL, SOCK_STREAM, 0)        = 3
	setsockopt(3<UNIX:[14728348]>, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
	bind(3<UNIX:[14728348]>, {sa_family=AF_LOCAL, sun_path="/tmp/example.sock"}, 19) = 0
	listen(3<UNIX:[14728348,"/tmp/example.sock"]>, 10) = 0
	accept(3<UNIX:[14728348,"/tmp/example.sock"]>, {sa_family=AF_LOCAL, NULL}, [2]) = 4<UNIX:[14727246->14727245,"/tmp/example.sock"]>
	recvfrom(4<UNIX:[14727246->14727245,"/tmp/example.sock"]>, "INPUT\n", 8192, 0, NULL, NULL) = 6
	INPUT

An example of a client side communication using netcat:

	$ ./strace -yy -e network nc -U /tmp/example.sock
	socket(PF_LOCAL, SOCK_STREAM, 0)        = 3
	connect(3<UNIX:[14727245]>, {sa_family=AF_LOCAL, sun_path="/tmp/example.sock"}, 19) = 0
	getsockopt(3<UNIX:[14727245]>, SOL_SOCKET, SO_ERROR, [0], [4]) = 0
	INPUT
	...
	sendto(3<UNIX:[14727245->14727246]>, "INPUT\n", 6, 0, NULL, 0) = 6

* linux/unix_diag.h: New file.
* socketutils.c (send_query): Rename to inet_send_query.
(parse_response): Rename to inet_parse_response.
(unix_print, unix_send_query, unix_parse_response): New functions.
(receive_responses): Add a new argument named parser: a function for
handling protocol specific data parts of diag messages.
(print_sockaddr_by_inode): Call unix_print.
Replace NETLINK_INET_DIAG with NETLINK_SOCK_DIAG, they are equal
but NETLINK_SOCK_DIAG looks more generic.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-12-25 01:00:48 +00:00
f605e92365 Use the protocol name of a socket as a hint for peer address resolution
To resolve the peer address of socket, all combinations of families
(AF_INET, AF_INET6) and protocols(IPPROTO_TCP, IPPROTO_UDP) were tried.
This change utilizes the protocol name obtained via getxattr to specify
the right combination.

* socketutils.c (inet_print): New helper function.
(print_sockaddr_by_inode): Use it.  Utilize the protocol name
associated with the given inode for resolving the peer socket
address.  If the protocol name is NULL, resolve the address
by trying combinations of families and protocols as before.
* defs.h (print_sockaddr_by_inode): Update prototype.
* util.c (printfd): Pass the protocol name associated with
the given path to print_sockaddr_by_inode as the 2nd argument.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-12-16 04:08:20 +00:00
530bed0ca8 Fix decoding of getgroups, getgroups32, setgroups, and setgroups32 syscalls
Convert parsers of these syscalls to the same scheme as were applied to
parsers of other uid/gid related syscalls.
That is, define two sets of parsers on architectures that support
(either directly or via multiarch) 16-bit and 32-bit gid getgroups
and setgroups syscalls simultaneously, and reuse essentially the same
code by parametrizing uid_t and names of parser functions.

* groups.c: Remove.
(sys_getgroups, sys_setgroups): Move ...
* uid.c: ... here and parametrize their names.
* Makefile.am (strace_SOURCES): Remove groups.c.
* linux/syscall.h (sys_getgroups32, sys_setgroups32): Remove.
[NEED_UID16_PARSERS] (sys_getgroups16, sys_setgroups16): New prototypes.
* linux/arm/syscallent.h: Rename sys_[gs]etgroups to sys_[gs]etgroups16,
rename sys_[gs]etgroups32 to sys_[gs]etgroups.
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* tests/uid.c: Test for getgroups.
* tests/uid16.c: Likewise.
* tests/uid32.c: Test for getgroups32.
* tests/uid.awk: Test for getgroups/getgroups32 decoding.
* tests/uid.test: Trace getgroups/getgroups32 syscalls.
2014-12-16 01:09:23 +00:00
80f7db1fed Fix decoding of 16-bit *chown and [gs]et*[gu]id syscalls
Define two sets of parsers on architectures that support (either
directly or via multiarch) 16-bit and 32-bit uid/gid syscalls
simultaneously.  Since the code in these two sets is essentially
the same and the key difference between them is the size of uid_t,
implement it by parametrizing uid_t and names of parser functions.

* defs.h (NEED_UID16_PARSERS): New macro.
* linux/syscall.h [NEED_UID16_PARSERS] (sys_chown16, sys_fchown16,
sys_getresuid16, sys_getuid16, sys_setfsuid16, sys_setresuid16,
sys_setreuid16, sys_setuid16): New prototypes.
* linux/dummy.h (sys_geteuid16): Alias to sys_getuid16.
(sys_getegid16, sys_getgid16, sys_getresgid16, sys_setfsgid16,
sys_setgid16, sys_setregid16, sys_setresgid16): Alias to corresponding
sys_*uid16 functions.
* uid.c: Stop including <asm/posix_types.h>.
Parametrize uid_t and names of all exported functions.
(get_print_uid): New function.
(sys_getresuid): Use it.
(printuid): Check for (uid_t) -1.
* uid16.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* linux/arm/syscallent.h: Use sys_chown16, sys_fchown16, sys_getegid16,
sys_geteuid16, sys_getgid16, sys_getresgid16, sys_getresuid16,
sys_getuid16, sys_setfsgid16, sys_setfsuid16, sys_setgid16,
sys_setregid16, sys_setresgid16, sys_setresuid16, sys_setreuid16,
and sys_setuid16 parsers for *chown and [gs]et*[gu]id syscall entries.
* linux/bfin/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* tests/uid16.c: New file.
* tests/uid16.test: New test.
* tests/Makefile.am (CHECK_PROGRAMS): Add uid16.
(TESTS): Add uid16.test.
* tests/.gitignore: Add uid16.
2014-12-16 01:07:12 +00:00
d535b8bd51 sh, sh64: fix uid/gid syscall entries
* linux/sh/syscallent.h: Replace printargs with real syscall
parsers in *chown32 and [gs]et*[gu]id32 syscall entries.
* linux/sh64/syscallent.h: Likewise.
2014-12-16 00:58:37 +00:00
641bb428dd s390: fix uid/gid syscall entries
* linux/s390/syscallent.h: Add "32" suffix to names of *chown32
and [gs]et*[gu]id32 syscalls #198..216.
2014-12-16 00:58:22 +00:00
37b20b3fd4 sparc: fix uid/gid syscall entries
* linux/sparc/syscallent.h: Add "32" suffix to names
of [gs]etres[gu]id32 syscalls #108..112.
Fix entry for syscall #112 from setresgid32 to setregid32.
2014-12-16 00:44:40 +00:00
2f7d020e22 chown.c: split into separate files
This will make further uid/gid fixes simpler.

* fchownat.c: New file.
* chown.c (sys_fchownat: Move to fchownat.c.
(sys_chown, sys_fchown): Move to uid.c.
* Makefile.am (strace_SOURCES): Remove chown.c, add fchownat.c.
2014-12-15 23:54:37 +00:00
25ebe46ce2 util.c: move printuid to uid.c
This will make further uid/gid fixes simpler.

* util.c (printuid): Move
* uid.c: ... here.
2014-12-15 23:54:37 +00:00
c55bfb0045 tests/uid.awk: rewrite in a more maintainable style
Since the test is virtually a FSM, rewrite it as a FSM.
2014-12-15 23:50:14 +00:00
1da7c95b62 printuid: fix uid_t decoding on 64-bit architectures
It was not a good idea to treat uid_t as a long int type because
the latter is twice larger than uid_t on 64-bit architectures.

* defs.h (printuid): Change uid argument type from "unsigned long"
to "unsigned int".
* util.c (printuid): Likewise.  When uid equals to -1, print "-1".
* tests/uid.awk: New file.
* tests/uid.c: New file.
* tests/uid32.c: Likewise.
* tests/uid.test: New test.
* tests/uid32.test: Likewise.
* tests/Makefile.am (CHECK_PROGRAMS): Add uid and uid32.
(TESTS): Add uid.test and uid32.test.
(EXTRA_DIST): Add uid.awk.
* tests/.gitignore: Add uid and uid32.
2014-12-14 03:54:04 +00:00
79fb4d6a9a Update PTRACE_* constants
* xlat/ptrace_cmds.in: Add PTRACE_PEEKSIGINFO, PTRACE_GETSIGMASK,
and PTRACE_SETSIGMASK.
2014-12-13 01:56:56 +00:00
825b524c8c Update SWAP_FLAG_* constants
* swapon.c: Ensure that SWAP_FLAG_DISCARD_ONCE and
SWAP_FLAG_DISCARD_PAGES are defined.
* xlat/swap_flags.in: Add SWAP_FLAG_DISCARD_ONCE and
SWAP_FLAG_DISCARD_PAGES.
2014-12-13 01:34:47 +00:00
719554d5eb Update SCHED_* constants
* xlat/schedulers.in: Add SCHED_BATCH, SCHED_ISO, SCHED_IDLE, and
SCHED_DEADLINE.
2014-12-11 23:33:02 +00:00
4bcce0ae6f Update prctl PR_* constants
* xlat/prctl_options.in: Add PR_SET_THP_DISABLE, PR_GET_THP_DISABLE,
PR_MPX_ENABLE_MANAGEMENT, and PR_MPX_DISABLE_MANAGEMENT.
2014-12-11 23:33:01 +00:00
8224758b33 Always compile sys_prctl parser
Since sys_prctl is referenced by syscallent files unconditionally,
conditional compilation of sys_prctl depending on prctl availability is
pointless.

* prctl.c (unalignctl_string, sys_prctl): Compile unconditionally.
2014-12-11 23:32:59 +00:00
fced7b0930 process.c: split struct_user_offsets into architecture-specific include files
* Makefile.am (EXTRA_DIST): Add linux/alpha/userent.h,
linux/arm/userent.h, linux/avr32/userent.h, linux/bfin/userent.h,
linux/crisv10/userent.h, linux/crisv32/userent.h,
linux/i386/userent.h, linux/i386/userent0.h, linux/ia64/userent.h,
linux/m68k/userent.h, linux/microblaze/userent.h,
linux/mips/userent.h, linux/or1k/userent.h, linux/powerpc/userent.h,
linux/s390/userent.h, linux/s390/userent0.h, linux/s390/userent1.h,
linux/s390x/userent.h, linux/sh/userent.h, linux/sh/userent0.h,
linux/sh64/userent.h, linux/sparc/userent.h, linux/sparc64/userent.h,
linux/tile/userent.h, linux/userent.h, linux/userent0.h,
linux/x32/userent.h, linux/x86_64/userent.h, and
linux/xtensa/userent.h.
* process.c (struct_user_offsets): Split into architecture-specific
include files, inculde userent.h.
2014-12-11 19:25:02 +00:00
6eee4e044c process.c: include less headers
* process.c: Do not include <fcntl.h> and <sys/stat.h>.
Reorder inclusion of xlat header files.
2014-12-11 19:25:02 +00:00
8c0ef9468c Unexport struct_user_offsets
* defs.h (struct_user_offsets): Remove.
* process.c (struct_user_offsets): Make static.
2014-12-11 19:25:02 +00:00
c6ce4fdafc process.c: introduce XLAT_UOFF macro
Introduce XLAT_UOFF macro and use it to automatically transform
struct_user_offsets array into a more readable and compact form.

for n in $(sed -n 's/^[[:space:]]*{[[:space:]]*uoff(\([a-z_0-9]\+\)),.*/\1/p' process.c |sort -u); do
	sed -i 's/^\([[:space:]]*\){[[:space:]]*uoff('"$n"'),[[:space:]]*"offsetof(struct user,[[:space:]]*'"$n"')"[[:space:]]*},$/\1XLAT_UOFF('"$n"'),/' process.c
done

* process.c (XLAT_UOFF): New macro.
(struct_user_offsets): Use it.
2014-12-11 19:25:02 +00:00
03c06ea592 process.c: move sethostname and gethostname parsers to a separate file
* hostname.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_sethostname, sys_gethostname): Move to hostname.c.
2014-12-11 22:52:03 +00:00
9175909acc process.c: move exit parser to a separate file
* exit.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_exit): Move to exit.c.
2014-12-11 22:52:03 +00:00
265903a416 process.c: move clone, setns, unshare, and fork parsers to a separate file
* clone.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c: Move sys_clone, sys_setns, sys_unshare, sys_fork, and
related code to clone.c.
2014-12-11 22:52:03 +00:00
e93ef1eb9d process.c: move get*uid and set*uid parsers to a separate file
* uid.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_getuid, sys_setfsuid, sys_setuid, sys_getresuid,
sys_setreuid, sys_setresuid): Move to uid.c.
2014-12-11 22:52:03 +00:00
7211480fee process.c: move getgroups* and setgroups* parsers to a separate file
* groups.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c: Move sys_setgroups, sys_getgroups, sys_setgroups32,
sys_getgroups32, and related code to groups.c.
2014-12-11 22:52:03 +00:00
7be2318ad2 process.c: move execve and execv parsers to a separate file
* execve.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c: Move sys_execve, sys_execv, and related code to execve.c.
2014-12-11 22:52:03 +00:00
7ccc144fdd process.c: move waitpid, wait4, osf_wait4, and waitid parsers to a separate file
* wait.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c: Move sys_waitpid, sys_wait4, sys_osf_wait4, sys_waitid and
related code to wait.c.
2014-12-11 22:51:45 +00:00
58dd2cf352 process.c: move uname parser to a separate file
* uname.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_uname): Move to uname.c.
2014-12-11 22:04:01 +00:00
e314f808bf process.c: move futex parser to a separate file
* futex.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c: Move sys_futex and related code to futex.c.
2014-12-11 19:25:02 +00:00
8357638568 process.c: move get_robust_list parser to a separate file
* get_robust_list.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_get_robust_list): Move to get_robust_list.c.
2014-12-11 19:25:02 +00:00
fff2f319f9 process.c: move sched_* parsers to a separate file
* sched.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c: Move sys_sched_getscheduler, sys_sched_setscheduler,
sys_sched_getparam, sys_sched_setparam, sys_sched_get_priority_min,
sys_sched_rr_get_interval, and related code to sched.c.
2014-12-11 21:44:56 +00:00
b94b9834fd process.c: move sched_setaffinity and sched_getaffinity parsers to a separate file
* affinity.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_sched_setaffinity, sys_sched_getaffinity): Move
to affinity.c.
2014-12-11 19:25:02 +00:00
53c993d9c1 process.c: move prctl and arch_prctl parsers to a separate file
* prctl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c: Move sys_prctl, sys_arch_prctl, and related code to prctl.c.
2014-12-11 21:40:44 +00:00
665f10c9a4 process.c: move getcpu parser to a separate file
* getcpu.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_getcpu): Move to getcpu.c.
2014-12-11 21:40:40 +00:00
db16c52668 process.c: move process_vm_readv and process_vm_writev parsers to a separate file
* process_vm.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* process.c (sys_process_vm_readv, sys_process_vm_writev): Move
to process_vm.c.
2014-12-11 21:40:23 +00:00
52572b6fdd Implement decoding of fallocate FALLOC_FL_* flags
* xlat/falloc_flags.in: New file.
* configure.ac (AC_CHECK_HEADERS): Add linux/falloc.h.
* fallocate.c [HAVE_LINUX_FALLOC_H]: Include <linux/falloc.h>.
Include xlat/falloc_flags.h.
(sys_fallocate): Decode flags.
2014-12-11 21:40:23 +00:00
19b50da101 Fix decoding of renameat2 RENAME_* flags
* renameat.c: Include <linux/fs.h> where RENAME_NOREPLACE,
RENAME_EXCHANGE, and RENAME_WHITEOUT are usually defined.
2014-12-11 21:40:23 +00:00
964d80a0f7 file.c: move open, openat, and creat parsers to a separate file
* open.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_open, sys_openat, sys_creat, and related code
to open.c.
2014-12-11 21:40:20 +00:00
304cd81e46 file.c: move access and faccessat parsers to a separate file
* access.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_access, sys_faccessat and related code to access.c.
2014-12-11 21:40:17 +00:00
d590f3cdd8 file.c: move umask parser to a separate file
* umask.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_umask): Move to umask.c.
2014-12-11 21:40:15 +00:00
b5d25ec2f9 file.c: move lseek and llseek parsers to a separate file
* lseek.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_lseek, sys_llseek, and related code to lseek.c.
2014-12-11 21:40:11 +00:00
9e9ceab3b1 file.c: move readahead parser to a separate file
* readahead.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_readahead): Move to readahead.c.
2014-12-11 21:40:08 +00:00
6934182f16 file.c: move truncate, truncate64, ftruncate, and ftruncate64 parsers to a separate file
* truncate.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_truncate, sys_truncate64, sys_ftruncate, sys_ftruncate64):
Move to truncate.c.
2014-12-11 21:40:04 +00:00
9b2f674adb file.c: move chdir parser to a separate file
* chdir.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_chdir): Move to chdir.c.
2014-12-11 21:39:59 +00:00
231b19fca0 file.c: move link, linkat, unlinkat, and symlinkat parsers to a separate file
* link.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_link, sys_linkat, sys_unlinkat, sys_symlinkat, and
related code to link.c.
2014-12-11 21:39:44 +00:00
46245b3541 file.c: move readlink and readlinkat parsers to a separate file
* readlink.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (decode_readlink, sys_readlink, sys_readlinkat): Move
to readlink.c.
2014-12-11 21:39:35 +00:00
6d20a0b9a3 file.c: move renameat and renameat2 parsers to a separate file
* renameat.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_renameat, sys_renameat2, and related code
to renameat.c.
2014-12-11 21:39:30 +00:00
2b7a53bff5 file.c: move chown, fchown, and fchownat parsers to a separate file
* chown.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_chown, sys_fchownat, sys_fchown): Move to chown.c.
2014-12-11 21:39:28 +00:00
43b110b7d1 Export at_flags
* defs.h (at_flags): New prototype.
2014-12-11 21:39:27 +00:00
ad5cf1e5ae file.c: move chmod, fchmod, and fchmodat parsers to a separate file
* chmod.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_chmod, sys_fchmodat, sys_fchmod): Move to chmod.c.
2014-12-11 21:39:25 +00:00
481e067836 file.c: move utimes, futimesat, utimensat, and osf_utimes parsers to a separate file
* utimes.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (decode_utimes, sys_utimes, sys_futimesat, sys_utimensat,
sys_osf_utimes): Move to utimes.c.
2014-12-11 21:39:21 +00:00
fb470f350e file.c: move utime parser to a separate file
* utime.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_utime): Move to utime.c.
2014-12-11 21:39:16 +00:00
b1a01b8d42 Export sprinttime
* defs.h (sprinttime): New prototype.
* file.c (sprinttime): Make global and move to util.c.
2014-12-11 21:39:16 +00:00
db23b3414c file.c: move mknod, mknodat, and xmknod parsers to a separate file
* mknod.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_mknod, sys_mknodat, sys_xmknod, and related code
to mknod.c.
2014-12-11 21:39:12 +00:00
9514ac73c7 file.c: export sprintmode and move it to a separate file
* printmode.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* defs.h (sprintmode): New prototype.
* file.c (sprintmode): Make global and move to printmode.c.
2014-12-11 21:39:02 +00:00
a836430dbb file.c: move getcwd parser to a separate file
* getcwd.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_getcwd): Move to getcwd.c.
2014-12-11 21:38:59 +00:00
769ffe9797 file.c: move *xattr parsers to a separate file
* xattr.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_setxattr, sys_fsetxattr, sys_getxattr, sys_fgetxattr,
sys_listxattr, sys_flistxattr, sys_removexattr, sys_fremovexattr,
and related code to xattr.c.
2014-12-11 21:38:51 +00:00
63f28dd197 file.c: move fadvise64 and fadvise64_64 parsers to a separate file
* fadvise.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_fadvise64, sys_fadvise64_64, and related code
to fadvise.c.
2014-12-11 21:38:43 +00:00
710b3ae4a2 file.c: move sync_file_range and sync_file_range2 parsers to a separate file
* sync_file_range.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_sync_file_range, sys_sync_file_range2, and related
code to sync_file_range.c.
2014-12-11 21:38:32 +00:00
2795a5f7ac file.c: move fallocate parser to a separate file
* fallocate.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sys_fallocate): Move to fallocate.c.
2014-12-11 21:38:25 +00:00
85a364a4ac file.c: move swapon parser to a separate file
* swapon.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c: Move sys_swapon and related code to swapon.c.
2014-12-11 21:37:52 +00:00
4b9c68b9a3 Implement full decoding of 64-bit capabilities
Unlike v1 capabilities which are 32-bit, v2 and v3 are 64-bit, but
before this change only lower 32 capability bits were decoded for
v2 and v3.

* xlat/capabilities1.in: New file.
* capability.c: Define v2/v3 CAP_* constants.
Include xlat/capabilities1.h.
(get_cap_header): New function.
(print_cap_header): Update to use get_cap_header result.
(print_cap_data): Decoder higher capability bits for v2 and v3.
(sys_capget, sys_capset): Use get_cap_header, update print_cap_header
and print_cap_data calls.
* tests/caps.c: New file.
* tests/caps.awk: New file.
* tests/caps.test: New test.
* tests/Makefile.am (CHECK_PROGRAMS): Add caps.
(TESTS): Add caps.test.
(EXTRA_DIST): Add caps.awk.
2014-12-06 03:53:12 +00:00
bf7fdfa96e Make parsers of capget and capset syscalls self-contained
Various versions of <linux/capability.h> used to require different
workarounds to avoid conflicts with types defined by libc headers.
Define all required types and constants locally to fix this issue.

* configure.ac (AC_CHECK_HEADERS): Remove linux/capability.h.
* capability.c: Do not include <linux/capability.h>, remove workarounds
for problematic versions of <linux/capability.h> file.
Define CAP_* and _LINUX_CAPABILITY_VERSION_* constants as enums.
(struct __user_cap_header_struct, struct __user_cap_data_struct): Define.
* xlat/cap_version.in: Add #unconditional.
* xlat/capabilities.in: Likewise.
2014-12-06 03:41:39 +00:00
83034c9de7 Remove system.c
All disjoint parts of system.c have been moved to separate files.

* system.c: Remove.
* Makefile.am (strace_SOURCES): Remove it.
2014-12-04 02:23:40 +00:00
6da7ca378d Move mount parser to a separate file
* mount.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move sys_mount and related code to mount.c.
2014-12-04 02:23:40 +00:00
542ca1ef3d Move umount2 parser to a separate file
* umount.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move sys_umount2 and related code to umount.c.
2014-12-04 02:23:40 +00:00
d28b6a0264 Move personality parser to a separate file
* personality.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move sys_personality and related code to personality.c.
2014-12-04 02:23:40 +00:00
b21e2fb059 Move syslog parser to a separate file
* syslog.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move sys_syslog and related code to syslog.c.
2014-12-04 02:23:40 +00:00
95edb8bb71 Move cacheflush parser to a separate file
* cacheflush.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move inclusion of <asm/cachectl.h> to cacheflush.c.
[M68K, BFIN, SH]: Move to cacheflush.c.
2014-12-04 02:23:34 +00:00
e36c72cbed bfin: move sram_alloc parser to a separate file
* sram_alloc.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c [BFIN]: Move sys_sram_alloc and related code to sram_alloc.c.
2014-12-04 02:22:38 +00:00
5e7987b4a8 Move capget and capset parsers to a separate file
* capability.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move inclusion of headers and macro definitions related
to capget and capset decoding to capability.c.
(print_cap_header, print_cap_data, sys_capget, sys_capset): Move
to capability.c.
2014-12-04 02:21:41 +00:00
172241be48 Move sysctl parser to a separate file
* sysctl.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Move sys_sysctl and related code to sysctl.c.
2014-12-03 21:21:04 +00:00
600e33cd45 mips: move sysmips parser to a separate file
* sysmips.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c: Fix typo in the check for <linux/utsname.h>.
Move inclusions of <linux/utsname.h> and <asm/sysmips.h> to sysmips.c.
[MIPS]: Likewise.
2014-12-03 21:20:47 +00:00
f6eb0d6b27 or1k: move or1k_atomic parser to a separate file
* or1k_atomic.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* system.c [OR1K]: Move to or1k_atomic.c.
2014-12-03 21:20:37 +00:00
907df1e157 Alias sys_setdomainname to sys_sethostname
Since parsers for setdomainname and sethostname syscalls are identical,
replace sys_setdomainname with an alias to sys_sethostname.

* linux/dummy.h (sys_setdomainname): Alias to sys_sethostname.
* linux/syscall.h (sys_setdomainname): Remove.
* process.c (sys_setdomainname): Remove.
2014-12-02 21:42:34 +00:00
37548c4afc Alias sys_getpeername to sys_getsockname
Since parsers for getpeername and getsockname syscalls are identical,
replace sys_getpeername with an alias to sys_getsockname.

* linux/dummy.h (sys_getpeername): Alias to sys_getsockname.
* linux/syscall.h (sys_getpeername): Remove.
* net.c (sys_getpeername): Remove.
2014-12-02 21:36:04 +00:00
8238590c1d Alias sys_stime to sys_time
Since parsers for stime and time syscalls are identical,
replace sys_stime with an alias to sys_time.

* linux/dummy.h (sys_stime): Alias to sys_time.
* linux/syscall.h (sys_stime): Remove.
* time.c (sys_stime): Remove.
2014-12-02 20:47:30 +00:00
6b82ba5b7f Remove unused sys_mctl
Starting with commit v4.6-240-g5afdf12, nobody compiles this
non-Linux code.

* mem.c [MC_SYNC]: Remove.
* xlat/mctl_funcs.in: Remove.
* xlat/mctl_lockas.in: Remove.
2014-12-02 20:39:13 +00:00
6355a1f867 Alias sys_mkdir and sys_mkdirat to sys_chmod and sys_fchmodat
Special parsers for mkdir and mkdirat are redundant because
sys_chmod and sys_fchmodat implement the same decoding.

* file.c (decode_mkdir, sys_mkdir, sys_mkdirat): Remove.
* linux/dummy.h (sys_mkdir): Alias to sys_chmod.
(sys_mkdirat): Alias to sys_fchmodat.
* linux/syscall.h (sys_mkdir, sys_mkdirat): Remove.
* pathtrace.c (pathtrace_match): Do not check for sys_mkdirat.
2014-12-01 19:52:26 +00:00
681452b0f8 Remove unused <sys/acl.h> based code
Starting with commit v4.6-240-g5afdf12, nobody compiles this
non-Linux code.

* configure.ac (AC_CHECK_HEADERS): Remove sys/acl.h.
* file.c [HAVE_SYS_ACL_H]: Remove.
* xlat/aclcmds.in: Remove.
2014-12-01 19:45:24 +00:00
c62d49ed0e Remove unused <sys/asynch.h> based code
Starting with commit v4.6-240-g5afdf12, nobody compiles this
non-Linux code.

* configure.ac (AC_CHECK_HEADERS): Remove sys/asynch.h.
* file.c [HAVE_SYS_ASYNCH_H]: Remove.
2014-12-01 19:45:24 +00:00
f548067417 Print protocol name of socket descriptors with -yy option
For those socket descriptors that have no associated ip:port pairs
(or when this information is not available), -yy option prints
the same <socket:[INODE]> information as -y option, e.g.

$ strace -e sendto -yy ip l > /dev/null
sendto(3<socket:[23456789]>, ...

This change makes -yy output more informative: instead of just
printing "socket", the name of protocol behind the socket descriptor
will be printed, e.g.

sendto(3<NETLINK:[23456789]>, ...

* configure.ac (AC_CHECK_HEADERS): Add sys/xattr.h.
* tests/net-yy-accept.awk: Update to support protocol names.
* tests/net-yy-connect.awk: Likewise.
* util.c [HAVE_SYS_XATTR_H]: Include <sys/xattr.h>.
(getfdproto): New function.
(printfd): Use it.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-11-27 23:48:02 +00:00
025b3581ae Replace MAXPATHLEN with PATH_MAX
MAXPATHLEN is defined to PATH_MAX, so replace the former with the latter.

* strace.c (startup_child): Replace MAXPATHLEN with PATH_MAX.
* util.c (printpathn, printpath): Likewise.
2014-11-21 22:28:34 +00:00
5b88608b29 Decode FIFREEZE/FITHAW/FITRIM ioctls
The freeze/thaw ones are simple, but the trim is an interesting struct.

* block.c (block_ioctl): Handle FIFREEZE/FITHAW/FITRIM.
* ioctl.c (ioctl_decode): Pass 'X' ioctls to block_ioctl.
2014-11-21 21:41:32 +00:00
b2fa2beedc Include <sys/uio.h> unconditionally
Since <sys/uio.h> is standardized by POSIX and is present in all
available versions of glibc, it's safe to assume that any usable
libc implementation provides this header file.

* configure.ac (AC_CHECK_HEADERS): Remove sys/uio.h.
* io.c: Include <sys/uio.h> unconditionally.
(tprint_iov_upto, tprint_iov, sys_readv, sys_writev,
print_llu_from_low_high_val, sys_preadv, sys_pwritev): Define
unconditionally.
* net.c: Include <sys/uio.h> unconditionally.
* util.c: Include <sys/uio.h> unconditionally.
(dumpiov): Define unconditionally.
2014-11-21 20:46:16 +00:00
af534b8d7a Consistently use C99 designated initializers in the new netlink code
* socketutils.c (send_query, receive_responses): Use designated
initializers for sockaddr_nl, nlmsghdr, and inet_diag_req_v2 structures.
* tests/netlink_inet_diag.c (send_query, check_responses): Likewise.
2014-11-21 19:59:16 +00:00
18901ea0ca Decode open's O_TMPFILE
* xlat/open_mode_flags.in: Add O_TMPFILE definition.
2014-11-20 02:21:57 +00:00
fafc71f622 hppa: update error codes and signal numbers
There are two important changes in here:

1. EWOULDBLOCK has been up to kernel 3.14 errorcode #246. Since hppa
folks had problems with EWOULDBLOCK != EAGAIN, this was changed in
kernel 3.14.

2. Starting with kernel 3.18, hppa folks changed some signal numbers in
such a way that we end up with SIGRTMIN == 32, which brings hppa in sync
with other linux ports.

Both were incompatible changes which basically broke hppa ABI, but since
they have been merged into the kernel, we have to follow.
2014-11-11 15:54:04 +00:00
22deda33c6 stack trace support: fix check on symbol name presence
The output format of the stack trace is supposed to be different
depending on whether symbol names are available in the build.

However, the check only verified the validity of the pointer, not of the
string pointed to (which could be empty).

This commit fixes the check so that the original output:

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x5e000
 > /lib/libc-2.10.1.so(_IO_file_doallocate+0x8c) [0x68a38]
 > /lib/libc-2.10.1.so(_IO_doallocbuf+0x6c) [0x78574]
 > /lib/libc-2.10.1.so(_IO_file_overflow+0x184) [0x7763c]
 > /lib/libc-2.10.1.so(_IO_file_xsputn+0x88) [0x76aac]
 > /lib/libc-2.10.1.so(_IO_puts+0xc8) [0x6b64c]
 > /bin/busybox(+0x0) [0x62c60]
 > /bin/busybox(+0x0) [0x4940]
 > /bin/busybox(+0x0) [0x499c]
 > /bin/busybox(+0x0) [0x4e08]
 > /lib/libc-2.10.1.so(__libc_init_first+0x30c) [0x1f84c]
 > /lib/libc-2.10.1.so(__libc_start_main+0xd8) [0x1f9f8]

becomes:

mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x5e000
 > /lib/libc-2.10.1.so(_IO_file_doallocate+0x8c) [0x68a38]
 > /lib/libc-2.10.1.so(_IO_doallocbuf+0x6c) [0x78574]
 > /lib/libc-2.10.1.so(_IO_file_overflow+0x184) [0x7763c]
 > /lib/libc-2.10.1.so(_IO_file_xsputn+0x88) [0x76aac]
 > /lib/libc-2.10.1.so(_IO_puts+0xc8) [0x6b64c]
 > /bin/busybox() [0x62c60]
 > /bin/busybox() [0x4940]
 > /bin/busybox() [0x499c]
 > /bin/busybox() [0x4e08]
 > /lib/libc-2.10.1.so(__libc_init_first+0x30c) [0x1f84c]
 > /lib/libc-2.10.1.so(__libc_start_main+0xd8) [0x1f9f8]

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Acked-by: Masatake YAMATO <yamato@redhat.com>
2014-11-11 15:48:31 +00:00
993198deb3 tests: add a test for decoding and dumping of recvmmsg/sendmmsg
* configure (AC_CHECK_FUNCS): Add sendmmsg.
* tests/mmsg.c: New file.
* tests/mmsg.expected: New file.
* tests/mmsg.test: New test.
* tests/.gitignore: Add mmsg.
* tests/Makefile.am (CHECK_PROGRAMS): Add mmsg.
(TESTS): Add mmsg.test.
(EXTRA_DIST): Add mmsg.expected.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-11-11 15:45:26 +00:00
a807dceca5 Add functions for dumping iovecs in mmsghdr used in sendmmsg and recvmmsg
This patch is similar to what I did in commit
02f9f6b386.
That commit was for sendmsg and recvmsg system calls.
This one is for sendmmsg and recvmmsg system calls.

* defs.h (dumpiov_in_mmsghdr): New declaration.
* net.c (extractmmsghdr): New function derived from printmmsghdr.
(printmmsghdr): Use it.
(dumpiov_in_mmsghdr): New function.
* syscall.c (dumpio) [HAVE_SENDMSG]: Call dumpiov_in_mmsghdr
for recvmmsg and sendmmsg syscalls.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-11-11 15:44:24 +00:00
caf6a438f9 Use the definition of struct mmsghdr if it is defined in build environment
mmsghrd structure type is defined locally in printmmsghdr function.

However, more functions will refer the definition in modifications for
supporting "-e write=set" and "-e read=set" option for sendmmsg and
recvmmsg system calls.

After this change, the system definition of struct mmsghdr will be used
if configure reports it is available, falling back to the old local
definition.

* configure.ac (AC_CHECK_TYPES): Add struct mmsghdr.
* net.c [!HAVE_STRUCT_MMSGHDR] (struct mmsghdr): Define.
(printmmsghdr): Use previously defined struct mmsghdr.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-11-11 15:42:07 +00:00
b248543be9 Introduce a separate function to copy from msghdr32 to msghdr
This patch is an initial step for supporting "-e write=set" and
"-e read=set" option for sendmmsg and recvmmsg system calls.

Coverting a data of msghdr32 to msghdr is needed both for
{send,recv}msg and {send,recv}mmsg to decode parameters.
To share the copying code in both decoders, a separate
function named copy_from_msghdr32 is introduced.

* net.c [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4]
(copy_from_msghdr32): New function.
(extractmsghdr) [SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4]: Use it.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-11-11 15:41:37 +00:00
00119f63fa ioctlsort: rewrite build rules using noinst_PROGRAMS
* linux/ioctlsort.c: Rename to ioctlsort.c
* Makefile.am (EXTRA_DIST): Rename linux/ioctlsort.c to ioctlsort.c.
[MAINTAINER_MODE] (noinst_PROGRAMS): Add ioctlsort.
(ioctlsort_SOURCES): Add ioctlsort.c.
(nodist_ioctlsort_SOURCES): Add ioctls.h and ioctldefs.h.
(CLEANFILES): Add $(nodist_ioctlsort_SOURCES).
(ioctlsort.$(OBJEXT)): Likewise.
(ioctlsort): Remove.
2014-11-11 15:30:00 +00:00
544a81063c Makefile.am: look for ioctl definitions in the kernel build tree by default
While most of ioctl-related kernel headers are now exported by kernel's
headers_install, some are still modules_install only.  The kernel's
headers installed into /usr/include/ are usually headers_install'ed and
therefore don't contain some internal headers we need.  The solution is
to look for modules_install'ed headers for the running kernel, and fall
back to old behavior if they aren't found.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-11-11 15:10:22 +00:00
c400a1c70e Dump details for Bluetooth socket operations
* configure.ac (AC_CHECK_HEADERS): Add bluetooth/bluetooth.h.
* xlat/bt_protocols.in: New file.
* net.c [AF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Include bluetooth
headers.
[PF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Include "xlat/bt_protocols.h".
(printsock) [AF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Dump details
for AF_BLUETOOTH sockets.
(sys_socket) [PF_BLUETOOTH && HAVE_BLUETOOTH_BLUETOOTH_H]: Decode
protocol for PF_BLUETOOTH sockets.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-11-04 15:38:39 +00:00
0cc961440b Implement Video4Linux video-input ioctls decoder
Introduce v4l2.c, a decoder for the arguments of the video-input subset
of the v4l2 ioctl's.  This is a combination of
- previous work by Peter Zotov <whitequark@whitequark.org>, found at
https://gist.githubusercontent.com/whitequark/1263207/raw/strace-4.6-v4l2-ioctls.patch
- previous work by William Manley <will@williammanley.net>, found at
http://marc.info/?l=strace&m=139395588520675
- forward port, additions and fixes by Philippe De Muyter <phdm@macqel.be>

As v4l2 is a moving target, I have made v4l2.c compilable with ancient
linux kernels by testing the availability of some macros.  It has been
succesfully compiled on linux 3.10, 3.1, 2.6.31 and 2.6.22, and
succesfully used on linux 3.10 with a camera device.

* configure.ac: Check for availabilty of V4L2_* enum constants.
* Makefile.am (strace_SOURCES): Add v4l2.c.
* defs.h (v4l2_ioctl): New prototype.
* ioctl.c (ioctl_decode): Use v4l2_ioctl.
* v4l2.c: New file.
* xlat/v4l2_*.in: New files.

Signed-off-by: Philippe De Muyter <phdm@macqel.be>
Cc: Peter Zotov <whitequark@whitequark.org>
Cc: William Manley <will@williammanley.net>
2014-11-04 15:27:31 +00:00
749c2218e1 Update ioctl entries
* linux/ioctlent.h.in: Regenerate from v3.17 headers.
2014-11-04 03:13:51 +00:00
3e252ca835 Remove ioctl header file names from the executable
* defs.h (struct ioctlent): Remove "doth" field.
* Makefile.am ($(ioctlent_h)): Remove 1st field.
2014-11-04 03:13:50 +00:00
ee7b76eab9 Filter out redundant ioctl entries early
For two ioctl entries with the same code, if one's name is a prefix
to another's name, keep the entry with a shorter name.  Filter out
redundant ioctl entries at ioctlsort stage so that distributed
ioctlent.h.in files will be already filtered.

* linux/ioctlsort.c (is_not_prefix): New function.
(main): Use it.
* linux/ioctlent-filter.awk: Remove.
* Makefile.am (EXTRA_DIST): Remove linux/ioctlent-filter.awk.
($(ioctlent_h)): Don't use linux/ioctlent-filter.awk.
2014-11-04 03:13:36 +00:00
118c60344b ioctlent.sh: update the list of directories exported by headers_install
* linux/ioctlent.sh: Add drm, mtd, rdma, video, and xen directories.
2014-11-03 19:05:33 +00:00
02f9f6b386 Add a function for dumping iovec in msghdr used in sendmsg and recvmsg
Here is an example session:

    $ ./strace -e write=all ip link change dev enp0s25 mtu 1501 > /dev/null
    sendmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"(...
     * 40 bytes in buffer 0
     | 00000  28 00 00 00 10 00 05 00  d0 d9 aa 53 00 00 00 00  (..........S.... |
     | 00010  00 00 00 00 02 00 00 00  00 00 00 00 00 00 00 00  ................ |
     | 00020  08 00 04 00 dd 05 00 00                           ........         |
    ...

    $ ./strace -e read=all ip link show > /dev/null
    recvmsg(3, {msg_name(12)={sa_family=AF_NETLINK, pid=0, groups=00000000}, msg_iov(1)=[{"...
     * 8192 bytes in buffer 0
     | 00000  34 00 00 00 02 00 00 00  00 00 00 00 ff 23 00 00  4............#.. |
     | 00010  ff ff ff ff 20 00 00 00  10 00 05 00 00 00 00 00  .... ........... |
    ...

* defs.h (dumpiov_in_msghdr): New prototype.
* net.c (extractmsghdr): New function derived from printmsghdr.
(printmsghdr): Use extractmsghdr.
(dumpiov_in_msghdr): New function.
* syscall.c (dumpio) [HAVE_SENDMSG]: Call dumpiov_in_msghdr for recvmsg
and sendmsg syscalls.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-11-01 01:46:06 +00:00
40c174b38b Include <linux/ptrace.h> regardless of <sys/reg.h> existence
This fixes compilation with musl libc.
This approach was already used in process.c, so I assume it is safe.

* signal.c: Move [HAVE_LINUX_PTRACE_H] code out of [HAVE_SYS_REG_H] check.
* syscall.c: Likewise.
* util.c: Likewise.

Signed-off-by: Maarten ter Huurne <maarten@treewalker.org>
2014-10-31 23:04:59 +00:00
788c0d660d sock: decode SIOCSIFNAME on entering syscall
* sock.c (sock_ioctl): Handle SIOCSIFNAME on entering syscall.
2014-10-31 22:59:19 +00:00
f27263d6d8 sock: fix decoding of SIOCSIFNAME
The decoding of SIOCSIFNAME is incorrect.  It does not use
the ifr_index field to look things up, but ifr_newname.

* sock.c (sock_ioctl): Split out SIOCSIFNAME from SIOCGIFNAME and
display ifr_newname.
2014-10-31 15:18:47 +00:00
8b5fbeea99 sock: fix decoding of struct ifreq.ifr_name
The ifr name fields of the ifreq structure might not be NUL terminated.
If the user makes an ioctl call where they aren't, then strace ends up
reading random content from its own stack.  Limit the printf lengths.

* sock.c (sock_ioctl): Add explicit length limits to ifr_name printfs.
2014-10-31 15:17:31 +00:00
22e34b9857 Don't risk truncating open flags by using mode_t
On Android, 32-bit arm and x86 use __kernel_mode_t (an unsigned short)
as their mode_t.  The open(2) flags are actually an int, so high ones
like O_CLOEXEC get truncated if you coerce them to mode_t.

* defs.h (tprint_open_modes, sprint_open_modes): Change argument type
from mode_t to int.
* file.c (tprint_open_modes, sprint_open_modes): Likewise.

Signed-off-by: Elliott Hughes <enh@google.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-10-03 22:01:37 +00:00
82a528d96f Enhance sysinfo decoding
* configure.ac (AC_CHECK_MEMBERS): Check for struct sysinfo.totalhigh,
struct sysinfo.freehigh, and struct sysinfo.mem_unit.
* sysinfo.c (sys_sysinfo): Treat failed umove() call as syserror().
Print totalhigh, freehigh, and mem_unit members when struct sysinfo
supports them.
2014-09-29 23:29:56 +00:00
57d45a2b3a Move sysinfo parser to a separate file
* sysinfo.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* resource.c (sys_sysinfo): Move to sysinfo.c.
2014-09-29 23:13:05 +00:00
9f59677e75 Fix build with musl libc
* resource.c: Include <sys/sysinfo.h> for struct sysinfo definition.

Reported-by: Steven Honeyman <stevenhoneyman@gmail.com>
2014-09-29 23:09:22 +00:00
3ec5c0492c tests: cleanup checks for basic programs
* tests/init.sh: Check for cat and rm.
* tests/getdents.test: Check for awk.
* tests/ptrace_setoptions.test: Check for grep.
* tests/net-fd.test: Do not check for rm.
* tests/net.test: Likewise.
* tests/scm_rights-fd.test: Likewise.
* tests/stat.test: Likewise.
* tests/uio.test: Likewise.
2014-09-23 01:51:05 +00:00
fdfa72276a tests: add a test for -yy option
* tests/net-yy.test: New test.
* tests/inet-accept-connect-send-recv.c: New file.
* tests/netlink_inet_diag.c: Likewise.
* tests/net-yy-accept.awk: Likewise.
* tests/net-yy-connect.awk: Likewise.
* tests/.gitignore: Add inet-accept-connect-send-recv,
netlink_inet_diag, *.tmp-*, and *.tmp.*.
* tests/Makefile.am (check_PROGRAMS): Add inet-accept-connect-send-recv
and netlink_inet_diag.
(TESTS): Add net-yy.test.
(EXTRA_DIST): Add net-yy-accept.awk and net-yy-connect.awk.
2014-09-23 01:42:07 +00:00
9a0dd74ae0 Move statfs related parsers to a separate file
* statfs.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (sprintfstype, printstatfs, sys_statfs, sys_fstatfs): Move
to statfs.c.
[HAVE_STATFS64] (printstatfs64, printcompat_statfs64, sys_statfs64,
sys_fstatfs64): Likewise.
[ALPHA] (osf_statfs, osf_fstatfs): Likewise.
2014-09-22 00:31:23 +00:00
4176d533e0 fsmagic: sort array by value and use bsearch for faster lookup
* defs.h (xlat_search): New prototype.
* util.c (xlat_bsearch_compare, xlat_search): New functions.
* file.c (sprintfstype): Use xlat_search for fsmagic lookup.
* xlat/fsmagic.in: Sort by value and mark as not NULL-terminated.
* tests/statfs.c: New file.
* tests/statfs.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add statfs.
(statfs_CFLAGS): Define.
(TESTS): Add statfs.test.
* tests/.gitignore: Add statfs.
2014-09-22 00:31:06 +00:00
7faa5b4884 fsmagic: update from <linux/magic.h>
* xlat/fsmagic.in: Add new constants from <linux/magic.h>.
Reported by Elliott Hughes.
2014-09-21 20:31:16 +00:00
2f6510c8a6 Add -yy option: print ip and port associated with socket descriptors
When two ore more -y options are given, print local and remote ip:port
pairs associated with socket descriptors.  This implementation uses
NETLINK_INET_DIAG for sockaddr lookup; it's based on the patch
prepared by Zubin Mithra as a part of his GSoC 2014 strace project.

* Makefile.am (strace_SOURCES): Add socketutils.c
(EXTRA_DIST): Add linux/inet_diag.h and linux/sock_diag.h.
* defs.h (print_sockaddr_by_inode): New prototype.
* linux/inet_diag.h: New file.
* linux/sock_diag.h: Likewise.
* socketutils.c: Likewise.
* strace.1: Document -yy option.
* strace.c (usage): Likewise.
* util.c (printfd): Use print_sockaddr_by_inode.
2014-09-17 20:03:38 +00:00
c3a5c01051 sigaction: wrap sa_restorer in #ifdef SA_RESTORER consistently
Wrap sa_restorer member definitions in #ifdef SA_RESTORER to be
consistent with their use.
If an architecture does not provide sa_restorer members but still
defines SA_RESTORER macro, the latter has to be explicitly undefined.

This change fixes compilation failures like this one:
signal.c: In function 'decode_old_sigaction':
signal.c:631:21: error: 'struct old_sigaction' has no member named 'sa_restorer'
signal.c: In function 'decode_new_sigaction':
signal.c:1224:21: error: 'struct new_sigaction' has no member named 'sa_restorer'

* signal.c (struct old_sigaction, struct old_sigaction32,
struct new_sigaction, struct new_sigaction32):
Wrap sa_restorer member in #ifdef SA_RESTORER.
(decode_old_sigaction, decode_new_sigaction):
Wrap use of sa32.sa_restorer in #ifdef SA_RESTORER.

Signed-off-by: Vicente Olivert Riera <vincent.riera@imgtec.com>
2014-09-17 19:23:45 +00:00
3ed5d02183 Fix compilation warnings reported by gcc -Wsign-compare
* configure.ac (gl_WARN_ADD): Add -Wsign-compare.
* defs.h (struct tcb): Change 'currpers' type to unsigned.
(struct xlat): Change 'val' type to unsigned
(signame): Add 'const' qualifier to its argument.
(xlookup, printxval): Add 'const' qualifier to the 2nd argument and
change its type to unsigned.
(printpathn): Change the 3rd argument type to unsigned.
(ioctl_lookup): Change 1st argument type to unsigned.
* count.c (call_summary_pers, call_summary): Change 'i' type to unsigned.
* file.c (print_xattr_list): Fix comparisons between signed and unsigned
long values.
* ioctl.c (compare): Fix cast.
(ioctl_lookup): Change 1st argument type to to unsigned.
(ioctl_next_match): Change 'code' type to unsigned.
* mem.c (sys_move_pages): Change 'i' type to unsigned.
* mtd.c (mtd_ioctl): Change 'i' and 'j' types to unsigned.
Print 'i' using %u format string.
* process.c (sys_prctl): Change 'i' type to unsigned.
(printargv): Change 'n' type to unsigned.
(sys_ptrace): Change 'addr' type to unsigned.
* scsi.c (print_sg_io_buffer): Add 'const' qualifier to 'len' argument
and change its type to unsigned.  Change 'i' and 'allocated' types
to unsigned.
* signal.c (signame): Add 'const' qualifier to its argument.
Fix comparisons between signed and unsigned values.
(sprintsigmask_n, printsiginfo): Fix comparisons between signed and
unsigned values.
* sock.c (sock_ioctl): Change 'i' and 'nifra' types to unsigned.
* strace.c (expand_tcbtab, alloctcb): Change 'i' type to unsigned.
(detach): Change 'sig' type to unsigned.
(startup_attach): Change 'tcbi' type to unsigned.
(startup_child): Change 'm', 'n', and 'len' types to unsigned.
(init): Use new variable to iterate 'tcbtab'.
(pid2tcb): Change 'i' type to unsigned.
(cleanup): Change 'i' and 'sig' types to unsigned.
* syscall.c (update_personality): Change 'personality' argument type
to unsigned.
(struct qual_options): Change 'bitflag' type to unsigned.
(reallocate_qual): Add 'const' qualifier to its argument and change its
type to unsigned.
(qualify_one): Change 'n' and 'bitflag' arguments types to unsigned.
Add 'const' qualifier to 'n', 'not', and 'pers' arguments.
Change 'p' type to signed int.
(qual_syscall): Change 'bitflag' argument type to unsigned.
Add 'const' qualifier to 'bitflag' and 'not' arguments.
Change 'p' type to signed int.
(qual_signal): Change 'bitflag' argument type to unsigned.
Add 'const' qualifier to 'bitflag' and 'not' arguments.
Change 'i' type to unsigned.
(qual_desc): Change 'bitflag' argument type to unsigned.
Add 'const' qualifier to 'bitflag' and 'not' arguments.
(qualify): Change 'i' type to unsigned.
(get_scno): Change 'currpers' type to unsigned.
Fix a comparison between signed and unsigned values.
* system.c (sys_sysctl): Change 'cnt' and 'max_cnt' types to unsigned.
Fix comparisons between signed and unsigned values.
* util.c (xlookup, printxval): Add 'const' qualifier to 'val' argument
and change its type to unsigned.
(printuid): Fix a comparison between signed and unsigned values.
(printpathn): Change 'n' argument type to unsigned.
(printstr): Change 'size' type to unsigned.
Fix a comparison between signed and unsigned values.
(setbpt): Change 'i' type to unsigned.
* net.c (printsock): Silence a compilation warning.
* reboot.c (sys_reboot): Likewise.
2014-09-17 19:18:18 +00:00
2ed2cc743d Move dirent related parsers to a separate file
* dirent.c: New file.
* Makefile.am (strace_SOURCES): Add it.
* file.c (print_old_dirent, sys_readdir, sys_getdents, sys_getdents64):
Move to dirent.c.
2014-09-11 22:40:37 +00:00
68d64241ac getdents, getdents64: fix potential out-of-bounds read issues
* file.c (sys_getdents): Check for invalid d_reclen.
Avoid reading from uninitialized memory.
(sys_getdents64): Likewise.
* tests/getdents.awk: New file.
* tests/getdents.test: New test.
* tests/Makefile.am (TESTS): Add it.
(EXTRA_DIST): Add getdents.awk.
2014-09-11 22:27:43 +00:00
1e42f2dbe7 tprint_sock_type: remove unused parameter
* net.c (tprint_sock_type): Remove unused parameter 'tcp'.
(sys_socket, sys_socketpair): Update callers.
2014-09-10 22:29:59 +00:00
1306365291 printsock: fix decoding of unrecognized AF_PACKET packet types
* net.c (printsock): Fix fallback string for AF_PACKET packet types.
2014-09-10 22:29:58 +00:00
6522f132ba decode_select: fix potential use of an uninitialized variable
A pointer to fd_set was used uninitialized when nfds == 0.

* desc.c (decode_select): Initialize fds.

Reported-by: Zubin Mithra <zubin.mithra@gmail.com>
2014-09-09 22:51:05 +00:00
b7dd5e63bf Use external libaio.h
Stop using an outdated partial copy of libaio.h, switch back to external
libaio.h from libaio.
This partially reverts commit 2df03c494e.

* aio.c: Drop a partial copy of libaio.h, include <libaio.h> instead.
(print_common_flags): Check for HAVE_STRUCT_IOCB_U_C_FLAGS.
(sys_io_submit): Check for HAVE_DECL_IO_CMD_PWRITE and
HAVE_DECL_IO_CMD_PWRITEV.
* configure.ac: Check for libaio.h and declaration it provides.
2014-09-08 16:43:36 +00:00
e277a90fbd maint: post-release administrivia
* NEWS: Add header line for next release.
2014-08-19 11:34:44 +00:00
e4db4c4bdd Prepare for 4.9 release
* NEWS: Update for 4.9 release.
* debian/changelog: 4.9-1.
* strace.spec: 4.9-1.
2014-08-15 13:14:15 +00:00
a283ae0368 Sync strace.spec and debian/ with packages
* debian/changelog: Sync with 4.8-1.1.
* debian/control: Likewise.
* debian/rules: Likewise.
* strace.spec: Sync with 4.8-5.
2014-08-15 13:14:15 +00:00
6d32e463ab NEWS: Update for 4.9 release 2014-08-15 00:36:36 +00:00
e971da48db Update syscall tables to the point where they include renameat2
* linux/dummy.h: Add printargs aliases for sys_sched_getattr and
sys_sched_setattr.
* linux/aarch64/syscallent1.h: Add kcmp/finit_module/sched_setattr/
sched_getattr/renameat2.
* linux/alpha/syscallent.h: Add kcmp/finit_module.
* linux/arm/syscallent.h: Add sched_setattr/sched_getattr/renameat2.
* linux/hppa/syscallent.h: Add sched_setattr/sched_getattr/utimes/renameat2.
* linux/i386/syscallent.h: Add sched_setattr/sched_getattr/renameat2.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Add getdents64/sched_setattr/sched_getattr/
renameat2.
* linux/mips/syscallent-o32.h: Add sched_setattr/sched_getattr/renameat2.
* linux/powerpc/syscallent.h: Fix finit_module/kcmp order.  Add sched_setattr/
sched_getattr/renameat2.
* linux/s390/syscallent.h: Add sched_setattr/sched_getattr/renameat2.
* linux/s390x/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Add sched_setattr/sched_getattr.
2014-08-15 00:09:12 +00:00
5b677ab904 renameat2: add decoding support
* file.c (decode_renameat, sys_renameat2): New functions.
(sys_renameat): Use decode_renameat.
* pathtrace.c (pathtrace_match): Handle sys_renameat2.
* linux/syscall.h (sys_renameat2): New prototype.
* xlat/rename_flags.in: New file.
2014-08-15 00:06:06 +00:00
67c4d437ba CREDITS: fix generation in out of tree builds
The {...} code changes the working dir with `cd`, but the commands outside
of that block expects to be in the original dir.  Change to a subshell so
the path outside of this block remains unchanged.

* Makefile.am ($(srcdir)/CREDITS): Change {...} to (...).
2014-08-14 23:30:15 +00:00
a80c636fd0 ia64: add missing syscalls
When the preadv/pwritev syscalls were added, the ones before it in the
ia64 list were missed, so all the syscalls there and later were not in
the right location (causing things to be decoded incorrectly).

Add the missing syscalls before preadv which also re-aligns all the
syscalls after that point.  This fixes the uio.test.

* linux/ia64/syscallent.h: Add syscalls 1310 through 1318.
2014-08-14 23:29:43 +00:00
dd80a879be ia64: fix sigaction decoding
Looks like ia64 doesn't have sa_restorer either, yet still defines
SA_RESTORER.  Deploy the same trick that HPPA is using to make the
test pass.

* signal.c (SA_RESTORER): Undefine when IA64 is defined.
(struct new_sigaction) [IA64]: Disable sa_restorer.
2014-08-14 23:29:09 +00:00
e55264e012 tests: skip detach-stopped.test when PTRACE_SEIZE doesn't work
detach-stopped.test is known to fail when PTRACE_SEIZE is not available,
so skip the test in that case.

* tests/detach-stopped.test: Check for "strace -d" output and skip the
test when it says that PTRACE_SEIZE doesn't work.
2014-08-12 01:09:28 +00:00
d5588a8e12 sh: fix syscall numbering for recv and sendto
* linux/sh/syscallent.h: Swap recv and sendto syscall entries.
2014-08-11 17:39:43 +00:00
97ca0277b3 tests: fix uio building w/out preadv/pwritev
The preadv/pwritev symbols weren't added to glibc until the 2.10 release,
so trying to build the uio test leads to link failures.  Add configure
tests and update uio.test to handle this.

* configure.ac (AC_CHECK_FUNCS): Add preadv/pwritev.
* tests/uio.c: Include config.h.
(main): Check for HAVE_PREADV and HAVE_PWRITEV.
* tests/uio.test: Check exit status of uio helper.
2014-08-11 17:30:01 +00:00
b267aef27f tests: ignore *.tmp files
The tests like to generate random .tmp files, so ignore them.

* tests/.gitignore: Add *.tmp.
2014-08-11 17:23:05 +00:00
2b5bfeb2a8 tests: fix shell errors in detach tests
The current detach test code does:
	set -e
	...
	cleanup() {
		set +e
		kill ...
		wait ...
	}
	...
	cleanup
	exit 0

The problem is that while `set -e` is disabled for the body of the
cleanup function, it isn't necessarily disabled in the caller scope.
So if the return value of the cleanup function (`wait` in this case)
is non-zero, the script ends up failing overall.

Add an explicit return 0 to the cleanup function so that we don't kill
the overall test pipeline.

* tests/detach-running.test (cleanup): Add return 0.
* tests/detach-sleeping.test (cleanup): Likewise.
* tests/detach-stopped.test (cleanup): Likewise.
2014-08-11 17:22:38 +00:00
6673ac74dc set_ptracer_any: add a little documentation
This way I don't have to keep reading up on these options and wondering
why the code isn't aborting when the call fails.

* tests/set_ptracer_any.c (main): Note prctl failures are ok.
2014-08-11 17:19:17 +00:00
6ab2ed119a signal: fix thinko in sa_restorer
Previous commit here re-added the bugs trying to be fixed due to a
logic thinko.  The patches were tested in isolation and hand merged
later.  Oops.

* signal.c (struct new_sigaction): Change || to &&.
2014-08-10 09:23:22 +00:00
0189ff919b sigaction test: support arches w/out SA_RESTORER and swapped args
Running Linux 3.15 (sparc64) and glibc 2.17 (sparc32) triggers a
rt_sigaction call that does not use SA_RESTORER and has an order
where it inserts a restorer and a size.  The current tests don't
support that ordering, so add another regex.

* tests/sigaction.awk: Support no SA_RESTORER and swapped args.
2014-08-09 15:38:17 +00:00
8efd209122 alpha/sparc: fix arg count for rt_sigaction
Both these arches have a rt_sigaction syscall that takes 5 args, not 4.

* linux/alpha/syscallent.h (rt_sigaction): Change nargs to 5.
* linux/sparc/syscallent.h (rt_sigaction): Change nargs to 5.
2014-08-09 15:28:04 +00:00
d632e10f51 hppa: fix sigaction decoding
Since the rt_sigaction syscall on hppa doesn't have a sa_restorer,
do not include it in the kernel struct.

We also have to undefine SA_RESTORER so that code doesn't try to
use it.  The headers will export this, but the syscall doesn't
actually respect it.

* signal.c (SA_RESTORER): Undefine when HPPA is defined.
(struct new_sigaction): Disable sa_restorer on hppa.
2014-08-09 15:27:55 +00:00
e355c60b1d alpha: fix sigaction decoding
Since the rt_sigaction syscall on alpha doesn't have a sa_restorer,
do not include it in the kernel struct.

* signal.c (struct new_sigaction): Disable sa_restorer on alpha.
2014-08-09 15:27:13 +00:00
45e7b189e2 Prepare for -yy option support
* defs.h (show_fd_path): Change type to unsigned int.
* strace.c (show_fd_path): Likewise.
(init): Handle repeated -y option.
2014-08-08 23:38:26 +00:00
20b84a6769 Fix preadv/pwritev offset decoding on ILP32 architectures
This fixes regression introduced by the previous commit.

* io.c (print_llu_from_low_high_val) [SIZEOF_LONG != SIZEOF_LONG_LONG]:
Cast argument to unsigned long before casting it to unsigned long long.
2014-08-07 11:42:46 +00:00
3c49b02e98 Fix preadv/pwritev offset decoding on bigendian architectures
This partially reverts commit 7845a42b39.

* util.c (printllval): Remove align argument.
* defs.h (printllval): Update prototype.
(printllval_aligned, printllval_unaligned): Remove.
* file.c (sys_readahead, sys_truncate64, sys_ftruncate64, sys_fadvise64,
sys_fadvise64_64, sys_sync_file_range, sys_sync_file_range2,
sys_fallocate): Replace printllval_aligned call with printllval.
* io.c (sys_pread, sys_pwrite): Likewise.
(print_llu_from_low_high_val): New function.
(sys_preadv, sys_pwritev): Use it instead of printllval_unaligned.
2014-08-07 00:30:26 +00:00
15114ec215 Decode file descriptors returned by accept and accept4 syscalls
* net.c (do_accept): Rename to do_sockname.
(sys_accept, sys_accept4): Update callers, return RVAL_FD.
(sys_getsockname, sys_getpeername): Call do_sockname directly.
* tests/net-fd.test: Update.
2014-08-06 16:49:59 +00:00
212287c56c x32: update io_{setup,submit} syscalls
Starting in 3.16, these two syscalls have gotten their own entry
point for x32.  See linux 7fd44dacdd803c0bbf38bf478d51d280902bb0f1.

* linux/x32/syscallent.h: Change existing io_{setup,submit} to 64bit,
and add new entry points for x32 specifically.
2014-08-01 14:25:12 +00:00
57fac759ca xtensa: sort values in struct_user_offsets
Otherwise ptrace syscall argument decoding is wrong:
  ptrace(PTRACE_PEEKUSER, 296, syscall_nr, [0x4048eb]) = 0
  ptrace(PTRACE_PEEKUSER, 296, syscall_nr, [0x3fa6cd30]) = 0
  ptrace(PTRACE_PEEKUSER, 296, syscall_nr, [0x8040676d]) = 0
instead of
  ptrace(PTRACE_PEEKUSER, 296, pc, [0x4048eb]) = 0
  ptrace(PTRACE_PEEKUSER, 296, a1, [0x3fa6cd30]) = 0
  ptrace(PTRACE_PEEKUSER, 296, a0, [0x8040676d]) = 0

* process.c (struct_user_offsets) [XTENSA]: Sort values.
2014-06-18 15:41:25 +00:00
2734a7010f Document -k option as experimental
strace -k does not produce a reliable output on all supported
configurations yet, even basic strace-k.test is known to fail
on some of them.

* strace.c (usage): Document -k option as experimental.
* strace.1: Likewise.
* NEWS: Likewise.
2014-06-18 15:41:19 +00:00
b076420692 tests: robustify -k test
Split stack-fcall.c into several compilation units so that intermediate
function calls would not be optimized out by compiler.

* tests/stack-fcall.c: Move intermediate functions to ...
* tests/stack-fcall-*.c: ... new files.
* tests/Makefile.am (stack_fcall_SOURCES): Add stack-fcall-*.c.
2014-06-18 15:18:47 +00:00
c588b205be tests: enhance -k test
Add two more function calls to the stack.  Suggested by Masatake YAMATO.

* tests/stack-fcall.c (f1): Rename to f3.
(f1, f2): New functions.
* tests/strace-k.test: Update.
2014-06-13 15:58:01 +00:00
73741d2e2e unwind: ignore memory mappings that have no PROT_EXEC bit set
* unwind.c (build_mmap_cache): For each memory mapping being scanned,
save its PROT_EXEC bit and skip the mapping if it is not set.
2014-06-13 15:58:00 +00:00
9a349c7779 unwind: cleanup build_mmap_cache
* unwind.c (build_mmap_cache): Move local variables to the code branch
where they are used.  Check return code of sscanf and strdup.  Do not
treat unusual memory mappings as fatal errors.  Do not skip memory
mappings with path names starting with "[".
2014-06-13 15:56:40 +00:00
2222b928c6 unwind: remove unused field from mmap_cache_t
* unwind.c (mmap_cache_t): Remove "deleted" field.
(build_mmap_cache): Remove initialization of "deleted" field.
2014-06-13 18:20:08 +04:00
52840ede0c unwind: refactor stacktrace_walk
* unwind.c (stacktrace_walk): Move stack frame printing code
to separate function print_stack_frame.
2014-06-12 22:12:31 +00:00
806539c55c unwind: constify binary_filename and symbol_name functions arguments
* unwind.c (call_action_fn, print_call_cb, sprint_call_or_error,
queue_put, queue_put_call): Add const qualifier to binary_filename and
symbol_name arguments.
2014-06-12 22:10:59 +00:00
f1d73110a0 unwind: disable stack trace with multiple personalities
* unwind.c (unwind_cache_invalidate, unwind_print_stacktrace,
unwind_capture_stacktrace): Disable stack tracing of non-default
personality processes.
2014-06-11 00:09:55 +00:00
6555711a6e unwind: rename function_off_set to function_offset
* unwind.c (call_action_fn, stacktrace_walk, STACK_ENTRY_SYMBOL_FMT,
print_call_cb, sprint_call_or_error, queue_put, queue_put_call):
Rename function_off_set to function_offset.
2014-06-05 23:00:28 +00:00
c12eb1117c unwind: fix a bug in range updating of binary search
* unwind.c (print_stacktrace): Fix another off-by-one error in binary search.
2014-06-05 21:40:43 +00:00
c903c822ee unwind: use fopen64 instead of fopen
* unwind.c (fopen_for_input): Define to fopen64 iff
[_LARGEFILE64_SOURCE && HAVE_FOPEN64], otherwise define it to fopen.
(build_mmap_cache): Use fopen_for_input instead of fopen.
2014-06-05 15:42:05 +00:00
e411397489 unwind: fix build on 32-bit architectures
Fix compilation warnings in unwind.c on 32-bit architectures.
On some architectures getuid is actually getuid32, so change the test
to use getpid instead of getuid.

* unwind.c (STACK_ENTRY_SYMBOL_FMT): Explicitly cast function_off_set
to unsigned long.
(queue_put_error): Change the 3rd argument's type to unsigned long.
* tests/stack-fcall.c (f1): Use getpid instead of getuid.
* tests/strace-k.test: Likewise.
2014-06-05 15:42:05 +00:00
6e7ba0d8fe tests: robustify -w option test
* tests/count.test: Allow nanosleep to spend a bit less time than 1 second.
2014-06-05 15:42:04 +00:00
d04bb2bb80 Fix delete_module decoding
* xlat/delete_module_flags.in: New file.
* file.c (sys_delete_module): Move ...
* bjm.c (sys_delete_module): ... to here.
Decode 1st argument using printstr instead of printpath.
* NEWS: Mention it.
2014-06-04 16:29:18 +00:00
64aa1b1e2d Decode paths associated with file descriptors returned by syscalls
* defs.h (RVAL_FD): New macro.
(RVAL_MASK, RVAL_STR, RVAL_NONE): Update.
* desc.c (sys_dup, sys_delete_module): New functions.
(do_dup2, decode_open, sys_creat): Change return value to RVAL_FD.
* linux/dummy.h (sys_delete_module, sys_dup): Remove.
* linux/syscall.h (sys_delete_module, sys_dup): New prototypes.
* syscall.c (trace_syscall_exiting): Handle RVAL_FD.

Signed-off-by: Zubin Mithra <zubin.mithra@gmail.com>
2014-06-04 16:28:04 +00:00
327102c7f6 NEWS: Prepare for 4.9 release 2014-06-03 13:31:37 +00:00
2727aae37c Warn about flags that have no effect with -c
* strace.c (init): Issue a warning if -i, -k, -r, -t, -T, or -y is used
along with -c.
This fixes Debian bug #443895.
2014-06-03 13:20:05 +00:00
4182981f6d debian: enable security hardening features
* debian/rules: Follow the advice in https://wiki.debian.org/Hardening
and enable maximum hardening as for programs that handle untrusted data.
Patch by Markus <waldeck@gmx.de>.
2014-06-03 13:04:06 +00:00
05cd5b2a04 debian: update control file
* debian/control (strace64): Fix a typo in package description.
Patch by Pascal De Vuyst <pascal.devuyst@gmail.com>.
(strace, strace-udeb): Add x32 to architecture list.
Patch by Guillaume Morin <guillaume@morinfr.org>.
(strace, strace-udeb): Add or1k to architecture list.
Patch by Christian Svensson <debian@cmd.nu>.
(strace, strace-udeb): Add arm64 to architecture list,
and remove defunct arm.
Patch by Wookey <wookey@debian.org>.

This fixes Debian bugs: #697625, #727018, #742235, #749956.
2014-06-03 12:36:20 +00:00
a197832282 manpage: minor corrections
$ groff -ww -mandoc -z strace.1
strace.1:65: warning: macro `IX' not defined

* strace.1: define IX macro as empty for groff.
Change remaining '-' as minus to '\-'.
Have two word spaces after a full stop as an end of sentence.
Use extra space ('\,' or '\/') between roman and italic characters.
Based on patch by Bjarni Ingi Gislason <bjarniig@rhi.hi.is>.
This fixes Debian bug #725987.
2014-06-03 12:36:14 +00:00
9682107053 unwind: tests: add a test for -k option
* tests/stack-fcall.c: New test target.
* tests/strace-k.test: New test driver.
* tests/Makefile.am (check_PROGRAMS): Add stack-fcall.
(TESTS): Add strace-k.test.
* tests/.gitignore: Add stack-fcall.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2014-05-30 22:59:27 +00:00
ed69fc2dc3 unwind: move stacktrace capturing and mmap cache invalidating to trace_syscall_entering
Instead of handling stacktrace capturing and mmap cache invalidating in
sys_* functions, handle them uniformly in trace_syscall_entering using
new flags introduced by previous two commits.

The patch is simpler than its older version(v3).  The value of
hide_log_until_execve is just ignored.  I found the value is nothing
to do with this patch.  unwind_cache_invalidate is mentioned only
once in trace_syscall_exiting.
Both are suggested by Dmitry Levin.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-05-30 22:59:01 +00:00
549e2c4a98 unwind: add SE and SI flags to syscall entries for all architectures
Add SE flag to execve, exit, and exit_group syscall entries.
Add SI flag to brk, execve, mmap, mprotect, mremap, munmap,
remap_file_pages, shmat, and shmdt syscall entries.
2014-05-30 22:58:47 +00:00
1d78d22058 unwind: introduce markers specifying the needs of special care in unwinding
Some system calls require capturing the stack trace before they are
processed in kernel.  Typical one is execve.  Some system calls require
invalidating mmap cache after they are processed in kernel.

In current implementation these requirements are handled directly by
appropriate syscall handlers.  However, it is difficult to keep the
source code maintainable using this approach to cover all system calls
which have such requirements.

A more generic way to implement this is to flag all syscalls that
require special processing, and handle these flags right in
trace_syscall_entering instead of changing syscall handlers.

This patch just defines new flags: STACKTRACE_INVALIDATE_CACHE and
STACKTRACE_CAPTURE_ON_ENTER.

The names of macros are suggested by Dmitry Levin.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-05-30 22:57:56 +00:00
a0b4ee7b38 unwind: enable dwarf cache of libunwind
Here is the benchmark of the dwarf cache.

Target program:

    #include <sched.h>
    int main(void)
    {
      unsigned int max = 0x6fff, i;
      for (i = 0; i < max; i++)
	sched_yield();
      return 0;
    }

Command line:

	./strace -o /dev/null -k a.out

With the dwarf cache:

    real	0m12.081s
    user	0m3.858s
    sys 	0m8.194s

Without the dwarf cache:

    real	0m22.326s
    user	0m5.218s
    sys		0m16.952s

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-05-30 22:57:39 +00:00
b45b7faa1f unwind: report expected backtracing error
When a file mmap'ed to the target process is unlink'ed, backtracing the
stack would fail.  Current implementation reports it as
"backtracing_error".  To avoid confusion, the message is changed to
"expected_backtracing_error".

Here is the reproducer:

  $ cat ./p-deleted.c
  #include <unistd.h>

  int main(int argc, char **argv) {
    return unlink(argv[0]) < 0;
  }

  $ strace -e unlink -k ./p-deleted
  unlink("./p-deleted")                   = 0
   > /usr/lib64/libc-2.18.so(unlink+0x7) [0xe7f17]
   > /home/yamato/var/strace/t_unwind/p-deleted (deleted)(+0x0) [0x575]
   > /usr/lib64/libc-2.18.so(__libc_start_main+0xf5) [0x21d65]
   > backtracing_error [0x7ffff1365590]
  +++ exited with 0 +++

p-deleted is deleted therefore backtracing_error is reported.  This
patch records the deleted marker when making mmap cache and refers the
recorded information in the case "backtracing_error" to switch the
message.

Here is the output of this patch:

  $ strace -e unlink -k ./p-deleted
  unlink("./p-deleted")                   = 0
   > /usr/lib64/libc-2.18.so(unlink+0x7) [0xe7f17]
   > /home/yamato/var/strace/t_unwind/p-deleted (deleted)(+0x0) [0x575]
   > /usr/lib64/libc-2.18.so(__libc_start_main+0xf5) [0x21d65]
   > expected_backtracing_error [0x7ffff1365590]
  +++ exited with 0 +++

This solution is not perfect: if a file is unlink'ed after making the
mmap cache and before unwinding, strace cannot have a chance to record
the deleted marker.

In this version of patch, hardcoded magic number used in comparing "(delete)"
string is replaced with strlen as suggested by Dmitry Levin.

In old version of patch, the deleted entry was thrown away from mmap
cache to avoid to report "backtracing_error".  In this patch I keep it,
and just switch the error message.
Inspired by the review comment from Dmitry Levin.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-05-30 22:57:19 +00:00
2b09df9731 unwind: call unwind_tcb_fin before printing detached message
captured stacktrace is printed in unwind_tcb_fin if tcp->queue is not
empty.  This should happen before printing detached message, so
unwind_tcb_fin is moved to the top of droptcb.

This is implicitly suggested by Dmitry Levin in patch review process.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-05-30 22:56:38 +00:00
9bc6561588 unwind: implement automatic mmap cache invalidation
A mmap cache belonging to a tcb was updated when a system call which
changed the memory mapping was called.  This implementation was assumed
the mapping was changed only by the tcb.  However, this assumption is
incorrect if the target application is multi-threaded; more than two
tcbs can shared the same memory mapping and a tcb can modify it without
being noticed by the others.

This change introduces a global integer variable mmap_cache_generation,
and mmap_cache_generation field to struct tcb.  The variable
is incremented each time a process enters a syscall that can modify its
memory mapping.  Each tcb records the value of this variable at the
moment if  building its mmap cache.  Every mmap cache associated with
the given tcb can be validated by comparing its mmap_cache_generation
field with the variable mmap_cache_generation.

This implementation is inefficient.  If strace attaches two processes
which don't share the memory mapping, rebuilding mmap cache of a tcb
triggered by another tcb's mmap system call is not necessary.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-05-30 22:56:14 +00:00
f8e39d7b7a unwind: introduce queue_t for capturing stacktrace
This is the second step for splitting capturing from printing.

New `queue' field is added to tcb.  Captured stacktrace is stored here.
The field is initialized/finalized at unwind_tcb_init/unwind_tcb_fin.

New API function unwind_capture_stacktrace is added.  This function
captures the currest stack using stracktrace_walker and records it in
tcb.  It's printing is delayed to the next call of
unwind_print_stacktrace.

unwind_print_stacktrace is extended.  Now it checks queue field of
the given tcb at the start of function.  If the function finds a
captured stack trace, the latter is printed using stracktrace_walker.

Currently unwind_capture_stacktrace invocations are added directly to
handlers of mmap, munmap, mprotect, and execve.

Here is the difference of output with/without patch:

(without patch)
  execve("./test-fork", ["./test-fork"], [/* 56 vars */]) = 0
   > /usr/lib64/ld-2.18.so(check_one_fd.part.0+0x82) [0x11f0]

(with patch)
  execve("./test-fork", ["./test-fork"], [/* 54 vars */]) = 0
   > /usr/lib64/libc-2.18.so(execve+0x7) [0xbcd27]
   > /home/yamato/var/strace/strace(exec_or_die+0x10c) [0x26ac]
   > /home/yamato/var/strace/strace(startup_child+0x346) [0x134f6]
   > /home/yamato/var/strace/strace(init+0x89f) [0x13dff]
   > /home/yamato/var/strace/strace(main+0xa) [0x26ca]
   > /usr/lib64/libc-2.18.so(__libc_start_main+0xf5) [0x21d65]
   > /home/yamato/var/strace/strace(_start+0x29) [0x2799]

In older version output lines of captured elements were built when
printing.  In this version they are built when capturing the stack.
As result, unneeded dynamic memory allocations are avoided.
Suggested by Luca Clementi.

In older version the combination of snprintf and realloc were used.
In this version they are replaced with asprintf.
Suggested by Dmitry Levin.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-05-30 22:55:08 +00:00
4e121e5bb4 unwind: introduce own debug macro
* unwind.c (DPRINTF): New macro, to be utilized in debugging cache
management code.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-05-30 22:54:07 +00:00
2d534daaa6 unwind: introduce stacktrace_walker
In current implementation, the stack trace is captured and printed at
the same time, in trace_syscall_exiting.  This approach cannot
provide user expected information when a system call changes the
memory mapping.  In such cases, the stack trace should be captured on
entering syscall and printed on exiting.

As the initial step for splitting capturing from printing, this change
introduces stacktrace_walker utility function.  It can be used both for
capturing in trace_syscall_entering and printing in
trace_syscall_exiting.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-05-30 22:43:04 +00:00
6141392856 unwind: give all exported functions "unwind_" prefix
* unwind.c (init_unwind_addr_space): Rename to unwind_init.
(init_libunwind_ui): Rename to unwind_tcb_init.
(free_libunwind_ui): Rename to unwind_tcb_fin.
(delete_mmap_cache): Rename to unwind_cache_invalidate.
(print_stacktrace): Rename to unwind_print_stacktrace.
* defs.h: Update prototypes.
* mem.c: All callers updated.
* process.c: Likewise.
* strace.c: Likewise.
* syscall.c: Likewise.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-05-30 22:40:22 +00:00
7721499fc7 unwind: delete mmap cache in free_libunwind_ui
free_libunwind_ui is expected to release all unwind related resources
attached to tcp.

* strace.c (droptcb): Move delete_mmap_cache call ...
* unwind.c (free_libunwind_ui): ... to here.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-05-30 22:30:07 +00:00
b65042fbdb unwind: make alloc_mmap_cache function local
* defs.h (alloc_mmap_cache): Remove.
* unwind.c (alloc_mmap_cache): Add static qualifier.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2014-05-30 22:28:15 +00:00
b4a2de8eff unwind: fix a bug in range updating of binary search
* unwind.c (print_stacktrace): Fix off-by-one error in binary search.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Luca Clementi <luca.clementi@gmail.com>
2014-05-30 22:26:42 +00:00
327064b637 Add -k option to print stack trace after each syscall
Print the stack trace of the traced process after each system call when
-k option is specified.  It is implemented using libunwind to unwind the
stack and to obtain the function name pointed by the IP.

Based on the code that was originally taken from strace-plus
of Philip J. Guo.

* configure.ac: Add --with-libunwind option.  Check libunwind support.
* Makefile.am: Add libunwind support.
* defs.h (struct tcb) [USE_LIBUNWIND]: Append libunwind specific fields.
[USE_LIBUNWIND] (stack_trace_enabled, alloc_mmap_cache,
delete_mmap_cache, print_stacktrace): New prototypes.
* mem.c (print_mmap, sys_munmap, sys_mprotect): Add libunwind support.
* process.c (sys_execve): Likewise.
* strace.c (usage, alloctcb, droptcb, init): Likewise.
* syscall.c (trace_syscall_exiting): Likewise.
* unwind.c: New file.
* strace.1: Document -k option.
2014-05-30 22:24:31 +00:00
6dbbe0737a 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.
2014-05-30 22:10:21 +00:00
d8ad1ddc76 Check for constants used by waitid function
* configure.ac (AC_CHECK_DECLS): Add P_* constants.
2014-05-30 22:10:21 +00:00
baf60d92f1 Check for LO_FLAGS_READ_ONLY constant
* configure.ac (AC_CHECK_DECLS): Add LO_FLAGS_READ_ONLY.
2014-05-30 22:10:21 +00:00
d35bdcad13 Compress blank lines
Suppress empty lines left after automated xlat conversion.
2014-05-30 22:10:21 +00:00
63ebcfc559 xlat: cleanup the aftermath of automatic conversion 2014-05-30 22:10:00 +00:00
0ed617bd66 Generate xlat/*.in files
Automatically convert xlat structures from *.c files to xlat/*.in files
using "./generate_xlat_in.sh *.c" command.
2014-05-30 21:40:03 +00:00
297b59401c 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.
2014-05-30 21:39:04 +00:00
5153b5cd68 Enhance xlat generator
* xlat/gen.sh: Define all xlat structs not declared in defs.h as static.
Some symbolic constants are not macros, extend #ifdef check to cover
symbolic constants checked by AC_CHECK_DECLS.
Handle complex symbolic constants in SYMBOL|... form.
Handle symbolic constants in 1<<SYMBOL form.
Handle numeric constants.
Implement #unconditional directive that turns off preprocessor checks.
Implement #unterminated directive that turns off adding XLAT_END.
2014-05-30 21:33:02 +00:00
3e69bdf41a Use bootstrap script consistently
Now that ./xlat/gen.sh has to be run before autoreconf,
replace all autoreconf calls with ./bootstrap call.

* bootstrap: Forward arguments to autoreconf.
* build_static_example.sh: Replace autoreconf call with bootstrap call.
* make-dist: Likewise.
* qemu_multiarch_testing/README: Likewise.
2014-05-30 21:31:08 +00:00
761ed9ba42 Implement xlat generator
* bootstrap: New file.
* xlat/gen.sh: Likewise.
* Makefile.am: Include xlat/Makemodule.am
(EXTRA_DIST): Add $(XLAT_INPUT_FILES), $(XLAT_HEADER_FILES), and
xlat/gen.sh.
2014-05-30 21:29:40 +00:00
e25fb4fd8e 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.
2014-05-30 15:18:00 +00:00
f23b097fc5 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.
2014-05-30 00:20:53 +00:00
772e32b67b tests: add a test for -c and -w options
* tests/count.test: New test.
* tests/Makefile.am (TESTS): Add it.
2014-05-30 00:20:44 +00:00
e53bf23f1c 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>
2014-05-29 18:15:38 +00:00
ac5133d0cb 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.
2014-05-29 18:10:00 +00:00
447db45365 Constify tv_* functions
* defs.h (tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_mul, tv_div): Add
const qualifier to read only arguments.
* util.c (tv_nz, tv_cmp, tv_float, tv_add, tv_sub, tv_mul, tv_div):
Likewise.
2014-05-29 17:59:01 +00:00
3a3b71c7d8 Use printstr for sethostname, setdomainname, and gethostname decoding
The argument passed to sethostname and setdomainname syscalls, as well
as the string returned by gethostname syscall, is not a pathname, so
printpathn is not the right method for its decoding.

* process.c (sys_sethostname, sys_setdomainname): Decode 1st argument
using printstr instead of printpathn.
[ALPHA] (sys_gethostname): Likewise.
2014-05-28 18:09:46 +00:00
3b09ebe724 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>
2014-05-21 00:22:07 +00:00
b2ede14797 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>
2014-05-13 23:22:47 +00:00
985425a30b mips: fix syscall entries that should have TP flag set 2014-05-12 20:37:48 +00:00
10b735a6f9 xtensa: fix unshare syscall entry 2014-05-12 20:37:48 +00:00
117d13d0de alpha, hppa, mips n64: fix waitid syscall entry 2014-05-12 20:37:48 +00:00
cd96f77ef8 Add TM flag to shmat and shmdt syscall entries 2014-05-12 20:37:20 +00:00
6556315493 Alias sys_vfork to sys_fork
* process.c (sys_vfork): Remove.
* linux/syscall.h (sys_vfork): Likewise.
* linux/dummy.h (sys_vfork): Alias to sys_fork.
* linux/alpha/syscallent.h: Fix vfork entry.
* util.c (setbpt): Do not check for sys_vfork.
* syscall.c (syscall_fixup_for_fork_exec): Likewise.
2014-05-12 20:26:24 +00:00
e51ce47b11 epoll_ctl: fix EPOLL_CTL_DEL argument decoding
* desc.c (sys_epoll_ctl): Do not parse the event structure for
EPOLL_CTL_DEL operation.

Reported-by: Марк Коренберг <socketpair@gmail.com>
2014-04-17 14:33:59 +00:00
fb7ae846c6 Update CLOCK_* constants
* time.c (clocknames): Add CLOCK_BOOTTIME, CLOCK_REALTIME_ALARM,
CLOCK_BOOTTIME_ALARM, CLOCK_SGI_CYCLE, and CLOCK_TAI.
Fixes RH#1088455.
2014-04-17 14:18:13 +00:00
7845a42b39 Fix preadv/pwritev offset decoding
* util.c (printllval): Add align argument.
* defs.h (printllval): Update prototype.
(printllval_aligned, printllval_unaligned): New macros.
* file.c (sys_readahead, sys_truncate64, sys_ftruncate64, sys_fadvise64,
sys_fadvise64_64, sys_sync_file_range, sys_sync_file_range2,
sys_fallocate): Replace printllval call with printllval_aligned.
* io.c (sys_pread, sys_pwrite): Likewise.
(sys_preadv, sys_pwritev): Replace printllval call with
printllval_unaligned.
* linux/arm/syscallent.h: Set the number of preadv and pwritev
arguments to 5.
* linux/mips/syscallent-o32.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.

Reported-by: Dima Kogan <dima@secretsauce.net>
2014-04-17 13:39:49 +00:00
cc3d59199d tests: add a test for pread/pwrite and preadv/pwritev offset decoding
* tests/uio.c: New file.
* tests/uio.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add uio.
(uio_CFLAGS): Define.
(TESTS): Add uio.test.
2014-04-16 23:49:33 +00:00
99a0544f01 Refactor LDT decoding
* configure.ac (AC_CHECK_TYPES): Remove struct user_desc.
* ldt.c: New file.
* Makefile.am (strace_SOURCES): Add ldt.c.
* mem.c: Do not include <asm/ldt.h>.
(print_ldt_entry): Remove.
(sys_modify_ldt, sys_set_thread_area, sys_get_thread_area): Move...
* ldt.c: ... here.
* process.c: Do not include <asm/ldt.h>.
(sys_clone) [I386 || X86_64 || X32]: Use print_user_desc.
2014-04-10 15:29:13 +00:00
329fa3919d 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>
2014-04-10 09:57:17 +02:00
15bc281269 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.
2014-04-09 13:14:44 +00:00
662221cab3 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.
2014-04-09 12:46:05 +00:00
f94e84780e x32: decode clone LDT user_desc entries for x86 processes
* mem.c [X32]: Include asm/ldt.h.
[X32] (print_ldt_entry, sys_modify_ldt, sys_set_thread_area,
sys_get_thread_area): Define.
* process.c [X32]: Include asm/ldt.h.
(sys_clone) [X32]: Decode LDT entry if current_personality == 1.
2014-04-09 12:37:01 +00:00
44655a451e 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>
2014-04-09 12:36:47 +00:00
2c4fb25766 x32: fix clone(2) argument order for x86 processes
Apply the same fix that was made for x86_64.

* process.c [X32] (ARG_CTID, ARG_TLS): Take current
personality into account.
2014-04-09 12:34:58 +00:00
b563325f0a 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>
2014-04-09 12:33:12 +00:00
391c0d8cc5 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>
2014-04-06 23:25:36 +00:00
0160e16108 ARM EABI: disable OABI support by default
OABI is rarely used in ARM EABI systems nowadays, so disable its support
by default.  Add --enable-arm-oabi option to enable ARM OABI support.

* configure.ac: New option --enable-arm-oabi.
* syscall.c (get_scno) [ARM]: Check ENABLE_ARM_OABI macro defined by
configure instead of undocumented STRACE_KNOWS_ONLY_EABI macro.
2014-03-20 22:21:51 +00:00
a07cfcc133 Fix stat decoding for LP64 bionic
Patch fb642bb6d6 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>
2014-03-12 21:29:12 +00:00
2394a3d0e5 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>
2014-03-11 22:56:42 +00:00
033fb910a2 Cleanup socketpair decoding
The only supported domain for socketpair syscall is AF_UNIX, so
no decoding related to other domains is required for socketpair.

* net.c (sys_socketpair): Remove support for PF_INET and PF_IPX domains,
print the protocol argument as is.
2014-03-11 22:50:39 +00:00
bc091e3ce1 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.
2014-03-11 22:18:40 +00:00
b9d4d21a61 Update siginfo codes
* signal.c (siginfo_codes): Add SI_DETHREAD.
2014-03-11 01:57:02 +00:00
4a524dbbdf Factor out printing of si_pid and si_uid members of siginfo_t
* signal.c (printsigsource): New function.
(printsiginfo): Use it.
2014-03-11 00:47:01 +00:00
4dd1e89cb8 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>
2014-03-10 19:33:49 +00:00
7a28f7f128 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>
2014-03-03 23:54:14 +00:00
54cabefc75 Fix fcntl decoding
Assume that F_SETLK64, F_SETLKW64, and F_GETLK64 are either defined or
not defined altogether.
Do not assume that sizeof(off_t) < sizeof(long long) when F_SETLK64 is
undefined.

This change fixes build with musl libc on x86.

* configure.ac: Define SIZEOF_OFF_T.
* desc.c (USE_PRINTFLOCK64): New macro.
(struct flock64, printflock64): Do not define on X32.
(printflock): Replace X32 specific workaround with SIZEOF_OFF_T check.
Fix printing off_t members of struct flock.
(sys_fcntl): Use USE_PRINTFLOCK64.
2014-03-03 23:30:04 +00:00
ec21e07441 sys_fcntl: remove F_FREESP and F_FREESP64 support
F_FREESP and F_FREESP64 fcntl commands are not available in Linux
and therefore the code implementing their decoding is useless.
Besides that, F_FREESP64 decoding is too complicated to support.

* desc.c (fcntlcmds): Remove F_FREESP and F_FREESP64.
Remove F_FREESP64 from the check whether to define struct flock64.
(sys_fcntl): Remove F_FREESP and F_FREESP64 support.
2014-03-01 21:17:17 +00:00
458b3f2fd9 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>
2014-02-28 23:35:21 +00:00
fb642bb6d6 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>
2014-02-28 23:35:05 +00:00
1d912aff16 Remove obsolete ioctlsort.c
The generic version of ioctlsort.c became obsolete after commit
v4.6-240-g5afdf12 that removed its last non-Linux users.

* ioctlsort.c: Remove.
* Makefile.am (EXTRA_DIST): Remove ioctlsort.c.

Reported-by: Elliott Hughes <enh@google.com>
2014-02-28 22:44:43 +00:00
d153bfc505 Add multi-personality support to stack_t decoding
stack_t is one of many structures that contain members
whose size differs between 32-bit and 64-bit personalities.

* signal.c (print_stack_t): Decode 32-bit stack_t on a 64-bit host.

Reported-by: Elliott Hughes <enh@google.com>
2014-02-27 22:35:39 +00:00
38593e942a Rewrite signal mask decoding without sigset_t
The sigset_t provided by libc is not quite convenient.
In glibc, sigset_t is an array with space for 1024 bits, which is much
more than required: all architectures supported by Linux have only 64
signals except MIPS, which has 128.
In bionic libc, LP32 sigset_t is only 4 bytes long, which is less than
necessary.

With this change, signal mask is decoded without use of intermediate
sigset_t structure, which saves us some cpu cycles in case of glibc with
its inflated sigset_t, and enables build with libcs where sigset_t is
broken.

Old implementation used to check each signal number in the given signal
mask twice using sigismember().
New implementation is based on popcount and next_set_bit() so it's
noticeably faster.

* configure.ac: Check for __builtin_popcount.
* signal.c: Ensure that NSIG >= 32.
(sprintsigmask, sprintsigmask_long, printsigmask): Remove.
(popcount32, sprintsigmask_n): New functions.
(tprintsigmask_addr, sprintsigmask_val, tprintsigmask_val): New macros.
(print_sigset_addr_len, sys_sigsetmask, sys_sigreturn, sys_siggetmask,
sys_sigsuspend, sys_sigprocmask, decode_new_sigaction): Update to use
new signal mask decoding interface.
* tests/sigaction.c (main): Add a test with almost filled signal mask.
* tests/sigaction.awk: Update.
2014-02-27 00:28:39 +00:00
d354130b3a Fix build with Bionic libc
Add generic tests for fopen64 and fputs_unlocked functions to fix build
with Bionic libc that does not provide them.

* configure.ac (AC_CHECK_FUNCS): Add fopen64 and fputs_unlocked.
* strace.c [_LARGEFILE64_SOURCE]: Use fopen instead of fopen64
if !HAVE_FOPEN64.
Use fputs instead of fputs_unlocked if !HAVE_FPUTS_UNLOCKED.
* vsprintf.c: Use fputs instead of fputs_unlocked
if !HAVE_FPUTS_UNLOCKED.

Reported-by: Elliott Hughes <enh@google.com>
2014-02-26 00:01:00 +00:00
a78d777c86 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>
2014-02-25 23:33:30 +00:00
fdb896e577 Do not compile scsi ioctl decoding if <scsi/sg.h> is not available
Add a generic test for <scsi/sg.h> availability to fix build with
Bionic libc that does not provide <scsi/sg.h>.

* configure.ac (AC_CHECK_HEADERS): Add scsi/sg.h.
* ioctl.c (ioctl_decode): Do not call scsi_ioctl if !HAVE_SCSI_SG_H.
* scsi.c: Do not compile scsi ioctl decoding if !HAVE_SCSI_SG_H.

Reported-by: Elliott Hughes <enh@google.com>
2014-02-25 23:15:20 +00:00
a7c6e5143c 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 61e426e87a.
2014-02-14 22:31:10 +00:00
b0c2a9dd5d tests: tighten sigaction check
* tests/sigaction.awk: Check that input conatins all expected lines.
2014-02-08 00:50:10 +00:00
5c7f627f05 Fix sigaction reporting on non-x86 architectures
If SA_RESTORER is not defined by libc headers but defined by kernel
headers, use the definition provided by kernel headers for proper
sigaction decoding.

* signal.c [!SA_RESTORER]: Define to ASM_SA_RESTORER if the latter is
defined, regardless of architecure.
2014-02-08 00:50:09 +00:00
ab3953b047 Check for SA_RESTORER definition in <asm/signal.h>
Kernel header <asm/signal.h> cannot be included from regular code
because it conflicts with libc headers, but SA_RESTORER is needed in
signal.c, so SA_RESTORER value is forwarded from <asm/signal.h> to
config.h using a configure check.

* configure.ac (ASM_SA_RESTORER): Define if SA_RESTORER is defined
in <asm/signal.h>.
2014-02-08 00:49:50 +00:00
ad138ccb80 arm: fix compilation warning
Fix "dereferencing type-punned pointer will break strict-aliasing rules"
warning introduced by commit v4.8-54-g670b21b.

* signal.c (sys_sigreturn) [ARM]: Avoid dereferencing type-punned pointers.
2014-02-07 18:02:39 +00:00
900ec1b042 kexec: fix typo
* kexec.c (print_kexec_segments) [SUPPORTED_PERSONALITIES == 1]: Fix typo.
2014-02-06 21:13:36 +00:00
61e426e87a 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>
2014-02-06 20:48:36 +00:00
3acf4035ea 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.
2014-02-05 23:41:50 +00:00
fc4727de60 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.
2014-02-05 18:03:46 +00:00
f67502e404 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.
2014-02-05 16:17:02 +00:00
2f332e937a 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.
2014-02-05 15:43:04 +00:00
9aaf88c000 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.
2014-02-05 14:51:19 +00:00
90aa9f4d72 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.
2014-02-05 14:25:20 +00:00
d21f186a94 Use prepared editions of recently imported linux headers
* linux/fanotify.h: Replace with edition prepared with headers_install.sh.
* linux/personality.h: Likewise.
2014-02-05 12:56:26 +00:00
99db95dd03 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.
2014-02-05 04:55:21 +00:00
5945273533 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/
2014-02-05 02:28:18 +00:00
82b1ea7c3f Itroduce XLAT_END macro to make xlat structures more compact
* defs.h (XLAT_END): New macro.
2014-02-05 02:28:17 +00:00
2a32eaa157 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.
2014-02-05 02:28:16 +00:00
9f56d87cc4 Convert futexops to XLAT form
* process.c: Define FUTEX_*_PRIVATE macros.
(futexops): Convert to XLAT form.
2014-02-05 02:28:00 +00:00
bae549e91b Convert sigev_value to XLAT form
* time.c (sigev_value): Convert to XLAT form.
(printsigevent32, printsigevent): Update use of sigev_value.
2014-02-05 01:46:10 +00:00
bce0cc6a2d Use XLAT macro
Automatically convert all xlat structures to XLAT form
using the following sed regexp:
s/^[[:space:]]*{[[:space:]]*\([^",}[:space:]]\+\)[[:space:]]*,[[:space:]]*"\1",\?[[:space:]]*}[[:space:]]*/\tXLAT(\1)/
2014-02-05 01:33:50 +00:00
a69ddcb672 Introduce XLAT macro to ease maintenance of xlat structures
* defs.h (XLAT): New macro.

Suggested-by: Mike Frysinger <vapier@gentoo.org>
2014-02-05 01:28:45 +00:00
b88a6f877e 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>
2014-02-04 00:03:08 +00:00
a5fea9060f 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>
2014-02-03 22:24:09 +00:00
cdf022afa4 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>
2014-02-03 22:16:50 +00:00
894c7e3858 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>
2014-02-02 16:51:22 +00:00
123d401508 tests: rename all tests so that their names end in .test suffix
Due to automake limitations, some features work only for tests
that end in one of the suffixes listed in TEST_EXTENSIONS.

* tests/detach-running: Rename to detach-running.test.
* tests/detach-sleeping: Rename to detach-sleeping.test.
* tests/detach-stopped: Rename to detach-stopped.test.
* tests/net: Rename to net.test.
* tests/ptrace_setoptions: Rename to ptrace_setoptions.test.
* tests/qual_syscall: Rename to qual_syscall.test.
* tests/sigaction.sh: Rename to sigaction.test.
* tests/stat: Rename to stat.test.
* tests/strace-f: Rename to strace-f.test.
* tests/Makefile.am (TESTS): Update.
(LOG_COMPILER): Rename to TEST_LOG_COMPILER.
2014-02-02 16:49:41 +00:00
aa4633c76e net: add more sockopt options
This syncs with the defines as available in linux-3.13.

* net.c (sockipoptions): Add IP_IPSEC_POLICY, IP_XFRM_POLICY,
IP_PASSSEC, IP_TRANSPARENT, IP_ORIGDSTADDR, IP_RECVORIGDSTADDR,
IP_MINTTL, IP_NODEFRAG, IP_UNBLOCK_SOURCE, IP_BLOCK_SOURCE,
IP_ADD_SOURCE_MEMBERSHIP, IP_DROP_SOURCE_MEMBERSHIP, MCAST_JOIN_GROUP,
MCAST_BLOCK_SOURCE, MCAST_UNBLOCK_SOURCE, MCAST_LEAVE_GROUP,
MCAST_JOIN_SOURCE_GROUP, MCAST_LEAVE_SOURCE_GROUP, IP_MULTICAST_ALL,
IP_UNICAST_IF.
2014-01-31 00:11:49 +00:00
2b4bb1c445 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>
2014-01-08 17:48:48 +00:00
ac655a878e Factor out struct sigaction printing code
* signal.c [HAVE_SIGACTION] (decode_old_sigaction): New function.
[HAVE_SIGACTION] (sys_sigaction): Use it.
(decode_new_sigaction): New function.
(sys_rt_sigaction): Use it.
2014-01-08 17:48:34 +00:00
66a15a5bb8 tests: add a test for rt_sigaction output
Since "struct sigaction" varies between architectures, rt_sigaction
decoding sometimes produces incorrect output.  This test is expected
to catch basic rt_sigaction decoding bugs.

Based on a patch proposed by Chris Dearman.

* tests/sigaction.c: New file.
* tests/sigaction.awk: Likewise.
* tests/sigaction.sh: New test.
* tests/Makefile.am (check_PROGRAMS): Add sigaction.
(TESTS): Add sigaction.sh.
(EXTRA_DIST): Add sigaction.awk.
* tests/.gitignore: Add sigaction.
2014-01-08 17:48:25 +00:00
b5530a1f89 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>
2014-01-05 22:00:46 +00:00
94e246ac57 Delete old PTRACE_{PEEK,POKE}USR logic
The code base has settled on PTRACE_{PEEK,POKE}USER (with an E) and has
logic in defs.h to make sure it's set sanely.  Delete this old logic as
the defs.h takes care of it now.

* process.c: Delete PTRACE_PEEKUSR/PTRACE_POKEUSR defines.
* signal.c: Likewise.
* syscall.c: Delete PTRACE_PEEKUSR define.
* util.c: Likewise.
2013-12-31 07:50:09 +00:00
5e7470386e Decode the O_PATH flag
* file.c (open_mode_flags): Add O_PATH.
2013-12-31 07:48:51 +00:00
5b35147cad Remove unused configure checks
* configure.ac (AC_CHECK_FUNCS): Remove _sys_siglist and sys_siglist.
(AC_CHECK_DECLS): Likewise.
2013-11-13 22:50:32 +00:00
03ef0b2665 Assume that <sys/ptrace.h> provides a valid ptrace prototype
We used to explicitly list architectures where <sys/ptrace.h> from glibc
is known to provide a valid prototype for ptrace, and use a homegrown
replacement for all the rest.  Situation seems to be better nowadays,
glibc is not the only libc available, so let's use ptrace prototype from
<sys/ptrace.h> by default, leaving the replacement for rare broken cases
if any.

* defs.h: Use ptrace prototype workaround iff
NEED_PTRACE_PROTOTYPE_WORKAROUND is defined.
2013-11-13 22:13:35 +00:00
0506f0f430 Stop using _LFS64_LARGEFILE
There is only one place left in the code where strace guesses whether
libc provides LFS64 functions and structures.  The most natural thing to
do there is to check for _LARGEFILE64_SOURCE - the macro provided by
glibc.  Other libc implementations that provide nondegenerate LFS64
interfaces are expected to define this macro as well.

* defs.h (_LFS64_LARGEFILE): Remove.
* strace.c: Use _LARGEFILE64_SOURCE instead of _LFS64_LARGEFILE.
2013-11-12 22:44:40 +00:00
157f98aac5 Define truncate64, ftruncate64, and getdents64 decoders unconditionally
These decoders are referenced by most architectures, there were no
undefined references so far because _LFS64_LARGEFILE appears to be
always defined by glibc when _GNU_SOURCE is defined.

* file.c (sys_truncate64, sys_ftruncate64, sys_getdents64): Define
unconditionally.
2013-11-12 22:25:06 +00:00
594eb8f8f8 Define printflock64 only if it is referenced by other code
* configure.ac (AC_CHECK_TYPES): Add struct flock64.
* desc.c (HAVE_F_SETLK64, HAVE_F_SETLKW64, HAVE_F_GETLK64): New macros.
[!HAVE_STRUCT_FLOCK64] (struct flock64): Define.
(printflock64): Define only if referenced by other code.
(sys_fcntl): Handle F_FREESP64, F_SETLK64, F_SETLKW64, and F_GETLK64 iff
these constants are defined and differ from their non-64bit versions.
2013-11-12 22:10:44 +00:00
6974bd4f5f Make PTRACE_PEEKUSER/PTRACE_POKEUSER checks less glibc specific
* configure.ac (AC_CHECK_DECLS): Add PTRACE_PEEKUSER and
PTRACE_POKEUSER.
* defs.h: Define PTRACE_PEEKUSER and PTRACE_POKEUSER only if
they are not provided by <sys/ptrace.h>.

Reported by John Spencer.
2013-11-12 21:20:50 +00:00
840a253bac Remove unneeded redefinitions of IPPROTO_* macros
IPPROTO_* macros are defined by <netinet/in.h>, no need to redefine
them.

* net.c (IPPROTO_EGP, IPPROTO_PUP, IPPROTO_IDP, IPPROTO_IGMP,
IPPROTO_RAW, IPPROTO_MAX): Remove.

Reported by John Spencer.
2013-11-12 16:13:43 +00:00
437ae19fc8 Remove unused AC_OFF_T_IS_LONG_LONG configure check
* configure.ac: Remove AC_OFF_T_IS_LONG_LONG.
* m4/long_long.m4: Likewise.
2013-11-12 15:43:06 +00:00
70e84c4e25 Remove unused code
* configure.ac (AC_CHECK_TYPES): Remove struct opthdr and
struct t_opthdr.
* net.c (print_sock_optmgmt): Remove.
2013-11-12 15:39:09 +00:00
e2de3bdd12 Use struct sigcontext instead of struct sigcontext_struct
* configure.ac (AC_CHECK_TYPES): Remove struct sigcontext_struct.
* signal.c (sys_sigreturn) [S390 || S390X || POWERPC || ALPHA): Replace
struct sigcontext_struct with struct sigcontext.

Reported by John Spencer.
2013-11-12 15:27:38 +00:00
e19a712aae Use standard names of sched_param structure members
* process.c (sys_sched_setscheduler, sys_sched_getparam,
sys_sched_setparam): Use portable struct sched_param member name
sched_priority instead of glibc specific __sched_priority.

Reported by John Spencer.
2013-11-12 15:12:16 +00:00
ae5aa47370 Make SIGEV_THREAD_ID decoding less glibc specific
SIGEV_THREAD_ID decoding requires access to an internal member of
struct sigevent.  There seems to be no portable way to do it besides
adding a configure check.

* configure.ac (AC_CHECK_MEMBERS): Check for
struct sigevent._sigev_un._pad and struct sigevent.__pad.
* time.c (printsigevent): Use an appropriate struct sigevent member
to print thread id.

Reported by John Spencer.
2013-11-12 15:00:13 +00:00
a0e02f5d52 Remove unused configure checks
* configure.ac (AC_CHECK_MEMBERS): Remove T_conn_res.QUEUE_ptr,
T_conn_res.ACCEPTOR_id, dqblk.dqb_curblocks, sigcontext.sc_hi2.
2013-11-11 15:59:49 +00:00
18bce8c23a Assume "long long" availability
Most of the code already uses long long types unconditionally.

* configure.ac: Remove the check for long long.
* file.c (printstat64): Remove HAVE_LONG_LONG checks, use %llu format
string unconditionally.
2013-11-11 15:58:20 +00:00
d64a7e4755 Include <sys/poll.h> only if there is no <poll.h>
* pathtrace.c: Do not include <sys/poll.h> if <poll.h> is available.
* stream.c: Likewise.
2013-11-11 15:27:01 +00:00
2b64034786 Move io_* syscalls decoding to a separate file
* desc.c (sys_io_setup, sys_io_destroy, sys_io_submit, sys_io_cancel,
sys_io_getevents, declarations from libaio.h): Move to ...
* aio.c: new file.
* Makefile.am (strace_SOURCES): Add aio.c.
2013-11-11 15:06:18 +00:00
2df03c494e Stop using external libaio.h.
This change incorporates a partial copy instead
of using external libaio.h.
Why?
Because we want to properly decode 32-bit aio calls
by 64-bit strace. For that, we need more definitions than
libaio.h provides.
(These defs are not done yet, but will eventually be done).
Keeping our local 32-bit compat defs in sync with libaio.h
_without seeing libaio structs_ is hard/more bug prone.
A smaller benefit is that we don't need libaio installed.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-11-11 12:50:47 +01:00
abd2fda380 sys_io_submit: simplify iocb_cmd_lookup() helper.
This helper returns two values (a string and an enum).
The caller prints the string. It's simpler to just print
the string in the caller itself. This eliminates
"return by reference" and more importantly, an intermediate
static string buffer for the string result.

Since function of the helper is different now,
it is renamed to tprint_lio_opcode().

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-11-11 12:31:18 +01:00
ab24d51828 sys_io_submit: stop traversing iocb vector after first failure.
The program may use a very large nr but supply either outright
invalid iocbpp[], or one with far fewer elements than nr.
We used to try reading iocbpp[i] until i == nr.
With this change, we stop on the first failure.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-11-11 12:24:29 +01:00
64778cbfa6 Fix pathtrace_match() to match recent fixes to select decoding.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-11-09 20:46:55 +01:00
b338f2d65e Fix select decoding on e.g. 32-bit ppc process by 64-bit strace.
Added next_set_bit() function which finds the next set bit,
properly taking into account word size of the traced process.
Use it in decode_select() instead of fd_isset().
Also, properly round fdsize up to word size of traced process,
not to strace's word size.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-11-09 20:40:31 +01:00
1297a513da Speed up and explain fd_isset()
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-11-06 11:34:02 +01:00
85db86e6d9 Add a test for the latest select decoding fix
* test/select.c (main): Add a test for nfds larger than FD_SETSIZE.
2013-11-05 23:35:56 +00:00
c2982b5b72 Fix select decoding for glibc in _FORTIFY_SOURCE mode
glibc in _FORTIFY_SOURCE mode raises SIGABRT when descriptor greater
or equal to FD_SETSIZE is passed to FD_ISSET.  Select family syscalls,
however, can legitimately accept such descriptors.  To overcome this
limitation, we have to replace FD_ISSET with an equivalent that imposes
no such restrictions.

* desc.c (fd_isset): New function.
(decode_select): Use it instead of FD_ISSET.
2013-11-05 23:35:37 +00:00
f3696b3c8b More select decoding fixes
* desc.c (decode_select): Actually print arg[0] as int on entering
syscall.  When arg[0] is negative, do not attempt to fetch and decode
descriptor sets on entering syscall, kernel will reject it anyway.
On exiting syscall, stop checking descriptor sets as soon as all
returned descriptors are found.
2013-11-05 22:46:43 +00:00
1f65c3cd2a Truncate arg[0] to int in select decoding.
This matches kernel's behavior.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-11-05 16:20:16 +01:00
c4b9214a0f test/select.c: make comment more understandable.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-11-05 12:44:55 +01:00
025f1082b6 Fix select decoding with bogus (huge or negative) nfds.
We used to allocate and fetch bit arrays using a sanitized
length, but then iterate over them with "j < arg[0]" condition,
where arg[0] is not sanitized. This segfaults if arg[0] is huge
or negative. This change fixes this.

Add test/select.c to capture the case.

Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-11-05 11:54:51 +01:00
0b4060f61f Work around conflict between <sys/ptrace.h> and <linux/ptrace.h>
Since glibc-2.18~39 <sys/ptrace.h> defines ptrace_peeksiginfo_args
which collides with <linux/ptrace.h>.

* configure.ac: Check for `struct ptrace_peeksiginfo_args' in
<sys/ptrace.h>.
* process.c: Work around potential conflict between <sys/ptrace.h>
and <linux/ptrace.h> by redefining ptrace_peeksiginfo_args.
* signal.c: Likewise.
* syscall.c: Likewise.
* util.c: Likewise.

Signed-off-by: Ali Polatel <alip@exherbo.org>
2013-09-26 13:08:43 +00:00
7daacbbbe7 Add support for ARC Cores from Synopsys
Take #2 on mainlining strace support for ARC (last one was 4.6 based back
in March 2011), see
http://sourceforge.net/p/strace/mailman/message/27210168/

The syscall ABI is asm-generic/unistd.h based (so no legacy syscalls),
hence very similar to metag port.

test/* all seem to work well.

* linux/arc/ioctlent.h.in: New file.
* linux/arc/syscallent.h: Likewise.
* Makefile.am (EXTRA_DIST): Add linux/arc/ioctlent.h.in and
linux/arc/syscallent.h.
* configure.ac: Add ARC to the list of supported architectures.
* defs.h: Add ARC support.
* process.c (struct_user_offsets): Likewise.
* signal.c (sys_sigreturn): Likewise.
* syscall.c (print_pc, get_regset, get_regs, get_scno, get_syscall_args,
get_syscall_result, get_error): Likewise.
* util.c (change_syscall): Likewise.

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2013-09-11 14:44:54 +00:00
16b9dcf8b8 Add support for decoding sync_file_range
* file.c (sync_file_range_flags): New xlat structure.
(sys_sync_file_range, sys_sync_file_range2): New functions.
* linux/syscall.h (sys_sync_file_range, sys_sync_file_range2): New
prototypes.
* linux/dummy.h (sys_sync_file_range, sys_sync_file_range2): Remove.
* linux/mips/syscallent-o32.h: Set the number of sync_file_range
arguments to 7.
2013-09-11 14:21:33 +00:00
9e937d9c47 fanotify_mark: fix number of args for 32bit arches
The fanotify_mark func takes a 64bit mask, so 32bit arches have to split
it up into two fields.  When the syscall was added, it was listed as only
having 5 fields total (since that's correct for 64bit systems).

* linux/arm/syscallent.h: Set the number of fanotify_mark arguments to 6.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/metag/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/or1k/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/tile/syscallent1.h: Likewise.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Chris Metcalf <cmetcalf@tilera.com> [for tile]
2013-09-11 13:58:26 +00:00
aca4ff79d1 x86, x86_64: fix compilation warnings
Fix "dereferencing type-punned pointer will break strict-aliasing rules"
warnings introduced by commit v4.8-52-gb51f364.

* signal.c (sys_sigreturn): Avoid dereferencing type-punned pointers.
2013-09-11 13:26:17 +00:00
a877379bcb Remove rt parameter from [s]printsigmask()
In almost all cases, the parameter was 1 ("decode RT sigs too").
This change hardwires it to be 1.

The cases where it was 0 are, and why the change to "decode RT sigs too"
is fine:

IA64: 64-bit arch, all 64 signals fit in one word in any case.
S390[x]: sc.oldmask is a sigset_t on kernel side,
	(sigset_t *)&sc.oldmask[0] does contain all 64 signals.
TILE: uc.uc_sigmask is a sigset_t on kernel side,
	memcpy(&sigm, &uc.uc_sigmask, NSIG / 8) copies all 64 signals.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-18 20:55:30 +02:00
75f4e1fb7d Convert some uses of long_to_sigmask+printsigmask to sprintsigmask_long
This allows to drop long_to_sigmask function,
and a whole bunch of sigset_t variables.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-18 20:55:30 +02:00
46c8acd16b Simplify some sigmask manipulations
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-18 20:55:30 +02:00
8a1ebbbee9 Add compat support for sys_pselect6
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-18 18:10:13 +02:00
e600ac67ee I386: fix signedness mismatch warning
&i386_regs.esp is a pointer to long, not unsigned long.
It needs a cast.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-18 17:40:45 +02:00
5e133aa684 Fix sigset printing via print_sigset().
Replace print_sigset() with print_sigset_addr_len(),
which takes not only addr, but also len parameter.
This allows us to drop "do we need to print RT signals?" parameter,
and this fixes RT signals printing in many syscalls.

sys_epoll_pwait: print RT signals too, print sigmask size argument.

sys_sigprocmask: print_sigset -> print_sigset_addr_len(current_wordsize),
no change in functionality.

sys_sigpending: use print_sigset_addr_len(current_wordsize)
instead of open-coding it.

sys_rt_sigprocmask: use print_sigset_addr_len instead of open-coding it.
sys_rt_sigpending: ditto.
sys_rt_sigsuspend: ditto.
sys_rt_sigtimedwait: ditto.

do_signalfd: print_sigset -> print_sigset_addr_len. This fixes
RT signals printing (wasn't showing them before).

sys_ppoll: ditto.

copy_sigset_len() is folded into its only user, print_sigset_addr_len(),
and copy_sigset() is gone.

While at it, checked kernel sources and noted where kernel enforces
sigset_size == NSIG / 8 (== sizeof(kernel_sigset_t)),
and where it allows word-sized sigset_size ([rt_]sigpending).

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-18 17:31:42 +02:00
80b73a24a9 sys_rt_sigaction: fix sigset copying
In practice, we always copy as many bytes as syscall param says
(8, or 16 on mips). However, malicious program can call sigaction
with wrong sigset size. Such syscall will result in EINVAL,
but we (strace) end up copying 128 bytes (sizeof(sigset_t)),
which copyes some garbage from stack after struct sigaction.

Now we always copy NSIG / 8 bytes (which is 8 bytes, or 16 on mips).

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-18 10:10:46 +02:00
94e10354d8 ARM: remove wrong NSIG = 32 define
ARM in fact has 64 signals (1..64), and NSIG should be 65
(as usual, rememebr that NSIG_libc == NSIG_kernel+1).

I carefully reviewed all usages of NSIG. In syscall.c,
the only usage is:
        for (i = 0; i <= NSIG; i++)
                if (strcasecmp(s, signame(i) + 3) == 0)...
which is safe even if NSIG is way too big - signame(i)
returns a well-formed string for any i.

In signal.c, memcpy(&sigset, &sc.sc_mask, NSIG / 8) is used by
IA64 and TILE code, so ARM change can't affect it. And final
usage is:
 struct new_sigaction::unsigned long sa_mask[NSIG / sizeof(long)];
It will grow on ARM (and become correct in the process).
Its only use is
 memcpy(&sigset, &sa.sa_mask, NSIG / 8);
 printsigmask(&sigset, 1);
which used to copy garbage in high bits, now it will copy actual data.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-18 09:41:20 +02:00
670b21b710 ARM: fix sigreturn decoding
Decoding of test/sigreturn testcase:
Was:
sigreturn() (mask [QUIT TRAP ABRT BUS SEGV USR2 PIPE STKFLT STOP XCPU VTALRM PROF WINCH IO PWR RTMIN]) = 0
Now:
sigreturn() (mask [CHLD RT_1 RT_3 RT_31 RT_32]) = 0

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-17 17:26:56 +02:00
76da831a41 Group USE_CUSTOM_PRINTF define with other tweakables
No code changes.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-16 12:18:59 +02:00
b51f364c42 Improve sigreturn decoding on x86 to show RT signal bits too.
This includes decoding of 32-bit sigreturn by 64-bit strace,
which previously wasn't done.

Added a test for it.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-16 12:06:25 +02:00
9afc2ee682 powerpc: enhance 32/64bit detection
We were using uname to determine if userspace was 32 or 64bit.
This fails when we have a 64bit kernel and a 32bit userspace.

* configure.ac (powerpc*): Similar to x86, use a runtime test
to determine if we are 32 or 64bit.

Signed-off-by: Anton Blanchard <anton@samba.org>
2013-07-12 14:34:12 +00:00
9459dfb891 powerpc: fix some compiler warnings
Fix a number of differing signedness warnings when building on
powerpc.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-12 12:24:02 +02:00
a34deadbb3 powerpc: fix iflag build issue (static -> extern)
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-12 12:22:06 +02:00
c169d94718 PTRACE_SEIZE can set ptrace options immediately, use this feature
This eliminates some rare bugs, such as post-execve SIGTRAP
generation when we attach to a process, and it manages to finish
execve'ing before we set TRACEEXEC option to suppress that.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-10 14:36:28 +02:00
7c41ce2878 If -o|logger is in use, exit trace loop if nprocs == 0.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-08 13:55:04 +02:00
d2e1f42d8a Exit trace loop if got ECHILD, not if nprocs == 0.
Comment gives a testcase which wasn't handled correctly
by the old code.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-08 11:28:27 +02:00
f5730e9614 s390[x]: get rid of syscall_mode, delete code which never triggers
Before this change, the logic was as follows:
syscall entry:
  get_scno:
    syscall_mode = GPR2
    scno = syscall_mode unless syscall_mode == -ENOSYS
    (if -ENOSYS, scn is retrieved by decoding current insn)
  fixup:
    gpr2 = GPR2
    syscall_mode = scno unless syscall_mode == -ENOSYS
    if (gpr2 != syscall_mode) stray_entry
syscall exit:
  get_res:
    gpr2 = GRP2
  fixup:
    syscall_mode = scno unless syscall_mode == -ENOSYS
    if (WAITEXECVE && gpr2 in (-ENOSYS, scno)) gpr2 = 0;
  get_error:
    gpr2 is retval

Entry fixup's if() can never trigger:
regardless whether GPR2 is -ENOSYS or not, syscall_mode is always
equal to GRP2 value there. So it can be removed.

On sysexit path, syscall mode is never used.

Therefore, syscall_mode variable is deleted. grp2 is read from
GPR2 register in get_scno, redundant read in entry fixup is removed.
As a result, entry fixup's s390 code block vanishes completely.

gpr2 variable is renamed s390_gpr2 to match the convention used
by other arches.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-07 12:56:42 +02:00
8b7aa2b35d ARM: add STRACE_KNOWS_ONLY_EABI define which can be used to omit OABI support
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-04 09:54:19 +02:00
6162a3f34f Add paranoia check before passing a long to pid2tcb(int pid)
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-04 09:26:24 +02:00
38eab5d6ea In debug output, show waitpid status with 6 hex digits, not 4
This shows event byte values better (without variable offset):

 [wait(0x01057f) = 29491] WIFSTOPPED,sig=SIGTRAP,EVENT_FORK (1)
 [wait(0x80057f) = 29492] WIFSTOPPED,sig=SIGTRAP,EVENT_STOP (128)
         ^^

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-02 12:18:22 +02:00
519af5ad34 Replace suspicious popen_pid assignment with an obviously correct one
popen_pid = vfork() does work correctly, but for a subtle reason
that wrong assignment of 0 happens in the child _first_,
and _then_ correct value overwrites it in the parent.

(And in a hyphothetical system where vfork = fork,
popen_pid wouldn't be shared, so it will also be ok.)

However, it's not necessary to be difficult.
This change makes it so that assignment is done only in parent.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-02 11:31:24 +02:00
d0ffdf494a Convert trace() from returning int to returning void
The cleanup sequence in error cases, and on normal code path
was nearly the same, no point in duplicating it.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-01 13:02:33 +02:00
5a2483ba25 Remove ia64-specific printing of current address on signal delivery
The address is printed anyway by printleader() if -i is active.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-01 12:49:14 +02:00
c09646aa9e Rename ia32 to ia64_ia32mode, and make it bool, not long
Grepping for just ia32 was turning up many false positives.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-07-01 12:28:17 +02:00
4793221a53 Fold is_restart_error() into its sole user
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-30 23:53:49 +02:00
254b5a7a97 Update qemu_multiarch_testing/README
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-29 14:34:48 +02:00
d083016e03 sys_clone: add a comment about CLONE_PTRACE and CLONE_UNTRACED
No code changes.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-28 18:57:27 +02:00
44a6d04e5e POWERPC: get rid of "static long ppc_result"
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-28 16:47:38 +02:00
6b3016e435 POWERPC: read ppc_regs.nip if -i
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-28 14:51:50 +02:00
7eb893236c POWERPC: if GETREGS fails with EIO, don't try it again
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-28 14:41:30 +02:00
7f5a132c81 Get rid of powerpc_getreg(), it's a copy of upeek()
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-28 14:36:39 +02:00
752e5a02e6 Change upeek() to take pid, not full tcp.
This will be used by next change.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-28 14:35:47 +02:00
14d51a6423 powerpc: Provide a fallback for old kernels without PTRACE_GETREGS
PTRACE_GETREGS was added to the ppc kernel in 2.6.23. In order to
provide backward compatibility for very old kernels, add a manual
fallback.

* syscall.c (powerpc_getreg, powerpc_getregs_old): New functions.
(get_regs): Call powerpc_getregs_old if PTRACE_GETREGS is not supported.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-26 15:57:29 +02:00
ce6e33be1d powerpc: Use PTRACE_GETREGS to fetch all registers
* defs.h: declare ppc_regs and get_regs_error.
* signal.c (sys_sigreturn): Use ppc_regs instead of upeek.
* syscall.c: define ppc_regs.
(printcall): Use ppc_regs instead of upeek.
(get_scno): Replace multiple upeek calls with one PTRACE_GETREGS call.
(get_syscall_result): Likewise.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-26 15:56:53 +02:00
711b17c44b Another manpage tweak
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-26 15:40:13 +02:00
b5370530d5 Manpage update
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-26 15:35:16 +02:00
aeb6e30493 Update build_static_example.sh
Now it also contains a tested example of i686 build on 64-bit host.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-26 15:07:23 +02:00
c8511f07ab In -f mode, do not assume that new pid is stopped - handle exits too
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-26 14:58:03 +02:00
e8681c926c Set strace_child only in the right branch
"strace_child = pid" assignment was racing in NOMMU case
because of vfork (no way to know which process would win).

After this change, strace_child is set to nonzero only
in one process after [v]fork.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-26 14:58:03 +02:00
fadbf6679c Get rid of TCB_INUSE and TCB_STRACE_CHILD
We can use tcb::pid == 0 as an indicator of free tcb,
and we already have strace_child variable which holds
pid of our child, if any.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-26 14:58:03 +02:00
1b2bfbc825 Fix debug output of wait4 result (was reusing buf[] on unknown events)
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-21 16:41:50 +02:00
4e020c0f4b Show PTRACE_EVENT_STOP correctly in debug output
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-21 16:33:56 +02:00
71d3d29a9d Panic a bit less when we see an unknown pid
I stumbeld over this case when I used "exec stace ...".

* strace.c (trace): Do not exit if we see an unknown pid in wait4.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-21 16:19:46 +02:00
e2567d54dd detach(): Reorganize code. Logic is the same.
* strace.c (detach): Use goto's instead of excessive nesting.
Drop sigstop_expected and interrupt_done variables.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-21 16:11:10 +02:00
a2de9dacec Eat pending SIGSTOP _before_ PTRACE_DETACH in detach()
* strace.c (detach): If TCB_IGNORE_ONE_SIGSTOP is set,
di not PTRACE_DETACH - wait for SIGSTOP first.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-21 15:50:41 +02:00
fdfa47af7e detach(): warn if we see ECHILD from waitpid
* strace.c (detach): Warn if we see ECHILD from waitpid.
Explain in comments that we don't normally expect !WIFSTOPPED
either, and also that PTRACE_CONT failure isn't expected
(the "break" there is a "I'm confused, bailing out" code style)..

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-20 15:34:12 +02:00
4a9ba989e6 Improve error messages in detach()
* strace.c (detach): Change return type from int to void.
Improve error meesages: show PID, tell exactly which operation fails.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-20 11:23:00 +02:00
725dd425a6 Remove workarounds for ancient kernels lacking __WALL
__WALL is available and working at least since 2.4 kernels: 10 years ago.

* strace (detach): Remove workarounds for ancient kernels lacking __WALL.
Add missing EINTR check.
(trace): Remove workarounds for ancient kernels lacking __WALL.
Remove redundant double error printout.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-20 11:23:00 +02:00
69e27ef244 USE_SEIZE: fix detaching from stopped processes
V3: split SEIZE/!SEIZE code paths to reduce confusion.
Extensively comment every possible case.
Verified that all tests/detach* tests work in both SEIZE and !SEIZE
cases.

* strace.c (detach): If PTRACE_SEIZE API is in use, stop the tracee
using PTRACE_INTERRUPT instead of sending it a SIGSTOP.
In a subsequent waitpid loop, correctly wait and suppress SIGSTOP
on detach if PTRACE_INTERRUPT wasn't used, or wait for any ptrace
stop and detach without suppressing signals.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-20 11:23:00 +02:00
0d7c3653c5 tests: disable /proc based checks when /proc is not mounted
* tests/detach-running: Disable /proc based checks when
/proc/self/status is not available.
* tests/detach-sleeping: Likewise.
* tests/detach-stopped: Likewise.
2013-06-19 14:57:05 +00:00
a815185d55 tests/detach-{running,sleeping,stopped}: check post-detach state
Check that traced process still exists and is in a right state
after strace detached from it.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-19 16:37:24 +02:00
78460f8bb2 tests: ensure that strace can detach from running processes
* tests/detach-running: New test.
* tests/Makefile.am (TESTS): Add it.
2013-06-19 10:22:18 +00:00
223e9a6f85 tests: ensure that strace does not leave sleeping processes stopped
* tests/detach-sleeping: Do not send SIGCONT to the sleeping process.
2013-06-19 01:05:30 +00:00
3cb7a0cd00 tests: fix parallel-tests support in detach-* tests
* tests/detach-sleeping: Use $LOG file for set_ptracer_any output.
* tests/detach-stopped: Likewise.
2013-06-18 22:37:08 +00:00
1e0a28063f tests: parametrize "sleep 1"
* tests/init.sh (SLEEP_A_BIT): New variable.
* tests/detach-sleeping: Use it.
* tests/detach-stopped: Likewise.
2013-06-18 20:51:49 +00:00
97c85088a2 tests: ensure that strace can detach from sleeping and stopped processes
* tests/set_ptracer_any.c: New file.
* tests/detach-sleeping: New test.
* tests/detach-stopped: Likewise.
* tests/Makefile.am (check_PROGRAMS): Add set_ptracer_any.
(TESTS): Add detach-sleeping and detach-stopped.
* tests/.gitignore: Add set_ptracer_any.
2013-06-18 17:07:48 +00:00
f60347d857 tests: enhance timeout checks
Run each test using a wrapper that does all necessary timeout checks.

* tests/run.sh: New file.
* tests/Makefile.am (EXTRA_DIST, LOG_COMPILER): Add it.
* tests/init.sh (check_strace, check_timeout): Remove.
* tests/detach-stopped: Update callers.
* tests/net: Likewise.
* tests/ptrace_setoptions: Likewise.
* tests/qual_syscall: Likewise.
* tests/stat: Likewise.
* tests/strace-f: Likewise.
2013-06-18 17:07:37 +00:00
3cf90b64ae tests: enable parallel-tests support
* configure.ac (AM_INIT_AUTOMAKE): Add parallel-tests.
2013-06-18 16:58:29 +00:00
107ceb935f tests: prepare for parallel-tests support
* tests/Makefile.am (CLEANFILES): Calculate dynamically from TESTS.
* tests/init.sh (LOG): New variable.
* tests/detach-stopped: Use it.
* tests/net: Likewise.
* tests/qual_syscall: Likewise.
* tests/stat: Likewise.
* tests/strace-f: Likewise.
2013-06-18 16:58:02 +00:00
f1669e7975 Cleanups. No logic changes.
* defs.h: Define new ptrace constants unconditionally.
* strace.c (detach): Fix comment.
(trace): Remove now unnecessary "if USE_SEIZE".

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-06-18 18:15:51 +02:00
02d2c708de maint: post-release administrivia
* NEWS: Add header line for next release.
2013-06-05 21:33:45 +00:00
1cd3f5f844 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.
2013-06-03 16:24:53 +00:00
d845411e8c Prepare for 4.8 release
* NEWS: Update for 4.8 release.
* debian/changelog: 4.8-1.
* strace.spec: 4.8-1.
2013-06-03 12:34:56 +00:00
0db34e7dfa 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.
2013-06-02 18:12:44 +00:00
8e0b8bef34 Fix "make dist" regression introduced by commit v4.7-184-gd648f29
* Makefile.am (EXTRA_DIST): Add linux/ubi-user.h.
2013-06-02 18:09:44 +00:00
e8ff4c6f86 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-28 21:49:16 +00:00
5c0796f346 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.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-05-23 15:41:23 +02:00
d90a2d26c1 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.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-05-23 15:40:34 +02:00
6c19136aca 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.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-05-17 23:18:55 +00:00
0eb7165588 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.
2013-05-17 23:16:39 +00:00
f782201adf Update PTRACE_O_* constants
* process.c (ptrace_setoptions_flags): Sync with Linux 3.9.
2013-05-17 22:22:19 +00:00
ea0d2a60b1 Update AF_*, PF_*, MSG_*, and TCP_* constants
* net.c (domains, addrfams, protocols, socktcpoptions): Sync with
Linux 3.9.
2013-05-17 22:20:02 +00:00
1d2435b20b NOMMU: do not hide startup syscalls unless in -D mode
On NOMMU systems in "strace PROG" case, we have no way to attach to
the tracee before it calls execve unless in -D mode.  That is, the
first execve call is very likely to be missed, and setting
hide_log_until_execve just results to empty log.

* strace.c (init) [NOMMU_SYSTEM]: Do not set hide_log_until_execve
unless in -D mode.
2013-05-14 22:50:11 +00:00
882478a072 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.
2013-05-14 22:29:18 +00:00
7a0fb38386 Update PR_* constants
* process.c (prctl_options): Add PR_SET_PTRACER.
2013-05-14 21:20:58 +00:00
2a3d27552f 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.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2013-05-14 16:10:42 +02:00
01997cf32d 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.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2013-05-13 14:11:31 +00:00
8190912d2e 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-11 21:57:28 +00:00
b1e7cb1777 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.
2013-05-10 22:56:35 +00:00
26ff3f2af4 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-10 22:55:29 +00:00
f9236e6d76 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.
2013-05-08 17:03:24 +00:00
cbd4e922ac 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.
2013-05-08 16:57:53 +00:00
56ef5ef90f tests/net: fix portability issues
* tests/net-accept-connect.c: Fix address length passed to bind()
and connect().
* tests/net: Update regexps.
2013-05-08 14:03:38 +00:00
47b0dcca2b 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.
2013-05-08 02:06:39 +00:00
56fb81c696 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-08 01:54:32 +00:00
de462cf99b Move subcall decoding configuration out of the common code
* Makefile.am (EXTRA_DIST): Add linux/subcall.h.
* linux/syscall.h (SYS_socket_subcall): Remove.
(SYS_socket_nsubcalls, SYS_ipc_subcall, SYS_ipc_nsubcalls): Move to ...
* linux/subcall.h: ... new file.
* linux/arm/syscallent.h: Define SYS_socket_subcall, include subcall.h.
* linux/i386/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.

Suggested by Mike Frysinger and Chris Metcalf.
2013-05-07 16:06:58 +00:00
ebe3d3a640 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 19:03:26 +04:00
3883ab8438 mips: fix build regression
The recent commit (2690fadc8b) 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 14:59:44 +00:00
f6c246f224 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.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
2013-05-07 13:12:41 +00:00
28927cd868 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.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
2013-05-07 13:11:03 +00:00
5273cb7d60 pread, pwrite: fix number of syscall arguments
The number of pread and pwrite arguments depends on architecture and
personality.  For 64bit and ilp32 it equals to 4, for unaligned
32bit it equals to 5, and for aligned 32bit it equals to 6.

* linux/aarch64/syscallent1.h: Change the number of pread and pwrite
arguments to 4.
* linux/alpha/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/or1k/syscallent.h: Change the number of pread and pwrite
arguments to 5.
2013-05-07 09:43:55 +00:00
ea5a079684 preadv, pwritev: fix number of syscall arguments
The number of preadv and pwritev arguments depends on architecture and
personality.  For 64bit and ilp32 it equals to 4, for unaligned 32bit
it equals to 5, and for aligned 32bit it equals to 6.

* linux/aarch64/syscallent1.h: Change the number of preadv and pwritev
arguments to 4.
* linux/alpha/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Change the number of preadv and pwritev
arguments to 6.
* linux/sh/syscallent.h: Likewise.
* linux/xtensa/syscallent.h: Likewise.
2013-05-07 09:43:54 +00:00
54aee7a38c ftruncate64, truncate64: fix number of syscall arguments
The number of ftruncate64/truncate64 arguments depends on architecture
and personality.  For 64bit and ilp32 it equals to 2, for unaligned
32bit it equals to 3, and for aligned 32bit it equals to 4.

* linux/or1k/syscallent.h: Change the number of ftruncate64 and
truncate64 arguments to 3.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Change ftruncate64 and truncate64 handlers.
* linux/sparc/syscallent.h: Change ftruncate64 handler, change the
number of its arguments to 3.
* linux/xtensa/syscallent.h: Change the number of ftruncate64 and
truncate64 arguments to 4.
2013-05-07 09:43:53 +00:00
eb1cc1568c fallocate: fix number of syscall arguments
The number of fallocate arguments depends on architecture and
personality.  For 64bit and ilp32 it equals to 4,
for 32bit it equals to 6.

* linux/aarch64/syscallent1.h: Change the number of fallocate arguments
to 4.
* linux/alpha/syscallent.h: Likewise.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Set fallocate handler and flags.
2013-05-07 09:43:52 +00:00
3f4a41a55d fadvise64, fadvise64_64: fix handlers and number of syscall arguments
The number of fadvise64 arguments depends on architecture and
personality.  For 64bit and ilp32 it equals to 4, for unaligned
32bit it equals to 5, and for aligned 32bit it equals to 6.

The number of fadvise64_64 arguments is 4 for 64bit and ilp32, for
unaligned 32bit and most of aligned 32bit it equals to 6, and for
mips o32 it equals to 7.

* linux/alpha/syscallent.h: Set fadvise64 handler.
* linux/s390/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Set fadvise64_64 handler, change the number
of syscall arguments to 6.
* linux/ia64/syscallent.h: Change the number of fadvise64 arguments
to 4.
* linux/mips/syscallent-n32.h: Likewise.
* linux/tile/syscallent1.h: Change the number of fadvise64 arguments
to 5.
* linux/mips/syscallent-o32.h: Change the number of fadvise64_64
arguments to 7.
* linux/s390x/syscallent.h: Change fadvise64_64 handler.  Set fadvise64
handler.  Change numbers of fadvise64 and fadvise64_64 arguments to 4.
* linux/sh64/syscallent.h: Change fadvise64_64 handler.
Change numbers of fadvise64 and fadvise64_64 arguments to 4.
* linux/sparc/syscallent.h: Set fadvise64 and fadvise64_64 handlers,
change numbers of their arguments to 5 and 6.
* linux/x86_64/syscallent.h: Change fadvise64 handler.
2013-05-07 09:43:51 +00:00
2690fadc8b mips o32: raise the max number of syscall arguments to 7
On mips o32, fadvise64_64 takes 7 arguments.

* defs.h [LINUX_MIPSO32]: Raise MAX_ARGS to 7.
2013-05-07 09:43:50 +00:00
34c445b5c6 mips: split syscallent.h
linux/mips/syscallent.h consisted of several parts that had little in
common.  Split them into separate files to ease maintenance.

* linux/mips/syscallent-compat.h: New file.
* linux/mips/syscallent-n32.h: Likewise.
* linux/mips/syscallent-n64.h: Likewise.
* linux/mips/syscallent-o32.h: Likewise.
* linux/mips/syscallent.h: Include them.
* Makefile.am (EXTRA_DIST): Add them.
2013-05-07 09:43:04 +00:00
4996b3a352 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-07 01:56:09 +00:00
828bbd846e 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 23:39:04 +00:00
2f6519a9c1 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.

Signed-off-by: Chris Zankel <chris@zankel.net>
2013-05-06 23:18:28 +00:00
6b03c9b5ce 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.
2013-05-06 20:43:35 +00:00
53f6795d75 tests/stat: enhance regexps
* tests/stat: Enhance regexps that check tracing of stat/stat64 and
fstatat/fstatat64 syscalls.
2013-05-06 19:15:09 +00:00
6f11acd360 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.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
2013-05-06 18:47:50 +00:00
8e096c4ec5 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 18:23:01 +00:00
a32b683704 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 18:13:34 +00:00
c7b2f0c74e 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.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
2013-05-06 18:09:36 +00:00
6b572cfd2b 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-06 18:08:39 +00:00
554c8beaab s390: fix # of args truncate64/ftruncate64 takes
* linux/s390/syscallent.h: Change nargs to 3 for truncate64/ftruncate64.
2013-05-05 21:19:23 +00:00
2f99788e8f 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-05 08:15:24 +00:00
7a498be266 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 19:51:57 +00:00
80acf62207 Fix building for sparc64 targets
* util.c (printllval): Handle SPARC64 define.
2013-05-04 19:11:04 +00:00
921744d5e7 Fix building for mips n64 targets
* util.c (printllval): Handle LINUX_MIPSN64 define.
2013-05-04 15:58:45 +00:00
8d5f11585c hppa: fix stat64 and fstat64 decoding
* file.c [HPPA]: Do not redefine stat64 to hpux_stat64.
2013-05-03 23:47:17 +00:00
a55b6b193c 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-03 23:45:54 +00:00
d648f29cc3 Decode mtd/ubi ioctls
Been playing with UBI of late and it'd help if I could see what it was
doing.  Not entirely sure about the decoding of UBI_IOCVOLUP -- it takes
a pointer to a 64bit value, not a strict.

* util.c (MAX, MIN): Move to ...
* defs.h (MAX, MIN): ... here.
(CLAMP): Define.
(ubi_ioctl): New prototype.
* ioctl.c (ioctl_decode): Call ubi_ioctl when code is 'o' or 'O'.
* mtd.c: Include ubi user API header.
(ubi_volume_types): New enum decode.
(ubi_volume_props): Likewise.
(ubi_ioctl): Define.
* linux/ubi-user.h: Import from linux 3.8.
2013-05-02 22:50:55 +00:00
48d3159d67 test: add mtd/ubi test helpers
I used these to develop the mtd/ubi ioctl decoders.

* test/.gitignore: Add mtd/ubi.
* test/Makefile: Declare all tests in a PROGS var.
Declare build targets .PHONY.
(all): Depend on $(PROGS) instead of hardcoded list.
(clean): Remove $(PROGS) instead of hardcoded list.
* test/mtd.c: New file.
* test/ubi.c: Likewise.
2013-05-02 22:43:47 +00:00
b51ce62454 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 22:41:50 +00:00
8582f881ee 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 22:14:21 +00:00
1970da0aa8 tests: stat: fix clean up of sample file
* tests/stat: Also rm the sample file at the end of the test.
2013-05-02 22:06:44 +00:00
d26d011078 Ignore more files
* .gitignore: Add gdb related files.
* tests/.gitignore: Ignore test logs.
2013-05-02 22:06:12 +00:00
7ae4a88285 x32: fix decoding of i386 truncate and ftruncate syscalls
* linux/x32/syscallent1.h: Remove sys_*truncate64 redirections.
2013-05-02 08:46:30 +00:00
0b46883339 x32: fix printllval-based decoders of i386 syscalls
* util.c (printllval) [X32]: Handle i386 personality.
2013-05-02 08:45:42 +00:00
318b0dde76 tests: add basic test for ftruncate, lseek and stat family syscalls
* tests/stat: New test.
* tests/Makefile.am (TESTS): Add stat.
2013-05-02 00:44:57 +00:00
0eeda2cdaa 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.
2013-05-01 22:39:10 +00:00
44f0ed1ca5 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.
2013-05-01 15:56:22 +00:00
e67e9f89ca x86_64: decode __old_kernel_stat based syscalls
* linux/x86_64/syscallent1.h: Remove sys_old*stat redirections.
2013-05-01 15:36:13 +00:00
bd2e28ac51 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 15:14:25 +00:00
554e6f3240 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.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
2013-05-01 14:55:54 +00:00
5cf23c53b8 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.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
2013-05-01 14:54:05 +00:00
6303f35779 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.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-05-01 14:49:52 +00:00
bb3a0f7ad3 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.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-05-01 02:47:57 +00:00
dce7593cab 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.
2013-04-30 23:52:12 +00:00
7ae73a91e9 Makefile.am: sort long lists to ease maintenance
* Makefile.am (strace_SOURCES, EXTRA_DIST): Sort, place one list element
per line.
2013-04-30 23:34:51 +00:00
07f022903e 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.
2013-04-30 23:19:17 +00:00
3e3285c6f1 build: fix "make dist" regression introduced by commit v4.7-29-g17e3860
* Makefile.am (EXTRA_DIST): Add linux/ioctlent-filter.awk.
2013-04-30 23:19:16 +00:00
149d7de7e7 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.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-04-30 21:55:54 +00:00
72cdefbb72 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.

Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
2013-03-31 01:32:31 +00:00
d2ab7fd3a0 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.

Signed-off-by: Andreas Schwab <schwab@suse.de>
2013-03-31 00:40:04 +01:00
341d09a8fe AArch64: Fix printing of long long value
* util.c (printllval): Fix printing of long long values on
AArch64.

Signed-off-by: Andreas Schwab <schwab@suse.de>
2013-03-31 00:40:04 +01:00
b6593deac4 Update PR_* constants
* process.c (prctl_options): Add more PR_* constants from linux/prctl.h.
2013-03-27 14:57:39 +00:00
8f636ed128 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.

Signed-off-by: Chris Zankel <chris@zankel.net>
2013-03-25 17:58:57 +00:00
6e5f5b3adb Add example script which builds static (possibly cross-compiled) strace
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-22 15:59:01 +01:00
c8938e08ad 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-21 22:13:52 +00:00
68f80e6d1a Do not use struct dirent in readdir decoding
struct dirent from libc should not be used for umove'ing into because it
contains fixed size d_name.

* file.c (printdir): Rename to print_old_dirent.
[SH64]: Decode using struct kernel_dirent.
[!SH64]: Decode using an open-coded struct with 32-bit d_ino and d_off.
(sys_readdir): Update.
2013-03-20 21:20:13 +00:00
2c42f32518 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-20 14:38:20 +00:00
3b211d8df0 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.
2013-03-18 23:28:29 +00:00
c108ba2dbb 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 22:58:28 +00:00
066a733bc0 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.

Signed-off-by: Maxin B. John <maxin.john@enea.com>
2013-03-18 22:17:41 +00:00
b787b10e16 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.
2013-03-18 12:01:21 +00:00
faa177e3d9 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.
2013-03-18 12:00:57 +00:00
32c049a9d8 Include <sys/uio.h> and <elf.h> on all architectures
* syscall.c: Include <sys/uio.h> and <elf.h> on all architectures.
2013-03-18 11:59:37 +00:00
27e3ae973a x86-64: enhance PTRACE_GETREGSET test
* syscall.c (get_regs) [X86_64]: Check whether PTRACE_GETREGSET
works regardless of the kernel version.
2013-03-18 11:46:36 +00:00
ee348c6073 x32: use PTRACE_GETREGSET unconditionally
* syscall.c (get_regs) [X32]: Assume that PTRACE_GETREGSET always works
regardless of the kernel version.
2013-03-18 11:46:35 +00:00
0482c5a21d x86-64, x32: do not include linux/ptrace.h unnecessarily
* syscall.c [X86_64 || X32]: Stop including linux/ptrace.h.
2013-03-18 11:46:32 +00:00
7d5696f11d i386, tile, x32: do not redefine ptrace prototype
* defs.h [I386 || TILE || X32]: Use ptrace prototype from sys/ptrace.h.
2013-03-18 11:46:26 +00:00
c41808bcd6 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-18 11:46:02 +00:00
3ec134b07a 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-14 18:55:26 +00:00
8050cdc43c 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

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-07 12:27:40 +01:00
5198ed4bb3 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).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-06 23:44:23 +01:00
76f61bec5e Makefile: add commented-out tweak to generate link map
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-06 18:59:09 +01:00
61ad0a401c 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

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-06 18:24:34 +01:00
7672946e74 Fix wrongly indented closing curly brace. No code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-05 17:46:19 +01:00
dafba9bb99 strace_vfprintf: if malloc fails, exit gracefully
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-05 17:29:18 +01:00
c76a363af8 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 16:03:53 +00:00
aba6292797 Emit better message for ERESTARTNOHAND return
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-05 16:56:35 +01:00
cc90291f4b 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

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-05 16:50:12 +01:00
e7db46503d Fix printstrbufarg's address argument to be long, not int
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-05 16:17:46 +01:00
38cfe7c923 Remove variable tracing_paths and check in pathtrace_match
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-05 16:01:53 +01:00
7239dbcf2d 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

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-05 15:46:34 +01:00
f877982aa2 metag,or1k: whitesace style fix. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-05 14:03:07 +01:00
99d3e01eef Assorted fixes to syscallent.h
or1k was missing TM on many memory-related syscalls
sys_lookup_dcookie is 3-arg on 64-bit arches, and isn't TF
sys_recvmsg is 3-arg on all arches
sys_nfsservctl is 3-arg on all arches
sys_timerfd_create is 2-arg on all arches
sys_[f]truncate64 is 4-arg or 3-arg, never 5-arg
truncate64 is TF
sys_[l]lseek is TD
fstat[64] is TD

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-05 13:59:45 +01:00
5f999a869b Add support for Imagination Technologies Meta
Add support for Imagination Technologies Meta architecture (the
architecture/ABI is usually referred to as metag in code). The Meta
Linux kernel port is in the process of being upstreamed for v3.9 so it
uses generic system call numbers.

sys_lookup_dcookie writes a filename to buffer argument, so I've set
TF flag.
nfsservctl appears to be set to sys_ni_syscall in asm-generic/unistd.h
so I've left it blank.
truncate64/ftruncate64/pread64/pwrite64/readahead have unaligned 64bit
args which are packed tightly on metag, so less arguments on metag.
fchdir/llseek takes a file descriptor so s/TF/TD/
sync_file_range has 2 64bit args so uses 6 args, so s/4/6/
timerfd_create/msgget/msgctl/msgrcv/semget/segtimedop/semop/shmget/
shmctl/shmat/shmdt/recvmsg/migrate_pages have different number of args.
oldgetrlimit is just getrlimit for metag.
add TM flag to various memory syscalls.
metag doesn't directly use sys_mmap_pgoff for mmap2.
prlimit64/process_vm_readv/process_vm_writev take a pid so add TP flag.
fanotify_init doesn't appear to take a file descriptor so remove TD.
Add kcmp syscall.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Christian Svensson <blue@cmd.nu>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-05 12:57:06 +01:00
1694092d7d umovestr: speed up check for NUL byte in the fetched word
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-01 18:52:59 +01:00
7b9e45e891 Fix trace=set regression introduced by commit v4.7-111-g9cbc15b
* syscall.c (qual_syscall, qualify): Pass personality down to
qualify_one.
* tests/qual_syscall: New test.
* tests/Makefile.am (TESTS): Add qual_syscall.
2013-03-01 16:22:02 +00:00
879ddddeba tile: handle printllval like x86_64 or powerpc64
Without this fix the tilegx build fails when it hits the new #error
about SIZEOF_LONG > 4.

* util.c (printllval): Fix printing of long long values on TILE.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-03-01 10:41:02 +01:00
22efaf0028 Make -b take SYSCALL param, document it in --help and in manpage.
To not waste an option letter for just one trick,
extend -b to take a parameter:
"on which syscalls do you want to detach?".
Currently supports only execve.

While at it, fixed (by removing non-Linux and stale info)
and extended manpage text about -f.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-27 12:15:19 +01:00
9700592e49 Cleanup umoven and umovestr
Cleanup sloppy error handling.

First, EFAULT kind of errors from process_vm_readv by itself is not
something unusual, so a warning message will not be issued unless a
short read is detected.

Second, clients of umoven and umovestr are not prepared to detect and
handle short reads that can happen in these functions.  The most safe
way to handle them is to return an error code.

* util.c (umoven, umovestr): Cleanup handling of errors coming from
process_vm_readv and PTRACE_PEEKDATA.
2013-02-26 22:11:32 +00:00
1a880cf3bd pathtrace: fix umovestr return code check
* pathtrace.c (upathmatch): Only NUL-terminated strings can be
path-matched, so fix the umovestr return code check to filter out
unsuitable strings.
2013-02-26 22:11:29 +00:00
e6f55240a1 Fix compilation errors uncovered by -Werror=enum-compare
This fixes regression introduced by commit v4.7-111-g9cbc15b.

* syscall.c: Merge all nsyscalls* enums into single enum.
Likewise merge nerrnos*, nsignals*, and nioctlents* into single enums.
2013-02-26 22:07:55 +00:00
905e8e0e2f Mass replace error_msg("%s", "literal") -> error_msg("literal")
There is no need to print literal strings through "%s".
Only untrusted strings such as filenames need that.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-26 12:30:09 +01:00
1d58fe9b3b Make umoven report success as 0, not >=0, stop returning success on partial reads
umoven() uses process_vm_readv() when available but it returns the
return value of that syscall, which is the number of bytes copied,
while its callers expect it to simply return zero on success.

It was causing syscalls that take a user-space argument to print
the abbreviated version, e.g.:

  epoll_ctl(5, EPOLL_CTL_ADD, 10, {...})

Instead of:

  epoll_ctl(5, EPOLL_CTL_ADD, 10, {EPOLLIN, {u32=10, u64=10}})

* util.c (umoven): Make umove[n] report success as 0, not >=0,
stop returning "success" on partial reads.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-26 12:24:25 +01:00
05f325199a Assorted NOMMU fixes
With -D, strdup'ing of pathname is necessary only on NOMMU.

Don't set skip_startup_execve to 1 if NOMMU and not in daemonized mode
(try "strace [-D] -b env echo HI" to see whether we detach on correct execve).

Fix test_ptrace_FOO shortcuts on NOMMU to always assume success
and _properly_ set all variables.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-26 12:00:34 +01:00
38e79bbb25 Shorten help text - no need to show deprecated option -F
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-26 11:33:54 +01:00
859ea8b8cc Merge adjacent tprint's
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-23 20:07:44 +01:00
b43dacd6d1 Correct i > MAX_NSYSCALLS commparison: should be i >= MAX_NSYSCALLS
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-23 18:19:28 +01:00
f90979b701 Fix wrong offset display in dumpstr
BTW, the new code from prev commit is 5 times faster
than old one :)

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-22 15:00:11 +01:00
763258071c Fix a bug in dumpstr (no null termination). Essentially rewrote dumpstr
This is a 14 year old bug (!).

It wasn't biting us merely because outstr[80] was static, thus ended up
in bss and whatever was after it "accidentally" provided the NUL byte.
When dumpstr was changed to use on-stack buffer, the bug reared its ugly head.

This is a rewrite which is smaller and should be significantly faster
for _long_ strings.

   text	   data	    bss	    dec	    hex	filename
 244627	    680	  10860	 256167	  3e8a7	strace.t9/strace
 244563	    680	  10860	 256103	  3e867	strace.ta/strace

* util.c (dumpstr): Rewrite to be faster and smaller.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-22 14:47:39 +01:00
9cbc15b7e7 Eliminate MAX_QUALS, make qualifier array dynamic
MAX_QUALS was 2048, even though most arches used less than 500 entries
in it. MAX_QUALS had to be maintained by hand to be higher than syscall
count. It also limited the highest possible fd to track.

This change makes qual_flagsN[] arrays start sized to the required minimum
(number of syscalls) and grow dynamically if user requested
-e read=BIGNUM. As a precaution, BIGNUM should be < 2^15, but this limit
can be raised with no cost for normal strace invocations.

qual_flags is now a define to qual_vec[current_personality].

As a bonus, this patch aliases sysent, errnoent, signalent, ioctlent
names in one-personality arches to their corresponding <foo>0 arrays,
removing one indirection level.

  text   data    bss    dec    hex filename
244471    700  12928 258099  3f033 strace.t7/strace
244627    680  10860 256167  3e8a7 strace.t8/strace

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-22 13:37:36 +01:00
a9fe13c943 Create and use struct_sysent and struct_ioctlent typedefs.
This is a preparatory mass replace patch with no code changes.

The future change will need to typedef sysent to sysent0,
which results in compile failures when "struct sysent" string
gets mangled into "struct sysent0".

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-22 13:26:10 +01:00
40d63b9a92 Use tcp->qual_flg instead of qual_flags[] in verbose() and abbrev()
We have hundreds of uses of these macros.
Result is more efficient and 1.1 kbyte shorter code:

  text	   data	    bss	    dec	    hex	filename
245579	    700	  12928	 259207	  3f487	strace.t5/strace
244471	    700	  12928	 258099	  3f033	strace.t6/strace

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-22 13:23:38 +01:00
c1540fe19d Remove unused QUAL_FAULT code (was used by non-Linux code only).
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-21 16:17:08 +01:00
a585c9d641 Use uint8_t for qual_flags[] instead of ints.
Resulting bss reduction is ~6kbytes:

   text	   data	    bss	    dec	    hex	filename
 245703	    700	  19072	 265475	  40d03	strace.t4/strace
 245687	    700	  12928	 259315	  3f4f3	strace.t5/strace

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-21 16:15:43 +01:00
74ec14f968 Eliminate many SCNO_IS_VALID checks
By adding tcp->s_ent pointer tot syscall table entry,
we can replace sysent[tcp->scno] references by tcp->s_ent.
More importantly, we may ensure that tcp->s_ent is always valid,
regardless of tcp->scno value. This allows us to drop
SCNO_IS_VALID(tcp->scno) checks before we access syscall
table entry.

We can optimize (qual_flags[tcp->scno] & QUAL_foo) checks
with a similar technique.

Resulting code shrink:
   text    data     bss     dec     hex filename
 245975     700   19072  265747   40e13 strace.t3/strace
 245703     700   19072  265475   40d03 strace.t4/strace

* count.c (count_syscall): Use cheaper SCNO_IN_RANGE() check.
* defs.h: Add "int qual_flg" and "const struct sysent *s_ent"
to struct tcb. Remove "int u_nargs" from it.
Add UNDEFINED_SCNO constant which will mark undefined scnos
in tcp->qual_flg.
* pathtrace.c (pathtrace_match): Drop SCNO_IS_VALID check.
Use tcp->s_ent instead of sysent[tcp->scno].
* process.c (sys_prctl): Use tcp->s_ent->nargs instead of tcp->u_nargs.
(sys_waitid): Likewise.
* strace.c (init): Add compile-time check that DEFAULT_QUAL_FLAGS
constant is consistent with init code.
* syscall.c (decode_socket_subcall): Use tcp->s_ent->nargs
instead of tcp->u_nargs. Set tcp->qual_flg and tcp->s_ent.
(decode_ipc_subcall): Likewise.
(printargs): Use tcp->s_ent->nargs instead of tcp->u_nargs.
(printargs_lu): Likewise.
(printargs_ld): Likewise.
(get_scno): [MIPS,ALPHA] Use cheaper SCNO_IN_RANGE() check.
If !SCNO_IS_VALID, set tcp->s_ent and tcp->qual_flg to default values.
(internal_fork): Use tcp->s_ent instead of sysent[tcp->scno].
(syscall_fixup_for_fork_exec): Remove SCNO_IS_VALID check.
Use tcp->s_ent instead of sysent[tcp->scno].
(get_syscall_args): Likewise.
(get_error): Drop SCNO_IS_VALID check where it is redundant.
(dumpio): Drop SCNO_IS_VALID check where it is redundant.
Use tcp->s_ent instead of sysent[tcp->scno].
(trace_syscall_entering): Use (tcp->qual_flg & UNDEFINED_SCNO) instead
of SCNO_IS_VALID check. Use tcp->s_ent instead of sysent[tcp->scno].
Drop SCNO_IS_VALID check where it is redundant.
Print undefined syscall name with undefined_scno_name(tcp).
(trace_syscall_exiting): Likewise.
* util.c (setbpt): Use tcp->s_ent instead of sysent[tcp->scno].

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-21 16:13:47 +01:00
7270de551c ARM: make it one-personality arch
ARM in fact _is_ one personality.

We had two personalities for it because it has a handful of
syscalls with huge scnos (0x000f00xx).

Extending syscall table to have [0x000f0005] index is of course
not a good idea.

Someone decided to handle that by having a separate personality
just for these syscalls.

But multi-personality arch does a bit more work in other parts.

This patch is another alternative: "move" 0x000f00nn syscalls
down to the entries just above last ordinary syscall,
by manipulating scno if it falls into the 0x000f00xx range.

In order to not worsen genuine undefined scnos' printing,
the code remaps scno back to actual value before printing
"syscall_NNN" string.

* defs.h: Remove multi-reprsonality defines from ARM.
* syscall.c (shuffle_scno): New function.
(undefined_scno_name): New function.
(get_scno): [ARM] Replace personality setting with scno shuffling.
(trace_syscall_entering): Print unknown syscall name using
undefined_scno_name().
(trace_syscall_exiting): Likewise.
* linux/arm/syscallent.h: Add ARM specific syscalls at the end.
* linux/arm/errnoent1.h: Deleted.
* linux/arm/ioctlent1.h: Deleted.
* linux/arm/signalent1.h: Deleted.
* linux/arm/syscallent1.h: Deleted.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-21 15:46:34 +01:00
e7030e5a7e arm: shorten syscall table for EABI - no point in storing NULL entries
Also, reformatted ARM code in get_scno(), mostly improved comments,
without code changes.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-20 18:08:25 +01:00
4bfb198db1 Use the same style of includes in linux/*/* files
While at it, fix some comments which say
"we use i386 syscalls/ioctls/errnos" but in reality
common ones are used.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-20 12:38:14 +01:00
2544f988c9 Fix compiler warnings
With constant current_wordsize == 4 and 32-bit longs,
gcc was spooked by "1ul << (8 * current_wordsize)" = "1ul << 32".

Make such places conditional on SIZEOF_LONG > 4.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 17:39:56 +01:00
30c03230a8 Improve comment text. No code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 16:59:26 +01:00
f909c8d0d7 Fix NOMMU + daemonized tracer SEGV
pathname[] was getting destroyed, execve of garbage pathname
failing, and to top it off, the tracer's stack was also
smashed and trecer segfaulted.

* strace.c (exec_or_die): New function.
(startup_child): Don't use pathname[] contents after vfork,
make a malloced copy instead. Explain "NOMMU + -D bug"
and how we work around it.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 16:30:31 +01:00
5c9d8f4fc5 Make it possible to to do test builds for NOMMU architectures
And while using it, I discovered that -D doesn't work too well
on NOMMU. Added a comment about it.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 15:30:12 +01:00
1ba85436de Clean up mmap decoding
Previous code merges too many similar, but different ways
of decoding mmap. For example, sys_old_mmap is "params in memory"
API... except SH[64], where it is "params in regs",
i.e. what sys_mmap ("new mmap") function does on other arches!

It's much simpler when every mmap handler has same API regardless
of arch. Where API means whether params are in regs or in memory,
and whether offset is in bytes, pages, or 4k blocks.

Then we just insert correct function pointers into
arch syscall tables.

It turns out there are four common mmap APIs over
all architectures which exist in Linux kernel,
and one outlier for S390.

A number of mmap decoders were plain wrong in arch tables.
For example, BFIN has no old_mmap. It returns ENOSYS.
I checked kernel sources for all arches nad fixed the tables.

There was dead code for x86_64 for old_mmap:
x86_64 has no old_mmap.

* mem.c: Refactor mmap functions so that we have five mmap syscall
handlers, each with the fixed API (not varying by arch).
* pathtrace.c (pathtrace_match): Adjust sys_func == mmap_func checks.
* linux/syscall.h: Declare new mmap syscall handler functions.
* linux/arm/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/avr32/syscallent.h: mmap is sys_mmap_pgoff.
* linux/bfin/syscallent.h: old_mmap is ENOSYS, mmap2 is sys_mmap_pgoff.
* linux/hppa/syscallent.h: mmap2 is sys_mmap_4koff.
* linux/i386/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/ia64/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/m68k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/microblaze/syscallent.h: old_mmap is sys_mmap, mmap2 is sys_mmap_pgoff.
* linux/mips/syscallent.h: mmap is sys_mmap_4kgoff.
* linux/or1k/syscallent.h: mmap2 is sys_mmap_pgoff.
* linux/powerpc/syscallent.h: mmap2 is sys_mmap_4kgoff.
* linux/s390/syscallent.h: mmap2 is sys_old_mmap_pgoff.
* linux/s390x/syscallent.h: mmap is sys_old_mmap and thus has 1 arg.
* linux/sh/syscallent.h: old_mmap2 is sys_mmap, mmap2 is sys_mmap_4koff.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent1.h: mmap is TD|TM.
* linux/tile/syscallent1.h: mmap2 is sys_mmap_4koff.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-19 11:54:36 +01:00
afd0072c37 Remove unused function sys_mmap64
No wonder that it is unused.
It's code looked quite questionable.

* mem.c (sys_mmap64): Remove this function.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-18 15:49:57 +01:00
8435d672eb Remove code which supports systems with long long off_t.
While looking at mmap mess, did experimenting in order
to figure out what gets used when.

Tried building armv4tl, armv5l, armv6l, mips, mipsel, i686,
x86_64 and none of they have long long off_t,
which isn't suprprising: we aren't using glibc defines
which enable that.

Moreover, we SHOULD NOT use off_t in syscall decode!
Its size depends on libc, not on arch! I.e. it is essentially
unpredictable and can even in theory vary on the same arch
with different libc.

We should use longs or long longs, in a way which matches
architectural ABI for the given syscall. There are usually
*at most* two permutations, no need to add yet another variable
(sizeof(off_t)) to the mix.

This change removes almost all HAVE_LONG_LONG_OFF_T conditionals,
which will reveal further possible simplifications.

* mem.c: Remove code conditional on HAVE_LONG_LONG_OFF_T.
As a result, never remap sys_mmap64 to sys_mmap.
(print_mmap): Compile unconditionally.
(sys_old_mmap): Compile unconditionally.
(sys_mmap): Compile unconditionally.
* io.c (sys_sendfile): Add a FIXME comment.
* file.c: Remove code conditional on HAVE_LONG_LONG_OFF_T.
As a result, never remap sys_*stat64 to sys_*stat etc.
(sys_truncate): Compile unconditionally.
(realprintstat): Likewise.
(sys_stat): Likewise.
(sys_fstat): Likewise.
(sys_lstat): Likewise.
* desc.c (printflock): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-18 15:47:57 +01:00
8dedb0dc96 Fixes in "new" mmap
* mem.c (sys_mmap): Ensure unsigned expansion of tcp->u_arg[5].
Add page shift of offset for I386.
Use tcp->ext_arg[5] as offset for X32.
(sys_old_mmap): [X32] Remove this function, X32 doesn't use is.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-18 03:13:07 +01:00
923255cbe8 Preliminary simplifications in mmap functions
* mem.c: Move "define sys_mmap64 sys_mmap" from the top
to the only place it affects.
(print_mmap): Make offset argument unsigned, for safer implicit conversions.
(sys_old_mmap): [IA64] use unsigned narrow_arg[].
Cast u_arg[5] (offset param) to unsigned long, to prevent erroneous signed
expansion.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-18 02:36:36 +01:00
c9d0fc0a63 Remove broken HAVE_LONG_LONG conditionals
We use printllval without HAVE_LONG_LONG guards in many places,
but define it only if HAVE_LONG_LONG. This means that
on !HAVE_LONG_LONG systems we won't build for some time now.

* defs.h: Remove HAVE_LONG_LONG guard around LONG_LONG() macro
and printllval() function declaration.
* util.c: Remove HAVE_LONG_LONG guard around printllval()
function definition.
(printllval): Add compile-time error check for using wrong
if branch. Explain places where we deliberately use mismatched
types for printf formats.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-17 22:41:33 +01:00
061217669b Use explicit long type instead of off_t
* file.c (sys_lseek): Use long instead of off_t.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-17 20:08:50 +01:00
86738a232d Merge two identical tables
* defs.h: Declare whence_codes[].
* desc.c: Delete static whence[].
(printflock[64]): Use whence_codes.
* file.c: Make whence_codes[] non-static.
Add SEEK_DATA and SEEK_HOLE to them.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-17 14:31:55 +01:00
09a87ae971 Remove wrong x32-specific lseek
Testing confirmed what I suspected: x32 lseek uses kernel-sized
(i.e. wide) long for offset parameter.

* file.c: Delete sys_lseek32.
* linux/syscall.h: Likewise.
* linux/x32/syscallent1.h: Likewise.
* test/x32_lseek.c: New file.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-17 13:17:49 +01:00
782d90f918 Fix SEGV in lseek
I found hard way why the code was using "_whence" name.

* file.c: Rename whence[] to whence_codes[].
(sys_lseek): Fix printxval() to use whence_codes[].
(sys_lseek32): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-17 12:47:44 +01:00
386b871b0a Comment inner workings of sys_[l]lseek
The code doesn't look fully correct to me, but I need to experiment
on actual x32 machine before I start "fixing" things.
For now, add comments, and optimize out one tprints() call...

* file.c (sys_lseek): Rename '_whence' as 'whence'.
Merge printing of ", " into subsequent tprintf.
(sys_lseek32): Likewise.
(sys_llseek): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-17 01:38:14 +01:00
a32086f2aa Cosmetic fixes to syscall tables, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-17 01:37:35 +01:00
bf8ed1794e Make linux/mips/syscallent.h smaller
* linux/mips/syscallent.h: Remove trailing empty elements.
Compactify huge stretches of NULL elements in the middle.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-16 14:44:31 +01:00
c956ef085f Simple optimization in get_error
* defs.h: Define SCNO_IN_RANGE(scno) macro.
* syscall.c (get_error): Change return type to void.
Use SCNO_IN_RANGE instead of SCNO_IS_VALID.
(trace_syscall_exiting): Stop checking get_error() return value.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-16 14:25:56 +01:00
5721cdbcdb Mass rename of SCNO_IN_RANGE define to SCNO_IS_VALID
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-16 13:22:38 +01:00
48e4c1bf4d Finish prefixing regs struct names with arch_
* defs: Rename regs -> sparc_regs.
* signal.c (sys_sigreturn): Use new variable name.
* syscall.c: Rename regs -> sparc_regs, regs -> avr32_regs.
(getrval2): Use new variable names.
(printcall): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-16 08:23:40 +01:00
2550d4890e Use the same type for i386_regs on 32-bit and 64-bit x86.
* defs.h: Stop including <asm/ptrace.h> for x86.
Change i386_regs from "struct pt_regs" to "struct user_regs_struct".
* syscall.c: Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-15 21:04:28 +01:00
ddd2da2562 Fix build error on Tile
* syscall.c (get_scno): [TILE] Remove TCB_WAITEXECVE check,
it is never true on Tile, and stopped compiling when
TCB_WAITEXECVE define was removed for Tile.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-15 15:25:37 +01:00
6cf36057b3 x86: zero-extend 32-bit args in syscall entry instead of sign-extension
Zero-extension is slightly more common that sign-extension:
all pointers are zero-extended, and some other params are unsigned.

Whereas signed ones (fds, pids, etc) are often treated as
_32-bit ints_ even by kernel, so just unconditionally casting
such tcp->u_arg[N] to int works.

* syscall.c (get_syscall_args): [X86] Zero-extend 32-bit args
instead of sign-extension.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-15 15:01:38 +01:00
e015d2d331 Macroize conditional signed widening operation
* defs.h: Define widen_to_long() macro.
* signal.c (sys_kill): Use it instead of open-coding it.
(sys_tgkill): Use widen_to_long() on pids.
* resource.c (decode_rlimit): Formatting fix.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-15 14:58:52 +01:00
ae8643e671 A better handling of current_wordsize
On x86_64:
  text	   data	    bss	    dec	    hex	filename
435661	  26628	  47424	 509713	  7c711	strace_old
435501	  26612	  47440	 509553	  7c671	strace_new_clever_wordsize

On x32 and arm it should be even better, current_wordsize becomes
a constant there.

* defs.h: Declare current_wordsize as a variable if needed,
else declare as a constant define.
Remove declatation of personality_wordsize[].
* syscall.c: Make personality_wordsize[] static.
Declare current_wordsize as a variable if needed.
(set_personality): Set current_wordsize only if non-constant.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-15 14:55:14 +01:00
cb26b75493 Remove unnecessary "return 0" statements
* util.c (change_syscall): Remove dummy "return 0"s.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-15 11:43:08 +01:00
e3b248dd83 x86: fix required kernel version for GETREGSET
* syscall.c (get_regs): [X86] Use GETREGSET only if kernel >= 2.6.35

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-15 00:24:19 +01:00
f5fa778d2f Whitespace fix, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-14 13:39:53 +01:00
492f81f14c Add support for the OpenRISC 1000 platform
* configure.ac: Added or1k architecture..
* defs.h: Added or1k to use register reading system.
* linux/or1k/ioctlent.h.in: Use i386 ioctls.
* linux/or1k/syscallent.h: New file.
* process.c: Added or1k register defs to struct_user_offsets[].
* syscall.c: Added or1k_io iovec for or1k GETREGSET,
  regset structure for or1k.
  (printcall): Added handling for or1k.
  (get_regs): Likewise.
  (get_scno): Likewise.
  (get_syscall_args): Likewise.
  (get_syscall_result): Likewise.
  (get_error): Likewise.
* util.c (change_syscall): Added dummy handling for or1k.
* system.c (sys_or1k_atomic): New function (or1k specific syscall).

Signed-off-by: Christian Svensson <blue@cmd.nu>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-14 13:38:27 +01:00
eec8d5d6b0 [X86] Use ptrace(PTRACE_GETREGSET, NT_PRSTATUS) to get registers.
Unlike PTRACE_GETREGS, this new method detects 32-bit processes
reliably, without checking segment register values which
are undocumented and aren't part of any sort of API.
While at it, also fixed x32 detection to use __X32_SYSCALL_BIT,
as it should have been from the beginning.

* defs.h: Declare os_release and KERNEL_VERSION.
* strace.c: Make os_release non-static, remove KERNEL_VERSION define.
* syscall.c: New struct i386_user_regs_struct,
static union x86_regs_union and struct iovec x86_io.
(printcall): Use i386_regs or x86_64_regs depending on x86_io.iov_len.
(get_regs): On x86 and kernels 2.6.30+, use PTRACE_GETREGSET,
on earlier kernels fall back to old method.
(get_scno): [X86] Determine personality based on regset size
on scno & __X32_SYSCALL_BIT.
(syscall_fixup_on_sysenter): Use i386_regs or x86_64_regs depending
on x86_io.iov_len.
(get_syscall_args): Likewise.
(get_error): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-14 03:29:48 +01:00
d22213a3ee Rename some register statics by prefixing their names with arch.
This makes it easier to grep for them.

* syscall.c: Rename variables:
r0 -> bfin_r0,alpha_r0,sh_r0.
a3 -> mips_a3.
r2 -> mips_r2.
(get_scno): Use new variable names.
(get_syscall_result): Likewise.
(get_error): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-13 17:52:31 +01:00
d4d3edefe7 Factor out code to check addr, fetch and print siginfo
* defs.h: Declare new function printsiginfo_at(tcp, addr).
* process.c (sys_waitid): Use printsiginfo_at().
(sys_ptrace): Likewise.
* signal.c: (printsiginfo_at): Implement this new function.
(sys_rt_sigsuspend): Use printsiginfo_at().
(sys_rt_sigtimedwait): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-13 16:31:32 +01:00
be99497d39 Decode struct iov in PTRACE_GET/SETREGSET
* process.c (sys_ptrace): Decode struct iov in PTRACE_GET/SETREGSET.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-13 16:10:10 +01:00
873e5a5a5c Unify representations of struct user fields for subarchitectures
* process.c: Unify MIPS and LINUX_MIPSN32, and SH and SH64 parts of
struct_user_offsets[].

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-12 17:15:19 +01:00
74307a6953 Add start_code and start_data members of struct user
* process.c: Add start_code and start_data members of struct user
in struct_user_offsets[], where appropriate.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-12 17:10:05 +01:00
a86696ba64 Remove hacks for old kernels for architectures which require new kernels
* util.c (change_syscall): For MICROBLAZE, replace code
with dummy "return 0" and a comment explaining why that is ok
for this architecture.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-12 16:07:54 +01:00
ab2f402242 Remove stray syscall result reading code on syscall entry for s390
This is a leftover from sysenter/sysexit split.
I can't run-test it, but from code inspection it seems to be correct.

* syscall.c (get_scno): Remove stray syscall result reading for s390[x].

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-12 15:57:37 +01:00
729e18dffd Deobfuscate definitions of struct user offsets
The maze of ifdefs/ifndefs was scaring new contributors.
Format it so that every arch has its own ifdef block.

* process.c: Deobfuscate definitions of struct user offsets.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-12 15:51:58 +01:00
bf357fcb76 Remove hacks for old kernels for architectures which require new kernels
* defs.h: Do not define TCB_WAITEXECVE for AARCH64.
* util.c (change_syscall): For AARCH64 and X32, replace code
with dummy "return 0" and a comment explaining why that is ok
for these architectures.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-12 13:06:51 +01:00
d27809c978 Remove old kernel hacks for architectures which require new kernels
* defs.h: Do not define TCB_WAITEXECVE for AVR32, BFIN and TILE.
* util.c (change_syscall): For AVR32, BFIN and TILE, replace code
with dummy "return 0" and a comment explaining why that is ok
for these architectures.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-12 12:50:10 +01:00
3e759d4293 Handle recv[m]msg for non-native 32-bit personality syscalls
* net.c (printmsghdr): If current_wordsize is 4 and long is wider than it,
read 32-bit struct msghdr and expand it into a native one before using it.
(printmmsghdr): Likewise for struct mmsghdr.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-12 11:57:48 +01:00
afea7dd4a5 Fix is_negated_errno() check for X32
X32's return value is 64-bit. We were truncating it to 32-bit long
before checking for -errno.

* syscall.c (is_negated_errno_x32): New function.
(get_error): Use is_negated_errno_x32 for X32 architecture.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-12 11:52:35 +01:00
9472a27b79 Remove unused / ambiguously used defines
We sometimes use LINUXSPARC and sometimes (more often)
use "defined(SPARC) || defined(SPARC64)". Better to use
one construct consistently.
LINUX_MIPS64 is altogether unused.

* defs.h: Remove LINUXSPARC and LINUX_MIPS64 defines.
Move PTRACE_xxx compat defines up, before arch-specific
machinery. Use defined(SPARC) || defined(SPARC64)
instead of LINUXSPARC.
* file.c: Use defined(SPARC) || defined(SPARC64) instead of LINUXSPARC.
* signal.c: Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-12 11:43:46 +01:00
59aea0a7d5 Preparatory patch for "new" x86 personality detection
* syscall.c: Move PT_FLAGS_COMPAT define to its only user, get_scno().
Rename arm_regs_union's fields to names less likely to collide with
system defines.
(get_regs): Use sizeof(arm_regs_union) instead of sizeof(aarch64_regs).
This should be the same, but htis way it's cleaner.
Remove __X32_SYSCALL_MASK and use __X32_SYSCALL_BIT instead.
Explain 64-bit check in X32 build better.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-11 12:29:36 +01:00
338c069e69 Fix sigaltstack decoder
strace used to hang when decoding sigaltstack called with invalid
stack_t pointers because of mishandling umove() return code.

* signal.c (print_stack_t): Handle unfetchable stack_t properly.
Change return type to void.
(sys_sigaltstack): Update print_stack_t() usage.

Reported-by: kawillia@ucalgary.ca
2013-02-09 02:03:04 +00:00
0cf04b6595 Fix decoding of sysctl() when oldval fields are NULL
If you call glibc's syscall wrapper like so:
	static int name[] = { CTL_NET, NET_IPV4, NET_IPV4_LOCAL_PORT_RANGE };
	int buffer[2] = { 32768, 61000 };
	size_t size = sizeof(buffer);
	sysctl(name, 3, 0, 0, buffer, size);
(note that oldval/oldlenp are NULL).

The current strace code complains like so:
_sysctl({{CTL_NET, NET_IPV4, NET_IPV4_LOCAL_PORT_RANGE, 38}, 3, process_vm_readv: Bad address
(nil), 0, 0x7fffe23c3960, 8}) = -1 EACCES (Permission denied)

Since passing NULL for the old values is valid, handle that explicitly.
This also simplifies the code a bit by splitting up the handling of the
new and old args so that we only handle the new args once.

Now the output looks like:
_sysctl({{CTL_NET, NET_IPV4, NET_IPV4_LOCAL_PORT_RANGE, 38}, 3, NULL, 0, 0x7fff8c0c91b0, 8) = -1 EACCES (Permission denied)

* system.c (sys_sysctl): Check if info.oldval is NULL first.  Move the
processing of oldlen/info.newval/info.newlen out so they always get
executed.  Fix the format strings so we use %lu for unsigned long rather
than a mix of %ld and %lu.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2013-02-09 01:39:43 +00:00
99aa181ebc If we are on a glibc system, assume it's at least glibc 2.1
It is not likely anyone uses glibc older that that:
glibc 2.1.1 was released in 1999

* net.c: Remove test for glibc >= 2.1.
* signal.c: Remove code which is compiled only for glibc < 2.1.
* util.c: Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-08 18:49:06 +01:00
7ba8e72bb5 S390: stop using needlessly static long pc variable
* syscall.c: Remove "static long pc" variable.
(get_scno): Use an automatic long variable instead of a static.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-08 15:50:05 +01:00
751acb3d70 Dying suddenly with abort() is rude, avoid if possible
* file.c (sys_utime): Don't call abort() if wordsize is strange.
Instead, warn user about it.
* desc.c (printflock): Use the same message string as in sys_utime.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-08 15:34:46 +01:00
86d94843cf Remove vestigial hacks around non-Linux struct sigactions
* signal.c: Stop using __sighandler_t glibc'ism. Remove SA_HANDLER macro.
Explain why we can't use "sa_handler" as a field name.
(sys_sigaction): Use __sa_handler instead of SA_HANDLER macro.
(sys_rt_sigaction): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-08 12:59:13 +01:00
28ac68f2ab Optimize AArch64 handling of 32-bit personality
By putting aarch64_regs and arm_regs into a union,
register copying is eliminated.
No need to check and change personality on syscall exit.

* defs.h: Remove unused NUM_ARM_REGS define. Fix indentation.
* syscall.c: Put aarch64_regs and arm_regs into a union.
(update_personality): Shorten bitness message.
(printcall): Add commented-out PC printing.
(get_regs): Remove now-unnecessary 64-to-32 bits register copying.
(get_syscall_result): Drop personality changing code.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-08 12:38:51 +01:00
89804ec3e1 Rename some register statics by prefixing their names with arch.
This makes it easier to grep for them.

* syscall.c: Make IA64's r8, r10 global variables static.
Rename variables:
r8,r10 -> ia64_r8,ia64_r10.
d0 -> m68k_d0.
a3 -> alpha_a3.
r28 -> hppa_r28.
r9 -> sh64_r9.
r10 -> cris_r10.
r3 -> microblaze_r3.
(get_scno): Use new variable names.
(syscall_fixup_on_sysenter): Likewise.
(get_syscall_result): Likewise.
(get_error): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-07 13:14:48 +01:00
401374e9c2 Rename ARM's regs structure to arm_regs
Compile-tested.

* defs.h: Rename regs structure to arm_regs.
* syscall.c: Likewise.
(printcall): Use new name instead of old one.
(get_regs): Likewise.
(get_scno): Likewise.
(get_syscall_args): Likewise.
(get_error): Likewise.
* signal.c (sys_sigreturn): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-06 18:24:39 +01:00
4bdb6bb734 Stop needlessly using static variable
* syscall.c: Remove static long psr.
(get_scno): Use local psr variable.
(get_syscall_result): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-06 18:09:31 +01:00
8d4ca0c8cd Shortcut tests for fork/exec syscalls
This change should speed up strace by a tiny bit.

More importantly, it makes it much more clear that
fork and exec fixups are not necessary for any reasonably
recent kernels. IOW: syscall_fixup_for_fork_exec() and its callees
are all dead code.

* defs.h: Declare new need_fork_exec_workarounds flag variable.
* strace.c: Define need_fork_exec_workarounds flag variable.
(test_ptrace_setoptions_followfork): Return 0/1 as success/fail indicator.
(test_ptrace_setoptions_for_all): Likewise.
(init): Set need_fork_exec_workarounds to TRUE if needed.
* syscall.c: Rename internal_syscall() to syscall_fixup_for_fork_exec().
(trace_syscall_entering): Call syscall_fixup_for_fork_exec() only if
need_fork_exec_workarounds == TRUE.
(trace_syscall_exiting): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-06 13:18:42 +01:00
88eafd81ab Improve perf_event_open argument decoding
* configure.ac (AC_CHECK_HEADERS): Add linux/perf_event.h.
* desc.c [HAVE_LINUX_PERF_EVENT_H]: Include <linux/perf_event.h>.
(perf_event_open_flags): New xlat structure.
(sys_perf_event_open): New function.
* linux/dummy.h (sys_perf_event_open): Remove.
* linux/syscall.h (sys_perf_event_open): New prototype.

Signed-off-by: Ben Noordhuis <info@bnoordhuis.nl>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2013-02-05 23:15:14 +00:00
af8dc6b3a5 tile: fix merge skew with new get_regs architecture
* defs.h [TILE]: Declare clear_regs(), get_regs() and get_regs_error.
* syscall.c (get_regs) [TILE]: Fix merge skew.
(printcall) [TILE]: fix a compiler warning about pt_reg_t in
a printf expression.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2013-02-05 23:15:06 +00:00
9e1a7d818a mount: decode MS_NOSEC
* system.c (MS_NOSEC): Define.
(mount_flags): Add MS_NOSEC.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-05 19:07:42 +00:00
21ceeb4879 mmap: decode MAP_UNINITIALIZED
* mem.c (mmap_flags): Add MAP_UNINITIALIZED.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-02-05 19:07:41 +00:00
ddba73e4c0 Print 64-bit instruction pointers zero padded
* syscall.c (printcall): Print 64-bit instruction pointers zero padded.
2013-02-05 19:01:58 +00:00
f0f41cfb19 x86_64: fix compilation warning introduced in previous commit
* syscall.c (printcall): Cast x86_64_regs.rip to the type being printed.
2013-02-05 18:57:16 +00:00
df39e56d2d Simple bug fix for x86_86
* syscall.c (printcall): Use x86_64_regs.rip, not x86_64_regs.ip.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-05 18:18:07 +01:00
0b99a8ac3b Add tilegx support to strace
tilegx support has been in the kernel since 3.0.
In addition, fix some issues with the tilepro support already
present in strace, primarily the decision to use the
<asm/unistd.h> numbering space for system calls.

* defs.h [TILE]: Include <asm/ptrace.h> and provide an extern
struct pt_regs tile_regs for efficiency.  Provide compat 32-bit
personality via SUPPORTED_PERSONALITIES, PERSONALITY0_WORDSIZE,
PERSONALITY1_WORDSIZE, and DEFAULT_PERSONALITY.
* linux/tile/errnoent1.h: New file, includes linux/errnoent.h.
* linux/tile/ioctlent1.h: New file, includes linux/ioctlent.h.
* linux/tile/signalent1.h: New file, includes linux/signalent.h.
* linux/tile/syscallent.h: Update with new asm-generic syscalls.
The version previously committed was the from the first tile patch
to LKML, which subsequently was changed to use <asm-generic/unistd.h>.
* linux/tile/syscallent1.h: Copy from linux/tile/syscallent.h.
* mem.c (addtileflags) [TILE]: use %ld properly for a "long" variable.
* process.c [TILE]: Choose clone arguments correctly and properly
suppress all "struct user" related offsets in user_struct_offsets.
* signal.c [TILE]: Use tile_regs not upeek.
* syscall.c (update_personality) [TILE]: Print mode.
(PT_FLAGS_COMPAT) [TILE]: Provide if not in system headers.
(tile_regs) [TILE]: Define 'struct pt_regs' variable to hold state.
(get_regs) [TILE]: use PTRACE_GETREGS to set tile_regs rather than using upeek.
(get_scno) [TILE]: Set personality.
(get_syscall_args) [TILE]: Use tile_regs.
(get_syscall_result) [TILE]: Update tile_regs.
(get_error) [TILE]: Use tile_regs.
(printcall) [TILE]: Print pc.
(arg0_offset, arg1_offset, restore_arg0, restore_arg1) [TILE]:
Properly handle tile call semantics and support tilegx.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-05 17:48:33 +01:00
4645582edb Small optimization for SPARC[64] get_scno
* syscall.c: Remove static unsigned long trap veriable.
(get_scno): Use local trap variable.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-05 17:02:59 +01:00
1ebe08d613 Do not compile getrval2() if not needed
* syscall.c (getrval2): Do not compile it for architetures where
it isn't ever used.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-05 16:55:23 +01:00
ce7d953ebe Optimize out PTRACE_PEEKUSER with -i
strace -i was fetching PC with a separate PEEKUSER
despite having GETREGS data:

ptrace(PTRACE_GETREGS, 22331, 0, 0x8087f00) = 0
ptrace(PTRACE_PEEKUSER, 22331, 4*EIP, [0x80dd7b7]) = 0
write(3, "[080dd7b7] ioctl(0, SNDCTL_TMR_T"..., 82) = 82
ptrace(PTRACE_SYSCALL, 22331, 0, SIG_0) = 0

Now it does this:

ptrace(PTRACE_GETREGS, 22549, 0, 0x8087ea0) = 0
write(3, "[080dd7b7] ioctl(0, SNDCTL_TMR_T"..., 82) = 82
ptrace(PTRACE_SYSCALL, 22549, 0, SIG_0) = 0

Analogous improvement in sys_sigreturn() is also implemented.

* defs.h: Declare extern struct pt_regs regs for SPARC[64] and ARM.
Declare clear_regs(), get_regs() and get_regs_error flag variable.
* strace.c (trace): Call get_regs(pid) as soon as we know the tcb
and that it is stopped.
* syscall.c (get_regs): New function. Used to fetch registers early,
just after tracee has stopped.
(printcall): Move it here from util.c. Use global regs.REG data,
if available on the arch, instead of re-fetching it.
(get_scno): Use global regs.REG data.
(get_syscall_result): Likewise.
* signal.c (sys_sigreturn): Likewise.
* util.c (printcall): Moved to syscall.c.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-02-05 16:36:13 +01:00
beae4c7182 Fix sys_semtimedop decoding on s390x
The s390 and s390x pass semtimedop arguments differently from other
architectures.  sys_semtimedop parser was fixed for s390 by commit
v4.6-177-ge0f5fd8, and s390x requires the same fix.

* linux/ipc.c (sys_semtimedop): Fix timespec decoding on s390x.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2012-12-15 14:13:05 +00:00
1f21513c38 Fix *xattr decoding
* file.c (print_xattr_val): Do not attempt to decode a zero sized array.
Fixes RH#885233.
2012-12-08 00:18:45 +00:00
eff5c0e60c sys_semtimedop: fix timeval argument index in wrapped call
Looking at the implementation of wrapped semtimedop() call inside glibc
and kernel, I started to believe that timeval should be located in
tcp->u_arg[4] and not tcp->u_arg[5].  Fortunately, tcp->u_arg[5] now
works correctly as well, due to side effects of decode_ipc_subcall().

declaration in header:
int semtimedop(semid, *sops, nsops, *timeout);
                 0      1      2        3

sys_ipc arguments in glibc on all patforms except s390*:
semid, (int) nsops, 0, CHECK_N (sops, nsops), timeout
  0            1    2            3                4
We have to use indexes: 0 3 1 4

sys_ipc arguments on s390*:
semid, (int) nsops, timeout, sops
  0            1       2       3
We have to use indexes: 0 3 1 2

* ipc.c (sys_semtimedop) [!S390]: Fix timeval argument index in
indirect_ipccall case.
2012-12-08 00:17:59 +00:00
eb54c47725 Fix glibc version checks
* util.c: Check if __GLIBC__ is defined before using it.
* signal.c: Likewise.  Fix __GLIBC_MINOR__ checks.
2012-12-06 02:20:33 +00:00
05eb905c44 Add state argument to change_syscall and fix SPARC
Add a state argument to change_syscall() so that SPARC can modify that
instead of read-modify-writing the whole register set.  This function is
always called within an arg_setup/arg_finish_change sequence which on
certain architectures like SPARC will also be doing a read-modify-write.
This prevents the second write (from arg_finish_change) from undoing the
effects of the change_syscall call.

* util.c (change_syscall): Move below definition of arg_setup_state.
Add state argument.
[SPARC || SPARC64] Change to set state->u_regs[U_REG_G1] rather than
read-modify-writing it with PTRACE_GETREGS and PTRACE_SETREGS.
(setbpt, clearbpt): Pass state argument to change_syscall.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
2012-11-29 23:45:38 +00:00
890a5cad23 Add support for tracing 32-bit ARM EABI binaries on AArch64
* defs.h [AARCH64]: Copy in the definition of arm_pt_regs and the
accessor macros, so it's possible to build on AArch64 without
ARM system headers.  Set SUPPORTED_PERSONALITIES to 2.
Define PERSONALITY0_WORDSIZE and PERSONALITY1_WORDSIZE.
Set DEFAULT_PERSONALITY to 1.
* linux/aarch64/errnoent1.h: New file, includes generic errnoent.h.
* linux/aarch64/ioctlent1.h: New file, includes generic ioctlent.h.
* linux/aarch64/signalent1.h: New file, includes generic signalent.h.
* linux/aarch64/syscallent1.h: Rename from linux/aarch64/syscallent.h.
* linux/aarch64/syscallent.h: New file, includes arm/syscallent.h.
* syscall.c [AARCH64]: Define aarch64_regs.
(update_personality) [AARCH64]: Add debug output.
(get_scno) [AARCH64]: Determine if we're in ARM or AArch64 mode by
checking the size of the returned uio structure from PTRACE_GETREGSET
and interpret the structure accordingly.
(get_syscall_result): Likewise.
(get_syscall_args): Merge the AArch64 and ARM sections so that on
AArch64 we can fall back to supporting the ARM personality.
(get_error): Likewise.

Signed-off-by: Steve McIntyre <steve.mcintyre@linaro.org>
2012-11-12 15:19:58 +00:00
716c93ecf8 Move asm-generic ioctl definitions to linux/ioctlent.h.in
* linux/ioctlent.h.in: Add asm-generic ioctl entries from all
linux/*/ioctlent.h.in files.
* linux/bfin/ioctlent.h.in: Remove asm-generic ioctl entries.
* linux/i386/ioctlent.h.in: Likewise.
* linux/powerpc/ioctlent.h.in: Likewise.
* linux/s390/ioctlent.h.in: Likewise.
* linux/sparc/ioctlent.h.in: Likewise.
2012-11-12 14:05:53 +00:00
17e3860ee8 Filter out redundant "*32" ioctl entries
* linux/ioctlent-filter.awk: New file.
* Makefile.am: Use it.
* linux/ioctlent.h.in: Removed redundant "*32" entries.
2012-10-27 01:13:53 +00:00
7943966f6c Enhance quotactl decoding
* quota.c (sys_quotactl): Decode 2nd syscall argument using printpath.
* pathtrace.c (pathtrace_match): Add quotactl support.
* linux/*/syscallent.h: Add TF flag to quotactl entry.
2012-10-26 23:43:13 +00:00
d8d3bd3709 Add AArch64 support to strace
AArch64 has been included in linux from 3.7 onwards.
Add support for AArch64 in strace, tested on linux in a simulator.

* configure.ac: Support AArch64.
* defs.h [AARCH64]: Include <sys/ptrace.h>, define TCB_WAITEXECVE.
* ipc.c (indirect_ipccall): Support AArch64.
* process.c (struct_user_offsets): Likewise.
* syscall.c [AARCH64]: Include <asm/ptrace.h>,  <sys/uio.h>, and
<elf.h>.  Define struct user_pt_regs regs.
(get_scno, get_syscall_result): Support AArch64 using PTRACE_GETREGSET.
(get_syscall_args, get_error): Support AArch64.
* linux/aarch64/ioctlent.h.in: New file.
* linux/aarch64/syscallent.h: New file, based on linux 3.7 version of
asm-generic/unistd.h.

Signed-off-by: Steve McIntyre <steve.mcintyre@linaro.org>
2012-10-26 23:32:15 +00:00
d6dbd998b7 linux: add new errno values for EPROBE_DEFER and EOPENSTALE
New definitions match updates in Linux 3.4 and Linux 3.5 respectively.

* linux/errnoent.h (ERRNO_517): Change to EPROBE_DEFER.
(ERRNO_518): Change to EOPENSTALE.

Signed-off-by: Steve McIntyre <steve.mcintyre@linaro.org>
2012-10-26 22:55:52 +00:00
9679296d56 Add -e trace=memory option
Add a new 'memory' category for tracing memory mapping related syscalls.

Affected syscalls are: break, brk, get_mempolicy, madvise, mbind,
migrate_pages, mincore, mlock, mlockall, mmap, move_pages, mprotect,
mremap, msync, munlock, munlockall, munmap, remap_file_pages, and
set_mempolicy.

* defs.h (TRACE_MEMORY): New macro.
* syscall.c (lookup_class): Handle trace=memory option.
* strace.1: Document it.
* linux/alpha/syscallent.h: Add TM flag to memory mapping related syscalls.
* linux/arm/syscallent.h: Likewise.
* linux/avr32/syscallent.h: Likewise.
* linux/bfin/syscallent.h: Likewise.
* linux/hppa/syscallent.h: Likewise.
* linux/i386/syscallent.h: Likewise.
* linux/ia64/syscallent.h: Likewise.
* linux/m68k/syscallent.h: Likewise.
* linux/microblaze/syscallent.h: Likewise.
* linux/mips/syscallent.h: Likewise.
* linux/powerpc/syscallent.h: Likewise.
* linux/s390/syscallent.h: Likewise.
* linux/s390x/syscallent.h: Likewise.
* linux/sh/syscallent.h: Likewise.
* linux/sh64/syscallent.h: Likewise.
* linux/sparc/syscallent.h: Likewise.
* linux/tile/syscallent.h: Likewise.
* linux/x32/syscallent.h: Likewise.
* linux/x86_64/syscallent.h: Likewise.

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
2012-10-26 22:45:08 +00:00
85c2178490 x32: add 64bit annotation too
Since someone can invoke these entry points directly with syscall(),
at least decode their name and show that they're 64bit versions rather
than just showing syscall_###.

* linux/x32/syscallent.h: Sync all missing entries below 312 with x86_64.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-09-28 01:25:17 +00:00
b742d8c1b8 Ignore fflush(3) return value
strace used to honor fflush(3) return value in trace_syscall_entering
which resulted to tracees not being PTRACE_SYSCALL'ed which in turn
caused nasty hangups like this one:

$ strace -o'|:' pwd
|:: Broken pipe

There is little strace can do in case of fflush(3) returning EOF, and
hangup is certainly not the best solution for the issue.

* syscall.c (trace_syscall_entering): Ignore fflush(3) return value.
2012-09-28 01:18:43 +00:00
9a71bcdab2 Use perror_msg instead of perror
* signal.c (sys_sigreturn): Use perror_msg instead of perror.
* strace.c (tprintf, tprints, detach, startup_attach): Likewise.
* syscall.c (get_scno): Likewise.
* util.c (umoven, umovestr): Likewise.
2012-09-28 01:13:10 +00:00
4411a0ce30 process_vm_readv may return ESRCH if tracee was killed, don't complain
Discovered by running test/sigkill_rain under strace.

* util.c (umoven): Do not emit error message if process_vm_readv
fails with ESRCH.
(umovestr): LikeWise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-27 13:53:37 +02:00
978fbc901c Trivial fixes, no code changes.
* strace.c: Fix compiler warning message about tgkill - we don't use it.
Fix indentation of preprocessor directives.
(trace): Remove outdated comment.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-13 10:28:43 +02:00
508279c94f Always check setreuid return code
* strace.c (startup_child): Check setreuid return code.
2012-08-24 17:56:53 +00:00
f04b5de5a5 x32: update {g,s}etsockopt syscall numbers
Starting with linux 3.6 (and backported to earlier kernels), these two
syscalls have changed numbers (moving from native to compat entry points).
Update the strace syscall list accordingly.

* linux/x32/syscallent.h: Move setsockopt from 54 to 541, and move
getsockopt from 55 to 542.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-08-24 12:18:48 +00:00
ad232c6aa0 Decode file type returned by getdents system call
* file.c (sys_getdents): Decode d_type in unabbreviated mode.
2012-08-16 19:29:55 +00:00
cf53436f73 Close pipe and wait for the pipe process termination
In case of normal strace termination, when the trace output is
redirected to a file or a pipe, close it and wait for the pipe
process termination.

* strace.c (main): Before normal exit, close shared_log when it
differs from stderr, and wait for popen_pid termination.
2012-07-12 20:54:46 +00:00
26bc0606d9 Enable usage of PTRACE_SEIZE
* defs.h: Define USE_SEIZE to 1. Remove PTRACE_SEIZE_DEVEL
and PTRACE_EVENT_STOP1.
* strace.c (ptrace_attach_or_seize): Replace PTRACE_SEIZE_DEVEL
with 0.
(trace): Do not check for PTRACE_EVENT_STOP1.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-07-10 16:36:32 +02:00
d7df59197d x32: update syscall table
This syncs with the syscall table as it is in linux 3.4.

* linux/x32/syscallent.h (59): Fix comment typo.
(78): Add missing getdents entry.
(174): Delete create_module entry (not in the kernel).
(181, 182, 183, 184, 185): Add missing entries.
(524, 536, 539, 540): Fix spacing.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-06-05 13:35:01 +00:00
d33e72a26d Merge adjacent printing operations in a few places
* file.c (sys_readahead): Merge tprints() with following printllval().
(sys_ftruncate64): Likewise.
(sys_fadvise64): Likewise.
(sys_fadvise64_64): Likewise.
(sys_fallocate): Merge tprints() with following tprintf().

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-05-18 02:03:24 +02:00
318a273ea9 Use %d printf format instead of %i everywhere
* loop.c (loop_ioctl): Use %d instead of %i.
* mtd.c (mtd_ioctl): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-05-16 12:29:09 +02:00
8560ef291c Fix a few goofs in sys_sysctl()
* system.c (sys_sysctl): Cast pointer to long, not size_t,
when we intend to use it as an address. Set oldlen to 0 prior
to reading into it - we want to have deterministic result
if read fails.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-05-16 12:23:58 +02:00
048cc42f08 Stop using non-standard %Zu and %Zd formats for size_t printing
The documented formats are %zu and %zd, but since our (normally disabled)
"fast" printf code doesn't support those too, I convert them to %lu and %ld.

* bjm.c (sys_query_module): Convert %Zd usages to %lu.
* system.c (sys_sysctl): Likewise.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-05-16 12:20:17 +02:00
c59b3f13fb Remove outdated comment about suspending new tracees
We no longer track parent/child relationship between tracees.
Therefore, we no longer suspend new tracee until parent is seen
exiting form [v]fork/clone. The comment is obsolete.

* strace.c (trace): Remove outdated comment.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-05-15 15:35:52 +02:00
c52826c267 Make sure current_wordsize and PERSONALITY0_WORDSIZE are ints in all arches
On 64bit systems with a single personality, they used to be sizeof(long),
which has type "long", not "int", which complicates printf formats.

* defs.h: Ensure that PERSONALITY0_WORDSIZE;s tyoe is int.
This in turn makes sure current_wordsize is also an int.
* count.c (call_summary): Revert the change which added cast to int.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-05-15 14:28:56 +02:00
d376c92a91 Add configure --enable-gcc-Werror option
* configure.ac: New option --enable-gcc-Werror.
2012-05-15 00:50:26 +00:00
f112d07800 Make x86-64 build free of artificial warnings
* signal.c (sys_sigreturn): Do not issue "no sys_sigreturn" warning
on X86_64.
2012-05-15 00:13:59 +00:00
0dbc80de89 Fix kernel release string parsing
* strace.c (get_os_release): Handle "X.Y-something" utsname.release
strings properly.

Reported-by: Bryce Gibson <bryce@gibson-consulting.com.au>
2012-05-14 23:42:10 +00:00
55980f5b72 On clearing "breakpopint", restore syscall number too
This fixes Fedora bug 659382.
Low risk: this code is not supposed to be used on any non-acient kernel.

* util.c (clearbpt): Restore syscall number too.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-05-14 16:40:28 +02:00
24ee60b836 util: fix building when glibc has a stub process_vm_readv
If you have a newer glibc which provides process_vm_readv, but it is built
against older kernel headers which lack __NR_process_vm_readv, the library
will contain a stub implementation that just returns ENOSYS.  Autoconf
checks for this case explicitly and will declare it as unavailable.  So we
end up in a case where the headers provide the prototype, but autoconf has
not defined HAVE_PROCESS_VM_READV, so we hit the same build failure again:

util.c:738:16: error: static declaration of 'process_vm_readv' follows non-static declaration
/usr/include/bits/uio.h:58:16: note: previous declaration of 'process_vm_readv' was here

So rename our local function to something unique, and add a define so the
callers all hit the right place.

* util.c (strace_process_vm_readv): Rename from process_vm_readv.
(process_vm_readv): Define to strace_process_vm_readv.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-05-05 00:06:58 +00:00
5700f68471 doc: describe documentation policy
* README-hacking: Describe documentation policy.
2012-05-03 01:44:49 +00:00
503faaae3a maint: post-release administrivia
* NEWS: Add header line for next release.
2012-05-02 23:00:34 +00:00
709 changed files with 45025 additions and 37720 deletions

17
.gitignore vendored
View File

@ -2,7 +2,12 @@
*.o
.deps
.libs
.version
.*.swp
*.gdb
core
.gdbinit
.gdb_history
/ChangeLog
/CREDITS
@ -12,6 +17,7 @@ Makefile.in
/aclocal.m4
/autom4te.cache
/compile
/config.guess
/config.h
/config.h.in
@ -25,11 +31,14 @@ Makefile.in
/stamp-h1
/*.gdb
/ioctls.h
/ioctldefs.h
/ioctlsort
/strace
/test-driver
/linux/ioctlent.h
/ioctlent[012].h
/ioctls_all[012].h
/ioctlsort[012]
/strace-*.tar.xz
/tests-m32
/tests-mx32

View File

View File

@ -14,7 +14,7 @@ architecture to be specific). Hopefully, it'll be obvious how to swap out a
different system or architecture as your circumstances apply.
ksrc=/usr/src/linux
asrc=$ksrc/arch/blackfin/include/asm
asrc=$ksrc/arch/blackfin/include
To use the errnoent.sh script, give it all the headers that might contain
appropriate errno values. Excessive headers are not a problem. The resulting
@ -22,30 +22,30 @@ output should be directly usable without modification.
sh ./errnoent.sh \
$ksrc/include/linux/*errno*.h \
$ksrc/include/asm-generic/*errno*.h \
$asrc/*errno*.h \
$asrc/asm/*errno*.h \
> errnoent.h
To use the ioctlent.sh script, give it all the base include directories. The
To use the ioctls_gen.sh script, give it all the base include directories. The
script will crawl all the headers and try to discover appropriate ioctls.
Unlike the other scripts, this one creates files for further processing. This
is because ioctls tend to have a lot of define indirection, and the ioctlent.h
is because ioctls tend to have a lot of define indirection, and the ioctlent0.h
header needs to be fully expanded into numeric form and sorted properly. So
first we process all of the ioctls with the ioctlent.sh into ioctldefs.h and
ioctls.h, and then we compile them into ioctlsort.c. The resulting output,
while directly usable, only contains definitions that match exactly the current
kernel version that the script ran against. That means older/newer ioctl
defines that might be present in the existing ioctlent.h header will be lost if
things are copied directly. A little creative use of `diff` and manual merging
should be used to produce the final ioctlent.h header.
sh ./linux/ioctlent.sh $ksrc/include $asrc
gcc -Wall -I. linux/ioctlsort.c -o ioctlsort
./ioctlsort > ioctlent.h
first we process all of the ioctls with the ioctls_gen.sh into ioctls_inc.h and
ioctls_arch.h, and then we compile them into ioctlsort.c. The resulting
output, while directly usable, only contains definitions that match exactly the
current kernel version that the script ran against. That means older/newer
ioctl defines that might be present in the existing ioctlent0.h header will be
lost if things are copied directly. A little creative use of `diff` and manual
merging should be used to produce the final ioctlent0.h header.
sh ./maint/ioctls_gen.sh $ksrc/include $asrc
gcc -Wall -I. ioctlsort.c -o ioctlsort
./ioctlsort > ioctlent0.h
To use the signalent.sh script, give it all the headers that might contain
appropriate signal values. Excessive headers are not a problem. The resulting
output should be directly usable without modification.
sh ./signalent.sh \
$asrc/signal.h \
$asrc/asm/signal.h \
> signalent.h
To use the syscallent.sh script, give it the header with the list of your
@ -54,5 +54,5 @@ a proper header as it can really only detect the system call number and its
name. It has no way of knowing the number of arguments or strace flags for
decoding them (yet?).
sh ./syscallent.sh \
$asrc/unistd.h \
$asrc/asm/unistd.h \
> syscallent.h

View File

@ -1,6 +1,12 @@
# Automake input for strace.
SUBDIRS = tests
if HAVE_M32_RUNTIME
TESTS_M32 = tests-m32
endif
if HAVE_MX32_RUNTIME
TESTS_MX32 = tests-mx32
endif
SUBDIRS = tests $(TESTS_M32) $(TESTS_MX32)
bin_PROGRAMS = strace
man_MANS = strace.1
@ -12,98 +18,425 @@ ARCH = @arch@
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = $(WARN_CFLAGS)
AM_CPPFLAGS = -I$(srcdir)/$(OS)/$(ARCH) -I$(srcdir)/$(OS) -I$(builddir)/$(OS)
AM_CPPFLAGS = -I$(builddir)/$(OS)/$(ARCH) \
-I$(srcdir)/$(OS)/$(ARCH) \
-I$(builddir)/$(OS) \
-I$(srcdir)/$(OS)
include xlat/Makemodule.am
strace_SOURCES = \
access.c \
affinity.c \
aio.c \
bjm.c \
block.c \
cacheflush.c \
capability.c \
caps0.h \
caps1.h \
chdir.c \
chmod.c \
clone.c \
count.c \
desc.c \
dirent.c \
evdev.c \
execve.c \
exit.c \
fadvise.c \
fallocate.c \
fanotify.c \
fchownat.c \
file.c \
futex.c \
get_robust_list.c \
getcpu.c \
getcwd.c \
getrandom.c \
hostname.c \
inotify.c \
io.c \
ioctl.c \
ioprio.c \
ipc.c \
kexec.c \
keyctl.c \
ldt.c \
link.c \
loop.c \
lseek.c \
mem.c \
mknod.c \
mount.c \
mtd.c \
net.c \
open.c \
or1k_atomic.c \
pathtrace.c \
personality.c \
prctl.c \
printmode.c \
printstat.h \
process.c \
process_vm.c \
ptp.c \
ptrace.h \
quota.c \
readahead.c \
readlink.c \
reboot.c \
regs.h \
renameat.c \
resource.c \
sched.c \
scsi.c \
seccomp.c \
signal.c \
sigreturn.c \
sock.c \
socketutils.c \
sram_alloc.c \
statfs.c \
strace.c \
stream.c \
swapon.c \
sync_file_range.c \
syscall.c \
sysctl.c \
sysinfo.c \
syslog.c \
sysmips.c \
term.c \
time.c \
truncate.c \
uid.c \
uid16.c \
umask.c \
umount.c \
uname.c \
util.c \
utime.c \
utimes.c \
v4l2.c \
vsprintf.c \
wait.c \
xattr.c
if USE_LIBUNWIND
strace_SOURCES += unwind.c
strace_CPPFLAGS = $(AM_CPPFLAGS) $(libunwind_CPPFLAGS)
strace_LDFLAGS = $(libunwind_LDFLAGS)
strace_LDADD = $(libunwind_LIBS)
else
strace_CPPFLAGS = $(AM_CPPFLAGS)
endif
strace_SOURCES = strace.c syscall.c count.c util.c desc.c file.c ipc.c \
io.c ioctl.c mem.c net.c process.c bjm.c quota.c \
resource.c signal.c sock.c system.c term.c time.c \
scsi.c stream.c block.c pathtrace.c mtd.c vsprintf.c \
loop.c
noinst_HEADERS = defs.h
# Enable this to get link map generated
#strace_CFLAGS = $(AM_CFLAGS) -Wl,-Map=strace.mapfile
EXTRA_DIST = $(man_MANS) errnoent.sh signalent.sh syscallent.sh ioctlsort.c \
debian/changelog debian/compat debian/control debian/copyright \
debian/rules debian/source/format debian/watch \
debian/strace64.install debian/strace64.manpages \
debian/strace.docs debian/strace.examples debian/strace.install \
debian/strace.manpages debian/strace-udeb.install \
strace.spec \
strace-graph strace-log-merge \
ChangeLog ChangeLog-CVS COPYRIGHT CREDITS \
README-linux README-linux-ptrace \
linux/ioctlsort.c linux/ioctlent.sh \
linux/ioctlent.h.in linux/errnoent.h linux/signalent.h \
linux/syscall.h linux/dummy.h linux/mtd-abi.h \
linux/i386/ioctlent.h.in linux/i386/syscallent.h \
linux/alpha/errnoent.h linux/alpha/ioctlent.h.in \
linux/alpha/signalent.h linux/alpha/syscallent.h \
linux/arm/ioctlent.h.in linux/arm/syscallent.h \
linux/arm/syscallent1.h \
linux/arm/signalent1.h linux/arm/ioctlent1.h \
linux/arm/errnoent1.h \
linux/avr32/ioctlent.h.in linux/avr32/syscallent.h \
linux/bfin/ioctlent.h.in linux/bfin/syscallent.h \
linux/hppa/errnoent.h linux/hppa/ioctlent.h.in \
linux/hppa/signalent.h linux/hppa/syscallent.h \
linux/ia64/ioctlent.h.in \
linux/ia64/signalent.h \
linux/ia64/syscallent.h \
linux/m68k/ioctlent.h.in linux/m68k/syscallent.h \
linux/microblaze/ioctlent.h.in linux/microblaze/syscallent.h \
linux/mips/ioctlent.sh linux/mips/errnoent.h \
linux/mips/ioctlent.h.in linux/mips/signalent.h \
linux/mips/syscallent.h \
linux/powerpc/ioctlent.h.in linux/powerpc/ioctlent1.h \
linux/powerpc/syscallent.h linux/powerpc/syscallent1.h \
linux/powerpc/errnoent1.h linux/powerpc/signalent1.h \
linux/s390/ioctlent.h.in \
linux/s390/syscallent.h \
linux/s390x/ioctlent.h.in \
linux/s390x/syscallent.h \
linux/sh/syscallent.h \
linux/sh/ioctlent.h.in \
linux/sh64/ioctlent.h.in linux/sh64/syscallent.h \
linux/sparc/dummy2.h \
linux/sparc/errnoent.h linux/sparc/errnoent1.h \
linux/sparc/ioctlent.h.in linux/sparc/ioctlent1.h \
linux/sparc/signalent.h linux/sparc/signalent1.h \
linux/sparc/syscall1.h \
linux/sparc/syscallent.h linux/sparc/syscallent1.h \
linux/sparc/gen.pl \
linux/sparc64/dummy2.h linux/sparc64/errnoent.h \
linux/sparc64/errnoent1.h linux/sparc64/errnoent2.h \
linux/sparc64/ioctlent.h.in linux/sparc64/ioctlent1.h \
linux/sparc64/ioctlent2.h linux/sparc64/signalent.h \
linux/sparc64/signalent1.h linux/sparc64/signalent2.h \
linux/sparc64/syscall1.h \
linux/sparc64/syscallent.h linux/sparc64/syscallent1.h \
linux/sparc64/syscallent2.h \
linux/tile/ioctlent.h.in linux/tile/syscallent.h \
linux/x32/errnoent.h linux/x32/ioctlent.h.in \
linux/x32/signalent.h linux/x32/syscallent.h \
linux/x32/errnoent1.h linux/x32/ioctlent1.h \
linux/x32/signalent1.h linux/x32/syscallent1.h \
linux/x86_64/ioctlent.h.in linux/x86_64/syscallent.h \
linux/x86_64/gentab.pl \
linux/x86_64/errnoent1.h linux/x86_64/ioctlent1.h \
linux/x86_64/signalent1.h linux/x86_64/syscallent1.h \
linux/x86_64/errnoent2.h linux/x86_64/ioctlent2.h \
linux/x86_64/signalent2.h linux/x86_64/syscallent2.h \
xlate.el
EXTRA_DIST = \
$(man_MANS) \
.version \
COPYING \
CREDITS \
ChangeLog \
ChangeLog-CVS \
README-linux-ptrace \
debian/changelog \
debian/compat \
debian/control \
debian/copyright \
debian/rules \
debian/source/format \
debian/strace-udeb.install \
debian/strace.docs \
debian/strace.examples \
debian/strace.install \
debian/strace.manpages \
debian/strace64.install \
debian/strace64.manpages \
debian/watch \
errnoent.sh \
ioctlsort.c \
linux/32/ioctls_inc.h \
linux/32/syscallent.h \
linux/64/ioctls_inc.h \
linux/64/syscallent.h \
linux/aarch64/errnoent1.h \
linux/aarch64/ioctls_arch0.h \
linux/aarch64/ioctls_arch1.h \
linux/aarch64/ioctls_inc0.h \
linux/aarch64/ioctls_inc1.h \
linux/aarch64/signalent1.h \
linux/aarch64/syscallent.h \
linux/aarch64/syscallent1.h \
linux/alpha/arch_regs.h \
linux/alpha/errnoent.h \
linux/alpha/ioctls_arch0.h \
linux/alpha/ioctls_inc0.h \
linux/alpha/signalent.h \
linux/alpha/syscallent.h \
linux/alpha/userent.h \
linux/arc/ioctls_arch0.h \
linux/arc/ioctls_inc0.h \
linux/arc/syscallent.h \
linux/arch_regs.h \
linux/arm/arch_regs.h \
linux/arm/ioctls_arch0.h \
linux/arm/ioctls_inc0.h \
linux/arm/syscallent.h \
linux/arm/userent.h \
linux/avr32/ioctls_arch0.h \
linux/avr32/ioctls_inc0.h \
linux/avr32/syscallent.h \
linux/avr32/userent.h \
linux/bfin/ioctls_arch0.h \
linux/bfin/ioctls_inc0.h \
linux/bfin/syscallent.h \
linux/bfin/userent.h \
linux/crisv10/userent.h \
linux/crisv32/userent.h \
linux/dummy.h \
linux/errnoent.h \
linux/hppa/arch_regs.h \
linux/hppa/errnoent.h \
linux/hppa/ioctls_arch0.h \
linux/hppa/ioctls_inc0.h \
linux/hppa/signalent.h \
linux/hppa/syscallent.h \
linux/i386/arch_regs.h \
linux/i386/ioctls_arch0.h \
linux/i386/ioctls_inc0.h \
linux/i386/syscallent.h \
linux/i386/userent.h \
linux/i386/userent0.h \
linux/ia64/arch_regs.h \
linux/ia64/ioctls_arch0.h \
linux/ia64/ioctls_inc0.h \
linux/ia64/syscallent.h \
linux/ia64/userent.h \
linux/inet_diag.h \
linux/m68k/ioctls_arch0.h \
linux/m68k/ioctls_inc0.h \
linux/m68k/syscallent.h \
linux/m68k/userent.h \
linux/metag/ioctls_arch0.h \
linux/metag/ioctls_inc0.h \
linux/metag/syscallent.h \
linux/microblaze/ioctls_arch0.h \
linux/microblaze/ioctls_inc0.h \
linux/microblaze/syscallent.h \
linux/microblaze/userent.h \
linux/mips/arch_regs.h \
linux/mips/errnoent.h \
linux/mips/genstub.sh \
linux/mips/ioctls_arch0.h \
linux/mips/ioctls_inc0.h \
linux/mips/signalent.h \
linux/mips/syscallent-compat.h \
linux/mips/syscallent-n32.h \
linux/mips/syscallent-n64.h \
linux/mips/syscallent-o32.h \
linux/mips/syscallent.h \
linux/mips/userent.h \
linux/mtd-abi.h \
linux/or1k/ioctls_arch0.h \
linux/or1k/ioctls_inc0.h \
linux/or1k/syscallent.h \
linux/or1k/userent.h \
linux/personality.h \
linux/powerpc/arch_regs.h \
linux/powerpc/errnoent.h \
linux/powerpc/ioctls_arch0.h \
linux/powerpc/ioctls_inc0.h \
linux/powerpc/syscallent.h \
linux/powerpc/userent.h \
linux/powerpc64/arch_regs.h \
linux/powerpc64/errnoent.h \
linux/powerpc64/errnoent1.h \
linux/powerpc64/ioctls_arch0.h \
linux/powerpc64/ioctls_arch1.h \
linux/powerpc64/ioctls_inc0.h \
linux/powerpc64/ioctls_inc1.h \
linux/powerpc64/signalent1.h \
linux/powerpc64/syscallent.h \
linux/powerpc64/syscallent1.h \
linux/powerpc64/userent.h \
linux/ptp_clock.h \
linux/s390/arch_regs.h \
linux/s390/ioctls_arch0.h \
linux/s390/ioctls_inc0.h \
linux/s390/syscallent.h \
linux/s390/userent.h \
linux/s390/userent0.h \
linux/s390/userent1.h \
linux/s390x/arch_regs.h \
linux/s390x/ioctls_arch0.h \
linux/s390x/ioctls_inc0.h \
linux/s390x/syscallent.h \
linux/s390x/userent.h \
linux/sh/ioctls_arch0.h \
linux/sh/ioctls_inc0.h \
linux/sh/syscallent.h \
linux/sh/userent.h \
linux/sh/userent0.h \
linux/sh64/arch_regs.h \
linux/sh64/ioctls_arch0.h \
linux/sh64/ioctls_inc0.h \
linux/sh64/syscallent.h \
linux/sh64/userent.h \
linux/signalent.h \
linux/sock_diag.h \
linux/sparc/arch_regs.h \
linux/sparc/dummy2.h \
linux/sparc/errnoent.h \
linux/sparc/errnoent1.h \
linux/sparc/gen.pl \
linux/sparc/ioctlent1.h \
linux/sparc/ioctls_arch0.h \
linux/sparc/ioctls_inc0.h \
linux/sparc/signalent.h \
linux/sparc/signalent1.h \
linux/sparc/syscall1.h \
linux/sparc/syscallent.h \
linux/sparc/syscallent1.h \
linux/sparc/userent.h \
linux/sparc64/arch_regs.h \
linux/sparc64/dummy2.h \
linux/sparc64/errnoent.h \
linux/sparc64/errnoent1.h \
linux/sparc64/errnoent2.h \
linux/sparc64/ioctlent1.h \
linux/sparc64/ioctls_arch0.h \
linux/sparc64/ioctls_arch2.h \
linux/sparc64/ioctls_inc0.h \
linux/sparc64/ioctls_inc2.h \
linux/sparc64/signalent.h \
linux/sparc64/signalent1.h \
linux/sparc64/signalent2.h \
linux/sparc64/syscall1.h \
linux/sparc64/syscallent.h \
linux/sparc64/syscallent1.h \
linux/sparc64/syscallent2.h \
linux/sparc64/userent.h \
linux/subcall.h \
linux/syscall.h \
linux/tile/arch_regs.h \
linux/tile/errnoent1.h \
linux/tile/ioctls_arch0.h \
linux/tile/ioctls_arch1.h \
linux/tile/ioctls_inc0.h \
linux/tile/ioctls_inc1.h \
linux/tile/signalent1.h \
linux/tile/syscallent.h \
linux/tile/syscallent1.h \
linux/tile/userent.h \
linux/ubi-user.h \
linux/unix_diag.h \
linux/userent.h \
linux/userent0.h \
linux/x32/arch_regs.h \
linux/x32/errnoent1.h \
linux/x32/ioctls_arch0.h \
linux/x32/ioctls_arch1.h \
linux/x32/ioctls_inc0.h \
linux/x32/ioctls_inc1.h \
linux/x32/signalent1.h \
linux/x32/syscallent.h \
linux/x32/syscallent1.h \
linux/x32/userent.h \
linux/x86_64/arch_regs.h \
linux/x86_64/errnoent1.h \
linux/x86_64/errnoent2.h \
linux/x86_64/gentab.pl \
linux/x86_64/ioctls_arch0.h \
linux/x86_64/ioctls_arch1.h \
linux/x86_64/ioctls_arch2.h \
linux/x86_64/ioctls_inc0.h \
linux/x86_64/ioctls_inc1.h \
linux/x86_64/ioctls_inc2.h \
linux/x86_64/signalent1.h \
linux/x86_64/signalent2.h \
linux/x86_64/syscallent.h \
linux/x86_64/syscallent1.h \
linux/x86_64/syscallent2.h \
linux/x86_64/userent.h \
linux/xtensa/ioctls_arch0.h \
linux/xtensa/ioctls_inc0.h \
linux/xtensa/syscallent.h \
linux/xtensa/userent.h \
maint/ioctls_gen.sh \
maint/ioctls_hex.sh \
maint/ioctls_sym.sh \
maint/print_ioctlent.c \
signalent.sh \
strace-graph \
strace-log-merge \
strace.spec \
syscallent.sh \
$(XLAT_INPUT_FILES) \
$(XLAT_HEADER_FILES) \
xlat/gen.sh \
xlate.el
.PHONY: srpm
srpm: dist-xz
rpmbuild --define '%_srcrpmdir .' -ts $(distdir).tar.xz
BUILT_SOURCES =
BUILT_SOURCES = .version
$(srcdir)/.version:
$(AM_V_GEN)echo $(VERSION) > $@-t && mv $@-t $@
dist-hook:
$(AM_V_GEN)echo $(VERSION) > $(distdir)/.tarball-version
today = $(shell date +%Y-%m-%d)
version_regexp = $(subst .,\.,$(VERSION))
news_check_regexp = 'Noteworthy changes in release $(version_regexp) ($(today))'
news-check: NEWS
$(AM_V_GEN)if head -1 $< | \
grep -x $(news_check_regexp) >/dev/null; then \
:; \
else \
echo >&2 '$<: check failed'; \
exit 1; \
fi
ioctlsort_CC = $(CC_FOR_BUILD)
ioctlsort_DEFS = $(DEFS)
ioctlsort_INCLUDES = $(DEFAULT_INCLUDES) $(INCLUDES)
ioctlsort_CPPFLAGS = $(AM_CPPFLAGS) $(CPPFLAGS_FOR_BUILD)
ioctlsort_CFLAGS = $(AM_CFLAGS) $(CFLAGS_FOR_BUILD)
ioctlsort_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_FOR_BUILD)
ioctls_inc_h = $(wildcard $(srcdir)/$(OS)/$(ARCH)/ioctls_inc*.h)
ioctlent_h = $(patsubst $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%,ioctlent%,$(ioctls_inc_h))
BUILT_SOURCES += $(ioctlent_h)
CLEANFILES = $(ioctlent_h)
ioctlent%.h: ioctlsort%
./$< > $@
ioctlsort%$(BUILD_EXEEXT): ioctlsort%.o
$(ioctlsort_CC) $(ioctlsort_CFLAGS) $(ioctlsort_LDFLAGS) $< -o $@
ioctlsort%.o: ioctls_all%.h $(srcdir)/ioctlsort.c
$(ioctlsort_CC) $(ioctlsort_DEFS) $(ioctlsort_INCLUDES) $(ioctlsort_CPPFLAGS) $(ioctlsort_CFLAGS) -DIOCTLSORT_INC=\"$<\" -c -o $@ $(srcdir)/ioctlsort.c
ioctls_all%.h: $(srcdir)/$(OS)/$(ARCH)/ioctls_inc%.h $(srcdir)/$(OS)/$(ARCH)/ioctls_arch%.h
cat $^ > $@
if MAINTAINER_MODE
gen_changelog_start_date = 2009-07-08 20:00
$(srcdir)/ChangeLog: $(top_srcdir)/gitlog-to-changelog $(srcdir)/Makefile.in \
$(top_srcdir)/.git/refs/heads/*
$(srcdir)/ChangeLog: $(srcdir)/gitlog-to-changelog $(srcdir)/Makefile.in \
$(srcdir)/.version
@rm -f $@.new
(cd $(top_srcdir); \
(cd $(srcdir); \
./gitlog-to-changelog --append-dot \
--since='$(gen_changelog_start_date)'; \
echo; echo; echo 'See ChangeLog-CVS for older changes.' \
@ -111,44 +444,18 @@ $(srcdir)/ChangeLog: $(top_srcdir)/gitlog-to-changelog $(srcdir)/Makefile.in \
chmod 444 $@.new
mv -f $@.new $@
$(srcdir)/CREDITS: $(top_srcdir)/CREDITS.in $(top_srcdir)/.mailmap \
$(srcdir)/Makefile.in $(top_srcdir)/.git/refs/heads/*
$(srcdir)/CREDITS: $(srcdir)/CREDITS.in $(srcdir)/.mailmap \
$(srcdir)/Makefile.in $(srcdir)/.version
$(AM_V_GEN) \
{ \
cd $(top_srcdir); \
( \
cd $(srcdir); \
sed '/^##/,$$d' CREDITS.in; \
{ sed -n '1,/^##>/d; s/ \+/\t/; s/^./&/p' CREDITS.in; \
git log --pretty=format:'%aN %aE'; \
} | LC_ALL=C sort -u \
| awk -F'\t' '{printf("\t%s <%s>\n",$$1,$$2)}'; \
} > $@-t && mv $@-t $@
) > $@-t && mv $@-t $@
export TAR_OPTIONS = --owner=0 --group=0 --numeric-owner --mode=go-w,go+rX
IOCTLDIR = /usr/include
IOCTLASM = asm
ioctlent_h_in = linux/ioctlent.h.in
BUILT_SOURCES += $(ioctlent_h_in)
$(srcdir)/$(ioctlent_h_in): ioctlsort
$(<D)/$(<F) > $@
ioctlsort: $(srcdir)/linux/ioctlsort.c ioctls.h ioctldefs.h
$(filter-out -I%,$(LINK.c)) -I. -I$(IOCTLDIR) $(filter -I%,$(LINK.c)) \
-o $@ $<
ioctls.h: $(srcdir)/linux/ioctlent.sh
$(SHELL) $< $(IOCTLDIR) $(IOCTLASM)
ioctldefs.h: ioctls.h ;
endif
ioctlent_h = $(builddir)/$(OS)/ioctlent.h
BUILT_SOURCES += $(ioctlent_h)
CLEANFILES = $(ioctlent_h)
ioctlent_h_deps = $(srcdir)/$(OS)/ioctlent.h.in $(srcdir)/$(OS)/$(ARCH)/ioctlent.h.in
$(ioctlent_h): $(top_builddir)/config.status $(ioctlent_h_deps)
$(MKDIR_P) $(builddir)/$(OS)
cat $(ioctlent_h_deps) | \
$(COMPILE) -E -P - | \
LC_ALL=C sort -u -k3,3 -k2,2 > $@

187
NEWS
View File

@ -1,5 +1,176 @@
Noteworthy changes in release 4.7
=================================
Noteworthy changes in release 4.10 (2015-03-06)
===============================================
* Improvements
* Added -yy option to print protocol and address information associated with
socket descriptors.
* Extended "-e read=set" and "-e write=set" options to cover sendmsg,
recvmsg, sendmmsg, and recvmmsg syscalls.
* Implemented full 32-bit decoding of ioctl commands
(addresses Debian bug #692913 and Fedora bug #902788).
* Implemented PTRACE_GETREGS API support on ia64.
* Implemented PTRACE_GETREGS API support on mips.
* Implemented PTRACE_GETREGSET API support on s390/s390x.
* Implemented decoding of getrandom and seccomp syscalls.
* Implemented full decoding of 64-bit capability sets.
* Implemented decoding of all prctl commands.
* Implemented decoding of parametrized ioctl commands.
* Implemented decoding of evdev ioctl commands.
* Implemented decoding of v4l ioctl commands.
* Implemented decoding of SG_IO v4 ioctl commands.
* Implemented decoding of FIFREEZE/FITHAW/FITRIM ioctl commands.
* Implemented decoding of FALLOC_FL_* fallocate flags.
* Implemented decoding of rt_sigreturn signal mask on aarch64,
x32, and x86_64.
* Enhanced socket decoder to support bluetooth sockets.
* Enhanced decoding of unlisted ioctl commands.
* Enhanced decoding of getsockopt and setsockopt syscall.
* Enhanced decoding of sysinfo syscall.
* Enhanced decoding of struct cmsghdr.
* Enhanced decoding of wait status.
* Enhanced aio support on non-x86 architectures by using external libaio.h.
* Added O_TMPFILE to the list of recognized open mode flags.
* Updated the list of filesystem type constants that is used in decoding
statfs family syscalls.
* Updated lists of CAP_*, PR_*, PTRACE_*, SCHED_*, SO_*, SOL_*, SWAP_FLAG_*,
and TFD_* constants.
* Updated lists of signal constants from Linux 3.19.
* Updated lists of errno constants from Linux 3.19.
* Updated lists of ioctl commands from Linux 3.9.
* Added new syscall entries to match Linux 3.19.
* Bug fixes
* Fixed various errors in mapping between syscall numbers and associated
information like the number of syscall arguments, the name of syscall,
and syscall decoder.
* Fixed quoting issues in printing descriptors, filenames, network interface
names, struct utsname members, device/volume names of BLK* ioctl commands.
* Fixed uid_t/git_t decoding.
* Fixed potential out-of-bounds read issues in getdents/getdents64 decoders.
* Fixed potential open flags truncation on some architectures.
* Fixed decoding of struct ifreq.ifr_name.
* Fixed decoding of SIOCSIFNAME ioctl command.
* Fixed decoding of RENAME_* renameat2 flags.
* Fixed decoding of UTIME_NOW/UTIME_OMIT timeval structures.
* Fixed decoding of indirect ipc subcalls on some architectures.
* Fixed decoding of fanotify_mark syscall on 32-bit architectures.
* Fixed decoding of 32-bit stat structures on 64-bit architectures.
* Fixed decoding of 32-bit struct cmsghdr on 64-bit architectures.
* Fixed decoding of 32-bit preadv/pwritev offset on 64-bit architectures.
* Fixed decoding of sigreturn/rt_sigreturn signal mask on ia64, ppc, ppc64,
sparc, sparc64, mips, and s390.
* Fixed instruction pointer output (-i option) on architectures that support
several personalities.
* Fixed behaviour of "-e read=set" and "-e write=set" when read and write
sets intersect.
* Fixed build on systems where struct sigaction has no sa_restorer member.
* Fixed build with uclibc and musl libc.
* Portability
* Linux kernel >= 2.5.46 is required.
Older versions without a decent PTRACE_SETOPTIONS support will not work.
* On mips, linux kernel >= 2.6.15 is required.
Older versions without a decent PTRACE_GETREGS support will not work.
* On s390 and s390x, linux kernel >= 2.6.27 is required.
Older versions without a decent PTRACE_GETREGSET support will not work.
Noteworthy changes in release 4.9 (2014-08-15)
==============================================
* Changes in behavior
* Disabled OABI support on ARM EABI systems by default,
added --enable-arm-oabi option to enable it at configure time.
* Improvements
* Added experimental -k option to print stack trace after each traced syscall.
* Added -w option to produce stats on syscall latency.
(addresses Debian bug #457497).
* Added ARC architecture support.
* Added PTRACE_GETREGS API support on PowerPC.
* Enhanced Bionic libc and musl libc support.
* Enhanced tracing of x86 personality processes on x86_64 and x32.
* Enhanced tracing of ARM personality processes on AArch64.
* Enhanced 32/64bit personality detection on PowerPC.
* Implemented decoding of add_key, ioprio_get, ioprio_set, kexec_load, keyctl,
renameat2, and request_key syscalls.
* Robustified decoding of select, pselect, and io_submit syscalls.
* Enhanced decoding of delete_module, fanotify_init, fanotify_mark, fcntl,
setdomainname, sethostname, setns, and sync_file_range syscalls.
* Enhanced decoding of signal bitmasks.
* Enhanced decoding of file descriptors.
* Enhanced siginfo_t decoding.
* Enhanced PF_NETLINK decoding.
* Updated CLOCK_* constants
(addresses Fedora bug #1088455).
* Added new syscall entries to match Linux 3.16.
* Bug fixes
* Added shmat and shmdt to the set of memory mapping related syscalls.
* Fixed detaching from stopped processes.
* Fixed fanotify_mark decoding on 32bit architectures.
* Fixed offset decoding in preadv and pwritev syscalls.
* Fixed select decoding for glibc in _FORTIFY_SOURCE mode.
* Fixed decoding of epoll_ctl syscall with EPOLL_CTL_DEL argument.
* Fixed build when <sys/ptrace.h> and <linux/ptrace.h> conflict
(addresses Fedora bug #993384).
* Miscellaneous corrections in the manual page.
(Addresses Debian bug #725987).
Noteworthy changes in release 4.8 (2013-06-03)
==============================================
* Changes in behavior
* In case of normal strace termination, when the trace output is
redirected to a pipe, strace now closes it and waits for the pipe
process termination before exit.
* Improvements
* Implemented tracing using PTRACE_SEIZE API (when available).
* Implemented more reliable PTRACE_GETREGSET-based process personality
detection on x86-64 and x32 (when available).
* Added -e trace=memory option for tracing memory mapping related syscalls.
* Documented -b option.
* Allowed exit status messages to be suppressed by giving -q option twice.
* Added AArch64 architecture support
(addresses Debian bug #693074 and Fedora bug #969858).
* Added support for OpenRISC 1000, Meta, and Xtensa architectures.
* Added tilegx personality support for Tile.
* Enhanced support of NOMMU architectures.
* Enhanced decoding of getdents, mmap, perf_event_open, ptrace, and
quotactl syscalls.
* Added new syscall entries to match Linux 3.9.
* Regenerated the list of common ioctl names from Linux 3.9.
* Updated the list of errno constants.
* Updated lists of AF_*, MADV_*, MAP_*, MSG_*, MS_*, PF_*, PR_*,
PTRACE_O_*, and TCP_* constants.
* Implemented decoding of UBI ioctls.
* Removed redundant "*32" ioctl names.
* Bug fixes
* Fixed ERESTARTNOINTR leaking to userspace on ancient kernels
(addresses Fedora bug #659382).
* Fixed kernel release string parsing
(addresses Debian bug #702309).
* Fixed decoding of *xattr syscalls
(addresses Fedora bug #885233).
* Fixed handling of files with 64-bit inode numbers by 32-bit strace
(addresses Fedora bug #912790).
* Fixed tracing forks on SPARC.
* Fixed decoding of fadvise64, fallocate, ftruncate64, io_submit, pread,
preadv, pwrite, pwritev, readahead, sigaltstack, sync_file_range, sysctl,
and truncate64 syscalls.
* Fixed categories of multiple syscalls on most of supported architectures.
* Fixed decoding of non-native 32-bit personality recv[m]msg syscalls.
* Fixed decoding of multiple 32-bit personality syscalls on x32.
* Fixed decoding of long long syscall arguments on ARM, MIPS/o32, PowerPC,
S390x, and Tile architectures.
* Fixed semtimedop decoding on S390x.
* Fixed sram_alloc decoding on Blackfin.
* Fixed build when process_vm_readv is a stab.
* Fixed build with older versions of libaio.h.
Noteworthy changes in release 4.7 (2012-05-02)
==============================================
* Changes in behavior
* strace no longer suspends waitpid until there is a child
@ -74,8 +245,8 @@ Noteworthy changes in release 4.7
* Linux kernel >= 2.6.18 is recommended. Older versions might still
work but they haven't been thoroughly tested with this release.
Noteworthy changes in release 4.6
=================================
Noteworthy changes in release 4.6 (2011-03-15)
==============================================
* Changes in behavior
* Print diagnostic information about changes in personality mode to
@ -125,8 +296,8 @@ Noteworthy changes in release 4.6
* Fixed misleading italics in the manual page.
(Addresses Debian bug #589323).
Noteworthy changes in release 4.5.20
====================================
Noteworthy changes in release 4.5.20 (2010-04-13)
=================================================
* Improvements
* Implemented decoding of new linux syscalls: inotify_init1, recvmmsg.
@ -160,8 +331,8 @@ Noteworthy changes in release 4.5.20
(Addresses Debian bug #513014)
* Corrected handling of killed threads.
Noteworthy changes in release 4.5.19
====================================
Noteworthy changes in release 4.5.19 (2009-10-21)
=================================================
* Changes in behavior
* When command exits, strace now exits with the same exit status.

2
README
View File

@ -1,7 +1,7 @@
This is strace, a system call tracer for Linux.
strace is released under a Berkeley-style license at the request
of Paul Kranenburg; see the file COPYRIGHT for details.
of Paul Kranenburg; see the file COPYING for details.
See the file CREDITS for a list of authors and other contributors.

View File

@ -2,8 +2,9 @@ Requirements
============
If you use the GIT version of strace there will be some files missing
that you need to build strace. These files are generated by tools from
the GNU Autoconf and Automake packages. You need recent versions, which
provide the `autoreconf -i' command that will do everything you need.
the GNU Autoconf and Automake packages.
Note: rather than run `autoreconf' directly, use the `./bootstrap' script.
No more ChangeLog file
@ -22,3 +23,10 @@ Each commit log should always start with a one-line summary, the second
line should be blank, and the remaining lines are usually ChangeLog-style
entries for all affected files, except the leading TABs which should
be omitted.
Documentation
=============
All noteworthy changes should be mentioned in NEWS. All changes in strace
command interface should be reflected in the man page. New options should
be documented both in -h output and in the man page.

View File

@ -1,31 +0,0 @@
Strace has been ported by Branko Lankester <branko@hacktic.nl>
to run on Linux systems. Since then it has been greatly modified
by various other people.
If you want to compile strace on a Linux system please make sure that
you use recent kernel headers. Strace needs those to get the proper data
structures and constatns used by the kernel, since these can be
different from the structures that the C library uses. Currently you
will need at least a 2.2.7 or newer kernel.
To complicate things a bit further strace might not compile if you are
using development kernels. These tend to have headers that conflict with
the headers from libc which makes it impossible to use them.
There are three ways to compile strace with other kernel headers:
* Specify the location in CFLAGS when running configure
CFLAGS=-I/usr/src/linux/include ./configure
* you can tell make where your kernel sources are. For example if you
have your kernelsource in /usr/src/linux, you can invoke make like
this:
make CFLAGS="\$CFLAGS -I/usr/src/linux/include"
(the extra \$CFLAGS is there to make sure we don't override any CFLAGS
settings that configure has found).
* you can link /usr/include/linux and /usr/include/asm to the
corresponding directories in your kernel source-tree.

30
access.c Normal file
View File

@ -0,0 +1,30 @@
#include "defs.h"
#include <fcntl.h>
#include "xlat/access_flags.h"
static int
decode_access(struct tcb *tcp, int offset)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[offset]);
tprints(", ");
printflags(access_flags, tcp->u_arg[offset + 1], "?_OK");
}
return 0;
}
int
sys_access(struct tcb *tcp)
{
return decode_access(tcp, 0);
}
int
sys_faccessat(struct tcb *tcp)
{
if (entering(tcp))
print_dirfd(tcp, tcp->u_arg[0]);
return decode_access(tcp, 1);
}

57
affinity.c Normal file
View File

@ -0,0 +1,57 @@
#include "defs.h"
static void
print_affinitylist(struct tcb *tcp, long list, unsigned int len)
{
int first = 1;
unsigned long w, min_len;
if (abbrev(tcp) && len / sizeof(w) > max_strlen)
min_len = len - max_strlen * sizeof(w);
else
min_len = 0;
for (; len >= sizeof(w) && len > min_len;
len -= sizeof(w), list += sizeof(w)) {
if (umove(tcp, list, &w) < 0)
break;
if (first)
tprints("{");
else
tprints(", ");
first = 0;
tprintf("%lx", w);
}
if (len) {
if (first)
tprintf("%#lx", list);
else
tprintf(", %s}", (len >= sizeof(w) && len > min_len ?
"???" : "..."));
} else {
tprints(first ? "{}" : "}");
}
}
int
sys_sched_setaffinity(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
print_affinitylist(tcp, tcp->u_arg[2], tcp->u_arg[1]);
}
return 0;
}
int
sys_sched_getaffinity(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
} else {
if (tcp->u_rval == -1)
tprintf("%#lx", tcp->u_arg[2]);
else
print_affinitylist(tcp, tcp->u_arg[2], tcp->u_rval);
}
return 0;
}

273
aio.c Normal file
View File

@ -0,0 +1,273 @@
/*
* Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
* Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
* Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "defs.h"
#ifdef HAVE_LIBAIO_H
# include <libaio.h>
#endif
/* Not defined in libaio.h */
#ifndef IOCB_RESFD
# define IOCB_RESFD (1 << 0)
#endif
int
sys_io_setup(struct tcb *tcp)
{
if (entering(tcp))
tprintf("%ld, ", tcp->u_arg[0]);
else {
if (syserror(tcp))
tprintf("0x%0lx", tcp->u_arg[1]);
else {
unsigned long user_id;
if (umove(tcp, tcp->u_arg[1], &user_id) == 0)
tprintf("{%lu}", user_id);
else
tprints("{...}");
}
}
return 0;
}
int
sys_io_destroy(struct tcb *tcp)
{
if (entering(tcp))
tprintf("%lu", tcp->u_arg[0]);
return 0;
}
#ifdef HAVE_LIBAIO_H
enum iocb_sub {
SUB_NONE, SUB_COMMON, SUB_POLL, SUB_VECTOR
};
static enum iocb_sub
tprint_lio_opcode(unsigned cmd)
{
static const struct {
const char *name;
enum iocb_sub sub;
} cmds[] = {
{ "pread", SUB_COMMON },
{ "pwrite", SUB_COMMON },
{ "fsync", SUB_NONE },
{ "fdsync", SUB_NONE },
{ "op4", SUB_NONE },
{ "poll", SUB_POLL },
{ "noop", SUB_NONE },
{ "preadv", SUB_VECTOR },
{ "pwritev", SUB_VECTOR },
};
if (cmd < ARRAY_SIZE(cmds)) {
tprints(cmds[cmd].name);
return cmds[cmd].sub;
}
tprintf("%u /* SUB_??? */", cmd);
return SUB_NONE;
}
static void
print_common_flags(struct iocb *iocb)
{
#if HAVE_STRUCT_IOCB_U_C_FLAGS
if (iocb->u.c.flags & IOCB_RESFD)
tprintf(", resfd=%d", iocb->u.c.resfd);
if (iocb->u.c.flags & ~IOCB_RESFD)
tprintf(", flags=%x", iocb->u.c.flags);
#else
# warning "libaio.h is too old => limited io_submit decoding"
#endif
}
#endif /* HAVE_LIBAIO_H */
int
sys_io_submit(struct tcb *tcp)
{
if (entering(tcp)) {
#ifdef HAVE_LIBAIO_H
long nr = tcp->u_arg[1];
/* if nr <= 0, we end up printing just "{}" */
tprintf("%lu, %ld, {", tcp->u_arg[0], tcp->u_arg[1]);
{
long i;
struct iocb **iocbs = (void *)tcp->u_arg[2];
//FIXME: decoding of 32-bit call by 64-bit strace
for (i = 0; i < nr; i++, iocbs++) {
enum iocb_sub sub;
struct iocb *iocbp;
struct iocb iocb;
if (i)
tprints(", ");
if (umove(tcp, (unsigned long)iocbs, &iocbp)) {
tprintf("%#lx", (unsigned long)iocbs);
/* No point in trying to read iocbs+1 etc */
/* (nr can be ridiculously large): */
break;
}
if (umove(tcp, (unsigned long)iocbp, &iocb)) {
tprintf("{%#lx}", (unsigned long)iocbp);
continue;
}
tprints("{");
if (iocb.data)
tprintf("data:%p, ", iocb.data);
if (iocb.key)
tprintf("key:%u, ", iocb.key);
sub = tprint_lio_opcode(iocb.aio_lio_opcode);
if (iocb.aio_reqprio)
tprintf(", reqprio:%d", iocb.aio_reqprio);
tprintf(", filedes:%d", iocb.aio_fildes);
switch (sub) {
case SUB_COMMON:
#if HAVE_DECL_IO_CMD_PWRITE
if (iocb.aio_lio_opcode == IO_CMD_PWRITE) {
tprints(", str:");
printstr(tcp, (unsigned long)iocb.u.c.buf,
iocb.u.c.nbytes);
} else
#endif
tprintf(", buf:%p", iocb.u.c.buf);
tprintf(", nbytes:%lu, offset:%lld",
iocb.u.c.nbytes,
iocb.u.c.offset);
print_common_flags(&iocb);
break;
case SUB_VECTOR:
tprintf(", %lld", iocb.u.v.offset);
print_common_flags(&iocb);
tprints(", ");
tprint_iov(tcp, iocb.u.v.nr,
(unsigned long)iocb.u.v.vec,
#if HAVE_DECL_IO_CMD_PWRITEV
iocb.aio_lio_opcode == IO_CMD_PWRITEV
#else
0
#endif
);
break;
case SUB_POLL:
tprintf(", %x", iocb.u.poll.events);
break;
case SUB_NONE:
break;
}
tprints("}");
}
}
tprints("}");
#else
# warning "libaio.h is not available => no io_submit decoding"
tprintf("%lu, %ld, %#lx", tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
#endif
}
return 0;
}
int
sys_io_cancel(struct tcb *tcp)
{
if (entering(tcp)) {
#ifdef HAVE_LIBAIO_H
struct iocb iocb;
#endif
tprintf("%lu, ", tcp->u_arg[0]);
#ifdef HAVE_LIBAIO_H
if (umove(tcp, tcp->u_arg[1], &iocb) == 0) {
tprintf("{%p, %u, %u, %u, %d}, ",
iocb.data, iocb.key,
(unsigned)iocb.aio_lio_opcode,
(unsigned)iocb.aio_reqprio, iocb.aio_fildes);
} else
#endif
tprints("{...}, ");
} else {
if (tcp->u_rval < 0)
tprints("{...}");
else {
#ifdef HAVE_LIBAIO_H
struct io_event event;
if (umove(tcp, tcp->u_arg[2], &event) == 0)
tprintf("{%p, %p, %ld, %ld}",
event.data, event.obj,
event.res, event.res2);
else
#endif
tprints("{...}");
}
}
return 0;
}
int
sys_io_getevents(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%ld, %ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1],
tcp->u_arg[2]);
} else {
if (tcp->u_rval == 0) {
tprints("{}");
} else {
#ifdef HAVE_LIBAIO_H
struct io_event *events = (void *)tcp->u_arg[3];
long i, nr = tcp->u_rval;
for (i = 0; i < nr; i++, events++) {
struct io_event event;
if (i == 0)
tprints("{");
else
tprints(", ");
if (umove(tcp, (unsigned long)events, &event) != 0) {
tprints("{...}");
continue;
}
tprintf("{%p, %p, %ld, %ld}", event.data,
event.obj, event.res, event.res2);
}
tprints("}, ");
#else
tprints("{...}");
#endif
}
print_timespec(tcp, tcp->u_arg[4]);
}
return 0;
}

81
bjm.c
View File

@ -34,7 +34,6 @@
#include <sys/wait.h>
#include <sys/resource.h>
#include <sys/utsname.h>
#include <sys/user.h>
/* Bits of module.flags. */
@ -69,26 +68,9 @@ struct module_info
long usecount;
};
static const struct xlat which[] = {
{ 0, "0" },
{ QM_MODULES, "QM_MODULES" },
{ QM_DEPS, "QM_DEPS" },
{ QM_REFS, "QM_REFS" },
{ QM_SYMBOLS, "QM_SYMBOLS" },
{ QM_INFO, "QM_INFO" },
{ 0, NULL },
};
static const struct xlat modflags[] = {
{ MOD_UNINITIALIZED, "MOD_UNINITIALIZED" },
{ MOD_RUNNING, "MOD_RUNNING" },
{ MOD_DELETED, "MOD_DELETED" },
{ MOD_AUTOCLEAN, "MOD_AUTOCLEAN" },
{ MOD_VISITED, "MOD_VISITED" },
{ MOD_USED_ONCE, "MOD_USED_ONCE" },
{ MOD_JUST_FREED, "MOD_JUST_FREED" },
{ 0, NULL },
};
#include "xlat/qm_which.h"
#include "xlat/modflags.h"
#include "xlat/delete_module_flags.h"
int
sys_query_module(struct tcb *tcp)
@ -96,7 +78,7 @@ sys_query_module(struct tcb *tcp)
if (entering(tcp)) {
printstr(tcp, tcp->u_arg[0], -1);
tprints(", ");
printxval(which, tcp->u_arg[1], "QM_???");
printxval(qm_which, tcp->u_arg[1], "QM_???");
tprints(", ");
} else {
size_t ret;
@ -115,7 +97,7 @@ sys_query_module(struct tcb *tcp)
printflags(modflags, mi.flags, "MOD_???");
tprintf(", usecount=%lu}, ", mi.usecount);
}
tprintf("%Zu", ret);
tprintf("%lu", (unsigned long)ret);
} else if ((tcp->u_arg[1]==QM_MODULES) ||
(tcp->u_arg[1]==QM_DEPS) ||
(tcp->u_arg[1]==QM_REFS)) {
@ -127,11 +109,11 @@ sys_query_module(struct tcb *tcp)
if (!data) {
fprintf(stderr, "out of memory\n");
tprintf(" /* %Zu entries */ ", ret);
tprintf(" /* %lu entries */ ", (unsigned long)ret);
} else {
if (umoven(tcp, tcp->u_arg[2],
tcp->u_arg[3], data) < 0) {
tprintf(" /* %Zu entries */ ", ret);
tprintf(" /* %lu entries */ ", (unsigned long)ret);
} else {
for (idx = 0; idx < ret; idx++) {
tprintf("%s%s",
@ -143,8 +125,8 @@ sys_query_module(struct tcb *tcp)
free(data);
}
} else
tprintf(" /* %Zu entries */ ", ret);
tprintf("}, %Zu", ret);
tprintf(" /* %lu entries */ ", (unsigned long)ret);
tprintf("}, %lu", (unsigned long)ret);
} else if (tcp->u_arg[1]==QM_SYMBOLS) {
tprints("{");
if (!abbrev(tcp)) {
@ -154,11 +136,11 @@ sys_query_module(struct tcb *tcp)
if (!data) {
fprintf(stderr, "out of memory\n");
tprintf(" /* %Zu entries */ ", ret);
tprintf(" /* %lu entries */ ", (unsigned long)ret);
} else {
if (umoven(tcp, tcp->u_arg[2],
tcp->u_arg[3], data) < 0) {
tprintf(" /* %Zu entries */ ", ret);
tprintf(" /* %lu entries */ ", (unsigned long)ret);
} else {
for (idx = 0; idx < ret; idx++) {
tprintf("%s{name=%s, value=%lu}",
@ -171,8 +153,8 @@ sys_query_module(struct tcb *tcp)
free(data);
}
} else
tprintf(" /* %Zu entries */ ", ret);
tprintf("}, %Zd", ret);
tprintf(" /* %lu entries */ ", (unsigned long)ret);
tprintf("}, %ld", (unsigned long)ret);
} else {
printstr(tcp, tcp->u_arg[2], tcp->u_arg[3]);
tprintf(", %#lx", tcp->u_arg[4]);
@ -191,13 +173,46 @@ sys_create_module(struct tcb *tcp)
return RVAL_HEX;
}
int
sys_delete_module(struct tcb *tcp)
{
if (entering(tcp)) {
printstr(tcp, tcp->u_arg[0], -1);
tprints(", ");
printflags(delete_module_flags, tcp->u_arg[1], "O_???");
}
return 0;
}
int
sys_init_module(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%#lx, ", tcp->u_arg[0]);
tprintf("%lu, ", tcp->u_arg[1]);
tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
printstr(tcp, tcp->u_arg[2], -1);
}
return 0;
}
#define MODULE_INIT_IGNORE_MODVERSIONS 1
#define MODULE_INIT_IGNORE_VERMAGIC 2
#include "xlat/module_init_flags.h"
int
sys_finit_module(struct tcb *tcp)
{
if (exiting(tcp))
return 0;
/* file descriptor */
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* param_values */
printstr(tcp, tcp->u_arg[1], -1);
tprints(", ");
/* flags */
printflags(module_init_flags, tcp->u_arg[2], "MODULE_INIT_???");
return 0;
}

55
block.c
View File

@ -79,11 +79,7 @@ struct blk_user_trace_setup {
#define BLKSECDISCARD _IO(0x12,125)
#endif
static const struct xlat blkpg_ops[] = {
{ BLKPG_ADD_PARTITION, "BLKPG_ADD_PARTITION", },
{ BLKPG_DEL_PARTITION, "BLKPG_DEL_PARTITION", },
{ 0, NULL },
};
#include "xlat/blkpg_ops.h"
static void
print_blkpg_req(struct tcb *tcp, struct blkpg_ioctl_arg *blkpg)
@ -98,16 +94,20 @@ print_blkpg_req(struct tcb *tcp, struct blkpg_ioctl_arg *blkpg)
if (umove(tcp, (long) blkpg->data, &p) < 0)
tprintf("%#lx}", (long) blkpg->data);
else
tprintf("{start=%lld, length=%lld, pno=%d, "
"devname=\"%.*s\", volname=\"%.*s\"}}",
p.start, p.length, p.pno,
(int) sizeof(p.devname), p.devname,
(int) sizeof(p.volname), p.volname);
else {
tprintf("{start=%lld, length=%lld, pno=%d, devname=",
p.start, p.length, p.pno);
print_quoted_string(p.devname, sizeof(p.devname),
QUOTE_0_TERMINATED);
tprints(", volname=");
print_quoted_string(p.volname, sizeof(p.volname),
QUOTE_0_TERMINATED);
tprints("}}");
}
}
int
block_ioctl(struct tcb *tcp, long code, long arg)
block_ioctl(struct tcb *tcp, const unsigned int code, long arg)
{
switch (code) {
/* take arg as a value, not as a pointer */
@ -120,6 +120,11 @@ block_ioctl(struct tcb *tcp, long code, long arg)
/* take a signed int */
case BLKROSET:
case BLKBSZSET:
#ifdef FIFREEZE
/* First seen in linux-2.6.29 */
case FIFREEZE:
case FITHAW:
#endif
if (entering(tcp)) {
int val;
if (umove(tcp, arg, &val) < 0)
@ -188,7 +193,7 @@ block_ioctl(struct tcb *tcp, long code, long arg)
tprintf(", %#lx", arg);
else
tprintf(", %lu", val);
}
}
break;
#ifdef HAVE_BLKGETSIZE64
@ -261,12 +266,30 @@ block_ioctl(struct tcb *tcp, long code, long arg)
struct blk_user_trace_setup buts;
if (syserror(tcp) || umove(tcp, arg, &buts) < 0)
tprintf(", %#lx", arg);
else
tprintf(", {name=\"%.*s\"}",
(int) sizeof(buts.name), buts.name);
else {
tprints(", {name=");
print_quoted_string(buts.name, sizeof(buts.name),
QUOTE_0_TERMINATED);
tprints("}");
}
}
break;
#ifdef FITRIM
/* First seen in linux-2.6.37 */
case FITRIM:
if (entering(tcp)) {
struct fstrim_range fstrim;
if (umove(tcp, arg, &fstrim))
tprintf(", %#lx", arg);
else
tprintf(", {start=%#" PRIx64 ", len=%#" PRIx64 ", "
"minlen=%#" PRIx64 "}", (uint64_t) fstrim.start,
(uint64_t) fstrim.len, (uint64_t) fstrim.minlen);
}
break;
#endif
/* No arguments or unhandled */
case BLKTRACESTART:
case BLKTRACESTOP:

18
bootstrap Executable file
View File

@ -0,0 +1,18 @@
#!/bin/sh -eu
for m in -m32 -mx32; do
mkdir -p tests$m
find tests$m -type l -delete
sed "s/^AM_CFLAGS[[:space:]]*=.*/& $m/" \
tests/Makefile.am > tests$m/Makefile.am
for f in tests/*; do
case "${f##*/}" in
Makefile*) continue;;
esac
ln -s ../"$f" tests$m/
done
done
./xlat/gen.sh
exec autoreconf -f -i "$@"

29
build_static_example.sh Executable file
View File

@ -0,0 +1,29 @@
#!/bin/sh -e
BUILDFLAG=""
#BUILDFLAG="--build=i686"
#export CC="i686-gcc"
# -mpreferred-stack-boundary=2 can be used to prevent gcc 4.2.x
# from aligning stack to 16 bytes. (Which is gcc's way of supporting SSE).
# For me it saves about 6k of text segment.
# This may be unsafe if your libc expects 16 byte stack alignment
# on function entry.
export CC="x86_64-gcc"
export CFLAGS="-Os\
-fomit-frame-pointer\
-static\
-static-libgcc\
-ffunction-sections -fdata-sections\
-falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1\
-fno-unwind-tables\
-fno-asynchronous-unwind-tables\
-Wl,--gc-sections\
-Wl,-Map=strace.mapfile\
"
./bootstrap
./configure $BUILDFLAG #--enable-maintainer-mode
make CC="$CC" CFLAGS="$CFLAGS"

94
cacheflush.c Normal file
View File

@ -0,0 +1,94 @@
#include "defs.h"
#ifdef HAVE_ASM_CACHECTL_H
# include <asm/cachectl.h>
#endif
#ifdef M68K
# include "xlat/cacheflush_scope.h"
static const struct xlat cacheflush_flags[] = {
#ifdef FLUSH_CACHE_BOTH
XLAT(FLUSH_CACHE_BOTH),
#endif
#ifdef FLUSH_CACHE_DATA
XLAT(FLUSH_CACHE_DATA),
#endif
#ifdef FLUSH_CACHE_INSN
XLAT(FLUSH_CACHE_INSN),
#endif
XLAT_END
};
int
sys_cacheflush(struct tcb *tcp)
{
if (entering(tcp)) {
/* addr */
tprintf("%#lx, ", tcp->u_arg[0]);
/* scope */
printxval(cacheflush_scope, tcp->u_arg[1], "FLUSH_SCOPE_???");
tprints(", ");
/* flags */
printflags(cacheflush_flags, tcp->u_arg[2], "FLUSH_CACHE_???");
/* len */
tprintf(", %lu", tcp->u_arg[3]);
}
return 0;
}
#endif /* M68K */
#ifdef BFIN
static const struct xlat cacheflush_flags[] = {
XLAT(ICACHE),
XLAT(DCACHE),
XLAT(BCACHE),
XLAT_END
};
int
sys_cacheflush(struct tcb *tcp)
{
if (entering(tcp)) {
/* start addr */
tprintf("%#lx, ", tcp->u_arg[0]);
/* length */
tprintf("%ld, ", tcp->u_arg[1]);
/* flags */
printxval(cacheflush_flags, tcp->u_arg[1], "?CACHE");
}
return 0;
}
#endif /* BFIN */
#ifdef SH
static const struct xlat cacheflush_flags[] = {
#ifdef CACHEFLUSH_D_INVAL
XLAT(CACHEFLUSH_D_INVAL),
#endif
#ifdef CACHEFLUSH_D_WB
XLAT(CACHEFLUSH_D_WB),
#endif
#ifdef CACHEFLUSH_D_PURGE
XLAT(CACHEFLUSH_D_PURGE),
#endif
#ifdef CACHEFLUSH_I
XLAT(CACHEFLUSH_I),
#endif
XLAT_END
};
int
sys_cacheflush(struct tcb *tcp)
{
if (entering(tcp)) {
/* addr */
tprintf("%#lx, ", tcp->u_arg[0]);
/* len */
tprintf("%lu, ", tcp->u_arg[1]);
/* flags */
printflags(cacheflush_flags, tcp->u_arg[2], "CACHEFLUSH_???");
}
return 0;
}
#endif /* SH */

146
capability.c Normal file
View File

@ -0,0 +1,146 @@
#include "defs.h"
/* these constants are the same as in <linux/capability.h> */
enum {
#include "caps0.h"
};
#include "xlat/cap_mask0.h"
/* these constants are CAP_TO_INDEX'ed constants from <linux/capability.h> */
enum {
#include "caps1.h"
};
#include "xlat/cap_mask1.h"
/* these constants are the same as in <linux/capability.h> */
enum {
_LINUX_CAPABILITY_VERSION_1 = 0x19980330,
_LINUX_CAPABILITY_VERSION_2 = 0x20071026,
_LINUX_CAPABILITY_VERSION_3 = 0x20080522
};
#include "xlat/cap_version.h"
typedef struct user_cap_header_struct {
uint32_t version;
int pid;
} *cap_user_header_t;
typedef struct user_cap_data_struct {
uint32_t effective;
uint32_t permitted;
uint32_t inheritable;
} *cap_user_data_t;
static cap_user_header_t
get_cap_header(struct tcb *tcp, unsigned long addr)
{
static struct user_cap_header_struct header;
if (!addr || !verbose(tcp))
return NULL;
if (umove(tcp, addr, &header) < 0)
return NULL;
return &header;
}
static void
print_cap_header(struct tcb *tcp, unsigned long addr, cap_user_header_t h)
{
if (!addr) {
tprints("NULL");
return;
}
if (!h) {
tprintf("%#lx", addr);
return;
}
tprints("{");
printxval(cap_version, h->version,
"_LINUX_CAPABILITY_VERSION_???");
tprintf(", %d}", h->pid);
}
static void
print_cap_bits(const uint32_t lo, const uint32_t hi)
{
if (lo || !hi)
printflags(cap_mask0, lo, "CAP_???");
if (hi) {
if (lo)
tprints("|");
printflags(cap_mask1, hi, "CAP_???");
}
}
static void
print_cap_data(struct tcb *tcp, unsigned long addr, const cap_user_header_t h)
{
struct user_cap_data_struct data[2];
unsigned int len;
if (!addr) {
tprints("NULL");
return;
}
if (!h || !verbose(tcp) ||
(exiting(tcp) && syserror(tcp))) {
tprintf("%#lx", addr);
return;
}
if (_LINUX_CAPABILITY_VERSION_2 == h->version ||
_LINUX_CAPABILITY_VERSION_3 == h->version)
len = 2;
else
len = 1;
if (umoven(tcp, addr, len * sizeof(data[0]), (char *) data) < 0) {
tprintf("%#lx", addr);
return;
}
tprints("{");
print_cap_bits(data[0].effective, len > 1 ? data[1].effective : 0);
tprints(", ");
print_cap_bits(data[0].permitted, len > 1 ? data[1].permitted : 0);
tprints(", ");
print_cap_bits(data[0].inheritable, len > 1 ? data[1].inheritable : 0);
tprints("}");
}
int
sys_capget(struct tcb *tcp)
{
cap_user_header_t h;
if (entering(tcp)) {
h = get_cap_header(tcp, tcp->u_arg[0]);
print_cap_header(tcp, tcp->u_arg[0], h);
tprints(", ");
} else {
h = syserror(tcp) ? NULL : get_cap_header(tcp, tcp->u_arg[0]);
print_cap_data(tcp, tcp->u_arg[1], h);
}
return 0;
}
int
sys_capset(struct tcb *tcp)
{
if (entering(tcp)) {
cap_user_header_t h = get_cap_header(tcp, tcp->u_arg[0]);
print_cap_header(tcp, tcp->u_arg[0], h);
tprints(", ");
print_cap_data(tcp, tcp->u_arg[1], h);
}
return 0;
}

32
caps0.h Normal file
View File

@ -0,0 +1,32 @@
CAP_CHOWN,
CAP_DAC_OVERRIDE,
CAP_DAC_READ_SEARCH,
CAP_FOWNER,
CAP_FSETID,
CAP_KILL,
CAP_SETGID,
CAP_SETUID,
CAP_SETPCAP,
CAP_LINUX_IMMUTABLE,
CAP_NET_BIND_SERVICE,
CAP_NET_BROADCAST,
CAP_NET_ADMIN,
CAP_NET_RAW,
CAP_IPC_LOCK,
CAP_IPC_OWNER,
CAP_SYS_MODULE,
CAP_SYS_RAWIO,
CAP_SYS_CHROOT,
CAP_SYS_PTRACE,
CAP_SYS_PACCT,
CAP_SYS_ADMIN,
CAP_SYS_BOOT,
CAP_SYS_NICE,
CAP_SYS_RESOURCE,
CAP_SYS_TIME,
CAP_SYS_TTY_CONFIG,
CAP_MKNOD,
CAP_LEASE,
CAP_AUDIT_WRITE,
CAP_AUDIT_CONTROL,
CAP_SETFCAP,

6
caps1.h Normal file
View File

@ -0,0 +1,6 @@
CAP_MAC_OVERRIDE,
CAP_MAC_ADMIN,
CAP_SYSLOG,
CAP_WAKE_ALARM,
CAP_BLOCK_SUSPEND,
CAP_AUDIT_READ,

10
chdir.c Normal file
View File

@ -0,0 +1,10 @@
#include "defs.h"
int
sys_chdir(struct tcb *tcp)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
}
return 0;
}

35
chmod.c Normal file
View File

@ -0,0 +1,35 @@
#include "defs.h"
static int
decode_chmod(struct tcb *tcp, int offset)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[offset]);
tprintf(", %#lo", tcp->u_arg[offset + 1]);
}
return 0;
}
int
sys_chmod(struct tcb *tcp)
{
return decode_chmod(tcp, 0);
}
int
sys_fchmodat(struct tcb *tcp)
{
if (entering(tcp))
print_dirfd(tcp, tcp->u_arg[0]);
return decode_chmod(tcp, 1);
}
int
sys_fchmod(struct tcb *tcp)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprintf(", %#lo", tcp->u_arg[1]);
}
return 0;
}

151
clone.c Normal file
View File

@ -0,0 +1,151 @@
#include "defs.h"
/* defines copied from linux/sched.h since we can't include that
* ourselves (it conflicts with *lots* of libc includes)
*/
#define CSIGNAL 0x000000ff /* signal mask to be sent at exit */
#define CLONE_VM 0x00000100 /* set if VM shared between processes */
#define CLONE_FS 0x00000200 /* set if fs info shared between processes */
#define CLONE_FILES 0x00000400 /* set if open files shared between processes */
#define CLONE_SIGHAND 0x00000800 /* set if signal handlers shared */
#define CLONE_IDLETASK 0x00001000 /* kernel-only flag */
#define CLONE_PTRACE 0x00002000 /* set if we want to let tracing continue on the child too */
#define CLONE_VFORK 0x00004000 /* set if the parent wants the child to wake it up on mm_release */
#define CLONE_PARENT 0x00008000 /* set if we want to have the same parent as the cloner */
#define CLONE_THREAD 0x00010000 /* Same thread group? */
#define CLONE_NEWNS 0x00020000 /* New namespace group? */
#define CLONE_SYSVSEM 0x00040000 /* share system V SEM_UNDO semantics */
#define CLONE_SETTLS 0x00080000 /* create a new TLS for the child */
#define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */
#define CLONE_CHILD_CLEARTID 0x00200000 /* clear the TID in the child */
#define CLONE_UNTRACED 0x00800000 /* set if the tracing process can't force CLONE_PTRACE on this clone */
#define CLONE_CHILD_SETTID 0x01000000 /* set the TID in the child */
#define CLONE_STOPPED 0x02000000 /* Start in stopped state */
#define CLONE_NEWUTS 0x04000000 /* New utsname group? */
#define CLONE_NEWIPC 0x08000000 /* New ipcs */
#define CLONE_NEWUSER 0x10000000 /* New user namespace */
#define CLONE_NEWPID 0x20000000 /* New pid namespace */
#define CLONE_NEWNET 0x40000000 /* New network namespace */
#define CLONE_IO 0x80000000 /* Clone io context */
#include "xlat/clone_flags.h"
#if defined IA64
# define ARG_FLAGS 0
# define ARG_STACK 1
# define ARG_STACKSIZE (tcp->scno == SYS_clone2 ? 2 : -1)
# define ARG_PTID (tcp->scno == SYS_clone2 ? 3 : 2)
# define ARG_CTID (tcp->scno == SYS_clone2 ? 4 : 3)
# define ARG_TLS (tcp->scno == SYS_clone2 ? 5 : 4)
#elif defined S390 || defined S390X || defined CRISV10 || defined CRISV32
# define ARG_STACK 0
# define ARG_FLAGS 1
# define ARG_PTID 2
# define ARG_CTID 3
# define ARG_TLS 4
#elif defined X86_64 || defined X32
/* x86 personality processes have the last two arguments flipped. */
# define ARG_FLAGS 0
# define ARG_STACK 1
# define ARG_PTID 2
# define ARG_CTID ((current_personality != 1) ? 3 : 4)
# define ARG_TLS ((current_personality != 1) ? 4 : 3)
#elif defined ALPHA || defined TILE || defined OR1K
# define ARG_FLAGS 0
# define ARG_STACK 1
# define ARG_PTID 2
# define ARG_CTID 3
# define ARG_TLS 4
#else
# define ARG_FLAGS 0
# define ARG_STACK 1
# define ARG_PTID 2
# define ARG_TLS 3
# define ARG_CTID 4
#endif
#if defined I386 || defined X86_64 || defined X32
extern void print_user_desc(struct tcb *, long);
#endif /* I386 || X86_64 || X32 */
int
sys_clone(struct tcb *tcp)
{
if (exiting(tcp)) {
const char *sep = "|";
unsigned long flags = tcp->u_arg[ARG_FLAGS];
tprintf("child_stack=%#lx, ", tcp->u_arg[ARG_STACK]);
#ifdef ARG_STACKSIZE
if (ARG_STACKSIZE != -1)
tprintf("stack_size=%#lx, ",
tcp->u_arg[ARG_STACKSIZE]);
#endif
tprints("flags=");
if (!printflags(clone_flags, flags &~ CSIGNAL, NULL))
sep = "";
if ((flags & CSIGNAL) != 0)
tprintf("%s%s", sep, signame(flags & CSIGNAL));
if ((flags & (CLONE_PARENT_SETTID|CLONE_CHILD_SETTID
|CLONE_CHILD_CLEARTID|CLONE_SETTLS)) == 0)
return 0;
if (flags & CLONE_PARENT_SETTID)
tprintf(", parent_tidptr=%#lx", tcp->u_arg[ARG_PTID]);
if (flags & CLONE_SETTLS) {
#if defined I386 || defined X86_64 || defined X32
# ifndef I386
if (current_personality == 1)
# endif
{
tprints(", tls=");
print_user_desc(tcp, tcp->u_arg[ARG_TLS]);
}
# ifndef I386
else
# endif
#endif /* I386 || X86_64 || X32 */
tprintf(", tls=%#lx", tcp->u_arg[ARG_TLS]);
}
if (flags & (CLONE_CHILD_SETTID|CLONE_CHILD_CLEARTID))
tprintf(", child_tidptr=%#lx", tcp->u_arg[ARG_CTID]);
}
/* TODO on syscall entry:
* We can clear CLONE_PTRACE here since it is an ancient hack
* to allow us to catch children, and we use another hack for that.
* But CLONE_PTRACE can conceivably be used by malicious programs
* to subvert us. By clearing this bit, we can defend against it:
* in untraced execution, CLONE_PTRACE should have no effect.
*
* We can also clear CLONE_UNTRACED, since it allows to start
* children outside of our control. At the moment
* I'm trying to figure out whether there is a *legitimate*
* use of this flag which we should respect.
*/
return 0;
}
int
sys_setns(struct tcb *tcp)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printflags(clone_flags, tcp->u_arg[1], "CLONE_???");
}
return 0;
}
int
sys_unshare(struct tcb *tcp)
{
if (entering(tcp))
printflags(clone_flags, tcp->u_arg[0], "CLONE_???");
return 0;
}
int
sys_fork(struct tcb *tcp)
{
if (exiting(tcp))
return RVAL_UDECIMAL;
return 0;
}

View File

@ -1,14 +1,17 @@
dnl Process this file with autoconf to create configure. Use autoreconf.
AC_PREREQ(2.57)
AC_INIT([strace],[4.7])
AC_INIT([strace],
m4_esyscmd([./git-version-gen .tarball-version]),
[strace-devel@lists.sourceforge.net])
AC_CONFIG_SRCDIR([strace.c])
AC_CONFIG_AUX_DIR([.])
AM_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([foreign check-news dist-xz no-dist-gzip silent-rules])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([foreign dist-xz no-dist-gzip silent-rules parallel-tests])
AM_MAINTAINER_MODE
AC_CANONICAL_HOST
AC_PROG_CC
AX_PROG_CC_FOR_BUILD
AC_USE_SYSTEM_EXTENSIONS
AC_MSG_CHECKING([for supported architecture])
@ -37,6 +40,10 @@ sparc*)
arch=sparc
AC_DEFINE([SPARC], 1, [Define for the SPARC architecture.])
;;
metag*)
arch=metag
AC_DEFINE([METAG], 1, [Define for the Meta architecture.])
;;
mips*)
arch=mips
AC_DEFINE([MIPS], 1, [Define for the MIPS architecture.])
@ -46,9 +53,12 @@ alpha*)
AC_DEFINE([ALPHA], 1, [Define for the Alpha architecture.])
;;
powerpc*)
arch=powerpc
AC_DEFINE([POWERPC], 1, [Define for the PowerPC architecture.])
if test $host_cpu = powerpc64; then
AC_TRY_COMPILE(
[#ifndef __LP64__
# error 32 bit
#endif], [], arch=powerpc64, arch=powerpc)
if test "$arch" = "powerpc64"; then
AC_DEFINE([POWERPC64], 1, [Define for the PowerPC64 architecture.])
fi
;;
@ -56,10 +66,18 @@ arm*)
arch=arm
AC_DEFINE([ARM], 1, [Define for the ARM architecture.])
;;
aarch64*)
arch=aarch64
AC_DEFINE([AARCH64], 1, [Define for the AArch64 architecture.])
;;
avr32*)
arch=avr32
AC_DEFINE([AVR32], 1, [Define for the AVR32 architecture.])
;;
arc*)
arch=arc
AC_DEFINE([ARC], 1, [Define for the ARC architecture.])
;;
s390)
arch=s390
AC_DEFINE([S390], 1, [Define for the S390 architecture.])
@ -107,6 +125,16 @@ microblaze*)
arch=microblaze
AC_DEFINE([MICROBLAZE], 1, [Define for the MicroBlaze architecture.])
;;
or1k*)
arch=or1k
AC_DEFINE([OR1K], 1, [Define for the OpenRISC 1000 architecture.])
;;
xtensa*)
arch=xtensa
AC_DEFINE([XTENSA], 1, [Define for the Xtensa architecture])
;;
*)
AC_MSG_RESULT([NO!])
AC_MSG_ERROR([architecture $host_cpu is not supported by strace])
@ -116,14 +144,52 @@ AC_MSG_RESULT($arch)
AC_SUBST(arch)
AM_CONDITIONAL([I386], [test x$arch = xi386])
AM_CONDITIONAL([X86_64], [test x$arch = xx86_64])
AM_CONDITIONAL([X32], [test x$arch = xx32])
if test "$arch" = mips; then
AC_CACHE_CHECK([for MIPS ABI], [ac_cv_mips_abi],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
[[int i[_MIPS_SIM == _MIPS_SIM_ABI32 ? 1 : - 1];]])],
[ac_cv_mips_abi=o32],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
[[int i[_MIPS_SIM == _MIPS_SIM_NABI32 ? 1 : - 1];]])],
[ac_cv_mips_abi=n32],
[AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[#include <sgidefs.h>]],
[[int i[_MIPS_SIM == _MIPS_SIM_ABI64 ? 1 : - 1];]])],
[ac_cv_mips_abi=n64],
[ac_cv_mips_abi=unknown])])])])
case "$ac_cv_mips_abi" in
o32) AC_DEFINE([LINUX_MIPSO32], [1], [Define for _MIPS_SIM_ABI32.]);;
n32) AC_DEFINE([LINUX_MIPSN32], [1], [Define for _MIPS_SIM_NABI32.]);;
n64) AC_DEFINE([LINUX_MIPSN64], [1], [Define for _MIPS_SIM_ABI64.]);;
*) AC_MSG_ERROR([Unsupported _MIPS_SIM]);;
esac
fi
AC_INCLUDEDIR
AC_ARG_ENABLE([arm-oabi],
[AS_HELP_STRING([--enable-arm-oabi],
[enable OABI support on ARM EABI])],
[], [enable_arm_oabi=no])
case "$enable_arm_oabi" in
yes) enable_arm_oabi=1 ;;
no) enable_arm_oabi=0 ;;
*) AC_MSG_ERROR([bad value $enable_arm_oabi for arm-oabi option]) ;;
esac
AC_DEFINE_UNQUOTED([ENABLE_ARM_OABI], [$enable_arm_oabi],
[Define to 1 if you want OABI support on ARM EABI.])
gl_WARN_ADD([-Wall])
gl_WARN_ADD([-Wwrite-strings])
gl_WARN_ADD([-Wsign-compare])
AC_ARG_ENABLE([gcc-Werror],
[AS_HELP_STRING([--enable-gcc-Werror], [turn on gcc's -Werror option])],
[case $enableval in
yes) gl_WARN_ADD([-Werror]) ;;
no) ;;
*) AC_MSG_ERROR([bad value $enableval for gcc-Werror option]) ;;
esac]
)
AC_SUBST([WARN_CFLAGS])
AC_PROG_CPP
@ -135,130 +201,503 @@ AC_HEADER_STDBOOL
AC_HEADER_DIRENT
AC_HEADER_STAT
AC_CHECK_MEMBERS(m4_normalize([
struct stat.st_aclcnt,
struct stat.st_blksize,
struct stat.st_blocks,
struct stat.st_flags,
struct stat.st_fstype,
struct stat.st_gen,
struct stat.st_level,
struct stat.st_rdev
]))
AC_STAT64
AC_STATFS64
AC_TYPE_SIGNAL
AC_TYPE_UID_T
AC_TYPE_MODE_T
AC_TYPE_GETGROUPS
AC_HEADER_MAJOR
AC_CHECK_TYPES([sig_atomic_t, siginfo_t],,, [#include <signal.h>])
AC_CHECK_TYPES([sig_atomic_t],,, [#include <signal.h>])
AC_CHECK_MEMBERS([struct sockaddr_in6.sin6_scope_id],,,
[#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>])
AC_CHECK_TYPES([long long])
AC_LITTLE_ENDIAN_LONG_LONG
AC_OFF_T_IS_LONG_LONG
AC_CHECK_TYPES([struct opthdr],,, [#include <sys/socket.h>])
AC_CHECK_TYPES([struct t_opthdr],,, [#include <sys/tiuser.h>])
AC_CHECK_FUNCS(m4_normalize([
fanotify_mark
fopen64
fork
fputs_unlocked
if_indextoname
inet_ntop
prctl
preadv
process_vm_readv
pwritev
sendmsg
sendmmsg
sigaction
stpcpy
strerror
strsignal
_sys_siglist
sys_siglist
]))
AC_CHECK_HEADERS(m4_normalize([
asm/cachectl.h
asm/sysmips.h
bluetooth/bluetooth.h
elf.h
inttypes.h
ioctls.h
libaio.h
linux/capability.h
linux/ptrace.h
linux/bsg.h
linux/falloc.h
linux/filter.h
linux/hiddev.h
linux/mmtimer.h
linux/perf_event.h
linux/seccomp.h
linux/securebits.h
linux/utsname.h
mqueue.h
netinet/sctp.h
poll.h
scsi/sg.h
stropts.h
sys/acl.h
sys/asynch.h
sys/conf.h
sys/epoll.h
sys/fanotify.h
sys/filio.h
sys/ioctl.h
sys/poll.h
sys/ptrace.h
sys/reg.h
sys/uio.h
sys/vfs.h
sys/xattr.h
]))
AC_CHECK_HEADERS([linux/icmp.h linux/in6.h linux/netlink.h linux/if_packet.h],
[], [], [#include <stddef.h>
#include <sys/socket.h>
#include <asm/types.h>])
AC_CHECK_HEADERS([asm/sigcontext.h], [], [], [#include <signal.h>])
AC_CHECK_TYPES([struct sigcontext_struct,
struct sigcontext],,, [#include <signal.h>])
AC_CHECK_TYPES([struct sigcontext],,, [#include <signal.h>])
AC_CHECK_HEADERS([netinet/tcp.h netinet/udp.h],,, [#include <netinet/in.h>])
AC_CHECK_TYPES([struct mmsghdr],,, [#include <sys/socket.h>])
AC_CHECK_MEMBERS([struct msghdr.msg_control],,, [#include <sys/socket.h>])
AC_CHECK_MEMBERS([struct T_conn_res.QUEUE_ptr,
struct T_conn_res.ACCEPTOR_id],,,
[#include <sys/stream.h>
#include <sys/tihdr.h>])
AC_CHECK_TYPES([struct stat64],,, [#include <sys/types.h>
#include <asm/stat.h>])
AC_CHECK_TYPES([struct __old_kernel_stat],,, [#include <asm/stat.h>])
AC_CHECK_TYPES([struct statfs64],,, [#include <sys/vfs.h>])
AC_CHECK_TYPES([struct pt_all_user_regs, struct ia64_fpreg],,,
AC_CHECK_TYPES([struct pt_all_user_regs, struct ia64_fpreg, struct ptrace_peeksiginfo_args],,,
[#include <sys/ptrace.h>])
AC_CHECK_TYPES([struct user_desc],,, [#include <asm/ldt.h>])
AC_CHECK_MEMBERS([struct dqblk.dqb_curblocks],,, [#include <sys/quota.h>])
AC_CHECK_MEMBERS([struct sigcontext.sc_hi2],,, [#include <signal.h>
#ifdef HAVE_ASM_SIGCONTEXT_H
# include <asm/sigcontext.h>
#endif])
AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>])
AC_CHECK_MEMBERS([struct sigevent._sigev_un._pad,
struct sigevent.__pad,
siginfo_t.si_syscall,
siginfo_t.si_timerid,
siginfo_t.si_overrun],,, [#include <signal.h>])
AC_CHECK_MEMBERS([struct sysinfo.totalhigh,
struct sysinfo.freehigh,
struct sysinfo.mem_unit],,, [#include <sys/sysinfo.h>])
AC_CHECK_TYPES([struct flock64],,, [#include <fcntl.h>])
AC_CHECK_HEADERS([libaio.h], [
AC_CHECK_MEMBERS([struct iocb.u.c.flags],,, [#include <libaio.h>])
AC_CHECK_DECLS([IO_CMD_PWRITE, IO_CMD_PWRITEV],,, [#include <libaio.h>])
])
AC_CHECK_HEADERS([linux/input.h], [
AC_CHECK_MEMBERS([struct input_absinfo.resolution],,, [#include <linux/input.h>])
])
AC_CHECK_DECLS([sys_errlist])
AC_CHECK_DECLS([sys_siglist, _sys_siglist],,, [#include <signal.h>])
AC_CHECK_DECLS(m4_normalize([
PTRACE_EVENT_CLONE,
PTRACE_EVENT_EXEC,
PTRACE_EVENT_EXIT,
PTRACE_EVENT_FORK,
PTRACE_EVENT_VFORK,
PTRACE_EVENT_VFORK_DONE,
PTRACE_GETEVENTMSG,
PTRACE_GETSIGINFO,
PTRACE_O_TRACECLONE,
PTRACE_O_TRACEEXEC,
PTRACE_O_TRACEEXIT,
PTRACE_O_TRACEFORK,
PTRACE_O_TRACESYSGOOD,
PTRACE_O_TRACEVFORK,
PTRACE_SETOPTIONS
PTRACE_PEEKUSER,
PTRACE_POKEUSER
]),,, [#include <sys/ptrace.h>])
AC_CHECK_DECLS(m4_normalize([
P_PID,
P_PPID,
P_PGID,
P_SID,
P_CID,
P_UID,
P_GID,
P_ALL,
P_LWPID
]),,, [#include <sys/wait.h>])
AC_CHECK_DECLS(m4_normalize([
LO_FLAGS_READ_ONLY,
LO_FLAGS_AUTOCLEAR,
LO_FLAGS_PARTSCAN
]),,, [#include <linux/loop.h>])
AC_CHECK_DECLS(m4_normalize([
CTL_KERN,
CTL_VM,
CTL_NET,
CTL_PROC,
CTL_FS,
CTL_DEBUG,
CTL_DEV,
CTL_BUS,
CTL_ABI,
CTL_CPU,
CTL_ARLAN,
CTL_S390DBF,
CTL_SUNRPC,
CTL_PM,
CTL_FRV,
KERN_OSTYPE,
KERN_OSRELEASE,
KERN_OSREV,
KERN_VERSION,
KERN_SECUREMASK,
KERN_PROF,
KERN_NODENAME,
KERN_DOMAINNAME,
KERN_PANIC,
KERN_REALROOTDEV,
KERN_SPARC_REBOOT,
KERN_CTLALTDEL,
KERN_PRINTK,
KERN_NAMETRANS,
KERN_PPC_HTABRECLAIM,
KERN_PPC_ZEROPAGED,
KERN_PPC_POWERSAVE_NAP,
KERN_MODPROBE,
KERN_SG_BIG_BUFF,
KERN_ACCT,
KERN_PPC_L2CR,
KERN_RTSIGNR,
KERN_RTSIGMAX,
KERN_SHMMAX,
KERN_MSGMAX,
KERN_MSGMNB,
KERN_MSGPOOL,
KERN_SYSRQ,
KERN_MAX_THREADS,
KERN_RANDOM,
KERN_SHMALL,
KERN_MSGMNI,
KERN_SEM,
KERN_SPARC_STOP_A,
KERN_SHMMNI,
KERN_OVERFLOWUID,
KERN_OVERFLOWGID,
KERN_SHMPATH,
KERN_HOTPLUG,
KERN_IEEE_EMULATION_WARNINGS,
KERN_S390_USER_DEBUG_LOGGING,
KERN_CORE_USES_PID,
KERN_TAINTED,
KERN_CADPID,
KERN_PIDMAX,
KERN_CORE_PATTERN,
KERN_PANIC_ON_OOPS,
KERN_HPPA_PWRSW,
KERN_HPPA_UNALIGNED,
KERN_PRINTK_RATELIMIT,
KERN_PRINTK_RATELIMIT_BURST,
KERN_PTY,
KERN_NGROUPS_MAX,
KERN_SPARC_SCONS_PWROFF,
KERN_HZ_TIMER,
KERN_UNKNOWN_NMI_PANIC,
KERN_BOOTLOADER_TYPE,
KERN_RANDOMIZE,
KERN_SETUID_DUMPABLE,
KERN_SPIN_RETRY,
KERN_ACPI_VIDEO_FLAGS,
KERN_IA64_UNALIGNED,
KERN_COMPAT_LOG,
KERN_MAX_LOCK_DEPTH,
KERN_NMI_WATCHDOG,
KERN_PANIC_ON_NMI,
NET_CORE,
NET_ETHER,
NET_802,
NET_UNIX,
NET_IPV4,
NET_IPX,
NET_ATALK,
NET_NETROM,
NET_AX25,
NET_BRIDGE,
NET_ROSE,
NET_IPV6,
NET_X25,
NET_TR,
NET_DECNET,
NET_ECONET,
NET_SCTP,
NET_LLC,
NET_NETFILTER,
NET_DCCP,
NET_IRDA,
NET_CORE_WMEM_MAX,
NET_CORE_RMEM_MAX,
NET_CORE_WMEM_DEFAULT,
NET_CORE_RMEM_DEFAULT,
NET_CORE_DESTROY_DELAY,
NET_CORE_MAX_BACKLOG,
NET_CORE_FASTROUTE,
NET_CORE_MSG_COST,
NET_CORE_MSG_BURST,
NET_CORE_OPTMEM_MAX,
NET_CORE_HOT_LIST_LENGTH,
NET_CORE_DIVERT_VERSION,
NET_CORE_NO_CONG_THRESH,
NET_CORE_NO_CONG,
NET_CORE_LO_CONG,
NET_CORE_MOD_CONG,
NET_CORE_DEV_WEIGHT,
NET_CORE_SOMAXCONN,
NET_CORE_BUDGET,
NET_CORE_AEVENT_ETIME,
NET_CORE_AEVENT_RSEQTH,
NET_CORE_WARNINGS,
NET_IPV4_FORWARD,
NET_IPV4_DYNADDR,
NET_IPV4_CONF,
NET_IPV4_NEIGH,
NET_IPV4_ROUTE,
NET_IPV4_FIB_HASH,
NET_IPV4_NETFILTER,
NET_IPV4_TCP_TIMESTAMPS,
NET_IPV4_TCP_WINDOW_SCALING,
NET_IPV4_TCP_SACK,
NET_IPV4_TCP_RETRANS_COLLAPSE,
NET_IPV4_DEFAULT_TTL,
NET_IPV4_AUTOCONFIG,
NET_IPV4_NO_PMTU_DISC,
NET_IPV4_TCP_SYN_RETRIES,
NET_IPV4_IPFRAG_HIGH_THRESH,
NET_IPV4_IPFRAG_LOW_THRESH,
NET_IPV4_IPFRAG_TIME,
NET_IPV4_TCP_MAX_KA_PROBES,
NET_IPV4_TCP_KEEPALIVE_TIME,
NET_IPV4_TCP_KEEPALIVE_PROBES,
NET_IPV4_TCP_RETRIES1,
NET_IPV4_TCP_RETRIES2,
NET_IPV4_TCP_FIN_TIMEOUT,
NET_IPV4_IP_MASQ_DEBUG,
NET_TCP_SYNCOOKIES,
NET_TCP_STDURG,
NET_TCP_RFC1337,
NET_TCP_SYN_TAILDROP,
NET_TCP_MAX_SYN_BACKLOG,
NET_IPV4_LOCAL_PORT_RANGE,
NET_IPV4_ICMP_ECHO_IGNORE_ALL,
NET_IPV4_ICMP_ECHO_IGNORE_BROADCASTS,
NET_IPV4_ICMP_SOURCEQUENCH_RATE,
NET_IPV4_ICMP_DESTUNREACH_RATE,
NET_IPV4_ICMP_TIMEEXCEED_RATE,
NET_IPV4_ICMP_PARAMPROB_RATE,
NET_IPV4_ICMP_ECHOREPLY_RATE,
NET_IPV4_ICMP_IGNORE_BOGUS_ERROR_RESPONSES,
NET_IPV4_IGMP_MAX_MEMBERSHIPS,
NET_TCP_TW_RECYCLE,
NET_IPV4_ALWAYS_DEFRAG,
NET_IPV4_TCP_KEEPALIVE_INTVL,
NET_IPV4_INET_PEER_THRESHOLD,
NET_IPV4_INET_PEER_MINTTL,
NET_IPV4_INET_PEER_MAXTTL,
NET_IPV4_INET_PEER_GC_MINTIME,
NET_IPV4_INET_PEER_GC_MAXTIME,
NET_TCP_ORPHAN_RETRIES,
NET_TCP_ABORT_ON_OVERFLOW,
NET_TCP_SYNACK_RETRIES,
NET_TCP_MAX_ORPHANS,
NET_TCP_MAX_TW_BUCKETS,
NET_TCP_FACK,
NET_TCP_REORDERING,
NET_TCP_ECN,
NET_TCP_DSACK,
NET_TCP_MEM,
NET_TCP_WMEM,
NET_TCP_RMEM,
NET_TCP_APP_WIN,
NET_TCP_ADV_WIN_SCALE,
NET_IPV4_NONLOCAL_BIND,
NET_IPV4_ICMP_RATELIMIT,
NET_IPV4_ICMP_RATEMASK,
NET_TCP_TW_REUSE,
NET_TCP_FRTO,
NET_TCP_LOW_LATENCY,
NET_IPV4_IPFRAG_SECRET_INTERVAL,
NET_IPV4_IGMP_MAX_MSF,
NET_TCP_NO_METRICS_SAVE,
NET_TCP_DEFAULT_WIN_SCALE,
NET_TCP_MODERATE_RCVBUF,
NET_TCP_TSO_WIN_DIVISOR,
NET_TCP_BIC_BETA,
NET_IPV4_ICMP_ERRORS_USE_INBOUND_IFADDR,
NET_TCP_CONG_CONTROL,
NET_TCP_ABC,
NET_IPV4_IPFRAG_MAX_DIST,
NET_TCP_MTU_PROBING,
NET_TCP_BASE_MSS,
NET_IPV4_TCP_WORKAROUND_SIGNED_WINDOWS,
NET_TCP_DMA_COPYBREAK,
NET_TCP_SLOW_START_AFTER_IDLE,
NET_CIPSOV4_CACHE_ENABLE,
NET_CIPSOV4_CACHE_BUCKET_SIZE,
NET_CIPSOV4_RBM_OPTFMT,
NET_CIPSOV4_RBM_STRICTVALID,
NET_TCP_AVAIL_CONG_CONTROL,
NET_TCP_ALLOWED_CONG_CONTROL,
NET_TCP_MAX_SSTHRESH,
NET_TCP_FRTO_RESPONSE,
NET_IPV4_ROUTE_FLUSH,
NET_IPV4_ROUTE_MIN_DELAY,
NET_IPV4_ROUTE_MAX_DELAY,
NET_IPV4_ROUTE_GC_THRESH,
NET_IPV4_ROUTE_MAX_SIZE,
NET_IPV4_ROUTE_GC_MIN_INTERVAL,
NET_IPV4_ROUTE_GC_TIMEOUT,
NET_IPV4_ROUTE_GC_INTERVAL,
NET_IPV4_ROUTE_REDIRECT_LOAD,
NET_IPV4_ROUTE_REDIRECT_NUMBER,
NET_IPV4_ROUTE_REDIRECT_SILENCE,
NET_IPV4_ROUTE_ERROR_COST,
NET_IPV4_ROUTE_ERROR_BURST,
NET_IPV4_ROUTE_GC_ELASTICITY,
NET_IPV4_ROUTE_MTU_EXPIRES,
NET_IPV4_ROUTE_MIN_PMTU,
NET_IPV4_ROUTE_MIN_ADVMSS,
NET_IPV4_ROUTE_SECRET_INTERVAL,
NET_IPV4_ROUTE_GC_MIN_INTERVAL_MS,
NET_IPV4_CONF_FORWARDING,
NET_IPV4_CONF_MC_FORWARDING,
NET_IPV4_CONF_PROXY_ARP,
NET_IPV4_CONF_ACCEPT_REDIRECTS,
NET_IPV4_CONF_SECURE_REDIRECTS,
NET_IPV4_CONF_SEND_REDIRECTS,
NET_IPV4_CONF_SHARED_MEDIA,
NET_IPV4_CONF_RP_FILTER,
NET_IPV4_CONF_ACCEPT_SOURCE_ROUTE,
NET_IPV4_CONF_BOOTP_RELAY,
NET_IPV4_CONF_LOG_MARTIANS,
NET_IPV4_CONF_TAG,
NET_IPV4_CONF_ARPFILTER,
NET_IPV4_CONF_MEDIUM_ID,
NET_IPV4_CONF_NOXFRM,
NET_IPV4_CONF_NOPOLICY,
NET_IPV4_CONF_FORCE_IGMP_VERSION,
NET_IPV4_CONF_ARP_ANNOUNCE,
NET_IPV4_CONF_ARP_IGNORE,
NET_IPV4_CONF_PROMOTE_SECONDARIES,
NET_IPV4_CONF_ARP_ACCEPT,
NET_IPV4_CONF_ARP_NOTIFY,
NET_IPV6_CONF,
NET_IPV6_NEIGH,
NET_IPV6_ROUTE,
NET_IPV6_ICMP,
NET_IPV6_BINDV6ONLY,
NET_IPV6_IP6FRAG_HIGH_THRESH,
NET_IPV6_IP6FRAG_LOW_THRESH,
NET_IPV6_IP6FRAG_TIME,
NET_IPV6_IP6FRAG_SECRET_INTERVAL,
NET_IPV6_MLD_MAX_MSF,
NET_IPV6_ROUTE_FLUSH,
NET_IPV6_ROUTE_GC_THRESH,
NET_IPV6_ROUTE_MAX_SIZE,
NET_IPV6_ROUTE_GC_MIN_INTERVAL,
NET_IPV6_ROUTE_GC_TIMEOUT,
NET_IPV6_ROUTE_GC_INTERVAL,
NET_IPV6_ROUTE_GC_ELASTICITY,
NET_IPV6_ROUTE_MTU_EXPIRES,
NET_IPV6_ROUTE_MIN_ADVMSS,
NET_IPV6_ROUTE_GC_MIN_INTERVAL_MS,
NET_UNIX_DESTROY_DELAY,
NET_UNIX_DELETE_DELAY,
NET_UNIX_MAX_DGRAM_QLEN,
VM_OVERCOMMIT_MEMORY,
VM_PAGE_CLUSTER,
VM_DIRTY_BACKGROUND,
VM_DIRTY_RATIO,
VM_DIRTY_WB_CS,
VM_DIRTY_EXPIRE_CS,
VM_NR_PDFLUSH_THREADS,
VM_OVERCOMMIT_RATIO,
VM_PAGEBUF,
VM_HUGETLB_PAGES,
VM_SWAPPINESS,
VM_LOWMEM_RESERVE_RATIO,
VM_MIN_FREE_KBYTES,
VM_MAX_MAP_COUNT,
VM_LAPTOP_MODE,
VM_BLOCK_DUMP,
VM_HUGETLB_GROUP,
VM_VFS_CACHE_PRESSURE,
VM_LEGACY_VA_LAYOUT,
VM_SWAP_TOKEN_TIMEOUT
]),,,
[#include <sys/types.h>
#include <linux/sysctl.h>])
AC_CHECK_DECLS(m4_normalize([
V4L2_FIELD_ANY,
V4L2_FIELD_NONE,
V4L2_FIELD_TOP,
V4L2_FIELD_BOTTOM,
V4L2_FIELD_INTERLACED,
V4L2_FIELD_SEQ_TB,
V4L2_FIELD_SEQ_BT,
V4L2_FIELD_ALTERNATE,
V4L2_FIELD_INTERLACED_TB,
V4L2_FIELD_INTERLACED_BT,
V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
V4L2_BUF_TYPE_VIDEO_OUTPUT,
V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
V4L2_BUF_TYPE_VIDEO_OVERLAY,
V4L2_BUF_TYPE_VBI_CAPTURE,
V4L2_BUF_TYPE_VBI_OUTPUT,
V4L2_BUF_TYPE_SLICED_VBI_CAPTURE,
V4L2_BUF_TYPE_SLICED_VBI_OUTPUT,
V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY,
V4L2_TUNER_RADIO,
V4L2_TUNER_ANALOG_TV,
V4L2_TUNER_DIGITAL_TV,
V4L2_MEMORY_MMAP,
V4L2_MEMORY_USERPTR,
V4L2_MEMORY_OVERLAY,
V4L2_MEMORY_DMABUF,
V4L2_COLORSPACE_SMPTE170M,
V4L2_COLORSPACE_SMPTE240M,
V4L2_COLORSPACE_REC709,
V4L2_COLORSPACE_BT878,
V4L2_COLORSPACE_470_SYSTEM_M,
V4L2_COLORSPACE_470_SYSTEM_BG,
V4L2_COLORSPACE_JPEG,
V4L2_COLORSPACE_SRGB,
V4L2_PRIORITY_UNSET,
V4L2_PRIORITY_BACKGROUND,
V4L2_PRIORITY_INTERACTIVE,
V4L2_PRIORITY_RECORD,
V4L2_FRMSIZE_TYPE_DISCRETE,
V4L2_FRMSIZE_TYPE_CONTINUOUS,
V4L2_FRMSIZE_TYPE_STEPWISE,
V4L2_FRMIVAL_TYPE_DISCRETE,
V4L2_FRMIVAL_TYPE_CONTINUOUS,
V4L2_FRMIVAL_TYPE_STEPWISE,
V4L2_CTRL_TYPE_INTEGER,
V4L2_CTRL_TYPE_BOOLEAN,
V4L2_CTRL_TYPE_MENU,
V4L2_CTRL_TYPE_BUTTON,
V4L2_CTRL_TYPE_INTEGER64,
V4L2_CTRL_TYPE_CTRL_CLASS,
V4L2_CTRL_TYPE_STRING,
V4L2_CTRL_TYPE_BITMASK,
V4L2_CTRL_TYPE_INTEGER_MENU
]),,, [#include <linux/videodev2.h>])
AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <stdlib.h>
@ -269,9 +708,170 @@ AC_CACHE_CHECK([for BLKGETSIZE64], [ac_cv_have_blkgetsize64],
fi)
AC_CHECK_SIZEOF([long])
AC_CHECK_SIZEOF([rlim_t],,[#include <sys/resource.h>])
AC_CHECK_SIZEOF([long long])
AC_CHECK_SIZEOF([off_t],,[#include <sys/types.h>])
AC_CACHE_CHECK([for SIGRTMIN], [st_cv_SIGRTMIN],
[[st_cv_SIGRTMIN="$(echo SIGRTMIN |
$CPP $CPPFLAGS -P -imacros asm/signal.h - |
grep '^[0-9]')"
test -n "$st_cv_SIGRTMIN" || st_cv_SIGRTMIN=no]])
if test "x$st_cv_SIGRTMIN" != xno; then
AC_DEFINE_UNQUOTED([ASM_SIGRTMIN], [$st_cv_SIGRTMIN],
[SIGRTMIN defined in <asm/signal.h>])
fi
AC_CACHE_CHECK([for SA_RESTORER], [st_cv_SA_RESTORER],
[st_cv_SA_RESTORER="$(echo SA_RESTORER |
$CPP $CPPFLAGS -P -imacros asm/signal.h - |
grep ^0x)"
test -n "$st_cv_SA_RESTORER" || st_cv_SA_RESTORER=no])
if test "x$st_cv_SA_RESTORER" != xno; then
AC_DEFINE_UNQUOTED([ASM_SA_RESTORER], [$st_cv_SA_RESTORER],
[SA_RESTORER defined in <asm/signal.h>])
fi
AC_CACHE_CHECK([for __builtin_popcount], [st_cv_have___builtin_popcount],
[AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_popcount(0)])],
[st_cv_have___builtin_popcount=yes],
[st_cv_have___builtin_popcount=no])])
if test "x$st_cv_have___builtin_popcount" = xyes; then
AC_DEFINE([HAVE___BUILTIN_POPCOUNT], [1],
[Define to 1 if the system provides __builtin_popcount function])
fi
AC_CHECK_LIB([dl], [dladdr], [dl_LIBS='-ldl'], [dl_LIBS=])
if test "x$ac_cv_lib_dl_dladdr" = xyes; then
AC_DEFINE([HAVE_DLADDR], [1], [Define to 1 if the system provides dladdr])
fi
AC_SUBST(dl_LIBS)
AC_PATH_PROG([PERL], [perl])
AC_CONFIG_FILES([Makefile tests/Makefile])
dnl stack trace with libunwind
libunwind_CPPFLAGS=
libunwind_LDFLAGS=
libunwind_LIBS=
AC_ARG_WITH([libunwind],
[AS_HELP_STRING([--with-libunwind],
[use libunwind to implement stack tracing support])],
[case "${withval}" in
yes|no|check) ;;
*) with_libunwind=yes
libunwind_CPPFLAGS="-I${withval}/include"
libunwind_LDFLAGS="-L${withval}/lib" ;;
esac],
[with_libunwind=check]
)
use_libunwind=no
AS_IF([test "x$with_libunwind" != xno],
[saved_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $libunwind_CPPFLAGS"
AC_CHECK_HEADERS([libunwind-ptrace.h],
[saved_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $libunwind_LDFLAGS"
AC_CHECK_LIB([unwind], [backtrace],
[libunwind_LIBS="-lunwind $libunwind_LIBS"
AC_MSG_CHECKING([for unw_create_addr_space in libunwind-generic])
saved_LIBS="$LIBS"
LIBS="-lunwind-generic $libunwind_LIBS $LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <libunwind-ptrace.h>]],
[[return !unw_create_addr_space(0, 0)]])
],
[AC_MSG_RESULT([yes])
libunwind_LIBS="-lunwind-generic $libunwind_LIBS"
AC_CHECK_LIB([unwind-ptrace], [_UPT_create],
[libunwind_LIBS="-lunwind-ptrace $libunwind_LIBS"
use_libunwind=yes
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find _UPT_create in libunwind-ptrace])
fi
],
[$libunwind_LIBS]
)
],
[AC_MSG_RESULT([no])
if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find unw_create_addr_space in libunwind-generic])
fi
]
)
LIBS="$saved_LIBS"
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find libunwind])
fi
],
[$libunwind_LIBS]
)
LDFLAGS="$saved_LDFLAGS"
],
[if test "x$with_libunwind" != xcheck; then
AC_MSG_FAILURE([failed to find libunwind-ptrace.h])
fi
]
)
CPPFLAGS="$saved_CPPFLAGS"
]
)
dnl enable libunwind
AC_MSG_CHECKING([whether to enable stack tracing support using libunwind])
if test "x$use_libunwind" = xyes; then
AC_DEFINE([USE_LIBUNWIND], 1, [Compile stack tracing functionality])
AC_SUBST(libunwind_LIBS)
AC_SUBST(libunwind_LDFLAGS)
AC_SUBST(libunwind_CPPFLAGS)
fi
AM_CONDITIONAL([USE_LIBUNWIND], [test "x$use_libunwind" = xyes])
AC_MSG_RESULT([$use_libunwind])
if test "$arch" = mips && test "$no_create" != yes; then
mkdir -p linux/mips
if $srcdir/linux/mips/genstub.sh linux/mips; then
AC_MSG_RESULT([Generated MIPS syscallent stubs])
else
AC_MSG_FAILURE([Failed to generate syscallent stubs])
fi
fi
have_m32=no
case "$arch" in
aarch64|powerpc64|sparc64|tile|x32|x86_64)
AC_MSG_CHECKING([for -m32 runtime support])
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -m32"
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(){return 0;}]])],
[have_m32=yes],[have_m32=no],[have_m32=no])
CFLAGS="$saved_CFLAGS"
AC_MSG_RESULT($have_m32)
;;
esac
AM_CONDITIONAL([HAVE_M32_RUNTIME], [test "$have_m32" = yes])
have_mx32=no
case "$arch" in
x86_64)
AC_MSG_CHECKING([for -mx32 runtime support])
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -mx32"
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main(){return 0;}]])],
[have_mx32=yes],[have_mx32=no],[have_mx32=no])
CFLAGS="$saved_CFLAGS"
AC_MSG_RESULT($have_mx32)
;;
esac
AM_CONDITIONAL([HAVE_MX32_RUNTIME], [test "$have_mx32" = yes])
AC_CONFIG_FILES([Makefile tests/Makefile tests-m32/Makefile tests-mx32/Makefile])
AC_OUTPUT

109
count.c
View File

@ -35,7 +35,9 @@
#include "defs.h"
/* Per-syscall stats structure */
struct call_counts {
/* time may be total latency or system time */
struct timeval time;
int calls, errors;
};
@ -46,9 +48,14 @@ static struct call_counts *countv[SUPPORTED_PERSONALITIES];
static struct timeval shortest = { 1000000, 0 };
void
count_syscall(struct tcb *tcp, struct timeval *tv)
count_syscall(struct tcb *tcp, const struct timeval *syscall_exiting_tv)
{
if (!SCNO_IN_RANGE(tcp->scno))
struct timeval wtv;
struct timeval *tv = &wtv;
struct call_counts *cc;
unsigned long scno = tcp->scno;
if (!SCNO_IN_RANGE(scno))
return;
if (!counts) {
@ -56,16 +63,20 @@ count_syscall(struct tcb *tcp, struct timeval *tv)
if (!counts)
die_out_of_memory();
}
cc = &counts[scno];
counts[tcp->scno].calls++;
cc->calls++;
if (tcp->u_error)
counts[tcp->scno].errors++;
cc->errors++;
tv_sub(tv, tv, &tcp->etime);
/* tv = wall clock time spent while in syscall */
tv_sub(tv, syscall_exiting_tv, &tcp->etime);
/* Spent more wall clock time than spent system time? (usually yes) */
if (tv_cmp(tv, &tcp->dtime) > 0) {
static struct timeval one_tick;
static struct timeval one_tick = { -1, 0 };
if (one_tick.tv_usec == 0) {
if (one_tick.tv_sec == -1) {
/* Initialize it. */
struct itimerval it;
@ -74,20 +85,24 @@ count_syscall(struct tcb *tcp, struct timeval *tv)
setitimer(ITIMER_REAL, &it, NULL);
getitimer(ITIMER_REAL, &it);
one_tick = it.it_interval;
//FIXME: this hack doesn't work (tested on linux-3.6.11): one_tick = 0.000000
//tprintf(" one_tick.tv_usec:%u\n", (unsigned)one_tick.tv_usec);
}
if (tv_nz(&tcp->dtime))
*tv = tcp->dtime;
/* tv = system time spent, if it isn't 0 */
tv = &tcp->dtime;
else if (tv_cmp(tv, &one_tick) > 0) {
/* tv = smallest "sane" time interval */
if (tv_cmp(&shortest, &one_tick) < 0)
*tv = shortest;
tv = &shortest;
else
*tv = one_tick;
tv = &one_tick;
}
}
if (tv_cmp(tv, &shortest) < 0)
shortest = *tv;
tv_add(&counts[tcp->scno].time, &counts[tcp->scno].time, tv);
tv_add(&cc->time, &cc->time, count_wallclock ? &wtv : tv);
}
static int
@ -141,17 +156,24 @@ void set_overhead(int n)
static void
call_summary_pers(FILE *outf)
{
int i, j;
unsigned int i;
int call_cum, error_cum;
struct timeval tv_cum, dtv;
double float_tv_cum;
double percent;
const char *dashes = "-------------------------";
char error_str[16];
int *sorted_count = calloc(sizeof(int), nsyscalls);
const char *dashes = "----------------";
char error_str[sizeof(int)*3];
int *sorted_count;
fprintf(outf, "%6.6s %11.11s %11.11s %9.9s %9.9s %s\n",
"% time", "seconds", "usecs/call",
"calls", "errors", "syscall");
fprintf(outf, "%6.6s %11.11s %11.11s %9.9s %9.9s %s\n",
dashes, dashes, dashes, dashes, dashes, dashes);
sorted_count = calloc(sizeof(int), nsyscalls);
if (!sorted_count)
die_out_of_memory();
call_cum = error_cum = tv_cum.tv_sec = tv_cum.tv_usec = 0;
if (overhead.tv_sec == -1) {
tv_mul(&overhead, &shortest, 8);
@ -167,49 +189,48 @@ call_summary_pers(FILE *outf)
error_cum += counts[i].errors;
tv_add(&tv_cum, &tv_cum, &counts[i].time);
}
if (counts && sortfun)
qsort((void *) sorted_count, nsyscalls, sizeof(int), sortfun);
fprintf(outf, "%6.6s %11.11s %11.11s %9.9s %9.9s %s\n",
"% time", "seconds", "usecs/call",
"calls", "errors", "syscall");
fprintf(outf, "%6.6s %11.11s %11.11s %9.9s %9.9s %-16.16s\n",
dashes, dashes, dashes, dashes, dashes, dashes);
float_tv_cum = tv_float(&tv_cum);
if (counts) {
if (sortfun)
qsort((void *) sorted_count, nsyscalls, sizeof(int), sortfun);
for (i = 0; i < nsyscalls; i++) {
j = sorted_count[i];
if (counts[j].calls == 0)
double float_syscall_time;
int idx = sorted_count[i];
struct call_counts *cc = &counts[idx];
if (cc->calls == 0)
continue;
tv_div(&dtv, &counts[j].time, counts[j].calls);
if (counts[j].errors)
sprintf(error_str, "%d", counts[j].errors);
else
error_str[0] = '\0';
percent = (100.0 * tv_float(&counts[j].time)
/ tv_float(&tv_cum));
fprintf(outf, "%6.2f %11.6f %11ld %9d %9.9s %s\n",
percent, tv_float(&counts[j].time),
tv_div(&dtv, &cc->time, cc->calls);
error_str[0] = '\0';
if (cc->errors)
sprintf(error_str, "%u", cc->errors);
float_syscall_time = tv_float(&cc->time);
percent = (100.0 * float_syscall_time);
if (percent != 0.0)
percent /= float_tv_cum;
/* else: float_tv_cum can be 0.0 too and we get 0/0 = NAN */
fprintf(outf, "%6.2f %11.6f %11lu %9u %9.9s %s\n",
percent, float_syscall_time,
(long) (1000000 * dtv.tv_sec + dtv.tv_usec),
counts[j].calls,
error_str, sysent[j].sys_name);
cc->calls,
error_str, sysent[idx].sys_name);
}
}
free(sorted_count);
fprintf(outf, "%6.6s %11.11s %11.11s %9.9s %9.9s %-16.16s\n",
fprintf(outf, "%6.6s %11.11s %11.11s %9.9s %9.9s %s\n",
dashes, dashes, dashes, dashes, dashes, dashes);
error_str[0] = '\0';
if (error_cum)
sprintf(error_str, "%d", error_cum);
else
error_str[0] = '\0';
fprintf(outf, "%6.6s %11.6f %11.11s %9d %9.9s %s\n",
"100.00", tv_float(&tv_cum), "",
sprintf(error_str, "%u", error_cum);
fprintf(outf, "%6.6s %11.6f %11.11s %9u %9.9s %s\n",
"100.00", float_tv_cum, "",
call_cum, error_str, "total");
}
void
call_summary(FILE *outf)
{
int i, old_pers = current_personality;
unsigned int i, old_pers = current_personality;
for (i = 0; i < SUPPORTED_PERSONALITIES; ++i) {
if (!countv[i])
@ -220,7 +241,7 @@ call_summary(FILE *outf)
if (i)
fprintf(outf,
"System call usage summary for %d bit mode:\n",
(int) (current_wordsize * 8));
current_wordsize * 8);
call_summary_pers(outf);
}

89
debian/changelog vendored
View File

@ -1,11 +1,69 @@
strace (4.7-1) unstable; urgency=low
strace (4.10-1) experimental; urgency=low
* New upstream version.
+ enhanced ioctl decoding, closes: #692913
+ enabled mips64el build, closes: #773375
+ updated signal and errno numbers, closes: #768642
+ updated generic and added arch-specific PTRACE_* constants,
closes: #734554
-- Dmitry V. Levin <ldv@altlinux.org> Fri, 06 Mar 2015 13:14:15 +0000
strace (4.9-2) unstable; urgency=medium
* Turn on support for ppc64el, code is already in upstream.
Closes: #744121.
-- Steve McIntyre <93sam@debian.org> Wed, 20 Aug 2014 18:00:20 +0100
strace (4.9-1) unstable; urgency=medium
[ Dmitry V. Levin ]
* New upstream version.
+ added -w option to produce stats on syscall latency, closes: #457497
+ applied miscellaneous corrections to the manpage, closes: #725987
+ fixed a typo in package description, closes: #697625
+ enabled or1k build, closes: #742235
+ enabled maximum security hardening, thanks to Markus <waldeck@gmx.de>
[ Steve McIntyre ]
* New maintainer. Thanks to Frederik for all his prior work!
-- Steve McIntyre <93sam@debian.org> Wed, 20 Aug 2014 15:11:36 +0100
strace (4.8-1.1) unstable; urgency=low
* NMU
* Uploading 4.8 to unstable to fix long-standing bugs that have been
fixed for ages in experimental only.
* enable arm64 build, Closes: #749956
* enable x32 build, Closes: #727018
* lintian-inspired fixes:
+ add build-arch and build-indep targets in debian/rules
+ update standards-version to 3.9.5
+ remove ancient changelog entries causing syntax checker errors
+ add hardening using buildflags.mk
+ trivial changes to Description: fields
-- Steve McIntyre <93sam@debian.org> Thu, 10 Jul 2014 14:22:18 +0000
strace (4.8-1) experimental; urgency=low
* New upstream version.
+ Added aarch64 support, closes: #693074
+ Fixed kernel release string parsing, closes: #702309
-- Dmitry V. Levin <ldv@altlinux.org> Mon, 03 Jun 2013 15:16:17 +0000
strace (4.7-1) experimental; urgency=low
[ Dmitry V. Levin ]
* New upstream version.
+ Fixed sockaddr_un.sun_path name in decoded output, closes: #554946
+ Avoid potential core file clobbering on exit, closes: #656398
+ Fixed a typo in documentation, closes: #653309
-- Dmitry V. Levin <ldv@altlinux.org> Wed, 02 May 2012 12:34:56 +0000
-- Frederik Schüler <fs@debian.org> Tue, 12 Feb 2013 10:35:22 +0100
strace (4.6-1) unstable; urgency=low
@ -519,7 +577,7 @@ strace (4.2-2) frozen unstable; urgency=low
-- Wichert Akkerman <wakkerma@debian.org> Thu, 27 Jan 2000 03:22:55 +0100
strace (4.2-1) frozen unstable; urgency=low
strace (4.2-1) frozen unstable; urgency=low
* New upstream version:
+ Builds correctly on glibc2.0 again, Closes: Bug# 51648
@ -704,14 +762,14 @@ strace (3.1-12) unstable; urgency=low
-- Wichert Akkerman <wakkerma@debian.org> Mon, 6 Oct 1997 15:42:25 +0200
strace (3.1-11) unstable; urgency=LOW
strace (3.1-11) unstable; urgency=low
* Ported to libc6 / glibc2 (Bug# 11729)
* Compress manpage
-- Wichert Akkerman <wakkerma@wi.leidenuniv.nl> Fri, 1 Aug 1997 00:13:38 +02
strace (3.1-10) unstable; urgency=LOW
strace (3.1-10) unstable; urgency=low
* Install upstream changelog
* Added dependencies to control file for libc
@ -719,7 +777,7 @@ strace (3.1-10) unstable; urgency=LOW
-- Wichert Akkerman <wakkerma@debian.org> Fri, 11 Jul 1997 12:26:12 +0200
strace (3.1-9) stable; urgency=LOW
strace (3.1-9) stable; urgency=low
* Fixed bug with hanging children. Patch by Matthias Urlichs
* Added some more constants to net.c.
@ -727,25 +785,26 @@ strace (3.1-9) stable; urgency=LOW
-- Wichert Akkerman <wakkerma@debian.org> Mon, 21 Apr 1997 11:59:45 +0200
strace (3.1-8) frozen unstable; urgency=LOW
strace (3.1-8) frozen unstable; urgency=low
* Added detection of ROSE networking
-- Wichert Akkerman <wakkerma@wi.leidenuniv.nl> Tue, 12 Nov 1996 22:21:22 +0100
strace (3.1-7) stable; urgency=LOW
strace (3.1-7) stable; urgency=low
* Install manpage with correct mode (0644) (Bug#4813)
* Renamed debian changelog to changelog.Debian
-- Wichert Akkerman <wakkerma@wi.leidenuniv.nl> Sat, 26 Oct 1996 18:15:41 +0200
strace (3.1-6) stable; urgency=LOW
strace (3.1-6) stable; urgency=low
* Small patch for compilation on kernels 2.1.0 and later (see signal.c)
-- Wichert Akkerman <wakkerma@wi.leidenuniv.nl> Fri, 18 Oct 1996 00:28:47 +0200
strace (3.1-5) stable unstable; urgency=LOW
strace (3.1-5) stable unstable; urgency=low
* Moved to new packagingformat
* Fixed umoven bug (Bug# 4523)
@ -753,21 +812,20 @@ strace (3.1-5) stable unstable; urgency=LOW
-- Wichert Akkerman <wakkerma@wi.leidenuniv.nl> Sat, 23 Sep 1996 23:33:58 +0200
strace (3.1-4) unstable; urgency=LOW
strace (3.1-4) unstable; urgency=low
* Fixed changestemplate
-- Wichert Akkerman <wakkerma@wi.leidenuniv.nl>, Thu Sep 12 14:59:44 MET DST 1996
strace (3.1-3) unstable; priority=LOW
strace (3.1-3) unstable; urgency=low
* Revamped debian files
-- Wichert Akkerman <wakkerma@wi.leidenuniv.nl>, Thu Jul 11 20:19:11 MET DST 1996
strace (3.1-2) unstable; priority=LOW
strace (3.1-2) unstable; urgency=low
* Added some #ifdef's around IPX stuff to make it compilable on non-Linux
systems.
* changed debian.control and debian.rules to conform to new debian naming
@ -776,8 +834,7 @@ strace (3.1-2) unstable; priority=LOW
-- Wichert Akkerman <wakkerma@wi.leidenuniv.nl>
strace (3.1-1) unstable; priority=LOW
strace (3.1-1) unstable; urgency=low
* Moved to new upstream version
* added more protocol families to domains

16
debian/control vendored
View File

@ -1,15 +1,15 @@
Source: strace
Maintainer: Frederik Schüler <fs@debian.org>
Maintainer: Steve McIntyre <93sam@debian.org>
Section: utils
Priority: optional
Build-Depends: libc6-dev (>= 2.2.2) [!alpha !ia64], libc6.1-dev (>= 2.2.2) [alpha ia64], gcc-multilib [i386 powerpc s390 sparc], debhelper (>= 7.0.0)
Standards-Version: 3.8.4
Standards-Version: 3.9.5
Homepage: http://sourceforge.net/projects/strace/
Package: strace
Architecture: alpha amd64 arm armeb armel armhf hppa i386 ia64 m68k mips mipsel powerpc powerpcspe ppc64 s390 s390x sh4 sparc sparc64
Architecture: alpha amd64 arm64 armeb armel armhf hppa i386 ia64 m68k mips mipsel mips64 mips64el or1k powerpc powerpcspe ppc64 ppc64el s390 s390x sh4 sparc sparc64 x32
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: A system call tracer
Description: System call tracer
strace is a system call tracer, i.e. a debugging tool which prints out
a trace of all the system calls made by a another process/program.
The program to be traced need not be recompiled for this, so you can
@ -23,13 +23,13 @@ Package: strace64
Architecture: i386 powerpc s390 sparc
Priority: extra
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: A system call tracer for 64bit binaries
Description: System call tracer for 64bit binaries
strace is a system call tracer, i.e. a debugging tool which prints out
a trace of all the system calls made by a another process/program.
The program to be traced need not be recompiled for this, so you can
use it on binaries for which you don't have source.
.
This package containts the 64bit version of the binary, intended for
This package contains the 64bit version of the binary, intended for
biarch systems with 32bit userland and 64bit kernel.
.
System calls and signals are events that happen at the user/kernel
@ -40,9 +40,9 @@ Package: strace-udeb
Section: debian-installer
XC-Package-Type: udeb
Priority: extra
Architecture: alpha amd64 arm armeb armel armhf hppa i386 ia64 m68k mips mipsel powerpc powerpcspe ppc64 s390 sh4 sparc sparc64
Architecture: alpha amd64 arm64 armeb armel armhf hppa i386 ia64 m68k mips mipsel mips64 mips64el or1k powerpc powerpcspe ppc64 ppc64el s390 sh4 sparc sparc64 x32
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: A system call tracer
Description: System call tracer
strace is a system call tracer, i.e. a debugging tool which prints out
a trace of all the system calls made by a another process/program.
The program to be traced need not be recompiled for this, so you can

13
debian/rules vendored
View File

@ -2,7 +2,11 @@
#export DH_VERBOSE=1
CFLAGS = -Wall -g
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
CFLAGS += -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
@ -33,7 +37,12 @@ else
CONFIG_OPTS = --build=$(DEB_BUILD_GNU_TYPE) --host=$(DEB_HOST_GNU_TYPE)
endif
all build: build-stamp $(extra_build_targets)
all: build
build: build-arch build-indep
build-arch: build-stamp $(extra_build_targets)
build-indep: build-stamp $(extra_build_targets)
%-stamp: %/Makefile
$(MAKE) -C $*

1
debian/strace.docs vendored
View File

@ -1,2 +1 @@
TODO
NEWS

630
defs.h
View File

@ -30,15 +30,7 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef _LARGEFILE64_SOURCE
/* This is the macro everything checks before using foo64 names. */
# ifndef _LFS64_LARGEFILE
# define _LFS64_LARGEFILE 1
# endif
#endif
#ifdef MIPS
# include <sgidefs.h>
#endif
#include <features.h>
#ifdef HAVE_STDBOOL_H
# include <stdbool.h>
@ -52,7 +44,10 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
/* Open-coding isprint(ch) et al proved more efficient than calling
* generalized libc interface. We don't *want* to do non-ASCII anyway.
*/
/* #include <ctype.h> */
#include <string.h>
#include <errno.h>
#include <signal.h>
@ -83,6 +78,15 @@ extern char *stpcpy(char *dst, const char *src);
#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
/* macros */
#ifndef MAX
# define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef MIN
# define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#define CLAMP(val, min, max) MIN(MAX(min, val), max)
/* Glibc has an efficient macro for sigemptyset
* (it just does one or two assignments of 0 to internal vector of longs).
*/
@ -91,13 +95,6 @@ extern char *stpcpy(char *dst, const char *src);
#endif
/* Configuration section */
#ifndef MAX_QUALS
# if defined(MIPS)
# define MAX_QUALS 7000 /* maximum number of syscalls, signals, etc. */
# else
# define MAX_QUALS 2048 /* maximum number of syscalls, signals, etc. */
# endif
#endif
#ifndef DEFAULT_STRLEN
/* default maximum # of bytes printed in `printstr', change with -s switch */
# define DEFAULT_STRLEN 32
@ -109,118 +106,62 @@ extern char *stpcpy(char *dst, const char *src);
* Maximum number of args to a syscall.
*
* Make sure that all entries in all syscallent.h files have nargs <= MAX_ARGS!
* linux/<ARCH>/syscallent.h: all have nargs <= 6.
* linux/<ARCH>/syscallent*.h:
* all have nargs <= 6 except mips o32 which has nargs <= 7.
*/
#ifndef MAX_ARGS
# define MAX_ARGS 6
# ifdef LINUX_MIPSO32
# define MAX_ARGS 7
# else
# define MAX_ARGS 6
# endif
#endif
/* default sorting method for call profiling */
#ifndef DEFAULT_SORTBY
# define DEFAULT_SORTBY "time"
#endif
/*
* Experimental code using PTRACE_SEIZE can be enabled here.
* This needs Linux kernel 3.4.x or later to work.
*/
#define USE_SEIZE 1
/* To force NOMMU build, set to 1 */
#define NOMMU_SYSTEM 0
/*
* Set to 1 to use speed-optimized vfprintf implementation.
* It results in strace using about 5% less CPU in user space
* (compared to glibc version).
* But strace spends a lot of time in kernel space,
* so overall it does not appear to be a significant win.
* Thus disabled by default.
*/
#define USE_CUSTOM_PRINTF 0
#ifndef ERESTARTSYS
# define ERESTARTSYS 512
#endif
#ifndef ERESTARTNOINTR
# define ERESTARTNOINTR 513
#endif
#ifndef ERESTARTNOHAND
# define ERESTARTNOHAND 514
#endif
#ifndef ERESTART_RESTARTBLOCK
# define ERESTART_RESTARTBLOCK 516
#endif
#if defined(SPARC) || defined(SPARC64)
# define LINUXSPARC
#endif
#if defined(MIPS) && _MIPS_SIM == _MIPS_SIM_ABI32
# define LINUX_MIPSO32
#endif
#if defined(MIPS) && _MIPS_SIM == _MIPS_SIM_NABI32
# define LINUX_MIPSN32
# define LINUX_MIPS64
#endif
#if defined(MIPS) && _MIPS_SIM == _MIPS_SIM_ABI64
# define LINUX_MIPSN64
# define LINUX_MIPS64
#endif
#if (defined(LINUXSPARC) || defined(X86_64) || defined(ARM) || defined(AVR32)) && defined(__GLIBC__)
# include <sys/ptrace.h>
#else
/* Work around awkward prototype in ptrace.h. */
# define ptrace xptrace
# include <sys/ptrace.h>
# undef ptrace
# ifdef POWERPC
# define __KERNEL__
# include <asm/ptrace.h>
# undef __KERNEL__
# endif
extern long ptrace(int, int, char *, long);
#endif
#if !defined(__GLIBC__)
# define PTRACE_PEEKUSER PTRACE_PEEKUSR
# define PTRACE_POKEUSER PTRACE_POKEUSR
#endif
#if defined(X86_64) || defined(X32) || defined(I386)
/* For struct pt_regs. x86 strace uses PTRACE_GETREGS.
* PTRACE_GETREGS returns registers in the layout of this struct.
*/
# include <asm/ptrace.h>
#endif
#ifdef ALPHA
# define REG_R0 0
# define REG_A0 16
# define REG_A3 19
# define REG_FP 30
# define REG_PC 64
#endif /* ALPHA */
#ifdef MIPS
# define REG_V0 2
# define REG_A0 4
# define REG_A3 7
# define REG_SP 29
# define REG_EPC 64
#endif /* MIPS */
#ifdef HPPA
# define PT_GR20 (20*4)
# define PT_GR26 (26*4)
# define PT_GR28 (28*4)
# define PT_IAOQ0 (106*4)
# define PT_IAOQ1 (107*4)
#endif /* HPPA */
#ifdef SH64
/* SH64 Linux - this code assumes the following kernel API for system calls:
PC Offset 0
System Call Offset 16 (actually, (syscall no.) | (0x1n << 16),
where n = no. of parameters.
Other regs Offset 24+
On entry: R2-7 = parameters 1-6 (as many as necessary)
On return: R9 = result. */
/* Offset for peeks of registers */
# define REG_OFFSET (24)
# define REG_GENERAL(x) (8*(x)+REG_OFFSET)
# define REG_PC (0*8)
# define REG_SYSCALL (2*8)
#endif /* SH64 */
#define SUPPORTED_PERSONALITIES 1
#define DEFAULT_PERSONALITY 0
#ifdef LINUXSPARC
/* Indexes into the pt_regs.u_reg[] array -- UREG_XX from kernel are all off
* by 1 and use Ix instead of Ox. These work for both 32 and 64 bit Linux. */
# define U_REG_G1 0
# define U_REG_O0 7
# define U_REG_O1 8
# define PERSONALITY0_WORDSIZE 4
# define PERSONALITY1_WORDSIZE 4
# undef SUPPORTED_PERSONALITIES
# if defined(SPARC64)
# include <asm/psrcompat.h>
# define SUPPORTED_PERSONALITIES 3
# define PERSONALITY2_WORDSIZE 8
# else
# include <asm/psr.h>
# define SUPPORTED_PERSONALITIES 2
# endif /* SPARC64 */
#endif /* LINUXSPARC */
#endif /* SPARC[64] */
#ifdef X86_64
# undef SUPPORTED_PERSONALITIES
# define SUPPORTED_PERSONALITIES 3
# define PERSONALITY0_WORDSIZE 8
# define PERSONALITY1_WORDSIZE 4
@ -228,135 +169,99 @@ extern long ptrace(int, int, char *, long);
#endif
#ifdef X32
# undef SUPPORTED_PERSONALITIES
# define SUPPORTED_PERSONALITIES 2
# define PERSONALITY0_WORDSIZE 4
# define PERSONALITY1_WORDSIZE 4
#endif
#ifdef ARM
# undef SUPPORTED_PERSONALITIES
/* one personality */
#endif
#ifdef AARCH64
/* The existing ARM personality, then AArch64 */
# define SUPPORTED_PERSONALITIES 2
# define PERSONALITY0_WORDSIZE 4
# define PERSONALITY1_WORDSIZE 4
# define PERSONALITY1_WORDSIZE 8
# define DEFAULT_PERSONALITY 1
#endif
#ifdef POWERPC64
# undef SUPPORTED_PERSONALITIES
# define SUPPORTED_PERSONALITIES 2
# define PERSONALITY0_WORDSIZE 8
# define PERSONALITY1_WORDSIZE 4
#endif
#ifdef TILE
# define SUPPORTED_PERSONALITIES 2
# define PERSONALITY0_WORDSIZE 8
# define PERSONALITY1_WORDSIZE 4
# ifdef __tilepro__
# define DEFAULT_PERSONALITY 1
# endif
#endif
#ifndef SUPPORTED_PERSONALITIES
# define SUPPORTED_PERSONALITIES 1
#endif
#ifndef DEFAULT_PERSONALITY
# define DEFAULT_PERSONALITY 0
#endif
#ifndef PERSONALITY0_WORDSIZE
# define PERSONALITY0_WORDSIZE sizeof(long)
# define PERSONALITY0_WORDSIZE SIZEOF_LONG
#endif
#if !HAVE_DECL_PTRACE_SETOPTIONS
# define PTRACE_SETOPTIONS 0x4200
#endif
#if !HAVE_DECL_PTRACE_GETEVENTMSG
# define PTRACE_GETEVENTMSG 0x4201
#endif
#if !HAVE_DECL_PTRACE_GETSIGINFO
# define PTRACE_GETSIGINFO 0x4202
#endif
typedef struct sysent {
unsigned nargs;
int sys_flags;
int (*sys_func)();
const char *sys_name;
} struct_sysent;
#if !HAVE_DECL_PTRACE_O_TRACESYSGOOD
# define PTRACE_O_TRACESYSGOOD 0x00000001
#endif
#if !HAVE_DECL_PTRACE_O_TRACEFORK
# define PTRACE_O_TRACEFORK 0x00000002
#endif
#if !HAVE_DECL_PTRACE_O_TRACEVFORK
# define PTRACE_O_TRACEVFORK 0x00000004
#endif
#if !HAVE_DECL_PTRACE_O_TRACECLONE
# define PTRACE_O_TRACECLONE 0x00000008
#endif
#if !HAVE_DECL_PTRACE_O_TRACEEXEC
# define PTRACE_O_TRACEEXEC 0x00000010
#endif
#if !HAVE_DECL_PTRACE_O_TRACEEXIT
# define PTRACE_O_TRACEEXIT 0x00000040
#endif
#if !HAVE_DECL_PTRACE_EVENT_FORK
# define PTRACE_EVENT_FORK 1
#endif
#if !HAVE_DECL_PTRACE_EVENT_VFORK
# define PTRACE_EVENT_VFORK 2
#endif
#if !HAVE_DECL_PTRACE_EVENT_CLONE
# define PTRACE_EVENT_CLONE 3
#endif
#if !HAVE_DECL_PTRACE_EVENT_EXEC
# define PTRACE_EVENT_EXEC 4
#endif
#if !HAVE_DECL_PTRACE_EVENT_VFORK_DONE
# define PTRACE_EVENT_VFORK_DONE 5
#endif
#if !HAVE_DECL_PTRACE_EVENT_EXIT
# define PTRACE_EVENT_EXIT 6
#endif
/* Experimental code using PTRACE_SEIZE can be enabled here: */
//# define USE_SEIZE 1
#ifdef USE_SEIZE
# undef PTRACE_SEIZE
# define PTRACE_SEIZE 0x4206
# undef PTRACE_INTERRUPT
# define PTRACE_INTERRUPT 0x4207
# undef PTRACE_LISTEN
# define PTRACE_LISTEN 0x4208
# undef PTRACE_SEIZE_DEVEL
# define PTRACE_SEIZE_DEVEL 0x80000000
# undef PTRACE_EVENT_STOP
# define PTRACE_EVENT_STOP 7
# define PTRACE_EVENT_STOP1 128
#endif
#if defined(I386)
extern struct pt_regs i386_regs;
#endif
#if defined(IA64)
extern long ia32;
#endif
typedef struct ioctlent {
const char *symbol;
unsigned int code;
} struct_ioctlent;
/* Trace Control Block */
struct tcb {
int flags; /* See below for TCB_ values */
int pid; /* Process Id of this entry */
int u_nargs; /* System call argument count */
int pid; /* If 0, this tcb is free */
int qual_flg; /* qual_flags[scno] or DEFAULT_QUAL_FLAGS + RAW */
int u_error; /* Error code */
long scno; /* System call number */
long u_arg[MAX_ARGS]; /* System call arguments */
#if defined(LINUX_MIPSN32) || defined(X32)
long long ext_arg[MAX_ARGS]; /* System call arguments */
#endif
long u_rval; /* return value */
#if defined(LINUX_MIPSN32) || defined(X32)
long long ext_arg[MAX_ARGS];
long long u_lrval; /* long long return value */
#endif
long u_rval; /* Return value */
#if SUPPORTED_PERSONALITIES > 1
int currpers; /* Personality at the time of scno update */
unsigned int currpers; /* Personality at the time of scno update */
#endif
int curcol; /* Output column for this process */
FILE *outf; /* Output file for this process */
const char *auxstr; /* Auxiliary info from syscall (see RVAL_STR) */
const struct_sysent *s_ent; /* sysent[scno] or dummy struct for bad scno */
struct timeval stime; /* System time usage as of last process wait */
struct timeval dtime; /* Delta for system time usage */
struct timeval etime; /* Syscall entry time */
/* Support for tracing forked processes: */
long inst[2]; /* Saved clone args (badly named) */
#ifdef USE_LIBUNWIND
struct UPT_info* libunwind_ui;
struct mmap_cache_t* mmap_cache;
unsigned int mmap_cache_size;
unsigned int mmap_cache_generation;
struct queue_t* queue;
#endif
};
/* TCB flags */
#define TCB_INUSE 00001 /* This table entry is in use */
/* We have attached to this process, but did not see it stopping yet */
#define TCB_STARTUP 00002
#define TCB_IGNORE_ONE_SIGSTOP 00004 /* Next SIGSTOP is to be ignored */
#define TCB_STARTUP 0x01
#define TCB_IGNORE_ONE_SIGSTOP 0x02 /* Next SIGSTOP is to be ignored */
/*
* Are we in system call entry or in syscall exit?
*
@ -369,60 +274,46 @@ struct tcb {
* are limited to trace(), this condition is never observed in trace_syscall()
* and below.
* The bit is cleared after all syscall exit processing is done.
* User-generated SIGTRAPs and post-execve SIGTRAP make it necessary
* to be very careful and NOT set TCB_INSYSCALL bit when they are encountered.
* TCB_WAITEXECVE bit is used for this purpose (see below).
*
* Use entering(tcp) / exiting(tcp) to check this bit to make code more readable.
*/
#define TCB_INSYSCALL 00010
#define TCB_ATTACHED 00020 /* It is attached already */
/* Are we PROG from "strace PROG [ARGS]" invocation? */
#define TCB_STRACE_CHILD 0040
#define TCB_BPTSET 00100 /* "Breakpoint" set after fork(2) */
#define TCB_REPRINT 00200 /* We should reprint this syscall on exit */
#define TCB_FILTERED 00400 /* This system call has been filtered out */
/* x86 does not need TCB_WAITEXECVE.
* It can detect SIGTRAP by looking at eax/rax.
* See "not a syscall entry (eax = %ld)\n" message
* in syscall_fixup_on_sysenter().
*/
#if defined(ALPHA) || defined(AVR32) || defined(SPARC) || defined(SPARC64) \
|| defined(POWERPC) || defined(IA64) || defined(HPPA) \
|| defined(SH) || defined(SH64) || defined(S390) || defined(S390X) \
|| defined(ARM) || defined(MIPS) || defined(BFIN) || defined(TILE)
/* This tracee has entered into execve syscall. Expect post-execve SIGTRAP
* to happen. (When it is detected, tracee is continued and this bit is cleared.)
*/
# define TCB_WAITEXECVE 01000
#endif
#define TCB_INSYSCALL 0x04
#define TCB_ATTACHED 0x08 /* We attached to it already */
#define TCB_REPRINT 0x10 /* We should reprint this syscall on exit */
#define TCB_FILTERED 0x20 /* This system call has been filtered out */
/* qualifier flags */
#define QUAL_TRACE 0001 /* this system call should be traced */
#define QUAL_ABBREV 0002 /* abbreviate the structures of this syscall */
#define QUAL_VERBOSE 0004 /* decode the structures of this syscall */
#define QUAL_RAW 0010 /* print all args in hex for this syscall */
#define QUAL_SIGNAL 0020 /* report events with this signal */
#define QUAL_FAULT 0040 /* report events with this fault */
#define QUAL_READ 0100 /* dump data read on this file descriptor */
#define QUAL_WRITE 0200 /* dump data written to this file descriptor */
#define QUAL_TRACE 0x001 /* this system call should be traced */
#define QUAL_ABBREV 0x002 /* abbreviate the structures of this syscall */
#define QUAL_VERBOSE 0x004 /* decode the structures of this syscall */
#define QUAL_RAW 0x008 /* print all args in hex for this syscall */
#define QUAL_SIGNAL 0x010 /* report events with this signal */
#define QUAL_READ 0x020 /* dump data read on this file descriptor */
#define QUAL_WRITE 0x040 /* dump data written to this file descriptor */
typedef uint8_t qualbits_t;
#define UNDEFINED_SCNO 0x100 /* Used only in tcp->qual_flg */
#define DEFAULT_QUAL_FLAGS (QUAL_TRACE | QUAL_ABBREV | QUAL_VERBOSE)
#define entering(tcp) (!((tcp)->flags & TCB_INSYSCALL))
#define exiting(tcp) ((tcp)->flags & TCB_INSYSCALL)
#define syserror(tcp) ((tcp)->u_error != 0)
#define verbose(tcp) (qual_flags[(tcp)->scno] & QUAL_VERBOSE)
#define abbrev(tcp) (qual_flags[(tcp)->scno] & QUAL_ABBREV)
#define verbose(tcp) ((tcp)->qual_flg & QUAL_VERBOSE)
#define abbrev(tcp) ((tcp)->qual_flg & QUAL_ABBREV)
#define filtered(tcp) ((tcp)->flags & TCB_FILTERED)
struct xlat {
int val;
unsigned int val;
const char *str;
};
#define XLAT(x) { x, #x }
#define XLAT_END { 0, NULL }
extern const struct xlat open_mode_flags[];
extern const struct xlat addrfams[];
extern const struct xlat struct_user_offsets[];
extern const struct xlat at_flags[];
extern const struct xlat open_access_modes[];
extern const struct xlat open_mode_flags[];
extern const struct xlat whence_codes[];
/* Format of syscall return values */
#define RVAL_DECIMAL 000 /* decimal format */
@ -437,10 +328,11 @@ extern const struct xlat open_access_modes[];
# endif
# define RVAL_LUDECIMAL 007 /* long unsigned decimal format */
#endif
#define RVAL_MASK 007 /* mask for these values */
#define RVAL_FD 010 /* file descriptor */
#define RVAL_MASK 017 /* mask for these values */
#define RVAL_STR 010 /* Print `auxstr' field after return val */
#define RVAL_NONE 020 /* Print nothing */
#define RVAL_STR 020 /* Print `auxstr' field after return val */
#define RVAL_NONE 040 /* Print nothing */
#define TRACE_FILE 001 /* Trace file-related syscalls. */
#define TRACE_IPC 002 /* Trace IPC-related syscalls. */
@ -448,7 +340,26 @@ extern const struct xlat open_access_modes[];
#define TRACE_PROCESS 010 /* Trace process-related syscalls. */
#define TRACE_SIGNAL 020 /* Trace signal-related syscalls. */
#define TRACE_DESC 040 /* Trace file descriptor-related syscalls. */
#define SYSCALL_NEVER_FAILS 0100 /* Syscall is always successful. */
#define TRACE_MEMORY 0100 /* Trace memory mapping-related syscalls. */
#define SYSCALL_NEVER_FAILS 0200 /* Syscall is always successful. */
#define STACKTRACE_INVALIDATE_CACHE 0400 /* Trigger proc/maps cache updating */
#define STACKTRACE_CAPTURE_ON_ENTER 01000 /* Capture stacktrace on "entering" stage */
#define TRACE_INDIRECT_SUBCALL 02000 /* Syscall is an indirect socket/ipc subcall. */
#if defined(ARM) || defined(AARCH64) \
|| defined(I386) || defined(X32) || defined(X86_64) \
|| defined(IA64) \
|| defined(BFIN) \
|| defined(M68K) \
|| defined(MICROBLAZE) \
|| defined(S390) \
|| defined(SH) || defined(SH64) \
|| defined(SPARC) || defined(SPARC64) \
/**/
# define NEED_UID16_PARSERS 1
#else
# define NEED_UID16_PARSERS 0
#endif
typedef enum {
CFLAG_NONE = 0,
@ -456,17 +367,28 @@ typedef enum {
CFLAG_BOTH
} cflag_t;
extern cflag_t cflag;
extern int *qual_flags;
extern bool debug_flag;
extern bool Tflag;
extern bool qflag;
extern bool iflag;
extern bool count_wallclock;
extern unsigned int qflag;
extern bool not_failing_only;
extern bool show_fd_path;
extern bool tracing_paths;
extern unsigned int xflag;
extern unsigned int followfork;
extern unsigned int ptrace_setoptions;
extern unsigned int max_strlen;
extern unsigned int show_fd_path;
extern bool hide_log_until_execve;
/* are we filtering traces based on paths? */
extern const char **paths_selected;
#define tracing_paths (paths_selected != NULL)
extern unsigned xflag;
extern unsigned followfork;
#ifdef USE_LIBUNWIND
/* if this is true do the stack trace for every system call */
extern bool stack_trace_enabled;
#endif
extern unsigned ptrace_setoptions;
extern unsigned max_strlen;
extern unsigned os_release;
#undef KERNEL_VERSION
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
enum bitness_t { BITNESS_CURRENT = 0, BITNESS_32 };
@ -476,17 +398,10 @@ void error_msg_and_die(const char *fmt, ...) __attribute__ ((noreturn, format(pr
void perror_msg_and_die(const char *fmt, ...) __attribute__ ((noreturn, format(printf, 1, 2)));
void die_out_of_memory(void) __attribute__ ((noreturn));
#ifdef USE_CUSTOM_PRINTF
#if USE_CUSTOM_PRINTF
/*
* Speed-optimized vfprintf implementation.
* See comment in vsprintf.c for allowed formats.
* Short version: %h[h]u, %zu, %tu are not allowed, use %[l[l]]u.
*
* It results in strace using about 5% less CPU in user space
* (compared to glibc version).
* But strace spends a lot of time in kernel space,
* so overall it does not appear to be a significant win.
* Thus disabled by default.
*/
int strace_vfprintf(FILE *fp, const char *fmt, va_list args);
#else
@ -496,65 +411,73 @@ int strace_vfprintf(FILE *fp, const char *fmt, va_list args);
extern void set_sortby(const char *);
extern void set_overhead(int);
extern void qualify(const char *);
extern void print_pc(struct tcb *);
extern int trace_syscall(struct tcb *);
extern void count_syscall(struct tcb *, struct timeval *);
extern void count_syscall(struct tcb *, const struct timeval *);
extern void call_summary(FILE *);
extern int umoven(struct tcb *, long, int, char *);
extern void clear_regs(void);
extern void get_regs(pid_t pid);
extern int umoven(struct tcb *, long, unsigned int, char *);
#define umove(pid, addr, objp) \
umoven((pid), (addr), sizeof(*(objp)), (char *) (objp))
extern int umovestr(struct tcb *, long, int, char *);
extern int upeek(struct tcb *, long, long *);
extern int umovestr(struct tcb *, long, unsigned int, char *);
extern int upeek(int pid, long, long *);
#if defined(SPARC) || defined(SPARC64) || defined(IA64) || defined(SH)
extern long getrval2(struct tcb *);
#endif
/*
* On Linux, "setbpt" is a misnomer: we don't set a breakpoint
* (IOW: no poking in user's text segment),
* instead we change fork/vfork/clone into clone(CLONE_PTRACE).
* On newer kernels, we use PTRACE_O_TRACECLONE/TRACE[V]FORK instead.
*/
extern int setbpt(struct tcb *);
extern int clearbpt(struct tcb *);
extern const char *signame(int);
extern int is_restart_error(struct tcb *);
extern int pathtrace_select(const char *);
extern const char *signame(const int);
extern void pathtrace_select(const char *);
extern int pathtrace_match(struct tcb *);
extern const char *getfdpath(struct tcb *, int);
extern int getfdpath(struct tcb *, int, char *, unsigned);
extern const char *xlookup(const struct xlat *, int);
extern const char *xlookup(const struct xlat *, const unsigned int);
extern const char *xlat_search(const struct xlat *, const size_t, const unsigned int);
extern int string_to_uint(const char *str);
extern int string_quote(const char *, char *, long, int);
extern int next_set_bit(const void *bit_array, unsigned cur_bit, unsigned size_bits);
#if HAVE_LONG_LONG
/* _l refers to the lower numbered u_arg,
* _h refers to the higher numbered u_arg
#define QUOTE_0_TERMINATED 0x01
#define QUOTE_OMIT_LEADING_TRAILING_QUOTES 0x02
extern int print_quoted_string(const char *, unsigned int, unsigned int);
/* a refers to the lower numbered u_arg,
* b refers to the higher numbered u_arg
*/
# if HAVE_LITTLE_ENDIAN_LONG_LONG
# define LONG_LONG(_l,_h) \
((long long)((unsigned long long)(unsigned)(_l) | ((unsigned long long)(_h)<<32)))
# else
# define LONG_LONG(_l,_h) \
((long long)((unsigned long long)(unsigned)(_h) | ((unsigned long long)(_l)<<32)))
# endif
extern int printllval(struct tcb *, const char *, int);
#if HAVE_LITTLE_ENDIAN_LONG_LONG
# define LONG_LONG(a,b) \
((long long)((unsigned long long)(unsigned)(a) | ((unsigned long long)(b)<<32)))
#else
# define LONG_LONG(a,b) \
((long long)((unsigned long long)(unsigned)(b) | ((unsigned long long)(a)<<32)))
#endif
extern void printxval(const struct xlat *, int, const char *);
extern int getllval(struct tcb *, unsigned long long *, int);
extern int printllval(struct tcb *, const char *, int)
__attribute__ ((format (printf, 2, 0)));
extern void printxval(const struct xlat *, const unsigned int, const char *);
extern int printargs(struct tcb *);
extern int printargs_lu(struct tcb *);
extern int printargs_ld(struct tcb *);
extern void addflags(const struct xlat *, int);
extern int printflags(const struct xlat *, int, const char *);
extern const char *sprintflags(const char *, const struct xlat *, int);
extern const char *sprintmode(int);
extern const char *sprinttime(time_t);
extern void dumpiov_in_msghdr(struct tcb *, long);
extern void dumpiov_in_mmsghdr(struct tcb *, long);
extern void dumpiov(struct tcb *, int, long);
extern void dumpstr(struct tcb *, long, int);
extern void printstr(struct tcb *, long, long);
extern void printnum(struct tcb *, long, const char *);
extern void printnum_int(struct tcb *, long, const char *);
extern void printnum_int(struct tcb *, long, const char *)
__attribute__ ((format (printf, 3, 0)));
extern void printnum_long(struct tcb *, long, const char *)
__attribute__ ((format (printf, 3, 0)));
extern void printpath(struct tcb *, long);
extern void printpathn(struct tcb *, long, int);
extern void printpathn(struct tcb *, long, unsigned int);
#define TIMESPEC_TEXT_BUFSIZE (sizeof(long)*3 * 2 + sizeof("{%u, %u}"))
#define TIMEVAL_TEXT_BUFSIZE TIMESPEC_TEXT_BUFSIZE
extern void printtv_bitness(struct tcb *, long, enum bitness_t, int);
@ -565,45 +488,63 @@ extern void printtv_bitness(struct tcb *, long, enum bitness_t, int);
extern char *sprinttv(char *, struct tcb *, long, enum bitness_t, int special);
extern void print_timespec(struct tcb *, long);
extern void sprint_timespec(char *, struct tcb *, long);
#ifdef HAVE_SIGINFO_T
extern void printsiginfo(siginfo_t *, int);
#endif
extern void printsiginfo(const siginfo_t *, int);
extern void printsiginfo_at(struct tcb *tcp, long addr);
extern void printfd(struct tcb *, int);
extern bool print_sockaddr_by_inode(const unsigned long, const char *);
extern void print_dirfd(struct tcb *, int);
extern void printsock(struct tcb *, long, int);
extern void print_sock_optmgmt(struct tcb *, long, int);
extern void printrusage(struct tcb *, long);
#ifdef ALPHA
extern void printrusage32(struct tcb *, long);
#endif
extern void printuid(const char *, unsigned long);
extern void printcall(struct tcb *);
extern void print_sigset(struct tcb *, long, int);
extern void printuid(const char *, const unsigned int);
extern void print_sigset_addr_len(struct tcb *, long, long);
extern const char *sprintsigmask_n(const char *, const void *, unsigned int);
#define tprintsigmask_addr(prefix, mask) \
tprints(sprintsigmask_n((prefix), (mask), sizeof(mask)))
extern void printsignal(int);
extern void tprint_iov(struct tcb *, unsigned long, unsigned long, int decode_iov);
extern void tprint_iov_upto(struct tcb *, unsigned long, unsigned long, int decode_iov, unsigned long);
extern void tprint_open_modes(mode_t);
extern const char *sprint_open_modes(mode_t);
extern void tprint_open_modes(int);
extern const char *sprint_open_modes(int);
extern void print_loff_t(struct tcb *, long);
extern void print_seccomp_filter(struct tcb *tcp, unsigned long);
extern const struct ioctlent *ioctl_lookup(long);
extern const struct ioctlent *ioctl_next_match(const struct ioctlent *);
extern int ioctl_decode(struct tcb *, long, long);
extern int term_ioctl(struct tcb *, long, long);
extern int sock_ioctl(struct tcb *, long, long);
extern int proc_ioctl(struct tcb *, int, int);
extern int rtc_ioctl(struct tcb *, long, long);
extern int scsi_ioctl(struct tcb *, long, long);
extern int block_ioctl(struct tcb *, long, long);
extern int mtd_ioctl(struct tcb *, long, long);
extern int loop_ioctl(struct tcb *, long, long);
extern const struct_ioctlent *ioctl_lookup(const unsigned int);
extern const struct_ioctlent *ioctl_next_match(const struct_ioctlent *);
extern void ioctl_print_code(const unsigned int);
extern int ioctl_decode(struct tcb *, const unsigned int, long);
extern int ioctl_decode_command_number(const unsigned int);
extern int block_ioctl(struct tcb *, const unsigned int, long);
extern int evdev_ioctl(struct tcb *, const unsigned int, long);
extern int loop_ioctl(struct tcb *, const unsigned int, long);
extern int mtd_ioctl(struct tcb *, const unsigned int, long);
extern int ptp_ioctl(struct tcb *, const unsigned int, long);
extern int rtc_ioctl(struct tcb *, const unsigned int, long);
extern int scsi_ioctl(struct tcb *, const unsigned int, long);
extern int sock_ioctl(struct tcb *, const unsigned int, long);
extern int term_ioctl(struct tcb *, const unsigned int, long);
extern int ubi_ioctl(struct tcb *, const unsigned int, long);
extern int v4l2_ioctl(struct tcb *, const unsigned int, long);
extern int tv_nz(struct timeval *);
extern int tv_cmp(struct timeval *, struct timeval *);
extern double tv_float(struct timeval *);
extern void tv_add(struct timeval *, struct timeval *, struct timeval *);
extern void tv_sub(struct timeval *, struct timeval *, struct timeval *);
extern void tv_mul(struct timeval *, struct timeval *, int);
extern void tv_div(struct timeval *, struct timeval *, int);
extern int tv_nz(const struct timeval *);
extern int tv_cmp(const struct timeval *, const struct timeval *);
extern double tv_float(const struct timeval *);
extern void tv_add(struct timeval *, const struct timeval *, const struct timeval *);
extern void tv_sub(struct timeval *, const struct timeval *, const struct timeval *);
extern void tv_mul(struct timeval *, const struct timeval *, int);
extern void tv_div(struct timeval *, const struct timeval *, int);
#ifdef USE_LIBUNWIND
extern void unwind_init(void);
extern void unwind_tcb_init(struct tcb *tcp);
extern void unwind_tcb_fin(struct tcb *tcp);
extern void unwind_cache_invalidate(struct tcb* tcp);
extern void unwind_print_stacktrace(struct tcb* tcp);
extern void unwind_capture_stacktrace(struct tcb* tcp);
#endif
/* Strace log generation machinery.
*
@ -631,36 +572,61 @@ extern void tprints(const char *str);
#if SUPPORTED_PERSONALITIES > 1
extern void set_personality(int personality);
extern int current_personality;
extern const int personality_wordsize[];
# define current_wordsize (personality_wordsize[current_personality])
extern unsigned current_personality;
#else
# define set_personality(personality) ((void)0)
# define current_personality 0
# define current_wordsize PERSONALITY0_WORDSIZE
#endif
struct sysent {
unsigned nargs;
int sys_flags;
int (*sys_func)();
const char *sys_name;
};
#if SUPPORTED_PERSONALITIES == 1
# define current_wordsize PERSONALITY0_WORDSIZE
#else
# if SUPPORTED_PERSONALITIES == 2 && PERSONALITY0_WORDSIZE == PERSONALITY1_WORDSIZE
# define current_wordsize PERSONALITY0_WORDSIZE
# else
extern unsigned current_wordsize;
# endif
#endif
struct ioctlent {
const char *doth;
const char *symbol;
unsigned long code;
};
/* In many, many places we play fast and loose and use
* tprintf("%d", (int) tcp->u_arg[N]) to print fds, pids etc.
* We probably need to use widen_to_long() instead:
*/
#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
# define widen_to_long(v) (current_wordsize == 4 ? (long)(int32_t)(v) : (long)(v))
#else
# define widen_to_long(v) ((long)(v))
#endif
extern const struct sysent *sysent;
extern unsigned nsyscalls;
extern const struct_sysent sysent0[];
extern const char *const errnoent0[];
extern const char *const signalent0[];
extern const struct_ioctlent ioctlent0[];
extern qualbits_t *qual_vec[SUPPORTED_PERSONALITIES];
#define qual_flags (qual_vec[current_personality])
#if SUPPORTED_PERSONALITIES > 1
extern const struct_sysent *sysent;
extern const char *const *errnoent;
extern unsigned nerrnos;
extern const struct ioctlent *ioctlent;
extern unsigned nioctlents;
extern const char *const *signalent;
extern const struct_ioctlent *ioctlent;
#else
# define sysent sysent0
# define errnoent errnoent0
# define signalent signalent0
# define ioctlent ioctlent0
#endif
extern unsigned nsyscalls;
extern unsigned nerrnos;
extern unsigned nsignals;
extern unsigned nioctlents;
extern unsigned num_quals;
/*
* If you need non-NULL sysent[scno].sys_func and sysent[scno].sys_name
*/
#define SCNO_IS_VALID(scno) \
((unsigned long)(scno) < nsyscalls && sysent[scno].sys_func)
/* Only ensures that sysent[scno] isn't out of range */
#define SCNO_IN_RANGE(scno) \
((unsigned long)(scno) < nsyscalls && sysent[scno].sys_func)
((unsigned long)(scno) < nsyscalls)

798
desc.c
View File

@ -34,249 +34,37 @@
#ifdef HAVE_SYS_EPOLL_H
# include <sys/epoll.h>
#endif
#ifdef HAVE_LIBAIO_H
# include <libaio.h>
#ifdef HAVE_LINUX_PERF_EVENT_H
# include <linux/perf_event.h>
#endif
#if HAVE_LONG_LONG_OFF_T
#include "xlat/fcntlcmds.h"
#include "xlat/fdflags.h"
#include "xlat/flockcmds.h"
#include "xlat/lockfcmds.h"
#include "xlat/notifyflags.h"
#include "xlat/perf_event_open_flags.h"
/*
* Hacks for systems that have a long long off_t
* Assume that F_SETLK64, F_SETLKW64, and F_GETLK64 are either defined
* or not defined altogether.
*/
# define flock64 flock /* Horrid hack */
# define printflock printflock64 /* Horrider hack */
#if defined(F_SETLK64) && F_SETLK64 + 0 != F_SETLK
# define USE_PRINTFLOCK64 1
#else
# define USE_PRINTFLOCK64 0
#endif
static const struct xlat fcntlcmds[] = {
{ F_DUPFD, "F_DUPFD" },
{ F_GETFD, "F_GETFD" },
{ F_SETFD, "F_SETFD" },
{ F_GETFL, "F_GETFL" },
{ F_SETFL, "F_SETFL" },
{ F_GETLK, "F_GETLK" },
{ F_SETLK, "F_SETLK" },
{ F_SETLKW, "F_SETLKW" },
{ F_GETOWN, "F_GETOWN" },
{ F_SETOWN, "F_SETOWN" },
#ifdef F_RSETLK
{ F_RSETLK, "F_RSETLK" },
#endif
#ifdef F_RSETLKW
{ F_RSETLKW, "F_RSETLKW" },
#endif
#ifdef F_RGETLK
{ F_RGETLK, "F_RGETLK" },
#endif
#ifdef F_CNVT
{ F_CNVT, "F_CNVT" },
#endif
#ifdef F_SETSIG
{ F_SETSIG, "F_SETSIG" },
#endif
#ifdef F_GETSIG
{ F_GETSIG, "F_GETSIG" },
#endif
#ifdef F_CHKFL
{ F_CHKFL, "F_CHKFL" },
#endif
#ifdef F_DUP2FD
{ F_DUP2FD, "F_DUP2FD" },
#endif
#ifdef F_ALLOCSP
{ F_ALLOCSP, "F_ALLOCSP" },
#endif
#ifdef F_ISSTREAM
{ F_ISSTREAM, "F_ISSTREAM" },
#endif
#ifdef F_PRIV
{ F_PRIV, "F_PRIV" },
#endif
#ifdef F_NPRIV
{ F_NPRIV, "F_NPRIV" },
#endif
#ifdef F_QUOTACL
{ F_QUOTACL, "F_QUOTACL" },
#endif
#ifdef F_BLOCKS
{ F_BLOCKS, "F_BLOCKS" },
#endif
#ifdef F_BLKSIZE
{ F_BLKSIZE, "F_BLKSIZE" },
#endif
#ifdef F_GETOWN
{ F_GETOWN, "F_GETOWN" },
#endif
#ifdef F_SETOWN
{ F_SETOWN, "F_SETOWN" },
#endif
#ifdef F_REVOKE
{ F_REVOKE, "F_REVOKE" },
#endif
#ifdef F_SETLK
{ F_SETLK, "F_SETLK" },
#endif
#ifdef F_SETLKW
{ F_SETLKW, "F_SETLKW" },
#endif
#ifdef F_FREESP
{ F_FREESP, "F_FREESP" },
#endif
#ifdef F_GETLK
{ F_GETLK, "F_GETLK" },
#endif
#ifdef F_SETLK64
{ F_SETLK64, "F_SETLK64" },
#endif
#ifdef F_SETLKW64
{ F_SETLKW64, "F_SETLKW64" },
#endif
#ifdef F_FREESP64
{ F_FREESP64, "F_FREESP64" },
#endif
#ifdef F_GETLK64
{ F_GETLK64, "F_GETLK64" },
#endif
#ifdef F_SHARE
{ F_SHARE, "F_SHARE" },
#endif
#ifdef F_UNSHARE
{ F_UNSHARE, "F_UNSHARE" },
#endif
#ifdef F_SETLEASE
{ F_SETLEASE, "F_SETLEASE" },
#endif
#ifdef F_GETLEASE
{ F_GETLEASE, "F_GETLEASE" },
#endif
#ifdef F_NOTIFY
{ F_NOTIFY, "F_NOTIFY" },
#endif
#ifdef F_DUPFD_CLOEXEC
{ F_DUPFD_CLOEXEC,"F_DUPFD_CLOEXEC"},
#endif
{ 0, NULL },
#if USE_PRINTFLOCK64
# ifndef HAVE_STRUCT_FLOCK64
struct flock64 {
short int l_type, l_whence;
int64_t l_start, l_len;
int l_pid;
};
# endif
static const struct xlat fdflags[] = {
#ifdef FD_CLOEXEC
{ FD_CLOEXEC, "FD_CLOEXEC" },
#endif
{ 0, NULL },
};
#ifdef LOCK_SH
static const struct xlat flockcmds[] = {
{ LOCK_SH, "LOCK_SH" },
{ LOCK_EX, "LOCK_EX" },
{ LOCK_NB, "LOCK_NB" },
{ LOCK_UN, "LOCK_UN" },
{ 0, NULL },
};
#endif /* LOCK_SH */
static const struct xlat lockfcmds[] = {
{ F_RDLCK, "F_RDLCK" },
{ F_WRLCK, "F_WRLCK" },
{ F_UNLCK, "F_UNLCK" },
#ifdef F_EXLCK
{ F_EXLCK, "F_EXLCK" },
#endif
#ifdef F_SHLCK
{ F_SHLCK, "F_SHLCK" },
#endif
{ 0, NULL },
};
#ifdef F_NOTIFY
static const struct xlat notifyflags[] = {
#ifdef DN_ACCESS
{ DN_ACCESS, "DN_ACCESS" },
#endif
#ifdef DN_MODIFY
{ DN_MODIFY, "DN_MODIFY" },
#endif
#ifdef DN_CREATE
{ DN_CREATE, "DN_CREATE" },
#endif
#ifdef DN_DELETE
{ DN_DELETE, "DN_DELETE" },
#endif
#ifdef DN_RENAME
{ DN_RENAME, "DN_RENAME" },
#endif
#ifdef DN_ATTRIB
{ DN_ATTRIB, "DN_ATTRIB" },
#endif
#ifdef DN_MULTISHOT
{ DN_MULTISHOT, "DN_MULTISHOT" },
#endif
{ 0, NULL },
};
#endif
static const struct xlat whence[] = {
{ SEEK_SET, "SEEK_SET" },
{ SEEK_CUR, "SEEK_CUR" },
{ SEEK_END, "SEEK_END" },
{ 0, NULL },
};
#ifndef HAVE_LONG_LONG_OFF_T
/* fcntl/lockf */
static void
printflock(struct tcb *tcp, long addr, int getlk)
{
struct flock fl;
#if SUPPORTED_PERSONALITIES > 1
if (current_wordsize != sizeof(fl.l_start)) {
if (current_wordsize == 4) {
/* 32-bit x86 app on x86_64 and similar cases */
struct {
short int l_type;
short int l_whence;
int32_t l_start; /* off_t */
int32_t l_len; /* off_t */
int32_t l_pid; /* pid_t */
} fl32;
if (umove(tcp, addr, &fl32) < 0) {
tprints("{...}");
return;
}
fl.l_type = fl32.l_type;
fl.l_whence = fl32.l_whence;
fl.l_start = fl32.l_start;
fl.l_len = fl32.l_len;
fl.l_pid = fl32.l_pid;
} else {
/* let people know we have a problem here */
tprintf("{ <decode error: unsupported wordsize %d> }",
current_wordsize);
return;
}
} else
#endif
{
if (umove(tcp, addr, &fl) < 0) {
tprints("{...}");
return;
}
}
tprints("{type=");
printxval(lockfcmds, fl.l_type, "F_???");
tprints(", whence=");
printxval(whence, fl.l_whence, "SEEK_???");
tprintf(", start=%ld, len=%ld", fl.l_start, fl.l_len);
if (getlk)
tprintf(", pid=%lu}", (unsigned long) fl.l_pid);
else
tprints("}");
}
#endif
#if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
/* fcntl/lockf */
static void
printflock64(struct tcb *tcp, long addr, int getlk)
{
@ -289,14 +77,73 @@ printflock64(struct tcb *tcp, long addr, int getlk)
tprints("{type=");
printxval(lockfcmds, fl.l_type, "F_???");
tprints(", whence=");
printxval(whence, fl.l_whence, "SEEK_???");
printxval(whence_codes, fl.l_whence, "SEEK_???");
tprintf(", start=%lld, len=%lld", (long long) fl.l_start, (long long) fl.l_len);
if (getlk)
tprintf(", pid=%lu}", (unsigned long) fl.l_pid);
else
tprints("}");
}
#endif /* USE_PRINTFLOCK64 */
static void
printflock(struct tcb *tcp, long addr, int getlk)
{
struct flock fl;
int r;
#if SUPPORTED_PERSONALITIES > 1
if (
# if SIZEOF_OFF_T > SIZEOF_LONG
current_personality > 0 &&
#endif
current_wordsize != sizeof(fl.l_start)) {
if (current_wordsize == 4) {
/* 32-bit x86 app on x86_64 and similar cases */
struct {
short int l_type;
short int l_whence;
int32_t l_start; /* off_t */
int32_t l_len; /* off_t */
int32_t l_pid; /* pid_t */
} fl32;
r = umove(tcp, addr, &fl32);
if (r >= 0) {
fl.l_type = fl32.l_type;
fl.l_whence = fl32.l_whence;
fl.l_start = fl32.l_start;
fl.l_len = fl32.l_len;
fl.l_pid = fl32.l_pid;
}
} else {
/* let people know we have a problem here */
tprintf("<decode error: unsupported wordsize %d>",
current_wordsize);
return;
}
} else
#endif
{
r = umove(tcp, addr, &fl);
}
if (r < 0) {
tprints("{...}");
return;
}
tprints("{type=");
printxval(lockfcmds, fl.l_type, "F_???");
tprints(", whence=");
printxval(whence_codes, fl.l_whence, "SEEK_???");
#if SIZEOF_OFF_T > SIZEOF_LONG
tprintf(", start=%lld, len=%lld", fl.l_start, fl.l_len);
#else
tprintf(", start=%ld, len=%ld", fl.l_start, fl.l_len);
#endif
if (getlk)
tprintf(", pid=%lu}", (unsigned long) fl.l_pid);
else
tprints("}");
}
int
sys_fcntl(struct tcb *tcp)
@ -321,28 +168,15 @@ sys_fcntl(struct tcb *tcp)
tprint_open_modes(tcp->u_arg[2]);
break;
case F_SETLK: case F_SETLKW:
#ifdef F_FREESP
case F_FREESP:
#endif
tprints(", ");
printflock(tcp, tcp->u_arg[2], 0);
break;
#if _LFS64_LARGEFILE
#ifdef F_FREESP64
case F_FREESP64:
#endif
/* Linux glibc defines SETLK64 as SETLK,
even though the kernel has different values - as does Solaris. */
#if defined(F_SETLK64) && F_SETLK64 + 0 != F_SETLK
case F_SETLK64:
#endif
#if defined(F_SETLKW64) && F_SETLKW64 + 0 != F_SETLKW
case F_SETLKW64:
#endif
#if USE_PRINTFLOCK64
case F_SETLK64: case F_SETLKW64:
tprints(", ");
printflock64(tcp, tcp->u_arg[2], 0);
break;
#endif
#endif /* USE_PRINTFLOCK64 */
#ifdef F_NOTIFY
case F_NOTIFY:
tprints(", ");
@ -387,10 +221,8 @@ sys_fcntl(struct tcb *tcp)
tprints(", ");
printflock(tcp, tcp->u_arg[2], 1);
break;
#if _LFS64_LARGEFILE
#if defined(F_GETLK64) && F_GETLK64+0 != F_GETLK
#if USE_PRINTFLOCK64
case F_GETLK64:
#endif
tprints(", ");
printflock64(tcp, tcp->u_arg[2], 1);
break;
@ -433,6 +265,15 @@ sys_close(struct tcb *tcp)
return 0;
}
int
sys_dup(struct tcb *tcp)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
}
return RVAL_FD;
}
static int
do_dup2(struct tcb *tcp, int flags_arg)
{
@ -445,7 +286,7 @@ do_dup2(struct tcb *tcp, int flags_arg)
printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???");
}
}
return 0;
return RVAL_FD;
}
int
@ -472,32 +313,43 @@ static int
decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
{
int i, j;
unsigned nfds, fdsize;
fd_set *fds;
int nfds, fdsize;
fd_set *fds = NULL;
const char *sep;
long arg;
fdsize = args[0];
/* Kernel truncates arg[0] to int, we do the same. */
nfds = (int) args[0];
/* Kernel rejects negative nfds, so we don't parse it either. */
if (nfds < 0)
nfds = 0;
/* Beware of select(2^31-1, NULL, NULL, NULL) and similar... */
if (args[0] > 1024*1024)
fdsize = 1024*1024;
if (args[0] < 0)
fdsize = 0;
fdsize = (((fdsize + 7) / 8) + sizeof(long)-1) & -sizeof(long);
if (nfds > 1024*1024)
nfds = 1024*1024;
/*
* We had bugs a-la "while (j < args[0])" and "umoven(args[0])" below.
* Instead of args[0], use nfds for fd count, fdsize for array lengths.
*/
fdsize = (((nfds + 7) / 8) + current_wordsize-1) & -current_wordsize;
if (entering(tcp)) {
fds = malloc(fdsize);
if (!fds)
die_out_of_memory();
nfds = args[0];
tprintf("%d", nfds);
tprintf("%d", (int) args[0]);
if (verbose(tcp) && fdsize > 0) {
fds = malloc(fdsize);
if (!fds)
die_out_of_memory();
}
for (i = 0; i < 3; i++) {
arg = args[i+1];
if (arg == 0) {
tprints(", NULL");
continue;
}
if (!verbose(tcp)) {
if (!fds) {
tprintf(", %#lx", arg);
continue;
}
@ -506,12 +358,13 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
continue;
}
tprints(", [");
for (j = 0, sep = ""; j < nfds; j++) {
if (FD_ISSET(j, fds)) {
tprints(sep);
printfd(tcp, j);
sep = " ";
}
for (j = 0, sep = "";; j++) {
j = next_set_bit(fds, j, nfds);
if (j < 0)
break;
tprints(sep);
printfd(tcp, j);
sep = " ";
}
tprints("]");
}
@ -523,13 +376,13 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
static char outstr[1024];
char *outptr;
#define end_outstr (outstr + sizeof(outstr))
const char *sep;
int ready_fds;
if (syserror(tcp))
return 0;
nfds = tcp->u_rval;
if (nfds == 0) {
ready_fds = tcp->u_rval;
if (ready_fds == 0) {
tcp->auxstr = "Timeout";
return RVAL_STR;
}
@ -540,36 +393,36 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
outptr = outstr;
sep = "";
for (i = 0; i < 3; i++) {
for (i = 0; i < 3 && ready_fds > 0; i++) {
int first = 1;
arg = args[i+1];
if (!arg || umoven(tcp, arg, fdsize, (char *) fds) < 0)
continue;
for (j = 0; j < args[0]; j++) {
if (FD_ISSET(j, fds)) {
/* +2 chars needed at the end: ']',NUL */
if (outptr < end_outstr - (sizeof(", except [") + sizeof(int)*3 + 2)) {
if (first) {
outptr += sprintf(outptr, "%s%s [%u",
sep,
i == 0 ? "in" : i == 1 ? "out" : "except",
j
);
first = 0;
sep = ", ";
}
else {
outptr += sprintf(outptr, " %u", j);
}
for (j = 0;; j++) {
j = next_set_bit(fds, j, nfds);
if (j < 0)
break;
/* +2 chars needed at the end: ']',NUL */
if (outptr < end_outstr - (sizeof(", except [") + sizeof(int)*3 + 2)) {
if (first) {
outptr += sprintf(outptr, "%s%s [%u",
sep,
i == 0 ? "in" : i == 1 ? "out" : "except",
j
);
first = 0;
sep = ", ";
}
else {
outptr += sprintf(outptr, " %u", j);
}
nfds--;
}
if (--ready_fds == 0)
break;
}
if (outptr != outstr)
*outptr++ = ']';
if (nfds == 0)
break;
}
free(fds);
/* This contains no useful information on SunOS. */
@ -608,61 +461,9 @@ sys_osf_select(struct tcb *tcp)
}
#endif
static const struct xlat epollctls[] = {
#ifdef EPOLL_CTL_ADD
{ EPOLL_CTL_ADD, "EPOLL_CTL_ADD" },
#endif
#ifdef EPOLL_CTL_MOD
{ EPOLL_CTL_MOD, "EPOLL_CTL_MOD" },
#endif
#ifdef EPOLL_CTL_DEL
{ EPOLL_CTL_DEL, "EPOLL_CTL_DEL" },
#endif
{ 0, NULL }
};
static const struct xlat epollevents[] = {
#ifdef EPOLLIN
{ EPOLLIN, "EPOLLIN" },
#endif
#ifdef EPOLLPRI
{ EPOLLPRI, "EPOLLPRI" },
#endif
#ifdef EPOLLOUT
{ EPOLLOUT, "EPOLLOUT" },
#endif
#ifdef EPOLLRDNORM
{ EPOLLRDNORM, "EPOLLRDNORM" },
#endif
#ifdef EPOLLRDBAND
{ EPOLLRDBAND, "EPOLLRDBAND" },
#endif
#ifdef EPOLLWRNORM
{ EPOLLWRNORM, "EPOLLWRNORM" },
#endif
#ifdef EPOLLWRBAND
{ EPOLLWRBAND, "EPOLLWRBAND" },
#endif
#ifdef EPOLLMSG
{ EPOLLMSG, "EPOLLMSG" },
#endif
#ifdef EPOLLERR
{ EPOLLERR, "EPOLLERR" },
#endif
#ifdef EPOLLHUP
{ EPOLLHUP, "EPOLLHUP" },
#endif
#ifdef EPOLLRDHUP
{ EPOLLRDHUP, "EPOLLRDHUP" },
#endif
#ifdef EPOLLONESHOT
{ EPOLLONESHOT, "EPOLLONESHOT" },
#endif
#ifdef EPOLLET
{ EPOLLET, "EPOLLET" },
#endif
{ 0, NULL }
};
#include "xlat/epollctls.h"
#include "xlat/epollevents.h"
#include "xlat/epollflags.h"
/* Not aliased to printargs_ld: we want it to have a distinct address */
int
@ -671,16 +472,6 @@ sys_epoll_create(struct tcb *tcp)
return printargs_ld(tcp);
}
static const struct xlat epollflags[] = {
#ifdef EPOLL_CLOEXEC
{ EPOLL_CLOEXEC, "EPOLL_CLOEXEC" },
#endif
#ifdef EPOLL_NONBLOCK
{ EPOLL_NONBLOCK, "EPOLL_NONBLOCK" },
#endif
{ 0, NULL }
};
int
sys_epoll_create1(struct tcb *tcp)
{
@ -717,11 +508,15 @@ sys_epoll_ctl(struct tcb *tcp)
else {
#ifdef HAVE_SYS_EPOLL_H
struct epoll_event ev;
if (umove(tcp, tcp->u_arg[3], &ev) == 0)
if (
#ifdef EPOLL_CTL_DEL
(tcp->u_arg[1] != EPOLL_CTL_DEL) &&
#endif
umove(tcp, tcp->u_arg[3], &ev) == 0)
print_epoll_event(&ev);
else
#endif
tprints("{...}");
tprintf("%lx", tcp->u_arg[3]);
}
}
return 0;
@ -781,236 +576,9 @@ sys_epoll_pwait(struct tcb *tcp)
epoll_wait_common(tcp);
if (exiting(tcp)) {
tprints(", ");
print_sigset(tcp, tcp->u_arg[4], 0);
}
return 0;
}
int
sys_io_setup(struct tcb *tcp)
{
if (entering(tcp))
tprintf("%ld, ", tcp->u_arg[0]);
else {
if (syserror(tcp))
tprintf("0x%0lx", tcp->u_arg[1]);
else {
unsigned long user_id;
if (umove(tcp, tcp->u_arg[1], &user_id) == 0)
tprintf("{%lu}", user_id);
else
tprints("{...}");
}
}
return 0;
}
int
sys_io_destroy(struct tcb *tcp)
{
if (entering(tcp))
tprintf("%lu", tcp->u_arg[0]);
return 0;
}
#ifdef HAVE_LIBAIO_H
enum iocb_sub {
SUB_NONE, SUB_COMMON, SUB_POLL, SUB_VECTOR
};
static const char *
iocb_cmd_lookup(unsigned cmd, enum iocb_sub *sub)
{
static char buf[sizeof("%u /* SUB_??? */") + sizeof(int)*3];
static const struct {
const char *name;
enum iocb_sub sub;
} cmds[] = {
{ "pread", SUB_COMMON },
{ "pwrite", SUB_COMMON },
{ "fsync", SUB_NONE },
{ "fdsync", SUB_NONE },
{ "op4", SUB_NONE },
{ "poll", SUB_POLL },
{ "noop", SUB_NONE },
{ "preadv", SUB_VECTOR },
{ "pwritev", SUB_VECTOR },
};
if (cmd < ARRAY_SIZE(cmds)) {
*sub = cmds[cmd].sub;
return cmds[cmd].name;
}
*sub = SUB_NONE;
sprintf(buf, "%u /* SUB_??? */", cmd);
return buf;
}
/* Not defined in libaio.h */
#ifndef IOCB_RESFD
# define IOCB_RESFD (1 << 0)
#endif
static void
print_common_flags(struct iocb *iocb)
{
if (iocb->u.c.flags & IOCB_RESFD)
tprintf("resfd=%d, ", iocb->u.c.resfd);
if (iocb->u.c.flags & ~IOCB_RESFD)
tprintf("flags=%x, ", iocb->u.c.flags);
}
#endif /* HAVE_LIBAIO_H */
int
sys_io_submit(struct tcb *tcp)
{
long nr;
if (entering(tcp)) {
tprintf("%lu, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
nr = tcp->u_arg[1];
/* and if nr is negative? */
if (nr == 0)
tprints("{}");
else {
#ifdef HAVE_LIBAIO_H
long i;
struct iocb *iocbp, **iocbs = (void *)tcp->u_arg[2];
for (i = 0; i < nr; i++, iocbs++) {
enum iocb_sub sub;
struct iocb iocb;
if (i == 0)
tprints("{");
else
tprints(", ");
if (umove(tcp, (unsigned long)iocbs, &iocbp) ||
umove(tcp, (unsigned long)iocbp, &iocb)) {
tprints("{...}");
continue;
}
tprints("{");
if (iocb.data)
tprintf("data:%p, ", iocb.data);
if (iocb.key)
tprintf("key:%u, ", iocb.key);
tprintf("%s, ", iocb_cmd_lookup(iocb.aio_lio_opcode, &sub));
if (iocb.aio_reqprio)
tprintf("reqprio:%d, ", iocb.aio_reqprio);
tprintf("filedes:%d", iocb.aio_fildes);
switch (sub) {
case SUB_COMMON:
if (iocb.aio_lio_opcode == IO_CMD_PWRITE) {
tprints(", str:");
printstr(tcp, (unsigned long)iocb.u.c.buf,
iocb.u.c.nbytes);
} else {
tprintf(", buf:%p", iocb.u.c.buf);
}
tprintf(", nbytes:%lu, offset:%llx",
iocb.u.c.nbytes,
iocb.u.c.offset);
print_common_flags(&iocb);
break;
case SUB_VECTOR:
tprintf(", %llx, ", iocb.u.v.offset);
print_common_flags(&iocb);
tprint_iov(tcp, iocb.u.v.nr,
(unsigned long)iocb.u.v.vec,
iocb.aio_lio_opcode == IO_CMD_PWRITEV);
break;
case SUB_POLL:
tprintf(", %x", iocb.u.poll.events);
break;
case SUB_NONE:
break;
}
tprints("}");
}
if (i)
tprints("}");
#else
#warning "libaio-devel is not available => no io_submit decoding"
tprintf("%#lx", tcp->u_arg[2]);
#endif
}
}
return 0;
}
int
sys_io_cancel(struct tcb *tcp)
{
if (entering(tcp)) {
#ifdef HAVE_LIBAIO_H
struct iocb iocb;
#endif
tprintf("%lu, ", tcp->u_arg[0]);
#ifdef HAVE_LIBAIO_H
if (umove(tcp, tcp->u_arg[1], &iocb) == 0) {
tprintf("{%p, %u, %u, %u, %d}, ",
iocb.data, iocb.key,
(unsigned)iocb.aio_lio_opcode,
(unsigned)iocb.aio_reqprio, iocb.aio_fildes);
} else
#endif
tprints("{...}, ");
} else {
if (tcp->u_rval < 0)
tprints("{...}");
else {
#ifdef HAVE_LIBAIO_H
struct io_event event;
if (umove(tcp, tcp->u_arg[2], &event) == 0)
tprintf("{%p, %p, %ld, %ld}",
event.data, event.obj,
event.res, event.res2);
else
#endif
tprints("{...}");
}
}
return 0;
}
int
sys_io_getevents(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%ld, %ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1],
tcp->u_arg[2]);
} else {
if (tcp->u_rval == 0) {
tprints("{}");
} else {
#ifdef HAVE_LIBAIO_H
struct io_event *events = (void *)tcp->u_arg[3];
long i, nr = tcp->u_rval;
for (i = 0; i < nr; i++, events++) {
struct io_event event;
if (i == 0)
tprints("{");
else
tprints(", ");
if (umove(tcp, (unsigned long)events, &event) != 0) {
tprints("{...}");
continue;
}
tprintf("{%p, %p, %ld, %ld}", event.data,
event.obj, event.res, event.res2);
}
tprints("}, ");
#else
tprints("{...}");
#endif
}
print_timespec(tcp, tcp->u_arg[4]);
/* NB: kernel requires arg[5] == NSIG / 8 */
print_sigset_addr_len(tcp, tcp->u_arg[4], tcp->u_arg[5]);
tprintf(", %lu", tcp->u_arg[5]);
}
return 0;
}
@ -1026,18 +594,29 @@ sys_pselect6(struct tcb *tcp)
{
int rc = decode_select(tcp, tcp->u_arg, BITNESS_CURRENT);
if (entering(tcp)) {
long r;
struct {
void *ss;
unsigned long ptr;
unsigned long len;
} data;
if (umove(tcp, tcp->u_arg[5], &data) < 0)
#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
if (current_wordsize == 4) {
struct {
uint32_t ptr;
uint32_t len;
} data32;
r = umove(tcp, tcp->u_arg[5], &data32);
data.ptr = data32.ptr;
data.len = data32.len;
} else
#endif
r = umove(tcp, tcp->u_arg[5], &data);
if (r < 0)
tprintf(", %#lx", tcp->u_arg[5]);
else {
tprints(", {");
if (data.len < sizeof(long))
tprintf("%#lx", (long)data.ss);
else
print_sigset(tcp, (long)data.ss, 0);
/* NB: kernel requires data.len == NSIG / 8 */
print_sigset_addr_len(tcp, data.ptr, data.len);
tprintf(", %lu}", data.len);
}
}
@ -1068,3 +647,18 @@ sys_eventfd2(struct tcb *tcp)
{
return do_eventfd(tcp, 1);
}
int
sys_perf_event_open(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%#lx, %d, %d, %d, ",
tcp->u_arg[0],
(int) tcp->u_arg[1],
(int) tcp->u_arg[2],
(int) tcp->u_arg[3]);
printflags(perf_event_open_flags, tcp->u_arg[4],
"PERF_FLAG_???");
}
return 0;
}

227
dirent.c Normal file
View File

@ -0,0 +1,227 @@
#include "defs.h"
#include <dirent.h>
#define D_NAME_LEN_MAX 256
struct kernel_dirent {
unsigned long d_ino;
unsigned long d_off;
unsigned short d_reclen;
char d_name[1];
};
static void
print_old_dirent(struct tcb *tcp, long addr)
{
#ifdef SH64
typedef struct kernel_dirent old_dirent_t;
#else
typedef struct {
uint32_t d_ino;
uint32_t d_off;
unsigned short d_reclen;
char d_name[1];
} old_dirent_t;
#endif
old_dirent_t d;
if (!verbose(tcp) || umove(tcp, addr, &d) < 0) {
tprintf("%#lx", addr);
return;
}
tprintf("{d_ino=%lu, d_off=%lu, d_reclen=%u, d_name=",
(unsigned long) d.d_ino, (unsigned long) d.d_off, d.d_reclen);
if (d.d_reclen > D_NAME_LEN_MAX)
d.d_reclen = D_NAME_LEN_MAX;
printpathn(tcp, addr + offsetof(old_dirent_t, d_name), d.d_reclen);
tprints("}");
}
int
sys_readdir(struct tcb *tcp)
{
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
tprintf("%#lx", tcp->u_arg[1]);
else
print_old_dirent(tcp, tcp->u_arg[1]);
/* Not much point in printing this out, it is always 1. */
if (tcp->u_arg[2] != 1)
tprintf(", %lu", tcp->u_arg[2]);
}
return 0;
}
#include "xlat/direnttypes.h"
int
sys_getdents(struct tcb *tcp)
{
unsigned int i, len, dents = 0;
char *buf;
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
return 0;
}
if (syserror(tcp) || !verbose(tcp)) {
tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
return 0;
}
/* Beware of insanely large or too small values in tcp->u_rval */
if (tcp->u_rval > 1024*1024)
len = 1024*1024;
else if (tcp->u_rval < (int) sizeof(struct kernel_dirent))
len = 0;
else
len = tcp->u_rval;
if (len) {
buf = malloc(len);
if (!buf)
die_out_of_memory();
if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
free(buf);
return 0;
}
} else {
buf = NULL;
}
if (!abbrev(tcp))
tprints("{");
for (i = 0; len && i <= len - sizeof(struct kernel_dirent); ) {
struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
if (!abbrev(tcp)) {
int oob = d->d_reclen < sizeof(struct kernel_dirent) ||
i + d->d_reclen - 1 >= len;
int d_name_len = oob ? len - i : d->d_reclen;
d_name_len -= offsetof(struct kernel_dirent, d_name) + 1;
if (d_name_len > D_NAME_LEN_MAX)
d_name_len = D_NAME_LEN_MAX;
tprintf("%s{d_ino=%lu, d_off=%lu, d_reclen=%u, d_name=",
i ? " " : "", d->d_ino, d->d_off, d->d_reclen);
if (print_quoted_string(d->d_name, d_name_len,
QUOTE_0_TERMINATED) > 0) {
tprints("...");
}
tprints(", d_type=");
if (oob)
tprints("?");
else
printxval(direnttypes, buf[i + d->d_reclen - 1], "DT_???");
tprints("}");
}
dents++;
if (d->d_reclen < sizeof(struct kernel_dirent)) {
tprints("/* d_reclen < sizeof(struct kernel_dirent) */");
break;
}
i += d->d_reclen;
}
if (!abbrev(tcp))
tprints("}");
else
tprintf("/* %u entries */", dents);
tprintf(", %lu", tcp->u_arg[2]);
free(buf);
return 0;
}
int
sys_getdents64(struct tcb *tcp)
{
/* the minimum size of a valid dirent64 structure */
const unsigned int d_name_offset = offsetof(struct dirent64, d_name);
unsigned int i, len, dents = 0;
char *buf;
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
return 0;
}
if (syserror(tcp) || !verbose(tcp)) {
tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
return 0;
}
/* Beware of insanely large or too small tcp->u_rval */
if (tcp->u_rval > 1024*1024)
len = 1024*1024;
else if (tcp->u_rval < (int) d_name_offset)
len = 0;
else
len = tcp->u_rval;
if (len) {
buf = malloc(len);
if (!buf)
die_out_of_memory();
if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
free(buf);
return 0;
}
} else {
buf = NULL;
}
if (!abbrev(tcp))
tprints("{");
for (i = 0; len && i <= len - d_name_offset; ) {
struct dirent64 *d = (struct dirent64 *) &buf[i];
if (!abbrev(tcp)) {
int d_name_len;
if (d->d_reclen >= d_name_offset
&& i + d->d_reclen <= len) {
d_name_len = d->d_reclen - d_name_offset;
} else {
d_name_len = len - i - d_name_offset;
}
if (d_name_len > D_NAME_LEN_MAX)
d_name_len = D_NAME_LEN_MAX;
tprintf("%s{d_ino=%" PRIu64 ", d_off=%" PRId64
", d_reclen=%u, d_type=",
i ? " " : "",
d->d_ino,
d->d_off,
d->d_reclen);
printxval(direnttypes, d->d_type, "DT_???");
tprints(", d_name=");
if (print_quoted_string(d->d_name, d_name_len,
QUOTE_0_TERMINATED) > 0) {
tprints("...");
}
tprints("}");
}
if (d->d_reclen < d_name_offset) {
tprints("/* d_reclen < offsetof(struct dirent64, d_name) */");
break;
}
i += d->d_reclen;
dents++;
}
if (!abbrev(tcp))
tprints("}");
else
tprintf("/* %u entries */", dents);
tprintf(", %lu", tcp->u_arg[2]);
free(buf);
return 0;
}

View File

@ -25,16 +25,14 @@
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
awk '
/^#define[ ]+E[A-Z0-9_]+[ ]+[0-9]+/ {
$1 == "#define" && $2 ~ /^E[A-Z0-9_]+$/ && $3 ~ /^[0-9]+$/ {
errno[$3] = $2
if ($3 > max)
max = $3
}
END {
for (i = 0; i <= max; i++) {
if (!errno[i])
errno[i] = "ERRNO_" i
printf "\t\"%s\", /* %d */\n", errno[i], i
}
for (i = 0; i <= max; i++)
if (errno[i])
printf("[%3d] = \"%s\",\n", i, errno[i])
}
' $*
' "$@"

480
evdev.c Normal file
View File

@ -0,0 +1,480 @@
/*
* Copyright (c) 2015 Etienne Gemsa <etienne.gemsa@lse.epita.fr>
* Copyright (c) 2015 Dmitry V. Levin <ldv@altlinux.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "defs.h"
#ifdef HAVE_LINUX_INPUT_H
#include <linux/input.h>
#include "xlat/evdev_abs.h"
#include "xlat/evdev_autorepeat.h"
#include "xlat/evdev_ff_status.h"
#include "xlat/evdev_ff_types.h"
#include "xlat/evdev_keycode.h"
#include "xlat/evdev_leds.h"
#include "xlat/evdev_misc.h"
#include "xlat/evdev_mtslots.h"
#include "xlat/evdev_prop.h"
#include "xlat/evdev_relative_axes.h"
#include "xlat/evdev_snd.h"
#include "xlat/evdev_switch.h"
#include "xlat/evdev_sync.h"
#ifndef SYN_MAX
# define SYN_MAX 0xf
#endif
static void
decode_envelope(struct ff_envelope *envelope)
{
tprintf(", envelope={attack_length=%" PRIu16 ", attack_level=%" PRIu16
", fade_length=%" PRIu16 ", fade_level=%" PRIx32 "}",
envelope->attack_length,
envelope->attack_level,
envelope->fade_length,
envelope->fade_level);
}
static int
ff_effect_ioctl(struct tcb *tcp, long arg)
{
struct ff_effect ffe;
if (!verbose(tcp) || umove(tcp, arg, &ffe) < 0)
return 0;
tprints(", {type=");
printxval(evdev_ff_types, ffe.type, "FF_???");
tprintf(", id=%" PRIu16 ", direction=%" PRIu16,
ffe.id, ffe.direction);
if (!abbrev(tcp)) {
tprintf(", trigger={button=%" PRIu16 ", interval=%" PRIu16 "}",
ffe.trigger.button, ffe.trigger.interval);
tprintf(", replay={lenght=%" PRIu16 ", delay=%" PRIu16 "}",
ffe.replay.length, ffe.replay.delay);
switch (ffe.type) {
case FF_CONSTANT:
tprintf(", constant_ef={%" PRIi16,
ffe.u.constant.level);
decode_envelope(&ffe.u.constant.envelope);
tprints("}");
return 1;
case FF_RAMP:
tprintf(", ramp={start_level=%" PRIi16
", end_level=%" PRIi16,
ffe.u.ramp.start_level,
ffe.u.ramp.end_level);
decode_envelope(&ffe.u.ramp.envelope);
tprints("}");
return 1;
case FF_PERIODIC:
tprintf(", periodic_ef={waveform=%" PRIu16
", period=%" PRIu16
", magnitude=%" PRIi16
", offset=%" PRIi16
", phase=%" PRIu16,
ffe.u.periodic.waveform,
ffe.u.periodic.period,
ffe.u.periodic.magnitude,
ffe.u.periodic.offset,
ffe.u.periodic.phase);
decode_envelope(&ffe.u.periodic.envelope);
tprintf(", custom_len=%" PRIu32
", *custom_data=%#lx}",
ffe.u.periodic.custom_len,
(unsigned long)ffe.u.periodic.custom_data);
return 1;
case FF_RUMBLE:
tprintf(", rumble={strong_magnitude=%" PRIu16
", weak_magnitude=%" PRIu16 "}",
ffe.u.rumble.strong_magnitude,
ffe.u.rumble.weak_magnitude);
return 1;
case FF_SPRING:
case FF_FRICTION:
case FF_DAMPER:
case FF_INERTIA:
case FF_CUSTOM:
break;
default :
break;
}
}
tprints(", ...}");
return 1;
}
static int
abs_ioctl(struct tcb *tcp, long arg)
{
struct input_absinfo absinfo;
if (!verbose(tcp) || umove(tcp, arg, &absinfo) < 0)
return 0;
tprintf(", {value=%" PRIu32 ", minimum=%" PRIu32,
absinfo.value, absinfo.minimum);
if (!abbrev(tcp)) {
tprintf(", maximum=%" PRIu32 ", fuzz=%" PRIu32,
absinfo.maximum, absinfo.fuzz);
tprintf(", flat=%" PRIu32, absinfo.flat);
#ifdef HAVE_STRUCT_INPUT_ABSINFO_RESOLUTION
tprintf(", resolution=%" PRIu32, absinfo.resolution);
#endif
tprints("}");
} else {
tprints(", ...}");
}
return 1;
}
static int
keycode_ioctl(struct tcb *tcp, long arg)
{
unsigned int keycode[2];
if (!arg) {
tprints(", NULL");
return 1;
}
if (!verbose(tcp) || umove(tcp, arg, &keycode) < 0)
return 0;
tprintf(", [%u, ", keycode[0]);
printxval(evdev_keycode, keycode[1], "KEY_???");
tprints("]");
return 1;
}
#ifdef EVIOCGKEYCODE_V2
static int
keycode_V2_ioctl(struct tcb *tcp, long arg)
{
struct input_keymap_entry ike;
if (!arg) {
tprints(", NULL");
return 1;
}
if (!verbose(tcp) || umove(tcp, arg, &ike) < 0)
return 0;
tprintf(", {flags=%" PRIu8 ", len=%" PRIu8, ike.flags, ike.len);
if (!abbrev(tcp)) {
unsigned int i;
tprintf(", index=%" PRIu16 ", keycode=", ike.index);
printxval(evdev_keycode, ike.keycode, "KEY_???");
tprints(", scancode=[");
for (i = 0; i < ARRAY_SIZE(ike.scancode); i++) {
if (i > 0)
tprints(", ");
tprintf("%" PRIx8, ike.scancode[i]);
}
tprints("]}");
} else {
tprints(", ...}");
}
return 1;
}
#endif /* EVIOCGKEYCODE_V2 */
static int
getid_ioctl(struct tcb *tcp, long arg)
{
struct input_id id;
if (!verbose(tcp) || umove(tcp, arg, &id) < 0)
return 0;
tprintf(", {ID_BUS=%" PRIu16 ", ID_VENDOR=%" PRIu16,
id.bustype, id.vendor);
if (!abbrev(tcp)) {
tprintf(", ID_PRODUCT=%" PRIu16 ", ID_VERSION=%" PRIu16 "}",
id.product, id.version);
} else {
tprints(", ...}");
}
return 1;
}
static int
decode_bitset(struct tcb *tcp, long arg, const struct xlat decode_nr[],
const unsigned int max_nr, const char *dflt)
{
if (!verbose(tcp))
return 0;
unsigned int size;
if ((unsigned long) tcp->u_rval > max_nr)
size = max_nr;
else
size = tcp->u_rval;
char decoded_arg[size];
if (umoven(tcp, arg, size, decoded_arg) < 0)
return 0;
tprints(", [");
int bit_displayed = 0;
int i = next_set_bit(decoded_arg, 0, size);
if (i < 0) {
tprints(" 0 ");
} else {
printxval(decode_nr, i, dflt);
while ((i = next_set_bit(decoded_arg, i + 1, size)) > 0) {
if (abbrev(tcp) && bit_displayed >= 3) {
tprints(", ...");
break;
}
tprints(", ");
printxval(decode_nr, i, dflt);
bit_displayed++;
}
}
tprints("]");
return 1;
}
#ifdef EVIOCGMTSLOTS
static int
mtslots_ioctl(struct tcb *tcp, const unsigned int code, long arg)
{
const size_t size = _IOC_SIZE(code) / sizeof(int32_t);
if (!size)
return 0;
int32_t buffer[size];
if (!verbose(tcp) || umove(tcp, arg, &buffer) < 0)
return 0;
tprints(", {code=");
printxval(evdev_mtslots, buffer[0], "ABS_MT_???");
unsigned int i;
tprints(", values=[");
for (i = 1; i < ARRAY_SIZE(buffer); i++)
tprintf("%s%d", i > 1 ? ", " : "", buffer[i]);
tprints("]}");
return 1;
}
#endif /* EVIOCGMTSLOTS */
#ifdef EVIOCGREP
static int
repeat_ioctl(struct tcb *tcp, long arg)
{
unsigned int val[2];
if (!verbose(tcp) || umove(tcp, arg, &val) < 0)
return 0;
tprintf(", [%" PRIu32 " %" PRIu32 "]", val[0], val[1]);
return 1;
}
#endif /* EVIOCGREP */
static int
evdev_read_ioctl(struct tcb *tcp, const unsigned int code, long arg)
{
if (entering(tcp))
return 1;
if (syserror(tcp))
return 0;
if ((_IOC_NR(code) & ~EV_MAX) == _IOC_NR(EVIOCGBIT(0, 0))) {
switch (_IOC_NR(code) - 0x20) {
case EV_SYN:
return decode_bitset(tcp, arg, evdev_sync,
SYN_MAX, "SYN_???");
case EV_KEY:
return decode_bitset(tcp, arg, evdev_keycode,
KEY_MAX, "KEY_???");
case EV_REL:
return decode_bitset(tcp, arg, evdev_relative_axes,
REL_MAX, "REL_???");
case EV_ABS:
return decode_bitset(tcp, arg,
evdev_abs, ABS_MAX, "ABS_???");
case EV_MSC:
return decode_bitset(tcp, arg,
evdev_misc, MSC_MAX, "MSC_???");
#ifdef EV_SW
case EV_SW:
return decode_bitset(tcp, arg,
evdev_switch, SW_MAX, "SW_???");
#endif
case EV_LED:
return decode_bitset(tcp, arg,
evdev_leds, LED_MAX, "LED_???");
case EV_SND:
return decode_bitset(tcp, arg,
evdev_snd, SND_MAX, "SND_???");
case EV_REP:
return decode_bitset(tcp, arg, evdev_autorepeat,
REP_MAX, "REP_???");
case EV_FF:
return decode_bitset(tcp, arg, evdev_ff_types,
FF_MAX, "FF_???");
case EV_PWR:
printnum_int(tcp, arg, "%d");
return 1;
case EV_FF_STATUS:
return decode_bitset(tcp, arg, evdev_ff_status,
FF_STATUS_MAX, "FF_STATUS_???");
default:
return 0;
}
}
if ((_IOC_NR(code) & ~ABS_MAX) == _IOC_NR(EVIOCGABS(0)))
return abs_ioctl(tcp, arg);
switch (code) {
case EVIOCGVERSION:
tprints(", ");
printnum_int(tcp, arg, "%" PRIx32);
return 1;
case EVIOCGEFFECTS:
tprints(", ");
printnum_int(tcp, arg, "%" PRIu32);
return 1;
case EVIOCGID:
return getid_ioctl(tcp, arg);
#ifdef EVIOCGREP
case EVIOCGREP:
return repeat_ioctl(tcp, arg);;
#endif
case EVIOCGKEYCODE:
return keycode_ioctl(tcp, arg);
#ifdef EVIOCGKEYCODE_V2
case EVIOCGKEYCODE_V2:
return keycode_V2_ioctl(tcp, arg);
#endif
}
switch (_IOC_NR(code)) {
#ifdef EVIOCGMTSLOTS
case _IOC_NR(EVIOCGMTSLOTS(0)):
return mtslots_ioctl(tcp, code, arg);
#endif
case _IOC_NR(EVIOCGNAME(0)):
case _IOC_NR(EVIOCGPHYS(0)):
case _IOC_NR(EVIOCGUNIQ(0)):
tprints(", ");
printstr(tcp, arg, tcp->u_rval - 1);
return 1;
#ifdef EVIOCGPROP
case _IOC_NR(EVIOCGPROP(0)):
return decode_bitset(tcp, arg,
evdev_prop, INPUT_PROP_MAX, "PROP_???");
#endif
case _IOC_NR(EVIOCGSND(0)):
return decode_bitset(tcp, arg,
evdev_snd, SND_MAX, "SND_???");
#ifdef EVIOCGSW
case _IOC_NR(EVIOCGSW(0)):
return decode_bitset(tcp, arg,
evdev_switch, SW_MAX, "SW_???");
#endif
case _IOC_NR(EVIOCGKEY(0)):
return decode_bitset(tcp, arg,
evdev_keycode, KEY_MAX, "KEY_???");
case _IOC_NR(EVIOCGLED(0)):
return decode_bitset(tcp, arg,
evdev_leds, LED_MAX, "LED_???");
default:
return 0;
}
}
static int
evdev_write_ioctl(struct tcb *tcp, const unsigned int code, long arg)
{
if (exiting(tcp))
return 1;
if ((_IOC_NR(code) & ~ABS_MAX) == _IOC_NR(EVIOCSABS(0)))
return abs_ioctl(tcp, arg);
switch (code) {
#ifdef EVIOCSREP
case EVIOCSREP:
return repeat_ioctl(tcp, arg);
#endif
case EVIOCSKEYCODE:
return keycode_ioctl(tcp, arg);
#ifdef EVIOCSKEYCODE_V2
case EVIOCSKEYCODE_V2:
return keycode_V2_ioctl(tcp, arg);
#endif
case EVIOCSFF:
return ff_effect_ioctl(tcp, arg);
case EVIOCRMFF:
#ifdef EVIOCSCLOCKID
case EVIOCSCLOCKID:
#endif
case EVIOCGRAB:
#ifdef EVIOCREVOKE
case EVIOCREVOKE:
#endif
tprints(", ");
printnum_int(tcp, arg, "%u");
return 1;
default:
return 0;
}
}
int
evdev_ioctl(struct tcb *tcp, const unsigned int code, long arg)
{
switch(_IOC_DIR(code)) {
case _IOC_READ:
return evdev_read_ioctl(tcp, code, arg);
case _IOC_WRITE:
if (!evdev_write_ioctl(tcp, code, arg))
tprintf(", %lx", arg);
return 1;
default:
return 0;
}
}
#endif /* HAVE_LINUX_INPUT_H */

86
execve.c Normal file
View File

@ -0,0 +1,86 @@
#include "defs.h"
static void
printargv(struct tcb *tcp, long addr)
{
union {
unsigned int p32;
unsigned long p64;
char data[sizeof(long)];
} cp;
const char *sep;
unsigned int n = 0;
unsigned wordsize = current_wordsize;
cp.p64 = 1;
for (sep = ""; !abbrev(tcp) || n < max_strlen / 2; sep = ", ", ++n) {
if (umoven(tcp, addr, wordsize, cp.data) < 0) {
tprintf("%#lx", addr);
return;
}
if (wordsize == 4)
cp.p64 = cp.p32;
if (cp.p64 == 0)
break;
tprints(sep);
printstr(tcp, cp.p64, -1);
addr += wordsize;
}
if (cp.p64)
tprintf("%s...", sep);
}
static void
printargc(const char *fmt, struct tcb *tcp, long addr)
{
int count;
char *cp;
for (count = 0; umove(tcp, addr, &cp) >= 0 && cp != NULL; count++) {
addr += sizeof(char *);
}
tprintf(fmt, count, count == 1 ? "" : "s");
}
int
sys_execve(struct tcb *tcp)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
if (!verbose(tcp))
tprintf(", %#lx", tcp->u_arg[1]);
else {
tprints(", [");
printargv(tcp, tcp->u_arg[1]);
tprints("]");
}
if (!verbose(tcp))
tprintf(", %#lx", tcp->u_arg[2]);
else if (abbrev(tcp))
printargc(", [/* %d var%s */]", tcp, tcp->u_arg[2]);
else {
tprints(", [");
printargv(tcp, tcp->u_arg[2]);
tprints("]");
}
}
return 0;
}
#if defined(SPARC) || defined(SPARC64)
int
sys_execv(struct tcb *tcp)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
if (!verbose(tcp))
tprintf(", %#lx", tcp->u_arg[1]);
else {
tprints(", [");
printargv(tcp, tcp->u_arg[1]);
tprints("]");
}
}
return 0;
}
#endif /* SPARC || SPARC64 */

16
exit.c Normal file
View File

@ -0,0 +1,16 @@
#include "defs.h"
int
sys_exit(struct tcb *tcp)
{
if (exiting(tcp)) {
fprintf(stderr, "_exit returned!\n");
return -1;
}
/* special case: we stop tracing this process, finish line now */
tprintf("%ld) ", tcp->u_arg[0]);
tabto();
tprints("= ?\n");
line_ended();
return 0;
}

35
fadvise.c Normal file
View File

@ -0,0 +1,35 @@
#include "defs.h"
#include <fcntl.h>
#include "xlat/advise.h"
int
sys_fadvise64(struct tcb *tcp)
{
if (entering(tcp)) {
int argn;
printfd(tcp, tcp->u_arg[0]);
argn = printllval(tcp, ", %lld", 1);
tprintf(", %ld, ", tcp->u_arg[argn++]);
printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
}
return 0;
}
int
sys_fadvise64_64(struct tcb *tcp)
{
if (entering(tcp)) {
int argn;
printfd(tcp, tcp->u_arg[0]);
argn = printllval(tcp, ", %lld, ", 1);
argn = printllval(tcp, "%lld, ", argn);
#if defined __ARM_EABI__ || defined AARCH64 || defined POWERPC || defined XTENSA
printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
#else
printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
#endif
}
return 0;
}

30
fallocate.c Normal file
View File

@ -0,0 +1,30 @@
#include "defs.h"
#ifdef HAVE_LINUX_FALLOC_H
# include <linux/falloc.h>
#endif
#include "xlat/falloc_flags.h"
int
sys_fallocate(struct tcb *tcp)
{
if (entering(tcp)) {
int argn;
/* fd */
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* mode */
printflags(falloc_flags, tcp->u_arg[1], "FALLOC_FL_???");
tprints(", ");
/* offset */
argn = printllval(tcp, "%llu, ", 2);
/* len */
printllval(tcp, "%llu", argn);
}
return 0;
}

68
fanotify.c Normal file
View File

@ -0,0 +1,68 @@
#include "defs.h"
#include "xlat/fan_classes.h"
#include "xlat/fan_init_flags.h"
#ifndef FAN_ALL_CLASS_BITS
# define FAN_ALL_CLASS_BITS (FAN_CLASS_NOTIF | FAN_CLASS_CONTENT | FAN_CLASS_PRE_CONTENT)
#endif
#ifndef FAN_NOFD
# define FAN_NOFD -1
#endif
int
sys_fanotify_init(struct tcb *tcp)
{
unsigned flags;
if (exiting(tcp))
return 0;
flags = tcp->u_arg[0];
printxval(fan_classes, flags & FAN_ALL_CLASS_BITS, "FAN_CLASS_???");
flags &= ~FAN_ALL_CLASS_BITS;
if (flags) {
tprints("|");
printflags(fan_init_flags, flags, "FAN_???");
}
tprints(", ");
tprint_open_modes((unsigned) tcp->u_arg[1]);
return 0;
}
#include "xlat/fan_mark_flags.h"
#include "xlat/fan_event_flags.h"
int
sys_fanotify_mark(struct tcb *tcp)
{
unsigned long long mask = 0;
int argn;
if (exiting(tcp))
return 0;
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printflags(fan_mark_flags, (unsigned) tcp->u_arg[1], "FAN_MARK_???");
tprints(", ");
/*
* the mask argument is defined as 64-bit,
* but kernel uses the lower 32 bits only.
*/
argn = getllval(tcp, &mask, 2);
#ifdef HPPA
/* Parsic is weird. See arch/parisc/kernel/sys_parisc32.c. */
mask = (mask << 32) | (mask >> 32);
#endif
printflags(fan_event_flags, mask, "FAN_???");
tprints(", ");
if ((int) tcp->u_arg[argn] == FAN_NOFD)
tprints("FAN_NOFD, ");
else
print_dirfd(tcp, tcp->u_arg[argn]);
printpath(tcp, tcp->u_arg[argn + 1]);
return 0;
}

15
fchownat.c Normal file
View File

@ -0,0 +1,15 @@
#include "defs.h"
int
sys_fchownat(struct tcb *tcp)
{
if (entering(tcp)) {
print_dirfd(tcp, tcp->u_arg[0]);
printpath(tcp, tcp->u_arg[1]);
printuid(", ", tcp->u_arg[2]);
printuid(", ", tcp->u_arg[3]);
tprints(", ");
printflags(at_flags, tcp->u_arg[4], "AT_???");
}
return 0;
}

2894
file.c

File diff suppressed because it is too large Load Diff

139
futex.c Normal file
View File

@ -0,0 +1,139 @@
#include "defs.h"
#ifdef HAVE_LINUX_FUTEX_H
# include <linux/futex.h>
#endif
#ifndef FUTEX_WAIT
# define FUTEX_WAIT 0
#endif
#ifndef FUTEX_WAKE
# define FUTEX_WAKE 1
#endif
#ifndef FUTEX_FD
# define FUTEX_FD 2
#endif
#ifndef FUTEX_REQUEUE
# define FUTEX_REQUEUE 3
#endif
#ifndef FUTEX_CMP_REQUEUE
# define FUTEX_CMP_REQUEUE 4
#endif
#ifndef FUTEX_WAKE_OP
# define FUTEX_WAKE_OP 5
#endif
#ifndef FUTEX_LOCK_PI
# define FUTEX_LOCK_PI 6
# define FUTEX_UNLOCK_PI 7
# define FUTEX_TRYLOCK_PI 8
#endif
#ifndef FUTEX_WAIT_BITSET
# define FUTEX_WAIT_BITSET 9
#endif
#ifndef FUTEX_WAKE_BITSET
# define FUTEX_WAKE_BITSET 10
#endif
#ifndef FUTEX_WAIT_REQUEUE_PI
# define FUTEX_WAIT_REQUEUE_PI 11
#endif
#ifndef FUTEX_CMP_REQUEUE_PI
# define FUTEX_CMP_REQUEUE_PI 12
#endif
#ifndef FUTEX_PRIVATE_FLAG
# define FUTEX_PRIVATE_FLAG 128
#endif
#ifndef FUTEX_CLOCK_REALTIME
# define FUTEX_CLOCK_REALTIME 256
#endif
#ifndef FUTEX_WAIT_PRIVATE
# define FUTEX_WAIT_PRIVATE (FUTEX_WAIT | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_WAKE_PRIVATE
# define FUTEX_WAKE_PRIVATE (FUTEX_WAKE | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_REQUEUE_PRIVATE
# define FUTEX_REQUEUE_PRIVATE (FUTEX_REQUEUE | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_CMP_REQUEUE_PRIVATE
# define FUTEX_CMP_REQUEUE_PRIVATE (FUTEX_CMP_REQUEUE | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_WAKE_OP_PRIVATE
# define FUTEX_WAKE_OP_PRIVATE (FUTEX_WAKE_OP | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_LOCK_PI_PRIVATE
# define FUTEX_LOCK_PI_PRIVATE (FUTEX_LOCK_PI | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_UNLOCK_PI_PRIVATE
# define FUTEX_UNLOCK_PI_PRIVATE (FUTEX_UNLOCK_PI | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_TRYLOCK_PI_PRIVATE
# define FUTEX_TRYLOCK_PI_PRIVATE (FUTEX_TRYLOCK_PI | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_WAIT_BITSET_PRIVATE
# define FUTEX_WAIT_BITSET_PRIVATE (FUTEX_WAIT_BITSET | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_WAKE_BITSET_PRIVATE
# define FUTEX_WAKE_BITSET_PRIVATE (FUTEX_WAKE_BITSET | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_WAIT_REQUEUE_PI_PRIVATE
# define FUTEX_WAIT_REQUEUE_PI_PRIVATE (FUTEX_WAIT_REQUEUE_PI | FUTEX_PRIVATE_FLAG)
#endif
#ifndef FUTEX_CMP_REQUEUE_PI_PRIVATE
# define FUTEX_CMP_REQUEUE_PI_PRIVATE (FUTEX_CMP_REQUEUE_PI | FUTEX_PRIVATE_FLAG)
#endif
#include "xlat/futexops.h"
#ifndef FUTEX_OP_SET
# define FUTEX_OP_SET 0
# define FUTEX_OP_ADD 1
# define FUTEX_OP_OR 2
# define FUTEX_OP_ANDN 3
# define FUTEX_OP_XOR 4
# define FUTEX_OP_CMP_EQ 0
# define FUTEX_OP_CMP_NE 1
# define FUTEX_OP_CMP_LT 2
# define FUTEX_OP_CMP_LE 3
# define FUTEX_OP_CMP_GT 4
# define FUTEX_OP_CMP_GE 5
#endif
#include "xlat/futexwakeops.h"
#include "xlat/futexwakecmps.h"
int
sys_futex(struct tcb *tcp)
{
if (entering(tcp)) {
long int cmd = tcp->u_arg[1] & 127;
tprintf("%p, ", (void *) tcp->u_arg[0]);
printxval(futexops, tcp->u_arg[1], "FUTEX_???");
tprintf(", %ld", tcp->u_arg[2]);
if (cmd == FUTEX_WAKE_BITSET)
tprintf(", %lx", tcp->u_arg[5]);
else if (cmd == FUTEX_WAIT) {
tprints(", ");
printtv(tcp, tcp->u_arg[3]);
} else if (cmd == FUTEX_WAIT_BITSET) {
tprints(", ");
printtv(tcp, tcp->u_arg[3]);
tprintf(", %lx", tcp->u_arg[5]);
} else if (cmd == FUTEX_REQUEUE)
tprintf(", %ld, %p", tcp->u_arg[3], (void *) tcp->u_arg[4]);
else if (cmd == FUTEX_CMP_REQUEUE || cmd == FUTEX_CMP_REQUEUE_PI)
tprintf(", %ld, %p, %ld", tcp->u_arg[3], (void *) tcp->u_arg[4], tcp->u_arg[5]);
else if (cmd == FUTEX_WAKE_OP) {
tprintf(", %ld, %p, {", tcp->u_arg[3], (void *) tcp->u_arg[4]);
if ((tcp->u_arg[5] >> 28) & 8)
tprints("FUTEX_OP_OPARG_SHIFT|");
printxval(futexwakeops, (tcp->u_arg[5] >> 28) & 0x7, "FUTEX_OP_???");
tprintf(", %ld, ", (tcp->u_arg[5] >> 12) & 0xfff);
if ((tcp->u_arg[5] >> 24) & 8)
tprints("FUTEX_OP_OPARG_SHIFT|");
printxval(futexwakecmps, (tcp->u_arg[5] >> 24) & 0x7, "FUTEX_OP_CMP_???");
tprintf(", %ld}", tcp->u_arg[5] & 0xfff);
} else if (cmd == FUTEX_WAIT_REQUEUE_PI) {
tprints(", ");
printtv(tcp, tcp->u_arg[3]);
tprintf(", %p", (void *) tcp->u_arg[4]);
}
}
return 0;
}

28
generate_xlat_in.sh Executable file
View File

@ -0,0 +1,28 @@
#!/bin/sh
convert() {
sed -n '/^\(static \)\?const struct xlat '"$n"'\[\] = {$/,/^};$/{
s/^[[:space:]]*XLAT(\([^)]\+\)).*/\1/p
s/^[[:space:]]*{[[:space:]]*(\?\(1<<[^),[:space:]]\+\).*/\1/p
s/.*not NULL-terminated.*/#unterminated/p
s/^\([[:space:]]*{.*\)/\1/p
s/^\t*\( *[/*].*\)/\1/p}' "$f" >> xlat/"$n".in
sed -i '/^\(static \)\?const struct xlat '"$n"'\[\] = {$/,/^};$/c #include "xlat/'"$n"'.h"' "$f"
}
for f; do
for n in $(sed -n 's/^\(static \)\?const struct xlat \([a-z0-9_]\+\)\[\] = {$/\2/p' "$f"); do
case "$n" in
cacheflush_flags|struct_user_offsets) # skip
;;
ioprio_class|ioprio_who|mtd_mode_options|personality_options|syslog_action_type|ubi_volume_props|ubi_volume_types)
echo '#unconditional' > xlat/"$n".in
convert
;;
*)
> xlat/"$n".in
convert
;;
esac
done
done

29
get_robust_list.c Normal file
View File

@ -0,0 +1,29 @@
#include "defs.h"
int
sys_get_robust_list(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]);
} else {
void *addr;
size_t len;
if (syserror(tcp) ||
!tcp->u_arg[1] ||
umove(tcp, tcp->u_arg[1], &addr) < 0) {
tprintf("%#lx, ", tcp->u_arg[1]);
} else {
tprintf("[%p], ", addr);
}
if (syserror(tcp) ||
!tcp->u_arg[2] ||
umove(tcp, tcp->u_arg[2], &len) < 0) {
tprintf("%#lx", tcp->u_arg[2]);
} else {
tprintf("[%lu]", (unsigned long) len);
}
}
return 0;
}

23
getcpu.c Normal file
View File

@ -0,0 +1,23 @@
#include "defs.h"
int
sys_getcpu(struct tcb *tcp)
{
if (exiting(tcp)) {
unsigned u;
if (tcp->u_arg[0] == 0)
tprints("NULL, ");
else if (umove(tcp, tcp->u_arg[0], &u) < 0)
tprintf("%#lx, ", tcp->u_arg[0]);
else
tprintf("[%u], ", u);
if (tcp->u_arg[1] == 0)
tprints("NULL, ");
else if (umove(tcp, tcp->u_arg[1], &u) < 0)
tprintf("%#lx, ", tcp->u_arg[1]);
else
tprintf("[%u], ", u);
tprintf("%#lx", tcp->u_arg[2]);
}
return 0;
}

14
getcwd.c Normal file
View File

@ -0,0 +1,14 @@
#include "defs.h"
int
sys_getcwd(struct tcb *tcp)
{
if (exiting(tcp)) {
if (syserror(tcp))
tprintf("%#lx", tcp->u_arg[0]);
else
printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
tprintf(", %lu", tcp->u_arg[1]);
}
return 0;
}

16
getrandom.c Normal file
View File

@ -0,0 +1,16 @@
#include "defs.h"
#include "xlat/getrandom_flags.h"
int
sys_getrandom(struct tcb *tcp)
{
if (exiting(tcp)) {
if (syserror(tcp))
tprintf("%#lx", tcp->u_arg[0]);
else
printstr(tcp, tcp->u_arg[0], tcp->u_rval);
tprintf(", %lu, ", tcp->u_arg[1]);
printflags(getrandom_flags, tcp->u_arg[2], "GRND_???");
}
return 0;
}

View File

@ -1,5 +1,6 @@
#!/usr/bin/perl -w
#!/usr/bin/perl
use strict;
use warnings;
# Sets mtime and atime of files to the latest commit time in git.
#

226
git-version-gen Executable file
View File

@ -0,0 +1,226 @@
#!/bin/sh
# Print a version string.
scriptversion=2014-12-02.19; # UTC
# Copyright (C) 2007-2014 Free Software Foundation, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This script is derived from GIT-VERSION-GEN from GIT: http://git.or.cz/.
# It may be run two ways:
# - from a git repository in which the "git describe" command below
# produces useful output (thus requiring at least one signed tag)
# - from a non-git-repo directory containing a .tarball-version file, which
# presumes this script is invoked like "./git-version-gen .tarball-version".
# In order to use intra-version strings in your project, you will need two
# separate generated version string files:
#
# .tarball-version - present only in a distribution tarball, and not in
# a checked-out repository. Created with contents that were learned at
# the last time autoconf was run, and used by git-version-gen. Must not
# be present in either $(srcdir) or $(builddir) for git-version-gen to
# give accurate answers during normal development with a checked out tree,
# but must be present in a tarball when there is no version control system.
# Therefore, it cannot be used in any dependencies. GNUmakefile has
# hooks to force a reconfigure at distribution time to get the value
# correct, without penalizing normal development with extra reconfigures.
#
# .version - present in a checked-out repository and in a distribution
# tarball. Usable in dependencies, particularly for files that don't
# want to depend on config.h but do want to track version changes.
# Delete this file prior to any autoconf run where you want to rebuild
# files to pick up a version string change; and leave it stale to
# minimize rebuild time after unrelated changes to configure sources.
#
# As with any generated file in a VC'd directory, you should add
# /.version to .gitignore, so that you don't accidentally commit it.
# .tarball-version is never generated in a VC'd directory, so needn't
# be listed there.
#
# Use the following line in your configure.ac, so that $(VERSION) will
# automatically be up-to-date each time configure is run (and note that
# since configure.ac no longer includes a version string, Makefile rules
# should not depend on configure.ac for version updates).
#
# AC_INIT([GNU project],
# m4_esyscmd([build-aux/git-version-gen .tarball-version]),
# [bug-project@example])
#
# Then use the following lines in your Makefile.am, so that .version
# will be present for dependencies, and so that .version and
# .tarball-version will exist in distribution tarballs.
#
# EXTRA_DIST = $(top_srcdir)/.version
# BUILT_SOURCES = $(top_srcdir)/.version
# $(top_srcdir)/.version:
# echo $(VERSION) > $@-t && mv $@-t $@
# dist-hook:
# echo $(VERSION) > $(distdir)/.tarball-version
me=$0
version="git-version-gen $scriptversion
Copyright 2011 Free Software Foundation, Inc.
There is NO warranty. You may redistribute this software
under the terms of the GNU General Public License.
For more information about these matters, see the files named COPYING."
usage="\
Usage: $me [OPTION]... \$srcdir/.tarball-version [TAG-NORMALIZATION-SED-SCRIPT]
Print a version string.
Options:
--prefix PREFIX prefix of git tags (default 'v')
--fallback VERSION
fallback version to use if \"git --version\" fails
--help display this help and exit
--version output version information and exit
Running without arguments will suffice in most cases."
prefix=v
fallback=
while test $# -gt 0; do
case $1 in
--help) echo "$usage"; exit 0;;
--version) echo "$version"; exit 0;;
--prefix) shift; prefix="$1";;
--fallback) shift; fallback="$1";;
-*)
echo "$0: Unknown option '$1'." >&2
echo "$0: Try '--help' for more information." >&2
exit 1;;
*)
if test "x$tarball_version_file" = x; then
tarball_version_file="$1"
elif test "x$tag_sed_script" = x; then
tag_sed_script="$1"
else
echo "$0: extra non-option argument '$1'." >&2
exit 1
fi;;
esac
shift
done
if test "x$tarball_version_file" = x; then
echo "$usage"
exit 1
fi
tag_sed_script="${tag_sed_script:-s/x/x/}"
nl='
'
# Avoid meddling by environment variable of the same name.
v=
v_from_git=
# First see if there is a tarball-only version file.
# then try "git describe", then default.
if test -f $tarball_version_file
then
v=`cat $tarball_version_file` || v=
case $v in
*$nl*) v= ;; # reject multi-line output
[0-9]*) ;;
*) v= ;;
esac
test "x$v" = x \
&& echo "$0: WARNING: $tarball_version_file is missing or damaged" 1>&2
fi
if test "x$v" != x
then
: # use $v
# Otherwise, if there is at least one git commit involving the working
# directory, and "git describe" output looks sensible, use that to
# derive a version string.
elif test "`git log -1 --pretty=format:x . 2>&1`" = x \
&& v=`git describe --abbrev=4 --match="$prefix*" HEAD 2>/dev/null \
|| git describe --abbrev=4 HEAD 2>/dev/null` \
&& v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
&& case $v in
$prefix[0-9]*) ;;
*) (exit 1) ;;
esac
then
# Is this a new git that lists number of commits since the last
# tag or the previous older version that did not?
# Newer: v6.10-77-g0f8faeb
# Older: v6.10-g0f8faeb
case $v in
*-*-*) : git describe is okay three part flavor ;;
*-*)
: git describe is older two part flavor
# Recreate the number of commits and rewrite such that the
# result is the same as if we were using the newer version
# of git describe.
vtag=`echo "$v" | sed 's/-.*//'`
commit_list=`git rev-list "$vtag"..HEAD 2>/dev/null` \
|| { commit_list=failed;
echo "$0: WARNING: git rev-list failed" 1>&2; }
numcommits=`echo "$commit_list" | wc -l`
v=`echo "$v" | sed "s/\(.*\)-\(.*\)/\1-$numcommits-\2/"`;
test "$commit_list" = failed && v=UNKNOWN
;;
esac
# Change the first '-' to a '.', so version-comparing tools work properly.
# Remove the "g" in git describe's output string, to save a byte.
v=`echo "$v" | sed 's/-/.0./;s/\(.*\)-g/\1-/'`;
v_from_git=1
elif test "x$fallback" = x || git --version >/dev/null 2>&1; then
v=UNKNOWN
else
v=$fallback
fi
v=`echo "$v" |sed "s/^$prefix//"`
# Test whether to append the "-dirty" suffix only if the version
# string we're using came from git. I.e., skip the test if it's "UNKNOWN"
# or if it came from .tarball-version.
if test "x$v_from_git" != x; then
# Don't declare a version "dirty" merely because a time stamp has changed.
git update-index --refresh > /dev/null 2>&1
dirty=`exec 2>/dev/null;git diff-index --name-only HEAD` || dirty=
case "$dirty" in
'') ;;
*) # Append the suffix only if there isn't one already.
case $v in
*-dirty) ;;
*) v="$v-dirty" ;;
esac ;;
esac
fi
# Omit the trailing newline, so that m4_esyscmd can use the result directly.
printf %s "$v"
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

View File

@ -3,13 +3,13 @@ eval '(exit $?0)' && eval 'exec perl -wS "$0" ${1+"$@"}'
if 0;
# Convert git log output to ChangeLog format.
my $VERSION = '2011-10-31 16:06'; # UTC
my $VERSION = '2014-11-20 17:25'; # UTC
# The definition above must lie within the first 8 lines in order
# for the Emacs time-stamp write hook (at end) to update it.
# If you change this file with Emacs, please let the write hook
# do its job. Otherwise, update this string manually.
# Copyright (C) 2008-2011 Free Software Foundation, Inc.
# Copyright (C) 2008-2014 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -47,7 +47,7 @@ sub usage ($)
my $STREAM = ($exit_code == 0 ? *STDOUT : *STDERR);
if ($exit_code != 0)
{
print $STREAM "Try `$ME --help' for more information.\n";
print $STREAM "Try '$ME --help' for more information.\n";
}
else
{
@ -60,14 +60,26 @@ $ME, they may be preceded by '--'.
OPTIONS:
--amend=FILE FILE maps from an SHA1 to perl code (i.e., s/old/new/) that
makes a change to SHA1's commit log text or metadata.
--append-dot append a dot to the first line of each commit message if
there is no other punctuation or blank at the end.
--no-cluster never cluster commit messages under the same date/author
header; the default is to cluster adjacent commit messages
if their headers are the same and neither commit message
contains multiple paragraphs.
--srcdir=DIR the root of the source tree, from which the .git/
directory can be derived.
--since=DATE convert only the logs since DATE;
the default is to convert all log entries.
--until=DATE convert only the logs older than DATE.
--format=FMT set format string for commit subject and body;
see 'man git-log' for the list of format metacharacters;
the default is '%s%n%b%n'
--append-dot append a dot to the first line of each commit message if
there is no other punctuation or blank at the end.
--strip-tab remove one additional leading TAB from commit message lines.
--strip-cherry-pick remove data inserted by "git cherry-pick";
this includes the "cherry picked from commit ..." line,
and the possible final "Conflicts:" paragraph.
--help display this help and exit
--version output version information and exit
@ -76,6 +88,38 @@ EXAMPLE:
$ME --since=2008-01-01 > ChangeLog
$ME -- -n 5 foo > last-5-commits-to-branch-foo
SPECIAL SYNTAX:
The following types of strings are interpreted specially when they appear
at the beginning of a log message line. They are not copied to the output.
Copyright-paperwork-exempt: Yes
Append the "(tiny change)" notation to the usual "date name email"
ChangeLog header to mark a change that does not require a copyright
assignment.
Co-authored-by: Joe User <user\@example.com>
List the specified name and email address on a second
ChangeLog header, denoting a co-author.
Signed-off-by: Joe User <user\@example.com>
These lines are simply elided.
In a FILE specified via --amend, comment lines (starting with "#") are ignored.
FILE must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1 (alone on
a line) referring to a commit in the current project, and CODE refers to one
or more consecutive lines of Perl code. Pairs must be separated by one or
more blank line.
Here is sample input for use with --amend=FILE, from coreutils:
3a169f4c5d9159283548178668d2fae6fced3030
# fix typo in title:
s/all tile types/all file types/
1379ed974f1fa39b12e2ffab18b3f7a607082202
# Due to a bug in vc-dwim, I mis-attributed a patch by Paul to myself.
# Change the author to be Paul. Note the escaped "@":
s,Jim .*>,Paul Eggert <eggert\\\@cs.ucla.edu>,
EOF
}
exit $exit_code;
@ -101,29 +145,125 @@ sub quoted_cmd(@)
return join (' ', map {shell_quote $_} @_);
}
# Parse file F.
# Comment lines (starting with "#") are ignored.
# F must consist of <SHA,CODE+> pairs where SHA is a 40-byte SHA1
# (alone on a line) referring to a commit in the current project, and
# CODE refers to one or more consecutive lines of Perl code.
# Pairs must be separated by one or more blank line.
sub parse_amend_file($)
{
my ($f) = @_;
open F, '<', $f
or die "$ME: $f: failed to open for reading: $!\n";
my $fail;
my $h = {};
my $in_code = 0;
my $sha;
while (defined (my $line = <F>))
{
$line =~ /^\#/
and next;
chomp $line;
$line eq ''
and $in_code = 0, next;
if (!$in_code)
{
$line =~ /^([0-9a-fA-F]{40})$/
or (warn "$ME: $f:$.: invalid line; expected an SHA1\n"),
$fail = 1, next;
$sha = lc $1;
$in_code = 1;
exists $h->{$sha}
and (warn "$ME: $f:$.: duplicate SHA1\n"),
$fail = 1, next;
}
else
{
$h->{$sha} ||= '';
$h->{$sha} .= "$line\n";
}
}
close F;
$fail
and exit 1;
return $h;
}
# git_dir_option $SRCDIR
#
# From $SRCDIR, the --git-dir option to pass to git (none if $SRCDIR
# is undef). Return as a list (0 or 1 element).
sub git_dir_option($)
{
my ($srcdir) = @_;
my @res = ();
if (defined $srcdir)
{
my $qdir = shell_quote $srcdir;
my $cmd = "cd $qdir && git rev-parse --show-toplevel";
my $qcmd = shell_quote $cmd;
my $git_dir = qx($cmd);
defined $git_dir
or die "$ME: cannot run $qcmd: $!\n";
$? == 0
or die "$ME: $qcmd had unexpected exit code or signal ($?)\n";
chomp $git_dir;
push @res, "--git-dir=$git_dir/.git";
}
@res;
}
{
my $since_date;
my $until_date;
my $format_string = '%s%n%b%n';
my $amend_file;
my $append_dot = 0;
my $cluster = 1;
my $strip_tab = 0;
my $strip_cherry_pick = 0;
my $srcdir;
GetOptions
(
help => sub { usage 0 },
version => sub { print "$ME version $VERSION\n"; exit },
'since=s' => \$since_date,
'until=s' => \$until_date,
'format=s' => \$format_string,
'amend=s' => \$amend_file,
'append-dot' => \$append_dot,
'cluster!' => \$cluster,
'strip-tab' => \$strip_tab,
'strip-cherry-pick' => \$strip_cherry_pick,
'srcdir=s' => \$srcdir,
) or usage 1;
defined $since_date
and unshift @ARGV, "--since=$since_date";
defined $until_date
and unshift @ARGV, "--until=$until_date";
my @cmd = (qw (git log --log-size),
'--pretty=format:%ct %an <%ae>%n%n'.$format_string, @ARGV);
# This is a hash that maps an SHA1 to perl code (i.e., s/old/new/)
# that makes a correction in the log or attribution of that commit.
my $amend_code = defined $amend_file ? parse_amend_file $amend_file : {};
my @cmd = ('git',
git_dir_option $srcdir,
qw(log --log-size),
'--pretty=format:%H:%ct %an <%ae>%n%n'.$format_string, @ARGV);
open PIPE, '-|', @cmd
or die ("$ME: failed to run `". quoted_cmd (@cmd) ."': $!\n"
or die ("$ME: failed to run '". quoted_cmd (@cmd) ."': $!\n"
. "(Is your Git too old? Version 1.5.1 or later is required.)\n");
my $prev_multi_paragraph;
my $prev_date_line = '';
my @prev_coauthors = ();
while (1)
{
defined (my $in = <PIPE>)
@ -137,7 +277,41 @@ sub quoted_cmd(@)
$n_read == $log_nbytes
or die "$ME:$.: unexpected EOF\n";
my @line = split "\n", $log;
# Extract leading hash.
my ($sha, $rest) = split ':', $log, 2;
defined $sha
or die "$ME:$.: malformed log entry\n";
$sha =~ /^[0-9a-fA-F]{40}$/
or die "$ME:$.: invalid SHA1: $sha\n";
# If this commit's log requires any transformation, do it now.
my $code = $amend_code->{$sha};
if (defined $code)
{
eval 'use Safe';
my $s = new Safe;
# Put the unpreprocessed entry into "$_".
$_ = $rest;
# Let $code operate on it, safely.
my $r = $s->reval("$code")
or die "$ME:$.:$sha: failed to eval \"$code\":\n$@\n";
# Note that we've used this entry.
delete $amend_code->{$sha};
# Update $rest upon success.
$rest = $_;
}
# Remove lines inserted by "git cherry-pick".
if ($strip_cherry_pick)
{
$rest =~ s/^\s*Conflicts:\n.*//sm;
$rest =~ s/^\s*\(cherry picked from commit [\da-f]+\)\n//m;
}
my @line = split "\n", $rest;
my $author_line = shift @line;
defined $author_line
or die "$ME:$.: unexpected EOF\n";
@ -145,19 +319,20 @@ sub quoted_cmd(@)
or die "$ME:$.: Invalid line "
. "(expected date/author/email):\n$author_line\n";
my $date_line = sprintf "%s $2\n", strftime ("%F", localtime ($1));
# If this line would be the same as the previous date/name/email
# line, then arrange not to print it.
if ($date_line ne $prev_date_line)
{
$prev_date_line eq ''
or print "\n";
print $date_line;
}
$prev_date_line = $date_line;
# Format 'Copyright-paperwork-exempt: Yes' as a standard ChangeLog
# `(tiny change)' annotation.
my $tiny = (grep (/^Copyright-paperwork-exempt:\s+[Yy]es$/, @line)
? ' (tiny change)' : '');
# Omit "Signed-off-by..." lines.
@line = grep !/^Signed-off-by: .*>$/, @line;
my $date_line = sprintf "%s %s$tiny\n",
strftime ("%F", localtime ($1)), $2;
my @coauthors = grep /^Co-authored-by:.*$/, @line;
# Omit meta-data lines we've already interpreted.
@line = grep !/^(?:Signed-off-by:[ ].*>$
|Co-authored-by:[ ]
|Copyright-paperwork-exempt:[ ]
)/x, @line;
# Remove leading and trailing blank lines.
if (@line)
@ -166,6 +341,41 @@ sub quoted_cmd(@)
while ($line[$#line] =~ /^\s*$/) { pop @line; }
}
# Record whether there are two or more paragraphs.
my $multi_paragraph = grep /^\s*$/, @line;
# Format 'Co-authored-by: A U Thor <email@example.com>' lines in
# standard multi-author ChangeLog format.
for (@coauthors)
{
s/^Co-authored-by:\s*/\t /;
s/\s*</ </;
/<.*?@.*\..*>/
or warn "$ME: warning: missing email address for "
. substr ($_, 5) . "\n";
}
# If clustering of commit messages has been disabled, if this header
# would be different from the previous date/name/email/coauthors header,
# or if this or the previous entry consists of two or more paragraphs,
# then print the header.
if ( ! $cluster
|| $date_line ne $prev_date_line
|| "@coauthors" ne "@prev_coauthors"
|| $multi_paragraph
|| $prev_multi_paragraph)
{
$prev_date_line eq ''
or print "\n";
print $date_line;
@coauthors
and print join ("\n", @coauthors), "\n";
}
$prev_date_line = $date_line;
@prev_coauthors = @coauthors;
$prev_multi_paragraph = $multi_paragraph;
# If there were any lines
if (@line == 0)
{
@ -185,6 +395,10 @@ sub quoted_cmd(@)
}
}
# Remove one additional leading TAB from each line.
$strip_tab
and map { s/^\t// } @line;
# Prefix each non-empty line with a TAB.
@line = map { length $_ ? "\t$_" : '' } @line;
@ -200,6 +414,16 @@ sub quoted_cmd(@)
close PIPE
or die "$ME: error closing pipe from " . quoted_cmd (@cmd) . "\n";
# FIXME-someday: include $PROCESS_STATUS in the diagnostic
# Complain about any unused entry in the --amend=F specified file.
my $fail = 0;
foreach my $sha (keys %$amend_code)
{
warn "$ME:$amend_file: unused entry: $sha\n";
$fail = 1;
}
exit $fail;
}
# Local Variables:

26
hostname.c Normal file
View File

@ -0,0 +1,26 @@
#include "defs.h"
int
sys_sethostname(struct tcb *tcp)
{
if (entering(tcp)) {
printstr(tcp, tcp->u_arg[0], tcp->u_arg[1]);
tprintf(", %lu", tcp->u_arg[1]);
}
return 0;
}
#if defined(ALPHA)
int
sys_gethostname(struct tcb *tcp)
{
if (exiting(tcp)) {
if (syserror(tcp))
tprintf("%#lx", tcp->u_arg[0]);
else
printstr(tcp, tcp->u_arg[0], -1);
tprintf(", %lu", tcp->u_arg[1]);
}
return 0;
}
#endif /* ALPHA */

41
inotify.c Normal file
View File

@ -0,0 +1,41 @@
#include "defs.h"
#include <fcntl.h>
#include "xlat/inotify_flags.h"
#include "xlat/inotify_init_flags.h"
int
sys_inotify_add_watch(struct tcb *tcp)
{
if (entering(tcp)) {
/* file descriptor */
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
/* pathname */
printpath(tcp, tcp->u_arg[1]);
tprints(", ");
/* mask */
printflags(inotify_flags, tcp->u_arg[2], "IN_???");
}
return 0;
}
int
sys_inotify_rm_watch(struct tcb *tcp)
{
if (entering(tcp)) {
/* file descriptor */
printfd(tcp, tcp->u_arg[0]);
/* watch descriptor */
tprintf(", %d", (int) tcp->u_arg[1]);
}
return 0;
}
int
sys_inotify_init1(struct tcb *tcp)
{
if (entering(tcp))
printflags(inotify_init_flags, tcp->u_arg[0], "IN_???");
return 0;
}

112
io.c
View File

@ -30,9 +30,7 @@
#include "defs.h"
#include <fcntl.h>
#if HAVE_SYS_UIO_H
# include <sys/uio.h>
#endif
#include <sys/uio.h>
int
sys_read(struct tcb *tcp)
@ -62,7 +60,6 @@ sys_write(struct tcb *tcp)
return 0;
}
#if HAVE_SYS_UIO_H
/*
* data_size limits the cumulative size of printed data.
* Example: recvmsg returing a short read.
@ -174,7 +171,6 @@ sys_writev(struct tcb *tcp)
}
return 0;
}
#endif
/* The SH4 ABI does allow long longs in odd-numbered registers, but
does not allow them to be split between registers and memory - and
@ -217,7 +213,32 @@ sys_pwrite(struct tcb *tcp)
return 0;
}
#if HAVE_SYS_UIO_H
static void
print_llu_from_low_high_val(struct tcb *tcp, int arg)
{
#if SIZEOF_LONG == SIZEOF_LONG_LONG
# if SUPPORTED_PERSONALITIES > 1
if (current_wordsize == sizeof(long))
# endif
tprintf("%lu", (unsigned long) tcp->u_arg[arg]);
# if SUPPORTED_PERSONALITIES > 1
else
tprintf("%lu",
((unsigned long) tcp->u_arg[arg + 1] << current_wordsize * 8)
| (unsigned long) tcp->u_arg[arg]);
# endif
#else
# ifdef X32
if (current_personality == 0)
tprintf("%llu", (unsigned long long) tcp->ext_arg[arg]);
else
# endif
tprintf("%llu",
((unsigned long long) (unsigned long) tcp->u_arg[arg + 1] << sizeof(long) * 8)
| (unsigned long long) (unsigned long) tcp->u_arg[arg]);
#endif
}
int
sys_preadv(struct tcb *tcp)
{
@ -231,7 +252,7 @@ sys_preadv(struct tcb *tcp)
}
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
tprintf(", %lu, ", tcp->u_arg[2]);
printllval(tcp, "%llu", PREAD_OFFSET_ARG);
print_llu_from_low_high_val(tcp, 3);
}
return 0;
}
@ -244,32 +265,46 @@ sys_pwritev(struct tcb *tcp)
tprints(", ");
tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1);
tprintf(", %lu, ", tcp->u_arg[2]);
printllval(tcp, "%llu", PREAD_OFFSET_ARG);
print_llu_from_low_high_val(tcp, 3);
}
return 0;
}
#endif /* HAVE_SYS_UIO_H */
static void
print_off_t(struct tcb *tcp, long addr)
{
unsigned long offset;
if (!addr) {
tprints("NULL");
return;
}
#if SUPPORTED_PERSONALITIES > 1 && SIZEOF_LONG > 4
if (current_wordsize == 4) {
uint32_t off;
if (umove(tcp, addr, &off) < 0)
tprintf("%#lx", addr);
else
tprintf("[%u]", off);
} else
#endif
if (umove(tcp, addr, &offset) < 0)
tprintf("%#lx", addr);
else
tprintf("[%lu]", offset);
}
int
sys_sendfile(struct tcb *tcp)
{
if (entering(tcp)) {
off_t offset;
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
printfd(tcp, tcp->u_arg[1]);
tprints(", ");
if (!tcp->u_arg[2])
tprints("NULL");
else if (umove(tcp, tcp->u_arg[2], &offset) < 0)
tprintf("%#lx", tcp->u_arg[2]);
else
#ifdef HAVE_LONG_LONG_OFF_T
tprintf("[%llu]", offset);
#else
tprintf("[%lu]", offset);
#endif
print_off_t(tcp, tcp->u_arg[2]);
tprintf(", %lu", tcp->u_arg[3]);
}
return 0;
@ -302,21 +337,7 @@ sys_sendfile64(struct tcb *tcp)
return 0;
}
static const struct xlat splice_flags[] = {
#ifdef SPLICE_F_MOVE
{ SPLICE_F_MOVE, "SPLICE_F_MOVE" },
#endif
#ifdef SPLICE_F_NONBLOCK
{ SPLICE_F_NONBLOCK, "SPLICE_F_NONBLOCK" },
#endif
#ifdef SPLICE_F_MORE
{ SPLICE_F_MORE, "SPLICE_F_MORE" },
#endif
#ifdef SPLICE_F_GIFT
{ SPLICE_F_GIFT, "SPLICE_F_GIFT" },
#endif
{ 0, NULL },
};
#include "xlat/splice_flags.h"
int
sys_tee(struct tcb *tcp)
@ -379,18 +400,21 @@ sys_vmsplice(struct tcb *tcp)
int
sys_ioctl(struct tcb *tcp)
{
const struct ioctlent *iop;
const struct_ioctlent *iop;
if (entering(tcp)) {
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
iop = ioctl_lookup(tcp->u_arg[1]);
if (iop) {
tprints(iop->symbol);
while ((iop = ioctl_next_match(iop)))
tprintf(" or %s", iop->symbol);
} else
tprintf("%#lx", tcp->u_arg[1]);
if (!ioctl_decode_command_number(tcp->u_arg[1])) {
iop = ioctl_lookup(tcp->u_arg[1]);
if (iop) {
tprints(iop->symbol);
while ((iop = ioctl_next_match(iop)))
tprintf(" or %s", iop->symbol);
} else {
ioctl_print_code(tcp->u_arg[1]);
}
}
ioctl_decode(tcp, tcp->u_arg[1], tcp->u_arg[2]);
}
else {

197
ioctl.c
View File

@ -30,22 +30,29 @@
#include "defs.h"
#include <asm/ioctl.h>
#include "xlat/ioctl_dirs.h"
#ifdef HAVE_LINUX_INPUT_H
# include <linux/input.h>
#endif
#include "xlat/evdev_abs.h"
#include "xlat/evdev_ev.h"
static int
compare(const void *a, const void *b)
{
unsigned long code1 = (long) a;
unsigned long code2 = ((struct ioctlent *) b)->code;
const unsigned int code1 = (const unsigned long) a;
const unsigned int code2 = ((struct_ioctlent *) b)->code;
return (code1 > code2) ? 1 : (code1 < code2) ? -1 : 0;
}
const struct ioctlent *
ioctl_lookup(long code)
const struct_ioctlent *
ioctl_lookup(const unsigned int code)
{
struct ioctlent *iop;
struct_ioctlent *iop;
code &= (_IOC_NRMASK<<_IOC_NRSHIFT) | (_IOC_TYPEMASK<<_IOC_TYPESHIFT);
iop = bsearch((void*)code, ioctlent,
iop = bsearch((const void *) (const unsigned long) code, ioctlent,
nioctlents, sizeof(ioctlent[0]), compare);
while (iop > ioctlent) {
iop--;
@ -57,22 +64,167 @@ ioctl_lookup(long code)
return iop;
}
const struct ioctlent *
ioctl_next_match(const struct ioctlent *iop)
const struct_ioctlent *
ioctl_next_match(const struct_ioctlent *iop)
{
long code;
code = iop->code;
const unsigned int code = iop->code;
iop++;
if (iop < ioctlent + nioctlents && iop->code == code)
return iop;
return NULL;
}
int
ioctl_decode(struct tcb *tcp, long code, long arg)
void
ioctl_print_code(const unsigned int code)
{
switch ((code >> 8) & 0xff) {
tprints("_IOC(");
printflags(ioctl_dirs, _IOC_DIR(code), "_IOC_???");
tprintf(", 0x%02x, 0x%02x, 0x%02x)",
_IOC_TYPE(code), _IOC_NR(code), _IOC_SIZE(code));
}
static int
evdev_decode_number(unsigned int arg)
{
unsigned int nr = _IOC_NR(arg);
if (_IOC_DIR(arg) == _IOC_WRITE) {
if (nr >= 0xc0 && nr <= 0xc0 + 0x3f) {
tprints("EVIOCSABS(");
printxval(evdev_abs, nr - 0xc0, "EV_???");
tprints(")");
return 1;
}
}
if (_IOC_DIR(arg) != _IOC_READ)
return 0;
if (nr >= 0x20 && nr <= 0x20 + 0x1f) {
tprints("EVIOCGBIT(");
printxval(evdev_ev, nr - 0x20, "EV_???");
tprintf(", %u)", _IOC_SIZE(arg));
return 1;
} else if (nr >= 0x40 && nr <= 0x40 + 0x3f) {
tprints("EVIOCGABS(");
printxval(evdev_abs, nr - 0x40, "ABS_???");
tprints(")");
return 1;
}
switch (_IOC_NR(nr)) {
case 0x06:
tprintf("EVIOCGNAME(%u)", _IOC_SIZE(arg));
return 1;
case 0x07:
tprintf("EVIOCGPHYS(%u)", _IOC_SIZE(arg));
return 1;
case 0x08:
tprintf("EVIOCGUNIQ(%u)", _IOC_SIZE(arg));
return 1;
case 0x09:
tprintf("EVIOCGPROP(%u)", _IOC_SIZE(arg));
return 1;
case 0x0a:
tprintf("EVIOCGMTSLOTS(%u)", _IOC_SIZE(arg));
return 1;
case 0x18:
tprintf("EVIOCGKEY(%u)", _IOC_SIZE(arg));
return 1;
case 0x19:
tprintf("EVIOCGLED(%u)", _IOC_SIZE(arg));
return 1;
case 0x1a:
tprintf("EVIOCGSND(%u)", _IOC_SIZE(arg));
return 1;
case 0x1b:
tprintf("EVIOCGSW(%u)", _IOC_SIZE(arg));
return 1;
default:
return 0;
}
}
static int
hiddev_decode_number(unsigned int arg)
{
if (_IOC_DIR(arg) == _IOC_READ) {
switch (_IOC_NR(arg)) {
case 0x04:
tprintf("HIDIOCGRAWNAME(%u)", _IOC_SIZE(arg));
return 1;
case 0x05:
tprintf("HIDIOCGRAWPHYS(%u)", _IOC_SIZE(arg));
return 1;
case 0x06:
tprintf("HIDIOCSFEATURE(%u)", _IOC_SIZE(arg));
return 1;
case 0x12:
tprintf("HIDIOCGPHYS(%u)", _IOC_SIZE(arg));
return 1;
default:
return 0;
}
} else if (_IOC_DIR(arg) == (_IOC_READ | _IOC_WRITE)) {
switch (_IOC_NR(arg)) {
case 0x06:
tprintf("HIDIOCSFEATURE(%u)", _IOC_SIZE(arg));
return 1;
case 0x07:
tprintf("HIDIOCGFEATURE(%u)", _IOC_SIZE(arg));
return 1;
default:
return 0;
}
}
return 0;
}
int
ioctl_decode_command_number(unsigned int arg)
{
switch (_IOC_TYPE(arg)) {
case 'E':
return evdev_decode_number(arg);
case 'H':
return hiddev_decode_number(arg);
case 'M':
if (_IOC_DIR(arg) == _IOC_WRITE) {
tprintf("MIXER_WRITE(%u)", _IOC_NR(arg));
return 1;
} else if (_IOC_DIR(arg) == _IOC_READ) {
tprintf("MIXER_READ(%u)", _IOC_NR(arg));
return 1;
}
return 0;
case 'U':
if (_IOC_DIR(arg) == _IOC_READ && _IOC_NR(arg) == 0x2c) {
tprintf("UI_GET_SYSNAME(%u)", _IOC_SIZE(arg));
return 1;
}
return 0;
case 'j':
if (_IOC_DIR(arg) == _IOC_READ && _IOC_NR(arg) == 0x13) {
tprintf("JSIOCGNAME(%u)", _IOC_SIZE(arg));
return 1;
}
return 0;
case 'k':
if (_IOC_DIR(arg) == _IOC_WRITE && _IOC_NR(arg) == 0) {
tprintf("SPI_IOC_MESSAGE(%u)", _IOC_SIZE(arg));
return 1;
}
return 0;
default:
return 0;
}
}
int
ioctl_decode(struct tcb *tcp, unsigned int code, long arg)
{
switch (_IOC_TYPE(code)) {
#if defined(ALPHA) || defined(POWERPC)
case 'f': case 't': case 'T':
#else /* !ALPHA */
@ -85,13 +237,27 @@ ioctl_decode(struct tcb *tcp, long code, long arg)
return rtc_ioctl(tcp, code, arg);
case 0x03:
case 0x12:
case 'X':
return block_ioctl(tcp, code, arg);
#ifdef HAVE_SCSI_SG_H
case 0x22:
return scsi_ioctl(tcp, code, arg);
#endif
case 'L':
return loop_ioctl(tcp, code, arg);
case 'M':
return mtd_ioctl(tcp, code, arg);
case 'o':
case 'O':
return ubi_ioctl(tcp, code, arg);
case 'V':
return v4l2_ioctl(tcp, code, arg);
case '=':
return ptp_ioctl(tcp, code, arg);
#ifdef HAVE_LINUX_INPUT_H
case 'E':
return evdev_ioctl(tcp, code, arg);
#endif
default:
break;
}
@ -142,6 +308,7 @@ ioctl_decode(struct tcb *tcp, long code, long arg)
* t sys/ttycom.h (possible overlap)
* v sundev/vuid_event.h *overlap*
* v sys/vcmd.h *overlap*
* V linux/videodev2.h
*
* End of Registry
*/

View File

@ -1,6 +1,6 @@
/*
* Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
* Copyright (c) 1993, 1994, 1995 Rick Sladkey <jrs@world.std.com>
* Copyright (c) 2001 Wichert Akkerman <wichert@cistron.nl>
* Copyright (c) 2004-2015 Dmitry V. Levin <ldv@altlinux.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -26,38 +26,138 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdio.h>
#ifdef STDC_HEADERS
# include <stdlib.h>
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <asm/ioctl.h>
struct ioctlent {
const char *doth;
const char *symbol;
unsigned long code;
const char *info;
const char *name;
unsigned int dir;
unsigned int type_nr;
unsigned int size;
};
#include "ioctlent.raw"
int nioctlents = sizeof ioctlent / sizeof ioctlent[0];
int
compare(const void *a, const void *b)
static int
is_prefix(const char *s1, const char *s2)
{
unsigned long code1 = ((struct ioctlent *) a)->code;
unsigned long code2 = ((struct ioctlent *) b)->code;
return (code1 > code2) ? 1 : (code1 < code2) ? -1 : 0;
size_t len = strlen(s1);
if (len > strlen(s2))
return 0;
return !memcmp(s1, s2, len);
}
int
main(int argc, const char *argv[])
static int
compare_name_info(const void* a, const void* b)
{
int i;
int rc;
qsort(ioctlent, nioctlents, sizeof ioctlent[0], compare);
for (i = 0; i < nioctlents; i++) {
printf("{\"%s\", \"%s\", %#lx},\n",
ioctlent[i].doth, ioctlent[i].symbol, ioctlent[i].code);
const char *name1 = ((struct ioctlent *) a)->name;
const char *name2 = ((struct ioctlent *) b)->name;
const char *info1 = ((struct ioctlent *) a)->info;
const char *info2 = ((struct ioctlent *) b)->info;
rc = strcmp(name1, name2);
if (rc)
return rc;
/*
* exception from lexicographical order:
* "asm/" < "asm-generic/"
*/
if (is_prefix("asm/", info1) &&
is_prefix("asm-generic/", info2))
return -1;
if (is_prefix("asm/", info2) &&
is_prefix("asm-generic/", info1))
return 1;
return strcmp(info1, info2);
}
static unsigned int
code(const struct ioctlent *e)
{
return e->type_nr |
(e->size << _IOC_SIZESHIFT) |
(e->dir << _IOC_DIRSHIFT);
}
static int
compare_code_name(const void* a, const void* b)
{
unsigned int code1 = code((struct ioctlent *) a);
unsigned int code2 = code((struct ioctlent *) b);
const char *name1 = ((struct ioctlent *) a)->name;
const char *name2 = ((struct ioctlent *) b)->name;
return (code1 > code2) ?
1 : (code1 < code2) ? -1 : strcmp(name1, name2);
}
static void
ioctlsort(struct ioctlent *ioctls, size_t nioctls)
{
size_t i;
qsort(ioctls, nioctls, sizeof(ioctls[0]), compare_name_info);
for (i = 1; i < nioctls; ++i)
if (!strcmp(ioctls[i-1].name, ioctls[i].name)) {
/*
* If there are multiple definitions for the same
* name, keep the first one and mark all the rest
* for deletion.
*/
ioctls[i].info = NULL;
}
for (i = 1; i < nioctls; ++i)
if (!ioctls[i].info) {
/*
* Change ioctl code of marked elements
* to make them sorted to the end of array.
*/
ioctls[i].dir =
ioctls[i].type_nr =
ioctls[i].size = 0xffffffffu;
}
qsort(ioctls, nioctls, sizeof(ioctls[0]), compare_code_name);
puts("/* Generated by ioctlsort. */");
for (i = 0; i < nioctls; ++i) {
if (!ioctls[i].info) {
/*
* We've reached the first element marked for deletion.
*/
break;
}
if (i == 0 || code(&ioctls[i-1]) != code(&ioctls[i]) ||
!is_prefix(ioctls[i-1].name, ioctls[i].name))
printf("{ \"%s\", %#010x },\n",
ioctls[i].name, code(ioctls+i));
}
}
static struct ioctlent ioctls[] = {
#ifdef IOCTLSORT_INC
# include IOCTLSORT_INC
#else
# include "ioctls_arch.h"
# include "ioctls_inc.h"
#endif
};
int
main(void)
{
ioctlsort(ioctls, sizeof(ioctls) / sizeof(ioctls[0]));
return 0;
}

75
ioprio.c Normal file
View File

@ -0,0 +1,75 @@
#include "defs.h"
enum {
IOPRIO_WHO_PROCESS = 1,
IOPRIO_WHO_PGRP,
IOPRIO_WHO_USER
};
#include "xlat/ioprio_who.h"
enum {
IOPRIO_CLASS_NONE,
IOPRIO_CLASS_RT,
IOPRIO_CLASS_BE,
IOPRIO_CLASS_IDLE
};
#include "xlat/ioprio_class.h"
#define IOPRIO_CLASS_SHIFT (13)
#define IOPRIO_PRIO_MASK ((1ul << IOPRIO_CLASS_SHIFT) - 1)
#define IOPRIO_PRIO_CLASS(mask) ((mask) >> IOPRIO_CLASS_SHIFT)
#define IOPRIO_PRIO_DATA(mask) ((mask) & IOPRIO_PRIO_MASK)
static const char *
sprint_ioprio(int ioprio)
{
static char outstr[256];
const char *str;
int class, data;
class = IOPRIO_PRIO_CLASS(ioprio);
data = IOPRIO_PRIO_DATA(ioprio);
str = xlookup(ioprio_class, class);
if (str)
sprintf(outstr, "IOPRIO_PRIO_VALUE(%s,%d)", str, data);
else
sprintf(outstr, "IOPRIO_PRIO_VALUE(%#x /* %s */,%d)",
class, "IOPRIO_CLASS_???", data);
return outstr;
}
int
sys_ioprio_get(struct tcb *tcp)
{
if (entering(tcp)) {
/* int which */
printxval(ioprio_who, tcp->u_arg[0], "IOPRIO_WHO_???");
/* int who */
tprintf(", %d", (int) tcp->u_arg[1]);
return 0;
} else {
if (syserror(tcp))
return 0;
tcp->auxstr = sprint_ioprio(tcp->u_rval);
return RVAL_STR;
}
}
int
sys_ioprio_set(struct tcb *tcp)
{
if (entering(tcp)) {
/* int which */
printxval(ioprio_who, tcp->u_arg[0], "IOPRIO_WHO_???");
/* int who */
tprintf(", %d, ", (int) tcp->u_arg[1]);
/* int ioprio */
tprints(sprint_ioprio(tcp->u_arg[2]));
}
return 0;
}

129
ipc.c
View File

@ -63,93 +63,22 @@
extern void printsigevent(struct tcb *tcp, long arg);
static const struct xlat msgctl_flags[] = {
{ IPC_RMID, "IPC_RMID" },
{ IPC_SET, "IPC_SET" },
{ IPC_STAT, "IPC_STAT" },
{ IPC_INFO, "IPC_INFO" },
{ MSG_STAT, "MSG_STAT" },
{ MSG_INFO, "MSG_INFO" },
{ 0, NULL },
};
static const struct xlat semctl_flags[] = {
{ IPC_RMID, "IPC_RMID" },
{ IPC_SET, "IPC_SET" },
{ IPC_STAT, "IPC_STAT" },
{ IPC_INFO, "IPC_INFO" },
{ SEM_STAT, "SEM_STAT" },
{ SEM_INFO, "SEM_INFO" },
{ GETPID, "GETPID" },
{ GETVAL, "GETVAL" },
{ GETALL, "GETALL" },
{ GETNCNT, "GETNCNT" },
{ GETZCNT, "GETZCNT" },
{ SETVAL, "SETVAL" },
{ SETALL, "SETALL" },
{ 0, NULL },
};
static const struct xlat shmctl_flags[] = {
{ IPC_RMID, "IPC_RMID" },
{ IPC_SET, "IPC_SET" },
{ IPC_STAT, "IPC_STAT" },
{ IPC_INFO, "IPC_INFO" },
{ SHM_STAT, "SHM_STAT" },
{ SHM_INFO, "SHM_INFO" },
#ifdef SHM_LOCK
{ SHM_LOCK, "SHM_LOCK" },
#endif
#ifdef SHM_UNLOCK
{ SHM_UNLOCK, "SHM_UNLOCK" },
#endif
{ 0, NULL },
};
static const struct xlat resource_flags[] = {
{ IPC_CREAT, "IPC_CREAT" },
{ IPC_EXCL, "IPC_EXCL" },
{ IPC_NOWAIT, "IPC_NOWAIT" },
{ 0, NULL },
};
static const struct xlat shm_resource_flags[] = {
{ IPC_CREAT, "IPC_CREAT" },
{ IPC_EXCL, "IPC_EXCL" },
#ifdef SHM_HUGETLB
{ SHM_HUGETLB, "SHM_HUGETLB" },
#endif
{ 0, NULL },
};
static const struct xlat shm_flags[] = {
{ SHM_REMAP, "SHM_REMAP" },
{ SHM_RDONLY, "SHM_RDONLY" },
{ SHM_RND, "SHM_RND" },
{ 0, NULL },
};
static const struct xlat msg_flags[] = {
{ MSG_NOERROR, "MSG_NOERROR" },
{ MSG_EXCEPT, "MSG_EXCEPT" },
{ IPC_NOWAIT, "IPC_NOWAIT" },
{ 0, NULL },
};
static const struct xlat semop_flags[] = {
{ SEM_UNDO, "SEM_UNDO" },
{ IPC_NOWAIT, "IPC_NOWAIT" },
{ 0, NULL },
};
#include "xlat/msgctl_flags.h"
#include "xlat/semctl_flags.h"
#include "xlat/shmctl_flags.h"
#include "xlat/resource_flags.h"
#include "xlat/shm_resource_flags.h"
#include "xlat/shm_flags.h"
#include "xlat/ipc_msg_flags.h"
#include "xlat/semop_flags.h"
int sys_msgget(struct tcb *tcp)
{
if (entering(tcp)) {
if (tcp->u_arg[0])
tprintf("%#lx", tcp->u_arg[0]);
tprintf("%#lx, ", tcp->u_arg[0]);
else
tprints("IPC_PRIVATE");
tprints(", ");
tprints("IPC_PRIVATE, ");
if (printflags(resource_flags, tcp->u_arg[1] & ~0777, NULL) != 0)
tprints("|");
tprintf("%#lo", tcp->u_arg[1] & 0777);
@ -168,16 +97,7 @@ int sys_msgget(struct tcb *tcp)
static int
indirect_ipccall(struct tcb *tcp)
{
#ifdef X86_64
return current_personality == 1;
#endif
#if defined IA64
return tcp->scno < 1024; /* ia32 emulation syscalls are low */
#endif
#if defined(ALPHA) || defined(MIPS) || defined(HPPA) || defined(__ARM_EABI__)
return 0;
#endif
return 1;
return tcp->s_ent->sys_flags & TRACE_INDIRECT_SUBCALL;
}
int sys_msgctl(struct tcb *tcp)
@ -204,7 +124,7 @@ tprint_msgsnd(struct tcb *tcp, long addr, unsigned long count,
tprints("}");
}
tprintf(", %lu, ", count);
printflags(msg_flags, flags, "MSG_???");
printflags(ipc_msg_flags, flags, "MSG_???");
}
int sys_msgsnd(struct tcb *tcp)
@ -255,11 +175,11 @@ int sys_msgrcv(struct tcb *tcp)
tprint_msgrcv(tcp, (long) tmp.msgp,
tcp->u_arg[1], tmp.msgtyp);
}
printflags(msg_flags, tcp->u_arg[2], "MSG_???");
printflags(ipc_msg_flags, tcp->u_arg[2], "MSG_???");
} else {
tprint_msgrcv(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
printflags(msg_flags, tcp->u_arg[4], "MSG_???");
printflags(ipc_msg_flags, tcp->u_arg[4], "MSG_???");
}
}
return 0;
@ -327,10 +247,10 @@ int sys_semtimedop(struct tcb *tcp)
if (indirect_ipccall(tcp)) {
tprint_sembuf(tcp, tcp->u_arg[3], tcp->u_arg[1]);
tprints(", ");
#if defined(S390)
#if defined(S390) || defined(S390X)
printtv(tcp, tcp->u_arg[2]);
#else
printtv(tcp, tcp->u_arg[5]);
printtv(tcp, tcp->u_arg[4]);
#endif
} else {
tprint_sembuf(tcp, tcp->u_arg[1], tcp->u_arg[2]);
@ -348,8 +268,7 @@ int sys_semget(struct tcb *tcp)
tprintf("%#lx", tcp->u_arg[0]);
else
tprints("IPC_PRIVATE");
tprintf(", %lu", tcp->u_arg[1]);
tprints(", ");
tprintf(", %lu, ", tcp->u_arg[1]);
if (printflags(resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
tprints("|");
tprintf("%#lo", tcp->u_arg[2] & 0777);
@ -360,8 +279,7 @@ int sys_semget(struct tcb *tcp)
int sys_semctl(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%lu", tcp->u_arg[0]);
tprintf(", %lu, ", tcp->u_arg[1]);
tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
PRINTCTL(semctl_flags, tcp->u_arg[2], "SEM_???");
tprintf(", %#lx", tcp->u_arg[3]);
}
@ -375,8 +293,7 @@ int sys_shmget(struct tcb *tcp)
tprintf("%#lx", tcp->u_arg[0]);
else
tprints("IPC_PRIVATE");
tprintf(", %lu", tcp->u_arg[1]);
tprints(", ");
tprintf(", %lu, ", tcp->u_arg[1]);
if (printflags(shm_resource_flags, tcp->u_arg[2] & ~0777, NULL) != 0)
tprints("|");
tprintf("%#lo", tcp->u_arg[2] & 0777);
@ -403,12 +320,10 @@ int sys_shmat(struct tcb *tcp)
if (exiting(tcp)) {
tprintf("%lu", tcp->u_arg[0]);
if (indirect_ipccall(tcp)) {
tprintf(", %#lx", tcp->u_arg[3]);
tprints(", ");
tprintf(", %#lx, ", tcp->u_arg[3]);
printflags(shm_flags, tcp->u_arg[1], "SHM_???");
} else {
tprintf(", %#lx", tcp->u_arg[1]);
tprints(", ");
tprintf(", %#lx, ", tcp->u_arg[1]);
printflags(shm_flags, tcp->u_arg[2], "SHM_???");
}
if (syserror(tcp))
@ -452,7 +367,7 @@ sys_mq_open(struct tcb *tcp)
/* mode */
tprintf(", %#lo, ", tcp->u_arg[2]);
if (umove(tcp, tcp->u_arg[3], &attr) < 0)
tprints("{ ??? }");
tprints("{???}");
else
tprintf("{mq_maxmsg=%ld, mq_msgsize=%ld}",
(long) attr.mq_maxmsg,

101
kexec.c Normal file
View File

@ -0,0 +1,101 @@
#include "defs.h"
#include "xlat/kexec_load_flags.h"
#include "xlat/kexec_arch_values.h"
#ifndef KEXEC_ARCH_MASK
# define KEXEC_ARCH_MASK 0xffff0000
#endif
#ifndef KEXEC_SEGMENT_MAX
# define KEXEC_SEGMENT_MAX 16
#endif
static void
print_kexec_segments(struct tcb *tcp, unsigned long addr, unsigned long len)
{
#if SUPPORTED_PERSONALITIES > 1
union {
struct { u_int32_t buf, bufsz, mem, memsz; } seg32;
struct { u_int64_t buf, bufsz, mem, memsz; } seg64;
} seg;
# define sizeof_seg \
(current_wordsize == 4 ? sizeof(seg.seg32) : sizeof(seg.seg64))
# define seg_buf \
(current_wordsize == 4 ? (uint64_t) seg.seg32.buf : seg.seg64.buf)
# define seg_bufsz \
(current_wordsize == 4 ? (uint64_t) seg.seg32.bufsz : seg.seg64.bufsz)
# define seg_mem \
(current_wordsize == 4 ? (uint64_t) seg.seg32.mem : seg.seg64.mem)
# define seg_memsz \
(current_wordsize == 4 ? (uint64_t) seg.seg32.memsz : seg.seg64.memsz)
#else
struct {
void *buf;
size_t bufsz;
void *mem;
size_t memsz;
} seg;
# define sizeof_seg sizeof(seg)
# define seg_buf seg.buf
# define seg_bufsz seg.bufsz
# define seg_mem seg.mem
# define seg_memsz seg.memsz
#endif
unsigned int i, failed;
if (!len) {
tprints("[]");
return;
}
if (len > KEXEC_SEGMENT_MAX) {
tprintf("%#lx", addr);
return;
}
failed = 0;
tprints("[");
for (i = 0; i < len; ++i) {
if (i)
tprints(", ");
if (umoven(tcp, addr + i * sizeof_seg, sizeof_seg,
(char *) &seg) < 0) {
tprints("?");
failed = 1;
break;
}
tprintf("{%#lx, %lu, %#lx, %lu}",
(long) seg_buf, (unsigned long) seg_bufsz,
(long) seg_mem, (unsigned long) seg_memsz);
}
tprints("]");
if (failed)
tprintf(" %#lx", addr);
}
int
sys_kexec_load(struct tcb *tcp)
{
unsigned long n;
if (exiting(tcp))
return 0;
/* entry, nr_segments */
tprintf("%#lx, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
/* segments */
print_kexec_segments(tcp, tcp->u_arg[2], tcp->u_arg[1]);
tprints(", ");
/* flags */
n = tcp->u_arg[3];
printxval(kexec_arch_values, n & KEXEC_ARCH_MASK, "KEXEC_ARCH_???");
n &= ~KEXEC_ARCH_MASK;
if (n) {
tprints("|");
printflags(kexec_load_flags, n, "KEXEC_???");
}
return 0;
}

349
keyctl.c Normal file
View File

@ -0,0 +1,349 @@
#include "defs.h"
typedef int32_t key_serial_t;
#include "xlat/key_spec.h"
static void
print_keyring_serial_number(key_serial_t id)
{
const char *str = xlookup(key_spec, id);
if (str)
tprints(str);
else
tprintf("%d", id);
}
int
sys_add_key(struct tcb *tcp)
{
if (entering(tcp)) {
/* type */
printstr(tcp, tcp->u_arg[0], -1);
/* description */
tprints(", ");
printstr(tcp, tcp->u_arg[1], -1);
/* payload */
tprints(", ");
printstr(tcp, tcp->u_arg[2], tcp->u_arg[3]);
/* payload length */
tprintf(", %lu, ", tcp->u_arg[3]);
/* keyring serial number */
print_keyring_serial_number(tcp->u_arg[4]);
}
return 0;
}
int
sys_request_key(struct tcb *tcp)
{
if (entering(tcp)) {
/* type */
printstr(tcp, tcp->u_arg[0], -1);
/* description */
tprints(", ");
printstr(tcp, tcp->u_arg[1], -1);
/* callout_info */
tprints(", ");
printstr(tcp, tcp->u_arg[2], -1);
/* keyring serial number */
tprints(", ");
print_keyring_serial_number(tcp->u_arg[3]);
}
return 0;
}
static int
keyctl_get_keyring_id(struct tcb *tcp, key_serial_t id, int create)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id);
tprintf(", %d", create);
}
return 0;
}
static int
keyctl_join_session_keyring(struct tcb *tcp, long addr)
{
if (entering(tcp)) {
tprints(", ");
printstr(tcp, addr, -1);
}
return 0;
}
static int
keyctl_update_key(struct tcb *tcp, key_serial_t id, long addr, long len)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id);
tprints(", ");
printstr(tcp, addr, len);
tprintf(", %lu", len);
}
return 0;
}
static int
keyctl_handle_key(struct tcb *tcp, key_serial_t id)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id);
}
return 0;
}
static int
keyctl_handle_key_key(struct tcb *tcp, key_serial_t id1, key_serial_t id2)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id1);
tprints(", ");
print_keyring_serial_number(id2);
}
return 0;
}
static int
keyctl_read_key(struct tcb *tcp, key_serial_t id, long addr, long len)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id);
tprints(", ");
} else {
if (addr && syserror(tcp))
tprintf("%#lx", addr);
else {
long rval = tcp->u_rval > len ?
len : (tcp->u_rval ? -1 : 0);
printstr(tcp, addr, rval);
}
tprintf(", %lu", len);
}
return 0;
}
static int
keyctl_keyring_search(struct tcb *tcp, key_serial_t id1, long addr1,
long addr2, key_serial_t id2)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id1);
tprints(", ");
printstr(tcp, addr1, -1);
tprints(", ");
printstr(tcp, addr2, -1);
tprints(", ");
print_keyring_serial_number(id2);
}
return 0;
}
static int
keyctl_chown_key(struct tcb *tcp, key_serial_t id, int user, int group)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id);
tprintf(", %d, %d", user, group);
}
return 0;
}
static int
keyctl_instantiate_key(struct tcb *tcp, key_serial_t id1, long addr,
long len, key_serial_t id2)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id1);
tprints(", ");
printstr(tcp, addr, len);
tprintf(", %lu, ", len);
print_keyring_serial_number(id2);
}
return 0;
}
static int
keyctl_instantiate_key_iov(struct tcb *tcp, key_serial_t id1,
long addr, long len, key_serial_t id2)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id1);
tprints(", ");
tprint_iov(tcp, len, addr, 1);
tprintf(", %lu, ", len);
print_keyring_serial_number(id2);
}
return 0;
}
static int
keyctl_negate_key(struct tcb *tcp, key_serial_t id1, unsigned timeout,
key_serial_t id2)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id1);
tprintf(", %u, ", timeout);
print_keyring_serial_number(id2);
}
return 0;
}
static int
keyctl_reject_key(struct tcb *tcp, key_serial_t id1, unsigned timeout,
unsigned error, key_serial_t id2)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id1);
tprintf(", %u, %u, ", timeout, error);
print_keyring_serial_number(id2);
}
return 0;
}
static int
keyctl_set_timeout(struct tcb *tcp, key_serial_t id, unsigned timeout)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id);
tprintf(", %u", timeout);
}
return 0;
}
static int
keyctl_get_persistent(struct tcb *tcp, int uid, key_serial_t id)
{
if (entering(tcp)) {
tprintf(", %d, ", uid);
print_keyring_serial_number(id);
}
return 0;
}
#include "xlat/key_perms.h"
static int
keyctl_setperm_key(struct tcb *tcp, key_serial_t id, uint32_t perm)
{
if (entering(tcp)) {
tprints(", ");
print_keyring_serial_number(id);
tprints(", ");
printflags(key_perms, perm, "KEY_???");
}
return 0;
}
#include "xlat/key_reqkeys.h"
static int
keyctl_set_reqkey_keyring(struct tcb *tcp, int reqkey)
{
if (entering(tcp)) {
tprints(", ");
printxval(key_reqkeys, reqkey, "KEY_REQKEY_DEFL_???");
}
return 0;
}
#include "xlat/keyctl_commands.h"
int
sys_keyctl(struct tcb *tcp)
{
int cmd = tcp->u_arg[0];
if (entering(tcp))
printxval(keyctl_commands, cmd, "KEYCTL_???");
switch (cmd) {
case KEYCTL_GET_KEYRING_ID:
return keyctl_get_keyring_id(tcp, tcp->u_arg[1], tcp->u_arg[2]);
case KEYCTL_JOIN_SESSION_KEYRING:
return keyctl_join_session_keyring(tcp, tcp->u_arg[1]);
case KEYCTL_UPDATE:
return keyctl_update_key(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
case KEYCTL_REVOKE:
case KEYCTL_CLEAR:
case KEYCTL_INVALIDATE:
case KEYCTL_ASSUME_AUTHORITY:
return keyctl_handle_key(tcp, tcp->u_arg[1]);
case KEYCTL_LINK:
case KEYCTL_UNLINK:
return keyctl_handle_key_key(tcp, tcp->u_arg[1], tcp->u_arg[2]);
case KEYCTL_DESCRIBE:
case KEYCTL_READ:
case KEYCTL_GET_SECURITY:
return keyctl_read_key(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
case KEYCTL_SEARCH:
return keyctl_keyring_search(tcp, tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
case KEYCTL_CHOWN:
return keyctl_chown_key(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
case KEYCTL_SETPERM:
return keyctl_setperm_key(tcp, tcp->u_arg[1], tcp->u_arg[2]);
case KEYCTL_INSTANTIATE:
return keyctl_instantiate_key(tcp, tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
case KEYCTL_NEGATE:
return keyctl_negate_key(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3]);
case KEYCTL_SET_REQKEY_KEYRING:
return keyctl_set_reqkey_keyring(tcp, tcp->u_arg[1]);
case KEYCTL_SET_TIMEOUT:
return keyctl_set_timeout(tcp, tcp->u_arg[1], tcp->u_arg[2]);
case KEYCTL_SESSION_TO_PARENT:
return 0;
case KEYCTL_REJECT:
return keyctl_reject_key(tcp, tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
case KEYCTL_INSTANTIATE_IOV:
return keyctl_instantiate_key_iov(tcp, tcp->u_arg[1],
tcp->u_arg[2], tcp->u_arg[3],
tcp->u_arg[4]);
case KEYCTL_GET_PERSISTENT:
return keyctl_get_persistent(tcp, tcp->u_arg[1], tcp->u_arg[2]);
default:
if (entering(tcp))
tprintf(", %#lx, %#lx, %#lx, %#lx",
tcp->u_arg[1], tcp->u_arg[2],
tcp->u_arg[3], tcp->u_arg[4]);
}
return 0;
}

110
ldt.c Normal file
View File

@ -0,0 +1,110 @@
#include "defs.h"
#if defined I386 || defined X86_64 || defined X32
# include <asm/ldt.h>
void
print_user_desc(struct tcb *tcp, long addr)
{
struct user_desc desc;
if (umove(tcp, addr, &desc) < 0) {
tprintf("%lx", addr);
return;
}
if (!verbose(tcp)) {
tprintf("{entry_number:%d, ...}", desc.entry_number);
return;
}
tprintf("{entry_number:%d, "
"base_addr:%#08x, "
"limit:%d, "
"seg_32bit:%d, "
"contents:%d, "
"read_exec_only:%d, "
"limit_in_pages:%d, "
"seg_not_present:%d, "
"useable:%d}",
desc.entry_number,
desc.base_addr,
desc.limit,
desc.seg_32bit,
desc.contents,
desc.read_exec_only,
desc.limit_in_pages,
desc.seg_not_present,
desc.useable);
}
int
sys_modify_ldt(struct tcb *tcp)
{
if (entering(tcp)) {
tprintf("%ld, ", tcp->u_arg[0]);
if (tcp->u_arg[1] == 0
|| tcp->u_arg[2] != sizeof(struct user_desc)) {
tprintf("%lx", tcp->u_arg[1]);
} else {
print_user_desc(tcp, tcp->u_arg[1]);
}
tprintf(", %lu", tcp->u_arg[2]);
}
return 0;
}
int
sys_set_thread_area(struct tcb *tcp)
{
if (entering(tcp)) {
print_user_desc(tcp, tcp->u_arg[0]);
} else {
struct user_desc desc;
if (syserror(tcp) || umove(tcp, tcp->u_arg[0], &desc) < 0) {
/* returned entry_number is not available */
} else {
static char outstr[32];
sprintf(outstr, "entry_number:%d", desc.entry_number);
tcp->auxstr = outstr;
return RVAL_STR;
}
}
return 0;
}
int
sys_get_thread_area(struct tcb *tcp)
{
if (exiting(tcp)) {
if (syserror(tcp))
tprintf("%lx", tcp->u_arg[0]);
else
print_user_desc(tcp, tcp->u_arg[0]);
}
return 0;
}
#endif /* I386 || X86_64 || X32 */
#if defined(M68K) || defined(MIPS)
int
sys_set_thread_area(struct tcb *tcp)
{
if (entering(tcp))
tprintf("%#lx", tcp->u_arg[0]);
return 0;
}
#endif
#if defined(M68K)
int
sys_get_thread_area(struct tcb *tcp)
{
return RVAL_HEX;
}
#endif

71
link.c Normal file
View File

@ -0,0 +1,71 @@
#include "defs.h"
#include <fcntl.h>
#ifndef AT_SYMLINK_NOFOLLOW
# define AT_SYMLINK_NOFOLLOW 0x100
#endif
#ifndef AT_REMOVEDIR
# define AT_REMOVEDIR 0x200
#endif
#ifndef AT_SYMLINK_FOLLOW
# define AT_SYMLINK_FOLLOW 0x400
#endif
#ifndef AT_NO_AUTOMOUNT
# define AT_NO_AUTOMOUNT 0x800
#endif
#ifndef AT_EMPTY_PATH
# define AT_EMPTY_PATH 0x1000
#endif
#include "xlat/at_flags.h"
int
sys_link(struct tcb *tcp)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
tprints(", ");
printpath(tcp, tcp->u_arg[1]);
}
return 0;
}
int
sys_linkat(struct tcb *tcp)
{
if (entering(tcp)) {
print_dirfd(tcp, tcp->u_arg[0]);
printpath(tcp, tcp->u_arg[1]);
tprints(", ");
print_dirfd(tcp, tcp->u_arg[2]);
printpath(tcp, tcp->u_arg[3]);
tprints(", ");
printflags(at_flags, tcp->u_arg[4], "AT_???");
}
return 0;
}
int
sys_unlinkat(struct tcb *tcp)
{
if (entering(tcp)) {
print_dirfd(tcp, tcp->u_arg[0]);
printpath(tcp, tcp->u_arg[1]);
tprints(", ");
printflags(at_flags, tcp->u_arg[2], "AT_???");
}
return 0;
}
int
sys_symlinkat(struct tcb *tcp)
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
tprints(", ");
print_dirfd(tcp, tcp->u_arg[1]);
printpath(tcp, tcp->u_arg[2]);
}
return 0;
}

2617
linux/32/ioctls_inc.h Normal file

File diff suppressed because it is too large Load Diff

277
linux/32/syscallent.h Normal file
View File

@ -0,0 +1,277 @@
#ifndef ARCH_sys_mmap
# define ARCH_sys_mmap sys_mmap
#endif
[ 0] = { 2, 0, sys_io_setup, "io_setup" },
[ 1] = { 1, 0, sys_io_destroy, "io_destroy" },
[ 2] = { 3, 0, sys_io_submit, "io_submit" },
[ 3] = { 3, 0, sys_io_cancel, "io_cancel" },
[ 4] = { 5, 0, sys_io_getevents, "io_getevents" },
[ 5] = { 5, TF, sys_setxattr, "setxattr" },
[ 6] = { 5, TF, sys_setxattr, "lsetxattr" },
[ 7] = { 5, TD, sys_fsetxattr, "fsetxattr" },
[ 8] = { 4, TF, sys_getxattr, "getxattr" },
[ 9] = { 4, TF, sys_getxattr, "lgetxattr" },
[ 10] = { 4, TD, sys_fgetxattr, "fgetxattr" },
[ 11] = { 3, TF, sys_listxattr, "listxattr" },
[ 12] = { 3, TF, sys_listxattr, "llistxattr" },
[ 13] = { 3, TD, sys_flistxattr, "flistxattr" },
[ 14] = { 2, TF, sys_removexattr, "removexattr" },
[ 15] = { 2, TF, sys_removexattr, "lremovexattr" },
[ 16] = { 2, TD, sys_fremovexattr, "fremovexattr" },
[ 17] = { 2, TF, sys_getcwd, "getcwd" },
[ 18] = { 4, 0, sys_lookup_dcookie, "lookup_dcookie" },
[ 19] = { 2, TD, sys_eventfd2, "eventfd2" },
[ 20] = { 1, TD, sys_epoll_create1, "epoll_create1" },
[ 21] = { 4, TD, sys_epoll_ctl, "epoll_ctl" },
[ 22] = { 6, TD, sys_epoll_pwait, "epoll_pwait" },
[ 23] = { 1, TD, sys_dup, "dup" },
[ 24] = { 3, TD, sys_dup3, "dup3" },
[ 25] = { 3, TD, sys_fcntl, "fcntl64" },
[ 26] = { 1, TD, sys_inotify_init1, "inotify_init1" },
[ 27] = { 3, TD, sys_inotify_add_watch, "inotify_add_watch" },
[ 28] = { 2, TD, sys_inotify_rm_watch, "inotify_rm_watch" },
[ 29] = { 3, TD, sys_ioctl, "ioctl" },
[ 30] = { 3, 0, sys_ioprio_set, "ioprio_set" },
[ 31] = { 2, 0, sys_ioprio_get, "ioprio_get" },
[ 32] = { 2, TD, sys_flock, "flock" },
[ 33] = { 4, TD|TF, sys_mknodat, "mknodat" },
[ 34] = { 3, TD|TF, sys_mkdirat, "mkdirat" },
[ 35] = { 3, TD|TF, sys_unlinkat, "unlinkat" },
[ 36] = { 3, TD|TF, sys_symlinkat, "symlinkat" },
[ 37] = { 5, TD|TF, sys_linkat, "linkat" },
[ 38] = { 4, TD|TF, sys_renameat, "renameat" },
[ 39] = { 2, TF, sys_umount2, "umount2" },
[ 40] = { 5, TF, sys_mount, "mount" },
[ 41] = { 2, TF, sys_pivotroot, "pivot_root" },
[ 42] = { 3, 0, sys_nfsservctl, "nfsservctl" },
[ 43] = { 3, TF, sys_statfs64, "statfs64" },
[ 44] = { 3, TD, sys_fstatfs64, "fstatfs64" },
[ 45] = { 3, TF, sys_truncate64, "truncate64" },
[ 46] = { 3, TD, sys_ftruncate64, "ftruncate64" },
[ 47] = { 6, TD, sys_fallocate, "fallocate" },
[ 48] = { 3, TD|TF, sys_faccessat, "faccessat" },
[ 49] = { 1, TF, sys_chdir, "chdir" },
[ 50] = { 1, TD, sys_fchdir, "fchdir" },
[ 51] = { 1, TF, sys_chroot, "chroot" },
[ 52] = { 2, TD, sys_fchmod, "fchmod" },
[ 53] = { 3, TD|TF, sys_fchmodat, "fchmodat" },
[ 54] = { 5, TD|TF, sys_fchownat, "fchownat" },
[ 55] = { 3, TD, sys_fchown, "fchown" },
[ 56] = { 4, TD|TF, sys_openat, "openat" },
[ 57] = { 1, TD, sys_close, "close" },
[ 58] = { 0, 0, sys_vhangup, "vhangup" },
[ 59] = { 2, TD, sys_pipe2, "pipe2" },
[ 60] = { 4, TF, sys_quotactl, "quotactl" },
[ 61] = { 3, TD, sys_getdents64, "getdents64" },
[ 62] = { 5, TD, sys_llseek, "_llseek" },
[ 63] = { 3, TD, sys_read, "read" },
[ 64] = { 3, TD, sys_write, "write" },
[ 65] = { 3, TD, sys_readv, "readv" },
[ 66] = { 3, TD, sys_writev, "writev" },
[ 67] = { 5, TD, sys_pread, "pread64" },
[ 68] = { 5, TD, sys_pwrite, "pwrite64" },
[ 69] = { 5, TD, sys_preadv, "preadv" },
[ 70] = { 5, TD, sys_pwritev, "pwritev" },
[ 71] = { 4, TD|TN, sys_sendfile64, "sendfile64" },
[ 72] = { 6, TD, sys_pselect6, "pselect6" },
[ 73] = { 5, TD, sys_ppoll, "ppoll" },
[ 74] = { 4, TD|TS, sys_signalfd4, "signalfd4" },
[ 75] = { 4, TD, sys_vmsplice, "vmsplice" },
[ 76] = { 6, TD, sys_splice, "splice" },
[ 77] = { 4, TD, sys_tee, "tee" },
[ 78] = { 4, TD|TF, sys_readlinkat, "readlinkat" },
[ 79] = { 4, TD|TF, sys_newfstatat, "fstatat64" },
[ 80] = { 2, TD, sys_fstat64, "fstat64" },
[ 81] = { 0, 0, sys_sync, "sync" },
[ 82] = { 1, TD, sys_fsync, "fsync" },
[ 83] = { 1, TD, sys_fdatasync, "fdatasync" },
#ifdef ARCH_WANT_SYNC_FILE_RANGE2
[ 84] = { 6, TD, sys_sync_file_range2, "sync_file_range2" },
#else
[ 84] = { 6, TD, sys_sync_file_range, "sync_file_range" },
#endif
[ 85] = { 2, TD, sys_timerfd_create, "timerfd_create" },
[ 86] = { 4, TD, sys_timerfd_settime, "timerfd_settime" },
[ 87] = { 2, TD, sys_timerfd_gettime, "timerfd_gettime" },
[ 88] = { 4, TD|TF, sys_utimensat, "utimensat" },
[ 89] = { 1, TF, sys_acct, "acct" },
[ 90] = { 2, 0, sys_capget, "capget" },
[ 91] = { 2, 0, sys_capset, "capset" },
[ 92] = { 1, 0, sys_personality, "personality" },
[ 93] = { 1, TP|SE, sys_exit, "exit" },
[ 94] = { 1, TP|SE, sys_exit, "exit_group" },
[ 95] = { 5, TP, sys_waitid, "waitid" },
[ 96] = { 1, 0, sys_set_tid_address, "set_tid_address" },
[ 97] = { 1, TP, sys_unshare, "unshare" },
[ 98] = { 6, 0, sys_futex, "futex" },
[ 99] = { 2, 0, sys_set_robust_list, "set_robust_list" },
[100] = { 3, 0, sys_get_robust_list, "get_robust_list" },
[101] = { 2, 0, sys_nanosleep, "nanosleep" },
[102] = { 2, 0, sys_getitimer, "getitimer" },
[103] = { 3, 0, sys_setitimer, "setitimer" },
[104] = { 4, 0, sys_kexec_load, "kexec_load" },
[105] = { 3, 0, sys_init_module, "init_module" },
[106] = { 2, 0, sys_delete_module, "delete_module" },
[107] = { 3, 0, sys_timer_create, "timer_create" },
[108] = { 2, 0, sys_timer_gettime, "timer_gettime" },
[109] = { 1, 0, sys_timer_getoverrun, "timer_getoverrun" },
[110] = { 4, 0, sys_timer_settime, "timer_settime" },
[111] = { 1, 0, sys_timer_delete, "timer_delete" },
[112] = { 2, 0, sys_clock_settime, "clock_settime" },
[113] = { 2, 0, sys_clock_gettime, "clock_gettime" },
[114] = { 2, 0, sys_clock_getres, "clock_getres" },
[115] = { 4, 0, sys_clock_nanosleep, "clock_nanosleep" },
[116] = { 3, 0, sys_syslog, "syslog" },
[117] = { 4, 0, sys_ptrace, "ptrace" },
[118] = { 2, 0, sys_sched_setparam, "sched_setparam" },
[119] = { 3, 0, sys_sched_setscheduler, "sched_setscheduler" },
[120] = { 1, 0, sys_sched_getscheduler, "sched_getscheduler" },
[121] = { 2, 0, sys_sched_getparam, "sched_getparam" },
[122] = { 3, 0, sys_sched_setaffinity, "sched_setaffinity" },
[123] = { 3, 0, sys_sched_getaffinity, "sched_getaffinity" },
[124] = { 0, 0, sys_sched_yield, "sched_yield" },
[125] = { 1, 0, sys_sched_get_priority_max, "sched_get_priority_max"},
[126] = { 1, 0, sys_sched_get_priority_min, "sched_get_priority_min"},
[127] = { 2, 0, sys_sched_rr_get_interval, "sched_rr_get_interval" },
[128] = { 0, 0, sys_restart_syscall, "restart_syscall" },
[129] = { 2, TS, sys_kill, "kill" },
[130] = { 2, TS, sys_kill, "tkill" },
[131] = { 3, TS, sys_tgkill, "tgkill" },
[132] = { 2, TS, sys_sigaltstack, "sigaltstack" },
[133] = { 2, TS, sys_rt_sigsuspend, "rt_sigsuspend" },
[134] = { 4, TS, sys_rt_sigaction, "rt_sigaction" },
[135] = { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask" },
[136] = { 2, TS, sys_rt_sigpending, "rt_sigpending" },
[137] = { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait" },
[138] = { 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo" },
[139] = { 0, TS, sys_rt_sigreturn, "rt_sigreturn" },
[140] = { 3, 0, sys_setpriority, "setpriority" },
[141] = { 2, 0, sys_getpriority, "getpriority" },
[142] = { 4, 0, sys_reboot, "reboot" },
[143] = { 2, 0, sys_setregid, "setregid" },
[144] = { 1, 0, sys_setgid, "setgid" },
[145] = { 2, 0, sys_setreuid, "setreuid" },
[146] = { 1, 0, sys_setuid, "setuid" },
[147] = { 3, 0, sys_setresuid, "setresuid" },
[148] = { 3, 0, sys_getresuid, "getresuid" },
[149] = { 3, 0, sys_setresgid, "setresgid" },
[150] = { 3, 0, sys_getresgid, "getresgid" },
[151] = { 1, NF, sys_setfsuid, "setfsuid" },
[152] = { 1, NF, sys_setfsgid, "setfsgid" },
[153] = { 1, 0, sys_times, "times" },
[154] = { 2, 0, sys_setpgid, "setpgid" },
[155] = { 1, 0, sys_getpgid, "getpgid" },
[156] = { 1, 0, sys_getsid, "getsid" },
[157] = { 0, 0, sys_setsid, "setsid" },
[158] = { 2, 0, sys_getgroups, "getgroups" },
[159] = { 2, 0, sys_setgroups, "setgroups" },
[160] = { 1, 0, sys_uname, "uname" },
[161] = { 2, 0, sys_sethostname, "sethostname" },
[162] = { 2, 0, sys_setdomainname, "setdomainname" },
[163] = { 2, 0, sys_getrlimit, "getrlimit" },
[164] = { 2, 0, sys_setrlimit, "setrlimit" },
[165] = { 2, 0, sys_getrusage, "getrusage" },
[166] = { 1, 0, sys_umask, "umask" },
[167] = { 5, 0, sys_prctl, "prctl" },
[168] = { 3, 0, sys_getcpu, "getcpu" },
[169] = { 2, 0, sys_gettimeofday, "gettimeofday" },
[170] = { 2, 0, sys_settimeofday, "settimeofday" },
[171] = { 1, 0, sys_adjtimex, "adjtimex" },
[172] = { 0, 0, sys_getpid, "getpid" },
[173] = { 0, 0, sys_getppid, "getppid" },
[174] = { 0, NF, sys_getuid, "getuid" },
[175] = { 0, NF, sys_geteuid, "geteuid" },
[176] = { 0, NF, sys_getgid, "getgid" },
[177] = { 0, NF, sys_getegid, "getegid" },
[178] = { 0, 0, sys_gettid, "gettid" },
[179] = { 1, 0, sys_sysinfo, "sysinfo" },
[180] = { 4, 0, sys_mq_open, "mq_open" },
[181] = { 1, 0, sys_mq_unlink, "mq_unlink" },
[182] = { 5, 0, sys_mq_timedsend, "mq_timedsend" },
[183] = { 5, 0, sys_mq_timedreceive, "mq_timedreceive" },
[184] = { 2, 0, sys_mq_notify, "mq_notify" },
[185] = { 3, 0, sys_mq_getsetattr, "mq_getsetattr" },
[186] = { 2, TI, sys_msgget, "msgget" },
[187] = { 3, TI, sys_msgctl, "msgctl" },
[188] = { 5, TI, sys_msgrcv, "msgrcv" },
[189] = { 4, TI, sys_msgsnd, "msgsnd" },
[190] = { 3, TI, sys_semget, "semget" },
[191] = { 4, TI, sys_semctl, "semctl" },
[192] = { 4, TI, sys_semtimedop, "semtimedop" },
[193] = { 3, TI, sys_semop, "semop" },
[194] = { 3, TI, sys_shmget, "shmget" },
[195] = { 3, TI, sys_shmctl, "shmctl" },
[196] = { 3, TI|TM|SI, sys_shmat, "shmat" },
[197] = { 1, TI|TM|SI, sys_shmdt, "shmdt" },
[198] = { 3, TN, sys_socket, "socket" },
[199] = { 4, TN, sys_socketpair, "socketpair" },
[200] = { 3, TN, sys_bind, "bind" },
[201] = { 2, TN, sys_listen, "listen" },
[202] = { 3, TN, sys_accept, "accept" },
[203] = { 3, TN, sys_connect, "connect" },
[204] = { 3, TN, sys_getsockname, "getsockname" },
[205] = { 3, TN, sys_getpeername, "getpeername" },
[206] = { 6, TN, sys_sendto, "sendto" },
[207] = { 6, TN, sys_recvfrom, "recvfrom" },
[208] = { 5, TN, sys_setsockopt, "setsockopt" },
[209] = { 5, TN, sys_getsockopt, "getsockopt" },
[210] = { 2, TN, sys_shutdown, "shutdown" },
[211] = { 3, TN, sys_sendmsg, "sendmsg" },
[212] = { 3, TN, sys_recvmsg, "recvmsg" },
[213] = { 4, TD, sys_readahead, "readahead" },
[214] = { 1, TM|SI, sys_brk, "brk" },
[215] = { 2, TM|SI, sys_munmap, "munmap" },
[216] = { 5, TM|SI, sys_mremap, "mremap" },
[217] = { 5, 0, sys_add_key, "add_key" },
[218] = { 4, 0, sys_request_key, "request_key" },
[219] = { 5, 0, sys_keyctl, "keyctl" },
[220] = { 5, TP, sys_clone, "clone" },
[221] = { 3, TF|TP|SE|SI, sys_execve, "execve" },
[222] = { 6, TD|TM|SI, ARCH_sys_mmap, "mmap2" },
[223] = { 6, TD, sys_fadvise64_64, "fadvise64_64" },
[224] = { 2, TF, sys_swapon, "swapon" },
[225] = { 1, TF, sys_swapoff, "swapoff" },
[226] = { 3, TM|SI, sys_mprotect, "mprotect" },
[227] = { 3, TM, sys_msync, "msync" },
[228] = { 2, TM, sys_mlock, "mlock" },
[229] = { 2, TM, sys_munlock, "munlock" },
[230] = { 1, TM, sys_mlockall, "mlockall" },
[231] = { 0, TM, sys_munlockall, "munlockall" },
[232] = { 3, TM, sys_mincore, "mincore" },
[233] = { 3, TM, sys_madvise, "madvise" },
[234] = { 5, TM|SI, sys_remap_file_pages, "remap_file_pages" },
[235] = { 6, TM, sys_mbind, "mbind" },
[236] = { 5, TM, sys_get_mempolicy, "get_mempolicy" },
[237] = { 3, TM, sys_set_mempolicy, "set_mempolicy" },
[238] = { 4, TM, sys_migrate_pages, "migrate_pages" },
[239] = { 6, TM, sys_move_pages, "move_pages" },
[240] = { 4, TP|TS, sys_rt_tgsigqueueinfo, "rt_tgsigqueueinfo" },
[241] = { 5, TD, sys_perf_event_open, "perf_event_open" },
[242] = { 4, TN, sys_accept4, "accept4" },
[243] = { 5, TN, sys_recvmmsg, "recvmmsg" },
/* [244 ... 259] are arch specific */
[260] = { 4, TP, sys_wait4, "wait4" },
[261] = { 4, 0, sys_prlimit64, "prlimit64" },
[262] = { 2, TD, sys_fanotify_init, "fanotify_init" },
[263] = { 6, TD|TF, sys_fanotify_mark, "fanotify_mark" },
[264] = { 5, TD|TF, sys_name_to_handle_at, "name_to_handle_at" },
[265] = { 3, TD, sys_open_by_handle_at, "open_by_handle_at" },
[266] = { 2, 0, sys_clock_adjtime, "clock_adjtime" },
[267] = { 1, TD, sys_syncfs, "syncfs" },
[268] = { 2, TD, sys_setns, "setns" },
[269] = { 4, TN, sys_sendmmsg, "sendmmsg" },
[270] = { 6, 0, sys_process_vm_readv, "process_vm_readv" },
[271] = { 6, 0, sys_process_vm_writev, "process_vm_writev" },
[272] = { 5, 0, sys_kcmp, "kcmp" },
[273] = { 3, TD, sys_finit_module, "finit_module" },
[274] = { 3, 0, sys_sched_setattr, "sched_setattr" },
[275] = { 4, 0, sys_sched_getattr, "sched_getattr" },
[276] = { 5, TD|TF, sys_renameat2, "renameat2" },
[277] = { 3, 0, sys_seccomp, "seccomp", },
[278] = { 3, 0, sys_getrandom, "getrandom", },
[279] = { 2, TD, sys_memfd_create, "memfd_create", },
[280] = { 3, TD, sys_bpf, "bpf", },
[281] = { 5, TD|TF|TP|SE|SI, sys_execveat, "execveat", },
#undef ARCH_sys_mmap
#undef ARCH_WANT_SYNC_FILE_RANGE2

2617
linux/64/ioctls_inc.h Normal file

File diff suppressed because it is too large Load Diff

267
linux/64/syscallent.h Normal file
View File

@ -0,0 +1,267 @@
[ 0] = { 2, 0, sys_io_setup, "io_setup" },
[ 1] = { 1, 0, sys_io_destroy, "io_destroy" },
[ 2] = { 3, 0, sys_io_submit, "io_submit" },
[ 3] = { 3, 0, sys_io_cancel, "io_cancel" },
[ 4] = { 5, 0, sys_io_getevents, "io_getevents" },
[ 5] = { 5, TF, sys_setxattr, "setxattr" },
[ 6] = { 5, TF, sys_setxattr, "lsetxattr" },
[ 7] = { 5, TD, sys_fsetxattr, "fsetxattr" },
[ 8] = { 4, TF, sys_getxattr, "getxattr" },
[ 9] = { 4, TF, sys_getxattr, "lgetxattr" },
[ 10] = { 4, TD, sys_fgetxattr, "fgetxattr" },
[ 11] = { 3, TF, sys_listxattr, "listxattr" },
[ 12] = { 3, TF, sys_listxattr, "llistxattr" },
[ 13] = { 3, TD, sys_flistxattr, "flistxattr" },
[ 14] = { 2, TF, sys_removexattr, "removexattr" },
[ 15] = { 2, TF, sys_removexattr, "lremovexattr" },
[ 16] = { 2, TD, sys_fremovexattr, "fremovexattr" },
[ 17] = { 2, TF, sys_getcwd, "getcwd" },
[ 18] = { 3, 0, sys_lookup_dcookie, "lookup_dcookie" },
[ 19] = { 2, TD, sys_eventfd2, "eventfd2" },
[ 20] = { 1, TD, sys_epoll_create1, "epoll_create1" },
[ 21] = { 4, TD, sys_epoll_ctl, "epoll_ctl" },
[ 22] = { 6, TD, sys_epoll_pwait, "epoll_pwait" },
[ 23] = { 1, TD, sys_dup, "dup" },
[ 24] = { 3, TD, sys_dup3, "dup3" },
[ 25] = { 3, TD, sys_fcntl, "fcntl" },
[ 26] = { 1, TD, sys_inotify_init1, "inotify_init1" },
[ 27] = { 3, TD, sys_inotify_add_watch, "inotify_add_watch" },
[ 28] = { 2, TD, sys_inotify_rm_watch, "inotify_rm_watch" },
[ 29] = { 3, TD, sys_ioctl, "ioctl" },
[ 30] = { 3, 0, sys_ioprio_set, "ioprio_set" },
[ 31] = { 2, 0, sys_ioprio_get, "ioprio_get" },
[ 32] = { 2, TD, sys_flock, "flock" },
[ 33] = { 4, TD|TF, sys_mknodat, "mknodat" },
[ 34] = { 3, TD|TF, sys_mkdirat, "mkdirat" },
[ 35] = { 3, TD|TF, sys_unlinkat, "unlinkat" },
[ 36] = { 3, TD|TF, sys_symlinkat, "symlinkat" },
[ 37] = { 5, TD|TF, sys_linkat, "linkat" },
[ 38] = { 4, TD|TF, sys_renameat, "renameat" },
[ 39] = { 2, TF, sys_umount2, "umount2" },
[ 40] = { 5, TF, sys_mount, "mount" },
[ 41] = { 2, TF, sys_pivotroot, "pivot_root" },
[ 42] = { 3, 0, sys_nfsservctl, "nfsservctl" },
[ 43] = { 2, TF, sys_statfs, "statfs" },
[ 44] = { 2, TD, sys_fstatfs, "fstatfs" },
[ 45] = { 2, TF, sys_truncate, "truncate" },
[ 46] = { 2, TD, sys_ftruncate, "ftruncate" },
[ 47] = { 4, TD, sys_fallocate, "fallocate" },
[ 48] = { 3, TD|TF, sys_faccessat, "faccessat" },
[ 49] = { 1, TF, sys_chdir, "chdir" },
[ 50] = { 1, TD, sys_fchdir, "fchdir" },
[ 51] = { 1, TF, sys_chroot, "chroot" },
[ 52] = { 2, TD, sys_fchmod, "fchmod" },
[ 53] = { 3, TD|TF, sys_fchmodat, "fchmodat" },
[ 54] = { 5, TD|TF, sys_fchownat, "fchownat" },
[ 55] = { 3, TD, sys_fchown, "fchown" },
[ 56] = { 4, TD|TF, sys_openat, "openat" },
[ 57] = { 1, TD, sys_close, "close" },
[ 58] = { 0, 0, sys_vhangup, "vhangup" },
[ 59] = { 2, TD, sys_pipe2, "pipe2" },
[ 60] = { 4, TF, sys_quotactl, "quotactl" },
[ 61] = { 3, TD, sys_getdents64, "getdents64" },
[ 62] = { 3, TD, sys_lseek, "lseek" },
[ 63] = { 3, TD, sys_read, "read" },
[ 64] = { 3, TD, sys_write, "write" },
[ 65] = { 3, TD, sys_readv, "readv" },
[ 66] = { 3, TD, sys_writev, "writev" },
[ 67] = { 4, TD, sys_pread, "pread64" },
[ 68] = { 4, TD, sys_pwrite, "pwrite64" },
[ 69] = { 4, TD, sys_preadv, "preadv" },
[ 70] = { 4, TD, sys_pwritev, "pwritev" },
[ 71] = { 4, TD|TN, sys_sendfile64, "sendfile" },
[ 72] = { 6, TD, sys_pselect6, "pselect6" },
[ 73] = { 5, TD, sys_ppoll, "ppoll" },
[ 74] = { 4, TD|TS, sys_signalfd4, "signalfd4" },
[ 75] = { 4, TD, sys_vmsplice, "vmsplice" },
[ 76] = { 6, TD, sys_splice, "splice" },
[ 77] = { 4, TD, sys_tee, "tee" },
[ 78] = { 4, TD|TF, sys_readlinkat, "readlinkat" },
[ 79] = { 4, TD|TF, sys_newfstatat, "newfstatat" },
[ 80] = { 2, TD, sys_fstat, "fstat" },
[ 81] = { 0, 0, sys_sync, "sync" },
[ 82] = { 1, TD, sys_fsync, "fsync" },
[ 83] = { 1, TD, sys_fdatasync, "fdatasync" },
[ 84] = { 4, TD, sys_sync_file_range, "sync_file_range" },
[ 85] = { 2, TD, sys_timerfd_create, "timerfd_create" },
[ 86] = { 4, TD, sys_timerfd_settime, "timerfd_settime" },
[ 87] = { 2, TD, sys_timerfd_gettime, "timerfd_gettime" },
[ 88] = { 4, TD|TF, sys_utimensat, "utimensat" },
[ 89] = { 1, TF, sys_acct, "acct" },
[ 90] = { 2, 0, sys_capget, "capget" },
[ 91] = { 2, 0, sys_capset, "capset" },
[ 92] = { 1, 0, sys_personality, "personality" },
[ 93] = { 1, TP|SE, sys_exit, "exit" },
[ 94] = { 1, TP|SE, sys_exit, "exit_group" },
[ 95] = { 5, TP, sys_waitid, "waitid" },
[ 96] = { 1, 0, sys_set_tid_address, "set_tid_address" },
[ 97] = { 1, TP, sys_unshare, "unshare" },
[ 98] = { 6, 0, sys_futex, "futex" },
[ 99] = { 2, 0, sys_set_robust_list, "set_robust_list" },
[100] = { 3, 0, sys_get_robust_list, "get_robust_list" },
[101] = { 2, 0, sys_nanosleep, "nanosleep" },
[102] = { 2, 0, sys_getitimer, "getitimer" },
[103] = { 3, 0, sys_setitimer, "setitimer" },
[104] = { 4, 0, sys_kexec_load, "kexec_load" },
[105] = { 3, 0, sys_init_module, "init_module" },
[106] = { 2, 0, sys_delete_module, "delete_module" },
[107] = { 3, 0, sys_timer_create, "timer_create" },
[108] = { 2, 0, sys_timer_gettime, "timer_gettime" },
[109] = { 1, 0, sys_timer_getoverrun, "timer_getoverrun" },
[110] = { 4, 0, sys_timer_settime, "timer_settime" },
[111] = { 1, 0, sys_timer_delete, "timer_delete" },
[112] = { 2, 0, sys_clock_settime, "clock_settime" },
[113] = { 2, 0, sys_clock_gettime, "clock_gettime" },
[114] = { 2, 0, sys_clock_getres, "clock_getres" },
[115] = { 4, 0, sys_clock_nanosleep, "clock_nanosleep" },
[116] = { 3, 0, sys_syslog, "syslog" },
[117] = { 4, 0, sys_ptrace, "ptrace" },
[118] = { 2, 0, sys_sched_setparam, "sched_setparam" },
[119] = { 3, 0, sys_sched_setscheduler, "sched_setscheduler" },
[120] = { 1, 0, sys_sched_getscheduler, "sched_getscheduler" },
[121] = { 2, 0, sys_sched_getparam, "sched_getparam" },
[122] = { 3, 0, sys_sched_setaffinity, "sched_setaffinity" },
[123] = { 3, 0, sys_sched_getaffinity, "sched_getaffinity" },
[124] = { 0, 0, sys_sched_yield, "sched_yield" },
[125] = { 1, 0, sys_sched_get_priority_max, "sched_get_priority_max"},
[126] = { 1, 0, sys_sched_get_priority_min, "sched_get_priority_min"},
[127] = { 2, 0, sys_sched_rr_get_interval, "sched_rr_get_interval" },
[128] = { 0, 0, sys_restart_syscall, "restart_syscall" },
[129] = { 2, TS, sys_kill, "kill" },
[130] = { 2, TS, sys_kill, "tkill" },
[131] = { 3, TS, sys_tgkill, "tgkill" },
[132] = { 2, TS, sys_sigaltstack, "sigaltstack" },
[133] = { 2, TS, sys_rt_sigsuspend, "rt_sigsuspend" },
[134] = { 4, TS, sys_rt_sigaction, "rt_sigaction" },
[135] = { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask" },
[136] = { 2, TS, sys_rt_sigpending, "rt_sigpending" },
[137] = { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait" },
[138] = { 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo" },
[139] = { 0, TS, sys_sigreturn, "rt_sigreturn" },
[140] = { 3, 0, sys_setpriority, "setpriority" },
[141] = { 2, 0, sys_getpriority, "getpriority" },
[142] = { 4, 0, sys_reboot, "reboot" },
[143] = { 2, 0, sys_setregid, "setregid" },
[144] = { 1, 0, sys_setgid, "setgid" },
[145] = { 2, 0, sys_setreuid, "setreuid" },
[146] = { 1, 0, sys_setuid, "setuid" },
[147] = { 3, 0, sys_setresuid, "setresuid" },
[148] = { 3, 0, sys_getresuid, "getresuid" },
[149] = { 3, 0, sys_setresgid, "setresgid" },
[150] = { 3, 0, sys_getresgid, "getresgid" },
[151] = { 1, NF, sys_setfsuid, "setfsuid" },
[152] = { 1, NF, sys_setfsgid, "setfsgid" },
[153] = { 1, 0, sys_times, "times" },
[154] = { 2, 0, sys_setpgid, "setpgid" },
[155] = { 1, 0, sys_getpgid, "getpgid" },
[156] = { 1, 0, sys_getsid, "getsid" },
[157] = { 0, 0, sys_setsid, "setsid" },
[158] = { 2, 0, sys_getgroups, "getgroups" },
[159] = { 2, 0, sys_setgroups, "setgroups" },
[160] = { 1, 0, sys_uname, "uname" },
[161] = { 2, 0, sys_sethostname, "sethostname" },
[162] = { 2, 0, sys_setdomainname, "setdomainname" },
[163] = { 2, 0, sys_getrlimit, "getrlimit" },
[164] = { 2, 0, sys_setrlimit, "setrlimit" },
[165] = { 2, 0, sys_getrusage, "getrusage" },
[166] = { 1, 0, sys_umask, "umask" },
[167] = { 5, 0, sys_prctl, "prctl" },
[168] = { 3, 0, sys_getcpu, "getcpu" },
[169] = { 2, 0, sys_gettimeofday, "gettimeofday" },
[170] = { 2, 0, sys_settimeofday, "settimeofday" },
[171] = { 1, 0, sys_adjtimex, "adjtimex" },
[172] = { 0, 0, sys_getpid, "getpid" },
[173] = { 0, 0, sys_getppid, "getppid" },
[174] = { 0, NF, sys_getuid, "getuid" },
[175] = { 0, NF, sys_geteuid, "geteuid" },
[176] = { 0, NF, sys_getgid, "getgid" },
[177] = { 0, NF, sys_getegid, "getegid" },
[178] = { 0, 0, sys_gettid, "gettid" },
[179] = { 1, 0, sys_sysinfo, "sysinfo" },
[180] = { 4, 0, sys_mq_open, "mq_open" },
[181] = { 1, 0, sys_mq_unlink, "mq_unlink" },
[182] = { 5, 0, sys_mq_timedsend, "mq_timedsend" },
[183] = { 5, 0, sys_mq_timedreceive, "mq_timedreceive" },
[184] = { 2, 0, sys_mq_notify, "mq_notify" },
[185] = { 3, 0, sys_mq_getsetattr, "mq_getsetattr" },
[186] = { 2, TI, sys_msgget, "msgget" },
[187] = { 3, TI, sys_msgctl, "msgctl" },
[188] = { 5, TI, sys_msgrcv, "msgrcv" },
[189] = { 4, TI, sys_msgsnd, "msgsnd" },
[190] = { 3, TI, sys_semget, "semget" },
[191] = { 4, TI, sys_semctl, "semctl" },
[192] = { 4, TI, sys_semtimedop, "semtimedop" },
[193] = { 3, TI, sys_semop, "semop" },
[194] = { 3, TI, sys_shmget, "shmget" },
[195] = { 3, TI, sys_shmctl, "shmctl" },
[196] = { 3, TI|TM|SI, sys_shmat, "shmat" },
[197] = { 1, TI|TM|SI, sys_shmdt, "shmdt" },
[198] = { 3, TN, sys_socket, "socket" },
[199] = { 4, TN, sys_socketpair, "socketpair" },
[200] = { 3, TN, sys_bind, "bind" },
[201] = { 2, TN, sys_listen, "listen" },
[202] = { 3, TN, sys_accept, "accept" },
[203] = { 3, TN, sys_connect, "connect" },
[204] = { 3, TN, sys_getsockname, "getsockname" },
[205] = { 3, TN, sys_getpeername, "getpeername" },
[206] = { 6, TN, sys_sendto, "sendto" },
[207] = { 6, TN, sys_recvfrom, "recvfrom" },
[208] = { 5, TN, sys_setsockopt, "setsockopt" },
[209] = { 5, TN, sys_getsockopt, "getsockopt" },
[210] = { 2, TN, sys_shutdown, "shutdown" },
[211] = { 3, TN, sys_sendmsg, "sendmsg" },
[212] = { 3, TN, sys_recvmsg, "recvmsg" },
[213] = { 3, TD, sys_readahead, "readahead" },
[214] = { 1, TM|SI, sys_brk, "brk" },
[215] = { 2, TM|SI, sys_munmap, "munmap" },
[216] = { 5, TM|SI, sys_mremap, "mremap" },
[217] = { 5, 0, sys_add_key, "add_key" },
[218] = { 4, 0, sys_request_key, "request_key" },
[219] = { 5, 0, sys_keyctl, "keyctl" },
[220] = { 5, TP, sys_clone, "clone" },
[221] = { 3, TF|TP|SE|SI, sys_execve, "execve" },
[222] = { 6, TD|TM|SI, sys_mmap, "mmap" },
[223] = { 4, TD, sys_fadvise64, "fadvise64" },
[224] = { 2, TF, sys_swapon, "swapon" },
[225] = { 1, TF, sys_swapoff, "swapoff" },
[226] = { 3, TM|SI, sys_mprotect, "mprotect" },
[227] = { 3, TM, sys_msync, "msync" },
[228] = { 2, TM, sys_mlock, "mlock" },
[229] = { 2, TM, sys_munlock, "munlock" },
[230] = { 1, TM, sys_mlockall, "mlockall" },
[231] = { 0, TM, sys_munlockall, "munlockall" },
[232] = { 3, TM, sys_mincore, "mincore" },
[233] = { 3, TM, sys_madvise, "madvise" },
[234] = { 5, TM|SI, sys_remap_file_pages, "remap_file_pages" },
[235] = { 6, TM, sys_mbind, "mbind" },
[236] = { 5, TM, sys_get_mempolicy, "get_mempolicy" },
[237] = { 3, TM, sys_set_mempolicy, "set_mempolicy" },
[238] = { 4, TM, sys_migrate_pages, "migrate_pages" },
[239] = { 6, TM, sys_move_pages, "move_pages" },
[240] = { 4, TP|TS, sys_rt_tgsigqueueinfo, "rt_tgsigqueueinfo" },
[241] = { 5, TD, sys_perf_event_open, "perf_event_open" },
[242] = { 4, TN, sys_accept4, "accept4" },
[243] = { 5, TN, sys_recvmmsg, "recvmmsg" },
/* [244 ... 259] are arch specific */
[260] = { 4, TP, sys_wait4, "wait4" },
[261] = { 4, 0, sys_prlimit64, "prlimit64" },
[262] = { 2, TD, sys_fanotify_init, "fanotify_init" },
[263] = { 5, TD|TF, sys_fanotify_mark, "fanotify_mark" },
[264] = { 5, TD|TF, sys_name_to_handle_at, "name_to_handle_at" },
[265] = { 3, TD, sys_open_by_handle_at, "open_by_handle_at" },
[266] = { 2, 0, sys_clock_adjtime, "clock_adjtime" },
[267] = { 1, TD, sys_syncfs, "syncfs" },
[268] = { 2, TD, sys_setns, "setns" },
[269] = { 4, TN, sys_sendmmsg, "sendmmsg" },
[270] = { 6, 0, sys_process_vm_readv, "process_vm_readv" },
[271] = { 6, 0, sys_process_vm_writev, "process_vm_writev" },
[272] = { 5, 0, sys_kcmp, "kcmp" },
[273] = { 3, TD, sys_finit_module, "finit_module" },
[274] = { 3, 0, sys_sched_setattr, "sched_setattr" },
[275] = { 4, 0, sys_sched_getattr, "sched_getattr" },
[276] = { 5, TD|TF, sys_renameat2, "renameat2" },
[277] = { 3, 0, sys_seccomp, "seccomp", },
[278] = { 3, 0, sys_getrandom, "getrandom", },
[279] = { 2, TD, sys_memfd_create, "memfd_create", },
[280] = { 3, TD, sys_bpf, "bpf", },
[281] = { 5, TD|TF|TP|SE|SI, sys_execveat, "execveat", },

View File

@ -0,0 +1,2 @@
extern uint64_t *const aarch64_sp_ptr;
extern uint32_t *const arm_sp_ptr;

View File

@ -0,0 +1,2 @@
/* Native AArch64 */
#include "errnoent.h"

View File

@ -0,0 +1 @@
/* Generated by ioctls_gen.sh from definitions found in $linux/arch/arm64/include/ tree. */

View File

@ -0,0 +1 @@
#include "arm/ioctls_arch0.h"

View File

@ -0,0 +1 @@
#include "64/ioctls_inc.h"

View File

@ -0,0 +1 @@
#include "arm/ioctls_inc0.h"

View File

@ -0,0 +1 @@
#include "signalent.h"

View File

@ -0,0 +1 @@
#include "../arm/syscallent.h"

View File

@ -0,0 +1,74 @@
#include "64/syscallent.h"
/* Arch-specific block, not used on AArch64 */
[244 ... 259] = { },
/* Blank down to 1023 */
[277 ... 1023] = { },
/* Quote from asm-generic/unistd.h:
*
* All syscalls below here should go away really,
* these are provided for both review and as a porting
* help for the C library version.
*
* Last chance: are any of these important enough to
* enable by default?
*/
[1024] = { 3, TD|TF, sys_open, "open" },
[1025] = { 2, TF, sys_link, "link" },
[1026] = { 1, TF, sys_unlink, "unlink" },
[1027] = { 3, TF, sys_mknod, "mknod" },
[1028] = { 2, TF, sys_chmod, "chmod" },
[1029] = { 3, TF, sys_chown, "chown" },
[1030] = { 2, TF, sys_mkdir, "mkdir" },
[1031] = { 1, TF, sys_rmdir, "rmdir" },
[1032] = { 3, TF, sys_chown, "lchown" },
[1033] = { 2, TF, sys_access, "access" },
[1034] = { 2, TF, sys_rename, "rename" },
[1035] = { 3, TF, sys_readlink, "readlink" },
[1036] = { 2, TF, sys_symlink, "symlink" },
[1037] = { 2, TF, sys_utimes, "utimes" },
[1038] = { 2, TF, sys_stat, "stat" },
[1039] = { 2, TF, sys_lstat, "lstat" },
[1040] = { 1, TD, sys_pipe, "pipe" },
[1041] = { 2, TD, sys_dup2, "dup2" },
[1042] = { 1, TD, sys_epoll_create, "epoll_create" },
[1043] = { 0, TD, sys_inotify_init, "inotify_init" },
[1044] = { 1, TD, sys_eventfd, "eventfd" },
[1045] = { 3, TD|TS, sys_signalfd, "signalfd" },
[1046] = { 4, TD|TN, sys_sendfile64, "sendfile" },
[1047] = { 2, TD, sys_ftruncate, "ftruncate" },
[1048] = { 2, TF, sys_truncate, "truncate" },
[1049] = { 2, TF, sys_stat, "stat" },
[1050] = { 2, TF, sys_lstat, "lstat" },
[1051] = { 2, TD, sys_fstat, "fstat" },
[1052] = { 3, TD, sys_fcntl, "fcntl" },
[1053] = { 4, TD, sys_fadvise64, "fadvise64" },
[1054] = { 4, TD|TF, sys_newfstatat, "newfstatat" },
[1055] = { 2, TD, sys_fstatfs, "fstatfs" },
[1056] = { 2, TF, sys_statfs, "statfs" },
[1057] = { 3, TD, sys_lseek, "lseek" },
[1058] = { 6, TD|TM|SI, sys_mmap, "mmap" },
[1059] = { 1, 0, sys_alarm, "alarm" },
[1060] = { 0, 0, sys_getpgrp, "getpgrp" },
[1061] = { 0, TS, sys_pause, "pause" },
[1062] = { 1, 0, sys_time, "time" },
[1063] = { 2, TF, sys_utime, "utime" },
[1064] = { 2, TD|TF, sys_creat, "creat" },
[1065] = { 3, TD, sys_getdents, "getdents" },
[1066] = { 3, TD|TF, sys_futimesat, "futimesat" },
[1067] = { 5, TD, sys_select, "select" },
[1068] = { 3, TD, sys_poll, "poll" },
[1069] = { 4, TD, sys_epoll_wait, "epoll_wait" },
[1070] = { 2, 0, sys_ustat, "ustat" },
[1071] = { 0, TP, sys_vfork, "vfork" },
[1072] = { 4, TP, sys_wait4, "wait4" },
[1073] = { 6, TN, sys_recv, "recv" },
[1074] = { 4, TN, sys_send, "send" },
[1075] = { 2, 0, sys_bdflush, "bdflush" },
[1076] = { 1, TF, sys_umount, "umount" },
[1077] = { 1, TF, sys_uselib, "uselib" },
[1078] = { 1, 0, sys_sysctl, "sysctl" },
[1079] = { 0, TP, sys_fork, "fork" },

5
linux/alpha/arch_regs.h Normal file
View File

@ -0,0 +1,5 @@
#define REG_R0 0
#define REG_A0 16
#define REG_A3 19
#define REG_FP 30
#define REG_PC 64

View File

@ -1,516 +1,148 @@
"ERRNO_0", /* 0 */
"EPERM", /* 1 */
"ENOENT", /* 2 */
"ESRCH", /* 3 */
"EINTR", /* 4 */
"EIO", /* 5 */
"ENXIO", /* 6 */
"E2BIG", /* 7 */
"ENOEXEC", /* 8 */
"EBADF", /* 9 */
"ECHILD", /* 10 */
"EDEADLK", /* 11 */
"ENOMEM", /* 12 */
"EACCES", /* 13 */
"EFAULT", /* 14 */
"ENOTBLK", /* 15 */
"EBUSY", /* 16 */
"EEXIST", /* 17 */
"EXDEV", /* 18 */
"ENODEV", /* 19 */
"ENOTDIR", /* 20 */
"EISDIR", /* 21 */
"EINVAL", /* 22 */
"ENFILE", /* 23 */
"EMFILE", /* 24 */
"ENOTTY", /* 25 */
"ETXTBSY", /* 26 */
"EFBIG", /* 27 */
"ENOSPC", /* 28 */
"ESPIPE", /* 29 */
"EROFS", /* 30 */
"EMLINK", /* 31 */
"EPIPE", /* 32 */
"EDOM", /* 33 */
"ERANGE", /* 34 */
"EAGAIN", /* 35 */
"EINPROGRESS", /* 36 */
"EALREADY", /* 37 */
"ENOTSOCK", /* 38 */
"EDESTADDRREQ", /* 39 */
"EMSGSIZE", /* 40 */
"EPROTOTYPE", /* 41 */
"ENOPROTOOPT", /* 42 */
"EPROTONOSUPPORT", /* 43 */
"ESOCKTNOSUPPORT", /* 44 */
"EOPNOTSUPP", /* 45 */
"EPFNOSUPPORT", /* 46 */
"EAFNOSUPPORT", /* 47 */
"EADDRINUSE", /* 48 */
"EADDRNOTAVAIL", /* 49 */
"ENETDOWN", /* 50 */
"ENETUNREACH", /* 51 */
"ENETRESET", /* 52 */
"ECONNABORTED", /* 53 */
"ECONNRESET", /* 54 */
"ENOBUFS", /* 55 */
"EISCONN", /* 56 */
"ENOTCONN", /* 57 */
"ESHUTDOWN", /* 58 */
"ETOOMANYREFS", /* 59 */
"ETIMEDOUT", /* 60 */
"ECONNREFUSED", /* 61 */
"ELOOP", /* 62 */
"ENAMETOOLONG", /* 63 */
"EHOSTDOWN", /* 64 */
"EHOSTUNREACH", /* 65 */
"ENOTEMPTY", /* 66 */
"ERRNO_67", /* 67 */
"EUSERS", /* 68 */
"EDQUOT", /* 69 */
"ESTALE", /* 70 */
"EREMOTE", /* 71 */
"ERRNO_72", /* 72 */
"ERRNO_73", /* 73 */
"ERRNO_74", /* 74 */
"ERRNO_75", /* 75 */
"ERRNO_76", /* 76 */
"ENOLCK", /* 77 */
"ENOSYS", /* 78 */
"ERRNO_79", /* 79 */
"ENOMSG", /* 80 */
"EIDRM", /* 81 */
"ENOSR", /* 82 */
"ETIME", /* 83 */
"EBADMSG", /* 84 */
"EPROTO", /* 85 */
"ENODATA", /* 86 */
"ENOSTR", /* 87 */
"ECHRNG", /* 88 */
"EL2NSYNC", /* 89 */
"EL3HLT", /* 90 */
"EL3RST", /* 91 */
"ENOPKG", /* 92 */
"ELNRNG", /* 93 */
"EUNATCH", /* 94 */
"ENOCSI", /* 95 */
"EL2HLT", /* 96 */
"EBADE", /* 97 */
"EBADR", /* 98 */
"EXFULL", /* 99 */
"ENOANO", /* 100 */
"EBADRQC", /* 101 */
"EBADSLT", /* 102 */
"EDEADLOCK", /* 103 */
"EBFONT", /* 104 */
"ENONET", /* 105 */
"ENOLINK", /* 106 */
"EADV", /* 107 */
"ESRMNT", /* 108 */
"ECOMM", /* 109 */
"EMULTIHOP", /* 110 */
"EDOTDOT", /* 111 */
"EOVERFLOW", /* 112 */
"ENOTUNIQ", /* 113 */
"EBADFD", /* 114 */
"EREMCHG", /* 115 */
"EILSEQ", /* 116 */
"EUCLEAN", /* 117 */
"ENOTNAM", /* 118 */
"ENAVAIL", /* 119 */
"EISNAM", /* 120 */
"EREMOTEIO", /* 121 */
"ELIBACC", /* 122 */
"ELIBBAD", /* 123 */
"ELIBSCN", /* 124 */
"ELIBMAX", /* 125 */
"ELIBEXEC", /* 126 */
"ERESTART", /* 127 */
"ESTRPIPE", /* 128 */
"ERRNO_129", /* 129 */
"ERRNO_130", /* 130 */
"ERRNO_131", /* 131 */
"ERRNO_132", /* 132 */
"ERRNO_133", /* 133 */
"ERRNO_134", /* 134 */
"ERRNO_135", /* 135 */
"ERRNO_136", /* 136 */
"ERRNO_137", /* 137 */
"ERRNO_138", /* 138 */
"ERRNO_139", /* 139 */
"ERRNO_140", /* 140 */
"ERRNO_141", /* 141 */
"ERRNO_142", /* 142 */
"ERRNO_143", /* 143 */
"ERRNO_144", /* 144 */
"ERRNO_145", /* 145 */
"ERRNO_146", /* 146 */
"ERRNO_147", /* 147 */
"ERRNO_148", /* 148 */
"ERRNO_149", /* 149 */
"ERRNO_150", /* 150 */
"ERRNO_151", /* 151 */
"ERRNO_152", /* 152 */
"ERRNO_153", /* 153 */
"ERRNO_154", /* 154 */
"ERRNO_155", /* 155 */
"ERRNO_156", /* 156 */
"ERRNO_157", /* 157 */
"ERRNO_158", /* 158 */
"ERRNO_159", /* 159 */
"ERRNO_160", /* 160 */
"ERRNO_161", /* 161 */
"ERRNO_162", /* 162 */
"ERRNO_163", /* 163 */
"ERRNO_164", /* 164 */
"ERRNO_165", /* 165 */
"ERRNO_166", /* 166 */
"ERRNO_167", /* 167 */
"ERRNO_168", /* 168 */
"ERRNO_169", /* 169 */
"ERRNO_170", /* 170 */
"ERRNO_171", /* 171 */
"ERRNO_172", /* 172 */
"ERRNO_173", /* 173 */
"ERRNO_174", /* 174 */
"ERRNO_175", /* 175 */
"ERRNO_176", /* 176 */
"ERRNO_177", /* 177 */
"ERRNO_178", /* 178 */
"ERRNO_179", /* 179 */
"ERRNO_180", /* 180 */
"ERRNO_181", /* 181 */
"ERRNO_182", /* 182 */
"ERRNO_183", /* 183 */
"ERRNO_184", /* 184 */
"ERRNO_185", /* 185 */
"ERRNO_186", /* 186 */
"ERRNO_187", /* 187 */
"ERRNO_188", /* 188 */
"ERRNO_189", /* 189 */
"ERRNO_190", /* 190 */
"ERRNO_191", /* 191 */
"ERRNO_192", /* 192 */
"ERRNO_193", /* 193 */
"ERRNO_194", /* 194 */
"ERRNO_195", /* 195 */
"ERRNO_196", /* 196 */
"ERRNO_197", /* 197 */
"ERRNO_198", /* 198 */
"ERRNO_199", /* 199 */
"ERRNO_200", /* 200 */
"ERRNO_201", /* 201 */
"ERRNO_202", /* 202 */
"ERRNO_203", /* 203 */
"ERRNO_204", /* 204 */
"ERRNO_205", /* 205 */
"ERRNO_206", /* 206 */
"ERRNO_207", /* 207 */
"ERRNO_208", /* 208 */
"ERRNO_209", /* 209 */
"ERRNO_210", /* 210 */
"ERRNO_211", /* 211 */
"ERRNO_212", /* 212 */
"ERRNO_213", /* 213 */
"ERRNO_214", /* 214 */
"ERRNO_215", /* 215 */
"ERRNO_216", /* 216 */
"ERRNO_217", /* 217 */
"ERRNO_218", /* 218 */
"ERRNO_219", /* 219 */
"ERRNO_220", /* 220 */
"ERRNO_221", /* 221 */
"ERRNO_222", /* 222 */
"ERRNO_223", /* 223 */
"ERRNO_224", /* 224 */
"ERRNO_225", /* 225 */
"ERRNO_226", /* 226 */
"ERRNO_227", /* 227 */
"ERRNO_228", /* 228 */
"ERRNO_229", /* 229 */
"ERRNO_230", /* 230 */
"ERRNO_231", /* 231 */
"ERRNO_232", /* 232 */
"ERRNO_233", /* 233 */
"ERRNO_234", /* 234 */
"ERRNO_235", /* 235 */
"ERRNO_236", /* 236 */
"ERRNO_237", /* 237 */
"ERRNO_238", /* 238 */
"ERRNO_239", /* 239 */
"ERRNO_240", /* 240 */
"ERRNO_241", /* 241 */
"ERRNO_242", /* 242 */
"ERRNO_243", /* 243 */
"ERRNO_244", /* 244 */
"ERRNO_245", /* 245 */
"ERRNO_246", /* 246 */
"ERRNO_247", /* 247 */
"ERRNO_248", /* 248 */
"ERRNO_249", /* 249 */
"ERRNO_250", /* 250 */
"ERRNO_251", /* 251 */
"ERRNO_252", /* 252 */
"ERRNO_253", /* 253 */
"ERRNO_254", /* 254 */
"ERRNO_255", /* 255 */
"ERRNO_256", /* 256 */
"ERRNO_257", /* 257 */
"ERRNO_258", /* 258 */
"ERRNO_259", /* 259 */
"ERRNO_260", /* 260 */
"ERRNO_261", /* 261 */
"ERRNO_262", /* 262 */
"ERRNO_263", /* 263 */
"ERRNO_264", /* 264 */
"ERRNO_265", /* 265 */
"ERRNO_266", /* 266 */
"ERRNO_267", /* 267 */
"ERRNO_268", /* 268 */
"ERRNO_269", /* 269 */
"ERRNO_270", /* 270 */
"ERRNO_271", /* 271 */
"ERRNO_272", /* 272 */
"ERRNO_273", /* 273 */
"ERRNO_274", /* 274 */
"ERRNO_275", /* 275 */
"ERRNO_276", /* 276 */
"ERRNO_277", /* 277 */
"ERRNO_278", /* 278 */
"ERRNO_279", /* 279 */
"ERRNO_280", /* 280 */
"ERRNO_281", /* 281 */
"ERRNO_282", /* 282 */
"ERRNO_283", /* 283 */
"ERRNO_284", /* 284 */
"ERRNO_285", /* 285 */
"ERRNO_286", /* 286 */
"ERRNO_287", /* 287 */
"ERRNO_288", /* 288 */
"ERRNO_289", /* 289 */
"ERRNO_290", /* 290 */
"ERRNO_291", /* 291 */
"ERRNO_292", /* 292 */
"ERRNO_293", /* 293 */
"ERRNO_294", /* 294 */
"ERRNO_295", /* 295 */
"ERRNO_296", /* 296 */
"ERRNO_297", /* 297 */
"ERRNO_298", /* 298 */
"ERRNO_299", /* 299 */
"ERRNO_300", /* 300 */
"ERRNO_301", /* 301 */
"ERRNO_302", /* 302 */
"ERRNO_303", /* 303 */
"ERRNO_304", /* 304 */
"ERRNO_305", /* 305 */
"ERRNO_306", /* 306 */
"ERRNO_307", /* 307 */
"ERRNO_308", /* 308 */
"ERRNO_309", /* 309 */
"ERRNO_310", /* 310 */
"ERRNO_311", /* 311 */
"ERRNO_312", /* 312 */
"ERRNO_313", /* 313 */
"ERRNO_314", /* 314 */
"ERRNO_315", /* 315 */
"ERRNO_316", /* 316 */
"ERRNO_317", /* 317 */
"ERRNO_318", /* 318 */
"ERRNO_319", /* 319 */
"ERRNO_320", /* 320 */
"ERRNO_321", /* 321 */
"ERRNO_322", /* 322 */
"ERRNO_323", /* 323 */
"ERRNO_324", /* 324 */
"ERRNO_325", /* 325 */
"ERRNO_326", /* 326 */
"ERRNO_327", /* 327 */
"ERRNO_328", /* 328 */
"ERRNO_329", /* 329 */
"ERRNO_330", /* 330 */
"ERRNO_331", /* 331 */
"ERRNO_332", /* 332 */
"ERRNO_333", /* 333 */
"ERRNO_334", /* 334 */
"ERRNO_335", /* 335 */
"ERRNO_336", /* 336 */
"ERRNO_337", /* 337 */
"ERRNO_338", /* 338 */
"ERRNO_339", /* 339 */
"ERRNO_340", /* 340 */
"ERRNO_341", /* 341 */
"ERRNO_342", /* 342 */
"ERRNO_343", /* 343 */
"ERRNO_344", /* 344 */
"ERRNO_345", /* 345 */
"ERRNO_346", /* 346 */
"ERRNO_347", /* 347 */
"ERRNO_348", /* 348 */
"ERRNO_349", /* 349 */
"ERRNO_350", /* 350 */
"ERRNO_351", /* 351 */
"ERRNO_352", /* 352 */
"ERRNO_353", /* 353 */
"ERRNO_354", /* 354 */
"ERRNO_355", /* 355 */
"ERRNO_356", /* 356 */
"ERRNO_357", /* 357 */
"ERRNO_358", /* 358 */
"ERRNO_359", /* 359 */
"ERRNO_360", /* 360 */
"ERRNO_361", /* 361 */
"ERRNO_362", /* 362 */
"ERRNO_363", /* 363 */
"ERRNO_364", /* 364 */
"ERRNO_365", /* 365 */
"ERRNO_366", /* 366 */
"ERRNO_367", /* 367 */
"ERRNO_368", /* 368 */
"ERRNO_369", /* 369 */
"ERRNO_370", /* 370 */
"ERRNO_371", /* 371 */
"ERRNO_372", /* 372 */
"ERRNO_373", /* 373 */
"ERRNO_374", /* 374 */
"ERRNO_375", /* 375 */
"ERRNO_376", /* 376 */
"ERRNO_377", /* 377 */
"ERRNO_378", /* 378 */
"ERRNO_379", /* 379 */
"ERRNO_380", /* 380 */
"ERRNO_381", /* 381 */
"ERRNO_382", /* 382 */
"ERRNO_383", /* 383 */
"ERRNO_384", /* 384 */
"ERRNO_385", /* 385 */
"ERRNO_386", /* 386 */
"ERRNO_387", /* 387 */
"ERRNO_388", /* 388 */
"ERRNO_389", /* 389 */
"ERRNO_390", /* 390 */
"ERRNO_391", /* 391 */
"ERRNO_392", /* 392 */
"ERRNO_393", /* 393 */
"ERRNO_394", /* 394 */
"ERRNO_395", /* 395 */
"ERRNO_396", /* 396 */
"ERRNO_397", /* 397 */
"ERRNO_398", /* 398 */
"ERRNO_399", /* 399 */
"ERRNO_400", /* 400 */
"ERRNO_401", /* 401 */
"ERRNO_402", /* 402 */
"ERRNO_403", /* 403 */
"ERRNO_404", /* 404 */
"ERRNO_405", /* 405 */
"ERRNO_406", /* 406 */
"ERRNO_407", /* 407 */
"ERRNO_408", /* 408 */
"ERRNO_409", /* 409 */
"ERRNO_410", /* 410 */
"ERRNO_411", /* 411 */
"ERRNO_412", /* 412 */
"ERRNO_413", /* 413 */
"ERRNO_414", /* 414 */
"ERRNO_415", /* 415 */
"ERRNO_416", /* 416 */
"ERRNO_417", /* 417 */
"ERRNO_418", /* 418 */
"ERRNO_419", /* 419 */
"ERRNO_420", /* 420 */
"ERRNO_421", /* 421 */
"ERRNO_422", /* 422 */
"ERRNO_423", /* 423 */
"ERRNO_424", /* 424 */
"ERRNO_425", /* 425 */
"ERRNO_426", /* 426 */
"ERRNO_427", /* 427 */
"ERRNO_428", /* 428 */
"ERRNO_429", /* 429 */
"ERRNO_430", /* 430 */
"ERRNO_431", /* 431 */
"ERRNO_432", /* 432 */
"ERRNO_433", /* 433 */
"ERRNO_434", /* 434 */
"ERRNO_435", /* 435 */
"ERRNO_436", /* 436 */
"ERRNO_437", /* 437 */
"ERRNO_438", /* 438 */
"ERRNO_439", /* 439 */
"ERRNO_440", /* 440 */
"ERRNO_441", /* 441 */
"ERRNO_442", /* 442 */
"ERRNO_443", /* 443 */
"ERRNO_444", /* 444 */
"ERRNO_445", /* 445 */
"ERRNO_446", /* 446 */
"ERRNO_447", /* 447 */
"ERRNO_448", /* 448 */
"ERRNO_449", /* 449 */
"ERRNO_450", /* 450 */
"ERRNO_451", /* 451 */
"ERRNO_452", /* 452 */
"ERRNO_453", /* 453 */
"ERRNO_454", /* 454 */
"ERRNO_455", /* 455 */
"ERRNO_456", /* 456 */
"ERRNO_457", /* 457 */
"ERRNO_458", /* 458 */
"ERRNO_459", /* 459 */
"ERRNO_460", /* 460 */
"ERRNO_461", /* 461 */
"ERRNO_462", /* 462 */
"ERRNO_463", /* 463 */
"ERRNO_464", /* 464 */
"ERRNO_465", /* 465 */
"ERRNO_466", /* 466 */
"ERRNO_467", /* 467 */
"ERRNO_468", /* 468 */
"ERRNO_469", /* 469 */
"ERRNO_470", /* 470 */
"ERRNO_471", /* 471 */
"ERRNO_472", /* 472 */
"ERRNO_473", /* 473 */
"ERRNO_474", /* 474 */
"ERRNO_475", /* 475 */
"ERRNO_476", /* 476 */
"ERRNO_477", /* 477 */
"ERRNO_478", /* 478 */
"ERRNO_479", /* 479 */
"ERRNO_480", /* 480 */
"ERRNO_481", /* 481 */
"ERRNO_482", /* 482 */
"ERRNO_483", /* 483 */
"ERRNO_484", /* 484 */
"ERRNO_485", /* 485 */
"ERRNO_486", /* 486 */
"ERRNO_487", /* 487 */
"ERRNO_488", /* 488 */
"ERRNO_489", /* 489 */
"ERRNO_490", /* 490 */
"ERRNO_491", /* 491 */
"ERRNO_492", /* 492 */
"ERRNO_493", /* 493 */
"ERRNO_494", /* 494 */
"ERRNO_495", /* 495 */
"ERRNO_496", /* 496 */
"ERRNO_497", /* 497 */
"ERRNO_498", /* 498 */
"ERRNO_499", /* 499 */
"ERRNO_500", /* 500 */
"ERRNO_501", /* 501 */
"ERRNO_502", /* 502 */
"ERRNO_503", /* 503 */
"ERRNO_504", /* 504 */
"ERRNO_505", /* 505 */
"ERRNO_506", /* 506 */
"ERRNO_507", /* 507 */
"ERRNO_508", /* 508 */
"ERRNO_509", /* 509 */
"ERRNO_510", /* 510 */
"ERRNO_511", /* 511 */
"ERESTARTSYS", /* 512 */
"ERESTARTNOINTR", /* 513 */
"ERESTARTNOHAND", /* 514 */
"ENOIOCTLCMD", /* 515 */
[ 1] = "EPERM",
[ 2] = "ENOENT",
[ 3] = "ESRCH",
[ 4] = "EINTR",
[ 5] = "EIO",
[ 6] = "ENXIO",
[ 7] = "E2BIG",
[ 8] = "ENOEXEC",
[ 9] = "EBADF",
[ 10] = "ECHILD",
[ 11] = "EDEADLK",
[ 12] = "ENOMEM",
[ 13] = "EACCES",
[ 14] = "EFAULT",
[ 15] = "ENOTBLK",
[ 16] = "EBUSY",
[ 17] = "EEXIST",
[ 18] = "EXDEV",
[ 19] = "ENODEV",
[ 20] = "ENOTDIR",
[ 21] = "EISDIR",
[ 22] = "EINVAL",
[ 23] = "ENFILE",
[ 24] = "EMFILE",
[ 25] = "ENOTTY",
[ 26] = "ETXTBSY",
[ 27] = "EFBIG",
[ 28] = "ENOSPC",
[ 29] = "ESPIPE",
[ 30] = "EROFS",
[ 31] = "EMLINK",
[ 32] = "EPIPE",
[ 33] = "EDOM",
[ 34] = "ERANGE",
[ 35] = "EAGAIN",
[ 36] = "EINPROGRESS",
[ 37] = "EALREADY",
[ 38] = "ENOTSOCK",
[ 39] = "EDESTADDRREQ",
[ 40] = "EMSGSIZE",
[ 41] = "EPROTOTYPE",
[ 42] = "ENOPROTOOPT",
[ 43] = "EPROTONOSUPPORT",
[ 44] = "ESOCKTNOSUPPORT",
[ 45] = "EOPNOTSUPP",
[ 46] = "EPFNOSUPPORT",
[ 47] = "EAFNOSUPPORT",
[ 48] = "EADDRINUSE",
[ 49] = "EADDRNOTAVAIL",
[ 50] = "ENETDOWN",
[ 51] = "ENETUNREACH",
[ 52] = "ENETRESET",
[ 53] = "ECONNABORTED",
[ 54] = "ECONNRESET",
[ 55] = "ENOBUFS",
[ 56] = "EISCONN",
[ 57] = "ENOTCONN",
[ 58] = "ESHUTDOWN",
[ 59] = "ETOOMANYREFS",
[ 60] = "ETIMEDOUT",
[ 61] = "ECONNREFUSED",
[ 62] = "ELOOP",
[ 63] = "ENAMETOOLONG",
[ 64] = "EHOSTDOWN",
[ 65] = "EHOSTUNREACH",
[ 66] = "ENOTEMPTY",
[ 68] = "EUSERS",
[ 69] = "EDQUOT",
[ 70] = "ESTALE",
[ 71] = "EREMOTE",
[ 77] = "ENOLCK",
[ 78] = "ENOSYS",
[ 80] = "ENOMSG",
[ 81] = "EIDRM",
[ 82] = "ENOSR",
[ 83] = "ETIME",
[ 84] = "EBADMSG",
[ 85] = "EPROTO",
[ 86] = "ENODATA",
[ 87] = "ENOSTR",
[ 88] = "ECHRNG",
[ 89] = "EL2NSYNC",
[ 90] = "EL3HLT",
[ 91] = "EL3RST",
[ 92] = "ENOPKG",
[ 93] = "ELNRNG",
[ 94] = "EUNATCH",
[ 95] = "ENOCSI",
[ 96] = "EL2HLT",
[ 97] = "EBADE",
[ 98] = "EBADR",
[ 99] = "EXFULL",
[100] = "ENOANO",
[101] = "EBADRQC",
[102] = "EBADSLT",
[103] = "EDEADLOCK",
[104] = "EBFONT",
[105] = "ENONET",
[106] = "ENOLINK",
[107] = "EADV",
[108] = "ESRMNT",
[109] = "ECOMM",
[110] = "EMULTIHOP",
[111] = "EDOTDOT",
[112] = "EOVERFLOW",
[113] = "ENOTUNIQ",
[114] = "EBADFD",
[115] = "EREMCHG",
[116] = "EILSEQ",
[117] = "EUCLEAN",
[118] = "ENOTNAM",
[119] = "ENAVAIL",
[120] = "EISNAM",
[121] = "EREMOTEIO",
[122] = "ELIBACC",
[123] = "ELIBBAD",
[124] = "ELIBSCN",
[125] = "ELIBMAX",
[126] = "ELIBEXEC",
[127] = "ERESTART",
[128] = "ESTRPIPE",
[129] = "ENOMEDIUM",
[130] = "EMEDIUMTYPE",
[131] = "ECANCELED",
[132] = "ENOKEY",
[133] = "EKEYEXPIRED",
[134] = "EKEYREVOKED",
[135] = "EKEYREJECTED",
[136] = "EOWNERDEAD",
[137] = "ENOTRECOVERABLE",
[138] = "ERFKILL",
[139] = "EHWPOISON",
[512] = "ERESTARTSYS",
[513] = "ERESTARTNOINTR",
[514] = "ERESTARTNOHAND",
[515] = "ENOIOCTLCMD",
[516] = "ERESTART_RESTARTBLOCK",
[517] = "EPROBE_DEFER",
[518] = "EOPENSTALE",
[521] = "EBADHANDLE",
[522] = "ENOTSYNC",
[523] = "EBADCOOKIE",
[524] = "ENOTSUPP",
[525] = "ETOOSMALL",
[526] = "ESERVERFAULT",
[527] = "EBADTYPE",
[528] = "EJUKEBOX",
[529] = "EIOCBQUEUED",

View File

@ -1,73 +0,0 @@
{"asm/ioctls.h", "TIOCEXCL", 0x540c},
{"asm/ioctls.h", "TIOCNXCL", 0x540d},
{"asm/ioctls.h", "TIOCSCTTY", 0x540e},
{"asm/ioctls.h", "TIOCSTI", 0x5412},
{"asm/ioctls.h", "TIOCMGET", 0x5415},
{"asm/ioctls.h", "TIOCMBIS", 0x5416},
{"asm/ioctls.h", "TIOCMBIC", 0x5417},
{"asm/ioctls.h", "TIOCMSET", 0x5418},
{"asm/ioctls.h", "TIOCGSOFTCAR", 0x5419},
{"asm/ioctls.h", "TIOCSSOFTCAR", 0x541a},
{"asm/ioctls.h", "TIOCLINUX", 0x541c},
{"asm/ioctls.h", "TIOCCONS", 0x541d},
{"asm/ioctls.h", "TIOCGSERIAL", 0x541e},
{"asm/ioctls.h", "TIOCSSERIAL", 0x541f},
{"asm/ioctls.h", "TIOCPKT", 0x5420},
{"asm/ioctls.h", "TIOCNOTTY", 0x5422},
{"asm/ioctls.h", "TIOCSETD", 0x5423},
{"asm/ioctls.h", "TIOCGETD", 0x5424},
{"asm/ioctls.h", "TCSBRKP", 0x5425},
{"asm/ioctls.h", "TIOCTTYGSTRUCT", 0x5426},
{"asm/ioctls.h", "TIOCSBRK", 0x5427},
{"asm/ioctls.h", "TIOCCBRK", 0x5428},
{"asm/ioctls.h", "TIOCGSID", 0x5429},
{"asm/ioctls.h", "TIOCGPTN", 0x5430},
{"asm/ioctls.h", "TIOCSPTLCK", 0x5431},
{"asm/ioctls.h", "TIOCSERCONFIG", 0x5453},
{"asm/ioctls.h", "TIOCSERGWILD", 0x5454},
{"asm/ioctls.h", "TIOCSERSWILD", 0x5455},
{"asm/ioctls.h", "TIOCGLCKTRMIOS", 0x5456},
{"asm/ioctls.h", "TIOCSLCKTRMIOS", 0x5457},
{"asm/ioctls.h", "TIOCSERGSTRUCT", 0x5458},
{"asm/ioctls.h", "TIOCSERGETLSR", 0x5459},
{"asm/ioctls.h", "TIOCSERGETMULTI", 0x545a},
{"asm/ioctls.h", "TIOCSERSETMULTI", 0x545b},
{"asm/ioctls.h", "TIOCMIWAIT", 0x545c},
{"asm/ioctls.h", "TIOCGICOUNT", 0x545d},
{"asm/ioctls.h", "TIOCGHAYESESP", 0x545e},
{"asm/ioctls.h", "TIOCSHAYESESP", 0x545f},
{"asm/ioctls.h", "FIOCLEX", 0x6601},
{"asm/ioctls.h", "FIONCLEX", 0x6602},
{"asm/sockios.h", "FIOGETOWN", 0x667b},
{"asm/sockios.h", "FIOSETOWN", 0x667c},
{"asm/ioctls.h", "FIOASYNC", 0x667d},
{"asm/ioctls.h", "FIONBIO", 0x667e},
{"asm/ioctls.h", "FIONREAD", 0x667f},
{"asm/sockios.h", "SIOCATMARK", 0x7307},
{"asm/sockios.h", "SIOCSPGRP", 0x7308},
{"asm/sockios.h", "SIOCGPGRP", 0x7309},
{"asm/ioctls.h", "TIOCGETP", 0x7408},
{"asm/ioctls.h", "TIOCSETP", 0x7409},
{"asm/ioctls.h", "TIOCSETN", 0x740a},
{"asm/ioctls.h", "TIOCSETC", 0x7411},
{"asm/ioctls.h", "TIOCGETC", 0x7412},
{"asm/ioctls.h", "TCGETS", 0x7413},
{"asm/ioctls.h", "TCSETS", 0x7414},
{"asm/ioctls.h", "TCSETSW", 0x7415},
{"asm/ioctls.h", "TCSETSF", 0x7416},
{"asm/ioctls.h", "TCGETA", 0x7417},
{"asm/ioctls.h", "TCSETA", 0x7418},
{"asm/ioctls.h", "TCSETAW", 0x7419},
{"asm/ioctls.h", "TCSETAF", 0x741c},
{"asm/ioctls.h", "TCSBRK", 0x741d},
{"asm/ioctls.h", "TCXONC", 0x741e},
{"asm/ioctls.h", "TCFLSH", 0x741f},
{"asm/ioctls.h", "TIOCSWINSZ", 0x7467},
{"asm/ioctls.h", "TIOCGWINSZ", 0x7468},
{"asm/ioctls.h", "TIOCSTART", 0x746e},
{"asm/ioctls.h", "TIOCSTOP", 0x746f},
{"asm/ioctls.h", "TIOCOUTQ", 0x7473},
{"asm/ioctls.h", "TIOCGLTC", 0x7474},
{"asm/ioctls.h", "TIOCSLTC", 0x7475},
{"asm/ioctls.h", "TIOCSPGRP", 0x7476},
{"asm/ioctls.h", "TIOCGPGRP", 0x7477},

View File

@ -0,0 +1,82 @@
/* Generated by ioctls_gen.sh from definitions found in $linux/arch/alpha/include/ tree. */
{ "asm/ioctls.h", "FIOASYNC", _IOC_WRITE, 0x667d, 0x04 },
{ "asm/ioctls.h", "FIOCLEX", _IOC_NONE, 0x6601, 0x00 },
{ "asm/ioctls.h", "FIONBIO", _IOC_WRITE, 0x667e, 0x04 },
{ "asm/ioctls.h", "FIONCLEX", _IOC_NONE, 0x6602, 0x00 },
{ "asm/ioctls.h", "FIONREAD", _IOC_READ, 0x667f, 0x04 },
{ "asm/ioctls.h", "FIOQSIZE", _IOC_READ, 0x6680, 0x08 },
{ "asm/ioctls.h", "TCFLSH", _IOC_NONE, 0x741f, 0x00 },
{ "asm/ioctls.h", "TCGETA", _IOC_READ, 0x7417, 0x12 },
{ "asm/ioctls.h", "TCGETS", _IOC_READ, 0x7413, 0x2c },
{ "asm/ioctls.h", "TCSBRK", _IOC_NONE, 0x741d, 0x00 },
{ "asm/ioctls.h", "TCSBRKP", 0, 0x5425, 0 },
{ "asm/ioctls.h", "TCSETA", _IOC_WRITE, 0x7418, 0x12 },
{ "asm/ioctls.h", "TCSETAF", _IOC_WRITE, 0x741c, 0x12 },
{ "asm/ioctls.h", "TCSETAW", _IOC_WRITE, 0x7419, 0x12 },
{ "asm/ioctls.h", "TCSETS", _IOC_WRITE, 0x7414, 0x2c },
{ "asm/ioctls.h", "TCSETSF", _IOC_WRITE, 0x7416, 0x2c },
{ "asm/ioctls.h", "TCSETSW", _IOC_WRITE, 0x7415, 0x2c },
{ "asm/ioctls.h", "TCXONC", _IOC_NONE, 0x741e, 0x00 },
{ "asm/ioctls.h", "TIOCCBRK", 0, 0x5428, 0 },
{ "asm/ioctls.h", "TIOCCONS", 0, 0x541D, 0 },
{ "asm/ioctls.h", "TIOCEXCL", 0, 0x540C, 0 },
{ "asm/ioctls.h", "TIOCGDEV", _IOC_READ, 0x5432, 0x04 },
{ "asm/ioctls.h", "TIOCGETC", _IOC_READ, 0x7412, 0x06 },
{ "asm/ioctls.h", "TIOCGETD", 0, 0x5424, 0 },
{ "asm/ioctls.h", "TIOCGETP", _IOC_READ, 0x7408, 0x06 },
{ "asm/ioctls.h", "TIOCGEXCL", _IOC_READ, 0x5440, 0x04 },
{ "asm/ioctls.h", "TIOCGICOUNT", 0, 0x545D, 0 },
{ "asm/ioctls.h", "TIOCGLCKTRMIOS", 0, 0x5456, 0 },
{ "asm/ioctls.h", "TIOCGLTC", _IOC_READ, 0x7474, 0x06 },
{ "asm/ioctls.h", "TIOCGPGRP", _IOC_READ, 0x7477, 0x04 },
{ "asm/ioctls.h", "TIOCGPKT", _IOC_READ, 0x5438, 0x04 },
{ "asm/ioctls.h", "TIOCGPTLCK", _IOC_READ, 0x5439, 0x04 },
{ "asm/ioctls.h", "TIOCGPTN", _IOC_READ, 0x5430, 0x04 },
{ "asm/ioctls.h", "TIOCGRS485", _IOC_READ, 0x542e, 0x20 },
{ "asm/ioctls.h", "TIOCGSERIAL", 0, 0x541E, 0 },
{ "asm/ioctls.h", "TIOCGSID", 0, 0x5429, 0 },
{ "asm/ioctls.h", "TIOCGSOFTCAR", 0, 0x5419, 0 },
{ "asm/ioctls.h", "TIOCGWINSZ", _IOC_READ, 0x7468, 0x08 },
{ "asm/ioctls.h", "TIOCLINUX", 0, 0x541C, 0 },
{ "asm/ioctls.h", "TIOCMBIC", 0, 0x5417, 0 },
{ "asm/ioctls.h", "TIOCMBIS", 0, 0x5416, 0 },
{ "asm/ioctls.h", "TIOCMGET", 0, 0x5415, 0 },
{ "asm/ioctls.h", "TIOCMIWAIT", 0, 0x545C, 0 },
{ "asm/ioctls.h", "TIOCMSET", 0, 0x5418, 0 },
{ "asm/ioctls.h", "TIOCNOTTY", 0, 0x5422, 0 },
{ "asm/ioctls.h", "TIOCNXCL", 0, 0x540D, 0 },
{ "asm/ioctls.h", "TIOCOUTQ", _IOC_READ, 0x7473, 0x04 },
{ "asm/ioctls.h", "TIOCPKT", 0, 0x5420, 0 },
{ "asm/ioctls.h", "TIOCSBRK", 0, 0x5427, 0 },
{ "asm/ioctls.h", "TIOCSCTTY", 0, 0x540E, 0 },
{ "asm/ioctls.h", "TIOCSERCONFIG", 0, 0x5453, 0 },
{ "asm/ioctls.h", "TIOCSERGETLSR", 0, 0x5459, 0 },
{ "asm/ioctls.h", "TIOCSERGETMULTI", 0, 0x545A, 0 },
{ "asm/ioctls.h", "TIOCSERGSTRUCT", 0, 0x5458, 0 },
{ "asm/ioctls.h", "TIOCSERGWILD", 0, 0x5454, 0 },
{ "asm/ioctls.h", "TIOCSERSETMULTI", 0, 0x545B, 0 },
{ "asm/ioctls.h", "TIOCSERSWILD", 0, 0x5455, 0 },
{ "asm/ioctls.h", "TIOCSETC", _IOC_WRITE, 0x7411, 0x06 },
{ "asm/ioctls.h", "TIOCSETD", 0, 0x5423, 0 },
{ "asm/ioctls.h", "TIOCSETN", _IOC_WRITE, 0x740a, 0x06 },
{ "asm/ioctls.h", "TIOCSETP", _IOC_WRITE, 0x7409, 0x06 },
{ "asm/ioctls.h", "TIOCSIG", _IOC_WRITE, 0x5436, 0x04 },
{ "asm/ioctls.h", "TIOCSLCKTRMIOS", 0, 0x5457, 0 },
{ "asm/ioctls.h", "TIOCSLTC", _IOC_WRITE, 0x7475, 0x06 },
{ "asm/ioctls.h", "TIOCSPGRP", _IOC_WRITE, 0x7476, 0x04 },
{ "asm/ioctls.h", "TIOCSPTLCK", _IOC_WRITE, 0x5431, 0x04 },
{ "asm/ioctls.h", "TIOCSRS485", _IOC_READ|_IOC_WRITE, 0x542f, 0x20 },
{ "asm/ioctls.h", "TIOCSSERIAL", 0, 0x541F, 0 },
{ "asm/ioctls.h", "TIOCSSOFTCAR", 0, 0x541A, 0 },
{ "asm/ioctls.h", "TIOCSTART", _IOC_NONE, 0x746e, 0x00 },
{ "asm/ioctls.h", "TIOCSTI", 0, 0x5412, 0 },
{ "asm/ioctls.h", "TIOCSTOP", _IOC_NONE, 0x746f, 0x00 },
{ "asm/ioctls.h", "TIOCSWINSZ", _IOC_WRITE, 0x7467, 0x08 },
{ "asm/ioctls.h", "TIOCVHANGUP", 0, 0x5437, 0 },
{ "asm/sockios.h", "FIOGETOWN", _IOC_READ, 0x667b, 0x04 },
{ "asm/sockios.h", "FIOSETOWN", _IOC_WRITE, 0x667c, 0x04 },
{ "asm/sockios.h", "SIOCATMARK", _IOC_READ, 0x7307, 0x04 },
{ "asm/sockios.h", "SIOCGPGRP", _IOC_READ, 0x7309, 0x04 },
{ "asm/sockios.h", "SIOCGSTAMP", 0, 0x8906, 0 },
{ "asm/sockios.h", "SIOCGSTAMPNS", 0, 0x8907, 0 },
{ "asm/sockios.h", "SIOCSPGRP", _IOC_WRITE, 0x7308, 0x04 },

View File

@ -0,0 +1 @@
#include "64/ioctls_inc.h"

View File

@ -30,3 +30,4 @@
"SIGINFO", /* 29 */
"SIGUSR1", /* 30 */
"SIGUSR2", /* 31 */
"SIGRTMIN", /* 32 */

View File

@ -26,507 +26,445 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
{ 6, 0, printargs, "osf_syscall" }, /* 0, not implemented */
{ 1, TP, sys_exit, "exit" }, /* 1 */
{ 0, TP, sys_fork, "fork" }, /* 2 */
{ 3, TD, sys_read, "read" }, /* 3 */
{ 3, TD, sys_write, "write" }, /* 4 */
{ 5, 0, printargs, "osf_old_open" }, /* 5, not implemented */
{ 1, TD, sys_close, "close" }, /* 6 */
{ 4, TP, sys_osf_wait4, "osf_wait4" }, /* 7 */
{ 5, 0, printargs, "osf_old_creat" }, /* 8, not implemented */
{ 2, TF, sys_link, "link" }, /* 9 */
{ 1, TF, sys_unlink, "unlink" }, /* 10 */
{ 5, 0, printargs, "osf_execve" }, /* 11, not implemented */
{ 1, TF, sys_chdir, "chdir" }, /* 12 */
{ 1, TF, sys_fchdir, "fchdir" }, /* 13 */
{ 3, TF, sys_mknod, "mknod" }, /* 14 */
{ 2, TF, sys_chmod, "chmod" }, /* 15 */
{ 3, TF, sys_chown, "chown" }, /* 16 */
{ 1, 0, sys_brk, "brk" }, /* 17 */
{ 5, 0, printargs, "osf_getfsstat" }, /* 18, not implemented */
{ 3, TF, sys_lseek, "lseek" }, /* 19 */
{ 0, 0, sys_getpid, "getxpid" }, /* 20 */
{ 4, 0, printargs, "osf_mount" }, /* 21 */
{ 2, 0, sys_umount2, "umount" }, /* 22 */
{ 1, 0, sys_setuid, "setuid" }, /* 23 */
{ 0, NF, sys_getuid, "getxuid" }, /* 24 */
{ 5, 0, printargs, "exec_with_loader" }, /* 25, not implemented */
{ 4, 0, sys_ptrace, "ptrace" }, /* 26 */
{ 5, 0, printargs, "osf_nrecvmsg" }, /* 27, not implemented */
{ 5, 0, printargs, "osf_nsendmsg" }, /* 28, not implemented */
{ 5, 0, printargs, "osf_nrecvfrom" }, /* 29, not implemented */
{ 5, 0, printargs, "osf_naccept" }, /* 30, not implemented */
{ 5, 0, printargs, "osf_ngetpeername" }, /* 31, not implemented */
{ 5, 0, printargs, "osf_ngetsockname" }, /* 32, not implemented */
{ 2, TF, sys_access, "access" }, /* 33 */
{ 5, 0, printargs, "osf_chflags" }, /* 34, not implemented */
{ 5, 0, printargs, "osf_fchflags" }, /* 35, not implemented */
{ 0, 0, sys_sync, "sync" }, /* 36 */
{ 2, TS, sys_kill, "kill" }, /* 37 */
{ 5, 0, printargs, "osf_old_stat" }, /* 38, not implemented */
{ 2, 0, sys_setpgid, "setpgid" }, /* 39 */
{ 5, 0, printargs, "osf_old_lstat" }, /* 40, not implemented */
{ 1, TD, sys_dup, "dup" }, /* 41 */
{ 1, TD, sys_pipe, "pipe" }, /* 42 */
{ 5, 0, printargs, "osf_set_program_attributes" }, /* 43 */
{ 5, 0, printargs, "osf_profil" }, /* 44, not implemented */
{ 3, TD|TF, sys_open, "open" }, /* 45 */
{ 5, 0, printargs, "osf_old_sigaction" }, /* 46, not implemented */
{ 1, NF, sys_getgid, "getxgid" }, /* 47 */
{ 2, TS, sys_sigprocmask, "osf_sigprocmask" }, /* 48 */
{ 5, 0, printargs, "osf_getlogin" }, /* 49, not implemented */
{ 5, 0, printargs, "osf_setlogin" }, /* 50, not implemented */
{ 1, TF, sys_acct, "acct" }, /* 51 */
{ 1, TS, sys_sigpending, "sigpending" }, /* 52 */
{ 5, 0, NULL, NULL }, /* 53 */
{ 3, TD, sys_ioctl, "ioctl" }, /* 54 */
{ 5, 0, printargs, "osf_reboot" }, /* 55, not implemented */
{ 5, 0, printargs, "osf_revoke" }, /* 56, not implemented */
{ 2, TF, sys_symlink, "symlink" }, /* 57 */
{ 3, TF, sys_readlink, "readlink" }, /* 58 */
{ 3, TF|TP, sys_execve, "execve" }, /* 59 */
{ 1, 0, sys_umask, "umask" }, /* 60 */
{ 1, TF, sys_chroot, "chroot" }, /* 61 */
{ 5, 0, printargs, "osf_old_fstat" }, /* 62, not implemented */
{ 0, 0, sys_getpgrp, "getpgrp" }, /* 63 */
{ 0, 0, sys_getpagesize, "getpagesize" }, /* 64 */
{ 5, 0, printargs, "osf_mremap" }, /* 65, not implemented */
{ 0, TP, sys_fork, "vfork" }, /* 66 */
{ 2, TF, sys_stat, "stat" }, /* 67 */
{ 2, TF, sys_lstat, "lstat" }, /* 68 */
{ 5, 0, printargs, "osf_sbrk" }, /* 69, not implemented */
{ 5, 0, printargs, "osf_sstk" }, /* 70, not implemented */
{ 6, TD, sys_mmap, "mmap" }, /* 71 */
{ 5, 0, printargs, "osf_old_vadvise" }, /* 72, not implemented */
{ 2, 0, sys_munmap, "munmap" }, /* 73 */
{ 3, 0, sys_mprotect, "mprotect" }, /* 74 */
{ 3, 0, sys_madvise, "madvise" }, /* 75 */
{ 0, 0, sys_vhangup, "vhangup" }, /* 76 */
{ 5, 0, printargs, "osf_kmodcall" }, /* 77, not implemented */
{ 5, 0, printargs, "osf_mincore" }, /* 78, not implemented */
{ 2, 0, sys_getgroups, "getgroups" }, /* 79 */
{ 2, 0, sys_setgroups, "setgroups" }, /* 80 */
{ 5, 0, printargs, "osf_old_getpgrp" }, /* 81, not implemented */
{ 2, 0, sys_setpgrp, "setpgrp" }, /* 82 */
{ 3, 0, sys_osf_setitimer, "osf_setitimer" }, /* 83 */
{ 5, 0, printargs, "osf_old_wait" }, /* 84, not implemented */
{ 5, 0, printargs, "osf_table" }, /* 85, not implemented */
{ 2, 0, sys_osf_getitimer, "osf_getitimer" }, /* 86 */
{ 2, 0, sys_gethostname, "gethostname" }, /* 87 */
{ 2, 0, sys_sethostname, "sethostname" }, /* 88 */
{ 0, 0, sys_getdtablesize, "getdtablesize" }, /* 89 */
{ 2, TD, sys_dup2, "dup2" }, /* 90 */
{ 2, TD, sys_fstat, "fstat" }, /* 91 */
{ 3, TD, sys_fcntl, "fcntl" }, /* 92 */
{ 5, 0, sys_osf_select, "osf_select" }, /* 93 */
{ 3, TD, sys_poll, "poll" }, /* 94 */
{ 1, TD, sys_fsync, "fsync" }, /* 95 */
{ 3, 0, sys_setpriority, "setpriority" }, /* 96 */
{ 3, TN, sys_socket, "socket" }, /* 97 */
{ 3, TN, sys_connect, "connect" }, /* 98 */
{ 3, TN, sys_accept, "accept" }, /* 99 */
{ 2, 0, sys_getpriority, "osf_getpriority" }, /* 100 */
{ 4, TN, sys_send, "send" }, /* 101 */
{ 4, TN, sys_recv, "recv" }, /* 102 */
{ 0, TS, sys_sigreturn, "sigreturn" }, /* 103 */
{ 3, TN, sys_bind, "bind" }, /* 104 */
{ 5, TN, sys_setsockopt, "setsockopt" }, /* 105 */
{ 2, TN, sys_listen, "listen" }, /* 106 */
{ 5, 0, printargs, "osf_plock" }, /* 107, not implemented */
{ 5, 0, printargs, "osf_old_sigvec" }, /* 108, not implemented */
{ 5, 0, printargs, "osf_old_sigblock" }, /* 109, not implemented */
{ 5, 0, printargs, "osf_old_sigsetmask" }, /* 110, not implemented */
{ 3, TS, sys_sigsuspend, "sigsuspend" }, /* 111 */
{ 5, 0, printargs, "sigstack" }, /* 112 */
{ 3, TN, sys_recvmsg, "recvmsg" }, /* 113 */
{ 3, TN, sys_sendmsg, "sendmsg" }, /* 114 */
{ 5, 0, printargs, "osf_old_vtrace" }, /* 115, not implemented */
{ 2, 0, sys_osf_gettimeofday, "osf_gettimeofday" }, /* 116 */
{ 2, 0, sys_osf_getrusage, "osf_getrusage" }, /* 117 */
{ 5, TN, sys_getsockopt, "getsockopt" }, /* 118 */
{ 5, 0, NULL, NULL }, /* 119 */
{ 3, TD, sys_readv, "readv" }, /* 120 */
{ 3, TD, sys_writev, "writev" }, /* 121 */
{ 2, 0, sys_osf_settimeofday, "osf_settimeofday" }, /* 122 */
{ 3, TD, sys_fchown, "fchown" }, /* 123 */
{ 2, TD, sys_fchmod, "fchmod" }, /* 124 */
{ 6, TN, sys_recvfrom, "recvfrom" }, /* 125 */
{ 2, 0, sys_setreuid, "setreuid" }, /* 126 */
{ 2, 0, sys_setregid, "setregid" }, /* 127 */
{ 2, TF, sys_rename, "rename" }, /* 128 */
{ 2, TF, sys_truncate, "truncate" }, /* 129 */
{ 2, TD, sys_ftruncate, "ftruncate" }, /* 130 */
{ 2, TD, sys_flock, "flock" }, /* 131 */
{ 1, 0, sys_setgid, "setgid" }, /* 132 */
{ 6, TN, sys_sendto, "sendto" }, /* 133 */
{ 2, TN, sys_shutdown, "shutdown" }, /* 134 */
{ 4, TN, sys_socketpair, "socketpair" }, /* 135 */
{ 2, TF, sys_mkdir, "mkdir" }, /* 136 */
{ 1, TF, sys_rmdir, "rmdir" }, /* 137 */
{ 2, 0, sys_osf_utimes, "osf_utimes" }, /* 138 */
{ 5, 0, printargs, "osf_old_sigreturn" }, /* 139 */
{ 5, 0, printargs, "osf_adjtime" }, /* 140, not implemented */
{ 3, TN, sys_getpeername, "getpeername" }, /* 141 */
{ 5, 0, printargs, "osf_gethostid" }, /* 142, not implemented */
{ 5, 0, printargs, "osf_sethostid" }, /* 143, not implemented */
{ 2, 0, sys_getrlimit, "getrlimit" }, /* 144 */
{ 2, 0, sys_setrlimit, "setrlimit" }, /* 145 */
{ 5, 0, printargs, "osf_old_killpg" }, /* 146, not implemented */
{ 0, 0, sys_setsid, "setsid" }, /* 147 */
{ 4, 0, sys_quotactl, "quotactl" }, /* 148 */
{ 5, 0, printargs, "osf_oldquota" }, /* 149, not implemented */
{ 3, TN, sys_getsockname, "getsockname" }, /* 150 */
{ 5, 0, NULL, NULL }, /* 151 */
{ 5, 0, NULL, NULL }, /* 152 */
{ 5, 0, printargs, "osf_pid_block" }, /* 153, not implemented */
{ 5, 0, printargs, "osf_pid_unblock" }, /* 154, not implemented */
{ 5, 0, NULL, NULL }, /* 155 */
{ 3, TS, sys_sigaction, "sigaction" }, /* 156 */
{ 5, 0, printargs, "osf_sigwaitprim" }, /* 157, not implemented */
{ 5, 0, printargs, "osf_nfssvc" }, /* 158, not implemented */
{ 4, 0, printargs, "osf_getdirentries" }, /* 159 */
{ 3, 0, osf_statfs, "osf_statfs" }, /* 160 */
{ 3, 0, osf_fstatfs, "osf_fstatfs" }, /* 161 */
{ 5, 0, NULL, NULL }, /* 162 */
{ 5, 0, printargs, "osf_asynch_daemon" }, /* 163, not implemented */
{ 5, 0, printargs, "osf_getfh" }, /* 164, not implemented */
{ 2, 0, printargs, "osf_getdomainname" }, /* 165 */
{ 2, 0, sys_setdomainname, "setdomainname" }, /* 166 */
{ 5, 0, NULL, NULL }, /* 167 */
{ 5, 0, NULL, NULL }, /* 168 */
{ 5, 0, printargs, "osf_exportfs" }, /* 169, not implemented */
{ 5, 0, NULL, NULL }, /* 170 */
{ 5, 0, NULL, NULL }, /* 171 */
{ 5, 0, NULL, NULL }, /* 172 */
{ 5, 0, NULL, NULL }, /* 173 */
{ 5, 0, NULL, NULL }, /* 174 */
{ 5, 0, NULL, NULL }, /* 175 */
{ 5, 0, NULL, NULL }, /* 176 */
{ 5, 0, NULL, NULL }, /* 177 */
{ 5, 0, NULL, NULL }, /* 178 */
{ 5, 0, NULL, NULL }, /* 179 */
{ 5, 0, NULL, NULL }, /* 180 */
{ 5, 0, printargs, "osf_alt_plock" }, /* 181, not implemented */
{ 5, 0, NULL, NULL }, /* 182 */
{ 5, 0, NULL, NULL }, /* 183 */
{ 5, 0, printargs, "osf_getmnt" }, /* 184, not implemented */
{ 5, 0, NULL, NULL }, /* 185 */
{ 5, 0, NULL, NULL }, /* 186 */
{ 5, 0, printargs, "osf_alt_sigpending" }, /* 187, not implemented */
{ 5, 0, printargs, "osf_alt_setsid" }, /* 188, not implemented */
{ 5, 0, NULL, NULL }, /* 189 */
{ 5, 0, NULL, NULL }, /* 190 */
{ 5, 0, NULL, NULL }, /* 191 */
{ 5, 0, NULL, NULL }, /* 192 */
{ 5, 0, NULL, NULL }, /* 193 */
{ 5, 0, NULL, NULL }, /* 194 */
{ 5, 0, NULL, NULL }, /* 195 */
{ 5, 0, NULL, NULL }, /* 196 */
{ 5, 0, NULL, NULL }, /* 197 */
{ 5, 0, NULL, NULL }, /* 198 */
{ 4, 0, printargs, "osf_swapon" }, /* 199 */
{ 4, TI, sys_msgctl, "msgctl" }, /* 200 */
{ 4, TI, sys_msgget, "msgget" }, /* 201 */
{ 4, TI, sys_msgrcv, "msgrcv" }, /* 202 */
{ 4, TI, sys_msgsnd, "msgsnd" }, /* 203 */
{ 4, TI, sys_semctl, "semctl" }, /* 204 */
{ 4, TI, sys_semget, "semget" }, /* 205 */
{ 4, TI, printargs, "semop" }, /* 206 */
{ 1, 0, printargs, "osf_utsname" }, /* 207 */
{ 3, TF, sys_chown, "lchown" }, /* 208 */
{ 3, TI, printargs, "osf_shmat" }, /* 209 */
{ 4, TI, sys_shmctl, "shmctl" }, /* 210 */
{ 4, TI, sys_shmdt, "shmdt" }, /* 211 */
{ 4, TI, sys_shmget, "shmget" }, /* 212 */
{ 5, 0, printargs, "osf_mvalid" }, /* 213, not implemented */
{ 5, 0, printargs, "osf_getaddressconf" }, /* 214, not implemented */
{ 5, 0, printargs, "osf_msleep" }, /* 215, not implemented */
{ 5, 0, printargs, "osf_mwakeup" }, /* 216, not implemented */
{ 3, 0, sys_msync, "msync" }, /* 217 */
{ 5, 0, printargs, "osf_signal" }, /* 218, not implemented */
{ 5, 0, printargs, "osf_utc_gettime" }, /* 219, not implemented */
{ 5, 0, printargs, "osf_utc_adjtime" }, /* 220, not implemented */
{ 5, 0, NULL, NULL }, /* 221 */
{ 5, 0, printargs, "osf_security" }, /* 222, not implemented */
{ 5, 0, printargs, "osf_kloadcall" }, /* 223, not implemented */
{ 5, 0, NULL, NULL }, /* 224 */
{ 5, 0, NULL, NULL }, /* 225 */
{ 5, 0, NULL, NULL }, /* 226 */
{ 5, 0, NULL, NULL }, /* 227 */
{ 5, 0, NULL, NULL }, /* 228 */
{ 5, 0, NULL, NULL }, /* 229 */
{ 5, 0, NULL, NULL }, /* 230 */
{ 5, 0, NULL, NULL }, /* 231 */
{ 5, 0, NULL, NULL }, /* 232 */
{ 1, 0, sys_getpgid, "getpgid" }, /* 233 */
{ 1, 0, sys_getsid, "getsid" }, /* 234 */
{ 5, 0, sys_sigaltstack, "sigaltstack" }, /* 235 */
{ 5, 0, printargs, "osf_waitid" }, /* 236, not implemented */
{ 5, 0, printargs, "osf_priocntlset" }, /* 237, not implemented */
{ 5, 0, printargs, "osf_sigsendset" }, /* 238, not implemented */
{ 5, 0, printargs, "osf_set_speculative" }, /* 239, not implemented */
{ 5, 0, printargs, "osf_msfs_syscall" }, /* 240, not implemented */
{ 5, 0, printargs, "osf_sysinfo" }, /* 241 */
{ 5, 0, printargs, "osf_uadmin" }, /* 242, not implemented */
{ 5, 0, printargs, "osf_fuser" }, /* 243, not implemented */
{ 2, 0, printargs, "osf_proplist_syscall" }, /* 244 */
{ 5, 0, printargs, "osf_ntp_adjtime" }, /* 245, not implemented */
{ 5, 0, printargs, "osf_ntp_gettime" }, /* 246, not implemented */
{ 5, 0, printargs, "osf_pathconf" }, /* 247, not implemented */
{ 5, 0, printargs, "osf_fpathconf" }, /* 248, not implemented */
{ 5, 0, NULL, NULL }, /* 249 */
{ 5, 0, printargs, "osf_uswitch" }, /* 250, not implemented */
{ 2, 0, printargs, "osf_usleep_thread" }, /* 251 */
{ 5, 0, printargs, "osf_audcntl" }, /* 252, not implemented */
{ 5, 0, printargs, "osf_audgen" }, /* 253, not implemented */
{ 5, 0, sys_sysfs, "sysfs" }, /* 254 */
{ 5, 0, printargs, "osf_subsysinfo" }, /* 255, not implemented */
{ 5, 0, printargs, "osf_getsysinfo" }, /* 256 */
{ 5, 0, printargs, "osf_setsysinfo" }, /* 257 */
{ 5, 0, printargs, "osf_afs_syscall" }, /* 258, not implemented */
{ 5, 0, printargs, "osf_swapctl" }, /* 259, not implemented */
{ 5, 0, printargs, "osf_memcntl" }, /* 260, not implemented */
{ 5, 0, printargs, "osf_fdatasync" }, /* 261, not implemented */
{ 5, 0, NULL, NULL }, /* 262 */
{ 5, 0, NULL, NULL }, /* 263 */
{ 5, 0, NULL, NULL }, /* 264 */
{ 5, 0, NULL, NULL }, /* 265 */
{ 5, 0, NULL, NULL }, /* 266 */
{ 5, 0, NULL, NULL }, /* 267 */
{ 5, 0, NULL, NULL }, /* 268 */
{ 5, 0, NULL, NULL }, /* 269 */
{ 5, 0, NULL, NULL }, /* 270 */
{ 5, 0, NULL, NULL }, /* 271 */
{ 5, 0, NULL, NULL }, /* 272 */
{ 5, 0, NULL, NULL }, /* 273 */
{ 5, 0, NULL, NULL }, /* 274 */
{ 5, 0, NULL, NULL }, /* 275 */
{ 5, 0, NULL, NULL }, /* 276 */
{ 5, 0, NULL, NULL }, /* 277 */
{ 5, 0, NULL, NULL }, /* 278 */
{ 5, 0, NULL, NULL }, /* 279 */
{ 5, 0, NULL, NULL }, /* 280 */
{ 5, 0, NULL, NULL }, /* 281 */
{ 5, 0, NULL, NULL }, /* 282 */
{ 5, 0, NULL, NULL }, /* 283 */
{ 5, 0, NULL, NULL }, /* 284 */
{ 5, 0, NULL, NULL }, /* 285 */
{ 5, 0, NULL, NULL }, /* 286 */
{ 5, 0, NULL, NULL }, /* 287 */
{ 5, 0, NULL, NULL }, /* 288 */
{ 5, 0, NULL, NULL }, /* 289 */
{ 5, 0, NULL, NULL }, /* 290 */
{ 5, 0, NULL, NULL }, /* 291 */
{ 5, 0, NULL, NULL }, /* 292 */
{ 5, 0, NULL, NULL }, /* 293 */
{ 5, 0, NULL, NULL }, /* 294 */
{ 5, 0, NULL, NULL }, /* 295 */
{ 5, 0, NULL, NULL }, /* 296 */
{ 5, 0, NULL, NULL }, /* 297 */
{ 5, 0, NULL, NULL }, /* 298 */
{ 5, 0, NULL, NULL }, /* 299 */
{ 0, 0, sys_bdflush, "bdflush" }, /* 300 */
{ 3, 0, printargs, "sethae" }, /* 301 */
{ 5, TF, sys_mount, "mount" }, /* 302 */
{ 1, 0, sys_adjtimex, "adjtimex32" }, /* 303 */
{ 1, TF, sys_swapoff, "swapoff" }, /* 304 */
{ 3, TD, sys_getdents, "getdents" }, /* 305 */
{ 2, 0, sys_create_module, "create_module" }, /* 306 */
{ 4, 0, sys_init_module, "init_module" }, /* 307 */
{ 2, 0, sys_delete_module, "delete_module" }, /* 308 */
{ 1, 0, sys_get_kernel_syms, "get_kernel_syms" }, /* 309 */
{ 3, 0, sys_syslog, "syslog" }, /* 310 */
{ 4, 0, sys_reboot, "reboot" }, /* 311 */
{ 5, TP, sys_clone, "clone" }, /* 312 */
{ 1, 0, sys_uselib, "uselib" }, /* 313 */
{ 2, 0, sys_mlock, "mlock" }, /* 314 */
{ 2, 0, sys_munlock, "munlock" }, /* 315 */
{ 1, 0, sys_mlockall, "mlockall" }, /* 316 */
{ 0, 0, sys_munlockall, "munlockall" }, /* 317 */
{ 1, 0, sys_sysinfo, "sysinfo" }, /* 318 */
{ 1, 0, sys_sysctl, "sysctl" }, /* 319 */
{ 0, 0, sys_idle, "idle" }, /* 320 */
{ 1, 0, sys_umount, "oldumount" }, /* 321 */
{ 2, TF, sys_swapon, "swapon" }, /* 322 */
{ 1, 0, sys_times, "times" }, /* 323 */
{ 1, 0, sys_personality, "personality" }, /* 324 */
{ 1, NF, sys_setfsuid, "setfsuid" }, /* 325 */
{ 1, NF, sys_setfsgid, "setfsgid" }, /* 326 */
{ 2, 0, sys_ustat, "ustat" }, /* 327 */
{ 2, TF, sys_statfs, "statfs" }, /* 328 */
{ 2, TD, sys_fstatfs, "fstatfs" }, /* 329 */
{ 2, 0, sys_sched_setparam, "sched_setparam" }, /* 330 */
{ 2, 0, sys_sched_getparam, "sched_getparam" }, /* 331 */
{ 3, 0, sys_sched_setscheduler, "sched_setscheduler" }, /* 332 */
{ 2, 0, sys_sched_getscheduler, "sched_getscheduler" }, /* 333 */
{ 0, 0, sys_sched_yield, "sched_yield" }, /* 334 */
{ 1, 0, sys_sched_get_priority_max,"sched_get_priority_max" }, /* 335 */
{ 1, 0, sys_sched_get_priority_min,"sched_get_priority_min" }, /* 336 */
{ 2, 0, sys_sched_rr_get_interval,"sched_rr_get_interval" }, /* 337 */
{ 5, 0, sys_afs_syscall, "afs_syscall" }, /* 338 */
{ 1, 0, sys_uname, "uname" }, /* 339 */
{ 2, 0, sys_nanosleep, "nanosleep" }, /* 340 */
{ 5, 0, sys_mremap, "mremap" }, /* 341 */
{ 5, 0, sys_nfsservctl, "nfsservctl" }, /* 342 */
{ 3, 0, sys_setresuid, "setresuid" }, /* 343 */
{ 3, 0, sys_getresuid, "getresuid" }, /* 344 */
{ 5, 0, printargs, "pciconfig_read" }, /* 345 */
{ 5, 0, printargs, "pciconfig_write" }, /* 346 */
{ 5, 0, sys_query_module, "query_module" }, /* 347 */
{ 5, 0, sys_prctl, "prctl" }, /* 348 */
{ 5, TD, sys_pread, "pread" }, /* 349 */
{ 5, TD, sys_pwrite, "pwrite" }, /* 350 */
{ 0, TS, sys_rt_sigreturn, "rt_sigreturn" }, /* 351 */
{ 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 352 */
{ 4, TS, sys_rt_sigprocmask, "rt_sigprocmask" }, /* 353 */
{ 2, TS, sys_rt_sigpending, "rt_sigpending" }, /* 354 */
{ 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait" }, /* 355 */
{ 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo" }, /* 356 */
{ 2, TS, sys_rt_sigsuspend, "rt_sigsuspend" }, /* 357 */
{ 5, TD, sys_select, "select" }, /* 358 */
{ 2, 0, sys_gettimeofday, "gettimeofday" }, /* 359 */
{ 3, 0, sys_settimeofday, "settimeofday" }, /* 360 */
{ 2, 0, sys_getitimer, "getitimer" }, /* 361 */
{ 3, 0, sys_setitimer, "setitimer" }, /* 362 */
{ 2, 0, sys_utimes, "utimes" }, /* 363 */
{ 2, 0, sys_getrusage, "getrusage" }, /* 364 */
{ 4, TP, sys_wait4, "wait4" }, /* 365 */
{ 1, 0, sys_adjtimex, "adjtimex" }, /* 366 */
{ 2, 0, sys_getcwd, "getcwd" }, /* 367 */
{ 2, 0, sys_capget, "capget" }, /* 368 */
{ 2, 0, sys_capset, "capset" }, /* 369 */
{ 4, TD|TN, sys_sendfile, "sendfile" }, /* 370 */
{ 3, 0, sys_setresgid, "setresgid" }, /* 371 */
{ 3, 0, sys_getresgid, "getresgid" }, /* 372 */
{ 4, 0, printargs, "dipc" }, /* 373, not implemented */
{ 2, TF, sys_pivotroot, "pivot_root" }, /* 374 */
{ 3, 0, sys_mincore, "mincore" }, /* 375 */
{ 3, 0, printargs, "pciconfig_iobase" }, /* 376 */
{ 3, TD, sys_getdents64, "getdents64" }, /* 377 */
{ 0, 0, sys_gettid, "gettid" }, /* 378 */
{ 4, TD, sys_readahead, "readahead" }, /* 379 */
{ 5, 0, NULL, NULL }, /* 380 */
{ 2, TS, sys_kill, "tkill" }, /* 381 */
{ 5, TF, sys_setxattr, "setxattr" }, /* 382 */
{ 5, TF, sys_setxattr, "lsetxattr" }, /* 383 */
{ 5, TD, sys_fsetxattr, "fsetxattr" }, /* 384 */
{ 4, TF, sys_getxattr, "getxattr" }, /* 385 */
{ 4, TF, sys_getxattr, "lgetxattr" }, /* 386 */
{ 4, TD, sys_fgetxattr, "fgetxattr" }, /* 387 */
{ 3, TF, sys_listxattr, "listxattr" }, /* 388 */
{ 3, TF, sys_listxattr, "llistxattr" }, /* 389 */
{ 3, TD, sys_flistxattr, "flistxattr" }, /* 390 */
{ 2, TF, sys_removexattr, "removexattr" }, /* 391 */
{ 2, TF, sys_removexattr, "lremovexattr" }, /* 392 */
{ 2, TD, sys_fremovexattr, "fremovexattr" }, /* 393 */
{ 6, 0, sys_futex, "futex" }, /* 394 */
{ 3, 0, sys_sched_setaffinity, "sched_setaffinity" }, /* 395 */
{ 3, 0, sys_sched_getaffinity, "sched_getaffinity" }, /* 396 */
{ 5, 0, sys_tuxcall, "tuxcall" }, /* 397 */
{ 2, 0, sys_io_setup, "io_setup" }, /* 398 */
{ 1, 0, sys_io_destroy, "io_destroy" }, /* 399 */
{ 5, 0, sys_io_getevents, "io_getevents" }, /* 400 */
{ 3, 0, sys_io_submit, "io_submit" }, /* 401 */
{ 3, 0, sys_io_cancel, "io_cancel" }, /* 402 */
{ 5, 0, NULL, NULL }, /* 403 */
{ 5, 0, NULL, NULL }, /* 404 */
{ 1, TP, sys_exit, "exit_group" }, /* 405 */
{ 4, 0, sys_lookup_dcookie, "lookup_dcookie" }, /* 406 */
{ 1, TD, sys_epoll_create, "epoll_create" }, /* 407 */
{ 4, TD, sys_epoll_ctl, "epoll_ctl" }, /* 408 */
{ 4, TD, sys_epoll_wait, "epoll_wait" }, /* 409 */
{ 5, 0, sys_remap_file_pages, "remap_file_pages" }, /* 410 */
{ 1, 0, sys_set_tid_address, "set_tid_address" }, /* 411 */
{ 0, 0, sys_restart_syscall, "restart_syscall" }, /* 412 */
{ 4, TD, printargs, "fadvise" }, /* 413 */
{ 3, 0, sys_timer_create, "timer_create" }, /* 414 */
{ 4, 0, sys_timer_settime, "timer_settime" }, /* 415 */
{ 2, 0, sys_timer_gettime, "timer_gettime" }, /* 416 */
{ 1, 0, sys_timer_getoverrun, "timer_getoverrun" }, /* 417 */
{ 1, 0, sys_timer_delete, "timer_delete" }, /* 418 */
{ 2, 0, sys_clock_settime, "clock_settime" }, /* 419 */
{ 2, 0, sys_clock_gettime, "clock_gettime" }, /* 420 */
{ 2, 0, sys_clock_getres, "clock_getres" }, /* 421 */
{ 4, 0, sys_clock_nanosleep, "clock_nanosleep" }, /* 422 */
{ 5, TI, sys_semtimedop, "semtimedop" }, /* 423 */
{ 3, TS, sys_tgkill, "tgkill" }, /* 424 */
{ 2, TF, sys_stat64, "stat64" }, /* 425 */
{ 2, TF, sys_lstat64, "lstat64" }, /* 426 */
{ 2, TD, sys_fstat64, "fstat64" }, /* 427 */
{ 5, 0, sys_vserver, "vserver" }, /* 428 ??? */
{ 5, 0, printargs, "mbind" }, /* 429 ??? */
{ 5, 0, printargs, "get_mempolicy" }, /* 430 ??? */
{ 5, 0, printargs, "set_mempolicy" }, /* 431 ??? */
{ 4, 0, sys_mq_open, "mq_open" }, /* 432 */
{ 1, 0, sys_mq_unlink, "mq_unlink" }, /* 433 */
{ 5, 0, sys_mq_timedsend, "mq_timedsend" }, /* 434 */
{ 5, 0, sys_mq_timedreceive, "mq_timedreceive" }, /* 435 */
{ 2, 0, sys_mq_notify, "mq_notify" }, /* 436 */
{ 3, 0, sys_mq_getsetattr, "mq_getsetattr" }, /* 437 */
{ 4, 0, printargs, "waitid" }, /* 438 */
{ 5, 0, sys_add_key, "add_key" }, /* 439 */
{ 4, 0, sys_request_key, "request_key" }, /* 440 */
{ 5, 0, sys_keyctl, "keyctl" }, /* 441 */
{ 3, 0, sys_ioprio_set, "ioprio_set" }, /* 442 */
{ 2, 0, sys_ioprio_get, "ioprio_get" }, /* 443 */
{ 0, TD, sys_inotify_init, "inotify_init" }, /* 444 */
{ 3, TD, sys_inotify_add_watch, "inotify_add_watch" }, /* 445 */
{ 2, TD, sys_inotify_rm_watch, "inotify_rm_watch" }, /* 446 */
{ 1, TD, sys_fdatasync, "fdatasync" }, /* 447 */
{ 4, 0, sys_kexec_load, "kexec_load" }, /* 448 */
{ 4, 0, sys_migrate_pages, "migrate_pages" }, /* 449 */
{ 4, TD|TF, sys_openat, "openat" }, /* 450 */
{ 3, TD|TF, sys_mkdirat, "mkdirat" }, /* 451 */
{ 4, TD|TF, sys_mknodat, "mknodat" }, /* 452 */
{ 5, TD|TF, sys_fchownat, "fchownat" }, /* 453 */
{ 3, TD|TF, sys_futimesat, "futimesat" }, /* 454 */
{ 4, TD|TF, sys_newfstatat, "newfstatat" }, /* 455 */
{ 3, TD|TF, sys_unlinkat, "unlinkat" }, /* 456 */
{ 4, TD|TF, sys_renameat, "renameat" }, /* 457 */
{ 5, TD|TF, sys_linkat, "linkat" }, /* 458 */
{ 3, TD|TF, sys_symlinkat, "symlinkat" }, /* 459 */
{ 4, TD|TF, sys_readlinkat, "readlinkat" }, /* 460 */
{ 3, TD|TF, sys_fchmodat, "fchmodat" }, /* 461 */
{ 3, TD|TF, sys_faccessat, "faccessat" }, /* 462 */
{ 6, TD, sys_pselect6, "pselect6" }, /* 463 */
{ 5, TD, sys_ppoll, "ppoll" }, /* 464 */
{ 1, TP, sys_unshare, "unshare" }, /* 465 */
{ 2, 0, sys_set_robust_list, "set_robust_list" }, /* 466 */
{ 3, 0, sys_get_robust_list, "get_robust_list" }, /* 467 */
{ 6, TD, sys_splice, "splice" }, /* 468 */
{ 4, TD, sys_sync_file_range, "sync_file_range" }, /* 469 */
{ 4, TD, sys_tee, "tee" }, /* 470 */
{ 4, TD, sys_vmsplice, "vmsplice" }, /* 471 */
{ 6, 0, sys_move_pages, "move_pages" }, /* 472 */
{ 3, 0, sys_getcpu, "getcpu" }, /* 473 */
{ 6, TD, sys_epoll_pwait, "epoll_pwait" }, /* 474 */
{ 4, TD|TF, sys_utimensat, "utimensat" }, /* 475 */
{ 3, TD|TS, sys_signalfd, "signalfd" }, /* 476 */
{ 4, TD, sys_timerfd, "timerfd" }, /* 477 */
{ 1, TD, sys_eventfd, "eventfd" }, /* 478 */
{ 5, TN, sys_recvmmsg, "recvmmsg" }, /* 479 */
{ 6, TD, sys_fallocate, "fallocate" }, /* 480 */
{ 2, TD, sys_timerfd_create, "timerfd_create" }, /* 481 */
{ 4, TD, sys_timerfd_settime, "timerfd_settime" }, /* 482 */
{ 2, TD, sys_timerfd_gettime, "timerfd_gettime" }, /* 483 */
{ 4, TD|TS, sys_signalfd4, "signalfd4" }, /* 484 */
{ 2, TD, sys_eventfd2, "eventfd2" }, /* 485 */
{ 1, TD, sys_epoll_create1, "epoll_create1" }, /* 486 */
{ 3, TD, sys_dup3, "dup3" }, /* 487 */
{ 2, TD, sys_pipe2, "pipe2" }, /* 488 */
{ 1, TD, sys_inotify_init1, "inotify_init1" }, /* 489 */
{ 5, TD, sys_preadv, "preadv" }, /* 490 */
{ 5, TD, sys_pwritev, "pwritev" }, /* 491 */
{ 4, TP|TS, sys_rt_tgsigqueueinfo, "rt_tgsigqueueinfo" }, /* 492 */
{ 5, TD, sys_perf_event_open, "perf_event_open" }, /* 493 */
{ 2, TD, sys_fanotify_init, "fanotify_init" }, /* 494 */
{ 5, TD|TF, sys_fanotify_mark, "fanotify_mark" }, /* 495 */
{ 4, 0, sys_prlimit64, "prlimit64" }, /* 496 */
{ 5, TD|TF, sys_name_to_handle_at, "name_to_handle_at" }, /* 497 */
{ 3, TD, sys_open_by_handle_at, "open_by_handle_at" }, /* 498 */
{ 2, 0, sys_clock_adjtime, "clock_adjtime" }, /* 499 */
{ 1, TD, sys_syncfs, "syncfs" }, /* 500 */
{ 2, TD, sys_setns, "setns" }, /* 501 */
{ 4, TN, sys_accept4, "accept4" }, /* 502 */
{ 4, TN, sys_sendmmsg, "sendmmsg" }, /* 503 */
[ 0] = { 6, 0, printargs, "osf_syscall" }, /*not implemented */
[ 1] = { 1, TP|SE, sys_exit, "exit" },
[ 2] = { 0, TP, sys_fork, "fork" },
[ 3] = { 3, TD, sys_read, "read" },
[ 4] = { 3, TD, sys_write, "write" },
[ 5] = { 5, 0, printargs, "osf_old_open" }, /*not implemented */
[ 6] = { 1, TD, sys_close, "close" },
[ 7] = { 4, TP, sys_osf_wait4, "osf_wait4" },
[ 8] = { 5, 0, printargs, "osf_old_creat" }, /*not implemented */
[ 9] = { 2, TF, sys_link, "link" },
[ 10] = { 1, TF, sys_unlink, "unlink" },
[ 11] = { 5, 0, printargs, "osf_execve" }, /*not implemented */
[ 12] = { 1, TF, sys_chdir, "chdir" },
[ 13] = { 1, TD, sys_fchdir, "fchdir" },
[ 14] = { 3, TF, sys_mknod, "mknod" },
[ 15] = { 2, TF, sys_chmod, "chmod" },
[ 16] = { 3, TF, sys_chown, "chown" },
[ 17] = { 1, TM|SI, sys_brk, "brk" },
[ 18] = { 5, 0, printargs, "osf_getfsstat" }, /*not implemented */
[ 19] = { 3, TD, sys_lseek, "lseek" },
[ 20] = { 0, 0, sys_getpid, "getxpid" },
[ 21] = { 4, 0, printargs, "osf_mount" },
[ 22] = { 2, TF, sys_umount2, "umount" },
[ 23] = { 1, 0, sys_setuid, "setuid" },
[ 24] = { 0, NF, sys_getuid, "getxuid" },
[ 25] = { 5, 0, printargs, "exec_with_loader" }, /*not implemented */
[ 26] = { 4, 0, sys_ptrace, "ptrace" },
[ 27] = { 5, 0, printargs, "osf_nrecvmsg" }, /*not implemented */
[ 28] = { 5, 0, printargs, "osf_nsendmsg" }, /*not implemented */
[ 29] = { 5, 0, printargs, "osf_nrecvfrom" }, /*not implemented */
[ 30] = { 5, 0, printargs, "osf_naccept" }, /*not implemented */
[ 31] = { 5, 0, printargs, "osf_ngetpeername" }, /*not implemented */
[ 32] = { 5, 0, printargs, "osf_ngetsockname" }, /*not implemented */
[ 33] = { 2, TF, sys_access, "access" },
[ 34] = { 5, 0, printargs, "osf_chflags" }, /*not implemented */
[ 35] = { 5, 0, printargs, "osf_fchflags" }, /*not implemented */
[ 36] = { 0, 0, sys_sync, "sync" },
[ 37] = { 2, TS, sys_kill, "kill" },
[ 38] = { 5, 0, printargs, "osf_old_stat" }, /*not implemented */
[ 39] = { 2, 0, sys_setpgid, "setpgid" },
[ 40] = { 5, 0, printargs, "osf_old_lstat" }, /*not implemented */
[ 41] = { 1, TD, sys_dup, "dup" },
[ 42] = { 1, TD, sys_pipe, "pipe" },
[ 43] = { 5, 0, printargs, "osf_set_program_attributes" },
[ 44] = { 5, 0, printargs, "osf_profil" }, /*not implemented */
[ 45] = { 3, TD|TF, sys_open, "open" },
[ 46] = { 5, 0, printargs, "osf_old_sigaction" }, /*not implemented */
[ 47] = { 1, NF, sys_getgid, "getxgid" },
[ 48] = { 2, TS, sys_sigprocmask, "osf_sigprocmask" },
[ 49] = { 5, 0, printargs, "osf_getlogin" }, /*not implemented */
[ 50] = { 5, 0, printargs, "osf_setlogin" }, /*not implemented */
[ 51] = { 1, TF, sys_acct, "acct" },
[ 52] = { 1, TS, sys_sigpending, "sigpending" },
[ 53] = { },
[ 54] = { 3, TD, sys_ioctl, "ioctl" },
[ 55] = { 5, 0, printargs, "osf_reboot" }, /*not implemented */
[ 56] = { 5, 0, printargs, "osf_revoke" }, /*not implemented */
[ 57] = { 2, TF, sys_symlink, "symlink" },
[ 58] = { 3, TF, sys_readlink, "readlink" },
[ 59] = { 3, TF|TP|SE|SI, sys_execve, "execve" },
[ 60] = { 1, 0, sys_umask, "umask" },
[ 61] = { 1, TF, sys_chroot, "chroot" },
[ 62] = { 5, 0, printargs, "osf_old_fstat" }, /*not implemented */
[ 63] = { 0, 0, sys_getpgrp, "getpgrp" },
[ 64] = { 0, 0, sys_getpagesize, "getpagesize" },
[ 65] = { 5, TM, printargs, "osf_mremap" }, /*not implemented */
[ 66] = { 0, TP, sys_vfork, "vfork" },
[ 67] = { 2, TF, sys_stat, "stat" },
[ 68] = { 2, TF, sys_lstat, "lstat" },
[ 69] = { 5, TM, printargs, "osf_sbrk" }, /*not implemented */
[ 70] = { 5, 0, printargs, "osf_sstk" }, /*not implemented */
[ 71] = { 6, TD|TM|SI, sys_mmap, "mmap" },
[ 72] = { 5, 0, printargs, "osf_old_vadvise" }, /*not implemented */
[ 73] = { 2, TM|SI, sys_munmap, "munmap" },
[ 74] = { 3, TM|SI, sys_mprotect, "mprotect" },
[ 75] = { 3, TM, sys_madvise, "madvise" },
[ 76] = { 0, 0, sys_vhangup, "vhangup" },
[ 77] = { 5, 0, printargs, "osf_kmodcall" }, /*not implemented */
[ 78] = { 5, TM, printargs, "osf_mincore" }, /*not implemented */
[ 79] = { 2, 0, sys_getgroups, "getgroups" },
[ 80] = { 2, 0, sys_setgroups, "setgroups" },
[ 81] = { 5, 0, printargs, "osf_old_getpgrp" }, /*not implemented */
[ 82] = { 2, 0, sys_setpgrp, "setpgrp" },
[ 83] = { 3, 0, sys_osf_setitimer, "osf_setitimer" },
[ 84] = { 5, 0, printargs, "osf_old_wait" }, /*not implemented */
[ 85] = { 5, 0, printargs, "osf_table" }, /*not implemented */
[ 86] = { 2, 0, sys_osf_getitimer, "osf_getitimer" },
[ 87] = { 2, 0, sys_gethostname, "gethostname" },
[ 88] = { 2, 0, sys_sethostname, "sethostname" },
[ 89] = { 0, 0, sys_getdtablesize, "getdtablesize" },
[ 90] = { 2, TD, sys_dup2, "dup2" },
[ 91] = { 2, TD, sys_fstat, "fstat" },
[ 92] = { 3, TD, sys_fcntl, "fcntl" },
[ 93] = { 5, 0, sys_osf_select, "osf_select" },
[ 94] = { 3, TD, sys_poll, "poll" },
[ 95] = { 1, TD, sys_fsync, "fsync" },
[ 96] = { 3, 0, sys_setpriority, "setpriority" },
[ 97] = { 3, TN, sys_socket, "socket" },
[ 98] = { 3, TN, sys_connect, "connect" },
[ 99] = { 3, TN, sys_accept, "accept" },
[100] = { 2, 0, sys_getpriority, "osf_getpriority" },
[101] = { 4, TN, sys_send, "send" },
[102] = { 4, TN, sys_recv, "recv" },
[103] = { 0, TS, sys_sigreturn, "sigreturn" },
[104] = { 3, TN, sys_bind, "bind" },
[105] = { 5, TN, sys_setsockopt, "setsockopt" },
[106] = { 2, TN, sys_listen, "listen" },
[107] = { 5, 0, printargs, "osf_plock" }, /*not implemented */
[108] = { 5, 0, printargs, "osf_old_sigvec" }, /*not implemented */
[109] = { 5, 0, printargs, "osf_old_sigblock" }, /*not implemented */
[110] = { 5, 0, printargs, "osf_old_sigsetmask" }, /*not implemented */
[111] = { 3, TS, sys_sigsuspend, "sigsuspend" },
[112] = { 5, 0, printargs, "sigstack" },
[113] = { 3, TN, sys_recvmsg, "recvmsg" },
[114] = { 3, TN, sys_sendmsg, "sendmsg" },
[115] = { 5, 0, printargs, "osf_old_vtrace" }, /*not implemented */
[116] = { 2, 0, sys_osf_gettimeofday, "osf_gettimeofday" },
[117] = { 2, 0, sys_osf_getrusage, "osf_getrusage" },
[118] = { 5, TN, sys_getsockopt, "getsockopt" },
[119] = { },
[120] = { 3, TD, sys_readv, "readv" },
[121] = { 3, TD, sys_writev, "writev" },
[122] = { 2, 0, sys_osf_settimeofday, "osf_settimeofday" },
[123] = { 3, TD, sys_fchown, "fchown" },
[124] = { 2, TD, sys_fchmod, "fchmod" },
[125] = { 6, TN, sys_recvfrom, "recvfrom" },
[126] = { 2, 0, sys_setreuid, "setreuid" },
[127] = { 2, 0, sys_setregid, "setregid" },
[128] = { 2, TF, sys_rename, "rename" },
[129] = { 2, TF, sys_truncate, "truncate" },
[130] = { 2, TD, sys_ftruncate, "ftruncate" },
[131] = { 2, TD, sys_flock, "flock" },
[132] = { 1, 0, sys_setgid, "setgid" },
[133] = { 6, TN, sys_sendto, "sendto" },
[134] = { 2, TN, sys_shutdown, "shutdown" },
[135] = { 4, TN, sys_socketpair, "socketpair" },
[136] = { 2, TF, sys_mkdir, "mkdir" },
[137] = { 1, TF, sys_rmdir, "rmdir" },
[138] = { 2, 0, sys_osf_utimes, "osf_utimes" },
[139] = { 5, 0, printargs, "osf_old_sigreturn" },
[140] = { 5, 0, printargs, "osf_adjtime" }, /*not implemented */
[141] = { 3, TN, sys_getpeername, "getpeername" },
[142] = { 5, 0, printargs, "osf_gethostid" }, /*not implemented */
[143] = { 5, 0, printargs, "osf_sethostid" }, /*not implemented */
[144] = { 2, 0, sys_getrlimit, "getrlimit" },
[145] = { 2, 0, sys_setrlimit, "setrlimit" },
[146] = { 5, 0, printargs, "osf_old_killpg" }, /*not implemented */
[147] = { 0, 0, sys_setsid, "setsid" },
[148] = { 4, TF, sys_quotactl, "quotactl" },
[149] = { 5, 0, printargs, "osf_oldquota" }, /*not implemented */
[150] = { 3, TN, sys_getsockname, "getsockname" },
[151 ... 152] = { },
[153] = { 5, 0, printargs, "osf_pid_block" }, /*not implemented */
[154] = { 5, 0, printargs, "osf_pid_unblock" }, /*not implemented */
[155] = { },
[156] = { 3, TS, sys_sigaction, "sigaction" },
[157] = { 5, 0, printargs, "osf_sigwaitprim" }, /*not implemented */
[158] = { 5, 0, printargs, "osf_nfssvc" }, /*not implemented */
[159] = { 4, 0, printargs, "osf_getdirentries" },
[160] = { 3, 0, osf_statfs, "osf_statfs" },
[161] = { 3, 0, osf_fstatfs, "osf_fstatfs" },
[162] = { },
[163] = { 5, 0, printargs, "osf_asynch_daemon" }, /*not implemented */
[164] = { 5, 0, printargs, "osf_getfh" }, /*not implemented */
[165] = { 2, 0, printargs, "osf_getdomainname" },
[166] = { 2, 0, sys_setdomainname, "setdomainname" },
[167 ... 168] = { },
[169] = { 5, 0, printargs, "osf_exportfs" }, /*not implemented */
[170 ... 180] = { },
[181] = { 5, 0, printargs, "osf_alt_plock" }, /*not implemented */
[182 ... 183] = { },
[184] = { 5, 0, printargs, "osf_getmnt" }, /*not implemented */
[185 ... 186] = { },
[187] = { 5, 0, printargs, "osf_alt_sigpending" }, /*not implemented */
[188] = { 5, 0, printargs, "osf_alt_setsid" }, /*not implemented */
[189 ... 198] = { },
[199] = { 4, 0, printargs, "osf_swapon" },
[200] = { 3, TI, sys_msgctl, "msgctl" },
[201] = { 2, TI, sys_msgget, "msgget" },
[202] = { 5, TI, sys_msgrcv, "msgrcv" },
[203] = { 4, TI, sys_msgsnd, "msgsnd" },
[204] = { 4, TI, sys_semctl, "semctl" },
[205] = { 3, TI, sys_semget, "semget" },
[206] = { 4, TI, printargs, "semop" },
[207] = { 1, 0, printargs, "osf_utsname" },
[208] = { 3, TF, sys_chown, "lchown" },
[209] = { 3, TI|TM, printargs, "osf_shmat" },
[210] = { 3, TI, sys_shmctl, "shmctl" },
[211] = { 1, TI|TM|SI, sys_shmdt, "shmdt" },
[212] = { 3, TI, sys_shmget, "shmget" },
[213] = { 5, 0, printargs, "osf_mvalid" }, /*not implemented */
[214] = { 5, 0, printargs, "osf_getaddressconf" }, /*not implemented */
[215] = { 5, 0, printargs, "osf_msleep" }, /*not implemented */
[216] = { 5, 0, printargs, "osf_mwakeup" }, /*not implemented */
[217] = { 3, TM, sys_msync, "msync" },
[218] = { 5, 0, printargs, "osf_signal" }, /*not implemented */
[219] = { 5, 0, printargs, "osf_utc_gettime" }, /*not implemented */
[220] = { 5, 0, printargs, "osf_utc_adjtime" }, /*not implemented */
[221] = { },
[222] = { 5, 0, printargs, "osf_security" }, /*not implemented */
[223] = { 5, 0, printargs, "osf_kloadcall" }, /*not implemented */
[224 ... 232] = { },
[233] = { 1, 0, sys_getpgid, "getpgid" },
[234] = { 1, 0, sys_getsid, "getsid" },
[235] = { 5, TS, sys_sigaltstack, "sigaltstack" },
[236] = { 5, 0, printargs, "osf_waitid" }, /*not implemented */
[237] = { 5, 0, printargs, "osf_priocntlset" }, /*not implemented */
[238] = { 5, 0, printargs, "osf_sigsendset" }, /*not implemented */
[239] = { 5, 0, printargs, "osf_set_speculative" }, /*not implemented */
[240] = { 5, 0, printargs, "osf_msfs_syscall" }, /*not implemented */
[241] = { 5, 0, printargs, "osf_sysinfo" },
[242] = { 5, 0, printargs, "osf_uadmin" }, /*not implemented */
[243] = { 5, 0, printargs, "osf_fuser" }, /*not implemented */
[244] = { 2, 0, printargs, "osf_proplist_syscall" },
[245] = { 5, 0, printargs, "osf_ntp_adjtime" }, /*not implemented */
[246] = { 5, 0, printargs, "osf_ntp_gettime" }, /*not implemented */
[247] = { 5, 0, printargs, "osf_pathconf" }, /*not implemented */
[248] = { 5, 0, printargs, "osf_fpathconf" }, /*not implemented */
[249] = { },
[250] = { 5, 0, printargs, "osf_uswitch" }, /*not implemented */
[251] = { 2, 0, printargs, "osf_usleep_thread" },
[252] = { 5, 0, printargs, "osf_audcntl" }, /*not implemented */
[253] = { 5, 0, printargs, "osf_audgen" }, /*not implemented */
[254] = { 5, 0, sys_sysfs, "sysfs" },
[255] = { 5, 0, printargs, "osf_subsysinfo" }, /*not implemented */
[256] = { 5, 0, printargs, "osf_getsysinfo" },
[257] = { 5, 0, printargs, "osf_setsysinfo" },
[258] = { 5, 0, printargs, "osf_afs_syscall" }, /*not implemented */
[259] = { 5, 0, printargs, "osf_swapctl" }, /*not implemented */
[260] = { 5, 0, printargs, "osf_memcntl" }, /*not implemented */
[261] = { 5, 0, printargs, "osf_fdatasync" }, /*not implemented */
[262 ... 299] = { },
[300] = { 0, 0, sys_bdflush, "bdflush" },
[301] = { 3, 0, printargs, "sethae" },
[302] = { 5, TF, sys_mount, "mount" },
[303] = { 1, 0, sys_adjtimex, "adjtimex32" },
[304] = { 1, TF, sys_swapoff, "swapoff" },
[305] = { 3, TD, sys_getdents, "getdents" },
[306] = { 2, 0, sys_create_module, "create_module" },
[307] = { 4, 0, sys_init_module, "init_module" },
[308] = { 2, 0, sys_delete_module, "delete_module" },
[309] = { 1, 0, sys_get_kernel_syms, "get_kernel_syms" },
[310] = { 3, 0, sys_syslog, "syslog" },
[311] = { 4, 0, sys_reboot, "reboot" },
[312] = { 5, TP, sys_clone, "clone" },
[313] = { 1, TF, sys_uselib, "uselib" },
[314] = { 2, TM, sys_mlock, "mlock" },
[315] = { 2, TM, sys_munlock, "munlock" },
[316] = { 1, TM, sys_mlockall, "mlockall" },
[317] = { 0, TM, sys_munlockall, "munlockall" },
[318] = { 1, 0, sys_sysinfo, "sysinfo" },
[319] = { 1, 0, sys_sysctl, "sysctl" },
[320] = { 0, 0, sys_idle, "idle" },
[321] = { 1, TF, sys_umount, "oldumount" },
[322] = { 2, TF, sys_swapon, "swapon" },
[323] = { 1, 0, sys_times, "times" },
[324] = { 1, 0, sys_personality, "personality" },
[325] = { 1, NF, sys_setfsuid, "setfsuid" },
[326] = { 1, NF, sys_setfsgid, "setfsgid" },
[327] = { 2, 0, sys_ustat, "ustat" },
[328] = { 2, TF, sys_statfs, "statfs" },
[329] = { 2, TD, sys_fstatfs, "fstatfs" },
[330] = { 2, 0, sys_sched_setparam, "sched_setparam" },
[331] = { 2, 0, sys_sched_getparam, "sched_getparam" },
[332] = { 3, 0, sys_sched_setscheduler, "sched_setscheduler" },
[333] = { 2, 0, sys_sched_getscheduler, "sched_getscheduler" },
[334] = { 0, 0, sys_sched_yield, "sched_yield" },
[335] = { 1, 0, sys_sched_get_priority_max, "sched_get_priority_max"},
[336] = { 1, 0, sys_sched_get_priority_min, "sched_get_priority_min"},
[337] = { 2, 0, sys_sched_rr_get_interval, "sched_rr_get_interval" },
[338] = { 5, 0, sys_afs_syscall, "afs_syscall" },
[339] = { 1, 0, sys_uname, "uname" },
[340] = { 2, 0, sys_nanosleep, "nanosleep" },
[341] = { 5, TM|SI, sys_mremap, "mremap" },
[342] = { 3, 0, sys_nfsservctl, "nfsservctl" },
[343] = { 3, 0, sys_setresuid, "setresuid" },
[344] = { 3, 0, sys_getresuid, "getresuid" },
[345] = { 5, 0, printargs, "pciconfig_read" },
[346] = { 5, 0, printargs, "pciconfig_write" },
[347] = { 5, 0, sys_query_module, "query_module" },
[348] = { 5, 0, sys_prctl, "prctl" },
[349] = { 4, TD, sys_pread, "pread" },
[350] = { 4, TD, sys_pwrite, "pwrite" },
[351] = { 0, TS, sys_rt_sigreturn, "rt_sigreturn" },
[352] = { 5, TS, sys_rt_sigaction, "rt_sigaction" },
[353] = { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask" },
[354] = { 2, TS, sys_rt_sigpending, "rt_sigpending" },
[355] = { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait" },
[356] = { 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo" },
[357] = { 2, TS, sys_rt_sigsuspend, "rt_sigsuspend" },
[358] = { 5, TD, sys_select, "select" },
[359] = { 2, 0, sys_gettimeofday, "gettimeofday" },
[360] = { 3, 0, sys_settimeofday, "settimeofday" },
[361] = { 2, 0, sys_getitimer, "getitimer" },
[362] = { 3, 0, sys_setitimer, "setitimer" },
[363] = { 2, TF, sys_utimes, "utimes" },
[364] = { 2, 0, sys_getrusage, "getrusage" },
[365] = { 4, TP, sys_wait4, "wait4" },
[366] = { 1, 0, sys_adjtimex, "adjtimex" },
[367] = { 2, TF, sys_getcwd, "getcwd" },
[368] = { 2, 0, sys_capget, "capget" },
[369] = { 2, 0, sys_capset, "capset" },
[370] = { 4, TD|TN, sys_sendfile, "sendfile" },
[371] = { 3, 0, sys_setresgid, "setresgid" },
[372] = { 3, 0, sys_getresgid, "getresgid" },
[373] = { 4, 0, printargs, "dipc" }, /*not implemented */
[374] = { 2, TF, sys_pivotroot, "pivot_root" },
[375] = { 3, TM, sys_mincore, "mincore" },
[376] = { 3, 0, printargs, "pciconfig_iobase" },
[377] = { 3, TD, sys_getdents64, "getdents64" },
[378] = { 0, 0, sys_gettid, "gettid" },
[379] = { 3, TD, sys_readahead, "readahead" },
[380] = { },
[381] = { 2, TS, sys_kill, "tkill" },
[382] = { 5, TF, sys_setxattr, "setxattr" },
[383] = { 5, TF, sys_setxattr, "lsetxattr" },
[384] = { 5, TD, sys_fsetxattr, "fsetxattr" },
[385] = { 4, TF, sys_getxattr, "getxattr" },
[386] = { 4, TF, sys_getxattr, "lgetxattr" },
[387] = { 4, TD, sys_fgetxattr, "fgetxattr" },
[388] = { 3, TF, sys_listxattr, "listxattr" },
[389] = { 3, TF, sys_listxattr, "llistxattr" },
[390] = { 3, TD, sys_flistxattr, "flistxattr" },
[391] = { 2, TF, sys_removexattr, "removexattr" },
[392] = { 2, TF, sys_removexattr, "lremovexattr" },
[393] = { 2, TD, sys_fremovexattr, "fremovexattr" },
[394] = { 6, 0, sys_futex, "futex" },
[395] = { 3, 0, sys_sched_setaffinity, "sched_setaffinity" },
[396] = { 3, 0, sys_sched_getaffinity, "sched_getaffinity" },
[397] = { 5, 0, sys_tuxcall, "tuxcall" },
[398] = { 2, 0, sys_io_setup, "io_setup" },
[399] = { 1, 0, sys_io_destroy, "io_destroy" },
[400] = { 5, 0, sys_io_getevents, "io_getevents" },
[401] = { 3, 0, sys_io_submit, "io_submit" },
[402] = { 3, 0, sys_io_cancel, "io_cancel" },
[403 ... 404] = { },
[405] = { 1, TP|SE, sys_exit, "exit_group" },
[406] = { 3, 0, sys_lookup_dcookie, "lookup_dcookie" },
[407] = { 1, TD, sys_epoll_create, "epoll_create" },
[408] = { 4, TD, sys_epoll_ctl, "epoll_ctl" },
[409] = { 4, TD, sys_epoll_wait, "epoll_wait" },
[410] = { 5, TM|SI, sys_remap_file_pages, "remap_file_pages" },
[411] = { 1, 0, sys_set_tid_address, "set_tid_address" },
[412] = { 0, 0, sys_restart_syscall, "restart_syscall" },
[413] = { 4, TD, sys_fadvise64, "fadvise64" },
[414] = { 3, 0, sys_timer_create, "timer_create" },
[415] = { 4, 0, sys_timer_settime, "timer_settime" },
[416] = { 2, 0, sys_timer_gettime, "timer_gettime" },
[417] = { 1, 0, sys_timer_getoverrun, "timer_getoverrun" },
[418] = { 1, 0, sys_timer_delete, "timer_delete" },
[419] = { 2, 0, sys_clock_settime, "clock_settime" },
[420] = { 2, 0, sys_clock_gettime, "clock_gettime" },
[421] = { 2, 0, sys_clock_getres, "clock_getres" },
[422] = { 4, 0, sys_clock_nanosleep, "clock_nanosleep" },
[423] = { 4, TI, sys_semtimedop, "semtimedop" },
[424] = { 3, TS, sys_tgkill, "tgkill" },
[425] = { 2, TF, sys_stat64, "stat64" },
[426] = { 2, TF, sys_lstat64, "lstat64" },
[427] = { 2, TD, sys_fstat64, "fstat64" },
[428] = { 5, 0, sys_vserver, "vserver" },
[429] = { 6, TM, sys_mbind, "mbind" },
[430] = { 5, TM, sys_get_mempolicy, "get_mempolicy" },
[431] = { 3, TM, sys_set_mempolicy, "set_mempolicy" },
[432] = { 4, 0, sys_mq_open, "mq_open" },
[433] = { 1, 0, sys_mq_unlink, "mq_unlink" },
[434] = { 5, 0, sys_mq_timedsend, "mq_timedsend" },
[435] = { 5, 0, sys_mq_timedreceive, "mq_timedreceive" },
[436] = { 2, 0, sys_mq_notify, "mq_notify" },
[437] = { 3, 0, sys_mq_getsetattr, "mq_getsetattr" },
[438] = { 5, TP, sys_waitid, "waitid" },
[439] = { 5, 0, sys_add_key, "add_key" },
[440] = { 4, 0, sys_request_key, "request_key" },
[441] = { 5, 0, sys_keyctl, "keyctl" },
[442] = { 3, 0, sys_ioprio_set, "ioprio_set" },
[443] = { 2, 0, sys_ioprio_get, "ioprio_get" },
[444] = { 0, TD, sys_inotify_init, "inotify_init" },
[445] = { 3, TD, sys_inotify_add_watch, "inotify_add_watch" },
[446] = { 2, TD, sys_inotify_rm_watch, "inotify_rm_watch" },
[447] = { 1, TD, sys_fdatasync, "fdatasync" },
[448] = { 4, 0, sys_kexec_load, "kexec_load" },
[449] = { 4, TM, sys_migrate_pages, "migrate_pages" },
[450] = { 4, TD|TF, sys_openat, "openat" },
[451] = { 3, TD|TF, sys_mkdirat, "mkdirat" },
[452] = { 4, TD|TF, sys_mknodat, "mknodat" },
[453] = { 5, TD|TF, sys_fchownat, "fchownat" },
[454] = { 3, TD|TF, sys_futimesat, "futimesat" },
[455] = { 4, TD|TF, sys_newfstatat, "newfstatat" },
[456] = { 3, TD|TF, sys_unlinkat, "unlinkat" },
[457] = { 4, TD|TF, sys_renameat, "renameat" },
[458] = { 5, TD|TF, sys_linkat, "linkat" },
[459] = { 3, TD|TF, sys_symlinkat, "symlinkat" },
[460] = { 4, TD|TF, sys_readlinkat, "readlinkat" },
[461] = { 3, TD|TF, sys_fchmodat, "fchmodat" },
[462] = { 3, TD|TF, sys_faccessat, "faccessat" },
[463] = { 6, TD, sys_pselect6, "pselect6" },
[464] = { 5, TD, sys_ppoll, "ppoll" },
[465] = { 1, TP, sys_unshare, "unshare" },
[466] = { 2, 0, sys_set_robust_list, "set_robust_list" },
[467] = { 3, 0, sys_get_robust_list, "get_robust_list" },
[468] = { 6, TD, sys_splice, "splice" },
[469] = { 4, TD, sys_sync_file_range, "sync_file_range" },
[470] = { 4, TD, sys_tee, "tee" },
[471] = { 4, TD, sys_vmsplice, "vmsplice" },
[472] = { 6, TM, sys_move_pages, "move_pages" },
[473] = { 3, 0, sys_getcpu, "getcpu" },
[474] = { 6, TD, sys_epoll_pwait, "epoll_pwait" },
[475] = { 4, TD|TF, sys_utimensat, "utimensat" },
[476] = { 3, TD|TS, sys_signalfd, "signalfd" },
[477] = { 4, TD, sys_timerfd, "timerfd" },
[478] = { 1, TD, sys_eventfd, "eventfd" },
[479] = { 5, TN, sys_recvmmsg, "recvmmsg" },
[480] = { 4, TD, sys_fallocate, "fallocate" },
[481] = { 2, TD, sys_timerfd_create, "timerfd_create" },
[482] = { 4, TD, sys_timerfd_settime, "timerfd_settime" },
[483] = { 2, TD, sys_timerfd_gettime, "timerfd_gettime" },
[484] = { 4, TD|TS, sys_signalfd4, "signalfd4" },
[485] = { 2, TD, sys_eventfd2, "eventfd2" },
[486] = { 1, TD, sys_epoll_create1, "epoll_create1" },
[487] = { 3, TD, sys_dup3, "dup3" },
[488] = { 2, TD, sys_pipe2, "pipe2" },
[489] = { 1, TD, sys_inotify_init1, "inotify_init1" },
[490] = { 4, TD, sys_preadv, "preadv" },
[491] = { 4, TD, sys_pwritev, "pwritev" },
[492] = { 4, TP|TS, sys_rt_tgsigqueueinfo, "rt_tgsigqueueinfo" },
[493] = { 5, TD, sys_perf_event_open, "perf_event_open" },
[494] = { 2, TD, sys_fanotify_init, "fanotify_init" },
[495] = { 5, TD|TF, sys_fanotify_mark, "fanotify_mark" },
[496] = { 4, 0, sys_prlimit64, "prlimit64" },
[497] = { 5, TD|TF, sys_name_to_handle_at, "name_to_handle_at" },
[498] = { 3, TD, sys_open_by_handle_at, "open_by_handle_at" },
[499] = { 2, 0, sys_clock_adjtime, "clock_adjtime" },
[500] = { 1, TD, sys_syncfs, "syncfs" },
[501] = { 2, TD, sys_setns, "setns" },
[502] = { 4, TN, sys_accept4, "accept4" },
[503] = { 4, TN, sys_sendmmsg, "sendmmsg" },
[504] = { 6, 0, sys_process_vm_readv, "process_vm_readv" },
[505] = { 6, 0, sys_process_vm_writev, "process_vm_writev" },
[506] = { 5, 0, sys_kcmp, "kcmp" },
[507] = { 3, TD, sys_finit_module, "finit_module" },
[508] = { 3, 0, sys_sched_setattr, "sched_setattr" },
[509] = { 4, 0, sys_sched_getattr, "sched_getattr" },
[510] = { 5, TD|TF, sys_renameat2, "renameat2" },

67
linux/alpha/userent.h Normal file
View File

@ -0,0 +1,67 @@
{ 0, "r0" },
{ 1, "r1" },
{ 2, "r2" },
{ 3, "r3" },
{ 4, "r4" },
{ 5, "r5" },
{ 6, "r6" },
{ 7, "r7" },
{ 8, "r8" },
{ 9, "r9" },
{ 10, "r10" },
{ 11, "r11" },
{ 12, "r12" },
{ 13, "r13" },
{ 14, "r14" },
{ 15, "r15" },
{ 16, "r16" },
{ 17, "r17" },
{ 18, "r18" },
{ 19, "r19" },
{ 20, "r20" },
{ 21, "r21" },
{ 22, "r22" },
{ 23, "r23" },
{ 24, "r24" },
{ 25, "r25" },
{ 26, "r26" },
{ 27, "r27" },
{ 28, "r28" },
{ 29, "gp" },
{ 30, "fp" },
{ 31, "zero" },
{ 32, "fp0" },
{ 33, "fp" },
{ 34, "fp2" },
{ 35, "fp3" },
{ 36, "fp4" },
{ 37, "fp5" },
{ 38, "fp6" },
{ 39, "fp7" },
{ 40, "fp8" },
{ 41, "fp9" },
{ 42, "fp10" },
{ 43, "fp11" },
{ 44, "fp12" },
{ 45, "fp13" },
{ 46, "fp14" },
{ 47, "fp15" },
{ 48, "fp16" },
{ 49, "fp17" },
{ 50, "fp18" },
{ 51, "fp19" },
{ 52, "fp20" },
{ 53, "fp21" },
{ 54, "fp22" },
{ 55, "fp23" },
{ 56, "fp24" },
{ 57, "fp25" },
{ 58, "fp26" },
{ 59, "fp27" },
{ 60, "fp28" },
{ 61, "fp29" },
{ 62, "fp30" },
{ 63, "fp31" },
{ 64, "pc" },
/* Other fields in "struct user" */
#include "../userent0.h"

1
linux/arc/ioctls_arch0.h Normal file
View File

@ -0,0 +1 @@
/* Generated by ioctls_gen.sh from definitions found in $linux/arch/arc/include/ tree. */

1
linux/arc/ioctls_inc0.h Normal file
View File

@ -0,0 +1 @@
#include "32/ioctls_inc.h"

6
linux/arc/syscallent.h Normal file
View File

@ -0,0 +1,6 @@
#define ARCH_sys_mmap sys_mmap_pgoff
#include "32/syscallent.h"
[244] = { 3, 0, printargs, "arc_cacheflush"},
[245] = { 1, 0, printargs, "arc_settls" },
[246] = { 0, 0, printargs, "arc_gettls" },
[247 ... 259] = { },

1
linux/arch_regs.h Normal file
View File

@ -0,0 +1 @@
/* nothing */

1
linux/arm/arch_regs.h Normal file
View File

@ -0,0 +1 @@
extern long *const arm_sp_ptr;

View File

@ -1,2 +0,0 @@
/* Our second set comes from the i386 files. */
#include "../errnoent.h"

View File

@ -1 +0,0 @@
#include "../i386/ioctlent.h.in"

View File

@ -1,2 +0,0 @@
/* Our second set comes from the i386 files. */
#include "linux/ioctlent.h"

2
linux/arm/ioctls_arch0.h Normal file
View File

@ -0,0 +1,2 @@
/* Generated by ioctls_gen.sh from definitions found in $linux/arch/arm/include/ tree. */
{ "asm/ioctls.h", "FIOQSIZE", 0, 0x545E, 0 },

1
linux/arm/ioctls_inc0.h Normal file
View File

@ -0,0 +1 @@
#include "32/ioctls_inc.h"

View File

@ -1,2 +0,0 @@
/* Our second set comes from the i386 files. */
#include "../signalent.h"

View File

@ -26,460 +26,417 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
{ 0, 0, sys_restart_syscall, "restart_syscall"}, /* 0 */
{ 1, TP, sys_exit, "exit" }, /* 1 */
{ 0, TP, sys_fork, "fork" }, /* 2 */
{ 3, 0, sys_read, "read" }, /* 3 */
{ 3, 0, sys_write, "write" }, /* 4 */
{ 3, TF, sys_open, "open" }, /* 5 */
{ 1, 0, sys_close, "close" }, /* 6 */
{ 3, TP, sys_waitpid, "waitpid" }, /* 7 */
{ 2, TF, sys_creat, "creat" }, /* 8 */
{ 2, TF, sys_link, "link" }, /* 9 */
{ 1, TF, sys_unlink, "unlink" }, /* 10 */
{ 3, TF|TP, sys_execve, "execve" }, /* 11 */
{ 1, TF, sys_chdir, "chdir" }, /* 12 */
{ 1, 0, sys_time, "time" }, /* 13 */
{ 3, TF, sys_mknod, "mknod" }, /* 14 */
{ 2, TF, sys_chmod, "chmod" }, /* 15 */
{ 3, TF, sys_chown, "lchown" }, /* 16 */
{ 0, 0, sys_break, "break" }, /* 17 */
{ 2, TF, sys_oldstat, "oldstat" }, /* 18 */
{ 3, 0, sys_lseek, "lseek" }, /* 19 */
{ 0, 0, sys_getpid, "getpid" }, /* 20 */
{ 5, TF, sys_mount, "mount" }, /* 21 */
{ 1, TF, sys_umount, "oldumount" }, /* 22 */
{ 1, 0, sys_setuid, "setuid" }, /* 23 */
{ 0, NF, sys_getuid, "getuid" }, /* 24 */
{ 1, 0, sys_stime, "stime" }, /* 25 */
{ 4, 0, sys_ptrace, "ptrace" }, /* 26 */
{ 1, 0, sys_alarm, "alarm" }, /* 27 */
{ 2, 0, sys_oldfstat, "oldfstat" }, /* 28 */
{ 0, TS, sys_pause, "pause" }, /* 29 */
{ 2, TF, sys_utime, "utime" }, /* 30 */
{ 2, 0, sys_stty, "stty" }, /* 31 */
{ 2, 0, sys_gtty, "gtty" }, /* 32 */
{ 2, TF, sys_access, "access" }, /* 33 */
{ 1, 0, sys_nice, "nice" }, /* 34 */
{ 0, 0, sys_ftime, "ftime" }, /* 35 */
{ 0, 0, sys_sync, "sync" }, /* 36 */
{ 2, TS, sys_kill, "kill" }, /* 37 */
{ 2, TF, sys_rename, "rename" }, /* 38 */
{ 2, TF, sys_mkdir, "mkdir" }, /* 39 */
{ 1, TF, sys_rmdir, "rmdir" }, /* 40 */
{ 1, 0, sys_dup, "dup" }, /* 41 */
{ 1, 0, sys_pipe, "pipe" }, /* 42 */
{ 1, 0, sys_times, "times" }, /* 43 */
{ 0, 0, sys_prof, "prof" }, /* 44 */
{ 1, 0, sys_brk, "brk" }, /* 45 */
{ 1, 0, sys_setgid, "setgid" }, /* 46 */
{ 0, NF, sys_getgid, "getgid" }, /* 47 */
{ 3, TS, sys_signal, "signal" }, /* 48 */
{ 0, NF, sys_geteuid, "geteuid" }, /* 49 */
{ 0, NF, sys_getegid, "getegid" }, /* 50 */
{ 1, TF, sys_acct, "acct" }, /* 51 */
{ 2, TF, sys_umount2, "umount" }, /* 52 */
{ 0, 0, sys_lock, "lock" }, /* 53 */
{ 3, 0, sys_ioctl, "ioctl" }, /* 54 */
{ 3, 0, sys_fcntl, "fcntl" }, /* 55 */
{ 0, 0, sys_mpx, "mpx" }, /* 56 */
{ 2, 0, sys_setpgid, "setpgid" }, /* 57 */
{ 2, 0, sys_ulimit, "ulimit" }, /* 58 */
{ 1, 0, sys_oldolduname, "oldolduname" }, /* 59 */
{ 1, 0, sys_umask, "umask" }, /* 60 */
{ 1, TF, sys_chroot, "chroot" }, /* 61 */
{ 2, 0, sys_ustat, "ustat" }, /* 62 */
{ 2, 0, sys_dup2, "dup2" }, /* 63 */
{ 0, 0, sys_getppid, "getppid" }, /* 64 */
{ 0, 0, sys_getpgrp, "getpgrp" }, /* 65 */
{ 0, 0, sys_setsid, "setsid" }, /* 66 */
{ 3, TS, sys_sigaction, "sigaction" }, /* 67 */
{ 0, TS, sys_siggetmask, "sgetmask" }, /* 68 */
{ 1, TS, sys_sigsetmask, "ssetmask" }, /* 69 */
{ 2, 0, sys_setreuid, "setreuid" }, /* 70 */
{ 2, 0, sys_setregid, "setregid" }, /* 71 */
{ 3, TS, sys_sigsuspend, "sigsuspend" }, /* 72 */
{ 1, TS, sys_sigpending, "sigpending" }, /* 73 */
{ 2, 0, sys_sethostname, "sethostname" }, /* 74 */
{ 2, 0, sys_setrlimit, "setrlimit" }, /* 75 */
{ 2, 0, sys_getrlimit, "old_getrlimit" }, /* 76 */
{ 2, 0, sys_getrusage, "getrusage" }, /* 77 */
{ 2, 0, sys_gettimeofday, "gettimeofday" }, /* 78 */
{ 2, 0, sys_settimeofday, "settimeofday" }, /* 79 */
{ 2, 0, sys_getgroups, "getgroups" }, /* 80 */
{ 2, 0, sys_setgroups, "setgroups" }, /* 81 */
{ 1, 0, sys_oldselect, "oldselect" }, /* 82 */
{ 2, TF, sys_symlink, "symlink" }, /* 83 */
{ 2, TF, sys_oldlstat, "oldlstat" }, /* 84 */
{ 3, TF, sys_readlink, "readlink" }, /* 85 */
{ 1, TF, sys_uselib, "uselib" }, /* 86 */
{ 2, TF, sys_swapon, "swapon" }, /* 87 */
{ 4, 0, sys_reboot, "reboot" }, /* 88 */
{ 3, 0, sys_readdir, "readdir" }, /* 89 */
{ 6, TD, sys_old_mmap, "old_mmap" }, /* 90 */
{ 2, 0, sys_munmap, "munmap" }, /* 91 */
{ 2, TF, sys_truncate, "truncate" }, /* 92 */
{ 2, 0, sys_ftruncate, "ftruncate" }, /* 93 */
{ 2, 0, sys_fchmod, "fchmod" }, /* 94 */
{ 3, 0, sys_fchown, "fchown" }, /* 95 */
{ 2, 0, sys_getpriority, "getpriority" }, /* 96 */
{ 3, 0, sys_setpriority, "setpriority" }, /* 97 */
{ 4, 0, sys_profil, "profil" }, /* 98 */
{ 2, TF, sys_statfs, "statfs" }, /* 99 */
{ 2, 0, sys_fstatfs, "fstatfs" }, /* 100 */
{ 3, 0, sys_ioperm, "ioperm" }, /* 101 */
{ 2, 0, sys_socketcall, "socketcall" }, /* 102 */
{ 3, 0, sys_syslog, "syslog" }, /* 103 */
{ 3, 0, sys_setitimer, "setitimer" }, /* 104 */
{ 2, 0, sys_getitimer, "getitimer" }, /* 105 */
{ 2, TF, sys_stat, "stat" }, /* 106 */
{ 2, TF, sys_lstat, "lstat" }, /* 107 */
{ 2, 0, sys_fstat, "fstat" }, /* 108 */
{ 1, 0, sys_olduname, "olduname" }, /* 109 */
{ 1, 0, sys_iopl, "iopl" }, /* 110 */
{ 0, 0, sys_vhangup, "vhangup" }, /* 111 */
{ 0, 0, sys_idle, "idle" }, /* 112 */
{ 5, 0, printargs, "syscall" }, /* 113 */
{ 4, TP, sys_wait4, "wait4" }, /* 114 */
{ 1, TF, sys_swapoff, "swapoff" }, /* 115 */
{ 1, 0, sys_sysinfo, "sysinfo" }, /* 116 */
{ 6, TI, sys_ipc, "ipc" }, /* 117 */
{ 1, 0, sys_fsync, "fsync" }, /* 118 */
{ 0, TS, sys_sigreturn, "sigreturn" }, /* 119 */
{ 5, TP, sys_clone, "clone" }, /* 120 */
{ 2, 0, sys_setdomainname, "setdomainname" }, /* 121 */
{ 1, 0, sys_uname, "uname" }, /* 122 */
{ 3, 0, sys_modify_ldt, "modify_ldt" }, /* 123 */
{ 1, 0, sys_adjtimex, "adjtimex" }, /* 124 */
{ 3, 0, sys_mprotect, "mprotect" }, /* 125 */
{ 3, TS, sys_sigprocmask, "sigprocmask" }, /* 126 */
{ 2, 0, sys_create_module, "create_module" }, /* 127 */
{ 3, 0, sys_init_module, "init_module" }, /* 128 */
{ 2, 0, sys_delete_module, "delete_module" }, /* 129 */
{ 1, 0, sys_get_kernel_syms, "get_kernel_syms"}, /* 130 */
{ 4, 0, sys_quotactl, "quotactl" }, /* 131 */
{ 1, 0, sys_getpgid, "getpgid" }, /* 132 */
{ 1, 0, sys_fchdir, "fchdir" }, /* 133 */
{ 0, 0, sys_bdflush, "bdflush" }, /* 134 */
{ 3, 0, sys_sysfs, "sysfs" }, /* 135 */
{ 1, 0, sys_personality, "personality" }, /* 136 */
{ 5, 0, sys_afs_syscall, "afs_syscall" }, /* 137 */
{ 1, NF, sys_setfsuid, "setfsuid" }, /* 138 */
{ 1, NF, sys_setfsgid, "setfsgid" }, /* 139 */
{ 5, 0, sys_llseek, "_llseek" }, /* 140 */
{ 3, 0, sys_getdents, "getdents" }, /* 141 */
{ 5, 0, sys_select, "select" }, /* 142 */
{ 2, 0, sys_flock, "flock" }, /* 143 */
{ 3, 0, sys_msync, "msync" }, /* 144 */
{ 3, 0, sys_readv, "readv" }, /* 145 */
{ 3, 0, sys_writev, "writev" }, /* 146 */
{ 1, 0, sys_getsid, "getsid" }, /* 147 */
{ 1, 0, sys_fdatasync, "fdatasync" }, /* 148 */
{ 1, 0, sys_sysctl, "_sysctl" }, /* 149 */
{ 2, 0, sys_mlock, "mlock" }, /* 150 */
{ 2, 0, sys_munlock, "munlock" }, /* 151 */
{ 1, 0, sys_mlockall, "mlockall" }, /* 152 */
{ 0, 0, sys_munlockall, "munlockall" }, /* 153 */
{ 0, 0, sys_sched_setparam, "sched_setparam"}, /* 154 */
{ 2, 0, sys_sched_getparam, "sched_getparam"}, /* 155 */
{ 3, 0, sys_sched_setscheduler, "sched_setscheduler"}, /* 156 */
{ 1, 0, sys_sched_getscheduler, "sched_getscheduler"}, /* 157 */
{ 0, 0, sys_sched_yield, "sched_yield"}, /* 158 */
{ 1, 0, sys_sched_get_priority_max,"sched_get_priority_max"}, /* 159 */
{ 1, 0, sys_sched_get_priority_min,"sched_get_priority_min"}, /* 160 */
{ 2, 0, sys_sched_rr_get_interval,"sched_rr_get_interval"}, /* 161 */
{ 2, 0, sys_nanosleep, "nanosleep" }, /* 162 */
{ 5, 0, sys_mremap, "mremap" }, /* 163 */
{ 3, 0, sys_setresuid, "setresuid" }, /* 164 */
{ 3, 0, sys_getresuid, "getresuid" }, /* 165 */
{ 5, 0, sys_vm86, "vm86" }, /* 166 */
{ 5, 0, sys_query_module, "query_module" }, /* 167 */
{ 3, 0, sys_poll, "poll" }, /* 168 */
{ 3, 0, sys_nfsservctl, "nfsservctl" }, /* 169 */
{ 3, 0, sys_setresgid, "setresgid" }, /* 170 */
{ 3, 0, sys_getresgid, "getresgid" }, /* 171 */
{ 5, 0, sys_prctl, "prctl" }, /* 172 */
{ 0, TS, sys_rt_sigreturn, "rt_sigreturn" }, /* 173 */
{ 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 174 */
{ 4, TS, sys_rt_sigprocmask, "rt_sigprocmask"}, /* 175 */
{ 2, TS, sys_rt_sigpending, "rt_sigpending" }, /* 176 */
{ 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait"}, /* 177 */
{ 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo"}, /* 178 */
{ 2, TS, sys_rt_sigsuspend, "rt_sigsuspend" }, /* 179 */
[ 0] = { 0, 0, sys_restart_syscall, "restart_syscall" },
[ 1] = { 1, TP|SE, sys_exit, "exit" },
[ 2] = { 0, TP, sys_fork, "fork" },
[ 3] = { 3, TD, sys_read, "read" },
[ 4] = { 3, TD, sys_write, "write" },
[ 5] = { 3, TD|TF, sys_open, "open" },
[ 6] = { 1, TD, sys_close, "close" },
[ 7] = { 3, TP, sys_waitpid, "waitpid" },
[ 8] = { 2, TD|TF, sys_creat, "creat" },
[ 9] = { 2, TF, sys_link, "link" },
[ 10] = { 1, TF, sys_unlink, "unlink" },
[ 11] = { 3, TF|TP|SE|SI, sys_execve, "execve" },
[ 12] = { 1, TF, sys_chdir, "chdir" },
[ 13] = { 1, 0, sys_time, "time" },
[ 14] = { 3, TF, sys_mknod, "mknod" },
[ 15] = { 2, TF, sys_chmod, "chmod" },
[ 16] = { 3, TF, sys_chown16, "lchown" },
[ 17] = { 0, TM, sys_break, "break" },
[ 18] = { 2, TF, sys_oldstat, "oldstat" },
[ 19] = { 3, TD, sys_lseek, "lseek" },
[ 20] = { 0, 0, sys_getpid, "getpid" },
[ 21] = { 5, TF, sys_mount, "mount" },
[ 22] = { 1, TF, sys_umount, "umount" },
[ 23] = { 1, 0, sys_setuid16, "setuid" },
[ 24] = { 0, NF, sys_getuid16, "getuid" },
[ 25] = { 1, 0, sys_stime, "stime" },
[ 26] = { 4, 0, sys_ptrace, "ptrace" },
[ 27] = { 1, 0, sys_alarm, "alarm" },
[ 28] = { 2, TD, sys_oldfstat, "oldfstat" },
[ 29] = { 0, TS, sys_pause, "pause" },
[ 30] = { 2, TF, sys_utime, "utime" },
[ 31] = { 2, 0, sys_stty, "stty" },
[ 32] = { 2, 0, sys_gtty, "gtty" },
[ 33] = { 2, TF, sys_access, "access" },
[ 34] = { 1, 0, sys_nice, "nice" },
[ 35] = { 0, 0, sys_ftime, "ftime" },
[ 36] = { 0, 0, sys_sync, "sync" },
[ 37] = { 2, TS, sys_kill, "kill" },
[ 38] = { 2, TF, sys_rename, "rename" },
[ 39] = { 2, TF, sys_mkdir, "mkdir" },
[ 40] = { 1, TF, sys_rmdir, "rmdir" },
[ 41] = { 1, TD, sys_dup, "dup" },
[ 42] = { 1, TD, sys_pipe, "pipe" },
[ 43] = { 1, 0, sys_times, "times" },
[ 44] = { 0, 0, sys_prof, "prof" },
[ 45] = { 1, TM|SI, sys_brk, "brk" },
[ 46] = { 1, 0, sys_setgid16, "setgid" },
[ 47] = { 0, NF, sys_getgid16, "getgid" },
[ 48] = { 3, TS, sys_signal, "signal" },
[ 49] = { 0, NF, sys_geteuid16, "geteuid" },
[ 50] = { 0, NF, sys_getegid16, "getegid" },
[ 51] = { 1, TF, sys_acct, "acct" },
[ 52] = { 2, TF, sys_umount2, "umount2" },
[ 53] = { 0, 0, sys_lock, "lock" },
[ 54] = { 3, TD, sys_ioctl, "ioctl" },
[ 55] = { 3, TD, sys_fcntl, "fcntl" },
[ 56] = { 0, 0, sys_mpx, "mpx" },
[ 57] = { 2, 0, sys_setpgid, "setpgid" },
[ 58] = { 2, 0, sys_ulimit, "ulimit" },
[ 59] = { 1, 0, sys_oldolduname, "oldolduname" },
[ 60] = { 1, 0, sys_umask, "umask" },
[ 61] = { 1, TF, sys_chroot, "chroot" },
[ 62] = { 2, 0, sys_ustat, "ustat" },
[ 63] = { 2, TD, sys_dup2, "dup2" },
[ 64] = { 0, 0, sys_getppid, "getppid" },
[ 65] = { 0, 0, sys_getpgrp, "getpgrp" },
[ 66] = { 0, 0, sys_setsid, "setsid" },
[ 67] = { 3, TS, sys_sigaction, "sigaction" },
[ 68] = { 0, TS, sys_siggetmask, "sgetmask" },
[ 69] = { 1, TS, sys_sigsetmask, "ssetmask" },
[ 70] = { 2, 0, sys_setreuid16, "setreuid" },
[ 71] = { 2, 0, sys_setregid16, "setregid" },
[ 72] = { 3, TS, sys_sigsuspend, "sigsuspend" },
[ 73] = { 1, TS, sys_sigpending, "sigpending" },
[ 74] = { 2, 0, sys_sethostname, "sethostname" },
[ 75] = { 2, 0, sys_setrlimit, "setrlimit" },
[ 76] = { 2, 0, sys_getrlimit, "getrlimit" },
[ 77] = { 2, 0, sys_getrusage, "getrusage" },
[ 78] = { 2, 0, sys_gettimeofday, "gettimeofday" },
[ 79] = { 2, 0, sys_settimeofday, "settimeofday" },
[ 80] = { 2, 0, sys_getgroups16, "getgroups" },
[ 81] = { 2, 0, sys_setgroups16, "setgroups" },
[ 82] = { 1, TD, sys_oldselect, "oldselect" },
[ 83] = { 2, TF, sys_symlink, "symlink" },
[ 84] = { 2, TF, sys_oldlstat, "oldlstat" },
[ 85] = { 3, TF, sys_readlink, "readlink" },
[ 86] = { 1, TF, sys_uselib, "uselib" },
[ 87] = { 2, TF, sys_swapon, "swapon" },
[ 88] = { 4, 0, sys_reboot, "reboot" },
[ 89] = { 3, TD, sys_readdir, "readdir" },
[ 90] = { 1, TD|TM|SI, sys_old_mmap, "mmap" },
[ 91] = { 2, TM|SI, sys_munmap, "munmap" },
[ 92] = { 2, TF, sys_truncate, "truncate" },
[ 93] = { 2, TD, sys_ftruncate, "ftruncate" },
[ 94] = { 2, TD, sys_fchmod, "fchmod" },
[ 95] = { 3, TD, sys_fchown16, "fchown" },
[ 96] = { 2, 0, sys_getpriority, "getpriority" },
[ 97] = { 3, 0, sys_setpriority, "setpriority" },
[ 98] = { 4, 0, sys_profil, "profil" },
[ 99] = { 2, TF, sys_statfs, "statfs" },
[100] = { 2, TD, sys_fstatfs, "fstatfs" },
[101] = { 3, 0, sys_ioperm, "ioperm" },
[102] = { 2, TD, sys_socketcall, "socketcall" },
[103] = { 3, 0, sys_syslog, "syslog" },
[104] = { 3, 0, sys_setitimer, "setitimer" },
[105] = { 2, 0, sys_getitimer, "getitimer" },
[106] = { 2, TF, sys_stat, "stat" },
[107] = { 2, TF, sys_lstat, "lstat" },
[108] = { 2, TD, sys_fstat, "fstat" },
[109] = { 1, 0, sys_olduname, "olduname" },
[110] = { 1, 0, sys_iopl, "iopl" },
[111] = { 0, 0, sys_vhangup, "vhangup" },
[112] = { 0, 0, sys_idle, "idle" },
[113] = { 5, 0, printargs, "syscall" },
[114] = { 4, TP, sys_wait4, "wait4" },
[115] = { 1, TF, sys_swapoff, "swapoff" },
[116] = { 1, 0, sys_sysinfo, "sysinfo" },
[117] = { 6, TI, sys_ipc, "ipc" },
[118] = { 1, TD, sys_fsync, "fsync" },
[119] = { 0, TS, sys_sigreturn, "sigreturn" },
[120] = { 5, TP, sys_clone, "clone" },
[121] = { 2, 0, sys_setdomainname, "setdomainname" },
[122] = { 1, 0, sys_uname, "uname" },
[123] = { 3, 0, sys_modify_ldt, "modify_ldt" },
[124] = { 1, 0, sys_adjtimex, "adjtimex" },
[125] = { 3, TM|SI, sys_mprotect, "mprotect" },
[126] = { 3, TS, sys_sigprocmask, "sigprocmask" },
[127] = { 2, 0, sys_create_module, "create_module" },
[128] = { 3, 0, sys_init_module, "init_module" },
[129] = { 2, 0, sys_delete_module, "delete_module" },
[130] = { 1, 0, sys_get_kernel_syms, "get_kernel_syms" },
[131] = { 4, TF, sys_quotactl, "quotactl" },
[132] = { 1, 0, sys_getpgid, "getpgid" },
[133] = { 1, TD, sys_fchdir, "fchdir" },
[134] = { 0, 0, sys_bdflush, "bdflush" },
[135] = { 3, 0, sys_sysfs, "sysfs" },
[136] = { 1, 0, sys_personality, "personality" },
[137] = { 5, 0, sys_afs_syscall, "afs_syscall" },
[138] = { 1, NF, sys_setfsuid16, "setfsuid" },
[139] = { 1, NF, sys_setfsgid16, "setfsgid" },
[140] = { 5, TD, sys_llseek, "_llseek" },
[141] = { 3, TD, sys_getdents, "getdents" },
[142] = { 5, TD, sys_select, "select" },
[143] = { 2, TD, sys_flock, "flock" },
[144] = { 3, TM, sys_msync, "msync" },
[145] = { 3, TD, sys_readv, "readv" },
[146] = { 3, TD, sys_writev, "writev" },
[147] = { 1, 0, sys_getsid, "getsid" },
[148] = { 1, TD, sys_fdatasync, "fdatasync" },
[149] = { 1, 0, sys_sysctl, "_sysctl" },
[150] = { 2, TM, sys_mlock, "mlock" },
[151] = { 2, TM, sys_munlock, "munlock" },
[152] = { 1, TM, sys_mlockall, "mlockall" },
[153] = { 0, TM, sys_munlockall, "munlockall" },
[154] = { 2, 0, sys_sched_setparam, "sched_setparam" },
[155] = { 2, 0, sys_sched_getparam, "sched_getparam" },
[156] = { 3, 0, sys_sched_setscheduler, "sched_setscheduler" },
[157] = { 1, 0, sys_sched_getscheduler, "sched_getscheduler" },
[158] = { 0, 0, sys_sched_yield, "sched_yield" },
[159] = { 1, 0, sys_sched_get_priority_max, "sched_get_priority_max"},
[160] = { 1, 0, sys_sched_get_priority_min, "sched_get_priority_min"},
[161] = { 2, 0, sys_sched_rr_get_interval, "sched_rr_get_interval" },
[162] = { 2, 0, sys_nanosleep, "nanosleep" },
[163] = { 5, TM|SI, sys_mremap, "mremap" },
[164] = { 3, 0, sys_setresuid16, "setresuid" },
[165] = { 3, 0, sys_getresuid16, "getresuid" },
[166] = { 5, 0, sys_vm86, "vm86" },
[167] = { 5, 0, sys_query_module, "query_module" },
[168] = { 3, TD, sys_poll, "poll" },
[169] = { 3, 0, sys_nfsservctl, "nfsservctl" },
[170] = { 3, 0, sys_setresgid16, "setresgid" },
[171] = { 3, 0, sys_getresgid16, "getresgid" },
[172] = { 5, 0, sys_prctl, "prctl" },
[173] = { 0, TS, sys_rt_sigreturn, "rt_sigreturn" },
[174] = { 4, TS, sys_rt_sigaction, "rt_sigaction" },
[175] = { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask" },
[176] = { 2, TS, sys_rt_sigpending, "rt_sigpending" },
[177] = { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait" },
[178] = { 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo" },
[179] = { 2, TS, sys_rt_sigsuspend, "rt_sigsuspend" },
[180] = { 6, TD, sys_pread, "pread64" },
[181] = { 6, TD, sys_pwrite, "pwrite64" },
[182] = { 3, TF, sys_chown16, "chown" },
[183] = { 2, TF, sys_getcwd, "getcwd" },
[184] = { 2, 0, sys_capget, "capget" },
[185] = { 2, 0, sys_capset, "capset" },
[186] = { 2, TS, sys_sigaltstack, "sigaltstack" },
[187] = { 4, TD|TN, sys_sendfile, "sendfile" },
[188] = { 5, 0, sys_getpmsg, "getpmsg" },
[189] = { 5, 0, sys_putpmsg, "putpmsg" },
[190] = { 0, TP, sys_vfork, "vfork" },
[191] = { 2, 0, sys_getrlimit, "ugetrlimit" },
[192] = { 6, TD|TM|SI, sys_mmap_pgoff, "mmap2" },
[193] = { 4, TF, sys_truncate64, "truncate64" },
[194] = { 4, TD, sys_ftruncate64, "ftruncate64" },
[195] = { 2, TF, sys_stat64, "stat64" },
[196] = { 2, TF, sys_lstat64, "lstat64" },
[197] = { 2, TD, sys_fstat64, "fstat64" },
[198] = { 3, TF, sys_chown, "lchown32" },
[199] = { 0, NF, sys_getuid, "getuid32" },
[200] = { 0, NF, sys_getgid, "getgid32" },
[201] = { 0, NF, sys_geteuid, "geteuid32" },
[202] = { 0, NF, sys_geteuid, "getegid32" },
[203] = { 2, 0, sys_setreuid, "setreuid32" },
[204] = { 2, 0, sys_setregid, "setregid32" },
[205] = { 2, 0, sys_getgroups, "getgroups32" },
[206] = { 2, 0, sys_setgroups, "setgroups32" },
[207] = { 3, TD, sys_fchown, "fchown32" },
[208] = { 3, 0, sys_setresuid, "setresuid32" },
[209] = { 3, 0, sys_getresuid, "getresuid32" },
[210] = { 3, 0, sys_setresgid, "setresgid32" },
[211] = { 3, 0, sys_getresgid, "getresgid32" },
[212] = { 3, TF, sys_chown, "chown32" },
[213] = { 1, 0, sys_setuid, "setuid32" },
[214] = { 1, 0, sys_setgid, "setgid32" },
[215] = { 1, NF, sys_setfsuid, "setfsuid32" },
[216] = { 1, NF, sys_setfsgid, "setfsgid32" },
[217] = { 3, TD, sys_getdents64, "getdents64" },
[218] = { 2, TF, sys_pivotroot, "pivot_root" },
[219] = { 3, TM, sys_mincore, "mincore" },
[220] = { 3, TM, sys_madvise, "madvise" },
[221] = { 3, TD, sys_fcntl, "fcntl64" },
[222 ... 223] = { },
[224] = { 0, 0, sys_gettid, "gettid" },
[225] = { 5, TD, sys_readahead, "readahead" },
[226] = { 5, TF, sys_setxattr, "setxattr" },
[227] = { 5, TF, sys_setxattr, "lsetxattr" },
[228] = { 5, TD, sys_fsetxattr, "fsetxattr" },
[229] = { 4, TF, sys_getxattr, "getxattr" },
[230] = { 4, TF, sys_getxattr, "lgetxattr" },
[231] = { 4, TD, sys_fgetxattr, "fgetxattr" },
[232] = { 3, TF, sys_listxattr, "listxattr" },
[233] = { 3, TF, sys_listxattr, "llistxattr" },
[234] = { 3, TD, sys_flistxattr, "flistxattr" },
[235] = { 2, TF, sys_removexattr, "removexattr" },
[236] = { 2, TF, sys_removexattr, "lremovexattr" },
[237] = { 2, TD, sys_fremovexattr, "fremovexattr" },
[238] = { 2, TS, sys_kill, "tkill" },
[239] = { 4, TD|TN, sys_sendfile64, "sendfile64" },
[240] = { 6, 0, sys_futex, "futex" },
[241] = { 3, 0, sys_sched_setaffinity, "sched_setaffinity" },
[242] = { 3, 0, sys_sched_getaffinity, "sched_getaffinity" },
[243] = { 2, 0, sys_io_setup, "io_setup" },
[244] = { 1, 0, sys_io_destroy, "io_destroy" },
[245] = { 5, 0, sys_io_getevents, "io_getevents" },
[246] = { 3, 0, sys_io_submit, "io_submit" },
[247] = { 3, 0, sys_io_cancel, "io_cancel" },
[248] = { 1, TP|SE, sys_exit, "exit_group" },
[249] = { 4, 0, sys_lookup_dcookie, "lookup_dcookie" },
[250] = { 1, TD, sys_epoll_create, "epoll_create" },
[251] = { 4, TD, sys_epoll_ctl, "epoll_ctl" },
[252] = { 4, TD, sys_epoll_wait, "epoll_wait" },
[253] = { 5, TM|SI, sys_remap_file_pages, "remap_file_pages" },
[254 ... 255] = { },
[256] = { 1, 0, sys_set_tid_address, "set_tid_address" },
[257] = { 3, 0, sys_timer_create, "timer_create" },
[258] = { 4, 0, sys_timer_settime, "timer_settime" },
[259] = { 2, 0, sys_timer_gettime, "timer_gettime" },
[260] = { 1, 0, sys_timer_getoverrun, "timer_getoverrun" },
[261] = { 1, 0, sys_timer_delete, "timer_delete" },
[262] = { 2, 0, sys_clock_settime, "clock_settime" },
[263] = { 2, 0, sys_clock_gettime, "clock_gettime" },
[264] = { 2, 0, sys_clock_getres, "clock_getres" },
[265] = { 4, 0, sys_clock_nanosleep, "clock_nanosleep" },
[266] = { 3, TF, sys_statfs64, "statfs64" },
[267] = { 3, TD, sys_fstatfs64, "fstatfs64" },
[268] = { 3, TS, sys_tgkill, "tgkill" },
[269] = { 2, TF, sys_utimes, "utimes" },
[270] = { 6, TD, sys_fadvise64_64, "fadvise64_64" },
[271] = { 5, 0, printargs, "pciconfig_iobase" },
[272] = { 5, 0, printargs, "pciconfig_read" },
[273] = { 5, 0, printargs, "pciconfig_write" },
[274] = { 4, 0, sys_mq_open, "mq_open" },
[275] = { 1, 0, sys_mq_unlink, "mq_unlink" },
[276] = { 5, 0, sys_mq_timedsend, "mq_timedsend" },
[277] = { 5, 0, sys_mq_timedreceive, "mq_timedreceive" },
[278] = { 2, 0, sys_mq_notify, "mq_notify" },
[279] = { 3, 0, sys_mq_getsetattr, "mq_getsetattr" },
[280] = { 5, TP, sys_waitid, "waitid" },
[281] = { 3, TN, sys_socket, "socket" },
[282] = { 3, TN, sys_bind, "bind" },
[283] = { 3, TN, sys_connect, "connect" },
[284] = { 2, TN, sys_listen, "listen" },
[285] = { 3, TN, sys_accept, "accept" },
[286] = { 3, TN, sys_getsockname, "getsockname" },
[287] = { 3, TN, sys_getpeername, "getpeername" },
[288] = { 4, TN, sys_socketpair, "socketpair" },
[289] = { 4, TN, sys_send, "send" },
[290] = { 6, TN, sys_sendto, "sendto" },
[291] = { 4, TN, sys_recv, "recv" },
[292] = { 6, TN, sys_recvfrom, "recvfrom" },
[293] = { 2, TN, sys_shutdown, "shutdown" },
[294] = { 5, TN, sys_setsockopt, "setsockopt" },
[295] = { 5, TN, sys_getsockopt, "getsockopt" },
[296] = { 3, TN, sys_sendmsg, "sendmsg" },
[297] = { 3, TN, sys_recvmsg, "recvmsg" },
[298] = { 4, TI, sys_semop, "semop" },
[299] = { 3, TI, sys_semget, "semget" },
[300] = { 4, TI, sys_semctl, "semctl" },
[301] = { 4, TI, sys_msgsnd, "msgsnd" },
[302] = { 4, TI, sys_msgrcv, "msgrcv" },
[303] = { 2, TI, sys_msgget, "msgget" },
[304] = { 4, TI, sys_msgctl, "msgctl" },
[305] = { 4, TI|TM|SI, sys_shmat, "shmat" },
[306] = { 4, TI|TM|SI, sys_shmdt, "shmdt" },
[307] = { 3, TI, sys_shmget, "shmget" },
[308] = { 4, TI, sys_shmctl, "shmctl" },
[309] = { 5, 0, sys_add_key, "add_key" },
[310] = { 4, 0, sys_request_key, "request_key" },
[311] = { 5, 0, sys_keyctl, "keyctl" },
[312] = { 5, TI, sys_semtimedop, "semtimedop" },
[313] = { 5, 0, sys_vserver, "vserver" },
[314] = { 3, 0, sys_ioprio_set, "ioprio_set" },
[315] = { 2, 0, sys_ioprio_get, "ioprio_get" },
[316] = { 0, TD, sys_inotify_init, "inotify_init" },
[317] = { 3, TD, sys_inotify_add_watch, "inotify_add_watch" },
[318] = { 2, TD, sys_inotify_rm_watch, "inotify_rm_watch" },
[319] = { 6, TM, sys_mbind, "mbind" },
[320] = { 3, TM, sys_get_mempolicy, "get_mempolicy" },
[321] = { 5, TM, sys_set_mempolicy, "set_mempolicy" },
[322] = { 4, TD|TF, sys_openat, "openat" },
[323] = { 3, TD|TF, sys_mkdirat, "mkdirat" },
[324] = { 4, TD|TF, sys_mknodat, "mknodat" },
[325] = { 5, TD|TF, sys_fchownat, "fchownat" },
[326] = { 3, TD|TF, sys_futimesat, "futimesat" },
[327] = { 4, TD|TF, sys_newfstatat, "fstatat64" },
[328] = { 3, TD|TF, sys_unlinkat, "unlinkat" },
[329] = { 4, TD|TF, sys_renameat, "renameat" },
[330] = { 5, TD|TF, sys_linkat, "linkat" },
[331] = { 3, TD|TF, sys_symlinkat, "symlinkat" },
[332] = { 4, TD|TF, sys_readlinkat, "readlinkat" },
[333] = { 3, TD|TF, sys_fchmodat, "fchmodat" },
[334] = { 3, TD|TF, sys_faccessat, "faccessat" },
[335] = { 6, TD, sys_pselect6, "pselect6" },
[336] = { 5, TD, sys_ppoll, "ppoll" },
[337] = { 1, TP, sys_unshare, "unshare" },
[338] = { 2, 0, sys_set_robust_list, "set_robust_list" },
[339] = { 3, 0, sys_get_robust_list, "get_robust_list" },
[340] = { 6, TD, sys_splice, "splice" },
[341] = { 6, TD, sys_sync_file_range2, "sync_file_range2" },
[342] = { 4, TD, sys_tee, "tee" },
[343] = { 4, TD, sys_vmsplice, "vmsplice" },
[344] = { 6, TM, sys_move_pages, "move_pages" },
[345] = { 3, 0, sys_getcpu, "getcpu" },
[346] = { 6, TD, sys_epoll_pwait, "epoll_pwait" },
[347] = { 4, 0, sys_kexec_load, "kexec_load" },
[348] = { 4, TD|TF, sys_utimensat, "utimensat" },
[349] = { 3, TD|TS, sys_signalfd, "signalfd" },
[350] = { 4, TD, sys_timerfd_create, "timerfd_create" },
[351] = { 1, TD, sys_eventfd, "eventfd" },
[352] = { 6, TD, sys_fallocate, "fallocate" },
[353] = { 4, TD, sys_timerfd_settime, "timerfd_settime" },
[354] = { 2, TD, sys_timerfd_gettime, "timerfd_gettime" },
[355] = { 4, TD|TS, sys_signalfd4, "signalfd4" },
[356] = { 2, TD, sys_eventfd2, "eventfd2" },
[357] = { 1, TD, sys_epoll_create1, "epoll_create1" },
[358] = { 3, TD, sys_dup3, "dup3" },
[359] = { 2, TD, sys_pipe2, "pipe2" },
[360] = { 1, TD, sys_inotify_init1, "inotify_init1" },
[361] = { 5, TD, sys_preadv, "preadv" },
[362] = { 5, TD, sys_pwritev, "pwritev" },
[363] = { 4, TP|TS, sys_rt_tgsigqueueinfo, "rt_tgsigqueueinfo" },
[364] = { 5, TD, sys_perf_event_open, "perf_event_open" },
[365] = { 5, TN, sys_recvmmsg, "recvmmsg" },
[366] = { 4, TN, sys_accept4, "accept4" },
[367] = { 2, TD, sys_fanotify_init, "fanotify_init" },
[368] = { 6, TD|TF, sys_fanotify_mark, "fanotify_mark" },
[369] = { 4, 0, sys_prlimit64, "prlimit64" },
[370] = { 5, TD|TF, sys_name_to_handle_at, "name_to_handle_at" },
[371] = { 3, TD, sys_open_by_handle_at, "open_by_handle_at" },
[372] = { 2, 0, sys_clock_adjtime, "clock_adjtime" },
[373] = { 1, TD, sys_syncfs, "syncfs" },
[374] = { 4, TN, sys_sendmmsg, "sendmmsg" },
[375] = { 2, TD, sys_setns, "setns" },
[376] = { 6, 0, sys_process_vm_readv, "process_vm_readv" },
[377] = { 6, 0, sys_process_vm_writev, "process_vm_writev" },
[378] = { 5, 0, sys_kcmp, "kcmp" },
[379] = { 3, TD, sys_finit_module, "finit_module" },
[380] = { 3, 0, sys_sched_setattr, "sched_setattr" },
[381] = { 4, 0, sys_sched_getattr, "sched_getattr" },
[382] = { 5, TD|TF, sys_renameat2, "renameat2" },
[383] = { 3, 0, sys_seccomp, "seccomp", },
[384] = { 3, 0, sys_getrandom, "getrandom", },
[385] = { 2, TD, sys_memfd_create, "memfd_create", },
[386] = { 3, TD, sys_bpf, "bpf", },
[387] = { 5, TD|TF|TP|SE|SI, sys_execveat, "execveat", },
[388 ... 399] = { },
{ 6, TF, sys_pread, "pread" }, /* 180 */
{ 6, TF, sys_pwrite, "pwrite" }, /* 181 */
{ 3, TF, sys_chown, "chown" }, /* 182 */
{ 2, TF, sys_getcwd, "getcwd" }, /* 183 */
{ 2, 0, sys_capget, "capget" }, /* 184 */
{ 2, 0, sys_capset, "capset" }, /* 185 */
{ 2, TS, sys_sigaltstack, "sigaltstack" }, /* 186 */
{ 4, TD|TN, sys_sendfile, "sendfile" }, /* 187 */
{ 5, 0, sys_getpmsg, "getpmsg" }, /* 188 */
{ 5, 0, sys_putpmsg, "putpmsg" }, /* 189 */
{ 0, TP, sys_vfork, "vfork" }, /* 190 */
{ 2, 0, sys_getrlimit, "getrlimit" }, /* 191 */
{ 6, TD, sys_mmap, "mmap2" }, /* 192 */
{ 4, TF, sys_truncate64, "truncate64" }, /* 193 */
{ 4, TF, sys_ftruncate64, "ftruncate64" }, /* 194 */
{ 2, TF, sys_stat64, "stat64" }, /* 195 */
{ 2, TF, sys_lstat64, "lstat64" }, /* 196 */
{ 2, TF, sys_fstat64, "fstat64" }, /* 197 */
{ 3, TF, sys_chown, "lchown32" }, /* 198 */
{ 0, NF, sys_getuid, "getuid32" }, /* 199 */
#ifdef __ARM_EABI__
# define ARM_FIRST_SHUFFLED_SYSCALL 400
#else
# define SYS_socket_subcall 400
# include "subcall.h"
# define ARM_FIRST_SHUFFLED_SYSCALL (SYS_ipc_subcall + SYS_ipc_nsubcalls)
#endif /* !__ARM_EABI__ */
{ 0, NF, sys_getgid, "getgid32" }, /* 200 */
{ 0, NF, sys_geteuid, "geteuid32" }, /* 201 */
{ 0, NF, sys_geteuid, "getegid32" }, /* 202 */
{ 2, 0, sys_setreuid, "setreuid32" }, /* 203 */
{ 2, 0, sys_setregid, "setregid32" }, /* 204 */
{ 2, 0, sys_getgroups32, "getgroups32" }, /* 205 */
{ 2, 0, sys_setgroups32, "setgroups32" }, /* 206 */
{ 3, 0, sys_fchown, "fchown32" }, /* 207 */
{ 3, 0, sys_setresuid, "setresuid32" }, /* 208 */
{ 3, 0, sys_getresuid, "getresuid32" }, /* 209 */
{ 3, 0, sys_setresgid, "setresgid32" }, /* 210 */
{ 3, 0, sys_getresgid, "getresgid32" }, /* 211 */
{ 3, TF, sys_chown, "chown32" }, /* 212 */
{ 1, 0, sys_setuid, "setuid32" }, /* 213 */
{ 1, 0, sys_setgid, "setgid32" }, /* 214 */
{ 1, NF, sys_setfsuid, "setfsuid32" }, /* 215 */
{ 1, NF, sys_setfsgid, "setfsgid32" }, /* 216 */
{ 3, 0, sys_getdents64, "getdents64" }, /* 217 */
{ 2, TF, sys_pivotroot, "pivot_root" }, /* 218 */
{ 3, 0, sys_mincore, "mincore" }, /* 219 */
{ 3, 0, sys_madvise, "madvise" }, /* 220 */
{ 3, 0, sys_fcntl, "fcntl64" }, /* 221 */
{ 5, 0, NULL, NULL }, /* 222 */
{ 5, 0, NULL, NULL }, /* 223 */
{ 0, 0, sys_gettid, "gettid" }, /* 224 */
{ 5, 0, sys_readahead, "readahead" }, /* 225 */
{ 5, TF, sys_setxattr, "setxattr" }, /* 226 */
{ 5, TF, sys_setxattr, "lsetxattr" }, /* 227 */
{ 5, 0, sys_fsetxattr, "fsetxattr" }, /* 228 */
{ 4, TF, sys_getxattr, "getxattr" }, /* 229 */
{ 4, TF, sys_getxattr, "lgetxattr" }, /* 230 */
{ 4, TD, sys_fgetxattr, "fgetxattr" }, /* 231 */
{ 3, TF, sys_listxattr, "listxattr" }, /* 232 */
{ 3, TF, sys_listxattr, "llistxattr" }, /* 233 */
{ 3, TD, sys_flistxattr, "flistxattr" }, /* 234 */
{ 2, TF, sys_removexattr, "removexattr" }, /* 235 */
{ 2, TF, sys_removexattr, "lremovexattr" }, /* 236 */
{ 2, TD, sys_fremovexattr, "fremovexattr" }, /* 237 */
{ 2, TS, sys_kill, "tkill" }, /* 238 */
{ 4, TD|TN, sys_sendfile64, "sendfile64" }, /* 239 */
{ 6, 0, sys_futex, "futex" }, /* 240 */
{ 3, 0, sys_sched_setaffinity, "sched_setaffinity" },/* 241 */
{ 3, 0, sys_sched_getaffinity, "sched_getaffinity" },/* 242 */
{ 2, 0, sys_io_setup, "io_setup" }, /* 243 */
{ 1, 0, sys_io_destroy, "io_destroy" }, /* 244 */
{ 5, 0, sys_io_getevents, "io_getevents" }, /* 245 */
{ 3, 0, sys_io_submit, "io_submit" }, /* 246 */
{ 3, 0, sys_io_cancel, "io_cancel" }, /* 247 */
{ 1, TP, sys_exit, "exit_group" }, /* 248 */
{ 4, 0, sys_lookup_dcookie, "lookup_dcookie"}, /* 249 */
{ 1, TD, sys_epoll_create, "epoll_create" }, /* 250 */
{ 4, TD, sys_epoll_ctl, "epoll_ctl" }, /* 251 */
{ 4, TD, sys_epoll_wait, "epoll_wait" }, /* 252 */
{ 5, 0, sys_remap_file_pages, "remap_file_pages"}, /* 253 */
{ 5, 0, NULL, NULL }, /* 254 */
{ 5, 0, NULL, NULL }, /* 255 */
{ 1, 0, sys_set_tid_address, "set_tid_address"}, /* 256 */
{ 3, 0, sys_timer_create, "timer_create" }, /* 257 */
{ 4, 0, sys_timer_settime, "timer_settime" }, /* 258 */
{ 2, 0, sys_timer_gettime, "timer_gettime" }, /* 259 */
{ 1, 0, sys_timer_getoverrun, "timer_getoverrun"}, /* 260 */
{ 1, 0, sys_timer_delete, "timer_delete" }, /* 261 */
{ 2, 0, sys_clock_settime, "clock_settime" }, /* 262 */
{ 2, 0, sys_clock_gettime, "clock_gettime" }, /* 263 */
{ 2, 0, sys_clock_getres, "clock_getres" }, /* 264 */
{ 4, 0, sys_clock_nanosleep, "clock_nanosleep"}, /* 265 */
{ 3, TF, sys_statfs64, "statfs64" }, /* 266 */
{ 3, 0, sys_fstatfs64, "fstatfs64" }, /* 267 */
{ 3, TS, sys_tgkill, "tgkill" }, /* 268 */
{ 2, TF, sys_utimes, "utimes" }, /* 269 */
{ 6, TD, sys_fadvise64_64, "fadvise64_64" }, /* 270 */
{ 5, 0, printargs, "pciconfig_iobase" }, /* 271 */
{ 5, 0, printargs, "pciconfig_read" }, /* 272 */
{ 5, 0, printargs, "pciconfig_write" }, /* 273 */
{ 4, 0, sys_mq_open, "mq_open" }, /* 274 */
{ 1, 0, sys_mq_unlink, "mq_unlink" }, /* 275 */
{ 5, 0, sys_mq_timedsend, "mq_timedsend" }, /* 276 */
{ 5, 0, sys_mq_timedreceive, "mq_timedreceive" }, /* 277 */
{ 2, 0, sys_mq_notify, "mq_notify" }, /* 278 */
{ 3, 0, sys_mq_getsetattr, "mq_getsetattr" }, /* 279 */
{ 5, TP, sys_waitid, "waitid" }, /* 280 */
{ 3, TN, sys_socket, "socket" }, /* 281 */
{ 3, TN, sys_bind, "bind" }, /* 282 */
{ 3, TN, sys_connect, "connect" }, /* 283 */
{ 2, TN, sys_listen, "listen" }, /* 284 */
{ 3, TN, sys_accept, "accept" }, /* 285 */
{ 3, TN, sys_getsockname, "getsockname" }, /* 286 */
{ 3, TN, sys_getpeername, "getpeername" }, /* 287 */
{ 4, TN, sys_socketpair, "socketpair" }, /* 288 */
{ 4, TN, sys_send, "send" }, /* 289 */
{ 6, TN, sys_sendto, "sendto" }, /* 290 */
{ 4, TN, sys_recv, "recv" }, /* 291 */
{ 6, TN, sys_recvfrom, "recvfrom" }, /* 292 */
{ 2, TN, sys_shutdown, "shutdown" }, /* 293 */
{ 5, TN, sys_setsockopt, "setsockopt" }, /* 294 */
{ 5, TN, sys_getsockopt, "getsockopt" }, /* 295 */
{ 3, TN, sys_sendmsg, "sendmsg" }, /* 296 */
{ 3, TN, sys_recvmsg, "recvmsg" }, /* 297 */
{ 4, TI, sys_semop, "semop" }, /* 298 */
{ 4, TI, sys_semget, "semget" }, /* 299 */
{ 4, TI, sys_semctl, "semctl" }, /* 300 */
{ 4, TI, sys_msgsnd, "msgsnd" }, /* 301 */
{ 4, TI, sys_msgrcv, "msgrcv" }, /* 302 */
{ 4, TI, sys_msgget, "msgget" }, /* 303 */
{ 4, TI, sys_msgctl, "msgctl" }, /* 304 */
{ 4, TI, sys_shmat, "shmat" }, /* 305 */
{ 4, TI, sys_shmdt, "shmdt" }, /* 306 */
{ 4, TI, sys_shmget, "shmget" }, /* 307 */
{ 4, TI, sys_shmctl, "shmctl" }, /* 308 */
{ 5, 0, sys_add_key, "add_key" }, /* 309 */
{ 4, 0, sys_request_key, "request_key" }, /* 310 */
{ 5, 0, sys_keyctl, "keyctl" }, /* 311 */
{ 5, TI, sys_semtimedop, "semtimedop" }, /* 312 */
{ 5, 0, sys_vserver, "vserver" }, /* 313 */
{ 3, 0, sys_ioprio_set, "ioprio_set" }, /* 314 */
{ 2, 0, sys_ioprio_get, "ioprio_get" }, /* 315 */
{ 0, TD, sys_inotify_init, "inotify_init" }, /* 316 */
{ 3, TD, sys_inotify_add_watch, "inotify_add_watch" }, /* 317 */
{ 2, TD, sys_inotify_rm_watch, "inotify_rm_watch" }, /* 318 */
{ 6, 0, sys_mbind, "mbind" }, /* 319 */
{ 3, 0, sys_set_mempolicy, "set_mempolicy" }, /* 320 */
{ 5, 0, sys_get_mempolicy, "get_mempolicy" }, /* 321 */
{ 4, TD|TF, sys_openat, "openat" }, /* 322 */
{ 3, TD|TF, sys_mkdirat, "mkdirat" }, /* 323 */
{ 4, TD|TF, sys_mknodat, "mknodat" }, /* 324 */
{ 5, TD|TF, sys_fchownat, "fchownat" }, /* 325 */
{ 3, TD|TF, sys_futimesat, "futimesat" }, /* 326 */
{ 4, TD|TF, sys_newfstatat, "newfstatat" }, /* 327 */
{ 3, TD|TF, sys_unlinkat, "unlinkat" }, /* 328 */
{ 4, TD|TF, sys_renameat, "renameat" }, /* 329 */
{ 5, TD|TF, sys_linkat, "linkat" }, /* 330 */
{ 3, TD|TF, sys_symlinkat, "symlinkat" }, /* 331 */
{ 4, TD|TF, sys_readlinkat, "readlinkat" }, /* 332 */
{ 3, TD|TF, sys_fchmodat, "fchmodat" }, /* 333 */
{ 3, TD|TF, sys_faccessat, "faccessat" }, /* 334 */
{ 6, TD, sys_pselect6, "pselect6" }, /* 335 */
{ 5, TD, sys_ppoll, "ppoll" }, /* 336 */
{ 1, TP, sys_unshare, "unshare" }, /* 337 */
{ 2, 0, sys_set_robust_list, "set_robust_list" }, /* 338 */
{ 3, 0, sys_get_robust_list, "get_robust_list" }, /* 339 */
{ 6, TD, sys_splice, "splice" }, /* 340 */
{ 5, 0, NULL, NULL }, /* 341 */
{ 4, TD, sys_tee, "tee" }, /* 342 */
{ 4, TD, sys_vmsplice, "vmsplice" }, /* 343 */
{ 6, 0, sys_move_pages, "move_pages" }, /* 344 */
{ 3, 0, sys_getcpu, "getcpu" }, /* 345 */
{ 6, TD, sys_epoll_pwait, "epoll_pwait" }, /* 346 */
{ 4, 0, sys_kexec_load, "kexec_load" }, /* 347 */
{ 4, TD|TF, sys_utimensat, "utimensat" }, /* 348 */
{ 3, TD|TS, sys_signalfd, "signalfd" }, /* 349 */
{ 4, TD, sys_timerfd, "timerfd" }, /* 350 */
{ 1, TD, sys_eventfd, "eventfd" }, /* 351 */
{ 6, TD, sys_fallocate, "fallocate" }, /* 352 */
{ 4, TD, sys_timerfd_settime, "timerfd_settime"}, /* 353 */
{ 2, TD, sys_timerfd_gettime, "timerfd_gettime"}, /* 354 */
{ 4, TD|TS, sys_signalfd4, "signalfd4" }, /* 355 */
{ 2, TD, sys_eventfd2, "eventfd2" }, /* 356 */
{ 1, TD, sys_epoll_create1, "epoll_create1" }, /* 357 */
{ 3, TD, sys_dup3, "dup3" }, /* 358 */
{ 2, TD, sys_pipe2, "pipe2" }, /* 359 */
{ 1, TD, sys_inotify_init1, "inotify_init1" }, /* 360 */
{ 6, TD, sys_preadv, "preadv" }, /* 361 */
{ 6, TD, sys_pwritev, "pwritev" }, /* 362 */
{ 4, TP|TS, sys_rt_tgsigqueueinfo, "rt_tgsigqueueinfo"}, /* 363 */
{ 5, TD, sys_perf_event_open, "perf_event_open"}, /* 364 */
{ 5, TN, sys_recvmmsg, "recvmmsg" }, /* 365 */
{ 4, TN, sys_accept4, "accept4" }, /* 366 */
{ 2, TD, sys_fanotify_init, "fanotify_init" }, /* 367 */
{ 5, TD|TF, sys_fanotify_mark, "fanotify_mark" }, /* 368 */
{ 4, 0, sys_prlimit64, "prlimit64" }, /* 369 */
{ 5, TD|TF, sys_name_to_handle_at, "name_to_handle_at"}, /* 370 */
{ 3, TD, sys_open_by_handle_at, "open_by_handle_at"}, /* 371 */
{ 2, 0, sys_clock_adjtime, "clock_adjtime" }, /* 372 */
{ 1, TD, sys_syncfs, "syncfs" }, /* 373 */
{ 4, TN, sys_sendmmsg, "sendmmsg" }, /* 374 */
{ 2, TD, sys_setns, "setns" }, /* 375 */
{ 6, 0, sys_process_vm_readv, "process_vm_readv" }, /* 376 */
{ 6, 0, sys_process_vm_writev, "process_vm_writev" }, /* 377 */
{ 5, 0, NULL, NULL }, /* 378 */
{ 5, 0, NULL, NULL }, /* 379 */
{ 5, 0, NULL, NULL }, /* 380 */
{ 5, 0, NULL, NULL }, /* 381 */
{ 5, 0, NULL, NULL }, /* 382 */
{ 5, 0, NULL, NULL }, /* 383 */
{ 5, 0, NULL, NULL }, /* 384 */
{ 5, 0, NULL, NULL }, /* 385 */
{ 5, 0, NULL, NULL }, /* 386 */
{ 5, 0, NULL, NULL }, /* 387 */
{ 5, 0, NULL, NULL }, /* 388 */
{ 5, 0, NULL, NULL }, /* 389 */
{ 5, 0, NULL, NULL }, /* 390 */
{ 5, 0, NULL, NULL }, /* 391 */
{ 5, 0, NULL, NULL }, /* 392 */
{ 5, 0, NULL, NULL }, /* 393 */
{ 5, 0, NULL, NULL }, /* 394 */
{ 5, 0, NULL, NULL }, /* 395 */
{ 5, 0, NULL, NULL }, /* 396 */
{ 5, 0, NULL, NULL }, /* 397 */
{ 5, 0, NULL, NULL }, /* 398 */
{ 5, 0, NULL, NULL }, /* 399 */
/*
* __ARM_NR_cmpxchg (0x000ffff0).
* Remapped by shuffle_scno() to be directly after ordinary syscalls
* in this table.
*/
[ARM_FIRST_SHUFFLED_SYSCALL ] = { 5, 0, printargs, "cmpxchg" },
#ifndef __ARM_EABI__
#if SYS_socket_subcall != 400
#error fix me
#endif
{ 6, 0, printargs, "socket_subcall"}, /* 400 */
{ 3, TN, sys_socket, "socket" }, /* 401 */
{ 3, TN, sys_bind, "bind" }, /* 402 */
{ 3, TN, sys_connect, "connect" }, /* 403 */
{ 2, TN, sys_listen, "listen" }, /* 404 */
{ 3, TN, sys_accept, "accept" }, /* 405 */
{ 3, TN, sys_getsockname, "getsockname" }, /* 406 */
{ 3, TN, sys_getpeername, "getpeername" }, /* 407 */
{ 4, TN, sys_socketpair, "socketpair" }, /* 408 */
{ 4, TN, sys_send, "send" }, /* 409 */
{ 4, TN, sys_recv, "recv" }, /* 410 */
{ 6, TN, sys_sendto, "sendto" }, /* 411 */
{ 6, TN, sys_recvfrom, "recvfrom" }, /* 412 */
{ 2, TN, sys_shutdown, "shutdown" }, /* 413 */
{ 5, TN, sys_setsockopt, "setsockopt" }, /* 414 */
{ 5, TN, sys_getsockopt, "getsockopt" }, /* 415 */
{ 3, TN, sys_sendmsg, "sendmsg" }, /* 416 */
{ 5, TN, sys_recvmsg, "recvmsg" }, /* 417 */
{ 4, TN, sys_accept4, "accept4" }, /* 418 */
{ 5, TN, sys_recvmmsg, "recvmmsg" }, /* 419 */
#if SYS_ipc_subcall != 420
#error fix me
#endif
{ 4, 0, printargs, "ipc_subcall" }, /* 420 */
{ 4, TI, sys_semop, "semop" }, /* 421 */
{ 4, TI, sys_semget, "semget" }, /* 422 */
{ 4, TI, sys_semctl, "semctl" }, /* 423 */
{ 5, TI, sys_semtimedop, "semtimedop" }, /* 424 */
{ 4, 0, printargs, "ipc_subcall" }, /* 425 */
{ 4, 0, printargs, "ipc_subcall" }, /* 426 */
{ 4, 0, printargs, "ipc_subcall" }, /* 427 */
{ 4, 0, printargs, "ipc_subcall" }, /* 428 */
{ 4, 0, printargs, "ipc_subcall" }, /* 429 */
{ 4, 0, printargs, "ipc_subcall" }, /* 430 */
{ 4, TI, sys_msgsnd, "msgsnd" }, /* 431 */
{ 4, TI, sys_msgrcv, "msgrcv" }, /* 432 */
{ 4, TI, sys_msgget, "msgget" }, /* 433 */
{ 4, TI, sys_msgctl, "msgctl" }, /* 434 */
{ 4, 0, printargs, "ipc_subcall" }, /* 435 */
{ 4, 0, printargs, "ipc_subcall" }, /* 436 */
{ 4, 0, printargs, "ipc_subcall" }, /* 437 */
{ 4, 0, printargs, "ipc_subcall" }, /* 438 */
{ 4, 0, printargs, "ipc_subcall" }, /* 439 */
{ 4, 0, printargs, "ipc_subcall" }, /* 440 */
{ 4, TI, sys_shmat, "shmat" }, /* 441 */
{ 4, TI, sys_shmdt, "shmdt" }, /* 442 */
{ 4, TI, sys_shmget, "shmget" }, /* 443 */
{ 4, TI, sys_shmctl, "shmctl" }, /* 444 */
#endif
/*
* ARM specific syscalls. Encoded with scno 0x000f00xx.
* Remapped by shuffle_scno() to be directly after __ARM_NR_cmpxchg.
*/
[ARM_FIRST_SHUFFLED_SYSCALL+1+0] = { },
[ARM_FIRST_SHUFFLED_SYSCALL+1+1] = { 5, 0, printargs, "breakpoint" },
[ARM_FIRST_SHUFFLED_SYSCALL+1+2] = { 5, 0, printargs, "cacheflush" },
[ARM_FIRST_SHUFFLED_SYSCALL+1+3] = { 5, 0, printargs, "usr26" },
[ARM_FIRST_SHUFFLED_SYSCALL+1+4] = { 5, 0, printargs, "usr32" },
[ARM_FIRST_SHUFFLED_SYSCALL+1+5] = { 5, 0, printargs, "set_tls" },
#define ARM_LAST_SPECIAL_SYSCALL 5

View File

@ -1,7 +0,0 @@
/* ARM specific syscalls */
{ 5, 0, NULL, NULL }, /* 0 */
{ 5, 0, printargs, "breakpoint" }, /* 1 */
{ 5, 0, printargs, "cacheflush" }, /* 2 */
{ 5, 0, printargs, "usr26" }, /* 3 */
{ 5, 0, printargs, "usr32" }, /* 4 */
{ 5, 0, printargs, "set_tls" }, /* 5 */

30
linux/arm/userent.h Normal file
View File

@ -0,0 +1,30 @@
{ uoff(regs.ARM_r0), "r0" },
{ uoff(regs.ARM_r1), "r1" },
{ uoff(regs.ARM_r2), "r2" },
{ uoff(regs.ARM_r3), "r3" },
{ uoff(regs.ARM_r4), "r4" },
{ uoff(regs.ARM_r5), "r5" },
{ uoff(regs.ARM_r6), "r6" },
{ uoff(regs.ARM_r7), "r7" },
{ uoff(regs.ARM_r8), "r8" },
{ uoff(regs.ARM_r9), "r9" },
{ uoff(regs.ARM_r10), "r10" },
{ uoff(regs.ARM_fp), "fp" },
{ uoff(regs.ARM_ip), "ip" },
{ uoff(regs.ARM_sp), "sp" },
{ uoff(regs.ARM_lr), "lr" },
{ uoff(regs.ARM_pc), "pc" },
{ uoff(regs.ARM_cpsr), "cpsr" },
/* Other fields in "struct user" */
XLAT_UOFF(u_fpvalid),
XLAT_UOFF(u_tsize),
XLAT_UOFF(u_dsize),
XLAT_UOFF(u_ssize),
XLAT_UOFF(start_code),
XLAT_UOFF(start_stack),
XLAT_UOFF(signal),
XLAT_UOFF(reserved),
XLAT_UOFF(u_ar0),
XLAT_UOFF(magic),
XLAT_UOFF(u_comm),
#include "../userent0.h"

View File

@ -1 +0,0 @@
#include "../i386/ioctlent.h.in"

View File

@ -0,0 +1,8 @@
/* Generated by ioctls_gen.sh from definitions found in $linux/arch/avr32/include/ tree. */
{ "asm/sockios.h", "FIOGETOWN", 0, 0x8903, 0 },
{ "asm/sockios.h", "FIOSETOWN", 0, 0x8901, 0 },
{ "asm/sockios.h", "SIOCATMARK", 0, 0x8905, 0 },
{ "asm/sockios.h", "SIOCGPGRP", 0, 0x8904, 0 },
{ "asm/sockios.h", "SIOCGSTAMP", 0, 0x8906, 0 },
{ "asm/sockios.h", "SIOCGSTAMPNS", 0, 0x8907, 0 },
{ "asm/sockios.h", "SIOCSPGRP", 0, 0x8902, 0 },

View File

@ -0,0 +1 @@
#include "32/ioctls_inc.h"

View File

@ -25,287 +25,287 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
{ 0, 0, sys_setup, "setup" }, /* 0 */
{ 1, TP, sys_exit, "_exit" }, /* 1 */
{ 0, TP, sys_fork, "fork" }, /* 2 */
{ 3, TD, sys_read, "read" }, /* 3 */
{ 3, TD, sys_write, "write" }, /* 4 */
{ 3, TD|TF, sys_open, "open" }, /* 5 */
{ 1, TD, sys_close, "close" }, /* 6 */
{ 1, 0, sys_umask, "umask" }, /* 7 */
{ 2, TD|TF, sys_creat, "creat" }, /* 8 */
{ 2, TF, sys_link, "link" }, /* 9 */
{ 1, TF, sys_unlink, "unlink" }, /* 10 */
{ 3, TF|TP, sys_execve, "execve" }, /* 11 */
{ 1, TF, sys_chdir, "chdir" }, /* 12 */
{ 1, 0, sys_time, "time" }, /* 13 */
{ 3, TF, sys_mknod, "mknod" }, /* 14 */
{ 2, TF, sys_chmod, "chmod" }, /* 15 */
{ 3, TF, sys_chown, "chown" }, /* 16 */
{ 3, TF, sys_chown, "lchown" }, /* 17 */
{ 3, TD, sys_lseek, "lseek" }, /* 18 */
{ 5, TD, sys_llseek, "_llseek" }, /* 19 */
{ 0, 0, sys_getpid, "getpid" }, /* 20 */
{ 5, TF, sys_mount, "mount" }, /* 21 */
{ 2, TF, sys_umount, "umount" }, /* 22 */
{ 1, 0, sys_setuid, "setuid" }, /* 23 */
{ 0, NF, sys_getuid, "getuid" }, /* 24 */
{ 1, 0, sys_stime, "stime" }, /* 25 */
{ 4, 0, sys_ptrace, "ptrace" }, /* 26 */
{ 1, 0, sys_alarm, "alarm" }, /* 27 */
{ 0, TS, sys_pause, "pause" }, /* 28 */
{ 2, TF, sys_utime, "utime" }, /* 29 */
{ 2, TF, sys_stat, "stat" }, /* 30 */
{ 2, TD, sys_fstat, "fstat" }, /* 31 */
{ 2, TF, sys_lstat, "lstat" }, /* 32 */
{ 2, TF, sys_access, "access" }, /* 33 */
{ 1, TF, sys_chroot, "chroot" }, /* 34 */
{ 0, 0, sys_sync, "sync" }, /* 35 */
{ 1, TD, sys_fsync, "fsync" }, /* 36 */
{ 2, TS, sys_kill, "kill" }, /* 37 */
{ 2, TF, sys_rename, "rename" }, /* 38 */
{ 2, TF, sys_mkdir, "mkdir" }, /* 39 */
{ 1, TF, sys_rmdir, "rmdir" }, /* 40 */
{ 1, TD, sys_dup, "dup" }, /* 41 */
{ 1, TD, sys_pipe, "pipe" }, /* 42 */
{ 1, 0, sys_times, "times" }, /* 43 */
{ 5, TP, sys_clone, "clone" }, /* 44 */
{ 1, 0, sys_brk, "brk" }, /* 45 */
{ 1, 0, sys_setgid, "setgid" }, /* 46 */
{ 0, NF, sys_getgid, "getgid" }, /* 47 */
{ 2, TF, sys_getcwd, "getcwd" }, /* 48 */
{ 0, NF, sys_geteuid, "geteuid" }, /* 49 */
{ 0, NF, sys_getegid, "getegid" }, /* 50 */
{ 1, TF, sys_acct, "acct" }, /* 51 */
{ 1, NF, sys_setfsuid, "setfsuid" }, /* 52 */
{ 1, NF, sys_setfsgid, "setfsgid" }, /* 53 */
{ 3, TD, sys_ioctl, "ioctl" }, /* 54 */
{ 3, TD, sys_fcntl, "fcntl" }, /* 55 */
{ 2, 0, sys_setpgid, "setpgid" }, /* 56 */
{ 5, 0, sys_mremap, "mremap" }, /* 57 */
{ 3, 0, sys_setresuid, "setresuid" }, /* 58 */
{ 3, 0, sys_getresuid, "getresuid" }, /* 59 */
{ 2, 0, sys_setreuid, "setreuid" }, /* 60 */
{ 2, 0, sys_setregid, "setregid" }, /* 61 */
{ 2, 0, sys_ustat, "ustat" }, /* 62 */
{ 2, TD, sys_dup2, "dup2" }, /* 63 */
{ 0, 0, sys_getppid, "getppid" }, /* 64 */
{ 0, 0, sys_getpgrp, "getpgrp" }, /* 65 */
{ 0, 0, sys_setsid, "setsid" }, /* 66 */
{ 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 67 */
{ 0, TS, sys_rt_sigreturn, "rt_sigreturn" }, /* 68 */
{ 4, TS, sys_rt_sigprocmask, "rt_sigprocmask"}, /* 69 */
{ 2, TS, sys_rt_sigpending, "rt_sigpending" }, /* 70 */
{ 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait"}, /* 71 */
{ 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo"}, /* 72 */
{ 2, TS, sys_rt_sigsuspend, "rt_sigsuspend" }, /* 73 */
{ 2, 0, sys_sethostname, "sethostname" }, /* 74 */
{ 2, 0, sys_setrlimit, "setrlimit" }, /* 75 */
{ 2, 0, sys_getrlimit, "old_getrlimit" }, /* 76 */
{ 2, 0, sys_getrusage, "getrusage" }, /* 77 */
{ 2, 0, sys_gettimeofday, "gettimeofday" }, /* 78 */
{ 2, 0, sys_settimeofday, "settimeofday" }, /* 79 */
{ 2, 0, sys_getgroups, "getgroups" }, /* 80 */
{ 2, 0, sys_setgroups, "setgroups" }, /* 81 */
{ 5, TD, sys_select, "select" }, /* 82 */
{ 2, TF, sys_symlink, "symlink" }, /* 83 */
{ 1, TD, sys_fchdir, "fchdir" }, /* 84 */
{ 3, TF, sys_readlink, "readlink" }, /* 85 */
{ 5, TD, sys_pread, "pread" }, /* 86 */
{ 5, TD, sys_pwrite, "pwrite" }, /* 87 */
{ 2, TF, sys_swapon, "swapon" }, /* 88 */
{ 4, 0, sys_reboot, "reboot" }, /* 89 */
{ 6, TD, sys_mmap, "mmap" }, /* 90 */
{ 2, 0, sys_munmap, "munmap" }, /* 91 */
{ 2, TF, sys_truncate, "truncate" }, /* 92 */
{ 2, TD, sys_ftruncate, "ftruncate" }, /* 93 */
{ 2, TD, sys_fchmod, "fchmod" }, /* 94 */
{ 3, TD, sys_fchown, "fchown" }, /* 95 */
{ 2, 0, sys_getpriority, "getpriority" }, /* 96 */
{ 3, 0, sys_setpriority, "setpriority" }, /* 97 */
{ 4, TP, sys_wait4, "wait4" }, /* 98 */
{ 2, TF, sys_statfs, "statfs" }, /* 99 */
{ 2, TD, sys_fstatfs, "fstatfs" }, /* 100 */
{ 0, 0, sys_vhangup, "vhangup" }, /* 101 */
{ 2, TS, sys_sigaltstack, "sigaltstack" }, /* 102 */
{ 3, 0, sys_syslog, "syslog" }, /* 103 */
{ 3, 0, sys_setitimer, "setitimer" }, /* 104 */
{ 2, 0, sys_getitimer, "getitimer" }, /* 105 */
{ 1, TF, sys_swapoff, "swapoff" }, /* 106 */
{ 1, 0, sys_sysinfo, "sysinfo" }, /* 107 */
{ 6, TI, sys_ipc, "ipc" }, /* 108 */
{ 4, TD|TN, sys_sendfile, "sendfile" }, /* 109 */
{ 2, 0, sys_setdomainname, "setdomainname" }, /* 110 */
{ 1, 0, sys_uname, "uname" }, /* 111 */
{ 1, 0, sys_adjtimex, "adjtimex" }, /* 112 */
{ 3, 0, sys_mprotect, "mprotect" }, /* 113 */
{ 0, TP, sys_vfork, "vfork" }, /* 114 */
{ 3, 0, sys_init_module, "init_module" }, /* 115 */
{ 2, 0, sys_delete_module, "delete_module" }, /* 116 */
{ 4, 0, sys_quotactl, "quotactl" }, /* 117 */
{ 1, 0, sys_getpgid, "getpgid" }, /* 118 */
{ 0, 0, sys_bdflush, "bdflush" }, /* 119 */
{ 3, 0, sys_sysfs, "sysfs" }, /* 120 */
{ 1, 0, sys_personality, "personality" }, /* 121 */
{ 5, 0, sys_afs_syscall, "afs_syscall" }, /* 122 */
{ 3, TD, sys_getdents, "getdents" }, /* 123 */
{ 2, TD, sys_flock, "flock" }, /* 124 */
{ 3, 0, sys_msync, "msync" }, /* 125 */
{ 3, TD, sys_readv, "readv" }, /* 126 */
{ 3, TD, sys_writev, "writev" }, /* 127 */
{ 1, 0, sys_getsid, "getsid" }, /* 128 */
{ 1, TD, sys_fdatasync, "fdatasync" }, /* 129 */
{ 1, 0, sys_sysctl, "_sysctl" }, /* 130 */
{ 2, 0, sys_mlock, "mlock" }, /* 131 */
{ 2, 0, sys_munlock, "munlock" }, /* 132 */
{ 1, 0, sys_mlockall, "mlockall" }, /* 133 */
{ 0, 0, sys_munlockall, "munlockall" }, /* 134 */
{ 0, 0, sys_sched_setparam, "sched_setparam"}, /* 135 */
{ 2, 0, sys_sched_getparam, "sched_getparam"}, /* 136 */
{ 3, 0, sys_sched_setscheduler, "sched_setscheduler"}, /* 137 */
{ 1, 0, sys_sched_getscheduler, "sched_getscheduler"}, /* 138 */
{ 0, 0, sys_sched_yield, "sched_yield"}, /* 139 */
{ 1, 0, sys_sched_get_priority_max,"sched_get_priority_max"}, /* 140 */
{ 1, 0, sys_sched_get_priority_min,"sched_get_priority_min"}, /* 141 */
{ 2, 0, sys_sched_rr_get_interval,"sched_rr_get_interval"}, /* 142 */
{ 2, 0, sys_nanosleep, "nanosleep" }, /* 143 */
{ 3, TD, sys_poll, "poll" }, /* 144 */
{ 3, 0, sys_nfsservctl, "nfsservctl" }, /* 145 */
{ 3, 0, sys_setresgid, "setresgid" }, /* 146 */
{ 3, 0, sys_getresgid, "getresgid" }, /* 147 */
{ 5, 0, sys_prctl, "prctl" }, /* 148 */
{ 3, TN, sys_socket, "socket" }, /* 149 */
{ 3, TN, sys_bind, "bind" }, /* 150 */
{ 3, TN, sys_connect, "connect" }, /* 151 */
{ 2, TN, sys_listen, "listen" }, /* 152 */
{ 3, TN, sys_accept, "accept" }, /* 153 */
{ 3, TN, sys_getsockname, "getsockname" }, /* 154 */
{ 3, TN, sys_getpeername, "getpeername" }, /* 155 */
{ 4, TN, sys_socketpair, "socketpair" }, /* 156 */
{ 4, TN, sys_send, "send" }, /* 157 */
{ 4, TN, sys_recv, "recv" }, /* 158 */
{ 6, TN, sys_sendto, "sendto" }, /* 159 */
{ 6, TN, sys_recvfrom, "recvfrom" }, /* 160 */
{ 2, TN, sys_shutdown, "shutdown" }, /* 161 */
{ 5, TN, sys_setsockopt, "setsockopt" }, /* 162 */
{ 5, TN, sys_getsockopt, "getsockopt" }, /* 163 */
{ 3, TN, sys_sendmsg, "sendmsg" }, /* 164 */
{ 5, TN, sys_recvmsg, "recvmsg" }, /* 165 */
{ 3, TF, sys_truncate64, "truncate64" }, /* 166 */
{ 3, TD, sys_ftruncate64, "ftruncate64" }, /* 167 */
{ 2, TF, sys_stat64, "stat64" }, /* 168 */
{ 2, TF, sys_lstat64, "lstat64" }, /* 169 */
{ 2, TD, sys_fstat64, "fstat64" }, /* 170 */
{ 2, TF, sys_pivotroot, "pivot_root" }, /* 171 */
{ 3, 0, sys_mincore, "mincore" }, /* 172 */
{ 3, 0, sys_madvise, "madvise" }, /* 173 */
{ 3, TD, sys_getdents64, "getdents64" }, /* 174 */
{ 3, TD, sys_fcntl, "fcntl64" }, /* 175 */
{ 0, 0, sys_gettid, "gettid" }, /* 176 */
{ 4, TD, sys_readahead, "readahead" }, /* 177 */
{ 5, TF, sys_setxattr, "setxattr" }, /* 178 */
{ 5, TF, sys_setxattr, "lsetxattr" }, /* 179 */
{ 5, TD, sys_fsetxattr, "fsetxattr" }, /* 180 */
{ 4, TF, sys_getxattr, "getxattr" }, /* 181 */
{ 4, TF, sys_getxattr, "lgetxattr" }, /* 182 */
{ 4, TD, sys_fgetxattr, "fgetxattr" }, /* 183 */
{ 3, TF, sys_listxattr, "listxattr" }, /* 184 */
{ 3, TF, sys_listxattr, "llistxattr" }, /* 185 */
{ 3, TD, sys_flistxattr, "flistxattr" }, /* 186 */
{ 2, TF, sys_removexattr, "removexattr" }, /* 187 */
{ 2, TF, sys_removexattr, "lremovexattr" }, /* 188 */
{ 2, TD, sys_fremovexattr, "fremovexattr" }, /* 189 */
{ 2, TS, sys_kill, "tkill" }, /* 190 */
{ 4, TD|TN, sys_sendfile64, "sendfile64" }, /* 191 */
{ 6, 0, sys_futex, "futex" }, /* 192 */
{ 3, 0, sys_sched_setaffinity, "sched_setaffinity" },/* 193 */
{ 3, 0, sys_sched_getaffinity, "sched_getaffinity" },/* 194 */
{ 2, 0, sys_capget, "capget" }, /* 195 */
{ 2, 0, sys_capset, "capset" }, /* 196 */
{ 2, 0, sys_io_setup, "io_setup" }, /* 197 */
{ 1, 0, sys_io_destroy, "io_destroy" }, /* 198 */
{ 5, 0, sys_io_getevents, "io_getevents" }, /* 199 */
{ 3, 0, sys_io_submit, "io_submit" }, /* 200 */
{ 3, 0, sys_io_cancel, "io_cancel" }, /* 201 */
{ 5, TD, sys_fadvise64, "fadvise64" }, /* 202 */
{ 1, TP, sys_exit, "exit_group" }, /* 203 */
{ 4, 0, sys_lookup_dcookie, "lookup_dcookie"}, /* 204 */
{ 1, TD, sys_epoll_create, "epoll_create" }, /* 205 */
{ 4, TD, sys_epoll_ctl, "epoll_ctl" }, /* 206 */
{ 4, TD, sys_epoll_wait, "epoll_wait" }, /* 207 */
{ 5, 0, sys_remap_file_pages, "remap_file_pages"}, /* 208 */
{ 1, 0, sys_set_tid_address, "set_tid_address"}, /* 209 */
{ 3, 0, sys_timer_create, "timer_create" }, /* 210 */
{ 4, 0, sys_timer_settime, "timer_settime" }, /* 211 */
{ 2, 0, sys_timer_gettime, "timer_gettime" }, /* 212 */
{ 1, 0, sys_timer_getoverrun, "timer_getoverrun"}, /* 213 */
{ 1, 0, sys_timer_delete, "timer_delete" }, /* 214 */
{ 2, 0, sys_clock_settime, "clock_settime" }, /* 215 */
{ 2, 0, sys_clock_gettime, "clock_gettime" }, /* 216 */
{ 2, 0, sys_clock_getres, "clock_getres" }, /* 217 */
{ 4, 0, sys_clock_nanosleep, "clock_nanosleep"}, /* 218 */
{ 3, TF, sys_statfs64, "statfs64" }, /* 219 */
{ 3, TD, sys_fstatfs64, "fstatfs64" }, /* 220 */
{ 3, TS, sys_tgkill, "tgkill" }, /* 221 */
{ 5, 0, NULL, NULL }, /* 222 */
{ 2, TF, sys_utimes, "utimes" }, /* 223 */
{ 6, TD, sys_fadvise64_64, "fadvise64_64" }, /* 224 */
{ 3, 0, printargs, "cacheflush" }, /* 225 */
{ 5, 0, sys_vserver, "vserver" }, /* 226 */
{ 4, 0, sys_mq_open, "mq_open" }, /* 227 */
{ 1, 0, sys_mq_unlink, "mq_unlink" }, /* 228 */
{ 5, 0, sys_mq_timedsend, "mq_timedsend" }, /* 229 */
{ 5, 0, sys_mq_timedreceive, "mq_timedreceive" }, /* 230 */
{ 2, 0, sys_mq_notify, "mq_notify" }, /* 231 */
{ 3, 0, sys_mq_getsetattr, "mq_getsetattr" }, /* 232 */
{ 4, 0, sys_kexec_load, "kexec_load" }, /* 233 */
{ 5, TP, sys_waitid, "waitid" }, /* 234 */
{ 5, 0, sys_add_key, "add_key" }, /* 235 */
{ 4, 0, sys_request_key, "request_key" }, /* 236 */
{ 5, 0, sys_keyctl, "keyctl" }, /* 237 */
{ 3, 0, sys_ioprio_set, "ioprio_set" }, /* 238 */
{ 2, 0, sys_ioprio_get, "ioprio_get" }, /* 239 */
{ 0, 0, sys_inotify_init, "inotify_init" }, /* 240 */
{ 3, TD, sys_inotify_add_watch, "inotify_add_watch" }, /* 241 */
{ 2, TD, sys_inotify_rm_watch, "inotify_rm_watch" }, /* 242 */
{ 4, TD|TF, sys_openat, "openat" }, /* 243 */
{ 3, TD|TF, sys_mkdirat, "mkdirat" }, /* 244 */
{ 4, TD|TF, sys_mknodat, "mknodat" }, /* 245 */
{ 5, TD|TF, sys_fchownat, "fchownat" }, /* 246 */
{ 3, TD|TF, sys_futimesat, "futimesat" }, /* 247 */
{ 4, TD|TF, printargs, "fstatat64" }, /* 248 */
{ 3, TD|TF, sys_unlinkat, "unlinkat" }, /* 249 */
{ 4, TD|TF, sys_renameat, "renameat" }, /* 250 */
{ 5, TD|TF, sys_linkat, "linkat" }, /* 251 */
{ 3, TD|TF, sys_symlinkat, "symlinkat" }, /* 252 */
{ 4, TD|TF, sys_readlinkat, "readlinkat" }, /* 253 */
{ 3, TD|TF, sys_fchmodat, "fchmodat" }, /* 254 */
{ 3, TD|TF, sys_faccessat, "faccessat" }, /* 255 */
{ 6, TD, sys_pselect6, "pselect6" }, /* 256 */
{ 5, TD, sys_ppoll, "ppoll" }, /* 257 */
{ 1, TD, sys_unshare, "unshare" }, /* 258 */
{ 2, 0, sys_set_robust_list, "set_robust_list" }, /* 259 */
{ 3, 0, sys_get_robust_list, "get_robust_list" }, /* 260 */
{ 6, TD, sys_splice, "splice" }, /* 261 */
{ 4, TD, sys_sync_file_range, "sync_file_range" }, /* 262 */
{ 4, TD, sys_tee, "tee" }, /* 263 */
{ 4, TD, sys_vmsplice, "vmsplice" }, /* 264 */
{ 6, TD, sys_epoll_pwait, "epoll_pwait" }, /* 265 */
{ 4, TI, sys_msgget, "msgget" }, /* 266 */
{ 4, TI, sys_msgsnd, "msgsnd" }, /* 267 */
{ 5, TI, sys_msgrcv, "msgrcv" }, /* 268 */
{ 3, TI, sys_msgctl, "msgctl" }, /* 269 */
{ 4, TI, sys_semget, "semget" }, /* 270 */
{ 4, TI, sys_semop, "semop" }, /* 271 */
{ 4, TI, sys_semctl, "semctl" }, /* 272 */
{ 5, TI, sys_semtimedop, "semtimedop" }, /* 273 */
{ 4, TI, sys_shmat, "shmat" }, /* 274 */
{ 4, TI, sys_shmget, "shmget" }, /* 275 */
{ 4, TI, sys_shmdt, "shmdt" }, /* 276 */
{ 4, TI, sys_shmctl, "shmctl" }, /* 277 */
{ 4, TD|TF, sys_utimensat, "utimensat" }, /* 278 */
{ 3, TD|TS, sys_signalfd, "signalfd" }, /* 279 */
{ 2, TD, sys_timerfd, "timerfd_create" }, /* 280 */
{ 1, TD, sys_eventfd, "eventfd" }, /* 281 */
{ 5, 0, NULL, NULL }, /* 282 */
{ 2, TD, sys_setns, "setns" }, /* 283 */
[ 0] = { 0, 0, sys_setup, "setup" },
[ 1] = { 1, TP|SE, sys_exit, "_exit" },
[ 2] = { 0, TP, sys_fork, "fork" },
[ 3] = { 3, TD, sys_read, "read" },
[ 4] = { 3, TD, sys_write, "write" },
[ 5] = { 3, TD|TF, sys_open, "open" },
[ 6] = { 1, TD, sys_close, "close" },
[ 7] = { 1, 0, sys_umask, "umask" },
[ 8] = { 2, TD|TF, sys_creat, "creat" },
[ 9] = { 2, TF, sys_link, "link" },
[ 10] = { 1, TF, sys_unlink, "unlink" },
[ 11] = { 3, TF|TP|SE|SI, sys_execve, "execve" },
[ 12] = { 1, TF, sys_chdir, "chdir" },
[ 13] = { 1, 0, sys_time, "time" },
[ 14] = { 3, TF, sys_mknod, "mknod" },
[ 15] = { 2, TF, sys_chmod, "chmod" },
[ 16] = { 3, TF, sys_chown, "chown" },
[ 17] = { 3, TF, sys_chown, "lchown" },
[ 18] = { 3, TD, sys_lseek, "lseek" },
[ 19] = { 5, TD, sys_llseek, "_llseek" },
[ 20] = { 0, 0, sys_getpid, "getpid" },
[ 21] = { 5, TF, sys_mount, "mount" },
[ 22] = { 1, TF, sys_umount, "umount" },
[ 23] = { 1, 0, sys_setuid, "setuid" },
[ 24] = { 0, NF, sys_getuid, "getuid" },
[ 25] = { 1, 0, sys_stime, "stime" },
[ 26] = { 4, 0, sys_ptrace, "ptrace" },
[ 27] = { 1, 0, sys_alarm, "alarm" },
[ 28] = { 0, TS, sys_pause, "pause" },
[ 29] = { 2, TF, sys_utime, "utime" },
[ 30] = { 2, TF, sys_stat, "stat" },
[ 31] = { 2, TD, sys_fstat, "fstat" },
[ 32] = { 2, TF, sys_lstat, "lstat" },
[ 33] = { 2, TF, sys_access, "access" },
[ 34] = { 1, TF, sys_chroot, "chroot" },
[ 35] = { 0, 0, sys_sync, "sync" },
[ 36] = { 1, TD, sys_fsync, "fsync" },
[ 37] = { 2, TS, sys_kill, "kill" },
[ 38] = { 2, TF, sys_rename, "rename" },
[ 39] = { 2, TF, sys_mkdir, "mkdir" },
[ 40] = { 1, TF, sys_rmdir, "rmdir" },
[ 41] = { 1, TD, sys_dup, "dup" },
[ 42] = { 1, TD, sys_pipe, "pipe" },
[ 43] = { 1, 0, sys_times, "times" },
[ 44] = { 5, TP, sys_clone, "clone" },
[ 45] = { 1, TM|SI, sys_brk, "brk" },
[ 46] = { 1, 0, sys_setgid, "setgid" },
[ 47] = { 0, NF, sys_getgid, "getgid" },
[ 48] = { 2, TF, sys_getcwd, "getcwd" },
[ 49] = { 0, NF, sys_geteuid, "geteuid" },
[ 50] = { 0, NF, sys_getegid, "getegid" },
[ 51] = { 1, TF, sys_acct, "acct" },
[ 52] = { 1, NF, sys_setfsuid, "setfsuid" },
[ 53] = { 1, NF, sys_setfsgid, "setfsgid" },
[ 54] = { 3, TD, sys_ioctl, "ioctl" },
[ 55] = { 3, TD, sys_fcntl, "fcntl" },
[ 56] = { 2, 0, sys_setpgid, "setpgid" },
[ 57] = { 5, TM|SI, sys_mremap, "mremap" },
[ 58] = { 3, 0, sys_setresuid, "setresuid" },
[ 59] = { 3, 0, sys_getresuid, "getresuid" },
[ 60] = { 2, 0, sys_setreuid, "setreuid" },
[ 61] = { 2, 0, sys_setregid, "setregid" },
[ 62] = { 2, 0, sys_ustat, "ustat" },
[ 63] = { 2, TD, sys_dup2, "dup2" },
[ 64] = { 0, 0, sys_getppid, "getppid" },
[ 65] = { 0, 0, sys_getpgrp, "getpgrp" },
[ 66] = { 0, 0, sys_setsid, "setsid" },
[ 67] = { 4, TS, sys_rt_sigaction, "rt_sigaction" },
[ 68] = { 0, TS, sys_rt_sigreturn, "rt_sigreturn" },
[ 69] = { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask" },
[ 70] = { 2, TS, sys_rt_sigpending, "rt_sigpending" },
[ 71] = { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait" },
[ 72] = { 3, TS, sys_rt_sigqueueinfo, "rt_sigqueueinfo" },
[ 73] = { 2, TS, sys_rt_sigsuspend, "rt_sigsuspend" },
[ 74] = { 2, 0, sys_sethostname, "sethostname" },
[ 75] = { 2, 0, sys_setrlimit, "setrlimit" },
[ 76] = { 2, 0, sys_getrlimit, "getrlimit" },
[ 77] = { 2, 0, sys_getrusage, "getrusage" },
[ 78] = { 2, 0, sys_gettimeofday, "gettimeofday" },
[ 79] = { 2, 0, sys_settimeofday, "settimeofday" },
[ 80] = { 2, 0, sys_getgroups, "getgroups" },
[ 81] = { 2, 0, sys_setgroups, "setgroups" },
[ 82] = { 5, TD, sys_select, "select" },
[ 83] = { 2, TF, sys_symlink, "symlink" },
[ 84] = { 1, TD, sys_fchdir, "fchdir" },
[ 85] = { 3, TF, sys_readlink, "readlink" },
[ 86] = { 5, TD, sys_pread, "pread" },
[ 87] = { 5, TD, sys_pwrite, "pwrite" },
[ 88] = { 2, TF, sys_swapon, "swapon" },
[ 89] = { 4, 0, sys_reboot, "reboot" },
[ 90] = { 6, TD|TM|SI, sys_mmap_pgoff, "mmap" },
[ 91] = { 2, TM|SI, sys_munmap, "munmap" },
[ 92] = { 2, TF, sys_truncate, "truncate" },
[ 93] = { 2, TD, sys_ftruncate, "ftruncate" },
[ 94] = { 2, TD, sys_fchmod, "fchmod" },
[ 95] = { 3, TD, sys_fchown, "fchown" },
[ 96] = { 2, 0, sys_getpriority, "getpriority" },
[ 97] = { 3, 0, sys_setpriority, "setpriority" },
[ 98] = { 4, TP, sys_wait4, "wait4" },
[ 99] = { 2, TF, sys_statfs, "statfs" },
[100] = { 2, TD, sys_fstatfs, "fstatfs" },
[101] = { 0, 0, sys_vhangup, "vhangup" },
[102] = { 2, TS, sys_sigaltstack, "sigaltstack" },
[103] = { 3, 0, sys_syslog, "syslog" },
[104] = { 3, 0, sys_setitimer, "setitimer" },
[105] = { 2, 0, sys_getitimer, "getitimer" },
[106] = { 1, TF, sys_swapoff, "swapoff" },
[107] = { 1, 0, sys_sysinfo, "sysinfo" },
[108] = { 6, TI, sys_ipc, "ipc" },
[109] = { 4, TD|TN, sys_sendfile, "sendfile" },
[110] = { 2, 0, sys_setdomainname, "setdomainname" },
[111] = { 1, 0, sys_uname, "uname" },
[112] = { 1, 0, sys_adjtimex, "adjtimex" },
[113] = { 3, TM|SI, sys_mprotect, "mprotect" },
[114] = { 0, TP, sys_vfork, "vfork" },
[115] = { 3, 0, sys_init_module, "init_module" },
[116] = { 2, 0, sys_delete_module, "delete_module" },
[117] = { 4, TF, sys_quotactl, "quotactl" },
[118] = { 1, 0, sys_getpgid, "getpgid" },
[119] = { 0, 0, sys_bdflush, "bdflush" },
[120] = { 3, 0, sys_sysfs, "sysfs" },
[121] = { 1, 0, sys_personality, "personality" },
[122] = { 5, 0, sys_afs_syscall, "afs_syscall" },
[123] = { 3, TD, sys_getdents, "getdents" },
[124] = { 2, TD, sys_flock, "flock" },
[125] = { 3, TM, sys_msync, "msync" },
[126] = { 3, TD, sys_readv, "readv" },
[127] = { 3, TD, sys_writev, "writev" },
[128] = { 1, 0, sys_getsid, "getsid" },
[129] = { 1, TD, sys_fdatasync, "fdatasync" },
[130] = { 1, 0, sys_sysctl, "_sysctl" },
[131] = { 2, TM, sys_mlock, "mlock" },
[132] = { 2, TM, sys_munlock, "munlock" },
[133] = { 1, TM, sys_mlockall, "mlockall" },
[134] = { 0, TM, sys_munlockall, "munlockall" },
[135] = { 2, 0, sys_sched_setparam, "sched_setparam" },
[136] = { 2, 0, sys_sched_getparam, "sched_getparam" },
[137] = { 3, 0, sys_sched_setscheduler, "sched_setscheduler" },
[138] = { 1, 0, sys_sched_getscheduler, "sched_getscheduler" },
[139] = { 0, 0, sys_sched_yield, "sched_yield" },
[140] = { 1, 0, sys_sched_get_priority_max, "sched_get_priority_max"},
[141] = { 1, 0, sys_sched_get_priority_min, "sched_get_priority_min"},
[142] = { 2, 0, sys_sched_rr_get_interval, "sched_rr_get_interval" },
[143] = { 2, 0, sys_nanosleep, "nanosleep" },
[144] = { 3, TD, sys_poll, "poll" },
[145] = { 3, 0, sys_nfsservctl, "nfsservctl" },
[146] = { 3, 0, sys_setresgid, "setresgid" },
[147] = { 3, 0, sys_getresgid, "getresgid" },
[148] = { 5, 0, sys_prctl, "prctl" },
[149] = { 3, TN, sys_socket, "socket" },
[150] = { 3, TN, sys_bind, "bind" },
[151] = { 3, TN, sys_connect, "connect" },
[152] = { 2, TN, sys_listen, "listen" },
[153] = { 3, TN, sys_accept, "accept" },
[154] = { 3, TN, sys_getsockname, "getsockname" },
[155] = { 3, TN, sys_getpeername, "getpeername" },
[156] = { 4, TN, sys_socketpair, "socketpair" },
[157] = { 4, TN, sys_send, "send" },
[158] = { 4, TN, sys_recv, "recv" },
[159] = { 6, TN, sys_sendto, "sendto" },
[160] = { 6, TN, sys_recvfrom, "recvfrom" },
[161] = { 2, TN, sys_shutdown, "shutdown" },
[162] = { 5, TN, sys_setsockopt, "setsockopt" },
[163] = { 5, TN, sys_getsockopt, "getsockopt" },
[164] = { 3, TN, sys_sendmsg, "sendmsg" },
[165] = { 3, TN, sys_recvmsg, "recvmsg" },
[166] = { 3, TF, sys_truncate64, "truncate64" },
[167] = { 3, TD, sys_ftruncate64, "ftruncate64" },
[168] = { 2, TF, sys_stat64, "stat64" },
[169] = { 2, TF, sys_lstat64, "lstat64" },
[170] = { 2, TD, sys_fstat64, "fstat64" },
[171] = { 2, TF, sys_pivotroot, "pivot_root" },
[172] = { 3, TM, sys_mincore, "mincore" },
[173] = { 3, TM, sys_madvise, "madvise" },
[174] = { 3, TD, sys_getdents64, "getdents64" },
[175] = { 3, TD, sys_fcntl, "fcntl64" },
[176] = { 0, 0, sys_gettid, "gettid" },
[177] = { 4, TD, sys_readahead, "readahead" },
[178] = { 5, TF, sys_setxattr, "setxattr" },
[179] = { 5, TF, sys_setxattr, "lsetxattr" },
[180] = { 5, TD, sys_fsetxattr, "fsetxattr" },
[181] = { 4, TF, sys_getxattr, "getxattr" },
[182] = { 4, TF, sys_getxattr, "lgetxattr" },
[183] = { 4, TD, sys_fgetxattr, "fgetxattr" },
[184] = { 3, TF, sys_listxattr, "listxattr" },
[185] = { 3, TF, sys_listxattr, "llistxattr" },
[186] = { 3, TD, sys_flistxattr, "flistxattr" },
[187] = { 2, TF, sys_removexattr, "removexattr" },
[188] = { 2, TF, sys_removexattr, "lremovexattr" },
[189] = { 2, TD, sys_fremovexattr, "fremovexattr" },
[190] = { 2, TS, sys_kill, "tkill" },
[191] = { 4, TD|TN, sys_sendfile64, "sendfile64" },
[192] = { 6, 0, sys_futex, "futex" },
[193] = { 3, 0, sys_sched_setaffinity, "sched_setaffinity" },
[194] = { 3, 0, sys_sched_getaffinity, "sched_getaffinity" },
[195] = { 2, 0, sys_capget, "capget" },
[196] = { 2, 0, sys_capset, "capset" },
[197] = { 2, 0, sys_io_setup, "io_setup" },
[198] = { 1, 0, sys_io_destroy, "io_destroy" },
[199] = { 5, 0, sys_io_getevents, "io_getevents" },
[200] = { 3, 0, sys_io_submit, "io_submit" },
[201] = { 3, 0, sys_io_cancel, "io_cancel" },
[202] = { 5, TD, sys_fadvise64, "fadvise64" },
[203] = { 1, TP|SE, sys_exit, "exit_group" },
[204] = { 4, 0, sys_lookup_dcookie, "lookup_dcookie" },
[205] = { 1, TD, sys_epoll_create, "epoll_create" },
[206] = { 4, TD, sys_epoll_ctl, "epoll_ctl" },
[207] = { 4, TD, sys_epoll_wait, "epoll_wait" },
[208] = { 5, TM|SI, sys_remap_file_pages, "remap_file_pages" },
[209] = { 1, 0, sys_set_tid_address, "set_tid_address" },
[210] = { 3, 0, sys_timer_create, "timer_create" },
[211] = { 4, 0, sys_timer_settime, "timer_settime" },
[212] = { 2, 0, sys_timer_gettime, "timer_gettime" },
[213] = { 1, 0, sys_timer_getoverrun, "timer_getoverrun" },
[214] = { 1, 0, sys_timer_delete, "timer_delete" },
[215] = { 2, 0, sys_clock_settime, "clock_settime" },
[216] = { 2, 0, sys_clock_gettime, "clock_gettime" },
[217] = { 2, 0, sys_clock_getres, "clock_getres" },
[218] = { 4, 0, sys_clock_nanosleep, "clock_nanosleep" },
[219] = { 3, TF, sys_statfs64, "statfs64" },
[220] = { 3, TD, sys_fstatfs64, "fstatfs64" },
[221] = { 3, TS, sys_tgkill, "tgkill" },
[222] = { },
[223] = { 2, TF, sys_utimes, "utimes" },
[224] = { 6, TD, sys_fadvise64_64, "fadvise64_64" },
[225] = { 3, 0, printargs, "cacheflush" },
[226] = { 5, 0, sys_vserver, "vserver" },
[227] = { 4, 0, sys_mq_open, "mq_open" },
[228] = { 1, 0, sys_mq_unlink, "mq_unlink" },
[229] = { 5, 0, sys_mq_timedsend, "mq_timedsend" },
[230] = { 5, 0, sys_mq_timedreceive, "mq_timedreceive" },
[231] = { 2, 0, sys_mq_notify, "mq_notify" },
[232] = { 3, 0, sys_mq_getsetattr, "mq_getsetattr" },
[233] = { 4, 0, sys_kexec_load, "kexec_load" },
[234] = { 5, TP, sys_waitid, "waitid" },
[235] = { 5, 0, sys_add_key, "add_key" },
[236] = { 4, 0, sys_request_key, "request_key" },
[237] = { 5, 0, sys_keyctl, "keyctl" },
[238] = { 3, 0, sys_ioprio_set, "ioprio_set" },
[239] = { 2, 0, sys_ioprio_get, "ioprio_get" },
[240] = { 0, TD, sys_inotify_init, "inotify_init" },
[241] = { 3, TD, sys_inotify_add_watch, "inotify_add_watch" },
[242] = { 2, TD, sys_inotify_rm_watch, "inotify_rm_watch" },
[243] = { 4, TD|TF, sys_openat, "openat" },
[244] = { 3, TD|TF, sys_mkdirat, "mkdirat" },
[245] = { 4, TD|TF, sys_mknodat, "mknodat" },
[246] = { 5, TD|TF, sys_fchownat, "fchownat" },
[247] = { 3, TD|TF, sys_futimesat, "futimesat" },
[248] = { 4, TD|TF, printargs, "fstatat64" },
[249] = { 3, TD|TF, sys_unlinkat, "unlinkat" },
[250] = { 4, TD|TF, sys_renameat, "renameat" },
[251] = { 5, TD|TF, sys_linkat, "linkat" },
[252] = { 3, TD|TF, sys_symlinkat, "symlinkat" },
[253] = { 4, TD|TF, sys_readlinkat, "readlinkat" },
[254] = { 3, TD|TF, sys_fchmodat, "fchmodat" },
[255] = { 3, TD|TF, sys_faccessat, "faccessat" },
[256] = { 6, TD, sys_pselect6, "pselect6" },
[257] = { 5, TD, sys_ppoll, "ppoll" },
[258] = { 1, TP, sys_unshare, "unshare" },
[259] = { 2, 0, sys_set_robust_list, "set_robust_list" },
[260] = { 3, 0, sys_get_robust_list, "get_robust_list" },
[261] = { 6, TD, sys_splice, "splice" },
[262] = { 6, TD, sys_sync_file_range, "sync_file_range" },
[263] = { 4, TD, sys_tee, "tee" },
[264] = { 4, TD, sys_vmsplice, "vmsplice" },
[265] = { 6, TD, sys_epoll_pwait, "epoll_pwait" },
[266] = { 2, TI, sys_msgget, "msgget" },
[267] = { 4, TI, sys_msgsnd, "msgsnd" },
[268] = { 5, TI, sys_msgrcv, "msgrcv" },
[269] = { 3, TI, sys_msgctl, "msgctl" },
[270] = { 3, TI, sys_semget, "semget" },
[271] = { 3, TI, sys_semop, "semop" },
[272] = { 4, TI, sys_semctl, "semctl" },
[273] = { 4, TI, sys_semtimedop, "semtimedop" },
[274] = { 3, TI|TM|SI, sys_shmat, "shmat" },
[275] = { 3, TI, sys_shmget, "shmget" },
[276] = { 1, TI|TM|SI, sys_shmdt, "shmdt" },
[277] = { 3, TI, sys_shmctl, "shmctl" },
[278] = { 4, TD|TF, sys_utimensat, "utimensat" },
[279] = { 3, TD|TS, sys_signalfd, "signalfd" },
[280] = { 2, TD, sys_timerfd, "timerfd" },
[281] = { 1, TD, sys_eventfd, "eventfd" },
[282] = { },
[283] = { 2, TD, sys_setns, "setns" },

30
linux/avr32/userent.h Normal file
View File

@ -0,0 +1,30 @@
{ uoff(regs.sr), "sr" },
{ uoff(regs.pc), "pc" },
{ uoff(regs.lr), "lr" },
{ uoff(regs.sp), "sp" },
{ uoff(regs.r12), "r12" },
{ uoff(regs.r11), "r11" },
{ uoff(regs.r10), "r10" },
{ uoff(regs.r9), "r9" },
{ uoff(regs.r8), "r8" },
{ uoff(regs.r7), "r7" },
{ uoff(regs.r6), "r6" },
{ uoff(regs.r5), "r5" },
{ uoff(regs.r4), "r4" },
{ uoff(regs.r3), "r3" },
{ uoff(regs.r2), "r2" },
{ uoff(regs.r1), "r1" },
{ uoff(regs.r0), "r0" },
{ uoff(regs.r12_orig), "orig_r12" },
/* Other fields in "struct user" */
XLAT_UOFF(u_tsize),
XLAT_UOFF(u_dsize),
XLAT_UOFF(u_ssize),
XLAT_UOFF(start_code),
XLAT_UOFF(start_data),
XLAT_UOFF(start_stack),
XLAT_UOFF(signal),
XLAT_UOFF(u_ar0),
XLAT_UOFF(magic),
XLAT_UOFF(u_comm),
#include "../userent0.h"

Some files were not shown because too many files have changed in this diff Show More