1 2 Linux Standard Base Specification 2.1 3 4 Copyright © 2000, 2001, 2002, 2003, 2004 Free Standards Group 5 6 Permission is granted to copy, distribute and/or modify this 7 document under the terms of the GNU Free Documentation 8 License, Version 1.1; with no Invariant Sections, with no 9 Front-Cover Texts, and with no Back-Cover Texts. A copy of the 10 license is included in the section entitled "GNU Free 11 Documentation License". 12 13 Portions of the text are copyrighted by the following parties: 14 15 * The Regents of the University of California 16 * Free Software Foundation 17 * Ian F. Darwin 18 * Paul Vixie 19 * BSDI (now Wind River) 20 * Andrew G Morgan 21 * Jean-loup Gailly and Mark Adler 22 * Massachusetts Institute of Technology 23 24 These excerpts are being used in accordance with their 25 respective licenses. 26 27 Linux is a trademark of Linus Torvalds. 28 29 UNIX a registered trademark of the Open Group in the United 30 States and other countries. 31 32 LSB is a trademark of the Free Standards Group in the USA and 33 other countries. 34 35 AMD is a trademark of Advanced Micro Devices, Inc. 36 37 Intel and Itanium are registered trademarks and Intel386 is a 38 trademarks of Intel Corporation. 39 40 OpenGL is a registered trademark of Silicon Graphics, Inc. 41 _________________________________________________________ 42 43 Table of Contents 44 Foreword 45 Introduction 46 I. Introductory Elements 47 48 1. Scope 49 50 1.1. General 51 1.2. Module Specific Scope 52 53 2. Normative References 54 3. Requirements 55 56 3.1. Relevant Libraries 57 3.2. LSB Implementation Conformance 58 3.3. LSB Application Conformance 59 60 4. Definitions 61 5. Terminology 62 6. Documentation Conventions 63 64 II. Base Libraries 65 66 7. Libraries 67 68 7.1. Introduction 69 7.2. Program Interpreter 70 7.3. Interfaces for libc 71 7.4. Data Definitions for libc 72 7.5. Interface Definitions for libc 73 7.6. Interfaces for libm 74 7.7. Data Definitions for libm 75 7.8. Interface Definitions for libm 76 7.9. Interfaces for libpthread 77 7.10. Data Definitions for libpthread 78 7.11. Interface Definitions for libpthread 79 7.12. Interfaces for libgcc_s 80 7.13. Data Definitions for libgcc_s 81 7.14. Interfaces for libdl 82 7.15. Data Definitions for libdl 83 7.16. Interface Definitions for libdl 84 7.17. Interfaces for libcrypt 85 7.18. Interfaces for libpam 86 7.19. Data Definitions for libpam 87 7.20. Interface Definitions for libpam 88 89 III. Utility Libraries 90 91 8. Utility Libraries 92 93 8.1. Interfaces for libz 94 8.2. Data Definitions for libz 95 8.3. Interface Definitions for libz 96 8.4. Interfaces for libncurses 97 8.5. Data Definitions for libncurses 98 8.6. Interfaces for libutil 99 8.7. Interface Definitions for libutil 100 101 IV. Commands and Utilities 102 103 9. Commands and Utilities 104 105 9.1. Commands and Utilities 106 9.2. Command Behavior 107 108 V. Execution Environment 109 110 10. File System Hierarchy 111 112 10.1. /dev 113 10.2. User Accounting Databases 114 115 11. Additional Recommendations 116 117 11.1. Minimal granted Directory and File 118 permissions 119 120 11.2. Recommendations for applications on ownership 121 and permissions 122 123 12. Additional Behaviors 124 125 12.1. Mandatory Optional Behaviors 126 127 13. Localization 128 129 13.1. Regular Expressions 130 13.2. Pattern Matching Notation 131 132 VI. System Initialization 133 134 14. System Initialization 135 136 14.1. Cron Jobs 137 14.2. Init Script Actions 138 14.3. Comment Conventions for Init Scripts 139 14.4. Installation and Removal of init.d Files 140 14.5. Run Levels 141 14.6. Facility Names 142 14.7. Script Names 143 14.8. Init Script Functions 144 145 VII. Users & Groups 146 147 15. Users & Groups 148 149 15.1. User and Group Database 150 15.2. User & Group Names 151 15.3. UID Ranges 152 15.4. Rationale 153 154 A. GNU Free Documentation License 155 156 A.1. PREAMBLE 157 A.2. APPLICABILITY AND DEFINITIONS 158 A.3. VERBATIM COPYING 159 A.4. COPYING IN QUANTITY 160 A.5. MODIFICATIONS 161 A.6. COMBINING DOCUMENTS 162 A.7. COLLECTIONS OF DOCUMENTS 163 A.8. AGGREGATION WITH INDEPENDENT WORKS 164 A.9. TRANSLATION 165 A.10. TERMINATION 166 A.11. FUTURE REVISIONS OF THIS LICENSE 167 A.12. How to use this License for your documents 168 169 List of Tables 170 2-1. Normative References 171 3-1. Standard Library Names 172 3-2. Standard Library Names defined in the Architecture 173 Specific Supplement 174 175 7-1. libc Definition 176 7-2. libc - RPC Function Interfaces 177 7-3. libc - RPC Deprecated Function Interfaces 178 7-4. libc - System Calls Function Interfaces 179 7-5. libc - System Calls Deprecated Function Interfaces 180 7-6. libc - Standard I/O Function Interfaces 181 7-7. libc - Standard I/O Data Interfaces 182 7-8. libc - Signal Handling Function Interfaces 183 7-9. libc - Signal Handling Deprecated Function Interfaces 184 7-10. libc - Signal Handling Data Interfaces 185 7-11. libc - Localization Functions Function Interfaces 186 7-12. libc - Localization Functions Data Interfaces 187 7-13. libc - Socket Interface Function Interfaces 188 7-14. libc - Socket Interface Deprecated Function Interfaces 189 7-15. libc - Wide Characters Function Interfaces 190 7-16. libc - String Functions Function Interfaces 191 7-17. libc - String Functions Deprecated Function Interfaces 192 7-18. libc - IPC Functions Function Interfaces 193 7-19. libc - Regular Expressions Function Interfaces 194 7-20. libc - Regular Expressions Deprecated Function 195 Interfaces 196 197 7-21. libc - Regular Expressions Deprecated Data Interfaces 198 7-22. libc - Character Type Functions Function Interfaces 199 7-23. libc - Time Manipulation Function Interfaces 200 7-24. libc - Time Manipulation Deprecated Function Interfaces 201 7-25. libc - Time Manipulation Data Interfaces 202 7-26. libc - Terminal Interface Functions Function Interfaces 203 7-27. libc - System Database Interface Function Interfaces 204 7-28. libc - System Database Interface Deprecated Function 205 Interfaces 206 207 7-29. libc - Language Support Function Interfaces 208 7-30. libc - Large File Support Function Interfaces 209 7-31. libc - Standard Library Function Interfaces 210 7-32. libc - Standard Library Deprecated Function Interfaces 211 7-33. libc - Standard Library Data Interfaces 212 7-1. Examples 213 7-35. libm Definition 214 7-36. libm - Math Function Interfaces 215 7-37. libm - Math Data Interfaces 216 7-38. libpthread Definition 217 7-39. libpthread - Posix Threads Function Interfaces 218 7-40. libgcc_s Definition 219 7-41. libdl Definition 220 7-42. libdl - Dynamic Loader Function Interfaces 221 7-43. libcrypt Definition 222 7-44. libcrypt - Encryption Function Interfaces 223 7-45. libpam Definition 224 7-46. libpam - Pluggable Authentication API Function 225 Interfaces 226 227 8-1. libz Definition 228 8-2. libz - Compression Library Function Interfaces 229 8-3. libncurses Definition 230 8-4. libncurses - Curses Function Interfaces 231 8-5. libncurses - Curses Data Interfaces 232 8-6. libutil Definition 233 8-7. libutil - Utility Functions Function Interfaces 234 9-1. Commands and Utilities 235 9-1. Escape Sequences 236 15-1. Required User & Group Names 237 15-2. Optional User & Group Names 238 _________________________________________________________ 239 240 Foreword 241 242 This is version 2.1 of the Linux Standard Base Specification. 243 An implementation of this version of the specification may not 244 claim to be an implementation of the Linux Standard Base 245 unless it has successfully completed the compliance process as 246 defined by the Free Standards Group. 247 _________________________________________________________ 248 249 Introduction 250 251 The LSB defines a binary interface for application programs 252 that are compiled and packaged for LSB-conforming 253 implementations on many different hardware architectures. 254 Since a binary specification shall include information 255 specific to the computer processor architecture for which it 256 is intended, it is not possible for a single document to 257 specify the interface for all possible LSB-conforming 258 implementations. Therefore, the LSB is a family of 259 specifications, rather than a single one. 260 261 This document should be used in conjunction with the documents 262 it references. This document enumerates the system components 263 it includes, but descriptions of those components may be 264 included entirely or partly in this document, partly in other 265 documents, or entirely in other reference documents. For 266 example, the section that describes system service routines 267 includes a list of the system routines supported in this 268 interface, formal declarations of the data structures they use 269 that are visible to applications, and a pointer to the 270 underlying referenced specification for information about the 271 syntax and semantics of each call. Only those routines not 272 described in standards referenced by this document, or 273 extensions to those standards, are described in the detail. 274 Information referenced in this way is as much a part of this 275 document as is the information explicitly included here. 276 277 The specification carries a version number of either the form 278 x.y or x.y.z. This version number carries the following 279 meaning: 280 281 * The first number (x) is the major version number. All 282 versions with the same major version number should share 283 binary compatibility. Any addition or deletion of a new 284 library results in a new version number. Interfaces marked 285 as deprecated may be removed from the specification at a 286 major version change. 287 * The second number (y) is the minor version number. 288 Individual interfaces may be added if all certified 289 implementations already had that (previously undocumented) 290 interface. Interfaces may be marked as deprecated at a 291 minor version change. Other minor changes may be permitted 292 at the discretion of the LSB workgroup. 293 * The third number (z), if present, is the editorial level. 294 Only editorial changes should be included in such 295 versions. 296 297 I. Introductory Elements 298 299 Table of Contents 300 1. Scope 301 2. Normative References 302 3. Requirements 303 4. Definitions 304 5. Terminology 305 6. Documentation Conventions 306 _________________________________________________________ 307 308 Chapter 1. Scope 309 310 1.1. General 311 312 The Linux Standard Base (LSB) defines a system interface for 313 compiled applications and a minimal environment for support of 314 installation scripts. Its purpose is to enable a uniform 315 industry standard environment for high-volume applications 316 conforming to the LSB. 317 318 These specifications are composed of two basic parts: A common 319 specification ("LSB-generic") describing those parts of the 320 interface that remain constant across all implementations of 321 the LSB, and an architecture-specific specification 322 ("LSB-arch") describing the parts of the interface that vary 323 by processor architecture. Together, the LSB-generic and the 324 architecture-specific supplement for a single hardware 325 architecture provide a complete interface specification for 326 compiled application programs on systems that share a common 327 hardware architecture. 328 329 The LSB-generic document shall be used in conjunction with an 330 architecture-specific supplement. Whenever a section of the 331 LSB-generic specification shall be supplemented by 332 architecture-specific information, the LSB-generic document 333 includes a reference to the architecture supplement. 334 Architecture supplements may also contain additional 335 information that is not referenced in the LSB-generic 336 document. 337 338 The LSB contains both a set of Application Program Interfaces 339 (APIs) and Application Binary Interfaces (ABIs). APIs may 340 appear in the source code of portable applications, while the 341 compiled binary of that application may use the larger set of 342 ABIs. A conforming implementation shall provide all of the 343 ABIs listed here. The compilation system may replace (e.g. by 344 macro definition) certain APIs with calls to one or more of 345 the underlying binary interfaces, and may insert calls to 346 binary interfaces as needed. 347 348 The LSB is primarily a binary interface definition. Not all of 349 the source level APIs available to applications may be 350 contained in this specification. 351 _________________________________________________________ 352 353 1.2. Module Specific Scope 354 355 This is the Core module of the Linux Standards Base (LSB). 356 This module provides the fundamental system interfaces, 357 libraries, and runtime environment upon which all conforming 358 applications and libraries depend. 359 360 Interfaces described in this module are mandatory except where 361 explicitly listed otherwise. Core interfaces may be 362 supplemented by other modules; all modules are built upon the 363 core. 364 _________________________________________________________ 365 366 Chapter 2. Normative References 367 368 The specifications listed below are referenced in whole or in 369 part by the Linux Standard Base. In this specification, where 370 only a particular section of one of these references is 371 identified, then the normative reference is to that section 372 alone, and the rest of the referenced document is informative. 373 374 Table 2-1. Normative References 375 Name Title URL 376 DWARF Debugging Information Format DWARF Debugging Information 377 Format, Revision 2.0.0 (July 27, 1993) 378 http://www.eagercon.com/dwarf/dwarf-2.0.0.pdf 379 Filesystem Hierarchy Standard Filesystem Hierarchy Standard 380 (FHS) 2.3 http://www.pathname.com/fhs/ 381 IEEE Std 754-1985 IEEE Standard 754 for Binary Floating-Point 382 Arithmetic http://www.ieee.org/ 383 ISO C (1999) ISO/IEC 9899: 1999, Programming Languages --C 384 ISO POSIX (2003) 385 386 ISO/IEC 9945-1:2003 Information technology -- Portable 387 Operating System Interface (POSIX) -- Part 1: Base Definitions 388 389 ISO/IEC 9945-2:2003 Information technology -- Portable 390 Operating System Interface (POSIX) -- Part 2: System 391 Interfaces 392 393 ISO/IEC 9945-3:2003 Information technology -- Portable 394 Operating System Interface (POSIX) -- Part 3: Shell and 395 Utilities 396 397 ISO/IEC 9945-4:2003 Information technology -- Portable 398 Operating System Interface (POSIX) -- Part 4: Rationale 399 http://www.unix.org/version3/ 400 ITU-T V.42 International Telecommunication Union 401 Recommendation V.42 (2002): Error-correcting procedures for 402 DCEs using asynchronous-to-synchronous conversionITUV 403 http://www.itu.int/rec/recommendation.asp?type=folders&lang=e& 404 parent=T-REC-V.42 405 Large File Support Large File Support 406 http://www.UNIX-systems.org/version2/whatsnew/lfs20mar.html 407 Li18nux Globalization Specification LI18NUX 2000 Globalization 408 Specification, Version 1.0 with Amendment 4 409 http://www.li18nux.org/docs/html/LI18NUX-2000-amd4.htm 410 Linux Allocated Device Registry LINUX ALLOCATED DEVICES 411 http://www.lanana.org/docs/device-list/devices.txt 412 PAM Open Software Foundation, Request For Comments: 86.0 , 413 October 1995, V. Samar & R.Schemers (SunSoft) 414 http://www.opengroup.org/tech/rfc/mirror-rfc/rfc86.0.txt 415 RFC 1321: The MD5 Message-Digest Algorithm IETF RFC 1321: The 416 MD5 Message-Digest Algorithm 417 http://www.ietf.org/rfc/rfc1321.txt 418 RFC 1833: Binding Protocols for ONC RPC Version 2 IETF RFC 419 1833: Binding Protocols for ONC RPC Version 2 420 http://www.ietf.org/rfc/rfc1833.txt 421 RFC 1950: ZLIB Compressed Data Format Specication IETF RFC 422 1950: ZLIB Compressed Data Format Specification 423 http://www.ietf.org/rfc/rfc1950.txt 424 RFC 1951: DEFLATE Compressed Data Format Specification IETF 425 RFC 1951: DEFLATE Compressed Data Format Specification version 426 1.3 http://www.ietf.org/rfc/rfc1951.txt 427 RFC 1952: GZIP File Format Specification IETF RFC 1952: GZIP 428 file format specification version 4.3 429 http://www.ietf.org/rfc/rfc1952.txt 430 RFC 2440: OpenPGP Message Format IETF RFC 2440: OpenPGP 431 Message Format http://www.ietf.org/rfc/rfc2440.txt 432 SUSv2 CAE Specification, January 1997, System Interfaces and 433 Headers (XSH),Issue 5 (ISBN: 1-85912-181-0, C606) 434 http://www.opengroup.org/publications/catalog/un.htm 435 SUSv2 Command and Utilities The Single UNIX® 436 Specification(SUS) Version 2, Commands and Utilities (XCU), 437 Issue 5 (ISBN: 1-85912-191-8, C604) 438 http://www.opengroup.org/publications/catalog/un.htm 439 SVID Issue 3 American Telephone and Telegraph Company, System 440 V Interface Definition, Issue 3 ; Morristown, NJ, UNIX Press, 441 1989.(ISBN 0201566524) 442 SVID Issue 4 System V Interface Definition,Fourth Edition 443 System V ABI System V Application Binary Interface, Edition 444 4.1 http://www.caldera.com/developers/devspecs/gabi41.pdf 445 System V ABI Update System V Application Binary Interface - 446 DRAFT - 17 December 2003 447 http://www.caldera.com/developers/gabi/2003-12-17/contents.htm 448 l 449 this specification Linux Standard Base 450 http://www.linuxbase.org/spec/ 451 X/Open Curses CAE Specification, May 1996, X/Open Curses, 452 Issue 4, Version 2 (ISBN: 1-85912-171-3, C610), plus 453 Corrigendum U018 454 http://www.opengroup.org/publications/catalog/un.htm 455 _________________________________________________________ 456 457 Chapter 3. Requirements 458 459 3.1. Relevant Libraries 460 461 The libraries listed in Table 3-1 shall be available on a 462 Linux Standard Base system, with the specified runtime names. 463 The libraries listed in Table 3-2 are architecture specific, 464 but shall be available on all LSB conforming systems. This 465 list may be supplemented or amended by the 466 architecture-specific specification. 467 468 Table 3-1. Standard Library Names 469 Library Runtime Name 470 libdl libdl.so.2 471 libcrypt libcrypt.so.1 472 libz libz.so.1 473 libncurses libncurses.so.5 474 libutil libutil.so.1 475 libpthread libpthread.so.0 476 libpam libpam.so.0 477 libgcc_s libgcc_s.so.1 478 479 Table 3-2. Standard Library Names defined in the Architecture 480 Specific Supplement 481 Library Runtime Name 482 libm See archLSB 483 libc See archLSB 484 proginterp See archLSB 485 486 These libraries will be in an implementation-defined directory 487 which the dynamic linker shall search by default. 488 _________________________________________________________ 489 490 3.2. LSB Implementation Conformance 491 492 A conforming implementation shall satisfy the following 493 requirements: 494 495 * The implementation shall implement fully the architecture 496 described in the hardware manual for the target processor 497 architecture. 498 * The implementation shall be capable of executing compiled 499 applications having the format and using the system 500 interfaces described in this document. 501 * The implementation shall provide libraries containing the 502 interfaces specified by this document, and shall provide a 503 dynamic linking mechanism that allows these interfaces to 504 be attached to applications at runtime. All the interfaces 505 shall behave as specified in this document. 506 * The map of virtual memory provided by the implementation 507 shall conform to the requirements of this document. 508 * The implementation's low-level behavior with respect to 509 function call linkage, system traps, signals, and other 510 such activities shall conform to the formats described in 511 this document. 512 * The implementation shall provide all of the mandatory 513 interfaces in their entirety. 514 * The implementation may provide one or more of the optional 515 interfaces. Each optional interface that is provided shall 516 be provided in its entirety. The product documentation 517 shall state which optional interfaces are provided. 518 * The implementation shall provide all files and utilities 519 specified as part of this document in the format defined 520 here and in other referenced documents. All commands and 521 utilities shall behave as required by this document. The 522 implementation shall also provide all mandatory components 523 of an application's runtime environment that are included 524 or referenced in this document. 525 * The implementation, when provided with standard data 526 formats and values at a named interface, shall provide the 527 behavior defined for those values and data formats at that 528 interface. However, a conforming implementation may 529 consist of components which are separately packaged and/or 530 sold. For example, a vendor of a conforming implementation 531 might sell the hardware, operating system, and windowing 532 system as separately packaged items. 533 * The implementation may provide additional interfaces with 534 different names. It may also provide additional behavior 535 corresponding to data values outside the standard ranges, 536 for standard named interfaces. 537 _________________________________________________________ 538 539 3.3. LSB Application Conformance 540 541 A conforming application shall satisfy the following 542 requirements: 543 544 * Its executable files are either shell scripts or object 545 files in the format defined for the Object File Format 546 system interface. 547 * Its object files participate in dynamic linking as defined 548 in the Program Loading and Linking System interface. 549 * It employs only the instructions, traps, and other 550 low-level facilities defined in the Low-Level System 551 interface as being for use by applications. 552 * If it requires any optional interface defined in this 553 document in order to be installed or to execute 554 successfully, the requirement for that optional interface 555 is stated in the application's documentation. 556 * It does not use any interface or data format that is not 557 required to be provided by a conforming implementation, 558 unless: 559 + If such an interface or data format is supplied by 560 another application through direct invocation of that 561 application during execution, that application is in 562 turn an LSB conforming application. 563 + The use of that interface or data format, as well as 564 its source, is identified in the documentation of the 565 application. 566 * It shall not use any values for a named interface that are 567 reserved for vendor extensions. 568 569 A strictly conforming application does not require or use any 570 interface, facility, or implementation-defined extension that 571 is not defined in this document in order to be installed or to 572 execute successfully. 573 _________________________________________________________ 574 575 Chapter 4. Definitions 576 577 For the purposes of this document, the following definitions, 578 as specified in the ISO/IEC Directives, Part 2, 2001, 4th 579 Edition, apply: 580 581 can 582 be able to; there is a possibility of; it is possible 583 to 584 585 cannot 586 be unable to; there is no possibilty of; it is not 587 possible to 588 589 may 590 is permitted; is allowed; is permissible 591 592 need not 593 it is not required that; no...is required 594 595 shall 596 is to; is required to; it is required that; has to; 597 only...is permitted; it is necessary 598 599 shall not 600 is not allowed [permitted] [acceptable] [permissible]; 601 is required to be not; is required that...be not; is 602 not to be 603 604 should 605 it is recommended that; ought to 606 607 should not 608 it is not recommended that; ought not to 609 _________________________________________________________ 610 611 Chapter 5. Terminology 612 613 For the purposes of this document, the following terms apply: 614 615 archLSB 616 The architectural part of the LSB Specification which 617 describes the specific parts of the interface that are 618 platform specific. The archLSB is complementary to the 619 gLSB. 620 621 Binary Standard 622 The total set of interfaces that are available to be 623 used in the compiled binary code of a conforming 624 application. 625 626 gLSB 627 The common part of the LSB Specification that describes 628 those parts of the interface that remain constant 629 across all hardware implementations of the LSB. 630 631 implementation-defined 632 Describes a value or behavior that is not defined by 633 this document but is selected by an implementor. The 634 value or behavior may vary among implementations that 635 conform to this document. An application should not 636 rely on the existence of the value or behavior. An 637 application that relies on such a value or behavior 638 cannot be assured to be portable across conforming 639 implementations. The implementor shall document such a 640 value or behavior so that it can be used correctly by 641 an application. 642 643 Shell Script 644 A file that is read by an interpreter (e.g., awk). The 645 first line of the shell script includes a reference to 646 its interpreter binary. 647 648 Source Standard 649 The set of interfaces that are available to be used in 650 the source code of a conforming application. 651 652 undefined 653 Describes the nature of a value or behavior not defined 654 by this document which results from use of an invalid 655 program construct or invalid data input. The value or 656 behavior may vary among implementations that conform to 657 this document. An application should not rely on the 658 existence or validity of the value or behavior. An 659 application that relies on any particular value or 660 behavior cannot be assured to be portable across 661 conforming implementations. 662 663 unspecified 664 Describes the nature of a value or behavior not 665 specified by this document which results from use of a 666 valid program construct or valid data input. The value 667 or behavior may vary among implementations that conform 668 to this document. An application should not rely on the 669 existence or validity of the value or behavior. An 670 application that relies on any particular value or 671 behavior cannot be assured to be portable across 672 conforming implementations. 673 674 Other terms and definitions used in this document shall have 675 the same meaning as defined in Chapter 3 of the Base 676 Definitions volume of ISO POSIX (2003). 677 _________________________________________________________ 678 679 Chapter 6. Documentation Conventions 680 681 Throughout this document, the following typographic 682 conventions are used: 683 684 function() 685 the name of a function 686 687 command 688 the name of a command or utility 689 690 CONSTANT 691 a constant value 692 693 parameter 694 a parameter 695 696 variable 697 a variable 698 699 Throughout this specification, several tables of interfaces 700 are presented. Each entry in these tables has the following 701 format: 702 703 name 704 the name of the interface 705 706 (symver) 707 An optional symbol version identifier, if required. 708 709 [refno] 710 A reference number indexing the table of referenced 711 specifications that follows this table. 712 713 For example, 714 715 forkpty(GLIBC_2.0) [1] 716 717 refers to the interface named forkpty() with symbol version 718 GLIBC_2.0 that is defined in the first of the listed 719 references below the table. 720 721 II. Base Libraries 722 723 Table of Contents 724 7. Libraries 725 _________________________________________________________ 726 727 Chapter 7. Libraries 728 729 7.1. Introduction 730 731 An LSB-conforming implementation shall support some base 732 libraries which provide interfaces for accessing the operating 733 system, processor and other hardware in the system. 734 _________________________________________________________ 735 736 7.2. Program Interpreter 737 738 The Program Interpreter is specified in the appropriate 739 architecture-specific LSB specification. 740 _________________________________________________________ 741 742 7.3. Interfaces for libc 743 744 Table 7-1 defines the library name and shared object name for 745 the libc library 746 747 Table 7-1. libc Definition 748 Library: libc 749 SONAME: See archLSB. 750 751 The behavior of the interfaces in this library is specified by 752 the following specifications: 753 754 Large File Support 755 this specification 756 SUSv2 757 ISO POSIX (2003) 758 SVID Issue 3 759 SVID Issue 4 760 _________________________________________________________ 761 762 7.3.1. RPC 763 _________________________________________________________ 764 765 7.3.1.1. Interfaces for RPC 766 767 An LSB conforming implementation shall provide the generic 768 functions for RPC specified in Table 7-2, with the full 769 functionality as described in the referenced underlying 770 specification. 771 772 Table 7-2. libc - RPC Function Interfaces 773 authnone_create [1] svc_getreqset [2] svcudp_create [3] 774 xdr_int [2] xdr_u_long [2] 775 clnt_create [1] svc_register [3] xdr_accepted_reply [2] 776 xdr_long [2] xdr_u_short [2] 777 clnt_pcreateerror [1] svc_run [3] xdr_array [2] xdr_opaque [2] 778 xdr_union [2] 779 clnt_perrno [1] svc_sendreply [3] xdr_bool [2] xdr_opaque_auth 780 [2] xdr_vector [2] 781 clnt_perror [1] svcerr_auth [2] xdr_bytes [2] xdr_pointer [2] 782 xdr_void [2] 783 clnt_spcreateerror [1] svcerr_decode [2] xdr_callhdr [2] 784 xdr_reference [2] xdr_wrapstring [2] 785 clnt_sperrno [1] svcerr_noproc [2] xdr_callmsg [2] 786 xdr_rejected_reply [2] xdrmem_create [2] 787 clnt_sperror [1] svcerr_noprog [2] xdr_char [2] xdr_replymsg 788 [2] xdrrec_create [2] 789 key_decryptsession [2] svcerr_progvers [2] xdr_double [2] 790 xdr_short [2] xdrrec_eof [2] 791 pmap_getport [3] svcerr_systemerr [2] xdr_enum [2] xdr_string 792 [2] 793 pmap_set [3] svcerr_weakauth [2] xdr_float [2] xdr_u_char [2] 794 795 pmap_unset [3] svctcp_create [3] xdr_free [2] xdr_u_int [3] 796 797 Referenced Specification(s) 798 799 [1]. SVID Issue 4 800 801 [2]. SVID Issue 3 802 803 [3]. this specification 804 805 An LSB conforming implementation shall provide the generic 806 deprecated functions for RPC specified in Table 7-3, with the 807 full functionality as described in the referenced underlying 808 specification. 809 810 Note: These interfaces are deprecated, and applications 811 should avoid using them. These interfaces may be withdrawn 812 in future releases of this specification. 813 814 Table 7-3. libc - RPC Deprecated Function Interfaces 815 getdomainname [1] setdomainname [1] 816 817 Referenced Specification(s) 818 819 [1]. this specification 820 _________________________________________________________ 821 822 7.3.2. System Calls 823 _________________________________________________________ 824 825 7.3.2.1. Interfaces for System Calls 826 827 An LSB conforming implementation shall provide the generic 828 functions for System Calls specified in Table 7-4, with the 829 full functionality as described in the referenced underlying 830 specification. 831 832 Table 7-4. libc - System Calls Function Interfaces 833 __fxstat [1] fchmod [2] getwd [2] read [2] setrlimit [2] 834 __getpgid [1] fchown [2] initgroups [1] readdir [2] 835 setrlimit64 [3] 836 __lxstat [1] fcntl [1] ioctl [1] readdir_r [2] setsid [2] 837 __xmknod [1] fdatasync [2] kill [1] readlink [2] setuid [2] 838 __xstat [1] flock [1] killpg [2] readv [2] sleep [2] 839 access [2] fork [2] lchown [2] rename [2] statvfs [2] 840 acct [1] fstatvfs [2] link [2] rmdir [2] stime [1] 841 alarm [2] fsync [2] lockf [2] sbrk [4] symlink [2] 842 brk [4] ftime [2] lseek [2] sched_get_priority_max [2] sync 843 [2] 844 chdir [2] ftruncate [2] mkdir [2] sched_get_priority_min [2] 845 sysconf [2] 846 chmod [2] getcontext [2] mkfifo [2] sched_getparam [2] time 847 [2] 848 chown [2] getegid [2] mlock [2] sched_getscheduler [2] times 849 [2] 850 chroot [4] geteuid [2] mlockall [2] sched_rr_get_interval [2] 851 truncate [2] 852 clock [2] getgid [2] mmap [2] sched_setparam [2] ulimit [2] 853 close [2] getgroups [2] mprotect [2] sched_setscheduler [2] 854 umask [2] 855 closedir [2] getitimer [2] msync [2] sched_yield [2] uname [2] 856 creat [1] getloadavg [1] munlock [2] select [2] unlink [1] 857 dup [2] getpagesize [4] munlockall [2] setcontext [2] utime 858 [2] 859 dup2 [2] getpgid [2] munmap [2] setegid [2] utimes [2] 860 execl [2] getpgrp [2] nanosleep [2] seteuid [2] vfork [2] 861 execle [2] getpid [2] nice [2] setgid [2] wait [2] 862 execlp [2] getppid [2] open [1] setitimer [2] wait4 [1] 863 execv [2] getpriority [2] opendir [2] setpgid [2] waitpid [1] 864 execve [2] getrlimit [2] pathconf [2] setpgrp [2] write [2] 865 execvp [2] getrusage [2] pause [2] setpriority [2] writev [2] 866 exit [2] getsid [2] pipe [2] setregid [2] 867 fchdir [2] getuid [2] poll [2] setreuid [2] 868 869 Referenced Specification(s) 870 871 [1]. this specification 872 873 [2]. ISO POSIX (2003) 874 875 [3]. Large File Support 876 877 [4]. SUSv2 878 879 An LSB conforming implementation shall provide the generic 880 deprecated functions for System Calls specified in Table 7-5, 881 with the full functionality as described in the referenced 882 underlying specification. 883 884 Note: These interfaces are deprecated, and applications 885 should avoid using them. These interfaces may be withdrawn 886 in future releases of this specification. 887 888 Table 7-5. libc - System Calls Deprecated Function Interfaces 889 wait3 [1] 890 891 Referenced Specification(s) 892 893 [1]. this specification 894 _________________________________________________________ 895 896 7.3.3. Standard I/O 897 _________________________________________________________ 898 899 7.3.3.1. Interfaces for Standard I/O 900 901 An LSB conforming implementation shall provide the generic 902 functions for Standard I/O specified in Table 7-6, with the 903 full functionality as described in the referenced underlying 904 specification. 905 906 Table 7-6. libc - Standard I/O Function Interfaces 907 _IO_feof [1] fgetpos [2] fsetpos [2] putchar [2] sscanf [2] 908 _IO_getc [1] fgets [2] ftell [2] putchar_unlocked [2] telldir 909 [2] 910 _IO_putc [1] fgetwc_unlocked [1] ftello [2] puts [2] tempnam 911 [2] 912 _IO_puts [1] fileno [2] fwrite [2] putw [3] ungetc [2] 913 asprintf [1] flockfile [2] getc [2] remove [2] vasprintf [1] 914 clearerr [2] fopen [1] getc_unlocked [2] rewind [2] vdprintf 915 [1] 916 ctermid [2] fprintf [2] getchar [2] rewinddir [2] vfprintf [2] 917 fclose [2] fputc [2] getchar_unlocked [2] scanf [2] vprintf 918 [2] 919 fdopen [2] fputs [2] getw [3] seekdir [2] vsnprintf [2] 920 feof [2] fread [2] pclose [2] setbuf [2] vsprintf [2] 921 ferror [2] freopen [1] popen [2] setbuffer [1] 922 fflush [2] fscanf [2] printf [2] setvbuf [2] 923 fflush_unlocked [1] fseek [2] putc [2] snprintf [2] 924 fgetc [2] fseeko [2] putc_unlocked [2] sprintf [2] 925 926 Referenced Specification(s) 927 928 [1]. this specification 929 930 [2]. ISO POSIX (2003) 931 932 [3]. SUSv2 933 934 An LSB conforming implementation shall provide the generic 935 data interfaces for Standard I/O specified in Table 7-7, with 936 the full functionality as described in the referenced 937 underlying specification. 938 939 Table 7-7. libc - Standard I/O Data Interfaces 940 stderr [1] stdin [1] stdout [1] 941 942 Referenced Specification(s) 943 944 [1]. ISO POSIX (2003) 945 _________________________________________________________ 946 947 7.3.4. Signal Handling 948 _________________________________________________________ 949 950 7.3.4.1. Interfaces for Signal Handling 951 952 An LSB conforming implementation shall provide the generic 953 functions for Signal Handling specified in Table 7-8, with the 954 full functionality as described in the referenced underlying 955 specification. 956 957 Table 7-8. libc - Signal Handling Function Interfaces 958 __libc_current_sigrtmax [1] sigaction [2] sighold [2] sigorset 959 [1] sigset [2] 960 __libc_current_sigrtmin [1] sigaddset [2] sigignore [2] 961 sigpause [2] sigsuspend [2] 962 __sigsetjmp [1] sigaltstack [2] siginterrupt [2] sigpending 963 [2] sigtimedwait [2] 964 __sysv_signal [1] sigandset [1] sigisemptyset [1] sigprocmask 965 [2] sigwait [2] 966 bsd_signal [2] sigdelset [2] sigismember [2] sigqueue [2] 967 sigwaitinfo [2] 968 psignal [1] sigemptyset [2] siglongjmp [2] sigrelse [2] 969 raise [2] sigfillset [2] signal [2] sigreturn [1] 970 971 Referenced Specification(s) 972 973 [1]. this specification 974 975 [2]. ISO POSIX (2003) 976 977 An LSB conforming implementation shall provide the generic 978 deprecated functions for Signal Handling specified in Table 979 7-9, with the full functionality as described in the 980 referenced underlying specification. 981 982 Note: These interfaces are deprecated, and applications 983 should avoid using them. These interfaces may be withdrawn 984 in future releases of this specification. 985 986 Table 7-9. libc - Signal Handling Deprecated Function 987 Interfaces 988 sigblock [1] siggetmask [1] sigstack [2] 989 990 Referenced Specification(s) 991 992 [1]. this specification 993 994 [2]. SUSv2 995 996 An LSB conforming implementation shall provide the generic 997 data interfaces for Signal Handling specified in Table 7-10, 998 with the full functionality as described in the referenced 999 underlying specification. 1000 1001 Table 7-10. libc - Signal Handling Data Interfaces 1002 _sys_siglist [1] 1003 1004 Referenced Specification(s) 1005 1006 [1]. this specification 1007 _________________________________________________________ 1008 1009 7.3.5. Localization Functions 1010 _________________________________________________________ 1011 1012 7.3.5.1. Interfaces for Localization Functions 1013 1014 An LSB conforming implementation shall provide the generic 1015 functions for Localization Functions specified in Table 7-11, 1016 with the full functionality as described in the referenced 1017 underlying specification. 1018 1019 Table 7-11. libc - Localization Functions Function Interfaces 1020 bind_textdomain_codeset [1] catopen [2] dngettext [1] 1021 iconv_open [2] setlocale [2] 1022 bindtextdomain [1] dcgettext [1] gettext [1] localeconv [2] 1023 textdomain [1] 1024 catclose [2] dcngettext [1] iconv [2] ngettext [1] 1025 catgets [2] dgettext [1] iconv_close [2] nl_langinfo [2] 1026 1027 Referenced Specification(s) 1028 1029 [1]. this specification 1030 1031 [2]. ISO POSIX (2003) 1032 1033 An LSB conforming implementation shall provide the generic 1034 data interfaces for Localization Functions specified in Table 1035 7-12, with the full functionality as described in the 1036 referenced underlying specification. 1037 1038 Table 7-12. libc - Localization Functions Data Interfaces 1039 _nl_msg_cat_cntr [1] 1040 1041 Referenced Specification(s) 1042 1043 [1]. this specification 1044 _________________________________________________________ 1045 1046 7.3.6. Socket Interface 1047 _________________________________________________________ 1048 1049 7.3.6.1. Interfaces for Socket Interface 1050 1051 An LSB conforming implementation shall provide the generic 1052 functions for Socket Interface specified in Table 7-13, with 1053 the full functionality as described in the referenced 1054 underlying specification. 1055 1056 Table 7-13. libc - Socket Interface Function Interfaces 1057 __h_errno_location [1] gethostname [2] if_nameindex [2] send 1058 [2] socket [2] 1059 accept [2] getpeername [2] if_nametoindex [2] sendmsg [2] 1060 socketpair [2] 1061 bind [2] getsockname [2] listen [2] sendto [2] 1062 bindresvport [1] getsockopt [2] recv [2] setsockopt [1] 1063 connect [2] if_freenameindex [2] recvfrom [2] shutdown [2] 1064 gethostid [2] if_indextoname [2] recvmsg [2] sockatmark [2] 1065 1066 Referenced Specification(s) 1067 1068 [1]. this specification 1069 1070 [2]. ISO POSIX (2003) 1071 1072 An LSB conforming implementation shall provide the generic 1073 deprecated functions for Socket Interface specified in Table 1074 7-14, with the full functionality as described in the 1075 referenced underlying specification. 1076 1077 Note: These interfaces are deprecated, and applications 1078 should avoid using them. These interfaces may be withdrawn 1079 in future releases of this specification. 1080 1081 Table 7-14. libc - Socket Interface Deprecated Function 1082 Interfaces 1083 gethostbyname_r [1] 1084 1085 Referenced Specification(s) 1086 1087 [1]. this specification 1088 _________________________________________________________ 1089 1090 7.3.7. Wide Characters 1091 _________________________________________________________ 1092 1093 7.3.7.1. Interfaces for Wide Characters 1094 1095 An LSB conforming implementation shall provide the generic 1096 functions for Wide Characters specified in Table 7-15, with 1097 the full functionality as described in the referenced 1098 underlying specification. 1099 1100 Table 7-15. libc - Wide Characters Function Interfaces 1101 __wcstod_internal [1] mbsinit [2] vwscanf [2] wcsnlen [1] 1102 wcstoumax [2] 1103 __wcstof_internal [1] mbsnrtowcs [1] wcpcpy [1] wcsnrtombs [1] 1104 wcstouq [1] 1105 __wcstol_internal [1] mbsrtowcs [2] wcpncpy [1] wcspbrk [2] 1106 wcswcs [2] 1107 __wcstold_internal [1] mbstowcs [2] wcrtomb [2] wcsrchr [2] 1108 wcswidth [2] 1109 __wcstoul_internal [1] mbtowc [2] wcscasecmp [1] wcsrtombs [2] 1110 wcsxfrm [2] 1111 btowc [2] putwc [2] wcscat [2] wcsspn [2] wctob [2] 1112 fgetwc [2] putwchar [2] wcschr [2] wcsstr [2] wctomb [2] 1113 fgetws [2] swprintf [2] wcscmp [2] wcstod [2] wctrans [2] 1114 fputwc [2] swscanf [2] wcscoll [2] wcstof [2] wctype [2] 1115 fputws [2] towctrans [2] wcscpy [2] wcstoimax [2] wcwidth [2] 1116 fwide [2] towlower [2] wcscspn [2] wcstok [2] wmemchr [2] 1117 fwprintf [2] towupper [2] wcsdup [1] wcstol [2] wmemcmp [2] 1118 fwscanf [2] ungetwc [2] wcsftime [2] wcstold [2] wmemcpy [2] 1119 getwc [2] vfwprintf [2] wcslen [2] wcstoll [2] wmemmove [2] 1120 getwchar [2] vfwscanf [2] wcsncasecmp [1] wcstombs [2] wmemset 1121 [2] 1122 mblen [2] vswprintf [2] wcsncat [2] wcstoq [1] wprintf [2] 1123 mbrlen [2] vswscanf [2] wcsncmp [2] wcstoul [2] wscanf [2] 1124 mbrtowc [2] vwprintf [2] wcsncpy [2] wcstoull [2] 1125 1126 Referenced Specification(s) 1127 1128 [1]. this specification 1129 1130 [2]. ISO POSIX (2003) 1131 _________________________________________________________ 1132 1133 7.3.8. String Functions 1134 _________________________________________________________ 1135 1136 7.3.8.1. Interfaces for String Functions 1137 1138 An LSB conforming implementation shall provide the generic 1139 functions for String Functions specified in Table 7-16, with 1140 the full functionality as described in the referenced 1141 underlying specification. 1142 1143 Table 7-16. libc - String Functions Function Interfaces 1144 __mempcpy [1] bzero [2] strcasestr [1] strncat [2] strtok [2] 1145 __rawmemchr [1] ffs [2] strcat [2] strncmp [2] strtok_r [2] 1146 __stpcpy [1] index [2] strchr [2] strncpy [2] strtold [2] 1147 __strdup [1] memccpy [2] strcmp [2] strndup [1] strtoll [2] 1148 __strtod_internal [1] memchr [2] strcoll [2] strnlen [1] 1149 strtoq [1] 1150 __strtof_internal [1] memcmp [2] strcpy [2] strpbrk [2] 1151 strtoull [2] 1152 __strtok_r [1] memcpy [2] strcspn [2] strptime [1] strtoumax 1153 [2] 1154 __strtol_internal [1] memmove [2] strdup [2] strrchr [2] 1155 strtouq [1] 1156 __strtold_internal [1] memrchr [1] strerror [2] strsep [1] 1157 strxfrm [2] 1158 __strtoll_internal [1] memset [2] strerror_r [1] strsignal [1] 1159 swab [2] 1160 __strtoul_internal [1] rindex [2] strfmon [2] strspn [2] 1161 __strtoull_internal [1] stpcpy [1] strftime [2] strstr [2] 1162 bcmp [2] stpncpy [1] strlen [2] strtof [2] 1163 bcopy [2] strcasecmp [2] strncasecmp [2] strtoimax [2] 1164 1165 Referenced Specification(s) 1166 1167 [1]. this specification 1168 1169 [2]. ISO POSIX (2003) 1170 1171 An LSB conforming implementation shall provide the generic 1172 deprecated functions for String Functions specified in Table 1173 7-17, with the full functionality as described in the 1174 referenced underlying specification. 1175 1176 Note: These interfaces are deprecated, and applications 1177 should avoid using them. These interfaces may be withdrawn 1178 in future releases of this specification. 1179 1180 Table 7-17. libc - String Functions Deprecated Function 1181 Interfaces 1182 strfry [1] strverscmp [1] 1183 1184 Referenced Specification(s) 1185 1186 [1]. this specification 1187 _________________________________________________________ 1188 1189 7.3.9. IPC Functions 1190 _________________________________________________________ 1191 1192 7.3.9.1. Interfaces for IPC Functions 1193 1194 An LSB conforming implementation shall provide the generic 1195 functions for IPC Functions specified in Table 7-18, with the 1196 full functionality as described in the referenced underlying 1197 specification. 1198 1199 Table 7-18. libc - IPC Functions Function Interfaces 1200 ftok [1] msgrcv [1] semget [1] shmctl [1] 1201 msgctl [1] msgsnd [1] semop [1] shmdt [1] 1202 msgget [1] semctl [1] shmat [1] shmget [1] 1203 1204 Referenced Specification(s) 1205 1206 [1]. ISO POSIX (2003) 1207 _________________________________________________________ 1208 1209 7.3.10. Regular Expressions 1210 _________________________________________________________ 1211 1212 7.3.10.1. Interfaces for Regular Expressions 1213 1214 An LSB conforming implementation shall provide the generic 1215 functions for Regular Expressions specified in Table 7-19, 1216 with the full functionality as described in the referenced 1217 underlying specification. 1218 1219 Table 7-19. libc - Regular Expressions Function Interfaces 1220 regcomp [1] regerror [1] regexec [1] regfree [1] 1221 1222 Referenced Specification(s) 1223 1224 [1]. ISO POSIX (2003) 1225 1226 An LSB conforming implementation shall provide the generic 1227 deprecated functions for Regular Expressions specified in 1228 Table 7-20, with the full functionality as described in the 1229 referenced underlying specification. 1230 1231 Note: These interfaces are deprecated, and applications 1232 should avoid using them. These interfaces may be withdrawn 1233 in future releases of this specification. 1234 1235 Table 7-20. libc - Regular Expressions Deprecated Function 1236 Interfaces 1237 advance [1] re_comp [1] re_exec [1] step [1] 1238 1239 Referenced Specification(s) 1240 1241 [1]. SUSv2 1242 1243 An LSB conforming implementation shall provide the generic 1244 deprecated data interfaces for Regular Expressions specified 1245 in Table 7-21, with the full functionality as described in the 1246 referenced underlying specification. 1247 1248 Note: These interfaces are deprecated, and applications 1249 should avoid using them. These interfaces may be withdrawn 1250 in future releases of this specification. 1251 1252 Table 7-21. libc - Regular Expressions Deprecated Data 1253 Interfaces 1254 loc1 [1] loc2 [1] locs [1] 1255 1256 Referenced Specification(s) 1257 1258 [1]. SUSv2 1259 _________________________________________________________ 1260 1261 7.3.11. Character Type Functions 1262 _________________________________________________________ 1263 1264 7.3.11.1. Interfaces for Character Type Functions 1265 1266 An LSB conforming implementation shall provide the generic 1267 functions for Character Type Functions specified in Table 1268 7-22, with the full functionality as described in the 1269 referenced underlying specification. 1270 1271 Table 7-22. libc - Character Type Functions Function 1272 Interfaces 1273 __ctype_b_loc(GLIBC_2.3) [1] isalpha [2] ispunct [2] iswctype 1274 [2] iswupper [2] 1275 __ctype_get_mb_cur_max [1] isascii [2] isspace [2] iswdigit 1276 [2] iswxdigit [2] 1277 __ctype_tolower_loc(GLIBC_2.3) [1] iscntrl [2] isupper [2] 1278 iswgraph [2] isxdigit [2] 1279 __ctype_toupper_loc(GLIBC_2.3) [1] isdigit [2] iswalnum [2] 1280 iswlower [2] toascii [2] 1281 _tolower [2] isgraph [2] iswalpha [2] iswprint [2] tolower [2] 1282 _toupper [2] islower [2] iswblank [2] iswpunct [2] toupper [2] 1283 isalnum [2] isprint [2] iswcntrl [2] iswspace [2] 1284 1285 Referenced Specification(s) 1286 1287 [1]. this specification 1288 1289 [2]. ISO POSIX (2003) 1290 _________________________________________________________ 1291 1292 7.3.12. Time Manipulation 1293 _________________________________________________________ 1294 1295 7.3.12.1. Interfaces for Time Manipulation 1296 1297 An LSB conforming implementation shall provide the generic 1298 functions for Time Manipulation specified in Table 7-23, with 1299 the full functionality as described in the referenced 1300 underlying specification. 1301 1302 Table 7-23. libc - Time Manipulation Function Interfaces 1303 adjtime [1] ctime [2] gmtime [2] localtime_r [2] ualarm [2] 1304 asctime [2] ctime_r [2] gmtime_r [2] mktime [2] 1305 asctime_r [2] difftime [2] localtime [2] tzset [2] 1306 1307 Referenced Specification(s) 1308 1309 [1]. this specification 1310 1311 [2]. ISO POSIX (2003) 1312 1313 An LSB conforming implementation shall provide the generic 1314 deprecated functions for Time Manipulation specified in Table 1315 7-24, with the full functionality as described in the 1316 referenced underlying specification. 1317 1318 Note: These interfaces are deprecated, and applications 1319 should avoid using them. These interfaces may be withdrawn 1320 in future releases of this specification. 1321 1322 Table 7-24. libc - Time Manipulation Deprecated Function 1323 Interfaces 1324 adjtimex [1] 1325 1326 Referenced Specification(s) 1327 1328 [1]. this specification 1329 1330 An LSB conforming implementation shall provide the generic 1331 data interfaces for Time Manipulation specified in Table 7-25, 1332 with the full functionality as described in the referenced 1333 underlying specification. 1334 1335 Table 7-25. libc - Time Manipulation Data Interfaces 1336 __daylight [1] __tzname [1] timezone [2] 1337 __timezone [1] daylight [2] tzname [2] 1338 1339 Referenced Specification(s) 1340 1341 [1]. this specification 1342 1343 [2]. ISO POSIX (2003) 1344 _________________________________________________________ 1345 1346 7.3.13. Terminal Interface Functions 1347 _________________________________________________________ 1348 1349 7.3.13.1. Interfaces for Terminal Interface Functions 1350 1351 An LSB conforming implementation shall provide the generic 1352 functions for Terminal Interface Functions specified in Table 1353 7-26, with the full functionality as described in the 1354 referenced underlying specification. 1355 1356 Table 7-26. libc - Terminal Interface Functions Function 1357 Interfaces 1358 cfgetispeed [1] cfsetispeed [1] tcdrain [1] tcgetattr [1] 1359 tcsendbreak [1] 1360 cfgetospeed [1] cfsetospeed [1] tcflow [1] tcgetpgrp [1] 1361 tcsetattr [1] 1362 cfmakeraw [2] cfsetspeed [2] tcflush [1] tcgetsid [1] 1363 tcsetpgrp [1] 1364 1365 Referenced Specification(s) 1366 1367 [1]. ISO POSIX (2003) 1368 1369 [2]. this specification 1370 _________________________________________________________ 1371 1372 7.3.14. System Database Interface 1373 _________________________________________________________ 1374 1375 7.3.14.1. Interfaces for System Database Interface 1376 1377 An LSB conforming implementation shall provide the generic 1378 functions for System Database Interface specified in Table 1379 7-27, with the full functionality as described in the 1380 referenced underlying specification. 1381 1382 Table 7-27. libc - System Database Interface Function 1383 Interfaces 1384 endgrent [1] getgrgid_r [1] getpwent [1] getutent [2] 1385 setprotoent [1] 1386 endprotoent [1] getgrnam [1] getpwnam [1] getutent_r [2] 1387 setpwent [1] 1388 endpwent [1] getgrnam_r [1] getpwnam_r [1] getutxent [1] 1389 setservent [1] 1390 endservent [1] gethostbyaddr [1] getpwuid [1] getutxid [1] 1391 setutent [2] 1392 endutent [3] gethostbyname [1] getpwuid_r [1] getutxline [1] 1393 setutxent [1] 1394 endutxent [1] getprotobyname [1] getservbyname [1] pututxline 1395 [1] utmpname [2] 1396 getgrent [1] getprotobynumber [1] getservbyport [1] setgrent 1397 [1] 1398 getgrgid [1] getprotoent [1] getservent [1] setgroups [2] 1399 1400 Referenced Specification(s) 1401 1402 [1]. ISO POSIX (2003) 1403 1404 [2]. this specification 1405 1406 [3]. SUSv2 1407 1408 An LSB conforming implementation shall provide the generic 1409 deprecated functions for System Database Interface specified 1410 in Table 7-28, with the full functionality as described in the 1411 referenced underlying specification. 1412 1413 Note: These interfaces are deprecated, and applications 1414 should avoid using them. These interfaces may be withdrawn 1415 in future releases of this specification. 1416 1417 Table 7-28. libc - System Database Interface Deprecated 1418 Function Interfaces 1419 endnetent [1] getnetbyaddr [1] setnetent [1] 1420 1421 Referenced Specification(s) 1422 1423 [1]. ISO POSIX (2003) 1424 _________________________________________________________ 1425 1426 7.3.15. Language Support 1427 _________________________________________________________ 1428 1429 7.3.15.1. Interfaces for Language Support 1430 1431 An LSB conforming implementation shall provide the generic 1432 functions for Language Support specified in Table 7-29, with 1433 the full functionality as described in the referenced 1434 underlying specification. 1435 1436 Table 7-29. libc - Language Support Function Interfaces 1437 __libc_start_main [1] __register_atfork(GLIBC_2.3.2) [1] 1438 1439 Referenced Specification(s) 1440 1441 [1]. this specification 1442 _________________________________________________________ 1443 1444 7.3.16. Large File Support 1445 _________________________________________________________ 1446 1447 7.3.16.1. Interfaces for Large File Support 1448 1449 An LSB conforming implementation shall provide the generic 1450 functions for Large File Support specified in Table 7-30, with 1451 the full functionality as described in the referenced 1452 underlying specification. 1453 1454 Table 7-30. libc - Large File Support Function Interfaces 1455 __fxstat64 [1] fopen64 [2] ftello64 [2] lseek64 [2] readdir64 1456 [2] 1457 __lxstat64 [1] freopen64 [2] ftruncate64 [2] mkstemp64 [2] 1458 statvfs64 [2] 1459 __xstat64 [1] fseeko64 [2] ftw64 [2] mmap64 [2] tmpfile64 [2] 1460 creat64 [2] fsetpos64 [2] getrlimit64 [2] nftw64 [2] 1461 truncate64 [2] 1462 fgetpos64 [2] fstatvfs64 [2] lockf64 [2] open64 [2] 1463 1464 Referenced Specification(s) 1465 1466 [1]. this specification 1467 1468 [2]. Large File Support 1469 _________________________________________________________ 1470 1471 7.3.17. Standard Library 1472 _________________________________________________________ 1473 1474 7.3.17.1. Interfaces for Standard Library 1475 1476 An LSB conforming implementation shall provide the generic 1477 functions for Standard Library specified in Table 7-31, with 1478 the full functionality as described in the referenced 1479 underlying specification. 1480 1481 Table 7-31. libc - Standard Library Function Interfaces 1482 _Exit [1] dirname [1] glob [1] lsearch [1] srandom [1] 1483 __assert_fail [2] div [1] glob64 [2] makecontext [1] strtod 1484 [1] 1485 __cxa_atexit [2] drand48 [1] globfree [1] malloc [1] strtol 1486 [1] 1487 __errno_location [2] ecvt [1] globfree64 [2] memmem [2] 1488 strtoul [1] 1489 __fpending [2] erand48 [1] grantpt [1] mkstemp [1] swapcontext 1490 [1] 1491 __getpagesize [2] err [2] hcreate [1] mktemp [1] syslog [1] 1492 __isinf [2] error [2] hdestroy [1] mrand48 [1] system [2] 1493 __isinff [2] errx [2] hsearch [1] nftw [1] tdelete [1] 1494 __isinfl [2] fcvt [1] htonl [1] nrand48 [1] tfind [1] 1495 __isnan [2] fmtmsg [1] htons [1] ntohl [1] tmpfile [1] 1496 __isnanf [2] fnmatch [1] imaxabs [1] ntohs [1] tmpnam [1] 1497 __isnanl [2] fpathconf [1] imaxdiv [1] openlog [1] tsearch [1] 1498 __sysconf [2] free [1] inet_addr [1] perror [1] ttyname [1] 1499 _exit [1] freeaddrinfo [1] inet_ntoa [1] posix_memalign [1] 1500 ttyname_r [1] 1501 _longjmp [1] ftrylockfile [1] inet_ntop [1] ptsname [1] twalk 1502 [1] 1503 _setjmp [1] ftw [1] inet_pton [1] putenv [1] unlockpt [1] 1504 a64l [1] funlockfile [1] initstate [1] qsort [1] unsetenv [1] 1505 abort [1] gai_strerror [1] insque [1] rand [1] usleep [1] 1506 abs [1] gcvt [1] isatty [1] rand_r [1] verrx [2] 1507 atof [1] getaddrinfo [1] isblank [1] random [1] vfscanf [1] 1508 atoi [1] getcwd [1] jrand48 [1] realloc [1] vscanf [1] 1509 atol [1] getdate [1] l64a [1] realpath [1] vsscanf [1] 1510 atoll [1] getenv [1] labs [1] remque [1] vsyslog [2] 1511 basename [1] getlogin [1] lcong48 [1] seed48 [1] warn [2] 1512 bsearch [1] getnameinfo [1] ldiv [1] setenv [1] warnx [2] 1513 calloc [1] getopt [2] lfind [1] sethostname [2] wordexp [1] 1514 closelog [1] getopt_long [2] llabs [1] setlogmask [1] wordfree 1515 [1] 1516 confstr [1] getopt_long_only [2] lldiv [1] setstate [1] 1517 cuserid [3] getsubopt [1] longjmp [1] srand [1] 1518 daemon [2] gettimeofday [1] lrand48 [1] srand48 [1] 1519 1520 Referenced Specification(s) 1521 1522 [1]. ISO POSIX (2003) 1523 1524 [2]. this specification 1525 1526 [3]. SUSv2 1527 1528 An LSB conforming implementation shall provide the generic 1529 deprecated functions for Standard Library specified in Table 1530 7-32, with the full functionality as described in the 1531 referenced underlying specification. 1532 1533 Note: These interfaces are deprecated, and applications 1534 should avoid using them. These interfaces may be withdrawn 1535 in future releases of this specification. 1536 1537 Table 7-32. libc - Standard Library Deprecated Function 1538 Interfaces 1539 random_r [1] sethostid [1] 1540 1541 Referenced Specification(s) 1542 1543 [1]. this specification 1544 1545 An LSB conforming implementation shall provide the generic 1546 data interfaces for Standard Library specified in Table 7-33, 1547 with the full functionality as described in the referenced 1548 underlying specification. 1549 1550 Table 7-33. libc - Standard Library Data Interfaces 1551 __environ [1] _sys_errlist [1] getdate_err [2] opterr [1] 1552 optopt [1] 1553 _environ [1] environ [2] optarg [2] optind [1] 1554 1555 Referenced Specification(s) 1556 1557 [1]. this specification 1558 1559 [2]. ISO POSIX (2003) 1560 _________________________________________________________ 1561 1562 7.4. Data Definitions for libc 1563 1564 This section defines global identifiers and their values that 1565 are associated with interfaces contained in libc. These 1566 definitions are organized into groups that correspond to 1567 system headers. This convention is used as a convenience for 1568 the reader, and does not imply the existence of these headers, 1569 or their content. 1570 1571 These definitions are intended to supplement those provided in 1572 the referenced underlying specifications. 1573 1574 This specification uses ISO/IEC 9899 C Language as the 1575 reference programming language, and data definitions are 1576 specified in ISO C format. The C language is used here as a 1577 convenient notation. Using a C language description of these 1578 data objects does not preclude their use by other programming 1579 languages. 1580 _________________________________________________________ 1581 1582 7.4.1. ctype.h 1583 1584 enum 1585 { 1586 _ISupper, _ISlower, _ISalpha, _ISdigit, _ISxdigit, _ISspace, _ISprint 1587 , 1588 _ISgraph, _ISblank, _IScntrl, _ISpunct, _ISalnum 1589 } 1590 ; 1591 _________________________________________________________ 1592 1593 7.4.2. dirent.h 1594 1595 typedef struct __dirstream DIR; 1596 1597 struct dirent 1598 { 1599 long d_ino; 1600 off_t d_off; 1601 unsigned short d_reclen; 1602 unsigned char d_type; 1603 char d_name[256]; 1604 } 1605 ; 1606 struct dirent64 1607 { 1608 uint64_t d_ino; 1609 int64_t d_off; 1610 unsigned short d_reclen; 1611 unsigned char d_type; 1612 char d_name[256]; 1613 } 1614 ; 1615 _________________________________________________________ 1616 1617 7.4.3. errno.h 1618 1619 #define errno (*__errno_location()) 1620 1621 #define EPERM 1 1622 #define ECHILD 10 1623 #define ENETDOWN 100 1624 #define ENETUNREACH 101 1625 #define ENETRESET 102 1626 #define ECONNABORTED 103 1627 #define ECONNRESET 104 1628 #define ENOBUFS 105 1629 #define EISCONN 106 1630 #define ENOTCONN 107 1631 #define ESHUTDOWN 108 1632 #define ETOOMANYREFS 109 1633 #define EAGAIN 11 1634 #define ETIMEDOUT 110 1635 #define ECONNREFUSED 111 1636 #define EHOSTDOWN 112 1637 #define EHOSTUNREACH 113 1638 #define EALREADY 114 1639 #define EINPROGRESS 115 1640 #define ESTALE 116 1641 #define EUCLEAN 117 1642 #define ENOTNAM 118 1643 #define ENAVAIL 119 1644 #define ENOMEM 12 1645 #define EISNAM 120 1646 #define EREMOTEIO 121 1647 #define EDQUOT 122 1648 #define ENOMEDIUM 123 1649 #define EMEDIUMTYPE 124 1650 #define ECANCELED 125 1651 #define EACCES 13 1652 #define EFAULT 14 1653 #define ENOTBLK 15 1654 #define EBUSY 16 1655 #define EEXIST 17 1656 #define EXDEV 18 1657 #define ENODEV 19 1658 #define ENOENT 2 1659 #define ENOTDIR 20 1660 #define EISDIR 21 1661 #define EINVAL 22 1662 #define ENFILE 23 1663 #define EMFILE 24 1664 #define ENOTTY 25 1665 #define ETXTBSY 26 1666 #define EFBIG 27 1667 #define ENOSPC 28 1668 #define ESPIPE 29 1669 #define ESRCH 3 1670 #define EROFS 30 1671 #define EMLINK 31 1672 #define EPIPE 32 1673 #define EDOM 33 1674 #define ERANGE 34 1675 #define EDEADLK 35 1676 #define ENAMETOOLONG 36 1677 #define ENOLCK 37 1678 #define ENOSYS 38 1679 #define ENOTEMPTY 39 1680 #define EINTR 4 1681 #define ELOOP 40 1682 #define ENOMSG 42 1683 #define EIDRM 43 1684 #define ECHRNG 44 1685 #define EL2NSYNC 45 1686 #define EL3HLT 46 1687 #define EL3RST 47 1688 #define ELNRNG 48 1689 #define EUNATCH 49 1690 #define EIO 5 1691 #define ENOANO 55 1692 #define EBADRQC 56 1693 #define EBADSLT 57 1694 #define EBFONT 59 1695 #define ENXIO 6 1696 #define ENOSTR 60 1697 #define ENODATA 61 1698 #define ETIME 62 1699 #define ENOSR 63 1700 #define ENONET 64 1701 #define ENOPKG 65 1702 #define EREMOTE 66 1703 #define ENOLINK 67 1704 #define EADV 68 1705 #define ESRMNT 69 1706 #define E2BIG 7 1707 #define ECOMM 70 1708 #define EPROTO 71 1709 #define EMULTIHOP 72 1710 #define EDOTDOT 73 1711 #define EBADMSG 74 1712 #define EOVERFLOW 75 1713 #define ENOTUNIQ 76 1714 #define EBADFD 77 1715 #define EREMCHG 78 1716 #define ELIBACC 79 1717 #define ENOEXEC 8 1718 #define ELIBBAD 80 1719 #define ELIBSCN 81 1720 #define ELIBMAX 82 1721 #define ELIBEXEC 83 1722 #define EILSEQ 84 1723 #define ERESTART 85 1724 #define ESTRPIPE 86 1725 #define EUSERS 87 1726 #define ENOTSOCK 88 1727 #define EDESTADDRREQ 89 1728 #define EBADF 9 1729 #define EMSGSIZE 90 1730 #define EPROTOTYPE 91 1731 #define ENOPROTOOPT 92 1732 #define EPROTONOSUPPORT 93 1733 #define ESOCKTNOSUPPORT 94 1734 #define EOPNOTSUPP 95 1735 #define EPFNOSUPPORT 96 1736 #define EAFNOSUPPORT 97 1737 #define EADDRINUSE 98 1738 #define EADDRNOTAVAIL 99 1739 #define EWOULDBLOCK EAGAIN 1740 #define ENOTSUP EOPNOTSUPP 1741 _________________________________________________________ 1742 1743 7.4.4. fcntl.h 1744 1745 #define O_RDONLY 00 1746 #define O_ACCMODE 0003 1747 #define O_WRONLY 01 1748 #define O_CREAT 0100 1749 #define O_TRUNC 01000 1750 #define O_SYNC 010000 1751 #define O_RDWR 02 1752 #define O_EXCL 0200 1753 #define O_APPEND 02000 1754 #define O_ASYNC 020000 1755 #define O_NOCTTY 0400 1756 #define O_NDELAY 04000 1757 #define O_NONBLOCK 04000 1758 #define FD_CLOEXEC 1 1759 1760 struct flock 1761 { 1762 short l_type; 1763 short l_whence; 1764 off_t l_start; 1765 off_t l_len; 1766 pid_t l_pid; 1767 } 1768 ; 1769 struct flock64 1770 { 1771 short l_type; 1772 short l_whence; 1773 loff_t l_start; 1774 loff_t l_len; 1775 pid_t l_pid; 1776 } 1777 ; 1778 1779 #define F_DUPFD 0 1780 #define F_RDLCK 0 1781 #define F_GETFD 1 1782 #define F_WRLCK 1 1783 #define F_SETFD 2 1784 #define F_UNLCK 2 1785 #define F_GETFL 3 1786 #define F_SETFL 4 1787 #define F_GETLK 5 1788 #define F_SETLK 6 1789 #define F_SETLKW 7 1790 #define F_SETOWN 8 1791 #define F_GETOWN 9 1792 _________________________________________________________ 1793 1794 7.4.5. fmtmsg.h 1795 1796 #define MM_HARD 1 1797 #define MM_NRECOV 128 1798 #define MM_UTIL 16 1799 #define MM_SOFT 2 1800 #define MM_OPSYS 32 1801 #define MM_FIRM 4 1802 #define MM_RECOVER 64 1803 #define MM_APPL 8 1804 1805 #define MM_NOSEV 0 1806 #define MM_HALT 1 1807 #define MM_ERROR 2 1808 1809 #define MM_NULLLBL ((char *) 0) 1810 _________________________________________________________ 1811 1812 7.4.6. fnmatch.h 1813 1814 #define FNM_PATHNAME (1<<0) 1815 #define FNM_NOESCAPE (1<<1) 1816 #define FNM_PERIOD (1<<2) 1817 #define FNM_NOMATCH 1 1818 _________________________________________________________ 1819 1820 7.4.7. ftw.h 1821 1822 #define FTW_D FTW_D 1823 #define FTW_DNR FTW_DNR 1824 #define FTW_DP FTW_DP 1825 #define FTW_F FTW_F 1826 #define FTW_NS FTW_NS 1827 #define FTW_SL FTW_SL 1828 #define FTW_SLN FTW_SLN 1829 1830 enum 1831 { 1832 FTW_F, FTW_D, FTW_DNR, FTW_NS, FTW_SL, FTW_DP, FTW_SLN 1833 } 1834 ; 1835 1836 enum 1837 { 1838 FTW_PHYS, FTW_MOUNT, FTW_CHDIR, FTW_DEPTH 1839 } 1840 ; 1841 1842 struct FTW 1843 { 1844 int base; 1845 int level; 1846 } 1847 ; 1848 1849 typedef int (*__ftw_func_t) (char *__filename, struct stat * __status, 1850 int __flag); 1851 typedef int (*__ftw64_func_t) (char *__filename, struct stat64 * __stat 1852 us, 1853 int __flag); 1854 typedef int (*__nftw_func_t) (char *__filename, struct stat * __status, 1855 int __flag, struct FTW * __info); 1856 typedef int (*__nftw64_func_t) (char *__filename, struct stat64 * __sta 1857 tus, 1858 int __flag, struct FTW * __info); 1859 _________________________________________________________ 1860 1861 7.4.8. getopt.h 1862 1863 #define no_argument 0 1864 #define required_argument 1 1865 #define optional_argument 2 1866 1867 struct option 1868 { 1869 char *name; 1870 int has_arg; 1871 int *flag; 1872 int val; 1873 } 1874 ; 1875 _________________________________________________________ 1876 1877 7.4.9. glob.h 1878 1879 #define GLOB_ERR (1<<0) 1880 #define GLOB_MARK (1<<1) 1881 #define GLOB_BRACE (1<<10) 1882 #define GLOB_NOMAGIC (1<<11) 1883 #define GLOB_TILDE (1<<12) 1884 #define GLOB_ONLYDIR (1<<13) 1885 #define GLOB_TILDE_CHECK (1<<14) 1886 #define GLOB_NOSORT (1<<2) 1887 #define GLOB_DOOFFS (1<<3) 1888 #define GLOB_NOCHECK (1<<4) 1889 #define GLOB_APPEND (1<<5) 1890 #define GLOB_NOESCAPE (1<<6) 1891 #define GLOB_PERIOD (1<<7) 1892 #define GLOB_MAGCHAR (1<<8) 1893 #define GLOB_ALTDIRFUNC (1<<9) 1894 1895 #define GLOB_NOSPACE 1 1896 #define GLOB_ABORTED 2 1897 #define GLOB_NOMATCH 3 1898 #define GLOB_NOSYS 4 1899 1900 typedef struct 1901 { 1902 size_t gl_pathc; 1903 char **gl_pathv; 1904 size_t gl_offs; 1905 int gl_flags; 1906 void (*gl_closedir) (void *); 1907 struct dirent *(*gl_readdir) (void *); 1908 void *(*gl_opendir) (const char *); 1909 int (*gl_lstat) (const char *, struct stat *); 1910 int (*gl_stat) (const char *, struct stat *); 1911 } 1912 glob_t; 1913 1914 typedef struct 1915 { 1916 size_t gl_pathc; 1917 char **gl_pathv; 1918 size_t gl_offs; 1919 int gl_flags; 1920 void (*gl_closedir) (void *); 1921 struct dirent64 *(*gl_readdir64) (void *); 1922 void *(*gl_opendir) (const char *); 1923 int (*gl_lstat) (const char *, struct stat *); 1924 int (*gl_stat) (const char *, struct stat *); 1925 } 1926 glob64_t; 1927 _________________________________________________________ 1928 1929 7.4.10. grp.h 1930 1931 struct group 1932 { 1933 char *gr_name; 1934 char *gr_passwd; 1935 gid_t gr_gid; 1936 char **gr_mem; 1937 } 1938 ; 1939 _________________________________________________________ 1940 1941 7.4.11. iconv.h 1942 1943 typedef void *iconv_t; 1944 _________________________________________________________ 1945 1946 7.4.12. inttypes.h 1947 1948 typedef lldiv_t imaxdiv_t; 1949 typedef unsigned char uint8_t; 1950 typedef unsigned short uint16_t; 1951 typedef unsigned int uint32_t; 1952 _________________________________________________________ 1953 1954 7.4.13. langinfo.h 1955 1956 #define ABDAY_1 0x20000 1957 #define ABDAY_2 0x20001 1958 #define ABDAY_3 0x20002 1959 #define ABDAY_4 0x20003 1960 #define ABDAY_5 0x20004 1961 #define ABDAY_6 0x20005 1962 #define ABDAY_7 0x20006 1963 1964 #define DAY_1 0x20007 1965 #define DAY_2 0x20008 1966 #define DAY_3 0x20009 1967 #define DAY_4 0x2000A 1968 #define DAY_5 0x2000B 1969 #define DAY_6 0x2000C 1970 #define DAY_7 0x2000D 1971 1972 #define ABMON_1 0x2000E 1973 #define ABMON_2 0x2000F 1974 #define ABMON_3 0x20010 1975 #define ABMON_4 0x20011 1976 #define ABMON_5 0x20012 1977 #define ABMON_6 0x20013 1978 #define ABMON_7 0x20014 1979 #define ABMON_8 0x20015 1980 #define ABMON_9 0x20016 1981 #define ABMON_10 0x20017 1982 #define ABMON_11 0x20018 1983 #define ABMON_12 0x20019 1984 1985 #define MON_1 0x2001A 1986 #define MON_2 0x2001B 1987 #define MON_3 0x2001C 1988 #define MON_4 0x2001D 1989 #define MON_5 0x2001E 1990 #define MON_6 0x2001F 1991 #define MON_7 0x20020 1992 #define MON_8 0x20021 1993 #define MON_9 0x20022 1994 #define MON_10 0x20023 1995 #define MON_11 0x20024 1996 #define MON_12 0x20025 1997 1998 #define AM_STR 0x20026 1999 #define PM_STR 0x20027 2000 2001 #define D_T_FMT 0x20028 2002 #define D_FMT 0x20029 2003 #define T_FMT 0x2002A 2004 #define T_FMT_AMPM 0x2002B 2005 2006 #define ERA 0x2002C 2007 #define ERA_D_FMT 0x2002E 2008 #define ALT_DIGITS 0x2002F 2009 #define ERA_D_T_FMT 0x20030 2010 #define ERA_T_FMT 0x20031 2011 2012 #define CODESET 14 2013 2014 #define CRNCYSTR 0x4000F 2015 2016 #define RADIXCHAR 0x10000 2017 #define THOUSEP 0x10001 2018 #define YESEXPR 0x50000 2019 #define NOEXPR 0x50001 2020 #define YESSTR 0x50002 2021 #define NOSTR 0x50003 2022 _________________________________________________________ 2023 2024 7.4.14. limits.h 2025 2026 #define LLONG_MIN (-LLONG_MAX-1LL) 2027 #define ULLONG_MAX 18446744073709551615ULL 2028 #define OPEN_MAX 256 2029 #define PATH_MAX 4096 2030 #define LLONG_MAX 9223372036854775807LL 2031 #define SSIZE_MAX LONG_MAX 2032 2033 #define MB_LEN_MAX 16 2034 2035 #define SCHAR_MIN (-128) 2036 #define SCHAR_MAX 127 2037 #define UCHAR_MAX 255 2038 #define CHAR_BIT 8 2039 2040 #define SHRT_MIN (-32768) 2041 #define SHRT_MAX 32767 2042 #define USHRT_MAX 65535 2043 2044 #define INT_MIN (-INT_MAX-1) 2045 #define INT_MAX 2147483647 2046 #define __INT_MAX__ 2147483647 2047 #define UINT_MAX 4294967295U 2048 2049 #define LONG_MIN (-LONG_MAX-1L) 2050 _________________________________________________________ 2051 2052 7.4.15. locale.h 2053 2054 #define LC_CTYPE 0 2055 #define LC_NUMERIC 1 2056 #define LC_TELEPHONE 10 2057 #define LC_MEASUREMENT 11 2058 #define LC_IDENTIFICATION 12 2059 #define LC_TIME 2 2060 #define LC_COLLATE 3 2061 #define LC_MONETARY 4 2062 #define LC_MESSAGES 5 2063 #define LC_ALL 6 2064 #define LC_PAPER 7 2065 #define LC_NAME 8 2066 #define LC_ADDRESS 9 2067 2068 struct lconv 2069 { 2070 char *decimal_point; 2071 char *thousands_sep; 2072 char *grouping; 2073 char *int_curr_symbol; 2074 char *currency_symbol; 2075 char *mon_decimal_point; 2076 char *mon_thousands_sep; 2077 char *mon_grouping; 2078 char *positive_sign; 2079 char *negative_sign; 2080 char int_frac_digits; 2081 char frac_digits; 2082 char p_cs_precedes; 2083 char p_sep_by_space; 2084 char n_cs_precedes; 2085 char n_sep_by_space; 2086 char p_sign_posn; 2087 char n_sign_posn; 2088 char int_p_cs_precedes; 2089 char int_p_sep_by_space; 2090 char int_n_cs_precedes; 2091 char int_n_sep_by_space; 2092 char int_p_sign_posn; 2093 char int_n_sign_posn; 2094 } 2095 ; 2096 2097 typedef struct __locale_struct 2098 { 2099 struct locale_data *__locales[13]; 2100 const unsigned short *__ctype_b; 2101 const int *__ctype_tolower; 2102 const int *__ctype_toupper; 2103 const char *__names[13]; 2104 } 2105 *__locale_t; 2106 _________________________________________________________ 2107 2108 7.4.16. net/if.h 2109 2110 #define IF_NAMESIZE 16 2111 2112 #define IFF_UP 0x01 2113 #define IFF_BROADCAST 0x02 2114 #define IFF_DEBUG 0x04 2115 #define IFF_LOOPBACK 0x08 2116 #define IFF_POINTOPOINT 0x10 2117 #define IFF_PROMISC 0x100 2118 #define IFF_MULTICAST 0x1000 2119 #define IFF_NOTRAILERS 0x20 2120 #define IFF_RUNNING 0x40 2121 #define IFF_NOARP 0x80 2122 2123 struct if_nameindex 2124 { 2125 unsigned int if_index; 2126 char *if_name; 2127 } 2128 ; 2129 2130 struct ifaddr 2131 { 2132 struct sockaddr ifa_addr; 2133 union 2134 { 2135 struct sockaddr ifu_broadaddr; 2136 struct sockaddr ifu_dstaddr; 2137 } 2138 ifa_ifu; 2139 void *ifa_ifp; 2140 void *ifa_next; 2141 } 2142 ; 2143 #define IFNAMSIZ IF_NAMESIZE 2144 2145 struct ifreq 2146 { 2147 union 2148 { 2149 char ifrn_name[IFNAMSIZ]; 2150 } 2151 ifr_ifrn; 2152 union 2153 { 2154 struct sockaddr ifru_addr; 2155 struct sockaddr ifru_dstaddr; 2156 struct sockaddr ifru_broadaddr; 2157 struct sockaddr ifru_netmask; 2158 struct sockaddr ifru_hwaddr; 2159 short ifru_flags; 2160 int ifru_ivalue; 2161 int ifru_mtu; 2162 char ifru_slave[IFNAMSIZ]; 2163 char ifru_newname[IFNAMSIZ]; 2164 caddr_t ifru_data; 2165 struct ifmap ifru_map; 2166 } 2167 ifr_ifru; 2168 } 2169 ; 2170 2171 struct ifconf 2172 { 2173 int ifc_len; 2174 union 2175 { 2176 caddr_t ifcu_buf; 2177 struct ifreq *ifcu_req; 2178 } 2179 ifc_ifcu; 2180 } 2181 ; 2182 _________________________________________________________ 2183 2184 7.4.17. netdb.h 2185 2186 #define NETDB_INTERNAL -1 2187 #define NETDB_SUCCESS 0 2188 #define HOST_NOT_FOUND 1 2189 #define IPPORT_RESERVED 1024 2190 #define NI_MAXHOST 1025 2191 #define TRY_AGAIN 2 2192 #define NO_RECOVERY 3 2193 #define NI_MAXSERV 32 2194 #define NO_DATA 4 2195 #define h_addr h_addr_list[0] 2196 #define NO_ADDRESS NO_DATA 2197 2198 struct servent 2199 { 2200 char *s_name; 2201 char **s_aliases; 2202 int s_port; 2203 char *s_proto; 2204 } 2205 ; 2206 struct hostent 2207 { 2208 char *h_name; 2209 char **h_aliases; 2210 int h_addrtype; 2211 int h_length; 2212 char **h_addr_list; 2213 } 2214 ; 2215 struct protoent 2216 { 2217 char *p_name; 2218 char **p_aliases; 2219 int p_proto; 2220 } 2221 ; 2222 struct netent 2223 { 2224 char *n_name; 2225 char **n_aliases; 2226 int n_addrtype; 2227 unsigned int n_net; 2228 } 2229 ; 2230 #define AI_PASSIVE 0x0001 2231 #define AI_CANONNAME 0x0002 2232 #define AI_NUMERICHOST 0x0004 2233 2234 struct addrinfo 2235 { 2236 int ai_flags; 2237 int ai_family; 2238 int ai_socktype; 2239 int ai_protocol; 2240 socklen_t ai_addrlen; 2241 struct sockaddr *ai_addr; 2242 char *ai_canonname; 2243 struct addrinfo *ai_next; 2244 } 2245 ; 2246 #define NI_NUMERICHOST 1 2247 #define NI_DGRAM 16 2248 #define NI_NUMERICSERV 2 2249 #define NI_NOFQDN 4 2250 #define NI_NAMEREQD 8 2251 2252 #define EAI_BADFLAGS -1 2253 #define EAI_MEMORY -10 2254 #define EAI_SYSTEM -11 2255 #define EAI_NONAME -2 2256 #define EAI_AGAIN -3 2257 #define EAI_FAIL -4 2258 #define EAI_NODATA -5 2259 #define EAI_FAMILY -6 2260 #define EAI_SOCKTYPE -7 2261 #define EAI_SERVICE -8 2262 #define EAI_ADDRFAMILY -9 2263 _________________________________________________________ 2264 2265 7.4.18. netinet/in.h 2266 2267 #define IPPROTO_IP 0 2268 #define IPPROTO_ICMP 1 2269 #define IPPROTO_UDP 17 2270 #define IPPROTO_IGMP 2 2271 #define IPPROTO_RAW 255 2272 #define IPPROTO_IPV6 41 2273 #define IPPROTO_ICMPV6 58 2274 #define IPPROTO_TCP 6 2275 2276 typedef uint16_t in_port_t; 2277 2278 struct in_addr 2279 { 2280 uint32_t s_addr; 2281 } 2282 ; 2283 typedef uint32_t in_addr_t; 2284 #define INADDR_NONE ((in_addr_t) 0xffffffff) 2285 #define INADDR_BROADCAST (0xffffffff) 2286 #define INADDR_ANY 0 2287 2288 struct in6_addr 2289 { 2290 union 2291 { 2292 uint8_t u6_addr8[16]; 2293 uint16_t u6_addr16[8]; 2294 uint32_t u6_addr32[4]; 2295 } 2296 in6_u; 2297 } 2298 ; 2299 #define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } 2300 } } 2301 #define IN6ADDR_LOOPBACK_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } 2302 } } 2303 2304 #define INET_ADDRSTRLEN 16 2305 2306 struct sockaddr_in 2307 { 2308 sa_family_t sin_family; 2309 unsigned short sin_port; 2310 struct in_addr sin_addr; 2311 unsigned char sin_zero[8]; 2312 } 2313 ; 2314 #define INET6_ADDRSTRLEN 46 2315 2316 struct sockaddr_in6 2317 { 2318 unsigned short sin6_family; 2319 uint16_t sin6_port; 2320 uint32_t sin6_flowinfo; 2321 struct in6_addr sin6_addr; 2322 uint32_t sin6_scope_id; 2323 } 2324 ; 2325 #define SOL_IP 0 2326 #define IP_TOS 1 2327 #define IPV6_UNICAST_HOPS 16 2328 #define IPV6_MULTICAST_IF 17 2329 #define IPV6_MULTICAST_HOPS 18 2330 #define IPV6_MULTICAST_LOOP 19 2331 #define IPV6_JOIN_GROUP 20 2332 #define IPV6_LEAVE_GROUP 21 2333 #define IPV6_V6ONLY 26 2334 #define IP_MULTICAST_IF 32 2335 #define IP_MULTICAST_TTL 33 2336 #define IP_MULTICAST_LOOP 34 2337 #define IP_ADD_MEMBERSHIP 35 2338 #define IP_DROP_MEMBERSHIP 36 2339 2340 struct ipv6_mreq 2341 { 2342 struct in6_addr ipv6mr_multiaddr; 2343 int ipv6mr_interface; 2344 } 2345 ; 2346 struct ip_mreq 2347 { 2348 struct in_addr imr_multiaddr; 2349 struct in_addr imr_interface; 2350 } 2351 ; 2352 _________________________________________________________ 2353 2354 7.4.19. netinet/tcp.h 2355 2356 #define TCP_NODELAY 1 2357 #define SOL_TCP 6 2358 _________________________________________________________ 2359 2360 7.4.20. netinet/udp.h 2361 2362 #define SOL_UDP 17 2363 _________________________________________________________ 2364 2365 7.4.21. nl_types.h 2366 2367 #define NL_CAT_LOCALE 1 2368 #define NL_SETD 1 2369 2370 typedef void *nl_catd; 2371 2372 typedef int nl_item; 2373 _________________________________________________________ 2374 2375 7.4.22. pty.h 2376 2377 struct winsize 2378 { 2379 unsigned short ws_row; 2380 unsigned short ws_col; 2381 unsigned short ws_xpixel; 2382 unsigned short ws_ypixel; 2383 } 2384 ; 2385 _________________________________________________________ 2386 2387 7.4.23. pwd.h 2388 2389 struct passwd 2390 { 2391 char *pw_name; 2392 char *pw_passwd; 2393 uid_t pw_uid; 2394 gid_t pw_gid; 2395 char *pw_gecos; 2396 char *pw_dir; 2397 char *pw_shell; 2398 } 2399 ; 2400 _________________________________________________________ 2401 2402 7.4.24. regex.h 2403 2404 typedef unsigned long reg_syntax_t; 2405 2406 typedef struct re_pattern_buffer 2407 { 2408 unsigned char *buffer; 2409 unsigned long allocated; 2410 unsigned long used; 2411 reg_syntax_t syntax; 2412 char *fastmap; 2413 char *translate; 2414 size_t re_nsub; 2415 unsigned int can_be_null:1; 2416 unsigned int regs_allocated:2; 2417 unsigned int fastmap_accurate:1; 2418 unsigned int no_sub:1; 2419 unsigned int not_bol:1; 2420 unsigned int not_eol:1; 2421 unsigned int newline_anchor:1; 2422 } 2423 regex_t; 2424 typedef int regoff_t; 2425 typedef struct 2426 { 2427 regoff_t rm_so; 2428 regoff_t rm_eo; 2429 } 2430 regmatch_t; 2431 #define REG_ICASE (REG_EXTENDED<<1) 2432 #define REG_NEWLINE (REG_ICASE<<1) 2433 #define REG_NOSUB (REG_NEWLINE<<1) 2434 #define REG_EXTENDED 1 2435 2436 #define REG_NOTEOL (1<<1) 2437 #define REG_NOTBOL 1 2438 2439 typedef enum 2440 { 2441 REG_ENOSYS, REG_NOERROR, REG_NOMATCH, REG_BADPAT, REG_ECOLLATE, REG_E 2442 CTYPE, 2443 REG_EESCAPE, REG_ESUBREG, REG_EBRACK, REG_EPAREN, REG_EBRACE, REG_B 2444 ADBR, 2445 REG_ERANGE, REG_ESPACE, REG_BADRPT, REG_EEND, REG_ESIZE, REG_ERPARE 2446 N 2447 } 2448 reg_errcode_t; 2449 _________________________________________________________ 2450 2451 7.4.25. rpc/auth.h 2452 2453 enum auth_stat 2454 { 2455 AUTH_OK, AUTH_BADCRED = 1, AUTH_REJECTEDCRED = 2, AUTH_BADVERF = 2456 3, AUTH_REJECTEDVERF = 4, AUTH_TOOWEAK = 5, AUTH_INVALIDRESP = 2457 6, AUTH_FAILED = 7 2458 } 2459 ; 2460 2461 union des_block 2462 { 2463 struct 2464 { 2465 u_int32_t high; 2466 u_int32_t low; 2467 } 2468 key; 2469 char c[8]; 2470 } 2471 ; 2472 2473 struct opaque_auth 2474 { 2475 enum_t oa_flavor; 2476 caddr_t oa_base; 2477 u_int oa_length; 2478 } 2479 ; 2480 2481 typedef struct AUTH 2482 { 2483 struct opaque_auth ah_cred; 2484 struct opaque_auth ah_verf; 2485 union des_block ah_key; 2486 struct auth_ops *ah_ops; 2487 caddr_t ah_private; 2488 } 2489 AUTH; 2490 2491 struct auth_ops 2492 { 2493 void (*ah_nextverf) (struct AUTH *); 2494 int (*ah_marshal) (struct AUTH *, XDR *); 2495 int (*ah_validate) (struct AUTH *, struct opaque_auth *); 2496 int (*ah_refresh) (struct AUTH *); 2497 void (*ah_destroy) (struct AUTH *); 2498 } 2499 ; 2500 _________________________________________________________ 2501 2502 7.4.26. rpc/clnt.h 2503 2504 #define clnt_control(cl,rq,in) ((*(cl)->cl_ops->cl_control)(cl,rq,in)) 2505 #define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) 2506 #define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) ((*(rh) 2507 ->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) 2508 #define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) 2509 #define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh 2510 ,xres,resp)) 2511 #define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) 2512 #define NULLPROC ((u_long)0) 2513 #define CLSET_TIMEOUT 1 2514 #define CLGET_XID 10 2515 #define CLSET_XID 11 2516 #define CLGET_VERS 12 2517 #define CLSET_VERS 13 2518 #define CLGET_PROG 14 2519 #define CLSET_PROG 15 2520 #define CLGET_TIMEOUT 2 2521 #define CLGET_SERVER_ADDR 3 2522 #define CLSET_RETRY_TIMEOUT 4 2523 #define CLGET_RETRY_TIMEOUT 5 2524 #define CLGET_FD 6 2525 #define CLGET_SVC_ADDR 7 2526 #define CLSET_FD_CLOSE 8 2527 #define CLSET_FD_NCLOSE 9 2528 2529 enum clnt_stat 2530 { 2531 RPC_SUCCESS, RPC_CANTENCODEARGS = 1, RPC_CANTDECODERES = 2, RPC_CANTS 2532 END = 2533 3, RPC_CANTRECV = 4, RPC_TIMEDOUT = 5, RPC_VERSMISMATCH = 2534 6, RPC_AUTHERROR = 7, RPC_PROGUNAVAIL = 8, RPC_PROGVERSMISMATCH = 2535 9, RPC_PROCUNAVAIL = 10, RPC_CANTDECODEARGS = 11, RPC_SYSTEMERROR = 2536 12, RPC_NOBROADCAST = 21, RPC_UNKNOWNHOST = 13, RPC_UNKNOWNPROTO = 2537 17, RPC_UNKNOWNADDR = 19, RPC_RPCBFAILURE = 14, RPC_PROGNOTREGISTER 2538 ED = 2539 15, RPC_N2AXLATEFAILURE = 22, RPC_FAILED = 16, RPC_INTR = 2540 18, RPC_TLIERROR = 20, RPC_UDERROR = 23, RPC_INPROGRESS = 2541 24, RPC_STALERACHANDLE = 25 2542 } 2543 ; 2544 struct rpc_err 2545 { 2546 enum clnt_stat re_status; 2547 union 2548 { 2549 int RE_errno; 2550 enum auth_stat RE_why; 2551 struct 2552 { 2553 u_long low; 2554 u_long high; 2555 } 2556 RE_vers; 2557 struct 2558 { 2559 long s1; 2560 long s2; 2561 } 2562 RE_lb; 2563 } 2564 ru; 2565 } 2566 ; 2567 2568 typedef struct CLIENT 2569 { 2570 struct AUTH *cl_auth; 2571 struct clnt_ops *cl_ops; 2572 caddr_t cl_private; 2573 } 2574 CLIENT; 2575 2576 struct clnt_ops 2577 { 2578 enum clnt_stat (*cl_call) (struct CLIENT *, u_long, xdrproc_t, caddr_ 2579 t, 2580 xdrproc_t, caddr_t, struct timeval); 2581 void (*cl_abort) (void); 2582 void (*cl_geterr) (struct CLIENT *, struct rpc_err *); 2583 bool_t (*cl_freeres) (struct CLIENT *, xdrproc_t, caddr_t); 2584 void (*cl_destroy) (struct CLIENT *); 2585 bool_t (*cl_control) (struct CLIENT *, int, char *); 2586 } 2587 ; 2588 _________________________________________________________ 2589 2590 7.4.27. rpc/rpc_msg.h 2591 2592 enum msg_type 2593 { 2594 CALL, REPLY = 1 2595 } 2596 ; 2597 enum reply_stat 2598 { 2599 MSG_ACCEPTED, MSG_DENIED = 1 2600 } 2601 ; 2602 enum accept_stat 2603 { 2604 SUCCESS, PROG_UNAVAIL = 1, PROG_MISMATCH = 2, PROC_UNAVAIL = 2605 3, GARBAGE_ARGS = 4, SYSTEM_ERR = 5 2606 } 2607 ; 2608 enum reject_stat 2609 { 2610 RPC_MISMATCH, AUTH_ERROR = 1 2611 } 2612 ; 2613 2614 struct accepted_reply 2615 { 2616 struct opaque_auth ar_verf; 2617 enum accept_stat ar_stat; 2618 union 2619 { 2620 struct 2621 { 2622 unsigned long low; 2623 unsigned long high; 2624 } 2625 AR_versions; 2626 struct 2627 { 2628 caddr_t where; 2629 xdrproc_t proc; 2630 } 2631 AR_results; 2632 } 2633 ru; 2634 } 2635 ; 2636 2637 struct rejected_reply 2638 { 2639 enum reject_stat rj_stat; 2640 union 2641 { 2642 struct 2643 { 2644 unsigned long low; 2645 unsigned long high; 2646 } 2647 RJ_versions; 2648 enum auth_stat RJ_why; 2649 } 2650 ru; 2651 } 2652 ; 2653 2654 struct reply_body 2655 { 2656 enum reply_stat rp_stat; 2657 union 2658 { 2659 struct accepted_reply RP_ar; 2660 struct rejected_reply RP_dr; 2661 } 2662 ru; 2663 } 2664 ; 2665 2666 struct call_body 2667 { 2668 unsigned long cb_rpcvers; 2669 unsigned long cb_prog; 2670 unsigned long cb_vers; 2671 unsigned long cb_proc; 2672 struct opaque_auth cb_cred; 2673 struct opaque_auth cb_verf; 2674 } 2675 ; 2676 2677 struct rpc_msg 2678 { 2679 unsigned long rm_xid; 2680 enum msg_type rm_direction; 2681 union 2682 { 2683 struct call_body RM_cmb; 2684 struct reply_body RM_rmb; 2685 } 2686 ru; 2687 } 2688 ; 2689 _________________________________________________________ 2690 2691 7.4.28. rpc/svc.h 2692 2693 #define svc_freeargs(xprt,xargs, argsp) (*(xprt)->xp_ops->xp_freeargs)( 2694 (xprt), (xargs), (argsp)) 2695 #define svc_getargs(xprt,xargs, argsp) (*(xprt)->xp_ops->xp_getargs)(( 2696 xprt), (xargs), (argsp)) 2697 #define RPC_ANYSOCK -1 2698 2699 typedef struct SVCXPRT 2700 { 2701 int xp_sock; 2702 u_short xp_port; 2703 struct xp_ops *xp_ops; 2704 int xp_addrlen; 2705 struct sockaddr_in xp_raddr; 2706 struct opaque_auth xp_verf; 2707 caddr_t xp_p1; 2708 caddr_t xp_p2; 2709 char xp_pad[256]; 2710 } 2711 SVCXPRT; 2712 2713 struct svc_req 2714 { 2715 rpcprog_t rq_prog; 2716 rpcvers_t rq_vers; 2717 rpcproc_t rq_proc; 2718 struct opaque_auth rq_cred; 2719 caddr_t rq_clntcred; 2720 SVCXPRT *rq_xprt; 2721 } 2722 ; 2723 2724 typedef void (*__dispatch_fn_t) (struct svc_req *, SVCXPRT *); 2725 2726 struct xp_ops 2727 { 2728 bool_t (*xp_recv) (SVCXPRT * __xprt, struct rpc_msg * __msg); 2729 enum xprt_stat (*xp_stat) (SVCXPRT * __xprt); 2730 bool_t (*xp_getargs) (SVCXPRT * __xprt, xdrproc_t __xdr_args, 2731 caddr_t args_ptr); 2732 bool_t (*xp_reply) (SVCXPRT * __xprt, struct rpc_msg * __msg); 2733 bool_t (*xp_freeargs) (SVCXPRT * __xprt, xdrproc_t __xdr_args, 2734 caddr_t args_ptr); 2735 void (*xp_destroy) (SVCXPRT * __xprt); 2736 } 2737 ; 2738 _________________________________________________________ 2739 2740 7.4.29. rpc/types.h 2741 2742 typedef int bool_t; 2743 typedef int enum_t; 2744 typedef unsigned long rpcprog_t; 2745 typedef unsigned long rpcvers_t; 2746 typedef unsigned long rpcproc_t; 2747 typedef unsigned long rpcprot_t; 2748 _________________________________________________________ 2749 2750 7.4.30. rpc/xdr.h 2751 2752 enum xdr_op 2753 { 2754 XDR_ENCODE, XDR_DECODE, XDR_FREE 2755 } 2756 ; 2757 typedef struct XDR 2758 { 2759 enum xdr_op x_op; 2760 struct xdr_ops *x_ops; 2761 caddr_t x_public; 2762 caddr_t x_private; 2763 caddr_t x_base; 2764 int x_handy; 2765 } 2766 XDR; 2767 2768 struct xdr_ops 2769 { 2770 bool_t (*x_getlong) (XDR * __xdrs, long *__lp); 2771 bool_t (*x_putlong) (XDR * __xdrs, long *__lp); 2772 bool_t (*x_getbytes) (XDR * __xdrs, caddr_t __addr, u_int __len); 2773 bool_t (*x_putbytes) (XDR * __xdrs, char *__addr, u_int __len); 2774 u_int (*x_getpostn) (XDR * __xdrs); 2775 bool_t (*x_setpostn) (XDR * __xdrs, u_int __pos); 2776 int32_t *(*x_inline) (XDR * __xdrs, int __len); 2777 void (*x_destroy) (XDR * __xdrs); 2778 bool_t (*x_getint32) (XDR * __xdrs, int32_t * __ip); 2779 bool_t (*x_putint32) (XDR * __xdrs, int32_t * __ip); 2780 } 2781 ; 2782 2783 typedef bool_t (*xdrproc_t) (XDR *, void *, ...); 2784 2785 struct xdr_discrim 2786 { 2787 int value; 2788 xdrproc_t proc; 2789 } 2790 ; 2791 _________________________________________________________ 2792 2793 7.4.31. sched.h 2794 2795 #define SCHED_OTHER 0 2796 #define SCHED_FIFO 1 2797 #define SCHED_RR 2 2798 2799 struct sched_param 2800 { 2801 int sched_priority; 2802 } 2803 ; 2804 _________________________________________________________ 2805 2806 7.4.32. search.h 2807 2808 typedef struct entry 2809 { 2810 char *key; 2811 void *data; 2812 } 2813 ENTRY; 2814 typedef enum 2815 { 2816 FIND, ENTER 2817 } 2818 ACTION; 2819 typedef enum 2820 { 2821 preorder, postorder, endorder, leaf 2822 } 2823 VISIT; 2824 2825 typedef void (*__action_fn_t) (void *__nodep, VISIT __value, int __leve 2826 l); 2827 _________________________________________________________ 2828 2829 7.4.33. setjmp.h 2830 2831 #define setjmp(env) _setjmp(env) 2832 #define sigsetjmp(a,b) __sigsetjmp(a,b) 2833 2834 struct __jmp_buf_tag 2835 { 2836 __jmp_buf __jmpbuf; 2837 int __mask_was_saved; 2838 sigset_t __saved_mask; 2839 } 2840 ; 2841 2842 typedef struct __jmp_buf_tag jmp_buf[1]; 2843 typedef jmp_buf sigjmp_buf; 2844 _________________________________________________________ 2845 2846 7.4.34. signal.h 2847 2848 #define _SIGSET_NWORDS (1024/(8*sizeof(unsigned long))) 2849 #define SIGRTMAX (__libc_current_sigrtmax ()) 2850 #define SIGRTMIN (__libc_current_sigrtmin ()) 2851 #define SIG_BLOCK 0 2852 #define SIG_UNBLOCK 1 2853 #define SIG_SETMASK 2 2854 #define NSIG 65 2855 2856 typedef int sig_atomic_t; 2857 2858 typedef void (*sighandler_t) (int); 2859 #define SIG_HOLD ((sighandler_t) 2) 2860 #define SIG_ERR ((sighandler_t)-1) 2861 #define SIG_DFL ((sighandler_t)0) 2862 #define SIG_IGN ((sighandler_t)1) 2863 2864 #define SIGHUP 1 2865 #define SIGUSR1 10 2866 #define SIGSEGV 11 2867 #define SIGUSR2 12 2868 #define SIGPIPE 13 2869 #define SIGALRM 14 2870 #define SIGTERM 15 2871 #define SIGSTKFLT 16 2872 #define SIGCHLD 17 2873 #define SIGCONT 18 2874 #define SIGSTOP 19 2875 #define SIGINT 2 2876 #define SIGTSTP 20 2877 #define SIGTTIN 21 2878 #define SIGTTOU 22 2879 #define SIGURG 23 2880 #define SIGXCPU 24 2881 #define SIGXFSZ 25 2882 #define SIGVTALRM 26 2883 #define SIGPROF 27 2884 #define SIGWINCH 28 2885 #define SIGIO 29 2886 #define SIGQUIT 3 2887 #define SIGPWR 30 2888 #define SIGSYS 31 2889 #define SIGUNUSED 31 2890 #define SIGILL 4 2891 #define SIGTRAP 5 2892 #define SIGABRT 6 2893 #define SIGIOT 6 2894 #define SIGBUS 7 2895 #define SIGFPE 8 2896 #define SIGKILL 9 2897 #define SIGCLD SIGCHLD 2898 #define SIGPOLL SIGIO 2899 2900 #define SV_ONSTACK (1<<0) 2901 #define SV_INTERRUPT (1<<1) 2902 #define SV_RESETHAND (1<<2) 2903 2904 typedef union sigval 2905 { 2906 int sival_int; 2907 void *sival_ptr; 2908 } 2909 sigval_t; 2910 #define SIGEV_SIGNAL 0 2911 #define SIGEV_NONE 1 2912 #define SIGEV_THREAD 2 2913 #define SIGEV_MAX_SIZE 64 2914 2915 typedef struct sigevent 2916 { 2917 sigval_t sigev_value; 2918 int sigev_signo; 2919 int sigev_notify; 2920 union 2921 { 2922 int _pad[SIGEV_PAD_SIZE]; 2923 struct 2924 { 2925 void (*sigev_thread_func) (sigval_t); 2926 void *_attribute; 2927 } 2928 _sigev_thread; 2929 } 2930 _sigev_un; 2931 } 2932 sigevent_t; 2933 #define SI_MAX_SIZE 128 2934 #define si_pid _sifields._kill._pid 2935 #define si_uid _sifields._kill._uid 2936 #define si_value _sifields._rt._sigval 2937 #define si_int _sifields._rt._sigval.sival_int 2938 #define si_ptr _sifields._rt._sigval.sival_ptr 2939 #define si_status _sifields._sigchld._status 2940 #define si_stime _sifields._sigchld._stime 2941 #define si_utime _sifields._sigchld._utime 2942 #define si_addr _sifields._sigfault._addr 2943 #define si_band _sifields._sigpoll._band 2944 #define si_fd _sifields._sigpoll._fd 2945 #define si_timer1 _sifields._timer._timer1 2946 #define si_timer2 _sifields._timer._timer2 2947 2948 typedef struct siginfo 2949 { 2950 int si_signo; 2951 int si_errno; 2952 int si_code; 2953 union 2954 { 2955 int _pad[SI_PAD_SIZE]; 2956 struct 2957 { 2958 pid_t _pid; 2959 uid_t _uid; 2960 } 2961 _kill; 2962 struct 2963 { 2964 unsigned int _timer1; 2965 unsigned int _timer2; 2966 } 2967 _timer; 2968 struct 2969 { 2970 pid_t _pid; 2971 uid_t _uid; 2972 sigval_t _sigval; 2973 } 2974 _rt; 2975 struct 2976 { 2977 pid_t _pid; 2978 uid_t _uid; 2979 int _status; 2980 clock_t _utime; 2981 clock_t _stime; 2982 } 2983 _sigchld; 2984 struct 2985 { 2986 void *_addr; 2987 } 2988 _sigfault; 2989 struct 2990 { 2991 int _band; 2992 int _fd; 2993 } 2994 _sigpoll; 2995 } 2996 _sifields; 2997 } 2998 siginfo_t; 2999 #define SI_QUEUE -1 3000 #define SI_TIMER -2 3001 #define SI_MESGQ -3 3002 #define SI_ASYNCIO -4 3003 #define SI_SIGIO -5 3004 #define SI_TKILL -6 3005 #define SI_ASYNCNL -60 3006 #define SI_USER 0 3007 #define SI_KERNEL 0x80 3008 3009 #define ILL_ILLOPC 1 3010 #define ILL_ILLOPN 2 3011 #define ILL_ILLADR 3 3012 #define ILL_ILLTRP 4 3013 #define ILL_PRVOPC 5 3014 #define ILL_PRVREG 6 3015 #define ILL_COPROC 7 3016 #define ILL_BADSTK 8 3017 3018 #define FPE_INTDIV 1 3019 #define FPE_INTOVF 2 3020 #define FPE_FLTDIV 3 3021 #define FPE_FLTOVF 4 3022 #define FPE_FLTUND 5 3023 #define FPE_FLTRES 6 3024 #define FPE_FLTINV 7 3025 #define FPE_FLTSUB 8 3026 3027 #define SEGV_MAPERR 1 3028 #define SEGV_ACCERR 2 3029 3030 #define BUS_ADRALN 1 3031 #define BUS_ADRERR 2 3032 #define BUS_OBJERR 3 3033 3034 #define TRAP_BRKPT 1 3035 #define TRAP_TRACE 2 3036 3037 #define CLD_EXITED 1 3038 #define CLD_KILLED 2 3039 #define CLD_DUMPED 3 3040 #define CLD_TRAPPED 4 3041 #define CLD_STOPPED 5 3042 #define CLD_CONTINUED 6 3043 3044 #define POLL_IN 1 3045 #define POLL_OUT 2 3046 #define POLL_MSG 3 3047 #define POLL_ERR 4 3048 #define POLL_PRI 5 3049 #define POLL_HUP 6 3050 3051 typedef struct 3052 { 3053 unsigned long sig[_SIGSET_NWORDS]; 3054 } 3055 sigset_t; 3056 #define SA_NOCLDSTOP 0x00000001 3057 #define SA_NOCLDWAIT 0x00000002 3058 #define SA_SIGINFO 0x00000004 3059 #define SA_ONSTACK 0x08000000 3060 #define SA_RESTART 0x10000000 3061 #define SA_INTERRUPT 0x20000000 3062 #define SA_NODEFER 0x40000000 3063 #define SA_RESETHAND 0x80000000 3064 #define SA_NOMASK SA_NODEFER 3065 #define SA_ONESHOT SA_RESETHAND 3066 3067 typedef struct sigaltstack 3068 { 3069 void *ss_sp; 3070 int ss_flags; 3071 size_t ss_size; 3072 } 3073 stack_t; 3074 #define SS_ONSTACK 1 3075 #define SS_DISABLE 2 3076 _________________________________________________________ 3077 3078 7.4.35. stddef.h 3079 3080 #define offsetof(TYPE,MEMBER) ((size_t)& ((TYPE*)0)->MEMBER) 3081 #define NULL (0L) 3082 3083 typedef int wchar_t; 3084 _________________________________________________________ 3085 3086 7.4.36. stdio.h 3087 3088 #define EOF (-1) 3089 #define P_tmpdir "/tmp" 3090 #define FOPEN_MAX 16 3091 #define L_tmpnam 20 3092 #define FILENAME_MAX 4096 3093 #define BUFSIZ 8192 3094 #define L_ctermid 9 3095 #define L_cuserid 9 3096 3097 typedef struct 3098 { 3099 off_t __pos; 3100 mbstate_t __state; 3101 } 3102 fpos_t; 3103 typedef struct 3104 { 3105 off64_t __pos; 3106 mbstate_t __state; 3107 } 3108 fpos64_t; 3109 3110 typedef struct _IO_FILE FILE; 3111 #define _IOFBF 0 3112 #define _IOLBF 1 3113 #define _IONBF 2 3114 _________________________________________________________ 3115 3116 7.4.37. stdlib.h 3117 3118 #define MB_CUR_MAX (__ctype_get_mb_cur_max()) 3119 #define EXIT_SUCCESS 0 3120 #define EXIT_FAILURE 1 3121 #define RAND_MAX 2147483647 3122 3123 typedef int (*__compar_fn_t) (const void *, const void *); 3124 struct random_data 3125 { 3126 int32_t *fptr; 3127 int32_t *rptr; 3128 int32_t *state; 3129 int rand_type; 3130 int rand_deg; 3131 int rand_sep; 3132 int32_t *end_ptr; 3133 } 3134 ; 3135 3136 typedef struct 3137 { 3138 int quot; 3139 int rem; 3140 } 3141 div_t; 3142 3143 typedef struct 3144 { 3145 long quot; 3146 long rem; 3147 } 3148 ldiv_t; 3149 3150 typedef struct 3151 { 3152 long long quot; 3153 long long rem; 3154 } 3155 lldiv_t; 3156 _________________________________________________________ 3157 3158 7.4.38. sys/file.h 3159 3160 #define LOCK_SH 1 3161 #define LOCK_EX 2 3162 #define LOCK_NB 4 3163 #define LOCK_UN 8 3164 _________________________________________________________ 3165 3166 7.4.39. sys/ipc.h 3167 3168 #define IPC_PRIVATE ((key_t)0) 3169 #define IPC_RMID 0 3170 #define IPC_CREAT 00001000 3171 #define IPC_EXCL 00002000 3172 #define IPC_NOWAIT 00004000 3173 #define IPC_SET 1 3174 #define IPC_STAT 2 3175 _________________________________________________________ 3176 3177 7.4.40. sys/mman.h 3178 3179 #define MAP_FAILED ((void*)-1) 3180 #define PROT_NONE 0x0 3181 #define MAP_SHARED 0x01 3182 #define MAP_PRIVATE 0x02 3183 #define PROT_READ 0x1 3184 #define MAP_FIXED 0x10 3185 #define PROT_WRITE 0x2 3186 #define MAP_ANONYMOUS 0x20 3187 #define PROT_EXEC 0x4 3188 #define MS_ASYNC 1 3189 #define MS_INVALIDATE 2 3190 #define MS_SYNC 4 3191 #define MAP_ANON MAP_ANONYMOUS 3192 _________________________________________________________ 3193 3194 7.4.41. sys/msg.h 3195 3196 #define MSG_NOERROR 010000 3197 _________________________________________________________ 3198 3199 7.4.42. sys/param.h 3200 3201 #define NOFILE 256 3202 #define MAXPATHLEN 4096 3203 _________________________________________________________ 3204 3205 7.4.43. sys/poll.h 3206 3207 #define POLLIN 0x0001 3208 #define POLLPRI 0x0002 3209 #define POLLOUT 0x0004 3210 #define POLLERR 0x0008 3211 #define POLLHUP 0x0010 3212 #define POLLNVAL 0x0020 3213 3214 struct pollfd 3215 { 3216 int fd; 3217 short events; 3218 short revents; 3219 } 3220 ; 3221 typedef unsigned long nfds_t; 3222 _________________________________________________________ 3223 3224 7.4.44. sys/resource.h 3225 3226 #define RUSAGE_CHILDREN (-1) 3227 #define RUSAGE_BOTH (-2) 3228 #define RLIM_INFINITY (~0UL) 3229 #define RLIM_SAVED_CUR -1 3230 #define RLIM_SAVED_MAX -1 3231 #define RLIMIT_CPU 0 3232 #define RUSAGE_SELF 0 3233 #define RLIMIT_FSIZE 1 3234 #define RLIMIT_DATA 2 3235 #define RLIMIT_STACK 3 3236 #define RLIMIT_CORE 4 3237 #define RLIMIT_NOFILE 7 3238 #define RLIMIT_AS 9 3239 3240 typedef unsigned long rlim_t; 3241 typedef unsigned long long rlim64_t; 3242 typedef int __rlimit_resource_t; 3243 3244 struct rlimit 3245 { 3246 rlim_t rlim_cur; 3247 rlim_t rlim_max; 3248 } 3249 ; 3250 struct rlimit64 3251 { 3252 rlim64_t rlim_cur; 3253 rlim64_t rlim_max; 3254 } 3255 ; 3256 3257 struct rusage 3258 { 3259 struct timeval ru_utime; 3260 struct timeval ru_stime; 3261 long ru_maxrss; 3262 long ru_ixrss; 3263 long ru_idrss; 3264 long ru_isrss; 3265 long ru_minflt; 3266 long ru_majflt; 3267 long ru_nswap; 3268 long ru_inblock; 3269 long ru_oublock; 3270 long ru_msgsnd; 3271 long ru_msgrcv; 3272 long ru_nsignals; 3273 long ru_nvcsw; 3274 long ru_nivcsw; 3275 } 3276 ; 3277 3278 enum __priority_which 3279 { 3280 PRIO_PROCESS, PRIO_PGRP = 1, PRIO_USER = 2 3281 } 3282 ; 3283 #define PRIO_PGRP PRIO_PGRP 3284 #define PRIO_PROCESS PRIO_PROCESS 3285 #define PRIO_USER PRIO_USER 3286 3287 typedef enum __priority_which __priority_which_t; 3288 _________________________________________________________ 3289 3290 7.4.45. sys/sem.h 3291 3292 #define SEM_UNDO 0x1000 3293 #define GETPID 11 3294 #define GETVAL 12 3295 #define GETALL 13 3296 #define GETNCNT 14 3297 #define GETZCNT 15 3298 #define SETVAL 16 3299 #define SETALL 17 3300 3301 struct sembuf 3302 { 3303 short sem_num; 3304 short sem_op; 3305 short sem_flg; 3306 } 3307 ; 3308 _________________________________________________________ 3309 3310 7.4.46. sys/shm.h 3311 3312 #define SHM_RDONLY 010000 3313 #define SHM_W 0200 3314 #define SHM_RND 020000 3315 #define SHM_R 0400 3316 #define SHM_REMAP 040000 3317 #define SHM_LOCK 11 3318 #define SHM_UNLOCK 12 3319 _________________________________________________________ 3320 3321 7.4.47. sys/socket.h 3322 3323 #define SCM_RIGHTS 0x01 3324 #define SOL_SOCKET 1 3325 #define SOMAXCONN 128 3326 #define SOL_RAW 255 3327 3328 struct linger 3329 { 3330 int l_onoff; 3331 int l_linger; 3332 } 3333 ; 3334 struct cmsghdr 3335 { 3336 size_t cmsg_len; 3337 int cmsg_level; 3338 int cmsg_type; 3339 } 3340 ; 3341 struct iovec 3342 { 3343 void *iov_base; 3344 size_t iov_len; 3345 } 3346 ; 3347 3348 typedef unsigned short sa_family_t; 3349 typedef unsigned int socklen_t; 3350 3351 struct sockaddr 3352 { 3353 sa_family_t sa_family; 3354 char sa_data[14]; 3355 } 3356 ; 3357 struct sockaddr_storage 3358 { 3359 sa_family_t ss_family; 3360 __ss_aligntype __ss_align; 3361 char __ss_padding[(128 - (2 * sizeof (__ss_aligntype)))]; 3362 } 3363 ; 3364 3365 struct msghdr 3366 { 3367 void *msg_name; 3368 int msg_namelen; 3369 struct iovec *msg_iov; 3370 size_t msg_iovlen; 3371 void *msg_control; 3372 size_t msg_controllen; 3373 unsigned int msg_flags; 3374 } 3375 ; 3376 #define AF_UNSPEC 0 3377 #define AF_UNIX 1 3378 #define AF_INET6 10 3379 #define AF_INET 2 3380 3381 #define PF_INET AF_INET 3382 #define PF_INET6 AF_INET6 3383 #define PF_UNIX AF_UNIX 3384 #define PF_UNSPEC AF_UNSPEC 3385 3386 #define SOCK_STREAM 1 3387 #define SOCK_PACKET 10 3388 #define SOCK_DGRAM 2 3389 #define SOCK_RAW 3 3390 #define SOCK_RDM 4 3391 #define SOCK_SEQPACKET 5 3392 3393 #define SO_DEBUG 1 3394 #define SO_OOBINLINE 10 3395 #define SO_NO_CHECK 11 3396 #define SO_PRIORITY 12 3397 #define SO_LINGER 13 3398 #define SO_REUSEADDR 2 3399 #define SO_TYPE 3 3400 #define SO_ACCEPTCONN 30 3401 #define SO_ERROR 4 3402 #define SO_DONTROUTE 5 3403 #define SO_BROADCAST 6 3404 #define SO_SNDBUF 7 3405 #define SO_RCVBUF 8 3406 #define SO_KEEPALIVE 9 3407 3408 #define SIOCGIFCONF 0x8912 3409 #define SIOCGIFFLAGS 0x8913 3410 #define SIOCGIFADDR 0x8915 3411 #define SIOCGIFNETMASK 0x891b 3412 3413 #define SHUT_RD 0 3414 #define SHUT_WR 1 3415 #define SHUT_RDWR 2 3416 #define MSG_DONTROUTE 4 3417 3418 #define MSG_WAITALL 0x100 3419 #define MSG_TRUNC 0x20 3420 #define MSG_EOR 0x80 3421 #define MSG_OOB 1 3422 #define MSG_PEEK 2 3423 #define MSG_CTRUNC 8 3424 _________________________________________________________ 3425 3426 7.4.48. sys/stat.h 3427 3428 #define S_ISBLK(m) (((m)& S_IFMT)==S_IFBLK) 3429 #define S_ISCHR(m) (((m)& S_IFMT)==S_IFCHR) 3430 #define S_ISDIR(m) (((m)& S_IFMT)==S_IFDIR) 3431 #define S_ISFIFO(m) (((m)& S_IFMT)==S_IFIFO) 3432 #define S_ISLNK(m) (((m)& S_IFMT)==S_IFLNK) 3433 #define S_ISREG(m) (((m)& S_IFMT)==S_IFREG) 3434 #define S_ISSOCK(m) (((m)& S_IFMT)==S_IFSOCK) 3435 #define S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) 3436 #define S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) 3437 #define S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) 3438 #define S_IRWXU (S_IREAD|S_IWRITE|S_IEXEC) 3439 #define S_IROTH (S_IRGRP>>3) 3440 #define S_IRGRP (S_IRUSR>>3) 3441 #define S_IRWXO (S_IRWXG>>3) 3442 #define S_IRWXG (S_IRWXU>>3) 3443 #define S_IWOTH (S_IWGRP>>3) 3444 #define S_IWGRP (S_IWUSR>>3) 3445 #define S_IXOTH (S_IXGRP>>3) 3446 #define S_IXGRP (S_IXUSR>>3) 3447 #define S_ISVTX 01000 3448 #define S_IXUSR 0x0040 3449 #define S_IWUSR 0x0080 3450 #define S_IRUSR 0x0100 3451 #define S_ISGID 0x0400 3452 #define S_ISUID 0x0800 3453 #define S_IFIFO 0x1000 3454 #define S_IFCHR 0x2000 3455 #define S_IFDIR 0x4000 3456 #define S_IFBLK 0x6000 3457 #define S_IFREG 0x8000 3458 #define S_IFLNK 0xa000 3459 #define S_IFSOCK 0xc000 3460 #define S_IFMT 0xf000 3461 #define st_atime st_atim.tv_sec 3462 #define st_ctime st_ctim.tv_sec 3463 #define st_mtime st_mtim.tv_sec 3464 #define S_IREAD S_IRUSR 3465 #define S_IWRITE S_IWUSR 3466 #define S_IEXEC S_IXUSR 3467 _________________________________________________________ 3468 3469 7.4.49. sys/time.h 3470 3471 #define ITIMER_REAL 0 3472 #define ITIMER_VIRTUAL 1 3473 #define ITIMER_PROF 2 3474 3475 struct timezone 3476 { 3477 int tz_minuteswest; 3478 int tz_dsttime; 3479 } 3480 ; 3481 3482 typedef int __itimer_which_t; 3483 3484 struct timespec 3485 { 3486 time_t tv_sec; 3487 long tv_nsec; 3488 } 3489 ; 3490 3491 struct timeval 3492 { 3493 time_t tv_sec; 3494 suseconds_t tv_usec; 3495 } 3496 ; 3497 3498 struct itimerval 3499 { 3500 struct timeval it_interval; 3501 struct timeval it_value; 3502 } 3503 ; 3504 _________________________________________________________ 3505 3506 7.4.50. sys/timeb.h 3507 3508 struct timeb 3509 { 3510 time_t time; 3511 unsigned short millitm; 3512 short timezone; 3513 short dstflag; 3514 } 3515 ; 3516 _________________________________________________________ 3517 3518 7.4.51. sys/times.h 3519 3520 struct tms 3521 { 3522 clock_t tms_utime; 3523 clock_t tms_stime; 3524 clock_t tms_cutime; 3525 clock_t tms_cstime; 3526 } 3527 ; 3528 _________________________________________________________ 3529 3530 7.4.52. sys/types.h 3531 3532 #define FD_ISSET(d,set) ((set)->fds_bits[((d)/(8*sizeof(long)))]& (1<<( 3533 (d)%(8*sizeof(long))))) 3534 #define FD_CLR(d,set) ((set)->fds_bits[((d)/(8*sizeof(long)))]& =~(1< 3535 <((d)%(8*sizeof(long))))) 3536 #define FD_SET(d,set) ((set)->fds_bits[((d)/(8*sizeof(long)))]|=(1<<( 3537 (d)%(8*sizeof(long))))) 3538 #define FALSE 0 3539 #define TRUE 1 3540 #define FD_SETSIZE 1024 3541 #define FD_ZERO(fdsetp) bzero(fdsetp, sizeof(*(fdsetp))) 3542 3543 typedef signed char int8_t; 3544 typedef short int16_t; 3545 typedef int int32_t; 3546 typedef unsigned char u_int8_t; 3547 typedef unsigned short u_int16_t; 3548 typedef unsigned int u_int32_t; 3549 typedef unsigned int uid_t; 3550 typedef int pid_t; 3551 typedef unsigned long off_t; 3552 typedef int key_t; 3553 typedef long suseconds_t; 3554 typedef unsigned int u_int; 3555 typedef struct 3556 { 3557 int __val[2]; 3558 } 3559 fsid_t; 3560 typedef unsigned int useconds_t; 3561 typedef unsigned long blksize_t; 3562 typedef long fd_mask; 3563 typedef int timer_t; 3564 typedef int clockid_t; 3565 3566 typedef unsigned int id_t; 3567 3568 typedef unsigned long long ino64_t; 3569 typedef long long loff_t; 3570 typedef unsigned long blkcnt_t; 3571 typedef unsigned long fsblkcnt_t; 3572 typedef unsigned long fsfilcnt_t; 3573 typedef unsigned long long blkcnt64_t; 3574 typedef unsigned long long fsblkcnt64_t; 3575 typedef unsigned long long fsfilcnt64_t; 3576 typedef unsigned char u_char; 3577 typedef unsigned short u_short; 3578 typedef unsigned long u_long; 3579 3580 typedef unsigned long ino_t; 3581 typedef unsigned int gid_t; 3582 typedef unsigned long long dev_t; 3583 typedef unsigned int mode_t; 3584 typedef unsigned long nlink_t; 3585 typedef char *caddr_t; 3586 3587 typedef struct 3588 { 3589 unsigned long fds_bits[__FDSET_LONGS]; 3590 } 3591 fd_set; 3592 3593 typedef long clock_t; 3594 typedef long time_t; 3595 _________________________________________________________ 3596 3597 7.4.53. sys/un.h 3598 3599 #define UNIX_PATH_MAX 108 3600 3601 struct sockaddr_un 3602 { 3603 sa_family_t sun_family; 3604 char sun_path[UNIX_PATH_MAX]; 3605 } 3606 ; 3607 _________________________________________________________ 3608 3609 7.4.54. sys/utsname.h 3610 3611 #define SYS_NMLN 65 3612 3613 struct utsname 3614 { 3615 char sysname[65]; 3616 char nodename[65]; 3617 char release[65]; 3618 char version[65]; 3619 char machine[65]; 3620 char domainname[65]; 3621 } 3622 ; 3623 _________________________________________________________ 3624 3625 7.4.55. sys/wait.h 3626 3627 #define WIFSIGNALED(status) (!WIFSTOPPED(status) & & !WIFEXITED(sta 3628 tus)) 3629 #define WIFSTOPPED(status) (((status) & 0xff) == 0x7f) 3630 #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) 3631 #define WTERMSIG(status) ((status) & 0x7f) 3632 #define WCOREDUMP(status) ((status) & 0x80) 3633 #define WIFEXITED(status) (WTERMSIG(status) == 0) 3634 #define WNOHANG 0x00000001 3635 #define WUNTRACED 0x00000002 3636 #define WCOREFLAG 0x80 3637 #define WSTOPSIG(status) WEXITSTATUS(status) 3638 3639 typedef enum 3640 { 3641 P_ALL, P_PID, P_PGID 3642 } 3643 idtype_t; 3644 _________________________________________________________ 3645 3646 7.4.56. syslog.h 3647 3648 #define LOG_EMERG 0 3649 #define LOG_PRIMASK 0x07 3650 #define LOG_ALERT 1 3651 #define LOG_CRIT 2 3652 #define LOG_ERR 3 3653 #define LOG_WARNING 4 3654 #define LOG_NOTICE 5 3655 #define LOG_INFO 6 3656 #define LOG_DEBUG 7 3657 3658 #define LOG_KERN (0<<3) 3659 #define LOG_AUTHPRIV (10<<3) 3660 #define LOG_FTP (11<<3) 3661 #define LOG_USER (1<<3) 3662 #define LOG_MAIL (2<<3) 3663 #define LOG_DAEMON (3<<3) 3664 #define LOG_AUTH (4<<3) 3665 #define LOG_SYSLOG (5<<3) 3666 #define LOG_LPR (6<<3) 3667 #define LOG_NEWS (7<<3) 3668 #define LOG_UUCP (8<<3) 3669 #define LOG_CRON (9<<3) 3670 #define LOG_FACMASK 0x03f8 3671 3672 #define LOG_LOCAL0 (16<<3) 3673 #define LOG_LOCAL1 (17<<3) 3674 #define LOG_LOCAL2 (18<<3) 3675 #define LOG_LOCAL3 (19<<3) 3676 #define LOG_LOCAL4 (20<<3) 3677 #define LOG_LOCAL5 (21<<3) 3678 #define LOG_LOCAL6 (22<<3) 3679 #define LOG_LOCAL7 (23<<3) 3680 3681 #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) 3682 #define LOG_MASK(pri) (1 << (pri)) 3683 3684 #define LOG_PID 0x01 3685 #define LOG_CONS 0x02 3686 #define LOG_ODELAY 0x04 3687 #define LOG_NDELAY 0x08 3688 #define LOG_NOWAIT 0x10 3689 #define LOG_PERROR 0x20 3690 _________________________________________________________ 3691 3692 7.4.57. termios.h 3693 3694 #define TCIFLUSH 0 3695 #define TCOOFF 0 3696 #define TCSANOW 0 3697 #define BS0 0000000 3698 #define CR0 0000000 3699 #define FF0 0000000 3700 #define NL0 0000000 3701 #define TAB0 0000000 3702 #define VT0 0000000 3703 #define OPOST 0000001 3704 #define OCRNL 0000010 3705 #define ONOCR 0000020 3706 #define ONLRET 0000040 3707 #define OFILL 0000100 3708 #define OFDEL 0000200 3709 #define NL1 0000400 3710 #define TCOFLUSH 1 3711 #define TCOON 1 3712 #define TCSADRAIN 1 3713 #define TCIOFF 2 3714 #define TCIOFLUSH 2 3715 #define TCSAFLUSH 2 3716 #define TCION 3 3717 3718 typedef unsigned int speed_t; 3719 typedef unsigned char cc_t; 3720 typedef unsigned int tcflag_t; 3721 #define NCCS 32 3722 3723 struct termios 3724 { 3725 tcflag_t c_iflag; 3726 tcflag_t c_oflag; 3727 tcflag_t c_cflag; 3728 tcflag_t c_lflag; 3729 cc_t c_line; 3730 cc_t c_cc[NCCS]; 3731 speed_t c_ispeed; 3732 speed_t c_ospeed; 3733 } 3734 ; 3735 #define VINTR 0 3736 #define VQUIT 1 3737 #define VLNEXT 15 3738 #define VERASE 2 3739 #define VKILL 3 3740 #define VEOF 4 3741 3742 #define IGNBRK 0000001 3743 #define BRKINT 0000002 3744 #define IGNPAR 0000004 3745 #define PARMRK 0000010 3746 #define INPCK 0000020 3747 #define ISTRIP 0000040 3748 #define INLCR 0000100 3749 #define IGNCR 0000200 3750 #define ICRNL 0000400 3751 #define IXANY 0004000 3752 #define IMAXBEL 0020000 3753 3754 #define CS5 0000000 3755 3756 #define ECHO 0000010 3757 3758 #define B0 0000000 3759 #define B50 0000001 3760 #define B75 0000002 3761 #define B110 0000003 3762 #define B134 0000004 3763 #define B150 0000005 3764 #define B200 0000006 3765 #define B300 0000007 3766 #define B600 0000010 3767 #define B1200 0000011 3768 #define B1800 0000012 3769 #define B2400 0000013 3770 #define B4800 0000014 3771 #define B9600 0000015 3772 #define B19200 0000016 3773 #define B38400 0000017 3774 _________________________________________________________ 3775 3776 7.4.58. time.h 3777 3778 #define CLK_TCK ((clock_t)__sysconf(2)) 3779 #define CLOCK_REALTIME 0 3780 #define TIMER_ABSTIME 1 3781 #define CLOCKS_PER_SEC 1000000l 3782 3783 struct tm 3784 { 3785 int tm_sec; 3786 int tm_min; 3787 int tm_hour; 3788 int tm_mday; 3789 int tm_mon; 3790 int tm_year; 3791 int tm_wday; 3792 int tm_yday; 3793 int tm_isdst; 3794 long tm_gmtoff; 3795 char *tm_zone; 3796 } 3797 ; 3798 struct itimerspec 3799 { 3800 struct timespec it_interval; 3801 struct timespec it_value; 3802 } 3803 ; 3804 _________________________________________________________ 3805 3806 7.4.59. ulimit.h 3807 3808 #define UL_GETFSIZE 1 3809 #define UL_SETFSIZE 2 3810 _________________________________________________________ 3811 3812 7.4.60. unistd.h 3813 3814 #define SEEK_SET 0 3815 #define STDIN_FILENO 0 3816 #define SEEK_CUR 1 3817 #define STDOUT_FILENO 1 3818 #define SEEK_END 2 3819 #define STDERR_FILENO 2 3820 3821 typedef long long off64_t; 3822 #define F_OK 0 3823 #define X_OK 1 3824 #define W_OK 2 3825 #define R_OK 4 3826 3827 #define _POSIX_VDISABLE '\0' 3828 #define _POSIX_CHOWN_RESTRICTED 1 3829 #define _POSIX_JOB_CONTROL 1 3830 #define _POSIX_NO_TRUNC 1 3831 #define _POSIX_SHELL 1 3832 #define _POSIX_FSYNC 200112 3833 #define _POSIX_MAPPED_FILES 200112 3834 #define _POSIX_MEMLOCK 200112 3835 #define _POSIX_MEMLOCK_RANGE 200112 3836 #define _POSIX_MEMORY_PROTECTION 200112 3837 #define _POSIX_SEMAPHORES 200112 3838 #define _POSIX_SHARED_MEMORY_OBJECTS 200112 3839 #define _POSIX_TIMERS 200112 3840 #define _POSIX2_C_BIND 200112L 3841 #define _POSIX_THREADS 200112L 3842 3843 #define _PC_LINK_MAX 0 3844 #define _PC_MAX_CANON 1 3845 #define _PC_ASYNC_IO 10 3846 #define _PC_PRIO_IO 11 3847 #define _PC_FILESIZEBITS 13 3848 #define _PC_REC_INCR_XFER_SIZE 14 3849 #define _PC_REC_MIN_XFER_SIZE 16 3850 #define _PC_REC_XFER_ALIGN 17 3851 #define _PC_ALLOC_SIZE_MIN 18 3852 #define _PC_MAX_INPUT 2 3853 #define _PC_2_SYMLINKS 20 3854 #define _PC_NAME_MAX 3 3855 #define _PC_PATH_MAX 4 3856 #define _PC_PIPE_BUF 5 3857 #define _PC_CHOWN_RESTRICTED 6 3858 #define _PC_NO_TRUNC 7 3859 #define _PC_VDISABLE 8 3860 #define _PC_SYNC_IO 9 3861 3862 #define _SC_ARG_MAX 0 3863 #define _SC_CHILD_MAX 1 3864 #define _SC_PRIORITY_SCHEDULING 10 3865 #define _SC_TIMERS 11 3866 #define _SC_ASYNCHRONOUS_IO 12 3867 #define _SC_XBS5_ILP32_OFF32 125 3868 #define _SC_XBS5_ILP32_OFFBIG 126 3869 #define _SC_XBS5_LP64_OFF64 127 3870 #define _SC_XBS5_LPBIG_OFFBIG 128 3871 #define _SC_XOPEN_LEGACY 129 3872 #define _SC_PRIORITIZED_IO 13 3873 #define _SC_XOPEN_REALTIME 130 3874 #define _SC_XOPEN_REALTIME_THREADS 131 3875 #define _SC_ADVISORY_INFO 132 3876 #define _SC_BARRIERS 133 3877 #define _SC_CLOCK_SELECTION 137 3878 #define _SC_CPUTIME 138 3879 #define _SC_THREAD_CPUTIME 139 3880 #define _SC_SYNCHRONIZED_IO 14 3881 #define _SC_MONOTONIC_CLOCK 149 3882 #define _SC_FSYNC 15 3883 #define _SC_READER_WRITER_LOCKS 153 3884 #define _SC_SPIN_LOCKS 154 3885 #define _SC_REGEXP 155 3886 #define _SC_SHELL 157 3887 #define _SC_SPAWN 159 3888 #define _SC_MAPPED_FILES 16 3889 #define _SC_SPORADIC_SERVER 160 3890 #define _SC_THREAD_SPORADIC_SERVER 161 3891 #define _SC_TIMEOUTS 164 3892 #define _SC_TYPED_MEMORY_OBJECTS 165 3893 #define _SC_2_PBS_ACCOUNTING 169 3894 #define _SC_MEMLOCK 17 3895 #define _SC_2_PBS_LOCATE 170 3896 #define _SC_2_PBS_MESSAGE 171 3897 #define _SC_2_PBS_TRACK 172 3898 #define _SC_SYMLOOP_MAX 173 3899 #define _SC_2_PBS_CHECKPOINT 175 3900 #define _SC_V6_ILP32_OFF32 176 3901 #define _SC_V6_ILP32_OFFBIG 177 3902 #define _SC_V6_LP64_OFF64 178 3903 #define _SC_V6_LPBIG_OFFBIG 179 3904 #define _SC_MEMLOCK_RANGE 18 3905 #define _SC_HOST_NAME_MAX 180 3906 #define _SC_TRACE 181 3907 #define _SC_TRACE_EVENT_FILTER 182 3908 #define _SC_TRACE_INHERIT 183 3909 #define _SC_TRACE_LOG 184 3910 #define _SC_MEMORY_PROTECTION 19 3911 #define _SC_CLK_TCK 2 3912 #define _SC_MESSAGE_PASSING 20 3913 #define _SC_SEMAPHORES 21 3914 #define _SC_SHARED_MEMORY_OBJECTS 22 3915 #define _SC_AIO_LISTIO_MAX 23 3916 #define _SC_AIO_MAX 24 3917 #define _SC_AIO_PRIO_DELTA_MAX 25 3918 #define _SC_DELAYTIMER_MAX 26 3919 #define _SC_MQ_OPEN_MAX 27 3920 #define _SC_MQ_PRIO_MAX 28 3921 #define _SC_VERSION 29 3922 #define _SC_NGROUPS_MAX 3 3923 #define _SC_PAGESIZE 30 3924 #define _SC_PAGE_SIZE 30 3925 #define _SC_RTSIG_MAX 31 3926 #define _SC_SEM_NSEMS_MAX 32 3927 #define _SC_SEM_VALUE_MAX 33 3928 #define _SC_SIGQUEUE_MAX 34 3929 #define _SC_TIMER_MAX 35 3930 #define _SC_BC_BASE_MAX 36 3931 #define _SC_BC_DIM_MAX 37 3932 #define _SC_BC_SCALE_MAX 38 3933 #define _SC_BC_STRING_MAX 39 3934 #define _SC_OPEN_MAX 4 3935 #define _SC_COLL_WEIGHTS_MAX 40 3936 #define _SC_EXPR_NEST_MAX 42 3937 #define _SC_LINE_MAX 43 3938 #define _SC_RE_DUP_MAX 44 3939 #define _SC_2_VERSION 46 3940 #define _SC_2_C_BIND 47 3941 #define _SC_2_C_DEV 48 3942 #define _SC_2_FORT_DEV 49 3943 #define _SC_STREAM_MAX 5 3944 #define _SC_2_FORT_RUN 50 3945 #define _SC_2_SW_DEV 51 3946 #define _SC_2_LOCALEDEF 52 3947 #define _SC_TZNAME_MAX 6 3948 #define _SC_IOV_MAX 60 3949 #define _SC_THREADS 67 3950 #define _SC_THREAD_SAFE_FUNCTIONS 68 3951 #define _SC_GETGR_R_SIZE_MAX 69 3952 #define _SC_JOB_CONTROL 7 3953 #define _SC_GETPW_R_SIZE_MAX 70 3954 #define _SC_LOGIN_NAME_MAX 71 3955 #define _SC_TTY_NAME_MAX 72 3956 #define _SC_THREAD_DESTRUCTOR_ITERATIONS 73 3957 #define _SC_THREAD_KEYS_MAX 74 3958 #define _SC_THREAD_STACK_MIN 75 3959 #define _SC_THREAD_THREADS_MAX 76 3960 #define _SC_THREAD_ATTR_STACKADDR 77 3961 #define _SC_THREAD_ATTR_STACKSIZE 78 3962 #define _SC_THREAD_PRIORITY_SCHEDULING 79 3963 #define _SC_SAVED_IDS 8 3964 #define _SC_THREAD_PRIO_INHERIT 80 3965 #define _SC_THREAD_PRIO_PROTECT 81 3966 #define _SC_THREAD_PROCESS_SHARED 82 3967 #define _SC_ATEXIT_MAX 87 3968 #define _SC_PASS_MAX 88 3969 #define _SC_XOPEN_VERSION 89 3970 #define _SC_REALTIME_SIGNALS 9 3971 #define _SC_XOPEN_UNIX 91 3972 #define _SC_XOPEN_CRYPT 92 3973 #define _SC_XOPEN_ENH_I18N 93 3974 #define _SC_XOPEN_SHM 94 3975 #define _SC_2_CHAR_TERM 95 3976 #define _SC_2_C_VERSION 96 3977 #define _SC_2_UPE 97 3978 3979 #define _CS_PATH 0 3980 #define _POSIX_REGEXP 1 3981 #define _CS_XBS5_ILP32_OFF32_CFLAGS 1100 3982 #define _CS_XBS5_ILP32_OFF32_LDFLAGS 1101 3983 #define _CS_XBS5_ILP32_OFF32_LIBS 1102 3984 #define _CS_XBS5_ILP32_OFF32_LINTFLAGS 1103 3985 #define _CS_XBS5_ILP32_OFFBIG_CFLAGS 1104 3986 #define _CS_XBS5_ILP32_OFFBIG_LDFLAGS 1105 3987 #define _CS_XBS5_ILP32_OFFBIG_LIBS 1106 3988 #define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS 1107 3989 #define _CS_XBS5_LP64_OFF64_CFLAGS 1108 3990 #define _CS_XBS5_LP64_OFF64_LDFLAGS 1109 3991 #define _CS_XBS5_LP64_OFF64_LIBS 1110 3992 #define _CS_XBS5_LP64_OFF64_LINTFLAGS 1111 3993 #define _CS_XBS5_LPBIG_OFFBIG_CFLAGS 1112 3994 #define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS 1113 3995 #define _CS_XBS5_LPBIG_OFFBIG_LIBS 1114 3996 #define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS 1115 3997 3998 #define _XOPEN_REALTIME 1 3999 #define _XOPEN_XPG4 1 4000 4001 #define F_ULOCK 0 4002 #define F_LOCK 1 4003 #define F_TLOCK 2 4004 #define F_TEST 3 4005 _________________________________________________________ 4006 4007 7.4.61. utime.h 4008 4009 struct utimbuf 4010 { 4011 time_t actime; 4012 time_t modtime; 4013 } 4014 ; 4015 _________________________________________________________ 4016 4017 7.4.62. utmp.h 4018 4019 #define UT_HOSTSIZE 256 4020 #define UT_LINESIZE 32 4021 #define UT_NAMESIZE 32 4022 4023 struct exit_status 4024 { 4025 short e_termination; 4026 short e_exit; 4027 } 4028 ; 4029 4030 #define EMPTY 0 4031 #define RUN_LVL 1 4032 #define BOOT_TIME 2 4033 #define NEW_TIME 3 4034 #define OLD_TIME 4 4035 #define INIT_PROCESS 5 4036 #define LOGIN_PROCESS 6 4037 #define USER_PROCESS 7 4038 #define DEAD_PROCESS 8 4039 #define ACCOUNTING 9 4040 _________________________________________________________ 4041 4042 7.4.63. wchar.h 4043 4044 #define WEOF (0xffffffffu) 4045 #define WCHAR_MAX 0x7FFFFFFF 4046 #define WCHAR_MIN 0x80000000 4047 _________________________________________________________ 4048 4049 7.4.64. wctype.h 4050 4051 typedef unsigned long wctype_t; 4052 typedef unsigned int wint_t; 4053 typedef const int32_t *wctrans_t; 4054 typedef struct 4055 { 4056 int count; 4057 wint_t value; 4058 } 4059 __mbstate_t; 4060 4061 typedef __mbstate_t mbstate_t; 4062 _________________________________________________________ 4063 4064 7.4.65. wordexp.h 4065 4066 enum 4067 { 4068 WRDE_DOOFFS, WRDE_APPEND, WRDE_NOCMD, WRDE_REUSE, WRDE_SHOWERR, WRDE_ 4069 UNDEF, 4070 __WRDE_FLAGS 4071 } 4072 ; 4073 4074 typedef struct 4075 { 4076 int we_wordc; 4077 char **we_wordv; 4078 int we_offs; 4079 } 4080 wordexp_t; 4081 4082 enum 4083 { 4084 WRDE_NOSYS, WRDE_NOSPACE, WRDE_BADCHAR, WRDE_BADVAL, WRDE_CMDSUB, 4085 WRDE_SYNTAX 4086 } 4087 ; 4088 _________________________________________________________ 4089 4090 7.5. Interface Definitions for libc 4091 4092 Table of Contents 4093 _IO_feof -- alias for feof 4094 _IO_getc -- alias for getc 4095 _IO_putc -- alias for putc 4096 _IO_puts -- alias for puts 4097 __assert_fail -- abort the program after false assertion 4098 __ctype_b_loc -- accessor function for __ctype_b array for 4099 ctype functions 4100 4101 __ctype_get_mb_cur_max -- maximum length of a multibyte 4102 character in the current locale 4103 4104 __ctype_tolower_loc -- accessor function for __ctype_b_tolower 4105 array for ctype tolower() function 4106 4107 __ctype_toupper_loc -- accessor function for 4108 __ctype_b_toupper() array for ctype toupper() function 4109 4110 __cxa_atexit -- register a function to be called by exit or 4111 when a shared library is unloaded 4112 4113 __daylight -- Daylight savings time flag 4114 __environ -- alias for environ - user environment 4115 __errno_location -- address of errno variable 4116 __fpending -- returns in bytes the amount of output pending on 4117 a stream 4118 4119 __getpagesize -- alias for getpagesize - get current page size 4120 4121 __getpgid -- get the process group id 4122 __h_errno_location -- address of h_errno variable 4123 __isinf -- test for infinity 4124 __isinff -- test for infinity 4125 __isinfl -- test for infinity 4126 __isnan -- test for infinity 4127 __isnanf -- test for infinity 4128 __isnanl -- test for infinity 4129 __libc_current_sigrtmax -- return number of available 4130 real-time signal with lowest priority 4131 4132 __libc_current_sigrtmin -- return number of available 4133 real-time signal with highest priority 4134 4135 __libc_start_main -- initialization routine 4136 __lxstat -- inline wrapper around call to lxstat 4137 __mempcpy -- copy given number of bytes of source to 4138 destination 4139 4140 __rawmemchr -- scan memory 4141 __register_atfork -- alias for register_atfork 4142 __sigsetjmp -- save stack context for non-local goto 4143 __stpcpy -- copy a string returning a pointer to its end 4144 __strdup -- alias for strdup 4145 __strtod_internal -- underlying function for strtod 4146 __strtof_internal -- underlying function for strtof 4147 __strtok_r -- alias for strtok_r 4148 __strtol_internal -- alias for strtol 4149 __strtold_internal -- underlying function for strtold 4150 __strtoll_internal -- underlying function for strtoll 4151 __strtoul_internal -- underlying function for strtoul 4152 __strtoull_internal -- underlying function for strtoull 4153 __sysconf -- get configuration information at runtime 4154 __sysv_signal -- signal handling 4155 __timezone -- global variable containing timezone 4156 __tzname -- global variable containing the timezone 4157 __wcstod_internal -- underlying function for wcstod 4158 __wcstof_internal -- underlying function for wcstof 4159 __wcstol_internal -- underlying function for wcstol 4160 __wcstold_internal -- underlying function for wcstold 4161 __wcstoul_internal -- underlying function for wcstoul 4162 __xmknod -- make block or character special file 4163 __xstat -- Get File Status 4164 __xstat64 -- Get File Status 4165 _environ -- alias for environ - user environment 4166 _nl_msg_cat_cntr -- new catalog load counter 4167 _sys_errlist -- array containing the "C" locale strings used 4168 by strerror() 4169 4170 _sys_siglist -- array containing the names of the signal names 4171 acct -- switch process accounting on or off 4172 adjtime -- correct the time to allow synchronization of the 4173 system clock 4174 4175 adjtimex -- tune kernel clock (DEPRECATED) 4176 asprintf -- write formatted output to a dynamically allocated 4177 string 4178 4179 bind_textdomain_codeset -- specify encoding for message 4180 retrieval 4181 4182 bindresvport -- bind socket to privileged IP port 4183 bindtextdomain -- specify the location of a message catalog 4184 cfmakeraw -- get and set terminal attributes 4185 cfsetspeed -- set terminal input and output data rate 4186 creat -- open a file 4187 daemon -- run in the background 4188 dcgettext -- perform domain and category specific lookup in 4189 message catalog 4190 4191 dcngettext -- perform domain and category specific lookup in 4192 message catalog with plural 4193 4194 dgettext -- perform lookup in message catalog for the current 4195 LC_MESSAGES locale 4196 4197 dngettext -- perform lookup in message catalog for the current 4198 locale 4199 4200 err -- display formatted error messages 4201 error -- print error message 4202 errx -- display formatted error message and exit 4203 fcntl -- file control 4204 fflush_unlocked -- non thread safe fflush 4205 fgetwc_unlocked -- non thread safe fgetwc 4206 flock -- apply or remove an advisory lock on an open file 4207 fopen -- open a file 4208 freopen -- open a file 4209 getdomainname -- get NIS domain name (DEPRECATED). 4210 gethostbyname_r -- find network host database entry matching 4211 host name (DEPRECATED) 4212 4213 getloadavg -- get system load averages 4214 getopt -- parse command line options 4215 getopt_long -- parse command line options 4216 getopt_long_only -- parse command line options 4217 gettext -- Search message catalogs for a string 4218 getutent -- access user accounting database entries 4219 getutent_r -- access user accounting database entries 4220 glob64 -- find pathnames matching a pattern (Large File 4221 Support) 4222 4223 globfree64 -- free memory from glob64() (Large File Support) 4224 initgroups -- initialize the supplementary group access list 4225 ioctl -- control device 4226 sockio -- socket ioctl commands 4227 ttyio -- tty ioctl commands 4228 kill -- send a signal 4229 mbsnrtowcs -- convert a multibyte string to a wide character 4230 string 4231 4232 memmem -- locate bytes 4233 memrchr -- scan memory for a character 4234 ngettext -- Search message catalogs for plural string 4235 open -- open a file 4236 opterr -- external variable used in getopt() 4237 optind -- external variable used in getopt() 4238 optopt -- external variable used in getopt() 4239 pmap_getport -- Find the port number assigned to a service 4240 registered with a portmapper. 4241 4242 pmap_set -- Establishes mapping to machine's RPC Bind service. 4243 pmap_unset -- Destroys RPC Binding 4244 psignal -- print signal message 4245 random_r -- generate random number (DEPRECATED) 4246 setbuffer -- stream buffering operation 4247 setdomainname -- set NIS domain name (DEPRECATED). 4248 setgroups -- set list of supplementary group IDs 4249 sethostid -- set the unique identifier of the current host 4250 (DEPRECATED) 4251 4252 sethostname -- set host name 4253 setsockopt -- set options on sockets 4254 setutent -- access user accounting database entries 4255 sigandset -- build a new signal set by combining the two input 4256 sets using logical AND 4257 4258 sigblock -- manipulate the signal mask (DEPRECATED) 4259 siggetmask -- manipulate the signal mask (DEPRECATED) 4260 sigisemptyset -- check for empty signal set 4261 sigorset -- build a new signal set by combining the two input 4262 sets using logical OR 4263 4264 sigreturn -- return from signal handler and cleanup stack 4265 frame 4266 4267 stime -- set time 4268 stpcpy -- copy a string returning a pointer to its end 4269 stpncpy -- copy a fixed-size string, returning a pointer to 4270 its end 4271 4272 strcasestr -- locate a substring ignoring case 4273 strerror_r -- reentrant version of strerror 4274 strfry -- randomize a string (DEPRECATED) 4275 strndup -- return a malloc'd copy of at most the specified 4276 number of bytes of a string 4277 4278 strnlen -- determine the length of a fixed-size string 4279 strptime -- parse a time string 4280 strsep -- extract token from string 4281 strsignal -- return string describing signal 4282 strtoq -- convert string value to a long or quad_t integer 4283 strtouq -- convert a string to an unsigned long long 4284 strverscmp -- compare strings holding name and indices/version 4285 numbers (DEPRECATED) 4286 4287 svc_register -- Register Remote Procedure Call Interface 4288 svc_run -- Waits for RPC requests to arrive and calls service 4289 procedure. 4290 4291 svc_sendreply -- called by RPC service's dispatch routine 4292 svctcp_create -- Creates a TCP/IP-based RPC service transport. 4293 svcudp_create -- Creates a UDP-based RPC service transport. 4294 system -- execute a shell command 4295 textdomain -- set the current default message domain 4296 unlink -- remove a directory entry 4297 utmpname -- set user accounting database 4298 vasprintf -- write formatted output to a dynamically allocated 4299 string 4300 4301 vdprintf -- write formatted output to a file descriptor 4302 verrx -- display formatted error message and exit 4303 vsyslog -- log to system log 4304 wait3 -- wait for child process (DEPRECATED) 4305 wait4 -- wait for process termination, BSD style 4306 waitpid -- wait for child process 4307 warn -- formatted error messages 4308 warnx -- formatted error messages 4309 wcpcpy -- copy a wide character string, returning a pointer to 4310 its end 4311 4312 wcpncpy -- copy a fixed-size string of wide characters, 4313 returning a pointer to its end 4314 4315 wcscasecmp -- compare two wide-character strings, ignoring 4316 case 4317 4318 wcsdup -- duplicate a wide-character string 4319 wcsncasecmp -- compare two fixed-size wide-character strings, 4320 ignoring case 4321 4322 wcsnlen -- determine the length of a fixed-size wide-character 4323 string 4324 4325 wcsnrtombs -- convert a wide character string to a multi-byte 4326 string 4327 4328 wcstoq -- convert wide string to long long int representation 4329 wcstouq -- convert wide string to unsigned long long int 4330 representation 4331 4332 xdr_u_int -- library routines for external data representation 4333 4334 The following interfaces are included in libc and are defined 4335 by this specification. Unless otherwise noted, these 4336 interfaces shall be included in the source standard. 4337 4338 Other interfaces listed above for libc shall behave as 4339 described in the referenced base document. 4340 4341 _IO_feof 4342 4343 Name 4344 4345 _IO_feof -- alias for feof 4346 4347 Synopsis 4348 4349 int _IO_feof(_IO_FILE * __fp); 4350 4351 Description 4352 4353 _IO_feof() tests the end-of-file indicator for the stream 4354 pointed to by __fp, returning a non-zero value if it is set. 4355 4356 _IO_feof() is not in the source standard; it is only in the 4357 binary standard. 4358 4359 _IO_getc 4360 4361 Name 4362 4363 _IO_getc -- alias for getc 4364 4365 Synopsis 4366 4367 int _IO_getc(_IO_FILE * __fp); 4368 4369 Description 4370 4371 _IO_getc() reads the next character from __fp and returns it 4372 as an unsigned char cast to an int, or EOF on end-of-file or 4373 error. 4374 4375 _IO_getc() is not in the source standard; it is only in the 4376 binary standard. 4377 4378 _IO_putc 4379 4380 Name 4381 4382 _IO_putc -- alias for putc 4383 4384 Synopsis 4385 4386 int _IO_putc(int __c, _IO_FILE * __fp); 4387 4388 Description 4389 4390 _IO_putc() writes the character __c, cast to an unsigned char, 4391 to __fp. 4392 4393 _IO_putc() is not in the source standard; it is only in the 4394 binary standard. 4395 4396 _IO_puts 4397 4398 Name 4399 4400 _IO_puts -- alias for puts 4401 4402 Synopsis 4403 4404 int _IO_puts(const char * __c); 4405 4406 Description 4407 4408 _IO_puts() writes the string __s and a trailing newline to 4409 stdout. 4410 4411 _IO_puts() is not in the source standard; it is only in the 4412 binary standard. 4413 4414 __assert_fail 4415 4416 Name 4417 4418 __assert_fail -- abort the program after false assertion 4419 4420 Synopsis 4421 4422 void __assert_fail(const char * assertion, const char * file, 4423 unsigned int line, const char * function); 4424 4425 Description 4426 4427 The __assert_fail() function is used to implement the assert() 4428 interface of ISO POSIX (2003). The __assert_fail() function 4429 shall print the given file filename, line line number, 4430 function function name and a message on the standard error 4431 stream in an unspecified format, and abort program execution 4432 via the abort() function. For example: 4433 4434 a.c:10: foobar: Assertion a == b failed. 4435 4436 If function is NULL, __assert_fail() shall omit information 4437 about the function. 4438 4439 assertion, file, and line shall be non-NULL. 4440 4441 The __assert_fail() function is not in the source standard; it 4442 is only in the binary standard. The assert() interface is not 4443 in the binary standard; it is only in the source standard. The 4444 assert() may be implemented as a macro. 4445 4446 __ctype_b_loc 4447 4448 Name 4449 4450 __ctype_b_loc -- accessor function for __ctype_b array for 4451 ctype functions 4452 4453 Synopsis 4454 4455 #include 4456 4457 const unsigned short * * __ctype_b_loc (void); 4458 4459 Description 4460 4461 The __ctype_b_loc() function shall return a pointer into an 4462 array of characters in the current locale that contains 4463 characteristics for each character in the current character 4464 set. The array shall contain a total of 384 characters, and 4465 can be indexed with any signed or unsigned char (i.e. with an 4466 index value between -128 and 255). If the application is 4467 multithreaded, the array shall be local to the current thread. 4468 4469 This interface is not in the source standard; it is only in 4470 the binary standard. 4471 4472 Return Value 4473 4474 The __ctype_b_loc() function shall return a pointer to the 4475 array of characters to be used for the ctype() family of 4476 functions (see ). 4477 4478 __ctype_get_mb_cur_max 4479 4480 Name 4481 4482 __ctype_get_mb_cur_max -- maximum length of a multibyte 4483 character in the current locale 4484 4485 Synopsis 4486 4487 size_t __ctype_get_mb_cur_max(void); 4488 4489 Description 4490 4491 __ctype_get_mb_cur_max() returns the maximum length of a 4492 multibyte character in the current locale. 4493 4494 __ctype_get_mb_cur_max() is not in the source standard; it is 4495 only in the binary standard. 4496 4497 __ctype_tolower_loc 4498 4499 Name 4500 4501 __ctype_tolower_loc -- accessor function for __ctype_b_tolower 4502 array for ctype tolower() function 4503 4504 Synopsis 4505 4506 #include 4507 4508 int32_t * * __ctype_tolower_loc(void); 4509 4510 Description 4511 4512 The __ctype_tolower_loc() function shall return a pointer into 4513 an array of characters in the current locale that contains 4514 lower case equivalents for each character in the current 4515 character set. The array shall contain a total of 384 4516 characters, and can be indexed with any signed or unsigned 4517 char (i.e. with an index value between -128 and 255). If the 4518 application is multithreaded, the array shall be local to the 4519 current thread. 4520 4521 This interface is not in the source standard; it is only in 4522 the binary standard. 4523 4524 Return Value 4525 4526 The __ctype_tolower_loc() function shall return a pointer to 4527 the array of characters to be used for the ctype() family of 4528 functions (see ). 4529 4530 __ctype_toupper_loc 4531 4532 Name 4533 4534 __ctype_toupper_loc -- accessor function for 4535 __ctype_b_toupper() array for ctype toupper() function 4536 4537 Synopsis 4538 4539 #include 4540 4541 int32_t * * __ctype_toupper_loc(void); 4542 4543 Description 4544 4545 The __ctype_toupper_loc() function shall return a pointer into 4546 an array of characters in the current locale that contains 4547 upper case equivalents for each character in the current 4548 character set. The array shall contain a total of 384 4549 characters, and can be indexed with any signed or unsigned 4550 char (i.e. with an index value between -128 and 255). If the 4551 application is multithreaded, the array shall be local to the 4552 current thread. 4553 4554 This interface is not in the source standard; it is only in 4555 the binary standard. 4556 4557 Return Value 4558 4559 The __ctype_toupper_loc() function shall return a pointer to 4560 the array of characters to be used for the ctype() family of 4561 functions (see ). 4562 4563 __cxa_atexit 4564 4565 Name 4566 4567 __cxa_atexit -- register a function to be called by exit or 4568 when a shared library is unloaded 4569 4570 Synopsis 4571 4572 int __cxa_atexit(void (*func) (void *), void * arg, void * 4573 dso_handle); 4574 4575 Description 4576 4577 __cxa_atexit() registers a function to be called by exit or 4578 when a shared library is unloaded. 4579 4580 The __cxa_atexit() function is used to implement atexit(), as 4581 described in ISO POSIX (2003). Calling 4582 atexit(func) 4583 4584 from the statically linked part of an application shall be 4585 equivalent to 4586 __cxa_atexit(func, NULL, NULL) 4587 4588 . 4589 4590 __cxa_atexit() is not in the source standard; it is only in 4591 the binary standard. atexit() is not in the binary standard; 4592 it is only in the source standard. 4593 4594 __daylight 4595 4596 Name 4597 4598 __daylight -- Daylight savings time flag 4599 4600 Synopsis 4601 4602 int __daylight; 4603 4604 Description 4605 4606 The integer variable __daylight shall implement the daylight 4607 savings time flag daylight as specified in the ISO POSIX 4608 (2003) header file . 4609 4610 __daylight is not in the source standard; it is only in the 4611 binary standard. daylight is not in the binary standard; it is 4612 only in the source standard. 4613 4614 __environ 4615 4616 Name 4617 4618 __environ -- alias for environ - user environment 4619 4620 Synopsis 4621 4622 extern char * *__environ; 4623 4624 Description 4625 4626 __environ is an alias for environ - user environment. 4627 4628 __environ has the same specification as environ. 4629 4630 __environ is not in the source standard; it is only in the 4631 binary standard. 4632 4633 __errno_location 4634 4635 Name 4636 4637 __errno_location -- address of errno variable 4638 4639 Synopsis 4640 4641 int * __errno_location(void); 4642 4643 Description 4644 4645 __errno_location() is not in the source standard; it is only 4646 in the binary standard. 4647 4648 __fpending 4649 4650 Name 4651 4652 __fpending -- returns in bytes the amount of output pending on 4653 a stream 4654 4655 Synopsis 4656 4657 #include 4658 4659 size_t __fpending(FILE * stream); 4660 4661 Description 4662 4663 __fpending() returns the amount of output in bytes pending on 4664 a stream. 4665 4666 __fpending() is not in the source standard; it is only in the 4667 binary standard. 4668 4669 __getpagesize 4670 4671 Name 4672 4673 __getpagesize -- alias for getpagesize - get current page size 4674 4675 Synopsis 4676 4677 int __getpagesize(void); 4678 4679 Description 4680 4681 __getpagesize() is an alias for getpagesize() - get current 4682 page size. 4683 4684 __getpagesize() has the same specification as getpagesize(). 4685 4686 __getpagesize() is not in the source standard; it is only in 4687 the binary standard. 4688 4689 __getpgid 4690 4691 Name 4692 4693 __getpgid -- get the process group id 4694 4695 Synopsis 4696 4697 pid_t __getpgid(pid_t pid); 4698 4699 Description 4700 4701 __getpgid() has the same specification as getpgid(). 4702 4703 __getpgid() is not in the source standard; it is only in the 4704 binary standard. 4705 4706 __h_errno_location 4707 4708 Name 4709 4710 __h_errno_location -- address of h_errno variable 4711 4712 Synopsis 4713 4714 int * __h_errno_location(void); 4715 4716 Description 4717 4718 __h_errno_location() returns the address of the h_errno 4719 variable, where h_errno is as specified in ISO POSIX (2003). 4720 4721 __h_errno_location() is not in the source standard; it is only 4722 in the binary standard. Note that h_errno itself is only in 4723 the source standard; it is not in the binary standard. 4724 4725 __isinf 4726 4727 Name 4728 4729 __isinf -- test for infinity 4730 4731 Synopsis 4732 4733 int __isinf(double arg); 4734 4735 Description 4736 4737 __isinf() has the same specification as isinf() in ISO POSIX 4738 (2003), except that the argument type for __isinf() is known 4739 to be double. 4740 4741 __isinf() is not in the source standard; it is only in the 4742 binary standard. 4743 4744 __isinff 4745 4746 Name 4747 4748 __isinff -- test for infinity 4749 4750 Synopsis 4751 4752 int __isinff(float arg); 4753 4754 Description 4755 4756 __isinff() has the same specification as isinf() in ISO POSIX 4757 (2003) except that the argument type for __isinff() is known 4758 to be float. 4759 4760 __isinff() is not in the source standard; it is only in the 4761 binary standard. 4762 4763 __isinfl 4764 4765 Name 4766 4767 __isinfl -- test for infinity 4768 4769 Synopsis 4770 4771 int __isinfl(long double arg); 4772 4773 Description 4774 4775 __isinfl() has the same specification as isinf() in the ISO 4776 POSIX (2003), except that the argument type for __isinfl() is 4777 known to be long double. 4778 4779 __isinfl() is not in the source standard; it is only in the 4780 binary standard. 4781 4782 __isnan 4783 4784 Name 4785 4786 __isnan -- test for infinity 4787 4788 Synopsis 4789 4790 int __isnan(double arg); 4791 4792 Description 4793 4794 __isnan() has the same specification as isnan() in ISO POSIX 4795 (2003), except that the argument type for __isnan() is known 4796 to be double. 4797 4798 __isnan() is not in the source standard; it is only in the 4799 binary standard. 4800 4801 __isnanf 4802 4803 Name 4804 4805 __isnanf -- test for infinity 4806 4807 Synopsis 4808 4809 int __isnanf(float arg); 4810 4811 Description 4812 4813 __isnanf() has the same specification as isnan() in ISO POSIX 4814 (2003), except that the argument type for __isnanf() is known 4815 to be float. 4816 4817 __isnanf() is not in the source standard; it is only in the 4818 binary standard. 4819 4820 __isnanl 4821 4822 Name 4823 4824 __isnanl -- test for infinity 4825 4826 Synopsis 4827 4828 int __isnanl(long double arg); 4829 4830 Description 4831 4832 __isnanl() has the same specification as isnan() in ISO POSIX 4833 (2003), except that the argument type for __isnanl() is known 4834 to be long double. 4835 4836 __isnanl() is not in the source standard; it is only in the 4837 binary standard. 4838 4839 __libc_current_sigrtmax 4840 4841 Name 4842 4843 __libc_current_sigrtmax -- return number of available 4844 real-time signal with lowest priority 4845 4846 Synopsis 4847 4848 int __libc_current_sigrtmax(void); 4849 4850 Description 4851 4852 __libc_current_sigrtmax() returns the number of an available 4853 real-time signal with the lowest priority. 4854 4855 __libc_current_sigrtmax() is not in the source standard; it is 4856 only in the binary standard. 4857 4858 __libc_current_sigrtmin 4859 4860 Name 4861 4862 __libc_current_sigrtmin -- return number of available 4863 real-time signal with highest priority 4864 4865 Synopsis 4866 4867 int __libc_current_sigrtmin(void); 4868 4869 Description 4870 4871 __libc_current_sigrtmin() returns the number of an available 4872 real-time signal with the highest priority. 4873 4874 __libc_current_sigrtmin() is not in the source standard; it is 4875 only in the binary standard. 4876 4877 __libc_start_main 4878 4879 Name 4880 4881 __libc_start_main -- initialization routine 4882 4883 Synopsis 4884 4885 int __libc_start_main(int *(main) (int, char * *, char * *), 4886 int argc, char * * ubp_av, void (*init) (void), void (*fini) 4887 (void), void (*rtld_fini) (void), void (* stack_end)); 4888 4889 Description 4890 4891 The __libc_start_main() function shall initialize the process, 4892 call the main function with appropriate arguments, and handle 4893 the return from main(). 4894 4895 __libc_start_main() is not in the source standard; it is only 4896 in the binary standard. 4897 4898 __lxstat 4899 4900 Name 4901 4902 __lxstat -- inline wrapper around call to lxstat 4903 4904 Synopsis 4905 4906 #include 4907 4908 int __lxstat(int version, char * __path, struct stat 4909 __statbuf); 4910 4911 Description 4912 4913 __lxstat() is an inline wrapper around call to lxstat(). 4914 4915 __lxstat() is not in the source standard; it is only in the 4916 binary standard. 4917 4918 __mempcpy 4919 4920 Name 4921 4922 __mempcpy -- copy given number of bytes of source to 4923 destination 4924 4925 Synopsis 4926 4927 #include 4928 4929 ptr_t __mempcpy(ptr_t restrict dest, const ptr_t restrict src, 4930 size_t n); 4931 4932 Description 4933 4934 __mempcpy() copies n bytes of source to destination, returning 4935 pointer to bytes after the last written byte. 4936 4937 __mempcpy() is not in the source standard; it is only in the 4938 binary standard. 4939 4940 __rawmemchr 4941 4942 Name 4943 4944 __rawmemchr -- scan memory 4945 4946 Synopsis 4947 4948 #include 4949 4950 ptr_t __rawmemchr(const ptr_t s, int c); 4951 4952 Description 4953 4954 __rawmemchr() searches in s for c. 4955 4956 __rawmemchr() is a weak alias to rawmemchr(). It is similar to 4957 memchr(), but it has no length limit. 4958 4959 __rawmemchr() is not in the source standard; it is only in the 4960 binary standard. 4961 4962 __register_atfork 4963 4964 Name 4965 4966 __register_atfork -- alias for register_atfork 4967 4968 Synopsis 4969 4970 int __register_atfork(void (*prepare) (void), void (*parent) 4971 (void), void (*child) (void), void * __dso_handle); 4972 4973 Description 4974 4975 __register_atfork() implements pthread_atfork() as specified 4976 in ISO POSIX (2003). The additional parameter __dso_handle 4977 allows a shared object to pass in it's handle so that 4978 functions registered by __register_atfork() can be 4979 unregistered by the runtime when the shared object is 4980 unloaded. 4981 4982 __sigsetjmp 4983 4984 Name 4985 4986 __sigsetjmp -- save stack context for non-local goto 4987 4988 Synopsis 4989 4990 int __sigsetjmp(jmp_buf env, int savemask); 4991 4992 Description 4993 4994 __sigsetjmp() has the same behavior as sigsetjmp() as 4995 specified by ISO POSIX (2003). 4996 4997 __sigsetjmp() is not in the source standard; it is only in the 4998 binary standard. 4999 5000 __stpcpy 5001 5002 Name 5003 5004 __stpcpy -- copy a string returning a pointer to its end 5005 5006 Synopsis 5007 5008 #include 5009 5010 char * __stpcpy(char * dest, const char * src); 5011 5012 Description 5013 5014 __stpcpy() copies the string src (including the terminating /0 5015 character) to the array dest. The strings may not overlap, and 5016 dest must be large enough to receive the copy. 5017 5018 Return Value 5019 5020 __stpcpy() returns a pointer to the end of the string dest 5021 (that is, the address of the terminating NULL character) 5022 rather than the beginning. 5023 5024 __stpcpy() has the same specification as stpcpy(). 5025 5026 __stpcpy() is not in the source standard; it is only in the 5027 binary standard. 5028 5029 __strdup 5030 5031 Name 5032 5033 __strdup -- alias for strdup 5034 5035 Synopsis 5036 5037 char * __strdup(const char string); 5038 5039 Description 5040 5041 __strdup() has the same specification as strdup(). 5042 5043 __strdup() is not in the source standard; it is only in the 5044 binary standard. 5045 5046 __strtod_internal 5047 5048 Name 5049 5050 __strtod_internal -- underlying function for strtod 5051 5052 Synopsis 5053 5054 double __strtod_internal(const char * __nptr, char * * 5055 __endptr, int __group); 5056 5057 Description 5058 5059 __group shall be 0 or the behavior of __strtod_internal() is 5060 undefined. 5061 5062 __strtod_internal(__nptr, __endptr, 0)() has the same 5063 specification as strtod(__nptr, __endptr)(). 5064 5065 __strtod_internal() is not in the source standard; it is only 5066 in the binary standard. 5067 5068 __strtof_internal 5069 5070 Name 5071 5072 __strtof_internal -- underlying function for strtof 5073 5074 Synopsis 5075 5076 float __strtof_internal(const char * __nptr, char * * 5077 __endptr, int __group); 5078 5079 Description 5080 5081 __group shall be 0 or the behavior of __strtof_internal() is 5082 undefined. 5083 5084 __strtof_internal(__nptr, __endptr, 0)() has the same 5085 specification as strtof(__nptr, __endptr)(). 5086 5087 __strtof_internal() is not in the source standard; it is only 5088 in the binary standard. 5089 5090 __strtok_r 5091 5092 Name 5093 5094 __strtok_r -- alias for strtok_r 5095 5096 Synopsis 5097 5098 char * __strtok_r(char * restrict s, const char * restrict 5099 delim, char * * restrict save_ptr); 5100 5101 Description 5102 5103 __strtok_r() has the same specification as strtok_r(). 5104 5105 __strtok_r() is not in the source standard; it is only in the 5106 binary standard. 5107 5108 __strtol_internal 5109 5110 Name 5111 5112 __strtol_internal -- alias for strtol 5113 5114 Synopsis 5115 5116 long int __strtol_internal(const char * __nptr, char * * 5117 __endptr, int __base, int __group); 5118 5119 Description 5120 5121 __group shall be 0 or the behavior of __strtol_internal() is 5122 undefined. 5123 5124 __strtol_internal(__nptr, __endptr, __base, 0) has the same 5125 specification as strtol(__nptr, __endptr, __base). 5126 5127 __strtol_internal() is not in the source standard; it is only 5128 in the binary standard. 5129 5130 __strtold_internal 5131 5132 Name 5133 5134 __strtold_internal -- underlying function for strtold 5135 5136 Synopsis 5137 5138 long double __strtold_internal(const char * __nptr, char * * 5139 __endptr, int __group); 5140 5141 Description 5142 5143 __group shall be 0 or the behavior of __strtold_internal() is 5144 undefined. 5145 5146 __strtold_internal(__nptr, __endptr, 0) has the same 5147 specification as strtold(__nptr, __endptr). 5148 5149 __strtold_internal() is not in the source standard; it is only 5150 in the binary standard. 5151 5152 __strtoll_internal 5153 5154 Name 5155 5156 __strtoll_internal -- underlying function for strtoll 5157 5158 Synopsis 5159 5160 long long __strtoll_internal(const char * __nptr, char * * 5161 __endptr, int __base, int __group); 5162 5163 Description 5164 5165 __group shall be 0 or the behavior of __strtoll_internal() is 5166 undefined. 5167 5168 __strtoll_internal(__nptr, __endptr, __base, 0) has the same 5169 specification as strtoll(__nptr, __endptr, __base). 5170 5171 __strtoll_internal() is not in the source standard; it is only 5172 in the binary standard. 5173 5174 __strtoul_internal 5175 5176 Name 5177 5178 __strtoul_internal -- underlying function for strtoul 5179 5180 Synopsis 5181 5182 unsigned long int __strtoul_internal(const char * __nptr, char 5183 * * __endptr, int __base, int __group); 5184 5185 Description 5186 5187 __group shall be 0 or the behavior of __strtoul_internal() is 5188 undefined. 5189 5190 __strtoul_internal(__nptr, __endptr, __base, 0) has the same 5191 specification as strtoul(__nptr, __endptr, __base). 5192 5193 __strtoul_internal() is not in the source standard; it is only 5194 in the binary standard. 5195 5196 __strtoull_internal 5197 5198 Name 5199 5200 __strtoull_internal -- underlying function for strtoull 5201 5202 Synopsis 5203 5204 unsigned long long __strtoull_internal(const char * __nptr, 5205 char * * __endptr, int __base, int __group); 5206 5207 Description 5208 5209 __group shall be 0 or the behavior of __strtoull_internal() is 5210 undefined. 5211 5212 __strtoull_internal(__nptr, __endptr, __base, 0) has the same 5213 specification as strtoull(__nptr, __endptr, __base). 5214 5215 __strtoull_internal() is not in the source standard; it is 5216 only in the binary standard. 5217 5218 __sysconf 5219 5220 Name 5221 5222 __sysconf -- get configuration information at runtime 5223 5224 Synopsis 5225 5226 #include 5227 5228 long __sysconf(int name); 5229 5230 Description 5231 5232 __sysconf() gets configuration information at runtime. 5233 5234 __sysconf() is weak alias to sysconf(). 5235 5236 __sysconf() has the same specification as sysconf(). 5237 5238 __sysconf() is not in the source standard; it is only in the 5239 binary standard. 5240 5241 __sysv_signal 5242 5243 Name 5244 5245 __sysv_signal -- signal handling 5246 5247 Synopsis 5248 5249 __sighandler_t __sysv_signal(int sig, __sighandler_t handler); 5250 5251 Description 5252 5253 __sysv_signal() has the same behavior as signal() as specified 5254 by ISO POSIX (2003). 5255 5256 __sysv_signal() is not in the source standard; it is only in 5257 the binary standard. 5258 5259 __timezone 5260 5261 Name 5262 5263 -- global variable containing timezone 5264 5265 Synopsis 5266 5267 long int __timezone; 5268 5269 Description 5270 5271 __timezone() has the same specification as timezone() in the 5272 ISO POSIX (2003) 5273 5274 __tzname 5275 5276 Name 5277 5278 -- global variable containing the timezone 5279 5280 Synopsis 5281 5282 char * __tzname[2]; 5283 5284 Description 5285 5286 __tzname has the same specification as tzname in the ISO POSIX 5287 (2003). 5288 5289 Note that the array size of 2 is explicit in the ISO POSIX 5290 (2003), but not in the SUSv2. 5291 5292 __wcstod_internal 5293 5294 Name 5295 5296 __wcstod_internal -- underlying function for wcstod 5297 5298 Synopsis 5299 5300 double __wcstod_internal(const wchar_t * nptr, wchar_t * * 5301 endptr, int group); 5302 5303 Description 5304 5305 group shall be 0 or the behavior of __wcstod_internal() is 5306 undefined. 5307 5308 __wcstod_internal(nptr, endptr, 0) has the same specification 5309 as wcstod(nptr, endptr). 5310 5311 __wcstod_internal() is not in the source standard; it is only 5312 in the binary standard. 5313 5314 __wcstof_internal 5315 5316 Name 5317 5318 __wcstof_internal -- underlying function for wcstof 5319 5320 Synopsis 5321 5322 float __wcstof_internal(const wchar_t * nptr, wchar_t * * 5323 endptr, int group); 5324 5325 Description 5326 5327 group shall be 0 or the behavior of __wcstof_internal() is 5328 undefined. 5329 5330 __wcstof_internal(nptr, endptr, 0) has the same specification 5331 as wcstof(nptr, endptr). 5332 5333 __wcstof_internal() is not in the source standard; it is only 5334 in the binary standard. 5335 5336 __wcstol_internal 5337 5338 Name 5339 5340 __wcstol_internal -- underlying function for wcstol 5341 5342 Synopsis 5343 5344 long __wcstol_internal(const wchar_t * nptr, wchar_t * * 5345 endptr, int base, int group); 5346 5347 Description 5348 5349 group shall be 0 or the behavior of __wcstol_internal() is 5350 undefined. 5351 5352 __wcstol_internal(nptr, endptr, base, 0) has the same 5353 specification as wcstol(nptr, endptr, base). 5354 5355 __wcstol_internal() is not in the source standard; it is only 5356 in the binary standard. 5357 5358 __wcstold_internal 5359 5360 Name 5361 5362 __wcstold_internal -- underlying function for wcstold 5363 5364 Synopsis 5365 5366 long double __wcstold_internal(const wchar_t * nptr, wchar_t * 5367 * endptr, int group); 5368 5369 Description 5370 5371 group shall be 0 or the behavior of __wcstold_internal() is 5372 undefined. 5373 5374 __wcstold_internal(nptr, endptr, 0) has the same specification 5375 as wcstold(nptr, endptr). 5376 5377 __wcstold_internal() is not in the source standard; it is only 5378 in the binary standard. 5379 5380 __wcstoul_internal 5381 5382 Name 5383 5384 __wcstoul_internal -- underlying function for wcstoul 5385 5386 Synopsis 5387 5388 unsigned long __wcstoul_internal(const wchar_t * restrict 5389 nptr, wchar_t * * restrict endptr, int base, int group); 5390 5391 Description 5392 5393 group shall be 0 or the behavior of __wcstoul_internal() is 5394 undefined. 5395 5396 __wcstoul_internal(nptr, endptr, base, 0)() has the same 5397 specification as wcstoul(nptr, endptr, base)(). 5398 5399 __wcstoul_internal() is not in the source standard; it is only 5400 in the binary standard. 5401 5402 __xmknod 5403 5404 Name 5405 5406 __xmknod -- make block or character special file 5407 5408 Synopsis 5409 5410 int __xmknod(int ver, const char * path, mode_t mode, dev_t * 5411 dev); 5412 5413 Description 5414 5415 The __xmknod() shall implement the mknod() interface from ISO 5416 POSIX (2003). 5417 5418 __xmknod(1, path, mode, dev) has the same specification as 5419 mknod(path, mode, dev). 5420 5421 ver shall be 1 or the behavior of __xmknod() is undefined. 5422 5423 The __xmknod() function is not in the source standard; it is 5424 only in the binary standard. The mknod() function is not in 5425 the binary standard; it is only in the source standard. 5426 5427 __xstat 5428 5429 Name 5430 5431 __xstat -- Get File Status 5432 5433 Synopsis 5434 5435 #include 5436 #include 5437 5438 int __xstat(int ver, const char * path, struct stat * 5439 stat_buf); 5440 5441 int __lxstat(int ver, const char * path, struct stat * 5442 stat_buf); 5443 5444 int __fxstat(int ver, int fildes, struct stat * stat_buf); 5445 5446 Description 5447 5448 The functions __xstat(), __lxstat(), and __fxstat() shall 5449 implement the ISO POSIX (2003) functions stat(), lstat(), and 5450 fstat() respectively. 5451 5452 ver shall be 3 or the behavior of these functions is 5453 undefined. 5454 5455 __xstat(3, path, stat_buf) shall behave as stat(path, 5456 stat_buf) as specified by ISO POSIX (2003). 5457 5458 __lxstat(3, path, stat_buf) shall behave as lstat(path, 5459 stat_buf) as specified by ISO POSIX (2003). 5460 5461 __fxstat(3, fildes, stat_buf) shall behave as fstat(fildes, 5462 stat_buf) as specified by ISO POSIX (2003). 5463 5464 __xstat(), __lxstat(), and __fxstat() are not in the source 5465 standard; they are only in the binary standard. 5466 5467 stat(), lstat(), and fstat() are not in the binary standard; 5468 they are only in the source standard. 5469 5470 __xstat64 5471 5472 Name 5473 5474 __xstat64 -- Get File Status 5475 5476 Synopsis 5477 5478 #define _LARGEFILE_SOURCE 1 5479 #include 5480 #include 5481 5482 int __xstat64(int ver, const char * path, struct stat64 * 5483 stat_buf); 5484 5485 int __lxstat64(int ver, const char * path, struct stat64 * 5486 stat_buf); 5487 5488 int __fxstat64(int ver, int fildes, struct stat64 * stat_buf); 5489 5490 Description 5491 5492 The functions __xstat64(), __lxstat64(), and __fxstat64() 5493 shall implement the Large File Support functions stat64(), 5494 lstat64(), and fstat64() respectively. 5495 5496 ver shall be 3 or the behavior of these functions is 5497 undefined. 5498 5499 __xstat64(3, path, stat_buf) shall behave as stat(path, 5500 stat_buf) as specified by Large File Support. 5501 5502 __lxstat64(3, path, stat_buf) shall behave as lstat(path, 5503 stat_buf) as specified by Large File Support. 5504 5505 __fxstat64(3, fildes, stat_buf) shall behave as fstat(fildes, 5506 stat_buf) as specified by Large File Support. 5507 5508 __xstat64(), __lxstat64(), and __fxstat64() are not in the 5509 source standard; they are only in the binary standard. 5510 5511 stat64(), lstat64(), and fstat64() are not in the binary 5512 standard; they are only in the source standard. 5513 5514 _environ 5515 5516 Name 5517 5518 _environ -- alias for environ - user environment 5519 5520 Synopsis 5521 5522 extern char * *_environ; 5523 5524 Description 5525 5526 _environ is an alias for environ - user environment. 5527 5528 _nl_msg_cat_cntr 5529 5530 Name 5531 5532 _nl_msg_cat_cntr -- new catalog load counter 5533 5534 Synopsis 5535 5536 #include 5537 5538 extern int _nl_msg_cat_cntr; 5539 5540 Description 5541 5542 _nl_msg_cat_cntr is incremented each time a new catalong is 5543 loaded. It is a variable defined in loadmsgcat.c and is used 5544 by Message catalogs for internationalization. 5545 5546 _sys_errlist 5547 5548 Name 5549 5550 _sys_errlist -- array containing the "C" locale strings used 5551 by strerror() 5552 5553 Synopsis 5554 5555 #include 5556 5557 extern const char *const _sys_errlist[]; 5558 5559 Description 5560 5561 _sys_errlist is an array containing the "C" locale strings 5562 used by strerror(). This normally should not be used directly. 5563 strerror() provides all of the needed functionality. 5564 5565 _sys_siglist 5566 5567 Name 5568 5569 _sys_siglist -- array containing the names of the signal names 5570 5571 Synopsis 5572 5573 #include 5574 5575 extern const char *const _sys_siglist[NSIG]; 5576 5577 Description 5578 5579 _sys_siglist is an array containing the names of the signal 5580 names. 5581 5582 The _sys_siglist array is only in the binary standard; it is 5583 not in the source standard. Applications wishing to access the 5584 names of signals should use the strsignal() function. 5585 5586 acct 5587 5588 Name 5589 5590 acct -- switch process accounting on or off 5591 5592 Synopsis 5593 5594 #include 5595 5596 int acct(const char * filename); 5597 5598 Description 5599 5600 When filename is the name of an existing file, acct() turns 5601 accounting on and appends a record to filename for each 5602 terminating process. When filename is NULL, acct() turns 5603 accounting off. 5604 5605 Return Value 5606 5607 On success, 0 is returned. On error, -1 is returned and the 5608 global variable errno is set appropriately. 5609 5610 Errors 5611 5612 ENOSYS 5613 BSD process accounting has not been enabled when the 5614 operating system kernel was compiled. The kernel 5615 configuration parameter controlling this feature is 5616 CONFIG_BSD_PROCESS_ACCT. 5617 5618 ENOMEM 5619 Out of memory. 5620 5621 EPERM 5622 The calling process has no permission to enable process 5623 accounting. 5624 5625 EACCES 5626 filename is not a regular file. 5627 5628 EIO 5629 Error writing to the filename. 5630 5631 EUSERS 5632 There are no more free file structures or we run out of 5633 memory. 5634 5635 adjtime 5636 5637 Name 5638 5639 adjtime -- correct the time to allow synchronization of the 5640 system clock 5641 5642 Synopsis 5643 5644 #include 5645 5646 int adjtime(const struct timeval * delta, struct timeval * 5647 olddelta); 5648 5649 Description 5650 5651 adjtime() makes small adjustments to the system time as 5652 returned by gettimeofday()(2), advancing or retarding it by 5653 the time specified by the timeval delta. If delta is negative, 5654 the clock is slowed down by incrementing it more slowly than 5655 normal until the correction is complete. If delta is positive, 5656 a larger increment than normal is used. The skew used to 5657 perform the correction is generally a fraction of one percent. 5658 Thus, the time is always a monotonically increasing function. 5659 A time correction from an earlier call to adjtime() may not be 5660 finished when adjtime() is called again. If olddelta is 5661 non-NULL, the structure pointed to will contain, upon return, 5662 the number of microseconds still to be corrected from the 5663 earlier call. 5664 5665 adjtime() may be used by time servers that synchronize the 5666 clocks of computers in a local area network. Such time servers 5667 would slow down the clocks of some machines and speed up the 5668 clocks of others to bring them to the average network time. 5669 5670 The adjtime() is restricted to the super-user. 5671 5672 Return Value 5673 5674 On success, 0 is returned. On error, -1 is returned and the 5675 global variable errno is set appropriately. 5676 5677 Errors 5678 5679 EFAULT 5680 An argument points outside the process's allocated 5681 address space. 5682 5683 EPERM 5684 The process's effective user ID is not that of the 5685 super-user. 5686 5687 adjtimex 5688 5689 Name 5690 5691 adjtimex -- tune kernel clock (DEPRECATED) 5692 5693 Synopsis 5694 5695 #include 5696 5697 int adjtimex(struct timex * buf); 5698 5699 Description 5700 5701 The adjtimex() function is deprecated from the LSB and is 5702 expected to disappear from a future version of the LSB. 5703 5704 Note: The LSB generally does not include interfaces 5705 unlikely to be used by software applications. 5706 5707 Linux uses David L. Mills' clock adjustment algorithm (see RFC 5708 1305). adjtimex() reads and optionally sets adjustment 5709 parameters for this algorithm. adjtimex() takes a pointer to a 5710 timex structure, updates kernel parameters from field values, 5711 and returns the same structure with current kernel values. 5712 This structure is declared as follows: 5713 struct timex { 5714 int modes; /* mode selector */ 5715 long offset; /* time offset (usec) */ 5716 long freq; /* frequency offset (scaled ppm) */ 5717 long maxerror; /* maximum error (usec) */ 5718 long esterror; /* estimated error (usec) */ 5719 int status; /* clock command/status */ 5720 long constant; /* pll time constant */ 5721 long precision; /* clock precision (usec) (read only) 5722 */ 5723 long tolerance; /* clock frequency tolerance (ppm) 5724 (read only) */ 5725 struct timeval time; /* current time (read only) */ 5726 long tick; /* usecs between clock ticks */ 5727 }; 5728 5729 modes determines which parameters, if any, to set. modes may 5730 contain a bitwise-or combination of zero or more of the 5731 following bits: 5732 #define ADJ_OFFSET 0x0001 /* time offset */ 5733 #define ADJ_FREQUENCY 0x0002 /* frequency offset */ 5734 #define ADJ_MAXERROR 0x0004 /* maximum time error */ 5735 #define ADJ_ESTERROR 0x0008 /* estimated time error */ 5736 #define ADJ_STATUS 0x0010 /* clock status */ 5737 #define ADJ_TIMECONST 0x0020 /* pll time constant */ 5738 #define ADJ_TICK 0x4000 /* tick value */ 5739 #define ADJ_OFFSET_SINGLESHOT 0x8001 /* old-fashioned adjtime */ 5740 5741 Ordinary users are restricted to a 0 value for modes. Only the 5742 superuser may set any parameters. 5743 5744 Return Value 5745 5746 On success, adjtimex() returns the clock state: 5747 #define TIME_OK 0 /* clock synchronized */ 5748 #define TIME_INS 1 /* insert leap second */ 5749 #define TIME_DEL 2 /* delete leap second */ 5750 #define TIME_OOP 3 /* leap second in progress */ 5751 #define TIME_WAIT 4 /* leap second has occurred */ 5752 #define TIME_BAD 5 /* clock not synchronized */ 5753 5754 On error, the global variable errno is set to -1. 5755 5756 Errors 5757 5758 EFAULT 5759 buf does not point to writable memory. 5760 5761 EPERM 5762 buf.mode is nonzero and the user is not super-user. 5763 5764 EINVAL 5765 An attempt is made to set buf.offset to a value outside 5766 of the range -131071 to +131071, or to set buf.status 5767 to a value other than those listed above, or to set 5768 buf.tick to a value outside of the range 900000/HZ to 5769 1100000/HZ, where HZ is the system timer interrupt 5770 frequency. 5771 5772 asprintf 5773 5774 Name 5775 5776 asprintf -- write formatted output to a dynamically allocated 5777 string 5778 5779 Synopsis 5780 5781 #include 5782 5783 int asprintf(char ** restrict ptr, const char * restrict 5784 format, ...); 5785 5786 Description 5787 5788 The asprintf() function shall behave as sprintf(), except that 5789 the output string shall be dynamically allocated space of 5790 sufficient length to hold the resulting string. The address of 5791 this dynamically allocated string shall be stored in the 5792 location referenced by ptr. 5793 5794 Return Value 5795 5796 Refer to fprintf(). 5797 5798 Errors 5799 5800 Refer to fprintf(). 5801 5802 bind_textdomain_codeset 5803 5804 Name 5805 5806 bind_textdomain_codeset -- specify encoding for message 5807 retrieval 5808 5809 Synopsis 5810 5811 #include 5812 5813 char * bind_textdomain_codeset (const char * domainname , 5814 const char * codeset ); 5815 5816 Description 5817 5818 The bind_textdomain_codeset function can be used to specify 5819 the output codeset for message catalogs for domain domainname. 5820 The codeset argument shall be a valid codeset name which can 5821 be used tor the iconv_open function, or a null pointer. If the 5822 codeset argument is the null pointer, then function returns 5823 the currently selected codeset for the domain with the name 5824 domainname. It shall return a null pointer if no codeset has 5825 yet been selected 5826 5827 Each successive call to bind_textdomain_codeset() function 5828 overrrides the settings made by the preceding call with the 5829 same domainname. 5830 5831 The bind_textdomain_codeset() function shall return a pointer 5832 to a string containing the name of the selected codeset. The 5833 string shall be allocated internally in the function and shall 5834 not be changed or freed by the user. 5835 5836 The bind_textdomain_codeset() function returns a pointer to a 5837 string containing the name of the selected codeset. The string 5838 is allocated internally in the function and shall not be 5839 changed by the user. 5840 5841 Parameters 5842 5843 domainname 5844 The domainname argument is applied to the currently 5845 active LC_MESSAGE locale. It is equivalent in syntax 5846 and meaning to the domainname argument to textdomain, 5847 except that the selection of the domain is valid only 5848 for the duration of the call. 5849 5850 codeset 5851 The name of the output codeset for the selected domain, 5852 or NULL to select the current codeset. 5853 5854 If domainname is the null pointer, or is an empty 5855 string, bind_textdomain_codeset() shall fail, but need 5856 not set errno. 5857 5858 Return Value 5859 5860 Returns the currently selected codeset name. It returns a null 5861 pointer if no codeset has yet been selected. 5862 5863 Errors 5864 5865 ENOMEM 5866 Insufficient memory available to allocate return value. 5867 5868 See Also 5869 5870 gettext, dgettext, ngettext, dngettext, dcgettext, dcngettext, 5871 textdomain, bindtextdomain 5872 5873 bindresvport 5874 5875 Name 5876 5877 bindresvport -- bind socket to privileged IP port 5878 5879 Synopsis 5880 5881 #include 5882 #include 5883 5884 int bindresvport(int sd, struct sockaddr_in * sin); 5885 5886 Description 5887 5888 If the process has appropriate privilege, the bindresvport() 5889 function shall bind a socket to a privileged IP port. 5890 5891 Return Value 5892 5893 On success, 0 is returned. On error, -1 is returned and the 5894 global variable errno is set appropriately. 5895 5896 Errors 5897 5898 EPERM 5899 The process did not have appropriate privilege. 5900 5901 EPFNOSUPPORT 5902 Address of sin did not match address family of sd. 5903 5904 bindtextdomain 5905 5906 Name 5907 5908 bindtextdomain -- specify the location of a message catalog 5909 5910 Synopsis 5911 5912 #include 5913 5914 char * bindtextdomain(const char * domainname, const char * 5915 dirname); 5916 5917 Description 5918 5919 The bindtextdomain() shall set the the base directory of the 5920 hierarchy containing message catalogs for a given message 5921 domain. 5922 5923 The bindtextdomain() function specifies that the domainname 5924 message catalog can be found in the dirname directory 5925 hierarchy, rather than in the system default locale data base. 5926 5927 If dirname is not NULL, the base directory for message 5928 catalogs belonging to domain domainname shall be set to 5929 dirname. If dirname is NULL, the base directory for message 5930 catalogs shall not be altered. 5931 5932 The function shall make copies of the argument strings as 5933 needed. 5934 5935 dirname can be an absolute or relative pathname. 5936 5937 Note: Applications that wish to use chdir() should always 5938 use absolute pathnames to avoid misadvertently selecting 5939 the wrong or non-existant directory. 5940 5941 If domainname is the null pointer, or is an empty string, 5942 bindtextdomain() shall fail, but need not set errno. 5943 5944 The bindtextdomain() function shall return a pointer to a 5945 string containing the name of the selected directory. The 5946 string shall be allocated internally in the function and shall 5947 not be changed or freed by the user. 5948 5949 Return Value 5950 5951 On success, bindtextdomain() shall return a pointer to a 5952 string containing the directory pathname currently bound to 5953 the domain. On failure, a NULL pointer is returned, and the 5954 global variable errno may be set to indicate the error. 5955 5956 Errors 5957 5958 ENOMEM 5959 Insufficient memory was available. 5960 5961 See Also 5962 5963 gettext, dgettext, ngettext, dngettext, dcgettext, dcngettext, 5964 textdomain, bind_textdomain_codeset 5965 5966 cfmakeraw 5967 5968 Name 5969 5970 cfmakeraw -- get and set terminal attributes 5971 5972 Synopsis 5973 5974 #include 5975 5976 void cfmakeraw(struct termios * termios_p); 5977 5978 Description 5979 5980 The cfmakeraw() function shall set the attributes of the 5981 termios structure referenced by termios_p as follows: 5982 termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP 5983 |INLCR|IGNCR|ICRNL|IXON); 5984 5985 termios_p->c_oflag &= ~OPOST; 5986 5987 termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); 5988 5989 termios_p->c_cflag &= ~(CSIZE|PARENB); 5990 5991 termios_p->c_cflag |= CS8; 5992 5993 termios_p shall point to a termios structure that contains the 5994 following members: 5995 tcflag_t c_iflag; /* input modes */ 5996 tcflag_t c_oflag; /* output modes */ 5997 tcflag_t c_cflag; /* control modes */ 5998 tcflag_t c_lflag; /* local modes */ 5999 cc_t c_cc[NCCS]; /* control chars */ 6000 6001 cfsetspeed 6002 6003 Name 6004 6005 cfsetspeed -- set terminal input and output data rate 6006 6007 Synopsis 6008 6009 #include 6010 6011 int cfsetspeed(struct termios *t, speed_t speed); 6012 6013 Description 6014 6015 cfsetspeed() sets the baud rate values in the termios 6016 structure. The effects of the function on the terminal as 6017 described below do not become effective, nor are all errors 6018 detected, until the tcsetattr() function is called. Certain 6019 values for baud rates set in termios and passed to tcsetattr() 6020 have special meanings. 6021 6022 Getting and Setting the Baud Rate 6023 6024 Input and output baud rates are found in the termios 6025 structure. The unsigned integer speed_t is typdef'd in the 6026 include file termios.h. The value of the integer corresponds 6027 directly to the baud rate being represented; however, the 6028 following symbolic values are defined. 6029 #define B0 0 6030 #define B50 50 6031 #define B75 75 6032 #define B110 110 6033 #define B134 134 6034 #define B150 150 6035 #define B200 200 6036 #define B300 300 6037 #define B600 600 6038 #define B1200 1200 6039 #define B1800 1800 6040 #define B2400 2400 6041 #define B4800 4800 6042 #define B9600 9600 6043 #define B19200 19200 6044 #define B38400 38400 6045 #ifndef _POSIX_SOURCE 6046 #define EXTA 19200 6047 #define EXTB 38400 6048 #endif /*_POSIX_SOURCE */ 6049 6050 cfsetspeed() sets both the input and output baud rates in the 6051 termios structure referenced by t to speed. 6052 6053 Return Value 6054 6055 On success, 0 is returned. On error, -1 is returned and the 6056 global variable errno is set appropriately. 6057 6058 Errors 6059 6060 EINVAL 6061 Invalid speed argument 6062 6063 creat 6064 6065 Name 6066 6067 creat -- open a file 6068 6069 Description 6070 6071 creat() is as specified in ISO POSIX (2003), but with 6072 differences as listed below. 6073 6074 May return ENODEV in place of ENXIO 6075 6076 Where the ISO POSIX (2003) specifies an ENXIO return, the 6077 implementation may return either ENXIO or ENODEV. 6078 Implementations are encouraged to return ENXIO. 6079 6080 Note: As of spring 2004, we don't know of any Linux kernel 6081 patches to switch to ENXIO, but we believe that such a 6082 kernel patch would be accepted if submitted. 6083 6084 daemon 6085 6086 Name 6087 6088 daemon -- run in the background 6089 6090 Synopsis 6091 6092 #include 6093 6094 int daemon(int nochdir, int noclose); 6095 6096 Description 6097 6098 The daemon() function shall create a new process, detached 6099 from the controlling terminal. If successful, the calling 6100 process shall exit and the new process shall continue to 6101 execute the application in the background. If nochdir 6102 evaluates to true, the current directory shall not be changed. 6103 Otherwise, daemon() shall change the current working directory 6104 to the root (`/'). If noclose evaluates to true the standard 6105 input, standard output, and standard error file descriptors 6106 shall not be altered. Otherwise, daemon() shall close the 6107 standard input, standard output and standard error file 6108 descriptors and reopen them attached to /dev/null. 6109 6110 Return Value 6111 6112 On error, -1 is returned, and the global variable errno is set 6113 to any of the errors specified for the library functions 6114 fork() and setsid(). 6115 6116 dcgettext 6117 6118 Name 6119 6120 dcgettext -- perform domain and category specific lookup in 6121 message catalog 6122 6123 Synopsis 6124 6125 #include 6126 #include 6127 6128 char * dcgettext(const char * domainname, const char * msgid, 6129 int category); 6130 6131 Description 6132 6133 The dcgettext() function is a domain specified version of 6134 gettext(). 6135 6136 The dcgettext() function shall lookup the translation in the 6137 current locale of the message identified by msgid in the 6138 domain specified by domainname and in the locale category 6139 specified by category. If domainname is NULL, the current 6140 default domain shall be used. The msgid argument shall be a 6141 NULL-terminated string to be matched in the catalogue. 6142 category shall specify the locale category to be used for 6143 retrieving message strings. The category parameter shall be 6144 one of LC_CTYPE, LC_COLLATE, LC_MESSAGES, LC_MONETARY, 6145 LC_NUMERIC, or LC_TIME. The default domain shall not be 6146 changed by a call to dcgettext. 6147 6148 Return Value 6149 6150 If a translation was found in one of the specified catalogs, 6151 it shall be converted to the current locale's codeset and 6152 returned. The resulting NULL-terminated string shall be 6153 allocated by the dcgettext function, and must not be modified 6154 or freed. If no translation was found, or category was 6155 invalid, msgid shall be returned. 6156 6157 Errors 6158 6159 dcgettext() shall not modify the errno global variable. 6160 6161 See Also 6162 6163 gettext, dgettext, ngettext, dngettext, dcngettext, 6164 textdomain, bindtextdomain, bind_textdomain_codeset 6165 6166 dcngettext 6167 6168 Name 6169 6170 dcngettext -- perform domain and category specific lookup in 6171 message catalog with plural 6172 6173 Synopsis 6174 6175 #include 6176 #include 6177 6178 char * dcngettext(const char * domainname, const char * 6179 msgid1, const char * msgid2, unsigned long int n, int 6180 category); 6181 6182 Description 6183 6184 The dcngettext() function is a domain specific version of 6185 gettext, capable of returning either a singular or plural form 6186 of the message. The dcngettext() function shall lookup the 6187 translation in the current locale of the message identified by 6188 msgid1 in the domain specified by domainname and in the locale 6189 category specified by category. If domainname is NULL, the 6190 current default domain shall be used. The msgid1 argument 6191 shall be a NULL-terminated string to be matched in the 6192 catalogue. category shall specify the locale category to be 6193 used for retrieving message strings. The category parameter 6194 shall be one of LC_CTYPE, LC_COLLATE, LC_MESSAGES, 6195 LC_MONETARY, LC_NUMERIC, or LC_TIME. The default domain shall 6196 not be changed by a call to dcgettext(). If n is 1 then the 6197 singular version of the message is returned, otherwise one of 6198 the plural forms is returned, depending on the value of n and 6199 the current locale settings. 6200 6201 Return Value 6202 6203 If a translation corresponding to the value of n was found in 6204 one of the specified catalogs for msgid1, it shall be 6205 converted to the current locale's codeset and returned. The 6206 resulting NULL-terminated string shall be allocated by the 6207 dcngettext() function, and must not be modified or freed. If 6208 no translation was found, or category was invalid, msgid1 6209 shall be returned if n has the value 1, otherwise msgid2 shall 6210 be returned. 6211 6212 Errors 6213 6214 dcngettext() shall not modify the errno global variable. 6215 6216 See Also 6217 6218 gettext, dgettext, ngettext, dngettext, dcgettext, textdomain, 6219 bindtextdomain, bind_textdomain_codeset 6220 6221 dgettext 6222 6223 Name 6224 6225 dgettext -- perform lookup in message catalog for the current 6226 LC_MESSAGES locale 6227 6228 Synopsis 6229 6230 #include 6231 6232 char * dgettext(const char * domainname, const char * msgid); 6233 6234 Description 6235 6236 dgettext() is a domain specified version of gettext(). 6237 6238 Parameters 6239 6240 domainname 6241 dgettext() applies domainname to the currently active 6242 LC_MESSAGE locale. This usage is equivalent in syntax 6243 and meaning to the textdomain() function's application 6244 of domainname, except that the selection of the domain 6245 in dgettext() is valid only for the duration of the 6246 call. 6247 6248 msgid 6249 a NULL-terminated string to be matched in the catalogue 6250 with respect to a specific domain and the current 6251 locale. 6252 6253 Return Value 6254 6255 On success of a msgid query, the translated NULL-terminated 6256 string is returned. On error, the original msgid is returned. 6257 The length of the string returned is undetermined until 6258 dgettext() is called. 6259 6260 Errors 6261 6262 dgettext() will not modify the errno global variable. 6263 6264 See Also 6265 6266 gettext, dgettext, ngettext, dngettext, dcgettext, dcngettext, 6267 textdomain, bindtextdomain, bind_textdomain_codeset 6268 6269 dngettext 6270 6271 Name 6272 6273 dngettext -- perform lookup in message catalog for the current 6274 locale 6275 6276 Synopsis 6277 6278 #include 6279 6280 char * dngettext(const char * domainname, const char * msgid1, 6281 const char * msgid2, unsigned long int n); 6282 6283 Description 6284 6285 dngettext() shall be equivalent to a call to 6286 dcngettext(domainname, msgid1, msgid2, n, LC_MESSAGES) 6287 6288 See dgettext() for more information. 6289 6290 See Also 6291 6292 gettext, dgettext, ngettext, dcgettext, dcngettext, 6293 textdomain, bindtextdomain, bind_textdomain_codeset 6294 6295 err 6296 6297 Name 6298 6299 err -- display formatted error messages 6300 6301 Synopsis 6302 6303 #include 6304 6305 void err(int eval, const char * fmt, ...); 6306 6307 Description 6308 6309 The err() function shall display a formatted error message on 6310 the standard error stream. First, err() shall write the last 6311 component of the program name, a colon character, and a space 6312 character. If fmt is non-NULL, it shall be used as a format 6313 string for the printf() family of functions, and err() shall 6314 write the formatted message, a colon character, and a space. 6315 Finally, the error message string affiliated with the current 6316 value of the global variable errno shall be written, followed 6317 by a newline character. 6318 6319 The err() function shall not return, the program shall 6320 terminate with the exit value of eval. 6321 6322 See Also 6323 6324 error(), errx() 6325 6326 Return Value 6327 6328 None. 6329 6330 Errors 6331 6332 None. 6333 6334 error 6335 6336 Name 6337 6338 error -- print error message 6339 6340 Synopsis 6341 6342 void error(int exitstatus, int errnum, const char * format, 6343 ...); 6344 6345 Description 6346 6347 error() shall print a message to standard error. 6348 6349 error() shall build the message from the following elements in 6350 their specified order: 6351 6352 1. the program name. If the application has provided a 6353 function named error_print_progname(), error() shall call 6354 this to supply the program name; otherwise, error() uses 6355 the content of the global variable program_name. 6356 2. the colon and space characters, then the result of using 6357 the printf-style format and the optional arguments. 6358 3. if errnum is nonzero, error() shall add the colon and 6359 space characters, then the result of strerror(errnum). 6360 4. a newline. 6361 6362 If exitstatus is nonzero, error() shall call exit(exitstatus). 6363 6364 See Also 6365 6366 err(), errx() 6367 6368 errx 6369 6370 Name 6371 6372 errx -- display formatted error message and exit 6373 6374 Synopsis 6375 6376 #include 6377 6378 void errx(int eval, const char * fmt, ...); 6379 6380 Description 6381 6382 The errx() function shall display a formatted error message on 6383 the standard error stream. The last component of the program 6384 name, a colon character, and a space shall be output. If fmt 6385 is non-NULL, it shall be used as the format string for the 6386 printf() family of functions, and the formatted error message, 6387 a colon character, and a space shall be output. The output 6388 shall be followed by a newline character. 6389 6390 errx() does not return, but shall exit with the value of eval. 6391 6392 Return Value 6393 6394 None. 6395 6396 Errors 6397 6398 None. 6399 6400 See Also 6401 6402 error(), err() 6403 6404 fcntl 6405 6406 Name 6407 6408 fcntl -- file control 6409 6410 Description 6411 6412 fcntl() is as specified in ISO POSIX (2003), but with 6413 differences as listed below. 6414 6415 Implementation may set O_LARGEFILE 6416 6417 According to ISO POSIX (2003), only an application sets 6418 fcntl() flags, for example O_LARGEFILE. However, this 6419 specification also allows an implementation to set O_LARGEFILE 6420 in the case where the system default behavior matches the 6421 O_LARGEFILE behavior, for example if sizeof(off_t) is 8. Thus, 6422 calling fcntl() with the F_GETFL command may return 6423 O_LARGEFILE as well as flags explicitly set by the 6424 application. 6425 6426 fflush_unlocked 6427 6428 Name 6429 6430 fflush_unlocked -- non thread safe fflush 6431 6432 Description 6433 6434 fflush_unlocked() is the same as fflush() except that it need 6435 not be thread safe. That is, it may only be invoked in the 6436 ways which are legal for getc_unlocked(). 6437 6438 fgetwc_unlocked 6439 6440 Name 6441 6442 fgetwc_unlocked -- non thread safe fgetwc 6443 6444 Description 6445 6446 fgetwc_unlocked() is the same as fgetwc() except that it need 6447 not be thread safe. That is, it may only be invoked in the 6448 ways which are legal for getc_unlocked(). 6449 6450 flock 6451 6452 Name 6453 6454 flock -- apply or remove an advisory lock on an open file 6455 6456 Synopsis 6457 6458 int flock(int fd, int operation); 6459 6460 Description 6461 6462 flock() applies or removes an advisory lock on the open file 6463 fd. Valid operation types are: 6464 6465 LOCK_SH 6466 Shared lock. More than one process may hold a shared 6467 lock for a given file at a given time. 6468 6469 LOCK_EX 6470 Exclusive lock. Only one process may hold an exclusive 6471 lock for a given file at a given time. 6472 6473 LOCK_UN 6474 Unlock. 6475 6476 LOCK_NB 6477 Don't block when locking. May be specified (by oring) 6478 along with one of the other operations. 6479 6480 A single file may not simultaneously have both shared and 6481 exclusive locks. 6482 6483 Return Value 6484 6485 On success, 0 is returned. On error, -1 is returned and the 6486 global variable errno is set appropriately. 6487 6488 Errors 6489 6490 EWOULDBLOCK 6491 The file is locked and the LOCK_NB flag was selected. 6492 6493 fopen 6494 6495 Name 6496 6497 fopen -- open a file 6498 6499 Description 6500 6501 fopen() is as specified in ISO POSIX (2003), but with 6502 differences as listed below. 6503 6504 May return ENODEV in place of ENXIO 6505 6506 Where the ISO POSIX (2003) specifies an ENXIO return, the 6507 implementation may return either ENXIO or ENODEV. 6508 Implementations are encouraged to return ENXIO. 6509 6510 Note: As of spring 2004, we don't know of any Linux kernel 6511 patches to switch to ENXIO, but we believe that such a 6512 kernel patch would be accepted if submitted. 6513 6514 freopen 6515 6516 Name 6517 6518 freopen -- open a file 6519 6520 Description 6521 6522 freopen() is as specified in ISO POSIX (2003), but with 6523 differences as listed below. 6524 6525 May return ENODEV in place of ENXIO 6526 6527 Where the ISO POSIX (2003) specifies an ENXIO return, the 6528 implementation may return either ENXIO or ENODEV. 6529 Implementations are encouraged to return ENXIO. 6530 6531 Note: As of spring 2004, we don't know of any Linux kernel 6532 patches to switch to ENXIO, but we believe that such a 6533 kernel patch would be accepted if submitted. 6534 6535 getdomainname 6536 6537 Name 6538 6539 getdomainname -- get NIS domain name (DEPRECATED). 6540 6541 Synopsis 6542 6543 #include 6544 6545 int getdomainname (char * name , size_t namelen ); 6546 6547 Description 6548 6549 If the Network Information System (NIS) is in use, 6550 getdomainname() shall copy the NIS domain name to the supplied 6551 buffer identified by name, with maximum length namelen. If the 6552 NIS domain name is not currently set, getdomainname() shall 6553 copy the string "(none)" to the name. If namelen is less the 6554 length of the string to be copied, getdomainname() may either 6555 truncate the string to namelen characters and place it in name 6556 (without a terminating null character), or may fail with 6557 EINVAL. 6558 6559 Note that the NIS domain name is not the same as the domain 6560 portion of a fully qualified domain name (for example, in 6561 DNS). 6562 6563 Return Value 6564 6565 On success, getdomainname() shall return 0. Otherwise, it 6566 shall return -1 and set errno to indicate the error). 6567 6568 Errors 6569 6570 EINVAL 6571 name was a null pointer. 6572 6573 EINVAL 6574 The buffer identified by name and namelen is of 6575 insufficient size to store the NIS domain name string, 6576 and the implementation considers this an error. 6577 6578 Future Directions 6579 6580 The LSB does not include other NIS interfaces, and a future 6581 version of this specification may deprecate this interface. 6582 Application developers should avoid using this interface where 6583 possible. 6584 6585 gethostbyname_r 6586 6587 Name 6588 6589 gethostbyname_r -- find network host database entry matching 6590 host name (DEPRECATED) 6591 6592 Synopsis 6593 6594 int gethostbyname_r(const char * restrict name, struct hostent 6595 * restrict result_buf, char * restrict buf, size_t buflen, 6596 struct hostent ** restrict result, int * restrict h_errnop); 6597 6598 Description 6599 6600 The gethostbyname_r() function is deprecated; applications 6601 should call getaddrinfo() instead. 6602 6603 gethostbyname_r() is a reentrant version of gethostbyname() 6604 that searches the network host database for a host name match. 6605 6606 getloadavg 6607 6608 Name 6609 6610 getloadavg -- get system load averages 6611 6612 Synopsis 6613 6614 #include 6615 6616 int getloadavg(double loadavg[], int nelem); 6617 6618 Description 6619 6620 getloadavg() returns the number of processes in the system run 6621 queue averaged over various periods of time. Up to nelem 6622 samples are retrieved and assigned to successive elements of 6623 loadavg[]. The system imposes a maximum of 3 samples, 6624 representing averages over the last 1, 5, and 15 minutes, 6625 respectively. 6626 6627 getopt 6628 6629 Name 6630 6631 getopt -- parse command line options 6632 6633 Synopsis 6634 6635 #include 6636 6637 int getopt(int argc, char * const argv[], const char * 6638 optstring); 6639 6640 extern char *optarg; 6641 extern int optind, opterr, optopt; 6642 6643 Description 6644 6645 The getopt() function shall parse command line arguments as 6646 described in ISO POSIX (2003), with the following exceptions, 6647 where LSB and POSIX specifications vary. LSB systems shall 6648 implement the modified behaviors described below. 6649 6650 Argument Ordering 6651 6652 The getopt() function can process command line arguments 6653 referenced by argv in one of three ways: 6654 6655 PERMUTE 6656 the order of arguments in argv is altered so that all 6657 options (and their arguments) are moved in front of all 6658 of the operands. This is the default behavior. 6659 6660 Note: This behavior has undefined results if argv is not 6661 modifiable. This is to support historic behavior predating 6662 the use of const and ISO C (1999). The function prototype 6663 was aligned with ISO POSIX (2003) despite the fact that it 6664 modifies argv, and the library maintainers are unwilling to 6665 change this. 6666 6667 REQUIRE_ORDER 6668 The arguments in argv are processed in exactly the 6669 order given, and option processing stops when the first 6670 non-option argument is reached, or when the element of 6671 argv is "--". This ordering can be enforced either by 6672 setting the environment variable POSIXLY_CORRECT, or by 6673 setting the first character of optstring to '+'. 6674 6675 RETURN_IN_ORDER 6676 The order of arguments is not altered, and all 6677 arguments are processed. Non-option arguments 6678 (operands) are handled as if they were the argument to 6679 an option with the value 1 ('\001'). This ordering is 6680 selected by setting the first character of optstring to 6681 '-'; 6682 6683 Option Characteristics 6684 6685 LSB specifies that: 6686 6687 * an element of argv that starts with "-" (and is not 6688 exactly "-" or "--") is an option element. 6689 * characters of an option element, aside from the initial 6690 "-", are option characters. 6691 6692 POSIX specifies that: 6693 6694 * applications using getopt() shall obey the following 6695 syntax guidelines: 6696 + option name is a single alphanumeric character from 6697 the portable character set 6698 + option is preceded by the '-' delimiter character 6699 + options without option-arguments should be accepted 6700 when grouped behind one '-' delimiter 6701 + each option and option-argument is a separate 6702 argument 6703 + option-arguments are not optional 6704 + all options should precede operands on the command 6705 line 6706 + the argument "--" is accepted as a delimiter 6707 indicating the end of options and the consideration 6708 of subsequent arguments, if any, as operands 6709 * historical implementations of getopt() support other 6710 characters as options as an allowed extension, but 6711 applications that use extensions are not maximally 6712 portable. 6713 * support for multi-byte option characters is only possible 6714 when such characters can be represented as type int. 6715 * applications that call any utility with a first operand 6716 starting with '-' should usually specify "--" to mark the 6717 end of the options. Standard utilities that do not support 6718 this guideline indicate that fact in the OPTIONS section 6719 of the utility description. 6720 6721 Extensions 6722 6723 LSB specifies that: 6724 6725 * if a character is followed by two colons, the option takes 6726 an optional argument; if there is text in the current argv 6727 element, it is returned in optarg, otherwise optarg is set 6728 to 0. 6729 * if optstring contains W followed by a semi-colon (;), then 6730 -W foo is treated as the long option --foo. 6731 6732 Note: See getopt_long() for a description of long options. 6733 * The first character of optstring shall modify the behavior 6734 of getopt() as follows: 6735 + if the first character is '+', then REQUIRE_ORDER 6736 processing shall be in effect (see above) 6737 + if the first character is '-', then RETURN_IN_ORDER 6738 processing shall be in effect (see above) 6739 + if the first character is ':', then getopt() shall 6740 return ':' instead of '?' to indicate a missing 6741 option argument, and shall not print any diagnostic 6742 message to stderr. 6743 6744 POSIX specifies that: 6745 6746 * the -W option is reserved for implementation extensions. 6747 6748 Return Values 6749 6750 LSB specifies the following additional getopt() return values: 6751 6752 * '\001' is returned if RETURN_IN_ORDER argument ordering is 6753 in effect, and the next argument is an operand, not an 6754 option. The argument is available in optarg. 6755 6756 Any other return value has the same meaning as for POSIX. 6757 6758 POSIX specifies the following getopt() return values: 6759 6760 * the next option character is returned, if found 6761 successfully. 6762 * ':' is returned if a parameter is missing for one of the 6763 options and the first character of optstring is ':'. 6764 * '?' is returned if an unknown option character not in 6765 optstring is encountered, or if getopt() detects a missing 6766 argument and the first character of optstring is not ':'. 6767 * -1 is returned for the end of the option list. 6768 6769 Environment Variables 6770 6771 LSB specifies that: 6772 6773 * if the variable POSIXLY_CORRECT is set, option processing 6774 stops as soon as a non-option argument is encountered. 6775 * the variable _[PID]_GNU_nonoption_argv_flags_ (where [PID] 6776 is the process ID for the current process), contains a 6777 space separated list of arguments that should not be 6778 treated as arguments even though they appear to be so. 6779 6780 Rationale: This was used by bash 2.0 to communicate to GNU 6781 libc which arguments resulted from wildcard expansion and 6782 so should not be considered as options. This behavior was 6783 removed in bash version 2.01, but the support remains in 6784 GNU libc. 6785 This behavior is DEPRECATED in this version of the LSB; 6786 future revisions of this specification may not include 6787 this requirement. 6788 6789 getopt_long 6790 6791 Name 6792 6793 getopt_long -- parse command line options 6794 6795 Synopsis 6796 6797 #define _GNU_SOURCE 6798 #include 6799 6800 int getopt_long(int argc, char * const argv[], const char * 6801 opstring, const struct option * longopts, int * longindex); 6802 6803 Description 6804 6805 getopt_long() works like getopt() except that it also accepts 6806 long options, started out by two dashes. Long option names may 6807 be abbreviated if the abbreviation is unique or is an exact 6808 match for some defined option. A long option may take a 6809 parameter, of the form --arg=param or --arg param. 6810 6811 longopts is a pointer to the first element of an array of 6812 struct option declared in getopt.h as: 6813 struct option { 6814 const char *name; 6815 int has_arg; 6816 int *flag; 6817 int val; 6818 }; 6819 6820 The fields in this structure have the following meaning: 6821 6822 name 6823 The name of the long option. 6824 6825 has_arg 6826 One of: 6827 6828 no_argument (or 0) if the option does not take an argument, 6829 required_argument (or 1) if the option requires an argument, 6830 or 6831 optional_argument (or 2) if the option takes an optional 6832 argument. 6833 6834 flag 6835 specifies how results are returned for a long option. 6836 If flag is NULL, then getopt_long() shall return val. 6837 (For example, the calling program may set val to the 6838 equivalent short option character.) Otherwise, 6839 getopt_long() returns 0, and flag shall point to a 6840 variable which shall be set to val if the option is 6841 found, but left unchanged if the option is not found. 6842 6843 val 6844 The value to return, or to load into the variable 6845 pointed to by flag. 6846 6847 Return Value 6848 6849 getopt_long() returns the option character if a short option 6850 was found successfully, or ":" if there was a missing 6851 parameter for one of the options, or "?" for an unknown option 6852 character, or -1 for the end of the option list. 6853 6854 For a long option, getopt_long() returns val if flag is NULL, 6855 and 0 otherwise. Error and -1 returns are the same as for 6856 getopt(), plus "?" for an ambiguous match or an extraneous 6857 parameter. 6858 6859 getopt_long_only 6860 6861 Name 6862 6863 getopt_long_only -- parse command line options 6864 6865 Synopsis 6866 6867 #define _GNU_SOURCE 6868 #include 6869 6870 int getopt_long_only(int argc, char * const argv[], const char 6871 * optstring, const struct option * longopts, int * longindex); 6872 6873 Description 6874 6875 getopt_long_only() is like getopt_long(), but "-" as well as 6876 "--" can indicate a long option. If an option that starts with 6877 "-" (not "--") doesn't match a long option, but does match a 6878 short option, it is parsed as a short option instead. 6879 6880 Note: The getopt_long_only() function is intended only for 6881 supporting certain programs whose command line syntax was 6882 designed before the Utility Syntax Guidelines of ISO POSIX 6883 (2003) were developed. New programs should generally call 6884 getopt_long() instead, which provides the --option syntax 6885 for long options, which is preferred by GNU and consistent 6886 with ISO POSIX (2003). 6887 6888 Return Value 6889 6890 getopt_long_only() returns the option character if the option 6891 was found successfully, or ":" if there was a missing 6892 parameter for one of the options, or "?" for an unknown option 6893 character, or -1 for the end of the option list. 6894 6895 getopt_long_only() also returns the option character when a 6896 short option is recognized. For a long option, they return val 6897 if flag is NULL, and 0 otherwise. Error and -1 returns are the 6898 same as for getopt(), plus "?" for an ambiguous match or an 6899 extraneous parameter. 6900 6901 gettext 6902 6903 Name 6904 6905 gettext -- Search message catalogs for a string 6906 6907 Synopsis 6908 6909 #include 6910 6911 char * gettext(const char * msgid); 6912 6913 Description 6914 6915 The gettext() function shall search the currently selected 6916 message catalogs for a string identified by the string msgid. 6917 If a string is located, that string shall be returned. 6918 6919 The gettext() function is equivalent to dcgettext(NULL, msgid, 6920 LC_MESSAGES). 6921 6922 Return Value 6923 6924 If a string is found in the currently selected message 6925 catalogs for msgid, then a pointer to that string shall be 6926 returned. Otherwise, a pointer to msgid shall be returned. 6927 6928 Applications shall not modify the string returned by 6929 gettext(). 6930 6931 Errors 6932 6933 None. 6934 6935 The gettext() function shall not modify errno. 6936 6937 See Also 6938 6939 dgettext, ngettext, dngettext, dcgettext, dcngettext, 6940 textdomain, bindtextdomain, bind_textdomain_codeset 6941 6942 getutent 6943 6944 Name 6945 6946 getutent -- access user accounting database entries 6947 6948 Synopsis 6949 6950 #include 6951 6952 struct utmp *getutent(void); 6953 6954 Description 6955 6956 The getutent() function shall read the next entry from the 6957 user accounting database. 6958 6959 Return Value 6960 6961 Upon successful completion, getutent() shall return a pointer 6962 to a utmp structure containing a copy of the requested entry 6963 in the user accounting database. Otherwise, a null pointer 6964 shall be returned. The return value may point to a static area 6965 which is overwritten by a subsequent call to getutent(). 6966 6967 Errors 6968 6969 None defined. 6970 6971 getutent_r 6972 6973 Name 6974 6975 getutent_r -- access user accounting database entries 6976 6977 Synopsis 6978 6979 int getutent_r(struct utmp * buffer, struct utmp ** result); 6980 6981 Description 6982 6983 The getutent_r() function is a reentrant version of the 6984 getutent() function. On entry, buffer should point to a user 6985 supplied buffer to which the next entry in the database will 6986 be copied, and result should point to a location where the 6987 result will be stored. 6988 6989 Return Value 6990 6991 On success, getutent_r() shall return 0 and set the location 6992 referenced by result to a pointer to buffer. Otherwise, 6993 getutent_r() shall return -1 and set the location referenced 6994 by result to NULL. 6995 6996 glob64 6997 6998 Name 6999 7000 glob64 -- find pathnames matching a pattern (Large File 7001 Support) 7002 7003 Synopsis 7004 7005 #include 7006 7007 int glob64(const char * pattern, int flags, int (*errfunc) 7008 (const char *, int), glob64_t * pglob); 7009 7010 Description 7011 7012 The glob64() function is a large-file version of the glob() 7013 defined in ISO POSIX (2003). It shall search for pathnames 7014 matching pattern according to the rules used by the shell, 7015 /bin/sh. No tilde expansion or parameter substitution is done; 7016 see wordexp(). 7017 7018 The results of a glob64() call are stored in the structure 7019 pointed to by pglob, which is a glob64_t declared in glob.h 7020 with the following members: 7021 typedef struct 7022 { 7023 size_t gl_pathc; 7024 char **gl_pathv; 7025 size_t gl_offs; 7026 int gl_flags; 7027 void (*gl_closedir) (void *); 7028 struct dirent64 *(*gl_readdir64) (void *); 7029 void *(*gl_opendir) (const char *); 7030 int (*gl_lstat) (const char *, struct stat *); 7031 int (*gl_stat) (const char *, struct stat *); 7032 } 7033 glob64_t; 7034 7035 Structure members with the same name as corresponding members 7036 of a glob_t as defined in ISO POSIX (2003) shall have the same 7037 purpose. 7038 7039 Other members are defined as follows: 7040 7041 gl_flags 7042 reserved for internal use 7043 7044 gl_closedir 7045 pointer to a function capable of closing a directory 7046 opened by gl_opendir 7047 7048 gl_readdir64 7049 pointer to a function capable of reading entries in a 7050 large directory 7051 7052 gl_opendir 7053 pointer to a function capable of opening a large 7054 directory 7055 7056 gl_stat 7057 pointer to a function capable of returning file status 7058 for a large file 7059 7060 gl_lstat 7061 pointer to a function capable of returning file status 7062 information for a large file or symbolic link 7063 7064 A large file or large directory is one with a size which 7065 cannot be represented by a variable of type off_t. 7066 7067 Return Value 7068 7069 On success, 0 is returned. Other possible returns are: 7070 7071 GLOB_NOSPACE 7072 out of memory 7073 7074 GLOB_ABORTED 7075 read error 7076 7077 GLOB_NOMATCH 7078 no match found 7079 7080 globfree64 7081 7082 Name 7083 7084 globfree64 -- free memory from glob64() (Large File Support) 7085 7086 Synopsis 7087 7088 #include 7089 7090 void globfree64(glob64_t * pglob); 7091 7092 Description 7093 7094 globfree64() frees the dynamically allocated storage from an 7095 earlier call to glob64(). 7096 7097 globfree64() is a 64-bit version of globfree(). 7098 7099 initgroups 7100 7101 Name 7102 7103 initgroups -- initialize the supplementary group access list 7104 7105 Synopsis 7106 7107 #include 7108 #include 7109 7110 int initgroups(const char * user, gid_t group); 7111 7112 Description 7113 7114 If the process has appropriate privilege, the initgroups() 7115 function shall initialize the Supplementary Group IDs for the 7116 current process by reading the group database and using all 7117 groups of which user is a member. The additional group group 7118 is also added to the list. 7119 7120 Return Value 7121 7122 On success, 0 is returned. On error, -1 is returned and the 7123 global variable errno is set appropriately. 7124 7125 Errors 7126 7127 EPERM 7128 The calling process does not have sufficient 7129 privileges. 7130 7131 ENOMEM 7132 Insufficient memory to allocate group information 7133 structure. 7134 7135 See Also 7136 7137 setgroups() 7138 7139 ioctl 7140 7141 Name 7142 7143 ioctl -- control device 7144 7145 Synopsis 7146 7147 #include 7148 7149 int ioctl (int d , int request , ...); 7150 7151 Description 7152 7153 The ioctl() function shall manipulate the underlying device 7154 parameters of special files. d shall be an open file 7155 descriptor referring to a special file. The ioctl() function 7156 shall take three parameters; the type and value of the third 7157 parameter is dependent on the device and request. 7158 7159 Conforming LSB applications shall not call ioctl() except in 7160 situations explicitly stated in this specification. 7161 7162 Return Value 7163 7164 On success, 0 is returned. An ioctl() may use the return value 7165 as an output parameter and return a non-negative value on 7166 success. On error, -1 is returned and the global variable 7167 errno is set appropriately. 7168 7169 Errors 7170 7171 EBADF 7172 d is not a valid descriptor. 7173 7174 EFAULT 7175 The third parameter references an inaccessible memory 7176 area. 7177 7178 ENOTTY 7179 d is not associated with a character special device. 7180 7181 ENOTTY 7182 The specified request does not apply to the kind of 7183 object that d references. 7184 7185 EINVAL 7186 request or the third parameter is not valid. 7187 7188 sockio 7189 7190 Name 7191 7192 sockio -- socket ioctl commands 7193 7194 Synopsis 7195 7196 #include 7197 #include 7198 #include 7199 7200 int ioctl(int sockfd, int request, char * argp); 7201 7202 Description 7203 7204 Socket ioctl() commands are a subset of the ioctl() calls, 7205 which can perform a variety of functions on sockets. sockfd 7206 shall contain the value of a file descriptor that was created 7207 with the socket() or accept() calls. 7208 7209 Socket ioctl() commands apply to the underlying network 7210 interfaces, and affect the entire system, not just the file 7211 descriptor used to issue the ioctl(). 7212 7213 The following values for request are accepted: 7214 7215 SIOCGIFCONF 7216 Gets the interface configuration list for the system. 7217 7218 Note: SIOCGIFCONF is similar to the if_nameindex() family 7219 found in the ISO POSIX (2003) or the getifaddrs() family 7220 found in BSD derived systems. 7221 7222 argp shall point to a ifconf structure, as described in 7223 . Before calling, the caller shall set the 7224 ifc_ifcu.ifcu_req field to point to an array of ifreq 7225 structures, and set ifc_len to the size in bytes of 7226 this allocated array. Upon return, ifc_len will contain 7227 the size in bytes of the array which was actually used. 7228 If it is the same as the length upon calling, the 7229 caller should assume that the array was too small and 7230 try again with a larger array. 7231 7232 On success, SIOCGIFCONF can return any nonnegative 7233 value. 7234 7235 Rationale: Historical UNIX systems disagree on the meaning 7236 of the return value. 7237 7238 SIOCGIFFLAGS 7239 Gets the interface flags for the indicated interface. 7240 argp shall point to a ifreq structure. Before calling, 7241 the caller should fill in the ifr_name field with the 7242 interface name, and upon return, the 7243 ifr_ifru.ifru_flags field is set with the interface 7244 flags. 7245 7246 SIOCGIFADDR 7247 Gets the interface address for the given interface. 7248 argp shall point to a ifreq structure. Before calling, 7249 the caller should fill in the ifr_name field with the 7250 interface name, and upon return, the ifr_ifru.ifru_addr 7251 field is set with the interface address. 7252 7253 SIOCGIFBRADDR 7254 Gets the interface broadcast address for the given 7255 interface. argp shall point to a ifreq structure. 7256 Before calling, the caller should fill in the ifr_name 7257 field with the interface name, and upon return, the 7258 ifr_ifru.ifru_broadcast field is set with the interface 7259 broadcast address. 7260 7261 SIOCGIFNETMASK 7262 Gets the network mask for the given interface. argp 7263 shall point to a ifreq structure. Before calling, the 7264 caller should fill in the ifr_name field with the 7265 interface name, and upon return, the 7266 ifr_ifru.ifru_netmask field is set with the network 7267 mask. 7268 7269 SIOCGIFMTU 7270 Gets the MTU for the given interface. argp shall point 7271 to a ifreq structure. Before calling, the caller should 7272 fill in the ifr_name field with the interface name, and 7273 upon return, the ifr_ifru.ifru_mtu field is set with 7274 the MTU. 7275 7276 FIONREAD 7277 Returns the amount of queued unread data in the receive 7278 buffer. argp shall point to an integer where the result 7279 is to be placed. 7280 7281 Return Value 7282 7283 On success, if request is SIOCGIFCONF, a non-negative integer 7284 shall be returned. If request is not SIOCGIFCONF, on success 0 7285 is returned. On error, -1 is returned and the global variable 7286 errno is set appropriately. 7287 7288 Errors 7289 7290 EBADF 7291 sockfd is not a valid descriptor. 7292 7293 EFAULT 7294 argp references an inaccessible memory area. 7295 7296 ENOTTY 7297 The specified request does not apply to the kind of 7298 object that the descriptor sockfd references. 7299 7300 EINVAL 7301 Either request or argp is invalid. 7302 7303 ENOTCONN 7304 The operation is only defined on a connected socket, 7305 but the socket wasn't connected. 7306 7307 ttyio 7308 7309 Name 7310 7311 ttyio -- tty ioctl commands 7312 7313 Synopsis 7314 7315 #include 7316 7317 int ioctl(int fd, unsigned long request, int * argp); 7318 7319 Description 7320 7321 Tty ioctl commands are a subset of the ioctl() calls, which 7322 can perform a variety of functions on tty devices. fd shall 7323 contain the value of a file descriptor that was created with 7324 the open() call. 7325 7326 The following ioctl()s are provided: 7327 7328 TIOCGWINSZ 7329 Gets the size attributes of the tty. argp is a pointer 7330 to a winsize structure. 7331 7332 Return Value 7333 7334 On success, 0 is returned. On error, -1 is returned and the 7335 global variable errno is set appropriately. 7336 7337 Errors 7338 7339 EBADF 7340 fd is not a valid descriptor. 7341 7342 EFAULT 7343 argp references an inaccessible memory area. 7344 7345 EINVAL 7346 request and argp are not valid. 7347 7348 kill 7349 7350 Name 7351 7352 kill -- send a signal 7353 7354 Synopsis 7355 7356 #include 7357 7358 int kill(pid_t pid, int sig); 7359 7360 Description 7361 7362 kill() is as specified in the ISO POSIX (2003), but with 7363 differences as listed below. 7364 7365 Process ID -1 doesn't affect calling process 7366 7367 If pid is specified as -1, sig shall not be sent to the 7368 calling process. Other than this, the rules in the ISO POSIX 7369 (2003) apply. 7370 7371 Rationale: This was a deliberate Linus decision after an 7372 unpopular experiment in including the calling process in 7373 the 2.5.1 kernel. See "What does it mean to signal 7374 everybody?", Linux Weekly News, 20 December 2001, 7375 http://lwn.net/2001/1220/kernel.php3 7376 7377 mbsnrtowcs 7378 7379 Name 7380 7381 mbsnrtowcs -- convert a multibyte string to a wide character 7382 string 7383 7384 Synopsis 7385 7386 #include 7387 7388 size_t mbsnrtowcs(wchar_t * dest, const char * * src, size_t 7389 nms, size_t len, mbstate_t * ps); 7390 7391 Description 7392 7393 mbsnrtowcs() is like mbsrtowcs(), except that the number of 7394 bytes to be converted, starting at src, is limited to nms. 7395 7396 If dest is not a NULL pointer, mbsnrtowcs() converts at most 7397 nms bytes from the multibyte string src to a wide-character 7398 string starting at dest. At most, len wide characters are 7399 written to dest. The state ps is updated. 7400 7401 The conversion is effectively performed by repeatedly calling: 7402 7403 mbrtowc(dest, *src, n, ps) 7404 7405 where n is some positive number, as long as this call 7406 succeeds, and then incrementing dest by one and src by the 7407 number of bytes consumed. 7408 7409 The conversion can stop for three reasons: 7410 7411 * An invalid multibyte sequence has been encountered. In 7412 this case src is left pointing to the invalid multibyte 7413 sequence, (size_t)(-1) is returned, and errno is set to 7414 EILSEQ. 7415 * The nms limit forces a stop, or len non-L'\0' wide 7416 characters have been stored at dest. In this case, src is 7417 left pointing to the next multibyte sequence to be 7418 converted, and the number of wide characters written to 7419 dest is returned. 7420 * The multibyte string has been completely converted, 7421 including the terminating '\0' (which has the side effect 7422 of bringing back ps to the initial state). In this case, 7423 src is set to NULL, and the number of wide characters 7424 written to dest, excluding the terminating L'\0' 7425 character, is returned. 7426 7427 If dest is NULL, len is ignored, and the conversion proceeds 7428 as above, except that the converted wide characters are not 7429 written out to memory, and that no destination length limit 7430 exists. 7431 7432 In both of the above cases, if ps is a NULL pointer, a static 7433 anonymous state only known to mbsnrtowcs() is used instead. 7434 7435 The programmer shall ensure that there is room for at least 7436 len wide characters at dest. 7437 7438 Return Value 7439 7440 mbsnrtowcs() returns the number of wide characters that make 7441 up the converted part of the wide character string, not 7442 including the terminating null wide character. If an invalid 7443 multibyte sequence was encountered, (size_t)(-1) is returned, 7444 and the global variable errno is set to EILSEQ. 7445 7446 Notes 7447 7448 The behavior of mbsnrtowcs() depends on the LC_CTYPE category 7449 of the current locale. 7450 7451 Passing NULL as ps is not multi-thread safe. 7452 7453 memmem 7454 7455 Name 7456 7457 memmem -- locate bytes 7458 7459 Synopsis 7460 7461 #define _GNU_SOURCE 7462 #include 7463 7464 void * memmem(const void * haystack, size_t haystacklen, const 7465 void * needle, size_t needlelen); 7466 7467 Description 7468 7469 memmem() finds the start of the first occurrence of the byte 7470 array referenced by needle of length needlelen in the memory 7471 area haystack of length haystacklen. 7472 7473 Return Value 7474 7475 memmem() returns a pointer to the beginning of the byte array, 7476 or NULL if the byte array is not found. 7477 7478 Notes 7479 7480 Earlier versions of the C library (prior to glibc 2.1) 7481 contained a memmem() with various problems, and application 7482 developers should treat this function with care. 7483 7484 memrchr 7485 7486 Name 7487 7488 memrchr -- scan memory for a character 7489 7490 Synopsis 7491 7492 #include 7493 7494 void * memrchr(const void * s, int c, size_t n); 7495 7496 Description 7497 7498 The memrchr() function shall locate the last occurence of c 7499 (converted to an unsigned char) in the initial n bytes (each 7500 interpreted as an unsigned char) of the object pointed to by 7501 s. 7502 7503 Return Value 7504 7505 The memrchr() shall return a pointer to the located byte, or a 7506 null pointer if the byte does not occur in the object. 7507 7508 Errors 7509 7510 No errors are defined. 7511 7512 See Also 7513 7514 memchr() 7515 7516 ngettext 7517 7518 Name 7519 7520 ngettext -- Search message catalogs for plural string 7521 7522 Synopsis 7523 7524 #include 7525 7526 char * ngettext(const char * msgid1, const char * msgid2, 7527 unsigned long int n); 7528 7529 Description 7530 7531 The ngettext() function shall search the currently selected 7532 message catalogs for a string matching the singular string 7533 msgid1. If a string is located, and if n is 1, that string 7534 shall be returned. If n is not 1, a pluralized version 7535 (dependant on n) of the string shall be returned. 7536 7537 The ngettext() function is equivalent to dcngettext(NULL, 7538 msgid1, msgid2, n, LC_MESSAGES)(). 7539 7540 Return Value 7541 7542 If a string is found in the currently selected message 7543 catalogs for msgid1, then if n is 1 a pointer to the located 7544 string shall be returned. If n is not 1, a pointer to an 7545 appropriately pluralized version of the string shall be 7546 returned. If no message could be found in the currently 7547 selected mesage catalogs, then if n is 1, a pointer to msgid1 7548 shall be returned, otherwise a pointer to msgid2 shall be 7549 returned. 7550 7551 Applications shall not modify the string returned by 7552 ngettext(). 7553 7554 Errors 7555 7556 None. 7557 7558 The ngettext() function shall not modify errno. 7559 7560 See Also 7561 7562 gettext, dgettext, ngettext, dngettext, dcgettext, dcngettext, 7563 textdomain, bindtextdomain, bind_textdomain_codeset 7564 7565 open 7566 7567 Name 7568 7569 open -- open a file 7570 7571 Description 7572 7573 The open() function shall behave as specified in ISO POSIX 7574 (2003), except with differences as listed below. 7575 7576 May return ENODEV in place of ENXIO 7577 7578 Where ISO POSIX (2003) specifies an ENXIO return, a conforming 7579 implementation may return either ENXIO or ENODEV. 7580 Implementations are encouraged to return ENXIO. 7581 7582 Rationale: As of spring 2004, no Linux kernel patches to 7583 switch to ENXIO are known, but it is believed that such a 7584 kernel patch would be accepted if submitted. 7585 7586 opterr 7587 7588 Name 7589 7590 opterr -- external variable used in getopt() 7591 7592 Synopsis 7593 7594 extern int opterr; 7595 7596 Description 7597 7598 opterr is used as a flag to suppress an error message 7599 generated by getopt(). When opterr is set to 0, it suppresses 7600 the error message generated by getopt() when that function 7601 does not recognize an option character. 7602 7603 optind 7604 7605 Name 7606 7607 optind -- external variable used in getopt() 7608 7609 Synopsis 7610 7611 extern int optind; 7612 7613 Description 7614 7615 optind holds the current index of the array argv[], which 7616 contains the command line options being parsed by getopt(). 7617 7618 optopt 7619 7620 Name 7621 7622 optopt -- external variable used in getopt() 7623 7624 Synopsis 7625 7626 extern int optopt; 7627 7628 Description 7629 7630 optopt holds the unknown option character when that option 7631 character is not recognized by getopt(). 7632 7633 pmap_getport 7634 7635 Name 7636 7637 pmap_getport -- Find the port number assigned to a service 7638 registered with a portmapper. 7639 7640 Synopsis 7641 7642 #include 7643 7644 u_short * pmap_getport(struct sockaddr_in * address, const 7645 u_long program, const u_long * version, u_int protocol); 7646 7647 Description 7648 7649 The pmap_getport() function shall return the port number 7650 assigned to a service registered with a RPC Binding service 7651 running on a given target system, using the protocol described 7652 in RFC 1833: Binding Protocols for ONC RPC Version 2. The 7653 pmap_getport() function shall be called given the RPC program 7654 number program, the program version version, and transport 7655 protocol protocol. Conforming implementations shall support 7656 both IPPROTO_UDP and IPPROTO_TCP protocols. On entry, address 7657 shall specify the address of the system on which the 7658 portmapper to be contacted resides. The value of 7659 address->sin_port shall be ignored, and the standard value for 7660 the portmapper port shall always be used. 7661 7662 Note: Security and network restrictions may prevent a 7663 conforming application from contacting a remote RPC Binding 7664 Service. 7665 7666 Return Value 7667 7668 On success, the pmap_getport() function shall return the port 7669 number in host byte order of the RPC application registered 7670 with the remote portmapper. On failure, if either the program 7671 was not registered or the remote portmapper service could not 7672 be reached, the pmap_getport() function shall return 0. If the 7673 remote portmap service could not be reached, the status is 7674 left in the global variable rpc_createerr. 7675 7676 pmap_set 7677 7678 Name 7679 7680 pmap_set -- Establishes mapping to machine's RPC Bind service. 7681 7682 Synopsis 7683 7684 #include 7685 7686 bool_t pmap_set(const u_long program, const u_long version, 7687 int protocol, u_short port); 7688 7689 Description 7690 7691 pmap_set() establishes a mapping between the triple 7692 [program,version,protocol] and port on the machine's RPC Bind 7693 service. The value of protocol is most likely IPPROTO_UDP or 7694 IPPROTO_TCP. Automatically done by svc_register(). 7695 7696 Return Value 7697 7698 pmap_set() returns 1 if it suceeds, 0 otherwise. 7699 7700 pmap_unset 7701 7702 Name 7703 7704 pmap_unset -- Destroys RPC Binding 7705 7706 Synopsis 7707 7708 #include 7709 7710 bool_t pmap_unset(u_long prognum, u_long versnum); 7711 7712 Description 7713 7714 As a user interface to the RPC Bind service, pmap_unset() 7715 destroys all mapping between the triple [prognum,versnum, *] 7716 and ports on the machine's RPC Bind service. 7717 7718 Return Value 7719 7720 pmap_unset() returns 1 if it succeeds, zero otherwise. 7721 7722 psignal 7723 7724 Name 7725 7726 psignal -- print signal message 7727 7728 Synopsis 7729 7730 #include 7731 7732 void psignal(int sig, const char * s); 7733 7734 extern const char *const sys_siglist[] 7735 7736 Description 7737 7738 The psignal() function shall display a message on the stderr 7739 stream. If s is not the null pointer, and does not point to an 7740 empty string (e.g. "\0"), the message shall consist of the 7741 string s, a colon, a space, and a string describing the signal 7742 number sig; otherwise psignal() shall display only a message 7743 describing the signal number sig. If sig is invalid, the 7744 message displayed shall indicate an unknown signal. 7745 7746 The array sys_siglist holds the signal description strings 7747 indexed by signal number. 7748 7749 Return Value 7750 7751 psignal() returns no value. 7752 7753 random_r 7754 7755 Name 7756 7757 random_r -- generate random number (DEPRECATED) 7758 7759 Synopsis 7760 7761 int random_r(struct random_data * restrict buf, int32_t * 7762 restrict result); 7763 7764 Description 7765 7766 random_r() is a reentrant version of random(), which generates 7767 a pseudorandom number. 7768 7769 Future Directions 7770 7771 Since this function requires support from other functions not 7772 specified in this specification (most notably initstate_r()), 7773 a future version of this specification may remove this 7774 interface. 7775 7776 setbuffer 7777 7778 Name 7779 7780 setbuffer -- stream buffering operation 7781 7782 Synopsis 7783 7784 #include 7785 7786 void setbuffer(FILE * stream, char * buf, size_t size); 7787 7788 Description 7789 7790 setbuffer() is an alias for the call to setvbuf(). It works 7791 the same, except that the size of the buffer in setbuffer() is 7792 up to the caller, rather than being determined by the default 7793 BUFSIZ. 7794 7795 setdomainname 7796 7797 Name 7798 7799 setdomainname -- set NIS domain name (DEPRECATED). 7800 7801 Synopsis 7802 7803 #include 7804 7805 int setdomainname (const char * name , size_t namelen ); 7806 7807 Description 7808 7809 If NIS is in use, set the NIS domain name. Note that this is 7810 not the same as the domain name which provides the domain 7811 portion of a fully qualified domain name (for example, in 7812 DNS). If NIS is not in use, this function may set the domain 7813 name anyway, or it may fail. 7814 7815 This call shall fail unless the caller has appropriate 7816 privileges. 7817 7818 namelen shall be the length of the string pointed to by name. 7819 7820 Return Value 7821 7822 On success, setdomainname() shall return 0. Otherwise, it 7823 shall return -1 and set errno to indicate the error. 7824 7825 Errors 7826 7827 EPERM 7828 The process did not have sufficient privilege to set 7829 the domain name. 7830 7831 EINVAL 7832 name is a null pointer. 7833 7834 setgroups 7835 7836 Name 7837 7838 setgroups -- set list of supplementary group IDs 7839 7840 Synopsis 7841 7842 #include 7843 7844 int setgroups(size_t size, const gid_t * list); 7845 7846 Description 7847 7848 If the process has appropriate privilege, the setgroups() 7849 function shall set the supplementary group IDs for the current 7850 process. list shall reference an array of size group IDs. A 7851 process may have at most NGROUPS_MAX supplementary group IDs. 7852 7853 Return Value 7854 7855 On successful completion, 0 is returned. On error, -1 is 7856 returned and the errno is set to indicate the error. 7857 7858 Errors 7859 7860 EFAULT 7861 list has an invalid address. 7862 7863 EPERM 7864 The process does not have appropriate privileges. 7865 7866 EINVAL 7867 size is greater than NGROUPS_MAX. 7868 7869 sethostid 7870 7871 Name 7872 7873 sethostid -- set the unique identifier of the current host 7874 (DEPRECATED) 7875 7876 Synopsis 7877 7878 #include 7879 7880 int sethostid(long int hostid); 7881 7882 Description 7883 7884 sethostid() sets a unique 32-bit identifier for the current 7885 machine. The 32-bit identifier is intended to be unique among 7886 all UNIX systems in existence. This normally resembles the 7887 Internet address for the local machine as returned by 7888 gethostbyname()(3), and thus usually never needs to be set. 7889 7890 The sethostid() call is restricted to the superuser. 7891 7892 hostid is stored in the file /etc/hostid. 7893 7894 The sethostid() function is deprecated from the LSB and is 7895 expected to disappear from a future version of the LSB. 7896 7897 Return Value 7898 7899 gethostid() returns the 32-bit identifier for the current host 7900 as set by sethostid()(2). 7901 7902 Files 7903 7904 /etc/hostid 7905 7906 sethostname 7907 7908 Name 7909 7910 sethostname -- set host name 7911 7912 Synopsis 7913 7914 #include 7915 #include 7916 #include 7917 7918 int sethostname(const char * name, size_t len); 7919 7920 Description 7921 7922 If the process has appropriate privileges, the sethostname() 7923 function shall change the host name for the current macine. 7924 The name shall point to a null-terminated string of at most 7925 len bytes that holds the new hostname. 7926 7927 If the symbol HOST_NAME_MAX is defined, or if 7928 sysconf(_SC_HOST_NAME_MAX)() returns a value greater than 0, 7929 this value shall represent the maximum length of the new 7930 hostname. Otherwise, if the symbol MAXHOSTLEN is defined, this 7931 value shall represent the maximum length for the new hostname. 7932 If none of these values are defined, the maximum length shall 7933 be the size of the nodename field of the utsname structure. 7934 7935 Return Value 7936 7937 On success, 0 is returned. On error, -1 is returned and the 7938 global variable errno is set appropriately. 7939 7940 Errors 7941 7942 EINVAL 7943 len is negative or larger than the maximum allowed 7944 size. 7945 7946 EPERM 7947 the process did not have appropriate privilege. 7948 7949 EFAULT 7950 name is an invalid address. 7951 7952 Rationale 7953 7954 ISO POSIX (2003) guarantees that: 7955 7956 Maximum length of a host name (not including the 7957 terminating null) as returned from the gethostname() 7958 function shall be at least 255 bytes. 7959 7960 The glibc C library does not currently define HOST_NAME_MAX, 7961 and although it provides the name _SC_HOST_NAME_MAX a call to 7962 sysconf() returns -1 and does not alter errno in this case 7963 (indicating that there is no restriction on the hostname 7964 length). However, the glibc manual idicates that some 7965 implementations may have MAXHOSTNAMELEN as a means of 7966 detecting the maximum length, while the Linux kernel at 7967 release 2.4 and 2.6 stores this hostname in the utsname 7968 structure. While the glibc manual suggests simply shortening 7969 the name until sethostname() succeeds, the LSB requires that 7970 one of the first four mechanisms works. Future versions of 7971 glibc may provide a more reasonable result from 7972 sysconf(_SC_HOST_NAME_MAX). 7973 7974 setsockopt 7975 7976 Name 7977 7978 setsockopt -- set options on sockets 7979 7980 Synopsis 7981 7982 #include 7983 #include 7984 7985 int setsockopt(int sockfd, int level, int optname, const void 7986 * optval, socklen_t optlen); 7987 7988 Description 7989 7990 In addition to the setsockopt() options specified in SUSv3, 7991 setsockopt() also supports the options specified here. 7992 7993 The following setsockopt() operations are provided for level 7994 IPPROTO_IP: 7995 7996 IP_MULTICAST_TTL 7997 Set or reads the time-to-live value of outgoing 7998 multicast packets for this socket. optval is a pointer 7999 to an integer which contains the new TTL value. 8000 8001 IP_MULTICAST_LOOP 8002 Sets a boolean flag indicating whether multicast 8003 packets originating locally should be looped back to 8004 the local sockets. optval is a pointer to an integer 8005 which contains the new flag value. 8006 8007 IP_ADD_MEMBERSHIP 8008 Join a multicast group. optval is a pointer to a 8009 ip_mreq structure. Before calling, the caller should 8010 fill in the imr_multiaddr field with the multicast 8011 group address and the imr_address field with the 8012 address of the local interface. If imr_address is set 8013 to INADDR_ANY, then an appropriate interface is chosen 8014 by the system. 8015 8016 IP_DROP_MEMBERSHIP 8017 Leave a multicast group. optval is a pointer to a 8018 ip_mreq structure containing the same values as were 8019 used with IP_ADD_MEMBERSHIP. 8020 8021 IP_MULTICAST_IF 8022 Set the local device for a multicast socket. optval is 8023 a pointer to a ip_mreq structure initialized in the 8024 same manner as with IP_ADD_MEMBERSHIP. 8025 8026 The ip_mreq structure contains two struct in_addr fields: 8027 imr_multiaddr and imr_address. 8028 8029 Return Value 8030 8031 On success, 0 is returned. On error, -1 is returned and the 8032 global variable errno is set appropriately. 8033 8034 setutent 8035 8036 Name 8037 8038 setutent -- access user accounting database entries 8039 8040 Synopsis 8041 8042 #include 8043 8044 void setutent(void); 8045 8046 Description 8047 8048 The setutent() function shall reset the user accounting 8049 database such that the next call to getutent() shall be return 8050 the first record in the database. It is recommended to call it 8051 before any of the other functions that operate on the user 8052 accounting databases (e.g. getutent()) 8053 8054 Return Value 8055 8056 None. 8057 8058 sigandset 8059 8060 Name 8061 8062 sigandset -- build a new signal set by combining the two input 8063 sets using logical AND 8064 8065 Synopsis 8066 8067 #include 8068 8069 int sigandset(sigset_t * set, const sigset_t * left, const 8070 sigset_t * right); 8071 8072 Description 8073 8074 The sigandset() shall combine the two signal sets referenced 8075 by left and right, using a logical AND operation, and shall 8076 place the result in the location referenced by set, The 8077 resulting signal set shall contain only signals that are in 8078 both the set referenced by left and the set referenced by 8079 right. 8080 8081 Return Value 8082 8083 On success, sigandset() shall return 0. Otherise, sigandset() 8084 shall return -1 and set errno to indicate the error. 8085 8086 Errors 8087 8088 EINVAL 8089 One or more of set, left, or right was a null pointer. 8090 8091 See Also 8092 8093 sigorset() 8094 8095 sigblock 8096 8097 Name 8098 8099 sigblock -- manipulate the signal mask (DEPRECATED) 8100 8101 Synopsis 8102 8103 #include _BSD_SOURCE 8104 #include 8105 8106 int sigblock(int mask); 8107 8108 Description 8109 8110 The sigblock() function shall add the signals corresponding to 8111 the bits set in mask to the set of signals currently being 8112 blocked from delivery. 8113 8114 Return Value 8115 8116 The sigblock() function shall return the previous signal mask. 8117 8118 Errors 8119 8120 None. 8121 8122 Notes 8123 8124 sigblock() is made obsolete by sigprocmask(). A future version 8125 of this specification may deprecate this function. 8126 8127 siggetmask 8128 8129 Name 8130 8131 siggetmask -- manipulate the signal mask (DEPRECATED) 8132 8133 Synopsis 8134 8135 #define _BSD_SOURCE 8136 #include 8137 8138 int siggetmask(void); 8139 8140 Description 8141 8142 The siggetmask() function shall return the current set of 8143 masked signals. 8144 8145 Notes 8146 8147 siggetmask() is made obsolete by sigprocmask(). 8148 8149 sigisemptyset 8150 8151 Name 8152 8153 sigisemptyset -- check for empty signal set 8154 8155 Synopsis 8156 8157 #include 8158 8159 int sigisemptyset(const sigset_t * set); 8160 8161 Description 8162 8163 The sigisemptyset() function shall check for empty signal set 8164 referenced by set. 8165 8166 Return Value 8167 8168 The sigisemptyset() function shall return a positive non-zero 8169 value if the signal set referenced by set is empty, or zero if 8170 this set is empty. On error, sigisemptyset() shall return -1 8171 and set errno to indicate the error. 8172 8173 Errors 8174 8175 EINVAL 8176 set is a null pointer. 8177 8178 sigorset 8179 8180 Name 8181 8182 sigorset -- build a new signal set by combining the two input 8183 sets using logical OR 8184 8185 Synopsis 8186 8187 #include 8188 8189 int sigorset(sigset_t * set, const sigset_t * left, const 8190 sigset_t * right); 8191 8192 Description 8193 8194 The sigorset() shall combine the two signal sets referenced by 8195 left and right, using a logical OR operation, and shall place 8196 the result in the location referenced by set, The resulting 8197 signal set shall contain only signals that are in either the 8198 set referenced by left or the set referenced by right. 8199 8200 Return Value 8201 8202 On success, sigorset() shall return 0. Otherise, sigorset() 8203 shall return -1 and set errno to indicate the error. 8204 8205 Errors 8206 8207 EINVAL 8208 One or more of set, left, or right was a null pointer. 8209 8210 See Also 8211 8212 sigorset() 8213 8214 sigreturn 8215 8216 Name 8217 8218 sigreturn -- return from signal handler and cleanup stack 8219 frame 8220 8221 Synopsis 8222 8223 int sigreturn(struct sigcontext * scp); 8224 8225 Description 8226 8227 The sigreturn() function is used by the system to cleanup 8228 after a signal handler has returned. This function is not in 8229 the source standard; it is only in the binary standard. 8230 8231 Return Value 8232 8233 sigreturn() never returns. 8234 8235 stime 8236 8237 Name 8238 8239 stime -- set time 8240 8241 Synopsis 8242 8243 #define _SVID_SOURCE 8244 #include 8245 8246 int stime(const time_t * t); 8247 8248 Description 8249 8250 If the process has appropriate privilege, the stime() function 8251 shall set the system's idea of the time and date. Time, 8252 referenced by t, is measured in seconds from the epoch 8253 (defined in ISO POSIX (2003) as 00:00:00 UTC January 1, 1970). 8254 8255 Return Value 8256 8257 On success, stime() shall return 0. Otherwise, stime() shall 8258 return -1 and errno shall be set to indicate the error. 8259 8260 Errors 8261 8262 EPERM 8263 The process does not have appropriate privilege. 8264 8265 EINVAL 8266 t is a null pointer. 8267 8268 stpcpy 8269 8270 Name 8271 8272 stpcpy -- copy a string returning a pointer to its end 8273 8274 Synopsis 8275 8276 #include 8277 8278 char * stpcpy(char * restrict dest, const char * restrict 8279 src); 8280 8281 Description 8282 8283 The stpcpy() function shall copy the string pointed to by src 8284 (including the terminating '\0' character) to the array 8285 pointed to by dest. The strings may not overlap, and the 8286 destination string dest shall be large enough to receive the 8287 copy. 8288 8289 Return Value 8290 8291 stpcpy() returns a pointer to the end of the string dest (that 8292 is, the address of the terminating '\0' character) rather than 8293 the beginning. 8294 8295 Example 8296 8297 This program uses stpcpy() to concatenate foo and bar to 8298 produce foobar, which it then prints. 8299 #include 8300 8301 int 8302 main (void) 8303 { 8304 char buffer[256]; 8305 char *to = buffer; 8306 to = stpcpy (to, "foo"); 8307 to = stpcpy (to, "bar"); 8308 printf ("%s\n", buffer); 8309 } 8310 8311 stpncpy 8312 8313 Name 8314 8315 stpncpy -- copy a fixed-size string, returning a pointer to 8316 its end 8317 8318 Synopsis 8319 8320 #include 8321 8322 char * stpncpy(char * restrict dest, const char * restrict 8323 src, size_t n); 8324 8325 Description 8326 8327 The stpncpy() function shall copy at most n characters from 8328 the string pointed to by src, including the terminating \0 8329 character, to the array pointed to by dest. Exactly n 8330 characters are written at dest. If the length strlen()(src) is 8331 smaller than n, the remaining characters in dest are filled 8332 with \0 characters. If the length strlen()(src) is greater 8333 than or equal to n, dest will not be \0 terminated. 8334 8335 The strings may not overlap. 8336 8337 The programmer shall ensure that there is room for at least n 8338 characters at dest. 8339 8340 Return Value 8341 8342 The stpncpy() function shall return a pointer to the 8343 terminating NULL in dest, or, if dest is not NULL-terminated, 8344 dest + n. 8345 8346 strcasestr 8347 8348 Name 8349 8350 strcasestr -- locate a substring ignoring case 8351 8352 Synopsis 8353 8354 #include 8355 8356 char * strcasestr(const char * s1, const char * s2); 8357 8358 Description 8359 8360 The strcasestr() shall behave as strstr(), except that it 8361 shall ignore the case of both strings. The strcasestr() 8362 function shall be locale aware; that is strcasestr() shall 8363 behave as if both strings had been converted to lower case in 8364 the current locale before the comparison is performed. 8365 8366 Return Value 8367 8368 Upon successful completion, strcasestr() shall return a 8369 pointer to the located string or a null pointer if the string 8370 is not found. If s2 points to a string with zero length, the 8371 function shall return s1. 8372 8373 strerror_r 8374 8375 Name 8376 8377 strerror_r -- reentrant version of strerror 8378 8379 Synopsis 8380 8381 #include 8382 8383 char * strerror_r(int errnum, char * buf, size_t buflen); 8384 8385 Description 8386 8387 The strerror_r() shall behave as specified in ISO POSIX 8388 (2003), except as described below. 8389 8390 Returns String, not Error Value 8391 8392 The strerror_r() function shall return a pointer to the string 8393 corresponding to errno. The returned pointer may point within 8394 the buffer buf (at most buflen bytes). 8395 8396 Return Value 8397 8398 On success, strerror_r() shall return a pointer to the 8399 generated message string (determined by the setting of the 8400 LC_MESSAGES category in the current locale). Otherwise, 8401 strerror_r() shall return the string corresponding to "Unknown 8402 error". 8403 8404 strfry 8405 8406 Name 8407 8408 strfry -- randomize a string (DEPRECATED) 8409 8410 Synopsis 8411 8412 #include 8413 8414 char * strfry(char * string); 8415 8416 Description 8417 8418 The strfry() function is deprecated from the LSB and is 8419 expected to disappear from a future version of the LSB. 8420 8421 strfry() randomizes the contents of string by using rand()(3) 8422 to randomly swap characters in the string. The result is an 8423 anagram of string. 8424 8425 Return Value 8426 8427 strfry() returns a pointer to the randomized string. 8428 8429 strndup 8430 8431 Name 8432 8433 strndup -- return a malloc'd copy of at most the specified 8434 number of bytes of a string 8435 8436 Synopsis 8437 8438 #include 8439 8440 char * strndup(const char * string, size_t n); 8441 8442 Description 8443 8444 The strndup() function shall return a malloc()'d copy of at 8445 most n bytes of string. The resultant string shall be 8446 terminated even if no NULL terminator appears before string+n. 8447 8448 Return Value 8449 8450 On success, strndup() shall return a pointer to a newly 8451 allocated block of memory containing a copy of at most n bytes 8452 of string. Otherwise, strndup() shall return NULL and set 8453 errno to indicate the error. 8454 8455 Errors 8456 8457 ENOMEM 8458 Insufficient memory available. 8459 8460 strnlen 8461 8462 Name 8463 8464 strnlen -- determine the length of a fixed-size string 8465 8466 Synopsis 8467 8468 #include 8469 8470 size_t strnlen(const char * s, size_t maxlen); 8471 8472 Description 8473 8474 strnlen() returns the number of characters in the string s, 8475 not including the terminating \0 character, but at most 8476 maxlen. In doing this, strnlen() looks only at the first 8477 maxlen characters at s and never beyond s + maxlen. 8478 8479 Return Value 8480 8481 strnlen() returns strlen()(s), if that is less than maxlen, or 8482 maxlen if there is no \0 character among the first maxlen 8483 characters pointed to by s. 8484 8485 strptime 8486 8487 Name 8488 8489 strptime -- parse a time string 8490 8491 Description 8492 8493 The strptime() shall behave as specified in the ISO POSIX 8494 (2003) with differences as listed below. 8495 8496 Number of leading zeroes may be limited 8497 8498 The ISO POSIX (2003) specifies fields for which "leading zeros 8499 are permitted but not required"; however, applications shall 8500 not expect to be able to supply more leading zeroes for these 8501 fields than would be implied by the range of the field. 8502 Implementations may choose to either match an input with 8503 excess leading zeroes, or treat this as a non-matching input. 8504 For example, %j has a range of 001 to 366, so 0, 00, 000, 001, 8505 and 045 are acceptable inputs, but inputs such as 0000, 0366 8506 and the like are not. 8507 8508 Rationale 8509 8510 glibc developers consider it appropriate behavior to forbid 8511 excess leading zeroes. When trying to parse a given input 8512 against several format strings, forbidding excess leading 8513 zeroes could be helpful. For example, if one matches 8514 0011-12-26 against %m-%d-%Y and then against %Y-%m-%d, it 8515 seems useful for the first match to fail, as it would be 8516 perverse to parse that date as November 12, year 26. The 8517 second pattern parses it as December 26, year 11. 8518 8519 The ISO POSIX (2003) is not explicit that an unlimited number 8520 of leading zeroes are required, although it may imply this. 8521 The LSB explicitly allows implementations to have either 8522 behavior. Future versions of this standard may require 8523 implementations to forbid excess leading zeroes. 8524 8525 An Interpretation Request is currently pending against ISO 8526 POSIX (2003) for this matter. 8527 8528 strsep 8529 8530 Name 8531 8532 strsep -- extract token from string 8533 8534 Synopsis 8535 8536 #include 8537 8538 char * strsep(char * * stringp, const char * delim); 8539 8540 Description 8541 8542 The strsep() function shall find the first token in the string 8543 referenced by the pointer stringp, using the characters in 8544 delim as delimiters. 8545 8546 If stringp is NULL, strsep() shall return NULL and do nothing 8547 else. 8548 8549 If stringp is non-NULL, strsep() shall find the first token in 8550 the string referenced by stringp, where tokens are delimited 8551 by characters in the string delim. This token shall be 8552 terminated with a \0 character by overwriting the delimiter, 8553 and stringp shall be updated to point past the token. In case 8554 no delimiter was found, the token is taken to be the entire 8555 string referenced by stringp, and the location referenced by 8556 stringp is made NULL. 8557 8558 Return Value 8559 8560 strsep() shall return a pointer to the beginning of the token. 8561 8562 Notes 8563 8564 The strsep() function was introduced as a replacement for 8565 strtok(), since the latter cannot handle empty fields. 8566 However, strtok() conforms to ISO C (1999) and to ISO POSIX 8567 (2003) and hence is more portable. 8568 8569 See Also 8570 8571 strtok(), strtok_r(). 8572 8573 strsignal 8574 8575 Name 8576 8577 strsignal -- return string describing signal 8578 8579 Synopsis 8580 8581 #define _GNU_SOURCE 8582 #include 8583 8584 char * strsignal(int sig); 8585 8586 extern const char * const sys_siglist[]; 8587 8588 Description 8589 8590 The strsignal() function shall return a pointer to a string 8591 describing the signal number sig. The string can only be used 8592 until the next call to strsignal(). 8593 8594 The array sys_siglist holds the signal description strings 8595 indexed by signal number. This array should not be accessed 8596 directly by applications. 8597 8598 Return Value 8599 8600 If sig is a valid signal number, strsignal() shall return a 8601 pointer to the appropriate description string. Otherwise, 8602 strsignal() shall return either a pointer to the string 8603 "unknown signal", or a null pointer. 8604 8605 Although the function is not declared as returning a pointer 8606 to a constant character string, applications shall not modify 8607 the returned string. 8608 8609 strtoq 8610 8611 Name 8612 8613 strtoq -- convert string value to a long or quad_t integer 8614 8615 Synopsis 8616 8617 #include 8618 #include 8619 #include 8620 8621 long long strtoq(const char * nptr, char * * endptr, int 8622 base); 8623 8624 Description 8625 8626 strtoq() converts the string nptr to a quadt value. The 8627 conversion is done according to the given base, which shall be 8628 between 2 and 36 inclusive, or be the special value 0. 8629 8630 nptr may begin with an arbitrary amount of white space (as 8631 determined by isspace()(3)), followed by a single optional + 8632 or - sign character. If base is 0 or 16, the string may then 8633 include a 0x prefix, and the number will be read in base 16; 8634 otherwise, a 0 base is taken as 10 (decimal), unless the next 8635 character is 0, in which case it is taken as 8 (octal). 8636 8637 The remainder of the string is converted to a long value in 8638 the obvious manner, stopping at the first character which is 8639 not a valid digit in the given base. (In bases above 10, the 8640 letter A in either upper or lower case represents 10, B 8641 represents 11, and so forth, with Z representing 35.) 8642 8643 Return Value 8644 8645 strtoq() returns the result of the conversion, unless the 8646 value would underflow or overflow. If an underflow occurs, 8647 strtoq() returns QUAD_MIN. If an overflow occurs, strtoq() 8648 returns QUAD_MAX. In both cases, the global variable errno is 8649 set to ERANGE. 8650 8651 Errors 8652 8653 ERANGE 8654 The given string was out of range; the value converted 8655 has been clamped. 8656 8657 strtouq 8658 8659 Name 8660 8661 strtouq -- convert a string to an unsigned long long 8662 8663 Synopsis 8664 8665 #include 8666 #include 8667 #include 8668 8669 unsigned long long strtouq(const char * nptr, char * * endptr, 8670 int base); 8671 8672 Description 8673 8674 strtouq() converts the string nptr to an unsigned long long 8675 value. The conversion is done according to the given base, 8676 which shall be between 2 and 36 inclusive, or be the special 8677 value 0. 8678 8679 nptr may begin with an arbitrary amount of white space (as 8680 determined by isspace()(3)), followed by a single optional + 8681 or - sign character. If base is 0 or 16, the string may then 8682 include a 0x prefix, and the number will be read in base 16; 8683 otherwise, a 0 base is taken as 10 (decimal), unless the next 8684 character is 0, in which case it is taken as 8 (octal). 8685 8686 The remainder of the string is converted to an unsigned long 8687 value in the obvious manner, stopping at the end of the string 8688 or at the first character that does not produce a valid digit 8689 in the given base. (In bases above 10, the letter A in either 8690 upper or lower case represents 10, B represents 11, and so 8691 forth, with Z representing 35.) 8692 8693 Return Value 8694 8695 On success, strtouq() returns either the result of the 8696 conversion or, if there was a leading minus sign, the negation 8697 of the result of the conversion, unless the original 8698 (non-negated) value would overflow. In the case of an overflow 8699 the function returns UQUAD_MAX and the global variable errno 8700 is set to ERANGE. 8701 8702 Errors 8703 8704 ERANGE 8705 The given string was out of range; the value converted 8706 has been clamped. 8707 8708 strverscmp 8709 8710 Name 8711 8712 strverscmp -- compare strings holding name and indices/version 8713 numbers (DEPRECATED) 8714 8715 Synopsis 8716 8717 #include 8718 8719 int strverscmp(const char * s1, const char * s2); 8720 8721 Description 8722 8723 The strverscmp() function is deprecated from the LSB and is 8724 expected to disappear from a future version of the LSB. 8725 8726 The strversmp() function shall compare two strings in a 8727 similar manner to strcmp(). If s1 and s2 contain no digits, 8728 strversmp() shall behave as strcmp(). 8729 8730 The strings are compared by scanning from left to right. If a 8731 digit or sequence of digits is encountered in both strings at 8732 the same position, the digit sequence is specially compared, 8733 as described below. If the digit sequences compared equal, the 8734 string comparison resumes in both s1 and s2 after the digit 8735 sequence. 8736 8737 Digit sequences are classified as either "integral" or 8738 "fractional". A fractional digit sequence begins with a '0'; 8739 otherwise the digit sequence shall be treated as an integral 8740 digit sequence. 8741 8742 If two integral digit sequences are encountered, they shall be 8743 compared as integers for equality. A fractional digit sequence 8744 shall always compare less than an integral digit sequence. If 8745 two fractional digit sequences are being compared, then if the 8746 common prefix contains only leading zeroes, the longer part 8747 shall compare less than the shorter; otherwise the comparison 8748 shall be strictly numeric. 8749 8750 Examples 8751 8752 Table 7-1. Examples 8753 Call Return Value 8754 strverscmp()( "no digit", "no digit") 0 /* same behavior as 8755 strcmp */ 8756 strverscmp()( "item#99", "item#100") < 0 /* same prefix, but 8757 99 < 100 */ 8758 strverscmp()( "alpha1", "alpha001") > 0 /* fractional part 8759 inferior to integral */ 8760 strverscmp()( "part1_f012", "part1_f01") > 0 /* two fractional 8761 parts */ 8762 strverscmp()( "foo.009", "foo.0") < 0 /* two fractional parts 8763 but with leading zeroes only */ 8764 8765 svc_register 8766 8767 Name 8768 8769 svc_register -- Register Remote Procedure Call Interface 8770 8771 Synopsis 8772 8773 #include 8774 8775 bool_t svc_register(SVCXPRT * xprt, rpcprog_t prognum, 8776 rpcvers_t versnum, __dispatch_fn_t dispatch, rpcprot_t 8777 protocol); 8778 8779 Description 8780 8781 The svc_register() function shall associate the program 8782 identified by prognum at version versnum with the service 8783 dispatch procedure, dispatch. If protocol is zero, the service 8784 is not registered with the portmap service. If protocol is 8785 non-zero, then a mapping of the triple [prognum, versnum, 8786 protocol] to xprt->xp_port is established with the local 8787 portmap service. The procedure dispatch has the following 8788 form: 8789 8790 int dispatch(struct svc_req * request, SVCXPRT * xprt); 8791 8792 Return Value 8793 8794 svc_register() returns 1 if it succeeds, and zero otherwise. 8795 8796 svc_run 8797 8798 Name 8799 8800 svc_run -- Waits for RPC requests to arrive and calls service 8801 procedure. 8802 8803 Synopsis 8804 8805 #include 8806 8807 void svc_run(void); 8808 8809 Description 8810 8811 The svc_run() function shall wait for RPC requests to arrive, 8812 read and unpack each request, and dispatch it to the 8813 appropriate registered handler. Under normal conditions, 8814 svc_run() shall not return; it shall only return if serious 8815 errors occur that prevent further processing. 8816 8817 svc_sendreply 8818 8819 Name 8820 8821 svc_sendreply -- called by RPC service's dispatch routine 8822 8823 Synopsis 8824 8825 bool_t svc_sendreply(SVCXPRT *xprt, xdrproc_t outproc, caddr_t 8826 out); 8827 8828 Description 8829 8830 Called by an RPC service's dispatch routine to send the 8831 results of a remote procedure call. The parameter xprt is the 8832 request's associated transport handle; outproc is the XDR 8833 routine which is used to encode the results; and out is the 8834 address of the results. This routine returns one if it 8835 succeeds, zero other-wise. 8836 8837 svctcp_create 8838 8839 Name 8840 8841 svctcp_create -- Creates a TCP/IP-based RPC service transport. 8842 8843 Synopsis 8844 8845 #include 8846 8847 SVCXPRT * svctcp_create(int sock, u_int send_buf_size, u_int 8848 recv_buf_size); 8849 8850 Description 8851 8852 svctcp_create() cretes a TCP/IP-based RPC service transport, 8853 to which it returns a pointer. The transport is associated 8854 with the socket sock, which may be RPC_ANYSOCK, in which case 8855 a new socket is created. If the socket is not bound to a local 8856 TCP port, then this routine binds it to an arbitrary port. 8857 Upon completion, xprt->xp_sock is the transport's socket 8858 descriptor, and xprt->xp_port is the transport's port number. 8859 Since TCP-based RPC uses buffered I/O, users may specify the 8860 size of buffers; values of zero choose suitable defaults. 8861 8862 Return Value 8863 8864 svctcp_create() returns NULL if it fails, or a pointer to the 8865 RPC service transport otherwise. 8866 8867 svcudp_create 8868 8869 Name 8870 8871 svcudp_create -- Creates a UDP-based RPC service transport. 8872 8873 Synopsis 8874 8875 SVCXPRT * 8876 8877 svcudp_create(int sock); 8878 8879 Description 8880 8881 This call is equivalent to svcudp_bufcreate( sock, SZ, SZ) for 8882 some default size SZ. 8883 8884 system 8885 8886 Name 8887 8888 system -- execute a shell command 8889 8890 Synopsis 8891 8892 #include 8893 8894 int system(const char * string); 8895 8896 Description 8897 8898 The system() function shall behave as described in ISO POSIX 8899 (2003). 8900 8901 Notes 8902 8903 The fact that system() ignores interrupts is often not what a 8904 program wants. ISO POSIX (2003) describes some of the 8905 consequences; an additional consequence is that a program 8906 calling system() from a loop cannot be reliably interrupted. 8907 Many programs will want to use the exec() family of functions 8908 instead. 8909 8910 Do not use system() from a program with suid or sgid 8911 privileges, because unexpected values for some environment 8912 variables might be used to subvert system integrity. Use the 8913 exec() family of functions instead, but not execlp() or 8914 execvp(). system() will not, in fact, work properly from 8915 programs with suid or sgid privileges on systems on which 8916 /bin/sh is bash version 2, since bash 2 drops privileges on 8917 startup. (Debian uses a modified bash which does not do this 8918 when invoked as sh.) 8919 8920 The check for the availability of /bin/sh is not actually 8921 performed; it is always assumed to be available. ISO C (1999) 8922 specifies the check, but ISO POSIX (2003) specifies that the 8923 return shall always be nonzero, since a system without the 8924 shell is not conforming, and it is this that is implemented. 8925 8926 It is possible for the shell command to return 127, so that 8927 code is not a sure indication that the execve() call failed; 8928 check the global variable errno to make sure. 8929 8930 textdomain 8931 8932 Name 8933 8934 textdomain -- set the current default message domain 8935 8936 Synopsis 8937 8938 #include 8939 8940 char * textdomain(const char * domainname); 8941 8942 Description 8943 8944 The textdomain() function shall set the current default 8945 message domain to domainname. Subsequent calls to gettext() 8946 and ngettext() use the default message domain. 8947 8948 If domainname is NULL, the default message domain shall not be 8949 altered. 8950 8951 If domainname is "", textdomain() shall reset the default 8952 domain to the system default of "messages". 8953 8954 Return 8955 8956 On success, textdomain() shall return the currently selected 8957 domain. Otherwise, a null pointer shall be returned, and errno 8958 set to indicate the error. 8959 8960 Errors 8961 8962 ENOMEM 8963 Insufficent memory available. 8964 8965 unlink 8966 8967 Name 8968 8969 unlink -- remove a directory entry 8970 8971 Synopsis 8972 8973 int unlink(const char * path); 8974 8975 Description 8976 8977 unlink() is as specified in ISO POSIX (2003), but with 8978 differences as listed below. 8979 8980 See also Additional behaviors: unlink/link on directory. 8981 8982 May return EISDIR on directories 8983 8984 If path specifies a directory, the implementation may return 8985 EISDIR instead of EPERM as specified by ISO POSIX (2003). 8986 8987 Rationale: The Linux kernel has deliberately chosen EISDIR 8988 for this case and does not expect to change (Al Viro, 8989 personal communication). 8990 8991 utmpname 8992 8993 Name 8994 8995 utmpname -- set user accounting database 8996 8997 Synopsis 8998 8999 #include 9000 9001 void getutent(const char * dbname ); 9002 9003 Description 9004 9005 The setutent() function shall cause the user accounting 9006 database used by the getutent(), getutent_r(), getutxent(), 9007 getutxid(), getutxline(), and pututxline() functions to be 9008 that named by dbname, instead of the system default database. 9009 See Section 10.2 for further information. 9010 9011 Note: The LSB does not specify the format of the user 9012 accounting database, nor the names of the file or files 9013 that may contain it. The implementation may map the dbname 9014 database name on to one or more files with the given stem. 9015 9016 Return Value 9017 9018 None. 9019 9020 Errors 9021 9022 None defined. 9023 9024 vasprintf 9025 9026 Name 9027 9028 vasprintf -- write formatted output to a dynamically allocated 9029 string 9030 9031 Synopsis 9032 9033 #include 9034 #include 9035 9036 int vasprintf(char * * restrict ptr, const char * restrict 9037 format, va_list arg); 9038 9039 Description 9040 9041 The vasprintf() function shall write formatted output to a 9042 dynamically allocated string, and store the address of that 9043 string in the location referenced by ptr. It shall behave as 9044 asprintf(), except that instead of being called with a 9045 variable number of arguments, it is called with an argument 9046 list as defined by . 9047 9048 Return Value 9049 9050 Refer to fprintf(). 9051 9052 Errors 9053 9054 Refer to fprintf(). 9055 9056 vdprintf 9057 9058 Name 9059 9060 vdprintf -- write formatted output to a file descriptor 9061 9062 Synopsis 9063 9064 #include 9065 9066 int vdprintf(int fd, const char * restrict format, va_list 9067 arg); 9068 9069 Description 9070 9071 The vdprintf() shall behave as vfprintf(), except that the 9072 first argument is a file descriptor rather than a STDIO 9073 stream. 9074 9075 Return Value 9076 9077 Refer to fprintf(). 9078 9079 Errors 9080 9081 Refer to fprintf(). 9082 9083 verrx 9084 9085 Name 9086 9087 verrx -- display formatted error message and exit 9088 9089 Synopsis 9090 9091 #include 9092 #include 9093 9094 void verrx(int eval, const char * fmt, va_list args); 9095 9096 Description 9097 9098 The verrx() shall behave as errx() except that instead of 9099 being called with a variable number of arguments, it is called 9100 with an argument list as defined by . 9101 9102 verrx() does not return, but exits with the value of eval. 9103 9104 Return Value 9105 9106 None. 9107 9108 Errors 9109 9110 None. 9111 9112 vsyslog 9113 9114 Name 9115 9116 vsyslog -- log to system log 9117 9118 Synopsis 9119 9120 #include 9121 #include 9122 9123 void vsyslog(int priority, char * message, va_list arglist); 9124 9125 Description 9126 9127 The vsyslog() function is identical to syslog() as specified 9128 in ISO POSIX (2003), except that arglist (as defined by 9129 stdarg.h) replaces the variable number of arguments. 9130 9131 wait3 9132 9133 Name 9134 9135 wait3 -- wait for child process (DEPRECATED) 9136 9137 Description 9138 9139 wait3() is as specified in the SUSv2 but with differences as 9140 listed below. 9141 9142 WCONTINUED and WIFCONTINUED optional 9143 9144 Implementations need not support the functionality of 9145 WCONTINUED or WIFCONTINUED. 9146 9147 wait4 9148 9149 Name 9150 9151 wait4 -- wait for process termination, BSD style 9152 9153 Synopsis 9154 9155 #include 9156 #include 9157 #include 9158 9159 pid_t wait4(pid_t pid, int * status, int options, struct 9160 rusage * rusage); 9161 9162 Description 9163 9164 wait4() suspends execution of the current process until a 9165 child (as specified by pid) has exited, or until a signal is 9166 delivered whose action is to terminate the current process or 9167 to call a signal handling function. If a child (as requested 9168 by pid) has already exited by the time of the call (a 9169 so-called "zombie" process), the function returns immediately. 9170 Any system resources used by the child are freed. 9171 9172 The value of pid can be one of: 9173 9174 < -1 9175 wait for any child process whose process group ID is 9176 equal to the absolute value of pid. 9177 9178 -1 9179 wait for any child process; this is equivalent to 9180 calling wait3(). 9181 9182 0 9183 wait for any child process whose process group ID is 9184 equal to that of the calling process. 9185 9186 > 0 9187 wait for the child whose process ID is equal to the 9188 value of pid. 9189 9190 The value of options is a bitwise or of zero or more of the 9191 following constants: 9192 9193 WNOHANG 9194 return immediately if no child is there to be waited 9195 for. 9196 9197 WUNTRACED 9198 return for children that are stopped, and whose status 9199 has not been reported. 9200 9201 If status is not NULL, wait4() stores status information in 9202 the location status. This status can be evaluated with the 9203 following macros: 9204 9205 Note: These macros take the status value (an int) as an 9206 argument -- not a pointer to the value! 9207 9208 WIFEXITED(status) 9209 is nonzero if the child exited normally. 9210 9211 WEXITSTATUS(status) 9212 evaluates to the least significant eight bits of the 9213 return code of the child that terminated, which may 9214 have been set as the argument to a call to exit() or as 9215 the argument for a return statement in the main 9216 program. This macro can only be evaluated if 9217 WIFEXITED() returned nonzero. 9218 9219 WIFSIGNALED(status) 9220 returns true if the child process exited because of a 9221 signal that was not caught. 9222 9223 WTERMSIG(status) 9224 returns the number of the signal that caused the child 9225 process to terminate. This macro can only be evaluated 9226 if WIFSIGNALED() returned nonzero. 9227 9228 WIFSTOPPED(status) 9229 returns true if the child process that caused the 9230 return is currently stopped; this is only possible if 9231 the call was done using WUNTRACED(). 9232 9233 WSTOPSIG(status) 9234 returns the number of the signal that caused the child 9235 to stop. This macro can only be evaluated if 9236 WIFSTOPPED() returned nonzero. 9237 9238 If rusage is not NULL, the struct rusage (as defined in 9239 sys/resource.h) that it points to will be filled with 9240 accounting information. (See getrusage()(2) for details. 9241 9242 Return Value 9243 9244 On success, the process ID of the child that exited is 9245 returned. On error, -1 is returned (in particular, when no 9246 unwaited-for child processes of the specified kind exist), or 9247 0 if WNOHANG() was used and no child was available yet. In the 9248 latter two cases, the global variable errno is set 9249 appropriately. 9250 9251 Errors 9252 9253 ECHILD 9254 No unwaited-for child process as specified does exist. 9255 9256 ERESTARTSYS 9257 A WNOHANG() was not set and an unblocked signal or a 9258 SIGCHILD was caught. This error is returned by the 9259 system call. The library interface is not allowed to 9260 return ERESTARTSYS, but will return EINTR. 9261 9262 waitpid 9263 9264 Name 9265 9266 waitpid -- wait for child process 9267 9268 Description 9269 9270 waitpid() is as specified in ISO POSIX (2003), but with 9271 differences as listed below. 9272 9273 Need not support WCONTINUED or WIFCONTINUED 9274 9275 Implementations need not support the functionality of 9276 WCONTINUED() or WIFCONTINUED(). 9277 9278 warn 9279 9280 Name 9281 9282 warn -- formatted error messages 9283 9284 Synopsis 9285 9286 #include 9287 9288 void warn(const char * fmt, ...); 9289 9290 Description 9291 9292 The warn() function shall display a formatted error message on 9293 the standard error stream. The output shall consist of the 9294 last component of the program name, a colon character, and a 9295 space character. If fmt is non-NULL, it shall be used as a 9296 format string for the printf() family of functions, and the 9297 formatted message, a colon character, and a space are written 9298 to stderr. Finally, the error message string affiliated with 9299 the current value of the global variable errno shall be 9300 written to stderr, followed by a newline character. 9301 9302 Return Value 9303 9304 None. 9305 9306 Errors 9307 9308 None. 9309 9310 warnx 9311 9312 Name 9313 9314 warnx -- formatted error messages 9315 9316 Synopsis 9317 9318 #include 9319 9320 void warnx(const char * fmt, ...); 9321 9322 Description 9323 9324 The warnx() function shall display a formatted error message 9325 on the standard error stream. The last component of the 9326 program name, a colon character, and a space shall be output. 9327 If fmt is non-NULL, it shall be used as the format string for 9328 the printf() family of functions, and the formatted error 9329 message, a colon character, and a space shall be output. The 9330 output shall be followed by a newline character. 9331 9332 Return Value 9333 9334 None. 9335 9336 Errors 9337 9338 None. 9339 9340 wcpcpy 9341 9342 Name 9343 9344 wcpcpy -- copy a wide character string, returning a pointer to 9345 its end 9346 9347 Synopsis 9348 9349 #include 9350 9351 wchar_t * wcpcpy(wchar_t * dest, const wchar_t * src); 9352 9353 Description 9354 9355 wcpcpy() is the wide-character equivalent of stpcpy(). It 9356 copies the wide character string src, including the 9357 terminating L'\0' character, to the array dest. 9358 9359 The strings may not overlap. 9360 9361 The programmer shall ensure that there is room for at least 9362 wcslen()(src)+1 wide characters at dest. 9363 9364 Return Value 9365 9366 wcpcpy() returns a pointer to the end of the wide-character 9367 string dest, that is, a pointer to the terminating L'\0' 9368 character. 9369 9370 wcpncpy 9371 9372 Name 9373 9374 wcpncpy -- copy a fixed-size string of wide characters, 9375 returning a pointer to its end 9376 9377 Synopsis 9378 9379 #include 9380 9381 wchar_t * wcpncpy(wchar_t * dest, const wchar_t * src, size_t 9382 n); 9383 9384 Description 9385 9386 wcpncpy() is the wide-character equivalent of stpncpy(). It 9387 copies at most n wide characters from the wide-character 9388 string src, including the terminating L'\0' character, to the 9389 array dest. Exactly n wide characters are written at dest. If 9390 the length wcslen()(src) is smaller than n, the remaining wide 9391 characters in the array dest are filled with L'\0' characters. 9392 If the length wcslen()(src) is greater than or equal to n, the 9393 string dest will not be L'\0' terminated. 9394 9395 The strings may not overlap. 9396 9397 The programmer shall ensure that there is room for at least n 9398 wide characters at dest. 9399 9400 Return Value 9401 9402 wcpncpy() returns a pointer to the wide character one past the 9403 last non-null wide character written. 9404 9405 wcscasecmp 9406 9407 Name 9408 9409 wcscasecmp -- compare two wide-character strings, ignoring 9410 case 9411 9412 Synopsis 9413 9414 #include 9415 9416 int wcscasecmp(const wchar_t * s1, const wchar_t * s2); 9417 9418 Description 9419 9420 wcscasecmp() is the wide-character equivalent of strcasecmp(). 9421 It compares the wide-character string s1 and the 9422 wide-character string s2, ignoring case differences (towupper, 9423 towlower). 9424 9425 Return Value 9426 9427 wcscasecmp() returns 0 if the wide-character strings s1 and s2 9428 are equal except for case distinctions. It returns a positive 9429 integer if s1 is greater than s2, ignoring case. It returns a 9430 negative integer if s1 is smaller than s2, ignoring case. 9431 9432 Notes 9433 9434 The behavior of wcscasecmp() depends upon the LC_CTYPE 9435 category of the current locale. 9436 9437 wcsdup 9438 9439 Name 9440 9441 wcsdup -- duplicate a wide-character string 9442 9443 Synopsis 9444 9445 #include 9446 9447 wchar_t * wcsdup(const wchar_t * s); 9448 9449 Description 9450 9451 wcsdup() is the wide-character equivalent of strdup(). It 9452 allocates and returns a new wide-character string whose 9453 initial contents is a duplicate of the wide-character string 9454 s. 9455 9456 Memory for the new wide-character string is obtained with 9457 malloc(), and can be freed with free(). 9458 9459 Return Value 9460 9461 wcsdup() returns a pointer to the new wide-character string, 9462 or NULL if sufficient memory was not available. 9463 9464 wcsncasecmp 9465 9466 Name 9467 9468 wcsncasecmp -- compare two fixed-size wide-character strings, 9469 ignoring case 9470 9471 Synopsis 9472 9473 #include 9474 9475 int wcsncasecmp(const wchar_t * s1, const wchar_t * s2, size_t 9476 n); 9477 9478 Description 9479 9480 wcsncasecmp() is the wide-character equivalent of 9481 strncasecmp(). It compares the wide-character string s1 and 9482 the wide-character string s2, but at most n wide characters 9483 from each string, ignoring case differences (towupper, 9484 towlower). 9485 9486 Return Value 9487 9488 wcscasecmp() returns 0 if the wide-character strings s1 and 9489 s2, truncated to at most length n, are equal except for case 9490 distinctions. It returns a positive integer if truncated s1 is 9491 greater than truncated s2, ignoring case. It returns a 9492 negative integer if truncated s1 is smaller than truncated s2, 9493 ignoring case. 9494 9495 Notes 9496 9497 The behavior of wcsncasecmp() depends upon the LC_CTYPE 9498 category of the current locale. 9499 9500 wcsnlen 9501 9502 Name 9503 9504 wcsnlen -- determine the length of a fixed-size wide-character 9505 string 9506 9507 Synopsis 9508 9509 #include 9510 9511 size_t wcsnlen(const wchar_t * s, size_t maxlen); 9512 9513 Description 9514 9515 wcsnlen() is the wide-character equivalent of strnlen(). It 9516 returns the number of wide-characters in the string s, not 9517 including the terminating L'\0' character, but at most maxlen. 9518 In doing this, wcsnlen() looks only at the first maxlen 9519 wide-characters at s and never beyond s + maxlen. 9520 9521 Return Value 9522 9523 wcsnlen() returns wcslen()(s) if that is less than maxlen, or 9524 maxlen if there is no L'\0' character among the first maxlen 9525 wide characters pointed to by s. 9526 9527 Notes 9528 9529 The behavior of wcsncasecmp() depends on the LC_CTYPE category 9530 of the current locale. 9531 9532 wcsnrtombs 9533 9534 Name 9535 9536 wcsnrtombs -- convert a wide character string to a multi-byte 9537 string 9538 9539 Synopsis 9540 9541 #include 9542 9543 size_t wcsnrtombs(char * dest, const wchar_t * * src, size_t 9544 nwc, size_t len, mbstate_t * ps); 9545 9546 Description 9547 9548 wcsnrtombs() is like wcsrtombs(), except that the number of 9549 wide characters to be converted, starting at src, is limited 9550 to nwc. 9551 9552 If dest is not a NULL pointer, wcsnrtombs() converts at most 9553 nwc wide characters from the wide-character string src to a 9554 multibyte string starting at dest. At most len bytes are 9555 written to dest. The state ps is updated. 9556 9557 The conversion is effectively performed by repeatedly calling: 9558 wcrtomb(dest, *src, ps) 9559 9560 as long as this call succeeds, and then incrementing dest by 9561 the number of bytes written and src by 1. 9562 9563 The conversion can stop for three reasons: 9564 9565 * A wide character has been encountered that cannot be 9566 represented as a multibyte sequence (according to the 9567 current locale). In this case src is left pointing to the 9568 invalid wide character, (size_t)(-1) is returned, and 9569 errno is set to EILSEQ. 9570 * nws wide characters have been converted without 9571 encountering a L'\0', or the length limit forces a stop. 9572 In this case, src is left pointing to the next wide 9573 character to be converted, and the number bytes written to 9574 dest is returned. 9575 * The wide-character string has been completely converted, 9576 including the terminating L'\0' (which has the side effect 9577 of bringing back ps to the initial state). In this case, 9578 src is set to NULL, and the number of bytes written to 9579 dest, excluding the terminating L'\0' byte, is returned. 9580 9581 If dest is NULL, len is ignored, and the conversion proceeds 9582 as above, except that the converted bytes are not written out 9583 to memory, and that no destination length limit exists. 9584 9585 In both of the above cases, if ps is a NULL pointer, a static 9586 anonymous state only known to wcsnrtombs() is used instead. 9587 9588 The programmer shall ensure that there is room for at least 9589 len bytes at dest. 9590 9591 Return Value 9592 9593 wcsnrtombs() returns the number of bytes that make up the 9594 converted part of multibyte sequence, not including the 9595 terminating L'\0' byte. If a wide character was encountered 9596 which could not be converted, (size_t)(-1) is returned, and 9597 the global variable errno set to EILSEQ. 9598 9599 Notes 9600 9601 The behavior of wcsnrtombs() depends on the LC_CTYPE category 9602 of the current locale. 9603 9604 Passing NULL as ps is not multi-thread safe. 9605 9606 wcstoq 9607 9608 Name 9609 9610 wcstoq -- convert wide string to long long int representation 9611 9612 Synopsis 9613 9614 #include 9615 9616 long long int wcstoq(const wchar_t * restrict nptr, wchar_t ** 9617 restrict endptr, int base); 9618 9619 Description 9620 9621 The wcstoq() function shall convert the initial portion of the 9622 wide string nptr to long long int representation. It is 9623 identical to wcstoll(). 9624 9625 Return Value 9626 9627 Refer to wcstoll(). 9628 9629 Errors 9630 9631 Refer to wcstoll(). 9632 9633 wcstouq 9634 9635 Name 9636 9637 wcstouq -- convert wide string to unsigned long long int 9638 representation 9639 9640 Synopsis 9641 9642 #include 9643 9644 unsigned long long wcstouq(const wchar_t * restrict nptr, 9645 wchar_t ** restrict endptr, int base); 9646 9647 Description 9648 9649 The wcstouq() function shall convert the initial portion of 9650 the wide string nptr to unsigned long long int representation. 9651 It is identical to wcstoull(). 9652 9653 Return Value 9654 9655 Refer to wcstoull(). 9656 9657 Errors 9658 9659 Refer to wcstoull(). 9660 9661 xdr_u_int 9662 9663 Name 9664 9665 xdr_u_int -- library routines for external data representation 9666 9667 Synopsis 9668 9669 int xdr_u_int(XDR * xdrs, unsigned int * up); 9670 9671 Description 9672 9673 xdr_u_int() is a filter primitive that translates between C 9674 unsigned integers and their external representations. 9675 9676 Return Value 9677 9678 On success, 1 is returned. On error, 0 is returned. 9679 _________________________________________________________ 9680 9681 7.6. Interfaces for libm 9682 9683 Table 7-35 defines the library name and shared object name for 9684 the libm library 9685 9686 Table 7-35. libm Definition 9687 Library: libm 9688 SONAME: See archLSB. 9689 9690 The behavior of the interfaces in this library is specified by 9691 the following specifications: 9692 9693 ISO C (1999) 9694 this specification 9695 SUSv2 9696 ISO POSIX (2003) 9697 _________________________________________________________ 9698 9699 7.6.1. Math 9700 _________________________________________________________ 9701 9702 7.6.1.1. Interfaces for Math 9703 9704 An LSB conforming implementation shall provide the generic 9705 functions for Math specified in Table 7-36, with the full 9706 functionality as described in the referenced underlying 9707 specification. 9708 9709 Table 7-36. libm - Math Function Interfaces 9710 __finite [1] ccosl [2] exp [2] j1l [1] powf [2] 9711 __finitef [1] ceil [2] exp2 [2] jn [2] powl [2] 9712 __finitel [1] ceilf [2] exp2f [2] jnf [1] remainder [2] 9713 __fpclassify [3] ceill [2] expf [2] jnl [1] remainderf [2] 9714 __fpclassifyf [3] cexp [2] expl [2] ldexp [2] remainderl [2] 9715 __signbit [1] cexpf [2] expm1 [2] ldexpf [2] remquo [2] 9716 __signbitf [1] cexpl [2] expm1f [2] ldexpl [2] remquof [2] 9717 acos [2] cimag [2] expm1l [2] lgamma [2] remquol [2] 9718 acosf [2] cimagf [2] fabs [2] lgamma_r [1] rint [2] 9719 acosh [2] cimagl [2] fabsf [2] lgammaf [2] rintf [2] 9720 acoshf [2] clog [2] fabsl [2] lgammaf_r [1] rintl [2] 9721 acoshl [2] clog10 [1] fdim [2] lgammal [2] round [2] 9722 acosl [2] clog10f [1] fdimf [2] lgammal_r [1] roundf [2] 9723 asin [2] clog10l [1] fdiml [2] llrint [2] roundl [2] 9724 asinf [2] clogf [2] feclearexcept [2] llrintf [2] scalb [2] 9725 asinh [2] clogl [2] fegetenv [2] llrintl [2] scalbf [1] 9726 asinhf [2] conj [2] fegetexceptflag [2] llround [2] scalbl [1] 9727 asinhl [2] conjf [2] fegetround [2] llroundf [2] scalbln [2] 9728 asinl [2] conjl [2] feholdexcept [2] llroundl [2] scalblnf [2] 9729 atan [2] copysign [2] feraiseexcept [2] log [2] scalblnl [2] 9730 atan2 [2] copysignf [2] fesetenv [2] log10 [2] scalbn [2] 9731 atan2f [2] copysignl [2] fesetexceptflag [2] log10f [2] 9732 scalbnf [2] 9733 atan2l [2] cos [2] fesetround [2] log10l [2] scalbnl [2] 9734 atanf [2] cosf [2] fetestexcept [2] log1p [2] significand [1] 9735 atanh [2] cosh [2] feupdateenv [2] log1pf [2] significandf [1] 9736 atanhf [2] coshf [2] finite [4] log1pl [2] significandl [1] 9737 atanhl [2] coshl [2] finitef [1] log2 [2] sin [2] 9738 atanl [2] cosl [2] finitel [1] log2f [2] sincos [1] 9739 cabs [2] cpow [2] floor [2] log2l [2] sincosf [1] 9740 cabsf [2] cpowf [2] floorf [2] logb [2] sincosl [1] 9741 cabsl [2] cpowl [2] floorl [2] logbf [2] sinf [2] 9742 cacos [2] cproj [2] fma [2] logbl [2] sinh [2] 9743 cacosf [2] cprojf [2] fmaf [2] logf [2] sinhf [2] 9744 cacosh [2] cprojl [2] fmal [2] logl [2] sinhl [2] 9745 cacoshf [2] creal [2] fmax [2] lrint [2] sinl [2] 9746 cacoshl [2] crealf [2] fmaxf [2] lrintf [2] sqrt [2] 9747 cacosl [2] creall [2] fmaxl [2] lrintl [2] sqrtf [2] 9748 carg [2] csin [2] fmin [2] lround [2] sqrtl [2] 9749 cargf [2] csinf [2] fminf [2] lroundf [2] tan [2] 9750 cargl [2] csinh [2] fminl [2] lroundl [2] tanf [2] 9751 casin [2] csinhf [2] fmod [2] matherr [1] tanh [2] 9752 casinf [2] csinhl [2] fmodf [2] modf [2] tanhf [2] 9753 casinh [2] csinl [2] fmodl [2] modff [2] tanhl [2] 9754 casinhf [2] csqrt [2] frexp [2] modfl [2] tanl [2] 9755 casinhl [2] csqrtf [2] frexpf [2] nan [2] tgamma [2] 9756 casinl [2] csqrtl [2] frexpl [2] nanf [2] tgammaf [2] 9757 catan [2] ctan [2] gamma [4] nanl [2] tgammal [2] 9758 catanf [2] ctanf [2] gammaf [1] nearbyint [2] trunc [2] 9759 catanh [2] ctanh [2] gammal [1] nearbyintf [2] truncf [2] 9760 catanhf [2] ctanhf [2] hypot [2] nearbyintl [2] truncl [2] 9761 catanhl [2] ctanhl [2] hypotf [2] nextafter [2] y0 [2] 9762 catanl [2] ctanl [2] hypotl [2] nextafterf [2] y0f [1] 9763 cbrt [2] dremf [1] ilogb [2] nextafterl [2] y0l [1] 9764 cbrtf [2] dreml [1] ilogbf [2] nexttoward [2] y1 [2] 9765 cbrtl [2] erf [2] ilogbl [2] nexttowardf [2] y1f [1] 9766 ccos [2] erfc [2] j0 [2] nexttowardl [2] y1l [1] 9767 ccosf [2] erfcf [2] j0f [1] pow [2] yn [2] 9768 ccosh [2] erfcl [2] j0l [1] pow10 [1] ynf [1] 9769 ccoshf [2] erff [2] j1 [2] pow10f [1] ynl [1] 9770 ccoshl [2] erfl [2] j1f [1] pow10l [1] 9771 9772 Referenced Specification(s) 9773 9774 [1]. ISO C (1999) 9775 9776 [2]. ISO POSIX (2003) 9777 9778 [3]. this specification 9779 9780 [4]. SUSv2 9781 9782 An LSB conforming implementation shall provide the generic 9783 data interfaces for Math specified in Table 7-37, with the 9784 full functionality as described in the referenced underlying 9785 specification. 9786 9787 Table 7-37. libm - Math Data Interfaces 9788 signgam [1] 9789 9790 Referenced Specification(s) 9791 9792 [1]. ISO POSIX (2003) 9793 _________________________________________________________ 9794 9795 7.7. Data Definitions for libm 9796 9797 This section defines global identifiers and their values that 9798 are associated with interfaces contained in libm. These 9799 definitions are organized into groups that correspond to 9800 system headers. This convention is used as a convenience for 9801 the reader, and does not imply the existence of these headers, 9802 or their content. 9803 9804 These definitions are intended to supplement those provided in 9805 the referenced underlying specifications. 9806 9807 This specification uses ISO/IEC 9899 C Language as the 9808 reference programming language, and data definitions are 9809 specified in ISO C format. The C language is used here as a 9810 convenient notation. Using a C language description of these 9811 data objects does not preclude their use by other programming 9812 languages. 9813 _________________________________________________________ 9814 9815 7.7.1. complex.h 9816 9817 #define complex _Complex 9818 _________________________________________________________ 9819 9820 7.7.2. math.h 9821 9822 #define DOMAIN 1 9823 #define SING 2 9824 9825 struct exception 9826 { 9827 int type; 9828 char *name; 9829 double arg1; 9830 double arg2; 9831 double retval; 9832 } 9833 ; 9834 #define FP_NAN 0 9835 #define FP_INFINITE 1 9836 #define FP_ZERO 2 9837 #define FP_SUBNORMAL 3 9838 #define FP_NORMAL 4 9839 9840 #define isnormal(x) (fpclassify (x) == FP_NORMAL) 9841 #define isfinite(x) (sizeof (x) == sizeof (float) ? __finitef (x) : 9842 sizeof (x) == sizeof (double)? __finite (x) : __finitel (x)) 9843 #define isinf(x) (sizeof (x) == sizeof (float) ? __isinff (x): s 9844 izeof (x) == sizeof (double) ? __isinf (x) : __isinfl (x)) 9845 #define isnan(x) (sizeof (x) == sizeof (float) ? __isnanf (x) : 9846 sizeof (x) == sizeof (double) ? __isnan (x) : __isnanl (x)) 9847 9848 #define HUGE_VAL 0x1.0p2047 9849 #define HUGE_VALF 0x1.0p255f 9850 #define HUGE_VALL 0x1.0p32767L 9851 9852 #define NAN ((float)0x7fc00000UL) 9853 #define M_1_PI 0.31830988618379067154 9854 #define M_LOG10E 0.43429448190325182765 9855 #define M_2_PI 0.63661977236758134308 9856 #define M_LN2 0.69314718055994530942 9857 #define M_SQRT1_2 0.70710678118654752440 9858 #define M_PI_4 0.78539816339744830962 9859 #define M_2_SQRTPI 1.12837916709551257390 9860 #define M_SQRT2 1.41421356237309504880 9861 #define M_LOG2E 1.4426950408889634074 9862 #define M_PI_2 1.57079632679489661923 9863 #define M_LN10 2.30258509299404568402 9864 #define M_E 2.7182818284590452354 9865 #define M_PI 3.14159265358979323846 9866 #define INFINITY HUGE_VALF 9867 9868 #define MATH_ERRNO 1 9869 #define MATH_ERREXCEPT 2 9870 9871 #define isunordered(u, v) (__extension__({ __typeof__(u) __u = (u 9872 ); __typeof__(v) __v = (v);fpclassify (__u) == FP_NAN || fpclassify (__ 9873 v) == FP_NAN; })) 9874 #define islessgreater(x, y) (__extension__({ __typeof__(x) __x = (x 9875 ); __typeof__(y) __y = (y);!isunordered (__x, __y) & & (__x < __y || __ 9876 y < __x); })) 9877 #define isless(x,y) (__extension__({ __typeof__(x) __x = (x); __typ 9878 eof__(y) __y = (y);!isunordered (__x, __y) & & __x < __y; })) 9879 #define islessequal(x, y) (__extension__({ __typeof__(x) __x = (x 9880 ); __typeof__(y) __y = (y);!isunordered (__x, __y) & & __x <= __y; })) 9881 #define isgreater(x,y) (__extension__({ __typeof__(x) __x = (x); __typ 9882 eof__(y) __y = (y);!isunordered (__x, __y) & & __x > __y; })) 9883 #define isgreaterequal(x,y) (__extension__({ __typeof__(x) __x = (x 9884 ); __typeof__(y) __y = (y);!isunordered (__x, __y) & & __x >= __y; })) 9885 _________________________________________________________ 9886 9887 7.8. Interface Definitions for libm 9888 9889 Table of Contents 9890 __fpclassify -- Classify real floating type 9891 __fpclassifyf -- Classify real floating type 9892 9893 The following interfaces are included in libm and are defined 9894 by this specification. Unless otherwise noted, these 9895 interfaces shall be included in the source standard. 9896 9897 Other interfaces listed above for libm shall behave as 9898 described in the referenced base document. 9899 9900 __fpclassify 9901 9902 Name 9903 9904 __fpclassify -- Classify real floating type 9905 9906 Synopsis 9907 9908 int __fpclassify(double arg); 9909 9910 Description 9911 9912 __fpclassify() has the same specification as fpclassify() in 9913 ISO POSIX (2003), except that the argument type for 9914 __fpclassify() is known to be double. 9915 9916 __fpclassify() is not in the source standard; it is only in 9917 the binary standard. 9918 9919 __fpclassifyf 9920 9921 Name 9922 9923 __fpclassifyf -- Classify real floating type 9924 9925 Synopsis 9926 9927 int __fpclassifyf(float arg); 9928 9929 Description 9930 9931 __fpclassifyf() has the same specification as fpclassifyf() in 9932 ISO POSIX (2003), except that the argument type for 9933 __fpclassifyf() is known to be float. 9934 9935 __fpclassifyf() is not in the source standard; it is only in 9936 the binary standard. 9937 _________________________________________________________ 9938 9939 7.9. Interfaces for libpthread 9940 9941 Table 7-38 defines the library name and shared object name for 9942 the libpthread library 9943 9944 Table 7-38. libpthread Definition 9945 Library: libpthread 9946 SONAME: libpthread.so.0 9947 9948 The behavior of the interfaces in this library is specified by 9949 the following specifications: 9950 9951 Large File Support 9952 this specification 9953 ISO POSIX (2003) 9954 _________________________________________________________ 9955 9956 7.9.1. Realtime Threads 9957 _________________________________________________________ 9958 9959 7.9.1.1. Interfaces for Realtime Threads 9960 9961 No external functions are defined for libpthread - Realtime 9962 Threads 9963 _________________________________________________________ 9964 9965 7.9.2. Advanced Realtime Threads 9966 _________________________________________________________ 9967 9968 7.9.2.1. Interfaces for Advanced Realtime Threads 9969 9970 No external functions are defined for libpthread - Advanced 9971 Realtime Threads 9972 _________________________________________________________ 9973 9974 7.9.3. Posix Threads 9975 _________________________________________________________ 9976 9977 7.9.3.1. Interfaces for Posix Threads 9978 9979 An LSB conforming implementation shall provide the generic 9980 functions for Posix Threads specified in Table 7-39, with the 9981 full functionality as described in the referenced underlying 9982 specification. 9983 9984 Table 7-39. libpthread - Posix Threads Function Interfaces 9985 _pthread_cleanup_pop [1] pthread_attr_setstacksize [2] 9986 pthread_getspecific [2] pthread_rwlock_destroy [2] 9987 pthread_setspecific [2] 9988 _pthread_cleanup_push [1] pthread_cancel [2] pthread_join [2] 9989 pthread_rwlock_init [2] pthread_sigmask [2] 9990 pread [2] pthread_cond_broadcast [2] pthread_key_create [2] 9991 pthread_rwlock_rdlock [2] pthread_testcancel [2] 9992 pread64 [3] pthread_cond_destroy [2] pthread_key_delete [2] 9993 pthread_rwlock_timedrdlock [2] pwrite [2] 9994 pthread_attr_destroy [2] pthread_cond_init [2] pthread_kill 9995 [2] pthread_rwlock_timedwrlock [2] pwrite64 [3] 9996 pthread_attr_getdetachstate [2] pthread_cond_signal [2] 9997 pthread_mutex_destroy [2] pthread_rwlock_tryrdlock [2] 9998 sem_close [2] 9999 pthread_attr_getguardsize [2] pthread_cond_timedwait [2] 10000 pthread_mutex_init [2] pthread_rwlock_trywrlock [2] 10001 sem_destroy [2] 10002 pthread_attr_getschedparam [2] pthread_cond_wait [2] 10003 pthread_mutex_lock [2] pthread_rwlock_unlock [2] sem_getvalue 10004 [2] 10005 pthread_attr_getstack [2] pthread_condattr_destroy [2] 10006 pthread_mutex_trylock [2] pthread_rwlock_wrlock [2] sem_init 10007 [2] 10008 pthread_attr_getstackaddr [2] pthread_condattr_getpshared [2] 10009 pthread_mutex_unlock [2] pthread_rwlockattr_destroy [2] 10010 sem_open [2] 10011 pthread_attr_getstacksize [2] pthread_condattr_init [2] 10012 pthread_mutexattr_destroy [2] pthread_rwlockattr_getpshared 10013 [2] sem_post [2] 10014 pthread_attr_init [2] pthread_condattr_setpshared [2] 10015 pthread_mutexattr_getpshared [2] pthread_rwlockattr_init [2] 10016 sem_timedwait [2] 10017 pthread_attr_setdetachstate [2] pthread_create [2] 10018 pthread_mutexattr_gettype [2] pthread_rwlockattr_setpshared 10019 [2] sem_trywait [2] 10020 pthread_attr_setguardsize [2] pthread_detach [2] 10021 pthread_mutexattr_init [2] pthread_self [2] sem_unlink [2] 10022 pthread_attr_setschedparam [2] pthread_equal [2] 10023 pthread_mutexattr_setpshared [2] pthread_setcancelstate [2] 10024 sem_wait [2] 10025 pthread_attr_setstack [2] pthread_exit [2] 10026 pthread_mutexattr_settype [2] pthread_setcanceltype [2] 10027 pthread_attr_setstackaddr [2] pthread_getconcurrency [2] 10028 pthread_once [2] pthread_setconcurrency [2] 10029 10030 Referenced Specification(s) 10031 10032 [1]. this specification 10033 10034 [2]. ISO POSIX (2003) 10035 10036 [3]. Large File Support 10037 _________________________________________________________ 10038 10039 7.10. Data Definitions for libpthread 10040 10041 This section defines global identifiers and their values that 10042 are associated with interfaces contained in libpthread. These 10043 definitions are organized into groups that correspond to 10044 system headers. This convention is used as a convenience for 10045 the reader, and does not imply the existence of these headers, 10046 or their content. 10047 10048 These definitions are intended to supplement those provided in 10049 the referenced underlying specifications. 10050 10051 This specification uses ISO/IEC 9899 C Language as the 10052 reference programming language, and data definitions are 10053 specified in ISO C format. The C language is used here as a 10054 convenient notation. Using a C language description of these 10055 data objects does not preclude their use by other programming 10056 languages. 10057 _________________________________________________________ 10058 10059 7.10.1. pthread.h 10060 10061 #define PTHREAD_MUTEX_DEFAULT 1 10062 #define PTHREAD_MUTEX_NORMAL 1 10063 #define PTHREAD_MUTEX_RECURSIVE 2 10064 #define PTHREAD_RWLOCK_DEFAULT_NP 2 10065 #define PTHREAD_MUTEX_ERRORCHECK 3 10066 #define pthread_cleanup_pop(execute) _pthread_cleanup_pop(& _buffer, 10067 (execute));} 10068 #define __LOCK_INITIALIZER { 0, 0 } 10069 #define PTHREAD_RWLOCK_INITIALIZER { __LOCK_INITIALIZER, 0, NULL, 10070 NULL, NULL,PTHREAD_RWLOCK_DEFAULT_NP, PTHREAD_PROCESS_PRIVATE } 10071 #define PTHREAD_MUTEX_INITIALIZER {0,0,0,PTHREAD_MUTEX_NORMAL,__L 10072 OCK_INITIALIZER} 10073 #define pthread_cleanup_push(routine,arg) {struct _pthread_cleanu 10074 p_buffer _buffer;_pthread_cleanup_push(& _buffer,(routine),(arg)); 10075 #define PTHREAD_COND_INITIALIZER {__LOCK_INITIALIZER,0} 10076 10077 struct _pthread_cleanup_buffer 10078 { 10079 void (*__routine) (void *); 10080 void *__arg; 10081 int __canceltype; 10082 struct _pthread_cleanup_buffer *__prev; 10083 } 10084 ; 10085 typedef unsigned int pthread_key_t; 10086 typedef int pthread_once_t; 10087 typedef long long __pthread_cond_align_t; 10088 10089 typedef unsigned long pthread_t; 10090 struct _pthread_fastlock 10091 { 10092 long __status; 10093 int __spinlock; 10094 } 10095 ; 10096 10097 typedef struct _pthread_descr_struct *_pthread_descr; 10098 10099 typedef struct 10100 { 10101 int __m_reserved; 10102 int __m_count; 10103 _pthread_descr __m_owner; 10104 int __m_kind; 10105 struct _pthread_fastlock __m_lock; 10106 } 10107 pthread_mutex_t; 10108 typedef struct 10109 { 10110 int __mutexkind; 10111 } 10112 pthread_mutexattr_t; 10113 10114 typedef struct 10115 { 10116 int __detachstate; 10117 int __schedpolicy; 10118 struct sched_param __schedparam; 10119 int __inheritsched; 10120 int __scope; 10121 size_t __guardsize; 10122 int __stackaddr_set; 10123 void *__stackaddr; 10124 unsigned long __stacksize; 10125 } 10126 pthread_attr_t; 10127 10128 typedef struct 10129 { 10130 struct _pthread_fastlock __c_lock; 10131 _pthread_descr __c_waiting; 10132 char __padding[48 - sizeof (struct _pthread_fastlock) - 10133 sizeof (_pthread_descr) - sizeof (__pthread_cond_align 10134 _t)]; 10135 __pthread_cond_align_t __align; 10136 } 10137 pthread_cond_t; 10138 typedef struct 10139 { 10140 int __dummy; 10141 } 10142 pthread_condattr_t; 10143 10144 typedef struct _pthread_rwlock_t 10145 { 10146 struct _pthread_fastlock __rw_lock; 10147 int __rw_readers; 10148 _pthread_descr __rw_writer; 10149 _pthread_descr __rw_read_waiting; 10150 _pthread_descr __rw_write_waiting; 10151 int __rw_kind; 10152 int __rw_pshared; 10153 } 10154 pthread_rwlock_t; 10155 typedef struct 10156 { 10157 int __lockkind; 10158 int __pshared; 10159 } 10160 pthread_rwlockattr_t; 10161 10162 #define PTHREAD_CREATE_JOINABLE 0 10163 #define PTHREAD_INHERIT_SCHED 0 10164 #define PTHREAD_ONCE_INIT 0 10165 #define PTHREAD_PROCESS_PRIVATE 0 10166 #define PTHREAD_CREATE_DETACHED 1 10167 #define PTHREAD_EXPLICIT_SCHED 1 10168 #define PTHREAD_PROCESS_SHARED 1 10169 10170 #define PTHREAD_CANCELED ((void*)-1) 10171 #define PTHREAD_CANCEL_DEFERRED 0 10172 #define PTHREAD_CANCEL_ENABLE 0 10173 #define PTHREAD_CANCEL_ASYNCHRONOUS 1 10174 #define PTHREAD_CANCEL_DISABLE 1 10175 _________________________________________________________ 10176 10177 7.10.2. semaphore.h 10178 10179 typedef struct 10180 { 10181 struct _pthread_fastlock __sem_lock; 10182 int __sem_value; 10183 _pthread_descr __sem_waiting; 10184 } 10185 sem_t; 10186 #define SEM_FAILED ((sem_t*)0) 10187 10188 #define SEM_VALUE_MAX ((int)((~0u)>>1)) 10189 _________________________________________________________ 10190 10191 7.11. Interface Definitions for libpthread 10192 10193 Table of Contents 10194 _pthread_cleanup_pop -- establish cancellation handlers 10195 _pthread_cleanup_push -- establish cancellation handlers 10196 10197 The following interfaces are included in libpthread and are 10198 defined by this specification. Unless otherwise noted, these 10199 interfaces shall be included in the source standard. 10200 10201 Other interfaces listed above for libpthread shall behave as 10202 described in the referenced base document. 10203 10204 _pthread_cleanup_pop 10205 10206 Name 10207 10208 _pthread_cleanup_pop -- establish cancellation handlers 10209 10210 Synopsis 10211 10212 #include 10213 10214 void _pthread_cleanup_pop(struct _pthread_cleanup_buffer *, 10215 int); 10216 10217 Description 10218 10219 The _pthread_cleanup_pop() function provides an implementation 10220 of the pthread_cleanup_pop() macro described in ISO POSIX 10221 (2003). 10222 10223 The _pthread_cleanup_pop() function is not in the source 10224 standard; it is only in the binary standard. 10225 10226 _pthread_cleanup_push 10227 10228 Name 10229 10230 _pthread_cleanup_push -- establish cancellation handlers 10231 10232 Synopsis 10233 10234 #include 10235 10236 void _pthread_cleanup_push(struct _pthread_cleanup_buffer *, 10237 void (*) (void *), void *); 10238 10239 Description 10240 10241 The _pthread_cleanup_push() function provides an 10242 implementation of the pthread_cleanup_push() macro described 10243 in ISO POSIX (2003). 10244 10245 The _pthread_cleanup_push() function is not in the source 10246 standard; it is only in the binary standard. 10247 _________________________________________________________ 10248 10249 7.12. Interfaces for libgcc_s 10250 10251 Table 7-40 defines the library name and shared object name for 10252 the libgcc_s library 10253 10254 Table 7-40. libgcc_s Definition 10255 Library: libgcc_s 10256 SONAME: libgcc_s.so.1 10257 _________________________________________________________ 10258 10259 7.12.1. Unwind Library 10260 _________________________________________________________ 10261 10262 7.12.1.1. Interfaces for Unwind Library 10263 10264 No external functions are defined for libgcc_s - Unwind 10265 Library 10266 _________________________________________________________ 10267 10268 7.13. Data Definitions for libgcc_s 10269 10270 This section defines global identifiers and their values that 10271 are associated with interfaces contained in libgcc_s. These 10272 definitions are organized into groups that correspond to 10273 system headers. This convention is used as a convenience for 10274 the reader, and does not imply the existence of these headers, 10275 or their content. 10276 10277 These definitions are intended to supplement those provided in 10278 the referenced underlying specifications. 10279 10280 This specification uses ISO/IEC 9899 C Language as the 10281 reference programming language, and data definitions are 10282 specified in ISO C format. The C language is used here as a 10283 convenient notation. Using a C language description of these 10284 data objects does not preclude their use by other programming 10285 languages. 10286 _________________________________________________________ 10287 10288 7.13.1. unwind.h 10289 10290 struct dwarf_eh_base 10291 { 10292 void *tbase; 10293 void *dbase; 10294 void *func; 10295 } 10296 ; 10297 struct _Unwind_Context; 10298 10299 typedef unsigned int _Unwind_Ptr; 10300 typedef unsigned int _Unwind_Word; 10301 10302 typedef enum 10303 { 10304 _URC_NO_REASON, _URC_FOREIGN_EXCEPTION_CAUGHT = 1, _URC_FATAL_PHASE2_ 10305 ERROR = 10306 2, _URC_FATAL_PHASE1_ERROR = 3, _URC_NORMAL_STOP = 4, _URC_END_OF_S 10307 TACK = 10308 5, _URC_HANDLER_FOUND = 6, _URC_INSTALL_CONTEXT = 10309 7, _URC_CONTINUE_UNWIND = 8 10310 } 10311 _Unwind_Reason_Code; 10312 10313 struct _Unwind_Exception 10314 { 10315 _Unwind_Exception_Class; 10316 _Unwind_Exception_Cleanup_Fn; 10317 _Unwind_Word; 10318 _Unwind_Word; 10319 } 10320 ; 10321 #define _UA_SEARCH_PHASE 1 10322 #define _UA_END_OF_STACK 16 10323 #define _UA_CLEANUP_PHASE 2 10324 #define _UA_HANDLER_FRAME 4 10325 #define _UA_FORCE_UNWIND 8 10326 _________________________________________________________ 10327 10328 7.14. Interfaces for libdl 10329 10330 Table 7-41 defines the library name and shared object name for 10331 the libdl library 10332 10333 Table 7-41. libdl Definition 10334 Library: libdl 10335 SONAME: libdl.so.2 10336 10337 The behavior of the interfaces in this library is specified by 10338 the following specifications: 10339 10340 this specification 10341 ISO POSIX (2003) 10342 _________________________________________________________ 10343 10344 7.14.1. Dynamic Loader 10345 _________________________________________________________ 10346 10347 7.14.1.1. Interfaces for Dynamic Loader 10348 10349 An LSB conforming implementation shall provide the generic 10350 functions for Dynamic Loader specified in Table 7-42, with the 10351 full functionality as described in the referenced underlying 10352 specification. 10353 10354 Table 7-42. libdl - Dynamic Loader Function Interfaces 10355 dladdr [1] dlclose [2] dlerror [2] dlopen [1] dlsym [1] 10356 10357 Referenced Specification(s) 10358 10359 [1]. this specification 10360 10361 [2]. ISO POSIX (2003) 10362 _________________________________________________________ 10363 10364 7.15. Data Definitions for libdl 10365 10366 This section defines global identifiers and their values that 10367 are associated with interfaces contained in libdl. These 10368 definitions are organized into groups that correspond to 10369 system headers. This convention is used as a convenience for 10370 the reader, and does not imply the existence of these headers, 10371 or their content. 10372 10373 These definitions are intended to supplement those provided in 10374 the referenced underlying specifications. 10375 10376 This specification uses ISO/IEC 9899 C Language as the 10377 reference programming language, and data definitions are 10378 specified in ISO C format. The C language is used here as a 10379 convenient notation. Using a C language description of these 10380 data objects does not preclude their use by other programming 10381 languages. 10382 _________________________________________________________ 10383 10384 7.15.1. dlfcn.h 10385 10386 #define RTLD_NEXT ((void *) -1l) 10387 #define RTLD_LOCAL 0 10388 #define RTLD_LAZY 0x00001 10389 #define RTLD_NOW 0x00002 10390 #define RTLD_GLOBAL 0x00100 10391 10392 typedef struct 10393 { 10394 char *dli_fname; 10395 void *dli_fbase; 10396 char *dli_sname; 10397 void *dli_saddr; 10398 } 10399 Dl_info; 10400 _________________________________________________________ 10401 10402 7.16. Interface Definitions for libdl 10403 10404 Table of Contents 10405 dladdr -- find the shared object containing a given address 10406 dlopen -- open dynamic object 10407 dlsym -- obtain the address of a symbol from a dlopen object 10408 10409 The following interfaces are included in libdl and are defined 10410 by this specification. Unless otherwise noted, these 10411 interfaces shall be included in the source standard. 10412 10413 Other interfaces listed above for libdl shall behave as 10414 described in the referenced base document. 10415 10416 dladdr 10417 10418 Name 10419 10420 dladdr -- find the shared object containing a given address 10421 10422 Synopsis 10423 10424 #include 10425 10426 typedef struct { 10427 const char *dli_fname; 10428 void *dli_fbase; 10429 const char *dli_sname; 10430 void *dli_saddr; 10431 } Dl_info; 10432 10433 int dladdr(const void * addr, Dl_info * dlip); 10434 10435 Description 10436 10437 The dladdr() function shall query the dynamic linker for 10438 information about the shared object containing the address 10439 addr. The information shall be returned in the user supplied 10440 data structure referenced by dlip. 10441 10442 The structure shall contain at least the following members: 10443 10444 dli_fname 10445 The pathname of the shared object containing the 10446 address 10447 10448 dli_fbase 10449 The base address at which the shared object is mapped 10450 into the address space of the calling process. 10451 10452 dli_sname 10453 The name of the nearest runtime symbol with value less 10454 than or equal to addr. Where possible, the symbol name 10455 shall be returned as it would appear in C source code. 10456 10457 If no symbol with a suitable value is found, both this 10458 field and dli_saddr shall be set to NULL. 10459 10460 dli_saddr 10461 The address of the symbol returned in dli_sname. 10462 10463 The behavior of dladdr() is only specified in dynamically 10464 linked programs. 10465 10466 Return Value 10467 10468 On success, dladdr() shall return non-zero, and the structure 10469 referenced by dlip shall be filled in as described. Otherwise, 10470 dladdr() shall return zero, and the cause of the error can be 10471 fetched with dlerr(). 10472 10473 Errors 10474 10475 See dlerr(). 10476 10477 Environment 10478 10479 LD_LIBRARY_PATH 10480 directory search-path for object files 10481 10482 dlopen 10483 10484 Name 10485 10486 dlopen -- open dynamic object 10487 10488 Synopsis 10489 10490 #include 10491 10492 void * dlopen(const char * filename, int flag); 10493 10494 Description 10495 10496 dlopen shall behave as specified in ISO POSIX (2003), but with 10497 additional behaviors listed below. 10498 10499 If the file argument does not contain a slash character, then 10500 the system shall look for a library of that name in at least 10501 the following directories, and use the first one which is 10502 found: 10503 10504 * The directories specified by the DT_RPATH dynamic entry. 10505 * The directories specified in the LD_LIBRARY_PATH 10506 environment variable (which is a colon separated list of 10507 pathnames). This step shall be skipped for setuid and 10508 setgid executables. 10509 * A set of directories sufficient to contain the libraries 10510 specified in this standard. 10511 10512 Note: Traditionally, /lib and /usr/lib. This case would 10513 also cover cases in which the system used the mechanism of 10514 /etc/ld.so.conf and /etc/ld.so.cache to provide access. 10515 Example: An application which is not linked against libm 10516 may choose to dlopen libm. 10517 10518 dlsym 10519 10520 Name 10521 10522 dlsym -- obtain the address of a symbol from a dlopen object 10523 10524 Description 10525 10526 dlsym() is as specified in the ISO POSIX (2003), but with 10527 differences as listed below. 10528 10529 The special purpose value for handle RTLD_NEXT 10530 10531 The value RTLD_NEXT, which is reserved for future use shall be 10532 available, with the behavior as described in ISO POSIX (2003). 10533 _________________________________________________________ 10534 10535 7.17. Interfaces for libcrypt 10536 10537 Table 7-43 defines the library name and shared object name for 10538 the libcrypt library 10539 10540 Table 7-43. libcrypt Definition 10541 Library: libcrypt 10542 SONAME: libcrypt.so.1 10543 10544 The behavior of the interfaces in this library is specified by 10545 the following specifications: 10546 10547 ISO POSIX (2003) 10548 _________________________________________________________ 10549 10550 7.17.1. Encryption 10551 _________________________________________________________ 10552 10553 7.17.1.1. Interfaces for Encryption 10554 10555 An LSB conforming implementation shall provide the generic 10556 functions for Encryption specified in Table 7-44, with the 10557 full functionality as described in the referenced underlying 10558 specification. 10559 10560 Table 7-44. libcrypt - Encryption Function Interfaces 10561 crypt [1] encrypt [1] setkey [1] 10562 10563 Referenced Specification(s) 10564 10565 [1]. ISO POSIX (2003) 10566 _________________________________________________________ 10567 10568 7.18. Interfaces for libpam 10569 10570 Table 7-45 defines the library name and shared object name for 10571 the libpam library 10572 10573 Table 7-45. libpam Definition 10574 Library: libpam 10575 SONAME: libpam.so.0 10576 10577 A single service name, other, shall always be present. The 10578 behavior of this service shall be determined by the system 10579 administrator. Additional service names may also exist. [1] 10580 10581 The behavior of the interfaces in this library is specified by 10582 the following specifications: 10583 10584 this specification 10585 _________________________________________________________ 10586 10587 7.18.1. Pluggable Authentication API 10588 _________________________________________________________ 10589 10590 7.18.1.1. Interfaces for Pluggable Authentication API 10591 10592 An LSB conforming implementation shall provide the generic 10593 functions for Pluggable Authentication API specified in Table 10594 7-46, with the full functionality as described in the 10595 referenced underlying specification. 10596 10597 Table 7-46. libpam - Pluggable Authentication API Function 10598 Interfaces 10599 pam_acct_mgmt [1] pam_close_session [1] pam_get_item [1] 10600 pam_set_item [1] pam_strerror [1] 10601 pam_authenticate [1] pam_end [1] pam_getenvlist [1] 10602 pam_setcred [1] 10603 pam_chauthtok [1] pam_fail_delay [1] pam_open_session [1] 10604 pam_start [1] 10605 10606 Referenced Specification(s) 10607 10608 [1]. this specification 10609 _________________________________________________________ 10610 10611 7.19. Data Definitions for libpam 10612 10613 This section defines global identifiers and their values that 10614 are associated with interfaces contained in libpam. These 10615 definitions are organized into groups that correspond to 10616 system headers. This convention is used as a convenience for 10617 the reader, and does not imply the existence of these headers, 10618 or their content. 10619 10620 These definitions are intended to supplement those provided in 10621 the referenced underlying specifications. 10622 10623 This specification uses ISO/IEC 9899 C Language as the 10624 reference programming language, and data definitions are 10625 specified in ISO C format. The C language is used here as a 10626 convenient notation. Using a C language description of these 10627 data objects does not preclude their use by other programming 10628 languages. 10629 _________________________________________________________ 10630 10631 7.19.1. security/pam_appl.h 10632 10633 typedef struct pam_handle pam_handle_t; 10634 struct pam_message 10635 { 10636 int msg_style; 10637 const char *msg; 10638 } 10639 ; 10640 struct pam_response 10641 { 10642 char *resp; 10643 int resp_retcode; 10644 } 10645 ; 10646 10647 struct pam_conv 10648 { 10649 int (*conv) (int num_msg, const struct pam_message * *msg, 10650 struct pam_response * *resp, void *appdata_ptr); 10651 void *appdata_ptr; 10652 } 10653 ; 10654 #define PAM_PROMPT_ECHO_OFF 1 10655 #define PAM_PROMPT_ECHO_ON 2 10656 #define PAM_ERROR_MSG 3 10657 #define PAM_TEXT_INFO 4 10658 10659 #define PAM_SERVICE 1 10660 #define PAM_USER 2 10661 #define PAM_TTY 3 10662 #define PAM_RHOST 4 10663 #define PAM_CONV 5 10664 #define PAM_RUSER 8 10665 #define PAM_USER_PROMPT 9 10666 10667 #define PAM_SUCCESS 0 10668 #define PAM_OPEN_ERR 1 10669 #define PAM_USER_UNKNOWN 10 10670 #define PAM_MAXTRIES 11 10671 #define PAM_NEW_AUTHTOK_REQD 12 10672 #define PAM_ACCT_EXPIRED 13 10673 #define PAM_SESSION_ERR 14 10674 #define PAM_CRED_UNAVAIL 15 10675 #define PAM_CRED_EXPIRED 16 10676 #define PAM_CRED_ERR 17 10677 #define PAM_CONV_ERR 19 10678 #define PAM_SYMBOL_ERR 2 10679 #define PAM_AUTHTOK_ERR 20 10680 #define PAM_AUTHTOK_RECOVER_ERR 21 10681 #define PAM_AUTHTOK_LOCK_BUSY 22 10682 #define PAM_AUTHTOK_DISABLE_AGING 23 10683 #define PAM_TRY_AGAIN 24 10684 #define PAM_ABORT 26 10685 #define PAM_AUTHTOK_EXPIRED 27 10686 #define PAM_BAD_ITEM 29 10687 #define PAM_SERVICE_ERR 3 10688 #define PAM_SYSTEM_ERR 4 10689 #define PAM_BUF_ERR 5 10690 #define PAM_PERM_DENIED 6 10691 #define PAM_AUTH_ERR 7 10692 #define PAM_CRED_INSUFFICIENT 8 10693 #define PAM_AUTHINFO_UNAVAIL 9 10694 10695 #define PAM_DISALLOW_NULL_AUTHTOK 0x0001U 10696 #define PAM_ESTABLISH_CRED 0x0002U 10697 #define PAM_DELETE_CRED 0x0004U 10698 #define PAM_REINITIALIZE_CRED 0x0008U 10699 #define PAM_REFRESH_CRED 0x0010U 10700 #define PAM_CHANGE_EXPIRED_AUTHTOK 0x0020U 10701 #define PAM_SILENT 0x8000U 10702 _________________________________________________________ 10703 10704 7.20. Interface Definitions for libpam 10705 10706 Table of Contents 10707 pam_acct_mgmt -- establish the status of a user's account 10708 pam_authenticate -- authenticate the user 10709 pam_chauthtok -- change the authentication token for a given 10710 user 10711 10712 pam_close_session -- indicate that an authenticated session 10713 has ended 10714 10715 pam_end -- terminate the use of the PAM library 10716 pam_fail_delay -- specify delay time to use on authentication 10717 error 10718 10719 pam_get_item -- obtain the value of the indicated item. 10720 pam_getenvlist -- returns a pointer to the complete PAM 10721 environment. 10722 10723 pam_open_session -- used to indicate that an authenticated 10724 session has been initiated 10725 10726 pam_set_item -- (re)set the value of an item. 10727 pam_setcred -- set the module-specific credentials of the user 10728 pam_start -- initialize the PAM library 10729 pam_strerror -- returns a string describing the PAM error 10730 10731 The following interfaces are included in libpam and are 10732 defined by this specification. Unless otherwise noted, these 10733 interfaces shall be included in the source standard. 10734 10735 Other interfaces listed above for libpam shall behave as 10736 described in the referenced base document. 10737 10738 pam_acct_mgmt 10739 10740 Name 10741 10742 pam_acct_mgmt -- establish the status of a user's account 10743 10744 Synopsis 10745 10746 #include 10747 10748 int pam_acct_mgmt(pam_handle_t * pamh, int flags); 10749 10750 Description 10751 10752 pam_acct_mgmt() establishes the account's usability and the 10753 user's accessibility to the system. It is typically called 10754 after the user has been authenticated. 10755 10756 flags may be specified as any valid flag (namely, one of those 10757 applicable to the flags argument of pam_authenticate()). 10758 Additionally, the value of flags may be logically or'd with 10759 PAM_SILENT. 10760 10761 Return Value 10762 10763 PAM_SUCCESS 10764 Success. 10765 10766 PAM_NEW_AUTHTOK_REQD 10767 User is valid, but user's authentication token has 10768 expired. The correct response to this return-value is 10769 to require that the user satisfy the pam_chauthtok() 10770 function before obtaining service. It may not be 10771 possible for an application to do this. In such a case, 10772 the user should be denied access until the account 10773 password is updated. 10774 10775 PAM_ACCT_EXPIRED 10776 User is no longer permitted access to the system. 10777 10778 PAM_AUTH_ERR 10779 Authentication error. 10780 10781 PAM_PERM_DENIED 10782 User is not permitted to gain access at this time. 10783 10784 PAM_USER_UNKNOWN 10785 User is not known to a module's account management 10786 component. 10787 10788 Errors 10789 10790 May be translated to text with pam_strerror(). 10791 10792 pam_authenticate 10793 10794 Name 10795 10796 pam_authenticate -- authenticate the user 10797 10798 Synopsis 10799 10800 #include 10801 10802 int pam_authenticate(pam_handle_t * pamh, int flags); 10803 10804 Description 10805 10806 pam_authenticate() serves as an interface to the 10807 authentication mechanisms of the loaded modules. 10808 10809 flags is an optional parameter that may be specified by the 10810 following value: 10811 10812 PAM_DISALLOW_NULL_AUTHTOK 10813 Instruct the authentication modules to return 10814 PAM_AUTH_ERR if the user does not have a registered 10815 authorization token. 10816 10817 Additionally, the value of flags may be logically or'd with 10818 PAM_SILENT. 10819 10820 The process may need to be privileged in order to successfully 10821 call this function. 10822 10823 Return Value 10824 10825 PAM_SUCCESS 10826 Success. 10827 10828 PAM_AUTH_ERR 10829 User was not authenticated or process did not have 10830 sufficient privileges to perform authentication. 10831 10832 PAM_CRED_INSUFFICIENT 10833 Application does not have sufficient credentials to 10834 authenticate the user. 10835 10836 PAM_AUTHINFO_UNAVAIL 10837 Modules were not able to access the authentication 10838 information. This might be due to a network or hardware 10839 failure, etc. 10840 10841 PAM_USER_UNKNOWN 10842 Supplied username is not known to the authentication 10843 service. 10844 10845 PAM_MAXTRIES 10846 One or more authentication modules has reached its 10847 limit of tries authenticating the user. Do not try 10848 again. 10849 10850 PAM_ABORT 10851 One or more authentication modules failed to load. 10852 10853 Errors 10854 10855 May be translated to text with pam_strerror(). 10856 10857 pam_chauthtok 10858 10859 Name 10860 10861 pam_chauthtok -- change the authentication token for a given 10862 user 10863 10864 Synopsis 10865 10866 #include 10867 10868 int pam_chauthtok(pam_handle_t * pamh, const int flags); 10869 10870 Description 10871 10872 pam_chauthtok() is used to change the authentication token for 10873 a given user as indicated by the state associated with the 10874 handle pamh. 10875 10876 flags is an optional parameter that may be specified by the 10877 following value: 10878 10879 PAM_CHANGE_EXPIRED_AUTHTOK 10880 User's authentication token should only be changed if 10881 it has expired. 10882 10883 Additionally, the value of flags may be logically or'd with 10884 PAM_SILENT. 10885 10886 RETURN VALUE 10887 10888 PAM_SUCCESS 10889 Success. 10890 10891 PAM_AUTHTOK_ERR 10892 A module was unable to obtain the new authentication 10893 token. 10894 10895 PAM_AUTHTOK_RECOVER_ERR 10896 A module was unable to obtain the old authentication 10897 token. 10898 10899 PAM_AUTHTOK_LOCK_BUSY 10900 One or more modules were unable to change the 10901 authentication token since it is currently locked. 10902 10903 PAM_AUTHTOK_DISABLE_AGING 10904 Authentication token aging has been disabled for at 10905 least one of the modules. 10906 10907 PAM_PERM_DENIED 10908 Permission denied. 10909 10910 PAM_TRY_AGAIN 10911 Not all modules were in a position to update the 10912 authentication token(s). In such a case, none of the 10913 user's authentication tokens are updated. 10914 10915 PAM_USER_UNKNOWN 10916 User is not known to the authentication token changing 10917 service. 10918 10919 ERRORS 10920 10921 May be translated to text with pam_strerror(). 10922 10923 pam_close_session 10924 10925 Name 10926 10927 pam_close_session -- indicate that an authenticated session 10928 has ended 10929 10930 Synopsis 10931 10932 #include 10933 10934 int pam_close_session(pam_handle_t * pamh, int flags); 10935 10936 Description 10937 10938 pam_close_session() is used to indicate that an authenticated 10939 session has ended. It is used to inform the module that the 10940 user is exiting a session. It should be possible for the PAM 10941 library to open a session and close the same session from 10942 different applications. 10943 10944 flags may have the value PAM_SILENT to indicate that no output 10945 should be generated as a result of this function call. 10946 10947 Return Value 10948 10949 PAM_SUCCESS 10950 Success. 10951 10952 PAM_SESSION_ERR 10953 One of the required loaded modules was unable to close 10954 a session for the user. 10955 10956 Errors 10957 10958 May be translated to text with pam_strerror(). 10959 10960 pam_end 10961 10962 Name 10963 10964 pam_end -- terminate the use of the PAM library 10965 10966 Synopsis 10967 10968 #include 10969 10970 int pam_end(pam_handle_t * pamh, int pam_status); 10971 10972 Description 10973 10974 pam_end() terminates use of the PAM library. On success, the 10975 contents of *pamh are no longer valid, and all memory 10976 associated with it is invalid. 10977 10978 Normally, pam_status is passed the value PAM_SUCCESS, but in 10979 the event of an unsuccessful service application, the 10980 appropriate PAM error return value should be used. 10981 10982 Return Value 10983 10984 PAM_SUCCESS 10985 Success. 10986 10987 Errors 10988 10989 May be translated to text with pam_strerror(). 10990 10991 pam_fail_delay 10992 10993 Name 10994 10995 pam_fail_delay -- specify delay time to use on authentication 10996 error 10997 10998 Synopsis 10999 11000 #include 11001 11002 int pam_fail_delay(pam_handle_t * pamh, unsigned int 11003 micro_sec); 11004 11005 Description 11006 11007 pam_fail_delay() specifies the minimum delay for the PAM 11008 library to use when an authentication error occurs. The actual 11009 delay can vary by as much at 25%. If this function is called 11010 multiple times, the longest time specified by any of the call 11011 will be used. 11012 11013 The delay is invoked if an authentication error occurs during 11014 the pam_authenticate() or pam_chauthtok() function calls. 11015 11016 Independent of the success of pam_authenticate() or 11017 pam_chauthtok(), the delay time is reset to its default value 11018 of 0 when the PAM library returns control to the application 11019 from these two functions. 11020 11021 Return Value 11022 11023 PAM_SUCCESS 11024 Success. 11025 11026 Errors 11027 11028 May be translated to text with pam_strerror(). 11029 11030 pam_get_item 11031 11032 Name 11033 11034 pam_get_item -- obtain the value of the indicated item. 11035 11036 Synopsis 11037 11038 #include 11039 11040 int pam_get_item(const pam_handle_t * pamh, int item_type, 11041 const void * * item); 11042 11043 Description 11044 11045 pam_get_item() obtains the value of the indicated item_type. 11046 The possible values of item_type are the same as listed for 11047 pam_set_item(). 11048 11049 On success, item contains a pointer to the value of the 11050 corresponding item. Note that this is a pointer to the actual 11051 data and should not be free()'d or over-written. 11052 11053 Return Value 11054 11055 PAM_SUCCESS 11056 Success. 11057 11058 PAM_PERM_DENIED 11059 Application passed a NULL pointer for item. 11060 11061 PAM_BAD_ITEM 11062 Application attempted to get an undefined item. 11063 11064 Errors 11065 11066 May be translated to text with pam_strerror(). 11067 11068 pam_getenvlist 11069 11070 Name 11071 11072 pam_getenvlist -- returns a pointer to the complete PAM 11073 environment. 11074 11075 Synopsis 11076 11077 #include 11078 11079 char * const * pam_getenvlist(pam_handle_t * pamh); 11080 11081 Description 11082 11083 pam_getenvlist() returns a pointer to the complete PAM 11084 environment. This pointer points to an array of pointers to 11085 NUL-terminated strings and must be terminated by a NULL 11086 pointer. Each string has the form "name=value". 11087 11088 The PAM library module allocates memory for the returned value 11089 and the associated strings. The calling application is 11090 responsible for freeing this memory. 11091 11092 Return Value 11093 11094 pam_getenvlist() returns an array of string pointers 11095 containing the PAM environment. On error, NULL is returned. 11096 11097 pam_open_session 11098 11099 Name 11100 11101 pam_open_session -- used to indicate that an authenticated 11102 session has been initiated 11103 11104 Synopsis 11105 11106 #include 11107 11108 int pam_open_session(pam_handle_t * pamh, int flags); 11109 11110 Description 11111 11112 pam_handle_t() is used to indicate that an authenticated 11113 session has begun. It is used to inform the module that the 11114 user is currently in a session. It should be possible for the 11115 PAM library to open a session and close the same session from 11116 different applications. 11117 11118 flags may have the value PAM_SILENT to indicate that no output 11119 be generated as a rsult of this function call. 11120 11121 Return Value 11122 11123 PAM_SUCCESS 11124 Success. 11125 11126 PAM_SESSION_ERR 11127 One of the loaded modules was unable to open a session 11128 for the user. 11129 11130 ERRORS 11131 11132 May be translated to text with pam_strerror(). 11133 11134 pam_set_item 11135 11136 Name 11137 11138 pam_set_item -- (re)set the value of an item. 11139 11140 Synopsis 11141 11142 #include 11143 11144 int pam_set_item(pam_handle_t * pamh, int item_type, const 11145 void * item); 11146 11147 Description 11148 11149 pam_set_item() (re)sets the value of one of the following 11150 item_types: 11151 11152 PAM_SERVICE 11153 service name 11154 11155 PAM_USER 11156 user name 11157 11158 PAM_TTY 11159 terminal name 11160 11161 The value for a device file should include the /dev/ 11162 prefix. The value for graphical, X-based, applications 11163 should be the $DISPLAY variable. 11164 11165 PAM_RHOST 11166 remote host name 11167 11168 PAM_CONV 11169 conversation structure 11170 11171 PAM_RUSER 11172 remote user name 11173 11174 PAM_USER_PROMPT 11175 string to be used when prompting for a user's name 11176 11177 The default value for this string is Please enter 11178 username: . 11179 11180 For all item_types other than PAM_CONV, item is a pointer to a 11181 NULL-terminated character string. In the case of PAM_CONV, 11182 item points to an initialized pam_conv structure. 11183 11184 Return Value 11185 11186 PAM_SUCCESS 11187 Success. 11188 11189 PAM_PERM_DENIED 11190 An attempt was made to replace the conversation 11191 structure with a NULL value. 11192 11193 PAM_BUF_ERR 11194 Function ran out of memory making a copy of the item. 11195 11196 PAM_BAD_ITEM 11197 Application attempted to set an undefined item. 11198 11199 Errors 11200 11201 May be translated to text with pam_strerror(). 11202 11203 pam_setcred 11204 11205 Name 11206 11207 pam_setcred -- set the module-specific credentials of the user 11208 11209 Synopsis 11210 11211 #include 11212 11213 extern int pam_setcred(pam_handle_t * pamh, int flags); 11214 11215 Description 11216 11217 pam_setcred() sets the module-specific credentials of the 11218 user. It is usually called after the user has been 11219 authenticated, after the account management function has been 11220 called and after a session has been opened for the user. 11221 11222 flags maybe specified from among the following values: 11223 11224 PAM_ESTABLISH_CRED 11225 set credentials for the authentication service 11226 11227 PAM_DELETE_CRED 11228 delete credentials associated with the authentication 11229 service 11230 11231 PAM_REINITIALIZE_CRED 11232 reinitialize the user credentials 11233 11234 PAM_REFRESH_CRED 11235 extend lifetime of the user credentials 11236 11237 Additionally, the value of flags may be logically or'd with 11238 PAM_SILENT. 11239 11240 Return Value 11241 11242 PAM_SUCCESS 11243 Success. 11244 11245 PAM_CRED_UNAVAIL 11246 Module cannot retrieve the user's credentials. 11247 11248 PAM_CRED_EXPIRED 11249 User's credentials have expired. 11250 11251 PAM_USER_UNKNOWN 11252 User is not known to an authentication module. 11253 11254 PAM_CRED_ERR 11255 Module was unable to set the credentials of the user. 11256 11257 Errors 11258 11259 May be translated to text with pam_strerror(). 11260 11261 pam_start 11262 11263 Name 11264 11265 pam_start -- initialize the PAM library 11266 11267 Synopsis 11268 11269 #include 11270 11271 int pam_start(const char * service_name, const char * user, 11272 const struct pam_conv * pam_conversation, pam_handle_t * * 11273 pamh); 11274 11275 Description 11276 11277 pam_start() is used to initialize the PAM library. It must be 11278 called prior to any other usage of the PAM library. On 11279 success, *pamh becomes a handle that provides continuity for 11280 successive calls to the PAM library. pam_start() expects 11281 arguments as follows: the service_name of the program, the 11282 username of the individual to be authenticated, a pointer to 11283 an application-supplied pam_conv structure, and a pointer to a 11284 pam_handle_t pointer. 11285 11286 An application must provide the conversation function used for 11287 direct communication between a loaded module and the 11288 application. The application also typically provides a means 11289 for the module to prompt the user for a password, etc. 11290 11291 The structure, pam_conv, is defined to be, 11292 struct pam_conv { 11293 int (*conv) (int num_msg, 11294 const struct pam_message * *msg, 11295 struct pam_response * *resp, 11296 void *appdata_ptr); 11297 void *appdata_ptr; 11298 }; 11299 11300 It is initialized by the application before it is passed to 11301 the library. The contents of this structure are attached to 11302 the *pamh handle. The point of this argument is to provide a 11303 mechanism for any loaded module to interact directly with the 11304 application program; this is why it is called a conversation 11305 structure. 11306 11307 When a module calls the referenced conv() function, 11308 appdata_ptr is set to the second element of this structure. 11309 11310 The other arguments of a call to conv() concern the 11311 information exchanged by module and application. num_msg holds 11312 the length of the array of pointers passed via msg. On 11313 success, the pointer resp points to an array of num_msg 11314 pam_response structures, holding the application-supplied 11315 text. Note that resp is a struct pam_response array and not an 11316 array of pointers. 11317 11318 Return Value 11319 11320 PAM_SUCCESS 11321 Success. 11322 11323 PAM_BUF_ERR 11324 Memory allocation error. 11325 11326 PAM_ABORT 11327 Internal failure. 11328 11329 ERRORS 11330 11331 May be translated to text with pam_strerror(). 11332 11333 pam_strerror 11334 11335 Name 11336 11337 pam_strerror -- returns a string describing the PAM error 11338 11339 Synopsis 11340 11341 #include 11342 11343 const char * pam_strerror(pam_handle_t * pamh, int errnum); 11344 11345 Description 11346 11347 pam_strerror() returns a string describing the PAM error 11348 associated with errnum. 11349 11350 Return Value 11351 11352 On success, this function returns a description of the 11353 indicated error. The application should not free or modify 11354 this string. Otherwise, a string indicating that the error is 11355 unknown shall be returned. It is unspecified whether or not 11356 the string returned is translated according to the setting of 11357 LC_MESSAGES. 11358 11359 III. Utility Libraries 11360 11361 Table of Contents 11362 8. Utility Libraries 11363 _________________________________________________________ 11364 11365 Chapter 8. Utility Libraries 11366 11367 An LSB-conforming implementation shall also support some 11368 utility libraries which are built on top of the interfaces 11369 provided by the base libraries. These libraries implement 11370 common functionality, and hide additional system dependent 11371 information such as file formats and device names. 11372 _________________________________________________________ 11373 11374 8.1. Interfaces for libz 11375 11376 Table 8-1 defines the library name and shared object name for 11377 the libz library 11378 11379 Table 8-1. libz Definition 11380 Library: libz 11381 SONAME: libz.so.1 11382 11383 The behavior of the interfaces in this library is specified by 11384 the following specifications: 11385 11386 this specification 11387 _________________________________________________________ 11388 11389 8.1.1. Compression Library 11390 _________________________________________________________ 11391 11392 8.1.1.1. Interfaces for Compression Library 11393 11394 An LSB conforming implementation shall provide the generic 11395 functions for Compression Library specified in Table 8-2, with 11396 the full functionality as described in the referenced 11397 underlying specification. 11398 11399 Table 8-2. libz - Compression Library Function Interfaces 11400 adler32 [1] deflateInit2_ [1] gzerror [1] gzrewind [1] 11401 inflateReset [1] 11402 compress [1] deflateInit_ [1] gzflush [1] gzseek [1] 11403 inflateSetDictionary [1] 11404 compress2 [1] deflateParams [1] gzgetc [1] gzsetparams [1] 11405 inflateSync [1] 11406 compressBound [1] deflateReset [1] gzgets [1] gztell [1] 11407 inflateSyncPoint [1] 11408 crc32 [1] deflateSetDictionary [1] gzopen [1] gzwrite [1] 11409 uncompress [1] 11410 deflate [1] get_crc_table [1] gzprintf [1] inflate [1] zError 11411 [1] 11412 deflateBound [1] gzclose [1] gzputc [1] inflateEnd [1] 11413 zlibVersion [1] 11414 deflateCopy [1] gzdopen [1] gzputs [1] inflateInit2_ [1] 11415 deflateEnd [1] gzeof [1] gzread [1] inflateInit_ [1] 11416 11417 Referenced Specification(s) 11418 11419 [1]. this specification 11420 _________________________________________________________ 11421 11422 8.2. Data Definitions for libz 11423 11424 This section defines global identifiers and their values that 11425 are associated with interfaces contained in libz. These 11426 definitions are organized into groups that correspond to 11427 system headers. This convention is used as a convenience for 11428 the reader, and does not imply the existence of these headers, 11429 or their content. 11430 11431 These definitions are intended to supplement those provided in 11432 the referenced underlying specifications. 11433 11434 This specification uses ISO/IEC 9899 C Language as the 11435 reference programming language, and data definitions are 11436 specified in ISO C format. The C language is used here as a 11437 convenient notation. Using a C language description of these 11438 data objects does not preclude their use by other programming 11439 languages. 11440 _________________________________________________________ 11441 11442 8.2.1. zlib.h 11443 11444 In addition to the values below, the zlib.h header shall 11445 define the ZLIB_VERSION macro. This macro may be used to check 11446 that the version of the library at run time matches that at 11447 compile time. 11448 11449 See also the zlibVersion() function, which returns the library 11450 version at run time. The first character of the version at 11451 compile time should always match the first character at run 11452 time. 11453 #define Z_NULL 0 11454 #define MAX_WBITS 15 11455 #define MAX_MEM_LEVEL 9 11456 #define deflateInit2(strm,level,method,windowBits,memLevel,strategy) 11457 deflateInit2_((strm),(level),(method),(windowBits),(memLevel),(strategy 11458 ),ZLIB_VERSION,sizeof(z_stream)) 11459 #define deflateInit(strm,level) deflateInit_((strm), (level), ZLI 11460 B_VERSION, sizeof(z_stream)) 11461 #define inflateInit2(strm,windowBits) inflateInit2_((strm), (windowBi 11462 ts), ZLIB_VERSION, sizeof(z_stream)) 11463 #define inflateInit(strm) inflateInit_((strm), ZLI 11464 B_VERSION, sizeof(z_stream)) 11465 11466 typedef char charf; 11467 typedef int intf; 11468 11469 typedef void *voidpf; 11470 typedef unsigned int uInt; 11471 typedef unsigned long uLong; 11472 typedef uLong uLongf; 11473 typedef void *voidp; 11474 typedef unsigned char Byte; 11475 typedef off_t z_off_t; 11476 typedef void *const voidpc; 11477 11478 typedef voidpf (*alloc_func) (voidpf opaque, uInt items, uInt size); 11479 typedef void (*free_func) (voidpf opaque, voidpf address); 11480 struct internal_state 11481 { 11482 int dummy; 11483 } 11484 ; 11485 typedef Byte Bytef; 11486 typedef uInt uIntf; 11487 11488 typedef struct z_stream_s 11489 { 11490 Bytef *next_in; 11491 uInt avail_in; 11492 uLong total_in; 11493 Bytef *next_out; 11494 uInt avail_out; 11495 uLong total_out; 11496 char *msg; 11497 struct internal_state *state; 11498 alloc_func zalloc; 11499 free_func zfree; 11500 voidpf opaque; 11501 int data_type; 11502 uLong adler; 11503 uLong reserved; 11504 } 11505 z_stream; 11506 11507 typedef z_stream *z_streamp; 11508 typedef voidp gzFile; 11509 #define Z_NO_FLUSH 0 11510 #define Z_PARTIAL_FLUSH 1 11511 #define Z_SYNC_FLUSH 2 11512 #define Z_FULL_FLUSH 3 11513 #define Z_FINISH 4 11514 11515 #define Z_ERRNO (-1) 11516 #define Z_STREAM_ERROR (-2) 11517 #define Z_DATA_ERROR (-3) 11518 #define Z_MEM_ERROR (-4) 11519 #define Z_BUF_ERROR (-5) 11520 #define Z_VERSION_ERROR (-6) 11521 #define Z_OK 0 11522 #define Z_STREAM_END 1 11523 #define Z_NEED_DICT 2 11524 11525 #define Z_DEFAULT_COMPRESSION (-1) 11526 #define Z_NO_COMPRESSION 0 11527 #define Z_BEST_SPEED 1 11528 #define Z_BEST_COMPRESSION 9 11529 11530 #define Z_DEFAULT_STRATEGY 0 11531 #define Z_FILTERED 1 11532 #define Z_HUFFMAN_ONLY 2 11533 11534 #define Z_BINARY 0 11535 #define Z_ASCII 1 11536 #define Z_UNKNOWN 2 11537 11538 #define Z_DEFLATED 8 11539 _________________________________________________________ 11540 11541 8.3. Interface Definitions for libz 11542 11543 Table of Contents 11544 adler32 -- Compute Adler 32 Checksum 11545 compress -- compress data 11546 compress2 -- compress data at a specified level 11547 compressBound -- compute compressed data size 11548 crc32 -- Compute CRC-32 Checksum 11549 deflate -- compress data 11550 deflateBound -- compute compressed data size 11551 deflateCopy -- copy compression stream 11552 deflateEnd -- free compression stream state 11553 deflateInit2_ -- initialize compression system 11554 deflateInit_ -- initialize compression system 11555 deflateParams -- set compression parameters 11556 deflateReset -- reset compression stream state 11557 deflateSetDictionary -- initialize compression dictionary 11558 get_crc_table -- generate a table for crc calculations 11559 gzclose -- close a compressed file stream 11560 gzdopen -- open a compressed file 11561 gzeof -- check for end-of-file on a compressed file stream 11562 gzerror -- decode an error on a compressed file stream 11563 gzflush -- flush a compressed file stream 11564 gzgetc -- read a character from a compressed file 11565 gzgets -- read a string from a compressed file 11566 gzopen -- open a compressed file 11567 gzprintf -- format data and compress 11568 gzputc -- write character to a compressed file 11569 gzputs -- string write to a compressed file 11570 gzread -- read from a compressed file 11571 gzrewind -- reset the file-position indicator on a compressed 11572 file stream 11573 11574 gzseek -- reposition a file-position indicator in a compressed 11575 file stream 11576 11577 gzsetparams -- dynamically set compression parameters 11578 gztell -- find position on a compressed file stream 11579 gzwrite -- write to a compressed file 11580 inflate -- decompress data 11581 inflateEnd -- free decompression stream state 11582 inflateInit2_ -- initialize decompression system 11583 inflateInit_ -- initialize decompression system 11584 inflateReset -- reset decompression stream state 11585 inflateSetDictionary -- initialize decompression dictionary 11586 inflateSync -- advance compression stream to next sync point 11587 inflateSyncPoint -- test for synchronization point 11588 uncompress -- uncompress data 11589 zError -- translate error number to string 11590 zlibVersion -- discover library version at run time 11591 11592 The following interfaces are included in libz and are defined 11593 by this specification. Unless otherwise noted, these 11594 interfaces shall be included in the source standard. 11595 11596 Other interfaces listed above for libz shall behave as 11597 described in the referenced base document. 11598 11599 adler32 11600 11601 Name 11602 11603 adler32 -- Compute Adler 32 Checksum 11604 11605 Synopsis 11606 11607 #include 11608 11609 uLong adler32(uLong adler, const Bytef * buf, uInt len); 11610 11611 Description 11612 11613 The adler32() function shall compute a running Adler-32 11614 checksum (as described in RFC 1950: ZLIB Compressed Data 11615 Format Specication). On entry, adler is the previous value for 11616 the checksum, and buf shall point to an array of len bytes of 11617 data to be added to this checksum. The adler32() function 11618 shall return the new checksum. 11619 11620 If buf is NULL (or Z_NULL), adler32() shall return the initial 11621 checksum. 11622 11623 Return Value 11624 11625 The adler32() function shall return the new checksum value. 11626 11627 Errors 11628 11629 None defined. 11630 11631 Application Usage (informative) 11632 11633 The following code fragment demonstrates typical usage of the 11634 adler32() function: 11635 uLong adler = adler32(0L, Z_NULL, 0); 11636 11637 while (read_buffer(buffer, length) != EOF) { 11638 adler = adler32(adler, buffer, length); 11639 } 11640 if (adler != original_adler) error(); 11641 11642 compress 11643 11644 Name 11645 11646 compress -- compress data 11647 11648 Synopsis 11649 11650 #include 11651 11652 int compress(Bytef * dest, uLongf * destLen, const Bytef * 11653 source, uLong sourceLen); 11654 11655 Description 11656 11657 The compress() function shall attempt to compress sourceLen 11658 bytes of data in the buffer source, placing the result in the 11659 buffer dest. 11660 11661 On entry, destLen should point to a value describing the size 11662 of the dest buffer. The application should ensure that this 11663 value be at least (sourceLen × 1.001) + 12. On successful 11664 exit, the variable referenced by destLen shall be updated to 11665 hold the length of compressed data in dest. 11666 11667 The compress() function is equivalent to compress2() with a 11668 level of Z_DEFAULT_LEVEL. 11669 11670 Return Value 11671 11672 On success, compress() shall return Z_OK. Otherwise, 11673 compress() shall return a value to indicate the error. 11674 11675 Errors 11676 11677 On error, compress() shall return a value as described below: 11678 11679 Z_BUF_ERROR 11680 The buffer dest was not large enough to hold the 11681 compressed data. 11682 11683 Z_MEM_ERROR 11684 Insufficient memory. 11685 11686 compress2 11687 11688 Name 11689 11690 compress2 -- compress data at a specified level 11691 11692 Synopsis 11693 11694 #include 11695 11696 int compress2(Bytef * dest, uLongf * destLen, const Bytef * 11697 source, uLong sourceLen, int level); 11698 11699 Description 11700 11701 The compress2() function shall attempt to compress sourceLen 11702 bytes of data in the buffer source, placing the result in the 11703 buffer dest, at the level described by level. The level 11704 supplied shall be a value between 0 and 9, or the value 11705 Z_DEFAULT_COMPRESSION. A level of 1 requests the highest 11706 speed, while a level of 9 requests the highest compression. A 11707 level of 0 indicates that no compression should be used, and 11708 the output shall be the same as the input. 11709 11710 On entry, destLen should point to a value describing the size 11711 of the dest buffer. The application should ensure that this 11712 value be at least (sourceLen × 1.001) + 12. On successful 11713 exit, the variable referenced by destLen shall be updated to 11714 hold the length of compressed data in dest. 11715 11716 The compress() function is equivalent to compress2() with a 11717 level of Z_DEFAULT_LEVEL. 11718 11719 Return Value 11720 11721 On success, compress2() shall return Z_OK. Otherwise, 11722 compress2() shall return a value to indicate the error. 11723 11724 Errors 11725 11726 On error, compress2() shall return a value as described below: 11727 11728 Z_BUF_ERROR 11729 The buffer dest was not large enough to hold the 11730 compressed data. 11731 11732 Z_MEM_ERROR 11733 Insufficient memory. 11734 11735 Z_STREAM_ERROR 11736 The level was not Z_DEFAULT_LEVEL, or was not between 0 11737 and 9. 11738 11739 compressBound 11740 11741 Name 11742 11743 compressBound -- compute compressed data size 11744 11745 Synopsis 11746 11747 #include 11748 11749 int compressBound(uLong sourceLen); 11750 11751 Description 11752 11753 The compressBound() function shall estimate the size of buffer 11754 required to compress sourceLen bytes of data using the 11755 compress() or compress2() functions. If successful, the value 11756 returned shall be an upper bound for the size of buffer 11757 required to compress sourceLen bytes of data, using the 11758 parameters stored in stream, in a single call to compress() or 11759 compress2(). 11760 11761 Return Value 11762 11763 The compressBound() shall return a value representing the 11764 upper bound of an array to allocate to hold the compressed 11765 data in a single call to compress() or compress2(). This 11766 function may return a conservative value that may be larger 11767 than sourceLen. 11768 11769 Errors 11770 11771 None defined. 11772 11773 crc32 11774 11775 Name 11776 11777 crc32 -- Compute CRC-32 Checksum 11778 11779 Synopsis 11780 11781 #include 11782 11783 uLong crc32(uLong crc, const Bytef * buf, uInt len); 11784 11785 Description 11786 11787 The crc32() function shall compute a running Cyclic Redundancy 11788 Check checksum, as defined in ITU-T V.42. On entry, crc is the 11789 previous value for the checksum, and buf shall point to an 11790 array of len bytes of data to be added to this checksum. The 11791 crc32() function shall return the new checksum. 11792 11793 If buf is NULL (or Z_NULL), crc32() shall return the initial 11794 checksum. 11795 11796 Return Value 11797 11798 The crc32() function shall return the new checksum value. 11799 11800 Errors 11801 11802 None defined. 11803 11804 Application Usage (informative) 11805 11806 The following code fragment demonstrates typical usage of the 11807 crc32() function: 11808 uLong crc = crc32(0L, Z_NULL, 0); 11809 11810 while (read_buffer(buffer, length) != EOF) { 11811 crc = crc32(crc, buffer, length); 11812 } 11813 if (crc != original_crc) error(); 11814 11815 deflate 11816 11817 Name 11818 11819 deflate -- compress data 11820 11821 Synopsis 11822 11823 #include 11824 11825 int deflate(z_streamp stream, int flush); 11826 11827 Description 11828 11829 The deflate() function shall attempt to compress data until 11830 either the input buffer is empty or the output buffer is full. 11831 The stream references a z_stream structure. Before the first 11832 call to deflate(), this structure should have been initialized 11833 by a call to deflateInit2_(). 11834 11835 Note: deflateInit2_() is only in the binary standard; 11836 source level applications should initialize stream via a 11837 call to deflateInit() or deflateInit2(). 11838 11839 In addition, the stream input and output buffers should have 11840 been initialized as follows: 11841 11842 next_in 11843 should point to the data to be compressed. 11844 11845 avail_in 11846 should contain the number of bytes of data in the 11847 buffer referenced by next_in. 11848 11849 next_out 11850 should point to a buffer where compressed data may be 11851 placed. 11852 11853 avail_out 11854 should contain the size in bytes of the buffer 11855 referenced by next_out 11856 11857 The deflate() function shall perform one or both of the 11858 following actions: 11859 11860 1. Compress input data from next_in and update next_in, 11861 avail_in and total_in to reflect the data that has been 11862 compressed. 11863 2. Fill the output buffer referenced by next_out, and update 11864 next_out, avail_out and total_out to reflect the 11865 compressed data that has been placed there. If flush is 11866 not Z_NO_FLUSH, and avail_out indicates that there is 11867 still space in output buffer, this action shall always 11868 occur (see below for further details). 11869 11870 The deflate() function shall return when either avail_in 11871 reaches zero (indicating that all the input data has been 11872 compressed), or avail_out reaches zero (indicating that the 11873 output buffer is full). 11874 11875 On success, the deflate() function shall set the adler field 11876 of the stream to the adler32() checksum of all the input data 11877 compressed so far (represented by total_in). 11878 11879 If the deflate() function shall attempt to determine the type 11880 of input data, and set field data_type in stream to Z_ASCII if 11881 the majority of the data bytes fall within the ASCII (ISO 646) 11882 printable character range. Otherwise, it shall set data_type 11883 to Z_BINARY. This data type is informational only, and does 11884 not affect the compression algorithm. 11885 11886 Note: Future versions of the LSB may remove this 11887 requirement, since it is based on an outdated character set 11888 that does not support Internationalization, and does not 11889 affect the algorithm. It is included for information only 11890 at this release. Applications should not depend on this 11891 field. 11892 11893 Flush Operation 11894 11895 The parameter flush determines when compressed bits are added 11896 to the output buffer in next_out. If flush is Z_NO_FLUSH, 11897 deflate() may return with some data pending output, and not 11898 yet added to the output buffer. 11899 11900 If flush is Z_SYNC_FLUSH, deflate() shall flush all pending 11901 output to next_out and align the output to a byte boundary. A 11902 synchronization point is generated in the output. 11903 11904 If flush is Z_FULL_FLUSH, all output shall be flushed, as for 11905 Z_SYNC_FLUSH, and the compression state shall be reset. A 11906 synchronization point is generated in the output. 11907 11908 Rationale: Z_SYNC_FLUSH is intended to ensure that the 11909 compressed data contains all the data compressed so far, 11910 and allows a decompressor to reconstruct all of the input 11911 data. Z_FULL_FLUSH allows decompression to restart from 11912 this point if the previous compressed data has been lost or 11913 damaged. Flushing is likely to degrade the performance of 11914 the compression system, and should only be used where 11915 necessary. 11916 11917 If flush is set to Z_FINISH, all pending input shall be 11918 processed and deflate() shall return with Z_STREAM_END if 11919 there is sufficient space in the output buffer at next_out, as 11920 indicated by avail_out. If deflate() is called with flush set 11921 to Z_FINISH and there is insufficient space to store the 11922 compressed data, and no other error has occurred during 11923 compression, deflate() shall return Z_OK, and the application 11924 should call deflate() again with flush unchanged, and having 11925 updated next_out and avail_out. 11926 11927 If all the compression is to be done in a single step, 11928 deflate() may be called with flush set to Z_FINISH immediately 11929 after the stream has been initialized if avail_out is set to 11930 at least the value returned by deflateBound(). 11931 11932 Return Value 11933 11934 On success, deflate() shall return Z_OK, unless flush was set 11935 to Z_FINISH and there was sufficient space in the output 11936 buffer to compress all of the input data. In this case, 11937 deflate() shall return Z_STREAM_END. On error, deflate() shall 11938 return a value to indicate the error. 11939 11940 Note: If deflate() returns Z_OK and has set avail_out to 11941 zero, the function should be called again with the same 11942 value for flush, and with updated next_out and avail_out 11943 until deflate() returns with Z_OK (or Z_STREAM_END if flush 11944 is set to Z_FINISH) and a non-zero avail_out. 11945 11946 Errors 11947 11948 On error, deflate() shall return a value as described below, 11949 and set the msg field of stream to point to a string 11950 describing the error: 11951 11952 Z_BUF_ERROR 11953 No progress is possible; either avail_in or avail_out 11954 was zero. 11955 11956 Z_MEM_ERROR 11957 Insufficient memory. 11958 11959 Z_STREAM_ERROR 11960 The state (as represented in stream) is inconsistent, 11961 or stream was NULL. 11962 11963 deflateBound 11964 11965 Name 11966 11967 deflateBound -- compute compressed data size 11968 11969 Synopsis 11970 11971 #include 11972 11973 int deflateBound(z_streamp stream, uLong sourceLen); 11974 11975 Description 11976 11977 The deflateBound() function shall estimate the size of buffer 11978 required to compress sourceLen bytes of data. If successful, 11979 the value returned shall be an upper bound for the size of 11980 buffer required to compress sourceLen bytes of data, using the 11981 parameters stored in stream, in a single call to deflate() 11982 with flush set to Z_FINISH. 11983 11984 On entry, stream should have been initialized via a call to 11985 deflateInit_() or deflateInit2_(). 11986 11987 Return Value 11988 11989 The deflateBound() shall return a value representing the upper 11990 bound of an array to allocate to hold the compressed data in a 11991 single call to deflate(). If the stream is not correctly 11992 initialized, or is NULL, then deflateBound() may return a 11993 conservative value that may be larger than sourceLen. 11994 11995 Errors 11996 11997 None defined. 11998 11999 deflateCopy 12000 12001 Name 12002 12003 deflateCopy -- copy compression stream 12004 12005 Synopsis 12006 12007 #include 12008 12009 int deflateCopy(z_streamp dest, z_streamp source); 12010 12011 Description 12012 12013 The deflateCopy() function shall copy the compression state 12014 information in source to the uninitialized z_stream structure 12015 referenced by dest. 12016 12017 On successful return, dest will be an exact copy of the stream 12018 referenced by source. The input and output buffer pointers in 12019 next_in and next_out will reference the same data. 12020 12021 Return Value 12022 12023 On success, deflateCopy() shall return Z_OK. Otherwise it 12024 shall return a value less than zero to indicate the error. 12025 12026 Errors 12027 12028 On error, deflateCopy() shall return a value as described 12029 below: 12030 12031 Z_STREAM_ERROR 12032 The state in source is inconsistent, or either source 12033 or dest was NULL. 12034 12035 Z_MEM_ERROR 12036 Insufficient memory available. 12037 12038 Application Usage (informative) 12039 12040 This function can be useful when several compression 12041 strategies will be tried, for example when there are several 12042 ways of pre-processing the input data with a filter. The 12043 streams that will be discarded should then be freed by calling 12044 deflateEnd(). Note that deflateCopy() duplicates the internal 12045 compression state which can be quite large, so this strategy 12046 may be slow and can consume lots of memory. 12047 12048 deflateEnd 12049 12050 Name 12051 12052 deflateEnd -- free compression stream state 12053 12054 Synopsis 12055 12056 #include 12057 12058 int deflateEnd(z_streamp stream); 12059 12060 Description 12061 12062 The deflateEnd() function shall free all allocated state 12063 information referenced by stream. All pending output is 12064 discarded, and unprocessed input is ignored. 12065 12066 Return Value 12067 12068 On success, deflateEnd() shall return Z_OK, or Z_DATA_ERROR if 12069 there was pending output discarded or input unprocessed. 12070 Otherwise it shall return Z_STREAM_ERROR to indicate the 12071 error. 12072 12073 Errors 12074 12075 On error, deflateEnd() shall return Z_STREAM_ERROR. The 12076 following conditions shall be treated as an error: 12077 12078 * The state in stream is inconsistent or inappropriate. 12079 * stream is NULL. 12080 12081 deflateInit2_ 12082 12083 Name 12084 12085 deflateInit2_ -- initialize compression system 12086 12087 Synopsis 12088 12089 #include 12090 12091 int deflateInit2_ (z_streamp strm, int level, int method, int 12092 windowBits, int memLevel, int strategy, char * version, int 12093 stream_size); 12094 12095 Description 12096 12097 The deflateInit2_() function shall initialize the compression 12098 system. On entry, strm shall refer to a user supplied z_stream 12099 object (a z_stream_s structure). The following fields shall be 12100 set on entry: 12101 12102 zalloc 12103 a pointer to an alloc_func function, used to allocate 12104 state information. If this is NULL, a default 12105 allocation function will be used. 12106 12107 zfree 12108 a pointer to a free_func function, used to free memory 12109 allocated by the zalloc function. If this is NULL a 12110 default free function will be used. 12111 12112 opaque 12113 If alloc_func is not NULL, opaque is a user supplied 12114 pointer to data that will be passed to the alloc_func 12115 and free_func functions. 12116 12117 If the version requested is not compatible with the version 12118 implemented, or if the size of the z_stream_s structure 12119 provided in stream_size does not match the size in the library 12120 implementation, deflateInit2_() shall fail, and return 12121 Z_VERSION_ERROR. 12122 12123 The level supplied shall be a value between 0 and 9, or the 12124 value Z_DEFAULT_COMPRESSION. A level of 1 requests the highest 12125 speed, while a level of 9 requests the highest compression. A 12126 level of 0 indicates that no compression should be used, and 12127 the output shall be the same as the input. 12128 12129 The method selects the compression algorithm to use. LSB 12130 conforming implementation shall support the Z_DEFLATED method, 12131 and may support other implementation defined methods. 12132 12133 The windowBits parameter shall be a base 2 logarithm of the 12134 window size to use, and shall be a value between 8 and 15. A 12135 smaller value will use less memory, but will result in a 12136 poorer compression ratio, while a higher value will give 12137 better compression but utilize more memory. 12138 12139 The memLevel parameter specifies how much memory to use for 12140 the internal state. The value of memLevel shall be between 1 12141 and MAX_MEM_LEVEL. Smaller values use less memory but are 12142 slower, while higher values use more memory to gain 12143 compression speed. 12144 12145 The strategy parameter selects the compression strategy to 12146 use: 12147 12148 Z_DEFAULT_STRATEGY 12149 use the system default compression strategy. 12150 Z_DEFAULT_STRATEGY is particularly appropriate for text 12151 data. 12152 12153 Z_FILTERED 12154 use a compression strategy tuned for data consisting 12155 largely of small values with a fairly random 12156 distribution. Z_FILTERED uses more Huffman encoding and 12157 less string matching than Z_DEFAULT_STRATEGY. 12158 12159 Z_HUFFMAN_ONLY 12160 force Huffman encoding only, with no string match. 12161 12162 The deflateInit2_() function is not in the source standard; it 12163 is only in the binary standard. Source applications should use 12164 the deflateInit2() macro. 12165 12166 Return Value 12167 12168 On success, the deflateInit2_() function shall return Z_OK. 12169 Otherwise, deflateInit2_() shall return a value as described 12170 below to indicate the error. 12171 12172 Errors 12173 12174 On error, deflateInit2_() shall return one of the following 12175 error indicators: 12176 12177 Z_STREAM_ERROR 12178 Invalid parameter. 12179 12180 Z_MEM_ERROR 12181 Insufficient memory available. 12182 12183 Z_VERSION_ERROR 12184 The version requested is not compatible with the 12185 library version, or the z_stream size differs from that 12186 used by the library. 12187 12188 In addition, the msg field of the strm may be set to an error 12189 message. 12190 12191 deflateInit_ 12192 12193 Name 12194 12195 deflateInit_ -- initialize compression system 12196 12197 Synopsis 12198 12199 #include 12200 12201 int deflateInit_(z_streamp stream, int level, const char * 12202 version, int stream_size); 12203 12204 Description 12205 12206 The deflateInit_() function shall initialize the compression 12207 system. On entry, stream shall refer to a user supplied 12208 z_stream object (a z_stream_s structure). The following fields 12209 shall be set on entry: 12210 12211 zalloc 12212 a pointer to an alloc_func function, used to allocate 12213 state information. If this is NULL, a default 12214 allocation function will be used. 12215 12216 zfree 12217 a pointer to a free_func function, used to free memory 12218 allocated by the zalloc function. If this is NULL a 12219 default free function will be used. 12220 12221 opaque 12222 If alloc_func is not NULL, opaque is a user supplied 12223 pointer to data that will be passed to the alloc_func 12224 and free_func functions. 12225 12226 If the version requested is not compatible with the version 12227 implemented, or if the size of the z_stream_s structure 12228 provided in stream_size does not match the size in the library 12229 implementation, deflateInit_() shall fail, and return 12230 Z_VERSION_ERROR. 12231 12232 The level supplied shall be a value between 0 and 9, or the 12233 value Z_DEFAULT_COMPRESSION. A level of 1 requests the highest 12234 speed, while a level of 9 requests the highest compression. A 12235 level of 0 indicates that no compression should be used, and 12236 the output shall be the same as the input. 12237 12238 The deflateInit_() function is not in the source standard; it 12239 is only in the binary standard. Source applications should use 12240 the deflateInit() macro. 12241 12242 The deflateInit_() function is equivalent to 12243 deflateInit2_(stream, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, 12244 Z_DEFAULT_STRATEGY, version, stream_size); 12245 12246 Return Value 12247 12248 On success, the deflateInit_() function shall return Z_OK. 12249 Otherwise, deflateInit_() shall return a value as described 12250 below to indicate the error. 12251 12252 Errors 12253 12254 On error, deflateInit_() shall return one of the following 12255 error indicators: 12256 12257 Z_STREAM_ERROR 12258 Invalid parameter. 12259 12260 Z_MEM_ERROR 12261 Insufficient memory available. 12262 12263 Z_VERSION_ERROR 12264 The version requested is not compatible with the 12265 library version, or the z_stream size differs from that 12266 used by the library. 12267 12268 In addition, the msg field of the stream may be set to an 12269 error message. 12270 12271 deflateParams 12272 12273 Name 12274 12275 deflateParams -- set compression parameters 12276 12277 Synopsis 12278 12279 #include 12280 12281 int deflateParams(z_streamp stream, int level, int strategy); 12282 12283 Description 12284 12285 The deflateParams() function shall dynamically alter the 12286 compression parameters for the compression stream object 12287 stream. On entry, stream shall refer to a user supplied 12288 z_stream object (a z_stream_s structure), already initialized 12289 via a call to deflateInit_() or deflateInit2_(). 12290 12291 The level supplied shall be a value between 0 and 9, or the 12292 value Z_DEFAULT_COMPRESSION. A level of 1 requests the highest 12293 speed, while a level of 9 requests the highest compression. A 12294 level of 0 indicates that no compression should be used, and 12295 the output shall be the same as the input. If the compression 12296 level is altered by deflateParams(), and some data has already 12297 been compressed with this stream (i.e. total_in is not zero), 12298 and the new level requires a different underlying compression 12299 method, then stream shall be flushed by a call to deflate(). 12300 12301 The strategy parameter selects the compression strategy to 12302 use: 12303 12304 Z_DEFAULT_STRATEGY 12305 use the system default compression strategy. 12306 Z_DEFAULT_STRATEGY is particularly appropriate for text 12307 data. 12308 12309 Z_FILTERED 12310 use a compression strategy tuned for data consisting 12311 largely of small values with a fairly random 12312 distribution. Z_FILTERED uses more Huffman encoding and 12313 less string matching than Z_DEFAULT_STRATEGY. 12314 12315 Z_HUFFMAN_ONLY 12316 force Huffman encoding only, with no string match. 12317 12318 Return Value 12319 12320 On success, the deflateParams() function shall return Z_OK. 12321 Otherwise, deflateParams() shall return a value as described 12322 below to indicate the error. 12323 12324 Errors 12325 12326 On error, deflateParams() shall return one of the following 12327 error indicators: 12328 12329 Z_STREAM_ERROR 12330 Invalid parameter. 12331 12332 Z_MEM_ERROR 12333 Insufficient memory available. 12334 12335 Z_BUF_ERROR 12336 Insufficient space in stream to flush the current 12337 output. 12338 12339 In addition, the msg field of the strm may be set to an error 12340 message. 12341 12342 Application Usage (Informative) 12343 12344 Applications should ensure that the stream is flushed, e.g. by 12345 a call to deflate(stream, Z_SYNC_FLUSH) before calling 12346 deflateParams(), or ensure that there is sufficient space in 12347 next_out (as identified by avail_out) to ensure that all 12348 pending output and all uncompressed input can be flushed in a 12349 single call to deflate(). 12350 12351 Rationale: Although the deflateParams() function should 12352 flush pending output and compress all pending input, the 12353 result is unspecified if there is insufficient space in the 12354 output buffer. Applications should only call 12355 deflateParams() when the stream is effectively empty 12356 (flushed). 12357 12358 The deflateParams() can be used to switch between 12359 compression and straight copy of the input data, or to 12360 switch to a different kind of input data requiring a 12361 different strategy. 12362 12363 deflateReset 12364 12365 Name 12366 12367 deflateReset -- reset compression stream state 12368 12369 Synopsis 12370 12371 #include 12372 12373 int deflateReset(z_streamp stream); 12374 12375 Description 12376 12377 The deflateReset() function shall reset all state associated 12378 with stream. All pending output shall be discarded, and the 12379 counts of processed bytes (total_in and total_out) shall be 12380 reset to zero. 12381 12382 Return Value 12383 12384 On success, deflateReset() shall return Z_OK. Otherwise it 12385 shall return Z_STREAM_ERROR to indicate the error. 12386 12387 Errors 12388 12389 On error, deflateReset() shall return Z_STREAM_ERROR. The 12390 following conditions shall be treated as an error: 12391 12392 * The state in stream is inconsistent or inappropriate. 12393 * stream is NULL. 12394 12395 deflateSetDictionary 12396 12397 Name 12398 12399 deflateSetDictionary -- initialize compression dictionary 12400 12401 Synopsis 12402 12403 #include 12404 12405 int deflateSetDictionary(z_streamp stream, const Bytef * 12406 dictionary, uInt dictlen); 12407 12408 Description 12409 12410 The deflateSetDictionary() function shall initialize the 12411 compression dictionary associated with stream using the 12412 dictlen bytes referenced by dictionary. 12413 12414 The implementation may silently use a subset of the provided 12415 dictionary if the dictionary cannot fit in the current window 12416 associated with stream (see deflateInit2_()). The application 12417 should ensure that the dictionary is sorted such that the most 12418 commonly used strings occur at the end of the dictionary. 12419 12420 If the dictionary is successfully set, the Adler32 checksum of 12421 the entire provided dictionary shall be stored in the adler 12422 member of stream. This value may be used by the decompression 12423 system to select the correct dictionary. The compression and 12424 decompression systems must use the same dictionary. 12425 12426 stream shall reference an initialized compression stream, with 12427 total_in zero (i.e. no data has been compressed since the 12428 stream was initialized). 12429 12430 Return Value 12431 12432 On success, deflateSetDictionary() shall return Z_OK. 12433 Otherwise it shall return Z_STREAM_ERROR to indicate an error. 12434 12435 Errors 12436 12437 On error, deflateSetDictionary() shall return a value as 12438 described below: 12439 12440 Z_STREAM_ERROR 12441 The state in stream is inconsistent, or stream was 12442 NULL. 12443 12444 Application Usage (informative) 12445 12446 The application should provide a dictionary consisting of 12447 strings {{{ed note: do we really mean "strings"? Null 12448 terminated?}}} that are likely to be encountered in the data 12449 to be compressed. The application should ensure that the 12450 dictionary is sorted such that the most commonly used strings 12451 occur at the end of the dictionary. 12452 12453 The use of a dictionary is optional; however if the data to be 12454 compressed is relatively short and has a predictable 12455 structure, the use of a dictionary can substantially improve 12456 the compression ratio. 12457 12458 get_crc_table 12459 12460 Name 12461 12462 get_crc_table -- generate a table for crc calculations 12463 12464 Synopsis 12465 12466 #include 12467 12468 const uLongf * get_crc_table(void); 12469 12470 Description 12471 12472 Generate tables for a byte-wise 32-bit CRC calculation based 12473 on the polynomial: 12474 x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+ 12475 1 12476 12477 In a multi-threaded application, get_crc_table() should be 12478 called by one thread to initialize the tables before any other 12479 thread calls any libz function. 12480 12481 Return Value 12482 12483 The get_crc_table() function shall return a pointer to the 12484 first of a set of tables used internally to calculate CRC-32 12485 values (see crc32()). 12486 12487 Errors 12488 12489 None defined. 12490 12491 gzclose 12492 12493 Name 12494 12495 gzclose -- close a compressed file stream 12496 12497 Synopsis 12498 12499 #include 12500 12501 int gzclose (gzFile file ); 12502 12503 Description 12504 12505 The gzclose() function shall close the compressed file stream 12506 file. If file was open for writing, gzclose() shall first 12507 flush any pending output. Any state information allocated 12508 shall be freed. 12509 12510 Return Value 12511 12512 On success, gzclose() shall return Z_OK. Otherwise, gzclose() 12513 shall return an error value as described below. 12514 12515 Errors 12516 12517 On error, gzclose() may set the global variable errno to 12518 indicate the error. The gzclose() shall return a value other 12519 than Z_OK on error. 12520 12521 Z_STREAM_ERROR 12522 file was NULL (or Z_NULL), or did not refer to an open 12523 compressed file stream. 12524 12525 Z_ERRNO 12526 An error occurred in the underlying base libraries, and 12527 the application should check errno for further 12528 information. 12529 12530 Z_BUF_ERROR 12531 no compression progress is possible during buffer flush 12532 (see deflate()). 12533 12534 gzdopen 12535 12536 Name 12537 12538 gzdopen -- open a compressed file 12539 12540 Synopsis 12541 12542 #include 12543 12544 gzFile gzdopen ( int fd, const char *mode ); 12545 12546 Description 12547 12548 The gzdopen() function shall attempt to associate the open 12549 file referenced by fd with a gzFile object. The mode argument 12550 is based on that of fopen(), but the mode parameter may also 12551 contain the following characters: 12552 12553 digit 12554 set the compression level to digit. A low value (e.g. 12555 1) means high speed, while a high value (e.g. 9) means 12556 high compression. A compression level of 0 (zero) means 12557 no compression. See defaultInit2_() for further 12558 details. 12559 12560 [fhR] 12561 set the compression strategy to [fhR]. The letter f 12562 corresponds to filtered data, the letter h corresponds 12563 to Huffman only compression, and the letter R 12564 corresponds to Run Length Encoding. See defaultInit2_() 12565 for further details. 12566 12567 If fd refers to an uncompressed file, and mode refers to a 12568 read mode, gzdopen() shall attempt to open the file and return 12569 a gzFile object suitable for reading directly from the file 12570 without any decompression. 12571 12572 If mode is NULL, or if mode does not contain one of r, w, or 12573 a, gzdopen() shall return Z_NULL, and need not set any other 12574 error condition. 12575 12576 Example 12577 12578 gzdopen(fileno(stdin), "r"); 12579 12580 Attempt to associate the standard input with a gzFile object. 12581 12582 Return Value 12583 12584 On success, gzdopen() shall return a gzFile object. On 12585 failure, gzdopen() shall return Z_NULL and may set errno 12586 accordingly. 12587 12588 Note: At version 1.2.2, zlib does not set errno for several 12589 error conditions. Applications may not be able to determine 12590 the cause of an error. 12591 12592 Errors 12593 12594 On error, gzdopen() may set the global variable errno to 12595 indicate the error. 12596 12597 gzeof 12598 12599 Name 12600 12601 gzeof -- check for end-of-file on a compressed file stream 12602 12603 Synopsis 12604 12605 #include 12606 12607 int gzeof (gzFile file ); 12608 12609 Description 12610 12611 The gzeof() function shall test the compressed file stream 12612 file for end of file. 12613 12614 Return Value 12615 12616 If file was open for reading and end of file has been reached, 12617 gzeof() shall return 1. Otherwise, gzeof() shall return 0. 12618 12619 Errors 12620 12621 None defined. 12622 12623 gzerror 12624 12625 Name 12626 12627 gzerror -- decode an error on a compressed file stream 12628 12629 Synopsis 12630 12631 #include 12632 12633 const char * gzerror (gzFile file, int * errnum); 12634 12635 Description 12636 12637 The gzerror() function shall return a string describing the 12638 last error to have occurred associated with the open 12639 compressed file stream referred to by file. It shall also set 12640 the location referenced by errnum to an integer value that 12641 further identifies the error. 12642 12643 Return Value 12644 12645 The gzerror() function shall return a string that describes 12646 the last error associated with the given file compressed file 12647 stream. This string shall have the format "%s: %s", with the 12648 name of the file, followed by a colon, a space, and the 12649 description of the error. If the compressed file stream was 12650 opened by a call to gzdopen(), the format of the filename is 12651 unspecified. 12652 12653 Rationale: Although in all current implementations of libz 12654 file descriptors are named "", the code suggests 12655 that this is for debugging purposes only, and may change in 12656 a future release. 12657 12658 It is unspecified if the string returned is determined by the 12659 setting of the LC_MESSAGES category in the current locale. 12660 12661 Errors 12662 12663 None defined. 12664 12665 gzflush 12666 12667 Name 12668 12669 gzflush -- flush a compressed file stream 12670 12671 Synopsis 12672 12673 #include 12674 12675 int gzflush(gzFile file, int flush); 12676 12677 Description 12678 12679 The gzflush() function shall flush pending output to the 12680 compressed file stream identified by file, which must be open 12681 for writing. 12682 12683 Flush Operation 12684 12685 The parameter flush determines which compressed bits are added 12686 to the output file. If flush is Z_NO_FLUSH, gzflush() may 12687 return with some data pending output, and not yet written to 12688 the file. 12689 12690 If flush is Z_SYNC_FLUSH, gzflush() shall flush all pending 12691 output to file and align the output to a byte boundary. There 12692 may still be data pending compression that is not flushed. 12693 12694 If flush is Z_FULL_FLUSH, all output shall be flushed, as for 12695 Z_SYNC_FLUSH, and the compression state shall be reset. There 12696 may still be data pending compression that is not flushed. 12697 12698 Rationale: Z_SYNC_FLUSH is intended to ensure that the 12699 compressed data contains all the data compressed so far, 12700 and allows a decompressor to reconstruct all of the input 12701 data. Z_FULL_FLUSH allows decompression to restart from 12702 this point if the previous compressed data has been lost or 12703 damaged. Flushing is likely to degrade the performance of 12704 the compression system, and should only be used where 12705 necessary. 12706 12707 If flush is set to Z_FINISH, all pending uncompressed data 12708 shall be compressed and all output shall be flushed. 12709 12710 Return Value 12711 12712 On success, gzflush() shall return the value Z_OK. Otherwise 12713 gzflush() shall return a value to indicate the error, and may 12714 set the error number associated with the compressed file 12715 stream file. 12716 12717 Note: If flush is set to Z_FINISH and the flush operation 12718 is successful, gzflush() will return Z_OK, but the 12719 compressed file stream error value may be set to 12720 Z_STREAM_END. 12721 12722 Errors 12723 12724 On error, gzwrite() shall return an error value, and may set 12725 the error number associated with the stream identified by file 12726 to indicate the error. Applications may use gzerror() to 12727 access this error value. 12728 12729 Z_ERRNO 12730 An underlying base library function has indicated an 12731 error. The global variable errno may be examined for 12732 further information. 12733 12734 Z_STREAM_ERROR 12735 The stream is invalid, is not open for writing, or is 12736 in an invalid state. 12737 12738 Z_BUF_ERROR 12739 no compression progress is possible (see deflate()). 12740 12741 Z_MEM_ERROR 12742 Insufficient memory available to compress. 12743 12744 gzgetc 12745 12746 Name 12747 12748 gzgetc -- read a character from a compressed file 12749 12750 Synopsis 12751 12752 #include 12753 12754 int gzgetc (gzFile file); 12755 12756 Description 12757 12758 The gzgetc() function shall read the next single character 12759 from the compressed file stream referenced by file, which 12760 shall have been opened in a read mode (see gzopen() and 12761 gzdopen()). 12762 12763 Return Value 12764 12765 On success, gzgetc() shall return the uncompressed character 12766 read, otherwise, on end of file or error, gzgetc() shall 12767 return -1. 12768 12769 Errors 12770 12771 On end of file or error, gzgetc() shall return -1. Further 12772 information can be found by calling gzerror() with a pointer 12773 to the compressed file stream. 12774 12775 gzgets 12776 12777 Name 12778 12779 gzgets -- read a string from a compressed file 12780 12781 Synopsis 12782 12783 #include 12784 12785 char * gzgets (gzFile file, char * buf, int len); 12786 12787 Description 12788 12789 The gzgets() function shall attempt to read data from the 12790 compressed file stream file, uncompressing it into buf until 12791 either len-1 bytes have been inserted into buf, or until a 12792 newline character has been uncompressed into buf. A null byte 12793 shall be appended to the uncompressed data. The file shall 12794 have been opened in for reading (see gzopen() and gzdopen()). 12795 12796 Return Value 12797 12798 On success, gzgets() shall return a pointer to buf. Otherwise, 12799 gzgets() shall return Z_NULL. Applications may examine the 12800 cause using gzerror(). 12801 12802 Errors 12803 12804 On error, gzgets() shall return Z_NULL. The following 12805 conditions shall always be treated as an error: 12806 12807 file is NULL, or does not refer to a file open for reading; 12808 buf is NULL; 12809 len is less than or equal to zero. 12810 12811 gzopen 12812 12813 Name 12814 12815 gzopen -- open a compressed file 12816 12817 Synopsis 12818 12819 #include 12820 12821 gzFile gzopen (const char *path , const char *mode ); 12822 12823 Description 12824 12825 The gzopen() function shall open the compressed file named by 12826 path. The mode argument is based on that of fopen(), but the 12827 mode parameter may also contain the following characters: 12828 12829 digit 12830 set the compression level to digit. A low value (e.g. 12831 1) means high speed, while a high value (e.g. 9) means 12832 high compression. A compression level of 0 (zero) means 12833 no compression. See defaultInit2_() for further 12834 details. 12835 12836 [fhR] 12837 set the compression strategy to [fhR]. The letter f 12838 corresponds to filtered data, the letter h corresponds 12839 to Huffman only compression, and the letter R 12840 corresponds to Run Length Encoding. See defaultInit2_() 12841 for further details. 12842 12843 If path refers to an uncompressed file, and mode refers to a 12844 read mode, gzopen() shall attempt to open the file and return 12845 a gzFile object suitable for reading directly from the file 12846 without any decompression. 12847 12848 If path or mode is NULL, or if mode does not contain one of r, 12849 w, or a, gzopen() shall return Z_NULL, and need not set any 12850 other error condition. 12851 12852 The gzFile object is also referred to as a compressed file 12853 stream. 12854 12855 Example 12856 12857 gzopen("file.gz", "w6h"); 12858 12859 Attempt to create a new compressed file, file.gz, at 12860 compression level 6 using Huffman only compression. 12861 12862 Return Value 12863 12864 On success, gzopen() shall return a gzFile object (also known 12865 as a compressed file stream). On failure, gzopen() shall 12866 return Z_NULL and may set errno accordingly. 12867 12868 Note: At version 1.2.2, zlib does not set errno for several 12869 error conditions. Applications may not be able to determine 12870 the cause of an error. 12871 12872 Errors 12873 12874 On error, gzopen() may set the global variable errno to 12875 indicate the error. 12876 12877 gzprintf 12878 12879 Name 12880 12881 gzprintf -- format data and compress 12882 12883 Synopsis 12884 12885 #include 12886 12887 int gzprintf (gzFile file, const char * fmt, ...); 12888 12889 Description 12890 12891 The gzprintf() function shall format data as for fprintf(), 12892 and write the resulting string to the compressed file stream 12893 file. 12894 12895 Return Value 12896 12897 The gzprintf() function shall return the number of 12898 uncompressed bytes actually written, or a value less than or 12899 equal to 0 in the event of an error. 12900 12901 Errors 12902 12903 If file is NULL, or refers to a compressed file stream that 12904 has not been opened for writing, gzprintf() shall return 12905 Z_STREAM_ERROR. Otherwise, errors are as for gzwrite(). 12906 12907 gzputc 12908 12909 Name 12910 12911 gzputc -- write character to a compressed file 12912 12913 Synopsis 12914 12915 #include 12916 12917 int gzputc (gzFile file, int c); 12918 12919 Description 12920 12921 The gzputc() function shall write the single character c, 12922 converted from integer to unsigned character, to the 12923 compressed file referenced by file, which shall have been 12924 opened in a write mode (see gzopen() and gzdopen()). 12925 12926 Return Value 12927 12928 On success, gzputc() shall return the value written, otherwise 12929 gzputc() shall return -1. 12930 12931 Errors 12932 12933 On error, gzputc() shall return -1. 12934 12935 gzputs 12936 12937 Name 12938 12939 gzputs -- string write to a compressed file 12940 12941 Synopsis 12942 12943 #include 12944 12945 int gzputs (gzFile file, const char * s); 12946 12947 Description 12948 12949 The gzputs() function shall write the null terminated string s 12950 to the compressed file referenced by file, which shall have 12951 been opened in a write mode (see gzopen() and gzdopen()). The 12952 terminating null character shall not be written. The gzputs() 12953 function shall return the number of uncompressed bytes 12954 actually written. 12955 12956 Return Value 12957 12958 On success, gzputs() shall return the number of uncompressed 12959 bytes actually written to file. On error gzputs() shall return 12960 a value less than or equal to 0. Applications may examine the 12961 cause using gzerror(). 12962 12963 Errors 12964 12965 On error, gzputs() shall set the error number associated with 12966 the stream identified by file to indicate the error. 12967 Applications should use gzerror() to access this error value. 12968 If file is NULL, gzputs() shall return Z_STREAM_ERR. 12969 12970 Z_ERRNO 12971 An underlying base library function has indicated an 12972 error. The global variable errno may be examined for 12973 further information. 12974 12975 Z_STREAM_ERROR 12976 The stream is invalid, is not open for writing, or is 12977 in an invalid state. 12978 12979 Z_BUF_ERROR 12980 no compression progress is possible (see deflate()). 12981 12982 Z_MEM_ERROR 12983 Insufficient memory available to compress. 12984 12985 gzread 12986 12987 Name 12988 12989 gzread -- read from a compressed file 12990 12991 Synopsis 12992 12993 #include 12994 12995 int gzread (gzFile file, voidp buf, unsigned int len); 12996 12997 Description 12998 12999 The gzread() function shall read data from the compressed file 13000 referenced by file, which shall have been opened in a read 13001 mode (see gzopen() and gzdopen()). The gzread() function shall 13002 read data from file, and uncompress it into buf. At most, len 13003 bytes of uncompressed data shall be copied to buf. If the file 13004 is not compressed, gzread() shall simply copy data from file 13005 to buf without alteration. 13006 13007 Return Value 13008 13009 On success, gzread() shall return the number of bytes 13010 decompressed into buf. If gzread() returns 0, either the 13011 end-of-file has been reached or an underlying read error has 13012 occurred. Applications should use gzerror() or gzeof() to 13013 determine which occurred. On other errors, gzread() shall 13014 return a value less than 0 and and applications may examine 13015 the cause using gzerror(). 13016 13017 Errors 13018 13019 On error, gzread() shall set the error number associated with 13020 the stream identified by file to indicate the error. 13021 Applications should use gzerror() to access this error value. 13022 13023 Z_ERRNO 13024 An underlying base library function has indicated an 13025 error. The global variable errno may be examined for 13026 further information. 13027 13028 Z_STREAM_END 13029 End of file has been reached on input. 13030 13031 Z_DATA_ERROR 13032 A CRC error occurred when reading data; the file is 13033 corrupt. 13034 13035 Z_STREAM_ERROR 13036 The stream is invalid, or is in an invalid state. 13037 13038 Z_NEED_DICT 13039 A dictionary is needed (see inflateSetDictionary()). 13040 13041 Z_MEM_ERROR 13042 Insufficient memory available to decompress. 13043 13044 gzrewind 13045 13046 Name 13047 13048 gzrewind -- reset the file-position indicator on a compressed 13049 file stream 13050 13051 Synopsis 13052 13053 #include 13054 13055 int gzrewind(gzFile file); 13056 13057 Description 13058 13059 The gzrewind() function shall set the starting position for 13060 the next read on compressed file stream file to the beginning 13061 of file. file must be open for reading. 13062 13063 gzrewind() is equivalent to 13064 (int)gzseek(file, 0L, SEEK_SET) 13065 13066 . 13067 13068 Return Value 13069 13070 On success, gzrewind() shall return 0. On error, gzrewind() 13071 shall return -1, and may set the error value for file 13072 accordingly. 13073 13074 Errors 13075 13076 On error, gzrewind() shall return -1, indicating that file is 13077 NULL, or does not represent an open compressed file stream, or 13078 represents a compressed file stream that is open for writing 13079 and is not currently at the beginning of file. 13080 13081 gzseek 13082 13083 Name 13084 13085 gzseek -- reposition a file-position indicator in a compressed 13086 file stream 13087 13088 Synopsis 13089 13090 #include 13091 13092 z_off_t gzseek(gzFile file, z_off_t offset, int whence); 13093 13094 Description 13095 13096 The gzseek() function shall set the file-position indicator 13097 for the compressed file stream file. The file-position 13098 indicator controls where the next read or write operation on 13099 the compressed file stream shall take place. The offset 13100 indicates a byte offset in the uncompressed data. The whence 13101 parameter may be one of: 13102 13103 SEEK_SET 13104 the offset is relative to the start of the uncompressed 13105 data. 13106 13107 SEEK_CUR 13108 the offset is relative to the current positition in the 13109 uncompressed data. 13110 13111 Note: The value SEEK_END need not be supported. 13112 13113 If the file is open for writing, the new offset must be 13114 greater than or equal to the current offset. In this case, 13115 gzseek() shall compress a sequence of null bytes to fill the 13116 gap from the previous offset to the new offset. 13117 13118 Return Value 13119 13120 On success, gzseek() shall return the resulting offset in the 13121 file expressed as a byte position in the uncompressed data 13122 stream. On error, gzseek() shall return -1, and may set the 13123 error value for file accordingly. 13124 13125 Errors 13126 13127 On error, gzseek() shall return -1. The following conditions 13128 shall always result in an error: 13129 13130 * file is NULL 13131 * file does not represent an open compressed file stream. 13132 * file refers to a compressed file stream that is open for 13133 writing, and the newly computed offset is less than the 13134 current offset. 13135 * The newly computed offset is less than zero. 13136 * whence is not one of the supported values. 13137 13138 Application Usage (informative) 13139 13140 If file is open for reading, the implementation may still need 13141 to uncompress all of the data up to the new offset. As a 13142 result, gzseek() may be extremely slow in some circumstances. 13143 13144 gzsetparams 13145 13146 Name 13147 13148 gzsetparams -- dynamically set compression parameters 13149 13150 Synopsis 13151 13152 #include 13153 13154 int gzsetparams (gzFile file, int level, int strategy); 13155 13156 Description 13157 13158 The gzsetparams() function shall set the compression level and 13159 compression strategy on the compressed file stream referenced 13160 by file. The compressed file stream shall have been opened in 13161 a write mode. The level and strategy are as defined in 13162 deflateInit2_. If there is any data pending writing, it shall 13163 be flushed before the parameters are updated. 13164 13165 Return Value 13166 13167 On success, the gzsetparams() function shall return Z_OK. 13168 13169 Errors 13170 13171 On error, gzsetparams() shall return one of the following 13172 error indications: 13173 13174 Z_STREAM_ERROR 13175 Invalid parameter, or file not open for writing. 13176 13177 Z_BUF_ERROR 13178 An internal inconsistency was detected while flushing 13179 the previous buffer. 13180 13181 gztell 13182 13183 Name 13184 13185 gztell -- find position on a compressed file stream 13186 13187 Synopsis 13188 13189 #include 13190 13191 z_off_t gztell (gzFile file ); 13192 13193 Description 13194 13195 The gztell() function shall return the starting position for 13196 the next read or write operation on compressed file stream 13197 file. This position represents the number of bytes from the 13198 beginning of file in the uncompressed data. 13199 13200 gztell() is equivalent to 13201 gzseek(file, 0L, SEEK_SET) 13202 13203 . 13204 13205 Return Value 13206 13207 gztell() shall return the current offset in the file expressed 13208 as a byte position in the uncompressed data stream. On error, 13209 gztell() shall return -1, and may set the error value for file 13210 accordingly. 13211 13212 Errors 13213 13214 On error, gztell() shall return -1, indicating that file is 13215 NULL, or does not represent an open compressed file stream. 13216 13217 gzwrite 13218 13219 Name 13220 13221 gzwrite -- write to a compressed file 13222 13223 Synopsis 13224 13225 #include 13226 13227 int gzwrite (gzFile file, voidpc buf, unsigned int len); 13228 13229 Description 13230 13231 The gzwrite() function shall write data to the compressed file 13232 referenced by file, which shall have been opened in a write 13233 mode (see gzopen() and gzdopen()). On entry, buf shall point 13234 to a buffer containing lenbytes of uncompressed data. The 13235 gzwrite() function shall compress this data and write it to 13236 file. The gzwrite() function shall return the number of 13237 uncompressed bytes actually written. 13238 13239 Return Value 13240 13241 On success, gzwrite() shall return the number of uncompressed 13242 bytes actually written to file. On error gzwrite() shall 13243 return a value less than or equal to 0. Applications may 13244 examine the cause using gzerror(). 13245 13246 Errors 13247 13248 On error, gzwrite() shall set the error number associated with 13249 the stream identified by file to indicate the error. 13250 Applications should use gzerror() to access this error value. 13251 13252 Z_ERRNO 13253 An underlying base library function has indicated an 13254 error. The global variable errno may be examined for 13255 further information. 13256 13257 Z_STREAM_ERROR 13258 The stream is invalid, is not open for writing, or is 13259 in an invalid state. 13260 13261 Z_BUF_ERROR 13262 no compression progress is possible (see deflate()). 13263 13264 Z_MEM_ERROR 13265 Insufficient memory available to compress. 13266 13267 inflate 13268 13269 Name 13270 13271 inflate -- decompress data 13272 13273 Synopsis 13274 13275 #include 13276 13277 int inflate(z_streamp stream, int flush); 13278 13279 Description 13280 13281 The inflate() function shall attempt to decompress data until 13282 either the input buffer is empty or the output buffer is full. 13283 The stream references a z_stream structure. Before the first 13284 call to inflate(), this structure should have been initialized 13285 by a call to inflateInit2_(). 13286 13287 Note: inflateInit2_() is only in the binary standard; 13288 source level applications should initialize stream via a 13289 call to inflateInit() or inflateInit2(). 13290 13291 In addition, the stream input and output buffers should have 13292 been initialized as follows: 13293 13294 next_in 13295 should point to the data to be decompressed. 13296 13297 avail_in 13298 should contain the number of bytes of data in the 13299 buffer referenced by next_in. 13300 13301 next_out 13302 should point to a buffer where decompressed data may be 13303 placed. 13304 13305 avail_out 13306 should contain the size in bytes of the buffer 13307 referenced by next_out 13308 13309 The inflate() function shall perform one or both of the 13310 following actions: 13311 13312 1. Decompress input data from next_in and update next_in, 13313 avail_in and total_in to reflect the data that has been 13314 decompressed. 13315 2. Fill the output buffer referenced by next_out, and update 13316 next_out, avail_out, and total_out to reflect the 13317 decompressed data that has been placed there. If flush is 13318 not Z_NO_FLUSH, and avail_out indicates that there is 13319 still space in output buffer, this action shall always 13320 occur (see below for further details). 13321 13322 The inflate() function shall return when either avail_in 13323 reaches zero (indicating that all the input data has been 13324 compressed), or avail_out reaches zero (indicating that the 13325 output buffer is full). 13326 13327 On success, the inflate() function shall set the adler field 13328 of the stream to the Adler-32 checksum of all the input data 13329 compressed so far (represented by total_in). 13330 13331 Flush Operation 13332 13333 The parameter flush determines when uncompressed bytes are 13334 added to the output buffer in next_out. If flush is 13335 Z_NO_FLUSH, inflate() may return with some data pending 13336 output, and not yet added to the output buffer. 13337 13338 If flush is Z_SYNC_FLUSH, inflate() shall flush all pending 13339 output to next_out, and update next_out and avail_out 13340 accordingly. 13341 13342 If flush is set to Z_BLOCK, inflate() shall stop adding data 13343 to the output buffer if and when the next compressed block 13344 boundary is reached (see RFC 1951: DEFLATE Compressed Data 13345 Format Specification). 13346 13347 If flush is set to Z_FINISH, all of the compressed input shall 13348 be decompressed and added to the output. If there is 13349 insufficient output space (i.e. the compressed input data 13350 uncompresses to more than avail_out bytes), then inflate() 13351 shall fail and return Z_BUF_ERROR. 13352 13353 Return Value 13354 13355 On success, inflate() shall return Z_OK if decompression 13356 progress has been made, or Z_STREAM_END if all of the input 13357 data has been decompressed and there was sufficient space in 13358 the output buffer to store the uncompressed result. On error, 13359 inflate() shall return a value to indicate the error. 13360 13361 Note: If inflate() returns Z_OK and has set avail_out to 13362 zero, the function should be called again with the same 13363 value for flush, and with updated next_out and avail_out 13364 until inflate() returns with either Z_OK or Z_STREAM_END 13365 and a non-zero avail_out. 13366 13367 On success, inflate() shall set the adler to the Adler-32 13368 checksum of the output produced so far (i.e. total_out bytes). 13369 13370 Errors 13371 13372 On error, inflate() shall return a value as described below, 13373 and may set the msg field of stream to point to a string 13374 describing the error: 13375 13376 Z_BUF_ERROR 13377 No progress is possible; either avail_in or avail_out 13378 was zero. 13379 13380 Z_MEM_ERROR 13381 Insufficient memory. 13382 13383 Z_STREAM_ERROR 13384 The state (as represented in stream) is inconsistent, 13385 or stream was NULL. 13386 13387 Z_NEED_DICT 13388 A preset dictionary is required. The adler field shall 13389 be set to the Adler-32 checksum of the dictionary 13390 chosen by the compressor. 13391 13392 inflateEnd 13393 13394 Name 13395 13396 inflateEnd -- free decompression stream state 13397 13398 Synopsis 13399 13400 #include 13401 13402 int inflateEnd(z_streamp stream); 13403 13404 Description 13405 13406 The inflateEnd() function shall free all allocated state 13407 information referenced by stream. All pending output is 13408 discarded, and unprocessed input is ignored. 13409 13410 Return Value 13411 13412 On success, inflateEnd() shall return Z_OK. Otherwise it shall 13413 return Z_STREAM_ERROR to indicate the error. 13414 13415 Errors 13416 13417 On error, inflateEnd() shall return Z_STREAM_ERROR. The 13418 following conditions shall be treated as an error: 13419 13420 * The state in stream is inconsistent. 13421 * stream is NULL. 13422 * The zfree function pointer is NULL. 13423 13424 inflateInit2_ 13425 13426 Name 13427 13428 inflateInit2_ -- initialize decompression system 13429 13430 Synopsis 13431 13432 #include 13433 13434 int inflateInit2_ (z_streamp strm, int windowBits, char * 13435 version, int stream_size); 13436 13437 Description 13438 13439 The inflateInit2_() function shall initialize the 13440 decompression system. On entry, strm shall refer to a user 13441 supplied z_stream object (a z_stream_s structure). The 13442 following fields shall be set on entry: 13443 13444 zalloc 13445 a pointer to an alloc_func function, used to allocate 13446 state information. If this is NULL, a default 13447 allocation function will be used. 13448 13449 zfree 13450 a pointer to a free_func function, used to free memory 13451 allocated by the zalloc function. If this is NULL a 13452 default free function will be used. 13453 13454 opaque 13455 If alloc_func is not NULL, opaque is a user supplied 13456 pointer to data that will be passed to the alloc_func 13457 and free_func functions. 13458 13459 If the version requested is not compatible with the version 13460 implemented, or if the size of the z_stream_s structure 13461 provided in stream_size does not match the size in the library 13462 implementation, inflateInit2_() shall fail, and return 13463 Z_VERSION_ERROR. 13464 13465 The windowBits parameter shall be a base 2 logarithm of the 13466 maximum window size to use, and shall be a value between 8 and 13467 15. If the input data was compressed with a larger window 13468 size, subsequent attempts to decompress this data will fail 13469 with Z_DATA_ERROR, rather than try to allocate a larger 13470 window. 13471 13472 The inflateInit2_() function is not in the source standard; it 13473 is only in the binary standard. Source applications should use 13474 the inflateInit2() macro. 13475 13476 Return Value 13477 13478 On success, the inflateInit2_() function shall return Z_OK. 13479 Otherwise, inflateInit2_() shall return a value as described 13480 below to indicate the error. 13481 13482 Errors 13483 13484 On error, inflateInit2_() shall return one of the following 13485 error indicators: 13486 13487 Z_STREAM_ERROR 13488 Invalid parameter. 13489 13490 Z_MEM_ERROR 13491 Insufficient memory available. 13492 13493 Z_VERSION_ERROR 13494 The version requested is not compatible with the 13495 library version, or the z_stream size differs from that 13496 used by the library. 13497 13498 In addition, the msg field of the strm may be set to an error 13499 message. 13500 13501 inflateInit_ 13502 13503 Name 13504 13505 inflateInit_ -- initialize decompression system 13506 13507 Synopsis 13508 13509 #include 13510 13511 int inflateInit_(z_streamp stream, const char * version, int 13512 stream_size); 13513 13514 Description 13515 13516 The inflateInit_() function shall initialize the decompression 13517 system. On entry, stream shall refer to a user supplied 13518 z_stream object (a z_stream_s structure). The following fields 13519 shall be set on entry: 13520 13521 zalloc 13522 a pointer to an alloc_func function, used to allocate 13523 state information. If this is NULL, a default 13524 allocation function will be used. 13525 13526 zfree 13527 a pointer to a free_func function, used to free memory 13528 allocated by the zalloc function. If this is NULL a 13529 default free function will be used. 13530 13531 opaque 13532 If alloc_func is not NULL, opaque is a user supplied 13533 pointer to data that will be passed to the alloc_func 13534 and free_func functions. 13535 13536 If the version requested is not compatible with the version 13537 implemented, or if the size of the z_stream_s structure 13538 provided in stream_size does not match the size in the library 13539 implementation, inflateInit_() shall fail, and return 13540 Z_VERSION_ERROR. 13541 13542 The inflateInit_() function is not in the source standard; it 13543 is only in the binary standard. Source applications should use 13544 the inflateInit() macro. 13545 13546 The inflateInit_() shall be equivalent to 13547 inflateInit2_(strm, DEF_WBITS, version, stream_size); 13548 13549 Return Value 13550 13551 On success, the inflateInit_() function shall return Z_OK. 13552 Otherwise, inflateInit_() shall return a value as described 13553 below to indicate the error. 13554 13555 Errors 13556 13557 On error, inflateInit_() shall return one of the following 13558 error indicators: 13559 13560 Z_STREAM_ERROR 13561 Invalid parameter. 13562 13563 Z_MEM_ERROR 13564 Insufficient memory available. 13565 13566 Z_VERSION_ERROR 13567 The version requested is not compatible with the 13568 library version, or the z_stream size differs from that 13569 used by the library. 13570 13571 In addition, the msg field of the strm may be set to an error 13572 message. 13573 13574 inflateReset 13575 13576 Name 13577 13578 inflateReset -- reset decompression stream state 13579 13580 Synopsis 13581 13582 #include 13583 13584 int inflateReset(z_streamp stream); 13585 13586 Description 13587 13588 The inflateReset() function shall reset all state associated 13589 with stream. All pending output shall be discarded, and the 13590 counts of processed bytes (total_in and total_out) shall be 13591 reset to zero. 13592 13593 Return Value 13594 13595 On success, inflateReset() shall return Z_OK. Otherwise it 13596 shall return Z_STREAM_ERROR to indicate the error. 13597 13598 Errors 13599 13600 On error, inflateReset() shall return Z_STREAM_ERROR. The 13601 following conditions shall be treated as an error: 13602 13603 * The state in stream is inconsistent or inappropriate. 13604 * stream is NULL. 13605 13606 inflateSetDictionary 13607 13608 Name 13609 13610 inflateSetDictionary -- initialize decompression dictionary 13611 13612 Synopsis 13613 13614 #include 13615 13616 int inflateSetDictionary(z_streamp stream, const Bytef * 13617 dictionary, uInt dictlen); 13618 13619 Description 13620 13621 The inflateSetDictionary() function shall initialize the 13622 decompression dictionary associated with stream using the 13623 dictlen bytes referenced by dictionary. 13624 13625 The inflateSetDictionary() function should be called 13626 immediately after a call to inflate() has failed with return 13627 value Z_NEED_DICT. The dictionary must have the same Adler-32 13628 checksum as the dictionary used for the compression (see 13629 deflateSetDictionary()). 13630 13631 stream shall reference an initialized decompression stream, 13632 with total_in zero (i.e. no data has been decompressed since 13633 the stream was initialized). 13634 13635 Return Value 13636 13637 On success, inflateSetDictionary() shall return Z_OK. 13638 Otherwise it shall return a value as indicated below. 13639 13640 Errors 13641 13642 On error, inflateSetDictionary() shall return a value as 13643 described below: 13644 13645 Z_STREAM_ERROR 13646 The state in stream is inconsistent, or stream was 13647 NULL. 13648 13649 Z_DATA_ERROR 13650 The Adler-32 checksum of the supplied dictionary does 13651 not match that used for the compression. 13652 13653 Application Usage (informative) 13654 13655 The application should provide a dictionary consisting of 13656 strings {{{ed note: do we really mean "strings"? Null 13657 terminated?}}} that are likely to be encountered in the data 13658 to be compressed. The application should ensure that the 13659 dictionary is sorted such that the most commonly used strings 13660 occur at the end of the dictionary. 13661 13662 The use of a dictionary is optional; however if the data to be 13663 compressed is relatively short and has a predictable 13664 structure, the use of a dictionary can substantially improve 13665 the compression ratio. 13666 13667 inflateSync 13668 13669 Name 13670 13671 inflateSync -- advance compression stream to next sync point 13672 13673 Synopsis 13674 13675 #include 13676 13677 int inflateSync(z_streamp stream); 13678 13679 Description 13680 13681 The inflateSync() function shall advance through the 13682 compressed data in stream, skipping any invalid compressed 13683 data, until the next full flush point is reached, or all input 13684 is exhausted. See the description for deflate() with flush 13685 level Z_FULL_FLUSH. No output is placed in next_out. 13686 13687 Return Value 13688 13689 On success, inflateSync() shall return Z_OK, and update the 13690 next_in,, avail_in, and, total_in fields of stream to reflect 13691 the number of bytes of compressed data that have been skipped. 13692 Otherwise, inflateSync() shall return a value as described 13693 below to indicate the error. 13694 13695 Errors 13696 13697 On error, inflateSync() shall return a value as described 13698 below: 13699 13700 Z_STREAM_ERROR 13701 The state (as represented in stream) is inconsistent, 13702 or stream was NULL. 13703 13704 Z_BUF_ERROR 13705 There is no data available to skip over. 13706 13707 Z_DATA_ERROR 13708 No sync point was found. 13709 13710 inflateSyncPoint 13711 13712 Name 13713 13714 inflateSyncPoint -- test for synchronization point 13715 13716 Synopsis 13717 13718 #include 13719 13720 int inflateSyncPoint(z_streamp stream); 13721 13722 Description 13723 13724 The inflateSyncPoint() function shall return a non-zero calue 13725 if the compressed data stream referenced by stream is at a 13726 synchronization point. 13727 13728 Return Value 13729 13730 If the compressed data in stream is at a synchronization point 13731 (see deflate() with a flush level of Z_SYNC_FLUSH or 13732 Z_FULL_FLUSH), inflateSyncPoint() shall return a non-zero 13733 value, other than Z_STREAM_ERROR. Otherwise, if the stream is 13734 valid, inflateSyncPoint() shall return 0. If stream is 13735 invalid, or in an invalid state, inflateSyncPoint() shall 13736 return Z_STREAM_ERROR to indicate the error. 13737 13738 Errors 13739 13740 On error, inflateSyncPoint() shall return a value as described 13741 below: 13742 13743 Z_STREAM_ERROR 13744 The state (as represented in stream) is inconsistent, 13745 or stream was NULL. 13746 13747 uncompress 13748 13749 Name 13750 13751 uncompress -- uncompress data 13752 13753 Synopsis 13754 13755 #include 13756 13757 int uncompress(Bytef * dest, uLongf * destLen, const Bytef * 13758 source, uLong sourceLen); 13759 13760 Description 13761 13762 The uncompress() function shall attempt to uncompress 13763 sourceLen bytes of data in the buffer source, placing the 13764 result in the buffer dest. 13765 13766 On entry, destLen should point to a value describing the size 13767 of the dest buffer. The application should ensure that this 13768 value is large enough to hold the entire uncompressed data. 13769 13770 Note: The LSB does not describe any mechanism by which a 13771 compressor can communicate the size required to the 13772 uncompressor. 13773 13774 On successful exit, the variable referenced by destLen shall 13775 be updated to hold the length of uncompressed data in dest. 13776 13777 Return Value 13778 13779 On success, uncompress() shall return Z_OK. Otherwise, 13780 uncompress() shall return a value to indicate the error. 13781 13782 Errors 13783 13784 On error, uncompress() shall return a value as described 13785 below: 13786 13787 Z_BUF_ERROR 13788 The buffer dest was not large enough to hold the 13789 uncompressed data. 13790 13791 Z_MEM_ERROR 13792 Insufficient memory. 13793 13794 Z_DATA_ERROR 13795 The compressed data (referenced by source) was 13796 corrupted. 13797 13798 zError 13799 13800 Name 13801 13802 zError -- translate error number to string 13803 13804 Synopsis 13805 13806 #include 13807 13808 const char * zError(int err); 13809 13810 Description 13811 13812 The zError() function shall return the string identifying the 13813 error associated with err. This allows for conversion from 13814 error code to string for functions such as compress() and 13815 uncompress(), that do not always set the string version of an 13816 error. 13817 13818 Return Value 13819 13820 The zError() function shall return a the string identifying 13821 the error associated with err, or NULL if err is not a valid 13822 error code. 13823 13824 It is unspecified if the string returned is determined by the 13825 setting of the LC_MESSAGES category in the current locale. 13826 13827 Errors 13828 13829 None defined. 13830 13831 zlibVersion 13832 13833 Name 13834 13835 zlibVersion -- discover library version at run time 13836 13837 Synopsis 13838 13839 #include 13840 13841 const char * zlibVersion (void); 13842 13843 Description 13844 13845 The zlibVersion() function shall return the string identifying 13846 the interface version at the time the library was built. 13847 13848 Applications should compare the value returned from 13849 zlibVersion() with the macro constant ZLIB_VERSION for 13850 compatibility. 13851 13852 Return Value 13853 13854 The zlibVersion() function shall return a the string 13855 identifying the version of the library currently implemented. 13856 13857 Errors 13858 13859 None defined. 13860 _________________________________________________________ 13861 13862 8.4. Interfaces for libncurses 13863 13864 Table 8-3 defines the library name and shared object name for 13865 the libncurses library 13866 13867 Table 8-3. libncurses Definition 13868 Library: libncurses 13869 SONAME: libncurses.so.5 13870 13871 The behavior of the interfaces in this library is specified by 13872 the following specifications: 13873 13874 X/Open Curses 13875 _________________________________________________________ 13876 13877 8.4.1. Curses 13878 _________________________________________________________ 13879 13880 8.4.1.1. Interfaces for Curses 13881 13882 An LSB conforming implementation shall provide the generic 13883 functions for Curses specified in Table 8-4, with the full 13884 functionality as described in the referenced underlying 13885 specification. 13886 13887 Table 8-4. libncurses - Curses Function Interfaces 13888 addch [1] has_ic [1] mvwaddchnstr [1] scr_init [1] vwscanw [1] 13889 addchnstr [1] has_il [1] mvwaddchstr [1] scr_restore [1] 13890 waddch [1] 13891 addchstr [1] hline [1] mvwaddnstr [1] scr_set [1] waddchnstr 13892 [1] 13893 addnstr [1] idcok [1] mvwaddstr [1] scrl [1] waddchstr [1] 13894 addstr [1] idlok [1] mvwchgat [1] scroll [1] waddnstr [1] 13895 attr_get [1] immedok [1] mvwdelch [1] scrollok [1] waddstr [1] 13896 attr_off [1] inch [1] mvwgetch [1] set_curterm [1] wattr_get 13897 [1] 13898 attr_on [1] inchnstr [1] mvwgetnstr [1] set_term [1] wattr_off 13899 [1] 13900 attr_set [1] inchstr [1] mvwgetstr [1] setscrreg [1] wattr_on 13901 [1] 13902 attroff [1] init_color [1] mvwhline [1] setupterm [1] 13903 wattr_set [1] 13904 attron [1] init_pair [1] mvwin [1] slk_attr_set [1] wattroff 13905 [1] 13906 attrset [1] initscr [1] mvwinch [1] slk_attroff [1] wattron 13907 [1] 13908 baudrate [1] innstr [1] mvwinchnstr [1] slk_attron [1] 13909 wattrset [1] 13910 beep [1] insch [1] mvwinchstr [1] slk_attrset [1] wbkgd [1] 13911 bkgd [1] insdelln [1] mvwinnstr [1] slk_clear [1] wbkgdset [1] 13912 bkgdset [1] insertln [1] mvwinsch [1] slk_color [1] wborder 13913 [1] 13914 border [1] insnstr [1] mvwinsnstr [1] slk_init [1] wchgat [1] 13915 box [1] insstr [1] mvwinsstr [1] slk_label [1] wclear [1] 13916 can_change_color [1] instr [1] mvwinstr [1] slk_noutrefresh 13917 [1] wclrtobot [1] 13918 cbreak [1] intrflush [1] mvwprintw [1] slk_refresh [1] 13919 wclrtoeol [1] 13920 chgat [1] is_linetouched [1] mvwscanw [1] slk_restore [1] 13921 wcolor_set [1] 13922 clear [1] is_wintouched [1] mvwvline [1] slk_set [1] 13923 wcursyncup [1] 13924 clearok [1] isendwin [1] napms [1] slk_touch [1] wdelch [1] 13925 clrtobot [1] keyname [1] newpad [1] standend [1] wdeleteln [1] 13926 clrtoeol [1] keypad [1] newterm [1] standout [1] wechochar [1] 13927 color_content [1] killchar [1] newwin [1] start_color [1] 13928 werase [1] 13929 color_set [1] leaveok [1] nl [1] subpad [1] wgetch [1] 13930 copywin [1] longname [1] nocbreak [1] subwin [1] wgetnstr [1] 13931 curs_set [1] meta [1] nodelay [1] syncok [1] wgetstr [1] 13932 def_prog_mode [1] move [1] noecho [1] termattrs [1] whline [1] 13933 def_shell_mode [1] mvaddch [1] nonl [1] termname [1] winch [1] 13934 del_curterm [1] mvaddchnstr [1] noqiflush [1] tgetent [1] 13935 winchnstr [1] 13936 delay_output [1] mvaddchstr [1] noraw [1] tgetflag [1] 13937 winchstr [1] 13938 delch [1] mvaddnstr [1] notimeout [1] tgetnum [1] winnstr [1] 13939 deleteln [1] mvaddstr [1] overlay [1] tgetstr [1] winsch [1] 13940 delscreen [1] mvchgat [1] overwrite [1] tgoto [1] winsdelln 13941 [1] 13942 delwin [1] mvcur [1] pair_content [1] tigetflag [1] winsertln 13943 [1] 13944 derwin [1] mvdelch [1] pechochar [1] tigetnum [1] winsnstr [1] 13945 doupdate [1] mvderwin [1] pnoutrefresh [1] tigetstr [1] 13946 winsstr [1] 13947 dupwin [1] mvgetch [1] prefresh [1] timeout [1] winstr [1] 13948 echo [1] mvgetnstr [1] printw [1] touchline [1] wmove [1] 13949 echochar [1] mvgetstr [1] putp [1] touchwin [1] wnoutrefresh 13950 [1] 13951 endwin [1] mvhline [1] putwin [1] tparm [1] wprintw [1] 13952 erase [1] mvinch [1] qiflush [1] tputs [1] wredrawln [1] 13953 erasechar [1] mvinchnstr [1] raw [1] typeahead [1] wrefresh 13954 [1] 13955 filter [1] mvinchstr [1] redrawwin [1] unctrl [1] wscanw [1] 13956 flash [1] mvinnstr [1] refresh [1] ungetch [1] wscrl [1] 13957 flushinp [1] mvinsch [1] reset_prog_mode [1] untouchwin [1] 13958 wsetscrreg [1] 13959 getbkgd [1] mvinsnstr [1] reset_shell_mode [1] use_env [1] 13960 wstandend [1] 13961 getch [1] mvinsstr [1] resetty [1] vidattr [1] wstandout [1] 13962 getnstr [1] mvinstr [1] restartterm [1] vidputs [1] wsyncdown 13963 [1] 13964 getstr [1] mvprintw [1] ripoffline [1] vline [1] wsyncup [1] 13965 getwin [1] mvscanw [1] savetty [1] vw_printw [1] wtimeout [1] 13966 halfdelay [1] mvvline [1] scanw [1] vw_scanw [1] wtouchln [1] 13967 has_colors [1] mvwaddch [1] scr_dump [1] vwprintw [1] wvline 13968 [1] 13969 13970 Referenced Specification(s) 13971 13972 [1]. X/Open Curses 13973 13974 An LSB conforming implementation shall provide the generic 13975 data interfaces for Curses specified in Table 8-5, with the 13976 full functionality as described in the referenced underlying 13977 specification. 13978 13979 Table 8-5. libncurses - Curses Data Interfaces 13980 COLORS [1] COLS [1] acs_map [1] curscr [1] 13981 COLOR_PAIRS [1] LINES [1] cur_term [1] stdscr [1] 13982 13983 Referenced Specification(s) 13984 13985 [1]. X/Open Curses 13986 _________________________________________________________ 13987 13988 8.5. Data Definitions for libncurses 13989 13990 This section defines global identifiers and their values that 13991 are associated with interfaces contained in libncurses. These 13992 definitions are organized into groups that correspond to 13993 system headers. This convention is used as a convenience for 13994 the reader, and does not imply the existence of these headers, 13995 or their content. 13996 13997 These definitions are intended to supplement those provided in 13998 the referenced underlying specifications. 13999 14000 This specification uses ISO/IEC 9899 C Language as the 14001 reference programming language, and data definitions are 14002 specified in ISO C format. The C language is used here as a 14003 convenient notation. Using a C language description of these 14004 data objects does not preclude their use by other programming 14005 languages. 14006 _________________________________________________________ 14007 14008 8.5.1. curses.h 14009 14010 #define ERR (-1) 14011 #define OK (0) 14012 #define ACS_RARROW (acs_map['+']) 14013 #define ACS_LARROW (acs_map[',']) 14014 #define ACS_UARROW (acs_map['-']) 14015 #define ACS_DARROW (acs_map['.']) 14016 #define ACS_BLOCK (acs_map['0']) 14017 #define ACS_CKBOARD (acs_map['a']) 14018 #define ACS_DEGREE (acs_map['f']) 14019 #define ACS_PLMINUS (acs_map['g']) 14020 #define ACS_BOARD (acs_map['h']) 14021 #define ACS_LANTERN (acs_map['i']) 14022 #define ACS_LRCORNER (acs_map['j']) 14023 #define ACS_URCORNER (acs_map['k']) 14024 #define ACS_ULCORNER (acs_map['l']) 14025 #define ACS_LLCORNER (acs_map['m']) 14026 #define ACS_PLUS (acs_map['n']) 14027 #define ACS_S1 (acs_map['o']) 14028 #define ACS_HLINE (acs_map['q']) 14029 #define ACS_S9 (acs_map['s']) 14030 #define ACS_LTEE (acs_map['t']) 14031 #define ACS_RTEE (acs_map['u']) 14032 #define ACS_BTEE (acs_map['v']) 14033 #define ACS_TTEE (acs_map['w']) 14034 #define ACS_VLINE (acs_map['x']) 14035 #define ACS_DIAMOND (acs_map['`']) 14036 #define ACS_BULLET (acs_map['~']) 14037 #define getmaxyx(win,y,x) (y=(win)?((win)->_maxy+1):ERR,x=(win)?( 14038 (win)->_maxx+1):ERR) 14039 #define getbegyx(win,y,x) (y=(win)?(win)->_begy:ERR,x=(win)?(win) 14040 ->_begx:ERR) 14041 #define getyx(win,y,x) (y=(win)?(win)->_cury:ERR,x=(win)?(win)->_curx: 14042 ERR) 14043 #define getparyx(win,y,x) (y=(win)?(win)->_pary:ERR,x=(win)?(win) 14044 ->_parx:ERR) 14045 14046 #define WA_ALTCHARSET A_ALTCHARSET 14047 #define WA_ATTRIBUTES A_ATTRIBUTES 14048 #define WA_BLINK A_BLINK 14049 #define WA_BOLD A_BOLD 14050 #define WA_DIM A_DIM 14051 #define WA_HORIZONTAL A_HORIZONTAL 14052 #define WA_INVIS A_INVIS 14053 #define WA_LEFT A_LEFT 14054 #define WA_LOW A_LOW 14055 #define WA_NORMAL A_NORMAL 14056 #define WA_PROTECT A_PROTECT 14057 #define WA_REVERSE A_REVERSE 14058 #define WA_RIGHT A_RIGHT 14059 #define WA_STANDOUT A_STANDOUT 14060 #define WA_TOP A_TOP 14061 #define WA_UNDERLINE A_UNDERLINE 14062 #define WA_VERTICAL A_VERTICAL 14063 #define A_REVERSE NCURSES_BITS(1UL,10) 14064 14065 #define COLOR_BLACK 0 14066 #define COLOR_RED 1 14067 #define COLOR_GREEN 2 14068 #define COLOR_YELLOW 3 14069 #define COLOR_BLUE 4 14070 #define COLOR_MAGENTA 5 14071 #define COLOR_CYAN 6 14072 #define COLOR_WHITE 7 14073 14074 #define _SUBWIN 0x01 14075 #define _ENDLINE 0x02 14076 #define _FULLWIN 0x04 14077 #define _ISPAD 0x10 14078 #define _HASMOVED 0x20 14079 14080 typedef unsigned char bool; 14081 14082 typedef unsigned long chtype; 14083 typedef struct screen SCREEN; 14084 typedef struct _win_st WINDOW; 14085 typedef chtype attr_t; 14086 typedef struct 14087 { 14088 attr_t attr; 14089 wchar_t chars[5]; 14090 } 14091 cchar_t; 14092 struct pdat 14093 { 14094 short _pad_y; 14095 short _pad_x; 14096 short _pad_top; 14097 short _pad_left; 14098 short _pad_bottom; 14099 short _pad_right; 14100 } 14101 ; 14102 14103 struct _win_st 14104 { 14105 short _cury; 14106 short _curx; 14107 short _maxy; 14108 short _maxx; 14109 short _begy; 14110 short _begx; 14111 short _flags; 14112 attr_t _attrs; 14113 chtype _bkgd; 14114 bool _notimeout; 14115 bool _clear; 14116 bool _leaveok; 14117 bool _scroll; 14118 bool _idlok; 14119 bool _idcok; 14120 bool _immed; 14121 bool _sync; 14122 bool _use_keypad; 14123 int _delay; 14124 struct ldat *_line; 14125 short _regtop; 14126 short _regbottom; 14127 int _parx; 14128 int _pary; 14129 WINDOW *_parent; 14130 struct pdat _pad; 14131 short _yoffset; 14132 cchar_t _bkgrnd; 14133 } 14134 ; 14135 #define KEY_CODE_YES 0400 14136 #define KEY_BREAK 0401 14137 #define KEY_MIN 0401 14138 #define KEY_DOWN 0402 14139 #define KEY_UP 0403 14140 #define KEY_LEFT 0404 14141 #define KEY_RIGHT 0405 14142 #define KEY_HOME 0406 14143 #define KEY_BACKSPACE 0407 14144 #define KEY_F0 0410 14145 #define KEY_DL 0510 14146 #define KEY_IL 0511 14147 #define KEY_DC 0512 14148 #define KEY_IC 0513 14149 #define KEY_EIC 0514 14150 #define KEY_CLEAR 0515 14151 #define KEY_EOS 0516 14152 #define KEY_EOL 0517 14153 #define KEY_SF 0520 14154 #define KEY_SR 0521 14155 #define KEY_NPAGE 0522 14156 #define KEY_PPAGE 0523 14157 #define KEY_STAB 0524 14158 #define KEY_CTAB 0525 14159 #define KEY_CATAB 0526 14160 #define KEY_ENTER 0527 14161 #define KEY_SRESET 0530 14162 #define KEY_RESET 0531 14163 #define KEY_PRINT 0532 14164 #define KEY_LL 0533 14165 #define KEY_A1 0534 14166 #define KEY_A3 0535 14167 #define KEY_B2 0536 14168 #define KEY_C1 0537 14169 #define KEY_C3 0540 14170 #define KEY_BTAB 0541 14171 #define KEY_BEG 0542 14172 #define KEY_CANCEL 0543 14173 #define KEY_CLOSE 0544 14174 #define KEY_COMMAND 0545 14175 #define KEY_COPY 0546 14176 #define KEY_CREATE 0547 14177 #define KEY_END 0550 14178 #define KEY_EXIT 0551 14179 #define KEY_FIND 0552 14180 #define KEY_HELP 0553 14181 #define KEY_MARK 0554 14182 #define KEY_MESSAGE 0555 14183 #define KEY_MOVE 0556 14184 #define KEY_NEXT 0557 14185 #define KEY_OPEN 0560 14186 #define KEY_OPTIONS 0561 14187 #define KEY_PREVIOUS 0562 14188 #define KEY_REDO 0563 14189 #define KEY_REFERENCE 0564 14190 #define KEY_REFRESH 0565 14191 #define KEY_REPLACE 0566 14192 #define KEY_RESTART 0567 14193 #define KEY_RESUME 0570 14194 #define KEY_SAVE 0571 14195 #define KEY_SBEG 0572 14196 #define KEY_SCANCEL 0573 14197 #define KEY_SCOMMAND 0574 14198 #define KEY_SCOPY 0575 14199 #define KEY_SCREATE 0576 14200 #define KEY_SDC 0577 14201 #define KEY_SDL 0600 14202 #define KEY_SELECT 0601 14203 #define KEY_SEND 0602 14204 #define KEY_SEOL 0603 14205 #define KEY_SEXIT 0604 14206 #define KEY_SFIND 0605 14207 #define KEY_SHELP 0606 14208 #define KEY_SHOME 0607 14209 #define KEY_SIC 0610 14210 #define KEY_SLEFT 0611 14211 #define KEY_SMESSAGE 0612 14212 #define KEY_SMOVE 0613 14213 #define KEY_SNEXT 0614 14214 #define KEY_SOPTIONS 0615 14215 #define KEY_SPREVIOUS 0616 14216 #define KEY_SPRINT 0617 14217 #define KEY_SREDO 0620 14218 #define KEY_SREPLACE 0621 14219 #define KEY_SRIGHT 0622 14220 #define KEY_SRSUME 0623 14221 #define KEY_SSAVE 0624 14222 #define KEY_SSUSPEND 0625 14223 #define KEY_SUNDO 0626 14224 #define KEY_SUSPEND 0627 14225 #define KEY_UNDO 0630 14226 #define KEY_MOUSE 0631 14227 #define KEY_RESIZE 0632 14228 #define KEY_MAX 0777 14229 14230 #define PAIR_NUMBER(a) (((a)& A_COLOR)>>8) 14231 #define NCURSES_BITS(mask,shift) ((mask)<<((shift)+8)) 14232 #define A_CHARTEXT (NCURSES_BITS(1UL,0)-1UL) 14233 #define A_NORMAL 0L 14234 #define NCURSES_ATTR_SHIFT 8 14235 #define A_COLOR NCURSES_BITS(((1UL)<<8)-1UL,0) 14236 #define A_BLINK NCURSES_BITS(1UL,11) 14237 #define A_DIM NCURSES_BITS(1UL,12) 14238 #define A_BOLD NCURSES_BITS(1UL,13) 14239 #define A_ALTCHARSET NCURSES_BITS(1UL,14) 14240 #define A_INVIS NCURSES_BITS(1UL,15) 14241 #define A_PROTECT NCURSES_BITS(1UL,16) 14242 #define A_HORIZONTAL NCURSES_BITS(1UL,17) 14243 #define A_LEFT NCURSES_BITS(1UL,18) 14244 #define A_LOW NCURSES_BITS(1UL,19) 14245 #define A_RIGHT NCURSES_BITS(1UL,20) 14246 #define A_TOP NCURSES_BITS(1UL,21) 14247 #define A_VERTICAL NCURSES_BITS(1UL,22) 14248 #define A_STANDOUT NCURSES_BITS(1UL,8) 14249 #define A_UNDERLINE NCURSES_BITS(1UL,9) 14250 #define COLOR_PAIR(n) NCURSES_BITS(n,0) 14251 #define A_ATTRIBUTES NCURSES_BITS(~(1UL-1UL),0) 14252 _________________________________________________________ 14253 14254 8.6. Interfaces for libutil 14255 14256 Table 8-6 defines the library name and shared object name for 14257 the libutil library 14258 14259 Table 8-6. libutil Definition 14260 Library: libutil 14261 SONAME: libutil.so.1 14262 14263 The behavior of the interfaces in this library is specified by 14264 the following specifications: 14265 14266 this specification 14267 _________________________________________________________ 14268 14269 8.6.1. Utility Functions 14270 _________________________________________________________ 14271 14272 8.6.1.1. Interfaces for Utility Functions 14273 14274 An LSB conforming implementation shall provide the generic 14275 functions for Utility Functions specified in Table 8-7, with 14276 the full functionality as described in the referenced 14277 underlying specification. 14278 14279 Table 8-7. libutil - Utility Functions Function Interfaces 14280 forkpty [1] login_tty [1] logwtmp [1] 14281 login [1] logout [1] openpty [1] 14282 14283 Referenced Specification(s) 14284 14285 [1]. this specification 14286 _________________________________________________________ 14287 14288 8.7. Interface Definitions for libutil 14289 14290 Table of Contents 14291 forkpty -- Create a new process attached to an available 14292 pseudo-terminal 14293 14294 login -- login utility function 14295 login_tty -- Prepare a terminal for login 14296 logout -- logout utility function 14297 logwtmp -- append an entry to the wtmp file 14298 openpty -- find and open an available pseudo-terminal 14299 14300 The following interfaces are included in libutil and are 14301 defined by this specification. Unless otherwise noted, these 14302 interfaces shall be included in the source standard. 14303 14304 Other interfaces listed above for libutil shall behave as 14305 described in the referenced base document. 14306 14307 forkpty 14308 14309 Name 14310 14311 forkpty -- Create a new process attached to an available 14312 pseudo-terminal 14313 14314 Synopsis 14315 14316 #include 14317 14318 int forkpty(int * amaster, char * name, struct termios * 14319 termp, struct winsize * winp); 14320 14321 Description 14322 14323 The forkpty() function shall find and open a pseudo-terminal 14324 device pair in the same manner as the openpty() function. If a 14325 pseudo-terminal is available, forkpty() shall create a new 14326 process in the same manner as the fork() function, and 14327 prepares the new process for login in the same manner as 14328 login_tty(). 14329 14330 If termp is not null, it shall refer to a termios structure 14331 that shall be used to initialize the characteristics of the 14332 slave device. If winp is not null, it shall refer to a winsize 14333 structure used to initialize the window size of the slave 14334 device. 14335 14336 Return Value 14337 14338 On success, the parent process shall return the process id of 14339 the child, and the child shall return 0. On error, no new 14340 process shall be created, -1 shall be returned, and errno 14341 shall be set appropriately. On success, the parent process 14342 shall receive the file descriptor of the master side of the 14343 pseudo-terminal in the location referenced by amaster, and, if 14344 name is not NULL, the filename of the slave device in name. 14345 14346 Errors 14347 14348 EAGAIN 14349 Unable to create a new process. 14350 14351 ENOENT 14352 There are no available pseudo-terminals. 14353 14354 ENOMEM 14355 Insufficient memory was available. 14356 14357 login 14358 14359 Name 14360 14361 login -- login utility function 14362 14363 Synopsis 14364 14365 #include 14366 14367 void login (struct utmp * ut ); 14368 14369 Description 14370 14371 The login() function shall update the user accounting 14372 databases. The ut parameter shall reference a utmp structure 14373 for all fields except the following: 14374 14375 1. The ut_type field shall be set to USER_PROCESS. 14376 2. The ut_pid field shall be set to the process identifier 14377 for the current process. 14378 3. The ut_line field shall be set to the name of the 14379 controlling terminal device. The name shall be found by 14380 examining the device associated with the standard input, 14381 output and error streams in sequence, until one associated 14382 with a terminal device is found. If none of these streams 14383 refers to a terminal device, the ut_line field shall be 14384 set to "???". If the terminal device is in the /dev 14385 directory hierarchy, the ut_line field shall not contain 14386 the leading "/dev/", otherwise it shall be set to the 14387 final component of the pathname of the device. If the user 14388 accounting database imposes a limit on the size of the 14389 ut_line field, it shall truncate the name, but any such 14390 limit shall not be smaller than UT_LINESIZE (including a 14391 terminating null character). 14392 14393 Return Value 14394 14395 None 14396 14397 Errors 14398 14399 None 14400 14401 login_tty 14402 14403 Name 14404 14405 login_tty -- Prepare a terminal for login 14406 14407 Synopsis 14408 14409 #include 14410 14411 int login_tty (int fdr); 14412 14413 Description 14414 14415 The login_tty() function shall prepare the terminal device 14416 referenced by the file descriptor fdr. This function shall 14417 create a new session, make the terminal the controlling 14418 terminal for the current process, and set the standard input, 14419 output, and error streams of the current process to the 14420 terminal. If fdr is not the standard input, output or error 14421 stream, then login_tty() shall close fdr. 14422 14423 Return Value 14424 14425 On success, login_tty() shall return zero; otherwise -1 is 14426 returned, and errno shall be set appropriately. 14427 14428 Errors 14429 14430 ENOTTY 14431 fdr does not refer to a terminal device. 14432 14433 logout 14434 14435 Name 14436 14437 logout -- logout utility function 14438 14439 Synopsis 14440 14441 #include 14442 14443 int logout (const char * line ); 14444 14445 Description 14446 14447 Given the device line, the logout() function shall search the 14448 user accounting database which is read by getutent() for an 14449 entry with the corresponding line, and with the type of 14450 USER_PROCESS. If a corresponding entry is located, it shall be 14451 updated as follows: 14452 14453 1. The ut_name field shall be set to zeroes (UT_NAMESIZE NUL 14454 bytes). 14455 2. The ut_host field shall be set to zeroes (UT_HOSTSIZE NUL 14456 bytes). 14457 3. The ut_tv shall be set to the current time of day. 14458 4. The ut_type field shall be set to DEAD_PROCESS. 14459 14460 Return Value 14461 14462 On success, the logout() function shall return non-zero. Zero 14463 is returned if there was no entry to remove, or if the utmp 14464 file could not be opened or updated. 14465 14466 logwtmp 14467 14468 Name 14469 14470 logwtmp -- append an entry to the wtmp file 14471 14472 Synopsis 14473 14474 #include 14475 14476 void logwtmp (const char * line , const char * name , const 14477 char * host ); 14478 14479 Description 14480 14481 If the process has permission to update the user accounting 14482 databases, the logwtmp() function shall append a record to the 14483 user accounting database that records all logins and logouts. 14484 The record to be appended shall be constructed as follows: 14485 14486 1. The ut_line field shall be initialized from line. If the 14487 user accounting database imposes a limit on the size of 14488 the ut_line field, it shall truncate the value, but any 14489 such limit shall not be smaller than UT_LINESIZE 14490 (including a terminating null character). 14491 2. The ut_name field shall be initialized from name. If the 14492 user accounting database imposes a limit on the size of 14493 the ut_name field, it shall truncate the value, but any 14494 such limit shall not be smaller than UT_NAMESIZE 14495 (including a terminating null character). 14496 3. The ut_host field shall be initialized from host. If the 14497 user accounting database imposes a limit on the size of 14498 the ut_host field, it shall truncate the value, but any 14499 such limit shall not be smaller than UT_HOSTSIZE 14500 (including a terminating null character). 14501 4. If the name parameter does not refer to an empty string 14502 (i.e. ""), the ut_type field shall be set to USER_PROCESS; 14503 otherwise the ut_type field shall be set to DEAD_PROCESS. 14504 5. The ut_id field shall be set to the process identifier for 14505 the current process. 14506 6. The ut_tv field shall be set to the current time of day. 14507 14508 Note: If a process does not have write access to the the 14509 user accounting database, the logwtmp() function will not 14510 update it. Since the function does not return any value, an 14511 application has no way of knowing whether it succeeded or 14512 failed. 14513 14514 Return Value 14515 14516 None. 14517 14518 openpty 14519 14520 Name 14521 14522 openpty -- find and open an available pseudo-terminal 14523 14524 Synopsis 14525 14526 #include 14527 14528 int openpty(int *amaster, int *aslave, char *name, struct 14529 termios *termp, struct winsize *winp); 14530 14531 Description 14532 14533 The openpty() function shall find an available pseudo-terminal 14534 and return file descriptors for the master and slave devices 14535 in the locations referenced by amaster and aslave 14536 respectively. If name is not NULL, the filename of the slave 14537 shall be placed in the user supplied buffer referenced by 14538 name. If termp is not NULL, it shall point to a termios 14539 structure used to initialize the terminal parameters of the 14540 slave pseudo-terminal device. If winp is not NULL, it shall 14541 point to a winsize structure used to initialize the window 14542 size parameters of the slave pseudo-terminal device. 14543 14544 Return Value 14545 14546 On success, zero is returned. On error, -1 is returned, and 14547 errno is set appropriately. 14548 14549 Errors 14550 14551 ENOENT 14552 There are no available pseudo-terminals. 14553 14554 IV. Commands and Utilities 14555 14556 Table of Contents 14557 9. Commands and Utilities 14558 _________________________________________________________ 14559 14560 Chapter 9. Commands and Utilities 14561 14562 9.1. Commands and Utilities 14563 14564 Table 9-1 lists the Commands and Utilities required to be 14565 present on a conforming system. These commands and utilities 14566 shall behave as described in the relevant underlying 14567 specification, with the following exceptions: 14568 14569 1. If any operand (except one which follows --) starts with a 14570 hyphen, the behavior is unspecified. 14571 14572 Rationale (Informative): Applications should place options 14573 before operands, or use --, as needed. This text is needed 14574 because GNU option parsing differs from POSIX. For example, 14575 ls . -a in GNU ls means to list the current directory, 14576 showing all files (that is, "." is an operand and -a is an 14577 option). In POSIX, "." and -a are both operands, and the 14578 command means to list the current directory, and also the 14579 file named -a. Suggesting that applications rely on the 14580 setting of the POSIXLY_CORRECT environment variable, or try 14581 to set it, seems worse than just asking the applictions to 14582 invoke commands in ways which work with either the POSIX or 14583 GNU behaviors. 14584 14585 The behavior of the interfaces described in this section is 14586 specified by the following standards. 14587 14588 this specification 14589 ISO POSIX (2003) 14590 14591 Table 9-1. Commands and Utilities 14592 [ [1] ar [2] at [2] awk [2] basename [1] 14593 batch [2] bc [2] cat [1] chfn [2] chgrp [2] 14594 chmod [1] chown [2] chsh [2] cksum [1] cmp [1] 14595 col [2] comm [1] cp [1] cpio [2] crontab [2] 14596 csplit [1] cut [2] date [1] dd [1] df [2] 14597 diff [1] dirname [1] dmesg [2] du [2] echo [2] 14598 egrep [2] env [1] expand [1] expr [1] false [1] 14599 fgrep [2] file [2] find [2] fold [1] fuser [2] 14600 gencat [1] getconf [1] gettext [2] grep [2] groupadd [2] 14601 groupdel [2] groupmod [2] groups [2] gunzip [2] gzip [2] 14602 head [1] hostname [2] iconv [1] id [1] install [2] 14603 install_initd [2] ipcrm [2] ipcs [2] join [1] kill [1] 14604 killall [2] ln [1] locale [1] localedef [1] logname [1] 14605 lpr [2] ls [2] lsb_release [2] m4 [2] make [1] 14606 man [1] md5sum [2] mkdir [1] mkfifo [1] mknod [2] 14607 mktemp [2] more [2] mount [2] msgfmt [2] mv [1] 14608 newgrp [2] nice [1] nl [1] nohup [1] od [2] 14609 passwd [2] paste [1] patch [2] pathchk [1] pidof [2] 14610 pr [1] printf [1] ps [1] pwd [1] remove_initd [2] 14611 renice [2] rm [1] rmdir [1] sed [2] sendmail [2] 14612 sh [1] shutdown [2] sleep [1] sort [1] split [1] 14613 strip [1] stty [1] su [2] sync [2] tail [1] 14614 tar [2] tee [1] test [1] time [1] touch [1] 14615 tr [1] true [1] tsort [1] tty [1] umount [2] 14616 uname [1] unexpand [1] uniq [1] useradd [2] userdel [2] 14617 usermod [2] wc [1] xargs [2] 14618 14619 Referenced Specification(s) 14620 14621 [1]. ISO POSIX (2003) 14622 14623 [2]. this specification 14624 _________________________________________________________ 14625 14626 9.2. Command Behavior 14627 14628 Table of Contents 14629 ar -- create and maintain library archives (DEPRECATED) 14630 at -- examine or delete jobs for later execution 14631 awk -- pattern scanning and processing language 14632 batch -- schedule commands to be executed in a batch queue 14633 bc -- An arbitrary precision calculator language 14634 chfn -- change user name and information 14635 chgrp -- change file group 14636 chown -- change file owner and group 14637 chsh -- change login shell 14638 col -- filter reverse line feeds from input 14639 cpio -- copy file archives in and out 14640 crontab -- maintain crontab files for individual users 14641 cut -- split a file into sections determined by context lines 14642 df -- report filesystem disk space usage 14643 dmesg -- print or control the system message buffer 14644 du -- estimate file space usage 14645 echo -- display a line of text 14646 egrep -- search a file with an ERE pattern 14647 fgrep -- search a file with a fixed pattern 14648 file -- determine file type 14649 find -- search for files in a directory hierarchy 14650 fuser -- identify processes using files or sockets 14651 gettext -- retrieve text string from message catalog 14652 grep -- print lines matching a pattern 14653 groupadd -- create a new group 14654 groupdel -- delete a group 14655 groupmod -- modify a group 14656 groups -- display a group 14657 gunzip -- uncompress files 14658 gzip -- compress or expand files 14659 hostname -- show or set the system's host name 14660 install -- copy files and set attributes 14661 install_initd -- install an init.d file 14662 ipcrm -- Remove IPC Resources 14663 ipcs -- provide information on ipc facilities 14664 killall -- kill processes by name 14665 lpr -- off line print 14666 ls -- list directory contents 14667 lsb_release -- print distribution specific information 14668 m4 -- macro processor 14669 md5sum -- generate or check MD5 message digests 14670 mknod -- make special files 14671 mktemp -- make temporary file name (unique) 14672 more -- display files on a page-by-page basis 14673 mount -- mount a file system 14674 msgfmt -- create a message object from a message file 14675 newgrp -- change group ID 14676 od -- dump files in octal and other formats 14677 passwd -- change user password 14678 patch -- apply a diff file to an original 14679 pidof -- find the process ID of a running program 14680 remove_initd -- clean up boot script system modifications 14681 introduced by install_initd 14682 14683 renice -- alter priority of running processes 14684 sed -- stream editor 14685 sendmail -- an electronic mail transport agent 14686 shutdown -- bring the system down 14687 su -- change user ID or become super-user 14688 sync -- flush filesystem buffers 14689 tar -- file archiver 14690 umount -- unmount file systems 14691 useradd -- create a new user or update default new user 14692 information 14693 14694 userdel -- delete a user account and related files 14695 usermod -- modify a user account 14696 xargs -- build and execute command lines from standard input 14697 14698 This section contains descriptions for commands and utilities 14699 whose specified behavior in the LSB contradicts or extends the 14700 standards referenced. It also contains commands and utilities 14701 only required by the LSB and not specified by other standards. 14702 14703 ar 14704 14705 Name 14706 14707 ar -- create and maintain library archives (DEPRECATED) 14708 14709 Description 14710 14711 ar is deprecated from the LSB and is expected to disappear 14712 from a future version of the LSB. 14713 14714 Rationale: The LSB generally does not include software 14715 development utilities nor does it specify .o and .a file 14716 formats. 14717 14718 ar is as specified in ISO POSIX (2003) but with differences as 14719 listed below. 14720 14721 Differences 14722 14723 -T, -C 14724 need not be accepted. 14725 14726 -l 14727 has unspecified behavior. 14728 14729 -q 14730 has unspecified behavior; using -r is suggested. 14731 14732 at 14733 14734 Name 14735 14736 at -- examine or delete jobs for later execution 14737 14738 Description 14739 14740 at is as specified in ISO POSIX (2003) but with differences as 14741 listed below. 14742 14743 Differences 14744 14745 -d 14746 is functionally equivalent to the -r option specified 14747 in ISO POSIX (2003). 14748 14749 -r 14750 need not be supported, but the '-d' option is 14751 equivalent. 14752 14753 -t time 14754 need not be supported. 14755 14756 Files 14757 14758 The files at.allow and at.deny reside in /etc rather than 14759 /usr/lib/cron. 14760 14761 awk 14762 14763 Name 14764 14765 awk -- pattern scanning and processing language 14766 14767 Description 14768 14769 awk is as specified in ISO POSIX (2003) but with differences 14770 as listed below. 14771 14772 Differences 14773 14774 Certain aspects of internationalized regular expressions are 14775 optional; see Internationalization and Regular Expressions. 14776 14777 batch 14778 14779 Name 14780 14781 batch -- schedule commands to be executed in a batch queue 14782 14783 Description 14784 14785 The specification for batch is as specified in ISO POSIX 14786 (2003), but with the following differences as listed below. 14787 14788 Files 14789 14790 The files at.allow and at.deny reside in /etc rather than 14791 /usr/lib/cron. 14792 14793 bc 14794 14795 Name 14796 14797 bc -- An arbitrary precision calculator language 14798 14799 Description 14800 14801 bc is as specified in ISO POSIX (2003) but with differences as 14802 listed below. 14803 14804 Differences 14805 14806 The bc language may be extended in an implementation defined 14807 manner. If an implementation supports extensions, it shall 14808 also support the additional options: 14809 14810 -s|--standard 14811 processes exactly the POSIX bc language. 14812 14813 -w|--warn 14814 gives warnings for extensions to POSIX bc. 14815 14816 chfn 14817 14818 Name 14819 14820 chfn -- change user name and information 14821 14822 Synopsis 14823 14824 chfn [-f full_name] [-h home_phone] [user] 14825 14826 Description 14827 14828 chfn shall update the user database. An unprivileged user may 14829 only change the fields for their own account, a user with 14830 appropriate privileges may change the fields for any account. 14831 14832 The fields full_name and home_phone may contain any character 14833 except: 14834 14835 any control character 14836 comma 14837 colon 14838 equal sign 14839 14840 If none of the options are selected, chfn operates in an 14841 interactive fashion. The prompts and expected input in 14842 interactive mode are unspecified and should not be relied 14843 upon. 14844 14845 As it is possible for the system to be configured to restrict 14846 which fields a non-privileged user is permitted to change, 14847 applications should be written to gracefully handle these 14848 situations. 14849 14850 Standard Options 14851 14852 -f full_name 14853 sets the user's full name. 14854 14855 -h home_phone 14856 sets the user's home phone number. 14857 14858 Future Directions 14859 14860 The following two options are expected to be added in a future 14861 version of the LSB: 14862 14863 -o office 14864 sets the user's office room number. 14865 14866 -p office_phone 14867 sets the user's office phone number. 14868 14869 Note that some implementations contain a "-o other" option 14870 which specifies an additional field called "other". 14871 Traditionally, this field is not subject to the constraints 14872 about legitimate characters in fields. Also, one traditionally 14873 shall have appropriate privileges to change the other field. 14874 At this point there is no consensus about whether it is 14875 desirable to specify the other field; applications may wish to 14876 avoid using it. 14877 14878 The "-w work_phone" field found in some implementations should 14879 be replaced by the "-p office_phone" field. The "-r 14880 room_number" field found in some implementations is the 14881 equivalent of the "-o office" option mentioned above; which 14882 one of these two options to specify will depend on 14883 implementation experience and the decision regarding the other 14884 field. 14885 14886 chgrp 14887 14888 Name 14889 14890 chgrp -- change file group 14891 14892 Description 14893 14894 chgrp is as specified in ISO POSIX (2003) but with differences 14895 as listed below. 14896 14897 Differences 14898 14899 The -L, -H, and -P options need not be supported. 14900 14901 chown 14902 14903 Name 14904 14905 chown -- change file owner and group 14906 14907 Description 14908 14909 chown is as specified in ISO POSIX (2003) but with differences 14910 as listed below. 14911 14912 Differences 14913 14914 The -L, -H, and -P options need not be supported. 14915 14916 chsh 14917 14918 Name 14919 14920 chsh -- change login shell 14921 14922 Synopsis 14923 14924 chsh [-s login_shell] [user] 14925 14926 Description 14927 14928 chsh changes the user login shell. This determines the name of 14929 the user's initial login command. An unprivileged user may 14930 only change the login shell for their own account, a user with 14931 appropriate privilege may change the login shell for any 14932 account specified by user. 14933 14934 Unless the user has appropriate privilege, the initial login 14935 command name shall be one of those listed in /etc/shells. The 14936 login_shell shall be the absolute path (i.e. it must start 14937 with '/') to an executable file. Accounts which are restricted 14938 (in an implementation-defined manner) may not change their 14939 login shell. 14940 14941 If the -s option is not selected, chsh operates in an 14942 interactive mode. The prompts and expected input in this mode 14943 are unspecified. 14944 14945 Standard Options 14946 14947 -s login_shell 14948 sets the login shell. 14949 14950 col 14951 14952 Name 14953 14954 col -- filter reverse line feeds from input 14955 14956 Description 14957 14958 col is as specified in the SUSv2 with the difference that the 14959 -p option has unspecified behavior. 14960 14961 Although col is shown as legacy in SUSv2, Version 2, it is not 14962 (yet) deprecated in the LSB. 14963 14964 cpio 14965 14966 Name 14967 14968 cpio -- copy file archives in and out 14969 14970 Description 14971 14972 cpio is as specified in ISO POSIX (2003), but with differences 14973 as listed below. 14974 14975 Differences 14976 14977 Some elements of the Pattern Matching Notation are optional; 14978 see Internationalization and Pattern Matching Notation. 14979 14980 crontab 14981 14982 Name 14983 14984 crontab -- maintain crontab files for individual users 14985 14986 Synopsis 14987 14988 crontab [-u user] file 14989 crontab [-u user] {-l | -r | -e} 14990 14991 Description 14992 14993 crontab is as specified in ISO POSIX (2003), but with 14994 differences as listed below. 14995 14996 Files 14997 14998 The files cron.allow and cron.deny reside in /etc rather than 14999 /usr/lib/cron. 15000 15001 cut 15002 15003 Name 15004 15005 cut -- split a file into sections determined by context lines 15006 15007 Description 15008 15009 cut is as specified in ISO POSIX (2003), but with differences 15010 as listed below. 15011 15012 Differences 15013 15014 -n 15015 has unspecified behavior. 15016 15017 df 15018 15019 Name 15020 15021 df -- report filesystem disk space usage 15022 15023 Description 15024 15025 df is as specified in ISO POSIX (2003), but with the following 15026 differences. 15027 15028 If the -k option is not specified, disk space is shown in 15029 unspecified units. Applications should specify -k. 15030 15031 If an argument is the absolute file name of a disk device node 15032 containing a mounted filesystem, df shows the space available 15033 on that filesystem rather than on the filesystem containing 15034 the device node (which is always the root filesystem). 15035 15036 dmesg 15037 15038 Name 15039 15040 dmesg -- print or control the system message buffer 15041 15042 Synopsis 15043 15044 dmesg [-c | -n level | -s bufsize] 15045 15046 Description 15047 15048 dmesg examines or controls the system message buffer. Only a 15049 user with appropriate privileges may modify the system message 15050 buffer parameters or contents. 15051 15052 Standard Options 15053 15054 -c 15055 If the user has appropriate privilege, clears the 15056 system message buffer contents after printing. 15057 15058 -n level 15059 If the user has appropriate privilege, sets the level 15060 at which logging of messages is done to the console. 15061 15062 -s bufsize 15063 uses a buffer of bufsize to query the system message 15064 buffer. This is 16392 by default (this matches the 15065 default kernel syslog buffer size since 2.1.113). If 15066 you have set the kernel buffer to larger than the 15067 default then this option can be used to view the entire 15068 buffer. 15069 15070 du 15071 15072 Name 15073 15074 du -- estimate file space usage 15075 15076 Description 15077 15078 du is as specified in ISO POSIX (2003), but with differences 15079 as listed below. 15080 15081 Differences 15082 15083 If the -k option is not specified, disk space is shown in 15084 unspecified units. Applications should specify -k. 15085 15086 echo 15087 15088 Name 15089 15090 echo -- display a line of text 15091 15092 Synopsis 15093 15094 echo [STRING...] 15095 15096 Description 15097 15098 The echo command is as specified in ISO POSIX (2003), but with 15099 the following differences. 15100 15101 Unlike the behavior specified in ISO POSIX (2003), whether 15102 echo supports options is implementation defined. The behavior 15103 of echo if any arguments contain backslashes is also 15104 implementation defined. Conforming applications shall not run 15105 echo with a first argument starting with a hyphen, or with any 15106 arguments containing backslashes; they shall use printf in 15107 those cases. 15108 15109 Note: The behavior specified here is similar to that 15110 specified by ISO POSIX (2003) without the XSI option. 15111 However, the LSB forbids all options and the latter forbids 15112 only -n. 15113 15114 egrep 15115 15116 Name 15117 15118 egrep -- search a file with an ERE pattern 15119 15120 Description 15121 15122 egrep is equivalent to grep -E. For further details, see the 15123 specification for grep. 15124 15125 fgrep 15126 15127 Name 15128 15129 fgrep -- search a file with a fixed pattern 15130 15131 Description 15132 15133 fgrep is equivalent to grep -F. For further details, see the 15134 specification for grep. 15135 15136 file 15137 15138 Name 15139 15140 file -- determine file type 15141 15142 Description 15143 15144 file is as specified in ISO POSIX (2003), but with differences 15145 as listed below. 15146 15147 Differences 15148 15149 The -M, -h, -d, and -i options need not be supported. 15150 15151 find 15152 15153 Name 15154 15155 find -- search for files in a directory hierarchy 15156 15157 Description 15158 15159 find is as specified in ISO POSIX (2003), but with additional 15160 options as specified below. 15161 15162 Differences 15163 15164 Some elements of the Pattern Matching Notation are optional; 15165 see Internationalization and Pattern Matching Notation. 15166 15167 fuser 15168 15169 Name 15170 15171 fuser -- identify processes using files or sockets 15172 15173 Description 15174 15175 fuser is as specified in ISO POSIX (2003), but with 15176 differences as listed below. 15177 15178 Differences 15179 15180 -c 15181 has unspecified behavior. 15182 15183 -f 15184 has unspecified behavior. 15185 15186 gettext 15187 15188 Name 15189 15190 gettext -- retrieve text string from message catalog 15191 15192 Synopsis 15193 15194 gettext [options] [textdomain] msgid 15195 gettext -s [options] msgid... 15196 15197 Description 15198 15199 The gettext utility retrieves a translated text string 15200 corresponding to string msgid from a message object generated 15201 with msgfmt utility. 15202 15203 The message object name is derived from the optional argument 15204 textdomain if present, otherwise from the TEXTDOMAIN 15205 environment variable. If no domain is specified, or if a 15206 corresponding string cannot be found, gettext prints msgid. 15207 15208 Ordinarily gettext looks for its message object in 15209 dirname/lang/LC_MESSAGES where dirname is the 15210 implementation-defined default directory and lang is the 15211 locale name. If present, the TEXTDOMAINDIR environment 15212 variable replaces the dirname. 15213 15214 This utility interprets C escape sequences such as \t for tab. 15215 Use \\ to print a backslash. To produce a message on a line of 15216 its own, either put a \n at the end of msgid, or use this 15217 command in conjunction with the printf utility. 15218 15219 When used with the -s option the gettext utility behaves like 15220 the echo utility, except that the message corresponding to 15221 msgid in the selected catalog provides the arguments. 15222 15223 Options 15224 15225 -d domainname, --domain=domainname 15226 PARAMETER translated messages from domainname. 15227 15228 -e 15229 Enable expansion of some escape sequences. 15230 15231 -n 15232 Suppress trailing newline. 15233 15234 Operands 15235 15236 The following operands are supported: 15237 15238 textdomain 15239 A domain name used to retrieve the messages. 15240 15241 msgid 15242 A key to retrieve the localized message. 15243 15244 Environment Variables 15245 15246 LANGUAGE 15247 Specifies one or more locale names. 15248 15249 LANG 15250 Specifies locale name. 15251 15252 LC_MESSAGES 15253 Specifies messaging locale, and if present overrides 15254 LANG for messages. 15255 15256 TEXTDOMAIN 15257 Specifies the text domain name, which is identical to 15258 the message object filename without .mo suffix. 15259 15260 TEXTDOMAINDIR 15261 Specifies the pathname to the message catalog, and if 15262 present replaces the implementation-defined default 15263 directory. 15264 15265 Exit Status 15266 15267 The following exit values are returned: 15268 15269 0 15270 Successful completion. 15271 15272 >0 15273 An error occurred. 15274 15275 grep 15276 15277 Name 15278 15279 grep -- print lines matching a pattern 15280 15281 Description 15282 15283 grep is as specified in ISO POSIX (2003), but with differences 15284 as listed below. 15285 15286 LSB Differences 15287 15288 Some elements of the Pattern Matching Notation are optional; 15289 see Internationalization and Pattern Matching Notation. 15290 15291 groupadd 15292 15293 Name 15294 15295 groupadd -- create a new group 15296 15297 Synopsis 15298 15299 groupadd [-g gid [-o]] group 15300 15301 Description 15302 15303 If the caller has appropriate privilege, the groupadd command 15304 shall create a new group named group. The group name shall be 15305 unique in the group database. If no gid is specified, groupadd 15306 shall create the new group with a unique group ID. 15307 15308 Options 15309 15310 -g gid [-o] 15311 The new group shall have group ID gid. If the -o option 15312 is not used, no other group shall have this group ID. 15313 The value of gidshall be non-negative. 15314 15315 groupdel 15316 15317 Name 15318 15319 groupdel -- delete a group 15320 15321 Synopsis 15322 15323 groupdel group 15324 15325 Description 15326 15327 If the caller has sufficient privilege, the groupdel command 15328 shall modify the system group database, deleting the group 15329 named group. If the group named group does not exist, groupdel 15330 shall issue a diagnostic message and exit with a non-zero exit 15331 status. 15332 15333 groupmod 15334 15335 Name 15336 15337 groupmod -- modify a group 15338 15339 Synopsis 15340 15341 groupmod [-g gid [-o]] [-n group_name] group 15342 15343 Description 15344 15345 If the caller has appropriate privilege, the groupmod command 15346 shall modify the entry in the system group database 15347 corresponding to a group named group. 15348 15349 Options 15350 15351 -g gid [-o] 15352 Modify the group's group ID, setting it to gid. If the 15353 -o option is not used, no other group shall have this 15354 group ID. The value of gidshall be non-negative. 15355 15356 Note: Only the group ID in the database is altered; any 15357 files with group ownership set to the original group ID are 15358 unchanged by this modification. 15359 15360 -n group_name 15361 changes the name of the group from group to group_name. 15362 15363 groups 15364 15365 Name 15366 15367 groups -- display a group 15368 15369 Synopsis 15370 15371 groups [user] 15372 15373 Description 15374 15375 The groups command shall behave as id -Gn [user], as specified 15376 in ISO POSIX (2003). The optional user parameter will display 15377 the groups for the named user. 15378 15379 gunzip 15380 15381 Name 15382 15383 gunzip -- uncompress files 15384 15385 Description 15386 15387 gunzip is equivalent to gzip -d. See the specification for 15388 gzip for further details. 15389 15390 gzip 15391 15392 Name 15393 15394 gzip -- compress or expand files 15395 15396 Synopsis 15397 15398 gzip [-cdfhlLnNrtvV19] [-S suffix] [name...] 15399 15400 Description 15401 15402 The gzip command shall attempt to reduce the size of the named 15403 files. Whenever possible, each file is replaced by one with 15404 the extension .gz, while keeping the same ownership modes, 15405 access and modification times. If no files are specified, or 15406 if a file name is -, the standard input is compressed to the 15407 standard output. gzip shall only attempt to compress regular 15408 files. In particular, it will ignore symbolic links. 15409 15410 When compressing, gzip uses the deflate algorithm specified in 15411 RFC 1951: DEFLATE Compressed Data Format Specification and 15412 stores the result in a file using the gzip file format 15413 specified in RFC 1952: GZIP File Format Specification. 15414 15415 Options 15416 15417 -c, --stdout, --to-stdout 15418 writes output on standard output, leaving the original 15419 files unchanged. If there are several input files, the 15420 output consists of a sequence of independently 15421 compressed members. To obtain better compression, 15422 concatenate all input files before compressing them. 15423 15424 -d, --decompress, --uncompress 15425 the name operands are compressed files, and gzip shall 15426 decompress them. 15427 15428 -f, --force 15429 forces compression or decompression even if the file 15430 has multiple links or the corresponding file already 15431 exists, or if the compressed data is read from or 15432 written to a terminal. If the input data is not in a 15433 format recognized by gzip, and if the option --stdout 15434 is also given, copy the input data without change to 15435 the standard ouput: let gzip behave as cat. If -f is 15436 not given, and when not running in the background, gzip 15437 prompts to verify whether an existing file should be 15438 overwritten. 15439 15440 -l, --list 15441 lists the compressed size, uncompressed size, ration 15442 and uncompressed name for each compressed file. Gives 15443 the uncompressed size as -1 for files not in gzip 15444 format. Additionally displays method, crc and timestamp 15445 for the uncompress file when used in combination with 15446 --verbose. 15447 15448 For decompression, gzip shall support at least the 15449 following compression methods: 15450 15451 + deflate (RFC 1951: DEFLATE Compressed Data Format 15452 Specification) 15453 + compress (ISO POSIX (2003)) 15454 15455 The crc shall be given as ffffffff for a file not in 15456 gzip format. 15457 15458 With --name, the uncompressed name, date and time are 15459 those stored within the compress file, if present. 15460 15461 With --verbose, the size totals and compression ratio 15462 for all files is also displayed, unless some sizes are 15463 unknown. With --quiet, the title and totals lines are 15464 not displayed. 15465 15466 -L, --license 15467 displays the gzip license and quit. 15468 15469 -n, --no-name 15470 does not save the original file name and time stamp by 15471 default when compressing. (The original name is always 15472 saved if the name had to be truncated.) When 15473 decompressing, do not restore the original file name if 15474 present (remove only the gzip suffix from the 15475 compressed file name) and do not restore the original 15476 time stamp if present (copy it from the compressed 15477 file). This option is the default when decompressing. 15478 15479 -N, --name 15480 always saves the original file name and time stamp when 15481 compressing; this is the default. When decompressing, 15482 restore the original file name and time stamp if 15483 present. This option is useful on systems which have a 15484 limit on file name length or when the time stamp has 15485 been lost after a file transfer. 15486 15487 -q, --quiet 15488 suppresses all warnings. 15489 15490 -r, --recursive 15491 travels the directory structure recursively. If any of 15492 the file names specified on the command line are 15493 directories, gzip will descend into the directory and 15494 compress all the files it finds there (or decompress 15495 them in the case of gunzip). 15496 15497 -S .suf, --sufix .suf 15498 uses suffix .suf instead of .gz. 15499 15500 -t, --test 15501 checks the compressed file integrity. 15502 15503 -v, --verbose 15504 displays the name and percentage reduction for each 15505 file compressed or decompressed. 15506 15507 -#, --fast, --best 15508 regulates the speed of compression using the specified 15509 digit #, where -1 or --fast indicates the fastest 15510 compression method (less compression) and -9 or --best 15511 indicates the slowest compression method (best 15512 compression). The default compression level is -6 (that 15513 is, biased towards high compression at expense of 15514 speed). 15515 15516 LSB Deprecated Options 15517 15518 The behaviors specified in this section are expected to 15519 disappear from a future version of the LSB; applications 15520 should only use the non-LSB-deprecated behaviors. 15521 15522 -V, --version 15523 displays the version number and compilation options, 15524 then quits. 15525 15526 hostname 15527 15528 Name 15529 15530 hostname -- show or set the system's host name 15531 15532 Synopsis 15533 15534 hostname [name] 15535 15536 Description 15537 15538 hostname is used to either display or, with appropriate 15539 privileges, set the current host name of the system. The host 15540 name is used by many applications to identify the machine. 15541 15542 When called without any arguments, the program displays the 15543 name of the system as returned by the gethostname() function. 15544 15545 When called with a name argument, and the user has appropriate 15546 privilege, the command sets the host name. 15547 15548 Note: It is not specified if the hostname displayed will be 15549 a fully qualified domain name. Applications requiring a 15550 particular format of hostname should check the output and 15551 take appropriate action. 15552 15553 install 15554 15555 Name 15556 15557 install -- copy files and set attributes 15558 15559 Synopsis 15560 15561 install [option...] SOURCE DEST 15562 install [option...] SOURCE... DEST 15563 install [-d | --directory] [option...] DIRECTORY... 15564 15565 Description 15566 15567 In the first two formats, copy SOURCE to DEST or multiple 15568 SOURCE(s) to the existing DIRECTORY, optionally setting 15569 permission modes and file ownership. In the third format, each 15570 DIRECTORY and any missing parent directories shall be created. 15571 15572 Standard Options 15573 15574 --backup[=METHOD] 15575 makes a backup of each existing destination file. 15576 METHOD may be one of the following: 15577 15578 + none or off never make backups. 15579 + numbered or t make numbered backups. A numbered 15580 backup has the form "%s.~%d~", target_name, 15581 version_number. Each backup shall increment the 15582 version number by 1. 15583 + existing or nil numbered if numbered backups exist, 15584 or simple otherwise. 15585 + simple or never append a suffix to the name. The 15586 default suffix is '~', but can be overriden by 15587 setting SIMPLE_BACKUP_SUFFIX in the environment, or 15588 via the -S or --suffix option. 15589 15590 If no METHOD is specified, the environment variable 15591 VERSION_CONTROL shall be examined for one of the above. 15592 Unambiguous abbreviations of METHOD shall be accepted. 15593 If no METHOD is specified, or if METHOD is empty, the 15594 backup method shall default to existing. 15595 15596 If METHOD is invalid or ambiguous, install shall fail 15597 and issue a diagnostic message. 15598 15599 -b 15600 is equivalent to --backup=existing. 15601 15602 -d, --directory 15603 treats all arguments as directory names; creates all 15604 components of the specified directories. 15605 15606 -D 15607 creates all leading components of DEST except the last, 15608 then copies SOURCE to DEST; useful in the 1st format. 15609 15610 -g GROUP, --group=GROUP 15611 if the user has appropriate privilege, sets group 15612 ownership, instead of process' current group. GROUP is 15613 either a name in the user group database, or a positive 15614 integer, which shall be used as a group-id. 15615 15616 -m MODE, --mode=MODE 15617 sets permission mode (specified as in chmod), instead 15618 of the default rwxr-xr-x. 15619 15620 -o OWNER, --owner=OWNER 15621 if the user has appropriate privilege, sets ownership. 15622 OWNER is either a name in the user login database, or a 15623 positive integer, which shall be used as a user-id. 15624 15625 -p, --preserve-timestamps 15626 copies the access and modification times of SOURCE 15627 files to corresponding destination files. 15628 15629 -s, --strip 15630 strips symbol tables, only for 1st and 2nd formats. 15631 15632 -S SUFFIX, --suffix=SUFFIX 15633 equivalent to --backup=existing, except if a simple 15634 suffix is required, use SUFFIX. 15635 15636 --verbose 15637 prints the name of each directory as it is created. 15638 15639 -v, --verbose 15640 print the name of each file before copying it to 15641 stdout. 15642 15643 install_initd 15644 15645 Name 15646 15647 install_initd -- install an init.d file 15648 15649 Synopsis 15650 15651 /usr/lib/lsb/install_initd initd_file 15652 15653 Description 15654 15655 install_initd shall install a system initialization file that 15656 has been copied to the /etc/init.d location such that this 15657 file shall be run at the appropriate point during system 15658 initialization. The install_initrd command is typically called 15659 in the postinstall script of a package. See also Section 14.4. 15660 15661 ipcrm 15662 15663 Name 15664 15665 ipcrm -- Remove IPC Resources 15666 15667 Synopsis 15668 15669 ipcrm [-q msgid | -Q msgkey | -s semid | -S semkey | -m shmid 15670 | -M shmkey]... 15671 ipcrm [shm | msg | msg] id... 15672 15673 Description 15674 15675 If any of the -q, -Q, -s, -S, -m, or -M arguments are given, 15676 the ipcrm shall behave as described in ISO POSIX (2003). 15677 15678 Otherwise, ipcrm shall remove the resource of the specified 15679 type identified by id. 15680 15681 Future Directions 15682 15683 A future revision of this specification may deprecate the 15684 second synopsis form. 15685 15686 Rationale: In its first Linux implementation, ipcrm used 15687 the second syntax shown in the SYNOPSIS. Functionality 15688 present in other implementations of ipcrm has since been 15689 added, namely the ability to delete resources by key (not 15690 just identifier), and to respect the same command line 15691 syntax. The previous syntax is still supported for 15692 backwards compatibility only. 15693 15694 ipcs 15695 15696 Name 15697 15698 ipcs -- provide information on ipc facilities 15699 15700 Synopsis 15701 15702 ipcs [-smq] [-tcp] 15703 15704 Description 15705 15706 ipcs provides information on the ipc facilities for which the 15707 calling process has read access. 15708 15709 Resource display options 15710 15711 -m 15712 shared memory segments. 15713 15714 -q 15715 message queues. 15716 15717 -s 15718 semaphore arrays. 15719 15720 Output format options 15721 15722 -t 15723 time. 15724 15725 -p 15726 pid. 15727 15728 -c 15729 creator. 15730 15731 Application Usage 15732 15733 In some implementations of ipcs the -a option will print all 15734 information available. In other implementations the -a option 15735 will print all resource types. Therefore, applications shall 15736 not use the -a option. 15737 15738 Some implements of ipcs implement more output formats than are 15739 specified here. These options are not consistent between 15740 differing implementations of ipcs. Therefore, only the -t -c 15741 and -p option flags may be used. At least one of the -t -c and 15742 -p options shall be specified. 15743 15744 killall 15745 15746 Name 15747 15748 killall -- kill processes by name 15749 15750 Synopsis 15751 15752 killall [-egiqvw] [-signal] name... 15753 killall -l 15754 killall -V 15755 15756 Description 15757 15758 killall sends a signal to all processes running any of the 15759 specified commands. If no signal name is specified, SIGTERM is 15760 sent. 15761 15762 Signals can be specified either by name (e.g. -HUP) or by 15763 number (e.g. -1). Signal 0 (check if a process exists) can 15764 only be specified by number. 15765 15766 If the command name contains a slash (/), processes executing 15767 that particular file will be selected for killing, independent 15768 of their name. 15769 15770 killall returns a non-zero return code if no process has been 15771 killed for any of the listed commands. If at least one process 15772 has been killed for each command, killall returns zero. 15773 15774 A killall process never kills itself (but may kill other 15775 killall processes). 15776 15777 Standard Options 15778 15779 -e 15780 requires an exact match for very long names. If a 15781 command name is longer than 15 characters, the full 15782 name may be unavailable (i.e. it is swapped out). In 15783 this case, killall will kill everything that matches 15784 within the first 15 characters. With -e, such entries 15785 are skipped. killall prints a message for each skipped 15786 entry if -v is specified in addition to -e. 15787 15788 -g 15789 kills the process group to which the process belongs. 15790 The kill signal is only sent once per group, even if 15791 multiple processes belonging to the same process group 15792 were found. 15793 15794 -i 15795 asks interactively for confirmation before killing. 15796 15797 -l 15798 lists all known signal names. 15799 15800 -q 15801 does not complain if no processes were killed. 15802 15803 -v 15804 reports if the signal was successfully sent. 15805 15806 LSB Deprecated Options 15807 15808 The behaviors specified in this section are expected to 15809 disappear from a future version of the LSB; applications 15810 should only use the non-LSB-deprecated behaviors. 15811 15812 -V 15813 displays version information. 15814 15815 lpr 15816 15817 Name 15818 15819 lpr -- off line print 15820 15821 Synopsis 15822 15823 lpr [-l] [-p] [-Pprinter] [-h] [-s] [-#copies] [-J name] [-T 15824 title] [name ......] 15825 15826 Description 15827 15828 lpr uses a spooling daemon to print the named files when 15829 facilities become available. If no names appear, the standard 15830 input is assumed. 15831 15832 Standard Options 15833 15834 -l 15835 identifies binary data that is not to be filtered but 15836 sent as raw input to printer. 15837 15838 -p 15839 formats with "pr" before sending to printer. 15840 15841 -Pprinter 15842 sends output to the printer named printer instead of 15843 the default printer. 15844 15845 -h 15846 suppresses header page. 15847 15848 -s 15849 uses symbolic links. 15850 15851 -#copies 15852 specifies copies as the number of copies to print. 15853 15854 -J name 15855 specifies name as the job name for the header page. 15856 15857 -T title 15858 specifies title as the title used for "pr". 15859 15860 ls 15861 15862 Name 15863 15864 ls -- list directory contents 15865 15866 Description 15867 15868 ls is as specified in ISO POSIX (2003), but with differences 15869 listed below. 15870 15871 Differences 15872 15873 -l 15874 If the file is a character special or block special 15875 file, the size of the file shall be replaced with two 15876 unsigned numbers in the format "%u, %u", representing 15877 the major and minor device numbers associated with the 15878 special file. 15879 15880 Note: The LSB does not specify the meaning of the major and 15881 minor devices numbers. 15882 15883 -p 15884 in addition to ISO POSIX (2003) behavior of printing a 15885 slash for a directory, ls -p may display other 15886 characters for other file types. 15887 15888 Certain aspects of the pattern matching notation are optional; 15889 see Internationalization and Pattern Matching Notation. 15890 15891 lsb_release 15892 15893 Name 15894 15895 lsb_release -- print distribution specific information 15896 15897 Synopsis 15898 15899 lsb_release [OPTION...] 15900 15901 Description 15902 15903 The lsb_release command prints certain LSB (Linux Standard 15904 Base) and Distribution information. 15905 15906 If no options are given, the -v option is assumed. 15907 15908 Options 15909 15910 -v, --version 15911 displays version of LSB against which distribution is 15912 compliant. The version is expressed as a colon 15913 seperated list of LSB module descriptions. LSB module 15914 descriptions are dash seperated tuples containing the 15915 module name, version, and architecture name. The output 15916 is a single line of text of the following format: 15917 15918 LSB Version:\t 15919 15920 -i, --id 15921 displays string id of distributor. The output is a 15922 single line of text of the following format: 15923 15924 Distributor ID:\t 15925 15926 -d, --description 15927 displays single line text description of distribution. 15928 The output is of the following format: 15929 15930 Description:\t 15931 15932 -r, --release 15933 displays release number of distribution. The output is 15934 a single line of text of the following format: 15935 15936 Release:\t 15937 15938 -c, --codename 15939 displays codename according to distribution release. 15940 The output is a single line of text of the following 15941 format. 15942 15943 Codename:\t 15944 15945 -a, --all 15946 displays all of the above information. 15947 15948 -s, --short 15949 displays all of the above information in short output 15950 format. 15951 15952 -h, --help 15953 displays a human-readable help message. 15954 15955 Examples 15956 15957 The following command will list the LSB Profiles which are 15958 currently supported on this platform. 15959 example% lsb_release -v 15960 LSB Version: core-2.0-ia32:core-2.0-noarch:graphics-2.0-ia32:graphics-2 15961 .0-noarch 15962 15963 m4 15964 15965 Name 15966 15967 m4 -- macro processor 15968 15969 Description 15970 15971 m4 is as specified in ISO POSIX (2003), but with extensions as 15972 listed below. 15973 15974 Extensions 15975 15976 -P 15977 forces all builtins to be prefixed with m4_. For 15978 example, define becomes m4_define. 15979 15980 -I directory 15981 Add directory to the end of the search path for 15982 includes. 15983 15984 md5sum 15985 15986 Name 15987 15988 md5sum -- generate or check MD5 message digests 15989 15990 Synopsis 15991 15992 md5sum [-c [file] | file...] 15993 15994 Description 15995 15996 For each file, write to standard output a line containing the 15997 MD5 message digest of that file, followed by one or more blank 15998 characters, followed by the name of the file. The MD5 message 15999 digest shall be calculated according to RFC 1321: The MD5 16000 Message-Digest Algorithm and output as 32 hexadecimal digits. 16001 16002 If no file names are specified as operands, read from standard 16003 input and use "-" as the file name in the output. 16004 16005 Options 16006 16007 -c [file] 16008 checks the MD5 message digest of all files named in 16009 file against the message digest listed in the same 16010 file. The actual format of file is the same as the 16011 output of md5sum. That is, each line in the file 16012 describes a file. If file is not specified, read 16013 message digests from stdin. 16014 16015 Exit Status 16016 16017 md5sum shall exit with status 0 if the sum was generated 16018 successfully, or, in check mode, if the check matched. 16019 Otherwise, md5sum shall exit with a non-zero status. 16020 16021 mknod 16022 16023 Name 16024 16025 mknod -- make special files 16026 16027 Synopsis 16028 16029 mknod [-m mode | --mode=mode] name type [major minor] 16030 mknod [--version] 16031 16032 Description 16033 16034 The mknod command shall create a special file named name of 16035 the given type. 16036 16037 The type shall be one of the following: 16038 16039 b 16040 creates a block (buffered) special file with the 16041 specified major and minor device numbers. 16042 16043 c, u 16044 creates a character (unbuffered) special file with the 16045 specified major and minor device numbers. 16046 16047 p 16048 creates a FIFO. 16049 16050 Options 16051 16052 -m mode, --mode=mode 16053 create the special file with file access permissions 16054 set as described in mode. The permissions may be any 16055 absolute value (i.e. one not containing '+' or '-') 16056 acceptable to the chmod command. 16057 16058 --version 16059 output version information and exit. 16060 16061 Note: This option may be deprecated in a future release of 16062 this specification. 16063 16064 If type is pparameter, major and minor shall not be specified. 16065 Otherwise, these parameters are mandatory. 16066 16067 Future Directions 16068 16069 This command may be deprecated in a future version of this 16070 specification. The major and minor operands are insufficently 16071 portable to be specified usefully here. Only a FIFO can be 16072 portably created by this command, and the mkfifo command is a 16073 simpler interface for that purpose. 16074 16075 mktemp 16076 16077 Name 16078 16079 mktemp -- make temporary file name (unique) 16080 16081 Synopsis 16082 16083 mktemp [-q] [-u] template 16084 16085 Description 16086 16087 The mktemp command takes the given file name template and 16088 overwrites a portion of it to create a file name. This file 16089 name shall be unique and suitable for use by the application. 16090 16091 The template should have at least six trailing 'X' characters. 16092 These characters are replaced with characters from the 16093 portable filename character set in order to generate a unique 16094 name. 16095 16096 If mktemp can successfully generate a unique file name, and 16097 the -u option is not present, the file shall be created with 16098 read and write permission only for the current user. The 16099 mktemp command shall write the filename generated to the 16100 standard output. 16101 16102 Options 16103 16104 -q 16105 fail silently if an error occurs. Diagnostic messages 16106 to stderr are suppressed, but the command shall still 16107 exit with a non-zero exit status if an error occurs. 16108 16109 -u 16110 operates in `unsafe' mode. A unique name is generated, 16111 but the temporary file shall be unlinked before mktemp 16112 exits. Use of this option is not encouraged. 16113 16114 more 16115 16116 Name 16117 16118 more -- display files on a page-by-page basis 16119 16120 Description 16121 16122 more is as specified in ISO POSIX (2003), but with differences 16123 as listed below. 16124 16125 Differences 16126 16127 The more command need not respect the LINES and COLUMNS 16128 environment variables. 16129 16130 The following additional options may be supported: 16131 16132 -num 16133 specifies an integer which is the screen size (in 16134 lines). 16135 16136 +num 16137 starts at line number num. 16138 16139 +/pattern 16140 Start at the first line matching the pattern, 16141 equivalent to executing the search forward (/) command 16142 with the given pattern immediately after opening each 16143 file. 16144 16145 The following options from ISO POSIX (2003) may behave 16146 differently: 16147 16148 -e 16149 has unspecified behavior. 16150 16151 -i 16152 has unspecified behavior. 16153 16154 -n 16155 has unspecified behavior. 16156 16157 -p 16158 Either clear the whole screen before displaying any 16159 text (instead of the usual scrolling behavior), or 16160 provide the behavior specified by ISO POSIX (2003). In 16161 the latter case, the syntax is "-p command". 16162 16163 -t 16164 has unspecified behavior. 16165 16166 The more command need not support the following interactive 16167 commands: 16168 16169 g 16170 G 16171 u 16172 control u 16173 control f 16174 newline 16175 j 16176 k 16177 r 16178 R 16179 m 16180 ' (return to mark) 16181 /! 16182 ? 16183 N 16184 :e 16185 :t 16186 control g 16187 ZZ 16188 16189 Rationale 16190 16191 The +num and +/string options are deprecated in SUSv2, and 16192 have been removed in ISO POSIX (2003); however this 16193 specification continues to specify them because the publicly 16194 available util-linux package does not support the replacement 16195 (-p command). The +command option as found in SUSv2 is more 16196 general than is specified here, but the util-linux package 16197 appears to only support the more specific +num and +/string 16198 forms. 16199 16200 mount 16201 16202 Name 16203 16204 mount -- mount a file system 16205 16206 Synopsis 16207 16208 mount [-hV] 16209 mount [-a] [-fFnrsvw] [-t vfstype] 16210 mount [-fnrsvw] [-o options [,...]] [device | dir] 16211 mount [-fnrsvw] [-t vfstype] [-o options] device dir 16212 16213 Description 16214 16215 As described in ISO POSIX (2003), all files in the system are 16216 organized in a directed graph, known as the file hierarchy, 16217 rooted at /. These files can be spread out over several 16218 underlying devices. The mount command shall attach the file 16219 system found on some underlying device to the file hierarchy. 16220 16221 Options 16222 16223 -v 16224 invoke verbose mode. The mount command shall provide 16225 diagnostic messages on stdout. 16226 16227 -a 16228 mount all filesystems (of the given types) mentioned in 16229 /etc/fstab. 16230 16231 -F 16232 If the -a option is also present, fork a new 16233 incarnation of mount for each device to be mounted. 16234 This will do the mounts on different devices or 16235 different NFS servers in parallel. 16236 16237 -f 16238 cause everything to be done except for the actual 16239 system call; if it's not obvious, this `fakes' mounting 16240 the file system. 16241 16242 -n 16243 mount without writing in /etc/mtab. This is necessary 16244 for example when /etc is on a read-only file system. 16245 16246 -s 16247 ignore mount options not supported by a filesystem 16248 type. Not all filesystems support this option. 16249 16250 -r 16251 mount the file system read-only. A synonym is -o ro. 16252 16253 -w 16254 mount the file system read/write. (default) A synonym 16255 is -o rw. 16256 16257 -L label 16258 If the file /proc/partitions is supported, mount the 16259 partition that has the specified label. 16260 16261 -U uuid 16262 If the file /proc/partitions is supported, mount the 16263 partition that has the specified uuid. 16264 16265 -t vfstype 16266 indicate a file system type of vfstype. 16267 16268 More than one type may be specified in a comma 16269 separated list. The list of file system types can be 16270 prefixed with no to specify the file system types on 16271 which no action should be taken. 16272 16273 -o 16274 options are specified with a -o flag followed by a 16275 comma-separated string of options. Some of these 16276 options are only useful when they appear in the 16277 /etc/fstab file. The following options apply to any 16278 file system that is being mounted: 16279 16280 async 16281 perform all I/O to the file system 16282 asynchronously. 16283 16284 atime 16285 update inode access time for each access. 16286 (default) 16287 16288 auto 16289 in /etc/fstab, indicate the device is mountable 16290 with -a. 16291 16292 defaults 16293 use default options: rw, suid, dev, exec, auto, 16294 nouser, async. 16295 16296 dev 16297 interpret character or block special devices on 16298 the file system. 16299 16300 exec 16301 permit execution of binaries. 16302 16303 noatime 16304 do not update file access times on this file 16305 system. 16306 16307 noauto 16308 in /etc/fstab, indicates the device is only 16309 explicitly mountable. 16310 16311 nodev 16312 do not interpret character or block special 16313 devices on the file system. 16314 16315 noexec 16316 do not allow execution of any binaries on the 16317 mounted file system. 16318 16319 nosuid 16320 do not allow set-user-identifier or 16321 set-group-identifier bits to take effect. 16322 16323 nouser 16324 forbid an unprivileged user to mount the file 16325 system. (default) 16326 16327 remount 16328 remount an already-mounted file system. This is 16329 commonly used to change the mount options for a 16330 file system, especially to make a read-only file 16331 system writable. 16332 16333 ro 16334 mount the file system read-only. 16335 16336 rw 16337 mount the file system read-write. 16338 16339 suid 16340 allow set-user-identifier or set-group-identifier 16341 bits to take effect. 16342 16343 sync 16344 do all I/O to the file system synchronously. 16345 16346 user 16347 allow an unprivilieged user to mount the file 16348 system. This option implies the options noexec, 16349 nosuid, nodev unless overridden by subsequent 16350 options. 16351 16352 LSB Deprecated Options 16353 16354 The behaviors specified in this section are expected to 16355 disappear from a future version of the LSB; applications 16356 should only use the non-LSB-deprecated behaviors. 16357 16358 -V 16359 output version and exit. 16360 16361 msgfmt 16362 16363 Name 16364 16365 msgfmt -- create a message object from a message file 16366 16367 Synopsis 16368 16369 msgfmt [options...] filename... 16370 16371 Description 16372 16373 The msgfmt command generates a binary message catalog from a 16374 textual translation description. Message catalogs, or message 16375 object files, are stored in files with a .mo extension. 16376 16377 Note: The format of message object files is not guaranteed 16378 to be portable. Message catalogs should always be generated 16379 on the target architecture using the msgfmt command. 16380 16381 The source message files, otherwise known as portable object 16382 files, have a .po extension. 16383 16384 The filename operands shall be portable object files. The .po 16385 file contains messages to be displayed to users by system 16386 utilities or by application programs. The portable object 16387 files are text files, and the messages in them can be 16388 rewritten in any language supported by the system. 16389 16390 If any filename is -, a portable object file shall be read 16391 from the standard input. 16392 16393 The msgfmt command interprets data as characters according to 16394 the current setting of the LC_CTYPE locale category. 16395 16396 Options 16397 16398 -c, --check 16399 Detect and diagnose input file anomalies which might 16400 represent translation errors. The msgid and msgstr 16401 strings are studied and compared. It is considered 16402 abnormal that one string starts or ends with a newline 16403 while the other does not. 16404 16405 If the message is flagged as c-format (see Comment 16406 Handling), check that the msgid string and the msgstr 16407 translation have the same number of % format 16408 specifiers, with matching types. 16409 16410 -D directory, --directory=directory 16411 Add directory to list for input files search. If 16412 filename is not an absolute pathname and filename 16413 cannot be opened, search for it in directory. This 16414 option may be repeated. Directories shall be searched 16415 in order, with the leftmost directory searched first. 16416 16417 -f, --use-fuzzy 16418 Use entries marked as fuzzy in output. If this option 16419 is not specified, such entries are not included into 16420 the output. See Comment Handling below. 16421 16422 -o output-file, --output-file=output-file 16423 Specify the output file name as output-file. If 16424 multiple domains or duplicate msgids in the .po file 16425 are present, the behavior is unspecified. If 16426 output-file is -, output is written to standard output. 16427 16428 --strict 16429 Ensure that all output files have a .mo extension. 16430 Output files are named either by the -o (or 16431 --output-file) option, or by domains found in the input 16432 files. 16433 16434 -v, --verbose 16435 Print additional information to the standard error, 16436 including the number of translated strings processed. 16437 16438 Operands 16439 16440 The filename operands are treated as portable object files. 16441 The format of portable object files is defined in EXTENDED 16442 DESCRIPTION. 16443 16444 Standard Input 16445 16446 The standard input is not used unless a filename operand is 16447 specified as "-". 16448 16449 Environment Variables 16450 16451 LANGUAGE 16452 Specifies one or more locale names. 16453 16454 LANG 16455 Specifies locale name. 16456 16457 LC_ALL 16458 Specifies locale name for all categories. If defined, 16459 overrides LANG, LC_CTYPE and LC_MESSAGES. 16460 16461 LC_CTYPE 16462 Determine the locale for the interpretation of 16463 sequences of bytes of text data as characters (for 16464 example, single-byte as opposed to multi-byte 16465 characters in arguments and input files). 16466 16467 LC_MESSAGES 16468 Specifies messaging locale, and if present overrides 16469 LANG for messages. 16470 16471 Standard Output 16472 16473 The standard output is not used unless the option-argument of 16474 the -o option is specified as -. 16475 16476 Extended Description 16477 16478 The format of portable object files (.po files) is defined as 16479 follows. Each .po file contains one or more lines, with each 16480 line containing either a comment or a statement. Comments 16481 start the line with a hash mark (#) and end with the newline 16482 character. Empty lines, or lines containing only white-space, 16483 shall be ignored. Comments can in certain circumstances alter 16484 the behavior of msgfmt. See Comment Handling below for details 16485 on comment processing. The format of a statement is: 16486 16487 directive value 16488 16489 Each directive starts at the beginning of the line and is 16490 separated from value by white space (such as one or more space 16491 or tab characters). The value consists of one or more quoted 16492 strings separated by white space. If two or more strings are 16493 specified as value, they are normalized into single string 16494 using the string normalization syntax specified in ISO C 16495 (1999). The following directives are supported: 16496 16497 domain domainname 16498 16499 msgid message_identifier 16500 16501 msgid_plural untranslated_string_plural 16502 16503 msgstr message_string 16504 16505 msgstr[n] message_string 16506 16507 The behavior of the domain directive is affected by the 16508 options used. See OPTIONS for the behavior when the -o option 16509 is specified. If the -o option is not specified, the behavior 16510 of the domain directive is as follows: 16511 16512 1. All msgids from the beginning of each .po file to the 16513 first domain directive are put into a default message 16514 object file, messages (or messages.mo if the --strict 16515 option is specified). 16516 2. When msgfmt encounters a domain domainname directive in 16517 the .po file, all following msgids until the next domain 16518 directive are put into the message object file domainname 16519 (or domainname.mo if --strict option is specified). 16520 3. Duplicate msgids are defined in the scope of each domain. 16521 That is, a msgid is considered a duplicate only if the 16522 identical msgid exists in the same domain. 16523 4. All duplicate msgids are ignored. 16524 16525 The msgid directive specifies the value of a message 16526 identifier associated with the directive that follows it. The 16527 msgid_plural directive specifies the plural form message 16528 specified to the plural message handling functions ngettext(), 16529 dngettext() or dcngettext(). The message_identifier string 16530 identifies a target string to be used at retrieval time. Each 16531 statement containing a msgid directive shall be followed by a 16532 statement containing a msgstr directive or msgstr[n] 16533 directives. 16534 16535 The msgstr directive specifies the target string associated 16536 with the message_identifier string declared in the immediately 16537 preceding msgid directive. 16538 16539 The msgstr[n] (where n = 0, 1, 2, ...) directive specifies the 16540 target string to be used with plural form handling functions 16541 ngettext(), dngettext() and dcngettext(). 16542 16543 Message strings can contain the following escape sequences: 16544 16545 Table 9-1. Escape Sequences 16546 \n newline 16547 \t tab 16548 \v vertical tab 16549 \b backspace 16550 \r carriage return 16551 \f formfeed 16552 \\ backslash 16553 \" double quote 16554 \ddd octal bit pattern 16555 \xHH hexadecimal bit pattern 16556 16557 Comment Handling 16558 16559 Comments are introduced by a #, and continue to the end of the 16560 line. The second character (i.e. the character following the 16561 #) has special meaning. Regular comments should follow a space 16562 character. Other comment types include: 16563 16564 # normal-comments 16565 16566 #. automatic-comments 16567 16568 #: reference... 16569 16570 #, flag 16571 16572 Automatic and reference comments are typically generated by 16573 external utilities, and are not specified by the LSB. The 16574 msgfmt command shall ignore such comments. 16575 16576 Note: Portable object files may be produced by unspecified 16577 tools. Some of the comment types described here may arise 16578 from the use of such tools. It is beyond the scope of this 16579 specification to describe these tools. 16580 16581 The #, comments require one or more flags separated by the 16582 comma (,) character. The following flags can be specified: 16583 16584 fuzzy 16585 This flag shows that the following msgstr string might 16586 not be a correct translation. Only the translator (i.e. 16587 the individual undertaking the translation) can judge 16588 if the translation requires further modification, or is 16589 acceptable as is. Once satisfied with the translation, 16590 the translator then removes this fuzzy flag. 16591 16592 If this flag is specified, the msgfmt utility will not 16593 generate the entry for the immediately following msgid 16594 in the output message catalog, unless the --use-fuzzy 16595 is specified. 16596 16597 c-format, no-c-format 16598 The c-format flag indicates that the msgid string is 16599 used as format string by printf()-like functions. If 16600 the c-format flag is given for a string the msgfmt 16601 utility may perform additional tests to check to 16602 validity of the translation. 16603 16604 Plurals 16605 16606 The msgid entry with empty string ("") is called the header 16607 entry and is treated specially. If the message string for the 16608 header entry contains nplurals=value, the value indicates the 16609 number of plural forms. For example, if nplurals=4, there are 16610 4 plural forms. If nplurals is defined, there should be a 16611 plural=expression on the same line, separated by a semicolon 16612 (;) character. The expression is a C language expression to 16613 determine which version of msgstr[n] to be used based on the 16614 value of n, the last argument of ngettext(), dngettext() or 16615 dcngettext(). For example: 16616 nplurals=2; plural=n == 1 ? 0 : 1 16617 16618 indicates that there are 2 plural forms in the language; 16619 msgstr[0] is used if n == 1, otherwise msgstr[1] is used. 16620 Another example: 16621 nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2 16622 16623 indicates that there are 3 plural forms in the language; 16624 msgstr[0] is used if n == 1, msgstr[1] is used if n == 2, 16625 otherwise msgstr[2] is used. 16626 16627 If the header entry contains charset=codeset string, the 16628 codeset is used to indicate the codeset to be used to encode 16629 the message strings. If the output string's codeset is 16630 different from the message string's codeset, codeset 16631 conversion from the message strings's codeset to the output 16632 string's codeset will be performed upon the call of gettext(), 16633 dgettext(), dcgettext(), ngettext(), dngettext(), and 16634 dcngettext(). The output string's codeset is determined by the 16635 current locale's codeset (the return value of 16636 nl_langinfo(CODESET)) by default, and can be changed by the 16637 call of bind_textdomain_codeset(). 16638 16639 Exit Status 16640 16641 The following exit values are returned: 16642 16643 0 16644 Successful completion. 16645 16646 >0 16647 An error occurred. 16648 16649 Application Usage 16650 16651 Neither msgfmt nor any gettext() function imposes a limit on 16652 the total length of a message. Installing message catalogs 16653 under the C locale is pointless, since they are ignored for 16654 the sake of efficiency. 16655 16656 Examples 16657 16658 Example 1: Examples of creating message objects from message 16659 files. 16660 16661 In this example module1.po, module2.po and module3.po are 16662 portable message object files. 16663 example% cat module1.po 16664 16665 # default domain "messages" 16666 16667 msgid "message one" 16668 16669 msgstr "mensaje nśmero uno" 16670 16671 # 16672 16673 domain "help_domain" 16674 16675 msgid "help two" 16676 16677 msgstr "ayuda nśmero dos" 16678 16679 # 16680 16681 domain "error_domain" 16682 16683 msgid "error three" 16684 16685 msgstr "error nśmero tres" 16686 16687 example% cat module2.po 16688 16689 # default domain "messages" 16690 16691 msgid "message four" 16692 16693 msgstr "mensaje nśmero cuatro" 16694 16695 # 16696 16697 domain "error_domain" 16698 16699 msgid "error five" 16700 16701 msgstr "error nśmero cinco" 16702 16703 # 16704 16705 domain "window_domain" 16706 16707 msgid "window six" 16708 16709 msgstr "ventana nśmero seises" 16710 16711 example% cat module3.po 16712 16713 # default domain "messages" 16714 16715 msgid "message seven" 16716 16717 msgstr "mensaje nśmero siete" 16718 16719 The following command will produce the output files messages, 16720 help_domain, and error_domain. 16721 example% msgfmt module1.po 16722 16723 The following command will produce the output files 16724 messages.mo, help_domain.mo, error_domain.mo, and 16725 window_domain.mo. 16726 example% msgfmt module1.po module2.po 16727 16728 The following example will produce the output file hello.mo. 16729 example% msgfmt -o hello.mo module3.po 16730 16731 newgrp 16732 16733 Name 16734 16735 newgrp -- change group ID 16736 16737 Synopsis 16738 16739 newgrp [group] 16740 16741 Description 16742 16743 The newgrp command is as specified in ISO POSIX (2003), but 16744 with differences as listed below. 16745 16746 Differences 16747 16748 The -l option specified in ISO POSIX (2003) need not be 16749 supported. 16750 16751 od 16752 16753 Name 16754 16755 od -- dump files in octal and other formats 16756 16757 Synopsis 16758 16759 od [-abcdfilox] [-w width | --width-width] [-v] [-A 16760 address_base] [-j skip] [-n count] [-t type_string] [file...] 16761 od --traditional [options] [file] [[+]offset [.] [b]] 16762 [[+]label [.] [b]] 16763 16764 Description 16765 16766 od is as specified in ISO POSIX (2003), but with differences 16767 as listed below. 16768 16769 Differences 16770 16771 -wwidth, --width[=width] 16772 each output line is limited to width bytes from the 16773 input. 16774 16775 --traditional 16776 accepts arguments in traditional form. 16777 16778 Note: The XSI optional behavior described in ISO POSIX 16779 (2003) is not supported unless the --traditional option is 16780 also specified. 16781 16782 Pre-POSIX and XSI Specifications 16783 16784 The LSB supports option intermixtures with the following 16785 pre-POSIX and XSI options: 16786 16787 -a 16788 is equivalent to -t a, selects named characters. 16789 16790 -b 16791 is equivalent to -t o1, selects octal bytes. 16792 16793 -c 16794 is equivalent to -t c, selects characters. 16795 16796 -d 16797 is equivalent to -t u2, selects unsigned decimal two 16798 byte units. 16799 16800 -f 16801 is equivalent to -t fF, selects floats. 16802 16803 -i 16804 is equivalent to -t d2, selects decimal two byte units. 16805 16806 Note: This usage may change in future releases; portable 16807 applications should use -t d2. 16808 16809 -l 16810 is equivalent to -t d4, selects decimal longs. 16811 16812 -o 16813 is equivalent to -t o2, selects octal two byte units. 16814 16815 -x 16816 is equivalent to -t x2, selects hexadecimal two byte 16817 units. 16818 16819 Note that the XSI option -s need not be supported. 16820 16821 Traditional Usage 16822 16823 If the --traditional is specified, there may be between zero 16824 and three operands specified. 16825 16826 If no operands are specified, then od shall read the standard 16827 input. 16828 16829 If there is exactly one operand, and it is an offset of the 16830 form [+]offset[.][b], then it shall be interpreted as 16831 specified in ISO POSIX (2003). The file to be dumped shall be 16832 the standard input. 16833 16834 If there are exactly two operands, and they are both of the 16835 form [+]offset[.][b], then the first shall be an treated as an 16836 offset (as above), and the second shall be a label, in the 16837 same format as the offset. If a label is specified, then the 16838 first output line produced for each input block shall be 16839 preceded by the input offset, cumulative across input files, 16840 of the next byte to be written, followed by the label, in 16841 parentheses. The label shall increment in the same manner as 16842 the offset. 16843 16844 If there are three operands, then the first shall be the file 16845 to dump, the second the offset, and the third the label. 16846 16847 passwd 16848 16849 Name 16850 16851 passwd -- change user password 16852 16853 Synopsis 16854 16855 passwd [-x max] [-n min] [-w warn] [-i inact] name 16856 passwd {-l | -u} name 16857 16858 Description 16859 16860 passwd changes passwords for user and group accounts. A normal 16861 user may only change the password for their own account, the 16862 super user may change the password for any account. passwd 16863 also changes password expiry dates and intervals. Applications 16864 may not assume the format of prompts and anticipated input for 16865 user interaction, because they are unspecified. 16866 16867 Options 16868 16869 -x max 16870 sets the maximum number of days a password remains 16871 valid. 16872 16873 -n min 16874 sets the minimum number of days before a password may 16875 be changed. 16876 16877 -w warn 16878 sets the number of days warning the user will receive 16879 before their password will expire. 16880 16881 -i inactive 16882 disables an account after the password has been expired 16883 for the given number of days. 16884 16885 -l 16886 disables an account by changing the password to a value 16887 which matches no possible encrypted value. 16888 16889 -u 16890 re-enables an account by changing the password back to 16891 its previous value. 16892 16893 patch 16894 16895 Name 16896 16897 patch -- apply a diff file to an original 16898 16899 Description 16900 16901 patch is as specified in ISO POSIX (2003), but with extensions 16902 as listed below. 16903 16904 Extensions 16905 16906 --binary 16907 reads and write all files in binary mode, except for 16908 standard output and /dev/tty. This option has no effect 16909 on POSIX-compliant systems. 16910 16911 -u, --unified 16912 interprets the patch file as a unified context diff. 16913 16914 pidof 16915 16916 Name 16917 16918 pidof -- find the process ID of a running program 16919 16920 Synopsis 16921 16922 pidof [-s] [-x] [-o omitpid...] program... 16923 16924 Description 16925 16926 Return the process ID of a process which is running the 16927 program named on the command line. 16928 16929 Options 16930 16931 -s 16932 instructs the program to only return one pid. 16933 16934 -x 16935 causes the program to also return process id's of 16936 shells running the named scripts. 16937 16938 -o 16939 omits processes with specified process id. 16940 16941 remove_initd 16942 16943 Name 16944 16945 remove_initd -- clean up boot script system modifications 16946 introduced by install_initd 16947 16948 Synopsis 16949 16950 /usr/lib/lsb/remove_initd initd_file 16951 16952 Description 16953 16954 remove_initd processes the removal of the modifications made 16955 to a distribution's boot script system by the install_initd 16956 program. This cleanup is performed in the preuninstall script 16957 of a package; however, the package manager is still 16958 responsible for removing the /etc/init.d file. See also 16959 Section 14.4. 16960 16961 renice 16962 16963 Name 16964 16965 renice -- alter priority of running processes 16966 16967 Description 16968 16969 renice is as specified in ISO POSIX (2003), but with 16970 differences as listed below. 16971 16972 Differences 16973 16974 -n increment 16975 has unspecified behavior. 16976 16977 sed 16978 16979 Name 16980 16981 sed -- stream editor 16982 16983 Description 16984 16985 sed is as specified in ISO POSIX (2003), but with differences 16986 as listed below. 16987 16988 LSB Differences 16989 16990 Certain aspects of internationalized regular expressions are 16991 optional; see Internationalization and Regular Expressions. 16992 16993 sendmail 16994 16995 Name 16996 16997 sendmail -- an electronic mail transport agent 16998 16999 Synopsis 17000 17001 sendmail [options] [address...] 17002 17003 Description 17004 17005 To deliver electronic mail (email), applications shall support 17006 the interface provided by /usr/sbin/sendmail (described here). 17007 This interface shall be the default delivery method for 17008 applications. 17009 17010 This program sends an email message to one or more recipients, 17011 routing the message as necessary. This program is not intended 17012 as a user interface routine. 17013 17014 With no options, sendmail reads its standard input up to an 17015 end-of-file or a line consisting only of a single dot and 17016 sends a copy of the message found there to all of the 17017 addresses listed. It determines the network(s) to use based on 17018 the syntax and contents of the addresses. 17019 17020 It is recommended that applications use as few options as 17021 necessary, none if possible. 17022 17023 Some agents allow aliasing on the local system to be prevented 17024 by preceding the address with a backslash. 17025 17026 The format of messages shall be as defined in RFC 2822. 17027 17028 Options 17029 17030 -bm 17031 reads mail from standard input and delivers to the 17032 recipient addresses. This is the default mode of 17033 operation. 17034 17035 -bp 17036 lists information about messages currently in the input 17037 mail queue. 17038 17039 -bs 17040 uses the SMTP protocol as described in RFC 2821; reads 17041 SMTP commands on standard input and writes SMTP 17042 responses on standard output. 17043 17044 Note that RFC 2821 specifies \r\n (CR-LF) be used at 17045 the end of each line, but pipes almost always use \n 17046 (LF) instead. To deal with this, agents will accept 17047 both \r\n and \n at the end of each line. When 17048 accepting \r\n, the \r before the \n is silently 17049 discarded. 17050 17051 -F fullname 17052 explicitly sets the full name of the sender for 17053 incoming mail unless the message already contains a 17054 From: message header. 17055 17056 If the user running sendmail is not sufficiently 17057 trusted, then the actual sender may be indicated in the 17058 message, depending on the behavior of the agent. 17059 17060 -f name 17061 explicitly sets the envelope sender address for 17062 incoming mail. If there is no From: header, the address 17063 specified in the From: header will also be set. 17064 17065 If the user running sendmail is not sufficiently 17066 trusted, then the actual sender will be indicated in 17067 the message. 17068 17069 -i 17070 ignores dots alone on lines by themselves in incoming 17071 messages. If -bs is also used, the behavior is 17072 unspecified. 17073 17074 -odb 17075 delivers any mail in background, if supported; 17076 otherwise ignored. 17077 17078 -odf 17079 delivers any mail in foreground, if supported; 17080 otherwise ignored. 17081 17082 -oem or -em 17083 mails errors back to the sender. (default) 17084 17085 -oep or -ep 17086 writes errors to the standard error output. 17087 17088 -oeq or -eq 17089 does not send notification of errors to the sender. 17090 This only works for mail delivered locally. 17091 17092 -oi 17093 is equivalent to -i. 17094 17095 -om 17096 indicates that the sender of a message should receive a 17097 copy of the message if the sender appears in an alias 17098 expansion. Ignored if aliases are not supported. 17099 17100 -t 17101 reads the message to obtain recipients from the To:, 17102 Cc:, and Bcc: headers in the message instead of from 17103 the command arguments. If a Bcc: header is present, it 17104 is removed from the message unless there is no To: or 17105 Cc: header, in which case a Bcc: header with no data is 17106 created, in accordance with RFC 2822. 17107 17108 If there are any arguments, they specify addresses to 17109 which the message is not to be delivered. That is, the 17110 argument addresses are removed from the recipients list 17111 obtained from the headers. Note: some agents implement 17112 this behavior in reverse, adding addresses instead of 17113 removing them. Others may disallow addresses in 17114 argument list. Therefore, applications should not put 17115 addresses in the argument list if -t is used. 17116 17117 This option is sometimes ignored when not in -bm mode 17118 (the default). 17119 17120 Exit status 17121 17122 0 17123 successful completion on all addresses. This does not 17124 indicate successful delivery. 17125 17126 >0 17127 there was an error. 17128 17129 Notes/Rationale 17130 17131 This page is believed to reflect functionality provided by 17132 smail, exim and other implementations, not just the sendmail 17133 implementation. 17134 17135 shutdown 17136 17137 Name 17138 17139 shutdown -- bring the system down 17140 17141 Synopsis 17142 17143 /sbin/shutdown [-t sec] [-arkhcfF] time [warning-message] 17144 17145 Description 17146 17147 shutdown brings the system down in a secure way. All logged-in 17148 users are notified that the system is going down, and login(1) 17149 is blocked. It is possible to shut the system down immediately 17150 or after a specified delay. All processes are first notified 17151 that the system is going down by the signal SIGTERM. If 17152 neither the -h or the -r argument is used, then the default 17153 behavior is to take the system to runlevel one where 17154 administrative tasks can be run. 17155 17156 Standard Options 17157 17158 -a 17159 uses /etc/shutdown.allow. 17160 17161 -t sec 17162 tells init(8) to wait sec seconds between sending 17163 processes the warning and the kill signal, before 17164 changing to another runlevel. 17165 17166 -k 17167 doesn't really shutdown; only sends the warning 17168 messages to everybody. 17169 17170 -r 17171 reboots after shutdown. 17172 17173 -h 17174 halts after shutdown. Powering off after halting is 17175 unspecified. 17176 17177 -f 17178 skips fsck on reboot. 17179 17180 -F 17181 forces fsck on reboot. 17182 17183 -c 17184 cancels an already running shutdown. With this option, 17185 it is of course not possible to give the time argument, 17186 but you can enter a explanatory message on the command 17187 line that will be sent to all users. 17188 17189 time 17190 specifies when to shut down. 17191 17192 The time argument can have different formats. First, it 17193 can be an absolute time in the format hh:mm, in which 17194 hh is the hour (1 or 2 digits) and mm is the minute of 17195 the hour (in two digits). Second, it can be in the 17196 format +m, in which m is the number of minutes to wait. 17197 The word now is an alias for +0. 17198 17199 If shutdown is called with a delay, it creates the 17200 advisory file /etc/nologin which causes programs such 17201 as login(1) to not allow new user logins. shutdown only 17202 removes this file if it is stopped before it can signal 17203 init (i.e. it is cancelled or something goes wrong). 17204 Otherwise it is the responsibility of the system 17205 shutdown or startup scripts to remove this file so that 17206 users can login. 17207 17208 warning-message 17209 specifies message to send all users. 17210 17211 su 17212 17213 Name 17214 17215 su -- change user ID or become super-user 17216 17217 Synopsis 17218 17219 su [options] [-] [username [ARGS]] 17220 17221 Description 17222 17223 su is used to become another user during a login session. 17224 Invoked without a username, su defaults to becoming the super 17225 user. The optional argument - may be used to provide an 17226 environment similar to what the user would expect had the user 17227 logged in directly. 17228 17229 The user will be prompted for a password, if appropriate. 17230 Invalid passwords will produce an error message. All attempts, 17231 both valid and invalid, are logged to detect abuses of the 17232 system. Applications may not assume the format of prompts and 17233 anticipated input for user interaction, because they are 17234 unspecified. 17235 17236 An optional command can be executed. This is done by the shell 17237 specified in /etc/passwd for the target user unless the -s or 17238 -m options are used. Any arguments supplied after the username 17239 will be passed to the invoked shell (shell shall support the 17240 -c command line option in order for a command to be passed to 17241 it). 17242 17243 The current environment is passed to the new shell. The value 17244 of $PATH is reset to /bin:/usr/bin for normal users, or 17245 /sbin:/bin:/usr/sbin:/usr/bin for the super user. This may be 17246 changed with the ENV_PATH and ENV_SUPATH definitions in 17247 /etc/login.defs. When using the -m or -p options, the user's 17248 environment is not changed. 17249 17250 A subsystem login is indicated by the presense of a "*" as the 17251 first character of the login shell. The given home directory 17252 will be used as the root of a new filesystem which the user is 17253 actually logged into. 17254 17255 Standard Options 17256 17257 - 17258 makes this a login shell. 17259 17260 -c, --comand=command 17261 passes command to the invoked shell. It is passed 17262 directly to the invoked shell (using the shell's -c 17263 option), so its syntax is whatever that shell can 17264 accept. 17265 17266 -m, -p, --preserve-environment 17267 does not reset environment variables, and keeps the 17268 same shell if it is present in /etc/shells. 17269 17270 -s, --shell=shell 17271 uses shell instead of the default in /etc/passwd. The 17272 shell specified shall be present in /etc/shells. 17273 17274 sync 17275 17276 Name 17277 17278 sync -- flush filesystem buffers 17279 17280 Synopsis 17281 17282 sync 17283 17284 Description 17285 17286 Force changed blocks to disk, update the super block. 17287 17288 tar 17289 17290 Name 17291 17292 tar -- file archiver 17293 17294 Description 17295 17296 tar is as specified in SUSv2, but with differences as listed 17297 below. 17298 17299 Differences 17300 17301 Certain aspects of internationalized filename globbing are 17302 optional; see Internationalization and Pattern Matching 17303 Notation. 17304 17305 -h 17306 doesn't dump symlinks; dumps the files they point to. 17307 17308 -z 17309 filters the archive through gzip. 17310 17311 umount 17312 17313 Name 17314 17315 umount -- unmount file systems 17316 17317 Synopsis 17318 17319 umount [-hV] 17320 umount -a [-nrv] [-t vfstype] 17321 umount [-nrv] device | dir... 17322 17323 Description 17324 17325 umount detaches the file system(s) mentioned from the file 17326 hierarchy. A file system is specified by giving the directory 17327 where it has been mounted. 17328 17329 Standard Options 17330 17331 -v 17332 invokes verbose mode. 17333 17334 -n 17335 unmounts without writing in /etc/mtab. 17336 17337 -r 17338 tries to remount read-only if unmounting fails. 17339 17340 -a 17341 unmounts all of the file systems described in /etc/mtab 17342 except for the proc filesystem. 17343 17344 -t vfstype 17345 indicates that the actions should only be taken on file 17346 systems of the specified type. More than one type may 17347 be specified in a comma separated list. The list of 17348 file system types can be prefixed with no to specify 17349 the file system types on which no action should be 17350 taken. 17351 17352 -f 17353 forces unmount (in case of an unreachable NFS system). 17354 17355 LSB Deprecated Options 17356 17357 The behaviors specified in this section are expected to 17358 disappear from a future version of the LSB; applications 17359 should only use the non-LSB-deprecated behaviors. 17360 17361 -V 17362 print version and exits. 17363 17364 useradd 17365 17366 Name 17367 17368 useradd -- create a new user or update default new user 17369 information 17370 17371 Synopsis 17372 17373 useradd [-c comment] [-d home_dir] 17374 [-g initial_group] [-G group[,...]] 17375 [-m [-k skeleton_dir]] [-p passwd] [-r] 17376 [-s shell] [-u uid [ -o]] login 17377 17378 useradd -D [-g default_group] [-b default_home] 17379 [-s default_shell] 17380 17381 Description 17382 17383 When invoked without the -D option, useradd creates a new user 17384 account using the values specified on the command line and the 17385 default values from the system. The new user account will be 17386 entered into the system files as needed, the home directory 17387 will be created, and initial files copied, depending on the 17388 command line options. 17389 17390 When invoked with the -D option, useradd will either display 17391 the current default values, or update the default values from 17392 the command line. If no options are specified, useradd 17393 displays the current default values. 17394 17395 Standard Options 17396 17397 -c comment 17398 specifies the new user's password file comment field 17399 value. 17400 17401 -d home_dir 17402 creates the new user using home_dir as the value for 17403 the user's login directory. The default is to append 17404 the login name to default_home and use that as the 17405 login directory name. 17406 17407 -g initial_group 17408 specifies the group name or number of the user's 17409 initial login group. The group name shall exist. A 17410 group number shall refer to an already existing group. 17411 If -g is not specified, the implementation will follow 17412 the normal user default for that system. This may 17413 create a new group or choose a default group that 17414 normal users are placed in. Applications which require 17415 control of the groups into which a user is placed 17416 should specify -g. 17417 17418 -G group,[...] 17419 specifies a list of supplementary groups which the user 17420 is also a member of. Each group is separated from the 17421 next by a comma, with no intervening whitespace. The 17422 groups are subject to the same restrictions as the 17423 group given with the -g option. The default is for the 17424 user to belong only to the initial group. 17425 17426 -m [-k skeleton_dir] 17427 specifies the user's home directory will be created if 17428 it does not exist. The files contained in skeleton_dir 17429 will be copied to the home directory if the -k option 17430 is used, otherwise the files contained in /etc/skel 17431 will be used instead. Any directories contained in 17432 skeleton_dir or /etc/skel will be created in the user's 17433 home directory as well. The -k option is only valid in 17434 conjunction with the -m option. The default is to not 17435 create the directory and to not copy any files. 17436 17437 -p passwd 17438 is the encrypted password, as returned by crypt(3). The 17439 default is to disable the account. 17440 17441 -r 17442 creates a system account, that is, a user with a UID in 17443 the range reserved for system account users. If there 17444 is not a UID free in the reserved range the command 17445 will fail. 17446 17447 -s shell 17448 specifies the name of the user's login shell. The 17449 default is to leave this field blank, which causes the 17450 system to select the default login shell. 17451 17452 -u uid [-o] 17453 specifies the numerical value of the user's ID. This 17454 value shall be unique, unless the -o option is used. 17455 The value shall be non-negative. The default is the 17456 smallest ID value greater than 499 which is not yet 17457 used. 17458 17459 Change Default Options 17460 17461 -b default_home 17462 specifies the initial path prefix for a new user's home 17463 directory. The user's name will be affixed to the end 17464 of default_home to create the new directory name if the 17465 -d option is not used when creating a new account. 17466 17467 -g default_group 17468 specifies the group name or ID for a new user's initial 17469 group. The named group shall exist, and a numerical 17470 group ID shall have an existing entry. 17471 17472 -s default_shell 17473 specifies the name of the new user's login shell. The 17474 named program will be used for all future new user 17475 accounts. 17476 17477 -c comment 17478 specifies the new user's password file comment field 17479 value. 17480 17481 Application Usage 17482 17483 The -D option will typically be used by system administration 17484 packages. Most applications should not change defaults which 17485 will affect other applications and users. 17486 17487 userdel 17488 17489 Name 17490 17491 userdel -- delete a user account and related files 17492 17493 Synopsis 17494 17495 userdel [-r] login 17496 17497 Description 17498 17499 Delete the user account named login. If there is also a group 17500 named login, this command may delete the group as well, or may 17501 leave it alone. 17502 17503 Options 17504 17505 -r 17506 removes files in the user's home directory along with 17507 the home directory itself. Files located in other file 17508 system will have to be searched for and deleted 17509 manually. 17510 17511 usermod 17512 17513 Name 17514 17515 usermod -- modify a user account 17516 17517 Synopsis 17518 17519 usermod [-c comment] [-d home_dir [ -m]] 17520 [-g initial_group] [-G group[,...]] 17521 [-l login_name] [-p passwd] 17522 [-s shell] [-u uid [ -o]] login 17523 17524 Options 17525 17526 -c comment 17527 specifies the new value of the user's password file 17528 comment field. 17529 17530 -d home_dir 17531 specifies the user's new login directory. If the -m 17532 option is given the contents of the current home 17533 directory will be moved to the new home directory, 17534 which is created if it does not already exist. 17535 17536 -g initial_group 17537 specifies the group name or number of the user's new 17538 initial login group. The group name shall exist. A 17539 group number shall refer to an already existing group. 17540 17541 -G group,[...] 17542 specifies a list of supplementary groups which the user 17543 is also a member of. Each group is separated from the 17544 next by a comma, with no intervening whitespace. The 17545 groups are subject to the same restrictions as the 17546 group given with the -g option. If the user is 17547 currently a member of a group which is not listed, the 17548 user will be removed from the group. 17549 17550 -l login_name 17551 changes the name of the user from login to login_name. 17552 Nothing else is changed. In particular, the user's home 17553 directory name should probably be changed to reflect 17554 the new login name. 17555 17556 -p passwd 17557 is the encrypted password, as returned by crypt(3). 17558 17559 -s shell 17560 specifies the name of the user's new login shell. 17561 Setting this field to blank causes the system to select 17562 the default login shell. 17563 17564 -u uid [-o] 17565 specifies the numerical value of the user's ID. This 17566 value shall be unique, unless the -o option is used. 17567 The value shall be non-negative. Any files which the 17568 user owns and which are located in the directory tree 17569 rooted at the user's home directory will have the file 17570 user ID changed automatically. Files outside of the 17571 user's home directory shall be altered manually. 17572 17573 xargs 17574 17575 Name 17576 17577 xargs -- build and execute command lines from standard input 17578 17579 Description 17580 17581 xargs is as specified in ISO POSIX (2003), but with 17582 differences as listed below. 17583 17584 Differences 17585 17586 -E 17587 has unspecified behavior. 17588 17589 -I 17590 has unspecified behavior. 17591 17592 -L 17593 has unspecified behavior. 17594 17595 V. Execution Environment 17596 17597 Table of Contents 17598 10. File System Hierarchy 17599 11. Additional Recommendations 17600 12. Additional Behaviors 17601 13. Localization 17602 _________________________________________________________ 17603 17604 Chapter 10. File System Hierarchy 17605 17606 An LSB conforming implementation shall provide the mandatory 17607 portions of the filesystem hierarchy specified in the 17608 Filesystem Hierarchy Standard (FHS), together with any 17609 additional requirements made in this specification. 17610 17611 An LSB conforming application shall conform to the Filesystem 17612 Hierarchy Standard. 17613 17614 The FHS allows many components or subsystems to be optional. 17615 An application shall check for the existence of an optional 17616 component before using it, and should behave in a reasonable 17617 manner if the optional component is not present. 17618 17619 The FHS requirement to locate the operating system kernel in 17620 either / or /boot does not apply if the operating system 17621 kernel does not exist as a file in the filesystem. 17622 17623 The FHS specifies certain behaviors for a variety of commands 17624 if they are present (for example, ping or python). However, 17625 LSB applications shall not rely on any commands beyond those 17626 specified by the LSB. The mere existence of a command may not 17627 be used as an indication that the command behaves in any 17628 particular way. 17629 17630 The following directories or links need not be present: 17631 /etc/X11 /usr/bin/X11 /usr/lib/X11 /proc 17632 _________________________________________________________ 17633 17634 10.1. /dev 17635 17636 The following shall exist under /dev. Other devices may also 17637 exist in /dev. Device names may exist as symbolic links to 17638 other device nodes located in /dev or subdirectories of /dev. 17639 There is no requirement concerning major/minor number values. 17640 17641 /dev/null 17642 An infinite data source and data sink. Data written to 17643 this device shall be discarded. Reads from this device 17644 shall always return end-of-file (EOF). 17645 17646 /dev/zero 17647 This device is a source of zeroed out data. All data 17648 written to this device shall be discarded. A read from 17649 this device shall always return the requested number of 17650 bytes, each initialized to the value '\0'. 17651 17652 /dev/tty 17653 In each process, a synonym for the controlling terminal 17654 associated with the process group of that process, if 17655 any. All reads and writes to this device shall behave 17656 as if the actual controlling terminal device had been 17657 opened. 17658 _________________________________________________________ 17659 17660 10.2. User Accounting Databases 17661 17662 The Filesystem Hierarchy Standard specifies two optional 17663 locations for user accounting databases used by the 17664 getutent(), getutent_r(), getutxent(), getutxid(), 17665 getutxline(), and pututxline() functions. These are 17666 /var/run/utmp and /var/run/wtmp. 17667 17668 The LSB does not specify the format or structure of these 17669 files, or even if they are files at all. If the implementation 17670 uses the file system to store these databases, the filenames 17671 /var/run/utmp and /var/log/wtmp may refer to one or more files 17672 with that stem. 17673 _________________________________________________________ 17674 17675 Chapter 11. Additional Recommendations 17676 17677 11.1. Minimal granted Directory and File permissions 17678 17679 In this Chapter "System" means an "LSB conforming 17680 implementation" and "application" means an "LSB conforming 17681 (third party vendor) application". 17682 17683 The system shall grant to the application read and execute 17684 permissions on files needed to use all system interfaces 17685 (ABIs) required by the LSB specification. 17686 _________________________________________________________ 17687 17688 11.2. Recommendations for applications on ownership and permissions 17689 17690 11.2.1. Directory Write Permissions 17691 17692 The application should not depend on having directory write 17693 permission outside /tmp, /var/tmp, invoking user's home 17694 directory and /var/opt/package, (where package is the name of 17695 the application package). 17696 17697 The application should not depend on owning these directories. 17698 17699 For these directories the application should be able to work 17700 with directory write permissions restricted by the S_ISVTXT 17701 bit (otherwise known as the "sticky bit"). 17702 _________________________________________________________ 17703 17704 11.2.2. File Write Permissions 17705 17706 The application should not depend on file write permission on 17707 files not owned by the user it runs under with the exception 17708 of its personal inbox /var/mail/username. 17709 _________________________________________________________ 17710 17711 11.2.3. File Read and execute Permissions 17712 17713 The application should not depend on having read permission to 17714 every file and directory. 17715 _________________________________________________________ 17716 17717 11.2.4. Suid and Sgid Permissions 17718 17719 The application should not depend on the set user ID or set 17720 group ID (the S_ISUID or S_ISGID permissions of a file not 17721 packaged with the application. Instead, the distribution is 17722 responsible for assuming that all system commands have the 17723 required permissions and work correctly. 17724 17725 Rationale: In order to implement common security policies 17726 it is strongly advisable for applications to use the 17727 minimum set of security attributes necessary for correct 17728 operation. Applications that require substantial 17729 appropriate privilege are likely to cause problems with 17730 such security policies. 17731 _________________________________________________________ 17732 17733 11.2.5. Privileged users 17734 17735 In general, applications should not depend on running as a 17736 privileged user. This specification uses the term "appropriate 17737 privilege" throughout to identify operations that cannot be 17738 achieved without some special granting of additional 17739 privilege. 17740 17741 Applications that have a reason to run with appropriate 17742 privilege should outline this reason clearly in their 17743 documentation. Users of the application should be informed, 17744 that "this application demands security privileges, which 17745 could interfere with system security". 17746 17747 The application should not contain binary-only software that 17748 requires being run with appropriate privilege, as this makes 17749 security auditing harder or even impossible. 17750 _________________________________________________________ 17751 17752 11.2.6. Changing permissions 17753 17754 The application shall not change permissions of files and 17755 directories that do not belong to its own package. Should an 17756 application require that certain files and directories not 17757 directly belonging to the package have a particular ownership, 17758 the application shall document this requirement, and may fail 17759 during installation if the permissions on these files is 17760 inappropriate. 17761 _________________________________________________________ 17762 17763 11.2.7. Removable Media (Cdrom, Floppy, etc.) 17764 17765 Applications that expect to be runnable from removable media 17766 should not depend on logging in as a privileged user, and 17767 should be prepared to deal with a restrictive environment. 17768 Examples of such restrictions could be default mount options 17769 that disable set-user/group-ID attributes, disabling block or 17770 character-special files on the medium, or remapping the user 17771 and group IDs of files away from any privileged value. 17772 17773 Rationale: System vendors and local system administrators 17774 want to run applications from removable media, but want the 17775 possibility to control what the application can do. 17776 _________________________________________________________ 17777 17778 11.2.8. Installable applications 17779 17780 Where the installation of an application needs additional 17781 privileges, it must clearly document all files and system 17782 databases that are modified outside of those in /opt/pkg-name 17783 and /var/opt/pkg-name, other than those that may be updated by 17784 system logging or auditing activities. 17785 17786 Without this, the local system administrator would have to 17787 blindly trust a piece of software, particularly with respect 17788 to its security. 17789 _________________________________________________________ 17790 17791 Chapter 12. Additional Behaviors 17792 17793 12.1. Mandatory Optional Behaviors 17794 17795 This section specifies behaviors in which there is optional 17796 behavior in one of the standards on which the LSB relies, and 17797 where the LSB requires a specific behavior. 17798 17799 Note: The LSB does not require the kernel to be Linux; the 17800 set of mandated options reflects current existing practice, 17801 but may be modified in future releases. 17802 17803 LSB conforming implementations shall support the following 17804 options defined within the ISO POSIX (2003): 17805 17806 _POSIX_FSYNC 17807 _POSIX_MAPPED_FILES 17808 _POSIX_MEMLOCK 17809 _POSIX_MEMLOCK_RANGE 17810 _POSIX_MEMORY_PROTECTION 17811 _POSIX_PRIORITY_SCHEDULING 17812 _POSIX_REALTIME_SIGNALS 17813 _POSIX_THREAD_ATTR_STACKADDR 17814 _POSIX_THREAD_ATTR_STACKSIZE 17815 _POSIX_THREAD_PROCESS_SHARED 17816 _POSIX_THREAD_SAFE_FUNCTIONS 17817 _POSIX_THREADS 17818 _XOPEN_UNIX 17819 17820 The opendir() function shall consume a file descriptor in the 17821 same fashion as open(), and therefore may fail with EMFILE or 17822 ENFILE. 17823 17824 The START and STOP termios characters shall be changeable, as 17825 described as optional behavior in the "General Terminal 17826 Interface" section of the ISO POSIX (2003). 17827 17828 The access() function function shall fail with errno set to 17829 EINVAL if the amode argument contains bits other than those 17830 set by the bitwise inclusive OR of R_OK, W_OK, X_OK and F_OK. 17831 17832 The link() function shall require access to the existing file 17833 in order to succeed, as described as optional behavior in the 17834 ISO POSIX (2003). 17835 17836 Calling unlink() on a directory shall fail. Calling link() 17837 specifying a directory as the first argument shall fail. See 17838 also unlink. 17839 17840 Note: Linux allows rename() on a directory without having 17841 write access, but the LSB does not require this. 17842 _________________________________________________________ 17843 17844 12.1.1. Special Requirements 17845 17846 LSB conforming systems shall enforce certain special 17847 additional restrictions above and beyond those required by ISO 17848 POSIX (2003). 17849 17850 Note: These additional restrictions are required in order 17851 to support the testing and certification programs 17852 associated with the LSB. In each case, these are values 17853 that defined macros must not have; conforming applications 17854 that use these values shall trigger a failure in the 17855 interface that is otherwise described as a "may fail". 17856 17857 The fcntl() function shall treat the "cmd" value -1 as 17858 invalid. 17859 17860 The whence value -1 shall be an invalid value for the lseek(), 17861 fseek() and fcntl() functions. 17862 17863 The value -5 shall be an invalid signal number. 17864 17865 If the sigaddset() or sigdelset() functions are passed an 17866 invalid signal number, they shall return with EINVAL. 17867 Implementations are only required to enforce this requirement 17868 for signal numbers which are specified to be invalid by this 17869 specification (such as the -5 mentioned above). 17870 17871 The mode value -1 to the access() function shall be treated as 17872 invalid. 17873 17874 A value of -1 shall be an invalid "_PC_..." value for 17875 pathconf(). 17876 17877 A value of -1 shall be an invalid "_SC..." value for 17878 sysconf(). 17879 17880 The nl_item value -1 shall be invalid for nl_langinfo(). 17881 17882 The value -1 shall be an invalid "_CS_..." value for 17883 confstr(). 17884 17885 The value "a" shall be an invalid mode argument to popen(). 17886 _________________________________________________________ 17887 17888 Chapter 13. Localization 17889 17890 In order to install a message catalog, the installation 17891 procedure shall supply the message catalog in a format 17892 readable by the msgfmt utility, which shall be invoked to 17893 compile the message catalog into an appropriate binary format 17894 on the target system. 17895 17896 Rationale: The original intent was to allow an application 17897 to contain the binary GNU MO format files. However, the 17898 format of these files is not officially stable, hence it is 17899 necessary to compile these catalogs on the target system. 17900 These binary catalogs may differ from architecture to 17901 architecture as well. 17902 17903 The resulting binary message catalog shall be located in the 17904 package's private area under /opt, and the application may use 17905 bindtextdomain() to specify this location. 17906 17907 Implementations shall support the POSIX and C locales as 17908 specified in the ISO POSIX (2003). 17909 _________________________________________________________ 17910 17911 13.1. Regular Expressions 17912 17913 Utilities that process regular expressions shall support Basic 17914 Regular Expressions and Extended Regular Expressions as 17915 specified in ISO POSIX (2003), with the following exceptions: 17916 17917 Range expression (such as [a-z]) can be based on code point 17918 order instead of collating element order. 17919 17920 Equivalence class expression (such as [=a=]) and 17921 multi-character collating element expression (such as [.ch.]) 17922 are optional. 17923 17924 Handling of a multi-character collating element is optional. 17925 17926 This affects at least the following utilities: grep (grep) 17927 (including egrep), sed (sed), and awk (awk). 17928 _________________________________________________________ 17929 17930 13.2. Pattern Matching Notation 17931 17932 Utilities that perform filename pattern matching (also known 17933 as Filename Globbing) shall do it as specified in ISO POSIX 17934 (2003), Pattern Matching Notation, with the following 17935 exceptions: 17936 17937 Pattern bracket expressions (such as [a-z]) can be based on 17938 code point order instead of collating element order. 17939 17940 Equivalence class expression (such as [=a=]) and 17941 multi-character collating element expression (such as [.ch.]) 17942 are optional. 17943 17944 Handling of a multi-character collating element is optional. 17945 17946 This affects at least the following utilities: cpio (cpio), 17947 find (find), ls (ls) and tar (tar). 17948 17949 VI. System Initialization 17950 17951 Table of Contents 17952 14. System Initialization 17953 _________________________________________________________ 17954 17955 Chapter 14. System Initialization 17956 17957 14.1. Cron Jobs 17958 17959 In addition to the individual user crontab files specified by 17960 ISO POSIX (2003) stored under /var/spool/cron, the process 17961 that executes scheduled commands shall also process the 17962 following additional crontab files: /etc/crontab, 17963 /etc/cron.d/* The installation of a package shall not modify 17964 the configuration file /etc/crontab. 17965 17966 If a package wishes to install a job that has to be executed 17967 periodically, it shall place a file in one of the following 17968 directories: 17969 17970 /etc/cron.daily 17971 /etc/cron.weekly 17972 /etc/cron.monthly 17973 17974 As these directory names suggest, the files within them are 17975 executed on a daily, weekly, or monthly basis, respectively, 17976 under the control of an entry in one of the system crontab 17977 files. See below for the rules concerning the names of files 17978 in these directories. 17979 17980 It is recommended that files installed in any of these 17981 directories be scripts (e.g. shell scripts, Perl scripts, 17982 etc.) so that they may be modified by the local system 17983 administrator. 17984 17985 The scripts in these directories should check if all necessary 17986 programs are installed before they try to execute them. 17987 Otherwise, problems will arise if a package is removed (but 17988 not purged), since the configuration files are kept on the 17989 system in this situation. 17990 17991 If a certain job has to be executed at a different frequency 17992 (e.g. more frequently than daily), the package shall install a 17993 file /etc/cron.d/cron-name tagged as a configuration file. 17994 This file uses the same syntax as /etc/crontab and is 17995 processed by the system automatically. 17996 17997 To avoid namespace conflicts in the /etc/cron.* directories, 17998 the filenames used by LSB-compliant packages in 17999 /etc/cron.daily, /etc/cron.weekly, /etc/cron.monthly, or 18000 /etc/cron.d shall come from a managed namespace. These 18001 filenames may be assigned using one of the following methods: 18002 18003 * Assigned namespace. This namespace consists of names which 18004 only use the character set [a-z0-9]. In order to avoid 18005 conflicts these cron script names shall be reserved 18006 through the Linux Assigned Names and Numbers Authority 18007 (LANANA). Information about the LANANA may be found at 18008 www.lanana.org. 18009 Commonly used names shall be reserved in advance; 18010 developers for projects should be encouraged reserve names 18011 from LANANA, so that each distribution can use the same 18012 name, and to avoid conflicts with other projects. 18013 * Hierarchical namespace. This namespace consists of script 18014 names of the form: [hier1]-[hier2]-...-[name], where name 18015 is again taken from the character set [a-z0-9], and where 18016 there may be one or more [hier-n] components. [hier1] may 18017 either be an LSB provider name assigned by the LANANA, or 18018 it may be owners' DNS name in lower case, with at least 18019 one '.'. e.g. "debian.org", "staroffice.sun.com", etc. The 18020 LSB provider name assigned by LANANA shall only consist of 18021 the ASCII characters [a-z0-9]. 18022 * Reserved namespace. This namespace consists of script 18023 names which begin with the character '_', and is reserved 18024 for distribution use only. This namespace should be used 18025 for core packages only. 18026 _________________________________________________________ 18027 18028 14.2. Init Script Actions 18029 18030 Init files provided by LSB applications shall accept one 18031 argument, saying what to do: 18032 18033 start start the service 18034 stop stop the service 18035 restart stop and restart the service if the service is already 18036 running, otherwise start the service 18037 try-restart restart the service if the service is already 18038 running 18039 reload cause the configuration of the service to be reloaded 18040 without actually stopping and restarting the service 18041 force-reload cause the configuration to be reloaded if the 18042 service supports this, otherwise restart the service if it is 18043 running 18044 status print the current status of the service 18045 18046 The start, stop, restart, force-reload, and status commands 18047 shall be supported by all init files; the reload and the 18048 try-restart options are optional. Other init script actions 18049 may be defined by the init script. 18050 18051 Init files shall ensure that they will behave sensibly if 18052 invoked with start when the service is already running, or 18053 with stop when it isn't, and that they don't kill 18054 unfortunately-named user processes. The best way to achieve 18055 this is to use the init-script functions provided by 18056 /lib/lsb/init-functions. 18057 18058 If a service reloads its configuration automatically (as in 18059 the case of cron, for example), the reload option of the init 18060 file shall behave as if the configuration has been reloaded 18061 successfully. The restart, try-restart, reload and 18062 force-reload action may be atomic; i.e. if a service is known 18063 not be operational after a restart or reload, the script may 18064 return an error without any further action. 18065 18066 These executable files shall not fail obscurely when the 18067 configuration files remain but the package has been removed, 18068 as the default in [the packaging system] is to leave 18069 configuration files on the system after the package has been 18070 removed. Only when it is executed with the [purge] option will 18071 [the packaging system] remove configuration files. Therefore, 18072 you should include a test statement at the top of the file, 18073 like this: 18074 test -f program-executed-later-in-file || exit 5 18075 18076 or take the equivalent action if the init file is not a shell 18077 script. 18078 18079 If the status command is given, the init script will return 18080 the following exit status codes. 18081 18082 0 program is running or service is OK 18083 1 program is dead and /var/run pid file exists 18084 2 program is dead and /var/lock lock file exists 18085 3 program is not running 18086 4 program or service status is unknown 18087 5-99 reserved for future LSB use 18088 100-149 reserved for distribution use 18089 150-199 reserved for application use 18090 200-254 reserved 18091 18092 In the case of init script commands other than "status" (i.e., 18093 "start", "stop", "restart", "try-restart", "reload", and 18094 "force-reload"), the init script shall return an exit status 18095 of zero if the action described by the argument has been 18096 successful. Otherwise, the exit status shall be non-zero, as 18097 defined below. In addition to straightforward success, the 18098 following situations are also to be considered successful: 18099 18100 * restarting a service (instead of reloading it) with the 18101 "force-reload" argument 18102 * running "start" on a service already running 18103 * running "stop" on a service already stopped or not running 18104 * running "restart" on a service already stopped or not 18105 running 18106 * running "try-restart" on a service already stopped or not 18107 running 18108 18109 In case of an error, while processing any init script action 18110 except for "status", the init script shall print an error 18111 message and return one of the following non-zero exit status 18112 codes. 18113 18114 1 generic or unspecified error (current practice) 18115 2 invalid or excess argument(s) 18116 3 unimplemented feature (for example, "reload") 18117 4 user had insufficient privilege 18118 5 program is not installed 18119 6 program is not configured 18120 7 program is not running 18121 8-99 reserved for future LSB use 18122 100-149 reserved for distribution use 18123 150-199 reserved for application use 18124 200-254 reserved 18125 18126 Error and status messages should be printed with the logging 18127 functions such as log_failure_msg and so on. Scripts may write 18128 to standard error or standard output, but implementations need 18129 not present text written to standard error/output to the user 18130 or do anything else with it. 18131 18132 Since init files may be run manually by a system administrator 18133 with non-standard environment variable values for PATH, USER, 18134 LOGNAME, etc. init files shall not depend on the values of 18135 these environment variables. They should set them to some 18136 known/default values if they are needed. 18137 _________________________________________________________ 18138 18139 14.3. Comment Conventions for Init Scripts 18140 18141 LSB applications which need to execute script(s) at bootup 18142 and/or shutdown may provide one or more init.d files. These 18143 files are installed by the install_initd program described 18144 below, which copies it into a standard directory and makes 18145 whatever other adjustments (creation of symlinks, creation of 18146 entries in a database, etc.) are necessary so that the script 18147 can be run at boot-time. 18148 18149 Note: This specification does not require, but is designed 18150 to allow, the development of a system which runs boot 18151 scripts in parallel. Hence, enforced-serialization of 18152 scripts is avoided unless it is explicitly necessary. 18153 18154 In the init.d file, information about the shell script shall 18155 be delimited by the lines "### BEGIN INIT INFO" and "### END 18156 INIT INFO". These delimiter lines may containg trailing 18157 whitespace, which shall be ignored. Inside this block there 18158 shall be lines of the form "# {keyword}: [arg1] [arg2] ...". 18159 (All lines inside this block start with a hash ('#') character 18160 in the first column, so that shell treats them as comments.) 18161 There shall be exactly one space character between "#" and the 18162 keyword. 18163 18164 Note: More than one space, or a tab character, indicates 18165 the continuation line. 18166 18167 The following keywords, with their arguments are defined in 18168 this specification: 18169 # Provides: boot_facility_1 [ boot_facility_2 ...] 18170 # Required-Start: boot_facility_1 [ boot_facility_2 ...] 18171 # Required-Stop: boot_facility_1 [ boot_facility_2 ...] 18172 # Should-Start: boot_facility_1 [ boot_facility_2 ...] 18173 # Should-Stop: boot_facility_1 [ boot_facility_2 ...] 18174 # Default-Start: run_level_1 [ run_level_2 ...] 18175 # Default-Stop: run_level_1 [ run_level_2 ...] 18176 # Short-Description: short_description 18177 # Description: multiline_description 18178 18179 Additional keywords may be defined in future LSB 18180 specifications. Distributions may define local extensions by 18181 using the prefix "X-[distribution name]" --- for example, 18182 "X-RedHat-foobardecl", or "X-Debian-xyzzydecl". 18183 18184 An init.d shell script may declare using the "Required-Start: 18185 " header that it shall not be run until certain boot 18186 facilities are provided. This information is used by the 18187 installation tool or the boot-time boot-script execution 18188 facility to assure that init scripts are run in the correct 18189 order. When an init script is run with a "start" argument, the 18190 boot facility or facilities specified in the "Provides" header 18191 shall be considered present, and hence init scripts which 18192 require those boot facilities would then be eligble to be run. 18193 When an init script is run with a "stop" argument, the boot 18194 facilities specified in the "Provides" header are considered 18195 no longer present. There are naming conventions for boot 18196 facilities and system facilities, as described in a following 18197 section. 18198 18199 Similarly, the "Required-Stop:" header defines which 18200 facilities shall still be available during the shutdown of 18201 that service. Hence, the init script system should avoid 18202 stopping shell scripts which provide those facilities until 18203 this shell script is stopped. 18204 18205 The "Should-Start:" header defines which facilities if present 18206 should be started before this service. This allows for weak 18207 dependencies which do not cause the service to fail if a 18208 facility is not available. But may cause reduced functionality 18209 of the service. Compliant applications should not rely on the 18210 existence of this feature. 18211 18212 The "Should-Stop:" header defines which facilities should be 18213 still available during the shutdown of that service. 18214 18215 The "Default-Start" and "Default-Stop" headers define which 18216 run levels should by default run the script with a start or 18217 stop argument, respectively, to start or stop the services 18218 controlled by the init script. 18219 18220 Note: For example, if you want a service to run in 18221 runlevels 3, 4, and 5 (only), specify "Default-Start: 3 4 18222 5" and "Default-Stop: 0 1 2 6". 18223 18224 The "Short-Description" and "Description" header fields are 18225 used to provide text which describes the actions of the init 18226 script. The "short_description" shall be a relatively short, 18227 pithy description of the init script, where as the 18228 "multiline_description" can be a much longer piece of text 18229 that may span mulitple lines. In a multiline description, each 18230 continuation line shall begin with a '#' followed by tab 18231 character or a '#' followed by at least two space characters. 18232 The multiline description is terminated by the first line that 18233 does not match this criteria. 18234 18235 The comment conventions described in this session are only 18236 required for use by LSB-compliant applications; system init 18237 scripts as provided by LSB-compliant run-time environments are 18238 not required to use the scheme outlined here. 18239 _________________________________________________________ 18240 18241 14.4. Installation and Removal of init.d Files 18242 18243 An init.d file is installed in /etc/init.d (which may be a 18244 symlink to another location). This can be done by the package 18245 installer. See Script Names>. During the package's postinstall 18246 script, the program "/usr/lib/lsb/install_initd" configures 18247 the distribution's boot script system to call the package's 18248 init.d file at the appropriate time. 18249 18250 Note: For example, install_initd might create symbolic 18251 links in /etc/rc2.d and other such directories which point 18252 to the files in /etc/init.d (or it might update a database, 18253 or some other mechanism). The init.d files themselves 18254 should already be in /etc/init.d before running 18255 install_initd. 18256 18257 The install_initd program takes a single argument, the 18258 pathname to the /etc/init.d file. For example: 18259 /usr/lib/lsb/install_initd /etc/init.d/example.com-coffeed 18260 18261 The install_initd program shall return an exit status of zero 18262 if the init.d file has been successfully installed or if the 18263 the init.d file was already installed. If the required boot 18264 facilities cannot be fulfilled an exit status of one shall be 18265 returned and the init.d file shall not be installed. 18266 18267 When a software package is removed, the package's preuninstall 18268 script shall call /usr/lib/lsb/remove_initd and pass the 18269 pathname to the /etc/init.d file. The package manager is still 18270 responsible for removing the /etc/init.d file; the 18271 remove_initd program is provided in case the distribution 18272 needs to clean up any other modifications in the 18273 distribution's boot script system that might have been made by 18274 the install_initd program. For example: 18275 /usr/lib/lsb/remove_initd /etc/init.d/example.com-coffeed 18276 18277 The remove_initd program shall return an exit status of zero 18278 if the init.d file has been successfully removed or if the the 18279 init.d file is not installed. If another init.d file which 18280 depends on a boot facility provided by this init.d file is 18281 installed, an exit status of one shall be returned and the 18282 init.d file shall remained installed. 18283 18284 There should be a tool available to the user (e.g., RedHat's 18285 chkconfig) which can be used by the system administrator to 18286 easily manipulate at which init levels a particular init.d 18287 script is started or stopped. This specification currently 18288 does not specify such an interface, however. 18289 _________________________________________________________ 18290 18291 14.5. Run Levels 18292 18293 The following run levels are specified for use by the 18294 "Default-Start:" and "Default-Stop:" specifiers as defined by 18295 the section Comment Conventions for Init Scripts>. Many LSB 18296 run-time environments commonly use these run level 18297 definitions, and in the absence of other considerations, 18298 providers of run-time environments are strongly encouraged to 18299 follow this convention to provide consistency for system 18300 administrators who need to work with multiple distributions. 18301 However, it is not required that LSB-compliant run-time 18302 environments use these run levels; the distribution-provided 18303 install_initd script may map the run levels specified below to 18304 whatever distribution-specified run levels are most 18305 appropriate. 18306 18307 0 halt 18308 1 single user mode 18309 2 multiuser with no network services exported 18310 3 normal/full multiuser 18311 4 reserved for local use, default is normal/full multiuser 18312 5 multiuser with xdm or equivalent 18313 6 reboot 18314 _________________________________________________________ 18315 18316 14.6. Facility Names 18317 18318 Boot facilities are used to indicate dependencies in init 18319 scripts, as defined in a previous section. Facility names that 18320 begin with a dollar sign ('$') are system facility names, 18321 defined by the LSB, and SHALL be provided by distributions. 18322 18323 Note: The dollar sign does not indicate variable expansion 18324 as in many Linux utilities. Starting a facility name with a 18325 dollar sign is merely a way of dividing the namespace 18326 between the system and applications. 18327 18328 LSB applications shall not provide facilities that begin with 18329 a dollar sign. This document defines the following facility 18330 names: 18331 18332 $local_fs all local filesystems are mounted 18333 $network low level networking (ethernet card; may imply PCMCIA 18334 running) 18335 $named daemons which may provide hostname resolution (if 18336 present) are running. For example, daemons to query DNS, NIS+, 18337 or LDAP. 18338 $portmap daemons providing SunRPC/ONCRPC portmapping service 18339 as defined in RFC 1833 (if present) are running 18340 $remote_fs all remote filesystems are mounted. In some LSB 18341 run-time environments, filesystems such as /usr may be remote. 18342 Many applications that require $local_fs will probably require 18343 also require $remote_fs. 18344 $syslog system logger is operational 18345 $time the system time has been set, for example by using a 18346 network-based time program such as ntp or rdate, or via the 18347 hardware Real Time Clock. 18348 18349 Other (non-system) facilities may be defined by other LSB 18350 applications. These facilities shall be named using the same 18351 conventions defined for naming init.d script names. Commonly, 18352 the facility provided by an LSB application init.d script will 18353 have the same name as the name assigned to the init.d script. 18354 _________________________________________________________ 18355 18356 14.7. Script Names 18357 18358 Since the init.d scripts shall live in a single directory, 18359 they shall come from a single namespace. Three means of 18360 assigning names from this namespace are available: 18361 18362 * Assigned namespace. This namespace consists of names which 18363 only use the character set [a-z0-9]. This space is 18364 desirable for scripts which system administrators may 18365 often wish to run manually: e.g., "/etc/init.d/named 18366 restart" In order to avoid conflicts these init.d names 18367 shall be reserved through the Linux Assigned Names and 18368 Numbers Authority (LANANA). Information about the LANANA 18369 may be found at www.lanana.org. 18370 Commonly used names shall be reserved in advance; 18371 developers for projects should be encouraged to reserve 18372 names from LANANA, so that each distribution can use the 18373 same name, and to avoid conflicts with other projects. 18374 * Hierarchical namespace. This namespace consists of scripts 18375 names which look like this: [hier1]-[hier2]-...-[name], 18376 where name is again taken the character set [a-z0-9], and 18377 where there may be one or more [hier-n] components. 18378 [hier1] may either be an LSB provider name assigned by the 18379 LANANA, or it may be owners' DNS name in lower case, with 18380 at least one '.' (e.g., "debian.org", 18381 "staroffice.sun.com"). The LSB provider name assigned by 18382 LANANA shall only consist of the ASCII characters 18383 [a-z0-9]. 18384 * Reserved namespace. This namespace consists of script 18385 names which begin with the character '_', and is reserved 18386 for distribution use only. This namespace should be used 18387 for core packages only, and in general use of this 18388 namespace is highly discouraged. 18389 18390 In general, if a package or some system function is likely to 18391 be used on multiple systems, the package developers or the 18392 distribution SHOULD get a registered name through LANANA, and 18393 distributions should strive to use the same name whenever 18394 possible. For applications which may not be "core" or may not 18395 be commonly installed, the hierarchical namespace may be more 18396 appropriate. An advantage to the hierarchical namespace is 18397 that there is no need to consult with the LANANA before 18398 obtaining an assigned name. 18399 18400 Short names are highly desirable, since many system 18401 administrators like to use them to manually start and stop 18402 services. Given this, they should be standardized on a 18403 per-package basis. This is the rationale behind having a 18404 LANANA organization to assign these names. The LANANA may be 18405 called upon to handle other namespace issues, such as 18406 package/prerequisites naming (which is essential to making 18407 prerequisites to work correctly). 18408 _________________________________________________________ 18409 18410 14.8. Init Script Functions 18411 18412 Each LSB-compliant init.d script shall source the file 18413 /lib/lsb/init-functions. This file shall cause the following 18414 shell script commands to be defined. This can be done either 18415 by adding a directory to the PATH variable which defines these 18416 commands, or by defining sh aliases. While the 18417 distribution-provided aliases may choose to use shell 18418 extensions (at the distribution's option), the LSB init.d 18419 files themselves should only depend in shell features as 18420 defined by the LSB. 18421 18422 The start_daemon, killproc and pidofproc functions shall use 18423 this algorithm for determining the status and the pid(s) of 18424 the specified program. They shall read the pidfile specified 18425 or otherwise /var/run/basename.pid and use the pid(s) herein 18426 when determining whether a program is running. The method used 18427 to determine the status is implementation defined, but should 18428 allow for non-binary programs. 18429 18430 Note: Commonly used methods check either for the existence 18431 of the /proc/pid directory or use /proc/pid/exe and 18432 /proc/pid/cmdline. Relying only on /proc/pid/exe is 18433 discouraged since this results in a not-running status for 18434 daemons that are written in a script language. 18435 18436 Compliant implementations may use other mechanisms besides 18437 those based on pidfiles, unless the -p pidfile option has been 18438 used. Compliant applications should not rely on such 18439 mechanisms and should always use a pidfile. When a program is 18440 stopped, it should delete its pidfile. Multiple pid(s) shall 18441 be separated by a single space in the pidfile and in the 18442 output of pidofproc. 18443 18444 start_daemon [-f] [-n nicelevel] [-p pidfile] pathname [args] 18445 This runs the specified program as a daemon. start_daemon 18446 shall check if the program is already running using the 18447 algorithm given above. If so, it shall not start another copy 18448 of the daemon unless the -f option is given. The -n option 18449 specifies a nice level. See nice(1). start_daemon should 18450 return the LSB defined exit status codes. It shall return 0 if 18451 the program has been successfully started or is running and 18452 not 0 otherwise. 18453 killproc [-p pidfile] pathname [signal] This stops the 18454 specified program. The program is found using the algorithm 18455 given above. If a signal is specified, using the -signal_name 18456 or -signal_number syntaxes as specified by the kill command, 18457 the program is sent that signal. Otherwise, a SIGTERM followed 18458 by a SIGKILL after some number of seconds shall be sent. If a 18459 program has been terminated, the pidfile should be removed if 18460 the terminated process has not already done so. Compliant 18461 applications may use the basename instead of the pathname. 18462 killproc should return the LSB defined exit status codes. If 18463 called without a signal, it shall return 0 if the program has 18464 been stopped or is not running and not 0 otherwise. If a 18465 signal is given, it shall return 0 only if the program is 18466 running. 18467 pidofproc [-p pidfile] pathname This function returns one or 18468 more pid(s) for a particular daemon using the algorithm given 18469 above. Only pids of running processes should be returned. 18470 Compliant applications may use the basename instead of the 18471 pathname. pidofproc should return the LSB defined exit status 18472 codes for "status". It shall return 0 if the program is 18473 running and not 0 otherwise. 18474 log_success_msg "message" This requests the distribution to 18475 print a success message. The message should be relatively 18476 short; no more than 60 characters is highly desirable. 18477 log_failure_msg "message" This requests the distribution to 18478 print a failure message. The message should be relatively 18479 short; no more than 60 characters is highly desirable. 18480 log_warning_msg "message" This requests the distribution to 18481 print a warning message. The message should be relatively 18482 short; no more than 60 characters is highly desirable. 18483 18484 VII. Users & Groups 18485 18486 Table of Contents 18487 15. Users & Groups 18488 _________________________________________________________ 18489 18490 Chapter 15. Users & Groups 18491 18492 15.1. User and Group Database 18493 18494 The format of the User and Group databases is not specified. 18495 Programs may only read these databases using the provided API. 18496 Changes to these databases should be made using the provided 18497 commands. 18498 _________________________________________________________ 18499 18500 15.2. User & Group Names 18501 18502 Below is a table of required mnemonic user and group names. 18503 This specification makes no attempt to numerically assign uid 18504 or gid numbers. The exception is the uid and gid for "root" 18505 which are equal to 0. 18506 18507 Table 15-1. Required User & Group Names 18508 User Group Comments 18509 root root Administrative user with all appropriate privileges 18510 bin bin Legacy UID/GID[a] 18511 daemon daemon Legacy UID/GID[b] 18512 Notes: 18513 a. The 'bin' UID/GID is included for compatibility with legacy 18514 applications. New applications should no longer use the 'bin' 18515 UID/GID. 18516 b. The 'daemon' UID/GID was used as an unprivileged UID/GID 18517 for daemons to execute under in order to limit their access to 18518 the system. Generally daemons should now run under individual 18519 UID/GIDs in order to further partition daemons from one 18520 another. 18521 18522 Below is a table of optional mnemonic user and group names. 18523 This specification makes no attempt to numerically assign uid 18524 or gid numbers. If the username exists on a system, then they 18525 should be in the suggested corresponding group. These user and 18526 group names are for use by distributions, not by applications. 18527 18528 Table 15-2. Optional User & Group Names 18529 User Group Comments 18530 adm adm Administrative special privileges 18531 lp lp Printer special privileges 18532 sync sync Login to sync the system 18533 shutdown shutdown Login to shutdown the system 18534 halt halt Login to halt the system 18535 mail mail Mail special privileges 18536 news news News special privileges 18537 uucp uucp UUCP special privileges 18538 operator root Operator special privileges 18539 man man Man special privileges 18540 nobody nobody Used by NFS 18541 18542 The differences in numeric values of the uids and gids between 18543 systems on a network can be reconciled via NIS, rdist(1), 18544 rsync(1), or ugidd(8). Only a minimum working set of "user 18545 names" and their corresponding "user groups" are required. 18546 Applications cannot assume non system user or group names will 18547 be defined. 18548 18549 Applications cannot assume any policy for the default umask or 18550 the default directory permissions a user may have. 18551 Applications should enforce user only file permissions on 18552 private files such as mailboxes. The location of the users 18553 home directory is also not defined by policy other than the 18554 recommendations of the FHS and shall be obtained by the 18555 *pwnam(3) calls. 18556 _________________________________________________________ 18557 18558 15.3. UID Ranges 18559 18560 The system UIDs from 0 to 99 should be statically allocated by 18561 the system, and shall not be created by applications. 18562 18563 The system UIDs from 100 to 499 should be reserved for dynamic 18564 allocation by system administrators and post install scripts 18565 using useradd(1). 18566 _________________________________________________________ 18567 18568 15.4. Rationale 18569 18570 The purpose of specifying optional users and groups is to 18571 reduce the potential for name conflicts between applications 18572 and distributions. 18573 _________________________________________________________ 18574 18575 Appendix A. GNU Free Documentation License 18576 18577 Version 1.1, March 2000 18578 18579 Copyright (C) 2000 Free Software Foundation, Inc. 59 Temple 18580 Place, Suite 330, Boston, MA 02111-1307 USA Everyone is 18581 permitted to copy and distribute verbatim copies of this 18582 license document, but changing it is not allowed. 18583 _________________________________________________________ 18584 18585 A.1. PREAMBLE 18586 18587 The purpose of this License is to make a manual, textbook, or 18588 other written document "free" in the sense of freedom: to 18589 assure everyone the effective freedom to copy and redistribute 18590 it, with or without modifying it, either commercially or 18591 noncommercially. Secondarily, this License preserves for the 18592 author and publisher a way to get credit for their work, while 18593 not being considered responsible for modifications made by 18594 others. 18595 18596 This License is a kind of "copyleft", which means that 18597 derivative works of the document must themselves be free in 18598 the same sense. It complements the GNU General Public License, 18599 which is a copyleft license designed for free software. 18600 18601 We have designed this License in order to use it for manuals 18602 for free software, because free software needs free 18603 documentation: a free program should come with manuals 18604 providing the same freedoms that the software does. But this 18605 License is not limited to software manuals; it can be used for 18606 any textual work, regardless of subject matter or whether it 18607 is published as a printed book. We recommend this License 18608 principally for works whose purpose is instruction or 18609 reference. 18610 _________________________________________________________ 18611 18612 A.2. APPLICABILITY AND DEFINITIONS 18613 18614 This License applies to any manual or other work that contains 18615 a notice placed by the copyright holder saying it can be 18616 distributed under the terms of this License. The "Document", 18617 below, refers to any such manual or work. Any member of the 18618 public is a licensee, and is addressed as "you". 18619 18620 A "Modified Version" of the Document means any work containing 18621 the Document or a portion of it, either copied verbatim, or 18622 with modifications and/or translated into another language. 18623 18624 A "Secondary Section" is a named appendix or a front-matter 18625 section of the Document that deals exclusively with the 18626 relationship of the publishers or authors of the Document to 18627 the Document's overall subject (or to related matters) and 18628 contains nothing that could fall directly within that overall 18629 subject. (For example, if the Document is in part a textbook 18630 of mathematics, a Secondary Section may not explain any 18631 mathematics.) The relationship could be a matter of historical 18632 connection with the subject or with related matters, or of 18633 legal, commercial, philosophical, ethical or political 18634 position regarding them. 18635 18636 The "Invariant Sections" are certain Secondary Sections whose 18637 titles are designated, as being those of Invariant Sections, 18638 in the notice that says that the Document is released under 18639 this License. 18640 18641 The "Cover Texts" are certain short passages of text that are 18642 listed, as Front-Cover Texts or Back-Cover Texts, in the 18643 notice that says that the Document is released under this 18644 License. 18645 18646 A "Transparent" copy of the Document means a machine-readable 18647 copy, represented in a format whose specification is available 18648 to the general public, whose contents can be viewed and edited 18649 directly and straightforwardly with generic text editors or 18650 (for images composed of pixels) generic paint programs or (for 18651 drawings) some widely available drawing editor, and that is 18652 suitable for input to text formatters or for automatic 18653 translation to a variety of formats suitable for input to text 18654 formatters. A copy made in an otherwise Transparent file 18655 format whose markup has been designed to thwart or discourage 18656 subsequent modification by readers is not Transparent. A copy 18657 that is not "Transparent" is called "Opaque". 18658 18659 Examples of suitable formats for Transparent copies include 18660 plain ASCII without markup, Texinfo input format, LaTeX input 18661 format, SGML or XML using a publicly available DTD, and 18662 standard-conforming simple HTML designed for human 18663 modification. Opaque formats include PostScript, PDF, 18664 proprietary formats that can be read and edited only by 18665 proprietary word processors, SGML or XML for which the DTD 18666 and/or processing tools are not generally available, and the 18667 machine-generated HTML produced by some word processors for 18668 output purposes only. 18669 18670 The "Title Page" means, for a printed book, the title page 18671 itself, plus such following pages as are needed to hold, 18672 legibly, the material this License requires to appear in the 18673 title page. For works in formats which do not have any title 18674 page as such, "Title Page" means the text near the most 18675 prominent appearance of the work's title, preceding the 18676 beginning of the body of the text. 18677 _________________________________________________________ 18678 18679 A.3. VERBATIM COPYING 18680 18681 You may copy and distribute the Document in any medium, either 18682 commercially or noncommercially, provided that this License, 18683 the copyright notices, and the license notice saying this 18684 License applies to the Document are reproduced in all copies, 18685 and that you add no other conditions whatsoever to those of 18686 this License. You may not use technical measures to obstruct 18687 or control the reading or further copying of the copies you 18688 make or distribute. However, you may accept compensation in 18689 exchange for copies. If you distribute a large enough number 18690 of copies you must also follow the conditions in section 3. 18691 18692 You may also lend copies, under the same conditions stated 18693 above, and you may publicly display copies. 18694 _________________________________________________________ 18695 18696 A.4. COPYING IN QUANTITY 18697 18698 If you publish printed copies of the Document numbering more 18699 than 100, and the Document's license notice requires Cover 18700 Texts, you must enclose the copies in covers that carry, 18701 clearly and legibly, all these Cover Texts: Front-Cover Texts 18702 on the front cover, and Back-Cover Texts on the back cover. 18703 Both covers must also clearly and legibly identify you as the 18704 publisher of these copies. The front cover must present the 18705 full title with all words of the title equally prominent and 18706 visible. You may add other material on the covers in addition. 18707 Copying with changes limited to the covers, as long as they 18708 preserve the title of the Document and satisfy these 18709 conditions, can be treated as verbatim copying in other 18710 respects. 18711 18712 If the required texts for either cover are too voluminous to 18713 fit legibly, you should put the first ones listed (as many as 18714 fit reasonably) on the actual cover, and continue the rest 18715 onto adjacent pages. 18716 18717 If you publish or distribute Opaque copies of the Document 18718 numbering more than 100, you must either include a 18719 machine-readable Transparent copy along with each Opaque copy, 18720 or state in or with each Opaque copy a publicly-accessible 18721 computer-network location containing a complete Transparent 18722 copy of the Document, free of added material, which the 18723 general network-using public has access to download 18724 anonymously at no charge using public-standard network 18725 protocols. If you use the latter option, you must take 18726 reasonably prudent steps, when you begin distribution of 18727 Opaque copies in quantity, to ensure that this Transparent 18728 copy will remain thus accessible at the stated location until 18729 at least one year after the last time you distribute an Opaque 18730 copy (directly or through your agents or retailers) of that 18731 edition to the public. 18732 18733 It is requested, but not required, that you contact the 18734 authors of the Document well before redistributing any large 18735 number of copies, to give them a chance to provide you with an 18736 updated version of the Document. 18737 _________________________________________________________ 18738 18739 A.5. MODIFICATIONS 18740 18741 You may copy and distribute a Modified Version of the Document 18742 under the conditions of sections 2 and 3 above, provided that 18743 you release the Modified Version under precisely this License, 18744 with the Modified Version filling the role of the Document, 18745 thus licensing distribution and modification of the Modified 18746 Version to whoever possesses a copy of it. In addition, you 18747 must do these things in the Modified Version: 18748 18749 A. Use in the Title Page (and on the covers, if any) a title 18750 distinct from that of the Document, and from those of 18751 previous versions (which should, if there were any, be 18752 listed in the History section of the Document). You may 18753 use the same title as a previous version if the original 18754 publisher of that version gives permission. 18755 B. List on the Title Page, as authors, one or more persons or 18756 entities responsible for authorship of the modifications 18757 in the Modified Version, together with at least five of 18758 the principal authors of the Document (all of its 18759 principal authors, if it has less than five). 18760 C. State on the Title page the name of the publisher of the 18761 Modified Version, as the publisher. 18762 D. Preserve all the copyright notices of the Document. 18763 E. Add an appropriate copyright notice for your modifications 18764 adjacent to the other copyright notices. 18765 F. Include, immediately after the copyright notices, a 18766 license notice giving the public permission to use the 18767 Modified Version under the terms of this License, in the 18768 form shown in the Addendum below. 18769 G. Preserve in that license notice the full lists of 18770 Invariant Sections and required Cover Texts given in the 18771 Document's license notice. 18772 H. Include an unaltered copy of this License. 18773 I. Preserve the section entitled "History", and its title, 18774 and add to it an item stating at least the title, year, 18775 new authors, and publisher of the Modified Version as 18776 given on the Title Page. If there is no section entitled 18777 "History" in the Document, create one stating the title, 18778 year, authors, and publisher of the Document as given on 18779 its Title Page, then add an item describing the Modified 18780 Version as stated in the previous sentence. 18781 J. Preserve the network location, if any, given in the 18782 Document for public access to a Transparent copy of the 18783 Document, and likewise the network locations given in the 18784 Document for previous versions it was based on. These may 18785 be placed in the "History" section. You may omit a network 18786 location for a work that was published at least four years 18787 before the Document itself, or if the original publisher 18788 of the version it refers to gives permission. 18789 K. In any section entitled "Acknowledgements" or 18790 "Dedications", preserve the section's title, and preserve 18791 in the section all the substance and tone of each of the 18792 contributor acknowledgements and/or dedications given 18793 therein. 18794 L. Preserve all the Invariant Sections of the Document, 18795 unaltered in their text and in their titles. Section 18796 numbers or the equivalent are not considered part of the 18797 section titles. 18798 M. Delete any section entitled "Endorsements". Such a section 18799 may not be included in the Modified Version. 18800 N. Do not retitle any existing section as "Endorsements" or 18801 to conflict in title with any Invariant Section. 18802 18803 If the Modified Version includes new front-matter sections or 18804 appendices that qualify as Secondary Sections and contain no 18805 material copied from the Document, you may at your option 18806 designate some or all of these sections as invariant. To do 18807 this, add their titles to the list of Invariant Sections in 18808 the Modified Version's license notice. These titles must be 18809 distinct from any other section titles. 18810 18811 You may add a section entitled "Endorsements", provided it 18812 contains nothing but endorsements of your Modified Version by 18813 various parties--for example, statements of peer review or 18814 that the text has been approved by an organization as the 18815 authoritative definition of a standard. 18816 18817 You may add a passage of up to five words as a Front-Cover 18818 Text, and a passage of up to 25 words as a Back-Cover Text, to 18819 the end of the list of Cover Texts in the Modified Version. 18820 Only one passage of Front-Cover Text and one of Back-Cover 18821 Text may be added by (or through arrangements made by) any one 18822 entity. If the Document already includes a cover text for the 18823 same cover, previously added by you or by arrangement made by 18824 the same entity you are acting on behalf of, you may not add 18825 another; but you may replace the old one, on explicit 18826 permission from the previous publisher that added the old one. 18827 18828 The author(s) and publisher(s) of the Document do not by this 18829 License give permission to use their names for publicity for 18830 or to assert or imply endorsement of any Modified Version. 18831 _________________________________________________________ 18832 18833 A.6. COMBINING DOCUMENTS 18834 18835 You may combine the Document with other documents released 18836 under this License, under the terms defined in section 4 above 18837 for modified versions, provided that you include in the 18838 combination all of the Invariant Sections of all of the 18839 original documents, unmodified, and list them all as Invariant 18840 Sections of your combined work in its license notice. 18841 18842 The combined work need only contain one copy of this License, 18843 and multiple identical Invariant Sections may be replaced with 18844 a single copy. If there are multiple Invariant Sections with 18845 the same name but different contents, make the title of each 18846 such section unique by adding at the end of it, in 18847 parentheses, the name of the original author or publisher of 18848 that section if known, or else a unique number. Make the same 18849 adjustment to the section titles in the list of Invariant 18850 Sections in the license notice of the combined work. 18851 18852 In the combination, you must combine any sections entitled 18853 "History" in the various original documents, forming one 18854 section entitled "History"; likewise combine any sections 18855 entitled "Acknowledgements", and any sections entitled 18856 "Dedications". You must delete all sections entitled 18857 "Endorsements." 18858 _________________________________________________________ 18859 18860 A.7. COLLECTIONS OF DOCUMENTS 18861 18862 You may make a collection consisting of the Document and other 18863 documents released under this License, and replace the 18864 individual copies of this License in the various documents 18865 with a single copy that is included in the collection, 18866 provided that you follow the rules of this License for 18867 verbatim copying of each of the documents in all other 18868 respects. 18869 18870 You may extract a single document from such a collection, and 18871 distribute it individually under this License, provided you 18872 insert a copy of this License into the extracted document, and 18873 follow this License in all other respects regarding verbatim 18874 copying of that document. 18875 _________________________________________________________ 18876 18877 A.8. AGGREGATION WITH INDEPENDENT WORKS 18878 18879 A compilation of the Document or its derivatives with other 18880 separate and independent documents or works, in or on a volume 18881 of a storage or distribution medium, does not as a whole count 18882 as a Modified Version of the Document, provided no compilation 18883 copyright is claimed for the compilation. Such a compilation 18884 is called an "aggregate", and this License does not apply to 18885 the other self-contained works thus compiled with the 18886 Document, on account of their being thus compiled, if they are 18887 not themselves derivative works of the Document. 18888 18889 If the Cover Text requirement of section 3 is applicable to 18890 these copies of the Document, then if the Document is less 18891 than one quarter of the entire aggregate, the Document's Cover 18892 Texts may be placed on covers that surround only the Document 18893 within the aggregate. Otherwise they must appear on covers 18894 around the whole aggregate. 18895 _________________________________________________________ 18896 18897 A.9. TRANSLATION 18898 18899 Translation is considered a kind of modification, so you may 18900 distribute translations of the Document under the terms of 18901 section 4. Replacing Invariant Sections with translations 18902 requires special permission from their copyright holders, but 18903 you may include translations of some or all Invariant Sections 18904 in addition to the original versions of these Invariant 18905 Sections. You may include a translation of this License 18906 provided that you also include the original English version of 18907 this License. In case of a disagreement between the 18908 translation and the original English version of this License, 18909 the original English version will prevail. 18910 _________________________________________________________ 18911 18912 A.10. TERMINATION 18913 18914 You may not copy, modify, sublicense, or distribute the 18915 Document except as expressly provided for under this License. 18916 Any other attempt to copy, modify, sublicense or distribute 18917 the Document is void, and will automatically terminate your 18918 rights under this License. However, parties who have received 18919 copies, or rights, from you under this License will not have 18920 their licenses terminated so long as such parties remain in 18921 full compliance. 18922 _________________________________________________________ 18923 18924 A.11. FUTURE REVISIONS OF THIS LICENSE 18925 18926 The Free Software Foundation may publish new, revised versions 18927 of the GNU Free Documentation License from time to time. Such 18928 new versions will be similar in spirit to the present version, 18929 but may differ in detail to address new problems or concerns. 18930 See http://www.gnu.org/copyleft/. 18931 18932 Each version of the License is given a distinguishing version 18933 number. If the Document specifies that a particular numbered 18934 version of this License "or any later version" applies to it, 18935 you have the option of following the terms and conditions 18936 either of that specified version or of any later version that 18937 has been published (not as a draft) by the Free Software 18938 Foundation. If the Document does not specify a version number 18939 of this License, you may choose any version ever published 18940 (not as a draft) by the Free Software Foundation. 18941 _________________________________________________________ 18942 18943 A.12. How to use this License for your documents 18944 18945 To use this License in a document you have written, include a 18946 copy of the License in the document and put the following 18947 copyright and license notices just after the title page: 18948 18949 Copyright (c) YEAR YOUR NAME. Permission is granted to 18950 copy, distribute and/or modify this document under the 18951 terms of the GNU Free Documentation License, Version 1.1 or 18952 any later version published by the Free Software 18953 Foundation; with the Invariant Sections being LIST THEIR 18954 TITLES, with the Front-Cover Texts being LIST, and with the 18955 Back-Cover Texts being LIST. A copy of the license is 18956 included in the section entitled "GNU Free Documentation 18957 License". 18958 18959 If you have no Invariant Sections, write "with no Invariant 18960 Sections" instead of saying which ones are invariant. If you 18961 have no Front-Cover Texts, write "no Front-Cover Texts" 18962 instead of "Front-Cover Texts being LIST"; likewise for 18963 Back-Cover Texts. 18964 18965 If your document contains nontrivial examples of program code, 18966 we recommend releasing these examples in parallel under your 18967 choice of free software license, such as the GNU General 18968 Public License, to permit their use in free software. 18969 18970 Notes 18971 18972 [1] 18973 18974 Future versions of this specification might define additional 18975 service names.