Linux for Programmers and Users

[Page 432 (continued)]

12.1. Introduction

In order to make use of services such as file creation, process duplication, and interprocess communication, application programs must talk to the operating system. They can do this via a collection of routines called system calls, which are the programmer's functional interface to the Linux kernel. To the programmer, they're just like library functions (in fact, some are library functions that, in turn, make true system calls) except that they perform a subroutine call directly into the heart of Linux.

The Linux system calls can be loosely grouped into three main categories:

  • file management

  • process management

  • error handling

Interprocess communication (IPC) is in fact a subset of file management, since Linux treats IPC mechanisms as special files. Figure 12-1 illustrates the file management system call hierarchy.


[Page 433]

Figure 12-1. File management system call hierarchy.

The process management system call hierarchy includes routines for duplicating, differentiating, and terminating processes (Figure 12-2).

Figure 12-2. Process management system call hierarchy.

The only system call that supports error handling is perror (), which I'll put it in a hierarchy just to be consistent (Figure 12-3).

Figure 12-3. Error handling hierarchy.


[Page 434]

This chapter covers the system calls shown in these hierarchy diagrams in the following order:

  • Error handling. I start the chapter with a description of perror ().

  • Regular file management. This includes information on how to create, open, close, read, and write regular files. We'll also see a short overview of STREAMS.

  • Process management. This explains how to duplicate, differentiate, suspend, and terminate processes and briefly discusses multithreaded processes.

  • Signals. Although the signal facility could come under the heading of either process management or interprocess communication, it's a significant enough topic to warrant a section of its own.

  • Interprocess communications. This section describes IPC via pipes (both unnamed and named) and sockets.

Категории