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.
38 struct kernel_dirent {
41 unsigned short d_reclen;
45 # define kernel_dirent dirent
51 unsigned short st_dev;
53 unsigned short st_mode;
55 unsigned short st_uid;
56 unsigned short st_gid;
57 unsigned short st_rdev;
60 unsigned int __unused1;
62 unsigned int __unused2;
64 unsigned int __unused3;
67 unsigned int __unused4[2];
74 unsigned int st_nlink;
84 unsigned long __unused4[2];
87 # define stat kernel_stat
88 # include <asm/stat.h>
100 # define dev_t __kernel_dev_t
101 # define ino_t __kernel_ino_t
102 # define mode_t __kernel_mode_t
103 # define nlink_t __kernel_nlink_t
104 # define uid_t __kernel_uid_t
105 # define gid_t __kernel_gid_t
106 # define off_t __kernel_off_t
107 # define loff_t __kernel_loff_t
109 # include <asm/stat.h>
122 # define mode_t mode_t
123 # define nlink_t nlink_t
127 # define loff_t loff_t
129 # ifdef HPPA /* asm-parisc/stat.h defines stat64 */
132 # define stat libc_stat
133 # define stat64 libc_stat64
134 # include <sys/stat.h>
137 /* These might be macros. */
142 # define stat64 hpux_stat64
145 # include <sys/stat.h>
151 # include <sys/cred.h>
154 #ifdef HAVE_SYS_VFS_H
158 #ifdef HAVE_LINUX_XATTR_H
159 #include <linux/xattr.h>
161 #define XATTR_CREATE 1
162 #define XATTR_REPLACE 2
166 #include <sys/param.h>
167 #include <sys/mount.h>
168 #include <sys/stat.h>
171 #if _LFS64_LARGEFILE && (defined(LINUX) || defined(SVR4))
172 # ifdef HAVE_INTTYPES_H
173 # include <inttypes.h>
175 # define PRId64 "lld"
176 # define PRIu64 "llu"
180 #if HAVE_LONG_LONG_OFF_T
182 * Ugly hacks for systems that have typedef long long off_t
186 #define HAVE_STAT64 1 /* Ugly hack */
188 #define sys_stat64 sys_stat
189 #define sys_fstat64 sys_fstat
190 #define sys_lstat64 sys_lstat
191 #define sys_lseek64 sys_lseek
192 #define sys_truncate64 sys_truncate
193 #define sys_ftruncate64 sys_ftruncate
196 #ifdef MAJOR_IN_SYSMACROS
197 #include <sys/sysmacros.h>
200 #ifdef MAJOR_IN_MKDEV
201 #include <sys/mkdev.h>
204 #ifdef HAVE_SYS_ASYNCH_H
205 #include <sys/asynch.h>
212 const struct xlat open_access_modes[] = {
213 { O_RDONLY, "O_RDONLY" },
214 { O_WRONLY, "O_WRONLY" },
215 { O_RDWR, "O_RDWR" },
217 { O_ACCMODE, "O_ACCMODE" },
222 const struct xlat open_mode_flags[] = {
223 { O_CREAT, "O_CREAT" },
224 { O_EXCL, "O_EXCL" },
225 { O_NOCTTY, "O_NOCTTY" },
226 { O_TRUNC, "O_TRUNC" },
227 { O_APPEND, "O_APPEND" },
228 { O_NONBLOCK, "O_NONBLOCK" },
230 { O_SYNC, "O_SYNC" },
233 { O_ASYNC, "O_ASYNC" },
236 { O_DSYNC, "O_DSYNC" },
239 { O_RSYNC, "O_RSYNC" },
241 #if defined(O_NDELAY) && (O_NDELAY != O_NONBLOCK)
242 { O_NDELAY, "O_NDELAY" },
245 { O_PRIV, "O_PRIV" },
248 { O_DIRECT, "O_DIRECT" },
251 # if O_LARGEFILE == 0 /* biarch platforms in 64-bit mode */
254 # define O_LARGEFILE 0x40000
255 # elif defined X86_64 || defined S390X
256 # define O_LARGEFILE 0100000
260 { O_LARGEFILE, "O_LARGEFILE" },
264 { O_DIRECTORY, "O_DIRECTORY" },
267 { O_NOFOLLOW, "O_NOFOLLOW" },
270 { O_NOATIME, "O_NOATIME" },
273 { O_CLOEXEC, "O_CLOEXEC" },
277 { FNDELAY, "FNDELAY" },
280 { FAPPEND, "FAPPEND" },
286 { FDEFER, "FDEFER" },
289 { FASYNC, "FASYNC" },
292 { FSHLOCK, "FSHLOCK" },
295 { FEXLOCK, "FEXLOCK" },
298 { FCREAT, "FCREAT" },
301 { FTRUNC, "FTRUNC" },
313 { FNOCTTY, "FNOCTTY" },
316 { O_SHLOCK, "O_SHLOCK" },
319 { O_EXLOCK, "O_EXLOCK" },
327 # define AT_FDCWD -100
330 /* The fd is an "int", so when decoding x86 on x86_64, we need to force sign
331 * extension to get the right value. We do this by declaring fd as int here.
334 print_dirfd(struct tcb *tcp, int fd)
337 tprints("AT_FDCWD, ");
346 * low bits of the open(2) flags define access mode,
347 * other bits are real flags.
350 sprint_open_modes(mode_t flags)
352 static char outstr[1024];
356 const struct xlat *x;
358 p = stpcpy(outstr, "flags ");
359 str = xlookup(open_access_modes, flags & 3);
368 for (x = open_mode_flags; x->str; x++) {
369 if ((flags & x->val) == x->val) {
372 p = stpcpy(p, x->str);
379 /* flags is still nonzero */
382 sprintf(p, "%#x", flags);
387 tprint_open_modes(mode_t flags)
389 tprints(sprint_open_modes(flags) + sizeof("flags"));
393 decode_open(struct tcb *tcp, int offset)
396 printpath(tcp, tcp->u_arg[offset]);
399 tprint_open_modes(tcp->u_arg[offset + 1]);
400 if (tcp->u_arg[offset + 1] & O_CREAT) {
402 tprintf(", %#lo", tcp->u_arg[offset + 2]);
409 sys_open(struct tcb *tcp)
411 return decode_open(tcp, 0);
416 sys_openat(struct tcb *tcp)
419 print_dirfd(tcp, tcp->u_arg[0]);
420 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);
504 sys_faccessat(struct tcb *tcp)
507 print_dirfd(tcp, tcp->u_arg[0]);
508 return decode_access(tcp, 1);
513 sys_umask(struct tcb *tcp)
516 tprintf("%#lo", tcp->u_arg[0]);
521 static const struct xlat whence[] = {
522 { SEEK_SET, "SEEK_SET" },
523 { SEEK_CUR, "SEEK_CUR" },
524 { SEEK_END, "SEEK_END" },
528 #ifndef HAVE_LONG_LONG_OFF_T
529 #if defined (LINUX_MIPSN32)
531 sys_lseek(struct tcb *tcp)
537 printfd(tcp, tcp->u_arg[0]);
539 offset = tcp->ext_arg[1];
540 _whence = tcp->u_arg[2];
541 if (_whence == SEEK_SET)
542 tprintf("%llu, ", offset);
544 tprintf("%lld, ", offset);
545 printxval(whence, _whence, "SEEK_???");
547 return RVAL_UDECIMAL;
549 #else /* !LINUX_MIPSN32 */
551 sys_lseek(struct tcb *tcp)
557 printfd(tcp, tcp->u_arg[0]);
559 offset = tcp->u_arg[1];
560 _whence = tcp->u_arg[2];
561 if (_whence == SEEK_SET)
562 tprintf("%lu, ", offset);
564 tprintf("%ld, ", offset);
565 printxval(whence, _whence, "SEEK_???");
567 return RVAL_UDECIMAL;
569 #endif /* LINUX_MIPSN32 */
574 sys_llseek(struct tcb *tcp)
577 printfd(tcp, tcp->u_arg[0]);
579 * This one call takes explicitly two 32-bit arguments hi, lo,
580 * rather than one 64-bit argument for which LONG_LONG works
581 * appropriate for the native byte order.
583 if (tcp->u_arg[4] == SEEK_SET)
585 ((long long int) tcp->u_arg[1]) << 32 |
586 (unsigned long long) (unsigned) tcp->u_arg[2]);
589 ((long long int) tcp->u_arg[1]) << 32 |
590 (unsigned long long) (unsigned) tcp->u_arg[2]);
594 if (syserror(tcp) || umove(tcp, tcp->u_arg[3], &off) < 0)
595 tprintf("%#lx, ", tcp->u_arg[3]);
597 tprintf("[%llu], ", off);
598 printxval(whence, tcp->u_arg[4], "SEEK_???");
604 sys_readahead(struct tcb *tcp)
608 printfd(tcp, tcp->u_arg[0]);
610 argn = printllval(tcp, "%lld", 1);
611 tprintf(", %ld", tcp->u_arg[argn]);
617 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
619 sys_lseek64(struct tcb *tcp)
623 printfd(tcp, tcp->u_arg[0]);
625 if (tcp->u_arg[3] == SEEK_SET)
626 argn = printllval(tcp, "%llu, ", 1);
628 argn = printllval(tcp, "%lld, ", 1);
629 printxval(whence, tcp->u_arg[argn], "SEEK_???");
631 return RVAL_LUDECIMAL;
635 #ifndef HAVE_LONG_LONG_OFF_T
637 sys_truncate(struct tcb *tcp)
640 printpath(tcp, tcp->u_arg[0]);
641 tprintf(", %lu", tcp->u_arg[1]);
647 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
649 sys_truncate64(struct tcb *tcp)
652 printpath(tcp, tcp->u_arg[0]);
653 printllval(tcp, ", %llu", 1);
659 #ifndef HAVE_LONG_LONG_OFF_T
661 sys_ftruncate(struct tcb *tcp)
664 printfd(tcp, tcp->u_arg[0]);
665 tprintf(", %lu", tcp->u_arg[1]);
671 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
673 sys_ftruncate64(struct tcb *tcp)
676 printfd(tcp, tcp->u_arg[0]);
678 printllval(tcp, "%llu", 1);
686 static const struct xlat modetypes[] = {
687 { S_IFREG, "S_IFREG" },
688 { S_IFSOCK, "S_IFSOCK" },
689 { S_IFIFO, "S_IFIFO" },
690 { S_IFLNK, "S_IFLNK" },
691 { S_IFDIR, "S_IFDIR" },
692 { S_IFBLK, "S_IFBLK" },
693 { S_IFCHR, "S_IFCHR" },
703 if ((mode & S_IFMT) == 0)
705 else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) {
706 sprintf(buf, "%#o", mode);
709 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(buf + strlen(buf), "|%#o", mode);
716 s = (*buf == '|') ? buf + 1 : buf;
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));
811 #if defined (SPARC64)
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));
859 #endif /* LINUXSPARC */
861 #if defined LINUX && defined POWERPC64
862 struct stat_powerpc32 {
865 unsigned int st_mode;
866 unsigned short st_nlink;
869 unsigned int st_rdev;
870 unsigned int st_size;
871 unsigned int st_blksize;
872 unsigned int st_blocks;
873 unsigned int st_atime;
874 unsigned int st_atime_nsec;
875 unsigned int st_mtime;
876 unsigned int st_mtime_nsec;
877 unsigned int st_ctime;
878 unsigned int st_ctime_nsec;
879 unsigned int __unused4;
880 unsigned int __unused5;
884 printstat_powerpc32(struct tcb *tcp, long addr)
886 struct stat_powerpc32 statbuf;
888 if (umove(tcp, addr, &statbuf) < 0) {
894 tprintf("{st_dev=makedev(%u, %u), st_ino=%u, st_mode=%s, ",
895 major(statbuf.st_dev), minor(statbuf.st_dev),
897 sprintmode(statbuf.st_mode));
898 tprintf("st_nlink=%u, st_uid=%u, st_gid=%u, ",
899 statbuf.st_nlink, statbuf.st_uid, statbuf.st_gid);
900 tprintf("st_blksize=%u, ", statbuf.st_blksize);
901 tprintf("st_blocks=%u, ", statbuf.st_blocks);
904 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
905 switch (statbuf.st_mode & S_IFMT) {
906 case S_IFCHR: case S_IFBLK:
907 tprintf("st_rdev=makedev(%lu, %lu), ",
908 (unsigned long) major(statbuf.st_rdev),
909 (unsigned long) minor(statbuf.st_rdev));
912 tprintf("st_size=%u, ", statbuf.st_size);
916 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
917 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
918 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
924 #endif /* LINUX && POWERPC64 */
926 static const struct xlat fileflags[] = {
928 { UF_NODUMP, "UF_NODUMP" },
929 { UF_IMMUTABLE, "UF_IMMUTABLE" },
930 { UF_APPEND, "UF_APPEND" },
931 { UF_OPAQUE, "UF_OPAQUE" },
932 { UF_NOUNLINK, "UF_NOUNLINK" },
933 { SF_ARCHIVED, "SF_ARCHIVED" },
934 { SF_IMMUTABLE, "SF_IMMUTABLE" },
935 { SF_APPEND, "SF_APPEND" },
936 { SF_NOUNLINK, "SF_NOUNLINK" },
939 { _S_ISMLD, "_S_ISMLD" },
942 { _S_ISMOUNTED, "_S_ISMOUNTED" },
950 sys_chflags(struct tcb *tcp)
953 printpath(tcp, tcp->u_arg[0]);
955 printflags(fileflags, tcp->u_arg[1], "UF_???");
961 sys_fchflags(struct tcb *tcp)
964 tprintf("%ld, ", tcp->u_arg[0]);
965 printflags(fileflags, tcp->u_arg[1], "UF_???");
971 #ifndef HAVE_LONG_LONG_OFF_T
973 realprintstat(struct tcb *tcp, struct stat *statbuf)
976 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
977 (unsigned long) major(statbuf->st_dev),
978 (unsigned long) minor(statbuf->st_dev),
979 (unsigned long) statbuf->st_ino,
980 sprintmode(statbuf->st_mode));
981 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
982 (unsigned long) statbuf->st_nlink,
983 (unsigned long) statbuf->st_uid,
984 (unsigned long) statbuf->st_gid);
985 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
986 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
988 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
989 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
993 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
994 switch (statbuf->st_mode & S_IFMT) {
995 case S_IFCHR: case S_IFBLK:
996 #ifdef HAVE_STRUCT_STAT_ST_RDEV
997 tprintf("st_rdev=makedev(%lu, %lu), ",
998 (unsigned long) major(statbuf->st_rdev),
999 (unsigned long) minor(statbuf->st_rdev));
1000 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
1001 tprintf("st_size=makedev(%lu, %lu), ",
1002 (unsigned long) major(statbuf->st_size),
1003 (unsigned long) minor(statbuf->st_size));
1004 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
1007 tprintf("st_size=%lu, ", (unsigned long) statbuf->st_size);
1011 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
1012 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
1013 tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));
1014 #if HAVE_STRUCT_STAT_ST_FLAGS
1015 tprints(", st_flags=");
1016 printflags(fileflags, statbuf->st_flags, "UF_???");
1018 #if HAVE_STRUCT_STAT_ST_ACLCNT
1019 tprintf(", st_aclcnt=%d", statbuf->st_aclcnt);
1021 #if HAVE_STRUCT_STAT_ST_LEVEL
1022 tprintf(", st_level=%ld", statbuf->st_level);
1024 #if HAVE_STRUCT_STAT_ST_FSTYPE
1025 tprintf(", st_fstype=%.*s",
1026 (int) sizeof statbuf->st_fstype, statbuf->st_fstype);
1028 #if HAVE_STRUCT_STAT_ST_GEN
1029 tprintf(", st_gen=%u", statbuf->st_gen);
1039 printstat(struct tcb *tcp, long addr)
1041 struct stat statbuf;
1047 if (syserror(tcp) || !verbose(tcp)) {
1048 tprintf("%#lx", addr);
1053 if (current_personality == 1) {
1054 printstatsol(tcp, addr);
1058 else if (current_personality == 2) {
1059 printstat_sparc64(tcp, addr);
1063 #endif /* LINUXSPARC */
1065 #if defined LINUX && defined POWERPC64
1066 if (current_personality == 1) {
1067 printstat_powerpc32(tcp, addr);
1072 if (umove(tcp, addr, &statbuf) < 0) {
1077 realprintstat(tcp, &statbuf);
1079 #endif /* !HAVE_LONG_LONG_OFF_T */
1081 #if !defined HAVE_STAT64 && defined LINUX && defined X86_64
1083 * Linux x86_64 has unified `struct stat' but its i386 biarch needs
1084 * `struct stat64'. Its <asm-i386/stat.h> definition expects 32-bit `long'.
1085 * <linux/include/asm-x86_64/ia32.h> is not in the public includes set.
1086 * __GNUC__ is needed for the required __attribute__ below.
1089 unsigned long long st_dev;
1090 unsigned char __pad0[4];
1091 unsigned int __st_ino;
1092 unsigned int st_mode;
1093 unsigned int st_nlink;
1094 unsigned int st_uid;
1095 unsigned int st_gid;
1096 unsigned long long st_rdev;
1097 unsigned char __pad3[4];
1099 unsigned int st_blksize;
1100 unsigned long long st_blocks;
1101 unsigned int st_atime;
1102 unsigned int st_atime_nsec;
1103 unsigned int st_mtime;
1104 unsigned int st_mtime_nsec;
1105 unsigned int st_ctime;
1106 unsigned int st_ctime_nsec;
1107 unsigned long long st_ino;
1108 } __attribute__((packed));
1109 # define HAVE_STAT64 1
1110 # define STAT64_SIZE 96
1115 printstat64(struct tcb *tcp, long addr)
1117 struct stat64 statbuf;
1120 (void) sizeof(char[sizeof statbuf == STAT64_SIZE ? 1 : -1]);
1127 if (syserror(tcp) || !verbose(tcp)) {
1128 tprintf("%#lx", addr);
1133 if (current_personality == 1) {
1134 printstatsol(tcp, addr);
1138 else if (current_personality == 2) {
1139 printstat_sparc64(tcp, addr);
1143 #endif /* LINUXSPARC */
1145 #if defined LINUX && defined X86_64
1146 if (current_personality == 0) {
1147 printstat(tcp, addr);
1152 if (umove(tcp, addr, &statbuf) < 0) {
1158 #ifdef HAVE_LONG_LONG
1159 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
1161 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
1163 (unsigned long) major(statbuf.st_dev),
1164 (unsigned long) minor(statbuf.st_dev),
1165 #ifdef HAVE_LONG_LONG
1166 (unsigned long long) statbuf.st_ino,
1168 (unsigned long) statbuf.st_ino,
1170 sprintmode(statbuf.st_mode));
1171 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
1172 (unsigned long) statbuf.st_nlink,
1173 (unsigned long) statbuf.st_uid,
1174 (unsigned long) statbuf.st_gid);
1175 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
1176 tprintf("st_blksize=%lu, ",
1177 (unsigned long) statbuf.st_blksize);
1178 #endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */
1179 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
1180 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
1181 #endif /* HAVE_STRUCT_STAT_ST_BLOCKS */
1184 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
1185 switch (statbuf.st_mode & S_IFMT) {
1186 case S_IFCHR: case S_IFBLK:
1187 #ifdef HAVE_STRUCT_STAT_ST_RDEV
1188 tprintf("st_rdev=makedev(%lu, %lu), ",
1189 (unsigned long) major(statbuf.st_rdev),
1190 (unsigned long) minor(statbuf.st_rdev));
1191 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
1192 tprintf("st_size=makedev(%lu, %lu), ",
1193 (unsigned long) major(statbuf.st_size),
1194 (unsigned long) minor(statbuf.st_size));
1195 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
1198 #ifdef HAVE_LONG_LONG
1199 tprintf("st_size=%llu, ", (unsigned long long) statbuf.st_size);
1201 tprintf("st_size=%lu, ", (unsigned long) statbuf.st_size);
1206 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
1207 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
1208 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
1209 #if HAVE_STRUCT_STAT_ST_FLAGS
1210 tprints(", st_flags=");
1211 printflags(fileflags, statbuf.st_flags, "UF_???");
1213 #if HAVE_STRUCT_STAT_ST_ACLCNT
1214 tprintf(", st_aclcnt=%d", statbuf.st_aclcnt);
1216 #if HAVE_STRUCT_STAT_ST_LEVEL
1217 tprintf(", st_level=%ld", statbuf.st_level);
1219 #if HAVE_STRUCT_STAT_ST_FSTYPE
1220 tprintf(", st_fstype=%.*s",
1221 (int) sizeof statbuf.st_fstype, statbuf.st_fstype);
1223 #if HAVE_STRUCT_STAT_ST_GEN
1224 tprintf(", st_gen=%u", statbuf.st_gen);
1231 #endif /* HAVE_STAT64 */
1233 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1235 convertoldstat(const struct __old_kernel_stat *oldbuf, struct stat *newbuf)
1237 newbuf->st_dev = oldbuf->st_dev;
1238 newbuf->st_ino = oldbuf->st_ino;
1239 newbuf->st_mode = oldbuf->st_mode;
1240 newbuf->st_nlink = oldbuf->st_nlink;
1241 newbuf->st_uid = oldbuf->st_uid;
1242 newbuf->st_gid = oldbuf->st_gid;
1243 newbuf->st_rdev = oldbuf->st_rdev;
1244 newbuf->st_size = oldbuf->st_size;
1245 newbuf->st_atime = oldbuf->st_atime;
1246 newbuf->st_mtime = oldbuf->st_mtime;
1247 newbuf->st_ctime = oldbuf->st_ctime;
1248 newbuf->st_blksize = 0; /* not supported in old_stat */
1249 newbuf->st_blocks = 0; /* not supported in old_stat */
1254 printoldstat(struct tcb *tcp, long addr)
1256 struct __old_kernel_stat statbuf;
1257 struct stat newstatbuf;
1263 if (syserror(tcp) || !verbose(tcp)) {
1264 tprintf("%#lx", addr);
1269 if (current_personality == 1) {
1270 printstatsol(tcp, addr);
1273 #endif /* LINUXSPARC */
1275 if (umove(tcp, addr, &statbuf) < 0) {
1280 convertoldstat(&statbuf, &newstatbuf);
1281 realprintstat(tcp, &newstatbuf);
1283 #endif /* LINUX && !IA64 && !HPPA && !X86_64 && !S390 && !S390X */
1285 #ifndef HAVE_LONG_LONG_OFF_T
1287 sys_stat(struct tcb *tcp)
1289 if (entering(tcp)) {
1290 printpath(tcp, tcp->u_arg[0]);
1293 printstat(tcp, tcp->u_arg[1]);
1300 sys_stat64(struct tcb *tcp)
1303 if (entering(tcp)) {
1304 printpath(tcp, tcp->u_arg[0]);
1307 printstat64(tcp, tcp->u_arg[1]);
1311 return printargs(tcp);
1316 static const struct xlat fstatatflags[] = {
1317 #ifndef AT_SYMLINK_NOFOLLOW
1318 # define AT_SYMLINK_NOFOLLOW 0x100
1320 { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" },
1323 #define utimensatflags fstatatflags
1326 sys_newfstatat(struct tcb *tcp)
1328 if (entering(tcp)) {
1329 print_dirfd(tcp, tcp->u_arg[0]);
1330 printpath(tcp, tcp->u_arg[1]);
1334 if (current_personality == 0)
1335 printstat(tcp, tcp->u_arg[2]);
1337 printstat64(tcp, tcp->u_arg[2]);
1338 #elif defined HAVE_STAT64
1339 printstat64(tcp, tcp->u_arg[2]);
1341 printstat(tcp, tcp->u_arg[2]);
1344 printflags(fstatatflags, tcp->u_arg[3], "AT_???");
1350 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1352 sys_oldstat(struct tcb *tcp)
1354 if (entering(tcp)) {
1355 printpath(tcp, tcp->u_arg[0]);
1358 printoldstat(tcp, tcp->u_arg[1]);
1362 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1364 #ifndef HAVE_LONG_LONG_OFF_T
1366 sys_fstat(struct tcb *tcp)
1368 if (entering(tcp)) {
1369 printfd(tcp, tcp->u_arg[0]);
1372 printstat(tcp, tcp->u_arg[1]);
1379 sys_fstat64(struct tcb *tcp)
1382 if (entering(tcp)) {
1383 printfd(tcp, tcp->u_arg[0]);
1386 printstat64(tcp, tcp->u_arg[1]);
1390 return printargs(tcp);
1394 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1396 sys_oldfstat(struct tcb *tcp)
1398 if (entering(tcp)) {
1399 printfd(tcp, tcp->u_arg[0]);
1402 printoldstat(tcp, tcp->u_arg[1]);
1406 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1408 #ifndef HAVE_LONG_LONG_OFF_T
1410 sys_lstat(struct tcb *tcp)
1412 if (entering(tcp)) {
1413 printpath(tcp, tcp->u_arg[0]);
1416 printstat(tcp, tcp->u_arg[1]);
1423 sys_lstat64(struct tcb *tcp)
1426 if (entering(tcp)) {
1427 printpath(tcp, tcp->u_arg[0]);
1430 printstat64(tcp, tcp->u_arg[1]);
1434 return printargs(tcp);
1438 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1440 sys_oldlstat(struct tcb *tcp)
1442 if (entering(tcp)) {
1443 printpath(tcp, tcp->u_arg[0]);
1446 printoldstat(tcp, tcp->u_arg[1]);
1450 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1453 #if defined(SVR4) || defined(LINUXSPARC)
1456 sys_xstat(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_fxstat(struct tcb *tcp)
1477 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
1480 if (tcp->u_arg[0] == _STAT64_VER)
1481 printstat64 (tcp, tcp->u_arg[2]);
1484 printstat(tcp, tcp->u_arg[2]);
1490 sys_lxstat(struct tcb *tcp)
1492 if (entering(tcp)) {
1493 tprintf("%ld, ", tcp->u_arg[0]);
1494 printpath(tcp, tcp->u_arg[1]);
1498 if (tcp->u_arg[0] == _STAT64_VER)
1499 printstat64 (tcp, tcp->u_arg[2]);
1502 printstat(tcp, tcp->u_arg[2]);
1508 sys_xmknod(struct tcb *tcp)
1510 int mode = tcp->u_arg[2];
1512 if (entering(tcp)) {
1513 tprintf("%ld, ", tcp->u_arg[0]);
1514 printpath(tcp, tcp->u_arg[1]);
1515 tprintf(", %s", sprintmode(mode));
1516 switch (mode & S_IFMT) {
1517 case S_IFCHR: case S_IFBLK:
1519 tprintf(", makedev(%lu, %lu)",
1520 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
1521 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
1523 tprintf(", makedev(%lu, %lu)",
1524 (unsigned long) major(tcp->u_arg[3]),
1525 (unsigned long) minor(tcp->u_arg[3]));
1535 #ifdef HAVE_SYS_ACL_H
1537 #include <sys/acl.h>
1539 static const struct xlat aclcmds[] = {
1541 { SETACL, "SETACL" },
1544 { GETACL, "GETACL" },
1547 { GETACLCNT, "GETACLCNT" },
1550 { ACL_GET, "ACL_GET" },
1553 { ACL_SET, "ACL_SET" },
1556 { ACL_CNT, "ACL_CNT" },
1562 sys_acl(struct tcb *tcp)
1564 if (entering(tcp)) {
1565 printpath(tcp, tcp->u_arg[0]);
1567 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1568 tprintf(", %ld", tcp->u_arg[2]);
1570 * FIXME - dump out the list of aclent_t's pointed to
1571 * by "tcp->u_arg[3]" if it's not NULL.
1574 tprintf(", %#lx", tcp->u_arg[3]);
1583 sys_facl(struct tcb *tcp)
1585 if (entering(tcp)) {
1586 tprintf("%ld, ", tcp->u_arg[0]);
1587 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1588 tprintf(", %ld", tcp->u_arg[2]);
1590 * FIXME - dump out the list of aclent_t's pointed to
1591 * by "tcp->u_arg[3]" if it's not NULL.
1594 tprintf(", %#lx", tcp->u_arg[3]);
1602 static const struct xlat aclipc[] = {
1604 { IPC_SHM, "IPC_SHM" },
1607 { IPC_SEM, "IPC_SEM" },
1610 { IPC_MSG, "IPC_MSG" },
1617 sys_aclipc(struct tcb *tcp)
1619 if (entering(tcp)) {
1620 printxval(aclipc, tcp->u_arg[0], "???IPC???");
1621 tprintf(", %#lx, ", tcp->u_arg[1]);
1622 printxval(aclcmds, tcp->u_arg[2], "???ACL???");
1623 tprintf(", %ld", tcp->u_arg[3]);
1625 * FIXME - dump out the list of aclent_t's pointed to
1626 * by "tcp->u_arg[4]" if it's not NULL.
1629 tprintf(", %#lx", tcp->u_arg[4]);
1636 #endif /* HAVE_SYS_ACL_H */
1638 #endif /* SVR4 || LINUXSPARC */
1642 static const struct xlat fsmagic[] = {
1643 { 0x73757245, "CODA_SUPER_MAGIC" },
1644 { 0x012ff7b7, "COH_SUPER_MAGIC" },
1645 { 0x1373, "DEVFS_SUPER_MAGIC" },
1646 { 0x1cd1, "DEVPTS_SUPER_MAGIC" },
1647 { 0x414A53, "EFS_SUPER_MAGIC" },
1648 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
1649 { 0xef53, "EXT2_SUPER_MAGIC" },
1650 { 0x137d, "EXT_SUPER_MAGIC" },
1651 { 0xf995e849, "HPFS_SUPER_MAGIC" },
1652 { 0x9660, "ISOFS_SUPER_MAGIC" },
1653 { 0x137f, "MINIX_SUPER_MAGIC" },
1654 { 0x138f, "MINIX_SUPER_MAGIC2" },
1655 { 0x2468, "MINIX2_SUPER_MAGIC" },
1656 { 0x2478, "MINIX2_SUPER_MAGIC2" },
1657 { 0x4d44, "MSDOS_SUPER_MAGIC" },
1658 { 0x564c, "NCP_SUPER_MAGIC" },
1659 { 0x6969, "NFS_SUPER_MAGIC" },
1660 { 0x9fa0, "PROC_SUPER_MAGIC" },
1661 { 0x002f, "QNX4_SUPER_MAGIC" },
1662 { 0x52654973, "REISERFS_SUPER_MAGIC" },
1663 { 0x02011994, "SHMFS_SUPER_MAGIC" },
1664 { 0x517b, "SMB_SUPER_MAGIC" },
1665 { 0x012ff7b6, "SYSV2_SUPER_MAGIC" },
1666 { 0x012ff7b5, "SYSV4_SUPER_MAGIC" },
1667 { 0x00011954, "UFS_MAGIC" },
1668 { 0x54190100, "UFS_CIGAM" },
1669 { 0x012ff7b4, "XENIX_SUPER_MAGIC" },
1670 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
1671 { 0x62656572, "SYSFS_MAGIC" },
1680 sprintfstype(int magic)
1682 static char buf[32];
1686 s = xlookup(fsmagic, magic);
1688 sprintf(buf, "\"%s\"", s);
1692 sprintf(buf, "%#x", magic);
1697 printstatfs(struct tcb *tcp, long addr)
1699 struct statfs statbuf;
1701 if (syserror(tcp) || !verbose(tcp)) {
1702 tprintf("%#lx", addr);
1705 if (umove(tcp, addr, &statbuf) < 0) {
1711 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
1712 sprintfstype(statbuf.f_type),
1713 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
1714 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_fsid={%d, %d}, f_namelen=%u",
1715 statbuf.f_bavail, statbuf.f_files, statbuf.f_ffree,
1716 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1],
1719 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
1720 sprintfstype(statbuf.f_type),
1721 (unsigned long)statbuf.f_bsize,
1722 (unsigned long)statbuf.f_blocks,
1723 (unsigned long)statbuf.f_bfree);
1724 tprintf("f_bavail=%lu, f_files=%lu, f_ffree=%lu, f_fsid={%d, %d}",
1725 (unsigned long)statbuf.f_bavail,
1726 (unsigned long)statbuf.f_files,
1727 (unsigned long)statbuf.f_ffree,
1728 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1730 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1733 #ifdef _STATFS_F_FRSIZE
1734 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
1740 sys_statfs(struct tcb *tcp)
1742 if (entering(tcp)) {
1743 printpath(tcp, tcp->u_arg[0]);
1746 printstatfs(tcp, tcp->u_arg[1]);
1752 sys_fstatfs(struct tcb *tcp)
1754 if (entering(tcp)) {
1755 printfd(tcp, tcp->u_arg[0]);
1758 printstatfs(tcp, tcp->u_arg[1]);
1763 #if defined LINUX && defined HAVE_STATFS64
1765 printstatfs64(struct tcb *tcp, long addr)
1767 struct statfs64 statbuf;
1769 if (syserror(tcp) || !verbose(tcp)) {
1770 tprintf("%#lx", addr);
1773 if (umove(tcp, addr, &statbuf) < 0) {
1777 tprintf("{f_type=%s, f_bsize=%llu, f_blocks=%llu, f_bfree=%llu, ",
1778 sprintfstype(statbuf.f_type),
1779 (unsigned long long)statbuf.f_bsize,
1780 (unsigned long long)statbuf.f_blocks,
1781 (unsigned long long)statbuf.f_bfree);
1782 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
1783 (unsigned long long)statbuf.f_bavail,
1784 (unsigned long long)statbuf.f_files,
1785 (unsigned long long)statbuf.f_ffree,
1786 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1787 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1788 #ifdef _STATFS_F_FRSIZE
1789 tprintf(", f_frsize=%llu", (unsigned long long)statbuf.f_frsize);
1791 #ifdef _STATFS_F_FLAGS
1792 tprintf(", f_flags=%llu", (unsigned long long)statbuf.f_flags);
1798 sys_statfs64(struct tcb *tcp)
1800 if (entering(tcp)) {
1801 printpath(tcp, tcp->u_arg[0]);
1802 tprintf(", %lu, ", tcp->u_arg[1]);
1804 if (tcp->u_arg[1] == sizeof(struct statfs64))
1805 printstatfs64(tcp, tcp->u_arg[2]);
1813 sys_fstatfs64(struct tcb *tcp)
1815 if (entering(tcp)) {
1816 printfd(tcp, tcp->u_arg[0]);
1817 tprintf(", %lu, ", tcp->u_arg[1]);
1819 if (tcp->u_arg[1] == sizeof(struct statfs64))
1820 printstatfs64(tcp, tcp->u_arg[2]);
1828 #if defined(LINUX) && defined(__alpha)
1831 osf_statfs(struct tcb *tcp)
1833 if (entering(tcp)) {
1834 printpath(tcp, tcp->u_arg[0]);
1837 printstatfs(tcp, tcp->u_arg[1]);
1838 tprintf(", %lu", tcp->u_arg[2]);
1844 osf_fstatfs(struct tcb *tcp)
1846 if (entering(tcp)) {
1847 tprintf("%lu, ", tcp->u_arg[0]);
1849 printstatfs(tcp, tcp->u_arg[1]);
1850 tprintf(", %lu", tcp->u_arg[2]);
1854 #endif /* LINUX && __alpha */
1860 sys_ustat(struct tcb *tcp)
1862 struct ustat statbuf;
1864 if (entering(tcp)) {
1865 tprintf("makedev(%lu, %lu), ",
1866 (long) major(tcp->u_arg[0]),
1867 (long) minor(tcp->u_arg[0]));
1870 if (syserror(tcp) || !verbose(tcp))
1871 tprintf("%#lx", tcp->u_arg[1]);
1872 else if (umove(tcp, tcp->u_arg[1], &statbuf) < 0)
1875 tprintf("{f_tfree=%lu, f_tinode=%lu, ",
1876 statbuf.f_tfree, statbuf.f_tinode);
1877 tprintf("f_fname=\"%.*s\", ",
1878 (int) sizeof(statbuf.f_fname),
1880 tprintf("f_fpack=\"%.*s\"}",
1881 (int) sizeof(statbuf.f_fpack),
1891 sys_chdir(struct tcb *tcp)
1893 if (entering(tcp)) {
1894 printpath(tcp, tcp->u_arg[0]);
1900 decode_mkdir(struct tcb *tcp, int offset)
1902 if (entering(tcp)) {
1903 printpath(tcp, tcp->u_arg[offset]);
1904 tprintf(", %#lo", tcp->u_arg[offset + 1]);
1910 sys_mkdir(struct tcb *tcp)
1912 return decode_mkdir(tcp, 0);
1917 sys_mkdirat(struct tcb *tcp)
1920 print_dirfd(tcp, tcp->u_arg[0]);
1921 return decode_mkdir(tcp, 1);
1926 sys_link(struct tcb *tcp)
1928 if (entering(tcp)) {
1929 printpath(tcp, tcp->u_arg[0]);
1931 printpath(tcp, tcp->u_arg[1]);
1938 sys_linkat(struct tcb *tcp)
1940 if (entering(tcp)) {
1941 print_dirfd(tcp, tcp->u_arg[0]);
1942 printpath(tcp, tcp->u_arg[1]);
1944 print_dirfd(tcp, tcp->u_arg[2]);
1945 printpath(tcp, tcp->u_arg[3]);
1947 printfd(tcp, tcp->u_arg[4]);
1954 static const struct xlat unlinkatflags[] = {
1955 #ifndef AT_REMOVEDIR
1956 # define AT_REMOVEDIR 0x200
1958 { AT_REMOVEDIR, "AT_REMOVEDIR" },
1963 sys_unlinkat(struct tcb *tcp)
1965 if (entering(tcp)) {
1966 print_dirfd(tcp, tcp->u_arg[0]);
1967 printpath(tcp, tcp->u_arg[1]);
1969 printflags(unlinkatflags, tcp->u_arg[2], "AT_???");
1977 sys_symlinkat(struct tcb *tcp)
1979 if (entering(tcp)) {
1980 printpath(tcp, tcp->u_arg[0]);
1982 print_dirfd(tcp, tcp->u_arg[1]);
1983 printpath(tcp, tcp->u_arg[2]);
1990 decode_readlink(struct tcb *tcp, int offset)
1992 if (entering(tcp)) {
1993 printpath(tcp, tcp->u_arg[offset]);
1997 tprintf("%#lx", tcp->u_arg[offset + 1]);
1999 printpathn(tcp, tcp->u_arg[offset + 1], tcp->u_rval);
2000 tprintf(", %lu", tcp->u_arg[offset + 2]);
2006 sys_readlink(struct tcb *tcp)
2008 return decode_readlink(tcp, 0);
2013 sys_readlinkat(struct tcb *tcp)
2016 print_dirfd(tcp, tcp->u_arg[0]);
2017 return decode_readlink(tcp, 1);
2023 sys_renameat(struct tcb *tcp)
2025 if (entering(tcp)) {
2026 print_dirfd(tcp, tcp->u_arg[0]);
2027 printpath(tcp, tcp->u_arg[1]);
2029 print_dirfd(tcp, tcp->u_arg[2]);
2030 printpath(tcp, tcp->u_arg[3]);
2037 sys_chown(struct tcb *tcp)
2039 if (entering(tcp)) {
2040 printpath(tcp, tcp->u_arg[0]);
2041 printuid(", ", tcp->u_arg[1]);
2042 printuid(", ", tcp->u_arg[2]);
2049 sys_fchownat(struct tcb *tcp)
2051 if (entering(tcp)) {
2052 print_dirfd(tcp, tcp->u_arg[0]);
2053 printpath(tcp, tcp->u_arg[1]);
2054 printuid(", ", tcp->u_arg[2]);
2055 printuid(", ", tcp->u_arg[3]);
2057 printflags(fstatatflags, tcp->u_arg[4], "AT_???");
2064 sys_fchown(struct tcb *tcp)
2066 if (entering(tcp)) {
2067 printfd(tcp, tcp->u_arg[0]);
2068 printuid(", ", tcp->u_arg[1]);
2069 printuid(", ", tcp->u_arg[2]);
2075 decode_chmod(struct tcb *tcp, int offset)
2077 if (entering(tcp)) {
2078 printpath(tcp, tcp->u_arg[offset]);
2079 tprintf(", %#lo", tcp->u_arg[offset + 1]);
2085 sys_chmod(struct tcb *tcp)
2087 return decode_chmod(tcp, 0);
2092 sys_fchmodat(struct tcb *tcp)
2095 print_dirfd(tcp, tcp->u_arg[0]);
2096 return decode_chmod(tcp, 1);
2101 sys_fchmod(struct tcb *tcp)
2103 if (entering(tcp)) {
2104 printfd(tcp, tcp->u_arg[0]);
2105 tprintf(", %#lo", tcp->u_arg[1]);
2112 sys_osf_utimes(struct tcb *tcp)
2114 if (entering(tcp)) {
2115 printpath(tcp, tcp->u_arg[0]);
2117 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
2124 decode_utimes(struct tcb *tcp, int offset, int special)
2126 if (entering(tcp)) {
2127 printpath(tcp, tcp->u_arg[offset]);
2129 if (tcp->u_arg[offset + 1] == 0)
2133 printtv_bitness(tcp, tcp->u_arg[offset + 1],
2134 BITNESS_CURRENT, special);
2136 printtv_bitness(tcp, tcp->u_arg[offset + 1]
2137 + sizeof(struct timeval),
2138 BITNESS_CURRENT, special);
2146 sys_utimes(struct tcb *tcp)
2148 return decode_utimes(tcp, 0, 0);
2153 sys_futimesat(struct tcb *tcp)
2156 print_dirfd(tcp, tcp->u_arg[0]);
2157 return decode_utimes(tcp, 1, 0);
2161 sys_utimensat(struct tcb *tcp)
2163 if (entering(tcp)) {
2164 print_dirfd(tcp, tcp->u_arg[0]);
2165 decode_utimes(tcp, 1, 1);
2167 printflags(utimensatflags, tcp->u_arg[3], "AT_???");
2174 sys_utime(struct tcb *tcp)
2181 if (entering(tcp)) {
2182 printpath(tcp, tcp->u_arg[0]);
2186 else if (!verbose(tcp))
2187 tprintf("%#lx", tcp->u_arg[1]);
2188 else if (umoven(tcp, tcp->u_arg[1],
2189 2 * personality_wordsize[current_personality],
2192 else if (personality_wordsize[current_personality]
2193 == sizeof u.utl[0]) {
2194 tprintf("[%s,", sprinttime(u.utl[0]));
2195 tprintf(" %s]", sprinttime(u.utl[1]));
2197 else if (personality_wordsize[current_personality]
2198 == sizeof u.uti[0]) {
2199 tprintf("[%s,", sprinttime(u.uti[0]));
2200 tprintf(" %s]", sprinttime(u.uti[1]));
2209 decode_mknod(struct tcb *tcp, int offset)
2211 int mode = tcp->u_arg[offset + 1];
2213 if (entering(tcp)) {
2214 printpath(tcp, tcp->u_arg[offset]);
2215 tprintf(", %s", sprintmode(mode));
2216 switch (mode & S_IFMT) {
2217 case S_IFCHR: case S_IFBLK:
2219 if (current_personality == 1)
2220 tprintf(", makedev(%lu, %lu)",
2221 (unsigned long) ((tcp->u_arg[offset + 2] >> 18) & 0x3fff),
2222 (unsigned long) (tcp->u_arg[offset + 2] & 0x3ffff));
2225 tprintf(", makedev(%lu, %lu)",
2226 (unsigned long) major(tcp->u_arg[offset + 2]),
2227 (unsigned long) minor(tcp->u_arg[offset + 2]));
2237 sys_mknod(struct tcb *tcp)
2239 return decode_mknod(tcp, 0);
2244 sys_mknodat(struct tcb *tcp)
2247 print_dirfd(tcp, tcp->u_arg[0]);
2248 return decode_mknod(tcp, 1);
2254 sys_mkfifo(struct tcb *tcp)
2256 if (entering(tcp)) {
2257 printpath(tcp, tcp->u_arg[0]);
2258 tprintf(", %#lo", tcp->u_arg[1]);
2262 #endif /* FREEBSD */
2265 sys_fsync(struct tcb *tcp)
2267 if (entering(tcp)) {
2268 printfd(tcp, tcp->u_arg[0]);
2276 printdir(struct tcb *tcp, long addr)
2280 if (!verbose(tcp)) {
2281 tprintf("%#lx", addr);
2284 if (umove(tcp, addr, &d) < 0) {
2288 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
2290 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
2295 sys_readdir(struct tcb *tcp)
2297 if (entering(tcp)) {
2298 printfd(tcp, tcp->u_arg[0]);
2301 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
2302 tprintf("%#lx", tcp->u_arg[1]);
2304 printdir(tcp, tcp->u_arg[1]);
2305 /* Not much point in printing this out, it is always 1. */
2306 if (tcp->u_arg[2] != 1)
2307 tprintf(", %lu", tcp->u_arg[2]);
2314 #if defined FREEBSD || defined LINUX
2315 static const struct xlat direnttypes[] = {
2316 { DT_UNKNOWN, "DT_UNKNOWN" },
2317 { DT_FIFO, "DT_FIFO" },
2318 { DT_CHR, "DT_CHR" },
2319 { DT_DIR, "DT_DIR" },
2320 { DT_BLK, "DT_BLK" },
2321 { DT_REG, "DT_REG" },
2322 { DT_LNK, "DT_LNK" },
2323 { DT_SOCK, "DT_SOCK" },
2324 { DT_WHT, "DT_WHT" },
2331 sys_getdents(struct tcb *tcp)
2333 int i, len, dents = 0;
2336 if (entering(tcp)) {
2337 printfd(tcp, tcp->u_arg[0]);
2341 if (syserror(tcp) || !verbose(tcp)) {
2342 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2346 /* Beware of insanely large or negative values in tcp->u_rval */
2347 if (tcp->u_rval > 1024*1024)
2349 if (tcp->u_rval < 0)
2351 buf = len ? malloc(len) : NULL;
2353 die_out_of_memory();
2354 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2355 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2361 for (i = 0; i < len;) {
2362 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
2365 tprintf("%s{d_ino=%lu, d_off=%lu, ",
2366 i ? " " : "", d->d_ino, d->d_off);
2367 tprintf("d_reclen=%u, d_name=\"%s\"}",
2368 d->d_reclen, d->d_name);
2373 tprintf("%s{d_ino=%lu, d_off=%lu, ",
2375 (unsigned long) d->d_ino,
2376 (unsigned long) d->d_off);
2377 tprintf("d_reclen=%u, d_name=\"%s\"}",
2378 d->d_reclen, d->d_name);
2383 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
2384 i ? " " : "", d->d_off, d->d_fileno,
2386 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
2387 d->d_namlen, d->d_namlen, d->d_name);
2392 tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
2393 i ? " " : "", d->d_fileno, d->d_reclen);
2394 printxval(direnttypes, d->d_type, "DT_???");
2395 tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
2396 d->d_namlen, d->d_namlen, d->d_name);
2398 #endif /* FREEBSD */
2400 tprints("/* d_reclen == 0, problem here */");
2409 tprintf("/* %u entries */", dents);
2410 tprintf(", %lu", tcp->u_arg[2]);
2416 #if _LFS64_LARGEFILE
2418 sys_getdents64(struct tcb *tcp)
2420 int i, len, dents = 0;
2423 if (entering(tcp)) {
2424 printfd(tcp, tcp->u_arg[0]);
2428 if (syserror(tcp) || !verbose(tcp)) {
2429 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2434 /* Beware of insanely large or negative tcp->u_rval */
2435 if (tcp->u_rval > 1024*1024)
2437 if (tcp->u_rval < 0)
2439 buf = len ? malloc(len) : NULL;
2441 die_out_of_memory();
2443 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2444 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2450 for (i = 0; i < len;) {
2451 struct dirent64 *d = (struct dirent64 *) &buf[i];
2452 #if defined(LINUX) || defined(SVR4)
2454 tprintf("%s{d_ino=%" PRIu64 ", d_off=%" PRId64 ", ",
2460 printxval(direnttypes, d->d_type, "DT_???");
2463 tprintf("d_reclen=%u, d_name=\"%s\"}",
2464 d->d_reclen, d->d_name);
2466 #endif /* LINUX || SVR4 */
2469 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
2470 i ? " " : "", d->d_off, d->d_fileno,
2472 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
2473 d->d_namlen, d->d_namlen, d->d_name);
2477 tprints("/* d_reclen == 0, problem here */");
2486 tprintf("/* %u entries */", dents);
2487 tprintf(", %lu", tcp->u_arg[2]);
2495 sys_getdirentries(struct tcb *tcp)
2497 int i, len, dents = 0;
2501 if (entering(tcp)) {
2502 printfd(tcp, tcp->u_arg[0]);
2506 if (syserror(tcp) || !verbose(tcp)) {
2507 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2512 /* Beware of insanely large or negative tcp->u_rval */
2513 if (tcp->u_rval > 1024*1024)
2515 if (tcp->u_rval < 0)
2519 die_out_of_memory();
2521 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2522 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2528 for (i = 0; i < len;) {
2529 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
2531 tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
2532 i ? " " : "", d->d_fileno, d->d_reclen);
2533 printxval(direnttypes, d->d_type, "DT_???");
2534 tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
2535 d->d_namlen, d->d_namlen, d->d_name);
2538 tprints("/* d_reclen == 0, problem here */");
2547 tprintf("/* %u entries */", dents);
2549 tprintf(", %lu", tcp->u_arg[2]);
2550 if (umove(tcp, tcp->u_arg[3], &basep) < 0)
2551 tprintf(", %#lx", tcp->u_arg[3]);
2553 tprintf(", [%lu]", basep);
2560 sys_getcwd(struct tcb *tcp)
2564 tprintf("%#lx", tcp->u_arg[0]);
2566 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
2567 tprintf(", %lu", tcp->u_arg[1]);
2575 sys___getcwd(struct tcb *tcp)
2579 tprintf("%#lx", tcp->u_arg[0]);
2581 printpathn(tcp, tcp->u_arg[0], tcp->u_arg[1]);
2582 tprintf(", %lu", tcp->u_arg[1]);
2588 #ifdef HAVE_SYS_ASYNCH_H
2591 sys_aioread(struct tcb *tcp)
2593 struct aio_result_t res;
2595 if (entering(tcp)) {
2596 tprintf("%lu, ", tcp->u_arg[0]);
2599 tprintf("%#lx", tcp->u_arg[1]);
2601 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2602 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2603 printxval(whence, tcp->u_arg[4], "L_???");
2604 if (syserror(tcp) || tcp->u_arg[5] == 0
2605 || umove(tcp, tcp->u_arg[5], &res) < 0)
2606 tprintf(", %#lx", tcp->u_arg[5]);
2608 tprintf(", {aio_return %d aio_errno %d}",
2609 res.aio_return, res.aio_errno);
2615 sys_aiowrite(struct tcb *tcp)
2617 struct aio_result_t res;
2619 if (entering(tcp)) {
2620 tprintf("%lu, ", tcp->u_arg[0]);
2621 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2622 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2623 printxval(whence, tcp->u_arg[4], "L_???");
2626 if (tcp->u_arg[5] == 0)
2628 else if (syserror(tcp)
2629 || umove(tcp, tcp->u_arg[5], &res) < 0)
2630 tprintf(", %#lx", tcp->u_arg[5]);
2632 tprintf(", {aio_return %d aio_errno %d}",
2633 res.aio_return, res.aio_errno);
2639 sys_aiowait(struct tcb *tcp)
2642 printtv(tcp, tcp->u_arg[0]);
2647 sys_aiocancel(struct tcb *tcp)
2649 struct aio_result_t res;
2652 if (tcp->u_arg[0] == 0)
2654 else if (syserror(tcp)
2655 || umove(tcp, tcp->u_arg[0], &res) < 0)
2656 tprintf("%#lx", tcp->u_arg[0]);
2658 tprintf("{aio_return %d aio_errno %d}",
2659 res.aio_return, res.aio_errno);
2664 #endif /* HAVE_SYS_ASYNCH_H */
2666 static const struct xlat xattrflags[] = {
2668 { XATTR_CREATE, "XATTR_CREATE" },
2669 { XATTR_REPLACE, "XATTR_REPLACE" },
2675 print_xattr_val(struct tcb *tcp, int failed,
2677 unsigned long insize,
2681 unsigned long capacity = 4 * size + 1;
2682 unsigned char *buf = (capacity < size) ? NULL : malloc(capacity);
2683 if (buf == NULL || /* probably a bogus size argument */
2684 umoven(tcp, arg, size, (char *) &buf[3 * size]) < 0) {
2688 unsigned char *out = buf;
2689 unsigned char *in = &buf[3 * size];
2691 for (i = 0; i < size; ++i) {
2695 #define tohex(n) "0123456789abcdef"[n]
2698 *out++ = tohex(in[i] / 16);
2699 *out++ = tohex(in[i] % 16);
2702 /* Don't print terminating NUL if there is one. */
2703 if (i > 0 && in[i - 1] == '\0')
2706 tprintf(", \"%s\", %ld", buf, insize);
2711 tprintf(", 0x%lx, %ld", arg, insize);
2715 sys_setxattr(struct tcb *tcp)
2717 if (entering(tcp)) {
2718 printpath(tcp, tcp->u_arg[0]);
2720 printstr(tcp, tcp->u_arg[1], -1);
2721 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2723 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2729 sys_fsetxattr(struct tcb *tcp)
2731 if (entering(tcp)) {
2732 printfd(tcp, tcp->u_arg[0]);
2734 printstr(tcp, tcp->u_arg[1], -1);
2735 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2737 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2743 sys_getxattr(struct tcb *tcp)
2745 if (entering(tcp)) {
2746 printpath(tcp, tcp->u_arg[0]);
2748 printstr(tcp, tcp->u_arg[1], -1);
2750 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2757 sys_fgetxattr(struct tcb *tcp)
2759 if (entering(tcp)) {
2760 printfd(tcp, tcp->u_arg[0]);
2762 printstr(tcp, tcp->u_arg[1], -1);
2764 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2771 sys_listxattr(struct tcb *tcp)
2773 if (entering(tcp)) {
2774 printpath(tcp, tcp->u_arg[0]);
2776 /* XXX Print value in format */
2777 tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]);
2783 sys_flistxattr(struct tcb *tcp)
2785 if (entering(tcp)) {
2786 printfd(tcp, tcp->u_arg[0]);
2788 /* XXX Print value in format */
2789 tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]);
2795 sys_removexattr(struct tcb *tcp)
2797 if (entering(tcp)) {
2798 printpath(tcp, tcp->u_arg[0]);
2800 printstr(tcp, tcp->u_arg[1], -1);
2806 sys_fremovexattr(struct tcb *tcp)
2808 if (entering(tcp)) {
2809 printfd(tcp, tcp->u_arg[0]);
2811 printstr(tcp, tcp->u_arg[1], -1);
2817 static const struct xlat advise[] = {
2818 { POSIX_FADV_NORMAL, "POSIX_FADV_NORMAL" },
2819 { POSIX_FADV_RANDOM, "POSIX_FADV_RANDOM" },
2820 { POSIX_FADV_SEQUENTIAL, "POSIX_FADV_SEQUENTIAL" },
2821 { POSIX_FADV_WILLNEED, "POSIX_FADV_WILLNEED" },
2822 { POSIX_FADV_DONTNEED, "POSIX_FADV_DONTNEED" },
2823 { POSIX_FADV_NOREUSE, "POSIX_FADV_NOREUSE" },
2830 sys_fadvise64(struct tcb *tcp)
2832 if (entering(tcp)) {
2834 printfd(tcp, tcp->u_arg[0]);
2836 argn = printllval(tcp, "%lld", 1);
2837 tprintf(", %ld, ", tcp->u_arg[argn++]);
2838 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2846 sys_fadvise64_64(struct tcb *tcp)
2848 if (entering(tcp)) {
2850 printfd(tcp, tcp->u_arg[0]);
2852 #if defined ARM || defined POWERPC
2853 argn = printllval(tcp, "%lld, ", 2);
2855 argn = printllval(tcp, "%lld, ", 1);
2857 argn = printllval(tcp, "%lld, ", argn);
2858 #if defined ARM || defined POWERPC
2859 printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
2861 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2868 static const struct xlat inotify_modes[] = {
2869 { 0x00000001, "IN_ACCESS" },
2870 { 0x00000002, "IN_MODIFY" },
2871 { 0x00000004, "IN_ATTRIB" },
2872 { 0x00000008, "IN_CLOSE_WRITE"},
2873 { 0x00000010, "IN_CLOSE_NOWRITE"},
2874 { 0x00000020, "IN_OPEN" },
2875 { 0x00000040, "IN_MOVED_FROM" },
2876 { 0x00000080, "IN_MOVED_TO" },
2877 { 0x00000100, "IN_CREATE" },
2878 { 0x00000200, "IN_DELETE" },
2879 { 0x00000400, "IN_DELETE_SELF"},
2880 { 0x00000800, "IN_MOVE_SELF" },
2881 { 0x00002000, "IN_UNMOUNT" },
2882 { 0x00004000, "IN_Q_OVERFLOW" },
2883 { 0x00008000, "IN_IGNORED" },
2884 { 0x01000000, "IN_ONLYDIR" },
2885 { 0x02000000, "IN_DONT_FOLLOW"},
2886 { 0x20000000, "IN_MASK_ADD" },
2887 { 0x40000000, "IN_ISDIR" },
2888 { 0x80000000, "IN_ONESHOT" },
2892 static const struct xlat inotify_init_flags[] = {
2893 { 0x00000800, "IN_NONBLOCK" },
2894 { 0x00080000, "IN_CLOEXEC" },
2899 sys_inotify_add_watch(struct tcb *tcp)
2901 if (entering(tcp)) {
2902 printfd(tcp, tcp->u_arg[0]);
2904 printpath(tcp, tcp->u_arg[1]);
2906 printflags(inotify_modes, tcp->u_arg[2], "IN_???");
2912 sys_inotify_rm_watch(struct tcb *tcp)
2914 if (entering(tcp)) {
2915 printfd(tcp, tcp->u_arg[0]);
2916 tprintf(", %ld", tcp->u_arg[1]);
2922 sys_inotify_init1(struct tcb *tcp)
2925 printflags(inotify_init_flags, tcp->u_arg[0], "IN_???");
2930 sys_fallocate(struct tcb *tcp)
2932 if (entering(tcp)) {
2934 printfd(tcp, tcp->u_arg[0]); /* fd */
2936 tprintf("%#lo, ", tcp->u_arg[1]); /* mode */
2937 argn = printllval(tcp, "%llu, ", 2); /* offset */
2938 printllval(tcp, "%llu", argn); /* len */