*/
#include "defs.h"
-#include <asm/ioctl.h>
+#include <linux/ioctl.h>
#include "xlat/ioctl_dirs.h"
#ifdef HAVE_LINUX_INPUT_H
return (code1 > code2) ? 1 : (code1 < code2) ? -1 : 0;
}
-const struct_ioctlent *
+static const struct_ioctlent *
ioctl_lookup(const unsigned int code)
{
struct_ioctlent *iop;
return iop;
}
-const struct_ioctlent *
+static const struct_ioctlent *
ioctl_next_match(const struct_ioctlent *iop)
{
const unsigned int code = iop->code;
return NULL;
}
-void
+static void
ioctl_print_code(const unsigned int code)
{
tprints("_IOC(");
return 0;
}
-int
+static int
ioctl_decode_command_number(unsigned int arg)
{
switch (_IOC_TYPE(arg)) {
}
}
-int
+static int
ioctl_decode(struct tcb *tcp, unsigned int code, long arg)
{
switch (_IOC_TYPE(code)) {
return v4l2_ioctl(tcp, code, arg);
case '=':
return ptp_ioctl(tcp, code, arg);
+#ifdef HAVE_LINUX_INPUT_H
+ case 'E':
+ return evdev_ioctl(tcp, code, arg);
+#endif
default:
break;
}
return 0;
}
-/*
- * Registry of ioctl characters, culled from
- * @(#)ioccom.h 1.7 89/06/16 SMI; from UCB ioctl.h 7.1 6/4/86
- *
- * char file where defined notes
- * ---- ------------------ -----
- * F sun/fbio.h
- * G sun/gpio.h
- * H vaxif/if_hy.h
- * M sundev/mcpcmd.h *overlap*
- * M sys/modem.h *overlap*
- * S sys/stropts.h
- * T sys/termio.h -no overlap-
- * T sys/termios.h -no overlap-
- * V sundev/mdreg.h
- * a vaxuba/adreg.h
- * d sun/dkio.h -no overlap with sys/des.h-
- * d sys/des.h (possible overlap)
- * d vax/dkio.h (possible overlap)
- * d vaxuba/rxreg.h (possible overlap)
- * f sys/filio.h
- * g sunwindow/win_ioctl.h -no overlap-
- * g sunwindowdev/winioctl.c !no manifest constant! -no overlap-
- * h sundev/hrc_common.h
- * i sys/sockio.h *overlap*
- * i vaxuba/ikreg.h *overlap*
- * k sundev/kbio.h
- * m sundev/msio.h (possible overlap)
- * m sundev/msreg.h (possible overlap)
- * m sys/mtio.h (possible overlap)
- * n sun/ndio.h
- * p net/nit_buf.h (possible overlap)
- * p net/nit_if.h (possible overlap)
- * p net/nit_pf.h (possible overlap)
- * p sundev/fpareg.h (possible overlap)
- * p sys/sockio.h (possible overlap)
- * p vaxuba/psreg.h (possible overlap)
- * q sun/sqz.h
- * r sys/sockio.h
- * s sys/sockio.h
- * t sys/ttold.h (possible overlap)
- * t sys/ttycom.h (possible overlap)
- * v sundev/vuid_event.h *overlap*
- * v sys/vcmd.h *overlap*
- * V linux/videodev2.h
- *
- * End of Registry
- */
+SYS_FUNC(ioctl)
+{
+ const struct_ioctlent *iop;
+
+ if (entering(tcp)) {
+ printfd(tcp, tcp->u_arg[0]);
+ tprints(", ");
+ if (!ioctl_decode_command_number(tcp->u_arg[1])) {
+ iop = ioctl_lookup(tcp->u_arg[1]);
+ if (iop) {
+ tprints(iop->symbol);
+ while ((iop = ioctl_next_match(iop)))
+ tprintf(" or %s", iop->symbol);
+ } else {
+ ioctl_print_code(tcp->u_arg[1]);
+ }
+ }
+ ioctl_decode(tcp, tcp->u_arg[1], tcp->u_arg[2]);
+ }
+ else {
+ int ret = ioctl_decode(tcp, tcp->u_arg[1], tcp->u_arg[2]);
+ if (!ret)
+ tprintf(", %#lx", tcp->u_arg[2]);
+ else
+ return ret - 1;
+ }
+ return 0;
+}