ioctl命令

用户空间 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

(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

 

转载于:https://www.cnblogs.com/youngvoice/p/4840075.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值