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" },
185 { FNDELAY, "FNDELAY" },
188 { FAPPEND, "FAPPEND" },
194 { FDEFER, "FDEFER" },
197 { FASYNC, "FASYNC" },
200 { FSHLOCK, "FSHLOCK" },
203 { FEXLOCK, "FEXLOCK" },
206 { FCREAT, "FCREAT" },
209 { FTRUNC, "FTRUNC" },
221 { FNOCTTY, "FNOCTTY" },
231 printpath(tcp, tcp->u_arg[0]);
234 printflags(openmodes, tcp->u_arg[1] + 1);
235 if (tcp->u_arg[1] & O_CREAT) {
237 tprintf(", %#lo", tcp->u_arg[2]);
244 struct xlat openmodessol[] = {
248 { 0x80, "O_NONBLOCK" },
250 { 0x100, "O_CREAT" },
251 { 0x200, "O_TRUNC" },
253 { 0x800, "O_NOCTTY" },
256 { 0x8000, "O_RSYNC" },
258 { 0x1000, "O_PRIV" },
267 printpath(tcp, tcp->u_arg[0]);
270 printflags(openmodessol, tcp->u_arg[1] + 1);
271 if (tcp->u_arg[1] & 0x100) {
273 tprintf(", %#lo", tcp->u_arg[2]);
286 printpath(tcp, tcp->u_arg[0]);
287 tprintf(", %#lo", tcp->u_arg[1]);
292 static struct xlat access_flags[] = {
298 { EFF_ONLY_OK, "EFF_ONLY_OK" },
311 printpath(tcp, tcp->u_arg[0]);
313 printflags(access_flags, tcp->u_arg[1]);
323 tprintf("%#lo", tcp->u_arg[0]);
328 static struct xlat whence[] = {
329 { SEEK_SET, "SEEK_SET" },
330 { SEEK_CUR, "SEEK_CUR" },
331 { SEEK_END, "SEEK_END" },
340 tprintf("%ld, ", tcp->u_arg[0]);
341 if (tcp->u_arg[2] == SEEK_SET)
342 tprintf("%lu, ", tcp->u_arg[1]);
344 tprintf("%ld, ", tcp->u_arg[1]);
345 printxval(whence, tcp->u_arg[2], "SEEK_???");
347 return RVAL_UDECIMAL;
356 if (tcp->u_arg[4] == SEEK_SET)
357 tprintf("%ld, %llu, ", tcp->u_arg[0],
358 (((long long int) tcp->u_arg[1]) << 32
359 | (unsigned long long) tcp->u_arg[2]));
361 tprintf("%ld, %lld, ", tcp->u_arg[0],
362 (((long long int) tcp->u_arg[1]) << 32
363 | (unsigned long long) tcp->u_arg[2]));
367 if (syserror(tcp) || umove(tcp, tcp->u_arg[3], &off) < 0)
368 tprintf("%#lx, ", tcp->u_arg[3]);
370 tprintf("[%llu], ", off);
371 printxval(whence, tcp->u_arg[4], "SEEK_???");
382 printpath(tcp, tcp->u_arg[0]);
383 tprintf(", %lu", tcp->u_arg[1]);
393 tprintf("%ld, %lu", tcp->u_arg[0], tcp->u_arg[1]);
400 static struct xlat modetypes[] = {
401 { S_IFREG, "S_IFREG" },
402 { S_IFSOCK, "S_IFSOCK" },
403 { S_IFIFO, "S_IFIFO" },
404 { S_IFLNK, "S_IFLNK" },
405 { S_IFDIR, "S_IFDIR" },
406 { S_IFBLK, "S_IFBLK" },
407 { S_IFCHR, "S_IFCHR" },
418 if ((mode & S_IFMT) == 0)
420 else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) {
421 sprintf(buf, "%#o", mode);
424 sprintf(buf, "%s%s%s%s", s,
425 (mode & S_ISUID) ? "|S_ISUID" : "",
426 (mode & S_ISGID) ? "|S_ISGID" : "",
427 (mode & S_ISVTX) ? "|S_ISVTX" : "");
428 mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX);
430 sprintf(buf + strlen(buf), "|%#o", mode);
431 s = (*buf == '|') ? buf + 1 : buf;
447 sprintf(buf, "%02d/%02d/%02d-%02d:%02d:%02d",
448 tmp->tm_year, tmp->tm_mon + 1, tmp->tm_mday,
449 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
461 int st_pad1[3]; /* network id */
470 int st_pad3; /* st_size, off_t expansion */
471 timestruct_t st_atime;
472 timestruct_t st_mtime;
473 timestruct_t st_ctime;
477 int st_pad4[8]; /* expansion area */
481 printstatsol(tcp, addr)
485 struct solstat statbuf;
491 if (syserror(tcp) || !verbose(tcp)) {
492 tprintf("%#x", addr);
495 if (umove(tcp, addr, &statbuf) < 0) {
500 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
501 (unsigned long) ((statbuf.st_dev >> 18) & 0x3fff),
502 (unsigned long) (statbuf.st_dev & 0x3ffff),
503 (unsigned long) statbuf.st_ino,
504 sprintmode(statbuf.st_mode));
505 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
506 (unsigned long) statbuf.st_nlink,
507 (unsigned long) statbuf.st_uid,
508 (unsigned long) statbuf.st_gid);
509 tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);
510 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
513 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
514 switch (statbuf.st_mode & S_IFMT) {
515 case S_IFCHR: case S_IFBLK:
516 tprintf("st_rdev=makedev(%lu, %lu), ",
517 (unsigned long) ((statbuf.st_rdev >> 18) & 0x3fff),
518 (unsigned long) (statbuf.st_rdev & 0x3ffff));
521 tprintf("st_size=%u, ", statbuf.st_size);
525 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
526 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
527 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
532 #endif /* LINUXSPARC */
535 realprintstat(tcp, statbuf)
537 struct stat *statbuf;
540 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
541 (unsigned long) major(statbuf->st_dev),
542 (unsigned long) minor(statbuf->st_dev),
543 (unsigned long) statbuf->st_ino,
544 sprintmode(statbuf->st_mode));
545 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
546 (unsigned long) statbuf->st_nlink,
547 (unsigned long) statbuf->st_uid,
548 (unsigned long) statbuf->st_gid);
549 #ifdef HAVE_ST_BLKSIZE
550 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
551 #endif /* HAVE_ST_BLKSIZE */
552 #ifdef HAVE_ST_BLOCKS
553 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
554 #endif /* HAVE_ST_BLOCKS */
557 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
558 switch (statbuf->st_mode & S_IFMT) {
559 case S_IFCHR: case S_IFBLK:
561 tprintf("st_rdev=makedev(%lu, %lu), ",
562 (unsigned long) major(statbuf->st_rdev),
563 (unsigned long) minor(statbuf->st_rdev));
564 #else /* !HAVE_ST_RDEV */
565 tprintf("st_size=makedev(%lu, %lu), ",
566 (unsigned long) major(statbuf->st_size),
567 (unsigned long) minor(statbuf->st_size));
568 #endif /* !HAVE_ST_RDEV */
571 tprintf("st_size=%lu, ", statbuf->st_size);
575 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
576 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
577 tprintf("st_ctime=%s}", sprinttime(statbuf->st_ctime));
592 if (current_personality == 1) {
593 printstatsol(tcp, addr);
596 #endif /* LINUXSPARC */
602 if (syserror(tcp) || !verbose(tcp)) {
603 tprintf("%#x", addr);
606 if (umove(tcp, addr, &statbuf) < 0) {
611 realprintstat(tcp, &statbuf);
616 printstat64(tcp, addr)
620 struct stat64 statbuf;
623 if (current_personality == 1) {
624 printstatsol(tcp, addr);
627 #endif /* LINUXSPARC */
633 if (syserror(tcp) || !verbose(tcp)) {
634 tprintf("%#x", addr);
637 if (umove(tcp, addr, &statbuf) < 0) {
643 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
644 (unsigned long) major(statbuf.st_dev),
645 (unsigned long) minor(statbuf.st_dev),
646 (unsigned long) statbuf.st_ino,
647 sprintmode(statbuf.st_mode));
648 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
649 (unsigned long) statbuf.st_nlink,
650 (unsigned long) statbuf.st_uid,
651 (unsigned long) statbuf.st_gid);
652 #ifdef HAVE_ST_BLKSIZE
653 tprintf("st_blksize=%lu, ",
654 (unsigned long) statbuf.st_blksize);
655 #endif /* HAVE_ST_BLKSIZE */
656 #ifdef HAVE_ST_BLOCKS
657 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
658 #endif /* HAVE_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:
665 tprintf("st_rdev=makedev(%lu, %lu), ",
666 (unsigned long) major(statbuf.st_rdev),
667 (unsigned long) minor(statbuf.st_rdev));
668 #else /* !HAVE_ST_RDEV */
669 tprintf("st_size=makedev(%lu, %lu), ",
670 (unsigned long) major(statbuf.st_size),
671 (unsigned long) minor(statbuf.st_size));
672 #endif /* !HAVE_ST_RDEV */
675 tprintf("st_size=%llu, ", statbuf.st_size);
679 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
680 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
681 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
688 convertoldstat(oldbuf, newbuf)
689 const struct __old_kernel_stat *oldbuf;
692 newbuf->st_dev=oldbuf->st_dev;
693 newbuf->st_ino=oldbuf->st_ino;
694 newbuf->st_mode=oldbuf->st_mode;
695 newbuf->st_nlink=oldbuf->st_nlink;
696 newbuf->st_uid=oldbuf->st_uid;
697 newbuf->st_gid=oldbuf->st_gid;
698 newbuf->st_rdev=oldbuf->st_rdev;
699 newbuf->st_size=oldbuf->st_size;
700 newbuf->st_atime=oldbuf->st_atime;
701 newbuf->st_mtime=oldbuf->st_mtime;
702 newbuf->st_ctime=oldbuf->st_ctime;
703 newbuf->st_blksize=0; /* not supported in old_stat */
704 newbuf->st_blocks=0; /* not supported in old_stat */
711 printoldstat(tcp, addr)
715 struct __old_kernel_stat statbuf;
716 struct stat newstatbuf;
719 if (current_personality == 1) {
720 printstatsol(tcp, addr);
723 #endif /* LINUXSPARC */
729 if (syserror(tcp) || !verbose(tcp)) {
730 tprintf("%#x", addr);
733 if (umove(tcp, addr, &statbuf) < 0) {
738 convertoldstat(&statbuf, &newstatbuf);
739 realprintstat(tcp, &newstatbuf);
749 printpath(tcp, tcp->u_arg[0]);
752 printstat(tcp, tcp->u_arg[1]);
764 printpath(tcp, tcp->u_arg[0]);
767 printstat64(tcp, tcp->u_arg[1]);
771 return printargs(tcp);
780 printpath(tcp, tcp->u_arg[0]);
783 printoldstat(tcp, tcp->u_arg[1]);
794 tprintf("%ld, ", tcp->u_arg[0]);
796 printstat(tcp, tcp->u_arg[1]);
808 tprintf("%ld, ", tcp->u_arg[0]);
810 printstat64(tcp, tcp->u_arg[1]);
814 return printargs(tcp);
823 tprintf("%ld, ", tcp->u_arg[0]);
825 printoldstat(tcp, tcp->u_arg[1]);
836 printpath(tcp, tcp->u_arg[0]);
839 printstat(tcp, tcp->u_arg[1]);
851 printpath(tcp, tcp->u_arg[0]);
854 printstat64(tcp, tcp->u_arg[1]);
858 return printargs(tcp);
867 printpath(tcp, tcp->u_arg[0]);
870 printoldstat(tcp, tcp->u_arg[1]);
877 #if defined(SVR4) || defined(LINUXSPARC)
884 tprintf("%ld, ", tcp->u_arg[0]);
885 printpath(tcp, tcp->u_arg[1]);
888 printstat(tcp, tcp->u_arg[2]);
898 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
900 printstat(tcp, tcp->u_arg[2]);
910 tprintf("%ld, ", tcp->u_arg[0]);
911 printpath(tcp, tcp->u_arg[1]);
914 printstat(tcp, tcp->u_arg[2]);
923 int mode = tcp->u_arg[2];
926 tprintf("%ld, ", tcp->u_arg[0]);
927 printpath(tcp, tcp->u_arg[1]);
928 tprintf(", %s", sprintmode(mode));
929 switch (mode & S_IFMT) {
930 case S_IFCHR: case S_IFBLK:
932 tprintf(", makedev(%lu, %lu)",
933 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
934 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
936 tprintf(", makedev(%lu, %lu)",
937 (unsigned long) major(tcp->u_arg[3]),
938 (unsigned long) minor(tcp->u_arg[3]));
948 #ifdef HAVE_SYS_ACL_H
952 struct xlat aclcmds[] = {
954 { SETACL, "SETACL" },
957 { GETACL, "GETACL" },
960 { GETACLCNT, "GETACLCNT" },
963 { ACL_GET, "ACL_GET" },
966 { ACL_SET, "ACL_SET" },
969 { ACL_CNT, "ACL_CNT" },
979 printpath(tcp, tcp->u_arg[0]);
981 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
982 tprintf(", %ld", tcp->u_arg[2]);
984 * FIXME - dump out the list of aclent_t's pointed to
985 * by "tcp->u_arg[3]" if it's not NULL.
988 tprintf(", %#lx", tcp->u_arg[3]);
1000 if (entering(tcp)) {
1001 tprintf("%ld, ", tcp->u_arg[0]);
1002 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1003 tprintf(", %ld", tcp->u_arg[2]);
1005 * FIXME - dump out the list of aclent_t's pointed to
1006 * by "tcp->u_arg[3]" if it's not NULL.
1009 tprintf(", %#lx", tcp->u_arg[3]);
1017 struct xlat aclipc[] = {
1019 { IPC_SHM, "IPC_SHM" },
1022 { IPC_SEM, "IPC_SEM" },
1025 { IPC_MSG, "IPC_MSG" },
1035 if (entering(tcp)) {
1036 printxval(aclipc, tcp->u_arg[0], "???IPC???");
1037 tprintf(", %#lx, ", tcp->u_arg[1]);
1038 printxval(aclcmds, tcp->u_arg[2], "???ACL???");
1039 tprintf(", %ld", tcp->u_arg[3]);
1041 * FIXME - dump out the list of aclent_t's pointed to
1042 * by "tcp->u_arg[4]" if it's not NULL.
1045 tprintf(", %#lx", tcp->u_arg[4]);
1054 #endif /* HAVE_SYS_ACL_H */
1056 #endif /* SVR4 || LINUXSPARC */
1060 static struct xlat fsmagic[] = {
1061 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
1062 { 0xef53, "EXT2_SUPER_MAGIC" },
1063 { 0x137d, "EXT_SUPER_MAGIC" },
1064 { 0x9660, "ISOFS_SUPER_MAGIC" },
1065 { 0x137f, "MINIX_SUPER_MAGIC" },
1066 { 0x138f, "MINIX_SUPER_MAGIC2" },
1067 { 0x2468, "MINIX2_SUPER_MAGIC" },
1068 { 0x2478, "MINIX2_SUPER_MAGIC2" },
1069 { 0x4d44, "MSDOS_SUPER_MAGIC" },
1070 { 0x6969, "NFS_SUPER_MAGIC" },
1071 { 0x9fa0, "PROC_SUPER_MAGIC" },
1072 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
1084 static char buf[32];
1088 s = xlookup(fsmagic, magic);
1090 sprintf(buf, "\"%s\"", s);
1094 sprintf(buf, "%#x", magic);
1099 printstatfs(tcp, addr)
1103 struct statfs statbuf;
1105 if (syserror(tcp) || !verbose(tcp)) {
1106 tprintf("%#lx", addr);
1109 if (umove(tcp, addr, &statbuf) < 0) {
1115 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
1116 sprintfstype(statbuf.f_type),
1117 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
1118 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_namelen=%u",
1119 statbuf.f_bavail,statbuf.f_files, statbuf.f_ffree, statbuf.f_namelen);
1121 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
1122 sprintfstype(statbuf.f_type),
1123 (unsigned long)statbuf.f_bsize,
1124 (unsigned long)statbuf.f_blocks,
1125 (unsigned long)statbuf.f_bfree);
1126 tprintf("f_files=%lu, f_ffree=%lu",
1127 (unsigned long)statbuf.f_files,
1128 (unsigned long)statbuf.f_ffree);
1130 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1140 if (entering(tcp)) {
1141 printpath(tcp, tcp->u_arg[0]);
1144 printstatfs(tcp, tcp->u_arg[1]);
1153 if (entering(tcp)) {
1154 tprintf("%lu, ", tcp->u_arg[0]);
1156 printstatfs(tcp, tcp->u_arg[1]);
1161 #if defined(linux) && defined(__alpha)
1167 if (entering(tcp)) {
1168 printpath(tcp, tcp->u_arg[0]);
1171 printstatfs(tcp, tcp->u_arg[1]);
1172 tprintf(", %lu", tcp->u_arg[2]);
1181 if (entering(tcp)) {
1182 tprintf("%lu, ", tcp->u_arg[0]);
1184 printstatfs(tcp, tcp->u_arg[1]);
1185 tprintf(", %lu", tcp->u_arg[2]);
1189 #endif /* linux && __alpha */
1199 struct ustat statbuf;
1201 if (entering(tcp)) {
1202 tprintf("makedev(%lu, %lu), ",
1203 (long) major(tcp->u_arg[0]),
1204 (long) minor(tcp->u_arg[0]));
1207 if (syserror(tcp) || !verbose(tcp))
1208 tprintf("%#lx", tcp->u_arg[1]);
1209 else if (umove(tcp, tcp->u_arg[1], &statbuf) < 0)
1212 tprintf("{f_tfree=%lu, f_tinode=%lu, ",
1213 statbuf.f_tfree, statbuf.f_tinode);
1214 tprintf("f_fname=\"%.*s\", ",
1215 (int) sizeof(statbuf.f_fname),
1217 tprintf("f_fpack=\"%.*s\"}",
1218 (int) sizeof(statbuf.f_fpack),
1232 if (entering(tcp)) {
1233 printpath(tcp, tcp->u_arg[0]);
1242 if (entering(tcp)) {
1243 printpath(tcp, tcp->u_arg[0]);
1244 tprintf(", %#lo", tcp->u_arg[1]);
1253 if (entering(tcp)) {
1254 printpath(tcp, tcp->u_arg[0]);
1263 if (entering(tcp)) {
1264 tprintf("%ld", tcp->u_arg[0]);
1273 if (entering(tcp)) {
1274 printpath(tcp, tcp->u_arg[0]);
1283 if (entering(tcp)) {
1284 tprintf("%ld", tcp->u_arg[0]);
1293 if (entering(tcp)) {
1294 printpath(tcp, tcp->u_arg[0]);
1296 printpath(tcp, tcp->u_arg[1]);
1305 if (entering(tcp)) {
1306 printpath(tcp, tcp->u_arg[0]);
1315 if (entering(tcp)) {
1316 printpath(tcp, tcp->u_arg[0]);
1318 printpath(tcp, tcp->u_arg[1]);
1327 if (entering(tcp)) {
1328 printpath(tcp, tcp->u_arg[0]);
1332 tprintf("%#lx", tcp->u_arg[1]);
1334 printpathn(tcp, tcp->u_arg[1], tcp->u_rval);
1335 tprintf(", %lu", tcp->u_arg[2]);
1344 if (entering(tcp)) {
1345 printpath(tcp, tcp->u_arg[0]);
1347 printpath(tcp, tcp->u_arg[1]);
1356 if (entering(tcp)) {
1357 printpath(tcp, tcp->u_arg[0]);
1358 tprintf(", %lu, %lu", tcp->u_arg[1], tcp->u_arg[2]);
1367 if (entering(tcp)) {
1368 tprintf("%ld, %lu, %lu",
1369 tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
1378 if (entering(tcp)) {
1379 printpath(tcp, tcp->u_arg[0]);
1380 tprintf(", %#lo", tcp->u_arg[1]);
1389 if (entering(tcp)) {
1390 tprintf("%ld, %#lo", tcp->u_arg[0], tcp->u_arg[1]);
1400 if (entering(tcp)) {
1401 printpath(tcp, tcp->u_arg[0]);
1403 printtv32(tcp, tcp->u_arg[1]);
1413 if (entering(tcp)) {
1414 printpath(tcp, tcp->u_arg[0]);
1416 printtv(tcp, tcp->u_arg[1]);
1427 if (entering(tcp)) {
1428 printpath(tcp, tcp->u_arg[0]);
1432 else if (!verbose(tcp))
1433 tprintf("%#lx", tcp->u_arg[1]);
1434 else if (umoven(tcp, tcp->u_arg[1], sizeof ut,
1438 tprintf("[%s,", sprinttime(ut[0]));
1439 tprintf(" %s]", sprinttime(ut[1]));
1449 int mode = tcp->u_arg[1];
1451 if (entering(tcp)) {
1452 printpath(tcp, tcp->u_arg[0]);
1453 tprintf(", %s", sprintmode(mode));
1454 switch (mode & S_IFMT) {
1455 case S_IFCHR: case S_IFBLK:
1457 if (current_personality == 1)
1458 tprintf(", makedev(%lu, %lu)",
1459 (unsigned long) ((tcp->u_arg[2] >> 18) & 0x3fff),
1460 (unsigned long) (tcp->u_arg[2] & 0x3ffff));
1463 tprintf(", makedev(%lu, %lu)",
1464 (unsigned long) major(tcp->u_arg[2]),
1465 (unsigned long) minor(tcp->u_arg[2]));
1478 if (entering(tcp)) {
1479 printpath(tcp, tcp->u_arg[0]);
1480 tprintf(", %#lo", tcp->u_arg[1]);
1489 if (entering(tcp)) {
1490 tprintf("%ld", tcp->u_arg[0]);
1504 if (!verbose(tcp)) {
1505 tprintf("%#lx", addr);
1508 if (umove(tcp, addr, &d) < 0) {
1512 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
1514 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
1522 if (entering(tcp)) {
1523 tprintf("%lu, ", tcp->u_arg[0]);
1525 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
1526 tprintf("%#lx", tcp->u_arg[1]);
1528 printdir(tcp, tcp->u_arg[1]);
1529 /* Not much point in printing this out, it is always 1. */
1530 if (tcp->u_arg[2] != 1)
1531 tprintf(", %lu", tcp->u_arg[2]);
1542 int i, len, dents = 0;
1545 if (entering(tcp)) {
1546 tprintf("%lu, ", tcp->u_arg[0]);
1549 if (syserror(tcp) || !verbose(tcp)) {
1550 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
1554 if ((buf = malloc(len)) == NULL) {
1555 tprintf("out of memory\n");
1558 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
1559 tprintf("{...}, %lu", tcp->u_arg[2]);
1565 for (i = 0; i < len;) {
1566 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
1569 tprintf("%s{d_ino=%lu, d_off=%lu, ",
1570 i ? " " : "", d->d_ino, d->d_off);
1571 tprintf("d_reclen=%u, d_name=\"%s\"}",
1572 d->d_reclen, d->d_name);
1577 tprintf("%s{d_ino=%lu, d_off=%lu, ",
1578 i ? " " : "", d->d_ino, d->d_off);
1579 tprintf("d_reclen=%u, d_name=\"%s\"}",
1580 d->d_reclen, d->d_name);
1585 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
1586 i ? " " : "", d->d_off, d->d_fileno,
1588 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
1589 d->d_namlen, d->d_namlen, d->d_name);
1598 tprintf("/* %u entries */", dents);
1599 tprintf(", %lu", tcp->u_arg[2]);
1612 tprintf("%#lx", tcp->u_arg[0]);
1614 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
1615 tprintf(", %lu", tcp->u_arg[1]);
1621 #ifdef HAVE_SYS_ASYNCH_H
1627 struct aio_result_t res;
1629 if (entering(tcp)) {
1630 tprintf("%lu, ", tcp->u_arg[0]);
1633 tprintf("%#lx", tcp->u_arg[1]);
1635 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1636 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
1637 printxval(whence, tcp->u_arg[4], "L_???");
1638 if (syserror(tcp) || tcp->u_arg[5] == 0
1639 || umove(tcp, tcp->u_arg[5], &res) < 0)
1640 tprintf(", %#lx", tcp->u_arg[5]);
1642 tprintf(", {aio_return %d aio_errno %d}",
1643 res.aio_return, res.aio_errno);
1652 struct aio_result_t res;
1654 if (entering(tcp)) {
1655 tprintf("%lu, ", tcp->u_arg[0]);
1656 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1657 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
1658 printxval(whence, tcp->u_arg[4], "L_???");
1661 if (tcp->u_arg[5] == 0)
1663 else if (syserror(tcp)
1664 || umove(tcp, tcp->u_arg[5], &res) < 0)
1665 tprintf(", %#lx", tcp->u_arg[5]);
1667 tprintf(", {aio_return %d aio_errno %d}",
1668 res.aio_return, res.aio_errno);
1678 printtv(tcp, tcp->u_arg[0]);
1686 struct aio_result_t res;
1689 if (tcp->u_arg[0] == 0)
1691 else if (syserror(tcp)
1692 || umove(tcp, tcp->u_arg[0], &res) < 0)
1693 tprintf("%#lx", tcp->u_arg[0]);
1695 tprintf("{aio_return %d aio_errno %d}",
1696 res.aio_return, res.aio_errno);
1701 #endif /* HAVE_SYS_ASYNCH_H */