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