7.3 Hardware Information

Several of the other entries in the /proc file system provide access to information about the system hardware. Although these are typically of interest to system configurators and administrators, the information may occasionally be of use to application programmers as well. We'll present some of the more useful entries here.

7.3.1 CPU Information

As shown previously, /proc/cpuinfo contains information about the CPU or CPUs running the GNU/Linux system. The Processor field lists the processor number; this is 0 for single-processor systems. The Vendor, CPU Family, Model, and Stepping fields enable you to determine the exact model and revision of the CPU. More useful, the Flags field shows which CPU flags are set, which indicates the features available in this CPU. For example, "mmx" indicates the availability of the extended MMX instructions. [3]

[3] See the IA-32 Intel Architecture Software Developer's Manual for documentation about MMX instructions, and see Chapter 9, "Inline Assembly Code," in this book for information on how to use these and other special assembly instructions in GNU/Linux programs.

Most of the information returned from /proc/cpuinfo is derived from the cpuid x86 assembly instruction. This instruction is the low-level mechanism by which a program obtains information about the CPU. For a greater understanding of the output of /proc/cpuinfo, see the documentation of the cpuid instruction in Intel's IA-32 Intel Architecture Software Developer's Manual, Volume 2: Instruction Set Reference. This manual is available from http://developer.intel.com/design.

The last element, bogomips, is a Linux-specific value. It is a measurement of the processor's speed spinning in a tight loop and is therefore a rather poor indicator of overall processor speed.

7.3.2 Device Information

The /proc/devices file lists major device numbers for character and block devices available to the system. See Chapter 6, "Devices," for information about types of devices and device numbers.

7.3.3 PCI Bus Information

The /proc/pci file lists a summary of devices attached to the PCI bus or buses. These are actual PCI expansion cards and may also include devices built into the system's motherboard, plus AGP graphics cards. The listing includes the device type; the device and vendor ID; a device name, if available; information about the features offered by the device; and information about the PCI resources used by the device.

7.3.4 Serial Port Information

The /proc/tty/driver/serial file lists configuration information and statistics about serial ports. Serial ports are numbered from 0. [4] Configuration information about serial ports can also be obtained, as well as modified, using the setserial command. However, /proc/tty/driver/serial displays additional statistics about each serial port's interrupt counts.

[4] Note that under DOS and Windows, serial ports are numbered from 1, so COM1 corresponds to serial port number 0 under Linux.

For example, this line from /proc/tty/driver/serial might describe serial port 1 (which would be COM2 under Windows):

1: uart:16550A port:2F8 irq:3 baud:9600 tx:11 rx:0 

This indicates that the serial port is run by a 16550A-type UART, uses I/O port 0x2f8 and IRQ 3 for communication, and runs at 9,600 baud. The serial port has seen 11 transmit interrupts and 0 receive interrupts.

See Section 6.4, "Hardware Devices," for information about serial devices.