You are previewing Beginning Linux Programming, 4th Edition.
O'Reilly logo
Beginning Linux Programming, 4th Edition

Book Description

Beginning Linux Programming, Fourth Edition continues its unique approach to teaching UNIX programming in a simple and structured way on the Linux platform. Through the use of detailed and realistic examples, students learn by doing, and are able to move from being a Linux beginner to creating custom applications in Linux. The book introduces fundamental concepts beginning with the basics of writing Unix programs in C, and including material on basic system calls, file I/O, interprocess communication (for getting programs to work together), and shell programming. Parallel to this, the book introduces the toolkits and libraries for working with user interfaces, from simpler terminal mode applications to X and GTK+ for graphical user interfaces. Advanced topics are covered in detail such as processes, pipes, semaphores, socket programming, using MySQL, writing applications for the GNOME or the KDE desktop, writing device drivers, POSIX Threads, and kernel programming for the latest Linux Kernel.

Table of Contents

  1. Cover
  2. Title Page
  3. Copyright
  4. About the Authors
  5. Credits
  6. Acknowledgments
  7. Foreword
  8. Introduction
    1. Who’s This Book For?
    2. What’s Covered in the Book
    3. What You Need to Use This Book
    4. Source Code
    5. Conventions
    6. Errata
    7. p2p.wrox.com
  9. Chapter 1: Getting Started
    1. An Introduction to UNIX, Linux, and GNU
    2. Programming Linux
    3. Getting Help
    4. Summary
  10. Chapter 2: Shell Programming
    1. Why Program with a Shell?
    2. A Bit of Philosophy
    3. What Is a Shell?
    4. Pipes and Redirection
    5. The Shell as a Programming Language
    6. Shell Syntax
    7. Going Graphical — The dialog Utility
    8. Putting It All Together
    9. Summary
  11. Chapter 3: Working with Files
    1. Linux File Structure
    2. System Calls and Device Drivers
    3. Library Functions
    4. Low-Level File Access
    5. The Standard I/O Library
    6. Formatted Input and Output
    7. File and Directory Maintenance
    8. Scanning Directories
    9. Errors
    10. The /proc File System
    11. Advanced Topics: fcntl and mmap
    12. Summary
  12. Chapter 4: The Linux Environment
    1. Program Arguments
    2. Environment Variables
    3. Time and Date
    4. Temporary Files
    5. User Information
    6. Host Information
    7. Logging
    8. Resources and Limits
    9. Summary
  13. Chapter 5: Terminals
    1. Reading from and Writing to the Terminal
    2. Talking to the Terminal
    3. The Terminal Driver and the General Terminal Interface
    4. The termios Structure
    5. Terminal Output
    6. Detecting Keystrokes
    7. Summary
  14. Chapter 6: Managing Text-Based Screens with curses
    1. Compiling with curses
    2. Curses Terminology and Concepts
    3. The Screen
    4. The Keyboard
    5. Windows
    6. Subwindows
    7. The Keypad
    8. Using Color
    9. Pads
    10. The CD Collection Application
    11. Summary
  15. Chapter 7: Data Management
    1. Managing Memory
    2. File Locking
    3. Databases
    4. The CD Application
    5. Summary
  16. Chapter 8: MySQL
    1. Installation
    2. MySQL Administration
    3. Accessing MySQL Data from C
    4. The CD Database Application
    5. Summary
  17. Chapter 9: Development Tools
    1. Problems of Multiple Source Files
    2. The make Command and Makefiles
    3. Source Code Control
    4. Writing a Manual Page
    5. Distributing Software
    6. RPM Packages
    7. Other Package Formats
    8. Development Environments
    9. Summary
  18. Chapter 10: Debugging
    1. Types of Errors
    2. General Debugging Techniques
    3. Debugging with gdb
    4. More Debugging Tools
    5. Assertions
    6. Memory Debugging
    7. Summary
  19. Chapter 11: Processes and Signals
    1. What Is a Process?
    2. Process Structure
    3. Starting New Processes
    4. Signals
    5. Summary
  20. Chapter 12: POSIX Threads
    1. What Is a Thread?
    2. Advantages and Drawbacks of Threads
    3. A First Threads Program
    4. Simultaneous Execution
    5. Synchronization
    6. Thread Attributes
    7. Canceling a Thread
    8. Threads in Abundance
    9. Summary
  21. Chapter 13: Inter-Process Communication: Pipes
    1. What Is a Pipe?
    2. Process Pipes
    3. Sending Output to popen
    4. The Pipe Call
    5. Parent and Child Processes
    6. Named Pipes: FIFOs
    7. The CD Database Application
    8. Summary
  22. Chapter 14: Semaphores, Shared Memory, and Message Queues
    1. Semaphores
    2. Shared Memory
    3. Message Queues
    4. The CD Database Application
    5. IPC Status Commands
    6. Summary
  23. Chapter 15: Sockets
    1. What Is a Socket?
    2. Socket Connections
    3. Network Information
    4. Multiple Clients
    5. Datagrams
    6. Summary
  24. Chapter 16: Programming GNOME Using GTK+
    1. Introducing X
    2. Introducing GTK+
    3. Events, Signals, and Callbacks
    4. Packing Box Widgets
    5. GTK+ Widgets
    6. GNOME Widgets
    7. GNOME Menus
    8. Dialogs
    9. CD Database Application
    10. Summary
  25. Chapter 17: Programming KDE Using Qt
    1. Introducing KDE and Qt
    2. Installing Qt
    3. Signals and Slots
    4. Qt Widgets
    5. Dialogs
    6. Menus and Toolbars with KDE
    7. CD Database Application Using KDE/Qt
    8. Summary
  26. Chapter 18: Standards for Linux
    1. The C Programming Language
    2. Interfaces and the Linux Standards Base
    3. The Filesystem Hierarchy Standard
    4. Further Reading about Standards
    5. Summary
  27. Index
  28. Advertisement
  29. Wiley End User License Agreement