2 # define DO_PRINTSTAT do_printstat
6 # define STRUCT_STAT struct stat
10 # define STAT_MAJOR(x) major(x)
14 # define STAT_MINOR(x) minor(x)
18 DO_PRINTSTAT(struct tcb *tcp, const STRUCT_STAT *statbuf)
21 tprintf("{st_dev=makedev(%u, %u), st_ino=%llu, st_mode=%s, ",
22 (unsigned int) STAT_MAJOR(statbuf->st_dev),
23 (unsigned int) STAT_MINOR(statbuf->st_dev),
24 (unsigned long long) statbuf->st_ino,
25 sprintmode(statbuf->st_mode));
26 tprintf("st_nlink=%u, st_uid=%u, st_gid=%u, ",
27 (unsigned int) statbuf->st_nlink,
28 (unsigned int) statbuf->st_uid,
29 (unsigned int) statbuf->st_gid);
30 #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE
31 tprintf("st_blksize=%u, ", (unsigned int) statbuf->st_blksize);
33 #ifdef HAVE_STRUCT_STAT_ST_BLOCKS
34 tprintf("st_blocks=%llu, ",
35 (unsigned long long) statbuf->st_blocks);
38 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
41 switch (statbuf->st_mode & S_IFMT) {
42 case S_IFCHR: case S_IFBLK:
43 #ifdef HAVE_STRUCT_STAT_ST_RDEV
44 tprintf("st_rdev=makedev(%u, %u), ",
45 (unsigned int) STAT_MAJOR(statbuf->st_rdev),
46 (unsigned int) STAT_MINOR(statbuf->st_rdev));
47 #else /* !HAVE_STRUCT_STAT_ST_RDEV */
48 tprintf("st_size=makedev(%u, %u), ",
49 (unsigned int) STAT_MAJOR(statbuf->st_size),
50 (unsigned int) STAT_MINOR(statbuf->st_size));
51 #endif /* !HAVE_STRUCT_STAT_ST_RDEV */
54 tprintf("st_size=%llu, ",
55 (unsigned long long) statbuf->st_size);
60 const bool cast = sizeof(statbuf->st_atime) == sizeof(int);
62 tprintf("st_atime=%s, ",
63 sprinttime(cast ? (time_t) (int) statbuf->st_atime:
64 (time_t) statbuf->st_atime));
65 tprintf("st_mtime=%s, ",
66 sprinttime(cast ? (time_t) (int) statbuf->st_mtime:
67 (time_t) statbuf->st_mtime));
68 tprintf("st_ctime=%s",
69 sprinttime(cast ? (time_t) (int) statbuf->st_ctime:
70 (time_t) statbuf->st_ctime));
71 #if HAVE_STRUCT_STAT_ST_FLAGS
72 tprintf(", st_flags=%u", (unsigned int) statbuf->st_flags);
74 #if HAVE_STRUCT_STAT_ST_FSTYPE
75 tprintf(", st_fstype=%.*s",
76 (int) sizeof statbuf->st_fstype, statbuf->st_fstype);
78 #if HAVE_STRUCT_STAT_ST_GEN
79 tprintf(", st_gen=%u", (unsigned int) statbuf->st_gen);