2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
5 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 unsigned short st_dev;
39 unsigned short st_mode;
41 unsigned short st_uid;
42 unsigned short st_gid;
43 unsigned short st_rdev;
46 unsigned int __unused1;
48 unsigned int __unused2;
50 unsigned int __unused3;
53 unsigned int __unused4[2];
60 unsigned int st_nlink;
70 unsigned long __unused4[2];
73 # define stat kernel_stat
74 # include <asm/stat.h>
78 unsigned long long st_dev;
79 unsigned long long st_ino;
80 unsigned long long st_nlink;
86 unsigned long long st_rdev;
91 unsigned long long st_atime;
92 unsigned long long st_atime_nsec;
93 unsigned long long st_mtime;
94 unsigned long long st_mtime_nsec;
95 unsigned long long st_ctime;
96 unsigned long long st_ctime_nsec;
97 long long __unused[3];
101 unsigned long long st_dev;
102 unsigned char __pad0[4];
103 unsigned long __st_ino;
104 unsigned int st_mode;
105 unsigned int st_nlink;
106 unsigned long st_uid;
107 unsigned long st_gid;
108 unsigned long long st_rdev;
109 unsigned char __pad3[4];
111 unsigned long st_blksize;
112 unsigned long long st_blocks;
113 unsigned long st_atime;
114 unsigned long st_atime_nsec;
115 unsigned long st_mtime;
116 unsigned int st_mtime_nsec;
117 unsigned long st_ctime;
118 unsigned long st_ctime_nsec;
119 unsigned long long st_ino;
130 # define dev_t __kernel_dev_t
131 # define ino_t __kernel_ino_t
132 # define mode_t __kernel_mode_t
133 # define nlink_t __kernel_nlink_t
134 # define uid_t __kernel_uid_t
135 # define gid_t __kernel_gid_t
136 # define off_t __kernel_off_t
137 # define loff_t __kernel_loff_t
139 # include <asm/stat.h>
151 # define mode_t mode_t
152 # define nlink_t nlink_t
156 # define loff_t loff_t
159 #ifdef HPPA /* asm-parisc/stat.h defines stat64 */
162 #define stat libc_stat
163 #define stat64 libc_stat64
164 #include <sys/stat.h>
167 /* These might be macros. */
172 # define stat64 hpux_stat64
176 #ifdef HAVE_SYS_VFS_H
177 # include <sys/vfs.h>
179 #ifdef HAVE_LINUX_XATTR_H
180 # include <linux/xattr.h>
182 # define XATTR_CREATE 1
183 # define XATTR_REPLACE 2
186 #if HAVE_LONG_LONG_OFF_T
188 * Ugly hacks for systems that have typedef long long off_t
191 # define HAVE_STAT64 1 /* Ugly hack */
192 # define sys_stat64 sys_stat
193 # define sys_fstat64 sys_fstat
194 # define sys_lstat64 sys_lstat
195 # define sys_truncate64 sys_truncate
196 # define sys_ftruncate64 sys_ftruncate
199 #ifdef MAJOR_IN_SYSMACROS
200 # include <sys/sysmacros.h>
203 #ifdef MAJOR_IN_MKDEV
204 # include <sys/mkdev.h>
207 #ifdef HAVE_SYS_ASYNCH_H
208 # include <sys/asynch.h>
211 struct kernel_dirent {
214 unsigned short d_reclen;
218 const struct xlat open_access_modes[] = {
219 { O_RDONLY, "O_RDONLY" },
220 { O_WRONLY, "O_WRONLY" },
221 { O_RDWR, "O_RDWR" },
223 { O_ACCMODE, "O_ACCMODE" },
228 const struct xlat open_mode_flags[] = {
229 { O_CREAT, "O_CREAT" },
230 { O_EXCL, "O_EXCL" },
231 { O_NOCTTY, "O_NOCTTY" },
232 { O_TRUNC, "O_TRUNC" },
233 { O_APPEND, "O_APPEND" },
234 { O_NONBLOCK, "O_NONBLOCK" },
236 { O_SYNC, "O_SYNC" },
239 { O_ASYNC, "O_ASYNC" },
242 { O_DSYNC, "O_DSYNC" },
245 { O_RSYNC, "O_RSYNC" },
247 #if defined(O_NDELAY) && (O_NDELAY != O_NONBLOCK)
248 { O_NDELAY, "O_NDELAY" },
251 { O_PRIV, "O_PRIV" },
254 { O_DIRECT, "O_DIRECT" },
257 # if O_LARGEFILE == 0 /* biarch platforms in 64-bit mode */
260 # define O_LARGEFILE 0x40000
261 # elif defined X86_64 || defined S390X
262 # define O_LARGEFILE 0100000
266 { O_LARGEFILE, "O_LARGEFILE" },
270 { O_DIRECTORY, "O_DIRECTORY" },
273 { O_NOFOLLOW, "O_NOFOLLOW" },
276 { O_NOATIME, "O_NOATIME" },
279 { O_CLOEXEC, "O_CLOEXEC" },
282 { FNDELAY, "FNDELAY" },
285 { FAPPEND, "FAPPEND" },
291 { FDEFER, "FDEFER" },
294 { FASYNC, "FASYNC" },
297 { FSHLOCK, "FSHLOCK" },
300 { FEXLOCK, "FEXLOCK" },
303 { FCREAT, "FCREAT" },
306 { FTRUNC, "FTRUNC" },
318 { FNOCTTY, "FNOCTTY" },
321 { O_SHLOCK, "O_SHLOCK" },
324 { O_EXLOCK, "O_EXLOCK" },
330 # define AT_FDCWD -100
333 /* The fd is an "int", so when decoding x86 on x86_64, we need to force sign
334 * extension to get the right value. We do this by declaring fd as int here.
337 print_dirfd(struct tcb *tcp, int fd)
340 tprints("AT_FDCWD, ");
348 * low bits of the open(2) flags define access mode,
349 * other bits are real flags.
352 sprint_open_modes(mode_t flags)
354 static char outstr[(1 + ARRAY_SIZE(open_mode_flags)) * sizeof("O_LARGEFILE")];
358 const struct xlat *x;
361 p = stpcpy(outstr, "flags");
362 str = xlookup(open_access_modes, flags & 3);
372 for (x = open_mode_flags; x->str; x++) {
373 if ((flags & x->val) == x->val) {
375 p = stpcpy(p, x->str);
382 /* flags is still nonzero */
384 sprintf(p, "%#x", flags);
389 tprint_open_modes(mode_t flags)
391 tprints(sprint_open_modes(flags) + sizeof("flags"));
395 decode_open(struct tcb *tcp, int offset)
398 printpath(tcp, tcp->u_arg[offset]);
401 tprint_open_modes(tcp->u_arg[offset + 1]);
402 if (tcp->u_arg[offset + 1] & O_CREAT) {
404 tprintf(", %#lo", tcp->u_arg[offset + 2]);
411 sys_open(struct tcb *tcp)
413 return decode_open(tcp, 0);
417 sys_openat(struct tcb *tcp)
420 print_dirfd(tcp, tcp->u_arg[0]);
421 return decode_open(tcp, 1);
425 static const struct xlat openmodessol[] = {
429 { 0x80, "O_NONBLOCK" },
431 { 0x100, "O_CREAT" },
432 { 0x200, "O_TRUNC" },
434 { 0x800, "O_NOCTTY" },
437 { 0x8000, "O_RSYNC" },
439 { 0x1000, "O_PRIV" },
444 solaris_open(struct tcb *tcp)
447 printpath(tcp, tcp->u_arg[0]);
450 printflags(openmodessol, tcp->u_arg[1] + 1, "O_???");
451 if (tcp->u_arg[1] & 0x100) {
453 tprintf(", %#lo", tcp->u_arg[2]);
462 sys_creat(struct tcb *tcp)
465 printpath(tcp, tcp->u_arg[0]);
466 tprintf(", %#lo", tcp->u_arg[1]);
471 static const struct xlat access_flags[] = {
477 { EFF_ONLY_OK, "EFF_ONLY_OK" },
486 decode_access(struct tcb *tcp, int offset)
489 printpath(tcp, tcp->u_arg[offset]);
491 printflags(access_flags, tcp->u_arg[offset + 1], "?_OK");
497 sys_access(struct tcb *tcp)
499 return decode_access(tcp, 0);
503 sys_faccessat(struct tcb *tcp)
506 print_dirfd(tcp, tcp->u_arg[0]);
507 return decode_access(tcp, 1);
511 sys_umask(struct tcb *tcp)
514 tprintf("%#lo", tcp->u_arg[0]);
519 static const struct xlat whence[] = {
520 { SEEK_SET, "SEEK_SET" },
521 { SEEK_CUR, "SEEK_CUR" },
522 { SEEK_END, "SEEK_END" },
526 #if defined(LINUX_MIPSN32) || defined(X32)
528 sys_lseek(struct tcb *tcp)
534 printfd(tcp, tcp->u_arg[0]);
536 offset = tcp->ext_arg[1];
537 _whence = tcp->u_arg[2];
538 if (_whence == SEEK_SET)
539 tprintf("%llu, ", offset);
541 tprintf("%lld, ", offset);
542 printxval(whence, _whence, "SEEK_???");
544 return RVAL_LUDECIMAL;
549 sys_lseek32(struct tcb *tcp)
555 printfd(tcp, tcp->u_arg[0]);
557 offset = tcp->u_arg[1];
558 _whence = tcp->u_arg[2];
559 if (_whence == SEEK_SET)
560 tprintf("%lu, ", offset);
562 tprintf("%ld, ", offset);
563 printxval(whence, _whence, "SEEK_???");
565 return RVAL_UDECIMAL;
570 sys_lseek(struct tcb *tcp)
576 printfd(tcp, tcp->u_arg[0]);
578 offset = tcp->u_arg[1];
579 _whence = tcp->u_arg[2];
580 if (_whence == SEEK_SET)
581 tprintf("%lu, ", offset);
583 tprintf("%ld, ", offset);
584 printxval(whence, _whence, "SEEK_???");
586 return RVAL_UDECIMAL;
591 sys_llseek(struct tcb *tcp)
594 printfd(tcp, tcp->u_arg[0]);
596 * This one call takes explicitly two 32-bit arguments hi, lo,
597 * rather than one 64-bit argument for which LONG_LONG works
598 * appropriate for the native byte order.
600 if (tcp->u_arg[4] == SEEK_SET)
602 ((long long int) tcp->u_arg[1]) << 32 |
603 (unsigned long long) (unsigned) tcp->u_arg[2]);
606 ((long long int) tcp->u_arg[1]) << 32 |
607 (unsigned long long) (unsigned) tcp->u_arg[2]);
611 if (syserror(tcp) || umove(tcp, tcp->u_arg[3], &off) < 0)
612 tprintf("%#lx, ", tcp->u_arg[3]);
614 tprintf("[%llu], ", off);
615 printxval(whence, tcp->u_arg[4], "SEEK_???");
621 sys_readahead(struct tcb *tcp)
625 printfd(tcp, tcp->u_arg[0]);
626 argn = printllval(tcp, ", %lld", 1);
627 tprintf(", %ld", tcp->u_arg[argn]);
632 #ifndef HAVE_LONG_LONG_OFF_T
634 sys_truncate(struct tcb *tcp)
637 printpath(tcp, tcp->u_arg[0]);
638 tprintf(", %lu", tcp->u_arg[1]);
644 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
646 sys_truncate64(struct tcb *tcp)
649 printpath(tcp, tcp->u_arg[0]);
650 printllval(tcp, ", %llu", 1);
656 #ifndef HAVE_LONG_LONG_OFF_T
658 sys_ftruncate(struct tcb *tcp)
661 printfd(tcp, tcp->u_arg[0]);
662 tprintf(", %lu", tcp->u_arg[1]);
668 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
670 sys_ftruncate64(struct tcb *tcp)
673 printfd(tcp, tcp->u_arg[0]);
674 printllval(tcp, ", %llu", 1);
682 static const struct xlat modetypes[] = {
683 { S_IFREG, "S_IFREG" },
684 { S_IFSOCK, "S_IFSOCK" },
685 { S_IFIFO, "S_IFIFO" },
686 { S_IFLNK, "S_IFLNK" },
687 { S_IFDIR, "S_IFDIR" },
688 { S_IFBLK, "S_IFBLK" },
689 { S_IFCHR, "S_IFCHR" },
696 static char buf[sizeof("S_IFSOCK|S_ISUID|S_ISGID|S_ISVTX|%o")
701 if ((mode & S_IFMT) == 0)
703 else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) {
704 sprintf(buf, "%#o", mode);
707 s = buf + sprintf(buf, "%s%s%s%s", s,
708 (mode & S_ISUID) ? "|S_ISUID" : "",
709 (mode & S_ISGID) ? "|S_ISGID" : "",
710 (mode & S_ISVTX) ? "|S_ISVTX" : "");
711 mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX);
713 sprintf((char*)s, "|%#o", mode);
714 s = (*buf == '|') ? buf + 1 : buf;
722 static char buf[sizeof("yyyy/mm/dd-hh:mm:ss")];
730 snprintf(buf, sizeof buf, "%02d/%02d/%02d-%02d:%02d:%02d",
731 tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
732 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
734 snprintf(buf, sizeof buf, "%lu", (unsigned long) t);
747 int st_pad1[3]; /* network id */
756 int st_pad3; /* st_size, off_t expansion */
757 timestruct_t st_atime;
758 timestruct_t st_mtime;
759 timestruct_t st_ctime;
763 int st_pad4[8]; /* expansion area */
767 printstatsol(struct tcb *tcp, long addr)
769 struct solstat statbuf;
771 if (umove(tcp, addr, &statbuf) < 0) {
776 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
777 (unsigned long) ((statbuf.st_dev >> 18) & 0x3fff),
778 (unsigned long) (statbuf.st_dev & 0x3ffff),
779 (unsigned long) statbuf.st_ino,
780 sprintmode(statbuf.st_mode));
781 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
782 (unsigned long) statbuf.st_nlink,
783 (unsigned long) statbuf.st_uid,
784 (unsigned long) statbuf.st_gid);
785 tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);
786 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
789 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
790 switch (statbuf.st_mode & S_IFMT) {
791 case S_IFCHR: case S_IFBLK:
792 tprintf("st_rdev=makedev(%lu, %lu), ",
793 (unsigned long) ((statbuf.st_rdev >> 18) & 0x3fff),
794 (unsigned long) (statbuf.st_rdev & 0x3ffff));
797 tprintf("st_size=%u, ", statbuf.st_size);
801 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime.tv_sec));
802 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime.tv_sec));
803 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime.tv_sec));
811 printstat_sparc64(struct tcb *tcp, long addr)
813 struct stat_sparc64 statbuf;
815 if (umove(tcp, addr, &statbuf) < 0) {
821 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
822 (unsigned long) major(statbuf.st_dev),
823 (unsigned long) minor(statbuf.st_dev),
824 (unsigned long) statbuf.st_ino,
825 sprintmode(statbuf.st_mode));
826 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
827 (unsigned long) statbuf.st_nlink,
828 (unsigned long) statbuf.st_uid,
829 (unsigned long) statbuf.st_gid);
830 tprintf("st_blksize=%lu, ",
831 (unsigned long) statbuf.st_blksize);
832 tprintf("st_blocks=%lu, ",
833 (unsigned long) statbuf.st_blocks);
836 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
837 switch (statbuf.st_mode & S_IFMT) {
838 case S_IFCHR: case S_IFBLK:
839 tprintf("st_rdev=makedev(%lu, %lu), ",
840 (unsigned long) major(statbuf.st_rdev),
841 (unsigned long) minor(statbuf.st_rdev));
844 tprintf("st_size=%lu, ", statbuf.st_size);
848 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
849 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
850 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
856 #endif /* LINUXSPARC */
858 #if defined POWERPC64
859 struct stat_powerpc32 {
862 unsigned int st_mode;
863 unsigned short st_nlink;
866 unsigned int st_rdev;
867 unsigned int st_size;
868 unsigned int st_blksize;
869 unsigned int st_blocks;
870 unsigned int st_atime;
871 unsigned int st_atime_nsec;
872 unsigned int st_mtime;
873 unsigned int st_mtime_nsec;
874 unsigned int st_ctime;
875 unsigned int st_ctime_nsec;
876 unsigned int __unused4;
877 unsigned int __unused5;
881 printstat_powerpc32(struct tcb *tcp, long addr)
883 struct stat_powerpc32 statbuf;
885 if (umove(tcp, addr, &statbuf) < 0) {
891 tprintf("{st_dev=makedev(%u, %u), st_ino=%u, st_mode=%s, ",
892 major(statbuf.st_dev), minor(statbuf.st_dev),
894 sprintmode(statbuf.st_mode));
895 tprintf("st_nlink=%u, st_uid=%u, st_gid=%u, ",
896 statbuf.st_nlink, statbuf.st_uid, statbuf.st_gid);
897 tprintf("st_blksize=%u, ", statbuf.st_blksize);
898 tprintf("st_blocks=%u, ", statbuf.st_blocks);
901 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
902 switch (statbuf.st_mode & S_IFMT) {
903 case S_IFCHR: case S_IFBLK:
904 tprintf("st_rdev=makedev(%lu, %lu), ",
905 (unsigned long) major(statbuf.st_rdev),
906 (unsigned long) minor(statbuf.st_rdev));
909 tprintf("st_size=%u, ", statbuf.st_size);
913 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
914 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
915 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
920 #endif /* POWERPC64 */
922 static const struct xlat fileflags[] = {
926 #ifndef HAVE_LONG_LONG_OFF_T
928 realprintstat(struct tcb *tcp, struct stat *statbuf)
931 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
932 (unsigned long) major(statbuf->st_dev),
933 (unsigned long) minor(statbuf->st_dev),
934 (unsigned long) statbuf->st_ino,
935 sprintmode(statbuf->st_mode));
936 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
937 (unsigned long) statbuf->st_nlink,
938 (unsigned long) statbuf->st_uid,
939 (unsigned long) statbuf->st_gid);
940 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
941 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
943 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
944 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
948 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
949 switch (statbuf->st_mode & S_IFMT) {
950 case S_IFCHR: case S_IFBLK:
951 #ifdef HAVE_STRUCT_STAT_ST_RDEV
952 tprintf("st_rdev=makedev(%lu, %lu), ",
953 (unsigned long) major(statbuf->st_rdev),
954 (unsigned long) minor(statbuf->st_rdev));
955 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
956 tprintf("st_size=makedev(%lu, %lu), ",
957 (unsigned long) major(statbuf->st_size),
958 (unsigned long) minor(statbuf->st_size));
959 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
962 tprintf("st_size=%lu, ", (unsigned long) statbuf->st_size);
966 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
967 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
968 tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));
969 #if HAVE_STRUCT_STAT_ST_FLAGS
970 tprints(", st_flags=");
971 printflags(fileflags, statbuf->st_flags, "UF_???");
973 #if HAVE_STRUCT_STAT_ST_ACLCNT
974 tprintf(", st_aclcnt=%d", statbuf->st_aclcnt);
976 #if HAVE_STRUCT_STAT_ST_LEVEL
977 tprintf(", st_level=%ld", statbuf->st_level);
979 #if HAVE_STRUCT_STAT_ST_FSTYPE
980 tprintf(", st_fstype=%.*s",
981 (int) sizeof statbuf->st_fstype, statbuf->st_fstype);
983 #if HAVE_STRUCT_STAT_ST_GEN
984 tprintf(", st_gen=%u", statbuf->st_gen);
993 printstat(struct tcb *tcp, long addr)
1001 if (syserror(tcp) || !verbose(tcp)) {
1002 tprintf("%#lx", addr);
1007 if (current_personality == 1) {
1008 printstatsol(tcp, addr);
1012 else if (current_personality == 2) {
1013 printstat_sparc64(tcp, addr);
1017 #endif /* LINUXSPARC */
1019 #if defined POWERPC64
1020 if (current_personality == 1) {
1021 printstat_powerpc32(tcp, addr);
1026 if (umove(tcp, addr, &statbuf) < 0) {
1031 realprintstat(tcp, &statbuf);
1033 #endif /* !HAVE_LONG_LONG_OFF_T */
1035 #if !defined HAVE_STAT64 && defined X86_64
1037 * Linux x86_64 has unified `struct stat' but its i386 biarch needs
1038 * `struct stat64'. Its <asm-i386/stat.h> definition expects 32-bit `long'.
1039 * <linux/include/asm-x86_64/ia32.h> is not in the public includes set.
1040 * __GNUC__ is needed for the required __attribute__ below.
1043 unsigned long long st_dev;
1044 unsigned char __pad0[4];
1045 unsigned int __st_ino;
1046 unsigned int st_mode;
1047 unsigned int st_nlink;
1048 unsigned int st_uid;
1049 unsigned int st_gid;
1050 unsigned long long st_rdev;
1051 unsigned char __pad3[4];
1053 unsigned int st_blksize;
1054 unsigned long long st_blocks;
1055 unsigned int st_atime;
1056 unsigned int st_atime_nsec;
1057 unsigned int st_mtime;
1058 unsigned int st_mtime_nsec;
1059 unsigned int st_ctime;
1060 unsigned int st_ctime_nsec;
1061 unsigned long long st_ino;
1062 } __attribute__((packed));
1063 # define HAVE_STAT64 1
1064 # define STAT64_SIZE 96
1069 printstat64(struct tcb *tcp, long addr)
1071 struct stat64 statbuf;
1074 (void) sizeof(char[sizeof statbuf == STAT64_SIZE ? 1 : -1]);
1081 if (syserror(tcp) || !verbose(tcp)) {
1082 tprintf("%#lx", addr);
1087 if (current_personality == 1) {
1088 printstatsol(tcp, addr);
1092 else if (current_personality == 2) {
1093 printstat_sparc64(tcp, addr);
1097 #endif /* LINUXSPARC */
1100 if (current_personality != 1) {
1101 printstat(tcp, addr);
1106 if (umove(tcp, addr, &statbuf) < 0) {
1112 #ifdef HAVE_LONG_LONG
1113 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
1115 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
1117 (unsigned long) major(statbuf.st_dev),
1118 (unsigned long) minor(statbuf.st_dev),
1119 #ifdef HAVE_LONG_LONG
1120 (unsigned long long) statbuf.st_ino,
1122 (unsigned long) statbuf.st_ino,
1124 sprintmode(statbuf.st_mode));
1125 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
1126 (unsigned long) statbuf.st_nlink,
1127 (unsigned long) statbuf.st_uid,
1128 (unsigned long) statbuf.st_gid);
1129 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
1130 tprintf("st_blksize=%lu, ",
1131 (unsigned long) statbuf.st_blksize);
1132 #endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */
1133 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
1134 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
1135 #endif /* HAVE_STRUCT_STAT_ST_BLOCKS */
1138 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
1139 switch (statbuf.st_mode & S_IFMT) {
1140 case S_IFCHR: case S_IFBLK:
1141 #ifdef HAVE_STRUCT_STAT_ST_RDEV
1142 tprintf("st_rdev=makedev(%lu, %lu), ",
1143 (unsigned long) major(statbuf.st_rdev),
1144 (unsigned long) minor(statbuf.st_rdev));
1145 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
1146 tprintf("st_size=makedev(%lu, %lu), ",
1147 (unsigned long) major(statbuf.st_size),
1148 (unsigned long) minor(statbuf.st_size));
1149 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
1152 #ifdef HAVE_LONG_LONG
1153 tprintf("st_size=%llu, ", (unsigned long long) statbuf.st_size);
1155 tprintf("st_size=%lu, ", (unsigned long) statbuf.st_size);
1160 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
1161 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
1162 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
1163 #if HAVE_STRUCT_STAT_ST_FLAGS
1164 tprints(", st_flags=");
1165 printflags(fileflags, statbuf.st_flags, "UF_???");
1167 #if HAVE_STRUCT_STAT_ST_ACLCNT
1168 tprintf(", st_aclcnt=%d", statbuf.st_aclcnt);
1170 #if HAVE_STRUCT_STAT_ST_LEVEL
1171 tprintf(", st_level=%ld", statbuf.st_level);
1173 #if HAVE_STRUCT_STAT_ST_FSTYPE
1174 tprintf(", st_fstype=%.*s",
1175 (int) sizeof statbuf.st_fstype, statbuf.st_fstype);
1177 #if HAVE_STRUCT_STAT_ST_GEN
1178 tprintf(", st_gen=%u", statbuf.st_gen);
1185 #endif /* HAVE_STAT64 */
1187 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
1189 convertoldstat(const struct __old_kernel_stat *oldbuf, struct stat *newbuf)
1191 newbuf->st_dev = oldbuf->st_dev;
1192 newbuf->st_ino = oldbuf->st_ino;
1193 newbuf->st_mode = oldbuf->st_mode;
1194 newbuf->st_nlink = oldbuf->st_nlink;
1195 newbuf->st_uid = oldbuf->st_uid;
1196 newbuf->st_gid = oldbuf->st_gid;
1197 newbuf->st_rdev = oldbuf->st_rdev;
1198 newbuf->st_size = oldbuf->st_size;
1199 newbuf->st_atime = oldbuf->st_atime;
1200 newbuf->st_mtime = oldbuf->st_mtime;
1201 newbuf->st_ctime = oldbuf->st_ctime;
1202 newbuf->st_blksize = 0; /* not supported in old_stat */
1203 newbuf->st_blocks = 0; /* not supported in old_stat */
1207 printoldstat(struct tcb *tcp, long addr)
1209 struct __old_kernel_stat statbuf;
1210 struct stat newstatbuf;
1216 if (syserror(tcp) || !verbose(tcp)) {
1217 tprintf("%#lx", addr);
1222 if (current_personality == 1) {
1223 printstatsol(tcp, addr);
1228 if (umove(tcp, addr, &statbuf) < 0) {
1233 convertoldstat(&statbuf, &newstatbuf);
1234 realprintstat(tcp, &newstatbuf);
1238 #ifndef HAVE_LONG_LONG_OFF_T
1240 sys_stat(struct tcb *tcp)
1242 if (entering(tcp)) {
1243 printpath(tcp, tcp->u_arg[0]);
1246 printstat(tcp, tcp->u_arg[1]);
1253 sys_stat64(struct tcb *tcp)
1256 if (entering(tcp)) {
1257 printpath(tcp, tcp->u_arg[0]);
1260 printstat64(tcp, tcp->u_arg[1]);
1264 return printargs(tcp);
1268 #ifndef AT_SYMLINK_NOFOLLOW
1269 # define AT_SYMLINK_NOFOLLOW 0x100
1271 #ifndef AT_REMOVEDIR
1272 # define AT_REMOVEDIR 0x200
1274 #ifndef AT_SYMLINK_FOLLOW
1275 # define AT_SYMLINK_FOLLOW 0x400
1277 #ifndef AT_NO_AUTOMOUNT
1278 # define AT_NO_AUTOMOUNT 0x800
1280 #ifndef AT_EMPTY_PATH
1281 # define AT_EMPTY_PATH 0x1000
1284 static const struct xlat at_flags[] = {
1285 { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" },
1286 { AT_REMOVEDIR, "AT_REMOVEDIR" },
1287 { AT_SYMLINK_FOLLOW, "AT_SYMLINK_FOLLOW" },
1288 { AT_NO_AUTOMOUNT, "AT_NO_AUTOMOUNT" },
1289 { AT_EMPTY_PATH, "AT_EMPTY_PATH" },
1294 sys_newfstatat(struct tcb *tcp)
1296 if (entering(tcp)) {
1297 print_dirfd(tcp, tcp->u_arg[0]);
1298 printpath(tcp, tcp->u_arg[1]);
1302 if (current_personality == 0)
1303 printstat(tcp, tcp->u_arg[2]);
1305 printstat64(tcp, tcp->u_arg[2]);
1306 #elif defined HAVE_STAT64
1307 printstat64(tcp, tcp->u_arg[2]);
1309 printstat(tcp, tcp->u_arg[2]);
1312 printflags(at_flags, tcp->u_arg[3], "AT_???");
1317 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
1319 sys_oldstat(struct tcb *tcp)
1321 if (entering(tcp)) {
1322 printpath(tcp, tcp->u_arg[0]);
1325 printoldstat(tcp, tcp->u_arg[1]);
1331 #ifndef HAVE_LONG_LONG_OFF_T
1333 sys_fstat(struct tcb *tcp)
1335 if (entering(tcp)) {
1336 printfd(tcp, tcp->u_arg[0]);
1339 printstat(tcp, tcp->u_arg[1]);
1346 sys_fstat64(struct tcb *tcp)
1349 if (entering(tcp)) {
1350 printfd(tcp, tcp->u_arg[0]);
1353 printstat64(tcp, tcp->u_arg[1]);
1357 return printargs(tcp);
1361 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
1363 sys_oldfstat(struct tcb *tcp)
1365 if (entering(tcp)) {
1366 printfd(tcp, tcp->u_arg[0]);
1369 printoldstat(tcp, tcp->u_arg[1]);
1375 #ifndef HAVE_LONG_LONG_OFF_T
1377 sys_lstat(struct tcb *tcp)
1379 if (entering(tcp)) {
1380 printpath(tcp, tcp->u_arg[0]);
1383 printstat(tcp, tcp->u_arg[1]);
1390 sys_lstat64(struct tcb *tcp)
1393 if (entering(tcp)) {
1394 printpath(tcp, tcp->u_arg[0]);
1397 printstat64(tcp, tcp->u_arg[1]);
1401 return printargs(tcp);
1405 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
1407 sys_oldlstat(struct tcb *tcp)
1409 if (entering(tcp)) {
1410 printpath(tcp, tcp->u_arg[0]);
1413 printoldstat(tcp, tcp->u_arg[1]);
1419 #if defined(LINUXSPARC)
1422 sys_xstat(struct tcb *tcp)
1424 if (entering(tcp)) {
1425 tprintf("%ld, ", tcp->u_arg[0]);
1426 printpath(tcp, tcp->u_arg[1]);
1430 if (tcp->u_arg[0] == _STAT64_VER)
1431 printstat64(tcp, tcp->u_arg[2]);
1434 printstat(tcp, tcp->u_arg[2]);
1440 sys_fxstat(struct tcb *tcp)
1443 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
1446 if (tcp->u_arg[0] == _STAT64_VER)
1447 printstat64(tcp, tcp->u_arg[2]);
1450 printstat(tcp, tcp->u_arg[2]);
1456 sys_lxstat(struct tcb *tcp)
1458 if (entering(tcp)) {
1459 tprintf("%ld, ", tcp->u_arg[0]);
1460 printpath(tcp, tcp->u_arg[1]);
1464 if (tcp->u_arg[0] == _STAT64_VER)
1465 printstat64(tcp, tcp->u_arg[2]);
1468 printstat(tcp, tcp->u_arg[2]);
1474 sys_xmknod(struct tcb *tcp)
1476 int mode = tcp->u_arg[2];
1478 if (entering(tcp)) {
1479 tprintf("%ld, ", tcp->u_arg[0]);
1480 printpath(tcp, tcp->u_arg[1]);
1481 tprintf(", %s", sprintmode(mode));
1482 switch (mode & S_IFMT) {
1483 case S_IFCHR: case S_IFBLK:
1484 tprintf(", makedev(%lu, %lu)",
1485 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
1486 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
1495 # ifdef HAVE_SYS_ACL_H
1497 # include <sys/acl.h>
1499 static const struct xlat aclcmds[] = {
1501 { SETACL, "SETACL" },
1504 { GETACL, "GETACL" },
1507 { GETACLCNT, "GETACLCNT" },
1510 { ACL_GET, "ACL_GET" },
1513 { ACL_SET, "ACL_SET" },
1516 { ACL_CNT, "ACL_CNT" },
1522 sys_acl(struct tcb *tcp)
1524 if (entering(tcp)) {
1525 printpath(tcp, tcp->u_arg[0]);
1527 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1528 tprintf(", %ld", tcp->u_arg[2]);
1530 * FIXME - dump out the list of aclent_t's pointed to
1531 * by "tcp->u_arg[3]" if it's not NULL.
1534 tprintf(", %#lx", tcp->u_arg[3]);
1542 sys_facl(struct tcb *tcp)
1544 if (entering(tcp)) {
1545 tprintf("%ld, ", tcp->u_arg[0]);
1546 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1547 tprintf(", %ld", tcp->u_arg[2]);
1549 * FIXME - dump out the list of aclent_t's pointed to
1550 * by "tcp->u_arg[3]" if it's not NULL.
1553 tprintf(", %#lx", tcp->u_arg[3]);
1560 static const struct xlat aclipc[] = {
1562 { IPC_SHM, "IPC_SHM" },
1565 { IPC_SEM, "IPC_SEM" },
1568 { IPC_MSG, "IPC_MSG" },
1574 sys_aclipc(struct tcb *tcp)
1576 if (entering(tcp)) {
1577 printxval(aclipc, tcp->u_arg[0], "???IPC???");
1578 tprintf(", %#lx, ", tcp->u_arg[1]);
1579 printxval(aclcmds, tcp->u_arg[2], "???ACL???");
1580 tprintf(", %ld", tcp->u_arg[3]);
1582 * FIXME - dump out the list of aclent_t's pointed to
1583 * by "tcp->u_arg[4]" if it's not NULL.
1586 tprintf(", %#lx", tcp->u_arg[4]);
1593 # endif /* HAVE_SYS_ACL_H */
1595 #endif /* LINUXSPARC */
1597 static const struct xlat fsmagic[] = {
1598 { 0x73757245, "CODA_SUPER_MAGIC" },
1599 { 0x012ff7b7, "COH_SUPER_MAGIC" },
1600 { 0x1373, "DEVFS_SUPER_MAGIC" },
1601 { 0x1cd1, "DEVPTS_SUPER_MAGIC" },
1602 { 0x414A53, "EFS_SUPER_MAGIC" },
1603 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
1604 { 0xef53, "EXT2_SUPER_MAGIC" },
1605 { 0x137d, "EXT_SUPER_MAGIC" },
1606 { 0xf995e849, "HPFS_SUPER_MAGIC" },
1607 { 0x9660, "ISOFS_SUPER_MAGIC" },
1608 { 0x137f, "MINIX_SUPER_MAGIC" },
1609 { 0x138f, "MINIX_SUPER_MAGIC2" },
1610 { 0x2468, "MINIX2_SUPER_MAGIC" },
1611 { 0x2478, "MINIX2_SUPER_MAGIC2" },
1612 { 0x4d44, "MSDOS_SUPER_MAGIC" },
1613 { 0x564c, "NCP_SUPER_MAGIC" },
1614 { 0x6969, "NFS_SUPER_MAGIC" },
1615 { 0x9fa0, "PROC_SUPER_MAGIC" },
1616 { 0x002f, "QNX4_SUPER_MAGIC" },
1617 { 0x52654973, "REISERFS_SUPER_MAGIC" },
1618 { 0x02011994, "SHMFS_SUPER_MAGIC" },
1619 { 0x517b, "SMB_SUPER_MAGIC" },
1620 { 0x012ff7b6, "SYSV2_SUPER_MAGIC" },
1621 { 0x012ff7b5, "SYSV4_SUPER_MAGIC" },
1622 { 0x00011954, "UFS_MAGIC" },
1623 { 0x54190100, "UFS_CIGAM" },
1624 { 0x012ff7b4, "XENIX_SUPER_MAGIC" },
1625 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
1626 { 0x62656572, "SYSFS_MAGIC" },
1631 sprintfstype(int magic)
1633 static char buf[32];
1636 s = xlookup(fsmagic, magic);
1638 sprintf(buf, "\"%s\"", s);
1641 sprintf(buf, "%#x", magic);
1646 printstatfs(struct tcb *tcp, long addr)
1648 struct statfs statbuf;
1650 if (syserror(tcp) || !verbose(tcp)) {
1651 tprintf("%#lx", addr);
1654 if (umove(tcp, addr, &statbuf) < 0) {
1660 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
1661 sprintfstype(statbuf.f_type),
1662 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
1663 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_fsid={%d, %d}, f_namelen=%u",
1664 statbuf.f_bavail, statbuf.f_files, statbuf.f_ffree,
1665 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1],
1668 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
1669 sprintfstype(statbuf.f_type),
1670 (unsigned long)statbuf.f_bsize,
1671 (unsigned long)statbuf.f_blocks,
1672 (unsigned long)statbuf.f_bfree);
1673 tprintf("f_bavail=%lu, f_files=%lu, f_ffree=%lu, f_fsid={%d, %d}",
1674 (unsigned long)statbuf.f_bavail,
1675 (unsigned long)statbuf.f_files,
1676 (unsigned long)statbuf.f_ffree,
1677 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1678 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1680 #ifdef _STATFS_F_FRSIZE
1681 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
1687 sys_statfs(struct tcb *tcp)
1689 if (entering(tcp)) {
1690 printpath(tcp, tcp->u_arg[0]);
1693 printstatfs(tcp, tcp->u_arg[1]);
1699 sys_fstatfs(struct tcb *tcp)
1701 if (entering(tcp)) {
1702 printfd(tcp, tcp->u_arg[0]);
1705 printstatfs(tcp, tcp->u_arg[1]);
1710 #if defined HAVE_STATFS64
1712 printstatfs64(struct tcb *tcp, long addr)
1714 struct statfs64 statbuf;
1716 if (syserror(tcp) || !verbose(tcp)) {
1717 tprintf("%#lx", addr);
1720 if (umove(tcp, addr, &statbuf) < 0) {
1724 tprintf("{f_type=%s, f_bsize=%llu, f_blocks=%llu, f_bfree=%llu, ",
1725 sprintfstype(statbuf.f_type),
1726 (unsigned long long)statbuf.f_bsize,
1727 (unsigned long long)statbuf.f_blocks,
1728 (unsigned long long)statbuf.f_bfree);
1729 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
1730 (unsigned long long)statbuf.f_bavail,
1731 (unsigned long long)statbuf.f_files,
1732 (unsigned long long)statbuf.f_ffree,
1733 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1734 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1735 #ifdef _STATFS_F_FRSIZE
1736 tprintf(", f_frsize=%llu", (unsigned long long)statbuf.f_frsize);
1738 #ifdef _STATFS_F_FLAGS
1739 tprintf(", f_flags=%llu", (unsigned long long)statbuf.f_flags);
1744 struct compat_statfs64 {
1756 uint32_t f_spare[4];
1758 #if defined(X86_64) || defined(IA64)
1759 __attribute__ ((packed, aligned(4)))
1764 printcompat_statfs64(struct tcb *tcp, long addr)
1766 struct compat_statfs64 statbuf;
1768 if (syserror(tcp) || !verbose(tcp)) {
1769 tprintf("%#lx", addr);
1772 if (umove(tcp, addr, &statbuf) < 0) {
1776 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%llu, f_bfree=%llu, ",
1777 sprintfstype(statbuf.f_type),
1778 (unsigned long)statbuf.f_bsize,
1779 (unsigned long long)statbuf.f_blocks,
1780 (unsigned long long)statbuf.f_bfree);
1781 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
1782 (unsigned long long)statbuf.f_bavail,
1783 (unsigned long long)statbuf.f_files,
1784 (unsigned long long)statbuf.f_ffree,
1785 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1786 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1787 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
1788 tprintf(", f_flags=%lu}", (unsigned long)statbuf.f_frsize);
1792 sys_statfs64(struct tcb *tcp)
1794 if (entering(tcp)) {
1795 printpath(tcp, tcp->u_arg[0]);
1796 tprintf(", %lu, ", tcp->u_arg[1]);
1798 if (tcp->u_arg[1] == sizeof(struct statfs64))
1799 printstatfs64(tcp, tcp->u_arg[2]);
1800 else if (tcp->u_arg[1] == sizeof(struct compat_statfs64))
1801 printcompat_statfs64(tcp, tcp->u_arg[2]);
1809 sys_fstatfs64(struct tcb *tcp)
1811 if (entering(tcp)) {
1812 printfd(tcp, tcp->u_arg[0]);
1813 tprintf(", %lu, ", tcp->u_arg[1]);
1815 if (tcp->u_arg[1] == sizeof(struct statfs64))
1816 printstatfs64(tcp, tcp->u_arg[2]);
1817 else if (tcp->u_arg[1] == sizeof(struct compat_statfs64))
1818 printcompat_statfs64(tcp, tcp->u_arg[2]);
1828 osf_statfs(struct tcb *tcp)
1830 if (entering(tcp)) {
1831 printpath(tcp, tcp->u_arg[0]);
1834 printstatfs(tcp, tcp->u_arg[1]);
1835 tprintf(", %lu", tcp->u_arg[2]);
1841 osf_fstatfs(struct tcb *tcp)
1843 if (entering(tcp)) {
1844 tprintf("%lu, ", tcp->u_arg[0]);
1846 printstatfs(tcp, tcp->u_arg[1]);
1847 tprintf(", %lu", tcp->u_arg[2]);
1855 sys_chdir(struct tcb *tcp)
1857 if (entering(tcp)) {
1858 printpath(tcp, tcp->u_arg[0]);
1864 decode_mkdir(struct tcb *tcp, int offset)
1866 if (entering(tcp)) {
1867 printpath(tcp, tcp->u_arg[offset]);
1868 tprintf(", %#lo", tcp->u_arg[offset + 1]);
1874 sys_mkdir(struct tcb *tcp)
1876 return decode_mkdir(tcp, 0);
1880 sys_mkdirat(struct tcb *tcp)
1883 print_dirfd(tcp, tcp->u_arg[0]);
1884 return decode_mkdir(tcp, 1);
1888 sys_link(struct tcb *tcp)
1890 if (entering(tcp)) {
1891 printpath(tcp, tcp->u_arg[0]);
1893 printpath(tcp, tcp->u_arg[1]);
1899 sys_linkat(struct tcb *tcp)
1901 if (entering(tcp)) {
1902 print_dirfd(tcp, tcp->u_arg[0]);
1903 printpath(tcp, tcp->u_arg[1]);
1905 print_dirfd(tcp, tcp->u_arg[2]);
1906 printpath(tcp, tcp->u_arg[3]);
1908 printflags(at_flags, tcp->u_arg[4], "AT_???");
1914 sys_unlinkat(struct tcb *tcp)
1916 if (entering(tcp)) {
1917 print_dirfd(tcp, tcp->u_arg[0]);
1918 printpath(tcp, tcp->u_arg[1]);
1920 printflags(at_flags, tcp->u_arg[2], "AT_???");
1926 sys_symlinkat(struct tcb *tcp)
1928 if (entering(tcp)) {
1929 printpath(tcp, tcp->u_arg[0]);
1931 print_dirfd(tcp, tcp->u_arg[1]);
1932 printpath(tcp, tcp->u_arg[2]);
1938 decode_readlink(struct tcb *tcp, int offset)
1940 if (entering(tcp)) {
1941 printpath(tcp, tcp->u_arg[offset]);
1945 tprintf("%#lx", tcp->u_arg[offset + 1]);
1947 /* Used to use printpathn(), but readlink
1948 * neither includes NUL in the returned count,
1949 * nor actually writes it into memory.
1950 * printpathn() would decide on printing
1951 * "..." continuation based on garbage
1952 * past return buffer's end.
1954 printstr(tcp, tcp->u_arg[offset + 1], tcp->u_rval);
1955 tprintf(", %lu", tcp->u_arg[offset + 2]);
1961 sys_readlink(struct tcb *tcp)
1963 return decode_readlink(tcp, 0);
1967 sys_readlinkat(struct tcb *tcp)
1970 print_dirfd(tcp, tcp->u_arg[0]);
1971 return decode_readlink(tcp, 1);
1975 sys_renameat(struct tcb *tcp)
1977 if (entering(tcp)) {
1978 print_dirfd(tcp, tcp->u_arg[0]);
1979 printpath(tcp, tcp->u_arg[1]);
1981 print_dirfd(tcp, tcp->u_arg[2]);
1982 printpath(tcp, tcp->u_arg[3]);
1988 sys_chown(struct tcb *tcp)
1990 if (entering(tcp)) {
1991 printpath(tcp, tcp->u_arg[0]);
1992 printuid(", ", tcp->u_arg[1]);
1993 printuid(", ", tcp->u_arg[2]);
1999 sys_fchownat(struct tcb *tcp)
2001 if (entering(tcp)) {
2002 print_dirfd(tcp, tcp->u_arg[0]);
2003 printpath(tcp, tcp->u_arg[1]);
2004 printuid(", ", tcp->u_arg[2]);
2005 printuid(", ", tcp->u_arg[3]);
2007 printflags(at_flags, tcp->u_arg[4], "AT_???");
2013 sys_fchown(struct tcb *tcp)
2015 if (entering(tcp)) {
2016 printfd(tcp, tcp->u_arg[0]);
2017 printuid(", ", tcp->u_arg[1]);
2018 printuid(", ", tcp->u_arg[2]);
2024 decode_chmod(struct tcb *tcp, int offset)
2026 if (entering(tcp)) {
2027 printpath(tcp, tcp->u_arg[offset]);
2028 tprintf(", %#lo", tcp->u_arg[offset + 1]);
2034 sys_chmod(struct tcb *tcp)
2036 return decode_chmod(tcp, 0);
2040 sys_fchmodat(struct tcb *tcp)
2043 print_dirfd(tcp, tcp->u_arg[0]);
2044 return decode_chmod(tcp, 1);
2048 sys_fchmod(struct tcb *tcp)
2050 if (entering(tcp)) {
2051 printfd(tcp, tcp->u_arg[0]);
2052 tprintf(", %#lo", tcp->u_arg[1]);
2059 sys_osf_utimes(struct tcb *tcp)
2061 if (entering(tcp)) {
2062 printpath(tcp, tcp->u_arg[0]);
2064 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
2071 decode_utimes(struct tcb *tcp, int offset, int special)
2073 if (entering(tcp)) {
2074 printpath(tcp, tcp->u_arg[offset]);
2076 if (tcp->u_arg[offset + 1] == 0)
2080 printtv_bitness(tcp, tcp->u_arg[offset + 1],
2081 BITNESS_CURRENT, special);
2083 printtv_bitness(tcp, tcp->u_arg[offset + 1]
2084 + sizeof(struct timeval),
2085 BITNESS_CURRENT, special);
2093 sys_utimes(struct tcb *tcp)
2095 return decode_utimes(tcp, 0, 0);
2099 sys_futimesat(struct tcb *tcp)
2102 print_dirfd(tcp, tcp->u_arg[0]);
2103 return decode_utimes(tcp, 1, 0);
2107 sys_utimensat(struct tcb *tcp)
2109 if (entering(tcp)) {
2110 print_dirfd(tcp, tcp->u_arg[0]);
2111 decode_utimes(tcp, 1, 1);
2113 printflags(at_flags, tcp->u_arg[3], "AT_???");
2119 sys_utime(struct tcb *tcp)
2125 unsigned wordsize = current_wordsize;
2127 if (entering(tcp)) {
2128 printpath(tcp, tcp->u_arg[0]);
2132 else if (!verbose(tcp))
2133 tprintf("%#lx", tcp->u_arg[1]);
2134 else if (umoven(tcp, tcp->u_arg[1], 2 * wordsize, (char *) &u) < 0)
2136 else if (wordsize == sizeof u.utl[0]) {
2137 tprintf("[%s,", sprinttime(u.utl[0]));
2138 tprintf(" %s]", sprinttime(u.utl[1]));
2140 else if (wordsize == sizeof u.uti[0]) {
2141 tprintf("[%s,", sprinttime(u.uti[0]));
2142 tprintf(" %s]", sprinttime(u.uti[1]));
2151 decode_mknod(struct tcb *tcp, int offset)
2153 int mode = tcp->u_arg[offset + 1];
2155 if (entering(tcp)) {
2156 printpath(tcp, tcp->u_arg[offset]);
2157 tprintf(", %s", sprintmode(mode));
2158 switch (mode & S_IFMT) {
2162 if (current_personality == 1)
2163 tprintf(", makedev(%lu, %lu)",
2164 (unsigned long) ((tcp->u_arg[offset + 2] >> 18) & 0x3fff),
2165 (unsigned long) (tcp->u_arg[offset + 2] & 0x3ffff));
2168 tprintf(", makedev(%lu, %lu)",
2169 (unsigned long) major(tcp->u_arg[offset + 2]),
2170 (unsigned long) minor(tcp->u_arg[offset + 2]));
2180 sys_mknod(struct tcb *tcp)
2182 return decode_mknod(tcp, 0);
2186 sys_mknodat(struct tcb *tcp)
2189 print_dirfd(tcp, tcp->u_arg[0]);
2190 return decode_mknod(tcp, 1);
2194 printdir(struct tcb *tcp, long addr)
2198 if (!verbose(tcp)) {
2199 tprintf("%#lx", addr);
2202 if (umove(tcp, addr, &d) < 0) {
2206 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
2208 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
2213 sys_readdir(struct tcb *tcp)
2215 if (entering(tcp)) {
2216 printfd(tcp, tcp->u_arg[0]);
2219 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
2220 tprintf("%#lx", tcp->u_arg[1]);
2222 printdir(tcp, tcp->u_arg[1]);
2223 /* Not much point in printing this out, it is always 1. */
2224 if (tcp->u_arg[2] != 1)
2225 tprintf(", %lu", tcp->u_arg[2]);
2230 static const struct xlat direnttypes[] = {
2231 { DT_UNKNOWN, "DT_UNKNOWN" },
2232 { DT_FIFO, "DT_FIFO" },
2233 { DT_CHR, "DT_CHR" },
2234 { DT_DIR, "DT_DIR" },
2235 { DT_BLK, "DT_BLK" },
2236 { DT_REG, "DT_REG" },
2237 { DT_LNK, "DT_LNK" },
2238 { DT_SOCK, "DT_SOCK" },
2239 { DT_WHT, "DT_WHT" },
2244 sys_getdents(struct tcb *tcp)
2246 int i, len, dents = 0;
2249 if (entering(tcp)) {
2250 printfd(tcp, tcp->u_arg[0]);
2254 if (syserror(tcp) || !verbose(tcp)) {
2255 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2259 /* Beware of insanely large or negative values in tcp->u_rval */
2260 if (tcp->u_rval > 1024*1024)
2262 if (tcp->u_rval < 0)
2264 buf = len ? malloc(len) : NULL;
2266 die_out_of_memory();
2267 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2268 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2274 for (i = 0; i < len;) {
2275 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
2277 tprintf("%s{d_ino=%lu, d_off=%lu, ",
2278 i ? " " : "", d->d_ino, d->d_off);
2279 tprintf("d_reclen=%u, d_name=\"%s\"}",
2280 d->d_reclen, d->d_name);
2283 tprints("/* d_reclen == 0, problem here */");
2292 tprintf("/* %u entries */", dents);
2293 tprintf(", %lu", tcp->u_arg[2]);
2298 #if _LFS64_LARGEFILE
2300 sys_getdents64(struct tcb *tcp)
2302 int i, len, dents = 0;
2305 if (entering(tcp)) {
2306 printfd(tcp, tcp->u_arg[0]);
2310 if (syserror(tcp) || !verbose(tcp)) {
2311 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2316 /* Beware of insanely large or negative tcp->u_rval */
2317 if (tcp->u_rval > 1024*1024)
2319 if (tcp->u_rval < 0)
2321 buf = len ? malloc(len) : NULL;
2323 die_out_of_memory();
2325 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2326 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2332 for (i = 0; i < len;) {
2333 struct dirent64 *d = (struct dirent64 *) &buf[i];
2335 tprintf("%s{d_ino=%" PRIu64 ", d_off=%" PRId64 ", ",
2340 printxval(direnttypes, d->d_type, "DT_???");
2342 tprintf("d_reclen=%u, d_name=\"%s\"}",
2343 d->d_reclen, d->d_name);
2346 tprints("/* d_reclen == 0, problem here */");
2355 tprintf("/* %u entries */", dents);
2356 tprintf(", %lu", tcp->u_arg[2]);
2363 sys_getcwd(struct tcb *tcp)
2367 tprintf("%#lx", tcp->u_arg[0]);
2369 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
2370 tprintf(", %lu", tcp->u_arg[1]);
2375 #ifdef HAVE_SYS_ASYNCH_H
2378 sys_aioread(struct tcb *tcp)
2380 struct aio_result_t res;
2382 if (entering(tcp)) {
2383 tprintf("%lu, ", tcp->u_arg[0]);
2386 tprintf("%#lx", tcp->u_arg[1]);
2388 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2389 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2390 printxval(whence, tcp->u_arg[4], "L_???");
2391 if (syserror(tcp) || tcp->u_arg[5] == 0
2392 || umove(tcp, tcp->u_arg[5], &res) < 0)
2393 tprintf(", %#lx", tcp->u_arg[5]);
2395 tprintf(", {aio_return %d aio_errno %d}",
2396 res.aio_return, res.aio_errno);
2402 sys_aiowrite(struct tcb *tcp)
2404 struct aio_result_t res;
2406 if (entering(tcp)) {
2407 tprintf("%lu, ", tcp->u_arg[0]);
2408 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2409 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2410 printxval(whence, tcp->u_arg[4], "L_???");
2413 if (tcp->u_arg[5] == 0)
2415 else if (syserror(tcp)
2416 || umove(tcp, tcp->u_arg[5], &res) < 0)
2417 tprintf(", %#lx", tcp->u_arg[5]);
2419 tprintf(", {aio_return %d aio_errno %d}",
2420 res.aio_return, res.aio_errno);
2426 sys_aiowait(struct tcb *tcp)
2429 printtv(tcp, tcp->u_arg[0]);
2434 sys_aiocancel(struct tcb *tcp)
2436 struct aio_result_t res;
2439 if (tcp->u_arg[0] == 0)
2441 else if (syserror(tcp)
2442 || umove(tcp, tcp->u_arg[0], &res) < 0)
2443 tprintf("%#lx", tcp->u_arg[0]);
2445 tprintf("{aio_return %d aio_errno %d}",
2446 res.aio_return, res.aio_errno);
2451 #endif /* HAVE_SYS_ASYNCH_H */
2453 static const struct xlat xattrflags[] = {
2455 { XATTR_CREATE, "XATTR_CREATE" },
2456 { XATTR_REPLACE, "XATTR_REPLACE" },
2462 print_xattr_val(struct tcb *tcp, int failed,
2464 unsigned long insize,
2468 unsigned long capacity = 4 * size + 1;
2469 unsigned char *buf = (capacity < size) ? NULL : malloc(capacity);
2470 if (buf == NULL || /* probably a bogus size argument */
2471 umoven(tcp, arg, size, (char *) &buf[3 * size]) < 0) {
2475 unsigned char *out = buf;
2476 unsigned char *in = &buf[3 * size];
2478 for (i = 0; i < size; ++i) {
2482 #define tohex(n) "0123456789abcdef"[n]
2485 *out++ = tohex(in[i] / 16);
2486 *out++ = tohex(in[i] % 16);
2489 /* Don't print terminating NUL if there is one. */
2490 if (i > 0 && in[i - 1] == '\0')
2493 tprintf(", \"%s\", %ld", buf, insize);
2498 tprintf(", 0x%lx, %ld", arg, insize);
2502 sys_setxattr(struct tcb *tcp)
2504 if (entering(tcp)) {
2505 printpath(tcp, tcp->u_arg[0]);
2507 printstr(tcp, tcp->u_arg[1], -1);
2508 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2510 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2516 sys_fsetxattr(struct tcb *tcp)
2518 if (entering(tcp)) {
2519 printfd(tcp, tcp->u_arg[0]);
2521 printstr(tcp, tcp->u_arg[1], -1);
2522 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2524 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2530 sys_getxattr(struct tcb *tcp)
2532 if (entering(tcp)) {
2533 printpath(tcp, tcp->u_arg[0]);
2535 printstr(tcp, tcp->u_arg[1], -1);
2537 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2544 sys_fgetxattr(struct tcb *tcp)
2546 if (entering(tcp)) {
2547 printfd(tcp, tcp->u_arg[0]);
2549 printstr(tcp, tcp->u_arg[1], -1);
2551 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2558 print_xattr_list(struct tcb *tcp, unsigned long addr, unsigned long size)
2560 if (syserror(tcp)) {
2561 tprintf("%#lx", addr);
2567 (size < tcp->u_rval) ? size : tcp->u_rval;
2568 printstr(tcp, addr, len);
2571 tprintf(", %lu", size);
2575 sys_listxattr(struct tcb *tcp)
2577 if (entering(tcp)) {
2578 printpath(tcp, tcp->u_arg[0]);
2581 print_xattr_list(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2587 sys_flistxattr(struct tcb *tcp)
2589 if (entering(tcp)) {
2590 printfd(tcp, tcp->u_arg[0]);
2593 print_xattr_list(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2599 sys_removexattr(struct tcb *tcp)
2601 if (entering(tcp)) {
2602 printpath(tcp, tcp->u_arg[0]);
2604 printstr(tcp, tcp->u_arg[1], -1);
2610 sys_fremovexattr(struct tcb *tcp)
2612 if (entering(tcp)) {
2613 printfd(tcp, tcp->u_arg[0]);
2615 printstr(tcp, tcp->u_arg[1], -1);
2620 static const struct xlat advise[] = {
2621 { POSIX_FADV_NORMAL, "POSIX_FADV_NORMAL" },
2622 { POSIX_FADV_RANDOM, "POSIX_FADV_RANDOM" },
2623 { POSIX_FADV_SEQUENTIAL, "POSIX_FADV_SEQUENTIAL" },
2624 { POSIX_FADV_WILLNEED, "POSIX_FADV_WILLNEED" },
2625 { POSIX_FADV_DONTNEED, "POSIX_FADV_DONTNEED" },
2626 { POSIX_FADV_NOREUSE, "POSIX_FADV_NOREUSE" },
2631 sys_fadvise64(struct tcb *tcp)
2633 if (entering(tcp)) {
2635 printfd(tcp, tcp->u_arg[0]);
2636 argn = printllval(tcp, ", %lld", 1);
2637 tprintf(", %ld, ", tcp->u_arg[argn++]);
2638 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2644 sys_fadvise64_64(struct tcb *tcp)
2646 if (entering(tcp)) {
2648 printfd(tcp, tcp->u_arg[0]);
2649 #if defined ARM || defined POWERPC
2650 argn = printllval(tcp, ", %lld, ", 2);
2652 argn = printllval(tcp, ", %lld, ", 1);
2654 argn = printllval(tcp, "%lld, ", argn);
2655 #if defined ARM || defined POWERPC
2656 printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
2658 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2664 static const struct xlat inotify_modes[] = {
2665 { 0x00000001, "IN_ACCESS" },
2666 { 0x00000002, "IN_MODIFY" },
2667 { 0x00000004, "IN_ATTRIB" },
2668 { 0x00000008, "IN_CLOSE_WRITE"},
2669 { 0x00000010, "IN_CLOSE_NOWRITE"},
2670 { 0x00000020, "IN_OPEN" },
2671 { 0x00000040, "IN_MOVED_FROM" },
2672 { 0x00000080, "IN_MOVED_TO" },
2673 { 0x00000100, "IN_CREATE" },
2674 { 0x00000200, "IN_DELETE" },
2675 { 0x00000400, "IN_DELETE_SELF"},
2676 { 0x00000800, "IN_MOVE_SELF" },
2677 { 0x00002000, "IN_UNMOUNT" },
2678 { 0x00004000, "IN_Q_OVERFLOW" },
2679 { 0x00008000, "IN_IGNORED" },
2680 { 0x01000000, "IN_ONLYDIR" },
2681 { 0x02000000, "IN_DONT_FOLLOW"},
2682 { 0x20000000, "IN_MASK_ADD" },
2683 { 0x40000000, "IN_ISDIR" },
2684 { 0x80000000, "IN_ONESHOT" },
2688 static const struct xlat inotify_init_flags[] = {
2689 { 0x00000800, "IN_NONBLOCK" },
2690 { 0x00080000, "IN_CLOEXEC" },
2695 sys_inotify_add_watch(struct tcb *tcp)
2697 if (entering(tcp)) {
2698 printfd(tcp, tcp->u_arg[0]);
2700 printpath(tcp, tcp->u_arg[1]);
2702 printflags(inotify_modes, tcp->u_arg[2], "IN_???");
2708 sys_inotify_rm_watch(struct tcb *tcp)
2710 if (entering(tcp)) {
2711 printfd(tcp, tcp->u_arg[0]);
2712 tprintf(", %d", (int) tcp->u_arg[1]);
2718 sys_inotify_init1(struct tcb *tcp)
2721 printflags(inotify_init_flags, tcp->u_arg[0], "IN_???");
2726 sys_fallocate(struct tcb *tcp)
2728 if (entering(tcp)) {
2730 printfd(tcp, tcp->u_arg[0]); /* fd */
2731 tprintf(", %#lo, ", tcp->u_arg[1]); /* mode */
2732 argn = printllval(tcp, "%llu, ", 2); /* offset */
2733 printllval(tcp, "%llu", argn); /* len */
2738 #ifndef SWAP_FLAG_PREFER
2739 # define SWAP_FLAG_PREFER 0x8000
2741 #ifndef SWAP_FLAG_DISCARD
2742 # define SWAP_FLAG_DISCARD 0x10000
2744 static const struct xlat swap_flags[] = {
2745 { SWAP_FLAG_PREFER, "SWAP_FLAG_PREFER" },
2746 { SWAP_FLAG_DISCARD, "SWAP_FLAG_DISCARD" },
2751 sys_swapon(struct tcb *tcp)
2753 if (entering(tcp)) {
2754 int flags = tcp->u_arg[1];
2755 printpath(tcp, tcp->u_arg[0]);
2757 printflags(swap_flags, flags & ~SWAP_FLAG_PRIO_MASK,
2759 if (flags & SWAP_FLAG_PREFER)
2760 tprintf("|%d", flags & SWAP_FLAG_PRIO_MASK);
2771 realprintstat64(struct tcb *tcp, long addr)
2773 struct stat64 statbuf;
2779 if (syserror(tcp) || !verbose(tcp)) {
2780 tprintf("%#lx", addr);
2784 if (umove(tcp, addr, &statbuf) < 0) {
2790 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
2791 (unsigned long) major(statbuf.st_dev),
2792 (unsigned long) minor(statbuf.st_dev),
2793 (unsigned long long) statbuf.st_ino,
2794 sprintmode(statbuf.st_mode));
2795 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
2796 (unsigned long) statbuf.st_nlink,
2797 (unsigned long) statbuf.st_uid,
2798 (unsigned long) statbuf.st_gid);
2799 tprintf("st_blksize=%lu, ",
2800 (unsigned long) statbuf.st_blksize);
2801 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
2804 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
2805 switch (statbuf.st_mode & S_IFMT) {
2806 case S_IFCHR: case S_IFBLK:
2807 tprintf("st_rdev=makedev(%lu, %lu), ",
2808 (unsigned long) major(statbuf.st_rdev),
2809 (unsigned long) minor(statbuf.st_rdev));
2812 tprintf("st_size=%llu, ", (unsigned long long) statbuf.st_size);
2816 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
2817 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
2818 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
2826 sys_fstat64(struct tcb *tcp)
2828 if (entering(tcp)) {
2829 printfd(tcp, tcp->u_arg[0]);
2832 realprintstat64(tcp, tcp->u_arg[1]);
2838 sys_stat64(struct tcb *tcp)
2840 if (entering(tcp)) {
2841 printpath(tcp, tcp->u_arg[0]);
2844 realprintstat64(tcp, tcp->u_arg[1]);