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.
34 #if defined(SPARC) || defined(SPARC64)
36 unsigned short st_dev;
38 unsigned short st_mode;
40 unsigned short st_uid;
41 unsigned short st_gid;
42 unsigned short st_rdev;
45 unsigned int __unused1;
47 unsigned int __unused2;
49 unsigned int __unused3;
52 unsigned int __unused4[2];
59 unsigned int st_nlink;
69 unsigned long __unused4[2];
72 # define stat kernel_stat
73 # include <asm/stat.h>
77 unsigned long long st_dev;
78 unsigned long long st_ino;
79 unsigned long long st_nlink;
85 unsigned long long st_rdev;
90 unsigned long long st_atime;
91 unsigned long long st_atime_nsec;
92 unsigned long long st_mtime;
93 unsigned long long st_mtime_nsec;
94 unsigned long long st_ctime;
95 unsigned long long st_ctime_nsec;
96 long long __unused[3];
100 unsigned long long st_dev;
101 unsigned char __pad0[4];
102 unsigned long __st_ino;
103 unsigned int st_mode;
104 unsigned int st_nlink;
105 unsigned long st_uid;
106 unsigned long st_gid;
107 unsigned long long st_rdev;
108 unsigned char __pad3[4];
110 unsigned long st_blksize;
111 unsigned long long st_blocks;
112 unsigned long st_atime;
113 unsigned long st_atime_nsec;
114 unsigned long st_mtime;
115 unsigned int st_mtime_nsec;
116 unsigned long st_ctime;
117 unsigned long st_ctime_nsec;
118 unsigned long long st_ino;
119 } __attribute__((packed));
120 # define HAVE_STAT64 1
122 struct __old_kernel_stat {
123 unsigned short st_dev;
124 unsigned short st_ino;
125 unsigned short st_mode;
126 unsigned short st_nlink;
127 unsigned short st_uid;
128 unsigned short st_gid;
129 unsigned short st_rdev;
130 unsigned int st_size;
131 unsigned int st_atime;
132 unsigned int st_mtime;
133 unsigned int st_ctime;
144 # define dev_t __kernel_dev_t
145 # define ino_t __kernel_ino_t
146 # define mode_t __kernel_mode_t
147 # define nlink_t __kernel_nlink_t
148 # define uid_t __kernel_uid_t
149 # define gid_t __kernel_gid_t
150 # define off_t __kernel_off_t
151 # define loff_t __kernel_loff_t
153 # include <asm/stat.h>
165 # define mode_t mode_t
166 # define nlink_t nlink_t
170 # define loff_t loff_t
173 #define stat libc_stat
174 #define stat64 libc_stat64
175 #include <sys/stat.h>
178 /* These might be macros. */
184 #ifdef HAVE_LINUX_XATTR_H
185 # include <linux/xattr.h>
187 # define XATTR_CREATE 1
188 # define XATTR_REPLACE 2
191 #ifdef MAJOR_IN_SYSMACROS
192 # include <sys/sysmacros.h>
195 #ifdef MAJOR_IN_MKDEV
196 # include <sys/mkdev.h>
200 # if O_LARGEFILE == 0 /* biarch platforms in 64-bit mode */
203 # define O_LARGEFILE 0x40000
204 # elif defined X86_64 || defined S390X
205 # define O_LARGEFILE 0100000
210 #include "xlat/open_access_modes.h"
211 #include "xlat/open_mode_flags.h"
214 # define AT_FDCWD -100
217 /* The fd is an "int", so when decoding x86 on x86_64, we need to force sign
218 * extension to get the right value. We do this by declaring fd as int here.
221 print_dirfd(struct tcb *tcp, int fd)
224 tprints("AT_FDCWD, ");
232 * low bits of the open(2) flags define access mode,
233 * other bits are real flags.
236 sprint_open_modes(int flags)
238 static char outstr[(1 + ARRAY_SIZE(open_mode_flags)) * sizeof("O_LARGEFILE")];
242 const struct xlat *x;
245 p = stpcpy(outstr, "flags");
246 str = xlookup(open_access_modes, flags & 3);
256 for (x = open_mode_flags; x->str; x++) {
257 if ((flags & x->val) == x->val) {
259 p = stpcpy(p, x->str);
266 /* flags is still nonzero */
268 sprintf(p, "%#x", flags);
273 tprint_open_modes(int flags)
275 tprints(sprint_open_modes(flags) + sizeof("flags"));
279 decode_open(struct tcb *tcp, int offset)
282 printpath(tcp, tcp->u_arg[offset]);
285 tprint_open_modes(tcp->u_arg[offset + 1]);
286 if (tcp->u_arg[offset + 1] & O_CREAT) {
288 tprintf(", %#lo", tcp->u_arg[offset + 2]);
295 sys_open(struct tcb *tcp)
297 return decode_open(tcp, 0);
301 sys_openat(struct tcb *tcp)
304 print_dirfd(tcp, tcp->u_arg[0]);
305 return decode_open(tcp, 1);
308 #if defined(SPARC) || defined(SPARC64)
309 #include "xlat/openmodessol.h"
312 solaris_open(struct tcb *tcp)
315 printpath(tcp, tcp->u_arg[0]);
318 printflags(openmodessol, tcp->u_arg[1] + 1, "O_???");
319 if (tcp->u_arg[1] & 0x100) {
321 tprintf(", %#lo", tcp->u_arg[2]);
330 sys_creat(struct tcb *tcp)
333 printpath(tcp, tcp->u_arg[0]);
334 tprintf(", %#lo", tcp->u_arg[1]);
339 #include "xlat/access_flags.h"
342 decode_access(struct tcb *tcp, int offset)
345 printpath(tcp, tcp->u_arg[offset]);
347 printflags(access_flags, tcp->u_arg[offset + 1], "?_OK");
353 sys_access(struct tcb *tcp)
355 return decode_access(tcp, 0);
359 sys_faccessat(struct tcb *tcp)
362 print_dirfd(tcp, tcp->u_arg[0]);
363 return decode_access(tcp, 1);
367 sys_umask(struct tcb *tcp)
370 tprintf("%#lo", tcp->u_arg[0]);
375 #include "xlat/whence_codes.h"
377 /* Linux kernel has exactly one version of lseek:
378 * fs/read_write.c::SYSCALL_DEFINE3(lseek, unsigned, fd, off_t, offset, unsigned, origin)
379 * In kernel, off_t is always the same as (kernel's) long
380 * (see include/uapi/asm-generic/posix_types.h),
381 * which means that on x32 we need to use tcp->ext_arg[N] to get offset argument.
382 * Use test/x32_lseek.c to test lseek decoding.
384 #if defined(LINUX_MIPSN32) || defined(X32)
386 sys_lseek(struct tcb *tcp)
392 printfd(tcp, tcp->u_arg[0]);
393 offset = tcp->ext_arg[1];
394 whence = tcp->u_arg[2];
395 if (whence == SEEK_SET)
396 tprintf(", %llu, ", offset);
398 tprintf(", %lld, ", offset);
399 printxval(whence_codes, whence, "SEEK_???");
401 return RVAL_LUDECIMAL;
405 sys_lseek(struct tcb *tcp)
411 printfd(tcp, tcp->u_arg[0]);
412 offset = tcp->u_arg[1];
413 whence = tcp->u_arg[2];
414 if (whence == SEEK_SET)
415 tprintf(", %lu, ", offset);
417 tprintf(", %ld, ", offset);
418 printxval(whence_codes, whence, "SEEK_???");
420 return RVAL_UDECIMAL;
424 /* llseek syscall takes explicitly two ulong arguments hi, lo,
425 * rather than one 64-bit argument for which LONG_LONG works
426 * appropriate for the native byte order.
428 * See kernel's fs/read_write.c::SYSCALL_DEFINE5(llseek, ...)
430 * hi,lo are "unsigned longs" and combined exactly this way in kernel:
431 * ((loff_t) hi << 32) | lo
432 * Note that for architectures with kernel's long wider than userspace long
433 * (such as x32), combining code will use *kernel's*, i.e. *wide* longs
434 * for hi and lo. We would need to use tcp->ext_arg[N] on x32...
435 * ...however, x32 (and x86_64) does not _have_ llseek syscall as such.
438 sys_llseek(struct tcb *tcp)
441 printfd(tcp, tcp->u_arg[0]);
442 if (tcp->u_arg[4] == SEEK_SET)
444 ((long long) tcp->u_arg[1]) << 32 |
445 (unsigned long long) (unsigned) tcp->u_arg[2]);
448 ((long long) tcp->u_arg[1]) << 32 |
449 (unsigned long long) (unsigned) tcp->u_arg[2]);
453 if (syserror(tcp) || umove(tcp, tcp->u_arg[3], &off) < 0)
454 tprintf("%#lx, ", tcp->u_arg[3]);
456 tprintf("[%llu], ", off);
457 printxval(whence_codes, tcp->u_arg[4], "SEEK_???");
463 sys_readahead(struct tcb *tcp)
467 printfd(tcp, tcp->u_arg[0]);
468 argn = printllval(tcp, ", %lld", 1);
469 tprintf(", %ld", tcp->u_arg[argn]);
475 sys_truncate(struct tcb *tcp)
478 printpath(tcp, tcp->u_arg[0]);
479 tprintf(", %lu", tcp->u_arg[1]);
485 sys_truncate64(struct tcb *tcp)
488 printpath(tcp, tcp->u_arg[0]);
489 printllval(tcp, ", %llu", 1);
495 sys_ftruncate(struct tcb *tcp)
498 printfd(tcp, tcp->u_arg[0]);
499 tprintf(", %lu", tcp->u_arg[1]);
505 sys_ftruncate64(struct tcb *tcp)
508 printfd(tcp, tcp->u_arg[0]);
509 printllval(tcp, ", %llu", 1);
516 #include "xlat/modetypes.h"
521 static char buf[sizeof("S_IFSOCK|S_ISUID|S_ISGID|S_ISVTX|%o")
526 if ((mode & S_IFMT) == 0)
528 else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) {
529 sprintf(buf, "%#o", mode);
532 s = buf + sprintf(buf, "%s%s%s%s", s,
533 (mode & S_ISUID) ? "|S_ISUID" : "",
534 (mode & S_ISGID) ? "|S_ISGID" : "",
535 (mode & S_ISVTX) ? "|S_ISVTX" : "");
536 mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX);
538 sprintf((char*)s, "|%#o", mode);
539 s = (*buf == '|') ? buf + 1 : buf;
547 static char buf[sizeof("yyyy/mm/dd-hh:mm:ss")];
555 snprintf(buf, sizeof buf, "%02d/%02d/%02d-%02d:%02d:%02d",
556 tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
557 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
559 snprintf(buf, sizeof buf, "%lu", (unsigned long) t);
564 #if defined(SPARC) || defined(SPARC64)
572 int st_pad1[3]; /* network id */
581 int st_pad3; /* st_size, off_t expansion */
582 timestruct_t st_atime;
583 timestruct_t st_mtime;
584 timestruct_t st_ctime;
588 int st_pad4[8]; /* expansion area */
592 printstatsol(struct tcb *tcp, long addr)
594 struct solstat statbuf;
596 if (umove(tcp, addr, &statbuf) < 0) {
601 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
602 (unsigned long) ((statbuf.st_dev >> 18) & 0x3fff),
603 (unsigned long) (statbuf.st_dev & 0x3ffff),
604 (unsigned long) statbuf.st_ino,
605 sprintmode(statbuf.st_mode));
606 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
607 (unsigned long) statbuf.st_nlink,
608 (unsigned long) statbuf.st_uid,
609 (unsigned long) statbuf.st_gid);
610 tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);
611 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
614 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
615 switch (statbuf.st_mode & S_IFMT) {
616 case S_IFCHR: case S_IFBLK:
617 tprintf("st_rdev=makedev(%lu, %lu), ",
618 (unsigned long) ((statbuf.st_rdev >> 18) & 0x3fff),
619 (unsigned long) (statbuf.st_rdev & 0x3ffff));
622 tprintf("st_size=%u, ", statbuf.st_size);
626 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime.tv_sec));
627 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime.tv_sec));
628 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime.tv_sec));
634 # if defined(SPARC64)
636 printstat_sparc64(struct tcb *tcp, long addr)
638 struct stat_sparc64 statbuf;
640 if (umove(tcp, addr, &statbuf) < 0) {
646 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
647 (unsigned long) major(statbuf.st_dev),
648 (unsigned long) minor(statbuf.st_dev),
649 (unsigned long) statbuf.st_ino,
650 sprintmode(statbuf.st_mode));
651 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
652 (unsigned long) statbuf.st_nlink,
653 (unsigned long) statbuf.st_uid,
654 (unsigned long) statbuf.st_gid);
655 tprintf("st_blksize=%lu, ",
656 (unsigned long) statbuf.st_blksize);
657 tprintf("st_blocks=%lu, ",
658 (unsigned long) statbuf.st_blocks);
661 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
662 switch (statbuf.st_mode & S_IFMT) {
663 case S_IFCHR: case S_IFBLK:
664 tprintf("st_rdev=makedev(%lu, %lu), ",
665 (unsigned long) major(statbuf.st_rdev),
666 (unsigned long) minor(statbuf.st_rdev));
669 tprintf("st_size=%lu, ", statbuf.st_size);
673 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
674 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
675 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
680 # endif /* SPARC64 */
681 #endif /* SPARC[64] */
683 #if defined POWERPC64
684 struct stat_powerpc32 {
687 unsigned int st_mode;
688 unsigned short st_nlink;
691 unsigned int st_rdev;
692 unsigned int st_size;
693 unsigned int st_blksize;
694 unsigned int st_blocks;
695 unsigned int st_atime;
696 unsigned int st_atime_nsec;
697 unsigned int st_mtime;
698 unsigned int st_mtime_nsec;
699 unsigned int st_ctime;
700 unsigned int st_ctime_nsec;
701 unsigned int __unused4;
702 unsigned int __unused5;
706 printstat_powerpc32(struct tcb *tcp, long addr)
708 struct stat_powerpc32 statbuf;
710 if (umove(tcp, addr, &statbuf) < 0) {
716 tprintf("{st_dev=makedev(%u, %u), st_ino=%u, st_mode=%s, ",
717 major(statbuf.st_dev), minor(statbuf.st_dev),
719 sprintmode(statbuf.st_mode));
720 tprintf("st_nlink=%u, st_uid=%u, st_gid=%u, ",
721 statbuf.st_nlink, statbuf.st_uid, statbuf.st_gid);
722 tprintf("st_blksize=%u, ", statbuf.st_blksize);
723 tprintf("st_blocks=%u, ", statbuf.st_blocks);
726 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
727 switch (statbuf.st_mode & S_IFMT) {
728 case S_IFCHR: case S_IFBLK:
729 tprintf("st_rdev=makedev(%lu, %lu), ",
730 (unsigned long) major(statbuf.st_rdev),
731 (unsigned long) minor(statbuf.st_rdev));
734 tprintf("st_size=%u, ", statbuf.st_size);
738 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
739 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
740 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
745 #endif /* POWERPC64 */
747 #include "xlat/fileflags.h"
750 realprintstat(struct tcb *tcp, struct stat *statbuf)
753 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
754 (unsigned long) major(statbuf->st_dev),
755 (unsigned long) minor(statbuf->st_dev),
756 (unsigned long) statbuf->st_ino,
757 sprintmode(statbuf->st_mode));
758 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
759 (unsigned long) statbuf->st_nlink,
760 (unsigned long) statbuf->st_uid,
761 (unsigned long) statbuf->st_gid);
762 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
763 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
765 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
766 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
770 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
771 switch (statbuf->st_mode & S_IFMT) {
772 case S_IFCHR: case S_IFBLK:
773 #ifdef HAVE_STRUCT_STAT_ST_RDEV
774 tprintf("st_rdev=makedev(%lu, %lu), ",
775 (unsigned long) major(statbuf->st_rdev),
776 (unsigned long) minor(statbuf->st_rdev));
777 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
778 tprintf("st_size=makedev(%lu, %lu), ",
779 (unsigned long) major(statbuf->st_size),
780 (unsigned long) minor(statbuf->st_size));
781 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
784 tprintf("st_size=%lu, ", (unsigned long) statbuf->st_size);
788 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
789 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
790 tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));
791 #if HAVE_STRUCT_STAT_ST_FLAGS
792 tprints(", st_flags=");
793 printflags(fileflags, statbuf->st_flags, "UF_???");
795 #if HAVE_STRUCT_STAT_ST_ACLCNT
796 tprintf(", st_aclcnt=%d", statbuf->st_aclcnt);
798 #if HAVE_STRUCT_STAT_ST_LEVEL
799 tprintf(", st_level=%ld", statbuf->st_level);
801 #if HAVE_STRUCT_STAT_ST_FSTYPE
802 tprintf(", st_fstype=%.*s",
803 (int) sizeof statbuf->st_fstype, statbuf->st_fstype);
805 #if HAVE_STRUCT_STAT_ST_GEN
806 tprintf(", st_gen=%u", statbuf->st_gen);
816 printstat(struct tcb *tcp, long addr)
824 if (syserror(tcp) || !verbose(tcp)) {
825 tprintf("%#lx", addr);
829 #if defined(SPARC) || defined(SPARC64)
830 if (current_personality == 1) {
831 printstatsol(tcp, addr);
835 else if (current_personality == 2) {
836 printstat_sparc64(tcp, addr);
840 #endif /* SPARC[64] */
842 #if defined POWERPC64
843 if (current_personality == 1) {
844 printstat_powerpc32(tcp, addr);
849 if (umove(tcp, addr, &statbuf) < 0) {
854 realprintstat(tcp, &statbuf);
857 # define printstat printstat64
860 #if !defined HAVE_STAT64 && (defined AARCH64 || defined X86_64)
862 * Linux x86_64 has unified `struct stat' but its i386 biarch needs
863 * `struct stat64'. Its <asm-i386/stat.h> definition expects 32-bit `long'.
864 * <linux/include/asm-x86_64/ia32.h> is not in the public includes set.
865 * __GNUC__ is needed for the required __attribute__ below.
867 * Similarly, aarch64 has a unified `struct stat' but its arm personality
868 * needs `struct stat64' (which also expects a 32-bit `long' but which
869 * shouldn't be packed).
872 unsigned long long st_dev;
873 unsigned char __pad0[4];
874 unsigned int __st_ino;
875 unsigned int st_mode;
876 unsigned int st_nlink;
879 unsigned long long st_rdev;
880 unsigned char __pad3[4];
882 unsigned int st_blksize;
883 unsigned long long st_blocks;
884 unsigned int st_atime;
885 unsigned int st_atime_nsec;
886 unsigned int st_mtime;
887 unsigned int st_mtime_nsec;
888 unsigned int st_ctime;
889 unsigned int st_ctime_nsec;
890 unsigned long long st_ino;
893 __attribute__((packed))
894 # define STAT64_SIZE 96
896 # define STAT64_SIZE 104
899 # define HAVE_STAT64 1
904 printstat64(struct tcb *tcp, long addr)
909 struct stat64 statbuf;
913 (void) sizeof(char[sizeof statbuf == STAT64_SIZE ? 1 : -1]);
920 if (syserror(tcp) || !verbose(tcp)) {
921 tprintf("%#lx", addr);
925 #if defined(SPARC) || defined(SPARC64)
926 if (current_personality == 1) {
927 printstatsol(tcp, addr);
931 else if (current_personality == 2) {
932 printstat_sparc64(tcp, addr);
936 #endif /* SPARC[64] */
939 if (current_personality != 0) {
940 printstat(tcp, addr);
945 if (current_personality != 1) {
946 printstat(tcp, addr);
951 if (umove(tcp, addr, &statbuf) < 0) {
957 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
958 (unsigned long) major(statbuf.st_dev),
959 (unsigned long) minor(statbuf.st_dev),
960 (unsigned long long) statbuf.st_ino,
961 sprintmode(statbuf.st_mode));
962 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
963 (unsigned long) statbuf.st_nlink,
964 (unsigned long) statbuf.st_uid,
965 (unsigned long) statbuf.st_gid);
966 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
967 tprintf("st_blksize=%lu, ",
968 (unsigned long) statbuf.st_blksize);
969 #endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */
970 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
971 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
972 #endif /* HAVE_STRUCT_STAT_ST_BLOCKS */
975 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
976 switch (statbuf.st_mode & S_IFMT) {
977 case S_IFCHR: case S_IFBLK:
978 #ifdef HAVE_STRUCT_STAT_ST_RDEV
979 tprintf("st_rdev=makedev(%lu, %lu), ",
980 (unsigned long) major(statbuf.st_rdev),
981 (unsigned long) minor(statbuf.st_rdev));
982 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
983 tprintf("st_size=makedev(%lu, %lu), ",
984 (unsigned long) major(statbuf.st_size),
985 (unsigned long) minor(statbuf.st_size));
986 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
989 tprintf("st_size=%llu, ", (unsigned long long) statbuf.st_size);
993 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
994 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
995 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
996 #if HAVE_STRUCT_STAT_ST_FLAGS
997 tprints(", st_flags=");
998 printflags(fileflags, statbuf.st_flags, "UF_???");
1000 #if HAVE_STRUCT_STAT_ST_ACLCNT
1001 tprintf(", st_aclcnt=%d", statbuf.st_aclcnt);
1003 #if HAVE_STRUCT_STAT_ST_LEVEL
1004 tprintf(", st_level=%ld", statbuf.st_level);
1006 #if HAVE_STRUCT_STAT_ST_FSTYPE
1007 tprintf(", st_fstype=%.*s",
1008 (int) sizeof statbuf.st_fstype, statbuf.st_fstype);
1010 #if HAVE_STRUCT_STAT_ST_GEN
1011 tprintf(", st_gen=%u", statbuf.st_gen);
1018 #endif /* HAVE_STAT64 */
1020 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1022 convertoldstat(const struct __old_kernel_stat *oldbuf, struct stat *newbuf)
1024 newbuf->st_dev = oldbuf->st_dev;
1025 newbuf->st_ino = oldbuf->st_ino;
1026 newbuf->st_mode = oldbuf->st_mode;
1027 newbuf->st_nlink = oldbuf->st_nlink;
1028 newbuf->st_uid = oldbuf->st_uid;
1029 newbuf->st_gid = oldbuf->st_gid;
1030 newbuf->st_rdev = oldbuf->st_rdev;
1031 newbuf->st_size = oldbuf->st_size;
1032 newbuf->st_atime = oldbuf->st_atime;
1033 newbuf->st_mtime = oldbuf->st_mtime;
1034 newbuf->st_ctime = oldbuf->st_ctime;
1035 newbuf->st_blksize = 0; /* not supported in old_stat */
1036 newbuf->st_blocks = 0; /* not supported in old_stat */
1040 printoldstat(struct tcb *tcp, long addr)
1042 struct __old_kernel_stat statbuf;
1043 struct stat newstatbuf;
1049 if (syserror(tcp) || !verbose(tcp)) {
1050 tprintf("%#lx", addr);
1054 # if defined(SPARC) || defined(SPARC64)
1055 if (current_personality == 1) {
1056 printstatsol(tcp, addr);
1061 if (umove(tcp, addr, &statbuf) < 0) {
1066 convertoldstat(&statbuf, &newstatbuf);
1067 realprintstat(tcp, &newstatbuf);
1072 sys_stat(struct tcb *tcp)
1074 if (entering(tcp)) {
1075 printpath(tcp, tcp->u_arg[0]);
1078 printstat(tcp, tcp->u_arg[1]);
1085 printstat64_x32(struct tcb *tcp, long addr)
1087 struct stat64 statbuf;
1093 if (syserror(tcp) || !verbose(tcp)) {
1094 tprintf("%#lx", addr);
1098 if (umove(tcp, addr, &statbuf) < 0) {
1104 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
1105 (unsigned long) major(statbuf.st_dev),
1106 (unsigned long) minor(statbuf.st_dev),
1107 (unsigned long long) statbuf.st_ino,
1108 sprintmode(statbuf.st_mode));
1109 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
1110 (unsigned long) statbuf.st_nlink,
1111 (unsigned long) statbuf.st_uid,
1112 (unsigned long) statbuf.st_gid);
1113 tprintf("st_blksize=%lu, ",
1114 (unsigned long) statbuf.st_blksize);
1115 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
1118 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
1119 switch (statbuf.st_mode & S_IFMT) {
1120 case S_IFCHR: case S_IFBLK:
1121 tprintf("st_rdev=makedev(%lu, %lu), ",
1122 (unsigned long) major(statbuf.st_rdev),
1123 (unsigned long) minor(statbuf.st_rdev));
1126 tprintf("st_size=%llu, ", (unsigned long long) statbuf.st_size);
1130 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
1131 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
1132 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
1141 sys_stat64(struct tcb *tcp)
1144 if (entering(tcp)) {
1145 printpath(tcp, tcp->u_arg[0]);
1149 printstat64_x32(tcp, tcp->u_arg[1]);
1151 printstat64(tcp, tcp->u_arg[1]);
1156 return printargs(tcp);
1160 #ifndef AT_SYMLINK_NOFOLLOW
1161 # define AT_SYMLINK_NOFOLLOW 0x100
1163 #ifndef AT_REMOVEDIR
1164 # define AT_REMOVEDIR 0x200
1166 #ifndef AT_SYMLINK_FOLLOW
1167 # define AT_SYMLINK_FOLLOW 0x400
1169 #ifndef AT_NO_AUTOMOUNT
1170 # define AT_NO_AUTOMOUNT 0x800
1172 #ifndef AT_EMPTY_PATH
1173 # define AT_EMPTY_PATH 0x1000
1176 #include "xlat/at_flags.h"
1179 sys_newfstatat(struct tcb *tcp)
1181 if (entering(tcp)) {
1182 print_dirfd(tcp, tcp->u_arg[0]);
1183 printpath(tcp, tcp->u_arg[1]);
1187 if (current_personality == 0)
1188 printstat(tcp, tcp->u_arg[2]);
1190 printstat64(tcp, tcp->u_arg[2]);
1191 #elif defined HAVE_STAT64
1192 printstat64(tcp, tcp->u_arg[2]);
1194 printstat(tcp, tcp->u_arg[2]);
1197 printflags(at_flags, tcp->u_arg[3], "AT_???");
1202 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1204 sys_oldstat(struct tcb *tcp)
1206 if (entering(tcp)) {
1207 printpath(tcp, tcp->u_arg[0]);
1210 printoldstat(tcp, tcp->u_arg[1]);
1217 sys_fstat(struct tcb *tcp)
1219 if (entering(tcp)) {
1220 printfd(tcp, tcp->u_arg[0]);
1223 printstat(tcp, tcp->u_arg[1]);
1229 sys_fstat64(struct tcb *tcp)
1232 if (entering(tcp)) {
1233 printfd(tcp, tcp->u_arg[0]);
1237 printstat64_x32(tcp, tcp->u_arg[1]);
1239 printstat64(tcp, tcp->u_arg[1]);
1244 return printargs(tcp);
1248 #if defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1250 sys_oldfstat(struct tcb *tcp)
1252 if (entering(tcp)) {
1253 printfd(tcp, tcp->u_arg[0]);
1256 printoldstat(tcp, tcp->u_arg[1]);
1262 #if defined(SPARC) || defined(SPARC64)
1265 sys_xstat(struct tcb *tcp)
1267 if (entering(tcp)) {
1268 tprintf("%ld, ", tcp->u_arg[0]);
1269 printpath(tcp, tcp->u_arg[1]);
1273 if (tcp->u_arg[0] == _STAT64_VER)
1274 printstat64(tcp, tcp->u_arg[2]);
1277 printstat(tcp, tcp->u_arg[2]);
1283 sys_fxstat(struct tcb *tcp)
1286 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
1289 if (tcp->u_arg[0] == _STAT64_VER)
1290 printstat64(tcp, tcp->u_arg[2]);
1293 printstat(tcp, tcp->u_arg[2]);
1299 sys_lxstat(struct tcb *tcp)
1301 if (entering(tcp)) {
1302 tprintf("%ld, ", tcp->u_arg[0]);
1303 printpath(tcp, tcp->u_arg[1]);
1307 if (tcp->u_arg[0] == _STAT64_VER)
1308 printstat64(tcp, tcp->u_arg[2]);
1311 printstat(tcp, tcp->u_arg[2]);
1317 sys_xmknod(struct tcb *tcp)
1319 int mode = tcp->u_arg[2];
1321 if (entering(tcp)) {
1322 tprintf("%ld, ", tcp->u_arg[0]);
1323 printpath(tcp, tcp->u_arg[1]);
1324 tprintf(", %s", sprintmode(mode));
1325 switch (mode & S_IFMT) {
1326 case S_IFCHR: case S_IFBLK:
1327 tprintf(", makedev(%lu, %lu)",
1328 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
1329 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
1338 # ifdef HAVE_SYS_ACL_H
1340 # include <sys/acl.h>
1342 #include "xlat/aclcmds.h"
1345 sys_acl(struct tcb *tcp)
1347 if (entering(tcp)) {
1348 printpath(tcp, tcp->u_arg[0]);
1350 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1351 tprintf(", %ld", tcp->u_arg[2]);
1353 * FIXME - dump out the list of aclent_t's pointed to
1354 * by "tcp->u_arg[3]" if it's not NULL.
1357 tprintf(", %#lx", tcp->u_arg[3]);
1365 sys_facl(struct tcb *tcp)
1367 if (entering(tcp)) {
1368 tprintf("%ld, ", tcp->u_arg[0]);
1369 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1370 tprintf(", %ld", tcp->u_arg[2]);
1372 * FIXME - dump out the list of aclent_t's pointed to
1373 * by "tcp->u_arg[3]" if it's not NULL.
1376 tprintf(", %#lx", tcp->u_arg[3]);
1383 #include "xlat/aclipc.h"
1386 sys_aclipc(struct tcb *tcp)
1388 if (entering(tcp)) {
1389 printxval(aclipc, tcp->u_arg[0], "???IPC???");
1390 tprintf(", %#lx, ", tcp->u_arg[1]);
1391 printxval(aclcmds, tcp->u_arg[2], "???ACL???");
1392 tprintf(", %ld", tcp->u_arg[3]);
1394 * FIXME - dump out the list of aclent_t's pointed to
1395 * by "tcp->u_arg[4]" if it's not NULL.
1398 tprintf(", %#lx", tcp->u_arg[4]);
1405 # endif /* HAVE_SYS_ACL_H */
1407 #endif /* SPARC[64] */
1411 sys_chdir(struct tcb *tcp)
1413 if (entering(tcp)) {
1414 printpath(tcp, tcp->u_arg[0]);
1420 decode_mkdir(struct tcb *tcp, int offset)
1422 if (entering(tcp)) {
1423 printpath(tcp, tcp->u_arg[offset]);
1424 tprintf(", %#lo", tcp->u_arg[offset + 1]);
1430 sys_mkdir(struct tcb *tcp)
1432 return decode_mkdir(tcp, 0);
1436 sys_mkdirat(struct tcb *tcp)
1439 print_dirfd(tcp, tcp->u_arg[0]);
1440 return decode_mkdir(tcp, 1);
1444 sys_link(struct tcb *tcp)
1446 if (entering(tcp)) {
1447 printpath(tcp, tcp->u_arg[0]);
1449 printpath(tcp, tcp->u_arg[1]);
1455 sys_linkat(struct tcb *tcp)
1457 if (entering(tcp)) {
1458 print_dirfd(tcp, tcp->u_arg[0]);
1459 printpath(tcp, tcp->u_arg[1]);
1461 print_dirfd(tcp, tcp->u_arg[2]);
1462 printpath(tcp, tcp->u_arg[3]);
1464 printflags(at_flags, tcp->u_arg[4], "AT_???");
1470 sys_unlinkat(struct tcb *tcp)
1472 if (entering(tcp)) {
1473 print_dirfd(tcp, tcp->u_arg[0]);
1474 printpath(tcp, tcp->u_arg[1]);
1476 printflags(at_flags, tcp->u_arg[2], "AT_???");
1482 sys_symlinkat(struct tcb *tcp)
1484 if (entering(tcp)) {
1485 printpath(tcp, tcp->u_arg[0]);
1487 print_dirfd(tcp, tcp->u_arg[1]);
1488 printpath(tcp, tcp->u_arg[2]);
1494 decode_readlink(struct tcb *tcp, int offset)
1496 if (entering(tcp)) {
1497 printpath(tcp, tcp->u_arg[offset]);
1501 tprintf("%#lx", tcp->u_arg[offset + 1]);
1503 /* Used to use printpathn(), but readlink
1504 * neither includes NUL in the returned count,
1505 * nor actually writes it into memory.
1506 * printpathn() would decide on printing
1507 * "..." continuation based on garbage
1508 * past return buffer's end.
1510 printstr(tcp, tcp->u_arg[offset + 1], tcp->u_rval);
1511 tprintf(", %lu", tcp->u_arg[offset + 2]);
1517 sys_readlink(struct tcb *tcp)
1519 return decode_readlink(tcp, 0);
1523 sys_readlinkat(struct tcb *tcp)
1526 print_dirfd(tcp, tcp->u_arg[0]);
1527 return decode_readlink(tcp, 1);
1531 decode_renameat(struct tcb *tcp)
1533 print_dirfd(tcp, tcp->u_arg[0]);
1534 printpath(tcp, tcp->u_arg[1]);
1536 print_dirfd(tcp, tcp->u_arg[2]);
1537 printpath(tcp, tcp->u_arg[3]);
1541 sys_renameat(struct tcb *tcp)
1543 if (entering(tcp)) {
1544 decode_renameat(tcp);
1549 #include "xlat/rename_flags.h"
1552 sys_renameat2(struct tcb *tcp)
1554 if (entering(tcp)) {
1555 decode_renameat(tcp);
1557 printflags(rename_flags, tcp->u_arg[4], "RENAME_??");
1563 sys_chown(struct tcb *tcp)
1565 if (entering(tcp)) {
1566 printpath(tcp, tcp->u_arg[0]);
1567 printuid(", ", tcp->u_arg[1]);
1568 printuid(", ", tcp->u_arg[2]);
1574 sys_fchownat(struct tcb *tcp)
1576 if (entering(tcp)) {
1577 print_dirfd(tcp, tcp->u_arg[0]);
1578 printpath(tcp, tcp->u_arg[1]);
1579 printuid(", ", tcp->u_arg[2]);
1580 printuid(", ", tcp->u_arg[3]);
1582 printflags(at_flags, tcp->u_arg[4], "AT_???");
1588 sys_fchown(struct tcb *tcp)
1590 if (entering(tcp)) {
1591 printfd(tcp, tcp->u_arg[0]);
1592 printuid(", ", tcp->u_arg[1]);
1593 printuid(", ", tcp->u_arg[2]);
1599 decode_chmod(struct tcb *tcp, int offset)
1601 if (entering(tcp)) {
1602 printpath(tcp, tcp->u_arg[offset]);
1603 tprintf(", %#lo", tcp->u_arg[offset + 1]);
1609 sys_chmod(struct tcb *tcp)
1611 return decode_chmod(tcp, 0);
1615 sys_fchmodat(struct tcb *tcp)
1618 print_dirfd(tcp, tcp->u_arg[0]);
1619 return decode_chmod(tcp, 1);
1623 sys_fchmod(struct tcb *tcp)
1625 if (entering(tcp)) {
1626 printfd(tcp, tcp->u_arg[0]);
1627 tprintf(", %#lo", tcp->u_arg[1]);
1634 sys_osf_utimes(struct tcb *tcp)
1636 if (entering(tcp)) {
1637 printpath(tcp, tcp->u_arg[0]);
1639 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
1646 decode_utimes(struct tcb *tcp, int offset, int special)
1648 if (entering(tcp)) {
1649 printpath(tcp, tcp->u_arg[offset]);
1651 if (tcp->u_arg[offset + 1] == 0)
1655 printtv_bitness(tcp, tcp->u_arg[offset + 1],
1656 BITNESS_CURRENT, special);
1658 printtv_bitness(tcp, tcp->u_arg[offset + 1]
1659 + sizeof(struct timeval),
1660 BITNESS_CURRENT, special);
1668 sys_utimes(struct tcb *tcp)
1670 return decode_utimes(tcp, 0, 0);
1674 sys_futimesat(struct tcb *tcp)
1677 print_dirfd(tcp, tcp->u_arg[0]);
1678 return decode_utimes(tcp, 1, 0);
1682 sys_utimensat(struct tcb *tcp)
1684 if (entering(tcp)) {
1685 print_dirfd(tcp, tcp->u_arg[0]);
1686 decode_utimes(tcp, 1, 1);
1688 printflags(at_flags, tcp->u_arg[3], "AT_???");
1694 sys_utime(struct tcb *tcp)
1699 long paranoia_for_huge_wordsize[4];
1703 if (entering(tcp)) {
1704 printpath(tcp, tcp->u_arg[0]);
1707 wordsize = current_wordsize;
1710 else if (!verbose(tcp))
1711 tprintf("%#lx", tcp->u_arg[1]);
1712 else if (umoven(tcp, tcp->u_arg[1], 2 * wordsize, (char *) &u) < 0)
1714 else if (wordsize == sizeof u.utl[0]) {
1715 tprintf("[%s,", sprinttime(u.utl[0]));
1716 tprintf(" %s]", sprinttime(u.utl[1]));
1718 else if (wordsize == sizeof u.uti[0]) {
1719 tprintf("[%s,", sprinttime(u.uti[0]));
1720 tprintf(" %s]", sprinttime(u.uti[1]));
1723 tprintf("<decode error: unsupported wordsize %d>",
1730 decode_mknod(struct tcb *tcp, int offset)
1732 int mode = tcp->u_arg[offset + 1];
1734 if (entering(tcp)) {
1735 printpath(tcp, tcp->u_arg[offset]);
1736 tprintf(", %s", sprintmode(mode));
1737 switch (mode & S_IFMT) {
1740 #if defined(SPARC) || defined(SPARC64)
1741 if (current_personality == 1)
1742 tprintf(", makedev(%lu, %lu)",
1743 (unsigned long) ((tcp->u_arg[offset + 2] >> 18) & 0x3fff),
1744 (unsigned long) (tcp->u_arg[offset + 2] & 0x3ffff));
1747 tprintf(", makedev(%lu, %lu)",
1748 (unsigned long) major(tcp->u_arg[offset + 2]),
1749 (unsigned long) minor(tcp->u_arg[offset + 2]));
1759 sys_mknod(struct tcb *tcp)
1761 return decode_mknod(tcp, 0);
1765 sys_mknodat(struct tcb *tcp)
1768 print_dirfd(tcp, tcp->u_arg[0]);
1769 return decode_mknod(tcp, 1);
1773 sys_getcwd(struct tcb *tcp)
1777 tprintf("%#lx", tcp->u_arg[0]);
1779 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
1780 tprintf(", %lu", tcp->u_arg[1]);
1785 #include "xlat/xattrflags.h"
1788 print_xattr_val(struct tcb *tcp, int failed,
1790 unsigned long insize,
1796 unsigned long capacity = 4 * size + 1;
1797 unsigned char *buf = (capacity < size) ? NULL : malloc(capacity);
1798 if (buf == NULL || /* probably a bogus size argument */
1799 umoven(tcp, arg, size, (char *) &buf[3 * size]) < 0) {
1803 unsigned char *out = buf;
1804 unsigned char *in = &buf[3 * size];
1806 for (i = 0; i < size; ++i) {
1807 if (in[i] >= ' ' && in[i] <= 0x7e)
1810 #define tohex(n) "0123456789abcdef"[n]
1813 *out++ = tohex(in[i] / 16);
1814 *out++ = tohex(in[i] % 16);
1817 /* Don't print terminating NUL if there is one. */
1818 if (i > 0 && in[i - 1] == '\0')
1821 tprintf(", \"%s\", %ld", buf, insize);
1826 tprintf(", 0x%lx, %ld", arg, insize);
1830 sys_setxattr(struct tcb *tcp)
1832 if (entering(tcp)) {
1833 printpath(tcp, tcp->u_arg[0]);
1835 printstr(tcp, tcp->u_arg[1], -1);
1836 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
1838 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
1844 sys_fsetxattr(struct tcb *tcp)
1846 if (entering(tcp)) {
1847 printfd(tcp, tcp->u_arg[0]);
1849 printstr(tcp, tcp->u_arg[1], -1);
1850 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
1852 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
1858 sys_getxattr(struct tcb *tcp)
1860 if (entering(tcp)) {
1861 printpath(tcp, tcp->u_arg[0]);
1863 printstr(tcp, tcp->u_arg[1], -1);
1865 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
1872 sys_fgetxattr(struct tcb *tcp)
1874 if (entering(tcp)) {
1875 printfd(tcp, tcp->u_arg[0]);
1877 printstr(tcp, tcp->u_arg[1], -1);
1879 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
1886 print_xattr_list(struct tcb *tcp, unsigned long addr, unsigned long size)
1888 if (syserror(tcp)) {
1889 tprintf("%#lx", addr);
1895 (size < (unsigned long) tcp->u_rval) ?
1896 size : (unsigned long) tcp->u_rval;
1897 printstr(tcp, addr, len);
1900 tprintf(", %lu", size);
1904 sys_listxattr(struct tcb *tcp)
1906 if (entering(tcp)) {
1907 printpath(tcp, tcp->u_arg[0]);
1910 print_xattr_list(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1916 sys_flistxattr(struct tcb *tcp)
1918 if (entering(tcp)) {
1919 printfd(tcp, tcp->u_arg[0]);
1922 print_xattr_list(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1928 sys_removexattr(struct tcb *tcp)
1930 if (entering(tcp)) {
1931 printpath(tcp, tcp->u_arg[0]);
1933 printstr(tcp, tcp->u_arg[1], -1);
1939 sys_fremovexattr(struct tcb *tcp)
1941 if (entering(tcp)) {
1942 printfd(tcp, tcp->u_arg[0]);
1944 printstr(tcp, tcp->u_arg[1], -1);
1949 #include "xlat/advise.h"
1952 sys_fadvise64(struct tcb *tcp)
1954 if (entering(tcp)) {
1956 printfd(tcp, tcp->u_arg[0]);
1957 argn = printllval(tcp, ", %lld", 1);
1958 tprintf(", %ld, ", tcp->u_arg[argn++]);
1959 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
1965 sys_fadvise64_64(struct tcb *tcp)
1967 if (entering(tcp)) {
1969 printfd(tcp, tcp->u_arg[0]);
1970 argn = printllval(tcp, ", %lld, ", 1);
1971 argn = printllval(tcp, "%lld, ", argn);
1972 #if defined __ARM_EABI__ || defined AARCH64 || defined POWERPC || defined XTENSA
1973 printxval(advise, tcp->u_arg[1], "POSIX_FADV_???");
1975 printxval(advise, tcp->u_arg[argn], "POSIX_FADV_???");
1981 #include "xlat/sync_file_range_flags.h"
1984 sys_sync_file_range(struct tcb *tcp)
1986 if (entering(tcp)) {
1988 printfd(tcp, tcp->u_arg[0]);
1989 argn = printllval(tcp, ", %lld, ", 1);
1990 argn = printllval(tcp, "%lld, ", argn);
1991 printflags(sync_file_range_flags, tcp->u_arg[argn],
1992 "SYNC_FILE_RANGE_???");
1998 sys_sync_file_range2(struct tcb *tcp)
2000 if (entering(tcp)) {
2002 printfd(tcp, tcp->u_arg[0]);
2003 printflags(sync_file_range_flags, 1,
2004 "SYNC_FILE_RANGE_???");
2005 argn = printllval(tcp, ", %lld, ", 2);
2006 argn = printllval(tcp, "%lld, ", argn);
2012 sys_fallocate(struct tcb *tcp)
2014 if (entering(tcp)) {
2016 printfd(tcp, tcp->u_arg[0]); /* fd */
2017 tprintf(", %#lo, ", tcp->u_arg[1]); /* mode */
2018 argn = printllval(tcp, "%llu, ", 2); /* offset */
2019 printllval(tcp, "%llu", argn); /* len */
2024 #ifndef SWAP_FLAG_PREFER
2025 # define SWAP_FLAG_PREFER 0x8000
2027 #ifndef SWAP_FLAG_DISCARD
2028 # define SWAP_FLAG_DISCARD 0x10000
2030 #include "xlat/swap_flags.h"
2033 sys_swapon(struct tcb *tcp)
2035 if (entering(tcp)) {
2036 int flags = tcp->u_arg[1];
2037 printpath(tcp, tcp->u_arg[0]);
2039 printflags(swap_flags, flags & ~SWAP_FLAG_PRIO_MASK,
2041 if (flags & SWAP_FLAG_PREFER)
2042 tprintf("|%d", flags & SWAP_FLAG_PRIO_MASK);