Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required. Learn more
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Linux Application Development 2nd Edition
| Price | New from | Used from |
- ISBN-100321219147
- ISBN-13978-0321219145
- Edition2nd
- PublisherAddison-Wesley Professional
- Publication dateJanuary 1, 2004
- LanguageEnglish
- Dimensions7.5 x 1.5 x 9.5 inches
- Print length702 pages
Editorial Reviews
From the Back Cover
"The first edition of this book has always been kept within arm's reach of my desk due to the wonderful explanations of all areas of the Linux userspace API. This second edition greatly overshadows the first one, and will replace it."
--Greg Kroah-Hartman, Linux kernel programmer
Develop Software that Leverages the Full Power of Today's Linux
Linux Application Development, Second Edition, is the definitive reference for Linux programmers at all levels of experience, including C programmers moving from other operating systems. Building on their widely praised first edition, leading Linux programmers Michael Johnson and Erik Troan systematically present the key APIs and techniques you need to create robust, secure, efficient software or to port existing code to Linux.
This book has been fully updated for the Linux 2.6 kernel, GNU C library version 2.3, the latest POSIX standards, and the Single Unix Specification, Issue 6. Its deep coverage of Linux-specific extensions and features helps you take advantage of the full power of contemporary Linux. Along the way, the authors share insights, tips, and tricks for developers working with any recent Linux distribution, and virtually any version of Unix.
Topics include
- Developing in Linux: understanding the operating system, licensing,
- and documentation
- The development environment: compilers, linker and loader, and unique
- debugging tools
- System programming: process models, file handling, signal processing, directory operations, and job control
- Terminals, sockets, timers, virtual consoles, and the Linux console
- Development libraries: string matching, terminal handling, command-line parsing, authentication, and more
- Hundreds of downloadable code samples
New to this edition
- The GNU C library (glibc), underlying standards, and test macros
- Writing secure Linux programs, system daemons, and utilities
- Significantly expanded coverage of memory debugging, including Valgrind and mpr
- Greatly improved coverage of regular expressions
- IPv6 networking coverage, including new system library interfaces for using IPv6 and IPv4 interchangeably
- Coverage of strace, ltrace, real-time signals, poll and epoll system calls, popt library improvements, Pluggable Authentication Modules (PAM), qdbm, and much more
- Improved index and glossary, plus line-numbered code examples
About the Author
Michael K. Johnson is an operating system engineer at Specifix. He was formerly an operating system developer for Red Hat, where he managed the kernel team for three and a half years, and was founding technical leader of the Fedora Project. He occasionally teaches full-day tutorials on Linux application development.
Erik W. Troan, cofounder and Executive VP of Operating Systems at Specifix, was formerly Vice President of Product Engineering at Red Hat, where he was responsible for specifying and building technologies such as RPM, Linux operating systems, the Red Hat Network, high-performance Web servers, and the infrastructure for Red Hat's Web site.
Excerpt. © Reprinted by permission. All rights reserved.
We wrote this book for experienced (or not-so-experienced, but eager-to-learn) programmers who want to develop Linux software or to port software from other platforms to Linux. This is the book we wish we had when we were learning to program for Linux, and the book we now keep on our desks for reference. As soon as we wrote the first three chapters of the first edition, we were using the drafts as reference material while we worked.
This second edition removes outdated information, adds new information, and introduces an online version. You can now browse and search the entire content of this book at http://ladweb.net/ to make this book even more useful to you.
Linux is designed to be similar to Unix. This book gives you a good background in Unix programming basics and style. Linux is not fundamentally different from Unix; it differs in some details, but no more than one Unix version typically differs from another Unix version. This book is very much a Unix programming guide that is written from a Linux viewpoint and with specific Linux information.
Linux also has unique extensions, such as its direct screen access capabilities (see Chapter 21), and it has features that are used more often on it than on other systems, such as the popt library (see Chapter 26). This book covers many of those extensions and features so that you can write programs that truly take advantage of Linux.
- If you are a C programmer, but you know neither Unix nor Linux, reading this book cover-to-cover and working with the examples should put you well on the road to being a competent Linux programmer. With the aid of system-specific documentation, you should find the transition to any version of Unix easy.
- If you are already a proficient Unix programmer, you will find that this book makes your transition to Linux easier. We have tried very hard to make it easy for you to find precisely the information you need to know. We also carefully and clearly cover topics that sometimes trip up even experienced Unix programmers, such as process and session groups, job control, and tty handling.
- If you are already a Linux programmer, this book covers confusing topics clearly and will make many of your programming tasks easier. Nearly every chapter will stand alone for you, because you already possess the essential knowledge of Linux on which they are based. No matter how experienced you are, you will find material here that you will appreciate having at your elbow.
This book is different from typical Unix programming texts because it is unabashedly specific to a particular operating system. We do not try to cover all the differences between different Unix-like systems; to do so would not be useful to Linux programmers, Unix programmers, or C programmers unfamiliar with Linux or Unix. We know from our own experience that once you learn how to program well for any Unix-like system, the others are easy to learn.
This book does not cover all the details of Linux programming. It does not explain the basic interface specified by ANSI/ISO C---other books do that quite well. It does not cover the wealth of other programming languages available for Linux, and it does not cover the graphical programming libraries that are identical no matter what system you are using. Instead, we point you to books that specialize in those areas. Without extraordinary verbosity, we cover the information you need to know to go from being a C programmer for another system, such as Windows, Macintosh, or even DOS, to being a C programmer for Linux.
Linux Application Development is written in four parts:
- The first part introduces you to Linux---the operating system, license terms, and online system documentation.
- The second part covers the most important facets of the development environment---the compilers, linker and loader, and some debugging tools that are not widely used on other platforms.
- The third part is the heart of the book---it describes the interface to the kernel and to system libraries that are meant primarily as an interface to the kernel. In this section, only Chapters 19, 20, and 21 are very Linux-specific; most of this section covers general Unix programming from a Linux perspective. A new chapter in this second edition, Chapter 22, covers the basics of writing secure programs.
- The fourth part rounds out your knowledge---it includes descriptions of some important libraries that provide interfaces that are more independent of the kernel. These libraries are, properly speaking, not Linux-specific, but several are used more often on Linux systems than on other systems.
If you are already familiar with Linux or Unix programming, you will be able to read the chapters in this book in any order, skipping any that do not interest you. If you are not familiar with either Linux or Unix, most of the chapters will stand alone, but you will probably want to read Chapters 1, 2, 4, 5, 9, 10, 11, and 14 first, as they give you most of what you need to know to read the other chapters. In particular, Chapters 10, 11, and 14 form the core of the Unix and Linux programming model.
The following books, although they may overlap a little here and there, mostly complement this book by being simpler, more advanced, or on related topics.
- The C Programming Language, second edition concisely teaches ANSI standard C programming, with scant reference to the operating system. It recommends that readers have either some programming knowledge or "access to a more knowledgeable colleague."
- Practical C Programming teaches C programming and style in a step-by-step, easy-to-follow manner that is designed for people with no prior programming experience.
- Programming with GNU Software is an introduction to the GNU programming environment, including chapters on running the C compiler, the debugger, the make utility, and the RCS source code control system.
- Advanced Programming in the UNIX Environment covers most important Unix and Unix-like systems, although it predates Linux. It covers similar material to the final two parts of Linux Application Development: system calls and shared libraries. It also provides many examples and explains the difference between various Unix versions.
- UNIX Network Programming thoroughly covers network programming, including legacy types of networking that are not available on Linux, at least as we write this. While reading this book, stick to the Berkeley socket interface (see Chapter 17) to maintain maximum portability. This book may be useful if you need to make a few slight changes to port your Linux network program to some brand of Unix.
- A Practical Guide to Red Hat Linux 8 is a 1,500-page tome that contains introductions to using Linux, shell programming, and system administration. While this book does mention Red Hat Linux 8, most of the information it contains applies to all flavors of Linux. It also contains a summary reference to many of the utilities that are included with a Linux system.
- Linux in a Nutshell is smaller and shorter and concentrates on a summary utility reference derived from O'Reilly's earlier nutshell references.
- Linux Device Drivers, second edition teaches those who have never touched operating system code, as well as those who have, how to write Linux device drivers.
All the source code in this book comes from working examples that we have tested while writing. All of the source code in this book is available in electronic format at http://ladweb.net/ In the interest of clarity, some short source code segmentscheck only for likely errors that document how the system works rather than check for all possible errors. However, in the full programs in the book and on our Web site, we have made an attempt (we are not perfect) to check for all reasonable errors.
This book will teach you which functions to use and how they fit together; we encourage you to learn also how to use the reference documentation, the great majority of which was included with your system. Chpater 3 discusses how to find online information on your Linux system.
Linux is a rapidly developing operating system, and by the time you read this book, some facts (although we hope little substance) will no doubt have changed. We wrote this book in reference to the Linux 2.6 kernel and the GNU C library version 2.3.
With your help, we will maintain a list of errata and changes on the World Wide Web at http://ladweb.net/errata.html
We welcome your comments sent to lad-comments@ladweb.net. We will read your comments, although we cannot promise to respond to them individually.
Second Edition
Additions to and modifications from the first to the second edition include:
- The whole book has been updated to take into account the new Single Unix Specification, issue 6; the updated version of the POSIX standard.
- A table of example source code has been added to make it easier to find sample programs.
- Small segments of example source code now are listed with line numbers printed, making it easier for you to orient yourself in respect to each entire soure code example.
- Chapter 1 has an updated and expanded history of Linux development.
- Chapter 4 now discusses the strace and ltrace utilities.
- Chapter 6 is a new chapter that discusses the GNU C library (glibc) and the standards on which it is based. Of particular interest, it explains how (and why) to use feature test macros. It also describes some basic types used by system calls discussed throughout the book, how to discover the capabilities of your system at run time, covers some miscellaneous system interfaces glibc provides, and describes glibc's approach to backward compatibility.
- Chapter 7 has significantly expanded information on memory debugging tools, including new memory debugging facilities in the GNU C Library, a new version of mpr, and the new Valgrind tool.
- Chapter 12 discusses real-time signals and signal contexts.
- Chapter 13 documents the poll() and epoll system calls, which provide recommended alternatives to select().
- Chapter 16 now discusses and recommends the newer mechanism for allocating Pseudo TTYs, and covers the modification of the utmp and wtmp system databases.
- Chapter 17 now covers IPv6 as well as IPv4, including new system library interfaces for writing programs that can use both IPv6 and IPv4 interchangeably. It still explains the older interfaces covered in the first edition, in order to enable you to maintain code that uses those interfaces and to port that older code to the newer interfaces. It also discusses more functionality that is required of many network server programs, such as non-blocking accept().
- Chapter 22 is a new chapter that discusses the basic requirements of writing secure programs, and explains why security concerns apply to all programs, not just system daemons and utilities.
- Chapter 23 has much-improved discussion of using regular expressions, including a simple version of the grep utility as an example.
- Chapter 26 covers the latest improvements to the popt library and has better example source code, more than doubling the length of the chapter.
- Chapter 28 has useful coverage of the Linux-PAM implementation of PAM added.
- Chapter 25 now documents the qdbm library rather than Berkeley db, as the qdbm license is less restrictive.
- The index and glossary have been greatly improved in scope and quality. In particular, canonical entries in the index are now flagged in bold to make it obvious where to look first.
- There are smaller changes throughout the book, with nearly every chapter having important updates.
Subtractions include:
- How to find generic Linux information on mailing lists, Web sites, and newsgroups; this information changes too rapidly to be part of a book that should otherwise be useful for many years.
- Discussion of manipulating I/O ports; this facility is generally deprecated because it conflicts with Linux's device and power management structure.
- Verbatim copies of the GNU General Public License and GNU Library General Public License. While these two licenses are as important as ever, it will not increase public awareness of their contents to print them again. Also, several other licenses have become more important since the first edition was published.
- The Checker tool for memory debugging is no longer maintained, so the second edition no longer discusses it.
Acknowledgments
We would like to thank each of our technical reviewers for their time and careful thought. Their suggestions have made this book stronger. Particular thanks go to Linus Torvalds, Alan Cox, Ted Ts'o, and Arjan van de Ven, who took time to answer our questions.
After supporting us through writing the first edition, our wives, Kim Johnson and Brigid Troan, were so brave and generous that they encouraged us to write this second edition. Without their help, this book would never have been written, let alone updated.
Product details
- Publisher : Addison-Wesley Professional; 2nd edition (January 1, 2004)
- Language : English
- Hardcover : 702 pages
- ISBN-10 : 0321219147
- ISBN-13 : 978-0321219145
- Item Weight : 2.91 pounds
- Dimensions : 7.5 x 1.5 x 9.5 inches
- Best Sellers Rank: #1,715,003 in Books (See Top 100 in Books)
- #15 in Linux Applications
- #410 in Computer Operating Systems (Books)
- #6,283 in Computer Software (Books)
- Customer Reviews:
Important information
To report an issue with this product, click here.
About the author

