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;
741 if ((tmp = localtime(&t)))
742 snprintf(buf, sizeof buf, "%02d/%02d/%02d-%02d:%02d:%02d",
743 tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
744 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
746 snprintf(buf, sizeof buf, "%lu", (unsigned long) t);
759 int st_pad1[3]; /* network id */
768 int st_pad3; /* st_size, off_t expansion */
769 timestruct_t st_atime;
770 timestruct_t st_mtime;
771 timestruct_t st_ctime;
775 int st_pad4[8]; /* expansion area */
779 printstatsol(struct tcb *tcp, long addr)
781 struct solstat statbuf;
783 if (umove(tcp, addr, &statbuf) < 0) {
788 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
789 (unsigned long) ((statbuf.st_dev >> 18) & 0x3fff),
790 (unsigned long) (statbuf.st_dev & 0x3ffff),
791 (unsigned long) statbuf.st_ino,
792 sprintmode(statbuf.st_mode));
793 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
794 (unsigned long) statbuf.st_nlink,
795 (unsigned long) statbuf.st_uid,
796 (unsigned long) statbuf.st_gid);
797 tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);
798 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
801 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
802 switch (statbuf.st_mode & S_IFMT) {
803 case S_IFCHR: case S_IFBLK:
804 tprintf("st_rdev=makedev(%lu, %lu), ",
805 (unsigned long) ((statbuf.st_rdev >> 18) & 0x3fff),
806 (unsigned long) (statbuf.st_rdev & 0x3ffff));
809 tprintf("st_size=%u, ", statbuf.st_size);
813 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime.tv_sec));
814 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime.tv_sec));
815 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime.tv_sec));
821 #if defined (SPARC64)
823 printstat_sparc64(struct tcb *tcp, long addr)
825 struct stat_sparc64 statbuf;
827 if (umove(tcp, addr, &statbuf) < 0) {
833 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
834 (unsigned long) major(statbuf.st_dev),
835 (unsigned long) minor(statbuf.st_dev),
836 (unsigned long) statbuf.st_ino,
837 sprintmode(statbuf.st_mode));
838 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
839 (unsigned long) statbuf.st_nlink,
840 (unsigned long) statbuf.st_uid,
841 (unsigned long) statbuf.st_gid);
842 tprintf("st_blksize=%lu, ",
843 (unsigned long) statbuf.st_blksize);
844 tprintf("st_blocks=%lu, ",
845 (unsigned long) statbuf.st_blocks);
848 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
849 switch (statbuf.st_mode & S_IFMT) {
850 case S_IFCHR: case S_IFBLK:
851 tprintf("st_rdev=makedev(%lu, %lu), ",
852 (unsigned long) major(statbuf.st_rdev),
853 (unsigned long) minor(statbuf.st_rdev));
856 tprintf("st_size=%lu, ", statbuf.st_size);
860 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
861 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
862 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
869 #endif /* LINUXSPARC */
871 #if defined LINUX && defined POWERPC64
872 struct stat_powerpc32 {
875 unsigned int st_mode;
876 unsigned short st_nlink;
879 unsigned int st_rdev;
880 unsigned int st_size;
881 unsigned int st_blksize;
882 unsigned int st_blocks;
883 unsigned int st_atime;
884 unsigned int st_atime_nsec;
885 unsigned int st_mtime;
886 unsigned int st_mtime_nsec;
887 unsigned int st_ctime;
888 unsigned int st_ctime_nsec;
889 unsigned int __unused4;
890 unsigned int __unused5;
894 printstat_powerpc32(struct tcb *tcp, long addr)
896 struct stat_powerpc32 statbuf;
898 if (umove(tcp, addr, &statbuf) < 0) {
904 tprintf("{st_dev=makedev(%u, %u), st_ino=%u, st_mode=%s, ",
905 major(statbuf.st_dev), minor(statbuf.st_dev),
907 sprintmode(statbuf.st_mode));
908 tprintf("st_nlink=%u, st_uid=%u, st_gid=%u, ",
909 statbuf.st_nlink, statbuf.st_uid, statbuf.st_gid);
910 tprintf("st_blksize=%u, ", statbuf.st_blksize);
911 tprintf("st_blocks=%u, ", statbuf.st_blocks);
914 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
915 switch (statbuf.st_mode & S_IFMT) {
916 case S_IFCHR: case S_IFBLK:
917 tprintf("st_rdev=makedev(%lu, %lu), ",
918 (unsigned long) major(statbuf.st_rdev),
919 (unsigned long) minor(statbuf.st_rdev));
922 tprintf("st_size=%u, ", statbuf.st_size);
926 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
927 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
928 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
934 #endif /* LINUX && POWERPC64 */
936 static const struct xlat fileflags[] = {
938 { UF_NODUMP, "UF_NODUMP" },
939 { UF_IMMUTABLE, "UF_IMMUTABLE" },
940 { UF_APPEND, "UF_APPEND" },
941 { UF_OPAQUE, "UF_OPAQUE" },
942 { UF_NOUNLINK, "UF_NOUNLINK" },
943 { SF_ARCHIVED, "SF_ARCHIVED" },
944 { SF_IMMUTABLE, "SF_IMMUTABLE" },
945 { SF_APPEND, "SF_APPEND" },
946 { SF_NOUNLINK, "SF_NOUNLINK" },
949 { _S_ISMLD, "_S_ISMLD" },
952 { _S_ISMOUNTED, "_S_ISMOUNTED" },
960 sys_chflags(struct tcb *tcp)
963 printpath(tcp, tcp->u_arg[0]);
965 printflags(fileflags, tcp->u_arg[1], "UF_???");
971 sys_fchflags(struct tcb *tcp)
974 tprintf("%ld, ", tcp->u_arg[0]);
975 printflags(fileflags, tcp->u_arg[1], "UF_???");
981 #ifndef HAVE_LONG_LONG_OFF_T
983 realprintstat(struct tcb *tcp, struct stat *statbuf)
986 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
987 (unsigned long) major(statbuf->st_dev),
988 (unsigned long) minor(statbuf->st_dev),
989 (unsigned long) statbuf->st_ino,
990 sprintmode(statbuf->st_mode));
991 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
992 (unsigned long) statbuf->st_nlink,
993 (unsigned long) statbuf->st_uid,
994 (unsigned long) statbuf->st_gid);
995 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
996 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
998 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
999 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
1003 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
1004 switch (statbuf->st_mode & S_IFMT) {
1005 case S_IFCHR: case S_IFBLK:
1006 #ifdef HAVE_STRUCT_STAT_ST_RDEV
1007 tprintf("st_rdev=makedev(%lu, %lu), ",
1008 (unsigned long) major(statbuf->st_rdev),
1009 (unsigned long) minor(statbuf->st_rdev));
1010 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
1011 tprintf("st_size=makedev(%lu, %lu), ",
1012 (unsigned long) major(statbuf->st_size),
1013 (unsigned long) minor(statbuf->st_size));
1014 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
1017 tprintf("st_size=%lu, ", (unsigned long) statbuf->st_size);
1021 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
1022 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
1023 tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));
1024 #if HAVE_STRUCT_STAT_ST_FLAGS
1025 tprintf(", st_flags=");
1026 printflags(fileflags, statbuf->st_flags, "UF_???");
1028 #if HAVE_STRUCT_STAT_ST_ACLCNT
1029 tprintf(", st_aclcnt=%d", statbuf->st_aclcnt);
1031 #if HAVE_STRUCT_STAT_ST_LEVEL
1032 tprintf(", st_level=%ld", statbuf->st_level);
1034 #if HAVE_STRUCT_STAT_ST_FSTYPE
1035 tprintf(", st_fstype=%.*s",
1036 (int) sizeof statbuf->st_fstype, statbuf->st_fstype);
1038 #if HAVE_STRUCT_STAT_ST_GEN
1039 tprintf(", st_gen=%u", statbuf->st_gen);
1049 printstat(struct tcb *tcp, long addr)
1051 struct stat statbuf;
1057 if (syserror(tcp) || !verbose(tcp)) {
1058 tprintf("%#lx", addr);
1063 if (current_personality == 1) {
1064 printstatsol(tcp, addr);
1068 else if (current_personality == 2) {
1069 printstat_sparc64(tcp, addr);
1073 #endif /* LINUXSPARC */
1075 #if defined LINUX && defined POWERPC64
1076 if (current_personality == 1) {
1077 printstat_powerpc32(tcp, addr);
1082 if (umove(tcp, addr, &statbuf) < 0) {
1087 realprintstat(tcp, &statbuf);
1089 #endif /* !HAVE_LONG_LONG_OFF_T */
1091 #if !defined HAVE_STAT64 && defined LINUX && defined X86_64
1093 * Linux x86_64 has unified `struct stat' but its i386 biarch needs
1094 * `struct stat64'. Its <asm-i386/stat.h> definition expects 32-bit `long'.
1095 * <linux/include/asm-x86_64/ia32.h> is not in the public includes set.
1096 * __GNUC__ is needed for the required __attribute__ below.
1099 unsigned long long st_dev;
1100 unsigned char __pad0[4];
1101 unsigned int __st_ino;
1102 unsigned int st_mode;
1103 unsigned int st_nlink;
1104 unsigned int st_uid;
1105 unsigned int st_gid;
1106 unsigned long long st_rdev;
1107 unsigned char __pad3[4];
1109 unsigned int st_blksize;
1110 unsigned long long st_blocks;
1111 unsigned int st_atime;
1112 unsigned int st_atime_nsec;
1113 unsigned int st_mtime;
1114 unsigned int st_mtime_nsec;
1115 unsigned int st_ctime;
1116 unsigned int st_ctime_nsec;
1117 unsigned long long st_ino;
1118 } __attribute__((packed));
1119 # define HAVE_STAT64 1
1120 # define STAT64_SIZE 96
1125 printstat64(struct tcb *tcp, long addr)
1127 struct stat64 statbuf;
1130 (void) sizeof(char[sizeof statbuf == STAT64_SIZE ? 1 : -1]);
1137 if (syserror(tcp) || !verbose(tcp)) {
1138 tprintf("%#lx", addr);
1143 if (current_personality == 1) {
1144 printstatsol(tcp, addr);
1148 else if (current_personality == 2) {
1149 printstat_sparc64(tcp, addr);
1153 #endif /* LINUXSPARC */
1155 #if defined LINUX && defined X86_64
1156 if (current_personality == 0) {
1157 printstat(tcp, addr);
1162 if (umove(tcp, addr, &statbuf) < 0) {
1168 #ifdef HAVE_LONG_LONG
1169 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
1171 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
1173 (unsigned long) major(statbuf.st_dev),
1174 (unsigned long) minor(statbuf.st_dev),
1175 #ifdef HAVE_LONG_LONG
1176 (unsigned long long) statbuf.st_ino,
1178 (unsigned long) statbuf.st_ino,
1180 sprintmode(statbuf.st_mode));
1181 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
1182 (unsigned long) statbuf.st_nlink,
1183 (unsigned long) statbuf.st_uid,
1184 (unsigned long) statbuf.st_gid);
1185 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
1186 tprintf("st_blksize=%lu, ",
1187 (unsigned long) statbuf.st_blksize);
1188 #endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */
1189 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
1190 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
1191 #endif /* HAVE_STRUCT_STAT_ST_BLOCKS */
1194 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
1195 switch (statbuf.st_mode & S_IFMT) {
1196 case S_IFCHR: case S_IFBLK:
1197 #ifdef HAVE_STRUCT_STAT_ST_RDEV
1198 tprintf("st_rdev=makedev(%lu, %lu), ",
1199 (unsigned long) major(statbuf.st_rdev),
1200 (unsigned long) minor(statbuf.st_rdev));
1201 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
1202 tprintf("st_size=makedev(%lu, %lu), ",
1203 (unsigned long) major(statbuf.st_size),
1204 (unsigned long) minor(statbuf.st_size));
1205 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
1208 #ifdef HAVE_LONG_LONG
1209 tprintf("st_size=%llu, ", (unsigned long long) statbuf.st_size);
1211 tprintf("st_size=%lu, ", (unsigned long) statbuf.st_size);
1216 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
1217 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
1218 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
1219 #if HAVE_STRUCT_STAT_ST_FLAGS
1220 tprintf(", st_flags=");
1221 printflags(fileflags, statbuf.st_flags, "UF_???");
1223 #if HAVE_STRUCT_STAT_ST_ACLCNT
1224 tprintf(", st_aclcnt=%d", statbuf.st_aclcnt);
1226 #if HAVE_STRUCT_STAT_ST_LEVEL
1227 tprintf(", st_level=%ld", statbuf.st_level);
1229 #if HAVE_STRUCT_STAT_ST_FSTYPE
1230 tprintf(", st_fstype=%.*s",
1231 (int) sizeof statbuf.st_fstype, statbuf.st_fstype);
1233 #if HAVE_STRUCT_STAT_ST_GEN
1234 tprintf(", st_gen=%u", statbuf.st_gen);
1241 #endif /* HAVE_STAT64 */
1243 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1245 convertoldstat(const struct __old_kernel_stat *oldbuf, struct stat *newbuf)
1247 newbuf->st_dev = oldbuf->st_dev;
1248 newbuf->st_ino = oldbuf->st_ino;
1249 newbuf->st_mode = oldbuf->st_mode;
1250 newbuf->st_nlink = oldbuf->st_nlink;
1251 newbuf->st_uid = oldbuf->st_uid;
1252 newbuf->st_gid = oldbuf->st_gid;
1253 newbuf->st_rdev = oldbuf->st_rdev;
1254 newbuf->st_size = oldbuf->st_size;
1255 newbuf->st_atime = oldbuf->st_atime;
1256 newbuf->st_mtime = oldbuf->st_mtime;
1257 newbuf->st_ctime = oldbuf->st_ctime;
1258 newbuf->st_blksize = 0; /* not supported in old_stat */
1259 newbuf->st_blocks = 0; /* not supported in old_stat */
1264 printoldstat(struct tcb *tcp, long addr)
1266 struct __old_kernel_stat statbuf;
1267 struct stat newstatbuf;
1273 if (syserror(tcp) || !verbose(tcp)) {
1274 tprintf("%#lx", addr);
1279 if (current_personality == 1) {
1280 printstatsol(tcp, addr);
1283 #endif /* LINUXSPARC */
1285 if (umove(tcp, addr, &statbuf) < 0) {
1290 convertoldstat(&statbuf, &newstatbuf);
1291 realprintstat(tcp, &newstatbuf);
1293 #endif /* LINUX && !IA64 && !HPPA && !X86_64 && !S390 && !S390X */
1295 #ifndef HAVE_LONG_LONG_OFF_T
1297 sys_stat(struct tcb *tcp)
1299 if (entering(tcp)) {
1300 printpath(tcp, tcp->u_arg[0]);
1303 printstat(tcp, tcp->u_arg[1]);
1310 sys_stat64(struct tcb *tcp)
1313 if (entering(tcp)) {
1314 printpath(tcp, tcp->u_arg[0]);
1317 printstat64(tcp, tcp->u_arg[1]);
1321 return printargs(tcp);
1326 static const struct xlat fstatatflags[] = {
1327 #ifndef AT_SYMLINK_NOFOLLOW
1328 # define AT_SYMLINK_NOFOLLOW 0x100
1330 { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" },
1333 #define utimensatflags fstatatflags
1336 sys_newfstatat(struct tcb *tcp)
1338 if (entering(tcp)) {
1339 print_dirfd(tcp, tcp->u_arg[0]);
1340 printpath(tcp, tcp->u_arg[1]);
1344 if (current_personality == 0)
1345 printstat(tcp, tcp->u_arg[2]);
1347 printstat64(tcp, tcp->u_arg[2]);
1348 #elif defined HAVE_STAT64
1349 printstat64(tcp, tcp->u_arg[2]);
1351 printstat(tcp, tcp->u_arg[2]);
1354 printflags(fstatatflags, tcp->u_arg[3], "AT_???");
1360 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1362 sys_oldstat(struct tcb *tcp)
1364 if (entering(tcp)) {
1365 printpath(tcp, tcp->u_arg[0]);
1368 printoldstat(tcp, tcp->u_arg[1]);
1372 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1374 #ifndef HAVE_LONG_LONG_OFF_T
1376 sys_fstat(struct tcb *tcp)
1378 if (entering(tcp)) {
1379 printfd(tcp, tcp->u_arg[0]);
1382 printstat(tcp, tcp->u_arg[1]);
1389 sys_fstat64(struct tcb *tcp)
1392 if (entering(tcp)) {
1393 printfd(tcp, tcp->u_arg[0]);
1396 printstat64(tcp, tcp->u_arg[1]);
1400 return printargs(tcp);
1404 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1406 sys_oldfstat(struct tcb *tcp)
1408 if (entering(tcp)) {
1409 printfd(tcp, tcp->u_arg[0]);
1412 printoldstat(tcp, tcp->u_arg[1]);
1416 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1418 #ifndef HAVE_LONG_LONG_OFF_T
1420 sys_lstat(struct tcb *tcp)
1422 if (entering(tcp)) {
1423 printpath(tcp, tcp->u_arg[0]);
1426 printstat(tcp, tcp->u_arg[1]);
1433 sys_lstat64(struct tcb *tcp)
1436 if (entering(tcp)) {
1437 printpath(tcp, tcp->u_arg[0]);
1440 printstat64(tcp, tcp->u_arg[1]);
1444 return printargs(tcp);
1448 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1450 sys_oldlstat(struct tcb *tcp)
1452 if (entering(tcp)) {
1453 printpath(tcp, tcp->u_arg[0]);
1456 printoldstat(tcp, tcp->u_arg[1]);
1460 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1463 #if defined(SVR4) || defined(LINUXSPARC)
1466 sys_xstat(struct tcb *tcp)
1468 if (entering(tcp)) {
1469 tprintf("%ld, ", tcp->u_arg[0]);
1470 printpath(tcp, tcp->u_arg[1]);
1474 if (tcp->u_arg[0] == _STAT64_VER)
1475 printstat64 (tcp, tcp->u_arg[2]);
1478 printstat(tcp, tcp->u_arg[2]);
1484 sys_fxstat(struct tcb *tcp)
1487 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
1490 if (tcp->u_arg[0] == _STAT64_VER)
1491 printstat64 (tcp, tcp->u_arg[2]);
1494 printstat(tcp, tcp->u_arg[2]);
1500 sys_lxstat(struct tcb *tcp)
1502 if (entering(tcp)) {
1503 tprintf("%ld, ", tcp->u_arg[0]);
1504 printpath(tcp, tcp->u_arg[1]);
1508 if (tcp->u_arg[0] == _STAT64_VER)
1509 printstat64 (tcp, tcp->u_arg[2]);
1512 printstat(tcp, tcp->u_arg[2]);
1518 sys_xmknod(struct tcb *tcp)
1520 int mode = tcp->u_arg[2];
1522 if (entering(tcp)) {
1523 tprintf("%ld, ", tcp->u_arg[0]);
1524 printpath(tcp, tcp->u_arg[1]);
1525 tprintf(", %s", sprintmode(mode));
1526 switch (mode & S_IFMT) {
1527 case S_IFCHR: case S_IFBLK:
1529 tprintf(", makedev(%lu, %lu)",
1530 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
1531 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
1533 tprintf(", makedev(%lu, %lu)",
1534 (unsigned long) major(tcp->u_arg[3]),
1535 (unsigned long) minor(tcp->u_arg[3]));
1545 #ifdef HAVE_SYS_ACL_H
1547 #include <sys/acl.h>
1549 static const struct xlat aclcmds[] = {
1551 { SETACL, "SETACL" },
1554 { GETACL, "GETACL" },
1557 { GETACLCNT, "GETACLCNT" },
1560 { ACL_GET, "ACL_GET" },
1563 { ACL_SET, "ACL_SET" },
1566 { ACL_CNT, "ACL_CNT" },
1572 sys_acl(struct tcb *tcp)
1574 if (entering(tcp)) {
1575 printpath(tcp, tcp->u_arg[0]);
1577 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1578 tprintf(", %ld", tcp->u_arg[2]);
1580 * FIXME - dump out the list of aclent_t's pointed to
1581 * by "tcp->u_arg[3]" if it's not NULL.
1584 tprintf(", %#lx", tcp->u_arg[3]);
1593 sys_facl(struct tcb *tcp)
1595 if (entering(tcp)) {
1596 tprintf("%ld, ", tcp->u_arg[0]);
1597 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1598 tprintf(", %ld", tcp->u_arg[2]);
1600 * FIXME - dump out the list of aclent_t's pointed to
1601 * by "tcp->u_arg[3]" if it's not NULL.
1604 tprintf(", %#lx", tcp->u_arg[3]);
1612 static const struct xlat aclipc[] = {
1614 { IPC_SHM, "IPC_SHM" },
1617 { IPC_SEM, "IPC_SEM" },
1620 { IPC_MSG, "IPC_MSG" },
1627 sys_aclipc(struct tcb *tcp)
1629 if (entering(tcp)) {
1630 printxval(aclipc, tcp->u_arg[0], "???IPC???");
1631 tprintf(", %#lx, ", tcp->u_arg[1]);
1632 printxval(aclcmds, tcp->u_arg[2], "???ACL???");
1633 tprintf(", %ld", tcp->u_arg[3]);
1635 * FIXME - dump out the list of aclent_t's pointed to
1636 * by "tcp->u_arg[4]" if it's not NULL.
1639 tprintf(", %#lx", tcp->u_arg[4]);
1646 #endif /* HAVE_SYS_ACL_H */
1648 #endif /* SVR4 || LINUXSPARC */
1652 static const struct xlat fsmagic[] = {
1653 { 0x73757245, "CODA_SUPER_MAGIC" },
1654 { 0x012ff7b7, "COH_SUPER_MAGIC" },
1655 { 0x1373, "DEVFS_SUPER_MAGIC" },
1656 { 0x1cd1, "DEVPTS_SUPER_MAGIC" },
1657 { 0x414A53, "EFS_SUPER_MAGIC" },
1658 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
1659 { 0xef53, "EXT2_SUPER_MAGIC" },
1660 { 0x137d, "EXT_SUPER_MAGIC" },
1661 { 0xf995e849, "HPFS_SUPER_MAGIC" },
1662 { 0x9660, "ISOFS_SUPER_MAGIC" },
1663 { 0x137f, "MINIX_SUPER_MAGIC" },
1664 { 0x138f, "MINIX_SUPER_MAGIC2" },
1665 { 0x2468, "MINIX2_SUPER_MAGIC" },
1666 { 0x2478, "MINIX2_SUPER_MAGIC2" },
1667 { 0x4d44, "MSDOS_SUPER_MAGIC" },
1668 { 0x564c, "NCP_SUPER_MAGIC" },
1669 { 0x6969, "NFS_SUPER_MAGIC" },
1670 { 0x9fa0, "PROC_SUPER_MAGIC" },
1671 { 0x002f, "QNX4_SUPER_MAGIC" },
1672 { 0x52654973, "REISERFS_SUPER_MAGIC" },
1673 { 0x02011994, "SHMFS_SUPER_MAGIC" },
1674 { 0x517b, "SMB_SUPER_MAGIC" },
1675 { 0x012ff7b6, "SYSV2_SUPER_MAGIC" },
1676 { 0x012ff7b5, "SYSV4_SUPER_MAGIC" },
1677 { 0x00011954, "UFS_MAGIC" },
1678 { 0x54190100, "UFS_CIGAM" },
1679 { 0x012ff7b4, "XENIX_SUPER_MAGIC" },
1680 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
1681 { 0x62656572, "SYSFS_MAGIC" },
1690 sprintfstype(int magic)
1692 static char buf[32];
1696 s = xlookup(fsmagic, magic);
1698 sprintf(buf, "\"%s\"", s);
1702 sprintf(buf, "%#x", magic);
1707 printstatfs(struct tcb *tcp, long addr)
1709 struct statfs statbuf;
1711 if (syserror(tcp) || !verbose(tcp)) {
1712 tprintf("%#lx", addr);
1715 if (umove(tcp, addr, &statbuf) < 0) {
1721 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
1722 sprintfstype(statbuf.f_type),
1723 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
1724 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_fsid={%d, %d}, f_namelen=%u",
1725 statbuf.f_bavail, statbuf.f_files, statbuf.f_ffree,
1726 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1],
1729 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
1730 sprintfstype(statbuf.f_type),
1731 (unsigned long)statbuf.f_bsize,
1732 (unsigned long)statbuf.f_blocks,
1733 (unsigned long)statbuf.f_bfree);
1734 tprintf("f_bavail=%lu, f_files=%lu, f_ffree=%lu, f_fsid={%d, %d}",
1735 (unsigned long)statbuf.f_bavail,
1736 (unsigned long)statbuf.f_files,
1737 (unsigned long)statbuf.f_ffree,
1738 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1740 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1743 #ifdef _STATFS_F_FRSIZE
1744 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
1750 sys_statfs(struct tcb *tcp)
1752 if (entering(tcp)) {
1753 printpath(tcp, tcp->u_arg[0]);
1756 printstatfs(tcp, tcp->u_arg[1]);
1762 sys_fstatfs(struct tcb *tcp)
1764 if (entering(tcp)) {
1765 printfd(tcp, tcp->u_arg[0]);
1768 printstatfs(tcp, tcp->u_arg[1]);
1773 #if defined LINUX && defined HAVE_STATFS64
1775 printstatfs64(struct tcb *tcp, long addr)
1777 struct statfs64 statbuf;
1779 if (syserror(tcp) || !verbose(tcp)) {
1780 tprintf("%#lx", addr);
1783 if (umove(tcp, addr, &statbuf) < 0) {
1787 tprintf("{f_type=%s, f_bsize=%llu, f_blocks=%llu, f_bfree=%llu, ",
1788 sprintfstype(statbuf.f_type),
1789 (unsigned long long)statbuf.f_bsize,
1790 (unsigned long long)statbuf.f_blocks,
1791 (unsigned long long)statbuf.f_bfree);
1792 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
1793 (unsigned long long)statbuf.f_bavail,
1794 (unsigned long long)statbuf.f_files,
1795 (unsigned long long)statbuf.f_ffree,
1796 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1797 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1798 #ifdef _STATFS_F_FRSIZE
1799 tprintf(", f_frsize=%llu", (unsigned long long)statbuf.f_frsize);
1805 sys_statfs64(struct tcb *tcp)
1807 if (entering(tcp)) {
1808 printpath(tcp, tcp->u_arg[0]);
1809 tprintf(", %lu, ", tcp->u_arg[1]);
1811 if (tcp->u_arg[1] == sizeof(struct statfs64))
1812 printstatfs64(tcp, tcp->u_arg[2]);
1820 sys_fstatfs64(struct tcb *tcp)
1822 if (entering(tcp)) {
1823 printfd(tcp, tcp->u_arg[0]);
1824 tprintf(", %lu, ", tcp->u_arg[1]);
1826 if (tcp->u_arg[1] == sizeof(struct statfs64))
1827 printstatfs64(tcp, tcp->u_arg[2]);
1835 #if defined(LINUX) && defined(__alpha)
1838 osf_statfs(struct tcb *tcp)
1840 if (entering(tcp)) {
1841 printpath(tcp, tcp->u_arg[0]);
1844 printstatfs(tcp, tcp->u_arg[1]);
1845 tprintf(", %lu", tcp->u_arg[2]);
1851 osf_fstatfs(struct tcb *tcp)
1853 if (entering(tcp)) {
1854 tprintf("%lu, ", tcp->u_arg[0]);
1856 printstatfs(tcp, tcp->u_arg[1]);
1857 tprintf(", %lu", tcp->u_arg[2]);
1861 #endif /* LINUX && __alpha */
1867 sys_ustat(struct tcb *tcp)
1869 struct ustat statbuf;
1871 if (entering(tcp)) {
1872 tprintf("makedev(%lu, %lu), ",
1873 (long) major(tcp->u_arg[0]),
1874 (long) minor(tcp->u_arg[0]));
1877 if (syserror(tcp) || !verbose(tcp))
1878 tprintf("%#lx", tcp->u_arg[1]);
1879 else if (umove(tcp, tcp->u_arg[1], &statbuf) < 0)
1882 tprintf("{f_tfree=%lu, f_tinode=%lu, ",
1883 statbuf.f_tfree, statbuf.f_tinode);
1884 tprintf("f_fname=\"%.*s\", ",
1885 (int) sizeof(statbuf.f_fname),
1887 tprintf("f_fpack=\"%.*s\"}",
1888 (int) sizeof(statbuf.f_fpack),
1897 sys_pivotroot(struct tcb *tcp)
1899 if (entering(tcp)) {
1900 printpath(tcp, tcp->u_arg[0]);
1902 printpath(tcp, tcp->u_arg[1]);
1910 sys_chdir(struct tcb *tcp)
1912 if (entering(tcp)) {
1913 printpath(tcp, tcp->u_arg[0]);
1919 decode_mkdir(struct tcb *tcp, int offset)
1921 if (entering(tcp)) {
1922 printpath(tcp, tcp->u_arg[offset]);
1923 tprintf(", %#lo", tcp->u_arg[offset + 1]);
1929 sys_mkdir(struct tcb *tcp)
1931 return decode_mkdir(tcp, 0);
1936 sys_mkdirat(struct tcb *tcp)
1939 print_dirfd(tcp, tcp->u_arg[0]);
1940 return decode_mkdir(tcp, 1);
1945 sys_rmdir(struct tcb *tcp)
1947 if (entering(tcp)) {
1948 printpath(tcp, tcp->u_arg[0]);
1954 sys_fchdir(struct tcb *tcp)
1956 if (entering(tcp)) {
1957 printfd(tcp, tcp->u_arg[0]);
1963 sys_chroot(struct tcb *tcp)
1965 if (entering(tcp)) {
1966 printpath(tcp, tcp->u_arg[0]);
1971 #if defined(SUNOS4) || defined(SVR4)
1973 sys_fchroot(struct tcb *tcp)
1975 if (entering(tcp)) {
1976 printfd(tcp, tcp->u_arg[0]);
1980 #endif /* SUNOS4 || SVR4 */
1983 sys_link(struct tcb *tcp)
1985 if (entering(tcp)) {
1986 printpath(tcp, tcp->u_arg[0]);
1988 printpath(tcp, tcp->u_arg[1]);
1995 sys_linkat(struct tcb *tcp)
1997 if (entering(tcp)) {
1998 print_dirfd(tcp, tcp->u_arg[0]);
1999 printpath(tcp, tcp->u_arg[1]);
2001 print_dirfd(tcp, tcp->u_arg[2]);
2002 printpath(tcp, tcp->u_arg[3]);
2004 printfd(tcp, tcp->u_arg[4]);
2011 sys_unlink(struct tcb *tcp)
2013 if (entering(tcp)) {
2014 printpath(tcp, tcp->u_arg[0]);
2020 static const struct xlat unlinkatflags[] = {
2021 #ifndef AT_REMOVEDIR
2022 # define AT_REMOVEDIR 0x200
2024 { AT_REMOVEDIR, "AT_REMOVEDIR" },
2029 sys_unlinkat(struct tcb *tcp)
2031 if (entering(tcp)) {
2032 print_dirfd(tcp, tcp->u_arg[0]);
2033 printpath(tcp, tcp->u_arg[1]);
2035 printflags(unlinkatflags, tcp->u_arg[2], "AT_???");
2042 sys_symlink(struct tcb *tcp)
2044 if (entering(tcp)) {
2045 printpath(tcp, tcp->u_arg[0]);
2047 printpath(tcp, tcp->u_arg[1]);
2054 sys_symlinkat(struct tcb *tcp)
2056 if (entering(tcp)) {
2057 printpath(tcp, tcp->u_arg[0]);
2059 print_dirfd(tcp, tcp->u_arg[1]);
2060 printpath(tcp, tcp->u_arg[2]);
2067 decode_readlink(struct tcb *tcp, int offset)
2069 if (entering(tcp)) {
2070 printpath(tcp, tcp->u_arg[offset]);
2074 tprintf("%#lx", tcp->u_arg[offset + 1]);
2076 printpathn(tcp, tcp->u_arg[offset + 1], tcp->u_rval);
2077 tprintf(", %lu", tcp->u_arg[offset + 2]);
2083 sys_readlink(struct tcb *tcp)
2085 return decode_readlink(tcp, 0);
2090 sys_readlinkat(struct tcb *tcp)
2093 print_dirfd(tcp, tcp->u_arg[0]);
2094 return decode_readlink(tcp, 1);
2099 sys_rename(struct tcb *tcp)
2101 if (entering(tcp)) {
2102 printpath(tcp, tcp->u_arg[0]);
2104 printpath(tcp, tcp->u_arg[1]);
2111 sys_renameat(struct tcb *tcp)
2113 if (entering(tcp)) {
2114 print_dirfd(tcp, tcp->u_arg[0]);
2115 printpath(tcp, tcp->u_arg[1]);
2117 print_dirfd(tcp, tcp->u_arg[2]);
2118 printpath(tcp, tcp->u_arg[3]);
2125 sys_chown(struct tcb *tcp)
2127 if (entering(tcp)) {
2128 printpath(tcp, tcp->u_arg[0]);
2129 printuid(", ", tcp->u_arg[1]);
2130 printuid(", ", tcp->u_arg[2]);
2137 sys_fchownat(struct tcb *tcp)
2139 if (entering(tcp)) {
2140 print_dirfd(tcp, tcp->u_arg[0]);
2141 printpath(tcp, tcp->u_arg[1]);
2142 printuid(", ", tcp->u_arg[2]);
2143 printuid(", ", tcp->u_arg[3]);
2145 printflags(fstatatflags, tcp->u_arg[4], "AT_???");
2152 sys_fchown(struct tcb *tcp)
2154 if (entering(tcp)) {
2155 printfd(tcp, tcp->u_arg[0]);
2156 printuid(", ", tcp->u_arg[1]);
2157 printuid(", ", tcp->u_arg[2]);
2163 decode_chmod(struct tcb *tcp, int offset)
2165 if (entering(tcp)) {
2166 printpath(tcp, tcp->u_arg[offset]);
2167 tprintf(", %#lo", tcp->u_arg[offset + 1]);
2173 sys_chmod(struct tcb *tcp)
2175 return decode_chmod(tcp, 0);
2180 sys_fchmodat(struct tcb *tcp)
2183 print_dirfd(tcp, tcp->u_arg[0]);
2184 return decode_chmod(tcp, 1);
2189 sys_fchmod(struct tcb *tcp)
2191 if (entering(tcp)) {
2192 printfd(tcp, tcp->u_arg[0]);
2193 tprintf(", %#lo", tcp->u_arg[1]);
2200 sys_osf_utimes(struct tcb *tcp)
2202 if (entering(tcp)) {
2203 printpath(tcp, tcp->u_arg[0]);
2205 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
2212 decode_utimes(struct tcb *tcp, int offset, int special)
2214 if (entering(tcp)) {
2215 printpath(tcp, tcp->u_arg[offset]);
2217 if (tcp->u_arg[offset + 1] == 0)
2221 printtv_bitness(tcp, tcp->u_arg[offset + 1],
2222 BITNESS_CURRENT, special);
2224 printtv_bitness(tcp, tcp->u_arg[offset + 1]
2225 + sizeof(struct timeval),
2226 BITNESS_CURRENT, special);
2234 sys_utimes(struct tcb *tcp)
2236 return decode_utimes(tcp, 0, 0);
2241 sys_futimesat(struct tcb *tcp)
2244 print_dirfd(tcp, tcp->u_arg[0]);
2245 return decode_utimes(tcp, 1, 0);
2249 sys_utimensat(struct tcb *tcp)
2251 if (entering(tcp)) {
2252 print_dirfd(tcp, tcp->u_arg[0]);
2253 decode_utimes(tcp, 1, 1);
2255 printflags(utimensatflags, tcp->u_arg[3], "AT_???");
2262 sys_utime(struct tcb *tcp)
2269 if (entering(tcp)) {
2270 printpath(tcp, tcp->u_arg[0]);
2274 else if (!verbose(tcp))
2275 tprintf("%#lx", tcp->u_arg[1]);
2276 else if (umoven(tcp, tcp->u_arg[1],
2277 2 * personality_wordsize[current_personality],
2280 else if (personality_wordsize[current_personality]
2281 == sizeof u.utl[0]) {
2282 tprintf("[%s,", sprinttime(u.utl[0]));
2283 tprintf(" %s]", sprinttime(u.utl[1]));
2285 else if (personality_wordsize[current_personality]
2286 == sizeof u.uti[0]) {
2287 tprintf("[%s,", sprinttime(u.uti[0]));
2288 tprintf(" %s]", sprinttime(u.uti[1]));
2297 decode_mknod(struct tcb *tcp, int offset)
2299 int mode = tcp->u_arg[offset + 1];
2301 if (entering(tcp)) {
2302 printpath(tcp, tcp->u_arg[offset]);
2303 tprintf(", %s", sprintmode(mode));
2304 switch (mode & S_IFMT) {
2305 case S_IFCHR: case S_IFBLK:
2307 if (current_personality == 1)
2308 tprintf(", makedev(%lu, %lu)",
2309 (unsigned long) ((tcp->u_arg[offset + 2] >> 18) & 0x3fff),
2310 (unsigned long) (tcp->u_arg[offset + 2] & 0x3ffff));
2313 tprintf(", makedev(%lu, %lu)",
2314 (unsigned long) major(tcp->u_arg[offset + 2]),
2315 (unsigned long) minor(tcp->u_arg[offset + 2]));
2325 sys_mknod(struct tcb *tcp)
2327 return decode_mknod(tcp, 0);
2332 sys_mknodat(struct tcb *tcp)
2335 print_dirfd(tcp, tcp->u_arg[0]);
2336 return decode_mknod(tcp, 1);
2342 sys_mkfifo(struct tcb *tcp)
2344 if (entering(tcp)) {
2345 printpath(tcp, tcp->u_arg[0]);
2346 tprintf(", %#lo", tcp->u_arg[1]);
2350 #endif /* FREEBSD */
2353 sys_fsync(struct tcb *tcp)
2355 if (entering(tcp)) {
2356 printfd(tcp, tcp->u_arg[0]);
2364 printdir(struct tcb *tcp, long addr)
2368 if (!verbose(tcp)) {
2369 tprintf("%#lx", addr);
2372 if (umove(tcp, addr, &d) < 0) {
2376 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
2378 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
2383 sys_readdir(struct tcb *tcp)
2385 if (entering(tcp)) {
2386 printfd(tcp, tcp->u_arg[0]);
2389 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
2390 tprintf("%#lx", tcp->u_arg[1]);
2392 printdir(tcp, tcp->u_arg[1]);
2393 /* Not much point in printing this out, it is always 1. */
2394 if (tcp->u_arg[2] != 1)
2395 tprintf(", %lu", tcp->u_arg[2]);
2402 #if defined FREEBSD || defined LINUX
2403 static const struct xlat direnttypes[] = {
2404 { DT_UNKNOWN, "DT_UNKNOWN" },
2405 { DT_FIFO, "DT_FIFO" },
2406 { DT_CHR, "DT_CHR" },
2407 { DT_DIR, "DT_DIR" },
2408 { DT_BLK, "DT_BLK" },
2409 { DT_REG, "DT_REG" },
2410 { DT_LNK, "DT_LNK" },
2411 { DT_SOCK, "DT_SOCK" },
2412 { DT_WHT, "DT_WHT" },
2419 sys_getdents(struct tcb *tcp)
2421 int i, len, dents = 0;
2424 if (entering(tcp)) {
2425 printfd(tcp, tcp->u_arg[0]);
2429 if (syserror(tcp) || !verbose(tcp)) {
2430 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2434 buf = len ? malloc(len) : NULL;
2436 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2437 fprintf(stderr, "out of memory\n");
2440 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2441 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2447 for (i = 0; i < len;) {
2448 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
2451 tprintf("%s{d_ino=%lu, d_off=%lu, ",
2452 i ? " " : "", d->d_ino, d->d_off);
2453 tprintf("d_reclen=%u, d_name=\"%s\"}",
2454 d->d_reclen, d->d_name);
2459 tprintf("%s{d_ino=%lu, d_off=%lu, ",
2461 (unsigned long) d->d_ino,
2462 (unsigned long) d->d_off);
2463 tprintf("d_reclen=%u, d_name=\"%s\"}",
2464 d->d_reclen, d->d_name);
2469 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
2470 i ? " " : "", d->d_off, d->d_fileno,
2472 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
2473 d->d_namlen, d->d_namlen, d->d_name);
2478 tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
2479 i ? " " : "", d->d_fileno, d->d_reclen);
2480 printxval(direnttypes, d->d_type, "DT_???");
2481 tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
2482 d->d_namlen, d->d_namlen, d->d_name);
2484 #endif /* FREEBSD */
2486 tprintf("/* d_reclen == 0, problem here */");
2495 tprintf("/* %u entries */", dents);
2496 tprintf(", %lu", tcp->u_arg[2]);
2502 #if _LFS64_LARGEFILE
2504 sys_getdents64(struct tcb *tcp)
2506 int i, len, dents = 0;
2509 if (entering(tcp)) {
2510 printfd(tcp, tcp->u_arg[0]);
2514 if (syserror(tcp) || !verbose(tcp)) {
2515 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2519 buf = len ? malloc(len) : NULL;
2521 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2522 fprintf(stderr, "out of memory\n");
2525 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2526 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2532 for (i = 0; i < len;) {
2533 struct dirent64 *d = (struct dirent64 *) &buf[i];
2534 #if defined(LINUX) || defined(SVR4)
2536 tprintf("%s{d_ino=%" PRIu64 ", d_off=%" PRId64 ", ",
2542 printxval(direnttypes, d->d_type, "DT_???");
2545 tprintf("d_reclen=%u, d_name=\"%s\"}",
2546 d->d_reclen, d->d_name);
2548 #endif /* LINUX || SVR4 */
2551 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
2552 i ? " " : "", d->d_off, d->d_fileno,
2554 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
2555 d->d_namlen, d->d_namlen, d->d_name);
2559 tprintf("/* d_reclen == 0, problem here */");
2568 tprintf("/* %u entries */", dents);
2569 tprintf(", %lu", tcp->u_arg[2]);
2577 sys_getdirentries(struct tcb *tcp)
2579 int i, len, dents = 0;
2583 if (entering(tcp)) {
2584 printfd(tcp, tcp->u_arg[0]);
2588 if (syserror(tcp) || !verbose(tcp)) {
2589 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2593 if ((buf = malloc(len)) == NULL) {
2594 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2595 fprintf(stderr, "out of memory\n");
2598 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2599 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2605 for (i = 0; i < len;) {
2606 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
2608 tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
2609 i ? " " : "", d->d_fileno, d->d_reclen);
2610 printxval(direnttypes, d->d_type, "DT_???");
2611 tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
2612 d->d_namlen, d->d_namlen, d->d_name);
2615 tprintf("/* d_reclen == 0, problem here */");
2624 tprintf("/* %u entries */", dents);
2626 tprintf(", %lu", tcp->u_arg[2]);
2627 if (umove(tcp, tcp->u_arg[3], &basep) < 0)
2628 tprintf(", %#lx", tcp->u_arg[3]);
2630 tprintf(", [%lu]", basep);
2637 sys_getcwd(struct tcb *tcp)
2641 tprintf("%#lx", tcp->u_arg[0]);
2643 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
2644 tprintf(", %lu", tcp->u_arg[1]);
2652 sys___getcwd(struct tcb *tcp)
2656 tprintf("%#lx", tcp->u_arg[0]);
2658 printpathn(tcp, tcp->u_arg[0], tcp->u_arg[1]);
2659 tprintf(", %lu", tcp->u_arg[1]);
2665 #ifdef HAVE_SYS_ASYNCH_H
2668 sys_aioread(struct tcb *tcp)
2670 struct aio_result_t res;
2672 if (entering(tcp)) {
2673 tprintf("%lu, ", tcp->u_arg[0]);
2676 tprintf("%#lx", tcp->u_arg[1]);
2678 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2679 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2680 printxval(whence, tcp->u_arg[4], "L_???");
2681 if (syserror(tcp) || tcp->u_arg[5] == 0
2682 || umove(tcp, tcp->u_arg[5], &res) < 0)
2683 tprintf(", %#lx", tcp->u_arg[5]);
2685 tprintf(", {aio_return %d aio_errno %d}",
2686 res.aio_return, res.aio_errno);
2692 sys_aiowrite(struct tcb *tcp)
2694 struct aio_result_t res;
2696 if (entering(tcp)) {
2697 tprintf("%lu, ", tcp->u_arg[0]);
2698 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2699 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2700 printxval(whence, tcp->u_arg[4], "L_???");
2703 if (tcp->u_arg[5] == 0)
2705 else if (syserror(tcp)
2706 || umove(tcp, tcp->u_arg[5], &res) < 0)
2707 tprintf(", %#lx", tcp->u_arg[5]);
2709 tprintf(", {aio_return %d aio_errno %d}",
2710 res.aio_return, res.aio_errno);
2716 sys_aiowait(struct tcb *tcp)
2719 printtv(tcp, tcp->u_arg[0]);
2724 sys_aiocancel(struct tcb *tcp)
2726 struct aio_result_t res;
2729 if (tcp->u_arg[0] == 0)
2731 else if (syserror(tcp)
2732 || umove(tcp, tcp->u_arg[0], &res) < 0)
2733 tprintf("%#lx", tcp->u_arg[0]);
2735 tprintf("{aio_return %d aio_errno %d}",
2736 res.aio_return, res.aio_errno);
2741 #endif /* HAVE_SYS_ASYNCH_H */
2743 static const struct xlat xattrflags[] = {
2745 { XATTR_CREATE, "XATTR_CREATE" },
2746 { XATTR_REPLACE, "XATTR_REPLACE" },
2752 print_xattr_val(struct tcb *tcp, int failed,
2754 unsigned long insize,
2758 unsigned long capacity = 4 * size + 1;
2759 unsigned char *buf = (capacity < size) ? NULL : malloc(capacity);
2760 if (buf == NULL || /* probably a bogus size argument */
2761 umoven(tcp, arg, size, (char *) &buf[3 * size]) < 0) {
2765 unsigned char *out = buf;
2766 unsigned char *in = &buf[3 * size];
2768 for (i = 0; i < size; ++i) {
2772 #define tohex(n) "0123456789abcdef"[n]
2775 *out++ = tohex(in[i] / 16);
2776 *out++ = tohex(in[i] % 16);
2779 /* Don't print terminating NUL if there is one. */
2780 if (i > 0 && in[i - 1] == '\0')
2783 tprintf(", \"%s\", %ld", buf, insize);
2788 tprintf(", 0x%lx, %ld", arg, insize);
2792 sys_setxattr(struct tcb *tcp)
2794 if (entering(tcp)) {
2795 printpath(tcp, tcp->u_arg[0]);
2797 printstr(tcp, tcp->u_arg[1], -1);
2798 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2800 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2806 sys_fsetxattr(struct tcb *tcp)
2808 if (entering(tcp)) {
2809 printfd(tcp, tcp->u_arg[0]);
2811 printstr(tcp, tcp->u_arg[1], -1);
2812 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2814 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2820 sys_getxattr(struct tcb *tcp)
2822 if (entering(tcp)) {
2823 printpath(tcp, tcp->u_arg[0]);
2825 printstr(tcp, tcp->u_arg[1], -1);
2827 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2834 sys_fgetxattr(struct tcb *tcp)
2836 if (entering(tcp)) {
2837 printfd(tcp, tcp->u_arg[0]);
2839 printstr(tcp, tcp->u_arg[1], -1);
2841 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2848 sys_listxattr(struct tcb *tcp)
2850 if (entering(tcp)) {
2851 printpath(tcp, tcp->u_arg[0]);
2853 /* XXX Print value in format */
2854 tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]);
2860 sys_flistxattr(struct tcb *tcp)
2862 if (entering(tcp)) {
2863 printfd(tcp, tcp->u_arg[0]);
2865 /* XXX Print value in format */
2866 tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]);
2872 sys_removexattr(struct tcb *tcp)
2874 if (entering(tcp)) {
2875 printpath(tcp, tcp->u_arg[0]);
2877 printstr(tcp, tcp->u_arg[1], -1);
2883 sys_fremovexattr(struct tcb *tcp)
2885 if (entering(tcp)) {
2886 printfd(tcp, tcp->u_arg[0]);
2888 printstr(tcp, tcp->u_arg[1], -1);
2894 static const struct xlat advise[] = {
2895 { POSIX_FADV_NORMAL, "POSIX_FADV_NORMAL" },
2896 { POSIX_FADV_RANDOM, "POSIX_FADV_RANDOM" },
2897 { POSIX_FADV_SEQUENTIAL, "POSIX_FADV_SEQUENTIAL" },
2898 { POSIX_FADV_WILLNEED, "POSIX_FADV_WILLNEED" },
2899 { POSIX_FADV_DONTNEED, "POSIX_FADV_DONTNEED" },
2900 { POSIX_FADV_NOREUSE, "POSIX_FADV_NOREUSE" },
2907 sys_fadvise64(struct tcb *tcp)
2909 if (entering(tcp)) {
2911 printfd(tcp, tcp->u_arg[0]);
2913 argn = printllval(tcp, "%lld", 1);
2914 tprintf(", %ld, ", tcp->u_arg[argn++]);
2915 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2923 sys_fadvise64_64(struct tcb *tcp)
2925 if (entering(tcp)) {
2927 printfd(tcp, tcp->u_arg[0]);
2929 #if defined ARM || defined POWERPC
2930 argn = printllval(tcp, "%lld, ", 2);
2932 argn = printllval(tcp, "%lld, ", 1);
2934 argn = printllval(tcp, "%lld, ", argn);
2935 #if defined ARM || defined POWERPC
2936 printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
2938 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2945 static const struct xlat inotify_modes[] = {
2946 { 0x00000001, "IN_ACCESS" },
2947 { 0x00000002, "IN_MODIFY" },
2948 { 0x00000004, "IN_ATTRIB" },
2949 { 0x00000008, "IN_CLOSE_WRITE"},
2950 { 0x00000010, "IN_CLOSE_NOWRITE"},
2951 { 0x00000020, "IN_OPEN" },
2952 { 0x00000040, "IN_MOVED_FROM" },
2953 { 0x00000080, "IN_MOVED_TO" },
2954 { 0x00000100, "IN_CREATE" },
2955 { 0x00000200, "IN_DELETE" },
2956 { 0x00000400, "IN_DELETE_SELF"},
2957 { 0x00000800, "IN_MOVE_SELF" },
2958 { 0x00002000, "IN_UNMOUNT" },
2959 { 0x00004000, "IN_Q_OVERFLOW" },
2960 { 0x00008000, "IN_IGNORED" },
2961 { 0x01000000, "IN_ONLYDIR" },
2962 { 0x02000000, "IN_DONT_FOLLOW"},
2963 { 0x20000000, "IN_MASK_ADD" },
2964 { 0x40000000, "IN_ISDIR" },
2965 { 0x80000000, "IN_ONESHOT" },
2969 static const struct xlat inotify_init_flags[] = {
2970 { 0x00000800, "IN_NONBLOCK" },
2971 { 0x00080000, "IN_CLOEXEC" },
2976 sys_inotify_add_watch(struct tcb *tcp)
2978 if (entering(tcp)) {
2979 printfd(tcp, tcp->u_arg[0]);
2981 printpath(tcp, tcp->u_arg[1]);
2983 printflags(inotify_modes, tcp->u_arg[2], "IN_???");
2989 sys_inotify_rm_watch(struct tcb *tcp)
2991 if (entering(tcp)) {
2992 printfd(tcp, tcp->u_arg[0]);
2993 tprintf(", %ld", tcp->u_arg[1]);
2999 sys_inotify_init1(struct tcb *tcp)
3002 printflags(inotify_init_flags, tcp->u_arg[0], "IN_???");
3007 sys_fallocate(struct tcb *tcp)
3009 if (entering(tcp)) {
3011 printfd(tcp, tcp->u_arg[0]); /* fd */
3013 tprintf("%#lo, ", tcp->u_arg[1]); /* mode */
3014 argn = printllval(tcp, "%llu, ", 2); /* offset */
3015 printllval(tcp, "%llu", argn); /* len */