Linux Application Development by Example
Book 1
Book 2
Book 3
Book 1
Book 2
Book 3
Book 1
Book 2
Book 3
Book 1
Book 2
Book 3
Home > Computing and Information Technology > Operating systems > Open source and other operating systems > Linux > Linux Application Development by Example
Linux Application Development by Example

Linux Application Development by Example


     0     
5
4
3
2
1



Out of Stock


Notify me when this book is in stock
X
About the Book

Unlock the secrets of Linux system programming and take your coding skills to the next level

  • Do you use Linux, but not really understand it?
  • Have you ever wondered how ls -l knows everything it does?
  • Could you explain to a coworker why ls and find can be external commands but cd and umask must be built into the shell?

The answers to these questions, and more, are in Linux Application Development by Example, Second Edition! This book tells you exactly what you need to know--no more and no less--about the fundamental Linux system programming APIs.

Following the latest POSIX standard, author Arnold Robbins explains how the basic file, process, IPC and networking APIs work. When possible, he demonstrates the use of the APIs with code drawn from real programs (V7 Unix, BSD Unix, and GNU), and when that's not possible, he provides small, clearly documented and annotated, standalone example programs of his own. All code presented in the book is available for download, so you can compile, run, and modify the programs yourself.

Robbins focuses on both high-level principles and "under the hood" techniques. Along the way, he carefully addresses real-world issues like performance, portability, and robustness.

Each chapter closes with exercises, ranging from coding problems to thought experiments, to help you cement your understanding of the material covered, and all chapters have been thoroughly revised and updated for this edition, along with two chapters new in this edition.

  • Memory management
  • File I/O
  • File metadata
  • Processes, Users and groups
  • Sorting and searching
  • Argument parsing
  • Extended interfaces
  • Signals
  • Internationalization
  • Basic Networking
  • Debugging
  • And more!

Just learning to program? Switching from Windows or macOS? Already developing with Linux but interested in exploring the system call interface further? No matter which, quickly and directly, this book will help you master the fundamentals needed to build serious Linux software.

"It's rare that I read a programming book and find myself enjoying it. I enjoyed going through this manuscript, to the point where I would be surprised that a couple hours would go by while I was absorbed in the topics.... It deserves to sit on my shelf alongside other classics."
--Matthew Helmke, Linux author and consultant

With a Foreword by Chet Ramey, maintainer of the Bash shell

Register your book for convenient access to downloads, updates, and/or corrections as they become available. See inside book for details.



Table of Contents:

Foreword xv
Preface xvii

Part I: Files and Users 1

Chapter 1: Introduction 3
1.1 The Linux/Unix File Model 3
1.2 The Linux/Unix Process Model 7
1.3 Standard C versus Original C 9
1.4 Why GNU Programs Are Better 13
1.5 Portability Revisited 17
1.6 Some Words about Coding Style 18
1.7 Artificial Intelligence Isn't Intelligent 19
1.8 Suggested Reading 19
1.9 Summary 20
Exercises 21

Chapter 2: Arguments, Options, and the Environment 23
2.1 Option and Argument Conventions 23
2.2 Basic Command-Line Processing 26
2.3 Option Parsing: getopt() and getopt_long() 28
2.4 The Environment 37
2.5 Summary 49
Exercises 49

Chapter 3: User-Level Memory Management 51
3.1 Linux/Unix Address Space 51
3.2 Memory Allocation 55
3.3 Summary 76
Exercises 77

Chapter 4: Files and File I/O 79
4.1 Introducing the Linux/Unix I/O Model 79
4.2 Presenting a Basic Program Structure 79
4.3 Determining What Went Wrong 81
4.4 Doing Input and Output 87
4.5 Random Access: Moving Around within a File 96
4.6 Creating Files 101
4.7 Forcing Data to Disk 106
4.8 Setting File Length 107
4.9 Summary 108
Exercises 109

