ioctl: print unrecognized ioctl codes in _IOC(dir,type,nr,size) format
* defs.h (ioctl_print_code): New prototype.
* ioctl.c: Include xlat/ioctl_dirs.h.
(ioctl_print_code): New function.
* io.c (sys_ioctl): Use it.
* xlat/ioctl_dirs.in: New file.
diff --git a/ioctl.c b/ioctl.c
index 3d867f7..f9d570e 100644
--- a/ioctl.c
+++ b/ioctl.c
@@ -30,6 +30,7 @@
#include "defs.h"
#include <asm/ioctl.h>
+#include "xlat/ioctl_dirs.h"
static int
compare(const void *a, const void *b)
@@ -67,6 +68,15 @@
return NULL;
}
+void
+ioctl_print_code(const unsigned int code)
+{
+ tprints("_IOC(");
+ printflags(ioctl_dirs, _IOC_DIR(code), "_IOC_???");
+ tprintf(", 0x%02x, 0x%02x, 0x%02x)",
+ _IOC_TYPE(code), _IOC_NR(code), _IOC_SIZE(code));
+}
+
int
ioctl_decode(struct tcb *tcp, unsigned int code, long arg)
{