Reputation: 3992
Below is the prototype of an ioctl call
long ioctl(struct file *f, unsigned int cmd, unsigned long arg);
Why third argument of an ioctl is unsigned long by default? Some times we pass a pointer to it. But it is using unsigned long.
Upvotes: 2
Views: 1874
Reputation: 331
In kernel unsigned long is often used as a substitution for pointers, for pointers always have this size on every architecture. Ioctls may take an integer as an argument as well, so this makes sense here. This must be defined for each ioctl.
Please mind, that ioctls are deprecated and unlocked_ioctls must be used in current kernel versions: http://lwn.net/Articles/119652/
Upvotes: 3