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]);
627 argn = printllval(tcp, "%lld", 1);
628 tprintf(", %ld", tcp->u_arg[argn]);
633 #ifndef HAVE_LONG_LONG_OFF_T
635 sys_truncate(struct tcb *tcp)
638 printpath(tcp, tcp->u_arg[0]);
639 tprintf(", %lu", tcp->u_arg[1]);
645 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
647 sys_truncate64(struct tcb *tcp)
650 printpath(tcp, tcp->u_arg[0]);
651 printllval(tcp, ", %llu", 1);
657 #ifndef HAVE_LONG_LONG_OFF_T
659 sys_ftruncate(struct tcb *tcp)
662 printfd(tcp, tcp->u_arg[0]);
663 tprintf(", %lu", tcp->u_arg[1]);
669 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
671 sys_ftruncate64(struct tcb *tcp)
674 printfd(tcp, tcp->u_arg[0]);
676 printllval(tcp, "%llu", 1);
684 static const struct xlat modetypes[] = {
685 { S_IFREG, "S_IFREG" },
686 { S_IFSOCK, "S_IFSOCK" },
687 { S_IFIFO, "S_IFIFO" },
688 { S_IFLNK, "S_IFLNK" },
689 { S_IFDIR, "S_IFDIR" },
690 { S_IFBLK, "S_IFBLK" },
691 { S_IFCHR, "S_IFCHR" },
698 static char buf[sizeof("S_IFSOCK|S_ISUID|S_ISGID|S_ISVTX|%o")
703 if ((mode & S_IFMT) == 0)
705 else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) {
706 sprintf(buf, "%#o", mode);
709 s = buf + sprintf(buf, "%s%s%s%s", s,
710 (mode & S_ISUID) ? "|S_ISUID" : "",
711 (mode & S_ISGID) ? "|S_ISGID" : "",
712 (mode & S_ISVTX) ? "|S_ISVTX" : "");
713 mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX);
715 sprintf((char*)s, "|%#o", mode);
716 s = (*buf == '|') ? buf + 1 : buf;
724 static char buf[sizeof("yyyy/mm/dd-hh:mm:ss")];
732 snprintf(buf, sizeof buf, "%02d/%02d/%02d-%02d:%02d:%02d",
733 tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
734 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
736 snprintf(buf, sizeof buf, "%lu", (unsigned long) t);
749 int st_pad1[3]; /* network id */
758 int st_pad3; /* st_size, off_t expansion */
759 timestruct_t st_atime;
760 timestruct_t st_mtime;
761 timestruct_t st_ctime;
765 int st_pad4[8]; /* expansion area */
769 printstatsol(struct tcb *tcp, long addr)
771 struct solstat statbuf;
773 if (umove(tcp, addr, &statbuf) < 0) {
778 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
779 (unsigned long) ((statbuf.st_dev >> 18) & 0x3fff),
780 (unsigned long) (statbuf.st_dev & 0x3ffff),
781 (unsigned long) statbuf.st_ino,
782 sprintmode(statbuf.st_mode));
783 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
784 (unsigned long) statbuf.st_nlink,
785 (unsigned long) statbuf.st_uid,
786 (unsigned long) statbuf.st_gid);
787 tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);
788 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
791 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
792 switch (statbuf.st_mode & S_IFMT) {
793 case S_IFCHR: case S_IFBLK:
794 tprintf("st_rdev=makedev(%lu, %lu), ",
795 (unsigned long) ((statbuf.st_rdev >> 18) & 0x3fff),
796 (unsigned long) (statbuf.st_rdev & 0x3ffff));
799 tprintf("st_size=%u, ", statbuf.st_size);
803 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime.tv_sec));
804 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime.tv_sec));
805 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime.tv_sec));
813 printstat_sparc64(struct tcb *tcp, long addr)
815 struct stat_sparc64 statbuf;
817 if (umove(tcp, addr, &statbuf) < 0) {
823 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
824 (unsigned long) major(statbuf.st_dev),
825 (unsigned long) minor(statbuf.st_dev),
826 (unsigned long) statbuf.st_ino,
827 sprintmode(statbuf.st_mode));
828 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
829 (unsigned long) statbuf.st_nlink,
830 (unsigned long) statbuf.st_uid,
831 (unsigned long) statbuf.st_gid);
832 tprintf("st_blksize=%lu, ",
833 (unsigned long) statbuf.st_blksize);
834 tprintf("st_blocks=%lu, ",
835 (unsigned long) statbuf.st_blocks);
838 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
839 switch (statbuf.st_mode & S_IFMT) {
840 case S_IFCHR: case S_IFBLK:
841 tprintf("st_rdev=makedev(%lu, %lu), ",
842 (unsigned long) major(statbuf.st_rdev),
843 (unsigned long) minor(statbuf.st_rdev));
846 tprintf("st_size=%lu, ", statbuf.st_size);
850 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
851 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
852 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
858 #endif /* LINUXSPARC */
860 #if defined POWERPC64
861 struct stat_powerpc32 {
864 unsigned int st_mode;
865 unsigned short st_nlink;
868 unsigned int st_rdev;
869 unsigned int st_size;
870 unsigned int st_blksize;
871 unsigned int st_blocks;
872 unsigned int st_atime;
873 unsigned int st_atime_nsec;
874 unsigned int st_mtime;
875 unsigned int st_mtime_nsec;
876 unsigned int st_ctime;
877 unsigned int st_ctime_nsec;
878 unsigned int __unused4;
879 unsigned int __unused5;
883 printstat_powerpc32(struct tcb *tcp, long addr)
885 struct stat_powerpc32 statbuf;
887 if (umove(tcp, addr, &statbuf) < 0) {
893 tprintf("{st_dev=makedev(%u, %u), st_ino=%u, st_mode=%s, ",
894 major(statbuf.st_dev), minor(statbuf.st_dev),
896 sprintmode(statbuf.st_mode));
897 tprintf("st_nlink=%u, st_uid=%u, st_gid=%u, ",
898 statbuf.st_nlink, statbuf.st_uid, statbuf.st_gid);
899 tprintf("st_blksize=%u, ", statbuf.st_blksize);
900 tprintf("st_blocks=%u, ", statbuf.st_blocks);
903 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
904 switch (statbuf.st_mode & S_IFMT) {
905 case S_IFCHR: case S_IFBLK:
906 tprintf("st_rdev=makedev(%lu, %lu), ",
907 (unsigned long) major(statbuf.st_rdev),
908 (unsigned long) minor(statbuf.st_rdev));
911 tprintf("st_size=%u, ", statbuf.st_size);
915 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
916 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
917 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
922 #endif /* POWERPC64 */
924 static const struct xlat fileflags[] = {
928 #ifndef HAVE_LONG_LONG_OFF_T
930 realprintstat(struct tcb *tcp, struct stat *statbuf)
933 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
934 (unsigned long) major(statbuf->st_dev),
935 (unsigned long) minor(statbuf->st_dev),
936 (unsigned long) statbuf->st_ino,
937 sprintmode(statbuf->st_mode));
938 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
939 (unsigned long) statbuf->st_nlink,
940 (unsigned long) statbuf->st_uid,
941 (unsigned long) statbuf->st_gid);
942 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
943 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
945 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
946 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
950 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
951 switch (statbuf->st_mode & S_IFMT) {
952 case S_IFCHR: case S_IFBLK:
953 #ifdef HAVE_STRUCT_STAT_ST_RDEV
954 tprintf("st_rdev=makedev(%lu, %lu), ",
955 (unsigned long) major(statbuf->st_rdev),
956 (unsigned long) minor(statbuf->st_rdev));
957 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
958 tprintf("st_size=makedev(%lu, %lu), ",
959 (unsigned long) major(statbuf->st_size),
960 (unsigned long) minor(statbuf->st_size));
961 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
964 tprintf("st_size=%lu, ", (unsigned long) statbuf->st_size);
968 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
969 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
970 tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));
971 #if HAVE_STRUCT_STAT_ST_FLAGS
972 tprints(", st_flags=");
973 printflags(fileflags, statbuf->st_flags, "UF_???");
975 #if HAVE_STRUCT_STAT_ST_ACLCNT
976 tprintf(", st_aclcnt=%d", statbuf->st_aclcnt);
978 #if HAVE_STRUCT_STAT_ST_LEVEL
979 tprintf(", st_level=%ld", statbuf->st_level);
981 #if HAVE_STRUCT_STAT_ST_FSTYPE
982 tprintf(", st_fstype=%.*s",
983 (int) sizeof statbuf->st_fstype, statbuf->st_fstype);
985 #if HAVE_STRUCT_STAT_ST_GEN
986 tprintf(", st_gen=%u", statbuf->st_gen);
995 printstat(struct tcb *tcp, long addr)
1003 if (syserror(tcp) || !verbose(tcp)) {
1004 tprintf("%#lx", addr);
1009 if (current_personality == 1) {
1010 printstatsol(tcp, addr);
1014 else if (current_personality == 2) {
1015 printstat_sparc64(tcp, addr);
1019 #endif /* LINUXSPARC */
1021 #if defined POWERPC64
1022 if (current_personality == 1) {
1023 printstat_powerpc32(tcp, addr);
1028 if (umove(tcp, addr, &statbuf) < 0) {
1033 realprintstat(tcp, &statbuf);
1035 #endif /* !HAVE_LONG_LONG_OFF_T */
1037 #if !defined HAVE_STAT64 && defined X86_64
1039 * Linux x86_64 has unified `struct stat' but its i386 biarch needs
1040 * `struct stat64'. Its <asm-i386/stat.h> definition expects 32-bit `long'.
1041 * <linux/include/asm-x86_64/ia32.h> is not in the public includes set.
1042 * __GNUC__ is needed for the required __attribute__ below.
1045 unsigned long long st_dev;
1046 unsigned char __pad0[4];
1047 unsigned int __st_ino;
1048 unsigned int st_mode;
1049 unsigned int st_nlink;
1050 unsigned int st_uid;
1051 unsigned int st_gid;
1052 unsigned long long st_rdev;
1053 unsigned char __pad3[4];
1055 unsigned int st_blksize;
1056 unsigned long long st_blocks;
1057 unsigned int st_atime;
1058 unsigned int st_atime_nsec;
1059 unsigned int st_mtime;
1060 unsigned int st_mtime_nsec;
1061 unsigned int st_ctime;
1062 unsigned int st_ctime_nsec;
1063 unsigned long long st_ino;
1064 } __attribute__((packed));
1065 # define HAVE_STAT64 1
1066 # define STAT64_SIZE 96
1071 printstat64(struct tcb *tcp, long addr)
1073 struct stat64 statbuf;
1076 (void) sizeof(char[sizeof statbuf == STAT64_SIZE ? 1 : -1]);
1083 if (syserror(tcp) || !verbose(tcp)) {
1084 tprintf("%#lx", addr);
1089 if (current_personality == 1) {
1090 printstatsol(tcp, addr);
1094 else if (current_personality == 2) {
1095 printstat_sparc64(tcp, addr);
1099 #endif /* LINUXSPARC */
1102 if (current_personality != 1) {
1103 printstat(tcp, addr);
1108 if (umove(tcp, addr, &statbuf) < 0) {
1114 #ifdef HAVE_LONG_LONG
1115 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
1117 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
1119 (unsigned long) major(statbuf.st_dev),
1120 (unsigned long) minor(statbuf.st_dev),
1121 #ifdef HAVE_LONG_LONG
1122 (unsigned long long) statbuf.st_ino,
1124 (unsigned long) statbuf.st_ino,
1126 sprintmode(statbuf.st_mode));
1127 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
1128 (unsigned long) statbuf.st_nlink,
1129 (unsigned long) statbuf.st_uid,
1130 (unsigned long) statbuf.st_gid);
1131 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
1132 tprintf("st_blksize=%lu, ",
1133 (unsigned long) statbuf.st_blksize);
1134 #endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */
1135 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
1136 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
1137 #endif /* HAVE_STRUCT_STAT_ST_BLOCKS */
1140 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
1141 switch (statbuf.st_mode & S_IFMT) {
1142 case S_IFCHR: case S_IFBLK:
1143 #ifdef HAVE_STRUCT_STAT_ST_RDEV
1144 tprintf("st_rdev=makedev(%lu, %lu), ",
1145 (unsigned long) major(statbuf.st_rdev),
1146 (unsigned long) minor(statbuf.st_rdev));
1147 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
1148 tprintf("st_size=makedev(%lu, %lu), ",
1149 (unsigned long) major(statbuf.st_size),
1150 (unsigned long) minor(statbuf.st_size));
1151 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
1154 #ifdef HAVE_LONG_LONG
1155 tprintf("st_size=%llu, ", (unsigned long long) statbuf.st_size);
1157 tprintf("st_size=%lu, ", (unsigned long) statbuf.st_size);
1162 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
1163 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
1164 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
1165 #if HAVE_STRUCT_STAT_ST_FLAGS
1166 tprints(", st_flags=");
1167 printflags(fileflags, statbuf.st_flags, "UF_???");
1169 #if HAVE_STRUCT_STAT_ST_ACLCNT
1170 tprintf(", st_aclcnt=%d", statbuf.st_aclcnt);
1172 #if HAVE_STRUCT_STAT_ST_LEVEL
1173 tprintf(", st_level=%ld", statbuf.st_level);
1175 #if HAVE_STRUCT_STAT_ST_FSTYPE
1176 tprintf(", st_fstype=%.*s",
1177 (int) sizeof statbuf.st_fstype, statbuf.st_fstype);
1179 #if HAVE_STRUCT_STAT_ST_GEN
1180 tprintf(", st_gen=%u", statbuf.st_gen);
1187 #endif /* HAVE_STAT64 */
1189 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
1191 convertoldstat(const struct __old_kernel_stat *oldbuf, struct stat *newbuf)
1193 newbuf->st_dev = oldbuf->st_dev;
1194 newbuf->st_ino = oldbuf->st_ino;
1195 newbuf->st_mode = oldbuf->st_mode;
1196 newbuf->st_nlink = oldbuf->st_nlink;
1197 newbuf->st_uid = oldbuf->st_uid;
1198 newbuf->st_gid = oldbuf->st_gid;
1199 newbuf->st_rdev = oldbuf->st_rdev;
1200 newbuf->st_size = oldbuf->st_size;
1201 newbuf->st_atime = oldbuf->st_atime;
1202 newbuf->st_mtime = oldbuf->st_mtime;
1203 newbuf->st_ctime = oldbuf->st_ctime;
1204 newbuf->st_blksize = 0; /* not supported in old_stat */
1205 newbuf->st_blocks = 0; /* not supported in old_stat */
1209 printoldstat(struct tcb *tcp, long addr)
1211 struct __old_kernel_stat statbuf;
1212 struct stat newstatbuf;
1218 if (syserror(tcp) || !verbose(tcp)) {
1219 tprintf("%#lx", addr);
1224 if (current_personality == 1) {
1225 printstatsol(tcp, addr);
1230 if (umove(tcp, addr, &statbuf) < 0) {
1235 convertoldstat(&statbuf, &newstatbuf);
1236 realprintstat(tcp, &newstatbuf);
1240 #ifndef HAVE_LONG_LONG_OFF_T
1242 sys_stat(struct tcb *tcp)
1244 if (entering(tcp)) {
1245 printpath(tcp, tcp->u_arg[0]);
1248 printstat(tcp, tcp->u_arg[1]);
1255 sys_stat64(struct tcb *tcp)
1258 if (entering(tcp)) {
1259 printpath(tcp, tcp->u_arg[0]);
1262 printstat64(tcp, tcp->u_arg[1]);
1266 return printargs(tcp);
1270 #ifndef AT_SYMLINK_NOFOLLOW
1271 # define AT_SYMLINK_NOFOLLOW 0x100
1273 #ifndef AT_REMOVEDIR
1274 # define AT_REMOVEDIR 0x200
1276 #ifndef AT_SYMLINK_FOLLOW
1277 # define AT_SYMLINK_FOLLOW 0x400
1279 #ifndef AT_NO_AUTOMOUNT
1280 # define AT_NO_AUTOMOUNT 0x800
1282 #ifndef AT_EMPTY_PATH
1283 # define AT_EMPTY_PATH 0x1000
1286 static const struct xlat at_flags[] = {
1287 { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" },
1288 { AT_REMOVEDIR, "AT_REMOVEDIR" },
1289 { AT_SYMLINK_FOLLOW, "AT_SYMLINK_FOLLOW" },
1290 { AT_NO_AUTOMOUNT, "AT_NO_AUTOMOUNT" },
1291 { AT_EMPTY_PATH, "AT_EMPTY_PATH" },
1296 sys_newfstatat(struct tcb *tcp)
1298 if (entering(tcp)) {
1299 print_dirfd(tcp, tcp->u_arg[0]);
1300 printpath(tcp, tcp->u_arg[1]);
1304 if (current_personality == 0)
1305 printstat(tcp, tcp->u_arg[2]);
1307 printstat64(tcp, tcp->u_arg[2]);
1308 #elif defined HAVE_STAT64
1309 printstat64(tcp, tcp->u_arg[2]);
1311 printstat(tcp, tcp->u_arg[2]);
1314 printflags(at_flags, tcp->u_arg[3], "AT_???");
1319 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
1321 sys_oldstat(struct tcb *tcp)
1323 if (entering(tcp)) {
1324 printpath(tcp, tcp->u_arg[0]);
1327 printoldstat(tcp, tcp->u_arg[1]);
1333 #ifndef HAVE_LONG_LONG_OFF_T
1335 sys_fstat(struct tcb *tcp)
1337 if (entering(tcp)) {
1338 printfd(tcp, tcp->u_arg[0]);
1341 printstat(tcp, tcp->u_arg[1]);
1348 sys_fstat64(struct tcb *tcp)
1351 if (entering(tcp)) {
1352 printfd(tcp, tcp->u_arg[0]);
1355 printstat64(tcp, tcp->u_arg[1]);
1359 return printargs(tcp);
1363 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
1365 sys_oldfstat(struct tcb *tcp)
1367 if (entering(tcp)) {
1368 printfd(tcp, tcp->u_arg[0]);
1371 printoldstat(tcp, tcp->u_arg[1]);
1377 #ifndef HAVE_LONG_LONG_OFF_T
1379 sys_lstat(struct tcb *tcp)
1381 if (entering(tcp)) {
1382 printpath(tcp, tcp->u_arg[0]);
1385 printstat(tcp, tcp->u_arg[1]);
1392 sys_lstat64(struct tcb *tcp)
1395 if (entering(tcp)) {
1396 printpath(tcp, tcp->u_arg[0]);
1399 printstat64(tcp, tcp->u_arg[1]);
1403 return printargs(tcp);
1407 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
1409 sys_oldlstat(struct tcb *tcp)
1411 if (entering(tcp)) {
1412 printpath(tcp, tcp->u_arg[0]);
1415 printoldstat(tcp, tcp->u_arg[1]);
1421 #if defined(LINUXSPARC)
1424 sys_xstat(struct tcb *tcp)
1426 if (entering(tcp)) {
1427 tprintf("%ld, ", tcp->u_arg[0]);
1428 printpath(tcp, tcp->u_arg[1]);
1432 if (tcp->u_arg[0] == _STAT64_VER)
1433 printstat64(tcp, tcp->u_arg[2]);
1436 printstat(tcp, tcp->u_arg[2]);
1442 sys_fxstat(struct tcb *tcp)
1445 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
1448 if (tcp->u_arg[0] == _STAT64_VER)
1449 printstat64(tcp, tcp->u_arg[2]);
1452 printstat(tcp, tcp->u_arg[2]);
1458 sys_lxstat(struct tcb *tcp)
1460 if (entering(tcp)) {
1461 tprintf("%ld, ", tcp->u_arg[0]);
1462 printpath(tcp, tcp->u_arg[1]);
1466 if (tcp->u_arg[0] == _STAT64_VER)
1467 printstat64(tcp, tcp->u_arg[2]);
1470 printstat(tcp, tcp->u_arg[2]);
1476 sys_xmknod(struct tcb *tcp)
1478 int mode = tcp->u_arg[2];
1480 if (entering(tcp)) {
1481 tprintf("%ld, ", tcp->u_arg[0]);
1482 printpath(tcp, tcp->u_arg[1]);
1483 tprintf(", %s", sprintmode(mode));
1484 switch (mode & S_IFMT) {
1485 case S_IFCHR: case S_IFBLK:
1486 tprintf(", makedev(%lu, %lu)",
1487 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
1488 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
1497 # ifdef HAVE_SYS_ACL_H
1499 # include <sys/acl.h>
1501 static const struct xlat aclcmds[] = {
1503 { SETACL, "SETACL" },
1506 { GETACL, "GETACL" },
1509 { GETACLCNT, "GETACLCNT" },
1512 { ACL_GET, "ACL_GET" },
1515 { ACL_SET, "ACL_SET" },
1518 { ACL_CNT, "ACL_CNT" },
1524 sys_acl(struct tcb *tcp)
1526 if (entering(tcp)) {
1527 printpath(tcp, tcp->u_arg[0]);
1529 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1530 tprintf(", %ld", tcp->u_arg[2]);
1532 * FIXME - dump out the list of aclent_t's pointed to
1533 * by "tcp->u_arg[3]" if it's not NULL.
1536 tprintf(", %#lx", tcp->u_arg[3]);
1544 sys_facl(struct tcb *tcp)
1546 if (entering(tcp)) {
1547 tprintf("%ld, ", tcp->u_arg[0]);
1548 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1549 tprintf(", %ld", tcp->u_arg[2]);
1551 * FIXME - dump out the list of aclent_t's pointed to
1552 * by "tcp->u_arg[3]" if it's not NULL.
1555 tprintf(", %#lx", tcp->u_arg[3]);
1562 static const struct xlat aclipc[] = {
1564 { IPC_SHM, "IPC_SHM" },
1567 { IPC_SEM, "IPC_SEM" },
1570 { IPC_MSG, "IPC_MSG" },
1576 sys_aclipc(struct tcb *tcp)
1578 if (entering(tcp)) {
1579 printxval(aclipc, tcp->u_arg[0], "???IPC???");
1580 tprintf(", %#lx, ", tcp->u_arg[1]);
1581 printxval(aclcmds, tcp->u_arg[2], "???ACL???");
1582 tprintf(", %ld", tcp->u_arg[3]);
1584 * FIXME - dump out the list of aclent_t's pointed to
1585 * by "tcp->u_arg[4]" if it's not NULL.
1588 tprintf(", %#lx", tcp->u_arg[4]);
1595 # endif /* HAVE_SYS_ACL_H */
1597 #endif /* LINUXSPARC */
1599 static const struct xlat fsmagic[] = {
1600 { 0x73757245, "CODA_SUPER_MAGIC" },
1601 { 0x012ff7b7, "COH_SUPER_MAGIC" },
1602 { 0x1373, "DEVFS_SUPER_MAGIC" },
1603 { 0x1cd1, "DEVPTS_SUPER_MAGIC" },
1604 { 0x414A53, "EFS_SUPER_MAGIC" },
1605 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
1606 { 0xef53, "EXT2_SUPER_MAGIC" },
1607 { 0x137d, "EXT_SUPER_MAGIC" },
1608 { 0xf995e849, "HPFS_SUPER_MAGIC" },
1609 { 0x9660, "ISOFS_SUPER_MAGIC" },
1610 { 0x137f, "MINIX_SUPER_MAGIC" },
1611 { 0x138f, "MINIX_SUPER_MAGIC2" },
1612 { 0x2468, "MINIX2_SUPER_MAGIC" },
1613 { 0x2478, "MINIX2_SUPER_MAGIC2" },
1614 { 0x4d44, "MSDOS_SUPER_MAGIC" },
1615 { 0x564c, "NCP_SUPER_MAGIC" },
1616 { 0x6969, "NFS_SUPER_MAGIC" },
1617 { 0x9fa0, "PROC_SUPER_MAGIC" },
1618 { 0x002f, "QNX4_SUPER_MAGIC" },
1619 { 0x52654973, "REISERFS_SUPER_MAGIC" },
1620 { 0x02011994, "SHMFS_SUPER_MAGIC" },
1621 { 0x517b, "SMB_SUPER_MAGIC" },
1622 { 0x012ff7b6, "SYSV2_SUPER_MAGIC" },
1623 { 0x012ff7b5, "SYSV4_SUPER_MAGIC" },
1624 { 0x00011954, "UFS_MAGIC" },
1625 { 0x54190100, "UFS_CIGAM" },
1626 { 0x012ff7b4, "XENIX_SUPER_MAGIC" },
1627 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
1628 { 0x62656572, "SYSFS_MAGIC" },
1633 sprintfstype(int magic)
1635 static char buf[32];
1638 s = xlookup(fsmagic, magic);
1640 sprintf(buf, "\"%s\"", s);
1643 sprintf(buf, "%#x", magic);
1648 printstatfs(struct tcb *tcp, long addr)
1650 struct statfs statbuf;
1652 if (syserror(tcp) || !verbose(tcp)) {
1653 tprintf("%#lx", addr);
1656 if (umove(tcp, addr, &statbuf) < 0) {
1662 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
1663 sprintfstype(statbuf.f_type),
1664 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
1665 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_fsid={%d, %d}, f_namelen=%u",
1666 statbuf.f_bavail, statbuf.f_files, statbuf.f_ffree,
1667 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1],
1670 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
1671 sprintfstype(statbuf.f_type),
1672 (unsigned long)statbuf.f_bsize,
1673 (unsigned long)statbuf.f_blocks,
1674 (unsigned long)statbuf.f_bfree);
1675 tprintf("f_bavail=%lu, f_files=%lu, f_ffree=%lu, f_fsid={%d, %d}",
1676 (unsigned long)statbuf.f_bavail,
1677 (unsigned long)statbuf.f_files,
1678 (unsigned long)statbuf.f_ffree,
1679 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1680 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1682 #ifdef _STATFS_F_FRSIZE
1683 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
1689 sys_statfs(struct tcb *tcp)
1691 if (entering(tcp)) {
1692 printpath(tcp, tcp->u_arg[0]);
1695 printstatfs(tcp, tcp->u_arg[1]);
1701 sys_fstatfs(struct tcb *tcp)
1703 if (entering(tcp)) {
1704 printfd(tcp, tcp->u_arg[0]);
1707 printstatfs(tcp, tcp->u_arg[1]);
1712 #if defined HAVE_STATFS64
1714 printstatfs64(struct tcb *tcp, long addr)
1716 struct statfs64 statbuf;
1718 if (syserror(tcp) || !verbose(tcp)) {
1719 tprintf("%#lx", addr);
1722 if (umove(tcp, addr, &statbuf) < 0) {
1726 tprintf("{f_type=%s, f_bsize=%llu, f_blocks=%llu, f_bfree=%llu, ",
1727 sprintfstype(statbuf.f_type),
1728 (unsigned long long)statbuf.f_bsize,
1729 (unsigned long long)statbuf.f_blocks,
1730 (unsigned long long)statbuf.f_bfree);
1731 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
1732 (unsigned long long)statbuf.f_bavail,
1733 (unsigned long long)statbuf.f_files,
1734 (unsigned long long)statbuf.f_ffree,
1735 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1736 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1737 #ifdef _STATFS_F_FRSIZE
1738 tprintf(", f_frsize=%llu", (unsigned long long)statbuf.f_frsize);
1740 #ifdef _STATFS_F_FLAGS
1741 tprintf(", f_flags=%llu", (unsigned long long)statbuf.f_flags);
1746 struct compat_statfs64 {
1758 uint32_t f_spare[4];
1760 #if defined(X86_64) || defined(IA64)
1761 __attribute__ ((packed, aligned(4)))
1766 printcompat_statfs64(struct tcb *tcp, long addr)
1768 struct compat_statfs64 statbuf;
1770 if (syserror(tcp) || !verbose(tcp)) {
1771 tprintf("%#lx", addr);
1774 if (umove(tcp, addr, &statbuf) < 0) {
1778 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%llu, f_bfree=%llu, ",
1779 sprintfstype(statbuf.f_type),
1780 (unsigned long)statbuf.f_bsize,
1781 (unsigned long long)statbuf.f_blocks,
1782 (unsigned long long)statbuf.f_bfree);
1783 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
1784 (unsigned long long)statbuf.f_bavail,
1785 (unsigned long long)statbuf.f_files,
1786 (unsigned long long)statbuf.f_ffree,
1787 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1788 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1789 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
1790 tprintf(", f_flags=%lu}", (unsigned long)statbuf.f_frsize);
1794 sys_statfs64(struct tcb *tcp)
1796 if (entering(tcp)) {
1797 printpath(tcp, tcp->u_arg[0]);
1798 tprintf(", %lu, ", tcp->u_arg[1]);
1800 if (tcp->u_arg[1] == sizeof(struct statfs64))
1801 printstatfs64(tcp, tcp->u_arg[2]);
1802 else if (tcp->u_arg[1] == sizeof(struct compat_statfs64))
1803 printcompat_statfs64(tcp, tcp->u_arg[2]);
1811 sys_fstatfs64(struct tcb *tcp)
1813 if (entering(tcp)) {
1814 printfd(tcp, tcp->u_arg[0]);
1815 tprintf(", %lu, ", tcp->u_arg[1]);
1817 if (tcp->u_arg[1] == sizeof(struct statfs64))
1818 printstatfs64(tcp, tcp->u_arg[2]);
1819 else if (tcp->u_arg[1] == sizeof(struct compat_statfs64))
1820 printcompat_statfs64(tcp, tcp->u_arg[2]);
1830 osf_statfs(struct tcb *tcp)
1832 if (entering(tcp)) {
1833 printpath(tcp, tcp->u_arg[0]);
1836 printstatfs(tcp, tcp->u_arg[1]);
1837 tprintf(", %lu", tcp->u_arg[2]);
1843 osf_fstatfs(struct tcb *tcp)
1845 if (entering(tcp)) {
1846 tprintf("%lu, ", tcp->u_arg[0]);
1848 printstatfs(tcp, tcp->u_arg[1]);
1849 tprintf(", %lu", tcp->u_arg[2]);
1857 sys_chdir(struct tcb *tcp)
1859 if (entering(tcp)) {
1860 printpath(tcp, tcp->u_arg[0]);
1866 decode_mkdir(struct tcb *tcp, int offset)
1868 if (entering(tcp)) {
1869 printpath(tcp, tcp->u_arg[offset]);
1870 tprintf(", %#lo", tcp->u_arg[offset + 1]);
1876 sys_mkdir(struct tcb *tcp)
1878 return decode_mkdir(tcp, 0);
1882 sys_mkdirat(struct tcb *tcp)
1885 print_dirfd(tcp, tcp->u_arg[0]);
1886 return decode_mkdir(tcp, 1);
1890 sys_link(struct tcb *tcp)
1892 if (entering(tcp)) {
1893 printpath(tcp, tcp->u_arg[0]);
1895 printpath(tcp, tcp->u_arg[1]);
1901 sys_linkat(struct tcb *tcp)
1903 if (entering(tcp)) {
1904 print_dirfd(tcp, tcp->u_arg[0]);
1905 printpath(tcp, tcp->u_arg[1]);
1907 print_dirfd(tcp, tcp->u_arg[2]);
1908 printpath(tcp, tcp->u_arg[3]);
1910 printflags(at_flags, tcp->u_arg[4], "AT_???");
1916 sys_unlinkat(struct tcb *tcp)
1918 if (entering(tcp)) {
1919 print_dirfd(tcp, tcp->u_arg[0]);
1920 printpath(tcp, tcp->u_arg[1]);
1922 printflags(at_flags, tcp->u_arg[2], "AT_???");
1928 sys_symlinkat(struct tcb *tcp)
1930 if (entering(tcp)) {
1931 printpath(tcp, tcp->u_arg[0]);
1933 print_dirfd(tcp, tcp->u_arg[1]);
1934 printpath(tcp, tcp->u_arg[2]);
1940 decode_readlink(struct tcb *tcp, int offset)
1942 if (entering(tcp)) {
1943 printpath(tcp, tcp->u_arg[offset]);
1947 tprintf("%#lx", tcp->u_arg[offset + 1]);
1949 /* Used to use printpathn(), but readlink
1950 * neither includes NUL in the returned count,
1951 * nor actually writes it into memory.
1952 * printpathn() would decide on printing
1953 * "..." continuation based on garbage
1954 * past return buffer's end.
1956 printstr(tcp, tcp->u_arg[offset + 1], tcp->u_rval);
1957 tprintf(", %lu", tcp->u_arg[offset + 2]);
1963 sys_readlink(struct tcb *tcp)
1965 return decode_readlink(tcp, 0);
1969 sys_readlinkat(struct tcb *tcp)
1972 print_dirfd(tcp, tcp->u_arg[0]);
1973 return decode_readlink(tcp, 1);
1977 sys_renameat(struct tcb *tcp)
1979 if (entering(tcp)) {
1980 print_dirfd(tcp, tcp->u_arg[0]);
1981 printpath(tcp, tcp->u_arg[1]);
1983 print_dirfd(tcp, tcp->u_arg[2]);
1984 printpath(tcp, tcp->u_arg[3]);
1990 sys_chown(struct tcb *tcp)
1992 if (entering(tcp)) {
1993 printpath(tcp, tcp->u_arg[0]);
1994 printuid(", ", tcp->u_arg[1]);
1995 printuid(", ", tcp->u_arg[2]);
2001 sys_fchownat(struct tcb *tcp)
2003 if (entering(tcp)) {
2004 print_dirfd(tcp, tcp->u_arg[0]);
2005 printpath(tcp, tcp->u_arg[1]);
2006 printuid(", ", tcp->u_arg[2]);
2007 printuid(", ", tcp->u_arg[3]);
2009 printflags(at_flags, tcp->u_arg[4], "AT_???");
2015 sys_fchown(struct tcb *tcp)
2017 if (entering(tcp)) {
2018 printfd(tcp, tcp->u_arg[0]);
2019 printuid(", ", tcp->u_arg[1]);
2020 printuid(", ", tcp->u_arg[2]);
2026 decode_chmod(struct tcb *tcp, int offset)
2028 if (entering(tcp)) {
2029 printpath(tcp, tcp->u_arg[offset]);
2030 tprintf(", %#lo", tcp->u_arg[offset + 1]);
2036 sys_chmod(struct tcb *tcp)
2038 return decode_chmod(tcp, 0);
2042 sys_fchmodat(struct tcb *tcp)
2045 print_dirfd(tcp, tcp->u_arg[0]);
2046 return decode_chmod(tcp, 1);
2050 sys_fchmod(struct tcb *tcp)
2052 if (entering(tcp)) {
2053 printfd(tcp, tcp->u_arg[0]);
2054 tprintf(", %#lo", tcp->u_arg[1]);
2061 sys_osf_utimes(struct tcb *tcp)
2063 if (entering(tcp)) {
2064 printpath(tcp, tcp->u_arg[0]);
2066 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
2073 decode_utimes(struct tcb *tcp, int offset, int special)
2075 if (entering(tcp)) {
2076 printpath(tcp, tcp->u_arg[offset]);
2078 if (tcp->u_arg[offset + 1] == 0)
2082 printtv_bitness(tcp, tcp->u_arg[offset + 1],
2083 BITNESS_CURRENT, special);
2085 printtv_bitness(tcp, tcp->u_arg[offset + 1]
2086 + sizeof(struct timeval),
2087 BITNESS_CURRENT, special);
2095 sys_utimes(struct tcb *tcp)
2097 return decode_utimes(tcp, 0, 0);
2101 sys_futimesat(struct tcb *tcp)
2104 print_dirfd(tcp, tcp->u_arg[0]);
2105 return decode_utimes(tcp, 1, 0);
2109 sys_utimensat(struct tcb *tcp)
2111 if (entering(tcp)) {
2112 print_dirfd(tcp, tcp->u_arg[0]);
2113 decode_utimes(tcp, 1, 1);
2115 printflags(at_flags, tcp->u_arg[3], "AT_???");
2121 sys_utime(struct tcb *tcp)
2127 unsigned wordsize = current_wordsize;
2129 if (entering(tcp)) {
2130 printpath(tcp, tcp->u_arg[0]);
2134 else if (!verbose(tcp))
2135 tprintf("%#lx", tcp->u_arg[1]);
2136 else if (umoven(tcp, tcp->u_arg[1], 2 * wordsize, (char *) &u) < 0)
2138 else if (wordsize == sizeof u.utl[0]) {
2139 tprintf("[%s,", sprinttime(u.utl[0]));
2140 tprintf(" %s]", sprinttime(u.utl[1]));
2142 else if (wordsize == sizeof u.uti[0]) {
2143 tprintf("[%s,", sprinttime(u.uti[0]));
2144 tprintf(" %s]", sprinttime(u.uti[1]));
2153 decode_mknod(struct tcb *tcp, int offset)
2155 int mode = tcp->u_arg[offset + 1];
2157 if (entering(tcp)) {
2158 printpath(tcp, tcp->u_arg[offset]);
2159 tprintf(", %s", sprintmode(mode));
2160 switch (mode & S_IFMT) {
2164 if (current_personality == 1)
2165 tprintf(", makedev(%lu, %lu)",
2166 (unsigned long) ((tcp->u_arg[offset + 2] >> 18) & 0x3fff),
2167 (unsigned long) (tcp->u_arg[offset + 2] & 0x3ffff));
2170 tprintf(", makedev(%lu, %lu)",
2171 (unsigned long) major(tcp->u_arg[offset + 2]),
2172 (unsigned long) minor(tcp->u_arg[offset + 2]));
2182 sys_mknod(struct tcb *tcp)
2184 return decode_mknod(tcp, 0);
2188 sys_mknodat(struct tcb *tcp)
2191 print_dirfd(tcp, tcp->u_arg[0]);
2192 return decode_mknod(tcp, 1);
2196 printdir(struct tcb *tcp, long addr)
2200 if (!verbose(tcp)) {
2201 tprintf("%#lx", addr);
2204 if (umove(tcp, addr, &d) < 0) {
2208 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
2210 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
2215 sys_readdir(struct tcb *tcp)
2217 if (entering(tcp)) {
2218 printfd(tcp, tcp->u_arg[0]);
2221 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
2222 tprintf("%#lx", tcp->u_arg[1]);
2224 printdir(tcp, tcp->u_arg[1]);
2225 /* Not much point in printing this out, it is always 1. */
2226 if (tcp->u_arg[2] != 1)
2227 tprintf(", %lu", tcp->u_arg[2]);
2232 static const struct xlat direnttypes[] = {
2233 { DT_UNKNOWN, "DT_UNKNOWN" },
2234 { DT_FIFO, "DT_FIFO" },
2235 { DT_CHR, "DT_CHR" },
2236 { DT_DIR, "DT_DIR" },
2237 { DT_BLK, "DT_BLK" },
2238 { DT_REG, "DT_REG" },
2239 { DT_LNK, "DT_LNK" },
2240 { DT_SOCK, "DT_SOCK" },
2241 { DT_WHT, "DT_WHT" },
2246 sys_getdents(struct tcb *tcp)
2248 int i, len, dents = 0;
2251 if (entering(tcp)) {
2252 printfd(tcp, tcp->u_arg[0]);
2256 if (syserror(tcp) || !verbose(tcp)) {
2257 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2261 /* Beware of insanely large or negative values in tcp->u_rval */
2262 if (tcp->u_rval > 1024*1024)
2264 if (tcp->u_rval < 0)
2266 buf = len ? malloc(len) : NULL;
2268 die_out_of_memory();
2269 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2270 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2276 for (i = 0; i < len;) {
2277 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
2279 tprintf("%s{d_ino=%lu, d_off=%lu, ",
2280 i ? " " : "", d->d_ino, d->d_off);
2281 tprintf("d_reclen=%u, d_name=\"%s\"}",
2282 d->d_reclen, d->d_name);
2285 tprints("/* d_reclen == 0, problem here */");
2294 tprintf("/* %u entries */", dents);
2295 tprintf(", %lu", tcp->u_arg[2]);
2300 #if _LFS64_LARGEFILE
2302 sys_getdents64(struct tcb *tcp)
2304 int i, len, dents = 0;
2307 if (entering(tcp)) {
2308 printfd(tcp, tcp->u_arg[0]);
2312 if (syserror(tcp) || !verbose(tcp)) {
2313 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2318 /* Beware of insanely large or negative tcp->u_rval */
2319 if (tcp->u_rval > 1024*1024)
2321 if (tcp->u_rval < 0)
2323 buf = len ? malloc(len) : NULL;
2325 die_out_of_memory();
2327 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2328 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2334 for (i = 0; i < len;) {
2335 struct dirent64 *d = (struct dirent64 *) &buf[i];
2337 tprintf("%s{d_ino=%" PRIu64 ", d_off=%" PRId64 ", ",
2342 printxval(direnttypes, d->d_type, "DT_???");
2344 tprintf("d_reclen=%u, d_name=\"%s\"}",
2345 d->d_reclen, d->d_name);
2348 tprints("/* d_reclen == 0, problem here */");
2357 tprintf("/* %u entries */", dents);
2358 tprintf(", %lu", tcp->u_arg[2]);
2365 sys_getcwd(struct tcb *tcp)
2369 tprintf("%#lx", tcp->u_arg[0]);
2371 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
2372 tprintf(", %lu", tcp->u_arg[1]);
2377 #ifdef HAVE_SYS_ASYNCH_H
2380 sys_aioread(struct tcb *tcp)
2382 struct aio_result_t res;
2384 if (entering(tcp)) {
2385 tprintf("%lu, ", tcp->u_arg[0]);
2388 tprintf("%#lx", tcp->u_arg[1]);
2390 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2391 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2392 printxval(whence, tcp->u_arg[4], "L_???");
2393 if (syserror(tcp) || tcp->u_arg[5] == 0
2394 || umove(tcp, tcp->u_arg[5], &res) < 0)
2395 tprintf(", %#lx", tcp->u_arg[5]);
2397 tprintf(", {aio_return %d aio_errno %d}",
2398 res.aio_return, res.aio_errno);
2404 sys_aiowrite(struct tcb *tcp)
2406 struct aio_result_t res;
2408 if (entering(tcp)) {
2409 tprintf("%lu, ", tcp->u_arg[0]);
2410 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2411 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2412 printxval(whence, tcp->u_arg[4], "L_???");
2415 if (tcp->u_arg[5] == 0)
2417 else if (syserror(tcp)
2418 || umove(tcp, tcp->u_arg[5], &res) < 0)
2419 tprintf(", %#lx", tcp->u_arg[5]);
2421 tprintf(", {aio_return %d aio_errno %d}",
2422 res.aio_return, res.aio_errno);
2428 sys_aiowait(struct tcb *tcp)
2431 printtv(tcp, tcp->u_arg[0]);
2436 sys_aiocancel(struct tcb *tcp)
2438 struct aio_result_t res;
2441 if (tcp->u_arg[0] == 0)
2443 else if (syserror(tcp)
2444 || umove(tcp, tcp->u_arg[0], &res) < 0)
2445 tprintf("%#lx", tcp->u_arg[0]);
2447 tprintf("{aio_return %d aio_errno %d}",
2448 res.aio_return, res.aio_errno);
2453 #endif /* HAVE_SYS_ASYNCH_H */
2455 static const struct xlat xattrflags[] = {
2457 { XATTR_CREATE, "XATTR_CREATE" },
2458 { XATTR_REPLACE, "XATTR_REPLACE" },
2464 print_xattr_val(struct tcb *tcp, int failed,
2466 unsigned long insize,
2470 unsigned long capacity = 4 * size + 1;
2471 unsigned char *buf = (capacity < size) ? NULL : malloc(capacity);
2472 if (buf == NULL || /* probably a bogus size argument */
2473 umoven(tcp, arg, size, (char *) &buf[3 * size]) < 0) {
2477 unsigned char *out = buf;
2478 unsigned char *in = &buf[3 * size];
2480 for (i = 0; i < size; ++i) {
2484 #define tohex(n) "0123456789abcdef"[n]
2487 *out++ = tohex(in[i] / 16);
2488 *out++ = tohex(in[i] % 16);
2491 /* Don't print terminating NUL if there is one. */
2492 if (i > 0 && in[i - 1] == '\0')
2495 tprintf(", \"%s\", %ld", buf, insize);
2500 tprintf(", 0x%lx, %ld", arg, insize);
2504 sys_setxattr(struct tcb *tcp)
2506 if (entering(tcp)) {
2507 printpath(tcp, tcp->u_arg[0]);
2509 printstr(tcp, tcp->u_arg[1], -1);
2510 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2512 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2518 sys_fsetxattr(struct tcb *tcp)
2520 if (entering(tcp)) {
2521 printfd(tcp, tcp->u_arg[0]);
2523 printstr(tcp, tcp->u_arg[1], -1);
2524 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2526 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2532 sys_getxattr(struct tcb *tcp)
2534 if (entering(tcp)) {
2535 printpath(tcp, tcp->u_arg[0]);
2537 printstr(tcp, tcp->u_arg[1], -1);
2539 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2546 sys_fgetxattr(struct tcb *tcp)
2548 if (entering(tcp)) {
2549 printfd(tcp, tcp->u_arg[0]);
2551 printstr(tcp, tcp->u_arg[1], -1);
2553 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2560 print_xattr_list(struct tcb *tcp, unsigned long addr, unsigned long size)
2562 if (syserror(tcp)) {
2563 tprintf("%#lx", addr);
2569 (size < tcp->u_rval) ? size : tcp->u_rval;
2570 printstr(tcp, addr, len);
2573 tprintf(", %lu", size);
2577 sys_listxattr(struct tcb *tcp)
2579 if (entering(tcp)) {
2580 printpath(tcp, tcp->u_arg[0]);
2583 print_xattr_list(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2589 sys_flistxattr(struct tcb *tcp)
2591 if (entering(tcp)) {
2592 printfd(tcp, tcp->u_arg[0]);
2595 print_xattr_list(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2601 sys_removexattr(struct tcb *tcp)
2603 if (entering(tcp)) {
2604 printpath(tcp, tcp->u_arg[0]);
2606 printstr(tcp, tcp->u_arg[1], -1);
2612 sys_fremovexattr(struct tcb *tcp)
2614 if (entering(tcp)) {
2615 printfd(tcp, tcp->u_arg[0]);
2617 printstr(tcp, tcp->u_arg[1], -1);
2622 static const struct xlat advise[] = {
2623 { POSIX_FADV_NORMAL, "POSIX_FADV_NORMAL" },
2624 { POSIX_FADV_RANDOM, "POSIX_FADV_RANDOM" },
2625 { POSIX_FADV_SEQUENTIAL, "POSIX_FADV_SEQUENTIAL" },
2626 { POSIX_FADV_WILLNEED, "POSIX_FADV_WILLNEED" },
2627 { POSIX_FADV_DONTNEED, "POSIX_FADV_DONTNEED" },
2628 { POSIX_FADV_NOREUSE, "POSIX_FADV_NOREUSE" },
2633 sys_fadvise64(struct tcb *tcp)
2635 if (entering(tcp)) {
2637 printfd(tcp, tcp->u_arg[0]);
2639 argn = printllval(tcp, "%lld", 1);
2640 tprintf(", %ld, ", tcp->u_arg[argn++]);
2641 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2647 sys_fadvise64_64(struct tcb *tcp)
2649 if (entering(tcp)) {
2651 printfd(tcp, tcp->u_arg[0]);
2653 #if defined ARM || defined POWERPC
2654 argn = printllval(tcp, "%lld, ", 2);
2656 argn = printllval(tcp, "%lld, ", 1);
2658 argn = printllval(tcp, "%lld, ", argn);
2659 #if defined ARM || defined POWERPC
2660 printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
2662 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2668 static const struct xlat inotify_modes[] = {
2669 { 0x00000001, "IN_ACCESS" },
2670 { 0x00000002, "IN_MODIFY" },
2671 { 0x00000004, "IN_ATTRIB" },
2672 { 0x00000008, "IN_CLOSE_WRITE"},
2673 { 0x00000010, "IN_CLOSE_NOWRITE"},
2674 { 0x00000020, "IN_OPEN" },
2675 { 0x00000040, "IN_MOVED_FROM" },
2676 { 0x00000080, "IN_MOVED_TO" },
2677 { 0x00000100, "IN_CREATE" },
2678 { 0x00000200, "IN_DELETE" },
2679 { 0x00000400, "IN_DELETE_SELF"},
2680 { 0x00000800, "IN_MOVE_SELF" },
2681 { 0x00002000, "IN_UNMOUNT" },
2682 { 0x00004000, "IN_Q_OVERFLOW" },
2683 { 0x00008000, "IN_IGNORED" },
2684 { 0x01000000, "IN_ONLYDIR" },
2685 { 0x02000000, "IN_DONT_FOLLOW"},
2686 { 0x20000000, "IN_MASK_ADD" },
2687 { 0x40000000, "IN_ISDIR" },
2688 { 0x80000000, "IN_ONESHOT" },
2692 static const struct xlat inotify_init_flags[] = {
2693 { 0x00000800, "IN_NONBLOCK" },
2694 { 0x00080000, "IN_CLOEXEC" },
2699 sys_inotify_add_watch(struct tcb *tcp)
2701 if (entering(tcp)) {
2702 printfd(tcp, tcp->u_arg[0]);
2704 printpath(tcp, tcp->u_arg[1]);
2706 printflags(inotify_modes, tcp->u_arg[2], "IN_???");
2712 sys_inotify_rm_watch(struct tcb *tcp)
2714 if (entering(tcp)) {
2715 printfd(tcp, tcp->u_arg[0]);
2716 tprintf(", %d", (int) tcp->u_arg[1]);
2722 sys_inotify_init1(struct tcb *tcp)
2725 printflags(inotify_init_flags, tcp->u_arg[0], "IN_???");
2730 sys_fallocate(struct tcb *tcp)
2732 if (entering(tcp)) {
2734 printfd(tcp, tcp->u_arg[0]); /* fd */
2736 tprintf("%#lo, ", tcp->u_arg[1]); /* mode */
2737 argn = printllval(tcp, "%llu, ", 2); /* offset */
2738 printllval(tcp, "%llu", argn); /* len */
2743 #ifndef SWAP_FLAG_PREFER
2744 # define SWAP_FLAG_PREFER 0x8000
2746 #ifndef SWAP_FLAG_DISCARD
2747 # define SWAP_FLAG_DISCARD 0x10000
2749 static const struct xlat swap_flags[] = {
2750 { SWAP_FLAG_PREFER, "SWAP_FLAG_PREFER" },
2751 { SWAP_FLAG_DISCARD, "SWAP_FLAG_DISCARD" },
2756 sys_swapon(struct tcb *tcp)
2758 if (entering(tcp)) {
2759 int flags = tcp->u_arg[1];
2760 printpath(tcp, tcp->u_arg[0]);
2762 printflags(swap_flags, flags & ~SWAP_FLAG_PRIO_MASK,
2764 if (flags & SWAP_FLAG_PREFER)
2765 tprintf("|%d", flags & SWAP_FLAG_PRIO_MASK);
2776 realprintstat64(struct tcb *tcp, long addr)
2778 struct stat64 statbuf;
2784 if (syserror(tcp) || !verbose(tcp)) {
2785 tprintf("%#lx", addr);
2789 if (umove(tcp, addr, &statbuf) < 0) {
2795 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
2796 (unsigned long) major(statbuf.st_dev),
2797 (unsigned long) minor(statbuf.st_dev),
2798 (unsigned long long) statbuf.st_ino,
2799 sprintmode(statbuf.st_mode));
2800 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
2801 (unsigned long) statbuf.st_nlink,
2802 (unsigned long) statbuf.st_uid,
2803 (unsigned long) statbuf.st_gid);
2804 tprintf("st_blksize=%lu, ",
2805 (unsigned long) statbuf.st_blksize);
2806 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
2809 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
2810 switch (statbuf.st_mode & S_IFMT) {
2811 case S_IFCHR: case S_IFBLK:
2812 tprintf("st_rdev=makedev(%lu, %lu), ",
2813 (unsigned long) major(statbuf.st_rdev),
2814 (unsigned long) minor(statbuf.st_rdev));
2817 tprintf("st_size=%llu, ", (unsigned long long) statbuf.st_size);
2821 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
2822 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
2823 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
2831 sys_fstat64(struct tcb *tcp)
2833 if (entering(tcp)) {
2834 printfd(tcp, tcp->u_arg[0]);
2837 realprintstat64(tcp, tcp->u_arg[1]);
2843 sys_stat64(struct tcb *tcp)
2845 if (entering(tcp)) {
2846 printpath(tcp, tcp->u_arg[0]);
2849 realprintstat64(tcp, tcp->u_arg[1]);