1 2 Linux Standard Base Specification 3.0Preview1 3 4 Copyright © 2000, 2001, 2002, 2003, 2004 Free Standards Group 5 6 Permission is granted to copy, distribute and/or modify this 7 document under the terms of the GNU Free Documentation 8 License, Version 1.1; with no Invariant Sections, with no 9 Front-Cover Texts, and with no Back-Cover Texts. A copy of the 10 license is included in the section entitled "GNU Free 11 Documentation License". 12 13 Portions of the text are copyrighted by the following parties: 14 15 * The Regents of the University of California 16 * Free Software Foundation 17 * Ian F. Darwin 18 * Paul Vixie 19 * BSDI (now Wind River) 20 * Andrew G Morgan 21 * Jean-loup Gailly and Mark Adler 22 * Massachusetts Institute of Technology 23 24 These excerpts are being used in accordance with their 25 respective licenses. 26 27 Linux is a trademark of Linus Torvalds. 28 29 UNIX a registered trademark of the Open Group in the United 30 States and other countries. 31 32 LSB is a trademark of the Free Standards Group in the USA and 33 other countries. 34 35 AMD is a trademark of Advanced Micro Devices, Inc. 36 37 Intel and Itanium are registered trademarks and Intel386 is a 38 trademarks of Intel Corporation. 39 40 OpenGL is a registered trademark of Silicon Graphics, Inc. 41 _________________________________________________________ 42 43 Table of Contents 44 Foreword 45 Introduction 46 I. Introductory Elements 47 48 1. Scope 49 50 1.1. General 51 1.2. Module Specific Scope 52 53 2. Normative References 54 3. Requirements 55 56 3.1. Relevant Libraries 57 3.2. LSB Implementation Conformance 58 3.3. LSB Application Conformance 59 60 4. Definitions 61 5. Terminology 62 6. Documentation Conventions 63 7. Relationship To ISO/IEC 9945 POSIX 64 65 II. Base Libraries 66 67 8. Libraries 68 69 8.1. Introduction 70 8.2. Program Interpreter 71 8.3. Interfaces for libc 72 8.4. Data Definitions for libc 73 8.5. Interface Definitions for libc 74 8.6. Interfaces for libm 75 8.7. Data Definitions for libm 76 8.8. Interface Definitions for libm 77 8.9. Interfaces for libpthread 78 8.10. Data Definitions for libpthread 79 8.11. Interface Definitions for libpthread 80 8.12. Interfaces for libgcc_s 81 8.13. Data Definitions for libgcc_s 82 8.14. Interfaces for libdl 83 8.15. Data Definitions for libdl 84 8.16. Interface Definitions for libdl 85 8.17. Interfaces for libcrypt 86 8.18. Interfaces for libpam 87 8.19. Data Definitions for libpam 88 8.20. Interface Definitions for libpam 89 90 III. Utility Libraries 91 92 9. Utility Libraries 93 94 9.1. Introduction 95 9.2. Interfaces for libz 96 9.3. Data Definitions for libz 97 9.4. Interface Definitions for libz 98 9.5. Interfaces for libncurses 99 9.6. Data Definitions for libncurses 100 9.7. Interfaces for libutil 101 9.8. Interface Definitions for libutil 102 103 IV. Commands and Utilities 104 105 10. Commands and Utilities 106 107 10.1. Commands and Utilities 108 10.2. Command Behavior 109 110 V. Execution Environment 111 112 11. File System Hierarchy 113 114 11.1. /dev 115 11.2. User Accounting Databases 116 11.3. Path For System Administration Utilities 117 118 12. Additional Recommendations 119 120 12.1. Minimal granted Directory and File 121 permissions 122 123 12.2. Recommendations for applications on ownership 124 and permissions 125 126 13. Additional Behaviors 127 128 13.1. Mandatory Optional Behaviors 129 130 14. Localization 131 132 14.1. Introduction 133 14.2. Regular Expressions 134 14.3. Pattern Matching Notation 135 136 VI. System Initialization 137 138 15. System Initialization 139 140 15.1. Cron Jobs 141 15.2. Init Script Actions 142 15.3. Comment Conventions for Init Scripts 143 15.4. Installation and Removal of init.d Files 144 15.5. Run Levels 145 15.6. Facility Names 146 15.7. Script Names 147 15.8. Init Script Functions 148 149 VII. Users & Groups 150 151 16. Users & Groups 152 153 16.1. User and Group Database 154 16.2. User & Group Names 155 16.3. UID Ranges 156 16.4. Rationale 157 158 A. GNU Free Documentation License 159 160 A.1. PREAMBLE 161 A.2. APPLICABILITY AND DEFINITIONS 162 A.3. VERBATIM COPYING 163 A.4. COPYING IN QUANTITY 164 A.5. MODIFICATIONS 165 A.6. COMBINING DOCUMENTS 166 A.7. COLLECTIONS OF DOCUMENTS 167 A.8. AGGREGATION WITH INDEPENDENT WORKS 168 A.9. TRANSLATION 169 A.10. TERMINATION 170 A.11. FUTURE REVISIONS OF THIS LICENSE 171 A.12. How to use this License for your documents 172 173 List of Tables 174 2-1. Normative References 175 3-1. Standard Library Names 176 3-2. Standard Library Names defined in the Architecture 177 Specific Supplement 178 179 8-1. libc Definition 180 8-2. libc - RPC Function Interfaces 181 8-3. libc - System Calls Function Interfaces 182 8-4. libc - Standard I/O Function Interfaces 183 8-5. libc - Standard I/O Data Interfaces 184 8-6. libc - Signal Handling Function Interfaces 185 8-7. libc - Signal Handling Data Interfaces 186 8-8. libc - Localization Functions Function Interfaces 187 8-9. libc - Localization Functions Data Interfaces 188 8-10. libc - Socket Interface Function Interfaces 189 8-11. libc - Wide Characters Function Interfaces 190 8-12. libc - String Functions Function Interfaces 191 8-13. libc - IPC Functions Function Interfaces 192 8-14. libc - Regular Expressions Function Interfaces 193 8-15. libc - Character Type Functions Function Interfaces 194 8-16. libc - Time Manipulation Function Interfaces 195 8-17. libc - Time Manipulation Data Interfaces 196 8-18. libc - Terminal Interface Functions Function Interfaces 197 8-19. libc - System Database Interface Function Interfaces 198 8-20. libc - Language Support Function Interfaces 199 8-21. libc - Large File Support Function Interfaces 200 8-22. libc - Standard Library Function Interfaces 201 8-23. libc - Standard Library Data Interfaces 202 8-24. libm Definition 203 8-25. libm - Math Function Interfaces 204 8-26. libm - Math Data Interfaces 205 8-27. libpthread Definition 206 8-28. libpthread - Realtime Threads Function Interfaces 207 8-29. libpthread - Posix Threads Function Interfaces 208 8-30. libgcc_s Definition 209 8-31. libdl Definition 210 8-32. libdl - Dynamic Loader Function Interfaces 211 8-33. libcrypt Definition 212 8-34. libcrypt - Encryption Function Interfaces 213 8-35. libpam Definition 214 8-36. libpam - Pluggable Authentication API Function 215 Interfaces 216 217 9-1. libz Definition 218 9-2. libz - Compression Library Function Interfaces 219 9-3. libncurses Definition 220 9-4. libncurses - Curses Function Interfaces 221 9-5. libncurses - Curses Data Interfaces 222 9-6. libutil Definition 223 9-7. libutil - Utility Functions Function Interfaces 224 10-1. Commands And Utilities 225 10-2. Built In Utilities 226 10-1. Escape Sequences 227 16-1. Required User & Group Names 228 16-2. Optional User & Group Names 229 _________________________________________________________ 230 231 Foreword 232 233 This is version 3.0Preview1 of the Linux Standard Base 234 Specification. An implementation of this version of the 235 specification may not claim to be an implementation of the 236 Linux Standard Base unless it has successfully completed the 237 compliance process as defined by the Free Standards Group. 238 _________________________________________________________ 239 240 Introduction 241 242 The LSB defines a binary interface for application programs 243 that are compiled and packaged for LSB-conforming 244 implementations on many different hardware architectures. 245 Since a binary specification shall include information 246 specific to the computer processor architecture for which it 247 is intended, it is not possible for a single document to 248 specify the interface for all possible LSB-conforming 249 implementations. Therefore, the LSB is a family of 250 specifications, rather than a single one. 251 252 This document should be used in conjunction with the documents 253 it references. This document enumerates the system components 254 it includes, but descriptions of those components may be 255 included entirely or partly in this document, partly in other 256 documents, or entirely in other reference documents. For 257 example, the section that describes system service routines 258 includes a list of the system routines supported in this 259 interface, formal declarations of the data structures they use 260 that are visible to applications, and a pointer to the 261 underlying referenced specification for information about the 262 syntax and semantics of each call. Only those routines not 263 described in standards referenced by this document, or 264 extensions to those standards, are described in the detail. 265 Information referenced in this way is as much a part of this 266 document as is the information explicitly included here. 267 268 The specification carries a version number of either the form 269 x.y or x.y.z. This version number carries the following 270 meaning: 271 272 * The first number (x) is the major version number. All 273 versions with the same major version number should share 274 binary compatibility. Any addition or deletion of a new 275 library results in a new version number. Interfaces marked 276 as deprecated may be removed from the specification at a 277 major version change. 278 * The second number (y) is the minor version number. 279 Individual interfaces may be added if all certified 280 implementations already had that (previously undocumented) 281 interface. Interfaces may be marked as deprecated at a 282 minor version change. Other minor changes may be permitted 283 at the discretion of the LSB workgroup. 284 * The third number (z), if present, is the editorial level. 285 Only editorial changes should be included in such 286 versions. 287 288 I. Introductory Elements 289 290 Table of Contents 291 1. Scope 292 2. Normative References 293 3. Requirements 294 4. Definitions 295 5. Terminology 296 6. Documentation Conventions 297 7. Relationship To ISO/IEC 9945 POSIX 298 _________________________________________________________ 299 300 Chapter 1. Scope 301 302 1.1. General 303 304 The Linux Standard Base (LSB) defines a system interface for 305 compiled applications and a minimal environment for support of 306 installation scripts. Its purpose is to enable a uniform 307 industry standard environment for high-volume applications 308 conforming to the LSB. 309 310 These specifications are composed of two basic parts: A common 311 specification ("LSB-generic") describing those parts of the 312 interface that remain constant across all implementations of 313 the LSB, and an architecture-specific specification 314 ("LSB-arch") describing the parts of the interface that vary 315 by processor architecture. Together, the LSB-generic and the 316 architecture-specific supplement for a single hardware 317 architecture provide a complete interface specification for 318 compiled application programs on systems that share a common 319 hardware architecture. 320 321 The LSB-generic document shall be used in conjunction with an 322 architecture-specific supplement. Whenever a section of the 323 LSB-generic specification shall be supplemented by 324 architecture-specific information, the LSB-generic document 325 includes a reference to the architecture supplement. 326 Architecture supplements may also contain additional 327 information that is not referenced in the LSB-generic 328 document. 329 330 The LSB contains both a set of Application Program Interfaces 331 (APIs) and Application Binary Interfaces (ABIs). APIs may 332 appear in the source code of portable applications, while the 333 compiled binary of that application may use the larger set of 334 ABIs. A conforming implementation shall provide all of the 335 ABIs listed here. The compilation system may replace (e.g. by 336 macro definition) certain APIs with calls to one or more of 337 the underlying binary interfaces, and may insert calls to 338 binary interfaces as needed. 339 340 The LSB is primarily a binary interface definition. Not all of 341 the source level APIs available to applications may be 342 contained in this specification. 343 _________________________________________________________ 344 345 1.2. Module Specific Scope 346 347 This is the Core module of the Linux Standards Base (LSB). 348 This module provides the fundamental system interfaces, 349 libraries, and runtime environment upon which all conforming 350 applications and libraries depend. 351 352 Interfaces described in this module are mandatory except where 353 explicitly listed otherwise. Core interfaces may be 354 supplemented by other modules; all modules are built upon the 355 core. 356 _________________________________________________________ 357 358 Chapter 2. Normative References 359 360 The specifications listed below are referenced in whole or in 361 part by the Linux Standard Base. In this specification, where 362 only a particular section of one of these references is 363 identified, then the normative reference is to that section 364 alone, and the rest of the referenced document is informative. 365 366 Table 2-1. Normative References 367 Name Title URL 368 DWARF Debugging Information Format DWARF Debugging Information 369 Format, Revision 2.0.0 (July 27, 1993) 370 http://www.eagercon.com/dwarf/dwarf-2.0.0.pdf 371 Filesystem Hierarchy Standard Filesystem Hierarchy Standard 372 (FHS) 2.3 http://www.pathname.com/fhs/ 373 Gdk 2.6.2 Reference Manual Gdk 2.6.2 Reference Manual 374 http://www.gtk.org/api/2.6/gdk/index.html 375 Gdk-pixbuf 2.6.2 Reference Manual Gdk-pixbuf 2.6.2 Reference 376 Manual http://www.gtk.org/api/2.6/gdk-pixbuf/index.html 377 Glib 2.6.2 Reference Manual Glib 2.6.2 Reference Manual 378 http://www.gtk.org/api/2.6/glib/index.html 379 Gobject 2.6.2 Reference Manual Gobject 2.6.2 Reference Manual 380 http://www.gtk.org/api/2.6/gobject/index.html 381 Gtk 2.6.2 Reference Manual Gtk 2.6.2 Reference Manual 382 http://www.gtk.org/api/2.6/gtk/index.html 383 IEEE Std 754-1985 IEEE Standard 754 for Binary Floating-Point 384 Arithmetic http://www.ieee.org/ 385 ISO C (1999) ISO/IEC 9899: 1999, Programming Languages --C 386 ISO POSIX (2003) 387 388 ISO/IEC 9945-1:2003 Information technology -- Portable 389 Operating System Interface (POSIX) -- Part 1: Base Definitions 390 391 ISO/IEC 9945-2:2003 Information technology -- Portable 392 Operating System Interface (POSIX) -- Part 2: System 393 Interfaces 394 395 ISO/IEC 9945-3:2003 Information technology -- Portable 396 Operating System Interface (POSIX) -- Part 3: Shell and 397 Utilities 398 399 ISO/IEC 9945-4:2003 Information technology -- Portable 400 Operating System Interface (POSIX) -- Part 4: Rationale 401 402 Including Technical Cor. 1: 2004 403 http://www.unix.org/version3/ 404 ISO/IEC TR14652 ISO/IEC Technical Report 14652:2002 405 Specification method for cultural conventions 406 ITU-T V.42 International Telecommunication Union 407 Recommendation V.42 (2002): Error-correcting procedures for 408 DCEs using asynchronous-to-synchronous conversionITUV 409 http://www.itu.int/rec/recommendation.asp?type=folders&lang=e& 410 parent=T-REC-V.42 411 Large File Support Large File Support 412 http://www.UNIX-systems.org/version2/whatsnew/lfs20mar.html 413 Li18nux Globalization Specification LI18NUX 2000 Globalization 414 Specification, Version 1.0 with Amendment 4 415 http://www.li18nux.org/docs/html/LI18NUX-2000-amd4.htm 416 Linux Allocated Device Registry LINUX ALLOCATED DEVICES 417 http://www.lanana.org/docs/device-list/devices.txt 418 PAM Open Software Foundation, Request For Comments: 86.0 , 419 October 1995, V. Samar & R.Schemers (SunSoft) 420 http://www.opengroup.org/tech/rfc/mirror-rfc/rfc86.0.txt 421 RFC 1321: The MD5 Message-Digest Algorithm IETF RFC 1321: The 422 MD5 Message-Digest Algorithm 423 http://www.ietf.org/rfc/rfc1321.txt 424 RFC 1833: Binding Protocols for ONC RPC Version 2 IETF RFC 425 1833: Binding Protocols for ONC RPC Version 2 426 http://www.ietf.org/rfc/rfc1833.txt 427 RFC 1950: ZLIB Compressed Data Format Specication IETF RFC 428 1950: ZLIB Compressed Data Format Specification 429 http://www.ietf.org/rfc/rfc1950.txt 430 RFC 1951: DEFLATE Compressed Data Format Specification IETF 431 RFC 1951: DEFLATE Compressed Data Format Specification version 432 1.3 http://www.ietf.org/rfc/rfc1951.txt 433 RFC 1952: GZIP File Format Specification IETF RFC 1952: GZIP 434 file format specification version 4.3 435 http://www.ietf.org/rfc/rfc1952.txt 436 RFC 2440: OpenPGP Message Format IETF RFC 2440: OpenPGP 437 Message Format http://www.ietf.org/rfc/rfc2440.txt 438 RFC 2821:Simple Mail Transfer Protocol IETF RFC 2821: Simple 439 Mail Transfer Protocol http://www.ietf.org/rfc/rfc2821.txt 440 RFC 2822:Internet Message Format IETF RFC 2822: Internet 441 Message Format http://www.ietf.org/rfc/rfc2822.txt 442 RFC 791:Internet Protocol IETF RFC 791: Internet Protocol 443 Specification http://www.ietf.org/rfc/rfc791.txt 444 SUSv2 CAE Specification, January 1997, System Interfaces and 445 Headers (XSH),Issue 5 (ISBN: 1-85912-181-0, C606) 446 http://www.opengroup.org/publications/catalog/un.htm 447 SUSv2 Commands and Utilities The Single UNIX® 448 Specification(SUS) Version 2, Commands and Utilities (XCU), 449 Issue 5 (ISBN: 1-85912-191-8, C604) 450 http://www.opengroup.org/publications/catalog/un.htm 451 SVID Issue 3 American Telephone and Telegraph Company, System 452 V Interface Definition, Issue 3 ; Morristown, NJ, UNIX Press, 453 1989.(ISBN 0201566524) 454 SVID Issue 4 System V Interface Definition,Fourth Edition 455 System V ABI System V Application Binary Interface, Edition 456 4.1 http://www.caldera.com/developers/devspecs/gabi41.pdf 457 System V ABI Update System V Application Binary Interface - 458 DRAFT - 17 December 2003 459 http://www.caldera.com/developers/gabi/2003-12-17/contents.htm 460 l 461 this specification Linux Standard Base 462 http://www.linuxbase.org/spec/ 463 X/Open Curses CAE Specification, May 1996, X/Open Curses, 464 Issue 4, Version 2 (ISBN: 1-85912-171-3, C610), plus 465 Corrigendum U018 466 http://www.opengroup.org/publications/catalog/un.htm 467 _________________________________________________________ 468 469 Chapter 3. Requirements 470 471 3.1. Relevant Libraries 472 473 The libraries listed in Table 3-1 shall be available on a 474 Linux Standard Base system, with the specified runtime names. 475 The libraries listed in Table 3-2 are architecture specific, 476 but shall be available on all LSB conforming systems. This 477 list may be supplemented or amended by the 478 architecture-specific specification. 479 480 Table 3-1. Standard Library Names 481 Library Runtime Name 482 libdl libdl.so.2 483 libcrypt libcrypt.so.1 484 libz libz.so.1 485 libncurses libncurses.so.5 486 libutil libutil.so.1 487 libpthread libpthread.so.0 488 libpam libpam.so.0 489 libgcc_s libgcc_s.so.1 490 491 Table 3-2. Standard Library Names defined in the Architecture 492 Specific Supplement 493 Library Runtime Name 494 libm See archLSB 495 libc See archLSB 496 proginterp See archLSB 497 498 These libraries will be in an implementation-defined directory 499 which the dynamic linker shall search by default. 500 _________________________________________________________ 501 502 3.2. LSB Implementation Conformance 503 504 A conforming implementation shall satisfy the following 505 requirements: 506 507 * The implementation shall implement fully the architecture 508 described in the hardware manual for the target processor 509 architecture. 510 * The implementation shall be capable of executing compiled 511 applications having the format and using the system 512 interfaces described in this document. 513 * The implementation shall provide libraries containing the 514 interfaces specified by this document, and shall provide a 515 dynamic linking mechanism that allows these interfaces to 516 be attached to applications at runtime. All the interfaces 517 shall behave as specified in this document. 518 * The map of virtual memory provided by the implementation 519 shall conform to the requirements of this document. 520 * The implementation's low-level behavior with respect to 521 function call linkage, system traps, signals, and other 522 such activities shall conform to the formats described in 523 this document. 524 * The implementation shall provide all of the mandatory 525 interfaces in their entirety. 526 * The implementation may provide one or more of the optional 527 interfaces. Each optional interface that is provided shall 528 be provided in its entirety. The product documentation 529 shall state which optional interfaces are provided. 530 * The implementation shall provide all files and utilities 531 specified as part of this document in the format defined 532 here and in other referenced documents. All commands and 533 utilities shall behave as required by this document. The 534 implementation shall also provide all mandatory components 535 of an application's runtime environment that are included 536 or referenced in this document. 537 * The implementation, when provided with standard data 538 formats and values at a named interface, shall provide the 539 behavior defined for those values and data formats at that 540 interface. However, a conforming implementation may 541 consist of components which are separately packaged and/or 542 sold. For example, a vendor of a conforming implementation 543 might sell the hardware, operating system, and windowing 544 system as separately packaged items. 545 * The implementation may provide additional interfaces with 546 different names. It may also provide additional behavior 547 corresponding to data values outside the standard ranges, 548 for standard named interfaces. 549 _________________________________________________________ 550 551 3.3. LSB Application Conformance 552 553 A conforming application shall satisfy the following 554 requirements: 555 556 * Its executable files are either shell scripts or object 557 files in the format defined for the Object File Format 558 system interface. 559 * Its object files participate in dynamic linking as defined 560 in the Program Loading and Linking System interface. 561 * It employs only the instructions, traps, and other 562 low-level facilities defined in the Low-Level System 563 interface as being for use by applications. 564 * If it requires any optional interface defined in this 565 document in order to be installed or to execute 566 successfully, the requirement for that optional interface 567 is stated in the application's documentation. 568 * It does not use any interface or data format that is not 569 required to be provided by a conforming implementation, 570 unless: 571 + If such an interface or data format is supplied by 572 another application through direct invocation of that 573 application during execution, that application is in 574 turn an LSB conforming application. 575 + The use of that interface or data format, as well as 576 its source, is identified in the documentation of the 577 application. 578 * It shall not use any values for a named interface that are 579 reserved for vendor extensions. 580 581 A strictly conforming application does not require or use any 582 interface, facility, or implementation-defined extension that 583 is not defined in this document in order to be installed or to 584 execute successfully. 585 _________________________________________________________ 586 587 Chapter 4. Definitions 588 589 For the purposes of this document, the following definitions, 590 as specified in the ISO/IEC Directives, Part 2, 2001, 4th 591 Edition, apply: 592 593 can 594 be able to; there is a possibility of; it is possible 595 to 596 597 cannot 598 be unable to; there is no possibilty of; it is not 599 possible to 600 601 may 602 is permitted; is allowed; is permissible 603 604 need not 605 it is not required that; no...is required 606 607 shall 608 is to; is required to; it is required that; has to; 609 only...is permitted; it is necessary 610 611 shall not 612 is not allowed [permitted] [acceptable] [permissible]; 613 is required to be not; is required that...be not; is 614 not to be 615 616 should 617 it is recommended that; ought to 618 619 should not 620 it is not recommended that; ought not to 621 _________________________________________________________ 622 623 Chapter 5. Terminology 624 625 For the purposes of this document, the following terms apply: 626 627 archLSB 628 The architectural part of the LSB Specification which 629 describes the specific parts of the interface that are 630 platform specific. The archLSB is complementary to the 631 gLSB. 632 633 Binary Standard 634 The total set of interfaces that are available to be 635 used in the compiled binary code of a conforming 636 application. 637 638 gLSB 639 The common part of the LSB Specification that describes 640 those parts of the interface that remain constant 641 across all hardware implementations of the LSB. 642 643 implementation-defined 644 Describes a value or behavior that is not defined by 645 this document but is selected by an implementor. The 646 value or behavior may vary among implementations that 647 conform to this document. An application should not 648 rely on the existence of the value or behavior. An 649 application that relies on such a value or behavior 650 cannot be assured to be portable across conforming 651 implementations. The implementor shall document such a 652 value or behavior so that it can be used correctly by 653 an application. 654 655 Shell Script 656 A file that is read by an interpreter (e.g., awk). The 657 first line of the shell script includes a reference to 658 its interpreter binary. 659 660 Source Standard 661 The set of interfaces that are available to be used in 662 the source code of a conforming application. 663 664 undefined 665 Describes the nature of a value or behavior not defined 666 by this document which results from use of an invalid 667 program construct or invalid data input. The value or 668 behavior may vary among implementations that conform to 669 this document. An application should not rely on the 670 existence or validity of the value or behavior. An 671 application that relies on any particular value or 672 behavior cannot be assured to be portable across 673 conforming implementations. 674 675 unspecified 676 Describes the nature of a value or behavior not 677 specified by this document which results from use of a 678 valid program construct or valid data input. The value 679 or behavior may vary among implementations that conform 680 to this document. An application should not rely on the 681 existence or validity of the value or behavior. An 682 application that relies on any particular value or 683 behavior cannot be assured to be portable across 684 conforming implementations. 685 686 Other terms and definitions used in this document shall have 687 the same meaning as defined in Chapter 3 of the Base 688 Definitions volume of ISO POSIX (2003). 689 _________________________________________________________ 690 691 Chapter 6. Documentation Conventions 692 693 Throughout this document, the following typographic 694 conventions are used: 695 696 function() 697 the name of a function 698 699 command 700 the name of a command or utility 701 702 CONSTANT 703 a constant value 704 705 parameter 706 a parameter 707 708 variable 709 a variable 710 711 Throughout this specification, several tables of interfaces 712 are presented. Each entry in these tables has the following 713 format: 714 715 name 716 the name of the interface 717 718 (symver) 719 An optional symbol version identifier, if required. 720 721 [refno] 722 A reference number indexing the table of referenced 723 specifications that follows this table. 724 725 For example, 726 727 forkpty(GLIBC_2.0) [1] 728 729 refers to the interface named forkpty() with symbol version 730 GLIBC_2.0 that is defined in the first of the listed 731 references below the table. 732 _________________________________________________________ 733 734 Chapter 7. Relationship To ISO/IEC 9945 POSIX 735 736 This specification includes many interfaces described in ISO 737 POSIX (2003). Unless otherwise specified, such interfaces 738 should behave exactly as described in that specification. Any 739 conflict between the requirements described here and the ISO 740 POSIX (2003) standard is unintentional, except as explicitly 741 noted otherwise. 742 743 Note: In addition to the differences noted inline in this 744 specification, PDTR 24715 has extracted the differences 745 between this specification and ISO POSIX (2003) into a 746 single place. It is the long term plan of the LSB to 747 converge with ISO/IEC 9945 POSIX. 748 749 The LSB Specification Authority is responsible for deciding 750 the meaning of conformance to normative referenced standards 751 in the LSB context. Problem Reports regarding underlying or 752 referenced standards in any other context will be referred to 753 the relevant maintenance body for that standard. 754 755 II. Base Libraries 756 757 Table of Contents 758 8. Libraries 759 _________________________________________________________ 760 761 Chapter 8. Libraries 762 763 8.1. Introduction 764 765 An LSB-conforming implementation shall support the following 766 base libraries which provide interfaces for accessing the 767 operating system, processor and other hardware in the system. 768 769 * libc 770 * libm 771 * libgcc_s 772 * libdl 773 * libcrypt 774 * libpam 775 _________________________________________________________ 776 777 8.2. Program Interpreter 778 779 The Program Interpreter is specified in the appropriate 780 architecture-specific LSB specification. 781 _________________________________________________________ 782 783 8.3. Interfaces for libc 784 785 Table 8-1 defines the library name and shared object name for 786 the libc library 787 788 Table 8-1. libc Definition 789 Library: libc 790 SONAME: See archLSB. 791 792 The behavior of the interfaces in this library is specified by 793 the following specifications: 794 795 Large File Support 796 this specification 797 SUSv2 798 ISO POSIX (2003) 799 SVID Issue 3 800 SVID Issue 4 801 _________________________________________________________ 802 803 8.3.1. RPC 804 _________________________________________________________ 805 806 8.3.1.1. Interfaces for RPC 807 808 An LSB conforming implementation shall provide the generic 809 functions for RPC specified in Table 8-2, with the full 810 mandatory functionality as described in the referenced 811 underlying specification. 812 813 Table 8-2. libc - RPC Function Interfaces 814 authnone_create [1] svc_getreqset [2] svcudp_create [3] 815 xdr_int [2] xdr_u_long [2] 816 clnt_create [1] svc_register [3] xdr_accepted_reply [2] 817 xdr_long [2] xdr_u_short [2] 818 clnt_pcreateerror [1] svc_run [3] xdr_array [2] xdr_opaque [2] 819 xdr_union [2] 820 clnt_perrno [1] svc_sendreply [3] xdr_bool [2] xdr_opaque_auth 821 [2] xdr_vector [2] 822 clnt_perror [1] svcerr_auth [2] xdr_bytes [2] xdr_pointer [2] 823 xdr_void [2] 824 clnt_spcreateerror [1] svcerr_decode [2] xdr_callhdr [2] 825 xdr_reference [2] xdr_wrapstring [2] 826 clnt_sperrno [1] svcerr_noproc [2] xdr_callmsg [2] 827 xdr_rejected_reply [2] xdrmem_create [2] 828 clnt_sperror [1] svcerr_noprog [2] xdr_char [2] xdr_replymsg 829 [2] xdrrec_create [2] 830 key_decryptsession [2] svcerr_progvers [2] xdr_double [2] 831 xdr_short [2] xdrrec_eof [2] 832 pmap_getport [3] svcerr_systemerr [2] xdr_enum [2] xdr_string 833 [2] 834 pmap_set [3] svcerr_weakauth [2] xdr_float [2] xdr_u_char [2] 835 836 pmap_unset [3] svctcp_create [3] xdr_free [2] xdr_u_int [3] 837 838 Referenced Specification(s) 839 840 [1]. SVID Issue 4 841 842 [2]. SVID Issue 3 843 844 [3]. this specification 845 _________________________________________________________ 846 847 8.3.2. System Calls 848 _________________________________________________________ 849 850 8.3.2.1. Interfaces for System Calls 851 852 An LSB conforming implementation shall provide the generic 853 functions for System Calls specified in Table 8-3, with the 854 full mandatory functionality as described in the referenced 855 underlying specification. 856 857 Table 8-3. libc - System Calls Function Interfaces 858 __fxstat [1] fchmod [2] getwd [2] read [2] setrlimit [2] 859 __getpgid [1] fchown [2] initgroups [1] readdir [2] 860 setrlimit64 [3] 861 __lxstat [1] fcntl [1] ioctl [1] readdir_r [2] setsid [2] 862 __xmknod [1] fdatasync [2] kill [1] readlink [2] setuid [2] 863 __xstat [1] flock [1] killpg [2] readv [2] sleep [2] 864 access [2] fork [2] lchown [2] rename [2] statvfs [2] 865 acct [1] fstatvfs [2] link [1] rmdir [2] stime [1] 866 alarm [2] fsync [2] lockf [2] sbrk [4] symlink [2] 867 brk [4] ftime [2] lseek [2] sched_get_priority_max [2] sync 868 [2] 869 chdir [2] ftruncate [2] mkdir [2] sched_get_priority_min [2] 870 sysconf [2] 871 chmod [2] getcontext [2] mkfifo [2] sched_getparam [2] time 872 [2] 873 chown [2] getegid [2] mlock [2] sched_getscheduler [2] times 874 [2] 875 chroot [4] geteuid [2] mlockall [2] sched_rr_get_interval [2] 876 truncate [2] 877 clock [2] getgid [2] mmap [2] sched_setparam [2] ulimit [2] 878 close [2] getgroups [2] mprotect [2] sched_setscheduler [2] 879 umask [2] 880 closedir [2] getitimer [2] msync [2] sched_yield [2] uname [2] 881 creat [2] getloadavg [1] munlock [2] select [2] unlink [1] 882 dup [2] getpagesize [4] munlockall [2] setcontext [2] utime 883 [2] 884 dup2 [2] getpgid [2] munmap [2] setegid [2] utimes [2] 885 execl [2] getpgrp [2] nanosleep [2] seteuid [2] vfork [2] 886 execle [2] getpid [2] nice [2] setgid [2] wait [2] 887 execlp [2] getppid [2] open [2] setitimer [2] wait4 [1] 888 execv [2] getpriority [2] opendir [2] setpgid [2] waitpid [1] 889 execve [2] getrlimit [2] pathconf [2] setpgrp [2] write [2] 890 execvp [2] getrusage [2] pause [2] setpriority [2] writev [2] 891 exit [2] getsid [2] pipe [2] setregid [2] 892 fchdir [2] getuid [2] poll [2] setreuid [2] 893 894 Referenced Specification(s) 895 896 [1]. this specification 897 898 [2]. ISO POSIX (2003) 899 900 [3]. Large File Support 901 902 [4]. SUSv2 903 _________________________________________________________ 904 905 8.3.3. Standard I/O 906 _________________________________________________________ 907 908 8.3.3.1. Interfaces for Standard I/O 909 910 An LSB conforming implementation shall provide the generic 911 functions for Standard I/O specified in Table 8-4, with the 912 full mandatory functionality as described in the referenced 913 underlying specification. 914 915 Table 8-4. libc - Standard I/O Function Interfaces 916 _IO_feof [1] fgetpos [2] fsetpos [2] putchar [2] sscanf [1] 917 _IO_getc [1] fgets [2] ftell [2] putchar_unlocked [2] telldir 918 [2] 919 _IO_putc [1] fgetwc_unlocked [1] ftello [2] puts [2] tempnam 920 [2] 921 _IO_puts [1] fileno [2] fwrite [2] putw [3] ungetc [2] 922 asprintf [1] flockfile [2] getc [2] remove [2] vasprintf [1] 923 clearerr [2] fopen [2] getc_unlocked [2] rewind [2] vdprintf 924 [1] 925 ctermid [2] fprintf [2] getchar [2] rewinddir [2] vfprintf [2] 926 fclose [2] fputc [2] getchar_unlocked [2] scanf [1] vprintf 927 [2] 928 fdopen [2] fputs [2] getw [3] seekdir [2] vsnprintf [2] 929 feof [2] fread [2] pclose [2] setbuf [2] vsprintf [2] 930 ferror [2] freopen [2] popen [2] setbuffer [1] 931 fflush [2] fscanf [1] printf [2] setvbuf [2] 932 fflush_unlocked [1] fseek [2] putc [2] snprintf [2] 933 fgetc [2] fseeko [2] putc_unlocked [2] sprintf [2] 934 935 Referenced Specification(s) 936 937 [1]. this specification 938 939 [2]. ISO POSIX (2003) 940 941 [3]. SUSv2 942 943 An LSB conforming implementation shall provide the generic 944 data interfaces for Standard I/O specified in Table 8-5, with 945 the full mandatory functionality as described in the 946 referenced underlying specification. 947 948 Table 8-5. libc - Standard I/O Data Interfaces 949 stderr [1] stdin [1] stdout [1] 950 951 Referenced Specification(s) 952 953 [1]. ISO POSIX (2003) 954 _________________________________________________________ 955 956 8.3.4. Signal Handling 957 _________________________________________________________ 958 959 8.3.4.1. Interfaces for Signal Handling 960 961 An LSB conforming implementation shall provide the generic 962 functions for Signal Handling specified in Table 8-6, with the 963 full mandatory functionality as described in the referenced 964 underlying specification. 965 966 Table 8-6. libc - Signal Handling Function Interfaces 967 __libc_current_sigrtmax [1] sigaction [2] sighold [2] sigorset 968 [1] sigset [2] 969 __libc_current_sigrtmin [1] sigaddset [2] sigignore [2] 970 sigpause [2] sigsuspend [2] 971 __sigsetjmp [1] sigaltstack [2] siginterrupt [2] sigpending 972 [2] sigtimedwait [2] 973 __sysv_signal [1] sigandset [1] sigisemptyset [1] sigprocmask 974 [2] sigwait [2] 975 bsd_signal [2] sigdelset [2] sigismember [2] sigqueue [2] 976 sigwaitinfo [2] 977 psignal [1] sigemptyset [2] siglongjmp [2] sigrelse [2] 978 raise [2] sigfillset [2] signal [2] sigreturn [1] 979 980 Referenced Specification(s) 981 982 [1]. this specification 983 984 [2]. ISO POSIX (2003) 985 986 An LSB conforming implementation shall provide the generic 987 data interfaces for Signal Handling specified in Table 8-7, 988 with the full mandatory functionality as described in the 989 referenced underlying specification. 990 991 Table 8-7. libc - Signal Handling Data Interfaces 992 _sys_siglist [1] 993 994 Referenced Specification(s) 995 996 [1]. this specification 997 _________________________________________________________ 998 999 8.3.5. Localization Functions 1000 _________________________________________________________ 1001 1002 8.3.5.1. Interfaces for Localization Functions 1003 1004 An LSB conforming implementation shall provide the generic 1005 functions for Localization Functions specified in Table 8-8, 1006 with the full mandatory functionality as described in the 1007 referenced underlying specification. 1008 1009 Table 8-8. libc - Localization Functions Function Interfaces 1010 bind_textdomain_codeset [1] dcgettext [1] 1011 freelocale(GLIBC_2.3) [1] localeconv [2] textdomain [1] 1012 bindtextdomain [1] dcngettext [1] gettext [1] 1013 newlocale(GLIBC_2.3) [1] uselocale(GLIBC_2.3) [1] 1014 catclose [2] dgettext [1] iconv [2] ngettext [1] 1015 catgets [2] dngettext [1] iconv_close [2] nl_langinfo [2] 1016 catopen [2] duplocale(GLIBC_2.3) [1] iconv_open [2] setlocale 1017 [2] 1018 1019 Referenced Specification(s) 1020 1021 [1]. this specification 1022 1023 [2]. ISO POSIX (2003) 1024 1025 An LSB conforming implementation shall provide the generic 1026 data interfaces for Localization Functions specified in Table 1027 8-9, with the full mandatory functionality as described in the 1028 referenced underlying specification. 1029 1030 Table 8-9. libc - Localization Functions Data Interfaces 1031 _nl_msg_cat_cntr [1] 1032 1033 Referenced Specification(s) 1034 1035 [1]. this specification 1036 _________________________________________________________ 1037 1038 8.3.6. Socket Interface 1039 _________________________________________________________ 1040 1041 8.3.6.1. Interfaces for Socket Interface 1042 1043 An LSB conforming implementation shall provide the generic 1044 functions for Socket Interface specified in Table 8-10, with 1045 the full mandatory functionality as described in the 1046 referenced underlying specification. 1047 1048 Table 8-10. libc - Socket Interface Function Interfaces 1049 __h_errno_location [1] gethostname [2] if_nameindex [2] send 1050 [2] socket [2] 1051 accept [2] getpeername [2] if_nametoindex [2] sendmsg [2] 1052 socketpair [2] 1053 bind [2] getsockname [2] listen [2] sendto [2] 1054 bindresvport [1] getsockopt [1] recv [2] setsockopt [1] 1055 connect [2] if_freenameindex [2] recvfrom [2] shutdown [2] 1056 gethostid [2] if_indextoname [2] recvmsg [2] sockatmark [2] 1057 1058 Referenced Specification(s) 1059 1060 [1]. this specification 1061 1062 [2]. ISO POSIX (2003) 1063 _________________________________________________________ 1064 1065 8.3.7. Wide Characters 1066 _________________________________________________________ 1067 1068 8.3.7.1. Interfaces for Wide Characters 1069 1070 An LSB conforming implementation shall provide the generic 1071 functions for Wide Characters specified in Table 8-11, with 1072 the full mandatory functionality as described in the 1073 referenced underlying specification. 1074 1075 Table 8-11. libc - Wide Characters Function Interfaces 1076 __wcstod_internal [1] mbsinit [2] vwscanf [1] wcsnlen [1] 1077 wcstoumax [2] 1078 __wcstof_internal [1] mbsnrtowcs [1] wcpcpy [1] wcsnrtombs [1] 1079 wcstouq [1] 1080 __wcstol_internal [1] mbsrtowcs [2] wcpncpy [1] wcspbrk [2] 1081 wcswcs [2] 1082 __wcstold_internal [1] mbstowcs [2] wcrtomb [2] wcsrchr [2] 1083 wcswidth [2] 1084 __wcstoul_internal [1] mbtowc [2] wcscasecmp [1] wcsrtombs [2] 1085 wcsxfrm [2] 1086 btowc [2] putwc [2] wcscat [2] wcsspn [2] wctob [2] 1087 fgetwc [2] putwchar [2] wcschr [2] wcsstr [2] wctomb [2] 1088 fgetws [2] swprintf [2] wcscmp [2] wcstod [2] wctrans [2] 1089 fputwc [2] swscanf [1] wcscoll [2] wcstof [2] wctype [2] 1090 fputws [2] towctrans [2] wcscpy [2] wcstoimax [2] wcwidth [2] 1091 fwide [2] towlower [2] wcscspn [2] wcstok [2] wmemchr [2] 1092 fwprintf [2] towupper [2] wcsdup [1] wcstol [2] wmemcmp [2] 1093 fwscanf [1] ungetwc [2] wcsftime [2] wcstold [2] wmemcpy [2] 1094 getwc [2] vfwprintf [2] wcslen [2] wcstoll [2] wmemmove [2] 1095 getwchar [2] vfwscanf [1] wcsncasecmp [1] wcstombs [2] wmemset 1096 [2] 1097 mblen [2] vswprintf [2] wcsncat [2] wcstoq [1] wprintf [2] 1098 mbrlen [2] vswscanf [1] wcsncmp [2] wcstoul [2] wscanf [1] 1099 mbrtowc [2] vwprintf [2] wcsncpy [2] wcstoull [2] 1100 1101 Referenced Specification(s) 1102 1103 [1]. this specification 1104 1105 [2]. ISO POSIX (2003) 1106 _________________________________________________________ 1107 1108 8.3.8. String Functions 1109 _________________________________________________________ 1110 1111 8.3.8.1. Interfaces for String Functions 1112 1113 An LSB conforming implementation shall provide the generic 1114 functions for String Functions specified in Table 8-12, with 1115 the full mandatory functionality as described in the 1116 referenced underlying specification. 1117 1118 Table 8-12. libc - String Functions Function Interfaces 1119 __mempcpy [1] bzero [2] strcasestr [1] strncat [2] strtok [2] 1120 __rawmemchr [1] ffs [2] strcat [2] strncmp [2] strtok_r [2] 1121 __stpcpy [1] index [2] strchr [2] strncpy [2] strtold [2] 1122 __strdup [1] memccpy [2] strcmp [2] strndup [1] strtoll [2] 1123 __strtod_internal [1] memchr [2] strcoll [2] strnlen [1] 1124 strtoq [1] 1125 __strtof_internal [1] memcmp [2] strcpy [2] strpbrk [2] 1126 strtoull [2] 1127 __strtok_r [1] memcpy [2] strcspn [2] strptime [1] strtoumax 1128 [2] 1129 __strtol_internal [1] memmove [2] strdup [2] strrchr [2] 1130 strtouq [1] 1131 __strtold_internal [1] memrchr [1] strerror [2] strsep [1] 1132 strxfrm [2] 1133 __strtoll_internal [1] memset [2] strerror_r [1] strsignal [1] 1134 swab [2] 1135 __strtoul_internal [1] rindex [2] strfmon [2] strspn [2] 1136 __strtoull_internal [1] stpcpy [1] strftime [2] strstr [2] 1137 bcmp [2] stpncpy [1] strlen [2] strtof [2] 1138 bcopy [2] strcasecmp [2] strncasecmp [2] strtoimax [2] 1139 1140 Referenced Specification(s) 1141 1142 [1]. this specification 1143 1144 [2]. ISO POSIX (2003) 1145 _________________________________________________________ 1146 1147 8.3.9. IPC Functions 1148 _________________________________________________________ 1149 1150 8.3.9.1. Interfaces for IPC Functions 1151 1152 An LSB conforming implementation shall provide the generic 1153 functions for IPC Functions specified in Table 8-13, with the 1154 full mandatory functionality as described in the referenced 1155 underlying specification. 1156 1157 Table 8-13. libc - IPC Functions Function Interfaces 1158 ftok [1] msgrcv [1] semget [1] shmctl [1] 1159 msgctl [1] msgsnd [1] semop [1] shmdt [1] 1160 msgget [1] semctl [1] shmat [1] shmget [1] 1161 1162 Referenced Specification(s) 1163 1164 [1]. ISO POSIX (2003) 1165 _________________________________________________________ 1166 1167 8.3.10. Regular Expressions 1168 _________________________________________________________ 1169 1170 8.3.10.1. Interfaces for Regular Expressions 1171 1172 An LSB conforming implementation shall provide the generic 1173 functions for Regular Expressions specified in Table 8-14, 1174 with the full mandatory functionality as described in the 1175 referenced underlying specification. 1176 1177 Table 8-14. libc - Regular Expressions Function Interfaces 1178 regcomp [1] regerror [1] regexec [2] regfree [1] 1179 1180 Referenced Specification(s) 1181 1182 [1]. ISO POSIX (2003) 1183 1184 [2]. this specification 1185 _________________________________________________________ 1186 1187 8.3.11. Character Type Functions 1188 _________________________________________________________ 1189 1190 8.3.11.1. Interfaces for Character Type Functions 1191 1192 An LSB conforming implementation shall provide the generic 1193 functions for Character Type Functions specified in Table 1194 8-15, with the full mandatory functionality as described in 1195 the referenced underlying specification. 1196 1197 Table 8-15. libc - Character Type Functions Function 1198 Interfaces 1199 __ctype_b_loc(GLIBC_2.3) [1] isalpha [2] ispunct [2] iswctype 1200 [2] iswupper [2] 1201 __ctype_get_mb_cur_max [1] isascii [2] isspace [2] iswdigit 1202 [2] iswxdigit [2] 1203 __ctype_tolower_loc(GLIBC_2.3) [1] iscntrl [2] isupper [2] 1204 iswgraph [2] isxdigit [2] 1205 __ctype_toupper_loc(GLIBC_2.3) [1] isdigit [2] iswalnum [2] 1206 iswlower [2] toascii [2] 1207 _tolower [2] isgraph [2] iswalpha [2] iswprint [2] tolower [2] 1208 _toupper [2] islower [2] iswblank [2] iswpunct [2] toupper [2] 1209 isalnum [2] isprint [2] iswcntrl [2] iswspace [2] 1210 1211 Referenced Specification(s) 1212 1213 [1]. this specification 1214 1215 [2]. ISO POSIX (2003) 1216 _________________________________________________________ 1217 1218 8.3.12. Time Manipulation 1219 _________________________________________________________ 1220 1221 8.3.12.1. Interfaces for Time Manipulation 1222 1223 An LSB conforming implementation shall provide the generic 1224 functions for Time Manipulation specified in Table 8-16, with 1225 the full mandatory functionality as described in the 1226 referenced underlying specification. 1227 1228 Table 8-16. libc - Time Manipulation Function Interfaces 1229 adjtime [1] ctime [2] gmtime [2] localtime_r [2] ualarm [2] 1230 asctime [2] ctime_r [2] gmtime_r [2] mktime [2] 1231 asctime_r [2] difftime [2] localtime [2] tzset [2] 1232 1233 Referenced Specification(s) 1234 1235 [1]. this specification 1236 1237 [2]. ISO POSIX (2003) 1238 1239 An LSB conforming implementation shall provide the generic 1240 data interfaces for Time Manipulation specified in Table 8-17, 1241 with the full mandatory functionality as described in the 1242 referenced underlying specification. 1243 1244 Table 8-17. libc - Time Manipulation Data Interfaces 1245 __daylight [1] __tzname [1] timezone [2] 1246 __timezone [1] daylight [2] tzname [2] 1247 1248 Referenced Specification(s) 1249 1250 [1]. this specification 1251 1252 [2]. ISO POSIX (2003) 1253 _________________________________________________________ 1254 1255 8.3.13. Terminal Interface Functions 1256 _________________________________________________________ 1257 1258 8.3.13.1. Interfaces for Terminal Interface Functions 1259 1260 An LSB conforming implementation shall provide the generic 1261 functions for Terminal Interface Functions specified in Table 1262 8-18, with the full mandatory functionality as described in 1263 the referenced underlying specification. 1264 1265 Table 8-18. libc - Terminal Interface Functions Function 1266 Interfaces 1267 cfgetispeed [1] cfsetispeed [1] tcdrain [1] tcgetattr [1] 1268 tcsendbreak [1] 1269 cfgetospeed [1] cfsetospeed [1] tcflow [1] tcgetpgrp [1] 1270 tcsetattr [1] 1271 cfmakeraw [2] cfsetspeed [2] tcflush [1] tcgetsid [1] 1272 tcsetpgrp [1] 1273 1274 Referenced Specification(s) 1275 1276 [1]. ISO POSIX (2003) 1277 1278 [2]. this specification 1279 _________________________________________________________ 1280 1281 8.3.14. System Database Interface 1282 _________________________________________________________ 1283 1284 8.3.14.1. Interfaces for System Database Interface 1285 1286 An LSB conforming implementation shall provide the generic 1287 functions for System Database Interface specified in Table 1288 8-19, with the full mandatory functionality as described in 1289 the referenced underlying specification. 1290 1291 Table 8-19. libc - System Database Interface Function 1292 Interfaces 1293 endgrent [1] getgrgid_r [1] getprotoent [1] getservent [1] 1294 setgroups [2] 1295 endprotoent [1] getgrnam [1] getpwent [1] getutent [2] 1296 setprotoent [1] 1297 endpwent [1] getgrnam_r [1] getpwnam [1] getutent_r [2] 1298 setpwent [1] 1299 endservent [1] getgrouplist [2] getpwnam_r [1] getutxent [1] 1300 setservent [1] 1301 endutent [3] gethostbyaddr [1] getpwuid [1] getutxid [1] 1302 setutent [2] 1303 endutxent [1] gethostbyname [1] getpwuid_r [1] getutxline [1] 1304 setutxent [1] 1305 getgrent [1] getprotobyname [1] getservbyname [1] pututxline 1306 [1] utmpname [2] 1307 getgrgid [1] getprotobynumber [1] getservbyport [1] setgrent 1308 [1] 1309 1310 Referenced Specification(s) 1311 1312 [1]. ISO POSIX (2003) 1313 1314 [2]. this specification 1315 1316 [3]. SUSv2 1317 _________________________________________________________ 1318 1319 8.3.15. Language Support 1320 _________________________________________________________ 1321 1322 8.3.15.1. Interfaces for Language Support 1323 1324 An LSB conforming implementation shall provide the generic 1325 functions for Language Support specified in Table 8-20, with 1326 the full mandatory functionality as described in the 1327 referenced underlying specification. 1328 1329 Table 8-20. libc - Language Support Function Interfaces 1330 __libc_start_main [1] __register_atfork(GLIBC_2.3.2) [1] 1331 1332 Referenced Specification(s) 1333 1334 [1]. this specification 1335 _________________________________________________________ 1336 1337 8.3.16. Large File Support 1338 _________________________________________________________ 1339 1340 8.3.16.1. Interfaces for Large File Support 1341 1342 An LSB conforming implementation shall provide the generic 1343 functions for Large File Support specified in Table 8-21, with 1344 the full mandatory functionality as described in the 1345 referenced underlying specification. 1346 1347 Table 8-21. libc - Large File Support Function Interfaces 1348 __fxstat64 [1] fopen64 [2] ftello64 [2] lseek64 [2] readdir64 1349 [2] 1350 __lxstat64 [1] freopen64 [2] ftruncate64 [2] mkstemp64 [2] 1351 statvfs64 [2] 1352 __xstat64 [1] fseeko64 [2] ftw64 [2] mmap64 [2] tmpfile64 [2] 1353 creat64 [2] fsetpos64 [2] getrlimit64 [2] nftw64 [2] 1354 truncate64 [2] 1355 fgetpos64 [2] fstatvfs64 [2] lockf64 [2] open64 [2] 1356 1357 Referenced Specification(s) 1358 1359 [1]. this specification 1360 1361 [2]. Large File Support 1362 _________________________________________________________ 1363 1364 8.3.17. Standard Library 1365 _________________________________________________________ 1366 1367 8.3.17.1. Interfaces for Standard Library 1368 1369 An LSB conforming implementation shall provide the generic 1370 functions for Standard Library specified in Table 8-22, with 1371 the full mandatory functionality as described in the 1372 referenced underlying specification. 1373 1374 Table 8-22. libc - Standard Library Function Interfaces 1375 _Exit [1] dirname [1] glob [1] lsearch [1] srand48 [1] 1376 __assert_fail [2] div [1] glob64 [2] makecontext [1] srandom 1377 [1] 1378 __cxa_atexit [2] drand48 [1] globfree [1] malloc [1] strtod 1379 [1] 1380 __errno_location [2] ecvt [1] globfree64 [2] memmem [2] strtol 1381 [1] 1382 __fpending [2] erand48 [1] grantpt [1] mkstemp [1] strtoul [1] 1383 __getpagesize [2] err [2] hcreate [1] mktemp [1] swapcontext 1384 [1] 1385 __isinf [2] error [2] hdestroy [1] mrand48 [1] syslog [1] 1386 __isinff [2] errx [2] hsearch [1] nftw [1] system [2] 1387 __isinfl [2] fcvt [1] htonl [1] nrand48 [1] tdelete [1] 1388 __isnan [2] fmtmsg [1] htons [1] ntohl [1] tfind [1] 1389 __isnanf [2] fnmatch [1] imaxabs [1] ntohs [1] tmpfile [1] 1390 __isnanl [2] fpathconf [1] imaxdiv [1] openlog [1] tmpnam [1] 1391 __sysconf [2] free [1] inet_addr [1] perror [1] tsearch [1] 1392 _exit [1] freeaddrinfo [1] inet_ntoa [1] posix_memalign [1] 1393 ttyname [1] 1394 _longjmp [1] ftrylockfile [1] inet_ntop [1] posix_openpt [1] 1395 ttyname_r [1] 1396 _setjmp [1] ftw [1] inet_pton [1] ptsname [1] twalk [1] 1397 a64l [1] funlockfile [1] initstate [1] putenv [1] unlockpt [1] 1398 abort [1] gai_strerror [1] insque [1] qsort [1] unsetenv [1] 1399 abs [1] gcvt [1] isatty [1] rand [1] usleep [1] 1400 atof [1] getaddrinfo [1] isblank [1] rand_r [1] verrx [2] 1401 atoi [1] getcwd [1] jrand48 [1] random [1] vfscanf [2] 1402 atol [1] getdate [1] l64a [1] realloc [1] vscanf [2] 1403 atoll [1] getenv [1] labs [1] realpath [1] vsscanf [2] 1404 basename [1] getlogin [1] lcong48 [1] remque [1] vsyslog [2] 1405 bsearch [1] getnameinfo [1] ldiv [1] seed48 [1] warn [2] 1406 calloc [1] getopt [2] lfind [1] setenv [1] warnx [2] 1407 closelog [1] getopt_long [2] llabs [1] sethostname [2] wordexp 1408 [1] 1409 confstr [1] getopt_long_only [2] lldiv [1] setlogmask [1] 1410 wordfree [1] 1411 cuserid [3] getsubopt [1] longjmp [1] setstate [1] 1412 daemon [2] gettimeofday [1] lrand48 [1] srand [1] 1413 1414 Referenced Specification(s) 1415 1416 [1]. ISO POSIX (2003) 1417 1418 [2]. this specification 1419 1420 [3]. SUSv2 1421 1422 An LSB conforming implementation shall provide the generic 1423 data interfaces for Standard Library specified in Table 8-23, 1424 with the full mandatory functionality as described in the 1425 referenced underlying specification. 1426 1427 Table 8-23. libc - Standard Library Data Interfaces 1428 __environ [1] _sys_errlist [1] getdate_err [2] opterr [2] 1429 optopt [2] 1430 _environ [1] environ [2] optarg [2] optind [2] 1431 1432 Referenced Specification(s) 1433 1434 [1]. this specification 1435 1436 [2]. ISO POSIX (2003) 1437 _________________________________________________________ 1438 1439 8.4. Data Definitions for libc 1440 1441 This section defines global identifiers and their values that 1442 are associated with interfaces contained in libc. These 1443 definitions are organized into groups that correspond to 1444 system headers. This convention is used as a convenience for 1445 the reader, and does not imply the existence of these headers, 1446 or their content. 1447 1448 These definitions are intended to supplement those provided in 1449 the referenced underlying specifications. 1450 1451 This specification uses ISO/IEC 9899 C Language as the 1452 reference programming language, and data definitions are 1453 specified in ISO C format. The C language is used here as a 1454 convenient notation. Using a C language description of these 1455 data objects does not preclude their use by other programming 1456 languages. 1457 _________________________________________________________ 1458 1459 8.4.1. ctype.h 1460 1461 enum 1462 { 1463 _ISupper, _ISlower, _ISalpha, _ISdigit, _ISxdigit, _ISspace, _ISprint 1464 , 1465 _ISgraph, _ISblank, _IScntrl, _ISpunct, _ISalnum 1466 } 1467 ; 1468 _________________________________________________________ 1469 1470 8.4.2. dirent.h 1471 1472 typedef struct __dirstream DIR; 1473 1474 struct dirent 1475 { 1476 long int d_ino; 1477 off_t d_off; 1478 unsigned short d_reclen; 1479 unsigned char d_type; 1480 char d_name[256]; 1481 } 1482 ; 1483 struct dirent64 1484 { 1485 uint64_t d_ino; 1486 int64_t d_off; 1487 unsigned short d_reclen; 1488 unsigned char d_type; 1489 char d_name[256]; 1490 } 1491 ; 1492 _________________________________________________________ 1493 1494 8.4.3. errno.h 1495 1496 ISO POSIX (2003) requires that each error value shall be 1497 unique, with permission for EAGAIN and EWOULDBLOCK possibly 1498 having the same value. This specification also requires that 1499 ENOTSUP and EOPNOTSUPP have the same value. 1500 1501 Note: A defect report against ISO POSIX (2003) has been 1502 filed to request that specification also permit these two 1503 symbols to have the same value. 1504 1505 #define errno (*__errno_location()) 1506 1507 #define EPERM 1 1508 #define ECHILD 10 1509 #define ENETDOWN 100 1510 #define ENETUNREACH 101 1511 #define ENETRESET 102 1512 #define ECONNABORTED 103 1513 #define ECONNRESET 104 1514 #define ENOBUFS 105 1515 #define EISCONN 106 1516 #define ENOTCONN 107 1517 #define ESHUTDOWN 108 1518 #define ETOOMANYREFS 109 1519 #define EAGAIN 11 1520 #define ETIMEDOUT 110 1521 #define ECONNREFUSED 111 1522 #define EHOSTDOWN 112 1523 #define EHOSTUNREACH 113 1524 #define EALREADY 114 1525 #define EINPROGRESS 115 1526 #define ESTALE 116 1527 #define EUCLEAN 117 1528 #define ENOTNAM 118 1529 #define ENAVAIL 119 1530 #define ENOMEM 12 1531 #define EISNAM 120 1532 #define EREMOTEIO 121 1533 #define EDQUOT 122 1534 #define ENOMEDIUM 123 1535 #define EMEDIUMTYPE 124 1536 #define ECANCELED 125 1537 #define EACCES 13 1538 #define EFAULT 14 1539 #define ENOTBLK 15 1540 #define EBUSY 16 1541 #define EEXIST 17 1542 #define EXDEV 18 1543 #define ENODEV 19 1544 #define ENOENT 2 1545 #define ENOTDIR 20 1546 #define EISDIR 21 1547 #define EINVAL 22 1548 #define ENFILE 23 1549 #define EMFILE 24 1550 #define ENOTTY 25 1551 #define ETXTBSY 26 1552 #define EFBIG 27 1553 #define ENOSPC 28 1554 #define ESPIPE 29 1555 #define ESRCH 3 1556 #define EROFS 30 1557 #define EMLINK 31 1558 #define EPIPE 32 1559 #define EDOM 33 1560 #define ERANGE 34 1561 #define EDEADLK 35 1562 #define ENAMETOOLONG 36 1563 #define ENOLCK 37 1564 #define ENOSYS 38 1565 #define ENOTEMPTY 39 1566 #define EINTR 4 1567 #define ELOOP 40 1568 #define ENOMSG 42 1569 #define EIDRM 43 1570 #define ECHRNG 44 1571 #define EL2NSYNC 45 1572 #define EL3HLT 46 1573 #define EL3RST 47 1574 #define ELNRNG 48 1575 #define EUNATCH 49 1576 #define EIO 5 1577 #define ENOANO 55 1578 #define EBADRQC 56 1579 #define EBADSLT 57 1580 #define EBFONT 59 1581 #define ENXIO 6 1582 #define ENOSTR 60 1583 #define ENODATA 61 1584 #define ETIME 62 1585 #define ENOSR 63 1586 #define ENONET 64 1587 #define ENOPKG 65 1588 #define EREMOTE 66 1589 #define ENOLINK 67 1590 #define EADV 68 1591 #define ESRMNT 69 1592 #define E2BIG 7 1593 #define ECOMM 70 1594 #define EPROTO 71 1595 #define EMULTIHOP 72 1596 #define EDOTDOT 73 1597 #define EBADMSG 74 1598 #define EOVERFLOW 75 1599 #define ENOTUNIQ 76 1600 #define EBADFD 77 1601 #define EREMCHG 78 1602 #define ELIBACC 79 1603 #define ENOEXEC 8 1604 #define ELIBBAD 80 1605 #define ELIBSCN 81 1606 #define ELIBMAX 82 1607 #define ELIBEXEC 83 1608 #define EILSEQ 84 1609 #define ERESTART 85 1610 #define ESTRPIPE 86 1611 #define EUSERS 87 1612 #define ENOTSOCK 88 1613 #define EDESTADDRREQ 89 1614 #define EBADF 9 1615 #define EMSGSIZE 90 1616 #define EPROTOTYPE 91 1617 #define ENOPROTOOPT 92 1618 #define EPROTONOSUPPORT 93 1619 #define ESOCKTNOSUPPORT 94 1620 #define EOPNOTSUPP 95 1621 #define EPFNOSUPPORT 96 1622 #define EAFNOSUPPORT 97 1623 #define EADDRINUSE 98 1624 #define EADDRNOTAVAIL 99 1625 #define EWOULDBLOCK EAGAIN 1626 #define ENOTSUP EOPNOTSUPP 1627 _________________________________________________________ 1628 1629 8.4.4. fcntl.h 1630 1631 #define O_RDONLY 00 1632 #define O_ACCMODE 0003 1633 #define O_WRONLY 01 1634 #define O_CREAT 0100 1635 #define O_TRUNC 01000 1636 #define O_SYNC 010000 1637 #define O_RDWR 02 1638 #define O_EXCL 0200 1639 #define O_APPEND 02000 1640 #define O_ASYNC 020000 1641 #define O_NOCTTY 0400 1642 #define O_NDELAY 04000 1643 #define O_NONBLOCK 04000 1644 #define FD_CLOEXEC 1 1645 1646 struct flock 1647 { 1648 short l_type; 1649 short l_whence; 1650 off_t l_start; 1651 off_t l_len; 1652 pid_t l_pid; 1653 } 1654 ; 1655 struct flock64 1656 { 1657 short l_type; 1658 short l_whence; 1659 loff_t l_start; 1660 loff_t l_len; 1661 pid_t l_pid; 1662 } 1663 ; 1664 1665 #define F_DUPFD 0 1666 #define F_RDLCK 0 1667 #define F_GETFD 1 1668 #define F_WRLCK 1 1669 #define F_SETFD 2 1670 #define F_UNLCK 2 1671 #define F_GETFL 3 1672 #define F_SETFL 4 1673 #define F_GETLK 5 1674 #define F_SETLK 6 1675 #define F_SETLKW 7 1676 #define F_SETOWN 8 1677 #define F_GETOWN 9 1678 _________________________________________________________ 1679 1680 8.4.5. fmtmsg.h 1681 1682 #define MM_HARD 1 1683 #define MM_NRECOV 128 1684 #define MM_UTIL 16 1685 #define MM_SOFT 2 1686 #define MM_OPSYS 32 1687 #define MM_FIRM 4 1688 #define MM_RECOVER 64 1689 #define MM_APPL 8 1690 1691 #define MM_NOSEV 0 1692 #define MM_HALT 1 1693 #define MM_ERROR 2 1694 1695 #define MM_NULLLBL ((char *) 0) 1696 _________________________________________________________ 1697 1698 8.4.6. fnmatch.h 1699 1700 #define FNM_PATHNAME (1<<0) 1701 #define FNM_NOESCAPE (1<<1) 1702 #define FNM_PERIOD (1<<2) 1703 #define FNM_NOMATCH 1 1704 _________________________________________________________ 1705 1706 8.4.7. ftw.h 1707 1708 #define FTW_D FTW_D 1709 #define FTW_DNR FTW_DNR 1710 #define FTW_DP FTW_DP 1711 #define FTW_F FTW_F 1712 #define FTW_NS FTW_NS 1713 #define FTW_SL FTW_SL 1714 #define FTW_SLN FTW_SLN 1715 1716 enum 1717 { 1718 FTW_F, FTW_D, FTW_DNR, FTW_NS, FTW_SL, FTW_DP, FTW_SLN 1719 } 1720 ; 1721 1722 enum 1723 { 1724 FTW_PHYS, FTW_MOUNT, FTW_CHDIR, FTW_DEPTH 1725 } 1726 ; 1727 1728 struct FTW 1729 { 1730 int base; 1731 int level; 1732 } 1733 ; 1734 1735 typedef int (*__ftw_func_t) (char *__filename, struct stat * __status, 1736 int __flag); 1737 typedef int (*__ftw64_func_t) (char *__filename, struct stat64 * __stat 1738 us, 1739 int __flag); 1740 typedef int (*__nftw_func_t) (char *__filename, struct stat * __status, 1741 int __flag, struct FTW * __info); 1742 typedef int (*__nftw64_func_t) (char *__filename, struct stat64 * __sta 1743 tus, 1744 int __flag, struct FTW * __info); 1745 _________________________________________________________ 1746 1747 8.4.8. getopt.h 1748 1749 #define no_argument 0 1750 #define required_argument 1 1751 #define optional_argument 2 1752 1753 struct option 1754 { 1755 char *name; 1756 int has_arg; 1757 int *flag; 1758 int val; 1759 } 1760 ; 1761 _________________________________________________________ 1762 1763 8.4.9. glob.h 1764 1765 #define GLOB_ERR (1<<0) 1766 #define GLOB_MARK (1<<1) 1767 #define GLOB_BRACE (1<<10) 1768 #define GLOB_NOMAGIC (1<<11) 1769 #define GLOB_TILDE (1<<12) 1770 #define GLOB_ONLYDIR (1<<13) 1771 #define GLOB_TILDE_CHECK (1<<14) 1772 #define GLOB_NOSORT (1<<2) 1773 #define GLOB_DOOFFS (1<<3) 1774 #define GLOB_NOCHECK (1<<4) 1775 #define GLOB_APPEND (1<<5) 1776 #define GLOB_NOESCAPE (1<<6) 1777 #define GLOB_PERIOD (1<<7) 1778 #define GLOB_MAGCHAR (1<<8) 1779 #define GLOB_ALTDIRFUNC (1<<9) 1780 1781 #define GLOB_NOSPACE 1 1782 #define GLOB_ABORTED 2 1783 #define GLOB_NOMATCH 3 1784 #define GLOB_NOSYS 4 1785 1786 typedef struct 1787 { 1788 size_t gl_pathc; 1789 char **gl_pathv; 1790 size_t gl_offs; 1791 int gl_flags; 1792 void (*gl_closedir) (void *); 1793 struct dirent *(*gl_readdir) (void *); 1794 void *(*gl_opendir) (const char *); 1795 int (*gl_lstat) (const char *, struct stat *); 1796 int (*gl_stat) (const char *, struct stat *); 1797 } 1798 glob_t; 1799 1800 typedef struct 1801 { 1802 size_t gl_pathc; 1803 char **gl_pathv; 1804 size_t gl_offs; 1805 int gl_flags; 1806 void (*gl_closedir) (void *); 1807 struct dirent64 *(*gl_readdir64) (void *); 1808 void *(*gl_opendir) (const char *); 1809 int (*gl_lstat) (const char *, struct stat *); 1810 int (*gl_stat) (const char *, struct stat *); 1811 } 1812 glob64_t; 1813 _________________________________________________________ 1814 1815 8.4.10. grp.h 1816 1817 struct group 1818 { 1819 char *gr_name; 1820 char *gr_passwd; 1821 gid_t gr_gid; 1822 char **gr_mem; 1823 } 1824 ; 1825 _________________________________________________________ 1826 1827 8.4.11. iconv.h 1828 1829 typedef void *iconv_t; 1830 _________________________________________________________ 1831 1832 8.4.12. inttypes.h 1833 1834 typedef lldiv_t imaxdiv_t; 1835 typedef unsigned char uint8_t; 1836 typedef unsigned short uint16_t; 1837 typedef unsigned int uint32_t; 1838 _________________________________________________________ 1839 1840 8.4.13. langinfo.h 1841 1842 #define ABDAY_1 0x20000 1843 #define ABDAY_2 0x20001 1844 #define ABDAY_3 0x20002 1845 #define ABDAY_4 0x20003 1846 #define ABDAY_5 0x20004 1847 #define ABDAY_6 0x20005 1848 #define ABDAY_7 0x20006 1849 1850 #define DAY_1 0x20007 1851 #define DAY_2 0x20008 1852 #define DAY_3 0x20009 1853 #define DAY_4 0x2000A 1854 #define DAY_5 0x2000B 1855 #define DAY_6 0x2000C 1856 #define DAY_7 0x2000D 1857 1858 #define ABMON_1 0x2000E 1859 #define ABMON_2 0x2000F 1860 #define ABMON_3 0x20010 1861 #define ABMON_4 0x20011 1862 #define ABMON_5 0x20012 1863 #define ABMON_6 0x20013 1864 #define ABMON_7 0x20014 1865 #define ABMON_8 0x20015 1866 #define ABMON_9 0x20016 1867 #define ABMON_10 0x20017 1868 #define ABMON_11 0x20018 1869 #define ABMON_12 0x20019 1870 1871 #define MON_1 0x2001A 1872 #define MON_2 0x2001B 1873 #define MON_3 0x2001C 1874 #define MON_4 0x2001D 1875 #define MON_5 0x2001E 1876 #define MON_6 0x2001F 1877 #define MON_7 0x20020 1878 #define MON_8 0x20021 1879 #define MON_9 0x20022 1880 #define MON_10 0x20023 1881 #define MON_11 0x20024 1882 #define MON_12 0x20025 1883 1884 #define AM_STR 0x20026 1885 #define PM_STR 0x20027 1886 1887 #define D_T_FMT 0x20028 1888 #define D_FMT 0x20029 1889 #define T_FMT 0x2002A 1890 #define T_FMT_AMPM 0x2002B 1891 1892 #define ERA 0x2002C 1893 #define ERA_D_FMT 0x2002E 1894 #define ALT_DIGITS 0x2002F 1895 #define ERA_D_T_FMT 0x20030 1896 #define ERA_T_FMT 0x20031 1897 1898 #define CODESET 14 1899 1900 #define CRNCYSTR 0x4000F 1901 1902 #define RADIXCHAR 0x10000 1903 #define THOUSEP 0x10001 1904 #define YESEXPR 0x50000 1905 #define NOEXPR 0x50001 1906 #define YESSTR 0x50002 1907 #define NOSTR 0x50003 1908 _________________________________________________________ 1909 1910 8.4.14. limits.h 1911 1912 #define LLONG_MIN (-LLONG_MAX-1LL) 1913 #define ULLONG_MAX 18446744073709551615ULL 1914 #define OPEN_MAX 256 1915 #define PATH_MAX 4096 1916 #define LLONG_MAX 9223372036854775807LL 1917 #define SSIZE_MAX LONG_MAX 1918 1919 #define MB_LEN_MAX 16 1920 1921 #define SCHAR_MIN (-128) 1922 #define SCHAR_MAX 127 1923 #define UCHAR_MAX 255 1924 #define CHAR_BIT 8 1925 1926 #define SHRT_MIN (-32768) 1927 #define SHRT_MAX 32767 1928 #define USHRT_MAX 65535 1929 1930 #define INT_MIN (-INT_MAX-1) 1931 #define INT_MAX 2147483647 1932 #define __INT_MAX__ 2147483647 1933 #define UINT_MAX 4294967295U 1934 1935 #define LONG_MIN (-LONG_MAX-1L) 1936 1937 #define PTHREAD_KEYS_MAX 1024 1938 #define PTHREAD_STACK_MIN 16384 1939 #define PTHREAD_THREADS_MAX 16384 1940 #define PTHREAD_DESTRUCTOR_ITERATIONS 4 1941 _________________________________________________________ 1942 1943 8.4.15. locale.h 1944 1945 struct lconv 1946 { 1947 char *decimal_point; 1948 char *thousands_sep; 1949 char *grouping; 1950 char *int_curr_symbol; 1951 char *currency_symbol; 1952 char *mon_decimal_point; 1953 char *mon_thousands_sep; 1954 char *mon_grouping; 1955 char *positive_sign; 1956 char *negative_sign; 1957 char int_frac_digits; 1958 char frac_digits; 1959 char p_cs_precedes; 1960 char p_sep_by_space; 1961 char n_cs_precedes; 1962 char n_sep_by_space; 1963 char p_sign_posn; 1964 char n_sign_posn; 1965 char int_p_cs_precedes; 1966 char int_p_sep_by_space; 1967 char int_n_cs_precedes; 1968 char int_n_sep_by_space; 1969 char int_p_sign_posn; 1970 char int_n_sign_posn; 1971 } 1972 ; 1973 #define LC_GLOBAL_LOCALE ((locale_t) -1L) 1974 #define LC_CTYPE 0 1975 #define LC_NUMERIC 1 1976 #define LC_TELEPHONE 10 1977 #define LC_MEASUREMENT 11 1978 #define LC_IDENTIFICATION 12 1979 #define LC_TIME 2 1980 #define LC_COLLATE 3 1981 #define LC_MONETARY 4 1982 #define LC_MESSAGES 5 1983 #define LC_ALL 6 1984 #define LC_PAPER 7 1985 #define LC_NAME 8 1986 #define LC_ADDRESS 9 1987 1988 typedef struct __locale_struct 1989 { 1990 struct locale_data *__locales[13]; 1991 const unsigned short *__ctype_b; 1992 const int *__ctype_tolower; 1993 const int *__ctype_toupper; 1994 const char *__names[13]; 1995 } 1996 *__locale_t; 1997 1998 typedef struct __locale_struct *locale_t; 1999 #define LC_ADDRESS_MASK (1 << LC_ADDRESS) 2000 #define LC_COLLATE_MASK (1 << LC_COLLATE) 2001 #define LC_IDENTIFICATION_MASK (1 << LC_IDENTIFICATION) 2002 #define LC_MEASUREMENT_MASK (1 << LC_MEASUREMENT) 2003 #define LC_MESSAGES_MASK (1 << LC_MESSAGES) 2004 #define LC_MONETARY_MASK (1 << LC_MONETARY) 2005 #define LC_NAME_MASK (1 << LC_NAME) 2006 #define LC_NUMERIC_MASK (1 << LC_NUMERIC) 2007 #define LC_PAPER_MASK (1 << LC_PAPER) 2008 #define LC_TELEPHONE_MASK (1 << LC_TELEPHONE) 2009 #define LC_TIME_MASK (1 << LC_TIME) 2010 #define LC_CTYPE_MASK (1<cl_ops->cl_control)(cl,rq,in)) 2428 #define clnt_abort(rh) ((*(rh)->cl_ops->cl_abort)(rh)) 2429 #define clnt_call(rh, proc, xargs, argsp, xres, resp, secs) ((*(rh) 2430 ->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs)) 2431 #define clnt_destroy(rh) ((*(rh)->cl_ops->cl_destroy)(rh)) 2432 #define clnt_freeres(rh,xres,resp) ((*(rh)->cl_ops->cl_freeres)(rh 2433 ,xres,resp)) 2434 #define clnt_geterr(rh,errp) ((*(rh)->cl_ops->cl_geterr)(rh, errp)) 2435 #define NULLPROC ((u_long)0) 2436 #define CLSET_TIMEOUT 1 2437 #define CLGET_XID 10 2438 #define CLSET_XID 11 2439 #define CLGET_VERS 12 2440 #define CLSET_VERS 13 2441 #define CLGET_PROG 14 2442 #define CLSET_PROG 15 2443 #define CLGET_TIMEOUT 2 2444 #define CLGET_SERVER_ADDR 3 2445 #define CLSET_RETRY_TIMEOUT 4 2446 #define CLGET_RETRY_TIMEOUT 5 2447 #define CLGET_FD 6 2448 #define CLGET_SVC_ADDR 7 2449 #define CLSET_FD_CLOSE 8 2450 #define CLSET_FD_NCLOSE 9 2451 2452 enum clnt_stat 2453 { 2454 RPC_SUCCESS, RPC_CANTENCODEARGS = 1, RPC_CANTDECODERES = 2, RPC_CANTS 2455 END = 2456 3, RPC_CANTRECV = 4, RPC_TIMEDOUT = 5, RPC_VERSMISMATCH = 2457 6, RPC_AUTHERROR = 7, RPC_PROGUNAVAIL = 8, RPC_PROGVERSMISMATCH = 2458 9, RPC_PROCUNAVAIL = 10, RPC_CANTDECODEARGS = 11, RPC_SYSTEMERROR = 2459 12, RPC_NOBROADCAST = 21, RPC_UNKNOWNHOST = 13, RPC_UNKNOWNPROTO = 2460 17, RPC_UNKNOWNADDR = 19, RPC_RPCBFAILURE = 14, RPC_PROGNOTREGISTER 2461 ED = 2462 15, RPC_N2AXLATEFAILURE = 22, RPC_FAILED = 16, RPC_INTR = 2463 18, RPC_TLIERROR = 20, RPC_UDERROR = 23, RPC_INPROGRESS = 2464 24, RPC_STALERACHANDLE = 25 2465 } 2466 ; 2467 struct rpc_err 2468 { 2469 enum clnt_stat re_status; 2470 union 2471 { 2472 int RE_errno; 2473 enum auth_stat RE_why; 2474 struct 2475 { 2476 u_long low; 2477 u_long high; 2478 } 2479 RE_vers; 2480 struct 2481 { 2482 long int s1; 2483 long int s2; 2484 } 2485 RE_lb; 2486 } 2487 ru; 2488 } 2489 ; 2490 2491 typedef struct CLIENT 2492 { 2493 struct AUTH *cl_auth; 2494 struct clnt_ops *cl_ops; 2495 caddr_t cl_private; 2496 } 2497 CLIENT; 2498 2499 struct clnt_ops 2500 { 2501 enum clnt_stat (*cl_call) (struct CLIENT *, u_long, xdrproc_t, caddr_ 2502 t, 2503 xdrproc_t, caddr_t, struct timeval); 2504 void (*cl_abort) (void); 2505 void (*cl_geterr) (struct CLIENT *, struct rpc_err *); 2506 bool_t (*cl_freeres) (struct CLIENT *, xdrproc_t, caddr_t); 2507 void (*cl_destroy) (struct CLIENT *); 2508 bool_t (*cl_control) (struct CLIENT *, int, char *); 2509 } 2510 ; 2511 _________________________________________________________ 2512 2513 8.4.28. rpc/rpc_msg.h 2514 2515 enum msg_type 2516 { 2517 CALL, REPLY = 1 2518 } 2519 ; 2520 enum reply_stat 2521 { 2522 MSG_ACCEPTED, MSG_DENIED = 1 2523 } 2524 ; 2525 enum accept_stat 2526 { 2527 SUCCESS, PROG_UNAVAIL = 1, PROG_MISMATCH = 2, PROC_UNAVAIL = 2528 3, GARBAGE_ARGS = 4, SYSTEM_ERR = 5 2529 } 2530 ; 2531 enum reject_stat 2532 { 2533 RPC_MISMATCH, AUTH_ERROR = 1 2534 } 2535 ; 2536 2537 struct accepted_reply 2538 { 2539 struct opaque_auth ar_verf; 2540 enum accept_stat ar_stat; 2541 union 2542 { 2543 struct 2544 { 2545 unsigned long int low; 2546 unsigned long int high; 2547 } 2548 AR_versions; 2549 struct 2550 { 2551 caddr_t where; 2552 xdrproc_t proc; 2553 } 2554 AR_results; 2555 } 2556 ru; 2557 } 2558 ; 2559 2560 struct rejected_reply 2561 { 2562 enum reject_stat rj_stat; 2563 union 2564 { 2565 struct 2566 { 2567 unsigned long int low; 2568 unsigned long int high; 2569 } 2570 RJ_versions; 2571 enum auth_stat RJ_why; 2572 } 2573 ru; 2574 } 2575 ; 2576 2577 struct reply_body 2578 { 2579 enum reply_stat rp_stat; 2580 union 2581 { 2582 struct accepted_reply RP_ar; 2583 struct rejected_reply RP_dr; 2584 } 2585 ru; 2586 } 2587 ; 2588 2589 struct call_body 2590 { 2591 unsigned long int cb_rpcvers; 2592 unsigned long int cb_prog; 2593 unsigned long int cb_vers; 2594 unsigned long int cb_proc; 2595 struct opaque_auth cb_cred; 2596 struct opaque_auth cb_verf; 2597 } 2598 ; 2599 2600 struct rpc_msg 2601 { 2602 unsigned long int rm_xid; 2603 enum msg_type rm_direction; 2604 union 2605 { 2606 struct call_body RM_cmb; 2607 struct reply_body RM_rmb; 2608 } 2609 ru; 2610 } 2611 ; 2612 _________________________________________________________ 2613 2614 8.4.29. rpc/svc.h 2615 2616 #define svc_freeargs(xprt,xargs, argsp) (*(xprt)->xp_ops->xp_freeargs)( 2617 (xprt), (xargs), (argsp)) 2618 #define svc_getargs(xprt,xargs, argsp) (*(xprt)->xp_ops->xp_getargs)(( 2619 xprt), (xargs), (argsp)) 2620 #define RPC_ANYSOCK -1 2621 2622 typedef struct SVCXPRT 2623 { 2624 int xp_sock; 2625 u_short xp_port; 2626 struct xp_ops *xp_ops; 2627 int xp_addrlen; 2628 struct sockaddr_in xp_raddr; 2629 struct opaque_auth xp_verf; 2630 caddr_t xp_p1; 2631 caddr_t xp_p2; 2632 char xp_pad[256]; 2633 } 2634 SVCXPRT; 2635 2636 struct svc_req 2637 { 2638 rpcprog_t rq_prog; 2639 rpcvers_t rq_vers; 2640 rpcproc_t rq_proc; 2641 struct opaque_auth rq_cred; 2642 caddr_t rq_clntcred; 2643 SVCXPRT *rq_xprt; 2644 } 2645 ; 2646 2647 typedef void (*__dispatch_fn_t) (struct svc_req *, SVCXPRT *); 2648 2649 struct xp_ops 2650 { 2651 bool_t (*xp_recv) (SVCXPRT * __xprt, struct rpc_msg * __msg); 2652 enum xprt_stat (*xp_stat) (SVCXPRT * __xprt); 2653 bool_t (*xp_getargs) (SVCXPRT * __xprt, xdrproc_t __xdr_args, 2654 caddr_t args_ptr); 2655 bool_t (*xp_reply) (SVCXPRT * __xprt, struct rpc_msg * __msg); 2656 bool_t (*xp_freeargs) (SVCXPRT * __xprt, xdrproc_t __xdr_args, 2657 caddr_t args_ptr); 2658 void (*xp_destroy) (SVCXPRT * __xprt); 2659 } 2660 ; 2661 _________________________________________________________ 2662 2663 8.4.30. rpc/types.h 2664 2665 typedef int bool_t; 2666 typedef int enum_t; 2667 typedef unsigned long int rpcprog_t; 2668 typedef unsigned long int rpcvers_t; 2669 typedef unsigned long int rpcproc_t; 2670 typedef unsigned long int rpcprot_t; 2671 _________________________________________________________ 2672 2673 8.4.31. rpc/xdr.h 2674 2675 enum xdr_op 2676 { 2677 XDR_ENCODE, XDR_DECODE, XDR_FREE 2678 } 2679 ; 2680 typedef struct XDR 2681 { 2682 enum xdr_op x_op; 2683 struct xdr_ops *x_ops; 2684 caddr_t x_public; 2685 caddr_t x_private; 2686 caddr_t x_base; 2687 int x_handy; 2688 } 2689 XDR; 2690 2691 struct xdr_ops 2692 { 2693 bool_t (*x_getlong) (XDR * __xdrs, long int *__lp); 2694 bool_t (*x_putlong) (XDR * __xdrs, long int *__lp); 2695 bool_t (*x_getbytes) (XDR * __xdrs, caddr_t __addr, u_int __len); 2696 bool_t (*x_putbytes) (XDR * __xdrs, char *__addr, u_int __len); 2697 u_int (*x_getpostn) (XDR * __xdrs); 2698 bool_t (*x_setpostn) (XDR * __xdrs, u_int __pos); 2699 int32_t *(*x_inline) (XDR * __xdrs, int __len); 2700 void (*x_destroy) (XDR * __xdrs); 2701 bool_t (*x_getint32) (XDR * __xdrs, int32_t * __ip); 2702 bool_t (*x_putint32) (XDR * __xdrs, int32_t * __ip); 2703 } 2704 ; 2705 2706 typedef bool_t (*xdrproc_t) (XDR *, void *, ...); 2707 2708 struct xdr_discrim 2709 { 2710 int value; 2711 xdrproc_t proc; 2712 } 2713 ; 2714 _________________________________________________________ 2715 2716 8.4.32. sched.h 2717 2718 #define SCHED_OTHER 0 2719 #define SCHED_FIFO 1 2720 #define SCHED_RR 2 2721 2722 struct sched_param 2723 { 2724 int sched_priority; 2725 } 2726 ; 2727 _________________________________________________________ 2728 2729 8.4.33. search.h 2730 2731 typedef struct entry 2732 { 2733 char *key; 2734 void *data; 2735 } 2736 ENTRY; 2737 typedef enum 2738 { 2739 FIND, ENTER 2740 } 2741 ACTION; 2742 typedef enum 2743 { 2744 preorder, postorder, endorder, leaf 2745 } 2746 VISIT; 2747 2748 typedef void (*__action_fn_t) (void *__nodep, VISIT __value, int __leve 2749 l); 2750 _________________________________________________________ 2751 2752 8.4.34. setjmp.h 2753 2754 #define setjmp(env) _setjmp(env) 2755 #define sigsetjmp(a,b) __sigsetjmp(a,b) 2756 2757 struct __jmp_buf_tag 2758 { 2759 __jmp_buf __jmpbuf; 2760 int __mask_was_saved; 2761 sigset_t __saved_mask; 2762 } 2763 ; 2764 2765 typedef struct __jmp_buf_tag jmp_buf[1]; 2766 typedef jmp_buf sigjmp_buf; 2767 _________________________________________________________ 2768 2769 8.4.35. signal.h 2770 2771 #define _SIGSET_NWORDS (1024/(8*sizeof(unsigned long))) 2772 #define SIGRTMAX (__libc_current_sigrtmax ()) 2773 #define SIGRTMIN (__libc_current_sigrtmin ()) 2774 #define SIG_BLOCK 0 2775 #define SIG_UNBLOCK 1 2776 #define SIG_SETMASK 2 2777 #define NSIG 65 2778 2779 typedef int sig_atomic_t; 2780 2781 typedef void (*sighandler_t) (int); 2782 #define SIG_HOLD ((sighandler_t) 2) 2783 #define SIG_ERR ((sighandler_t)-1) 2784 #define SIG_DFL ((sighandler_t)0) 2785 #define SIG_IGN ((sighandler_t)1) 2786 2787 #define SIGHUP 1 2788 #define SIGUSR1 10 2789 #define SIGSEGV 11 2790 #define SIGUSR2 12 2791 #define SIGPIPE 13 2792 #define SIGALRM 14 2793 #define SIGTERM 15 2794 #define SIGSTKFLT 16 2795 #define SIGCHLD 17 2796 #define SIGCONT 18 2797 #define SIGSTOP 19 2798 #define SIGINT 2 2799 #define SIGTSTP 20 2800 #define SIGTTIN 21 2801 #define SIGTTOU 22 2802 #define SIGURG 23 2803 #define SIGXCPU 24 2804 #define SIGXFSZ 25 2805 #define SIGVTALRM 26 2806 #define SIGPROF 27 2807 #define SIGWINCH 28 2808 #define SIGIO 29 2809 #define SIGQUIT 3 2810 #define SIGPWR 30 2811 #define SIGSYS 31 2812 #define SIGUNUSED 31 2813 #define SIGILL 4 2814 #define SIGTRAP 5 2815 #define SIGABRT 6 2816 #define SIGIOT 6 2817 #define SIGBUS 7 2818 #define SIGFPE 8 2819 #define SIGKILL 9 2820 #define SIGCLD SIGCHLD 2821 #define SIGPOLL SIGIO 2822 2823 #define SV_ONSTACK (1<<0) 2824 #define SV_INTERRUPT (1<<1) 2825 #define SV_RESETHAND (1<<2) 2826 2827 typedef union sigval 2828 { 2829 int sival_int; 2830 void *sival_ptr; 2831 } 2832 sigval_t; 2833 #define SIGEV_SIGNAL 0 2834 #define SIGEV_NONE 1 2835 #define SIGEV_THREAD 2 2836 #define SIGEV_MAX_SIZE 64 2837 2838 typedef struct sigevent 2839 { 2840 sigval_t sigev_value; 2841 int sigev_signo; 2842 int sigev_notify; 2843 union 2844 { 2845 int _pad[SIGEV_PAD_SIZE]; 2846 struct 2847 { 2848 void (*sigev_thread_func) (sigval_t); 2849 void *_attribute; 2850 } 2851 _sigev_thread; 2852 } 2853 _sigev_un; 2854 } 2855 sigevent_t; 2856 #define SI_MAX_SIZE 128 2857 #define si_pid _sifields._kill._pid 2858 #define si_uid _sifields._kill._uid 2859 #define si_value _sifields._rt._sigval 2860 #define si_int _sifields._rt._sigval.sival_int 2861 #define si_ptr _sifields._rt._sigval.sival_ptr 2862 #define si_status _sifields._sigchld._status 2863 #define si_stime _sifields._sigchld._stime 2864 #define si_utime _sifields._sigchld._utime 2865 #define si_addr _sifields._sigfault._addr 2866 #define si_band _sifields._sigpoll._band 2867 #define si_fd _sifields._sigpoll._fd 2868 #define si_timer1 _sifields._timer._timer1 2869 #define si_timer2 _sifields._timer._timer2 2870 2871 typedef struct siginfo 2872 { 2873 int si_signo; 2874 int si_errno; 2875 int si_code; 2876 union 2877 { 2878 int _pad[SI_PAD_SIZE]; 2879 struct 2880 { 2881 pid_t _pid; 2882 uid_t _uid; 2883 } 2884 _kill; 2885 struct 2886 { 2887 unsigned int _timer1; 2888 unsigned int _timer2; 2889 } 2890 _timer; 2891 struct 2892 { 2893 pid_t _pid; 2894 uid_t _uid; 2895 sigval_t _sigval; 2896 } 2897 _rt; 2898 struct 2899 { 2900 pid_t _pid; 2901 uid_t _uid; 2902 int _status; 2903 clock_t _utime; 2904 clock_t _stime; 2905 } 2906 _sigchld; 2907 struct 2908 { 2909 void *_addr; 2910 } 2911 _sigfault; 2912 struct 2913 { 2914 int _band; 2915 int _fd; 2916 } 2917 _sigpoll; 2918 } 2919 _sifields; 2920 } 2921 siginfo_t; 2922 #define SI_QUEUE -1 2923 #define SI_TIMER -2 2924 #define SI_MESGQ -3 2925 #define SI_ASYNCIO -4 2926 #define SI_SIGIO -5 2927 #define SI_TKILL -6 2928 #define SI_ASYNCNL -60 2929 #define SI_USER 0 2930 #define SI_KERNEL 0x80 2931 2932 #define ILL_ILLOPC 1 2933 #define ILL_ILLOPN 2 2934 #define ILL_ILLADR 3 2935 #define ILL_ILLTRP 4 2936 #define ILL_PRVOPC 5 2937 #define ILL_PRVREG 6 2938 #define ILL_COPROC 7 2939 #define ILL_BADSTK 8 2940 2941 #define FPE_INTDIV 1 2942 #define FPE_INTOVF 2 2943 #define FPE_FLTDIV 3 2944 #define FPE_FLTOVF 4 2945 #define FPE_FLTUND 5 2946 #define FPE_FLTRES 6 2947 #define FPE_FLTINV 7 2948 #define FPE_FLTSUB 8 2949 2950 #define SEGV_MAPERR 1 2951 #define SEGV_ACCERR 2 2952 2953 #define BUS_ADRALN 1 2954 #define BUS_ADRERR 2 2955 #define BUS_OBJERR 3 2956 2957 #define TRAP_BRKPT 1 2958 #define TRAP_TRACE 2 2959 2960 #define CLD_EXITED 1 2961 #define CLD_KILLED 2 2962 #define CLD_DUMPED 3 2963 #define CLD_TRAPPED 4 2964 #define CLD_STOPPED 5 2965 #define CLD_CONTINUED 6 2966 2967 #define POLL_IN 1 2968 #define POLL_OUT 2 2969 #define POLL_MSG 3 2970 #define POLL_ERR 4 2971 #define POLL_PRI 5 2972 #define POLL_HUP 6 2973 2974 typedef struct 2975 { 2976 unsigned long int sig[_SIGSET_NWORDS]; 2977 } 2978 sigset_t; 2979 #define SA_NOCLDSTOP 0x00000001 2980 #define SA_NOCLDWAIT 0x00000002 2981 #define SA_SIGINFO 0x00000004 2982 #define SA_ONSTACK 0x08000000 2983 #define SA_RESTART 0x10000000 2984 #define SA_INTERRUPT 0x20000000 2985 #define SA_NODEFER 0x40000000 2986 #define SA_RESETHAND 0x80000000 2987 #define SA_NOMASK SA_NODEFER 2988 #define SA_ONESHOT SA_RESETHAND 2989 2990 typedef struct sigaltstack 2991 { 2992 void *ss_sp; 2993 int ss_flags; 2994 size_t ss_size; 2995 } 2996 stack_t; 2997 #define SS_ONSTACK 1 2998 #define SS_DISABLE 2 2999 _________________________________________________________ 3000 3001 8.4.36. stddef.h 3002 3003 #define offsetof(TYPE,MEMBER) ((size_t)& ((TYPE*)0)->MEMBER) 3004 #define NULL (0L) 3005 3006 typedef int wchar_t; 3007 _________________________________________________________ 3008 3009 8.4.37. stdio.h 3010 3011 #define EOF (-1) 3012 #define P_tmpdir "/tmp" 3013 #define FOPEN_MAX 16 3014 #define L_tmpnam 20 3015 #define FILENAME_MAX 4096 3016 #define BUFSIZ 8192 3017 #define L_ctermid 9 3018 #define L_cuserid 9 3019 3020 typedef struct 3021 { 3022 off_t __pos; 3023 mbstate_t __state; 3024 } 3025 fpos_t; 3026 typedef struct 3027 { 3028 off64_t __pos; 3029 mbstate_t __state; 3030 } 3031 fpos64_t; 3032 3033 typedef struct _IO_FILE FILE; 3034 #define _IOFBF 0 3035 #define _IOLBF 1 3036 #define _IONBF 2 3037 _________________________________________________________ 3038 3039 8.4.38. stdlib.h 3040 3041 #define MB_CUR_MAX (__ctype_get_mb_cur_max()) 3042 #define EXIT_SUCCESS 0 3043 #define EXIT_FAILURE 1 3044 #define RAND_MAX 2147483647 3045 3046 typedef int (*__compar_fn_t) (const void *, const void *); 3047 struct random_data 3048 { 3049 int32_t *fptr; 3050 int32_t *rptr; 3051 int32_t *state; 3052 int rand_type; 3053 int rand_deg; 3054 int rand_sep; 3055 int32_t *end_ptr; 3056 } 3057 ; 3058 3059 typedef struct 3060 { 3061 int quot; 3062 int rem; 3063 } 3064 div_t; 3065 3066 typedef struct 3067 { 3068 long int quot; 3069 long int rem; 3070 } 3071 ldiv_t; 3072 3073 typedef struct 3074 { 3075 long long int quot; 3076 long long int rem; 3077 } 3078 lldiv_t; 3079 _________________________________________________________ 3080 3081 8.4.39. sys/file.h 3082 3083 #define LOCK_SH 1 3084 #define LOCK_EX 2 3085 #define LOCK_NB 4 3086 #define LOCK_UN 8 3087 _________________________________________________________ 3088 3089 8.4.40. sys/ipc.h 3090 3091 #define IPC_PRIVATE ((key_t)0) 3092 #define IPC_RMID 0 3093 #define IPC_CREAT 00001000 3094 #define IPC_EXCL 00002000 3095 #define IPC_NOWAIT 00004000 3096 #define IPC_SET 1 3097 #define IPC_STAT 2 3098 _________________________________________________________ 3099 3100 8.4.41. sys/mman.h 3101 3102 #define MAP_FAILED ((void*)-1) 3103 #define PROT_NONE 0x0 3104 #define MAP_SHARED 0x01 3105 #define MAP_PRIVATE 0x02 3106 #define PROT_READ 0x1 3107 #define MAP_FIXED 0x10 3108 #define PROT_WRITE 0x2 3109 #define MAP_ANONYMOUS 0x20 3110 #define PROT_EXEC 0x4 3111 #define MS_ASYNC 1 3112 #define MS_INVALIDATE 2 3113 #define MS_SYNC 4 3114 #define MAP_ANON MAP_ANONYMOUS 3115 _________________________________________________________ 3116 3117 8.4.42. sys/msg.h 3118 3119 #define MSG_NOERROR 010000 3120 _________________________________________________________ 3121 3122 8.4.43. sys/param.h 3123 3124 #define NOFILE 256 3125 #define MAXPATHLEN 4096 3126 _________________________________________________________ 3127 3128 8.4.44. sys/poll.h 3129 3130 #define POLLIN 0x0001 3131 #define POLLPRI 0x0002 3132 #define POLLOUT 0x0004 3133 #define POLLERR 0x0008 3134 #define POLLHUP 0x0010 3135 #define POLLNVAL 0x0020 3136 3137 struct pollfd 3138 { 3139 int fd; 3140 short events; 3141 short revents; 3142 } 3143 ; 3144 typedef unsigned long int nfds_t; 3145 _________________________________________________________ 3146 3147 8.4.45. sys/resource.h 3148 3149 #define RUSAGE_CHILDREN (-1) 3150 #define RUSAGE_BOTH (-2) 3151 #define RLIM_INFINITY (~0UL) 3152 #define RLIM_SAVED_CUR -1 3153 #define RLIM_SAVED_MAX -1 3154 #define RLIMIT_CPU 0 3155 #define RUSAGE_SELF 0 3156 #define RLIMIT_FSIZE 1 3157 #define RLIMIT_DATA 2 3158 #define RLIMIT_STACK 3 3159 #define RLIMIT_CORE 4 3160 #define RLIMIT_NOFILE 7 3161 #define RLIMIT_AS 9 3162 3163 typedef unsigned long int rlim_t; 3164 typedef unsigned long long int rlim64_t; 3165 typedef int __rlimit_resource_t; 3166 3167 struct rlimit 3168 { 3169 rlim_t rlim_cur; 3170 rlim_t rlim_max; 3171 } 3172 ; 3173 struct rlimit64 3174 { 3175 rlim64_t rlim_cur; 3176 rlim64_t rlim_max; 3177 } 3178 ; 3179 3180 struct rusage 3181 { 3182 struct timeval ru_utime; 3183 struct timeval ru_stime; 3184 long int ru_maxrss; 3185 long int ru_ixrss; 3186 long int ru_idrss; 3187 long int ru_isrss; 3188 long int ru_minflt; 3189 long int ru_majflt; 3190 long int ru_nswap; 3191 long int ru_inblock; 3192 long int ru_oublock; 3193 long int ru_msgsnd; 3194 long int ru_msgrcv; 3195 long int ru_nsignals; 3196 long int ru_nvcsw; 3197 long int ru_nivcsw; 3198 } 3199 ; 3200 3201 enum __priority_which 3202 { 3203 PRIO_PROCESS, PRIO_PGRP = 1, PRIO_USER = 2 3204 } 3205 ; 3206 #define PRIO_PGRP PRIO_PGRP 3207 #define PRIO_PROCESS PRIO_PROCESS 3208 #define PRIO_USER PRIO_USER 3209 3210 typedef enum __priority_which __priority_which_t; 3211 _________________________________________________________ 3212 3213 8.4.46. sys/sem.h 3214 3215 #define SEM_UNDO 0x1000 3216 #define GETPID 11 3217 #define GETVAL 12 3218 #define GETALL 13 3219 #define GETNCNT 14 3220 #define GETZCNT 15 3221 #define SETVAL 16 3222 #define SETALL 17 3223 3224 struct sembuf 3225 { 3226 short sem_num; 3227 short sem_op; 3228 short sem_flg; 3229 } 3230 ; 3231 _________________________________________________________ 3232 3233 8.4.47. sys/shm.h 3234 3235 #define SHM_RDONLY 010000 3236 #define SHM_W 0200 3237 #define SHM_RND 020000 3238 #define SHM_R 0400 3239 #define SHM_REMAP 040000 3240 #define SHM_LOCK 11 3241 #define SHM_UNLOCK 12 3242 _________________________________________________________ 3243 3244 8.4.48. sys/socket.h 3245 3246 #define CMSG_NXTHDR(mhdr,cmsg) ( ((cmsg) == NULL) ? CMSG_FIRSTHDR(mhd 3247 r) : (((unsigned char *)(cmsg) + CMSG_ALIGN((cmsg)->cmsg_len) + CMSG_AL 3248 IGN(sizeof(struct cmsghdr)) > (unsigned char *)((mhdr)->msg_control) + 3249 (mhdr)->msg_controllen) ? (struct cmsghdr *)NULL :(struct cmsghdr *)((u 3250 nsi 3251 #define CMSG_ALIGN(len) (((len)+sizeof(size_t)-1)& (size_t)~(sizeof(siz 3252 e_t)-1)) 3253 #define CMSG_FIRSTHDR(msg) ((size_t) (mhdr)->msg_controllen >= siz 3254 eof (struct cmsghdr) ? (struct cmsghdr *) (mhdr)->msg_control : (struct 3255 cmsghdr *) NULL) 3256 #define CMSG_DATA(cmsg) ((unsigned char *) (cmsg) + CMSG_ALIGN(sizeof(s 3257 truct cmsghdr))) 3258 #define CMSG_LEN(len) (CMSG_ALIGN(sizeof(struct cmsghdr))+(len)) 3259 #define CMSG_SPACE(len) (CMSG_ALIGN(sizeof(struct cmsghdr))+CMSG_ALIGN( 3260 len)) 3261 #define SCM_RIGHTS 0x01 3262 #define SOL_SOCKET 1 3263 #define SOMAXCONN 128 3264 #define SOL_RAW 255 3265 3266 struct linger 3267 { 3268 int l_onoff; 3269 int l_linger; 3270 } 3271 ; 3272 struct cmsghdr 3273 { 3274 size_t cmsg_len; 3275 int cmsg_level; 3276 int cmsg_type; 3277 } 3278 ; 3279 struct iovec 3280 { 3281 void *iov_base; 3282 size_t iov_len; 3283 } 3284 ; 3285 3286 typedef unsigned short sa_family_t; 3287 typedef unsigned int socklen_t; 3288 3289 struct sockaddr 3290 { 3291 sa_family_t sa_family; 3292 char sa_data[14]; 3293 } 3294 ; 3295 struct sockaddr_storage 3296 { 3297 sa_family_t ss_family; 3298 __ss_aligntype __ss_align; 3299 char __ss_padding[(128 - (2 * sizeof (__ss_aligntype)))]; 3300 } 3301 ; 3302 3303 struct msghdr 3304 { 3305 void *msg_name; 3306 int msg_namelen; 3307 struct iovec *msg_iov; 3308 size_t msg_iovlen; 3309 void *msg_control; 3310 size_t msg_controllen; 3311 unsigned int msg_flags; 3312 } 3313 ; 3314 #define AF_UNSPEC 0 3315 #define AF_UNIX 1 3316 #define AF_INET6 10 3317 #define AF_INET 2 3318 3319 #define PF_INET AF_INET 3320 #define PF_INET6 AF_INET6 3321 #define PF_UNIX AF_UNIX 3322 #define PF_UNSPEC AF_UNSPEC 3323 3324 #define SOCK_STREAM 1 3325 #define SOCK_PACKET 10 3326 #define SOCK_DGRAM 2 3327 #define SOCK_RAW 3 3328 #define SOCK_RDM 4 3329 #define SOCK_SEQPACKET 5 3330 3331 #define SO_DEBUG 1 3332 #define SO_OOBINLINE 10 3333 #define SO_NO_CHECK 11 3334 #define SO_PRIORITY 12 3335 #define SO_LINGER 13 3336 #define SO_REUSEADDR 2 3337 #define SO_TYPE 3 3338 #define SO_ACCEPTCONN 30 3339 #define SO_ERROR 4 3340 #define SO_DONTROUTE 5 3341 #define SO_BROADCAST 6 3342 #define SO_SNDBUF 7 3343 #define SO_RCVBUF 8 3344 #define SO_KEEPALIVE 9 3345 3346 #define SIOCGIFFLAGS 0x8913 3347 #define SIOCGIFADDR 0x8915 3348 #define SIOCGIFNETMASK 0x891b 3349 3350 #define SHUT_RD 0 3351 #define SHUT_WR 1 3352 #define SHUT_RDWR 2 3353 #define MSG_DONTROUTE 4 3354 3355 #define MSG_WAITALL 0x100 3356 #define MSG_TRUNC 0x20 3357 #define MSG_EOR 0x80 3358 #define MSG_OOB 1 3359 #define MSG_PEEK 2 3360 #define MSG_CTRUNC 8 3361 _________________________________________________________ 3362 3363 8.4.49. sys/stat.h 3364 3365 #define S_ISBLK(m) (((m)& S_IFMT)==S_IFBLK) 3366 #define S_ISCHR(m) (((m)& S_IFMT)==S_IFCHR) 3367 #define S_ISDIR(m) (((m)& S_IFMT)==S_IFDIR) 3368 #define S_ISFIFO(m) (((m)& S_IFMT)==S_IFIFO) 3369 #define S_ISLNK(m) (((m)& S_IFMT)==S_IFLNK) 3370 #define S_ISREG(m) (((m)& S_IFMT)==S_IFREG) 3371 #define S_ISSOCK(m) (((m)& S_IFMT)==S_IFSOCK) 3372 #define S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode) 3373 #define S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode) 3374 #define S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode) 3375 #define S_IRWXU (S_IREAD|S_IWRITE|S_IEXEC) 3376 #define S_IROTH (S_IRGRP>>3) 3377 #define S_IRGRP (S_IRUSR>>3) 3378 #define S_IRWXO (S_IRWXG>>3) 3379 #define S_IRWXG (S_IRWXU>>3) 3380 #define S_IWOTH (S_IWGRP>>3) 3381 #define S_IWGRP (S_IWUSR>>3) 3382 #define S_IXOTH (S_IXGRP>>3) 3383 #define S_IXGRP (S_IXUSR>>3) 3384 #define S_ISVTX 01000 3385 #define S_IXUSR 0x0040 3386 #define S_IWUSR 0x0080 3387 #define S_IRUSR 0x0100 3388 #define S_ISGID 0x0400 3389 #define S_ISUID 0x0800 3390 #define S_IFIFO 0x1000 3391 #define S_IFCHR 0x2000 3392 #define S_IFDIR 0x4000 3393 #define S_IFBLK 0x6000 3394 #define S_IFREG 0x8000 3395 #define S_IFLNK 0xa000 3396 #define S_IFSOCK 0xc000 3397 #define S_IFMT 0xf000 3398 #define st_atime st_atim.tv_sec 3399 #define st_ctime st_ctim.tv_sec 3400 #define st_mtime st_mtim.tv_sec 3401 #define S_IREAD S_IRUSR 3402 #define S_IWRITE S_IWUSR 3403 #define S_IEXEC S_IXUSR 3404 _________________________________________________________ 3405 3406 8.4.50. sys/time.h 3407 3408 #define ITIMER_REAL 0 3409 #define ITIMER_VIRTUAL 1 3410 #define ITIMER_PROF 2 3411 3412 struct timezone 3413 { 3414 int tz_minuteswest; 3415 int tz_dsttime; 3416 } 3417 ; 3418 3419 typedef int __itimer_which_t; 3420 3421 struct timespec 3422 { 3423 time_t tv_sec; 3424 long int tv_nsec; 3425 } 3426 ; 3427 3428 struct timeval 3429 { 3430 time_t tv_sec; 3431 suseconds_t tv_usec; 3432 } 3433 ; 3434 3435 struct itimerval 3436 { 3437 struct timeval it_interval; 3438 struct timeval it_value; 3439 } 3440 ; 3441 _________________________________________________________ 3442 3443 8.4.51. sys/timeb.h 3444 3445 struct timeb 3446 { 3447 time_t time; 3448 unsigned short millitm; 3449 short timezone; 3450 short dstflag; 3451 } 3452 ; 3453 _________________________________________________________ 3454 3455 8.4.52. sys/times.h 3456 3457 struct tms 3458 { 3459 clock_t tms_utime; 3460 clock_t tms_stime; 3461 clock_t tms_cutime; 3462 clock_t tms_cstime; 3463 } 3464 ; 3465 _________________________________________________________ 3466 3467 8.4.53. sys/types.h 3468 3469 #define FD_ISSET(d,set) ((set)->fds_bits[((d)/(8*sizeof(long)))]& (1<<( 3470 (d)%(8*sizeof(long))))) 3471 #define FD_CLR(d,set) ((set)->fds_bits[((d)/(8*sizeof(long)))]& =~(1< 3472 <((d)%(8*sizeof(long))))) 3473 #define FD_SET(d,set) ((set)->fds_bits[((d)/(8*sizeof(long)))]|=(1<<( 3474 (d)%(8*sizeof(long))))) 3475 #define FALSE 0 3476 #define TRUE 1 3477 #define FD_SETSIZE 1024 3478 #define FD_ZERO(fdsetp) bzero(fdsetp, sizeof(*(fdsetp))) 3479 3480 typedef signed char int8_t; 3481 typedef short int16_t; 3482 typedef int int32_t; 3483 typedef unsigned char u_int8_t; 3484 typedef unsigned short u_int16_t; 3485 typedef unsigned int u_int32_t; 3486 typedef unsigned int uid_t; 3487 typedef int pid_t; 3488 typedef unsigned long int off_t; 3489 typedef int key_t; 3490 typedef long int suseconds_t; 3491 typedef unsigned int u_int; 3492 typedef struct 3493 { 3494 int __val[2]; 3495 } 3496 fsid_t; 3497 typedef unsigned int useconds_t; 3498 typedef unsigned long int blksize_t; 3499 typedef long int fd_mask; 3500 typedef int timer_t; 3501 typedef int clockid_t; 3502 3503 typedef unsigned int id_t; 3504 3505 typedef unsigned long long int ino64_t; 3506 typedef long long int loff_t; 3507 typedef unsigned long int blkcnt_t; 3508 typedef unsigned long int fsblkcnt_t; 3509 typedef unsigned long int fsfilcnt_t; 3510 typedef unsigned long long int blkcnt64_t; 3511 typedef unsigned long long int fsblkcnt64_t; 3512 typedef unsigned long long int fsfilcnt64_t; 3513 typedef unsigned char u_char; 3514 typedef unsigned short u_short; 3515 typedef unsigned long int u_long; 3516 3517 typedef unsigned long int ino_t; 3518 typedef unsigned int gid_t; 3519 typedef unsigned long long int dev_t; 3520 typedef unsigned int mode_t; 3521 typedef unsigned long int nlink_t; 3522 typedef char *caddr_t; 3523 3524 typedef struct 3525 { 3526 unsigned long int fds_bits[__FDSET_LONGS]; 3527 } 3528 fd_set; 3529 3530 typedef long int clock_t; 3531 typedef long int time_t; 3532 _________________________________________________________ 3533 3534 8.4.54. sys/un.h 3535 3536 #define UNIX_PATH_MAX 108 3537 3538 struct sockaddr_un 3539 { 3540 sa_family_t sun_family; 3541 char sun_path[UNIX_PATH_MAX]; 3542 } 3543 ; 3544 _________________________________________________________ 3545 3546 8.4.55. sys/utsname.h 3547 3548 #define SYS_NMLN 65 3549 3550 struct utsname 3551 { 3552 char sysname[65]; 3553 char nodename[65]; 3554 char release[65]; 3555 char version[65]; 3556 char machine[65]; 3557 char domainname[65]; 3558 } 3559 ; 3560 _________________________________________________________ 3561 3562 8.4.56. sys/wait.h 3563 3564 #define WIFSIGNALED(status) (!WIFSTOPPED(status) & & !WIFEXITED(sta 3565 tus)) 3566 #define WIFSTOPPED(status) (((status) & 0xff) == 0x7f) 3567 #define WEXITSTATUS(status) (((status) & 0xff00) >> 8) 3568 #define WTERMSIG(status) ((status) & 0x7f) 3569 #define WCOREDUMP(status) ((status) & 0x80) 3570 #define WIFEXITED(status) (WTERMSIG(status) == 0) 3571 #define WNOHANG 0x00000001 3572 #define WUNTRACED 0x00000002 3573 #define WCOREFLAG 0x80 3574 #define WSTOPSIG(status) WEXITSTATUS(status) 3575 3576 typedef enum 3577 { 3578 P_ALL, P_PID, P_PGID 3579 } 3580 idtype_t; 3581 _________________________________________________________ 3582 3583 8.4.57. syslog.h 3584 3585 #define LOG_EMERG 0 3586 #define LOG_PRIMASK 0x07 3587 #define LOG_ALERT 1 3588 #define LOG_CRIT 2 3589 #define LOG_ERR 3 3590 #define LOG_WARNING 4 3591 #define LOG_NOTICE 5 3592 #define LOG_INFO 6 3593 #define LOG_DEBUG 7 3594 3595 #define LOG_KERN (0<<3) 3596 #define LOG_AUTHPRIV (10<<3) 3597 #define LOG_FTP (11<<3) 3598 #define LOG_USER (1<<3) 3599 #define LOG_MAIL (2<<3) 3600 #define LOG_DAEMON (3<<3) 3601 #define LOG_AUTH (4<<3) 3602 #define LOG_SYSLOG (5<<3) 3603 #define LOG_LPR (6<<3) 3604 #define LOG_NEWS (7<<3) 3605 #define LOG_UUCP (8<<3) 3606 #define LOG_CRON (9<<3) 3607 #define LOG_FACMASK 0x03f8 3608 3609 #define LOG_LOCAL0 (16<<3) 3610 #define LOG_LOCAL1 (17<<3) 3611 #define LOG_LOCAL2 (18<<3) 3612 #define LOG_LOCAL3 (19<<3) 3613 #define LOG_LOCAL4 (20<<3) 3614 #define LOG_LOCAL5 (21<<3) 3615 #define LOG_LOCAL6 (22<<3) 3616 #define LOG_LOCAL7 (23<<3) 3617 3618 #define LOG_UPTO(pri) ((1 << ((pri)+1)) - 1) 3619 #define LOG_MASK(pri) (1 << (pri)) 3620 3621 #define LOG_PID 0x01 3622 #define LOG_CONS 0x02 3623 #define LOG_ODELAY 0x04 3624 #define LOG_NDELAY 0x08 3625 #define LOG_NOWAIT 0x10 3626 #define LOG_PERROR 0x20 3627 _________________________________________________________ 3628 3629 8.4.58. termios.h 3630 3631 #define TCIFLUSH 0 3632 #define TCOOFF 0 3633 #define TCSANOW 0 3634 #define BS0 0000000 3635 #define CR0 0000000 3636 #define FF0 0000000 3637 #define NL0 0000000 3638 #define TAB0 0000000 3639 #define VT0 0000000 3640 #define OPOST 0000001 3641 #define OCRNL 0000010 3642 #define ONOCR 0000020 3643 #define ONLRET 0000040 3644 #define OFILL 0000100 3645 #define OFDEL 0000200 3646 #define NL1 0000400 3647 #define TCOFLUSH 1 3648 #define TCOON 1 3649 #define TCSADRAIN 1 3650 #define TCIOFF 2 3651 #define TCIOFLUSH 2 3652 #define TCSAFLUSH 2 3653 #define TCION 3 3654 3655 typedef unsigned int speed_t; 3656 typedef unsigned char cc_t; 3657 typedef unsigned int tcflag_t; 3658 #define NCCS 32 3659 3660 struct termios 3661 { 3662 tcflag_t c_iflag; 3663 tcflag_t c_oflag; 3664 tcflag_t c_cflag; 3665 tcflag_t c_lflag; 3666 cc_t c_line; 3667 cc_t c_cc[NCCS]; 3668 speed_t c_ispeed; 3669 speed_t c_ospeed; 3670 } 3671 ; 3672 #define VINTR 0 3673 #define VQUIT 1 3674 #define VLNEXT 15 3675 #define VERASE 2 3676 #define VKILL 3 3677 #define VEOF 4 3678 3679 #define IGNBRK 0000001 3680 #define BRKINT 0000002 3681 #define IGNPAR 0000004 3682 #define PARMRK 0000010 3683 #define INPCK 0000020 3684 #define ISTRIP 0000040 3685 #define INLCR 0000100 3686 #define IGNCR 0000200 3687 #define ICRNL 0000400 3688 #define IXANY 0004000 3689 #define IMAXBEL 0020000 3690 3691 #define CS5 0000000 3692 3693 #define ECHO 0000010 3694 3695 #define B0 0000000 3696 #define B50 0000001 3697 #define B75 0000002 3698 #define B110 0000003 3699 #define B134 0000004 3700 #define B150 0000005 3701 #define B200 0000006 3702 #define B300 0000007 3703 #define B600 0000010 3704 #define B1200 0000011 3705 #define B1800 0000012 3706 #define B2400 0000013 3707 #define B4800 0000014 3708 #define B9600 0000015 3709 #define B19200 0000016 3710 #define B38400 0000017 3711 _________________________________________________________ 3712 3713 8.4.59. time.h 3714 3715 #define CLK_TCK ((clock_t)__sysconf(2)) 3716 #define CLOCK_REALTIME 0 3717 #define TIMER_ABSTIME 1 3718 #define CLOCKS_PER_SEC 1000000l 3719 3720 struct tm 3721 { 3722 int tm_sec; 3723 int tm_min; 3724 int tm_hour; 3725 int tm_mday; 3726 int tm_mon; 3727 int tm_year; 3728 int tm_wday; 3729 int tm_yday; 3730 int tm_isdst; 3731 long int tm_gmtoff; 3732 char *tm_zone; 3733 } 3734 ; 3735 struct itimerspec 3736 { 3737 struct timespec it_interval; 3738 struct timespec it_value; 3739 } 3740 ; 3741 _________________________________________________________ 3742 3743 8.4.60. ulimit.h 3744 3745 #define UL_GETFSIZE 1 3746 #define UL_SETFSIZE 2 3747 _________________________________________________________ 3748 3749 8.4.61. unistd.h 3750 3751 The LSB requires _XOPEN_REALTIME to be defined to 1, but does 3752 not require all the set of functions required by the ISO POSIX 3753 (2003) XSI Option Group _XOPEN_REALTIME. For example, the 3754 asynchronous input/output functions are optional for LSB 3755 conforming systems. 3756 #define SEEK_SET 0 3757 #define STDIN_FILENO 0 3758 #define SEEK_CUR 1 3759 #define STDOUT_FILENO 1 3760 #define SEEK_END 2 3761 #define STDERR_FILENO 2 3762 3763 typedef long long int off64_t; 3764 #define F_OK 0 3765 #define X_OK 1 3766 #define W_OK 2 3767 #define R_OK 4 3768 3769 #define _POSIX_VDISABLE '\0' 3770 #define _POSIX_CHOWN_RESTRICTED 1 3771 #define _POSIX_JOB_CONTROL 1 3772 #define _POSIX_NO_TRUNC 1 3773 #define _POSIX_SHELL 1 3774 #define _POSIX_FSYNC 200112 3775 #define _POSIX_MAPPED_FILES 200112 3776 #define _POSIX_MEMLOCK 200112 3777 #define _POSIX_MEMLOCK_RANGE 200112 3778 #define _POSIX_MEMORY_PROTECTION 200112 3779 #define _POSIX_SEMAPHORES 200112 3780 #define _POSIX_SHARED_MEMORY_OBJECTS 200112 3781 #define _POSIX_TIMERS 200112 3782 #define _POSIX2_C_BIND 200112L 3783 #define _POSIX_THREADS 200112L 3784 3785 #define _PC_LINK_MAX 0 3786 #define _PC_MAX_CANON 1 3787 #define _PC_ASYNC_IO 10 3788 #define _PC_PRIO_IO 11 3789 #define _PC_FILESIZEBITS 13 3790 #define _PC_REC_INCR_XFER_SIZE 14 3791 #define _PC_REC_MIN_XFER_SIZE 16 3792 #define _PC_REC_XFER_ALIGN 17 3793 #define _PC_ALLOC_SIZE_MIN 18 3794 #define _PC_MAX_INPUT 2 3795 #define _PC_2_SYMLINKS 20 3796 #define _PC_NAME_MAX 3 3797 #define _PC_PATH_MAX 4 3798 #define _PC_PIPE_BUF 5 3799 #define _PC_CHO