@samitouri / QOSamiQemu / commits / ba4b26e626

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>

Stacey Son committed Mar 14, 2026 at 11:28 UTC ba4b26e6268d2217fad2437ecb0ec6c2e265e306
1 file changed +24
bsd-user/bsd-ioctl.c
+24
@@ -217,3 +217,27 @@ static IOCTLEntry ioctl_entries[] = {
217 #include "os-ioctl-cmds.h"
218 { 0, 0 },
219 };
220 +
221 +static void log_unsupported_ioctl(unsigned long cmd)
222 +{
223 + gemu_log("cmd=0x%08lx dir=", cmd);
224 + switch (cmd & IOC_DIRMASK) {
225 + case IOC_VOID:
226 + gemu_log("VOID ");
227 + break;
228 + case IOC_OUT:
229 + gemu_log("OUT ");
230 + break;
231 + case IOC_IN:
232 + gemu_log("IN ");
233 + break;
234 + case IOC_INOUT:
235 + gemu_log("INOUT");
236 + break;
237 + default:
238 + gemu_log("%01lx ???", (cmd & IOC_DIRMASK) >> 29);
239 + break;
240 + }
241 + gemu_log(" '%c' %3d %lu\n", (char)IOCGROUP(cmd), (int)(cmd & 0xff),
242 + IOCPARM_LEN(cmd));
243 +}