/* * linux/fs/ioctl.c * * (C) 1991 Linus Torvalds */ #include <errno.h> #include <linux/string.h> #include <linux/stat.h> #include <linux/sched.h> int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) { struct file * filp; if (fd >= NR_OPEN || !(filp = current->filp[fd])) return -EBADF; if (filp->f_op && filp->f_op->ioctl) return filp->f_op->ioctl(filp->f_inode, filp, cmd,arg); return -EINVAL; }