root/fs/ioctl.c

/* [previous][next][first][last][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. sys_ioctl

   1 /*
   2  *  linux/fs/ioctl.c
   3  *
   4  *  Copyright (C) 1991, 1992  Linus Torvalds
   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)
     /* [previous][next][first][last][top][bottom][index][help] */
  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 }

/* [previous][next][first][last][top][bottom][index][help] */