Chapter 5: Directories and File Metadata 111
5.1 Considering Directory Contents 111
5.2 Creating and Removing Directories 121
5.3 Reading Directories 123
5.4 Obtaining Information about Files 130
5.5 Avoiding Race Conditions: openat() and Friends 144
5.6 Changing Ownership, Permission, and Modification Times 145
5.7 Summary 151
Exercises 153

Chapter 6: General Library Interfaces--Part 1 155
6.1 Times and Dates 155
6.2 Sorting and Searching Functions 171
6.3 User and Group Names 190
6.4 Terminals: isatty() 196
6.5 Suggested Reading 196
6.6 Summary 197
Exercises 198

Chapter 7: Putting It All Together: ls 201
7.1 V7 ls Options 201
7.2 V7 ls Code 202
7.3 Summary 218
Exercises 218

Chapter 8: Filesystems and Directory Walks 221
8.1 Mounting and Unmounting Filesystems 221
8.2 Files for Filesystem Administration 228
8.3 Retrieving Per-Filesystem Information 234
8.4 Moving Around in the File Hierarchy 247
8.5 Processing a File Hierarchy: GNU du 261
8.6 Changing the Root Directory: chroot() 269
8.7 Summary 270
Exercises 271

Part II: Processes, Networking, and Internationalization 273

Chapter 9: Process Management and Pipes 275
9.1 Process Creation and Management 275
9.2 Process Groups 300
9.3 Basic Interprocess Communication: Pipes and FIFOs 302
9.4 File Descriptor Management 307
9.5 Example: Two-Way Pipes in gawk 323
9.6 Suggested Reading 327
9.7 Summary 328
Exercises 330

Chapter 10: Signals 333
10.1 Introduction 333
10.2 Signal Actions 333
10.3 Standard C Signals: signal() and raise() 334
10.4 Signal Handlers in Action 337
10.5 The System V Release 3 Signal APIs: sigset() et al. 349
10.6 POSIX Signals 350
10.7 Signals for Interprocess Communication 360
10.8 Important Special-Purpose Signals 363
10.9 Signals across fork() and exec() 378
10.10 Summary 379
Exercises 381

Chapter 11: Permissions and User and Group ID Numbers 383
11.1 Checking Permissions 383
11.2 Retrieving User and Group IDs 385
11.3 Checking as the Real User: access() 388
11.4 Setting Extra Permission Bits for Directories 391
11.5 Setting Real and Effective IDs 393
11.6 Working with All Three IDs: getresuid() and setresuid() (Linux) 398
11.7 Crossing a Security Minefield: Setuid root 399
11.8 Suggested Reading 400
11.9 Summary 401
Exercises 403

Chapter 12: Resource Limits 405
12.1 Introduction 405
12.2 System Limits: sysconf(), pathconf(), and fpathconf() 405
12.3 Getting Configuration String Variables: confstr() 411
12.4 Basic Process Limits: ulimit() 413
12.5 Hard and Soft Limits: getrlimit() and setrlimit() 414
12.6 Summary 417
Exercises 418

Chapter 13: General Library Interfaces--Part 2 419
13.1 Assertion Statements: assert() 419
13.2 Low-Level Memory: The memXXX() Functions 423
13.3 Temporary Files 426
13.4 Committing Suicide: abort() 434
13.5 Nonlocal Gotos 435
13.6 Pseudorandom Numbers 442
13.7 Metacharacter Expansions 450
13.8 Regular Expressions 459
13.9 Suggested Reading 467
13.10 Summary 468
Exercises 469

Chapter 14: Sockets and Basic Networking 473
14.1 Introduction, with a Little Bit of History 473
14.2 Networking Technologies 474
14.3 Internet Building Blocks 474
14.4 Networking and Client/Server 477
14.5 Basic Structure of a Server Program 478
14.6 Basic Structure of a Client Program 488
14.7 Specialized Send and Receive Functions 492
14.8 Handling Multiple Open Connections: select() 494
14.9 pselect(): A Smarter Version of select() 501
14.10 Unix-Domain Sockets 502
14.11 Suggested Reading 502
14.12 Summary 503
Exercises 504

