]> granicus.if.org Git - strace/blob - stat.c
Fix preprocessor indentation
[strace] / stat.c
1 /*
2  * Copyright (c) 2005-2015 Dmitry V. Levin <ldv@altlinux.org>
3  * Copyright (c) 2015-2019 The strace developers.
4  * All rights reserved.
5  *
6  * SPDX-License-Identifier: LGPL-2.1-or-later
7  */
8
9 #include "defs.h"
10 #include "stat.h"
11
12 static void
13 decode_struct_stat(struct tcb *const tcp, const kernel_ulong_t addr)
14 {
15         struct strace_stat st;
16
17         if (fetch_struct_stat(tcp, addr, &st))
18                 print_struct_stat(tcp, &st);
19 }
20
21 SYS_FUNC(stat)
22 {
23         if (entering(tcp)) {
24                 printpath(tcp, tcp->u_arg[0]);
25                 tprints(", ");
26         } else {
27                 decode_struct_stat(tcp, tcp->u_arg[1]);
28         }
29         return 0;
30 }
31
32 SYS_FUNC(fstat)
33 {
34         if (entering(tcp)) {
35                 printfd(tcp, tcp->u_arg[0]);
36                 tprints(", ");
37         } else {
38                 decode_struct_stat(tcp, tcp->u_arg[1]);
39         }
40         return 0;
41 }
42
43 SYS_FUNC(newfstatat)
44 {
45         if (entering(tcp)) {
46                 print_dirfd(tcp, tcp->u_arg[0]);
47                 tprints(", ");
48                 printpath(tcp, tcp->u_arg[1]);
49                 tprints(", ");
50         } else {
51                 decode_struct_stat(tcp, tcp->u_arg[2]);
52                 tprints(", ");
53                 printflags(at_flags, tcp->u_arg[3], "AT_???");
54         }
55         return 0;
56 }