1 /*
2 * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com>
3 * Copyright (c) 2017-2021 The strace developers.
4 * All rights reserved.
5 *
6 * SPDX-License-Identifier: LGPL-2.1-or-later
7 */
8
9 #include "defs.h"
10 #ifdef HAVE_USTAT_H
11 # include DEF_MPERS_TYPE(struct_ustat)
12 # include <ustat.h>
13 typedef struct ustat struct_ustat;
14 #endif /* HAVE_USTAT_H */
15
16 #include MPERS_DEFS
17
18 SYS_FUNC(ustat)
19 {
20 if (entering(tcp)) {
21 /* dev */
22 print_dev_t((unsigned int) tcp->u_arg[0]);
23 tprint_arg_next();
24 } else {
25 /* ubuf */
26 #ifdef HAVE_USTAT_H
27 struct_ustat ust;
28
29 if (!umove_or_printaddr(tcp, tcp->u_arg[1], &ust)) {
30 tprint_struct_begin();
31 PRINT_FIELD_U(ust, f_tfree);
32 tprint_struct_next();
33 PRINT_FIELD_U(ust, f_tinode);
34 tprint_struct_end();
35 }
36 #else /* !HAVE_USTAT_H */
37 printaddr(tcp->u_arg[1]);
38 #endif /* HAVE_USTAT_H */
39 }
40
41 return 0;
42 }