Chapter 15: Internationalization and Localization 507
15.1 Introduction 507
15.2 Locales and the C Library 508
15.3 Dynamic Translation of Program Messages 526
15.4 Can You Spell That for Me, Please? 540
15.5 Suggested Reading 553
15.6 Summary 553
Exercises 555

Chapter 16: Extended Interfaces 557
16.1 Allocating Aligned Memory: posix_memalign() and memalign() 557
16.2 Locking Files 558
16.3 More Precise Times 567
16.4 Advanced Searching with Binary Trees 575
16.5 Summary 586
Exercises 587

Part III: Debugging and Final Project 589

Chapter 17: Debugging 591
17.1 First Things First 591
17.2 Compilation for Debugging 592
17.3 GDB Basics 593
17.4 Programming for Debugging 606
17.5 Debugging Tools I: A Modern lint 632
17.6 Debugging Tools II: Memory Allocation Debuggers 633
17.7 Asking for Help 650
17.8 Software Testing 651
17.9 Debugging Rules 653
17.10 Suggested Reading 655
17.11 Summary 656
Exercises 657

Chapter 18: A Project That Ties Everything Together 659
18.1 Project Description 659
18.2 Suggested Reading 661

Part IV: Appendices 663

Appendix A: Teach Yourself Programming in Ten Years 665
Appendix B: Caldera Ancient UNIX License 671
Appendix C: GNU General Public License 673
Appendix D: License for the One True Awk 685
Appendix E: License for 4.4 BSD Code 687

Index 689



About the Author :

Arnold Robbins is a professional software engineer and technical author. He has been working with Unix systems of various sorts, GNU/Linux systems, C, C++, and all the other major Unix tools since 1980. As a long-time volunteer for the GNU project, he has been the maintainer of gawk (GNU Awk) for many years. In 2024, he was awarded the USENIX Lifetime Achievement Award ("The Flame") for his work on GNU Awk and for his numerous books on topics related to Unix and Linux.



Review :

Praise for the Second Edition

"This may be the most clearly written narrative-style coverage of the topic that I have encountered and one of the most complete that is not solely a reference work.

"[The book] has forced me to think differently about some of these topics and how they build on one another. It's almost like when I studied LISP way back when and it turned all my thinking about programming on its head. Thank you! It is a privilege to review this.

"This is one of the better-crafted tech books I've reviewed across two decades. The exercises consistently help the reader focus on specific things in the text and gently struggle and learn concepts that might otherwise slip through the cracks. I failed to find any exercise that I would delete and can't think of any I would add."
--Matthew Helmke, Linux author and consultant

Praise for the First Edition

"This is an excellent introduction to Linux programming. The topics are well chosen and lucidly presented. I learned things myself, especially about internationalization, and I've been at this for quite a while."
--Chet Ramey, coauthor and maintainer of the Bash shell

"This is a good introduction to Linux programming. Arnold's technique of showing how experienced programmers use the Linux programming interfaces is a nice touch, much more useful than the canned programming examples found in most books."
--Ulrich Drepper, project lead, GNU C library

"A gentle yet thorough introduction to the art of UNIX system programming, Linux Programming by Example uses code from a wide range of familiar programs to illustrate each concept it teaches. Readers will enjoy an interesting mix of in-depth API descriptions and portability guidelines, and will come away well prepared to begin reading and writing systems applications. Heartily recommended."
--Jim Meyering, coauthor and maintainer of the GNU Core Utility Programs


Best Sellers


Product Details
  • ISBN-13: 9780135325582
  • Publisher: Pearson Education (US)
  • Publisher Imprint: Addison Wesley
  • ISBN-10: 0135325587
  • Publisher Date: 13 Nov 2025


Similar Products

Add Photo
Add Photo

Customer Reviews

