This source file includes following definitions.
- sys_ioctl
1
2
3
4
5
6
7 #include <asm/segment.h>
8
9 #include <linux/sched.h>
10 #include <linux/errno.h>
11 #include <linux/string.h>
12 #include <linux/stat.h>
13
14 int sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg)
15 {
16 struct file * filp;
17 int block;
18
19 if (fd >= NR_OPEN || !(filp = current->filp[fd]))
20 return -EBADF;
21 if (S_ISREG(filp->f_inode->i_mode) && cmd == BMAP_IOCTL &&
22 filp->f_inode->i_op->bmap) {
23 block = get_fs_long((long *) arg);
24 block = filp->f_inode->i_op->bmap(filp->f_inode,block);
25 put_fs_long(block,(long *) arg);
26 return 0;
27 }
28 if (filp->f_op && filp->f_op->ioctl)
29 return filp->f_op->ioctl(filp->f_inode, filp, cmd,arg);
30 return -EINVAL;
31 }