]> granicus.if.org Git - strace/blob - ustat.c
tests: add ioctl_evdev-success* test binaries to .gitignore
[strace] / ustat.c
1 /*
2  * Copyright (c) 2017 JingPiao Chen <chenjingpiao@gmail.com>
3  * Copyright (c) 2017-2018 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                 print_dev_t((unsigned int) tcp->u_arg[0]);
22         else {
23                 tprints(", ");
24 #ifdef HAVE_USTAT_H
25                 struct_ustat ust;
26
27                 if (!umove_or_printaddr(tcp, tcp->u_arg[1], &ust))
28                         tprintf("{f_tfree=%llu, f_tinode=%llu}",
29                                 zero_extend_signed_to_ull(ust.f_tfree),
30                                 zero_extend_signed_to_ull(ust.f_tinode));
31 #else /* !HAVE_USTAT_H */
32                 printaddr(tcp->u_arg[1]);
33 #endif /* HAVE_USTAT_H */
34         }
35
36         return 0;
37 }