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_codes[] = {
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.
531 * Use test/x32_lseek.c to test lseek decoding.
533 #if defined(LINUX_MIPSN32) || defined(X32)
535 sys_lseek(struct tcb *tcp)
541 printfd(tcp, tcp->u_arg[0]);
542 offset = tcp->ext_arg[1];
543 whence = tcp->u_arg[2];
544 if (whence == SEEK_SET)
545 tprintf(", %llu, ", offset);
547 tprintf(", %lld, ", offset);
548 printxval(whence_codes, whence, "SEEK_???");
550 return RVAL_LUDECIMAL;
554 sys_lseek(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_codes, whence, "SEEK_???");
569 return RVAL_UDECIMAL;
573 /* llseek syscall takes explicitly two ulong arguments hi, lo,
574 * rather than one 64-bit argument for which LONG_LONG works
575 * appropriate for the native byte order.
577 * See kernel's fs/read_write.c::SYSCALL_DEFINE5(llseek, ...)
579 * hi,lo are "unsigned longs" and combined exactly this way in kernel:
580 * ((loff_t) hi << 32) | lo
581 * Note that for architectures with kernel's long wider than userspace long
582 * (such as x32), combining code will use *kernel's*, i.e. *wide* longs
583 * for hi and lo. We may need to use tcp->ext_arg[N]!
586 sys_llseek(struct tcb *tcp)
589 printfd(tcp, tcp->u_arg[0]);
590 if (tcp->u_arg[4] == SEEK_SET)
592 ((long long) tcp->u_arg[1]) << 32 |
593 (unsigned long long) (unsigned) tcp->u_arg[2]);
596 ((long long) tcp->u_arg[1]) << 32 |
597 (unsigned long long) (unsigned) tcp->u_arg[2]);
601 if (syserror(tcp) || umove(tcp, tcp->u_arg[3], &off) < 0)
602 tprintf("%#lx, ", tcp->u_arg[3]);
604 tprintf("[%llu], ", off);
605 printxval(whence_codes, tcp->u_arg[4], "SEEK_???");
611 sys_readahead(struct tcb *tcp)
615 printfd(tcp, tcp->u_arg[0]);
616 argn = printllval(tcp, ", %lld", 1);
617 tprintf(", %ld", tcp->u_arg[argn]);
622 #ifndef HAVE_LONG_LONG_OFF_T
624 sys_truncate(struct tcb *tcp)
627 printpath(tcp, tcp->u_arg[0]);
628 tprintf(", %lu", tcp->u_arg[1]);
634 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
636 sys_truncate64(struct tcb *tcp)
639 printpath(tcp, tcp->u_arg[0]);
640 printllval(tcp, ", %llu", 1);
646 #ifndef HAVE_LONG_LONG_OFF_T
648 sys_ftruncate(struct tcb *tcp)
651 printfd(tcp, tcp->u_arg[0]);
652 tprintf(", %lu", tcp->u_arg[1]);
658 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
660 sys_ftruncate64(struct tcb *tcp)
663 printfd(tcp, tcp->u_arg[0]);
664 printllval(tcp, ", %llu", 1);
672 static const struct xlat modetypes[] = {
673 { S_IFREG, "S_IFREG" },
674 { S_IFSOCK, "S_IFSOCK" },
675 { S_IFIFO, "S_IFIFO" },
676 { S_IFLNK, "S_IFLNK" },
677 { S_IFDIR, "S_IFDIR" },
678 { S_IFBLK, "S_IFBLK" },
679 { S_IFCHR, "S_IFCHR" },
686 static char buf[sizeof("S_IFSOCK|S_ISUID|S_ISGID|S_ISVTX|%o")
691 if ((mode & S_IFMT) == 0)
693 else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) {
694 sprintf(buf, "%#o", mode);
697 s = buf + sprintf(buf, "%s%s%s%s", s,
698 (mode & S_ISUID) ? "|S_ISUID" : "",
699 (mode & S_ISGID) ? "|S_ISGID" : "",
700 (mode & S_ISVTX) ? "|S_ISVTX" : "");
701 mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX);
703 sprintf((char*)s, "|%#o", mode);
704 s = (*buf == '|') ? buf + 1 : buf;
712 static char buf[sizeof("yyyy/mm/dd-hh:mm:ss")];
720 snprintf(buf, sizeof buf, "%02d/%02d/%02d-%02d:%02d:%02d",
721 tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
722 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
724 snprintf(buf, sizeof buf, "%lu", (unsigned long) t);
729 #if defined(SPARC) || defined(SPARC64)
737 int st_pad1[3]; /* network id */
746 int st_pad3; /* st_size, off_t expansion */
747 timestruct_t st_atime;
748 timestruct_t st_mtime;
749 timestruct_t st_ctime;
753 int st_pad4[8]; /* expansion area */
757 printstatsol(struct tcb *tcp, long addr)
759 struct solstat statbuf;
761 if (umove(tcp, addr, &statbuf) < 0) {
766 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
767 (unsigned long) ((statbuf.st_dev >> 18) & 0x3fff),
768 (unsigned long) (statbuf.st_dev & 0x3ffff),
769 (unsigned long) statbuf.st_ino,
770 sprintmode(statbuf.st_mode));
771 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
772 (unsigned long) statbuf.st_nlink,
773 (unsigned long) statbuf.st_uid,
774 (unsigned long) statbuf.st_gid);
775 tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);
776 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
779 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
780 switch (statbuf.st_mode & S_IFMT) {
781 case S_IFCHR: case S_IFBLK:
782 tprintf("st_rdev=makedev(%lu, %lu), ",
783 (unsigned long) ((statbuf.st_rdev >> 18) & 0x3fff),
784 (unsigned long) (statbuf.st_rdev & 0x3ffff));
787 tprintf("st_size=%u, ", statbuf.st_size);
791 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime.tv_sec));
792 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime.tv_sec));
793 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime.tv_sec));
799 # if defined(SPARC64)
801 printstat_sparc64(struct tcb *tcp, long addr)
803 struct stat_sparc64 statbuf;
805 if (umove(tcp, addr, &statbuf) < 0) {
811 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
812 (unsigned long) major(statbuf.st_dev),
813 (unsigned long) minor(statbuf.st_dev),
814 (unsigned long) statbuf.st_ino,
815 sprintmode(statbuf.st_mode));
816 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
817 (unsigned long) statbuf.st_nlink,
818 (unsigned long) statbuf.st_uid,
819 (unsigned long) statbuf.st_gid);
820 tprintf("st_blksize=%lu, ",
821 (unsigned long) statbuf.st_blksize);
822 tprintf("st_blocks=%lu, ",
823 (unsigned long) statbuf.st_blocks);
826 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
827 switch (statbuf.st_mode & S_IFMT) {
828 case S_IFCHR: case S_IFBLK:
829 tprintf("st_rdev=makedev(%lu, %lu), ",
830 (unsigned long) major(statbuf.st_rdev),
831 (unsigned long) minor(statbuf.st_rdev));
834 tprintf("st_size=%lu, ", statbuf.st_size);
838 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
839 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
840 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
845 # endif /* SPARC64 */
846 #endif /* SPARC[64] */
848 #if defined POWERPC64
849 struct stat_powerpc32 {
852 unsigned int st_mode;
853 unsigned short st_nlink;
856 unsigned int st_rdev;
857 unsigned int st_size;
858 unsigned int st_blksize;
859 unsigned int st_blocks;
860 unsigned int st_atime;
861 unsigned int st_atime_nsec;
862 unsigned int st_mtime;
863 unsigned int st_mtime_nsec;
864 unsigned int st_ctime;
865 unsigned int st_ctime_nsec;
866 unsigned int __unused4;
867 unsigned int __unused5;
871 printstat_powerpc32(struct tcb *tcp, long addr)
873 struct stat_powerpc32 statbuf;
875 if (umove(tcp, addr, &statbuf) < 0) {
881 tprintf("{st_dev=makedev(%u, %u), st_ino=%u, st_mode=%s, ",
882 major(statbuf.st_dev), minor(statbuf.st_dev),
884 sprintmode(statbuf.st_mode));
885 tprintf("st_nlink=%u, st_uid=%u, st_gid=%u, ",
886 statbuf.st_nlink, statbuf.st_uid, statbuf.st_gid);
887 tprintf("st_blksize=%u, ", statbuf.st_blksize);
888 tprintf("st_blocks=%u, ", statbuf.st_blocks);
891 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
892 switch (statbuf.st_mode & S_IFMT) {
893 case S_IFCHR: case S_IFBLK:
894 tprintf("st_rdev=makedev(%lu, %lu), ",
895 (unsigned long) major(statbuf.st_rdev),
896 (unsigned long) minor(statbuf.st_rdev));
899 tprintf("st_size=%u, ", statbuf.st_size);
903 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
904 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
905 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
910 #endif /* POWERPC64 */
912 static const struct xlat fileflags[] = {
916 #ifndef HAVE_LONG_LONG_OFF_T
918 realprintstat(struct tcb *tcp, struct stat *statbuf)
921 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
922 (unsigned long) major(statbuf->st_dev),
923 (unsigned long) minor(statbuf->st_dev),
924 (unsigned long) statbuf->st_ino,
925 sprintmode(statbuf->st_mode));
926 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
927 (unsigned long) statbuf->st_nlink,
928 (unsigned long) statbuf->st_uid,
929 (unsigned long) statbuf->st_gid);
930 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
931 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
933 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
934 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
938 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
939 switch (statbuf->st_mode & S_IFMT) {
940 case S_IFCHR: case S_IFBLK:
941 #ifdef HAVE_STRUCT_STAT_ST_RDEV
942 tprintf("st_rdev=makedev(%lu, %lu), ",
943 (unsigned long) major(statbuf->st_rdev),
944 (unsigned long) minor(statbuf->st_rdev));
945 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
946 tprintf("st_size=makedev(%lu, %lu), ",
947 (unsigned long) major(statbuf->st_size),
948 (unsigned long) minor(statbuf->st_size));
949 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
952 tprintf("st_size=%lu, ", (unsigned long) statbuf->st_size);
956 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
957 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
958 tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));
959 #if HAVE_STRUCT_STAT_ST_FLAGS
960 tprints(", st_flags=");
961 printflags(fileflags, statbuf->st_flags, "UF_???");
963 #if HAVE_STRUCT_STAT_ST_ACLCNT
964 tprintf(", st_aclcnt=%d", statbuf->st_aclcnt);
966 #if HAVE_STRUCT_STAT_ST_LEVEL
967 tprintf(", st_level=%ld", statbuf->st_level);
969 #if HAVE_STRUCT_STAT_ST_FSTYPE
970 tprintf(", st_fstype=%.*s",
971 (int) sizeof statbuf->st_fstype, statbuf->st_fstype);
973 #if HAVE_STRUCT_STAT_ST_GEN
974 tprintf(", st_gen=%u", statbuf->st_gen);
983 printstat(struct tcb *tcp, long addr)
991 if (syserror(tcp) || !verbose(tcp)) {
992 tprintf("%#lx", addr);
996 #if defined(SPARC) || defined(SPARC64)
997 if (current_personality == 1) {
998 printstatsol(tcp, addr);
1002 else if (current_personality == 2) {
1003 printstat_sparc64(tcp, addr);
1007 #endif /* SPARC[64] */
1009 #if defined POWERPC64
1010 if (current_personality == 1) {
1011 printstat_powerpc32(tcp, addr);
1016 if (umove(tcp, addr, &statbuf) < 0) {
1021 realprintstat(tcp, &statbuf);
1023 #endif /* !HAVE_LONG_LONG_OFF_T */
1025 #if !defined HAVE_STAT64 && defined X86_64
1027 * Linux x86_64 has unified `struct stat' but its i386 biarch needs
1028 * `struct stat64'. Its <asm-i386/stat.h> definition expects 32-bit `long'.
1029 * <linux/include/asm-x86_64/ia32.h> is not in the public includes set.
1030 * __GNUC__ is needed for the required __attribute__ below.
1033 unsigned long long st_dev;
1034 unsigned char __pad0[4];
1035 unsigned int __st_ino;
1036 unsigned int st_mode;
1037 unsigned int st_nlink;
1038 unsigned int st_uid;
1039 unsigned int st_gid;
1040 unsigned long long st_rdev;
1041 unsigned char __pad3[4];
1043 unsigned int st_blksize;
1044 unsigned long long st_blocks;
1045 unsigned int st_atime;
1046 unsigned int st_atime_nsec;
1047 unsigned int st_mtime;
1048 unsigned int st_mtime_nsec;
1049 unsigned int st_ctime;
1050 unsigned int st_ctime_nsec;
1051 unsigned long long st_ino;
1052 } __attribute__((packed));
1053 # define HAVE_STAT64 1
1054 # define STAT64_SIZE 96
1059 printstat64(struct tcb *tcp, long addr)
1061 struct stat64 statbuf;
1064 (void) sizeof(char[sizeof statbuf == STAT64_SIZE ? 1 : -1]);
1071 if (syserror(tcp) || !verbose(tcp)) {
1072 tprintf("%#lx", addr);
1076 #if defined(SPARC) || defined(SPARC64)
1077 if (current_personality == 1) {
1078 printstatsol(tcp, addr);
1082 else if (current_personality == 2) {
1083 printstat_sparc64(tcp, addr);
1087 #endif /* SPARC[64] */
1090 if (current_personality != 1) {
1091 printstat(tcp, addr);
1096 if (umove(tcp, addr, &statbuf) < 0) {
1102 #ifdef HAVE_LONG_LONG
1103 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
1105 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
1107 (unsigned long) major(statbuf.st_dev),
1108 (unsigned long) minor(statbuf.st_dev),
1109 #ifdef HAVE_LONG_LONG
1110 (unsigned long long) statbuf.st_ino,
1112 (unsigned long) statbuf.st_ino,
1114 sprintmode(statbuf.st_mode));
1115 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
1116 (unsigned long) statbuf.st_nlink,
1117 (unsigned long) statbuf.st_uid,
1118 (unsigned long) statbuf.st_gid);
1119 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
1120 tprintf("st_blksize=%lu, ",
1121 (unsigned long) statbuf.st_blksize);
1122 #endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */
1123 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
1124 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
1125 #endif /* HAVE_STRUCT_STAT_ST_BLOCKS */
1128 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
1129 switch (statbuf.st_mode & S_IFMT) {
1130 case S_IFCHR: case S_IFBLK:
1131 #ifdef HAVE_STRUCT_STAT_ST_RDEV
1132 tprintf("st_rdev=makedev(%lu, %lu), ",
1133 (unsigned long) major(statbuf.st_rdev),
1134 (unsigned long) minor(statbuf.st_rdev));
1135 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
1136 tprintf("st_size=makedev(%lu, %lu), ",
1137 (unsigned long) major(statbuf.st_size),
1138 (unsigned long) minor(statbuf.st_size));
1139 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
1142 #ifdef HAVE_LONG_LONG
1143 tprintf("st_size=%llu, ", (unsigned long long) statbuf.st_size);
1145 tprintf("st_size=%lu, ", (unsigned long) statbuf.st_size);
1150 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
1151 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
1152 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
1153 #if HAVE_STRUCT_STAT_ST_FLAGS
1154 tprints(", st_flags=");
1155 printflags(fileflags, statbuf.st_flags, "UF_???");
1157 #if HAVE_STRUCT_STAT_ST_ACLCNT
1158 tprintf(", st_aclcnt=%d", statbuf.st_aclcnt);
1160 #if HAVE_STRUCT_STAT_ST_LEVEL
1161 tprintf(", st_level=%ld", statbuf.st_level);
1163 #if HAVE_STRUCT_STAT_ST_FSTYPE
1164 tprintf(", st_fstype=%.*s",
1165 (int) sizeof statbuf.st_fstype, statbuf.st_fstype);
1167 #if HAVE_STRUCT_STAT_ST_GEN
1168 tprintf(", st_gen=%u", statbuf.st_gen);
1175 #endif /* HAVE_STAT64 */
1177 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
1179 convertoldstat(const struct __old_kernel_stat *oldbuf, struct stat *newbuf)
1181 newbuf->st_dev = oldbuf->st_dev;
1182 newbuf->st_ino = oldbuf->st_ino;
1183 newbuf->st_mode = oldbuf->st_mode;
1184 newbuf->st_nlink = oldbuf->st_nlink;
1185 newbuf->st_uid = oldbuf->st_uid;
1186 newbuf->st_gid = oldbuf->st_gid;
1187 newbuf->st_rdev = oldbuf->st_rdev;
1188 newbuf->st_size = oldbuf->st_size;
1189 newbuf->st_atime = oldbuf->st_atime;
1190 newbuf->st_mtime = oldbuf->st_mtime;
1191 newbuf->st_ctime = oldbuf->st_ctime;
1192 newbuf->st_blksize = 0; /* not supported in old_stat */
1193 newbuf->st_blocks = 0; /* not supported in old_stat */
1197 printoldstat(struct tcb *tcp, long addr)
1199 struct __old_kernel_stat statbuf;
1200 struct stat newstatbuf;
1206 if (syserror(tcp) || !verbose(tcp)) {
1207 tprintf("%#lx", addr);
1211 # if defined(SPARC) || defined(SPARC64)
1212 if (current_personality == 1) {
1213 printstatsol(tcp, addr);
1218 if (umove(tcp, addr, &statbuf) < 0) {
1223 convertoldstat(&statbuf, &newstatbuf);
1224 realprintstat(tcp, &newstatbuf);
1228 #ifndef HAVE_LONG_LONG_OFF_T
1230 sys_stat(struct tcb *tcp)
1232 if (entering(tcp)) {
1233 printpath(tcp, tcp->u_arg[0]);
1236 printstat(tcp, tcp->u_arg[1]);
1243 sys_stat64(struct tcb *tcp)
1246 if (entering(tcp)) {
1247 printpath(tcp, tcp->u_arg[0]);
1250 printstat64(tcp, tcp->u_arg[1]);
1254 return printargs(tcp);
1258 #ifndef AT_SYMLINK_NOFOLLOW
1259 # define AT_SYMLINK_NOFOLLOW 0x100
1261 #ifndef AT_REMOVEDIR
1262 # define AT_REMOVEDIR 0x200
1264 #ifndef AT_SYMLINK_FOLLOW
1265 # define AT_SYMLINK_FOLLOW 0x400
1267 #ifndef AT_NO_AUTOMOUNT
1268 # define AT_NO_AUTOMOUNT 0x800
1270 #ifndef AT_EMPTY_PATH
1271 # define AT_EMPTY_PATH 0x1000
1274 static const struct xlat at_flags[] = {
1275 { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" },
1276 { AT_REMOVEDIR, "AT_REMOVEDIR" },
1277 { AT_SYMLINK_FOLLOW, "AT_SYMLINK_FOLLOW" },
1278 { AT_NO_AUTOMOUNT, "AT_NO_AUTOMOUNT" },
1279 { AT_EMPTY_PATH, "AT_EMPTY_PATH" },
1284 sys_newfstatat(struct tcb *tcp)
1286 if (entering(tcp)) {
1287 print_dirfd(tcp, tcp->u_arg[0]);
1288 printpath(tcp, tcp->u_arg[1]);
1292 if (current_personality == 0)
1293 printstat(tcp, tcp->u_arg[2]);
1295 printstat64(tcp, tcp->u_arg[2]);
1296 #elif defined HAVE_STAT64
1297 printstat64(tcp, tcp->u_arg[2]);
1299 printstat(tcp, tcp->u_arg[2]);
1302 printflags(at_flags, tcp->u_arg[3], "AT_???");
1307 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
1309 sys_oldstat(struct tcb *tcp)
1311 if (entering(tcp)) {
1312 printpath(tcp, tcp->u_arg[0]);
1315 printoldstat(tcp, tcp->u_arg[1]);
1321 #ifndef HAVE_LONG_LONG_OFF_T
1323 sys_fstat(struct tcb *tcp)
1325 if (entering(tcp)) {
1326 printfd(tcp, tcp->u_arg[0]);
1329 printstat(tcp, tcp->u_arg[1]);
1336 sys_fstat64(struct tcb *tcp)
1339 if (entering(tcp)) {
1340 printfd(tcp, tcp->u_arg[0]);
1343 printstat64(tcp, tcp->u_arg[1]);
1347 return printargs(tcp);
1351 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
1353 sys_oldfstat(struct tcb *tcp)
1355 if (entering(tcp)) {
1356 printfd(tcp, tcp->u_arg[0]);
1359 printoldstat(tcp, tcp->u_arg[1]);
1365 #ifndef HAVE_LONG_LONG_OFF_T
1367 sys_lstat(struct tcb *tcp)
1369 if (entering(tcp)) {
1370 printpath(tcp, tcp->u_arg[0]);
1373 printstat(tcp, tcp->u_arg[1]);
1380 sys_lstat64(struct tcb *tcp)
1383 if (entering(tcp)) {
1384 printpath(tcp, tcp->u_arg[0]);
1387 printstat64(tcp, tcp->u_arg[1]);
1391 return printargs(tcp);
1395 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT) && !defined(HAVE_LONG_LONG_OFF_T)
1397 sys_oldlstat(struct tcb *tcp)
1399 if (entering(tcp)) {
1400 printpath(tcp, tcp->u_arg[0]);
1403 printoldstat(tcp, tcp->u_arg[1]);
1409 #if defined(SPARC) || defined(SPARC64)
1412 sys_xstat(struct tcb *tcp)
1414 if (entering(tcp)) {
1415 tprintf("%ld, ", tcp->u_arg[0]);
1416 printpath(tcp, tcp->u_arg[1]);
1420 if (tcp->u_arg[0] == _STAT64_VER)
1421 printstat64(tcp, tcp->u_arg[2]);
1424 printstat(tcp, tcp->u_arg[2]);
1430 sys_fxstat(struct tcb *tcp)
1433 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
1436 if (tcp->u_arg[0] == _STAT64_VER)
1437 printstat64(tcp, tcp->u_arg[2]);
1440 printstat(tcp, tcp->u_arg[2]);
1446 sys_lxstat(struct tcb *tcp)
1448 if (entering(tcp)) {
1449 tprintf("%ld, ", tcp->u_arg[0]);
1450 printpath(tcp, tcp->u_arg[1]);
1454 if (tcp->u_arg[0] == _STAT64_VER)
1455 printstat64(tcp, tcp->u_arg[2]);
1458 printstat(tcp, tcp->u_arg[2]);
1464 sys_xmknod(struct tcb *tcp)
1466 int mode = tcp->u_arg[2];
1468 if (entering(tcp)) {
1469 tprintf("%ld, ", tcp->u_arg[0]);
1470 printpath(tcp, tcp->u_arg[1]);
1471 tprintf(", %s", sprintmode(mode));
1472 switch (mode & S_IFMT) {
1473 case S_IFCHR: case S_IFBLK:
1474 tprintf(", makedev(%lu, %lu)",
1475 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
1476 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
1485 # ifdef HAVE_SYS_ACL_H
1487 # include <sys/acl.h>
1489 static const struct xlat aclcmds[] = {
1491 { SETACL, "SETACL" },
1494 { GETACL, "GETACL" },
1497 { GETACLCNT, "GETACLCNT" },
1500 { ACL_GET, "ACL_GET" },
1503 { ACL_SET, "ACL_SET" },
1506 { ACL_CNT, "ACL_CNT" },
1512 sys_acl(struct tcb *tcp)
1514 if (entering(tcp)) {
1515 printpath(tcp, tcp->u_arg[0]);
1517 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1518 tprintf(", %ld", tcp->u_arg[2]);
1520 * FIXME - dump out the list of aclent_t's pointed to
1521 * by "tcp->u_arg[3]" if it's not NULL.
1524 tprintf(", %#lx", tcp->u_arg[3]);
1532 sys_facl(struct tcb *tcp)
1534 if (entering(tcp)) {
1535 tprintf("%ld, ", tcp->u_arg[0]);
1536 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1537 tprintf(", %ld", tcp->u_arg[2]);
1539 * FIXME - dump out the list of aclent_t's pointed to
1540 * by "tcp->u_arg[3]" if it's not NULL.
1543 tprintf(", %#lx", tcp->u_arg[3]);
1550 static const struct xlat aclipc[] = {
1552 { IPC_SHM, "IPC_SHM" },
1555 { IPC_SEM, "IPC_SEM" },
1558 { IPC_MSG, "IPC_MSG" },
1564 sys_aclipc(struct tcb *tcp)
1566 if (entering(tcp)) {
1567 printxval(aclipc, tcp->u_arg[0], "???IPC???");
1568 tprintf(", %#lx, ", tcp->u_arg[1]);
1569 printxval(aclcmds, tcp->u_arg[2], "???ACL???");
1570 tprintf(", %ld", tcp->u_arg[3]);
1572 * FIXME - dump out the list of aclent_t's pointed to
1573 * by "tcp->u_arg[4]" if it's not NULL.
1576 tprintf(", %#lx", tcp->u_arg[4]);
1583 # endif /* HAVE_SYS_ACL_H */
1585 #endif /* SPARC[64] */
1587 static const struct xlat fsmagic[] = {
1588 { 0x73757245, "CODA_SUPER_MAGIC" },
1589 { 0x012ff7b7, "COH_SUPER_MAGIC" },
1590 { 0x1373, "DEVFS_SUPER_MAGIC" },
1591 { 0x1cd1, "DEVPTS_SUPER_MAGIC" },
1592 { 0x414A53, "EFS_SUPER_MAGIC" },
1593 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
1594 { 0xef53, "EXT2_SUPER_MAGIC" },
1595 { 0x137d, "EXT_SUPER_MAGIC" },
1596 { 0xf995e849, "HPFS_SUPER_MAGIC" },
1597 { 0x9660, "ISOFS_SUPER_MAGIC" },
1598 { 0x137f, "MINIX_SUPER_MAGIC" },
1599 { 0x138f, "MINIX_SUPER_MAGIC2" },
1600 { 0x2468, "MINIX2_SUPER_MAGIC" },
1601 { 0x2478, "MINIX2_SUPER_MAGIC2" },
1602 { 0x4d44, "MSDOS_SUPER_MAGIC" },
1603 { 0x564c, "NCP_SUPER_MAGIC" },
1604 { 0x6969, "NFS_SUPER_MAGIC" },
1605 { 0x9fa0, "PROC_SUPER_MAGIC" },
1606 { 0x002f, "QNX4_SUPER_MAGIC" },
1607 { 0x52654973, "REISERFS_SUPER_MAGIC" },
1608 { 0x02011994, "SHMFS_SUPER_MAGIC" },
1609 { 0x517b, "SMB_SUPER_MAGIC" },
1610 { 0x012ff7b6, "SYSV2_SUPER_MAGIC" },
1611 { 0x012ff7b5, "SYSV4_SUPER_MAGIC" },
1612 { 0x00011954, "UFS_MAGIC" },
1613 { 0x54190100, "UFS_CIGAM" },
1614 { 0x012ff7b4, "XENIX_SUPER_MAGIC" },
1615 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
1616 { 0x62656572, "SYSFS_MAGIC" },
1621 sprintfstype(int magic)
1623 static char buf[32];
1626 s = xlookup(fsmagic, magic);
1628 sprintf(buf, "\"%s\"", s);
1631 sprintf(buf, "%#x", magic);
1636 printstatfs(struct tcb *tcp, long addr)
1638 struct statfs statbuf;
1640 if (syserror(tcp) || !verbose(tcp)) {
1641 tprintf("%#lx", addr);
1644 if (umove(tcp, addr, &statbuf) < 0) {
1650 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
1651 sprintfstype(statbuf.f_type),
1652 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
1653 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_fsid={%d, %d}, f_namelen=%u",
1654 statbuf.f_bavail, statbuf.f_files, statbuf.f_ffree,
1655 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1],
1658 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
1659 sprintfstype(statbuf.f_type),
1660 (unsigned long)statbuf.f_bsize,
1661 (unsigned long)statbuf.f_blocks,
1662 (unsigned long)statbuf.f_bfree);
1663 tprintf("f_bavail=%lu, f_files=%lu, f_ffree=%lu, f_fsid={%d, %d}",
1664 (unsigned long)statbuf.f_bavail,
1665 (unsigned long)statbuf.f_files,
1666 (unsigned long)statbuf.f_ffree,
1667 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1668 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1670 #ifdef _STATFS_F_FRSIZE
1671 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
1677 sys_statfs(struct tcb *tcp)
1679 if (entering(tcp)) {
1680 printpath(tcp, tcp->u_arg[0]);
1683 printstatfs(tcp, tcp->u_arg[1]);
1689 sys_fstatfs(struct tcb *tcp)
1691 if (entering(tcp)) {
1692 printfd(tcp, tcp->u_arg[0]);
1695 printstatfs(tcp, tcp->u_arg[1]);
1700 #if defined HAVE_STATFS64
1702 printstatfs64(struct tcb *tcp, long addr)
1704 struct statfs64 statbuf;
1706 if (syserror(tcp) || !verbose(tcp)) {
1707 tprintf("%#lx", addr);
1710 if (umove(tcp, addr, &statbuf) < 0) {
1714 tprintf("{f_type=%s, f_bsize=%llu, f_blocks=%llu, f_bfree=%llu, ",
1715 sprintfstype(statbuf.f_type),
1716 (unsigned long long)statbuf.f_bsize,
1717 (unsigned long long)statbuf.f_blocks,
1718 (unsigned long long)statbuf.f_bfree);
1719 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
1720 (unsigned long long)statbuf.f_bavail,
1721 (unsigned long long)statbuf.f_files,
1722 (unsigned long long)statbuf.f_ffree,
1723 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1724 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1725 #ifdef _STATFS_F_FRSIZE
1726 tprintf(", f_frsize=%llu", (unsigned long long)statbuf.f_frsize);
1728 #ifdef _STATFS_F_FLAGS
1729 tprintf(", f_flags=%llu", (unsigned long long)statbuf.f_flags);
1734 struct compat_statfs64 {
1746 uint32_t f_spare[4];
1748 #if defined(X86_64) || defined(IA64)
1749 __attribute__ ((packed, aligned(4)))
1754 printcompat_statfs64(struct tcb *tcp, long addr)
1756 struct compat_statfs64 statbuf;
1758 if (syserror(tcp) || !verbose(tcp)) {
1759 tprintf("%#lx", addr);
1762 if (umove(tcp, addr, &statbuf) < 0) {
1766 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%llu, f_bfree=%llu, ",
1767 sprintfstype(statbuf.f_type),
1768 (unsigned long)statbuf.f_bsize,
1769 (unsigned long long)statbuf.f_blocks,
1770 (unsigned long long)statbuf.f_bfree);
1771 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
1772 (unsigned long long)statbuf.f_bavail,
1773 (unsigned long long)statbuf.f_files,
1774 (unsigned long long)statbuf.f_ffree,
1775 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1776 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1777 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
1778 tprintf(", f_flags=%lu}", (unsigned long)statbuf.f_frsize);
1782 sys_statfs64(struct tcb *tcp)
1784 if (entering(tcp)) {
1785 printpath(tcp, tcp->u_arg[0]);
1786 tprintf(", %lu, ", tcp->u_arg[1]);
1788 if (tcp->u_arg[1] == sizeof(struct statfs64))
1789 printstatfs64(tcp, tcp->u_arg[2]);
1790 else if (tcp->u_arg[1] == sizeof(struct compat_statfs64))
1791 printcompat_statfs64(tcp, tcp->u_arg[2]);
1799 sys_fstatfs64(struct tcb *tcp)
1801 if (entering(tcp)) {
1802 printfd(tcp, tcp->u_arg[0]);
1803 tprintf(", %lu, ", tcp->u_arg[1]);
1805 if (tcp->u_arg[1] == sizeof(struct statfs64))
1806 printstatfs64(tcp, tcp->u_arg[2]);
1807 else if (tcp->u_arg[1] == sizeof(struct compat_statfs64))
1808 printcompat_statfs64(tcp, tcp->u_arg[2]);
1818 osf_statfs(struct tcb *tcp)
1820 if (entering(tcp)) {
1821 printpath(tcp, tcp->u_arg[0]);
1824 printstatfs(tcp, tcp->u_arg[1]);
1825 tprintf(", %lu", tcp->u_arg[2]);
1831 osf_fstatfs(struct tcb *tcp)
1833 if (entering(tcp)) {
1834 tprintf("%lu, ", tcp->u_arg[0]);
1836 printstatfs(tcp, tcp->u_arg[1]);
1837 tprintf(", %lu", tcp->u_arg[2]);
1845 sys_chdir(struct tcb *tcp)
1847 if (entering(tcp)) {
1848 printpath(tcp, tcp->u_arg[0]);
1854 decode_mkdir(struct tcb *tcp, int offset)
1856 if (entering(tcp)) {
1857 printpath(tcp, tcp->u_arg[offset]);
1858 tprintf(", %#lo", tcp->u_arg[offset + 1]);
1864 sys_mkdir(struct tcb *tcp)
1866 return decode_mkdir(tcp, 0);
1870 sys_mkdirat(struct tcb *tcp)
1873 print_dirfd(tcp, tcp->u_arg[0]);
1874 return decode_mkdir(tcp, 1);
1878 sys_link(struct tcb *tcp)
1880 if (entering(tcp)) {
1881 printpath(tcp, tcp->u_arg[0]);
1883 printpath(tcp, tcp->u_arg[1]);
1889 sys_linkat(struct tcb *tcp)
1891 if (entering(tcp)) {
1892 print_dirfd(tcp, tcp->u_arg[0]);
1893 printpath(tcp, tcp->u_arg[1]);
1895 print_dirfd(tcp, tcp->u_arg[2]);
1896 printpath(tcp, tcp->u_arg[3]);
1898 printflags(at_flags, tcp->u_arg[4], "AT_???");
1904 sys_unlinkat(struct tcb *tcp)
1906 if (entering(tcp)) {
1907 print_dirfd(tcp, tcp->u_arg[0]);
1908 printpath(tcp, tcp->u_arg[1]);
1910 printflags(at_flags, tcp->u_arg[2], "AT_???");
1916 sys_symlinkat(struct tcb *tcp)
1918 if (entering(tcp)) {
1919 printpath(tcp, tcp->u_arg[0]);
1921 print_dirfd(tcp, tcp->u_arg[1]);
1922 printpath(tcp, tcp->u_arg[2]);
1928 decode_readlink(struct tcb *tcp, int offset)
1930 if (entering(tcp)) {
1931 printpath(tcp, tcp->u_arg[offset]);
1935 tprintf("%#lx", tcp->u_arg[offset + 1]);
1937 /* Used to use printpathn(), but readlink
1938 * neither includes NUL in the returned count,
1939 * nor actually writes it into memory.
1940 * printpathn() would decide on printing
1941 * "..." continuation based on garbage
1942 * past return buffer's end.
1944 printstr(tcp, tcp->u_arg[offset + 1], tcp->u_rval);
1945 tprintf(", %lu", tcp->u_arg[offset + 2]);
1951 sys_readlink(struct tcb *tcp)
1953 return decode_readlink(tcp, 0);
1957 sys_readlinkat(struct tcb *tcp)
1960 print_dirfd(tcp, tcp->u_arg[0]);
1961 return decode_readlink(tcp, 1);
1965 sys_renameat(struct tcb *tcp)
1967 if (entering(tcp)) {
1968 print_dirfd(tcp, tcp->u_arg[0]);
1969 printpath(tcp, tcp->u_arg[1]);
1971 print_dirfd(tcp, tcp->u_arg[2]);
1972 printpath(tcp, tcp->u_arg[3]);
1978 sys_chown(struct tcb *tcp)
1980 if (entering(tcp)) {
1981 printpath(tcp, tcp->u_arg[0]);
1982 printuid(", ", tcp->u_arg[1]);
1983 printuid(", ", tcp->u_arg[2]);
1989 sys_fchownat(struct tcb *tcp)
1991 if (entering(tcp)) {
1992 print_dirfd(tcp, tcp->u_arg[0]);
1993 printpath(tcp, tcp->u_arg[1]);
1994 printuid(", ", tcp->u_arg[2]);
1995 printuid(", ", tcp->u_arg[3]);
1997 printflags(at_flags, tcp->u_arg[4], "AT_???");
2003 sys_fchown(struct tcb *tcp)
2005 if (entering(tcp)) {
2006 printfd(tcp, tcp->u_arg[0]);
2007 printuid(", ", tcp->u_arg[1]);
2008 printuid(", ", tcp->u_arg[2]);
2014 decode_chmod(struct tcb *tcp, int offset)
2016 if (entering(tcp)) {
2017 printpath(tcp, tcp->u_arg[offset]);
2018 tprintf(", %#lo", tcp->u_arg[offset + 1]);
2024 sys_chmod(struct tcb *tcp)
2026 return decode_chmod(tcp, 0);
2030 sys_fchmodat(struct tcb *tcp)
2033 print_dirfd(tcp, tcp->u_arg[0]);
2034 return decode_chmod(tcp, 1);
2038 sys_fchmod(struct tcb *tcp)
2040 if (entering(tcp)) {
2041 printfd(tcp, tcp->u_arg[0]);
2042 tprintf(", %#lo", tcp->u_arg[1]);
2049 sys_osf_utimes(struct tcb *tcp)
2051 if (entering(tcp)) {
2052 printpath(tcp, tcp->u_arg[0]);
2054 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
2061 decode_utimes(struct tcb *tcp, int offset, int special)
2063 if (entering(tcp)) {
2064 printpath(tcp, tcp->u_arg[offset]);
2066 if (tcp->u_arg[offset + 1] == 0)
2070 printtv_bitness(tcp, tcp->u_arg[offset + 1],
2071 BITNESS_CURRENT, special);
2073 printtv_bitness(tcp, tcp->u_arg[offset + 1]
2074 + sizeof(struct timeval),
2075 BITNESS_CURRENT, special);
2083 sys_utimes(struct tcb *tcp)
2085 return decode_utimes(tcp, 0, 0);
2089 sys_futimesat(struct tcb *tcp)
2092 print_dirfd(tcp, tcp->u_arg[0]);
2093 return decode_utimes(tcp, 1, 0);
2097 sys_utimensat(struct tcb *tcp)
2099 if (entering(tcp)) {
2100 print_dirfd(tcp, tcp->u_arg[0]);
2101 decode_utimes(tcp, 1, 1);
2103 printflags(at_flags, tcp->u_arg[3], "AT_???");
2109 sys_utime(struct tcb *tcp)
2114 long paranoia_for_huge_wordsize[4];
2118 if (entering(tcp)) {
2119 printpath(tcp, tcp->u_arg[0]);
2122 wordsize = current_wordsize;
2125 else if (!verbose(tcp))
2126 tprintf("%#lx", tcp->u_arg[1]);
2127 else if (umoven(tcp, tcp->u_arg[1], 2 * wordsize, (char *) &u) < 0)
2129 else if (wordsize == sizeof u.utl[0]) {
2130 tprintf("[%s,", sprinttime(u.utl[0]));
2131 tprintf(" %s]", sprinttime(u.utl[1]));
2133 else if (wordsize == sizeof u.uti[0]) {
2134 tprintf("[%s,", sprinttime(u.uti[0]));
2135 tprintf(" %s]", sprinttime(u.uti[1]));
2138 tprintf("<decode error: unsupported wordsize %d>",
2145 decode_mknod(struct tcb *tcp, int offset)
2147 int mode = tcp->u_arg[offset + 1];
2149 if (entering(tcp)) {
2150 printpath(tcp, tcp->u_arg[offset]);
2151 tprintf(", %s", sprintmode(mode));
2152 switch (mode & S_IFMT) {
2155 #if defined(SPARC) || defined(SPARC64)
2156 if (current_personality == 1)
2157 tprintf(", makedev(%lu, %lu)",
2158 (unsigned long) ((tcp->u_arg[offset + 2] >> 18) & 0x3fff),
2159 (unsigned long) (tcp->u_arg[offset + 2] & 0x3ffff));
2162 tprintf(", makedev(%lu, %lu)",
2163 (unsigned long) major(tcp->u_arg[offset + 2]),
2164 (unsigned long) minor(tcp->u_arg[offset + 2]));
2174 sys_mknod(struct tcb *tcp)
2176 return decode_mknod(tcp, 0);
2180 sys_mknodat(struct tcb *tcp)
2183 print_dirfd(tcp, tcp->u_arg[0]);
2184 return decode_mknod(tcp, 1);
2188 printdir(struct tcb *tcp, long addr)
2192 if (!verbose(tcp)) {
2193 tprintf("%#lx", addr);
2196 if (umove(tcp, addr, &d) < 0) {
2200 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
2202 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
2207 sys_readdir(struct tcb *tcp)
2209 if (entering(tcp)) {
2210 printfd(tcp, tcp->u_arg[0]);
2213 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
2214 tprintf("%#lx", tcp->u_arg[1]);
2216 printdir(tcp, tcp->u_arg[1]);
2217 /* Not much point in printing this out, it is always 1. */
2218 if (tcp->u_arg[2] != 1)
2219 tprintf(", %lu", tcp->u_arg[2]);
2224 static const struct xlat direnttypes[] = {
2225 { DT_UNKNOWN, "DT_UNKNOWN" },
2226 { DT_FIFO, "DT_FIFO" },
2227 { DT_CHR, "DT_CHR" },
2228 { DT_DIR, "DT_DIR" },
2229 { DT_BLK, "DT_BLK" },
2230 { DT_REG, "DT_REG" },
2231 { DT_LNK, "DT_LNK" },
2232 { DT_SOCK, "DT_SOCK" },
2233 { DT_WHT, "DT_WHT" },
2238 sys_getdents(struct tcb *tcp)
2240 int i, len, dents = 0;
2243 if (entering(tcp)) {
2244 printfd(tcp, tcp->u_arg[0]);
2248 if (syserror(tcp) || !verbose(tcp)) {
2249 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2253 /* Beware of insanely large or negative values in tcp->u_rval */
2254 if (tcp->u_rval > 1024*1024)
2256 if (tcp->u_rval < 0)
2258 buf = len ? malloc(len) : NULL;
2260 die_out_of_memory();
2261 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2262 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2268 for (i = 0; i < len;) {
2269 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
2271 tprintf("%s{d_ino=%lu, d_off=%lu, ",
2272 i ? " " : "", d->d_ino, d->d_off);
2273 tprintf("d_reclen=%u, d_name=\"%s\", d_type=",
2274 d->d_reclen, d->d_name);
2275 printxval(direnttypes, buf[i + d->d_reclen - 1], "DT_???");
2279 tprints("/* d_reclen == 0, problem here */");
2288 tprintf("/* %u entries */", dents);
2289 tprintf(", %lu", tcp->u_arg[2]);
2294 #if _LFS64_LARGEFILE
2296 sys_getdents64(struct tcb *tcp)
2298 int i, len, dents = 0;
2301 if (entering(tcp)) {
2302 printfd(tcp, tcp->u_arg[0]);
2306 if (syserror(tcp) || !verbose(tcp)) {
2307 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2312 /* Beware of insanely large or negative tcp->u_rval */
2313 if (tcp->u_rval > 1024*1024)
2315 if (tcp->u_rval < 0)
2317 buf = len ? malloc(len) : NULL;
2319 die_out_of_memory();
2321 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2322 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2328 for (i = 0; i < len;) {
2329 struct dirent64 *d = (struct dirent64 *) &buf[i];
2331 tprintf("%s{d_ino=%" PRIu64 ", d_off=%" PRId64 ", ",
2336 printxval(direnttypes, d->d_type, "DT_???");
2338 tprintf("d_reclen=%u, d_name=\"%s\"}",
2339 d->d_reclen, d->d_name);
2342 tprints("/* d_reclen == 0, problem here */");
2351 tprintf("/* %u entries */", dents);
2352 tprintf(", %lu", tcp->u_arg[2]);
2359 sys_getcwd(struct tcb *tcp)
2363 tprintf("%#lx", tcp->u_arg[0]);
2365 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
2366 tprintf(", %lu", tcp->u_arg[1]);
2371 #ifdef HAVE_SYS_ASYNCH_H
2374 sys_aioread(struct tcb *tcp)
2376 struct aio_result_t res;
2378 if (entering(tcp)) {
2379 tprintf("%lu, ", tcp->u_arg[0]);
2382 tprintf("%#lx", tcp->u_arg[1]);
2384 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2385 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2386 printxval(whence, tcp->u_arg[4], "L_???");
2387 if (syserror(tcp) || tcp->u_arg[5] == 0
2388 || umove(tcp, tcp->u_arg[5], &res) < 0)
2389 tprintf(", %#lx", tcp->u_arg[5]);
2391 tprintf(", {aio_return %d aio_errno %d}",
2392 res.aio_return, res.aio_errno);
2398 sys_aiowrite(struct tcb *tcp)
2400 struct aio_result_t res;
2402 if (entering(tcp)) {
2403 tprintf("%lu, ", tcp->u_arg[0]);
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_???");
2409 if (tcp->u_arg[5] == 0)
2411 else if (syserror(tcp)
2412 || umove(tcp, tcp->u_arg[5], &res) < 0)
2413 tprintf(", %#lx", tcp->u_arg[5]);
2415 tprintf(", {aio_return %d aio_errno %d}",
2416 res.aio_return, res.aio_errno);
2422 sys_aiowait(struct tcb *tcp)
2425 printtv(tcp, tcp->u_arg[0]);
2430 sys_aiocancel(struct tcb *tcp)
2432 struct aio_result_t res;
2435 if (tcp->u_arg[0] == 0)
2437 else if (syserror(tcp)
2438 || umove(tcp, tcp->u_arg[0], &res) < 0)
2439 tprintf("%#lx", tcp->u_arg[0]);
2441 tprintf("{aio_return %d aio_errno %d}",
2442 res.aio_return, res.aio_errno);
2447 #endif /* HAVE_SYS_ASYNCH_H */
2449 static const struct xlat xattrflags[] = {
2451 { XATTR_CREATE, "XATTR_CREATE" },
2452 { XATTR_REPLACE, "XATTR_REPLACE" },
2458 print_xattr_val(struct tcb *tcp, int failed,
2460 unsigned long insize,
2466 unsigned long capacity = 4 * size + 1;
2467 unsigned char *buf = (capacity < size) ? NULL : malloc(capacity);
2468 if (buf == NULL || /* probably a bogus size argument */
2469 umoven(tcp, arg, size, (char *) &buf[3 * size]) < 0) {
2473 unsigned char *out = buf;
2474 unsigned char *in = &buf[3 * size];
2476 for (i = 0; i < size; ++i) {
2480 #define tohex(n) "0123456789abcdef"[n]
2483 *out++ = tohex(in[i] / 16);
2484 *out++ = tohex(in[i] % 16);
2487 /* Don't print terminating NUL if there is one. */
2488 if (i > 0 && in[i - 1] == '\0')
2491 tprintf(", \"%s\", %ld", buf, insize);
2496 tprintf(", 0x%lx, %ld", arg, insize);
2500 sys_setxattr(struct tcb *tcp)
2502 if (entering(tcp)) {
2503 printpath(tcp, tcp->u_arg[0]);
2505 printstr(tcp, tcp->u_arg[1], -1);
2506 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2508 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2514 sys_fsetxattr(struct tcb *tcp)
2516 if (entering(tcp)) {
2517 printfd(tcp, tcp->u_arg[0]);
2519 printstr(tcp, tcp->u_arg[1], -1);
2520 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2522 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2528 sys_getxattr(struct tcb *tcp)
2530 if (entering(tcp)) {
2531 printpath(tcp, tcp->u_arg[0]);
2533 printstr(tcp, tcp->u_arg[1], -1);
2535 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2542 sys_fgetxattr(struct tcb *tcp)
2544 if (entering(tcp)) {
2545 printfd(tcp, tcp->u_arg[0]);
2547 printstr(tcp, tcp->u_arg[1], -1);
2549 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2556 print_xattr_list(struct tcb *tcp, unsigned long addr, unsigned long size)
2558 if (syserror(tcp)) {
2559 tprintf("%#lx", addr);
2565 (size < tcp->u_rval) ? size : tcp->u_rval;
2566 printstr(tcp, addr, len);
2569 tprintf(", %lu", size);
2573 sys_listxattr(struct tcb *tcp)
2575 if (entering(tcp)) {
2576 printpath(tcp, tcp->u_arg[0]);
2579 print_xattr_list(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2585 sys_flistxattr(struct tcb *tcp)
2587 if (entering(tcp)) {
2588 printfd(tcp, tcp->u_arg[0]);
2591 print_xattr_list(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2597 sys_removexattr(struct tcb *tcp)
2599 if (entering(tcp)) {
2600 printpath(tcp, tcp->u_arg[0]);
2602 printstr(tcp, tcp->u_arg[1], -1);
2608 sys_fremovexattr(struct tcb *tcp)
2610 if (entering(tcp)) {
2611 printfd(tcp, tcp->u_arg[0]);
2613 printstr(tcp, tcp->u_arg[1], -1);
2618 static const struct xlat advise[] = {
2619 { POSIX_FADV_NORMAL, "POSIX_FADV_NORMAL" },
2620 { POSIX_FADV_RANDOM, "POSIX_FADV_RANDOM" },
2621 { POSIX_FADV_SEQUENTIAL, "POSIX_FADV_SEQUENTIAL" },
2622 { POSIX_FADV_WILLNEED, "POSIX_FADV_WILLNEED" },
2623 { POSIX_FADV_DONTNEED, "POSIX_FADV_DONTNEED" },
2624 { POSIX_FADV_NOREUSE, "POSIX_FADV_NOREUSE" },
2629 sys_fadvise64(struct tcb *tcp)
2631 if (entering(tcp)) {
2633 printfd(tcp, tcp->u_arg[0]);
2634 argn = printllval(tcp, ", %lld", 1);
2635 tprintf(", %ld, ", tcp->u_arg[argn++]);
2636 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2642 sys_fadvise64_64(struct tcb *tcp)
2644 if (entering(tcp)) {
2646 printfd(tcp, tcp->u_arg[0]);
2647 #if defined ARM || defined POWERPC
2648 argn = printllval(tcp, ", %lld, ", 2);
2650 argn = printllval(tcp, ", %lld, ", 1);
2652 argn = printllval(tcp, "%lld, ", argn);
2653 #if defined ARM || defined POWERPC
2654 printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
2656 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2662 static const struct xlat inotify_modes[] = {
2663 { 0x00000001, "IN_ACCESS" },
2664 { 0x00000002, "IN_MODIFY" },
2665 { 0x00000004, "IN_ATTRIB" },
2666 { 0x00000008, "IN_CLOSE_WRITE"},
2667 { 0x00000010, "IN_CLOSE_NOWRITE"},
2668 { 0x00000020, "IN_OPEN" },
2669 { 0x00000040, "IN_MOVED_FROM" },
2670 { 0x00000080, "IN_MOVED_TO" },
2671 { 0x00000100, "IN_CREATE" },
2672 { 0x00000200, "IN_DELETE" },
2673 { 0x00000400, "IN_DELETE_SELF"},
2674 { 0x00000800, "IN_MOVE_SELF" },
2675 { 0x00002000, "IN_UNMOUNT" },
2676 { 0x00004000, "IN_Q_OVERFLOW" },
2677 { 0x00008000, "IN_IGNORED" },
2678 { 0x01000000, "IN_ONLYDIR" },
2679 { 0x02000000, "IN_DONT_FOLLOW"},
2680 { 0x20000000, "IN_MASK_ADD" },
2681 { 0x40000000, "IN_ISDIR" },
2682 { 0x80000000, "IN_ONESHOT" },
2686 static const struct xlat inotify_init_flags[] = {
2687 { 0x00000800, "IN_NONBLOCK" },
2688 { 0x00080000, "IN_CLOEXEC" },
2693 sys_inotify_add_watch(struct tcb *tcp)
2695 if (entering(tcp)) {
2696 printfd(tcp, tcp->u_arg[0]);
2698 printpath(tcp, tcp->u_arg[1]);
2700 printflags(inotify_modes, tcp->u_arg[2], "IN_???");
2706 sys_inotify_rm_watch(struct tcb *tcp)
2708 if (entering(tcp)) {
2709 printfd(tcp, tcp->u_arg[0]);
2710 tprintf(", %d", (int) tcp->u_arg[1]);
2716 sys_inotify_init1(struct tcb *tcp)
2719 printflags(inotify_init_flags, tcp->u_arg[0], "IN_???");
2724 sys_fallocate(struct tcb *tcp)
2726 if (entering(tcp)) {
2728 printfd(tcp, tcp->u_arg[0]); /* fd */
2729 tprintf(", %#lo, ", tcp->u_arg[1]); /* mode */
2730 argn = printllval(tcp, "%llu, ", 2); /* offset */
2731 printllval(tcp, "%llu", argn); /* len */
2736 #ifndef SWAP_FLAG_PREFER
2737 # define SWAP_FLAG_PREFER 0x8000
2739 #ifndef SWAP_FLAG_DISCARD
2740 # define SWAP_FLAG_DISCARD 0x10000
2742 static const struct xlat swap_flags[] = {
2743 { SWAP_FLAG_PREFER, "SWAP_FLAG_PREFER" },
2744 { SWAP_FLAG_DISCARD, "SWAP_FLAG_DISCARD" },
2749 sys_swapon(struct tcb *tcp)
2751 if (entering(tcp)) {
2752 int flags = tcp->u_arg[1];
2753 printpath(tcp, tcp->u_arg[0]);
2755 printflags(swap_flags, flags & ~SWAP_FLAG_PRIO_MASK,
2757 if (flags & SWAP_FLAG_PREFER)
2758 tprintf("|%d", flags & SWAP_FLAG_PRIO_MASK);
2769 realprintstat64(struct tcb *tcp, long addr)
2771 struct stat64 statbuf;
2777 if (syserror(tcp) || !verbose(tcp)) {
2778 tprintf("%#lx", addr);
2782 if (umove(tcp, addr, &statbuf) < 0) {
2788 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
2789 (unsigned long) major(statbuf.st_dev),
2790 (unsigned long) minor(statbuf.st_dev),
2791 (unsigned long long) statbuf.st_ino,
2792 sprintmode(statbuf.st_mode));
2793 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
2794 (unsigned long) statbuf.st_nlink,
2795 (unsigned long) statbuf.st_uid,
2796 (unsigned long) statbuf.st_gid);
2797 tprintf("st_blksize=%lu, ",
2798 (unsigned long) statbuf.st_blksize);
2799 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
2802 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
2803 switch (statbuf.st_mode & S_IFMT) {
2804 case S_IFCHR: case S_IFBLK:
2805 tprintf("st_rdev=makedev(%lu, %lu), ",
2806 (unsigned long) major(statbuf.st_rdev),
2807 (unsigned long) minor(statbuf.st_rdev));
2810 tprintf("st_size=%llu, ", (unsigned long long) statbuf.st_size);
2814 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
2815 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
2816 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
2824 sys_fstat64(struct tcb *tcp)
2826 if (entering(tcp)) {
2827 printfd(tcp, tcp->u_arg[0]);
2830 realprintstat64(tcp, tcp->u_arg[1]);
2836 sys_stat64(struct tcb *tcp)
2838 if (entering(tcp)) {
2839 printpath(tcp, tcp->u_arg[0]);
2842 realprintstat64(tcp, tcp->u_arg[1]);