3 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
4 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
5 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
6 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. The name of the author may not be used to endorse or promote products
18 * derived from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
38 #define dirent kernel_dirent
39 #define dirent64 kernel_dirent64
40 #include <linux/types.h>
41 #include <linux/dirent.h>
44 #define kernel_dirent dirent
50 unsigned short st_dev;
52 unsigned short st_mode;
54 unsigned short st_uid;
55 unsigned short st_gid;
56 unsigned short st_rdev;
59 unsigned int __unused1;
61 unsigned int __unused2;
63 unsigned int __unused3;
66 unsigned int __unused4[2];
68 # define stat kernel_stat
69 # include <asm/stat.h>
81 # define dev_t __kernel_dev_t
82 # define ino_t __kernel_ino_t
83 # define mode_t __kernel_mode_t
84 # define nlink_t __kernel_nlink_t
85 # define uid_t __kernel_uid_t
86 # define gid_t __kernel_gid_t
87 # define off_t __kernel_off_t
88 # define loff_t __kernel_loff_t
90 # include <asm/stat.h>
103 # define mode_t mode_t
104 # define nlink_t nlink_t
108 # define loff_t loff_t
110 # define stat libc_stat
111 # define stat64 libc_stat64
112 # include <sys/stat.h>
116 # include <sys/stat.h>
122 # include <sys/cred.h>
125 #ifdef HAVE_SYS_VFS_H
130 #include <sys/param.h>
131 #include <sys/mount.h>
132 #include <sys/stat.h>
135 #define HAVE_STAT64 1 /* Ugly hack */
138 #ifdef MAJOR_IN_SYSMACROS
139 #include <sys/sysmacros.h>
142 #ifdef MAJOR_IN_MKDEV
143 #include <sys/mkdev.h>
146 #ifdef HAVE_SYS_ASYNCH_H
147 #include <sys/asynch.h>
155 * This is a really dirty trick but it should always work. Traditional
156 * Unix says r/w/rw are 0/1/2, so we make them true flags 1/2/3 by
157 * adding 1. Just remember to add 1 to any arg decoded with openmodes.
159 struct xlat openmodes[] = {
160 { O_RDWR+1, "O_RDWR" },
161 { O_RDONLY+1, "O_RDONLY" },
162 { O_WRONLY+1, "O_WRONLY" },
163 { O_NONBLOCK, "O_NONBLOCK" },
164 { O_APPEND, "O_APPEND" },
165 { O_CREAT, "O_CREAT" },
166 { O_TRUNC, "O_TRUNC" },
167 { O_EXCL, "O_EXCL" },
168 { O_NOCTTY, "O_NOCTTY" },
170 { O_SYNC, "O_SYNC" },
173 { O_ASYNC, "O_ASYNC" },
176 { O_DSYNC, "O_DSYNC" },
179 { O_RSYNC, "O_RSYNC" },
182 { O_NDELAY, "O_NDELAY" },
185 { O_PRIV, "O_PRIV" },
188 { O_DIRECT, "O_DIRECT" },
191 { O_LARGEFILE, "O_LARGEFILE" },
194 { O_DIRECTORY, "O_DIRECTORY" },
197 { O_NOFOLLOW, "O_NOFOLLOW" },
201 { FNDELAY, "FNDELAY" },
204 { FAPPEND, "FAPPEND" },
210 { FDEFER, "FDEFER" },
213 { FASYNC, "FASYNC" },
216 { FSHLOCK, "FSHLOCK" },
219 { FEXLOCK, "FEXLOCK" },
222 { FCREAT, "FCREAT" },
225 { FTRUNC, "FTRUNC" },
237 { FNOCTTY, "FNOCTTY" },
240 { O_SHLOCK, "O_SHLOCK" },
243 { O_EXLOCK, "O_EXLOCK" },
253 printpath(tcp, tcp->u_arg[0]);
256 printflags(openmodes, tcp->u_arg[1] + 1);
257 if (tcp->u_arg[1] & O_CREAT) {
259 tprintf(", %#lo", tcp->u_arg[2]);
266 struct xlat openmodessol[] = {
270 { 0x80, "O_NONBLOCK" },
272 { 0x100, "O_CREAT" },
273 { 0x200, "O_TRUNC" },
275 { 0x800, "O_NOCTTY" },
278 { 0x8000, "O_RSYNC" },
280 { 0x1000, "O_PRIV" },
289 printpath(tcp, tcp->u_arg[0]);
292 printflags(openmodessol, tcp->u_arg[1] + 1);
293 if (tcp->u_arg[1] & 0x100) {
295 tprintf(", %#lo", tcp->u_arg[2]);
308 printpath(tcp, tcp->u_arg[0]);
309 tprintf(", %#lo", tcp->u_arg[1]);
314 static struct xlat access_flags[] = {
320 { EFF_ONLY_OK, "EFF_ONLY_OK" },
333 printpath(tcp, tcp->u_arg[0]);
335 printflags(access_flags, tcp->u_arg[1]);
345 tprintf("%#lo", tcp->u_arg[0]);
350 static struct xlat whence[] = {
351 { SEEK_SET, "SEEK_SET" },
352 { SEEK_CUR, "SEEK_CUR" },
353 { SEEK_END, "SEEK_END" },
366 tprintf("%ld, ", tcp->u_arg[0]);
367 offset = tcp->u_arg[1];
368 _whence = tcp->u_arg[2];
369 if (_whence == SEEK_SET)
370 tprintf("%lu, ", offset);
372 tprintf("%ld, ", offset);
373 printxval(whence, _whence, "SEEK_???");
375 return RVAL_UDECIMAL;
385 if (tcp->u_arg[4] == SEEK_SET)
386 tprintf("%ld, %llu, ", tcp->u_arg[0],
387 (((long long int) tcp->u_arg[1]) << 32
388 | (unsigned long long) tcp->u_arg[2]));
390 tprintf("%ld, %lld, ", tcp->u_arg[0],
391 (((long long int) tcp->u_arg[1]) << 32
392 | (unsigned long long) tcp->u_arg[2]));
396 if (syserror(tcp) || umove(tcp, tcp->u_arg[3], &off) < 0)
397 tprintf("%#lx, ", tcp->u_arg[3]);
399 tprintf("[%llu], ", off);
400 printxval(whence, tcp->u_arg[4], "SEEK_???");
406 #if _LFS64_LARGEFILE || FREEBSD
413 ALIGN64 (tcp, 1); /* FreeBSD aligns off_t args */
414 offset = get64(tcp->u_arg [1], tcp->u_arg[2]);
415 if (tcp->u_arg[3] == SEEK_SET)
416 tprintf("%ld, %llu, ", tcp->u_arg[0], offset);
418 tprintf("%ld, %lld, ", tcp->u_arg[0], offset);
419 printxval(whence, tcp->u_arg[3], "SEEK_???");
421 return RVAL_LUDECIMAL;
431 printpath(tcp, tcp->u_arg[0]);
432 tprintf(", %lu", tcp->u_arg[1]);
438 #if _LFS64_LARGEFILE || FREEBSD
445 printpath(tcp, tcp->u_arg[0]);
446 tprintf(", %llu", get64(tcp->u_arg[1],tcp->u_arg[2]));
458 tprintf("%ld, %lu", tcp->u_arg[0], tcp->u_arg[1]);
464 #if _LFS64_LARGEFILE || FREEBSD
471 tprintf("%ld, %llu", tcp->u_arg[0],
472 get64(tcp->u_arg[1] ,tcp->u_arg[2]));
480 static struct xlat modetypes[] = {
481 { S_IFREG, "S_IFREG" },
482 { S_IFSOCK, "S_IFSOCK" },
483 { S_IFIFO, "S_IFIFO" },
484 { S_IFLNK, "S_IFLNK" },
485 { S_IFDIR, "S_IFDIR" },
486 { S_IFBLK, "S_IFBLK" },
487 { S_IFCHR, "S_IFCHR" },
498 if ((mode & S_IFMT) == 0)
500 else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) {
501 sprintf(buf, "%#o", mode);
504 sprintf(buf, "%s%s%s%s", s,
505 (mode & S_ISUID) ? "|S_ISUID" : "",
506 (mode & S_ISGID) ? "|S_ISGID" : "",
507 (mode & S_ISVTX) ? "|S_ISVTX" : "");
508 mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX);
510 sprintf(buf + strlen(buf), "|%#o", mode);
511 s = (*buf == '|') ? buf + 1 : buf;
527 sprintf(buf, "%02d/%02d/%02d-%02d:%02d:%02d",
528 tmp->tm_year + 1900, tmp->tm_mon + 1, tmp->tm_mday,
529 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
541 int st_pad1[3]; /* network id */
550 int st_pad3; /* st_size, off_t expansion */
551 timestruct_t st_atime;
552 timestruct_t st_mtime;
553 timestruct_t st_ctime;
557 int st_pad4[8]; /* expansion area */
561 printstatsol(tcp, addr)
565 struct solstat statbuf;
571 if (syserror(tcp) || !verbose(tcp)) {
572 tprintf("%#lx", addr);
575 if (umove(tcp, addr, &statbuf) < 0) {
580 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
581 (unsigned long) ((statbuf.st_dev >> 18) & 0x3fff),
582 (unsigned long) (statbuf.st_dev & 0x3ffff),
583 (unsigned long) statbuf.st_ino,
584 sprintmode(statbuf.st_mode));
585 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
586 (unsigned long) statbuf.st_nlink,
587 (unsigned long) statbuf.st_uid,
588 (unsigned long) statbuf.st_gid);
589 tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);
590 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
593 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
594 switch (statbuf.st_mode & S_IFMT) {
595 case S_IFCHR: case S_IFBLK:
596 tprintf("st_rdev=makedev(%lu, %lu), ",
597 (unsigned long) ((statbuf.st_rdev >> 18) & 0x3fff),
598 (unsigned long) (statbuf.st_rdev & 0x3ffff));
601 tprintf("st_size=%u, ", statbuf.st_size);
605 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
606 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
607 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
612 #endif /* LINUXSPARC */
615 static struct xlat fileflags[] = {
616 { UF_NODUMP, "UF_NODUMP" },
617 { UF_IMMUTABLE, "UF_IMMUTABLE" },
618 { UF_APPEND, "UF_APPEND" },
619 { UF_OPAQUE, "UF_OPAQUE" },
620 { UF_NOUNLINK, "UF_NOUNLINK" },
621 { SF_ARCHIVED, "SF_ARCHIVED" },
622 { SF_IMMUTABLE, "SF_IMMUTABLE" },
623 { SF_APPEND, "SF_APPEND" },
624 { SF_NOUNLINK, "SF_NOUNLINK" },
633 printpath(tcp, tcp->u_arg[0]);
636 printflags(fileflags, tcp->u_arg[1]);
648 tprintf("%ld, ", tcp->u_arg[0]);
650 printflags(fileflags, tcp->u_arg[1]);
660 realprintstat(tcp, statbuf)
662 struct stat *statbuf;
665 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
666 (unsigned long) major(statbuf->st_dev),
667 (unsigned long) minor(statbuf->st_dev),
668 (unsigned long) statbuf->st_ino,
669 sprintmode(statbuf->st_mode));
670 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
671 (unsigned long) statbuf->st_nlink,
672 (unsigned long) statbuf->st_uid,
673 (unsigned long) statbuf->st_gid);
674 #ifdef HAVE_ST_BLKSIZE
675 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
676 #endif /* HAVE_ST_BLKSIZE */
677 #ifdef HAVE_ST_BLOCKS
678 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
679 #endif /* HAVE_ST_BLOCKS */
682 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
683 switch (statbuf->st_mode & S_IFMT) {
684 case S_IFCHR: case S_IFBLK:
686 tprintf("st_rdev=makedev(%lu, %lu), ",
687 (unsigned long) major(statbuf->st_rdev),
688 (unsigned long) minor(statbuf->st_rdev));
689 #else /* !HAVE_ST_RDEV */
690 tprintf("st_size=makedev(%lu, %lu), ",
691 (unsigned long) major(statbuf->st_size),
692 (unsigned long) minor(statbuf->st_size));
693 #endif /* !HAVE_ST_RDEV */
696 tprintf("st_size=%lu, ", statbuf->st_size);
700 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
701 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
702 tprintf("st_ctime=%s}", sprinttime(statbuf->st_ctime));
717 if (current_personality == 1) {
718 printstatsol(tcp, addr);
721 #endif /* LINUXSPARC */
727 if (syserror(tcp) || !verbose(tcp)) {
728 tprintf("%#lx", addr);
731 if (umove(tcp, addr, &statbuf) < 0) {
736 realprintstat(tcp, &statbuf);
738 #endif /* !FREEBSD */
742 printstat64(tcp, addr)
746 struct stat64 statbuf;
749 if (current_personality == 1) {
750 printstatsol(tcp, addr);
753 #endif /* LINUXSPARC */
759 if (syserror(tcp) || !verbose(tcp)) {
760 tprintf("%#lx", addr);
763 if (umove(tcp, addr, &statbuf) < 0) {
769 #ifdef HAVE_LONG_LONG
770 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
772 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
774 (unsigned long) major(statbuf.st_dev),
775 (unsigned long) minor(statbuf.st_dev),
776 #ifdef HAVE_LONG_LONG
777 (unsigned long long) statbuf.st_ino,
779 (unsigned long) statbuf.st_ino,
781 sprintmode(statbuf.st_mode));
782 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
783 (unsigned long) statbuf.st_nlink,
784 (unsigned long) statbuf.st_uid,
785 (unsigned long) statbuf.st_gid);
786 #ifdef HAVE_ST_BLKSIZE
787 tprintf("st_blksize=%lu, ",
788 (unsigned long) statbuf.st_blksize);
789 #endif /* HAVE_ST_BLKSIZE */
790 #ifdef HAVE_ST_BLOCKS
791 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
792 #endif /* HAVE_ST_BLOCKS */
795 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
796 switch (statbuf.st_mode & S_IFMT) {
797 case S_IFCHR: case S_IFBLK:
799 tprintf("st_rdev=makedev(%lu, %lu), ",
800 (unsigned long) major(statbuf.st_rdev),
801 (unsigned long) minor(statbuf.st_rdev));
802 #else /* !HAVE_ST_RDEV */
803 tprintf("st_size=makedev(%lu, %lu), ",
804 (unsigned long) major(statbuf.st_size),
805 (unsigned long) minor(statbuf.st_size));
806 #endif /* !HAVE_ST_RDEV */
809 tprintf("st_size=%llu, ", statbuf.st_size);
813 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
814 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
816 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
818 tprintf("st_ctime=%s, ", sprinttime(statbuf.st_ctime));
819 tprintf("st_flags=");
820 if (statbuf.st_flags) {
821 printflags(fileflags, statbuf.st_flags);
824 tprintf(", st_gen=%u}", statbuf.st_gen);
830 #endif /* HAVE_STAT64 */
832 #if defined(linux) && !defined(IA64)
834 convertoldstat(oldbuf, newbuf)
835 const struct __old_kernel_stat *oldbuf;
838 newbuf->st_dev=oldbuf->st_dev;
839 newbuf->st_ino=oldbuf->st_ino;
840 newbuf->st_mode=oldbuf->st_mode;
841 newbuf->st_nlink=oldbuf->st_nlink;
842 newbuf->st_uid=oldbuf->st_uid;
843 newbuf->st_gid=oldbuf->st_gid;
844 newbuf->st_rdev=oldbuf->st_rdev;
845 newbuf->st_size=oldbuf->st_size;
846 newbuf->st_atime=oldbuf->st_atime;
847 newbuf->st_mtime=oldbuf->st_mtime;
848 newbuf->st_ctime=oldbuf->st_ctime;
849 newbuf->st_blksize=0; /* not supported in old_stat */
850 newbuf->st_blocks=0; /* not supported in old_stat */
855 printoldstat(tcp, addr)
859 struct __old_kernel_stat statbuf;
860 struct stat newstatbuf;
863 if (current_personality == 1) {
864 printstatsol(tcp, addr);
867 #endif /* LINUXSPARC */
873 if (syserror(tcp) || !verbose(tcp)) {
874 tprintf("%#lx", addr);
877 if (umove(tcp, addr, &statbuf) < 0) {
882 convertoldstat(&statbuf, &newstatbuf);
883 realprintstat(tcp, &newstatbuf);
885 #endif /* linux && !IA64 */
893 printpath(tcp, tcp->u_arg[0]);
896 printstat(tcp, tcp->u_arg[1]);
908 printpath(tcp, tcp->u_arg[0]);
911 printstat64(tcp, tcp->u_arg[1]);
915 return printargs(tcp);
926 printpath(tcp, tcp->u_arg[0]);
929 printoldstat(tcp, tcp->u_arg[1]);
942 tprintf("%ld, ", tcp->u_arg[0]);
944 printstat(tcp, tcp->u_arg[1]);
956 tprintf("%ld, ", tcp->u_arg[0]);
958 printstat64(tcp, tcp->u_arg[1]);
962 return printargs(tcp);
973 tprintf("%ld, ", tcp->u_arg[0]);
975 printoldstat(tcp, tcp->u_arg[1]);
988 printpath(tcp, tcp->u_arg[0]);
991 printstat(tcp, tcp->u_arg[1]);
1002 if (entering(tcp)) {
1003 printpath(tcp, tcp->u_arg[0]);
1006 printstat64(tcp, tcp->u_arg[1]);
1010 return printargs(tcp);
1020 if (entering(tcp)) {
1021 printpath(tcp, tcp->u_arg[0]);
1024 printoldstat(tcp, tcp->u_arg[1]);
1032 #if defined(SVR4) || defined(LINUXSPARC)
1038 if (entering(tcp)) {
1039 tprintf("%ld, ", tcp->u_arg[0]);
1040 printpath(tcp, tcp->u_arg[1]);
1044 if (tcp->u_arg[0] == _STAT64_VER)
1045 printstat64 (tcp, tcp->u_arg[2]);
1048 printstat(tcp, tcp->u_arg[2]);
1058 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
1061 if (tcp->u_arg[0] == _STAT64_VER)
1062 printstat64 (tcp, tcp->u_arg[2]);
1065 printstat(tcp, tcp->u_arg[2]);
1074 if (entering(tcp)) {
1075 tprintf("%ld, ", tcp->u_arg[0]);
1076 printpath(tcp, tcp->u_arg[1]);
1080 if (tcp->u_arg[0] == _STAT64_VER)
1081 printstat64 (tcp, tcp->u_arg[2]);
1084 printstat(tcp, tcp->u_arg[2]);
1093 int mode = tcp->u_arg[2];
1095 if (entering(tcp)) {
1096 tprintf("%ld, ", tcp->u_arg[0]);
1097 printpath(tcp, tcp->u_arg[1]);
1098 tprintf(", %s", sprintmode(mode));
1099 switch (mode & S_IFMT) {
1100 case S_IFCHR: case S_IFBLK:
1102 tprintf(", makedev(%lu, %lu)",
1103 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
1104 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
1106 tprintf(", makedev(%lu, %lu)",
1107 (unsigned long) major(tcp->u_arg[3]),
1108 (unsigned long) minor(tcp->u_arg[3]));
1118 #ifdef HAVE_SYS_ACL_H
1120 #include <sys/acl.h>
1122 struct xlat aclcmds[] = {
1124 { SETACL, "SETACL" },
1127 { GETACL, "GETACL" },
1130 { GETACLCNT, "GETACLCNT" },
1133 { ACL_GET, "ACL_GET" },
1136 { ACL_SET, "ACL_SET" },
1139 { ACL_CNT, "ACL_CNT" },
1148 if (entering(tcp)) {
1149 printpath(tcp, tcp->u_arg[0]);
1151 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1152 tprintf(", %ld", tcp->u_arg[2]);
1154 * FIXME - dump out the list of aclent_t's pointed to
1155 * by "tcp->u_arg[3]" if it's not NULL.
1158 tprintf(", %#lx", tcp->u_arg[3]);
1170 if (entering(tcp)) {
1171 tprintf("%ld, ", tcp->u_arg[0]);
1172 printxval(aclcmds, tcp->u_arg[1], "???ACL???");
1173 tprintf(", %ld", tcp->u_arg[2]);
1175 * FIXME - dump out the list of aclent_t's pointed to
1176 * by "tcp->u_arg[3]" if it's not NULL.
1179 tprintf(", %#lx", tcp->u_arg[3]);
1187 struct xlat aclipc[] = {
1189 { IPC_SHM, "IPC_SHM" },
1192 { IPC_SEM, "IPC_SEM" },
1195 { IPC_MSG, "IPC_MSG" },
1205 if (entering(tcp)) {
1206 printxval(aclipc, tcp->u_arg[0], "???IPC???");
1207 tprintf(", %#lx, ", tcp->u_arg[1]);
1208 printxval(aclcmds, tcp->u_arg[2], "???ACL???");
1209 tprintf(", %ld", tcp->u_arg[3]);
1211 * FIXME - dump out the list of aclent_t's pointed to
1212 * by "tcp->u_arg[4]" if it's not NULL.
1215 tprintf(", %#lx", tcp->u_arg[4]);
1224 #endif /* HAVE_SYS_ACL_H */
1226 #endif /* SVR4 || LINUXSPARC */
1230 static struct xlat fsmagic[] = {
1231 { 0x73757245, "CODA_SUPER_MAGIC" },
1232 { 0x012ff7b7, "COH_SUPER_MAGIC" },
1233 { 0x1373, "DEVFS_SUPER_MAGIC" },
1234 { 0x1cd1, "DEVPTS_SUPER_MAGIC" },
1235 { 0x414A53, "EFS_SUPER_MAGIC" },
1236 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
1237 { 0xef53, "EXT2_SUPER_MAGIC" },
1238 { 0x137d, "EXT_SUPER_MAGIC" },
1239 { 0xf995e849, "HPFS_SUPER_MAGIC" },
1240 { 0x9660, "ISOFS_SUPER_MAGIC" },
1241 { 0x137f, "MINIX_SUPER_MAGIC" },
1242 { 0x138f, "MINIX_SUPER_MAGIC2" },
1243 { 0x2468, "MINIX2_SUPER_MAGIC" },
1244 { 0x2478, "MINIX2_SUPER_MAGIC2" },
1245 { 0x4d44, "MSDOS_SUPER_MAGIC" },
1246 { 0x564c, "NCP_SUPER_MAGIC" },
1247 { 0x6969, "NFS_SUPER_MAGIC" },
1248 { 0x9fa0, "PROC_SUPER_MAGIC" },
1249 { 0x002f, "QNX4_SUPER_MAGIC" },
1250 { 0x52654973, "REISERFS_SUPER_MAGIC" },
1251 { 0x02011994, "SHMFS_SUPER_MAGIC" },
1252 { 0x517b, "SMB_SUPER_MAGIC" },
1253 { 0x012ff7b6, "SYSV2_SUPER_MAGIC" },
1254 { 0x012ff7b5, "SYSV4_SUPER_MAGIC" },
1255 { 0x00011954, "UFS_MAGIC" },
1256 { 0x54190100, "UFS_CIGAM" },
1257 { 0x012ff7b4, "XENIX_SUPER_MAGIC" },
1258 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
1270 static char buf[32];
1274 s = xlookup(fsmagic, magic);
1276 sprintf(buf, "\"%s\"", s);
1280 sprintf(buf, "%#x", magic);
1285 printstatfs(tcp, addr)
1289 struct statfs statbuf;
1291 if (syserror(tcp) || !verbose(tcp)) {
1292 tprintf("%#lx", addr);
1295 if (umove(tcp, addr, &statbuf) < 0) {
1301 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
1302 sprintfstype(statbuf.f_type),
1303 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
1304 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_namelen=%u",
1305 statbuf.f_bavail,statbuf.f_files, statbuf.f_ffree, statbuf.f_namelen);
1307 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
1308 sprintfstype(statbuf.f_type),
1309 (unsigned long)statbuf.f_bsize,
1310 (unsigned long)statbuf.f_blocks,
1311 (unsigned long)statbuf.f_bfree);
1312 tprintf("f_files=%lu, f_ffree=%lu",
1313 (unsigned long)statbuf.f_files,
1314 (unsigned long)statbuf.f_ffree);
1316 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
1326 if (entering(tcp)) {
1327 printpath(tcp, tcp->u_arg[0]);
1330 printstatfs(tcp, tcp->u_arg[1]);
1339 if (entering(tcp)) {
1340 tprintf("%lu, ", tcp->u_arg[0]);
1342 printstatfs(tcp, tcp->u_arg[1]);
1347 #if defined(linux) && defined(__alpha)
1353 if (entering(tcp)) {
1354 printpath(tcp, tcp->u_arg[0]);
1357 printstatfs(tcp, tcp->u_arg[1]);
1358 tprintf(", %lu", tcp->u_arg[2]);
1367 if (entering(tcp)) {
1368 tprintf("%lu, ", tcp->u_arg[0]);
1370 printstatfs(tcp, tcp->u_arg[1]);
1371 tprintf(", %lu", tcp->u_arg[2]);
1375 #endif /* linux && __alpha */
1385 struct ustat statbuf;
1387 if (entering(tcp)) {
1388 tprintf("makedev(%lu, %lu), ",
1389 (long) major(tcp->u_arg[0]),
1390 (long) minor(tcp->u_arg[0]));
1393 if (syserror(tcp) || !verbose(tcp))
1394 tprintf("%#lx", tcp->u_arg[1]);
1395 else if (umove(tcp, tcp->u_arg[1], &statbuf) < 0)
1398 tprintf("{f_tfree=%lu, f_tinode=%lu, ",
1399 statbuf.f_tfree, statbuf.f_tinode);
1400 tprintf("f_fname=\"%.*s\", ",
1401 (int) sizeof(statbuf.f_fname),
1403 tprintf("f_fpack=\"%.*s\"}",
1404 (int) sizeof(statbuf.f_fpack),
1417 if (entering(tcp)) {
1418 printpath(tcp, tcp->u_arg[0]);
1420 printpath(tcp, tcp->u_arg[1]);
1431 if (entering(tcp)) {
1432 printpath(tcp, tcp->u_arg[0]);
1441 if (entering(tcp)) {
1442 printpath(tcp, tcp->u_arg[0]);
1443 tprintf(", %#lo", tcp->u_arg[1]);
1452 if (entering(tcp)) {
1453 printpath(tcp, tcp->u_arg[0]);
1462 if (entering(tcp)) {
1463 tprintf("%ld", tcp->u_arg[0]);
1472 if (entering(tcp)) {
1473 printpath(tcp, tcp->u_arg[0]);
1482 if (entering(tcp)) {
1483 tprintf("%ld", tcp->u_arg[0]);
1492 if (entering(tcp)) {
1493 printpath(tcp, tcp->u_arg[0]);
1495 printpath(tcp, tcp->u_arg[1]);
1504 if (entering(tcp)) {
1505 printpath(tcp, tcp->u_arg[0]);
1514 if (entering(tcp)) {
1515 printpath(tcp, tcp->u_arg[0]);
1517 printpath(tcp, tcp->u_arg[1]);
1526 if (entering(tcp)) {
1527 printpath(tcp, tcp->u_arg[0]);
1531 tprintf("%#lx", tcp->u_arg[1]);
1533 printpathn(tcp, tcp->u_arg[1], tcp->u_rval);
1534 tprintf(", %lu", tcp->u_arg[2]);
1543 if (entering(tcp)) {
1544 printpath(tcp, tcp->u_arg[0]);
1546 printpath(tcp, tcp->u_arg[1]);
1555 if (entering(tcp)) {
1556 printpath(tcp, tcp->u_arg[0]);
1557 tprintf(", %lu, %lu", tcp->u_arg[1], tcp->u_arg[2]);
1566 if (entering(tcp)) {
1567 tprintf("%ld, %lu, %lu",
1568 tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
1577 if (entering(tcp)) {
1578 printpath(tcp, tcp->u_arg[0]);
1579 tprintf(", %#lo", tcp->u_arg[1]);
1588 if (entering(tcp)) {
1589 tprintf("%ld, %#lo", tcp->u_arg[0], tcp->u_arg[1]);
1599 if (entering(tcp)) {
1600 printpath(tcp, tcp->u_arg[0]);
1602 printtv32(tcp, tcp->u_arg[1]);
1612 if (entering(tcp)) {
1613 printpath(tcp, tcp->u_arg[0]);
1615 printtv(tcp, tcp->u_arg[1]);
1626 if (entering(tcp)) {
1627 printpath(tcp, tcp->u_arg[0]);
1631 else if (!verbose(tcp))
1632 tprintf("%#lx", tcp->u_arg[1]);
1633 else if (umoven(tcp, tcp->u_arg[1], sizeof ut,
1637 tprintf("[%s,", sprinttime(ut[0]));
1638 tprintf(" %s]", sprinttime(ut[1]));
1648 int mode = tcp->u_arg[1];
1650 if (entering(tcp)) {
1651 printpath(tcp, tcp->u_arg[0]);
1652 tprintf(", %s", sprintmode(mode));
1653 switch (mode & S_IFMT) {
1654 case S_IFCHR: case S_IFBLK:
1656 if (current_personality == 1)
1657 tprintf(", makedev(%lu, %lu)",
1658 (unsigned long) ((tcp->u_arg[2] >> 18) & 0x3fff),
1659 (unsigned long) (tcp->u_arg[2] & 0x3ffff));
1662 tprintf(", makedev(%lu, %lu)",
1663 (unsigned long) major(tcp->u_arg[2]),
1664 (unsigned long) minor(tcp->u_arg[2]));
1677 if (entering(tcp)) {
1678 printpath(tcp, tcp->u_arg[0]);
1679 tprintf(", %#lo", tcp->u_arg[1]);
1688 if (entering(tcp)) {
1689 tprintf("%ld", tcp->u_arg[0]);
1703 if (!verbose(tcp)) {
1704 tprintf("%#lx", addr);
1707 if (umove(tcp, addr, &d) < 0) {
1711 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
1713 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
1721 if (entering(tcp)) {
1722 tprintf("%lu, ", tcp->u_arg[0]);
1724 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
1725 tprintf("%#lx", tcp->u_arg[1]);
1727 printdir(tcp, tcp->u_arg[1]);
1728 /* Not much point in printing this out, it is always 1. */
1729 if (tcp->u_arg[2] != 1)
1730 tprintf(", %lu", tcp->u_arg[2]);
1738 struct xlat direnttypes[] = {
1739 { DT_FIFO, "DT_FIFO" },
1740 { DT_CHR, "DT_CHR" },
1741 { DT_DIR, "DT_DIR" },
1742 { DT_BLK, "DT_BLK" },
1743 { DT_REG, "DT_REG" },
1744 { DT_LNK, "DT_LNK" },
1745 { DT_SOCK, "DT_SOCK" },
1746 { DT_WHT, "DT_WHT" },
1756 int i, len, dents = 0;
1759 if (entering(tcp)) {
1760 tprintf("%lu, ", tcp->u_arg[0]);
1763 if (syserror(tcp) || !verbose(tcp)) {
1764 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
1768 if ((buf = malloc(len)) == NULL) {
1769 tprintf("out of memory\n");
1772 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
1773 tprintf("{...}, %lu", tcp->u_arg[2]);
1779 for (i = 0; i < len;) {
1780 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
1783 tprintf("%s{d_ino=%lu, d_off=%lu, ",
1784 i ? " " : "", d->d_ino, d->d_off);
1785 tprintf("d_reclen=%u, d_name=\"%s\"}",
1786 d->d_reclen, d->d_name);
1791 tprintf("%s{d_ino=%lu, d_off=%lu, ",
1792 i ? " " : "", d->d_ino, d->d_off);
1793 tprintf("d_reclen=%u, d_name=\"%s\"}",
1794 d->d_reclen, d->d_name);
1799 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
1800 i ? " " : "", d->d_off, d->d_fileno,
1802 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
1803 d->d_namlen, d->d_namlen, d->d_name);
1808 tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
1809 i ? " " : "", d->d_fileno, d->d_reclen);
1810 printxval(direnttypes, d->d_type, "DT_???");
1811 tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
1812 d->d_namlen, d->d_namlen, d->d_name);
1814 #endif /* FREEBSD */
1816 tprintf("/* d_reclen == 0, problem here */");
1825 tprintf("/* %u entries */", dents);
1826 tprintf(", %lu", tcp->u_arg[2]);
1832 #if _LFS64_LARGEFILE
1837 int i, len, dents = 0;
1840 if (entering(tcp)) {
1841 tprintf("%lu, ", tcp->u_arg[0]);
1844 if (syserror(tcp) || !verbose(tcp)) {
1845 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
1849 if ((buf = malloc(len)) == NULL) {
1850 tprintf("out of memory\n");
1853 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
1854 tprintf("{...}, %lu", tcp->u_arg[2]);
1860 for (i = 0; i < len;) {
1861 struct dirent64 *d = (struct dirent64 *) &buf[i];
1864 tprintf("%s{d_ino=%lu, d_off=%lu, ",
1865 i ? " " : "", d->d_ino, d->d_off);
1866 tprintf("d_reclen=%u, d_name=\"%s\"}",
1867 d->d_reclen, d->d_name);
1872 tprintf("%s{d_ino=%llu, d_off=%llu, ",
1873 i ? " " : "", d->d_ino, d->d_off);
1874 tprintf("d_reclen=%u, d_name=\"%s\"}",
1875 d->d_reclen, d->d_name);
1880 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
1881 i ? " " : "", d->d_off, d->d_fileno,
1883 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
1884 d->d_namlen, d->d_namlen, d->d_name);
1893 tprintf("/* %u entries */", dents);
1894 tprintf(", %lu", tcp->u_arg[2]);
1902 sys_getdirentries(tcp)
1905 int i, len, dents = 0;
1909 if (entering(tcp)) {
1910 tprintf("%lu, ", tcp->u_arg[0]);
1913 if (syserror(tcp) || !verbose(tcp)) {
1914 tprintf("%#lx, %lu, %#lx", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
1918 if ((buf = malloc(len)) == NULL) {
1919 tprintf("out of memory\n");
1922 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
1923 tprintf("{...}, %lu, %#lx", tcp->u_arg[2], tcp->u_arg[3]);
1929 for (i = 0; i < len;) {
1930 struct kernel_dirent *d = (struct kernel_dirent *) &buf[i];
1932 tprintf("%s{d_fileno=%u, d_reclen=%u, d_type=",
1933 i ? " " : "", d->d_fileno, d->d_reclen);
1934 printxval(direnttypes, d->d_type, "DT_???");
1935 tprintf(", d_namlen=%u, d_name=\"%.*s\"}",
1936 d->d_namlen, d->d_namlen, d->d_name);
1944 tprintf("/* %u entries */", dents);
1946 tprintf(", %lu", tcp->u_arg[2]);
1947 if (umove(tcp, tcp->u_arg[3], &basep) < 0)
1948 tprintf(", %#lx", tcp->u_arg[3]);
1950 tprintf(", [%lu]", basep);
1962 tprintf("%#lx", tcp->u_arg[0]);
1964 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
1965 tprintf(", %lu", tcp->u_arg[1]);
1978 tprintf("%#lx", tcp->u_arg[0]);
1980 printpathn(tcp, tcp->u_arg[0], tcp->u_arg[1]);
1981 tprintf(", %lu", tcp->u_arg[1]);
1987 #ifdef HAVE_SYS_ASYNCH_H
1993 struct aio_result_t res;
1995 if (entering(tcp)) {
1996 tprintf("%lu, ", tcp->u_arg[0]);
1999 tprintf("%#lx", tcp->u_arg[1]);
2001 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2002 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2003 printxval(whence, tcp->u_arg[4], "L_???");
2004 if (syserror(tcp) || tcp->u_arg[5] == 0
2005 || umove(tcp, tcp->u_arg[5], &res) < 0)
2006 tprintf(", %#lx", tcp->u_arg[5]);
2008 tprintf(", {aio_return %d aio_errno %d}",
2009 res.aio_return, res.aio_errno);
2018 struct aio_result_t res;
2020 if (entering(tcp)) {
2021 tprintf("%lu, ", tcp->u_arg[0]);
2022 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
2023 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
2024 printxval(whence, tcp->u_arg[4], "L_???");
2027 if (tcp->u_arg[5] == 0)
2029 else if (syserror(tcp)
2030 || umove(tcp, tcp->u_arg[5], &res) < 0)
2031 tprintf(", %#lx", tcp->u_arg[5]);
2033 tprintf(", {aio_return %d aio_errno %d}",
2034 res.aio_return, res.aio_errno);
2044 printtv(tcp, tcp->u_arg[0]);
2052 struct aio_result_t res;
2055 if (tcp->u_arg[0] == 0)
2057 else if (syserror(tcp)
2058 || umove(tcp, tcp->u_arg[0], &res) < 0)
2059 tprintf("%#lx", tcp->u_arg[0]);
2061 tprintf("{aio_return %d aio_errno %d}",
2062 res.aio_return, res.aio_errno);
2067 #endif /* HAVE_SYS_ASYNCH_H */