Полезная информация Цветы с доставкой магнитогорск русский букет доставка цветов в магнитогорск.

next up previous contents
Next: The mmap() function Up: The VFS Previous: The select() function

The ioctl() function

The ioctl() function processes ioctl calls. The structure of your ioctl() function will be: first error checking, then one giant (possibly nested) switch statement to handle all possible ioctls. The ioctl number is passed as cmd, and the argument to the ioctl is passed as arg. It is good to have an understanding of how ioctls ought to work before making them up. If you are not sure about your ioctls, do not feel ashamed to ask someone knowledgeable about it, for a few reasons: you may not even need an ioctl for your purpose, and if you do need an ioctl, there may be a better way to do it than what you have thought of. Since ioctls are the least regular part of the device interface, it takes perhaps the most work to get this part right. Take the time and energy you need to get it right.

dispitems416

dispitems423

If the ioctl() slot in the file_operations structure is not filled in, the VFS will return -EINVAL. However, in all cases, if cmd is one of FIOCLEX, FIONCLEX, FIONBIO, or FIOASYNC, default processing will be done:

dispitems435

Note that you have to avoid these four numbers when creating your own ioctls, since if they conflict, the VFS ioctl code will interpret them as being one of these four, and act appropriately, causing a very hard to track down bug.



Converted on:
Mon Apr 1 10:20:16 EST 1996