The Linux Programming Interface: A Linux and UNIX System Programming Handbook

The Linux Programming Interface: A Linux and UNIX System Programming Handbook

Michael Kerrisk

Language: English

Pages: 1552

ISBN: 1593272200

Format: PDF / Kindle (mobi) / ePub


The Linux Programming Interface is the definitive guide to the Linux and UNIX programming interface—the interface employed by nearly every application that runs on a Linux or UNIX system.

In this authoritative work, Linux programming expert Michael Kerrisk provides detailed descriptions of the system calls and library functions that you need in order to master the craft of system programming, and accompanies his explanations with clear, complete example programs.

You'll find descriptions of over 500 system calls and library functions, and more than 200 example programs, 88 tables, and 115 diagrams. You'll learn how to:

  • Read and write files efficiently
  • Use signals, clocks, and timers
  • Create processes and execute programs
  • Write secure programs
  • Write multithreaded programs using POSIX threads
  • Build and use shared libraries
  • Perform interprocess communication using pipes, message queues, shared memory, and semaphores
  • Write network applications with the sockets API

While The Linux Programming Interface covers a wealth of Linux-specific features, including epoll, inotify, and the /proc file system, its emphasis on UNIX standards (POSIX.1-2001/SUSv3 and POSIX.1-2008/SUSv4) makes it equally valuable to programmers working on other UNIX platforms.

The Linux Programming Interface is the most comprehensive single-volume work on the Linux and UNIX programming interface, and a book that's destined to become a new classic.

Praise for The Linux Programming Interface

"If I had to choose a single book to sit next to my machine when writing software for Linux, this would be it."—Martin Landers, Software Engineer, Google

"This book, with its detailed descriptions and examples, contains everything you need to understand the details and nuances of the low-level programming APIs in Linux . . . no matter what the level of reader, there will be something to be learnt from this book."—Mel Gorman, Author of Understanding the Linux Virtual Memory Manager

"Michael Kerrisk has not only written a great book about Linux programming and how it relates to various standards, but has also taken care that bugs he noticed got fixed and the man pages were (greatly) improved. In all three ways, he has made Linux programming easier. The in-depth treatment of topics in The Linux Programming Interface . . . makes it a must-have reference for both new and experienced Linux programmers."—Andreas Jaeger, Program Manager, openSUSE, Novell

"Michael's inexhaustible determination to get his information right, and to express it clearly and concisely, has resulted in a strong reference source for programmers. While this work is targeted at Linux programmers, it will be of value to any programmer working in the UNIX/POSIX ecosystem."—David Butenhof, Author of Programming with POSIX Threads and Contributor to the POSIX and UNIX Standards

". . . a very thorough—yet easy to read—explanation of UNIX system and network programming, with an emphasis on Linux systems. It's certainly a book I'd recommend to anybody wanting to get into UNIX programming (in general) or to experienced UNIX programmers wanting to know 'what's new' in the popular GNU/Linux system."—Fernando Gont, Network Security Researcher, IETF Participant, and RFC Author

". . . encyclopedic in the breadth and depth of its coverage, and textbook-like in its wealth of worked examples and exercises. Each topic is clearly and comprehensively covered, from theory to hands-on working code. Professionals, students, educators, this is the Linux/UNIX reference that you have been waiting for."—Anthony Robins, Associate Professor of Computer Science, The University of Otago

"I've been very impressed by the precision, the quality and the level of detail Michael Kerrisk put in his book. He is a great expert of Linux system calls and lets us share his knowledge and understanding of the Linux APIs."—Christophe Blaess, Author of Programmation systeme en C sous Linux

". . . an essential resource for the serious or professional Linux and UNIX systems programmer. Michael Kerrisk covers the use of all the key APIs across both the Linux and UNIX system interfaces with clear descriptions and tutorial examples and stresses the importance and benefits of following standards such as the Single UNIX Specification and POSIX 1003.1."—Andrew Josey, Director, Standards, The Open Group, and Chair of the POSIX 1003.1 Working Group

"What could be better than an encyclopedic reference to the Linux system, from the standpoint of the system programmer, written by none other than the maintainer of the man pages himself? The Linux Programming Interface is comprehensive and detailed. I firmly expect it to become an indispensable addition to my programming bookshelf."—Bill Gallmeister, Author of POSIX.4 Programmer's Guide: Programming for the Real World

". . . the most complete and up-to-date book about Linux and UNIX system programming. If you're new to Linux system programming, if you're a UNIX veteran focused on portability while interested in learning the Linux way, or if you're simply looking for an excellent reference about the Linux programming interface, then Michael Kerrisk's book is definitely the companion you want on your bookshelf."—Loic Domaigne, Chief Software Architect (Embedded), Corpuls.com

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

with alloca(). Likewise, it is not possible to use realloc() to resize a block of memory allocated by alloca(). Although alloca() is not part of SUSv3, it is provided on most UNIX implementations and is thus reasonably portable. 150 Chapter 7 Older versions of glibc, and some other UNIX implementations (mainly BSD derivatives), require the inclusion of instead of to obtain the declaration of alloca(). If the stack overflows as a consequence of calling alloca(), then

1321 1322 1323 1 32 5 1325 1329 1330 1330 1331 1337 1341 1344 1346 1346 1351 1352 1355 1356 1356 1358 1363 1365 1366 1368 1369 1370 1373 1374 64 P S E U D O T E RMI N A L S 64.1 64.2 1 37 5 Overview ............................................................................................................... UNIX 98 Pseudoterminals......................................................................................... 64.2.1 Opening an Unused Master: posix_openpt()

many chapters of my book. David Butenhof (Hewlett-Packard) was a member of the original working group for POSIX threads and for the Single UNIX Specification threads extensions, and is the author of Programming with POSIX Threads. He wrote the original DCE Threads reference implementation for the Open Software Foundation, z z z z z and was lead architect of the threads implementation for OpenVMS and Digital UNIX. David reviewed the threads chapters, suggested many improvements, and

typed by a user and execute appropriate programs in response to those commands. Such a program is sometimes known as a command interpreter. The term login shell is used to denote the process that is created to run a shell when the user first logs in. 24 Chapter 2 Whereas on some operating systems the command interpreter is an integral part of the kernel, on UNIX systems, the shell is a user process. Many different shells exist, and different users (or, for that matter, a single user) on the

system or device are handled within the kernel, we can generally ignore device-specific factors when writing application programs. When access to specific features of a file system or device is required, a program can use the catchall ioctl() system call (Section 4.8), which provides an interface to features that fall outside the universal I/O model. 4.3 Opening a File: open() The open() system call either opens an existing file or creates and opens a new file. #include #include

Download sample

Download