Linux驅動程序設計的時候偶然發現的ioctl()函數的cmd參數不能為2,如果為2,ioctl()函數返回-1,網上說就是這樣的,正常,不知道為什么,stack overflow上有一個外國學友的建議:
“In general, you want to compose your ioctl commands using the?_IO
?family of macros, with a unique type, to avoid collisions.
I suggest reading?ioctl-number.txt?from the kernel documentation for more information, including a list of most used types”
In general, you want to compose your ioctl commands using the?_IO
?family of macros, with a unique type, to avoid collisions.
I suggest reading?ioctl-number.txt?from the kernel documentation for more information, including a list of most used types”