2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
5 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 struct kernel_dirent {
41 unsigned short d_reclen;
45 # define kernel_dirent dirent
51 unsigned short st_dev;
53 unsigned short st_mode;
55 unsigned short st_uid;
56 unsigned short st_gid;
57 unsigned short st_rdev;
60 unsigned int __unused1;
62 unsigned int __unused2;
64 unsigned int __unused3;
67 unsigned int __unused4[2];
74 unsigned int st_nlink;
84 unsigned long __unused4[2];
87 # define stat kernel_stat
88 # include <asm/stat.h>
100 # define dev_t __kernel_dev_t
101 # define ino_t __kernel_ino_t
102 # define mode_t __kernel_mode_t
103 # define nlink_t __kernel_nlink_t
104 # define uid_t __kernel_uid_t
105 # define gid_t __kernel_gid_t
106 # define off_t __kernel_off_t
107 # define loff_t __kernel_loff_t
109 # include <asm/stat.h>
122 # define mode_t mode_t
123 # define nlink_t nlink_t
127 # define loff_t loff_t
129 # ifdef HPPA /* asm-parisc/stat.h defines stat64 */
132 # define stat libc_stat
133 # define stat64 libc_stat64
134 # include <sys/stat.h>
137 /* These might be macros. */
142 # define stat64 hpux_stat64
145 # include <sys/stat.h>
151 # include <sys/cred.h>
154 #ifdef HAVE_SYS_VFS_H
158 #ifdef HAVE_LINUX_XATTR_H
159 #include <linux/xattr.h>
161 #define XATTR_CREATE 1
162 #define XATTR_REPLACE 2
166 #include <sys/param.h>
167 #include <sys/mount.h>
168 #include <sys/stat.h>
171 #if _LFS64_LARGEFILE && (defined(LINUX) || defined(SVR4))
172 # ifdef HAVE_INTTYPES_H
173 # include <inttypes.h>
175 # define PRId64 "lld"
176 # define PRIu64 "llu"
180 #if HAVE_LONG_LONG_OFF_T
182 * Ugly hacks for systems that have typedef long long off_t
186 #define HAVE_STAT64 1 /* Ugly hack */
188 #define sys_stat64 sys_stat
189 #define sys_fstat64 sys_fstat
190 #define sys_lstat64 sys_lstat
191 #define sys_lseek64 sys_lseek
192 #define sys_truncate64 sys_truncate
193 #define sys_ftruncate64 sys_ftruncate
196 #ifdef MAJOR_IN_SYSMACROS
197 #include <sys/sysmacros.h>
200 #ifdef MAJOR_IN_MKDEV
201 #include <sys/mkdev.h>
204 #ifdef HAVE_SYS_ASYNCH_H
205 #include <sys/asynch.h>
212 const struct xlat open_access_modes[] = {
213 { O_RDONLY, "O_RDONLY" },
214 { O_WRONLY, "O_WRONLY" },
215 { O_RDWR, "O_RDWR" },
217 { O_ACCMODE, "O_ACCMODE" },
222 const struct xlat open_mode_flags[] = {
223 { O_CREAT, "O_CREAT" },
224 { O_EXCL, "O_EXCL" },
225 { O_NOCTTY, "O_NOCTTY" },
226 { O_TRUNC, "O_TRUNC" },
227 { O_APPEND, "O_APPEND" },
228 { O_NONBLOCK, "O_NONBLOCK" },
230 { O_SYNC, "O_SYNC" },
233 { O_ASYNC, "O_ASYNC" },
236 { O_DSYNC, "O_DSYNC" },
239 { O_RSYNC, "O_RSYNC" },
241 #if defined(O_NDELAY) && (O_NDELAY != O_NONBLOCK)
242 { O_NDELAY, "O_NDELAY" },
245 { O_PRIV, "O_PRIV" },
248 { O_DIRECT, "O_DIRECT" },
251 # if O_LARGEFILE == 0 /* biarch platforms in 64-bit mode */
254 # define O_LARGEFILE 0x40000
255 # elif defined X86_64 || defined S390X
256 # define O_LARGEFILE 0100000
260 { O_LARGEFILE, "O_LARGEFILE" },
264 { O_DIRECTORY, "O_DIRECTORY" },
267 { O_NOFOLLOW, "O_NOFOLLOW" },
270 { O_NOATIME, "O_NOATIME" },
273 { O_CLOEXEC, "O_CLOEXEC" },
276 { FNDELAY, "FNDELAY" },
279 { FAPPEND, "FAPPEND" },
285 { FDEFER, "FDEFER" },
288 { FASYNC, "FASYNC" },
291 { FSHLOCK, "FSHLOCK" },
294 { FEXLOCK, "FEXLOCK" },
297 { FCREAT, "FCREAT" },
300 { FTRUNC, "FTRUNC" },
312 { FNOCTTY, "FNOCTTY" },
315 { O_SHLOCK, "O_SHLOCK" },
318 { O_EXLOCK, "O_EXLOCK" },
326 # define AT_FDCWD -100
329 /* The fd is an "int", so when decoding x86 on x86_64, we need to force sign
330 * extension to get the right value. We do this by declaring fd as int here.
333 print_dirfd(struct tcb *tcp, int fd)
336 tprints("AT_FDCWD, ");
345 * low bits of the open(2) flags define access mode,
346 * other bits are real flags.
349 sprint_open_modes(mode_t flags)
351 static char outstr[(1 + ARRAY_SIZE(open_mode_flags)) * sizeof("O_LARGEFILE")];
355 const struct xlat *x;
358 p = stpcpy(outstr, "flags");
359 str = xlookup(open_access_modes, flags & 3);
369 for (x = open_mode_flags; x->str; x++) {
370 if ((flags & x->val) == x->val) {
372 p = stpcpy(p, x->str);
379 /* flags is still nonzero */
381 sprintf(p, "%#x", flags);
386 tprint_open_modes(mode_t flags)
388 tprints(sprint_open_modes(flags) + sizeof("flags"));
392 decode_open(struct tcb *tcp, int offset)
395 printpath(tcp, tcp->u_arg[offset]);
398 tprint_open_modes(tcp->u_arg[offset + 1]);
399 if (tcp->u_arg[offset + 1] & O_CREAT) {
401 tprintf(", %#lo", tcp->u_arg[offset + 2]);
408 sys_open(struct tcb *tcp)
410 return decode_open(tcp, 0);
415 sys_openat(struct tcb *tcp)
418 print_dirfd(tcp, tcp->u_arg[0]);
419 return decode_open(tcp, 1);
424 static const struct xlat openmodessol[] = {
428 { 0x80, "O_NONBLOCK" },
430 { 0x100, "O_CREAT" },
431 { 0x200, "O_TRUNC" },
433 { 0x800, "O_NOCTTY" },
436 { 0x8000, "O_RSYNC" },
438 { 0x1000, "O_PRIV" },
443 solaris_open(struct tcb *tcp)
446 printpath(tcp, tcp->u_arg[0]);
449 printflags(openmodessol, tcp->u_arg[1] + 1, "O_???");
450 if (tcp->u_arg[1] & 0x100) {
452 tprintf(", %#lo", tcp->u_arg[2]);
461 sys_creat(struct tcb *tcp)
464 printpath(tcp, tcp->u_arg[0]);
465 tprintf(", %#lo", tcp->u_arg[1]);
470 static const struct xlat access_flags[] = {
476 { EFF_ONLY_OK, "EFF_ONLY_OK" },
485 decode_access(struct tcb *tcp, int offset)
488 printpath(tcp, tcp->u_arg[offset]);
490 printflags(access_flags, tcp->u_arg[offset + 1], "?_OK");
496 sys_access(struct tcb *tcp)
498 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);
512 sys_umask(struct tcb *tcp)
515 tprintf("%#lo", tcp->u_arg[0]);
520 static const struct xlat whence[] = {
521 { SEEK_SET, "SEEK_SET" },
522 { SEEK_CUR, "SEEK_CUR" },
523 { SEEK_END, "SEEK_END" },
527 #ifndef HAVE_LONG_LONG_OFF_T
528 #if defined (LINUX_MIPSN32)
530 sys_lseek(struct tcb *tcp)
536 printfd(tcp, tcp->u_arg[0]);
538 offset = tcp->ext_arg[1];
539 _whence = tcp->u_arg[2];
540 if (_whence == SEEK_SET)
541 tprintf("%llu, ", offset);
543 tprintf("%lld, ", offset);
544 printxval(whence, _whence, "SEEK_???");
546 return RVAL_UDECIMAL;
548 #else /* !LINUX_MIPSN32 */
550 sys_lseek(struct tcb *tcp)
556 printfd(tcp, tcp->u_arg[0]);
558 offset = tcp->u_arg[1];
559 _whence = tcp->u_arg[2];
560 if (_whence == SEEK_SET)
561 tprintf("%lu, ", offset);
563 tprintf("%ld, ", offset);
564 printxval(whence, _whence, "SEEK_???");
566 return RVAL_UDECIMAL;
568 #endif /* LINUX_MIPSN32 */
573 sys_llseek(struct tcb *tcp)
576 printfd(tcp, tcp->u_arg[0]);
578 * This one call takes explicitly two 32-bit arguments hi, lo,
579 * rather than one 64-bit argument for which LONG_LONG works
580 * appropriate for the native byte order.
582 if (tcp->u_arg[4] == SEEK_SET)
584 ((long long int) tcp->u_arg[1]) << 32 |
585 (unsigned long long) (unsigned) tcp->u_arg[2]);
588 ((long long int) tcp->u_arg[1]) << 32 |
589 (unsigned long long) (unsigned) tcp->u_arg[2]);
593 if (syserror(tcp) || umove(tcp, tcp->u_arg[3], &off) < 0)
594 tprintf("%#lx, ", tcp->u_arg[3]);
596 tprintf("[%llu], ", off);
597 printxval(whence, tcp->u_arg[4], "SEEK_???");
603 sys_readahead(struct tcb *tcp)
607 printfd(tcp, tcp->u_arg[0]);
609 argn = printllval(tcp, "%lld", 1);
610 tprintf(", %ld", tcp->u_arg[argn]);
616 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
618 sys_lseek64(struct tcb *tcp)
622 printfd(tcp, tcp->u_arg[0]);
624 if (tcp->u_arg[3] == SEEK_SET)
625 argn = printllval(tcp, "%llu, ", 1);
627 argn = printllval(tcp, "%lld, ", 1);
628 printxval(whence, tcp->u_arg[argn], "SEEK_???");
630 return RVAL_LUDECIMAL;
634 #ifndef HAVE_LONG_LONG_OFF_T
636 sys_truncate(struct tcb *tcp)
639 printpath(tcp, tcp->u_arg[0]);
640 tprintf(", %lu", tcp->u_arg[1]);
646 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
648 sys_truncate64(struct tcb *tcp)
651 printpath(tcp, tcp->u_arg[0]);
652 printllval(tcp, ", %llu", 1);
658 #ifndef HAVE_LONG_LONG_OFF_T
660 sys_ftruncate(struct tcb *tcp)
663 printfd(tcp, tcp->u_arg[0]);
664 tprintf(", %lu", tcp->u_arg[1]);
670 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
672 sys_ftruncate64(struct tcb *tcp)
675 printfd(tcp, tcp->u_arg[0]);
677 printllval(tcp, "%llu", 1);
685 static const struct xlat modetypes[] = {
686 { S_IFREG, "S_IFREG" },
687 { S_IFSOCK, "S_IFSOCK" },
688 { S_IFIFO, "S_IFIFO" },
689 { S_IFLNK, "S_IFLNK" },
690 { S_IFDIR, "S_IFDIR" },
691 { S_IFBLK, "S_IFBLK" },
692 { S_IFCHR, "S_IFCHR" },
702 if ((mode & S_IFMT) == 0)
704 else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) {
705 sprintf(buf, "%#o", mode);
708 sprintf(buf, "%s%s%s%s", s,
709 (mode & S_ISUID) ? "|S_ISUID" : "",
710 (mode & S_ISGID) ? "|S_ISGID" : "",
711 (mode & S_ISVTX) ? "|S_ISVTX" : "");
712 mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX);
714 sprintf(buf + strlen(buf), "|%#o", mode);
715 s = (*buf == '|') ? buf + 1 : buf;
731 snprintf(buf, sizeof buf, "%02d/%02d/%02d-%02d:%02d:%02d",
732 tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
733 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
735 snprintf(buf, sizeof buf, "%lu", (unsigned long) t);
748 int st_pad1[3]; /* network id */
757 int st_pad3; /* st_size, off_t expansion */
758 timestruct_t st_atime;
759 timestruct_t st_mtime;
760 timestruct_t st_ctime;
764 int st_pad4[8]; /* expansion area */
768 printstatsol(struct tcb *tcp, long addr)
770 struct solstat statbuf;
772 if (umove(tcp, addr, &statbuf) < 0) {
777 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
778 (unsigned long) ((statbuf.st_dev >> 18) & 0x3fff),
779 (unsigned long) (statbuf.st_dev & 0x3ffff),
780 (unsigned long) statbuf.st_ino,
781 sprintmode(statbuf.st_mode));
782 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
783 (unsigned long) statbuf.st_nlink,
784 (unsigned long) statbuf.st_uid,
785 (unsigned long) statbuf.st_gid);
786 tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);
787 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
790 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
791 switch (statbuf.st_mode & S_IFMT) {
792 case S_IFCHR: case S_IFBLK:
793 tprintf("st_rdev=makedev(%lu, %lu), ",
794 (unsigned long) ((statbuf.st_rdev >> 18) & 0x3fff),
795 (unsigned long) (statbuf.st_rdev & 0x3ffff));
798 tprintf("st_size=%u, ", statbuf.st_size);
802 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime.tv_sec));
803 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime.tv_sec));
804 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime.tv_sec));
810 #if defined (SPARC64)
812 printstat_sparc64(struct tcb *tcp, long addr)
814 struct stat_sparc64 statbuf;
816 if (umove(tcp, addr, &statbuf) < 0) {
822 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
823 (unsigned long) major(statbuf.st_dev),
824 (unsigned long) minor(statbuf.st_dev),
825 (unsigned long) statbuf.st_ino,
826 sprintmode(statbuf.st_mode));
827 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
828 (unsigned long) statbuf.st_nlink,
829 (unsigned long) statbuf.st_uid,
830 (unsigned long) statbuf.st_gid);
831 tprintf("st_blksize=%lu, ",
832 (unsigned long) statbuf.st_blksize);
833 tprintf("st_blocks=%lu, ",
834 (unsigned long) statbuf.st_blocks);
837 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
838 switch (statbuf.st_mode & S_IFMT) {
839 case S_IFCHR: case S_IFBLK:
840 tprintf("st_rdev=makedev(%lu, %lu), ",
841 (unsigned long) major(statbuf.st_rdev),
842 (unsigned long) minor(statbuf.st_rdev));
845 tprintf("st_size=%lu, ", statbuf.st_size);
849 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
850 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
851 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
858 #endif /* LINUXSPARC */
860 #if defined LINUX && defined POWERPC64
861 struct stat_powerpc32 {
864 unsigned int st_mode;
865 unsigned short st_nlink;
868 unsigned int st_rdev;
869 unsigned int st_size;
870 unsigned int st_blksize;
871 unsigned int st_blocks;
872 unsigned int st_atime;
873 unsigned int st_atime_nsec;
874 unsigned int st_mtime;
875 unsigned int st_mtime_nsec;
876 unsigned int st_ctime;
877 unsigned int st_ctime_nsec;
878 unsigned int __unused4;
879 unsigned int __unused5;
883 printstat_powerpc32(struct tcb *tcp, long addr)
885 struct stat_powerpc32 statbuf;
887 if (umove(tcp, addr, &statbuf) < 0) {
893 tprintf("{st_dev=makedev(%u, %u), st_ino=%u, st_mode=%s, ",
894 major(statbuf.st_dev), minor(statbuf.st_dev),
896 sprintmode(statbuf.st_mode));
897 tprintf("st_nlink=%u, st_uid=%u, st_gid=%u, ",
898 statbuf.st_nlink, statbuf.st_uid, statbuf.st_gid);
899 tprintf("st_blksize=%u, ", statbuf.st_blksize);
900 tprintf("st_blocks=%u, ", statbuf.st_blocks);
903 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
904 switch (statbuf.st_mode & S_IFMT) {
905 case S_IFCHR: case S_IFBLK:
906 tprintf("st_rdev=makedev(%lu, %lu), ",
907 (unsigned long) major(statbuf.st_rdev),
908 (unsigned long) minor(statbuf.st_rdev));
911 tprintf("st_size=%u, ", statbuf.st_size);
915 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
916 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
917 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
923 #endif /* LINUX && POWERPC64 */
925 static const struct xlat fileflags[] = {
927 { UF_NODUMP, "UF_NODUMP" },
928 { UF_IMMUTABLE, "UF_IMMUTABLE" },
929 { UF_APPEND, "UF_APPEND" },
930 { UF_OPAQUE, "UF_OPAQUE" },
931 { UF_NOUNLINK, "UF_NOUNLINK" },
932 { SF_ARCHIVED, "SF_ARCHIVED" },
933 { SF_IMMUTABLE, "SF_IMMUTABLE" },
934 { SF_APPEND, "SF_APPEND" },
935 { SF_NOUNLINK, "SF_NOUNLINK" },
938 { _S_ISMLD, "_S_ISMLD" },
941 { _S_ISMOUNTED, "_S_ISMOUNTED" },
949 sys_chflags(struct tcb *tcp)
952 printpath(tcp, tcp->u_arg[0]);
954 printflags(fileflags, tcp->u_arg[1], "UF_???");
960 sys_fchflags(struct tcb *tcp)
963 tprintf("%ld, ", tcp->u_arg[0]);
964 printflags(fileflags, tcp->u_arg[1], "UF_???");
970 #ifndef HAVE_LONG_LONG_OFF_T
972 realprintstat(struct tcb *tcp, struct stat *statbuf)
975 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
976 (unsigned long) major(statbuf->st_dev),
977 (unsigned long) minor(statbuf->st_dev),
978 (unsigned long) statbuf->st_ino,
979 sprintmode(statbuf->st_mode));
980 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
981 (unsigned long) statbuf->st_nlink,
982 (unsigned long) statbuf->st_uid,
983 (unsigned long) statbuf->st_gid);
984 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
985 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
987 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
988 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
992 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
993 switch (statbuf->st_mode & S_IFMT) {
994 case S_IFCHR: case S_IFBLK:
995 #ifdef HAVE_STRUCT_STAT_ST_RDEV
996 tprintf("st_rdev=makedev(%lu, %lu), ",
997 (unsigned long) major(statbuf->st_rdev),
998 (unsigned long) minor(statbuf->st_rdev));
999 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
1000 tprintf("st_size=makedev(%lu, %lu), ",
1001 (unsigned long) major(statbuf->st_size),
1002 (unsigned long) minor(statbuf->st_size));
1003 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
1006 tprintf("st_size=%lu, ", (unsigned long) statbuf->st_size);
1010 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
1011 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
1012 tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));
1013 #if HAVE_STRUCT_STAT_ST_FLAGS
1014 tprints(", st_flags=");
1015 printflags(fileflags, statbuf->st_flags, "UF_???");
1017 #if HAVE_STRUCT_STAT_ST_ACLCNT
1018 tprintf(", st_aclcnt=%d", statbuf->st_aclcnt);
1020 #if HAVE_STRUCT_STAT_ST_LEVEL
1021 tprintf(", st_level=%ld", statbuf->st_level);
1023 #if HAVE_STRUCT_STAT_ST_FSTYPE
1024 tprintf(", st_fstype=%.*s",
1025 (int) sizeof statbuf->st_fstype, statbuf->st_fstype);
1027 #if HAVE_STRUCT_STAT_ST_GEN
1028 tprintf(", st_gen=%u", statbuf->st_gen);
1038 printstat(struct tcb *tcp, long addr)
1040 struct stat statbuf;
1046 if (syserror(tcp) || !verbose(tcp)) {
1047 tprintf("%#lx", addr);
1052 if (current_personality == 1) {
1053 printstatsol(tcp, addr);
1057 else if (current_personality == 2) {
1058 printstat_sparc64(tcp, addr);
1062 #endif /* LINUXSPARC */
1064 #if defined LINUX && defined POWERPC64
1065 if (current_personality == 1) {
1066 printstat_powerpc32(tcp, addr);
1071 if (umove(tcp, addr, &statbuf) < 0) {
1076 realprintstat(tcp, &statbuf);
1078 #endif /* !HAVE_LONG_LONG_OFF_T */
1080 #if !defined HAVE_STAT64 && defined LINUX && defined X86_64
1082 * Linux x86_64 has unified `struct stat' but its i386 biarch needs
1083 * `struct stat64'. Its <asm-i386/stat.h> definition expects 32-bit `long'.
1084 * <linux/include/asm-x86_64/ia32.h> is not in the public includes set.
1085 * __GNUC__ is needed for the required __attribute__ below.
1088 unsigned long long st_dev;
1089 unsigned char __pad0[4];
1090 unsigned int __st_ino;
1091 unsigned int st_mode;
1092 unsigned int st_nlink;
1093 unsigned int st_uid;
1094 unsigned int st_gid;
1095 unsigned long long st_rdev;
1096 unsigned char __pad3[4];
1098 unsigned int st_blksize;
1099 unsigned long long st_blocks;
1100 unsigned int st_atime;
1101 unsigned int st_atime_nsec;
1102 unsigned int st_mtime;
1103 unsigned int st_mtime_nsec;
1104 unsigned int st_ctime;
1105 unsigned int st_ctime_nsec;
1106 unsigned long long st_ino;
1107 } __attribute__((packed));
1108 # define HAVE_STAT64 1
1109 # define STAT64_SIZE 96
1114 printstat64(struct tcb *tcp, long addr)
1116 struct stat64 statbuf;
1119 (void) sizeof(char[sizeof statbuf == STAT64_SIZE ? 1 : -1]);
1126 if (syserror(tcp) || !verbose(tcp)) {
1127 tprintf("%#lx", addr);
1132 if (current_personality == 1) {
1133 printstatsol(tcp, addr);
1137 else if (current_personality == 2) {
1138 printstat_sparc64(tcp, addr);
1142 #endif /* LINUXSPARC */
1144 #if defined LINUX && defined X86_64
1145 if (current_personality == 0) {
1146 printstat(tcp, addr);
1151 if (umove(tcp, addr, &statbuf) < 0) {
1157 #ifdef HAVE_LONG_LONG
1158 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
1160 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
1162 (unsigned long) major(statbuf.st_dev),
1163 (unsigned long) minor(statbuf.st_dev),
1164 #ifdef HAVE_LONG_LONG
1165 (unsigned long long) statbuf.st_ino,
1167 (unsigned long) statbuf.st_ino,
1169 sprintmode(statbuf.st_mode));
1170 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
1171 (unsigned long) statbuf.st_nlink,
1172 (unsigned long) statbuf.st_uid,
1173 (unsigned long) statbuf.st_gid);
1174 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
1175 tprintf("st_blksize=%lu, ",
1176 (unsigned long) statbuf.st_blksize);
1177 #endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */
1178 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
1179 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
1180 #endif /* HAVE_STRUCT_STAT_ST_BLOCKS */
1183 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
1184 switch (statbuf.st_mode & S_IFMT) {
1185 case S_IFCHR: case S_IFBLK:
1186 #ifdef HAVE_STRUCT_STAT_ST_RDEV
1187 tprintf("st_rdev=makedev(%lu, %lu), ",
1188 (unsigned long) major(statbuf.st_rdev),
1189 (unsigned long) minor(statbuf.st_rdev));
1190 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
1191 tprintf("st_size=makedev(%lu, %lu), ",
1192 (unsigned long) major(statbuf.st_size),
1193 (unsigned long) minor(statbuf.st_size));
1194 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
1197 #ifdef HAVE_LONG_LONG
1198 tprintf("st_size=%llu, ", (unsigned long long) statbuf.st_size);
1200 tprintf("st_size=%lu, ", (unsigned long) statbuf.st_size);
1205 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
1206 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
1207 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
1208 #if HAVE_STRUCT_STAT_ST_FLAGS
1209 tprints(", st_flags=");
1210 printflags(fileflags, statbuf.st_flags, "UF_???");
1212 #if HAVE_STRUCT_STAT_ST_ACLCNT
1213 tprintf(", st_aclcnt=%d", statbuf.st_aclcnt);
1215 #if HAVE_STRUCT_STAT_ST_LEVEL
1216 tprintf(", st_level=%ld", statbuf.st_level);
1218 #if HAVE_STRUCT_STAT_ST_FSTYPE
1219 tprintf(", st_fstype=%.*s",
1220 (int) sizeof statbuf.st_fstype, statbuf.st_fstype);
1222 #if HAVE_STRUCT_STAT_ST_GEN
1223 tprintf(", st_gen=%u", statbuf.st_gen);
1230 #endif /* HAVE_STAT64 */
1232 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1234 convertoldstat(const struct __old_kernel_stat *oldbuf, struct stat *newbuf)
1236 newbuf->st_dev = oldbuf->st_dev;
1237 newbuf->st_ino = oldbuf->st_ino;
1238 newbuf->st_mode = oldbuf->st_mode;
1239 newbuf->st_nlink = oldbuf->st_nlink;
1240 newbuf->st_uid = oldbuf->st_uid;
1241 newbuf->st_gid = oldbuf->st_gid;
1242 newbuf->st_rdev = oldbuf->st_rdev;
1243 newbuf->st_size = oldbuf->st_size;
1244 newbuf->st_atime = oldbuf->st_atime;
1245 newbuf->st_mtime = oldbuf->st_mtime;
1246 newbuf->st_ctime = oldbuf->st_ctime;
1247 newbuf->st_blksize = 0; /* not supported in old_stat */
1248 newbuf->st_blocks = 0; /* not supported in old_stat */
1253 printoldstat(struct tcb *tcp, long addr)
1255 struct __old_kernel_stat statbuf;
1256 struct stat newstatbuf;
1262 if (syserror(tcp) || !verbose(tcp)) {
1263 tprintf("%#lx", addr);
1268 if (current_personality == 1) {
1269 printstatsol(tcp, addr);
1272 #endif /* LINUXSPARC */
1274 if (umove(tcp, addr, &statbuf) < 0) {
1279 convertoldstat(&statbuf, &newstatbuf);
1280 realprintstat(tcp, &newstatbuf);
1282 #endif /* LINUX && !IA64 && !HPPA && !X86_64 && !S390 && !S390X */
1284 #ifndef HAVE_LONG_LONG_OFF_T
1286 sys_stat(struct tcb *tcp)
1288 if (entering(tcp)) {
1289 printpath(tcp, tcp->u_arg[0]);
1292 printstat(tcp, tcp->u_arg[1]);
1299 sys_stat64(struct tcb *tcp)
1302 if (entering(tcp)) {
1303 printpath(tcp, tcp->u_arg[0]);
1306 printstat64(tcp, tcp->u_arg[1]);
1310 return printargs(tcp);
1315 static const struct xlat fstatatflags[] = {
1316 #ifndef AT_SYMLINK_NOFOLLOW
1317 # define AT_SYMLINK_NOFOLLOW 0x100
1319 { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" },
1322 #define utimensatflags fstatatflags
1325 sys_newfstatat(struct tcb *tcp)
1327 if (entering(tcp)) {
1328 print_dirfd(tcp, tcp->u_arg[0]);
1329 printpath(tcp, tcp->u_arg[1]);
1333 if (current_personality == 0)
1334 printstat(tcp, tcp->u_arg[2]);
1336 printstat64(tcp, tcp->u_arg[2]);
1337 #elif defined HAVE_STAT64
1338 printstat64(tcp, tcp->u_arg[2]);
1340 printstat(tcp, tcp->u_arg[2]);
1343 printflags(fstatatflags, tcp->u_arg[3], "AT_???");
1349 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1351 sys_oldstat(struct tcb *tcp)
1353 if (entering(tcp)) {
1354 printpath(tcp, tcp->u_arg[0]);
1357 printoldstat(tcp, tcp->u_arg[1]);
1361 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1363 #ifndef HAVE_LONG_LONG_OFF_T
1365 sys_fstat(struct tcb *tcp)
1367 if (entering(tcp)) {
1368 printfd(tcp, tcp->u_arg[0]);
1371 printstat(tcp, tcp->u_arg[1]);
1378 sys_fstat64(struct tcb *tcp)
1381 if (entering(tcp)) {
1382 printfd(tcp, tcp->u_arg[0]);
1385 printstat64(tcp, tcp->u_arg[1]);
1389 return printargs(tcp);
1393 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1395 sys_oldfstat(struct tcb *tcp)
1397 if (entering(tcp)) {
1398 printfd(tcp, tcp->u_arg[0]);
1401 printoldstat(tcp, tcp->u_arg[1]);
1405 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1407 #ifndef HAVE_LONG_LONG_OFF_T
1409 sys_lstat(struct tcb *tcp)
1411 if (entering(tcp)) {
1412 printpath(tcp, tcp->u_arg[0]);
1415 printstat(tcp, tcp->u_arg[1]);
1422 sys_lstat64(struct tcb *tcp)
1425 if (entering(tcp)) {
1426 printpath(tcp, tcp->u_arg[0]);
1429 printstat64(tcp, tcp->u_arg[1]);
1433 return printargs(tcp);
1437 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1439 sys_oldlstat(struct tcb *tcp)
1441 if (entering(tcp)) {
1442 printpath(tcp, tcp->u_arg[0]);
1445 printoldstat(tcp, tcp->u_arg[1]);
1449 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1452 #if defined(SVR4) || defined(LINUXSPARC)
1455 sys_xstat(struct tcb *tcp)
1457 if (entering(tcp)) {
1458 tprintf("%ld, ", tcp->u_arg[0]);
1459 printpath(tcp, tcp->u_arg[1]);
1463 if (tcp->u_arg[0] == _STAT64_VER)
1464 printstat64 (tcp, tcp->u_arg[2]);
1467 printstat(tcp, tcp->u_arg[2]);
1473 sys_fxstat(struct tcb *tcp)
1476 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
1479 if (tcp->u_arg[0] == _STAT64_VER)
1480 printstat64 (tcp, tcp->u_arg[2]);
1483 printstat(tcp, tcp->u_arg[2]);
1489 sys_lxstat(struct tcb *tcp)
1491 if (entering(tcp)) {
1492 tprintf("%ld, ", tcp->u_arg[0]);
1493 printpath(tcp, tcp->u_arg[1]);
1497 if (tcp->u_arg[0] == _STAT64_VER)
1498 printstat64 (tcp, tcp->u_arg[2]);
1501 printstat(tcp, tcp->u_arg[2]);
1507 sys_xmknod(struct tcb *tcp)
1509 int mode = tcp->u_arg[2];
1511 if (entering(tcp)) {
1512 tprintf("%ld, ", tcp->u_arg[0]);
1513 printpath(tcp, tcp->u_arg[1]);
1514 tprintf(", %s", sprintmode(mode));
1515 switch (mode & S_IFMT) {
1516 case S_IFCHR: case S_IFBLK:
1518 tprintf(", makedev(%lu, %lu)",
1519 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
1520 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
1522 tprintf(", makedev(%lu, %lu)",
1523 (unsigned long) major(tcp->u_arg[3]),
1524 (unsigned long) minor(tcp->u_arg[3]));
1534 #ifdef HAVE_SYS_ACL_H
1536 #include <sys/acl.h>
1538 static const struct xlat aclcmds[] = {
1540 { SETACL, "SETACL" },
1543 { GETACL, "GETACL" },
1546 { GETACLCNT, "GETACLCNT" },
1549 { ACL_GET, "ACL_GET" },
1552 { ACL_SET, "ACL_SET" },
1555 { ACL_CNT, "ACL_CNT" },
1561 sys_acl(struct tcb *tcp)
1563 if (entering(tcp)) {
1564 printpath(tcp, tcp->u_arg[0]);
1566 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1567 tprintf(", %ld", tcp->u_arg[2]);
1569 * FIXME - dump out the list of aclent_t's pointed to
1570 * by "tcp->u_arg[3]" if it's not NULL.
1573 tprintf(", %#lx", tcp->u_arg[3]);
1582 sys_facl(struct tcb *tcp)
1584 if (entering(tcp)) {
1585 tprintf("%ld, ", tcp->u_arg[0]);
1586 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1587 tprintf(", %ld", tcp->u_arg[2]);
1589 * FIXME - dump out the list of aclent_t's pointed to
1590 * by "tcp->u_arg[3]" if it's not NULL.
1593 tprintf(", %#lx", tcp->u_arg[3]);
1601 static const struct xlat aclipc[] = {
1603 { IPC_SHM, "IPC_SHM" },
1606 { IPC_SEM, "IPC_SEM" },
1609 { IPC_MSG, "IPC_MSG" },
1616 sys_aclipc(struct tcb *tcp)
1618 if (entering(tcp)) {
1619 printxval(aclipc, tcp->u_arg[0], "???IPC???");
1620 tprintf(", %#lx, ", tcp->u_arg[1]);
1621 printxval(aclcmds, tcp->u_arg[2], "???ACL???");
1622 tprintf(", %ld", tcp->u_arg[3]);
1624 * FIXME - dump out the list of aclent_t's pointed to
1625 * by "tcp->u_arg[4]" if it's not NULL.
1628 tprintf(", %#lx", tcp->u_arg[4]);
1635 #endif /* HAVE_SYS_ACL_H */
1637 #endif /* SVR4 || LINUXSPARC */
1641 static const struct xlat fsmagic[] = {
1642 { 0x73757245, "CODA_SUPER_MAGIC" },
1643 { 0x012ff7b7, "COH_SUPER_MAGIC" },
1644 { 0x1373, "DEVFS_SUPER_MAGIC" },
1645 { 0x1cd1, "DEVPTS_SUPER_MAGIC" },
1646 { 0x414A53, "EFS_SUPER_MAGIC" },
1647 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
1648 { 0xef53, "EXT2_SUPER_MAGIC" },
1649 { 0x137d, "EXT_SUPER_MAGIC" },
1650 { 0xf995e849, "HPFS_SUPER_MAGIC" },
1651 { 0x9660, "ISOFS_SUPER_MAGIC" },
1652 { 0x137f, "MINIX_SUPER_MAGIC" },
1653 { 0x138f, "MINIX_SUPER_MAGIC2" },
1654 { 0x2468, "MINIX2_SUPER_MAGIC" },
1655 { 0x2478, "MINIX2_SUPER_MAGIC2" },
1656 { 0x4d44, "MSDOS_SUPER_MAGIC" },
1657 { 0x564c, "NCP_SUPER_MAGIC" },
1658 { 0x6969, "NFS_SUPER_MAGIC" },
1659 { 0x9fa0, "PROC_SUPER_MAGIC" },
1660 { 0x002f, "QNX4_SUPER_MAGIC" },
1661 { 0x52654973, "REISERFS_SUPER_MAGIC" },
1662 { 0x02011994, "SHMFS_SUPER_MAGIC" },
1663 { 0x517b, "SMB_SUPER_MAGIC" },
1664 { 0x012ff7b6, "SYSV2_SUPER_MAGIC" },
1665 { 0x012ff7b5, "SYSV4_SUPER_MAGIC" },
1666 { 0x00011954, "UFS_MAGIC" },
1667 { 0x54190100, "UFS_CIGAM" },
1668 { 0x012ff7b4, "XENIX_SUPER_MAGIC" },
1669 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
1670 { 0x62656572, "SYSFS_MAGIC" },
1679 sprintfstype(int magic)
1681 static char buf[32];
1685 s = xlookup(fsmagic, magic);
1687 sprintf(buf, "\"%s\"", s);
1691 sprintf(buf, "%#x", magic);
1696 printstatfs(struct tcb *tcp, long addr)
1698 struct statfs statbuf;
1700 if (syserror(tcp) || !verbose(tcp)) {
1701 tprintf("%#lx", addr);
1704 if (umove(tcp, addr, &statbuf) < 0) {
1710 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
1711 sprintfstype(statbuf.f_type),
1712 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
1713 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_fsid={%d, %d}, f_namelen=%u",
1714 statbuf.f_bavail, statbuf.f_files, statbuf.f_ffree,
1715 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1],
1718 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
1719 sprintfstype(statbuf.f_type),
1720 (unsigned long)statbuf.f_bsize,
1721 (unsigned long)statbuf.f_blocks,
1722 (unsigned long)statbuf.f_bfree);
1723 tprintf("f_bavail=%lu, f_files=%lu, f_ffree=%lu, f_fsid={%d, %d}",
1724 (unsigned long)statbuf.f_bavail,
1725 (unsigned long)statbuf.f_files,
1726 (unsigned long)statbuf.f_ffree,
1727 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1729 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1732 #ifdef _STATFS_F_FRSIZE
1733 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
1739 sys_statfs(struct tcb *tcp)
1741 if (entering(tcp)) {
1742 printpath(tcp, tcp->u_arg[0]);
1745 printstatfs(tcp, tcp->u_arg[1]);
1751 sys_fstatfs(struct tcb *tcp)
1753 if (entering(tcp)) {
1754 printfd(tcp, tcp->u_arg[0]);
1757 printstatfs(tcp, tcp->u_arg[1]);
1762 #if defined LINUX && defined HAVE_STATFS64
1764 printstatfs64(struct tcb *tcp, long addr)
1766 struct statfs64 statbuf;
1768 if (syserror(tcp) || !verbose(tcp)) {
1769 tprintf("%#lx", addr);
1772 if (umove(tcp, addr, &statbuf) < 0) {
1776 tprintf("{f_type=%s, f_bsize=%llu, f_blocks=%llu, f_bfree=%llu, ",
1777 sprintfstype(statbuf.f_type),
1778 (unsigned long long)statbuf.f_bsize,
1779 (unsigned long long)statbuf.f_blocks,
1780 (unsigned long long)statbuf.f_bfree);
1781 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
1782 (unsigned long long)statbuf.f_bavail,
1783 (unsigned long long)statbuf.f_files,
1784 (unsigned long long)statbuf.f_ffree,
1785 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1786 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1787 #ifdef _STATFS_F_FRSIZE
1788 tprintf(", f_frsize=%llu", (unsigned long long)statbuf.f_frsize);
1790 #ifdef _STATFS_F_FLAGS
1791 tprintf(", f_flags=%llu", (unsigned long long)statbuf.f_flags);
1796 struct compat_statfs64 {
1808 uint32_t f_spare[4];
1810 #if defined(X86_64) || defined(IA64)
1811 __attribute__ ((packed, aligned(4)))
1816 printcompat_statfs64(struct tcb *tcp, long addr)
1818 struct compat_statfs64 statbuf;
1820 if (syserror(tcp) || !verbose(tcp)) {
1821 tprintf("%#lx", addr);
1824 if (umove(tcp, addr, &statbuf) < 0) {
1828 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%llu, f_bfree=%llu, ",
1829 sprintfstype(statbuf.f_type),
1830 (unsigned long)statbuf.f_bsize,
1831 (unsigned long long)statbuf.f_blocks,
1832 (unsigned long long)statbuf.f_bfree);
1833 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
1834 (unsigned long long)statbuf.f_bavail,
1835 (unsigned long long)statbuf.f_files,
1836 (unsigned long long)statbuf.f_ffree,
1837 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1838 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1839 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
1840 tprintf(", f_flags=%lu", (unsigned long)statbuf.f_frsize);
1845 sys_statfs64(struct tcb *tcp)
1847 if (entering(tcp)) {
1848 printpath(tcp, tcp->u_arg[0]);
1849 tprintf(", %lu, ", tcp->u_arg[1]);
1851 if (tcp->u_arg[1] == sizeof(struct statfs64))
1852 printstatfs64(tcp, tcp->u_arg[2]);
1853 else if (tcp->u_arg[1] == sizeof(struct compat_statfs64))
1854 printcompat_statfs64(tcp, tcp->u_arg[2]);
1862 sys_fstatfs64(struct tcb *tcp)
1864 if (entering(tcp)) {
1865 printfd(tcp, tcp->u_arg[0]);
1866 tprintf(", %lu, ", tcp->u_arg[1]);
1868 if (tcp->u_arg[1] == sizeof(struct statfs64))
1869 printstatfs64(tcp, tcp->u_arg[2]);
1870 else if (tcp->u_arg[1] == sizeof(struct compat_statfs64))
1871 printcompat_statfs64(tcp, tcp->u_arg[2]);
1879 #if defined(LINUX) && defined(__alpha)
1882 osf_statfs(struct tcb *tcp)
1884 if (entering(tcp)) {
1885 printpath(tcp, tcp->u_arg[0]);
1888 printstatfs(tcp, tcp->u_arg[1]);
1889 tprintf(", %lu", tcp->u_arg[2]);
1895 osf_fstatfs(struct tcb *tcp)
1897 if (entering(tcp)) {
1898 tprintf("%lu, ", tcp->u_arg[0]);
1900 printstatfs(tcp, tcp->u_arg[1]);
1901 tprintf(", %lu", tcp->u_arg[2]);
1905 #endif /* LINUX && __alpha */
1911 sys_ustat(struct tcb *tcp)
1913 struct ustat statbuf;
1915 if (entering(tcp)) {
1916 tprintf("makedev(%lu, %lu), ",
1917 (long) major(tcp->u_arg[0]),
1918 (long) minor(tcp->u_arg[0]));
1921 if (syserror(tcp) || !verbose(tcp))
1922 tprintf("%#lx", tcp->u_arg[1]);
1923 else if (umove(tcp, tcp->u_arg[1], &statbuf) < 0)
1926 tprintf("{f_tfree=%lu, f_tinode=%lu, ",
1927 statbuf.f_tfree, statbuf.f_tinode);
1928 tprintf("f_fname=\"%.*s\", ",
1929 (int) sizeof(statbuf.f_fname),
1931 tprintf("f_fpack=\"%.*s\"}",
1932 (int) sizeof(statbuf.f_fpack),
1942 sys_chdir(struct tcb *tcp)
1944 if (entering(tcp)) {
1945 printpath(tcp, tcp->u_arg[0]);
1951 decode_mkdir(struct tcb *tcp, int offset)
1953 if (entering(tcp)) {
1954 printpath(tcp, tcp->u_arg[offset]);
1955 tprintf(", %#lo", tcp->u_arg[offset + 1]);
1961 sys_mkdir(struct tcb *tcp)
1963 return decode_mkdir(tcp, 0);
1968 sys_mkdirat(struct tcb *tcp)
1971 print_dirfd(tcp, tcp->u_arg[0]);
1972 return decode_mkdir(tcp, 1);
1977 sys_link(struct tcb *tcp)
1979 if (entering(tcp)) {
1980 printpath(tcp, tcp->u_arg[0]);
1982 printpath(tcp, tcp->u_arg[1]);
1989 sys_linkat(struct tcb *tcp)
1991 if (entering(tcp)) {
1992 print_dirfd(tcp, tcp->u_arg[0]);
1993 printpath(tcp, tcp->u_arg[1]);
1995 print_dirfd(tcp, tcp->u_arg[2]);
1996 printpath(tcp, tcp->u_arg[3]);
1998 printfd(tcp, tcp->u_arg[4]);
2005 static const struct xlat unlinkatflags[] = {
2006 #ifndef AT_REMOVEDIR
2007 # define AT_REMOVEDIR 0x200
2009 { AT_REMOVEDIR, "AT_REMOVEDIR" },
2014 sys_unlinkat(struct tcb *tcp)
2016 if (entering(tcp)) {
2017 print_dirfd(tcp, tcp->u_arg[0]);
2018 printpath(tcp, tcp->u_arg[1]);
2020 printflags(unlinkatflags, tcp->u_arg[2], "AT_???");
2028 sys_symlinkat(struct tcb *tcp)
2030 if (entering(tcp)) {
2031 printpath(tcp, tcp->u_arg[0]);
2033 print_dirfd(tcp, tcp->u_arg[1]);
2034 printpath(tcp, tcp->u_arg[2]);
2041 decode_readlink(struct tcb *tcp, int offset)
2043 if (entering(tcp)) {
2044 printpath(tcp, tcp->u_arg[offset]);
2048 tprintf("%#lx", tcp->u_arg[offset + 1]);
2050 /* Used to use printpathn(), but readlink
2051 * neither includes NUL in the returned count,
2052 * nor actually writes it into memory.
2053 * printpathn() would decide on printing
2054 * "..." continuation based on garbage
2055 * past return buffer's end.
2057 printstr(tcp, tcp->u_arg[offset + 1], tcp->u_rval);
2058 tprintf(", %lu", tcp->u_arg[offset + 2]);
2064 sys_readlink(struct tcb *tcp)
2066 return decode_readlink(tcp, 0);
2071 sys_readlinkat(struct tcb *tcp)
2074 print_dirfd(tcp, tcp->u_arg[0]);
2075 return decode_readlink(tcp, 1);
2081 sys_renameat(struct tcb *tcp)
2083 if (entering(tcp)) {
2084 print_dirfd(tcp, tcp->u_arg[0]);
2085 printpath(tcp, tcp->u_arg[1]);
2087 print_dirfd(tcp, tcp->u_arg[2]);
2088 printpath(tcp, tcp->u_arg[3]);
2095 sys_chown(struct tcb *tcp)
2097 if (entering(tcp)) {
2098 printpath(tcp, tcp->u_arg[0]);
2099 printuid(", ", tcp->u_arg[1]);
2100 printuid(", ", tcp->u_arg[2]);
2107 sys_fchownat(struct tcb *tcp)
2109 if (entering(tcp)) {
2110 print_dirfd(tcp, tcp->u_arg[0]);
2111 printpath(tcp, tcp->u_arg[1]);
2112 printuid(", ", tcp->u_arg[2]);
2113 printuid(", ", tcp->u_arg[3]);
2115 printflags(fstatatflags, tcp->u_arg[4], "AT_???");
2122 sys_fchown(struct tcb *tcp)
2124 if (entering(tcp)) {
2125 printfd(tcp, tcp->u_arg[0]);
2126 printuid(", ", tcp->u_arg[1]);
2127 printuid(", ", tcp->u_arg[2]);
2133 decode_chmod(struct tcb *tcp, int offset)
2135 if (entering(tcp)) {
2136 printpath(tcp, tcp->u_arg[offset]);
2137 tprintf(", %#lo", tcp->u_arg[offset + 1]);
2143 sys_chmod(struct tcb *tcp)
2145 return decode_chmod(tcp, 0);
2150 sys_fchmodat(struct tcb *tcp)
2153 print_dirfd(tcp, tcp->u_arg[0]);
2154 return decode_chmod(tcp, 1);
2159 sys_fchmod(struct tcb *tcp)
2161 if (entering(tcp)) {
2162 printfd(tcp, tcp->u_arg[0]);
2163 tprintf(", %#lo", tcp->u_arg[1]);
2170 sys_osf_utimes(struct tcb *tcp)
2172 if (entering(tcp)) {
2173 printpath(tcp, tcp->u_arg[0]);
2175 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
2182 decode_utimes(struct tcb *tcp, int offset, int special)
2184 if (entering(tcp)) {
2185 printpath(tcp, tcp->u_arg[offset]);
2187 if (tcp->u_arg[offset + 1] == 0)
2191 printtv_bitness(tcp, tcp->u_arg[offset + 1],
2192 BITNESS_CURRENT, special);
2194 printtv_bitness(tcp, tcp->u_arg[offset + 1]
2195 + sizeof(struct timeval),
2196 BITNESS_CURRENT, special);
2204 sys_utimes(struct tcb *tcp)
2206 return decode_utimes(tcp, 0, 0);
2211 sys_futimesat(struct tcb *tcp)
2214 print_dirfd(tcp, tcp->u_arg[0]);
2215 return decode_utimes(tcp, 1, 0);
2219 sys_utimensat(struct tcb *tcp)
2221 if (entering(tcp)) {
2222 print_dirfd(tcp, tcp->u_arg[0]);
2223 decode_utimes(tcp, 1, 1);
2225 printflags(utimensatflags, tcp->u_arg[3], "AT_???");
2232 sys_utime(struct tcb *tcp)
2239 if (entering(tcp)) {
2240 printpath(tcp, tcp->u_arg[0]);
2244 else if (!verbose(tcp))
2245 tprintf("%#lx", tcp->u_arg[1]);
2246 else if (umoven(tcp, tcp->u_arg[1],
2247 2 * personality_wordsize[current_personality],
2250 else if (personality_wordsize[current_personality]
2251 == sizeof u.utl[0]) {
2252 tprintf("[%s,", sprinttime(u.utl[0]));
2253 tprintf(" %s]", sprinttime(u.utl[1]));
2255 else if (personality_wordsize[current_personality]
2256 == sizeof u.uti[0]) {
2257 tprintf("[%s,", sprinttime(u.uti[0]));
2258 tprintf(" %s]", sprinttime(u.uti[1]));
2267 decode_mknod(struct tcb *tcp, int offset)
2269 int mode = tcp->u_arg[offset + 1];
2271 if (entering(tcp)) {
2272 printpath(tcp, tcp->u_arg[offset]);
2273 tprintf(", %s", sprintmode(mode));
2274 switch (mode & S_IFMT) {
2275 case S_IFCHR: case S_IFBLK:
2277 if (current_personality == 1)
2278 tprintf(", makedev(%lu, %lu)",
2279 (unsigned long) ((tcp->u_arg[offset + 2] >> 18) & 0x3fff),
2280 (unsigned long) (tcp->u_arg[offset + 2] & 0x3ffff));
2283 tprintf(", makedev(%lu, %lu)",
2284 (unsigned long) major(tcp->u_arg[offset + 2]),
2285 (unsigned long) minor(tcp->u_arg[offset + 2]));
2295 sys_mknod(struct tcb *tcp)
2297 return decode_mknod(tcp, 0);
2302 sys_mknodat(struct tcb *tcp)
2305 print_dirfd(tcp, tcp->u_arg[0]);
2306 return decode_mknod(tcp, 1);
2312 sys_mkfifo(struct tcb *tcp)
2314 if (entering(tcp)) {
2315 printpath(tcp, tcp->u_arg[0]);
2316 tprintf(", %#lo", tcp->u_arg[1]);
2320 #endif /* FREEBSD */
2323 sys_fsync(struct tcb *tcp)
2325 if (entering(tcp)) {
2326 printfd(tcp, tcp->u_arg[0]);
2334 printdir(struct tcb *tcp, long addr)
2338 if (!verbose(tcp)) {
2339 tprintf("%#lx", addr);
2342 if (umove(tcp, addr, &d) < 0) {
2346 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
2348 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
2353 sys_readdir(struct tcb *tcp)
2355 if (entering(tcp)) {
2356 printfd(tcp, tcp->u_arg[0]);
2359 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
2360 tprintf("%#lx", tcp->u_arg[1]);
2362 printdir(tcp, tcp->u_arg[1]);
2363 /* Not much point in printing this out, it is always 1. */
2364 if (tcp->u_arg[2] != 1)
2365 tprintf(", %lu", tcp->u_arg[2]);
2372 #if defined FREEBSD || defined LINUX
2373 static const struct xlat direnttypes[] = {
2374 { DT_UNKNOWN, "DT_UNKNOWN" },
2375 { DT_FIFO, "DT_FIFO" },
2376 { DT_CHR, "DT_CHR" },
2377 { DT_DIR, "DT_DIR" },
2378 { DT_BLK, "DT_BLK" },
2379 { DT_REG, "DT_REG" },
2380 { DT_LNK, "DT_LNK" },
2381 { DT_SOCK, "DT_SOCK" },
2382 { DT_WHT, "DT_WHT" },
2389 sys_getdents(struct tcb *tcp)
2391 int i, len, dents = 0;
2394 if (entering(tcp)) {
2395 printfd(tcp, tcp->u_arg[0]);
2399 if (syserror(tcp) || !verbose(tcp)) {
2400 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2404 /* Beware of insanely large or negative values in tcp->u_rval */
2405 if (tcp->u_rval > 1024*1024)
2407 if (tcp->u_rval < 0)
2409 buf = len ? malloc(len) : NULL;
2411 die_out_of_memory();
2412 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2413 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2419 for (i = 0; i < len;) {
2420 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
2423 tprintf("%s{d_ino=%lu, d_off=%lu, ",
2424 i ? " " : "", d->d_ino, d->d_off);
2425 tprintf("d_reclen=%u, d_name=\"%s\"}",
2426 d->d_reclen, d->d_name);
2431 tprintf("%s{d_ino=%lu, d_off=%lu, ",
2433 (unsigned long) d->d_ino,
2434 (unsigned long) d->d_off);
2435 tprintf("d_reclen=%u, d_name=\"%s\"}",
2436 d->d_reclen, d->d_name);
2441 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
2442 i ? " " : "", d->d_off, d->d_fileno,
2444 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
2445 d->d_namlen, d->d_namlen, d->d_name);
2450 tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
2451 i ? " " : "", d->d_fileno, d->d_reclen);
2452 printxval(direnttypes, d->d_type, "DT_???");
2453 tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
2454 d->d_namlen, d->d_namlen, d->d_name);
2456 #endif /* FREEBSD */
2458 tprints("/* d_reclen == 0, problem here */");
2467 tprintf("/* %u entries */", dents);
2468 tprintf(", %lu", tcp->u_arg[2]);
2474 #if _LFS64_LARGEFILE
2476 sys_getdents64(struct tcb *tcp)
2478 int i, len, dents = 0;
2481 if (entering(tcp)) {
2482 printfd(tcp, tcp->u_arg[0]);
2486 if (syserror(tcp) || !verbose(tcp)) {
2487 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2492 /* Beware of insanely large or negative tcp->u_rval */
2493 if (tcp->u_rval > 1024*1024)
2495 if (tcp->u_rval < 0)
2497 buf = len ? malloc(len) : NULL;
2499 die_out_of_memory();
2501 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2502 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2508 for (i = 0; i < len;) {
2509 struct dirent64 *d = (struct dirent64 *) &buf[i];
2510 #if defined(LINUX) || defined(SVR4)
2512 tprintf("%s{d_ino=%" PRIu64 ", d_off=%" PRId64 ", ",
2518 printxval(direnttypes, d->d_type, "DT_???");
2521 tprintf("d_reclen=%u, d_name=\"%s\"}",
2522 d->d_reclen, d->d_name);
2524 #endif /* LINUX || SVR4 */
2527 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
2528 i ? " " : "", d->d_off, d->d_fileno,
2530 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
2531 d->d_namlen, d->d_namlen, d->d_name);
2535 tprints("/* d_reclen == 0, problem here */");
2544 tprintf("/* %u entries */", dents);
2545 tprintf(", %lu", tcp->u_arg[2]);
2553 sys_getdirentries(struct tcb *tcp)
2555 int i, len, dents = 0;
2559 if (entering(tcp)) {
2560 printfd(tcp, tcp->u_arg[0]);
2564 if (syserror(tcp) || !verbose(tcp)) {
2565 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2570 /* Beware of insanely large or negative tcp->u_rval */
2571 if (tcp->u_rval > 1024*1024)
2573 if (tcp->u_rval < 0)
2577 die_out_of_memory();
2579 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2580 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2586 for (i = 0; i < len;) {
2587 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
2589 tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
2590 i ? " " : "", d->d_fileno, d->d_reclen);
2591 printxval(direnttypes, d->d_type, "DT_???");
2592 tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
2593 d->d_namlen, d->d_namlen, d->d_name);
2596 tprints("/* d_reclen == 0, problem here */");
2605 tprintf("/* %u entries */", dents);
2607 tprintf(", %lu", tcp->u_arg[2]);
2608 if (umove(tcp, tcp->u_arg[3], &basep) < 0)
2609 tprintf(", %#lx", tcp->u_arg[3]);
2611 tprintf(", [%lu]", basep);
2618 sys_getcwd(struct tcb *tcp)
2622 tprintf("%#lx", tcp->u_arg[0]);
2624 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
2625 tprintf(", %lu", tcp->u_arg[1]);
2633 sys___getcwd(struct tcb *tcp)
2637 tprintf("%#lx", tcp->u_arg[0]);
2639 printpathn(tcp, tcp->u_arg[0], tcp->u_arg[1]);
2640 tprintf(", %lu", tcp->u_arg[1]);
2646 #ifdef HAVE_SYS_ASYNCH_H
2649 sys_aioread(struct tcb *tcp)
2651 struct aio_result_t res;
2653 if (entering(tcp)) {
2654 tprintf("%lu, ", tcp->u_arg[0]);
2657 tprintf("%#lx", tcp->u_arg[1]);
2659 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2660 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2661 printxval(whence, tcp->u_arg[4], "L_???");
2662 if (syserror(tcp) || tcp->u_arg[5] == 0
2663 || umove(tcp, tcp->u_arg[5], &res) < 0)
2664 tprintf(", %#lx", tcp->u_arg[5]);
2666 tprintf(", {aio_return %d aio_errno %d}",
2667 res.aio_return, res.aio_errno);
2673 sys_aiowrite(struct tcb *tcp)
2675 struct aio_result_t res;
2677 if (entering(tcp)) {
2678 tprintf("%lu, ", tcp->u_arg[0]);
2679 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2680 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2681 printxval(whence, tcp->u_arg[4], "L_???");
2684 if (tcp->u_arg[5] == 0)
2686 else if (syserror(tcp)
2687 || umove(tcp, tcp->u_arg[5], &res) < 0)
2688 tprintf(", %#lx", tcp->u_arg[5]);
2690 tprintf(", {aio_return %d aio_errno %d}",
2691 res.aio_return, res.aio_errno);
2697 sys_aiowait(struct tcb *tcp)
2700 printtv(tcp, tcp->u_arg[0]);
2705 sys_aiocancel(struct tcb *tcp)
2707 struct aio_result_t res;
2710 if (tcp->u_arg[0] == 0)
2712 else if (syserror(tcp)
2713 || umove(tcp, tcp->u_arg[0], &res) < 0)
2714 tprintf("%#lx", tcp->u_arg[0]);
2716 tprintf("{aio_return %d aio_errno %d}",
2717 res.aio_return, res.aio_errno);
2722 #endif /* HAVE_SYS_ASYNCH_H */
2724 static const struct xlat xattrflags[] = {
2726 { XATTR_CREATE, "XATTR_CREATE" },
2727 { XATTR_REPLACE, "XATTR_REPLACE" },
2733 print_xattr_val(struct tcb *tcp, int failed,
2735 unsigned long insize,
2739 unsigned long capacity = 4 * size + 1;
2740 unsigned char *buf = (capacity < size) ? NULL : malloc(capacity);
2741 if (buf == NULL || /* probably a bogus size argument */
2742 umoven(tcp, arg, size, (char *) &buf[3 * size]) < 0) {
2746 unsigned char *out = buf;
2747 unsigned char *in = &buf[3 * size];
2749 for (i = 0; i < size; ++i) {
2753 #define tohex(n) "0123456789abcdef"[n]
2756 *out++ = tohex(in[i] / 16);
2757 *out++ = tohex(in[i] % 16);
2760 /* Don't print terminating NUL if there is one. */
2761 if (i > 0 && in[i - 1] == '\0')
2764 tprintf(", \"%s\", %ld", buf, insize);
2769 tprintf(", 0x%lx, %ld", arg, insize);
2773 sys_setxattr(struct tcb *tcp)
2775 if (entering(tcp)) {
2776 printpath(tcp, tcp->u_arg[0]);
2778 printstr(tcp, tcp->u_arg[1], -1);
2779 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2781 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2787 sys_fsetxattr(struct tcb *tcp)
2789 if (entering(tcp)) {
2790 printfd(tcp, tcp->u_arg[0]);
2792 printstr(tcp, tcp->u_arg[1], -1);
2793 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2795 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2801 sys_getxattr(struct tcb *tcp)
2803 if (entering(tcp)) {
2804 printpath(tcp, tcp->u_arg[0]);
2806 printstr(tcp, tcp->u_arg[1], -1);
2808 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2815 sys_fgetxattr(struct tcb *tcp)
2817 if (entering(tcp)) {
2818 printfd(tcp, tcp->u_arg[0]);
2820 printstr(tcp, tcp->u_arg[1], -1);
2822 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2829 sys_listxattr(struct tcb *tcp)
2831 if (entering(tcp)) {
2832 printpath(tcp, tcp->u_arg[0]);
2834 /* XXX Print value in format */
2835 tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]);
2841 sys_flistxattr(struct tcb *tcp)
2843 if (entering(tcp)) {
2844 printfd(tcp, tcp->u_arg[0]);
2846 /* XXX Print value in format */
2847 tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]);
2853 sys_removexattr(struct tcb *tcp)
2855 if (entering(tcp)) {
2856 printpath(tcp, tcp->u_arg[0]);
2858 printstr(tcp, tcp->u_arg[1], -1);
2864 sys_fremovexattr(struct tcb *tcp)
2866 if (entering(tcp)) {
2867 printfd(tcp, tcp->u_arg[0]);
2869 printstr(tcp, tcp->u_arg[1], -1);
2875 static const struct xlat advise[] = {
2876 { POSIX_FADV_NORMAL, "POSIX_FADV_NORMAL" },
2877 { POSIX_FADV_RANDOM, "POSIX_FADV_RANDOM" },
2878 { POSIX_FADV_SEQUENTIAL, "POSIX_FADV_SEQUENTIAL" },
2879 { POSIX_FADV_WILLNEED, "POSIX_FADV_WILLNEED" },
2880 { POSIX_FADV_DONTNEED, "POSIX_FADV_DONTNEED" },
2881 { POSIX_FADV_NOREUSE, "POSIX_FADV_NOREUSE" },
2888 sys_fadvise64(struct tcb *tcp)
2890 if (entering(tcp)) {
2892 printfd(tcp, tcp->u_arg[0]);
2894 argn = printllval(tcp, "%lld", 1);
2895 tprintf(", %ld, ", tcp->u_arg[argn++]);
2896 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2904 sys_fadvise64_64(struct tcb *tcp)
2906 if (entering(tcp)) {
2908 printfd(tcp, tcp->u_arg[0]);
2910 #if defined ARM || defined POWERPC
2911 argn = printllval(tcp, "%lld, ", 2);
2913 argn = printllval(tcp, "%lld, ", 1);
2915 argn = printllval(tcp, "%lld, ", argn);
2916 #if defined ARM || defined POWERPC
2917 printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
2919 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2926 static const struct xlat inotify_modes[] = {
2927 { 0x00000001, "IN_ACCESS" },
2928 { 0x00000002, "IN_MODIFY" },
2929 { 0x00000004, "IN_ATTRIB" },
2930 { 0x00000008, "IN_CLOSE_WRITE"},
2931 { 0x00000010, "IN_CLOSE_NOWRITE"},
2932 { 0x00000020, "IN_OPEN" },
2933 { 0x00000040, "IN_MOVED_FROM" },
2934 { 0x00000080, "IN_MOVED_TO" },
2935 { 0x00000100, "IN_CREATE" },
2936 { 0x00000200, "IN_DELETE" },
2937 { 0x00000400, "IN_DELETE_SELF"},
2938 { 0x00000800, "IN_MOVE_SELF" },
2939 { 0x00002000, "IN_UNMOUNT" },
2940 { 0x00004000, "IN_Q_OVERFLOW" },
2941 { 0x00008000, "IN_IGNORED" },
2942 { 0x01000000, "IN_ONLYDIR" },
2943 { 0x02000000, "IN_DONT_FOLLOW"},
2944 { 0x20000000, "IN_MASK_ADD" },
2945 { 0x40000000, "IN_ISDIR" },
2946 { 0x80000000, "IN_ONESHOT" },
2950 static const struct xlat inotify_init_flags[] = {
2951 { 0x00000800, "IN_NONBLOCK" },
2952 { 0x00080000, "IN_CLOEXEC" },
2957 sys_inotify_add_watch(struct tcb *tcp)
2959 if (entering(tcp)) {
2960 printfd(tcp, tcp->u_arg[0]);
2962 printpath(tcp, tcp->u_arg[1]);
2964 printflags(inotify_modes, tcp->u_arg[2], "IN_???");
2970 sys_inotify_rm_watch(struct tcb *tcp)
2972 if (entering(tcp)) {
2973 printfd(tcp, tcp->u_arg[0]);
2974 tprintf(", %ld", tcp->u_arg[1]);
2980 sys_inotify_init1(struct tcb *tcp)
2983 printflags(inotify_init_flags, tcp->u_arg[0], "IN_???");
2988 sys_fallocate(struct tcb *tcp)
2990 if (entering(tcp)) {
2992 printfd(tcp, tcp->u_arg[0]); /* fd */
2994 tprintf("%#lo, ", tcp->u_arg[1]); /* mode */
2995 argn = printllval(tcp, "%llu, ", 2); /* offset */
2996 printllval(tcp, "%llu", argn); /* len */