An Ioctl() is a "catch all" function built into a device driver for a device in a UNIX system.

Normally, each device driver that sits under the kernel has a defined set of functions that are callable by the kernel to do standard operations (read(), write(), open(), close(), etc.). This is pretty much the case with device drivers on all OSs I've worked on. However, your brand-spanking new "Whizz-O" device may just have some whacky new feature you want to use that doesn't fall under one of the standard DD function calls - for example, the "Jello Squirt" function, and the "Select Jello Colour" function won't sit easily under a read() or write() function, since it will have undesirable (and probably unexpected) results when the kernel wants to send the "Whizz-O" a file to write, for example.

So what you do is build the function you need under the Ioctl(), one layer deeper. To call the "Select Jello Colour" feature of the device, you call IOCTL( Device, Function, NewColour) (where Device = "Whizz-O", and Function = "Select Jello Colour"), then to make it squirt the Green Jello (NewColour was, of course = "Green" in this case ) you then call IOCTL( Device, Function, NULL) (where Function = "Squirt").

So there you go, IOCTLs in a nutshell. Clear as Mud? Good. There will be a test at the end of class.

One of the few remaining Mk1 owners... #00015
_________________________
One of the few remaining Mk1 owners... #00015