Next: About this document ...
Up: Devices
Previous: Loopback Devices
- The ioctl system call is an all-purpose interface for controlling hardware devices.
- The first argument to ioctl is a file descriptor, which should be opened to the device that you want to control.
- The second argument is a request code that indicates the operation that you want to perform.
- The http://siber.cankaya.edu.tr/SystemsProgramming/cfiles/cdrom-eject.cprogram in Fig. 7 presents a short program that ejects the disk in a CD-ROM drive (if the
drive supports this).
Figure 7:
Eject a CD-ROM.
|
$ ./cdrom-eject /dev/hdc
Cem Ozdogan
2007-04-16