]> granicus.if.org Git - strace/blob - watchdog_ioctl.c
tests: fix format warnings on x32
[strace] / watchdog_ioctl.c
1 /*
2  * Copyright (c) 2019 The strace developers.
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: LGPL-2.1-or-later
6  */
7
8 #include "defs.h"
9 #include "print_fields.h"
10
11 #include <linux/watchdog.h>
12
13 #define XLAT_MACROS_ONLY
14 #include "xlat/watchdog_ioctl_cmds.h"
15 #undef XLAT_MACROS_ONLY
16
17 int
18 watchdog_ioctl(struct tcb *const tcp, const unsigned int code,
19            const kernel_ulong_t arg)
20 {
21         switch (code) {
22         case WDIOC_GETSTATUS:
23         case WDIOC_GETBOOTSTATUS:
24         case WDIOC_GETTEMP:
25         case WDIOC_GETTIMEOUT:
26         case WDIOC_GETPRETIMEOUT:
27         case WDIOC_GETTIMELEFT:
28                 if (entering(tcp))
29                         return 0;
30                 ATTRIBUTE_FALLTHROUGH;
31         case WDIOC_SETTIMEOUT:
32         case WDIOC_SETPRETIMEOUT:
33                 tprints(", ");
34                 printnum_int(tcp, arg, "%d");
35                 break;
36
37         /*
38          * linux/watchdog.h says that this takes an int, but in
39          * practice the argument is ignored.
40          */
41         case WDIOC_KEEPALIVE:
42                 break;
43         default:
44                 return RVAL_DECODED;
45         }
46         return RVAL_IOCTL_DECODED;
47 }