int st_blocks;
unsigned int __unused4[2];
};
+#if defined(SPARC64)
+struct stat_sparc64 {
+ unsigned int st_dev;
+ unsigned long st_ino;
+ unsigned int st_mode;
+ unsigned int st_nlink;
+ unsigned int st_uid;
+ unsigned int st_gid;
+ unsigned int st_rdev;
+ long st_size;
+ long st_atime;
+ long st_mtime;
+ long st_ctime;
+ long st_blksize;
+ long st_blocks;
+ unsigned long __unused4[2];
+};
+#endif /* SPARC64 */
# define stat kernel_stat
# include <asm/stat.h>
# undef stat
* Unix says r/w/rw are 0/1/2, so we make them true flags 1/2/3 by
* adding 1. Just remember to add 1 to any arg decoded with openmodes.
*/
-struct xlat openmodes[] = {
+const struct xlat openmodes[] = {
{ O_RDWR+1, "O_RDWR" },
{ O_RDONLY+1, "O_RDONLY" },
{ O_WRONLY+1, "O_WRONLY" },
}
#ifdef LINUXSPARC
-struct xlat openmodessol[] = {
+const struct xlat openmodessol[] = {
{ 0, "O_RDWR" },
{ 1, "O_RDONLY" },
{ 2, "O_WRONLY" },
return 0;
}
-static struct xlat access_flags[] = {
+static const struct xlat access_flags[] = {
{ F_OK, "F_OK", },
{ R_OK, "R_OK" },
{ W_OK, "W_OK" },
return RVAL_OCTAL;
}
-static struct xlat whence[] = {
+static const struct xlat whence[] = {
{ SEEK_SET, "SEEK_SET" },
{ SEEK_CUR, "SEEK_CUR" },
{ SEEK_END, "SEEK_END" },
/* several stats */
-static struct xlat modetypes[] = {
+static const struct xlat modetypes[] = {
{ S_IFREG, "S_IFREG" },
{ S_IFSOCK, "S_IFSOCK" },
{ S_IFIFO, "S_IFIFO" },
else
tprintf("...}");
}
+
+#if defined (SPARC64)
+static void
+printstat_sparc64(tcp, addr)
+struct tcb *tcp;
+long addr;
+{
+ struct stat_sparc64 statbuf;
+
+ if (!addr) {
+ tprintf("NULL");
+ return;
+ }
+ if (syserror(tcp) || !verbose(tcp)) {
+ tprintf("%#lx", addr);
+ return;
+ }
+ if (umove(tcp, addr, &statbuf) < 0) {
+ tprintf("{...}");
+ return;
+ }
+
+ if (!abbrev(tcp)) {
+ tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
+ (unsigned long) major(statbuf.st_dev),
+ (unsigned long) minor(statbuf.st_dev),
+ (unsigned long) statbuf.st_ino,
+ sprintmode(statbuf.st_mode));
+ tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
+ (unsigned long) statbuf.st_nlink,
+ (unsigned long) statbuf.st_uid,
+ (unsigned long) statbuf.st_gid);
+ tprintf("st_blksize=%lu, ",
+ (unsigned long) statbuf.st_blksize);
+ tprintf("st_blocks=%lu, ",
+ (unsigned long) statbuf.st_blocks);
+ }
+ else
+ tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
+ switch (statbuf.st_mode & S_IFMT) {
+ case S_IFCHR: case S_IFBLK:
+ tprintf("st_rdev=makedev(%lu, %lu), ",
+ (unsigned long) major(statbuf.st_rdev),
+ (unsigned long) minor(statbuf.st_rdev));
+ break;
+ default:
+ tprintf("st_size=%lu, ", statbuf.st_size);
+ break;
+ }
+ if (!abbrev(tcp)) {
+ tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
+ tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
+ tprintf("st_ctime=%s", sprinttime(statbuf.st_ctime));
+ tprintf("}");
+ }
+ else
+ tprintf("...}");
+}
+#endif /* SPARC64 */
#endif /* LINUXSPARC */
-struct xlat fileflags[] = {
+const struct xlat fileflags[] = {
#ifdef FREEBSD
{ UF_NODUMP, "UF_NODUMP" },
{ UF_IMMUTABLE, "UF_IMMUTABLE" },
printstatsol(tcp, addr);
return;
}
+#ifdef SPARC64
+ else if (current_personality == 2) {
+ printstat_sparc64(tcp, addr);
+ return;
+ }
+#endif
#endif /* LINUXSPARC */
if (!addr) {
printstatsol(tcp, addr);
return;
}
+#ifdef SPARC64
+ else if (current_personality == 2) {
+ printstat_sparc64(tcp, addr);
+ return;
+ }
+#endif
#endif /* LINUXSPARC */
if (!addr) {
}
#endif /* HAVE_STAT64 */
-#if defined(LINUX) && !defined(IA64) && !defined(HPPA) && !defined(X86_64) \
- && !defined(S390) && !defined(S390X)
+#if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
static void
convertoldstat(oldbuf, newbuf)
const struct __old_kernel_stat *oldbuf;
#endif
}
-#ifdef LINUX
-# if !defined(IA64) && !defined(HPPA) && !defined(X86_64) \
- && !defined(S390) && !defined(S390X)
+#if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
int
sys_oldstat(tcp)
struct tcb *tcp;
}
return 0;
}
-# endif /* !IA64 && !HPPA*/
-#endif /* LINUX */
+#endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
#ifndef HAVE_LONG_LONG_OFF_T
int
#endif
}
-#ifdef LINUX
-# if !defined(IA64) && !defined(HPPA) && !defined(X86_64) \
- && !defined(S390) && !defined(S390X)
+#if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
int
sys_oldfstat(tcp)
struct tcb *tcp;
}
return 0;
}
-# endif /* !IA64 && !HPPA && !X86_64 && !S390 && !S390X */
-#endif
+#endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
#ifndef HAVE_LONG_LONG_OFF_T
int
#endif
}
-#ifdef LINUX
-# if !defined(IA64) && !defined(HPPA) && !defined(X86_64) \
- && !defined(S390) && !defined(S390X)
+#if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT)
int
sys_oldlstat(tcp)
struct tcb *tcp;
}
return 0;
}
-# endif /* !IA64 && !HPPA && !X86_64 && !S390 && !S390X */
-#endif
+#endif /* LINUX && HAVE_STRUCT___OLD_KERNEL_STAT */
#if defined(SVR4) || defined(LINUXSPARC)
#include <sys/acl.h>
-struct xlat aclcmds[] = {
+const struct xlat aclcmds[] = {
#ifdef SETACL
{ SETACL, "SETACL" },
#endif
}
-struct xlat aclipc[] = {
+const struct xlat aclipc[] = {
#ifdef IPC_SHM
{ IPC_SHM, "IPC_SHM" },
#endif
#ifdef LINUX
-static struct xlat fsmagic[] = {
+static const struct xlat fsmagic[] = {
{ 0x73757245, "CODA_SUPER_MAGIC" },
{ 0x012ff7b7, "COH_SUPER_MAGIC" },
{ 0x1373, "DEVFS_SUPER_MAGIC" },
{ 0x54190100, "UFS_CIGAM" },
{ 0x012ff7b4, "XENIX_SUPER_MAGIC" },
{ 0x012fd16d, "XIAFS_SUPER_MAGIC" },
+ { 0x62656572, "SYSFS_MAGIC" },
{ 0, NULL },
};
tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
sprintfstype(statbuf.f_type),
statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
- tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_namelen=%u",
- statbuf.f_bavail,statbuf.f_files, statbuf.f_ffree, statbuf.f_namelen);
+ tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_fsid={%d, %d}, f_namelen=%u",
+ statbuf.f_bavail,statbuf.f_files, statbuf.f_ffree,
+ statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1],
+ statbuf.f_namelen);
#else /* !ALPHA */
tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
sprintfstype(statbuf.f_type),
(unsigned long)statbuf.f_bsize,
(unsigned long)statbuf.f_blocks,
(unsigned long)statbuf.f_bfree);
- tprintf("f_files=%lu, f_ffree=%lu",
+ tprintf("f_bavail=%lu, f_files=%lu, f_ffree=%lu, f_fsid={%d, %d}",
+ (unsigned long)statbuf.f_bavail,
(unsigned long)statbuf.f_files,
- (unsigned long)statbuf.f_ffree);
+ (unsigned long)statbuf.f_ffree,
+ statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
#ifdef LINUX
tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
#endif /* LINUX */
#endif /* !ALPHA */
+#ifdef _STATFS_F_FRSIZE
+ tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
+#endif
tprintf("}");
}
return 0;
}
+#ifdef LINUX
+static void
+printstatfs64(tcp, addr)
+struct tcb *tcp;
+long addr;
+{
+ struct statfs64 statbuf;
+
+ if (syserror(tcp) || !verbose(tcp)) {
+ tprintf("%#lx", addr);
+ return;
+ }
+ if (umove(tcp, addr, &statbuf) < 0) {
+ tprintf("{...}");
+ return;
+ }
+#ifdef ALPHA
+
+ tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
+ sprintfstype(statbuf.f_type),
+ statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
+ tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_fsid={%d, %d}, f_namelen=%u",
+ statbuf.f_bavail,statbuf.f_files, statbuf.f_ffree,
+ statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1],
+ statbuf.f_namelen);
+#else /* !ALPHA */
+ tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
+ sprintfstype(statbuf.f_type),
+ (unsigned long)statbuf.f_bsize,
+ (unsigned long)statbuf.f_blocks,
+ (unsigned long)statbuf.f_bfree);
+ tprintf("f_bavail=%lu, f_files=%lu, f_ffree=%lu, f_fsid={%d, %d}",
+ (unsigned long)statbuf.f_bavail,
+ (unsigned long)statbuf.f_files,
+ (unsigned long)statbuf.f_ffree,
+ statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
+ tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
+#endif /* !ALPHA */
+#ifdef _STATFS_F_FRSIZE
+ tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
+#endif
+ tprintf("}");
+}
+
+int
+sys_statfs64(tcp)
+struct tcb *tcp;
+{
+ if (entering(tcp)) {
+ printpath(tcp, tcp->u_arg[0]);
+ tprintf(", %lu, ", tcp->u_arg[1]);
+ } else {
+ if (tcp->u_arg[1] == sizeof (struct statfs64))
+ printstatfs64(tcp, tcp->u_arg[2]);
+ else
+ tprintf("{???}");
+ }
+ return 0;
+}
+
+int
+sys_fstatfs64(tcp)
+struct tcb *tcp;
+{
+ if (entering(tcp)) {
+ tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]);
+ } else {
+ if (tcp->u_arg[1] == sizeof (struct statfs64))
+ printstatfs64(tcp, tcp->u_arg[2]);
+ else
+ tprintf("{???}");
+ }
+ return 0;
+}
+#endif
+
#if defined(LINUX) && defined(__alpha)
int
{
if (entering(tcp)) {
printpath(tcp, tcp->u_arg[0]);
- tprintf(", %lu, %lu", tcp->u_arg[1], tcp->u_arg[2]);
+ printuid(", ", tcp->u_arg[1]);
+ printuid(", ", tcp->u_arg[2]);
}
return 0;
}
struct tcb *tcp;
{
if (entering(tcp)) {
- tprintf("%ld, %lu, %lu",
- tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
+ tprintf("%ld", tcp->u_arg[0]);
+ printuid(", ", tcp->u_arg[1]);
+ printuid(", ", tcp->u_arg[2]);
}
return 0;
}
#endif /* LINUX */
-#ifdef FREEBSD
-struct xlat direnttypes[] = {
+#if defined FREEBSD || defined LINUX
+const struct xlat direnttypes[] = {
+ { DT_UNKNOWN, "DT_UNKNOWN" },
{ DT_FIFO, "DT_FIFO" },
{ DT_CHR, "DT_CHR" },
{ DT_DIR, "DT_DIR" },
struct dirent64 *d = (struct dirent64 *) &buf[i];
#if defined(LINUX) || defined(SVR4)
if (!abbrev(tcp)) {
- tprintf("%s{d_ino=%lu, d_off=%lu, ",
+ tprintf("%s{d_ino=%llu, d_off=%llu, ",
i ? " " : "",
- (unsigned long)d->d_ino,
- (unsigned long)d->d_off);
+ d->d_ino,
+ d->d_off);
+#ifdef LINUX
+ tprintf("d_type=");
+ printxval(direnttypes, d->d_type, "DT_???");
+ tprintf(", ");
+#endif
tprintf("d_reclen=%u, d_name=\"%s\"}",
d->d_reclen, d->d_name);
}
#endif /* HAVE_SYS_ASYNCH_H */
-struct xlat xattrflags[] = {
+const struct xlat xattrflags[] = {
#ifdef XATTR_CREATE
{ XATTR_CREATE, "XATTR_CREATE" },
{ XATTR_REPLACE, "XATTR_REPLACE" },
{ 0, NULL }
};
+static void
+print_xattr_val(tcp, failed, arg, insize, size)
+struct tcb *tcp;
+int failed;
+unsigned long arg;
+size_t size;
+{
+ unsigned char buf[4 * size + 1];
+ if (!failed && umoven(tcp, arg, size, &buf[3 * size]) >= 0) {
+ unsigned char *out = buf;
+ unsigned char *in = &buf[3 * size];
+ size_t i;
+ for (i = 0; i < size; ++i)
+ if (isprint(in[i]))
+ *out++ = in[i];
+ else {
+#define tohex(n) "0123456789abcdef"[n]
+ *out++ = '\\';
+ *out++ = 'x';
+ *out++ = tohex(in[i] / 16);
+ *out++ = tohex(in[i] % 16);
+ }
+ /* Don't print terminating NUL if there is one. */
+ if (in[i - 1] == '\0')
+ out -= 4;
+ *out = '\0';
+ tprintf(", \"%s\", %zd", buf, insize);
+ } else
+ tprintf(", 0x%lx, %zd", arg, insize);
+}
+
int
sys_setxattr(tcp)
struct tcb *tcp;
printpath(tcp, tcp->u_arg[0]);
tprintf(", ");
printstr(tcp, tcp->u_arg[1], -1);
- /* XXX Print value in format */
- tprintf(", %p, %ld, ", (void *) tcp->u_arg[2], tcp->u_arg[3]);
+ print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
+ tprintf(", ");
printflags(xattrflags, tcp->u_arg[4]);
}
return 0;
if (entering(tcp)) {
tprintf("%ld, ", tcp->u_arg[0]);
printstr(tcp, tcp->u_arg[1], -1);
- /* XXX Print value in format */
- tprintf(", %p, %ld, ", (void *) tcp->u_arg[2], tcp->u_arg[3]);
+ print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]);
+ tprintf(", ");
printflags(xattrflags, tcp->u_arg[4]);
}
return 0;
tprintf(", ");
printstr(tcp, tcp->u_arg[1], -1);
} else {
- /* XXX Print value in format */
- tprintf(", %p, %ld", (void *) tcp->u_arg[2], tcp->u_arg[3]);
+ print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
+ tcp->u_rval);
}
return 0;
}
tprintf("%ld, ", tcp->u_arg[0]);
printstr(tcp, tcp->u_arg[1], -1);
} else {
- /* XXX Print value in format */
- tprintf(", %p, %ld", (void *) tcp->u_arg[2], tcp->u_arg[3]);
+ print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3],
+ tcp->u_rval);
}
return 0;
}