+}
+
+__DEFINE_LXSYSCALL3(int, ioctl, int, fd, int, req, va_list, args)
+{
+ int errno;
+ struct v_fd* fd_s;
+ if ((errno = vfs_getfd(fd, &fd_s))) {
+ goto done;
+ }
+
+ struct device* dev = (struct device*)fd_s->file->inode->data;
+ if (dev->magic != DEV_STRUCT_MAGIC) {
+ errno = ENODEV;
+ goto done;
+ }
+
+ if (!dev->ops.exec_cmd) {
+ errno = ENOTSUP;
+ goto done;
+ }
+
+ errno = dev->ops.exec_cmd(dev, req, args);
+
+done:
+ return DO_STATUS_OR_RETURN(errno);