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