2 * Introduction:: Purpose of the GNU C Library.
3 * Error Reporting:: How library functions report errors.
4 * Memory Allocation:: Allocating memory dynamically and
5 manipulating it via pointers.
6 * Character Handling:: Character testing and conversion functions.
7 * String and Array Utilities:: Utilities for copying and comparing strings
9 * Extended Characters:: Support for extended character sets.
10 * Locales:: The country and language can affect the
11 behavior of library functions.
12 * Message Translation:: How to make the program speak the user's
14 * Searching and Sorting:: General searching and sorting functions.
15 * Pattern Matching:: Matching shell ``globs'' and regular
17 * I/O Overview:: Introduction to the I/O facilities.
18 * I/O on Streams:: Hign-level, portable I/O facilities.
19 * Low-Level I/O:: Low-level, less portable I/O.
20 * File System Interface:: Functions for manipulating files.
21 * Pipes and FIFOs:: A simple interprocess communication
23 * Sockets:: A more complicated IPC mechanism, with
25 * Low-Level Terminal Interface:: How to change the characteristics of a
27 * Mathematics:: Math functions, useful constants, random
29 * Arithmetic:: Low level arithmetic functions.
30 * Date and Time:: Functions for getting the date and time and
31 formatting them nicely.
32 * Non-Local Exits:: Jumping out of nested function calls.
33 * Signal Handling:: How to send, block, and handle signals.
34 * Process Startup:: Writing the beginning and end of your
36 * Processes:: How to create processes and run other
38 * Job Control:: All about process groups and sessions.
39 * Name Service Switch:: Accessing system databases.
40 * Users and Groups:: How users are identified and classified.
41 * System Information:: Getting information about the hardware and
43 * System Configuration:: Parameters describing operating system
48 * POSIX Threads:: The standard threads library.
52 * Language Features:: C language features provided by the library.
53 * Library Summary:: A summary showing the syntax, header file,
54 and derivation of each library feature.
55 * Installation:: How to install the GNU C library.
56 * Maintenance:: How to enhance and port the GNU C Library.
57 * Contributors:: Who wrote what parts of the GNU C library.
58 * Copying:: The GNU Library General Public License says
59 how you can copy and share the GNU C Library.
63 * Concept Index:: Index of concepts and names.
64 * Type Index:: Index of types and type qualifiers.
65 * Function Index:: Index of functions and function-like macros.
66 * Variable Index:: Index of variables and variable-like macros.
67 * File Index:: Index of programs and files.
69 --- The Detailed Node Listing ---
73 * Getting Started:: What this manual is for and how to use it.
74 * Standards and Portability:: Standards and sources upon which the GNU
76 * Using the Library:: Some practical uses for the library.
77 * Roadmap to the Manual:: Overview of the remaining chapters in
80 Standards and Portability
82 * ISO C:: The international standard for the C
84 * POSIX:: The ISO/IEC 9945 (aka IEEE 1003) standards
85 for operating systems.
86 * Berkeley Unix:: BSD and SunOS.
87 * SVID:: The System V Interface Description.
88 * XPG:: The X/Open Portability Guide.
92 * Header Files:: How to include the header files in your
94 * Macro Definitions:: Some functions in the library may really
95 be implemented as macros.
96 * Reserved Names:: The C standard reserves some names for
97 the library, and some for users.
98 * Feature Test Macros:: How to control what names are defined.
102 * Checking for Errors:: How errors are reported by library functions.
103 * Error Codes:: Error code macros; all of these expand
104 into integer constant values.
105 * Error Messages:: Mapping error codes onto error messages.
109 * Memory Concepts:: An introduction to concepts and terminology.
110 * Dynamic Allocation and C:: How to get different kinds of allocation in C.
111 * Unconstrained Allocation:: The @code{malloc} facility allows fully general
113 * Allocation Debugging:: Finding memory leaks and not freed memory.
114 * Obstacks:: Obstacks are less general than malloc
115 but more efficient and convenient.
116 * Variable Size Automatic:: Allocation of variable-sized blocks
117 of automatic storage that are freed when the
118 calling function returns.
120 Unconstrained Allocation
122 * Basic Allocation:: Simple use of @code{malloc}.
123 * Malloc Examples:: Examples of @code{malloc}. @code{xmalloc}.
124 * Freeing after Malloc:: Use @code{free} to free a block you
125 got with @code{malloc}.
126 * Changing Block Size:: Use @code{realloc} to make a block
128 * Allocating Cleared Space:: Use @code{calloc} to allocate a
130 * Efficiency and Malloc:: Efficiency considerations in use of
132 * Aligned Memory Blocks:: Allocating specially aligned memory:
133 @code{memalign} and @code{valloc}.
134 * Malloc Tunable Parameters:: Use @code{mallopt} to adjust allocation
136 * Heap Consistency Checking:: Automatic checking for errors.
137 * Hooks for Malloc:: You can use these hooks for debugging
138 programs that use @code{malloc}.
139 * Statistics of Malloc:: Getting information about how much
140 memory your program is using.
141 * Summary of Malloc:: Summary of @code{malloc} and related functions.
145 * Tracing malloc:: How to install the tracing functionality.
146 * Using the Memory Debugger:: Example programs excerpts.
147 * Tips for the Memory Debugger:: Some more or less clever ideas.
148 * Interpreting the traces:: What do all these lines mean?
152 * Creating Obstacks:: How to declare an obstack in your program.
153 * Preparing for Obstacks:: Preparations needed before you can
155 * Allocation in an Obstack:: Allocating objects in an obstack.
156 * Freeing Obstack Objects:: Freeing objects in an obstack.
157 * Obstack Functions:: The obstack functions are both
158 functions and macros.
159 * Growing Objects:: Making an object bigger by stages.
160 * Extra Fast Growing:: Extra-high-efficiency (though more
161 complicated) growing objects.
162 * Status of an Obstack:: Inquiries about the status of an obstack.
163 * Obstacks Data Alignment:: Controlling alignment of objects in obstacks.
164 * Obstack Chunks:: How obstacks obtain and release chunks;
165 efficiency considerations.
166 * Summary of Obstacks::
168 Variable Size Automatic
170 * Alloca Example:: Example of using @code{alloca}.
171 * Advantages of Alloca:: Reasons to use @code{alloca}.
172 * Disadvantages of Alloca:: Reasons to avoid @code{alloca}.
173 * GNU C Variable-Size Arrays:: Only in GNU C, here is an alternative
174 method of allocating dynamically and
175 freeing automatically.
179 * Classification of Characters:: Testing whether characters are
180 letters, digits, punctuation, etc.
182 * Case Conversion:: Case mapping, and the like.
184 String and Array Utilities
186 * Representation of Strings:: Introduction to basic concepts.
187 * String/Array Conventions:: Whether to use a string function or an
188 arbitrary array function.
189 * String Length:: Determining the length of a string.
190 * Copying and Concatenation:: Functions to copy the contents of strings
192 * String/Array Comparison:: Functions for byte-wise and character-wise
194 * Collation Functions:: Functions for collating strings.
195 * Search Functions:: Searching for a specific element or substring.
196 * Finding Tokens in a String:: Splitting a string into tokens by looking
198 * Encode Binary Data:: Encoding and Decoding of Binary Data.
199 * Argz and Envz Vectors:: Null-separated string vectors.
201 Argz and Envz Vectors
203 * Argz Functions:: Operations on argz vectors.
204 * Envz Functions:: Additional operations on environment vectors.
208 * Extended Char Intro:: Multibyte codes versus wide characters.
209 * Locales and Extended Chars:: The locale selects the character codes.
210 * Multibyte Char Intro:: How multibyte codes are represented.
211 * Wide Char Intro:: How wide characters are represented.
212 * Wide String Conversion:: Converting wide strings to multibyte code
214 * Length of Char:: how many bytes make up one multibyte char.
215 * Converting One Char:: Converting a string character by character.
216 * Example of Conversion:: Example showing why converting
217 one character at a time may be useful.
218 * Shift State:: Multibyte codes with "shift characters".
222 * Effects of Locale:: Actions affected by the choice of
224 * Choosing Locale:: How the user specifies a locale.
225 * Locale Categories:: Different purposes for which you can
227 * Setting the Locale:: How a program specifies the locale
228 with library functions.
229 * Standard Locales:: Locale names available on all systems.
230 * Locale Information:: How to access the information for the locale.
231 * Formatting Numbers:: A dedicated function to format numbers.
235 * The Lame Way to Locale Data:: ISO C's @code{localeconv}.
236 * The Elegant and Fast Way:: X/Open's @code{nl_langinfo}.
238 The Lame Way to Locale Data
240 * General Numeric:: Parameters for formatting numbers and
242 * Currency Symbol:: How to print the symbol that identifies an
243 amount of money (e.g. @samp{$}).
244 * Sign of Money Amount:: How to print the (positive or negative) sign
245 for a monetary amount, if one exists.
249 * Message catalogs a la X/Open:: The @code{catgets} family of functions.
250 * The Uniforum approach:: The @code{gettext} family of functions.
252 Message catalogs a la X/Open
254 * The catgets Functions:: The @code{catgets} function family.
255 * The message catalog files:: Format of the message catalog files.
256 * The gencat program:: How to generate message catalogs files which
257 can be used by the functions.
258 * Common Usage:: How to use the @code{catgets} interface.
260 The Uniforum approach
262 * Message catalogs with gettext:: The @code{gettext} family of functions.
263 * Helper programs for gettext:: Programs to handle message catalogs
266 Message catalogs with gettext
268 * Translation with gettext:: What has to be done to translate a message.
269 * Locating gettext catalog:: How to determine which catalog to be used.
270 * Using gettextized software:: The possibilities of the user to influence
271 the way @code{gettext} works.
273 Searching and Sorting
275 * Comparison Functions:: Defining how to compare two objects.
276 Since the sort and search facilities
277 are general, you have to specify the
279 * Array Search Function:: The @code{bsearch} function.
280 * Array Sort Function:: The @code{qsort} function.
281 * Search/Sort Example:: An example program.
282 * Hash Search Function:: The @code{hsearch} function.
283 * Tree Search Function:: The @code{tsearch} function.
287 * Wildcard Matching:: Matching a wildcard pattern against a single string.
288 * Globbing:: Finding the files that match a wildcard pattern.
289 * Regular Expressions:: Matching regular expressions against strings.
290 * Word Expansion:: Expanding shell variables, nested commands,
291 arithmetic, and wildcards.
292 This is what the shell does with shell commands.
296 * Calling Glob:: Basic use of @code{glob}.
297 * Flags for Globbing:: Flags that enable various options in @code{glob}.
298 * More Flags for Globbing:: GNU specific extensions to @code{glob}.
302 * POSIX Regexp Compilation:: Using @code{regcomp} to prepare to match.
303 * Flags for POSIX Regexps:: Syntax variations for @code{regcomp}.
304 * Matching POSIX Regexps:: Using @code{regexec} to match the compiled
305 pattern that you get from @code{regcomp}.
306 * Regexp Subexpressions:: Finding which parts of the string were matched.
307 * Subexpression Complications:: Find points of which parts were matched.
308 * Regexp Cleanup:: Freeing storage; reporting errors.
312 * Expansion Stages:: What word expansion does to a string.
313 * Calling Wordexp:: How to call @code{wordexp}.
314 * Flags for Wordexp:: Options you can enable in @code{wordexp}.
315 * Wordexp Example:: A sample program that does word expansion.
316 * Tilde Expansion:: Details of how tilde expansion works.
317 * Variable Substitution:: Different types of variable substitution.
321 * I/O Concepts:: Some basic information and terminology.
322 * File Names:: How to refer to a file.
326 * Streams and File Descriptors:: The GNU Library provides two ways
327 to access the contents of files.
328 * File Position:: The number of bytes from the
329 beginning of the file.
333 * Directories:: Directories contain entries for files.
334 * File Name Resolution:: A file name specifies how to look up a file.
335 * File Name Errors:: Error conditions relating to file names.
336 * File Name Portability:: File name portability and syntax issues.
340 * Streams:: About the data type representing a stream.
341 * Standard Streams:: Streams to the standard input and output
342 devices are created for you.
343 * Opening Streams:: How to create a stream to talk to a file.
344 * Closing Streams:: Close a stream when you are finished with it.
345 * Simple Output:: Unformatted output by characters and lines.
346 * Character Input:: Unformatted input by characters and words.
347 * Line Input:: Reading a line or a record from a stream.
348 * Unreading:: Peeking ahead/pushing back input just read.
349 * Block Input/Output:: Input and output operations on blocks of data.
350 * Formatted Output:: @code{printf} and related functions.
351 * Customizing Printf:: You can define new conversion specifiers for
352 @code{printf} and friends.
353 * Formatted Input:: @code{scanf} and related functions.
354 * EOF and Errors:: How you can tell if an I/O error happens.
355 * Binary Streams:: Some systems distinguish between text files
357 * File Positioning:: About random-access streams.
358 * Portable Positioning:: Random access on peculiar ISO C systems.
359 * Stream Buffering:: How to control buffering of streams.
360 * Other Kinds of Streams:: Streams that do not necessarily correspond
362 * Formatted Messages:: Print strictly formatted messages.
366 * Unreading Idea:: An explanation of unreading with pictures.
367 * How Unread:: How to call @code{ungetc} to do unreading.
371 * Formatted Output Basics:: Some examples to get you started.
372 * Output Conversion Syntax:: General syntax of conversion
374 * Table of Output Conversions:: Summary of output conversions and
376 * Integer Conversions:: Details about formatting of integers.
377 * Floating-Point Conversions:: Details about formatting of
378 floating-point numbers.
379 * Other Output Conversions:: Details about formatting of strings,
380 characters, pointers, and the like.
381 * Formatted Output Functions:: Descriptions of the actual functions.
382 * Dynamic Output:: Functions that allocate memory for the output.
383 * Variable Arguments Output:: @code{vprintf} and friends.
384 * Parsing a Template String:: What kinds of args does a given template
386 * Example of Parsing:: Sample program using @code{parse_printf_format}.
390 * Registering New Conversions:: Using @code{register_printf_function}
391 to register a new output conversion.
392 * Conversion Specifier Options:: The handler must be able to get
393 the options specified in the
394 template when it is called.
395 * Defining the Output Handler:: Defining the handler and arginfo
396 functions that are passed as arguments
397 to @code{register_printf_function}.
398 * Printf Extension Example:: How to define a @code{printf}
400 * Predefined Printf Handlers:: Predefined @code{printf} handlers.
404 * Formatted Input Basics:: Some basics to get you started.
405 * Input Conversion Syntax:: Syntax of conversion specifications.
406 * Table of Input Conversions:: Summary of input conversions and what they do.
407 * Numeric Input Conversions:: Details of conversions for reading numbers.
408 * String Input Conversions:: Details of conversions for reading strings.
409 * Dynamic String Input:: String conversions that @code{malloc} the buffer.
410 * Other Input Conversions:: Details of miscellaneous other conversions.
411 * Formatted Input Functions:: Descriptions of the actual functions.
412 * Variable Arguments Input:: @code{vscanf} and friends.
416 * Buffering Concepts:: Terminology is defined here.
417 * Flushing Buffers:: How to ensure that output buffers are flushed.
418 * Controlling Buffering:: How to specify what kind of buffering to use.
420 Other Kinds of Streams
422 * String Streams:: Streams that get data from or put data in
423 a string or memory buffer.
424 * Obstack Streams:: Streams that store data in an obstack.
425 * Custom Streams:: Defining your own streams with an arbitrary
426 input data source and/or output data sink.
430 * Streams and Cookies:: The @dfn{cookie} records where to fetch or
431 store data that is read or written.
432 * Hook Functions:: How you should define the four @dfn{hook
433 functions} that a custom stream needs.
437 * Printing Formatted Messages:: The @code{fmtmsg} function.
438 * Adding Severity Classes:: Add more severity classes.
439 * Example:: How to use @code{fmtmsg} and @code{addseverity}.
443 * Opening and Closing Files:: How to open and close file
445 * Truncating Files:: Change the size of a file.
446 * I/O Primitives:: Reading and writing data.
447 * File Position Primitive:: Setting a descriptor's file
449 * Descriptors and Streams:: Converting descriptor to stream
451 * Stream/Descriptor Precautions:: Precautions needed if you use both
452 descriptors and streams.
453 * Scatter-Gather:: Fast I/O to discontinous buffers.
454 * Memory-mapped I/O:: Using files like memory.
455 * Waiting for I/O:: How to check for input or output
456 on multiple file descriptors.
457 * Synchronizing I/O:: Making sure all I/O actions completed.
458 * Asynchronous I/O:: Perform I/O in parallel.
459 * Control Operations:: Various other operations on file
461 * Duplicating Descriptors:: Fcntl commands for duplicating
463 * Descriptor Flags:: Fcntl commands for manipulating
464 flags associated with file
466 * File Status Flags:: Fcntl commands for manipulating
467 flags associated with open files.
468 * File Locks:: Fcntl commands for implementing
470 * Interrupt Input:: Getting an asynchronous signal when
472 * IOCTLs:: Generic I/O Control operations.
474 Stream/Descriptor Precautions
476 * Linked Channels:: Dealing with channels sharing a file position.
477 * Independent Channels:: Dealing with separately opened, unlinked channels.
478 * Cleaning Streams:: Cleaning a stream makes it safe to use
483 * Asynchronous Reads/Writes:: Asynchronous Read and Write Operations.
484 * Status of AIO Operations:: Getting the Status of AIO Operations.
485 * Synchronizing AIO Operations:: Getting into a consistent state.
486 * Cancel AIO Operations:: Cancelation of AIO Operations.
487 * Configuration of AIO:: How to optimize the AIO implementation.
491 * Access Modes:: Whether the descriptor can read or write.
492 * Open-time Flags:: Details of @code{open}.
493 * Operating Modes:: Special modes to control I/O operations.
494 * Getting File Status Flags:: Fetching and changing these flags.
496 File System Interface
498 * Working Directory:: This is used to resolve relative
500 * Accessing Directories:: Finding out what files a directory
502 * Working on Directory Trees:: Apply actions to all files or a selectable
503 subset of a directory hierarchy.
504 * Hard Links:: Adding alternate names to a file.
505 * Symbolic Links:: A file that ``points to'' a file name.
506 * Deleting Files:: How to delete a file, and what that means.
507 * Renaming Files:: Changing a file's name.
508 * Creating Directories:: A system call just for creating a directory.
509 * File Attributes:: Attributes of individual files.
510 * Making Special Files:: How to create special files.
511 * Temporary Files:: Naming and creating temporary files.
513 Accessing Directories
515 * Directory Entries:: Format of one directory entry.
516 * Opening a Directory:: How to open a directory stream.
517 * Reading/Closing Directory:: How to read directory entries from the stream.
518 * Simple Directory Lister:: A very simple directory listing program.
519 * Random Access Directory:: Rereading part of the directory
520 already read with the same stream.
521 * Scanning Directory Content:: Get entries for user selected subset of
522 contents in given directory.
523 * Simple Directory Lister Mark II:: Revised version of the program.
527 * Attribute Meanings:: The names of the file attributes,
528 and what their values mean.
529 * Reading Attributes:: How to read the attributes of a file.
530 * Testing File Type:: Distinguishing ordinary files,
531 directories, links...
532 * File Owner:: How ownership for new files is determined,
533 and how to change it.
534 * Permission Bits:: How information about a file's access
536 * Access Permission:: How the system decides who can access a file.
537 * Setting Permissions:: How permissions for new files are assigned,
538 and how to change them.
539 * Testing File Access:: How to find out if your process can
541 * File Times:: About the time attributes of a file.
542 * File Size:: Manually changing the size of a file.
546 * Creating a Pipe:: Making a pipe with the @code{pipe} function.
547 * Pipe to a Subprocess:: Using a pipe to communicate with a
549 * FIFO Special Files:: Making a FIFO special file.
550 * Pipe Atomicity:: When pipe (or FIFO) I/O is atomic.
554 * Socket Concepts:: Basic concepts you need to know about.
555 * Communication Styles::Stream communication, datagrams, and other styles.
556 * Socket Addresses:: How socket names (``addresses'') work.
557 * Interface Naming:: Identifying specific network interfaces.
558 * Local Namespace:: Details about the local namespace.
559 * Internet Namespace:: Details about the Internet namespace.
560 * Misc Namespaces:: Other namespaces not documented fully here.
561 * Open/Close Sockets:: Creating sockets and destroying them.
562 * Connections:: Operations on sockets with connection state.
563 * Datagrams:: Operations on datagram sockets.
564 * Inetd:: Inetd is a daemon that starts servers on request.
565 The most convenient way to write a server
566 is to make it work with Inetd.
567 * Socket Options:: Miscellaneous low-level socket options.
568 * Networks Database:: Accessing the database of network names.
572 * Address Formats:: About @code{struct sockaddr}.
573 * Setting Address:: Binding an address to a socket.
574 * Reading Address:: Reading the address of a socket.
578 * Concepts: Local Namespace Concepts. What you need to understand.
579 * Details: Local Namespace Details. Address format, symbolic names, etc.
580 * Example: Local Socket Example. Example of creating a socket.
584 * Internet Address Formats:: How socket addresses are specified in the
586 * Host Addresses:: All about host addresses of internet host.
587 * Protocols Database:: Referring to protocols by name.
588 * Ports:: Internet port numbers.
589 * Services Database:: Ports may have symbolic names.
590 * Byte Order:: Different hosts may use different byte
591 ordering conventions; you need to
592 canonicalize host address and port number.
593 * Inet Example:: Putting it all together.
597 * Abstract Host Addresses:: What a host number consists of.
598 * Data type: Host Address Data Type. Data type for a host number.
599 * Functions: Host Address Functions. Functions to operate on them.
600 * Names: Host Names. Translating host names to host numbers.
604 * Creating a Socket:: How to open a socket.
605 * Closing a Socket:: How to close a socket.
606 * Socket Pairs:: These are created like pipes.
610 * Connecting:: What the client program must do.
611 * Listening:: How a server program waits for requests.
612 * Accepting Connections:: What the server does when it gets a request.
613 * Who is Connected:: Getting the address of the
614 other side of a connection.
615 * Transferring Data:: How to send and receive data.
616 * Byte Stream Example:: An example program: a client for communicating
617 over a byte stream socket in the Internet namespace.
618 * Server Example:: A corresponding server program.
619 * Out-of-Band Data:: This is an advanced feature.
623 * Sending Data:: Sending data with @code{send}.
624 * Receiving Data:: Reading data with @code{recv}.
625 * Socket Data Options:: Using @code{send} and @code{recv}.
629 * Sending Datagrams:: Sending packets on a datagram socket.
630 * Receiving Datagrams:: Receiving packets on a datagram socket.
631 * Datagram Example:: An example program: packets sent over a
632 datagram socket in the local namespace.
633 * Example Receiver:: Another program, that receives those packets.
638 * Configuring Inetd::
642 * Socket Option Functions:: The basic functions for setting and getting
644 * Socket-Level Options:: Details of the options at the socket level.
646 Low-Level Terminal Interface
648 * Is It a Terminal:: How to determine if a file is a terminal
649 device, and what its name is.
650 * I/O Queues:: About flow control and typeahead.
651 * Canonical or Not:: Two basic styles of input processing.
652 * Terminal Modes:: How to examine and modify flags controlling
653 details of terminal I/O: echoing,
655 * Line Control:: Sending break sequences, clearing
656 terminal buffers @dots{}
657 * Noncanon Example:: How to read single characters without echo.
658 * Pseudo-Terminals:: How to open a pseudo-terminal.
662 * Mode Data Types:: The data type @code{struct termios} and
664 * Mode Functions:: Functions to read and set the terminal
666 * Setting Modes:: The right way to set terminal attributes
668 * Input Modes:: Flags controlling low-level input handling.
669 * Output Modes:: Flags controlling low-level output handling.
670 * Control Modes:: Flags controlling serial port behavior.
671 * Local Modes:: Flags controlling high-level input handling.
672 * Line Speed:: How to read and set the terminal line speed.
673 * Special Characters:: Characters that have special effects,
674 and how to change them.
675 * Noncanonical Input:: Controlling how long to wait for input.
679 * Editing Characters:: Special characters that terminate lines and
680 delete text, and other editing functions.
681 * Signal Characters:: Special characters that send or raise signals
682 to or for certain classes of processes.
683 * Start/Stop Characters:: Special characters that suspend or resume
685 * Other Special:: Other special characters for BSD systems:
686 they can discard output, and print status.
690 * Allocation:: Allocating a pseudo terminal.
691 * Pseudo-Terminal Pairs:: How to open both sides of a
692 pseudo-terminal in a single operation.
696 * Mathematical Constants:: Precise numeric values for often-used
698 * Trig Functions:: Sine, cosine, tangent, and friends.
699 * Inverse Trig Functions:: Arcsine, arccosine, etc.
700 * Exponents and Logarithms:: Also pow and sqrt.
701 * Hyperbolic Functions:: sinh, cosh, tanh, etc.
702 * Special Functions:: Bessel, gamma, erf.
703 * Pseudo-Random Numbers:: Functions for generating pseudo-random
705 * FP Function Optimizations:: Fast code or small code.
707 Pseudo-Random Numbers
709 * ISO Random:: @code{rand} and friends.
710 * BSD Random:: @code{random} and friends.
711 * SVID Random:: @code{drand48} and friends.
715 * Floating Point Numbers:: Basic concepts. IEEE 754.
716 * Floating Point Classes:: The five kinds of floating-point number.
717 * Floating Point Errors:: When something goes wrong in a calculation.
718 * Rounding:: Controlling how results are rounded.
719 * Control Functions:: Saving and restoring the FPU's state.
720 * Arithmetic Functions:: Fundamental operations provided by the library.
721 * Complex Numbers:: The types. Writing complex constants.
722 * Operations on Complex:: Projection, conjugation, decomposition.
723 * Integer Division:: Integer division with guaranteed rounding.
724 * Parsing of Numbers:: Converting strings to numbers.
725 * System V Number Conversion:: An archaic way to convert numbers to strings.
727 Floating Point Errors
729 * FP Exceptions:: IEEE 754 math exceptions and how to detect them.
730 * Infinity and NaN:: Special values returned by calculations.
731 * Status bit operations:: Checking for exceptions after the fact.
732 * Math Error Reporting:: How the math functions report errors.
736 * Absolute Value:: Absolute values of integers and floats.
737 * Normalization Functions:: Extracting exponents and putting them back.
738 * Rounding Functions:: Rounding floats to integers.
739 * Remainder Functions:: Remainders on division, precisely defined.
740 * FP Bit Twiddling:: Sign bit adjustment. Adding epsilon.
741 * FP Comparison Functions:: Comparisons without risk of exceptions.
742 * Misc FP Arithmetic:: Max, min, positive difference, multiply-add.
746 * Parsing of Integers:: Functions for conversion of integer values.
747 * Parsing of Floats:: Functions for conversion of floating-point
752 * Processor Time:: Measures processor time used by a program.
753 * Calendar Time:: Manipulation of ``real'' dates and times.
754 * Setting an Alarm:: Sending a signal after a specified time.
755 * Sleeping:: Waiting for a period of time.
756 * Resource Usage:: Measuring various resources used.
757 * Limits on Resources:: Specifying limits on resource usage.
758 * Priority:: Reading or setting process run priority.
762 * Basic CPU Time:: The @code{clock} function.
763 * Detailed CPU Time:: The @code{times} function.
767 * Simple Calendar Time:: Facilities for manipulating calendar time.
768 * High-Resolution Calendar:: A time representation with greater precision.
769 * Broken-down Time:: Facilities for manipulating local time.
770 * Formatting Date and Time:: Converting times to strings.
771 * Parsing Date and Time:: Convert textual time and date information back
772 into broken-down time values.
773 * TZ Variable:: How users specify the time zone.
774 * Time Zone Functions:: Functions to examine or specify the time zone.
775 * Time Functions Example:: An example program showing use of some of
778 Parsing Date and Time
780 * Low-Level Time String Parsing:: Interpret string according to given format.
781 * General Time String Parsing:: User-friendly function to parse data and
786 * Intro: Non-Local Intro. When and how to use these facilities.
787 * Details: Non-Local Details. Functions for nonlocal exits.
788 * Non-Local Exits and Signals:: Portability issues.
792 * Concepts of Signals:: Introduction to the signal facilities.
793 * Standard Signals:: Particular kinds of signals with
794 standard names and meanings.
795 * Signal Actions:: Specifying what happens when a
796 particular signal is delivered.
797 * Defining Handlers:: How to write a signal handler function.
798 * Interrupted Primitives:: Signal handlers affect use of @code{open},
799 @code{read}, @code{write} and other functions.
800 * Generating Signals:: How to send a signal to a process.
801 * Blocking Signals:: Making the system hold signals temporarily.
802 * Waiting for a Signal:: Suspending your program until a signal
804 * Signal Stack:: Using a Separate Signal Stack.
805 * BSD Signal Handling:: Additional functions for backward
806 compatibility with BSD.
810 * Kinds of Signals:: Some examples of what can cause a signal.
811 * Signal Generation:: Concepts of why and how signals occur.
812 * Delivery of Signal:: Concepts of what a signal does to the
817 * Program Error Signals:: Used to report serious program errors.
818 * Termination Signals:: Used to interrupt and/or terminate the
820 * Alarm Signals:: Used to indicate expiration of timers.
821 * Asynchronous I/O Signals:: Used to indicate input is available.
822 * Job Control Signals:: Signals used to support job control.
823 * Operation Error Signals:: Used to report operational system errors.
824 * Miscellaneous Signals:: Miscellaneous Signals.
825 * Signal Messages:: Printing a message describing a signal.
829 * Basic Signal Handling:: The simple @code{signal} function.
830 * Advanced Signal Handling:: The more powerful @code{sigaction} function.
831 * Signal and Sigaction:: How those two functions interact.
832 * Sigaction Function Example:: An example of using the sigaction function.
833 * Flags for Sigaction:: Specifying options for signal handling.
834 * Initial Signal Actions:: How programs inherit signal actions.
838 * Handler Returns:: Handlers that return normally, and what
840 * Termination in Handler:: How handler functions terminate a program.
841 * Longjmp in Handler:: Nonlocal transfer of control out of a
843 * Signals in Handler:: What happens when signals arrive while
844 the handler is already occupied.
845 * Merged Signals:: When a second signal arrives before the
847 * Nonreentrancy:: Do not call any functions unless you know they
848 are reentrant with respect to signals.
849 * Atomic Data Access:: A single handler can run in the middle of
850 reading or writing a single object.
854 * Non-atomic Example:: A program illustrating interrupted access.
855 * Types: Atomic Types. Data types that guarantee no interruption.
856 * Usage: Atomic Usage. Proving that interruption is harmless.
860 * Signaling Yourself:: A process can send a signal to itself.
861 * Signaling Another Process:: Send a signal to another process.
862 * Permission for kill:: Permission for using @code{kill}.
863 * Kill Example:: Using @code{kill} for Communication.
867 * Why Block:: The purpose of blocking signals.
868 * Signal Sets:: How to specify which signals to
870 * Process Signal Mask:: Blocking delivery of signals to your
871 process during normal execution.
872 * Testing for Delivery:: Blocking to Test for Delivery of
874 * Blocking for Handler:: Blocking additional signals while a
875 handler is being run.
876 * Checking for Pending Signals:: Checking for Pending Signals
877 * Remembering a Signal:: How you can get almost the same
878 effect as blocking a signal, by
879 handling it and setting a flag
884 * Using Pause:: The simple way, using @code{pause}.
885 * Pause Problems:: Why the simple way is often not very good.
886 * Sigsuspend:: Reliably waiting for a specific signal.
890 * BSD Handler:: BSD Function to Establish a Handler.
891 * Blocking in BSD:: BSD Functions for Blocking Signals.
895 * Program Arguments:: Parsing your program's command-line arguments.
896 * Environment Variables:: How to access parameters inherited from
898 * Program Termination:: How to cause a process to terminate and
899 return status information to its parent.
903 * Argument Syntax:: By convention, options start with a hyphen.
904 * Parsing Program Arguments:: Ways to parse program options and arguments.
906 Parsing Program Arguments
908 * Getopt:: Parsing program options using @code{getopt}.
909 * Argp:: Parsing program options using @code{argp_parse}.
910 * Suboptions:: Some programs need more detailed options.
911 * Suboptions Example:: This shows how it could be done for @code{mount}.
913 Environment Variables
915 * Environment Access:: How to get and set the values of
916 environment variables.
917 * Standard Environment:: These environment variables have
918 standard interpretations.
922 * Normal Termination:: If a program calls @code{exit}, a
923 process terminates normally.
924 * Exit Status:: The @code{exit status} provides information
925 about why the process terminated.
926 * Cleanups on Exit:: A process can run its own cleanup
927 functions upon normal termination.
928 * Aborting a Program:: The @code{abort} function causes
929 abnormal program termination.
930 * Termination Internals:: What happens when a process terminates.
934 * Running a Command:: The easy way to run another program.
935 * Process Creation Concepts:: An overview of the hard way to do it.
936 * Process Identification:: How to get the process ID of a process.
937 * Creating a Process:: How to fork a child process.
938 * Executing a File:: How to make a process execute another program.
939 * Process Completion:: How to tell when a child process has completed.
940 * Process Completion Status:: How to interpret the status value
941 returned from a child process.
942 * BSD Wait Functions:: More functions, for backward compatibility.
943 * Process Creation Example:: A complete example program.
947 * Concepts of Job Control:: Jobs can be controlled by a shell.
948 * Job Control is Optional:: Not all POSIX systems support job control.
949 * Controlling Terminal:: How a process gets its controlling terminal.
950 * Access to the Terminal:: How processes share the controlling terminal.
951 * Orphaned Process Groups:: Jobs left after the user logs out.
952 * Implementing a Shell:: What a shell must do to implement job control.
953 * Functions for Job Control:: Functions to control process groups.
957 * Data Structures:: Introduction to the sample shell.
958 * Initializing the Shell:: What the shell must do to take
959 responsibility for job control.
960 * Launching Jobs:: Creating jobs to execute commands.
961 * Foreground and Background:: Putting a job in foreground of background.
962 * Stopped and Terminated Jobs:: Reporting job status.
963 * Continuing Stopped Jobs:: How to continue a stopped job in
964 the foreground or background.
965 * Missing Pieces:: Other parts of the shell.
967 Functions for Job Control
969 * Identifying the Terminal:: Determining the controlling terminal's name.
970 * Process Group Functions:: Functions for manipulating process groups.
971 * Terminal Access Functions:: Functions for controlling terminal access.
975 * NSS Basics:: What is this NSS good for.
976 * NSS Configuration File:: Configuring NSS.
977 * NSS Module Internals:: How does it work internally.
978 * Extending NSS:: What to do to add services or databases.
980 NSS Configuration File
982 * Services in the NSS configuration:: Service names in the NSS configuration.
983 * Actions in the NSS configuration:: React appropriately to the lookup result.
984 * Notes on NSS Configuration File:: Things to take care about while
989 * NSS Module Names:: Construction of the interface function of
991 * NSS Modules Interface:: Programming interface in the NSS module
996 * Adding another Service to NSS:: What is to do to add a new service.
997 * NSS Module Function Internals:: Guidelines for writing new NSS
1002 * User and Group IDs:: Each user has a unique numeric ID;
1003 likewise for groups.
1004 * Process Persona:: The user IDs and group IDs of a process.
1005 * Why Change Persona:: Why a program might need to change
1006 its user and/or group IDs.
1007 * How Change Persona:: Changing the user and group IDs.
1008 * Reading Persona:: How to examine the user and group IDs.
1010 * Setting User ID:: Functions for setting the user ID.
1011 * Setting Groups:: Functions for setting the group IDs.
1013 * Enable/Disable Setuid:: Turning setuid access on and off.
1014 * Setuid Program Example:: The pertinent parts of one sample program.
1015 * Tips for Setuid:: How to avoid granting unlimited access.
1017 * Who Logged In:: Getting the name of the user who logged in,
1018 or of the real user ID of the current process.
1020 * User Accounting Database:: Keeping information about users and various
1021 actions in databases.
1023 * User Database:: Functions and data structures for
1024 accessing the user database.
1025 * Group Database:: Functions and data structures for
1026 accessing the group database.
1027 * Database Example:: Example program showing the use of database
1029 * Netgroup Database:: Functions for accessing the netgroup database.
1031 User Accounting Database
1033 * Manipulating the Database:: Scanning and modifying the user
1034 accounting database.
1035 * XPG Functions:: A standardized way for doing the same thing.
1036 * Logging In and Out:: Functions from BSD that modify the user
1037 accounting database.
1041 * User Data Structure:: What each user record contains.
1042 * Lookup User:: How to look for a particular user.
1043 * Scanning All Users:: Scanning the list of all users, one by one.
1044 * Writing a User Entry:: How a program can rewrite a user's record.
1048 * Group Data Structure:: What each group record contains.
1049 * Lookup Group:: How to look for a particular group.
1050 * Scanning All Groups:: Scanning the list of all groups.
1054 * Netgroup Data:: Data in the Netgroup database and where
1056 * Lookup Netgroup:: How to look for a particular netgroup.
1057 * Netgroup Membership:: How to test for netgroup membership.
1061 * Host Identification:: Determining the name of the machine.
1062 * Hardware/Software Type ID:: Determining the hardware type of the
1063 machine and what operating system it is
1065 * Filesystem handling:: Which is mounted and/or available?
1067 System Configuration
1069 * General Limits:: Constants and functions that describe
1070 various process-related limits that have
1071 one uniform value for any given machine.
1072 * System Options:: Optional POSIX features.
1073 * Version Supported:: Version numbers of POSIX.1 and POSIX.2.
1074 * Sysconf:: Getting specific configuration values
1075 of general limits and system options.
1076 * Minimums:: Minimum values for general limits.
1078 * Limits for Files:: Size limitations that pertain to individual files.
1079 These can vary between file systems
1080 or even from file to file.
1081 * Options for Files:: Optional features that some files may support.
1082 * File Minimums:: Minimum values for file limits.
1083 * Pathconf:: Getting the limit values for a particular file.
1085 * Utility Limits:: Capacity limits of some POSIX.2 utility programs.
1086 * Utility Minimums:: Minimum allowable values of those limits.
1088 * String Parameters:: Getting the default search path.
1092 * Sysconf Definition:: Detailed specifications of @code{sysconf}.
1093 * Constants for Sysconf:: The list of parameters @code{sysconf} can read.
1094 * Examples of Sysconf:: How to use @code{sysconf} and the parameter
1095 macros properly together.
1099 * Basic Thread Operations:: Creating, terminating, and waiting for threads.
1100 * Thread Attributes:: Tuning thread scheduling.
1101 * Cancellation:: Stopping a thread before it's done.
1102 * Cleanup Handlers:: Deallocating resources when a thread is
1104 * Mutexes:: One way to synchronize threads.
1105 * Condition Variables:: Another way.
1106 * POSIX Semaphores:: And a third way.
1107 * Thread-Specific Data:: Variables with different values in
1109 * Threads and Signal Handling:: Why you should avoid mixing the two, and
1110 how to do it if you must.
1111 * Miscellaneous Thread Functions:: A grab bag of utility routines.
1115 * Consistency Checking:: Using @code{assert} to abort if
1116 something ``impossible'' happens.
1117 * Variadic Functions:: Defining functions with varying numbers
1119 * Null Pointer Constant:: The macro @code{NULL}.
1120 * Important Data Types:: Data types for object sizes.
1121 * Data Type Measurements:: Parameters of data type representations.
1125 * Why Variadic:: Reasons for making functions take
1127 * How Variadic:: How to define and call variadic functions.
1128 * Variadic Example:: A complete example.
1132 * Variadic Prototypes:: How to make a prototype for a function
1133 with variable arguments.
1134 * Receiving Arguments:: Steps you must follow to access the
1135 optional argument values.
1136 * How Many Arguments:: How to decide whether there are more arguments.
1137 * Calling Variadics:: Things you need to know about calling
1138 variable arguments functions.
1139 * Argument Macros:: Detailed specification of the macros
1140 for accessing variable arguments.
1141 * Old Varargs:: The pre-ISO way of defining variadic functions.
1143 Data Type Measurements
1145 * Width of Type:: How many bits does an integer type hold?
1146 * Range of Type:: What are the largest and smallest values
1147 that an integer type can hold?
1148 * Floating Type Macros:: Parameters that measure the floating point types.
1149 * Structure Measurement:: Getting measurements on structure types.
1151 Floating Type Macros
1153 * Floating Point Concepts:: Definitions of terminology.
1154 * Floating Point Parameters:: Details of specific macros.
1155 * IEEE Floating Point:: The measurements for one common
1160 * Configuring and compiling:: How to compile and test GNU libc.
1161 * Running make install:: How to install it once you've got it compiled.
1162 * Tools for Compilation:: You'll need these first.
1163 * Supported Configurations:: What it runs on, what it doesn't.
1164 * Linux:: Specific advice for Linux systems.
1165 * Reporting Bugs:: So they'll get fixed.
1169 * Source Layout:: How to add new functions or header files
1170 to the GNU C library.
1171 * Porting:: How to port the GNU C library to
1172 a new machine or operating system.
1176 * Hierarchy Conventions:: The layout of the @file{sysdeps} hierarchy.
1177 * Porting to Unix:: Porting the library to an average