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(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)
613 tprintf("%ld, %lld, %ld", tcp->u_arg[0],
614 # if defined LINUX_MIPSN32
615 tcp->ext_arg[1], tcp->u_arg[2]
616 # elif defined IA64 || defined X86_64 || defined ALPHA || defined LINUX_MIPSN64
617 (long long int) tcp->u_arg[1], tcp->u_arg[2]
619 LONG_LONG(tcp->u_arg[1], tcp->u_arg[2]), tcp->u_arg[3]
627 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
629 sys_lseek64(struct tcb *tcp)
633 ALIGN64 (tcp, 1); /* FreeBSD aligns off_t args */
634 offset = LONG_LONG(tcp->u_arg [1], tcp->u_arg[2]);
635 if (tcp->u_arg[3] == SEEK_SET)
636 tprintf("%ld, %llu, ", tcp->u_arg[0], offset);
638 tprintf("%ld, %lld, ", tcp->u_arg[0], offset);
639 printxval(whence, tcp->u_arg[3], "SEEK_???");
641 return RVAL_LUDECIMAL;
645 #ifndef HAVE_LONG_LONG_OFF_T
647 sys_truncate(struct tcb *tcp)
650 printpath(tcp, tcp->u_arg[0]);
651 tprintf(", %lu", tcp->u_arg[1]);
657 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
659 sys_truncate64(struct tcb *tcp)
663 printpath(tcp, tcp->u_arg[0]);
664 tprintf(", %llu", LONG_LONG(tcp->u_arg[1],tcp->u_arg[2]));
670 #ifndef HAVE_LONG_LONG_OFF_T
672 sys_ftruncate(struct tcb *tcp)
675 tprintf("%ld, %lu", tcp->u_arg[0], tcp->u_arg[1]);
681 #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T
683 sys_ftruncate64(struct tcb *tcp)
687 tprintf("%ld, %llu", tcp->u_arg[0],
688 LONG_LONG(tcp->u_arg[1] ,tcp->u_arg[2]));
696 static const struct xlat modetypes[] = {
697 { S_IFREG, "S_IFREG" },
698 { S_IFSOCK, "S_IFSOCK" },
699 { S_IFIFO, "S_IFIFO" },
700 { S_IFLNK, "S_IFLNK" },
701 { S_IFDIR, "S_IFDIR" },
702 { S_IFBLK, "S_IFBLK" },
703 { S_IFCHR, "S_IFCHR" },
713 if ((mode & S_IFMT) == 0)
715 else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) {
716 sprintf(buf, "%#o", mode);
719 sprintf(buf, "%s%s%s%s", s,
720 (mode & S_ISUID) ? "|S_ISUID" : "",
721 (mode & S_ISGID) ? "|S_ISGID" : "",
722 (mode & S_ISVTX) ? "|S_ISVTX" : "");
723 mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX);
725 sprintf(buf + strlen(buf), "|%#o", mode);
726 s = (*buf == '|') ? buf + 1 : buf;
740 if ((tmp = localtime(&t)))
741 snprintf(buf, sizeof buf, "%02d/%02d/%02d-%02d:%02d:%02d",
742 tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
743 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
745 snprintf(buf, sizeof buf, "%lu", (unsigned long) t);
758 int st_pad1[3]; /* network id */
767 int st_pad3; /* st_size, off_t expansion */
768 timestruct_t st_atime;
769 timestruct_t st_mtime;
770 timestruct_t st_ctime;
774 int st_pad4[8]; /* expansion area */
778 printstatsol(struct tcb *tcp, long addr)
780 struct solstat statbuf;
786 if (syserror(tcp) || !verbose(tcp)) {
787 tprintf("%#lx", addr);
790 if (umove(tcp, addr, &statbuf) < 0) {
795 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
796 (unsigned long) ((statbuf.st_dev >> 18) & 0x3fff),
797 (unsigned long) (statbuf.st_dev & 0x3ffff),
798 (unsigned long) statbuf.st_ino,
799 sprintmode(statbuf.st_mode));
800 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
801 (unsigned long) statbuf.st_nlink,
802 (unsigned long) statbuf.st_uid,
803 (unsigned long) statbuf.st_gid);
804 tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);
805 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
808 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
809 switch (statbuf.st_mode & S_IFMT) {
810 case S_IFCHR: case S_IFBLK:
811 tprintf("st_rdev=makedev(%lu, %lu), ",
812 (unsigned long) ((statbuf.st_rdev >> 18) & 0x3fff),
813 (unsigned long) (statbuf.st_rdev & 0x3ffff));
816 tprintf("st_size=%u, ", statbuf.st_size);
820 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime.tv_sec));
821 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime.tv_sec));
822 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime.tv_sec));
828 #if defined (SPARC64)
830 printstat_sparc64(struct tcb *tcp, long addr)
832 struct stat_sparc64 statbuf;
838 if (syserror(tcp) || !verbose(tcp)) {
839 tprintf("%#lx", addr);
842 if (umove(tcp, addr, &statbuf) < 0) {
848 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
849 (unsigned long) major(statbuf.st_dev),
850 (unsigned long) minor(statbuf.st_dev),
851 (unsigned long) statbuf.st_ino,
852 sprintmode(statbuf.st_mode));
853 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
854 (unsigned long) statbuf.st_nlink,
855 (unsigned long) statbuf.st_uid,
856 (unsigned long) statbuf.st_gid);
857 tprintf("st_blksize=%lu, ",
858 (unsigned long) statbuf.st_blksize);
859 tprintf("st_blocks=%lu, ",
860 (unsigned long) statbuf.st_blocks);
863 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
864 switch (statbuf.st_mode & S_IFMT) {
865 case S_IFCHR: case S_IFBLK:
866 tprintf("st_rdev=makedev(%lu, %lu), ",
867 (unsigned long) major(statbuf.st_rdev),
868 (unsigned long) minor(statbuf.st_rdev));
871 tprintf("st_size=%lu, ", statbuf.st_size);
875 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
876 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
877 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
884 #endif /* LINUXSPARC */
886 static const struct xlat fileflags[] = {
888 { UF_NODUMP, "UF_NODUMP" },
889 { UF_IMMUTABLE, "UF_IMMUTABLE" },
890 { UF_APPEND, "UF_APPEND" },
891 { UF_OPAQUE, "UF_OPAQUE" },
892 { UF_NOUNLINK, "UF_NOUNLINK" },
893 { SF_ARCHIVED, "SF_ARCHIVED" },
894 { SF_IMMUTABLE, "SF_IMMUTABLE" },
895 { SF_APPEND, "SF_APPEND" },
896 { SF_NOUNLINK, "SF_NOUNLINK" },
899 { _S_ISMLD, "_S_ISMLD" },
902 { _S_ISMOUNTED, "_S_ISMOUNTED" },
910 sys_chflags(struct tcb *tcp)
913 printpath(tcp, tcp->u_arg[0]);
915 printflags(fileflags, tcp->u_arg[1], "UF_???");
921 sys_fchflags(struct tcb *tcp)
924 tprintf("%ld, ", tcp->u_arg[0]);
925 printflags(fileflags, tcp->u_arg[1], "UF_???");
931 #ifndef HAVE_LONG_LONG_OFF_T
933 realprintstat(struct tcb *tcp, struct stat *statbuf)
936 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
937 (unsigned long) major(statbuf->st_dev),
938 (unsigned long) minor(statbuf->st_dev),
939 (unsigned long) statbuf->st_ino,
940 sprintmode(statbuf->st_mode));
941 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
942 (unsigned long) statbuf->st_nlink,
943 (unsigned long) statbuf->st_uid,
944 (unsigned long) statbuf->st_gid);
945 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
946 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
948 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
949 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
953 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
954 switch (statbuf->st_mode & S_IFMT) {
955 case S_IFCHR: case S_IFBLK:
956 #ifdef HAVE_STRUCT_STAT_ST_RDEV
957 tprintf("st_rdev=makedev(%lu, %lu), ",
958 (unsigned long) major(statbuf->st_rdev),
959 (unsigned long) minor(statbuf->st_rdev));
960 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
961 tprintf("st_size=makedev(%lu, %lu), ",
962 (unsigned long) major(statbuf->st_size),
963 (unsigned long) minor(statbuf->st_size));
964 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
967 tprintf("st_size=%lu, ", statbuf->st_size);
971 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
972 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
973 tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime));
974 #if HAVE_STRUCT_STAT_ST_FLAGS
975 tprintf(", st_flags=");
976 printflags(fileflags, statbuf->st_flags, "UF_???");
978 #if HAVE_STRUCT_STAT_ST_ACLCNT
979 tprintf(", st_aclcnt=%d", statbuf->st_aclcnt);
981 #if HAVE_STRUCT_STAT_ST_LEVEL
982 tprintf(", st_level=%ld", statbuf->st_level);
984 #if HAVE_STRUCT_STAT_ST_FSTYPE
985 tprintf(", st_fstype=%.*s",
986 (int) sizeof statbuf->st_fstype, statbuf->st_fstype);
988 #if HAVE_STRUCT_STAT_ST_GEN
989 tprintf(", st_gen=%u", statbuf->st_gen);
999 printstat(struct tcb *tcp, long addr)
1001 struct stat statbuf;
1004 if (current_personality == 1) {
1005 printstatsol(tcp, addr);
1009 else if (current_personality == 2) {
1010 printstat_sparc64(tcp, addr);
1014 #endif /* LINUXSPARC */
1020 if (syserror(tcp) || !verbose(tcp)) {
1021 tprintf("%#lx", addr);
1024 if (umove(tcp, addr, &statbuf) < 0) {
1029 realprintstat(tcp, &statbuf);
1031 #endif /* !HAVE_LONG_LONG_OFF_T */
1033 #if !defined HAVE_STAT64 && defined LINUX && defined X86_64
1035 * Linux x86_64 has unified `struct stat' but its i386 biarch needs
1036 * `struct stat64'. Its <asm-i386/stat.h> definition expects 32-bit `long'.
1037 * <linux/include/asm-x86_64/ia32.h> is not in the public includes set.
1038 * __GNUC__ is needed for the required __attribute__ below.
1041 unsigned long long st_dev;
1042 unsigned char __pad0[4];
1043 unsigned int __st_ino;
1044 unsigned int st_mode;
1045 unsigned int st_nlink;
1046 unsigned int st_uid;
1047 unsigned int st_gid;
1048 unsigned long long st_rdev;
1049 unsigned char __pad3[4];
1051 unsigned int st_blksize;
1052 unsigned long long st_blocks;
1053 unsigned int st_atime;
1054 unsigned int st_atime_nsec;
1055 unsigned int st_mtime;
1056 unsigned int st_mtime_nsec;
1057 unsigned int st_ctime;
1058 unsigned int st_ctime_nsec;
1059 unsigned long long st_ino;
1060 } __attribute__((packed));
1061 # define HAVE_STAT64 1
1062 # define STAT64_SIZE 96
1067 printstat64(struct tcb *tcp, long addr)
1069 struct stat64 statbuf;
1072 (void) sizeof(char[sizeof statbuf == STAT64_SIZE ? 1 : -1]);
1076 if (current_personality == 1) {
1077 printstatsol(tcp, addr);
1081 else if (current_personality == 2) {
1082 printstat_sparc64(tcp, addr);
1086 #endif /* LINUXSPARC */
1092 if (syserror(tcp) || !verbose(tcp)) {
1093 tprintf("%#lx", addr);
1096 if (umove(tcp, addr, &statbuf) < 0) {
1102 #ifdef HAVE_LONG_LONG
1103 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
1105 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
1107 (unsigned long) major(statbuf.st_dev),
1108 (unsigned long) minor(statbuf.st_dev),
1109 #ifdef HAVE_LONG_LONG
1110 (unsigned long long) statbuf.st_ino,
1112 (unsigned long) statbuf.st_ino,
1114 sprintmode(statbuf.st_mode));
1115 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
1116 (unsigned long) statbuf.st_nlink,
1117 (unsigned long) statbuf.st_uid,
1118 (unsigned long) statbuf.st_gid);
1119 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
1120 tprintf("st_blksize=%lu, ",
1121 (unsigned long) statbuf.st_blksize);
1122 #endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */
1123 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
1124 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
1125 #endif /* HAVE_STRUCT_STAT_ST_BLOCKS */
1128 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
1129 switch (statbuf.st_mode & S_IFMT) {
1130 case S_IFCHR: case S_IFBLK:
1131 #ifdef HAVE_STRUCT_STAT_ST_RDEV
1132 tprintf("st_rdev=makedev(%lu, %lu), ",
1133 (unsigned long) major(statbuf.st_rdev),
1134 (unsigned long) minor(statbuf.st_rdev));
1135 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
1136 tprintf("st_size=makedev(%lu, %lu), ",
1137 (unsigned long) major(statbuf.st_size),
1138 (unsigned long) minor(statbuf.st_size));
1139 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
1142 #ifdef HAVE_LONG_LONG
1143 tprintf("st_size=%llu, ", (unsigned long long) statbuf.st_size);
1145 tprintf("st_size=%lu, ", (unsigned long) statbuf.st_size);
1150 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
1151 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
1152 tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
1153 #if HAVE_STRUCT_STAT_ST_FLAGS
1154 tprintf(", st_flags=");
1155 printflags(fileflags, statbuf.st_flags, "UF_???");
1157 #if HAVE_STRUCT_STAT_ST_ACLCNT
1158 tprintf(", st_aclcnt=%d", statbuf.st_aclcnt);
1160 #if HAVE_STRUCT_STAT_ST_LEVEL
1161 tprintf(", st_level=%ld", statbuf.st_level);
1163 #if HAVE_STRUCT_STAT_ST_FSTYPE
1164 tprintf(", st_fstype=%.*s",
1165 (int) sizeof statbuf.st_fstype, statbuf.st_fstype);
1167 #if HAVE_STRUCT_STAT_ST_GEN
1168 tprintf(", st_gen=%u", statbuf.st_gen);
1175 #endif /* HAVE_STAT64 */
1177 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1179 convertoldstat(const struct __old_kernel_stat *oldbuf, struct stat *newbuf)
1181 newbuf->st_dev = oldbuf->st_dev;
1182 newbuf->st_ino = oldbuf->st_ino;
1183 newbuf->st_mode = oldbuf->st_mode;
1184 newbuf->st_nlink = oldbuf->st_nlink;
1185 newbuf->st_uid = oldbuf->st_uid;
1186 newbuf->st_gid = oldbuf->st_gid;
1187 newbuf->st_rdev = oldbuf->st_rdev;
1188 newbuf->st_size = oldbuf->st_size;
1189 newbuf->st_atime = oldbuf->st_atime;
1190 newbuf->st_mtime = oldbuf->st_mtime;
1191 newbuf->st_ctime = oldbuf->st_ctime;
1192 newbuf->st_blksize = 0; /* not supported in old_stat */
1193 newbuf->st_blocks = 0; /* not supported in old_stat */
1198 printoldstat(struct tcb *tcp, long addr)
1200 struct __old_kernel_stat statbuf;
1201 struct stat newstatbuf;
1204 if (current_personality == 1) {
1205 printstatsol(tcp, addr);
1208 #endif /* LINUXSPARC */
1214 if (syserror(tcp) || !verbose(tcp)) {
1215 tprintf("%#lx", addr);
1218 if (umove(tcp, addr, &statbuf) < 0) {
1223 convertoldstat(&statbuf, &newstatbuf);
1224 realprintstat(tcp, &newstatbuf);
1226 #endif /* LINUX && !IA64 && !HPPA && !X86_64 && !S390 && !S390X */
1228 #ifndef HAVE_LONG_LONG_OFF_T
1230 sys_stat(struct tcb *tcp)
1232 if (entering(tcp)) {
1233 printpath(tcp, tcp->u_arg[0]);
1236 printstat(tcp, tcp->u_arg[1]);
1243 sys_stat64(struct tcb *tcp)
1246 if (entering(tcp)) {
1247 printpath(tcp, tcp->u_arg[0]);
1250 printstat64(tcp, tcp->u_arg[1]);
1254 return printargs(tcp);
1259 static const struct xlat fstatatflags[] = {
1260 #ifndef AT_SYMLINK_NOFOLLOW
1261 # define AT_SYMLINK_NOFOLLOW 0x100
1263 { AT_SYMLINK_NOFOLLOW, "AT_SYMLINK_NOFOLLOW" },
1266 #define utimensatflags fstatatflags
1269 sys_newfstatat(struct tcb *tcp)
1271 if (entering(tcp)) {
1272 print_dirfd(tcp->u_arg[0]);
1273 printpath(tcp, tcp->u_arg[1]);
1276 #if defined HAVE_STAT64 && !(defined POWERPC && defined __powerpc64__)
1277 printstat64(tcp, tcp->u_arg[2]);
1279 printstat(tcp, tcp->u_arg[2]);
1282 printflags(fstatatflags, tcp->u_arg[3], "AT_???");
1288 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1290 sys_oldstat(struct tcb *tcp)
1292 if (entering(tcp)) {
1293 printpath(tcp, tcp->u_arg[0]);
1296 printoldstat(tcp, tcp->u_arg[1]);
1300 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1302 #ifndef HAVE_LONG_LONG_OFF_T
1304 sys_fstat(struct tcb *tcp)
1307 tprintf("%ld, ", tcp->u_arg[0]);
1309 printstat(tcp, tcp->u_arg[1]);
1316 sys_fstat64(struct tcb *tcp)
1320 tprintf("%ld, ", tcp->u_arg[0]);
1322 printstat64(tcp, tcp->u_arg[1]);
1326 return printargs(tcp);
1330 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1332 sys_oldfstat(struct tcb *tcp)
1335 tprintf("%ld, ", tcp->u_arg[0]);
1337 printoldstat(tcp, tcp->u_arg[1]);
1341 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1343 #ifndef HAVE_LONG_LONG_OFF_T
1345 sys_lstat(struct tcb *tcp)
1347 if (entering(tcp)) {
1348 printpath(tcp, tcp->u_arg[0]);
1351 printstat(tcp, tcp->u_arg[1]);
1358 sys_lstat64(struct tcb *tcp)
1361 if (entering(tcp)) {
1362 printpath(tcp, tcp->u_arg[0]);
1365 printstat64(tcp, tcp->u_arg[1]);
1369 return printargs(tcp);
1373 #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
1375 sys_oldlstat(struct tcb *tcp)
1377 if (entering(tcp)) {
1378 printpath(tcp, tcp->u_arg[0]);
1381 printoldstat(tcp, tcp->u_arg[1]);
1385 #endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
1388 #if defined(SVR4) || defined(LINUXSPARC)
1391 sys_xstat(struct tcb *tcp)
1393 if (entering(tcp)) {
1394 tprintf("%ld, ", tcp->u_arg[0]);
1395 printpath(tcp, tcp->u_arg[1]);
1399 if (tcp->u_arg[0] == _STAT64_VER)
1400 printstat64 (tcp, tcp->u_arg[2]);
1403 printstat(tcp, tcp->u_arg[2]);
1409 sys_fxstat(struct tcb *tcp)
1412 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
1415 if (tcp->u_arg[0] == _STAT64_VER)
1416 printstat64 (tcp, tcp->u_arg[2]);
1419 printstat(tcp, tcp->u_arg[2]);
1425 sys_lxstat(struct tcb *tcp)
1427 if (entering(tcp)) {
1428 tprintf("%ld, ", tcp->u_arg[0]);
1429 printpath(tcp, tcp->u_arg[1]);
1433 if (tcp->u_arg[0] == _STAT64_VER)
1434 printstat64 (tcp, tcp->u_arg[2]);
1437 printstat(tcp, tcp->u_arg[2]);
1443 sys_xmknod(struct tcb *tcp)
1445 int mode = tcp->u_arg[2];
1447 if (entering(tcp)) {
1448 tprintf("%ld, ", tcp->u_arg[0]);
1449 printpath(tcp, tcp->u_arg[1]);
1450 tprintf(", %s", sprintmode(mode));
1451 switch (mode & S_IFMT) {
1452 case S_IFCHR: case S_IFBLK:
1454 tprintf(", makedev(%lu, %lu)",
1455 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
1456 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
1458 tprintf(", makedev(%lu, %lu)",
1459 (unsigned long) major(tcp->u_arg[3]),
1460 (unsigned long) minor(tcp->u_arg[3]));
1470 #ifdef HAVE_SYS_ACL_H
1472 #include <sys/acl.h>
1474 static const struct xlat aclcmds[] = {
1476 { SETACL, "SETACL" },
1479 { GETACL, "GETACL" },
1482 { GETACLCNT, "GETACLCNT" },
1485 { ACL_GET, "ACL_GET" },
1488 { ACL_SET, "ACL_SET" },
1491 { ACL_CNT, "ACL_CNT" },
1497 sys_acl(struct tcb *tcp)
1499 if (entering(tcp)) {
1500 printpath(tcp, tcp->u_arg[0]);
1502 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1503 tprintf(", %ld", tcp->u_arg[2]);
1505 * FIXME - dump out the list of aclent_t's pointed to
1506 * by "tcp->u_arg[3]" if it's not NULL.
1509 tprintf(", %#lx", tcp->u_arg[3]);
1518 sys_facl(struct tcb *tcp)
1520 if (entering(tcp)) {
1521 tprintf("%ld, ", tcp->u_arg[0]);
1522 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1523 tprintf(", %ld", tcp->u_arg[2]);
1525 * FIXME - dump out the list of aclent_t's pointed to
1526 * by "tcp->u_arg[3]" if it's not NULL.
1529 tprintf(", %#lx", tcp->u_arg[3]);
1537 static const struct xlat aclipc[] = {
1539 { IPC_SHM, "IPC_SHM" },
1542 { IPC_SEM, "IPC_SEM" },
1545 { IPC_MSG, "IPC_MSG" },
1552 sys_aclipc(struct tcb *tcp)
1554 if (entering(tcp)) {
1555 printxval(aclipc, tcp->u_arg[0], "???IPC???");
1556 tprintf(", %#lx, ", tcp->u_arg[1]);
1557 printxval(aclcmds, tcp->u_arg[2], "???ACL???");
1558 tprintf(", %ld", tcp->u_arg[3]);
1560 * FIXME - dump out the list of aclent_t's pointed to
1561 * by "tcp->u_arg[4]" if it's not NULL.
1564 tprintf(", %#lx", tcp->u_arg[4]);
1571 #endif /* HAVE_SYS_ACL_H */
1573 #endif /* SVR4 || LINUXSPARC */
1577 static const struct xlat fsmagic[] = {
1578 { 0x73757245, "CODA_SUPER_MAGIC" },
1579 { 0x012ff7b7, "COH_SUPER_MAGIC" },
1580 { 0x1373, "DEVFS_SUPER_MAGIC" },
1581 { 0x1cd1, "DEVPTS_SUPER_MAGIC" },
1582 { 0x414A53, "EFS_SUPER_MAGIC" },
1583 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
1584 { 0xef53, "EXT2_SUPER_MAGIC" },
1585 { 0x137d, "EXT_SUPER_MAGIC" },
1586 { 0xf995e849, "HPFS_SUPER_MAGIC" },
1587 { 0x9660, "ISOFS_SUPER_MAGIC" },
1588 { 0x137f, "MINIX_SUPER_MAGIC" },
1589 { 0x138f, "MINIX_SUPER_MAGIC2" },
1590 { 0x2468, "MINIX2_SUPER_MAGIC" },
1591 { 0x2478, "MINIX2_SUPER_MAGIC2" },
1592 { 0x4d44, "MSDOS_SUPER_MAGIC" },
1593 { 0x564c, "NCP_SUPER_MAGIC" },
1594 { 0x6969, "NFS_SUPER_MAGIC" },
1595 { 0x9fa0, "PROC_SUPER_MAGIC" },
1596 { 0x002f, "QNX4_SUPER_MAGIC" },
1597 { 0x52654973, "REISERFS_SUPER_MAGIC" },
1598 { 0x02011994, "SHMFS_SUPER_MAGIC" },
1599 { 0x517b, "SMB_SUPER_MAGIC" },
1600 { 0x012ff7b6, "SYSV2_SUPER_MAGIC" },
1601 { 0x012ff7b5, "SYSV4_SUPER_MAGIC" },
1602 { 0x00011954, "UFS_MAGIC" },
1603 { 0x54190100, "UFS_CIGAM" },
1604 { 0x012ff7b4, "XENIX_SUPER_MAGIC" },
1605 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
1606 { 0x62656572, "SYSFS_MAGIC" },
1615 sprintfstype(int magic)
1617 static char buf[32];
1621 s = xlookup(fsmagic, magic);
1623 sprintf(buf, "\"%s\"", s);
1627 sprintf(buf, "%#x", magic);
1632 printstatfs(struct tcb *tcp, long addr)
1634 struct statfs statbuf;
1636 if (syserror(tcp) || !verbose(tcp)) {
1637 tprintf("%#lx", addr);
1640 if (umove(tcp, addr, &statbuf) < 0) {
1646 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
1647 sprintfstype(statbuf.f_type),
1648 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
1649 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_fsid={%d, %d}, f_namelen=%u",
1650 statbuf.f_bavail,statbuf.f_files, statbuf.f_ffree,
1651 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1],
1654 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
1655 sprintfstype(statbuf.f_type),
1656 (unsigned long)statbuf.f_bsize,
1657 (unsigned long)statbuf.f_blocks,
1658 (unsigned long)statbuf.f_bfree);
1659 tprintf("f_bavail=%lu, f_files=%lu, f_ffree=%lu, f_fsid={%d, %d}",
1660 (unsigned long)statbuf.f_bavail,
1661 (unsigned long)statbuf.f_files,
1662 (unsigned long)statbuf.f_ffree,
1663 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1665 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1668 #ifdef _STATFS_F_FRSIZE
1669 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
1675 sys_statfs(struct tcb *tcp)
1677 if (entering(tcp)) {
1678 printpath(tcp, tcp->u_arg[0]);
1681 printstatfs(tcp, tcp->u_arg[1]);
1687 sys_fstatfs(struct tcb *tcp)
1689 if (entering(tcp)) {
1690 tprintf("%lu, ", tcp->u_arg[0]);
1692 printstatfs(tcp, tcp->u_arg[1]);
1699 printstatfs64(struct tcb *tcp, long addr)
1701 struct statfs64 statbuf;
1703 if (syserror(tcp) || !verbose(tcp)) {
1704 tprintf("%#lx", addr);
1707 if (umove(tcp, addr, &statbuf) < 0) {
1711 tprintf("{f_type=%s, f_bsize=%llu, f_blocks=%llu, f_bfree=%llu, ",
1712 sprintfstype(statbuf.f_type),
1713 (unsigned long long)statbuf.f_bsize,
1714 (unsigned long long)statbuf.f_blocks,
1715 (unsigned long long)statbuf.f_bfree);
1716 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
1717 (unsigned long long)statbuf.f_bavail,
1718 (unsigned long long)statbuf.f_files,
1719 (unsigned long long)statbuf.f_ffree,
1720 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
1721 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1722 #ifdef _STATFS_F_FRSIZE
1723 tprintf(", f_frsize=%llu", (unsigned long long)statbuf.f_frsize);
1729 sys_statfs64(struct tcb *tcp)
1731 if (entering(tcp)) {
1732 printpath(tcp, tcp->u_arg[0]);
1733 tprintf(", %lu, ", tcp->u_arg[1]);
1735 if (tcp->u_arg[1] == sizeof (struct statfs64))
1736 printstatfs64(tcp, tcp->u_arg[2]);
1744 sys_fstatfs64(struct tcb *tcp)
1746 if (entering(tcp)) {
1747 tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
1749 if (tcp->u_arg[1] == sizeof (struct statfs64))
1750 printstatfs64(tcp, tcp->u_arg[2]);
1758 #if defined(LINUX) && defined(__alpha)
1761 osf_statfs(struct tcb *tcp)
1763 if (entering(tcp)) {
1764 printpath(tcp, tcp->u_arg[0]);
1767 printstatfs(tcp, tcp->u_arg[1]);
1768 tprintf(", %lu", tcp->u_arg[2]);
1774 osf_fstatfs(struct tcb *tcp)
1776 if (entering(tcp)) {
1777 tprintf("%lu, ", tcp->u_arg[0]);
1779 printstatfs(tcp, tcp->u_arg[1]);
1780 tprintf(", %lu", tcp->u_arg[2]);
1784 #endif /* LINUX && __alpha */
1790 sys_ustat(struct tcb *tcp)
1792 struct ustat statbuf;
1794 if (entering(tcp)) {
1795 tprintf("makedev(%lu, %lu), ",
1796 (long) major(tcp->u_arg[0]),
1797 (long) minor(tcp->u_arg[0]));
1800 if (syserror(tcp) || !verbose(tcp))
1801 tprintf("%#lx", tcp->u_arg[1]);
1802 else if (umove(tcp, tcp->u_arg[1], &statbuf) < 0)
1805 tprintf("{f_tfree=%lu, f_tinode=%lu, ",
1806 statbuf.f_tfree, statbuf.f_tinode);
1807 tprintf("f_fname=\"%.*s\", ",
1808 (int) sizeof(statbuf.f_fname),
1810 tprintf("f_fpack=\"%.*s\"}",
1811 (int) sizeof(statbuf.f_fpack),
1820 sys_pivotroot(struct tcb *tcp)
1822 if (entering(tcp)) {
1823 printpath(tcp, tcp->u_arg[0]);
1825 printpath(tcp, tcp->u_arg[1]);
1833 sys_chdir(struct tcb *tcp)
1835 if (entering(tcp)) {
1836 printpath(tcp, tcp->u_arg[0]);
1842 decode_mkdir(struct tcb *tcp, int offset)
1844 if (entering(tcp)) {
1845 printpath(tcp, tcp->u_arg[offset]);
1846 tprintf(", %#lo", tcp->u_arg[offset + 1]);
1852 sys_mkdir(struct tcb *tcp)
1854 return decode_mkdir(tcp, 0);
1859 sys_mkdirat(struct tcb *tcp)
1862 print_dirfd(tcp->u_arg[0]);
1863 return decode_mkdir(tcp, 1);
1868 sys_rmdir(struct tcb *tcp)
1870 if (entering(tcp)) {
1871 printpath(tcp, tcp->u_arg[0]);
1877 sys_fchdir(struct tcb *tcp)
1879 if (entering(tcp)) {
1880 tprintf("%ld", tcp->u_arg[0]);
1886 sys_chroot(struct tcb *tcp)
1888 if (entering(tcp)) {
1889 printpath(tcp, tcp->u_arg[0]);
1894 #if defined(SUNOS4) || defined(SVR4)
1896 sys_fchroot(struct tcb *tcp)
1898 if (entering(tcp)) {
1899 tprintf("%ld", tcp->u_arg[0]);
1903 #endif /* SUNOS4 || SVR4 */
1906 sys_link(struct tcb *tcp)
1908 if (entering(tcp)) {
1909 printpath(tcp, tcp->u_arg[0]);
1911 printpath(tcp, tcp->u_arg[1]);
1918 sys_linkat(struct tcb *tcp)
1920 if (entering(tcp)) {
1921 print_dirfd(tcp->u_arg[0]);
1922 printpath(tcp, tcp->u_arg[1]);
1924 print_dirfd(tcp->u_arg[2]);
1925 printpath(tcp, tcp->u_arg[3]);
1926 tprintf(", %ld", tcp->u_arg[4]);
1933 sys_unlink(struct tcb *tcp)
1935 if (entering(tcp)) {
1936 printpath(tcp, tcp->u_arg[0]);
1942 static const struct xlat unlinkatflags[] = {
1943 #ifndef AT_REMOVEDIR
1944 # define AT_REMOVEDIR 0x200
1946 { AT_REMOVEDIR, "AT_REMOVEDIR" },
1951 sys_unlinkat(struct tcb *tcp)
1953 if (entering(tcp)) {
1954 print_dirfd(tcp->u_arg[0]);
1955 printpath(tcp, tcp->u_arg[1]);
1957 printflags(unlinkatflags, tcp->u_arg[2], "AT_???");
1964 sys_symlink(struct tcb *tcp)
1966 if (entering(tcp)) {
1967 printpath(tcp, tcp->u_arg[0]);
1969 printpath(tcp, tcp->u_arg[1]);
1976 sys_symlinkat(struct tcb *tcp)
1978 if (entering(tcp)) {
1979 printpath(tcp, tcp->u_arg[0]);
1981 print_dirfd(tcp->u_arg[1]);
1982 printpath(tcp, tcp->u_arg[2]);
1989 decode_readlink(struct tcb *tcp, int offset)
1991 if (entering(tcp)) {
1992 printpath(tcp, tcp->u_arg[offset]);
1996 tprintf("%#lx", tcp->u_arg[offset + 1]);
1998 printpathn(tcp, tcp->u_arg[offset + 1], tcp->u_rval);
1999 tprintf(", %lu", tcp->u_arg[offset + 2]);
2005 sys_readlink(struct tcb *tcp)
2007 return decode_readlink(tcp, 0);
2012 sys_readlinkat(struct tcb *tcp)
2015 print_dirfd(tcp->u_arg[0]);
2016 return decode_readlink(tcp, 1);
2021 sys_rename(struct tcb *tcp)
2023 if (entering(tcp)) {
2024 printpath(tcp, tcp->u_arg[0]);
2026 printpath(tcp, tcp->u_arg[1]);
2033 sys_renameat(struct tcb *tcp)
2035 if (entering(tcp)) {
2036 print_dirfd(tcp->u_arg[0]);
2037 printpath(tcp, tcp->u_arg[1]);
2039 print_dirfd(tcp->u_arg[2]);
2040 printpath(tcp, tcp->u_arg[3]);
2047 sys_chown(struct tcb *tcp)
2049 if (entering(tcp)) {
2050 printpath(tcp, tcp->u_arg[0]);
2051 printuid(", ", tcp->u_arg[1]);
2052 printuid(", ", tcp->u_arg[2]);
2059 sys_fchownat(struct tcb *tcp)
2061 if (entering(tcp)) {
2062 print_dirfd(tcp->u_arg[0]);
2063 printpath(tcp, tcp->u_arg[1]);
2064 printuid(", ", tcp->u_arg[2]);
2065 printuid(", ", tcp->u_arg[3]);
2067 printflags(fstatatflags, tcp->u_arg[4], "AT_???");
2074 sys_fchown(struct tcb *tcp)
2076 if (entering(tcp)) {
2077 tprintf("%ld", tcp->u_arg[0]);
2078 printuid(", ", tcp->u_arg[1]);
2079 printuid(", ", tcp->u_arg[2]);
2085 decode_chmod(struct tcb *tcp, int offset)
2087 if (entering(tcp)) {
2088 printpath(tcp, tcp->u_arg[offset]);
2089 tprintf(", %#lo", tcp->u_arg[offset + 1]);
2095 sys_chmod(struct tcb *tcp)
2097 return decode_chmod(tcp, 0);
2102 sys_fchmodat(struct tcb *tcp)
2105 print_dirfd(tcp->u_arg[0]);
2106 return decode_chmod(tcp, 1);
2111 sys_fchmod(struct tcb *tcp)
2113 if (entering(tcp)) {
2114 tprintf("%ld, %#lo", tcp->u_arg[0], tcp->u_arg[1]);
2121 sys_osf_utimes(struct tcb *tcp)
2123 if (entering(tcp)) {
2124 printpath(tcp, tcp->u_arg[0]);
2126 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
2133 decode_utimes(struct tcb *tcp, int offset, int special)
2135 if (entering(tcp)) {
2136 printpath(tcp, tcp->u_arg[offset]);
2138 if (tcp->u_arg[offset + 1] == 0)
2142 printtv_bitness(tcp, tcp->u_arg[offset + 1],
2143 BITNESS_CURRENT, special);
2145 printtv_bitness(tcp, tcp->u_arg[offset + 1]
2146 + sizeof (struct timeval),
2147 BITNESS_CURRENT, special);
2155 sys_utimes(struct tcb *tcp)
2157 return decode_utimes(tcp, 0, 0);
2162 sys_futimesat(struct tcb *tcp)
2165 print_dirfd(tcp->u_arg[0]);
2166 return decode_utimes(tcp, 1, 0);
2170 sys_utimensat(struct tcb *tcp)
2172 if (entering(tcp)) {
2173 print_dirfd(tcp->u_arg[0]);
2174 decode_utimes(tcp, 1, 1);
2176 printflags(utimensatflags, tcp->u_arg[3], "AT_???");
2183 sys_utime(struct tcb *tcp)
2190 if (entering(tcp)) {
2191 printpath(tcp, tcp->u_arg[0]);
2195 else if (!verbose(tcp))
2196 tprintf("%#lx", tcp->u_arg[1]);
2197 else if (umoven(tcp, tcp->u_arg[1],
2198 2 * personality_wordsize[current_personality],
2201 else if (personality_wordsize[current_personality]
2202 == sizeof u.utl[0]) {
2203 tprintf("[%s,", sprinttime(u.utl[0]));
2204 tprintf(" %s]", sprinttime(u.utl[1]));
2206 else if (personality_wordsize[current_personality]
2207 == sizeof u.uti[0]) {
2208 tprintf("[%s,", sprinttime(u.uti[0]));
2209 tprintf(" %s]", sprinttime(u.uti[1]));
2218 decode_mknod(struct tcb *tcp, int offset)
2220 int mode = tcp->u_arg[offset + 1];
2222 if (entering(tcp)) {
2223 printpath(tcp, tcp->u_arg[offset]);
2224 tprintf(", %s", sprintmode(mode));
2225 switch (mode & S_IFMT) {
2226 case S_IFCHR: case S_IFBLK:
2228 if (current_personality == 1)
2229 tprintf(", makedev(%lu, %lu)",
2230 (unsigned long) ((tcp->u_arg[offset + 2] >> 18) & 0x3fff),
2231 (unsigned long) (tcp->u_arg[offset + 2] & 0x3ffff));
2234 tprintf(", makedev(%lu, %lu)",
2235 (unsigned long) major(tcp->u_arg[offset + 2]),
2236 (unsigned long) minor(tcp->u_arg[offset + 2]));
2246 sys_mknod(struct tcb *tcp)
2248 return decode_mknod(tcp, 0);
2253 sys_mknodat(struct tcb *tcp)
2256 print_dirfd(tcp->u_arg[0]);
2257 return decode_mknod(tcp, 1);
2263 sys_mkfifo(struct tcb *tcp)
2265 if (entering(tcp)) {
2266 printpath(tcp, tcp->u_arg[0]);
2267 tprintf(", %#lo", tcp->u_arg[1]);
2271 #endif /* FREEBSD */
2274 sys_fsync(struct tcb *tcp)
2276 if (entering(tcp)) {
2277 tprintf("%ld", tcp->u_arg[0]);
2285 printdir(struct tcb *tcp, long addr)
2289 if (!verbose(tcp)) {
2290 tprintf("%#lx", addr);
2293 if (umove(tcp, addr, &d) < 0) {
2297 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
2299 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
2304 sys_readdir(struct tcb *tcp)
2306 if (entering(tcp)) {
2307 tprintf("%lu, ", tcp->u_arg[0]);
2309 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
2310 tprintf("%#lx", tcp->u_arg[1]);
2312 printdir(tcp, tcp->u_arg[1]);
2313 /* Not much point in printing this out, it is always 1. */
2314 if (tcp->u_arg[2] != 1)
2315 tprintf(", %lu", tcp->u_arg[2]);
2322 #if defined FREEBSD || defined LINUX
2323 static const struct xlat direnttypes[] = {
2324 { DT_UNKNOWN, "DT_UNKNOWN" },
2325 { DT_FIFO, "DT_FIFO" },
2326 { DT_CHR, "DT_CHR" },
2327 { DT_DIR, "DT_DIR" },
2328 { DT_BLK, "DT_BLK" },
2329 { DT_REG, "DT_REG" },
2330 { DT_LNK, "DT_LNK" },
2331 { DT_SOCK, "DT_SOCK" },
2332 { DT_WHT, "DT_WHT" },
2339 sys_getdents(struct tcb *tcp)
2341 int i, len, dents = 0;
2344 if (entering(tcp)) {
2345 tprintf("%lu, ", tcp->u_arg[0]);
2348 if (syserror(tcp) || !verbose(tcp)) {
2349 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2353 if ((buf = malloc(len)) == NULL) {
2354 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2355 fprintf(stderr, "out of memory\n");
2358 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2359 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2365 for (i = 0; i < len;) {
2366 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
2369 tprintf("%s{d_ino=%lu, d_off=%lu, ",
2370 i ? " " : "", d->d_ino, d->d_off);
2371 tprintf("d_reclen=%u, d_name=\"%s\"}",
2372 d->d_reclen, d->d_name);
2377 tprintf("%s{d_ino=%lu, d_off=%lu, ",
2379 (unsigned long) d->d_ino,
2380 (unsigned long) d->d_off);
2381 tprintf("d_reclen=%u, d_name=\"%s\"}",
2382 d->d_reclen, d->d_name);
2387 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
2388 i ? " " : "", d->d_off, d->d_fileno,
2390 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
2391 d->d_namlen, d->d_namlen, d->d_name);
2396 tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
2397 i ? " " : "", d->d_fileno, d->d_reclen);
2398 printxval(direnttypes, d->d_type, "DT_???");
2399 tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
2400 d->d_namlen, d->d_namlen, d->d_name);
2402 #endif /* FREEBSD */
2404 tprintf("/* d_reclen == 0, problem here */");
2413 tprintf("/* %u entries */", dents);
2414 tprintf(", %lu", tcp->u_arg[2]);
2420 #if _LFS64_LARGEFILE
2422 sys_getdents64(struct tcb *tcp)
2424 int i, len, dents = 0;
2427 if (entering(tcp)) {
2428 tprintf("%lu, ", tcp->u_arg[0]);
2431 if (syserror(tcp) || !verbose(tcp)) {
2432 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2436 if ((buf = malloc(len)) == NULL) {
2437 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2438 fprintf(stderr, "out of memory\n");
2441 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2442 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
2448 for (i = 0; i < len;) {
2449 struct dirent64 *d = (struct dirent64 *) &buf[i];
2450 #if defined(LINUX) || defined(SVR4)
2452 tprintf("%s{d_ino=%" PRIu64 ", d_off=%" PRId64 ", ",
2458 printxval(direnttypes, d->d_type, "DT_???");
2461 tprintf("d_reclen=%u, d_name=\"%s\"}",
2462 d->d_reclen, d->d_name);
2464 #endif /* LINUX || SVR4 */
2467 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
2468 i ? " " : "", d->d_off, d->d_fileno,
2470 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
2471 d->d_namlen, d->d_namlen, d->d_name);
2475 tprintf("/* d_reclen == 0, problem here */");
2484 tprintf("/* %u entries */", dents);
2485 tprintf(", %lu", tcp->u_arg[2]);
2493 sys_getdirentries(struct tcb *tcp)
2495 int i, len, dents = 0;
2499 if (entering(tcp)) {
2500 tprintf("%lu, ", tcp->u_arg[0]);
2503 if (syserror(tcp) || !verbose(tcp)) {
2504 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2508 if ((buf = malloc(len)) == NULL) {
2509 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2510 fprintf(stderr, "out of memory\n");
2513 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
2514 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
2520 for (i = 0; i < len;) {
2521 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
2523 tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
2524 i ? " " : "", d->d_fileno, d->d_reclen);
2525 printxval(direnttypes, d->d_type, "DT_???");
2526 tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
2527 d->d_namlen, d->d_namlen, d->d_name);
2530 tprintf("/* d_reclen == 0, problem here */");
2539 tprintf("/* %u entries */", dents);
2541 tprintf(", %lu", tcp->u_arg[2]);
2542 if (umove(tcp, tcp->u_arg[3], &basep) < 0)
2543 tprintf(", %#lx", tcp->u_arg[3]);
2545 tprintf(", [%lu]", basep);
2552 sys_getcwd(struct tcb *tcp)
2556 tprintf("%#lx", tcp->u_arg[0]);
2558 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
2559 tprintf(", %lu", tcp->u_arg[1]);
2567 sys___getcwd(struct tcb *tcp)
2571 tprintf("%#lx", tcp->u_arg[0]);
2573 printpathn(tcp, tcp->u_arg[0], tcp->u_arg[1]);
2574 tprintf(", %lu", tcp->u_arg[1]);
2580 #ifdef HAVE_SYS_ASYNCH_H
2583 sys_aioread(struct tcb *tcp)
2585 struct aio_result_t res;
2587 if (entering(tcp)) {
2588 tprintf("%lu, ", tcp->u_arg[0]);
2591 tprintf("%#lx", tcp->u_arg[1]);
2593 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2594 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2595 printxval(whence, tcp->u_arg[4], "L_???");
2596 if (syserror(tcp) || tcp->u_arg[5] == 0
2597 || umove(tcp, tcp->u_arg[5], &res) < 0)
2598 tprintf(", %#lx", tcp->u_arg[5]);
2600 tprintf(", {aio_return %d aio_errno %d}",
2601 res.aio_return, res.aio_errno);
2607 sys_aiowrite(struct tcb *tcp)
2609 struct aio_result_t res;
2611 if (entering(tcp)) {
2612 tprintf("%lu, ", tcp->u_arg[0]);
2613 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2614 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2615 printxval(whence, tcp->u_arg[4], "L_???");
2618 if (tcp->u_arg[5] == 0)
2620 else if (syserror(tcp)
2621 || umove(tcp, tcp->u_arg[5], &res) < 0)
2622 tprintf(", %#lx", tcp->u_arg[5]);
2624 tprintf(", {aio_return %d aio_errno %d}",
2625 res.aio_return, res.aio_errno);
2631 sys_aiowait(struct tcb *tcp)
2634 printtv(tcp, tcp->u_arg[0]);
2639 sys_aiocancel(struct tcb *tcp)
2641 struct aio_result_t res;
2644 if (tcp->u_arg[0] == 0)
2646 else if (syserror(tcp)
2647 || umove(tcp, tcp->u_arg[0], &res) < 0)
2648 tprintf("%#lx", tcp->u_arg[0]);
2650 tprintf("{aio_return %d aio_errno %d}",
2651 res.aio_return, res.aio_errno);
2656 #endif /* HAVE_SYS_ASYNCH_H */
2658 static const struct xlat xattrflags[] = {
2660 { XATTR_CREATE, "XATTR_CREATE" },
2661 { XATTR_REPLACE, "XATTR_REPLACE" },
2667 print_xattr_val(struct tcb *tcp, int failed,
2669 unsigned long insize,
2673 unsigned long capacity = 4 * size + 1;
2674 unsigned char *buf = (capacity < size) ? NULL : malloc(capacity);
2675 if (buf == NULL || /* probably a bogus size argument */
2676 umoven(tcp, arg, size, (char *) &buf[3 * size]) < 0) {
2680 unsigned char *out = buf;
2681 unsigned char *in = &buf[3 * size];
2683 for (i = 0; i < size; ++i) {
2687 #define tohex(n) "0123456789abcdef"[n]
2690 *out++ = tohex(in[i] / 16);
2691 *out++ = tohex(in[i] % 16);
2694 /* Don't print terminating NUL if there is one. */
2695 if (i > 0 && in[i - 1] == '\0')
2698 tprintf(", \"%s\", %ld", buf, insize);
2703 tprintf(", 0x%lx, %ld", arg, insize);
2707 sys_setxattr(struct tcb *tcp)
2709 if (entering(tcp)) {
2710 printpath(tcp, tcp->u_arg[0]);
2712 printstr(tcp, tcp->u_arg[1], -1);
2713 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2715 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2721 sys_fsetxattr(struct tcb *tcp)
2723 if (entering(tcp)) {
2724 tprintf("%ld, ", tcp->u_arg[0]);
2725 printstr(tcp, tcp->u_arg[1], -1);
2726 print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
2728 printflags(xattrflags, tcp->u_arg[4], "XATTR_???");
2734 sys_getxattr(struct tcb *tcp)
2736 if (entering(tcp)) {
2737 printpath(tcp, tcp->u_arg[0]);
2739 printstr(tcp, tcp->u_arg[1], -1);
2741 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2748 sys_fgetxattr(struct tcb *tcp)
2750 if (entering(tcp)) {
2751 tprintf("%ld, ", tcp->u_arg[0]);
2752 printstr(tcp, tcp->u_arg[1], -1);
2754 print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
2761 sys_listxattr(struct tcb *tcp)
2763 if (entering(tcp)) {
2764 printpath(tcp, tcp->u_arg[0]);
2766 /* XXX Print value in format */
2767 tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]);
2773 sys_flistxattr(struct tcb *tcp)
2775 if (entering(tcp)) {
2776 tprintf("%ld", tcp->u_arg[0]);
2778 /* XXX Print value in format */
2779 tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]);
2785 sys_removexattr(struct tcb *tcp)
2787 if (entering(tcp)) {
2788 printpath(tcp, tcp->u_arg[0]);
2790 printstr(tcp, tcp->u_arg[1], -1);
2796 sys_fremovexattr(struct tcb *tcp)
2798 if (entering(tcp)) {
2799 tprintf("%ld, ", tcp->u_arg[0]);
2800 printstr(tcp, tcp->u_arg[1], -1);
2806 static const struct xlat advise[] = {
2807 { POSIX_FADV_NORMAL, "POSIX_FADV_NORMAL" },
2808 { POSIX_FADV_RANDOM, "POSIX_FADV_RANDOM" },
2809 { POSIX_FADV_SEQUENTIAL, "POSIX_FADV_SEQUENTIAL" },
2810 { POSIX_FADV_WILLNEED, "POSIX_FADV_WILLNEED" },
2811 { POSIX_FADV_DONTNEED, "POSIX_FADV_DONTNEED" },
2812 { POSIX_FADV_NOREUSE, "POSIX_FADV_NOREUSE" },
2819 sys_fadvise64(struct tcb *tcp)
2821 if (entering(tcp)) {
2822 tprintf("%ld, %lld, %ld, ",
2824 # if defined IA64 || defined X86_64 || defined ALPHA
2825 (long long int) tcp->u_arg[1], tcp->u_arg[2]);
2826 printxval(advise, tcp->u_arg[3], "POSIX_FADV_???");
2828 LONG_LONG(tcp->u_arg[1], tcp->u_arg[2]), tcp->u_arg[3]);
2829 printxval(advise, tcp->u_arg[4], "POSIX_FADV_???");
2838 sys_fadvise64_64(struct tcb *tcp)
2840 if (entering(tcp)) {
2841 tprintf("%ld, %lld, %lld, ",
2843 #if defined LINUX_MIPSN32
2844 tcp->ext_arg[1], tcp->ext_arg[2]);
2845 printxval(advise, tcp->u_arg[3], "POSIX_FADV_???");
2846 #elif defined IA64 || defined X86_64 || defined ALPHA || defined LINUX_MIPSN64
2847 (long long int) tcp->u_arg[1], (long long int) tcp->u_arg[2]);
2848 printxval(advise, tcp->u_arg[3], "POSIX_FADV_???");
2850 LONG_LONG(tcp->u_arg[1], tcp->u_arg[2]),
2851 LONG_LONG(tcp->u_arg[3], tcp->u_arg[4]));
2852 printxval(advise, tcp->u_arg[5], "POSIX_FADV_???");
2859 static const struct xlat inotify_modes[] = {
2860 { 0x00000001, "IN_ACCESS" },
2861 { 0x00000002, "IN_MODIFY" },
2862 { 0x00000004, "IN_ATTRIB" },
2863 { 0x00000008, "IN_CLOSE_WRITE" },
2864 { 0x00000010, "IN_CLOSE_NOWRITE" },
2865 { 0x00000020, "IN_OPEN" },
2866 { 0x00000040, "IN_MOVED_FROM" },
2867 { 0x00000080, "IN_MOVED_TO" },
2868 { 0x00000100, "IN_CREATE" },
2869 { 0x00000200, "IN_DELETE" },
2870 { 0x00000400, "IN_DELETE_SELF" },
2871 { 0x00000800, "IN_MOVE_SELF" },
2872 { 0x00002000, "IN_UNMOUNT" },
2873 { 0x00004000, "IN_Q_OVERFLOW" },
2874 { 0x00008000, "IN_IGNORED" },
2875 { 0x01000000, "IN_ONLYDIR" },
2876 { 0x02000000, "IN_DONT_FOLLOW" },
2877 { 0x20000000, "IN_MASK_ADD" },
2878 { 0x40000000, "IN_ISDIR" },
2879 { 0x80000000, "IN_ONESHOT" }
2883 sys_inotify_add_watch(struct tcb *tcp)
2885 if (entering(tcp)) {
2886 tprintf("%ld, ", tcp->u_arg[0]);
2887 printpath(tcp, tcp->u_arg[1]);
2889 printflags(inotify_modes, tcp->u_arg[2], "IN_???");
2895 sys_inotify_rm_watch(struct tcb *tcp)
2897 if (entering(tcp)) {
2898 tprintf("%ld, %ld", tcp->u_arg[0], tcp->u_arg[1]);
2904 sys_fallocate(struct tcb *tcp)
2906 if (entering(tcp)) {
2907 tprintf("%ld, ", tcp->u_arg[0]); /* fd */
2908 tprintf("%#lo, ", tcp->u_arg[1]); /* mode */
2909 tprintf("%llu, ", LONG_LONG(tcp->u_arg[2],
2910 tcp->u_arg[3])); /* offset */
2911 tprintf("%llu", LONG_LONG(tcp->u_arg[4],
2912 tcp->u_arg[5])); /* len */