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