2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
5 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 struct kernel_dirent {
41 unsigned short d_reclen;
45 # define kernel_dirent dirent
51 unsigned short st_dev;
53 unsigned short st_mode;
55 unsigned short st_uid;
56 unsigned short st_gid;
57 unsigned short st_rdev;
60 unsigned int __unused1;
62 unsigned int __unused2;
64 unsigned int __unused3;
67 unsigned int __unused4[2];
74 unsigned int st_nlink;
84 unsigned long __unused4[2];
87 # define stat kernel_stat
88 # include <asm/stat.h>
100 # define dev_t __kernel_dev_t
101 # define ino_t __kernel_ino_t
102 # define mode_t __kernel_mode_t
103 # define nlink_t __kernel_nlink_t
104 # define uid_t __kernel_uid_t
105 # define gid_t __kernel_gid_t
106 # define off_t __kernel_off_t
107 # define loff_t __kernel_loff_t
109 # include <asm/stat.h>
122 # define mode_t mode_t
123 # define nlink_t nlink_t
127 # define loff_t loff_t
129 # ifdef HPPA /* asm-parisc/stat.h defines stat64 */
132 # define stat libc_stat
133 # define stat64 libc_stat64
134 # include <sys/stat.h>
137 /* These might be macros. */
142 # define stat64 hpux_stat64
145 # include <sys/stat.h>
151 # include <sys/cred.h>
154 #ifdef HAVE_SYS_VFS_H
158 #ifdef HAVE_LINUX_XATTR_H
159 #include <linux/xattr.h>
161 #define XATTR_CREATE 1
162 #define XATTR_REPLACE 2
166 #include <sys/param.h>
167 #include <sys/mount.h>
168 #include <sys/stat.h>
171 #if _LFS64_LARGEFILE && (defined(LINUX) || defined(SVR4))
172 # ifdef HAVE_INTTYPES_H
173 # include <inttypes.h>
175 # define PRId64 "lld"
176 # define PRIu64 "llu"
180 #if HAVE_LONG_LONG_OFF_T
182 * Ugly hacks for systems that have typedef long long off_t
186 #define HAVE_STAT64 1 /* Ugly hack */
188 #define sys_stat64 sys_stat
189 #define sys_fstat64 sys_fstat
190 #define sys_lstat64 sys_lstat
191 #define sys_lseek64 sys_lseek
192 #define sys_truncate64 sys_truncate
193 #define sys_ftruncate64 sys_ftruncate
196 #ifdef MAJOR_IN_SYSMACROS
197 #include <sys/sysmacros.h>
200 #ifdef MAJOR_IN_MKDEV
201 #include <sys/mkdev.h>
204 #ifdef HAVE_SYS_ASYNCH_H
205 #include <sys/asynch.h>
212 const struct xlat open_access_modes[] = {
213 { O_RDONLY, "O_RDONLY" },
214 { O_WRONLY, "O_WRONLY" },
215 { O_RDWR, "O_RDWR" },
217 { O_ACCMODE, "O_ACCMODE" },
222 const struct xlat open_mode_flags[] = {
223 { O_CREAT, "O_CREAT" },
224 { O_EXCL, "O_EXCL" },
225 { O_NOCTTY, "O_NOCTTY" },
226 { O_TRUNC, "O_TRUNC" },
227 { O_APPEND, "O_APPEND" },
228 { O_NONBLOCK, "O_NONBLOCK" },
230 { O_SYNC, "O_SYNC" },
233 { O_ASYNC, "O_ASYNC" },
236 { O_DSYNC, "O_DSYNC" },
239 { O_RSYNC, "O_RSYNC" },
241 #if defined(O_NDELAY) && (O_NDELAY != O_NONBLOCK)
242 { O_NDELAY, "O_NDELAY" },
245 { O_PRIV, "O_PRIV" },
248 { O_DIRECT, "O_DIRECT" },
251 # if O_LARGEFILE == 0 /* biarch platforms in 64-bit mode */
254 # define O_LARGEFILE 0x40000
255 # elif defined X86_64 || defined S390X
256 # define O_LARGEFILE 0100000
260 { O_LARGEFILE, "O_LARGEFILE" },
264 { O_DIRECTORY, "O_DIRECTORY" },
267 { O_NOFOLLOW, "O_NOFOLLOW" },
270 { O_NOATIME, "O_NOATIME" },
273 { O_CLOEXEC, "O_CLOEXEC" },
277 { FNDELAY, "FNDELAY" },
280 { FAPPEND, "FAPPEND" },
286 { FDEFER, "FDEFER" },
289 { FASYNC, "FASYNC" },
292 { FSHLOCK, "FSHLOCK" },
295 { FEXLOCK, "FEXLOCK" },
298 { FCREAT, "FCREAT" },
301 { FTRUNC, "FTRUNC" },
313 { FNOCTTY, "FNOCTTY" },
316 { O_SHLOCK, "O_SHLOCK" },
319 { O_EXLOCK, "O_EXLOCK" },
327 # define AT_FDCWD -100
330 /* The fd is an "int", so when decoding x86 on x86_64, we need to force sign
331 * extension to get the right value. We do this by declaring fd as int here.
334 print_dirfd(struct tcb *tcp, int fd)
337 tprintf("AT_FDCWD, ");
346 * Pity stpcpy() is not standardized...
349 str_append(char *dst, const char *src)
351 while ((*dst = *src++) != '\0')
357 * low bits of the open(2) flags define access mode,
358 * other bits are real flags.
361 sprint_open_modes(mode_t flags)
363 static char outstr[1024];
367 const struct xlat *x;
369 p = str_append(outstr, "flags ");
370 str = xlookup(open_access_modes, flags & 3);
372 p = str_append(p, str);
379 for (x = open_mode_flags; x->str; x++) {
380 if ((flags & x->val) == x->val) {
383 p = str_append(p, x->str);
390 /* flags is still nonzero */
393 sprintf(p, "%#x", flags);
398 tprint_open_modes(mode_t flags)
400 tprintf("%s", sprint_open_modes(flags) + sizeof("flags"));
404 decode_open(struct tcb *tcp, int offset)
407 printpath(tcp, tcp->u_arg[offset]);
410 tprint_open_modes(tcp->u_arg[offset + 1]);
411 if (tcp->u_arg[offset + 1] & O_CREAT) {
413 tprintf(", %#lo", tcp->u_arg[offset + 2]);
420 sys_open(struct tcb *tcp)
422 return decode_open(tcp, 0);
427 sys_openat(struct tcb *tcp)
430 print_dirfd(tcp, tcp->u_arg[0]);
431 return decode_open(tcp, 1);
436 static const struct xlat openmodessol[] = {
440 { 0x80, "O_NONBLOCK" },
442 { 0x100, "O_CREAT" },
443 { 0x200, "O_TRUNC" },
445 { 0x800, "O_NOCTTY" },
448 { 0x8000, "O_RSYNC" },
450 { 0x1000, "O_PRIV" },
455 solaris_open(struct tcb *tcp)
458 printpath(tcp, tcp->u_arg[0]);
461 printflags(openmodessol, tcp->u_arg[1] + 1, "O_???");
462 if (tcp->u_arg[1] & 0x100) {
464 tprintf(", %#lo", tcp->u_arg[2]);
473 sys_creat(struct tcb *tcp)
476 printpath(tcp, tcp->u_arg[0]);
477 tprintf(", %#lo", tcp->u_arg[1]);
482 static const struct xlat access_flags[] = {
488 { EFF_ONLY_OK, "EFF_ONLY_OK" },
497 decode_access(struct tcb *tcp, int offset)
500 printpath(tcp, tcp->u_arg[offset]);
502 printflags(access_flags, tcp->u_arg[offset + 1], "?_OK");
508 sys_access(struct tcb *tcp)
510 return decode_access(tcp, 0);
515 sys_faccessat(struct tcb *tcp)
518 print_dirfd(tcp, tcp->u_arg[0]);
519 return decode_access(tcp, 1);
524 sys_umask(struct tcb *tcp)
527 tprintf("%#lo", tcp->u_arg[0]);
532 static const struct xlat whence[] = {
533 { SEEK_SET, "SEEK_SET" },
534 { SEEK_CUR, "SEEK_CUR" },
535 { SEEK_END, "SEEK_END" },
539 #ifndef HAVE_LONG_LONG_OFF_T
540 #if defined (LINUX_MIPSN32)
542 sys_lseek(struct tcb *tcp)
548 printfd(tcp, tcp->u_arg[0]);
550 offset = tcp->ext_arg[1];
551 _whence = tcp->u_arg[2];
552 if (_whence == SEEK_SET)
553 tprintf("%llu, ", offset);
555 tprintf("%lld, ", offset);
556 printxval(whence, _whence, "SEEK_???");
558 return RVAL_UDECIMAL;
560 #else /* !LINUX_MIPSN32 */
562 sys_lseek(struct tcb *tcp)
568 printfd(tcp, tcp->u_arg[0]);
570 offset = tcp->u_arg[1];
571 _whence = tcp->u_arg[2];
572 if (_whence == SEEK_SET)
573 tprintf("%lu, ", offset);
575 tprintf("%ld, ", offset);
576 printxval(whence, _whence, "SEEK_???");
578 return RVAL_UDECIMAL;
580 #endif /* LINUX_MIPSN32 */
585 sys_llseek(struct tcb *tcp)
588 printfd(tcp, tcp->u_arg[0]);
590 * This one call takes explicitly two 32-bit arguments hi, lo,
591 * rather than one 64-bit argument for which LONG_LONG works
592 * appropriate for the native byte order.
594 if (tcp->u_arg[4] == SEEK_SET)
596 ((long long int) tcp->u_arg[1]) << 32 |
597 (unsigned long long) (unsigned) tcp->u_arg[2]);
600 ((long long int) tcp->u_arg[1]) << 32 |
601 (unsigned long long) (unsigned) tcp->u_arg[2]);
605 if (syserror(tcp) || umove(tcp, tcp->u_arg[3], &off) < 0)
606 tprintf("%#lx, ", tcp->u_arg[3]);
608 tprintf("[%llu], ", off);
609 printxval(whence, tcp->u_arg[4], "SEEK_???");
615 sys_readahead(struct tcb *tcp)
619 printfd(tcp, tcp->u_arg[0]);
621 argn = printllval(tcp, "%lld", 1);
622 tprintf(", %ld", tcp->u_arg[argn]);
628 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
630 sys_lseek64(struct tcb *tcp)
634 printfd(tcp, tcp->u_arg[0]);
636 if (tcp->u_arg[3] == SEEK_SET)
637 argn = printllval(tcp, "%llu, ", 1);
639 argn = printllval(tcp, "%lld, ", 1);
640 printxval(whence, tcp->u_arg[argn], "SEEK_???");
642 return RVAL_LUDECIMAL;
646 #ifndef HAVE_LONG_LONG_OFF_T
648 sys_truncate(struct tcb *tcp)
651 printpath(tcp, tcp->u_arg[0]);
652 tprintf(", %lu", tcp->u_arg[1]);
658 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
660 sys_truncate64(struct tcb *tcp)
663 printpath(tcp, tcp->u_arg[0]);
664 printllval(tcp, ", %llu", 1);
670 #ifndef HAVE_LONG_LONG_OFF_T
672 sys_ftruncate(struct tcb *tcp)
675 printfd(tcp, tcp->u_arg[0]);
676 tprintf(", %lu", tcp->u_arg[1]);
682 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
684 sys_ftruncate64(struct tcb *tcp)
687 printfd(tcp, tcp->u_arg[0]);
689 printllval(tcp, "%llu", 1);
697 static const struct xlat modetypes[] = {
698 { S_IFREG, "S_IFREG" },
699 { S_IFSOCK, "S_IFSOCK" },
700 { S_IFIFO, "S_IFIFO" },
701 { S_IFLNK, "S_IFLNK" },
702 { S_IFDIR, "S_IFDIR" },
703 { S_IFBLK, "S_IFBLK" },
704 { S_IFCHR, "S_IFCHR" },
714 if ((mode & S_IFMT) == 0)
716 else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) {
717 sprintf(buf, "%#o", mode);
720 sprintf(buf, "%s%s%s%s", s,
721 (mode & S_ISUID) ? "|S_ISUID" : "",
722 (mode & S_ISGID) ? "|S_ISGID" : "",
723 (mode & S_ISVTX) ? "|S_ISVTX" : "");
724 mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX);
726 sprintf(buf + strlen(buf), "|%#o", mode);
727 s = (*buf == '|') ? buf + 1 : buf;
743 snprintf(buf, sizeof buf, "%02d/%02d/%02d-%02d:%02d:%02d",
744 tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
745 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
747 snprintf(buf, sizeof buf, "%lu", (unsigned long) t);
760 int st_pad1[3]; /* network id */
769 int st_pad3; /* st_size, off_t expansion */
770 timestruct_t st_atime;
771 timestruct_t st_mtime;
772 timestruct_t st_ctime;
776 int st_pad4[8]; /* expansion area */
780 printstatsol(struct tcb *tcp, long addr)
782 struct solstat statbuf;
784 if (umove(tcp, addr, &statbuf) < 0) {
789 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
790 (unsigned long) ((statbuf.st_dev >> 18) & 0x3fff),
791 (unsigned long) (statbuf.st_dev & 0x3ffff),
792 (unsigned long) statbuf.st_ino,
793 sprintmode(statbuf.st_mode));
794 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
795 (unsigned long) statbuf.st_nlink,
796 (unsigned long) statbuf.st_uid,
797 (unsigned long) statbuf.st_gid);
798 tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);
799 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
802 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
803 switch (statbuf.st_mode & S_IFMT) {
804 case S_IFCHR: case S_IFBLK:
805 tprintf("st_rdev=makedev(%lu, %lu), ",
806 (unsigned long) ((statbuf.st_rdev >> 18) & 0x3fff),
807 (unsigned long) (statbuf.st_rdev & 0x3ffff));
810 tprintf("st_size=%u, ", statbuf.st_size);
814 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime.tv_sec));
815 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime.tv_sec));
816 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime.tv_sec));
822 #if defined (SPARC64)
824 printstat_sparc64(struct tcb *tcp, long addr)
826 struct stat_sparc64 statbuf;
828 if (umove(tcp, addr, &statbuf) < 0) {
834 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
835 (unsigned long) major(statbuf.st_dev),
836 (unsigned long) minor(statbuf.st_dev),
837 (unsigned long) statbuf.st_ino,
838 sprintmode(statbuf.st_mode));
839 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
840 (unsigned long) statbuf.st_nlink,
841 (unsigned long) statbuf.st_uid,
842 (unsigned long) statbuf.st_gid);
843 tprintf("st_blksize=%lu, ",
844 (unsigned long) statbuf.st_blksize);
845 tprintf("st_blocks=%lu, ",
846 (unsigned long) statbuf.st_blocks);
849 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
850 switch (statbuf.st_mode & S_IFMT) {
851 case S_IFCHR: case S_IFBLK:
852 tprintf("st_rdev=makedev(%lu, %lu), ",
853 (unsigned long) major(statbuf.st_rdev),
854 (unsigned long) minor(statbuf.st_rdev));
857 tprintf("st_size=%lu, ", statbuf.st_size);
861 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
862 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
863 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
870 #endif /* LINUXSPARC */
872 #if defined LINUX && defined POWERPC64
873 struct stat_powerpc32 {
876 unsigned int st_mode;
877 unsigned short st_nlink;
880 unsigned int st_rdev;
881 unsigned int st_size;
882 unsigned int st_blksize;
883 unsigned int st_blocks;
884 unsigned int st_atime;
885 unsigned int st_atime_nsec;
886 unsigned int st_mtime;
887 unsigned int st_mtime_nsec;
888 unsigned int st_ctime;
889 unsigned int st_ctime_nsec;
890 unsigned int __unused4;
891 unsigned int __unused5;
895 printstat_powerpc32(struct tcb *tcp, long addr)
897 struct stat_powerpc32 statbuf;
899 if (umove(tcp, addr, &statbuf) < 0) {
905 tprintf("{st_dev=makedev(%u, %u), st_ino=%u, st_mode=%s, ",
906 major(statbuf.st_dev), minor(statbuf.st_dev),
908 sprintmode(statbuf.st_mode));
909 tprintf("st_nlink=%u, st_uid=%u, st_gid=%u, ",
910 statbuf.st_nlink, statbuf.st_uid, statbuf.st_gid);
911 tprintf("st_blksize=%u, ", statbuf.st_blksize);
912 tprintf("st_blocks=%u, ", statbuf.st_blocks);
915 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
916 switch (statbuf.st_mode & S_IFMT) {
917 case S_IFCHR: case S_IFBLK:
918 tprintf("st_rdev=makedev(%lu, %lu), ",
919 (unsigned long) major(statbuf.st_rdev),
920 (unsigned long) minor(statbuf.st_rdev));
923 tprintf("st_size=%u, ", statbuf.st_size);
927 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
928 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
929 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
935 #endif /* LINUX && POWERPC64 */
937 static const struct xlat fileflags[] = {
939 { UF_NODUMP, "UF_NODUMP" },
940 { UF_IMMUTABLE, "UF_IMMUTABLE" },
941 { UF_APPEND, "UF_APPEND" },
942 { UF_OPAQUE, "UF_OPAQUE" },
943 { UF_NOUNLINK, "UF_NOUNLINK" },
944 { SF_ARCHIVED, "SF_ARCHIVED" },
945 { SF_IMMUTABLE, "SF_IMMUTABLE" },
946 { SF_APPEND, "SF_APPEND" },
947 { SF_NOUNLINK, "SF_NOUNLINK" },
950 { _S_ISMLD, "_S_ISMLD" },
953 { _S_ISMOUNTED, "_S_ISMOUNTED" },
961 sys_chflags(struct tcb *tcp)
964 printpath(tcp, tcp->u_arg[0]);
966 printflags(fileflags, tcp->u_arg[1], "UF_???");
972 sys_fchflags(struct tcb *tcp)
975 tprintf("%ld, ", tcp->u_arg[0]);
976 printflags(fileflags, tcp->u_arg[1], "UF_???");
982 #ifndef HAVE_LONG_LONG_OFF_T
984 realprintstat(struct tcb *tcp, struct stat *statbuf)
987 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
988 (unsigned long) major(statbuf->st_dev),
989 (unsigned long) minor(statbuf->st_dev),
990 (unsigned long) statbuf->st_ino,
991 sprintmode(statbuf->st_mode));
992 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
993 (unsigned long) statbuf->st_nlink,
994 (unsigned long) statbuf->st_uid,
995 (unsigned long) statbuf->st_gid);
996 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
997 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
999 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
1000 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
1004 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
1005 switch (statbuf->st_mode & S_IFMT) {
1006 case S_IFCHR: case S_IFBLK:
1007 #ifdef HAVE_STRUCT_STAT_ST_RDEV
1008 tprintf("st_rdev=makedev(%lu, %lu), ",
1009 (unsigned long) major(statbuf->st_rdev),
1010 (unsigned long) minor(statbuf->st_rdev));
1011 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
1012 tprintf("st_size=makedev(%lu, %lu), ",
1013 (unsigned long) major(statbuf->st_size),
1014 (unsigned long) minor(statbuf->st_size));
1015 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
1018 tprintf("st_size=%lu, ", (unsigned long) statbuf->st_size);
1022 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
1023 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
1024 tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));
1025 #if HAVE_STRUCT_STAT_ST_FLAGS
1026 tprintf(", st_flags=");
1027 printflags(fileflags, statbuf->st_flags, "UF_???");
1029 #if HAVE_STRUCT_STAT_ST_ACLCNT
1030 tprintf(", st_aclcnt=%d", statbuf->st_aclcnt);
1032 #if HAVE_STRUCT_STAT_ST_LEVEL
1033 tprintf(", st_level=%ld", statbuf->st_level);
1035 #if HAVE_STRUCT_STAT_ST_FSTYPE
1036 tprintf(", st_fstype=%.*s",
1037 (int) sizeof statbuf->st_fstype, statbuf->st_fstype);
1039 #if HAVE_STRUCT_STAT_ST_GEN
1040 tprintf(", st_gen=%u", statbuf->st_gen);
1050 printstat(struct tcb *tcp, long addr)
1052 struct stat statbuf;
1058 if (syserror(tcp) || !verbose(tcp)) {
1059 tprintf("%#lx", addr);
1064 if (current_personality == 1) {
1065 printstatsol(tcp, addr);
1069 else if (current_personality == 2) {
1070 printstat_sparc64(tcp, addr);
1074 #endif /* LINUXSPARC */
1076 #if defined LINUX && defined POWERPC64
1077 if (current_personality == 1) {
1078 printstat_powerpc32(tcp, addr);
1083 if (umove(tcp, addr, &statbuf) < 0) {
1088 realprintstat(tcp, &statbuf);
1090 #endif /* !HAVE_LONG_LONG_OFF_T */
1092 #if !defined HAVE_STAT64 && defined LINUX && defined X86_64
1094 * Linux x86_64 has unified `struct stat' but its i386 biarch needs
1095 * `struct stat64'. Its <asm-i386/stat.h> definition expects 32-bit `long'.
1096 * <linux/include/asm-x86_64/ia32.h> is not in the public includes set.
1097 * __GNUC__ is needed for the required __attribute__ below.
1100 unsigned long long st_dev;
1101 unsigned char __pad0[4];
1102 unsigned int __st_ino;
1103 unsigned int st_mode;
1104 unsigned int st_nlink;
1105 unsigned int st_uid;
1106 unsigned int st_gid;
1107 unsigned long long st_rdev;
1108 unsigned char __pad3[4];
1110 unsigned int st_blksize;
1111 unsigned long long st_blocks;
1112 unsigned int st_atime;
1113 unsigned int st_atime_nsec;
1114 unsigned int st_mtime;
1115 unsigned int st_mtime_nsec;
1116 unsigned int st_ctime;
1117 unsigned int st_ctime_nsec;
1118 unsigned long long st_ino;
1119 } __attribute__((packed));
1120 # define HAVE_STAT64 1
1121 # define STAT64_SIZE 96
1126 printstat64(struct tcb *tcp, long addr)
1128 struct stat64 statbuf;
1131 (void) sizeof(char[sizeof statbuf == STAT64_SIZE ? 1 : -1]);
1138 if (syserror(tcp) || !verbose(tcp)) {
1139 tprintf("%#lx", addr);
1144 if (current_personality == 1) {
1145 printstatsol(tcp, addr);
1149 else if (current_personality == 2) {
1150 printstat_sparc64(tcp, addr);
1154 #endif /* LINUXSPARC */
1156 #if defined LINUX && defined X86_64
1157 if (current_personality == 0) {
1158 printstat(tcp, addr);
1163 if (umove(tcp, addr, &statbuf) < 0) {
1169 #ifdef HAVE_LONG_LONG
1170 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
1172 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
1174 (unsigned long) major(statbuf.st_dev),
1175 (unsigned long) minor(statbuf.st_dev),
1176 #ifdef HAVE_LONG_LONG
1177 (unsigned long long) statbuf.st_ino,
1179 (unsigned long) statbuf.st_ino,
1181 sprintmode(statbuf.st_mode));
1182 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
1183 (unsigned long) statbuf.st_nlink,
1184 (unsigned long) statbuf.st_uid,
1185 (unsigned long) statbuf.st_gid);
1186 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
1187 tprintf("st_blksize=%lu, ",
1188 (unsigned long) statbuf.st_blksize);
1189 #endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */
1190 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
1191 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
1192 #endif /* HAVE_STRUCT_STAT_ST_BLOCKS */
1195 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
1196 switch (statbuf.st_mode & S_IFMT) {
1197 case S_IFCHR: case S_IFBLK:
1198 #ifdef HAVE_STRUCT_STAT_ST_RDEV
1199 tprintf("st_rdev=makedev(%lu, %lu), ",
1200 (unsigned long) major(statbuf.st_rdev),
1201 (unsigned long) minor(statbuf.st_rdev));
1202 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
1203 tprintf("st_size=makedev(%lu, %lu), ",
1204 (unsigned long) major(statbuf.st_size),
1205 (unsigned long) minor(statbuf.st_size));
1206 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
1209 #ifdef HAVE_LONG_LONG
1210 tprintf("st_size=%llu, ", (unsigned long long) statbuf.st_size);
1212 tprintf("st_size=%lu, ", (unsigned long) statbuf.st_size);
1217 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
1218 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
1219 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
1220 #if HAVE_STRUCT_STAT_ST_FLAGS
1221 tprintf(", st_flags=");
1222 printflags(fileflags, statbuf.st_flags, "UF_???");
1224 #if HAVE_STRUCT_STAT_ST_ACLCNT
1225 tprintf(", st_aclcnt=%d", statbuf.st_aclcnt);
1227 #if HAVE_STRUCT_STAT_ST_LEVEL
1228 tprintf(", st_level=%ld", statbuf.st_level);
1230 #if HAVE_STRUCT_STAT_ST_FSTYPE
1231 tprintf(", st_fstype=%.*s",
1232 (int) sizeof statbuf.st_fstype, statbuf.st_fstype);
1234 #if HAVE_STRUCT_STAT_ST_GEN
1235 tprintf(", st_gen=%u", statbuf.st_gen);
1242 #endif /* HAVE_STAT64 */
1244 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1246 convertoldstat(const struct __old_kernel_stat *oldbuf, struct stat *newbuf)
1248 newbuf->st_dev = oldbuf->st_dev;
1249 newbuf->st_ino = oldbuf->st_ino;
1250 newbuf->st_mode = oldbuf->st_mode;
1251 newbuf->st_nlink = oldbuf->st_nlink;
1252 newbuf->st_uid = oldbuf->st_uid;
1253 newbuf->st_gid = oldbuf->st_gid;
1254 newbuf->st_rdev = oldbuf->st_rdev;
1255 newbuf->st_size = oldbuf->st_size;
1256 newbuf->st_atime = oldbuf->st_atime;
1257 newbuf->st_mtime = oldbuf->st_mtime;
1258 newbuf->st_ctime = oldbuf->st_ctime;
1259 newbuf->st_blksize = 0; /* not supported in old_stat */
1260 newbuf->st_blocks = 0; /* not supported in old_stat */
1265 printoldstat(struct tcb *tcp, long addr)
1267 struct __old_kernel_stat statbuf;
1268 struct stat newstatbuf;
1274 if (syserror(tcp) || !verbose(tcp)) {
1275 tprintf("%#lx", addr);
1280 if (current_personality == 1) {
1281 printstatsol(tcp, addr);
1284 #endif /* LINUXSPARC */
1286 if (umove(tcp, addr, &statbuf) < 0) {
1291 convertoldstat(&statbuf, &newstatbuf);
1292 realprintstat(tcp, &newstatbuf);
1294 #endif /* LINUX && !IA64 && !HPPA && !X86_64 && !S390 && !S390X */
1296 #ifndef HAVE_LONG_LONG_OFF_T
1298 sys_stat(struct tcb *tcp)
1300 if (entering(tcp)) {
1301 printpath(tcp, tcp->u_arg[0]);
1304 printstat(tcp, tcp->u_arg[1]);
1311 sys_stat64(struct tcb *tcp)
1314 if (entering(tcp)) {
1315 printpath(tcp, tcp->u_arg[0]);
1318 printstat64(tcp, tcp->u_arg[1]);
1322 return printargs(tcp);
1327 static const struct xlat fstatatflags[] = {
1328 #ifndef AT_SYMLINK_NOFOLLOW
1329 # define AT_SYMLINK_NOFOLLOW 0x100
1331 { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" },
1334 #define utimensatflags fstatatflags
1337 sys_newfstatat(struct tcb *tcp)
1339 if (entering(tcp)) {
1340 print_dirfd(tcp, tcp->u_arg[0]);
1341 printpath(tcp, tcp->u_arg[1]);
1345 if (current_personality == 0)
1346 printstat(tcp, tcp->u_arg[2]);
1348 printstat64(tcp, tcp->u_arg[2]);
1349 #elif defined HAVE_STAT64
1350 printstat64(tcp, tcp->u_arg[2]);
1352 printstat(tcp, tcp->u_arg[2]);
1355 printflags(fstatatflags, tcp->u_arg[3], "AT_???");
1361 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1363 sys_oldstat(struct tcb *tcp)
1365 if (entering(tcp)) {
1366 printpath(tcp, tcp->u_arg[0]);
1369 printoldstat(tcp, tcp->u_arg[1]);
1373 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1375 #ifndef HAVE_LONG_LONG_OFF_T
1377 sys_fstat(struct tcb *tcp)
1379 if (entering(tcp)) {
1380 printfd(tcp, tcp->u_arg[0]);
1383 printstat(tcp, tcp->u_arg[1]);
1390 sys_fstat64(struct tcb *tcp)
1393 if (entering(tcp)) {
1394 printfd(tcp, tcp->u_arg[0]);
1397 printstat64(tcp, tcp->u_arg[1]);
1401 return printargs(tcp);
1405 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1407 sys_oldfstat(struct tcb *tcp)
1409 if (entering(tcp)) {
1410 printfd(tcp, tcp->u_arg[0]);
1413 printoldstat(tcp, tcp->u_arg[1]);
1417 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1419 #ifndef HAVE_LONG_LONG_OFF_T
1421 sys_lstat(struct tcb *tcp)
1423 if (entering(tcp)) {
1424 printpath(tcp, tcp->u_arg[0]);
1427 printstat(tcp, tcp->u_arg[1]);
1434 sys_lstat64(struct tcb *tcp)
1437 if (entering(tcp)) {
1438 printpath(tcp, tcp->u_arg[0]);
1441 printstat64(tcp, tcp->u_arg[1]);
1445 return printargs(tcp);
1449 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1451 sys_oldlstat(struct tcb *tcp)
1453 if (entering(tcp)) {
1454 printpath(tcp, tcp->u_arg[0]);
1457 printoldstat(tcp, tcp->u_arg[1]);
1461 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1464 #if defined(SVR4) || defined(LINUXSPARC)
1467 sys_xstat(struct tcb *tcp)
1469 if (entering(tcp)) {
1470 tprintf("%ld, ", tcp->u_arg[0]);
1471 printpath(tcp, tcp->u_arg[1]);
1475 if (tcp->u_arg[0] == _STAT64_VER)
1476 printstat64 (tcp, tcp->u_arg[2]);
1479 printstat(tcp, tcp->u_arg[2]);
1485 sys_fxstat(struct tcb *tcp)
1488 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
1491 if (tcp->u_arg[0] == _STAT64_VER)
1492 printstat64 (tcp, tcp->u_arg[2]);
1495 printstat(tcp, tcp->u_arg[2]);
1501 sys_lxstat(struct tcb *tcp)
1503 if (entering(tcp)) {
1504 tprintf("%ld, ", tcp->u_arg[0]);
1505 printpath(tcp, tcp->u_arg[1]);
1509 if (tcp->u_arg[0] == _STAT64_VER)
1510 printstat64 (tcp, tcp->u_arg[2]);
1513 printstat(tcp, tcp->u_arg[2]);
1519 sys_xmknod(struct tcb *tcp)
1521 int mode = tcp->u_arg[2];
1523 if (entering(tcp)) {
1524 tprintf("%ld, ", tcp->u_arg[0]);
1525 printpath(tcp, tcp->u_arg[1]);
1526 tprintf(", %s", sprintmode(mode));
1527 switch (mode & S_IFMT) {
1528 case S_IFCHR: case S_IFBLK:
1530 tprintf(", makedev(%lu, %lu)",
1531 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
1532 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
1534 tprintf(", makedev(%lu, %lu)",
1535 (unsigned long) major(tcp->u_arg[3]),
1536 (unsigned long) minor(tcp->u_arg[3]));
1546 #ifdef HAVE_SYS_ACL_H
1548 #include <sys/acl.h>
1550 static const struct xlat aclcmds[] = {
1552 { SETACL, "SETACL" },
1555 { GETACL, "GETACL" },
1558 { GETACLCNT, "GETACLCNT" },
1561 { ACL_GET, "ACL_GET" },
1564 { ACL_SET, "ACL_SET" },
1567 { ACL_CNT, "ACL_CNT" },
1573 sys_acl(struct tcb *tcp)
1575 if (entering(tcp)) {
1576 printpath(tcp, tcp->u_arg[0]);
1578 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1579 tprintf(", %ld", tcp->u_arg[2]);
1581 * FIXME - dump out the list of aclent_t's pointed to
1582 * by "tcp->u_arg[3]" if it's not NULL.
1585 tprintf(", %#lx", tcp->u_arg[3]);
1594 sys_facl(struct tcb *tcp)
1596 if (entering(tcp)) {
1597 tprintf("%ld, ", tcp->u_arg[0]);
1598 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1599 tprintf(", %ld", tcp->u_arg[2]);
1601 * FIXME - dump out the list of aclent_t's pointed to
1602 * by "tcp->u_arg[3]" if it's not NULL.
1605 tprintf(", %#lx", tcp->u_arg[3]);
1613 static const struct xlat aclipc[] = {
1615 { IPC_SHM, "IPC_SHM" },
1618 { IPC_SEM, "IPC_SEM" },
1621 { IPC_MSG, "IPC_MSG" },
1628 sys_aclipc(struct tcb *tcp)
1630 if (entering(tcp)) {
1631 printxval(aclipc, tcp->u_arg[0], "???IPC???");
1632 tprintf(", %#lx, ", tcp->u_arg[1]);
1633 printxval(aclcmds, tcp->u_arg[2], "???ACL???");
1634 tprintf(", %ld", tcp->u_arg[3]);
1636 * FIXME - dump out the list of aclent_t's pointed to
1637 * by "tcp->u_arg[4]" if it's not NULL.
1640 tprintf(", %#lx", tcp->u_arg[4]);
1647 #endif /* HAVE_SYS_ACL_H */
1649 #endif /* SVR4 || LINUXSPARC */
1653 static const struct xlat fsmagic[] = {
1654 { 0x73757245, "CODA_SUPER_MAGIC" },
1655 { 0x012ff7b7, "COH_SUPER_MAGIC" },
1656 { 0x1373, "DEVFS_SUPER_MAGIC" },
1657 { 0x1cd1, "DEVPTS_SUPER_MAGIC" },
1658 { 0x414A53, "EFS_SUPER_MAGIC" },
1659 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
1660 { 0xef53, "EXT2_SUPER_MAGIC" },
1661 { 0x137d, "EXT_SUPER_MAGIC" },
1662 { 0xf995e849, "HPFS_SUPER_MAGIC" },
1663 { 0x9660, "ISOFS_SUPER_MAGIC" },
1664 { 0x137f, "MINIX_SUPER_MAGIC" },
1665 { 0x138f, "MINIX_SUPER_MAGIC2" },
1666 { 0x2468, "MINIX2_SUPER_MAGIC" },
1667 { 0x2478, "MINIX2_SUPER_MAGIC2" },
1668 { 0x4d44, "MSDOS_SUPER_MAGIC" },
1669 { 0x564c, "NCP_SUPER_MAGIC" },
1670 { 0x6969, "NFS_SUPER_MAGIC" },
1671 { 0x9fa0, "PROC_SUPER_MAGIC" },
1672 { 0x002f, "QNX4_SUPER_MAGIC" },
1673 { 0x52654973, "REISERFS_SUPER_MAGIC" },
1674 { 0x02011994, "SHMFS_SUPER_MAGIC" },
1675 { 0x517b, "SMB_SUPER_MAGIC" },
1676 { 0x012ff7b6, "SYSV2_SUPER_MAGIC" },
1677 { 0x012ff7b5, "SYSV4_SUPER_MAGIC" },
1678 { 0x00011954, "UFS_MAGIC" },
1679 { 0x54190100, "UFS_CIGAM" },
1680 { 0x012ff7b4, "XENIX_SUPER_MAGIC" },
1681 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
1682 { 0x62656572, "SYSFS_MAGIC" },
1691 sprintfstype(int magic)
1693 static char buf[32];
1697 s = xlookup(fsmagic, magic);
1699 sprintf(buf, "\"%s\"", s);
1703 sprintf(buf, "%#x", magic);
1708 printstatfs(struct tcb *tcp, long addr)
1710 struct statfs statbuf;
1712 if (syserror(tcp) || !verbose(tcp)) {
1713 tprintf("%#lx", addr);
1716 if (umove(tcp, addr, &statbuf) < 0) {
1722 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
1723 sprintfstype(statbuf.f_type),
1724 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
1725 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_fsid={%d, %d}, f_namelen=%u",
1726 statbuf.f_bavail, statbuf.f_files, statbuf.f_ffree,
1727 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1],
1730 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
1731 sprintfstype(statbuf.f_type),
1732 (unsigned long)statbuf.f_bsize,
1733 (unsigned long)statbuf.f_blocks,
1734 (unsigned long)statbuf.f_bfree);
1735 tprintf("f_bavail=%lu, f_files=%lu, f_ffree=%lu, f_fsid={%d, %d}",
1736 (unsigned long)statbuf.f_bavail,
1737 (unsigned long)statbuf.f_files,
1738 (unsigned long)statbuf.f_ffree,
1739 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1741 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1744 #ifdef _STATFS_F_FRSIZE
1745 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
1751 sys_statfs(struct tcb *tcp)
1753 if (entering(tcp)) {
1754 printpath(tcp, tcp->u_arg[0]);
1757 printstatfs(tcp, tcp->u_arg[1]);
1763 sys_fstatfs(struct tcb *tcp)
1765 if (entering(tcp)) {
1766 printfd(tcp, tcp->u_arg[0]);
1769 printstatfs(tcp, tcp->u_arg[1]);
1774 #if defined LINUX && defined HAVE_STATFS64
1776 printstatfs64(struct tcb *tcp, long addr)
1778 struct statfs64 statbuf;
1780 if (syserror(tcp) || !verbose(tcp)) {
1781 tprintf("%#lx", addr);
1784 if (umove(tcp, addr, &statbuf) < 0) {
1788 tprintf("{f_type=%s, f_bsize=%llu, f_blocks=%llu, f_bfree=%llu, ",
1789 sprintfstype(statbuf.f_type),
1790 (unsigned long long)statbuf.f_bsize,
1791 (unsigned long long)statbuf.f_blocks,
1792 (unsigned long long)statbuf.f_bfree);
1793 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
1794 (unsigned long long)statbuf.f_bavail,
1795 (unsigned long long)statbuf.f_files,
1796 (unsigned long long)statbuf.f_ffree,
1797 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1798 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1799 #ifdef _STATFS_F_FRSIZE
1800 tprintf(", f_frsize=%llu", (unsigned long long)statbuf.f_frsize);
1806 sys_statfs64(struct tcb *tcp)
1808 if (entering(tcp)) {
1809 printpath(tcp, tcp->u_arg[0]);
1810 tprintf(", %lu, ", tcp->u_arg[1]);
1812 if (tcp->u_arg[1] == sizeof(struct statfs64))
1813 printstatfs64(tcp, tcp->u_arg[2]);
1821 sys_fstatfs64(struct tcb *tcp)
1823 if (entering(tcp)) {
1824 printfd(tcp, tcp->u_arg[0]);
1825 tprintf(", %lu, ", tcp->u_arg[1]);
1827 if (tcp->u_arg[1] == sizeof(struct statfs64))
1828 printstatfs64(tcp, tcp->u_arg[2]);
1836 #if defined(LINUX) && defined(__alpha)
1839 osf_statfs(struct tcb *tcp)
1841 if (entering(tcp)) {
1842 printpath(tcp, tcp->u_arg[0]);
1845 printstatfs(tcp, tcp->u_arg[1]);
1846 tprintf(", %lu", tcp->u_arg[2]);
1852 osf_fstatfs(struct tcb *tcp)
1854 if (entering(tcp)) {
1855 tprintf("%lu, ", tcp->u_arg[0]);
1857 printstatfs(tcp, tcp->u_arg[1]);
1858 tprintf(", %lu", tcp->u_arg[2]);
1862 #endif /* LINUX && __alpha */
1868 sys_ustat(struct tcb *tcp)
1870 struct ustat statbuf;
1872 if (entering(tcp)) {
1873 tprintf("makedev(%lu, %lu), ",
1874 (long) major(tcp->u_arg[0]),
1875 (long) minor(tcp->u_arg[0]));
1878 if (syserror(tcp) || !verbose(tcp))
1879 tprintf("%#lx", tcp->u_arg[1]);
1880 else if (umove(tcp, tcp->u_arg[1], &statbuf) < 0)
1883 tprintf("{f_tfree=%lu, f_tinode=%lu, ",
1884 statbuf.f_tfree, statbuf.f_tinode);
1885 tprintf("f_fname=\"%.*s\", ",
1886 (int) sizeof(statbuf.f_fname),
1888 tprintf("f_fpack=\"%.*s\"}",
1889 (int) sizeof(statbuf.f_fpack),
1898 sys_pivotroot(struct tcb *tcp)
1900 if (entering(tcp)) {
1901 printpath(tcp, tcp->u_arg[0]);
1903 printpath(tcp, tcp->u_arg[1]);
1911 sys_chdir(struct tcb *tcp)
1913 if (entering(tcp)) {
1914 printpath(tcp, tcp->u_arg[0]);
1920 decode_mkdir(struct tcb *tcp, int offset)
1922 if (entering(tcp)) {
1923 printpath(tcp, tcp->u_arg[offset]);
1924 tprintf(", %#lo", tcp->u_arg[offset + 1]);
1930 sys_mkdir(struct tcb *tcp)
1932 return decode_mkdir(tcp, 0);
1937 sys_mkdirat(struct tcb *tcp)
1940 print_dirfd(tcp, tcp->u_arg[0]);
1941 return decode_mkdir(tcp, 1);
1946 sys_rmdir(struct tcb *tcp)
1948 if (entering(tcp)) {
1949 printpath(tcp, tcp->u_arg[0]);
1955 sys_fchdir(struct tcb *tcp)
1957 if (entering(tcp)) {
1958 printfd(tcp, tcp->u_arg[0]);
1964 sys_chroot(struct tcb *tcp)
1966 if (entering(tcp)) {
1967 printpath(tcp, tcp->u_arg[0]);
1972 #if defined(SUNOS4) || defined(SVR4)
1974 sys_fchroot(struct tcb *tcp)
1976 if (entering(tcp)) {
1977 printfd(tcp, tcp->u_arg[0]);
1981 #endif /* SUNOS4 || SVR4 */
1984 sys_link(struct tcb *tcp)
1986 if (entering(tcp)) {
1987 printpath(tcp, tcp->u_arg[0]);
1989 printpath(tcp, tcp->u_arg[1]);
1996 sys_linkat(struct tcb *tcp)
1998 if (entering(tcp)) {
1999 print_dirfd(tcp, tcp->u_arg[0]);
2000 printpath(tcp, tcp->u_arg[1]);
2002 print_dirfd(tcp, tcp->u_arg[2]);
2003 printpath(tcp, tcp->u_arg[3]);
2005 printfd(tcp, tcp->u_arg[4]);
2012 sys_unlink(struct tcb *tcp)
2014 if (entering(tcp)) {
2015 printpath(tcp, tcp->u_arg[0]);
2021 static const struct xlat unlinkatflags[] = {
2022 #ifndef AT_REMOVEDIR
2023 # define AT_REMOVEDIR 0x200
2025 { AT_REMOVEDIR, "AT_REMOVEDIR" },
2030 sys_unlinkat(struct tcb *tcp)
2032 if (entering(tcp)) {
2033 print_dirfd(tcp, tcp->u_arg[0]);
2034 printpath(tcp, tcp->u_arg[1]);
2036 printflags(unlinkatflags, tcp->u_arg[2], "AT_???");
2043 sys_symlink(struct tcb *tcp)
2045 if (entering(tcp)) {
2046 printpath(tcp, tcp->u_arg[0]);
2048 printpath(tcp, tcp->u_arg[1]);
2055 sys_symlinkat(struct tcb *tcp)
2057 if (entering(tcp)) {
2058 printpath(tcp, tcp->u_arg[0]);
2060 print_dirfd(tcp, tcp->u_arg[1]);
2061 printpath(tcp, tcp->u_arg[2]);
2068 decode_readlink(struct tcb *tcp, int offset)
2070 if (entering(tcp)) {
2071 printpath(tcp, tcp->u_arg[offset]);
2075 tprintf("%#lx", tcp->u_arg[offset + 1]);
2077 printpathn(tcp, tcp->u_arg[offset + 1], tcp->u_rval);
2078 tprintf(", %lu", tcp->u_arg[offset + 2]);
2084 sys_readlink(struct tcb *tcp)
2086 return decode_readlink(tcp, 0);
2091 sys_readlinkat(struct tcb *tcp)
2094 print_dirfd(tcp, tcp->u_arg[0]);
2095 return decode_readlink(tcp, 1);
2100 sys_rename(struct tcb *tcp)
2102 if (entering(tcp)) {
2103 printpath(tcp, tcp->u_arg[0]);
2105 printpath(tcp, tcp->u_arg[1]);
2112 sys_renameat(struct tcb *tcp)
2114 if (entering(tcp)) {
2115 print_dirfd(tcp, tcp->u_arg[0]);
2116 printpath(tcp, tcp->u_arg[1]);
2118 print_dirfd(tcp, tcp->u_arg[2]);
2119 printpath(tcp, tcp->u_arg[3]);
2126 sys_chown(struct tcb *tcp)
2128 if (entering(tcp)) {
2129 printpath(tcp, tcp->u_arg[0]);
2130 printuid(", ", tcp->u_arg[1]);
2131 printuid(", ", tcp->u_arg[2]);
2138 sys_fchownat(struct tcb *tcp)
2140 if (entering(tcp)) {
2141 print_dirfd(tcp, tcp->u_arg[0]);
2142 printpath(tcp, tcp->u_arg[1]);
2143 printuid(", ", tcp->u_arg[2]);
2144 printuid(", ", tcp->u_arg[3]);
2146 printflags(fstatatflags, tcp->u_arg[4], "AT_???");
2153 sys_fchown(struct tcb *tcp)
2155 if (entering(tcp)) {
2156 printfd(tcp, tcp->u_arg[0]);
2157 printuid(", ", tcp->u_arg[1]);
2158 printuid(", ", tcp->u_arg[2]);
2164 decode_chmod(struct tcb *tcp, int offset)
2166 if (entering(tcp)) {
2167 printpath(tcp, tcp->u_arg[offset]);
2168 tprintf(", %#lo", tcp->u_arg[offset + 1]);
2174 sys_chmod(struct tcb *tcp)
2176 return decode_chmod(tcp, 0);
2181 sys_fchmodat(struct tcb *tcp)
2184 print_dirfd(tcp, tcp->u_arg[0]);
2185 return decode_chmod(tcp, 1);
2190 sys_fchmod(struct tcb *tcp)
2192 if (entering(tcp)) {
2193 printfd(tcp, tcp->u_arg[0]);
2194 tprintf(", %#lo", tcp->u_arg[1]);
2201 sys_osf_utimes(struct tcb *tcp)
2203 if (entering(tcp)) {
2204 printpath(tcp, tcp->u_arg[0]);
2206 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
2213 decode_utimes(struct tcb *tcp, int offset, int special)
2215 if (entering(tcp)) {
2216 printpath(tcp, tcp->u_arg[offset]);
2218 if (tcp->u_arg[offset + 1] == 0)
2222 printtv_bitness(tcp, tcp->u_arg[offset + 1],
2223 BITNESS_CURRENT, special);
2225 printtv_bitness(tcp, tcp->u_arg[offset + 1]
2226 + sizeof(struct timeval),
2227 BITNESS_CURRENT, special);
2235 sys_utimes(struct tcb *tcp)
2237 return decode_utimes(tcp, 0, 0);
2242 sys_futimesat(struct tcb *tcp)
2245 print_dirfd(tcp, tcp->u_arg[0]);
2246 return decode_utimes(tcp, 1, 0);
2250 sys_utimensat(struct tcb *tcp)
2252 if (entering(tcp)) {
2253 print_dirfd(tcp, tcp->u_arg[0]);
2254 decode_utimes(tcp, 1, 1);
2256 printflags(utimensatflags, tcp->u_arg[3], "AT_???");
2263 sys_utime(struct tcb *tcp)
2270 if (entering(tcp)) {
2271 printpath(tcp, tcp->u_arg[0]);
2275 else if (!verbose(tcp))
2276 tprintf("%#lx", tcp->u_arg[1]);
2277 else if (umoven(tcp, tcp->u_arg[1],
2278 2 * personality_wordsize[current_personality],
2281 else if (personality_wordsize[current_personality]
2282 == sizeof u.utl[0]) {
2283 tprintf("[%s,", sprinttime(u.utl[0]));
2284 tprintf(" %s]", sprinttime(u.utl[1]));
2286 else if (personality_wordsize[current_personality]
2287 == sizeof u.uti[0]) {
2288 tprintf("[%s,", sprinttime(u.uti[0]));
2289 tprintf(" %s]", sprinttime(u.uti[1]));
2298 decode_mknod(struct tcb *tcp, int offset)
2300 int mode = tcp->u_arg[offset + 1];
2302 if (entering(tcp)) {
2303 printpath(tcp, tcp->u_arg[offset]);
2304 tprintf(", %s", sprintmode(mode));
2305 switch (mode & S_IFMT) {
2306 case S_IFCHR: case S_IFBLK:
2308 if (current_personality == 1)
2309 tprintf(", makedev(%lu, %lu)",
2310 (unsigned long) ((tcp->u_arg[offset + 2] >> 18) & 0x3fff),
2311 (unsigned long) (tcp->u_arg[offset + 2] & 0x3ffff));
2314 tprintf(", makedev(%lu, %lu)",
2315 (unsigned long) major(tcp->u_arg[offset + 2]),
2316 (unsigned long) minor(tcp->u_arg[offset + 2]));
2326 sys_mknod(struct tcb *tcp)
2328 return decode_mknod(tcp, 0);
2333 sys_mknodat(struct tcb *tcp)
2336 print_dirfd(tcp, tcp->u_arg[0]);
2337 return decode_mknod(tcp, 1);
2343 sys_mkfifo(struct tcb *tcp)
2345 if (entering(tcp)) {
2346 printpath(tcp, tcp->u_arg[0]);
2347 tprintf(", %#lo", tcp->u_arg[1]);
2351 #endif /* FREEBSD */
2354 sys_fsync(struct tcb *tcp)
2356 if (entering(tcp)) {
2357 printfd(tcp, tcp->u_arg[0]);
2365 printdir(struct tcb *tcp, long addr)
2369 if (!verbose(tcp)) {
2370 tprintf("%#lx", addr);
2373 if (umove(tcp, addr, &d) < 0) {
2377 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
2379 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
2384 sys_readdir(struct tcb *tcp)
2386 if (entering(tcp)) {
2387 printfd(tcp, tcp->u_arg[0]);
2390 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
2391 tprintf("%#lx", tcp->u_arg[1]);
2393 printdir(tcp, tcp->u_arg[1]);
2394 /* Not much point in printing this out, it is always 1. */
2395 if (tcp->u_arg[2] != 1)
2396 tprintf(", %lu", tcp->u_arg[2]);
2403 #if defined FREEBSD || defined LINUX
2404 static const struct xlat direnttypes[] = {
2405 { DT_UNKNOWN, "DT_UNKNOWN" },
2406 { DT_FIFO, "DT_FIFO" },
2407 { DT_CHR, "DT_CHR" },
2408 { DT_DIR, "DT_DIR" },
2409 { DT_BLK, "DT_BLK" },
2410 { DT_REG, "DT_REG" },
2411 { DT_LNK, "DT_LNK" },
2412 { DT_SOCK, "DT_SOCK" },
2413 { DT_WHT, "DT_WHT" },
2420 sys_getdents(struct tcb *tcp)
2422 int i, len, dents = 0;
2425 if (entering(tcp)) {
2426 printfd(tcp, tcp->u_arg[0]);
2430 if (syserror(tcp) || !verbose(tcp)) {
2431 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2435 buf = len ? malloc(len) : NULL;
2437 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2438 fprintf(stderr, "out of memory\n");
2441 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2442 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2448 for (i = 0; i < len;) {
2449 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
2452 tprintf("%s{d_ino=%lu, d_off=%lu, ",
2453 i ? " " : "", d->d_ino, d->d_off);
2454 tprintf("d_reclen=%u, d_name=\"%s\"}",
2455 d->d_reclen, d->d_name);
2460 tprintf("%s{d_ino=%lu, d_off=%lu, ",
2462 (unsigned long) d->d_ino,
2463 (unsigned long) d->d_off);
2464 tprintf("d_reclen=%u, d_name=\"%s\"}",
2465 d->d_reclen, d->d_name);
2470 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
2471 i ? " " : "", d->d_off, d->d_fileno,
2473 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
2474 d->d_namlen, d->d_namlen, d->d_name);
2479 tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
2480 i ? " " : "", d->d_fileno, d->d_reclen);
2481 printxval(direnttypes, d->d_type, "DT_???");
2482 tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
2483 d->d_namlen, d->d_namlen, d->d_name);
2485 #endif /* FREEBSD */
2487 tprintf("/* d_reclen == 0, problem here */");
2496 tprintf("/* %u entries */", dents);
2497 tprintf(", %lu", tcp->u_arg[2]);
2503 #if _LFS64_LARGEFILE
2505 sys_getdents64(struct tcb *tcp)
2507 int i, len, dents = 0;
2510 if (entering(tcp)) {
2511 printfd(tcp, tcp->u_arg[0]);
2515 if (syserror(tcp) || !verbose(tcp)) {
2516 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2520 buf = len ? malloc(len) : NULL;
2522 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2523 fprintf(stderr, "out of memory\n");
2526 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2527 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2533 for (i = 0; i < len;) {
2534 struct dirent64 *d = (struct dirent64 *) &buf[i];
2535 #if defined(LINUX) || defined(SVR4)
2537 tprintf("%s{d_ino=%" PRIu64 ", d_off=%" PRId64 ", ",
2543 printxval(direnttypes, d->d_type, "DT_???");
2546 tprintf("d_reclen=%u, d_name=\"%s\"}",
2547 d->d_reclen, d->d_name);
2549 #endif /* LINUX || SVR4 */
2552 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
2553 i ? " " : "", d->d_off, d->d_fileno,
2555 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
2556 d->d_namlen, d->d_namlen, d->d_name);
2560 tprintf("/* d_reclen == 0, problem here */");
2569 tprintf("/* %u entries */", dents);
2570 tprintf(", %lu", tcp->u_arg[2]);
2578 sys_getdirentries(struct tcb *tcp)
2580 int i, len, dents = 0;
2584 if (entering(tcp)) {
2585 printfd(tcp, tcp->u_arg[0]);
2589 if (syserror(tcp) || !verbose(tcp)) {
2590 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2596 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2597 fprintf(stderr, "out of memory\n");
2600 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2601 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2607 for (i = 0; i < len;) {
2608 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
2610 tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
2611 i ? " " : "", d->d_fileno, d->d_reclen);
2612 printxval(direnttypes, d->d_type, "DT_???");
2613 tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
2614 d->d_namlen, d->d_namlen, d->d_name);
2617 tprintf("/* d_reclen == 0, problem here */");
2626 tprintf("/* %u entries */", dents);
2628 tprintf(", %lu", tcp->u_arg[2]);
2629 if (umove(tcp, tcp->u_arg[3], &basep) < 0)
2630 tprintf(", %#lx", tcp->u_arg[3]);
2632 tprintf(", [%lu]", basep);
2639 sys_getcwd(struct tcb *tcp)
2643 tprintf("%#lx", tcp->u_arg[0]);
2645 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
2646 tprintf(", %lu", tcp->u_arg[1]);
2654 sys___getcwd(struct tcb *tcp)
2658 tprintf("%#lx", tcp->u_arg[0]);
2660 printpathn(tcp, tcp->u_arg[0], tcp->u_arg[1]);
2661 tprintf(", %lu", tcp->u_arg[1]);
2667 #ifdef HAVE_SYS_ASYNCH_H
2670 sys_aioread(struct tcb *tcp)
2672 struct aio_result_t res;
2674 if (entering(tcp)) {
2675 tprintf("%lu, ", tcp->u_arg[0]);
2678 tprintf("%#lx", tcp->u_arg[1]);
2680 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2681 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2682 printxval(whence, tcp->u_arg[4], "L_???");
2683 if (syserror(tcp) || tcp->u_arg[5] == 0
2684 || umove(tcp, tcp->u_arg[5], &res) < 0)
2685 tprintf(", %#lx", tcp->u_arg[5]);
2687 tprintf(", {aio_return %d aio_errno %d}",
2688 res.aio_return, res.aio_errno);
2694 sys_aiowrite(struct tcb *tcp)
2696 struct aio_result_t res;
2698 if (entering(tcp)) {
2699 tprintf("%lu, ", tcp->u_arg[0]);
2700 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2701 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2702 printxval(whence, tcp->u_arg[4], "L_???");
2705 if (tcp->u_arg[5] == 0)
2707 else if (syserror(tcp)
2708 || umove(tcp, tcp->u_arg[5], &res) < 0)
2709 tprintf(", %#lx", tcp->u_arg[5]);
2711 tprintf(", {aio_return %d aio_errno %d}",
2712 res.aio_return, res.aio_errno);
2718 sys_aiowait(struct tcb *tcp)
2721 printtv(tcp, tcp->u_arg[0]);
2726 sys_aiocancel(struct tcb *tcp)
2728 struct aio_result_t res;
2731 if (tcp->u_arg[0] == 0)
2733 else if (syserror(tcp)
2734 || umove(tcp, tcp->u_arg[0], &res) < 0)
2735 tprintf("%#lx", tcp->u_arg[0]);
2737 tprintf("{aio_return %d aio_errno %d}",
2738 res.aio_return, res.aio_errno);
2743 #endif /* HAVE_SYS_ASYNCH_H */
2745 static const struct xlat xattrflags[] = {
2747 { XATTR_CREATE, "XATTR_CREATE" },
2748 { XATTR_REPLACE, "XATTR_REPLACE" },
2754 print_xattr_val(struct tcb *tcp, int failed,
2756 unsigned long insize,
2760 unsigned long capacity = 4 * size + 1;
2761 unsigned char *buf = (capacity < size) ? NULL : malloc(capacity);
2762 if (buf == NULL || /* probably a bogus size argument */
2763 umoven(tcp, arg, size, (char *) &buf[3 * size]) < 0) {
2767 unsigned char *out = buf;
2768 unsigned char *in = &buf[3 * size];
2770 for (i = 0; i < size; ++i) {
2774 #define tohex(n) "0123456789abcdef"[n]
2777 *out++ = tohex(in[i] / 16);
2778 *out++ = tohex(in[i] % 16);
2781 /* Don't print terminating NUL if there is one. */
2782 if (i > 0 && in[i - 1] == '\0')
2785 tprintf(", \"%s\", %ld", buf, insize);
2790 tprintf(", 0x%lx, %ld", arg, insize);
2794 sys_setxattr(struct tcb *tcp)
2796 if (entering(tcp)) {
2797 printpath(tcp, tcp->u_arg[0]);
2799 printstr(tcp, tcp->u_arg[1], -1);
2800 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2802 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2808 sys_fsetxattr(struct tcb *tcp)
2810 if (entering(tcp)) {
2811 printfd(tcp, tcp->u_arg[0]);
2813 printstr(tcp, tcp->u_arg[1], -1);
2814 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2816 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2822 sys_getxattr(struct tcb *tcp)
2824 if (entering(tcp)) {
2825 printpath(tcp, tcp->u_arg[0]);
2827 printstr(tcp, tcp->u_arg[1], -1);
2829 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2836 sys_fgetxattr(struct tcb *tcp)
2838 if (entering(tcp)) {
2839 printfd(tcp, tcp->u_arg[0]);
2841 printstr(tcp, tcp->u_arg[1], -1);
2843 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2850 sys_listxattr(struct tcb *tcp)
2852 if (entering(tcp)) {
2853 printpath(tcp, tcp->u_arg[0]);
2855 /* XXX Print value in format */
2856 tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]);
2862 sys_flistxattr(struct tcb *tcp)
2864 if (entering(tcp)) {
2865 printfd(tcp, tcp->u_arg[0]);
2867 /* XXX Print value in format */
2868 tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]);
2874 sys_removexattr(struct tcb *tcp)
2876 if (entering(tcp)) {
2877 printpath(tcp, tcp->u_arg[0]);
2879 printstr(tcp, tcp->u_arg[1], -1);
2885 sys_fremovexattr(struct tcb *tcp)
2887 if (entering(tcp)) {
2888 printfd(tcp, tcp->u_arg[0]);
2890 printstr(tcp, tcp->u_arg[1], -1);
2896 static const struct xlat advise[] = {
2897 { POSIX_FADV_NORMAL, "POSIX_FADV_NORMAL" },
2898 { POSIX_FADV_RANDOM, "POSIX_FADV_RANDOM" },
2899 { POSIX_FADV_SEQUENTIAL, "POSIX_FADV_SEQUENTIAL" },
2900 { POSIX_FADV_WILLNEED, "POSIX_FADV_WILLNEED" },
2901 { POSIX_FADV_DONTNEED, "POSIX_FADV_DONTNEED" },
2902 { POSIX_FADV_NOREUSE, "POSIX_FADV_NOREUSE" },
2909 sys_fadvise64(struct tcb *tcp)
2911 if (entering(tcp)) {
2913 printfd(tcp, tcp->u_arg[0]);
2915 argn = printllval(tcp, "%lld", 1);
2916 tprintf(", %ld, ", tcp->u_arg[argn++]);
2917 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2925 sys_fadvise64_64(struct tcb *tcp)
2927 if (entering(tcp)) {
2929 printfd(tcp, tcp->u_arg[0]);
2931 #if defined ARM || defined POWERPC
2932 argn = printllval(tcp, "%lld, ", 2);
2934 argn = printllval(tcp, "%lld, ", 1);
2936 argn = printllval(tcp, "%lld, ", argn);
2937 #if defined ARM || defined POWERPC
2938 printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
2940 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2947 static const struct xlat inotify_modes[] = {
2948 { 0x00000001, "IN_ACCESS" },
2949 { 0x00000002, "IN_MODIFY" },
2950 { 0x00000004, "IN_ATTRIB" },
2951 { 0x00000008, "IN_CLOSE_WRITE"},
2952 { 0x00000010, "IN_CLOSE_NOWRITE"},
2953 { 0x00000020, "IN_OPEN" },
2954 { 0x00000040, "IN_MOVED_FROM" },
2955 { 0x00000080, "IN_MOVED_TO" },
2956 { 0x00000100, "IN_CREATE" },
2957 { 0x00000200, "IN_DELETE" },
2958 { 0x00000400, "IN_DELETE_SELF"},
2959 { 0x00000800, "IN_MOVE_SELF" },
2960 { 0x00002000, "IN_UNMOUNT" },
2961 { 0x00004000, "IN_Q_OVERFLOW" },
2962 { 0x00008000, "IN_IGNORED" },
2963 { 0x01000000, "IN_ONLYDIR" },
2964 { 0x02000000, "IN_DONT_FOLLOW"},
2965 { 0x20000000, "IN_MASK_ADD" },
2966 { 0x40000000, "IN_ISDIR" },
2967 { 0x80000000, "IN_ONESHOT" },
2971 static const struct xlat inotify_init_flags[] = {
2972 { 0x00000800, "IN_NONBLOCK" },
2973 { 0x00080000, "IN_CLOEXEC" },
2978 sys_inotify_add_watch(struct tcb *tcp)
2980 if (entering(tcp)) {
2981 printfd(tcp, tcp->u_arg[0]);
2983 printpath(tcp, tcp->u_arg[1]);
2985 printflags(inotify_modes, tcp->u_arg[2], "IN_???");
2991 sys_inotify_rm_watch(struct tcb *tcp)
2993 if (entering(tcp)) {
2994 printfd(tcp, tcp->u_arg[0]);
2995 tprintf(", %ld", tcp->u_arg[1]);
3001 sys_inotify_init1(struct tcb *tcp)
3004 printflags(inotify_init_flags, tcp->u_arg[0], "IN_???");
3009 sys_fallocate(struct tcb *tcp)
3011 if (entering(tcp)) {
3013 printfd(tcp, tcp->u_arg[0]); /* fd */
3015 tprintf("%#lo, ", tcp->u_arg[1]); /* mode */
3016 argn = printllval(tcp, "%llu, ", 2); /* offset */
3017 printllval(tcp, "%llu", argn); /* len */