summaryrefslogtreecommitdiff
path: root/file.c
Commit message (Collapse)AuthorAge
* Fix preadv/pwritev offset decodingDmitry V. Levin2014-04-17
| | | | | | | | | | | | | | | | | | | | * util.c (printllval): Add align argument. * defs.h (printllval): Update prototype. (printllval_aligned, printllval_unaligned): New macros. * file.c (sys_readahead, sys_truncate64, sys_ftruncate64, sys_fadvise64, sys_fadvise64_64, sys_sync_file_range, sys_sync_file_range2, sys_fallocate): Replace printllval call with printllval_aligned. * io.c (sys_pread, sys_pwrite): Likewise. (sys_preadv, sys_pwritev): Replace printllval call with printllval_unaligned. * linux/arm/syscallent.h: Set the number of preadv and pwritev arguments to 5. * linux/mips/syscallent-o32.h: Likewise. * linux/powerpc/syscallent.h: Likewise. * linux/sh/syscallent.h: Likewise. * linux/xtensa/syscallent.h: Likewise. Reported-by: Dima Kogan <dima@secretsauce.net>
* aarch64: Fix decoding of arm struct stat64Elliott Hughes2014-04-06
| | | | | | | | We need to handle this situation more like x86-64. 32-bit arm and i386 actually have a common struct stat64, except the arm one must not be packed. Additionally, on aarch64 the 32-bit personality is personality 0. Signed-off-by: Elliott Hughes <enh@google.com>
* Fix stat decoding for LP64 bionicElliott Hughes2014-03-12
| | | | | | | | | Patch fb642bb6d63f7ffe2228bf48a6008bc8f56f67ff fixed building with HAVE_STAT64 for aarch64 with uapi kernel headers but not x86_64. The workaround needed to be applied to all LP64 architectures, not just aarch64. This patch fixes that and adds an explanatory comment. Signed-off-by: Elliott Hughes <enh@google.com>
* Fix decoding of arm struct stat64 by aarch64 strace.Elliott Hughes2014-02-28
| | | | | | | | | | | | aarch64's uapi header files have a struct stat but no struct stat64. To correctly decode a 32-bit process' s struct stat64 we need HAVE_STAT64, but then the build fails because there is no struct stat64. Luckily, the aarch64 struct stat is structurally equivalent to the arm struct stat64, so we can just reuse that. * file.c [AARCH64] (stat64): Define to stat. Signed-off-by: Elliott Hughes <enh@google.com>
* Cleanup inotify syscalls decodingDmitry V. Levin2014-02-05
| | | | | | | | | | | * linux/inotify.h: New file. * file.c (inotify_modes, inotify_init_flags, sys_inotify_add_watch, sys_inotify_rm_watch, sys_inotify_init1): Move... * inotify.c: ... here. (inotify_modes): Rename to inotify_flags, convert to XLAT form. (inotify_init_flags): Convert to XLAT form. * Makefile.am (strace_SOURCES): Add inotify.c. (EXTRA_DIST): Add linux/inotify.h.
* Implement fanotify_init and fanotify_mark decodingDmitry V. Levin2014-02-05
| | | | | | | | | | | | | | * fanotify.c: New file. * linux/fanotify.h: Likewise. * Makefile.am (strace_SOURCES): Add fanotify.c. (EXTRA_DIST): Add linux/fanotify.h. * defs.h (print_dirfd): New prototype. * file.c (print_dirfd): Export. * linux/dummy.h (sys_fanotify_init, sys_fanotify_mark): Remove. * linux/syscall.h (sys_fanotify_init, sys_fanotify_mark): New prototypes. * pathtrace.c (pathtrace_match): Handle sys_fanotify_init and sys_fanotify_mark.
* Use XLAT_END macroDmitry V. Levin2014-02-05
| | | | | Automatically update all xlat structures using the following sed regexp: s/^[[:space:]]*{[[:space:]]*0[[:space:]]*,[[:space:]]*NULL[[:space:]]*,\?[[:space:]]*}[[:space:]]*,\?[[:space:]]*/\tXLAT_END/
* Use XLAT macroDmitry V. Levin2014-02-05
| | | | | | Automatically convert all xlat structures to XLAT form using the following sed regexp: s/^[[:space:]]*{[[:space:]]*\([^",}[:space:]]\+\)[[:space:]]*,[[:space:]]*"\1",\?[[:space:]]*}[[:space:]]*/\tXLAT(\1)/
* Decode the O_PATH flagMike Frysinger2013-12-31
| | | | * file.c (open_mode_flags): Add O_PATH.
* Define truncate64, ftruncate64, and getdents64 decoders unconditionallyDmitry V. Levin2013-11-12
| | | | | | | | | These decoders are referenced by most architectures, there were no undefined references so far because _LFS64_LARGEFILE appears to be always defined by glibc when _GNU_SOURCE is defined. * file.c (sys_truncate64, sys_ftruncate64, sys_getdents64): Define unconditionally.
* Assume "long long" availabilityDmitry V. Levin2013-11-11
| | | | | | | | Most of the code already uses long long types unconditionally. * configure.ac: Remove the check for long long. * file.c (printstat64): Remove HAVE_LONG_LONG checks, use %llu format string unconditionally.
* Add support for decoding sync_file_rangeWilliam Manley2013-09-11
| | | | | | | | | | * file.c (sync_file_range_flags): New xlat structure. (sys_sync_file_range, sys_sync_file_range2): New functions. * linux/syscall.h (sys_sync_file_range, sys_sync_file_range2): New prototypes. * linux/dummy.h (sys_sync_file_range, sys_sync_file_range2): Remove. * linux/mips/syscallent-o32.h: Set the number of sync_file_range arguments to 7.
* ARM OABI: fix 64-bit arguments decodingDmitry V. Levin2013-05-06
| | | | | | | | ARM OABI and ARM EABI have different function parameters passing rules, see commit v4.6-11-g7a5b08f for details. * util.c (printllval): Do not align argument number in case of ARM OABI. * file.c (sys_fadvise64_64): Likewise.
* printllval: fix 64bit unpacking on mips/o32 and xtensaMike Frysinger2013-05-06
| | | | | | | | | | | | The mips/o32 ABI and xtensa arch also do 64bit aligning, so add it to the printllval list for this. Normally for sys_fadvise64_64 we'd handle the same list of arches, but mips/o32 ABI is funky and doesn't shift -- it has 7 args. So just add xtensa to it. * file.c (sys_fadvise64_64): Add XTENSA to the shifted list. * util.c (printllval): Add LINUX_MIPSO32 and XTENSA to the shifted list.
* hppa: fix stat64 and fstat64 decodingDmitry V. Levin2013-05-03
| | | | * file.c [HPPA]: Do not redefine stat64 to hpux_stat64.
* arm, aarch64, ppc: fix printllval-based decodersDmitry V. Levin2013-05-03
| | | | | | | | * util.c (printllval) [ARM || POWERPC]: Align argument number. [AARCH64]: Align argument number in 32bit mode. * file.c (sys_fadvise64_64) [ARM || POWERPC]: Remove no longer needed printllval workaround. [AARCH64]: Fix printing POSIX_FADV_* constants in 32bit mode.
* x32: fix build regressions introduced by commit v4.7-96-g8435d67Dmitry V. Levin2013-05-01
| | | | | | | | | | | | | * desc.c (printflock) [X32]: Add special handling required for this architecture with sizeof(long) < sizeof(off_t). * file.c [X32] (struct stat64): Add __attribute__((packed)). [X32] (HAVE_STAT64): Define. (printstat) [X32]: Redirect to printstat64. (printstat64) [X32]: Use "struct stat" instead of "struct stat64". [X32] (realprintstat64): Rename to printstat64_x32. (sys_stat64, sys_fstat64) [X32]: Remove second definitions of these functions. Call printstat64_x32 instead of printstat64 * linux/x32/syscallent.h: Fix handlers for truncate and ftruncate.
* Alias sys_*lstat* syscall printing functionsDmitry V. Levin2013-05-01
| | | | | | | | | | * file.c (sys_lstat, sys_lstat64, sys_oldlstat): Remove. * linux/dummy.h: Move !HAVE_STRUCT___OLD_KERNEL_STAT aliases forward. (sys_lstat): Alias to sys_stat. (sys_lstat64): Alias to sys_stat64. (sys_oldlstat): Alias to sys_oldstat. * linux/syscall.h (sys_lstat, sys_lstat64, sys_oldlstat): Remove. * linux/x32/syscallent1.h (sys_lstat64): Remove.
* x32: fix decoding of __old_kernel_stat based syscallsDmitry V. Levin2013-05-01
| | | | | * file.c [X32] (struct __old_kernel_stat): Define. * linux/x32/syscallent1.h: Remove sys_old*stat redirections.
* Do not use struct dirent in readdir decodingDmitry V. Levin2013-03-20
| | | | | | | | | | struct dirent from libc should not be used for umove'ing into because it contains fixed size d_name. * file.c (printdir): Rename to print_old_dirent. [SH64]: Decode using struct kernel_dirent. [!SH64]: Decode using an open-coded struct with 32-bit d_ino and d_off. (sys_readdir): Update.
* Open-code isprint(c) and isspace(c)Denys Vlasenko2013-03-06
| | | | | | | | | | | | | | | | | | | | We don't call setlocale, thus we always use C locale. But libc supports various other locales, and therefore its ctype interface is general and at times inefficient. For example, in glibc these macros result in function call, whereas for e.g. isprint(c) just c >= ' ' && c <= 0x7e suffices. By open-coding ctype checks (we have only 4 of them) we avoid function calls, we get smaller code: text data bss dec hex filename 245127 680 5708 251515 3d67b strace_old 245019 676 5708 251403 3d60b strace and we don't link in ctype tables (beneficial for static builds). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Remove code which supports systems with long long off_t.Denys Vlasenko2013-02-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While looking at mmap mess, did experimenting in order to figure out what gets used when. Tried building armv4tl, armv5l, armv6l, mips, mipsel, i686, x86_64 and none of they have long long off_t, which isn't suprprising: we aren't using glibc defines which enable that. Moreover, we SHOULD NOT use off_t in syscall decode! Its size depends on libc, not on arch! I.e. it is essentially unpredictable and can even in theory vary on the same arch with different libc. We should use longs or long longs, in a way which matches architectural ABI for the given syscall. There are usually *at most* two permutations, no need to add yet another variable (sizeof(off_t)) to the mix. This change removes almost all HAVE_LONG_LONG_OFF_T conditionals, which will reveal further possible simplifications. * mem.c: Remove code conditional on HAVE_LONG_LONG_OFF_T. As a result, never remap sys_mmap64 to sys_mmap. (print_mmap): Compile unconditionally. (sys_old_mmap): Compile unconditionally. (sys_mmap): Compile unconditionally. * io.c (sys_sendfile): Add a FIXME comment. * file.c: Remove code conditional on HAVE_LONG_LONG_OFF_T. As a result, never remap sys_*stat64 to sys_*stat etc. (sys_truncate): Compile unconditionally. (realprintstat): Likewise. (sys_stat): Likewise. (sys_fstat): Likewise. (sys_lstat): Likewise. * desc.c (printflock): Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Use explicit long type instead of off_tDenys Vlasenko2013-02-17
| | | | | | * file.c (sys_lseek): Use long instead of off_t. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Merge two identical tablesDenys Vlasenko2013-02-17
| | | | | | | | | | * defs.h: Declare whence_codes[]. * desc.c: Delete static whence[]. (printflock[64]): Use whence_codes. * file.c: Make whence_codes[] non-static. Add SEEK_DATA and SEEK_HOLE to them. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Remove wrong x32-specific lseekDenys Vlasenko2013-02-17
| | | | | | | | | | | | Testing confirmed what I suspected: x32 lseek uses kernel-sized (i.e. wide) long for offset parameter. * file.c: Delete sys_lseek32. * linux/syscall.h: Likewise. * linux/x32/syscallent1.h: Likewise. * test/x32_lseek.c: New file. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Fix SEGV in lseekDenys Vlasenko2013-02-17
| | | | | | | | | | I found hard way why the code was using "_whence" name. * file.c: Rename whence[] to whence_codes[]. (sys_lseek): Fix printxval() to use whence_codes[]. (sys_lseek32): Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Comment inner workings of sys_[l]lseekDenys Vlasenko2013-02-17
| | | | | | | | | | | | | The code doesn't look fully correct to me, but I need to experiment on actual x32 machine before I start "fixing" things. For now, add comments, and optimize out one tprints() call... * file.c (sys_lseek): Rename '_whence' as 'whence'. Merge printing of ", " into subsequent tprintf. (sys_lseek32): Likewise. (sys_llseek): Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Remove unused / ambiguously used definesDenys Vlasenko2013-02-12
| | | | | | | | | | | | | | | | We sometimes use LINUXSPARC and sometimes (more often) use "defined(SPARC) || defined(SPARC64)". Better to use one construct consistently. LINUX_MIPS64 is altogether unused. * defs.h: Remove LINUXSPARC and LINUX_MIPS64 defines. Move PTRACE_xxx compat defines up, before arch-specific machinery. Use defined(SPARC) || defined(SPARC64) instead of LINUXSPARC. * file.c: Use defined(SPARC) || defined(SPARC64) instead of LINUXSPARC. * signal.c: Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Dying suddenly with abort() is rude, avoid if possibleDenys Vlasenko2013-02-08
| | | | | | | | * file.c (sys_utime): Don't call abort() if wordsize is strange. Instead, warn user about it. * desc.c (printflock): Use the same message string as in sys_utime. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Fix *xattr decodingDmitry V. Levin2012-12-08
| | | | | * file.c (print_xattr_val): Do not attempt to decode a zero sized array. Fixes RH#885233.
* Decode file type returned by getdents system callDmitry V. Levin2012-08-16
| | | | * file.c (sys_getdents): Decode d_type in unabbreviated mode.
* Merge adjacent printing operations in a few placesDenys Vlasenko2012-05-18
| | | | | | | | | | * file.c (sys_readahead): Merge tprints() with following printllval(). (sys_ftruncate64): Likewise. (sys_fadvise64): Likewise. (sys_fadvise64_64): Likewise. (sys_fallocate): Merge tprints() with following tprintf(). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* x32: add ia32 supportH.J. Lu2012-04-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | * Makefile.am (EXTRA_DIST): Add linux/x32/errnoent1.h, linux/x32/ioctlent1.h, linux/x32/signalent1.h and linux/x32/syscallent1.h. * configure.ac: Remove AC_GNU_SOURCE, obsoleted by AC_USE_SYSTEM_EXTENSIONS. * defs.h (SUPPORTED_PERSONALITIES): Set to 2 for X32. (PERSONALITY1_WORDSIZE): Set to 4 for X32. * file.c (stat64): New struct for X32. (sys_lseek32): New function for X32. (stat64): Undef. (sys_fstat64): Likewise. (sys_stat64): Likewise. (realprintstat64): New function for X32. (sys_fstat64): Likewise. (sys_stat64): Likewise. * mem.c (sys_old_mmap): New function for X32. * pathtrace.c (pathtrace_match): Also check sys_old_mmap for X32. * syscall.c (update_personality): Add X32 support. (get_scno): Support currpers == 1 for X32. * linux/syscall.h (sys_lseek32): New function prototype for X32. * linux/x32/errnoent1.h: New file. * linux/x32/ioctlent1.h: Likewise. * linux/x32/signalent1.h: Likewise. * linux/x32/syscallent1.h: Likewise.
* Fix a problem with sys_lseek on x32H.J. Lu2012-04-16
| | | | | | | * file.c (sys_lseek): Use MIPS-n32 variant also for x32 Signed-off-by: H.J. Lu <hongjiu.lu@intel.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Add x32 support to straceH.J. Lu2012-04-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | X32 support is added to Linux kernel 3.4. In a nutshell, x32 is x86-64 with 32bit pointers. At system call level, x32 is also identical to x86-64, as shown by many changes like "defined(X86_64) || defined(X32)". The main differerence bewteen x32 and x86-64 is off_t in x32 is long long instead of long. This patch adds x32 support to strace. Tested on Linux/x32. * configure.ac: Support X32. * defs.h: Set SUPPORTED_PERSONALITIES to 3 for X86_64, Set PERSONALITY2_WORDSIZE to 4 for X86_64. Add tcb::ext_arg for X32. * file.c (stat): New for X32. (sys_lseek): Use 64-bit version for X32. (printstat64): Check current_personality != 1 for X86_64. * ipc.c (indirect_ipccall): Check current_personality == 1 for X86_64. * mem.c (sys_mmap64): Also use tcp->u_arg for X32. Print NULL for zero address. Call printllval for offset for X32. * pathtrace.c (pathtrace_match): Don't check sys_old_mmap for X32. * process.c (ARG_FLAGS): Defined for X32. (ARG_STACK): Likewise. (ARG_PTID): Likewise. (change_syscall): Handle X32. (struct_user_offsets): Support X32. (sys_arch_prctl): Likewise. * signal.c: Include <asm/sigcontext.h> for X32. (SA_RESTORER): Also define for X32. * syscall.c (update_personality): Support X32 for X86_64. (is_restart_error): Likewise. (syscall_fixup_on_sysenter): Likewise. (get_syscall_args): Likewise. (get_syscall_result): Likewise. (get_error): Likewise. (__X32_SYSCALL_BIT): Define if not defined. (__X32_SYSCALL_MASK): Likewise. (get_scno): Check DS register value for X32. Use __X32_SYSCALL_MASK on X32 system calls. * util.c (printllval): Use ext_arg for X32. (printcall): Support X32. (change_syscall): Likewise. (arg0_offset): Likewise. (arg1_offset): Likewise. * Makefile.am (EXTRA_DIST): Add linux/x32/errnoent.h, linux/x32/ioctlent.h.in, linux/x32/signalent.h, linux/x32/syscallent.h, linux/x86_64/errnoent2.h, linux/x86_64/ioctlent2.h, linux/x86_64/signalent2.h and linux/x86_64/syscallent2.h. * linux/x32/errnoent.h: New. * linux/x32/ioctlent.h.in: Likewise. * linux/x32/signalent.h: Likewise. * linux/x32/syscallent.h: Likewise. * linux/x86_64/errnoent2.h: Likewise. * linux/x86_64/ioctlent2.h: Likewise. * linux/x86_64/signalent2.h: Likewise. * linux/x86_64/syscallent2.h: Likewise. Signed-off-by: H.J. Lu <hongjiu.lu@intel.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Restore tcb::u_lrval; fix lseek on MIPS-n32H.J. Lu2012-04-16
| | | | | | | | | | | | | | | | | Linux kernel v3.4 adds x32 support. Both x32 and n32 use 64bit offset for lseek parameter and return value. We need u_lrval to handle it properly. Also we shouldn't check HAVE_LONG_LONG_OFF_T for n32 lseek. This patch fixes it properly and prepares lseek for x32. * defs.h (tcb): Restore tcb::u_lrval field, RVAL_Lfoo constants. Set RVAL_MASK to 7. * file.c (sys_lseek): Print 64bit offset and return RVAL_LUDECIMAL for n32. * syscall.c (get_error): Set u_lrval for MIPS-n32. (trace_syscall_exiting): Handle RVAL_Lfoo return value types. Signed-off-by: H.J. Lu <hongjiu.lu@intel.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Optimize code if we have only one personalityDenys Vlasenko2012-03-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On i386: text data bss dec hex filename 238025 672 18980 257677 3ee8d strace.before 237389 704 18944 257037 3ec0d strace * defs.h: Define PERSONALITY0_WORDSIZE as sizeof(long) if not defined. Introduce new define, current_wordsize as (personality_wordsize[current_personality]). Make set_personality() no-op, current_personality constant zero, current_wordsize as PERSONALITY0_WORDSIZE if we have only one personality. * count.c (call_summary): Use current_wordsize instead of personality_wordsize[current_personality]. * desc.c (printflock): Likewise. * file.c (sys_utime): Likewise. * io.c (tprint_iov): Likewise. * process.c (printargv): Likewise. * resource.c (decode_rlimit): Likewise. * signal.c (sys_kill): Likewise. (sys_rt_sigaction): Likewise. * time.c (sprinttv): Likewise. (sprint_timespec): Likewise. (printitv_bitness): Likewise. (tprint_timex): Likewise. (printsigevent): Likewise. * util.c (dumpiov): Likewise. (umoven): Likewise. (umovestr): Likewise. * syscall.c: Initialize sysent to sysent0 etc. Make current_personality, personality_wordsize[], set_personality() conditional on SUPPORTED_PERSONALITIES > 1. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Remove unused version of sys_lseekDenys Vlasenko2012-03-18
| | | | | | | | | | | | It is buggy: it returns RVAL_LUDECIMAL, which means the return value is in tcp->u_lrval. But tcp->u_lrval is never set (on Linux - it used to be set on other OSes). * file.c (sys_lseek): Remove a version of this function which is supposed to be used if off_t is long long. It appears to be buggy and unused. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Simplify sys_lseek64 conditional compilation.Denys Vlasenko2012-03-17
| | | | | | | | | | | | | | | | | | | | | | | | | | It looks like sys_lseek64() is never used. For one, it is buggy (always shows 0 return value), and no one complains. From code inspection: sys_lseek64 name is not used anywhere. It is defined to sys_lseek if HAVE_LONG_LONG_OFF_T is true. Thus, if !HAVE_LONG_LONG_OFF_T, it is never used. Therefore "if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T" conditional it sits in can be simplified to "if HAVE_LONG_LONG_OFF_T". Therefore, we can move it a bit up and merge with "if !HAVE_LONG_LONG_OFF_T, use this sys_lseek()" code block, by addind an "else" clause to it. To simplify it more, drop define and just rename sys_lseek64 -> sys_lseek. Since the function is buggy, I think it is unused and we can just drop it. (I checked: at least I386 never uses it). * file.c (sys_lseek64): Rename to sys_lseek; don't compile it if _LFS64_LARGEFILE but !HAVE_LONG_LONG_OFF_T since in this case it is never used. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Indentation and whitespace fixes. No code changes.Denys Vlasenko2012-03-17
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Tidy up includes and copyright notices, fix indentationDenys Vlasenko2012-03-16
| | | | | | | | | | | | | | | The files not mentioned in changelog below had only copyright notices fixes and indentation fixes. * defs.h: Include <stdint.h> and <inttypes.h>. * file.c: Do not include <inttypes.h>. Move struct kernel_dirent declaration below top include block. * block.c: Do not include <stdint.h> and <inttypes.h>. * quota.c: Likewise. * desc.c: Likewise. * signal.c: Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Ensure that SWAP_FLAG_* constants are definedDmitry V. Levin2012-03-15
| | | | | | | * file.c: Define those of SWAP_FLAG_* constants which are not yet provided by <sys/swap.h>. Reported-by: Mike Frysinger <vapier@gentoo.org>
* Enhance *listxattr syscalls decodingDmitry V. Levin2012-03-14
| | | | | * file.c (print_xattr_list): New function. (sys_listxattr, sys_flistxattr): Use it.
* Fix *at syscalls flags decodingDmitry V. Levin2012-03-13
| | | | | | | | | | | | | | Several *at decoders were defining own incomplete *atflags xlat structures. That was error prone, and fchownat decoder actually failed to recognize AT_EMPTY_PATH. Merging these incomplete structures into the single at_flags xlat structure will fix flags handling in all these decoders altogether. * file.c: Define all AT_* constants used by *at decoders. (at_flags): New xlat structure, with records for all AT_* constants. (fstatatflags, linkat_flags, unlinkatflags): Remove. (sys_newfstatat, sys_linkat, sys_unlinkat, sys_fchownat, sys_utimensat): Use at_flags.
* Fix linkat flags decodingDmitry V. Levin2012-03-13
| | | | | * file.c (linkat_flags): New xlat structure. (sys_linkat): Decode flags using linkat_flags.
* Correct inotify_rm_watch decoderDmitry V. Levin2012-03-11
| | | | * file.c (sys_inotify_rm_watch): Print second argument as int.
* Alias sys_fsync to sys_closeDmitry V. Levin2012-03-11
| | | | | | | | | * file.c (sys_fsync): Remove. * linux/syscall.h (sys_fsync): Likewise. * linux/dummy.h (sys_fsync): Alias to sys_close. * linux/m68k/syscallent.h: Add TD flag to fsync entry. * linux/microblaze/syscallent.h: Likewise. * linux/mips/syscallent.h: Likewise.
* swapon: decode swap flagsDmitry V. Levin2012-03-09
| | | | | | | | * file.c: Include <sys/swap.h>. (swap_flags): New xlat structure. (sys_swapon): New function. * linux/dummy.h (sys_swapon): Remove. * linux/syscall.h (sys_swapon): New declaration.
* Assorted trivial optimizationsDenys Vlasenko2012-02-27
| | | | | | | | | | | | | | | | | | | | | | text data bss dec hex filename 236448 672 19044 256164 3e8a4 strace.before 236360 672 19044 256076 3e84c strace * file.c (sprintmode): Use smaller static buffer, eliminate strlen call. (sprinttime): Use smaller static buffer. (printstat_sparc64): Coalesce two printing calls into one. (printstat_powerpc32): Likewise. (printcompat_statfs6): Likewise. (sys_utime): Do not fetch personality_wordsize[current_personality] repeatedly - cache it in local variable instead. * process.c (printargv): Likewise. * resource.c (sprintrlim): Return const char*, not char*. This allows to eliminate sprintf(buf, "RLIM_INFINITY"). Use smaller static buffer. (sprintrlim64): Likewise. * strace.c (strerror): Use smaller static buffer. (strsignal): Likewise. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Style fixes, no code changesDenys Vlasenko2012-02-27
| | | | | | | | | | | * desc.c (sys_io_getevents): Indentation fix. * file.c (sys_xstat): Remove space after function name. (decode_mknod): Indentation fix. * net.c (printsockopt): Indentation fix. * process.c (unalignctl_string): Indentation fix. (sys_sched_getscheduler): Remove space after ! operator. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>