ptg10805159
Section 1.12 Summary 23
application
code
Clibrary
functions
system calls
kernel
user process
Figure 1.12 Difference between C library functions and system calls
we comparethe unbuffered I/O functions (Chapter 3) and the standardI/O functions
(Chapter 5).
The process control system calls (fork,exec,andwaitpid)are usually invoked
by the user’s application code directly.(Recall the bare-bones shell in Figure1.7.) But
some library routines exist to simplify certain common cases: thesystemandpopen
library routines, for example. In Section 8.13, we’ll show an implementation of the
systemfunction that invokes the basic process control system calls.We’ll enhance this
example in Section 10.18 to handle signals correctly.
To define the interface to the UNIX System that most programmers use, we have to
describe both the system calls and some of the library functions. If we described only
the sbrksystem call, for example, we would skip the moreprogrammer-friendly
malloclibrary function that many applications use. In this text, we’ll use the term
functionto refer to both system calls and library functions, except when the distinction is
necessary.
1.12 Summary
This chapter has provided a short tour of the UNIX System.We’ve described some of
the fundamental terms that we’ll encounter over and over again.We’ve seen numerous
small examples of UNIX programs to give us a feel for what the remainder of the text
talks about.