diff options
author | Dmitry V. Levin <ldv@altlinux.org> | 2014-02-05 14:51:19 +0000 |
---|---|---|
committer | Dmitry V. Levin <ldv@altlinux.org> | 2014-02-05 14:51:19 +0000 |
commit | 9aaf88c0004f0d9856947aad7d618fb84d5dba40 (patch) | |
tree | aabe3e8f6f46806051a14346f58472cb36ea041f /reboot.c | |
parent | 90aa9f4d72e26581ea0a39c02db625d7bd4e2962 (diff) | |
download | strace-9aaf88c0004f0d9856947aad7d618fb84d5dba40.tar.gz strace-9aaf88c0004f0d9856947aad7d618fb84d5dba40.tar.bz2 strace-9aaf88c0004f0d9856947aad7d618fb84d5dba40.tar.xz |
Enhance reboot decoding
* linux/reboot.h: New file.
* system.c (bootflags1, bootflags2, bootflags3, sys_reboot): Move...
* reboot.c: ... here.
(bootflags2, bootflags3): Update constants.
* Makefile.am (strace_SOURCES): Add reboot.c.
(EXTRA_DIST): Add linux/reboot.h.
Diffstat (limited to 'reboot.c')
-rw-r--r-- | reboot.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/reboot.c b/reboot.c new file mode 100644 index 0000000..f8c3de7 --- /dev/null +++ b/reboot.c @@ -0,0 +1,45 @@ +#include "defs.h" +#include <linux/reboot.h> + +static const struct xlat bootflags1[] = { + XLAT(LINUX_REBOOT_MAGIC1), + XLAT_END +}; + +static const struct xlat bootflags2[] = { + XLAT(LINUX_REBOOT_MAGIC2), + XLAT(LINUX_REBOOT_MAGIC2A), + XLAT(LINUX_REBOOT_MAGIC2B), + XLAT(LINUX_REBOOT_MAGIC2C), + XLAT_END +}; + +static const struct xlat bootflags3[] = { + XLAT(LINUX_REBOOT_CMD_RESTART), + XLAT(LINUX_REBOOT_CMD_HALT), + XLAT(LINUX_REBOOT_CMD_CAD_ON), + XLAT(LINUX_REBOOT_CMD_CAD_OFF), + XLAT(LINUX_REBOOT_CMD_POWER_OFF), + XLAT(LINUX_REBOOT_CMD_RESTART2), + XLAT(LINUX_REBOOT_CMD_SW_SUSPEND), + XLAT(LINUX_REBOOT_CMD_KEXEC), + XLAT_END +}; + +int +sys_reboot(struct tcb *tcp) +{ + if (exiting(tcp)) + return 0; + + printflags(bootflags1, tcp->u_arg[0], "LINUX_REBOOT_MAGIC_???"); + tprints(", "); + printflags(bootflags2, tcp->u_arg[1], "LINUX_REBOOT_MAGIC_???"); + tprints(", "); + printflags(bootflags3, tcp->u_arg[2], "LINUX_REBOOT_CMD_???"); + if (tcp->u_arg[2] == LINUX_REBOOT_CMD_RESTART2) { + tprints(", "); + printstr(tcp, tcp->u_arg[3], -1); + } + return 0; +} |