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>
78 # define dev_t __kernel_dev_t
79 # define ino_t __kernel_ino_t
80 # define mode_t __kernel_mode_t
81 # define nlink_t __kernel_nlink_t
82 # define uid_t __kernel_uid_t
83 # define gid_t __kernel_gid_t
84 # define off_t __kernel_off_t
85 # define loff_t __kernel_loff_t
87 # include <asm/stat.h>
100 # define mode_t mode_t
101 # define nlink_t nlink_t
105 # define loff_t loff_t
107 # define stat libc_stat
108 # include <sys/stat.h>
111 # include <sys/stat.h>
117 # include <sys/cred.h>
122 #ifdef MAJOR_IN_SYSMACROS
123 #include <sys/sysmacros.h>
126 #ifdef MAJOR_IN_MKDEV
127 #include <sys/mkdev.h>
130 #ifdef HAVE_SYS_ASYNCH_H
131 #include <sys/asynch.h>
139 * This is a really dirty trick but it should always work. Traditional
140 * Unix says r/w/rw are 0/1/2, so we make them true flags 1/2/3 by
141 * adding 1. Just remember to add 1 to any arg decoded with openmodes.
143 struct xlat openmodes[] = {
144 { O_RDWR+1, "O_RDWR" },
145 { O_RDONLY+1, "O_RDONLY" },
146 { O_WRONLY+1, "O_WRONLY" },
147 { O_NONBLOCK, "O_NONBLOCK" },
148 { O_APPEND, "O_APPEND" },
149 { O_CREAT, "O_CREAT" },
150 { O_TRUNC, "O_TRUNC" },
151 { O_EXCL, "O_EXCL" },
152 { O_NOCTTY, "O_NOCTTY" },
154 { O_SYNC, "O_SYNC" },
157 { O_ASYNC, "O_ASYNC" },
160 { O_DSYNC, "O_DSYNC" },
163 { O_RSYNC, "O_RSYNC" },
166 { O_NDELAY, "O_NDELAY" },
169 { O_PRIV, "O_PRIV" },
172 { O_DIRECT, "O_DIRECT" },
175 { O_LARGEFILE, "O_LARGEFILE" },
178 { O_DIRECTORY, "O_DIRECTORY" },
182 { FNDELAY, "FNDELAY" },
185 { FAPPEND, "FAPPEND" },
191 { FDEFER, "FDEFER" },
194 { FASYNC, "FASYNC" },
197 { FSHLOCK, "FSHLOCK" },
200 { FEXLOCK, "FEXLOCK" },
203 { FCREAT, "FCREAT" },
206 { FTRUNC, "FTRUNC" },
218 { FNOCTTY, "FNOCTTY" },
228 printpath(tcp, tcp->u_arg[0]);
231 printflags(openmodes, tcp->u_arg[1] + 1);
232 if (tcp->u_arg[1] & O_CREAT) {
234 tprintf(", %#lo", tcp->u_arg[2]);
241 struct xlat openmodessol[] = {
245 { 0x80, "O_NONBLOCK" },
247 { 0x100, "O_CREAT" },
248 { 0x200, "O_TRUNC" },
250 { 0x800, "O_NOCTTY" },
253 { 0x8000, "O_RSYNC" },
255 { 0x1000, "O_PRIV" },
264 printpath(tcp, tcp->u_arg[0]);
267 printflags(openmodessol, tcp->u_arg[1] + 1);
268 if (tcp->u_arg[1] & 0x100) {
270 tprintf(", %#lo", tcp->u_arg[2]);
283 printpath(tcp, tcp->u_arg[0]);
284 tprintf(", %#lo", tcp->u_arg[1]);
289 static struct xlat access_flags[] = {
295 { EFF_ONLY_OK, "EFF_ONLY_OK" },
308 printpath(tcp, tcp->u_arg[0]);
310 printflags(access_flags, tcp->u_arg[1]);
320 tprintf("%#lo", tcp->u_arg[0]);
325 static struct xlat whence[] = {
326 { SEEK_SET, "SEEK_SET" },
327 { SEEK_CUR, "SEEK_CUR" },
328 { SEEK_END, "SEEK_END" },
337 tprintf("%ld, ", tcp->u_arg[0]);
338 if (tcp->u_arg[2] == SEEK_SET)
339 tprintf("%lu, ", tcp->u_arg[1]);
341 tprintf("%ld, ", tcp->u_arg[1]);
342 printxval(whence, tcp->u_arg[2], "SEEK_???");
344 return RVAL_UDECIMAL;
353 if (tcp->u_arg[4] == SEEK_SET)
354 tprintf("%ld, %llu, ", tcp->u_arg[0],
355 (((long long int) tcp->u_arg[1]) << 32
356 | (unsigned long long) tcp->u_arg[2]));
358 tprintf("%ld, %lld, ", tcp->u_arg[0],
359 (((long long int) tcp->u_arg[1]) << 32
360 | (unsigned long long) tcp->u_arg[2]));
364 if (syserror(tcp) || umove(tcp, tcp->u_arg[3], &off) < 0)
365 tprintf("%#lx, ", tcp->u_arg[3]);
367 tprintf("[%llu], ", off);
368 printxval(whence, tcp->u_arg[4], "SEEK_???");
379 printpath(tcp, tcp->u_arg[0]);
380 tprintf(", %lu", tcp->u_arg[1]);
390 tprintf("%ld, %lu", tcp->u_arg[0], tcp->u_arg[1]);
397 static struct xlat modetypes[] = {
398 { S_IFREG, "S_IFREG" },
399 { S_IFSOCK, "S_IFSOCK" },
400 { S_IFIFO, "S_IFIFO" },
401 { S_IFLNK, "S_IFLNK" },
402 { S_IFDIR, "S_IFDIR" },
403 { S_IFBLK, "S_IFBLK" },
404 { S_IFCHR, "S_IFCHR" },
415 if ((mode & S_IFMT) == 0)
417 else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) {
418 sprintf(buf, "%#o", mode);
421 sprintf(buf, "%s%s%s%s", s,
422 (mode & S_ISUID) ? "|S_ISUID" : "",
423 (mode & S_ISGID) ? "|S_ISGID" : "",
424 (mode & S_ISVTX) ? "|S_ISVTX" : "");
425 mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX);
427 sprintf(buf + strlen(buf), "|%#o", mode);
428 s = (*buf == '|') ? buf + 1 : buf;
444 sprintf(buf, "%02d/%02d/%02d-%02d:%02d:%02d",
445 tmp->tm_year, tmp->tm_mon + 1, tmp->tm_mday,
446 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
458 int st_pad1[3]; /* network id */
467 int st_pad3; /* st_size, off_t expansion */
468 timestruct_t st_atime;
469 timestruct_t st_mtime;
470 timestruct_t st_ctime;
474 int st_pad4[8]; /* expansion area */
478 printstatsol(tcp, addr)
482 struct solstat statbuf;
488 if (syserror(tcp) || !verbose(tcp)) {
489 tprintf("%#x", addr);
492 if (umove(tcp, addr, &statbuf) < 0) {
497 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
498 (unsigned long) ((statbuf.st_dev >> 18) & 0x3fff),
499 (unsigned long) (statbuf.st_dev & 0x3ffff),
500 (unsigned long) statbuf.st_ino,
501 sprintmode(statbuf.st_mode));
502 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
503 (unsigned long) statbuf.st_nlink,
504 (unsigned long) statbuf.st_uid,
505 (unsigned long) statbuf.st_gid);
506 tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);
507 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
510 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
511 switch (statbuf.st_mode & S_IFMT) {
512 case S_IFCHR: case S_IFBLK:
513 tprintf("st_rdev=makedev(%lu, %lu), ",
514 (unsigned long) ((statbuf.st_rdev >> 18) & 0x3fff),
515 (unsigned long) (statbuf.st_rdev & 0x3ffff));
518 tprintf("st_size=%u, ", statbuf.st_size);
522 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
523 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
524 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
529 #endif /* LINUXSPARC */
532 realprintstat(tcp, statbuf)
534 struct stat *statbuf;
537 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
538 (unsigned long) major(statbuf->st_dev),
539 (unsigned long) minor(statbuf->st_dev),
540 (unsigned long) statbuf->st_ino,
541 sprintmode(statbuf->st_mode));
542 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
543 (unsigned long) statbuf->st_nlink,
544 (unsigned long) statbuf->st_uid,
545 (unsigned long) statbuf->st_gid);
546 #ifdef HAVE_ST_BLKSIZE
547 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
548 #endif /* HAVE_ST_BLKSIZE */
549 #ifdef HAVE_ST_BLOCKS
550 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
551 #endif /* HAVE_ST_BLOCKS */
554 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
555 switch (statbuf->st_mode & S_IFMT) {
556 case S_IFCHR: case S_IFBLK:
558 tprintf("st_rdev=makedev(%lu, %lu), ",
559 (unsigned long) major(statbuf->st_rdev),
560 (unsigned long) minor(statbuf->st_rdev));
561 #else /* !HAVE_ST_RDEV */
562 tprintf("st_size=makedev(%lu, %lu), ",
563 (unsigned long) major(statbuf->st_size),
564 (unsigned long) minor(statbuf->st_size));
565 #endif /* !HAVE_ST_RDEV */
568 tprintf("st_size=%lu, ", statbuf->st_size);
572 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
573 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
574 tprintf("st_ctime=%s}", sprinttime(statbuf->st_ctime));
589 if (current_personality == 1) {
590 printstatsol(tcp, addr);
593 #endif /* LINUXSPARC */
599 if (syserror(tcp) || !verbose(tcp)) {
600 tprintf("%#x", addr);
603 if (umove(tcp, addr, &statbuf) < 0) {
608 realprintstat(tcp, &statbuf);
613 convertoldstat(oldbuf, newbuf)
614 const struct __old_kernel_stat *oldbuf;
617 newbuf->st_dev=oldbuf->st_dev;
618 newbuf->st_ino=oldbuf->st_ino;
619 newbuf->st_mode=oldbuf->st_mode;
620 newbuf->st_nlink=oldbuf->st_nlink;
621 newbuf->st_uid=oldbuf->st_uid;
622 newbuf->st_gid=oldbuf->st_gid;
623 newbuf->st_rdev=oldbuf->st_rdev;
624 newbuf->st_size=oldbuf->st_size;
625 newbuf->st_atime=oldbuf->st_atime;
626 newbuf->st_mtime=oldbuf->st_mtime;
627 newbuf->st_ctime=oldbuf->st_ctime;
628 newbuf->st_blksize=0; /* not supported in old_stat */
629 newbuf->st_blocks=0; /* not supported in old_stat */
636 printoldstat(tcp, addr)
640 struct __old_kernel_stat statbuf;
641 struct stat newstatbuf;
644 if (current_personality == 1) {
645 printstatsol(tcp, addr);
648 #endif /* LINUXSPARC */
654 if (syserror(tcp) || !verbose(tcp)) {
655 tprintf("%#x", addr);
658 if (umove(tcp, addr, &statbuf) < 0) {
663 convertoldstat(&statbuf, &newstatbuf);
664 realprintstat(tcp, &newstatbuf);
674 printpath(tcp, tcp->u_arg[0]);
677 printstat(tcp, tcp->u_arg[1]);
688 printpath(tcp, tcp->u_arg[0]);
691 printoldstat(tcp, tcp->u_arg[1]);
702 tprintf("%ld, ", tcp->u_arg[0]);
704 printstat(tcp, tcp->u_arg[1]);
715 tprintf("%ld, ", tcp->u_arg[0]);
717 printoldstat(tcp, tcp->u_arg[1]);
728 printpath(tcp, tcp->u_arg[0]);
731 printstat(tcp, tcp->u_arg[1]);
742 printpath(tcp, tcp->u_arg[0]);
745 printoldstat(tcp, tcp->u_arg[1]);
752 #if defined(SVR4) || defined(LINUXSPARC)
759 tprintf("%ld, ", tcp->u_arg[0]);
760 printpath(tcp, tcp->u_arg[1]);
763 printstat(tcp, tcp->u_arg[2]);
773 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
775 printstat(tcp, tcp->u_arg[2]);
785 tprintf("%ld, ", tcp->u_arg[0]);
786 printpath(tcp, tcp->u_arg[1]);
789 printstat(tcp, tcp->u_arg[2]);
798 int mode = tcp->u_arg[2];
801 tprintf("%ld, ", tcp->u_arg[0]);
802 printpath(tcp, tcp->u_arg[1]);
803 tprintf(", %s", sprintmode(mode));
804 switch (mode & S_IFMT) {
805 case S_IFCHR: case S_IFBLK:
807 tprintf(", makedev(%lu, %lu)",
808 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
809 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
811 tprintf(", makedev(%lu, %lu)",
812 (unsigned long) major(tcp->u_arg[3]),
813 (unsigned long) minor(tcp->u_arg[3]));
823 #ifdef HAVE_SYS_ACL_H
827 struct xlat aclcmds[] = {
828 { SETACL, "SETACL" },
829 { GETACL, "GETACL" },
830 { GETACLCNT, "GETACLCNT" },
839 printpath(tcp, tcp->u_arg[0]);
841 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
842 tprintf(", %ld", tcp->u_arg[2]);
844 * FIXME - dump out the list of aclent_t's pointed to
845 * by "tcp->u_arg[3]" if it's not NULL.
848 tprintf(", %#lx", tcp->u_arg[3]);
861 tprintf("%ld, ", tcp->u_arg[0]);
862 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
863 tprintf(", %ld", tcp->u_arg[2]);
865 * FIXME - dump out the list of aclent_t's pointed to
866 * by "tcp->u_arg[3]" if it's not NULL.
869 tprintf(", %#lx", tcp->u_arg[3]);
876 #endif /* HAVE_SYS_ACL_H */
878 #endif /* SVR4 || LINUXSPARC */
882 static struct xlat fsmagic[] = {
883 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
884 { 0xef53, "EXT2_SUPER_MAGIC" },
885 { 0x137d, "EXT_SUPER_MAGIC" },
886 { 0x9660, "ISOFS_SUPER_MAGIC" },
887 { 0x137f, "MINIX_SUPER_MAGIC" },
888 { 0x138f, "MINIX_SUPER_MAGIC2" },
889 { 0x2468, "MINIX2_SUPER_MAGIC" },
890 { 0x2478, "MINIX2_SUPER_MAGIC2" },
891 { 0x4d44, "MSDOS_SUPER_MAGIC" },
892 { 0x6969, "NFS_SUPER_MAGIC" },
893 { 0x9fa0, "PROC_SUPER_MAGIC" },
894 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
910 s = xlookup(fsmagic, magic);
912 sprintf(buf, "\"%s\"", s);
916 sprintf(buf, "%#x", magic);
921 printstatfs(tcp, addr)
925 struct statfs statbuf;
927 if (syserror(tcp) || !verbose(tcp)) {
928 tprintf("%#lx", addr);
931 if (umove(tcp, addr, &statbuf) < 0) {
937 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
938 sprintfstype(statbuf.f_type),
939 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
940 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_namelen=%u",
941 statbuf.f_bavail,statbuf.f_files, statbuf.f_ffree, statbuf.f_namelen);
943 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
944 sprintfstype(statbuf.f_type),
945 (unsigned long)statbuf.f_bsize,
946 (unsigned long)statbuf.f_blocks,
947 (unsigned long)statbuf.f_bfree);
948 tprintf("f_files=%lu, f_ffree=%lu",
949 (unsigned long)statbuf.f_files,
950 (unsigned long)statbuf.f_ffree);
952 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
963 printpath(tcp, tcp->u_arg[0]);
966 printstatfs(tcp, tcp->u_arg[1]);
976 tprintf("%lu, ", tcp->u_arg[0]);
978 printstatfs(tcp, tcp->u_arg[1]);
983 #if defined(linux) && defined(__alpha)
990 printpath(tcp, tcp->u_arg[0]);
993 printstatfs(tcp, tcp->u_arg[1]);
994 tprintf(", %lu", tcp->u_arg[2]);
1003 if (entering(tcp)) {
1004 tprintf("%lu, ", tcp->u_arg[0]);
1006 printstatfs(tcp, tcp->u_arg[1]);
1007 tprintf(", %lu", tcp->u_arg[2]);
1011 #endif /* linux && __alpha */
1021 struct ustat statbuf;
1023 if (entering(tcp)) {
1024 tprintf("makedev(%lu, %lu), ",
1025 (long) major(tcp->u_arg[0]),
1026 (long) minor(tcp->u_arg[0]));
1029 if (syserror(tcp) || !verbose(tcp))
1030 tprintf("%#lx", tcp->u_arg[1]);
1031 else if (umove(tcp, tcp->u_arg[1], &statbuf) < 0)
1034 tprintf("{f_tfree=%lu, f_tinode=%lu, ",
1035 statbuf.f_tfree, statbuf.f_tinode);
1036 tprintf("f_fname=\"%.*s\", ",
1037 (int) sizeof(statbuf.f_fname),
1039 tprintf("f_fpack=\"%.*s\"}",
1040 (int) sizeof(statbuf.f_fpack),
1054 if (entering(tcp)) {
1055 printpath(tcp, tcp->u_arg[0]);
1064 if (entering(tcp)) {
1065 printpath(tcp, tcp->u_arg[0]);
1066 tprintf(", %#lo", tcp->u_arg[1]);
1075 if (entering(tcp)) {
1076 printpath(tcp, tcp->u_arg[0]);
1085 if (entering(tcp)) {
1086 tprintf("%ld", tcp->u_arg[0]);
1095 if (entering(tcp)) {
1096 printpath(tcp, tcp->u_arg[0]);
1105 if (entering(tcp)) {
1106 tprintf("%ld", tcp->u_arg[0]);
1115 if (entering(tcp)) {
1116 printpath(tcp, tcp->u_arg[0]);
1118 printpath(tcp, tcp->u_arg[1]);
1127 if (entering(tcp)) {
1128 printpath(tcp, tcp->u_arg[0]);
1137 if (entering(tcp)) {
1138 printpath(tcp, tcp->u_arg[0]);
1140 printpath(tcp, tcp->u_arg[1]);
1149 if (entering(tcp)) {
1150 printpath(tcp, tcp->u_arg[0]);
1154 tprintf("%#lx", tcp->u_arg[1]);
1156 printpathn(tcp, tcp->u_arg[1], tcp->u_rval);
1157 tprintf(", %lu", tcp->u_arg[2]);
1166 if (entering(tcp)) {
1167 printpath(tcp, tcp->u_arg[0]);
1169 printpath(tcp, tcp->u_arg[1]);
1178 if (entering(tcp)) {
1179 printpath(tcp, tcp->u_arg[0]);
1180 tprintf(", %lu, %lu", tcp->u_arg[1], tcp->u_arg[2]);
1189 if (entering(tcp)) {
1190 tprintf("%ld, %lu, %lu",
1191 tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
1200 if (entering(tcp)) {
1201 printpath(tcp, tcp->u_arg[0]);
1202 tprintf(", %#lo", tcp->u_arg[1]);
1211 if (entering(tcp)) {
1212 tprintf("%ld, %#lo", tcp->u_arg[0], tcp->u_arg[1]);
1221 if (entering(tcp)) {
1222 printpath(tcp, tcp->u_arg[0]);
1224 printtv(tcp, tcp->u_arg[1]);
1235 if (entering(tcp)) {
1236 printpath(tcp, tcp->u_arg[0]);
1240 else if (!verbose(tcp))
1241 tprintf("%#lx", tcp->u_arg[1]);
1242 else if (umoven(tcp, tcp->u_arg[1], sizeof ut,
1246 tprintf("[%s,", sprinttime(ut[0]));
1247 tprintf(" %s]", sprinttime(ut[1]));
1257 int mode = tcp->u_arg[1];
1259 if (entering(tcp)) {
1260 printpath(tcp, tcp->u_arg[0]);
1261 tprintf(", %s", sprintmode(mode));
1262 switch (mode & S_IFMT) {
1263 case S_IFCHR: case S_IFBLK:
1265 if (current_personality == 1)
1266 tprintf(", makedev(%lu, %lu)",
1267 (unsigned long) ((tcp->u_arg[2] >> 18) & 0x3fff),
1268 (unsigned long) (tcp->u_arg[2] & 0x3ffff));
1271 tprintf(", makedev(%lu, %lu)",
1272 (unsigned long) major(tcp->u_arg[2]),
1273 (unsigned long) minor(tcp->u_arg[2]));
1286 if (entering(tcp)) {
1287 printpath(tcp, tcp->u_arg[0]);
1288 tprintf(", %#lo", tcp->u_arg[1]);
1297 if (entering(tcp)) {
1298 tprintf("%ld", tcp->u_arg[0]);
1312 if (!verbose(tcp)) {
1313 tprintf("%#lx", addr);
1316 if (umove(tcp, addr, &d) < 0) {
1320 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
1322 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
1330 if (entering(tcp)) {
1331 tprintf("%lu, ", tcp->u_arg[0]);
1333 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
1334 tprintf("%#lx", tcp->u_arg[1]);
1336 printdir(tcp, tcp->u_arg[1]);
1337 /* Not much point in printing this out, it is always 1. */
1338 if (tcp->u_arg[2] != 1)
1339 tprintf(", %lu", tcp->u_arg[2]);
1350 int i, len, dents = 0;
1353 if (entering(tcp)) {
1354 tprintf("%lu, ", tcp->u_arg[0]);
1357 if (syserror(tcp) || !verbose(tcp)) {
1358 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
1362 if ((buf = malloc(len)) == NULL) {
1363 tprintf("out of memory\n");
1366 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
1367 tprintf("{...}, %lu", tcp->u_arg[2]);
1373 for (i = 0; i < len;) {
1374 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
1377 tprintf("%s{d_ino=%lu, d_off=%lu, ",
1378 i ? " " : "", d->d_ino, d->d_off);
1379 tprintf("d_reclen=%u, d_name=\"%s\"}",
1380 d->d_reclen, d->d_name);
1385 tprintf("%s{d_ino=%lu, d_off=%lu, ",
1386 i ? " " : "", d->d_ino, d->d_off);
1387 tprintf("d_reclen=%u, d_name=\"%s\"}",
1388 d->d_reclen, d->d_name);
1393 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
1394 i ? " " : "", d->d_off, d->d_fileno,
1396 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
1397 d->d_namlen, d->d_namlen, d->d_name);
1406 tprintf("/* %u entries */", dents);
1407 tprintf(", %lu", tcp->u_arg[2]);
1420 tprintf("%#lx", tcp->u_arg[0]);
1422 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
1423 tprintf(", %lu", tcp->u_arg[1]);
1429 #ifdef HAVE_SYS_ASYNCH_H
1435 struct aio_result_t res;
1437 if (entering(tcp)) {
1438 tprintf("%lu, ", tcp->u_arg[0]);
1441 tprintf("%#lx", tcp->u_arg[1]);
1443 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1444 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
1445 printxval(whence, tcp->u_arg[4], "L_???");
1446 if (syserror(tcp) || tcp->u_arg[5] == 0
1447 || umove(tcp, tcp->u_arg[5], &res) < 0)
1448 tprintf(", %#lx", tcp->u_arg[5]);
1450 tprintf(", {aio_return %d aio_errno %d}",
1451 res.aio_return, res.aio_errno);
1460 struct aio_result_t res;
1462 if (entering(tcp)) {
1463 tprintf("%lu, ", tcp->u_arg[0]);
1464 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1465 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
1466 printxval(whence, tcp->u_arg[4], "L_???");
1469 if (tcp->u_arg[5] == 0)
1471 else if (syserror(tcp)
1472 || umove(tcp, tcp->u_arg[5], &res) < 0)
1473 tprintf(", %#lx", tcp->u_arg[5]);
1475 tprintf(", {aio_return %d aio_errno %d}",
1476 res.aio_return, res.aio_errno);
1486 printtv(tcp, tcp->u_arg[0]);
1494 struct aio_result_t res;
1497 if (tcp->u_arg[0] == 0)
1499 else if (syserror(tcp)
1500 || umove(tcp, tcp->u_arg[0], &res) < 0)
1501 tprintf("%#lx", tcp->u_arg[0]);
1503 tprintf("{aio_return %d aio_errno %d}",
1504 res.aio_return, res.aio_errno);
1509 #endif /* HAVE_SYS_ASYNCH_H */