├── .gitignore ├── .mailmap ├── AUTHORS ├── COPYING ├── CREDITS.in ├── ChangeLog-CVS ├── HACKING-scripts ├── INSTALL ├── Makefile.am ├── NEWS ├── README ├── README-hacking ├── README-linux ├── README-linux-ptrace ├── access.c ├── affinity.c ├── aio.c ├── bjm.c ├── block.c ├── bootstrap ├── build_static_example.sh ├── cacheflush.c ├── capability.c ├── chdir.c ├── chmod.c ├── clone.c ├── configure.ac ├── count.c ├── debian ├── changelog ├── compat ├── control ├── copyright ├── rules ├── source │ └── format ├── strace-udeb.install ├── strace.docs ├── strace.examples ├── strace.install ├── strace.manpages ├── strace64.install ├── strace64.manpages └── watch ├── defs.h ├── desc.c ├── dirent.c ├── errnoent.sh ├── execve.c ├── exit.c ├── fadvise.c ├── fallocate.c ├── fanotify.c ├── fchownat.c ├── file.c ├── futex.c ├── generate_xlat_in.sh ├── get_robust_list.c ├── getcpu.c ├── getcwd.c ├── git-set-file-times ├── git-version-gen ├── gitlog-to-changelog ├── hostname.c ├── inotify.c ├── io.c ├── ioctl.c ├── ioctlsort.c ├── ioprio.c ├── ipc.c ├── kexec.c ├── keyctl.c ├── ldt.c ├── link.c ├── linux ├── 32 │ ├── ioctls_inc.h │ └── syscallent.h ├── 64 │ ├── ioctls_inc.h │ └── syscallent.h ├── aarch64 │ ├── errnoent1.h │ ├── ioctls_arch0.h │ ├── ioctls_arch1.h │ ├── ioctls_inc0.h │ ├── ioctls_inc1.h │ ├── signalent1.h │ ├── syscallent.h │ └── syscallent1.h ├── alpha │ ├── errnoent.h │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── signalent.h │ ├── syscallent.h │ └── userent.h ├── arc │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ └── syscallent.h ├── arm │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── syscallent.h │ └── userent.h ├── avr32 │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── syscallent.h │ └── userent.h ├── bfin │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── syscallent.h │ └── userent.h ├── crisv10 │ └── userent.h ├── crisv32 │ └── userent.h ├── dummy.h ├── dummy_check.sh ├── errnoent.h ├── fanotify.h ├── hppa │ ├── errnoent.h │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── signalent.h │ └── syscallent.h ├── i386 │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── syscallent.h │ ├── userent.h │ └── userent0.h ├── ia64 │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── signalent.h │ ├── syscallent.h │ └── userent.h ├── inet_diag.h ├── inotify.h ├── kexec.h ├── keyctl.h ├── m68k │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── syscallent.h │ └── userent.h ├── metag │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ └── syscallent.h ├── microblaze │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── syscallent.h │ └── userent.h ├── mips │ ├── .gitignore │ ├── errnoent.h │ ├── genstub.sh │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── signalent.h │ ├── syscallent-compat.h │ ├── syscallent-n32.h │ ├── syscallent-n64.h │ ├── syscallent-o32.h │ ├── syscallent.h │ └── userent.h ├── mtd-abi.h ├── or1k │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── syscallent.h │ └── userent.h ├── personality.h ├── powerpc │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── syscallent.h │ └── userent.h ├── powerpc64 │ ├── errnoent1.h │ ├── ioctls_arch0.h │ ├── ioctls_arch1.h │ ├── ioctls_inc0.h │ ├── ioctls_inc1.h │ ├── signalent1.h │ ├── syscallent.h │ ├── syscallent1.h │ └── userent.h ├── ptp_clock.h ├── reboot.h ├── s390 │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── syscallent.h │ ├── userent.h │ ├── userent0.h │ └── userent1.h ├── s390x │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── syscallent.h │ └── userent.h ├── sh │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── syscallent.h │ ├── userent.h │ └── userent0.h ├── sh64 │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── syscallent.h │ └── userent.h ├── signalent.h ├── sock_diag.h ├── sparc │ ├── dummy2.h │ ├── errnoent.h │ ├── errnoent1.h │ ├── gen.pl │ ├── ioctlent1.h │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── signalent.h │ ├── signalent1.h │ ├── syscall1.h │ ├── syscallent.h │ ├── syscallent1.h │ └── userent.h ├── sparc64 │ ├── dummy2.h │ ├── errnoent.h │ ├── errnoent1.h │ ├── errnoent2.h │ ├── ioctlent1.h │ ├── ioctls_arch0.h │ ├── ioctls_arch2.h │ ├── ioctls_inc0.h │ ├── ioctls_inc2.h │ ├── signalent.h │ ├── signalent1.h │ ├── signalent2.h │ ├── syscall1.h │ ├── syscallent.h │ ├── syscallent1.h │ ├── syscallent2.h │ └── userent.h ├── subcall.h ├── syscall.h ├── tile │ ├── errnoent1.h │ ├── ioctls_arch0.h │ ├── ioctls_arch1.h │ ├── ioctls_inc0.h │ ├── ioctls_inc1.h │ ├── signalent1.h │ ├── syscallent.h │ ├── syscallent1.h │ └── userent.h ├── ubi-user.h ├── unix_diag.h ├── userent.h ├── userent0.h ├── x32 │ ├── errnoent.h │ ├── errnoent1.h │ ├── ioctls_arch0.h │ ├── ioctls_arch1.h │ ├── ioctls_inc0.h │ ├── ioctls_inc1.h │ ├── signalent.h │ ├── signalent1.h │ ├── syscallent.h │ ├── syscallent1.h │ └── userent.h ├── x86_64 │ ├── errnoent1.h │ ├── errnoent2.h │ ├── gentab.pl │ ├── ioctlent2.h │ ├── ioctls_arch0.h │ ├── ioctls_arch1.h │ ├── ioctls_inc0.h │ ├── ioctls_inc1.h │ ├── signalent1.h │ ├── signalent2.h │ ├── syscallent.h │ ├── syscallent1.h │ ├── syscallent2.h │ └── userent.h └── xtensa │ ├── ioctls_arch0.h │ ├── ioctls_inc0.h │ ├── syscallent.h │ └── userent.h ├── loop.c ├── lseek.c ├── m4 ├── long_long.m4 └── warnings.m4 ├── maint ├── ioctls_gen.sh ├── ioctls_hex.sh ├── ioctls_sym.sh └── print_ioctlent.c ├── make-dist ├── 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 ├── qemu_multiarch_testing ├── .gitignore ├── README ├── hdc.dir │ ├── init │ └── init2 ├── make-hdc-img.sh └── parallel-build-hdc-img.sh ├── quota.c ├── readahead.c ├── readlink.c ├── reboot.c ├── renameat.c ├── resource.c ├── sched.c ├── scsi.c ├── signal.c ├── signalent.sh ├── sock.c ├── socketutils.c ├── sram_alloc.c ├── statfs.c ├── strace-graph ├── strace-log-merge ├── strace.1 ├── strace.c ├── strace.spec ├── stream.c ├── swapon.c ├── sync_file_range.c ├── syscall.c ├── syscallent.sh ├── sysctl.c ├── sysinfo.c ├── syslog.c ├── sysmips.c ├── term.c ├── test ├── .gitignore ├── Makefile ├── README ├── childthread.c ├── clone.c ├── fork.c ├── leaderkill.c ├── mmap_offset_decode.c ├── mtd.c ├── procpollable.c ├── sfd.c ├── sig.c ├── sigkill_rain.c ├── sigreturn.c ├── skodic.c ├── threaded_execve.c ├── ubi.c ├── vfork.c ├── wait_must_be_interruptible.c ├── x32_lseek.c └── x32_mmap.c ├── tests ├── .gitignore ├── Makefile.am ├── caps.awk ├── caps.c ├── caps.test ├── count.test ├── detach-running.test ├── detach-sleeping.test ├── detach-stopped.test ├── dumpio.expected ├── dumpio.test ├── fanotify_mark.c ├── fanotify_mark.test ├── getdents.awk ├── getdents.test ├── inet-accept-connect-send-recv.c ├── init.sh ├── ioctl.c ├── ioctl.test ├── ipc_msg.c ├── ipc_msg.test ├── ipc_sem.c ├── ipc_sem.test ├── ipc_shm.c ├── ipc_shm.test ├── mmsg.c ├── mmsg.expected ├── mmsg.test ├── net-accept-connect.c ├── net-fd.test ├── net-yy-accept.awk ├── net-yy-connect.awk ├── net-yy.test ├── net.test ├── netlink_inet_diag.c ├── netlink_unix_diag.c ├── ptrace_setoptions.test ├── qual_syscall.test ├── run.sh ├── scm_rights-fd.test ├── scm_rights.c ├── select.awk ├── select.c ├── select.test ├── set_ptracer_any.c ├── sigaction.awk ├── sigaction.c ├── sigaction.test ├── stack-fcall-0.c ├── stack-fcall-1.c ├── stack-fcall-2.c ├── stack-fcall-3.c ├── stack-fcall.c ├── stat.c ├── stat.test ├── stat32-v.test ├── stat32.c ├── stat64-v.test ├── statfs.c ├── statfs.test ├── strace-f.test ├── strace-k.test ├── sun_path.test ├── uid.awk ├── uid.c ├── uid.test ├── uid16.c ├── uid16.test ├── uid32.c ├── uid32.test ├── uio.c ├── uio.test ├── unix-pair-send-recv.c ├── unix-yy-accept.awk ├── unix-yy-connect.awk └── unix-yy.test ├── time.c ├── truncate.c ├── uid.c ├── uid16.c ├── umask.c ├── umount.c ├── uname.c ├── unwind.c ├── util.c ├── utime.c ├── utimes.c ├── v4l2.c ├── vsprintf.c ├── wait.c ├── xattr.c ├── xlat ├── access_flags.in ├── aclipc.in ├── addrfams.in ├── adjtimex_modes.in ├── adjtimex_state.in ├── adjtimex_status.in ├── advise.in ├── af_packet_types.in ├── archvals.in ├── at_flags.in ├── atomic_ops.in ├── baud_options.in ├── blkpg_ops.in ├── bootflags1.in ├── bootflags2.in ├── bootflags3.in ├── bt_protocols.in ├── cacheflush_scope.in ├── cap_version.in ├── capabilities.in ├── capabilities1.in ├── clockflags.in ├── clocknames.in ├── clone_flags.in ├── cpuclocknames.in ├── delete_module_flags.in ├── direnttypes.in ├── domains.in ├── epollctls.in ├── epollevents.in ├── epollflags.in ├── evdev_abs.in ├── evdev_ev.in ├── falloc_flags.in ├── fan_classes.in ├── fan_event_flags.in ├── fan_init_flags.in ├── fan_mark_flags.in ├── fcntlcmds.in ├── fdflags.in ├── flockcmds.in ├── fsmagic.in ├── futexops.in ├── futexwakecmps.in ├── futexwakeops.in ├── gen.sh ├── icmpfilterflags.in ├── if_dqblk_valid.in ├── if_dqinfo_valid.in ├── iffflags.in ├── inet_protocols.in ├── inotify_flags.in ├── inotify_init_flags.in ├── ioctl_dirs.in ├── ioprio_class.in ├── ioprio_who.in ├── ipc_msg_flags.in ├── itimer_which.in ├── kexec_arch_values.in ├── kexec_flags.in ├── key_perms.in ├── key_reqkeys.in ├── key_spec.in ├── keyctl_commands.in ├── lockfcmds.in ├── loop_crypt_type_options.in ├── loop_flags_options.in ├── madvise_cmds.in ├── mbindflags.in ├── mctl_sync.in ├── mempolicyflags.in ├── mlockall_flags.in ├── mmap_flags.in ├── mmap_prot.in ├── modem_flags.in ├── modetypes.in ├── modflags.in ├── module_init_flags.in ├── mount_flags.in ├── move_pages_flags.in ├── mremap_flags.in ├── msg_flags.in ├── msgctl_flags.in ├── msgflags.in ├── mtd_flags_options.in ├── mtd_mode_options.in ├── mtd_nandecc_options.in ├── mtd_otp_options.in ├── mtd_type_options.in ├── netlink_protocols.in ├── notifyflags.in ├── nt_descriptor_types.in ├── open_access_modes.in ├── open_mode_flags.in ├── openmodessol.in ├── packet_mreq_type.in ├── perf_event_open_flags.in ├── personality_options.in ├── pmsgflags.in ├── policies.in ├── pollflags.in ├── prctl_options.in ├── priorities.in ├── ptp_flags_options.in ├── ptrace_cmds.in ├── ptrace_setoptions_flags.in ├── qm_which.in ├── quota_formats.in ├── quotacmds.in ├── quotatypes.in ├── rename_flags.in ├── resource_flags.in ├── resources.in ├── schedulers.in ├── scmvals.in ├── semctl_flags.in ├── semop_flags.in ├── sg_io_dxfer_direction.in ├── shm_flags.in ├── shm_resource_flags.in ├── shmctl_flags.in ├── shutdown_modes.in ├── sigact_flags.in ├── sigaltstack_flags.in ├── sigbus_codes.in ├── sigchld_codes.in ├── sigemt_codes.in ├── sigev_value.in ├── sigfpe_codes.in ├── sigill_codes.in ├── siginfo_codes.in ├── sigpoll_codes.in ├── sigprocmaskcmds.in ├── sigprof_codes.in ├── sigsegv_codes.in ├── sigsys_codes.in ├── sigtrap_codes.in ├── sock_type_flags.in ├── socketlayers.in ├── sockipoptions.in ├── sockipv6options.in ├── sockipxoptions.in ├── sockoptions.in ├── sockpacketoptions.in ├── sockrawoptions.in ├── socksctpoptions.in ├── socktcpoptions.in ├── socktypes.in ├── splice_flags.in ├── sram_alloc_flags.in ├── swap_flags.in ├── sync_file_range_flags.in ├── sysctl_kern.in ├── sysctl_net.in ├── sysctl_net_core.in ├── sysctl_net_ipv4.in ├── sysctl_net_ipv4_conf.in ├── sysctl_net_ipv4_route.in ├── sysctl_net_ipv6.in ├── sysctl_net_ipv6_route.in ├── sysctl_net_unix.in ├── sysctl_root.in ├── sysctl_vm.in ├── syslog_action_type.in ├── sysmips_operations.in ├── tcflsh_options.in ├── tcxonc_options.in ├── timerfdflags.in ├── ubi_volume_props.in ├── ubi_volume_types.in ├── umount_flags.in ├── usagewho.in ├── v4l2_buf_flags.in ├── v4l2_buf_types.in ├── v4l2_capture_modes.in ├── v4l2_colorspaces.in ├── v4l2_control_classes.in ├── v4l2_control_flags.in ├── v4l2_control_ids.in ├── v4l2_control_types.in ├── v4l2_device_capabilities_flags.in ├── v4l2_fields.in ├── v4l2_format_description_flags.in ├── v4l2_frameinterval_types.in ├── v4l2_framesize_types.in ├── v4l2_input_types.in ├── v4l2_memories.in ├── v4l2_streaming_capabilities.in ├── wait4_options.in ├── waitid_types.in ├── whence_codes.in ├── xattrflags.in ├── xfs_dqblk_flags.in └── xfs_quota_flags.in └── xlate.el /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.o 3 | .deps 4 | .libs 5 | .version 6 | .*.swp 7 | *.gdb 8 | .gdbinit 9 | .gdb_history 10 | 11 | /ChangeLog 12 | /CREDITS 13 | 14 | Makefile 15 | Makefile.in 16 | 17 | /aclocal.m4 18 | /autom4te.cache 19 | /config.guess 20 | /config.h 21 | /config.h.in 22 | /config.log 23 | /config.status 24 | /config.sub 25 | /configure 26 | /depcomp 27 | /install-sh 28 | /missing 29 | /stamp-h1 30 | 31 | /*.gdb 32 | /strace 33 | /test-driver 34 | 35 | /ioctlent[012].h 36 | /ioctls_all[012].h 37 | /ioctlsort[012] 38 | 39 | /strace-*.tar.xz 40 | 41 | /tests-m32 42 | /tests-mx32 43 | -------------------------------------------------------------------------------- /.mailmap: -------------------------------------------------------------------------------- 1 | # Map git author names and email addresses to canonical/preferred form. 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | See the file CREDITS. Automake likes us to have this file called AUTHORS. 2 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This is strace, a system call tracer for Linux. 2 | 3 | strace is released under a Berkeley-style license at the request 4 | of Paul Kranenburg; see the file COPYING for details. 5 | 6 | See the file CREDITS for a list of authors and other contributors. 7 | 8 | See the file INSTALL for compilation and installation instructions. 9 | 10 | See the file NEWS for information on what has changed in recent 11 | versions. 12 | 13 | You can get the latest version of strace from its homepage at 14 | http://sourceforge.net/projects/strace/ . 15 | 16 | Please send bug reports and enhancements to the strace 17 | mailinglist at strace-devel@lists.sourceforge.net. 18 | -------------------------------------------------------------------------------- /README-hacking: -------------------------------------------------------------------------------- 1 | Requirements 2 | ============ 3 | If you use the GIT version of strace there will be some files missing 4 | that you need to build strace. These files are generated by tools from 5 | the GNU Autoconf and Automake packages. You need recent versions, which 6 | provide the `autoreconf -i' command that will do everything you need. 7 | 8 | 9 | No more ChangeLog file 10 | ====================== 11 | Do not create or modify the ChangeLog files. Starting at 2009-07-09, the 12 | policy changed. Before, we would insert the exact same text (or worse, 13 | sometimes slightly differing) into both the ChangeLog file and the commit 14 | log. Now we put that information only in the commit log, and generate 15 | the top-level ChangeLog file from logs at "make dist" time. As such, 16 | there are strict requirements on the form of the commit log messages. 17 | 18 | 19 | Commit log requirements 20 | ======================= 21 | Each commit log should always start with a one-line summary, the second 22 | line should be blank, and the remaining lines are usually ChangeLog-style 23 | entries for all affected files, except the leading TABs which should 24 | be omitted. 25 | 26 | 27 | Documentation 28 | ============= 29 | All noteworthy changes should be mentioned in NEWS. All changes in strace 30 | command interface should be reflected in the man page. New options should 31 | be documented both in -h output and in the man page. 32 | -------------------------------------------------------------------------------- /README-linux: -------------------------------------------------------------------------------- 1 | 2 | Strace has been ported by Branko Lankester 3 | to run on Linux systems. Since then it has been greatly modified 4 | by various other people. 5 | 6 | If you want to compile strace on a Linux system please make sure that 7 | you use recent kernel headers. Strace needs those to get the proper data 8 | structures and constatns used by the kernel, since these can be 9 | different from the structures that the C library uses. Currently you 10 | will need at least a 2.2.7 or newer kernel. 11 | 12 | To complicate things a bit further strace might not compile if you are 13 | using development kernels. These tend to have headers that conflict with 14 | the headers from libc which makes it impossible to use them. 15 | 16 | There are three ways to compile strace with other kernel headers: 17 | * Specify the location in CFLAGS when running configure 18 | 19 | CFLAGS=-I/usr/src/linux/include ./configure 20 | 21 | * you can tell make where your kernel sources are. For example if you 22 | have your kernelsource in /usr/src/linux, you can invoke make like 23 | this: 24 | 25 | make CFLAGS="\$CFLAGS -I/usr/src/linux/include" 26 | 27 | (the extra \$CFLAGS is there to make sure we don't override any CFLAGS 28 | settings that configure has found). 29 | 30 | * you can link /usr/include/linux and /usr/include/asm to the 31 | corresponding directories in your kernel source-tree. 32 | -------------------------------------------------------------------------------- /access.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | #include 4 | 5 | #include "xlat/access_flags.h" 6 | 7 | static int 8 | decode_access(struct tcb *tcp, int offset) 9 | { 10 | if (entering(tcp)) { 11 | printpath(tcp, tcp->u_arg[offset]); 12 | tprints(", "); 13 | printflags(access_flags, tcp->u_arg[offset + 1], "?_OK"); 14 | } 15 | return 0; 16 | } 17 | 18 | int 19 | sys_access(struct tcb *tcp) 20 | { 21 | return decode_access(tcp, 0); 22 | } 23 | 24 | int 25 | sys_faccessat(struct tcb *tcp) 26 | { 27 | if (entering(tcp)) 28 | print_dirfd(tcp, tcp->u_arg[0]); 29 | return decode_access(tcp, 1); 30 | } 31 | -------------------------------------------------------------------------------- /affinity.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | static void 4 | print_affinitylist(struct tcb *tcp, long list, unsigned int len) 5 | { 6 | int first = 1; 7 | unsigned long w, min_len; 8 | 9 | if (abbrev(tcp) && len / sizeof(w) > max_strlen) 10 | min_len = len - max_strlen * sizeof(w); 11 | else 12 | min_len = 0; 13 | for (; len >= sizeof(w) && len > min_len; 14 | len -= sizeof(w), list += sizeof(w)) { 15 | if (umove(tcp, list, &w) < 0) 16 | break; 17 | if (first) 18 | tprints("{"); 19 | else 20 | tprints(", "); 21 | first = 0; 22 | tprintf("%lx", w); 23 | } 24 | if (len) { 25 | if (first) 26 | tprintf("%#lx", list); 27 | else 28 | tprintf(", %s}", (len >= sizeof(w) && len > min_len ? 29 | "???" : "...")); 30 | } else { 31 | tprints(first ? "{}" : "}"); 32 | } 33 | } 34 | 35 | int 36 | sys_sched_setaffinity(struct tcb *tcp) 37 | { 38 | if (entering(tcp)) { 39 | tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]); 40 | print_affinitylist(tcp, tcp->u_arg[2], tcp->u_arg[1]); 41 | } 42 | return 0; 43 | } 44 | 45 | int 46 | sys_sched_getaffinity(struct tcb *tcp) 47 | { 48 | if (entering(tcp)) { 49 | tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]); 50 | } else { 51 | if (tcp->u_rval == -1) 52 | tprintf("%#lx", tcp->u_arg[2]); 53 | else 54 | print_affinitylist(tcp, tcp->u_arg[2], tcp->u_rval); 55 | } 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /bootstrap: -------------------------------------------------------------------------------- 1 | #!/bin/sh -eu 2 | 3 | for m in -m32 -mx32; do 4 | mkdir tests$m || 5 | continue 6 | sed "s/^AM_CFLAGS[[:space:]]*=.*/& $m/" \ 7 | tests/Makefile.am > tests$m/Makefile.am 8 | for f in tests/*; do 9 | [ "${f##*/}" != Makefile.am ] || 10 | continue 11 | ln -s ../"$f" tests$m/ 12 | done 13 | done 14 | 15 | ./xlat/gen.sh 16 | 17 | exec autoreconf -f -i "$@" 18 | -------------------------------------------------------------------------------- /build_static_example.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | BUILDFLAG="" 4 | 5 | #BUILDFLAG="--build=i686" 6 | #export CC="i686-gcc" 7 | # -mpreferred-stack-boundary=2 can be used to prevent gcc 4.2.x 8 | # from aligning stack to 16 bytes. (Which is gcc's way of supporting SSE). 9 | # For me it saves about 6k of text segment. 10 | # This may be unsafe if your libc expects 16 byte stack alignment 11 | # on function entry. 12 | 13 | export CC="x86_64-gcc" 14 | 15 | export CFLAGS="-Os\ 16 | -fomit-frame-pointer\ 17 | -static\ 18 | -static-libgcc\ 19 | -ffunction-sections -fdata-sections\ 20 | -falign-functions=1 -falign-jumps=1 -falign-labels=1 -falign-loops=1\ 21 | -fno-unwind-tables\ 22 | -fno-asynchronous-unwind-tables\ 23 | -Wl,--gc-sections\ 24 | -Wl,-Map=strace.mapfile\ 25 | " 26 | 27 | ./bootstrap 28 | ./configure $BUILDFLAG #--enable-maintainer-mode 29 | make CC="$CC" CFLAGS="$CFLAGS" 30 | -------------------------------------------------------------------------------- /chdir.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | int 4 | sys_chdir(struct tcb *tcp) 5 | { 6 | if (entering(tcp)) { 7 | printpath(tcp, tcp->u_arg[0]); 8 | } 9 | return 0; 10 | } 11 | -------------------------------------------------------------------------------- /chmod.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | static int 4 | decode_chmod(struct tcb *tcp, int offset) 5 | { 6 | if (entering(tcp)) { 7 | printpath(tcp, tcp->u_arg[offset]); 8 | tprintf(", %#lo", tcp->u_arg[offset + 1]); 9 | } 10 | return 0; 11 | } 12 | 13 | int 14 | sys_chmod(struct tcb *tcp) 15 | { 16 | return decode_chmod(tcp, 0); 17 | } 18 | 19 | int 20 | sys_fchmodat(struct tcb *tcp) 21 | { 22 | if (entering(tcp)) 23 | print_dirfd(tcp, tcp->u_arg[0]); 24 | return decode_chmod(tcp, 1); 25 | } 26 | 27 | int 28 | sys_fchmod(struct tcb *tcp) 29 | { 30 | if (entering(tcp)) { 31 | printfd(tcp, tcp->u_arg[0]); 32 | tprintf(", %#lo", tcp->u_arg[1]); 33 | } 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (quilt) 2 | -------------------------------------------------------------------------------- /debian/strace-udeb.install: -------------------------------------------------------------------------------- 1 | build/strace usr/bin 2 | -------------------------------------------------------------------------------- /debian/strace.docs: -------------------------------------------------------------------------------- 1 | NEWS 2 | -------------------------------------------------------------------------------- /debian/strace.examples: -------------------------------------------------------------------------------- 1 | strace-graph 2 | -------------------------------------------------------------------------------- /debian/strace.install: -------------------------------------------------------------------------------- 1 | build/strace usr/bin 2 | -------------------------------------------------------------------------------- /debian/strace.manpages: -------------------------------------------------------------------------------- 1 | strace.1 2 | -------------------------------------------------------------------------------- /debian/strace64.install: -------------------------------------------------------------------------------- 1 | build64/strace64 usr/bin 2 | -------------------------------------------------------------------------------- /debian/strace64.manpages: -------------------------------------------------------------------------------- 1 | strace64.1 2 | -------------------------------------------------------------------------------- /debian/watch: -------------------------------------------------------------------------------- 1 | version=3 2 | opts="uversionmangle=s/-/./g" http://sf.net/strace/strace-([[:digit:].-]*)\.tar\.xz 3 | -------------------------------------------------------------------------------- /exit.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | int 4 | sys_exit(struct tcb *tcp) 5 | { 6 | if (exiting(tcp)) { 7 | fprintf(stderr, "_exit returned!\n"); 8 | return -1; 9 | } 10 | /* special case: we stop tracing this process, finish line now */ 11 | tprintf("%ld) ", tcp->u_arg[0]); 12 | tabto(); 13 | tprints("= ?\n"); 14 | line_ended(); 15 | return 0; 16 | } 17 | -------------------------------------------------------------------------------- /fadvise.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | #include 4 | 5 | #include "xlat/advise.h" 6 | 7 | int 8 | sys_fadvise64(struct tcb *tcp) 9 | { 10 | if (entering(tcp)) { 11 | int argn; 12 | printfd(tcp, tcp->u_arg[0]); 13 | argn = printllval(tcp, ", %lld", 1); 14 | tprintf(", %ld, ", tcp->u_arg[argn++]); 15 | printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???"); 16 | } 17 | return 0; 18 | } 19 | 20 | int 21 | sys_fadvise64_64(struct tcb *tcp) 22 | { 23 | if (entering(tcp)) { 24 | int argn; 25 | printfd(tcp, tcp->u_arg[0]); 26 | argn = printllval(tcp, ", %lld, ", 1); 27 | argn = printllval(tcp, "%lld, ", argn); 28 | #if defined __ARM_EABI__ || defined AARCH64 || defined POWERPC || defined XTENSA 29 | printxval(advise, tcp->u_arg[1], "POSIX_FADV_???"); 30 | #else 31 | printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???"); 32 | #endif 33 | } 34 | return 0; 35 | } 36 | -------------------------------------------------------------------------------- /fallocate.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | #ifdef HAVE_LINUX_FALLOC_H 4 | # include 5 | #endif 6 | 7 | #include "xlat/falloc_flags.h" 8 | 9 | int 10 | sys_fallocate(struct tcb *tcp) 11 | { 12 | if (entering(tcp)) { 13 | int argn; 14 | 15 | /* fd */ 16 | printfd(tcp, tcp->u_arg[0]); 17 | tprints(", "); 18 | 19 | /* mode */ 20 | printflags(falloc_flags, tcp->u_arg[1], "FALLOC_FL_???"); 21 | tprints(", "); 22 | 23 | /* offset */ 24 | argn = printllval(tcp, "%llu, ", 2); 25 | 26 | /* len */ 27 | printllval(tcp, "%llu", argn); 28 | } 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /fanotify.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | #include 3 | 4 | #include "xlat/fan_classes.h" 5 | #include "xlat/fan_init_flags.h" 6 | 7 | int 8 | sys_fanotify_init(struct tcb *tcp) 9 | { 10 | unsigned flags; 11 | 12 | if (exiting(tcp)) 13 | return 0; 14 | 15 | flags = tcp->u_arg[0]; 16 | printxval(fan_classes, flags & FAN_ALL_CLASS_BITS, "FAN_CLASS_???"); 17 | flags &= ~FAN_ALL_CLASS_BITS; 18 | if (flags) { 19 | tprints("|"); 20 | printflags(fan_init_flags, flags, "FAN_???"); 21 | } 22 | tprints(", "); 23 | tprint_open_modes((unsigned) tcp->u_arg[1]); 24 | 25 | return 0; 26 | } 27 | 28 | #include "xlat/fan_mark_flags.h" 29 | #include "xlat/fan_event_flags.h" 30 | 31 | int 32 | sys_fanotify_mark(struct tcb *tcp) 33 | { 34 | unsigned long long mask = 0; 35 | int argn; 36 | 37 | if (exiting(tcp)) 38 | return 0; 39 | 40 | printfd(tcp, tcp->u_arg[0]); 41 | tprints(", "); 42 | printflags(fan_mark_flags, (unsigned) tcp->u_arg[1], "FAN_MARK_???"); 43 | tprints(", "); 44 | /* 45 | * the mask argument is defined as 64-bit, 46 | * but kernel uses the lower 32 bits only. 47 | */ 48 | argn = getllval(tcp, &mask, 2); 49 | printflags(fan_event_flags, mask, "FAN_???"); 50 | tprints(", "); 51 | if ((int) tcp->u_arg[argn] == FAN_NOFD) 52 | tprints("FAN_NOFD, "); 53 | else 54 | print_dirfd(tcp, tcp->u_arg[argn]); 55 | printpath(tcp, tcp->u_arg[argn + 1]); 56 | 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /fchownat.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | int 4 | sys_fchownat(struct tcb *tcp) 5 | { 6 | if (entering(tcp)) { 7 | print_dirfd(tcp, tcp->u_arg[0]); 8 | printpath(tcp, tcp->u_arg[1]); 9 | printuid(", ", tcp->u_arg[2]); 10 | printuid(", ", tcp->u_arg[3]); 11 | tprints(", "); 12 | printflags(at_flags, tcp->u_arg[4], "AT_???"); 13 | } 14 | return 0; 15 | } 16 | -------------------------------------------------------------------------------- /generate_xlat_in.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | convert() { 4 | sed -n '/^\(static \)\?const struct xlat '"$n"'\[\] = {$/,/^};$/{ 5 | s/^[[:space:]]*XLAT(\([^)]\+\)).*/\1/p 6 | s/^[[:space:]]*{[[:space:]]*(\?\(1<<[^),[:space:]]\+\).*/\1/p 7 | s/.*not NULL-terminated.*/#unterminated/p 8 | s/^\([[:space:]]*{.*\)/\1/p 9 | s/^\t*\( *[/*].*\)/\1/p}' "$f" >> xlat/"$n".in 10 | sed -i '/^\(static \)\?const struct xlat '"$n"'\[\] = {$/,/^};$/c #include "xlat/'"$n"'.h"' "$f" 11 | } 12 | 13 | for f; do 14 | for n in $(sed -n 's/^\(static \)\?const struct xlat \([a-z0-9_]\+\)\[\] = {$/\2/p' "$f"); do 15 | case "$n" in 16 | cacheflush_flags|struct_user_offsets) # skip 17 | ;; 18 | ioprio_class|ioprio_who|mtd_mode_options|personality_options|syslog_action_type|ubi_volume_props|ubi_volume_types) 19 | echo '#unconditional' > xlat/"$n".in 20 | convert 21 | ;; 22 | *) 23 | > xlat/"$n".in 24 | convert 25 | ;; 26 | esac 27 | done 28 | done 29 | -------------------------------------------------------------------------------- /get_robust_list.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | int 4 | sys_get_robust_list(struct tcb *tcp) 5 | { 6 | if (entering(tcp)) { 7 | tprintf("%ld, ", (long) (pid_t) tcp->u_arg[0]); 8 | } else { 9 | void *addr; 10 | size_t len; 11 | 12 | if (syserror(tcp) || 13 | !tcp->u_arg[1] || 14 | umove(tcp, tcp->u_arg[1], &addr) < 0) { 15 | tprintf("%#lx, ", tcp->u_arg[1]); 16 | } else { 17 | tprintf("[%p], ", addr); 18 | } 19 | 20 | if (syserror(tcp) || 21 | !tcp->u_arg[2] || 22 | umove(tcp, tcp->u_arg[2], &len) < 0) { 23 | tprintf("%#lx", tcp->u_arg[2]); 24 | } else { 25 | tprintf("[%lu]", (unsigned long) len); 26 | } 27 | } 28 | return 0; 29 | } 30 | -------------------------------------------------------------------------------- /getcpu.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | int 4 | sys_getcpu(struct tcb *tcp) 5 | { 6 | if (exiting(tcp)) { 7 | unsigned u; 8 | if (tcp->u_arg[0] == 0) 9 | tprints("NULL, "); 10 | else if (umove(tcp, tcp->u_arg[0], &u) < 0) 11 | tprintf("%#lx, ", tcp->u_arg[0]); 12 | else 13 | tprintf("[%u], ", u); 14 | if (tcp->u_arg[1] == 0) 15 | tprints("NULL, "); 16 | else if (umove(tcp, tcp->u_arg[1], &u) < 0) 17 | tprintf("%#lx, ", tcp->u_arg[1]); 18 | else 19 | tprintf("[%u], ", u); 20 | tprintf("%#lx", tcp->u_arg[2]); 21 | } 22 | return 0; 23 | } 24 | -------------------------------------------------------------------------------- /getcwd.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | int 4 | sys_getcwd(struct tcb *tcp) 5 | { 6 | if (exiting(tcp)) { 7 | if (syserror(tcp)) 8 | tprintf("%#lx", tcp->u_arg[0]); 9 | else 10 | printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1); 11 | tprintf(", %lu", tcp->u_arg[1]); 12 | } 13 | return 0; 14 | } 15 | -------------------------------------------------------------------------------- /git-set-file-times: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | use warnings; 4 | 5 | # Sets mtime and atime of files to the latest commit time in git. 6 | # 7 | # This is useful after the first clone of the rsync repository BEFORE you 8 | # do any building. It is also safe if you have done a "make distclean". 9 | 10 | my %ls; 11 | my $commit_time; 12 | my $prefix = @ARGV && $ARGV[0] =~ s/^--prefix=// ? shift : ''; 13 | 14 | $/ = "\0"; 15 | open FH, 'git ls-files -z|' or die $!; 16 | while () { 17 | chomp; 18 | $ls{$_} = $_; 19 | } 20 | close FH; 21 | 22 | $/ = "\n"; 23 | open FH, "git log -r --name-only --no-color --pretty=raw -z @ARGV |" or die $!; 24 | while () { 25 | chomp; 26 | if (/^committer .*? (\d+) (?:[\-\+]\d+)$/) { 27 | $commit_time = $1; 28 | } elsif (s/\0\0commit [a-f0-9]{40}$// or s/\0$//) { 29 | my @files = delete @ls{split(/\0/, $_)}; 30 | @files = grep { defined $_ } @files; 31 | next unless @files; 32 | map { s/^/$prefix/ } @files; 33 | utime $commit_time, $commit_time, @files; 34 | } 35 | last unless %ls; 36 | } 37 | close FH; 38 | -------------------------------------------------------------------------------- /hostname.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | int 4 | sys_sethostname(struct tcb *tcp) 5 | { 6 | if (entering(tcp)) { 7 | printstr(tcp, tcp->u_arg[0], tcp->u_arg[1]); 8 | tprintf(", %lu", tcp->u_arg[1]); 9 | } 10 | return 0; 11 | } 12 | 13 | #if defined(ALPHA) 14 | int 15 | sys_gethostname(struct tcb *tcp) 16 | { 17 | if (exiting(tcp)) { 18 | if (syserror(tcp)) 19 | tprintf("%#lx", tcp->u_arg[0]); 20 | else 21 | printstr(tcp, tcp->u_arg[0], -1); 22 | tprintf(", %lu", tcp->u_arg[1]); 23 | } 24 | return 0; 25 | } 26 | #endif /* ALPHA */ 27 | -------------------------------------------------------------------------------- /inotify.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | #include 3 | #include 4 | 5 | #include "xlat/inotify_flags.h" 6 | #include "xlat/inotify_init_flags.h" 7 | 8 | int 9 | sys_inotify_add_watch(struct tcb *tcp) 10 | { 11 | if (entering(tcp)) { 12 | /* file descriptor */ 13 | printfd(tcp, tcp->u_arg[0]); 14 | tprints(", "); 15 | /* pathname */ 16 | printpath(tcp, tcp->u_arg[1]); 17 | tprints(", "); 18 | /* mask */ 19 | printflags(inotify_flags, tcp->u_arg[2], "IN_???"); 20 | } 21 | return 0; 22 | } 23 | 24 | int 25 | sys_inotify_rm_watch(struct tcb *tcp) 26 | { 27 | if (entering(tcp)) { 28 | /* file descriptor */ 29 | printfd(tcp, tcp->u_arg[0]); 30 | /* watch descriptor */ 31 | tprintf(", %d", (int) tcp->u_arg[1]); 32 | } 33 | return 0; 34 | } 35 | 36 | int 37 | sys_inotify_init1(struct tcb *tcp) 38 | { 39 | if (entering(tcp)) 40 | printflags(inotify_init_flags, tcp->u_arg[0], "IN_???"); 41 | return 0; 42 | } 43 | -------------------------------------------------------------------------------- /linux/aarch64/errnoent1.h: -------------------------------------------------------------------------------- 1 | /* Native AArch64 */ 2 | #include "../errnoent.h" 3 | -------------------------------------------------------------------------------- /linux/aarch64/ioctls_arch0.h: -------------------------------------------------------------------------------- 1 | /* Generated by ioctls_gen.sh from definitions found in $linux/arch/arm64/include/ tree. */ 2 | -------------------------------------------------------------------------------- /linux/aarch64/ioctls_arch1.h: -------------------------------------------------------------------------------- 1 | #include "arm/ioctls_arch0.h" 2 | -------------------------------------------------------------------------------- /linux/aarch64/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "64/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/aarch64/ioctls_inc1.h: -------------------------------------------------------------------------------- 1 | #include "arm/ioctls_inc0.h" 2 | -------------------------------------------------------------------------------- /linux/aarch64/signalent1.h: -------------------------------------------------------------------------------- 1 | #include "../signalent.h" 2 | -------------------------------------------------------------------------------- /linux/aarch64/syscallent.h: -------------------------------------------------------------------------------- 1 | #include "../arm/syscallent.h" 2 | -------------------------------------------------------------------------------- /linux/alpha/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "64/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/alpha/signalent.h: -------------------------------------------------------------------------------- 1 | "SIG_0", /* 0 */ 2 | "SIGHUP", /* 1 */ 3 | "SIGINT", /* 2 */ 4 | "SIGQUIT", /* 3 */ 5 | "SIGILL", /* 4 */ 6 | "SIGTRAP", /* 5 */ 7 | "SIGABRT", /* 6 */ 8 | "SIGEMT", /* 7 */ 9 | "SIGFPE", /* 8 */ 10 | "SIGKILL", /* 9 */ 11 | "SIGBUS", /* 10 */ 12 | "SIGSEGV", /* 11 */ 13 | "SIGSYS", /* 12 */ 14 | "SIGPIPE", /* 13 */ 15 | "SIGALRM", /* 14 */ 16 | "SIGTERM", /* 15 */ 17 | "SIGURG", /* 16 */ 18 | "SIGSTOP", /* 17 */ 19 | "SIGTSTP", /* 18 */ 20 | "SIGCONT", /* 19 */ 21 | "SIGCHLD", /* 20 */ 22 | "SIGTTIN", /* 21 */ 23 | "SIGTTOU", /* 22 */ 24 | "SIGIO", /* 23 */ 25 | "SIGXCPU", /* 24 */ 26 | "SIGXFSZ", /* 25 */ 27 | "SIGVTALRM", /* 26 */ 28 | "SIGPROF", /* 27 */ 29 | "SIGWINCH", /* 28 */ 30 | "SIGINFO", /* 29 */ 31 | "SIGUSR1", /* 30 */ 32 | "SIGUSR2", /* 31 */ 33 | -------------------------------------------------------------------------------- /linux/arc/ioctls_arch0.h: -------------------------------------------------------------------------------- 1 | /* Generated by ioctls_gen.sh from definitions found in $linux/arch/arc/include/ tree. */ 2 | -------------------------------------------------------------------------------- /linux/arc/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "32/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/arc/syscallent.h: -------------------------------------------------------------------------------- 1 | #define ARCH_sys_mmap sys_mmap_pgoff 2 | #include "32/syscallent.h" 3 | [244] = { 3, 0, printargs, "arc_cacheflush"}, 4 | [245] = { 1, 0, printargs, "arc_settls" }, 5 | [246] = { 0, 0, printargs, "arc_gettls" }, 6 | [247 ... 259] = { }, 7 | -------------------------------------------------------------------------------- /linux/arm/ioctls_arch0.h: -------------------------------------------------------------------------------- 1 | /* Generated by ioctls_gen.sh from definitions found in $linux/arch/arm/include/ tree. */ 2 | { "asm/ioctls.h", "FIOQSIZE", 0, 0x545E, 0 }, 3 | -------------------------------------------------------------------------------- /linux/arm/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "32/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/arm/userent.h: -------------------------------------------------------------------------------- 1 | { uoff(regs.ARM_r0), "r0" }, 2 | { uoff(regs.ARM_r1), "r1" }, 3 | { uoff(regs.ARM_r2), "r2" }, 4 | { uoff(regs.ARM_r3), "r3" }, 5 | { uoff(regs.ARM_r4), "r4" }, 6 | { uoff(regs.ARM_r5), "r5" }, 7 | { uoff(regs.ARM_r6), "r6" }, 8 | { uoff(regs.ARM_r7), "r7" }, 9 | { uoff(regs.ARM_r8), "r8" }, 10 | { uoff(regs.ARM_r9), "r9" }, 11 | { uoff(regs.ARM_r10), "r10" }, 12 | { uoff(regs.ARM_fp), "fp" }, 13 | { uoff(regs.ARM_ip), "ip" }, 14 | { uoff(regs.ARM_sp), "sp" }, 15 | { uoff(regs.ARM_lr), "lr" }, 16 | { uoff(regs.ARM_pc), "pc" }, 17 | { uoff(regs.ARM_cpsr), "cpsr" }, 18 | /* Other fields in "struct user" */ 19 | XLAT_UOFF(u_fpvalid), 20 | XLAT_UOFF(u_tsize), 21 | XLAT_UOFF(u_dsize), 22 | XLAT_UOFF(u_ssize), 23 | XLAT_UOFF(start_code), 24 | XLAT_UOFF(start_stack), 25 | XLAT_UOFF(signal), 26 | XLAT_UOFF(reserved), 27 | XLAT_UOFF(u_ar0), 28 | XLAT_UOFF(magic), 29 | XLAT_UOFF(u_comm), 30 | #include "../userent0.h" 31 | -------------------------------------------------------------------------------- /linux/avr32/ioctls_arch0.h: -------------------------------------------------------------------------------- 1 | /* Generated by ioctls_gen.sh from definitions found in $linux/arch/avr32/include/ tree. */ 2 | { "asm/sockios.h", "FIOGETOWN", 0, 0x8903, 0 }, 3 | { "asm/sockios.h", "FIOSETOWN", 0, 0x8901, 0 }, 4 | { "asm/sockios.h", "SIOCATMARK", 0, 0x8905, 0 }, 5 | { "asm/sockios.h", "SIOCGPGRP", 0, 0x8904, 0 }, 6 | { "asm/sockios.h", "SIOCGSTAMP", 0, 0x8906, 0 }, 7 | { "asm/sockios.h", "SIOCGSTAMPNS", 0, 0x8907, 0 }, 8 | { "asm/sockios.h", "SIOCSPGRP", 0, 0x8902, 0 }, 9 | -------------------------------------------------------------------------------- /linux/avr32/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "32/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/avr32/userent.h: -------------------------------------------------------------------------------- 1 | { uoff(regs.sr), "sr" }, 2 | { uoff(regs.pc), "pc" }, 3 | { uoff(regs.lr), "lr" }, 4 | { uoff(regs.sp), "sp" }, 5 | { uoff(regs.r12), "r12" }, 6 | { uoff(regs.r11), "r11" }, 7 | { uoff(regs.r10), "r10" }, 8 | { uoff(regs.r9), "r9" }, 9 | { uoff(regs.r8), "r8" }, 10 | { uoff(regs.r7), "r7" }, 11 | { uoff(regs.r6), "r6" }, 12 | { uoff(regs.r5), "r5" }, 13 | { uoff(regs.r4), "r4" }, 14 | { uoff(regs.r3), "r3" }, 15 | { uoff(regs.r2), "r2" }, 16 | { uoff(regs.r1), "r1" }, 17 | { uoff(regs.r0), "r0" }, 18 | { uoff(regs.r12_orig), "orig_r12" }, 19 | /* Other fields in "struct user" */ 20 | XLAT_UOFF(u_tsize), 21 | XLAT_UOFF(u_dsize), 22 | XLAT_UOFF(u_ssize), 23 | XLAT_UOFF(start_code), 24 | XLAT_UOFF(start_data), 25 | XLAT_UOFF(start_stack), 26 | XLAT_UOFF(signal), 27 | XLAT_UOFF(u_ar0), 28 | XLAT_UOFF(magic), 29 | XLAT_UOFF(u_comm), 30 | #include "../userent0.h" 31 | -------------------------------------------------------------------------------- /linux/bfin/ioctls_arch0.h: -------------------------------------------------------------------------------- 1 | /* Generated by ioctls_gen.sh from definitions found in $linux/arch/blackfin/include/ tree. */ 2 | { "asm/bfin_simple_timer.h", "BFIN_SIMPLE_TIMER_READ", _IOC_NONE, 0x740a, 0x00 }, 3 | { "asm/bfin_simple_timer.h", "BFIN_SIMPLE_TIMER_READ_COUNTER", _IOC_NONE, 0x740b, 0x00 }, 4 | { "asm/bfin_simple_timer.h", "BFIN_SIMPLE_TIMER_SET_MODE", _IOC_NONE, 0x7404, 0x00 }, 5 | { "asm/bfin_simple_timer.h", "BFIN_SIMPLE_TIMER_SET_PERIOD", _IOC_NONE, 0x7402, 0x00 }, 6 | { "asm/bfin_simple_timer.h", "BFIN_SIMPLE_TIMER_SET_WIDTH", _IOC_NONE, 0x7403, 0x00 }, 7 | { "asm/bfin_simple_timer.h", "BFIN_SIMPLE_TIMER_START", _IOC_NONE, 0x7406, 0x00 }, 8 | { "asm/bfin_simple_timer.h", "BFIN_SIMPLE_TIMER_STOP", _IOC_NONE, 0x7408, 0x00 }, 9 | { "asm/bfin_sport.h", "SPORT_IOC_CONFIG", _IOC_READ|_IOC_WRITE, 0x5001, 0x24 }, 10 | { "asm/bfin_sport.h", "SPORT_IOC_GET_SYSTEMCLOCK", _IOC_READ, 0x5002, 0x04 }, 11 | { "asm/bfin_sport.h", "SPORT_IOC_SET_BAUDRATE", _IOC_WRITE, 0x5003, 0x04 }, 12 | { "asm/ioctls.h", "FIOQSIZE", 0, 0x545E, 0 }, 13 | -------------------------------------------------------------------------------- /linux/bfin/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "32/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/bfin/userent.h: -------------------------------------------------------------------------------- 1 | XLAT_UOFF(u_tsize), 2 | XLAT_UOFF(u_dsize), 3 | XLAT_UOFF(u_ssize), 4 | XLAT_UOFF(start_code), 5 | XLAT_UOFF(signal), 6 | XLAT_UOFF(u_ar0), 7 | XLAT_UOFF(magic), 8 | XLAT_UOFF(u_comm), 9 | #include "../userent0.h" 10 | -------------------------------------------------------------------------------- /linux/crisv10/userent.h: -------------------------------------------------------------------------------- 1 | XLAT(4*PT_FRAMETYPE), 2 | XLAT(4*PT_ORIG_R10), 3 | XLAT(4*PT_R13), 4 | XLAT(4*PT_R12), 5 | XLAT(4*PT_R11), 6 | XLAT(4*PT_R10), 7 | XLAT(4*PT_R9), 8 | XLAT(4*PT_R8), 9 | XLAT(4*PT_R7), 10 | XLAT(4*PT_R6), 11 | XLAT(4*PT_R5), 12 | XLAT(4*PT_R4), 13 | XLAT(4*PT_R3), 14 | XLAT(4*PT_R2), 15 | XLAT(4*PT_R1), 16 | XLAT(4*PT_R0), 17 | XLAT(4*PT_MOF), 18 | XLAT(4*PT_DCCR), 19 | XLAT(4*PT_SRP), 20 | XLAT(4*PT_IRP), 21 | XLAT(4*PT_CSRINSTR), 22 | XLAT(4*PT_CSRADDR), 23 | XLAT(4*PT_CSRDATA), 24 | XLAT(4*PT_USP), 25 | /* Other fields in "struct user" */ 26 | #include "../userent0.h" 27 | -------------------------------------------------------------------------------- /linux/crisv32/userent.h: -------------------------------------------------------------------------------- 1 | XLAT(4*PT_ORIG_R10), 2 | XLAT(4*PT_R0), 3 | XLAT(4*PT_R1), 4 | XLAT(4*PT_R2), 5 | XLAT(4*PT_R3), 6 | XLAT(4*PT_R4), 7 | XLAT(4*PT_R5), 8 | XLAT(4*PT_R6), 9 | XLAT(4*PT_R7), 10 | XLAT(4*PT_R8), 11 | XLAT(4*PT_R9), 12 | XLAT(4*PT_R10), 13 | XLAT(4*PT_R11), 14 | XLAT(4*PT_R12), 15 | XLAT(4*PT_R13), 16 | XLAT(4*PT_ACR), 17 | XLAT(4*PT_SRS), 18 | XLAT(4*PT_MOF), 19 | XLAT(4*PT_SPC), 20 | XLAT(4*PT_CCS), 21 | XLAT(4*PT_SRP), 22 | XLAT(4*PT_ERP), 23 | XLAT(4*PT_EXS), 24 | XLAT(4*PT_EDA), 25 | XLAT(4*PT_USP), 26 | XLAT(4*PT_PPC), 27 | XLAT(4*PT_BP_CTRL), 28 | XLAT(4*PT_BP+4), 29 | XLAT(4*PT_BP+8), 30 | XLAT(4*PT_BP+12), 31 | XLAT(4*PT_BP+16), 32 | XLAT(4*PT_BP+20), 33 | XLAT(4*PT_BP+24), 34 | XLAT(4*PT_BP+28), 35 | XLAT(4*PT_BP+32), 36 | XLAT(4*PT_BP+36), 37 | XLAT(4*PT_BP+40), 38 | XLAT(4*PT_BP+44), 39 | XLAT(4*PT_BP+48), 40 | XLAT(4*PT_BP+52), 41 | XLAT(4*PT_BP+56), 42 | /* Other fields in "struct user" */ 43 | #include "../userent0.h" 44 | -------------------------------------------------------------------------------- /linux/dummy_check.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | grep '^#define' dummy.h | cut -f2 | \ 4 | while read func; do 5 | grep -q -F -- "${func}(" syscall.h && echo "Defined as macro and as func: $func" 6 | done 7 | -------------------------------------------------------------------------------- /linux/hppa/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "32/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/hppa/signalent.h: -------------------------------------------------------------------------------- 1 | "SIG_0", /* 0 */ 2 | "SIGHUP", /* 1 */ 3 | "SIGINT", /* 2 */ 4 | "SIGQUIT", /* 3 */ 5 | "SIGILL", /* 4 */ 6 | "SIGTRAP", /* 5 */ 7 | "SIGABRT", /* 6 */ 8 | "SIGSTKFLT", /* 7 */ 9 | "SIGFPE", /* 8 */ 10 | "SIGKILL", /* 9 */ 11 | "SIGBUS", /* 10 */ 12 | "SIGSEGV", /* 11 */ 13 | "SIGXCPU", /* 12 */ 14 | "SIGPIPE", /* 13 */ 15 | "SIGALRM", /* 14 */ 16 | "SIGTERM", /* 15 */ 17 | "SIGUSR1", /* 16 */ 18 | "SIGUSR2", /* 17 */ 19 | "SIGCHLD", /* 18 */ 20 | "SIGPWR", /* 19 */ 21 | "SIGVTALRM", /* 20 */ 22 | "SIGPROF", /* 21 */ 23 | "SIGIO", /* 22 */ 24 | "SIGWINCH", /* 23 */ 25 | "SIGSTOP", /* 24 */ 26 | "SIGTSTP", /* 25 */ 27 | "SIGCONT", /* 26 */ 28 | "SIGTTIN", /* 27 */ 29 | "SIGTTOU", /* 28 */ 30 | "SIGURG", /* 29 */ 31 | "SIGXFSZ", /* 30 */ 32 | "SIGUNUSED", /* 31 */ 33 | "SIGRTMIN", /* 32 */ 34 | -------------------------------------------------------------------------------- /linux/i386/ioctls_arch0.h: -------------------------------------------------------------------------------- 1 | /* Generated by ioctls_gen.sh from definitions found in $linux/arch/x86/include/ tree. */ 2 | { "asm/mce.h", "MCE_GETCLEAR_FLAGS", _IOC_READ, 0x4d03, 0x04 }, 3 | { "asm/mce.h", "MCE_GET_LOG_LEN", _IOC_READ, 0x4d02, 0x04 }, 4 | { "asm/mce.h", "MCE_GET_RECORD_LEN", _IOC_READ, 0x4d01, 0x04 }, 5 | { "asm/msr.h", "X86_IOC_RDMSR_REGS", _IOC_READ|_IOC_WRITE, 0x63a0, 0x20 }, 6 | { "asm/msr.h", "X86_IOC_WRMSR_REGS", _IOC_READ|_IOC_WRITE, 0x63a1, 0x20 }, 7 | { "asm/mtrr.h", "MTRRIOC_ADD_ENTRY", _IOC_WRITE, 0x4d00, 0x0c }, 8 | { "asm/mtrr.h", "MTRRIOC_ADD_PAGE_ENTRY", _IOC_WRITE, 0x4d05, 0x0c }, 9 | { "asm/mtrr.h", "MTRRIOC_DEL_ENTRY", _IOC_WRITE, 0x4d02, 0x0c }, 10 | { "asm/mtrr.h", "MTRRIOC_DEL_PAGE_ENTRY", _IOC_WRITE, 0x4d07, 0x0c }, 11 | { "asm/mtrr.h", "MTRRIOC_GET_ENTRY", _IOC_READ|_IOC_WRITE, 0x4d03, 0x10 }, 12 | { "asm/mtrr.h", "MTRRIOC_GET_PAGE_ENTRY", _IOC_READ|_IOC_WRITE, 0x4d08, 0x10 }, 13 | { "asm/mtrr.h", "MTRRIOC_KILL_ENTRY", _IOC_WRITE, 0x4d04, 0x0c }, 14 | { "asm/mtrr.h", "MTRRIOC_KILL_PAGE_ENTRY", _IOC_WRITE, 0x4d09, 0x0c }, 15 | { "asm/mtrr.h", "MTRRIOC_SET_ENTRY", _IOC_WRITE, 0x4d01, 0x0c }, 16 | { "asm/mtrr.h", "MTRRIOC_SET_PAGE_ENTRY", _IOC_WRITE, 0x4d06, 0x0c }, 17 | -------------------------------------------------------------------------------- /linux/i386/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "32/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/i386/userent.h: -------------------------------------------------------------------------------- 1 | XLAT(4*EBX), 2 | XLAT(4*ECX), 3 | XLAT(4*EDX), 4 | XLAT(4*ESI), 5 | XLAT(4*EDI), 6 | XLAT(4*EBP), 7 | XLAT(4*EAX), 8 | XLAT(4*DS), 9 | XLAT(4*ES), 10 | XLAT(4*FS), 11 | XLAT(4*GS), 12 | XLAT(4*ORIG_EAX), 13 | XLAT(4*EIP), 14 | XLAT(4*CS), 15 | XLAT(4*EFL), 16 | XLAT(4*UESP), 17 | XLAT(4*SS), 18 | /* Other fields in "struct user" */ 19 | #include "userent0.h" 20 | -------------------------------------------------------------------------------- /linux/i386/userent0.h: -------------------------------------------------------------------------------- 1 | XLAT_UOFF(u_fpvalid), 2 | XLAT_UOFF(i387), 3 | XLAT_UOFF(u_tsize), 4 | XLAT_UOFF(u_dsize), 5 | XLAT_UOFF(u_ssize), 6 | XLAT_UOFF(start_code), 7 | XLAT_UOFF(start_stack), 8 | XLAT_UOFF(signal), 9 | XLAT_UOFF(reserved), 10 | XLAT_UOFF(u_ar0), 11 | XLAT_UOFF(u_fpstate), 12 | XLAT_UOFF(magic), 13 | XLAT_UOFF(u_comm), 14 | XLAT_UOFF(u_debugreg), 15 | #include "../userent0.h" 16 | -------------------------------------------------------------------------------- /linux/ia64/ioctls_arch0.h: -------------------------------------------------------------------------------- 1 | /* Generated by ioctls_gen.sh from definitions found in $linux/arch/ia64/include/ tree. */ 2 | { "asm/sockios.h", "FIOGETOWN", 0, 0x8903, 0 }, 3 | { "asm/sockios.h", "FIOSETOWN", 0, 0x8901, 0 }, 4 | { "asm/sockios.h", "SIOCATMARK", 0, 0x8905, 0 }, 5 | { "asm/sockios.h", "SIOCGPGRP", 0, 0x8904, 0 }, 6 | { "asm/sockios.h", "SIOCGSTAMP", 0, 0x8906, 0 }, 7 | { "asm/sockios.h", "SIOCGSTAMPNS", 0, 0x8907, 0 }, 8 | { "asm/sockios.h", "SIOCSPGRP", 0, 0x8902, 0 }, 9 | -------------------------------------------------------------------------------- /linux/ia64/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "64/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/inet_diag.h: -------------------------------------------------------------------------------- 1 | #define TCPDIAG_GETSOCK 18 2 | #define DCCPDIAG_GETSOCK 19 3 | 4 | /* Socket identity */ 5 | struct inet_diag_sockid { 6 | uint16_t idiag_sport; 7 | uint16_t idiag_dport; 8 | uint32_t idiag_src[4]; 9 | uint32_t idiag_dst[4]; 10 | uint32_t idiag_if; 11 | uint32_t idiag_cookie[2]; 12 | }; 13 | 14 | /* Request structure */ 15 | struct inet_diag_req_v2 { 16 | uint8_t sdiag_family; 17 | uint8_t sdiag_protocol; 18 | uint8_t idiag_ext; 19 | uint8_t pad; 20 | uint32_t idiag_states; 21 | struct inet_diag_sockid id; 22 | }; 23 | 24 | /* Info structure */ 25 | struct inet_diag_msg { 26 | uint8_t idiag_family; 27 | uint8_t idiag_state; 28 | uint8_t idiag_timer; 29 | uint8_t idiag_retrans; 30 | 31 | struct inet_diag_sockid id; 32 | 33 | uint32_t idiag_expires; 34 | uint32_t idiag_rqueue; 35 | uint32_t idiag_wqueue; 36 | uint32_t idiag_uid; 37 | uint32_t idiag_inode; 38 | }; 39 | -------------------------------------------------------------------------------- /linux/m68k/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "32/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/m68k/userent.h: -------------------------------------------------------------------------------- 1 | XLAT(4*PT_D1), 2 | XLAT(4*PT_D2), 3 | XLAT(4*PT_D3), 4 | XLAT(4*PT_D4), 5 | XLAT(4*PT_D5), 6 | XLAT(4*PT_D6), 7 | XLAT(4*PT_D7), 8 | XLAT(4*PT_A0), 9 | XLAT(4*PT_A1), 10 | XLAT(4*PT_A2), 11 | XLAT(4*PT_A3), 12 | XLAT(4*PT_A4), 13 | XLAT(4*PT_A5), 14 | XLAT(4*PT_A6), 15 | XLAT(4*PT_D0), 16 | XLAT(4*PT_USP), 17 | XLAT(4*PT_ORIG_D0), 18 | XLAT(4*PT_SR), 19 | XLAT(4*PT_PC), 20 | /* Other fields in "struct user" */ 21 | XLAT_UOFF(u_fpvalid), 22 | XLAT_UOFF(m68kfp), 23 | XLAT_UOFF(u_tsize), 24 | XLAT_UOFF(u_dsize), 25 | XLAT_UOFF(u_ssize), 26 | XLAT_UOFF(start_code), 27 | XLAT_UOFF(start_stack), 28 | XLAT_UOFF(signal), 29 | XLAT_UOFF(reserved), 30 | XLAT_UOFF(u_ar0), 31 | XLAT_UOFF(u_fpstate), 32 | XLAT_UOFF(magic), 33 | XLAT_UOFF(u_comm), 34 | #include "../userent0.h" 35 | -------------------------------------------------------------------------------- /linux/metag/ioctls_arch0.h: -------------------------------------------------------------------------------- 1 | /* Generated by ioctls_gen.sh from definitions found in $linux/arch/metag/include/ tree. */ 2 | -------------------------------------------------------------------------------- /linux/metag/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "32/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/metag/syscallent.h: -------------------------------------------------------------------------------- 1 | #include "32/syscallent.h" 2 | [244] = { }, 3 | [245] = { 2, 0, printargs, "metag_setglobalbit" }, 4 | [246] = { 1, 0, printargs, "metag_set_fpu_flags" }, 5 | [247] = { 1, 0, printargs, "metag_set_tls" }, 6 | [248] = { 0, NF, printargs, "metag_get_tls" }, 7 | [249 ... 259] = { }, 8 | -------------------------------------------------------------------------------- /linux/microblaze/ioctls_arch0.h: -------------------------------------------------------------------------------- 1 | /* Generated by ioctls_gen.sh from definitions found in $linux/arch/microblaze/include/ tree. */ 2 | -------------------------------------------------------------------------------- /linux/microblaze/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "32/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/microblaze/userent.h: -------------------------------------------------------------------------------- 1 | { PT_GPR(0), "r0" }, 2 | { PT_GPR(1), "r1" }, 3 | { PT_GPR(2), "r2" }, 4 | { PT_GPR(3), "r3" }, 5 | { PT_GPR(4), "r4" }, 6 | { PT_GPR(5), "r5" }, 7 | { PT_GPR(6), "r6" }, 8 | { PT_GPR(7), "r7" }, 9 | { PT_GPR(8), "r8" }, 10 | { PT_GPR(9), "r9" }, 11 | { PT_GPR(10), "r10" }, 12 | { PT_GPR(11), "r11" }, 13 | { PT_GPR(12), "r12" }, 14 | { PT_GPR(13), "r13" }, 15 | { PT_GPR(14), "r14" }, 16 | { PT_GPR(15), "r15" }, 17 | { PT_GPR(16), "r16" }, 18 | { PT_GPR(17), "r17" }, 19 | { PT_GPR(18), "r18" }, 20 | { PT_GPR(19), "r19" }, 21 | { PT_GPR(20), "r20" }, 22 | { PT_GPR(21), "r21" }, 23 | { PT_GPR(22), "r22" }, 24 | { PT_GPR(23), "r23" }, 25 | { PT_GPR(24), "r24" }, 26 | { PT_GPR(25), "r25" }, 27 | { PT_GPR(26), "r26" }, 28 | { PT_GPR(27), "r27" }, 29 | { PT_GPR(28), "r28" }, 30 | { PT_GPR(29), "r29" }, 31 | { PT_GPR(30), "r30" }, 32 | { PT_GPR(31), "r31" }, 33 | { PT_PC, "rpc", }, 34 | { PT_MSR, "rmsr", }, 35 | { PT_EAR, "rear", }, 36 | { PT_ESR, "resr", }, 37 | { PT_FSR, "rfsr", }, 38 | { PT_KERNEL_MODE, "kernel_mode", }, 39 | /* Other fields in "struct user" */ 40 | #include "../userent0.h" 41 | -------------------------------------------------------------------------------- /linux/mips/.gitignore: -------------------------------------------------------------------------------- 1 | syscallent-n32-stub.h 2 | syscallent-n64-stub.h 3 | syscallent-o32-stub.h 4 | -------------------------------------------------------------------------------- /linux/mips/genstub.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | srcdir="${0%/*}" 4 | dstdir="$1"; shift 5 | 6 | for n in n32 n64 o32; do 7 | in="$srcdir/syscallent-$n.h" 8 | out="$dstdir/syscallent-$n-stub.h" 9 | sed -n '/^#if/,/^#else/ {s/^\([^{]*{[^,]*,[^,]*,[[:space:]]*\)[^,[:space:]]\+,[[:space:]]*"\([^"]\+".*\)/\1printargs, "'$n'_\2/; s/^\[.*/&/p}' < "$in" > "$out" 10 | done 11 | -------------------------------------------------------------------------------- /linux/mips/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #ifdef LINUX_MIPSN64 2 | # include "64/ioctls_inc.h" 3 | #else 4 | # include "32/ioctls_inc.h" 5 | #endif 6 | -------------------------------------------------------------------------------- /linux/mips/signalent.h: -------------------------------------------------------------------------------- 1 | "SIG_0", /* 0 */ 2 | "SIGHUP", /* 1 */ 3 | "SIGINT", /* 2 */ 4 | "SIGQUIT", /* 3 */ 5 | "SIGILL", /* 4 */ 6 | "SIGTRAP", /* 5 */ 7 | "SIGIOT", /* 6 */ 8 | "SIGEMT", /* 7 */ 9 | "SIGFPE", /* 8 */ 10 | "SIGKILL", /* 9 */ 11 | "SIGBUS", /* 10 */ 12 | "SIGSEGV", /* 11 */ 13 | "SIGSYS", /* 12 */ 14 | "SIGPIPE", /* 13 */ 15 | "SIGALRM", /* 14 */ 16 | "SIGTERM", /* 15 */ 17 | "SIGUSR1", /* 16 */ 18 | "SIGUSR2", /* 17 */ 19 | "SIGCHLD", /* 18 */ 20 | "SIGPWR", /* 19 */ 21 | "SIGWINCH", /* 20 */ 22 | "SIGURG", /* 21 */ 23 | "SIGIO", /* 22 */ 24 | "SIGSTOP", /* 23 */ 25 | "SIGTSTP", /* 24 */ 26 | "SIGCONT", /* 25 */ 27 | "SIGTTIN", /* 26 */ 28 | "SIGTTOU", /* 27 */ 29 | "SIGVTALRM", /* 28 */ 30 | "SIGPROF", /* 29 */ 31 | "SIGXCPU", /* 30 */ 32 | "SIGXFSZ", /* 31 */ 33 | -------------------------------------------------------------------------------- /linux/mips/syscallent.h: -------------------------------------------------------------------------------- 1 | #include "../dummy.h" 2 | #include "syscallent-compat.h" 3 | #include "syscallent-o32.h" 4 | #include "syscallent-n64.h" 5 | #include "syscallent-n32.h" 6 | -------------------------------------------------------------------------------- /linux/or1k/ioctls_arch0.h: -------------------------------------------------------------------------------- 1 | /* Generated by ioctls_gen.sh from definitions found in $linux/arch/openrisc/include/ tree. */ 2 | -------------------------------------------------------------------------------- /linux/or1k/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "32/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/or1k/syscallent.h: -------------------------------------------------------------------------------- 1 | #define ARCH_sys_mmap sys_mmap_pgoff 2 | #include "32/syscallent.h" 3 | [244] = { 3, NF, sys_or1k_atomic, "or1k_atomic" }, 4 | [245 ... 259] = { }, 5 | -------------------------------------------------------------------------------- /linux/or1k/userent.h: -------------------------------------------------------------------------------- 1 | { 4*0, "r0" }, 2 | { 4*1, "r1" }, 3 | { 4*2, "r2" }, 4 | { 4*3, "r3" }, 5 | { 4*4, "r4" }, 6 | { 4*5, "r5" }, 7 | { 4*6, "r6" }, 8 | { 4*7, "r7" }, 9 | { 4*8, "r8" }, 10 | { 4*9, "r9" }, 11 | { 4*10, "r10" }, 12 | { 4*11, "r11" }, 13 | { 4*12, "r12" }, 14 | { 4*13, "r13" }, 15 | { 4*14, "r14" }, 16 | { 4*15, "r15" }, 17 | { 4*16, "r16" }, 18 | { 4*17, "r17" }, 19 | { 4*18, "r18" }, 20 | { 4*19, "r19" }, 21 | { 4*20, "r20" }, 22 | { 4*21, "r21" }, 23 | { 4*22, "r22" }, 24 | { 4*23, "r23" }, 25 | { 4*24, "r24" }, 26 | { 4*25, "r25" }, 27 | { 4*26, "r26" }, 28 | { 4*27, "r27" }, 29 | { 4*28, "r28" }, 30 | { 4*29, "r29" }, 31 | { 4*30, "r30" }, 32 | { 4*31, "r31" }, 33 | { 4*32, "pc" }, 34 | { 4*33, "sr" }, 35 | -------------------------------------------------------------------------------- /linux/powerpc/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "32/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/powerpc64/errnoent1.h: -------------------------------------------------------------------------------- 1 | #include "../errnoent.h" 2 | -------------------------------------------------------------------------------- /linux/powerpc64/ioctls_arch0.h: -------------------------------------------------------------------------------- 1 | #include "powerpc/ioctls_arch0.h" 2 | -------------------------------------------------------------------------------- /linux/powerpc64/ioctls_arch1.h: -------------------------------------------------------------------------------- 1 | #include "powerpc/ioctls_arch0.h" 2 | -------------------------------------------------------------------------------- /linux/powerpc64/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "64/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/powerpc64/ioctls_inc1.h: -------------------------------------------------------------------------------- 1 | #include "powerpc/ioctls_inc0.h" 2 | -------------------------------------------------------------------------------- /linux/powerpc64/signalent1.h: -------------------------------------------------------------------------------- 1 | #include "../signalent.h" 2 | -------------------------------------------------------------------------------- /linux/powerpc64/syscallent.h: -------------------------------------------------------------------------------- 1 | #include "powerpc/syscallent.h" 2 | -------------------------------------------------------------------------------- /linux/powerpc64/syscallent1.h: -------------------------------------------------------------------------------- 1 | #include "powerpc/syscallent.h" 2 | -------------------------------------------------------------------------------- /linux/powerpc64/userent.h: -------------------------------------------------------------------------------- 1 | #include "powerpc/userent.h" 2 | -------------------------------------------------------------------------------- /linux/reboot.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_REBOOT_H 2 | #define _LINUX_REBOOT_H 3 | 4 | /* 5 | * Magic values required to use _reboot() system call. 6 | */ 7 | 8 | #define LINUX_REBOOT_MAGIC1 0xfee1dead 9 | #define LINUX_REBOOT_MAGIC2 672274793 10 | #define LINUX_REBOOT_MAGIC2A 85072278 11 | #define LINUX_REBOOT_MAGIC2B 369367448 12 | #define LINUX_REBOOT_MAGIC2C 537993216 13 | 14 | 15 | /* 16 | * Commands accepted by the _reboot() system call. 17 | * 18 | * RESTART Restart system using default command and mode. 19 | * HALT Stop OS and give system control to ROM monitor, if any. 20 | * CAD_ON Ctrl-Alt-Del sequence causes RESTART command. 21 | * CAD_OFF Ctrl-Alt-Del sequence sends SIGINT to init task. 22 | * POWER_OFF Stop OS and remove all power from system, if possible. 23 | * RESTART2 Restart system using given command string. 24 | * SW_SUSPEND Suspend system using software suspend if compiled in. 25 | * KEXEC Restart system using a previously loaded Linux kernel 26 | */ 27 | 28 | #define LINUX_REBOOT_CMD_RESTART 0x01234567 29 | #define LINUX_REBOOT_CMD_HALT 0xCDEF0123 30 | #define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF 31 | #define LINUX_REBOOT_CMD_CAD_OFF 0x00000000 32 | #define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC 33 | #define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4 34 | #define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2 35 | #define LINUX_REBOOT_CMD_KEXEC 0x45584543 36 | 37 | 38 | 39 | #endif /* _LINUX_REBOOT_H */ 40 | -------------------------------------------------------------------------------- /linux/s390/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "32/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/s390/userent.h: -------------------------------------------------------------------------------- 1 | #include "userent0.h" 2 | { PT_FPR0_HI, "fpr0.hi" }, 3 | { PT_FPR0_LO, "fpr0.lo" }, 4 | { PT_FPR1_HI, "fpr1.hi" }, 5 | { PT_FPR1_LO, "fpr1.lo" }, 6 | { PT_FPR2_HI, "fpr2.hi" }, 7 | { PT_FPR2_LO, "fpr2.lo" }, 8 | { PT_FPR3_HI, "fpr3.hi" }, 9 | { PT_FPR3_LO, "fpr3.lo" }, 10 | { PT_FPR4_HI, "fpr4.hi" }, 11 | { PT_FPR4_LO, "fpr4.lo" }, 12 | { PT_FPR5_HI, "fpr5.hi" }, 13 | { PT_FPR5_LO, "fpr5.lo" }, 14 | { PT_FPR6_HI, "fpr6.hi" }, 15 | { PT_FPR6_LO, "fpr6.lo" }, 16 | { PT_FPR7_HI, "fpr7.hi" }, 17 | { PT_FPR7_LO, "fpr7.lo" }, 18 | { PT_FPR8_HI, "fpr8.hi" }, 19 | { PT_FPR8_LO, "fpr8.lo" }, 20 | { PT_FPR9_HI, "fpr9.hi" }, 21 | { PT_FPR9_LO, "fpr9.lo" }, 22 | { PT_FPR10_HI, "fpr10.hi" }, 23 | { PT_FPR10_LO, "fpr10.lo" }, 24 | { PT_FPR11_HI, "fpr11.hi" }, 25 | { PT_FPR11_LO, "fpr11.lo" }, 26 | { PT_FPR12_HI, "fpr12.hi" }, 27 | { PT_FPR12_LO, "fpr12.lo" }, 28 | { PT_FPR13_HI, "fpr13.hi" }, 29 | { PT_FPR13_LO, "fpr13.lo" }, 30 | { PT_FPR14_HI, "fpr14.hi" }, 31 | { PT_FPR14_LO, "fpr14.lo" }, 32 | { PT_FPR15_HI, "fpr15.hi" }, 33 | { PT_FPR15_LO, "fpr15.lo" }, 34 | /* Other fields in "struct user" */ 35 | #include "userent1.h" 36 | -------------------------------------------------------------------------------- /linux/s390/userent0.h: -------------------------------------------------------------------------------- 1 | { PT_PSWMASK, "psw_mask" }, 2 | { PT_PSWADDR, "psw_addr" }, 3 | { PT_GPR0, "gpr0" }, 4 | { PT_GPR1, "gpr1" }, 5 | { PT_GPR2, "gpr2" }, 6 | { PT_GPR3, "gpr3" }, 7 | { PT_GPR4, "gpr4" }, 8 | { PT_GPR5, "gpr5" }, 9 | { PT_GPR6, "gpr6" }, 10 | { PT_GPR7, "gpr7" }, 11 | { PT_GPR8, "gpr8" }, 12 | { PT_GPR9, "gpr9" }, 13 | { PT_GPR10, "gpr10" }, 14 | { PT_GPR11, "gpr11" }, 15 | { PT_GPR12, "gpr12" }, 16 | { PT_GPR13, "gpr13" }, 17 | { PT_GPR14, "gpr14" }, 18 | { PT_GPR15, "gpr15" }, 19 | { PT_ACR0, "acr0" }, 20 | { PT_ACR1, "acr1" }, 21 | { PT_ACR2, "acr2" }, 22 | { PT_ACR3, "acr3" }, 23 | { PT_ACR4, "acr4" }, 24 | { PT_ACR5, "acr5" }, 25 | { PT_ACR6, "acr6" }, 26 | { PT_ACR7, "acr7" }, 27 | { PT_ACR8, "acr8" }, 28 | { PT_ACR9, "acr9" }, 29 | { PT_ACR10, "acr10" }, 30 | { PT_ACR11, "acr11" }, 31 | { PT_ACR12, "acr12" }, 32 | { PT_ACR13, "acr13" }, 33 | { PT_ACR14, "acr14" }, 34 | { PT_ACR15, "acr15" }, 35 | { PT_ORIGGPR2, "orig_gpr2" }, 36 | { PT_FPC, "fpc" }, 37 | /* PT_FPR* differ between s390 and s390x */ 38 | { PT_CR_9, "cr9" }, 39 | { PT_CR_10, "cr10" }, 40 | { PT_CR_11, "cr11" }, 41 | { PT_IEEE_IP, "ieee_exception_ip" }, 42 | -------------------------------------------------------------------------------- /linux/s390/userent1.h: -------------------------------------------------------------------------------- 1 | XLAT_UOFF(u_tsize), 2 | XLAT_UOFF(u_dsize), 3 | XLAT_UOFF(u_ssize), 4 | XLAT_UOFF(start_code), 5 | /* S390[X] has no start_data */ 6 | XLAT_UOFF(start_stack), 7 | XLAT_UOFF(signal), 8 | XLAT_UOFF(u_ar0), 9 | XLAT_UOFF(magic), 10 | XLAT_UOFF(u_comm), 11 | #include "../userent0.h" 12 | -------------------------------------------------------------------------------- /linux/s390x/ioctls_arch0.h: -------------------------------------------------------------------------------- 1 | #include "s390/ioctls_arch0.h" 2 | -------------------------------------------------------------------------------- /linux/s390x/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "64/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/s390x/userent.h: -------------------------------------------------------------------------------- 1 | #include "../s390/userent0.h" 2 | { PT_FPR0, "fpr0" }, 3 | { PT_FPR1, "fpr1" }, 4 | { PT_FPR2, "fpr2" }, 5 | { PT_FPR3, "fpr3" }, 6 | { PT_FPR4, "fpr4" }, 7 | { PT_FPR5, "fpr5" }, 8 | { PT_FPR6, "fpr6" }, 9 | { PT_FPR7, "fpr7" }, 10 | { PT_FPR8, "fpr8" }, 11 | { PT_FPR9, "fpr9" }, 12 | { PT_FPR10, "fpr10" }, 13 | { PT_FPR11, "fpr11" }, 14 | { PT_FPR12, "fpr12" }, 15 | { PT_FPR13, "fpr13" }, 16 | { PT_FPR14, "fpr14" }, 17 | { PT_FPR15, "fpr15" }, 18 | /* Other fields in "struct user" */ 19 | #include "../s390/userent1.h" 20 | -------------------------------------------------------------------------------- /linux/sh/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "32/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/sh/userent0.h: -------------------------------------------------------------------------------- 1 | XLAT_UOFF(u_fpvalid), 2 | XLAT_UOFF(u_tsize), 3 | XLAT_UOFF(u_dsize), 4 | XLAT_UOFF(u_ssize), 5 | XLAT_UOFF(start_code), 6 | XLAT_UOFF(start_data), 7 | XLAT_UOFF(start_stack), 8 | XLAT_UOFF(signal), 9 | XLAT_UOFF(u_ar0), 10 | XLAT_UOFF(u_fpstate), 11 | XLAT_UOFF(magic), 12 | XLAT_UOFF(u_comm), 13 | #include "../userent0.h" 14 | -------------------------------------------------------------------------------- /linux/sh64/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "64/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/signalent.h: -------------------------------------------------------------------------------- 1 | "SIG_0", /* 0 */ 2 | "SIGHUP", /* 1 */ 3 | "SIGINT", /* 2 */ 4 | "SIGQUIT", /* 3 */ 5 | "SIGILL", /* 4 */ 6 | "SIGTRAP", /* 5 */ 7 | "SIGABRT", /* 6 */ 8 | "SIGBUS", /* 7 */ 9 | "SIGFPE", /* 8 */ 10 | "SIGKILL", /* 9 */ 11 | "SIGUSR1", /* 10 */ 12 | "SIGSEGV", /* 11 */ 13 | "SIGUSR2", /* 12 */ 14 | "SIGPIPE", /* 13 */ 15 | "SIGALRM", /* 14 */ 16 | "SIGTERM", /* 15 */ 17 | "SIGSTKFLT", /* 16 */ 18 | "SIGCHLD", /* 17 */ 19 | "SIGCONT", /* 18 */ 20 | "SIGSTOP", /* 19 */ 21 | "SIGTSTP", /* 20 */ 22 | "SIGTTIN", /* 21 */ 23 | "SIGTTOU", /* 22 */ 24 | "SIGURG", /* 23 */ 25 | "SIGXCPU", /* 24 */ 26 | "SIGXFSZ", /* 25 */ 27 | "SIGVTALRM", /* 26 */ 28 | "SIGPROF", /* 27 */ 29 | "SIGWINCH", /* 28 */ 30 | "SIGIO", /* 29 */ 31 | "SIGPWR", /* 30 */ 32 | "SIGSYS", /* 31 */ 33 | "SIGRTMIN", /* 32 */ 34 | -------------------------------------------------------------------------------- /linux/sock_diag.h: -------------------------------------------------------------------------------- 1 | #define SOCK_DIAG_BY_FAMILY 20 2 | 3 | struct sock_diag_req { 4 | uint8_t sdiag_family; 5 | uint8_t sdiag_protocol; 6 | }; 7 | -------------------------------------------------------------------------------- /linux/sparc/gen.pl: -------------------------------------------------------------------------------- 1 | open SPARC, "syscallent.h" || die "no puedo abrir el de la sparc"; 2 | open ALPHA, "../alpha/syscallent.h" || die "no puedo abrir el de la alpha"; 3 | open PC, "../i386/syscallent.h" || die "no puedo abrir PC\n"; 4 | 5 | while () { 6 | chop; 7 | ($i1, $i2, $i3, $syscall, $syscall_name) = split; 8 | $strn[$index] = $syscall_name; 9 | $name[$index++] = $syscall; 10 | } 11 | 12 | while (){ 13 | if (/\{/) { 14 | ($i1, $n, $pr, $syscall) = split; 15 | $par{$syscall} = $n; 16 | $prr{$syscall} = $pr; 17 | } 18 | } 19 | 20 | while (){ 21 | if (/\{/) { 22 | ($i1, $n, $pr, $syscall) = split; 23 | $par{$syscall} = $n; 24 | $prr{$syscall} = $pr; 25 | } 26 | } 27 | 28 | print "missing \n"; 29 | 30 | for ($i = 0; $i < $index; $i++){ 31 | $x = $name[$i]; 32 | $y = $strn[$i]; 33 | $n = $par{$x}; 34 | $p = $prr{$x}; 35 | $j++; 36 | print "\t{ $n\t$p\t$x\t$y },\t /* $j */\n"; 37 | } 38 | -------------------------------------------------------------------------------- /linux/sparc/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "32/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/sparc/signalent.h: -------------------------------------------------------------------------------- 1 | "SIG_0", /* 0 */ 2 | "SIGHUP", /* 1 */ 3 | "SIGINT", /* 2 */ 4 | "SIGQUIT", /* 3 */ 5 | "SIGILL", /* 4 */ 6 | "SIGTRAP", /* 5 */ 7 | "SIGABRT", /* 6 */ 8 | "SIGEMT", /* 7 */ 9 | "SIGFPE", /* 8 */ 10 | "SIGKILL", /* 9 */ 11 | "SIGBUS", /* 10 */ 12 | "SIGSEGV", /* 11 */ 13 | "SIGSYS", /* 12 */ 14 | "SIGPIPE", /* 13 */ 15 | "SIGALRM", /* 14 */ 16 | "SIGTERM", /* 15 */ 17 | "SIGURG", /* 16 */ 18 | "SIGSTOP", /* 17 */ 19 | "SIGTSTP", /* 18 */ 20 | "SIGCONT", /* 19 */ 21 | "SIGCHLD", /* 20 */ 22 | "SIGTTIN", /* 21 */ 23 | "SIGTTOU", /* 22 */ 24 | "SIGIO", /* 23 */ 25 | "SIGXCPU", /* 24 */ 26 | "SIGXFSZ", /* 25 */ 27 | "SIGVTALRM", /* 26 */ 28 | "SIGPROF", /* 27 */ 29 | "SIGWINCH", /* 28 */ 30 | "SIGLOST", /* 29 */ 31 | "SIGUSR1", /* 30 */ 32 | "SIGUSR2", /* 31 */ 33 | -------------------------------------------------------------------------------- /linux/sparc/signalent1.h: -------------------------------------------------------------------------------- 1 | "SIG_0", /* 0 */ 2 | "SIGHUP", /* 1 */ 3 | "SIGINT", /* 2 */ 4 | "SIGQUIT", /* 3 */ 5 | "SIGILL", /* 4 */ 6 | "SIGTRAP", /* 5 */ 7 | "SIGABRT", /* 6 */ 8 | "SIGEMT", /* 7 */ 9 | "SIGFPE", /* 8 */ 10 | "SIGKILL", /* 9 */ 11 | "SIGBUS", /* 10 */ 12 | "SIGSEGV", /* 11 */ 13 | "SIGSYS", /* 12 */ 14 | "SIGPIPE", /* 13 */ 15 | "SIGALRM", /* 14 */ 16 | "SIGTERM", /* 15 */ 17 | "SIGUSR1", /* 16 */ 18 | "SIGUSR2", /* 17 */ 19 | "SIGCHLD", /* 18 */ 20 | "SIGPWR", /* 19 */ 21 | "SIGWINCH", /* 20 */ 22 | "SIGURG", /* 21 */ 23 | "SIGPOLL", /* 22 */ 24 | "SIGSTOP", /* 23 */ 25 | "SIGTSTP", /* 24 */ 26 | "SIGCONT", /* 25 */ 27 | "SIGTTIN", /* 26 */ 28 | "SIGTTOU", /* 27 */ 29 | "SIGVTALRM", /* 28 */ 30 | "SIGPROF", /* 29 */ 31 | "SIGXCPU", /* 30 */ 32 | "SIGXFSZ", /* 31 */ 33 | "SIGWAITING", /* 32 */ 34 | "SIGLWP", /* 33 */ 35 | "SIGFREEZE", /* 34 */ 36 | "SIGTHAW", /* 35 */ 37 | -------------------------------------------------------------------------------- /linux/sparc/userent.h: -------------------------------------------------------------------------------- 1 | #include "../userent0.h" 2 | -------------------------------------------------------------------------------- /linux/sparc64/errnoent1.h: -------------------------------------------------------------------------------- 1 | #include "../sparc/errnoent1.h" 2 | -------------------------------------------------------------------------------- /linux/sparc64/ioctlent1.h: -------------------------------------------------------------------------------- 1 | #include "sparc/ioctlent1.h" 2 | -------------------------------------------------------------------------------- /linux/sparc64/ioctls_arch0.h: -------------------------------------------------------------------------------- 1 | #include "sparc/ioctls_arch0.h" 2 | -------------------------------------------------------------------------------- /linux/sparc64/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "sparc/ioctls_inc0.h" 2 | -------------------------------------------------------------------------------- /linux/sparc64/ioctls_inc2.h: -------------------------------------------------------------------------------- 1 | #include "64/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/sparc64/signalent.h: -------------------------------------------------------------------------------- 1 | "SIG_0", /* 0 */ 2 | "SIGHUP", /* 1 */ 3 | "SIGINT", /* 2 */ 4 | "SIGQUIT", /* 3 */ 5 | "SIGILL", /* 4 */ 6 | "SIGTRAP", /* 5 */ 7 | "SIGABRT", /* 6 */ 8 | "SIGEMT", /* 7 */ 9 | "SIGFPE", /* 8 */ 10 | "SIGKILL", /* 9 */ 11 | "SIGBUS", /* 10 */ 12 | "SIGSEGV", /* 11 */ 13 | "SIGSYS", /* 12 */ 14 | "SIGPIPE", /* 13 */ 15 | "SIGALRM", /* 14 */ 16 | "SIGTERM", /* 15 */ 17 | "SIGURG", /* 16 */ 18 | "SIGSTOP", /* 17 */ 19 | "SIGTSTP", /* 18 */ 20 | "SIGCONT", /* 19 */ 21 | "SIGCHLD", /* 20 */ 22 | "SIGTTIN", /* 21 */ 23 | "SIGTTOU", /* 22 */ 24 | "SIGIO", /* 23 */ 25 | "SIGXCPU", /* 24 */ 26 | "SIGXFSZ", /* 25 */ 27 | "SIGVTALRM", /* 26 */ 28 | "SIGPROF", /* 27 */ 29 | "SIGWINCH", /* 28 */ 30 | "SIGLOST", /* 29 */ 31 | "SIGUSR1", /* 30 */ 32 | "SIGUSR2", /* 31 */ 33 | -------------------------------------------------------------------------------- /linux/sparc64/signalent1.h: -------------------------------------------------------------------------------- 1 | #include "../sparc/signalent1.h" 2 | -------------------------------------------------------------------------------- /linux/sparc64/signalent2.h: -------------------------------------------------------------------------------- 1 | "SIG_0", /* 0 */ 2 | "SIGHUP", /* 1 */ 3 | "SIGINT", /* 2 */ 4 | "SIGQUIT", /* 3 */ 5 | "SIGILL", /* 4 */ 6 | "SIGTRAP", /* 5 */ 7 | "SIGABRT", /* 6 */ 8 | "SIGEMT", /* 7 */ 9 | "SIGFPE", /* 8 */ 10 | "SIGKILL", /* 9 */ 11 | "SIGBUS", /* 10 */ 12 | "SIGSEGV", /* 11 */ 13 | "SIGSYS", /* 12 */ 14 | "SIGPIPE", /* 13 */ 15 | "SIGALRM", /* 14 */ 16 | "SIGTERM", /* 15 */ 17 | "SIGURG", /* 16 */ 18 | "SIGSTOP", /* 17 */ 19 | "SIGTSTP", /* 18 */ 20 | "SIGCONT", /* 19 */ 21 | "SIGCHLD", /* 20 */ 22 | "SIGTTIN", /* 21 */ 23 | "SIGTTOU", /* 22 */ 24 | "SIGIO", /* 23 */ 25 | "SIGXCPU", /* 24 */ 26 | "SIGXFSZ", /* 25 */ 27 | "SIGVTALRM", /* 26 */ 28 | "SIGPROF", /* 27 */ 29 | "SIGWINCH", /* 28 */ 30 | "SIGLOST", /* 29 */ 31 | "SIGUSR1", /* 30 */ 32 | "SIGUSR2", /* 31 */ 33 | -------------------------------------------------------------------------------- /linux/sparc64/syscallent.h: -------------------------------------------------------------------------------- 1 | #include "../sparc/syscallent.h" 2 | -------------------------------------------------------------------------------- /linux/sparc64/syscallent1.h: -------------------------------------------------------------------------------- 1 | #include "../sparc/syscallent1.h" 2 | -------------------------------------------------------------------------------- /linux/sparc64/syscallent2.h: -------------------------------------------------------------------------------- 1 | #include "../sparc/syscallent.h" 2 | -------------------------------------------------------------------------------- /linux/sparc64/userent.h: -------------------------------------------------------------------------------- 1 | XLAT_UOFF(u_tsize), 2 | XLAT_UOFF(u_dsize), 3 | XLAT_UOFF(u_ssize), 4 | XLAT_UOFF(signal), 5 | XLAT_UOFF(magic), 6 | XLAT_UOFF(u_comm), 7 | #include "../userent0.h" 8 | -------------------------------------------------------------------------------- /linux/tile/errnoent1.h: -------------------------------------------------------------------------------- 1 | /* tilegx32/tilepro */ 2 | #include "../errnoent.h" 3 | -------------------------------------------------------------------------------- /linux/tile/ioctls_arch0.h: -------------------------------------------------------------------------------- 1 | /* Generated by ioctls_gen.sh from definitions found in $linux/arch/tile/include/ tree. */ 2 | -------------------------------------------------------------------------------- /linux/tile/ioctls_arch1.h: -------------------------------------------------------------------------------- 1 | /* Generated by ioctls_gen.sh from definitions found in $linux/arch/tile/include/ tree. */ 2 | -------------------------------------------------------------------------------- /linux/tile/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "64/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/tile/ioctls_inc1.h: -------------------------------------------------------------------------------- 1 | #include "32/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/tile/signalent1.h: -------------------------------------------------------------------------------- 1 | /* tilegx32/tilepro */ 2 | #include "../signalent.h" 3 | -------------------------------------------------------------------------------- /linux/tile/syscallent.h: -------------------------------------------------------------------------------- 1 | #include "64/syscallent.h" 2 | [244] = { 1, 0, printargs, "cmpxchg_badaddr" }, 3 | [245] = { 3, 0, printargs, "cacheflush" }, 4 | [246 ... 259] = { }, 5 | -------------------------------------------------------------------------------- /linux/tile/syscallent1.h: -------------------------------------------------------------------------------- 1 | #define ARCH_sys_mmap sys_mmap_4koff 2 | #define ARCH_WANT_SYNC_FILE_RANGE2 1 3 | #include "32/syscallent.h" 4 | [244] = { 1, 0, printargs, "cmpxchg_badaddr" }, 5 | [245] = { 3, 0, printargs, "cacheflush" }, 6 | [246 ... 259] = { }, 7 | -------------------------------------------------------------------------------- /linux/unix_diag.h: -------------------------------------------------------------------------------- 1 | struct unix_diag_req { 2 | uint8_t sdiag_family; 3 | uint8_t sdiag_protocol; 4 | uint16_t pad; 5 | uint32_t udiag_states; 6 | uint32_t udiag_ino; 7 | uint32_t udiag_show; 8 | uint32_t udiag_cookie[2]; 9 | }; 10 | 11 | #define UDIAG_SHOW_NAME 0x01 12 | #define UDIAG_SHOW_PEER 0x04 13 | 14 | struct unix_diag_msg { 15 | uint8_t udiag_family; 16 | uint8_t udiag_type; 17 | uint8_t udiag_state; 18 | uint8_t pad; 19 | uint32_t udiag_ino; 20 | uint32_t udiag_cookie[2]; 21 | }; 22 | 23 | #define UNIX_DIAG_NAME 0 24 | #define UNIX_DIAG_PEER 2 25 | -------------------------------------------------------------------------------- /linux/userent.h: -------------------------------------------------------------------------------- 1 | /* nothing */ 2 | -------------------------------------------------------------------------------- /linux/userent0.h: -------------------------------------------------------------------------------- 1 | { sizeof(struct user), "sizeof(struct user)" }, 2 | -------------------------------------------------------------------------------- /linux/x32/errnoent.h: -------------------------------------------------------------------------------- 1 | #include "../errnoent.h" 2 | -------------------------------------------------------------------------------- /linux/x32/errnoent1.h: -------------------------------------------------------------------------------- 1 | /* i386 personality */ 2 | #include "../errnoent.h" 3 | -------------------------------------------------------------------------------- /linux/x32/ioctls_arch0.h: -------------------------------------------------------------------------------- 1 | #include "x86_64/ioctls_arch0.h" 2 | -------------------------------------------------------------------------------- /linux/x32/ioctls_arch1.h: -------------------------------------------------------------------------------- 1 | #include "i386/ioctls_arch0.h" 2 | -------------------------------------------------------------------------------- /linux/x32/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "x86_64/ioctls_inc0.h" 2 | -------------------------------------------------------------------------------- /linux/x32/ioctls_inc1.h: -------------------------------------------------------------------------------- 1 | #include "i386/ioctls_inc0.h" 2 | -------------------------------------------------------------------------------- /linux/x32/signalent.h: -------------------------------------------------------------------------------- 1 | #include "../signalent.h" 2 | -------------------------------------------------------------------------------- /linux/x32/signalent1.h: -------------------------------------------------------------------------------- 1 | /* i386 personality */ 2 | #include "../signalent.h" 3 | -------------------------------------------------------------------------------- /linux/x32/syscallent1.h: -------------------------------------------------------------------------------- 1 | /* Our second set comes from the i386 files. */ 2 | 3 | #include "../i386/syscallent.h" 4 | -------------------------------------------------------------------------------- /linux/x32/userent.h: -------------------------------------------------------------------------------- 1 | #include "../x86_64/userent.h" 2 | -------------------------------------------------------------------------------- /linux/x86_64/errnoent1.h: -------------------------------------------------------------------------------- 1 | /* i386 personality */ 2 | #include "../errnoent.h" 3 | -------------------------------------------------------------------------------- /linux/x86_64/errnoent2.h: -------------------------------------------------------------------------------- 1 | /* x32 personality */ 2 | #include "../errnoent.h" 3 | -------------------------------------------------------------------------------- /linux/x86_64/ioctlent2.h: -------------------------------------------------------------------------------- 1 | /* x32 personality */ 2 | #include "ioctlent0.h" 3 | -------------------------------------------------------------------------------- /linux/x86_64/ioctls_arch0.h: -------------------------------------------------------------------------------- 1 | /* Generated by ioctls_gen.sh from definitions found in $linux/arch/x86/include/ tree. */ 2 | { "asm/mce.h", "MCE_GETCLEAR_FLAGS", _IOC_READ, 0x4d03, 0x04 }, 3 | { "asm/mce.h", "MCE_GET_LOG_LEN", _IOC_READ, 0x4d02, 0x04 }, 4 | { "asm/mce.h", "MCE_GET_RECORD_LEN", _IOC_READ, 0x4d01, 0x04 }, 5 | { "asm/msr.h", "X86_IOC_RDMSR_REGS", _IOC_READ|_IOC_WRITE, 0x63a0, 0x20 }, 6 | { "asm/msr.h", "X86_IOC_WRMSR_REGS", _IOC_READ|_IOC_WRITE, 0x63a1, 0x20 }, 7 | { "asm/mtrr.h", "MTRRIOC_ADD_ENTRY", _IOC_WRITE, 0x4d00, 0x10 }, 8 | { "asm/mtrr.h", "MTRRIOC_ADD_PAGE_ENTRY", _IOC_WRITE, 0x4d05, 0x10 }, 9 | { "asm/mtrr.h", "MTRRIOC_DEL_ENTRY", _IOC_WRITE, 0x4d02, 0x10 }, 10 | { "asm/mtrr.h", "MTRRIOC_DEL_PAGE_ENTRY", _IOC_WRITE, 0x4d07, 0x10 }, 11 | { "asm/mtrr.h", "MTRRIOC_GET_ENTRY", _IOC_READ|_IOC_WRITE, 0x4d03, 0x18 }, 12 | { "asm/mtrr.h", "MTRRIOC_GET_PAGE_ENTRY", _IOC_READ|_IOC_WRITE, 0x4d08, 0x18 }, 13 | { "asm/mtrr.h", "MTRRIOC_KILL_ENTRY", _IOC_WRITE, 0x4d04, 0x10 }, 14 | { "asm/mtrr.h", "MTRRIOC_KILL_PAGE_ENTRY", _IOC_WRITE, 0x4d09, 0x10 }, 15 | { "asm/mtrr.h", "MTRRIOC_SET_ENTRY", _IOC_WRITE, 0x4d01, 0x10 }, 16 | { "asm/mtrr.h", "MTRRIOC_SET_PAGE_ENTRY", _IOC_WRITE, 0x4d06, 0x10 }, 17 | -------------------------------------------------------------------------------- /linux/x86_64/ioctls_arch1.h: -------------------------------------------------------------------------------- 1 | #include "i386/ioctls_arch0.h" 2 | -------------------------------------------------------------------------------- /linux/x86_64/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "64/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /linux/x86_64/ioctls_inc1.h: -------------------------------------------------------------------------------- 1 | #include "i386/ioctls_inc0.h" 2 | -------------------------------------------------------------------------------- /linux/x86_64/signalent1.h: -------------------------------------------------------------------------------- 1 | /* i386 personality */ 2 | #include "../signalent.h" 3 | -------------------------------------------------------------------------------- /linux/x86_64/signalent2.h: -------------------------------------------------------------------------------- 1 | /* x32 personality */ 2 | #include "../signalent.h" 3 | -------------------------------------------------------------------------------- /linux/x86_64/syscallent1.h: -------------------------------------------------------------------------------- 1 | /* Our second set comes from the i386 files. */ 2 | 3 | #include "../i386/syscallent.h" 4 | -------------------------------------------------------------------------------- /linux/x86_64/syscallent2.h: -------------------------------------------------------------------------------- 1 | /* x32 personality */ 2 | #include "../x32/syscallent.h" 3 | -------------------------------------------------------------------------------- /linux/x86_64/userent.h: -------------------------------------------------------------------------------- 1 | XLAT(8*R15), 2 | XLAT(8*R14), 3 | XLAT(8*R13), 4 | XLAT(8*R12), 5 | XLAT(8*RBP), 6 | XLAT(8*RBX), 7 | XLAT(8*R11), 8 | XLAT(8*R10), 9 | XLAT(8*R9), 10 | XLAT(8*R8), 11 | XLAT(8*RAX), 12 | XLAT(8*RCX), 13 | XLAT(8*RDX), 14 | XLAT(8*RSI), 15 | XLAT(8*RDI), 16 | XLAT(8*ORIG_RAX), 17 | XLAT(8*RIP), 18 | XLAT(8*CS), 19 | { 8*EFLAGS, "8*EFL" }, 20 | XLAT(8*RSP), 21 | XLAT(8*SS), 22 | /* Other fields in "struct user" */ 23 | #include "../i386/userent0.h" 24 | -------------------------------------------------------------------------------- /linux/xtensa/ioctls_inc0.h: -------------------------------------------------------------------------------- 1 | #include "32/ioctls_inc.h" 2 | -------------------------------------------------------------------------------- /m4/long_long.m4: -------------------------------------------------------------------------------- 1 | dnl ### A macro to determine endianness of long long 2 | AC_DEFUN([AC_LITTLE_ENDIAN_LONG_LONG], 3 | [AC_MSG_CHECKING(for little endian long long) 4 | AC_CACHE_VAL(ac_cv_have_little_endian_long_long, 5 | [AC_RUN_IFELSE([AC_LANG_SOURCE([[ 6 | int main () { 7 | union { 8 | long long ll; 9 | int l [2]; 10 | } u; 11 | u.ll = 0x12345678; 12 | if (u.l[0] == 0x12345678) 13 | return 0; 14 | return 1; 15 | } 16 | ]])],[ac_cv_have_little_endian_long_long=yes],[ac_cv_have_little_endian_long_long=no],[ 17 | if test "x$ac_cv_c_bigendian" = "xyes"; then 18 | ac_cv_have_little_endian_long_long=no 19 | else 20 | ac_cv_have_little_endian_long_long=yes 21 | fi 22 | ])]) 23 | AC_MSG_RESULT($ac_cv_have_little_endian_long_long) 24 | if test "$ac_cv_have_little_endian_long_long" = yes 25 | then 26 | AC_DEFINE([HAVE_LITTLE_ENDIAN_LONG_LONG], 1, 27 | [Define if long long is little-endian.]) 28 | fi 29 | ]) 30 | -------------------------------------------------------------------------------- /make-dist: -------------------------------------------------------------------------------- 1 | #!/bin/sh -e 2 | 3 | tag="${1:-master}" 4 | 5 | j=-j`getconf _NPROCESSORS_ONLN 2> /dev/null` || j= 6 | 7 | distdir=strace-dist-$$ 8 | abs_distdir="`pwd`/$distdir" 9 | trap 'chmod -Rf u+w $abs_distdir; rm -rf $abs_distdir' 1 2 15 0 10 | 11 | set -x 12 | git clone -q -n -s .git "$distdir" 13 | 14 | cd $distdir 15 | git checkout -f "$tag" 16 | 17 | ./git-set-file-times 18 | 19 | ./bootstrap 20 | 21 | ./configure --enable-maintainer-mode 22 | 23 | make -s $j distcheck 24 | make -s $j news-check 25 | 26 | mv -f strace-*.tar.xz .. 27 | -------------------------------------------------------------------------------- /or1k_atomic.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | #ifdef OR1K 4 | 5 | #define OR1K_ATOMIC_SWAP 1 6 | #define OR1K_ATOMIC_CMPXCHG 2 7 | #define OR1K_ATOMIC_XCHG 3 8 | #define OR1K_ATOMIC_ADD 4 9 | #define OR1K_ATOMIC_DECPOS 5 10 | #define OR1K_ATOMIC_AND 6 11 | #define OR1K_ATOMIC_OR 7 12 | #define OR1K_ATOMIC_UMAX 8 13 | #define OR1K_ATOMIC_UMIN 9 14 | 15 | #include "xlat/atomic_ops.h" 16 | 17 | int sys_or1k_atomic(struct tcb *tcp) 18 | { 19 | if (entering(tcp)) { 20 | printxval(atomic_ops, tcp->u_arg[0], "???"); 21 | switch(tcp->u_arg[0]) { 22 | case OR1K_ATOMIC_SWAP: 23 | tprintf(", 0x%lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]); 24 | break; 25 | case OR1K_ATOMIC_CMPXCHG: 26 | tprintf(", 0x%lx, %#lx, %#lx", tcp->u_arg[1], tcp->u_arg[2], 27 | tcp->u_arg[3]); 28 | break; 29 | 30 | case OR1K_ATOMIC_XCHG: 31 | case OR1K_ATOMIC_ADD: 32 | case OR1K_ATOMIC_AND: 33 | case OR1K_ATOMIC_OR: 34 | case OR1K_ATOMIC_UMAX: 35 | case OR1K_ATOMIC_UMIN: 36 | tprintf(", 0x%lx, %#lx", tcp->u_arg[1], tcp->u_arg[2]); 37 | break; 38 | 39 | case OR1K_ATOMIC_DECPOS: 40 | tprintf(", 0x%lx", tcp->u_arg[1]); 41 | break; 42 | 43 | default: 44 | break; 45 | } 46 | } 47 | 48 | return RVAL_HEX; 49 | } 50 | 51 | #endif /* OR1K */ 52 | -------------------------------------------------------------------------------- /personality.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | #include 4 | 5 | #include "xlat/personality_options.h" 6 | 7 | int 8 | sys_personality(struct tcb *tcp) 9 | { 10 | if (entering(tcp)) 11 | printxval(personality_options, tcp->u_arg[0], "PER_???"); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /printmode.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | #include 4 | 5 | #include "xlat/modetypes.h" 6 | 7 | const char * 8 | sprintmode(int mode) 9 | { 10 | static char buf[sizeof("S_IFSOCK|S_ISUID|S_ISGID|S_ISVTX|%o") 11 | + sizeof(int)*3 12 | + /*paranoia:*/ 8]; 13 | const char *s; 14 | 15 | if ((mode & S_IFMT) == 0) 16 | s = ""; 17 | else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) { 18 | sprintf(buf, "%#o", mode); 19 | return buf; 20 | } 21 | s = buf + sprintf(buf, "%s%s%s%s", s, 22 | (mode & S_ISUID) ? "|S_ISUID" : "", 23 | (mode & S_ISGID) ? "|S_ISGID" : "", 24 | (mode & S_ISVTX) ? "|S_ISVTX" : ""); 25 | mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX); 26 | if (mode) 27 | sprintf((char*)s, "|%#o", mode); 28 | s = (*buf == '|') ? buf + 1 : buf; 29 | return *s ? s : "0"; 30 | } 31 | -------------------------------------------------------------------------------- /process_vm.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | int 4 | sys_process_vm_readv(struct tcb *tcp) 5 | { 6 | if (entering(tcp)) { 7 | /* arg 1: pid */ 8 | tprintf("%ld, ", tcp->u_arg[0]); 9 | } else { 10 | /* arg 2: local iov */ 11 | if (syserror(tcp)) { 12 | tprintf("%#lx", tcp->u_arg[1]); 13 | } else { 14 | tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1); 15 | } 16 | /* arg 3: local iovcnt */ 17 | tprintf(", %lu, ", tcp->u_arg[2]); 18 | /* arg 4: remote iov */ 19 | if (syserror(tcp)) { 20 | tprintf("%#lx", tcp->u_arg[3]); 21 | } else { 22 | tprint_iov(tcp, tcp->u_arg[4], tcp->u_arg[3], 0); 23 | } 24 | /* arg 5: remote iovcnt */ 25 | /* arg 6: flags */ 26 | tprintf(", %lu, %lu", tcp->u_arg[4], tcp->u_arg[5]); 27 | } 28 | return 0; 29 | } 30 | 31 | int 32 | sys_process_vm_writev(struct tcb *tcp) 33 | { 34 | if (entering(tcp)) { 35 | /* arg 1: pid */ 36 | tprintf("%ld, ", tcp->u_arg[0]); 37 | /* arg 2: local iov */ 38 | if (syserror(tcp)) 39 | tprintf("%#lx", tcp->u_arg[1]); 40 | else 41 | tprint_iov(tcp, tcp->u_arg[2], tcp->u_arg[1], 1); 42 | /* arg 3: local iovcnt */ 43 | tprintf(", %lu, ", tcp->u_arg[2]); 44 | /* arg 4: remote iov */ 45 | if (syserror(tcp)) 46 | tprintf("%#lx", tcp->u_arg[3]); 47 | else 48 | tprint_iov(tcp, tcp->u_arg[4], tcp->u_arg[3], 0); 49 | /* arg 5: remote iovcnt */ 50 | /* arg 6: flags */ 51 | tprintf(", %lu, %lu", tcp->u_arg[4], tcp->u_arg[5]); 52 | } 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /qemu_multiarch_testing/.gitignore: -------------------------------------------------------------------------------- 1 | hdc.dir/strace 2 | hdc.img 3 | -------------------------------------------------------------------------------- /qemu_multiarch_testing/hdc.dir/init: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Emit a msg to let user know this place was reached 4 | echo "Copying to /home" 5 | # Had a case where cp SEGVs, let's have diagnostics for it 6 | cp -a /mnt /home || { echo "cp: $?"; exit 1; } 7 | cd /home/mnt || exit $? 8 | exec ./init2 9 | echo "Failed to exec ./init2" 10 | -------------------------------------------------------------------------------- /qemu_multiarch_testing/hdc.dir/init2: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | umount /mnt # optional 4 | ( 5 | set -e -x 6 | cd strace 7 | ./configure 8 | make 9 | size strace 10 | make check VERBOSE=1 && 11 | cat tests/test-suite.log ||: 12 | test "x$FTP_PORT" = x || 13 | ftpput -P "$FTP_PORT" "$FTP_SERVER" strace 14 | ) 2>&1 | tee strace_build.log 15 | mount -o remount,ro /home 16 | sync 17 | sleep 1 18 | -------------------------------------------------------------------------------- /qemu_multiarch_testing/make-hdc-img.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh -ex 2 | 3 | mountpoint -q / 4 | [ ! -e hdc.img.dir ] 5 | 6 | cleanup() 7 | { 8 | trap - EXIT 9 | if mountpoint -q hdc.img.dir; then 10 | umount -d hdc.img.dir 11 | fi 12 | mountpoint -q hdc.img.dir || 13 | rm -rf hdc.img.dir 14 | exit $@ 15 | } 16 | 17 | trap 'cleanup $?' EXIT 18 | trap 'cleanup 1' HUP PIPE INT QUIT TERM 19 | 20 | size=$(du -ks hdc.dir | sed -rn 's/^([0-9]+).*/\1/p') 21 | [ "$size" -gt 0 ] 22 | 23 | rm -f hdc.img 24 | dd if=/dev/zero of=hdc.img count=1 bs=1024 seek=$(($size*2)) 25 | mkfs.ext3 -q -F -b 1024 -i 4096 hdc.img 26 | tune2fs -c 0 -i 0 hdc.img 27 | mkdir hdc.img.dir 28 | mount -o loop hdc.img hdc.img.dir 29 | cp -a hdc.dir/* hdc.img.dir/ 30 | umount -d hdc.img.dir 31 | -------------------------------------------------------------------------------- /qemu_multiarch_testing/parallel-build-hdc-img.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | export HDBMEGS=64 4 | 5 | build_in_dir() 6 | { 7 | cd "$1" || exit 1 8 | rm -f hdb.img 9 | nice -n10 time ./native-build.sh ../hdc.img 10 | rm -f hdb.img 11 | echo >&3 "Finished: $1" 12 | } 13 | 14 | started=false 15 | for dir; do 16 | test -d "$dir" || continue 17 | test -e "$dir/native-build.sh" || continue 18 | echo "Starting: $dir" 19 | build_in_dir "$dir" 3>&1 "$dir.log" 2>&1 & 20 | started=true 21 | done 22 | 23 | $started || { 24 | echo "Give me system-image-ARCH directories on command line" 25 | exit 1 26 | } 27 | 28 | echo "Waiting to finish" 29 | wait 30 | echo "Done, check the logs" 31 | -------------------------------------------------------------------------------- /readahead.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | int 4 | sys_readahead(struct tcb *tcp) 5 | { 6 | if (entering(tcp)) { 7 | int argn; 8 | printfd(tcp, tcp->u_arg[0]); 9 | argn = printllval(tcp, ", %lld", 1); 10 | tprintf(", %ld", tcp->u_arg[argn]); 11 | } 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /readlink.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | static int 4 | decode_readlink(struct tcb *tcp, int offset) 5 | { 6 | if (entering(tcp)) { 7 | printpath(tcp, tcp->u_arg[offset]); 8 | tprints(", "); 9 | } else { 10 | if (syserror(tcp)) 11 | tprintf("%#lx", tcp->u_arg[offset + 1]); 12 | else 13 | /* Used to use printpathn(), but readlink 14 | * neither includes NUL in the returned count, 15 | * nor actually writes it into memory. 16 | * printpathn() would decide on printing 17 | * "..." continuation based on garbage 18 | * past return buffer's end. 19 | */ 20 | printstr(tcp, tcp->u_arg[offset + 1], tcp->u_rval); 21 | tprintf(", %lu", tcp->u_arg[offset + 2]); 22 | } 23 | return 0; 24 | } 25 | 26 | int 27 | sys_readlink(struct tcb *tcp) 28 | { 29 | return decode_readlink(tcp, 0); 30 | } 31 | 32 | int 33 | sys_readlinkat(struct tcb *tcp) 34 | { 35 | if (entering(tcp)) 36 | print_dirfd(tcp, tcp->u_arg[0]); 37 | return decode_readlink(tcp, 1); 38 | } 39 | -------------------------------------------------------------------------------- /reboot.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | #include 3 | 4 | #include "xlat/bootflags1.h" 5 | #include "xlat/bootflags2.h" 6 | #include "xlat/bootflags3.h" 7 | 8 | int 9 | sys_reboot(struct tcb *tcp) 10 | { 11 | if (exiting(tcp)) 12 | return 0; 13 | 14 | printflags(bootflags1, tcp->u_arg[0], "LINUX_REBOOT_MAGIC_???"); 15 | tprints(", "); 16 | printflags(bootflags2, tcp->u_arg[1], "LINUX_REBOOT_MAGIC_???"); 17 | tprints(", "); 18 | printflags(bootflags3, tcp->u_arg[2], "LINUX_REBOOT_CMD_???"); 19 | if (tcp->u_arg[2] == (long) LINUX_REBOOT_CMD_RESTART2) { 20 | tprints(", "); 21 | printstr(tcp, tcp->u_arg[3], -1); 22 | } 23 | return 0; 24 | } 25 | -------------------------------------------------------------------------------- /renameat.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | static void 4 | decode_renameat(struct tcb *tcp) 5 | { 6 | print_dirfd(tcp, tcp->u_arg[0]); 7 | printpath(tcp, tcp->u_arg[1]); 8 | tprints(", "); 9 | print_dirfd(tcp, tcp->u_arg[2]); 10 | printpath(tcp, tcp->u_arg[3]); 11 | } 12 | 13 | int 14 | sys_renameat(struct tcb *tcp) 15 | { 16 | if (entering(tcp)) { 17 | decode_renameat(tcp); 18 | } 19 | return 0; 20 | } 21 | 22 | #include 23 | #include "xlat/rename_flags.h" 24 | 25 | int 26 | sys_renameat2(struct tcb *tcp) 27 | { 28 | if (entering(tcp)) { 29 | decode_renameat(tcp); 30 | tprints(", "); 31 | printflags(rename_flags, tcp->u_arg[4], "RENAME_??"); 32 | } 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /sram_alloc.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | #ifdef BFIN 4 | 5 | #include 6 | 7 | #include "xlat/sram_alloc_flags.h" 8 | 9 | int 10 | sys_sram_alloc(struct tcb *tcp) 11 | { 12 | if (entering(tcp)) { 13 | /* size */ 14 | tprintf("%lu, ", tcp->u_arg[0]); 15 | /* flags */ 16 | printflags(sram_alloc_flags, tcp->u_arg[1], "???_SRAM"); 17 | } 18 | return 1; 19 | } 20 | 21 | #endif /* BFIN */ 22 | -------------------------------------------------------------------------------- /strace-log-merge: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | show_usage() 4 | { 5 | cat <<__EOF__ 6 | Usage: ${0##*/} STRACE_LOG 7 | 8 | Finds all STRACE_LOG.PID files, adds PID prefix to every line, 9 | then combines and sorts them, and prints result to standard output. 10 | 11 | It is assumed that STRACE_LOGs were produced by strace with -tt[t] 12 | option which prints timestamps (otherwise sorting won't do any good). 13 | __EOF__ 14 | } 15 | 16 | if [ $# -ne 1 ]; then 17 | show_usage >&2 18 | exit 1 19 | elif [ "$1" = '--help' ]; then 20 | show_usage 21 | exit 0 22 | fi 23 | 24 | logfile=$1 25 | 26 | for file in "$logfile".*; do 27 | [ -f "$file" ] || continue 28 | suffix=${file#"$logfile".} 29 | [ "$suffix" -gt 0 ] 2> /dev/null || 30 | continue 31 | pid=$(printf "%-5s" $suffix) 32 | # Some strace logs have last line which is not '\n' terminated, 33 | # so add extra newline to every file. 34 | # grep -v '^$' removes empty lines which may result. 35 | sed "s/^/$pid /" < "$file" 36 | echo 37 | done \ 38 | | sort -s -k2,2 | grep -v '^$' 39 | 40 | rc=$? 41 | [ $rc -eq 1 ] && 42 | echo >&2 "${0##*/}: $logfile: strace output not found" 43 | exit $rc 44 | -------------------------------------------------------------------------------- /swapon.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | #include 4 | 5 | #ifndef SWAP_FLAG_PREFER 6 | # define SWAP_FLAG_PREFER 0x8000 7 | #endif 8 | #ifndef SWAP_FLAG_DISCARD 9 | # define SWAP_FLAG_DISCARD 0x10000 10 | #endif 11 | #ifndef SWAP_FLAG_DISCARD_ONCE 12 | # define SWAP_FLAG_DISCARD_ONCE 0x20000 13 | #endif 14 | #ifndef SWAP_FLAG_DISCARD_PAGES 15 | # define SWAP_FLAG_DISCARD_PAGES 0x40000 16 | #endif 17 | 18 | #include "xlat/swap_flags.h" 19 | 20 | int 21 | sys_swapon(struct tcb *tcp) 22 | { 23 | if (entering(tcp)) { 24 | int flags = tcp->u_arg[1]; 25 | printpath(tcp, tcp->u_arg[0]); 26 | tprints(", "); 27 | printflags(swap_flags, flags & ~SWAP_FLAG_PRIO_MASK, 28 | "SWAP_FLAG_???"); 29 | if (flags & SWAP_FLAG_PREFER) 30 | tprintf("|%d", flags & SWAP_FLAG_PRIO_MASK); 31 | } 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /sync_file_range.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | #include 4 | 5 | #include "xlat/sync_file_range_flags.h" 6 | 7 | int 8 | sys_sync_file_range(struct tcb *tcp) 9 | { 10 | if (entering(tcp)) { 11 | int argn; 12 | printfd(tcp, tcp->u_arg[0]); 13 | argn = printllval(tcp, ", %lld, ", 1); 14 | argn = printllval(tcp, "%lld, ", argn); 15 | printflags(sync_file_range_flags, tcp->u_arg[argn], 16 | "SYNC_FILE_RANGE_???"); 17 | } 18 | return 0; 19 | } 20 | 21 | int 22 | sys_sync_file_range2(struct tcb *tcp) 23 | { 24 | if (entering(tcp)) { 25 | int argn; 26 | printfd(tcp, tcp->u_arg[0]); 27 | printflags(sync_file_range_flags, 1, 28 | "SYNC_FILE_RANGE_???"); 29 | argn = printllval(tcp, ", %lld, ", 2); 30 | argn = printllval(tcp, "%lld, ", argn); 31 | } 32 | return 0; 33 | } 34 | -------------------------------------------------------------------------------- /sysinfo.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | #include 3 | 4 | int 5 | sys_sysinfo(struct tcb *tcp) 6 | { 7 | struct sysinfo si; 8 | 9 | if (entering(tcp)) 10 | return 0; 11 | 12 | if (syserror(tcp) || !verbose(tcp) || 13 | umove(tcp, tcp->u_arg[0], &si) < 0) { 14 | tprintf("%#lx", tcp->u_arg[0]); 15 | } else { 16 | tprintf("{uptime=%lu" 17 | ", loads=[%lu, %lu, %lu]" 18 | ", totalram=%lu" 19 | ", freeram=%lu" 20 | ", sharedram=%lu" 21 | ", bufferram=%lu" 22 | ", totalswap=%lu" 23 | ", freeswap=%lu" 24 | ", procs=%u" 25 | #ifdef HAVE_STRUCT_SYSINFO_TOTALHIGH 26 | ", totalhigh=%lu" 27 | #endif 28 | #ifdef HAVE_STRUCT_SYSINFO_FREEHIGH 29 | ", freehigh=%lu" 30 | #endif 31 | #ifdef HAVE_STRUCT_SYSINFO_MEM_UNIT 32 | ", mem_unit=%u" 33 | #endif 34 | "}", 35 | si.uptime 36 | , si.loads[0], si.loads[1], si.loads[2] 37 | , si.totalram 38 | , si.freeram 39 | , si.sharedram 40 | , si.bufferram 41 | , si.totalswap 42 | , si.freeswap 43 | , (unsigned) si.procs 44 | #ifdef HAVE_STRUCT_SYSINFO_TOTALHIGH 45 | , si.totalhigh 46 | #endif 47 | #ifdef HAVE_STRUCT_SYSINFO_FREEHIGH 48 | , si.freehigh 49 | #endif 50 | #ifdef HAVE_STRUCT_SYSINFO_MEM_UNIT 51 | , si.mem_unit 52 | #endif 53 | ); 54 | } 55 | 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /syslog.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | enum { 4 | SYSLOG_ACTION_CLOSE = 0, 5 | SYSLOG_ACTION_OPEN, 6 | SYSLOG_ACTION_READ, 7 | SYSLOG_ACTION_READ_ALL, 8 | SYSLOG_ACTION_READ_CLEAR, 9 | SYSLOG_ACTION_CLEAR, 10 | SYSLOG_ACTION_CONSOLE_OFF, 11 | SYSLOG_ACTION_CONSOLE_ON, 12 | SYSLOG_ACTION_CONSOLE_LEVEL, 13 | SYSLOG_ACTION_SIZE_UNREAD, 14 | SYSLOG_ACTION_SIZE_BUFFER 15 | }; 16 | 17 | #include "xlat/syslog_action_type.h" 18 | 19 | int 20 | sys_syslog(struct tcb *tcp) 21 | { 22 | int type = tcp->u_arg[0]; 23 | 24 | if (entering(tcp)) { 25 | /* type */ 26 | printxval(syslog_action_type, type, "SYSLOG_ACTION_???"); 27 | tprints(", "); 28 | } 29 | 30 | switch (type) { 31 | case SYSLOG_ACTION_READ: 32 | case SYSLOG_ACTION_READ_ALL: 33 | case SYSLOG_ACTION_READ_CLEAR: 34 | if (entering(tcp)) 35 | return 0; 36 | break; 37 | default: 38 | if (entering(tcp)) { 39 | tprintf("%#lx, %lu", 40 | tcp->u_arg[1], tcp->u_arg[2]); 41 | } 42 | return 0; 43 | } 44 | 45 | /* bufp */ 46 | if (syserror(tcp)) 47 | tprintf("%#lx", tcp->u_arg[1]); 48 | else 49 | printstr(tcp, tcp->u_arg[1], tcp->u_rval); 50 | /* len */ 51 | tprintf(", %d", (int) tcp->u_arg[2]); 52 | 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /sysmips.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | #ifdef MIPS 4 | 5 | #ifdef HAVE_LINUX_UTSNAME_H 6 | # include 7 | #endif 8 | #ifdef HAVE_ASM_SYSMIPS_H 9 | # include 10 | #endif 11 | 12 | #ifndef __NEW_UTS_LEN 13 | # define __NEW_UTS_LEN 64 14 | #endif 15 | 16 | #include "xlat/sysmips_operations.h" 17 | 18 | int sys_sysmips(struct tcb *tcp) 19 | { 20 | if (entering(tcp)) { 21 | printxval(sysmips_operations, tcp->u_arg[0], "???"); 22 | if (!verbose(tcp)) { 23 | tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]); 24 | } else if (tcp->u_arg[0] == SETNAME) { 25 | char nodename[__NEW_UTS_LEN + 1]; 26 | tprints(", "); 27 | if (umovestr(tcp, tcp->u_arg[1], (__NEW_UTS_LEN + 1), 28 | nodename) < 0) { 29 | tprintf("%#lx", tcp->u_arg[1]); 30 | } else { 31 | print_quoted_string(nodename, __NEW_UTS_LEN + 1, 32 | QUOTE_0_TERMINATED); 33 | } 34 | } else if (tcp->u_arg[0] == MIPS_ATOMIC_SET) { 35 | tprintf(", %#lx, 0x%lx", tcp->u_arg[1], tcp->u_arg[2]); 36 | } else if (tcp->u_arg[0] == MIPS_FIXADE) { 37 | tprintf(", 0x%lx", tcp->u_arg[1]); 38 | } else { 39 | tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]); 40 | } 41 | } 42 | 43 | return 0; 44 | } 45 | 46 | #endif /* MIPS */ 47 | -------------------------------------------------------------------------------- /test/.gitignore: -------------------------------------------------------------------------------- 1 | vfork 2 | fork 3 | sig 4 | skodic 5 | clone 6 | leaderkill 7 | childthread 8 | sigkill_rain 9 | wait_must_be_interruptible 10 | threaded_execve 11 | mtd 12 | ubi 13 | sigreturn 14 | -------------------------------------------------------------------------------- /test/Makefile: -------------------------------------------------------------------------------- 1 | CFLAGS += -Wall 2 | 3 | PROGS = \ 4 | vfork fork sig skodic clone leaderkill childthread \ 5 | sigkill_rain wait_must_be_interruptible threaded_execve \ 6 | mtd ubi sigreturn 7 | 8 | all: $(PROGS) 9 | 10 | leaderkill: LDFLAGS += -pthread 11 | 12 | childthread: LDFLAGS += -pthread 13 | 14 | clean distclean: 15 | rm -f *.o core $(PROGS) *.gdb 16 | 17 | .PHONY: all clean distclean 18 | -------------------------------------------------------------------------------- /test/README: -------------------------------------------------------------------------------- 1 | To run a test: 2 | * Run make 3 | * Run resulting executable(s) under strace 4 | * Check strace output and/or program's output and exitcode 5 | 6 | To add a new test: 7 | * Add its .c source to this dir 8 | * Add it to "all" and "clean" targets in Makefile 9 | * Add it to .gitignore file 10 | 11 | Please spend some time making your testcase understandable. 12 | For example, it may print an explanation how it should be used 13 | (which strace options to use, and what to look for in strace output). 14 | 15 | If possible, make it so that your testcase detects error/bug 16 | it is intended to test for, and prints error message and exits with 1 17 | if the bug is detected, instead of relying on user to peruse strace output. 18 | -------------------------------------------------------------------------------- /test/clone.c: -------------------------------------------------------------------------------- 1 | /* for CLONE_foo: */ 2 | #define _GNU_SOURCE 1 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int child(void* arg) 10 | { 11 | write(1, "clone\n", 6); 12 | return 0; 13 | } 14 | 15 | int main(int argc, char *argv[]) 16 | { 17 | char stack[4096]; 18 | clone(child, stack+4000, CLONE_VM|CLONE_FS|CLONE_FILES, NULL); 19 | write(1, "original\n", 9); 20 | exit(0); 21 | } 22 | -------------------------------------------------------------------------------- /test/fork.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | if (fork() == 0) { 8 | write(1, "child\n", 6); 9 | } else { 10 | wait(0); 11 | write(1, "parent\n", 7); 12 | } 13 | 14 | exit(0); 15 | } 16 | -------------------------------------------------------------------------------- /test/mmap_offset_decode.c: -------------------------------------------------------------------------------- 1 | /* Should strace show byte or page offsets in mmap syscalls 2 | * which take page offset parameters? 3 | * 4 | * At the time of writing, sys_mmap() converts page to byte offsets, 5 | * but only for SH64! But this routine is used on i386 too - by mmap2 syscall, 6 | * which uses page offsets too. As it stands now, SH64 and i386 are inconsistent. 7 | * 8 | * sys_old_mmap() is used for old mmap syscall, which uses byte offset - 9 | * should be ok. 10 | * sys_mmap64() is currently buggy (should print bogus offset, but I can't 11 | * test it right now. What arch/bitness invokes sys_mmap64?) 12 | * 13 | * This program is intended for testing what strace actually shows. Usage: 14 | * $ gcc test/mmap_offset_decode.c -o mmap_offset_decode -static 15 | * $ strace ./mmap_offset_decode 16 | * 17 | * As of today (2011-08), on i386 strace prints page offset. 18 | * Fixed 2013-02-19. Now all mmaps on all arches should show byte offsets. 19 | */ 20 | #define _LARGEFILE_SOURCE 21 | #define _LARGEFILE64_SOURCE 22 | #define _FILE_OFFSET_BITS 64 23 | #include 24 | #include 25 | int main() 26 | { 27 | /* 0x1000 is meant to be page size multiplier */ 28 | mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 29 | 0x7fff0000LL * 0x1000); 30 | return errno != 0; 31 | } 32 | -------------------------------------------------------------------------------- /test/mtd.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int main() { 10 | int fd = open("/dev/null", 0); 11 | struct mtd_info_user minfo; 12 | struct erase_info_user einfo; 13 | struct erase_info_user64 einfo64; 14 | struct mtd_oob_buf mbuf; 15 | struct mtd_oob_buf64 mbuf64; 16 | struct region_info_user rinfo; 17 | /* struct otp_info oinfo; */ 18 | struct mtd_ecc_stats estat; 19 | struct mtd_write_req mreq; 20 | struct nand_oobinfo ninfo; 21 | struct nand_ecclayout_user nlay; 22 | off_t f = 333; 23 | 24 | memset(&einfo, 0, sizeof(einfo)); 25 | memset(&einfo64, 0xff, sizeof(einfo64)); 26 | 27 | ioctl(fd, MEMGETINFO, &minfo); 28 | 29 | ioctl(fd, MEMERASE, &einfo); 30 | ioctl(fd, MEMERASE64, &einfo64); 31 | 32 | ioctl(fd, MEMGETBADBLOCK, &f); 33 | int i = 0; 34 | ioctl(fd, OTPSELECT, &i); 35 | ioctl(fd, MEMSETBADBLOCK, &f); 36 | 37 | ioctl(fd, MEMREADOOB, &mbuf); 38 | ioctl(fd, MEMREADOOB64, &mbuf64); 39 | 40 | ioctl(fd, MEMGETREGIONINFO, &rinfo); 41 | 42 | ioctl(fd, ECCGETSTATS, &estat); 43 | ioctl(fd, MEMWRITE, &mreq); 44 | 45 | ioctl(fd, MEMGETOOBSEL, &ninfo); 46 | ioctl(fd, ECCGETLAYOUT, &nlay); 47 | 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /test/procpollable.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | int main(int argc, char *argv[]) 9 | { 10 | int pid; 11 | char proc[32]; 12 | FILE *pfp; 13 | struct pollfd pfd; 14 | 15 | pid = fork(); 16 | if (pid == 0) { 17 | pause(); 18 | exit(0); 19 | } 20 | 21 | sprintf(proc, "/proc/%d", pid); 22 | 23 | pfp = fopen(proc, "r+"); 24 | if (pfp == NULL) 25 | goto fail; 26 | 27 | if (ioctl(fileno(pfp), PIOCSTOP, NULL) < 0) 28 | goto fail; 29 | 30 | pfd.fd = fileno(pfp); 31 | pfd.events = POLLPRI; 32 | 33 | if (poll(&pfd, 1, 0) < 0) 34 | goto fail; 35 | 36 | if (!(pfd.revents & POLLPRI)) 37 | goto fail; 38 | 39 | kill(pid, SIGKILL); 40 | exit(0); 41 | fail: 42 | kill(pid, SIGKILL); 43 | exit(1); 44 | } 45 | -------------------------------------------------------------------------------- /test/sfd.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(int argc, char *argv[]) 5 | { 6 | int pid = atoi(argv[1]); 7 | int sfd; 8 | char sname[32]; 9 | char buf[1024]; 10 | char *s; 11 | int i; 12 | int signal, blocked, ignore, caught; 13 | 14 | sprintf(sname, "/proc/%d/stat", pid); 15 | 16 | sfd = open(sname, O_RDONLY); 17 | if (sfd == -1) { 18 | perror(sname); 19 | return 1; 20 | } 21 | 22 | i = read(sfd, buf, 1024); 23 | buf[i] = '\0'; 24 | 25 | for (i = 0, s = buf; i < 30; i++) { 26 | while (*++s != ' ') { 27 | if (!*s) 28 | break; 29 | } 30 | } 31 | 32 | if (sscanf(s, "%d%d%d%d", &signal, &blocked, &ignore, &caught) != 4) { 33 | fprintf(stderr, "/proc/pid/stat format error\n"); 34 | return 1; 35 | } 36 | 37 | printf("%8x %8x %8x %8x\n", signal, blocked, ignore, caught); 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /test/sig.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | void interrupt() 6 | { 7 | write(2, "xyzzy\n", 6); 8 | } 9 | 10 | int main(int argc, char *argv[]) 11 | { 12 | char buf[1024]; 13 | 14 | signal(SIGINT, interrupt); 15 | read(0, buf, 1024); 16 | write(2, "qwerty\n", 7); 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /test/sigreturn.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Check that strace output contains RT_1 RT_3 RT_31 RT_32 here: 3 | * rt_sigprocmask(SIG_BLOCK, [CHLD RT_1 RT_3 RT_31 RT_32], NULL, 8) = 0 4 | * and here: 5 | * sigreturn() (mask [CHLD RT_1 RT_3 RT_31 RT_32]) = 0 6 | * 7 | * On x86, both 32-bit and 64-bit strace needs to be checked. 8 | */ 9 | #include 10 | #include 11 | #include 12 | 13 | void null_handler(int sig) 14 | { 15 | } 16 | 17 | int main(int argc, char *argv[]) 18 | { 19 | sigset_t set; 20 | sigemptyset(&set); 21 | sigaddset(&set, SIGCHLD); 22 | sigaddset(&set, 33); 23 | sigaddset(&set, 35); 24 | sigaddset(&set, 63); 25 | sigaddset(&set, 64); 26 | sigprocmask(SIG_BLOCK, &set, NULL); 27 | signal(SIGWINCH, null_handler); 28 | raise(SIGWINCH); 29 | return 0; 30 | } 31 | -------------------------------------------------------------------------------- /test/skodic.c: -------------------------------------------------------------------------------- 1 | /* This demonstrates races: kernel may actually open other file then 2 | * you read at strace output. Create /tmp/delme with 10K of zeros and 3 | * 666 mode, then run this under strace. If you see open successfull 4 | * open of /etc/shadow, you know you've seen a race. 5 | */ 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | int main(int argc, char *argv[]) 17 | { 18 | char *c; 19 | int fd; 20 | 21 | fd = open("/tmp/delme", O_RDWR); 22 | c = mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); 23 | *c = 0; 24 | 25 | if (fork()) { 26 | while (1) { 27 | strcpy(c, "/etc/passwd"); 28 | strcpy(c, "/etc/shadow"); 29 | } 30 | } else { 31 | while (1) 32 | if ((fd = open(c, 0)) != -1) 33 | close(fd); 34 | } 35 | 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /test/ubi.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define zero(x) memset(&x, 0, sizeof(x)) 11 | 12 | int main() { 13 | int fd = open("/dev/null", 0); 14 | struct ubi_mkvol_req mkvol = { 15 | .vol_id = 3, 16 | .alignment = 124, 17 | .bytes = 1125899906842624ULL, 18 | .vol_type = 3, 19 | .name_len = 7, 20 | .name = "foobar", 21 | }; 22 | struct ubi_rsvol_req rsvol = { 23 | .bytes = 1125899906842624ULL, 24 | .vol_id = -3, 25 | }; 26 | struct ubi_rnvol_req rnvol = { 27 | .count = 300, 28 | }; 29 | struct ubi_attach_req attach; 30 | struct ubi_map_req map; 31 | struct ubi_set_vol_prop_req prop = { 32 | .property = 1, 33 | .value = 1125899906842624ULL, 34 | }; 35 | uint64_t bytes = ((uint64_t)1 << 50) | 0x123; 36 | 37 | ioctl(fd, UBI_IOCMKVOL, &mkvol); 38 | ioctl(fd, UBI_IOCRSVOL, &rsvol); 39 | ioctl(fd, UBI_IOCRNVOL, &rnvol); 40 | ioctl(fd, UBI_IOCATT, &attach); 41 | ioctl(fd, UBI_IOCVOLUP, &bytes); 42 | ioctl(fd, UBI_IOCEBMAP, &map); 43 | ioctl(fd, UBI_IOCSETVOLPROP, &prop); 44 | zero(prop); 45 | ioctl(fd, UBI_IOCSETVOLPROP, &prop); 46 | ioctl(fd, UBI_IOCRMVOL, 1); 47 | ioctl(fd, UBI_IOCDET, 2); 48 | ioctl(fd, UBI_IOCEBER, 3); 49 | ioctl(fd, UBI_IOCEBCH, 4); 50 | ioctl(fd, UBI_IOCEBUNMAP, 5); 51 | ioctl(fd, UBI_IOCEBISMAP, 6); 52 | 53 | return 0; 54 | } 55 | -------------------------------------------------------------------------------- /test/vfork.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int main(int argc, char *argv[]) 6 | { 7 | if (vfork() == 0) { 8 | write(1, "child\n", 6); 9 | } else { 10 | wait(0); 11 | write(1, "parent\n", 7); 12 | } 13 | 14 | exit(0); 15 | } 16 | -------------------------------------------------------------------------------- /test/x32_lseek.c: -------------------------------------------------------------------------------- 1 | // Test program which explores whether lseek syscall (not llseek!) 2 | // on x32 uses 64-bit offset argument. 3 | // IOW: does _kernel_ truncate it on entry? 4 | // The answer appears to be "no, full 64-bit offset is used". 5 | // strace must show it correctly too - tricky if strace itself is x32 one! 6 | // 7 | // Build: x86_64-gcc -static -Wall -ox32_lseek x32_lseek.c 8 | // Run: $ strace ./x32_lseek 2>&1 | grep lseek | grep 1250999896321 9 | // lseek(0, 1250999896321, SEEK_SET) = 1250999896321 10 | #define _GNU_SOURCE 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | // Ensure we are compiling to 64 bits 20 | struct bug { int t[sizeof(long) > 4 ? 1 : -1]; }; 21 | int main(int argc, char **argv) 22 | { 23 | long ofs = 0x12345678901; 24 | errno = 0; 25 | close(0); 26 | if (open("/etc/passwd", O_RDONLY)) 27 | return 1; 28 | long r = syscall( 29 | (long) (__NR_lseek | 0x40000000), // make x32 call 30 | (long) (0), 31 | (long) (ofs), 32 | (long) (SEEK_SET) 33 | ); 34 | printf("pos:%ld(0x%lx) errno:%m\n", r, r); 35 | if (!errno) 36 | printf((r == ofs) ? "64-bit offset used\n" : "Kernel truncated offset\n"); 37 | return 0; 38 | } 39 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | caps 2 | fanotify_mark 3 | inet-accept-connect-send-recv 4 | ioctl 5 | ipc_msg 6 | ipc_sem 7 | ipc_shm 8 | mmsg 9 | net-accept-connect 10 | netlink_inet_diag 11 | netlink_unix_diag 12 | scm_rights 13 | select 14 | set_ptracer_any 15 | sigaction 16 | stack-fcall 17 | stat 18 | stat32 19 | statfs 20 | uid 21 | uid16 22 | uid32 23 | uio 24 | unix-pair-send-recv 25 | *.log 26 | *.log.* 27 | *.o 28 | *.tmp 29 | *.tmp-* 30 | *.tmp.* 31 | *.trs 32 | -------------------------------------------------------------------------------- /tests/caps.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | fail = 0 3 | lines = 3 4 | cap = "(0|CAP_[A-Z_]+(\\|CAP_[A-Z_]+)*|CAP_[A-Z_]+(\\|CAP_[A-Z_]+){37}\\|0xffffffc0)" 5 | capget = "^capget\\(\\{_LINUX_CAPABILITY_VERSION_3, 0\\}, \\{" cap ", " cap ", " cap "\\}\\) = 0$" 6 | } 7 | 8 | NR == 1 {if (match($0, capget)) next} 9 | 10 | NR == 2 && $0 == "capset({_LINUX_CAPABILITY_VERSION_3, 0}, {CAP_DAC_OVERRIDE|CAP_WAKE_ALARM, CAP_DAC_READ_SEARCH|CAP_BLOCK_SUSPEND, 0}) = -1 EPERM (Operation not permitted)" {next} 11 | 12 | NR == lines && $0 == "+++ exited with 0 +++" {next} 13 | 14 | { 15 | print "Line " NR " does not match." 16 | fail = 1 17 | exit 1 18 | } 19 | 20 | END { 21 | if (fail == 0 && NR != lines) { 22 | print "Expected " lines " lines, found " NR " line(s)." 23 | exit 1 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /tests/caps.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern int capget(int *, int *); 4 | extern int capset(int *, const int *); 5 | 6 | int 7 | main(void) 8 | { 9 | int unused[6]; 10 | const int data[] = { 2, 4, 0, 8, 16, 0 }; 11 | const int v3 = 0x20080522; 12 | int head[] = { v3, 0 }; 13 | 14 | if (capget(head, unused) || head[0] != v3 || 15 | capset(head, data) == 0 || errno != EPERM) 16 | return 77; 17 | 18 | return 0; 19 | } 20 | -------------------------------------------------------------------------------- /tests/caps.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check capget/capset syscalls decoding. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog awk 8 | 9 | ./caps || { 10 | if [ $? -eq 77 ]; then 11 | framework_skip_ 'capget/capset syscalls do not behave as expected' 12 | else 13 | fail_ 'caps failed' 14 | fi 15 | } 16 | 17 | args="-e trace=capget,capset ./caps" 18 | $STRACE -o "$LOG" $args || { 19 | cat "$LOG" 20 | fail_ "$STRACE $args failed" 21 | } 22 | 23 | awk -f "$srcdir"/caps.awk "$LOG" || 24 | { cat "$LOG"; fail_ 'unexpected output'; } 25 | 26 | exit 0 27 | -------------------------------------------------------------------------------- /tests/count.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check whether -c and -w options work. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog grep 8 | check_prog sleep 9 | 10 | make_log() 11 | { 12 | $STRACE $args > $LOG 2>&1 || { 13 | cat $LOG 14 | fail_ "$STRACE $args failed" 15 | } 16 | } 17 | 18 | grep_log() 19 | { 20 | LC_ALL=C grep -E -x -e "$*" $LOG > /dev/null || { 21 | cat $LOG 22 | fail_ "unexpected output from $STRACE $args" 23 | } 24 | } 25 | 26 | args='-c sleep 1' 27 | make_log 28 | grep nanosleep $LOG > /dev/null || 29 | skip_ 'sleep does not use nanosleep' 30 | grep_log ' *[^ ]+ +0\.0[^n]*nanosleep' 31 | 32 | args='-c -enanosleep sleep 1' 33 | make_log 34 | grep_log ' *[^ ]+ +0\.0[^n]*nanosleep' 35 | 36 | args='-cw sleep 1' 37 | make_log 38 | grep_log ' *[^ ]+ +(1\.0|0\.99)[^n]*nanosleep' 39 | 40 | args='-cw -enanosleep sleep 1' 41 | make_log 42 | grep_log '100\.00 +(1\.0|0\.99)[^n]*nanosleep' 43 | 44 | exit 0 45 | -------------------------------------------------------------------------------- /tests/detach-running.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Ensure that strace can detach from running processes. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | kill -0 $$ || 8 | framework_skip_ 'kill -0 does not work' 9 | 10 | check_prog grep 11 | check_prog sleep 12 | 13 | set -e 14 | 15 | ./set_ptracer_any sh -c "echo > $LOG; while :; do :; done" > /dev/null & 16 | 17 | while ! [ -s $LOG ]; do 18 | kill -0 $! 2> /dev/null || 19 | fail_ 'set_ptracer_any sh failed' 20 | $SLEEP_A_BIT 21 | done 22 | 23 | tracee_pid=$! 24 | 25 | cleanup() 26 | { 27 | set +e 28 | kill $tracee_pid 29 | wait $tracee_pid 2> /dev/null 30 | return 0 31 | } 32 | 33 | rm -f $LOG 34 | $STRACE -p $tracee_pid 2> $LOG & 35 | 36 | while ! grep -F "Process $tracee_pid attached" $LOG > /dev/null; do 37 | kill -0 $! 2> /dev/null || 38 | { cat $LOG; cleanup; fail_ 'strace -p does not work'; } 39 | $SLEEP_A_BIT 40 | done 41 | 42 | kill -INT $! 43 | wait $! 44 | 45 | grep -F "Process $tracee_pid detached" $LOG > /dev/null || 46 | { cat $LOG; cleanup; fail_ 'strace -p failed to detach'; } 47 | 48 | if [ -f /proc/self/status ]; then 49 | $SLEEP_A_BIT 50 | test -d /proc/$tracee_pid || 51 | { cat $LOG; cleanup; fail_ 'tracee died after detach'; } 52 | grep '^State:.*R (running)' < /proc/$tracee_pid/status > /dev/null || { 53 | cat $LOG 54 | grep '^State:' < /proc/$tracee_pid/status 55 | cleanup 56 | fail_ 'tracee is not running after detach' 57 | } 58 | fi 59 | 60 | cleanup 61 | exit 0 62 | -------------------------------------------------------------------------------- /tests/dumpio.expected: -------------------------------------------------------------------------------- 1 | sendto(0, "zyxwvutsrqponmlkjihgfedcba", 26, MSG_DONTROUTE, NULL, 0) = 26 2 | | 00000 7a 79 78 77 76 75 74 73 72 71 70 6f 6e 6d 6c 6b zyxwvutsrqponmlk | 3 | | 00010 6a 69 68 67 66 65 64 63 62 61 jihgfedcba | 4 | recvfrom(0, "abcdefghijklmnopqrstuvwxyz", 26, MSG_WAITALL, NULL, NULL) = 26 5 | | 00000 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f 70 abcdefghijklmnop | 6 | | 00010 71 72 73 74 75 76 77 78 79 7a qrstuvwxyz | 7 | +++ exited with 0 +++ 8 | -------------------------------------------------------------------------------- /tests/dumpio.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check how dumpio works. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | dumpio_expected="${srcdir=.}/dumpio.expected" 8 | cat "$dumpio_expected" > /dev/null || 9 | fail_ "$dumpio_expected is not available" 10 | 11 | check_prog diff 12 | 13 | args='./unix-pair-send-recv abcdefghijklmnopqrstuvwxyz' 14 | $args || 15 | fail_ "$args failed" 16 | 17 | args="-esignal=none -esendto,recvfrom -eread=0 -ewrite=0 $args" 18 | $STRACE -o "$LOG" $args || { 19 | cat "$LOG" 20 | fail_ "$STRACE $args failed" 21 | } 22 | 23 | diff "$dumpio_expected" "$LOG" || 24 | fail_ "$STRACE $args failed to dump i/o properly" 25 | 26 | exit 0 27 | -------------------------------------------------------------------------------- /tests/fanotify_mark.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | # include "config.h" 3 | #endif 4 | 5 | #if defined HAVE_SYS_FANOTIFY_H && defined HAVE_FANOTIFY_MARK 6 | # include 7 | int 8 | main(void) 9 | { 10 | fanotify_mark(-1, FAN_MARK_ADD, FAN_MODIFY | FAN_ONDIR, -100, "."); 11 | return 0; 12 | } 13 | #else 14 | int 15 | main(void) 16 | { 17 | return 77; 18 | } 19 | #endif 20 | -------------------------------------------------------------------------------- /tests/fanotify_mark.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check fanotify_mark syscall decoding. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog grep 8 | 9 | ./fanotify_mark || { 10 | if [ $? -eq 77 ]; then 11 | framework_skip_ 'fanotify_mark is not available' 12 | else 13 | fail_ 'fanotify_mark failed' 14 | fi 15 | } 16 | 17 | args="-efanotify_mark ./fanotify_mark" 18 | $STRACE -o "$LOG" $args || { 19 | cat "$LOG" 20 | fail_ "$STRACE $args failed" 21 | } 22 | 23 | grep_log() 24 | { 25 | local syscall="$1"; shift 26 | 27 | LC_ALL=C grep -E -x "$syscall$*" $LOG > /dev/null || { 28 | cat $LOG 29 | fail_ "$STRACE $args failed to trace \"$syscall\" properly" 30 | } 31 | } 32 | 33 | grep_log fanotify_mark '\(-1, FAN_MARK_ADD, FAN_MODIFY\|FAN_ONDIR, AT_FDCWD, "\."\) += -1.*' 34 | 35 | exit 0 36 | -------------------------------------------------------------------------------- /tests/getdents.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check that getdents/getdents64 syscalls are traced properly. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog awk 8 | check_prog ls 9 | check_prog mkdir 10 | check_prog rm 11 | check_prog seq 12 | check_prog touch 13 | 14 | dir="$LOG.dir" 15 | mkdir -- "$dir" || 16 | framework_skip_ 'failed to create a directory' 17 | 18 | touch -- "$dir/$(for i in $(seq 1 127); do echo A; done; echo Z)" || 19 | framework_skip_ 'failed to create a file' 20 | 21 | ls -- "$dir" > /dev/null || { 22 | rm -rf -- "$dir" 23 | framework_skip_ 'failed to list a directory' 24 | } 25 | 26 | args='-vegetdents,getdents64' 27 | $STRACE -o "$LOG" $args ls -- "$dir" > /dev/null 28 | rc=$? 29 | rm -rf -- "$dir" 30 | [ $rc -eq 0 ] || { 31 | cat "$LOG" 32 | fail_ "strace $args failed" 33 | } 34 | 35 | awk -f "$srcdir"/getdents.awk "$LOG" || { 36 | cat "$LOG" 37 | fail_ "strace $args failed to trace getdents/getdents64 properly" 38 | } 39 | 40 | exit 0 41 | -------------------------------------------------------------------------------- /tests/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ME_="${0##*/}" 4 | 5 | warn_() { printf >&2 '%s\n' "$*"; } 6 | fail_() { warn_ "$ME_: failed test: $*"; exit 1; } 7 | skip_() { warn_ "$ME_: skipped test: $*"; exit 77; } 8 | framework_failure_() { warn_ "$ME_: framework failure: $*"; exit 99; } 9 | framework_skip_() { warn_ "$ME_: framework skip: $*"; exit 77; } 10 | 11 | check_prog() 12 | { 13 | type "$@" > /dev/null 2>&1 || 14 | framework_skip_ "$* is not available" 15 | } 16 | 17 | check_prog cat 18 | check_prog rm 19 | 20 | LOG="$ME_.tmp" 21 | rm -f "$LOG" 22 | 23 | : "${STRACE:=../strace}" 24 | : "${TIMEOUT_DURATION:=60}" 25 | : "${SLEEP_A_BIT:=sleep 1}" 26 | -------------------------------------------------------------------------------- /tests/ioctl.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | # include "config.h" 3 | #endif 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #ifdef HAVE_LINUX_MMTIMER_H 11 | # include 12 | #endif 13 | #ifdef HAVE_LINUX_HIDDEV_H 14 | # include 15 | #endif 16 | #ifdef HAVE_LINUX_INPUT_H 17 | # include 18 | #endif 19 | 20 | #if defined MMTIMER_GETRES \ 21 | && defined HIDIOCGVERSION \ 22 | && defined HIDIOCGPHYS \ 23 | && defined EVIOCGBIT \ 24 | && defined EV_KEY 25 | 26 | int 27 | main(void ) 28 | { 29 | struct termios tty; 30 | uint64_t data; 31 | 32 | if (ioctl(-1, TCGETS, &tty) != -1 || 33 | ioctl(-1, MMTIMER_GETRES, &data) != -1 || 34 | ioctl(-1, HIDIOCGVERSION, &data) != -1 || 35 | ioctl(-1, HIDIOCGPHYS(8), &data) != -1 || 36 | ioctl(-1, EVIOCGBIT(EV_KEY, 8), &data) != -1 || 37 | ioctl(-1, _IOR(0xde, 0xad, data), &data) != -1) 38 | return 77; 39 | 40 | return 0; 41 | } 42 | 43 | #else 44 | 45 | int 46 | main(void ) 47 | { 48 | return 77; 49 | } 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /tests/ioctl.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check ioctl syscall decoding. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog grep 8 | 9 | ./ioctl || { 10 | if [ $? -eq 77 ]; then 11 | framework_skip_ 'ioctl does not behave as expected' 12 | else 13 | fail_ 'ioctl failed' 14 | fi 15 | } 16 | 17 | args="-e ioctl ./ioctl" 18 | $STRACE -o "$LOG" $args || { 19 | cat "$LOG" 20 | fail_ "$STRACE $args failed" 21 | } 22 | 23 | grep_log() 24 | { 25 | local syscall="$1"; shift 26 | 27 | LC_ALL=C grep -E -x "$syscall$*" "$LOG" > /dev/null || { 28 | cat "$LOG" 29 | fail_ "$STRACE $args failed to trace \"$syscall\" properly" 30 | } 31 | } 32 | 33 | grep_log ioctl '\(-1, TCGETS, 0x[0-9a-f]+\) += -1 EBADF .*' 34 | grep_log ioctl '\(-1, MMTIMER_GETRES, 0x[0-9a-f]+\) += -1 EBADF .*' 35 | grep_log ioctl '\(-1, HIDIOCGRDESCSIZE or HIDIOCGVERSION, 0x[0-9a-f]+\) += -1 EBADF .*' 36 | grep_log ioctl '\(-1, HIDIOCGPHYS\(8\), 0x[0-9a-f]+\) += -1 EBADF .*' 37 | grep_log ioctl '\(-1, EVIOCGBIT\(EV_KEY, 8\), 0x[0-9a-f]+\) += -1 EBADF .*' 38 | grep_log ioctl '\(-1, _IOC\(_IOC_READ, 0xde, 0xad, 0x08\), 0x[0-9a-f]+\) += -1 EBADF .*' 39 | 40 | exit 0 41 | -------------------------------------------------------------------------------- /tests/ipc_msg.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int 6 | main(void) 7 | { 8 | int rc, id; 9 | struct msqid_ds ds; 10 | 11 | id = msgget(IPC_PRIVATE, 0600); 12 | if (id < 0) 13 | return 77; 14 | printf("msgget\\(IPC_PRIVATE, 0600\\) += %d\n", id); 15 | 16 | if (msgctl(id, IPC_STAT, &ds)) 17 | goto fail; 18 | printf("msgctl\\(%d, IPC_STAT, %p\\) += 0\n", id, &ds); 19 | 20 | int max = msgctl(0, MSG_INFO, &ds); 21 | if (max < 0) 22 | goto fail; 23 | printf("msgctl\\(0, MSG_INFO, %p\\) += %d\n", &ds, max); 24 | 25 | rc = msgctl(id, MSG_STAT, &ds); 26 | if (rc != id) { 27 | /* 28 | * In linux < v2.6.24-rc1 the first argument must be 29 | * an index in the kernel's internal array. 30 | */ 31 | if (-1 != rc || EINVAL != errno) 32 | goto fail; 33 | printf("msgctl\\(%d, MSG_STAT, %p\\) += -1 EINVAL \\(Invalid argument\\)\n", id, &ds); 34 | } else { 35 | printf("msgctl\\(%d, MSG_STAT, %p\\) += %d\n", id, &ds, id); 36 | } 37 | 38 | rc = 0; 39 | done: 40 | if (msgctl(id, IPC_RMID, 0) < 0) 41 | return 1; 42 | printf("msgctl\\(%d, IPC_RMID, 0\\) += 0\n", id); 43 | return rc; 44 | 45 | fail: 46 | rc = 1; 47 | goto done; 48 | } 49 | -------------------------------------------------------------------------------- /tests/ipc_msg.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check decoding of ipc msgget/msgctl syscalls 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog grep 8 | 9 | OUT="$LOG.out" 10 | 11 | ./ipc_msg > /dev/null || { 12 | if [ $? -eq 77 ]; then 13 | framework_skip_ 'ipc msgget/msgctl syscalls do not behave as expected' 14 | else 15 | fail_ 'ipc_msg failed' 16 | fi 17 | } 18 | 19 | args="-eipc ./ipc_msg $f" 20 | $STRACE -o "$LOG" $args > "$OUT" && 21 | LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || { 22 | cat "$OUT" "$LOG" 23 | fail_ "$STRACE $args output mismatch" 24 | } 25 | 26 | rm -f "$OUT" 27 | 28 | exit 0 29 | -------------------------------------------------------------------------------- /tests/ipc_sem.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int 6 | main(void) 7 | { 8 | int rc, id; 9 | struct semid_ds ds; 10 | struct seminfo info; 11 | 12 | id = semget(IPC_PRIVATE, 1, 0600); 13 | if (id < 0) 14 | return 77; 15 | printf("semget\\(IPC_PRIVATE, 1, 0600\\) += %d\n", id); 16 | 17 | if (semctl(id, 0, IPC_STAT, &ds)) 18 | goto fail; 19 | printf("semctl\\(%d, 0, IPC_STAT, %p\\) += 0\n", id, &ds); 20 | 21 | int max = semctl(0, 0, SEM_INFO, &info); 22 | if (max < 0) 23 | goto fail; 24 | printf("semctl\\(0, 0, SEM_INFO, %p\\) += %d\n", &info, max); 25 | 26 | rc = semctl(id, 0, SEM_STAT, &ds); 27 | if (rc != id) { 28 | /* 29 | * In linux < v2.6.24-rc1 the first argument must be 30 | * an index in the kernel's internal array. 31 | */ 32 | if (-1 != rc || EINVAL != errno) 33 | goto fail; 34 | printf("semctl\\(%d, 0, SEM_STAT, %p\\) += -1 EINVAL \\(Invalid argument\\)\n", id, &ds); 35 | } else { 36 | printf("semctl\\(%d, 0, SEM_STAT, %p\\) += %d\n", id, &ds, id); 37 | } 38 | 39 | rc = 0; 40 | done: 41 | if (semctl(id, 0, IPC_RMID, 0) < 0) 42 | return 1; 43 | printf("semctl\\(%d, 0, IPC_RMID, 0\\) += 0\n", id); 44 | return rc; 45 | 46 | fail: 47 | rc = 1; 48 | goto done; 49 | } 50 | -------------------------------------------------------------------------------- /tests/ipc_sem.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check decoding of ipc semget/semctl syscalls 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog grep 8 | 9 | OUT="$LOG.out" 10 | 11 | ./ipc_sem > /dev/null || { 12 | if [ $? -eq 77 ]; then 13 | framework_skip_ 'ipc semget/semctl syscalls do not behave as expected' 14 | else 15 | fail_ 'ipc_sem failed' 16 | fi 17 | } 18 | 19 | args="-eipc ./ipc_sem $f" 20 | $STRACE -o "$LOG" $args > "$OUT" && 21 | LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || { 22 | cat "$OUT" "$LOG" 23 | fail_ "$STRACE $args output mismatch" 24 | } 25 | 26 | rm -f "$OUT" 27 | 28 | exit 0 29 | -------------------------------------------------------------------------------- /tests/ipc_shm.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | int 6 | main(void) 7 | { 8 | int rc, id; 9 | struct shmid_ds ds; 10 | 11 | id = shmget(IPC_PRIVATE, 1, 0600); 12 | if (id < 0) 13 | return 77; 14 | printf("shmget\\(IPC_PRIVATE, 1, 0600\\) += %d\n", id); 15 | 16 | if (shmctl(id, IPC_STAT, &ds)) 17 | goto fail; 18 | printf("shmctl\\(%d, IPC_STAT, %p\\) += 0\n", id, &ds); 19 | 20 | int max = shmctl(0, SHM_INFO, &ds); 21 | if (max < 0) 22 | goto fail; 23 | printf("shmctl\\(0, SHM_INFO, %p\\) += %d\n", &ds, max); 24 | 25 | rc = shmctl(id, SHM_STAT, &ds); 26 | if (rc != id) { 27 | /* 28 | * In linux < v2.6.24-rc1 the first argument must be 29 | * an index in the kernel's internal array. 30 | */ 31 | if (-1 != rc || EINVAL != errno) 32 | goto fail; 33 | printf("shmctl\\(%d, SHM_STAT, %p\\) += -1 EINVAL \\(Invalid argument\\)\n", id, &ds); 34 | } else { 35 | printf("shmctl\\(%d, SHM_STAT, %p\\) += %d\n", id, &ds, id); 36 | } 37 | 38 | rc = 0; 39 | done: 40 | if (shmctl(id, IPC_RMID, 0) < 0) 41 | return 1; 42 | printf("shmctl\\(%d, IPC_RMID, 0\\) += 0\n", id); 43 | return rc; 44 | 45 | fail: 46 | rc = 1; 47 | goto done; 48 | } 49 | -------------------------------------------------------------------------------- /tests/ipc_shm.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check decoding of ipc shmget/shmctl syscalls 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog grep 8 | 9 | OUT="$LOG.out" 10 | 11 | ./ipc_shm > /dev/null || { 12 | if [ $? -eq 77 ]; then 13 | framework_skip_ 'ipc shmget/shmctl syscalls do not behave as expected' 14 | else 15 | fail_ 'ipc_shm failed' 16 | fi 17 | } 18 | 19 | args="-eipc ./ipc_shm $f" 20 | $STRACE -o "$LOG" $args > "$OUT" && 21 | LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || { 22 | cat "$OUT" "$LOG" 23 | fail_ "$STRACE $args output mismatch" 24 | } 25 | 26 | rm -f "$OUT" 27 | 28 | exit 0 29 | -------------------------------------------------------------------------------- /tests/mmsg.expected: -------------------------------------------------------------------------------- 1 | sendmmsg(1, {{{msg_name(0)=NULL, msg_iov(2)=[{"one", 3}, {"two", 3}], msg_controllen=0, msg_flags=0}, 6}, {{msg_name(0)=NULL, msg_iov(1)=[{"three", 5}], msg_controllen=0, msg_flags=0}, 5}}, 2, 0) = 2 2 | = 2 buffers in vector 0 3 | * 3 bytes in buffer 0 4 | | 00000 6f 6e 65 one | 5 | * 3 bytes in buffer 1 6 | | 00000 74 77 6f two | 7 | = 1 buffers in vector 1 8 | * 5 bytes in buffer 0 9 | | 00000 74 68 72 65 65 three | 10 | recvmmsg(0, {{{msg_name(0)=NULL, msg_iov(2)=[{"one", 3}, {"two", 3}], msg_controllen=0, msg_flags=0}, 6}, {{msg_name(0)=NULL, msg_iov(1)=[{"three", 5}], msg_controllen=0, msg_flags=0}, 5}}, 2, 0, NULL) = 2 (left NULL) 11 | = 2 buffers in vector 0 12 | * 3 bytes in buffer 0 13 | | 00000 6f 6e 65 one | 14 | * 3 bytes in buffer 1 15 | | 00000 74 77 6f two | 16 | = 1 buffers in vector 1 17 | * 5 bytes in buffer 0 18 | | 00000 74 68 72 65 65 three | 19 | +++ exited with 0 +++ 20 | -------------------------------------------------------------------------------- /tests/mmsg.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check how iovecs in struct mmsghdr are decoded. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | mmsg_expected="${srcdir=.}/mmsg.expected" 8 | 9 | check_prog diff 10 | 11 | cat "$mmsg_expected" > /dev/null || 12 | fail_ "$mmsg_expected is not available" 13 | 14 | ./mmsg || { 15 | if [ $? -eq 77 ]; then 16 | framework_skip_ 'sendmmsg/recvmmsg syscalls are not available' 17 | else 18 | fail_ 'mmsg failed' 19 | fi 20 | } 21 | 22 | args="-e trace=recvmmsg,sendmmsg -e read=0 -e write=1 -o $LOG ./mmsg" 23 | $STRACE $args || { 24 | cat $LOG 25 | fail_ "$STRACE $args failed" 26 | } 27 | 28 | diff "$mmsg_expected" $LOG || 29 | fail_ "$STRACE $args failed to decode mmsghdr properly" 30 | 31 | exit 0 32 | -------------------------------------------------------------------------------- /tests/net.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check how network syscalls are traced. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog grep 8 | 9 | rm -f $LOG.* 10 | 11 | addr=net-local-stream 12 | ./net-accept-connect $addr || 13 | fail_ 'net-accept-connect failed' 14 | 15 | args="-tt -ff -enetwork ./net-accept-connect $addr" 16 | $STRACE -o "$LOG" $args || 17 | fail_ "$STRACE $args failed" 18 | 19 | "$srcdir"/../strace-log-merge $LOG > $LOG || { 20 | cat $LOG 21 | fail_ 'strace-log-merge failed' 22 | } 23 | 24 | rm -f $LOG.* 25 | 26 | grep_log() 27 | { 28 | local syscall="$1"; shift 29 | local prefix='[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +' 30 | 31 | LC_ALL=C grep -E -x "$prefix$syscall$*" $LOG > /dev/null || { 32 | cat $LOG 33 | fail_ "strace -enetwork failed to trace \"$syscall\" properly" 34 | } 35 | } 36 | 37 | grep_log socket '\(PF_(LOCAL|UNIX|FILE), SOCK_STREAM, 0\) += 0' 38 | grep_log socket '\(PF_(LOCAL|UNIX|FILE), SOCK_STREAM, 0\) += 1' 39 | grep_log bind '\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="'$addr'"\}, 19\) += 0' 40 | grep_log listen '\(0, 5\) += 0' 41 | grep_log getsockname '\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="'$addr'"\}, \[19\]\) += 0' 42 | grep_log accept '\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), NULL\}, \[2\]\) += 1' 43 | grep_log connect '\(1, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="'$addr'"\}, 19\) += 0' 44 | 45 | exit 0 46 | -------------------------------------------------------------------------------- /tests/ptrace_setoptions.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Ensure that strace tests kernel PTRACE_O_TRACECLONE 4 | # and PTRACE_O_TRACESYSGOOD support properly. 5 | 6 | . "${srcdir=.}/init.sh" 7 | 8 | check_prog grep 9 | 10 | [ "$(uname -s)" = Linux ] || 11 | skip_ 'The kernel is not a Linux kernel' 12 | case "$(uname -r)" in 13 | 2.[6-9]*|2.[1-5][0-9]*|[3-9].*|[12][0-9]*) ;; 14 | *) skip_ 'The kernel is not Linux 2.6.* or newer' ;; 15 | esac 16 | 17 | $STRACE -df -enone / > /dev/null 2> $LOG 18 | grep -F -x 'ptrace_setoptions = 0xe' $LOG > /dev/null || { 19 | cat $LOG 20 | fail_ 'strace -f failed to recognize proper kernel PTRACE_O_TRACECLONE support' 21 | } 22 | 23 | grep -F -x 'ptrace_setoptions = 0x1f' $LOG > /dev/null || { 24 | cat $LOG 25 | fail_ 'strace -f failed to recognize proper kernel PTRACE_O_TRACESYSGOOD support' 26 | } 27 | 28 | $STRACE -d -enone / > /dev/null 2> $LOG 29 | grep -F -x 'ptrace_setoptions = 0x11' $LOG > /dev/null || { 30 | cat $LOG 31 | fail_ 'strace failed to recognize proper kernel PTRACE_O_TRACESYSGOOD support' 32 | } 33 | -------------------------------------------------------------------------------- /tests/qual_syscall.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Ensure that strace -e trace=set works. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog ls 8 | check_prog grep 9 | 10 | $STRACE -e execve ls > /dev/null 2> $LOG && 11 | grep '^execve(' $LOG > /dev/null || 12 | { cat $LOG; fail_ 'strace -e execve does not work'; } 13 | 14 | grep -v '^execve(' $LOG | 15 | LC_ALL=C grep '^[[:alnum:]_]*(' > /dev/null && 16 | { cat $LOG; fail_ 'strace -e execve does not work properly'; } 17 | 18 | $STRACE -e trace=process ls > /dev/null 2> $LOG && 19 | grep '^execve(' $LOG > /dev/null || 20 | { cat $LOG; fail_ 'strace -e trace=process does not work'; } 21 | 22 | grep '^open' $LOG > /dev/null && 23 | { cat $LOG; fail_ 'strace -e trace=process does not work properly'; } 24 | 25 | exit 0 26 | -------------------------------------------------------------------------------- /tests/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . "${srcdir=.}/init.sh" 4 | 5 | $STRACE -V > /dev/null || 6 | framework_failure_ "$STRACE is not available" 7 | 8 | TIMEOUT="timeout -s 9 $TIMEOUT_DURATION" 9 | $TIMEOUT true > /dev/null 2>&1 || 10 | TIMEOUT= 11 | 12 | exec $TIMEOUT "$@" 13 | -------------------------------------------------------------------------------- /tests/select.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | r[1] = "^select\\(2, \\[0 1\\], \\[0 1\\], \\[0 1\\], NULL\\) += 1 \\(\\)$" 3 | r[2] = "^select\\(-1, NULL, 0x[0-9a-f]+, NULL, NULL\\) += -1 " 4 | r[3] = "^select\\(1025, \\[0\\], \\[\\], NULL, \\{0, 100\\}\\) += 0 \\(Timeout\\)$" 5 | r[4] = "^\\+\\+\\+ exited with 0 \\+\\+\\+$" 6 | lines = 4 7 | fail = 0 8 | } 9 | 10 | NR > lines { exit 1 } 11 | 12 | { 13 | if (match($0, r[NR])) 14 | next 15 | 16 | print "Line " NR " does not match." 17 | fail = 1 18 | } 19 | 20 | END { 21 | if (fail == 0 && NR != lines) { 22 | fail = 1 23 | print "Expected " lines " lines, found " NR " line(s)." 24 | } 25 | exit fail 26 | } 27 | -------------------------------------------------------------------------------- /tests/select.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Based on test by Dr. David Alan Gilbert 3 | */ 4 | #include 5 | #include 6 | #include 7 | 8 | static fd_set set[0x1000000 / sizeof(fd_set)]; 9 | 10 | int main() 11 | { 12 | int fds[2]; 13 | struct timeval timeout = { .tv_sec = 0, .tv_usec = 100 }; 14 | 15 | (void) close(0); 16 | (void) close(1); 17 | assert(pipe(fds) == 0); 18 | 19 | /* 20 | * Start with a nice simple select. 21 | */ 22 | FD_ZERO(set); 23 | FD_SET(0, set); 24 | FD_SET(1, set); 25 | assert(select(2, set, set, set, NULL) == 1); 26 | 27 | /* 28 | * Now the crash case that trinity found, negative nfds 29 | * but with a pointer to a large chunk of valid memory. 30 | */ 31 | FD_ZERO(set); 32 | FD_SET(1,set); 33 | assert(select(-1, NULL, set, NULL, NULL) == -1); 34 | 35 | /* 36 | * Another variant, with nfds exceeding FD_SETSIZE limit. 37 | */ 38 | FD_ZERO(set); 39 | FD_SET(0,set); 40 | assert(select(FD_SETSIZE + 1, set, set + 1, NULL, &timeout) == 0); 41 | 42 | return 0; 43 | } 44 | -------------------------------------------------------------------------------- /tests/select.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check select syscall decoding. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog awk 8 | 9 | ./select || 10 | framework_skip_ 'select syscall does not behave as expected' 11 | 12 | args="-eselect ./select" 13 | $STRACE -o "$LOG" $args || { 14 | cat "$LOG" 15 | fail_ "$STRACE $args failed" 16 | } 17 | 18 | awk -f "$srcdir"/select.awk "$LOG" || { 19 | cat "$LOG" 20 | fail_ 'unexpected output' 21 | } 22 | 23 | exit 0 24 | -------------------------------------------------------------------------------- /tests/set_ptracer_any.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | # include "config.h" 3 | #endif 4 | #include 5 | #include 6 | #ifdef HAVE_PRCTL 7 | # include 8 | #endif 9 | 10 | int main(int argc, char **argv) 11 | { 12 | if (argc < 2) 13 | return 99; 14 | #if defined HAVE_PRCTL && defined PR_SET_PTRACER && defined PR_SET_PTRACER_ANY 15 | /* Turn off restrictions on tracing if applicable. If the options 16 | * aren't available on this system, that's OK too. */ 17 | (void) prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY); 18 | #endif 19 | if (write(1, "\n", 1) != 1) { 20 | perror("write"); 21 | return 99; 22 | } 23 | (void) execvp(argv[1], argv + 1); 24 | perror(argv[1]); 25 | return 99; 26 | } 27 | -------------------------------------------------------------------------------- /tests/sigaction.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | static void handle_signal(int no) 7 | { 8 | _exit(128 + no); 9 | } 10 | 11 | int 12 | main(void) 13 | { 14 | struct sigaction sa, sa0; 15 | 16 | sa.sa_handler = SIG_IGN; 17 | sigemptyset(&sa.sa_mask); 18 | sigaddset(&sa.sa_mask, SIGHUP); 19 | sigaddset(&sa.sa_mask, SIGINT); 20 | sa.sa_flags = SA_RESTART; 21 | assert(!sigaction(SIGUSR2, &sa, &sa0)); 22 | 23 | sa.sa_handler = handle_signal; 24 | sigemptyset(&sa.sa_mask); 25 | sigaddset(&sa.sa_mask, SIGQUIT); 26 | sigaddset(&sa.sa_mask, SIGTERM); 27 | sa.sa_flags = SA_SIGINFO; 28 | assert(!sigaction(SIGUSR2, &sa, &sa0)); 29 | 30 | sa.sa_handler = SIG_DFL; 31 | sigemptyset(&sa.sa_mask); 32 | sa.sa_flags = 0; 33 | assert(!sigaction(SIGUSR2, &sa, &sa0)); 34 | 35 | sigfillset(&sa.sa_mask); 36 | sigdelset(&sa.sa_mask, SIGHUP); 37 | assert(!sigaction(SIGUSR2, &sa, &sa0)); 38 | 39 | return 0; 40 | } 41 | -------------------------------------------------------------------------------- /tests/sigaction.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check rt_sigaction decoding. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog awk 8 | 9 | ./sigaction || 10 | fail_ 'sigaction failed' 11 | 12 | args="-o $LOG -ert_sigaction ./sigaction" 13 | $STRACE $args || 14 | fail_ "strace $args failed" 15 | 16 | awk -f "$srcdir"/sigaction.awk $LOG || 17 | { cat $LOG; fail_ 'unexpected output'; } 18 | 19 | exit 0 20 | -------------------------------------------------------------------------------- /tests/stack-fcall-0.c: -------------------------------------------------------------------------------- 1 | int f1(int i); 2 | 3 | int f0(int i) 4 | { 5 | return f1(i) - i; 6 | } 7 | -------------------------------------------------------------------------------- /tests/stack-fcall-1.c: -------------------------------------------------------------------------------- 1 | int f2(int i); 2 | 3 | int f1(int i) 4 | { 5 | return f2(i) + i; 6 | } 7 | -------------------------------------------------------------------------------- /tests/stack-fcall-2.c: -------------------------------------------------------------------------------- 1 | int f3(int i); 2 | 3 | int f2(int i) 4 | { 5 | return f3(i) - i; 6 | } 7 | -------------------------------------------------------------------------------- /tests/stack-fcall-3.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int f3(int i) 4 | { 5 | return getpid() + i; 6 | } 7 | -------------------------------------------------------------------------------- /tests/stack-fcall.c: -------------------------------------------------------------------------------- 1 | int f0(int i); 2 | 3 | int main(int argc, char** argv) 4 | { 5 | f0(argc); 6 | return 0; 7 | } 8 | -------------------------------------------------------------------------------- /tests/stat32-v.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check verbose decoding of 32-bit stat syscall. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog dd 8 | check_prog grep 9 | check_prog touch 10 | 11 | OUT="$LOG.out" 12 | size=233811181 13 | sample=stat32_sample 14 | 15 | umask 022 16 | truncate_cmd="dd seek=$size bs=1 count=0 if=/dev/null of=$sample" 17 | $truncate_cmd > "$OUT" 2>&1 || { 18 | cat "$OUT" 19 | framework_skip_ 'failed to create a large sparse file' 20 | } 21 | 22 | ./stat32 $sample > /dev/null || { 23 | if [ $? -eq 77 ]; then 24 | rm -f $sample "$OUT" 25 | framework_skip_ '32-bit stat syscall is not available' 26 | else 27 | fail_ 'stat32 failed' 28 | fi 29 | } 30 | 31 | touch -t 0102030405 $sample 32 | 33 | for f in $sample . /dev/null; do 34 | args="-v -efile ./stat32 $f" 35 | $STRACE -o "$LOG" $args > "$OUT" && 36 | LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || { 37 | cat "$OUT" "$LOG" 38 | fail_ "$STRACE $args output mismatch" 39 | } 40 | done 41 | 42 | rm -f $sample "$OUT" 43 | 44 | exit 0 45 | -------------------------------------------------------------------------------- /tests/stat32.c: -------------------------------------------------------------------------------- 1 | #include "stat.c" 2 | -------------------------------------------------------------------------------- /tests/stat64-v.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check verbose decoding of 64-bit stat syscall. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog dd 8 | check_prog grep 9 | check_prog touch 10 | 11 | OUT="$LOG.out" 12 | size=46118400000 13 | sample=stat64_sample 14 | 15 | umask 022 16 | truncate_cmd="dd seek=$size bs=1 count=0 if=/dev/null of=$sample" 17 | $truncate_cmd > "$OUT" 2>&1 || { 18 | cat "$OUT" 19 | framework_skip_ 'failed to create a large sparse file' 20 | } 21 | 22 | ./stat $sample > /dev/null || 23 | fail_ 'stat failed' 24 | 25 | touch -d '1970-01-01 36028797018963968 seconds' $sample || 26 | touch -t 0102030405 $sample 27 | 28 | for f in $sample . /dev/null; do 29 | args="-v -efile ./stat $f" 30 | $STRACE -o "$LOG" $args > "$OUT" && 31 | LC_ALL=C grep -E -x -f "$OUT" "$LOG" > /dev/null || { 32 | cat "$OUT" "$LOG" 33 | fail_ "$STRACE $args output mismatch" 34 | } 35 | done 36 | 37 | rm -f $sample "$OUT" 38 | 39 | exit 0 40 | -------------------------------------------------------------------------------- /tests/statfs.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | # include "config.h" 3 | #endif 4 | #include 5 | #include 6 | 7 | int 8 | main(void) 9 | { 10 | struct statfs stb; 11 | assert(statfs("/proc/self/status", &stb) == 0); 12 | return 0; 13 | } 14 | -------------------------------------------------------------------------------- /tests/statfs.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check how statfs/statfs64 syscalls are traced. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog grep 8 | 9 | # this test probes /proc/self/status 10 | [ -f /proc/self/status ] || 11 | framework_skip_ '/proc/self/status is not available' 12 | 13 | ./statfs || 14 | fail_ 'statfs failed' 15 | 16 | args="-efile ./statfs" 17 | $STRACE $args > $LOG 2>&1 || { 18 | cat $LOG 19 | fail_ "$STRACE $args failed" 20 | } 21 | 22 | grep_log() 23 | { 24 | local syscall="$1"; shift 25 | 26 | LC_ALL=C grep -E -x "$syscall$*" $LOG > /dev/null || { 27 | cat $LOG 28 | fail_ "$STRACE $args failed to trace \"$syscall\" properly" 29 | } 30 | } 31 | 32 | grep_log 'statfs(64)?' '\("/proc/self/status"(, [1-9][0-9]*)?, \{f_type="PROC_SUPER_MAGIC", f_bsize=[1-9][0-9]*, f_blocks=[0-9]+, f_bfree=[0-9]+, f_bavail=[0-9]+, f_files=[0-9]+, f_ffree=[0-9]+, f_fsid=\{[0-9]+, [0-9]+\}, f_namelen=[1-9][0-9]*(, f_frsize=[0-9]+)?(, f_flags=[0-9]+)?\}\) += 0' 33 | 34 | exit 0 35 | -------------------------------------------------------------------------------- /tests/strace-f.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Ensure that strace -f works. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | time=/usr/bin/time 8 | check_prog $time 9 | 10 | $STRACE -f $time /bin/ls > $LOG 2>&1 || 11 | { cat $LOG; fail_ 'strace -f does not work'; } 12 | -------------------------------------------------------------------------------- /tests/strace-k.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Ensure that strace -k works. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | # strace -k is implemented using /proc/$pid/maps 8 | [ -f /proc/self/maps ] || 9 | framework_skip_ '/proc/self/maps is not available' 10 | 11 | check_prog sed 12 | check_prog tr 13 | 14 | ./stack-fcall || 15 | fail_ 'stack-fcall failed' 16 | 17 | $STRACE -h | grep '^-k' > /dev/null || 18 | skip_ 'strace -k is not available' 19 | 20 | args="-e getpid -k ./stack-fcall" 21 | $STRACE $args > $LOG 2>&1 || { 22 | cat $LOG 23 | fail_ "$STRACE $args failed" 24 | } 25 | 26 | expected='getpid f3 f2 f1 f0 main ' 27 | result=$(sed -n '1,/(main+0x[a-f0-9]\+) .*/ s/^.*(\([^+]\+\)+0x[a-f0-9]\+) .*/\1/p' $LOG | 28 | tr '\n' ' ') 29 | 30 | test "$result" = "$expected" || { 31 | cat $LOG 32 | echo "expected: \"$expected\"" 33 | echo "result: \"$result\"" 34 | fail_ "unexpected output from $STRACE $args" 35 | } 36 | 37 | exit 0 38 | -------------------------------------------------------------------------------- /tests/sun_path.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check how long sun_path addresses are traced. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog grep 8 | 9 | rm -f $LOG.* 10 | 11 | addr=123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678 12 | ./net-accept-connect $addr || 13 | fail_ 'net-accept-connect failed' 14 | 15 | args="-tt -ff -ebind,connect,getsockname ./net-accept-connect $addr" 16 | $STRACE -o "$LOG" $args || 17 | fail_ "$STRACE $args failed" 18 | 19 | "$srcdir"/../strace-log-merge $LOG > $LOG || { 20 | cat $LOG 21 | fail_ 'strace-log-merge failed' 22 | } 23 | 24 | rm -f $LOG.* 25 | 26 | grep_log() 27 | { 28 | local syscall="$1"; shift 29 | local prefix='[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +' 30 | 31 | LC_ALL=C grep -E -x "$prefix$syscall$*" $LOG > /dev/null || { 32 | cat $LOG 33 | fail_ "strace -enetwork failed to trace \"$syscall\" properly" 34 | } 35 | } 36 | 37 | grep_log bind '\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="'$addr'"\}, 110\) += 0' 38 | grep_log getsockname '\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="'$addr'"\}, \[111\]\) += 0' 39 | grep_log connect '\(1, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="'$addr'"\}, 110\) += 0' 40 | 41 | exit 0 42 | -------------------------------------------------------------------------------- /tests/uid.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | # include "config.h" 3 | #endif 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int 10 | main(void) 11 | { 12 | #if defined(__NR_getuid) \ 13 | && defined(__NR_setuid) \ 14 | && defined(__NR_getresuid) \ 15 | && defined(__NR_setreuid) \ 16 | && defined(__NR_setresuid) \ 17 | && defined(__NR_chown) \ 18 | && defined(__NR_getgroups) 19 | int r, e, s; 20 | int size; 21 | int *list = 0; 22 | 23 | e = syscall(__NR_getuid); 24 | assert(syscall(__NR_setuid, e) == 0); 25 | assert(syscall(__NR_getresuid, &r, &e, &s) == 0); 26 | assert(syscall(__NR_setreuid, -1, -1L) == 0); 27 | assert(syscall(__NR_setresuid, -1, e, -1L) == 0); 28 | assert(syscall(__NR_chown, ".", -1, -1L) == 0); 29 | assert((size = syscall(__NR_getgroups, 0, list)) >= 0); 30 | assert(list = calloc(size + 1, sizeof(*list))); 31 | assert(syscall(__NR_getgroups, size, list) == size); 32 | return 0; 33 | #else 34 | return 77; 35 | #endif 36 | } 37 | -------------------------------------------------------------------------------- /tests/uid.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check uid decoding. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog gawk 8 | 9 | s="${uid_syscall_suffix-}" 10 | w="${uid_t_size-}" 11 | uid="uid$s$w" 12 | ./"$uid" || { 13 | if [ $? -eq 77 ]; then 14 | framework_skip_ "some uid$s or uid${w}_t syscalls are not available" 15 | else 16 | fail_ "$uid failed" 17 | fi 18 | } 19 | 20 | syscalls="getuid$s,setuid$s,getresuid$s,setreuid$s,setresuid$s,chown$s,getgroups$s" 21 | args="-e trace=$syscalls" 22 | $STRACE -o "$LOG" $args ./"$uid"|| { 23 | cat "$LOG" 24 | fail_ "$STRACE $args ./$uid failed" 25 | } 26 | 27 | gawk -f "$srcdir"/uid.awk -v suffix="$s" "$LOG" || { 28 | cat "$LOG" 29 | fail_ 'unexpected output' 30 | } 31 | 32 | exit 0 33 | -------------------------------------------------------------------------------- /tests/uid16.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check uid16_t decoding. 4 | 5 | uid_t_size=16 6 | 7 | . "${srcdir=.}/uid.test" 8 | -------------------------------------------------------------------------------- /tests/uid32.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | # include "config.h" 3 | #endif 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int 10 | main(void) 11 | { 12 | #if defined(__NR_getuid32) \ 13 | && defined(__NR_setuid32) \ 14 | && defined(__NR_getresuid32) \ 15 | && defined(__NR_setreuid32) \ 16 | && defined(__NR_setresuid32) \ 17 | && defined(__NR_chown32) \ 18 | && defined(__NR_getgroups32) 19 | int r, e, s; 20 | int size; 21 | int *list = 0; 22 | 23 | e = syscall(__NR_getuid32); 24 | assert(syscall(__NR_setuid32, e) == 0); 25 | assert(syscall(__NR_getresuid32, &r, &e, &s) == 0); 26 | assert(syscall(__NR_setreuid32, -1, -1L) == 0); 27 | assert(syscall(__NR_setresuid32, -1, e, -1L) == 0); 28 | assert(syscall(__NR_chown32, ".", -1, -1L) == 0); 29 | assert((size = syscall(__NR_getgroups32, 0, list)) >= 0); 30 | assert(list = calloc(size + 1, sizeof(*list))); 31 | assert(syscall(__NR_getgroups32, size, list) == size); 32 | return 0; 33 | #else 34 | return 77; 35 | #endif 36 | } 37 | -------------------------------------------------------------------------------- /tests/uid32.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check uid32 decoding. 4 | 5 | uid_syscall_suffix=32 6 | 7 | . "${srcdir=.}/uid.test" 8 | -------------------------------------------------------------------------------- /tests/uio.c: -------------------------------------------------------------------------------- 1 | #ifdef HAVE_CONFIG_H 2 | # include "config.h" 3 | #endif 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | int 10 | main(void) 11 | { 12 | #if defined(HAVE_PREADV) && defined(HAVE_PWRITEV) 13 | const off_t offset = 0xdefaceddeadbeefLL; 14 | int fd; 15 | char buf[4]; 16 | struct iovec iov = { buf, sizeof buf }; 17 | 18 | assert((fd = open("/dev/zero", O_RDONLY)) >= 0); 19 | assert(pread(fd, buf, sizeof buf, offset) == 4); 20 | assert(preadv(fd, &iov, 1, offset) == 4); 21 | assert(!close(fd)); 22 | 23 | assert((fd = open("/dev/null", O_WRONLY)) >= 0); 24 | assert(pwrite(fd, buf, sizeof buf, offset) == 4); 25 | assert(pwritev(fd, &iov, 1, offset) == 4); 26 | assert(!close(fd)); 27 | 28 | return 0; 29 | #else 30 | return 77; 31 | #endif 32 | } 33 | -------------------------------------------------------------------------------- /tests/uio.test: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Check how pread/pwrite and preadv/pwritev syscalls are traced. 4 | 5 | . "${srcdir=.}/init.sh" 6 | 7 | check_prog grep 8 | 9 | ./uio || { 10 | if [ $? -eq 77 ]; then 11 | framework_skip_ 'preadv/pwritev syscalls are not available' 12 | else 13 | fail_ 'uio failed' 14 | fi 15 | } 16 | 17 | args="-edesc ./uio" 18 | $STRACE $args > $LOG 2>&1 || { 19 | cat $LOG 20 | fail_ "$STRACE $args failed" 21 | } 22 | 23 | grep_log() 24 | { 25 | local syscall="$1"; shift 26 | 27 | LC_ALL=C grep -E -x "$syscall$*" $LOG > /dev/null || { 28 | cat $LOG 29 | fail_ "$STRACE $args failed to trace \"$syscall\" properly" 30 | } 31 | } 32 | 33 | grep_log 'pread(64)?' '\(3, "\\0\\0\\0\\0", 4, 1004211379570065135\) += 4' 34 | grep_log 'preadv' '\(3, \[{"\\0\\0\\0\\0", 4}\], 1, 1004211379570065135\) += 4' 35 | grep_log 'pwrite(64)?' '\(3, "\\0\\0\\0\\0", 4, 1004211379570065135\) += 4' 36 | grep_log 'pwritev' '\(3, \[{"\\0\\0\\0\\0", 4}\], 1, 1004211379570065135\) += 4' 37 | 38 | exit 0 39 | -------------------------------------------------------------------------------- /tests/unix-pair-send-recv.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | static void 8 | transpose(char *str, int len) 9 | { 10 | int i; 11 | 12 | for (i = 0; i < len / 2; ++i) { 13 | char c = str[i]; 14 | str[i] = str[len - 1 - i]; 15 | str[len - 1 - i] = c; 16 | } 17 | } 18 | 19 | int 20 | main(int ac, char **av) 21 | { 22 | assert(ac == 2); 23 | const int len = strlen(av[1]); 24 | assert(len); 25 | 26 | (void) close(0); 27 | (void) close(1); 28 | 29 | int sv[2]; 30 | assert(socketpair(AF_UNIX, SOCK_STREAM, 0, sv) == 0); 31 | assert(sv[0] == 0); 32 | assert(sv[1] == 1); 33 | 34 | pid_t pid = fork(); 35 | assert(pid >= 0); 36 | 37 | if (pid) { 38 | assert(close(1) == 0); 39 | transpose(av[1], len); 40 | assert(sendto(0, av[1], len, MSG_DONTROUTE, NULL, 0) == len); 41 | assert(recvfrom(0, av[1], len, MSG_WAITALL, NULL, NULL) == len); 42 | assert(close(0) == 0); 43 | 44 | int status; 45 | assert(waitpid(pid, &status, 0) == pid); 46 | assert(status == 0); 47 | } else { 48 | assert(close(0) == 0); 49 | assert(recvfrom(1, av[1], len, MSG_WAITALL, NULL, NULL) == len); 50 | transpose(av[1], len); 51 | assert(sendto(1, av[1], len, MSG_DONTROUTE, NULL, 0) == len); 52 | assert(recvfrom(1, av[1], len, MSG_WAITALL, NULL, NULL) == 0); 53 | assert(close(1) == 0); 54 | } 55 | 56 | return 0; 57 | } 58 | -------------------------------------------------------------------------------- /tests/unix-yy-connect.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | lines = 5 3 | fail = 0 4 | addrlen = length(addr) + 3 5 | 6 | r_i = "[1-9][0-9]*" 7 | r_close_listen = "^close\\(0\\) += 0$" 8 | r_connect = "^connect\\(1, \\{sa_family=AF_(LOCAL|UNIX|FILE), sun_path=\"" addr "\"\\}, " addrlen "\\) += 0$" 9 | } 10 | 11 | NR == 1 && /^socket\(PF_(LOCAL|UNIX|FILE), SOCK_STREAM, 0\) += 1$/ {next} 12 | 13 | NR == 2 {if (match($0, r_close_listen)) next} 14 | 15 | NR == 3 { 16 | if (match($0, r_connect, a)) { 17 | inode = a[1] 18 | r_close_connected = "^close\\(1" r_i "\\]>\\) += 0$" 19 | next 20 | } 21 | } 22 | 23 | NR == 4 { 24 | if (inode != "" && r_close_connected != "" && match($0, r_close_connected, a) && a[1] == inode) { 25 | next 26 | } 27 | } 28 | 29 | NR == lines && $0 == "+++ exited with 0 +++" {next} 30 | 31 | { 32 | print "Line " NR " does not match: " $0 33 | fail=1 34 | } 35 | 36 | END { 37 | if (NR != lines) { 38 | print "Expected " lines " lines, found " NR " line(s)." 39 | print "" 40 | exit 1 41 | } 42 | if (fail) { 43 | print "" 44 | exit 1 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /truncate.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | int 4 | sys_truncate(struct tcb *tcp) 5 | { 6 | if (entering(tcp)) { 7 | printpath(tcp, tcp->u_arg[0]); 8 | tprintf(", %lu", tcp->u_arg[1]); 9 | } 10 | return 0; 11 | } 12 | 13 | int 14 | sys_truncate64(struct tcb *tcp) 15 | { 16 | if (entering(tcp)) { 17 | printpath(tcp, tcp->u_arg[0]); 18 | printllval(tcp, ", %llu", 1); 19 | } 20 | return 0; 21 | } 22 | 23 | int 24 | sys_ftruncate(struct tcb *tcp) 25 | { 26 | if (entering(tcp)) { 27 | printfd(tcp, tcp->u_arg[0]); 28 | tprintf(", %lu", tcp->u_arg[1]); 29 | } 30 | return 0; 31 | } 32 | 33 | int 34 | sys_ftruncate64(struct tcb *tcp) 35 | { 36 | if (entering(tcp)) { 37 | printfd(tcp, tcp->u_arg[0]); 38 | printllval(tcp, ", %llu", 1); 39 | } 40 | return 0; 41 | } 42 | -------------------------------------------------------------------------------- /uid16.c: -------------------------------------------------------------------------------- 1 | #define STRACE_UID_SIZE 16 2 | #include "uid.c" 3 | -------------------------------------------------------------------------------- /umask.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | int 4 | sys_umask(struct tcb *tcp) 5 | { 6 | if (entering(tcp)) { 7 | tprintf("%#lo", tcp->u_arg[0]); 8 | } 9 | return RVAL_OCTAL; 10 | } 11 | -------------------------------------------------------------------------------- /umount.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | #define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ 4 | #define MNT_DETACH 0x00000002 /* Just detach from the tree */ 5 | #define MNT_EXPIRE 0x00000004 /* Mark for expiry */ 6 | 7 | #include "xlat/umount_flags.h" 8 | 9 | int 10 | sys_umount2(struct tcb *tcp) 11 | { 12 | if (entering(tcp)) { 13 | printstr(tcp, tcp->u_arg[0], -1); 14 | tprints(", "); 15 | printflags(umount_flags, tcp->u_arg[1], "MNT_???"); 16 | } 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /uname.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | #include 4 | 5 | int 6 | sys_uname(struct tcb *tcp) 7 | { 8 | struct utsname uname; 9 | 10 | if (entering(tcp)) 11 | return 0; 12 | 13 | if (syserror(tcp) || !verbose(tcp)) 14 | tprintf("%#lx", tcp->u_arg[0]); 15 | else if (umove(tcp, tcp->u_arg[0], &uname) < 0) 16 | tprints("{...}"); 17 | else { 18 | #define PRINT_UTS_MEMBER(prefix, member) \ 19 | tprints(prefix #member "="); \ 20 | print_quoted_string(uname.member, sizeof(uname.member), \ 21 | QUOTE_0_TERMINATED) 22 | 23 | PRINT_UTS_MEMBER("{", sysname); 24 | PRINT_UTS_MEMBER(", ", nodename); 25 | if (abbrev(tcp)) { 26 | tprints(", ...}"); 27 | return 0; 28 | } 29 | PRINT_UTS_MEMBER(", ", release); 30 | PRINT_UTS_MEMBER(", ", version); 31 | PRINT_UTS_MEMBER(", ", machine); 32 | #ifdef HAVE_STRUCT_UTSNAME_DOMAINNAME 33 | PRINT_UTS_MEMBER(", ", domainname); 34 | #endif 35 | tprints("}"); 36 | } 37 | 38 | return 0; 39 | } 40 | -------------------------------------------------------------------------------- /utime.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | int 4 | sys_utime(struct tcb *tcp) 5 | { 6 | union { 7 | long utl[2]; 8 | int uti[2]; 9 | long paranoia_for_huge_wordsize[4]; 10 | } u; 11 | unsigned wordsize; 12 | 13 | if (entering(tcp)) { 14 | printpath(tcp, tcp->u_arg[0]); 15 | tprints(", "); 16 | 17 | wordsize = current_wordsize; 18 | if (!tcp->u_arg[1]) 19 | tprints("NULL"); 20 | else if (!verbose(tcp)) 21 | tprintf("%#lx", tcp->u_arg[1]); 22 | else if (umoven(tcp, tcp->u_arg[1], 2 * wordsize, (char *) &u) < 0) 23 | tprints("[?, ?]"); 24 | else if (wordsize == sizeof u.utl[0]) { 25 | tprintf("[%s,", sprinttime(u.utl[0])); 26 | tprintf(" %s]", sprinttime(u.utl[1])); 27 | } 28 | else if (wordsize == sizeof u.uti[0]) { 29 | tprintf("[%s,", sprinttime(u.uti[0])); 30 | tprintf(" %s]", sprinttime(u.uti[1])); 31 | } 32 | else 33 | tprintf("", 34 | wordsize); 35 | } 36 | return 0; 37 | } 38 | -------------------------------------------------------------------------------- /utimes.c: -------------------------------------------------------------------------------- 1 | #include "defs.h" 2 | 3 | static int 4 | decode_utimes(struct tcb *tcp, int offset, int special) 5 | { 6 | if (entering(tcp)) { 7 | printpath(tcp, tcp->u_arg[offset]); 8 | tprints(", "); 9 | if (tcp->u_arg[offset + 1] == 0) 10 | tprints("NULL"); 11 | else { 12 | tprints("{"); 13 | printtv_bitness(tcp, tcp->u_arg[offset + 1], 14 | BITNESS_CURRENT, special); 15 | tprints(", "); 16 | printtv_bitness(tcp, tcp->u_arg[offset + 1] 17 | + sizeof(struct timeval), 18 | BITNESS_CURRENT, special); 19 | tprints("}"); 20 | } 21 | } 22 | return 0; 23 | } 24 | 25 | int 26 | sys_utimes(struct tcb *tcp) 27 | { 28 | return decode_utimes(tcp, 0, 0); 29 | } 30 | 31 | int 32 | sys_futimesat(struct tcb *tcp) 33 | { 34 | if (entering(tcp)) 35 | print_dirfd(tcp, tcp->u_arg[0]); 36 | return decode_utimes(tcp, 1, 0); 37 | } 38 | 39 | int 40 | sys_utimensat(struct tcb *tcp) 41 | { 42 | if (entering(tcp)) { 43 | print_dirfd(tcp, tcp->u_arg[0]); 44 | decode_utimes(tcp, 1, 1); 45 | tprints(", "); 46 | printflags(at_flags, tcp->u_arg[3], "AT_???"); 47 | } 48 | return 0; 49 | } 50 | 51 | #ifdef ALPHA 52 | int 53 | sys_osf_utimes(struct tcb *tcp) 54 | { 55 | if (entering(tcp)) { 56 | printpath(tcp, tcp->u_arg[0]); 57 | tprints(", "); 58 | printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); 59 | } 60 | return 0; 61 | } 62 | #endif /* ALPHA */ 63 | -------------------------------------------------------------------------------- /xlat/access_flags.in: -------------------------------------------------------------------------------- 1 | F_OK 2 | R_OK 3 | W_OK 4 | X_OK 5 | EFF_ONLY_OK 6 | EX_OK 7 | -------------------------------------------------------------------------------- /xlat/aclipc.in: -------------------------------------------------------------------------------- 1 | IPC_SHM 2 | IPC_SEM 3 | IPC_MSG 4 | -------------------------------------------------------------------------------- /xlat/addrfams.in: -------------------------------------------------------------------------------- 1 | AF_UNSPEC 2 | AF_LOCAL 3 | AF_UNIX 4 | AF_INET 5 | AF_AX25 6 | AF_IPX 7 | AF_APPLETALK 8 | AF_NETROM 9 | AF_BRIDGE 10 | AF_ATMPVC 11 | AF_X25 12 | AF_INET6 13 | AF_ROSE 14 | AF_DECnet 15 | AF_NETBEUI 16 | AF_SECURITY 17 | AF_KEY 18 | AF_NETLINK 19 | AF_ROUTE 20 | AF_PACKET 21 | AF_ASH 22 | AF_ECONET 23 | AF_ATMSVC 24 | AF_RDS 25 | AF_SNA 26 | AF_IRDA 27 | AF_PPPOX 28 | AF_WANPIPE 29 | AF_LLC 30 | AF_CAN 31 | AF_TIPC 32 | AF_BLUETOOTH 33 | AF_IUCV 34 | AF_RXRPC 35 | AF_ISDN 36 | AF_PHONET 37 | AF_IEEE802154 38 | AF_CAIF 39 | AF_ALG 40 | AF_NFC 41 | AF_VSOCK 42 | -------------------------------------------------------------------------------- /xlat/adjtimex_modes.in: -------------------------------------------------------------------------------- 1 | 0 2 | ADJ_OFFSET 3 | ADJ_FREQUENCY 4 | ADJ_MAXERROR 5 | ADJ_ESTERROR 6 | ADJ_STATUS 7 | ADJ_TIMECONST 8 | ADJ_TAI 9 | ADJ_SETOFFSET 10 | ADJ_MICRO 11 | ADJ_NANO 12 | ADJ_TICK 13 | ADJ_OFFSET_SINGLESHOT 14 | ADJ_OFFSET_SS_READ 15 | -------------------------------------------------------------------------------- /xlat/adjtimex_state.in: -------------------------------------------------------------------------------- 1 | TIME_OK 2 | TIME_INS 3 | TIME_DEL 4 | TIME_OOP 5 | TIME_WAIT 6 | TIME_ERROR 7 | -------------------------------------------------------------------------------- /xlat/adjtimex_status.in: -------------------------------------------------------------------------------- 1 | STA_PLL 2 | STA_PPSFREQ 3 | STA_PPSTIME 4 | STA_FLL 5 | STA_INS 6 | STA_DEL 7 | STA_UNSYNC 8 | STA_FREQHOLD 9 | STA_PPSSIGNAL 10 | STA_PPSJITTER 11 | STA_PPSWANDER 12 | STA_PPSERROR 13 | STA_CLOCKERR 14 | STA_NANO 15 | STA_MODE 16 | STA_CLK 17 | -------------------------------------------------------------------------------- /xlat/advise.in: -------------------------------------------------------------------------------- 1 | POSIX_FADV_NORMAL 2 | POSIX_FADV_RANDOM 3 | POSIX_FADV_SEQUENTIAL 4 | POSIX_FADV_WILLNEED 5 | POSIX_FADV_DONTNEED 6 | POSIX_FADV_NOREUSE 7 | -------------------------------------------------------------------------------- /xlat/af_packet_types.in: -------------------------------------------------------------------------------- 1 | PACKET_HOST 2 | PACKET_BROADCAST 3 | PACKET_MULTICAST 4 | PACKET_OTHERHOST 5 | PACKET_OUTGOING 6 | PACKET_LOOPBACK 7 | PACKET_FASTROUTE 8 | -------------------------------------------------------------------------------- /xlat/archvals.in: -------------------------------------------------------------------------------- 1 | ARCH_SET_GS 2 | ARCH_SET_FS 3 | ARCH_GET_FS 4 | ARCH_GET_GS 5 | -------------------------------------------------------------------------------- /xlat/at_flags.in: -------------------------------------------------------------------------------- 1 | AT_SYMLINK_NOFOLLOW 2 | AT_REMOVEDIR 3 | AT_SYMLINK_FOLLOW 4 | AT_NO_AUTOMOUNT 5 | AT_EMPTY_PATH 6 | -------------------------------------------------------------------------------- /xlat/atomic_ops.in: -------------------------------------------------------------------------------- 1 | { OR1K_ATOMIC_SWAP, "SWAP" }, 2 | { OR1K_ATOMIC_CMPXCHG, "CMPXCHG" }, 3 | { OR1K_ATOMIC_XCHG, "XCHG" }, 4 | { OR1K_ATOMIC_ADD, "ADD" }, 5 | { OR1K_ATOMIC_DECPOS, "DECPOS" }, 6 | { OR1K_ATOMIC_AND, "AND" }, 7 | { OR1K_ATOMIC_OR, "OR" }, 8 | { OR1K_ATOMIC_UMAX, "UMAX" }, 9 | { OR1K_ATOMIC_UMIN, "UMIN" }, 10 | -------------------------------------------------------------------------------- /xlat/baud_options.in: -------------------------------------------------------------------------------- 1 | B0 2 | B50 3 | B75 4 | B110 5 | B134 6 | B150 7 | B200 8 | B300 9 | B600 10 | B1200 11 | B1800 12 | B2400 13 | B4800 14 | B9600 15 | B19200 16 | B38400 17 | B57600 18 | B115200 19 | B230400 20 | B460800 21 | B500000 22 | B576000 23 | B921600 24 | B1000000 25 | B1152000 26 | B1500000 27 | B2000000 28 | B2500000 29 | B3000000 30 | B3500000 31 | B4000000 32 | EXTA 33 | EXTB 34 | -------------------------------------------------------------------------------- /xlat/blkpg_ops.in: -------------------------------------------------------------------------------- 1 | BLKPG_ADD_PARTITION 2 | BLKPG_DEL_PARTITION 3 | -------------------------------------------------------------------------------- /xlat/bootflags1.in: -------------------------------------------------------------------------------- 1 | LINUX_REBOOT_MAGIC1 2 | -------------------------------------------------------------------------------- /xlat/bootflags2.in: -------------------------------------------------------------------------------- 1 | LINUX_REBOOT_MAGIC2 2 | LINUX_REBOOT_MAGIC2A 3 | LINUX_REBOOT_MAGIC2B 4 | LINUX_REBOOT_MAGIC2C 5 | -------------------------------------------------------------------------------- /xlat/bootflags3.in: -------------------------------------------------------------------------------- 1 | LINUX_REBOOT_CMD_RESTART 2 | LINUX_REBOOT_CMD_HALT 3 | LINUX_REBOOT_CMD_CAD_ON 4 | LINUX_REBOOT_CMD_CAD_OFF 5 | LINUX_REBOOT_CMD_POWER_OFF 6 | LINUX_REBOOT_CMD_RESTART2 7 | LINUX_REBOOT_CMD_SW_SUSPEND 8 | LINUX_REBOOT_CMD_KEXEC 9 | -------------------------------------------------------------------------------- /xlat/bt_protocols.in: -------------------------------------------------------------------------------- 1 | BTPROTO_L2CAP 2 | BTPROTO_HCI 3 | BTPROTO_SCO 4 | BTPROTO_RFCOMM 5 | BTPROTO_BNEP 6 | BTPROTO_CMTP 7 | BTPROTO_HIDP 8 | BTPROTO_AVDTP 9 | -------------------------------------------------------------------------------- /xlat/cacheflush_scope.in: -------------------------------------------------------------------------------- 1 | FLUSH_SCOPE_LINE 2 | FLUSH_SCOPE_PAGE 3 | FLUSH_SCOPE_ALL 4 | -------------------------------------------------------------------------------- /xlat/cap_version.in: -------------------------------------------------------------------------------- 1 | #unconditional 2 | _LINUX_CAPABILITY_VERSION_1 3 | _LINUX_CAPABILITY_VERSION_2 4 | _LINUX_CAPABILITY_VERSION_3 5 | -------------------------------------------------------------------------------- /xlat/capabilities.in: -------------------------------------------------------------------------------- 1 | #unconditional 2 | 1<