bsd-user: Add log_unsupported_ioctl function

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>
This commit is contained in:
Stacey Son
2026-03-14 11:28:24 -06:00
committed by Warner Losh
parent e4cd71da25
commit ba4b26e626

View 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));
}