Skip to Main Content
Understanding the Linux Kernel
book

Understanding the Linux Kernel

by Daniel P. Bovet, Marco Cesati
October 2000
Intermediate to advanced content levelIntermediate to advanced
704 pages
18h 13m
English
O'Reilly Media, Inc.
Content preview from Understanding the Linux Kernel

8.1. POSIX APIs and System Calls

Let us start by stressing the difference between an application programmer interface (API) and a system call. The former is a function definition that specifies how to obtain a given service, while the latter is an explicit request to the kernel made via a software interrupt.

Unix systems include several libraries of functions that provide APIs to programmers. Some of the APIs defined by the libc standard C library refer to wrapper routines, that is, routines whose only purpose is to issue a system call. Usually, each system call corresponds to a wrapper routine; the wrapper routine defines the API that application programs should refer to.

The converse is not true, by the way—an API does not necessarily correspond to a specific system call. First of all, the API could offer its services directly in User Mode. (For something abstract like math functions, there may be no reason to make system calls.) Second, a single API function could make several system calls. Moreover, several API functions could make the same system call but wrap extra functionality around it. For instance, in Linux the malloc( ), calloc( ), and free( ) POSIX APIs are implemented in the libc library: the code in that library keeps track of the allocation and deallocation requests and uses the brk( ) system call in order to enlarge or shrink the process heap (see Section 7.6 in Chapter 7).

The POSIX standard refers to APIs and not to system calls. A system can be certified as ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Kernel in a Nutshell

Linux Kernel in a Nutshell

Greg Kroah-Hartman
Linux Kernel Debugging

Linux Kernel Debugging

Kaiwan N. Billimoria
Understanding the Linux Kernel, 3rd Edition

Understanding the Linux Kernel, 3rd Edition

Daniel P. Bovet, Marco Cesati

Publisher Resources

ISBN: 0596000022Catalog PageErrata