用户空间 ioctl() 系统调用原型 int ioctl(int fd,unsigned long cmd, ...);

驱动中的 ioctl 方法原型 int (*ioctl) (struct inode *inode,struct file *flip,unsigned int cmd,unsigned long arg);

1. ioctl 中的 命令cmd 以及参数 arg

ioctl命令

(1) 内核中生成命令的辅助的宏:

 _IO  an ioctl with no parameters

 _IOW  an ioctl with write parameters (copy_from_user)

 _IOR  an ioctl with read parameters (copy_to_user)

 _IOWR an ioctl with both write and read parameters

'write' and 'read' are from the user's point of view

(2) 内核中的预定义命令,如果设备驱动中包含了与预定义命令一样的命令码,则这些命令将会被当作预定义命令被内核处理。

FIOCLEX , FIONCLEX , FIOQSIZE , FIONBIO

 

相关文章:

  • 2021-05-17
  • 2021-06-24
  • 2022-12-23
  • 2021-06-30
  • 2021-10-25
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-01
  • 2022-02-19
  • 2021-09-09
  • 2022-12-23
  • 2021-04-15
相关资源
相似解决方案