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