IOCTL number differs from kernel space

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello All,

I am trying IOCTL example provided in http://linux.die.net/lkmpg/x892.html, 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.

// IOCTL number which is in kernel
[ 6417.807403]  Value of IOCTL_GET_NTH_BYTE: -1073454078
[ 6417.807398]  Value of IOCTL_GET_MSG: -2147195903
[ 6417.807391]  Value of IOCTL_SET_MSG: -2147195904


// IOCTL number which is received by kernel.
[ 6426.691360] Passed IOCTL:number 0
[ 6426.691464] Passed IOCTL:number -1074930088
[ 6426.691537] Passed IOCTL:number 134514878


Can you please tell why this number is getting changed while receiving in kernel ?

// Here is the definition of numbers.
#define MAJOR_NUM 100
#define IOCTL_SET_MSG _IOR(MAJOR_NUM, 0, char *)
#define IOCTL_GET_MSG _IOR(MAJOR_NUM, 1, char *)
#define IOCTL_GET_NTH_BYTE _IOWR(MAJOR_NUM, 2, int)


--
Regards
Jeshwanth Kumar N K
+91-7411483498
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux