Hello All,<br><br>I am trying IOCTL example provided in <a href="http://linux.die.net/lkmpg/x892.html">http://linux.die.net/lkmpg/x892.html</a>, both user-space and kernel space using same chardev.h file for IOCTL number. But the number receiving in kernel is different than number in kernel. I printed both the received number and defined number in dmesg, please find it below.<br>
<br>// IOCTL number which is in kernel<br>[ 6417.807403] Value of IOCTL_GET_NTH_BYTE: -1073454078<br>[ 6417.807398] Value of IOCTL_GET_MSG: -2147195903<br>[ 6417.807391] Value of IOCTL_SET_MSG: -2147195904<br><br><br>
// IOCTL number which is received by kernel.<br>
[ 6426.691360] Passed IOCTL:number 0<br>[ 6426.691464] Passed IOCTL:number -1074930088<br>[ 6426.691537] Passed IOCTL:number 134514878<br><br><br>Can you please tell why this number is getting changed while receiving in kernel ?<br>
<br>// Here is the definition of numbers.<br>#define MAJOR_NUM 100<br>#define IOCTL_SET_MSG _IOR(MAJOR_NUM, 0, char *)<br>#define IOCTL_GET_MSG _IOR(MAJOR_NUM, 1, char *)<br>#define IOCTL_GET_NTH_BYTE _IOWR(MAJOR_NUM, 2, int)<br>
<br clear="all"><br>-- <br>Regards<br>Jeshwanth Kumar N K<br>+91-7411483498<br>