The GNU C Library
- 
Introduction 
- Getting Started
 - 
Standards and Portability 
- ANSI C
 - POSIX (The Portable Operating System Interface)
 - Berkeley Unix
 - SVID (The System V Interface Description)
 
 - 
Using the Library 
- Header Files
 - Macro Definitions of Functions
 - Reserved Names
 - Feature Test Macros
 
 - Roadmap to the Manual
 
 - 
Error Reporting 
- Checking for Errors
 - Error Codes
 - Error Messages
 
 - 
Memory Allocation 
- Dynamic Memory Allocation Concepts
 - Dynamic Allocation and C
 - 
Unconstrained Allocation 
- Basic Storage Allocation
 - 
Examples of 
malloc - 
Freeing Memory Allocated with 
malloc - Changing the Size of a Block
 - Allocating Cleared Space
 - 
Efficiency Considerations for 
malloc - Allocating Aligned Memory Blocks
 - Heap Consistency Checking
 - Storage Allocation Hooks
 - 
Statistics for Storage Allocation with 
malloc - 
Summary of 
malloc-Related Functions 
 - 
Obstacks 
- Creating Obstacks
 - Preparing for Using Obstacks
 - Allocation in an Obstack
 - Freeing Objects in an Obstack
 - Obstack Functions and Macros
 - Growing Objects
 - Extra Fast Growing Objects
 - Status of an Obstack
 - Alignment of Data in Obstacks
 - Obstack Chunks
 - Summary of Obstack Functions
 
 - 
Automatic Storage with Variable Size 
- 
allocaExample - 
Advantages of 
alloca - 
Disadvantages of 
alloca - GNU C Variable-Size Arrays
 
 - 
 - 
Relocating Allocator 
- Concepts of Relocating Allocation
 - Allocating and Freeing Relocatable Blocks
 
 - Memory Usage Warnings
 
 - 
Character Handling 
- Classification of Characters
 - Case Conversion
 
 - 
String and Array Utilities 
- Representation of Strings
 - String/Array Conventions
 - String Length
 - Copying and Concatenation
 - String/Array Comparison
 - Collation Functions
 - Search Functions
 - Finding Tokens in a String
 
 - 
Extended Characters 
- Introduction to Extended Characters
 - Locales and Extended Characters
 - Multibyte Characters
 - Wide Character Introduction
 - Conversion of Extended Strings
 - Multibyte Character Length
 - Conversion of Extended Characters One by One
 - Example of Character-by-Character Conversion
 - Multibyte Codes Using Shift Sequences
 
 - 
Locales and Internationalization 
- What Effects a Locale Has
 - Choosing a Locale
 - Categories of Activities that Locales Affect
 - How Programs Set the Locale
 - Standard Locales
 - 
Numeric Formatting 
- Generic Numeric Formatting Parameters
 - Printing the Currency Symbol
 - Printing the Sign of an Amount of Money
 
 
 - 
Searching and Sorting 
- Defining the Comparison Function
 - Array Search Function
 - Array Sort Function
 - Searching and Sorting Example
 
 - 
Pattern Matching 
- Wildcard Matching
 - 
Globbing 
- 
Calling 
glob - Flags for Globbing
 
 - 
Calling 
 - 
Regular Expression Matching 
- POSIX Regular Expression Compilation
 - Flags for POSIX Regular Expressions
 - Matching a Compiled POSIX Regular Expression
 - Subexpressions Match Results
 - Complications in Subexpression Matching
 - POSIX Regexp Matching Cleanup
 
 - 
Shell-Style Word Expansion 
- The Stages of Word Expansion
 - 
Calling 
wordexp - Flags for Word Expansion
 - 
wordexpExample 
 
 - 
Input/Output Overview 
- 
Input/Output Concepts 
- Streams and File Descriptors
 - File Position
 
 - 
File Names 
- Directories
 - File Name Resolution
 - File Name Errors
 - Portability of File Names
 
 
 - 
Input/Output Concepts 
 - 
Input/Output on Streams 
- Streams
 - Standard Streams
 - Opening Streams
 - Closing Streams
 - Simple Output by Characters or Lines
 - Character Input
 - Line-Oriented Input
 - 
