[E liangshi Yiyou network] in the UNIX operating system, access to I/O devices is performed through a set of fixed entry points, this set of entry points are provided by the device drivers for each device. Generally, the drivers of devices provide the following entry points:
1. Open entry point. Open the device to prepare for the I/O operation. When you open a special device file, the open entry point of the device is called. The open subroutine must make necessary preparations for the I/O operations to be performed, such as clearing the buffer zone. If the device is exclusive, that is, only one program can access the device at the same time, the open subroutine must set some signs to indicate that the device is busy.
2. Close the entry point. Disable a device. After the last device termination, call the close subroutine. An exclusive device must be marked as a device that can be used again.
3. Read entry point. Read data from the device. For I/O operations with a buffer, data is generally read from the buffer. The read subroutine is called to read special device files.
4. Write entry point. Write Data to the device. For I/O operations with a buffer, data is generally written into the buffer. The write subprogram is called to write special device files.
5. IOCTL entry point. Perform operations other than read and write operations.
6. select entry point. Check the device to see whether the data is readable or whether the device can be used to write data. The Select system calls the select entry point when checking the file descriptors related to the device's special files. If the device driver does not provide one of the above entry points, the system will use the default subroutine instead. There are also some other entry points for different UNIX operating systems.
For more information about the basic structure of device drivers in UNIX operating systems, we will explain it here today. We hope to have more opportunities to discuss with you later. MoreSystem O & M tutorialLog on to the E-mentor Yiyou network with relevant knowledge.
About the device drivers of UNIX operating systems