{ 0, NULL },
};
+#if _LFS64_LARGEFILE
+/* fcntl/lockf */
+static void
+printflock64(struct tcb *tcp, long addr, int getlk)
+{
+ struct flock64 fl;
+
+ if (umove(tcp, addr, &fl) < 0) {
+ tprints("{...}");
+ return;
+ }
+ tprints("{type=");
+ printxval(lockfcmds, fl.l_type, "F_???");
+ tprints(", whence=");
+ printxval(whence_codes, fl.l_whence, "SEEK_???");
+ tprintf(", start=%lld, len=%lld", (long long) fl.l_start, (long long) fl.l_len);
+ if (getlk)
+ tprintf(", pid=%lu}", (unsigned long) fl.l_pid);
+ else
+ tprints("}");
+}
+#endif
+
/* fcntl/lockf */
static void
printflock(struct tcb *tcp, long addr, int getlk)
struct flock fl;
#if SUPPORTED_PERSONALITIES > 1
+# ifdef X32
+ if (current_personality == 0) {
+ printflock64(tcp, addr, getlk);
+ return;
+ }
+# endif
if (current_wordsize != sizeof(fl.l_start)) {
if (current_wordsize == 4) {
/* 32-bit x86 app on x86_64 and similar cases */
printxval(lockfcmds, fl.l_type, "F_???");
tprints(", whence=");
printxval(whence_codes, fl.l_whence, "SEEK_???");
+#ifdef X32
+ tprintf(", start=%lld, len=%lld", fl.l_start, fl.l_len);
+#else
tprintf(", start=%ld, len=%ld", fl.l_start, fl.l_len);
+#endif
if (getlk)
tprintf(", pid=%lu}", (unsigned long) fl.l_pid);
else
tprints("}");
}
-#if _LFS64_LARGEFILE
-/* fcntl/lockf */
-static void
-printflock64(struct tcb *tcp, long addr, int getlk)
-{
- struct flock64 fl;
-
- if (umove(tcp, addr, &fl) < 0) {
- tprints("{...}");
- return;
- }
- tprints("{type=");
- printxval(lockfcmds, fl.l_type, "F_???");
- tprints(", whence=");
- printxval(whence_codes, fl.l_whence, "SEEK_???");
- tprintf(", start=%lld, len=%lld", (long long) fl.l_start, (long long) fl.l_len);
- if (getlk)
- tprintf(", pid=%lu}", (unsigned long) fl.l_pid);
- else
- tprints("}");
-}
-#endif
-
int
sys_fcntl(struct tcb *tcp)
{
unsigned long st_ctime;
unsigned long st_ctime_nsec;
unsigned long long st_ino;
-};
+} __attribute__((packed));
+# define HAVE_STAT64 1
struct __old_kernel_stat {
unsigned short st_dev;
tprints("...}");
}
+#ifndef X32
static void
printstat(struct tcb *tcp, long addr)
{
realprintstat(tcp, &statbuf);
}
+#else /* X32 */
+# define printstat printstat64
+#endif
#if !defined HAVE_STAT64 && defined X86_64
/*
static void
printstat64(struct tcb *tcp, long addr)
{
+#ifdef X32
+ struct stat statbuf;
+#else
struct stat64 statbuf;
+#endif
#ifdef STAT64_SIZE
(void) sizeof(char[sizeof statbuf == STAT64_SIZE ? 1 : -1]);
return 0;
}
+#ifdef X32
+static void
+printstat64_x32(struct tcb *tcp, long addr)
+{
+ struct stat64 statbuf;
+
+ if (!addr) {
+ tprints("NULL");
+ return;
+ }
+ if (syserror(tcp) || !verbose(tcp)) {
+ tprintf("%#lx", addr);
+ return;
+ }
+
+ if (umove(tcp, addr, &statbuf) < 0) {
+ tprints("{...}");
+ return;
+ }
+
+ if (!abbrev(tcp)) {
+ tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
+ (unsigned long) major(statbuf.st_dev),
+ (unsigned long) minor(statbuf.st_dev),
+ (unsigned long 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=%llu, ", (unsigned long long) 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));
+ tprints("}");
+ }
+ else
+ tprints("...}");
+}
+#endif /* X32 */
+
int
sys_stat64(struct tcb *tcp)
{
printpath(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
+# ifdef X32
+ printstat64_x32(tcp, tcp->u_arg[1]);
+# else
printstat64(tcp, tcp->u_arg[1]);
+# endif
}
return 0;
#else
printfd(tcp, tcp->u_arg[0]);
tprints(", ");
} else {
+# ifdef X32
+ printstat64_x32(tcp, tcp->u_arg[1]);
+# else
printstat64(tcp, tcp->u_arg[1]);
+# endif
}
return 0;
#else
}
return 0;
}
-
-#ifdef X32
-# undef stat64
-# undef sys_fstat64
-# undef sys_stat64
-
-static void
-realprintstat64(struct tcb *tcp, long addr)
-{
- struct stat64 statbuf;
-
- if (!addr) {
- tprints("NULL");
- return;
- }
- if (syserror(tcp) || !verbose(tcp)) {
- tprintf("%#lx", addr);
- return;
- }
-
- if (umove(tcp, addr, &statbuf) < 0) {
- tprints("{...}");
- return;
- }
-
- if (!abbrev(tcp)) {
- tprintf("{st_dev=makedev(%lu, %lu), st_ino=%llu, st_mode=%s, ",
- (unsigned long) major(statbuf.st_dev),
- (unsigned long) minor(statbuf.st_dev),
- (unsigned long 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=%llu, ", (unsigned long long) 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));
- tprints("}");
- }
- else
- tprints("...}");
-}
-
-int
-sys_fstat64(struct tcb *tcp)
-{
- if (entering(tcp)) {
- printfd(tcp, tcp->u_arg[0]);
- tprints(", ");
- } else {
- realprintstat64(tcp, tcp->u_arg[1]);
- }
- return 0;
-}
-
-int
-sys_stat64(struct tcb *tcp)
-{
- if (entering(tcp)) {
- printpath(tcp, tcp->u_arg[0]);
- tprints(", ");
- } else {
- realprintstat64(tcp, tcp->u_arg[1]);
- }
- return 0;
-}
-#endif
{ 2, TD, sys_flock, "flock" }, /* 73 */
{ 1, TD, sys_fsync, "fsync" }, /* 74 */
{ 1, TD, sys_fdatasync, "fdatasync" }, /* 75 */
- { 2, TF, sys_truncate, "truncate" }, /* 76 */
- { 2, TD, sys_ftruncate, "ftruncate" }, /* 77 */
+ { 2, TF, sys_truncate64, "truncate" }, /* 76 */
+ { 2, TD, sys_ftruncate64, "ftruncate" }, /* 77 */
{ 3, TD, sys_getdents, "getdents" }, /* 78 */
{ 2, TF, sys_getcwd, "getcwd" }, /* 79 */
{ 1, TF, sys_chdir, "chdir" }, /* 80 */