1 \input texinfo @c -*- Texinfo -*-
2 @comment %**start of header (This is for running Texinfo on a region.)
4 @settitle The GNU C Library
7 @c This tells texinfo.tex to use the real section titles in xrefs in
8 @c place of the node name, when no section title is explicitly given.
9 @set xref-automatic-section-title
14 @comment %**end of header (This is for running Texinfo on a region.)
16 @c sold 0.06/1.09, print run out 21may96
17 @set EDITION 0.07 DRAFT
18 @set VERSION 2.00 Beta
19 @set UPDATED 4 Oct 1996
20 @set ISBN 1-882114-53-1
23 This file documents the GNU C library.
25 This is Edition @value{EDITION}, last updated @value{UPDATED},
26 of @cite{The GNU C Library Reference Manual}, for Version @value{VERSION}.
28 Copyright (C) 1993, '94, '95, '96 Free Software Foundation, Inc.
30 Permission is granted to make and distribute verbatim copies of
31 this manual provided the copyright notice and this permission notice
32 are preserved on all copies.
35 Permission is granted to process this file through TeX and print the
36 results, provided the printed document carries copying permission
37 notice identical to this one except for the removal of this paragraph
38 (this paragraph not being relevant to the printed manual).
41 Permission is granted to copy and distribute modified versions of this
42 manual under the conditions for verbatim copying, provided also that the
43 section entitled ``GNU Library General Public License'' is included
44 exactly as in the original, and provided that the entire resulting
45 derived work is distributed under the terms of a permission notice
46 identical to this one.
48 Permission is granted to copy and distribute translations of this manual
49 into another language, under the above conditions for modified versions,
50 except that the text of the translation of the section entitled ``GNU
51 Library General Public License'' must be approved for accuracy by the
56 @shorttitlepage The GNU C Library Reference Manual
59 @center @titlefont{The GNU C Library}
61 @center @titlefont{Reference Manual}
63 @center Sandra Loosemore
65 @center Richard M. Stallman, Roland McGrath, Andrew Oram, and Ulrich Drepper
67 @center Edition @value{EDITION}
69 @center last updated @value{UPDATED}
71 @center for version @value{VERSION}
73 @vskip 0pt plus 1filll
74 Copyright @copyright{} 1993, '94, '95, '96 Free Software Foundation, Inc.
76 Published by the Free Software Foundation @*
77 59 Temple Place -- Suite 330, @*
78 Boston, MA 02111-1307 USA @*
79 Printed copies are available for $50 each. @*
82 Permission is granted to make and distribute verbatim copies of
83 this manual provided the copyright notice and this permission notice
84 are preserved on all copies.
86 Permission is granted to copy and distribute modified versions of this
87 manual under the conditions for verbatim copying, provided also that the
88 section entitled ``GNU Library General Public License'' is included
89 exactly as in the original, and provided that the entire resulting
90 derived work is distributed under the terms of a permission notice
91 identical to this one.
93 Permission is granted to copy and distribute translations of this manual
94 into another language, under the above conditions for modified versions,
95 except that the text of the translation of the section entitled ``GNU
96 Library General Public License'' must be approved for accuracy by the
102 @node Top, Introduction, (dir), (dir)
104 This is Edition @value{EDITION}, last updated @value{UPDATED}, of
105 @cite{The GNU C Library Reference Manual}, for Version @value{VERSION}
106 of the GNU C Library.
111 * Introduction:: Purpose of the GNU C Library.
112 * Error Reporting:: How the GNU Library functions report
114 * Memory Allocation:: Your program can allocate memory dynamically
115 and manipulate it via pointers.
116 * Character Handling:: Character testing and conversion functions.
117 * String and Array Utilities:: Utilities for copying and comparing
119 * Extended Characters:: Support for extended character sets.
120 * Locales:: The country and language can affect
121 the behavior of library functions.
122 * Searching and Sorting:: General searching and sorting functions.
123 * Pattern Matching:: Matching wildcards and regular expressions,
124 and shell-style ``word expansion''.
125 * I/O Overview:: Introduction to the I/O facilities.
126 * Streams: I/O on Streams. High-level, portable I/O facilities.
127 * Low-Level I/O:: Low-level, less portable I/O.
128 * File System Interface:: Functions for manipulating files.
129 * Pipes and FIFOs:: A simple interprocess communication mechanism.
130 * Sockets:: A more complicated interprocess communication
131 mechanism, with support for networking.
132 * Low-Level Terminal Interface::How to change the characteristics
133 of a terminal device.
134 * Mathematics:: Math functions (transcendental functions,
135 random numbers, absolute value, etc.).
136 * Arithmetic:: Low-level arithmetic functions.
137 * Date and Time:: Functions for getting the date and time,
138 and for conversion between formats.
139 * Non-Local Exits:: The @code{setjmp} and @code{longjmp} facilities.
140 * Signal Handling:: All about signals; how to send them,
141 block them, and handle them.
142 * Process Startup:: Writing the beginning and end of your program.
143 * Processes:: How to create processes and run other programs.
144 * Job Control:: All about process groups and sessions.
145 * Name Service Switch:: Accessing the various system databases.
146 * Users and Groups:: How users are identified and classified.
147 * System Information:: Getting information about the
148 hardware and software configuration
149 of the machine a program runs on.
150 * System Configuration:: Parameters describing operating system limits.
154 * Language Features:: C language features provided by the library.
156 * Library Summary:: A summary showing the syntax, header file,
157 and derivation of each library feature.
158 * Maintenance:: How to install and maintain the GNU C Library.
159 * Copying:: The GNU Library General Public License says
160 how you can copy and share the GNU C Library.
164 * Concept Index:: Index of concepts and names.
165 * Type Index:: Index of types and type qualifiers.
166 * Function Index:: Index of functions and function-like macros.
167 * Variable Index:: Index of variables and variable-like macros.
168 * File Index:: Index of programs and files.
170 --- The Detailed Node Listing ---
174 * Getting Started:: Getting Started
175 * Standards and Portability:: Standards and Portability
176 * Using the Library:: Using the Library
177 * Roadmap to the Manual:: Roadmap to the Manual
179 Standards and Portability
181 * ISO C:: The American National Standard for the
182 C programming language.
183 * POSIX:: The ISO/IEC 9945 (aka IEEE 1003) standards
184 for operating systems.
185 * Berkeley Unix:: BSD and SunOS.
186 * SVID:: The System V Interface Description.
190 * Header Files:: How to use the header files in your programs.
191 * Macro Definitions:: Some functions in the library may really
192 be implemented as macros.
193 * Reserved Names:: The C standard reserves some names for
194 the library, and some for users.
195 * Feature Test Macros:: How to control what names are defined.
199 * Checking for Errors:: How errors are reported by library functions.
200 * Error Codes:: What all the error codes are.
201 * Error Messages:: Mapping error codes onto error messages.
205 * Memory Concepts:: An introduction to concepts and terminology.
206 * Dynamic Allocation and C:: How to get different kinds of allocation in C.
207 * Unconstrained Allocation:: The @code{malloc} facility allows fully general
209 * Obstacks:: Obstacks are less general than malloc
210 but more efficient and convenient.
211 * Variable Size Automatic:: Allocation of variable-sized blocks
212 of automatic storage that are freed when the
213 calling function returns.
214 * Relocating Allocator:: Waste less memory, if you can tolerate
215 automatic relocation of the blocks you get.
217 Unconstrained Allocation
219 * Basic Allocation:: Simple use of @code{malloc}.
220 * Malloc Examples:: Examples of @code{malloc}. @code{xmalloc}.
221 * Freeing after Malloc:: Use @code{free} to free a block you
222 got with @code{malloc}.
223 * Changing Block Size:: Use @code{realloc} to make a block
225 * Allocating Cleared Space:: Use @code{calloc} to allocate a
227 * Efficiency and Malloc:: Efficiency considerations in use of
229 * Aligned Memory Blocks:: Allocating specially aligned memory:
230 @code{memalign} and @code{valloc}.
231 * Heap Consistency Checking:: Automatic checking for errors.
232 * Hooks for Malloc:: You can use these hooks for debugging
233 programs that use @code{malloc}.
234 * Statistics of Malloc:: Getting information about how much
235 memory your program is using.
236 * Summary of Malloc:: Summary of @code{malloc} and related functions.
240 * Creating Obstacks:: How to declare an obstack in your program.
241 * Preparing for Obstacks:: Preparations needed before you can
243 * Allocation in an Obstack:: Allocating objects in an obstack.
244 * Freeing Obstack Objects:: Freeing objects in an obstack.
245 * Obstack Functions:: The obstack functions are both
246 functions and macros.
247 * Growing Objects:: Making an object bigger by stages.
248 * Extra Fast Growing:: Extra-high-efficiency (though more
249 complicated) growing objects.
250 * Status of an Obstack:: Inquiries about the status of an obstack.
251 * Obstacks Data Alignment:: Controlling alignment of objects in obstacks.
252 * Obstack Chunks:: How obstacks obtain and release chunks.
253 Efficiency considerations.
254 * Summary of Obstacks::
256 Automatic Storage with Variable Size
258 * Alloca Example:: Example of using @code{alloca}.
259 * Advantages of Alloca:: Reasons to use @code{alloca}.
260 * Disadvantages of Alloca:: Reasons to avoid @code{alloca}.
261 * GNU C Variable-Size Arrays:: Only in GNU C, here is an alternative
262 method of allocating dynamically and
263 freeing automatically.
266 * Relocator Concepts:: How to understand relocating allocation.
267 * Using Relocator:: Functions for relocating allocation.
271 * Classification of Characters::Testing whether characters are
272 letters, digits, punctuation, etc.
273 * Case Conversion:: Case mapping, and the like.
275 String and Array Utilities
277 * Representation of Strings:: Introduction to basic concepts.
278 * String/Array Conventions:: Whether to use a string function or an
279 arbitrary array function.
280 * String Length:: Determining the length of a string.
281 * Copying and Concatenation:: Functions to copy the contents of strings
283 * String/Array Comparison:: Functions for byte-wise and character-wise
285 * Collation Functions:: Functions for collating strings.
286 * Search Functions:: Searching for a specific element or substring.
287 * Finding Tokens in a String:: Splitting a string into tokens by looking
292 * Extended Char Intro:: Multibyte codes versus wide characters.
293 * Locales and Extended Chars:: The locale selects the character codes.
294 * Multibyte Char Intro:: How multibyte codes are represented.
295 * Wide Char Intro:: How wide characters are represented.
296 * Wide String Conversion:: Converting wide strings to multibyte code
298 * Length of Char:: how many bytes make up one multibyte char.
299 * Converting One Char:: Converting a string character by character.
300 * Example of Conversion:: Example showing why converting
301 one character at a time may be useful.
302 * Shift State:: Multibyte codes with "shift characters".
304 Locales and Internationalization
306 * Effects of Locale:: Actions affected by the choice of locale.
307 * Choosing Locale:: How the user specifies a locale.
308 * Locale Categories:: Different purposes for which
309 you can select a locale.
310 * Setting the Locale:: How a program specifies the locale.
311 * Standard Locales:: Locale names available on all systems.
312 * Numeric Formatting:: How to format numbers for the chosen locale.
314 Searching and Sorting
316 * Comparison Functions:: Defining how to compare two objects.
317 Since the sort and search facilities are
318 general, you have to specify the ordering.
319 * Array Search Function:: The @code{bsearch} function.
320 * Array Sort Function:: The @code{qsort} function.
321 * Search/Sort Example:: An example program.
325 * Wildcard Matching:: Matching a wildcard pattern against a single string.
326 * Globbing:: Finding the files that match a wildcard pattern.
327 * Regular Expressions:: Matching regular expressions against strings.
328 * Word Expansion:: Expanding shell variables, nested commands,
329 arithmetic, and wildcards.
330 This is what the shell does with shell commands.
334 * I/O Concepts:: Some basic information and terminology.
335 * File Names:: How to refer to a file.
339 * Streams and File Descriptors:: The GNU Library provides two ways
340 to access the contents of files.
341 * File Position:: The number of bytes from the
342 beginning of the file.
346 * Directories:: Directories contain entries for files.
347 * File Name Resolution:: A file name specifies how to look up a file.
348 * File Name Errors:: Error conditions relating to file names.
349 * File Name Portability:: File name portability and syntax issues.
353 * Streams:: About the data type representing a stream.
354 * Standard Streams:: Streams to the standard input and output
355 devices are created for you.
356 * Opening Streams:: How to create a stream to talk to a file.
357 * Closing Streams:: Close a stream when you are finished with it.
358 * Simple Output:: Unformatted output by characters and lines.
359 * Character Input:: Unformatted input by characters and words.
360 * Line Input:: Reading a line or a record from a stream.
361 * Unreading:: Peeking ahead/pushing back input just read.
362 * Formatted Output:: @code{printf} and related functions.
363 * Customizing Printf:: You can define new conversion specifiers for
364 @code{printf} and friends.
365 * Formatted Input:: @code{scanf} and related functions.
366 * Block Input/Output:: Input and output operations on blocks of data.
367 * EOF and Errors:: How you can tell if an I/O error happens.
368 * Binary Streams:: Some systems distinguish between text files
370 * File Positioning:: About random-access streams.
371 * Portable Positioning:: Random access on peculiar ISO C systems.
372 * Stream Buffering:: How to control buffering of streams.
373 * Temporary Files:: How to open a temporary file.
374 * Other Kinds of Streams:: Other Kinds of Streams
378 * Unreading Idea:: An explanation of unreading with pictures.
379 * How Unread:: How to call @code{ungetc} to do unreading.
383 * Formatted Output Basics:: Some examples to get you started.
384 * Output Conversion Syntax:: General syntax of conversion specifications.
385 * Table of Output Conversions:: Summary of output conversions, what they do.
386 * Integer Conversions:: Details of formatting integers.
387 * Floating-Point Conversions:: Details of formatting floating-point numbers.
388 * Other Output Conversions:: Details about formatting of strings,
389 characters, pointers, and the like.
390 * Formatted Output Functions:: Descriptions of the actual functions.
391 * Variable Arguments Output:: @code{vprintf} and friends.
392 * Parsing a Template String:: What kinds of arguments does
393 a given template call for?
397 * Registering New Conversions::
398 * Conversion Specifier Options::
399 * Defining the Output Handler::
400 * Printf Extension Example::
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 * Other Input Conversions:: Details of miscellaneous other conversions.
410 * Formatted Input Functions:: Descriptions of the actual functions.
411 * Variable Arguments Input:: @code{vscanf} and friends.
415 * Buffering Concepts:: Terminology is defined here.
416 * Flushing Buffers:: How to ensure that output buffers are flushed.
417 * Controlling Buffering:: How to specify what kind of buffering to use.
419 Other Kinds of Streams
424 Programming Your Own Custom Streams
426 * Streams and Cookies::
431 * Opening and Closing Files:: How to open and close file descriptors.
432 * I/O Primitives:: Reading and writing data.
433 * File Position Primitive:: Setting a descriptor's file position.
434 * Descriptors and Streams:: Converting descriptor to stream or vice-versa.
435 * Stream/Descriptor Precautions:: Precautions needed if you use both
436 descriptors and streams.
437 * Waiting for I/O:: How to check for input or output
438 on multiple file descriptors.
439 * Control Operations:: Various other operations on file descriptors.
440 * Duplicating Descriptors:: Fcntl commands for duplicating descriptors.
441 * Descriptor Flags:: Fcntl commands for manipulating flags
442 associated with file descriptors.
443 * File Status Flags:: Fcntl commands for manipulating flags
444 associated with open files.
445 * File Locks:: Fcntl commands for implementing file locking.
446 * Interrupt Input:: Getting a signal when input arrives.
448 File System Interface
450 * Working Directory:: This is used to resolve relative file names.
451 * Accessing Directories:: Finding out what files a directory contains.
452 * Hard Links:: Adding alternate names to a file.
453 * Symbolic Links:: A file that ``points to'' a file name.
454 * Deleting Files:: How to delete a file, and what that means.
455 * Renaming Files:: Changing a file's name.
456 * Creating Directories:: A system call just for creating a directory.
457 * File Attributes:: Attributes of individual files.
458 * Making Special Files:: How to create special files.
460 Accessing Directories
462 * Directory Entries:: Format of one directory entry.
463 * Opening a Directory:: How to open a directory stream.
464 * Reading/Closing Directory:: How to read directory entries from the stream.
465 * Simple Directory Lister:: A very simple directory listing program.
466 * Random Access Directory:: Rereading part of the directory
467 already read with the same stream.
471 * Attribute Meanings:: The names of the file attributes,
472 and what their values mean.
473 * Reading Attributes:: How to read the attributes of a file.
474 * Testing File Type:: Distinguishing ordinary files,
475 directories, links...
476 * File Owner:: How ownership for new files is determined,
477 and how to change it.
478 * Permission Bits:: How information about a file's access mode
480 * Access Permission:: How the system decides who can access a file.
481 * Setting Permissions:: How permissions for new files are assigned,
482 and how to change them.
483 * Testing File Access:: How to find out if your process can
485 * File Times:: About the time attributes of a file.
489 * Creating a Pipe:: Making a pipe with the @code{pipe} function.
490 * Pipe to a Subprocess:: Using a pipe to communicate with a child.
491 * FIFO Special Files:: Making a FIFO special file.
495 * Socket Concepts:: Basic concepts you need to know about.
496 * Communication Styles:: Stream communication, datagrams, and others.
497 * Socket Addresses:: How socket names (``addresses'') work.
498 * File Namespace:: Details about the file namespace.
499 * Internet Namespace:: Details about the Internet namespace.
500 * Open/Close Sockets:: Creating sockets and destroying them.
501 * Connections:: Operations on sockets with connection state.
502 * Datagrams:: Operations on datagram sockets.
503 * Socket Options:: Miscellaneous low-level socket options.
504 * Networks Database:: Accessing the database of network names.
508 * Address Formats:: About @code{struct sockaddr}.
509 * Setting Address:: Binding an address to a socket.
510 * Reading Address:: Reading the address of a socket.
514 * Internet Address Format:: How socket addresses are specified in the
516 * Host Addresses:: All about host addresses of Internet hosts.
517 * Protocols Database:: Referring to protocols by name.
518 * Services Database:: Ports may have symbolic names.
519 * Byte Order:: Different hosts may use different byte
520 ordering conventions; you need to
521 canonicalize host address and port number.
522 * Inet Example:: Putting it all together.
526 * Abstract Host Addresses:: What a host number consists of.
527 * Data type: Host Address Data Type. Data type for a host number.
528 * Functions: Host Address Functions. Functions to operate on them.
529 * Names: Host Names. Translating host names to host numbers.
533 * Creating a Socket:: How to open a socket.
534 * Closing a Socket:: How to close a socket.
535 * Socket Pairs:: These are created like pipes.
539 * Connecting:: What the client program must do.
540 * Listening:: How a server program waits for requests.
541 * Accepting Connections:: What the server does when it gets a request.
542 * Who is Connected:: Getting the address of the
543 other side of a connection.
544 * Transferring Data:: How to send and receive data.
545 * Byte Stream Example:: An example client for communicating over a
546 byte stream socket in the Internet namespace.
547 * Server Example:: A corresponding server program.
548 * Out-of-Band Data:: This is an advanced feature.
552 * Sending Data:: Sending data with @code{write}.
553 * Receiving Data:: Reading data with @code{read}.
554 * Socket Data Options:: Using @code{send} and @code{recv}.
558 * Sending Datagrams:: Sending packets on a datagram socket.
559 * Receiving Datagrams:: Receiving packets on a datagram socket.
560 * Datagram Example:: An example program: packets sent over a
561 datagram stream in the file namespace.
562 * Example Receiver:: Another program, that receives those packets.
566 * Socket Option Functions:: The basic functions for setting and getting
568 * Socket-Level Options:: Details of the options at the socket level.
570 Low-Level Terminal Interface
572 * Is It a Terminal:: How to determine if a file is a terminal
573 device, and what its name is.
574 * I/O Queues:: About flow control and typeahead.
575 * Canonical or Not:: Two basic styles of input processing.
576 * Terminal Modes:: How to examine and modify flags controlling
577 terminal I/O: echoing, signals, editing.
578 * Line Control:: Sending break sequences, clearing buffers...
579 * Noncanon Example:: How to read single characters without echo.
583 * Mode Data Types:: The data type @code{struct termios} and related types.
584 * Mode Functions:: Functions to read and set terminal attributes.
585 * Setting Modes:: The right way to set attributes reliably.
586 * Input Modes:: Flags controlling low-level input handling.
587 * Output Modes:: Flags controlling low-level output handling.
588 * Control Modes:: Flags controlling serial port behavior.
589 * Local Modes:: Flags controlling high-level input handling.
590 * Line Speed:: How to read and set the terminal line speed.
591 * Special Characters:: Characters that have special effects,
592 and how to change them.
593 * Noncanonical Input:: Controlling how long to wait for input.
597 * Editing Characters::
598 * Signal Characters::
599 * Start/Stop Characters::
603 * Domain and Range Errors:: How overflow conditions and the
605 * Not a Number:: Making NANs and testing for NANs.
606 * Trig Functions:: Sine, cosine, and tangent.
607 * Inverse Trig Functions:: Arc sine, arc cosine, and arc tangent.
608 * Exponents and Logarithms:: Also includes square root.
609 * Hyperbolic Functions:: Hyperbolic sine and friends.
610 * Pseudo-Random Numbers:: Functions for generating pseudo-random numbers.
611 * Absolute Value:: Absolute value functions.
613 Pseudo-Random Numbers
615 * ISO Random:: @code{rand} and friends.
616 * BSD Random:: @code{random} and friends.
618 Low-Level Arithmetic Functions
620 * Normalization Functions:: Hacks for radix-2 representations.
621 * Rounding and Remainders:: Determining the integer and
622 fractional parts of a float.
623 * Integer Division:: Functions for performing integer division.
624 * Parsing of Numbers:: Functions for ``reading'' numbers from strings.
625 * Predicates on Floats:: Some miscellaneous test functions.
629 * Parsing of Integers:: Functions for conversion of integer values.
630 * Parsing of Floats:: Functions for conversion of floating-point.
634 * Processor Time:: Measures processor time used by a program.
635 * Calendar Time:: Manipulation of ``real'' dates and times.
636 * Setting an Alarm:: Sending a signal after a specified time.
637 * Sleeping:: Waiting for a period of time.
641 * Basic CPU Time:: The @code{clock} function.
642 * Detailed CPU Time:: The @code{times} function.
646 * Simple Calendar Time:: Facilities for manipulating calendar time.
647 * High-Resolution Calendar:: A time representation with greater precision.
648 * Broken-down Time:: Facilities for manipulating local time.
649 * Formatting Date and Time:: Converting times to strings.
650 * TZ Variable:: How users specify the time zone.
651 * Time Zone Functions:: Functions to examine or specify the time zone.
652 * Time Functions Example:: An example program showing use of some of
657 * Concepts of Signals:: Introduction to the signal facilities.
658 * Standard Signals:: Particular kinds of signals with standard
660 * Signal Actions:: Specifying what happens when a particular
662 * Defining Handlers:: How to write a signal handler function.
663 * Generating Signals:: How to send a signal to a process.
664 * Blocking Signals:: Making the system hold signals temporarily.
665 * Waiting for a Signal:: Suspending your program until a signal arrives.
666 * Signal Stack:: Using a Separate Signal Stack
667 * BSD Signal Handling:: Additional functions for backward
668 compatibility with BSD.
670 Basic Concepts of Signals
672 * Kinds of Signals:: Some examples of what can cause a signal.
673 * Signal Generation:: Concepts of why and how signals occur.
674 * Delivery of Signal:: Concepts of what a signal does to the process.
678 * Program Error Signals:: Used to report serious program errors.
679 * Termination Signals:: Used to interrupt and/or terminate the program.
680 * Alarm Signals:: Used to indicate expiration of timers.
681 * Asynchronous I/O Signals:: Used to indicate input is available.
682 * Job Control Signals:: Signals used to support job control.
683 * Operation Error Signals:: Used to report operational system errors.
684 * Miscellaneous Signals:: Miscellaneous Signals.
685 * Signal Messages:: Printing a message describing a signal.
687 Specifying Signal Actions
689 * Basic Signal Handling:: The simple @code{signal} function.
690 * Advanced Signal Handling:: The more powerful @code{sigaction} function.
691 * Signal and Sigaction:: How those two functions interact.
692 * Sigaction Function Example:: An example of using the sigaction function.
693 * Flags for Sigaction:: Specifying options for signal handling.
694 * Initial Signal Actions:: How programs inherit signal actions.
696 Defining Signal Handlers
699 * Termination in Handler::
700 * Longjmp in Handler::
701 * Signals in Handler::
703 * Atomic Data Access::
707 * Signaling Yourself:: Signaling Yourself
708 * Signaling Another Process:: Send a signal to another process.
709 * Permission for kill:: Permission for using @code{kill}
710 * Kill Example:: Using @code{kill} for Communication
714 * Why Block:: The purpose of blocking signals.
715 * Signal Sets:: How to specify which signals to block.
716 * Process Signal Mask:: Blocking delivery of signals to your
717 process during normal execution.
718 * Testing for Delivery:: Blocking to Test for Delivery of a Signal
719 * Blocking for Handler:: Blocking additional signals while a
720 handler is being run.
721 * Checking for Pending Signals::Checking for Pending Signals
722 * Remembering a Signal:: How you can get almost the same effect
723 as blocking a signal, by handling it
724 and setting a flag to be tested later.
728 * Using Pause:: The simple way, using @code{pause}.
729 * Pause Problems:: Why the simple way is often not very good.
730 * Sigsuspend:: Reliably waiting for a specific signal.
734 * BSD Handler:: BSD Function to Establish a Handler.
735 * Blocking in BSD:: BSD Functions for Blocking Signals
737 Process Startup and Termination
739 * Program Arguments:: Parsing your program's command-line arguments.
740 * Environment Variables:: How to access parameters inherited from
742 * Program Termination:: How to cause a process to terminate and
743 return status information to its parent.
747 * Argument Syntax:: By convention, options start with a hyphen.
748 * Parsing Options:: The @code{getopt} function.
749 * Example of Getopt:: An example of parsing options with @code{getopt}.
750 * Long Options:: GNU utilities should accept long-named options.
751 Here is how to do that.
752 * Long Option Example:: An example of using @code{getopt_long}.
754 Environment Variables
756 * Environment Access:: How to get and set the values of
757 environment variables.
758 * Standard Environment:: These environment variables have
759 standard interpretations.
763 * Normal Termination:: If a program calls @code{exit}, a
764 process terminates normally.
765 * Exit Status:: The @code{exit status} provides information
766 about why the process terminated.
767 * Cleanups on Exit:: A process can run its own cleanup
768 functions upon normal termination.
769 * Aborting a Program:: The @code{abort} function causes
770 abnormal program termination.
771 * Termination Internals:: What happens when a process terminates.
776 * Running a Command:: The easy way to run another program.
777 * Process Creation Concepts:: An overview of the hard way to do it.
778 * Process Identification:: How to get the process ID of a process.
779 * Creating a Process:: How to fork a child process.
780 * Executing a File:: How to make a child execute another program.
781 * Process Completion:: How to tell when a child process has completed.
782 * Process Completion Status:: How to interpret the status value
783 returned from a child process.
784 * BSD Wait Functions:: More functions, for backward compatibility.
785 * Process Creation Example:: A complete example program.
789 * Concepts of Job Control :: Concepts of Job Control
790 * Job Control is Optional:: Not all POSIX systems support job control.
791 * Controlling Terminal:: How a process gets its controlling terminal.
792 * Access to the Terminal:: How processes share the controlling terminal.
793 * Orphaned Process Groups:: Jobs left after the user logs out.
794 * Implementing a Shell:: What a shell must do to implement job control.
795 * Functions for Job Control:: Functions to control process groups.
797 Implementing a Job Control Shell
799 * Data Structures:: Introduction to the sample shell.
800 * Initializing the Shell:: What the shell must do to take
801 responsibility for job control.
802 * Launching Jobs:: Creating jobs to execute commands.
803 * Foreground and Background:: Putting a job in foreground of background.
804 * Stopped and Terminated Jobs:: Reporting job status.
805 * Continuing Stopped Jobs:: How to continue a stopped job in
806 the foreground or background.
807 * Missing Pieces:: Other parts of the shell.
809 Functions for Job Control
811 * Identifying the Terminal:: Determining the controlling terminal's name.
812 * Process Group Functions:: Functions for manipulating process groups.
813 * Terminal Access Functions:: Functions for controlling terminal access.
817 * NSS Basics:: What is this NSS good for.
818 * NSS Configuration File:: Configuring NSS.
819 * NSS Module Internals:: How does it work internally.
820 * Extending NSS:: What to do to add services or databases.
824 * User and Group IDs:: Each user and group has a unique numeric ID.
825 * Process Persona:: The user IDs and group IDs of a process.
826 * Why Change Persona:: Why a program might need to change
827 its user and/or group IDs.
828 * How Change Persona:: Restrictions on changing user and group IDs.
829 * Reading Persona:: Examining the process's user and group IDs.
832 * Enable/Disable Setuid::
833 * Setuid Program Example:: Setuid Program Example
835 * Who Logged In:: Getting the name of the user who logged in,
836 or of the real user ID of the current process.
838 * User Database:: Functions and data structures for
839 accessing the user database.
840 * Group Database:: Functions and data structures for
841 accessing the group database.
842 * Database Example:: Example program showing use of database
847 * User Data Structure::
849 * Scanning All Users:: Scanning the List of All Users
850 * Writing a User Entry::
854 * Group Data Structure::
856 * Scanning All Groups:: Scanning the List of All Groups
860 * Host Identification:: Determining the name of the machine.
861 * Hardware/Software Type ID:: Determining the hardware type and
862 operating system type.
864 System Configuration Limits
866 * General Limits:: Constants and functions that describe
867 various process-related limits that have
868 one uniform value for any given machine.
869 * System Options:: Optional POSIX features.
870 * Version Supported:: Version numbers of POSIX.1 and POSIX.2.
871 * Sysconf:: Getting specific configuration values
872 of general limits and system options.
873 * Minimums:: Minimum values for general limits.
875 * Limits for Files:: Size limitations on individual files.
876 These can vary between file systems
877 or even from file to file.
878 * Options for Files:: Optional features that some files may support.
879 * File Minimums:: Minimum values for file limits.
880 * Pathconf:: Getting the limit values for a particular file.
882 * Utility Limits:: Capacity limits of POSIX.2 utility programs.
883 * Utility Minimums:: Minimum allowable values of those limits.
885 * String Parameters:: Getting the default search path.
887 Library Facilities that are Part of the C Language
889 * Consistency Checking:: Using @code{assert} to abort
890 if something ``impossible'' happens.
891 * Variadic Functions:: Defining functions with varying
892 numbers of arguments.
893 * Null Pointer Constant:: The macro @code{NULL}.
894 * Important Data Types:: Data types for object sizes.
895 * Data Type Measurements:: Parameters of data type representations.
899 * Why Variadic:: Reasons for making functions take
901 * How Variadic:: How to define and call variadic functions.
902 * Argument Macros:: Detailed specification of the macros
903 for accessing variable arguments.
904 * Variadic Example:: A complete example.
906 How Variadic Functions are Defined and Used
908 * Variadic Prototypes:: How to make a prototype for a function
909 with variable arguments.
910 * Receiving Arguments:: Steps you must follow to access the
911 optional argument values.
912 * How Many Arguments:: How to decide whether there are more arguments.
913 * Calling Variadics:: Things you need to know about calling
914 variable arguments functions.
916 Data Type Measurements
918 * Width of Type:: How many bits does an integer type hold?
919 * Range of Type:: What are the largest and smallest values
920 that an integer type can hold?
921 * Floating Type Macros:: Parameters that measure floating-point types.
922 * Structure Measurement:: Getting measurements on structure types.
926 * Floating Point Concepts:: Definitions of terminology.
927 * Floating Point Parameters:: Dimensions, limits of floating point types.
928 * IEEE Floating Point:: How one common representation is described.
932 * Installation:: How to configure, compile and install
934 * Reporting Bugs:: How to report bugs (if you want to
935 get them fixed) and other troubles
936 you may have with the GNU C library.
937 * Porting:: How to port the GNU C library to
938 a new machine or operating system.
939 @c * Traditional C Compatibility:: Using the GNU C library with non-ANSI
941 * Contributors:: Who wrote what parts of the GNU C Library.
943 Porting the GNU C Library
945 * Hierarchy Conventions:: How the @file{sysdeps} hierarchy is
947 * Porting to Unix:: Porting the library to an average
952 @comment Includes of all the individual chapters.
961 @include filesys.texi
964 @include terminal.texi
968 @include pattern.texi
974 @include startup.texi
975 @include process.texi
979 @include sysinfo.texi
982 @comment Includes of the appendices.
989 @node Copying, Concept Index, Maintenance, Top
990 @include lgpl.texinfo
993 @node Concept Index, Type Index, Copying, Top
994 @unnumbered Concept Index
998 @node Type Index, Function Index, Concept Index, Top
999 @unnumbered Type Index
1003 @node Function Index, Variable Index, Type Index, Top
1004 @unnumbered Function and Macro Index
1008 @node Variable Index, File Index, Function Index, Top
1009 @unnumbered Variable and Constant Macro Index
1013 @node File Index, , Variable Index, Top
1014 @unnumbered Program and File Index