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>
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 #define dirent kernel_dirent
37 #include <linux/types.h>
38 #include <linux/dirent.h>
41 #define kernel_dirent dirent
47 unsigned short st_dev;
49 unsigned short st_mode;
51 unsigned short st_uid;
52 unsigned short st_gid;
53 unsigned short st_rdev;
56 unsigned int __unused1;
58 unsigned int __unused2;
60 unsigned int __unused3;
63 unsigned int __unused4[2];
65 # define stat kernel_stat
66 # include <asm/stat.h>
69 # define dev_t __kernel_dev_t
70 # define ino_t __kernel_ino_t
71 # define mode_t __kernel_mode_t
72 # define nlink_t __kernel_nlink_t
73 # define uid_t __kernel_uid_t
74 # define gid_t __kernel_gid_t
75 # define off_t __kernel_off_t
76 # define loff_t __kernel_loff_t
78 # include <asm/stat.h>
89 # define stat libc_stat
90 # include <sys/stat.h>
93 # include <sys/stat.h>
99 # include <sys/cred.h>
104 #ifdef MAJOR_IN_SYSMACROS
105 #include <sys/sysmacros.h>
108 #ifdef MAJOR_IN_MKDEV
109 #include <sys/mkdev.h>
112 #ifdef HAVE_SYS_ASYNCH_H
113 #include <sys/asynch.h>
121 * This is a really dirty trick but it should always work. Traditional
122 * Unix says r/w/rw are 0/1/2, so we make them true flags 1/2/3 by
123 * adding 1. Just remember to add 1 to any arg decoded with openmodes.
125 struct xlat openmodes[] = {
126 { O_RDWR+1, "O_RDWR" },
127 { O_RDONLY+1, "O_RDONLY" },
128 { O_WRONLY+1, "O_WRONLY" },
129 { O_NONBLOCK, "O_NONBLOCK" },
130 { O_APPEND, "O_APPEND" },
131 { O_CREAT, "O_CREAT" },
132 { O_TRUNC, "O_TRUNC" },
133 { O_EXCL, "O_EXCL" },
134 { O_NOCTTY, "O_NOCTTY" },
136 { O_SYNC, "O_SYNC" },
139 { O_ASYNC, "O_ASYNC" },
142 { O_DSYNC, "O_DSYNC" },
145 { O_RSYNC, "O_RSYNC" },
148 { O_NDELAY, "O_NDELAY" },
151 { O_PRIV, "O_PRIV" },
154 { O_DIRECT, "O_DIRECT" },
157 { O_LARGEFILE, "O_LARGEFILE" },
160 { O_DIRECTORY, "O_DIRECTORY" },
164 { FNDELAY, "FNDELAY" },
167 { FAPPEND, "FAPPEND" },
173 { FDEFER, "FDEFER" },
176 { FASYNC, "FASYNC" },
179 { FSHLOCK, "FSHLOCK" },
182 { FEXLOCK, "FEXLOCK" },
185 { FCREAT, "FCREAT" },
188 { FTRUNC, "FTRUNC" },
200 { FNOCTTY, "FNOCTTY" },
210 printpath(tcp, tcp->u_arg[0]);
213 printflags(openmodes, tcp->u_arg[1] + 1);
214 if (tcp->u_arg[1] & O_CREAT) {
216 tprintf(", %#lo", tcp->u_arg[2]);
223 struct xlat openmodessol[] = {
227 { 0x80, "O_NONBLOCK" },
229 { 0x100, "O_CREAT" },
230 { 0x200, "O_TRUNC" },
232 { 0x800, "O_NOCTTY" },
235 { 0x8000, "O_RSYNC" },
237 { 0x1000, "O_PRIV" },
246 printpath(tcp, tcp->u_arg[0]);
249 printflags(openmodessol, tcp->u_arg[1] + 1);
250 if (tcp->u_arg[1] & 0x100) {
252 tprintf(", %#lo", tcp->u_arg[2]);
265 printpath(tcp, tcp->u_arg[0]);
266 tprintf(", %#lo", tcp->u_arg[1]);
271 static struct xlat access_flags[] = {
277 { EFF_ONLY_OK, "EFF_ONLY_OK" },
290 printpath(tcp, tcp->u_arg[0]);
292 printflags(access_flags, tcp->u_arg[1]);
302 tprintf("%#lo", tcp->u_arg[0]);
307 static struct xlat whence[] = {
308 { SEEK_SET, "SEEK_SET" },
309 { SEEK_CUR, "SEEK_CUR" },
310 { SEEK_END, "SEEK_END" },
319 tprintf("%ld, ", tcp->u_arg[0]);
320 if (tcp->u_arg[2] == SEEK_SET)
321 tprintf("%lu, ", tcp->u_arg[1]);
323 tprintf("%ld, ", tcp->u_arg[1]);
324 printxval(whence, tcp->u_arg[2], "SEEK_???");
326 return RVAL_UDECIMAL;
335 if (tcp->u_arg[4] == SEEK_SET)
336 tprintf("%ld, %llu, ", tcp->u_arg[0],
337 (((long long int) tcp->u_arg[1]) << 32
338 | (unsigned long long) tcp->u_arg[2]));
340 tprintf("%ld, %lld, ", tcp->u_arg[0],
341 (((long long int) tcp->u_arg[1]) << 32
342 | (unsigned long long) tcp->u_arg[2]));
346 if (syserror(tcp) || umove(tcp, tcp->u_arg[3], &off) < 0)
347 tprintf("%#lx, ", tcp->u_arg[3]);
349 tprintf("[%llu], ", off);
350 printxval(whence, tcp->u_arg[4], "SEEK_???");
361 printpath(tcp, tcp->u_arg[0]);
362 tprintf(", %lu", tcp->u_arg[1]);
372 tprintf("%ld, %lu", tcp->u_arg[0], tcp->u_arg[1]);
379 static struct xlat modetypes[] = {
380 { S_IFREG, "S_IFREG" },
381 { S_IFSOCK, "S_IFSOCK" },
382 { S_IFIFO, "S_IFIFO" },
383 { S_IFLNK, "S_IFLNK" },
384 { S_IFDIR, "S_IFDIR" },
385 { S_IFBLK, "S_IFBLK" },
386 { S_IFCHR, "S_IFCHR" },
397 if ((mode & S_IFMT) == 0)
399 else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) {
400 sprintf(buf, "%#o", mode);
403 sprintf(buf, "%s%s%s%s", s,
404 (mode & S_ISUID) ? "|S_ISUID" : "",
405 (mode & S_ISGID) ? "|S_ISGID" : "",
406 (mode & S_ISVTX) ? "|S_ISVTX" : "");
407 mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX);
409 sprintf(buf + strlen(buf), "|%#o", mode);
410 s = (*buf == '|') ? buf + 1 : buf;
426 sprintf(buf, "%02d/%02d/%02d-%02d:%02d:%02d",
427 tmp->tm_year, tmp->tm_mon + 1, tmp->tm_mday,
428 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
440 int st_pad1[3]; /* network id */
449 int st_pad3; /* st_size, off_t expansion */
450 timestruct_t st_atime;
451 timestruct_t st_mtime;
452 timestruct_t st_ctime;
456 int st_pad4[8]; /* expansion area */
460 printstatsol(tcp, addr)
464 struct solstat statbuf;
470 if (syserror(tcp) || !verbose(tcp)) {
471 tprintf("%#x", addr);
474 if (umove(tcp, addr, &statbuf) < 0) {
479 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
480 (unsigned long) ((statbuf.st_dev >> 18) & 0x3fff),
481 (unsigned long) (statbuf.st_dev & 0x3ffff),
482 (unsigned long) statbuf.st_ino,
483 sprintmode(statbuf.st_mode));
484 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
485 (unsigned long) statbuf.st_nlink,
486 (unsigned long) statbuf.st_uid,
487 (unsigned long) statbuf.st_gid);
488 tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);
489 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
492 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
493 switch (statbuf.st_mode & S_IFMT) {
494 case S_IFCHR: case S_IFBLK:
495 tprintf("st_rdev=makedev(%lu, %lu), ",
496 (unsigned long) ((statbuf.st_rdev >> 18) & 0x3fff),
497 (unsigned long) (statbuf.st_rdev & 0x3ffff));
500 tprintf("st_size=%u, ", statbuf.st_size);
504 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
505 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
506 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
511 #endif /* LINUXSPARC */
514 realprintstat(tcp, statbuf)
516 struct stat *statbuf;
519 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
520 (unsigned long) major(statbuf->st_dev),
521 (unsigned long) minor(statbuf->st_dev),
522 (unsigned long) statbuf->st_ino,
523 sprintmode(statbuf->st_mode));
524 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
525 (unsigned long) statbuf->st_nlink,
526 (unsigned long) statbuf->st_uid,
527 (unsigned long) statbuf->st_gid);
528 #ifdef HAVE_ST_BLKSIZE
529 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
530 #endif /* HAVE_ST_BLKSIZE */
531 #ifdef HAVE_ST_BLOCKS
532 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
533 #endif /* HAVE_ST_BLOCKS */
536 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
537 switch (statbuf->st_mode & S_IFMT) {
538 case S_IFCHR: case S_IFBLK:
540 tprintf("st_rdev=makedev(%lu, %lu), ",
541 (unsigned long) major(statbuf->st_rdev),
542 (unsigned long) minor(statbuf->st_rdev));
543 #else /* !HAVE_ST_RDEV */
544 tprintf("st_size=makedev(%lu, %lu), ",
545 (unsigned long) major(statbuf->st_size),
546 (unsigned long) minor(statbuf->st_size));
547 #endif /* !HAVE_ST_RDEV */
550 tprintf("st_size=%lu, ", statbuf->st_size);
554 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
555 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
556 tprintf("st_ctime=%s}", sprinttime(statbuf->st_ctime));
571 if (current_personality == 1) {
572 printstatsol(tcp, addr);
575 #endif /* LINUXSPARC */
581 if (syserror(tcp) || !verbose(tcp)) {
582 tprintf("%#x", addr);
585 if (umove(tcp, addr, &statbuf) < 0) {
590 realprintstat(tcp, &statbuf);
595 convertoldstat(oldbuf, newbuf)
596 const struct __old_kernel_stat *oldbuf;
599 newbuf->st_dev=oldbuf->st_dev;
600 newbuf->st_ino=oldbuf->st_ino;
601 newbuf->st_mode=oldbuf->st_mode;
602 newbuf->st_nlink=oldbuf->st_nlink;
603 newbuf->st_uid=oldbuf->st_uid;
604 newbuf->st_gid=oldbuf->st_gid;
605 newbuf->st_rdev=oldbuf->st_rdev;
606 newbuf->st_size=oldbuf->st_size;
607 newbuf->st_atime=oldbuf->st_atime;
608 newbuf->st_mtime=oldbuf->st_mtime;
609 newbuf->st_ctime=oldbuf->st_ctime;
610 newbuf->st_blksize=0; /* not supported in old_stat */
611 newbuf->st_blocks=0; /* not supported in old_stat */
618 printoldstat(tcp, addr)
622 struct __old_kernel_stat statbuf;
623 struct stat newstatbuf;
626 if (current_personality == 1) {
627 printstatsol(tcp, addr);
630 #endif /* LINUXSPARC */
636 if (syserror(tcp) || !verbose(tcp)) {
637 tprintf("%#x", addr);
640 if (umove(tcp, addr, &statbuf) < 0) {
645 convertoldstat(&statbuf, &newstatbuf);
646 realprintstat(tcp, &newstatbuf);
656 printpath(tcp, tcp->u_arg[0]);
659 printstat(tcp, tcp->u_arg[1]);
670 printpath(tcp, tcp->u_arg[0]);
673 printoldstat(tcp, tcp->u_arg[1]);
684 tprintf("%ld, ", tcp->u_arg[0]);
686 printstat(tcp, tcp->u_arg[1]);
697 tprintf("%ld, ", tcp->u_arg[0]);
699 printoldstat(tcp, tcp->u_arg[1]);
710 printpath(tcp, tcp->u_arg[0]);
713 printstat(tcp, tcp->u_arg[1]);
724 printpath(tcp, tcp->u_arg[0]);
727 printoldstat(tcp, tcp->u_arg[1]);
734 #if defined(SVR4) || defined(LINUXSPARC)
741 tprintf("%ld, ", tcp->u_arg[0]);
742 printpath(tcp, tcp->u_arg[1]);
745 printstat(tcp, tcp->u_arg[2]);
755 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
757 printstat(tcp, tcp->u_arg[2]);
767 tprintf("%ld, ", tcp->u_arg[0]);
768 printpath(tcp, tcp->u_arg[1]);
771 printstat(tcp, tcp->u_arg[2]);
780 int mode = tcp->u_arg[2];
783 tprintf("%ld, ", tcp->u_arg[0]);
784 printpath(tcp, tcp->u_arg[1]);
785 tprintf(", %s", sprintmode(mode));
786 switch (mode & S_IFMT) {
787 case S_IFCHR: case S_IFBLK:
789 tprintf(", makedev(%lu, %lu)",
790 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
791 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
793 tprintf(", makedev(%lu, %lu)",
794 (unsigned long) major(tcp->u_arg[3]),
795 (unsigned long) minor(tcp->u_arg[3]));
805 #ifdef HAVE_SYS_ACL_H
809 struct xlat aclcmds[] = {
810 { SETACL, "SETACL" },
811 { GETACL, "GETACL" },
812 { GETACLCNT, "GETACLCNT" },
821 printpath(tcp, tcp->u_arg[0]);
823 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
824 tprintf(", %ld", tcp->u_arg[2]);
826 * FIXME - dump out the list of aclent_t's pointed to
827 * by "tcp->u_arg[3]" if it's not NULL.
830 tprintf(", %#lx", tcp->u_arg[3]);
843 tprintf("%ld, ", tcp->u_arg[0]);
844 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
845 tprintf(", %ld", tcp->u_arg[2]);
847 * FIXME - dump out the list of aclent_t's pointed to
848 * by "tcp->u_arg[3]" if it's not NULL.
851 tprintf(", %#lx", tcp->u_arg[3]);
858 #endif /* HAVE_SYS_ACL_H */
860 #endif /* SVR4 || LINUXSPARC */
864 static struct xlat fsmagic[] = {
865 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
866 { 0xef53, "EXT2_SUPER_MAGIC" },
867 { 0x137d, "EXT_SUPER_MAGIC" },
868 { 0x9660, "ISOFS_SUPER_MAGIC" },
869 { 0x137f, "MINIX_SUPER_MAGIC" },
870 { 0x138f, "MINIX_SUPER_MAGIC2" },
871 { 0x2468, "MINIX2_SUPER_MAGIC" },
872 { 0x2478, "MINIX2_SUPER_MAGIC2" },
873 { 0x4d44, "MSDOS_SUPER_MAGIC" },
874 { 0x6969, "NFS_SUPER_MAGIC" },
875 { 0x9fa0, "PROC_SUPER_MAGIC" },
876 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
892 s = xlookup(fsmagic, magic);
894 sprintf(buf, "\"%s\"", s);
898 sprintf(buf, "%#x", magic);
903 printstatfs(tcp, addr)
907 struct statfs statbuf;
909 if (syserror(tcp) || !verbose(tcp)) {
910 tprintf("%#lx", addr);
913 if (umove(tcp, addr, &statbuf) < 0) {
919 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
920 sprintfstype(statbuf.f_type),
921 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
922 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_namelen=%u",
923 statbuf.f_bavail,statbuf.f_files, statbuf.f_ffree, statbuf.f_namelen);
925 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
926 sprintfstype(statbuf.f_type),
927 (unsigned long)statbuf.f_bsize,
928 (unsigned long)statbuf.f_blocks,
929 (unsigned long)statbuf.f_bfree);
930 tprintf("f_files=%lu, f_ffree=%lu",
931 (unsigned long)statbuf.f_files,
932 (unsigned long)statbuf.f_ffree);
934 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
945 printpath(tcp, tcp->u_arg[0]);
948 printstatfs(tcp, tcp->u_arg[1]);
958 tprintf("%lu, ", tcp->u_arg[0]);
960 printstatfs(tcp, tcp->u_arg[1]);
965 #if defined(linux) && defined(__alpha)
972 printpath(tcp, tcp->u_arg[0]);
975 printstatfs(tcp, tcp->u_arg[1]);
976 tprintf(", %lu", tcp->u_arg[2]);
986 tprintf("%lu, ", tcp->u_arg[0]);
988 printstatfs(tcp, tcp->u_arg[1]);
989 tprintf(", %lu", tcp->u_arg[2]);
993 #endif /* linux && __alpha */
1003 struct ustat statbuf;
1005 if (entering(tcp)) {
1006 tprintf("makedev(%lu, %lu), ",
1007 (long) major(tcp->u_arg[0]),
1008 (long) minor(tcp->u_arg[0]));
1011 if (syserror(tcp) || !verbose(tcp))
1012 tprintf("%#lx", tcp->u_arg[1]);
1013 else if (umove(tcp, tcp->u_arg[1], &statbuf) < 0)
1016 tprintf("{f_tfree=%lu, f_tinode=%lu, ",
1017 statbuf.f_tfree, statbuf.f_tinode);
1018 tprintf("f_fname=\"%.*s\", ",
1019 (int) sizeof(statbuf.f_fname),
1021 tprintf("f_fpack=\"%.*s\"}",
1022 (int) sizeof(statbuf.f_fpack),
1036 if (entering(tcp)) {
1037 printpath(tcp, tcp->u_arg[0]);
1046 if (entering(tcp)) {
1047 printpath(tcp, tcp->u_arg[0]);
1048 tprintf(", %#lo", tcp->u_arg[1]);
1057 if (entering(tcp)) {
1058 printpath(tcp, tcp->u_arg[0]);
1067 if (entering(tcp)) {
1068 tprintf("%ld", tcp->u_arg[0]);
1077 if (entering(tcp)) {
1078 printpath(tcp, tcp->u_arg[0]);
1087 if (entering(tcp)) {
1088 tprintf("%ld", tcp->u_arg[0]);
1097 if (entering(tcp)) {
1098 printpath(tcp, tcp->u_arg[0]);
1100 printpath(tcp, tcp->u_arg[1]);
1109 if (entering(tcp)) {
1110 printpath(tcp, tcp->u_arg[0]);
1119 if (entering(tcp)) {
1120 printpath(tcp, tcp->u_arg[0]);
1122 printpath(tcp, tcp->u_arg[1]);
1131 if (entering(tcp)) {
1132 printpath(tcp, tcp->u_arg[0]);
1136 tprintf("%#lx", tcp->u_arg[1]);
1138 printpathn(tcp, tcp->u_arg[1], tcp->u_rval);
1139 tprintf(", %lu", tcp->u_arg[2]);
1148 if (entering(tcp)) {
1149 printpath(tcp, tcp->u_arg[0]);
1151 printpath(tcp, tcp->u_arg[1]);
1160 if (entering(tcp)) {
1161 printpath(tcp, tcp->u_arg[0]);
1162 tprintf(", %lu, %lu", tcp->u_arg[1], tcp->u_arg[2]);
1171 if (entering(tcp)) {
1172 tprintf("%ld, %lu, %lu",
1173 tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
1182 if (entering(tcp)) {
1183 printpath(tcp, tcp->u_arg[0]);
1184 tprintf(", %#lo", tcp->u_arg[1]);
1193 if (entering(tcp)) {
1194 tprintf("%ld, %#lo", tcp->u_arg[0], tcp->u_arg[1]);
1203 if (entering(tcp)) {
1204 printpath(tcp, tcp->u_arg[0]);
1206 printtv(tcp, tcp->u_arg[1]);
1217 if (entering(tcp)) {
1218 printpath(tcp, tcp->u_arg[0]);
1222 else if (!verbose(tcp))
1223 tprintf("%#lx", tcp->u_arg[1]);
1224 else if (umoven(tcp, tcp->u_arg[1], sizeof ut,
1228 tprintf("[%s,", sprinttime(ut[0]));
1229 tprintf(" %s]", sprinttime(ut[1]));
1239 int mode = tcp->u_arg[1];
1241 if (entering(tcp)) {
1242 printpath(tcp, tcp->u_arg[0]);
1243 tprintf(", %s", sprintmode(mode));
1244 switch (mode & S_IFMT) {
1245 case S_IFCHR: case S_IFBLK:
1247 if (current_personality == 1)
1248 tprintf(", makedev(%lu, %lu)",
1249 (unsigned long) ((tcp->u_arg[2] >> 18) & 0x3fff),
1250 (unsigned long) (tcp->u_arg[2] & 0x3ffff));
1253 tprintf(", makedev(%lu, %lu)",
1254 (unsigned long) major(tcp->u_arg[2]),
1255 (unsigned long) minor(tcp->u_arg[2]));
1268 if (entering(tcp)) {
1269 printpath(tcp, tcp->u_arg[0]);
1270 tprintf(", %#lo", tcp->u_arg[1]);
1279 if (entering(tcp)) {
1280 tprintf("%ld", tcp->u_arg[0]);
1294 if (!verbose(tcp)) {
1295 tprintf("%#lx", addr);
1298 if (umove(tcp, addr, &d) < 0) {
1302 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
1304 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
1312 if (entering(tcp)) {
1313 tprintf("%lu, ", tcp->u_arg[0]);
1315 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
1316 tprintf("%#lx", tcp->u_arg[1]);
1318 printdir(tcp, tcp->u_arg[1]);
1319 /* Not much point in printing this out, it is always 1. */
1320 if (tcp->u_arg[2] != 1)
1321 tprintf(", %lu", tcp->u_arg[2]);
1332 int i, len, dents = 0;
1335 if (entering(tcp)) {
1336 tprintf("%lu, ", tcp->u_arg[0]);
1339 if (syserror(tcp) || !verbose(tcp)) {
1340 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
1344 if ((buf = malloc(len)) == NULL) {
1345 tprintf("out of memory\n");
1348 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
1349 tprintf("{...}, %lu", tcp->u_arg[2]);
1355 for (i = 0; i < len;) {
1356 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
1359 tprintf("%s{d_ino=%lu, d_off=%lu, ",
1360 i ? " " : "", d->d_ino, d->d_off);
1361 tprintf("d_reclen=%u, d_name=\"%s\"}",
1362 d->d_reclen, d->d_name);
1367 tprintf("%s{d_ino=%lu, d_off=%lu, ",
1368 i ? " " : "", d->d_ino, d->d_off);
1369 tprintf("d_reclen=%u, d_name=\"%s\"}",
1370 d->d_reclen, d->d_name);
1375 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
1376 i ? " " : "", d->d_off, d->d_fileno,
1378 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
1379 d->d_namlen, d->d_namlen, d->d_name);
1388 tprintf("/* %u entries */", dents);
1389 tprintf(", %lu", tcp->u_arg[2]);
1402 tprintf("%#lx", tcp->u_arg[0]);
1404 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
1405 tprintf(", %lu", tcp->u_arg[1]);
1411 #ifdef HAVE_SYS_ASYNCH_H
1417 struct aio_result_t res;
1419 if (entering(tcp)) {
1420 tprintf("%lu, ", tcp->u_arg[0]);
1423 tprintf("%#lx", tcp->u_arg[1]);
1425 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1426 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
1427 printxval(whence, tcp->u_arg[4], "L_???");
1428 if (syserror(tcp) || tcp->u_arg[5] == 0
1429 || umove(tcp, tcp->u_arg[5], &res) < 0)
1430 tprintf(", %#lx", tcp->u_arg[5]);
1432 tprintf(", {aio_return %d aio_errno %d}",
1433 res.aio_return, res.aio_errno);
1442 struct aio_result_t res;
1444 if (entering(tcp)) {
1445 tprintf("%lu, ", tcp->u_arg[0]);
1446 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1447 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
1448 printxval(whence, tcp->u_arg[4], "L_???");
1451 if (tcp->u_arg[5] == 0)
1453 else if (syserror(tcp)
1454 || umove(tcp, tcp->u_arg[5], &res) < 0)
1455 tprintf(", %#lx", tcp->u_arg[5]);
1457 tprintf(", {aio_return %d aio_errno %d}",
1458 res.aio_return, res.aio_errno);
1468 printtv(tcp, tcp->u_arg[0]);
1476 struct aio_result_t res;
1479 if (tcp->u_arg[0] == 0)
1481 else if (syserror(tcp)
1482 || umove(tcp, tcp->u_arg[0], &res) < 0)
1483 tprintf("%#lx", tcp->u_arg[0]);
1485 tprintf("{aio_return %d aio_errno %d}",
1486 res.aio_return, res.aio_errno);
1491 #endif /* HAVE_SYS_ASYNCH_H */