Unreading 
- What Unreading Means
 - 
Using 
ungetcTo Do Unreading 
 - 
Formatted Output 
- Formatted Output Basics
 - Output Conversion Syntax
 - Table of Output Conversions
 - Integer Conversions
 - Floating-Point Conversions
 - Other Output Conversions
 - Formatted Output Functions
 - Dynamically Allocating Formatted Output
 - Variable Arguments Output Functions
 - Parsing a Template String
 - Example of Parsing a Template String
 
 - 
Customizing 
printf- Registering New Conversions
 - Conversion Specifier Options
 - Defining the Output Handler
 - 
printfExtension Example 
 - 
Formatted Input 
- Formatted Input Basics
 - Input Conversion Syntax
 - Table of Input Conversions
 - Numeric Input Conversions
 - String Input Conversions
 - Dynamically Allocating String Conversions
 - Other Input Conversions
 - Formatted Input Functions
 - Variable Arguments Input Functions
 
 - Block Input/Output
 - End-Of-File and Errors
 - Text and Binary Streams
 - File Positioning
 - Portable File-Position Functions
 - 
Stream Buffering 
- Buffering Concepts
 - Flushing Buffers
 - Controlling Which Kind of Buffering
 
 - Temporary Files
 - 
Other Kinds of Streams 
- String Streams
 - Obstack Streams
 - 
Programming Your Own Custom Streams 
- Custom Streams and Cookies
 - Custom Stream Hook Functions
 
 
 
 - 
Low-Level Input/Output 
- Opening and Closing Files
 - Input and Output Primitives
 - Setting the File Position of a Descriptor
 - Descriptors and Streams
 - 
Precautions for Mixing Streams and Descriptors 
- Linked Channels
 - Independent Channels
 - Cleaning Streams
 
 - Waiting for Input or Output
 - Control Operations on Files
 - Duplicating Descriptors
 - File Descriptor Flags
 - File Status Flags
 - File Locks
 - Interrupt-Driven Input
 
 - 
File System Interface 
- Working Directory
 - 
Accessing Directories 
- Format of a Directory Entry
 - Opening a Directory Stream
 - Reading and Closing a Directory Stream
 - Simple Program to List a Directory
 - Random Access in a Directory Stream
 
 - Hard Links
 - Symbolic Links
 - Deleting Files
 - Renaming Files
 - Creating Directories
 - 
File Attributes 
- What the File Attribute Values Mean
 - Reading the Attributes of a File
 - Testing the Type of a File
 - File Owner
 - The Mode Bits for Access Permission
 - How Your Access to a File is Decided
 - Assigning File Permissions
 - Testing Permission to Access a File
 - File Times
 
 - Making Special Files
 
 - 
Pipes and FIFOs 
- Creating a Pipe
 - Pipe to a Subprocess
 - FIFO Special Files
 - Atomicity of Pipe I/O
 
 - 
Sockets 
- Socket Concepts
 - Communication Styles
 - 
Socket Addresses 
- Address Formats
 - Setting a Socket's Address
 - Reading a Socket's Address
 
 - 
The File Namespace 
- File Namespace Concepts
 - Details of File Namespace
 - Example of File-Namespace Sockets
 
 - 
The Internet Namespace 
- Internet Socket Address Format
 - 
Host Addresses 
- Internet Host Addresses
 - Host Address Data Type
 - Host Address Functions
 - Host Names
 
 - Internet Ports
 - The Services Database
 - Byte Order Conversion
 - Protocols Database
 - Internet Socket Example
 
 - Other Namespaces
 - 
Opening and Closing Sockets 
- Creating a Socket
 - Closing a Socket
 - Socket Pairs
 
 - 
Using Sockets with Connections 
- Making a Connection
 - Listening for Connections
 - Accepting Connections
 - Who is Connected to Me?
 - 
Transferring Data 
- Sending Data
 - Receiving Data
 - Socket Data Options
 
 - Byte Stream Socket Example
 - Byte Stream Connection Server Example
 - Out-of-Band Data
 
 - 
Datagram Socket Operations 
- Sending Datagrams
 - Receiving Datagrams
 - Datagram Socket Example
 - Example of Reading Datagrams
 
 - 
