其他分享
首页 > 其他分享> > IOCTL命令字的解析

IOCTL命令字的解析

作者:互联网

#define CMD_ERR_PRINT(devname, cmd, arg) do { \
char *p[4] = {"", "W", "R", "WR"}; \
if (0 == _IOC_DIR(cmd)) { \
printk(KERN_ERR "ERROR: /dev/%s not find cmd(%#x): _IO('%c', %d), called by pname=%s, pid=%d\n", \
devname, cmd, _IOC_TYPE(cmd), _IOC_NR(cmd), current->comm, current->pid); \
} else { \
printk(KERN_ERR "ERROR: /dev/%s not find cmd(%#x): _IO%s('%c', %d, 0x%p), called by pname=%s, pid=%d\n", \
devname, cmd, p[_IOC_DIR(cmd)], _IOC_TYPE(cmd), _IOC_NR(cmd), (void *)arg, current->comm, current->pid); \
} \
} while (0)

 

标签:devname,ERR,cmd,pid,命令字,current,IOCTL,解析,IOC
来源: https://www.cnblogs.com/chuck11/p/12344510.html