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 + 1900, 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("%#lx", 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("%#lx", 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("%#lx", 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 #if defined(linux) && !defined(IA64)
690 convertoldstat(oldbuf, newbuf)
691 const struct __old_kernel_stat *oldbuf;
694 newbuf->st_dev=oldbuf->st_dev;
695 newbuf->st_ino=oldbuf->st_ino;
696 newbuf->st_mode=oldbuf->st_mode;
697 newbuf->st_nlink=oldbuf->st_nlink;
698 newbuf->st_uid=oldbuf->st_uid;
699 newbuf->st_gid=oldbuf->st_gid;
700 newbuf->st_rdev=oldbuf->st_rdev;
701 newbuf->st_size=oldbuf->st_size;
702 newbuf->st_atime=oldbuf->st_atime;
703 newbuf->st_mtime=oldbuf->st_mtime;
704 newbuf->st_ctime=oldbuf->st_ctime;
705 newbuf->st_blksize=0; /* not supported in old_stat */
706 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("%#lx", addr);
733 if (umove(tcp, addr, &statbuf) < 0) {
738 convertoldstat(&statbuf, &newstatbuf);
739 realprintstat(tcp, &newstatbuf);
741 #endif /* linux && !IA64 */
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);
781 printpath(tcp, tcp->u_arg[0]);
784 printoldstat(tcp, tcp->u_arg[1]);
796 tprintf("%ld, ", tcp->u_arg[0]);
798 printstat(tcp, tcp->u_arg[1]);
810 tprintf("%ld, ", tcp->u_arg[0]);
812 printstat64(tcp, tcp->u_arg[1]);
816 return printargs(tcp);
826 tprintf("%ld, ", tcp->u_arg[0]);
828 printoldstat(tcp, tcp->u_arg[1]);
840 printpath(tcp, tcp->u_arg[0]);
843 printstat(tcp, tcp->u_arg[1]);
855 printpath(tcp, tcp->u_arg[0]);
858 printstat64(tcp, tcp->u_arg[1]);
862 return printargs(tcp);
872 printpath(tcp, tcp->u_arg[0]);
875 printoldstat(tcp, tcp->u_arg[1]);
883 #if defined(SVR4) || defined(LINUXSPARC)
890 tprintf("%ld, ", tcp->u_arg[0]);
891 printpath(tcp, tcp->u_arg[1]);
894 printstat(tcp, tcp->u_arg[2]);
904 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
906 printstat(tcp, tcp->u_arg[2]);
916 tprintf("%ld, ", tcp->u_arg[0]);
917 printpath(tcp, tcp->u_arg[1]);
920 printstat(tcp, tcp->u_arg[2]);
929 int mode = tcp->u_arg[2];
932 tprintf("%ld, ", tcp->u_arg[0]);
933 printpath(tcp, tcp->u_arg[1]);
934 tprintf(", %s", sprintmode(mode));
935 switch (mode & S_IFMT) {
936 case S_IFCHR: case S_IFBLK:
938 tprintf(", makedev(%lu, %lu)",
939 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
940 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
942 tprintf(", makedev(%lu, %lu)",
943 (unsigned long) major(tcp->u_arg[3]),
944 (unsigned long) minor(tcp->u_arg[3]));
954 #ifdef HAVE_SYS_ACL_H
958 struct xlat aclcmds[] = {
960 { SETACL, "SETACL" },
963 { GETACL, "GETACL" },
966 { GETACLCNT, "GETACLCNT" },
969 { ACL_GET, "ACL_GET" },
972 { ACL_SET, "ACL_SET" },
975 { ACL_CNT, "ACL_CNT" },
985 printpath(tcp, tcp->u_arg[0]);
987 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
988 tprintf(", %ld", tcp->u_arg[2]);
990 * FIXME - dump out the list of aclent_t's pointed to
991 * by "tcp->u_arg[3]" if it's not NULL.
994 tprintf(", %#lx", tcp->u_arg[3]);
1006 if (entering(tcp)) {
1007 tprintf("%ld, ", tcp->u_arg[0]);
1008 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1009 tprintf(", %ld", tcp->u_arg[2]);
1011 * FIXME - dump out the list of aclent_t's pointed to
1012 * by "tcp->u_arg[3]" if it's not NULL.
1015 tprintf(", %#lx", tcp->u_arg[3]);
1023 struct xlat aclipc[] = {
1025 { IPC_SHM, "IPC_SHM" },
1028 { IPC_SEM, "IPC_SEM" },
1031 { IPC_MSG, "IPC_MSG" },
1041 if (entering(tcp)) {
1042 printxval(aclipc, tcp->u_arg[0], "???IPC???");
1043 tprintf(", %#lx, ", tcp->u_arg[1]);
1044 printxval(aclcmds, tcp->u_arg[2], "???ACL???");
1045 tprintf(", %ld", tcp->u_arg[3]);
1047 * FIXME - dump out the list of aclent_t's pointed to
1048 * by "tcp->u_arg[4]" if it's not NULL.
1051 tprintf(", %#lx", tcp->u_arg[4]);
1060 #endif /* HAVE_SYS_ACL_H */
1062 #endif /* SVR4 || LINUXSPARC */
1066 static struct xlat fsmagic[] = {
1067 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
1068 { 0xef53, "EXT2_SUPER_MAGIC" },
1069 { 0x137d, "EXT_SUPER_MAGIC" },
1070 { 0x9660, "ISOFS_SUPER_MAGIC" },
1071 { 0x137f, "MINIX_SUPER_MAGIC" },
1072 { 0x138f, "MINIX_SUPER_MAGIC2" },
1073 { 0x2468, "MINIX2_SUPER_MAGIC" },
1074 { 0x2478, "MINIX2_SUPER_MAGIC2" },
1075 { 0x4d44, "MSDOS_SUPER_MAGIC" },
1076 { 0x6969, "NFS_SUPER_MAGIC" },
1077 { 0x9fa0, "PROC_SUPER_MAGIC" },
1078 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
1090 static char buf[32];
1094 s = xlookup(fsmagic, magic);
1096 sprintf(buf, "\"%s\"", s);
1100 sprintf(buf, "%#x", magic);
1105 printstatfs(tcp, addr)
1109 struct statfs statbuf;
1111 if (syserror(tcp) || !verbose(tcp)) {
1112 tprintf("%#lx", addr);
1115 if (umove(tcp, addr, &statbuf) < 0) {
1121 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
1122 sprintfstype(statbuf.f_type),
1123 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
1124 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_namelen=%u",
1125 statbuf.f_bavail,statbuf.f_files, statbuf.f_ffree, statbuf.f_namelen);
1127 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
1128 sprintfstype(statbuf.f_type),
1129 (unsigned long)statbuf.f_bsize,
1130 (unsigned long)statbuf.f_blocks,
1131 (unsigned long)statbuf.f_bfree);
1132 tprintf("f_files=%lu, f_ffree=%lu",
1133 (unsigned long)statbuf.f_files,
1134 (unsigned long)statbuf.f_ffree);
1136 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1146 if (entering(tcp)) {
1147 printpath(tcp, tcp->u_arg[0]);
1150 printstatfs(tcp, tcp->u_arg[1]);
1159 if (entering(tcp)) {
1160 tprintf("%lu, ", tcp->u_arg[0]);
1162 printstatfs(tcp, tcp->u_arg[1]);
1167 #if defined(linux) && defined(__alpha)
1173 if (entering(tcp)) {
1174 printpath(tcp, tcp->u_arg[0]);
1177 printstatfs(tcp, tcp->u_arg[1]);
1178 tprintf(", %lu", tcp->u_arg[2]);
1187 if (entering(tcp)) {
1188 tprintf("%lu, ", tcp->u_arg[0]);
1190 printstatfs(tcp, tcp->u_arg[1]);
1191 tprintf(", %lu", tcp->u_arg[2]);
1195 #endif /* linux && __alpha */
1205 struct ustat statbuf;
1207 if (entering(tcp)) {
1208 tprintf("makedev(%lu, %lu), ",
1209 (long) major(tcp->u_arg[0]),
1210 (long) minor(tcp->u_arg[0]));
1213 if (syserror(tcp) || !verbose(tcp))
1214 tprintf("%#lx", tcp->u_arg[1]);
1215 else if (umove(tcp, tcp->u_arg[1], &statbuf) < 0)
1218 tprintf("{f_tfree=%lu, f_tinode=%lu, ",
1219 statbuf.f_tfree, statbuf.f_tinode);
1220 tprintf("f_fname=\"%.*s\", ",
1221 (int) sizeof(statbuf.f_fname),
1223 tprintf("f_fpack=\"%.*s\"}",
1224 (int) sizeof(statbuf.f_fpack),
1238 if (entering(tcp)) {
1239 printpath(tcp, tcp->u_arg[0]);
1248 if (entering(tcp)) {
1249 printpath(tcp, tcp->u_arg[0]);
1250 tprintf(", %#lo", tcp->u_arg[1]);
1259 if (entering(tcp)) {
1260 printpath(tcp, tcp->u_arg[0]);
1269 if (entering(tcp)) {
1270 tprintf("%ld", tcp->u_arg[0]);
1279 if (entering(tcp)) {
1280 printpath(tcp, tcp->u_arg[0]);
1289 if (entering(tcp)) {
1290 tprintf("%ld", tcp->u_arg[0]);
1299 if (entering(tcp)) {
1300 printpath(tcp, tcp->u_arg[0]);
1302 printpath(tcp, tcp->u_arg[1]);
1311 if (entering(tcp)) {
1312 printpath(tcp, tcp->u_arg[0]);
1321 if (entering(tcp)) {
1322 printpath(tcp, tcp->u_arg[0]);
1324 printpath(tcp, tcp->u_arg[1]);
1333 if (entering(tcp)) {
1334 printpath(tcp, tcp->u_arg[0]);
1338 tprintf("%#lx", tcp->u_arg[1]);
1340 printpathn(tcp, tcp->u_arg[1], tcp->u_rval);
1341 tprintf(", %lu", tcp->u_arg[2]);
1350 if (entering(tcp)) {
1351 printpath(tcp, tcp->u_arg[0]);
1353 printpath(tcp, tcp->u_arg[1]);
1362 if (entering(tcp)) {
1363 printpath(tcp, tcp->u_arg[0]);
1364 tprintf(", %lu, %lu", tcp->u_arg[1], tcp->u_arg[2]);
1373 if (entering(tcp)) {
1374 tprintf("%ld, %lu, %lu",
1375 tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
1384 if (entering(tcp)) {
1385 printpath(tcp, tcp->u_arg[0]);
1386 tprintf(", %#lo", tcp->u_arg[1]);
1395 if (entering(tcp)) {
1396 tprintf("%ld, %#lo", tcp->u_arg[0], tcp->u_arg[1]);
1406 if (entering(tcp)) {
1407 printpath(tcp, tcp->u_arg[0]);
1409 printtv32(tcp, tcp->u_arg[1]);
1419 if (entering(tcp)) {
1420 printpath(tcp, tcp->u_arg[0]);
1422 printtv(tcp, tcp->u_arg[1]);
1433 if (entering(tcp)) {
1434 printpath(tcp, tcp->u_arg[0]);
1438 else if (!verbose(tcp))
1439 tprintf("%#lx", tcp->u_arg[1]);
1440 else if (umoven(tcp, tcp->u_arg[1], sizeof ut,
1444 tprintf("[%s,", sprinttime(ut[0]));
1445 tprintf(" %s]", sprinttime(ut[1]));
1455 int mode = tcp->u_arg[1];
1457 if (entering(tcp)) {
1458 printpath(tcp, tcp->u_arg[0]);
1459 tprintf(", %s", sprintmode(mode));
1460 switch (mode & S_IFMT) {
1461 case S_IFCHR: case S_IFBLK:
1463 if (current_personality == 1)
1464 tprintf(", makedev(%lu, %lu)",
1465 (unsigned long) ((tcp->u_arg[2] >> 18) & 0x3fff),
1466 (unsigned long) (tcp->u_arg[2] & 0x3ffff));
1469 tprintf(", makedev(%lu, %lu)",
1470 (unsigned long) major(tcp->u_arg[2]),
1471 (unsigned long) minor(tcp->u_arg[2]));
1484 if (entering(tcp)) {
1485 printpath(tcp, tcp->u_arg[0]);
1486 tprintf(", %#lo", tcp->u_arg[1]);
1495 if (entering(tcp)) {
1496 tprintf("%ld", tcp->u_arg[0]);
1510 if (!verbose(tcp)) {
1511 tprintf("%#lx", addr);
1514 if (umove(tcp, addr, &d) < 0) {
1518 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
1520 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
1528 if (entering(tcp)) {
1529 tprintf("%lu, ", tcp->u_arg[0]);
1531 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
1532 tprintf("%#lx", tcp->u_arg[1]);
1534 printdir(tcp, tcp->u_arg[1]);
1535 /* Not much point in printing this out, it is always 1. */
1536 if (tcp->u_arg[2] != 1)
1537 tprintf(", %lu", tcp->u_arg[2]);
1548 int i, len, dents = 0;
1551 if (entering(tcp)) {
1552 tprintf("%lu, ", tcp->u_arg[0]);
1555 if (syserror(tcp) || !verbose(tcp)) {
1556 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
1560 if ((buf = malloc(len)) == NULL) {
1561 tprintf("out of memory\n");
1564 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
1565 tprintf("{...}, %lu", tcp->u_arg[2]);
1571 for (i = 0; i < len;) {
1572 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
1575 tprintf("%s{d_ino=%lu, d_off=%lu, ",
1576 i ? " " : "", d->d_ino, d->d_off);
1577 tprintf("d_reclen=%u, d_name=\"%s\"}",
1578 d->d_reclen, d->d_name);
1583 tprintf("%s{d_ino=%lu, d_off=%lu, ",
1584 i ? " " : "", d->d_ino, d->d_off);
1585 tprintf("d_reclen=%u, d_name=\"%s\"}",
1586 d->d_reclen, d->d_name);
1591 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
1592 i ? " " : "", d->d_off, d->d_fileno,
1594 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
1595 d->d_namlen, d->d_namlen, d->d_name);
1599 tprintf("/* d_reclen == 0, problem here */");
1608 tprintf("/* %u entries */", dents);
1609 tprintf(", %lu", tcp->u_arg[2]);
1622 tprintf("%#lx", tcp->u_arg[0]);
1624 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
1625 tprintf(", %lu", tcp->u_arg[1]);
1631 #ifdef HAVE_SYS_ASYNCH_H
1637 struct aio_result_t res;
1639 if (entering(tcp)) {
1640 tprintf("%lu, ", tcp->u_arg[0]);
1643 tprintf("%#lx", tcp->u_arg[1]);
1645 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1646 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
1647 printxval(whence, tcp->u_arg[4], "L_???");
1648 if (syserror(tcp) || tcp->u_arg[5] == 0
1649 || umove(tcp, tcp->u_arg[5], &res) < 0)
1650 tprintf(", %#lx", tcp->u_arg[5]);
1652 tprintf(", {aio_return %d aio_errno %d}",
1653 res.aio_return, res.aio_errno);
1662 struct aio_result_t res;
1664 if (entering(tcp)) {
1665 tprintf("%lu, ", tcp->u_arg[0]);
1666 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1667 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
1668 printxval(whence, tcp->u_arg[4], "L_???");
1671 if (tcp->u_arg[5] == 0)
1673 else if (syserror(tcp)
1674 || umove(tcp, tcp->u_arg[5], &res) < 0)
1675 tprintf(", %#lx", tcp->u_arg[5]);
1677 tprintf(", {aio_return %d aio_errno %d}",
1678 res.aio_return, res.aio_errno);
1688 printtv(tcp, tcp->u_arg[0]);
1696 struct aio_result_t res;
1699 if (tcp->u_arg[0] == 0)
1701 else if (syserror(tcp)
1702 || umove(tcp, tcp->u_arg[0], &res) < 0)
1703 tprintf("%#lx", tcp->u_arg[0]);
1705 tprintf("{aio_return %d aio_errno %d}",
1706 res.aio_return, res.aio_errno);
1711 #endif /* HAVE_SYS_ASYNCH_H */