The 
inetdDaemon- 
inetdServers - 
Configuring 
inetd 
 - 
 - 
Socket Options 
- Socket Option Functions
 - Socket-Level Options
 
 - Networks Database
 
 - 
Low-Level Terminal Interface 
- Identifying Terminals
 - I/O Queues
 - Two Styles of Input: Canonical or Not
 - 
Terminal Modes 
- Terminal Mode Data Types
 - Terminal Mode Functions
 - Setting Terminal Modes Properly
 - Input Modes
 - Output Modes
 - Control Modes
 - Local Modes
 - Line Speed
 - 
Special Characters 
- Characters for Input Editing
 - BSD Extensions to Editing Characters
 - Characters that Cause Signals
 - Special Characters for Flow Control
 - Other Special Characters
 
 - Noncanonical Input
 
 - Line Control Functions
 - Noncanonical Mode Example
 
 - 
Mathematics 
- Domain and Range Errors
 - Trigonometric Functions
 - Inverse Trigonometric Functions
 - Exponentiation and Logarithms
 - Hyperbolic Functions
 - 
Pseudo-Random Numbers 
- ANSI C Random Number Functions
 - BSD Random Number Functions
 
 
 - 
Low-Level Arithmetic Functions 
- "Not a Number" Values
 - Predicates on Floats
 - Absolute Value
 - Normalization Functions
 - Rounding and Remainder Functions
 - Integer Division
 - 
Parsing of Numbers 
- Parsing of Integers
 - Parsing of Floats
 
 
 - 
Date and Time 
- 
Processor Time 
- Basic CPU Time Inquiry
 - Detailed Elapsed CPU Time Inquiry
 
 - 
Calendar Time 
- Simple Calendar Time
 - High-Resolution Calendar
 - Broken-down Time
 - Formatting Date and Time
 - 
Specifying the Time Zone with 
TZ - Functions and Variables for Time Zones
 - Time Functions Example
 
 - Setting an Alarm
 - Sleeping
 - Resource Usage
 - Limiting Resource Usage
 - Process Priority
 
 - 
Processor Time 
 - 
Non-Local Exits 
- Introduction to Non-Local Exits
 - Details of Non-Local Exits
 - Non-Local Exits and Signals
 
 - 
Signal Handling 
- 
Basic Concepts of Signals 
- Some Kinds of Signals
 - Concepts of Signal Generation
 - How Signals Are Delivered
 
 - 
Standard Signals 
- Program Error Signals
 - Termination Signals
 - Alarm Signals
 - Asynchronous I/O Signals
 - Job Control Signals
 - Miscellaneous Signals
 - Nonstandard Signals
 - Signal Messages
 
 - 
Specifying Signal Actions 
- Basic Signal Handling
 - Advanced Signal Handling
 - 
Interaction of 
signalandsigaction - 
sigactionFunction Example - 
Flags for 
sigaction - Initial Signal Actions
 
 - 
Defining Signal Handlers 
- Signal Handlers That Return
 - Handlers That Terminate the Process
 - Nonlocal Control Transfer in Handlers
 - Signals Arriving While a Handler Runs
 - Signals Close Together Merge into One
 - Signal Handling and Nonreentrant Functions
 - 
Atomic Data Access and Signal Handling 
- Example of Problems with Non-Atomic Access
 - Atomic Types
 - Atomic Usage Patterns
 
 
 - Primitives Interrupted by Signals
 - 
Generating Signals 
- Signaling Yourself
 - Signaling Another Process
 - 
Permission for using 
kill - 
Using 
killfor Communication 
 - 
Blocking Signals 
- Why Blocking Signals is Useful
 - Signal Sets
 - Process Signal Mask
 - Blocking to Test for Delivery of a Signal
 - Blocking Signals for a Handler
 - Checking for Pending Signals
 - Remembering a Signal to Act On Later
 
 - 
Waiting for a Signal 
- 
Using 
pause - 
Problems with 
pause - 
Using 
sigsuspend 
 - 
Using 
 - 
BSD Signal Handling 
- POSIX and BSD Signal Facilities
 
 - 
BSD Function to Establish a Handler 
- BSD Functions for Blocking Signals
 - Using a Separate Signal Stack
 
 
 - 
