Many devices have more than one operating mode. For example, a serial port typically can operate at a variety of bit rates (sometimes called baud rates). Because the modes are unique to each device, OS/2 does not include specific functions to set or retrieve these modes. Instead OS/2 provides an I/O Control (IOCtl) interface to enable applications to control devices by communicating directly with the device driver.
The IOCtl interface is a method that an application or subsystem can use to send device-specific control commands to a device driver. The IOCtl interface function for OS/2 applications is DosDevIOCtl.
DosDevIOCtl provides a generic, expandable IOCtl facility. Applications send commands and data to the device driver with DosDevIOCtl. The OS/2 kernel reformats the generic IOCtl packets into request packets then calls the device driver. The device driver then carries out the specified action. IOCtl commands can be sent to both block and character device drivers.
Before using DosDevIOCtl, the application or subsystem must first obtain the device handle by calling DosOpen for the device name. The opened device handle is used to specify the device the command is to go to.
Refer to the Control Program Programming Reference for details of DosDevIOCtl.