diff options
Diffstat (limited to 'src/watchdog_ioctl.c')
-rw-r--r-- | src/watchdog_ioctl.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/watchdog_ioctl.c b/src/watchdog_ioctl.c new file mode 100644 index 000000000..160c5f52f --- /dev/null +++ b/src/watchdog_ioctl.c @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2019 The strace developers. + * All rights reserved. + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#include "defs.h" + +#include <linux/watchdog.h> + +#define XLAT_MACROS_ONLY +#include "xlat/watchdog_ioctl_cmds.h" +#undef XLAT_MACROS_ONLY + +int +watchdog_ioctl(struct tcb *const tcp, const unsigned int code, + const kernel_ulong_t arg) +{ + switch (code) { + case WDIOC_GETSTATUS: + case WDIOC_GETBOOTSTATUS: + case WDIOC_GETTEMP: + case WDIOC_GETTIMEOUT: + case WDIOC_GETPRETIMEOUT: + case WDIOC_GETTIMELEFT: + if (entering(tcp)) + return 0; + ATTRIBUTE_FALLTHROUGH; + case WDIOC_SETTIMEOUT: + case WDIOC_SETPRETIMEOUT: + tprints(", "); + printnum_int(tcp, arg, "%d"); + break; + + /* + * linux/watchdog.h says that this takes an int, but in + * practice the argument is ignored. + */ + case WDIOC_KEEPALIVE: + break; + default: + return RVAL_DECODED; + } + return RVAL_IOCTL_DECODED; +} |