Linux API Dr. Michael L. Collard 1
Linux Systems Programming Linux API – set of calls that applications, directly or indirectly, use to interact with the Linux kernel File, directory, and filesystem access Communication Concurrency Control
Device Interface files, terminals, disks, tapes, audio, network, peripheral devices device driver – Kernel module, typically LKM (Loadable Kernel Module) devices represented as special files
Device Types Regular file Block device (block special file) – similar to a disk, transfers information in blocks Character device (character special file) – terminal-like with a stream of bytes in order Network device – no device node, use name with socket to ioctl File-system device – Rarely directly access, through ioctl
Uniform Device Access File descriptor 0 – STDIN_FILENO, 1 – STDOUT_FILENO, 2 – STDERR_FILENO open close read write ioctl
Process Creation init – special process, parent of all processes fork exec family: execle wait
Interrupts & Signals Interrupt generated by hardware, typically by external device drivers, and typically asynchronous Signal How software is notified of an asynchronous event Signal Handler – How a process catches and handles a generated signal
Terminal Control Special Devices have special capabilities termios.h tcgetattr tcsetattr