REVIEWS      0     
Click Here To Be The First to Review this Product
Linux Application Development by Example
Pearson Education (US) -
Linux Application Development by Example
Writing guidlines
We want to publish your review, so please:
  • keep your review on the product. Review's that defame author's character will be rejected.
  • Keep your review focused on the product.
  • Avoid writing about customer service. contact us instead if you have issue requiring immediate attention.
  • Refrain from mentioning competitors or the specific price you paid for the product.
  • Do not include any personally identifiable information, such as full names.

Linux Application Development by Example

Required fields are marked with *

Review Title*
Review
    Add Photo Add up to 6 photos
    Would you recommend this product to a friend?
    Tag this Book Read more
    Does your review contain spoilers?
    What type of reader best describes you?
    I agree to the terms & conditions
    You may receive emails regarding this submission. Any emails will include the ability to opt-out of future communications.

    CUSTOMER RATINGS AND REVIEWS AND QUESTIONS AND ANSWERS TERMS OF USE

    These Terms of Use govern your conduct associated with the Customer Ratings and Reviews and/or Questions and Answers service offered by Bookswagon (the "CRR Service").


    By submitting any content to Bookswagon, you guarantee that:
    • You are the sole author and owner of the intellectual property rights in the content;
    • All "moral rights" that you may have in such content have been voluntarily waived by you;
    • All content that you post is accurate;
    • You are at least 13 years old;
    • Use of the content you supply does not violate these Terms of Use and will not cause injury to any person or entity.
    You further agree that you may not submit any content:
    • That is known by you to be false, inaccurate or misleading;
    • That infringes any third party's copyright, patent, trademark, trade secret or other proprietary rights or rights of publicity or privacy;
    • That violates any law, statute, ordinance or regulation (including, but not limited to, those governing, consumer protection, unfair competition, anti-discrimination or false advertising);
    • That is, or may reasonably be considered to be, defamatory, libelous, hateful, racially or religiously biased or offensive, unlawfully threatening or unlawfully harassing to any individual, partnership or corporation;
    • For which you were compensated or granted any consideration by any unapproved third party;
    • That includes any information that references other websites, addresses, email addresses, contact information or phone numbers;
    • That contains any computer viruses, worms or other potentially damaging computer programs or files.
    You agree to indemnify and hold Bookswagon (and its officers, directors, agents, subsidiaries, joint ventures, employees and third-party service providers, including but not limited to Bazaarvoice, Inc.), harmless from all claims, demands, and damages (actual and consequential) of every kind and nature, known and unknown including reasonable attorneys' fees, arising out of a breach of your representations and warranties set forth above, or your violation of any law or the rights of a third party.


    For any content that you submit, you grant Bookswagon a perpetual, irrevocable, royalty-free, transferable right and license to use, copy, modify, delete in its entirety, adapt, publish, translate, create derivative works from and/or sell, transfer, and/or distribute such content and/or incorporate such content into any form, medium or technology throughout the world without compensation to you. Additionally,  Bookswagon may transfer or share any personal information that you submit with its third-party service providers, including but not limited to Bazaarvoice, Inc. in accordance with  Privacy Policy


    All content that you submit may be used at Bookswagon's sole discretion. Bookswagon reserves the right to change, condense, withhold publication, remove or delete any content on Bookswagon's website that Bookswagon deems, in its sole discretion, to violate the content guidelines or any other provision of these Terms of Use.  Bookswagon does not guarantee that you will have any recourse through Bookswagon to edit or delete any content you have submitted. Ratings and written comments are generally posted within two to four business days. However, Bookswagon reserves the right to remove or to refuse to post any submission to the extent authorized by law. You acknowledge that you, not Bookswagon, are responsible for the contents of your submission. None of the content that you submit shall be subject to any obligation of confidence on the part of Bookswagon, its agents, subsidiaries, affiliates, partners or third party service providers (including but not limited to Bazaarvoice, Inc.)and their respective directors, officers and employees.

    Accept


    Inspired by your browsing history


    Your review has been submitted!

    You've already reviewed this product!