5 #include "xlat/fsmagic.h"
8 sprintfstype(const unsigned int magic)
13 s = xlat_search(fsmagic, ARRAY_SIZE(fsmagic), magic);
15 sprintf(buf, "\"%s\"", s);
18 sprintf(buf, "%#x", magic);
23 printstatfs(struct tcb *tcp, const long addr)
25 struct statfs statbuf;
27 if (syserror(tcp) || !verbose(tcp)) {
28 tprintf("%#lx", addr);
31 if (umove(tcp, addr, &statbuf) < 0) {
35 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
36 sprintfstype(statbuf.f_type),
37 (unsigned long)statbuf.f_bsize,
38 (unsigned long)statbuf.f_blocks,
39 (unsigned long)statbuf.f_bfree);
40 tprintf("f_bavail=%lu, f_files=%lu, f_ffree=%lu, f_fsid={%d, %d}",
41 (unsigned long)statbuf.f_bavail,
42 (unsigned long)statbuf.f_files,
43 (unsigned long)statbuf.f_ffree,
44 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
45 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
46 #ifdef _STATFS_F_FRSIZE
47 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
49 #ifdef _STATFS_F_FLAGS
50 tprintf(", f_flags=%lu", (unsigned long)statbuf.f_flags);
56 sys_statfs(struct tcb *tcp)
59 printpath(tcp, tcp->u_arg[0]);
62 printstatfs(tcp, tcp->u_arg[1]);
68 sys_fstatfs(struct tcb *tcp)
71 printfd(tcp, tcp->u_arg[0]);
74 printstatfs(tcp, tcp->u_arg[1]);
79 #ifdef HAVE_STRUCT_STATFS64
81 printstatfs64(struct tcb *tcp, long addr)
83 struct statfs64 statbuf;
85 if (syserror(tcp) || !verbose(tcp)) {
86 tprintf("%#lx", addr);
89 if (umove(tcp, addr, &statbuf) < 0) {
93 tprintf("{f_type=%s, f_bsize=%llu, f_blocks=%llu, f_bfree=%llu, ",
94 sprintfstype(statbuf.f_type),
95 (unsigned long long)statbuf.f_bsize,
96 (unsigned long long)statbuf.f_blocks,
97 (unsigned long long)statbuf.f_bfree);
98 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
99 (unsigned long long)statbuf.f_bavail,
100 (unsigned long long)statbuf.f_files,
101 (unsigned long long)statbuf.f_ffree,
102 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
103 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
104 #ifdef _STATFS_F_FRSIZE
105 tprintf(", f_frsize=%llu", (unsigned long long)statbuf.f_frsize);
107 #ifdef _STATFS_F_FLAGS
108 tprintf(", f_flags=%llu", (unsigned long long)statbuf.f_flags);
113 struct compat_statfs64 {
127 #if defined AARCH64 || defined X86_64 || defined X32 || defined IA64
128 __attribute__ ((packed, aligned(4)))
133 printcompat_statfs64(struct tcb *tcp, const long addr)
135 struct compat_statfs64 statbuf;
137 if (syserror(tcp) || !verbose(tcp)) {
138 tprintf("%#lx", addr);
141 if (umove(tcp, addr, &statbuf) < 0) {
145 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%llu, f_bfree=%llu, ",
146 sprintfstype(statbuf.f_type),
147 (unsigned long)statbuf.f_bsize,
148 (unsigned long long)statbuf.f_blocks,
149 (unsigned long long)statbuf.f_bfree);
150 tprintf("f_bavail=%llu, f_files=%llu, f_ffree=%llu, f_fsid={%d, %d}",
151 (unsigned long long)statbuf.f_bavail,
152 (unsigned long long)statbuf.f_files,
153 (unsigned long long)statbuf.f_ffree,
154 statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1]);
155 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
156 tprintf(", f_frsize=%lu", (unsigned long)statbuf.f_frsize);
157 tprintf(", f_flags=%lu}", (unsigned long)statbuf.f_frsize);
161 sys_statfs64(struct tcb *tcp)
164 printpath(tcp, tcp->u_arg[0]);
165 tprintf(", %lu, ", tcp->u_arg[1]);
167 if (tcp->u_arg[1] == sizeof(struct statfs64))
168 printstatfs64(tcp, tcp->u_arg[2]);
169 else if (tcp->u_arg[1] == sizeof(struct compat_statfs64))
170 printcompat_statfs64(tcp, tcp->u_arg[2]);
178 sys_fstatfs64(struct tcb *tcp)
181 printfd(tcp, tcp->u_arg[0]);
182 tprintf(", %lu, ", tcp->u_arg[1]);
184 if (tcp->u_arg[1] == sizeof(struct statfs64))
185 printstatfs64(tcp, tcp->u_arg[2]);
186 else if (tcp->u_arg[1] == sizeof(struct compat_statfs64))
187 printcompat_statfs64(tcp, tcp->u_arg[2]);
193 #endif /* HAVE_STRUCT_STATFS64 */
197 osf_statfs(struct tcb *tcp)
200 printpath(tcp, tcp->u_arg[0]);
203 printstatfs(tcp, tcp->u_arg[1]);
204 tprintf(", %lu", tcp->u_arg[2]);
210 osf_fstatfs(struct tcb *tcp)
213 tprintf("%lu, ", tcp->u_arg[0]);
215 printstatfs(tcp, tcp->u_arg[1]);
216 tprintf(", %lu", tcp->u_arg[2]);