Discover more of the author’s books, see similar authors, read author blogs and more
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonRead reviews that mention
-
Top reviews
Top reviews from the United States
There was a problem filtering reviews right now. Please try again later.
I do wish it had more information about shell scripts, but that's about it.
The book is divided into four major parts: Getting Started, Development Tools and Environment, System Programming and Development Libraries.
Part 1 - Getting Started, is a very high-level overview of Linux itself. The three chapters cover barely 20 pages, and discuss the history of Linux, its licensing, and the online documentation.
Part 2 - Development Tools and Environment gets more detailed, but ends up as a medium-level view of what tools you might use to actually create and debug your application. Six chapters covering about 75 pages discuss editors (Emacs and vi), make, the GNU debugger gdb, tracing, gcc options, glibc, memory debugging tools, libraries, and the environment. Each chapter feels a little light-weight except for the one on memory debugging tools.
If the first two parts seemed to just skim the surface somewhat, Part 3 - System Programming definitely dives into the deep end of the pool. Part 3 has 13 chapters and covers 450 pages, almost two-thirds of the total book. My major complaint with Part 3 is that related chapters appear to be separated by others. Five major groups of functionality are covered.
The Unix/Linux process model is explained in detail in Chapter 10, and should be followed by chapter 15, which goes into job control. File handling is introduced in chapter 11, expanded in chapter 13, and directory handling is covered in chapter 14. Interprocess communication is discussed in chapters 12 - Signal Processing (discussing simple semaphores) and chapter 17 - Networking with Sockets, which extends IPC across the network. User interfaces are covered in chapters 16 (terminals and pseudo-terminals), 20 (virtual consoles), and 21 (text-based interfaces for the Linux console). Timers, encryption, and writing secure programs are the topics of chapters 18, 19, and 22.
Finally, Part 4 covers the various development libraries commonly available to the programmer. Chapter 23 covers the ins and outs of string handling and regular expressions. Using S-Lang to handle the terminal is the main interest of the next chapter. Chapter 25 discusses database interfaces, specifically qdbm, which is licensed under the LGPL. Traditional option functions getopt and getopt_long and their cousin on steriods popt are detailed in the following chapter. The final two chapters cover dynamic loading of shared objects with the advantages that provides, and user identification and authentication, covering id-to-name translation, and Pluggable Authentication Modules (PAM).
This book has a lot of information packed within its covers, When programming, one needs a number of reference books at hand, and Linux Application Development should definitely be one of the handiest. My only concerns were how the first two parts seemed skimpy compared to the rest of the book, and the part on System Programming could have been laid out better. That said, Linux Application Development rates a 4 out of 5.
Are you a C programmer working on a unix box? And you have to port your application to linux? There can be understandable trepidation about migration. Because the biggest issue may not be the free linux versus a proprietary operating system. For application development, the cost of an operating system isn't usually a big deal. More important are the compiler and types of native library support you get. Hence the authors fill in a lot of practical details about linux. The book's title doesn't say so, but the language covered is C. Not Java or C++. Though in fact much of the book's remarks will also apply to C++. And there is no fancy GUI. The book goes back to the basics of C development.
Unix veterans will catch on quickly. The book's description of file handling, general I/O handling, sockets, directory operations and other issues is really no different than going to a given unix. Daresay that you'll be pleased to know that over 90% of your unix knowledge is eminently reusable. And the GNU C compiler used in the book should already be a close friend.
Granted that if you're porting an application specific to a unix, there might be low level unpleasantries. But hopefully, good design and having this book will mitigate the migration.
This is a high end reference that is light on screenshots (almost none), that has well written and annotated example code. It's reminiscent of the classic Advanced Unix Programming. With the exception that this book is larger and has better exposition. In particular this book will answer almost any question you have about file I/O, process management, and networking.
This is an excellent book. It gets my full recommendation.
This one, however, is just excellent. It's not narrow as some Linux books are, and it's not one of those ancient UNIX programming books.
80/20 rule applies to many things including learning. You'll be using just 20% of "linux programming knowledge" at least 80% of the time. This book carefully picks those 20%, just the "right stuff" and captures it beautifully.
And it's a hardcover too. Buy it.
The bookis aimed at three audiences: C programmers who need to know how to get to the Linux operating system, Unix programmers who need to make the transition to Linux (no they're not the same), Linux programmers who need to move upwards in their understanding of the operating system. It does these jobs very well. The authors each spent years at Red Hat developing their releases, have a throrough understanding of Linux and the ability to convey that information to the reader in a clear and understandable manner.
Amazon's database is a bit confused about the two editions of Linux Application Development. Both are hardcover, but the second edition was released in November, 2004. The version with a mostly white color is the second edition; the cover of the first edition is mostly yellow. Hopefully this will get fixed; in the mean time I suggest you look at Addison Wesley's site ([...]) for information on the second edition.
And if you have also "Advanced Programming in Unix Environment" the you have the complete bible to program in Linux Environment :)
A better alternative, I think, is "Linux Programming by Example: The Fundamentals" by Arnold Robbins. Arnold says in that book he plans to write more subsequent volumes on the subject.
