]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
bsd-user: Add log_unsupported_ioctl function
authorStacey Son <sson@FreeBSD.org>
Sat, 14 Mar 2026 17:28:24 +0000 (11:28 -0600)
committerWarner Losh <imp@bsdimp.com>
Thu, 7 May 2026 02:19:26 +0000 (20:19 -0600)
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

index 94110d4ad59149703c1c38661b5a6c9251d6997e..2d84adce7125c39227f39d6fe184c80ce0f422c0 100644 (file)
@@ -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));
+}