From: Stacey Son <sson@FreeBSD.org>
Add helper function to log detailed information about unsupported
ioctl commands, including direction, group, and parameter length.
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
---
bsd-user/bsd-ioctl.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/bsd-user/bsd-ioctl.c b/bsd-user/bsd-ioctl.c
index 94110d4ad5..2d84adce71 100644
--- a/bsd-user/bsd-ioctl.c
+++ b/bsd-user/bsd-ioctl.c
@@ -217,3 +217,27 @@ static IOCTLEntry ioctl_entries[] = {
#include "os-ioctl-cmds.h"
{ 0, 0 },
};
+
+static void log_unsupported_ioctl(unsigned long cmd)
+{
+ gemu_log("cmd=0x%08lx dir=", cmd);
+ switch (cmd & IOC_DIRMASK) {
+ case IOC_VOID:
+ gemu_log("VOID ");
+ break;
+ case IOC_OUT:
+ gemu_log("OUT ");
+ break;
+ case IOC_IN:
+ gemu_log("IN ");
+ break;
+ case IOC_INOUT:
+ gemu_log("INOUT");
+ break;
+ default:
+ gemu_log("%01lx ???", (cmd & IOC_DIRMASK) >> 29);
+ break;
+ }
+ gemu_log(" '%c' %3d %lu\n", (char)IOCGROUP(cmd), (int)(cmd & 0xff),
+ IOCPARM_LEN(cmd));
+}
--
2.52.0