1 \input texinfo @c -*- Texinfo -*-
2 @comment %**start of header (This is for running Texinfo on a region.)
4 @settitle The GNU C Library
6 @comment %**end of header (This is for running Texinfo on a region.)
8 @c This tells texinfo.tex to use the real section titles in xrefs in
9 @c place of the node name, when no section title is explicitly given.
10 @set xref-automatic-section-title
13 @c sold 0.06/1.09, print run out 21may96
14 @set EDITION 0.07 DRAFT
15 @set VERSION 2.00 Beta
16 @set UPDATED 4 Oct 1996
17 @set ISBN 1-882114-53-1
20 This file documents the GNU C library.
22 This is Edition @value{EDITION}, last updated @value{UPDATED},
23 of @cite{The GNU C Library Reference Manual}, for Version @value{VERSION}.
25 Copyright (C) 1993, '94, '95, '96 Free Software Foundation, Inc.
27 Permission is granted to make and distribute verbatim copies of
28 this manual provided the copyright notice and this permission notice
29 are preserved on all copies.
32 Permission is granted to process this file through TeX and print the
33 results, provided the printed document carries copying permission
34 notice identical to this one except for the removal of this paragraph
35 (this paragraph not being relevant to the printed manual).
38 Permission is granted to copy and distribute modified versions of this
39 manual under the conditions for verbatim copying, provided also that the
40 section entitled ``GNU Library General Public License'' is included
41 exactly as in the original, and provided that the entire resulting
42 derived work is distributed under the terms of a permission notice
43 identical to this one.
45 Permission is granted to copy and distribute translations of this manual
46 into another language, under the above conditions for modified versions,
47 except that the text of the translation of the section entitled ``GNU
48 Library General Public License'' must be approved for accuracy by the
53 @shorttitlepage The GNU C Library Reference Manual
56 @center @titlefont{The GNU C Library}
58 @center @titlefont{Reference Manual}
60 @center Sandra Loosemore
62 @center Richard M. Stallman, Roland McGrath, Andrew Oram, and Ulrich Drepper
64 @center Edition @value{EDITION}
66 @center last updated @value{UPDATED}
68 @center for version @value{VERSION}
70 @vskip 0pt plus 1filll
71 Copyright @copyright{} 1993, '94, '95, '96 Free Software Foundation, Inc.
73 Published by the Free Software Foundation @*
74 59 Temple Place -- Suite 330, @*
75 Boston, MA 02111-1307 USA @*
76 Printed copies are available for $50 each. @*
79 Permission is granted to make and distribute verbatim copies of
80 this manual provided the copyright notice and this permission notice
81 are preserved on all copies.
83 Permission is granted to copy and distribute modified versions of this
84 manual under the conditions for verbatim copying, provided also that the
85 section entitled ``GNU Library General Public License'' is included
86 exactly as in the original, and provided that the entire resulting
87 derived work is distributed under the terms of a permission notice
88 identical to this one.
90 Permission is granted to copy and distribute translations of this manual
91 into another language, under the above conditions for modified versions,
92 except that the text of the translation of the section entitled ``GNU
93 Library General Public License'' must be approved for accuracy by the
99 @node Top, Introduction, (dir), (dir)
101 This is Edition @value{EDITION}, last updated @value{UPDATED}, of
102 @cite{The GNU C Library Reference Manual}, for Version @value{VERSION}
103 of the GNU C Library.
108 * Introduction:: Purpose of the GNU C Library.
109 * Error Reporting:: How the GNU Library functions report
111 * Memory Allocation:: Your program can allocate memory dynamically
112 and manipulate it via pointers.
113 * Character Handling:: Character testing and conversion functions.
114 * String and Array Utilities:: Utilities for copying and comparing
116 * Extended Characters:: Support for extended character sets.
117 * Locales:: The country and language can affect
118 the behavior of library functions.
119 * Searching and Sorting:: General searching and sorting functions.
120 * Pattern Matching:: Matching wildcards and regular expressions,
121 and shell-style ``word expansion''.
122 * I/O Overview:: Introduction to the I/O facilities.
123 * Streams: I/O on Streams. High-level, portable I/O facilities.
124 * Low-Level I/O:: Low-level, less portable I/O.
125 * File System Interface:: Functions for manipulating files.
126 * Pipes and FIFOs:: A simple interprocess communication mechanism.
127 * Sockets:: A more complicated interprocess communication
128 mechanism, with support for networking.
129 * Low-Level Terminal Interface::How to change the characteristics
130 of a terminal device.
131 * Mathematics:: Math functions (transcendental functions,
132 random numbers, absolute value, etc.).
133 * Arithmetic:: Low-level arithmetic functions.
134 * Date and Time:: Functions for getting the date and time,
135 and for conversion between formats.
136 * Non-Local Exits:: The @code{setjmp} and @code{longjmp} facilities.
137 * Signal Handling:: All about signals; how to send them,
138 block them, and handle them.
139 * Process Startup:: Writing the beginning and end of your program.
140 * Processes:: How to create processes and run other programs.
141 * Job Control:: All about process groups and sessions.
142 * Name Service Switch:: Accessing the various system databases.
143 * Users and Groups:: How users are identified and classified.
144 * System Information:: Getting information about the
145 hardware and software configuration
146 of the machine a program runs on.
147 * System Configuration:: Parameters describing operating system limits.
151 * Language Features:: C language features provided by the library.
153 * Library Summary:: A summary showing the syntax, header file,
154 and derivation of each library feature.
155 * Maintenance:: How to install and maintain the GNU C Library.
156 * Copying:: The GNU Library General Public License says
157 how you can copy and share the GNU C Library.
161 * Concept Index:: Index of concepts and names.
162 * Type Index:: Index of types and type qualifiers.
163 * Function Index:: Index of functions and function-like macros.
164 * Variable Index:: Index of variables and variable-like macros.
165 * File Index:: Index of programs and files.
167 --- The Detailed Node Listing ---
171 * Getting Started:: Getting Started
172 * Standards and Portability:: Standards and Portability
173 * Using the Library:: Using the Library
174 * Roadmap to the Manual:: Roadmap to the Manual
176 Standards and Portability
178 * ISO C:: The American National Standard for the
179 C programming language.
180 * POSIX:: The ISO/IEC 9945 (aka IEEE 1003) standards
181 for operating systems.
182 * Berkeley Unix:: BSD and SunOS.
183 * SVID:: The System V Interface Description.
187 * Header Files:: How to use the header files in your programs.
188 * Macro Definitions:: Some functions in the library may really
189 be implemented as macros.
190 * Reserved Names:: The C standard reserves some names for
191 the library, and some for users.
192 * Feature Test Macros:: How to control what names are defined.
196 * Checking for Errors:: How errors are reported by library functions.
197 * Error Codes:: What all the error codes are.
198 * Error Messages:: Mapping error codes onto error messages.
202 * Memory Concepts:: An introduction to concepts and terminology.
203 * Dynamic Allocation and C:: How to get different kinds of allocation in C.
204 * Unconstrained Allocation:: The @code{malloc} facility allows fully general
206 * Obstacks:: Obstacks are less general than malloc
207 but more efficient and convenient.
208 * Variable Size Automatic:: Allocation of variable-sized blocks
209 of automatic storage that are freed when the
210 calling function returns.
211 * Relocating Allocator:: Waste less memory, if you can tolerate
212 automatic relocation of the blocks you get.
214 Unconstrained Allocation
216 * Basic Allocation:: Simple use of @code{malloc}.
217 * Malloc Examples:: Examples of @code{malloc}. @code{xmalloc}.
218 * Freeing after Malloc:: Use @code{free} to free a block you
219 got with @code{malloc}.
220 * Changing Block Size:: Use @code{realloc} to make a block
222 * Allocating Cleared Space:: Use @code{calloc} to allocate a
224 * Efficiency and Malloc:: Efficiency considerations in use of
226 * Aligned Memory Blocks:: Allocating specially aligned memory:
227 @code{memalign} and @code{valloc}.
228 * Heap Consistency Checking:: Automatic checking for errors.
229 * Hooks for Malloc:: You can use these hooks for debugging
230 programs that use @code{malloc}.
231 * Statistics of Malloc:: Getting information about how much
232 memory your program is using.
233 * Summary of Malloc:: Summary of @code{malloc} and related functions.
237 * Creating Obstacks:: How to declare an obstack in your program.
238 * Preparing for Obstacks:: Preparations needed before you can
240 * Allocation in an Obstack:: Allocating objects in an obstack.
241 * Freeing Obstack Objects:: Freeing objects in an obstack.
242 * Obstack Functions:: The obstack functions are both
243 functions and macros.
244 * Growing Objects:: Making an object bigger by stages.
245 * Extra Fast Growing:: Extra-high-efficiency (though more
246 complicated) growing objects.
247 * Status of an Obstack:: Inquiries about the status of an obstack.
248 * Obstacks Data Alignment:: Controlling alignment of objects in obstacks.
249 * Obstack Chunks:: How obstacks obtain and release chunks.
250 Efficiency considerations.
251 * Summary of Obstacks::
253 Automatic Storage with Variable Size
255 * Alloca Example:: Example of using @code{alloca}.
256 * Advantages of Alloca:: Reasons to use @code{alloca}.
257 * Disadvantages of Alloca:: Reasons to avoid @code{alloca}.
258 * GNU C Variable-Size Arrays:: Only in GNU C, here is an alternative
259 method of allocating dynamically and
260 freeing automatically.
263 * Relocator Concepts:: How to understand relocating allocation.
264 * Using Relocator:: Functions for relocating allocation.
268 * Classification of Characters::Testing whether characters are
269 letters, digits, punctuation, etc.
270 * Case Conversion:: Case mapping, and the like.
272 String and Array Utilities
274 * Representation of Strings:: Introduction to basic concepts.
275 * String/Array Conventions:: Whether to use a string function or an
276 arbitrary array function.
277 * String Length:: Determining the length of a string.
278 * Copying and Concatenation:: Functions to copy the contents of strings
280 * String/Array Comparison:: Functions for byte-wise and character-wise
282 * Collation Functions:: Functions for collating strings.
283 * Search Functions:: Searching for a specific element or substring.
284 * Finding Tokens in a String:: Splitting a string into tokens by looking
289 * Extended Char Intro:: Multibyte codes versus wide characters.
290 * Locales and Extended Chars:: The locale selects the character codes.
291 * Multibyte Char Intro:: How multibyte codes are represented.
292 * Wide Char Intro:: How wide characters are represented.
293 * Wide String Conversion:: Converting wide strings to multibyte code
295 * Length of Char:: how many bytes make up one multibyte char.
296 * Converting One Char:: Converting a string character by character.
297 * Example of Conversion:: Example showing why converting
298 one character at a time may be useful.
299 * Shift State:: Multibyte codes with "shift characters".
301 Locales and Internationalization
303 * Effects of Locale:: Actions affected by the choice of locale.
304 * Choosing Locale:: How the user specifies a locale.
305 * Locale Categories:: Different purposes for which
306 you can select a locale.
307 * Setting the Locale:: How a program specifies the locale.
308 * Standard Locales:: Locale names available on all systems.
309 * Numeric Formatting:: How to format numbers for the chosen locale.
311 Searching and Sorting
313 * Comparison Functions:: Defining how to compare two objects.
314 Since the sort and search facilities are
315 general, you have to specify the ordering.
316 * Array Search Function:: The @code{bsearch} function.
317 * Array Sort Function:: The @code{qsort} function.
318 * Search/Sort Example:: An example program.
322 * Wildcard Matching:: Matching a wildcard pattern against a single string.
323 * Globbing:: Finding the files that match a wildcard pattern.
324 * Regular Expressions:: Matching regular expressions against strings.
325 * Word Expansion:: Expanding shell variables, nested commands,
326 arithmetic, and wildcards.
327 This is what the shell does with shell commands.
331 * I/O Concepts:: Some basic information and terminology.
332 * File Names:: How to refer to a file.
336 * Streams and File Descriptors:: The GNU Library provides two ways
337 to access the contents of files.
338 * File Position:: The number of bytes from the
339 beginning of the file.
343 * Directories:: Directories contain entries for files.
344 * File Name Resolution:: A file name specifies how to look up a file.
345 * File Name Errors:: Error conditions relating to file names.
346 * File Name Portability:: File name portability and syntax issues.
350 * Streams:: About the data type representing a stream.
351 * Standard Streams:: Streams to the standard input and output
352 devices are created for you.
353 * Opening Streams:: How to create a stream to talk to a file.
354 * Closing Streams:: Close a stream when you are finished with it.
355 * Simple Output:: Unformatted output by characters and lines.
356 * Character Input:: Unformatted input by characters and words.
357 * Line Input:: Reading a line or a record from a stream.
358 * Unreading:: Peeking ahead/pushing back input just read.
359 * Formatted Output:: @code{printf} and related functions.
360 * Customizing Printf:: You can define new conversion specifiers for
361 @code{printf} and friends.
362 * Formatted Input:: @code{scanf} and related functions.
363 * Block Input/Output:: Input and output operations on blocks of data.
364 * EOF and Errors:: How you can tell if an I/O error happens.
365 * Binary Streams:: Some systems distinguish between text files
367 * File Positioning:: About random-access streams.
368 * Portable Positioning:: Random access on peculiar ISO C systems.
369 * Stream Buffering:: How to control buffering of streams.
370 * Temporary Files:: How to open a temporary file.
371 * Other Kinds of Streams:: Other Kinds of Streams
375 * Unreading Idea:: An explanation of unreading with pictures.
376 * How Unread:: How to call @code{ungetc} to do unreading.
380 * Formatted Output Basics:: Some examples to get you started.
381 * Output Conversion Syntax:: General syntax of conversion specifications.
382 * Table of Output Conversions:: Summary of output conversions, what they do.
383 * Integer Conversions:: Details of formatting integers.
384 * Floating-Point Conversions:: Details of formatting floating-point numbers.
385 * Other Output Conversions:: Details about formatting of strings,
386 characters, pointers, and the like.
387 * Formatted Output Functions:: Descriptions of the actual functions.
388 * Variable Arguments Output:: @code{vprintf} and friends.
389 * Parsing a Template String:: What kinds of arguments does
390 a given template call for?
394 * Registering New Conversions::
395 * Conversion Specifier Options::
396 * Defining the Output Handler::
397 * Printf Extension Example::
401 * Formatted Input Basics:: Some basics to get you started.
402 * Input Conversion Syntax:: Syntax of conversion specifications.
403 * Table of Input Conversions:: Summary of input conversions and what they do.
404 * Numeric Input Conversions:: Details of conversions for reading numbers.
405 * String Input Conversions:: Details of conversions for reading strings.
406 * Other Input Conversions:: Details of miscellaneous other conversions.
407 * Formatted Input Functions:: Descriptions of the actual functions.
408 * Variable Arguments Input:: @code{vscanf} and friends.
412 * Buffering Concepts:: Terminology is defined here.
413 * Flushing Buffers:: How to ensure that output buffers are flushed.
414 * Controlling Buffering:: How to specify what kind of buffering to use.
416 Other Kinds of Streams
421 Programming Your Own Custom Streams
423 * Streams and Cookies::
428 * Opening and Closing Files:: How to open and close file descriptors.
429 * I/O Primitives:: Reading and writing data.
430 * File Position Primitive:: Setting a descriptor's file position.
431 * Descriptors and Streams:: Converting descriptor to stream or vice-versa.
432 * Stream/Descriptor Precautions:: Precautions needed if you use both
433 descriptors and streams.
434 * Waiting for I/O:: How to check for input or output
435 on multiple file descriptors.
436 * Control Operations:: Various other operations on file descriptors.
437 * Duplicating Descriptors:: Fcntl commands for duplicating descriptors.
438 * Descriptor Flags:: Fcntl commands for manipulating flags
439 associated with file descriptors.
440 * File Status Flags:: Fcntl commands for manipulating flags
441 associated with open files.
442 * File Locks:: Fcntl commands for implementing file locking.
443 * Interrupt Input:: Getting a signal when input arrives.
445 File System Interface
447 * Working Directory:: This is used to resolve relative file names.
448 * Accessing Directories:: Finding out what files a directory contains.
449 * Hard Links:: Adding alternate names to a file.
450 * Symbolic Links:: A file that ``points to'' a file name.
451 * Deleting Files:: How to delete a file, and what that means.
452 * Renaming Files:: Changing a file's name.
453 * Creating Directories:: A system call just for creating a directory.
454 * File Attributes:: Attributes of individual files.
455 * Making Special Files:: How to create special files.
457 Accessing Directories
459 * Directory Entries:: Format of one directory entry.
460 * Opening a Directory:: How to open a directory stream.
461 * Reading/Closing Directory:: How to read directory entries from the stream.
462 * Simple Directory Lister:: A very simple directory listing program.
463 * Random Access Directory:: Rereading part of the directory
464 already read with the same stream.
468 * Attribute Meanings:: The names of the file attributes,
469 and what their values mean.
470 * Reading Attributes:: How to read the attributes of a file.
471 * Testing File Type:: Distinguishing ordinary files,
472 directories, links...
473 * File Owner:: How ownership for new files is determined,
474 and how to change it.
475 * Permission Bits:: How information about a file's access mode
477 * Access Permission:: How the system decides who can access a file.
478 * Setting Permissions:: How permissions for new files are assigned,
479 and how to change them.
480 * Testing File Access:: How to find out if your process can
482 * File Times:: About the time attributes of a file.
486 * Creating a Pipe:: Making a pipe with the @code{pipe} function.
487 * Pipe to a Subprocess:: Using a pipe to communicate with a child.
488 * FIFO Special Files:: Making a FIFO special file.
492 * Socket Concepts:: Basic concepts you need to know about.
493 * Communication Styles:: Stream communication, datagrams, and others.
494 * Socket Addresses:: How socket names (``addresses'') work.
495 * File Namespace:: Details about the file namespace.
496 * Internet Namespace:: Details about the Internet namespace.
497 * Open/Close Sockets:: Creating sockets and destroying them.
498 * Connections:: Operations on sockets with connection state.
499 * Datagrams:: Operations on datagram sockets.
500 * Socket Options:: Miscellaneous low-level socket options.
501 * Networks Database:: Accessing the database of network names.
505 * Address Formats:: About @code{struct sockaddr}.
506 * Setting Address:: Binding an address to a socket.
507 * Reading Address:: Reading the address of a socket.
511 * Internet Address Format:: How socket addresses are specified in the
513 * Host Addresses:: All about host addresses of Internet hosts.
514 * Protocols Database:: Referring to protocols by name.
515 * Services Database:: Ports may have symbolic names.
516 * Byte Order:: Different hosts may use different byte
517 ordering conventions; you need to
518 canonicalize host address and port number.
519 * Inet Example:: Putting it all together.
523 * Abstract Host Addresses:: What a host number consists of.
524 * Data type: Host Address Data Type. Data type for a host number.
525 * Functions: Host Address Functions. Functions to operate on them.
526 * Names: Host Names. Translating host names to host numbers.
530 * Creating a Socket:: How to open a socket.
531 * Closing a Socket:: How to close a socket.
532 * Socket Pairs:: These are created like pipes.
536 * Connecting:: What the client program must do.
537 * Listening:: How a server program waits for requests.
538 * Accepting Connections:: What the server does when it gets a request.
539 * Who is Connected:: Getting the address of the
540 other side of a connection.
541 * Transferring Data:: How to send and receive data.
542 * Byte Stream Example:: An example client for communicating over a
543 byte stream socket in the Internet namespace.
544 * Server Example:: A corresponding server program.
545 * Out-of-Band Data:: This is an advanced feature.
549 * Sending Data:: Sending data with @code{write}.
550 * Receiving Data:: Reading data with @code{read}.
551 * Socket Data Options:: Using @code{send} and @code{recv}.
555 * Sending Datagrams:: Sending packets on a datagram socket.
556 * Receiving Datagrams:: Receiving packets on a datagram socket.
557 * Datagram Example:: An example program: packets sent over a
558 datagram stream in the file namespace.
559 * Example Receiver:: Another program, that receives those packets.
563 * Socket Option Functions:: The basic functions for setting and getting
565 * Socket-Level Options:: Details of the options at the socket level.
567 Low-Level Terminal Interface
569 * Is It a Terminal:: How to determine if a file is a terminal
570 device, and what its name is.
571 * I/O Queues:: About flow control and typeahead.
572 * Canonical or Not:: Two basic styles of input processing.
573 * Terminal Modes:: How to examine and modify flags controlling
574 terminal I/O: echoing, signals, editing.
575 * Line Control:: Sending break sequences, clearing buffers...
576 * Noncanon Example:: How to read single characters without echo.
580 * Mode Data Types:: The data type @code{struct termios} and related types.
581 * Mode Functions:: Functions to read and set terminal attributes.
582 * Setting Modes:: The right way to set attributes reliably.
583 * Input Modes:: Flags controlling low-level input handling.
584 * Output Modes:: Flags controlling low-level output handling.
585 * Control Modes:: Flags controlling serial port behavior.
586 * Local Modes:: Flags controlling high-level input handling.
587 * Line Speed:: How to read and set the terminal line speed.
588 * Special Characters:: Characters that have special effects,
589 and how to change them.
590 * Noncanonical Input:: Controlling how long to wait for input.
594 * Editing Characters::
595 * Signal Characters::
596 * Start/Stop Characters::
600 * Domain and Range Errors:: How overflow conditions and the
602 * Not a Number:: Making NANs and testing for NANs.
603 * Trig Functions:: Sine, cosine, and tangent.
604 * Inverse Trig Functions:: Arc sine, arc cosine, and arc tangent.
605 * Exponents and Logarithms:: Also includes square root.
606 * Hyperbolic Functions:: Hyperbolic sine and friends.
607 * Pseudo-Random Numbers:: Functions for generating pseudo-random numbers.
608 * Absolute Value:: Absolute value functions.
610 Pseudo-Random Numbers
612 * ISO Random:: @code{rand} and friends.
613 * BSD Random:: @code{random} and friends.
615 Low-Level Arithmetic Functions
617 * Normalization Functions:: Hacks for radix-2 representations.
618 * Rounding and Remainders:: Determining the integer and
619 fractional parts of a float.
620 * Integer Division:: Functions for performing integer division.
621 * Parsing of Numbers:: Functions for ``reading'' numbers from strings.
622 * Predicates on Floats:: Some miscellaneous test functions.
626 * Parsing of Integers:: Functions for conversion of integer values.
627 * Parsing of Floats:: Functions for conversion of floating-point.
631 * Processor Time:: Measures processor time used by a program.
632 * Calendar Time:: Manipulation of ``real'' dates and times.
633 * Setting an Alarm:: Sending a signal after a specified time.
634 * Sleeping:: Waiting for a period of time.
638 * Basic CPU Time:: The @code{clock} function.
639 * Detailed CPU Time:: The @code{times} function.
643 * Simple Calendar Time:: Facilities for manipulating calendar time.
644 * High-Resolution Calendar:: A time representation with greater precision.
645 * Broken-down Time:: Facilities for manipulating local time.
646 * Formatting Date and Time:: Converting times to strings.
647 * TZ Variable:: How users specify the time zone.
648 * Time Zone Functions:: Functions to examine or specify the time zone.
649 * Time Functions Example:: An example program showing use of some of
654 * Concepts of Signals:: Introduction to the signal facilities.
655 * Standard Signals:: Particular kinds of signals with standard
657 * Signal Actions:: Specifying what happens when a particular
659 * Defining Handlers:: How to write a signal handler function.
660 * Generating Signals:: How to send a signal to a process.
661 * Blocking Signals:: Making the system hold signals temporarily.
662 * Waiting for a Signal:: Suspending your program until a signal arrives.
663 * Signal Stack:: Using a Separate Signal Stack
664 * BSD Signal Handling:: Additional functions for backward
665 compatibility with BSD.
667 Basic Concepts of Signals
669 * Kinds of Signals:: Some examples of what can cause a signal.
670 * Signal Generation:: Concepts of why and how signals occur.
671 * Delivery of Signal:: Concepts of what a signal does to the process.
675 * Program Error Signals:: Used to report serious program errors.
676 * Termination Signals:: Used to interrupt and/or terminate the program.
677 * Alarm Signals:: Used to indicate expiration of timers.
678 * Asynchronous I/O Signals:: Used to indicate input is available.
679 * Job Control Signals:: Signals used to support job control.
680 * Operation Error Signals:: Used to report operational system errors.
681 * Miscellaneous Signals:: Miscellaneous Signals.
682 * Signal Messages:: Printing a message describing a signal.
684 Specifying Signal Actions
686 * Basic Signal Handling:: The simple @code{signal} function.
687 * Advanced Signal Handling:: The more powerful @code{sigaction} function.
688 * Signal and Sigaction:: How those two functions interact.
689 * Sigaction Function Example:: An example of using the sigaction function.
690 * Flags for Sigaction:: Specifying options for signal handling.
691 * Initial Signal Actions:: How programs inherit signal actions.
693 Defining Signal Handlers
696 * Termination in Handler::
697 * Longjmp in Handler::
698 * Signals in Handler::
700 * Atomic Data Access::
704 * Signaling Yourself:: Signaling Yourself
705 * Signaling Another Process:: Send a signal to another process.
706 * Permission for kill:: Permission for using @code{kill}
707 * Kill Example:: Using @code{kill} for Communication
711 * Why Block:: The purpose of blocking signals.
712 * Signal Sets:: How to specify which signals to block.
713 * Process Signal Mask:: Blocking delivery of signals to your
714 process during normal execution.
715 * Testing for Delivery:: Blocking to Test for Delivery of a Signal
716 * Blocking for Handler:: Blocking additional signals while a
717 handler is being run.
718 * Checking for Pending Signals::Checking for Pending Signals
719 * Remembering a Signal:: How you can get almost the same effect
720 as blocking a signal, by handling it
721 and setting a flag to be tested later.
725 * Using Pause:: The simple way, using @code{pause}.
726 * Pause Problems:: Why the simple way is often not very good.
727 * Sigsuspend:: Reliably waiting for a specific signal.
731 * BSD Handler:: BSD Function to Establish a Handler.
732 * Blocking in BSD:: BSD Functions for Blocking Signals
734 Process Startup and Termination
736 * Program Arguments:: Parsing your program's command-line arguments.
737 * Environment Variables:: How to access parameters inherited from
739 * Program Termination:: How to cause a process to terminate and
740 return status information to its parent.
744 * Argument Syntax:: By convention, options start with a hyphen.
745 * Parsing Options:: The @code{getopt} function.
746 * Example of Getopt:: An example of parsing options with @code{getopt}.
747 * Long Options:: GNU utilities should accept long-named options.
748 Here is how to do that.
749 * Long Option Example:: An example of using @code{getopt_long}.
751 Environment Variables
753 * Environment Access:: How to get and set the values of
754 environment variables.
755 * Standard Environment:: These environment variables have
756 standard interpretations.
760 * Normal Termination:: If a program calls @code{exit}, a
761 process terminates normally.
762 * Exit Status:: The @code{exit status} provides information
763 about why the process terminated.
764 * Cleanups on Exit:: A process can run its own cleanup
765 functions upon normal termination.
766 * Aborting a Program:: The @code{abort} function causes
767 abnormal program termination.
768 * Termination Internals:: What happens when a process terminates.
773 * Running a Command:: The easy way to run another program.
774 * Process Creation Concepts:: An overview of the hard way to do it.
775 * Process Identification:: How to get the process ID of a process.
776 * Creating a Process:: How to fork a child process.
777 * Executing a File:: How to make a child execute another program.
778 * Process Completion:: How to tell when a child process has completed.
779 * Process Completion Status:: How to interpret the status value
780 returned from a child process.
781 * BSD Wait Functions:: More functions, for backward compatibility.
782 * Process Creation Example:: A complete example program.
786 * Concepts of Job Control :: Concepts of Job Control
787 * Job Control is Optional:: Not all POSIX systems support job control.
788 * Controlling Terminal:: How a process gets its controlling terminal.
789 * Access to the Terminal:: How processes share the controlling terminal.
790 * Orphaned Process Groups:: Jobs left after the user logs out.
791 * Implementing a Shell:: What a shell must do to implement job control.
792 * Functions for Job Control:: Functions to control process groups.
794 Implementing a Job Control Shell
796 * Data Structures:: Introduction to the sample shell.
797 * Initializing the Shell:: What the shell must do to take
798 responsibility for job control.
799 * Launching Jobs:: Creating jobs to execute commands.
800 * Foreground and Background:: Putting a job in foreground of background.
801 * Stopped and Terminated Jobs:: Reporting job status.
802 * Continuing Stopped Jobs:: How to continue a stopped job in
803 the foreground or background.
804 * Missing Pieces:: Other parts of the shell.
806 Functions for Job Control
808 * Identifying the Terminal:: Determining the controlling terminal's name.
809 * Process Group Functions:: Functions for manipulating process groups.
810 * Terminal Access Functions:: Functions for controlling terminal access.
814 * NSS Basics:: What is this NSS good for.
815 * NSS Configuration File:: Configuring NSS.
816 * NSS Module Internals:: How does it work internally.
817 * Extending NSS:: What to do to add services or databases.
821 * User and Group IDs:: Each user and group has a unique numeric ID.
822 * Process Persona:: The user IDs and group IDs of a process.
823 * Why Change Persona:: Why a program might need to change
824 its user and/or group IDs.
825 * How Change Persona:: Restrictions on changing user and group IDs.
826 * Reading Persona:: Examining the process's user and group IDs.
829 * Enable/Disable Setuid::
830 * Setuid Program Example:: Setuid Program Example
832 * Who Logged In:: Getting the name of the user who logged in,
833 or of the real user ID of the current process.
835 * User Database:: Functions and data structures for
836 accessing the user database.
837 * Group Database:: Functions and data structures for
838 accessing the group database.
839 * Database Example:: Example program showing use of database
844 * User Data Structure::
846 * Scanning All Users:: Scanning the List of All Users
847 * Writing a User Entry::
851 * Group Data Structure::
853 * Scanning All Groups:: Scanning the List of All Groups
857 * Host Identification:: Determining the name of the machine.
858 * Hardware/Software Type ID:: Determining the hardware type and
859 operating system type.
861 System Configuration Limits
863 * General Limits:: Constants and functions that describe
864 various process-related limits that have
865 one uniform value for any given machine.
866 * System Options:: Optional POSIX features.
867 * Version Supported:: Version numbers of POSIX.1 and POSIX.2.
868 * Sysconf:: Getting specific configuration values
869 of general limits and system options.
870 * Minimums:: Minimum values for general limits.
872 * Limits for Files:: Size limitations on individual files.
873 These can vary between file systems
874 or even from file to file.
875 * Options for Files:: Optional features that some files may support.
876 * File Minimums:: Minimum values for file limits.
877 * Pathconf:: Getting the limit values for a particular file.
879 * Utility Limits:: Capacity limits of POSIX.2 utility programs.
880 * Utility Minimums:: Minimum allowable values of those limits.
882 * String Parameters:: Getting the default search path.
884 Library Facilities that are Part of the C Language
886 * Consistency Checking:: Using @code{assert} to abort
887 if something ``impossible'' happens.
888 * Variadic Functions:: Defining functions with varying
889 numbers of arguments.
890 * Null Pointer Constant:: The macro @code{NULL}.
891 * Important Data Types:: Data types for object sizes.
892 * Data Type Measurements:: Parameters of data type representations.
896 * Why Variadic:: Reasons for making functions take
898 * How Variadic:: How to define and call variadic functions.
899 * Argument Macros:: Detailed specification of the macros
900 for accessing variable arguments.
901 * Variadic Example:: A complete example.
903 How Variadic Functions are Defined and Used
905 * Variadic Prototypes:: How to make a prototype for a function
906 with variable arguments.
907 * Receiving Arguments:: Steps you must follow to access the
908 optional argument values.
909 * How Many Arguments:: How to decide whether there are more arguments.
910 * Calling Variadics:: Things you need to know about calling
911 variable arguments functions.
913 Data Type Measurements
915 * Width of Type:: How many bits does an integer type hold?
916 * Range of Type:: What are the largest and smallest values
917 that an integer type can hold?
918 * Floating Type Macros:: Parameters that measure floating-point types.
919 * Structure Measurement:: Getting measurements on structure types.
923 * Floating Point Concepts:: Definitions of terminology.
924 * Floating Point Parameters:: Dimensions, limits of floating point types.
925 * IEEE Floating Point:: How one common representation is described.
929 * Installation:: How to configure, compile and install
931 * Reporting Bugs:: How to report bugs (if you want to
932 get them fixed) and other troubles
933 you may have with the GNU C library.
934 * Porting:: How to port the GNU C library to
935 a new machine or operating system.
936 @c * Traditional C Compatibility:: Using the GNU C library with non-ANSI
938 * Contributors:: Who wrote what parts of the GNU C Library.
940 Porting the GNU C Library
942 * Hierarchy Conventions:: How the @file{sysdeps} hierarchy is
944 * Porting to Unix:: Porting the library to an average
949 @comment Includes of all the individual chapters.
958 @include filesys.texi
961 @include terminal.texi
965 @include pattern.texi
971 @include startup.texi
972 @include process.texi
976 @include sysinfo.texi
979 @comment Includes of the appendices.
986 @node Copying, Concept Index, Maintenance, Top
987 @include lgpl.texinfo
990 @node Concept Index, Type Index, Copying, Top
991 @unnumbered Concept Index
995 @node Type Index, Function Index, Concept Index, Top
996 @unnumbered Type Index
1000 @node Function Index, Variable Index, Type Index, Top
1001 @unnumbered Function and Macro Index
1005 @node Variable Index, File Index, Function Index, Top
1006 @unnumbered Variable and Constant Macro Index
1010 @node File Index, , Variable Index, Top
1011 @unnumbered Program and File Index