IOCTL命令字的解析
Posted chuck11
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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
",
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
",
devname, cmd, p[_IOC_DIR(cmd)], _IOC_TYPE(cmd), _IOC_NR(cmd), (void *)arg, current->comm, current->pid);
}
} while (0)
__user
以上是关于IOCTL命令字的解析的主要内容,如果未能解决你的问题,请参考以下文章