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.
337 tprintf("AT_FDCWD, ");
344 * Pity stpcpy() is not standardized...
347 str_append(char *dst, const char *src)
349 while ((*dst = *src++) != '\0')
355 * low bits of the open(2) flags define access mode,
356 * other bits are real flags.
359 sprint_open_modes(mode_t flags)
361 static char outstr[1024];
365 const struct xlat *x;
367 p = str_append(outstr, "flags ");
368 str = xlookup(open_access_modes, flags & 3);
370 p = str_append(p, str);
377 for (x = open_mode_flags; x->str; x++) {
378 if ((flags & x->val) == x->val) {
381 p = str_append(p, x->str);
388 /* flags is still nonzero */
391 sprintf(p, "%#x", flags);
396 tprint_open_modes(mode_t flags)
398 tprintf("%s", sprint_open_modes(flags) + sizeof("flags"));
402 decode_open(struct tcb *tcp, int offset)
405 printpath(tcp, tcp->u_arg[offset]);
408 tprint_open_modes(tcp->u_arg[offset + 1]);
409 if (tcp->u_arg[offset + 1] & O_CREAT) {
411 tprintf(", %#lo", tcp->u_arg[offset + 2]);
418 sys_open(struct tcb *tcp)
420 return decode_open(tcp, 0);
425 sys_openat(struct tcb *tcp)
428 print_dirfd(tcp->u_arg[0]);
429 return decode_open(tcp, 1);
434 static const struct xlat openmodessol[] = {
438 { 0x80, "O_NONBLOCK" },
440 { 0x100, "O_CREAT" },
441 { 0x200, "O_TRUNC" },
443 { 0x800, "O_NOCTTY" },
446 { 0x8000, "O_RSYNC" },
448 { 0x1000, "O_PRIV" },
453 solaris_open(struct tcb *tcp)
456 printpath(tcp, tcp->u_arg[0]);
459 printflags(openmodessol, tcp->u_arg[1] + 1, "O_???");
460 if (tcp->u_arg[1] & 0x100) {
462 tprintf(", %#lo", tcp->u_arg[2]);
471 sys_creat(struct tcb *tcp)
474 printpath(tcp, tcp->u_arg[0]);
475 tprintf(", %#lo", tcp->u_arg[1]);
480 static const struct xlat access_flags[] = {
486 { EFF_ONLY_OK, "EFF_ONLY_OK" },
495 decode_access(struct tcb *tcp, int offset)
498 printpath(tcp, tcp->u_arg[offset]);
500 printflags(access_flags, tcp->u_arg[offset + 1], "?_OK");
506 sys_access(struct tcb *tcp)
508 return decode_access(tcp, 0);
513 sys_faccessat(struct tcb *tcp)
516 print_dirfd(tcp->u_arg[0]);
517 return decode_access(tcp, 1);
522 sys_umask(struct tcb *tcp)
525 tprintf("%#lo", tcp->u_arg[0]);
530 static const struct xlat whence[] = {
531 { SEEK_SET, "SEEK_SET" },
532 { SEEK_CUR, "SEEK_CUR" },
533 { SEEK_END, "SEEK_END" },
537 #ifndef HAVE_LONG_LONG_OFF_T
538 #if defined (LINUX_MIPSN32)
540 sys_lseek(struct tcb *tcp)
546 tprintf("%ld, ", tcp->u_arg[0]);
547 offset = tcp->ext_arg[1];
548 _whence = tcp->u_arg[2];
549 if (_whence == SEEK_SET)
550 tprintf("%llu, ", offset);
552 tprintf("%lld, ", offset);
553 printxval(whence, _whence, "SEEK_???");
555 return RVAL_UDECIMAL;
557 #else /* !LINUX_MIPSN32 */
559 sys_lseek(struct tcb *tcp)
565 tprintf("%ld, ", tcp->u_arg[0]);
566 offset = tcp->u_arg[1];
567 _whence = tcp->u_arg[2];
568 if (_whence == SEEK_SET)
569 tprintf("%lu, ", offset);
571 tprintf("%ld, ", offset);
572 printxval(whence, _whence, "SEEK_???");
574 return RVAL_UDECIMAL;
576 #endif /* LINUX_MIPSN32 */
581 sys_llseek(struct tcb *tcp)
585 * This one call takes explicitly two 32-bit arguments hi, lo,
586 * rather than one 64-bit argument for which LONG_LONG works
587 * appropriate for the native byte order.
589 if (tcp->u_arg[4] == SEEK_SET)
590 tprintf("%ld, %llu, ", tcp->u_arg[0],
591 (((long long int) tcp->u_arg[1]) << 32
592 | (unsigned long long) (unsigned) tcp->u_arg[2]));
594 tprintf("%ld, %lld, ", tcp->u_arg[0],
595 (((long long int) tcp->u_arg[1]) << 32
596 | (unsigned long long) (unsigned) tcp->u_arg[2]));
600 if (syserror(tcp) || umove(tcp, tcp->u_arg[3], &off) < 0)
601 tprintf("%#lx, ", tcp->u_arg[3]);
603 tprintf("[%llu], ", off);
604 printxval(whence, tcp->u_arg[4], "SEEK_???");
610 sys_readahead(struct tcb *tcp)
614 tprintf("%ld, ", tcp->u_arg[0]);
615 argn = printllval(tcp, "%lld", 1);
616 tprintf(", %ld", tcp->u_arg[argn]);
622 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
624 sys_lseek64(struct tcb *tcp)
628 tprintf("%ld, ", tcp->u_arg[0]);
629 if (tcp->u_arg[3] == SEEK_SET)
630 argn = printllval(tcp, "%llu, ", 1);
632 argn = printllval(tcp, "%lld, ", 1);
633 printxval(whence, tcp->u_arg[argn], "SEEK_???");
635 return RVAL_LUDECIMAL;
639 #ifndef HAVE_LONG_LONG_OFF_T
641 sys_truncate(struct tcb *tcp)
644 printpath(tcp, tcp->u_arg[0]);
645 tprintf(", %lu", tcp->u_arg[1]);
651 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
653 sys_truncate64(struct tcb *tcp)
656 printpath(tcp, tcp->u_arg[0]);
657 printllval(tcp, ", %llu", 1);
663 #ifndef HAVE_LONG_LONG_OFF_T
665 sys_ftruncate(struct tcb *tcp)
668 tprintf("%ld, %lu", tcp->u_arg[0], tcp->u_arg[1]);
674 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
676 sys_ftruncate64(struct tcb *tcp)
679 tprintf("%ld, ", tcp->u_arg[0]);
680 printllval(tcp, "%llu", 1);
688 static const struct xlat modetypes[] = {
689 { S_IFREG, "S_IFREG" },
690 { S_IFSOCK, "S_IFSOCK" },
691 { S_IFIFO, "S_IFIFO" },
692 { S_IFLNK, "S_IFLNK" },
693 { S_IFDIR, "S_IFDIR" },
694 { S_IFBLK, "S_IFBLK" },
695 { S_IFCHR, "S_IFCHR" },
705 if ((mode & S_IFMT) == 0)
707 else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) {
708 sprintf(buf, "%#o", mode);
711 sprintf(buf, "%s%s%s%s", s,
712 (mode & S_ISUID) ? "|S_ISUID" : "",
713 (mode & S_ISGID) ? "|S_ISGID" : "",
714 (mode & S_ISVTX) ? "|S_ISVTX" : "");
715 mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX);
717 sprintf(buf + strlen(buf), "|%#o", mode);
718 s = (*buf == '|') ? buf + 1 : buf;
732 if ((tmp = localtime(&t)))
733 snprintf(buf, sizeof buf, "%02d/%02d/%02d-%02d:%02d:%02d",
734 tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
735 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
737 snprintf(buf, sizeof buf, "%lu", (unsigned long) t);
750 int st_pad1[3]; /* network id */
759 int st_pad3; /* st_size, off_t expansion */
760 timestruct_t st_atime;
761 timestruct_t st_mtime;
762 timestruct_t st_ctime;
766 int st_pad4[8]; /* expansion area */
770 printstatsol(struct tcb *tcp, long addr)
772 struct solstat statbuf;
774 if (umove(tcp, addr, &statbuf) < 0) {
779 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
780 (unsigned long) ((statbuf.st_dev >> 18) & 0x3fff),
781 (unsigned long) (statbuf.st_dev & 0x3ffff),
782 (unsigned long) statbuf.st_ino,
783 sprintmode(statbuf.st_mode));
784 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
785 (unsigned long) statbuf.st_nlink,
786 (unsigned long) statbuf.st_uid,
787 (unsigned long) statbuf.st_gid);
788 tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);
789 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
792 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
793 switch (statbuf.st_mode & S_IFMT) {
794 case S_IFCHR: case S_IFBLK:
795 tprintf("st_rdev=makedev(%lu, %lu), ",
796 (unsigned long) ((statbuf.st_rdev >> 18) & 0x3fff),
797 (unsigned long) (statbuf.st_rdev & 0x3ffff));
800 tprintf("st_size=%u, ", statbuf.st_size);
804 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime.tv_sec));
805 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime.tv_sec));
806 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime.tv_sec));
812 #if defined (SPARC64)
814 printstat_sparc64(struct tcb *tcp, long addr)
816 struct stat_sparc64 statbuf;
818 if (umove(tcp, addr, &statbuf) < 0) {
824 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
825 (unsigned long) major(statbuf.st_dev),
826 (unsigned long) minor(statbuf.st_dev),
827 (unsigned long) statbuf.st_ino,
828 sprintmode(statbuf.st_mode));
829 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
830 (unsigned long) statbuf.st_nlink,
831 (unsigned long) statbuf.st_uid,
832 (unsigned long) statbuf.st_gid);
833 tprintf("st_blksize=%lu, ",
834 (unsigned long) statbuf.st_blksize);
835 tprintf("st_blocks=%lu, ",
836 (unsigned long) statbuf.st_blocks);
839 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
840 switch (statbuf.st_mode & S_IFMT) {
841 case S_IFCHR: case S_IFBLK:
842 tprintf("st_rdev=makedev(%lu, %lu), ",
843 (unsigned long) major(statbuf.st_rdev),
844 (unsigned long) minor(statbuf.st_rdev));
847 tprintf("st_size=%lu, ", statbuf.st_size);
851 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
852 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
853 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
860 #endif /* LINUXSPARC */
862 #if defined LINUX && defined POWERPC64
863 struct stat_powerpc32 {
866 unsigned int st_mode;
867 unsigned short st_nlink;
870 unsigned int st_rdev;
871 unsigned int st_size;
872 unsigned int st_blksize;
873 unsigned int st_blocks;
874 unsigned int st_atime;
875 unsigned int st_atime_nsec;
876 unsigned int st_mtime;
877 unsigned int st_mtime_nsec;
878 unsigned int st_ctime;
879 unsigned int st_ctime_nsec;
880 unsigned int __unused4;
881 unsigned int __unused5;
885 printstat_powerpc32(struct tcb *tcp, long addr)
887 struct stat_powerpc32 statbuf;
889 if (umove(tcp, addr, &statbuf) < 0) {
895 tprintf("{st_dev=makedev(%u, %u), st_ino=%u, st_mode=%s, ",
896 major(statbuf.st_dev), minor(statbuf.st_dev),
898 sprintmode(statbuf.st_mode));
899 tprintf("st_nlink=%u, st_uid=%u, st_gid=%u, ",
900 statbuf.st_nlink, statbuf.st_uid, statbuf.st_gid);
901 tprintf("st_blksize=%u, ", statbuf.st_blksize);
902 tprintf("st_blocks=%u, ", statbuf.st_blocks);
905 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
906 switch (statbuf.st_mode & S_IFMT) {
907 case S_IFCHR: case S_IFBLK:
908 tprintf("st_rdev=makedev(%lu, %lu), ",
909 (unsigned long) major(statbuf.st_rdev),
910 (unsigned long) minor(statbuf.st_rdev));
913 tprintf("st_size=%u, ", statbuf.st_size);
917 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
918 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
919 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
925 #endif /* LINUX && POWERPC64 */
927 static const struct xlat fileflags[] = {
929 { UF_NODUMP, "UF_NODUMP" },
930 { UF_IMMUTABLE, "UF_IMMUTABLE" },
931 { UF_APPEND, "UF_APPEND" },
932 { UF_OPAQUE, "UF_OPAQUE" },
933 { UF_NOUNLINK, "UF_NOUNLINK" },
934 { SF_ARCHIVED, "SF_ARCHIVED" },
935 { SF_IMMUTABLE, "SF_IMMUTABLE" },
936 { SF_APPEND, "SF_APPEND" },
937 { SF_NOUNLINK, "SF_NOUNLINK" },
940 { _S_ISMLD, "_S_ISMLD" },
943 { _S_ISMOUNTED, "_S_ISMOUNTED" },
951 sys_chflags(struct tcb *tcp)
954 printpath(tcp, tcp->u_arg[0]);
956 printflags(fileflags, tcp->u_arg[1], "UF_???");
962 sys_fchflags(struct tcb *tcp)
965 tprintf("%ld, ", tcp->u_arg[0]);
966 printflags(fileflags, tcp->u_arg[1], "UF_???");
972 #ifndef HAVE_LONG_LONG_OFF_T
974 realprintstat(struct tcb *tcp, struct stat *statbuf)
977 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
978 (unsigned long) major(statbuf->st_dev),
979 (unsigned long) minor(statbuf->st_dev),
980 (unsigned long) statbuf->st_ino,
981 sprintmode(statbuf->st_mode));
982 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
983 (unsigned long) statbuf->st_nlink,
984 (unsigned long) statbuf->st_uid,
985 (unsigned long) statbuf->st_gid);
986 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
987 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
989 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
990 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
994 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
995 switch (statbuf->st_mode & S_IFMT) {
996 case S_IFCHR: case S_IFBLK:
997 #ifdef HAVE_STRUCT_STAT_ST_RDEV
998 tprintf("st_rdev=makedev(%lu, %lu), ",
999 (unsigned long) major(statbuf->st_rdev),
1000 (unsigned long) minor(statbuf->st_rdev));
1001 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
1002 tprintf("st_size=makedev(%lu, %lu), ",
1003 (unsigned long) major(statbuf->st_size),
1004 (unsigned long) minor(statbuf->st_size));
1005 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
1008 tprintf("st_size=%lu, ", statbuf->st_size);
1012 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
1013 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
1014 tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));
1015 #if HAVE_STRUCT_STAT_ST_FLAGS
1016 tprintf(", st_flags=");
1017 printflags(fileflags, statbuf->st_flags, "UF_???");
1019 #if HAVE_STRUCT_STAT_ST_ACLCNT
1020 tprintf(", st_aclcnt=%d", statbuf->st_aclcnt);
1022 #if HAVE_STRUCT_STAT_ST_LEVEL
1023 tprintf(", st_level=%ld", statbuf->st_level);
1025 #if HAVE_STRUCT_STAT_ST_FSTYPE
1026 tprintf(", st_fstype=%.*s",
1027 (int) sizeof statbuf->st_fstype, statbuf->st_fstype);
1029 #if HAVE_STRUCT_STAT_ST_GEN
1030 tprintf(", st_gen=%u", statbuf->st_gen);
1040 printstat(struct tcb *tcp, long addr)
1042 struct stat statbuf;
1048 if (syserror(tcp) || !verbose(tcp)) {
1049 tprintf("%#lx", addr);
1054 if (current_personality == 1) {
1055 printstatsol(tcp, addr);
1059 else if (current_personality == 2) {
1060 printstat_sparc64(tcp, addr);
1064 #endif /* LINUXSPARC */
1066 #if defined LINUX && defined POWERPC64
1067 if (current_personality == 1) {
1068 printstat_powerpc32(tcp, addr);
1073 if (umove(tcp, addr, &statbuf) < 0) {
1078 realprintstat(tcp, &statbuf);
1080 #endif /* !HAVE_LONG_LONG_OFF_T */
1082 #if !defined HAVE_STAT64 && defined LINUX && defined X86_64
1084 * Linux x86_64 has unified `struct stat' but its i386 biarch needs
1085 * `struct stat64'. Its <asm-i386/stat.h> definition expects 32-bit `long'.
1086 * <linux/include/asm-x86_64/ia32.h> is not in the public includes set.
1087 * __GNUC__ is needed for the required __attribute__ below.
1090 unsigned long long st_dev;
1091 unsigned char __pad0[4];
1092 unsigned int __st_ino;
1093 unsigned int st_mode;
1094 unsigned int st_nlink;
1095 unsigned int st_uid;
1096 unsigned int st_gid;
1097 unsigned long long st_rdev;
1098 unsigned char __pad3[4];
1100 unsigned int st_blksize;
1101 unsigned long long st_blocks;
1102 unsigned int st_atime;
1103 unsigned int st_atime_nsec;
1104 unsigned int st_mtime;
1105 unsigned int st_mtime_nsec;
1106 unsigned int st_ctime;
1107 unsigned int st_ctime_nsec;
1108 unsigned long long st_ino;
1109 } __attribute__((packed));
1110 # define HAVE_STAT64 1
1111 # define STAT64_SIZE 96
1116 printstat64(struct tcb *tcp, long addr)
1118 struct stat64 statbuf;
1121 (void) sizeof(char[sizeof statbuf == STAT64_SIZE ? 1 : -1]);
1128 if (syserror(tcp) || !verbose(tcp)) {
1129 tprintf("%#lx", addr);
1134 if (current_personality == 1) {
1135 printstatsol(tcp, addr);
1139 else if (current_personality == 2) {
1140 printstat_sparc64(tcp, addr);
1144 #endif /* LINUXSPARC */
1146 #if defined LINUX && defined X86_64
1147 if (current_personality == 0) {
1148 printstat(tcp, addr);
1153 if (umove(tcp, addr, &statbuf) < 0) {
1159 #ifdef HAVE_LONG_LONG
1160 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
1162 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
1164 (unsigned long) major(statbuf.st_dev),
1165 (unsigned long) minor(statbuf.st_dev),
1166 #ifdef HAVE_LONG_LONG
1167 (unsigned long long) statbuf.st_ino,
1169 (unsigned long) statbuf.st_ino,
1171 sprintmode(statbuf.st_mode));
1172 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
1173 (unsigned long) statbuf.st_nlink,
1174 (unsigned long) statbuf.st_uid,
1175 (unsigned long) statbuf.st_gid);
1176 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
1177 tprintf("st_blksize=%lu, ",
1178 (unsigned long) statbuf.st_blksize);
1179 #endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */
1180 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
1181 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
1182 #endif /* HAVE_STRUCT_STAT_ST_BLOCKS */
1185 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
1186 switch (statbuf.st_mode & S_IFMT) {
1187 case S_IFCHR: case S_IFBLK:
1188 #ifdef HAVE_STRUCT_STAT_ST_RDEV
1189 tprintf("st_rdev=makedev(%lu, %lu), ",
1190 (unsigned long) major(statbuf.st_rdev),
1191 (unsigned long) minor(statbuf.st_rdev));
1192 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
1193 tprintf("st_size=makedev(%lu, %lu), ",
1194 (unsigned long) major(statbuf.st_size),
1195 (unsigned long) minor(statbuf.st_size));
1196 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
1199 #ifdef HAVE_LONG_LONG
1200 tprintf("st_size=%llu, ", (unsigned long long) statbuf.st_size);
1202 tprintf("st_size=%lu, ", (unsigned long) statbuf.st_size);
1207 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
1208 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
1209 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
1210 #if HAVE_STRUCT_STAT_ST_FLAGS
1211 tprintf(", st_flags=");
1212 printflags(fileflags, statbuf.st_flags, "UF_???");
1214 #if HAVE_STRUCT_STAT_ST_ACLCNT
1215 tprintf(", st_aclcnt=%d", statbuf.st_aclcnt);
1217 #if HAVE_STRUCT_STAT_ST_LEVEL
1218 tprintf(", st_level=%ld", statbuf.st_level);
1220 #if HAVE_STRUCT_STAT_ST_FSTYPE
1221 tprintf(", st_fstype=%.*s",
1222 (int) sizeof statbuf.st_fstype, statbuf.st_fstype);
1224 #if HAVE_STRUCT_STAT_ST_GEN
1225 tprintf(", st_gen=%u", statbuf.st_gen);
1232 #endif /* HAVE_STAT64 */
1234 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1236 convertoldstat(const struct __old_kernel_stat *oldbuf, struct stat *newbuf)
1238 newbuf->st_dev = oldbuf->st_dev;
1239 newbuf->st_ino = oldbuf->st_ino;
1240 newbuf->st_mode = oldbuf->st_mode;
1241 newbuf->st_nlink = oldbuf->st_nlink;
1242 newbuf->st_uid = oldbuf->st_uid;
1243 newbuf->st_gid = oldbuf->st_gid;
1244 newbuf->st_rdev = oldbuf->st_rdev;
1245 newbuf->st_size = oldbuf->st_size;
1246 newbuf->st_atime = oldbuf->st_atime;
1247 newbuf->st_mtime = oldbuf->st_mtime;
1248 newbuf->st_ctime = oldbuf->st_ctime;
1249 newbuf->st_blksize = 0; /* not supported in old_stat */
1250 newbuf->st_blocks = 0; /* not supported in old_stat */
1255 printoldstat(struct tcb *tcp, long addr)
1257 struct __old_kernel_stat statbuf;
1258 struct stat newstatbuf;
1264 if (syserror(tcp) || !verbose(tcp)) {
1265 tprintf("%#lx", addr);
1270 if (current_personality == 1) {
1271 printstatsol(tcp, addr);
1274 #endif /* LINUXSPARC */
1276 if (umove(tcp, addr, &statbuf) < 0) {
1281 convertoldstat(&statbuf, &newstatbuf);
1282 realprintstat(tcp, &newstatbuf);
1284 #endif /* LINUX && !IA64 && !HPPA && !X86_64 && !S390 && !S390X */
1286 #ifndef HAVE_LONG_LONG_OFF_T
1288 sys_stat(struct tcb *tcp)
1290 if (entering(tcp)) {
1291 printpath(tcp, tcp->u_arg[0]);
1294 printstat(tcp, tcp->u_arg[1]);
1301 sys_stat64(struct tcb *tcp)
1304 if (entering(tcp)) {
1305 printpath(tcp, tcp->u_arg[0]);
1308 printstat64(tcp, tcp->u_arg[1]);
1312 return printargs(tcp);
1317 static const struct xlat fstatatflags[] = {
1318 #ifndef AT_SYMLINK_NOFOLLOW
1319 # define AT_SYMLINK_NOFOLLOW 0x100
1321 { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" },
1324 #define utimensatflags fstatatflags
1327 sys_newfstatat(struct tcb *tcp)
1329 if (entering(tcp)) {
1330 print_dirfd(tcp->u_arg[0]);
1331 printpath(tcp, tcp->u_arg[1]);
1335 if (current_personality == 0)
1336 printstat(tcp, tcp->u_arg[2]);
1338 printstat64(tcp, tcp->u_arg[2]);
1339 #elif defined HAVE_STAT64
1340 printstat64(tcp, tcp->u_arg[2]);
1342 printstat(tcp, tcp->u_arg[2]);
1345 printflags(fstatatflags, tcp->u_arg[3], "AT_???");
1351 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1353 sys_oldstat(struct tcb *tcp)
1355 if (entering(tcp)) {
1356 printpath(tcp, tcp->u_arg[0]);
1359 printoldstat(tcp, tcp->u_arg[1]);
1363 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1365 #ifndef HAVE_LONG_LONG_OFF_T
1367 sys_fstat(struct tcb *tcp)
1370 tprintf("%ld, ", tcp->u_arg[0]);
1372 printstat(tcp, tcp->u_arg[1]);
1379 sys_fstat64(struct tcb *tcp)
1383 tprintf("%ld, ", tcp->u_arg[0]);
1385 printstat64(tcp, tcp->u_arg[1]);
1389 return printargs(tcp);
1393 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1395 sys_oldfstat(struct tcb *tcp)
1398 tprintf("%ld, ", tcp->u_arg[0]);
1400 printoldstat(tcp, tcp->u_arg[1]);
1404 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1406 #ifndef HAVE_LONG_LONG_OFF_T
1408 sys_lstat(struct tcb *tcp)
1410 if (entering(tcp)) {
1411 printpath(tcp, tcp->u_arg[0]);
1414 printstat(tcp, tcp->u_arg[1]);
1421 sys_lstat64(struct tcb *tcp)
1424 if (entering(tcp)) {
1425 printpath(tcp, tcp->u_arg[0]);
1428 printstat64(tcp, tcp->u_arg[1]);
1432 return printargs(tcp);
1436 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1438 sys_oldlstat(struct tcb *tcp)
1440 if (entering(tcp)) {
1441 printpath(tcp, tcp->u_arg[0]);
1444 printoldstat(tcp, tcp->u_arg[1]);
1448 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1451 #if defined(SVR4) || defined(LINUXSPARC)
1454 sys_xstat(struct tcb *tcp)
1456 if (entering(tcp)) {
1457 tprintf("%ld, ", tcp->u_arg[0]);
1458 printpath(tcp, tcp->u_arg[1]);
1462 if (tcp->u_arg[0] == _STAT64_VER)
1463 printstat64 (tcp, tcp->u_arg[2]);
1466 printstat(tcp, tcp->u_arg[2]);
1472 sys_fxstat(struct tcb *tcp)
1475 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
1478 if (tcp->u_arg[0] == _STAT64_VER)
1479 printstat64 (tcp, tcp->u_arg[2]);
1482 printstat(tcp, tcp->u_arg[2]);
1488 sys_lxstat(struct tcb *tcp)
1490 if (entering(tcp)) {
1491 tprintf("%ld, ", tcp->u_arg[0]);
1492 printpath(tcp, tcp->u_arg[1]);
1496 if (tcp->u_arg[0] == _STAT64_VER)
1497 printstat64 (tcp, tcp->u_arg[2]);
1500 printstat(tcp, tcp->u_arg[2]);
1506 sys_xmknod(struct tcb *tcp)
1508 int mode = tcp->u_arg[2];
1510 if (entering(tcp)) {
1511 tprintf("%ld, ", tcp->u_arg[0]);
1512 printpath(tcp, tcp->u_arg[1]);
1513 tprintf(", %s", sprintmode(mode));
1514 switch (mode & S_IFMT) {
1515 case S_IFCHR: case S_IFBLK:
1517 tprintf(", makedev(%lu, %lu)",
1518 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
1519 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
1521 tprintf(", makedev(%lu, %lu)",
1522 (unsigned long) major(tcp->u_arg[3]),
1523 (unsigned long) minor(tcp->u_arg[3]));
1533 #ifdef HAVE_SYS_ACL_H
1535 #include <sys/acl.h>
1537 static const struct xlat aclcmds[] = {
1539 { SETACL, "SETACL" },
1542 { GETACL, "GETACL" },
1545 { GETACLCNT, "GETACLCNT" },
1548 { ACL_GET, "ACL_GET" },
1551 { ACL_SET, "ACL_SET" },
1554 { ACL_CNT, "ACL_CNT" },
1560 sys_acl(struct tcb *tcp)
1562 if (entering(tcp)) {
1563 printpath(tcp, tcp->u_arg[0]);
1565 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1566 tprintf(", %ld", tcp->u_arg[2]);
1568 * FIXME - dump out the list of aclent_t's pointed to
1569 * by "tcp->u_arg[3]" if it's not NULL.
1572 tprintf(", %#lx", tcp->u_arg[3]);
1581 sys_facl(struct tcb *tcp)
1583 if (entering(tcp)) {
1584 tprintf("%ld, ", tcp->u_arg[0]);
1585 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1586 tprintf(", %ld", tcp->u_arg[2]);
1588 * FIXME - dump out the list of aclent_t's pointed to
1589 * by "tcp->u_arg[3]" if it's not NULL.
1592 tprintf(", %#lx", tcp->u_arg[3]);
1600 static const struct xlat aclipc[] = {
1602 { IPC_SHM, "IPC_SHM" },
1605 { IPC_SEM, "IPC_SEM" },
1608 { IPC_MSG, "IPC_MSG" },
1615 sys_aclipc(struct tcb *tcp)
1617 if (entering(tcp)) {
1618 printxval(aclipc, tcp->u_arg[0], "???IPC???");
1619 tprintf(", %#lx, ", tcp->u_arg[1]);
1620 printxval(aclcmds, tcp->u_arg[2], "???ACL???");
1621 tprintf(", %ld", tcp->u_arg[3]);
1623 * FIXME - dump out the list of aclent_t's pointed to
1624 * by "tcp->u_arg[4]" if it's not NULL.
1627 tprintf(", %#lx", tcp->u_arg[4]);
1634 #endif /* HAVE_SYS_ACL_H */
1636 #endif /* SVR4 || LINUXSPARC */
1640 static const struct xlat fsmagic[] = {
1641 { 0x73757245, "CODA_SUPER_MAGIC" },
1642 { 0x012ff7b7, "COH_SUPER_MAGIC" },
1643 { 0x1373, "DEVFS_SUPER_MAGIC" },
1644 { 0x1cd1, "DEVPTS_SUPER_MAGIC" },
1645 { 0x414A53, "EFS_SUPER_MAGIC" },
1646 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
1647 { 0xef53, "EXT2_SUPER_MAGIC" },
1648 { 0x137d, "EXT_SUPER_MAGIC" },
1649 { 0xf995e849, "HPFS_SUPER_MAGIC" },
1650 { 0x9660, "ISOFS_SUPER_MAGIC" },
1651 { 0x137f, "MINIX_SUPER_MAGIC" },
1652 { 0x138f, "MINIX_SUPER_MAGIC2" },
1653 { 0x2468, "MINIX2_SUPER_MAGIC" },
1654 { 0x2478, "MINIX2_SUPER_MAGIC2" },
1655 { 0x4d44, "MSDOS_SUPER_MAGIC" },
1656 { 0x564c, "NCP_SUPER_MAGIC" },
1657 { 0x6969, "NFS_SUPER_MAGIC" },
1658 { 0x9fa0, "PROC_SUPER_MAGIC" },
1659 { 0x002f, "QNX4_SUPER_MAGIC" },
1660 { 0x52654973, "REISERFS_SUPER_MAGIC" },
1661 { 0x02011994, "SHMFS_SUPER_MAGIC" },
1662 { 0x517b, "SMB_SUPER_MAGIC" },
1663 { 0x012ff7b6, "SYSV2_SUPER_MAGIC" },
1664 { 0x012ff7b5, "SYSV4_SUPER_MAGIC" },
1665 { 0x00011954, "UFS_MAGIC" },
1666 { 0x54190100, "UFS_CIGAM" },
1667 { 0x012ff7b4, "XENIX_SUPER_MAGIC" },
1668 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
1669 { 0x62656572, "SYSFS_MAGIC" },
1678 sprintfstype(int magic)
1680 static char buf[32];
1684 s = xlookup(fsmagic, magic);
1686 sprintf(buf, "\"%s\"", s);
1690 sprintf(buf, "%#x", magic);
1695 printstatfs(struct tcb *tcp, long addr)
1697 struct statfs statbuf;
1699 if (syserror(tcp) || !verbose(tcp)) {
1700 tprintf("%#lx", addr);
1703 if (umove(tcp, addr, &statbuf) < 0) {
1709 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
1710 sprintfstype(statbuf.f_type),
1711 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
1712 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_fsid={%d, %d}, f_namelen=%u",
1713 statbuf.f_bavail,statbuf.f_files, statbuf.f_ffree,
1714 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1],
1717 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
1718 sprintfstype(statbuf.f_type),
1719 (unsigned long)statbuf.f_bsize,
1720 (unsigned long)statbuf.f_blocks,
1721 (unsigned long)statbuf.f_bfree);
1722 tprintf("f_bavail=%lu, f_files=%lu, f_ffree=%lu, f_fsid={%d, %d}",
1723 (unsigned long)statbuf.f_bavail,
1724 (unsigned long)statbuf.f_files,
1725 (unsigned long)statbuf.f_ffree,
1726 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1728 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1731 #ifdef _STATFS_F_FRSIZE
1732 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
1738 sys_statfs(struct tcb *tcp)
1740 if (entering(tcp)) {
1741 printpath(tcp, tcp->u_arg[0]);
1744 printstatfs(tcp, tcp->u_arg[1]);
1750 sys_fstatfs(struct tcb *tcp)
1752 if (entering(tcp)) {
1753 tprintf("%lu, ", tcp->u_arg[0]);
1755 printstatfs(tcp, tcp->u_arg[1]);
1760 #if defined LINUX && defined HAVE_STATFS64
1762 printstatfs64(struct tcb *tcp, long addr)
1764 struct statfs64 statbuf;
1766 if (syserror(tcp) || !verbose(tcp)) {
1767 tprintf("%#lx", addr);
1770 if (umove(tcp, addr, &statbuf) < 0) {
1774 tprintf("{f_type=%s, f_bsize=%llu, f_blocks=%llu, f_bfree=%llu, ",
1775 sprintfstype(statbuf.f_type),
1776 (unsigned long long)statbuf.f_bsize,
1777 (unsigned long long)statbuf.f_blocks,
1778 (unsigned long long)statbuf.f_bfree);
1779 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
1780 (unsigned long long)statbuf.f_bavail,
1781 (unsigned long long)statbuf.f_files,
1782 (unsigned long long)statbuf.f_ffree,
1783 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1784 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1785 #ifdef _STATFS_F_FRSIZE
1786 tprintf(", f_frsize=%llu", (unsigned long long)statbuf.f_frsize);
1792 sys_statfs64(struct tcb *tcp)
1794 if (entering(tcp)) {
1795 printpath(tcp, tcp->u_arg[0]);
1796 tprintf(", %lu, ", tcp->u_arg[1]);
1798 if (tcp->u_arg[1] == sizeof (struct statfs64))
1799 printstatfs64(tcp, tcp->u_arg[2]);
1807 sys_fstatfs64(struct tcb *tcp)
1809 if (entering(tcp)) {
1810 tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
1812 if (tcp->u_arg[1] == sizeof (struct statfs64))
1813 printstatfs64(tcp, tcp->u_arg[2]);
1821 #if defined(LINUX) && defined(__alpha)
1824 osf_statfs(struct tcb *tcp)
1826 if (entering(tcp)) {
1827 printpath(tcp, tcp->u_arg[0]);
1830 printstatfs(tcp, tcp->u_arg[1]);
1831 tprintf(", %lu", tcp->u_arg[2]);
1837 osf_fstatfs(struct tcb *tcp)
1839 if (entering(tcp)) {
1840 tprintf("%lu, ", tcp->u_arg[0]);
1842 printstatfs(tcp, tcp->u_arg[1]);
1843 tprintf(", %lu", tcp->u_arg[2]);
1847 #endif /* LINUX && __alpha */
1853 sys_ustat(struct tcb *tcp)
1855 struct ustat statbuf;
1857 if (entering(tcp)) {
1858 tprintf("makedev(%lu, %lu), ",
1859 (long) major(tcp->u_arg[0]),
1860 (long) minor(tcp->u_arg[0]));
1863 if (syserror(tcp) || !verbose(tcp))
1864 tprintf("%#lx", tcp->u_arg[1]);
1865 else if (umove(tcp, tcp->u_arg[1], &statbuf) < 0)
1868 tprintf("{f_tfree=%lu, f_tinode=%lu, ",
1869 statbuf.f_tfree, statbuf.f_tinode);
1870 tprintf("f_fname=\"%.*s\", ",
1871 (int) sizeof(statbuf.f_fname),
1873 tprintf("f_fpack=\"%.*s\"}",
1874 (int) sizeof(statbuf.f_fpack),
1883 sys_pivotroot(struct tcb *tcp)
1885 if (entering(tcp)) {
1886 printpath(tcp, tcp->u_arg[0]);
1888 printpath(tcp, tcp->u_arg[1]);
1896 sys_chdir(struct tcb *tcp)
1898 if (entering(tcp)) {
1899 printpath(tcp, tcp->u_arg[0]);
1905 decode_mkdir(struct tcb *tcp, int offset)
1907 if (entering(tcp)) {
1908 printpath(tcp, tcp->u_arg[offset]);
1909 tprintf(", %#lo", tcp->u_arg[offset + 1]);
1915 sys_mkdir(struct tcb *tcp)
1917 return decode_mkdir(tcp, 0);
1922 sys_mkdirat(struct tcb *tcp)
1925 print_dirfd(tcp->u_arg[0]);
1926 return decode_mkdir(tcp, 1);
1931 sys_rmdir(struct tcb *tcp)
1933 if (entering(tcp)) {
1934 printpath(tcp, tcp->u_arg[0]);
1940 sys_fchdir(struct tcb *tcp)
1942 if (entering(tcp)) {
1943 tprintf("%ld", tcp->u_arg[0]);
1949 sys_chroot(struct tcb *tcp)
1951 if (entering(tcp)) {
1952 printpath(tcp, tcp->u_arg[0]);
1957 #if defined(SUNOS4) || defined(SVR4)
1959 sys_fchroot(struct tcb *tcp)
1961 if (entering(tcp)) {
1962 tprintf("%ld", tcp->u_arg[0]);
1966 #endif /* SUNOS4 || SVR4 */
1969 sys_link(struct tcb *tcp)
1971 if (entering(tcp)) {
1972 printpath(tcp, tcp->u_arg[0]);
1974 printpath(tcp, tcp->u_arg[1]);
1981 sys_linkat(struct tcb *tcp)
1983 if (entering(tcp)) {
1984 print_dirfd(tcp->u_arg[0]);
1985 printpath(tcp, tcp->u_arg[1]);
1987 print_dirfd(tcp->u_arg[2]);
1988 printpath(tcp, tcp->u_arg[3]);
1989 tprintf(", %ld", tcp->u_arg[4]);
1996 sys_unlink(struct tcb *tcp)
1998 if (entering(tcp)) {
1999 printpath(tcp, tcp->u_arg[0]);
2005 static const struct xlat unlinkatflags[] = {
2006 #ifndef AT_REMOVEDIR
2007 # define AT_REMOVEDIR 0x200
2009 { AT_REMOVEDIR, "AT_REMOVEDIR" },
2014 sys_unlinkat(struct tcb *tcp)
2016 if (entering(tcp)) {
2017 print_dirfd(tcp->u_arg[0]);
2018 printpath(tcp, tcp->u_arg[1]);
2020 printflags(unlinkatflags, tcp->u_arg[2], "AT_???");
2027 sys_symlink(struct tcb *tcp)
2029 if (entering(tcp)) {
2030 printpath(tcp, tcp->u_arg[0]);
2032 printpath(tcp, tcp->u_arg[1]);
2039 sys_symlinkat(struct tcb *tcp)
2041 if (entering(tcp)) {
2042 printpath(tcp, tcp->u_arg[0]);
2044 print_dirfd(tcp->u_arg[1]);
2045 printpath(tcp, tcp->u_arg[2]);
2052 decode_readlink(struct tcb *tcp, int offset)
2054 if (entering(tcp)) {
2055 printpath(tcp, tcp->u_arg[offset]);
2059 tprintf("%#lx", tcp->u_arg[offset + 1]);
2061 printpathn(tcp, tcp->u_arg[offset + 1], tcp->u_rval);
2062 tprintf(", %lu", tcp->u_arg[offset + 2]);
2068 sys_readlink(struct tcb *tcp)
2070 return decode_readlink(tcp, 0);
2075 sys_readlinkat(struct tcb *tcp)
2078 print_dirfd(tcp->u_arg[0]);
2079 return decode_readlink(tcp, 1);
2084 sys_rename(struct tcb *tcp)
2086 if (entering(tcp)) {
2087 printpath(tcp, tcp->u_arg[0]);
2089 printpath(tcp, tcp->u_arg[1]);
2096 sys_renameat(struct tcb *tcp)
2098 if (entering(tcp)) {
2099 print_dirfd(tcp->u_arg[0]);
2100 printpath(tcp, tcp->u_arg[1]);
2102 print_dirfd(tcp->u_arg[2]);
2103 printpath(tcp, tcp->u_arg[3]);
2110 sys_chown(struct tcb *tcp)
2112 if (entering(tcp)) {
2113 printpath(tcp, tcp->u_arg[0]);
2114 printuid(", ", tcp->u_arg[1]);
2115 printuid(", ", tcp->u_arg[2]);
2122 sys_fchownat(struct tcb *tcp)
2124 if (entering(tcp)) {
2125 print_dirfd(tcp->u_arg[0]);
2126 printpath(tcp, tcp->u_arg[1]);
2127 printuid(", ", tcp->u_arg[2]);
2128 printuid(", ", tcp->u_arg[3]);
2130 printflags(fstatatflags, tcp->u_arg[4], "AT_???");
2137 sys_fchown(struct tcb *tcp)
2139 if (entering(tcp)) {
2140 tprintf("%ld", tcp->u_arg[0]);
2141 printuid(", ", tcp->u_arg[1]);
2142 printuid(", ", tcp->u_arg[2]);
2148 decode_chmod(struct tcb *tcp, int offset)
2150 if (entering(tcp)) {
2151 printpath(tcp, tcp->u_arg[offset]);
2152 tprintf(", %#lo", tcp->u_arg[offset + 1]);
2158 sys_chmod(struct tcb *tcp)
2160 return decode_chmod(tcp, 0);
2165 sys_fchmodat(struct tcb *tcp)
2168 print_dirfd(tcp->u_arg[0]);
2169 return decode_chmod(tcp, 1);
2174 sys_fchmod(struct tcb *tcp)
2176 if (entering(tcp)) {
2177 tprintf("%ld, %#lo", tcp->u_arg[0], tcp->u_arg[1]);
2184 sys_osf_utimes(struct tcb *tcp)
2186 if (entering(tcp)) {
2187 printpath(tcp, tcp->u_arg[0]);
2189 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
2196 decode_utimes(struct tcb *tcp, int offset, int special)
2198 if (entering(tcp)) {
2199 printpath(tcp, tcp->u_arg[offset]);
2201 if (tcp->u_arg[offset + 1] == 0)
2205 printtv_bitness(tcp, tcp->u_arg[offset + 1],
2206 BITNESS_CURRENT, special);
2208 printtv_bitness(tcp, tcp->u_arg[offset + 1]
2209 + sizeof (struct timeval),
2210 BITNESS_CURRENT, special);
2218 sys_utimes(struct tcb *tcp)
2220 return decode_utimes(tcp, 0, 0);
2225 sys_futimesat(struct tcb *tcp)
2228 print_dirfd(tcp->u_arg[0]);
2229 return decode_utimes(tcp, 1, 0);
2233 sys_utimensat(struct tcb *tcp)
2235 if (entering(tcp)) {
2236 print_dirfd(tcp->u_arg[0]);
2237 decode_utimes(tcp, 1, 1);
2239 printflags(utimensatflags, tcp->u_arg[3], "AT_???");
2246 sys_utime(struct tcb *tcp)
2253 if (entering(tcp)) {
2254 printpath(tcp, tcp->u_arg[0]);
2258 else if (!verbose(tcp))
2259 tprintf("%#lx", tcp->u_arg[1]);
2260 else if (umoven(tcp, tcp->u_arg[1],
2261 2 * personality_wordsize[current_personality],
2264 else if (personality_wordsize[current_personality]
2265 == sizeof u.utl[0]) {
2266 tprintf("[%s,", sprinttime(u.utl[0]));
2267 tprintf(" %s]", sprinttime(u.utl[1]));
2269 else if (personality_wordsize[current_personality]
2270 == sizeof u.uti[0]) {
2271 tprintf("[%s,", sprinttime(u.uti[0]));
2272 tprintf(" %s]", sprinttime(u.uti[1]));
2281 decode_mknod(struct tcb *tcp, int offset)
2283 int mode = tcp->u_arg[offset + 1];
2285 if (entering(tcp)) {
2286 printpath(tcp, tcp->u_arg[offset]);
2287 tprintf(", %s", sprintmode(mode));
2288 switch (mode & S_IFMT) {
2289 case S_IFCHR: case S_IFBLK:
2291 if (current_personality == 1)
2292 tprintf(", makedev(%lu, %lu)",
2293 (unsigned long) ((tcp->u_arg[offset + 2] >> 18) & 0x3fff),
2294 (unsigned long) (tcp->u_arg[offset + 2] & 0x3ffff));
2297 tprintf(", makedev(%lu, %lu)",
2298 (unsigned long) major(tcp->u_arg[offset + 2]),
2299 (unsigned long) minor(tcp->u_arg[offset + 2]));
2309 sys_mknod(struct tcb *tcp)
2311 return decode_mknod(tcp, 0);
2316 sys_mknodat(struct tcb *tcp)
2319 print_dirfd(tcp->u_arg[0]);
2320 return decode_mknod(tcp, 1);
2326 sys_mkfifo(struct tcb *tcp)
2328 if (entering(tcp)) {
2329 printpath(tcp, tcp->u_arg[0]);
2330 tprintf(", %#lo", tcp->u_arg[1]);
2334 #endif /* FREEBSD */
2337 sys_fsync(struct tcb *tcp)
2339 if (entering(tcp)) {
2340 tprintf("%ld", tcp->u_arg[0]);
2348 printdir(struct tcb *tcp, long addr)
2352 if (!verbose(tcp)) {
2353 tprintf("%#lx", addr);
2356 if (umove(tcp, addr, &d) < 0) {
2360 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
2362 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
2367 sys_readdir(struct tcb *tcp)
2369 if (entering(tcp)) {
2370 tprintf("%lu, ", tcp->u_arg[0]);
2372 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
2373 tprintf("%#lx", tcp->u_arg[1]);
2375 printdir(tcp, tcp->u_arg[1]);
2376 /* Not much point in printing this out, it is always 1. */
2377 if (tcp->u_arg[2] != 1)
2378 tprintf(", %lu", tcp->u_arg[2]);
2385 #if defined FREEBSD || defined LINUX
2386 static const struct xlat direnttypes[] = {
2387 { DT_UNKNOWN, "DT_UNKNOWN" },
2388 { DT_FIFO, "DT_FIFO" },
2389 { DT_CHR, "DT_CHR" },
2390 { DT_DIR, "DT_DIR" },
2391 { DT_BLK, "DT_BLK" },
2392 { DT_REG, "DT_REG" },
2393 { DT_LNK, "DT_LNK" },
2394 { DT_SOCK, "DT_SOCK" },
2395 { DT_WHT, "DT_WHT" },
2402 sys_getdents(struct tcb *tcp)
2404 int i, len, dents = 0;
2407 if (entering(tcp)) {
2408 tprintf("%lu, ", tcp->u_arg[0]);
2411 if (syserror(tcp) || !verbose(tcp)) {
2412 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2416 buf = len ? malloc(len) : NULL;
2418 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2419 fprintf(stderr, "out of memory\n");
2422 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2423 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2429 for (i = 0; i < len;) {
2430 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
2433 tprintf("%s{d_ino=%lu, d_off=%lu, ",
2434 i ? " " : "", d->d_ino, d->d_off);
2435 tprintf("d_reclen=%u, d_name=\"%s\"}",
2436 d->d_reclen, d->d_name);
2441 tprintf("%s{d_ino=%lu, d_off=%lu, ",
2443 (unsigned long) d->d_ino,
2444 (unsigned long) d->d_off);
2445 tprintf("d_reclen=%u, d_name=\"%s\"}",
2446 d->d_reclen, d->d_name);
2451 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
2452 i ? " " : "", d->d_off, d->d_fileno,
2454 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
2455 d->d_namlen, d->d_namlen, d->d_name);
2460 tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
2461 i ? " " : "", d->d_fileno, d->d_reclen);
2462 printxval(direnttypes, d->d_type, "DT_???");
2463 tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
2464 d->d_namlen, d->d_namlen, d->d_name);
2466 #endif /* FREEBSD */
2468 tprintf("/* d_reclen == 0, problem here */");
2477 tprintf("/* %u entries */", dents);
2478 tprintf(", %lu", tcp->u_arg[2]);
2484 #if _LFS64_LARGEFILE
2486 sys_getdents64(struct tcb *tcp)
2488 int i, len, dents = 0;
2491 if (entering(tcp)) {
2492 tprintf("%lu, ", tcp->u_arg[0]);
2495 if (syserror(tcp) || !verbose(tcp)) {
2496 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2500 buf = len ? malloc(len) : NULL;
2502 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2503 fprintf(stderr, "out of memory\n");
2506 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2507 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2513 for (i = 0; i < len;) {
2514 struct dirent64 *d = (struct dirent64 *) &buf[i];
2515 #if defined(LINUX) || defined(SVR4)
2517 tprintf("%s{d_ino=%" PRIu64 ", d_off=%" PRId64 ", ",
2523 printxval(direnttypes, d->d_type, "DT_???");
2526 tprintf("d_reclen=%u, d_name=\"%s\"}",
2527 d->d_reclen, d->d_name);
2529 #endif /* LINUX || SVR4 */
2532 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
2533 i ? " " : "", d->d_off, d->d_fileno,
2535 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
2536 d->d_namlen, d->d_namlen, d->d_name);
2540 tprintf("/* d_reclen == 0, problem here */");
2549 tprintf("/* %u entries */", dents);
2550 tprintf(", %lu", tcp->u_arg[2]);
2558 sys_getdirentries(struct tcb *tcp)
2560 int i, len, dents = 0;
2564 if (entering(tcp)) {
2565 tprintf("%lu, ", tcp->u_arg[0]);
2568 if (syserror(tcp) || !verbose(tcp)) {
2569 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2573 if ((buf = malloc(len)) == NULL) {
2574 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2575 fprintf(stderr, "out of memory\n");
2578 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2579 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2585 for (i = 0; i < len;) {
2586 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
2588 tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
2589 i ? " " : "", d->d_fileno, d->d_reclen);
2590 printxval(direnttypes, d->d_type, "DT_???");
2591 tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
2592 d->d_namlen, d->d_namlen, d->d_name);
2595 tprintf("/* d_reclen == 0, problem here */");
2604 tprintf("/* %u entries */", dents);
2606 tprintf(", %lu", tcp->u_arg[2]);
2607 if (umove(tcp, tcp->u_arg[3], &basep) < 0)
2608 tprintf(", %#lx", tcp->u_arg[3]);
2610 tprintf(", [%lu]", basep);
2617 sys_getcwd(struct tcb *tcp)
2621 tprintf("%#lx", tcp->u_arg[0]);
2623 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
2624 tprintf(", %lu", tcp->u_arg[1]);
2632 sys___getcwd(struct tcb *tcp)
2636 tprintf("%#lx", tcp->u_arg[0]);
2638 printpathn(tcp, tcp->u_arg[0], tcp->u_arg[1]);
2639 tprintf(", %lu", tcp->u_arg[1]);
2645 #ifdef HAVE_SYS_ASYNCH_H
2648 sys_aioread(struct tcb *tcp)
2650 struct aio_result_t res;
2652 if (entering(tcp)) {
2653 tprintf("%lu, ", tcp->u_arg[0]);
2656 tprintf("%#lx", tcp->u_arg[1]);
2658 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2659 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2660 printxval(whence, tcp->u_arg[4], "L_???");
2661 if (syserror(tcp) || tcp->u_arg[5] == 0
2662 || umove(tcp, tcp->u_arg[5], &res) < 0)
2663 tprintf(", %#lx", tcp->u_arg[5]);
2665 tprintf(", {aio_return %d aio_errno %d}",
2666 res.aio_return, res.aio_errno);
2672 sys_aiowrite(struct tcb *tcp)
2674 struct aio_result_t res;
2676 if (entering(tcp)) {
2677 tprintf("%lu, ", tcp->u_arg[0]);
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_???");
2683 if (tcp->u_arg[5] == 0)
2685 else if (syserror(tcp)
2686 || umove(tcp, tcp->u_arg[5], &res) < 0)
2687 tprintf(", %#lx", tcp->u_arg[5]);
2689 tprintf(", {aio_return %d aio_errno %d}",
2690 res.aio_return, res.aio_errno);
2696 sys_aiowait(struct tcb *tcp)
2699 printtv(tcp, tcp->u_arg[0]);
2704 sys_aiocancel(struct tcb *tcp)
2706 struct aio_result_t res;
2709 if (tcp->u_arg[0] == 0)
2711 else if (syserror(tcp)
2712 || umove(tcp, tcp->u_arg[0], &res) < 0)
2713 tprintf("%#lx", tcp->u_arg[0]);
2715 tprintf("{aio_return %d aio_errno %d}",
2716 res.aio_return, res.aio_errno);
2721 #endif /* HAVE_SYS_ASYNCH_H */
2723 static const struct xlat xattrflags[] = {
2725 { XATTR_CREATE, "XATTR_CREATE" },
2726 { XATTR_REPLACE, "XATTR_REPLACE" },
2732 print_xattr_val(struct tcb *tcp, int failed,
2734 unsigned long insize,
2738 unsigned long capacity = 4 * size + 1;
2739 unsigned char *buf = (capacity < size) ? NULL : malloc(capacity);
2740 if (buf == NULL || /* probably a bogus size argument */
2741 umoven(tcp, arg, size, (char *) &buf[3 * size]) < 0) {
2745 unsigned char *out = buf;
2746 unsigned char *in = &buf[3 * size];
2748 for (i = 0; i < size; ++i) {
2752 #define tohex(n) "0123456789abcdef"[n]
2755 *out++ = tohex(in[i] / 16);
2756 *out++ = tohex(in[i] % 16);
2759 /* Don't print terminating NUL if there is one. */
2760 if (i > 0 && in[i - 1] == '\0')
2763 tprintf(", \"%s\", %ld", buf, insize);
2768 tprintf(", 0x%lx, %ld", arg, insize);
2772 sys_setxattr(struct tcb *tcp)
2774 if (entering(tcp)) {
2775 printpath(tcp, tcp->u_arg[0]);
2777 printstr(tcp, tcp->u_arg[1], -1);
2778 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2780 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2786 sys_fsetxattr(struct tcb *tcp)
2788 if (entering(tcp)) {
2789 tprintf("%ld, ", tcp->u_arg[0]);
2790 printstr(tcp, tcp->u_arg[1], -1);
2791 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2793 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2799 sys_getxattr(struct tcb *tcp)
2801 if (entering(tcp)) {
2802 printpath(tcp, tcp->u_arg[0]);
2804 printstr(tcp, tcp->u_arg[1], -1);
2806 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2813 sys_fgetxattr(struct tcb *tcp)
2815 if (entering(tcp)) {
2816 tprintf("%ld, ", tcp->u_arg[0]);
2817 printstr(tcp, tcp->u_arg[1], -1);
2819 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2826 sys_listxattr(struct tcb *tcp)
2828 if (entering(tcp)) {
2829 printpath(tcp, tcp->u_arg[0]);
2831 /* XXX Print value in format */
2832 tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]);
2838 sys_flistxattr(struct tcb *tcp)
2840 if (entering(tcp)) {
2841 tprintf("%ld", tcp->u_arg[0]);
2843 /* XXX Print value in format */
2844 tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]);
2850 sys_removexattr(struct tcb *tcp)
2852 if (entering(tcp)) {
2853 printpath(tcp, tcp->u_arg[0]);
2855 printstr(tcp, tcp->u_arg[1], -1);
2861 sys_fremovexattr(struct tcb *tcp)
2863 if (entering(tcp)) {
2864 tprintf("%ld, ", tcp->u_arg[0]);
2865 printstr(tcp, tcp->u_arg[1], -1);
2871 static const struct xlat advise[] = {
2872 { POSIX_FADV_NORMAL, "POSIX_FADV_NORMAL" },
2873 { POSIX_FADV_RANDOM, "POSIX_FADV_RANDOM" },
2874 { POSIX_FADV_SEQUENTIAL, "POSIX_FADV_SEQUENTIAL" },
2875 { POSIX_FADV_WILLNEED, "POSIX_FADV_WILLNEED" },
2876 { POSIX_FADV_DONTNEED, "POSIX_FADV_DONTNEED" },
2877 { POSIX_FADV_NOREUSE, "POSIX_FADV_NOREUSE" },
2884 sys_fadvise64(struct tcb *tcp)
2886 if (entering(tcp)) {
2888 tprintf("%ld, ", tcp->u_arg[0]);
2889 argn = printllval(tcp, "%lld", 1);
2890 tprintf(", %ld, ", tcp->u_arg[argn++]);
2891 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2899 sys_fadvise64_64(struct tcb *tcp)
2901 if (entering(tcp)) {
2903 tprintf("%ld, ", tcp->u_arg[0]);
2904 #if defined ARM || defined POWERPC
2905 argn = printllval(tcp, "%lld, ", 2);
2907 argn = printllval(tcp, "%lld, ", 1);
2909 argn = printllval(tcp, "%lld, ", argn);
2910 #if defined ARM || defined POWERPC
2911 printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
2913 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
2920 static const struct xlat inotify_modes[] = {
2921 { 0x00000001, "IN_ACCESS" },
2922 { 0x00000002, "IN_MODIFY" },
2923 { 0x00000004, "IN_ATTRIB" },
2924 { 0x00000008, "IN_CLOSE_WRITE" },
2925 { 0x00000010, "IN_CLOSE_NOWRITE" },
2926 { 0x00000020, "IN_OPEN" },
2927 { 0x00000040, "IN_MOVED_FROM" },
2928 { 0x00000080, "IN_MOVED_TO" },
2929 { 0x00000100, "IN_CREATE" },
2930 { 0x00000200, "IN_DELETE" },
2931 { 0x00000400, "IN_DELETE_SELF" },
2932 { 0x00000800, "IN_MOVE_SELF" },
2933 { 0x00002000, "IN_UNMOUNT" },
2934 { 0x00004000, "IN_Q_OVERFLOW" },
2935 { 0x00008000, "IN_IGNORED" },
2936 { 0x01000000, "IN_ONLYDIR" },
2937 { 0x02000000, "IN_DONT_FOLLOW" },
2938 { 0x20000000, "IN_MASK_ADD" },
2939 { 0x40000000, "IN_ISDIR" },
2940 { 0x80000000, "IN_ONESHOT" }
2944 sys_inotify_add_watch(struct tcb *tcp)
2946 if (entering(tcp)) {
2947 tprintf("%ld, ", tcp->u_arg[0]);
2948 printpath(tcp, tcp->u_arg[1]);
2950 printflags(inotify_modes, tcp->u_arg[2], "IN_???");
2956 sys_inotify_rm_watch(struct tcb *tcp)
2958 if (entering(tcp)) {
2959 tprintf("%ld, %ld", tcp->u_arg[0], tcp->u_arg[1]);
2965 sys_inotify_init1(struct tcb *tcp)
2968 printflags(open_mode_flags, tcp->u_arg[0], "O_???");
2973 sys_fallocate(struct tcb *tcp)
2975 if (entering(tcp)) {
2977 tprintf("%ld, ", tcp->u_arg[0]); /* fd */
2978 tprintf("%#lo, ", tcp->u_arg[1]); /* mode */
2979 argn = printllval(tcp, "%llu, ", 2); /* offset */
2980 printllval(tcp, "%llu", argn); /* len */