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.
37 #define dirent kernel_dirent
38 #include <linux/types.h>
39 #include <linux/dirent.h>
42 #define kernel_dirent dirent
48 unsigned short st_dev;
50 unsigned short st_mode;
52 unsigned short st_uid;
53 unsigned short st_gid;
54 unsigned short st_rdev;
57 unsigned int __unused1;
59 unsigned int __unused2;
61 unsigned int __unused3;
64 unsigned int __unused4[2];
66 # define stat kernel_stat
67 # include <asm/stat.h>
79 # define dev_t __kernel_dev_t
80 # define ino_t __kernel_ino_t
81 # define mode_t __kernel_mode_t
82 # define nlink_t __kernel_nlink_t
83 # define uid_t __kernel_uid_t
84 # define gid_t __kernel_gid_t
85 # define off_t __kernel_off_t
86 # define loff_t __kernel_loff_t
88 # include <asm/stat.h>
101 # define mode_t mode_t
102 # define nlink_t nlink_t
106 # define loff_t loff_t
108 # define stat libc_stat
109 # define stat64 libc_stat64
110 # include <sys/stat.h>
114 # include <sys/stat.h>
120 # include <sys/cred.h>
125 #ifdef MAJOR_IN_SYSMACROS
126 #include <sys/sysmacros.h>
129 #ifdef MAJOR_IN_MKDEV
130 #include <sys/mkdev.h>
133 #ifdef HAVE_SYS_ASYNCH_H
134 #include <sys/asynch.h>
142 * This is a really dirty trick but it should always work. Traditional
143 * Unix says r/w/rw are 0/1/2, so we make them true flags 1/2/3 by
144 * adding 1. Just remember to add 1 to any arg decoded with openmodes.
146 struct xlat openmodes[] = {
147 { O_RDWR+1, "O_RDWR" },
148 { O_RDONLY+1, "O_RDONLY" },
149 { O_WRONLY+1, "O_WRONLY" },
150 { O_NONBLOCK, "O_NONBLOCK" },
151 { O_APPEND, "O_APPEND" },
152 { O_CREAT, "O_CREAT" },
153 { O_TRUNC, "O_TRUNC" },
154 { O_EXCL, "O_EXCL" },
155 { O_NOCTTY, "O_NOCTTY" },
157 { O_SYNC, "O_SYNC" },
160 { O_ASYNC, "O_ASYNC" },
163 { O_DSYNC, "O_DSYNC" },
166 { O_RSYNC, "O_RSYNC" },
169 { O_NDELAY, "O_NDELAY" },
172 { O_PRIV, "O_PRIV" },
175 { O_DIRECT, "O_DIRECT" },
178 { O_LARGEFILE, "O_LARGEFILE" },
181 { O_DIRECTORY, "O_DIRECTORY" },
184 { O_NOFOLLOW, "O_NOFOLLOW" },
188 { FNDELAY, "FNDELAY" },
191 { FAPPEND, "FAPPEND" },
197 { FDEFER, "FDEFER" },
200 { FASYNC, "FASYNC" },
203 { FSHLOCK, "FSHLOCK" },
206 { FEXLOCK, "FEXLOCK" },
209 { FCREAT, "FCREAT" },
212 { FTRUNC, "FTRUNC" },
224 { FNOCTTY, "FNOCTTY" },
234 printpath(tcp, tcp->u_arg[0]);
237 printflags(openmodes, tcp->u_arg[1] + 1);
238 if (tcp->u_arg[1] & O_CREAT) {
240 tprintf(", %#lo", tcp->u_arg[2]);
247 struct xlat openmodessol[] = {
251 { 0x80, "O_NONBLOCK" },
253 { 0x100, "O_CREAT" },
254 { 0x200, "O_TRUNC" },
256 { 0x800, "O_NOCTTY" },
259 { 0x8000, "O_RSYNC" },
261 { 0x1000, "O_PRIV" },
270 printpath(tcp, tcp->u_arg[0]);
273 printflags(openmodessol, tcp->u_arg[1] + 1);
274 if (tcp->u_arg[1] & 0x100) {
276 tprintf(", %#lo", tcp->u_arg[2]);
289 printpath(tcp, tcp->u_arg[0]);
290 tprintf(", %#lo", tcp->u_arg[1]);
295 static struct xlat access_flags[] = {
301 { EFF_ONLY_OK, "EFF_ONLY_OK" },
314 printpath(tcp, tcp->u_arg[0]);
316 printflags(access_flags, tcp->u_arg[1]);
326 tprintf("%#lo", tcp->u_arg[0]);
331 static struct xlat whence[] = {
332 { SEEK_SET, "SEEK_SET" },
333 { SEEK_CUR, "SEEK_CUR" },
334 { SEEK_END, "SEEK_END" },
343 tprintf("%ld, ", tcp->u_arg[0]);
344 if (tcp->u_arg[2] == SEEK_SET)
345 tprintf("%lu, ", tcp->u_arg[1]);
347 tprintf("%ld, ", tcp->u_arg[1]);
348 printxval(whence, tcp->u_arg[2], "SEEK_???");
350 return RVAL_UDECIMAL;
359 if (tcp->u_arg[4] == SEEK_SET)
360 tprintf("%ld, %llu, ", tcp->u_arg[0],
361 (((long long int) tcp->u_arg[1]) << 32
362 | (unsigned long long) tcp->u_arg[2]));
364 tprintf("%ld, %lld, ", tcp->u_arg[0],
365 (((long long int) tcp->u_arg[1]) << 32
366 | (unsigned long long) tcp->u_arg[2]));
370 if (syserror(tcp) || umove(tcp, tcp->u_arg[3], &off) < 0)
371 tprintf("%#lx, ", tcp->u_arg[3]);
373 tprintf("[%llu], ", off);
374 printxval(whence, tcp->u_arg[4], "SEEK_???");
385 printpath(tcp, tcp->u_arg[0]);
386 tprintf(", %lu", tcp->u_arg[1]);
396 tprintf("%ld, %lu", tcp->u_arg[0], tcp->u_arg[1]);
403 static struct xlat modetypes[] = {
404 { S_IFREG, "S_IFREG" },
405 { S_IFSOCK, "S_IFSOCK" },
406 { S_IFIFO, "S_IFIFO" },
407 { S_IFLNK, "S_IFLNK" },
408 { S_IFDIR, "S_IFDIR" },
409 { S_IFBLK, "S_IFBLK" },
410 { S_IFCHR, "S_IFCHR" },
421 if ((mode & S_IFMT) == 0)
423 else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) {
424 sprintf(buf, "%#o", mode);
427 sprintf(buf, "%s%s%s%s", s,
428 (mode & S_ISUID) ? "|S_ISUID" : "",
429 (mode & S_ISGID) ? "|S_ISGID" : "",
430 (mode & S_ISVTX) ? "|S_ISVTX" : "");
431 mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX);
433 sprintf(buf + strlen(buf), "|%#o", mode);
434 s = (*buf == '|') ? buf + 1 : buf;
450 sprintf(buf, "%02d/%02d/%02d-%02d:%02d:%02d",
451 tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
452 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
464 int st_pad1[3]; /* network id */
473 int st_pad3; /* st_size, off_t expansion */
474 timestruct_t st_atime;
475 timestruct_t st_mtime;
476 timestruct_t st_ctime;
480 int st_pad4[8]; /* expansion area */
484 printstatsol(tcp, addr)
488 struct solstat statbuf;
494 if (syserror(tcp) || !verbose(tcp)) {
495 tprintf("%#lx", addr);
498 if (umove(tcp, addr, &statbuf) < 0) {
503 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
504 (unsigned long) ((statbuf.st_dev >> 18) & 0x3fff),
505 (unsigned long) (statbuf.st_dev & 0x3ffff),
506 (unsigned long) statbuf.st_ino,
507 sprintmode(statbuf.st_mode));
508 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
509 (unsigned long) statbuf.st_nlink,
510 (unsigned long) statbuf.st_uid,
511 (unsigned long) statbuf.st_gid);
512 tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);
513 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
516 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
517 switch (statbuf.st_mode & S_IFMT) {
518 case S_IFCHR: case S_IFBLK:
519 tprintf("st_rdev=makedev(%lu, %lu), ",
520 (unsigned long) ((statbuf.st_rdev >> 18) & 0x3fff),
521 (unsigned long) (statbuf.st_rdev & 0x3ffff));
524 tprintf("st_size=%u, ", statbuf.st_size);
528 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
529 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
530 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
535 #endif /* LINUXSPARC */
538 realprintstat(tcp, statbuf)
540 struct stat *statbuf;
543 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
544 (unsigned long) major(statbuf->st_dev),
545 (unsigned long) minor(statbuf->st_dev),
546 (unsigned long) statbuf->st_ino,
547 sprintmode(statbuf->st_mode));
548 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
549 (unsigned long) statbuf->st_nlink,
550 (unsigned long) statbuf->st_uid,
551 (unsigned long) statbuf->st_gid);
552 #ifdef HAVE_ST_BLKSIZE
553 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
554 #endif /* HAVE_ST_BLKSIZE */
555 #ifdef HAVE_ST_BLOCKS
556 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
557 #endif /* HAVE_ST_BLOCKS */
560 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
561 switch (statbuf->st_mode & S_IFMT) {
562 case S_IFCHR: case S_IFBLK:
564 tprintf("st_rdev=makedev(%lu, %lu), ",
565 (unsigned long) major(statbuf->st_rdev),
566 (unsigned long) minor(statbuf->st_rdev));
567 #else /* !HAVE_ST_RDEV */
568 tprintf("st_size=makedev(%lu, %lu), ",
569 (unsigned long) major(statbuf->st_size),
570 (unsigned long) minor(statbuf->st_size));
571 #endif /* !HAVE_ST_RDEV */
574 tprintf("st_size=%lu, ", statbuf->st_size);
578 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
579 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
580 tprintf("st_ctime=%s}", sprinttime(statbuf->st_ctime));
595 if (current_personality == 1) {
596 printstatsol(tcp, addr);
599 #endif /* LINUXSPARC */
605 if (syserror(tcp) || !verbose(tcp)) {
606 tprintf("%#lx", addr);
609 if (umove(tcp, addr, &statbuf) < 0) {
614 realprintstat(tcp, &statbuf);
619 printstat64(tcp, addr)
623 struct stat64 statbuf;
626 if (current_personality == 1) {
627 printstatsol(tcp, addr);
630 #endif /* LINUXSPARC */
636 if (syserror(tcp) || !verbose(tcp)) {
637 tprintf("%#lx", addr);
640 if (umove(tcp, addr, &statbuf) < 0) {
646 #ifdef HAVE_LONG_LONG
647 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
649 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
651 (unsigned long) major(statbuf.st_dev),
652 (unsigned long) minor(statbuf.st_dev),
653 #ifdef HAVE_LONG_LONG
654 (unsigned long long) statbuf.st_ino,
656 (unsigned long) statbuf.st_ino,
658 sprintmode(statbuf.st_mode));
659 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
660 (unsigned long) statbuf.st_nlink,
661 (unsigned long) statbuf.st_uid,
662 (unsigned long) statbuf.st_gid);
663 #ifdef HAVE_ST_BLKSIZE
664 tprintf("st_blksize=%lu, ",
665 (unsigned long) statbuf.st_blksize);
666 #endif /* HAVE_ST_BLKSIZE */
667 #ifdef HAVE_ST_BLOCKS
668 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
669 #endif /* HAVE_ST_BLOCKS */
672 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
673 switch (statbuf.st_mode & S_IFMT) {
674 case S_IFCHR: case S_IFBLK:
676 tprintf("st_rdev=makedev(%lu, %lu), ",
677 (unsigned long) major(statbuf.st_rdev),
678 (unsigned long) minor(statbuf.st_rdev));
679 #else /* !HAVE_ST_RDEV */
680 tprintf("st_size=makedev(%lu, %lu), ",
681 (unsigned long) major(statbuf.st_size),
682 (unsigned long) minor(statbuf.st_size));
683 #endif /* !HAVE_ST_RDEV */
686 tprintf("st_size=%llu, ", statbuf.st_size);
690 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
691 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
692 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
697 #endif /* HAVE_STAT64 */
699 #if defined(linux) && !defined(IA64)
701 convertoldstat(oldbuf, newbuf)
702 const struct __old_kernel_stat *oldbuf;
705 newbuf->st_dev=oldbuf->st_dev;
706 newbuf->st_ino=oldbuf->st_ino;
707 newbuf->st_mode=oldbuf->st_mode;
708 newbuf->st_nlink=oldbuf->st_nlink;
709 newbuf->st_uid=oldbuf->st_uid;
710 newbuf->st_gid=oldbuf->st_gid;
711 newbuf->st_rdev=oldbuf->st_rdev;
712 newbuf->st_size=oldbuf->st_size;
713 newbuf->st_atime=oldbuf->st_atime;
714 newbuf->st_mtime=oldbuf->st_mtime;
715 newbuf->st_ctime=oldbuf->st_ctime;
716 newbuf->st_blksize=0; /* not supported in old_stat */
717 newbuf->st_blocks=0; /* not supported in old_stat */
722 printoldstat(tcp, addr)
726 struct __old_kernel_stat statbuf;
727 struct stat newstatbuf;
730 if (current_personality == 1) {
731 printstatsol(tcp, addr);
734 #endif /* LINUXSPARC */
740 if (syserror(tcp) || !verbose(tcp)) {
741 tprintf("%#lx", addr);
744 if (umove(tcp, addr, &statbuf) < 0) {
749 convertoldstat(&statbuf, &newstatbuf);
750 realprintstat(tcp, &newstatbuf);
752 #endif /* linux && !IA64 */
760 printpath(tcp, tcp->u_arg[0]);
763 printstat(tcp, tcp->u_arg[1]);
775 printpath(tcp, tcp->u_arg[0]);
778 printstat64(tcp, tcp->u_arg[1]);
782 return printargs(tcp);
792 printpath(tcp, tcp->u_arg[0]);
795 printoldstat(tcp, tcp->u_arg[1]);
807 tprintf("%ld, ", tcp->u_arg[0]);
809 printstat(tcp, tcp->u_arg[1]);
821 tprintf("%ld, ", tcp->u_arg[0]);
823 printstat64(tcp, tcp->u_arg[1]);
827 return printargs(tcp);
837 tprintf("%ld, ", tcp->u_arg[0]);
839 printoldstat(tcp, tcp->u_arg[1]);
851 printpath(tcp, tcp->u_arg[0]);
854 printstat(tcp, tcp->u_arg[1]);
866 printpath(tcp, tcp->u_arg[0]);
869 printstat64(tcp, tcp->u_arg[1]);
873 return printargs(tcp);
883 printpath(tcp, tcp->u_arg[0]);
886 printoldstat(tcp, tcp->u_arg[1]);
894 #if defined(SVR4) || defined(LINUXSPARC)
901 tprintf("%ld, ", tcp->u_arg[0]);
902 printpath(tcp, tcp->u_arg[1]);
905 printstat(tcp, tcp->u_arg[2]);
915 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
917 printstat(tcp, tcp->u_arg[2]);
927 tprintf("%ld, ", tcp->u_arg[0]);
928 printpath(tcp, tcp->u_arg[1]);
931 printstat(tcp, tcp->u_arg[2]);
940 int mode = tcp->u_arg[2];
943 tprintf("%ld, ", tcp->u_arg[0]);
944 printpath(tcp, tcp->u_arg[1]);
945 tprintf(", %s", sprintmode(mode));
946 switch (mode & S_IFMT) {
947 case S_IFCHR: case S_IFBLK:
949 tprintf(", makedev(%lu, %lu)",
950 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
951 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
953 tprintf(", makedev(%lu, %lu)",
954 (unsigned long) major(tcp->u_arg[3]),
955 (unsigned long) minor(tcp->u_arg[3]));
965 #ifdef HAVE_SYS_ACL_H
969 struct xlat aclcmds[] = {
971 { SETACL, "SETACL" },
974 { GETACL, "GETACL" },
977 { GETACLCNT, "GETACLCNT" },
980 { ACL_GET, "ACL_GET" },
983 { ACL_SET, "ACL_SET" },
986 { ACL_CNT, "ACL_CNT" },
996 printpath(tcp, tcp->u_arg[0]);
998 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
999 tprintf(", %ld", tcp->u_arg[2]);
1001 * FIXME - dump out the list of aclent_t's pointed to
1002 * by "tcp->u_arg[3]" if it's not NULL.
1005 tprintf(", %#lx", tcp->u_arg[3]);
1017 if (entering(tcp)) {
1018 tprintf("%ld, ", tcp->u_arg[0]);
1019 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1020 tprintf(", %ld", tcp->u_arg[2]);
1022 * FIXME - dump out the list of aclent_t's pointed to
1023 * by "tcp->u_arg[3]" if it's not NULL.
1026 tprintf(", %#lx", tcp->u_arg[3]);
1034 struct xlat aclipc[] = {
1036 { IPC_SHM, "IPC_SHM" },
1039 { IPC_SEM, "IPC_SEM" },
1042 { IPC_MSG, "IPC_MSG" },
1052 if (entering(tcp)) {
1053 printxval(aclipc, tcp->u_arg[0], "???IPC???");
1054 tprintf(", %#lx, ", tcp->u_arg[1]);
1055 printxval(aclcmds, tcp->u_arg[2], "???ACL???");
1056 tprintf(", %ld", tcp->u_arg[3]);
1058 * FIXME - dump out the list of aclent_t's pointed to
1059 * by "tcp->u_arg[4]" if it's not NULL.
1062 tprintf(", %#lx", tcp->u_arg[4]);
1071 #endif /* HAVE_SYS_ACL_H */
1073 #endif /* SVR4 || LINUXSPARC */
1077 static struct xlat fsmagic[] = {
1078 { 0x73757245, "CODA_SUPER_MAGIC" },
1079 { 0x012ff7b7, "COH_SUPER_MAGIC" },
1080 { 0x1373, "DEVFS_SUPER_MAGIC" },
1081 { 0x1cd1, "DEVPTS_SUPER_MAGIC" },
1082 { 0x414A53, "EFS_SUPER_MAGIC" },
1083 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
1084 { 0xef53, "EXT2_SUPER_MAGIC" },
1085 { 0x137d, "EXT_SUPER_MAGIC" },
1086 { 0xf995e849, "HPFS_SUPER_MAGIC" },
1087 { 0x9660, "ISOFS_SUPER_MAGIC" },
1088 { 0x137f, "MINIX_SUPER_MAGIC" },
1089 { 0x138f, "MINIX_SUPER_MAGIC2" },
1090 { 0x2468, "MINIX2_SUPER_MAGIC" },
1091 { 0x2478, "MINIX2_SUPER_MAGIC2" },
1092 { 0x4d44, "MSDOS_SUPER_MAGIC" },
1093 { 0x564c, "NCP_SUPER_MAGIC" },
1094 { 0x6969, "NFS_SUPER_MAGIC" },
1095 { 0x9fa0, "PROC_SUPER_MAGIC" },
1096 { 0x002f, "QNX4_SUPER_MAGIC" },
1097 { 0x52654973, "REISERFS_SUPER_MAGIC" },
1098 { 0x02011994, "SHMFS_SUPER_MAGIC" },
1099 { 0x517b, "SMB_SUPER_MAGIC" },
1100 { 0x012ff7b6, "SYSV2_SUPER_MAGIC" },
1101 { 0x012ff7b5, "SYSV4_SUPER_MAGIC" },
1102 { 0x00011954, "UFS_MAGIC" },
1103 { 0x54190100, "UFS_CIGAM" },
1104 { 0x012ff7b4, "XENIX_SUPER_MAGIC" },
1105 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
1117 static char buf[32];
1121 s = xlookup(fsmagic, magic);
1123 sprintf(buf, "\"%s\"", s);
1127 sprintf(buf, "%#x", magic);
1132 printstatfs(tcp, addr)
1136 struct statfs statbuf;
1138 if (syserror(tcp) || !verbose(tcp)) {
1139 tprintf("%#lx", addr);
1142 if (umove(tcp, addr, &statbuf) < 0) {
1148 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
1149 sprintfstype(statbuf.f_type),
1150 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
1151 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_namelen=%u",
1152 statbuf.f_bavail,statbuf.f_files, statbuf.f_ffree, statbuf.f_namelen);
1154 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
1155 sprintfstype(statbuf.f_type),
1156 (unsigned long)statbuf.f_bsize,
1157 (unsigned long)statbuf.f_blocks,
1158 (unsigned long)statbuf.f_bfree);
1159 tprintf("f_files=%lu, f_ffree=%lu",
1160 (unsigned long)statbuf.f_files,
1161 (unsigned long)statbuf.f_ffree);
1163 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1173 if (entering(tcp)) {
1174 printpath(tcp, tcp->u_arg[0]);
1177 printstatfs(tcp, tcp->u_arg[1]);
1186 if (entering(tcp)) {
1187 tprintf("%lu, ", tcp->u_arg[0]);
1189 printstatfs(tcp, tcp->u_arg[1]);
1194 #if defined(linux) && defined(__alpha)
1200 if (entering(tcp)) {
1201 printpath(tcp, tcp->u_arg[0]);
1204 printstatfs(tcp, tcp->u_arg[1]);
1205 tprintf(", %lu", tcp->u_arg[2]);
1214 if (entering(tcp)) {
1215 tprintf("%lu, ", tcp->u_arg[0]);
1217 printstatfs(tcp, tcp->u_arg[1]);
1218 tprintf(", %lu", tcp->u_arg[2]);
1222 #endif /* linux && __alpha */
1232 struct ustat statbuf;
1234 if (entering(tcp)) {
1235 tprintf("makedev(%lu, %lu), ",
1236 (long) major(tcp->u_arg[0]),
1237 (long) minor(tcp->u_arg[0]));
1240 if (syserror(tcp) || !verbose(tcp))
1241 tprintf("%#lx", tcp->u_arg[1]);
1242 else if (umove(tcp, tcp->u_arg[1], &statbuf) < 0)
1245 tprintf("{f_tfree=%lu, f_tinode=%lu, ",
1246 statbuf.f_tfree, statbuf.f_tinode);
1247 tprintf("f_fname=\"%.*s\", ",
1248 (int) sizeof(statbuf.f_fname),
1250 tprintf("f_fpack=\"%.*s\"}",
1251 (int) sizeof(statbuf.f_fpack),
1264 if (entering(tcp)) {
1265 printpath(tcp, tcp->u_arg[0]);
1267 printpath(tcp, tcp->u_arg[1]);
1278 if (entering(tcp)) {
1279 printpath(tcp, tcp->u_arg[0]);
1288 if (entering(tcp)) {
1289 printpath(tcp, tcp->u_arg[0]);
1290 tprintf(", %#lo", tcp->u_arg[1]);
1299 if (entering(tcp)) {
1300 printpath(tcp, tcp->u_arg[0]);
1309 if (entering(tcp)) {
1310 tprintf("%ld", tcp->u_arg[0]);
1319 if (entering(tcp)) {
1320 printpath(tcp, tcp->u_arg[0]);
1329 if (entering(tcp)) {
1330 tprintf("%ld", tcp->u_arg[0]);
1339 if (entering(tcp)) {
1340 printpath(tcp, tcp->u_arg[0]);
1342 printpath(tcp, tcp->u_arg[1]);
1351 if (entering(tcp)) {
1352 printpath(tcp, tcp->u_arg[0]);
1361 if (entering(tcp)) {
1362 printpath(tcp, tcp->u_arg[0]);
1364 printpath(tcp, tcp->u_arg[1]);
1373 if (entering(tcp)) {
1374 printpath(tcp, tcp->u_arg[0]);
1378 tprintf("%#lx", tcp->u_arg[1]);
1380 printpathn(tcp, tcp->u_arg[1], tcp->u_rval);
1381 tprintf(", %lu", tcp->u_arg[2]);
1390 if (entering(tcp)) {
1391 printpath(tcp, tcp->u_arg[0]);
1393 printpath(tcp, tcp->u_arg[1]);
1402 if (entering(tcp)) {
1403 printpath(tcp, tcp->u_arg[0]);
1404 tprintf(", %lu, %lu", tcp->u_arg[1], tcp->u_arg[2]);
1413 if (entering(tcp)) {
1414 tprintf("%ld, %lu, %lu",
1415 tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
1424 if (entering(tcp)) {
1425 printpath(tcp, tcp->u_arg[0]);
1426 tprintf(", %#lo", tcp->u_arg[1]);
1435 if (entering(tcp)) {
1436 tprintf("%ld, %#lo", tcp->u_arg[0], tcp->u_arg[1]);
1446 if (entering(tcp)) {
1447 printpath(tcp, tcp->u_arg[0]);
1449 printtv32(tcp, tcp->u_arg[1]);
1459 if (entering(tcp)) {
1460 printpath(tcp, tcp->u_arg[0]);
1462 printtv(tcp, tcp->u_arg[1]);
1473 if (entering(tcp)) {
1474 printpath(tcp, tcp->u_arg[0]);
1478 else if (!verbose(tcp))
1479 tprintf("%#lx", tcp->u_arg[1]);
1480 else if (umoven(tcp, tcp->u_arg[1], sizeof ut,
1484 tprintf("[%s,", sprinttime(ut[0]));
1485 tprintf(" %s]", sprinttime(ut[1]));
1495 int mode = tcp->u_arg[1];
1497 if (entering(tcp)) {
1498 printpath(tcp, tcp->u_arg[0]);
1499 tprintf(", %s", sprintmode(mode));
1500 switch (mode & S_IFMT) {
1501 case S_IFCHR: case S_IFBLK:
1503 if (current_personality == 1)
1504 tprintf(", makedev(%lu, %lu)",
1505 (unsigned long) ((tcp->u_arg[2] >> 18) & 0x3fff),
1506 (unsigned long) (tcp->u_arg[2] & 0x3ffff));
1509 tprintf(", makedev(%lu, %lu)",
1510 (unsigned long) major(tcp->u_arg[2]),
1511 (unsigned long) minor(tcp->u_arg[2]));
1524 if (entering(tcp)) {
1525 printpath(tcp, tcp->u_arg[0]);
1526 tprintf(", %#lo", tcp->u_arg[1]);
1535 if (entering(tcp)) {
1536 tprintf("%ld", tcp->u_arg[0]);
1550 if (!verbose(tcp)) {
1551 tprintf("%#lx", addr);
1554 if (umove(tcp, addr, &d) < 0) {
1558 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
1560 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
1568 if (entering(tcp)) {
1569 tprintf("%lu, ", tcp->u_arg[0]);
1571 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
1572 tprintf("%#lx", tcp->u_arg[1]);
1574 printdir(tcp, tcp->u_arg[1]);
1575 /* Not much point in printing this out, it is always 1. */
1576 if (tcp->u_arg[2] != 1)
1577 tprintf(", %lu", tcp->u_arg[2]);
1588 int i, len, dents = 0;
1591 if (entering(tcp)) {
1592 tprintf("%lu, ", tcp->u_arg[0]);
1595 if (syserror(tcp) || !verbose(tcp)) {
1596 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
1600 if ((buf = malloc(len)) == NULL) {
1601 tprintf("out of memory\n");
1604 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
1605 tprintf("{...}, %lu", tcp->u_arg[2]);
1611 for (i = 0; i < len;) {
1612 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
1615 tprintf("%s{d_ino=%lu, d_off=%lu, ",
1616 i ? " " : "", d->d_ino, d->d_off);
1617 tprintf("d_reclen=%u, d_name=\"%s\"}",
1618 d->d_reclen, d->d_name);
1623 tprintf("%s{d_ino=%lu, d_off=%lu, ",
1624 i ? " " : "", d->d_ino, d->d_off);
1625 tprintf("d_reclen=%u, d_name=\"%s\"}",
1626 d->d_reclen, d->d_name);
1631 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
1632 i ? " " : "", d->d_off, d->d_fileno,
1634 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
1635 d->d_namlen, d->d_namlen, d->d_name);
1639 tprintf("/* d_reclen == 0, problem here */");
1648 tprintf("/* %u entries */", dents);
1649 tprintf(", %lu", tcp->u_arg[2]);
1662 tprintf("%#lx", tcp->u_arg[0]);
1664 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
1665 tprintf(", %lu", tcp->u_arg[1]);
1671 #ifdef HAVE_SYS_ASYNCH_H
1677 struct aio_result_t res;
1679 if (entering(tcp)) {
1680 tprintf("%lu, ", tcp->u_arg[0]);
1683 tprintf("%#lx", tcp->u_arg[1]);
1685 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1686 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
1687 printxval(whence, tcp->u_arg[4], "L_???");
1688 if (syserror(tcp) || tcp->u_arg[5] == 0
1689 || umove(tcp, tcp->u_arg[5], &res) < 0)
1690 tprintf(", %#lx", tcp->u_arg[5]);
1692 tprintf(", {aio_return %d aio_errno %d}",
1693 res.aio_return, res.aio_errno);
1702 struct aio_result_t res;
1704 if (entering(tcp)) {
1705 tprintf("%lu, ", tcp->u_arg[0]);
1706 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1707 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
1708 printxval(whence, tcp->u_arg[4], "L_???");
1711 if (tcp->u_arg[5] == 0)
1713 else if (syserror(tcp)
1714 || umove(tcp, tcp->u_arg[5], &res) < 0)
1715 tprintf(", %#lx", tcp->u_arg[5]);
1717 tprintf(", {aio_return %d aio_errno %d}",
1718 res.aio_return, res.aio_errno);
1728 printtv(tcp, tcp->u_arg[0]);
1736 struct aio_result_t res;
1739 if (tcp->u_arg[0] == 0)
1741 else if (syserror(tcp)
1742 || umove(tcp, tcp->u_arg[0], &res) < 0)
1743 tprintf("%#lx", tcp->u_arg[0]);
1745 tprintf("{aio_return %d aio_errno %d}",
1746 res.aio_return, res.aio_errno);
1751 #endif /* HAVE_SYS_ASYNCH_H */
1758 if (entering(tcp)) {
1759 long long offset = * (long long *) & tcp->u_arg [1];
1760 if (tcp->u_arg[3] == SEEK_SET)
1761 tprintf("%ld, %llu, ", tcp->u_arg[0], offset);
1763 tprintf("%ld, %lld, ", tcp->u_arg[0], offset);
1764 printxval(whence, tcp->u_arg[3], "SEEK_???");
1766 return RVAL_LDECIMAL;