Basic Concepts of Signals 
 - 
Process Startup and Termination 
- 
Program Arguments 
- Program Argument Syntax Conventions
 - Parsing Program Options
 - 
Example of Parsing Arguments with 
getopt - Parsing Long Options
 - Example of Parsing Long Options
 
 - 
Environment Variables 
- Environment Access
 - Standard Environment Variables
 
 - 
Program Termination 
- Normal Termination
 - Exit Status
 - Cleanups on Exit
 - Aborting a Program
 - Termination Internals
 
 
 - 
Program Arguments 
 - 
Child Processes 
- Running a Command
 - Process Creation Concepts
 - Process Identification
 - Creating a Process
 - Executing a File
 - Process Completion
 - Process Completion Status
 - BSD Process Wait Functions
 - Process Creation Example
 
 - 
Job Control 
- Concepts of Job Control
 - Job Control is Optional
 - Controlling Terminal of a Process
 - Access to the Controlling Terminal
 - Orphaned Process Groups
 - 
Implementing a Job Control Shell 
- Data Structures for the Shell
 - Initializing the Shell
 - Launching Jobs
 - Foreground and Background
 - Stopped and Terminated Jobs
 - Continuing Stopped Jobs
 - The Missing Pieces
 
 - 
Functions for Job Control 
- Identifying the Controlling Terminal
 - Process Group Functions
 - Functions for Controlling Terminal Access
 
 
 - 
Users and Groups 
- User and Group IDs
 - The Persona of a Process
 - Why Change the Persona of a Process?
 - How an Application Can Change Persona
 - Reading the Persona of a Process
 - Setting the User ID
 - Setting the Group IDs
 - Enabling and Disabling Setuid Access
 - Setuid Program Example
 - Tips for Writing Setuid Programs
 - Identifying Who Logged In
 - 
User Database 
- The Data Structure that Describes a User
 - Looking Up One User
 - Scanning the List of All Users
 - Writing a User Entry
 
 - 
Group Database 
- The Data Structure for a Group
 - Looking Up One Group
 - Scanning the List of All Groups
 
 - User and Group Database Example
 
 - 
System Information 
- Host Identification
 - Hardware/Software Type Identification
 
 - 
System Configuration Parameters 
- General Capacity Limits
 - Overall System Options
 - Which Version of POSIX is Supported
 - 
Using 
sysconf- 
Definition of 
sysconf - 
Constants for 
sysconfParameters - 
Examples of 
sysconf 
 - 
Definition of 
 - Minimum Values for General Capacity Limits
 - Limits on File System Capacity
 - Optional Features in File Support
 - Minimum Values for File System Limits
 - 
Using 
pathconf - Utility Program Capacity Limits
 - Minimum Values for Utility Limits
 - String-Valued Parameters
 
 - 
C Language Facilities Implemented By the Library 
- Explicitly Checking Internal Consistency
 - 
Variadic Functions 
- Why Variadic Functions are Used
 - 
How Variadic Functions are Defined and Used 
- Syntax for Variable Arguments
 - Receiving the Argument Values
 - How Many Arguments Were Supplied
 - Calling Variadic Functions
 - Argument Access Macros
 
 - 
Example of a Variadic Function 
- Old-Style Variadic Functions
 
 
 - Null Pointer Constant
 - Important Data Types
 - 
Data Type Measurements 
- Computing the Width of an Integer Data Type
 - Range of an Integer Type
 - 
Floating Type Macros 
- Floating Point Representation Concepts
 - Floating Point Parameters
 - IEEE Floating Point
 
 - Structure Field Offset Measurement
 
 
 - Summary of Library Facilities
 - 
Library Maintenance 
- How to Install the GNU C Library
 - Reporting Bugs
 - Adding New Functions
 - 
Porting the GNU C Library 
- The Layout of the `sysdeps' Directory Hierarchy
 - Porting the GNU C Library to Unix Systems
 
 - Contributors to the GNU C Library
 
 - 
GNU LIBRARY GENERAL PUBLIC LICENSE 
- Preamble
 - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 - How to Apply These Terms to Your New Libraries
 
 - Concept Index
 - Type Index
 - Function and Macro Index
 - Variable and Constant Macro Index
 - Program and File Index