Next: SYSTEMS PROGRAMMING LABORATORY VI
Up: Interprocess Communication
Previous: Loopback Devices
Contents
- 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. 6.16 presents a short program that ejects the disk in a CD-ROM drive (if the
drive supports this).
Figure 6.16:
Eject a CD-ROM.
|
$ ./cdrom-eject /dev/hdc
Cem Ozdogan
2007-05-16