Home Page Icon
Home Page
Table of Contents for
2. Development Tools and Environment
Close
2. Development Tools and Environment
by Erik W. Troan, Michael K. Johnson
Linux Application Development, Second Edition
Copyright
Dedication
List of Tables
Code Examples
Preface
Second Edition
Acknowledgments
1. Getting Started
1. History of Linux Development
1.1. A Short History of Free Unix Software
1.2. Development of Linux
1.3. Notional Lineage of Unix Systems
1.4. Linux Lineage
2. Licenses and Copyright
2.1. Copyright
2.2. Licensing
2.3. Free Software Licenses
2.3.1. The GNU General Public License
2.3.2. The GNU Library General Public License
2.3.3. MIT/X/BSD-Style Licenses
2.3.4. Old BSD-Style Licenses
2.3.5. Artistic License
2.3.6. License Incompatibilities
3. Online System Documentation
3.1. The man Pages
3.2. The Info Pages
3.3. Other Documentation
2. Development Tools and Environment
4. Development Tools
4.1. Editors
4.1.1. Emacs
4.1.2. vi
4.2. Make
4.2.1. Complex Command Lines
4.2.2. Variables
4.2.3. Suffix Rules
4.3. The GNU Debugger
4.4. Tracing Program Actions
5. gcc Options and Extensions
5.1. gcc Options
5.2. Header Files
5.2.1. long long
5.2.2. Inline Functions
5.2.3. Alternative Extended Keywords
5.2.4. Attributes
6. The GNU C Library
6.1. Feature Selection
6.2. POSIX Interfaces
6.2.1. POSIX Required Types
6.2.2. Discovering Run-Time Capabilities
6.2.3. Finding and Setting Basic System Information
6.3. Compatibility
7. Memory Debugging Tools
7.1. Buggy Code
7.2. Memory-Checking Tools Included in glibc
7.2.1. Finding Memory Heap Corruption
7.2.2. Using mtrace() to Track Allocations
7.3. Finding Memory Leaks with mpr
7.4. Investigating Memory Errors with Valgrind
7.5. Electric Fence
7.5.1. Using Electric Fence
7.5.2. Memory Alignment
7.5.3. Other Features
7.5.4. Limitations
7.5.5. Resource Consumption
8. Creating and Using Libraries
8.1. Static Libraries
8.2. Shared Libraries
8.3. Designing Shared Libraries
8.3.1. Managing Compatibility
8.3.2. Incompatible Libraries
8.3.3. Designing Compatible Libraries
8.4. Building Shared Libraries
8.5. Installing Shared Libraries
8.5.1. Example
8.6. Using Shared Libraries
8.6.1. Using Noninstalled Libraries
8.6.2. Preloading Libraries
9. Linux System Environment
9.1. The Process Environment
9.2. Understanding System Calls
9.2.1. System Call Limitations
9.2.2. System Call Return Codes
9.2.3. Using System Calls
9.2.4. Common Error Return Codes
9.3. Finding Header and Library Files
3. System Programming
10. The Process Model
10.1. Defining a Process
10.1.1. Complicating Things with Threads
10.1.2. The Linux Approach
10.2. Process Attributes
10.2.1. The pid and Parentage
10.2.2. Credentials
10.2.3. The filesystem uid
10.2.4. User and Group ID Summary
10.3. Process Information
10.3.1. Program Arguments
10.3.2. Resource Usage
10.3.3. Establishing Usage Limits
10.4. Process Primitives
10.4.1. Having Children
10.4.2. Watching Your Children Die
10.4.3. Running New Programs
10.4.4. Faster Process Creation with vfork()
10.4.5. Killing Yourself
10.4.6. Killing Others
10.4.7. Dumping Core
10.5. Simple Children
10.5.1. Running and Waiting with system()
10.5.2. Reading or Writing from a Process
10.6. Sessions and Process Groups
10.6.1. Sessions
10.6.2. Controlling Terminal
10.6.3. Process Groups
10.6.4. Orphaned Process Groups
10.7. Introduction to ladsh
10.7.1. Running External Programs with ladsh
10.8. Creating Clones
11. Simple File Handling
11.1. The File Mode
11.1.1. File Access Permissions
11.1.2. File Permission Modifiers
11.1.3. File Types
11.1.4. The Process’s umask
11.2. Basic File Operations
11.2.1. File Descriptors
11.2.2. Closing Files
11.2.3. Opening Files in the File System
11.2.4. Reading, Writing, and Moving Around
11.2.5. Partial Reads and Writes
11.2.6. Shortening Files
11.2.7. Synchronizing Files
11.2.8. Other Operations
11.3. Querying and Changing Inode Information
11.3.1. Finding Inode Information
11.3.2. A Simple Example of stat()
11.3.3. Easily Determining Access Rights
11.3.4. Changing a File’s Access Permissions
11.3.5. Changing a File’s Owner and Group
11.3.6. Changing a File’s Timestamps
11.3.7. Ext3 Extended Attributes
11.4. Manipulating Directory Entries
11.4.1. Creating Device and Named Pipe Entries
11.4.2. Creating Hard Links
11.4.3. Using Symbolic Links
11.4.4. Removing Files
11.4.5. Renaming Files
11.5. Manipulating File Descriptors
11.5.1. Changing the Access Mode for an Open File
11.5.2. Modifiying the close-on-exec Flag
11.5.3. Duplicating File Descriptors
11.6. Creating Unnamed Pipes
11.7. Adding Redirection to ladsh
11.7.1. The Data Structures
11.7.2. Changing the Code
12. Signal Processing
12.1. Signal Concepts
12.1.1. Life Cycle of a Signal
12.1.2. Simple Signals
12.1.3. Reliable Signals
12.1.4. Signals and System Calls
12.2. The Linux (and POSIX) Signal API
12.2.1. Sending Signals
12.2.2. Using sigset_t
12.2.3. Catching Signals
12.2.4. Manipulating a Process’s Signal Mask
12.2.5. Finding the Set of Pending Signals
12.2.6. Waiting for Signals
12.3. Available Signals
12.3.1. Describing Signals
12.4. Writing Signal Handlers
12.5. Reopening Log Files
12.6. Real-Time Signals
12.6.1. Signal Queueing and Ordering
12.7. Learning About a Signal
12.7.1. Getting a Signal’s Context
12.7.2. Sending Data with a Signal
13. Advanced File Handling
13.1. Input and Output Multiplexing
13.1.1. Nonblocking I/O
13.1.2. Multiplexing with poll()
13.1.3. Multiplexing with select()
13.1.4. Comparing poll() and select()
13.1.5. Multiplexing with epoll
13.1.6. Comparing poll() and epoll
13.2. Memory Mapping
13.2.1. Page Alignment
13.2.2. Establishing Memory Mappings
13.2.3. Unmapping Regions
13.2.4. Syncing Memory Regions to Disk
13.2.5. Locking Memory Regions
13.3. File Locking
13.3.1. Lock Files
13.3.2. Record Locking
13.3.3. Mandatory Locks
13.3.4. Leasing a File
13.4. Alternatives to read() and write()
13.4.1. Scatter/Gather Reads and Writes
13.4.2. Ignoring the File Pointer
14. Directory Operations
14.1. The Current Working Directory
14.1.1. Finding the Current Working Directory
14.1.2. The . and .. Special Files
14.1.3. Changing the Current Directory
14.2. Changing the Root Directory
14.3. Creating and Removing Directories
14.3.1. Creating New Directories
14.3.2. Removing Directories
14.4. Reading a Directory’s Contents
14.4.1. Starting Over
14.5. File Name Globbing
14.5.1. Use a Subprocess
14.5.2. Internal Globbing
14.6. Adding Directories and Globbing to ladsh
14.6.1. Adding cd and pwd
14.6.2. Adding File Name Globbing
14.7. Walking File System Trees
14.7.1. Using ftw()
14.7.2. File Tree Walks with nftw()
14.7.3. Implementing find
14.8. Directory Change Notification
15. Job Control
15.1. Job Control Basics
15.1.1. Restarting Processes
15.1.2. Stopping Processes
15.1.3. Handling Job Control Signals
15.2. Job Control in ladsh
16. Terminals and Pseudo Terminals
16.1. tty Operations
16.1.1. Terminal Utility Functions
16.1.2. Controlling Terminals
16.1.3. Terminal Ownership
16.1.4. Recording with utempter
16.1.5. Recording by Hand
16.2. termios Overview
16.3. termios Examples
16.3.1. Passwords
16.3.2. Serial Communications
16.4. termios Debugging
16.5. termios Reference
16.5.1. Functions
16.5.2. Window Sizes
16.5.3. Flags
16.5.4. Input Flags
16.5.5. Output Flags
16.5.6. Control Flags
16.5.7. Control Characters
16.5.8. Local Flags
16.5.9. Controlling read()
16.6. Pseudo ttys
16.6.1. Opening Pseudo ttys
16.6.2. Opening Pseudo ttys the Easy Ways
16.6.3. Opening Pseudo ttys the Hard Ways
16.6.4. Pseudo tty Examples
17. Networking with Sockets
17.1. Protocol Support
17.1.1. Nice Networking
17.1.2. Real Networking
17.1.3. Making Reality Play Nice
17.1.4. Addresses
17.2. Utility Functions
17.3. Basic Socket Operations
17.3.1. Creating a Socket
17.3.2. Establishing Connections
17.3.3. Binding an Address to a Socket
17.3.4. Waiting for Connections
17.3.5. Connecting to a Server
17.3.6. Finding Connection Addresses
17.4. Unix Domain Sockets
17.4.1. Unix Domain Addresses
17.4.2. Waiting for a Connection
17.4.3. Connecting to a Server
17.4.4. Running the Unix Domain Examples
17.4.5. Unnamed Unix Domain Sockets
17.4.6. Passing File Descriptors
17.5. Networking Machines with TCP/IP
17.5.1. Byte Ordering
17.5.2. IPv4 Addressing
17.5.3. IPv6 Addressing
17.5.4. Manipulating IP Addresses
17.5.5. Turning Names into Addresses
17.5.6. Turning Addresses into Names
17.5.7. Listening for TCP Connections
17.5.8. TCP Client Applications
17.6. Using UDP Datagrams
17.6.1. Creating a UDP Socket
17.6.2. Sending and Receiving Datagrams
17.6.3. A Simple tftp Server
17.7. Socket Errors
17.8. Legacy Networking Functions
17.8.1. IPv4 Address Manipulation
17.8.2. Hostname Resolution
17.8.3. Legacy Host Information Lookup Example
17.8.4. Looking Up Port Numbers
18. Time
18.1. Telling Time and Dates
18.1.1. Representing Time
18.1.2. Converting, Formatting, and Parsing Times
18.1.3. The Limits of Time
18.2. Using Timers
18.2.1. Sleeping
18.2.2. Interval Timers
19. Random Numbers
19.1. Pseudo-Random Numbers
19.2. Cryptography and Random Numbers
20. Programming Virtual Consoles
20.1. Getting Started
20.2. Beeping
20.3. Determining Whether the Terminal Is a VC
20.4. Finding the Current VC
20.5. Managing VC Switching
20.6. Example: The open Command
21. The Linux Console
21.1. Capability Databases
21.2. Glyphs, Characters, and Maps
21.3. Linux Console Capabilities
21.3.1. Control Characters
21.3.2. Escape Sequences
21.3.3. Testing Sequences
21.3.4. Complex Escape Sequences
21.4. Direct Screen Writing
22. Writing Secure Programs
22.1. When Security Matters
22.1.1. When Security Fails
22.2. Minimizing the Opportunity for Attack
22.2.1. Giving Up Permissions
22.2.2. Getting a Helping Hand
22.2.3. Restricting File System Access
22.3. Common Security Holes
22.3.1. Buffer Overflows
22.3.2. Parsing Filenames
22.3.3. Environment Variables
22.3.4. Running the Shell
22.3.5. Creating Temporary Files
22.3.6. Race Conditions and Signal Handlers
22.3.7. Closing File Descriptors
22.4. Running as a Daemon
4. Development Libraries
23. String Matching
23.1. Globbing Arbitrary Strings
23.2. Regular Expressions
23.2.1. Linux Regular Expressions
23.2.2. Regular Expression Matching
23.2.3. A Simple grep
24. Terminal Handling with S-Lang
24.1. Input Handling
24.1.1. Initializing S-Lang Input Handling
24.1.2. Restoring the Terminal State
24.1.3. Reading Characters from the Terminal
24.1.4. Checking for Pending Input
24.2. Output Handling
24.2.1. Initializing Screen Management
24.2.2. Updating the Display
24.2.3. Moving the Cursor
24.2.4. Finishing Screen Management
24.2.5. Skeleton Screen Management
24.2.6. Switching Character Sets
24.2.7. Writing to the Screen
24.2.8. Drawing Lines and Boxes
24.2.9. Using Color
25. A Hashed Database Library
25.1. Overview
25.2. Basic Operations
25.2.1. Opening a qdbm File
25.2.2. Closing a Database
25.2.3. Obtaining the File Descriptor
25.2.4. Syncing the Database
25.3. Reading Records
25.3.1. Reading a Particular Record
25.3.2. Reading Records Sequentially
25.4. Modifying the Database
25.4.1. Adding Records
25.4.2. Removing Records
25.5. Example
26. Parsing Command-Line Options
26.1. The Option Table
26.1.1. Defining the Options
26.1.2. Nesting Option Tables
26.2. Using the Option Table
26.2.1. Creating a Context
26.2.2. Parsing the Command Line
26.2.3. Leftover Arguments
26.2.4. Automatic Help Messages
26.3. Using Callbacks
26.4. Error Handling
26.5. Option Aliasing
26.5.1. Specifying Aliases
26.5.2. Enabling Aliases
26.6. Parsing Argument Strings
26.7. Handling Extra Arguments
26.8. Sample Application
27. Dynamic Loading at Run Time
27.1. The dl Interface
27.1.1. Example
28. User Identification and Authentication
28.1. ID-to-Name Translation
28.1.1. Example: The id Command
28.2. Pluggable Authentication Modules
28.2.1. PAM Conversations
28.2.2. PAM Actions
Appendices
A. Header Files
B. ladsh Source Code
Glossary
Bibliography
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
3. Online System Documentation
Next
Next Chapter
4. Development Tools
Part 2. Development Tools and Environment
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset