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.
35 #if defined(SPARC) || defined(SPARC64)
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);
424 #if defined(SPARC) || defined(SPARC64)
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 /* Linux kernel has exactly one version of lseek:
527 * fs/read_write.c::SYSCALL_DEFINE3(lseek, unsigned, fd, off_t, offset, unsigned, origin)
528 * In kernel, off_t is always the same as (kernel's) long
529 * (see include/uapi/asm-generic/posix_types.h),
530 * which means that on x32 we need to use tcp->ext_arg[N] to get offset argument.
532 #if defined(LINUX_MIPSN32) || defined(X32)
534 sys_lseek(struct tcb *tcp)
540 printfd(tcp, tcp->u_arg[0]);
541 offset = tcp->ext_arg[1];
542 whence = tcp->u_arg[2];
543 if (whence == SEEK_SET)
544 tprintf(", %llu, ", offset);
546 tprintf(", %lld, ", offset);
547 printxval(whence, whence, "SEEK_???");
549 return RVAL_LUDECIMAL;
554 sys_lseek32(struct tcb *tcp)
560 printfd(tcp, tcp->u_arg[0]);
561 offset = tcp->u_arg[1];
562 whence = tcp->u_arg[2];
563 if (whence == SEEK_SET)
564 tprintf(", %lu, ", offset);
566 tprintf(", %ld, ", offset);
567 printxval(whence, whence, "SEEK_???");
569 return RVAL_UDECIMAL;
574 sys_lseek(struct tcb *tcp)
580 printfd(tcp, tcp->u_arg[0]);
581 offset = tcp->u_arg[1];
582 whence = tcp->u_arg[2];
583 if (whence == SEEK_SET)
584 tprintf(", %lu, ", offset);
586 tprintf(", %ld, ", offset);
587 printxval(whence, whence, "SEEK_???");
589 return RVAL_UDECIMAL;
593 /* llseek syscall takes explicitly two ulong arguments hi, lo,
594 * rather than one 64-bit argument for which LONG_LONG works
595 * appropriate for the native byte order.
597 * See kernel's fs/read_write.c::SYSCALL_DEFINE5(llseek, ...)
599 * hi,lo are "unsigned longs" and combined exactly this way in kernel:
600 * ((loff_t) hi << 32) | lo
601 * Note that for architectures with kernel's long wider than userspace longs
602 * (such as x32), combining code will use *kernel's*, i.e. *wide* longs
603 * for hi and lo. You may need to use tcp->ext_arg[N]!
606 sys_llseek(struct tcb *tcp)
609 printfd(tcp, tcp->u_arg[0]);
610 if (tcp->u_arg[4] == SEEK_SET)
612 ((long long) tcp->u_arg[1]) << 32 |
613 (unsigned long long) (unsigned) tcp->u_arg[2]);
616 ((long long) tcp->u_arg[1]) << 32 |
617 (unsigned long long) (unsigned) tcp->u_arg[2]);
621 if (syserror(tcp) || umove(tcp, tcp->u_arg[3], &off) < 0)
622 tprintf("%#lx, ", tcp->u_arg[3]);
624 tprintf("[%llu], ", off);
625 printxval(whence, tcp->u_arg[4], "SEEK_???");
631 sys_readahead(struct tcb *tcp)
635 printfd(tcp, tcp->u_arg[0]);
636 argn = printllval(tcp, ", %lld", 1);
637 tprintf(", %ld", tcp->u_arg[argn]);
642 #ifndef HAVE_LONG_LONG_OFF_T
644 sys_truncate(struct tcb *tcp)
647 printpath(tcp, tcp->u_arg[0]);
648 tprintf(", %lu", tcp->u_arg[1]);
654 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
656 sys_truncate64(struct tcb *tcp)
659 printpath(tcp, tcp->u_arg[0]);
660 printllval(tcp, ", %llu", 1);
666 #ifndef HAVE_LONG_LONG_OFF_T
668 sys_ftruncate(struct tcb *tcp)
671 printfd(tcp, tcp->u_arg[0]);
672 tprintf(", %lu", tcp->u_arg[1]);
678 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
680 sys_ftruncate64(struct tcb *tcp)
683 printfd(tcp, tcp->u_arg[0]);
684 printllval(tcp, ", %llu", 1);
692 static const struct xlat modetypes[] = {
693 { S_IFREG, "S_IFREG" },
694 { S_IFSOCK, "S_IFSOCK" },
695 { S_IFIFO, "S_IFIFO" },
696 { S_IFLNK, "S_IFLNK" },
697 { S_IFDIR, "S_IFDIR" },
698 { S_IFBLK, "S_IFBLK" },
699 { S_IFCHR, "S_IFCHR" },
706 static char buf[sizeof("S_IFSOCK|S_ISUID|S_ISGID|S_ISVTX|%o")
711 if ((mode & S_IFMT) == 0)
713 else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) {
714 sprintf(buf, "%#o", mode);
717 s = buf + sprintf(buf, "%s%s%s%s", s,
718 (mode & S_ISUID) ? "|S_ISUID" : "",
719 (mode & S_ISGID) ? "|S_ISGID" : "",
720 (mode & S_ISVTX) ? "|S_ISVTX" : "");
721 mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX);
723 sprintf((char*)s, "|%#o", mode);
724 s = (*buf == '|') ? buf + 1 : buf;
732 static char buf[sizeof("yyyy/mm/dd-hh:mm:ss")];
740 snprintf(buf, sizeof buf, "%02d/%02d/%02d-%02d:%02d:%02d",
741 tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
742 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
744 snprintf(buf, sizeof buf, "%lu", (unsigned long) t);
749 #if defined(SPARC) || defined(SPARC64)
757 int st_pad1[3]; /* network id */
766 int st_pad3; /* st_size, off_t expansion */
767 timestruct_t st_atime;
768 timestruct_t st_mtime;
769 timestruct_t st_ctime;
773 int st_pad4[8]; /* expansion area */
777 printstatsol(struct tcb *tcp, long addr)
779 struct solstat statbuf;
781 if (umove(tcp, addr, &statbuf) < 0) {
786 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
787 (unsigned long) ((statbuf.st_dev >> 18) & 0x3fff),
788 (unsigned long) (statbuf.st_dev & 0x3ffff),
789 (unsigned long) statbuf.st_ino,
790 sprintmode(statbuf.st_mode));
791 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
792 (unsigned long) statbuf.st_nlink,
793 (unsigned long) statbuf.st_uid,
794 (unsigned long) statbuf.st_gid);
795 tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);
796 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
799 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
800 switch (statbuf.st_mode & S_IFMT) {
801 case S_IFCHR: case S_IFBLK:
802 tprintf("st_rdev=makedev(%lu, %lu), ",
803 (unsigned long) ((statbuf.st_rdev >> 18) & 0x3fff),
804 (unsigned long) (statbuf.st_rdev & 0x3ffff));
807 tprintf("st_size=%u, ", statbuf.st_size);
811 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime.tv_sec));
812 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime.tv_sec));
813 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime.tv_sec));
819 # if defined(SPARC64)
821 printstat_sparc64(struct tcb *tcp, long addr)
823 struct stat_sparc64 statbuf;
825 if (umove(tcp, addr, &statbuf) < 0) {
831 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
832 (unsigned long) major(statbuf.st_dev),
833 (unsigned long) minor(statbuf.st_dev),
834 (unsigned long) statbuf.st_ino,
835 sprintmode(statbuf.st_mode));
836 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
837 (unsigned long) statbuf.st_nlink,
838 (unsigned long) statbuf.st_uid,
839 (unsigned long) statbuf.st_gid);
840 tprintf("st_blksize=%lu, ",
841 (unsigned long) statbuf.st_blksize);
842 tprintf("st_blocks=%lu, ",
843 (unsigned long) statbuf.st_blocks);
846 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
847 switch (statbuf.st_mode & S_IFMT) {
848 case S_IFCHR: case S_IFBLK:
849 tprintf("st_rdev=makedev(%lu, %lu), ",
850 (unsigned long) major(statbuf.st_rdev),
851 (unsigned long) minor(statbuf.st_rdev));
854 tprintf("st_size=%lu, ", statbuf.st_size);
858 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
859 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
860 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
865 # endif /* SPARC64 */
866 #endif /* SPARC[64] */
868 #if defined POWERPC64
869 struct stat_powerpc32 {
872 unsigned int st_mode;
873 unsigned short st_nlink;
876 unsigned int st_rdev;
877 unsigned int st_size;
878 unsigned int st_blksize;
879 unsigned int st_blocks;
880 unsigned int st_atime;
881 unsigned int st_atime_nsec;
882 unsigned int st_mtime;
883 unsigned int st_mtime_nsec;
884 unsigned int st_ctime;
885 unsigned int st_ctime_nsec;
886 unsigned int __unused4;
887 unsigned int __unused5;
891 printstat_powerpc32(struct tcb *tcp, long addr)
893 struct stat_powerpc32 statbuf;
895 if (umove(tcp, addr, &statbuf) < 0) {
901 tprintf("{st_dev=makedev(%u, %u), st_ino=%u, st_mode=%s, ",
902 major(statbuf.st_dev), minor(statbuf.st_dev),
904 sprintmode(statbuf.st_mode));
905 tprintf("st_nlink=%u, st_uid=%u, st_gid=%u, ",
906 statbuf.st_nlink, statbuf.st_uid, statbuf.st_gid);
907 tprintf("st_blksize=%u, ", statbuf.st_blksize);
908 tprintf("st_blocks=%u, ", statbuf.st_blocks);
911 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
912 switch (statbuf.st_mode & S_IFMT) {
913 case S_IFCHR: case S_IFBLK:
914 tprintf("st_rdev=makedev(%lu, %lu), ",
915 (unsigned long) major(statbuf.st_rdev),
916 (unsigned long) minor(statbuf.st_rdev));
919 tprintf("st_size=%u, ", statbuf.st_size);
923 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
924 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
925 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
930 #endif /* POWERPC64 */
932 static const struct xlat fileflags[] = {
936 #ifndef HAVE_LONG_LONG_OFF_T
938 realprintstat(struct tcb *tcp, struct stat *statbuf)
941 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
942 (unsigned long) major(statbuf->st_dev),
943 (unsigned long) minor(statbuf->st_dev),
944 (unsigned long) statbuf->st_ino,
945 sprintmode(statbuf->st_mode));
946 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
947 (unsigned long) statbuf->st_nlink,
948 (unsigned long) statbuf->st_uid,
949 (unsigned long) statbuf->st_gid);
950 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
951 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
953 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
954 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
958 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
959 switch (statbuf->st_mode & S_IFMT) {
960 case S_IFCHR: case S_IFBLK:
961 #ifdef HAVE_STRUCT_STAT_ST_RDEV
962 tprintf("st_rdev=makedev(%lu, %lu), ",
963 (unsigned long) major(statbuf->st_rdev),
964 (unsigned long) minor(statbuf->st_rdev));
965 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
966 tprintf("st_size=makedev(%lu, %lu), ",
967 (unsigned long) major(statbuf->st_size),
968 (unsigned long) minor(statbuf->st_size));
969 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
972 tprintf("st_size=%lu, ", (unsigned long) statbuf->st_size);
976 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
977 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
978 tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));
979 #if HAVE_STRUCT_STAT_ST_FLAGS
980 tprints(", st_flags=");
981 printflags(fileflags, statbuf->st_flags, "UF_???");
983 #if HAVE_STRUCT_STAT_ST_ACLCNT
984 tprintf(", st_aclcnt=%d", statbuf->st_aclcnt);
986 #if HAVE_STRUCT_STAT_ST_LEVEL
987 tprintf(", st_level=%ld", statbuf->st_level);
989 #if HAVE_STRUCT_STAT_ST_FSTYPE
990 tprintf(", st_fstype=%.*s",
991 (int) sizeof statbuf->st_fstype, statbuf->st_fstype);
993 #if HAVE_STRUCT_STAT_ST_GEN
994 tprintf(", st_gen=%u", statbuf->st_gen);
1003 printstat(struct tcb *tcp, long addr)
1005 struct stat statbuf;
1011 if (syserror(tcp) || !verbose(tcp)) {
1012 tprintf("%#lx", addr);
1016 #if defined(SPARC) || defined(SPARC64)
1017 if (current_personality == 1) {
1018 printstatsol(tcp, addr);
1022 else if (current_personality == 2) {
1023 printstat_sparc64(tcp, addr);
1027 #endif /* SPARC[64] */
1029 #if defined POWERPC64
1030 if (current_personality == 1) {
1031 printstat_powerpc32(tcp, addr);
1036 if (umove(tcp, addr, &statbuf) < 0) {
1041 realprintstat(tcp, &statbuf);
1043 #endif /* !HAVE_LONG_LONG_OFF_T */
1045 #if !defined HAVE_STAT64 && defined X86_64
1047 * Linux x86_64 has unified `struct stat' but its i386 biarch needs
1048 * `struct stat64'. Its <asm-i386/stat.h> definition expects 32-bit `long'.
1049 * <linux/include/asm-x86_64/ia32.h> is not in the public includes set.
1050 * __GNUC__ is needed for the required __attribute__ below.
1053 unsigned long long st_dev;
1054 unsigned char __pad0[4];
1055 unsigned int __st_ino;
1056 unsigned int st_mode;
1057 unsigned int st_nlink;
1058 unsigned int st_uid;
1059 unsigned int st_gid;
1060 unsigned long long st_rdev;
1061 unsigned char __pad3[4];
1063 unsigned int st_blksize;
1064 unsigned long long st_blocks;
1065 unsigned int st_atime;
1066 unsigned int st_atime_nsec;
1067 unsigned int st_mtime;
1068 unsigned int st_mtime_nsec;
1069 unsigned int st_ctime;
1070 unsigned int st_ctime_nsec;
1071 unsigned long long st_ino;
1072 } __attribute__((packed));
1073 # define HAVE_STAT64 1
1074 # define STAT64_SIZE 96
1079 printstat64(struct tcb *tcp, long addr)
1081 struct stat64 statbuf;
1084 (void) sizeof(char[sizeof statbuf == STAT64_SIZE ? 1 : -1]);
1091 if (syserror(tcp) || !verbose(tcp)) {
1092 tprintf("%#lx", addr);
1096 #if defined(SPARC) || defined(SPARC64)
1097 if (current_personality == 1) {
1098 printstatsol(tcp, addr);
1102 else if (current_personality == 2) {
1103 printstat_sparc64(tcp, addr);
1107 #endif /* SPARC[64] */
1110 if (current_personality != 1) {
1111 printstat(tcp, addr);
1116 if (umove(tcp, addr, &statbuf) < 0) {
1122 #ifdef HAVE_LONG_LONG
1123 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
1125 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
1127 (unsigned long) major(statbuf.st_dev),
1128 (unsigned long) minor(statbuf.st_dev),
1129 #ifdef HAVE_LONG_LONG
1130 (unsigned long long) statbuf.st_ino,
1132 (unsigned long) statbuf.st_ino,
1134 sprintmode(statbuf.st_mode));
1135 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
1136 (unsigned long) statbuf.st_nlink,
1137 (unsigned long) statbuf.st_uid,
1138 (unsigned long) statbuf.st_gid);
1139 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
1140 tprintf("st_blksize=%lu, ",
1141 (unsigned long) statbuf.st_blksize);
1142 #endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */
1143 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
1144 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
1145 #endif /* HAVE_STRUCT_STAT_ST_BLOCKS */
1148 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
1149 switch (statbuf.st_mode & S_IFMT) {
1150 case S_IFCHR: case S_IFBLK:
1151 #ifdef HAVE_STRUCT_STAT_ST_RDEV
1152 tprintf("st_rdev=makedev(%lu, %lu), ",
1153 (unsigned long) major(statbuf.st_rdev),
1154 (unsigned long) minor(statbuf.st_rdev));
1155 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
1156 tprintf("st_size=makedev(%lu, %lu), ",
1157 (unsigned long) major(statbuf.st_size),
1158 (unsigned long) minor(statbuf.st_size));
1159 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
1162 #ifdef HAVE_LONG_LONG
1163 tprintf("st_size=%llu, ", (unsigned long long) statbuf.st_size);
1165 tprintf("st_size=%lu, ", (unsigned long) statbuf.st_size);
1170 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
1171 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
1172 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
1173 #if HAVE_STRUCT_STAT_ST_FLAGS
1174 tprints(", st_flags=");
1175 printflags(fileflags, statbuf.st_flags, "UF_???");
1177 #if HAVE_STRUCT_STAT_ST_ACLCNT
1178 tprintf(", st_aclcnt=%d", statbuf.st_aclcnt);
1180 #if HAVE_STRUCT_STAT_ST_LEVEL
1181 tprintf(", st_level=%ld", statbuf.st_level);
1183 #if HAVE_STRUCT_STAT_ST_FSTYPE
1184 tprintf(", st_fstype=%.*s",
1185 (int) sizeof statbuf.st_fstype, statbuf.st_fstype);
1187 #if HAVE_STRUCT_STAT_ST_GEN
1188 tprintf(", st_gen=%u", statbuf.st_gen);
1195 #endif /* HAVE_STAT64 */
1197 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
1199 convertoldstat(const struct __old_kernel_stat *oldbuf, struct stat *newbuf)
1201 newbuf->st_dev = oldbuf->st_dev;
1202 newbuf->st_ino = oldbuf->st_ino;
1203 newbuf->st_mode = oldbuf->st_mode;
1204 newbuf->st_nlink = oldbuf->st_nlink;
1205 newbuf->st_uid = oldbuf->st_uid;
1206 newbuf->st_gid = oldbuf->st_gid;
1207 newbuf->st_rdev = oldbuf->st_rdev;
1208 newbuf->st_size = oldbuf->st_size;
1209 newbuf->st_atime = oldbuf->st_atime;
1210 newbuf->st_mtime = oldbuf->st_mtime;
1211 newbuf->st_ctime = oldbuf->st_ctime;
1212 newbuf->st_blksize = 0; /* not supported in old_stat */
1213 newbuf->st_blocks = 0; /* not supported in old_stat */
1217 printoldstat(struct tcb *tcp, long addr)
1219 struct __old_kernel_stat statbuf;
1220 struct stat newstatbuf;
1226 if (syserror(tcp) || !verbose(tcp)) {
1227 tprintf("%#lx", addr);
1231 # if defined(SPARC) || defined(SPARC64)
1232 if (current_personality == 1) {
1233 printstatsol(tcp, addr);
1238 if (umove(tcp, addr, &statbuf) < 0) {
1243 convertoldstat(&statbuf, &newstatbuf);
1244 realprintstat(tcp, &newstatbuf);
1248 #ifndef HAVE_LONG_LONG_OFF_T
1250 sys_stat(struct tcb *tcp)
1252 if (entering(tcp)) {
1253 printpath(tcp, tcp->u_arg[0]);
1256 printstat(tcp, tcp->u_arg[1]);
1263 sys_stat64(struct tcb *tcp)
1266 if (entering(tcp)) {
1267 printpath(tcp, tcp->u_arg[0]);
1270 printstat64(tcp, tcp->u_arg[1]);
1274 return printargs(tcp);
1278 #ifndef AT_SYMLINK_NOFOLLOW
1279 # define AT_SYMLINK_NOFOLLOW 0x100
1281 #ifndef AT_REMOVEDIR
1282 # define AT_REMOVEDIR 0x200
1284 #ifndef AT_SYMLINK_FOLLOW
1285 # define AT_SYMLINK_FOLLOW 0x400
1287 #ifndef AT_NO_AUTOMOUNT
1288 # define AT_NO_AUTOMOUNT 0x800
1290 #ifndef AT_EMPTY_PATH
1291 # define AT_EMPTY_PATH 0x1000
1294 static const struct xlat at_flags[] = {
1295 { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" },
1296 { AT_REMOVEDIR, "AT_REMOVEDIR" },
1297 { AT_SYMLINK_FOLLOW, "AT_SYMLINK_FOLLOW" },
1298 { AT_NO_AUTOMOUNT, "AT_NO_AUTOMOUNT" },
1299 { AT_EMPTY_PATH, "AT_EMPTY_PATH" },
1304 sys_newfstatat(struct tcb *tcp)
1306 if (entering(tcp)) {
1307 print_dirfd(tcp, tcp->u_arg[0]);
1308 printpath(tcp, tcp->u_arg[1]);
1312 if (current_personality == 0)
1313 printstat(tcp, tcp->u_arg[2]);
1315 printstat64(tcp, tcp->u_arg[2]);
1316 #elif defined HAVE_STAT64
1317 printstat64(tcp, tcp->u_arg[2]);
1319 printstat(tcp, tcp->u_arg[2]);
1322 printflags(at_flags, tcp->u_arg[3], "AT_???");
1327 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
1329 sys_oldstat(struct tcb *tcp)
1331 if (entering(tcp)) {
1332 printpath(tcp, tcp->u_arg[0]);
1335 printoldstat(tcp, tcp->u_arg[1]);
1341 #ifndef HAVE_LONG_LONG_OFF_T
1343 sys_fstat(struct tcb *tcp)
1345 if (entering(tcp)) {
1346 printfd(tcp, tcp->u_arg[0]);
1349 printstat(tcp, tcp->u_arg[1]);
1356 sys_fstat64(struct tcb *tcp)
1359 if (entering(tcp)) {
1360 printfd(tcp, tcp->u_arg[0]);
1363 printstat64(tcp, tcp->u_arg[1]);
1367 return printargs(tcp);
1371 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
1373 sys_oldfstat(struct tcb *tcp)
1375 if (entering(tcp)) {
1376 printfd(tcp, tcp->u_arg[0]);
1379 printoldstat(tcp, tcp->u_arg[1]);
1385 #ifndef HAVE_LONG_LONG_OFF_T
1387 sys_lstat(struct tcb *tcp)
1389 if (entering(tcp)) {
1390 printpath(tcp, tcp->u_arg[0]);
1393 printstat(tcp, tcp->u_arg[1]);
1400 sys_lstat64(struct tcb *tcp)
1403 if (entering(tcp)) {
1404 printpath(tcp, tcp->u_arg[0]);
1407 printstat64(tcp, tcp->u_arg[1]);
1411 return printargs(tcp);
1415 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
1417 sys_oldlstat(struct tcb *tcp)
1419 if (entering(tcp)) {
1420 printpath(tcp, tcp->u_arg[0]);
1423 printoldstat(tcp, tcp->u_arg[1]);
1429 #if defined(SPARC) || defined(SPARC64)
1432 sys_xstat(struct tcb *tcp)
1434 if (entering(tcp)) {
1435 tprintf("%ld, ", tcp->u_arg[0]);
1436 printpath(tcp, tcp->u_arg[1]);
1440 if (tcp->u_arg[0] == _STAT64_VER)
1441 printstat64(tcp, tcp->u_arg[2]);
1444 printstat(tcp, tcp->u_arg[2]);
1450 sys_fxstat(struct tcb *tcp)
1453 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
1456 if (tcp->u_arg[0] == _STAT64_VER)
1457 printstat64(tcp, tcp->u_arg[2]);
1460 printstat(tcp, tcp->u_arg[2]);
1466 sys_lxstat(struct tcb *tcp)
1468 if (entering(tcp)) {
1469 tprintf("%ld, ", tcp->u_arg[0]);
1470 printpath(tcp, tcp->u_arg[1]);
1474 if (tcp->u_arg[0] == _STAT64_VER)
1475 printstat64(tcp, tcp->u_arg[2]);
1478 printstat(tcp, tcp->u_arg[2]);
1484 sys_xmknod(struct tcb *tcp)
1486 int mode = tcp->u_arg[2];
1488 if (entering(tcp)) {
1489 tprintf("%ld, ", tcp->u_arg[0]);
1490 printpath(tcp, tcp->u_arg[1]);
1491 tprintf(", %s", sprintmode(mode));
1492 switch (mode & S_IFMT) {
1493 case S_IFCHR: case S_IFBLK:
1494 tprintf(", makedev(%lu, %lu)",
1495 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
1496 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
1505 # ifdef HAVE_SYS_ACL_H
1507 # include <sys/acl.h>
1509 static const struct xlat aclcmds[] = {
1511 { SETACL, "SETACL" },
1514 { GETACL, "GETACL" },
1517 { GETACLCNT, "GETACLCNT" },
1520 { ACL_GET, "ACL_GET" },
1523 { ACL_SET, "ACL_SET" },
1526 { ACL_CNT, "ACL_CNT" },
1532 sys_acl(struct tcb *tcp)
1534 if (entering(tcp)) {
1535 printpath(tcp, tcp->u_arg[0]);
1537 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1538 tprintf(", %ld", tcp->u_arg[2]);
1540 * FIXME - dump out the list of aclent_t's pointed to
1541 * by "tcp->u_arg[3]" if it's not NULL.
1544 tprintf(", %#lx", tcp->u_arg[3]);
1552 sys_facl(struct tcb *tcp)
1554 if (entering(tcp)) {
1555 tprintf("%ld, ", tcp->u_arg[0]);
1556 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1557 tprintf(", %ld", tcp->u_arg[2]);
1559 * FIXME - dump out the list of aclent_t's pointed to
1560 * by "tcp->u_arg[3]" if it's not NULL.
1563 tprintf(", %#lx", tcp->u_arg[3]);
1570 static const struct xlat aclipc[] = {
1572 { IPC_SHM, "IPC_SHM" },
1575 { IPC_SEM, "IPC_SEM" },
1578 { IPC_MSG, "IPC_MSG" },
1584 sys_aclipc(struct tcb *tcp)
1586 if (entering(tcp)) {
1587 printxval(aclipc, tcp->u_arg[0], "???IPC???");
1588 tprintf(", %#lx, ", tcp->u_arg[1]);
1589 printxval(aclcmds, tcp->u_arg[2], "???ACL???");
1590 tprintf(", %ld", tcp->u_arg[3]);
1592 * FIXME - dump out the list of aclent_t's pointed to
1593 * by "tcp->u_arg[4]" if it's not NULL.
1596 tprintf(", %#lx", tcp->u_arg[4]);
1603 # endif /* HAVE_SYS_ACL_H */
1605 #endif /* SPARC[64] */
1607 static const struct xlat fsmagic[] = {
1608 { 0x73757245, "CODA_SUPER_MAGIC" },
1609 { 0x012ff7b7, "COH_SUPER_MAGIC" },
1610 { 0x1373, "DEVFS_SUPER_MAGIC" },
1611 { 0x1cd1, "DEVPTS_SUPER_MAGIC" },
1612 { 0x414A53, "EFS_SUPER_MAGIC" },
1613 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
1614 { 0xef53, "EXT2_SUPER_MAGIC" },
1615 { 0x137d, "EXT_SUPER_MAGIC" },
1616 { 0xf995e849, "HPFS_SUPER_MAGIC" },
1617 { 0x9660, "ISOFS_SUPER_MAGIC" },
1618 { 0x137f, "MINIX_SUPER_MAGIC" },
1619 { 0x138f, "MINIX_SUPER_MAGIC2" },
1620 { 0x2468, "MINIX2_SUPER_MAGIC" },
1621 { 0x2478, "MINIX2_SUPER_MAGIC2" },
1622 { 0x4d44, "MSDOS_SUPER_MAGIC" },
1623 { 0x564c, "NCP_SUPER_MAGIC" },
1624 { 0x6969, "NFS_SUPER_MAGIC" },
1625 { 0x9fa0, "PROC_SUPER_MAGIC" },
1626 { 0x002f, "QNX4_SUPER_MAGIC" },
1627 { 0x52654973, "REISERFS_SUPER_MAGIC" },
1628 { 0x02011994, "SHMFS_SUPER_MAGIC" },
1629 { 0x517b, "SMB_SUPER_MAGIC" },
1630 { 0x012ff7b6, "SYSV2_SUPER_MAGIC" },
1631 { 0x012ff7b5, "SYSV4_SUPER_MAGIC" },
1632 { 0x00011954, "UFS_MAGIC" },
1633 { 0x54190100, "UFS_CIGAM" },
1634 { 0x012ff7b4, "XENIX_SUPER_MAGIC" },
1635 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
1636 { 0x62656572, "SYSFS_MAGIC" },
1641 sprintfstype(int magic)
1643 static char buf[32];
1646 s = xlookup(fsmagic, magic);
1648 sprintf(buf, "\"%s\"", s);
1651 sprintf(buf, "%#x", magic);
1656 printstatfs(struct tcb *tcp, long addr)
1658 struct statfs statbuf;
1660 if (syserror(tcp) || !verbose(tcp)) {
1661 tprintf("%#lx", addr);
1664 if (umove(tcp, addr, &statbuf) < 0) {
1670 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
1671 sprintfstype(statbuf.f_type),
1672 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
1673 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_fsid={%d, %d}, f_namelen=%u",
1674 statbuf.f_bavail, statbuf.f_files, statbuf.f_ffree,
1675 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1],
1678 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
1679 sprintfstype(statbuf.f_type),
1680 (unsigned long)statbuf.f_bsize,
1681 (unsigned long)statbuf.f_blocks,
1682 (unsigned long)statbuf.f_bfree);
1683 tprintf("f_bavail=%lu, f_files=%lu, f_ffree=%lu, f_fsid={%d, %d}",
1684 (unsigned long)statbuf.f_bavail,
1685 (unsigned long)statbuf.f_files,
1686 (unsigned long)statbuf.f_ffree,
1687 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1688 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1690 #ifdef _STATFS_F_FRSIZE
1691 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
1697 sys_statfs(struct tcb *tcp)
1699 if (entering(tcp)) {
1700 printpath(tcp, tcp->u_arg[0]);
1703 printstatfs(tcp, tcp->u_arg[1]);
1709 sys_fstatfs(struct tcb *tcp)
1711 if (entering(tcp)) {
1712 printfd(tcp, tcp->u_arg[0]);
1715 printstatfs(tcp, tcp->u_arg[1]);
1720 #if defined HAVE_STATFS64
1722 printstatfs64(struct tcb *tcp, long addr)
1724 struct statfs64 statbuf;
1726 if (syserror(tcp) || !verbose(tcp)) {
1727 tprintf("%#lx", addr);
1730 if (umove(tcp, addr, &statbuf) < 0) {
1734 tprintf("{f_type=%s, f_bsize=%llu, f_blocks=%llu, f_bfree=%llu, ",
1735 sprintfstype(statbuf.f_type),
1736 (unsigned long long)statbuf.f_bsize,
1737 (unsigned long long)statbuf.f_blocks,
1738 (unsigned long long)statbuf.f_bfree);
1739 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
1740 (unsigned long long)statbuf.f_bavail,
1741 (unsigned long long)statbuf.f_files,
1742 (unsigned long long)statbuf.f_ffree,
1743 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1744 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1745 #ifdef _STATFS_F_FRSIZE
1746 tprintf(", f_frsize=%llu", (unsigned long long)statbuf.f_frsize);
1748 #ifdef _STATFS_F_FLAGS
1749 tprintf(", f_flags=%llu", (unsigned long long)statbuf.f_flags);
1754 struct compat_statfs64 {
1766 uint32_t f_spare[4];
1768 #if defined(X86_64) || defined(IA64)
1769 __attribute__ ((packed, aligned(4)))
1774 printcompat_statfs64(struct tcb *tcp, long addr)
1776 struct compat_statfs64 statbuf;
1778 if (syserror(tcp) || !verbose(tcp)) {
1779 tprintf("%#lx", addr);
1782 if (umove(tcp, addr, &statbuf) < 0) {
1786 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%llu, f_bfree=%llu, ",
1787 sprintfstype(statbuf.f_type),
1788 (unsigned long)statbuf.f_bsize,
1789 (unsigned long long)statbuf.f_blocks,
1790 (unsigned long long)statbuf.f_bfree);
1791 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
1792 (unsigned long long)statbuf.f_bavail,
1793 (unsigned long long)statbuf.f_files,
1794 (unsigned long long)statbuf.f_ffree,
1795 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1796 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1797 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
1798 tprintf(", f_flags=%lu}", (unsigned long)statbuf.f_frsize);
1802 sys_statfs64(struct tcb *tcp)
1804 if (entering(tcp)) {
1805 printpath(tcp, tcp->u_arg[0]);
1806 tprintf(", %lu, ", tcp->u_arg[1]);
1808 if (tcp->u_arg[1] == sizeof(struct statfs64))
1809 printstatfs64(tcp, tcp->u_arg[2]);
1810 else if (tcp->u_arg[1] == sizeof(struct compat_statfs64))
1811 printcompat_statfs64(tcp, tcp->u_arg[2]);
1819 sys_fstatfs64(struct tcb *tcp)
1821 if (entering(tcp)) {
1822 printfd(tcp, tcp->u_arg[0]);
1823 tprintf(", %lu, ", tcp->u_arg[1]);
1825 if (tcp->u_arg[1] == sizeof(struct statfs64))
1826 printstatfs64(tcp, tcp->u_arg[2]);
1827 else if (tcp->u_arg[1] == sizeof(struct compat_statfs64))
1828 printcompat_statfs64(tcp, tcp->u_arg[2]);
1838 osf_statfs(struct tcb *tcp)
1840 if (entering(tcp)) {
1841 printpath(tcp, tcp->u_arg[0]);
1844 printstatfs(tcp, tcp->u_arg[1]);
1845 tprintf(", %lu", tcp->u_arg[2]);
1851 osf_fstatfs(struct tcb *tcp)
1853 if (entering(tcp)) {
1854 tprintf("%lu, ", tcp->u_arg[0]);
1856 printstatfs(tcp, tcp->u_arg[1]);
1857 tprintf(", %lu", tcp->u_arg[2]);
1865 sys_chdir(struct tcb *tcp)
1867 if (entering(tcp)) {
1868 printpath(tcp, tcp->u_arg[0]);
1874 decode_mkdir(struct tcb *tcp, int offset)
1876 if (entering(tcp)) {
1877 printpath(tcp, tcp->u_arg[offset]);
1878 tprintf(", %#lo", tcp->u_arg[offset + 1]);
1884 sys_mkdir(struct tcb *tcp)
1886 return decode_mkdir(tcp, 0);
1890 sys_mkdirat(struct tcb *tcp)
1893 print_dirfd(tcp, tcp->u_arg[0]);
1894 return decode_mkdir(tcp, 1);
1898 sys_link(struct tcb *tcp)
1900 if (entering(tcp)) {
1901 printpath(tcp, tcp->u_arg[0]);
1903 printpath(tcp, tcp->u_arg[1]);
1909 sys_linkat(struct tcb *tcp)
1911 if (entering(tcp)) {
1912 print_dirfd(tcp, tcp->u_arg[0]);
1913 printpath(tcp, tcp->u_arg[1]);
1915 print_dirfd(tcp, tcp->u_arg[2]);
1916 printpath(tcp, tcp->u_arg[3]);
1918 printflags(at_flags, tcp->u_arg[4], "AT_???");
1924 sys_unlinkat(struct tcb *tcp)
1926 if (entering(tcp)) {
1927 print_dirfd(tcp, tcp->u_arg[0]);
1928 printpath(tcp, tcp->u_arg[1]);
1930 printflags(at_flags, tcp->u_arg[2], "AT_???");
1936 sys_symlinkat(struct tcb *tcp)
1938 if (entering(tcp)) {
1939 printpath(tcp, tcp->u_arg[0]);
1941 print_dirfd(tcp, tcp->u_arg[1]);
1942 printpath(tcp, tcp->u_arg[2]);
1948 decode_readlink(struct tcb *tcp, int offset)
1950 if (entering(tcp)) {
1951 printpath(tcp, tcp->u_arg[offset]);
1955 tprintf("%#lx", tcp->u_arg[offset + 1]);
1957 /* Used to use printpathn(), but readlink
1958 * neither includes NUL in the returned count,
1959 * nor actually writes it into memory.
1960 * printpathn() would decide on printing
1961 * "..." continuation based on garbage
1962 * past return buffer's end.
1964 printstr(tcp, tcp->u_arg[offset + 1], tcp->u_rval);
1965 tprintf(", %lu", tcp->u_arg[offset + 2]);
1971 sys_readlink(struct tcb *tcp)
1973 return decode_readlink(tcp, 0);
1977 sys_readlinkat(struct tcb *tcp)
1980 print_dirfd(tcp, tcp->u_arg[0]);
1981 return decode_readlink(tcp, 1);
1985 sys_renameat(struct tcb *tcp)
1987 if (entering(tcp)) {
1988 print_dirfd(tcp, tcp->u_arg[0]);
1989 printpath(tcp, tcp->u_arg[1]);
1991 print_dirfd(tcp, tcp->u_arg[2]);
1992 printpath(tcp, tcp->u_arg[3]);
1998 sys_chown(struct tcb *tcp)
2000 if (entering(tcp)) {
2001 printpath(tcp, tcp->u_arg[0]);
2002 printuid(", ", tcp->u_arg[1]);
2003 printuid(", ", tcp->u_arg[2]);
2009 sys_fchownat(struct tcb *tcp)
2011 if (entering(tcp)) {
2012 print_dirfd(tcp, tcp->u_arg[0]);
2013 printpath(tcp, tcp->u_arg[1]);
2014 printuid(", ", tcp->u_arg[2]);
2015 printuid(", ", tcp->u_arg[3]);
2017 printflags(at_flags, tcp->u_arg[4], "AT_???");
2023 sys_fchown(struct tcb *tcp)
2025 if (entering(tcp)) {
2026 printfd(tcp, tcp->u_arg[0]);
2027 printuid(", ", tcp->u_arg[1]);
2028 printuid(", ", tcp->u_arg[2]);
2034 decode_chmod(struct tcb *tcp, int offset)
2036 if (entering(tcp)) {
2037 printpath(tcp, tcp->u_arg[offset]);
2038 tprintf(", %#lo", tcp->u_arg[offset + 1]);
2044 sys_chmod(struct tcb *tcp)
2046 return decode_chmod(tcp, 0);
2050 sys_fchmodat(struct tcb *tcp)
2053 print_dirfd(tcp, tcp->u_arg[0]);
2054 return decode_chmod(tcp, 1);
2058 sys_fchmod(struct tcb *tcp)
2060 if (entering(tcp)) {
2061 printfd(tcp, tcp->u_arg[0]);
2062 tprintf(", %#lo", tcp->u_arg[1]);
2069 sys_osf_utimes(struct tcb *tcp)
2071 if (entering(tcp)) {
2072 printpath(tcp, tcp->u_arg[0]);
2074 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
2081 decode_utimes(struct tcb *tcp, int offset, int special)
2083 if (entering(tcp)) {
2084 printpath(tcp, tcp->u_arg[offset]);
2086 if (tcp->u_arg[offset + 1] == 0)
2090 printtv_bitness(tcp, tcp->u_arg[offset + 1],
2091 BITNESS_CURRENT, special);
2093 printtv_bitness(tcp, tcp->u_arg[offset + 1]
2094 + sizeof(struct timeval),
2095 BITNESS_CURRENT, special);
2103 sys_utimes(struct tcb *tcp)
2105 return decode_utimes(tcp, 0, 0);
2109 sys_futimesat(struct tcb *tcp)
2112 print_dirfd(tcp, tcp->u_arg[0]);
2113 return decode_utimes(tcp, 1, 0);
2117 sys_utimensat(struct tcb *tcp)
2119 if (entering(tcp)) {
2120 print_dirfd(tcp, tcp->u_arg[0]);
2121 decode_utimes(tcp, 1, 1);
2123 printflags(at_flags, tcp->u_arg[3], "AT_???");
2129 sys_utime(struct tcb *tcp)
2134 long paranoia_for_huge_wordsize[4];
2138 if (entering(tcp)) {
2139 printpath(tcp, tcp->u_arg[0]);
2142 wordsize = current_wordsize;
2145 else if (!verbose(tcp))
2146 tprintf("%#lx", tcp->u_arg[1]);
2147 else if (umoven(tcp, tcp->u_arg[1], 2 * wordsize, (char *) &u) < 0)
2149 else if (wordsize == sizeof u.utl[0]) {
2150 tprintf("[%s,", sprinttime(u.utl[0]));
2151 tprintf(" %s]", sprinttime(u.utl[1]));
2153 else if (wordsize == sizeof u.uti[0]) {
2154 tprintf("[%s,", sprinttime(u.uti[0]));
2155 tprintf(" %s]", sprinttime(u.uti[1]));
2158 tprintf("<decode error: unsupported wordsize %d>",
2165 decode_mknod(struct tcb *tcp, int offset)
2167 int mode = tcp->u_arg[offset + 1];
2169 if (entering(tcp)) {
2170 printpath(tcp, tcp->u_arg[offset]);
2171 tprintf(", %s", sprintmode(mode));
2172 switch (mode & S_IFMT) {
2175 #if defined(SPARC) || defined(SPARC64)
2176 if (current_personality == 1)
2177 tprintf(", makedev(%lu, %lu)",
2178 (unsigned long) ((tcp->u_arg[offset + 2] >> 18) & 0x3fff),
2179 (unsigned long) (tcp->u_arg[offset + 2] & 0x3ffff));
2182 tprintf(", makedev(%lu, %lu)",
2183 (unsigned long) major(tcp->u_arg[offset + 2]),
2184 (unsigned long) minor(tcp->u_arg[offset + 2]));
2194 sys_mknod(struct tcb *tcp)
2196 return decode_mknod(tcp, 0);
2200 sys_mknodat(struct tcb *tcp)
2203 print_dirfd(tcp, tcp->u_arg[0]);
2204 return decode_mknod(tcp, 1);
2208 printdir(struct tcb *tcp, long addr)
2212 if (!verbose(tcp)) {
2213 tprintf("%#lx", addr);
2216 if (umove(tcp, addr, &d) < 0) {
2220 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
2222 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
2227 sys_readdir(struct tcb *tcp)
2229 if (entering(tcp)) {
2230 printfd(tcp, tcp->u_arg[0]);
2233 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
2234 tprintf("%#lx", tcp->u_arg[1]);
2236 printdir(tcp, tcp->u_arg[1]);
2237 /* Not much point in printing this out, it is always 1. */
2238 if (tcp->u_arg[2] != 1)
2239 tprintf(", %lu", tcp->u_arg[2]);
2244 static const struct xlat direnttypes[] = {
2245 { DT_UNKNOWN, "DT_UNKNOWN" },
2246 { DT_FIFO, "DT_FIFO" },
2247 { DT_CHR, "DT_CHR" },
2248 { DT_DIR, "DT_DIR" },
2249 { DT_BLK, "DT_BLK" },
2250 { DT_REG, "DT_REG" },
2251 { DT_LNK, "DT_LNK" },
2252 { DT_SOCK, "DT_SOCK" },
2253 { DT_WHT, "DT_WHT" },
2258 sys_getdents(struct tcb *tcp)
2260 int i, len, dents = 0;
2263 if (entering(tcp)) {
2264 printfd(tcp, tcp->u_arg[0]);
2268 if (syserror(tcp) || !verbose(tcp)) {
2269 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2273 /* Beware of insanely large or negative values in tcp->u_rval */
2274 if (tcp->u_rval > 1024*1024)
2276 if (tcp->u_rval < 0)
2278 buf = len ? malloc(len) : NULL;
2280 die_out_of_memory();
2281 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2282 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2288 for (i = 0; i < len;) {
2289 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
2291 tprintf("%s{d_ino=%lu, d_off=%lu, ",
2292 i ? " " : "", d->d_ino, d->d_off);
2293 tprintf("d_reclen=%u, d_name=\"%s\", d_type=",
2294 d->d_reclen, d->d_name);
2295 printxval(direnttypes, buf[i + d->d_reclen - 1], "DT_???");
2299 tprints("/* d_reclen == 0, problem here */");
2308 tprintf("/* %u entries */", dents);
2309 tprintf(", %lu", tcp->u_arg[2]);
2314 #if _LFS64_LARGEFILE
2316 sys_getdents64(struct tcb *tcp)
2318 int i, len, dents = 0;
2321 if (entering(tcp)) {
2322 printfd(tcp, tcp->u_arg[0]);
2326 if (syserror(tcp) || !verbose(tcp)) {
2327 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2332 /* Beware of insanely large or negative tcp->u_rval */
2333 if (tcp->u_rval > 1024*1024)
2335 if (tcp->u_rval < 0)
2337 buf = len ? malloc(len) : NULL;
2339 die_out_of_memory();
2341 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2342 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2348 for (i = 0; i < len;) {
2349 struct dirent64 *d = (struct dirent64 *) &buf[i];
2351 tprintf("%s{d_ino=%" PRIu64 ", d_off=%" PRId64 ", ",
2356 printxval(direnttypes, d->d_type, "DT_???");
2358 tprintf("d_reclen=%u, d_name=\"%s\"}",
2359 d->d_reclen, d->d_name);
2362 tprints("/* d_reclen == 0, problem here */");
2371 tprintf("/* %u entries */", dents);
2372 tprintf(", %lu", tcp->u_arg[2]);
2379 sys_getcwd(struct tcb *tcp)
2383 tprintf("%#lx", tcp->u_arg[0]);
2385 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
2386 tprintf(", %lu", tcp->u_arg[1]);
2391 #ifdef HAVE_SYS_ASYNCH_H
2394 sys_aioread(struct tcb *tcp)
2396 struct aio_result_t res;
2398 if (entering(tcp)) {
2399 tprintf("%lu, ", tcp->u_arg[0]);
2402 tprintf("%#lx", tcp->u_arg[1]);
2404 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2405 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2406 printxval(whence, tcp->u_arg[4], "L_???");
2407 if (syserror(tcp) || tcp->u_arg[5] == 0
2408 || umove(tcp, tcp->u_arg[5], &res) < 0)
2409 tprintf(", %#lx", tcp->u_arg[5]);
2411 tprintf(", {aio_return %d aio_errno %d}",
2412 res.aio_return, res.aio_errno);
2418 sys_aiowrite(struct tcb *tcp)
2420 struct aio_result_t res;
2422 if (entering(tcp)) {
2423 tprintf("%lu, ", tcp->u_arg[0]);
2424 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2425 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2426 printxval(whence, tcp->u_arg[4], "L_???");
2429 if (tcp->u_arg[5] == 0)
2431 else if (syserror(tcp)
2432 || umove(tcp, tcp->u_arg[5], &res) < 0)
2433 tprintf(", %#lx", tcp->u_arg[5]);
2435 tprintf(", {aio_return %d aio_errno %d}",
2436 res.aio_return, res.aio_errno);
2442 sys_aiowait(struct tcb *tcp)
2445 printtv(tcp, tcp->u_arg[0]);
2450 sys_aiocancel(struct tcb *tcp)
2452 struct aio_result_t res;
2455 if (tcp->u_arg[0] == 0)
2457 else if (syserror(tcp)
2458 || umove(tcp, tcp->u_arg[0], &res) < 0)
2459 tprintf("%#lx", tcp->u_arg[0]);
2461 tprintf("{aio_return %d aio_errno %d}",
2462 res.aio_return, res.aio_errno);
2467 #endif /* HAVE_SYS_ASYNCH_H */
2469 static const struct xlat xattrflags[] = {
2471 { XATTR_CREATE, "XATTR_CREATE" },
2472 { XATTR_REPLACE, "XATTR_REPLACE" },
2478 print_xattr_val(struct tcb *tcp, int failed,
2480 unsigned long insize,
2486 unsigned long capacity = 4 * size + 1;
2487 unsigned char *buf = (capacity < size) ? NULL : malloc(capacity);
2488 if (buf == NULL || /* probably a bogus size argument */
2489 umoven(tcp, arg, size, (char *) &buf[3 * size]) < 0) {
2493 unsigned char *out = buf;
2494 unsigned char *in = &buf[3 * size];
2496 for (i = 0; i < size; ++i) {
2500 #define tohex(n) "0123456789abcdef"[n]
2503 *out++ = tohex(in[i] / 16);
2504 *out++ = tohex(in[i] % 16);
2507 /* Don't print terminating NUL if there is one. */
2508 if (i > 0 && in[i - 1] == '\0')
2511 tprintf(", \"%s\", %ld", buf, insize);
2516 tprintf(", 0x%lx, %ld", arg, insize);
2520 sys_setxattr(struct tcb *tcp)
2522 if (entering(tcp)) {
2523 printpath(tcp, tcp->u_arg[0]);
2525 printstr(tcp, tcp->u_arg[1], -1);
2526 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2528 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2534 sys_fsetxattr(struct tcb *tcp)
2536 if (entering(tcp)) {
2537 printfd(tcp, tcp->u_arg[0]);
2539 printstr(tcp, tcp->u_arg[1], -1);
2540 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2542 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2548 sys_getxattr(struct tcb *tcp)
2550 if (entering(tcp)) {
2551 printpath(tcp, tcp->u_arg[0]);
2553 printstr(tcp, tcp->u_arg[1], -1);
2555 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2562 sys_fgetxattr(struct tcb *tcp)
2564 if (entering(tcp)) {
2565 printfd(tcp, tcp->u_arg[0]);
2567 printstr(tcp, tcp->u_arg[1], -1);
2569 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2576 print_xattr_list(struct tcb *tcp, unsigned long addr, unsigned long size)
2578 if (syserror(tcp)) {
2579 tprintf("%#lx", addr);
2585 (size < tcp->u_rval) ? size : tcp->u_rval;
2586 printstr(tcp, addr, len);
2589 tprintf(", %lu", size);
2593 sys_listxattr(struct tcb *tcp)
2595 if (entering(tcp)) {
2596 printpath(tcp, tcp->u_arg[0]);
2599 print_xattr_list(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2605 sys_flistxattr(struct tcb *tcp)
2607 if (entering(tcp)) {
2608 printfd(tcp, tcp->u_arg[0]);
2611 print_xattr_list(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2617 sys_removexattr(struct tcb *tcp)
2619 if (entering(tcp)) {
2620 printpath(tcp, tcp->u_arg[0]);
2622 printstr(tcp, tcp->u_arg[1], -1);
2628 sys_fremovexattr(struct tcb *tcp)
2630 if (entering(tcp)) {
2631 printfd(tcp, tcp->u_arg[0]);
2633 printstr(tcp, tcp->u_arg[1], -1);
2638 static const struct xlat advise[] = {
2639 { POSIX_FADV_NORMAL, "POSIX_FADV_NORMAL" },
2640 { POSIX_FADV_RANDOM, "POSIX_FADV_RANDOM" },
2641 { POSIX_FADV_SEQUENTIAL, "POSIX_FADV_SEQUENTIAL" },
2642 { POSIX_FADV_WILLNEED, "POSIX_FADV_WILLNEED" },
2643 { POSIX_FADV_DONTNEED, "POSIX_FADV_DONTNEED" },
2644 { POSIX_FADV_NOREUSE, "POSIX_FADV_NOREUSE" },
2649 sys_fadvise64(struct tcb *tcp)
2651 if (entering(tcp)) {
2653 printfd(tcp, tcp->u_arg[0]);
2654 argn = printllval(tcp, ", %lld", 1);
2655 tprintf(", %ld, ", tcp->u_arg[argn++]);
2656 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2662 sys_fadvise64_64(struct tcb *tcp)
2664 if (entering(tcp)) {
2666 printfd(tcp, tcp->u_arg[0]);
2667 #if defined ARM || defined POWERPC
2668 argn = printllval(tcp, ", %lld, ", 2);
2670 argn = printllval(tcp, ", %lld, ", 1);
2672 argn = printllval(tcp, "%lld, ", argn);
2673 #if defined ARM || defined POWERPC
2674 printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
2676 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2682 static const struct xlat inotify_modes[] = {
2683 { 0x00000001, "IN_ACCESS" },
2684 { 0x00000002, "IN_MODIFY" },
2685 { 0x00000004, "IN_ATTRIB" },
2686 { 0x00000008, "IN_CLOSE_WRITE"},
2687 { 0x00000010, "IN_CLOSE_NOWRITE"},
2688 { 0x00000020, "IN_OPEN" },
2689 { 0x00000040, "IN_MOVED_FROM" },
2690 { 0x00000080, "IN_MOVED_TO" },
2691 { 0x00000100, "IN_CREATE" },
2692 { 0x00000200, "IN_DELETE" },
2693 { 0x00000400, "IN_DELETE_SELF"},
2694 { 0x00000800, "IN_MOVE_SELF" },
2695 { 0x00002000, "IN_UNMOUNT" },
2696 { 0x00004000, "IN_Q_OVERFLOW" },
2697 { 0x00008000, "IN_IGNORED" },
2698 { 0x01000000, "IN_ONLYDIR" },
2699 { 0x02000000, "IN_DONT_FOLLOW"},
2700 { 0x20000000, "IN_MASK_ADD" },
2701 { 0x40000000, "IN_ISDIR" },
2702 { 0x80000000, "IN_ONESHOT" },
2706 static const struct xlat inotify_init_flags[] = {
2707 { 0x00000800, "IN_NONBLOCK" },
2708 { 0x00080000, "IN_CLOEXEC" },
2713 sys_inotify_add_watch(struct tcb *tcp)
2715 if (entering(tcp)) {
2716 printfd(tcp, tcp->u_arg[0]);
2718 printpath(tcp, tcp->u_arg[1]);
2720 printflags(inotify_modes, tcp->u_arg[2], "IN_???");
2726 sys_inotify_rm_watch(struct tcb *tcp)
2728 if (entering(tcp)) {
2729 printfd(tcp, tcp->u_arg[0]);
2730 tprintf(", %d", (int) tcp->u_arg[1]);
2736 sys_inotify_init1(struct tcb *tcp)
2739 printflags(inotify_init_flags, tcp->u_arg[0], "IN_???");
2744 sys_fallocate(struct tcb *tcp)
2746 if (entering(tcp)) {
2748 printfd(tcp, tcp->u_arg[0]); /* fd */
2749 tprintf(", %#lo, ", tcp->u_arg[1]); /* mode */
2750 argn = printllval(tcp, "%llu, ", 2); /* offset */
2751 printllval(tcp, "%llu", argn); /* len */
2756 #ifndef SWAP_FLAG_PREFER
2757 # define SWAP_FLAG_PREFER 0x8000
2759 #ifndef SWAP_FLAG_DISCARD
2760 # define SWAP_FLAG_DISCARD 0x10000
2762 static const struct xlat swap_flags[] = {
2763 { SWAP_FLAG_PREFER, "SWAP_FLAG_PREFER" },
2764 { SWAP_FLAG_DISCARD, "SWAP_FLAG_DISCARD" },
2769 sys_swapon(struct tcb *tcp)
2771 if (entering(tcp)) {
2772 int flags = tcp->u_arg[1];
2773 printpath(tcp, tcp->u_arg[0]);
2775 printflags(swap_flags, flags & ~SWAP_FLAG_PRIO_MASK,
2777 if (flags & SWAP_FLAG_PREFER)
2778 tprintf("|%d", flags & SWAP_FLAG_PRIO_MASK);
2789 realprintstat64(struct tcb *tcp, long addr)
2791 struct stat64 statbuf;
2797 if (syserror(tcp) || !verbose(tcp)) {
2798 tprintf("%#lx", addr);
2802 if (umove(tcp, addr, &statbuf) < 0) {
2808 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
2809 (unsigned long) major(statbuf.st_dev),
2810 (unsigned long) minor(statbuf.st_dev),
2811 (unsigned long long) statbuf.st_ino,
2812 sprintmode(statbuf.st_mode));
2813 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
2814 (unsigned long) statbuf.st_nlink,
2815 (unsigned long) statbuf.st_uid,
2816 (unsigned long) statbuf.st_gid);
2817 tprintf("st_blksize=%lu, ",
2818 (unsigned long) statbuf.st_blksize);
2819 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
2822 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
2823 switch (statbuf.st_mode & S_IFMT) {
2824 case S_IFCHR: case S_IFBLK:
2825 tprintf("st_rdev=makedev(%lu, %lu), ",
2826 (unsigned long) major(statbuf.st_rdev),
2827 (unsigned long) minor(statbuf.st_rdev));
2830 tprintf("st_size=%llu, ", (unsigned long long) statbuf.st_size);
2834 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
2835 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
2836 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
2844 sys_fstat64(struct tcb *tcp)
2846 if (entering(tcp)) {
2847 printfd(tcp, tcp->u_arg[0]);
2850 realprintstat64(tcp, tcp->u_arg[1]);
2856 sys_stat64(struct tcb *tcp)
2858 if (entering(tcp)) {
2859 printpath(tcp, tcp->u_arg[0]);
2862 realprintstat64(tcp, tcp->u_arg[1]);