Add helper function to log detailed information about unsupported ioctl commands, including direction, group, and parameter length.
Signed-off-by: Stacey D. Son <[email protected]> Signed-off-by: Warner Losh <[email protected]> --- 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 32fa9c3d33..049188e5e1 100644 --- a/bsd-user/bsd-ioctl.c +++ b/bsd-user/bsd-ioctl.c @@ -219,3 +219,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
