blob: 3ea0b5da6165cc5c37a54c71cd5c5cb2b8f6dbe9 [file] [log] [blame]
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001/*
2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
Wichert Akkerman4dc8a2a1999-12-23 14:20:14 +00005 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00006 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000029 */
30
31#include "defs.h"
Roland McGrathc531e572008-08-01 01:13:10 +000032
Dmitry V. Levinf19836b2014-12-30 11:18:47 +000033#undef dev_t
34#undef ino_t
35#undef mode_t
36#undef nlink_t
37#undef uid_t
38#undef gid_t
39#undef off_t
40#undef loff_t
41#define dev_t __kernel_dev_t
42#define ino_t __kernel_ino_t
43#define mode_t __kernel_mode_t
44#define nlink_t __kernel_nlink_t
45#define uid_t __kernel_uid_t
46#define gid_t __kernel_gid_t
47#define off_t __kernel_off_t
48#define loff_t __kernel_loff_t
Wichert Akkermana6013701999-07-08 14:00:58 +000049
Dmitry V. Levinc31481f2015-12-04 14:37:02 +000050#include "asm_stat.h"
Wichert Akkermana6013701999-07-08 14:00:58 +000051
Dmitry V. Levinf19836b2014-12-30 11:18:47 +000052#undef dev_t
53#undef ino_t
54#undef mode_t
55#undef nlink_t
56#undef uid_t
57#undef gid_t
58#undef off_t
59#undef loff_t
60#define dev_t dev_t
61#define ino_t ino_t
62#define mode_t mode_t
63#define nlink_t nlink_t
64#define uid_t uid_t
65#define gid_t gid_t
66#define off_t off_t
67#define loff_t loff_t
Denys Vlasenko84703742012-02-25 02:38:52 +010068
Dmitry V. Levinf19836b2014-12-30 11:18:47 +000069/* for S_IFMT */
Denys Vlasenko84703742012-02-25 02:38:52 +010070#define stat libc_stat
71#define stat64 libc_stat64
72#include <sys/stat.h>
73#undef stat
74#undef stat64
Denys Vlasenkoa6d91de2012-03-16 12:02:22 +010075/* These might be macros. */
Denys Vlasenko84703742012-02-25 02:38:52 +010076#undef st_atime
77#undef st_mtime
78#undef st_ctime
Wichert Akkermand4d8e921999-04-18 23:30:29 +000079
Dmitry V. Levinf19836b2014-12-30 11:18:47 +000080#if defined MAJOR_IN_SYSMACROS
Denys Vlasenko84703742012-02-25 02:38:52 +010081# include <sys/sysmacros.h>
Dmitry V. Levinf19836b2014-12-30 11:18:47 +000082#elif defined MAJOR_IN_MKDEV
Denys Vlasenko84703742012-02-25 02:38:52 +010083# include <sys/mkdev.h>
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000084#endif
85
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000086/* several stats */
87
Dmitry V. Levin721de782015-01-08 02:59:04 +000088#include "printstat.h"
89
Dmitry V. Levin525eed32015-08-08 12:12:13 +000090/* all locally defined structures provide these fields */
91#undef HAVE_STRUCT_STAT_ST_ATIME_NSEC
92#define HAVE_STRUCT_STAT_ST_ATIME_NSEC 1
93#undef HAVE_STRUCT_STAT_ST_CTIME_NSEC
94#define HAVE_STRUCT_STAT_ST_CTIME_NSEC 1
95#undef HAVE_STRUCT_STAT_ST_MTIME_NSEC
96#define HAVE_STRUCT_STAT_ST_MTIME_NSEC 1
97
Dmitry V. Levinf19836b2014-12-30 11:18:47 +000098#undef STAT32_PERSONALITY
99#if SUPPORTED_PERSONALITIES > 1
100# if defined AARCH64 || defined X86_64 || defined X32
101struct stat32 {
102 unsigned int st_dev;
103 unsigned int st_ino;
104 unsigned short st_mode;
105 unsigned short st_nlink;
106 unsigned short st_uid;
107 unsigned short st_gid;
108 unsigned int st_rdev;
109 unsigned int st_size;
110 unsigned int st_blksize;
111 unsigned int st_blocks;
112 unsigned int st_atime;
113 unsigned int st_atime_nsec;
114 unsigned int st_mtime;
115 unsigned int st_mtime_nsec;
116 unsigned int st_ctime;
117 unsigned int st_ctime_nsec;
118 unsigned int __unused4;
119 unsigned int __unused5;
120};
Dmitry V. Levinc37173f2015-12-09 00:43:39 +0000121# define STAT32_PERSONALITY 1
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000122# elif defined POWERPC64
123struct stat32 {
Andreas Schwabd69fa492010-07-12 21:39:57 +0200124 unsigned int st_dev;
125 unsigned int st_ino;
126 unsigned int st_mode;
127 unsigned short st_nlink;
128 unsigned int st_uid;
129 unsigned int st_gid;
130 unsigned int st_rdev;
131 unsigned int st_size;
132 unsigned int st_blksize;
133 unsigned int st_blocks;
134 unsigned int st_atime;
135 unsigned int st_atime_nsec;
136 unsigned int st_mtime;
137 unsigned int st_mtime_nsec;
138 unsigned int st_ctime;
139 unsigned int st_ctime_nsec;
140 unsigned int __unused4;
141 unsigned int __unused5;
142};
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000143# define STAT32_PERSONALITY 1
144# elif defined SPARC64
145struct stat32 {
146 unsigned short st_dev;
147 unsigned int st_ino;
148 unsigned short st_mode;
149 unsigned short st_nlink;
150 unsigned short st_uid;
151 unsigned short st_gid;
152 unsigned short st_rdev;
153 unsigned int st_size;
154 unsigned int st_atime;
155 unsigned int st_atime_nsec;
156 unsigned int st_mtime;
157 unsigned int st_mtime_nsec;
158 unsigned int st_ctime;
159 unsigned int st_ctime_nsec;
160 unsigned int st_blksize;
161 unsigned int st_blocks;
162 unsigned int __unused4[2];
163};
164# define STAT32_PERSONALITY 0
165# elif defined SPARC
166# /* no 64-bit personalities */
167# elif defined TILE
168# /* no 32-bit stat */
169# else
170# warning FIXME: check whether struct stat32 definition is needed for this architecture!
171# endif /* X86_64 || X32 || POWERPC64 */
172#endif /* SUPPORTED_PERSONALITIES > 1 */
Andreas Schwabd69fa492010-07-12 21:39:57 +0200173
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000174#ifdef STAT32_PERSONALITY
Dmitry V. Levin721de782015-01-08 02:59:04 +0000175# define DO_PRINTSTAT do_printstat32
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000176# define STRUCT_STAT struct stat32
Dmitry V. Levin721de782015-01-08 02:59:04 +0000177# undef HAVE_STRUCT_STAT_ST_FLAGS
178# undef HAVE_STRUCT_STAT_ST_FSTYPE
179# undef HAVE_STRUCT_STAT_ST_GEN
180# include "printstat.h"
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000181#endif /* STAT32_PERSONALITY */
Andreas Schwabd69fa492010-07-12 21:39:57 +0200182
Dmitry V. Levine6e475c2015-01-08 03:13:59 +0000183#if defined(SPARC) || defined(SPARC64)
184
185struct solstat {
186 unsigned st_dev;
187 unsigned int st_pad1[3]; /* network id */
188 unsigned st_ino;
189 unsigned st_mode;
190 unsigned st_nlink;
191 unsigned st_uid;
192 unsigned st_gid;
193 unsigned st_rdev;
194 unsigned int st_pad2[2];
195 unsigned int st_size;
196 unsigned int st_pad3; /* st_size, off_t expansion */
197 unsigned int st_atime;
198 unsigned int st_atime_nsec;
199 unsigned int st_mtime;
200 unsigned int st_mtime_nsec;
201 unsigned int st_ctime;
202 unsigned int st_ctime_nsec;
203 unsigned int st_blksize;
204 unsigned int st_blocks;
205 char st_fstype[16];
206 unsigned int st_pad4[8]; /* expansion area */
207};
208
209# define DO_PRINTSTAT do_printstat_sol
210# define STRUCT_STAT struct solstat
211# define STAT_MAJOR(x) (((x) >> 18) & 0x3fff)
212# define STAT_MINOR(x) ((x) & 0x3ffff)
213# undef HAVE_STRUCT_STAT_ST_FLAGS
214# undef HAVE_STRUCT_STAT_ST_FSTYPE
215# undef HAVE_STRUCT_STAT_ST_GEN
216# include "printstat.h"
Dmitry V. Levine6e475c2015-01-08 03:13:59 +0000217#endif /* SPARC || SPARC64 */
218
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000219static void
Denys Vlasenko1d632462009-04-14 12:51:00 +0000220printstat(struct tcb *tcp, long addr)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000221{
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000222 struct stat statbuf;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000223
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000224#ifdef STAT32_PERSONALITY
225 if (current_personality == STAT32_PERSONALITY) {
Dmitry V. Levinb6d80ff2015-07-20 12:09:44 +0000226 struct stat32 statbuf;
227
228 if (!umove_or_printaddr(tcp, addr, &statbuf))
229 do_printstat32(tcp, &statbuf);
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000230 return;
231 }
232#endif
233
Denys Vlasenko9472a272013-02-12 11:43:46 +0100234#if defined(SPARC) || defined(SPARC64)
Denys Vlasenko5ae2b7c2009-02-27 20:32:52 +0000235 if (current_personality == 1) {
Dmitry V. Levinb6d80ff2015-07-20 12:09:44 +0000236 struct solstat statbuf;
237
238 if (!umove_or_printaddr(tcp, addr, &statbuf))
239 do_printstat_sol(tcp, &statbuf);
Denys Vlasenko5ae2b7c2009-02-27 20:32:52 +0000240 return;
241 }
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000242#endif /* SPARC || SPARC64 */
Andreas Schwabd69fa492010-07-12 21:39:57 +0200243
Dmitry V. Levinb6d80ff2015-07-20 12:09:44 +0000244 if (!umove_or_printaddr(tcp, addr, &statbuf))
245 do_printstat(tcp, &statbuf);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000246}
247
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000248SYS_FUNC(stat)
Dmitry V. Levinc6ee0ec2015-01-08 01:14:53 +0000249{
250 if (entering(tcp)) {
251 printpath(tcp, tcp->u_arg[0]);
252 tprints(", ");
253 } else {
254 printstat(tcp, tcp->u_arg[1]);
255 }
256 return 0;
257}
258
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000259SYS_FUNC(fstat)
Dmitry V. Levinc6ee0ec2015-01-08 01:14:53 +0000260{
261 if (entering(tcp)) {
262 printfd(tcp, tcp->u_arg[0]);
263 tprints(", ");
264 } else {
265 printstat(tcp, tcp->u_arg[1]);
266 }
267 return 0;
268}
269
Dmitry V. Levin7b9bc442015-01-08 04:06:06 +0000270#if defined STAT32_PERSONALITY && !defined HAVE_STRUCT_STAT64
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000271# if defined AARCH64 || defined X86_64 || defined X32
Roland McGrathe6d0f712007-08-07 01:22:49 +0000272/*
Dmitry V. Levin8d411082014-12-28 16:41:24 +0000273 * Linux x86_64 and x32 have unified `struct stat' but their i386 personality
274 * needs `struct stat64'.
275 * linux/arch/x86/include/uapi/asm/stat.h defines `struct stat64' only for i386.
Elliott Hughes391c0d82014-04-03 17:50:14 -0700276 *
277 * Similarly, aarch64 has a unified `struct stat' but its arm personality
Dmitry V. Levin8d411082014-12-28 16:41:24 +0000278 * needs `struct stat64' (unlike x86, it shouldn't be packed).
Roland McGrathe6d0f712007-08-07 01:22:49 +0000279 */
280struct stat64 {
281 unsigned long long st_dev;
282 unsigned char __pad0[4];
283 unsigned int __st_ino;
284 unsigned int st_mode;
285 unsigned int st_nlink;
286 unsigned int st_uid;
287 unsigned int st_gid;
288 unsigned long long st_rdev;
289 unsigned char __pad3[4];
290 long long st_size;
291 unsigned int st_blksize;
292 unsigned long long st_blocks;
293 unsigned int st_atime;
294 unsigned int st_atime_nsec;
295 unsigned int st_mtime;
296 unsigned int st_mtime_nsec;
297 unsigned int st_ctime;
298 unsigned int st_ctime_nsec;
299 unsigned long long st_ino;
Elliott Hughes391c0d82014-04-03 17:50:14 -0700300}
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000301# if defined X86_64 || defined X32
Dmitry V. Levin5647cf82015-03-29 22:45:03 +0000302 ATTRIBUTE_PACKED
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000303# define STAT64_SIZE 96
304# else
305# define STAT64_SIZE 104
306# endif
Elliott Hughes391c0d82014-04-03 17:50:14 -0700307;
Dmitry V. Levin7b9bc442015-01-08 04:06:06 +0000308# define HAVE_STRUCT_STAT64 1
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000309# else /* !(AARCH64 || X86_64 || X32) */
310# warning FIXME: check whether struct stat64 definition is needed for this architecture!
311# endif
Dmitry V. Levin7b9bc442015-01-08 04:06:06 +0000312#endif /* STAT32_PERSONALITY && !HAVE_STRUCT_STAT64 */
Roland McGrathe6d0f712007-08-07 01:22:49 +0000313
Dmitry V. Levin7b9bc442015-01-08 04:06:06 +0000314#ifdef HAVE_STRUCT_STAT64
Dmitry V. Levinb8ad3932014-12-28 18:56:23 +0000315
316# define DO_PRINTSTAT do_printstat64
317# define STRUCT_STAT struct stat64
318# undef HAVE_STRUCT_STAT_ST_FLAGS
319# undef HAVE_STRUCT_STAT_ST_FSTYPE
320# undef HAVE_STRUCT_STAT_ST_GEN
321# include "printstat.h"
322
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000323static void
Denys Vlasenko1d632462009-04-14 12:51:00 +0000324printstat64(struct tcb *tcp, long addr)
Ulrich Drepper7f02c4d1999-12-24 08:01:34 +0000325{
326 struct stat64 statbuf;
327
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000328# ifdef STAT64_SIZE
Roland McGrathe6d0f712007-08-07 01:22:49 +0000329 (void) sizeof(char[sizeof statbuf == STAT64_SIZE ? 1 : -1]);
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000330# endif
Roland McGrathe6d0f712007-08-07 01:22:49 +0000331
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000332# ifdef STAT32_PERSONALITY
333 if (current_personality != STAT32_PERSONALITY) {
Elliott Hughes391c0d82014-04-03 17:50:14 -0700334 printstat(tcp, addr);
335 return;
336 }
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000337# endif /* STAT32_PERSONALITY */
Dmitry V. Levinff896f72009-10-21 13:43:57 +0000338
Dmitry V. Levinb6d80ff2015-07-20 12:09:44 +0000339 if (!umove_or_printaddr(tcp, addr, &statbuf))
340 do_printstat64(tcp, &statbuf);
Ulrich Drepper7f02c4d1999-12-24 08:01:34 +0000341}
342
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000343SYS_FUNC(stat64)
Ulrich Drepper7f02c4d1999-12-24 08:01:34 +0000344{
Ulrich Drepper7f02c4d1999-12-24 08:01:34 +0000345 if (entering(tcp)) {
346 printpath(tcp, tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200347 tprints(", ");
Ulrich Drepper7f02c4d1999-12-24 08:01:34 +0000348 } else {
349 printstat64(tcp, tcp->u_arg[1]);
350 }
351 return 0;
Ulrich Drepper7f02c4d1999-12-24 08:01:34 +0000352}
353
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000354SYS_FUNC(fstat64)
Dmitry V. Levinc6ee0ec2015-01-08 01:14:53 +0000355{
Dmitry V. Levinc6ee0ec2015-01-08 01:14:53 +0000356 if (entering(tcp)) {
357 printfd(tcp, tcp->u_arg[0]);
358 tprints(", ");
359 } else {
360 printstat64(tcp, tcp->u_arg[1]);
361 }
362 return 0;
Dmitry V. Levinc6ee0ec2015-01-08 01:14:53 +0000363}
364
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000365#else
366
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000367SYS_FUNC(stat64)
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000368{
369 return sys_stat(tcp);
370}
371
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000372SYS_FUNC(fstat64)
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000373{
374 return sys_fstat(tcp);
375}
376
Dmitry V. Levin7b9bc442015-01-08 04:06:06 +0000377#endif /* HAVE_STRUCT_STAT64 */
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000378
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000379SYS_FUNC(newfstatat)
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000380{
381 if (entering(tcp)) {
Dmitry V. Levin31382132011-03-04 05:08:02 +0300382 print_dirfd(tcp, tcp->u_arg[0]);
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000383 printpath(tcp, tcp->u_arg[1]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200384 tprints(", ");
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000385 } else {
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000386#if defined STAT32_PERSONALITY
387 if (current_personality == STAT32_PERSONALITY)
Andreas Schwabd69fa492010-07-12 21:39:57 +0200388 printstat64(tcp, tcp->u_arg[2]);
Dmitry V. Levinf19836b2014-12-30 11:18:47 +0000389 else
390 printstat(tcp, tcp->u_arg[2]);
Dmitry V. Levin7b9bc442015-01-08 04:06:06 +0000391#elif defined HAVE_STRUCT_STAT64
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000392 printstat64(tcp, tcp->u_arg[2]);
393#else
394 printstat(tcp, tcp->u_arg[2]);
Dmitry V. Levin7b9bc442015-01-08 04:06:06 +0000395#endif /* STAT32_PERSONALITY || HAVE_STRUCT_STAT64 */
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200396 tprints(", ");
Dmitry V. Levin7989ad42012-03-13 23:26:01 +0000397 printflags(at_flags, tcp->u_arg[3], "AT_???");
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000398 }
399 return 0;
400}
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000401
Denys Vlasenko8435d672013-02-18 15:47:57 +0100402#if defined(HAVE_STRUCT___OLD_KERNEL_STAT)
Dmitry V. Levin1fb1c132014-12-28 19:10:58 +0000403
404static void
405convertoldstat(const struct __old_kernel_stat *oldbuf, struct stat *newbuf)
406{
407 memset(newbuf, 0, sizeof(*newbuf));
408 newbuf->st_dev = oldbuf->st_dev;
409 newbuf->st_ino = oldbuf->st_ino;
410 newbuf->st_mode = oldbuf->st_mode;
411 newbuf->st_nlink = oldbuf->st_nlink;
412 newbuf->st_uid = oldbuf->st_uid;
413 newbuf->st_gid = oldbuf->st_gid;
414 newbuf->st_rdev = oldbuf->st_rdev;
415 newbuf->st_size = oldbuf->st_size;
416 newbuf->st_atime = oldbuf->st_atime;
417 newbuf->st_mtime = oldbuf->st_mtime;
418 newbuf->st_ctime = oldbuf->st_ctime;
419}
420
421static void
422printoldstat(struct tcb *tcp, long addr)
423{
424 struct __old_kernel_stat statbuf;
425 struct stat newstatbuf;
426
Dmitry V. Levin1fb1c132014-12-28 19:10:58 +0000427# if defined(SPARC) || defined(SPARC64)
428 if (current_personality == 1) {
Dmitry V. Levinb6d80ff2015-07-20 12:09:44 +0000429 struct solstat statbuf;
430
431 if (!umove_or_printaddr(tcp, addr, &statbuf))
432 do_printstat_sol(tcp, &statbuf);
Dmitry V. Levin1fb1c132014-12-28 19:10:58 +0000433 return;
434 }
435# endif
436
Dmitry V. Levinb6d80ff2015-07-20 12:09:44 +0000437 if (!umove_or_printaddr(tcp, addr, &statbuf)) {
438 convertoldstat(&statbuf, &newstatbuf);
439 do_printstat(tcp, &newstatbuf);
Dmitry V. Levin1fb1c132014-12-28 19:10:58 +0000440 }
Dmitry V. Levin1fb1c132014-12-28 19:10:58 +0000441}
442
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000443SYS_FUNC(oldstat)
Dmitry V. Levin1fb1c132014-12-28 19:10:58 +0000444{
445 if (entering(tcp)) {
446 printpath(tcp, tcp->u_arg[0]);
447 tprints(", ");
448 } else {
449 printoldstat(tcp, tcp->u_arg[1]);
450 }
451 return 0;
452}
453
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000454SYS_FUNC(oldfstat)
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000455{
Dmitry V. Levin31382132011-03-04 05:08:02 +0300456 if (entering(tcp)) {
457 printfd(tcp, tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200458 tprints(", ");
Dmitry V. Levin31382132011-03-04 05:08:02 +0300459 } else {
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000460 printoldstat(tcp, tcp->u_arg[1]);
461 }
462 return 0;
463}
Dmitry V. Levin1fb1c132014-12-28 19:10:58 +0000464
465#endif /* HAVE_STRUCT___OLD_KERNEL_STAT */
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000466
Denys Vlasenko9472a272013-02-12 11:43:46 +0100467#if defined(SPARC) || defined(SPARC64)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000468
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000469SYS_FUNC(xstat)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000470{
471 if (entering(tcp)) {
472 tprintf("%ld, ", tcp->u_arg[0]);
473 printpath(tcp, tcp->u_arg[1]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200474 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000475 } else {
476 printstat(tcp, tcp->u_arg[2]);
477 }
478 return 0;
479}
480
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000481SYS_FUNC(fxstat)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000482{
Dmitry V. Levine00a9572014-12-29 03:15:42 +0000483 if (entering(tcp)) {
484 tprintf("%ld, ", tcp->u_arg[0]);
485 printfd(tcp, tcp->u_arg[1]);
486 tprints(", ");
487 } else {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000488 printstat(tcp, tcp->u_arg[2]);
489 }
490 return 0;
491}
492
Dmitry V. Levin964d80a2014-12-06 03:53:16 +0000493#endif /* SPARC || SPARC64 */