1 2 Linux Standard Base Core Specification 3.0Preview1 3 4 Copyright © 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 Table of Contents 43 Specification Introduction 44 ELF Specification 45 Linux Standard Base Specification 46 Linux Packaging Specification 47 Free Documentation License 48 49 Specification Introduction 50 _________________________________________________________ 51 52 Table of Contents 53 Foreword 54 Introduction 55 I. Introductory Elements 56 57 1. Scope 58 59 1.1. General 60 1.2. Module Specific Scope 61 62 2. Normative References 63 3. Requirements 64 65 3.1. Relevant Libraries 66 3.2. LSB Implementation Conformance 67 3.3. LSB Application Conformance 68 69 4. Definitions 70 5. Terminology 71 6. Documentation Conventions 72 7. Relationship To ISO/IEC 9945 POSIX 73 74 List of Tables 75 2-1. Normative References 76 3-1. Standard Library Names 77 3-2. Standard Library Names defined in the Architecture 78 Specific Supplement 79 _________________________________________________________ 80 81 Foreword 82 83 This is version 3.0Preview1 of the Linux Standard Base Core 84 Specification. An implementation of this version of the 85 specification may not claim to be an implementation of the 86 Linux Standard Base unless it has successfully completed the 87 compliance process as defined by the Free Standards Group. 88 _________________________________________________________ 89 90 Introduction 91 92 The LSB defines a binary interface for application programs 93 that are compiled and packaged for LSB-conforming 94 implementations on many different hardware architectures. 95 Since a binary specification shall include information 96 specific to the computer processor architecture for which it 97 is intended, it is not possible for a single document to 98 specify the interface for all possible LSB-conforming 99 implementations. Therefore, the LSB is a family of 100 specifications, rather than a single one. 101 102 This document should be used in conjunction with the documents 103 it references. This document enumerates the system components 104 it includes, but descriptions of those components may be 105 included entirely or partly in this document, partly in other 106 documents, or entirely in other reference documents. For 107 example, the section that describes system service routines 108 includes a list of the system routines supported in this 109 interface, formal declarations of the data structures they use 110 that are visible to applications, and a pointer to the 111 underlying referenced specification for information about the 112 syntax and semantics of each call. Only those routines not 113 described in standards referenced by this document, or 114 extensions to those standards, are described in the detail. 115 Information referenced in this way is as much a part of this 116 document as is the information explicitly included here. 117 118 The specification carries a version number of either the form 119 x.y or x.y.z. This version number carries the following 120 meaning: 121 122 * The first number (x) is the major version number. All 123 versions with the same major version number should share 124 binary compatibility. Any addition or deletion of a new 125 library results in a new version number. Interfaces marked 126 as deprecated may be removed from the specification at a 127 major version change. 128 * The second number (y) is the minor version number. 129 Individual interfaces may be added if all certified 130 implementations already had that (previously undocumented) 131 interface. Interfaces may be marked as deprecated at a 132 minor version change. Other minor changes may be permitted 133 at the discretion of the LSB workgroup. 134 * The third number (z), if present, is the editorial level. 135 Only editorial changes should be included in such 136 versions. 137 138 I. Introductory Elements 139 140 Table of Contents 141 1. Scope 142 2. Normative References 143 3. Requirements 144 4. Definitions 145 5. Terminology 146 6. Documentation Conventions 147 7. Relationship To ISO/IEC 9945 POSIX 148 _________________________________________________________ 149 150 Chapter 1. Scope 151 152 1.1. General 153 154 The Linux Standard Base (LSB) defines a system interface for 155 compiled applications and a minimal environment for support of 156 installation scripts. Its purpose is to enable a uniform 157 industry standard environment for high-volume applications 158 conforming to the LSB. 159 160 These specifications are composed of two basic parts: A common 161 specification ("LSB-generic") describing those parts of the 162 interface that remain constant across all implementations of 163 the LSB, and an architecture-specific specification 164 ("LSB-arch") describing the parts of the interface that vary 165 by processor architecture. Together, the LSB-generic and the 166 architecture-specific supplement for a single hardware 167 architecture provide a complete interface specification for 168 compiled application programs on systems that share a common 169 hardware architecture. 170 171 The LSB-generic document shall be used in conjunction with an 172 architecture-specific supplement. Whenever a section of the 173 LSB-generic specification shall be supplemented by 174 architecture-specific information, the LSB-generic document 175 includes a reference to the architecture supplement. 176 Architecture supplements may also contain additional 177 information that is not referenced in the LSB-generic 178 document. 179 180 The LSB contains both a set of Application Program Interfaces 181 (APIs) and Application Binary Interfaces (ABIs). APIs may 182 appear in the source code of portable applications, while the 183 compiled binary of that application may use the larger set of 184 ABIs. A conforming implementation shall provide all of the 185 ABIs listed here. The compilation system may replace (e.g. by 186 macro definition) certain APIs with calls to one or more of 187 the underlying binary interfaces, and may insert calls to 188 binary interfaces as needed. 189 190 The LSB is primarily a binary interface definition. Not all of 191 the source level APIs available to applications may be 192 contained in this specification. 193 _________________________________________________________ 194 195 1.2. Module Specific Scope 196 197 This is the Core module of the Linux Standards Base (LSB). 198 This module provides the fundamental system interfaces, 199 libraries, and runtime environment upon which all conforming 200 applications and libraries depend. 201 202 Interfaces described in this module are mandatory except where 203 explicitly listed otherwise. Core interfaces may be 204 supplemented by other modules; all modules are built upon the 205 core. 206 _________________________________________________________ 207 208 Chapter 2. Normative References 209 210 The specifications listed below are referenced in whole or in 211 part by the Linux Standard Base. In this specification, where 212 only a particular section of one of these references is 213 identified, then the normative reference is to that section 214 alone, and the rest of the referenced document is informative. 215 216 Table 2-1. Normative References 217 Name Title URL 218 DWARF Debugging Information Format DWARF Debugging Information 219 Format, Revision 2.0.0 (July 27, 1993) 220 http://www.eagercon.com/dwarf/dwarf-2.0.0.pdf 221 Filesystem Hierarchy Standard Filesystem Hierarchy Standard 222 (FHS) 2.3 http://www.pathname.com/fhs/ 223 Gdk 2.6.2 Reference Manual Gdk 2.6.2 Reference Manual 224 http://www.gtk.org/api/2.6/gdk/index.html 225 Gdk-pixbuf 2.6.2 Reference Manual Gdk-pixbuf 2.6.2 Reference 226 Manual http://www.gtk.org/api/2.6/gdk-pixbuf/index.html 227 Glib 2.6.2 Reference Manual Glib 2.6.2 Reference Manual 228 http://www.gtk.org/api/2.6/glib/index.html 229 Gobject 2.6.2 Reference Manual Gobject 2.6.2 Reference Manual 230 http://www.gtk.org/api/2.6/gobject/index.html 231 Gtk 2.6.2 Reference Manual Gtk 2.6.2 Reference Manual 232 http://www.gtk.org/api/2.6/gtk/index.html 233 IEEE Std 754-1985 IEEE Standard 754 for Binary Floating-Point 234 Arithmetic http://www.ieee.org/ 235 ISO C (1999) ISO/IEC 9899: 1999, Programming Languages --C 236 ISO POSIX (2003) 237 238 ISO/IEC 9945-1:2003 Information technology -- Portable 239 Operating System Interface (POSIX) -- Part 1: Base Definitions 240 241 ISO/IEC 9945-2:2003 Information technology -- Portable 242 Operating System Interface (POSIX) -- Part 2: System 243 Interfaces 244 245 ISO/IEC 9945-3:2003 Information technology -- Portable 246 Operating System Interface (POSIX) -- Part 3: Shell and 247 Utilities 248 249 ISO/IEC 9945-4:2003 Information technology -- Portable 250 Operating System Interface (POSIX) -- Part 4: Rationale 251 252 Including Technical Cor. 1: 2004 253 http://www.unix.org/version3/ 254 ISO/IEC TR14652 ISO/IEC Technical Report 14652:2002 255 Specification method for cultural conventions 256 ITU-T V.42 International Telecommunication Union 257 Recommendation V.42 (2002): Error-correcting procedures for 258 DCEs using asynchronous-to-synchronous conversionITUV 259 http://www.itu.int/rec/recommendation.asp?type=folders&lang=e& 260 parent=T-REC-V.42 261 Large File Support Large File Support 262 http://www.UNIX-systems.org/version2/whatsnew/lfs20mar.html 263 Li18nux Globalization Specification LI18NUX 2000 Globalization 264 Specification, Version 1.0 with Amendment 4 265 http://www.li18nux.org/docs/html/LI18NUX-2000-amd4.htm 266 Linux Allocated Device Registry LINUX ALLOCATED DEVICES 267 http://www.lanana.org/docs/device-list/devices.txt 268 PAM Open Software Foundation, Request For Comments: 86.0 , 269 October 1995, V. Samar & R.Schemers (SunSoft) 270 http://www.opengroup.org/tech/rfc/mirror-rfc/rfc86.0.txt 271 RFC 1321: The MD5 Message-Digest Algorithm IETF RFC 1321: The 272 MD5 Message-Digest Algorithm 273 http://www.ietf.org/rfc/rfc1321.txt 274 RFC 1833: Binding Protocols for ONC RPC Version 2 IETF RFC 275 1833: Binding Protocols for ONC RPC Version 2 276 http://www.ietf.org/rfc/rfc1833.txt 277 RFC 1950: ZLIB Compressed Data Format Specication IETF RFC 278 1950: ZLIB Compressed Data Format Specification 279 http://www.ietf.org/rfc/rfc1950.txt 280 RFC 1951: DEFLATE Compressed Data Format Specification IETF 281 RFC 1951: DEFLATE Compressed Data Format Specification version 282 1.3 http://www.ietf.org/rfc/rfc1951.txt 283 RFC 1952: GZIP File Format Specification IETF RFC 1952: GZIP 284 file format specification version 4.3 285 http://www.ietf.org/rfc/rfc1952.txt 286 RFC 2440: OpenPGP Message Format IETF RFC 2440: OpenPGP 287 Message Format http://www.ietf.org/rfc/rfc2440.txt 288 RFC 2821:Simple Mail Transfer Protocol IETF RFC 2821: Simple 289 Mail Transfer Protocol http://www.ietf.org/rfc/rfc2821.txt 290 RFC 2822:Internet Message Format IETF RFC 2822: Internet 291 Message Format http://www.ietf.org/rfc/rfc2822.txt 292 RFC 791:Internet Protocol IETF RFC 791: Internet Protocol 293 Specification http://www.ietf.org/rfc/rfc791.txt 294 SUSv2 CAE Specification, January 1997, System Interfaces and 295 Headers (XSH),Issue 5 (ISBN: 1-85912-181-0, C606) 296 http://www.opengroup.org/publications/catalog/un.htm 297 SUSv2 Commands and Utilities The Single UNIX® 298 Specification(SUS) Version 2, Commands and Utilities (XCU), 299 Issue 5 (ISBN: 1-85912-191-8, C604) 300 http://www.opengroup.org/publications/catalog/un.htm 301 SVID Issue 3 American Telephone and Telegraph Company, System 302 V Interface Definition, Issue 3 ; Morristown, NJ, UNIX Press, 303 1989.(ISBN 0201566524) 304 SVID Issue 4 System V Interface Definition,Fourth Edition 305 System V ABI System V Application Binary Interface, Edition 306 4.1 http://www.caldera.com/developers/devspecs/gabi41.pdf 307 System V ABI Update System V Application Binary Interface - 308 DRAFT - 17 December 2003 309 http://www.caldera.com/developers/gabi/2003-12-17/contents.htm 310 l 311 this specification Linux Standard Base 312 http://www.linuxbase.org/spec/ 313 X/Open Curses CAE Specification, May 1996, X/Open Curses, 314 Issue 4, Version 2 (ISBN: 1-85912-171-3, C610), plus 315 Corrigendum U018 316 http://www.opengroup.org/publications/catalog/un.htm 317 _________________________________________________________ 318 319 Chapter 3. Requirements 320 321 3.1. Relevant Libraries 322 323 The libraries listed in Table 3-1 shall be available on a 324 Linux Standard Base system, with the specified runtime names. 325 The libraries listed in Table 3-2 are architecture specific, 326 but shall be available on all LSB conforming systems. This 327 list may be supplemented or amended by the 328 architecture-specific specification. 329 330 Table 3-1. Standard Library Names 331 Library Runtime Name 332 libdl libdl.so.2 333 libcrypt libcrypt.so.1 334 libz libz.so.1 335 libncurses libncurses.so.5 336 libutil libutil.so.1 337 libpthread libpthread.so.0 338 libpam libpam.so.0 339 libgcc_s libgcc_s.so.1 340 341 Table 3-2. Standard Library Names defined in the Architecture 342 Specific Supplement 343 Library Runtime Name 344 libm See archLSB 345 libc See archLSB 346 proginterp See archLSB 347 348 These libraries will be in an implementation-defined directory 349 which the dynamic linker shall search by default. 350 _________________________________________________________ 351 352 3.2. LSB Implementation Conformance 353 354 A conforming implementation shall satisfy the following 355 requirements: 356 357 * The implementation shall implement fully the architecture 358 described in the hardware manual for the target processor 359 architecture. 360 * The implementation shall be capable of executing compiled 361 applications having the format and using the system 362 interfaces described in this document. 363 * The implementation shall provide libraries containing the 364 interfaces specified by this document, and shall provide a 365 dynamic linking mechanism that allows these interfaces to 366 be attached to applications at runtime. All the interfaces 367 shall behave as specified in this document. 368 * The map of virtual memory provided by the implementation 369 shall conform to the requirements of this document. 370 * The implementation's low-level behavior with respect to 371 function call linkage, system traps, signals, and other 372 such activities shall conform to the formats described in 373 this document. 374 * The implementation shall provide all of the mandatory 375 interfaces in their entirety. 376 * The implementation may provide one or more of the optional 377 interfaces. Each optional interface that is provided shall 378 be provided in its entirety. The product documentation 379 shall state which optional interfaces are provided. 380 * The implementation shall provide all files and utilities 381 specified as part of this document in the format defined 382 here and in other referenced documents. All commands and 383 utilities shall behave as required by this document. The 384 implementation shall also provide all mandatory components 385 of an application's runtime environment that are included 386 or referenced in this document. 387 * The implementation, when provided with standard data 388 formats and values at a named interface, shall provide the 389 behavior defined for those values and data formats at that 390 interface. However, a conforming implementation may 391 consist of components which are separately packaged and/or 392 sold. For example, a vendor of a conforming implementation 393 might sell the hardware, operating system, and windowing 394 system as separately packaged items. 395 * The implementation may provide additional interfaces with 396 different names. It may also provide additional behavior 397 corresponding to data values outside the standard ranges, 398 for standard named interfaces. 399 _________________________________________________________ 400 401 3.3. LSB Application Conformance 402 403 A conforming application shall satisfy the following 404 requirements: 405 406 * Its executable files are either shell scripts or object 407 files in the format defined for the Object File Format 408 system interface. 409 * Its object files participate in dynamic linking as defined 410 in the Program Loading and Linking System interface. 411 * It employs only the instructions, traps, and other 412 low-level facilities defined in the Low-Level System 413 interface as being for use by applications. 414 * If it requires any optional interface defined in this 415 document in order to be installed or to execute 416 successfully, the requirement for that optional interface 417 is stated in the application's documentation. 418 * It does not use any interface or data format that is not 419 required to be provided by a conforming implementation, 420 unless: 421 + If such an interface or data format is supplied by 422 another application through direct invocation of that 423 application during execution, that application is in 424 turn an LSB conforming application. 425 + The use of that interface or data format, as well as 426 its source, is identified in the documentation of the 427 application. 428 * It shall not use any values for a named interface that are 429 reserved for vendor extensions. 430 431 A strictly conforming application does not require or use any 432 interface, facility, or implementation-defined extension that 433 is not defined in this document in order to be installed or to 434 execute successfully. 435 _________________________________________________________ 436 437 Chapter 4. Definitions 438 439 For the purposes of this document, the following definitions, 440 as specified in the ISO/IEC Directives, Part 2, 2001, 4th 441 Edition, apply: 442 443 can 444 be able to; there is a possibility of; it is possible 445 to 446 447 cannot 448 be unable to; there is no possibilty of; it is not 449 possible to 450 451 may 452 is permitted; is allowed; is permissible 453 454 need not 455 it is not required that; no...is required 456 457 shall 458 is to; is required to; it is required that; has to; 459 only...is permitted; it is necessary 460 461 shall not 462 is not allowed [permitted] [acceptable] [permissible]; 463 is required to be not; is required that...be not; is 464 not to be 465 466 should 467 it is recommended that; ought to 468 469 should not 470 it is not recommended that; ought not to 471 _________________________________________________________ 472 473 Chapter 5. Terminology 474 475 For the purposes of this document, the following terms apply: 476 477 archLSB 478 The architectural part of the LSB Specification which 479 describes the specific parts of the interface that are 480 platform specific. The archLSB is complementary to the 481 gLSB. 482 483 Binary Standard 484 The total set of interfaces that are available to be 485 used in the compiled binary code of a conforming 486 application. 487 488 gLSB 489 The common part of the LSB Specification that describes 490 those parts of the interface that remain constant 491 across all hardware implementations of the LSB. 492 493 implementation-defined 494 Describes a value or behavior that is not defined by 495 this document but is selected by an implementor. The 496 value or behavior may vary among implementations that 497 conform to this document. An application should not 498 rely on the existence of the value or behavior. An 499 application that relies on such a value or behavior 500 cannot be assured to be portable across conforming 501 implementations. The implementor shall document such a 502 value or behavior so that it can be used correctly by 503 an application. 504 505 Shell Script 506 A file that is read by an interpreter (e.g., awk). The 507 first line of the shell script includes a reference to 508 its interpreter binary. 509 510 Source Standard 511 The set of interfaces that are available to be used in 512 the source code of a conforming application. 513 514 undefined 515 Describes the nature of a value or behavior not defined 516 by this document which results from use of an invalid 517 program construct or invalid data input. The value or 518 behavior may vary among implementations that conform to 519 this document. An application should not rely on the 520 existence or validity of the value or behavior. An 521 application that relies on any particular value or 522 behavior cannot be assured to be portable across 523 conforming implementations. 524 525 unspecified 526 Describes the nature of a value or behavior not 527 specified by this document which results from use of a 528 valid program construct or valid data input. The value 529 or behavior may vary among implementations that conform 530 to this document. An application should not rely on the 531 existence or validity of the value or behavior. An 532 application that relies on any particular value or 533 behavior cannot be assured to be portable across 534 conforming implementations. 535 536 Other terms and definitions used in this document shall have 537 the same meaning as defined in Chapter 3 of the Base 538 Definitions volume of ISO POSIX (2003). 539 _________________________________________________________ 540 541 Chapter 6. Documentation Conventions 542 543 Throughout this document, the following typographic 544 conventions are used: 545 546 function() 547 the name of a function 548 549 command 550 the name of a command or utility 551 552 CONSTANT 553 a constant value 554 555 parameter 556 a parameter 557 558 variable 559 a variable 560 561 Throughout this specification, several tables of interfaces 562 are presented. Each entry in these tables has the following 563 format: 564 565 name 566 the name of the interface 567 568 (symver) 569 An optional symbol version identifier, if required. 570 571 [refno] 572 A reference number indexing the table of referenced 573 specifications that follows this table. 574 575 For example, 576 577 forkpty(GLIBC_2.0) [1] 578 579 refers to the interface named forkpty() with symbol version 580 GLIBC_2.0 that is defined in the first of the listed 581 references below the table. 582 _________________________________________________________ 583 584 Chapter 7. Relationship To ISO/IEC 9945 POSIX 585 586 This specification includes many interfaces described in ISO 587 POSIX (2003). Unless otherwise specified, such interfaces 588 should behave exactly as described in that specification. Any 589 conflict between the requirements described here and the ISO 590 POSIX (2003) standard is unintentional, except as explicitly 591 noted otherwise. 592 593 Note: In addition to the differences noted inline in this 594 specification, PDTR 24715 has extracted the differences 595 between this specification and ISO POSIX (2003) into a 596 single place. It is the long term plan of the LSB to 597 converge with ISO/IEC 9945 POSIX. 598 599 The LSB Specification Authority is responsible for deciding 600 the meaning of conformance to normative referenced standards 601 in the LSB context. Problem Reports regarding underlying or 602 referenced standards in any other context will be referred to 603 the relevant maintenance body for that standard. 604 605 ELF Specification 606 _________________________________________________________ 607 608 Table of Contents 609 I. Low Level System Information 610 611 1. Operating System Interface 612 2. Machine Interface 613 614 2.1. Data Representation 615 616 II. Object Format 617 618 3. Object Files 619 4. Sections 620 621 4.1. Introduction 622 4.2. Sections Types 623 624 5. Special Sections 625 626 5.1. Special Sections 627 628 6. Symbol Mapping 629 630 6.1. Introduction 631 6.2. Symbol Mapping 632 633 7. DWARF Extensions 634 8. EH Frame 635 9. EH Frame Header 636 637 9.1. Introduction 638 9.2. DWARF Exception Header Encoding 639 640 10. Symbol Versioning 641 642 10.1. Introduction 643 10.2. Symbol Version Table 644 10.3. Version Definitions 645 10.4. Version Requirements 646 10.5. Startup Sequence 647 10.6. Symbol Resolution 648 649 11. ABI note tag 650 651 III. Dynamic Linking 652 653 12. Program Loading and Dynamic Linking 654 13. Program Header 655 14. Dynamic Entries 656 657 14.1. Introduction 658 14.2. Dynamic Entries 659 660 List of Figures 661 10-1. Version Definition Entries 662 10-2. Version Definition Auxiliary Entries 663 10-3. Version Needed Entries 664 10-4. Version Needed Auxiliary Entries 665 14-1. Dynamic Structure 666 667 List of Tables 668 2-1. Scalar Types 669 4-1. ELF Section Types 670 4-2. Additional Section Types 671 5-1. ELF Special Sections 672 5-2. Additional Special Sections 673 7-1. Additional DWARF Call Frame Instructions 674 9-1. .eh_frame_hdr Section Format 675 9-2. DWARF Exception Header value format 676 9-3. DWARF Exception Header application 677 13-1. Linux Segment Types 678 679 I. Low Level System Information 680 681 Table of Contents 682 1. Operating System Interface 683 2. Machine Interface 684 _________________________________________________________ 685 686 Chapter 1. Operating System Interface 687 688 LSB-conforming applications shall assume that stack, heap and 689 other allocated memory regions will be non-executable. The 690 application must take steps to make them executable if needed. 691 _________________________________________________________ 692 693 Chapter 2. Machine Interface 694 695 2.1. Data Representation 696 697 LSB-conforming applications shall use the data representation 698 as defined in the Arcitecture specific ELF documents. 699 _________________________________________________________ 700 701 2.1.1. Fundamental Types 702 703 In addition to the fundamental types specified in the 704 Architecture specific ELF documents, a 1 byte data type is 705 defined here. 706 707 Table 2-1. Scalar Types 708 Type C C++ sizeof Alignment (bytes) Architecture 709 Representation 710 Integral _Bool bool 1 1 byte 711 712 II. Object Format 713 714 Table of Contents 715 3. Object Files 716 4. Sections 717 5. Special Sections 718 6. Symbol Mapping 719 7. DWARF Extensions 720 8. EH Frame 721 9. EH Frame Header 722 10. Symbol Versioning 723 11. ABI note tag 724 _________________________________________________________ 725 726 Chapter 3. Object Files 727 728 LSB-conforming implementations shall support the object file 729 Executable and Linking Format (ELF), which is defined by the 730 following documents: 731 732 * System V ABI 733 * System V ABI Update 734 * this document 735 * an architecture-specific LSB specification 736 737 Conforming implementations may also support other unspecified 738 object file formats. 739 _________________________________________________________ 740 741 Chapter 4. Sections 742 743 4.1. Introduction 744 745 As described in System V ABI, an ELF object file contains a 746 number of sections. 747 _________________________________________________________ 748 749 4.2. Sections Types 750 751 The section header table is an array of Elf32_Shdr or 752 Elf64_Shdr structures as described in System V ABI. The 753 sh_type member shall be either a value from Table 4-1, drawn 754 from the System V ABI, or one of the additional values 755 specified in Table 4-2. 756 757 A section header's sh_type member specifies the sections's 758 semantics. 759 _________________________________________________________ 760 761 4.2.1. ELF Section Types 762 763 The following section types are defined in the System V ABI 764 and the System V ABI Update. 765 766 Table 4-1. ELF Section Types 767 Name Value Description 768 SHT_DYNAMIC 0x6 The section holds information for dynamic 769 linking. Currently, an object file shall have only one dynamic 770 section, but this restriction may be relaxed in the future. 771 See `Dynamic Section' in Chapter 5 for details. 772 SHT_DYNSYM 0xb This section holds a minimal set of symbols 773 adequate for dynamic linking. See also SHT_SYMTAB. Currently, 774 an object file may have either a section of SHT_SYMTAB type or 775 a section of SHT_DYNSYM type, but not both. This restriction 776 may be relaxed in the future. 777 SHT_FINI_ARRAY 0xf This section contains an array of pointers 778 to termination functions, as described in `Initialization and 779 Termination Functions' in Chapter 5. Each pointer in the array 780 is taken as a parameterless procedure with a void return. 781 SHT_HASH 0x5 The section holds a symbol hash table. Currently, 782 an object file shall have only one hash table, but this 783 restriction may be relaxed in the future. See `Hash Table' in 784 the Chapter 5 for details. 785 SHT_HIPROC 0x7fffffff Values in this inclusive range are 786 reserved for processor-specific semantics. 787 SHT_HIUSER 0xffffffff This value specifies the upper bound of 788 the range of indexes reserved for application programs. 789 Section types between SHT_LOUSER and SHT_HIUSER can be used by 790 the application, without conflicting with current or future 791 system-defined section types. 792 SHT_INIT_ARRAY 0xe This section contains an array of pointers 793 to initialization functions, as described in `Initialization 794 and Termination Functions' in Chapter 5. Each pointer in the 795 array is taken as a parameterless procedure with a void 796 return. 797 SHT_LOPROC 0x70000000 Values in this inclusive range are 798 reserved for processor-specific semantics. 799 SHT_LOUSER 0x80000000 This value specifies the lower bound of 800 the range of indexes reserved for application programs. 801 SHT_NOBITS 0x8 A section of this type occupies no space in the 802 file but otherwise resembles SHT_PROGBITS. Although this 803 section contains no bytes, the sh_offset member contains the 804 conceptual file offset. 805 SHT_NOTE 0x7 The section holds information that marks the file 806 in some way. See `Note Section' in Chapter 5 for details. 807 SHT_NULL 0x0 This value marks the section header as inactive; 808 it does not have an associated section. Other members of the 809 section header have undefined values. 810 SHT_PREINIT_ARRAY 0x10 This section contains an array of 811 pointers to functions that are invoked before all other 812 initialization functions, as described in `Initialization and 813 Termination Functions' in Chapter 5. Each pointer in the array 814 is taken as a parameterless proceure with a void return. 815 SHT_PROGBITS 0x1 The section holds information defined by the 816 program, whose format and meaning are determined solely by the 817 program. 818 SHT_REL 0x9 The section holds relocation entries without 819 explicit addends, such as type Elf32_Rel for the 32-bit class 820 of object files or type Elf64_Rel for the 64-bit class of 821 object files. An object file may have multiple relocation 822 sections. See "Relocation" 823 SHT_RELA 0x4 The section holds relocation entries with 824 explicit addends, such as type Elf32_Rela for the 32-bit class 825 of object files or type Elf64_Rela for the 64-bit class of 826 object files. An object file may have multiple relocation 827 sections. `Relocation' b 828 SHT_SHLIB 0xa This section type is reserved but has 829 unspecified semantics. 830 SHT_STRTAB 0x3 The section holds a string table. An object 831 file may have multiple string table sections. See `String 832 Table' below for details. 833 SHT_SYMTAB 0x2 This section holds a symbol table. Currently, 834 an object file may have either a section of SHT_SYMTAB type or 835 a section of SHT_DYNSYM type, but not both. This restriction 836 may be relaxed in the future. Typically, SHT_SYMTAB provides 837 symbols for link editing, though it may also be used for 838 dynamic linking. As a complete symbol table, it may contain 839 many symbols unnecessary for dynamic linking. 840 _________________________________________________________ 841 842 4.2.2. Additional Section Types 843 844 The following additional section types are defined here. 845 846 Table 4-2. Additional Section Types 847 Name Value Description 848 SHT_GNU_verdef 0x6ffffffd This section contains the symbol 849 versions that are provided. 850 SHT_GNU_verneed 0x6ffffffe This section contains the symbol 851 versions that are required. 852 SHT_GNU_versym 0x6fffffff This section contains the Symbol 853 Version Table. 854 _________________________________________________________ 855 856 Chapter 5. Special Sections 857 858 5.1. Special Sections 859 860 Various sections hold program and control information. 861 Sections in the lists below are used by the system and have 862 the indicated types and attributes. 863 _________________________________________________________ 864 865 5.1.1. ELF Special Sections 866 867 The following sections are defined in the System V ABI and the 868 System V ABI Update. 869 870 Table 5-1. ELF Special Sections 871 Name Type Attributes 872 .bss SHT_NOBITS SHF_ALLOC+SHF_WRITE 873 .comment SHT_PROGBITS 0 874 .data SHT_PROGBITS SHF_ALLOC+SHF_WRITE 875 .data1 SHT_PROGBITS SHF_ALLOC+SHF_WRITE 876 .debug SHT_PROGBITS 0 877 .dynamic SHT_DYNAMIC SHF_ALLOC+SHF_WRITE 878 .dynstr SHT_STRTAB SHF_ALLOC 879 .dynsym SHT_DYNSYM SHF_ALLOC 880 .fini SHT_PROGBITS SHF_ALLOC+SHF_EXECINSTR 881 .fini_array SHT_FINI_ARRAY SHF_ALLOC+SHF_WRITE 882 .hash SHT_HASH SHF_ALLOC 883 .init SHT_PROGBITS SHF_ALLOC+SHF_EXECINSTR 884 .init_array SHT_INIT_ARRAY SHF_ALLOC+SHF_WRITE 885 .interp SHT_PROGBITS SHF_ALLOC 886 .line SHT_PROGBITS 0 887 .note SHT_NOTE 0 888 .preinit_array SHT_PREINIT_ARRAY SHF_ALLOC+SHF_WRITE 889 .rodata SHT_PROGBITS SHF_ALLOC 890 .rodata1 SHT_PROGBITS SHF_ALLOC 891 .shstrtab SHT_STRTAB 0 892 .strtab SHT_STRTAB SHF_ALLOC 893 .symtab SHT_SYMTAB SHF_ALLOC 894 .tbss SHT_NOBITS SHF_ALLOC+SHF_WRITE+SHF_TLS 895 .tdata SHT_PROGBITS SHF_ALLOC+SHF_WRITE+SHF_TLS 896 .text SHT_PROGBITS SHF_ALLOC+SHF_EXECINSTR 897 898 .bss 899 This section holds data that contributes to the 900 program's memory image. The program may treat this data 901 as uninitialized. However, the system shall initialize 902 this data with zeroes when the program begins to run. 903 The section occupies no file space, as indicated by the 904 section type, SHT_NOBITS 905 906 .comment 907 This section holds version control information. 908 909 .data 910 This section holds initialized data that contribute to 911 the program's memory image. 912 913 .data1 914 This section holds initialized data that contribute to 915 the program's memory image. 916 917 .debug 918 This section holds information for symbolic debugging. 919 The contents are unspecified. All section names with 920 the prefix .debug hold information for symbolic 921 debugging. The contents of these sections are 922 unspecified. 923 924 .dynamic 925 This section holds dynamic linking information. The 926 section's attributes will include the SHF_ALLOC bit. 927 Whether the SHF_WRITE bit is set is processor specific. 928 See Chapter 5 for more information. 929 930 .dynstr 931 This section holds strings needed for dynamic linking, 932 most commonly the strings that represent the names 933 associated with symbol table entries. See Chapter 5 for 934 more information. 935 936 .dynsym 937 This section holds the dynamic linking symbol table, as 938 described in `Symbol Table'. See Chapter 5 for more 939 information. 940 941 .fini 942 This section holds executable instructions that 943 contribute to the process termination code. That is, 944 when a program exits normally, the system arranges to 945 execute the code in this section. 946 947 .fini_array 948 This section holds an array of function pointers that 949 contributes to a single termination array for the 950 executable or shared object containing the section. 951 952 .hash 953 This section holds a symbol hash table. See `Hash 954 Table' in Chapter 5 for more information. 955 956 .init 957 This section holds executable instructions that 958 contribute to the process initialization code. When a 959 program starts to run, the system arranges to execute 960 the code in this section before calling the main 961 program entry point (called main for C programs) 962 963 .init_array 964 This section holds an array of function pointers that 965 contributes to a single initialization array for the 966 executable or shared object containing the section. 967 968 .interp 969 This section holds the path name of a program 970 interpreter. If the file has a loadable segment that 971 includes relocation, the sections' attributes will 972 include the SHF_ALLOC bit; otherwise, that bit will be 973 off. See Chapter 5 for more information. 974 975 .line 976 This section holds line number information for symbolic 977 debugging, which describes the correspondence between 978 the source program and the machine code. The contents 979 are unspecified. 980 981 .note 982 This section holds information in the format that `Note 983 Section' in Chapter 5 describes of the System V 984 Application Binary Interface, Edition 4.1. 985 986 .preinit_array 987 This section holds an array of function pointers that 988 contributes to a single pre-initialization array for 989 the executable or shared object containing the section. 990 991 .rodata 992 This section holds read-only data that typically 993 contribute to a non-writable segment in the process 994 image. See `Program Header' in Chapter 5 for more 995 information. 996 997 .rodata1 998 This section hold sread-only data that typically 999 contribute to a non-writable segment in the process 1000 image. See `Program Header' in Chapter 5 for more 1001 information. 1002 1003 .shstrtab 1004 This section holds section names. 1005 1006 .strtab 1007 This section holds strings, most commonly the strings 1008 that represent the names associated with symbol table 1009 entries. If the file has a loadable segment that 1010 includes the symbol string table, the section's 1011 attributes will include the SHF_ALLOC bit; otherwi 1012 1013 .symtab 1014 This section holds a symbol table, as `Symbol Table'. 1015 in this chapter describes. If the file has a loadable 1016 segment that includes the symbol table, the section's 1017 attributes will include the SHF_ALLOC bit; otherwise, 1018 that bit will be off. 1019 1020 .tbss 1021 This section holds uninitialized thread-local data that 1022 contribute to the program's memory image. By 1023 definition, the system initializes the data with zeros 1024 when the data is instantiated for each new execution 1025 flow. The section occupies no file space, as indicated 1026 by the section type, SHT_NOBITS. Implementations need 1027 not support thread-local storage. 1028 1029 .tdata 1030 This section holds initialized thread-local data that 1031 contributes to the program's memory image. A copy of 1032 its contents is instantiated by the system for each new 1033 execution flow. Implementations need not support 1034 thread-local storage. 1035 1036 .text 1037 This section holds the `text,' or executable 1038 instructions, of a program. 1039 _________________________________________________________ 1040 1041 5.1.2. Additional Special Sections 1042 1043 Object files in an LSB conforming application may also contain 1044 one or more of the additional special sections described 1045 below. 1046 1047 Table 5-2. Additional Special Sections 1048 Name Type Attributes 1049 .ctors SHT_PROGBITS SHF_ALLOC+SHF_WRITE 1050 .dtors SHT_PROGBITS SHF_ALLOC+SHF_WRITE 1051 .eh_frame SHT_PROGBITS SHF_ALLOC 1052 .eh_frame_hdr SHT_PROGBITS SHF_ALLOC 1053 .gnu.version SHT_GNU_versym SHF_ALLOC 1054 .gnu.version_d SHT_GNU_verdef SHF_ALLOC 1055 .gnu.version_r SHT_GNU_verneed SHF_ALLOC 1056 .jcr SHT_PROGBITS SHF_ALLOC+SHF_WRITE 1057 .note.ABI-tag SHT_NOTE SHF_ALLOC 1058 .stab SHT_PROGBITS 0 1059 .stabstr SHT_STRTAB 0 1060 1061 .ctors 1062 This section contains a list of global constructor 1063 function pointers. 1064 1065 .dtors 1066 This section contains a list of global destructor 1067 function pointers. 1068 1069 .eh_frame 1070 This section contains information necessary for frame 1071 unwinding during exception handling. 1072 1073 .eh_frame_hdr 1074 This section contains a pointer to the .eh_frame 1075 section which is accessible to the runtime support code 1076 of a C++ application. This section may also contain a 1077 binary search table which may be used by the runtime 1078 support code to more efficiently access records in the 1079 .eh_frame section. 1080 1081 .gnu.version 1082 This section contains the Symbol Version Table. 1083 1084 .gnu.version_d 1085 This section contains the Version Definitions. 1086 1087 .gnu.version_r 1088 This section contains the Version Requirments. 1089 1090 .jcr 1091 This section contains information necessary for 1092 registering compiled Java classes. The contents are 1093 compiler-specific and used by compiler initialization 1094 functions. 1095 1096 .note.ABI-tag 1097 Specify ABI details. 1098 1099 .stab 1100 This section contains debugging information. The 1101 contents are not specified as part of the LSB. 1102 1103 .stabstr 1104 This section contains strings associated with the 1105 debugging infomation contained in the .stab section. 1106 _________________________________________________________ 1107 1108 Chapter 6. Symbol Mapping 1109 1110 6.1. Introduction 1111 1112 This chapter defines how names are mapped from the source 1113 symbol to the object symbol. 1114 _________________________________________________________ 1115 1116 6.2. Symbol Mapping 1117 1118 Symbols in a source program are translated by the compilation 1119 system into symbols that exist in the object file. The rules 1120 for this translation are defined here. 1121 _________________________________________________________ 1122 1123 6.2.1. C Language 1124 1125 External C symbols have the same names in C and object files' 1126 symbol tables. 1127 _________________________________________________________ 1128 1129 Chapter 7. DWARF Extensions 1130 1131 In addition to the Call Frame Instructions defined in section 1132 6.4.2 of DWARF Debugging Information Format, the following 1133 Call Frame Instructions may also be used. 1134 1135 Table 7-1. Additional DWARF Call Frame Instructions 1136 Name Value Meaning 1137 DW_CFA_expression 0x10 The DW_CFA_expression instruction takes 1138 two operands: an unsigned LEB128 value representing a register 1139 number, and a DW_FORM_block value representing a DWARF 1140 expression. The required action is to establish the DWARF 1141 expression as the means by which the address in which the 1142 given register contents are found may be computed. The value 1143 of the CFA is pushed on the DWARF evaluation stack prior to 1144 execution of the DWARF expression. The DW_OP_call2, 1145 DW_OP_call4, DW_OP_call_ref and DW_OP_push_object_address 1146 DWARF operators (see Section 2.4.1 of DWARF Debugging 1147 Information Format) cannot be used in such a DWARF expression. 1148 DW_CFA_offset_extended_sf 0x11 The DW_CFA_offset_extended_sf 1149 instruction takes two operands: an unsigned LEB128 value 1150 representing a register number and a signed LEB128 factored 1151 offset. This instruction is identical to 1152 DW_CFA_offset_extended except that the second operand is 1153 signed. 1154 DW_CFA_def_cfa_sf 0x12 The DW_CFA_def_cfa_sf instruction takes 1155 two operands: an unsigned LEB128 value representing a register 1156 number and a signed LEB128 factored offset. This instruction 1157 is identical to DW_CFA_def_cfa except that the second operand 1158 is signed and factored. 1159 DW_CFA_def_cfa_offset_sf 0x13 The DW_CFA_def_cfa_offset_sf 1160 instruction takes a signed LEB128 operand representing a 1161 factored offset. This instruction is identical to 1162 DW_CFA_def_cfa_offset except that the operand is signed and 1163 factored. 1164 DW_CFA_GNU_args_size 0x2e The DW_CFA_def_cfa_offset_sf 1165 instruction takes an unsigned LEB128 operand representing an 1166 argument size. 1167 DW_CFA_GNU_negative_offset_extended 0x2f The DW_CFA_def_cfa_sf 1168 instruction takes two operands: an unsigned LEB128 value 1169 representing a register number and an unsigned LEB128 which 1170 represents the magnitude of the offset. This instruction is 1171 identical to DW_CFA_offset_extended_sf except that the operand 1172 is subtracted to produce the offset. This instructions is 1173 obsoleted by DW_CFA_offset_extended_sf. 1174 _________________________________________________________ 1175 1176 Chapter 8. EH Frame 1177 1178 This chapter will contain a formal description of the contents 1179 of the .eh_frame_hdr section. 1180 _________________________________________________________ 1181 1182 Chapter 9. EH Frame Header 1183 1184 9.1. Introduction 1185 1186 The .eh_frame_hdr section contains additional information 1187 about the .eh_frame section. A pointer to the start of the 1188 .eh_frame data, and optionally, a binary search table of 1189 pointers to the .eh_frame records are found in this section. 1190 1191 Data in this section is encoded according to the DWARF 1192 Exception Header Encoding described below. 1193 1194 Table 9-1. .eh_frame_hdr Section Format 1195 Encoding Field 1196 unsigned byte version 1197 unsigned byte eh_frame_ptr_enc 1198 unsigned byte fde_count_enc 1199 unsigned byte table_enc 1200 encoded eh_frame_ptr 1201 encoded fde_count 1202 binary search table 1203 1204 version 1205 Version of the .eh_frame_hdr format. This value shall 1206 be 1. 1207 1208 eh_frame_ptr_enc 1209 The encoding format of the eh_frame_ptr field. 1210 1211 fde_count_enc 1212 The encoding format of the fde_count field. A value of 1213 DW_EH_PE_omit indicates the binary search table is not 1214 present. 1215 1216 table_enc 1217 The encoding format of the entries in the binary search 1218 table. A value of DW_EH_PE_omit indicates the binary 1219 search table is not present. 1220 1221 eh_frame_ptr 1222 The encoded value of the pointer to the start of the 1223 .eh_frame section. 1224 1225 fde_count 1226 The encoded value of the count of entries in the binary 1227 search table. 1228 1229 binary search table 1230 A binary search table containing fde_count entries. 1231 Each entry of the table consist of two encoded values, 1232 the initial location, and the address. The entries are 1233 sorted in an increasing order by the initial location 1234 value. 1235 _________________________________________________________ 1236 1237 9.2. DWARF Exception Header Encoding 1238 1239 The DWARF Exception Header Encoding is used to describe the 1240 type of data used in the .eh_frame_hdr section. The upper 4 1241 bits indicate how the value is to be applied. The lower 4 bits 1242 indicate the format of the data. 1243 1244 Table 9-2. DWARF Exception Header value format 1245 Name Value Meaning 1246 DW_EH_PE_omit 0xff No value is present. 1247 DW_EH_PE_uleb128 0x01 Unsigned value is encoded using the 1248 Little Endian Base 128 (LEB128) as defined by DWARF Debugging 1249 Information Format. 1250 DW_EH_PE_udata2 0x02 A 2 bytes unsigned value. 1251 DW_EH_PE_udata4 0x03 A 4 bytes unsigned value. 1252 DW_EH_PE_udata8 0x04 An 8 bytes unsigned value. 1253 DW_EH_PE_sleb128 0x09 Signed value is encoded using the Little 1254 Endian Base 128 (LEB128) as defined by DWARF Debugging 1255 Information Format. 1256 DW_EH_PE_sdata2 0x0A A 2 bytes signed value. 1257 DW_EH_PE_sdata4 0x0B A 4 bytes signed value. 1258 DW_EH_PE_sdata8 0x0C An 8 bytes signed value. 1259 1260 Table 9-3. DWARF Exception Header application 1261 Name Value Meaning 1262 DW_EH_PE_absptr 0x00 Value is used with no modification. 1263 DW_EH_PE_pcrel 0x10 Value is reletive to the current program 1264 counter. 1265 DW_EH_PE_datarel 0x30 Value is reletive to the beginning of 1266 the .eh_frame_hdr section. 1267 DW_EH_PE_omit 0xff No value is present. 1268 _________________________________________________________ 1269 1270 Chapter 10. Symbol Versioning 1271 1272 10.1. Introduction 1273 1274 This chapter describes the Symbol Versioning mechanism. All 1275 ELF objects may provide or depend on versioned symbols. Symbol 1276 Versioning is implemented by 3 section types: SHT_GNU_versym, 1277 SHT_GNU_verdef, and SHT_GNU_verneed. 1278 1279 The prefix Elfxx in the following descriptions and code 1280 fragments stands for either "Elf32" or "Elf64", depending on 1281 the architecture. 1282 1283 Versions are described by strings. The structures that are 1284 used for symbol versions also contain a member that holds the 1285 ELF hashing values of the strings. This allows for more 1286 efficient processing. 1287 _________________________________________________________ 1288 1289 10.2. Symbol Version Table 1290 1291 The special section .gnu.version which has a section type of 1292 SHT_GNU_versym shall contain the Symbol Version Table. This 1293 section shall have the same number of entries as the Dynamic 1294 Symbol Table in the .dynsym section. 1295 1296 The .gnu.version section shall contain an array of elements of 1297 type Elfxx_Half. Each entry specifies the version defined for 1298 or required by the corresponding symbol in the Dynamic Symbol 1299 Table. 1300 1301 The values in the Symbol Version Table are specific to the 1302 object in which they are located. These values are identifiers 1303 that are provided by the the vna_other member of the 1304 Elfxx_Vernaux structure or the vd_ndx member of the 1305 Elfxx_Verdef structure. 1306 1307 The values 0 and 1 are reserved. 1308 1309 0 1310 The symbol is local, not available outside the object. 1311 1312 1 1313 The symbol is defined in this object and is globally 1314 available. 1315 1316 All other values are used to identify version strings located 1317 in one of the other Symbol Version sections. The value itself 1318 is not the version associated with the symbol. The string 1319 identified by the value defines the version of the symbol. 1320 _________________________________________________________ 1321 1322 10.3. Version Definitions 1323 1324 Symbol definitions are contained in the special section 1325 .gnu.version_d which has a section type of SHT_GNU_verdef. The 1326 number of entries in this section is contained in the 1327 DT_VERDEFNUM entry of the Dynamic Section. The sh_link member 1328 of the section header points to the section that contains the 1329 strings referenced by this section. 1330 1331 The special section .gnu.version_d which has a section type of 1332 SHT_GNU_verdef shall contain symbol version definitions. The 1333 number of entries in this section shall be contained in the 1334 DT_VERDEFNUM entry of the Dynamic Section .dynamic. The 1335 sh_link member of the section header (see figure 4-8 in the 1336 System V ABI) shall point to the section that contains the 1337 strings referenced by this section. 1338 1339 The section shall contain an array of Elfxx_Verdef structures, 1340 as described in Figure 10-1, optionally followed by an array 1341 of Elfxx_Verdaux structures, as defined in Figure 10-2. 1342 typedef struct { 1343 Elfxx_Half vd_version; 1344 Elfxx_Half vd_flags; 1345 Elfxx_Half vd_ndx; 1346 Elfxx_Half vd_cnt; 1347 Elfxx_Word vd_hash; 1348 Elfxx_Word vd_aux; 1349 Elfxx_Word vd_next; 1350 } Elfxx_Verdef; 1351 1352 Figure 10-1. Version Definition Entries 1353 1354 vd_version 1355 Version revision. This field shall be set to 1. 1356 1357 vd_flags 1358 Version information flag bitmask. 1359 1360 vd_ndx 1361 Version index numeric value referencing the 1362 SHT_GNU_versym section. 1363 1364 vd_cnt 1365 Number of associated verdaux array entries. 1366 1367 vd_hash 1368 Version name hash value (ELF hash function). 1369 1370 vd_aux 1371 Offset in bytes to a corresponding entry in an array of 1372 Elfxx_Verdaux structures as defined in Figure 10-2 1373 1374 vd_next 1375 Offset to the next verdef entry, in bytes. 1376 1377 typedef struct { 1378 Elfxx_Word vda_name; 1379 Elfxx_Word vda_next; 1380 } Elfxx_Verdaux; 1381 1382 Figure 10-2. Version Definition Auxiliary Entries 1383 1384 vda_name 1385 Offset to the version or dependency name string in the 1386 section header, in bytes. 1387 1388 vda_next 1389 Offset to the next verdaux entry, in bytes. 1390 _________________________________________________________ 1391 1392 10.4. Version Requirements 1393 1394 The special section .gnu.version_r which has a section type of 1395 SHT_GNU_verneed shall contain required symbol version 1396 definitions. The number of entries in this section shall be 1397 contained in the DT_VERNEEDNUM entry of the Dynamic Section 1398 .dynamic. The sh_link member of the section header (see figure 1399 4-8 in System V ABI) shall point to the section that contains 1400 the strings referenced by this section. 1401 1402 The section shall contain an array of Elfxx_Verneed 1403 structures, as described in Figure 10-3, optionally followed 1404 by an array of Elfxx_Vernaux structures, as defined in Figure 1405 10-4. 1406 typedef struct { 1407 Elfxx_Half vn_version; 1408 Elfxx_Half vn_cnt; 1409 Elfxx_Word vn_file; 1410 Elfxx_Word vn_aux; 1411 Elfxx_Word vn_next; 1412 } Elfxx_Verneed; 1413 1414 Figure 10-3. Version Needed Entries 1415 1416 vn_version 1417 Version of structure. This value is currently set to 1, 1418 and will be reset if the versioning implementation is 1419 incompatibly altered. 1420 1421 vn_cnt 1422 Number of associated verneed array entries. 1423 1424 vn_file 1425 Offset to the file name string in the section header, 1426 in bytes. 1427 1428 vn_aux 1429 Offset to a corresponding entry in the vernaux array, 1430 in bytes. 1431 1432 vn_next 1433 Offset to the next verneed entry, in bytes. 1434 1435 typedef struct { 1436 Elfxx_Word vna_hash; 1437 Elfxx_Half vna_flags; 1438 Elfxx_Half vna_other; 1439 Elfxx_Word vna_name; 1440 Elfxx_Word vna_next; 1441 } Elfxx_Vernaux; 1442 1443 Figure 10-4. Version Needed Auxiliary Entries 1444 1445 vna_hash 1446 Dependency name hash value (ELF hash function). 1447 1448 vna_flags 1449 Dependency information flag bitmask. 1450 1451 vna_other 1452 Object file version identifier used in the .gnu.version 1453 symbol version array. Bit number 15 controls whether or 1454 not the object is hidden; if this bit is set, the 1455 object cannot be used and the static linker will ignore 1456 the symbol's presence in the object. 1457 1458 vna_name 1459 Offset to the dependency name string in the section 1460 header, in bytes. 1461 1462 vna_next 1463 Offset to the next vernaux entry, in bytes. 1464 _________________________________________________________ 1465 1466 10.5. Startup Sequence 1467 1468 When loading a sharable object the system shall analyze 1469 version definition data from the loaded object to assure that 1470 it meets the version requirements of the calling object. This 1471 step is referred to as definition testing. The dynamic loader 1472 shall retrieve the entries in the caller's Elfxx_Verneed array 1473 and attempt to find matching definition information in the 1474 loaded Elfxx_Verdef table. 1475 1476 Each object and dependency shall be tested in turn. If a 1477 symbol definition is missing and the vna_flags bit for 1478 VER_FLG_WEAK is not set, the loader shall return an error and 1479 exit. If the vna_flags bit for VER_FLG_WEAK is set in the 1480 Elfxx_Vernaux entry, and the loader shall issue a warning and 1481 continue operation. 1482 1483 When the versions referenced by undefined symbols in the 1484 loaded object are found, version availability is certified. 1485 The test completes without error and the object shall be made 1486 available. 1487 _________________________________________________________ 1488 1489 10.6. Symbol Resolution 1490 1491 When symbol versioning is used in an object, relocations 1492 extend definition testing beyond the simple match of symbol 1493 name strings: the version of the reference shall also equal 1494 the name of the definition. 1495 1496 The same index that is used in the symbol table can be 1497 referenced in the SHT_GNU_versym section, and the value of 1498 this index is then used to acquire name data. The 1499 corresponding requirement string is retrieved from the 1500 Elfxx_Verneed array, and likewise, the corresponding 1501 definition string from the Elfxx_Verdef table. 1502 1503 If the high order bit (bit number 15) of the version symbolis 1504 set, the object cannot be used and the static linker shall 1505 ignore the symbol's presence in the object. 1506 1507 When an object with a reference and an object with the 1508 definition are being linked, the following rules shall govern 1509 the result: 1510 1511 * The object with the reference and the object with the 1512 definitions both use versioning. All described matching is 1513 processed in this case. A fatal error shall be triggered 1514 when no matching definition can be found in the object 1515 whose name is the one referenced by the vn_name element in 1516 the Elfxx_Verneed entry. 1517 * The object with the reference does not use versioning, 1518 while the object with the definitions does. In this 1519 instance, only the definitions with index numbers 1 and 2 1520 will be used in the reference match, the same identified 1521 by the static linker as the base definition. In cases 1522 where the static linker was not used, such as in calls to 1523 dlopen(), a version that does not have the base definition 1524 index shall be acceptable if it is the only version for 1525 which the symbol is defined. 1526 * The object with the reference uses versioning, but the 1527 object with the definitions specifies none. A matching 1528 symbol shall be accepted in this case. A fatal error shall 1529 be triggered if a corruption in the required symbols list 1530 obscures an outdated object file and causes a match on the 1531 object filename in the Elfxx_Verneed entry. 1532 * Neither the object with the reference nor the object with 1533 the definitions use versioning. The behavior in this 1534 instance shall default to pre-existing symbol rules. 1535 _________________________________________________________ 1536 1537 Chapter 11. ABI note tag 1538 1539 Every executable shall contain a section named .note.ABI-tag 1540 of type SHT_NOTE. This section is structured as a note section 1541 as documented in the ELF spec. The section shall contain at 1542 least the following entry. The name field (namesz/name) 1543 contains the string "GNU". The type field shall be 1. The 1544 descsz field shall be at least 16, and the first 16 bytes of 1545 the desc field shall be as follows. 1546 1547 The first 32-bit word of the desc field shall be 0 (this 1548 signifies a Linux executable). The second, third, and fourth 1549 32-bit words of the desc field contain the earliest compatible 1550 kernel version. For example, if the 3 words are 2, 2, and 5, 1551 this signifies a 2.2.5 kernel. 1552 1553 III. Dynamic Linking 1554 1555 Table of Contents 1556 12. Program Loading and Dynamic Linking 1557 13. Program Header 1558 14. Dynamic Entries 1559 _________________________________________________________ 1560 1561 Chapter 12. Program Loading and Dynamic Linking 1562 1563 LSB-conforming implementations shall support the object file 1564 information and system actions that create running programs as 1565 specified in the System V ABI and System V ABI Update and as 1566 supplemented by this document and an architecture-specific LSB 1567 specification. 1568 1569 Any shared object that is loaded shall contain sufficient 1570 DT_NEEDED records to satisfy the symbols on the shared 1571 library. 1572 _________________________________________________________ 1573 1574 Chapter 13. Program Header 1575 1576 In addition to the Segment Types defined in the System V ABI 1577 and System V ABI Update the following Segment Types shall also 1578 be supported. 1579 1580 Table 13-1. Linux Segment Types 1581 Name Value 1582 PT_GNU_EH_FRAME 0x6474e550 1583 PT_GNU_STACK 0x6474e551 1584 1585 PT_GNU_EH_FRAME 1586 The array element specifies the location and size of 1587 the exception handling information as defined by the 1588 .eh_frame_hdr section. 1589 1590 PT_GNU_STACK 1591 The p_flags member specifies the permissions on the 1592 segment containing the stack and is used to indicate 1593 wether the stack should be executable. The absense of 1594 this header indicates that the stack will be 1595 executable. 1596 _________________________________________________________ 1597 1598 Chapter 14. Dynamic Entries 1599 1600 14.1. Introduction 1601 1602 As described in System V ABI, if an object file participates 1603 in dynamic linking, its program header table shall have an 1604 element of type PT_DYNAMIC. This `segment' contains the 1605 .dynamic section. A special symbol, _DYNAMIC, labels the 1606 section, which contains an array of the following structures. 1607 typedef struct { 1608 Elf32_Sword d_tag; 1609 union { 1610 Elf32_Word d_val; 1611 Elf32_Addr d_ptr; 1612 } d_un; 1613 } Elf32_Dyn; 1614 1615 extern Elf32_Dyn _DYNAMIC[]; 1616 1617 typedef struct { 1618 Elf64_Sxword d_tag; 1619 union { 1620 Elf64_Xword d_val; 1621 Elf64_Addr d_ptr; 1622 } d_un; 1623 } Elf64_Dyn; 1624 1625 extern Elf64_Dyn _DYNAMIC[]; 1626 1627 Figure 14-1. Dynamic Structure 1628 1629 For each object with this type, d_tag controls the 1630 interpretation of d_un. 1631 _________________________________________________________ 1632 1633 14.2. Dynamic Entries 1634 _________________________________________________________ 1635 1636 14.2.1. ELF Dynamic Entries 1637 1638 The following dynamic entries are defined in the System V ABI 1639 and System V ABI Update. 1640 1641 DT_BIND_NOW 1642 Process relocations of object 1643 1644 DT_DEBUG 1645 For debugging; unspecified 1646 1647 DT_FINI 1648 Address of termination function 1649 1650 DT_HASH 1651 Address of symbol hash table 1652 1653 DT_HIPROC 1654 End of processor-specific 1655 1656 DT_INIT 1657 Address of init function 1658 1659 DT_JMPREL 1660 Address of PLT relocs 1661 1662 DT_LOPROC 1663 Start of processor-specific 1664 1665 DT_NEEDED 1666 Name of needed library 1667 1668 DT_NULL 1669 Marks end of dynamic section 1670 1671 DT_PLTREL 1672 Type of reloc in PLT 1673 1674 DT_PLTRELSZ 1675 Size in bytes of PLT relocs 1676 1677 DT_REL 1678 Address of Rel relocs 1679 1680 DT_RELA 1681 Address of Rela relocs 1682 1683 DT_RELAENT 1684 Size of one Rela reloc 1685 1686 DT_RELASZ 1687 Total size of Rela relocs 1688 1689 DT_RELENT 1690 Size of one Rel reloc 1691 1692 DT_RELSZ 1693 Total size of Rel relocs 1694 1695 DT_RPATH 1696 Library search path 1697 1698 DT_SONAME 1699 Name of shared object 1700 1701 DT_STRSZ 1702 Size of string table 1703 1704 DT_STRTAB 1705 Address of string table 1706 1707 DT_SYMBOLIC 1708 Start symbol search here 1709 1710 DT_SYMENT 1711 Size of one symbol table entry 1712 1713 DT_SYMTAB 1714 Address of symbol table 1715 1716 DT_TEXTREL 1717 Reloc might modify .text 1718 _________________________________________________________ 1719 1720 14.2.2. Additional Dynamic Entries 1721 1722 An LSB conforming object may also use the following additional 1723 Dynamic Entry types. 1724 1725 DT_ADDRRNGHI 1726 Values from DT_ADDRRNGLO through DT_ADDRRNGHI are 1727 reserved for definition by an archLSB. 1728 1729 DT_ADDRRNGLO 1730 Values from DT_ADDRRNGLO through DT_ADDRRNGHI are 1731 reserved for definition by an archLSB. 1732 1733 DT_AUXILIARY 1734 Shared object to load before self 1735 1736 DT_FILTER 1737 Shared object to get values from 1738 1739 DT_FINI_ARRAY 1740 The address of an array of pointers to termination 1741 functions. 1742 1743 DT_FINI_ARRAYSZ 1744 Size in bytes of DT_FINI_ARRAY 1745 1746 DT_HIOS 1747 Values from DT_LOOS through DT_HIOS are reserved for 1748 definition by specific operating systems. 1749 1750 DT_INIT_ARRAY 1751 The address of an array of pointers to initialization 1752 functions. 1753 1754 DT_INIT_ARRAYSZ 1755 Size in bytes of DT_INIT_ARRAY 1756 1757 DT_LOOS 1758 Values from DT_LOOS through DT_HIOS are reserved for 1759 definition by specific operating systems. 1760 1761 DT_NUM 1762 Number of dynamic entry tags defined (excepting 1763 reserved ranges). 1764 1765 DT_POSFLAG_1 1766 Flags for DT_* entries, effecting the following DT_* 1767 entry 1768 1769 DT_RELCOUNT 1770 All Elf32_Rel R_*_RELATIVE relocations have been placed 1771 into a single block and this entry specifies the number 1772 of entries in that block. This permits ld.so.1 to 1773 streamline the processing of RELATIVE relocations. 1774 1775 DT_RUNPATH 1776 null-terminated library search path string 1777 1778 DT_SYMINENT 1779 Entry size of syminfo 1780 1781 DT_SYMINFO 1782 Address of the Syminfo table. 1783 1784 DT_SYMINSZ 1785 Size of syminfo table (in bytes) 1786 1787 DT_VALRNGHI 1788 Entries which fall between DT_VALRNGHI & DT_VALRNGLO 1789 use the Dyn.d_un.d_val field of the Elf*_Dyn structure. 1790 1791 DT_VALRNGLO 1792 Entries which fall between DT_VALRNGHI & DT_VALRNGLO 1793 use the Dyn.d_un.d_val field of the Elf*_Dyn structure. 1794 1795 DT_VERDEF 1796 Address of version definition table 1797 1798 DT_VERDEFNUM 1799 Number of version definitions 1800 1801 DT_VERNEED 1802 Address of table with needed versions 1803 1804 DT_VERNEEDNUM 1805 Number of needed versions 1806 1807 DT_VERSYM 1808 Address of the table provided by the .gnu.version 1809 section. 1810 1811 Linux Standard Base Specification 1812 _________________________________________________________ 1813 1814 Table of Contents 1815 I. Base Libraries 1816 1817 1. Libraries 1818 1819 1.1. Introduction 1820 1.2. Program Interpreter 1821 1.3. Interfaces for libc 1822 1.4. Data Definitions for libc 1823 1.5. Interface Definitions for libc 1824 1.6. Interfaces for libm 1825 1.7. Data Definitions for libm 1826 1.8. Interface Definitions for libm 1827 1.9. Interfaces for libpthread 1828 1.10. Data Definitions for libpthread 1829 1.11. Interface Definitions for libpthread 1830 1.12. Interfaces for libgcc_s 1831 1.13. Data Definitions for libgcc_s 1832 1.14. Interfaces for libdl 1833 1.15. Data Definitions for libdl 1834 1.16. Interface Definitions for libdl 1835 1.17. Interfaces for libcrypt 1836 1.18. Interfaces for libpam 1837 1.19. Data Definitions for libpam 1838 1.20. Interface Definitions for libpam 1839 1840 II. Utility Libraries 1841 1842 2. Utility Libraries 1843 1844 2.1. Introduction 1845 2.2. Interfaces for libz 1846 2.3. Data Definitions for libz 1847 2.4. Interface Definitions for libz 1848 2.5. Interfaces for libncurses 1849 2.6. Data Definitions for libncurses 1850 2.7. Interfaces for libutil 1851 2.8. Interface Definitions for libutil 1852 1853 III. Commands and Utilities 1854 1855 3. Commands and Utilities 1856 1857 3.1. Commands and Utilities 1858 3.2. Command Behavior 1859 1860 IV. Execution Environment 1861 1862 4. File System Hierarchy 1863 1864 4.1. /dev 1865 4.2. User Accounting Databases 1866 4.3. Path For System Administration Utilities 1867 1868 5. Additional Recommendations 1869 1870 5.1. Minimal granted Directory and File permissions 1871 5.2. Recommendations for applications on ownership 1872 and permissions 1873 1874 6. Additional Behaviors 1875 1876 6.1. Mandatory Optional Behaviors 1877 1878 7. Localization 1879 1880 7.1. Introduction 1881 7.2. Regular Expressions 1882 7.3. Pattern Matching Notation 1883 1884 V. System Initialization 1885 1886 8. System Initialization 1887 1888 8.1. Cron Jobs 1889 8.2. Init Script Actions 1890 8.3. Comment Conventions for Init Scripts 1891 8.4. Installation and Removal of init.d Files 1892 8.5. Run Levels 1893 8.6. Facility Names 1894 8.7. Script Names 1895 8.8. Init Script Functions 1896 1897 VI. Users & Groups 1898 1899 9. Users & Groups 1900 1901 9.1. User and Group Database 1902 9.2. User & Group Names 1903 9.3. UID Ranges 1904 9.4. Rationale 1905 1906 A. Alphabetical Listing of Interfaces 1907 1908 A.1. libc 1909 A.2. libcrypt 1910 A.3. libdl 1911 A.4. libm 1912 A.5. libncurses 1913 A.6. libpam 1914 A.7. libpthread 1915 A.8. libutil 1916 A.9. libz 1917 1918 List of Tables 1919 1-1. libc Definition 1920 1-2. libc - RPC Function Interfaces 1921 1-3. libc - System Calls Function Interfaces 1922 1-4. libc - Standard I/O Function Interfaces 1923 1-5. libc - Standard I/O Data Interfaces 1924 1-6. libc - Signal Handling Function Interfaces 1925 1-7. libc - Signal Handling Data Interfaces 1926 1-8. libc - Localization Functions Function Interfaces 1927 1-9. libc - Localization Functions Data Interfaces 1928 1-10. libc - Socket Interface Function Interfaces 1929 1-11. libc - Wide Characters Function Interfaces 1930 1-12. libc - String Functions Function Interfaces 1931 1-13. libc - IPC Functions Function Interfaces 1932 1-14. libc - Regular Expressions Function Interfaces 1933 1-15. libc - Character Type Functions Function Interfaces 1934 1-16. libc - Time Manipulation Function Interfaces 1935 1-17. libc - Time Manipulation Data Interfaces 1936 1-18. libc - Terminal Interface Functions Function Interfaces 1937 1-19. libc - System Database Interface Function Interfaces 1938 1-20. libc - Language Support Function Interfaces 1939 1-21. libc - Large File Support Function Interfaces 1940 1-22. libc - Standard Library Function Interfaces 1941 1-23. libc - Standard Library Data Interfaces 1942 1-24. libm Definition 1943 1-25. libm - Math Function Interfaces 1944 1-26. libm - Math Data Interfaces 1945 1-27. libpthread Definition 1946 1-28. libpthread - Realtime Threads Function Interfaces 1947 1-29. libpthread - Posix Threads Function Interfaces 1948 1-30. libgcc_s Definition 1949 1-31. libdl Definition 1950 1-32. libdl - Dynamic Loader Function Interfaces 1951 1-33. libcrypt Definition 1952 1-34. libcrypt - Encryption Function Interfaces 1953 1-35. libpam Definition 1954 1-36. libpam - Pluggable Authentication API Function 1955 Interfaces 1956 1957 2-1. libz Definition 1958 2-2. libz - Compression Library Function Interfaces 1959 2-3. libncurses Definition 1960 2-4. libncurses - Curses Function Interfaces 1961 2-5. libncurses - Curses Data Interfaces 1962 2-6. libutil Definition 1963 2-7. libutil - Utility Functions Function Interfaces 1964 3-1. Commands And Utilities 1965 3-2. Built In Utilities 1966 3-1. Escape Sequences 1967 9-1. Required User & Group Names 1968 9-2. Optional User & Group Names 1969 A-1. libc Function Interfaces 1970 A-2. libc Data Interfaces 1971 A-3. libcrypt Function Interfaces 1972 A-4. libdl Function Interfaces 1973 A-5. libm Function Interfaces 1974 A-6. libm Data Interfaces 1975 A-7. libncurses Function Interfaces 1976 A-8. libncurses Data Interfaces 1977 A-9. libpam Function Interfaces 1978 A-10. libpthread Function Interfaces 1979 A-11. libutil Function Interfaces 1980 A-12. libz Function Interfaces 1981 1982 I. Base Libraries 1983 1984 Table of Contents 1985 1. Libraries 1986 _________________________________________________________ 1987 1988 Chapter 1. Libraries 1989 1990 1.1. Introduction 1991 1992 An LSB-conforming implementation shall support the following 1993 base libraries which provide interfaces for accessing the 1994 operating system, processor and other hardware in the system. 1995 1996 * libc 1997 * libm 1998 * libgcc_s 1999 * libdl 2000 * libcrypt 2001 * libpam 2002 _________________________________________________________ 2003 2004 1.2. Program Interpreter 2005 2006 The Program Interpreter is specified in the appropriate 2007 architecture-specific LSB specification. 2008 _________________________________________________________ 2009 2010 1.3. Interfaces for libc 2011 2012 Table 1-1 defines the library name and shared object name for 2013 the libc library 2014 2015 Table 1-1. libc Definition 2016 Library: libc 2017 SONAME: See archLSB. 2018 2019 The behavior of the interfaces in this library is specified by 2020 the following specifications: 2021 2022 Large File Support 2023 this specification 2024 SUSv2 2025 ISO POSIX (2003) 2026 SVID Issue 3 2027 SVID Issue 4 2028 _________________________________________________________ 2029 2030 1.3.1. RPC 2031 _________________________________________________________ 2032 2033 1.3.1.1. Interfaces for RPC 2034 2035 An LSB conforming implementation shall provide the generic 2036 functions for RPC specified in Table 1-2, with the full 2037 mandatory functionality as described in the referenced 2038 underlying specification. 2039 2040 Table 1-2. libc - RPC Function Interfaces 2041 authnone_create [1] svc_getreqset [2] svcudp_create [3] 2042 xdr_int [2] xdr_u_long [2] 2043 clnt_create [1] svc_register [3] xdr_accepted_reply [2] 2044 xdr_long [2] xdr_u_short [2] 2045 clnt_pcreateerror [1] svc_run [3] xdr_array [2] xdr_opaque [2] 2046 xdr_union [2] 2047 clnt_perrno [1] svc_sendreply [3] xdr_bool [2] xdr_opaque_auth 2048 [2] xdr_vector [2] 2049 clnt_perror [1] svcerr_auth [2] xdr_bytes [2] xdr_pointer [2] 2050 xdr_void [2] 2051 clnt_spcreateerror [1] svcerr_decode [2] xdr_callhdr [2] 2052 xdr_reference [2] xdr_wrapstring [2] 2053 clnt_sperrno [1] svcerr_noproc [2] xdr_callmsg [2] 2054 xdr_rejected_reply [2] xdrmem_create [2] 2055 clnt_sperror [1] svcerr_noprog [2] xdr_char [2] xdr_replymsg 2056 [2] xdrrec_create [2] 2057 key_decryptsession [2] svcerr_progvers [2] xdr_double [2] 2058 xdr_short [2] xdrrec_eof [2] 2059 pmap_getport [3] svcerr_systemerr [2] xdr_enum [2] xdr_string 2060 [2] 2061 pmap_set [3] svcerr_weakauth [2] xdr_float [2] xdr_u_char [2] 2062 2063 pmap_unset [3] svctcp_create [3] xdr_free [2] xdr_u_int [3] 2064 2065 Referenced Specification(s) 2066 2067 [1]. SVID Issue 4 2068 2069 [2]. SVID Issue 3 2070 2071 [3]. this specification 2072 _________________________________________________________ 2073 2074 1.3.2. System Calls 2075 _________________________________________________________ 2076 2077 1.3.2.1. Interfaces for System Calls 2078 2079 An LSB conforming implementation shall provide the generic 2080 functions for System Calls specified in Table 1-3, with the 2081 full mandatory functionality as described in the referenced 2082 underlying specification. 2083 2084 Table 1-3. libc - System Calls Function Interfaces 2085 __fxstat [1] fchmod [2] getwd [2] read [2] setrlimit [2] 2086 __getpgid [1] fchown [2] initgroups [1] readdir [2] 2087 setrlimit64 [3] 2088 __lxstat [1] fcntl [1] ioctl [1] readdir_r [2] setsid [2] 2089 __xmknod [1] fdatasync [2] kill [1] readlink [2] setuid [2] 2090 __xstat [1] flock [1] killpg [2] readv [2] sleep [2] 2091 access [2] fork [2] lchown [2] rename [2] statvfs [2] 2092 acct [1] fstatvfs [2] link [1] rmdir [2] stime [1] 2093 alarm [2] fsync [2] lockf [2] sbrk [4] symlink [2] 2094 brk [4] ftime [2] lseek [2] sched_get_priority_max [2] sync 2095 [2] 2096 chdir [2] ftruncate [2] mkdir [2] sched_get_priority_min [2] 2097 sysconf [2] 2098 chmod [2] getcontext [2] mkfifo [2] sched_getparam [2] time 2099 [2] 2100 chown [2] getegid [2] mlock [2] sched_getscheduler [2] times 2101 [2] 2102 chroot [4] geteuid [2] mlockall [2] sched_rr_get_interval [2] 2103 truncate [2] 2104 clock [2] getgid [2] mmap [2] sched_setparam [2] ulimit [2] 2105 close [2] getgroups [2] mprotect [2] sched_setscheduler [2] 2106 umask [2] 2107 closedir [2] getitimer [2] msync [2] sched_yield [2] uname [2] 2108 creat [2] getloadavg [1] munlock [2] select [2] unlink [1] 2109 dup [2] getpagesize [4] munlockall [2] setcontext [2] utime 2110 [2] 2111 dup2 [2] getpgid [2] munmap [2] setegid [2] utimes [2] 2112 execl [2] getpgrp [2] nanosleep [2] seteuid [2] vfork [2] 2113 execle [2] getpid [2] nice [2] setgid [2] wait [2] 2114 execlp [2] getppid [2] open [2] setitimer [2] wait4 [1] 2115 execv [2] getpriority [2] opendir [2] setpgid [2] waitpid [1] 2116 execve [2] getrlimit [2] pathconf [2] setpgrp [2] write [2] 2117 execvp [2] getrusage [2] pause [2] setpriority [2] writev [2] 2118 exit [2] getsid [2] pipe [2] setregid [2] 2119 fchdir [2] getuid [2] poll [2] setreuid [2] 2120 2121 Referenced Specification(s) 2122 2123 [1]. this specification 2124 2125 [2]. ISO POSIX (2003) 2126 2127 [3]. Large File Support 2128 2129 [4]. SUSv2 2130 _________________________________________________________ 2131 2132 1.3.3. Standard I/O 2133 _________________________________________________________ 2134 2135 1.3.3.1. Interfaces for Standard I/O 2136 2137 An LSB conforming implementation shall provide the generic 2138 functions for Standard I/O specified in Table 1-4, with the 2139 full mandatory functionality as described in the referenced 2140 underlying specification. 2141 2142 Table 1-4. libc - Standard I/O Function Interfaces 2143 _IO_feof [1] fgetpos [2] fsetpos [2] putchar [2] sscanf [1] 2144 _IO_getc [1] fgets [2] ftell [2] putchar_unlocked [2] telldir 2145 [2] 2146 _IO_putc [1] fgetwc_unlocked [1] ftello [2] puts [2] tempnam 2147 [2] 2148 _IO_puts [1] fileno [2] fwrite [2] putw [3] ungetc [2] 2149 asprintf [1] flockfile [2] getc [2] remove [2] vasprintf [1] 2150 clearerr [2] fopen [2] getc_unlocked [2] rewind [2] vdprintf 2151 [1] 2152 ctermid [2] fprintf [2] getchar [2] rewinddir [2] vfprintf [2] 2153 fclose [2] fputc [2] getchar_unlocked [2] scanf [1] vprintf 2154 [2] 2155 fdopen [2] fputs [2] getw [3] seekdir [2] vsnprintf [2] 2156 feof [2] fread [2] pclose [2] setbuf [2] vsprintf [2] 2157 ferror [2] freopen [2] popen [2] setbuffer [1] 2158 fflush [2] fscanf [1] printf [2] setvbuf [2] 2159 fflush_unlocked [1] fseek [2] putc [2] snprintf [2] 2160 fgetc [2] fseeko [2] putc_unlocked [2] sprintf [2] 2161 2162 Referenced Specification(s) 2163 2164 [1]. this specification 2165 2166 [2]. ISO POSIX (2003) 2167 2168 [3]. SUSv2 2169 2170 An LSB conforming implementation shall provide the generic 2171 data interfaces for Standard I/O specified in Table 1-5, with 2172 the full mandatory functionality as described in the 2173 referenced underlying specification. 2174 2175 Table 1-5. libc - Standard I/O Data Interfaces 2176 stderr [1] stdin [1] stdout [1] 2177 2178 Referenced Specification(s) 2179 2180 [1]. ISO POSIX (2003) 2181 _________________________________________________________ 2182 2183 1.3.4. Signal Handling 2184 _________________________________________________________ 2185 2186 1.3.4.1. Interfaces for Signal Handling 2187 2188 An LSB conforming implementation shall provide the generic 2189 functions for Signal Handling specified in Table 1-6, with the 2190 full mandatory functionality as described in the referenced 2191 underlying specification. 2192 2193 Table 1-6. libc - Signal Handling Function Interfaces 2194 __libc_current_sigrtmax [1] sigaction [2] sighold [2] sigorset 2195 [1] sigset [2] 2196 __libc_current_sigrtmin [1] sigaddset [2] sigignore [2] 2197 sigpause [2] sigsuspend [2] 2198 __sigsetjmp [1] sigaltstack [2] siginterrupt [2] sigpending 2199 [2] sigtimedwait [2] 2200 __sysv_signal [1] sigandset [1] sigisemptyset [1] sigprocmask 2201 [2] sigwait [2] 2202 bsd_signal [2] sigdelset [2] sigismember [2] sigqueue [2] 2203 sigwaitinfo [2] 2204 psignal [1] sigemptyset [2] siglongjmp [2] sigrelse [2] 2205 raise [2] sigfillset [2] signal [2] sigreturn [1] 2206 2207 Referenced Specification(s) 2208 2209 [1]. this specification 2210 2211 [2]. ISO POSIX (2003) 2212 2213 An LSB conforming implementation shall provide the generic 2214 data interfaces for Signal Handling specified in Table 1-7, 2215 with the full mandatory functionality as described in the 2216 referenced underlying specification. 2217 2218 Table 1-7. libc - Signal Handling Data Interfaces 2219 _sys_siglist [1] 2220 2221 Referenced Specification(s) 2222 2223 [1]. this specification 2224 _________________________________________________________ 2225 2226 1.3.5. Localization Functions 2227 _________________________________________________________ 2228 2229 1.3.5.1. Interfaces for Localization Functions 2230 2231 An LSB conforming implementation shall provide the generic 2232 functions for Localization Functions specified in Table 1-8, 2233 with the full mandatory functionality as described in the 2234 referenced underlying specification. 2235 2236 Table 1-8. libc - Localization Functions Function Interfaces 2237 bind_textdomain_codeset [1] dcgettext [1] 2238 freelocale(GLIBC_2.3) [1] localeconv [2] textdomain [1] 2239 bindtextdomain [1] dcngettext [1] gettext [1] 2240 newlocale(GLIBC_2.3) [1] uselocale(GLIBC_2.3) [1] 2241 catclose [2] dgettext [1] iconv [2] ngettext [1] 2242 catgets [2] dngettext [1] iconv_close [2] nl_langinfo [2] 2243 catopen [2] duplocale(GLIBC_2.3) [1] iconv_open [2] setlocale 2244 [2] 2245 2246 Referenced Specification(s) 2247 2248 [1]. this specification 2249 2250 [2]. ISO POSIX (2003) 2251 2252 An LSB conforming implementation shall provide the generic 2253 data interfaces for Localization Functions specified in Table 2254 1-9, with the full mandatory functionality as described in the 2255 referenced underlying specification. 2256 2257 Table 1-9. libc - Localization Functions Data Interfaces 2258 _nl_msg_cat_cntr [1] 2259 2260 Referenced Specification(s) 2261 2262 [1]. this specification 2263 _________________________________________________________ 2264 2265 1.3.6. Socket Interface 2266 _________________________________________________________ 2267 2268 1.3.6.1. Interfaces for Socket Interface 2269 2270 An LSB conforming implementation shall provide the generic 2271 functions for Socket Interface specified in Table 1-10, with 2272 the full mandatory functionality as described in the 2273 referenced underlying specification. 2274 2275 Table 1-10. libc - Socket Interface Function Interfaces 2276 __h_errno_location [1] gethostname [2] if_nameindex [2] send 2277 [2] socket [2] 2278 accept [2] getpeername [2] if_nametoindex [2] sendmsg [2] 2279 socketpair [2] 2280 bind [2] getsockname [2] listen [2] sendto [2] 2281 bindresvport [1] getsockopt [1] recv [2] setsockopt [1] 2282 connect [2] if_freenameindex [2] recvfrom [2] shutdown [2] 2283 gethostid [2] if_indextoname [2] recvmsg [2] sockatmark [2] 2284 2285 Referenced Specification(s) 2286 2287 [1]. this specification 2288 2289 [2]. ISO POSIX (2003) 2290 _________________________________________________________ 2291 2292 1.3.7. Wide Characters 2293 _________________________________________________________ 2294 2295 1.3.7.1. Interfaces for Wide Characters 2296 2297 An LSB conforming implementation shall provide the generic 2298 functions for Wide Characters specified in Table 1-11, with 2299 the full mandatory functionality as described in the 2300 referenced underlying specification. 2301 2302 Table 1-11. libc - Wide Characters Function Interfaces 2303 __wcstod_internal [1] mbsinit [2] vwscanf [1] wcsnlen [1] 2304 wcstoumax [2] 2305 __wcstof_internal [1] mbsnrtowcs [1] wcpcpy [1] wcsnrtombs [1] 2306 wcstouq [1] 2307 __wcstol_internal [1] mbsrtowcs [2] wcpncpy [1] wcspbrk [2] 2308 wcswcs [2] 2309 __wcstold_internal [1] mbstowcs [2] wcrtomb [2] wcsrchr [2] 2310 wcswidth [2] 2311 __wcstoul_internal [1] mbtowc [2] wcscasecmp [1] wcsrtombs [2] 2312 wcsxfrm [2] 2313 btowc [2] putwc [2] wcscat [2] wcsspn [2] wctob [2] 2314 fgetwc [2] putwchar [2] wcschr [2] wcsstr [2] wctomb [2] 2315 fgetws [2] swprintf [2] wcscmp [2] wcstod [2] wctrans [2] 2316 fputwc [2] swscanf [1] wcscoll [2] wcstof [2] wctype [2] 2317 fputws [2] towctrans [2] wcscpy [2] wcstoimax [2] wcwidth [2] 2318 fwide [2] towlower [2] wcscspn [2] wcstok [2] wmemchr [2] 2319 fwprintf [2] towupper [2] wcsdup [1] wcstol [2] wmemcmp [2] 2320 fwscanf [1] ungetwc [2] wcsftime [2] wcstold [2] wmemcpy [2] 2321 getwc [2] vfwprintf [2] wcslen [2] wcstoll [2] wmemmove [2] 2322 getwchar [2] vfwscanf [1] wcsncasecmp [1] wcstombs [2] wmemset 2323 [2] 2324 mblen [2] vswprintf [2] wcsncat [2] wcstoq [1] wprintf [2] 2325 mbrlen [2] vswscanf [1] wcsncmp [2] wcstoul [2] wscanf [1] 2326 mbrtowc [2] vwprintf [2] wcsncpy [2] wcstoull [2] 2327 2328 Referenced Specification(s) 2329 2330 [1]. this specification 2331 2332 [2]. ISO POSIX (2003) 2333 _________________________________________________________ 2334 2335 1.3.8. String Functions 2336 _________________________________________________________ 2337 2338 1.3.8.1. Interfaces for String Functions 2339 2340 An LSB conforming implementation shall provide the generic 2341 functions for String Functions specified in Table 1-12, with 2342 the full mandatory functionality as described in the 2343 referenced underlying specification. 2344 2345 Table 1-12. libc - String Functions Function Interfaces 2346 __mempcpy [1] bzero [2] strcasestr [1] strncat [2] strtok [2] 2347 __rawmemchr [1] ffs [2] strcat [2] strncmp [2] strtok_r [2] 2348 __stpcpy [1] index [2] strchr [2] strncpy [2] strtold [2] 2349 __strdup [1] memccpy [2] strcmp [2] strndup [1] strtoll [2] 2350 __strtod_internal [1] memchr [2] strcoll [2] strnlen [1] 2351 strtoq [1] 2352 __strtof_internal [1] memcmp [2] strcpy [2] strpbrk [2] 2353 strtoull [2] 2354 __strtok_r [1] memcpy [2] strcspn [2] strptime [1] strtoumax 2355 [2] 2356 __strtol_internal [1] memmove [2] strdup [2] strrchr [2] 2357 strtouq [1] 2358 __strtold_internal [1] memrchr [1] strerror [2] strsep [1] 2359 strxfrm [2] 2360 __strtoll_internal [1] memset [2] strerror_r [1] strsignal [1] 2361 swab [2] 2362 __strtoul_internal [1] rindex [2] strfmon [2] strspn [2] 2363 __strtoull_internal [1] stpcpy [1] strftime [2] strstr [2] 2364 bcmp [2] stpncpy [1] strlen [2] strtof [2] 2365 bcopy [2] strcasecmp [2] strncasecmp [2] strtoimax [2] 2366 2367 Referenced Specification(s) 2368 2369 [1]. this specification 2370 2371 [2]. ISO POSIX (2003) 2372 _________________________________________________________ 2373 2374 1.3.9. IPC Functions 2375 _________________________________________________________ 2376 2377 1.3.9.1. Interfaces for IPC Functions 2378 2379 An LSB conforming implementation shall provide the generic 2380 functions for IPC Functions specified in Table 1-13, with the 2381 full mandatory functionality as described in the referenced 2382 underlying specification. 2383 2384 Table 1-13. libc - IPC Functions Function Interfaces 2385 ftok [1] msgrcv [1] semget [1] shmctl [1] 2386 msgctl [1] msgsnd [1] semop [1] shmdt [1] 2387 msgget [1] semctl [1] shmat [1] shmget [1] 2388 2389 Referenced Specification(s) 2390 2391 [1]. ISO POSIX (2003) 2392 _________________________________________________________ 2393 2394 1.3.10. Regular Expressions 2395 _________________________________________________________ 2396 2397 1.3.10.1. Interfaces for Regular Expressions 2398 2399 An LSB conforming implementation shall provide the generic 2400 functions for Regular Expressions specified in Table 1-14, 2401 with the full mandatory functionality as described in the 2402 referenced underlying specification. 2403 2404 Table 1-14. libc - Regular Expressions Function Interfaces 2405 regcomp [1] regerror [1] regexec [2] regfree [1] 2406 2407 Referenced Specification(s) 2408 2409 [1]. ISO POSIX (2003) 2410 2411 [2]. this specification 2412 _________________________________________________________ 2413 2414 1.3.11. Character Type Functions 2415 _________________________________________________________ 2416 2417 1.3.11.1. Interfaces for Character Type Functions 2418 2419 An LSB conforming implementation shall provide the generic 2420 functions for Character Type Functions specified in Table 2421 1-15, with the full mandatory functionality as described in 2422 the referenced underlying specification. 2423 2424 Table 1-15. libc - Character Type Functions Function 2425 Interfaces 2426 __ctype_b_loc(GLIBC_2.3) [1] isalpha [2] ispunct [2] iswctype 2427 [2] iswupper [2] 2428 __ctype_get_mb_cur_max [1] isascii [2] isspace [2] iswdigit 2429 [2] iswxdigit [2] 2430 __ctype_tolower_loc(GLIBC_2.3) [1] iscntrl [2] isupper [2] 2431 iswgraph [2] isxdigit [2] 2432 __ctype_toupper_loc(GLIBC_2.3) [1] isdigit [2] iswalnum [2] 2433 iswlower [2] toascii [2] 2434 _tolower [2] isgraph [2] iswalpha [2] iswprint [2] tolower [2] 2435 _toupper [2] islower [2] iswblank [2] iswpunct [2] toupper [2] 2436 isalnum [2] isprint [2] iswcntrl [2] iswspace [2] 2437 2438 Referenced Specification(s) 2439 2440 [1]. this specification 2441 2442 [2]. ISO POSIX (2003) 2443 _________________________________________________________ 2444 2445 1.3.12. Time Manipulation 2446 _________________________________________________________ 2447 2448 1.3.12.1. Interfaces for Time Manipulation 2449 2450 An LSB conforming implementation shall provide the generic 2451 functions for Time Manipulation specified in Table 1-16, with 2452 the full mandatory functionality as described in the 2453 referenced underlying specification. 2454 2455 Table 1-16. libc - Time Manipulation Function Interfaces 2456 adjtime [1] ctime [2] gmtime [2] localtime_r [2] ualarm [2] 2457 asctime [2] ctime_r [2] gmtime_r [2] mktime [2] 2458 asctime_r [2] difftime [2] localtime [2] tzset [2] 2459 2460 Referenced Specification(s) 2461 2462 [1]. this specification 2463 2464 [2]. ISO POSIX (2003) 2465 2466 An LSB conforming implementation shall provide the generic 2467 data interfaces for Time Manipulation specified in Table 1-17, 2468 with the full mandatory functionality as described in the 2469 referenced underlying specification. 2470 2471 Table 1-17. libc - Time Manipulation Data Interfaces 2472 __daylight [1] __tzname [1] timezone [2] 2473 __timezone [1] daylight [2] tzname [2] 2474 2475 Referenced Specification(s) 2476 2477 [1]. this specification 2478 2479 [2]. ISO POSIX (2003) 2480 _________________________________________________________ 2481 2482 1.3.13. Terminal Interface Functions 2483 _________________________________________________________ 2484 2485 1.3.13.1. Interfaces for Terminal Interface Functions 2486 2487 An LSB conforming implementation shall provide the generic 2488 functions for Terminal Interface Functions specified in Table 2489 1-18, with the full mandatory functionality as described in 2490 the referenced underlying specification. 2491 2492 Table 1-18. libc - Terminal Interface Functions Function 2493 Interfaces 2494 cfgetispeed [1] cfsetispeed [1] tcdrain [1] tcgetattr [1] 2495 tcsendbreak [1] 2496 cfgetospeed [1] cfsetospeed [1] tcflow [1] tcgetpgrp [1] 2497 tcsetattr [1] 2498 cfmakeraw [2] cfsetspeed [2] tcflush [1] tcgetsid [1] 2499 tcsetpgrp [1] 2500 2501 Referenced Specification(s) 2502 2503 [1]. ISO POSIX (2003) 2504 2505 [2]. this specification 2506 _________________________________________________________ 2507 2508 1.3.14. System Database Interface 2509 _________________________________________________________ 2510 2511 1.3.14.1. Interfaces for System Database Interface 2512 2513 An LSB conforming implementation shall provide the generic 2514 functions for System Database Interface specified in Table 2515 1-19, with the full mandatory functionality as described in 2516 the referenced underlying specification. 2517 2518 Table 1-19. libc - System Database Interface Function 2519 Interfaces 2520 endgrent [1] getgrgid_r [1] getprotoent [1] getservent [1] 2521 setgroups [2] 2522 endprotoent [1] getgrnam [1] getpwent [1] getutent [2] 2523 setprotoent [1] 2524 endpwent [1] getgrnam_r [1] getpwnam [1] getutent_r [2] 2525 setpwent [1] 2526 endservent [1] getgrouplist [2] getpwnam_r [1] getutxent [1] 2527 setservent [1] 2528 endutent [3] gethostbyaddr [1] getpwuid [1] getutxid [1] 2529 setutent [2] 2530 endutxent [1] gethostbyname [1] getpwuid_r [1] getutxline [1] 2531 setutxent [1] 2532 getgrent [1] getprotobyname [1] getservbyname [1] pututxline 2533 [1] utmpname [2] 2534 getgrgid [1] getprotobynumber [1] getservbyport [1] setgrent 2535 [1] 2536 2537 Referenced Specification(s) 2538 2539 [1]. ISO POSIX (2003) 2540 2541 [2]. this specification 2542 2543 [3]. SUSv2 2544 _________________________________________________________ 2545 2546 1.3.15. Language Support 2547 _________________________________________________________ 2548 2549 1.3.15.1. Interfaces for Language Support 2550 2551 An LSB conforming implementation shall provide the generic 2552 functions for Language Support specified in Table 1-20, with 2553 the full mandatory functionality as described in the 2554 referenced underlying specification. 2555 2556 Table 1-20. libc - Language Support Function Interfaces 2557 __libc_start_main [1] __register_atfork(GLIBC_2.3.2) [1] 2558 2559 Referenced Specification(s) 2560 2561 [1]. this specification 2562 _________________________________________________________ 2563 2564 1.3.16. Large File Support 2565 _________________________________________________________ 2566 2567 1.3.16.1. Interfaces for Large File Support 2568 2569 An LSB conforming implementation shall provide the generic 2570 functions for Large File Support specified in Table 1-21, with 2571 the full mandatory functionality as described in the 2572 referenced underlying specification. 2573 2574 Table 1-21. libc - Large File Support Function Interfaces 2575 __fxstat64 [1] fopen64 [2] ftello64 [2] lseek64 [2] readdir64 2576 [2] 2577 __lxstat64 [1] freopen64 [2] ftruncate64 [2] mkstemp64 [2] 2578 statvfs64 [2] 2579 __xstat64 [1] fseeko64 [2] ftw64 [2] mmap64 [2] tmpfile64 [2] 2580 creat64 [2] fsetpos64 [2] getrlimit64 [2] nftw64 [2] 2581 truncate64 [2] 2582 fgetpos64 [2] fstatvfs64 [2] lockf64 [2] open64 [2] 2583 2584 Referenced Specification(s) 2585 2586 [1]. this specification 2587 2588 [2]. Large File Support 2589 _________________________________________________________ 2590 2591 1.3.17. Standard Library 2592 _________________________________________________________ 2593 2594 1.3.17.1. Interfaces for Standard Library 2595 2596 An LSB conforming implementation shall provide the generic 2597 functions for Standard Library specified in Table 1-22, with 2598 the full mandatory functionality as described in the 2599 referenced underlying specification. 2600 2601 Table 1-22. libc - Standard Library Function Interfaces 2602 _Exit [1] dirname [1] glob [1] lsearch [1] srand48 [1] 2603 __assert_fail [2] div [1] glob64 [2] makecontext [1] srandom 2604 [1] 2605 __cxa_atexit [2] drand48 [1] globfree [1] malloc [1] strtod 2606 [1] 2607 __errno_location [2] ecvt [1] globfree64 [2] memmem [2] strtol 2608 [1] 2609 __fpending [2] erand48 [1] grantpt [1] mkstemp [1] strtoul [1] 2610 __getpagesize [2] err [2] hcreate [1] mktemp [1] swapcontext 2611 [1] 2612 __isinf [2] error [2] hdestroy [1] mrand48 [1] syslog [1] 2613 __isinff [2] errx [2] hsearch [1] nftw [1] system [2] 2614 __isinfl [2] fcvt [1] htonl [1] nrand48 [1] tdelete [1] 2615 __isnan [2] fmtmsg [1] htons [1] ntohl [1] tfind [1] 2616 __isnanf [2] fnmatch [1] imaxabs [1] ntohs [1] tmpfile [1] 2617 __isnanl [2] fpathconf [1] imaxdiv [1] openlog [1] tmpnam [1] 2618 __sysconf [2] free [1] inet_addr [1] perror [1] tsearch [1] 2619 _exit [1] freeaddrinfo [1] inet_ntoa [1] posix_memalign [1] 2620 ttyname [1] 2621 _longjmp [1] ftrylockfile [1] inet_ntop [1] posix_openpt [1] 2622 ttyname_r [1] 2623 _setjmp [1] ftw [1] inet_pton [1] ptsname [1] twalk [1] 2624 a64l [1] funlockfile [1] initstate [1] putenv [1] unlockpt [1] 2625 abort [1] gai_strerror [1] insque [1] qsort [1] unsetenv [1] 2626 abs [1] gcvt [1] isatty [1] rand [1] usleep [1] 2627 atof [1] getaddrinfo [1] isblank [1] rand_r [1] verrx [2] 2628 atoi [1] getcwd [1] jrand48 [1] random [1] vfscanf [2] 2629 atol [1] getdate [1] l64a [1] realloc [1] vscanf [2] 2630 atoll [1] getenv [1] labs [1] realpath [1] vsscanf [2] 2631 basename [1] getlogin [1] lcong48 [1] remque [1] vsyslog [2] 2632 bsearch [1] getnameinfo [1] ldiv [1] seed48 [1] warn [2] 2633 calloc [1] getopt [2] lfind [1] setenv [1] warnx [2] 2634 closelog [1] getopt_long [2] llabs [1] sethostname [2] wordexp 2635 [1] 2636 confstr [1] getopt_long_only [2] lldiv [1] setlogmask [1] 2637 wordfree [1] 2638 cuserid [3] getsubopt [1] longjmp [1] setstate [1] 2639 daemon [2] gettimeofday [1] lrand48 [1] srand [1] 2640 2641 Referenced Specification(s) 2642 2643 [1]. ISO POSIX (2003) 2644 2645 [2]. this specification 2646 2647 [3]. SUSv2 2648 2649 An LSB conforming implementation shall provide the generic 2650 data interfaces for Standard Library specified in Table 1-23, 2651 with the full mandatory functionality as described in the 2652 referenced underlying specification. 2653 2654 Table 1-23. libc - Standard Library Data Interfaces 2655 __environ [1] _sys_errlist [1] getdate_err [2] opterr [2] 2656 optopt [2] 2657 _environ [1] environ [2] optarg [2] optind [2] 2658 2659 Referenced Specification(s) 2660 2661 [1]. this specification 2662 2663 [2]. ISO POSIX (2003) 2664 _________________________________________________________ 2665 2666 1.4. Data Definitions for libc 2667 2668 This section defines global identifiers and their values that 2669 are associated with interfaces contained in libc. These 2670 definitions are organized into groups that correspond to 2671 system headers. This convention is used as a convenience for 2672 the reader, and does not imply the existence of these headers, 2673 or their content. 2674 2675 These definitions are intended to supplement those provided in 2676 the referenced underlying specifications. 2677 2678 This specification uses ISO/IEC 9899 C Language as the 2679 reference programming language, and data definitions are 2680 specified in ISO C format. The C language is used here as a 2681 convenient notation. Using a C language description of these 2682 data objects does not preclude their use by other programming 2683 languages. 2684 _________________________________________________________ 2685 2686 1.4.1. ctype.h 2687 2688 enum 2689 { 2690 _ISupper, _ISlower, _ISalpha, _ISdigit, _ISxdigit, _ISspace, _ISprint 2691 , 2692 _ISgraph, _ISblank, _IScntrl, _ISpunct, _ISalnum 2693 } 2694 ; 2695 _________________________________________________________ 2696 2697 1.4.2. dirent.h 2698 2699 typedef struct __dirstream DIR; 2700 2701 struct dirent 2702 { 2703 long int d_ino; 2704 off_t d_off; 2705 unsigned short d_reclen; 2706 unsigned char d_type; 2707 char d_name[256]; 2708 } 2709 ; 2710 struct dirent64 2711 { 2712 uint64_t d_ino; 2713 int64_t d_off; 2714 unsigned short d_reclen; 2715 unsigned char d_type; 2716 char d_name[256]; 2717 } 2718 ; 2719 _________________________________________________________ 2720 2721 1.4.3. errno.h 2722 2723 ISO POSIX (2003) requires that each error value shall be 2724 unique, with permission for EAGAIN and EWOULDBLOCK possibly 2725 having the same value. This specification also requires that 2726 ENOTSUP and EOPNOTSUPP have the same value. 2727 2728 Note: A defect report against ISO POSIX (2003) has been 2729 filed to request that specification also permit these two 2730 symbols to have the same value. 2731 2732 #define errno (*__errno_location()) 2733 2734 #define EPERM 1 2735 #define ECHILD 10 2736 #define ENETDOWN 100 2737 #define ENETUNREACH 101 2738 #define ENETRESET 102 2739 #define ECONNABORTED 103 2740 #define ECONNRESET 104 2741 #define ENOBUFS 105 2742 #define EISCONN 106 2743 #define ENOTCONN 107 2744 #define ESHUTDOWN 108 2745 #define ETOOMANYREFS 109 2746 #define EAGAIN 11 2747 #define ETIMEDOUT 110 2748 #define ECONNREFUSED 111 2749 #define EHOSTDOWN 112 2750 #define EHOSTUNREACH 113 2751 #define EALREADY 114 2752 #define EINPROGRESS 115 2753 #define ESTALE 116 2754 #define EUCLEAN 117 2755 #define ENOTNAM 118 2756 #define ENAVAIL 119 2757 #define ENOMEM 12 2758 #define EISNAM 120 2759 #define EREMOTEIO 121 2760 #define EDQUOT 122 2761 #define ENOMEDIUM 123 2762 #define EMEDIUMTYPE 124 2763 #define ECANCELED 125 2764 #define EACCES 13 2765 #define EFAULT 14 2766 #define ENOTBLK 15 2767 #define EBUSY 16 2768 #define EEXIST 17 2769 #define EXDEV 18 2770 #define ENODEV 19 2771 #define ENOENT 2 2772 #define ENOTDIR 20 2773 #define EISDIR 21 2774 #define EINVAL 22 2775 #define ENFILE 23 2776 #define EMFILE 24 2777 #define ENOTTY 25 2778 #define ETXTBSY 26 2779 #define EFBIG 27 2780 #define ENOSPC 28 2781 #define ESPIPE 29 2782 #define ESRCH 3 2783 #define EROFS 30 2784 #define EMLINK 31 2785 #define EPIPE 32 2786 #define EDOM 33 2787 #define ERANGE 34 2788 #define EDEADLK 35 2789 #define ENAMETOOLONG 36 2790 #define ENOLCK 37 2791 #define ENOSYS 38 2792 #define ENOTEMPTY 39 2793 #define EINTR 4 2794 #define ELOOP 40 2795 #define ENOMSG 42 2796 #define EIDRM 43 2797 #define ECHRNG 44 2798 #define EL2NSYNC 45 2799 #define EL3HLT 46 2800 #define EL3RST 47 2801 #define ELNRNG 48 2802 #define EUNATCH 49 2803 #define EIO 5 2804 #define ENOANO 55 2805 #define EBADRQC 56 2806 #define EBADSLT 57 2807 #define EBFONT 59 2808 #define ENXIO 6 2809 #define ENOSTR 60 2810 #define ENODATA 61 2811 #define ETIME 62 2812 #define ENOSR 63 2813 #define ENONET 64 2814 #define ENOPKG 65 2815 #define EREMOTE 66 2816 #define ENOLINK 67 2817 #define EADV 68 2818 #define ESRMNT 69 2819 #define E2BIG 7 2820 #define ECOMM 70 2821 #define EPROTO 71 2822 #define EMULTIHOP 72 2823 #define EDOTDOT 73 2824 #define EBADMSG 74 2825 #define EOVERFLOW 75 2826 #define ENOTUNIQ 76 2827 #define EBADFD 77 2828 #define EREMCHG 78 2829 #define ELIBACC 79 2830 #define ENOEXEC 8 2831 #define ELIBBAD 80 2832 #define ELIBSCN 81 2833 #define ELIBMAX 82 2834 #define ELIBEXEC 83 2835 #define EILSEQ 84 2836 #define ERESTART 85 2837 #define ESTRPIPE 86 2838 #define EUSERS 87 2839 #define ENOTSOCK 88 2840 #define EDESTADDRREQ 89 2841 #define EBADF 9 2842 #define EMSGSIZE 90 2843 #define EPROTOTYPE 91 2844 #define ENOPROTOOPT 92 2845 #define EPROTONOSUPPORT 93 2846 #define ESOCKTNOSUPPORT 94 2847 #define EOPNOTSUPP 95 2848 #define EPFNOSUPPORT 96 2849 #define EAFNOSUPPORT 97 2850 #define EADDRINUSE 98 2851 #define EADDRNOTAVAIL 99 2852 #define EWOULDBLOCK EAGAIN 2853 #define ENOTSUP EOPNOTSUPP 2854 _________________________________________________________ 2855 2856 1.4.4. fcntl.h 2857 2858 #define O_RDONLY 00 2859 #define O_ACCMODE 0003 2860 #define O_WRONLY 01 2861 #define O_CREAT 0100 2862 #define O_TRUNC 01000 2863 #define O_SYNC 010000 2864 #define O_RDWR 02 2865 #define O_EXCL 0200 2866 #define O_APPEND 02000 2867 #define O_ASYNC 020000 2868 #define O_NOCTTY 0400 2869 #define O_NDELAY 04000 2870 #define O_NONBLOCK 04000 2871 #define FD_CLOEXEC 1 2872 2873 struct flock 2874 { 2875 short l_type; 2876 short l_whence; 2877 off_t l_start; 2878 off_t l_len; 2879 pid_t l_pid; 2880 } 2881 ; 2882 struct flock64 2883 { 2884 short l_type; 2885 short l_whence; 2886 loff_t l_start; 2887 loff_t l_len; 2888 pid_t l_pid; 2889 } 2890 ; 2891 2892 #define F_DUPFD 0 2893 #define F_RDLCK 0 2894 #define F_GETFD 1 2895 #define F_WRLCK 1 2896 #define F_SETFD 2 2897 #define F_UNLCK 2 2898 #define F_GETFL 3 2899 #define F_SETFL 4 2900 #define F_GETLK 5 2901 #define F_SETLK 6 2902 #define F_SETLKW 7 2903 #define F_SETOWN 8 2904 #define F_GETOWN 9 2905 _________________________________________________________ 2906 2907 1.4.5. fmtmsg.h 2908 2909 #define MM_HARD 1 2910 #define MM_NRECOV 128 2911 #define MM_UTIL 16 2912 #define MM_SOFT 2 2913 #define MM_OPSYS 32 2914 #define MM_FIRM 4 2915 #define MM_RECOVER 64 2916 #define MM_APPL 8 2917 2918 #define MM_NOSEV 0 2919 #define MM_HALT 1 2920 #define MM_ERROR 2 2921 2922 #define MM_NULLLBL ((char *) 0) 2923 _________________________________________________________ 2924 2925 1.4.6. fnmatch.h 2926 2927 #define FNM_PATHNAME (1<<0) 2928 #define FNM_NOESCAPE (1<<1) 2929 #define FNM_PERIOD (1<<2) 2930 #define FNM_NOMATCH 1 2931 _________________________________________________________ 2932 2933 1.4.7. ftw.h 2934 2935 #define FTW_D FTW_D 2936 #define FTW_DNR FTW_DNR 2937 #define FTW_DP FTW_DP 2938 #define FTW_F FTW_F 2939 #define FTW_NS FTW_NS 2940 #define FTW_SL FTW_SL 2941 #define FTW_SLN FTW_SLN 2942 2943 enum 2944 { 2945 FTW_F, FTW_D, FTW_DNR, FTW_NS, FTW_SL, FTW_DP, FTW_SLN 2946 } 2947 ; 2948 2949 enum 2950 { 2951 FTW_PHYS, FTW_MOUNT, FTW_CHDIR, FTW_DEPTH 2952 } 2953 ; 2954 2955 struct FTW 2956 { 2957 int base; 2958 int level; 2959 } 2960 ; 2961 2962 typedef int (*__ftw_func_t) (char *__filename, struct stat * __status, 2963 int __flag); 2964 typedef int (*__ftw64_func_t) (char *__filename, struct stat64 * __stat 2965 us, 2966 int __flag); 2967 typedef int (*__nftw_func_t) (char *__filename, struct stat * __status, 2968 int __flag, struct FTW * __info); 2969 typedef int (*__nftw64_func_t) (char *__filename, struct stat64 * __sta 2970 tus, 2971 int __flag, struct FTW * __info); 2972 _________________________________________________________ 2973 2974 1.4.8. getopt.h 2975 2976 #define no_argument 0 2977 #define required_argument 1 2978 #define optional_argument 2 2979 2980 struct option 2981 { 2982 char *name; 2983 int has_arg; 2984 int *flag; 2985 int val; 2986 } 2987 ; 2988 _________________________________________________________ 2989 2990 1.4.9. glob.h 2991 2992 #define GLOB_ERR (1<<0) 2993 #define GLOB_MARK (1<<1) 2994 #define GLOB_BRACE (1<<10) 2995 #define GLOB_NOMAGIC (1<<11) 2996 #define GLOB_TILDE (1<<12) 2997 #define GLOB_ONLYDIR (1<<13) 2998 #define GLOB_TILDE_CHECK (1<<14) 2999 #define GLOB_NOSORT (1<<2) 3000 #define GLOB_DOOFFS (1<<3) 3001 #define GLOB_NOCHECK (1<<4) 3002 #define GLOB_APPEND (1<<5) 3003 #define GLOB_NOESCAPE (1<<6) 3004 #define GLOB_PERIOD (1<<7) 3005 #define GLOB_MAGCHAR (1<<8) 3006 #define GLOB_ALTDIRFUNC (1<<9) 3007 3008 #define GLOB_NOSPACE 1 3009 #define GLOB_ABORTED 2 3010 #define GLOB_NOMATCH 3 3011 #define GLOB_NOSYS 4 3012 3013 typedef struct 3014 { 3015 size_t gl_pathc; 3016 char **gl_pathv; 3017 size_t gl_offs; 3018 int gl_flags; 3019 void (*gl_closedir) (void *); 3020 struct dirent *(*gl_readdir) (void *); 3021 void *(*gl_opendir) (const char *); 3022 int (*gl_lstat) (const char *, struct stat *); 3023 int (*gl_stat) (const char *, struct stat *); 3024 } 3025 glob_t; 3026 3027 typedef struct 3028 { 3029 size_t gl_pathc; 3030 char **gl_pathv; 3031 size_t gl_offs; 3032 int gl_flags; 3033 void (*gl_closedir) (void *); 3034 struct dirent64 *(*gl_readdir64) (void *); 3035 void *(*gl_opendir) (const char *); 3036 int (*gl_lstat) (const char *, struct stat *); 3037 int (*gl_stat) (const char *, struct stat *); 3038 } 3039 glob64_t; 3040 _________________________________________________________ 3041 3042 1.4.10. grp.h 3043 3044 struct group 3045 { 3046 char *gr_name; 3047 char *gr_passwd; 3048 gid_t gr_gid; 3049 char **gr_mem; 3050 } 3051 ; 3052 _________________________________________________________ 3053 3054 1.4.11. iconv.h 3055 3056 typedef void *iconv_t; 3057 _________________________________________________________ 3058 3059 1.4.12. inttypes.h 3060 3061 typedef lldiv_t imaxdiv_t; 3062 typedef unsigned char uint8_t; 3063 typedef unsigned short uint16_t; 3064 typedef unsigned int uint32_t; 3065 _________________________________________________________ 3066 3067 1.4.13. langinfo.h 3068 3069 #define ABDAY_1 0x20000 3070 #define ABDAY_2 0x20001 3071 #define ABDAY_3 0x20002 3072 #define ABDAY_4 0x20003 3073 #define ABDAY_5 0x20004 3074 #define ABDAY_6 0x20005 3075 #define ABDAY_7 0x20006 3076 3077 #define DAY_1 0x20007 3078 #define DAY_2 0x20008 3079 #define DAY_3 0x20009 3080 #define DAY_4 0x2000A 3081 #define DAY_5 0x2000B 3082 #define DAY_6 0x2000C 3083 #define DAY_7 0x2000D 3084 3085 #define ABMON_1 0x2000E 3086 #define ABMON_2 0x2000F 3087 #define ABMON_3 0x20010 3088 #define ABMON_4 0x20011 3089 #define ABMON_5 0x20012 3090 #define ABMON_6 0x20013 3091 #define ABMON_7 0x20014 3092 #define ABMON_8 0x20015 3093 #define ABMON_9 0x20016 3094 #define ABMON_10 0x20017 3095 #define ABMON_11 0x20018 3096 #define ABMON_12 0x20019 3097 3098 #define MON_1 0x2001A 3099 #define MON_2 0x2001B 3100 #define MON_3 0x2001C 3101 #define MON_4 0x2001D 3102 #define MON_5 0x2001E 3103 #define MON_6 0x2001F 3104 #define MON_7 0x20020 3105 #define MON_8 0x20021 3106 #define MON_9 0x20022 3107 #define MON_10 0x20023 3108 #define MON_11 0x20024 3109 #define MON_12 0x20025 3110 3111 #define AM_STR 0x20026 3112 #define PM_STR 0x20027 3113 3114 #define D_T_FMT 0x20028 3115 #define D_FMT 0x20029 3116 #define T_FMT 0x2002A 3117 #define T_FMT_AMPM 0x2002B 3118 3119 #define ERA 0x2002C 3120 #define ERA_D_FMT 0x2002E 3121 #define ALT_DIGITS 0x2002F 3122 #define ERA_D_T_FMT 0x20030 3123 #define ERA_T_FMT 0x20031 3124 3125 #define CODESET 14 3126 3127 #define CRNCYSTR 0x4000F 3128 3129 #define RADIXCHAR 0x10000 3130 #define THOUSEP 0x10001 3131 #define YESEXPR 0x50000 3132 #define NOEXPR 0x50001 3133 #define YESSTR 0x50002 3134 #define NOSTR 0x50003 3135 _________________________________________________________ 3136 3137 1.4.14. limits.h 3138 3139 #define LLONG_MIN (-LLONG_MAX-1LL) 3140 #define ULLONG_MAX 18446744073709551615ULL 3141 #define OPEN_MAX 256 3142 #define PATH_MAX 4096 3143 #define LLONG_MAX 9223372036854775807LL 3144 #define SSIZE_MAX LONG_MAX 3145 3146 #define MB_LEN_MAX 16 3147 3148 #define SCHAR_MIN (-128) 3149 #define SCHAR_MAX 127 3150 #define UCHAR_MAX 255 3151 #define CHAR_BIT 8 3152 3153 #define SHRT_MIN (-32768) 3154 #define SHRT_MAX 32767 3155 #define USHRT_MAX 65535 3156 3157 #define INT_MIN (-INT_MAX-1) 3158 #define INT_MAX 2147483647 3159 #define __INT_MAX__ 2147483647 3160 #define UINT_MAX 4294967295U 3161 3162 #define LONG_MIN (-LONG_MAX-1L) 3163 3164 #define PTHREAD_KEYS_MAX 1024 3165 #define PTHREAD_STACK_MIN 16384 3166 #define PTHREAD_THREADS_MAX 16384 3167 #define PTHREAD_DESTRUCTOR_ITERATIONS 4 3168 _________________________________________________________ 3169 3170 1.4.15. locale.h 3171 3172 struct lconv 3173 { 3174 char *decimal_point; 3175 char *thousands_sep; 3176 char *grouping; 3177 char *int_curr_symbol; 3178 char *currency_symbol; 3179 char *mon_decimal_point; 3180 char *mon_thousands_sep; 3181 char *mon_grouping; 3182 char *positive_sign; 3183 char *negative_sign; 3184 char int_frac_digits; 3185 char frac_digits; 3186 char p_cs_precedes; 3187 char p_sep_by_space; 3188 char n_cs_precedes; 3189 char n_sep_by_space; 3190 char p_sign_posn; 3191 char n_sign_posn; 3192 char int_p_cs_precedes; 3193 char int_p_sep_by_space; 3194 char int_n_cs_precedes; 3195 char int_n_sep_by_space; 3196 char int_p_sign_posn; 3197 char int_n_sign_posn; 3198 } 3199 ; 3200 #define LC_GLOBAL_LOCALE ((locale_t) -1L) 3201 #define LC_CTYPE 0 3202 #define LC_NUMERIC 1 3203 #define LC_TELEPHONE 10 3204 #define LC_MEASUREMENT 11 3205 #define LC_IDENTIFICATION 12 3206 #define LC_TIME 2 3207 #define LC_COLLATE 3 3208 #define LC_MONETARY 4 3209 #define LC_MESSAGES 5 3210 #define LC_ALL 6 3211 #define LC_PAPER 7 3212 #define LC_NAME 8 3213 #define LC_ADDRESS 9 3214 3215 typedef struct __locale_struct 3216 { 3217 struct locale_data *__locales[13]; 3218 const unsigned short *__ctype_b; 3219 const int *__ctype_tolower; 3220 const int *__ctype_toupper; 3221 const char *__names[13]; 3222 } 3223 *__locale_t; 3224 3225 typedef struct __locale_struct *locale_t; 3226 #define LC_ADDRESS_MASK (1 << LC_ADDRESS) 3227 #define LC_COLLATE_MASK (1 << LC_COLLATE) 3228 #define LC_IDENTIFICATION_MASK (1 << LC_IDENTIFICATION) 3229 #define LC_MEASUREMENT_MASK (1 << LC_MEASUREMENT) 3230 #define LC_MESSAGES_MASK (1 << LC_MESSAGES) 3231 #define LC_MONETARY_MASK (1 << LC_MONETARY) 3232 #define LC_NAME_MASK (1 << LC_NAME) 3233 #define LC_NUMERIC_MASK (1 << LC_NUMERIC) 3234 #define LC_PAPER_MASK (1 << LC_PAPER) 3235 #define LC_TELEPHONE_MASK (1 << LC_TELEPHONE) 3236 #define LC_TIME_MASK (1 << LC_TIME) 3237 #define LC_CTYPE_MASK (1<cl_ops->cl_control)(cl,rq,in)) 3655 #define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) 3656 #define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) ((*(rh) 3657 ->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) 3658 #define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) 3659 #define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh 3660 ,xres,resp)) 3661 #define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) 3662 #define NULLPROC ((u_long)0) 3663 #define CLSET_TIMEOUT 1 3664 #define CLGET_XID 10 3665 #define CLSET_XID 11 3666 #define CLGET_VERS 12 3667 #define CLSET_VERS 13 3668 #define CLGET_PROG 14 3669 #define CLSET_PROG 15 3670 #define CLGET_TIMEOUT 2 3671 #define CLGET_SERVER_ADDR 3 3672 #define CLSET_RETRY_TIMEOUT 4 3673 #define CLGET_RETRY_TIMEOUT 5 3674 #define CLGET_FD 6 3675 #define CLGET_SVC_ADDR 7 3676 #define CLSET_FD_CLOSE 8 3677 #define CLSET_FD_NCLOSE 9 3678 3679 enum clnt_stat 3680 { 3681 RPC_SUCCESS, RPC_CANTENCODEARGS = 1, RPC_CANTDECODERES = 2, RPC_CANTS 3682 END = 3683 3, RPC_CANTRECV = 4, RPC_TIMEDOUT = 5, RPC_VERSMISMATCH = 3684 6, RPC_AUTHERROR = 7, RPC_PROGUNAVAIL = 8, RPC_PROGVERSMISMATCH = 3685 9, RPC_PROCUNAVAIL = 10, RPC_CANTDECODEARGS = 11, RPC_SYSTEMERROR = 3686 12, RPC_NOBROADCAST = 21, RPC_UNKNOWNHOST = 13, RPC_UNKNOWNPROTO = 3687 17, RPC_UNKNOWNADDR = 19, RPC_RPCBFAILURE = 14, RPC_PROGNOTREGISTER 3688 ED = 3689 15, RPC_N2AXLATEFAILURE = 22, RPC_FAILED = 16, RPC_INTR = 3690 18, RPC_TLIERROR = 20, RPC_UDERROR = 23, RPC_INPROGRESS = 3691 24, RPC_STALERACHANDLE = 25 3692 } 3693 ; 3694 struct rpc_err 3695 { 3696 enum clnt_stat re_status; 3697 union 3698 { 3699 int RE_errno; 3700 enum auth_stat RE_why; 3701 struct 3702 { 3703 u_long low; 3704 u_long high; 3705 } 3706 RE_vers; 3707 struct 3708 { 3709 long int s1; 3710 long int s2; 3711 } 3712 RE_lb; 3713 } 3714 ru; 3715 } 3716 ; 3717 3718 typedef struct CLIENT 3719 { 3720 struct AUTH *cl_auth; 3721 struct clnt_ops *cl_ops; 3722 caddr_t cl_private; 3723 } 3724 CLIENT; 3725 3726 struct clnt_ops 3727 { 3728 enum clnt_stat (*cl_call) (struct CLIENT *, u_long, xdrproc_t, caddr_ 3729 t, 3730 xdrproc_t, caddr_t, struct timeval); 3731 void (*cl_abort) (void); 3732 void (*cl_geterr) (struct CLIENT *, struct rpc_err *); 3733 bool_t (*cl_freeres) (struct CLIENT *, xdrproc_t, caddr_t); 3734 void (*cl_destroy) (struct CLIENT *); 3735 bool_t (*cl_control) (struct CLIENT *, int, char *); 3736 } 3737 ; 3738 _________________________________________________________ 3739 3740 1.4.28. rpc/rpc_msg.h 3741 3742 enum msg_type 3743 { 3744 CALL, REPLY = 1 3745 } 3746 ; 3747 enum reply_stat 3748 { 3749 MSG_ACCEPTED, MSG_DENIED = 1 3750 } 3751 ; 3752 enum accept_stat 3753 { 3754 SUCCESS, PROG_UNAVAIL = 1, PROG_MISMATCH = 2, PROC_UNAVAIL = 3755 3, GARBAGE_ARGS = 4, SYSTEM_ERR = 5 3756 } 3757 ; 3758 enum reject_stat 3759 { 3760 RPC_MISMATCH, AUTH_ERROR = 1 3761 } 3762 ; 3763 3764 struct accepted_reply 3765 { 3766 struct opaque_auth ar_verf; 3767 enum accept_stat ar_stat; 3768 union 3769 { 3770 struct 3771 { 3772 unsigned long int low; 3773 unsigned long int high; 3774 } 3775 AR_versions; 3776 struct 3777 { 3778 caddr_t where; 3779 xdrproc_t proc; 3780 } 3781 AR_results; 3782 } 3783 ru; 3784 } 3785 ; 3786 3787 struct rejected_reply 3788 { 3789 enum reject_stat rj_stat; 3790 union 3791 { 3792 struct 3793 { 3794 unsigned long int low; 3795 unsigned long int high; 3796 } 3797 RJ_versions; 3798 enum auth_stat RJ_why; 3799 } 3800 ru; 3801 } 3802 ; 3803 3804 struct reply_body 3805 { 3806 enum reply_stat rp_stat; 3807 union 3808 { 3809 struct accepted_reply RP_ar; 3810 struct rejected_reply RP_dr; 3811 } 3812 ru; 3813 } 3814 ; 3815 3816 struct call_body 3817 { 3818 unsigned long int cb_rpcvers; 3819 unsigned long int cb_prog; 3820 unsigned long int cb_vers; 3821 unsigned long int cb_proc; 3822 struct opaque_auth cb_cred; 3823 struct opaque_auth cb_verf; 3824 } 3825 ; 3826 3827 struct rpc_msg 3828 { 3829 unsigned long int rm_xid; 3830 enum msg_type rm_direction; 3831 union 3832 { 3833 struct call_body RM_cmb; 3834 struct reply_body RM_rmb; 3835 } 3836 ru; 3837 } 3838 ; 3839 _________________________________________________________ 3840 3841 1.4.29. rpc/svc.h 3842 3843 #define svc_freeargs(xprt,xargs, argsp) (*(xprt)->xp_ops->xp_freeargs)( 3844 (xprt), (xargs), (argsp)) 3845 #define svc_getargs(xprt,xargs, argsp) (*(xprt)->xp_ops->xp_getargs)(( 3846 xprt), (xargs), (argsp)) 3847 #define RPC_ANYSOCK -1 3848 3849 typedef struct SVCXPRT 3850 { 3851 int xp_sock; 3852 u_short xp_port; 3853 struct xp_ops *xp_ops; 3854 int xp_addrlen; 3855 struct sockaddr_in xp_raddr; 3856 struct opaque_auth xp_verf; 3857 caddr_t xp_p1; 3858 caddr_t xp_p2; 3859 char xp_pad[256]; 3860 } 3861 SVCXPRT; 3862 3863 struct svc_req 3864 { 3865 rpcprog_t rq_prog; 3866 rpcvers_t rq_vers; 3867 rpcproc_t rq_proc; 3868 struct opaque_auth rq_cred; 3869 caddr_t rq_clntcred; 3870 SVCXPRT *rq_xprt; 3871 } 3872 ; 3873 3874 typedef void (*__dispatch_fn_t) (struct svc_req *, SVCXPRT *); 3875 3876 struct xp_ops 3877 { 3878 bool_t (*xp_recv) (SVCXPRT * __xprt, struct rpc_msg * __msg); 3879 enum xprt_stat (*xp_stat) (SVCXPRT * __xprt); 3880 bool_t (*xp_getargs) (SVCXPRT * __xprt, xdrproc_t __xdr_args, 3881 caddr_t args_ptr); 3882 bool_t (*xp_reply) (SVCXPRT * __xprt, struct rpc_msg * __msg); 3883 bool_t (*xp_freeargs) (SVCXPRT * __xprt, xdrproc_t __xdr_args, 3884 caddr_t args_ptr); 3885 void (*xp_destroy) (SVCXPRT * __xprt); 3886 } 3887 ; 3888 _________________________________________________________ 3889 3890 1.4.30. rpc/types.h 3891 3892 typedef int bool_t; 3893 typedef int enum_t; 3894 typedef unsigned long int rpcprog_t; 3895 typedef unsigned long int rpcvers_t; 3896 typedef unsigned long int rpcproc_t; 3897 typedef unsigned long int rpcprot_t; 3898 _________________________________________________________ 3899 3900 1.4.31. rpc/xdr.h 3901 3902 enum xdr_op 3903 { 3904 XDR_ENCODE, XDR_DECODE, XDR_FREE 3905 } 3906 ; 3907 typedef struct XDR 3908 { 3909 enum xdr_op x_op; 3910 struct xdr_ops *x_ops; 3911 caddr_t x_public; 3912 caddr_t x_private; 3913 caddr_t x_base; 3914 int x_handy; 3915 } 3916 XDR; 3917 3918 struct xdr_ops 3919 { 3920 bool_t (*x_getlong) (XDR * __xdrs, long int *__lp); 3921 bool_t (*x_putlong) (XDR * __xdrs, long int *__lp); 3922 bool_t (*x_getbytes) (XDR * __xdrs, caddr_t __addr, u_int __len); 3923 bool_t (*x_putbytes) (XDR * __xdrs, char *__addr, u_int __len); 3924 u_int (*x_getpostn) (XDR * __xdrs); 3925 bool_t (*x_setpostn) (XDR * __xdrs, u_int __pos); 3926 int32_t *(*x_inline) (XDR * __xdrs, int __len); 3927 void (*x_destroy) (XDR * __xdrs); 3928 bool_t (*x_getint32) (XDR * __xdrs, int32_t * __ip); 3929 bool_t (*x_putint32) (XDR * __xdrs, int32_t * __ip); 3930 } 3931 ; 3932 3933 typedef bool_t (*xdrproc_t) (XDR *, void *, ...); 3934 3935 struct xdr_discrim 3936 { 3937 int value; 3938 xdrproc_t proc; 3939 } 3940 ; 3941 _________________________________________________________ 3942 3943 1.4.32. sched.h 3944 3945 #define SCHED_OTHER 0 3946 #define SCHED_FIFO 1 3947 #define SCHED_RR 2 3948 3949 struct sched_param 3950 { 3951 int sched_priority; 3952 } 3953 ; 3954 _________________________________________________________ 3955 3956 1.4.33. search.h 3957 3958 typedef struct entry 3959 { 3960 char *key; 3961 void *data; 3962 } 3963 ENTRY; 3964 typedef enum 3965 { 3966 FIND, ENTER 3967 } 3968 ACTION; 3969 typedef enum 3970 { 3971 preorder, postorder, endorder, leaf 3972 } 3973 VISIT; 3974 3975 typedef void (*__action_fn_t) (void *__nodep, VISIT __value, int __leve 3976 l); 3977 _________________________________________________________ 3978 3979 1.4.34. setjmp.h 3980 3981 #define setjmp(env) _setjmp(env) 3982 #define sigsetjmp(a,b) __sigsetjmp(a,b) 3983 3984 struct __jmp_buf_tag 3985 { 3986 __jmp_buf __jmpbuf; 3987 int __mask_was_saved; 3988 sigset_t __saved_mask; 3989 } 3990 ; 3991 3992 typedef struct __jmp_buf_tag jmp_buf[1]; 3993 typedef jmp_buf sigjmp_buf; 3994 _________________________________________________________ 3995 3996 1.4.35. signal.h 3997 3998 #define _SIGSET_NWORDS (1024/(8*sizeof(unsigned long))) 3999 #define SIGRTMAX (__libc_current_sigrtmax ()) 4000 #define SIGRTMIN (__libc_current_sigrtmin ()) 4001 #define SIG_BLOCK 0 4002 #define SIG_UNBLOCK 1 4003 #define SIG_SETMASK 2 4004 #define NSIG 65 4005 4006 typedef int sig_atomic_t; 4007 4008 typedef void (*sighandler_t) (int); 4009 #define SIG_HOLD ((sighandler_t) 2) 4010 #define SIG_ERR ((sighandler_t)-1) 4011 #define SIG_DFL ((sighandler_t)0) 4012 #define SIG_IGN ((sighandler_t)1) 4013 4014 #define SIGHUP 1 4015 #define SIGUSR1 10 4016 #define SIGSEGV 11 4017 #define SIGUSR2 12 4018 #define SIGPIPE 13 4019 #define SIGALRM 14 4020 #define SIGTERM 15 4021 #define SIGSTKFLT 16 4022 #define SIGCHLD 17 4023 #define SIGCONT 18 4024 #define SIGSTOP 19 4025 #define SIGINT 2 4026 #define SIGTSTP 20 4027 #define SIGTTIN 21 4028 #define SIGTTOU 22 4029 #define SIGURG 23 4030 #define SIGXCPU 24 4031 #define SIGXFSZ 25 4032 #define SIGVTALRM 26 4033 #define SIGPROF 27 4034 #define SIGWINCH 28 4035 #define SIGIO 29 4036 #define SIGQUIT 3 4037 #define SIGPWR 30 4038 #define SIGSYS 31 4039 #define SIGUNUSED 31 4040 #define SIGILL 4 4041 #define SIGTRAP 5 4042 #define SIGABRT 6 4043 #define SIGIOT 6 4044 #define SIGBUS 7 4045 #define SIGFPE 8 4046 #define SIGKILL 9 4047 #define SIGCLD SIGCHLD 4048 #define SIGPOLL SIGIO 4049 4050 #define SV_ONSTACK (1<<0) 4051 #define SV_INTERRUPT (1<<1) 4052 #define SV_RESETHAND (1<<2) 4053 4054 typedef union sigval 4055 { 4056 int sival_int; 4057 void *sival_ptr; 4058 } 4059 sigval_t; 4060 #define SIGEV_SIGNAL 0 4061 #define SIGEV_NONE 1 4062 #define SIGEV_THREAD 2 4063 #define SIGEV_MAX_SIZE 64 4064 4065 typedef struct sigevent 4066 { 4067 sigval_t sigev_value; 4068 int sigev_signo; 4069 int sigev_notify; 4070 union 4071 { 4072 int _pad[SIGEV_PAD_SIZE]; 4073 struct 4074 { 4075 void (*sigev_thread_func) (sigval_t); 4076 void *_attribute; 4077 } 4078 _sigev_thread; 4079 } 4080 _sigev_un; 4081 } 4082 sigevent_t; 4083 #define SI_MAX_SIZE 128 4084 #define si_pid _sifields._kill._pid 4085 #define si_uid _sifields._kill._uid 4086 #define si_value _sifields._rt._sigval 4087 #define si_int _sifields._rt._sigval.sival_int 4088 #define si_ptr _sifields._rt._sigval.sival_ptr 4089 #define si_status _sifields._sigchld._status 4090 #define si_stime _sifields._sigchld._stime 4091 #define si_utime _sifields._sigchld._utime 4092 #define si_addr _sifields._sigfault._addr 4093 #define si_band _sifields._sigpoll._band 4094 #define si_fd _sifields._sigpoll._fd 4095 #define si_timer1 _sifields._timer._timer1 4096 #define si_timer2 _sifields._timer._timer2 4097 4098 typedef struct siginfo 4099 { 4100 int si_signo; 4101 int si_errno; 4102 int si_code; 4103 union 4104 { 4105 int _pad[SI_PAD_SIZE]; 4106 struct 4107 { 4108 pid_t _pid; 4109 uid_t _uid; 4110 } 4111 _kill; 4112 struct 4113 { 4114 unsigned int _timer1; 4115 unsigned int _timer2; 4116 } 4117 _timer; 4118 struct 4119 { 4120 pid_t _pid; 4121 uid_t _uid; 4122 sigval_t _sigval; 4123 } 4124 _rt; 4125 struct 4126 { 4127 pid_t _pid; 4128 uid_t _uid; 4129 int _status; 4130 clock_t _utime; 4131 clock_t _stime; 4132 } 4133 _sigchld; 4134 struct 4135 { 4136 void *_addr; 4137 } 4138 _sigfault; 4139 struct 4140 { 4141 int _band; 4142 int _fd; 4143 } 4144 _sigpoll; 4145 } 4146 _sifields; 4147 } 4148 siginfo_t; 4149 #define SI_QUEUE -1 4150 #define SI_TIMER -2 4151 #define SI_MESGQ -3 4152 #define SI_ASYNCIO -4 4153 #define SI_SIGIO -5 4154 #define SI_TKILL -6 4155 #define SI_ASYNCNL -60 4156 #define SI_USER 0 4157 #define SI_KERNEL 0x80 4158 4159 #define ILL_ILLOPC 1 4160 #define ILL_ILLOPN 2 4161 #define ILL_ILLADR 3 4162 #define ILL_ILLTRP 4 4163 #define ILL_PRVOPC 5 4164 #define ILL_PRVREG 6 4165 #define ILL_COPROC 7 4166 #define ILL_BADSTK 8 4167 4168 #define FPE_INTDIV 1 4169 #define FPE_INTOVF 2 4170 #define FPE_FLTDIV 3 4171 #define FPE_FLTOVF 4 4172 #define FPE_FLTUND 5 4173 #define FPE_FLTRES 6 4174 #define FPE_FLTINV 7 4175 #define FPE_FLTSUB 8 4176 4177 #define SEGV_MAPERR 1 4178 #define SEGV_ACCERR 2 4179 4180 #define BUS_ADRALN 1 4181 #define BUS_ADRERR 2 4182 #define BUS_OBJERR 3 4183 4184 #define TRAP_BRKPT 1 4185 #define TRAP_TRACE 2 4186 4187 #define CLD_EXITED 1 4188 #define CLD_KILLED 2 4189 #define CLD_DUMPED 3 4190 #define CLD_TRAPPED 4 4191 #define CLD_STOPPED 5 4192 #define CLD_CONTINUED 6 4193 4194 #define POLL_IN 1 4195 #define POLL_OUT 2 4196 #define POLL_MSG 3 4197 #define POLL_ERR 4 4198 #define POLL_PRI 5 4199 #define POLL_HUP 6 4200 4201 typedef struct 4202 { 4203 unsigned long int sig[_SIGSET_NWORDS]; 4204 } 4205 sigset_t; 4206 #define SA_NOCLDSTOP 0x00000001 4207 #define SA_NOCLDWAIT 0x00000002 4208 #define SA_SIGINFO 0x00000004 4209 #define SA_ONSTACK 0x08000000 4210 #define SA_RESTART 0x10000000 4211 #define SA_INTERRUPT 0x20000000 4212 #define SA_NODEFER 0x40000000 4213 #define SA_RESETHAND 0x80000000 4214 #define SA_NOMASK SA_NODEFER 4215 #define SA_ONESHOT SA_RESETHAND 4216 4217 typedef struct sigaltstack 4218 { 4219 void *ss_sp; 4220 int ss_flags; 4221 size_t ss_size; 4222 } 4223 stack_t; 4224 #define SS_ONSTACK 1 4225 #define SS_DISABLE 2 4226 _________________________________________________________ 4227 4228 1.4.36. stddef.h 4229 4230 #define offsetof(TYPE,MEMBER) ((size_t)& ((TYPE*)0)->MEMBER) 4231 #define NULL (0L) 4232 4233 typedef int wchar_t; 4234 _________________________________________________________ 4235 4236 1.4.37. stdio.h 4237 4238 #define EOF (-1) 4239 #define P_tmpdir "/tmp" 4240 #define FOPEN_MAX 16 4241 #define L_tmpnam 20 4242 #define FILENAME_MAX 4096 4243 #define BUFSIZ 8192 4244 #define L_ctermid 9 4245 #define L_cuserid 9 4246 4247 typedef struct 4248 { 4249 off_t __pos; 4250 mbstate_t __state; 4251 } 4252 fpos_t; 4253 typedef struct 4254 { 4255 off64_t __pos; 4256 mbstate_t __state; 4257 } 4258 fpos64_t; 4259 4260 typedef struct _IO_FILE FILE; 4261 #define _IOFBF 0 4262 #define _IOLBF 1 4263 #define _IONBF 2 4264 _________________________________________________________ 4265 4266 1.4.38. stdlib.h 4267 4268 #define MB_CUR_MAX (__ctype_get_mb_cur_max()) 4269 #define EXIT_SUCCESS 0 4270 #define EXIT_FAILURE 1 4271 #define RAND_MAX 2147483647 4272 4273 typedef int (*__compar_fn_t) (const void *, const void *); 4274 struct random_data 4275 { 4276 int32_t *fptr; 4277 int32_t *rptr; 4278 int32_t *state; 4279 int rand_type; 4280 int rand_deg; 4281 int rand_sep; 4282 int32_t *end_ptr; 4283 } 4284 ; 4285 4286 typedef struct 4287 { 4288 int quot; 4289 int rem; 4290 } 4291 div_t; 4292 4293 typedef struct 4294 { 4295 long int quot; 4296 long int rem; 4297 } 4298 ldiv_t; 4299 4300 typedef struct 4301 { 4302 long long int quot; 4303 long long int rem; 4304 } 4305 lldiv_t; 4306 _________________________________________________________ 4307 4308 1.4.39. sys/file.h 4309 4310 #define LOCK_SH 1 4311 #define LOCK_EX 2 4312 #define LOCK_NB 4 4313 #define LOCK_UN 8 4314 _________________________________________________________ 4315 4316 1.4.40. sys/ipc.h 4317 4318 #define IPC_PRIVATE ((key_t)0) 4319 #define IPC_RMID 0 4320 #define IPC_CREAT 00001000 4321 #define IPC_EXCL 00002000 4322 #define IPC_NOWAIT 00004000 4323 #define IPC_SET 1 4324 #define IPC_STAT 2 4325 _________________________________________________________ 4326 4327 1.4.41. sys/mman.h 4328 4329 #define MAP_FAILED ((void*)-1) 4330 #define PROT_NONE 0x0 4331 #define MAP_SHARED 0x01 4332 #define MAP_PRIVATE 0x02 4333 #define PROT_READ 0x1 4334 #define MAP_FIXED 0x10 4335 #define PROT_WRITE 0x2 4336 #define MAP_ANONYMOUS 0x20 4337 #define PROT_EXEC 0x4 4338 #define MS_ASYNC 1 4339 #define MS_INVALIDATE 2 4340 #define MS_SYNC 4 4341 #define MAP_ANON MAP_ANONYMOUS 4342 _________________________________________________________ 4343 4344 1.4.42. sys/msg.h 4345 4346 #define MSG_NOERROR 010000 4347 _________________________________________________________ 4348 4349 1.4.43. sys/param.h 4350 4351 #define NOFILE 256 4352 #define MAXPATHLEN 4096 4353 _________________________________________________________ 4354 4355 1.4.44. sys/poll.h 4356 4357 #define POLLIN 0x0001 4358 #define POLLPRI 0x0002 4359 #define POLLOUT 0x0004 4360 #define POLLERR 0x0008 4361 #define POLLHUP 0x0010 4362 #define POLLNVAL 0x0020 4363 4364 struct pollfd 4365 { 4366 int fd; 4367 short events; 4368 short revents; 4369 } 4370 ; 4371 typedef unsigned long int nfds_t; 4372 _________________________________________________________ 4373 4374 1.4.45. sys/resource.h 4375 4376 #define RUSAGE_CHILDREN (-1) 4377 #define RUSAGE_BOTH (-2) 4378 #define RLIM_INFINITY (~0UL) 4379 #define RLIM_SAVED_CUR -1 4380 #define RLIM_SAVED_MAX -1 4381 #define RLIMIT_CPU 0 4382 #define RUSAGE_SELF 0 4383 #define RLIMIT_FSIZE 1 4384 #define RLIMIT_DATA 2 4385 #define RLIMIT_STACK 3 4386 #define RLIMIT_CORE 4 4387 #define RLIMIT_NOFILE 7 4388 #define RLIMIT_AS 9 4389 4390 typedef unsigned long int rlim_t; 4391 typedef unsigned long long int rlim64_t; 4392 typedef int __rlimit_resource_t; 4393 4394 struct rlimit 4395 { 4396 rlim_t rlim_cur; 4397 rlim_t rlim_max; 4398 } 4399 ; 4400 struct rlimit64 4401 { 4402 rlim64_t rlim_cur; 4403 rlim64_t rlim_max; 4404 } 4405 ; 4406 4407 struct rusage 4408 { 4409 struct timeval ru_utime; 4410 struct timeval ru_stime; 4411 long int ru_maxrss; 4412 long int ru_ixrss; 4413 long int ru_idrss; 4414 long int ru_isrss; 4415 long int ru_minflt; 4416 long int ru_majflt; 4417 long int ru_nswap; 4418 long int ru_inblock; 4419 long int ru_oublock; 4420 long int ru_msgsnd; 4421 long int ru_msgrcv; 4422 long int ru_nsignals; 4423 long int ru_nvcsw; 4424 long int ru_nivcsw; 4425 } 4426 ; 4427 4428 enum __priority_which 4429 { 4430 PRIO_PROCESS, PRIO_PGRP = 1, PRIO_USER = 2 4431 } 4432 ; 4433 #define PRIO_PGRP PRIO_PGRP 4434 #define PRIO_PROCESS PRIO_PROCESS 4435 #define PRIO_USER PRIO_USER 4436 4437 typedef enum __priority_which __priority_which_t; 4438 _________________________________________________________ 4439 4440 1.4.46. sys/sem.h 4441 4442 #define SEM_UNDO 0x1000 4443 #define GETPID 11 4444 #define GETVAL 12 4445 #define GETALL 13 4446 #define GETNCNT 14 4447 #define GETZCNT 15 4448 #define SETVAL 16 4449 #define SETALL 17 4450 4451 struct sembuf 4452 { 4453 short sem_num; 4454 short sem_op; 4455 short sem_flg; 4456 } 4457 ; 4458 _________________________________________________________ 4459 4460 1.4.47. sys/shm.h 4461 4462 #define SHM_RDONLY 010000 4463 #define SHM_W 0200 4464 #define SHM_RND 020000 4465 #define SHM_R 0400 4466 #define SHM_REMAP 040000 4467 #define SHM_LOCK 11 4468 #define SHM_UNLOCK 12 4469 _________________________________________________________ 4470 4471 1.4.48. sys/socket.h 4472 4473 #define CMSG_NXTHDR(mhdr,cmsg) ( ((cmsg) == NULL) ? CMSG_FIRSTHDR(mhd 4474 r) : (((unsigned char *)(cmsg) + CMSG_ALIGN((cmsg)->cmsg_len) + CMSG_AL 4475 IGN(sizeof(struct cmsghdr)) > (unsigned char *)((mhdr)->msg_control) + 4476 (mhdr)->msg_controllen) ? (struct cmsghdr *)NULL :(struct cmsghdr *)((u 4477 nsi 4478 #define CMSG_ALIGN(len) (((len)+sizeof(size_t)-1)& (size_t)~(sizeof(siz 4479 e_t)-1)) 4480 #define CMSG_FIRSTHDR(msg) ((size_t) (mhdr)->msg_controllen >= siz 4481 eof (struct cmsghdr) ? (struct cmsghdr *) (mhdr)->msg_control : (struct 4482 cmsghdr *) NULL) 4483 #define CMSG_DATA(cmsg) ((unsigned char *) (cmsg) + CMSG_ALIGN(sizeof(s 4484 truct cmsghdr))) 4485 #define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr))+(len)) 4486 #define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr))+CMSG_ALIGN( 4487 len)) 4488 #define SCM_RIGHTS 0x01 4489 #define SOL_SOCKET 1 4490 #define SOMAXCONN 128 4491 #define SOL_RAW 255 4492 4493 struct linger 4494 { 4495 int l_onoff; 4496 int l_linger; 4497 } 4498 ; 4499 struct cmsghdr 4500 { 4501 size_t cmsg_len; 4502 int cmsg_level; 4503 int cmsg_type; 4504 } 4505 ; 4506 struct iovec 4507 { 4508 void *iov_base; 4509 size_t iov_len; 4510 } 4511 ; 4512 4513 typedef unsigned short sa_family_t; 4514 typedef unsigned int socklen_t; 4515 4516 struct sockaddr 4517 { 4518 sa_family_t sa_family; 4519 char sa_data[14]; 4520 } 4521 ; 4522 struct sockaddr_storage 4523 { 4524 sa_family_t ss_family; 4525 __ss_aligntype __ss_align; 4526 char __ss_padding[(128 - (2 * sizeof (__ss_aligntype)))]; 4527 } 4528 ; 4529 4530 struct msghdr 4531 { 4532 void *msg_name; 4533 int msg_namelen; 4534 struct iovec *msg_iov; 4535 size_t msg_iovlen; 4536 void *msg_control; 4537 size_t msg_controllen; 4538 unsigned int msg_flags; 4539 } 4540 ; 4541 #define AF_UNSPEC 0 4542 #define AF_UNIX 1 4543 #define AF_INET6 10 4544 #define AF_INET 2 4545 4546 #define PF_INET AF_INET 4547 #define PF_INET6 AF_INET6 4548 #define PF_UNIX AF_UNIX 4549 #define PF_UNSPEC AF_UNSPEC 4550 4551 #define SOCK_STREAM 1 4552 #define SOCK_PACKET 10 4553 #define SOCK_DGRAM 2 4554 #define SOCK_RAW 3 4555 #define SOCK_RDM 4 4556 #define SOCK_SEQPACKET 5 4557 4558 #define SO_DEBUG 1 4559 #define SO_OOBINLINE 10 4560 #define SO_NO_CHECK 11 4561 #define SO_PRIORITY 12 4562 #define SO_LINGER 13 4563 #define SO_REUSEADDR 2 4564 #define SO_TYPE 3 4565 #define SO_ACCEPTCONN 30 4566 #define SO_ERROR 4 4567 #define SO_DONTROUTE 5 4568 #define SO_BROADCAST 6 4569 #define SO_SNDBUF 7 4570 #define SO_RCVBUF 8 4571 #define SO_KEEPALIVE 9 4572 4573 #define SIOCGIFFLAGS 0x8913 4574 #define SIOCGIFADDR 0x8915 4575 #define SIOCGIFNETMASK 0x891b 4576 4577 #define SHUT_RD 0 4578 #define SHUT_WR 1 4579 #define SHUT_RDWR 2 4580 #define MSG_DONTROUTE 4 4581 4582 #define MSG_WAITALL 0x100 4583 #define MSG_TRUNC 0x20 4584 #define MSG_EOR 0x80 4585 #define MSG_OOB 1 4586 #define MSG_PEEK 2 4587 #define MSG_CTRUNC 8 4588 _________________________________________________________ 4589 4590 1.4.49. sys/stat.h 4591 4592 #define S_ISBLK(m) (((m)& S_IFMT)==S_IFBLK) 4593 #define S_ISCHR(m) (((m)& S_IFMT)==S_IFCHR) 4594 #define S_ISDIR(m) (((m)& S_IFMT)==S_IFDIR) 4595 #define S_ISFIFO(m) (((m)& S_IFMT)==S_IFIFO) 4596 #define S_ISLNK(m) (((m)& S_IFMT)==S_IFLNK) 4597 #define S_ISREG(m) (((m)& S_IFMT)==S_IFREG) 4598 #define S_ISSOCK(m) (((m)& S_IFMT)==S_IFSOCK) 4599 #define S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) 4600 #define S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) 4601 #define S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) 4602 #define S_IRWXU (S_IREAD|S_IWRITE|S_IEXEC) 4603 #define S_IROTH (S_IRGRP>>3) 4604 #define S_IRGRP (S_IRUSR>>3) 4605 #define S_IRWXO (S_IRWXG>>3) 4606 #define S_IRWXG (S_IRWXU>>3) 4607 #define S_IWOTH (S_IWGRP>>3) 4608 #define S_IWGRP (S_IWUSR>>3) 4609 #define S_IXOTH (S_IXGRP>>3) 4610 #define S_IXGRP (S_IXUSR>>3) 4611 #define S_ISVTX 01000 4612 #define S_IXUSR 0x0040 4613 #define S_IWUSR 0x0080 4614 #define S_IRUSR 0x0100 4615 #define S_ISGID 0x0400 4616 #define S_ISUID 0x0800 4617 #define S_IFIFO 0x1000 4618 #define S_IFCHR 0x2000 4619 #define S_IFDIR 0x4000 4620 #define S_IFBLK 0x6000 4621 #define S_IFREG 0x8000 4622 #define S_IFLNK 0xa000 4623 #define S_IFSOCK 0xc000 4624 #define S_IFMT 0xf000 4625 #define st_atime st_atim.tv_sec 4626 #define st_ctime st_ctim.tv_sec 4627 #define st_mtime st_mtim.tv_sec 4628 #define S_IREAD S_IRUSR 4629 #define S_IWRITE S_IWUSR 4630 #define S_IEXEC S_IXUSR 4631 _________________________________________________________ 4632 4633 1.4.50. sys/time.h 4634 4635 #define ITIMER_REAL 0 4636 #define ITIMER_VIRTUAL 1 4637 #define ITIMER_PROF 2 4638 4639 struct timezone 4640 { 4641 int tz_minuteswest; 4642 int tz_dsttime; 4643 } 4644 ; 4645 4646 typedef int __itimer_which_t; 4647 4648 struct timespec 4649 { 4650 time_t tv_sec; 4651 long int tv_nsec; 4652 } 4653 ; 4654 4655 struct timeval 4656 { 4657 time_t tv_sec; 4658 suseconds_t tv_usec; 4659 } 4660 ; 4661 4662 struct itimerval 4663 { 4664 struct timeval it_interval; 4665 struct timeval it_value; 4666 } 4667 ; 4668 _________________________________________________________ 4669 4670 1.4.51. sys/timeb.h 4671 4672 struct timeb 4673 { 4674 time_t time; 4675 unsigned short millitm; 4676 short timezone; 4677 short dstflag; 4678 } 4679 ; 4680 _________________________________________________________ 4681 4682 1.4.52. sys/times.h 4683 4684 struct tms 4685 { 4686 clock_t tms_utime; 4687 clock_t tms_stime; 4688 clock_t tms_cutime; 4689 clock_t tms_cstime; 4690 } 4691 ; 4692 _________________________________________________________ 4693 4694 1.4.53. sys/types.h 4695 4696 #define FD_ISSET(d,set) ((set)->fds_bits[((d)/(8*sizeof(long)))]& (1<<( 4697 (d)%(8*sizeof(long))))) 4698 #define FD_CLR(d,set) ((set)->fds_bits[((d)/(8*sizeof(long)))]& =~(1< 4699 <((d)%(8*sizeof(long))))) 4700 #define FD_SET(d,set) ((set)->fds_bits[((d)/(8*sizeof(long)))]|=(1<<( 4701 (d)%(8*sizeof(long))))) 4702 #define FALSE 0 4703 #define TRUE 1 4704 #define FD_SETSIZE 1024 4705 #define FD_ZERO(fdsetp) bzero(fdsetp, sizeof(*(fdsetp))) 4706 4707 typedef signed char int8_t; 4708 typedef short int16_t; 4709 typedef int int32_t; 4710 typedef unsigned char u_int8_t; 4711 typedef unsigned short u_int16_t; 4712 typedef unsigned int u_int32_t; 4713 typedef unsigned int uid_t; 4714 typedef int pid_t; 4715 typedef unsigned long int off_t; 4716 typedef int key_t; 4717 typedef long int suseconds_t; 4718 typedef unsigned int u_int; 4719 typedef struct 4720 { 4721 int __val[2]; 4722 } 4723 fsid_t; 4724 typedef unsigned int useconds_t; 4725 typedef unsigned long int blksize_t; 4726 typedef long int fd_mask; 4727 typedef int timer_t; 4728 typedef int clockid_t; 4729 4730 typedef unsigned int id_t; 4731 4732 typedef unsigned long long int ino64_t; 4733 typedef long long int loff_t; 4734 typedef unsigned long int blkcnt_t; 4735 typedef unsigned long int fsblkcnt_t; 4736 typedef unsigned long int fsfilcnt_t; 4737 typedef unsigned long long int blkcnt64_t; 4738 typedef unsigned long long int fsblkcnt64_t; 4739 typedef unsigned long long int fsfilcnt64_t; 4740 typedef unsigned char u_char; 4741 typedef unsigned short u_short; 4742 typedef unsigned long int u_long; 4743 4744 typedef unsigned long int ino_t; 4745 typedef unsigned int gid_t; 4746 typedef unsigned long long int dev_t; 4747 typedef unsigned int mode_t; 4748 typedef unsigned long int nlink_t; 4749 typedef char *caddr_t; 4750 4751 typedef struct 4752 { 4753 unsigned long int fds_bits[__FDSET_LONGS]; 4754 } 4755 fd_set; 4756 4757 typedef long int clock_t; 4758 typedef long int time_t; 4759 _________________________________________________________ 4760 4761 1.4.54. sys/un.h 4762 4763 #define UNIX_PATH_MAX 108 4764 4765 struct sockaddr_un 4766 { 4767 sa_family_t sun_family; 4768 char sun_path[UNIX_PATH_MAX]; 4769 } 4770 ; 4771 _________________________________________________________ 4772 4773 1.4.55. sys/utsname.h 4774 4775 #define SYS_NMLN 65 4776 4777 struct utsname 4778 { 4779 char sysname[65]; 4780 char nodename[65]; 4781 char release[65]; 4782 char version[65]; 4783 char machine[65]; 4784 char domainname[65]; 4785 } 4786 ; 4787 _________________________________________________________ 4788 4789 1.4.56. sys/wait.h 4790 4791 #define WIFSIGNALED(status) (!WIFSTOPPED(status) & & !WIFEXITED(sta 4792 tus)) 4793 #define WIFSTOPPED(status) (((status) & 0xff) == 0x7f) 4794 #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) 4795 #define WTERMSIG(status) ((status) & 0x7f) 4796 #define WCOREDUMP(status) ((status) & 0x80) 4797 #define WIFEXITED(status) (WTERMSIG(status) == 0) 4798 #define WNOHANG 0x00000001 4799 #define WUNTRACED 0x00000002 4800 #define WCOREFLAG 0x80 4801 #define WSTOPSIG(status) WEXITSTATUS(status) 4802 4803 typedef enum 4804 { 4805 P_ALL, P_PID, P_PGID 4806 } 4807 idtype_t; 4808 _________________________________________________________ 4809 4810 1.4.57. syslog.h 4811 4812 #define LOG_EMERG 0 4813 #define LOG_PRIMASK 0x07 4814 #define LOG_ALERT 1 4815 #define LOG_CRIT 2 4816 #define LOG_ERR 3 4817 #define LOG_WARNING 4 4818 #define LOG_NOTICE 5 4819 #define LOG_INFO 6 4820 #define LOG_DEBUG 7 4821 4822 #define LOG_KERN (0<<3) 4823 #define LOG_AUTHPRIV (10<<3) 4824 #define LOG_FTP (11<<3) 4825 #define LOG_USER (1<<3) 4826 #define LOG_MAIL (2<<3) 4827 #define LOG_DAEMON (3<<3) 4828 #define LOG_AUTH (4<<3) 4829 #define LOG_SYSLOG (5<<3) 4830 #define LOG_LPR (6<<3) 4831 #define LOG_NEWS (7<<3) 4832 #define LOG_UUCP (8<<3) 4833 #define LOG_CRON (9<<3) 4834 #define LOG_FACMASK 0x03f8 4835 4836 #define LOG_LOCAL0 (16<<3) 4837 #define LOG_LOCAL1 (17<<3) 4838 #define LOG_LOCAL2 (18<<3) 4839 #define LOG_LOCAL3 (19<<3) 4840 #define LOG_LOCAL4 (20<<3) 4841 #define LOG_LOCAL5 (21<<3) 4842 #define LOG_LOCAL6 (22<<3) 4843 #define LOG_LOCAL7 (23<<3) 4844 4845 #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) 4846 #define LOG_MASK(pri) (1 << (pri)) 4847 4848 #define LOG_PID 0x01 4849 #define LOG_CONS 0x02 4850 #define LOG_ODELAY 0x04 4851 #define LOG_NDELAY 0x08 4852 #define LOG_NOWAIT 0x10 4853 #define LOG_PERROR 0x20 4854 _________________________________________________________ 4855 4856 1.4.58. termios.h 4857 4858 #define TCIFLUSH 0 4859 #define TCOOFF 0 4860 #define TCSANOW 0 4861 #define BS0 0000000 4862 #define CR0 0000000 4863 #define FF0 0000000 4864 #define NL0 0000000 4865 #define TAB0 0000000 4866 #define VT0 0000000 4867 #define OPOST 0000001 4868 #define OCRNL 0000010 4869 #define ONOCR 0000020 4870 #define ONLRET 0000040 4871 #define OFILL 0000100 4872 #define OFDEL 0000200 4873 #define NL1 0000400 4874 #define TCOFLUSH 1 4875 #define TCOON 1 4876 #define TCSADRAIN 1 4877 #define TCIOFF 2 4878 #define TCIOFLUSH 2 4879 #define TCSAFLUSH 2 4880 #define TCION 3 4881 4882 typedef unsigned int speed_t; 4883 typedef unsigned char cc_t; 4884 typedef unsigned int tcflag_t; 4885 #define NCCS 32 4886 4887 struct termios 4888 { 4889 tcflag_t c_iflag; 4890 tcflag_t c_oflag; 4891 tcflag_t c_cflag; 4892 tcflag_t c_lflag; 4893 cc_t c_line; 4894 cc_t c_cc[NCCS]; 4895 speed_t c_ispeed; 4896 speed_t c_ospeed; 4897 } 4898 ; 4899 #define VINTR 0 4900 #define VQUIT 1 4901 #define VLNEXT 15 4902 #define VERASE 2 4903 #define VKILL 3 4904 #define VEOF 4 4905 4906 #define IGNBRK 0000001 4907 #define BRKINT 0000002 4908 #define IGNPAR 0000004 4909 #define PARMRK 0000010 4910 #define INPCK 0000020 4911 #define ISTRIP 0000040 4912 #define INLCR 0000100 4913 #define IGNCR 0000200 4914 #define ICRNL 0000400 4915 #define IXANY 0004000 4916 #define IMAXBEL 0020000 4917 4918 #define CS5 0000000 4919 4920 #define ECHO 0000010 4921 4922 #define B0 0000000 4923 #define B50 0000001 4924 #define B75 0000002 4925 #define B110 0000003 4926 #define B134 0000004 4927 #define B150 0000005 4928 #define B200 0000006 4929 #define B300 0000007 4930 #define B600 0000010 4931 #define B1200 0000011 4932 #define B1800 0000012 4933 #define B2400 0000013 4934 #define B4800 0000014 4935 #define B9600 0000015 4936 #define B19200 0000016 4937 #define B38400 0000017 4938 _________________________________________________________ 4939 4940 1.4.59. time.h 4941 4942 #define CLK_TCK ((clock_t)__sysconf(2)) 4943 #define CLOCK_REALTIME 0 4944 #define TIMER_ABSTIME 1 4945 #define CLOCKS_PER_SEC 1000000l 4946 4947 struct tm 4948 { 4949 int tm_sec; 4950 int tm_min; 4951 int tm_hour; 4952 int tm_mday; 4953 int tm_mon; 4954 int tm_year; 4955 int tm_wday; 4956 int tm_yday; 4957 int tm_isdst; 4958 long int tm_gmtoff; 4959 char *tm_zone; 4960 } 4961 ; 4962 struct itimerspec 4963 { 4964 struct timespec it_interval; 4965 struct timespec it_value; 4966 } 4967 ; 4968 _________________________________________________________ 4969 4970 1.4.60. ulimit.h 4971 4972 #define UL_GETFSIZE 1 4973 #define UL_SETFSIZE 2 4974 _________________________________________________________ 4975 4976 1.4.61. unistd.h 4977 4978 The LSB requires _XOPEN_REALTIME to be defined to 1, but does 4979 not require all the set of functions required by the ISO POSIX 4980 (2003) XSI Option Group _XOPEN_REALTIME. For example, the 4981 asynchronous input/output functions are optional for LSB 4982 conforming systems. 4983 #define SEEK_SET 0 4984 #define STDIN_FILENO 0 4985 #define SEEK_CUR 1 4986 #define STDOUT_FILENO 1 4987 #define SEEK_END 2 4988 #define STDERR_FILENO 2 4989 4990 typedef long long int off64_t; 4991 #define F_OK 0 4992 #define X_OK 1 4993 #define W_OK 2 4994 #define R_OK 4 4995 4996 #define _POSIX_VDISABLE '\0' 4997 #define _POSIX_CHOWN_RESTRICTED 1 4998 #define _POSIX_JOB_CONTROL 1 4999 #define _POSIX_NO_TRUNC 1 5000 #define _POSIX_SHELL 1 5001 #define _POSIX_FSYNC 200112 5002 #define _POSIX_MAPPED_FILES 200112 5003 #define _POSIX_MEMLOCK 200112 5004 #define _POSIX_MEMLOCK_RANGE 200112 5005 #define _POSIX_MEMORY_PROTECTION 200112 5006 #define _POSIX_SEMAPHORES 200112 5007 #define _POSIX_SHARED_MEMORY_OBJECTS 200112 5008 #define _POSIX_TIMERS 200112 5009 #define _POSIX2_C_BIND 200112L 5010 #define _POSIX_THREADS 200112L 5011 5012 #define _PC_LINK_MAX 0 5013 #define _PC_MAX_CANON 1 5014 #define _PC_ASYNC_IO 10 5015 #define _PC_PRIO_IO 11 5016 #define _PC_FILESIZEBITS 13 5017 #define _PC_REC_INCR_XFER_SIZE 14 5018 #define _PC_REC_MIN_XFER_SIZE 16 5019 #define _PC_REC_XFER_ALIGN 17 5020 #define _PC_ALLOC_SIZE_MIN 18 5021 #define _PC_MAX_INPUT 2 5022 #define _PC_2_SYMLINKS 20 5023 #define _PC_NAME_MAX 3 5024 #define _PC_PATH_MAX 4 5025 #define _PC_PIPE_BUF 5 5026 #define _PC_CHOWN_RESTRICTED 6 5027 #define _PC_NO_TRUNC 7 5028 #define _PC_VDISABLE 8 5029 #define _PC_SYNC_IO 9 5030 5031 #define _SC_ARG_MAX 0 5032 #define _SC_CHILD_MAX 1 5033 #define _SC_PRIORITY_SCHEDULING 10 5034 #define _SC_TIMERS 11 5035 #define _SC_ASYNCHRONOUS_IO 12 5036 #define _SC_XBS5_ILP32_OFF32 125 5037 #define _SC_XBS5_ILP32_OFFBIG 126 5038 #define _SC_XBS5_LP64_OFF64 127 5039 #define _SC_XBS5_LPBIG_OFFBIG 128 5040 #define _SC_XOPEN_LEGACY 129 5041 #define _SC_PRIORITIZED_IO 13 5042 #define _SC_XOPEN_REALTIME 130 5043 #define _SC_XOPEN_REALTIME_THREADS 131 5044 #define _SC_ADVISORY_INFO 132 5045 #define _SC_BARRIERS 133 5046 #define _SC_CLOCK_SELECTION 137 5047 #define _SC_CPUTIME 138 5048 #define _SC_THREAD_CPUTIME 139 5049 #define _SC_SYNCHRONIZED_IO 14 5050 #define _SC_MONOTONIC_CLOCK 149 5051 #define _SC_FSYNC 15 5052 #define _SC_READER_WRITER_LOCKS 153 5053 #define _SC_SPIN_LOCKS 154 5054 #define _SC_REGEXP 155 5055 #define _SC_SHELL 157 5056 #define _SC_SPAWN 159 5057 #define _SC_MAPPED_FILES 16 5058 #define _SC_SPORADIC_SERVER 160 5059 #define _SC_THREAD_SPORADIC_SERVER 161 5060 #define _SC_TIMEOUTS 164 5061 #define _SC_TYPED_MEMORY_OBJECTS 165 5062 #define _SC_2_PBS_ACCOUNTING 169 5063 #define _SC_MEMLOCK 17 5064 #define _SC_2_PBS_LOCATE 170 5065 #define _SC_2_PBS_MESSAGE 171 5066 #define _SC_2_PBS_TRACK 172 5067 #define _SC_SYMLOOP_MAX 173 5068 #define _SC_2_PBS_CHECKPOINT 175 5069 #define _SC_V6_ILP32_OFF32 176 5070 #define _SC_V6_ILP32_OFFBIG 177 5071 #define _SC_V6_LP64_OFF64 178 5072 #define _SC_V6_LPBIG_OFFBIG 179 5073 #define _SC_MEMLOCK_RANGE 18 5074 #define _SC_HOST_NAME_MAX 180 5075 #define _SC_TRACE 181 5076 #define _SC_TRACE_EVENT_FILTER 182 5077 #define _SC_TRACE_INHERIT 183 5078 #define _SC_TRACE_LOG 184 5079 #define _SC_MEMORY_PROTECTION 19 5080 #define _SC_CLK_TCK 2 5081 #define _SC_MESSAGE_PASSING 20 5082 #define _SC_SEMAPHORES 21 5083 #define _SC_SHARED_MEMORY_OBJECTS 22 5084 #define _SC_AIO_LISTIO_MAX 23 5085 #define _SC_AIO_MAX 24 5086 #define _SC_AIO_PRIO_DELTA_MAX 25 5087 #define _SC_DELAYTIMER_MAX 26 5088 #define _SC_MQ_OPEN_MAX 27 5089 #define _SC_MQ_PRIO_MAX 28 5090 #define _SC_VERSION 29 5091 #define _SC_NGROUPS_MAX 3 5092 #define _SC_PAGESIZE 30 5093 #define _SC_PAGE_SIZE 30 5094 #define _SC_RTSIG_MAX 31 5095 #define _SC_SEM_NSEMS_MAX 32 5096 #define _SC_SEM_VALUE_MAX 33 5097 #define _SC_SIGQUEUE_MAX 34 5098 #define _SC_TIMER_MAX 35 5099 #define _SC_BC_BASE_MAX 36 5100 #define _SC_BC_DIM_MAX 37 5101 #define _SC_BC_SCALE_MAX 38 5102 #define _SC_BC_STRING_MAX 39 5103 #define _SC_OPEN_MAX 4 5104 #define _SC_COLL_WEIGHTS_MAX 40 5105 #define _SC_EXPR_NEST_MAX 42 5106 #define _SC_LINE_MAX 43 5107 #define _SC_RE_DUP_MAX 44 5108 #define _SC_2_VERSION 46 5109 #define _SC_2_C_BIND 47 5110 #define _SC_2_C_DEV 48 5111 #define _SC_2_FORT_DEV 49 5112 #define _SC_STREAM_MAX 5 5113 #define _SC_2_FORT_RUN 50 5114 #define _SC_2_SW_DEV 51 5115 #define _SC_2_LOCALEDEF 52 5116 #define _SC_TZNAME_MAX 6 5117 #define _SC_IOV_MAX 60 5118 #define _SC_THREADS 67 5119 #define _SC_THREAD_SAFE_FUNCTIONS 68 5120 #define _SC_GETGR_R_SIZE_MAX 69 5121 #define _SC_JOB_CONTROL 7 5122 #define _SC_GETPW_R_SIZE_MAX 70 5123 #define _SC_LOGIN_NAME_MAX 71 5124 #define _SC_TTY_NAME_MAX 72 5125 #define _SC_THREAD_DESTRUCTOR_ITERATIONS 73 5126 #define _SC_THREAD_KEYS_MAX 74 5127 #define _SC_THREAD_STACK_MIN 75 5128 #define _SC_THREAD_THREADS_MAX 76 5129 #define _SC_THREAD_ATTR_STACKADDR 77 5130 #define _SC_THREAD_ATTR_STACKSIZE 78 5131 #define _SC_THREAD_PRIORITY_SCHEDULING 79 5132 #define _SC_SAVED_IDS 8 5133 #define _SC_THREAD_PRIO_INHERIT 80 5134 #define _SC_THREAD_PRIO_PROTECT 81 5135 #define _SC_THREAD_PROCESS_SHARED 82 5136 #define _SC_ATEXIT_MAX 87 5137 #define _SC_PASS_MAX 88 5138 #define _SC_XOPEN_VERSION 89 5139 #define _SC_REALTIME_SIGNALS 9 5140 #define _SC_XOPEN_UNIX 91 5141 #define _SC_XOPEN_CRYPT 92 5142 #define _SC_XOPEN_ENH_I18N 93 5143 #define _SC_XOPEN_SHM 94 5144 #define _SC_2_CHAR_TERM 95 5145 #define _SC_2_C_VERSION 96 5146 #define _SC_2_UPE 97 5147 5148 #define _CS_PATH 0 5149 #define _POSIX_REGEXP 1 5150 #define _CS_XBS5_ILP32_OFF32_CFLAGS 1100 5151 #define _CS_XBS5_ILP32_OFF32_LDFLAGS 1101 5152 #define _CS_XBS5_ILP32_OFF32_LIBS 1102 5153 #define _CS_XBS5_ILP32_OFF32_LINTFLAGS 1103 5154 #define _CS_XBS5_ILP32_OFFBIG_CFLAGS 1104 5155 #define _CS_XBS5_ILP32_OFFBIG_LDFLAGS 1105 5156 #define _CS_XBS5_ILP32_OFFBIG_LIBS 1106 5157 #define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS 1107 5158 #define _CS_XBS5_LP64_OFF64_CFLAGS 1108 5159 #define _CS_XBS5_LP64_OFF64_LDFLAGS 1109 5160 #define _CS_XBS5_LP64_OFF64_LIBS 1110 5161 #define _CS_XBS5_LP64_OFF64_LINTFLAGS 1111 5162 #define _CS_XBS5_LPBIG_OFFBIG_CFLAGS 1112 5163 #define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS 1113 5164 #define _CS_XBS5_LPBIG_OFFBIG_LIBS 1114 5165 #define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS 1115 5166 5167 #define _XOPEN_XPG4 1 5168 5169 #define F_ULOCK 0 5170 #define F_LOCK 1 5171 #define F_TLOCK 2 5172 #define F_TEST 3 5173 _________________________________________________________ 5174 5175 1.4.62. utime.h 5176 5177 struct utimbuf 5178 { 5179 time_t actime; 5180 time_t modtime; 5181 } 5182 ; 5183 _________________________________________________________ 5184 5185 1.4.63. utmp.h 5186 5187 #define UT_HOSTSIZE 256 5188 #define UT_LINESIZE 32 5189 #define UT_NAMESIZE 32 5190 5191 struct exit_status 5192 { 5193 short e_termination; 5194 short e_exit; 5195 } 5196 ; 5197 5198 #define EMPTY 0 5199 #define RUN_LVL 1 5200 #define BOOT_TIME 2 5201 #define NEW_TIME 3 5202 #define OLD_TIME 4 5203 #define INIT_PROCESS 5 5204 #define LOGIN_PROCESS 6 5205 #define USER_PROCESS 7 5206 #define DEAD_PROCESS 8 5207 #define ACCOUNTING 9 5208 _________________________________________________________ 5209 5210 1.4.64. wchar.h 5211 5212 #define WEOF (0xffffffffu) 5213 #define WCHAR_MAX 0x7FFFFFFF 5214 #define WCHAR_MIN 0x80000000 5215 _________________________________________________________ 5216 5217 1.4.65. wctype.h 5218 5219 typedef unsigned long int wctype_t; 5220 typedef unsigned int wint_t; 5221 typedef const int32_t *wctrans_t; 5222 typedef struct 5223 { 5224 int count; 5225 wint_t value; 5226 } 5227 __mbstate_t; 5228 5229 typedef __mbstate_t mbstate_t; 5230 _________________________________________________________ 5231 5232 1.4.66. wordexp.h 5233 5234 enum 5235 { 5236 WRDE_DOOFFS, WRDE_APPEND, WRDE_NOCMD, WRDE_REUSE, WRDE_SHOWERR, WRDE_ 5237 UNDEF, 5238 __WRDE_FLAGS 5239 } 5240 ; 5241 5242 typedef struct 5243 { 5244 int we_wordc; 5245 char **we_wordv; 5246 int we_offs; 5247 } 5248 wordexp_t; 5249 5250 enum 5251 { 5252 WRDE_NOSYS, WRDE_NOSPACE, WRDE_BADCHAR, WRDE_BADVAL, WRDE_CMDSUB, 5253 WRDE_SYNTAX 5254 } 5255 ; 5256 _________________________________________________________ 5257 5258 1.5. Interface Definitions for libc 5259 5260 Table of Contents 5261 _IO_feof -- alias for feof 5262 _IO_getc -- alias for getc 5263 _IO_putc -- alias for putc 5264 _IO_puts -- alias for puts 5265 __assert_fail -- abort the program after false assertion 5266 __ctype_b_loc -- accessor function for __ctype_b array for 5267 ctype functions 5268 5269 __ctype_get_mb_cur_max -- maximum length of a multibyte 5270 character in the current locale 5271 5272 __ctype_tolower_loc -- accessor function for __ctype_b_tolower 5273 array for ctype tolower() function 5274 5275 __ctype_toupper_loc -- accessor function for 5276 __ctype_b_toupper() array for ctype toupper() function 5277 5278 __cxa_atexit -- register a function to be called by exit or 5279 when a shared library is unloaded 5280 5281 __daylight -- Daylight savings time flag 5282 __environ -- alias for environ - user environment 5283 __errno_location -- address of errno variable 5284 __fpending -- returns in bytes the amount of output pending on 5285 a stream 5286 5287 __getpagesize -- alias for getpagesize - get current page size 5288 5289 __getpgid -- get the process group id 5290 __h_errno_location -- address of h_errno variable 5291 __isinf -- test for infinity 5292 __isinff -- test for infinity 5293 __isinfl -- test for infinity 5294 __isnan -- test for infinity 5295 __isnanf -- test for infinity 5296 __isnanl -- test for infinity 5297 __libc_current_sigrtmax -- return number of available 5298 real-time signal with lowest priority 5299 5300 __libc_current_sigrtmin -- return number of available 5301 real-time signal with highest priority 5302 5303 __libc_start_main -- initialization routine 5304 __lxstat -- inline wrapper around call to lxstat 5305 __mempcpy -- copy given number of bytes of source to 5306 destination 5307 5308 __rawmemchr -- scan memory 5309 __register_atfork -- alias for register_atfork 5310 __sigsetjmp -- save stack context for non-local goto 5311 __stpcpy -- copy a string returning a pointer to its end 5312 __strdup -- alias for strdup 5313 __strtod_internal -- underlying function for strtod 5314 __strtof_internal -- underlying function for strtof 5315 __strtok_r -- alias for strtok_r 5316 __strtol_internal -- alias for strtol 5317 __strtold_internal -- underlying function for strtold 5318 __strtoll_internal -- underlying function for strtoll 5319 __strtoul_internal -- underlying function for strtoul 5320 __strtoull_internal -- underlying function for strtoull 5321 __sysconf -- get configuration information at runtime 5322 __sysv_signal -- signal handling 5323 __timezone -- global variable containing timezone 5324 __tzname -- global variable containing the timezone 5325 __wcstod_internal -- underlying function for wcstod 5326 __wcstof_internal -- underlying function for wcstof 5327 __wcstol_internal -- underlying function for wcstol 5328 __wcstold_internal -- underlying function for wcstold 5329 __wcstoul_internal -- underlying function for wcstoul 5330 __xmknod -- make block or character special file 5331 __xstat -- Get File Status 5332 __xstat64 -- Get File Status 5333 _environ -- alias for environ - user environment 5334 _nl_msg_cat_cntr -- new catalog load counter 5335 _sys_errlist -- array containing the "C" locale strings used 5336 by strerror() 5337 5338 _sys_siglist -- array containing the names of the signal names 5339 acct -- switch process accounting on or off 5340 adjtime -- correct the time to allow synchronization of the 5341 system clock 5342 5343 asprintf -- write formatted output to a dynamically allocated 5344 string 5345 5346 bind_textdomain_codeset -- specify encoding for message 5347 retrieval 5348 5349 bindresvport -- bind socket to privileged IP port 5350 bindtextdomain -- specify the location of a message catalog 5351 cfmakeraw -- get and set terminal attributes 5352 cfsetspeed -- set terminal input and output data rate 5353 daemon -- run in the background 5354 dcgettext -- perform domain and category specific lookup in 5355 message catalog 5356 5357 dcngettext -- perform domain and category specific lookup in 5358 message catalog with plural 5359 5360 dgettext -- perform lookup in message catalog for the current 5361 LC_MESSAGES locale 5362 5363 dngettext -- perform lookup in message catalog for the current 5364 locale 5365 5366 duplocale -- provide new handle for selection of locale 5367 err -- display formatted error messages 5368 error -- print error message 5369 errx -- display formatted error message and exit 5370 fcntl -- file control 5371 fflush_unlocked -- non thread safe fflush 5372 fgetwc_unlocked -- non thread safe fgetwc 5373 flock -- apply or remove an advisory lock on an open file 5374 freelocale -- free a locale object 5375 fscanf -- convert formatted input 5376 fwscanf -- convert formatted input 5377 getgrouplist -- get network group entry 5378 getloadavg -- get system load averages 5379 getopt -- parse command line options 5380 getopt_long -- parse command line options 5381 getopt_long_only -- parse command line options 5382 getsockopt -- get socket options 5383 gettext -- Search message catalogs for a string 5384 getutent -- access user accounting database entries 5385 getutent_r -- access user accounting database entries 5386 glob64 -- find pathnames matching a pattern (Large File 5387 Support) 5388 5389 globfree64 -- free memory from glob64() (Large File Support) 5390 initgroups -- initialize the supplementary group access list 5391 ioctl -- control device 5392 sockio -- socket ioctl commands 5393 ttyio -- tty ioctl commands 5394 kill -- send a signal 5395 link -- create a link to a file 5396 mbsnrtowcs -- convert a multibyte string to a wide character 5397 string 5398 5399 memmem -- locate bytes 5400 memrchr -- scan memory for a character 5401 newlocale -- allocate a locale object 5402 ngettext -- Search message catalogs for plural string 5403 pmap_getport -- Find the port number assigned to a service 5404 registered with a portmapper. 5405 5406 pmap_set -- Establishes mapping to machine's RPC Bind service. 5407 pmap_unset -- Destroys RPC Binding 5408 psignal -- print signal message 5409 regexec -- regular expression matching 5410 scanf -- convert formatted input 5411 setbuffer -- stream buffering operation 5412 setgroups -- set list of supplementary group IDs 5413 sethostname -- set host name 5414 setsockopt -- set socket options 5415 setutent -- access user accounting database entries 5416 sigandset -- build a new signal set by combining the two input 5417 sets using logical AND 5418 5419 sigisemptyset -- check for empty signal set 5420 sigorset -- build a new signal set by combining the two input 5421 sets using logical OR 5422 5423 sigreturn -- return from signal handler and cleanup stack 5424 frame 5425 5426 sscanf -- convert formatted input 5427 stime -- set time 5428 stpcpy -- copy a string returning a pointer to its end 5429 stpncpy -- copy a fixed-size string, returning a pointer to 5430 its end 5431 5432 strcasestr -- locate a substring ignoring case 5433 strerror_r -- reentrant version of strerror 5434 strndup -- return a malloc'd copy of at most the specified 5435 number of bytes of a string 5436 5437 strnlen -- determine the length of a fixed-size string 5438 strptime -- parse a time string 5439 strsep -- extract token from string 5440 strsignal -- return string describing signal 5441 strtoq -- convert string value to a long or quad_t integer 5442 strtouq -- convert a string to an unsigned long long 5443 svc_register -- Register Remote Procedure Call Interface 5444 svc_run -- Waits for RPC requests to arrive and calls service 5445 procedure. 5446 5447 svc_sendreply -- called by RPC service's dispatch routine 5448 svctcp_create -- Creates a TCP/IP-based RPC service transport. 5449 svcudp_create -- Creates a UDP-based RPC service transport. 5450 swscanf -- convert formatted input 5451 system -- execute a shell command 5452 textdomain -- set the current default message domain 5453 unlink -- remove a directory entry 5454 uselocale -- Set locale for thread 5455 utmpname -- set user accounting database 5456 vasprintf -- write formatted output to a dynamically allocated 5457 string 5458 5459 vdprintf -- write formatted output to a file descriptor 5460 verrx -- display formatted error message and exit 5461 vfscanf -- convert formatted input 5462 vfwscanf -- convert formatted input 5463 vscanf -- convert formatted input 5464 vsscanf -- convert formatted input 5465 vswscanf -- convert formatted input 5466 vsyslog -- log to system log 5467 vwscanf -- convert formatted input 5468 wait4 -- wait for process termination, BSD style 5469 waitpid -- wait for child process 5470 warn -- formatted error messages 5471 warnx -- formatted error messages 5472 wcpcpy -- copy a wide character string, returning a pointer to 5473 its end 5474 5475 wcpncpy -- copy a fixed-size string of wide characters, 5476 returning a pointer to its end 5477 5478 wcscasecmp -- compare two wide-character strings, ignoring 5479 case 5480 5481 wcsdup -- duplicate a wide-character string 5482 wcsncasecmp -- compare two fixed-size wide-character strings, 5483 ignoring case 5484 5485 wcsnlen -- determine the length of a fixed-size wide-character 5486 string 5487 5488 wcsnrtombs -- convert a wide character string to a multi-byte 5489 string 5490 5491 wcstoq -- convert wide string to long long int representation 5492 wcstouq -- convert wide string to unsigned long long int 5493 representation 5494 5495 wscanf -- convert formatted input 5496 xdr_u_int -- library routines for external data representation 5497 5498 The following interfaces are included in libc and are defined 5499 by this specification. Unless otherwise noted, these 5500 interfaces shall be included in the source standard. 5501 5502 Other interfaces listed above for libc shall behave as 5503 described in the referenced base document. 5504 5505 _IO_feof 5506 5507 Name 5508 5509 _IO_feof -- alias for feof 5510 5511 Synopsis 5512 5513 int _IO_feof(_IO_FILE * __fp); 5514 5515 Description 5516 5517 _IO_feof() tests the end-of-file indicator for the stream 5518 pointed to by __fp, returning a non-zero value if it is set. 5519 5520 _IO_feof() is not in the source standard; it is only in the 5521 binary standard. 5522 5523 _IO_getc 5524 5525 Name 5526 5527 _IO_getc -- alias for getc 5528 5529 Synopsis 5530 5531 int _IO_getc(_IO_FILE * __fp); 5532 5533 Description 5534 5535 _IO_getc() reads the next character from __fp and returns it 5536 as an unsigned char cast to an int, or EOF on end-of-file or 5537 error. 5538 5539 _IO_getc() is not in the source standard; it is only in the 5540 binary standard. 5541 5542 _IO_putc 5543 5544 Name 5545 5546 _IO_putc -- alias for putc 5547 5548 Synopsis 5549 5550 int _IO_putc(int __c, _IO_FILE * __fp); 5551 5552 Description 5553 5554 _IO_putc() writes the character __c, cast to an unsigned char, 5555 to __fp. 5556 5557 _IO_putc() is not in the source standard; it is only in the 5558 binary standard. 5559 5560 _IO_puts 5561 5562 Name 5563 5564 _IO_puts -- alias for puts 5565 5566 Synopsis 5567 5568 int _IO_puts(const char * __c); 5569 5570 Description 5571 5572 _IO_puts() writes the string __s and a trailing newline to 5573 stdout. 5574 5575 _IO_puts() is not in the source standard; it is only in the 5576 binary standard. 5577 5578 __assert_fail 5579 5580 Name 5581 5582 __assert_fail -- abort the program after false assertion 5583 5584 Synopsis 5585 5586 void __assert_fail(const char * assertion, const char * file, 5587 unsigned int line, const char * function); 5588 5589 Description 5590 5591 The __assert_fail() function is used to implement the assert() 5592 interface of ISO POSIX (2003). The __assert_fail() function 5593 shall print the given file filename, line line number, 5594 function function name and a message on the standard error 5595 stream in an unspecified format, and abort program execution 5596 via the abort() function. For example: 5597 5598 a.c:10: foobar: Assertion a == b failed. 5599 5600 If function is NULL, __assert_fail() shall omit information 5601 about the function. 5602 5603 assertion, file, and line shall be non-NULL. 5604 5605 The __assert_fail() function is not in the source standard; it 5606 is only in the binary standard. The assert() interface is not 5607 in the binary standard; it is only in the source standard. The 5608 assert() may be implemented as a macro. 5609 5610 __ctype_b_loc 5611 5612 Name 5613 5614 __ctype_b_loc -- accessor function for __ctype_b array for 5615 ctype functions 5616 5617 Synopsis 5618 5619 #include 5620 5621 const unsigned short * * __ctype_b_loc (void); 5622 5623 Description 5624 5625 The __ctype_b_loc() function shall return a pointer into an 5626 array of characters in the current locale that contains 5627 characteristics for each character in the current character 5628 set. The array shall contain a total of 384 characters, and 5629 can be indexed with any signed or unsigned char (i.e. with an 5630 index value between -128 and 255). If the application is 5631 multithreaded, the array shall be local to the current thread. 5632 5633 This interface is not in the source standard; it is only in 5634 the binary standard. 5635 5636 Return Value 5637 5638 The __ctype_b_loc() function shall return a pointer to the 5639 array of characters to be used for the ctype() family of 5640 functions (see ). 5641 5642 __ctype_get_mb_cur_max 5643 5644 Name 5645 5646 __ctype_get_mb_cur_max -- maximum length of a multibyte 5647 character in the current locale 5648 5649 Synopsis 5650 5651 size_t __ctype_get_mb_cur_max(void); 5652 5653 Description 5654 5655 __ctype_get_mb_cur_max() returns the maximum length of a 5656 multibyte character in the current locale. 5657 5658 __ctype_get_mb_cur_max() is not in the source standard; it is 5659 only in the binary standard. 5660 5661 __ctype_tolower_loc 5662 5663 Name 5664 5665 __ctype_tolower_loc -- accessor function for __ctype_b_tolower 5666 array for ctype tolower() function 5667 5668 Synopsis 5669 5670 #include 5671 5672 int32_t * * __ctype_tolower_loc(void); 5673 5674 Description 5675 5676 The __ctype_tolower_loc() function shall return a pointer into 5677 an array of characters in the current locale that contains 5678 lower case equivalents for each character in the current 5679 character set. The array shall contain a total of 384 5680 characters, and can be indexed with any signed or unsigned 5681 char (i.e. with an index value between -128 and 255). If the 5682 application is multithreaded, the array shall be local to the 5683 current thread. 5684 5685 This interface is not in the source standard; it is only in 5686 the binary standard. 5687 5688 Return Value 5689 5690 The __ctype_tolower_loc() function shall return a pointer to 5691 the array of characters to be used for the ctype() family of 5692 functions (see ). 5693 5694 __ctype_toupper_loc 5695 5696 Name 5697 5698 __ctype_toupper_loc -- accessor function for 5699 __ctype_b_toupper() array for ctype toupper() function 5700 5701 Synopsis 5702 5703 #include 5704 5705 int32_t * * __ctype_toupper_loc(void); 5706 5707 Description 5708 5709 The __ctype_toupper_loc() function shall return a pointer into 5710 an array of characters in the current locale that contains 5711 upper case equivalents for each character in the current 5712 character set. The array shall contain a total of 384 5713 characters, and can be indexed with any signed or unsigned 5714 char (i.e. with an index value between -128 and 255). If the 5715 application is multithreaded, the array shall be local to the 5716 current thread. 5717 5718 This interface is not in the source standard; it is only in 5719 the binary standard. 5720 5721 Return Value 5722 5723 The __ctype_toupper_loc() function shall return a pointer to 5724 the array of characters to be used for the ctype() family of 5725 functions (see ). 5726 5727 __cxa_atexit 5728 5729 Name 5730 5731 __cxa_atexit -- register a function to be called by exit or 5732 when a shared library is unloaded 5733 5734 Synopsis 5735 5736 int __cxa_atexit(void (*func) (void *), void * arg, void * 5737 dso_handle); 5738 5739 Description 5740 5741 __cxa_atexit() registers a function to be called by exit or 5742 when a shared library is unloaded. 5743 5744 The __cxa_atexit() function is used to implement atexit(), as 5745 described in ISO POSIX (2003). Calling 5746 atexit(func) 5747 5748 from the statically linked part of an application shall be 5749 equivalent to 5750 __cxa_atexit(func, NULL, NULL) 5751 5752 . 5753 5754 __cxa_atexit() is not in the source standard; it is only in 5755 the binary standard. atexit() is not in the binary standard; 5756 it is only in the source standard. 5757 5758 __daylight 5759 5760 Name 5761 5762 __daylight -- Daylight savings time flag 5763 5764 Synopsis 5765 5766 int __daylight; 5767 5768 Description 5769 5770 The integer variable __daylight shall implement the daylight 5771 savings time flag daylight as specified in the ISO POSIX 5772 (2003) header file . 5773 5774 __daylight is not in the source standard; it is only in the 5775 binary standard. daylight is not in the binary standard; it is 5776 only in the source standard. 5777 5778 __environ 5779 5780 Name 5781 5782 __environ -- alias for environ - user environment 5783 5784 Synopsis 5785 5786 extern char * *__environ; 5787 5788 Description 5789 5790 __environ is an alias for environ - user environment. 5791 5792 __environ has the same specification as environ. 5793 5794 __environ is not in the source standard; it is only in the 5795 binary standard. 5796 5797 __errno_location 5798 5799 Name 5800 5801 __errno_location -- address of errno variable 5802 5803 Synopsis 5804 5805 int * __errno_location(void); 5806 5807 Description 5808 5809 __errno_location() is not in the source standard; it is only 5810 in the binary standard. 5811 5812 __fpending 5813 5814 Name 5815 5816 __fpending -- returns in bytes the amount of output pending on 5817 a stream 5818 5819 Synopsis 5820 5821 #include 5822 5823 size_t __fpending(FILE * stream); 5824 5825 Description 5826 5827 __fpending() returns the amount of output in bytes pending on 5828 a stream. 5829 5830 __fpending() is not in the source standard; it is only in the 5831 binary standard. 5832 5833 __getpagesize 5834 5835 Name 5836 5837 __getpagesize -- alias for getpagesize - get current page size 5838 5839 Synopsis 5840 5841 int __getpagesize(void); 5842 5843 Description 5844 5845 __getpagesize() is an alias for getpagesize() - get current 5846 page size. 5847 5848 __getpagesize() has the same specification as getpagesize(). 5849 5850 __getpagesize() is not in the source standard; it is only in 5851 the binary standard. 5852 5853 __getpgid 5854 5855 Name 5856 5857 __getpgid -- get the process group id 5858 5859 Synopsis 5860 5861 pid_t __getpgid(pid_t pid); 5862 5863 Description 5864 5865 __getpgid() has the same specification as getpgid(). 5866 5867 __getpgid() is not in the source standard; it is only in the 5868 binary standard. 5869 5870 __h_errno_location 5871 5872 Name 5873 5874 __h_errno_location -- address of h_errno variable 5875 5876 Synopsis 5877 5878 int * __h_errno_location(void); 5879 5880 Description 5881 5882 __h_errno_location() returns the address of the h_errno 5883 variable, where h_errno is as specified in ISO POSIX (2003). 5884 5885 __h_errno_location() is not in the source standard; it is only 5886 in the binary standard. Note that h_errno itself is only in 5887 the source standard; it is not in the binary standard. 5888 5889 __isinf 5890 5891 Name 5892 5893 __isinf -- test for infinity 5894 5895 Synopsis 5896 5897 int __isinf(double arg); 5898 5899 Description 5900 5901 __isinf() has the same specification as isinf() in ISO POSIX 5902 (2003), except that the argument type for __isinf() is known 5903 to be double. 5904 5905 __isinf() is not in the source standard; it is only in the 5906 binary standard. 5907 5908 __isinff 5909 5910 Name 5911 5912 __isinff -- test for infinity 5913 5914 Synopsis 5915 5916 int __isinff(float arg); 5917 5918 Description 5919 5920 __isinff() has the same specification as isinf() in ISO POSIX 5921 (2003) except that the argument type for __isinff() is known 5922 to be float. 5923 5924 __isinff() is not in the source standard; it is only in the 5925 binary standard. 5926 5927 __isinfl 5928 5929 Name 5930 5931 __isinfl -- test for infinity 5932 5933 Synopsis 5934 5935 int __isinfl(long double arg); 5936 5937 Description 5938 5939 __isinfl() has the same specification as isinf() in the ISO 5940 POSIX (2003), except that the argument type for __isinfl() is 5941 known to be long double. 5942 5943 __isinfl() is not in the source standard; it is only in the 5944 binary standard. 5945 5946 __isnan 5947 5948 Name 5949 5950 __isnan -- test for infinity 5951 5952 Synopsis 5953 5954 int __isnan(double arg); 5955 5956 Description 5957 5958 __isnan() has the same specification as isnan() in ISO POSIX 5959 (2003), except that the argument type for __isnan() is known 5960 to be double. 5961 5962 __isnan() is not in the source standard; it is only in the 5963 binary standard. 5964 5965 __isnanf 5966 5967 Name 5968 5969 __isnanf -- test for infinity 5970 5971 Synopsis 5972 5973 int __isnanf(float arg); 5974 5975 Description 5976 5977 __isnanf() has the same specification as isnan() in ISO POSIX 5978 (2003), except that the argument type for __isnanf() is known 5979 to be float. 5980 5981 __isnanf() is not in the source standard; it is only in the 5982 binary standard. 5983 5984 __isnanl 5985 5986 Name 5987 5988 __isnanl -- test for infinity 5989 5990 Synopsis 5991 5992 int __isnanl(long double arg); 5993 5994 Description 5995 5996 __isnanl() has the same specification as isnan() in ISO POSIX 5997 (2003), except that the argument type for __isnanl() is known 5998 to be long double. 5999 6000 __isnanl() is not in the source standard; it is only in the 6001 binary standard. 6002 6003 __libc_current_sigrtmax 6004 6005 Name 6006 6007 __libc_current_sigrtmax -- return number of available 6008 real-time signal with lowest priority 6009 6010 Synopsis 6011 6012 int __libc_current_sigrtmax(void); 6013 6014 Description 6015 6016 __libc_current_sigrtmax() returns the number of an available 6017 real-time signal with the lowest priority. 6018 6019 __libc_current_sigrtmax() is not in the source standard; it is 6020 only in the binary standard. 6021 6022 __libc_current_sigrtmin 6023 6024 Name 6025 6026 __libc_current_sigrtmin -- return number of available 6027 real-time signal with highest priority 6028 6029 Synopsis 6030 6031 int __libc_current_sigrtmin(void); 6032 6033 Description 6034 6035 __libc_current_sigrtmin() returns the number of an available 6036 real-time signal with the highest priority. 6037 6038 __libc_current_sigrtmin() is not in the source standard; it is 6039 only in the binary standard. 6040 6041 __libc_start_main 6042 6043 Name 6044 6045 __libc_start_main -- initialization routine 6046 6047 Synopsis 6048 6049 int __libc_start_main(int *(main) (int, char * *, char * *), 6050 int argc, char * * ubp_av, void (*init) (void), void (*fini) 6051 (void), void (*rtld_fini) (void), void (* stack_end)); 6052 6053 Description 6054 6055 The __libc_start_main() function shall initialize the process, 6056 call the main function with appropriate arguments, and handle 6057 the return from main(). 6058 6059 __libc_start_main() is not in the source standard; it is only 6060 in the binary standard. 6061 6062 __lxstat 6063 6064 Name 6065 6066 __lxstat -- inline wrapper around call to lxstat 6067 6068 Synopsis 6069 6070 #include 6071 6072 int __lxstat(int version, char * __path, struct stat 6073 __statbuf); 6074 6075 Description 6076 6077 __lxstat() is an inline wrapper around call to lxstat(). 6078 6079 __lxstat() is not in the source standard; it is only in the 6080 binary standard. 6081 6082 __mempcpy 6083 6084 Name 6085 6086 __mempcpy -- copy given number of bytes of source to 6087 destination 6088 6089 Synopsis 6090 6091 #include 6092 6093 ptr_t __mempcpy(ptr_t restrict dest, const ptr_t restrict src, 6094 size_t n); 6095 6096 Description 6097 6098 __mempcpy() copies n bytes of source to destination, returning 6099 pointer to bytes after the last written byte. 6100 6101 __mempcpy() is not in the source standard; it is only in the 6102 binary standard. 6103 6104 __rawmemchr 6105 6106 Name 6107 6108 __rawmemchr -- scan memory 6109 6110 Synopsis 6111 6112 #include 6113 6114 ptr_t __rawmemchr(const ptr_t s, int c); 6115 6116 Description 6117 6118 __rawmemchr() searches in s for c. 6119 6120 __rawmemchr() is a weak alias to rawmemchr(). It is similar to 6121 memchr(), but it has no length limit. 6122 6123 __rawmemchr() is not in the source standard; it is only in the 6124 binary standard. 6125 6126 __register_atfork 6127 6128 Name 6129 6130 __register_atfork -- alias for register_atfork 6131 6132 Synopsis 6133 6134 int __register_atfork(void (*prepare) (void), void (*parent) 6135 (void), void (*child) (void), void * __dso_handle); 6136 6137 Description 6138 6139 __register_atfork() implements pthread_atfork() as specified 6140 in ISO POSIX (2003). The additional parameter __dso_handle 6141 allows a shared object to pass in it's handle so that 6142 functions registered by __register_atfork() can be 6143 unregistered by the runtime when the shared object is 6144 unloaded. 6145 6146 __sigsetjmp 6147 6148 Name 6149 6150 __sigsetjmp -- save stack context for non-local goto 6151 6152 Synopsis 6153 6154 int __sigsetjmp(jmp_buf env, int savemask); 6155 6156 Description 6157 6158 __sigsetjmp() has the same behavior as sigsetjmp() as 6159 specified by ISO POSIX (2003). 6160 6161 __sigsetjmp() is not in the source standard; it is only in the 6162 binary standard. 6163 6164 __stpcpy 6165 6166 Name 6167 6168 __stpcpy -- copy a string returning a pointer to its end 6169 6170 Synopsis 6171 6172 #include 6173 6174 char * __stpcpy(char * dest, const char * src); 6175 6176 Description 6177 6178 __stpcpy() copies the string src (including the terminating /0 6179 character) to the array dest. The strings may not overlap, and 6180 dest must be large enough to receive the copy. 6181 6182 Return Value 6183 6184 __stpcpy() returns a pointer to the end of the string dest 6185 (that is, the address of the terminating NULL character) 6186 rather than the beginning. 6187 6188 __stpcpy() has the same specification as stpcpy(). 6189 6190 __stpcpy() is not in the source standard; it is only in the 6191 binary standard. 6192 6193 __strdup 6194 6195 Name 6196 6197 __strdup -- alias for strdup 6198 6199 Synopsis 6200 6201 char * __strdup(const char string); 6202 6203 Description 6204 6205 __strdup() has the same specification as strdup(). 6206 6207 __strdup() is not in the source standard; it is only in the 6208 binary standard. 6209 6210 __strtod_internal 6211 6212 Name 6213 6214 __strtod_internal -- underlying function for strtod 6215 6216 Synopsis 6217 6218 double __strtod_internal(const char * __nptr, char * * 6219 __endptr, int __group); 6220 6221 Description 6222 6223 __group shall be 0 or the behavior of __strtod_internal() is 6224 undefined. 6225 6226 __strtod_internal(__nptr, __endptr, 0)() has the same 6227 specification as strtod(__nptr, __endptr)(). 6228 6229 __strtod_internal() is not in the source standard; it is only 6230 in the binary standard. 6231 6232 __strtof_internal 6233 6234 Name 6235 6236 __strtof_internal -- underlying function for strtof 6237 6238 Synopsis 6239 6240 float __strtof_internal(const char * __nptr, char * * 6241 __endptr, int __group); 6242 6243 Description 6244 6245 __group shall be 0 or the behavior of __strtof_internal() is 6246 undefined. 6247 6248 __strtof_internal(__nptr, __endptr, 0)() has the same 6249 specification as strtof(__nptr, __endptr)(). 6250 6251 __strtof_internal() is not in the source standard; it is only 6252 in the binary standard. 6253 6254 __strtok_r 6255 6256 Name 6257 6258 __strtok_r -- alias for strtok_r 6259 6260 Synopsis 6261 6262 char * __strtok_r(char * restrict s, const char * restrict 6263 delim, char * * restrict save_ptr); 6264 6265 Description 6266 6267 __strtok_r() has the same specification as strtok_r(). 6268 6269 __strtok_r() is not in the source standard; it is only in the 6270 binary standard. 6271 6272 __strtol_internal 6273 6274 Name 6275 6276 __strtol_internal -- alias for strtol 6277 6278 Synopsis 6279 6280 long int __strtol_internal(const char * __nptr, char * * 6281 __endptr, int __base, int __group); 6282 6283 Description 6284 6285 __group shall be 0 or the behavior of __strtol_internal() is 6286 undefined. 6287 6288 __strtol_internal(__nptr, __endptr, __base, 0) has the same 6289 specification as strtol(__nptr, __endptr, __base). 6290 6291 __strtol_internal() is not in the source standard; it is only 6292 in the binary standard. 6293 6294 __strtold_internal 6295 6296 Name 6297 6298 __strtold_internal -- underlying function for strtold 6299 6300 Synopsis 6301 6302 long double __strtold_internal(const char * __nptr, char * * 6303 __endptr, int __group); 6304 6305 Description 6306 6307 __group shall be 0 or the behavior of __strtold_internal() is 6308 undefined. 6309 6310 __strtold_internal(__nptr, __endptr, 0) has the same 6311 specification as strtold(__nptr, __endptr). 6312 6313 __strtold_internal() is not in the source standard; it is only 6314 in the binary standard. 6315 6316 __strtoll_internal 6317 6318 Name 6319 6320 __strtoll_internal -- underlying function for strtoll 6321 6322 Synopsis 6323 6324 long long __strtoll_internal(const char * __nptr, char * * 6325 __endptr, int __base, int __group); 6326 6327 Description 6328 6329 __group shall be 0 or the behavior of __strtoll_internal() is 6330 undefined. 6331 6332 __strtoll_internal(__nptr, __endptr, __base, 0) has the same 6333 specification as strtoll(__nptr, __endptr, __base). 6334 6335 __strtoll_internal() is not in the source standard; it is only 6336 in the binary standard. 6337 6338 __strtoul_internal 6339 6340 Name 6341 6342 __strtoul_internal -- underlying function for strtoul 6343 6344 Synopsis 6345 6346 unsigned long int __strtoul_internal(const char * __nptr, char 6347 * * __endptr, int __base, int __group); 6348 6349 Description 6350 6351 __group shall be 0 or the behavior of __strtoul_internal() is 6352 undefined. 6353 6354 __strtoul_internal(__nptr, __endptr, __base, 0) has the same 6355 specification as strtoul(__nptr, __endptr, __base). 6356 6357 __strtoul_internal() is not in the source standard; it is only 6358 in the binary standard. 6359 6360 __strtoull_internal 6361 6362 Name 6363 6364 __strtoull_internal -- underlying function for strtoull 6365 6366 Synopsis 6367 6368 unsigned long long __strtoull_internal(const char * __nptr, 6369 char * * __endptr, int __base, int __group); 6370 6371 Description 6372 6373 __group shall be 0 or the behavior of __strtoull_internal() is 6374 undefined. 6375 6376 __strtoull_internal(__nptr, __endptr, __base, 0) has the same 6377 specification as strtoull(__nptr, __endptr, __base). 6378 6379 __strtoull_internal() is not in the source standard; it is 6380 only in the binary standard. 6381 6382 __sysconf 6383 6384 Name 6385 6386 __sysconf -- get configuration information at runtime 6387 6388 Synopsis 6389 6390 #include 6391 6392 long __sysconf(int name); 6393 6394 Description 6395 6396 __sysconf() gets configuration information at runtime. 6397 6398 __sysconf() is weak alias to sysconf(). 6399 6400 __sysconf() has the same specification as sysconf(). 6401 6402 __sysconf() is not in the source standard; it is only in the 6403 binary standard. 6404 6405 __sysv_signal 6406 6407 Name 6408 6409 __sysv_signal -- signal handling 6410 6411 Synopsis 6412 6413 __sighandler_t __sysv_signal(int sig, __sighandler_t handler); 6414 6415 Description 6416 6417 __sysv_signal() has the same behavior as signal() as specified 6418 by ISO POSIX (2003). 6419 6420 __sysv_signal() is not in the source standard; it is only in 6421 the binary standard. 6422 6423 __timezone 6424 6425 Name 6426 6427 -- global variable containing timezone 6428 6429 Synopsis 6430 6431 long int __timezone; 6432 6433 Description 6434 6435 __timezone() has the same specification as timezone() in the 6436 ISO POSIX (2003) 6437 6438 __tzname 6439 6440 Name 6441 6442 -- global variable containing the timezone 6443 6444 Synopsis 6445 6446 char * __tzname[2]; 6447 6448 Description 6449 6450 __tzname has the same specification as tzname in the ISO POSIX 6451 (2003). 6452 6453 Note that the array size of 2 is explicit in the ISO POSIX 6454 (2003), but not in the SUSv2. 6455 6456 __wcstod_internal 6457 6458 Name 6459 6460 __wcstod_internal -- underlying function for wcstod 6461 6462 Synopsis 6463 6464 double __wcstod_internal(const wchar_t * nptr, wchar_t * * 6465 endptr, int group); 6466 6467 Description 6468 6469 group shall be 0 or the behavior of __wcstod_internal() is 6470 undefined. 6471 6472 __wcstod_internal(nptr, endptr, 0) has the same specification 6473 as wcstod(nptr, endptr). 6474 6475 __wcstod_internal() is not in the source standard; it is only 6476 in the binary standard. 6477 6478 __wcstof_internal 6479 6480 Name 6481 6482 __wcstof_internal -- underlying function for wcstof 6483 6484 Synopsis 6485 6486 float __wcstof_internal(const wchar_t * nptr, wchar_t * * 6487 endptr, int group); 6488 6489 Description 6490 6491 group shall be 0 or the behavior of __wcstof_internal() is 6492 undefined. 6493 6494 __wcstof_internal(nptr, endptr, 0) has the same specification 6495 as wcstof(nptr, endptr). 6496 6497 __wcstof_internal() is not in the source standard; it is only 6498 in the binary standard. 6499 6500 __wcstol_internal 6501 6502 Name 6503 6504 __wcstol_internal -- underlying function for wcstol 6505 6506 Synopsis 6507 6508 long __wcstol_internal(const wchar_t * nptr, wchar_t * * 6509 endptr, int base, int group); 6510 6511 Description 6512 6513 group shall be 0 or the behavior of __wcstol_internal() is 6514 undefined. 6515 6516 __wcstol_internal(nptr, endptr, base, 0) has the same 6517 specification as wcstol(nptr, endptr, base). 6518 6519 __wcstol_internal() is not in the source standard; it is only 6520 in the binary standard. 6521 6522 __wcstold_internal 6523 6524 Name 6525 6526 __wcstold_internal -- underlying function for wcstold 6527 6528 Synopsis 6529 6530 long double __wcstold_internal(const wchar_t * nptr, wchar_t * 6531 * endptr, int group); 6532 6533 Description 6534 6535 group shall be 0 or the behavior of __wcstold_internal() is 6536 undefined. 6537 6538 __wcstold_internal(nptr, endptr, 0) has the same specification 6539 as wcstold(nptr, endptr). 6540 6541 __wcstold_internal() is not in the source standard; it is only 6542 in the binary standard. 6543 6544 __wcstoul_internal 6545 6546 Name 6547 6548 __wcstoul_internal -- underlying function for wcstoul 6549 6550 Synopsis 6551 6552 unsigned long __wcstoul_internal(const wchar_t * restrict 6553 nptr, wchar_t * * restrict endptr, int base, int group); 6554 6555 Description 6556 6557 group shall be 0 or the behavior of __wcstoul_internal() is 6558 undefined. 6559 6560 __wcstoul_internal(nptr, endptr, base, 0)() has the same 6561 specification as wcstoul(nptr, endptr, base)(). 6562 6563 __wcstoul_internal() is not in the source standard; it is only 6564 in the binary standard. 6565 6566 __xmknod 6567 6568 Name 6569 6570 __xmknod -- make block or character special file 6571 6572 Synopsis 6573 6574 int __xmknod(int ver, const char * path, mode_t mode, dev_t * 6575 dev); 6576 6577 Description 6578 6579 The __xmknod() shall implement the mknod() interface from ISO 6580 POSIX (2003). 6581 6582 __xmknod(1, path, mode, dev) has the same specification as 6583 mknod(path, mode, dev). 6584 6585 ver shall be 1 or the behavior of __xmknod() is undefined. 6586 6587 The __xmknod() function is not in the source standard; it is 6588 only in the binary standard. The mknod() function is not in 6589 the binary standard; it is only in the source standard. 6590 6591 __xstat 6592 6593 Name 6594 6595 __xstat -- Get File Status 6596 6597 Synopsis 6598 6599 #include 6600 #include 6601 6602 int __xstat(int ver, const char * path, struct stat * 6603 stat_buf); 6604 6605 int __lxstat(int ver, const char * path, struct stat * 6606 stat_buf); 6607 6608 int __fxstat(int ver, int fildes, struct stat * stat_buf); 6609 6610 Description 6611 6612 The functions __xstat(), __lxstat(), and __fxstat() shall 6613 implement the ISO POSIX (2003) functions stat(), lstat(), and 6614 fstat() respectively. 6615 6616 ver shall be 3 or the behavior of these functions is 6617 undefined. 6618 6619 __xstat(3, path, stat_buf) shall behave as stat(path, 6620 stat_buf) as specified by ISO POSIX (2003). 6621 6622 __lxstat(3, path, stat_buf) shall behave as lstat(path, 6623 stat_buf) as specified by ISO POSIX (2003). 6624 6625 __fxstat(3, fildes, stat_buf) shall behave as fstat(fildes, 6626 stat_buf) as specified by ISO POSIX (2003). 6627 6628 __xstat(), __lxstat(), and __fxstat() are not in the source 6629 standard; they are only in the binary standard. 6630 6631 stat(), lstat(), and fstat() are not in the binary standard; 6632 they are only in the source standard. 6633 6634 __xstat64 6635 6636 Name 6637 6638 __xstat64 -- Get File Status 6639 6640 Synopsis 6641 6642 #define _LARGEFILE_SOURCE 1 6643 #include 6644 #include 6645 6646 int __xstat64(int ver, const char * path, struct stat64 * 6647 stat_buf); 6648 6649 int __lxstat64(int ver, const char * path, struct stat64 * 6650 stat_buf); 6651 6652 int __fxstat64(int ver, int fildes, struct stat64 * stat_buf); 6653 6654 Description 6655 6656 The functions __xstat64(), __lxstat64(), and __fxstat64() 6657 shall implement the Large File Support functions stat64(), 6658 lstat64(), and fstat64() respectively. 6659 6660 ver shall be 3 or the behavior of these functions is 6661 undefined. 6662 6663 __xstat64(3, path, stat_buf) shall behave as stat(path, 6664 stat_buf) as specified by Large File Support. 6665 6666 __lxstat64(3, path, stat_buf) shall behave as lstat(path, 6667 stat_buf) as specified by Large File Support. 6668 6669 __fxstat64(3, fildes, stat_buf) shall behave as fstat(fildes, 6670 stat_buf) as specified by Large File Support. 6671 6672 __xstat64(), __lxstat64(), and __fxstat64() are not in the 6673 source standard; they are only in the binary standard. 6674 6675 stat64(), lstat64(), and fstat64() are not in the binary 6676 standard; they are only in the source standard. 6677 6678 _environ 6679 6680 Name 6681 6682 _environ -- alias for environ - user environment 6683 6684 Synopsis 6685 6686 extern char * *_environ; 6687 6688 Description 6689 6690 _environ is an alias for environ - user environment. 6691 6692 _nl_msg_cat_cntr 6693 6694 Name 6695 6696 _nl_msg_cat_cntr -- new catalog load counter 6697 6698 Synopsis 6699 6700 #include 6701 6702 extern int _nl_msg_cat_cntr; 6703 6704 Description 6705 6706 _nl_msg_cat_cntr is incremented each time a new catalong is 6707 loaded. It is a variable defined in loadmsgcat.c and is used 6708 by Message catalogs for internationalization. 6709 6710 _sys_errlist 6711 6712 Name 6713 6714 _sys_errlist -- array containing the "C" locale strings used 6715 by strerror() 6716 6717 Synopsis 6718 6719 #include 6720 6721 extern const char *const _sys_errlist[]; 6722 6723 Description 6724 6725 _sys_errlist is an array containing the "C" locale strings 6726 used by strerror(). This normally should not be used directly. 6727 strerror() provides all of the needed functionality. 6728 6729 _sys_siglist 6730 6731 Name 6732 6733 _sys_siglist -- array containing the names of the signal names 6734 6735 Synopsis 6736 6737 #include 6738 6739 extern const char *const _sys_siglist[NSIG]; 6740 6741 Description 6742 6743 _sys_siglist is an array containing the names of the signal 6744 names. 6745 6746 The _sys_siglist array is only in the binary standard; it is 6747 not in the source standard. Applications wishing to access the 6748 names of signals should use the strsignal() function. 6749 6750 acct 6751 6752 Name 6753 6754 acct -- switch process accounting on or off 6755 6756 Synopsis 6757 6758 #include 6759 6760 int acct(const char * filename); 6761 6762 Description 6763 6764 When filename is the name of an existing file, acct() turns 6765 accounting on and appends a record to filename for each 6766 terminating process. When filename is NULL, acct() turns 6767 accounting off. 6768 6769 Return Value 6770 6771 On success, 0 is returned. On error, -1 is returned and the 6772 global variable errno is set appropriately. 6773 6774 Errors 6775 6776 ENOSYS 6777 BSD process accounting has not been enabled when the 6778 operating system kernel was compiled. The kernel 6779 configuration parameter controlling this feature is 6780 CONFIG_BSD_PROCESS_ACCT. 6781 6782 ENOMEM 6783 Out of memory. 6784 6785 EPERM 6786 The calling process has no permission to enable process 6787 accounting. 6788 6789 EACCES 6790 filename is not a regular file. 6791 6792 EIO 6793 Error writing to the filename. 6794 6795 EUSERS 6796 There are no more free file structures or we run out of 6797 memory. 6798 6799 adjtime 6800 6801 Name 6802 6803 adjtime -- correct the time to allow synchronization of the 6804 system clock 6805 6806 Synopsis 6807 6808 #include 6809 6810 int adjtime(const struct timeval * delta, struct timeval * 6811 olddelta); 6812 6813 Description 6814 6815 adjtime() makes small adjustments to the system time as 6816 returned by gettimeofday()(2), advancing or retarding it by 6817 the time specified by the timeval delta. If delta is negative, 6818 the clock is slowed down by incrementing it more slowly than 6819 normal until the correction is complete. If delta is positive, 6820 a larger increment than normal is used. The skew used to 6821 perform the correction is generally a fraction of one percent. 6822 Thus, the time is always a monotonically increasing function. 6823 A time correction from an earlier call to adjtime() may not be 6824 finished when adjtime() is called again. If olddelta is 6825 non-NULL, the structure pointed to will contain, upon return, 6826 the number of microseconds still to be corrected from the 6827 earlier call. 6828 6829 adjtime() may be used by time servers that synchronize the 6830 clocks of computers in a local area network. Such time servers 6831 would slow down the clocks of some machines and speed up the 6832 clocks of others to bring them to the average network time. 6833 6834 The adjtime() is restricted to the super-user. 6835 6836 Return Value 6837 6838 On success, 0 is returned. On error, -1 is returned and the 6839 global variable errno is set appropriately. 6840 6841 Errors 6842 6843 EFAULT 6844 An argument points outside the process's allocated 6845 address space. 6846 6847 EPERM 6848 The process's effective user ID is not that of the 6849 super-user. 6850 6851 asprintf 6852 6853 Name 6854 6855 asprintf -- write formatted output to a dynamically allocated 6856 string 6857 6858 Synopsis 6859 6860 #include 6861 6862 int asprintf(char ** restrict ptr, const char * restrict 6863 format, ...); 6864 6865 Description 6866 6867 The asprintf() function shall behave as sprintf(), except that 6868 the output string shall be dynamically allocated space of 6869 sufficient length to hold the resulting string. The address of 6870 this dynamically allocated string shall be stored in the 6871 location referenced by ptr. 6872 6873 Return Value 6874 6875 Refer to fprintf(). 6876 6877 Errors 6878 6879 Refer to fprintf(). 6880 6881 bind_textdomain_codeset 6882 6883 Name 6884 6885 bind_textdomain_codeset -- specify encoding for message 6886 retrieval 6887 6888 Synopsis 6889 6890 #include 6891 6892 char * bind_textdomain_codeset (const char * domainname , 6893 const char * codeset ); 6894 6895 Description 6896 6897 The bind_textdomain_codeset function can be used to specify 6898 the output codeset for message catalogs for domain domainname. 6899 The codeset argument shall be a valid codeset name which can 6900 be used tor the iconv_open function, or a null pointer. If the 6901 codeset argument is the null pointer, then function returns 6902 the currently selected codeset for the domain with the name 6903 domainname. It shall return a null pointer if no codeset has 6904 yet been selected 6905 6906 Each successive call to bind_textdomain_codeset() function 6907 overrrides the settings made by the preceding call with the 6908 same domainname. 6909 6910 The bind_textdomain_codeset() function shall return a pointer 6911 to a string containing the name of the selected codeset. The 6912 string shall be allocated internally in the function and shall 6913 not be changed or freed by the user. 6914 6915 The bind_textdomain_codeset() function returns a pointer to a 6916 string containing the name of the selected codeset. The string 6917 is allocated internally in the function and shall not be 6918 changed by the user. 6919 6920 Parameters 6921 6922 domainname 6923 The domainname argument is applied to the currently 6924 active LC_MESSAGE locale. It is equivalent in syntax 6925 and meaning to the domainname argument to textdomain, 6926 except that the selection of the domain is valid only 6927 for the duration of the call. 6928 6929 codeset 6930 The name of the output codeset for the selected domain, 6931 or NULL to select the current codeset. 6932 6933 If domainname is the null pointer, or is an empty 6934 string, bind_textdomain_codeset() shall fail, but need 6935 not set errno. 6936 6937 Return Value 6938 6939 Returns the currently selected codeset name. It returns a null 6940 pointer if no codeset has yet been selected. 6941 6942 Errors 6943 6944 ENOMEM 6945 Insufficient memory available to allocate return value. 6946 6947 See Also 6948 6949 gettext, dgettext, ngettext, dngettext, dcgettext, dcngettext, 6950 textdomain, bindtextdomain 6951 6952 bindresvport 6953 6954 Name 6955 6956 bindresvport -- bind socket to privileged IP port 6957 6958 Synopsis 6959 6960 #include 6961 #include 6962 6963 int bindresvport(int sd, struct sockaddr_in * sin); 6964 6965 Description 6966 6967 If the process has appropriate privilege, the bindresvport() 6968 function shall bind a socket to a privileged IP port. 6969 6970 Return Value 6971 6972 On success, 0 is returned. On error, -1 is returned and the 6973 global variable errno is set appropriately. 6974 6975 Errors 6976 6977 EPERM 6978 The process did not have appropriate privilege. 6979 6980 EPFNOSUPPORT 6981 Address of sin did not match address family of sd. 6982 6983 bindtextdomain 6984 6985 Name 6986 6987 bindtextdomain -- specify the location of a message catalog 6988 6989 Synopsis 6990 6991 #include 6992 6993 char * bindtextdomain(const char * domainname, const char * 6994 dirname); 6995 6996 Description 6997 6998 The bindtextdomain() shall set the the base directory of the 6999 hierarchy containing message catalogs for a given message 7000 domain. 7001 7002 The bindtextdomain() function specifies that the domainname 7003 message catalog can be found in the dirname directory 7004 hierarchy, rather than in the system default locale data base. 7005 7006 If dirname is not NULL, the base directory for message 7007 catalogs belonging to domain domainname shall be set to 7008 dirname. If dirname is NULL, the base directory for message 7009 catalogs shall not be altered. 7010 7011 The function shall make copies of the argument strings as 7012 needed. 7013 7014 dirname can be an absolute or relative pathname. 7015 7016 Note: Applications that wish to use chdir() should always 7017 use absolute pathnames to avoid misadvertently selecting 7018 the wrong or non-existant directory. 7019 7020 If domainname is the null pointer, or is an empty string, 7021 bindtextdomain() shall fail, but need not set errno. 7022 7023 The bindtextdomain() function shall return a pointer to a 7024 string containing the name of the selected directory. The 7025 string shall be allocated internally in the function and shall 7026 not be changed or freed by the user. 7027 7028 Return Value 7029 7030 On success, bindtextdomain() shall return a pointer to a 7031 string containing the directory pathname currently bound to 7032 the domain. On failure, a NULL pointer is returned, and the 7033 global variable errno may be set to indicate the error. 7034 7035 Errors 7036 7037 ENOMEM 7038 Insufficient memory was available. 7039 7040 See Also 7041 7042 gettext, dgettext, ngettext, dngettext, dcgettext, dcngettext, 7043 textdomain, bind_textdomain_codeset 7044 7045 cfmakeraw 7046 7047 Name 7048 7049 cfmakeraw -- get and set terminal attributes 7050 7051 Synopsis 7052 7053 #include 7054 7055 void cfmakeraw(struct termios * termios_p); 7056 7057 Description 7058 7059 The cfmakeraw() function shall set the attributes of the 7060 termios structure referenced by termios_p as follows: 7061 termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP 7062 |INLCR|IGNCR|ICRNL|IXON); 7063 7064 termios_p->c_oflag &= ~OPOST; 7065 7066 termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN); 7067 7068 termios_p->c_cflag &= ~(CSIZE|PARENB); 7069 7070 termios_p->c_cflag |= CS8; 7071 7072 termios_p shall point to a termios structure that contains the 7073 following members: 7074 tcflag_t c_iflag; /* input modes */ 7075 tcflag_t c_oflag; /* output modes */ 7076 tcflag_t c_cflag; /* control modes */ 7077 tcflag_t c_lflag; /* local modes */ 7078 cc_t c_cc[NCCS]; /* control chars */ 7079 7080 cfsetspeed 7081 7082 Name 7083 7084 cfsetspeed -- set terminal input and output data rate 7085 7086 Synopsis 7087 7088 #include 7089 7090 int cfsetspeed(struct termios *t, speed_t speed); 7091 7092 Description 7093 7094 cfsetspeed() sets the baud rate values in the termios 7095 structure. The effects of the function on the terminal as 7096 described below do not become effective, nor are all errors 7097 detected, until the tcsetattr() function is called. Certain 7098 values for baud rates set in termios and passed to tcsetattr() 7099 have special meanings. 7100 7101 Getting and Setting the Baud Rate 7102 7103 Input and output baud rates are found in the termios 7104 structure. The unsigned integer speed_t is typdef'd in the 7105 include file termios.h. The value of the integer corresponds 7106 directly to the baud rate being represented; however, the 7107 following symbolic values are defined. 7108 #define B0 0 7109 #define B50 50 7110 #define B75 75 7111 #define B110 110 7112 #define B134 134 7113 #define B150 150 7114 #define B200 200 7115 #define B300 300 7116 #define B600 600 7117 #define B1200 1200 7118 #define B1800 1800 7119 #define B2400 2400 7120 #define B4800 4800 7121 #define B9600 9600 7122 #define B19200 19200 7123 #define B38400 38400 7124 #ifndef _POSIX_SOURCE 7125 #define EXTA 19200 7126 #define EXTB 38400 7127 #endif /*_POSIX_SOURCE */ 7128 7129 cfsetspeed() sets both the input and output baud rates in the 7130 termios structure referenced by t to speed. 7131 7132 Return Value 7133 7134 On success, 0 is returned. On error, -1 is returned and the 7135 global variable errno is set appropriately. 7136 7137 Errors 7138 7139 EINVAL 7140 Invalid speed argument 7141 7142 daemon 7143 7144 Name 7145 7146 daemon -- run in the background 7147 7148 Synopsis 7149 7150 #include 7151 7152 int daemon(int nochdir, int noclose); 7153 7154 Description 7155 7156 The daemon() function shall create a new process, detached 7157 from the controlling terminal. If successful, the calling 7158 process shall exit and the new process shall continue to 7159 execute the application in the background. If nochdir 7160 evaluates to true, the current directory shall not be changed. 7161 Otherwise, daemon() shall change the current working directory 7162 to the root (`/'). If noclose evaluates to true the standard 7163 input, standard output, and standard error file descriptors 7164 shall not be altered. Otherwise, daemon() shall close the 7165 standard input, standard output and standard error file 7166 descriptors and reopen them attached to /dev/null. 7167 7168 Return Value 7169 7170 On error, -1 is returned, and the global variable errno is set 7171 to any of the errors specified for the library functions 7172 fork() and setsid(). 7173 7174 dcgettext 7175 7176 Name 7177 7178 dcgettext -- perform domain and category specific lookup in 7179 message catalog 7180 7181 Synopsis 7182 7183 #include 7184 #include 7185 7186 char * dcgettext(const char * domainname, const char * msgid, 7187 int category); 7188 7189 Description 7190 7191 The dcgettext() function is a domain specified version of 7192 gettext(). 7193 7194 The dcgettext() function shall lookup the translation in the 7195 current locale of the message identified by msgid in the 7196 domain specified by domainname and in the locale category 7197 specified by category. If domainname is NULL, the current 7198 default domain shall be used. The msgid argument shall be a 7199 NULL-terminated string to be matched in the catalogue. 7200 category shall specify the locale category to be used for 7201 retrieving message strings. The category parameter shall be 7202 one of LC_CTYPE, LC_COLLATE, LC_MESSAGES, LC_MONETARY, 7203 LC_NUMERIC, or LC_TIME. The default domain shall not be 7204 changed by a call to dcgettext. 7205 7206 Return Value 7207 7208 If a translation was found in one of the specified catalogs, 7209 it shall be converted to the current locale's codeset and 7210 returned. The resulting NULL-terminated string shall be 7211 allocated by the dcgettext function, and must not be modified 7212 or freed. If no translation was found, or category was 7213 invalid, msgid shall be returned. 7214 7215 Errors 7216 7217 dcgettext() shall not modify the errno global variable. 7218 7219 See Also 7220 7221 gettext, dgettext, ngettext, dngettext, dcngettext, 7222 textdomain, bindtextdomain, bind_textdomain_codeset 7223 7224 dcngettext 7225 7226 Name 7227 7228 dcngettext -- perform domain and category specific lookup in 7229 message catalog with plural 7230 7231 Synopsis 7232 7233 #include 7234 #include 7235 7236 char * dcngettext(const char * domainname, const char * 7237 msgid1, const char * msgid2, unsigned long int n, int 7238 category); 7239 7240 Description 7241 7242 The dcngettext() function is a domain specific version of 7243 gettext, capable of returning either a singular or plural form 7244 of the message. The dcngettext() function shall lookup the 7245 translation in the current locale of the message identified by 7246 msgid1 in the domain specified by domainname and in the locale 7247 category specified by category. If domainname is NULL, the 7248 current default domain shall be used. The msgid1 argument 7249 shall be a NULL-terminated string to be matched in the 7250 catalogue. category shall specify the locale category to be 7251 used for retrieving message strings. The category parameter 7252 shall be one of LC_CTYPE, LC_COLLATE, LC_MESSAGES, 7253 LC_MONETARY, LC_NUMERIC, or LC_TIME. The default domain shall 7254 not be changed by a call to dcgettext(). If n is 1 then the 7255 singular version of the message is returned, otherwise one of 7256 the plural forms is returned, depending on the value of n and 7257 the current locale settings. 7258 7259 Return Value 7260 7261 If a translation corresponding to the value of n was found in 7262 one of the specified catalogs for msgid1, it shall be 7263 converted to the current locale's codeset and returned. The 7264 resulting NULL-terminated string shall be allocated by the 7265 dcngettext() function, and must not be modified or freed. If 7266 no translation was found, or category was invalid, msgid1 7267 shall be returned if n has the value 1, otherwise msgid2 shall 7268 be returned. 7269 7270 Errors 7271 7272 dcngettext() shall not modify the errno global variable. 7273 7274 See Also 7275 7276 gettext, dgettext, ngettext, dngettext, dcgettext, textdomain, 7277 bindtextdomain, bind_textdomain_codeset 7278 7279 dgettext 7280 7281 Name 7282 7283 dgettext -- perform lookup in message catalog for the current 7284 LC_MESSAGES locale 7285 7286 Synopsis 7287 7288 #include 7289 7290 char * dgettext(const char * domainname, const char * msgid); 7291 7292 Description 7293 7294 dgettext() is a domain specified version of gettext(). 7295 7296 Parameters 7297 7298 domainname 7299 dgettext() applies domainname to the currently active 7300 LC_MESSAGE locale. This usage is equivalent in syntax 7301 and meaning to the textdomain() function's application 7302 of domainname, except that the selection of the domain 7303 in dgettext() is valid only for the duration of the 7304 call. 7305 7306 msgid 7307 a NULL-terminated string to be matched in the catalogue 7308 with respect to a specific domain and the current 7309 locale. 7310 7311 Return Value 7312 7313 On success of a msgid query, the translated NULL-terminated 7314 string is returned. On error, the original msgid is returned. 7315 The length of the string returned is undetermined until 7316 dgettext() is called. 7317 7318 Errors 7319 7320 dgettext() will not modify the errno global variable. 7321 7322 See Also 7323 7324 gettext, dgettext, ngettext, dngettext, dcgettext, dcngettext, 7325 textdomain, bindtextdomain, bind_textdomain_codeset 7326 7327 dngettext 7328 7329 Name 7330 7331 dngettext -- perform lookup in message catalog for the current 7332 locale 7333 7334 Synopsis 7335 7336 #include 7337 7338 char * dngettext(const char * domainname, const char * msgid1, 7339 const char * msgid2, unsigned long int n); 7340 7341 Description 7342 7343 dngettext() shall be equivalent to a call to 7344 dcngettext(domainname, msgid1, msgid2, n, LC_MESSAGES) 7345 7346 See dgettext() for more information. 7347 7348 See Also 7349 7350 gettext, dgettext, ngettext, dcgettext, dcngettext, 7351 textdomain, bindtextdomain, bind_textdomain_codeset 7352 7353 duplocale 7354 7355 Name 7356 7357 duplocale -- provide new handle for selection of locale 7358 7359 Synopsis 7360 7361 #include 7362 7363 locale_t duplocale(locale_t locale); 7364 7365 Description 7366 7367 The duplocale() function shall provide a new locale object 7368 based on the locale object provided in locale, suitable for 7369 use in the newlocale() or uselocale() functions. The new 7370 object may be released by calling freelocale(). 7371 7372 Return Value 7373 7374 On success, the duplocale() function shall return a locale 7375 object. Otherwise, it shall return NULL, and set errno to 7376 indicate the error. 7377 7378 Errors 7379 7380 The duplocale() function shall fail if: 7381 7382 ENOMEM 7383 Insufficient memory. 7384 7385 See Also 7386 7387 setlocale(), freelocale(), newlocale(), uselocale() 7388 7389 err 7390 7391 Name 7392 7393 err -- display formatted error messages 7394 7395 Synopsis 7396 7397 #include 7398 7399 void err(int eval, const char * fmt, ...); 7400 7401 Description 7402 7403 The err() function shall display a formatted error message on 7404 the standard error stream. First, err() shall write the last 7405 component of the program name, a colon character, and a space 7406 character. If fmt is non-NULL, it shall be used as a format 7407 string for the printf() family of functions, and err() shall 7408 write the formatted message, a colon character, and a space. 7409 Finally, the error message string affiliated with the current 7410 value of the global variable errno shall be written, followed 7411 by a newline character. 7412 7413 The err() function shall not return, the program shall 7414 terminate with the exit value of eval. 7415 7416 See Also 7417 7418 error(), errx() 7419 7420 Return Value 7421 7422 None. 7423 7424 Errors 7425 7426 None. 7427 7428 error 7429 7430 Name 7431 7432 error -- print error message 7433 7434 Synopsis 7435 7436 void error(int exitstatus, int errnum, const char * format, 7437 ...); 7438 7439 Description 7440 7441 error() shall print a message to standard error. 7442 7443 error() shall build the message from the following elements in 7444 their specified order: 7445 7446 1. the program name. If the application has provided a 7447 function named error_print_progname(), error() shall call 7448 this to supply the program name; otherwise, error() uses 7449 the content of the global variable program_name. 7450 2. the colon and space characters, then the result of using 7451 the printf-style format and the optional arguments. 7452 3. if errnum is nonzero, error() shall add the colon and 7453 space characters, then the result of strerror(errnum). 7454 4. a newline. 7455 7456 If exitstatus is nonzero, error() shall call exit(exitstatus). 7457 7458 See Also 7459 7460 err(), errx() 7461 7462 errx 7463 7464 Name 7465 7466 errx -- display formatted error message and exit 7467 7468 Synopsis 7469 7470 #include 7471 7472 void errx(int eval, const char * fmt, ...); 7473 7474 Description 7475 7476 The errx() function shall display a formatted error message on 7477 the standard error stream. The last component of the program 7478 name, a colon character, and a space shall be output. If fmt 7479 is non-NULL, it shall be used as the format string for the 7480 printf() family of functions, and the formatted error message, 7481 a colon character, and a space shall be output. The output 7482 shall be followed by a newline character. 7483 7484 errx() does not return, but shall exit with the value of eval. 7485 7486 Return Value 7487 7488 None. 7489 7490 Errors 7491 7492 None. 7493 7494 See Also 7495 7496 error(), err() 7497 7498 fcntl 7499 7500 Name 7501 7502 fcntl -- file control 7503 7504 Description 7505 7506 fcntl() is as specified in ISO POSIX (2003), but with 7507 differences as listed below. 7508 7509 Implementation may set O_LARGEFILE 7510 7511 According to ISO POSIX (2003), only an application sets 7512 fcntl() flags, for example O_LARGEFILE. However, this 7513 specification also allows an implementation to set the 7514 O_LARGEFILE flag in the case where the programming environment 7515 is one of _POSIX_V6_ILP32_OFFBIG, _POSIX_V6_LP64_OFF64, 7516 _POSIX_V6_LPBIG_OFFBIG. See getconf and c99 in ISO POSIX 7517 (2003) for a description of these environments. Thus, calling 7518 fcntl() with the F_GETFL command may return O_LARGEFILE as 7519 well as flags explicitly set by the application in the case 7520 that both the implementation and the application support an 7521 off_t of at least 64 bits. 7522 7523 fflush_unlocked 7524 7525 Name 7526 7527 fflush_unlocked -- non thread safe fflush 7528 7529 Description 7530 7531 fflush_unlocked() is the same as fflush() except that it need 7532 not be thread safe. That is, it may only be invoked in the 7533 ways which are legal for getc_unlocked(). 7534 7535 fgetwc_unlocked 7536 7537 Name 7538 7539 fgetwc_unlocked -- non thread safe fgetwc 7540 7541 Description 7542 7543 fgetwc_unlocked() is the same as fgetwc() except that it need 7544 not be thread safe. That is, it may only be invoked in the 7545 ways which are legal for getc_unlocked(). 7546 7547 flock 7548 7549 Name 7550 7551 flock -- apply or remove an advisory lock on an open file 7552 7553 Synopsis 7554 7555 int flock(int fd, int operation); 7556 7557 Description 7558 7559 flock() applies or removes an advisory lock on the open file 7560 fd. Valid operation types are: 7561 7562 LOCK_SH 7563 Shared lock. More than one process may hold a shared 7564 lock for a given file at a given time. 7565 7566 LOCK_EX 7567 Exclusive lock. Only one process may hold an exclusive 7568 lock for a given file at a given time. 7569 7570 LOCK_UN 7571 Unlock. 7572 7573 LOCK_NB 7574 Don't block when locking. May be specified (by oring) 7575 along with one of the other operations. 7576 7577 A single file may not simultaneously have both shared and 7578 exclusive locks. 7579 7580 Return Value 7581 7582 On success, 0 is returned. On error, -1 is returned and the 7583 global variable errno is set appropriately. 7584 7585 Errors 7586 7587 EWOULDBLOCK 7588 The file is locked and the LOCK_NB flag was selected. 7589 7590 freelocale 7591 7592 Name 7593 7594 freelocale -- free a locale object 7595 7596 Synopsis 7597 7598 #include 7599 7600 void freelocale(locale_t locale); 7601 7602 Description 7603 7604 The freelocale() function shall free the locale object locale, 7605 and release any resources associated with it. 7606 7607 Return Value 7608 7609 None. 7610 7611 Errors 7612 7613 None defined. 7614 7615 See Also 7616 7617 setlocale(), newlocale(), duplocale(), uselocale() 7618 7619 fscanf 7620 7621 Name 7622 7623 fscanf -- convert formatted input 7624 7625 Description 7626 7627 The scanf() family of functions shall behave as described in 7628 ISO POSIX (2003), except as noted below. 7629 7630 Differences 7631 7632 The %s, %S and %[ conversion specifiers shall accept an option 7633 length modifier a, which shall cause a memory buffer to be 7634 allocated to hold the string converted. In such a case, the 7635 argument corresponding to the conversion specifier should be a 7636 reference to a pointer value that will receive a pointer to 7637 the allocated buffer. If there is insufficient memory to 7638 allocate a buffer, the function may set errno to ENOMEM and a 7639 conversion error results. 7640 7641 Note: This directly conflicts with the ISO C (1999) usage 7642 of %a as a conversion specifier for hexadecimal float 7643 values. While this conversion specifier should be 7644 supported, a format specifier such as "%aseconds" will have 7645 a different meaning on an LSB conforming system. 7646 7647 fwscanf 7648 7649 Name 7650 7651 fwscanf -- convert formatted input 7652 7653 Description 7654 7655 The scanf() family of functions shall behave as described in 7656 ISO POSIX (2003), except as noted below. 7657 7658 Differences 7659 7660 The %s, %S and %[ conversion specifiers shall accept an option 7661 length modifier a, which shall cause a memory buffer to be 7662 allocated to hold the string converted. In such a case, the 7663 argument corresponding to the conversion specifier should be a 7664 reference to a pointer value that will receive a pointer to 7665 the allocated buffer. If there is insufficient memory to 7666 allocate a buffer, the function may set errno to ENOMEM and a 7667 conversion error results. 7668 7669 Note: This directly conflicts with the ISO C (1999) usage 7670 of %a as a conversion specifier for hexadecimal float 7671 values. While this conversion specifier should be 7672 supported, a format specifier such as "%aseconds" will have 7673 a different meaning on an LSB conforming system. 7674 7675 getgrouplist 7676 7677 Name 7678 7679 getgrouplist -- get network group entry 7680 7681 Synopsis 7682 7683 #include 7684 7685 int getgrouplist(const char * user, gid_t group, gid_t * 7686 groups, int * ngroups); 7687 7688 Description 7689 7690 The getgrouplist() function shall fill in the array groups 7691 with the supplementary groups for the user specified by user. 7692 On entry, ngroups shall refer to an integer containing the 7693 maximum number of gid_t members in the groups array. The group 7694 group shall also be included. On success, the value referred 7695 to by ngroups shall be updated to contain the number of gid_t 7696 objects copied. 7697 7698 Return Value 7699 7700 On success, if there was sufficient room to copy all the 7701 supplementatry group identifiers to the array identified by 7702 groups, getgrouplist() shall return the number of gid_t 7703 objects copied, and the value referenced by ngroups shall be 7704 updated. If there was not sufficient room to copy all the 7705 supplementary group identifiers, grouplist() shall return -1, 7706 and update the value referenced by ngroups to the number 7707 actually copied. 7708 7709 If user does not refer to a valid user on the system, 7710 getgrouplist() shall return 0, and set the value referenced by 7711 ngroups to 0. 7712 7713 Errors 7714 7715 None defined. 7716 7717 See Also 7718 7719 getgroups() 7720 7721 getloadavg 7722 7723 Name 7724 7725 getloadavg -- get system load averages 7726 7727 Synopsis 7728 7729 #include 7730 7731 int getloadavg(double loadavg[], int nelem); 7732 7733 Description 7734 7735 getloadavg() returns the number of processes in the system run 7736 queue averaged over various periods of time. Up to nelem 7737 samples are retrieved and assigned to successive elements of 7738 loadavg[]. The system imposes a maximum of 3 samples, 7739 representing averages over the last 1, 5, and 15 minutes, 7740 respectively. 7741 7742 getopt 7743 7744 Name 7745 7746 getopt -- parse command line options 7747 7748 Synopsis 7749 7750 #include 7751 7752 int getopt(int argc, char * const argv[], const char * 7753 optstring); 7754 7755 extern char *optarg; 7756 extern int optind, opterr, optopt; 7757 7758 Description 7759 7760 The getopt() function shall parse command line arguments as 7761 described in ISO POSIX (2003), with the following exceptions, 7762 where LSB and POSIX specifications vary. LSB systems shall 7763 implement the modified behaviors described below. 7764 7765 Argument Ordering 7766 7767 The getopt() function can process command line arguments 7768 referenced by argv in one of three ways: 7769 7770 PERMUTE 7771 the order of arguments in argv is altered so that all 7772 options (and their arguments) are moved in front of all 7773 of the operands. This is the default behavior. 7774 7775 Note: This behavior has undefined results if argv is not 7776 modifiable. This is to support historic behavior predating 7777 the use of const and ISO C (1999). The function prototype 7778 was aligned with ISO POSIX (2003) despite the fact that it 7779 modifies argv, and the library maintainers are unwilling to 7780 change this. 7781 7782 REQUIRE_ORDER 7783 The arguments in argv are processed in exactly the 7784 order given, and option processing stops when the first 7785 non-option argument is reached, or when the element of 7786 argv is "--". This ordering can be enforced either by 7787 setting the environment variable POSIXLY_CORRECT, or by 7788 setting the first character of optstring to '+'. 7789 7790 RETURN_IN_ORDER 7791 The order of arguments is not altered, and all 7792 arguments are processed. Non-option arguments 7793 (operands) are handled as if they were the argument to 7794 an option with the value 1 ('\001'). This ordering is 7795 selected by setting the first character of optstring to 7796 '-'; 7797 7798 Option Characteristics 7799 7800 LSB specifies that: 7801 7802 * an element of argv that starts with "-" (and is not 7803 exactly "-" or "--") is an option element. 7804 * characters of an option element, aside from the initial 7805 "-", are option characters. 7806 7807 POSIX specifies that: 7808 7809 * applications using getopt() shall obey the following 7810 syntax guidelines: 7811 + option name is a single alphanumeric character from 7812 the portable character set 7813 + option is preceded by the '-' delimiter character 7814 + options without option-arguments should be accepted 7815 when grouped behind one '-' delimiter 7816 + each option and option-argument is a separate 7817 argument 7818 + option-arguments are not optional 7819 + all options should precede operands on the command 7820 line 7821 + the argument "--" is accepted as a delimiter 7822 indicating the end of options and the consideration 7823 of subsequent arguments, if any, as operands 7824 * historical implementations of getopt() support other 7825 characters as options as an allowed extension, but 7826 applications that use extensions are not maximally 7827 portable. 7828 * support for multi-byte option characters is only possible 7829 when such characters can be represented as type int. 7830 * applications that call any utility with a first operand 7831 starting with '-' should usually specify "--" to mark the 7832 end of the options. Standard utilities that do not support 7833 this guideline indicate that fact in the OPTIONS section 7834 of the utility description. 7835 7836 Extensions 7837 7838 LSB specifies that: 7839 7840 * if a character is followed by two colons, the option takes 7841 an optional argument; if there is text in the current argv 7842 element, it is returned in optarg, otherwise optarg is set 7843 to 0. 7844 * if optstring contains W followed by a semi-colon (;), then 7845 -W foo is treated as the long option --foo. 7846 7847 Note: See getopt_long() for a description of long options. 7848 * The first character of optstring shall modify the behavior 7849 of getopt() as follows: 7850 + if the first character is '+', then REQUIRE_ORDER 7851 processing shall be in effect (see above) 7852 + if the first character is '-', then RETURN_IN_ORDER 7853 processing shall be in effect (see above) 7854 + if the first character is ':', then getopt() shall 7855 return ':' instead of '?' to indicate a missing 7856 option argument, and shall not print any diagnostic 7857 message to stderr. 7858 7859 POSIX specifies that: 7860 7861 * the -W option is reserved for implementation extensions. 7862 7863 Return Values 7864 7865 LSB specifies the following additional getopt() return values: 7866 7867 * '\001' is returned if RETURN_IN_ORDER argument ordering is 7868 in effect, and the next argument is an operand, not an 7869 option. The argument is available in optarg. 7870 7871 Any other return value has the same meaning as for POSIX. 7872 7873 POSIX specifies the following getopt() return values: 7874 7875 * the next option character is returned, if found 7876 successfully. 7877 * ':' is returned if a parameter is missing for one of the 7878 options and the first character of optstring is ':'. 7879 * '?' is returned if an unknown option character not in 7880 optstring is encountered, or if getopt() detects a missing 7881 argument and the first character of optstring is not ':'. 7882 * -1 is returned for the end of the option list. 7883 7884 Environment Variables 7885 7886 LSB specifies that: 7887 7888 * if the variable POSIXLY_CORRECT is set, option processing 7889 stops as soon as a non-option argument is encountered. 7890 * the variable _[PID]_GNU_nonoption_argv_flags_ (where [PID] 7891 is the process ID for the current process), contains a 7892 space separated list of arguments that should not be 7893 treated as arguments even though they appear to be so. 7894 7895 Rationale: This was used by bash 2.0 to communicate to GNU 7896 libc which arguments resulted from wildcard expansion and 7897 so should not be considered as options. This behavior was 7898 removed in bash version 2.01, but the support remains in 7899 GNU libc. 7900 This behavior is DEPRECATED in this version of the LSB; 7901 future revisions of this specification may not include 7902 this requirement. 7903 7904 getopt_long 7905 7906 Name 7907 7908 getopt_long -- parse command line options 7909 7910 Synopsis 7911 7912 #define _GNU_SOURCE 7913 #include 7914 7915 int getopt_long(int argc, char * const argv[], const char * 7916 opstring, const struct option * longopts, int * longindex); 7917 7918 Description 7919 7920 getopt_long() works like getopt() except that it also accepts 7921 long options, started out by two dashes. Long option names may 7922 be abbreviated if the abbreviation is unique or is an exact 7923 match for some defined option. A long option may take a 7924 parameter, of the form --arg=param or --arg param. 7925 7926 longopts is a pointer to the first element of an array of 7927 struct option declared in getopt.h as: 7928 struct option { 7929 const char *name; 7930 int has_arg; 7931 int *flag; 7932 int val; 7933 }; 7934 7935 The fields in this structure have the following meaning: 7936 7937 name 7938 The name of the long option. 7939 7940 has_arg 7941 One of: 7942 7943 no_argument (or 0) if the option does not take an argument, 7944 required_argument (or 1) if the option requires an argument, 7945 or 7946 optional_argument (or 2) if the option takes an optional 7947 argument. 7948 7949 flag 7950 specifies how results are returned for a long option. 7951 If flag is NULL, then getopt_long() shall return val. 7952 (For example, the calling program may set val to the 7953 equivalent short option character.) Otherwise, 7954 getopt_long() returns 0, and flag shall point to a 7955 variable which shall be set to val if the option is 7956 found, but left unchanged if the option is not found. 7957 7958 val 7959 The value to return, or to load into the variable 7960 pointed to by flag. 7961 7962 Return Value 7963 7964 getopt_long() returns the option character if a short option 7965 was found successfully, or ":" if there was a missing 7966 parameter for one of the options, or "?" for an unknown option 7967 character, or -1 for the end of the option list. 7968 7969 For a long option, getopt_long() returns val if flag is NULL, 7970 and 0 otherwise. Error and -1 returns are the same as for 7971 getopt(), plus "?" for an ambiguous match or an extraneous 7972 parameter. 7973 7974 getopt_long_only 7975 7976 Name 7977 7978 getopt_long_only -- parse command line options 7979 7980 Synopsis 7981 7982 #define _GNU_SOURCE 7983 #include 7984 7985 int getopt_long_only(int argc, char * const argv[], const char 7986 * optstring, const struct option * longopts, int * longindex); 7987 7988 Description 7989 7990 getopt_long_only() is like getopt_long(), but "-" as well as 7991 "--" can indicate a long option. If an option that starts with 7992 "-" (not "--") doesn't match a long option, but does match a 7993 short option, it is parsed as a short option instead. 7994 7995 Note: The getopt_long_only() function is intended only for 7996 supporting certain programs whose command line syntax was 7997 designed before the Utility Syntax Guidelines of ISO POSIX 7998 (2003) were developed. New programs should generally call 7999 getopt_long() instead, which provides the --option syntax 8000 for long options, which is preferred by GNU and consistent 8001 with ISO POSIX (2003). 8002 8003 Return Value 8004 8005 getopt_long_only() returns the option character if the option 8006 was found successfully, or ":" if there was a missing 8007 parameter for one of the options, or "?" for an unknown option 8008 character, or -1 for the end of the option list. 8009 8010 getopt_long_only() also returns the option character when a 8011 short option is recognized. For a long option, they return val 8012 if flag is NULL, and 0 otherwise. Error and -1 returns are the 8013 same as for getopt(), plus "?" for an ambiguous match or an 8014 extraneous parameter. 8015 8016 getsockopt 8017 8018 Name 8019 8020 getsockopt -- get socket options 8021 8022 Synopsis 8023 8024 #include 8025 #include 8026 8027 int getsockopt(int socket, int level, int option_name, void * 8028 restrict option_value, socklen_t * restrict option_len); 8029 8030 Description 8031 8032 The getsockopt() function shall behave as specified in ISO 8033 POSIX (2003), with the following extensions. 8034 8035 IP Protocol Level Options 8036 8037 If the level parameter is IPPROTO_IP, the following values 8038 shall be supported for option_name (see RFC 791:Internet 8039 Protocol for further details): 8040 8041 IP_OPTIONS 8042 Get the Internet Protocol options sent with every 8043 packet from this socket. The option_value shall point 8044 to a memory buffer in which the options shall be 8045 placed; on entry option_len shall point to an integer 8046 value indicating the maximum size of the memory buffer, 8047 in bytes. On successful return, the value referenced by 8048 option_len shall be updated to the size of data copied 8049 to the buffer. For IPv4, the maximum length of options 8050 is 40 bytes. 8051 8052 IP_TTL 8053 Get the current unicast Internet Protocol Time To Live 8054 value used when sending packets with this socket. The 8055 option_value shall point to a buffer large enough to 8056 hold the time to live value (at least 1 byte), and 8057 option_len shall point to an integer value holding the 8058 maximum size of that buffer. On successful return, the 8059 value referenced by option_len shall be updated to 8060 contain the number of bytes copied into the buffer, 8061 which shall be no larger than the initial value, and 8062 option_value shall point to an integer containing the 8063 time to live value. 8064 8065 IP_TOS 8066 Get the Internet Protocol type of service indicator 8067 used when sending packets with this socket. The 8068 option_value shall point to a buffer large enough to 8069 hold the type of service indicator (at least 1 byte), 8070 and option_len shall point to an integer value holding 8071 the maximum size of that buffer. On successful return, 8072 the value referenced by option_len shall be updated to 8073 contain the number of bytes copied into the buffer, 8074 which shall be no larger than the initial value, and 8075 option_value shall point to an integer containing the 8076 time to live value. 8077 8078 gettext 8079 8080 Name 8081 8082 gettext -- Search message catalogs for a string 8083 8084 Synopsis 8085 8086 #include 8087 8088 char * gettext(const char * msgid); 8089 8090 Description 8091 8092 The gettext() function shall search the currently selected 8093 message catalogs for a string identified by the string msgid. 8094 If a string is located, that string shall be returned. 8095 8096 The gettext() function is equivalent to dcgettext(NULL, msgid, 8097 LC_MESSAGES). 8098 8099 Return Value 8100 8101 If a string is found in the currently selected message 8102 catalogs for msgid, then a pointer to that string shall be 8103 returned. Otherwise, a pointer to msgid shall be returned. 8104 8105 Applications shall not modify the string returned by 8106 gettext(). 8107 8108 Errors 8109 8110 None. 8111 8112 The gettext() function shall not modify errno. 8113 8114 See Also 8115 8116 dgettext, ngettext, dngettext, dcgettext, dcngettext, 8117 textdomain, bindtextdomain, bind_textdomain_codeset 8118 8119 getutent 8120 8121 Name 8122 8123 getutent -- access user accounting database entries 8124 8125 Synopsis 8126 8127 #include 8128 8129 struct utmp *getutent(void); 8130 8131 Description 8132 8133 The getutent() function shall read the next entry from the 8134 user accounting database. 8135 8136 Return Value 8137 8138 Upon successful completion, getutent() shall return a pointer 8139 to a utmp structure containing a copy of the requested entry 8140 in the user accounting database. Otherwise, a null pointer 8141 shall be returned. The return value may point to a static area 8142 which is overwritten by a subsequent call to getutent(). 8143 8144 Errors 8145 8146 None defined. 8147 8148 getutent_r 8149 8150 Name 8151 8152 getutent_r -- access user accounting database entries 8153 8154 Synopsis 8155 8156 int getutent_r(struct utmp * buffer, struct utmp ** result); 8157 8158 Description 8159 8160 The getutent_r() function is a reentrant version of the 8161 getutent() function. On entry, buffer should point to a user 8162 supplied buffer to which the next entry in the database will 8163 be copied, and result should point to a location where the 8164 result will be stored. 8165 8166 Return Value 8167 8168 On success, getutent_r() shall return 0 and set the location 8169 referenced by result to a pointer to buffer. Otherwise, 8170 getutent_r() shall return -1 and set the location referenced 8171 by result to NULL. 8172 8173 glob64 8174 8175 Name 8176 8177 glob64 -- find pathnames matching a pattern (Large File 8178 Support) 8179 8180 Synopsis 8181 8182 #include 8183 8184 int glob64(const char * pattern, int flags, int (*errfunc) 8185 (const char *, int), glob64_t * pglob); 8186 8187 Description 8188 8189 The glob64() function is a large-file version of the glob() 8190 defined in ISO POSIX (2003). It shall search for pathnames 8191 matching pattern according to the rules used by the shell, 8192 /bin/sh. No tilde expansion or parameter substitution is done; 8193 see wordexp(). 8194 8195 The results of a glob64() call are stored in the structure 8196 pointed to by pglob, which is a glob64_t declared in glob.h 8197 with the following members: 8198 typedef struct 8199 { 8200 size_t gl_pathc; 8201 char **gl_pathv; 8202 size_t gl_offs; 8203 int gl_flags; 8204 void (*gl_closedir) (void *); 8205 struct dirent64 *(*gl_readdir64) (void *); 8206 void *(*gl_opendir) (const char *); 8207 int (*gl_lstat) (const char *, struct stat *); 8208 int (*gl_stat) (const char *, struct stat *); 8209 } 8210 glob64_t; 8211 8212 Structure members with the same name as corresponding members 8213 of a glob_t as defined in ISO POSIX (2003) shall have the same 8214 purpose. 8215 8216 Other members are defined as follows: 8217 8218 gl_flags 8219 reserved for internal use 8220 8221 gl_closedir 8222 pointer to a function capable of closing a directory 8223 opened by gl_opendir 8224 8225 gl_readdir64 8226 pointer to a function capable of reading entries in a 8227 large directory 8228 8229 gl_opendir 8230 pointer to a function capable of opening a large 8231 directory 8232 8233 gl_stat 8234 pointer to a function capable of returning file status 8235 for a large file 8236 8237 gl_lstat 8238 pointer to a function capable of returning file status 8239 information for a large file or symbolic link 8240 8241 A large file or large directory is one with a size which 8242 cannot be represented by a variable of type off_t. 8243 8244 Return Value 8245 8246 On success, 0 is returned. Other possible returns are: 8247 8248 GLOB_NOSPACE 8249 out of memory 8250 8251 GLOB_ABORTED 8252 read error 8253 8254 GLOB_NOMATCH 8255 no match found 8256 8257 globfree64 8258 8259 Name 8260 8261 globfree64 -- free memory from glob64() (Large File Support) 8262 8263 Synopsis 8264 8265 #include 8266 8267 void globfree64(glob64_t * pglob); 8268 8269 Description 8270 8271 globfree64() frees the dynamically allocated storage from an 8272 earlier call to glob64(). 8273 8274 globfree64() is a 64-bit version of globfree(). 8275 8276 initgroups 8277 8278 Name 8279 8280 initgroups -- initialize the supplementary group access list 8281 8282 Synopsis 8283 8284 #include 8285 #include 8286 8287 int initgroups(const char * user, gid_t group); 8288 8289 Description 8290 8291 If the process has appropriate privilege, the initgroups() 8292 function shall initialize the Supplementary Group IDs for the 8293 current process by reading the group database and using all 8294 groups of which user is a member. The additional group group 8295 is also added to the list. 8296 8297 Return Value 8298 8299 On success, 0 is returned. On error, -1 is returned and the 8300 global variable errno is set appropriately. 8301 8302 Errors 8303 8304 EPERM 8305 The calling process does not have sufficient 8306 privileges. 8307 8308 ENOMEM 8309 Insufficient memory to allocate group information 8310 structure. 8311 8312 See Also 8313 8314 setgroups() 8315 8316 ioctl 8317 8318 Name 8319 8320 ioctl -- control device 8321 8322 Synopsis 8323 8324 #include 8325 8326 int ioctl (int fildes , int request , ...); 8327 8328 Description 8329 8330 The ioctl() function shall manipulate the underlying device 8331 parameters of special files. fildes shall be an open file 8332 descriptor referring to a special file. The ioctl() function 8333 shall take three parameters; the type and value of the third 8334 parameter is dependent on the device and request. 8335 8336 Conforming LSB applications shall not call ioctl() except in 8337 situations explicitly stated in this specification. 8338 8339 Return Value 8340 8341 On success, 0 is returned. An ioctl() may use the return value 8342 as an output parameter and return a non-negative value on 8343 success. On error, -1 is returned and the global variable 8344 errno is set appropriately. 8345 8346 Errors 8347 8348 EBADF 8349 fildes is not a valid descriptor. 8350 8351 EFAULT 8352 The third parameter references an inaccessible memory 8353 area. 8354 8355 ENOTTY 8356 fildes is not associated with a character special 8357 device. 8358 8359 ENOTTY 8360 The specified request does not apply to the kind of 8361 object that fildes references. 8362 8363 EINVAL 8364 request or the third parameter is not valid. 8365 8366 Relationship to POSIX (Informative) 8367 8368 It should be noted that ISO POSIX (2003) contains an interface 8369 named ioctl(). The LSB only defines behavior when fildes 8370 refers to a socket (see sockio) or terminal device (see 8371 ttyio), while ISO POSIX (2003) only defines behavior when 8372 fildes refers to a STREAMS device. An implementation may 8373 support both behaviors; the LSB does not require any STREAMS 8374 support. 8375 8376 sockio 8377 8378 Name 8379 8380 sockio -- socket ioctl commands 8381 8382 Synopsis 8383 8384 #include 8385 #include 8386 #include 8387 8388 int ioctl(int sockfd, int request, char * argp); 8389 8390 Description 8391 8392 Socket ioctl() commands are a subset of the ioctl() calls, 8393 which can perform a variety of functions on sockets. sockfd 8394 shall be an open file descriptor referring to a socket (see 8395 the socket() or accept() functions). 8396 8397 Socket ioctl() commands apply to the underlying network 8398 interfaces, and affect the entire system, not just the file 8399 descriptor used to issue the ioctl(). 8400 8401 The following values for request are accepted: 8402 8403 SIOCGIFCONF (Deprecated) 8404 Get the interface configuration list for the system. 8405 8406 Note: The SIOCGIFCONF interface is superceded by the 8407 if_nameindex() family of functions (see ISO POSIX (2003)). 8408 A future version of this specification may withdraw this 8409 value for request. 8410 8411 argp shall point to a ifconf structure, as described in 8412 . Before calling, the caller shall set the 8413 ifc_ifcu.ifcu_req field to point to an array of ifreq 8414 structures, and set ifc_len to the size in bytes of 8415 this allocated array. Upon return, ifc_len will contain 8416 the size in bytes of the array which was actually used. 8417 If it is the same as the length upon calling, the 8418 caller should assume that the array was too small and 8419 try again with a larger array. 8420 8421 On success, SIOCGIFCONF shall return a nonnegative 8422 value. 8423 8424 Rationale: Historical UNIX systems disagree on the meaning 8425 of the return value. 8426 8427 SIOCGIFFLAGS 8428 Get the interface flags for the indicated interface. 8429 argp shall point to a ifreq structure. Before calling, 8430 the caller should fill in the ifr_name field with the 8431 interface name, and upon return, the 8432 ifr_ifru.ifru_flags field is set with the interface 8433 flags. 8434 8435 SIOCGIFADDR 8436 Get the interface address for the given interface. argp 8437 shall point to a ifreq structure. Before calling, the 8438 caller should fill in the ifr_name field with the 8439 interface name, and upon return, the ifr_ifru.ifru_addr 8440 field is set with the interface address. 8441 8442 SIOCGIFBRDADDR 8443 Get the interface broadcast address for the given 8444 interface. argp shall point to a ifreq structure. 8445 Before calling, the caller should fill in the ifr_name 8446 field with the interface name, and upon return, the 8447 ifr_ifru.ifru_broadcast field is set with the interface 8448 broadcast address. 8449 8450 SIOCGIFNETMASK 8451 Get the network mask for the given interface. argp 8452 shall point to a ifreq structure. Before calling, the 8453 caller should fill in the ifr_name field with the 8454 interface name, and upon return, the 8455 ifr_ifru.ifru_netmask field is set with the network 8456 mask. 8457 8458 SIOCGIFMTU 8459 Get the Maximum Transmission Unit (MTU) size for the 8460 given interface. argp shall point to a ifreq structure. 8461 Before calling, the caller should fill in the ifr_name 8462 field with the interface name, and upon return, the 8463 ifr_ifru.ifru_mtu field is set with the MTU. 8464 8465 FIONREAD 8466 Get the amount of queued unread data in the receive 8467 buffer. argp shall point to an integer where the result 8468 is to be placed. 8469 8470 Return Value 8471 8472 On success, if request is SIOCGIFCONF, a non-negative integer 8473 shall be returned. If request is not SIOCGIFCONF, on success 0 8474 is returned. On error, -1 is returned and the global variable 8475 errno is set appropriately. 8476 8477 Errors 8478 8479 EBADF 8480 sockfd is not a valid descriptor. 8481 8482 EFAULT 8483 argp references an inaccessible memory area. 8484 8485 ENOTTY 8486 The specified request does not apply to the kind of 8487 object that the descriptor sockfd references. 8488 8489 EINVAL 8490 Either request or argp is invalid. 8491 8492 ENOTCONN 8493 The operation is only defined on a connected socket, 8494 but the socket wasn't connected. 8495 8496 ttyio 8497 8498 Name 8499 8500 ttyio -- tty ioctl commands 8501 8502 Synopsis 8503 8504 #include 8505 8506 int ioctl(int fd, unsigned long request, int * argp); 8507 8508 Description 8509 8510 Tty ioctl commands are a subset of the ioctl() calls, which 8511 can perform a variety of functions on tty devices. fd shall be 8512 an open file descriptor referring to a terminal device. 8513 8514 The following ioctl()s are provided: 8515 8516 TIOCGWINSZ 8517 Get the size attributes of the tty. argp is a pointer 8518 to a winsize structure. 8519 8520 Return Value 8521 8522 On success, 0 is returned. On error, -1 is returned and the 8523 global variable errno is set appropriately. 8524 8525 Errors 8526 8527 EBADF 8528 fd is not a valid descriptor. 8529 8530 EFAULT 8531 argp references an inaccessible memory area. 8532 8533 EINVAL 8534 request and argp are not valid. 8535 8536 kill 8537 8538 Name 8539 8540 kill -- send a signal 8541 8542 Synopsis 8543 8544 #include 8545 8546 int kill(pid_t pid, int sig); 8547 8548 Description 8549 8550 kill() is as specified in the ISO POSIX (2003), but with 8551 differences as listed below. 8552 8553 Process ID -1 doesn't affect calling process 8554 8555 If pid is specified as -1, sig shall not be sent to the 8556 calling process. Other than this, the rules in the ISO POSIX 8557 (2003) apply. 8558 8559 Rationale: This was a deliberate Linus decision after an 8560 unpopular experiment in including the calling process in 8561 the 2.5.1 kernel. See "What does it mean to signal 8562 everybody?", Linux Weekly News, 20 December 2001, 8563 http://lwn.net/2001/1220/kernel.php3 8564 8565 link 8566 8567 Name 8568 8569 link -- create a link to a file 8570 8571 Synopsis 8572 8573 #include 8574 8575 int link(const char * path1, const char * path2); 8576 8577 Description 8578 8579 The link() function shall behave as specified in ISO POSIX 8580 (2003), except with differences as listed below. 8581 8582 Need Not Follow Symlinks 8583 8584 ISO POSIX (2003) specifies that pathname resolution shall 8585 follow symbolic links during pathname resolution unless the 8586 function is required to act on the symbolic link itself, or 8587 certain arguments direct that the function act on the symbolic 8588 link itself. The link() function in ISO POSIX (2003) contains 8589 no such requirement to operate on a symbolic link. However, a 8590 conforming LSB implementation need not follow a symbolic link 8591 for the path1 argument. 8592 8593 mbsnrtowcs 8594 8595 Name 8596 8597 mbsnrtowcs -- convert a multibyte string to a wide character 8598 string 8599 8600 Synopsis 8601 8602 #include 8603 8604 size_t mbsnrtowcs(wchar_t * dest, const char * * src, size_t 8605 nms, size_t len, mbstate_t * ps); 8606 8607 Description 8608 8609 mbsnrtowcs() is like mbsrtowcs(), except that the number of 8610 bytes to be converted, starting at src, is limited to nms. 8611 8612 If dest is not a NULL pointer, mbsnrtowcs() converts at most 8613 nms bytes from the multibyte string src to a wide-character 8614 string starting at dest. At most, len wide characters are 8615 written to dest. The state ps is updated. 8616 8617 The conversion is effectively performed by repeatedly calling: 8618 8619 mbrtowc(dest, *src, n, ps) 8620 8621 where n is some positive number, as long as this call 8622 succeeds, and then incrementing dest by one and src by the 8623 number of bytes consumed. 8624 8625 The conversion can stop for three reasons: 8626 8627 * An invalid multibyte sequence has been encountered. In 8628 this case src is left pointing to the invalid multibyte 8629 sequence, (size_t)(-1) is returned, and errno is set to 8630 EILSEQ. 8631 * The nms limit forces a stop, or len non-L'\0' wide 8632 characters have been stored at dest. In this case, src is 8633 left pointing to the next multibyte sequence to be 8634 converted, and the number of wide characters written to 8635 dest is returned. 8636 * The multibyte string has been completely converted, 8637 including the terminating '\0' (which has the side effect 8638 of bringing back ps to the initial state). In this case, 8639 src is set to NULL, and the number of wide characters 8640 written to dest, excluding the terminating L'\0' 8641 character, is returned. 8642 8643 If dest is NULL, len is ignored, and the conversion proceeds 8644 as above, except that the converted wide characters are not 8645 written out to memory, and that no destination length limit 8646 exists. 8647 8648 In both of the above cases, if ps is a NULL pointer, a static 8649 anonymous state only known to mbsnrtowcs() is used instead. 8650 8651 The programmer shall ensure that there is room for at least 8652 len wide characters at dest. 8653 8654 Return Value 8655 8656 mbsnrtowcs() returns the number of wide characters that make 8657 up the converted part of the wide character string, not 8658 including the terminating null wide character. If an invalid 8659 multibyte sequence was encountered, (size_t)(-1) is returned, 8660 and the global variable errno is set to EILSEQ. 8661 8662 Notes 8663 8664 The behavior of mbsnrtowcs() depends on the LC_CTYPE category 8665 of the current locale. 8666 8667 Passing NULL as ps is not multi-thread safe. 8668 8669 memmem 8670 8671 Name 8672 8673 memmem -- locate bytes 8674 8675 Synopsis 8676 8677 #define _GNU_SOURCE 8678 #include 8679 8680 void * memmem(const void * haystack, size_t haystacklen, const 8681 void * needle, size_t needlelen); 8682 8683 Description 8684 8685 memmem() finds the start of the first occurrence of the byte 8686 array referenced by needle of length needlelen in the memory 8687 area haystack of length haystacklen. 8688 8689 Return Value 8690 8691 memmem() returns a pointer to the beginning of the byte array, 8692 or NULL if the byte array is not found. 8693 8694 Notes 8695 8696 Earlier versions of the C library (prior to glibc 2.1) 8697 contained a memmem() with various problems, and application 8698 developers should treat this function with care. 8699 8700 memrchr 8701 8702 Name 8703 8704 memrchr -- scan memory for a character 8705 8706 Synopsis 8707 8708 #include 8709 8710 void * memrchr(const void * s, int c, size_t n); 8711 8712 Description 8713 8714 The memrchr() function shall locate the last occurence of c 8715 (converted to an unsigned char) in the initial n bytes (each 8716 interpreted as an unsigned char) of the object pointed to by 8717 s. 8718 8719 Return Value 8720 8721 The memrchr() shall return a pointer to the located byte, or a 8722 null pointer if the byte does not occur in the object. 8723 8724 Errors 8725 8726 No errors are defined. 8727 8728 See Also 8729 8730 memchr() 8731 8732 newlocale 8733 8734 Name 8735 8736 newlocale -- allocate a locale object 8737 8738 Synopsis 8739 8740 #include 8741 8742 locale_t newlocale(int category_mask, const char * locale, 8743 locale_t base); 8744 8745 Description 8746 8747 The newlocale() function shall initialize a locale object. If 8748 base is NULL, then newlocale() shall first allocate the 8749 object; otherwise it shall use the locale object referenced by 8750 base. 8751 8752 The object shall be initialized for the locale named by 8753 locale, and for the categories selected in category_mask. The 8754 category_mask value is a bitwise inclusive OR of the required 8755 LC_name_MASK values, or the value LC_ALL_MASK. 8756 8757 Return Value 8758 8759 On success, the newlocale() function shall return the 8760 initialized locale object. Otherwise, it shall return NULL, 8761 and set errno to indicate the error. 8762 8763 Errors 8764 8765 The newlocale() function shall fail if: 8766 8767 ENOMEM 8768 Insufficient memory. 8769 8770 EINVAL 8771 An invalid category_mask was provided, or the locale 8772 was NULL. 8773 8774 Application Usage (Informative) 8775 8776 The only portable way to allocate a locale object is to call 8777 newlocale() with a NULL base. The allocated object may be 8778 reinitialized to a new locale by passing it back to 8779 newlocale(). The new object may be released by calling 8780 freelocale(). 8781 8782 See Also 8783 8784 setlocale(), freelocale(), duplocale(), uselocale() 8785 8786 ngettext 8787 8788 Name 8789 8790 ngettext -- Search message catalogs for plural string 8791 8792 Synopsis 8793 8794 #include 8795 8796 char * ngettext(const char * msgid1, const char * msgid2, 8797 unsigned long int n); 8798 8799 Description 8800 8801 The ngettext() function shall search the currently selected 8802 message catalogs for a string matching the singular string 8803 msgid1. If a string is located, and if n is 1, that string 8804 shall be returned. If n is not 1, a pluralized version 8805 (dependant on n) of the string shall be returned. 8806 8807 The ngettext() function is equivalent to dcngettext(NULL, 8808 msgid1, msgid2, n, LC_MESSAGES)(). 8809 8810 Return Value 8811 8812 If a string is found in the currently selected message 8813 catalogs for msgid1, then if n is 1 a pointer to the located 8814 string shall be returned. If n is not 1, a pointer to an 8815 appropriately pluralized version of the string shall be 8816 returned. If no message could be found in the currently 8817 selected mesage catalogs, then if n is 1, a pointer to msgid1 8818 shall be returned, otherwise a pointer to msgid2 shall be 8819 returned. 8820 8821 Applications shall not modify the string returned by 8822 ngettext(). 8823 8824 Errors 8825 8826 None. 8827 8828 The ngettext() function shall not modify errno. 8829 8830 See Also 8831 8832 gettext, dgettext, ngettext, dngettext, dcgettext, dcngettext, 8833 textdomain, bindtextdomain, bind_textdomain_codeset 8834 8835 pmap_getport 8836 8837 Name 8838 8839 pmap_getport -- Find the port number assigned to a service 8840 registered with a portmapper. 8841 8842 Synopsis 8843 8844 #include 8845 8846 u_short * pmap_getport(struct sockaddr_in * address, const 8847 u_long program, const u_long * version, u_int protocol); 8848 8849 Description 8850 8851 The pmap_getport() function shall return the port number 8852 assigned to a service registered with a RPC Binding service 8853 running on a given target system, using the protocol described 8854 in RFC 1833: Binding Protocols for ONC RPC Version 2. The 8855 pmap_getport() function shall be called given the RPC program 8856 number program, the program version version, and transport 8857 protocol protocol. Conforming implementations shall support 8858 both IPPROTO_UDP and IPPROTO_TCP protocols. On entry, address 8859 shall specify the address of the system on which the 8860 portmapper to be contacted resides. The value of 8861 address->sin_port shall be ignored, and the standard value for 8862 the portmapper port shall always be used. 8863 8864 Note: Security and network restrictions may prevent a 8865 conforming application from contacting a remote RPC Binding 8866 Service. 8867 8868 Return Value 8869 8870 On success, the pmap_getport() function shall return the port 8871 number in host byte order of the RPC application registered 8872 with the remote portmapper. On failure, if either the program 8873 was not registered or the remote portmapper service could not 8874 be reached, the pmap_getport() function shall return 0. If the 8875 remote portmap service could not be reached, the status is 8876 left in the global variable rpc_createerr. 8877 8878 pmap_set 8879 8880 Name 8881 8882 pmap_set -- Establishes mapping to machine's RPC Bind service. 8883 8884 Synopsis 8885 8886 #include 8887 8888 bool_t pmap_set(const u_long program, const u_long version, 8889 int protocol, u_short port); 8890 8891 Description 8892 8893 pmap_set() establishes a mapping between the triple 8894 [program,version,protocol] and port on the machine's RPC Bind 8895 service. The value of protocol is most likely IPPROTO_UDP or 8896 IPPROTO_TCP. Automatically done by svc_register(). 8897 8898 Return Value 8899 8900 pmap_set() returns 1 if it suceeds, 0 otherwise. 8901 8902 pmap_unset 8903 8904 Name 8905 8906 pmap_unset -- Destroys RPC Binding 8907 8908 Synopsis 8909 8910 #include 8911 8912 bool_t pmap_unset(u_long prognum, u_long versnum); 8913 8914 Description 8915 8916 As a user interface to the RPC Bind service, pmap_unset() 8917 destroys all mapping between the triple [prognum,versnum, *] 8918 and ports on the machine's RPC Bind service. 8919 8920 Return Value 8921 8922 pmap_unset() returns 1 if it succeeds, zero otherwise. 8923 8924 psignal 8925 8926 Name 8927 8928 psignal -- print signal message 8929 8930 Synopsis 8931 8932 #include 8933 8934 void psignal(int sig, const char * s); 8935 8936 extern const char *const sys_siglist[] 8937 8938 Description 8939 8940 The psignal() function shall display a message on the stderr 8941 stream. If s is not the null pointer, and does not point to an 8942 empty string (e.g. "\0"), the message shall consist of the 8943 string s, a colon, a space, and a string describing the signal 8944 number sig; otherwise psignal() shall display only a message 8945 describing the signal number sig. If sig is invalid, the 8946 message displayed shall indicate an unknown signal. 8947 8948 The array sys_siglist holds the signal description strings 8949 indexed by signal number. 8950 8951 Return Value 8952 8953 psignal() returns no value. 8954 8955 regexec 8956 8957 Name 8958 8959 regexec -- regular expression matching 8960 8961 Description 8962 8963 The regexec() function shall behave as specified in ISO POSIX 8964 (2003), except with differences as listed below. 8965 8966 Differences 8967 8968 Certain aspects of regular expression matching are optional; 8969 see Internationalization and Regular Expressions. 8970 8971 scanf 8972 8973 Name 8974 8975 scanf -- convert formatted input 8976 8977 Description 8978 8979 The scanf() family of functions shall behave as described in 8980 ISO POSIX (2003), except as noted below. 8981 8982 Differences 8983 8984 The %s, %S and %[ conversion specifiers shall accept an option 8985 length modifier a, which shall cause a memory buffer to be 8986 allocated to hold the string converted. In such a case, the 8987 argument corresponding to the conversion specifier should be a 8988 reference to a pointer value that will receive a pointer to 8989 the allocated buffer. If there is insufficient memory to 8990 allocate a buffer, the function may set errno to ENOMEM and a 8991 conversion error results. 8992 8993 Note: This directly conflicts with the ISO C (1999) usage 8994 of %a as a conversion specifier for hexadecimal float 8995 values. While this conversion specifier should be 8996 supported, a format specifier such as "%aseconds" will have 8997 a different meaning on an LSB conforming system. 8998 8999 setbuffer 9000 9001 Name 9002 9003 setbuffer -- stream buffering operation 9004 9005 Synopsis 9006 9007 #include 9008 9009 void setbuffer(FILE * stream, char * buf, size_t size); 9010 9011 Description 9012 9013 setbuffer() is an alias for the call to setvbuf(). It works 9014 the same, except that the size of the buffer in setbuffer() is 9015 up to the caller, rather than being determined by the default 9016 BUFSIZ. 9017 9018 setgroups 9019 9020 Name 9021 9022 setgroups -- set list of supplementary group IDs 9023 9024 Synopsis 9025 9026 #include 9027 9028 int setgroups(size_t size, const gid_t * list); 9029 9030 Description 9031 9032 If the process has appropriate privilege, the setgroups() 9033 function shall set the supplementary group IDs for the current 9034 process. list shall reference an array of size group IDs. A 9035 process may have at most NGROUPS_MAX supplementary group IDs. 9036 9037 Return Value 9038 9039 On successful completion, 0 is returned. On error, -1 is 9040 returned and the errno is set to indicate the error. 9041 9042 Errors 9043 9044 EFAULT 9045 list has an invalid address. 9046 9047 EPERM 9048 The process does not have appropriate privileges. 9049 9050 EINVAL 9051 size is greater than NGROUPS_MAX. 9052 9053 sethostname 9054 9055 Name 9056 9057 sethostname -- set host name 9058 9059 Synopsis 9060 9061 #include 9062 #include 9063 #include 9064 9065 int sethostname(const char * name, size_t len); 9066 9067 Description 9068 9069 If the process has appropriate privileges, the sethostname() 9070 function shall change the host name for the current macine. 9071 The name shall point to a null-terminated string of at most 9072 len bytes that holds the new hostname. 9073 9074 If the symbol HOST_NAME_MAX is defined, or if 9075 sysconf(_SC_HOST_NAME_MAX)() returns a value greater than 0, 9076 this value shall represent the maximum length of the new 9077 hostname. Otherwise, if the symbol MAXHOSTLEN is defined, this 9078 value shall represent the maximum length for the new hostname. 9079 If none of these values are defined, the maximum length shall 9080 be the size of the nodename field of the utsname structure. 9081 9082 Return Value 9083 9084 On success, 0 is returned. On error, -1 is returned and the 9085 global variable errno is set appropriately. 9086 9087 Errors 9088 9089 EINVAL 9090 len is negative or larger than the maximum allowed 9091 size. 9092 9093 EPERM 9094 the process did not have appropriate privilege. 9095 9096 EFAULT 9097 name is an invalid address. 9098 9099 Rationale 9100 9101 ISO POSIX (2003) guarantees that: 9102 9103 Maximum length of a host name (not including the 9104 terminating null) as returned from the gethostname() 9105 function shall be at least 255 bytes. 9106 9107 The glibc C library does not currently define HOST_NAME_MAX, 9108 and although it provides the name _SC_HOST_NAME_MAX a call to 9109 sysconf() returns -1 and does not alter errno in this case 9110 (indicating that there is no restriction on the hostname 9111 length). However, the glibc manual idicates that some 9112 implementations may have MAXHOSTNAMELEN as a means of 9113 detecting the maximum length, while the Linux kernel at 9114 release 2.4 and 2.6 stores this hostname in the utsname 9115 structure. While the glibc manual suggests simply shortening 9116 the name until sethostname() succeeds, the LSB requires that 9117 one of the first four mechanisms works. Future versions of 9118 glibc may provide a more reasonable result from 9119 sysconf(_SC_HOST_NAME_MAX). 9120 9121 setsockopt 9122 9123 Name 9124 9125 setsockopt -- set socket options 9126 9127 Synopsis 9128 9129 #include 9130 #include 9131 9132 int setsockopt(int socket, int level, int option_name, const 9133 void * option_value, socklen_t option_len); 9134 9135 Description 9136 9137 The setsockopt() function shall behave as specified in ISO 9138 POSIX (2003), with the following extensions. 9139 9140 IP Protocol Level Options 9141 9142 If the level parameter is IPPROTO_IP, the following values 9143 shall be supported for option_name (see RFC 791:Internet 9144 Protocol for further details): 9145 9146 IP_OPTIONS 9147 Set the Internet Protocol options sent with every 9148 packet from this socket. The option_value shall point 9149 to a memory buffer containing the options and 9150 option_len shall contain the size in bytes of that 9151 buffer. For IPv4, the maximum length of options is 40 9152 bytes. 9153 9154 IP_TOS 9155 Set the Type of Service flags to use when sending 9156 packets with this socket. The option_value shall point 9157 to a value containing the type of service value. The 9158 least significant two bits of the value shall contain 9159 the new Type of Service indicator. Use of other bits in 9160 the value is unspecified. The option_len parameter 9161 shall hold the size, in bytes, of the buffer referred 9162 to by option_value. 9163 9164 IP_TTL 9165 Set the current unicast Internet Protocol Time To Live 9166 value used when sending packets with this socket. The 9167 option_value shall point to a value containing the time 9168 to live value, which shall be between 1 and 255. The 9169 option_len parameter shall hold the size, in bytes, of 9170 the buffer referred to by option_value. 9171 9172 setutent 9173 9174 Name 9175 9176 setutent -- access user accounting database entries 9177 9178 Synopsis 9179 9180 #include 9181 9182 void setutent(void); 9183 9184 Description 9185 9186 The setutent() function shall reset the user accounting 9187 database such that the next call to getutent() shall be return 9188 the first record in the database. It is recommended to call it 9189 before any of the other functions that operate on the user 9190 accounting databases (e.g. getutent()) 9191 9192 Return Value 9193 9194 None. 9195 9196 sigandset 9197 9198 Name 9199 9200 sigandset -- build a new signal set by combining the two input 9201 sets using logical AND 9202 9203 Synopsis 9204 9205 #include 9206 9207 int sigandset(sigset_t * set, const sigset_t * left, const 9208 sigset_t * right); 9209 9210 Description 9211 9212 The sigandset() shall combine the two signal sets referenced 9213 by left and right, using a logical AND operation, and shall 9214 place the result in the location referenced by set, The 9215 resulting signal set shall contain only signals that are in 9216 both the set referenced by left and the set referenced by 9217 right. 9218 9219 Return Value 9220 9221 On success, sigandset() shall return 0. Otherise, sigandset() 9222 shall return -1 and set errno to indicate the error. 9223 9224 Errors 9225 9226 EINVAL 9227 One or more of set, left, or right was a null pointer. 9228 9229 See Also 9230 9231 sigorset() 9232 9233 sigisemptyset 9234 9235 Name 9236 9237 sigisemptyset -- check for empty signal set 9238 9239 Synopsis 9240 9241 #include 9242 9243 int sigisemptyset(const sigset_t * set); 9244 9245 Description 9246 9247 The sigisemptyset() function shall check for empty signal set 9248 referenced by set. 9249 9250 Return Value 9251 9252 The sigisemptyset() function shall return a positive non-zero 9253 value if the signal set referenced by set is empty, or zero if 9254 this set is empty. On error, sigisemptyset() shall return -1 9255 and set errno to indicate the error. 9256 9257 Errors 9258 9259 EINVAL 9260 set is a null pointer. 9261 9262 sigorset 9263 9264 Name 9265 9266 sigorset -- build a new signal set by combining the two input 9267 sets using logical OR 9268 9269 Synopsis 9270 9271 #include 9272 9273 int sigorset(sigset_t * set, const sigset_t * left, const 9274 sigset_t * right); 9275 9276 Description 9277 9278 The sigorset() shall combine the two signal sets referenced by 9279 left and right, using a logical OR operation, and shall place 9280 the result in the location referenced by set, The resulting 9281 signal set shall contain only signals that are in either the 9282 set referenced by left or the set referenced by right. 9283 9284 Return Value 9285 9286 On success, sigorset() shall return 0. Otherise, sigorset() 9287 shall return -1 and set errno to indicate the error. 9288 9289 Errors 9290 9291 EINVAL 9292 One or more of set, left, or right was a null pointer. 9293 9294 See Also 9295 9296 sigorset() 9297 9298 sigreturn 9299 9300 Name 9301 9302 sigreturn -- return from signal handler and cleanup stack 9303 frame 9304 9305 Synopsis 9306 9307 int sigreturn(struct sigcontext * scp); 9308 9309 Description 9310 9311 The sigreturn() function is used by the system to cleanup 9312 after a signal handler has returned. This function is not in 9313 the source standard; it is only in the binary standard. 9314 9315 Return Value 9316 9317 sigreturn() never returns. 9318 9319 sscanf 9320 9321 Name 9322 9323 sscanf -- convert formatted input 9324 9325 Description 9326 9327 The scanf() family of functions shall behave as described in 9328 ISO POSIX (2003), except as noted below. 9329 9330 Differences 9331 9332 The %s, %S and %[ conversion specifiers shall accept an option 9333 length modifier a, which shall cause a memory buffer to be 9334 allocated to hold the string converted. In such a case, the 9335 argument corresponding to the conversion specifier should be a 9336 reference to a pointer value that will receive a pointer to 9337 the allocated buffer. If there is insufficient memory to 9338 allocate a buffer, the function may set errno to ENOMEM and a 9339 conversion error results. 9340 9341 Note: This directly conflicts with the ISO C (1999) usage 9342 of %a as a conversion specifier for hexadecimal float 9343 values. While this conversion specifier should be 9344 supported, a format specifier such as "%aseconds" will have 9345 a different meaning on an LSB conforming system. 9346 9347 stime 9348 9349 Name 9350 9351 stime -- set time 9352 9353 Synopsis 9354 9355 #define _SVID_SOURCE 9356 #include 9357 9358 int stime(const time_t * t); 9359 9360 Description 9361 9362 If the process has appropriate privilege, the stime() function 9363 shall set the system's idea of the time and date. Time, 9364 referenced by t, is measured in seconds from the epoch 9365 (defined in ISO POSIX (2003) as 00:00:00 UTC January 1, 1970). 9366 9367 Return Value 9368 9369 On success, stime() shall return 0. Otherwise, stime() shall 9370 return -1 and errno shall be set to indicate the error. 9371 9372 Errors 9373 9374 EPERM 9375 The process does not have appropriate privilege. 9376 9377 EINVAL 9378 t is a null pointer. 9379 9380 stpcpy 9381 9382 Name 9383 9384 stpcpy -- copy a string returning a pointer to its end 9385 9386 Synopsis 9387 9388 #include 9389 9390 char * stpcpy(char * restrict dest, const char * restrict 9391 src); 9392 9393 Description 9394 9395 The stpcpy() function shall copy the string pointed to by src 9396 (including the terminating '\0' character) to the array 9397 pointed to by dest. The strings may not overlap, and the 9398 destination string dest shall be large enough to receive the 9399 copy. 9400 9401 Return Value 9402 9403 stpcpy() returns a pointer to the end of the string dest (that 9404 is, the address of the terminating '\0' character) rather than 9405 the beginning. 9406 9407 Example 9408 9409 This program uses stpcpy() to concatenate foo and bar to 9410 produce foobar, which it then prints. 9411 #include 9412 9413 int 9414 main (void) 9415 { 9416 char buffer[256]; 9417 char *to = buffer; 9418 to = stpcpy (to, "foo"); 9419 to = stpcpy (to, "bar"); 9420 printf ("%s\n", buffer); 9421 } 9422 9423 stpncpy 9424 9425 Name 9426 9427 stpncpy -- copy a fixed-size string, returning a pointer to 9428 its end 9429 9430 Synopsis 9431 9432 #include 9433 9434 char * stpncpy(char * restrict dest, const char * restrict 9435 src, size_t n); 9436 9437 Description 9438 9439 The stpncpy() function shall copy at most n characters from 9440 the string pointed to by src, including the terminating \0 9441 character, to the array pointed to by dest. Exactly n 9442 characters are written at dest. If the length strlen()(src) is 9443 smaller than n, the remaining characters in dest are filled 9444 with \0 characters. If the length strlen()(src) is greater 9445 than or equal to n, dest will not be \0 terminated. 9446 9447 The strings may not overlap. 9448 9449 The programmer shall ensure that there is room for at least n 9450 characters at dest. 9451 9452 Return Value 9453 9454 The stpncpy() function shall return a pointer to the 9455 terminating NULL in dest, or, if dest is not NULL-terminated, 9456 dest + n. 9457 9458 strcasestr 9459 9460 Name 9461 9462 strcasestr -- locate a substring ignoring case 9463 9464 Synopsis 9465 9466 #include 9467 9468 char * strcasestr(const char * s1, const char * s2); 9469 9470 Description 9471 9472 The strcasestr() shall behave as strstr(), except that it 9473 shall ignore the case of both strings. The strcasestr() 9474 function shall be locale aware; that is strcasestr() shall 9475 behave as if both strings had been converted to lower case in 9476 the current locale before the comparison is performed. 9477 9478 Return Value 9479 9480 Upon successful completion, strcasestr() shall return a 9481 pointer to the located string or a null pointer if the string 9482 is not found. If s2 points to a string with zero length, the 9483 function shall return s1. 9484 9485 strerror_r 9486 9487 Name 9488 9489 strerror_r -- reentrant version of strerror 9490 9491 Synopsis 9492 9493 #include 9494 9495 char * strerror_r(int errnum, char * buf, size_t buflen); 9496 9497 Description 9498 9499 The strerror_r() shall behave as specified in ISO POSIX 9500 (2003), except as described below. 9501 9502 Returns String, not Error Value 9503 9504 The strerror_r() function shall return a pointer to the string 9505 corresponding to errno. The returned pointer may point within 9506 the buffer buf (at most buflen bytes). 9507 9508 Return Value 9509 9510 On success, strerror_r() shall return a pointer to the 9511 generated message string (determined by the setting of the 9512 LC_MESSAGES category in the current locale). Otherwise, 9513 strerror_r() shall return the string corresponding to "Unknown 9514 error". 9515 9516 strndup 9517 9518 Name 9519 9520 strndup -- return a malloc'd copy of at most the specified 9521 number of bytes of a string 9522 9523 Synopsis 9524 9525 #include 9526 9527 char * strndup(const char * string, size_t n); 9528 9529 Description 9530 9531 The strndup() function shall return a malloc()'d copy of at 9532 most n bytes of string. The resultant string shall be 9533 terminated even if no NULL terminator appears before string+n. 9534 9535 Return Value 9536 9537 On success, strndup() shall return a pointer to a newly 9538 allocated block of memory containing a copy of at most n bytes 9539 of string. Otherwise, strndup() shall return NULL and set 9540 errno to indicate the error. 9541 9542 Errors 9543 9544 ENOMEM 9545 Insufficient memory available. 9546 9547 strnlen 9548 9549 Name 9550 9551 strnlen -- determine the length of a fixed-size string 9552 9553 Synopsis 9554 9555 #include 9556 9557 size_t strnlen(const char * s, size_t maxlen); 9558 9559 Description 9560 9561 strnlen() returns the number of characters in the string s, 9562 not including the terminating \0 character, but at most 9563 maxlen. In doing this, strnlen() looks only at the first 9564 maxlen characters at s and never beyond s + maxlen. 9565 9566 Return Value 9567 9568 strnlen() returns strlen(s), if that is less than maxlen, or 9569 maxlen if there is no \0 character among the first maxlen 9570 characters pointed to by s. 9571 9572 strptime 9573 9574 Name 9575 9576 strptime -- parse a time string 9577 9578 Description 9579 9580 The strptime() shall behave as specified in the ISO POSIX 9581 (2003) with differences as listed below. 9582 9583 Number of leading zeroes may be limited 9584 9585 The ISO POSIX (2003) specifies fields for which "leading zeros 9586 are permitted but not required"; however, applications shall 9587 not expect to be able to supply more leading zeroes for these 9588 fields than would be implied by the range of the field. 9589 Implementations may choose to either match an input with 9590 excess leading zeroes, or treat this as a non-matching input. 9591 For example, %j has a range of 001 to 366, so 0, 00, 000, 001, 9592 and 045 are acceptable inputs, but inputs such as 0000, 0366 9593 and the like are not. 9594 9595 Rationale 9596 9597 glibc developers consider it appropriate behavior to forbid 9598 excess leading zeroes. When trying to parse a given input 9599 against several format strings, forbidding excess leading 9600 zeroes could be helpful. For example, if one matches 9601 0011-12-26 against %m-%d-%Y and then against %Y-%m-%d, it 9602 seems useful for the first match to fail, as it would be 9603 perverse to parse that date as November 12, year 26. The 9604 second pattern parses it as December 26, year 11. 9605 9606 The ISO POSIX (2003) is not explicit that an unlimited number 9607 of leading zeroes are required, although it may imply this. 9608 The LSB explicitly allows implementations to have either 9609 behavior. Future versions of this standard may require 9610 implementations to forbid excess leading zeroes. 9611 9612 An Interpretation Request is currently pending against ISO 9613 POSIX (2003) for this matter. 9614 9615 strsep 9616 9617 Name 9618 9619 strsep -- extract token from string 9620 9621 Synopsis 9622 9623 #include 9624 9625 char * strsep(char * * stringp, const char * delim); 9626 9627 Description 9628 9629 The strsep() function shall find the first token in the string 9630 referenced by the pointer stringp, using the characters in 9631 delim as delimiters. 9632 9633 If stringp is NULL, strsep() shall return NULL and do nothing 9634 else. 9635 9636 If stringp is non-NULL, strsep() shall find the first token in 9637 the string referenced by stringp, where tokens are delimited 9638 by characters in the string delim. This token shall be 9639 terminated with a \0 character by overwriting the delimiter, 9640 and stringp shall be updated to point past the token. In case 9641 no delimiter was found, the token is taken to be the entire 9642 string referenced by stringp, and the location referenced by 9643 stringp is made NULL. 9644 9645 Return Value 9646 9647 strsep() shall return a pointer to the beginning of the token. 9648 9649 Notes 9650 9651 The strsep() function was introduced as a replacement for 9652 strtok(), since the latter cannot handle empty fields. 9653 However, strtok() conforms to ISO C (1999) and to ISO POSIX 9654 (2003) and hence is more portable. 9655 9656 See Also 9657 9658 strtok(), strtok_r(). 9659 9660 strsignal 9661 9662 Name 9663 9664 strsignal -- return string describing signal 9665 9666 Synopsis 9667 9668 #define _GNU_SOURCE 9669 #include 9670 9671 char * strsignal(int sig); 9672 9673 extern const char * const sys_siglist[]; 9674 9675 Description 9676 9677 The strsignal() function shall return a pointer to a string 9678 describing the signal number sig. The string can only be used 9679 until the next call to strsignal(). 9680 9681 The array sys_siglist holds the signal description strings 9682 indexed by signal number. This array should not be accessed 9683 directly by applications. 9684 9685 Return Value 9686 9687 If sig is a valid signal number, strsignal() shall return a 9688 pointer to the appropriate description string. Otherwise, 9689 strsignal() shall return either a pointer to the string 9690 "unknown signal", or a null pointer. 9691 9692 Although the function is not declared as returning a pointer 9693 to a constant character string, applications shall not modify 9694 the returned string. 9695 9696 strtoq 9697 9698 Name 9699 9700 strtoq -- convert string value to a long or quad_t integer 9701 9702 Synopsis 9703 9704 #include 9705 #include 9706 #include 9707 9708 long long strtoq(const char * nptr, char * * endptr, int 9709 base); 9710 9711 Description 9712 9713 strtoq() converts the string nptr to a quadt value. The 9714 conversion is done according to the given base, which shall be 9715 between 2 and 36 inclusive, or be the special value 0. 9716 9717 nptr may begin with an arbitrary amount of white space (as 9718 determined by isspace()(3)), followed by a single optional + 9719 or - sign character. If base is 0 or 16, the string may then 9720 include a 0x prefix, and the number will be read in base 16; 9721 otherwise, a 0 base is taken as 10 (decimal), unless the next 9722 character is 0, in which case it is taken as 8 (octal). 9723 9724 The remainder of the string is converted to a long value in 9725 the obvious manner, stopping at the first character which is 9726 not a valid digit in the given base. (In bases above 10, the 9727 letter A in either upper or lower case represents 10, B 9728 represents 11, and so forth, with Z representing 35.) 9729 9730 Return Value 9731 9732 strtoq() returns the result of the conversion, unless the 9733 value would underflow or overflow. If an underflow occurs, 9734 strtoq() returns QUAD_MIN. If an overflow occurs, strtoq() 9735 returns QUAD_MAX. In both cases, the global variable errno is 9736 set to ERANGE. 9737 9738 Errors 9739 9740 ERANGE 9741 The given string was out of range; the value converted 9742 has been clamped. 9743 9744 strtouq 9745 9746 Name 9747 9748 strtouq -- convert a string to an unsigned long long 9749 9750 Synopsis 9751 9752 #include 9753 #include 9754 #include 9755 9756 unsigned long long strtouq(const char * nptr, char * * endptr, 9757 int base); 9758 9759 Description 9760 9761 strtouq() converts the string nptr to an unsigned long long 9762 value. The conversion is done according to the given base, 9763 which shall be between 2 and 36 inclusive, or be the special 9764 value 0. 9765 9766 nptr may begin with an arbitrary amount of white space (as 9767 determined by isspace()(3)), followed by a single optional + 9768 or - sign character. If base is 0 or 16, the string may then 9769 include a 0x prefix, and the number will be read in base 16; 9770 otherwise, a 0 base is taken as 10 (decimal), unless the next 9771 character is 0, in which case it is taken as 8 (octal). 9772 9773 The remainder of the string is converted to an unsigned long 9774 value in the obvious manner, stopping at the end of the string 9775 or at the first character that does not produce a valid digit 9776 in the given base. (In bases above 10, the letter A in either 9777 upper or lower case represents 10, B represents 11, and so 9778 forth, with Z representing 35.) 9779 9780 Return Value 9781 9782 On success, strtouq() returns either the result of the 9783 conversion or, if there was a leading minus sign, the negation 9784 of the result of the conversion, unless the original 9785 (non-negated) value would overflow. In the case of an overflow 9786 the function returns UQUAD_MAX and the global variable errno 9787 is set to ERANGE. 9788 9789 Errors 9790 9791 ERANGE 9792 The given string was out of range; the value converted 9793 has been clamped. 9794 9795 svc_register 9796 9797 Name 9798 9799 svc_register -- Register Remote Procedure Call Interface 9800 9801 Synopsis 9802 9803 #include 9804 9805 bool_t svc_register(SVCXPRT * xprt, rpcprog_t prognum, 9806 rpcvers_t versnum, __dispatch_fn_t dispatch, rpcprot_t 9807 protocol); 9808 9809 Description 9810 9811 The svc_register() function shall associate the program 9812 identified by prognum at version versnum with the service 9813 dispatch procedure, dispatch. If protocol is zero, the service 9814 is not registered with the portmap service. If protocol is 9815 non-zero, then a mapping of the triple [prognum, versnum, 9816 protocol] to xprt->xp_port is established with the local 9817 portmap service. The procedure dispatch has the following 9818 form: 9819 9820 int dispatch(struct svc_req * request, SVCXPRT * xprt); 9821 9822 Return Value 9823 9824 svc_register() returns 1 if it succeeds, and zero otherwise. 9825 9826 svc_run 9827 9828 Name 9829 9830 svc_run -- Waits for RPC requests to arrive and calls service 9831 procedure. 9832 9833 Synopsis 9834 9835 #include 9836 9837 void svc_run(void); 9838 9839 Description 9840 9841 The svc_run() function shall wait for RPC requests to arrive, 9842 read and unpack each request, and dispatch it to the 9843 appropriate registered handler. Under normal conditions, 9844 svc_run() shall not return; it shall only return if serious 9845 errors occur that prevent further processing. 9846 9847 svc_sendreply 9848 9849 Name 9850 9851 svc_sendreply -- called by RPC service's dispatch routine 9852 9853 Synopsis 9854 9855 bool_t svc_sendreply(SVCXPRT *xprt, xdrproc_t outproc, caddr_t 9856 out); 9857 9858 Description 9859 9860 Called by an RPC service's dispatch routine to send the 9861 results of a remote procedure call. The parameter xprt is the 9862 request's associated transport handle; outproc is the XDR 9863 routine which is used to encode the results; and out is the 9864 address of the results. This routine returns one if it 9865 succeeds, zero other-wise. 9866 9867 svctcp_create 9868 9869 Name 9870 9871 svctcp_create -- Creates a TCP/IP-based RPC service transport. 9872 9873 Synopsis 9874 9875 #include 9876 9877 SVCXPRT * svctcp_create(int sock, u_int send_buf_size, u_int 9878 recv_buf_size); 9879 9880 Description 9881 9882 svctcp_create() cretes a TCP/IP-based RPC service transport, 9883 to which it returns a pointer. The transport is associated 9884 with the socket sock, which may be RPC_ANYSOCK, in which case 9885 a new socket is created. If the socket is not bound to a local 9886 TCP port, then this routine binds it to an arbitrary port. 9887 Upon completion, xprt->xp_sock is the transport's socket 9888 descriptor, and xprt->xp_port is the transport's port number. 9889 Since TCP-based RPC uses buffered I/O, users may specify the 9890 size of buffers; values of zero choose suitable defaults. 9891 9892 Return Value 9893 9894 svctcp_create() returns NULL if it fails, or a pointer to the 9895 RPC service transport otherwise. 9896 9897 svcudp_create 9898 9899 Name 9900 9901 svcudp_create -- Creates a UDP-based RPC service transport. 9902 9903 Synopsis 9904 9905 SVCXPRT * 9906 9907 svcudp_create(int sock); 9908 9909 Description 9910 9911 This call is equivalent to svcudp_bufcreate( sock, SZ, SZ) for 9912 some default size SZ. 9913 9914 swscanf 9915 9916 Name 9917 9918 swscanf -- convert formatted input 9919 9920 Description 9921 9922 The scanf() family of functions shall behave as described in 9923 ISO POSIX (2003), except as noted below. 9924 9925 Differences 9926 9927 The %s, %S and %[ conversion specifiers shall accept an option 9928 length modifier a, which shall cause a memory buffer to be 9929 allocated to hold the string converted. In such a case, the 9930 argument corresponding to the conversion specifier should be a 9931 reference to a pointer value that will receive a pointer to 9932 the allocated buffer. If there is insufficient memory to 9933 allocate a buffer, the function may set errno to ENOMEM and a 9934 conversion error results. 9935 9936 Note: This directly conflicts with the ISO C (1999) usage 9937 of %a as a conversion specifier for hexadecimal float 9938 values. While this conversion specifier should be 9939 supported, a format specifier such as "%aseconds" will have 9940 a different meaning on an LSB conforming system. 9941 9942 system 9943 9944 Name 9945 9946 system -- execute a shell command 9947 9948 Synopsis 9949 9950 #include 9951 9952 int system(const char * string); 9953 9954 Description 9955 9956 The system() function shall behave as described in ISO POSIX 9957 (2003). 9958 9959 Notes 9960 9961 The fact that system() ignores interrupts is often not what a 9962 program wants. ISO POSIX (2003) describes some of the 9963 consequences; an additional consequence is that a program 9964 calling system() from a loop cannot be reliably interrupted. 9965 Many programs will want to use the exec() family of functions 9966 instead. 9967 9968 Do not use system() from a program with suid or sgid 9969 privileges, because unexpected values for some environment 9970 variables might be used to subvert system integrity. Use the 9971 exec() family of functions instead, but not execlp() or 9972 execvp(). system() will not, in fact, work properly from 9973 programs with suid or sgid privileges on systems on which 9974 /bin/sh is bash version 2, since bash 2 drops privileges on 9975 startup. (Debian uses a modified bash which does not do this 9976 when invoked as sh.) 9977 9978 The check for the availability of /bin/sh is not actually 9979 performed; it is always assumed to be available. ISO C (1999) 9980 specifies the check, but ISO POSIX (2003) specifies that the 9981 return shall always be nonzero, since a system without the 9982 shell is not conforming, and it is this that is implemented. 9983 9984 It is possible for the shell command to return 127, so that 9985 code is not a sure indication that the execve() call failed; 9986 check the global variable errno to make sure. 9987 9988 textdomain 9989 9990 Name 9991 9992 textdomain -- set the current default message domain 9993 9994 Synopsis 9995 9996 #include 9997 9998 char * textdomain(const char * domainname); 9999 10000 Description 10001 10002 The textdomain() function shall set the current default 10003 message domain to domainname. Subsequent calls to gettext() 10004 and ngettext() use the default message domain. 10005 10006 If domainname is NULL, the default message domain shall not be 10007 altered. 10008 10009 If domainname is "", textdomain() shall reset the default 10010 domain to the system default of "messages". 10011 10012 Return 10013 10014 On success, textdomain() shall return the currently selected 10015 domain. Otherwise, a null pointer shall be returned, and errno 10016 set to indicate the error. 10017 10018 Errors 10019 10020 ENOMEM 10021 Insufficent memory available. 10022 10023 unlink 10024 10025 Name 10026 10027 unlink -- remove a directory entry 10028 10029 Synopsis 10030 10031 int unlink(const char * path); 10032 10033 Description 10034 10035 unlink() is as specified in ISO POSIX (2003), but with 10036 differences as listed below. 10037 10038 See also Additional behaviors: unlink/link on directory. 10039 10040 May return EISDIR on directories 10041 10042 If path specifies a directory, the implementation may return 10043 EISDIR instead of EPERM as specified by ISO POSIX (2003). 10044 10045 Rationale: The Linux kernel has deliberately chosen EISDIR 10046 for this case and does not expect to change (Al Viro, 10047 personal communication). 10048 10049 uselocale 10050 10051 Name 10052 10053 uselocale -- Set locale for thread 10054 10055 Synopsis 10056 10057 #include 10058 10059 locale_t uselocale(locale_t newloc); 10060 10061 Description 10062 10063 The uselocale() function shall set the locale for the calling 10064 thread to the locale specified by newloc. 10065 10066 If newloc is the value LC_GLOBAL_LOCALE, the thread's locale 10067 shall be set to the process current global locale, as set by 10068 setlocale(). If newloc is NULL, the thread's locale is not 10069 altered. 10070 10071 Return Value 10072 10073 The uselocale() function shall return the previous locale, or 10074 LC_GLOBAL_LOCALE if the thread local locale has not been 10075 previously set. 10076 10077 Errors 10078 10079 None defined. 10080 10081 See Also 10082 10083 setlocale(), freelocale(), duplocale(), newlocale() 10084 10085 utmpname 10086 10087 Name 10088 10089 utmpname -- set user accounting database 10090 10091 Synopsis 10092 10093 #include 10094 10095 int utmpname(const char * dbname); 10096 10097 Description 10098 10099 The utmpname() function shall cause the user accounting 10100 database used by the getutent(), getutent_r(), getutxent(), 10101 getutxid(), getutxline(), and pututxline() functions to be 10102 that named by dbname, instead of the system default database. 10103 See Section 4.2 for further information. 10104 10105 Note: The LSB does not specify the format of the user 10106 accounting database, nor the names of the file or files 10107 that may contain it. 10108 10109 Return Value 10110 10111 None. 10112 10113 Errors 10114 10115 None defined. 10116 10117 vasprintf 10118 10119 Name 10120 10121 vasprintf -- write formatted output to a dynamically allocated 10122 string 10123 10124 Synopsis 10125 10126 #include 10127 #include 10128 10129 int vasprintf(char * * restrict ptr, const char * restrict 10130 format, va_list arg); 10131 10132 Description 10133 10134 The vasprintf() function shall write formatted output to a 10135 dynamically allocated string, and store the address of that 10136 string in the location referenced by ptr. It shall behave as 10137 asprintf(), except that instead of being called with a 10138 variable number of arguments, it is called with an argument 10139 list as defined by . 10140 10141 Return Value 10142 10143 Refer to fprintf(). 10144 10145 Errors 10146 10147 Refer to fprintf(). 10148 10149 vdprintf 10150 10151 Name 10152 10153 vdprintf -- write formatted output to a file descriptor 10154 10155 Synopsis 10156 10157 #include 10158 10159 int vdprintf(int fd, const char * restrict format, va_list 10160 arg); 10161 10162 Description 10163 10164 The vdprintf() shall behave as vfprintf(), except that the 10165 first argument is a file descriptor rather than a STDIO 10166 stream. 10167 10168 Return Value 10169 10170 Refer to fprintf(). 10171 10172 Errors 10173 10174 Refer to fprintf(). 10175 10176 verrx 10177 10178 Name 10179 10180 verrx -- display formatted error message and exit 10181 10182 Synopsis 10183 10184 #include 10185 #include 10186 10187 void verrx(int eval, const char * fmt, va_list args); 10188 10189 Description 10190 10191 The verrx() shall behave as errx() except that instead of 10192 being called with a variable number of arguments, it is called 10193 with an argument list as defined by . 10194 10195 verrx() does not return, but exits with the value of eval. 10196 10197 Return Value 10198 10199 None. 10200 10201 Errors 10202 10203 None. 10204 10205 vfscanf 10206 10207 Name 10208 10209 vfscanf -- convert formatted input 10210 10211 Description 10212 10213 The scanf() family of functions shall behave as described in 10214 ISO POSIX (2003), except as noted below. 10215 10216 Differences 10217 10218 The %s, %S and %[ conversion specifiers shall accept an option 10219 length modifier a, which shall cause a memory buffer to be 10220 allocated to hold the string converted. In such a case, the 10221 argument corresponding to the conversion specifier should be a 10222 reference to a pointer value that will receive a pointer to 10223 the allocated buffer. If there is insufficient memory to 10224 allocate a buffer, the function may set errno to ENOMEM and a 10225 conversion error results. 10226 10227 Note: This directly conflicts with the ISO C (1999) usage 10228 of %a as a conversion specifier for hexadecimal float 10229 values. While this conversion specifier should be 10230 supported, a format specifier such as "%aseconds" will have 10231 a different meaning on an LSB conforming system. 10232 10233 vfwscanf 10234 10235 Name 10236 10237 vfwscanf -- convert formatted input 10238 10239 Description 10240 10241 The scanf() family of functions shall behave as described in 10242 ISO POSIX (2003), except as noted below. 10243 10244 Differences 10245 10246 The %s, %S and %[ conversion specifiers shall accept an option 10247 length modifier a, which shall cause a memory buffer to be 10248 allocated to hold the string converted. In such a case, the 10249 argument corresponding to the conversion specifier should be a 10250 reference to a pointer value that will receive a pointer to 10251 the allocated buffer. If there is insufficient memory to 10252 allocate a buffer, the function may set errno to ENOMEM and a 10253 conversion error results. 10254 10255 Note: This directly conflicts with the ISO C (1999) usage 10256 of %a as a conversion specifier for hexadecimal float 10257 values. While this conversion specifier should be 10258 supported, a format specifier such as "%aseconds" will have 10259 a different meaning on an LSB conforming system. 10260 10261 vscanf 10262 10263 Name 10264 10265 vscanf -- convert formatted input 10266 10267 Description 10268 10269 The scanf() family of functions shall behave as described in 10270 ISO POSIX (2003), except as noted below. 10271 10272 Differences 10273 10274 The %s, %S and %[ conversion specifiers shall accept an option 10275 length modifier a, which shall cause a memory buffer to be 10276 allocated to hold the string converted. In such a case, the 10277 argument corresponding to the conversion specifier should be a 10278 reference to a pointer value that will receive a pointer to 10279 the allocated buffer. If there is insufficient memory to 10280 allocate a buffer, the function may set errno to ENOMEM and a 10281 conversion error results. 10282 10283 Note: This directly conflicts with the ISO C (1999) usage 10284 of %a as a conversion specifier for hexadecimal float 10285 values. While this conversion specifier should be 10286 supported, a format specifier such as "%aseconds" will have 10287 a different meaning on an LSB conforming system. 10288 10289 vsscanf 10290 10291 Name 10292 10293 vsscanf -- convert formatted input 10294 10295 Description 10296 10297 The scanf() family of functions shall behave as described in 10298 ISO POSIX (2003), except as noted below. 10299 10300 Differences 10301 10302 The %s, %S and %[ conversion specifiers shall accept an option 10303 length modifier a, which shall cause a memory buffer to be 10304 allocated to hold the string converted. In such a case, the 10305 argument corresponding to the conversion specifier should be a 10306 reference to a pointer value that will receive a pointer to 10307 the allocated buffer. If there is insufficient memory to 10308 allocate a buffer, the function may set errno to ENOMEM and a 10309 conversion error results. 10310 10311 Note: This directly conflicts with the ISO C (1999) usage 10312 of %a as a conversion specifier for hexadecimal float 10313 values. While this conversion specifier should be 10314 supported, a format specifier such as "%aseconds" will have 10315 a different meaning on an LSB conforming system. 10316 10317 vswscanf 10318 10319 Name 10320 10321 vswscanf -- convert formatted input 10322 10323 Description 10324 10325 The scanf() family of functions shall behave as described in 10326 ISO POSIX (2003), except as noted below. 10327 10328 Differences 10329 10330 The %s, %S and %[ conversion specifiers shall accept an option 10331 length modifier a, which shall cause a memory buffer to be 10332 allocated to hold the string converted. In such a case, the 10333 argument corresponding to the conversion specifier should be a 10334 reference to a pointer value that will receive a pointer to 10335 the allocated buffer. If there is insufficient memory to 10336 allocate a buffer, the function may set errno to ENOMEM and a 10337 conversion error results. 10338 10339 Note: This directly conflicts with the ISO C (1999) usage 10340 of %a as a conversion specifier for hexadecimal float 10341 values. While this conversion specifier should be 10342 supported, a format specifier such as "%aseconds" will have 10343 a different meaning on an LSB conforming system. 10344 10345 vsyslog 10346 10347 Name 10348 10349 vsyslog -- log to system log 10350 10351 Synopsis 10352 10353 #include 10354 #include 10355 10356 void vsyslog(int priority, char * message, va_list arglist); 10357 10358 Description 10359 10360 The vsyslog() function is identical to syslog() as specified 10361 in ISO POSIX (2003), except that arglist (as defined by 10362 stdarg.h) replaces the variable number of arguments. 10363 10364 vwscanf 10365 10366 Name 10367 10368 vwscanf -- convert formatted input 10369 10370 Description 10371 10372 The scanf() family of functions shall behave as described in 10373 ISO POSIX (2003), except as noted below. 10374 10375 Differences 10376 10377 The %s, %S and %[ conversion specifiers shall accept an option 10378 length modifier a, which shall cause a memory buffer to be 10379 allocated to hold the string converted. In such a case, the 10380 argument corresponding to the conversion specifier should be a 10381 reference to a pointer value that will receive a pointer to 10382 the allocated buffer. If there is insufficient memory to 10383 allocate a buffer, the function may set errno to ENOMEM and a 10384 conversion error results. 10385 10386 Note: This directly conflicts with the ISO C (1999) usage 10387 of %a as a conversion specifier for hexadecimal float 10388 values. While this conversion specifier should be 10389 supported, a format specifier such as "%aseconds" will have 10390 a different meaning on an LSB conforming system. 10391 10392 wait4 10393 10394 Name 10395 10396 wait4 -- wait for process termination, BSD style 10397 10398 Synopsis 10399 10400 #include 10401 #include 10402 #include 10403 10404 pid_t wait4(pid_t pid, int * status, int options, struct 10405 rusage * rusage); 10406 10407 Description 10408 10409 wait4() suspends execution of the current process until a 10410 child (as specified by pid) has exited, or until a signal is 10411 delivered whose action is to terminate the current process or 10412 to call a signal handling function. If a child (as requested 10413 by pid) has already exited by the time of the call (a 10414 so-called "zombie" process), the function returns immediately. 10415 Any system resources used by the child are freed. 10416 10417 The value of pid can be one of: 10418 10419 < -1 10420 wait for any child process whose process group ID is 10421 equal to the absolute value of pid. 10422 10423 -1 10424 wait for any child process; this is equivalent to 10425 calling wait3(). 10426 10427 0 10428 wait for any child process whose process group ID is 10429 equal to that of the calling process. 10430 10431 > 0 10432 wait for the child whose process ID is equal to the 10433 value of pid. 10434 10435 The value of options is a bitwise or of zero or more of the 10436 following constants: 10437 10438 WNOHANG 10439 return immediately if no child is there to be waited 10440 for. 10441 10442 WUNTRACED 10443 return for children that are stopped, and whose status 10444 has not been reported. 10445 10446 If status is not NULL, wait4() stores status information in 10447 the location status. This status can be evaluated with the 10448 following macros: 10449 10450 Note: These macros take the status value (an int) as an 10451 argument -- not a pointer to the value! 10452 10453 WIFEXITED(status) 10454 is nonzero if the child exited normally. 10455 10456 WEXITSTATUS(status) 10457 evaluates to the least significant eight bits of the 10458 return code of the child that terminated, which may 10459 have been set as the argument to a call to exit() or as 10460 the argument for a return statement in the main 10461 program. This macro can only be evaluated if 10462 WIFEXITED() returned nonzero. 10463 10464 WIFSIGNALED(status) 10465 returns true if the child process exited because of a 10466 signal that was not caught. 10467 10468 WTERMSIG(status) 10469 returns the number of the signal that caused the child 10470 process to terminate. This macro can only be evaluated 10471 if WIFSIGNALED() returned nonzero. 10472 10473 WIFSTOPPED(status) 10474 returns true if the child process that caused the 10475 return is currently stopped; this is only possible if 10476 the call was done using WUNTRACED(). 10477 10478 WSTOPSIG(status) 10479 returns the number of the signal that caused the child 10480 to stop. This macro can only be evaluated if 10481 WIFSTOPPED() returned nonzero. 10482 10483 If rusage is not NULL, the struct rusage (as defined in 10484 sys/resource.h) that it points to will be filled with 10485 accounting information. (See getrusage()(2) for details. 10486 10487 Return Value 10488 10489 On success, the process ID of the child that exited is 10490 returned. On error, -1 is returned (in particular, when no 10491 unwaited-for child processes of the specified kind exist), or 10492 0 if WNOHANG() was used and no child was available yet. In the 10493 latter two cases, the global variable errno is set 10494 appropriately. 10495 10496 Errors 10497 10498 ECHILD 10499 No unwaited-for child process as specified does exist. 10500 10501 ERESTARTSYS 10502 A WNOHANG() was not set and an unblocked signal or a 10503 SIGCHILD was caught. This error is returned by the 10504 system call. The library interface is not allowed to 10505 return ERESTARTSYS, but will return EINTR. 10506 10507 waitpid 10508 10509 Name 10510 10511 waitpid -- wait for child process 10512 10513 Description 10514 10515 waitpid() is as specified in ISO POSIX (2003), but with 10516 differences as listed below. 10517 10518 Need not support WCONTINUED or WIFCONTINUED 10519 10520 Implementations need not support the XSI optional 10521 functionality of WCONTINUED() or WIFCONTINUED(). 10522 10523 warn 10524 10525 Name 10526 10527 warn -- formatted error messages 10528 10529 Synopsis 10530 10531 #include 10532 10533 void warn(const char * fmt, ...); 10534 10535 Description 10536 10537 The warn() function shall display a formatted error message on 10538 the standard error stream. The output shall consist of the 10539 last component of the program name, a colon character, and a 10540 space character. If fmt is non-NULL, it shall be used as a 10541 format string for the printf() family of functions, and the 10542 formatted message, a colon character, and a space are written 10543 to stderr. Finally, the error message string affiliated with 10544 the current value of the global variable errno shall be 10545 written to stderr, followed by a newline character. 10546 10547 Return Value 10548 10549 None. 10550 10551 Errors 10552 10553 None. 10554 10555 warnx 10556 10557 Name 10558 10559 warnx -- formatted error messages 10560 10561 Synopsis 10562 10563 #include 10564 10565 void warnx(const char * fmt, ...); 10566 10567 Description 10568 10569 The warnx() function shall display a formatted error message 10570 on the standard error stream. The last component of the 10571 program name, a colon character, and a space shall be output. 10572 If fmt is non-NULL, it shall be used as the format string for 10573 the printf() family of functions, and the formatted error 10574 message, a colon character, and a space shall be output. The 10575 output shall be followed by a newline character. 10576 10577 Return Value 10578 10579 None. 10580 10581 Errors 10582 10583 None. 10584 10585 wcpcpy 10586 10587 Name 10588 10589 wcpcpy -- copy a wide character string, returning a pointer to 10590 its end 10591 10592 Synopsis 10593 10594 #include 10595 10596 wchar_t * wcpcpy(wchar_t * dest, const wchar_t * src); 10597 10598 Description 10599 10600 wcpcpy() is the wide-character equivalent of stpcpy(). It 10601 copies the wide character string src, including the 10602 terminating L'\0' character, to the array dest. 10603 10604 The strings may not overlap. 10605 10606 The programmer shall ensure that there is room for at least 10607 wcslen()(src)+1 wide characters at dest. 10608 10609 Return Value 10610 10611 wcpcpy() returns a pointer to the end of the wide-character 10612 string dest, that is, a pointer to the terminating L'\0' 10613 character. 10614 10615 wcpncpy 10616 10617 Name 10618 10619 wcpncpy -- copy a fixed-size string of wide characters, 10620 returning a pointer to its end 10621 10622 Synopsis 10623 10624 #include 10625 10626 wchar_t * wcpncpy(wchar_t * dest, const wchar_t * src, size_t 10627 n); 10628 10629 Description 10630 10631 wcpncpy() is the wide-character equivalent of stpncpy(). It 10632 copies at most n wide characters from the wide-character 10633 string src, including the terminating L'\0' character, to the 10634 array dest. Exactly n wide characters are written at dest. If 10635 the length wcslen()(src) is smaller than n, the remaining wide 10636 characters in the array dest are filled with L'\0' characters. 10637 If the length wcslen()(src) is greater than or equal to n, the 10638 string dest will not be L'\0' terminated. 10639 10640 The strings may not overlap. 10641 10642 The programmer shall ensure that there is room for at least n 10643 wide characters at dest. 10644 10645 Return Value 10646 10647 wcpncpy() returns a pointer to the wide character one past the 10648 last non-null wide character written. 10649 10650 wcscasecmp 10651 10652 Name 10653 10654 wcscasecmp -- compare two wide-character strings, ignoring 10655 case 10656 10657 Synopsis 10658 10659 #include 10660 10661 int wcscasecmp(const wchar_t * s1, const wchar_t * s2); 10662 10663 Description 10664 10665 wcscasecmp() is the wide-character equivalent of strcasecmp(). 10666 It compares the wide-character string s1 and the 10667 wide-character string s2, ignoring case differences (towupper, 10668 towlower). 10669 10670 Return Value 10671 10672 wcscasecmp() returns 0 if the wide-character strings s1 and s2 10673 are equal except for case distinctions. It returns a positive 10674 integer if s1 is greater than s2, ignoring case. It returns a 10675 negative integer if s1 is smaller than s2, ignoring case. 10676 10677 Notes 10678 10679 The behavior of wcscasecmp() depends upon the LC_CTYPE 10680 category of the current locale. 10681 10682 wcsdup 10683 10684 Name 10685 10686 wcsdup -- duplicate a wide-character string 10687 10688 Synopsis 10689 10690 #include 10691 10692 wchar_t * wcsdup(const wchar_t * s); 10693 10694 Description 10695 10696 wcsdup() is the wide-character equivalent of strdup(). It 10697 allocates and returns a new wide-character string whose 10698 initial contents is a duplicate of the wide-character string 10699 s. 10700 10701 Memory for the new wide-character string is obtained with 10702 malloc(), and can be freed with free(). 10703 10704 Return Value 10705 10706 wcsdup() returns a pointer to the new wide-character string, 10707 or NULL if sufficient memory was not available. 10708 10709 wcsncasecmp 10710 10711 Name 10712 10713 wcsncasecmp -- compare two fixed-size wide-character strings, 10714 ignoring case 10715 10716 Synopsis 10717 10718 #include 10719 10720 int wcsncasecmp(const wchar_t * s1, const wchar_t * s2, size_t 10721 n); 10722 10723 Description 10724 10725 wcsncasecmp() is the wide-character equivalent of 10726 strncasecmp(). It compares the wide-character string s1 and 10727 the wide-character string s2, but at most n wide characters 10728 from each string, ignoring case differences (towupper, 10729 towlower). 10730 10731 Return Value 10732 10733 wcscasecmp() returns 0 if the wide-character strings s1 and 10734 s2, truncated to at most length n, are equal except for case 10735 distinctions. It returns a positive integer if truncated s1 is 10736 greater than truncated s2, ignoring case. It returns a 10737 negative integer if truncated s1 is smaller than truncated s2, 10738 ignoring case. 10739 10740 Notes 10741 10742 The behavior of wcsncasecmp() depends upon the LC_CTYPE 10743 category of the current locale. 10744 10745 wcsnlen 10746 10747 Name 10748 10749 wcsnlen -- determine the length of a fixed-size wide-character 10750 string 10751 10752 Synopsis 10753 10754 #include 10755 10756 size_t wcsnlen(const wchar_t * s, size_t maxlen); 10757 10758 Description 10759 10760 wcsnlen() is the wide-character equivalent of strnlen(). It 10761 returns the number of wide-characters in the string s, not 10762 including the terminating L'\0' character, but at most maxlen. 10763 In doing this, wcsnlen() looks only at the first maxlen 10764 wide-characters at s and never beyond s + maxlen. 10765 10766 Return Value 10767 10768 wcsnlen() returns wcslen()(s) if that is less than maxlen, or 10769 maxlen if there is no L'\0' character among the first maxlen 10770 wide characters pointed to by s. 10771 10772 Notes 10773 10774 The behavior of wcsncasecmp() depends on the LC_CTYPE category 10775 of the current locale. 10776 10777 wcsnrtombs 10778 10779 Name 10780 10781 wcsnrtombs -- convert a wide character string to a multi-byte 10782 string 10783 10784 Synopsis 10785 10786 #include 10787 10788 size_t wcsnrtombs(char * dest, const wchar_t * * src, size_t 10789 nwc, size_t len, mbstate_t * ps); 10790 10791 Description 10792 10793 wcsnrtombs() is like wcsrtombs(), except that the number of 10794 wide characters to be converted, starting at src, is limited 10795 to nwc. 10796 10797 If dest is not a NULL pointer, wcsnrtombs() converts at most 10798 nwc wide characters from the wide-character string src to a 10799 multibyte string starting at dest. At most len bytes are 10800 written to dest. The state ps is updated. 10801 10802 The conversion is effectively performed by repeatedly calling: 10803 wcrtomb(dest, *src, ps) 10804 10805 as long as this call succeeds, and then incrementing dest by 10806 the number of bytes written and src by 1. 10807 10808 The conversion can stop for three reasons: 10809 10810 * A wide character has been encountered that cannot be 10811 represented as a multibyte sequence (according to the 10812 current locale). In this case src is left pointing to the 10813 invalid wide character, (size_t)(-1) is returned, and 10814 errno is set to EILSEQ. 10815 * nws wide characters have been converted without 10816 encountering a L'\0', or the length limit forces a stop. 10817 In this case, src is left pointing to the next wide 10818 character to be converted, and the number bytes written to 10819 dest is returned. 10820 * The wide-character string has been completely converted, 10821 including the terminating L'\0' (which has the side effect 10822 of bringing back ps to the initial state). In this case, 10823 src is set to NULL, and the number of bytes written to 10824 dest, excluding the terminating L'\0' byte, is returned. 10825 10826 If dest is NULL, len is ignored, and the conversion proceeds 10827 as above, except that the converted bytes are not written out 10828 to memory, and that no destination length limit exists. 10829 10830 In both of the above cases, if ps is a NULL pointer, a static 10831 anonymous state only known to wcsnrtombs() is used instead. 10832 10833 The programmer shall ensure that there is room for at least 10834 len bytes at dest. 10835 10836 Return Value 10837 10838 wcsnrtombs() returns the number of bytes that make up the 10839 converted part of multibyte sequence, not including the 10840 terminating L'\0' byte. If a wide character was encountered 10841 which could not be converted, (size_t)(-1) is returned, and 10842 the global variable errno set to EILSEQ. 10843 10844 Notes 10845 10846 The behavior of wcsnrtombs() depends on the LC_CTYPE category 10847 of the current locale. 10848 10849 Passing NULL as ps is not multi-thread safe. 10850 10851 wcstoq 10852 10853 Name 10854 10855 wcstoq -- convert wide string to long long int representation 10856 10857 Synopsis 10858 10859 #include 10860 10861 long long int wcstoq(const wchar_t * restrict nptr, wchar_t ** 10862 restrict endptr, int base); 10863 10864 Description 10865 10866 The wcstoq() function shall convert the initial portion of the 10867 wide string nptr to long long int representation. It is 10868 identical to wcstoll(). 10869 10870 Return Value 10871 10872 Refer to wcstoll(). 10873 10874 Errors 10875 10876 Refer to wcstoll(). 10877 10878 wcstouq 10879 10880 Name 10881 10882 wcstouq -- convert wide string to unsigned long long int 10883 representation 10884 10885 Synopsis 10886 10887 #include 10888 10889 unsigned long long wcstouq(const wchar_t * restrict nptr, 10890 wchar_t ** restrict endptr, int base); 10891 10892 Description 10893 10894 The wcstouq() function shall convert the initial portion of 10895 the wide string nptr to unsigned long long int representation. 10896 It is identical to wcstoull(). 10897 10898 Return Value 10899 10900 Refer to wcstoull(). 10901 10902 Errors 10903 10904 Refer to wcstoull(). 10905 10906 wscanf 10907 10908 Name 10909 10910 wscanf -- convert formatted input 10911 10912 Description 10913 10914 The scanf() family of functions shall behave as described in 10915 ISO POSIX (2003), except as noted below. 10916 10917 Differences 10918 10919 The %s, %S and %[ conversion specifiers shall accept an option 10920 length modifier a, which shall cause a memory buffer to be 10921 allocated to hold the string converted. In such a case, the 10922 argument corresponding to the conversion specifier should be a 10923 reference to a pointer value that will receive a pointer to 10924 the allocated buffer. If there is insufficient memory to 10925 allocate a buffer, the function may set errno to ENOMEM and a 10926 conversion error results. 10927 10928 Note: This directly conflicts with the ISO C (1999) usage 10929 of %a as a conversion specifier for hexadecimal float 10930 values. While this conversion specifier should be 10931 supported, a format specifier such as "%aseconds" will have 10932 a different meaning on an LSB conforming system. 10933 10934 xdr_u_int 10935 10936 Name 10937 10938 xdr_u_int -- library routines for external data representation 10939 10940 Synopsis 10941 10942 int xdr_u_int(XDR * xdrs, unsigned int * up); 10943 10944 Description 10945 10946 xdr_u_int() is a filter primitive that translates between C 10947 unsigned integers and their external representations. 10948 10949 Return Value 10950 10951 On success, 1 is returned. On error, 0 is returned. 10952 _________________________________________________________ 10953 10954 1.6. Interfaces for libm 10955 10956 Table 1-24 defines the library name and shared object name for 10957 the libm library 10958 10959 Table 1-24. libm Definition 10960 Library: libm 10961 SONAME: See archLSB. 10962 10963 The behavior of the interfaces in this library is specified by 10964 the following specifications: 10965 10966 ISO C (1999) 10967 this specification 10968 SUSv2 10969 ISO POSIX (2003) 10970 _________________________________________________________ 10971 10972 1.6.1. Math 10973 _________________________________________________________ 10974 10975 1.6.1.1. Interfaces for Math 10976 10977 An LSB conforming implementation shall provide the generic 10978 functions for Math specified in Table 1-25, with the full 10979 mandatory functionality as described in the referenced 10980 underlying specification. 10981 10982 Table 1-25. libm - Math Function Interfaces 10983 __finite [1] ccosl [2] exp [2] j1l [1] powf [2] 10984 __finitef [1] ceil [2] exp2 [2] jn [2] powl [2] 10985 __finitel [1] ceilf [2] exp2f [2] jnf [1] remainder [2] 10986 __fpclassify [3] ceill [2] expf [2] jnl [1] remainderf [2] 10987 __fpclassifyf [3] cexp [2] expl [2] ldexp [2] remainderl [2] 10988 __signbit [1] cexpf [2] expm1 [2] ldexpf [2] remquo [2] 10989 __signbitf [1] cexpl [2] expm1f [2] ldexpl [2] remquof [2] 10990 acos [2] cimag [2] expm1l [2] lgamma [2] remquol [2] 10991 acosf [2] cimagf [2] fabs [2] lgamma_r [1] rint [2] 10992 acosh [2] cimagl [2] fabsf [2] lgammaf [2] rintf [2] 10993 acoshf [2] clog [2] fabsl [2] lgammaf_r [1] rintl [2] 10994 acoshl [2] clog10 [1] fdim [2] lgammal [2] round [2] 10995 acosl [2] clog10f [1] fdimf [2] lgammal_r [1] roundf [2] 10996 asin [2] clog10l [1] fdiml [2] llrint [2] roundl [2] 10997 asinf [2] clogf [2] feclearexcept [2] llrintf [2] scalb [2] 10998 asinh [2] clogl [2] fegetenv [2] llrintl [2] scalbf [1] 10999 asinhf [2] conj [2] fegetexceptflag [2] llround [2] scalbl [1] 11000 asinhl [2] conjf [2] fegetround [2] llroundf [2] scalbln [2] 11001 asinl [2] conjl [2] feholdexcept [2] llroundl [2] scalblnf [2] 11002 atan [2] copysign [2] feraiseexcept [2] log [2] scalblnl [2] 11003 atan2 [2] copysignf [2] fesetenv [2] log10 [2] scalbn [2] 11004 atan2f [2] copysignl [2] fesetexceptflag [2] log10f [2] 11005 scalbnf [2] 11006 atan2l [2] cos [2] fesetround [2] log10l [2] scalbnl [2] 11007 atanf [2] cosf [2] fetestexcept [2] log1p [2] significand [1] 11008 atanh [2] cosh [2] feupdateenv [2] log1pf [2] significandf [1] 11009 atanhf [2] coshf [2] finite [4] log1pl [2] significandl [1] 11010 atanhl [2] coshl [2] finitef [1] log2 [2] sin [2] 11011 atanl [2] cosl [2] finitel [1] log2f [2] sincos [1] 11012 cabs [2] cpow [2] floor [2] log2l [2] sincosf [1] 11013 cabsf [2] cpowf [2] floorf [2] logb [2] sincosl [1] 11014 cabsl [2] cpowl [2] floorl [2] logbf [2] sinf [2] 11015 cacos [2] cproj [2] fma [2] logbl [2] sinh [2] 11016 cacosf [2] cprojf [2] fmaf [2] logf [2] sinhf [2] 11017 cacosh [2] cprojl [2] fmal [2] logl [2] sinhl [2] 11018 cacoshf [2] creal [2] fmax [2] lrint [2] sinl [2] 11019 cacoshl [2] crealf [2] fmaxf [2] lrintf [2] sqrt [2] 11020 cacosl [2] creall [2] fmaxl [2] lrintl [2] sqrtf [2] 11021 carg [2] csin [2] fmin [2] lround [2] sqrtl [2] 11022 cargf [2] csinf [2] fminf [2] lroundf [2] tan [2] 11023 cargl [2] csinh [2] fminl [2] lroundl [2] tanf [2] 11024 casin [2] csinhf [2] fmod [2] matherr [1] tanh [2] 11025 casinf [2] csinhl [2] fmodf [2] modf [2] tanhf [2] 11026 casinh [2] csinl [2] fmodl [2] modff [2] tanhl [2] 11027 casinhf [2] csqrt [2] frexp [2] modfl [2] tanl [2] 11028 casinhl [2] csqrtf [2] frexpf [2] nan [2] tgamma [2] 11029 casinl [2] csqrtl [2] frexpl [2] nanf [2] tgammaf [2] 11030 catan [2] ctan [2] gamma [4] nanl [2] tgammal [2] 11031 catanf [2] ctanf [2] gammaf [1] nearbyint [2] trunc [2] 11032 catanh [2] ctanh [2] gammal [1] nearbyintf [2] truncf [2] 11033 catanhf [2] ctanhf [2] hypot [2] nearbyintl [2] truncl [2] 11034 catanhl [2] ctanhl [2] hypotf [2] nextafter [2] y0 [2] 11035 catanl [2] ctanl [2] hypotl [2] nextafterf [2] y0f [1] 11036 cbrt [2] dremf [1] ilogb [2] nextafterl [2] y0l [1] 11037 cbrtf [2] dreml [1] ilogbf [2] nexttoward [2] y1 [2] 11038 cbrtl [2] erf [2] ilogbl [2] nexttowardf [2] y1f [1] 11039 ccos [2] erfc [2] j0 [2] nexttowardl [2] y1l [1] 11040 ccosf [2] erfcf [2] j0f [1] pow [2] yn [2] 11041 ccosh [2] erfcl [2] j0l [1] pow10 [1] ynf [1] 11042 ccoshf [2] erff [2] j1 [2] pow10f [1] ynl [1] 11043 ccoshl [2] erfl [2] j1f [1] pow10l [1] 11044 11045 Referenced Specification(s) 11046 11047 [1]. ISO C (1999) 11048 11049 [2]. ISO POSIX (2003) 11050 11051 [3]. this specification 11052 11053 [4]. SUSv2 11054 11055 An LSB conforming implementation shall provide the generic 11056 data interfaces for Math specified in Table 1-26, with the 11057 full mandatory functionality as described in the referenced 11058 underlying specification. 11059 11060 Table 1-26. libm - Math Data Interfaces 11061 signgam [1] 11062 11063 Referenced Specification(s) 11064 11065 [1]. ISO POSIX (2003) 11066 _________________________________________________________ 11067 11068 1.7. Data Definitions for libm 11069 11070 This section defines global identifiers and their values that 11071 are associated with interfaces contained in libm. These 11072 definitions are organized into groups that correspond to 11073 system headers. This convention is used as a convenience for 11074 the reader, and does not imply the existence of these headers, 11075 or their content. 11076 11077 These definitions are intended to supplement those provided in 11078 the referenced underlying specifications. 11079 11080 This specification uses ISO/IEC 9899 C Language as the 11081 reference programming language, and data definitions are 11082 specified in ISO C format. The C language is used here as a 11083 convenient notation. Using a C language description of these 11084 data objects does not preclude their use by other programming 11085 languages. 11086 _________________________________________________________ 11087 11088 1.7.1. complex.h 11089 11090 #define complex _Complex 11091 _________________________________________________________ 11092 11093 1.7.2. math.h 11094 11095 #define DOMAIN 1 11096 #define SING 2 11097 11098 struct exception 11099 { 11100 int type; 11101 char *name; 11102 double arg1; 11103 double arg2; 11104 double retval; 11105 } 11106 ; 11107 #define FP_NAN 0 11108 #define FP_INFINITE 1 11109 #define FP_ZERO 2 11110 #define FP_SUBNORMAL 3 11111 #define FP_NORMAL 4 11112 11113 #define isnormal(x) (fpclassify (x) == FP_NORMAL) 11114 #define isfinite(x) (sizeof (x) == sizeof (float) ? __finitef (x) : 11115 sizeof (x) == sizeof (double)? __finite (x) : __finitel (x)) 11116 #define isinf(x) (sizeof (x) == sizeof (float) ? __isinff (x): s 11117 izeof (x) == sizeof (double) ? __isinf (x) : __isinfl (x)) 11118 #define isnan(x) (sizeof (x) == sizeof (float) ? __isnanf (x) : 11119 sizeof (x) == sizeof (double) ? __isnan (x) : __isnanl (x)) 11120 11121 #define HUGE_VAL 0x1.0p2047 11122 #define HUGE_VALF 0x1.0p255f 11123 #define HUGE_VALL 0x1.0p32767L 11124 11125 #define NAN ((float)0x7fc00000UL) 11126 #define M_1_PI 0.31830988618379067154 11127 #define M_LOG10E 0.43429448190325182765 11128 #define M_2_PI 0.63661977236758134308 11129 #define M_LN2 0.69314718055994530942 11130 #define M_SQRT1_2 0.70710678118654752440 11131 #define M_PI_4 0.78539816339744830962 11132 #define M_2_SQRTPI 1.12837916709551257390 11133 #define M_SQRT2 1.41421356237309504880 11134 #define M_LOG2E 1.4426950408889634074 11135 #define M_PI_2 1.57079632679489661923 11136 #define M_LN10 2.30258509299404568402 11137 #define M_E 2.7182818284590452354 11138 #define M_PI 3.14159265358979323846 11139 #define INFINITY HUGE_VALF 11140 11141 #define MATH_ERRNO 1 11142 #define MATH_ERREXCEPT 2 11143 11144 #define isunordered(u, v) (__extension__({ __typeof__(u) __u = (u 11145 ); __typeof__(v) __v = (v);fpclassify (__u) == FP_NAN || fpclassify (__ 11146 v) == FP_NAN; })) 11147 #define islessgreater(x, y) (__extension__({ __typeof__(x) __x = (x 11148 ); __typeof__(y) __y = (y);!isunordered (__x, __y) & & (__x < __y || __ 11149 y < __x); })) 11150 #define isless(x,y) (__extension__({ __typeof__(x) __x = (x); __typ 11151 eof__(y) __y = (y);!isunordered (__x, __y) & & __x < __y; })) 11152 #define islessequal(x, y) (__extension__({ __typeof__(x) __x = (x 11153 ); __typeof__(y) __y = (y);!isunordered (__x, __y) & & __x <= __y; })) 11154 #define isgreater(x,y) (__extension__({ __typeof__(x) __x = (x); __typ 11155 eof__(y) __y = (y);!isunordered (__x, __y) & & __x > __y; })) 11156 #define isgreaterequal(x,y) (__extension__({ __typeof__(x) __x = (x 11157 ); __typeof__(y) __y = (y);!isunordered (__x, __y) & & __x >= __y; })) 11158 _________________________________________________________ 11159 11160 1.8. Interface Definitions for libm 11161 11162 Table of Contents 11163 __fpclassify -- Classify real floating type 11164 __fpclassifyf -- Classify real floating type 11165 11166 The following interfaces are included in libm and are defined 11167 by this specification. Unless otherwise noted, these 11168 interfaces shall be included in the source standard. 11169 11170 Other interfaces listed above for libm shall behave as 11171 described in the referenced base document. 11172 11173 __fpclassify 11174 11175 Name 11176 11177 __fpclassify -- Classify real floating type 11178 11179 Synopsis 11180 11181 int __fpclassify(double arg); 11182 11183 Description 11184 11185 __fpclassify() has the same specification as fpclassify() in 11186 ISO POSIX (2003), except that the argument type for 11187 __fpclassify() is known to be double. 11188 11189 __fpclassify() is not in the source standard; it is only in 11190 the binary standard. 11191 11192 __fpclassifyf 11193 11194 Name 11195 11196 __fpclassifyf -- Classify real floating type 11197 11198 Synopsis 11199 11200 int __fpclassifyf(float arg); 11201 11202 Description 11203 11204 __fpclassifyf() has the same specification as fpclassifyf() in 11205 ISO POSIX (2003), except that the argument type for 11206 __fpclassifyf() is known to be float. 11207 11208 __fpclassifyf() is not in the source standard; it is only in 11209 the binary standard. 11210 _________________________________________________________ 11211 11212 1.9. Interfaces for libpthread 11213 11214 Table 1-27 defines the library name and shared object name for 11215 the libpthread library 11216 11217 Table 1-27. libpthread Definition 11218 Library: libpthread 11219 SONAME: libpthread.so.0 11220 11221 The behavior of the interfaces in this library is specified by 11222 the following specifications: 11223 11224 Large File Support 11225 this specification 11226 ISO POSIX (2003) 11227 _________________________________________________________ 11228 11229 1.9.1. Realtime Threads 11230 _________________________________________________________ 11231 11232 1.9.1.1. Interfaces for Realtime Threads 11233 11234 An LSB conforming implementation shall provide the generic 11235 functions for Realtime Threads specified in Table 1-28, with 11236 the full mandatory functionality as described in the 11237 referenced underlying specification. 11238 11239 Table 1-28. libpthread - Realtime Threads Function Interfaces 11240 pthread_attr_getinheritsched [1] pthread_attr_getscope [1] 11241 pthread_attr_setschedpolicy [1] pthread_getschedparam [1] 11242 pthread_setschedprio(GLIBC_2.3.4) [1] 11243 pthread_attr_getschedpolicy [1] pthread_attr_setinheritsched 11244 [1] pthread_attr_setscope [1] pthread_setschedparam [1] 11245 11246 Referenced Specification(s) 11247 11248 [1]. ISO POSIX (2003) 11249 _________________________________________________________ 11250 11251 1.9.2. Advanced Realtime Threads 11252 _________________________________________________________ 11253 11254 1.9.2.1. Interfaces for Advanced Realtime Threads 11255 11256 No external functions are defined for libpthread - Advanced 11257 Realtime Threads 11258 _________________________________________________________ 11259 11260 1.9.3. Posix Threads 11261 _________________________________________________________ 11262 11263 1.9.3.1. Interfaces for Posix Threads 11264 11265 An LSB conforming implementation shall provide the generic 11266 functions for Posix Threads specified in Table 1-29, with the 11267 full mandatory functionality as described in the referenced 11268 underlying specification. 11269 11270 Table 1-29. libpthread - Posix Threads Function Interfaces 11271 _pthread_cleanup_pop [1] pthread_attr_setstacksize [2] 11272 pthread_getspecific [2] pthread_rwlock_destroy [2] 11273 pthread_setspecific [2] 11274 _pthread_cleanup_push [1] pthread_cancel [2] pthread_join [2] 11275 pthread_rwlock_init [2] pthread_sigmask [2] 11276 pread [2] pthread_cond_broadcast [2] pthread_key_create [2] 11277 pthread_rwlock_rdlock [2] pthread_testcancel [2] 11278 pread64 [3] pthread_cond_destroy [2] pthread_key_delete [2] 11279 pthread_rwlock_timedrdlock [2] pwrite [2] 11280 pthread_attr_destroy [2] pthread_cond_init [2] pthread_kill 11281 [2] pthread_rwlock_timedwrlock [2] pwrite64 [3] 11282 pthread_attr_getdetachstate [2] pthread_cond_signal [2] 11283 pthread_mutex_destroy [2] pthread_rwlock_tryrdlock [2] 11284 sem_close [2] 11285 pthread_attr_getguardsize [2] pthread_cond_timedwait [2] 11286 pthread_mutex_init [2] pthread_rwlock_trywrlock [2] 11287 sem_destroy [2] 11288 pthread_attr_getschedparam [2] pthread_cond_wait [2] 11289 pthread_mutex_lock [2] pthread_rwlock_unlock [2] sem_getvalue 11290 [2] 11291 pthread_attr_getstack [2] pthread_condattr_destroy [2] 11292 pthread_mutex_trylock [2] pthread_rwlock_wrlock [2] sem_init 11293 [2] 11294 pthread_attr_getstackaddr [2] pthread_condattr_getpshared [2] 11295 pthread_mutex_unlock [2] pthread_rwlockattr_destroy [2] 11296 sem_open [2] 11297 pthread_attr_getstacksize [2] pthread_condattr_init [2] 11298 pthread_mutexattr_destroy [2] pthread_rwlockattr_getpshared 11299 [2] sem_post [2] 11300 pthread_attr_init [2] pthread_condattr_setpshared [2] 11301 pthread_mutexattr_getpshared [2] pthread_rwlockattr_init [2] 11302 sem_timedwait [2] 11303 pthread_attr_setdetachstate [2] pthread_create [2] 11304 pthread_mutexattr_gettype [2] pthread_rwlockattr_setpshared 11305 [2] sem_trywait [2] 11306 pthread_attr_setguardsize [2] pthread_detach [2] 11307 pthread_mutexattr_init [2] pthread_self [2] sem_unlink [2] 11308 pthread_attr_setschedparam [2] pthread_equal [2] 11309 pthread_mutexattr_setpshared [2] pthread_setcancelstate [2] 11310 sem_wait [2] 11311 pthread_attr_setstack [2] pthread_exit [2] 11312 pthread_mutexattr_settype [2] pthread_setcanceltype [2] 11313 pthread_attr_setstackaddr [2] pthread_getconcurrency [2] 11314 pthread_once [2] pthread_setconcurrency [2] 11315 11316 Referenced Specification(s) 11317 11318 [1]. this specification 11319 11320 [2]. ISO POSIX (2003) 11321 11322 [3]. Large File Support 11323 _________________________________________________________ 11324 11325 1.10. Data Definitions for libpthread 11326 11327 This section defines global identifiers and their values that 11328 are associated with interfaces contained in libpthread. These 11329 definitions are organized into groups that correspond to 11330 system headers. This convention is used as a convenience for 11331 the reader, and does not imply the existence of these headers, 11332 or their content. 11333 11334 These definitions are intended to supplement those provided in 11335 the referenced underlying specifications. 11336 11337 This specification uses ISO/IEC 9899 C Language as the 11338 reference programming language, and data definitions are 11339 specified in ISO C format. The C language is used here as a 11340 convenient notation. Using a C language description of these 11341 data objects does not preclude their use by other programming 11342 languages. 11343 _________________________________________________________ 11344 11345 1.10.1. pthread.h 11346 11347 #define PTHREAD_SCOPE_SYSTEM 0 11348 #define PTHREAD_MUTEX_DEFAULT 1 11349 #define PTHREAD_MUTEX_NORMAL 1 11350 #define PTHREAD_SCOPE_PROCESS 1 11351 #define PTHREAD_MUTEX_RECURSIVE 2 11352 #define PTHREAD_RWLOCK_DEFAULT_NP 2 11353 #define PTHREAD_MUTEX_ERRORCHECK 3 11354 #define pthread_cleanup_pop(execute) _pthread_cleanup_pop(& _buffer, 11355 (execute));} 11356 #define __LOCK_INITIALIZER { 0, 0 } 11357 #define PTHREAD_RWLOCK_INITIALIZER { __LOCK_INITIALIZER, 0, NULL, 11358 NULL, NULL,PTHREAD_RWLOCK_DEFAULT_NP, PTHREAD_PROCESS_PRIVATE } 11359 #define PTHREAD_MUTEX_INITIALIZER {0,0,0,PTHREAD_MUTEX_NORMAL,__L 11360 OCK_INITIALIZER} 11361 #define pthread_cleanup_push(routine,arg) {struct _pthread_cleanu 11362 p_buffer _buffer;_pthread_cleanup_push(& _buffer,(routine),(arg)); 11363 #define PTHREAD_COND_INITIALIZER {__LOCK_INITIALIZER,0} 11364 11365 struct _pthread_cleanup_buffer 11366 { 11367 void (*__routine) (void *); 11368 void *__arg; 11369 int __canceltype; 11370 struct _pthread_cleanup_buffer *__prev; 11371 } 11372 ; 11373 typedef unsigned int pthread_key_t; 11374 typedef int pthread_once_t; 11375 typedef long long int __pthread_cond_align_t; 11376 11377 typedef unsigned long int pthread_t; 11378 struct _pthread_fastlock 11379 { 11380 long int __status; 11381 int __spinlock; 11382 } 11383 ; 11384 11385 typedef struct _pthread_descr_struct *_pthread_descr; 11386 11387 typedef struct 11388 { 11389 int __m_reserved; 11390 int __m_count; 11391 _pthread_descr __m_owner; 11392 int __m_kind; 11393 struct _pthread_fastlock __m_lock; 11394 } 11395 pthread_mutex_t; 11396 typedef struct 11397 { 11398 int __mutexkind; 11399 } 11400 pthread_mutexattr_t; 11401 11402 typedef struct 11403 { 11404 int __detachstate; 11405 int __schedpolicy; 11406 struct sched_param __schedparam; 11407 int __inheritsched; 11408 int __scope; 11409 size_t __guardsize; 11410 int __stackaddr_set; 11411 void *__stackaddr; 11412 unsigned long int __stacksize; 11413 } 11414 pthread_attr_t; 11415 11416 typedef struct 11417 { 11418 struct _pthread_fastlock __c_lock; 11419 _pthread_descr __c_waiting; 11420 char __padding[48 - sizeof (struct _pthread_fastlock) - 11421 sizeof (_pthread_descr) - sizeof (__pthread_cond_align 11422 _t)]; 11423 __pthread_cond_align_t __align; 11424 } 11425 pthread_cond_t; 11426 typedef struct 11427 { 11428 int __dummy; 11429 } 11430 pthread_condattr_t; 11431 11432 typedef struct _pthread_rwlock_t 11433 { 11434 struct _pthread_fastlock __rw_lock; 11435 int __rw_readers; 11436 _pthread_descr __rw_writer; 11437 _pthread_descr __rw_read_waiting; 11438 _pthread_descr __rw_write_waiting; 11439 int __rw_kind; 11440 int __rw_pshared; 11441 } 11442 pthread_rwlock_t; 11443 typedef struct 11444 { 11445 int __lockkind; 11446 int __pshared; 11447 } 11448 pthread_rwlockattr_t; 11449 11450 #define PTHREAD_CREATE_JOINABLE 0 11451 #define PTHREAD_INHERIT_SCHED 0 11452 #define PTHREAD_ONCE_INIT 0 11453 #define PTHREAD_PROCESS_PRIVATE 0 11454 #define PTHREAD_CREATE_DETACHED 1 11455 #define PTHREAD_EXPLICIT_SCHED 1 11456 #define PTHREAD_PROCESS_SHARED 1 11457 11458 #define PTHREAD_CANCELED ((void*)-1) 11459 #define PTHREAD_CANCEL_DEFERRED 0 11460 #define PTHREAD_CANCEL_ENABLE 0 11461 #define PTHREAD_CANCEL_ASYNCHRONOUS 1 11462 #define PTHREAD_CANCEL_DISABLE 1 11463 _________________________________________________________ 11464 11465 1.10.2. semaphore.h 11466 11467 typedef struct 11468 { 11469 struct _pthread_fastlock __sem_lock; 11470 int __sem_value; 11471 _pthread_descr __sem_waiting; 11472 } 11473 sem_t; 11474 #define SEM_FAILED ((sem_t*)0) 11475 11476 #define SEM_VALUE_MAX ((int)((~0u)>>1)) 11477 _________________________________________________________ 11478 11479 1.11. Interface Definitions for libpthread 11480 11481 Table of Contents 11482 _pthread_cleanup_pop -- establish cancellation handlers 11483 _pthread_cleanup_push -- establish cancellation handlers 11484 11485 The following interfaces are included in libpthread and are 11486 defined by this specification. Unless otherwise noted, these 11487 interfaces shall be included in the source standard. 11488 11489 Other interfaces listed above for libpthread shall behave as 11490 described in the referenced base document. 11491 11492 _pthread_cleanup_pop 11493 11494 Name 11495 11496 _pthread_cleanup_pop -- establish cancellation handlers 11497 11498 Synopsis 11499 11500 #include 11501 11502 void _pthread_cleanup_pop(struct _pthread_cleanup_buffer *, 11503 int); 11504 11505 Description 11506 11507 The _pthread_cleanup_pop() function provides an implementation 11508 of the pthread_cleanup_pop() macro described in ISO POSIX 11509 (2003). 11510 11511 The _pthread_cleanup_pop() function is not in the source 11512 standard; it is only in the binary standard. 11513 11514 _pthread_cleanup_push 11515 11516 Name 11517 11518 _pthread_cleanup_push -- establish cancellation handlers 11519 11520 Synopsis 11521 11522 #include 11523 11524 void _pthread_cleanup_push(struct _pthread_cleanup_buffer *, 11525 void (*) (void *), void *); 11526 11527 Description 11528 11529 The _pthread_cleanup_push() function provides an 11530 implementation of the pthread_cleanup_push() macro described 11531 in ISO POSIX (2003). 11532 11533 The _pthread_cleanup_push() function is not in the source 11534 standard; it is only in the binary standard. 11535 _________________________________________________________ 11536 11537 1.12. Interfaces for libgcc_s 11538 11539 Table 1-30 defines the library name and shared object name for 11540 the libgcc_s library 11541 11542 Table 1-30. libgcc_s Definition 11543 Library: libgcc_s 11544 SONAME: libgcc_s.so.1 11545 _________________________________________________________ 11546 11547 1.12.1. Unwind Library 11548 _________________________________________________________ 11549 11550 1.12.1.1. Interfaces for Unwind Library 11551 11552 No external functions are defined for libgcc_s - Unwind 11553 Library 11554 _________________________________________________________ 11555 11556 1.13. Data Definitions for libgcc_s 11557 11558 This section defines global identifiers and their values that 11559 are associated with interfaces contained in libgcc_s. These 11560 definitions are organized into groups that correspond to 11561 system headers. This convention is used as a convenience for 11562 the reader, and does not imply the existence of these headers, 11563 or their content. 11564 11565 These definitions are intended to supplement those provided in 11566 the referenced underlying specifications. 11567 11568 This specification uses ISO/IEC 9899 C Language as the 11569 reference programming language, and data definitions are 11570 specified in ISO C format. The C language is used here as a 11571 convenient notation. Using a C language description of these 11572 data objects does not preclude their use by other programming 11573 languages. 11574 _________________________________________________________ 11575 11576 1.13.1. unwind.h 11577 11578 struct dwarf_eh_base 11579 { 11580 void *tbase; 11581 void *dbase; 11582 void *func; 11583 } 11584 ; 11585 struct _Unwind_Context; 11586 11587 typedef unsigned int _Unwind_Ptr; 11588 typedef unsigned int _Unwind_Word; 11589 11590 typedef enum 11591 { 11592 _URC_NO_REASON, _URC_FOREIGN_EXCEPTION_CAUGHT = 1, _URC_FATAL_PHASE2_ 11593 ERROR = 11594 2, _URC_FATAL_PHASE1_ERROR = 3, _URC_NORMAL_STOP = 4, _URC_END_OF_S 11595 TACK = 11596 5, _URC_HANDLER_FOUND = 6, _URC_INSTALL_CONTEXT = 11597 7, _URC_CONTINUE_UNWIND = 8 11598 } 11599 _Unwind_Reason_Code; 11600 11601 struct _Unwind_Exception 11602 { 11603 _Unwind_Exception_Class; 11604 _Unwind_Exception_Cleanup_Fn; 11605 _Unwind_Word; 11606 _Unwind_Word; 11607 } 11608 ; 11609 #define _UA_SEARCH_PHASE 1 11610 #define _UA_END_OF_STACK 16 11611 #define _UA_CLEANUP_PHASE 2 11612 #define _UA_HANDLER_FRAME 4 11613 #define _UA_FORCE_UNWIND 8 11614 _________________________________________________________ 11615 11616 1.14. Interfaces for libdl 11617 11618 Table 1-31 defines the library name and shared object name for 11619 the libdl library 11620 11621 Table 1-31. libdl Definition 11622 Library: libdl 11623 SONAME: libdl.so.2 11624 11625 The behavior of the interfaces in this library is specified by 11626 the following specifications: 11627 11628 this specification 11629 ISO POSIX (2003) 11630 _________________________________________________________ 11631 11632 1.14.1. Dynamic Loader 11633 _________________________________________________________ 11634 11635 1.14.1.1. Interfaces for Dynamic Loader 11636 11637 An LSB conforming implementation shall provide the generic 11638 functions for Dynamic Loader specified in Table 1-32, with the 11639 full mandatory functionality as described in the referenced 11640 underlying specification. 11641 11642 Table 1-32. libdl - Dynamic Loader Function Interfaces 11643 dladdr [1] dlclose [2] dlerror [2] dlopen [1] dlsym [1] 11644 11645 Referenced Specification(s) 11646 11647 [1]. this specification 11648 11649 [2]. ISO POSIX (2003) 11650 _________________________________________________________ 11651 11652 1.15. Data Definitions for libdl 11653 11654 This section defines global identifiers and their values that 11655 are associated with interfaces contained in libdl. These 11656 definitions are organized into groups that correspond to 11657 system headers. This convention is used as a convenience for 11658 the reader, and does not imply the existence of these headers, 11659 or their content. 11660 11661 These definitions are intended to supplement those provided in 11662 the referenced underlying specifications. 11663 11664 This specification uses ISO/IEC 9899 C Language as the 11665 reference programming language, and data definitions are 11666 specified in ISO C format. The C language is used here as a 11667 convenient notation. Using a C language description of these 11668 data objects does not preclude their use by other programming 11669 languages. 11670 _________________________________________________________ 11671 11672 1.15.1. dlfcn.h 11673 11674 #define RTLD_NEXT ((void *) -1l) 11675 #define RTLD_LOCAL 0 11676 #define RTLD_LAZY 0x00001 11677 #define RTLD_NOW 0x00002 11678 #define RTLD_GLOBAL 0x00100 11679 11680 typedef struct 11681 { 11682 char *dli_fname; 11683 void *dli_fbase; 11684 char *dli_sname; 11685 void *dli_saddr; 11686 } 11687 Dl_info; 11688 _________________________________________________________ 11689 11690 1.16. Interface Definitions for libdl 11691 11692 Table of Contents 11693 dladdr -- find the shared object containing a given address 11694 dlopen -- open dynamic object 11695 dlsym -- obtain the address of a symbol from a dlopen object 11696 11697 The following interfaces are included in libdl and are defined 11698 by this specification. Unless otherwise noted, these 11699 interfaces shall be included in the source standard. 11700 11701 Other interfaces listed above for libdl shall behave as 11702 described in the referenced base document. 11703 11704 dladdr 11705 11706 Name 11707 11708 dladdr -- find the shared object containing a given address 11709 11710 Synopsis 11711 11712 #include 11713 11714 typedef struct { 11715 const char *dli_fname; 11716 void *dli_fbase; 11717 const char *dli_sname; 11718 void *dli_saddr; 11719 } Dl_info; 11720 11721 int dladdr(const void * addr, Dl_info * dlip); 11722 11723 Description 11724 11725 The dladdr() function shall query the dynamic linker for 11726 information about the shared object containing the address 11727 addr. The information shall be returned in the user supplied 11728 data structure referenced by dlip. 11729 11730 The structure shall contain at least the following members: 11731 11732 dli_fname 11733 The pathname of the shared object containing the 11734 address 11735 11736 dli_fbase 11737 The base address at which the shared object is mapped 11738 into the address space of the calling process. 11739 11740 dli_sname 11741 The name of the nearest runtime symbol with value less 11742 than or equal to addr. Where possible, the symbol name 11743 shall be returned as it would appear in C source code. 11744 11745 If no symbol with a suitable value is found, both this 11746 field and dli_saddr shall be set to NULL. 11747 11748 dli_saddr 11749 The address of the symbol returned in dli_sname. 11750 11751 The behavior of dladdr() is only specified in dynamically 11752 linked programs. 11753 11754 Return Value 11755 11756 On success, dladdr() shall return non-zero, and the structure 11757 referenced by dlip shall be filled in as described. Otherwise, 11758 dladdr() shall return zero, and the cause of the error can be 11759 fetched with dlerr(). 11760 11761 Errors 11762 11763 See dlerr(). 11764 11765 Environment 11766 11767 LD_LIBRARY_PATH 11768 directory search-path for object files 11769 11770 dlopen 11771 11772 Name 11773 11774 dlopen -- open dynamic object 11775 11776 Synopsis 11777 11778 #include 11779 11780 void * dlopen(const char * filename, int flag); 11781 11782 Description 11783 11784 dlopen shall behave as specified in ISO POSIX (2003), but with 11785 additional behaviors listed below. 11786 11787 If the file argument does not contain a slash character, then 11788 the system shall look for a library of that name in at least 11789 the following directories, and use the first one which is 11790 found: 11791 11792 * The directories specified by the DT_RPATH dynamic entry. 11793 * The directories specified in the LD_LIBRARY_PATH 11794 environment variable (which is a colon separated list of 11795 pathnames). This step shall be skipped for setuid and 11796 setgid executables. 11797 * A set of directories sufficient to contain the libraries 11798 specified in this standard. 11799 11800 Note: Traditionally, /lib and /usr/lib. This case would 11801 also cover cases in which the system used the mechanism of 11802 /etc/ld.so.conf and /etc/ld.so.cache to provide access. 11803 Example: An application which is not linked against libm 11804 may choose to dlopen libm. 11805 11806 dlsym 11807 11808 Name 11809 11810 dlsym -- obtain the address of a symbol from a dlopen object 11811 11812 Description 11813 11814 dlsym() is as specified in the ISO POSIX (2003), but with 11815 differences as listed below. 11816 11817 The special purpose value for handle RTLD_NEXT 11818 11819 The value RTLD_NEXT, which is reserved for future use shall be 11820 available, with the behavior as described in ISO POSIX (2003). 11821 _________________________________________________________ 11822 11823 1.17. Interfaces for libcrypt 11824 11825 Table 1-33 defines the library name and shared object name for 11826 the libcrypt library 11827 11828 Table 1-33. libcrypt Definition 11829 Library: libcrypt 11830 SONAME: libcrypt.so.1 11831 11832 The behavior of the interfaces in this library is specified by 11833 the following specifications: 11834 11835 ISO POSIX (2003) 11836 _________________________________________________________ 11837 11838 1.17.1. Encryption 11839 _________________________________________________________ 11840 11841 1.17.1.1. Interfaces for Encryption 11842 11843 An LSB conforming implementation shall provide the generic 11844 functions for Encryption specified in Table 1-34, with the 11845 full mandatory functionality as described in the referenced 11846 underlying specification. 11847 11848 Table 1-34. libcrypt - Encryption Function Interfaces 11849 crypt [1] encrypt [1] setkey [1] 11850 11851 Referenced Specification(s) 11852 11853 [1]. ISO POSIX (2003) 11854 _________________________________________________________ 11855 11856 1.18. Interfaces for libpam 11857 11858 Table 1-35 defines the library name and shared object name for 11859 the libpam library 11860 11861 Table 1-35. libpam Definition 11862 Library: libpam 11863 SONAME: libpam.so.0 11864 11865 A single service name, other, shall always be present. The 11866 behavior of this service shall be determined by the system 11867 administrator. Additional service names may also exist. [1] 11868 11869 The behavior of the interfaces in this library is specified by 11870 the following specifications: 11871 11872 this specification 11873 _________________________________________________________ 11874 11875 1.18.1. Pluggable Authentication API 11876 _________________________________________________________ 11877 11878 1.18.1.1. Interfaces for Pluggable Authentication API 11879 11880 An LSB conforming implementation shall provide the generic 11881 functions for Pluggable Authentication API specified in Table 11882 1-36, with the full mandatory functionality as described in 11883 the referenced underlying specification. 11884 11885 Table 1-36. libpam - Pluggable Authentication API Function 11886 Interfaces 11887 pam_acct_mgmt [1] pam_close_session [1] pam_get_item [1] 11888 pam_set_item [1] pam_strerror [1] 11889 pam_authenticate [1] pam_end [1] pam_getenvlist [1] 11890 pam_setcred [1] 11891 pam_chauthtok [1] pam_fail_delay [1] pam_open_session [1] 11892 pam_start [1] 11893 11894 Referenced Specification(s) 11895 11896 [1]. this specification 11897 _________________________________________________________ 11898 11899 1.19. Data Definitions for libpam 11900 11901 This section defines global identifiers and their values that 11902 are associated with interfaces contained in libpam. These 11903 definitions are organized into groups that correspond to 11904 system headers. This convention is used as a convenience for 11905 the reader, and does not imply the existence of these headers, 11906 or their content. 11907 11908 These definitions are intended to supplement those provided in 11909 the referenced underlying specifications. 11910 11911 This specification uses ISO/IEC 9899 C Language as the 11912 reference programming language, and data definitions are 11913 specified in ISO C format. The C language is used here as a 11914 convenient notation. Using a C language description of these 11915 data objects does not preclude their use by other programming 11916 languages. 11917 _________________________________________________________ 11918 11919 1.19.1. security/pam_appl.h 11920 11921 typedef struct pam_handle pam_handle_t; 11922 struct pam_message 11923 { 11924 int msg_style; 11925 const char *msg; 11926 } 11927 ; 11928 struct pam_response 11929 { 11930 char *resp; 11931 int resp_retcode; 11932 } 11933 ; 11934 11935 struct pam_conv 11936 { 11937 int (*conv) (int num_msg, const struct pam_message * *msg, 11938 struct pam_response * *resp, void *appdata_ptr); 11939 void *appdata_ptr; 11940 } 11941 ; 11942 #define PAM_PROMPT_ECHO_OFF 1 11943 #define PAM_PROMPT_ECHO_ON 2 11944 #define PAM_ERROR_MSG 3 11945 #define PAM_TEXT_INFO 4 11946 11947 #define PAM_SERVICE 1 11948 #define PAM_USER 2 11949 #define PAM_TTY 3 11950 #define PAM_RHOST 4 11951 #define PAM_CONV 5 11952 #define PAM_RUSER 8 11953 #define PAM_USER_PROMPT 9 11954 11955 #define PAM_SUCCESS 0 11956 #define PAM_OPEN_ERR 1 11957 #define PAM_USER_UNKNOWN 10 11958 #define PAM_MAXTRIES 11 11959 #define PAM_NEW_AUTHTOK_REQD 12 11960 #define PAM_ACCT_EXPIRED 13 11961 #define PAM_SESSION_ERR 14 11962 #define PAM_CRED_UNAVAIL 15 11963 #define PAM_CRED_EXPIRED 16 11964 #define PAM_CRED_ERR 17 11965 #define PAM_CONV_ERR 19 11966 #define PAM_SYMBOL_ERR 2 11967 #define PAM_AUTHTOK_ERR 20 11968 #define PAM_AUTHTOK_RECOVER_ERR 21 11969 #define PAM_AUTHTOK_LOCK_BUSY 22 11970 #define PAM_AUTHTOK_DISABLE_AGING 23 11971 #define PAM_TRY_AGAIN 24 11972 #define PAM_ABORT 26 11973 #define PAM_AUTHTOK_EXPIRED 27 11974 #define PAM_BAD_ITEM 29 11975 #define PAM_SERVICE_ERR 3 11976 #define PAM_SYSTEM_ERR 4 11977 #define PAM_BUF_ERR 5 11978 #define PAM_PERM_DENIED 6 11979 #define PAM_AUTH_ERR 7 11980 #define PAM_CRED_INSUFFICIENT 8 11981 #define PAM_AUTHINFO_UNAVAIL 9 11982 11983 #define PAM_DISALLOW_NULL_AUTHTOK 0x0001U 11984 #define PAM_ESTABLISH_CRED 0x0002U 11985 #define PAM_DELETE_CRED 0x0004U 11986 #define PAM_REINITIALIZE_CRED 0x0008U 11987 #define PAM_REFRESH_CRED 0x0010U 11988 #define PAM_CHANGE_EXPIRED_AUTHTOK 0x0020U 11989 #define PAM_SILENT 0x8000U 11990 _________________________________________________________ 11991 11992 1.20. Interface Definitions for libpam 11993 11994 Table of Contents 11995 pam_acct_mgmt -- establish the status of a user's account 11996 pam_authenticate -- authenticate the user 11997 pam_chauthtok -- change the authentication token for a given 11998 user 11999 12000 pam_close_session -- indicate that an authenticated session 12001 has ended 12002 12003 pam_end -- terminate the use of the PAM library 12004 pam_fail_delay -- specify delay time to use on authentication 12005 error 12006 12007 pam_get_item -- obtain the value of the indicated item. 12008 pam_getenvlist -- returns a pointer to the complete PAM 12009 environment. 12010 12011 pam_open_session -- used to indicate that an authenticated 12012 session has been initiated 12013 12014 pam_set_item -- (re)set the value of an item. 12015 pam_setcred -- set the module-specific credentials of the user 12016 pam_start -- initialize the PAM library 12017 pam_strerror -- returns a string describing the PAM error 12018 12019 The following interfaces are included in libpam and are 12020 defined by this specification. Unless otherwise noted, these 12021 interfaces shall be included in the source standard. 12022 12023 Other interfaces listed above for libpam shall behave as 12024 described in the referenced base document. 12025 12026 pam_acct_mgmt 12027 12028 Name 12029 12030 pam_acct_mgmt -- establish the status of a user's account 12031 12032 Synopsis 12033 12034 #include 12035 12036 int pam_acct_mgmt(pam_handle_t * pamh, int flags); 12037 12038 Description 12039 12040 pam_acct_mgmt() establishes the account's usability and the 12041 user's accessibility to the system. It is typically called 12042 after the user has been authenticated. 12043 12044 flags may be specified as any valid flag (namely, one of those 12045 applicable to the flags argument of pam_authenticate()). 12046 Additionally, the value of flags may be logically or'd with 12047 PAM_SILENT. 12048 12049 Return Value 12050 12051 PAM_SUCCESS 12052 Success. 12053 12054 PAM_NEW_AUTHTOK_REQD 12055 User is valid, but user's authentication token has 12056 expired. The correct response to this return-value is 12057 to require that the user satisfy the pam_chauthtok() 12058 function before obtaining service. It may not be 12059 possible for an application to do this. In such a case, 12060 the user should be denied access until the account 12061 password is updated. 12062 12063 PAM_ACCT_EXPIRED 12064 User is no longer permitted access to the system. 12065 12066 PAM_AUTH_ERR 12067 Authentication error. 12068 12069 PAM_PERM_DENIED 12070 User is not permitted to gain access at this time. 12071 12072 PAM_USER_UNKNOWN 12073 User is not known to a module's account management 12074 component. 12075 12076 Errors 12077 12078 May be translated to text with pam_strerror(). 12079 12080 pam_authenticate 12081 12082 Name 12083 12084 pam_authenticate -- authenticate the user 12085 12086 Synopsis 12087 12088 #include 12089 12090 int pam_authenticate(pam_handle_t * pamh, int flags); 12091 12092 Description 12093 12094 pam_authenticate() serves as an interface to the 12095 authentication mechanisms of the loaded modules. 12096 12097 flags is an optional parameter that may be specified by the 12098 following value: 12099 12100 PAM_DISALLOW_NULL_AUTHTOK 12101 Instruct the authentication modules to return 12102 PAM_AUTH_ERR if the user does not have a registered 12103 authorization token. 12104 12105 Additionally, the value of flags may be logically or'd with 12106 PAM_SILENT. 12107 12108 The process may need to be privileged in order to successfully 12109 call this function. 12110 12111 Return Value 12112 12113 PAM_SUCCESS 12114 Success. 12115 12116 PAM_AUTH_ERR 12117 User was not authenticated or process did not have 12118 sufficient privileges to perform authentication. 12119 12120 PAM_CRED_INSUFFICIENT 12121 Application does not have sufficient credentials to 12122 authenticate the user. 12123 12124 PAM_AUTHINFO_UNAVAIL 12125 Modules were not able to access the authentication 12126 information. This might be due to a network or hardware 12127 failure, etc. 12128 12129 PAM_USER_UNKNOWN 12130 Supplied username is not known to the authentication 12131 service. 12132 12133 PAM_MAXTRIES 12134 One or more authentication modules has reached its 12135 limit of tries authenticating the user. Do not try 12136 again. 12137 12138 PAM_ABORT 12139 One or more authentication modules failed to load. 12140 12141 Errors 12142 12143 May be translated to text with pam_strerror(). 12144 12145 pam_chauthtok 12146 12147 Name 12148 12149 pam_chauthtok -- change the authentication token for a given 12150 user 12151 12152 Synopsis 12153 12154 #include 12155 12156 int pam_chauthtok(pam_handle_t * pamh, const int flags); 12157 12158 Description 12159 12160 pam_chauthtok() is used to change the authentication token for 12161 a given user as indicated by the state associated with the 12162 handle pamh. 12163 12164 flags is an optional parameter that may be specified by the 12165 following value: 12166 12167 PAM_CHANGE_EXPIRED_AUTHTOK 12168 User's authentication token should only be changed if 12169 it has expired. 12170 12171 Additionally, the value of flags may be logically or'd with 12172 PAM_SILENT. 12173 12174 RETURN VALUE 12175 12176 PAM_SUCCESS 12177 Success. 12178 12179 PAM_AUTHTOK_ERR 12180 A module was unable to obtain the new authentication 12181 token. 12182 12183 PAM_AUTHTOK_RECOVER_ERR 12184 A module was unable to obtain the old authentication 12185 token. 12186 12187 PAM_AUTHTOK_LOCK_BUSY 12188 One or more modules were unable to change the 12189 authentication token since it is currently locked. 12190 12191 PAM_AUTHTOK_DISABLE_AGING 12192 Authentication token aging has been disabled for at 12193 least one of the modules. 12194 12195 PAM_PERM_DENIED 12196 Permission denied. 12197 12198 PAM_TRY_AGAIN 12199 Not all modules were in a position to update the 12200 authentication token(s). In such a case, none of the 12201 user's authentication tokens are updated. 12202 12203 PAM_USER_UNKNOWN 12204 User is not known to the authentication token changing 12205 service. 12206 12207 ERRORS 12208 12209 May be translated to text with pam_strerror(). 12210 12211 pam_close_session 12212 12213 Name 12214 12215 pam_close_session -- indicate that an authenticated session 12216 has ended 12217 12218 Synopsis 12219 12220 #include 12221 12222 int pam_close_session(pam_handle_t * pamh, int flags); 12223 12224 Description 12225 12226 pam_close_session() is used to indicate that an authenticated 12227 session has ended. It is used to inform the module that the 12228 user is exiting a session. It should be possible for the PAM 12229 library to open a session and close the same session from 12230 different applications. 12231 12232 flags may have the value PAM_SILENT to indicate that no output 12233 should be generated as a result of this function call. 12234 12235 Return Value 12236 12237 PAM_SUCCESS 12238 Success. 12239 12240 PAM_SESSION_ERR 12241 One of the required loaded modules was unable to close 12242 a session for the user. 12243 12244 Errors 12245 12246 May be translated to text with pam_strerror(). 12247 12248 pam_end 12249 12250 Name 12251 12252 pam_end -- terminate the use of the PAM library 12253 12254 Synopsis 12255 12256 #include 12257 12258 int pam_end(pam_handle_t * pamh, int pam_status); 12259 12260 Description 12261 12262 pam_end() terminates use of the PAM library. On success, the 12263 contents of *pamh are no longer valid, and all memory 12264 associated with it is invalid. 12265 12266 Normally, pam_status is passed the value PAM_SUCCESS, but in 12267 the event of an unsuccessful service application, the 12268 appropriate PAM error return value should be used. 12269 12270 Return Value 12271 12272 PAM_SUCCESS 12273 Success. 12274 12275 Errors 12276 12277 May be translated to text with pam_strerror(). 12278 12279 pam_fail_delay 12280 12281 Name 12282 12283 pam_fail_delay -- specify delay time to use on authentication 12284 error 12285 12286 Synopsis 12287 12288 #include 12289 12290 int pam_fail_delay(pam_handle_t * pamh, unsigned int 12291 micro_sec); 12292 12293 Description 12294 12295 pam_fail_delay() specifies the minimum delay for the PAM 12296 library to use when an authentication error occurs. The actual 12297 delay can vary by as much at 25%. If this function is called 12298 multiple times, the longest time specified by any of the call 12299 will be used. 12300 12301 The delay is invoked if an authentication error occurs during 12302 the pam_authenticate() or pam_chauthtok() function calls. 12303 12304 Independent of the success of pam_authenticate() or 12305 pam_chauthtok(), the delay time is reset to its default value 12306 of 0 when the PAM library returns control to the application 12307 from these two functions. 12308 12309 Return Value 12310 12311 PAM_SUCCESS 12312 Success. 12313 12314 Errors 12315 12316 May be translated to text with pam_strerror(). 12317 12318 pam_get_item 12319 12320 Name 12321 12322 pam_get_item -- obtain the value of the indicated item. 12323 12324 Synopsis 12325 12326 #include 12327 12328 int pam_get_item(const pam_handle_t * pamh, int item_type, 12329 const void * * item); 12330 12331 Description 12332 12333 pam_get_item() obtains the value of the indicated item_type. 12334 The possible values of item_type are the same as listed for 12335 pam_set_item(). 12336 12337 On success, item contains a pointer to the value of the 12338 corresponding item. Note that this is a pointer to the actual 12339 data and should not be free()'d or over-written. 12340 12341 Return Value 12342 12343 PAM_SUCCESS 12344 Success. 12345 12346 PAM_PERM_DENIED 12347 Application passed a NULL pointer for item. 12348 12349 PAM_BAD_ITEM 12350 Application attempted to get an undefined item. 12351 12352 Errors 12353 12354 May be translated to text with pam_strerror(). 12355 12356 pam_getenvlist 12357 12358 Name 12359 12360 pam_getenvlist -- returns a pointer to the complete PAM 12361 environment. 12362 12363 Synopsis 12364 12365 #include 12366 12367 char * const * pam_getenvlist(pam_handle_t * pamh); 12368 12369 Description 12370 12371 pam_getenvlist() returns a pointer to the complete PAM 12372 environment. This pointer points to an array of pointers to 12373 NUL-terminated strings and must be terminated by a NULL 12374 pointer. Each string has the form "name=value". 12375 12376 The PAM library module allocates memory for the returned value 12377 and the associated strings. The calling application is 12378 responsible for freeing this memory. 12379 12380 Return Value 12381 12382 pam_getenvlist() returns an array of string pointers 12383 containing the PAM environment. On error, NULL is returned. 12384 12385 pam_open_session 12386 12387 Name 12388 12389 pam_open_session -- used to indicate that an authenticated 12390 session has been initiated 12391 12392 Synopsis 12393 12394 #include 12395 12396 int pam_open_session(pam_handle_t * pamh, int flags); 12397 12398 Description 12399 12400 pam_handle_t() is used to indicate that an authenticated 12401 session has begun. It is used to inform the module that the 12402 user is currently in a session. It should be possible for the 12403 PAM library to open a session and close the same session from 12404 different applications. 12405 12406 flags may have the value PAM_SILENT to indicate that no output 12407 be generated as a rsult of this function call. 12408 12409 Return Value 12410 12411 PAM_SUCCESS 12412 Success. 12413 12414 PAM_SESSION_ERR 12415 One of the loaded modules was unable to open a session 12416 for the user. 12417 12418 ERRORS 12419 12420 May be translated to text with pam_strerror(). 12421 12422 pam_set_item 12423 12424 Name 12425 12426 pam_set_item -- (re)set the value of an item. 12427 12428 Synopsis 12429 12430 #include 12431 12432 int pam_set_item(pam_handle_t * pamh, int item_type, const 12433 void * item); 12434 12435 Description 12436 12437 pam_set_item() (re)sets the value of one of the following 12438 item_types: 12439 12440 PAM_SERVICE 12441 service name 12442 12443 PAM_USER 12444 user name 12445 12446 PAM_TTY 12447 terminal name 12448 12449 The value for a device file should include the /dev/ 12450 prefix. The value for graphical, X-based, applications 12451 should be the $DISPLAY variable. 12452 12453 PAM_RHOST 12454 remote host name 12455 12456 PAM_CONV 12457 conversation structure 12458 12459 PAM_RUSER 12460 remote user name 12461 12462 PAM_USER_PROMPT 12463 string to be used when prompting for a user's name 12464 12465 The default value for this string is Please enter 12466 username: . 12467 12468 For all item_types other than PAM_CONV, item is a pointer to a 12469 NULL-terminated character string. In the case of PAM_CONV, 12470 item points to an initialized pam_conv structure. 12471 12472 Return Value 12473 12474 PAM_SUCCESS 12475 Success. 12476 12477 PAM_PERM_DENIED 12478 An attempt was made to replace the conversation 12479 structure with a NULL value. 12480 12481 PAM_BUF_ERR 12482 Function ran out of memory making a copy of the item. 12483 12484 PAM_BAD_ITEM 12485 Application attempted to set an undefined item. 12486 12487 Errors 12488 12489 May be translated to text with pam_strerror(). 12490 12491 pam_setcred 12492 12493 Name 12494 12495 pam_setcred -- set the module-specific credentials of the user 12496 12497 Synopsis 12498 12499 #include 12500 12501 extern int pam_setcred(pam_handle_t * pamh, int flags); 12502 12503 Description 12504 12505 pam_setcred() sets the module-specific credentials of the 12506 user. It is usually called after the user has been 12507 authenticated, after the account management function has been 12508 called and after a session has been opened for the user. 12509 12510 flags maybe specified from among the following values: 12511 12512 PAM_ESTABLISH_CRED 12513 set credentials for the authentication service 12514 12515 PAM_DELETE_CRED 12516 delete credentials associated with the authentication 12517 service 12518 12519 PAM_REINITIALIZE_CRED 12520 reinitialize the user credentials 12521 12522 PAM_REFRESH_CRED 12523 extend lifetime of the user credentials 12524 12525 Additionally, the value of flags may be logically or'd with 12526 PAM_SILENT. 12527 12528 Return Value 12529 12530 PAM_SUCCESS 12531 Success. 12532 12533 PAM_CRED_UNAVAIL 12534 Module cannot retrieve the user's credentials. 12535 12536 PAM_CRED_EXPIRED 12537 User's credentials have expired. 12538 12539 PAM_USER_UNKNOWN 12540 User is not known to an authentication module. 12541 12542 PAM_CRED_ERR 12543 Module was unable to set the credentials of the user. 12544 12545 Errors 12546 12547 May be translated to text with pam_strerror(). 12548 12549 pam_start 12550 12551 Name 12552 12553 pam_start -- initialize the PAM library 12554 12555 Synopsis 12556 12557 #include 12558 12559 int pam_start(const char * service_name, const char * user, 12560 const struct pam_conv * pam_conversation, pam_handle_t * * 12561 pamh); 12562 12563 Description 12564 12565 pam_start() is used to initialize the PAM library. It must be 12566 called prior to any other usage of the PAM library. On 12567 success, *pamh becomes a handle that provides continuity for 12568 successive calls to the PAM library. pam_start() expects 12569 arguments as follows: the service_name of the program, the 12570 username of the individual to be authenticated, a pointer to 12571 an application-supplied pam_conv structure, and a pointer to a 12572 pam_handle_t pointer. 12573 12574 An application must provide the conversation function used for 12575 direct communication between a loaded module and the 12576 application. The application also typically provides a means 12577 for the module to prompt the user for a password, etc. 12578 12579 The structure, pam_conv, is defined to be, 12580 struct pam_conv { 12581 int (*conv) (int num_msg, 12582 const struct pam_message * *msg, 12583 struct pam_response * *resp, 12584 void *appdata_ptr); 12585 void *appdata_ptr; 12586 }; 12587 12588 It is initialized by the application before it is passed to 12589 the library. The contents of this structure are attached to 12590 the *pamh handle. The point of this argument is to provide a 12591 mechanism for any loaded module to interact directly with the 12592 application program; this is why it is called a conversation 12593 structure. 12594 12595 When a module calls the referenced conv() function, 12596 appdata_ptr is set to the second element of this structure. 12597 12598 The other arguments of a call to conv() concern the 12599 information exchanged by module and application. num_msg holds 12600 the length of the array of pointers passed via msg. On 12601 success, the pointer resp points to an array of num_msg 12602 pam_response structures, holding the application-supplied 12603 text. Note that resp is a struct pam_response array and not an 12604 array of pointers. 12605 12606 Return Value 12607 12608 PAM_SUCCESS 12609 Success. 12610 12611 PAM_BUF_ERR 12612 Memory allocation error. 12613 12614 PAM_ABORT 12615 Internal failure. 12616 12617 ERRORS 12618 12619 May be translated to text with pam_strerror(). 12620 12621 pam_strerror 12622 12623 Name 12624 12625 pam_strerror -- returns a string describing the PAM error 12626 12627 Synopsis 12628 12629 #include 12630 12631 const char * pam_strerror(pam_handle_t * pamh, int errnum); 12632 12633 Description 12634 12635 pam_strerror() returns a string describing the PAM error 12636 associated with errnum. 12637 12638 Return Value 12639 12640 On success, this function returns a description of the 12641 indicated error. The application should not free or modify 12642 this string. Otherwise, a string indicating that the error is 12643 unknown shall be returned. It is unspecified whether or not 12644 the string returned is translated according to the setting of 12645 LC_MESSAGES. 12646 12647 II. Utility Libraries 12648 12649 Table of Contents 12650 2. Utility Libraries 12651 _________________________________________________________ 12652 12653 Chapter 2. Utility Libraries 12654 12655 2.1. Introduction 12656 12657 An LSB-conforming implementation shall also support the 12658 following utility libraries which are built on top of the 12659 interfaces provided by the base libraries. These libraries 12660 implement common functionality, and hide additional system 12661 dependent information such as file formats and device names. 12662 12663 * libz 12664 * libcurses 12665 * libutil 12666 _________________________________________________________ 12667 12668 2.2. Interfaces for libz 12669 12670 Table 2-1 defines the library name and shared object name for 12671 the libz library 12672 12673 Table 2-1. libz Definition 12674 Library: libz 12675 SONAME: libz.so.1 12676 12677 The behavior of the interfaces in this library is specified by 12678 the following specifications: 12679 12680 this specification 12681 _________________________________________________________ 12682 12683 2.2.1. Compression Library 12684 _________________________________________________________ 12685 12686 2.2.1.1. Interfaces for Compression Library 12687 12688 An LSB conforming implementation shall provide the generic 12689 functions for Compression Library specified in Table 2-2, with 12690 the full mandatory functionality as described in the 12691 referenced underlying specification. 12692 12693 Table 2-2. libz - Compression Library Function Interfaces 12694 adler32 [1] deflateInit2_ [1] gzerror [1] gzrewind [1] 12695 inflateReset [1] 12696 compress [1] deflateInit_ [1] gzflush [1] gzseek [1] 12697 inflateSetDictionary [1] 12698 compress2 [1] deflateParams [1] gzgetc [1] gzsetparams [1] 12699 inflateSync [1] 12700 compressBound [1] deflateReset [1] gzgets [1] gztell [1] 12701 inflateSyncPoint [1] 12702 crc32 [1] deflateSetDictionary [1] gzopen [1] gzwrite [1] 12703 uncompress [1] 12704 deflate [1] get_crc_table [1] gzprintf [1] inflate [1] zError 12705 [1] 12706 deflateBound [1] gzclose [1] gzputc [1] inflateEnd [1] 12707 zlibVersion [1] 12708 deflateCopy [1] gzdopen [1] gzputs [1] inflateInit2_ [1] 12709 deflateEnd [1] gzeof [1] gzread [1] inflateInit_ [1] 12710 12711 Referenced Specification(s) 12712 12713 [1]. this specification 12714 _________________________________________________________ 12715 12716 2.3. Data Definitions for libz 12717 12718 This section defines global identifiers and their values that 12719 are associated with interfaces contained in libz. These 12720 definitions are organized into groups that correspond to 12721 system headers. This convention is used as a convenience for 12722 the reader, and does not imply the existence of these headers, 12723 or their content. 12724 12725 These definitions are intended to supplement those provided in 12726 the referenced underlying specifications. 12727 12728 This specification uses ISO/IEC 9899 C Language as the 12729 reference programming language, and data definitions are 12730 specified in ISO C format. The C language is used here as a 12731 convenient notation. Using a C language description of these 12732 data objects does not preclude their use by other programming 12733 languages. 12734 _________________________________________________________ 12735 12736 2.3.1. zlib.h 12737 12738 In addition to the values below, the zlib.h header shall 12739 define the ZLIB_VERSION macro. This macro may be used to check 12740 that the version of the library at run time matches that at 12741 compile time. 12742 12743 See also the zlibVersion() function, which returns the library 12744 version at run time. The first character of the version at 12745 compile time should always match the first character at run 12746 time. 12747 #define Z_NULL 0 12748 #define MAX_WBITS 15 12749 #define MAX_MEM_LEVEL 9 12750 #define deflateInit2(strm,level,method,windowBits,memLevel,strategy) 12751 deflateInit2_((strm),(level),(method),(windowBits),(memLevel),(strategy 12752 ),ZLIB_VERSION,sizeof(z_stream)) 12753 #define deflateInit(strm,level) deflateInit_((strm), (level), ZLI 12754 B_VERSION, sizeof(z_stream)) 12755 #define inflateInit2(strm,windowBits) inflateInit2_((strm), (windowBi 12756 ts), ZLIB_VERSION, sizeof(z_stream)) 12757 #define inflateInit(strm) inflateInit_((strm), ZLI 12758 B_VERSION, sizeof(z_stream)) 12759 12760 typedef char charf; 12761 typedef int intf; 12762 12763 typedef void *voidpf; 12764 typedef unsigned int uInt; 12765 typedef unsigned long int uLong; 12766 typedef uLong uLongf; 12767 typedef void *voidp; 12768 typedef unsigned char Byte; 12769 typedef off_t z_off_t; 12770 typedef void *const voidpc; 12771 12772 typedef voidpf (*alloc_func) (voidpf opaque, uInt items, uInt size); 12773 typedef void (*free_func) (voidpf opaque, voidpf address); 12774 struct internal_state 12775 { 12776 int dummy; 12777 } 12778 ; 12779 typedef Byte Bytef; 12780 typedef uInt uIntf; 12781 12782 typedef struct z_stream_s 12783 { 12784 Bytef *next_in; 12785 uInt avail_in; 12786 uLong total_in; 12787 Bytef *next_out; 12788 uInt avail_out; 12789 uLong total_out; 12790 char *msg; 12791 struct internal_state *state; 12792 alloc_func zalloc; 12793 free_func zfree; 12794 voidpf opaque; 12795 int data_type; 12796 uLong adler; 12797 uLong reserved; 12798 } 12799 z_stream; 12800 12801 typedef z_stream *z_streamp; 12802 typedef voidp gzFile; 12803 #define Z_NO_FLUSH 0 12804 #define Z_PARTIAL_FLUSH 1 12805 #define Z_SYNC_FLUSH 2 12806 #define Z_FULL_FLUSH 3 12807 #define Z_FINISH 4 12808 12809 #define Z_ERRNO (-1) 12810 #define Z_STREAM_ERROR (-2) 12811 #define Z_DATA_ERROR (-3) 12812 #define Z_MEM_ERROR (-4) 12813 #define Z_BUF_ERROR (-5) 12814 #define Z_VERSION_ERROR (-6) 12815 #define Z_OK 0 12816 #define Z_STREAM_END 1 12817 #define Z_NEED_DICT 2 12818 12819 #define Z_DEFAULT_COMPRESSION (-1) 12820 #define Z_NO_COMPRESSION 0 12821 #define Z_BEST_SPEED 1 12822 #define Z_BEST_COMPRESSION 9 12823 12824 #define Z_DEFAULT_STRATEGY 0 12825 #define Z_FILTERED 1 12826 #define Z_HUFFMAN_ONLY 2 12827 12828 #define Z_BINARY 0 12829 #define Z_ASCII 1 12830 #define Z_UNKNOWN 2 12831 12832 #define Z_DEFLATED 8 12833 _________________________________________________________ 12834 12835 2.4. Interface Definitions for libz 12836 12837 Table of Contents 12838 adler32 -- Compute Adler 32 Checksum 12839 compress -- compress data 12840 compress2 -- compress data at a specified level 12841 compressBound -- compute compressed data size 12842 crc32 -- Compute CRC-32 Checksum 12843 deflate -- compress data 12844 deflateBound -- compute compressed data size 12845 deflateCopy -- copy compression stream 12846 deflateEnd -- free compression stream state 12847 deflateInit2_ -- initialize compression system 12848 deflateInit_ -- initialize compression system 12849 deflateParams -- set compression parameters 12850 deflateReset -- reset compression stream state 12851 deflateSetDictionary -- initialize compression dictionary 12852 get_crc_table -- generate a table for crc calculations 12853 gzclose -- close a compressed file stream 12854 gzdopen -- open a compressed file 12855 gzeof -- check for end-of-file on a compressed file stream 12856 gzerror -- decode an error on a compressed file stream 12857 gzflush -- flush a compressed file stream 12858 gzgetc -- read a character from a compressed file 12859 gzgets -- read a string from a compressed file 12860 gzopen -- open a compressed file 12861 gzprintf -- format data and compress 12862 gzputc -- write character to a compressed file 12863 gzputs -- string write to a compressed file 12864 gzread -- read from a compressed file 12865 gzrewind -- reset the file-position indicator on a compressed 12866 file stream 12867 12868 gzseek -- reposition a file-position indicator in a compressed 12869 file stream 12870 12871 gzsetparams -- dynamically set compression parameters 12872 gztell -- find position on a compressed file stream 12873 gzwrite -- write to a compressed file 12874 inflate -- decompress data 12875 inflateEnd -- free decompression stream state 12876 inflateInit2_ -- initialize decompression system 12877 inflateInit_ -- initialize decompression system 12878 inflateReset -- reset decompression stream state 12879 inflateSetDictionary -- initialize decompression dictionary 12880 inflateSync -- advance compression stream to next sync point 12881 inflateSyncPoint -- test for synchronization point 12882 uncompress -- uncompress data 12883 zError -- translate error number to string 12884 zlibVersion -- discover library version at run time 12885 12886 The following interfaces are included in libz and are defined 12887 by this specification. Unless otherwise noted, these 12888 interfaces shall be included in the source standard. 12889 12890 Other interfaces listed above for libz shall behave as 12891 described in the referenced base document. 12892 12893 adler32 12894 12895 Name 12896 12897 adler32 -- Compute Adler 32 Checksum 12898 12899 Synopsis 12900 12901 #include 12902 12903 uLong adler32(uLong adler, const Bytef * buf, uInt len); 12904 12905 Description 12906 12907 The adler32() function shall compute a running Adler-32 12908 checksum (as described in RFC 1950: ZLIB Compressed Data 12909 Format Specication). On entry, adler is the previous value for 12910 the checksum, and buf shall point to an array of len bytes of 12911 data to be added to this checksum. The adler32() function 12912 shall return the new checksum. 12913 12914 If buf is NULL (or Z_NULL), adler32() shall return the initial 12915 checksum. 12916 12917 Return Value 12918 12919 The adler32() function shall return the new checksum value. 12920 12921 Errors 12922 12923 None defined. 12924 12925 Application Usage (informative) 12926 12927 The following code fragment demonstrates typical usage of the 12928 adler32() function: 12929 uLong adler = adler32(0L, Z_NULL, 0); 12930 12931 while (read_buffer(buffer, length) != EOF) { 12932 adler = adler32(adler, buffer, length); 12933 } 12934 if (adler != original_adler) error(); 12935 12936 compress 12937 12938 Name 12939 12940 compress -- compress data 12941 12942 Synopsis 12943 12944 #include 12945 12946 int compress(Bytef * dest, uLongf * destLen, const Bytef * 12947 source, uLong sourceLen); 12948 12949 Description 12950 12951 The compress() function shall attempt to compress sourceLen 12952 bytes of data in the buffer source, placing the result in the 12953 buffer dest. 12954 12955 On entry, destLen should point to a value describing the size 12956 of the dest buffer. The application should ensure that this 12957 value be at least (sourceLen × 1.001) + 12. On successful 12958 exit, the variable referenced by destLen shall be updated to 12959 hold the length of compressed data in dest. 12960 12961 The compress() function is equivalent to compress2() with a 12962 level of Z_DEFAULT_LEVEL. 12963 12964 Return Value 12965 12966 On success, compress() shall return Z_OK. Otherwise, 12967 compress() shall return a value to indicate the error. 12968 12969 Errors 12970 12971 On error, compress() shall return a value as described below: 12972 12973 Z_BUF_ERROR 12974 The buffer dest was not large enough to hold the 12975 compressed data. 12976 12977 Z_MEM_ERROR 12978 Insufficient memory. 12979 12980 compress2 12981 12982 Name 12983 12984 compress2 -- compress data at a specified level 12985 12986 Synopsis 12987 12988 #include 12989 12990 int compress2(Bytef * dest, uLongf * destLen, const Bytef * 12991 source, uLong sourceLen, int level); 12992 12993 Description 12994 12995 The compress2() function shall attempt to compress sourceLen 12996 bytes of data in the buffer source, placing the result in the 12997 buffer dest, at the level described by level. The level 12998 supplied shall be a value between 0 and 9, or the value 12999 Z_DEFAULT_COMPRESSION. A level of 1 requests the highest 13000 speed, while a level of 9 requests the highest compression. A 13001 level of 0 indicates that no compression should be used, and 13002 the output shall be the same as the input. 13003 13004 On entry, destLen should point to a value describing the size 13005 of the dest buffer. The application should ensure that this 13006 value be at least (sourceLen × 1.001) + 12. On successful 13007 exit, the variable referenced by destLen shall be updated to 13008 hold the length of compressed data in dest. 13009 13010 The compress() function is equivalent to compress2() with a 13011 level of Z_DEFAULT_LEVEL. 13012 13013 Return Value 13014 13015 On success, compress2() shall return Z_OK. Otherwise, 13016 compress2() shall return a value to indicate the error. 13017 13018 Errors 13019 13020 On error, compress2() shall return a value as described below: 13021 13022 Z_BUF_ERROR 13023 The buffer dest was not large enough to hold the 13024 compressed data. 13025 13026 Z_MEM_ERROR 13027 Insufficient memory. 13028 13029 Z_STREAM_ERROR 13030 The level was not Z_DEFAULT_LEVEL, or was not between 0 13031 and 9. 13032 13033 compressBound 13034 13035 Name 13036 13037 compressBound -- compute compressed data size 13038 13039 Synopsis 13040 13041 #include 13042 13043 int compressBound(uLong sourceLen); 13044 13045 Description 13046 13047 The compressBound() function shall estimate the size of buffer 13048 required to compress sourceLen bytes of data using the 13049 compress() or compress2() functions. If successful, the value 13050 returned shall be an upper bound for the size of buffer 13051 required to compress sourceLen bytes of data, using the 13052 parameters stored in stream, in a single call to compress() or 13053 compress2(). 13054 13055 Return Value 13056 13057 The compressBound() shall return a value representing the 13058 upper bound of an array to allocate to hold the compressed 13059 data in a single call to compress() or compress2(). This 13060 function may return a conservative value that may be larger 13061 than sourceLen. 13062 13063 Errors 13064 13065 None defined. 13066 13067 crc32 13068 13069 Name 13070 13071 crc32 -- Compute CRC-32 Checksum 13072 13073 Synopsis 13074 13075 #include 13076 13077 uLong crc32(uLong crc, const Bytef * buf, uInt len); 13078 13079 Description 13080 13081 The crc32() function shall compute a running Cyclic Redundancy 13082 Check checksum, as defined in ITU-T V.42. On entry, crc is the 13083 previous value for the checksum, and buf shall point to an 13084 array of len bytes of data to be added to this checksum. The 13085 crc32() function shall return the new checksum. 13086 13087 If buf is NULL (or Z_NULL), crc32() shall return the initial 13088 checksum. 13089 13090 Return Value 13091 13092 The crc32() function shall return the new checksum value. 13093 13094 Errors 13095 13096 None defined. 13097 13098 Application Usage (informative) 13099 13100 The following code fragment demonstrates typical usage of the 13101 crc32() function: 13102 uLong crc = crc32(0L, Z_NULL, 0); 13103 13104 while (read_buffer(buffer, length) != EOF) { 13105 crc = crc32(crc, buffer, length); 13106 } 13107 if (crc != original_crc) error(); 13108 13109 deflate 13110 13111 Name 13112 13113 deflate -- compress data 13114 13115 Synopsis 13116 13117 #include 13118 13119 int deflate(z_streamp stream, int flush); 13120 13121 Description 13122 13123 The deflate() function shall attempt to compress data until 13124 either the input buffer is empty or the output buffer is full. 13125 The stream references a z_stream structure. Before the first 13126 call to deflate(), this structure should have been initialized 13127 by a call to deflateInit2_(). 13128 13129 Note: deflateInit2_() is only in the binary standard; 13130 source level applications should initialize stream via a 13131 call to deflateInit() or deflateInit2(). 13132 13133 In addition, the stream input and output buffers should have 13134 been initialized as follows: 13135 13136 next_in 13137 should point to the data to be compressed. 13138 13139 avail_in 13140 should contain the number of bytes of data in the 13141 buffer referenced by next_in. 13142 13143 next_out 13144 should point to a buffer where compressed data may be 13145 placed. 13146 13147 avail_out 13148 should contain the size in bytes of the buffer 13149 referenced by next_out 13150 13151 The deflate() function shall perform one or both of the 13152 following actions: 13153 13154 1. Compress input data from next_in and update next_in, 13155 avail_in and total_in to reflect the data that has been 13156 compressed. 13157 2. Fill the output buffer referenced by next_out, and update 13158 next_out, avail_out and total_out to reflect the 13159 compressed data that has been placed there. If flush is 13160 not Z_NO_FLUSH, and avail_out indicates that there is 13161 still space in output buffer, this action shall always 13162 occur (see below for further details). 13163 13164 The deflate() function shall return when either avail_in 13165 reaches zero (indicating that all the input data has been 13166 compressed), or avail_out reaches zero (indicating that the 13167 output buffer is full). 13168 13169 On success, the deflate() function shall set the adler field 13170 of the stream to the adler32() checksum of all the input data 13171 compressed so far (represented by total_in). 13172 13173 If the deflate() function shall attempt to determine the type 13174 of input data, and set field data_type in stream to Z_ASCII if 13175 the majority of the data bytes fall within the ASCII (ISO 646) 13176 printable character range. Otherwise, it shall set data_type 13177 to Z_BINARY. This data type is informational only, and does 13178 not affect the compression algorithm. 13179 13180 Note: Future versions of the LSB may remove this 13181 requirement, since it is based on an outdated character set 13182 that does not support Internationalization, and does not 13183 affect the algorithm. It is included for information only 13184 at this release. Applications should not depend on this 13185 field. 13186 13187 Flush Operation 13188 13189 The parameter flush determines when compressed bits are added 13190 to the output buffer in next_out. If flush is Z_NO_FLUSH, 13191 deflate() may return with some data pending output, and not 13192 yet added to the output buffer. 13193 13194 If flush is Z_SYNC_FLUSH, deflate() shall flush all pending 13195 output to next_out and align the output to a byte boundary. A 13196 synchronization point is generated in the output. 13197 13198 If flush is Z_FULL_FLUSH, all output shall be flushed, as for 13199 Z_SYNC_FLUSH, and the compression state shall be reset. A 13200 synchronization point is generated in the output. 13201 13202 Rationale: Z_SYNC_FLUSH is intended to ensure that the 13203 compressed data contains all the data compressed so far, 13204 and allows a decompressor to reconstruct all of the input 13205 data. Z_FULL_FLUSH allows decompression to restart from 13206 this point if the previous compressed data has been lost or 13207 damaged. Flushing is likely to degrade the performance of 13208 the compression system, and should only be used where 13209 necessary. 13210 13211 If flush is set to Z_FINISH, all pending input shall be 13212 processed and deflate() shall return with Z_STREAM_END if 13213 there is sufficient space in the output buffer at next_out, as 13214 indicated by avail_out. If deflate() is called with flush set 13215 to Z_FINISH and there is insufficient space to store the 13216 compressed data, and no other error has occurred during 13217 compression, deflate() shall return Z_OK, and the application 13218 should call deflate() again with flush unchanged, and having 13219 updated next_out and avail_out. 13220 13221 If all the compression is to be done in a single step, 13222 deflate() may be called with flush set to Z_FINISH immediately 13223 after the stream has been initialized if avail_out is set to 13224 at least the value returned by deflateBound(). 13225 13226 Return Value 13227 13228 On success, deflate() shall return Z_OK, unless flush was set 13229 to Z_FINISH and there was sufficient space in the output 13230 buffer to compress all of the input data. In this case, 13231 deflate() shall return Z_STREAM_END. On error, deflate() shall 13232 return a value to indicate the error. 13233 13234 Note: If deflate() returns Z_OK and has set avail_out to 13235 zero, the function should be called again with the same 13236 value for flush, and with updated next_out and avail_out 13237 until deflate() returns with Z_OK (or Z_STREAM_END if flush 13238 is set to Z_FINISH) and a non-zero avail_out. 13239 13240 Errors 13241 13242 On error, deflate() shall return a value as described below, 13243 and set the msg field of stream to point to a string 13244 describing the error: 13245 13246 Z_BUF_ERROR 13247 No progress is possible; either avail_in or avail_out 13248 was zero. 13249 13250 Z_MEM_ERROR 13251 Insufficient memory. 13252 13253 Z_STREAM_ERROR 13254 The state (as represented in stream) is inconsistent, 13255 or stream was NULL. 13256 13257 deflateBound 13258 13259 Name 13260 13261 deflateBound -- compute compressed data size 13262 13263 Synopsis 13264 13265 #include 13266 13267 int deflateBound(z_streamp stream, uLong sourceLen); 13268 13269 Description 13270 13271 The deflateBound() function shall estimate the size of buffer 13272 required to compress sourceLen bytes of data. If successful, 13273 the value returned shall be an upper bound for the size of 13274 buffer required to compress sourceLen bytes of data, using the 13275 parameters stored in stream, in a single call to deflate() 13276 with flush set to Z_FINISH. 13277 13278 On entry, stream should have been initialized via a call to 13279 deflateInit_() or deflateInit2_(). 13280 13281 Return Value 13282 13283 The deflateBound() shall return a value representing the upper 13284 bound of an array to allocate to hold the compressed data in a 13285 single call to deflate(). If the stream is not correctly 13286 initialized, or is NULL, then deflateBound() may return a 13287 conservative value that may be larger than sourceLen. 13288 13289 Errors 13290 13291 None defined. 13292 13293 deflateCopy 13294 13295 Name 13296 13297 deflateCopy -- copy compression stream 13298 13299 Synopsis 13300 13301 #include 13302 13303 int deflateCopy(z_streamp dest, z_streamp source); 13304 13305 Description 13306 13307 The deflateCopy() function shall copy the compression state 13308 information in source to the uninitialized z_stream structure 13309 referenced by dest. 13310 13311 On successful return, dest will be an exact copy of the stream 13312 referenced by source. The input and output buffer pointers in 13313 next_in and next_out will reference the same data. 13314 13315 Return Value 13316 13317 On success, deflateCopy() shall return Z_OK. Otherwise it 13318 shall return a value less than zero to indicate the error. 13319 13320 Errors 13321 13322 On error, deflateCopy() shall return a value as described 13323 below: 13324 13325 Z_STREAM_ERROR 13326 The state in source is inconsistent, or either source 13327 or dest was NULL. 13328 13329 Z_MEM_ERROR 13330 Insufficient memory available. 13331 13332 Application Usage (informative) 13333 13334 This function can be useful when several compression 13335 strategies will be tried, for example when there are several 13336 ways of pre-processing the input data with a filter. The 13337 streams that will be discarded should then be freed by calling 13338 deflateEnd(). Note that deflateCopy() duplicates the internal 13339 compression state which can be quite large, so this strategy 13340 may be slow and can consume lots of memory. 13341 13342 deflateEnd 13343 13344 Name 13345 13346 deflateEnd -- free compression stream state 13347 13348 Synopsis 13349 13350 #include 13351 13352 int deflateEnd(z_streamp stream); 13353 13354 Description 13355 13356 The deflateEnd() function shall free all allocated state 13357 information referenced by stream. All pending output is 13358 discarded, and unprocessed input is ignored. 13359 13360 Return Value 13361 13362 On success, deflateEnd() shall return Z_OK, or Z_DATA_ERROR if 13363 there was pending output discarded or input unprocessed. 13364 Otherwise it shall return Z_STREAM_ERROR to indicate the 13365 error. 13366 13367 Errors 13368 13369 On error, deflateEnd() shall return Z_STREAM_ERROR. The 13370 following conditions shall be treated as an error: 13371 13372 * The state in stream is inconsistent or inappropriate. 13373 * stream is NULL. 13374 13375 deflateInit2_ 13376 13377 Name 13378 13379 deflateInit2_ -- initialize compression system 13380 13381 Synopsis 13382 13383 #include 13384 13385 int deflateInit2_ (z_streamp strm, int level, int method, int 13386 windowBits, int memLevel, int strategy, char * version, int 13387 stream_size); 13388 13389 Description 13390 13391 The deflateInit2_() function shall initialize the compression 13392 system. On entry, strm shall refer to a user supplied z_stream 13393 object (a z_stream_s structure). The following fields shall be 13394 set on entry: 13395 13396 zalloc 13397 a pointer to an alloc_func function, used to allocate 13398 state information. If this is NULL, a default 13399 allocation function will be used. 13400 13401 zfree 13402 a pointer to a free_func function, used to free memory 13403 allocated by the zalloc function. If this is NULL a 13404 default free function will be used. 13405 13406 opaque 13407 If alloc_func is not NULL, opaque is a user supplied 13408 pointer to data that will be passed to the alloc_func 13409 and free_func functions. 13410 13411 If the version requested is not compatible with the version 13412 implemented, or if the size of the z_stream_s structure 13413 provided in stream_size does not match the size in the library 13414 implementation, deflateInit2_() shall fail, and return 13415 Z_VERSION_ERROR. 13416 13417 The level supplied shall be a value between 0 and 9, or the 13418 value Z_DEFAULT_COMPRESSION. A level of 1 requests the highest 13419 speed, while a level of 9 requests the highest compression. A 13420 level of 0 indicates that no compression should be used, and 13421 the output shall be the same as the input. 13422 13423 The method selects the compression algorithm to use. LSB 13424 conforming implementation shall support the Z_DEFLATED method, 13425 and may support other implementation defined methods. 13426 13427 The windowBits parameter shall be a base 2 logarithm of the 13428 window size to use, and shall be a value between 8 and 15. A 13429 smaller value will use less memory, but will result in a 13430 poorer compression ratio, while a higher value will give 13431 better compression but utilize more memory. 13432 13433 The memLevel parameter specifies how much memory to use for 13434 the internal state. The value of memLevel shall be between 1 13435 and MAX_MEM_LEVEL. Smaller values use less memory but are 13436 slower, while higher values use more memory to gain 13437 compression speed. 13438 13439 The strategy parameter selects the compression strategy to 13440 use: 13441 13442 Z_DEFAULT_STRATEGY 13443 use the system default compression strategy. 13444 Z_DEFAULT_STRATEGY is particularly appropriate for text 13445 data. 13446 13447 Z_FILTERED 13448 use a compression strategy tuned for data consisting 13449 largely of small values with a fairly random 13450 distribution. Z_FILTERED uses more Huffman encoding and 13451 less string matching than Z_DEFAULT_STRATEGY. 13452 13453 Z_HUFFMAN_ONLY 13454 force Huffman encoding only, with no string match. 13455 13456 The deflateInit2_() function is not in the source standard; it 13457 is only in the binary standard. Source applications should use 13458 the deflateInit2() macro. 13459 13460 Return Value 13461 13462 On success, the deflateInit2_() function shall return Z_OK. 13463 Otherwise, deflateInit2_() shall return a value as described 13464 below to indicate the error. 13465 13466 Errors 13467 13468 On error, deflateInit2_() shall return one of the following 13469 error indicators: 13470 13471 Z_STREAM_ERROR 13472 Invalid parameter. 13473 13474 Z_MEM_ERROR 13475 Insufficient memory available. 13476 13477 Z_VERSION_ERROR 13478 The version requested is not compatible with the 13479 library version, or the z_stream size differs from that 13480 used by the library. 13481 13482 In addition, the msg field of the strm may be set to an error 13483 message. 13484 13485 deflateInit_ 13486 13487 Name 13488 13489 deflateInit_ -- initialize compression system 13490 13491 Synopsis 13492 13493 #include 13494 13495 int deflateInit_(z_streamp stream, int level, const char * 13496 version, int stream_size); 13497 13498 Description 13499 13500 The deflateInit_() function shall initialize the compression 13501 system. On entry, stream shall refer to a user supplied 13502 z_stream object (a z_stream_s structure). The following fields 13503 shall be set on entry: 13504 13505 zalloc 13506 a pointer to an alloc_func function, used to allocate 13507 state information. If this is NULL, a default 13508 allocation function will be used. 13509 13510 zfree 13511 a pointer to a free_func function, used to free memory 13512 allocated by the zalloc function. If this is NULL a 13513 default free function will be used. 13514 13515 opaque 13516 If alloc_func is not NULL, opaque is a user supplied 13517 pointer to data that will be passed to the alloc_func 13518 and free_func functions. 13519 13520 If the version requested is not compatible with the version 13521 implemented, or if the size of the z_stream_s structure 13522 provided in stream_size does not match the size in the library 13523 implementation, deflateInit_() shall fail, and return 13524 Z_VERSION_ERROR. 13525 13526 The level supplied shall be a value between 0 and 9, or the 13527 value Z_DEFAULT_COMPRESSION. A level of 1 requests the highest 13528 speed, while a level of 9 requests the highest compression. A 13529 level of 0 indicates that no compression should be used, and 13530 the output shall be the same as the input. 13531 13532 The deflateInit_() function is not in the source standard; it 13533 is only in the binary standard. Source applications should use 13534 the deflateInit() macro. 13535 13536 The deflateInit_() function is equivalent to 13537 deflateInit2_(stream, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, 13538 Z_DEFAULT_STRATEGY, version, stream_size); 13539 13540 Return Value 13541 13542 On success, the deflateInit_() function shall return Z_OK. 13543 Otherwise, deflateInit_() shall return a value as described 13544 below to indicate the error. 13545 13546 Errors 13547 13548 On error, deflateInit_() shall return one of the following 13549 error indicators: 13550 13551 Z_STREAM_ERROR 13552 Invalid parameter. 13553 13554 Z_MEM_ERROR 13555 Insufficient memory available. 13556 13557 Z_VERSION_ERROR 13558 The version requested is not compatible with the 13559 library version, or the z_stream size differs from that 13560 used by the library. 13561 13562 In addition, the msg field of the stream may be set to an 13563 error message. 13564 13565 deflateParams 13566 13567 Name 13568 13569 deflateParams -- set compression parameters 13570 13571 Synopsis 13572 13573 #include 13574 13575 int deflateParams(z_streamp stream, int level, int strategy); 13576 13577 Description 13578 13579 The deflateParams() function shall dynamically alter the 13580 compression parameters for the compression stream object 13581 stream. On entry, stream shall refer to a user supplied 13582 z_stream object (a z_stream_s structure), already initialized 13583 via a call to deflateInit_() or deflateInit2_(). 13584 13585 The level supplied shall be a value between 0 and 9, or the 13586 value Z_DEFAULT_COMPRESSION. A level of 1 requests the highest 13587 speed, while a level of 9 requests the highest compression. A 13588 level of 0 indicates that no compression should be used, and 13589 the output shall be the same as the input. If the compression 13590 level is altered by deflateParams(), and some data has already 13591 been compressed with this stream (i.e. total_in is not zero), 13592 and the new level requires a different underlying compression 13593 method, then stream shall be flushed by a call to deflate(). 13594 13595 The strategy parameter selects the compression strategy to 13596 use: 13597 13598 Z_DEFAULT_STRATEGY 13599 use the system default compression strategy. 13600 Z_DEFAULT_STRATEGY is particularly appropriate for text 13601 data. 13602 13603 Z_FILTERED 13604 use a compression strategy tuned for data consisting 13605 largely of small values with a fairly random 13606 distribution. Z_FILTERED uses more Huffman encoding and 13607 less string matching than Z_DEFAULT_STRATEGY. 13608 13609 Z_HUFFMAN_ONLY 13610 force Huffman encoding only, with no string match. 13611 13612 Return Value 13613 13614 On success, the deflateParams() function shall return Z_OK. 13615 Otherwise, deflateParams() shall return a value as described 13616 below to indicate the error. 13617 13618 Errors 13619 13620 On error, deflateParams() shall return one of the following 13621 error indicators: 13622 13623 Z_STREAM_ERROR 13624 Invalid parameter. 13625 13626 Z_MEM_ERROR 13627 Insufficient memory available. 13628 13629 Z_BUF_ERROR 13630 Insufficient space in stream to flush the current 13631 output. 13632 13633 In addition, the msg field of the strm may be set to an error 13634 message. 13635 13636 Application Usage (Informative) 13637 13638 Applications should ensure that the stream is flushed, e.g. by 13639 a call to deflate(stream, Z_SYNC_FLUSH) before calling 13640 deflateParams(), or ensure that there is sufficient space in 13641 next_out (as identified by avail_out) to ensure that all 13642 pending output and all uncompressed input can be flushed in a 13643 single call to deflate(). 13644 13645 Rationale: Although the deflateParams() function should 13646 flush pending output and compress all pending input, the 13647 result is unspecified if there is insufficient space in the 13648 output buffer. Applications should only call 13649 deflateParams() when the stream is effectively empty 13650 (flushed). 13651 13652 The deflateParams() can be used to switch between 13653 compression and straight copy of the input data, or to 13654 switch to a different kind of input data requiring a 13655 different strategy. 13656 13657 deflateReset 13658 13659 Name 13660 13661 deflateReset -- reset compression stream state 13662 13663 Synopsis 13664 13665 #include 13666 13667 int deflateReset(z_streamp stream); 13668 13669 Description 13670 13671 The deflateReset() function shall reset all state associated 13672 with stream. All pending output shall be discarded, and the 13673 counts of processed bytes (total_in and total_out) shall be 13674 reset to zero. 13675 13676 Return Value 13677 13678 On success, deflateReset() shall return Z_OK. Otherwise it 13679 shall return Z_STREAM_ERROR to indicate the error. 13680 13681 Errors 13682 13683 On error, deflateReset() shall return Z_STREAM_ERROR. The 13684 following conditions shall be treated as an error: 13685 13686 * The state in stream is inconsistent or inappropriate. 13687 * stream is NULL. 13688 13689 deflateSetDictionary 13690 13691 Name 13692 13693 deflateSetDictionary -- initialize compression dictionary 13694 13695 Synopsis 13696 13697 #include 13698 13699 int deflateSetDictionary(z_streamp stream, const Bytef * 13700 dictionary, uInt dictlen); 13701 13702 Description 13703 13704 The deflateSetDictionary() function shall initialize the 13705 compression dictionary associated with stream using the 13706 dictlen bytes referenced by dictionary. 13707 13708 The implementation may silently use a subset of the provided 13709 dictionary if the dictionary cannot fit in the current window 13710 associated with stream (see deflateInit2_()). The application 13711 should ensure that the dictionary is sorted such that the most 13712 commonly used strings occur at the end of the dictionary. 13713 13714 If the dictionary is successfully set, the Adler32 checksum of 13715 the entire provided dictionary shall be stored in the adler 13716 member of stream. This value may be used by the decompression 13717 system to select the correct dictionary. The compression and 13718 decompression systems must use the same dictionary. 13719 13720 stream shall reference an initialized compression stream, with 13721 total_in zero (i.e. no data has been compressed since the 13722 stream was initialized). 13723 13724 Return Value 13725 13726 On success, deflateSetDictionary() shall return Z_OK. 13727 Otherwise it shall return Z_STREAM_ERROR to indicate an error. 13728 13729 Errors 13730 13731 On error, deflateSetDictionary() shall return a value as 13732 described below: 13733 13734 Z_STREAM_ERROR 13735 The state in stream is inconsistent, or stream was 13736 NULL. 13737 13738 Application Usage (informative) 13739 13740 The application should provide a dictionary consisting of 13741 strings {{{ed note: do we really mean "strings"? Null 13742 terminated?}}} that are likely to be encountered in the data 13743 to be compressed. The application should ensure that the 13744 dictionary is sorted such that the most commonly used strings 13745 occur at the end of the dictionary. 13746 13747 The use of a dictionary is optional; however if the data to be 13748 compressed is relatively short and has a predictable 13749 structure, the use of a dictionary can substantially improve 13750 the compression ratio. 13751 13752 get_crc_table 13753 13754 Name 13755 13756 get_crc_table -- generate a table for crc calculations 13757 13758 Synopsis 13759 13760 #include 13761 13762 const uLongf * get_crc_table(void); 13763 13764 Description 13765 13766 Generate tables for a byte-wise 32-bit CRC calculation based 13767 on the polynomial: 13768 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+ 13769 1 13770 13771 In a multi-threaded application, get_crc_table() should be 13772 called by one thread to initialize the tables before any other 13773 thread calls any libz function. 13774 13775 Return Value 13776 13777 The get_crc_table() function shall return a pointer to the 13778 first of a set of tables used internally to calculate CRC-32 13779 values (see crc32()). 13780 13781 Errors 13782 13783 None defined. 13784 13785 gzclose 13786 13787 Name 13788 13789 gzclose -- close a compressed file stream 13790 13791 Synopsis 13792 13793 #include 13794 13795 int gzclose (gzFile file ); 13796 13797 Description 13798 13799 The gzclose() function shall close the compressed file stream 13800 file. If file was open for writing, gzclose() shall first 13801 flush any pending output. Any state information allocated 13802 shall be freed. 13803 13804 Return Value 13805 13806 On success, gzclose() shall return Z_OK. Otherwise, gzclose() 13807 shall return an error value as described below. 13808 13809 Errors 13810 13811 On error, gzclose() may set the global variable errno to 13812 indicate the error. The gzclose() shall return a value other 13813 than Z_OK on error. 13814 13815 Z_STREAM_ERROR 13816 file was NULL (or Z_NULL), or did not refer to an open 13817 compressed file stream. 13818 13819 Z_ERRNO 13820 An error occurred in the underlying base libraries, and 13821 the application should check errno for further 13822 information. 13823 13824 Z_BUF_ERROR 13825 no compression progress is possible during buffer flush 13826 (see deflate()). 13827 13828 gzdopen 13829 13830 Name 13831 13832 gzdopen -- open a compressed file 13833 13834 Synopsis 13835 13836 #include 13837 13838 gzFile gzdopen ( int fd, const char *mode ); 13839 13840 Description 13841 13842 The gzdopen() function shall attempt to associate the open 13843 file referenced by fd with a gzFile object. The mode argument 13844 is based on that of fopen(), but the mode parameter may also 13845 contain the following characters: 13846 13847 digit 13848 set the compression level to digit. A low value (e.g. 13849 1) means high speed, while a high value (e.g. 9) means 13850 high compression. A compression level of 0 (zero) means 13851 no compression. See defaultInit2_() for further 13852 details. 13853 13854 [fhR] 13855 set the compression strategy to [fhR]. The letter f 13856 corresponds to filtered data, the letter h corresponds 13857 to Huffman only compression, and the letter R 13858 corresponds to Run Length Encoding. See defaultInit2_() 13859 for further details. 13860 13861 If fd refers to an uncompressed file, and mode refers to a 13862 read mode, gzdopen() shall attempt to open the file and return 13863 a gzFile object suitable for reading directly from the file 13864 without any decompression. 13865 13866 If mode is NULL, or if mode does not contain one of r, w, or 13867 a, gzdopen() shall return Z_NULL, and need not set any other 13868 error condition. 13869 13870 Example 13871 13872 gzdopen(fileno(stdin), "r"); 13873 13874 Attempt to associate the standard input with a gzFile object. 13875 13876 Return Value 13877 13878 On success, gzdopen() shall return a gzFile object. On 13879 failure, gzdopen() shall return Z_NULL and may set errno 13880 accordingly. 13881 13882 Note: At version 1.2.2, zlib does not set errno for several 13883 error conditions. Applications may not be able to determine 13884 the cause of an error. 13885 13886 Errors 13887 13888 On error, gzdopen() may set the global variable errno to 13889 indicate the error. 13890 13891 gzeof 13892 13893 Name 13894 13895 gzeof -- check for end-of-file on a compressed file stream 13896 13897 Synopsis 13898 13899 #include 13900 13901 int gzeof (gzFile file ); 13902 13903 Description 13904 13905 The gzeof() function shall test the compressed file stream 13906 file for end of file. 13907 13908 Return Value 13909 13910 If file was open for reading and end of file has been reached, 13911 gzeof() shall return 1. Otherwise, gzeof() shall return 0. 13912 13913 Errors 13914 13915 None defined. 13916 13917 gzerror 13918 13919 Name 13920 13921 gzerror -- decode an error on a compressed file stream 13922 13923 Synopsis 13924 13925 #include 13926 13927 const char * gzerror (gzFile file, int * errnum); 13928 13929 Description 13930 13931 The gzerror() function shall return a string describing the 13932 last error to have occurred associated with the open 13933 compressed file stream referred to by file. It shall also set 13934 the location referenced by errnum to an integer value that 13935 further identifies the error. 13936 13937 Return Value 13938 13939 The gzerror() function shall return a string that describes 13940 the last error associated with the given file compressed file 13941 stream. This string shall have the format "%s: %s", with the 13942 name of the file, followed by a colon, a space, and the 13943 description of the error. If the compressed file stream was 13944 opened by a call to gzdopen(), the format of the filename is 13945 unspecified. 13946 13947 Rationale: Although in all current implementations of libz 13948 file descriptors are named "", the code suggests 13949 that this is for debugging purposes only, and may change in 13950 a future release. 13951 13952 It is unspecified if the string returned is determined by the 13953 setting of the LC_MESSAGES category in the current locale. 13954 13955 Errors 13956 13957 None defined. 13958 13959 gzflush 13960 13961 Name 13962 13963 gzflush -- flush a compressed file stream 13964 13965 Synopsis 13966 13967 #include 13968 13969 int gzflush(gzFile file, int flush); 13970 13971 Description 13972 13973 The gzflush() function shall flush pending output to the 13974 compressed file stream identified by file, which must be open 13975 for writing. 13976 13977 Flush Operation 13978 13979 The parameter flush determines which compressed bits are added 13980 to the output file. If flush is Z_NO_FLUSH, gzflush() may 13981 return with some data pending output, and not yet written to 13982 the file. 13983 13984 If flush is Z_SYNC_FLUSH, gzflush() shall flush all pending 13985 output to file and align the output to a byte boundary. There 13986 may still be data pending compression that is not flushed. 13987 13988 If flush is Z_FULL_FLUSH, all output shall be flushed, as for 13989 Z_SYNC_FLUSH, and the compression state shall be reset. There 13990 may still be data pending compression that is not flushed. 13991 13992 Rationale: Z_SYNC_FLUSH is intended to ensure that the 13993 compressed data contains all the data compressed so far, 13994 and allows a decompressor to reconstruct all of the input 13995 data. Z_FULL_FLUSH allows decompression to restart from 13996 this point if the previous compressed data has been lost or 13997 damaged. Flushing is likely to degrade the performance of 13998 the compression system, and should only be used where 13999 necessary. 14000 14001 If flush is set to Z_FINISH, all pending uncompressed data 14002 shall be compressed and all output shall be flushed. 14003 14004 Return Value 14005 14006 On success, gzflush() shall return the value Z_OK. Otherwise 14007 gzflush() shall return a value to indicate the error, and may 14008 set the error number associated with the compressed file 14009 stream file. 14010 14011 Note: If flush is set to Z_FINISH and the flush operation 14012 is successful, gzflush() will return Z_OK, but the 14013 compressed file stream error value may be set to 14014 Z_STREAM_END. 14015 14016 Errors 14017 14018 On error, gzwrite() shall return an error value, and may set 14019 the error number associated with the stream identified by file 14020 to indicate the error. Applications may use gzerror() to 14021 access this error value. 14022 14023 Z_ERRNO 14024 An underlying base library function has indicated an 14025 error. The global variable errno may be examined for 14026 further information. 14027 14028 Z_STREAM_ERROR 14029 The stream is invalid, is not open for writing, or is 14030 in an invalid state. 14031 14032 Z_BUF_ERROR 14033 no compression progress is possible (see deflate()). 14034 14035 Z_MEM_ERROR 14036 Insufficient memory available to compress. 14037 14038 gzgetc 14039 14040 Name 14041 14042 gzgetc -- read a character from a compressed file 14043 14044 Synopsis 14045 14046 #include 14047 14048 int gzgetc (gzFile file); 14049 14050 Description 14051 14052 The gzgetc() function shall read the next single character 14053 from the compressed file stream referenced by file, which 14054 shall have been opened in a read mode (see gzopen() and 14055 gzdopen()). 14056 14057 Return Value 14058 14059 On success, gzgetc() shall return the uncompressed character 14060 read, otherwise, on end of file or error, gzgetc() shall 14061 return -1. 14062 14063 Errors 14064 14065 On end of file or error, gzgetc() shall return -1. Further 14066 information can be found by calling gzerror() with a pointer 14067 to the compressed file stream. 14068 14069 gzgets 14070 14071 Name 14072 14073 gzgets -- read a string from a compressed file 14074 14075 Synopsis 14076 14077 #include 14078 14079 char * gzgets (gzFile file, char * buf, int len); 14080 14081 Description 14082 14083 The gzgets() function shall attempt to read data from the 14084 compressed file stream file, uncompressing it into buf until 14085 either len-1 bytes have been inserted into buf, or until a 14086 newline character has been uncompressed into buf. A null byte 14087 shall be appended to the uncompressed data. The file shall 14088 have been opened in for reading (see gzopen() and gzdopen()). 14089 14090 Return Value 14091 14092 On success, gzgets() shall return a pointer to buf. Otherwise, 14093 gzgets() shall return Z_NULL. Applications may examine the 14094 cause using gzerror(). 14095 14096 Errors 14097 14098 On error, gzgets() shall return Z_NULL. The following 14099 conditions shall always be treated as an error: 14100 14101 file is NULL, or does not refer to a file open for reading; 14102 buf is NULL; 14103 len is less than or equal to zero. 14104 14105 gzopen 14106 14107 Name 14108 14109 gzopen -- open a compressed file 14110 14111 Synopsis 14112 14113 #include 14114 14115 gzFile gzopen (const char *path , const char *mode ); 14116 14117 Description 14118 14119 The gzopen() function shall open the compressed file named by 14120 path. The mode argument is based on that of fopen(), but the 14121 mode parameter may also contain the following characters: 14122 14123 digit 14124 set the compression level to digit. A low value (e.g. 14125 1) means high speed, while a high value (e.g. 9) means 14126 high compression. A compression level of 0 (zero) means 14127 no compression. See defaultInit2_() for further 14128 details. 14129 14130 [fhR] 14131 set the compression strategy to [fhR]. The letter f 14132 corresponds to filtered data, the letter h corresponds 14133 to Huffman only compression, and the letter R 14134 corresponds to Run Length Encoding. See defaultInit2_() 14135 for further details. 14136 14137 If path refers to an uncompressed file, and mode refers to a 14138 read mode, gzopen() shall attempt to open the file and return 14139 a gzFile object suitable for reading directly from the file 14140 without any decompression. 14141 14142 If path or mode is NULL, or if mode does not contain one of r, 14143 w, or a, gzopen() shall return Z_NULL, and need not set any 14144 other error condition. 14145 14146 The gzFile object is also referred to as a compressed file 14147 stream. 14148 14149 Example 14150 14151 gzopen("file.gz", "w6h"); 14152 14153 Attempt to create a new compressed file, file.gz, at 14154 compression level 6 using Huffman only compression. 14155 14156 Return Value 14157 14158 On success, gzopen() shall return a gzFile object (also known 14159 as a compressed file stream). On failure, gzopen() shall 14160 return Z_NULL and may set errno accordingly. 14161 14162 Note: At version 1.2.2, zlib does not set errno for several 14163 error conditions. Applications may not be able to determine 14164 the cause of an error. 14165 14166 Errors 14167 14168 On error, gzopen() may set the global variable errno to 14169 indicate the error. 14170 14171 gzprintf 14172 14173 Name 14174 14175 gzprintf -- format data and compress 14176 14177 Synopsis 14178 14179 #include 14180 14181 int gzprintf (gzFile file, const char * fmt, ...); 14182 14183 Description 14184 14185 The gzprintf() function shall format data as for fprintf(), 14186 and write the resulting string to the compressed file stream 14187 file. 14188 14189 Return Value 14190 14191 The gzprintf() function shall return the number of 14192 uncompressed bytes actually written, or a value less than or 14193 equal to 0 in the event of an error. 14194 14195 Errors 14196 14197 If file is NULL, or refers to a compressed file stream that 14198 has not been opened for writing, gzprintf() shall return 14199 Z_STREAM_ERROR. Otherwise, errors are as for gzwrite(). 14200 14201 gzputc 14202 14203 Name 14204 14205 gzputc -- write character to a compressed file 14206 14207 Synopsis 14208 14209 #include 14210 14211 int gzputc (gzFile file, int c); 14212 14213 Description 14214 14215 The gzputc() function shall write the single character c, 14216 converted from integer to unsigned character, to the 14217 compressed file referenced by file, which shall have been 14218 opened in a write mode (see gzopen() and gzdopen()). 14219 14220 Return Value 14221 14222 On success, gzputc() shall return the value written, otherwise 14223 gzputc() shall return -1. 14224 14225 Errors 14226 14227 On error, gzputc() shall return -1. 14228 14229 gzputs 14230 14231 Name 14232 14233 gzputs -- string write to a compressed file 14234 14235 Synopsis 14236 14237 #include 14238 14239 int gzputs (gzFile file, const char * s); 14240 14241 Description 14242 14243 The gzputs() function shall write the null terminated string s 14244 to the compressed file referenced by file, which shall have 14245 been opened in a write mode (see gzopen() and gzdopen()). The 14246 terminating null character shall not be written. The gzputs() 14247 function shall return the number of uncompressed bytes 14248 actually written. 14249 14250 Return Value 14251 14252 On success, gzputs() shall return the number of uncompressed 14253 bytes actually written to file. On error gzputs() shall return 14254 a value less than or equal to 0. Applications may examine the 14255 cause using gzerror(). 14256 14257 Errors 14258 14259 On error, gzputs() shall set the error number associated with 14260 the stream identified by file to indicate the error. 14261 Applications should use gzerror() to access this error value. 14262 If file is NULL, gzputs() shall return Z_STREAM_ERR. 14263 14264 Z_ERRNO 14265 An underlying base library function has indicated an 14266 error. The global variable errno may be examined for 14267 further information. 14268 14269 Z_STREAM_ERROR 14270 The stream is invalid, is not open for writing, or is 14271 in an invalid state. 14272 14273 Z_BUF_ERROR 14274 no compression progress is possible (see deflate()). 14275 14276 Z_MEM_ERROR 14277 Insufficient memory available to compress. 14278 14279 gzread 14280 14281 Name 14282 14283 gzread -- read from a compressed file 14284 14285 Synopsis 14286 14287 #include 14288 14289 int gzread (gzFile file, voidp buf, unsigned int len); 14290 14291 Description 14292 14293 The gzread() function shall read data from the compressed file 14294 referenced by file, which shall have been opened in a read 14295 mode (see gzopen() and gzdopen()). The gzread() function shall 14296 read data from file, and uncompress it into buf. At most, len 14297 bytes of uncompressed data shall be copied to buf. If the file 14298 is not compressed, gzread() shall simply copy data from file 14299 to buf without alteration. 14300 14301 Return Value 14302 14303 On success, gzread() shall return the number of bytes 14304 decompressed into buf. If gzread() returns 0, either the 14305 end-of-file has been reached or an underlying read error has 14306 occurred. Applications should use gzerror() or gzeof() to 14307 determine which occurred. On other errors, gzread() shall 14308 return a value less than 0 and and applications may examine 14309 the cause using gzerror(). 14310 14311 Errors 14312 14313 On error, gzread() shall set the error number associated with 14314 the stream identified by file to indicate the error. 14315 Applications should use gzerror() to access this error value. 14316 14317 Z_ERRNO 14318 An underlying base library function has indicated an 14319 error. The global variable errno may be examined for 14320 further information. 14321 14322 Z_STREAM_END 14323 End of file has been reached on input. 14324 14325 Z_DATA_ERROR 14326 A CRC error occurred when reading data; the file is 14327 corrupt. 14328 14329 Z_STREAM_ERROR 14330 The stream is invalid, or is in an invalid state. 14331 14332 Z_NEED_DICT 14333 A dictionary is needed (see inflateSetDictionary()). 14334 14335 Z_MEM_ERROR 14336 Insufficient memory available to decompress. 14337 14338 gzrewind 14339 14340 Name 14341 14342 gzrewind -- reset the file-position indicator on a compressed 14343 file stream 14344 14345 Synopsis 14346 14347 #include 14348 14349 int gzrewind(gzFile file); 14350 14351 Description 14352 14353 The gzrewind() function shall set the starting position for 14354 the next read on compressed file stream file to the beginning 14355 of file. file must be open for reading. 14356 14357 gzrewind() is equivalent to 14358 (int)gzseek(file, 0L, SEEK_SET) 14359 14360 . 14361 14362 Return Value 14363 14364 On success, gzrewind() shall return 0. On error, gzrewind() 14365 shall return -1, and may set the error value for file 14366 accordingly. 14367 14368 Errors 14369 14370 On error, gzrewind() shall return -1, indicating that file is 14371 NULL, or does not represent an open compressed file stream, or 14372 represents a compressed file stream that is open for writing 14373 and is not currently at the beginning of file. 14374 14375 gzseek 14376 14377 Name 14378 14379 gzseek -- reposition a file-position indicator in a compressed 14380 file stream 14381 14382 Synopsis 14383 14384 #include 14385 14386 z_off_t gzseek(gzFile file, z_off_t offset, int whence); 14387 14388 Description 14389 14390 The gzseek() function shall set the file-position indicator 14391 for the compressed file stream file. The file-position 14392 indicator controls where the next read or write operation on 14393 the compressed file stream shall take place. The offset 14394 indicates a byte offset in the uncompressed data. The whence 14395 parameter may be one of: 14396 14397 SEEK_SET 14398 the offset is relative to the start of the uncompressed 14399 data. 14400 14401 SEEK_CUR 14402 the offset is relative to the current positition in the 14403 uncompressed data. 14404 14405 Note: The value SEEK_END need not be supported. 14406 14407 If the file is open for writing, the new offset must be 14408 greater than or equal to the current offset. In this case, 14409 gzseek() shall compress a sequence of null bytes to fill the 14410 gap from the previous offset to the new offset. 14411 14412 Return Value 14413 14414 On success, gzseek() shall return the resulting offset in the 14415 file expressed as a byte position in the uncompressed data 14416 stream. On error, gzseek() shall return -1, and may set the 14417 error value for file accordingly. 14418 14419 Errors 14420 14421 On error, gzseek() shall return -1. The following conditions 14422 shall always result in an error: 14423 14424 * file is NULL 14425 * file does not represent an open compressed file stream. 14426 * file refers to a compressed file stream that is open for 14427 writing, and the newly computed offset is less than the 14428 current offset. 14429 * The newly computed offset is less than zero. 14430 * whence is not one of the supported values. 14431 14432 Application Usage (informative) 14433 14434 If file is open for reading, the implementation may still need 14435 to uncompress all of the data up to the new offset. As a 14436 result, gzseek() may be extremely slow in some circumstances. 14437 14438 gzsetparams 14439 14440 Name 14441 14442 gzsetparams -- dynamically set compression parameters 14443 14444 Synopsis 14445 14446 #include 14447 14448 int gzsetparams (gzFile file, int level, int strategy); 14449 14450 Description 14451 14452 The gzsetparams() function shall set the compression level and 14453 compression strategy on the compressed file stream referenced 14454 by file. The compressed file stream shall have been opened in 14455 a write mode. The level and strategy are as defined in 14456 deflateInit2_. If there is any data pending writing, it shall 14457 be flushed before the parameters are updated. 14458 14459 Return Value 14460 14461 On success, the gzsetparams() function shall return Z_OK. 14462 14463 Errors 14464 14465 On error, gzsetparams() shall return one of the following 14466 error indications: 14467 14468 Z_STREAM_ERROR 14469 Invalid parameter, or file not open for writing. 14470 14471 Z_BUF_ERROR 14472 An internal inconsistency was detected while flushing 14473 the previous buffer. 14474 14475 gztell 14476 14477 Name 14478 14479 gztell -- find position on a compressed file stream 14480 14481 Synopsis 14482 14483 #include 14484 14485 z_off_t gztell (gzFile file ); 14486 14487 Description 14488 14489 The gztell() function shall return the starting position for 14490 the next read or write operation on compressed file stream 14491 file. This position represents the number of bytes from the 14492 beginning of file in the uncompressed data. 14493 14494 gztell() is equivalent to 14495 gzseek(file, 0L, SEEK_SET) 14496 14497 . 14498 14499 Return Value 14500 14501 gztell() shall return the current offset in the file expressed 14502 as a byte position in the uncompressed data stream. On error, 14503 gztell() shall return -1, and may set the error value for file 14504 accordingly. 14505 14506 Errors 14507 14508 On error, gztell() shall return -1, indicating that file is 14509 NULL, or does not represent an open compressed file stream. 14510 14511 gzwrite 14512 14513 Name 14514 14515 gzwrite -- write to a compressed file 14516 14517 Synopsis 14518 14519 #include 14520 14521 int gzwrite (gzFile file, voidpc buf, unsigned int len); 14522 14523 Description 14524 14525 The gzwrite() function shall write data to the compressed file 14526 referenced by file, which shall have been opened in a write 14527 mode (see gzopen() and gzdopen()). On entry, buf shall point 14528 to a buffer containing lenbytes of uncompressed data. The 14529 gzwrite() function shall compress this data and write it to 14530 file. The gzwrite() function shall return the number of 14531 uncompressed bytes actually written. 14532 14533 Return Value 14534 14535 On success, gzwrite() shall return the number of uncompressed 14536 bytes actually written to file. On error gzwrite() shall 14537 return a value less than or equal to 0. Applications may 14538 examine the cause using gzerror(). 14539 14540 Errors 14541 14542 On error, gzwrite() shall set the error number associated with 14543 the stream identified by file to indicate the error. 14544 Applications should use gzerror() to access this error value. 14545 14546 Z_ERRNO 14547 An underlying base library function has indicated an 14548 error. The global variable errno may be examined for 14549 further information. 14550 14551 Z_STREAM_ERROR 14552 The stream is invalid, is not open for writing, or is 14553 in an invalid state. 14554 14555 Z_BUF_ERROR 14556 no compression progress is possible (see deflate()). 14557 14558 Z_MEM_ERROR 14559 Insufficient memory available to compress. 14560 14561 inflate 14562 14563 Name 14564 14565 inflate -- decompress data 14566 14567 Synopsis 14568 14569 #include 14570 14571 int inflate(z_streamp stream, int flush); 14572 14573 Description 14574 14575 The inflate() function shall attempt to decompress data until 14576 either the input buffer is empty or the output buffer is full. 14577 The stream references a z_stream structure. Before the first 14578 call to inflate(), this structure should have been initialized 14579 by a call to inflateInit2_(). 14580 14581 Note: inflateInit2_() is only in the binary standard; 14582 source level applications should initialize stream via a 14583 call to inflateInit() or inflateInit2(). 14584 14585 In addition, the stream input and output buffers should have 14586 been initialized as follows: 14587 14588 next_in 14589 should point to the data to be decompressed. 14590 14591 avail_in 14592 should contain the number of bytes of data in the 14593 buffer referenced by next_in. 14594 14595 next_out 14596 should point to a buffer where decompressed data may be 14597 placed. 14598 14599 avail_out 14600 should contain the size in bytes of the buffer 14601 referenced by next_out 14602 14603 The inflate() function shall perform one or both of the 14604 following actions: 14605 14606 1. Decompress input data from next_in and update next_in, 14607 avail_in and total_in to reflect the data that has been 14608 decompressed. 14609 2. Fill the output buffer referenced by next_out, and update 14610 next_out, avail_out, and total_out to reflect the 14611 decompressed data that has been placed there. If flush is 14612 not Z_NO_FLUSH, and avail_out indicates that there is 14613 still space in output buffer, this action shall always 14614 occur (see below for further details). 14615 14616 The inflate() function shall return when either avail_in 14617 reaches zero (indicating that all the input data has been 14618 compressed), or avail_out reaches zero (indicating that the 14619 output buffer is full). 14620 14621 On success, the inflate() function shall set the adler field 14622 of the stream to the Adler-32 checksum of all the input data 14623 compressed so far (represented by total_in). 14624 14625 Flush Operation 14626 14627 The parameter flush determines when uncompressed bytes are 14628 added to the output buffer in next_out. If flush is 14629 Z_NO_FLUSH, inflate() may return with some data pending 14630 output, and not yet added to the output buffer. 14631 14632 If flush is Z_SYNC_FLUSH, inflate() shall flush all pending 14633 output to next_out, and update next_out and avail_out 14634 accordingly. 14635 14636 If flush is set to Z_BLOCK, inflate() shall stop adding data 14637 to the output buffer if and when the next compressed block 14638 boundary is reached (see RFC 1951: DEFLATE Compressed Data 14639 Format Specification). 14640 14641 If flush is set to Z_FINISH, all of the compressed input shall 14642 be decompressed and added to the output. If there is 14643 insufficient output space (i.e. the compressed input data 14644 uncompresses to more than avail_out bytes), then inflate() 14645 shall fail and return Z_BUF_ERROR. 14646 14647 Return Value 14648 14649 On success, inflate() shall return Z_OK if decompression 14650 progress has been made, or Z_STREAM_END if all of the input 14651 data has been decompressed and there was sufficient space in 14652 the output buffer to store the uncompressed result. On error, 14653 inflate() shall return a value to indicate the error. 14654 14655 Note: If inflate() returns Z_OK and has set avail_out to 14656 zero, the function should be called again with the same 14657 value for flush, and with updated next_out and avail_out 14658 until inflate() returns with either Z_OK or Z_STREAM_END 14659 and a non-zero avail_out. 14660 14661 On success, inflate() shall set the adler to the Adler-32 14662 checksum of the output produced so far (i.e. total_out bytes). 14663 14664 Errors 14665 14666 On error, inflate() shall return a value as described below, 14667 and may set the msg field of stream to point to a string 14668 describing the error: 14669 14670 Z_BUF_ERROR 14671 No progress is possible; either avail_in or avail_out 14672 was zero. 14673 14674 Z_MEM_ERROR 14675 Insufficient memory. 14676 14677 Z_STREAM_ERROR 14678 The state (as represented in stream) is inconsistent, 14679 or stream was NULL. 14680 14681 Z_NEED_DICT 14682 A preset dictionary is required. The adler field shall 14683 be set to the Adler-32 checksum of the dictionary 14684 chosen by the compressor. 14685 14686 inflateEnd 14687 14688 Name 14689 14690 inflateEnd -- free decompression stream state 14691 14692 Synopsis 14693 14694 #include 14695 14696 int inflateEnd(z_streamp stream); 14697 14698 Description 14699 14700 The inflateEnd() function shall free all allocated state 14701 information referenced by stream. All pending output is 14702 discarded, and unprocessed input is ignored. 14703 14704 Return Value 14705 14706 On success, inflateEnd() shall return Z_OK. Otherwise it shall 14707 return Z_STREAM_ERROR to indicate the error. 14708 14709 Errors 14710 14711 On error, inflateEnd() shall return Z_STREAM_ERROR. The 14712 following conditions shall be treated as an error: 14713 14714 * The state in stream is inconsistent. 14715 * stream is NULL. 14716 * The zfree function pointer is NULL. 14717 14718 inflateInit2_ 14719 14720 Name 14721 14722 inflateInit2_ -- initialize decompression system 14723 14724 Synopsis 14725 14726 #include 14727 14728 int inflateInit2_ (z_streamp strm, int windowBits, char * 14729 version, int stream_size); 14730 14731 Description 14732 14733 The inflateInit2_() function shall initialize the 14734 decompression system. On entry, strm shall refer to a user 14735 supplied z_stream object (a z_stream_s structure). The 14736 following fields shall be set on entry: 14737 14738 zalloc 14739 a pointer to an alloc_func function, used to allocate 14740 state information. If this is NULL, a default 14741 allocation function will be used. 14742 14743 zfree 14744 a pointer to a free_func function, used to free memory 14745 allocated by the zalloc function. If this is NULL a 14746 default free function will be used. 14747 14748 opaque 14749 If alloc_func is not NULL, opaque is a user supplied 14750 pointer to data that will be passed to the alloc_func 14751 and free_func functions. 14752 14753 If the version requested is not compatible with the version 14754 implemented, or if the size of the z_stream_s structure 14755 provided in stream_size does not match the size in the library 14756 implementation, inflateInit2_() shall fail, and return 14757 Z_VERSION_ERROR. 14758 14759 The windowBits parameter shall be a base 2 logarithm of the 14760 maximum window size to use, and shall be a value between 8 and 14761 15. If the input data was compressed with a larger window 14762 size, subsequent attempts to decompress this data will fail 14763 with Z_DATA_ERROR, rather than try to allocate a larger 14764 window. 14765 14766 The inflateInit2_() function is not in the source standard; it 14767 is only in the binary standard. Source applications should use 14768 the inflateInit2() macro. 14769 14770 Return Value 14771 14772 On success, the inflateInit2_() function shall return Z_OK. 14773 Otherwise, inflateInit2_() shall return a value as described 14774 below to indicate the error. 14775 14776 Errors 14777 14778 On error, inflateInit2_() shall return one of the following 14779 error indicators: 14780 14781 Z_STREAM_ERROR 14782 Invalid parameter. 14783 14784 Z_MEM_ERROR 14785 Insufficient memory available. 14786 14787 Z_VERSION_ERROR 14788 The version requested is not compatible with the 14789 library version, or the z_stream size differs from that 14790 used by the library. 14791 14792 In addition, the msg field of the strm may be set to an error 14793 message. 14794 14795 inflateInit_ 14796 14797 Name 14798 14799 inflateInit_ -- initialize decompression system 14800 14801 Synopsis 14802 14803 #include 14804 14805 int inflateInit_(z_streamp stream, const char * version, int 14806 stream_size); 14807 14808 Description 14809 14810 The inflateInit_() function shall initialize the decompression 14811 system. On entry, stream shall refer to a user supplied 14812 z_stream object (a z_stream_s structure). The following fields 14813 shall be set on entry: 14814 14815 zalloc 14816 a pointer to an alloc_func function, used to allocate 14817 state information. If this is NULL, a default 14818 allocation function will be used. 14819 14820 zfree 14821 a pointer to a free_func function, used to free memory 14822 allocated by the zalloc function. If this is NULL a 14823 default free function will be used. 14824 14825 opaque 14826 If alloc_func is not NULL, opaque is a user supplied 14827 pointer to data that will be passed to the alloc_func 14828 and free_func functions. 14829 14830 If the version requested is not compatible with the version 14831 implemented, or if the size of the z_stream_s structure 14832 provided in stream_size does not match the size in the library 14833 implementation, inflateInit_() shall fail, and return 14834 Z_VERSION_ERROR. 14835 14836 The inflateInit_() function is not in the source standard; it 14837 is only in the binary standard. Source applications should use 14838 the inflateInit() macro. 14839 14840 The inflateInit_() shall be equivalent to 14841 inflateInit2_(strm, DEF_WBITS, version, stream_size); 14842 14843 Return Value 14844 14845 On success, the inflateInit_() function shall return Z_OK. 14846 Otherwise, inflateInit_() shall return a value as described 14847 below to indicate the error. 14848 14849 Errors 14850 14851 On error, inflateInit_() shall return one of the following 14852 error indicators: 14853 14854 Z_STREAM_ERROR 14855 Invalid parameter. 14856 14857 Z_MEM_ERROR 14858 Insufficient memory available. 14859 14860 Z_VERSION_ERROR 14861 The version requested is not compatible with the 14862 library version, or the z_stream size differs from that 14863 used by the library. 14864 14865 In addition, the msg field of the strm may be set to an error 14866 message. 14867 14868 inflateReset 14869 14870 Name 14871 14872 inflateReset -- reset decompression stream state 14873 14874 Synopsis 14875 14876 #include 14877 14878 int inflateReset(z_streamp stream); 14879 14880 Description 14881 14882 The inflateReset() function shall reset all state associated 14883 with stream. All pending output shall be discarded, and the 14884 counts of processed bytes (total_in and total_out) shall be 14885 reset to zero. 14886 14887 Return Value 14888 14889 On success, inflateReset() shall return Z_OK. Otherwise it 14890 shall return Z_STREAM_ERROR to indicate the error. 14891 14892 Errors 14893 14894 On error, inflateReset() shall return Z_STREAM_ERROR. The 14895 following conditions shall be treated as an error: 14896 14897 * The state in stream is inconsistent or inappropriate. 14898 * stream is NULL. 14899 14900 inflateSetDictionary 14901 14902 Name 14903 14904 inflateSetDictionary -- initialize decompression dictionary 14905 14906 Synopsis 14907 14908 #include 14909 14910 int inflateSetDictionary(z_streamp stream, const Bytef * 14911 dictionary, uInt dictlen); 14912 14913 Description 14914 14915 The inflateSetDictionary() function shall initialize the 14916 decompression dictionary associated with stream using the 14917 dictlen bytes referenced by dictionary. 14918 14919 The inflateSetDictionary() function should be called 14920 immediately after a call to inflate() has failed with return 14921 value Z_NEED_DICT. The dictionary must have the same Adler-32 14922 checksum as the dictionary used for the compression (see 14923 deflateSetDictionary()). 14924 14925 stream shall reference an initialized decompression stream, 14926 with total_in zero (i.e. no data has been decompressed since 14927 the stream was initialized). 14928 14929 Return Value 14930 14931 On success, inflateSetDictionary() shall return Z_OK. 14932 Otherwise it shall return a value as indicated below. 14933 14934 Errors 14935 14936 On error, inflateSetDictionary() shall return a value as 14937 described below: 14938 14939 Z_STREAM_ERROR 14940 The state in stream is inconsistent, or stream was 14941 NULL. 14942 14943 Z_DATA_ERROR 14944 The Adler-32 checksum of the supplied dictionary does 14945 not match that used for the compression. 14946 14947 Application Usage (informative) 14948 14949 The application should provide a dictionary consisting of 14950 strings {{{ed note: do we really mean "strings"? Null 14951 terminated?}}} that are likely to be encountered in the data 14952 to be compressed. The application should ensure that the 14953 dictionary is sorted such that the most commonly used stri