UNIX System Administration Handbook - Evi Nemeth [152]
options CHILD_MAX=1024
This option sets the maximum number of child processes on the system. The number should be high on a network server. In general, network server daemons create a child process for each incoming request.
options OPEN_MAX=1024
This option sets the maximum number of file descriptors on the system. This number should generally be the same as CHILD_MAX, since each incoming network connection gets assigned its own file descriptor. Given the way that network servers generally work, if you have fewer file descriptors than child processes, you will be limited by the number of file descriptors; the converse is also true.
12.8 ADDING DEVICE DRIVERS
A device driver is a program that manages the system’s interaction with a particular piece of hardware. The driver translates between the hardware commands understood by the device and the stylized programming interface used by the kernel. The existence of the driver layer helps keep UNIX reasonably device independent.
Device drivers are part of the kernel; they are not user processes. However, a driver can be accessed both from within the kernel and from the user space. User-level access to devices is usually provided through special device files that live in the /dev directory. The kernel transforms operations on these special files into calls to the code of the driver.
The old days were a time of chaos in which vendors shipped specialized boards for many of the devices connected to a machine. Eventually, the industry reached something closer to stability, with most systems supporting SCSI as their standard interface for disks, tapes, and CD-ROM drives. Vendors incorporated standard features such as Ethernet into their machines, and there was much rejoicing.
Then came the PC, which reintroduced chaos into the system administrator’s world. Once again, proprietary interfaces reigned, multiple “standards” were introduced, and a dizzying array of hardware with varying levels of operating system support were available. Behold:
• Over 30 different PC SCSI chipsets are supported by Linux, and each is packaged and sold by at least twice that many vendors.
• Over 200 different PC network interfaces are out there, each being marketed by several different vendors under different names.
• Newer, better, cheaper types of hardware are being developed all the time. Each will require a device driver in order to work with your UNIX of choice.
With the remarkable pace at which new hardware is being developed, it is practically impossible to keep the mainline OS distributions up to date with the latest hardware. It is not at all uncommon to have to add a device driver to your kernel to support a new piece of hardware.
Vendors are becoming more aware of the UNIX market, and they even provide UNIX drivers on occasion. You may be lucky and find that your vendor will furnish you with drivers and installation instructions. More likely, you will only find the driver you need on some uncommented web page.
In either case, this section shows you what is really going on when you add a device driver. We assume that you are comfortable with basic kernel configuration as covered earlier in this chapter.
Device numbers
Many devices have a corresponding file in /dev, the notable exceptions on modern operating systems being network devices. By virtue of being device files, the files in /dev each have a major and minor device number associated with them. The kernel uses these numbers to map references to a device file to the corresponding driver.
The major device number identifies the driver that the file is associated with (in other words, the type of device). The minor device number usually identifies which particular instance of a given device type is to be addressed. The minor device number is sometimes called the unit number.
You can see the major and minor number of a device file with ls -l:
% ls -l /dev/sda
brw-rw---- 1 root disk 8, 0 Mar 3 1999 /dev/sda
This example shows the first SCSI