Linux Standard Base Core Specification 4.1

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".

Portions of the text may be copyrighted by the following parties:

  • The Regents of the University of California

  • Free Software Foundation

  • Ian F. Darwin

  • Paul Vixie

  • BSDI (now Wind River)

  • Andrew G Morgan

  • Jean-loup Gailly and Mark Adler

  • Massachusetts Institute of Technology

  • Apple Inc.

  • Easy Software Products

  • artofcode LLC

  • Till Kamppeter

  • Manfred Wassman

  • Python Software Foundation

These excerpts are being used in accordance with their respective licenses.

Linux is the registered trademark of Linus Torvalds in the U.S. and other countries.

UNIX is a registered trademark of The Open Group.

LSB is a trademark of the Linux Foundation in the United States and other countries.

AMD is a trademark of Advanced Micro Devices, Inc.

Intel and Itanium are registered trademarks and Intel386 is a trademark of Intel Corporation.

PowerPC is a registered trademark and PowerPC Architecture is a trademark of the IBM Corporation.

S/390 is a registered trademark of the IBM Corporation.

OpenGL is a registered trademark of Silicon Graphics, Inc.


Table of Contents
Foreword
Status of this Document
Introduction
I. Introductory Elements
1. Scope
1.1. General
1.2. Module Specific Scope
2. References
2.1. Normative References
2.2. Informative References/Bibliography
3. Requirements
3.1. Relevant Libraries
3.2. LSB Implementation Conformance
3.3. LSB Application Conformance
4. Terms and Definitions
5. Documentation Conventions
6. Relationship To ISO/IEC 9945 POSIX
7. Relationship To Other Linux Foundation Specifications
II. Executable And Linking Format (ELF)
8. Introduction
9. Low Level System Information
9.1. Operating System Interface
9.2. Machine Interface
10. Object Format
10.1. Object Files
10.2. Sections
10.3. Special Sections
10.4. Symbol Mapping
10.5. DWARF Extensions
10.6. Exception Frames
10.7. Symbol Versioning
10.8. ABI note tag
11. Dynamic Linking
11.1. Program Loading and Dynamic Linking
11.2. Program Header
11.3. Dynamic Entries
III. Base Libraries
12. Base Libraries
12.1. Introduction
12.2. Program Interpreter
12.3. Interfaces for libc
12.4. Data Definitions for libc
12.5. Interface Definitions for libc
12.6. Interfaces for libm
12.7. Data Definitions for libm
12.8. Interface Definitions for libm
12.9. Interfaces for libpthread
12.10. Data Definitions for libpthread
12.11. Interface Definitions for libpthread
12.12. Interfaces for libgcc_s
12.13. Data Definitions for libgcc_s
12.14. Interface Definitions for libgcc_s
12.15. Interfaces for libdl
12.16. Data Definitions for libdl
12.17. Interface Definitions for libdl
12.18. Interfaces for librt
12.19. Data Definitions for librt
12.20. Interfaces for libcrypt
12.21. Interfaces for libpam
12.22. Data Definitions for libpam
12.23. Interface Definitions for libpam
IV. Utility Libraries
13. Utility Libraries
13.1. Introduction
13.2. Interfaces for libz
13.3. Data Definitions for libz
13.4. Interface Definitions for libz
13.5. Interfaces for libncurses
13.6. Data Definitions for libncurses
13.7. Interface Definitions for libncurses
13.8. Interfaces for libutil
13.9. Interface Definitions for libutil
V. Network Security Services
14. Libraries
14.1. Interfaces for libnspr4
14.2. Data Definitions for libnspr4
14.3. Interfaces for libnss3
14.4. Data Definitions for libnss3
14.5. Interfaces for libssl3
14.6. Data Definitions for libssl3
VI. Commands and Utilities
15. Commands and Utilities
15.1. Commands and Utilities
15.2. Command Behavior
VII. Execution Environment
16. File System Hierarchy
16.1. /dev: Device Files
16.2. /etc: Host-specific system configuration
16.3. User Accounting Databases
16.4. Path For System Administration Utilities
17. Additional Recommendations
17.1. Recommendations for applications on ownership and permissions
18. Additional Behaviors
18.1. Mandatory Optional Behaviors
18.2. Optional Mandatory Behaviors
18.3. Executable Scripts
19. Localization
19.1. Introduction
19.2. Regular Expressions
19.3. Pattern Matching Notation
VIII. System Initialization
20. System Initialization
20.1. Cron Jobs
20.2. Init Script Actions
20.3. Comment Conventions for Init Scripts
20.4. Installation and Removal of Init Scripts
20.5. Run Levels
20.6. Facility Names
20.7. Script Names
20.8. Init Script Functions
IX. Users & Groups
21. Users & Groups
21.1. User and Group Database
21.2. User & Group Names
21.3. User ID Ranges
21.4. Rationale
X. Package Format and Installation
22. Software Installation
22.1. Introduction
22.2. Package File Format
22.3. Package Script Restrictions
22.4. Package Tools
22.5. Package Naming
22.6. Package Dependencies
22.7. Package Architecture Considerations
A. Alphabetical Listing of Interfaces
A.1. libc
A.2. libcrypt
A.3. libdl
A.4. libgcc_s
A.5. libm
A.6. libncurses
A.7. libpam
A.8. libpthread
A.9. librt
A.10. libutil
A.11. libz
B. GNU Free Documentation License (Informative)
B.1. PREAMBLE
B.2. APPLICABILITY AND DEFINITIONS
B.3. VERBATIM COPYING
B.4. COPYING IN QUANTITY
B.5. MODIFICATIONS
B.6. COMBINING DOCUMENTS
B.7. COLLECTIONS OF DOCUMENTS
B.8. AGGREGATION WITH INDEPENDENT WORKS
B.9. TRANSLATION
B.10. TERMINATION
B.11. FUTURE REVISIONS OF THIS LICENSE
B.12. How to use this License for your documents
List of Figures
10-1. Version Definition Entries
10-2. Version Definition Auxiliary Entries
10-3. Version Needed Entries
10-4. Version Needed Auxiliary Entries
11-1. Dynamic Structure
List of Tables
2-1. Normative References
2-2. Other References
3-1. Standard Library Names
3-2. Standard Library Names defined in the Architecture Specific Parts of ISO/IEC 23360
9-1. Scalar Types
10-1. ELF Section Types
10-2. Additional Section Types
10-3. ELF Special Sections
10-4. Additional Special Sections
10-5. DWARF Exception Header value format
10-6. DWARF Exception Header application
10-7. Additional DWARF Call Frame Instructions
10-8. Call Frame Information Format
10-9. Common Information Entry Format
10-10. Frame Description Entry Format
10-11. .eh_frame_hdr Section Format
11-1. Linux Segment Types
12-1. libc Definition
12-2. libc - RPC Function Interfaces
12-3. libc - RPC Deprecated Function Interfaces
12-4. libc - Epoll Function Interfaces
12-5. libc - System Calls Function Interfaces
12-6. libc - System Calls Deprecated Function Interfaces
12-7. libc - Standard I/O Function Interfaces
12-8. libc - Standard I/O Deprecated Function Interfaces
12-9. libc - Standard I/O Data Interfaces
12-10. libc - Signal Handling Function Interfaces
12-11. libc - Signal Handling Deprecated Function Interfaces
12-12. libc - Signal Handling Data Interfaces
12-13. libc - Localization Functions Function Interfaces
12-14. libc - Localization Functions Data Interfaces
12-15. libc - Posix Spawn Option Function Interfaces
12-16. libc - Posix Advisory Option Function Interfaces
12-17. libc - Socket Interface Function Interfaces
12-18. libc - Socket Interface Data Interfaces
12-19. libc - Wide Characters Function Interfaces
12-20. libc - String Functions Function Interfaces
12-21. libc - String Functions Deprecated Function Interfaces
12-22. libc - IPC Functions Function Interfaces
12-23. libc - Regular Expressions Function Interfaces
12-24. libc - Character Type Functions Function Interfaces
12-25. libc - Time Manipulation Function Interfaces
12-26. libc - Time Manipulation Data Interfaces
12-27. libc - Terminal Interface Functions Function Interfaces
12-28. libc - System Database Interface Function Interfaces
12-29. libc - System Database Interface Deprecated Function Interfaces
12-30. libc - Language Support Function Interfaces
12-31. libc - Large File Support Function Interfaces
12-32. libc - Large File Support Deprecated Function Interfaces
12-33. libc - Inotify Function Interfaces
12-34. libc - Standard Library Function Interfaces
12-35. libc - Standard Library Deprecated Function Interfaces
12-36. libc - Standard Library Data Interfaces
12-37. libc - GNU Extensions for libc Function Interfaces
12-38. libm Definition
12-39. libm - Math Function Interfaces
12-40. libm - Math Deprecated Function Interfaces
12-41. libm - Math Data Interfaces
12-42. libpthread Definition
12-43. libpthread - Realtime Threads Function Interfaces
12-44. libpthread - Advanced Realtime Threads Function Interfaces
12-45. libpthread - Posix Threads Function Interfaces
12-46. libpthread - Posix Threads Deprecated Function Interfaces
12-47. libpthread - Thread aware versions of libc interfaces Function Interfaces
12-48. libpthread - GNU Extensions for libpthread Function Interfaces
12-49. libgcc_s Definition
12-50. libgcc_s - Unwind Library Function Interfaces
12-51. libdl Definition
12-52. libdl - Dynamic Loader Function Interfaces
12-53. librt Definition
12-54. librt - Shared Memory Objects Function Interfaces
12-55. librt - Clock Function Interfaces
12-56. librt - Timers Function Interfaces
12-57. librt - Message Queues Function Interfaces
12-58. libcrypt Definition
12-59. libcrypt - Encryption Function Interfaces
12-60. libpam Definition
12-61. libpam - Pluggable Authentication API Function Interfaces
13-1. libz Definition
13-2. libz - Compression Library Function Interfaces
13-3. libncurses Definition
13-4. libncurses - Curses Function Interfaces
13-5. libncurses - Curses Deprecated Function Interfaces
13-6. libncurses - Curses Data Interfaces
13-7. libutil Definition
13-8. libutil - Utility Functions Function Interfaces
14-1. libnspr4 Definition
14-2. libnspr4 - Netscape Portable Runtime Function Interfaces
14-3. libnss3 Definition
14-4. libnss3 - NSS Utility Function Interfaces
14-5. libssl3 Definition
14-6. libssl3 - NSS SSL Function Interfaces
15-1. Commands And Utilities
15-2. Built In Utilities
15-1. Escape Sequences
21-1. Required User & Group Names
21-2. Optional User & Group Names
22-1. RPM File Format
22-2. Signature Format
22-3. Index Type values
22-4. Header Private Tag Values
22-5. Signature Tag Values
22-6. Signature Digest Tag Values
22-7. Signature Signing Tag Values
22-8. Package Info Tag Values
22-9. Installation Tag Values
22-10. File Info Tag Values
22-11. File Flags
22-12. Package Dependency Tag Values
22-13. Index Type values
22-14. Package Dependency Attributes
22-15. Other Tag Values
22-16. CPIO File Format
A-1. libc Function Interfaces
A-2. libc Data Interfaces
A-3. libcrypt Function Interfaces
A-4. libdl Function Interfaces
A-5. libgcc_s Function Interfaces
A-6. libm Function Interfaces
A-7. libm Data Interfaces
A-8. libncurses Function Interfaces
A-9. libncurses Data Interfaces
A-10. libpam Function Interfaces
A-11. libpthread Function Interfaces
A-12. librt Function Interfaces
A-13. libutil Function Interfaces
A-14. libz Function Interfaces

Foreword

This is version 4.1 of the Linux Standard Base Core Specification. This specification is one of a series of volumes under the collective title Linux Standard Base:

Note that the Core, C++ and Desktop volumes consist of a generic volume augmented by an architecture-specific volume.


Status of this Document

This is a released specification. Other documents may supersede or augment this specification. A list of current Linux Standard Base (LSB) specifications is available at http://refspecs.linuxfoundation.org.

If you wish to make comments regarding this document in a manner that is tracked by the LSB project, please submit them using our public bug database at http://bugs.linuxbase.org. Please enter your feedback, carefully indicating the title of the section for which you are submitting feedback, and the volume and version of the specification where you found the problem, quoting the incorrect text if appropriate. If you are suggesting a new feature, please indicate what the problem you are trying to solve is. That is more important than the solution, in fact.

If you do not have or wish to create a bug database account then you can also e-mail feedback to (subscribe, archives), and arrangements will be made to transpose the comments to our public bug database.


Introduction

The LSB defines a binary interface for application programs that are compiled and packaged for LSB-conforming implementations on many different hardware architectures. A binary specification must include information specific to the computer processor architecture for which it is intended. To avoid the complexity of conditional descriptions, the specification has instead been divided into generic parts which are augmented by one of several architecture-specific parts, depending on the target processor architecture; the generic part will indicate when reference must be made to the architecture part, and vice versa.

This document should be used in conjunction with the documents it references. This document enumerates the system components it includes, but descriptions of those components may be included entirely or partly in this document, partly in other documents, or entirely in other reference documents. For example, the section that describes system service routines includes a list of the system routines supported in this interface, formal declarations of the data structures they use that are visible to applications, and a pointer to the underlying referenced specification for information about the syntax and semantics of each call. Only those routines not described in standards referenced by this document, or extensions to those standards, are described in the detail. Information referenced in this way is as much a part of this document as is the information explicitly included here.

The specification carries a version number of either the form x.y or x.y.z. This version number carries the following meaning:

  1. The first number (x) is the major version number. Versions sharing the same major version number shall be compatible in a backwards direction; that is, a newer version shall be compatible with an older version. Any deletion of a library results in a new major version number. Interfaces marked as deprecated may be removed from the specification at a major version change.

  2. The second number (y) is the minor version number. Libraries and individual interfaces may be added, but not removed. Interfaces may be marked as deprecated at a minor version change. Other minor changes may be permitted at the discretion of the LSB workgroup.

  3. The third number (z), if present, is the editorial level. Only editorial changes should be included in such versions.

Since this specification is a descriptive Application Binary Interface, and not a source level API specification, it is not possible to make a guarantee of 100% backward compatibility between major releases. However, it is the intent that those parts of the binary interface that are visible in the source level API will remain backward compatible from version to version, except where a feature marked as "Deprecated" in one release may be removed from a future release. Implementors are strongly encouraged to make use of symbol versioning to permit simultaneous support of applications conforming to different releases of this specification.

LSB is a trademark of the Linux Foundation. Developers of applications or implementations interested in using the trademark should see the Linux Foundation Certification Policy for details.


Chapter 1. Scope

1.1. General

The Linux Standard Base (LSB) defines a system interface for compiled applications and a minimal environment for support of installation scripts. Its purpose is to enable a uniform industry standard environment for high-volume applications conforming to the LSB.

These specifications are composed of two basic parts: A common specification ("LSB-generic" or "generic LSB"), ISO/IEC 23360 Part 1, describing those parts of the interface that remain constant across all implementations of the LSB, and an architecture-specific part ("LSB-arch") describing the parts of the interface that vary by processor architecture. Together, the LSB-generic and the relevant architecture-specific part of ISO/IEC 23360 for a single hardware architecture provide a complete interface specification for compiled application programs on systems that share a common hardware architecture.

ISO/IEC 23360 Part 1, the LSB-generic document, should be used in conjunction with an architecture-specific part. Whenever a section of the LSB-generic specification is supplemented by architecture-specific information, the LSB-generic document includes a reference to the architecture part. Architecture-specific parts of ISO/IEC 23360 may also contain additional information that is not referenced in the LSB-generic document.

The LSB contains both a set of Application Program Interfaces (APIs) and Application Binary Interfaces (ABIs). APIs may appear in the source code of portable applications, while the compiled binary of that application may use the larger set of ABIs. A conforming implementation provides all of the ABIs listed here. The compilation system may replace (e.g. by macro definition) certain APIs with calls to one or more of the underlying binary interfaces, and may insert calls to binary interfaces as needed.

The LSB is primarily a binary interface definition. Not all of the source level APIs available to applications may be contained in this specification.


1.2. Module Specific Scope

This is the Core module of the Linux Standard Base (LSB), ISO/IEC 23360 Part 1. This module provides the fundamental system interfaces, libraries, and runtime environment upon which all conforming applications and libraries depend.

Interfaces described in this part of ISO/IEC 23360 are mandatory except where explicitly listed otherwise. Core interfaces may be supplemented by other modules; all modules are built upon the core.


Chapter 2. References

2.1. Normative References

The following referenced documents are indispensable for the application of this document. For dated references, only the edition cited applies. For undated references, the latest edition of the referenced document (including any amendments) applies.

Note: Where copies of a document are available on the World Wide Web, a Uniform Resource Locator (URL) is given for informative purposes only. This may point to a more recent copy of the referenced specification, or may be out of date. Reference copies of specifications at the revision level indicated may be found at the Linux Foundation's Reference Specifications site.

Table 2-1. Normative References

NameTitleURL
Filesystem Hierarchy StandardFilesystem Hierarchy Standard (FHS) 2.3http://www.pathname.com/fhs/
ISO C (1999)ISO/IEC 9899: 1999, Programming Languages --C
Itanium™ C++ ABIItanium™ C++ ABI (Revision 1.86)http://refspecs.linuxfoundation.org/cxxabi-1.86.html
Large File SupportLarge File Supporthttp://www.UNIX-systems.org/version2/whatsnew/lfs20mar.html
POSIX 1003.1-2001 (ISO/IEC 9945-2003)

ISO/IEC 9945-1:2003 Information technology -- Portable Operating System Interface (POSIX) -- Part 1: Base Definitions

ISO/IEC 9945-2:2003 Information technology -- Portable Operating System Interface (POSIX) -- Part 2: System Interfaces

ISO/IEC 9945-3:2003 Information technology -- Portable Operating System Interface (POSIX) -- Part 3: Shell and Utilities

ISO/IEC 9945-4:2003 Information technology -- Portable Operating System Interface (POSIX) -- Part 4: Rationale

Including Technical Cor. 1: 2004

http://www.unix.org/version3/
POSIX 1003.1-2008 (ISO/IEC 9945-2009)Portable Operating System Interface (POSIX®) 2008 Edition / The Open Group Technical Standard Base Specifications, Issue 7http://www.unix.org/version4/
SUSv2CAE Specification, January 1997, System Interfaces and Headers (XSH),Issue 5 (ISBN: 1-85912-181-0, C606)http://www.opengroup.org/publications/catalog/un.htm
SVID Issue 3American Telephone and Telegraph Company, System V Interface Definition, Issue 3; Morristown, NJ, UNIX Press, 1989. (ISBN 0201566524)
SVID Issue 4System V Interface Definition, Fourth Editionhttp://refspecs.linuxfoundation.org/svid4/
System V ABISystem V Application Binary Interface, Edition 4.1http://www.sco.com/developers/devspecs/gabi41.pdf
System V ABI UpdateSystem V Application Binary Interface - DRAFT - 17 December 2003http://www.sco.com/developers/gabi/2003-12-17/contents.html
X/Open CursesCAE Specification, May 1996, X/Open Curses, Issue 4, Version 2 (ISBN: 1-85912-171-3, C610), plus Corrigendum U018http://www.opengroup.org/publications/catalog/un.htm

2.2. Informative References/Bibliography

In addition, the specifications listed below provide essential background information to implementors of this specification. These references are included for information only.

Table 2-2. Other References

NameTitleURL
DWARF Debugging Information Format, Revision 2.0.0DWARF Debugging Information Format, Revision 2.0.0 (July 27, 1993)http://refspecs.linux-foundation.org/dwarf/dwarf-2.0.0.pdf
DWARF Debugging Information Format, Revision 3.0.0 (Draft)DWARF Debugging Information Format, Revision 3.0.0 (Draft)http://refspecs.linux-foundation.org/dwarf
IEC 60559/IEEE 754 Floating PointIEC 60559:1989 Binary floating-point arithmetic for microprocessor systemshttp://www.ieee.org/
ISO/IEC TR14652ISO/IEC Technical Report 14652:2002 Specification method for cultural conventions
ITU-T V.42International Telecommunication Union Recommendation V.42 (2002): Error-correcting procedures for DCEs using asynchronous-to-synchronous conversionITUVhttp://www.itu.int/rec/recommendation.asp?type=folders&lang=e&parent=T-REC-V.42
Li18nux Globalization SpecificationLI18NUX 2000 Globalization Specification, Version 1.0 with Amendment 4http://www.openi18n.org/docs/html/LI18NUX-2000-amd4.htm
Linux Allocated Device RegistryLINUX ALLOCATED DEVICEShttp://www.lanana.org/docs/device-list/devices.txt
Mozilla's NSS SSL ReferenceMozilla's NSS SSL Referencehttp://www.mozilla.org/projects/security/pki/nss/ref/ssl/
NSPR ReferenceMozilla's NSPR Referencehttp://refspecs.linuxfoundation.org/NSPR_API_Reference/NSPR_API.html
PAMOpen Software Foundation, Request For Comments: 86.0 , October 1995, V. Samar & R.Schemers (SunSoft)http://www.opengroup.org/tech/rfc/mirror-rfc/rfc86.0.txt
RFC 1321: The MD5 Message-Digest AlgorithmIETF RFC 1321: The MD5 Message-Digest Algorithmhttp://www.ietf.org/rfc/rfc1321.txt
RFC 1831/1832 RPC & XDRIETF RFC 1831 & 1832http://www.ietf.org/
RFC 1833: Binding Protocols for ONC RPC Version 2IETF RFC 1833: Binding Protocols for ONC RPC Version 2http://www.ietf.org/rfc/rfc1833.txt
RFC 1950: ZLIB Compressed Data Format SpecicationIETF RFC 1950: ZLIB Compressed Data Format Specificationhttp://www.ietf.org/rfc/rfc1950.txt
RFC 1951: DEFLATE Compressed Data Format SpecificationIETF RFC 1951: DEFLATE Compressed Data Format Specification version 1.3http://www.ietf.org/rfc/rfc1951.txt
RFC 1952: GZIP File Format SpecificationIETF RFC 1952: GZIP file format specification version 4.3http://www.ietf.org/rfc/rfc1952.txt
RFC 2440: OpenPGP Message FormatIETF RFC 2440: OpenPGP Message Formathttp://www.ietf.org/rfc/rfc2440.txt
RFC 2821:Simple Mail Transfer ProtocolIETF RFC 2821: Simple Mail Transfer Protocolhttp://www.ietf.org/rfc/rfc2821.txt
RFC 2822:Internet Message FormatIETF RFC 2822: Internet Message Formathttp://www.ietf.org/rfc/rfc2822.txt
RFC 791:Internet ProtocolIETF RFC 791: Internet Protocol Specificationhttp://www.ietf.org/rfc/rfc791.txt
RPM Package FormatRPM Package Format V3.0http://www.rpm.org/max-rpm/s1-rpm-file-format-rpm-file-format.html
SUSv2 Commands and UtilitiesThe Single UNIX Specification(SUS) Version 2, Commands and Utilities (XCU), Issue 5 (ISBN: 1-85912-191-8, C604)http://www.opengroup.org/publications/catalog/un.htm
zlib Manualzlib 1.2 Manualhttp://www.gzip.org/zlib/

Chapter 3. Requirements

3.1. Relevant Libraries

The libraries listed in Table 3-1 shall be available on a Linux Standard Base system, with the specified runtime names. The libraries listed in Table 3-2 are architecture specific, but shall be available on all LSB conforming systems. This list may be supplemented or amended by the relevant architecture specific part of ISO/IEC 23360.

Table 3-1. Standard Library Names

LibraryRuntime Name
libdllibdl.so.2
libcryptlibcrypt.so.1
libzlibz.so.1
libncurseslibncurses.so.5
libutillibutil.so.1
libpthreadlibpthread.so.0
librtlibrt.so.1
libpamlibpam.so.0
libgcc_slibgcc_s.so.1

Table 3-2. Standard Library Names defined in the Architecture Specific Parts of ISO/IEC 23360

LibraryRuntime Name
libmSee archLSB
libcSee archLSB
proginterpSee archLSB

These libraries will be in an implementation-defined directory which the dynamic linker shall search by default.


3.2. LSB Implementation Conformance

A conforming implementation is necessarily architecture specific, and must provide the interfaces specified by both the generic LSB Core specification (ISO/IEC 23360 Part 1) and the relevant architecture specific part of ISO/IEC 23360.

Rationale: An implementation must provide at least the interfaces specified in these specifications. It may also provide additional interfaces.

A conforming implementation shall satisfy the following requirements:

  • A processor architecture represents a family of related processors which may not have identical feature sets. The architecture specific parts of ISO/IEC 23360 that supplement this specification for a given target processor architecture describe a minimum acceptable processor. The implementation shall provide all features of this processor, whether in hardware or through emulation transparent to the application.

  • The implementation shall be capable of executing compiled applications having the format and using the system interfaces described in this document.

  • The implementation shall provide libraries containing the interfaces specified by this document, and shall provide a dynamic linking mechanism that allows these interfaces to be attached to applications at runtime. All the interfaces shall behave as specified in this document.

  • The map of virtual memory provided by the implementation shall conform to the requirements of this document.

  • The implementation's low-level behavior with respect to function call linkage, system traps, signals, and other such activities shall conform to the formats described in this document.

  • The implementation shall provide all of the mandatory interfaces in their entirety.

  • The implementation may provide one or more of the optional interfaces. Each optional interface that is provided shall be provided in its entirety. The product documentation shall state which optional interfaces are provided.

  • The implementation shall provide all files and utilities specified as part of this document in the format defined here and in other referenced documents. All commands and utilities shall behave as required by this document. The implementation shall also provide all mandatory components of an application's runtime environment that are included or referenced in this document.

  • The implementation, when provided with standard data formats and values at a named interface, shall provide the behavior defined for those values and data formats at that interface. However, a conforming implementation may consist of components which are separately packaged and/or sold. For example, a vendor of a conforming implementation might sell the hardware, operating system, and windowing system as separately packaged items.

  • The implementation may provide additional interfaces with different names. It may also provide additional behavior corresponding to data values outside the standard ranges, for standard named interfaces.


3.3. LSB Application Conformance

A conforming application is necessarily architecture specific, and must conform to both the generic LSB Core specification (ISO/IEC 23360 Part 1)and the relevant architecture specific part of ISO/IEC 23360.

A conforming application shall satisfy the following requirements:

  • Its executable files shall be either shell scripts or object files in the format defined for the Object File Format system interface.

  • Its object files shall participate in dynamic linking as defined in the Program Loading and Linking System interface.

  • It shall employ only the instructions, traps, and other low-level facilities defined in the Low-Level System interface as being for use by applications.

  • If it requires any optional interface defined in this document in order to be installed or to execute successfully, the requirement for that optional interface shall be stated in the application's documentation.

  • It shall not use any interface or data format that is not required to be provided by a conforming implementation, unless:

    • If such an interface or data format is supplied by another application through direct invocation of that application during execution, that application shall be in turn an LSB conforming application.

    • The use of that interface or data format, as well as its source, shall be identified in the documentation of the application.

  • It shall not use any values for a named interface that are reserved for vendor extensions.

A strictly conforming application shall not require or use any interface, facility, or implementation-defined extension that is not defined in this document in order to be installed or to execute successfully.


Chapter 4. Terms and Definitions

For the purposes of this document, the terms given in ISO/IEC Directives, Part 2, Annex H and the following apply.

archLSB

Some LSB specification documents have both a generic, architecture-neutral part and an architecture-specific part. The latter describes elements whose definitions may be unique to a particular processor architecture. The term archLSB may be used in the generic part to refer to the corresponding section of the architecture-specific part.

Binary Standard, ABI

The total set of interfaces that are available to be used in the compiled binary code of a conforming application, including the run-time details such as calling conventions, binary format, C++ name mangling, etc.

Implementation-defined

Describes a value or behavior that is not defined by this document but is selected by an implementor. The value or behavior may vary among implementations that conform to this document. An application should not rely on the existence of the value or behavior. An application that relies on such a value or behavior cannot be assured to be portable across conforming implementations. The implementor shall document such a value or behavior so that it can be used correctly by an application.

Shell Script

A file that is read by an interpreter (e.g., awk). The first line of the shell script includes a reference to its interpreter binary.

Source Standard, API

The total set of interfaces that are available to be used in the source code of a conforming application. Due to translations, the Binary Standard and the Source Standard may contain some different interfaces.

Undefined

Describes the nature of a value or behavior not defined by this document which results from use of an invalid program construct or invalid data input. The value or behavior may vary among implementations that conform to this document. An application should not rely on the existence or validity of the value or behavior. An application that relies on any particular value or behavior cannot be assured to be portable across conforming implementations.

Unspecified

Describes the nature of a value or behavior not specified by this document which results from use of a valid program construct or valid data input. The value or behavior may vary among implementations that conform to this document. An application should not rely on the existence or validity of the value or behavior. An application that relies on any particular value or behavior cannot be assured to be portable across conforming implementations.

In addition, for the portions of this specification which build on IEEE Std 1003.1-2001, the definitions given in IEEE Std 1003.1-2001, Base Definitions, Chapter 3 apply.


Chapter 5. Documentation Conventions

Throughout this document, the following typographic conventions are used:

function() 

the name of a function

command 

the name of a command or utility

CONSTANT 

a constant value

parameter 

a parameter

variable 

a variable

Throughout this specification, several tables of interfaces are presented. Each entry in these tables has the following format:

name 

the name of the interface

(symver) 

An optional symbol version identifier, if required.

[refno] 

A reference number indexing the table of referenced specifications that follows this table.

For example,

forkpty(GLIBC_2.0) [SUSv3]

refers to the interface named forkpty() with symbol version GLIBC_2.0 that is defined in the SUSv3 reference.

Note: For symbols with versions which differ between architectures, the symbol versions are defined in the architecture specific parts of ISO/IEC 23360 only.


Chapter 6. Relationship To ISO/IEC 9945 POSIX

This specification includes many interfaces described in POSIX 1003.1-2001 (ISO/IEC 9945-2003). Unless otherwise specified, such interfaces should behave exactly as described in that specification. Any conflict between the requirements described here and the POSIX 1003.1-2001 (ISO/IEC 9945-2003) standard is unintentional, except as explicitly noted otherwise.

Note: In addition to the differences noted inline in this specification, PDTR 24715 has extracted the differences between this specification and POSIX 1003.1-2001 (ISO/IEC 9945-2003) into a single place. It is the long term plan of the Linux Foundation to converge the LSB Core Specification with ISO/IEC 9945 POSIX.

The LSB Specification Authority is responsible for deciding the meaning of conformance to normative referenced standards in the LSB context. Problem Reports regarding underlying or referenced standards in any other context will be referred to the relevant maintenance body for that standard.


Chapter 7. Relationship To Other Linux Foundation Specifications

The LSB is the base for several other specification projects under the umbrella of the Linux Foundation (LF). This specification is the foundation, and other specifications build on the interfaces defined here. However, beyond those specifications listed as Normative References, this specification has no dependencies on other LF projects.


Chapter 8. Introduction

Executable and Linking Format (ELF) defines the object format for compiled applications. This specification supplements the information found in System V ABI Update and is intended to document additions made since the publication of that document.


Chapter 9. Low Level System Information

9.1. Operating System Interface

LSB-conforming applications shall assume that stack, heap and other allocated memory regions will be non-executable. The application must take steps to make them executable if needed.


9.2. Machine Interface

9.2.1. Data Representation

LSB-conforming applications shall use the data representation as defined in the Arcitecture specific ELF documents.


9.2.1.1. Fundamental Types

In addition to the fundamental types specified in the relevant architecture specific part of ISO/IEC 23360, a 1 byte data type is defined here.

Table 9-1. Scalar Types

TypeCC++sizeofAlignment (bytes)Architecture Representation
Integral_Boolbool11byte


Chapter 10. Object Format

10.1. Object Files

LSB-conforming implementations shall support the object file Executable and Linking Format (ELF), which is defined by the following documents:

Conforming implementations may also support other unspecified object file formats.


10.2. Sections

10.2.1. Introduction

As described in System V ABI, an ELF object file contains a number of sections.


10.2.2. Sections Types

The section header table is an array of Elf32_Shdr or Elf64_Shdr structures as described in System V ABI. The sh_type member shall be either a value from Table 10-1, drawn from the System V ABI, or one of the additional values specified in Table 10-2.

A section header's sh_type member specifies the sections's semantics.


10.2.2.1. ELF Section Types

The following section types are defined in the System V ABI and the System V ABI Update.

Table 10-1. ELF Section Types

NameValueDescription
SHT_DYNAMIC0x6The section holds information for dynamic linking. Currently, an object file shall have only one dynamic section, but this restriction may be relaxed in the future. See `Dynamic Section' in Chapter 5 of System V ABI Update for details.
SHT_DYNSYM0xbThis section holds a minimal set of symbols adequate for dynamic linking. See also SHT_SYMTAB. Currently, an object file may have either a section of SHT_SYMTAB type or a section of SHT_DYNSYM type, but not both. This restriction may be relaxed in the future.
SHT_FINI_ARRAY0xfThis section contains an array of pointers to termination functions, as described in `Initialization and Termination Functions' in Chapter 5 of System V ABI Update. Each pointer in the array is taken as a parameterless procedure with a void return.
SHT_HASH0x5The section holds a symbol hash table. Currently, an object file shall have only one hash table, but this restriction may be relaxed in the future. See `Hash Table' in Chapter 5 of System V ABI Update for details.
SHT_INIT_ARRAY0xeThis section contains an array of pointers to initialization functions, as described in `Initialization and Termination Functions' in Chapter 5 of System V ABI Update. Each pointer in the array is taken as a parameterless procedure with a void return.
SHT_NOBITS0x8A section of this type occupies no space in the file but otherwise resembles SHT_PROGBITS. Although this section contains no bytes, the sh_offset member contains the conceptual file offset.
SHT_NOTE0x7The section holds information that marks the file in some way. See `Note Section' in Chapter 5 of System V ABI Update for details.
SHT_NULL0x0This value marks the section header as inactive; it does not have an associated section. Other members of the section header have undefined values.
SHT_PREINIT_ARRAY0x10This section contains an array of pointers to functions that are invoked before all other initialization functions, as described in `Initialization and Termination Functions' in Chapter 5 of System V ABI Update. Each pointer in the array is taken as a parameterless proceure with a void return.
SHT_PROGBITS0x1The section holds information defined by the program, whose format and meaning are determined solely by the program.
SHT_REL0x9The section holds relocation entries without explicit addends, such as type Elf32_Rel for the 32-bit class of object files or type Elf64_Rel for the 64-bit class of object files. An object file may have multiple relocation sections. See `Relocation' in Chapter 4 of System V ABI Update for details.
SHT_RELA0x4The section holds relocation entries with explicit addends, such as type Elf32_Rela for the 32-bit class of object files or type Elf64_Rela for the 64-bit class of object files. An object file may have multiple relocation sections. See `Relocation' in Chapter 4 of System V ABI Update for details.
SHT_STRTAB0x3The section holds a string table. An object file may have multiple string table sections. See `String Table' in Chapter 4 of System V ABI Update for details.
SHT_SYMTAB0x2This section holds a symbol table. Currently, an object file may have either a section of SHT_SYMTAB type or a section of SHT_DYNSYM type, but not both. This restriction may be relaxed in the future. Typically, SHT_SYMTAB provides symbols for link editing, though it may also be used for dynamic linking. As a complete symbol table, it may contain many symbols unnecessary for dynamic linking.


10.2.2.2. Additional Section Types

The following additional section types are defined here.

Table 10-2. Additional Section Types

NameValueDescription
SHT_GNU_verdef0x6ffffffdThis section contains the symbol versions that are provided.
SHT_GNU_verneed0x6ffffffeThis section contains the symbol versions that are required.
SHT_GNU_versym0x6fffffffThis section contains the Symbol Version Table.


10.3. Special Sections

10.3.1. Special Sections

Various sections hold program and control information. Sections in the lists below are used by the system and have the indicated types and attributes.


10.3.1.1. ELF Special Sections

The following sections are defined in the System V ABI and the System V ABI Update.

Table 10-3. ELF Special Sections

NameTypeAttributes
.bssSHT_NOBITSSHF_ALLOC+SHF_WRITE
.commentSHT_PROGBITS0
.dataSHT_PROGBITSSHF_ALLOC+SHF_WRITE
.data1SHT_PROGBITSSHF_ALLOC+SHF_WRITE
.debugSHT_PROGBITS0
.dynamicSHT_DYNAMICSHF_ALLOC+SHF_WRITE
.dynstrSHT_STRTABSHF_ALLOC
.dynsymSHT_DYNSYMSHF_ALLOC
.finiSHT_PROGBITSSHF_ALLOC+SHF_EXECINSTR
.fini_arraySHT_FINI_ARRAYSHF_ALLOC+SHF_WRITE
.hashSHT_HASHSHF_ALLOC
.initSHT_PROGBITSSHF_ALLOC+SHF_EXECINSTR
.init_arraySHT_INIT_ARRAY SHF_ALLOC+SHF_WRITE
.interpSHT_PROGBITSSHF_ALLOC
.lineSHT_PROGBITS0
.noteSHT_NOTE0
.preinit_arraySHT_PREINIT_ARRAYSHF_ALLOC+SHF_WRITE
.rodataSHT_PROGBITSSHF_ALLOC+SHF_MERGE+SHF_STRINGS
.rodata1SHT_PROGBITSSHF_ALLOC+SHF_MERGE+SHF_STRINGS
.shstrtabSHT_STRTAB0
.strtabSHT_STRTABSHF_ALLOC
.symtabSHT_SYMTABSHF_ALLOC
.tbssSHT_NOBITSSHF_ALLOC+SHF_WRITE+SHF_TLS
.tdataSHT_PROGBITSSHF_ALLOC+SHF_WRITE+SHF_TLS
.textSHT_PROGBITSSHF_ALLOC+SHF_EXECINSTR

.bss 

This section holds data that contributes to the program's memory image. The program may treat this data as uninitialized. However, the system shall initialize this data with zeroes when the program begins to run. The section occupies no file space, as indicated by the section type, SHT_NOBITS.

.comment 

This section holds version control information.

.data 

This section holds initialized data that contribute to the program's memory image.

.data1 

This section holds initialized data that contribute to the program's memory image.

.debug 

This section holds information for symbolic debugging. The contents are unspecified. All section names with the prefix .debug hold information for symbolic debugging. The contents of these sections are unspecified.

.dynamic 

This section holds dynamic linking information. The section's attributes will include the SHF_ALLOC bit. Whether the SHF_WRITE bit is set is processor specific. See Chapter 5 of System V ABI Update for more information.

.dynstr 

This section holds strings needed for dynamic linking, most commonly the strings that represent the names associated with symbol table entries. See Chapter 5 of System V ABI Update for more information.

.dynsym 

This section holds the dynamic linking symbol table, as described in `Symbol Table' of System V ABI Update.

.fini 

This section holds executable instructions that contribute to the process termination code. That is, when a program exits normally, the system arranges to execute the code in this section.

.fini_array 

This section holds an array of function pointers that contributes to a single termination array for the executable or shared object containing the section.

.hash 

This section holds a symbol hash table. See `Hash Table' in Chapter 5 of System V ABI Update for more information.

.init 

This section holds executable instructions that contribute to the process initialization code. When a program starts to run, the system arranges to execute the code in this section before calling the main program entry point (called main for C programs).

.init_array 

This section holds an array of function pointers that contributes to a single initialization array for the executable or shared object containing the section.

.interp 

This section holds the path name of a program interpreter. If the file has a loadable segment that includes relocation, the sections' attributes will include the SHF_ALLOC bit; otherwise, that bit will be off. See Chapter 5 of System V ABI Update for more information.

.line 

This section holds line number information for symbolic debugging, which describes the correspondence between the source program and the machine code. The contents are unspecified.

.note 

This section holds information in the format that `Note Section' in Chapter 5 of System V ABI Update describes.

.preinit_array 

This section holds an array of function pointers that contributes to a single pre-initialization array for the executable or shared object containing the section.

.rodata 

This section holds read-only data that typically contribute to a non-writable segment in the process image. See `Program Header' in Chapter 5 of System V ABI Update for more information.

.rodata1 

This section holds read-only data that typically contribute to a non-writable segment in the process image. See `Program Header' in Chapter 5 of System V ABI Update for more information.

.shstrtab 

This section holds section names.

.strtab 

This section holds strings, most commonly the strings that represent the names associated with symbol table entries. If the file has a loadable segment that includes the symbol string table, the section's attributes will include the SHF_ALLOC bit; otherwise, that bit will be off.

.symtab 

This section holds a symbol table, as `Symbol Table' in Chapter 4 of System V ABI Update describes. If the file has a loadable segment that includes the symbol table, the section's attributes will include the SHF_ALLOC bit; otherwise, that bit will be off.

.tbss 

This section holds uninitialized thread-local data that contribute to the program's memory image. By definition, the system initializes the data with zeros when the data is instantiated for each new execution flow. The section occupies no file space, as indicated by the section type, SHT_NOBITS. Implementations need not support thread-local storage.

.tdata 

This section holds initialized thread-local data that contributes to the program's memory image. A copy of its contents is instantiated by the system for each new execution flow. Implementations need not support thread-local storage.

.text 

This section holds the `text', or executable instructions, of a program.


10.3.1.2. Additional Special Sections

Object files in an LSB conforming application may also contain one or more of the additional special sections described below.

Table 10-4. Additional Special Sections

NameTypeAttributes
.ctorsSHT_PROGBITSSHF_ALLOC+SHF_WRITE
.data.rel.roSHT_PROGBITSSHF_ALLOC+SHF_WRITE
.dtorsSHT_PROGBITSSHF_ALLOC+SHF_WRITE
.eh_frameSHT_PROGBITSSHF_ALLOC
.eh_frame_hdrSHT_PROGBITSSHF_ALLOC
.gcc_except_tableSHT_PROGBITSSHF_ALLOC
.gnu.versionSHT_GNU_versymSHF_ALLOC
.gnu.version_dSHT_GNU_verdefSHF_ALLOC
.gnu.version_rSHT_GNU_verneedSHF_ALLOC
.got.pltSHT_PROGBITSSHF_ALLOC+SHF_WRITE
.jcrSHT_PROGBITSSHF_ALLOC+SHF_WRITE
.note.ABI-tagSHT_NOTESHF_ALLOC
.stabSHT_PROGBITS0
.stabstrSHT_STRTAB0

.ctors 

This section contains a list of global constructor function pointers.

.data.rel.ro 

This section holds initialized data that contribute to the program's memory image. This section may be made read-only after relocations have been applied.

.dtors 

This section contains a list of global destructor function pointers.

.eh_frame 

This section contains information necessary for frame unwinding during exception handling. See Section 10.6.1.

.eh_frame_hdr 

This section contains a pointer to the .eh_frame section which is accessible to the runtime support code of a C++ application. This section may also contain a binary search table which may be used by the runtime support code to more efficiently access records in the .eh_frame section. See Section 10.6.2.

.gcc_except_table 

This section holds Language Specific Data.

.gnu.version 

This section contains the Symbol Version Table. See Section 10.7.2.

.gnu.version_d 

This section contains the Version Definitions. See Section 10.7.3.

.gnu.version_r 

This section contains the Version Requirements. See Section 10.7.4.

.got.plt 

This section holds the read-only portion of the GLobal Offset Table. This section may be made read-only after relocations have been applied.

.jcr 

This section contains information necessary for registering compiled Java classes. The contents are compiler-specific and used by compiler initialization functions.

.note.ABI-tag 

Specify ABI details. See Section 10.8.

.stab 

This section contains debugging information. The contents are not specified as part of the LSB.

.stabstr 

This section contains strings associated with the debugging infomation contained in the .stab section.


10.4. Symbol Mapping

10.4.1. Introduction

Symbols in a source program are translated by the compilation system into symbols that exist in the object file.


10.4.1.1. C Language

External C symbols shall be unchanged in an object file's symbol table.


10.5. DWARF Extensions

The LSB does not specify debugging information, however, some additional sections contain information which is encoded using the the encoding as specified by DWARF Debugging Information Format, Revision 2.0.0 with extensions defined here.

Note: The extensions specified here also exist in DWARF Debugging Information Format, Revision 3.0.0 (Draft). It is expected that future versions of the LSB will reference the final version of that document, and that the definitions here will be taken from that document instead of being specified here.


10.5.1. DWARF Exception Header Encoding

The DWARF Exception Header Encoding is used to describe the type of data used in the .eh_frame and .eh_frame_hdr section. The upper 4 bits indicate how the value is to be applied. The lower 4 bits indicate the format of the data.

Table 10-5. DWARF Exception Header value format

NameValueMeaning
DW_EH_PE_absptr0x00The Value is a literal pointer whose size is determined by the architecture.
DW_EH_PE_uleb1280x01Unsigned value is encoded using the Little Endian Base 128 (LEB128) as defined by DWARF Debugging Information Format, Revision 2.0.0.
DW_EH_PE_udata20x02A 2 bytes unsigned value.
DW_EH_PE_udata40x03A 4 bytes unsigned value.
DW_EH_PE_udata80x04An 8 bytes unsigned value.
DW_EH_PE_sleb1280x09Signed value is encoded using the Little Endian Base 128 (LEB128) as defined by DWARF Debugging Information Format, Revision 2.0.0.
DW_EH_PE_sdata20x0AA 2 bytes signed value.
DW_EH_PE_sdata40x0BA 4 bytes signed value.
DW_EH_PE_sdata80x0CAn 8 bytes signed value.

Table 10-6. DWARF Exception Header application

NameValueMeaning
DW_EH_PE_pcrel0x10Value is relative to the current program counter.
DW_EH_PE_textrel0x20Value is relative to the beginning of the .text section.
DW_EH_PE_datarel0x30Value is relative to the beginning of the .got or .eh_frame_hdr section.
DW_EH_PE_funcrel0x40Value is relative to the beginning of the function.
DW_EH_PE_aligned0x50Value is aligned to an address unit sized boundary.

One special encoding, 0xff (DW_EH_PE_omit), shall be used to indicate that no value ispresent.


10.5.2. DWARF CFI Extensions

In addition to the Call Frame Instructions defined in section 6.4.2 of DWARF Debugging Information Format, Revision 2.0.0, the following additional Call Frame Instructions may also be used.

Table 10-7. Additional DWARF Call Frame Instructions

NameValueMeaning
DW_CFA_expression0x10The DW_CFA_expression instruction takes two operands: an unsigned LEB128 value representing a register number, and a DW_FORM_block value representing a DWARF expression. The required action is to establish the DWARF expression as the means by which the address in which the given register contents are found may be computed. The value of the CFA is pushed on the DWARF evaluation stack prior to execution of the DWARF expression. The DW_OP_call2, DW_OP_call4, DW_OP_call_ref and DW_OP_push_object_address DWARF operators (see Section 2.4.1 of DWARF Debugging Information Format, Revision 2.0.0) cannot be used in such a DWARF expression.
DW_CFA_offset_extended_sf0x11The DW_CFA_offset_extended_sf instruction takes two operands: an unsigned LEB128 value representing a register number and a signed LEB128 factored offset. This instruction is identical to DW_CFA_offset_extended except that the second operand is signed.
DW_CFA_def_cfa_sf0x12The DW_CFA_def_cfa_sf instruction takes two operands: an unsigned LEB128 value representing a register number and a signed LEB128 factored offset. This instruction is identical to DW_CFA_def_cfa except that the second operand is signed and factored.
DW_CFA_def_cfa_offset_sf0x13The DW_CFA_def_cfa_offset_sf instruction takes a signed LEB128 operand representing a factored offset. This instruction is identical to DW_CFA_def_cfa_offset except that the operand is signed and factored.
DW_CFA_GNU_args_size0x2eThe DW_CFA_GNU_args_size instruction takes an unsigned LEB128 operand representing an argument size. This instruction specifies the total of the size of the arguments which have been pushed onto the stack.
DW_CFA_GNU_negative_offset_extended0x2fThe DW_CFA_def_cfa_sf instruction takes two operands: an unsigned LEB128 value representing a register number and an unsigned LEB128 which represents the magnitude of the offset. This instruction is identical to DW_CFA_offset_extended_sf except that the operand is subtracted to produce the offset. This instructions is obsoleted by DW_CFA_offset_extended_sf.

10.6. Exception Frames

When using languages that support exceptions, such as C++, additional information must be provided to the runtime environment that describes the call frames that must be unwound during the processing of an exception. This information is contained in the special sections .eh_frame and .eh_framehdr.

Note: The format of the .eh_frame section is similar in format and purpose to the .debug_frame section which is specified in DWARF Debugging Information Format, Revision 3.0.0 (Draft). Readers are advised that there are some subtle difference, and care should be taken when comparing the two sections.


10.6.1. The .eh_frame section

The .eh_frame section shall contain 1 or more Call Frame Information (CFI) records. The number of records present shall be determined by size of the section as contained in the section header. Each CFI record contains a Common Information Entry (CIE) record followed by 1 or more Frame Description Entry (FDE) records. Both CIEs and FDEs shall be aligned to an addressing unit sized boundary.

Table 10-8. Call Frame Information Format

Common Information Entry Record
Frame Description Entry Record(s)

10.6.1.1. The Common Information Entry Format

Table 10-9. Common Information Entry Format

LengthRequired
Extended LengthOptional
CIE IDRequired
VersionRequired
Augmentation StringRequired
Code Alignment FactorRequired
Data Alignment FactorRequired
Return Address RegisterRequired
Augmentation Data LengthOptional
Augmentation DataOptional
Initial InstructionsRequired
Padding 

Length

A 4 byte unsigned value indicating the length in bytes of the CIE structure, not including the Length field itself. If Length contains the value 0xffffffff, then the length is contained in the Extended Length field. If Length contains the value 0, then this CIE shall be considered a terminator and processing shall end.

Extended Length

A 8 byte unsigned value indicating the length in bytes of the CIE structure, not including the Length and Extended Length fields.

CIE ID

A 4 byte unsigned value that is used to distinguish CIE records from FDE records. This value shall always be 0, which indicates this record is a CIE.

Version

A 1 byte value that identifies the version number of the frame information structure. This value shall be 1.

Augmentation String

This value is a NUL terminated string that identifies the augmentation to the CIE or to the FDEs associated with this CIE. A zero length string indicates that no augmentation data is present. The augmentation string is case sensitive and shall be interpreted as described below.

Code Alignment Factor

An unsigned LEB128 encoded value that is factored out of all advance location instructions that are associated with this CIE or its FDEs. This value shall be multiplied by the delta argument of an adavance location instruction to obtain the new location value.

Data Alignment Factor

A signed LEB128 encoded value that is factored out of all offset instructions that are associated with this CIE or its FDEs. This value shall be multiplied by the register offset argument of an offset instruction to obtain the new offset value.

Augmentation Length

An unsigned LEB128 encoded value indicating the length in bytes of the Augmentation Data. This field is only present if the Augmentation String contains the character 'z'.

Augmentation Data

A block of data whose contents are defined by the contents of the Augmentation String as described below. This field is only present if the Augmentation String contains the character 'z'. The size of this data is given by the Augentation Length.

Initial Instructions

Initial set of Call Frame Instructions. The number of instructions is determined by the remaining space in the CIE record.

Padding

Extra bytes to align the CIE structure to an addressing unit size boundary.


10.6.1.1.1. Augmentation String Format

The Agumentation String indicates the presence of some optional fields, and how those fields should be intepreted. This string is case sensitive. Each character in the augmentation string in the CIE can be interpreted as below:

'z' 

A 'z' may be present as the first character of the string. If present, the Augmentation Data field shall be present. The contents of the Augmentation Data shall be intepreted according to other characters in the Augmentation String.

'L' 

A 'L' may be present at any position after the first character of the string. This character may only be present if 'z' is the first character of the string. If present, it indicates the presence of one argument in the Augmentation Data of the CIE, and a corresponding argument in the Augmentation Data of the FDE. The argument in the Augmentation Data of the CIE is 1-byte and represents the pointer encoding used for the argument in the Augmentation Data of the FDE, which is the address of a language-specific data area (LSDA). The size of the LSDA pointer is specified by the pointer encoding used.

'P' 

A 'P' may be present at any position after the first character of the string. This character may only be present if 'z' is the first character of the string. If present, it indicates the presence of two arguments in the Augmentation Data of the CIE. The first argument is 1-byte and represents the pointer encoding used for the second argument, which is the address of a personality routine handler. The personality routine is used to handle language and vendor-specific tasks. The system unwind library interface accesses the language-specific exception handling semantics via the pointer to the personality routine. The personality routine does not have an ABI-specific name. The size of the personality routine pointer is specified by the pointer encoding used.

'R' 

A 'R' may be present at any position after the first character of the string. This character may only be present if 'z' is the first character of the string. If present, The Augmentation Data shall include a 1 byte argument that represents the pointer encoding for the address pointers used in the FDE.


10.6.1.2. The Frame Description Entry Format

Table 10-10. Frame Description Entry Format

LengthRequired
Extended LengthOptional
CIE PointerRequired
PC BeginRequired
PC RangeRequired
Augmentation Data LengthOptional
Augmentation DataOptional
Call Frame InstructionsRequired
Padding 

Length

A 4 byte unsigned value indicating the length in bytes of the CIE structure, not including the Length field itself. If Length contains the value 0xffffffff, then the length is contained the Extended Length field. If Length contains the value 0, then this CIE shall be considered a terminator and processing shall end.

Extended Length

A 8 byte unsigned value indicating the length in bytes of the CIE structure, not including the Length field itself.

CIE Pointer

A 4 byte unsigned value that when subtracted from the offset of the the CIE Pointer in the current FDE yields the offset of the start of the associated CIE. This value shall never be 0.

PC Begin

An encoded value that indicates the address of the initial location associated with this FDE. The encoding format is specified in the Augmentation Data.

PC Range

An absolute value that indicates the number of bytes of instructions associated with this FDE.

Augmentation Length

An unsigned LEB128 encoded value indicating the length in bytes of the Augmentation Data. This field is only present if the Augmentation String in the associated CIE contains the character 'z'.

Augmentation Data

A block of data whose contents are defined by the contents of the Augmentation String in the associated CIE as described above. This field is only present if the Augmentation String in the associated CIE contains the character 'z'. The size of this data is given by the Augentation Length.

Call Frame Instructions

A set of Call Frame Instructions.

Padding

Extra bytes to align the FDE structure to an addressing unit size boundary.


10.6.2. The .eh_frame_hdr section

The .eh_frame_hdr section contains additional information about the .eh_frame section. A pointer to the start of the .eh_frame data, and optionally, a binary search table of pointers to the .eh_frame records are found in this section.

Data in this section is encoded according to Section 10.5.1.

Table 10-11. .eh_frame_hdr Section Format

EncodingField
unsigned byteversion
unsigned byteeh_frame_ptr_enc
unsigned bytefde_count_enc
unsigned bytetable_enc
encodedeh_frame_ptr
encodedfde_count
 binary search table

version 

Version of the .eh_frame_hdr format. This value shall be 1.

eh_frame_ptr_enc 

The encoding format of the eh_frame_ptr field.

fde_count_enc 

The encoding format of the fde_count field. A value of DW_EH_PE_omit indicates the binary search table is not present.

table_enc 

The encoding format of the entries in the binary search table. A value of DW_EH_PE_omit indicates the binary search table is not present.

eh_frame_ptr 

The encoded value of the pointer to the start of the .eh_frame section.

fde_count 

The encoded value of the count of entries in the binary search table.

binary search table 

A binary search table containing fde_count entries. Each entry of the table consist of two encoded values, the initial location, and the address. The entries are sorted in an increasing order by the initial location value.


10.7. Symbol Versioning

10.7.1. Introduction

This chapter describes the Symbol Versioning mechanism. All ELF objects may provide or depend on versioned symbols. Symbol Versioning is implemented by 3 section types: SHT_GNU_versym, SHT_GNU_verdef, and SHT_GNU_verneed.

The prefix Elfxx in the following descriptions and code fragments stands for either "Elf32" or "Elf64", depending on the architecture.

Versions are described by strings. The structures that are used for symbol versions also contain a member that holds the ELF hashing values of the strings. This allows for more efficient processing.


10.7.2. Symbol Version Table

The special section .gnu.version which has a section type of SHT_GNU_versym shall contain the Symbol Version Table. This section shall have the same number of entries as the Dynamic Symbol Table in the .dynsym section.

The .gnu.version section shall contain an array of elements of type Elfxx_Half. Each entry specifies the version defined for or required by the corresponding symbol in the Dynamic Symbol Table.

The values in the Symbol Version Table are specific to the object in which they are located. These values are identifiers that are provided by the the vna_other member of the Elfxx_Vernaux structure or the vd_ndx member of the Elfxx_Verdef structure.

The values 0 and 1 are reserved.

0 

The symbol is local, not available outside the object.

1 

The symbol is defined in this object and is globally available.

All other values are used to identify version strings located in one of the other Symbol Version sections. The value itself is not the version associated with the symbol. The string identified by the value defines the version of the symbol.


10.7.3. Version Definitions

The special section .gnu.version_d which has a section type of SHT_GNU_verdef shall contain symbol version definitions. The number of entries in this section shall be contained in the DT_VERDEFNUM entry of the Dynamic Section .dynamic. The sh_link member of the section header (see figure 4-8 in the System V ABI) shall point to the section that contains the strings referenced by this section.

The section shall contain an array of Elfxx_Verdef structures, as described in Figure 10-1, optionally followed by an array of Elfxx_Verdaux structures, as defined in Figure 10-2.

typedef struct {
	Elfxx_Half    vd_version;
	Elfxx_Half    vd_flags;
	Elfxx_Half    vd_ndx;
	Elfxx_Half    vd_cnt;
	Elfxx_Word    vd_hash;
	Elfxx_Word    vd_aux;
	Elfxx_Word    vd_next;
} Elfxx_Verdef;

Figure 10-1. Version Definition Entries

vd_version 

Version revision. This field shall be set to 1.

vd_flags 

Version information flag bitmask.

vd_ndx 

Version index numeric value referencing the SHT_GNU_versym section.

vd_cnt 

Number of associated verdaux array entries.

vd_hash 

Version name hash value (ELF hash function).

vd_aux 

Offset in bytes to a corresponding entry in an array of Elfxx_Verdaux structures as defined in Figure 10-2

vd_next 

Offset to the next verdef entry, in bytes.

typedef struct {
	Elfxx_Word    vda_name;
	Elfxx_Word    vda_next;
} Elfxx_Verdaux;

Figure 10-2. Version Definition Auxiliary Entries

vda_name 

Offset to the version or dependency name string in the section header, in bytes.

vda_next 

Offset to the next verdaux entry, in bytes.


10.7.4. Version Requirements

The special section .gnu.version_r which has a section type of SHT_GNU_verneed shall contain required symbol version definitions. The number of entries in this section shall be contained in the DT_VERNEEDNUM entry of the Dynamic Section .dynamic. The sh_link member of the section header (see figure 4-8 in System V ABI) shall point to the section that contains the strings referenced by this section.

The section shall contain an array of Elfxx_Verneed structures, as described in Figure 10-3, optionally followed by an array of Elfxx_Vernaux structures, as defined in Figure 10-4.

typedef struct {
	Elfxx_Half    vn_version;
	Elfxx_Half    vn_cnt;
	Elfxx_Word    vn_file;
	Elfxx_Word    vn_aux;
	Elfxx_Word    vn_next;
} Elfxx_Verneed;

Figure 10-3. Version Needed Entries

vn_version 

Version of structure. This value is currently set to 1, and will be reset if the versioning implementation is incompatibly altered.

vn_cnt 

Number of associated verneed array entries.

vn_file 

Offset to the file name string in the section header, in bytes.

vn_aux 

Offset to a corresponding entry in the vernaux array, in bytes.

vn_next 

Offset to the next verneed entry, in bytes.

typedef struct {
	Elfxx_Word    vna_hash;
	Elfxx_Half    vna_flags;
	Elfxx_Half    vna_other;
	Elfxx_Word    vna_name;
	Elfxx_Word    vna_next;
} Elfxx_Vernaux;

Figure 10-4. Version Needed Auxiliary Entries

vna_hash 

Dependency name hash value (ELF hash function).

vna_flags 

Dependency information flag bitmask.

vna_other 

Object file version identifier used in the .gnu.version symbol version array. Bit number 15 controls whether or not the object is hidden; if this bit is set, the object cannot be used and the static linker will ignore the symbol's presence in the object.

vna_name 

Offset to the dependency name string in the section header, in bytes.

vna_next 

Offset to the next vernaux entry, in bytes.


10.7.5. Startup Sequence

When loading a sharable object the system shall analyze version definition data from the loaded object to assure that it meets the version requirements of the calling object. This step is referred to as definition testing. The dynamic loader shall retrieve the entries in the caller's Elfxx_Verneed array and attempt to find matching definition information in the loaded Elfxx_Verdef table.

Each object and dependency shall be tested in turn. If a symbol definition is missing and the vna_flags bit for VER_FLG_WEAK is not set, the loader shall return an error and exit. If the vna_flags bit for VER_FLG_WEAK is set in the Elfxx_Vernaux entry, and the loader shall issue a warning and continue operation.

When the versions referenced by undefined symbols in the loaded object are found, version availability is certified. The test completes without error and the object shall be made available.


10.7.6. Symbol Resolution

When symbol versioning is used in an object, relocations extend definition testing beyond the simple match of symbol name strings: the version of the reference shall also equal the name of the definition.

The same index that is used in the symbol table can be referenced in the SHT_GNU_versym section, and the value of this index is then used to acquire name data. The corresponding requirement string is retrieved from the Elfxx_Verneed array, and likewise, the corresponding definition string from the Elfxx_Verdef table.

If the high order bit (bit number 15) of the version symbolis set, the object cannot be used and the static linker shall ignore the symbol's presence in the object.

When an object with a reference and an object with the definition are being linked, the following rules shall govern the result:

  • The object with the reference and the object with the definitions both use versioning. All described matching is processed in this case. A fatal error shall be triggered when no matching definition can be found in the object whose name is the one referenced by the vn_name element in the Elfxx_Verneed entry.

  • The object with the reference does not use versioning, while the object with the definitions does. In this instance, only the definitions with index numbers 1 and 2 will be used in the reference match, the same identified by the static linker as the base definition. In cases where the static linker was not used, such as in calls to dlopen(), a version that does not have the base definition index shall be acceptable if it is the only version for which the symbol is defined.

  • The object with the reference uses versioning, but the object with the definitions specifies none. A matching symbol shall be accepted in this case. A fatal error shall be triggered if a corruption in the required symbols list obscures an outdated object file and causes a match on the object filename in the Elfxx_Verneed entry.

  • Neither the object with the reference nor the object with the definitions use versioning. The behavior in this instance shall default to pre-existing symbol rules.


10.8. ABI note tag

Every executable shall contain a section named .note.ABI-tag of type SHT_NOTE. This section is structured as a note section as documented in the ELF spec. The section shall contain at least the following entry. The name field (namesz/name) contains the string "GNU". The type field shall be 1. The descsz field shall be at least 16, and the first 16 bytes of the desc field shall be as follows.

The first 32-bit word of the desc field shall be 0 (this signifies a Linux executable). The second, third, and fourth 32-bit words of the desc field contain the earliest compatible kernel version. For example, if the 3 words are 2, 2, and 5, this signifies a 2.2.5 kernel.


Chapter 11. Dynamic Linking

11.1. Program Loading and Dynamic Linking

LSB-conforming implementations shall support the object file information and system actions that create running programs as specified in the System V ABI and System V ABI Update and as further required by this specification and the relevant architecture specific part of ISO/IEC 23360.

Any shared object that is loaded shall contain sufficient DT_NEEDED records to satisfy the symbols on the shared library.


11.2. Program Header

In addition to the Segment Types defined in the System V ABI and System V ABI Update the following Segment Types shall also be supported.

Table 11-1. Linux Segment Types

NameValue
PT_GNU_EH_FRAME0x6474e550
PT_GNU_STACK0x6474e551
PT_GNU_RELRO0x6474e552

PT_GNU_EH_FRAME 

The array element specifies the location and size of the exception handling information as defined by the .eh_frame_hdr section.

PT_GNU_STACK 

The p_flags member specifies the permissions on the segment containing the stack and is used to indicate wether the stack should be executable. The absense of this header indicates that the stack will be executable.

PT_GNU_RELRO 

the array element specifies the location and size of a segment which may be made read-only after relocations have been processed.


11.3. Dynamic Entries

11.3.1. Introduction

As described in System V ABI, if an object file participates in dynamic linking, its program header table shall have an element of type PT_DYNAMIC. This `segment' contains the .dynamic section. A special symbol, _DYNAMIC, labels the section, which contains an array of the following structures.

typedef struct {
	Elf32_Sword	d_tag;
   	union {
   		Elf32_Word	d_val;
   		Elf32_Addr	d_ptr;
	} d_un;
} Elf32_Dyn;

extern Elf32_Dyn	_DYNAMIC[];

typedef struct {
	Elf64_Sxword	d_tag;
   	union {
   		Elf64_Xword	d_val;
   		Elf64_Addr	d_ptr;
	} d_un;
} Elf64_Dyn;

extern Elf64_Dyn	_DYNAMIC[];

Figure 11-1. Dynamic Structure

For each object with this type, d_tag controls the interpretation of d_un.


11.3.2. Dynamic Entries


11.3.2.1. ELF Dynamic Entries

The following dynamic entries are defined in the System V ABI and System V ABI Update.

DT_BIND_NOW 

Process relocations of object

DT_DEBUG 

For debugging; unspecified

DT_FINI 

Address of termination function

DT_FINI_ARRAY 

The address of an array of pointers to termination functions.

DT_FINI_ARRAYSZ 

Size in bytes of DT_FINI_ARRAY

DT_FLAGS 

Flag values specific to the object being loaded

DT_HASH 

Address of symbol hash table

DT_HIPROC 

End of processor-specific

DT_INIT 

Address of init function

DT_INIT_ARRAY 

The address of an array of pointers to initialization functions.

DT_INIT_ARRAYSZ 

Size in bytes of DT_INIT_ARRAY

DT_JMPREL 

Address of PLT relocs

DT_LOPROC 

Start of processor-specific

DT_NEEDED 

Name of needed library

DT_NULL 

Marks end of dynamic section

DT_PLTREL 

Type of reloc in PLT

DT_PLTRELSZ 

Size in bytes of PLT relocs

DT_PREINIT_ARRAY 

Array with addresses of preinit functions

DT_PREINIT_ARRAYSZ 

Size in bytes of DT_PREINIT_ARRAY

DT_REL 

Address of Rel relocs

DT_RELA 

Address of Rela relocs

DT_RELAENT 

Size of one Rela reloc

DT_RELASZ 

Total size of Rela relocs

DT_RELENT 

Size of one Rel reloc

DT_RELSZ 

Total size of Rel relocs

DT_RPATH 

Library search path

DT_RUNPATH 

null-terminated library search path string

DT_SONAME 

Name of shared object

DT_STRSZ 

Size of string table

DT_STRTAB 

Address of string table

DT_SYMBOLIC 

Start symbol search here

DT_SYMENT 

Size of one symbol table entry

DT_SYMTAB 

Address of symbol table

DT_TEXTREL 

Reloc might modify .text


11.3.2.2. Additional Dynamic Entries

An LSB conforming object may also use the following additional Dynamic Entry types.

DT_ADDRRNGHI 

Values from DT_ADDRRNGLO through DT_ADDRRNGHI are reserved for definition by an archLSB.

DT_ADDRRNGLO 

Values from DT_ADDRRNGLO through DT_ADDRRNGHI are reserved for definition by an archLSB.

DT_AUXILIARY 

Shared object to load before self

DT_FILTER 

Shared object to get values from

DT_HIOS 

Values from DT_LOOS through DT_HIOS are reserved for definition by specific operating systems.

DT_LOOS 

Values from DT_LOOS through DT_HIOS are reserved for definition by specific operating systems.

DT_NUM 

Number of dynamic entry tags defined (excepting reserved ranges).

DT_POSFLAG_1 

Flags for DT_* entries, effecting the following DT_* entry

DT_RELCOUNT 

All Elf32_Rel R_*_RELATIVE relocations have been placed into a single block and this entry specifies the number of entries in that block. This permits ld.so.1 to streamline the processing of RELATIVE relocations.

DT_SYMINENT 

Entry size of syminfo

DT_SYMINFO 

Address of the Syminfo table.

DT_SYMINSZ 

Size of syminfo table (in bytes)

DT_VALRNGHI 

Entries which fall between DT_VALRNGHI & DT_VALRNGLO use the Dyn.d_un.d_val field of the Elf*_Dyn structure.

DT_VALRNGLO 

Entries which fall between DT_VALRNGHI & DT_VALRNGLO use the Dyn.d_un.d_val field of the Elf*_Dyn structure.

DT_VERDEF 

Address of version definition table

DT_VERDEFNUM 

Number of version definitions

DT_VERNEED 

Address of table with needed versions

DT_VERNEEDNUM 

Number of needed versions

DT_VERSYM 

Address of the table provided by the .gnu.version section.

III. Base Libraries

Table of Contents
12. Base Libraries
12.1. Introduction
12.2. Program Interpreter
12.3. Interfaces for libc
12.3.1. RPC
12.3.2. Epoll
12.3.3. System Calls
12.3.4. Standard I/O
12.3.5. Signal Handling
12.3.6. Localization Functions
12.3.7. Posix Spawn Option
12.3.8. Posix Advisory Option
12.3.9. Socket Interface
12.3.10. Wide Characters
12.3.11. String Functions
12.3.12. IPC Functions
12.3.13. Regular Expressions
12.3.14. Character Type Functions
12.3.15. Time Manipulation
12.3.16. Terminal Interface Functions
12.3.17. System Database Interface
12.3.18. Language Support
12.3.19. Large File Support
12.3.20. Inotify
12.3.21. Standard Library
12.3.22. GNU Extensions for libc
12.4. Data Definitions for libc
12.4.1. arpa/inet.h
12.4.2. assert.h
12.4.3. cpio.h
12.4.4. ctype.h
12.4.5. dirent.h
12.4.6. elf.h
12.4.7. endian.h
12.4.8. err.h
12.4.9. errno.h
12.4.10. execinfo.h
12.4.11. fcntl.h
12.4.12. fmtmsg.h
12.4.13. fnmatch.h
12.4.14. ftw.h
12.4.15. getopt.h
12.4.16. glob.h
12.4.17. gnu/libc-version.h
12.4.18. grp.h
12.4.19. iconv.h
12.4.20. inttypes.h
12.4.21. langinfo.h
12.4.22. libgen.h
12.4.23. libintl.h
12.4.24. limits.h
12.4.25. link.h
12.4.26. locale.h
12.4.27. monetary.h
12.4.28. net/if.h
12.4.29. netdb.h
12.4.30. netinet/icmp6.h
12.4.31. netinet/igmp.h
12.4.32. netinet/in.h
12.4.33. netinet/in_systm.h
12.4.34. netinet/ip.h
12.4.35. netinet/ip6.h
12.4.36. netinet/ip_icmp.h
12.4.37. netinet/tcp.h
12.4.38. netinet/udp.h
12.4.39. nl_types.h
12.4.40. poll.h
12.4.41. pty.h
12.4.42. pwd.h
12.4.43. regex.h
12.4.44. rpc/auth.h
12.4.45. rpc/clnt.h
12.4.46. rpc/pmap_clnt.h
12.4.47. rpc/rpc_msg.h
12.4.48. rpc/svc.h
12.4.49. rpc/types.h
12.4.50. rpc/xdr.h
12.4.51. sched.h
12.4.52. search.h
12.4.53. setjmp.h
12.4.54. signal.h
12.4.55. spawn.h
12.4.56. stddef.h
12.4.57. stdint.h
12.4.58. stdio.h
12.4.59. stdlib.h
12.4.60. string.h
12.4.61. strings.h
12.4.62. sys/epoll.h
12.4.63. sys/file.h
12.4.64. sys/inotify.h
12.4.65. sys/ioctl.h
12.4.66. sys/ipc.h
12.4.67. sys/mman.h
12.4.68. sys/msg.h
12.4.69. sys/param.h
12.4.70. sys/poll.h
12.4.71. sys/ptrace.h
12.4.72. sys/resource.h
12.4.73. sys/select.h
12.4.74. sys/sem.h
12.4.75. sys/sendfile.h
12.4.76. sys/shm.h
12.4.77. sys/socket.h
12.4.78. sys/stat.h
12.4.79. sys/statfs.h
12.4.80. sys/statvfs.h
12.4.81. sys/sysinfo.h
12.4.82. sys/time.h
12.4.83. sys/timeb.h
12.4.84. sys/times.h
12.4.85. sys/types.h
12.4.86. sys/uio.h
12.4.87. sys/un.h
12.4.88. sys/utsname.h
12.4.89. sys/wait.h
12.4.90. syslog.h
12.4.91. tar.h
12.4.92. termios.h
12.4.93. time.h
12.4.94. ucontext.h
12.4.95. ulimit.h
12.4.96. unistd.h
12.4.97. utime.h
12.4.98. utmp.h
12.4.99. utmpx.h
12.4.100. wchar.h
12.4.101. wctype.h
12.4.102. wordexp.h
12.5. Interface Definitions for libc
_IO_feof -- alias for feof
_IO_getc -- alias for getc
_IO_putc -- alias for putc
_IO_puts -- alias for puts
__assert_fail -- abort the program after false assertion
__chk_fail -- terminate a function in case of buffer overflow
__confstr_chk -- get configuration dependent string variables, with buffer overflow checking
__ctype_b_loc -- accessor function for __ctype_b array for ctype functions
__ctype_get_mb_cur_max -- maximum length of a multibyte character in the current locale
__ctype_tolower_loc -- accessor function for __ctype_b_tolower array for ctype tolower() function
__ctype_toupper_loc -- accessor function for __ctype_b_toupper() array for ctype toupper() function
__cxa_atexit -- register a function to be called by exit or when a shared library is unloaded
__cxa_finalize -- call destructors of global (or local static) C++ objects and exit functions registered with atexit
__daylight -- external daylight savings time flag
__environ -- alias for environ - user environment
__errno_location -- address of errno variable
__fgets_chk -- string input, with buffer overflow checking
__fgets_unlocked_chk -- non-locking string input, with buffer overflow checking
__fgetws_chk -- read a wide-character string from a FILE stream, with buffer overflow checking
__fgetws_unlocked_chk -- read a wide-character string from a FILE stream in a non-locking manner, with stack checking
__fpending -- returns in bytes the amount of output pending on a stream
__fprintf_chk -- convert formatted output, with stack checking
__fwprintf_chk -- convert formatted wide-character output, with stack checking
__fxstatat -- get file status relative to directory file descriptor
__fxstatat64, fstatat64 -- get file status relative to a directory file descriptor (Large File Support)
__getcwd_chk -- get current working directory, with buffer overflow checking
__getgroups_chk -- get list of supplementary group IDs, with buffer overflow checking
__gethostname_chk -- get host name, with buffer overflow checking
__getlogin_r_chk -- get user name, with buffer overflow checking (reentrant)
__getpagesize -- alias for getpagesize - get current page size
__getpgid -- get the process group id
__h_errno_location -- address of h_errno variable
__isinf -- test for infinity
__isinff -- test for infinity
__isinfl -- test for infinity
__isnan -- test for infinity
__isnanf -- test for infinity
__isnanl -- test for infinity
__libc_current_sigrtmax -- return number of available real-time signal with lowest priority
__libc_current_sigrtmin -- return number of available real-time signal with highest priority
__libc_start_main -- initialization routine
__mbsnrtowcs_chk -- convert a multibyte string to a wide-character string, with buffer overflow checking
__mbsrtowcs_chk -- convert a multibyte string to a wide-character string, with buffer overflow checking
__mbstowcs_chk -- convert a multibyte string to a wide-character string, with buffer overflow checking
__memcpy_chk -- copy memory area, with buffer overflow checking
__memmove_chk -- copy memory area, with buffer overflow checking
__mempcpy -- copy given number of bytes of source to destination
__mempcpy_chk -- copy memory area, with buffer overflow checking
__memset_chk -- fill memory with a constant byte, using buffer overflow checking
__pread64_chk -- read from a file descriptor at a given offset, with buffer overflow checking
__pread_chk -- read from a file descriptor at a given offset, with buffer overflow checking
__printf_chk -- format and print data, with stack checking
__rawmemchr -- scan memory
__read_chk -- read from a file descriptor, with buffer overflow checking
__readlink_chk -- display value of a symbolic link, with buffer overflow checking
__realpath_chk -- return the canonicalized absolute pathname, with buffer overflow checking
__recv_chk -- receive a message from a socket, with buffer overflow checking
__recvfrom_chk -- receive a message from a socket, with buffer overflow checking
__register_atfork -- alias for register_atfork
__sigsetjmp -- save stack context for non-local goto
__snprintf_chk -- convert formatted output, with buffer overflow checking
__sprintf_chk -- convert formatted output, with stack checking
__stack_chk_fail -- terminate a function in case of stack overflow
__stpcpy -- alias for stpcpy
__stpcpy_chk -- copy a string returning a pointer to its end, with buffer overflow checking
__stpncpy_chk -- copy a fixed-size string, returning a pointer to its end, with buffer overflow checking
__strcat_chk -- concatenate two strings, with buffer overflow checking
__strcpy_chk -- copy a string, with buffer overflow checking
__strdup -- alias for strdup
__strncat_chk -- concatenate two strings, with buffer overflow checking
__strncpy_chk -- copy a string, with buffer overflow checking
__strtod_internal -- underlying function for strtod
__strtof_internal -- underlying function for strtof
__strtok_r -- alias for strtok_r
__strtol_internal -- alias for strtol
__strtold_internal -- underlying function for strtold
__strtoll_internal -- underlying function for strtoll
__strtoul_internal -- underlying function for strtoul
__strtoull_internal -- underlying function for strtoull
__swprintf_chk -- convert formatted wide-character output, with stack checking
__sysconf -- get configuration information at runtime
__syslog_chk -- send messages to the system logger, with stack checking
__sysv_signal -- signal handling
__timezone -- external variable containing timezone
__ttyname_r_chk -- return name of a terminal, with buffer overflow checking (reentrant)
__tzname -- external variable containing the timezone names
__vfprintf_chk -- convert formatted output, with stack checking
__vfwprintf_chk -- convert formatted wide-character output, with stack checking
__vprintf_chk -- convert formatted output, with stack checking
__vsnprintf_chk -- convert formatted output, with stack checking
__vsprintf_chk -- convert formatted output, with stack checking
__vswprintf_chk -- convert formatted wide-character output, with stack checking
__vsyslog_chk -- send messages to the system logger, with stack checking
__vwprintf_chk -- convert formatted wide-character output, with stack checking
__wcpcpy_chk -- copy a wide-character string, returning a pointer to its end, with buffer overflow checking
__wcpncpy_chk -- copy a fixed-size string of wide characters, returning a pointer to its end, with buffer overflow checking
__wcrtomb_chk -- convert a wide character to a multibyte sequence, with buffer overflow checking
__wcscat_chk -- concatenate two wide-character strings, with buffer overflow checking
__wcscpy_chk -- copy a wide-character string, with buffer overflow checking
__wcsncat_chk -- concatenate two wide-character strings, with buffer overflow checking
__wcsncpy_chk -- copy a fixed-size string of wide characters, with buffer overflow checking
__wcsnrtombs_chk -- convert a wide-character string to a multibyte string, with buffer overflow checking
__wcsrtombs_chk -- convert a wide-character string to a multibyte string, with buffer overflow checking
__wcstod_internal -- underlying function for wcstod
__wcstof_internal -- underlying function for wcstof
__wcstol_internal -- underlying function for wcstol
__wcstold_internal -- underlying function for wcstold
__wcstombs_chk -- convert a wide-character string to a multibyte string, with buffer overflow checking
__wcstoul_internal -- underlying function for wcstoul
__wctomb_chk -- convert a wide character to a multibyte sequence, with buffer overflow checking
__wmemcpy_chk -- copy an array of wide-characters, with buffer overflow checking
__wmemmove_chk -- copy an array of wide-characters, with buffer overflow checking
__wmempcpy_chk -- copy memory area, with buffer overflow checking
__wmemset_chk -- fill an array of wide-characters with a constant wide character, with buffer overflow checking
__wprintf_chk -- convert formatted wide-character output, with stack checking
__xmknod -- make a special file
__xmknodat -- make a special file relative to a directory file descriptor
__xpg_basename -- return the last component of a file name
__xpg_sigpause -- remove a signal from the signal mask and suspend the thread
__xpg_strerror_r -- return string describing error number
__xstat -- get File Status
__xstat64 -- get File Status
_environ -- alias for environ - user environment
_nl_msg_cat_cntr -- new catalog load counter
_sys_errlist -- array containing the "C" locale strings used by strerror()
_sys_siglist -- array containing the names of the signal names
acct -- switch process accounting on or off
adjtime -- correct the time to allow synchronization of the system clock
alphasort64 -- Comparison function for directory scanning (Large File Support)
asprintf -- write formatted output to a dynamically allocated string
backtrace, backtrace_symbols, backtrace_symbols_fd -- runtime stack back tracing
basename -- return the last component of a file name
bind_textdomain_codeset -- specify encoding for message retrieval
bindresvport -- bind socket to privileged IP port
bindtextdomain -- specify the location of a message catalog
cfmakeraw -- get and set terminal attributes
cfsetspeed -- set terminal input and output data rate
clearerr_unlocked -- non-thread-safe clearerr
daemon -- run in the background
dcgettext -- perform domain and category specific lookup in message catalog
dcngettext -- perform domain and category specific lookup in message catalog with plural
dgettext -- perform lookup in message catalog for the current LC_MESSAGES locale
dl_iterate_phdr -- iterate over a program's loaded shared objects
dngettext -- perform lookup in message catalog for the current locale
drand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
duplocale -- provide new handle for selection of locale
endutent -- access utmp file entries
epoll_create -- open an epoll file descriptor
epoll_ctl -- control an epoll file descriptor
epoll_wait -- wait for I/O events on an epoll file descriptor
erand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
err -- display formatted error messages
error -- print error message
errx -- display formatted error message and exit
fcntl -- file control
feof_unlocked -- non-thread-safe feof
ferror_unlocked -- non-thread-safe ferror
fflush_unlocked -- non thread safe fflush
fgetc_unlocked -- non-thread-safe fgetc
fgets_unlocked -- non-thread-safe fgets
fgetwc_unlocked -- non thread safe fgetwc
fgetws_unlocked -- non-thread-safe fgetws
fileno_unlocked -- non-thread-safe fileno
flock -- apply or remove an advisory lock on an open file
fputc_unlocked -- non-thread-safe fputc
fputs_unlocked -- non-thread-safe fputs
fputwc_unlocked -- non-thread-safe fputwc
fputws_unlocked -- non-thread-safe fputws
fread_unlocked -- non-thread-safe fread
freelocale -- free a locale object
fscanf -- convert formatted input
fstatfs -- (deprecated)
fstatfs64 -- (deprecated)
fwrite_unlocked -- non-thread-safe fwrite
fwscanf -- convert formatted input
getdomainname -- get NIS domain name (DEPRECATED).
getdtablesize -- get file descriptor table size (DEPRECATED)
getgrent_r -- reentrantly get entry in group file
getgrouplist -- get groups a user belongs to
gethostbyaddr_r -- find network host database entry matching host name (DEPRECATED)
gethostbyname2 -- find network host database entry matching host name (DEPRECATED)
gethostbyname2_r -- find network host database entry matching host name (DEPRECATED)
gethostbyname_r -- find network host database entry matching host name (DEPRECATED)
getloadavg -- get system load averages
getopt -- parse command line options
getopt_long -- parse command line options
getopt_long_only -- parse command line options
getpagesize -- get memory page size (DEPRECATED)
getprotobyname_r -- retrieve information from the network protocol database by protocol name, reentrantly
getprotobynumber_r -- retrieve information from the network protocol database by protocol number, reentrantly
getprotoent_r -- read the next entry of the protocol database, reentrantly
getpwent_r -- reentrantly get entry in passwd file
getservbyname_r -- retrieve information from the network services database by service name, reentrantly
getservbyport_r -- retrieve information from the network services database by service port, reentrantly
getservent_r -- read the next entry of the network services database, reentrantly
getsockopt -- get socket options
gettext -- search message catalogs for a string
getutent -- access user accounting database entries
getutent_r -- access user accounting database entries
getwc_unlocked -- non-thread-safe getwc
getwchar_unlocked -- non-thread-safe getwchar
glob64 -- find pathnames matching a pattern (Large File Support)
globfree64 -- free memory from glob64() (Large File Support)
gnu_get_libc_version, gnu_get_libc_release -- get glibc-specific version and release
hcreate_r -- allocate space for a hash search table, reentrantly
hdestroy_r -- dispose of a hash search table, reentrantly
hsearch_r -- search a hash table, reentrantly
inet_aton -- Internet address manipulation routine
initgroups -- initialize the supplementary group access list
initstate_r -- reentrantly initialize a state array for random number generator functions
inotify_add_watch -- add a watch to a watch list
inotify_init -- instantiate inotify
inotify_rm_watch -- remove a watch from an inotify watch list
ioctl -- control device
sockio -- socket ioctl commands
ttyio -- tty ioctl commands
jrand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
kill -- send a signal
lcong48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
link -- create a link to a file
lrand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
mbsnrtowcs -- convert a multibyte string to a wide character string
memmem -- locate bytes
memrchr -- scan memory for a character
mkstemp64 -- create a unique temporary file (Large File Support)
mrand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
mremap -- remap a virtual memory address
newlocale -- allocate a locale object
ngettext -- search message catalogs for plural string
nrand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
openat64 -- open a file relative to a directory file descriptor (Large File Support)
pmap_getport -- find the port number assigned to a service registered with a portmapper.
pmap_set -- establishes mapping to machine's RPC Bind service.
pmap_unset --  destroys RPC Binding
posix_fadvise64 -- File advisory information (Large File Support)
posix_fallocate64 -- file space control (Large File Support)
pread64 -- read from a file (Large File Support)
psignal -- print signal message
ptrace -- process trace
putwc_unlocked -- non-thread-safe putwc
putwchar_unlocked -- non-thread-safe putwchar
pwrite64 -- write on a file (Large File Support)
random_r -- reentrantly generate pseudorandom numbers in a uniform distribution
readdir64_r -- read a directory (Large File Support)
regexec -- regular expression matching
scandir64 -- scan a directory (Large File Support)
scanf -- convert formatted input
sched_getaffinity -- retrieve the affinity mask of a process
sched_setaffinity -- set the CPU affinity mask for a process
sched_setscheduler -- set scheduling policy and parameters
seed48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
sendfile -- transfer data between two file descriptors
sendfile64 -- transfer data between two file descriptors (Large File Support)
setbuffer -- stream buffering operation
setgroups -- set list of supplementary group IDs
sethostname -- set host name
setsockopt -- set socket options
setstate_r -- reentrantly change the state array used by random number generator functions
setutent -- access user accounting database entries
sigandset -- build a new signal set by combining the two input sets using logical AND
sigisemptyset -- check for empty signal set
sigorset -- build a new signal set by combining the two input sets using logical OR
sigpause -- remove a signal from the signal mask and suspend the thread (deprecated)
sigreturn -- return from signal handler and cleanup stack frame
srand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
srandom_r -- reentrantly set the seed for a new sequence of pseudorandom numbers
sscanf -- convert formatted input
statfs -- (deprecated)
statfs64 -- (deprecated)
stime -- set time
stpcpy -- copy a string returning a pointer to its end
stpncpy -- copy a fixed-size string, returning a pointer to its end
strcasestr -- locate a substring ignoring case
strerror_r -- return string describing error number
strndup -- return a malloc'd copy of at most the specified number of bytes of a string
strnlen -- determine the length of a fixed-size string
strptime -- parse a time string
strsep -- extract token from string
strsignal -- return string describing signal
strtoq -- convert string value to a long or quad_t integer
strtouq -- convert a string to an unsigned long long
svc_register -- register Remote Procedure Call interface
svc_run -- waits for RPC requests to arrive and calls service procedure
svc_sendreply -- called by RPC service's dispatch routine
svctcp_create -- create a TCP/IP-based RPC service transport
svcudp_create --  create a UDP-based RPC service transport
swscanf -- convert formatted input
sysconf -- Get configuration information at runtime
sysinfo -- return system information
system -- execute a shell command
textdomain -- set the current default message domain
unlink -- remove a directory entry
uselocale -- set locale for thread
utmpname -- set user accounting database
vasprintf -- write formatted output to a dynamically allocated string
vdprintf -- write formatted output to a file descriptor
verrx -- display formatted error message and exit
vfscanf -- convert formatted input
vfwscanf -- convert formatted input
vscanf -- convert formatted input
vsscanf -- convert formatted input
vswscanf -- convert formatted input
vsyslog -- log to system log
vwscanf -- convert formatted input
wait4 -- wait for process termination, BSD style
warn -- formatted error messages
warnx -- formatted error messages
wcpcpy -- copy a wide character string, returning a pointer to its end
wcpncpy -- copy a fixed-size string of wide characters, returning a pointer to its end
wcscasecmp -- compare two wide-character strings, ignoring case
wcsdup -- duplicate a wide-character string
wcsncasecmp -- compare two fixed-size wide-character strings, ignoring case
wcsnlen -- determine the length of a fixed-size wide-character string
wcsnrtombs -- convert a wide character string to a multi-byte string
wcstoq -- convert wide string to long long int representation
wcstouq -- convert wide string to unsigned long long int representation
wscanf -- convert formatted input
xdr_u_int -- library routines for external data representation
xdrstdio_create -- library routines for external data representation
12.6. Interfaces for libm
12.6.1. Math
12.7. Data Definitions for libm
12.7.1. complex.h
12.7.2. fenv.h
12.7.3. math.h
12.8. Interface Definitions for libm
__finite -- test for infinity
__finitef -- test for infinity
__finitel -- test for infinity
__fpclassify -- Classify real floating type
__fpclassifyf -- Classify real floating type
__signbit -- test sign of floating point value
__signbitf -- test sign of floating point value
clog10 -- Logarithm of a Complex Number
clog10f -- Logarithm of a Complex Number
clog10l -- Logarithm of a Complex Number
drem -- Floating Point Remainder (DEPRECATED)
dremf -- Floating Point Remainder (DEPRECATED)
dreml -- Floating Point Remainder (DEPRECATED)
exp10 -- Base-10 power function
exp10f -- Base-10 power function
exp10l -- Base-10 power function
fedisableexcept -- disable floating point exceptions
feenableexcept -- enable floating point exceptions
fegetexcept -- query floating point exception handling state
finite -- test for infinity (DEPRECATED)
finitef -- test for infinity (DEPRECATED)
finitel -- test for infinity (DEPRECATED)
gamma -- log gamma function (DEPRECATED)
gammaf -- log gamma function (DEPRECATED)
gammal -- log gamma function (DEPRECATED)
j0f -- Bessel functions
j0l -- Bessel functions
j1f -- Bessel functions
j1l -- Bessel functions
jnf -- Bessel functions
jnl -- Bessel functions
lgamma_r -- log gamma functions
lgammaf_r -- log gamma functions
lgammal_r -- log gamma functions
matherr -- math library exception handling
pow10 -- Base-10 power function
pow10f -- Base-10 power function
pow10l -- Base-10 power function
scalbf -- load exponent of radix-independent floating point number
scalbl -- load exponent of radix-independent floating point number
significand -- floating point mantissa
significandf -- floating point mantissa
significandl -- floating point mantissa
sincos -- trigonometric functions
sincosf -- trigonometric functions
sincosl -- trigonometric functions
y0f -- Bessel functions
y0l -- Bessel functions
y1f -- Bessel functions
y1l -- Bessel functions
ynf -- Bessel functions
ynl -- Bessel functions
12.9. Interfaces for libpthread
12.9.1. Realtime Threads
12.9.2. Advanced Realtime Threads
12.9.3. Posix Threads
12.9.4. Thread aware versions of libc interfaces
12.9.5. GNU Extensions for libpthread
12.10. Data Definitions for libpthread
12.10.1. pthread.h
12.10.2. semaphore.h
12.11. Interface Definitions for libpthread
_pthread_cleanup_pop -- establish cancellation handlers
_pthread_cleanup_push -- establish cancellation handlers
pthread_getattr_np -- get thread attributes
pthread_mutex_consistent_np -- mark state protected by robust mutex as consistent
pthread_mutexattr_getrobust_np, pthread_mutexattr_setrobust_np -- get and set the mutex robust attribute
pthread_rwlockattr_getkind_np, pthread_rwlockattr_setkind_np -- get/set the read-write lock kind of the thread read-write lock attribute object
12.12. Interfaces for libgcc_s
12.12.1. Unwind Library
12.13. Data Definitions for libgcc_s
12.13.1. unwind.h
12.14. Interface Definitions for libgcc_s
_Unwind_Backtrace -- private C++ error handling method
_Unwind_DeleteException -- private C++ error handling method
_Unwind_FindEnclosingFunction -- private C++ error handling method
_Unwind_ForcedUnwind -- private C++ error handling method
_Unwind_GetCFA -- private C++ error handling method
_Unwind_GetGR -- private C++ error handling method
_Unwind_GetIP -- private C++ error handling method
_Unwind_GetIPInfo -- private C++ error handling method
_Unwind_GetLanguageSpecificData -- private C++ error handling method
_Unwind_GetRegionStart -- private C++ error handling method
_Unwind_RaiseException -- private C++ error handling method
_Unwind_Resume -- private C++ error handling method
_Unwind_Resume_or_Rethrow -- private C++ error handling method
_Unwind_SetGR -- private C++ error handling method
_Unwind_SetIP -- private C++ error handling method
12.15. Interfaces for libdl
12.15.1. Dynamic Loader
12.16. Data Definitions for libdl
12.16.1. dlfcn.h
12.17. Interface Definitions for libdl
dladdr -- find the shared object containing a given address
dlopen -- open dynamic object
dlsym -- obtain the address of a symbol from a dlopen object
dlvsym -- obtain the address of a symbol from a dlopen object
12.18. Interfaces for librt
12.18.1. Shared Memory Objects
12.18.2. Clock
12.18.3. Timers
12.18.4. Message Queues
12.19. Data Definitions for librt
12.19.1. mqueue.h
12.20. Interfaces for libcrypt
12.20.1. Encryption
12.21. Interfaces for libpam
12.21.1. Pluggable Authentication API
12.22. Data Definitions for libpam
12.22.1. security/pam_appl.h
12.23. Interface Definitions for libpam
pam_acct_mgmt -- establish the status of a user's account
pam_authenticate -- authenticate the user
pam_chauthtok -- change the authentication token for a given user
pam_close_session -- indicate that an authenticated session has ended
pam_end -- terminate the use of the PAM library
pam_fail_delay -- specify delay time to use on authentication error
pam_get_item -- obtain the value of the indicated item.
pam_getenv -- get a PAM environment variable
pam_getenvlist -- returns a pointer to the complete PAM environment.
pam_open_session -- indicate session has started
pam_putenv -- Add, replace or delete a PAM environment variable
pam_set_item -- (re)set the value of an item.
pam_setcred -- set the module-specific credentials of the user
pam_start -- initialize the PAM library
pam_strerror -- returns a string describing the PAM error

Chapter 12. Base Libraries

12.1. Introduction

An LSB-conforming implementation shall support the following base libraries which provide interfaces for accessing the operating system, processor and other hardware in the system.

  • libc

  • libm

  • libgcc_s

  • libdl

  • librt

  • libcrypt

  • libpam

There are three main parts to the definition of each of these libraries.

The "Interfaces" section defines the required library name and version, and the required public symbols (interfaces and global data), as well as symbol versions, if any.

The "Interface Definitions" section provides complete or partial definitions of certain interfaces where either this specification is the source specification, or where there are variations from the source specification. If an interface definition requires one or more header files, one of those headers shall include the function prototype for the interface.

For source definitions of interfaces which include a reference to a header file, the contents of such header files form a part of the specification. The "Data Definitions" section provides the binary-level details for the header files from the source specifications, such as values for macros and enumerated types, as well as structure layouts, sizes and padding, etc. These data definitions, although presented in the form of header files for convenience, should not be taken a representing complete header files, as they are a supplement to the source specifications. Application developers should follow the guidelines of the source specifications when determining which header files need to be included to completely resolve all references.

Note: While the Data Definitions supplement the source specifications, this specification itself does not require conforming implementations to supply any header files.


12.2. Program Interpreter

The Program Interpreter is specified in the appropriate architecture specific part of ISO/IEC 23360.


12.3. Interfaces for libc

Table 12-1 defines the library name and shared object name for the libc library

Table 12-1. libc Definition

Library:libc
SONAME:See archLSB.

The behavior of the interfaces in this library is specified by the following specifications:

[LFS] Large File Support
[LSB] This Specification
[RPC & XDR] RFC 1831/1832 RPC & XDR
[SUSv2] SUSv2
[SUSv3] POSIX 1003.1-2001 (ISO/IEC 9945-2003)
[SUSv4] POSIX 1003.1-2008 (ISO/IEC 9945-2009)
[SVID.4] SVID Issue 4


12.3.1. RPC


12.3.1.1. Interfaces for RPC

An LSB conforming implementation shall provide the generic functions for RPC specified in Table 12-2, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-2. libc - RPC Function Interfaces

authnone_create [SVID.4]callrpc [RPC & XDR]clnt_create [SVID.4]clnt_pcreateerror [SVID.4]
clnt_perrno [SVID.4]clnt_perror [SVID.4]clnt_spcreateerror [SVID.4]clnt_sperrno [SVID.4]
clnt_sperror [SVID.4]clntraw_create [RPC & XDR]clnttcp_create [RPC & XDR]clntudp_bufcreate [RPC & XDR]
clntudp_create [RPC & XDR]key_decryptsession [SVID.4]pmap_getport [LSB]pmap_set [LSB]
pmap_unset [LSB]svc_getreqset [SVID.4]svc_register [LSB]svc_run [LSB]
svc_sendreply [LSB]svcerr_auth [SVID.4]svcerr_decode [SVID.4]svcerr_noproc [SVID.4]
svcerr_noprog [SVID.4]svcerr_progvers [SVID.4]svcerr_systemerr [SVID.4]svcerr_weakauth [SVID.4]
svcfd_create [RPC & XDR]svcraw_create [RPC & XDR]svctcp_create [LSB]svcudp_create [LSB]
xdr_accepted_reply [SVID.4]xdr_array [SVID.4]xdr_bool [SVID.4]xdr_bytes [SVID.4]
xdr_callhdr [SVID.4]xdr_callmsg [SVID.4]xdr_char [SVID.4]xdr_double [SVID.4]
xdr_enum [SVID.4]xdr_float [SVID.4]xdr_free [SVID.4]xdr_int [SVID.4]
xdr_long [SVID.4]xdr_opaque [SVID.4]xdr_opaque_auth [SVID.4]xdr_pointer [SVID.4]
xdr_reference [SVID.4]xdr_rejected_reply [SVID.4]xdr_replymsg [SVID.4]xdr_short [SVID.4]
xdr_string [SVID.4]xdr_u_char [SVID.4]xdr_u_int [LSB]xdr_u_long [SVID.4]
xdr_u_short [SVID.4]xdr_union [SVID.4]xdr_vector [SVID.4]xdr_void [SVID.4]
xdr_wrapstring [SVID.4]xdrmem_create [SVID.4]xdrrec_create [SVID.4]xdrrec_endofrecord [RPC & XDR]
xdrrec_eof [SVID.4]xdrrec_skiprecord [RPC & XDR]xdrstdio_create [LSB] 

An LSB conforming implementation shall provide the generic deprecated functions for RPC specified in Table 12-3, with the full mandatory functionality as described in the referenced underlying specification.

Note: These interfaces are deprecated, and applications should avoid using them. These interfaces may be withdrawn in future releases of this specification.

Table 12-3. libc - RPC Deprecated Function Interfaces

key_decryptsession [SVID.4]   

12.3.2. Epoll


12.3.2.1. Interfaces for Epoll

An LSB conforming implementation shall provide the generic functions for Epoll specified in Table 12-4, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-4. libc - Epoll Function Interfaces

epoll_create(GLIBC_2.3.2) [LSB]epoll_ctl(GLIBC_2.3.2) [LSB]epoll_wait(GLIBC_2.3.2) [LSB] 

12.3.3. System Calls


12.3.3.1. Interfaces for System Calls

An LSB conforming implementation shall provide the generic functions for System Calls specified in Table 12-5, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-5. libc - System Calls Function Interfaces

__chk_fail(GLIBC_2.3.4) [LSB]__fxstat [LSB]__fxstatat(GLIBC_2.4) [LSB]__getgroups_chk(GLIBC_2.4) [LSB]
__getpgid [LSB]__lxstat [LSB]__read_chk(GLIBC_2.4) [LSB]__readlink_chk(GLIBC_2.4) [LSB]
__stack_chk_fail(GLIBC_2.4) [LSB]__xmknod [LSB]__xmknodat(GLIBC_2.4) [LSB]__xstat [LSB]
access [SUSv3]acct [LSB]alarm [SUSv3]backtrace [LSB]
backtrace_symbols [LSB]backtrace_symbols_fd [LSB]brk [SUSv2]chdir [SUSv3]
chmod [SUSv3]chown [SUSv3]chroot [SUSv2]clock [SUSv3]
close [SUSv3]closedir [SUSv3]creat [SUSv3]dup [SUSv3]
dup2 [SUSv3]execl [SUSv3]execle [SUSv3]execlp [SUSv3]
execv [SUSv3]execve [SUSv3]execvp [SUSv3]exit [SUSv3]
faccessat(GLIBC_2.4) [SUSv4]fchdir [SUSv3]fchmod [SUSv3]fchmodat(GLIBC_2.4) [SUSv4]
fchown [SUSv3]fchownat(GLIBC_2.4) [SUSv4]fcntl [LSB]fdatasync [SUSv3]
fdopendir(GLIBC_2.4) [SUSv4]fexecve [SUSv4]flock [LSB]fork [SUSv3]
fstatfs [LSB]fstatvfs [SUSv3]fsync [SUSv3]ftime [SUSv3]
ftruncate [SUSv3]getcontext [SUSv3]getdtablesize [LSB]getegid [SUSv3]
geteuid [SUSv3]getgid [SUSv3]getgroups [SUSv3]getitimer [SUSv3]
getloadavg [LSB]getpagesize [LSB]getpgid [SUSv3]getpgrp [SUSv3]
getpid [SUSv3]getppid [SUSv3]getpriority [SUSv3]getrlimit [SUSv3]
getrusage [SUSv3]getsid [SUSv3]getuid [SUSv3]getwd [SUSv3]
initgroups [LSB]ioctl [LSB]kill [LSB]killpg [SUSv3]
lchown [SUSv3]link [LSB]linkat(GLIBC_2.4) [SUSv4]lockf [SUSv3]
lseek [SUSv3]mkdir [SUSv3]mkdirat(GLIBC_2.4) [SUSv4]mkfifo [SUSv3]
mkfifoat(GLIBC_2.4) [SUSv4]mlock [SUSv3]mlockall [SUSv3]mmap [SUSv3]
mprotect [SUSv3]mremap [LSB]msync [SUSv3]munlock [SUSv3]
munlockall [SUSv3]munmap [SUSv3]nanosleep [SUSv3]nice [SUSv3]
open [SUSv3]openat(GLIBC_2.4) [SUSv4]opendir [SUSv3]pathconf [SUSv3]
pause [SUSv3]pipe [SUSv3]poll [SUSv3]pread [SUSv3]
pselect [SUSv3]ptrace [LSB]pwrite [SUSv3]read [SUSv3]
readdir [SUSv3]readdir_r [SUSv3]readlink [SUSv3]readlinkat(GLIBC_2.4) [SUSv4]
readv [SUSv3]rename [SUSv3]renameat(GLIBC_2.4) [SUSv4]rmdir [SUSv3]
sbrk [SUSv2]sched_get_priority_max [SUSv3]sched_get_priority_min [SUSv3]sched_getaffinity(GLIBC_2.3.4) [LSB]
sched_getparam [SUSv3]sched_getscheduler [SUSv3]sched_rr_get_interval [SUSv3]sched_setaffinity(GLIBC_2.3.4) [LSB]
sched_setparam [SUSv3]sched_setscheduler [LSB]sched_yield [SUSv3]select [SUSv3]
setcontext [SUSv3]setegid [SUSv3]seteuid [SUSv3]setgid [SUSv3]
setitimer [SUSv3]setpgid [SUSv3]setpgrp [SUSv3]setpriority [SUSv3]
setregid [SUSv3]setreuid [SUSv3]setrlimit [SUSv3]setrlimit64 [LFS]
setsid [SUSv3]setuid [SUSv3]sleep [SUSv3]statfs [LSB]
statvfs [SUSv3]stime [LSB]symlink [SUSv3]symlinkat(GLIBC_2.4) [SUSv4]
sync [SUSv3]sysconf [LSB]sysinfo [LSB]time [SUSv3]
times [SUSv3]truncate [SUSv3]ulimit [SUSv3]umask [SUSv3]
uname [SUSv3]unlink [LSB]unlinkat(GLIBC_2.4) [SUSv4]utime [SUSv3]
utimes [SUSv3]vfork [SUSv3]wait [SUSv3]wait4 [LSB]
waitid [SUSv3]waitpid [SUSv3]write [SUSv3]writev [SUSv3]

An LSB conforming implementation shall provide the generic deprecated functions for System Calls specified in Table 12-6, with the full mandatory functionality as described in the referenced underlying specification.

Note: These interfaces are deprecated, and applications should avoid using them. These interfaces may be withdrawn in future releases of this specification.

Table 12-6. libc - System Calls Deprecated Function Interfaces

fstatfs [LSB]getdtablesize [LSB]getpagesize [LSB]getwd [SUSv3]
statfs [LSB]   

12.3.4. Standard I/O


12.3.4.1. Interfaces for Standard I/O

An LSB conforming implementation shall provide the generic functions for Standard I/O specified in Table 12-7, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-7. libc - Standard I/O Function Interfaces

_IO_feof [LSB]_IO_getc [LSB]_IO_putc [LSB]_IO_puts [LSB]
__fgets_chk(GLIBC_2.4) [LSB]__fgets_unlocked_chk(GLIBC_2.4) [LSB]__fgetws_unlocked_chk(GLIBC_2.4) [LSB]__fprintf_chk [LSB]
__printf_chk [LSB]__snprintf_chk [LSB]__sprintf_chk [LSB]__vfprintf_chk [LSB]
__vprintf_chk [LSB]__vsnprintf_chk [LSB]__vsprintf_chk [LSB]asprintf [LSB]
clearerr [SUSv3]clearerr_unlocked [LSB]ctermid [SUSv3]dprintf [SUSv4]
fclose [SUSv3]fdopen [SUSv3]feof [SUSv3]feof_unlocked [LSB]
ferror [SUSv3]ferror_unlocked [LSB]fflush [SUSv3]fflush_unlocked [LSB]
fgetc [SUSv3]fgetc_unlocked [LSB]fgetpos [SUSv3]fgets [SUSv3]
fgets_unlocked [LSB]fgetwc_unlocked [LSB]fgetws_unlocked [LSB]fileno [SUSv3]
fileno_unlocked [LSB]flockfile [SUSv3]fopen [SUSv3]fprintf [SUSv3]
fputc [SUSv3]fputc_unlocked [LSB]fputs [SUSv3]fputs_unlocked [LSB]
fputwc_unlocked [LSB]fputws_unlocked [LSB]fread [SUSv3]fread_unlocked [LSB]
freopen [SUSv3]fscanf [LSB]fseek [SUSv3]fseeko [SUSv3]
fsetpos [SUSv3]ftell [SUSv3]ftello [SUSv3]fwrite [SUSv3]
fwrite_unlocked [LSB]getc [SUSv3]getc_unlocked [SUSv3]getchar [SUSv3]
getchar_unlocked [SUSv3]getdelim [SUSv4]getline [SUSv4]getw [SUSv2]
getwc_unlocked [LSB]getwchar_unlocked [LSB]pclose [SUSv3]popen [SUSv3]
printf [SUSv3]putc [SUSv3]putc_unlocked [SUSv3]putchar [SUSv3]
putchar_unlocked [SUSv3]puts [SUSv3]putw [SUSv2]putwc_unlocked [LSB]
putwchar_unlocked [LSB]remove [SUSv3]rewind [SUSv3]rewinddir [SUSv3]
scanf [LSB]seekdir [SUSv3]setbuf [SUSv3]setbuffer [LSB]
setvbuf [SUSv3]snprintf [SUSv3]sprintf [SUSv3]sscanf [LSB]
telldir [SUSv3]tempnam [SUSv3]ungetc [SUSv3]vasprintf [LSB]
vdprintf [LSB]vfprintf [SUSv3]vprintf [SUSv3]vsnprintf [SUSv3]
vsprintf [SUSv3]   

An LSB conforming implementation shall provide the generic deprecated functions for Standard I/O specified in Table 12-8, with the full mandatory functionality as described in the referenced underlying specification.

Note: These interfaces are deprecated, and applications should avoid using them. These interfaces may be withdrawn in future releases of this specification.

Table 12-8. libc - Standard I/O Deprecated Function Interfaces

tempnam [SUSv3]   

An LSB conforming implementation shall provide the generic data interfaces for Standard I/O specified in Table 12-9, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-9. libc - Standard I/O Data Interfaces

stderr [SUSv3]stdin [SUSv3]stdout [SUSv3] 

12.3.5. Signal Handling


12.3.5.1. Interfaces for Signal Handling

An LSB conforming implementation shall provide the generic functions for Signal Handling specified in Table 12-10, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-10. libc - Signal Handling Function Interfaces

__libc_current_sigrtmax [LSB]__libc_current_sigrtmin [LSB]__sigsetjmp [LSB]__sysv_signal [LSB]
__xpg_sigpause [LSB]bsd_signal [SUSv3]psignal [LSB]raise [SUSv3]
sigaction [SUSv3]sigaddset [SUSv3]sigaltstack [SUSv3]sigandset [LSB]
sigdelset [SUSv3]sigemptyset [SUSv3]sigfillset [SUSv3]sighold [SUSv3]
sigignore [SUSv3]siginterrupt [SUSv3]sigisemptyset [LSB]sigismember [SUSv3]
siglongjmp [SUSv3]signal [SUSv3]sigorset [LSB]sigpause [LSB]
sigpending [SUSv3]sigprocmask [SUSv3]sigqueue [SUSv3]sigrelse [SUSv3]
sigreturn [LSB]sigset [SUSv3]sigsuspend [SUSv3]sigtimedwait [SUSv3]
sigwait [SUSv3]sigwaitinfo [SUSv3]  

An LSB conforming implementation shall provide the generic deprecated functions for Signal Handling specified in Table 12-11, with the full mandatory functionality as described in the referenced underlying specification.

Note: These interfaces are deprecated, and applications should avoid using them. These interfaces may be withdrawn in future releases of this specification.

Table 12-11. libc - Signal Handling Deprecated Function Interfaces

sigpause [LSB]   

An LSB conforming implementation shall provide the generic data interfaces for Signal Handling specified in Table 12-12, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-12. libc - Signal Handling Data Interfaces

_sys_siglist [LSB]   

12.3.6. Localization Functions


12.3.6.1. Interfaces for Localization Functions

An LSB conforming implementation shall provide the generic functions for Localization Functions specified in Table 12-13, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-13. libc - Localization Functions Function Interfaces

bind_textdomain_codeset [LSB]bindtextdomain [LSB]catclose [SUSv3]catgets [SUSv3]
catopen [SUSv3]dcgettext [LSB]dcngettext [LSB]dgettext [LSB]
dngettext [LSB]duplocale(GLIBC_2.3) [LSB]freelocale(GLIBC_2.3) [LSB]gettext [LSB]
iconv [SUSv3]iconv_close [SUSv3]iconv_open [SUSv3]localeconv [SUSv3]
newlocale(GLIBC_2.3) [LSB]ngettext [LSB]nl_langinfo [SUSv3]setlocale [SUSv3]
textdomain [LSB]uselocale(GLIBC_2.3) [LSB]  

An LSB conforming implementation shall provide the generic data interfaces for Localization Functions specified in Table 12-14, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-14. libc - Localization Functions Data Interfaces

_nl_msg_cat_cntr [LSB]   

12.3.7. Posix Spawn Option


12.3.7.1. Interfaces for Posix Spawn Option

An LSB conforming implementation shall provide the generic functions for Posix Spawn Option specified in Table 12-15, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-15. libc - Posix Spawn Option Function Interfaces

posix_spawn [SUSv3]posix_spawn_file_actions_addclose [SUSv3]posix_spawn_file_actions_adddup2 [SUSv3]posix_spawn_file_actions_addopen [SUSv3]
posix_spawn_file_actions_destroy [SUSv3]posix_spawn_file_actions_init [SUSv3]posix_spawnattr_destroy [SUSv3]posix_spawnattr_getflags [SUSv3]
posix_spawnattr_getpgroup [SUSv3]posix_spawnattr_getschedparam [SUSv3]posix_spawnattr_getschedpolicy [SUSv3]posix_spawnattr_getsigdefault [SUSv3]
posix_spawnattr_getsigmask [SUSv3]posix_spawnattr_init [SUSv3]posix_spawnattr_setflags [SUSv3]posix_spawnattr_setpgroup [SUSv3]
posix_spawnattr_setschedparam [SUSv3]posix_spawnattr_setschedpolicy [SUSv3]posix_spawnattr_setsigdefault [SUSv3]posix_spawnattr_setsigmask [SUSv3]
posix_spawnp [SUSv3]   

12.3.8. Posix Advisory Option


12.3.8.1. Interfaces for Posix Advisory Option

An LSB conforming implementation shall provide the generic functions for Posix Advisory Option specified in Table 12-16, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-16. libc - Posix Advisory Option Function Interfaces

posix_fadvise [SUSv3]posix_fallocate [SUSv3]posix_madvise [SUSv3]posix_memalign [SUSv3]

12.3.9. Socket Interface


12.3.9.1. Interfaces for Socket Interface

An LSB conforming implementation shall provide the generic functions for Socket Interface specified in Table 12-17, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-17. libc - Socket Interface Function Interfaces

__gethostname_chk(GLIBC_2.4) [LSB]__h_errno_location [LSB]__recv_chk(GLIBC_2.4) [LSB]__recvfrom_chk(GLIBC_2.4) [LSB]
accept [SUSv3]bind [SUSv3]bindresvport [LSB]connect [SUSv3]
gethostid [SUSv3]gethostname [SUSv3]getpeername [SUSv3]getsockname [SUSv3]
getsockopt [LSB]if_freenameindex [SUSv3]if_indextoname [SUSv3]if_nameindex [SUSv3]
if_nametoindex [SUSv3]listen [SUSv3]recv [SUSv3]recvfrom [SUSv3]
recvmsg [SUSv3]send [SUSv4]sendmsg [SUSv4]sendto [SUSv4]
setsockopt [LSB]shutdown [SUSv3]sockatmark [SUSv3]socket [SUSv3]
socketpair [SUSv3]   

An LSB conforming implementation shall provide the generic data interfaces for Socket Interface specified in Table 12-18, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-18. libc - Socket Interface Data Interfaces

in6addr_any [SUSv3]in6addr_loopback [SUSv3]  

12.3.10. Wide Characters


12.3.10.1. Interfaces for Wide Characters

An LSB conforming implementation shall provide the generic functions for Wide Characters specified in Table 12-19, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-19. libc - Wide Characters Function Interfaces

__fgetws_chk(GLIBC_2.4) [LSB]__fwprintf_chk(GLIBC_2.4) [LSB]__mbsnrtowcs_chk(GLIBC_2.4) [LSB]__mbsrtowcs_chk(GLIBC_2.4) [LSB]
__mbstowcs_chk(GLIBC_2.4) [LSB]__swprintf_chk(GLIBC_2.4) [LSB]__vfwprintf_chk(GLIBC_2.4) [LSB]__vswprintf_chk(GLIBC_2.4) [LSB]
__vwprintf_chk(GLIBC_2.4) [LSB]__wcpcpy_chk(GLIBC_2.4) [LSB]__wcpncpy_chk(GLIBC_2.4) [LSB]__wcrtomb_chk(GLIBC_2.4) [LSB]
__wcscat_chk(GLIBC_2.4) [LSB]__wcscpy_chk(GLIBC_2.4) [LSB]__wcsncat_chk(GLIBC_2.4) [LSB]__wcsncpy_chk(GLIBC_2.4) [LSB]
__wcsnrtombs_chk(GLIBC_2.4) [LSB]__wcsrtombs_chk(GLIBC_2.4) [LSB]__wcstod_internal [LSB]__wcstof_internal [LSB]
__wcstol_internal [LSB]__wcstold_internal [LSB]__wcstombs_chk(GLIBC_2.4) [LSB]__wcstoul_internal [LSB]
__wctomb_chk(GLIBC_2.4) [LSB]__wmemcpy_chk(GLIBC_2.4) [LSB]__wmemmove_chk(GLIBC_2.4) [LSB]__wmempcpy_chk(GLIBC_2.4) [LSB]
__wmemset_chk(GLIBC_2.4) [LSB]__wprintf_chk(GLIBC_2.4) [LSB]btowc [SUSv3]fgetwc [SUSv3]
fgetws [SUSv3]fputwc [SUSv3]fputws [SUSv3]fwide [SUSv3]
fwprintf [SUSv3]fwscanf [LSB]getwc [SUSv3]getwchar [SUSv3]
mblen [SUSv3]mbrlen [SUSv3]mbrtowc [SUSv3]mbsinit [SUSv3]
mbsnrtowcs [LSB]mbsrtowcs [SUSv3]mbstowcs [SUSv3]mbtowc [SUSv3]
putwc [SUSv3]putwchar [SUSv3]swprintf [SUSv3]swscanf [LSB]
towctrans [SUSv3]towlower [SUSv3]towupper [SUSv3]ungetwc [SUSv3]
vfwprintf [SUSv3]vfwscanf [LSB]vswprintf [SUSv3]vswscanf [LSB]
vwprintf [SUSv3]vwscanf [LSB]wcpcpy [LSB]wcpncpy [LSB]
wcrtomb [SUSv3]wcscasecmp [LSB]wcscat [SUSv3]wcschr [SUSv3]
wcscmp [SUSv3]wcscoll [SUSv3]wcscpy [SUSv3]wcscspn [SUSv3]
wcsdup [LSB]wcsftime [SUSv3]wcslen [SUSv3]wcsncasecmp [LSB]
wcsncat [SUSv3]wcsncmp [SUSv3]wcsncpy [SUSv3]wcsnlen [LSB]
wcsnrtombs [LSB]wcspbrk [SUSv3]wcsrchr [SUSv3]wcsrtombs [SUSv3]
wcsspn [SUSv3]wcsstr [SUSv3]wcstod [SUSv3]wcstof [SUSv3]
wcstoimax [SUSv3]wcstok [SUSv3]wcstol [SUSv3]wcstold [SUSv3]
wcstoll [SUSv3]wcstombs [SUSv3]wcstoq [LSB]wcstoul [SUSv3]
wcstoull [SUSv3]wcstoumax [SUSv3]wcstouq [LSB]wcswcs [SUSv3]
wcswidth [SUSv3]wcsxfrm [SUSv3]wctob [SUSv3]wctomb [SUSv3]
wctrans [SUSv3]wctype [SUSv3]wcwidth [SUSv3]wmemchr [SUSv3]
wmemcmp [SUSv3]wmemcpy [SUSv3]wmemmove [SUSv3]wmemset [SUSv3]
wprintf [SUSv3]wscanf [LSB]  

12.3.11. String Functions


12.3.11.1. Interfaces for String Functions

An LSB conforming implementation shall provide the generic functions for String Functions specified in Table 12-20, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-20. libc - String Functions Function Interfaces

__memcpy_chk(GLIBC_2.3.4) [LSB]__memmove_chk(GLIBC_2.3.4) [LSB]__mempcpy [LSB]__mempcpy_chk(GLIBC_2.3.4) [LSB]
__memset_chk(GLIBC_2.3.4) [LSB]__rawmemchr [LSB]__stpcpy [LSB]__stpcpy_chk(GLIBC_2.3.4) [LSB]
__stpncpy_chk(GLIBC_2.4) [LSB]__strcat_chk(GLIBC_2.3.4) [LSB]__strcpy_chk(GLIBC_2.3.4) [LSB]__strdup [LSB]
__strncat_chk(GLIBC_2.3.4) [LSB]__strncpy_chk(GLIBC_2.3.4) [LSB]__strtod_internal [LSB]__strtof_internal [LSB]
__strtok_r [LSB]__strtol_internal [LSB]__strtold_internal [LSB]__strtoll_internal [LSB]
__strtoul_internal [LSB]__strtoull_internal [LSB]__xpg_strerror_r(GLIBC_2.3.4) [LSB]bcmp [SUSv3]
bcopy [SUSv3]bzero [SUSv3]ffs [SUSv3]index [SUSv3]
memccpy [SUSv3]memchr [SUSv3]memcmp [SUSv3]memcpy [SUSv3]
memmove [SUSv3]memrchr [LSB]memset [SUSv3]rindex [SUSv3]
stpcpy [LSB]stpncpy [LSB]strcasecmp [SUSv3]strcasestr [LSB]
strcat [SUSv3]strchr [SUSv3]strcmp [SUSv3]strcoll [SUSv3]
strcpy [SUSv3]strcspn [SUSv3]strdup [SUSv3]strerror [SUSv3]
strerror_r [LSB]strfmon [SUSv3]strftime [SUSv3]strlen [SUSv3]
strncasecmp [SUSv3]strncat [SUSv3]strncmp [SUSv3]strncpy [SUSv3]
strndup [LSB]strnlen [LSB]strpbrk [SUSv3]strptime [LSB]
strrchr [SUSv3]strsep [LSB]strsignal [LSB]strspn [SUSv3]
strstr [SUSv3]strtof [SUSv3]strtoimax [SUSv3]strtok [SUSv3]
strtok_r [SUSv3]strtold [SUSv3]strtoll [SUSv3]strtoq [LSB]
strtoull [SUSv3]strtoumax [SUSv3]strtouq [LSB]strxfrm [SUSv3]
swab [SUSv3]   

An LSB conforming implementation shall provide the generic deprecated functions for String Functions specified in Table 12-21, with the full mandatory functionality as described in the referenced underlying specification.

Note: These interfaces are deprecated, and applications should avoid using them. These interfaces may be withdrawn in future releases of this specification.

Table 12-21. libc - String Functions Deprecated Function Interfaces

strerror_r [LSB]   

12.3.12. IPC Functions


12.3.12.1. Interfaces for IPC Functions

An LSB conforming implementation shall provide the generic functions for IPC Functions specified in Table 12-22, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-22. libc - IPC Functions Function Interfaces

ftok [SUSv3]msgctl [SUSv3]msgget [SUSv3]msgrcv [SUSv3]
msgsnd [SUSv3]semctl [SUSv3]semget [SUSv3]semop [SUSv3]
shmat [SUSv3]shmctl [SUSv3]shmdt [SUSv3]shmget [SUSv3]

12.3.13. Regular Expressions


12.3.13.1. Interfaces for Regular Expressions

An LSB conforming implementation shall provide the generic functions for Regular Expressions specified in Table 12-23, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-23. libc - Regular Expressions Function Interfaces

regcomp [SUSv3]regerror [SUSv3]regexec [LSB]regfree [SUSv3]

12.3.14. Character Type Functions


12.3.14.1. Interfaces for Character Type Functions

An LSB conforming implementation shall provide the generic functions for Character Type Functions specified in Table 12-24, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-24. libc - Character Type Functions Function Interfaces

__ctype_b_loc(GLIBC_2.3) [LSB]__ctype_get_mb_cur_max [LSB]__ctype_tolower_loc(GLIBC_2.3) [LSB]__ctype_toupper_loc(GLIBC_2.3) [LSB]
_tolower [SUSv3]_toupper [SUSv3]isalnum [SUSv3]isalpha [SUSv3]
isascii [SUSv3]iscntrl [SUSv3]isdigit [SUSv3]isgraph [SUSv3]
islower [SUSv3]isprint [SUSv3]ispunct [SUSv3]isspace [SUSv3]
isupper [SUSv3]iswalnum [SUSv3]iswalpha [SUSv3]iswblank [SUSv3]
iswcntrl [SUSv3]iswctype [SUSv3]iswdigit [SUSv3]iswgraph [SUSv3]
iswlower [SUSv3]iswprint [SUSv3]iswpunct [SUSv3]iswspace [SUSv3]
iswupper [SUSv3]iswxdigit [SUSv3]isxdigit [SUSv3]toascii [SUSv3]
tolower [SUSv3]toupper [SUSv3]  

12.3.15. Time Manipulation


12.3.15.1. Interfaces for Time Manipulation

An LSB conforming implementation shall provide the generic functions for Time Manipulation specified in Table 12-25, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-25. libc - Time Manipulation Function Interfaces

adjtime [LSB]asctime [SUSv3]asctime_r [SUSv3]ctime [SUSv3]
ctime_r [SUSv3]difftime [SUSv3]gmtime [SUSv3]gmtime_r [SUSv3]
localtime [SUSv3]localtime_r [SUSv3]mktime [SUSv3]tzset [SUSv3]
ualarm [SUSv3]   

An LSB conforming implementation shall provide the generic data interfaces for Time Manipulation specified in Table 12-26, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-26. libc - Time Manipulation Data Interfaces

__daylight [LSB]__timezone [LSB]__tzname [LSB]daylight [SUSv3]
timezone [SUSv3]tzname [SUSv3]  

12.3.16. Terminal Interface Functions


12.3.16.1. Interfaces for Terminal Interface Functions

An LSB conforming implementation shall provide the generic functions for Terminal Interface Functions specified in Table 12-27, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-27. libc - Terminal Interface Functions Function Interfaces

cfgetispeed [SUSv3]cfgetospeed [SUSv3]cfmakeraw [LSB]cfsetispeed [SUSv3]
cfsetospeed [SUSv3]cfsetspeed [LSB]tcdrain [SUSv3]tcflow [SUSv3]
tcflush [SUSv3]tcgetattr [SUSv3]tcgetpgrp [SUSv3]tcgetsid [SUSv3]
tcsendbreak [SUSv3]tcsetattr [SUSv3]tcsetpgrp [SUSv3] 

12.3.17. System Database Interface


12.3.17.1. Interfaces for System Database Interface

An LSB conforming implementation shall provide the generic functions for System Database Interface specified in Table 12-28, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-28. libc - System Database Interface Function Interfaces

endgrent [SUSv3]endprotoent [SUSv3]endpwent [SUSv3]endservent [SUSv3]
endutent [LSB]endutxent [SUSv3]getgrent [SUSv3]getgrent_r [LSB]
getgrgid [SUSv3]getgrgid_r [SUSv3]getgrnam [SUSv3]getgrnam_r [SUSv3]
getgrouplist [LSB]gethostbyaddr [SUSv3]gethostbyaddr_r [LSB]gethostbyname [SUSv3]
gethostbyname2 [LSB]gethostbyname2_r [LSB]gethostbyname_r [LSB]getprotobyname [SUSv3]
getprotobyname_r [LSB]getprotobynumber [SUSv3]getprotobynumber_r [LSB]getprotoent [SUSv3]
getprotoent_r [LSB]getpwent [SUSv3]getpwent_r [LSB]getpwnam [SUSv3]
getpwnam_r [SUSv3]getpwuid [SUSv3]getpwuid_r [SUSv3]getservbyname [SUSv3]
getservbyname_r [LSB]getservbyport [SUSv3]getservbyport_r [LSB]getservent [SUSv3]
getservent_r [LSB]getutent [LSB]getutent_r [LSB]getutxent [SUSv3]
getutxid [SUSv3]getutxline [SUSv3]pututxline [SUSv3]setgrent [SUSv3]
setgroups [LSB]setprotoent [SUSv3]setpwent [SUSv3]setservent [SUSv3]
setutent [LSB]setutxent [SUSv3]utmpname [LSB] 

An LSB conforming implementation shall provide the generic deprecated functions for System Database Interface specified in Table 12-29, with the full mandatory functionality as described in the referenced underlying specification.

Note: These interfaces are deprecated, and applications should avoid using them. These interfaces may be withdrawn in future releases of this specification.

Table 12-29. libc - System Database Interface Deprecated Function Interfaces

gethostbyaddr [SUSv3]gethostbyaddr_r [LSB]gethostbyname [SUSv3]gethostbyname2 [LSB]
gethostbyname2_r [LSB]gethostbyname_r [LSB]  

12.3.18. Language Support


12.3.18.1. Interfaces for Language Support

An LSB conforming implementation shall provide the generic functions for Language Support specified in Table 12-30, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-30. libc - Language Support Function Interfaces

__libc_start_main [LSB]__register_atfork(GLIBC_2.3.2) [LSB]  

12.3.19. Large File Support


12.3.19.1. Interfaces for Large File Support

An LSB conforming implementation shall provide the generic functions for Large File Support specified in Table 12-31, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-31. libc - Large File Support Function Interfaces

__fxstat64 [LSB]__fxstatat64(GLIBC_2.4) [LSB]__lxstat64 [LSB]__xstat64 [LSB]
creat64 [LFS]fgetpos64 [LFS]fopen64 [LFS]freopen64 [LFS]
fseeko64 [LFS]fsetpos64 [LFS]fstatfs64 [LSB]fstatvfs64 [LFS]
ftello64 [LFS]ftruncate64 [LFS]ftw64 [LFS]getrlimit64 [LFS]
lockf64 [LFS]lseek64 [LFS]mkstemp64 [LSB]mmap64 [LFS]
nftw64 [LFS]open64 [LFS]openat64(GLIBC_2.4) [LSB]posix_fadvise64 [LSB]
posix_fallocate64 [LSB]pread64 [LSB]pwrite64 [LSB]readdir64 [LFS]
readdir64_r [LSB]statfs64 [LSB]statvfs64 [LFS]tmpfile64 [LFS]
truncate64 [LFS]   

An LSB conforming implementation shall provide the generic deprecated functions for Large File Support specified in Table 12-32, with the full mandatory functionality as described in the referenced underlying specification.

Note: These interfaces are deprecated, and applications should avoid using them. These interfaces may be withdrawn in future releases of this specification.

Table 12-32. libc - Large File Support Deprecated Function Interfaces

fstatfs64 [LSB]statfs64 [LSB]  

12.3.20. Inotify


12.3.20.1. Interfaces for Inotify

An LSB conforming implementation shall provide the generic functions for Inotify specified in Table 12-33, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-33. libc - Inotify Function Interfaces

inotify_add_watch(GLIBC_2.4) [LSB]inotify_init(GLIBC_2.4) [LSB]inotify_rm_watch(GLIBC_2.4) [LSB] 

12.3.21. Standard Library


12.3.21.1. Interfaces for Standard Library

An LSB conforming implementation shall provide the generic functions for Standard Library specified in Table 12-34, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-34. libc - Standard Library Function Interfaces

_Exit [SUSv3]__assert_fail [LSB]__confstr_chk(GLIBC_2.4) [LSB]__cxa_atexit [LSB]
__cxa_finalize [LSB]__errno_location [LSB]__fpending [LSB]__getcwd_chk(GLIBC_2.4) [LSB]
__getlogin_r_chk(GLIBC_2.4) [LSB]__getpagesize [LSB]__isinf [LSB]__isinff [LSB]
__isinfl [LSB]__isnan [LSB]__isnanf [LSB]__isnanl [LSB]
__pread64_chk(GLIBC_2.4) [LSB]__pread_chk(GLIBC_2.4) [LSB]__realpath_chk(GLIBC_2.4) [LSB]__sysconf [LSB]
__syslog_chk(GLIBC_2.4) [LSB]__ttyname_r_chk(GLIBC_2.4) [LSB]__vsyslog_chk(GLIBC_2.4) [LSB]__xpg_basename [LSB]
_exit [SUSv3]_longjmp [SUSv3]_setjmp [SUSv3]a64l [SUSv3]
abort [SUSv3]abs [SUSv3]alphasort [SUSv4]alphasort64 [LSB]
atof [SUSv3]atoi [SUSv3]atol [SUSv3]atoll [SUSv3]
basename [LSB]bsearch [SUSv3]calloc [SUSv3]closelog [SUSv3]
confstr [SUSv3]cuserid [SUSv2]daemon [LSB]dirfd [SUSv4]
dirname [SUSv3]div [SUSv3]dl_iterate_phdr [LSB]drand48 [SUSv3]
drand48_r [LSB]ecvt [SUSv3]erand48 [SUSv3]erand48_r [LSB]
err [LSB]error [LSB]errx [LSB]fcvt [SUSv3]
fmemopen [SUSv4]fmtmsg [SUSv3]fnmatch [SUSv3]fpathconf [SUSv3]
free [SUSv3]freeaddrinfo [SUSv3]ftrylockfile [SUSv3]ftw [SUSv3]
funlockfile [SUSv3]gai_strerror [SUSv3]gcvt [SUSv3]getaddrinfo [SUSv3]
getcwd [SUSv3]getdate [SUSv3]getdomainname [LSB]getenv [SUSv3]
getlogin [SUSv3]getlogin_r [SUSv3]getnameinfo [SUSv3]getopt [LSB]
getopt_long [LSB]getopt_long_only [LSB]getsubopt [SUSv3]gettimeofday [SUSv3]
glob [SUSv3]glob64 [LSB]globfree [SUSv3]globfree64 [LSB]
grantpt [SUSv3]hcreate [SUSv3]hcreate_r [LSB]hdestroy [SUSv3]
hdestroy_r [LSB]hsearch [SUSv3]hsearch_r [LSB]htonl [SUSv3]
htons [SUSv3]imaxabs [SUSv3]imaxdiv [SUSv3]inet_addr [SUSv3]
inet_aton [LSB]inet_ntoa [SUSv3]inet_ntop [SUSv3]inet_pton [SUSv3]
initstate [SUSv3]initstate_r [LSB]insque [SUSv3]isatty [SUSv3]
isblank [SUSv3]jrand48 [SUSv3]jrand48_r [LSB]l64a [SUSv3]
labs [SUSv3]lcong48 [SUSv3]lcong48_r [LSB]ldiv [SUSv3]
lfind [SUSv3]llabs [SUSv3]lldiv [SUSv3]longjmp [SUSv3]
lrand48 [SUSv3]lrand48_r [LSB]lsearch [SUSv3]makecontext [SUSv3]
malloc [SUSv3]memmem [LSB]mkdtemp [SUSv4]mkstemp [SUSv3]
mktemp [SUSv3]mrand48 [SUSv3]mrand48_r [LSB]nftw [SUSv3]
nrand48 [SUSv3]nrand48_r [LSB]ntohl [SUSv3]ntohs [SUSv3]
open_memstream [SUSv4]open_wmemstream(GLIBC_2.4) [SUSv4]openlog [SUSv3]perror [SUSv3]
posix_openpt [SUSv3]ptsname [SUSv3]putenv [SUSv3]qsort [SUSv3]
rand [SUSv3]rand_r [SUSv3]random [SUSv3]random_r [LSB]
realloc [SUSv3]realpath [SUSv3]remque [SUSv3]scandir [SUSv4]
scandir64 [LSB]seed48 [SUSv3]seed48_r [LSB]sendfile [LSB]
sendfile64(GLIBC_2.3) [LSB]setenv [SUSv3]sethostname [LSB]setlogmask [SUSv3]
setstate [SUSv3]setstate_r [LSB]srand [SUSv3]srand48 [SUSv3]
srand48_r [LSB]srandom [SUSv3]srandom_r [LSB]strtod [SUSv3]
strtol [SUSv3]strtoul [SUSv3]swapcontext [SUSv3]syslog [SUSv3]
system [LSB]tdelete [SUSv3]tfind [SUSv3]tmpfile [SUSv3]
tmpnam [SUSv3]tsearch [SUSv3]ttyname [SUSv3]ttyname_r [SUSv3]
twalk [SUSv3]unlockpt [SUSv3]unsetenv [SUSv3]usleep [SUSv3]
verrx [LSB]vfscanf [LSB]vscanf [LSB]vsscanf [LSB]
vsyslog [LSB]warn [LSB]warnx [LSB]wordexp [SUSv3]
wordfree [SUSv3]   

An LSB conforming implementation shall provide the generic deprecated functions for Standard Library specified in Table 12-35, with the full mandatory functionality as described in the referenced underlying specification.

Note: These interfaces are deprecated, and applications should avoid using them. These interfaces may be withdrawn in future releases of this specification.

Table 12-35. libc - Standard Library Deprecated Function Interfaces

basename [LSB]getdomainname [LSB]inet_aton [LSB]tmpnam [SUSv3]

An LSB conforming implementation shall provide the generic data interfaces for Standard Library specified in Table 12-36, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-36. libc - Standard Library Data Interfaces

__environ [LSB]_environ [LSB]_sys_errlist [LSB]environ [SUSv3]
getdate_err [SUSv3]optarg [SUSv3]opterr [SUSv3]optind [SUSv3]
optopt [SUSv3]   

12.3.22. GNU Extensions for libc


12.3.22.1. Interfaces for GNU Extensions for libc

An LSB conforming implementation shall provide the generic functions for GNU Extensions for libc specified in Table 12-37, with the full mandatory functionality as described in the referenced underlying specification.

Table 12-37. libc - GNU Extensions for libc Function Interfaces

gnu_get_libc_release [LSB]gnu_get_libc_version [LSB]  

12.4. Data Definitions for libc

This section defines global identifiers and their values that are associated with interfaces contained in libc. These definitions are organized into groups that correspond to system headers. This convention is used as a convenience for the reader, and does not imply the existence of these headers, or their content. Where an interface is defined as requiring a particular system header file all of the data definitions for that system header file presented here shall be in effect.

This section gives data definitions to promote binary application portability, not to repeat source interface definitions available elsewhere. System providers and application developers should use this ABI to supplement - not to replace - source interface definition specifications.

This specification uses the ISO C (1999) C Language as the reference programming language, and data definitions are specified in ISO C format. The C language is used here as a convenient notation. Using a C language description of these data objects does not preclude their use by other programming languages.


12.4.1. arpa/inet.h


extern uint32_t htonl(uint32_t);
extern uint16_t htons(uint16_t);
extern in_addr_t inet_addr(const char *__cp);
extern int inet_aton(const char *__cp, struct in_addr *__inp);
extern char *inet_ntoa(struct in_addr __in);
extern const char *inet_ntop(int __af, const void *__cp, char *__buf,
			     socklen_t __len);
extern int inet_pton(int __af, const char *__cp, void *__buf);
extern uint32_t ntohl(uint32_t);
extern uint16_t ntohs(uint16_t);

12.4.2. assert.h


#ifdef NDEBUG
#define assert(expr) ((void)0)
#else
#define assert(expr)	((void) ((expr) ? 0 : (__assert_fail (#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__), 0)))
#endif

extern void __assert_fail(const char *__assertion, const char *__file,
			  unsigned int __line, const char *__function);

12.4.3. cpio.h


#define C_IXOTH	000001
#define C_IWOTH	000002
#define C_IROTH	000004
#define C_IXGRP	000010
#define C_IWGRP	000020
#define C_IRGRP	000040
#define C_IXUSR	000100
#define C_IWUSR	000200
#define C_IRUSR	000400
#define C_ISVTX	001000
#define C_ISGID	002000
#define C_ISUID	004000
#define C_ISFIFO	010000
#define C_ISREG	0100000
#define C_ISCTG	0110000
#define C_ISLNK	0120000
#define C_ISSOCK	0140000
#define C_ISCHR	020000
#define C_ISDIR	040000
#define C_ISBLK	060000
#define MAGIC	"070707"

12.4.4. ctype.h


extern const unsigned short **__ctype_b_loc(void);
extern const int32_t **__ctype_tolower_loc(void);
extern const int32_t **__ctype_toupper_loc(void);
extern int _tolower(int);
extern int _toupper(int);
extern int isalnum(int);
extern int isalpha(int);
extern int isascii(int __c);
extern int isblank(int);
extern int iscntrl(int);
extern int isdigit(int);
extern int isgraph(int);
extern int islower(int);
extern int isprint(int);
extern int ispunct(int);
extern int isspace(int);
extern int isupper(int);
extern int isxdigit(int);
extern int toascii(int __c);
extern int tolower(int __c);
extern int toupper(int __c);

12.4.5. dirent.h


typedef struct __dirstream DIR;

struct dirent {
    long int d_ino;
    off_t d_off;
    unsigned short d_reclen;
    unsigned char d_type;
    char d_name[256];
};
struct dirent64 {
    uint64_t d_ino;
    int64_t d_off;
    unsigned short d_reclen;
    unsigned char d_type;
    char d_name[256];
};
extern int alphasort(const struct dirent **__e1,
		     const struct dirent **__e2);
extern int alphasort64(const struct dirent64 **__e1,
		       const struct dirent64 **__e2);
extern int closedir(DIR * __dirp);
extern int dirfd(DIR * __dirp);
extern DIR *fdopendir(int __fd);
extern DIR *opendir(const char *__name);
extern struct dirent *readdir(DIR * __dirp);
extern struct dirent64 *readdir64(DIR * __dirp);
extern int readdir64_r(DIR * __dirp, struct dirent64 *__entry,
		       struct dirent64 **__result);
extern int readdir_r(DIR * __dirp, struct dirent *__entry,
		     struct dirent **__result);
extern void rewinddir(DIR * __dirp);
extern int scandir(const char *__dir, struct dirent ***__namelist,
		   int (*__selector) (const struct dirent *),
		   int (*__cmp) (const struct dirent * *,
				 const struct dirent * *));
extern int scandir64(const char *__dir, struct dirent64 ***__namelist,
		     int (*__selector) (const struct dirent64 *),
		     int (*__cmp) (const struct dirent64 * *,
				   const struct dirent64 * *));
extern void seekdir(DIR * __dirp, long int __pos);
extern long int telldir(DIR * __dirp);

12.4.6. elf.h


#define ELFMAG1	'E'
#define ELFMAG3	'F'
#define ELFMAG2	'L'
#define ELF32_ST_INFO(bind,type)	(((bind) << 4) + ((type) & 0xf))
#define ELF32_ST_BIND(val)	(((unsigned char) (val)) >> 4)
#define ELF32_ST_TYPE(val)	((val) & 0xf)
#define PF_X	(1 << 0)
#define SHF_WRITE	(1 << 0)
#define PF_W	(1 << 1)
#define SHF_ALLOC	(1 << 1)
#define SHF_TLS	(1 << 10)
#define PF_R	(1 << 2)
#define SHF_EXECINSTR	(1 << 2)
#define SHF_MERGE	(1 << 4)
#define SHF_STRINGS	(1 << 5)
#define SHF_LINK_ORDER	(1 << 7)
#define EI_NIDENT	(16)
#define DT_ADDRTAGIDX(tag)	(DT_ADDRRNGHI - (tag))
#define DT_VALTAGIDX(tag)	(DT_VALRNGHI - (tag))
#define DT_VERSIONTAGIDX(tag)	(DT_VERNEEDNUM - (tag))
#define PT_IA_64_UNWIND	(PT_LOPROC + 1)
#define SHT_IA_64_EXT	(SHT_LOPROC + 0)
#define SHT_IA_64_UNWIND	(SHT_LOPROC + 1)
#define DT_NULL	0
#define EI_MAG0	0
#define ELFCLASSNONE	0
#define ELFDATANONE	0
#define ELFOSABI_NONE	0
#define ELFOSABI_SYSV	0
#define ET_NONE	0
#define EV_NONE	0
#define PT_NULL	0
#define SHN_UNDEF	0
#define SHT_NULL	0
#define STB_LOCAL	0
#define STT_NOTYPE	0
#define DF_ORIGIN	0x00000001	/* Object may use DF_ORIGIN */
#define DF_SYMBOLIC	0x00000002	/* Symbol resolutions start with this object */
#define DF_TEXTREL	0x00000004	/* Object contains text relocations */
#define DF_BIND_NOW	0x00000008	/* No lazy binding for this object */
#define DF_STATIC_TLS	0x00000010	/* Module uses the static TLS model */
#define SHF_IA_64_SHORT	0x10000000
#define PT_LOOS	0x60000000
#define DT_LOOS	0x6000000d
#define PT_GNU_EH_FRAME	0x6474e550
#define PT_GNU_STACK	0x6474e551
#define PT_GNU_RELRO	0x6474e552
#define DT_HIOS	0x6ffff000
#define DT_VALRNGLO	0x6ffffd00
#define DT_GNU_PRELINKED	0x6ffffdf5
#define DT_GNU_CONFLICTSZ	0x6ffffdf6
#define DT_GNU_LIBLISTSZ	0x6ffffdf7
#define DT_CHECKSUM	0x6ffffdf8
#define DT_PLTPADSZ	0x6ffffdf9
#define DT_MOVEENT	0x6ffffdfa
#define DT_MOVESZ	0x6ffffdfb
#define DT_FEATURE_1	0x6ffffdfc
#define DT_POSFLAG_1	0x6ffffdfd
#define DT_SYMINSZ	0x6ffffdfe
#define DT_SYMINENT	0x6ffffdff
#define DT_VALRNGHI	0x6ffffdff
#define DT_ADDRRNGLO	0x6ffffe00
#define DT_GNU_HASH	0x6ffffef5
#define DT_TLSDESC_PLT	0x6ffffef6
#define DT_TLSDESC_GOT	0x6ffffef7
#define DT_GNU_CONFLICT	0x6ffffef8
#define DT_GNU_LIBLIST	0x6ffffef9
#define DT_CONFIG	0x6ffffefa
#define DT_DEPAUDIT	0x6ffffefb
#define DT_AUDIT	0x6ffffefc
#define DT_PLTPAD	0x6ffffefd
#define DT_MOVETAB	0x6ffffefe
#define DT_ADDRRNGHI	0x6ffffeff
#define DT_SYMINFO	0x6ffffeff
#define DT_VERSYM	0x6ffffff0
#define DT_RELACOUNT	0x6ffffff9
#define DT_RELCOUNT	0x6ffffffa
#define DT_FLAGS_1	0x6ffffffb
#define DT_VERDEF	0x6ffffffc
#define DT_VERDEFNUM	0x6ffffffd
#define SHT_GNU_verdef	0x6ffffffd
#define DT_VERNEED	0x6ffffffe
#define SHT_GNU_verneed	0x6ffffffe
#define DT_VERNEEDNUM	0x6fffffff
#define SHT_GNU_versym	0x6fffffff
#define DT_LOPROC	0x70000000
#define PT_LOPROC	0x70000000
#define SHT_LOPROC	0x70000000
#define ELFMAG0	0x7f
#define DT_AUXILIARY	0x7ffffffd
#define DT_FILTER	0x7fffffff
#define DT_HIPROC	0x7fffffff
#define PT_HIPROC	0x7fffffff
#define SHT_HIPROC	0x7fffffff
#define SHT_LOUSER	0x80000000
#define SHT_HIUSER	0x8fffffff
#define ET_LOOS	0xfe00
#define ET_HIOS	0xfeff
#define ET_LOPROC	0xff00
#define SHN_LOPROC	0xff00
#define SHN_LORESERVE	0xff00
#define SHN_HIPROC	0xff1f
#define SHN_LOOS	0xff20
#define SHN_HIOS	0xff3f
#define SHN_ABS	0xfff1
#define SHN_COMMON	0xfff2
#define ET_HIPROC	0xffff
#define SHN_HIRESERVE	0xffff
#define SHN_XINDEX	0xffff
#define DT_NEEDED	1
#define EI_MAG1	1
#define ELFCLASS32	1
#define ELFDATA2LSB	1
#define ET_REL	1
#define EV_CURRENT	1
#define PT_LOAD	1
#define SHT_PROGBITS	1
#define STB_GLOBAL	1
#define STT_OBJECT	1
#define DT_STRSZ	10
#define SHT_SHLIB	10
#define STB_LOOS	10
#define DT_ADDRNUM	11
#define DT_SYMENT	11
#define SHT_DYNSYM	11
#define DT_INIT	12
#define DT_VALNUM	12
#define STB_HIOS	12
#define DT_FINI	13
#define STB_LOPROC	13
#define DT_SONAME	14
#define SHT_INIT_ARRAY	14
#define DT_RPATH	15
#define SHT_FINI_ARRAY	15
#define STB_HIPROC	15
#define DT_SYMBOLIC	16
#define DT_VERSIONTAGNUM	16
#define SHT_PREINIT_ARRAY	16
#define DT_REL	17
#define DT_RELSZ	18
#define DT_RELENT	19
#define DT_PLTRELSZ	2
#define EI_MAG2	2
#define ELFCLASS64	2
#define ELFDATA2MSB	2
#define ET_EXEC	2
#define EV_NUM	2
#define PT_DYNAMIC	2
#define SHT_SYMTAB	2
#define STB_WEAK	2
#define STT_FUNC	2
#define DT_PLTREL	20
#define DT_DEBUG	21
#define DT_TEXTREL	22
#define DT_JMPREL	23
#define DT_BIND_NOW	24
#define DT_INIT_ARRAY	25
#define DT_FINI_ARRAY	26
#define DT_INIT_ARRAYSZ	27
#define DT_FINI_ARRAYSZ	28
#define DT_RUNPATH	29
#define DT_EXTRANUM	3
#define DT_PLTGOT	3
#define EI_MAG3	3
#define ELFCLASSNUM	3
#define ELFDATANUM	3
#define ELFOSABI_LINUX	3
#define ET_DYN	3
#define PT_INTERP	3
#define SHT_STRTAB	3
#define STB_NUM	3
#define DT_FLAGS	30
#define DT_ENCODING	32
#define DT_PREINIT_ARRAY	32
#define DT_PREINIT_ARRAYSZ	33
#define DT_NUM	34
#define DT_HASH	4
#define EI_CLASS	4
#define ET_CORE	4
#define PT_NOTE	4
#define SELFMAG	4
#define SHT_RELA	4
#define DT_STRTAB	5
#define EI_DATA	5
#define ET_NUM	5
#define PT_SHLIB	5
#define SHT_HASH	5
#define DT_SYMTAB	6
#define EI_VERSION	6
#define PT_PHDR	6
#define SHT_DYNAMIC	6
#define DT_RELA	7
#define EI_OSABI	7
#define PT_TLS	7
#define SHT_NOTE	7
#define DT_RELASZ	8
#define EI_ABIVERSION	8
#define PT_NUM	8
#define SHT_NOBITS	8
#define DT_RELAENT	9
#define SHT_REL	9
#define ELF64_ST_BIND(val)	ELF32_ST_BIND (val)
#define ELF64_ST_INFO(bind,type)	ELF32_ST_INFO ((bind), (type))
#define ELF64_ST_TYPE(val)	ELF32_ST_TYPE (val)
#define ELFMAG	"\177ELF"

typedef uint32_t Elf32_Addr;
typedef uint64_t Elf64_Addr;
typedef uint32_t Elf32_Word;
typedef uint32_t Elf64_Word;
typedef int32_t Elf32_Sword;
typedef int32_t Elf64_Sword;
typedef uint64_t Elf32_Xword;
typedef uint64_t Elf64_Xword;
typedef int64_t Elf32_Sxword;
typedef int64_t Elf64_Sxword;
typedef uint32_t Elf32_Off;
typedef uint64_t Elf64_Off;
typedef struct {
    Elf32_Word p_type;		/* Segment type */
    Elf32_Off p_offset;		/* Segment file offset */
    Elf32_Addr p_vaddr;		/* Segment virtual address */
    Elf32_Addr p_paddr;		/* Segment physical address */
    Elf32_Word p_filesz;	/* Segment size in file */
    Elf32_Word p_memsz;		/* Segment size in memory */
    Elf32_Word p_flags;		/* Segment flags */
    Elf32_Word p_align;		/* Segment alignment */
} Elf32_Phdr;
typedef struct {
    Elf64_Word p_type;		/* Segment type */
    Elf64_Word p_flags;		/* Segment flags */
    Elf64_Off p_offset;		/* Segment file offset */
    Elf64_Addr p_vaddr;		/* Segment virtual address */
    Elf64_Addr p_paddr;		/* Segment physical address */
    Elf64_Xword p_filesz;	/* Segment size in file */
    Elf64_Xword p_memsz;	/* Segment size in memory */
    Elf64_Xword p_align;	/* Segment alignment */
} Elf64_Phdr;
typedef uint16_t Elf32_Half;
typedef uint16_t Elf64_Half;
typedef uint16_t Elf32_Section;
typedef uint16_t Elf64_Section;
typedef struct {
    Elf32_Word n_namesz;
    Elf32_Word n_descsz;
    Elf32_Word n_type;
} Elf32_Nhdr;
typedef struct {
    Elf64_Word n_namesz;
    Elf64_Word n_descsz;
    Elf64_Word n_type;
} Elf64_Nhdr;
typedef struct {
    Elf64_Word st_name;
    unsigned char st_info;
    unsigned char st_other;
    Elf64_Section st_shndx;
    Elf64_Addr st_value;
    Elf64_Xword st_size;
} Elf64_Sym;
typedef struct {
    Elf32_Word st_name;
    Elf32_Addr st_value;
    Elf32_Word st_size;
    unsigned char st_info;
    unsigned char st_other;
    Elf32_Section st_shndx;
} Elf32_Sym;
typedef struct {
    Elf64_Addr r_offset;
    Elf64_Xword r_info;
} Elf64_Rel;
typedef struct {
    Elf32_Addr r_offset;
    Elf32_Word r_info;
} Elf32_Rel;
typedef struct {
    Elf64_Addr r_offset;
    Elf64_Xword r_info;
    Elf64_Sxword r_addend;
} Elf64_Rela;
typedef struct {
    Elf32_Addr r_offset;
    Elf32_Word r_info;
    Elf32_Sword r_addend;
} Elf32_Rela;
typedef struct {
    Elf32_Half vd_version;
    Elf32_Half vd_flags;
    Elf32_Half vd_ndx;
    Elf32_Half vd_cnt;
    Elf32_Word vd_hash;
    Elf32_Word vd_aux;
    Elf32_Word vd_next;
} Elf32_Verdef;
typedef struct {
    Elf64_Half vd_version;
    Elf64_Half vd_flags;
    Elf64_Half vd_ndx;
    Elf64_Half vd_cnt;
    Elf64_Word vd_hash;
    Elf64_Word vd_aux;
    Elf64_Word vd_next;
} Elf64_Verdef;
typedef struct {
    Elf64_Word vda_name;
    Elf64_Word vda_next;
} Elf64_Verdaux;
typedef struct {
    Elf32_Word vda_name;
    Elf32_Word vda_next;
} Elf32_Verdaux;
typedef struct {
    Elf32_Half vn_version;
    Elf32_Half vn_cnt;
    Elf32_Word vn_file;
    Elf32_Word vn_aux;
    Elf32_Word vn_next;
} Elf32_Verneed;
typedef struct {
    Elf64_Half vn_version;
    Elf64_Half vn_cnt;
    Elf64_Word vn_file;
    Elf64_Word vn_aux;
    Elf64_Word vn_next;
} Elf64_Verneed;
typedef struct {
    Elf32_Word vna_hash;
    Elf32_Half vna_flags;
    Elf32_Half vna_other;
    Elf32_Word vna_name;
    Elf32_Word vna_next;
} Elf32_Vernaux;
typedef struct {
    Elf64_Word vna_hash;
    Elf64_Half vna_flags;
    Elf64_Half vna_other;
    Elf64_Word vna_name;
    Elf64_Word vna_next;
} Elf64_Vernaux;
typedef struct {
    unsigned char e_ident[EI_NIDENT];
    Elf64_Half e_type;
    Elf64_Half e_machine;
    Elf64_Word e_version;
    Elf64_Addr e_entry;
    Elf64_Off e_phoff;
    Elf64_Off e_shoff;
    Elf64_Word e_flags;
    Elf64_Half e_ehsize;
    Elf64_Half e_phentsize;
    Elf64_Half e_phnum;
    Elf64_Half e_shentsize;
    Elf64_Half e_shnum;
    Elf64_Half e_shstrndx;
} Elf64_Ehdr;
typedef struct {
    unsigned char e_ident[EI_NIDENT];
    Elf32_Half e_type;
    Elf32_Half e_machine;
    Elf32_Word e_version;
    Elf32_Addr e_entry;
    Elf32_Off e_phoff;
    Elf32_Off e_shoff;
    Elf32_Word e_flags;
    Elf32_Half e_ehsize;
    Elf32_Half e_phentsize;
    Elf32_Half e_phnum;
    Elf32_Half e_shentsize;
    Elf32_Half e_shnum;
    Elf32_Half e_shstrndx;
} Elf32_Ehdr;
typedef struct {
    Elf32_Word sh_name;
    Elf32_Word sh_type;
    Elf32_Word sh_flags;
    Elf32_Addr sh_addr;
    Elf32_Off sh_offset;
    Elf32_Word sh_size;
    Elf32_Word sh_link;
    Elf32_Word sh_info;
    Elf32_Word sh_addralign;
    Elf32_Word sh_entsize;
} Elf32_Shdr;
typedef struct {
    Elf64_Word sh_name;
    Elf64_Word sh_type;
    Elf64_Xword sh_flags;
    Elf64_Addr sh_addr;
    Elf64_Off sh_offset;
    Elf64_Xword sh_size;
    Elf64_Word sh_link;
    Elf64_Word sh_info;
    Elf64_Xword sh_addralign;
    Elf64_Xword sh_entsize;
} Elf64_Shdr;
typedef struct {
    Elf32_Sword d_tag;
    union {
	Elf32_Word d_val;
	Elf32_Addr d_ptr;
    } d_un;
} Elf32_Dyn;
typedef struct {
    Elf64_Sxword d_tag;
    union {
	Elf64_Xword d_val;
	Elf64_Addr d_ptr;
    } d_un;
} Elf64_Dyn;

12.4.7. endian.h


#define __LITTLE_ENDIAN	1234
#define __BIG_ENDIAN	4321
#define BIG_ENDIAN	__BIG_ENDIAN
#define BYTE_ORDER	__BYTE_ORDER
#define LITTLE_ENDIAN	__LITTLE_ENDIAN

12.4.8. err.h


extern void err(int __status, const char *__format, ...);
extern void error(int, int, const char *, ...);
extern void errx(int __status, const char *__format, ...);
extern void warn(const char *__format, ...);
extern void warnx(const char *__format, ...);

12.4.9. errno.h


#define errno	(*__errno_location())

#define EPERM	1		/* Operation not permitted */
#define ECHILD	10		/* No child processes */
#define ENETDOWN	100	/* Network is down */
#define ENETUNREACH	101	/* Network is unreachable */
#define ENETRESET	102	/* Network dropped connection because of reset */
#define ECONNABORTED	103	/* Software caused connection abort */
#define ECONNRESET	104	/* Connection reset by peer */
#define ENOBUFS	105		/* No buffer space available */
#define EISCONN	106		/* Transport endpoint is already connected */
#define ENOTCONN	107	/* Transport endpoint is not connected */
#define ESHUTDOWN	108	/* Cannot send after transport endpoint shutdown */
#define ETOOMANYREFS	109	/* Too many references: cannot splice */
#define EAGAIN	11		/* Try again */
#define ETIMEDOUT	110	/* Connection timed out */
#define ECONNREFUSED	111	/* Connection refused */
#define EHOSTDOWN	112	/* Host is down */
#define EHOSTUNREACH	113	/* No route to host */
#define EALREADY	114	/* Operation already in progress */
#define EINPROGRESS	115	/* Operation now in progress */
#define ESTALE	116		/* Stale NFS file handle */
#define EUCLEAN	117		/* Structure needs cleaning */
#define ENOTNAM	118		/* Not a XENIX named type file */
#define ENAVAIL	119		/* No XENIX semaphores available */
#define ENOMEM	12		/* Out of memory */
#define EISNAM	120		/* Is a named type file */
#define EREMOTEIO	121	/* Remote I/O error */
#define EDQUOT	122		/* Quota exceeded */
#define ENOMEDIUM	123	/* No medium found */
#define EMEDIUMTYPE	124	/* Wrong medium type */
#define ECANCELED	125	/* Operation Canceled */
#define EACCES	13		/* Permission denied */
#define EOWNERDEAD	130
#define ENOTRECOVERABLE	131
#define EFAULT	14		/* Bad address */
#define ENOTBLK	15		/* Block device required */
#define EBUSY	16		/* Device or resource busy */
#define EEXIST	17		/* File exists */
#define EXDEV	18		/* Cross-device link */
#define ENODEV	19		/* No such device */
#define ENOENT	2		/* No such file or directory */
#define ENOTDIR	20		/* Not a directory */
#define EISDIR	21		/* Is a directory */
#define EINVAL	22		/* Invalid argument */
#define ENFILE	23		/* File table overflow */
#define EMFILE	24		/* Too many open files */
#define ENOTTY	25		/* Not a typewriter */
#define ETXTBSY	26		/* Text file busy */
#define EFBIG	27		/* File too large */
#define ENOSPC	28		/* No space left on device */
#define ESPIPE	29		/* Illegal seek */
#define ESRCH	3		/* No such process */
#define EROFS	30		/* Read-only file system */
#define EMLINK	31		/* Too many links */
#define EPIPE	32		/* Broken pipe */
#define EDOM	33		/* Math argument out of domain of func */
#define ERANGE	34		/* Math result not representable */
#define EDEADLK	35		/* Resource deadlock would occur */
#define ENAMETOOLONG	36	/* File name too long */
#define ENOLCK	37		/* No record locks available */
#define ENOSYS	38		/* Function not implemented */
#define ENOTEMPTY	39	/* Directory not empty */
#define EINTR	4		/* Interrupted system call */
#define ELOOP	40		/* Too many symbolic links encountered */
#define ENOMSG	42		/* No message of desired type */
#define EIDRM	43		/* Identifier removed */
#define ECHRNG	44		/* Channel number out of range */
#define EL2NSYNC	45	/* Level 2 not synchronized */
#define EL3HLT	46		/* Level 3 halted */
#define EL3RST	47		/* Level 3 reset */
#define ELNRNG	48		/* Link number out of range */
#define EUNATCH	49		/* Protocol driver not attached */
#define EIO	5		/* I/O error */
#define ENOANO	55		/* No anode */
#define EBADRQC	56		/* Invalid request code */
#define EBADSLT	57		/* Invalid slot */
#define EBFONT	59		/* Bad font file format */
#define ENXIO	6		/* No such device or address */
#define ENOSTR	60		/* Device not a stream */
#define ENODATA	61		/* No data available */
#define ETIME	62		/* Timer expired */
#define ENOSR	63		/* Out of streams resources */
#define ENONET	64		/* Machine is not on the network */
#define ENOPKG	65		/* Package not installed */
#define EREMOTE	66		/* Object is remote */
#define ENOLINK	67		/* Link has been severed */
#define EADV	68		/* Advertise error */
#define ESRMNT	69		/* Srmount error */
#define E2BIG	7		/* Argument list too long */
#define ECOMM	70		/* Communication error on send */
#define EPROTO	71		/* Protocol error */
#define EMULTIHOP	72	/* Multihop attempted */
#define EDOTDOT	73		/* RFS specific error */
#define EBADMSG	74		/* Not a data message */
#define EOVERFLOW	75	/* Value too large for defined data type */
#define ENOTUNIQ	76	/* Name not unique on network */
#define EBADFD	77		/* File descriptor in bad state */
#define EREMCHG	78		/* Remote address changed */
#define ELIBACC	79		/* Can not access a needed shared library */
#define ENOEXEC	8		/* Exec format error */
#define ELIBBAD	80		/* Accessing a corrupted shared library */
#define ELIBSCN	81		/* .lib section in a.out corrupted */
#define ELIBMAX	82		/* Attempting to link in too many shared libraries */
#define ELIBEXEC	83	/* Cannot exec a shared library directly */
#define EILSEQ	84		/* Illegal byte sequence */
#define ERESTART	85	/* Interrupted system call should be restarted */
#define ESTRPIPE	86	/* Streams pipe error */
#define EUSERS	87		/* Too many users */
#define ENOTSOCK	88	/* Socket operation on non-socket */
#define EDESTADDRREQ	89	/* Destination address required */
#define EBADF	9		/* Bad file number */
#define EMSGSIZE	90	/* Message too long */
#define EPROTOTYPE	91	/* Protocol wrong type for socket */
#define ENOPROTOOPT	92	/* Protocol not available */
#define EPROTONOSUPPORT	93	/* Protocol not supported */
#define ESOCKTNOSUPPORT	94	/* Socket type not supported */
#define EOPNOTSUPP	95	/* Operation not supported on transport endpoint */
#define EPFNOSUPPORT	96	/* Protocol family not supported */
#define EAFNOSUPPORT	97	/* Address family not supported by protocol */
#define EADDRINUSE	98	/* Address already in use */
#define EADDRNOTAVAIL	99	/* Cannot assign requested address */
#define EWOULDBLOCK	EAGAIN	/* Operation would block */
#define ENOTSUP	EOPNOTSUPP

extern int *__errno_location(void);

12.4.10. execinfo.h


extern int backtrace(void **__array, int __size);
extern char **backtrace_symbols(void *const *__array, int __size);
extern void backtrace_symbols_fd(void *const *__array, int __size,
				 int __fd);

12.4.11. fcntl.h


#define POSIX_FADV_NORMAL	0
#define O_RDONLY	00
#define O_ACCMODE	0003
#define O_WRONLY	01
#define O_CREAT	0100
#define O_TRUNC	01000
#define O_DSYNC	010000
#define O_RSYNC	010000
#define O_SYNC	010000
#define O_RDWR	02
#define O_EXCL	0200
#define O_APPEND	02000
#define O_ASYNC	020000
#define O_NOCTTY	0400
#define O_NDELAY	04000
#define O_NONBLOCK	04000
#define FD_CLOEXEC	1
#define POSIX_FADV_RANDOM	1
#define POSIX_FADV_SEQUENTIAL	2
#define POSIX_FADV_WILLNEED	3

struct flock {
    short l_type;
    short l_whence;
    off_t l_start;
    off_t l_len;
    pid_t l_pid;
};
struct flock64 {
    short l_type;
    short l_whence;
    loff_t l_start;
    loff_t l_len;
    pid_t l_pid;
};

#define AT_FDCWD	-100
#define AT_SYMLINK_NOFOLLOW	0x100
#define AT_EACCESS	0x200
#define AT_REMOVEDIR	0x200
#define AT_SYMLINK_FOLLOW	0x400

#define F_DUPFD	0
#define F_RDLCK	0
#define F_GETFD	1
#define F_WRLCK	1
#define F_SETSIG	10
#define F_GETSIG	11
#define F_SETFD	2
#define F_UNLCK	2
#define F_GETFL	3
#define F_SETFL	4
#define F_GETLK	5
#define F_SETLK	6
#define F_SETLKW	7
#define F_SETOWN	8
#define F_GETOWN	9

extern int creat(const char *__file, mode_t __mode);
extern int creat64(const char *__file, mode_t __mode);
extern int fcntl(int __fd, int __cmd, ...);
extern int open(const char *__file, int __oflag, ...);
extern int open64(const char *__file, int __oflag, ...);
extern int openat(int __fd, const char *__file, int __oflag, ...);
extern int openat64(int __fd, const char *__file, int __oflag, ...);
extern int posix_fadvise(int __fd, off_t __offset, off_t __len,
			 int __advise);
extern int posix_fadvise64(int __fd, off64_t __offset, off64_t __len,
			   int __advise);
extern int posix_fallocate(int __fd, off_t __offset, off_t __len);
extern int posix_fallocate64(int __fd, off64_t __offset, off64_t __len);

12.4.12. fmtmsg.h


#define MM_HARD	1		/* Source of the condition is hardware. */
#define MM_NRECOV	128	/* Non-recoverable error. */
#define MM_UTIL	16		/* Condition detected by utility. */
#define MM_SOFT	2		/* Source of the condition is software. */
#define MM_PRINT	256	/* Display message in standard error. */
#define MM_OPSYS	32	/* Condition detected by operating system. */
#define MM_FIRM	4		/* Source of the condition is firmware. */
#define MM_CONSOLE	512	/* Display message on system console. */
#define MM_RECOVER	64	/* Recoverable error. */
#define MM_APPL	8		/* Condition detected by application. */

#define MM_NOSEV	0	/* No severity level provided for the message. */
#define MM_HALT	1		/* Error causing application to halt. */
#define MM_ERROR	2	/* Application has encountered a non-fatal fault. */
#define MM_WARNING	3	/* Application has detected unusual non-error condition. */
#define MM_INFO	4		/* Informative message. */

#define MM_NULLACT	((char *) 0)
#define MM_NULLLBL	((char *) 0)
#define MM_NULLTAG	((char *) 0)
#define MM_NULLTXT	((char *) 0)
#define MM_NULLMC	((long int) 0)
#define MM_NULLSEV	0

#define MM_NOTOK	-1	/* The function failed completely. */
#define MM_OK	0		/* The function succeeded. */
#define MM_NOMSG	1	/* The function was unable to generate a message on standard error, but otherwise succeeded. */
#define MM_NOCON	4	/* The function was unable to generate a console message, but otherwise succeeded. */

extern int fmtmsg(long int __classification, const char *__label,
		  int __severity, const char *__text, const char *__action,
		  const char *__tag);

12.4.13. fnmatch.h


#define FNM_PATHNAME	(1<<0)
#define FNM_NOESCAPE	(1<<1)
#define FNM_PERIOD	(1<<2)
#define FNM_NOMATCH	1

extern int fnmatch(const char *__pattern, const char *__name, int __flags);

12.4.14. ftw.h


#define FTW_D	FTW_D
#define FTW_DNR	FTW_DNR
#define FTW_DP	FTW_DP
#define FTW_F	FTW_F
#define FTW_NS	FTW_NS
#define FTW_SL	FTW_SL
#define FTW_SLN	FTW_SLN

enum {
    FTW_F,
    FTW_D,
    FTW_DNR,
    FTW_NS,
    FTW_SL,
    FTW_DP,
    FTW_SLN
};

enum {
    FTW_PHYS = 1,
    FTW_MOUNT = 2,
    FTW_CHDIR = 4,
    FTW_DEPTH = 8
};

struct FTW {
    int base;
    int level;
};

typedef int (*__ftw_func_t) (const char *__filename,
			     const struct stat * __status, int __flag);
typedef int (*__ftw64_func_t) (const char *__filename,
			       const struct stat64 * __status, int __flag);
typedef int (*__nftw_func_t) (const char *__filename,
			      const struct stat * __status, int __flag,
			      struct FTW * __info);
typedef int (*__nftw64_func_t) (const char *__filename,
				const struct stat64 * __status, int __flag,
				struct FTW * __info);
extern int ftw(const char *__dir, __ftw_func_t __func, int __descriptors);
extern int ftw64(const char *__dir, __ftw64_func_t __func,
		 int __descriptors);
extern int nftw(const char *__dir, __nftw_func_t __func, int __descriptors,
		int __flag);
extern int nftw64(const char *__dir, __nftw64_func_t __func,
		  int __descriptors, int __flag);

12.4.15. getopt.h


#define no_argument	0
#define required_argument	1
#define optional_argument	2

struct option {
    const char *name;
    int has_arg;
    int *flag;
    int val;
};
extern int getopt_long(int ___argc, char *const ___argv[],
		       const char *__shortopts,
		       const struct option *__longopts, int *__longind);
extern int getopt_long_only(int ___argc, char *const ___argv[],
			    const char *__shortopts,
			    const struct option *__longopts,
			    int *__longind);

12.4.16. glob.h


#define GLOB_ERR	(1<<0)
#define GLOB_MARK	(1<<1)
#define GLOB_BRACE	(1<<10)
#define GLOB_NOMAGIC	(1<<11)
#define GLOB_TILDE	(1<<12)
#define GLOB_ONLYDIR	(1<<13)
#define GLOB_TILDE_CHECK	(1<<14)
#define GLOB_NOSORT	(1<<2)
#define GLOB_DOOFFS	(1<<3)
#define GLOB_NOCHECK	(1<<4)
#define GLOB_APPEND	(1<<5)
#define GLOB_NOESCAPE	(1<<6)
#define GLOB_PERIOD	(1<<7)
#define GLOB_MAGCHAR	(1<<8)
#define GLOB_ALTDIRFUNC	(1<<9)

#define GLOB_NOSPACE	1
#define GLOB_ABORTED	2
#define GLOB_NOMATCH	3
#define GLOB_NOSYS	4

typedef struct {
    size_t gl_pathc;
    char **gl_pathv;
    size_t gl_offs;
    int gl_flags;
    void (*gl_closedir) (void *);
    struct dirent *(*gl_readdir) (void *);
    void *(*gl_opendir) (const char *);
    int (*gl_lstat) (const char *, struct stat *);
    int (*gl_stat) (const char *, struct stat *);
} glob_t;

typedef struct {
    size_t gl_pathc;
    char **gl_pathv;
    size_t gl_offs;
    int gl_flags;
    void (*gl_closedir) (void *);
    struct dirent64 *(*gl_readdir) (void *);
    void *(*gl_opendir) (const char *);
    int (*gl_lstat) (const char *, struct stat *);
    int (*gl_stat) (const char *, struct stat *);
} glob64_t;
extern int glob(const char *__pattern, int __flags,
		int (*__errfunc) (const char *, int), glob_t * __pglob);
extern int glob64(const char *__pattern, int __flags,
		  int (*__errfunc) (const char *, int),
		  glob64_t * __pglob);
extern void globfree(glob_t * __pglob);
extern void globfree64(glob64_t * __pglob);

12.4.17. gnu/libc-version.h


extern const char *gnu_get_libc_release(void);
extern const char *gnu_get_libc_version(void);

12.4.18. grp.h


struct group {
    char *gr_name;
    char *gr_passwd;
    gid_t gr_gid;
    char **gr_mem;
};

extern void endgrent(void);
extern struct group *getgrent(void);
extern int getgrent_r(struct group *__resultbuf, char *__buffer,
		      size_t __buflen, struct group **__result);
extern struct group *getgrgid(gid_t __gid);
extern int getgrgid_r(gid_t __gid, struct group *__resultbuf,
		      char *__buffer, size_t __buflen,
		      struct group **__result);
extern struct group *getgrnam(const char *__name);
extern int getgrnam_r(const char *__name, struct group *__resultbuf,
		      char *__buffer, size_t __buflen,
		      struct group **__result);
extern int getgrouplist(const char *__user, gid_t __group,
			gid_t * __groups, int *__ngroups);
extern int initgroups(const char *__user, gid_t __group);
extern void setgrent(void);
extern int setgroups(size_t __n, const gid_t * __groups);

12.4.19. iconv.h


typedef void *iconv_t;
extern size_t iconv(iconv_t __cd, char **__inbuf, size_t * __inbytesleft,
		    char **__outbuf, size_t * __outbytesleft);
extern int iconv_close(iconv_t __cd);
extern iconv_t iconv_open(const char *__tocode, const char *__fromcode);

12.4.20. inttypes.h


typedef lldiv_t imaxdiv_t;

#define __PDP_ENDIAN	3412
#define PDP_ENDIAN	__PDP_ENDIAN

extern intmax_t imaxabs(intmax_t __n);
extern imaxdiv_t imaxdiv(intmax_t __numer, intmax_t __denom);
extern intmax_t strtoimax(const char *__nptr, char **__endptr, int __base);
extern uintmax_t strtoumax(const char *__nptr, char **__endptr,
			   int __base);
extern intmax_t wcstoimax(const wchar_t * __nptr, wchar_t * *__endptr,
			  int __base);
extern uintmax_t wcstoumax(const wchar_t * __nptr, wchar_t * *__endptr,
			   int __base);

12.4.21. langinfo.h


#define ABDAY_1	0x20000		/* Sun. */
#define ABDAY_2	0x20001
#define ABDAY_3	0x20002
#define ABDAY_4	0x20003
#define ABDAY_5	0x20004
#define ABDAY_6	0x20005
#define ABDAY_7	0x20006

#define DAY_1	0x20007
#define DAY_2	0x20008
#define DAY_3	0x20009
#define DAY_4	0x2000A
#define DAY_5	0x2000B
#define DAY_6	0x2000C
#define DAY_7	0x2000D

#define ABMON_1	0x2000E
#define ABMON_2	0x2000F
#define ABMON_3	0x20010
#define ABMON_4	0x20011
#define ABMON_5	0x20012
#define ABMON_6	0x20013
#define ABMON_7	0x20014
#define ABMON_8	0x20015
#define ABMON_9	0x20016
#define ABMON_10	0x20017
#define ABMON_11	0x20018
#define ABMON_12	0x20019

#define MON_1	0x2001A
#define MON_2	0x2001B
#define MON_3	0x2001C
#define MON_4	0x2001D
#define MON_5	0x2001E
#define MON_6	0x2001F
#define MON_7	0x20020
#define MON_8	0x20021
#define MON_9	0x20022
#define MON_10	0x20023
#define MON_11	0x20024
#define MON_12	0x20025

#define AM_STR	0x20026
#define PM_STR	0x20027

#define D_T_FMT	0x20028
#define D_FMT	0x20029
#define T_FMT	0x2002A
#define T_FMT_AMPM	0x2002B

#define ERA	0x2002C
#define ERA_D_FMT	0x2002E
#define ALT_DIGITS	0x2002F
#define ERA_D_T_FMT	0x20030
#define ERA_T_FMT	0x20031

#define CODESET	14

#define CRNCYSTR	0x4000F

#define RADIXCHAR	0x10000
#define THOUSEP	0x10001
#define YESEXPR	0x50000
#define NOEXPR	0x50001
#define YESSTR	0x50002
#define NOSTR	0x50003

extern char *nl_langinfo(nl_item __item);

12.4.22. libgen.h


#define basename __xpg_basename

extern char *__xpg_basename(char *__path);
extern char *dirname(char *__path);

12.4.23. libintl.h


extern char *bind_textdomain_codeset(const char *__domainname,
				     const char *__codeset);
extern char *bindtextdomain(const char *__domainname,
			    const char *__dirname);
extern char *dcgettext(const char *__domainname, const char *__msgid,
		       int __category);
extern char *dcngettext(const char *__domainname, const char *__msgid1,
			const char *__msgid2, unsigned long int __n,
			int __category);
extern char *dgettext(const char *__domainname, const char *__msgid);
extern char *dngettext(const char *__domainname, const char *__msgid1,
		       const char *__msgid2, unsigned long int __n);
extern char *gettext(const char *__msgid);
extern char *ngettext(const char *__msgid1, const char *__msgid2,
		      unsigned long int __n);
extern char *textdomain(const char *__domainname);

12.4.24. limits.h


#define LLONG_MIN	(-LLONG_MAX-1LL)
#define _POSIX_AIO_MAX	1
#define _POSIX_QLIMIT	1
#define _POSIX2_BC_STRING_MAX	1000
#define _POSIX2_CHARCLASS_NAME_MAX	14
#define _POSIX_NAME_MAX	14
#define _POSIX_UIO_MAXIOV	16
#define ULLONG_MAX	18446744073709551615ULL
#define _POSIX2_COLL_WEIGHTS_MAX	2
#define _POSIX_AIO_LISTIO_MAX	2
#define _POSIX_OPEN_MAX	20
#define _POSIX_CLOCKRES_MIN	20000000
#define CHARCLASS_NAME_MAX	2048
#define LINE_MAX	2048
#define _POSIX2_BC_DIM_MAX	2048
#define _POSIX2_LINE_MAX	2048
#define _POSIX_CHILD_MAX	25
#define COLL_WEIGHTS_MAX	255
#define _POSIX2_RE_DUP_MAX	255
#define _POSIX_HOST_NAME_MAX	255
#define _POSIX_MAX_CANON	255
#define _POSIX_MAX_INPUT	255
#define _POSIX_RE_DUP_MAX	255
#define _POSIX_SYMLINK_MAX	255
#define _POSIX_PATH_MAX	256
#define _POSIX_SEM_NSEMS_MAX	256
#define NGROUPS_MAX	32
#define _POSIX2_EXPR_NEST_MAX	32
#define _POSIX_DELAYTIMER_MAX	32
#define _POSIX_MQ_PRIO_MAX	32
#define _POSIX_SIGQUEUE_MAX	32
#define _POSIX_TIMER_MAX	32
#define _POSIX_SEM_VALUE_MAX	32767
#define _POSIX_SSIZE_MAX	32767
#define PATH_MAX	4096
#define _POSIX_ARG_MAX	4096
#define _POSIX_PIPE_BUF	512
#define _POSIX_TZNAME_MAX	6
#define _POSIX_LINK_MAX	8
#define _POSIX_MQ_OPEN_MAX	8
#define _POSIX_NGROUPS_MAX	8
#define _POSIX_RTSIG_MAX	8
#define _POSIX_STREAM_MAX	8
#define _POSIX_SYMLOOP_MAX	8
#define _POSIX_LOGIN_NAME_MAX	9
#define _POSIX_TTY_NAME_MAX	9
#define LLONG_MAX	9223372036854775807LL
#define _POSIX2_BC_BASE_MAX	99
#define _POSIX2_BC_SCALE_MAX	99
#define SSIZE_MAX	LONG_MAX	/* Maximum value of an object of type ssize_t */
#define BC_BASE_MAX	_POSIX2_BC_BASE_MAX
#define BC_DIM_MAX	_POSIX2_BC_DIM_MAX
#define BC_SCALE_MAX	_POSIX2_BC_SCALE_MAX
#define BC_STRING_MAX	_POSIX2_BC_STRING_MAX
#define EXPR_NEST_MAX	_POSIX2_EXPR_NEST_MAX
#define _POSIX_FD_SETSIZE	_POSIX_OPEN_MAX
#define _POSIX_HIWAT	_POSIX_PIPE_BUF

#define MB_LEN_MAX	16

#define SCHAR_MIN	(-128)
#define SCHAR_MAX	127
#define UCHAR_MAX	255
#define CHAR_BIT	8

#define SHRT_MIN	(-32768)
#define SHRT_MAX	32767
#define USHRT_MAX	65535

#define INT_MIN	(-INT_MAX-1)
#define INT_MAX	2147483647
#define UINT_MAX	4294967295U

#define LONG_MIN	(-LONG_MAX-1L)

#define PTHREAD_KEYS_MAX	1024
#define PTHREAD_THREADS_MAX	16384
#define PTHREAD_DESTRUCTOR_ITERATIONS	4

12.4.25. link.h


extern int
dl_iterate_phdr(int (*callback) (struct dl_phdr_info *, size_t, void *),
		void *data);

12.4.26. locale.h


struct lconv {
    char *decimal_point;
    char *thousands_sep;
    char *grouping;
    char *int_curr_symbol;
    char *currency_symbol;
    char *mon_decimal_point;
    char *mon_thousands_sep;
    char *mon_grouping;
    char *positive_sign;
    char *negative_sign;
    char int_frac_digits;
    char frac_digits;
    char p_cs_precedes;
    char p_sep_by_space;
    char n_cs_precedes;
    char n_sep_by_space;
    char p_sign_posn;
    char n_sign_posn;
    char int_p_cs_precedes;
    char int_p_sep_by_space;
    char int_n_cs_precedes;
    char int_n_sep_by_space;
    char int_p_sign_posn;
    char int_n_sign_posn;
};

#define LC_GLOBAL_LOCALE	((locale_t) -1L)
#define LC_CTYPE	0
#define LC_NUMERIC	1
#define LC_TELEPHONE	10
#define LC_MEASUREMENT	11
#define LC_IDENTIFICATION	12
#define LC_TIME	2
#define LC_COLLATE	3
#define LC_MONETARY	4
#define LC_MESSAGES	5
#define LC_ALL	6
#define LC_PAPER	7
#define LC_NAME	8
#define LC_ADDRESS	9

struct __locale_struct {
    struct locale_data *__locales[13];
    const unsigned short *__ctype_b;
    const int *__ctype_tolower;
    const int *__ctype_toupper;
    const char *__names[13];
};
typedef struct __locale_struct *__locale_t;

typedef struct __locale_struct *locale_t;

#define LC_ADDRESS_MASK	(1 << LC_ADDRESS)
#define LC_COLLATE_MASK	(1 << LC_COLLATE)
#define LC_IDENTIFICATION_MASK	(1 << LC_IDENTIFICATION)
#define LC_MEASUREMENT_MASK	(1 << LC_MEASUREMENT)
#define LC_MESSAGES_MASK	(1 << LC_MESSAGES)
#define LC_MONETARY_MASK	(1 << LC_MONETARY)
#define LC_NAME_MASK	(1 << LC_NAME)
#define LC_NUMERIC_MASK	(1 << LC_NUMERIC)
#define LC_PAPER_MASK	(1 << LC_PAPER)
#define LC_TELEPHONE_MASK	(1 << LC_TELEPHONE)
#define LC_TIME_MASK	(1 << LC_TIME)
#define LC_CTYPE_MASK	(1<<LC_CTYPE)
#define LC_ALL_MASK	\
        (LC_CTYPE_MASK| LC_NUMERIC_MASK| LC_TIME_MASK| LC_COLLATE_MASK| LC_MONETARY_MASK|\
         LC_MESSAGES_MASK| LC_PAPER_MASK| LC_NAME_MASK| LC_ADDRESS_MASK| LC_TELEPHONE_MASK|\
         LC_MEASUREMENT_MASK| LC_IDENTIFICATION_MASK)

extern locale_t duplocale(locale_t __dataset);
extern void freelocale(locale_t __dataset);
extern struct lconv *localeconv(void);
extern locale_t newlocale(int __category_mask, const char *__locale,
			  locale_t __base);
extern char *setlocale(int __category, const char *__locale);
extern locale_t uselocale(locale_t __dataset);

12.4.27. monetary.h


extern ssize_t strfmon(char *__s, size_t __maxsize, const char *__format,
		       ...);

12.4.28. net/if.h


#define IF_NAMESIZE	16

#define IFF_UP	0x01		/* Interface is up. */
#define IFF_BROADCAST	0x02	/* Broadcast address valid. */
#define IFF_DEBUG	0x04	/* Turn on debugging. */
#define IFF_LOOPBACK	0x08	/* Is a loopback net. */
#define IFF_POINTOPOINT	0x10	/* Interface is point-to-point link. */
#define IFF_PROMISC	0x100	/* Receive all packets. */
#define IFF_MULTICAST	0x1000	/* Supports multicast. */
#define IFF_NOTRAILERS	0x20	/* Avoid use of trailers. */
#define IFF_RUNNING	0x40	/* Resources allocated. */
#define IFF_NOARP	0x80	/* No address resolution protocol. */

struct if_nameindex {
    unsigned int if_index;	/* 1, 2, ... */
    char *if_name;		/* null terminated name: */
};

struct ifaddr {
    struct sockaddr ifa_addr;	/* Address of interface. */
    union {
	struct sockaddr ifu_broadaddr;
	struct sockaddr ifu_dstaddr;
    } ifa_ifu;
    void *ifa_ifp;
    void *ifa_next;
};

#define ifr_name	ifr_ifrn.ifrn_name	/* interface name */
#define ifr_addr	ifr_ifru.ifru_addr	/* address */
#define ifr_broadaddr	ifr_ifru.ifru_broadaddr	/* broadcast address */
#define ifr_data	ifr_ifru.ifru_data	/* for use by interface */
#define ifr_dstaddr	ifr_ifru.ifru_dstaddr	/* other end of p-p lnk */
#define ifr_flags	ifr_ifru.ifru_flags	/* flags */
#define ifr_hwaddr	ifr_ifru.ifru_hwaddr	/* interface name */
#define ifr_bandwidth	ifr_ifru.ifru_ivalue	/* link bandwidth */
#define ifr_ifindex	ifr_ifru.ifru_ivalue	/* interface index */
#define ifr_metric	ifr_ifru.ifru_ivalue	/* metric */
#define ifr_qlen	ifr_ifru.ifru_ivalue	/* queue length */
#define ifr_mtu	ifr_ifru.ifru_mtu	/* mtu */
#define ifr_netmask	ifr_ifru.ifru_netmask	/* interface net mask */
#define ifr_slave	ifr_ifru.ifru_slave	/* slave device */
#define IFNAMSIZ	IF_NAMESIZE

struct ifreq {
    union {
	char ifrn_name[IFNAMSIZ];
    } ifr_ifrn;
    union {
	struct sockaddr ifru_addr;
	struct sockaddr ifru_dstaddr;
	struct sockaddr ifru_broadaddr;
	struct sockaddr ifru_netmask;
	struct sockaddr ifru_hwaddr;
	short ifru_flags;
	int ifru_ivalue;
	int ifru_mtu;
	char ifru_slave[IFNAMSIZ];
	char ifru_newname[IFNAMSIZ];
	caddr_t ifru_data;
	struct ifmap ifru_map;
    } ifr_ifru;
};

#define ifc_buf	ifc_ifcu.ifcu_buf	/* Buffer address. */
#define ifc_req	ifc_ifcu.ifcu_req	/* Array of structures. */

struct ifconf {
    int ifc_len;
    union {
	caddr_t ifcu_buf;
	struct ifreq *ifcu_req;
    } ifc_ifcu;
};
extern void if_freenameindex(struct if_nameindex *__ptr);
extern char *if_indextoname(unsigned int __ifindex, char *__ifname);
extern struct if_nameindex *if_nameindex(void);
extern unsigned int if_nametoindex(const char *__ifname);

12.4.29. netdb.h


#define h_errno	(*__h_errno_location ())
#define NETDB_INTERNAL	-1	/* See errno. */
#define NETDB_SUCCESS	0	/* No problem. */
#define HOST_NOT_FOUND	1	/* Authoritative Answer Host not found. */
#define IPPORT_RESERVED	1024
#define NI_MAXHOST	1025
#define TRY_AGAIN	2	/* Non-Authoritative Host not found, or SERVERFAIL. */
#define NO_RECOVERY	3	/* Non recoverable errors, FORMERR, REFUSED, NOTIMP. */
#define NI_MAXSERV	32
#define NO_DATA	4		/* Valid name, no data record of requested type. */
#define h_addr	h_addr_list[0]
#define NO_ADDRESS	NO_DATA	/* No address, look for MX record. */

struct servent {
    char *s_name;
    char **s_aliases;
    int s_port;
    char *s_proto;
};
struct hostent {
    char *h_name;
    char **h_aliases;
    int h_addrtype;
    int h_length;
    char **h_addr_list;
};
struct protoent {
    char *p_name;
    char **p_aliases;
    int p_proto;
};
struct netent {
    char *n_name;
    char **n_aliases;
    int n_addrtype;
    unsigned int n_net;
};

#define AI_PASSIVE	0x0001	/* Socket address is intended for `bind' */
#define AI_CANONNAME	0x0002	/* Request for canonical name */
#define AI_NUMERICHOST	0x0004	/* Don't use name resolution */
#define AI_V4MAPPED	0x0008	/* IPv4 mapped addresses are acceptable. */
#define AI_ALL	0x0010		/* Return IPv4 mapped and IPv6 addresses. */
#define AI_ADDRCONFIG	0x0020	/* Use configuration of this host to choose returned address type.. */
#define AI_NUMERICSERV	0x0400	/* Don't use name resolution */

struct addrinfo {
    int ai_flags;
    int ai_family;
    int ai_socktype;
    int ai_protocol;
    socklen_t ai_addrlen;
    struct sockaddr *ai_addr;
    char *ai_canonname;
    struct addrinfo *ai_next;
};

#define NI_NUMERICHOST	1
#define NI_DGRAM	16
#define NI_NUMERICSERV	2
#define NI_NOFQDN	4
#define NI_NAMEREQD	8

#define EAI_BADFLAGS	-1	/* Invalid value for `ai_flags' field. */
#define EAI_MEMORY	-10	/* Memory allocation failure. */
#define EAI_SYSTEM	-11	/* System error returned in `errno'. */
#define EAI_NONAME	-2	/* NAME or SERVICE is unknown. */
#define EAI_AGAIN	-3	/* Temporary failure in name resolution. */
#define EAI_FAIL	-4	/* Non-recoverable failure in name res. */
#define EAI_NODATA	-5	/* No address associated with NAME. */
#define EAI_FAMILY	-6	/* `ai_family' not supported. */
#define EAI_SOCKTYPE	-7	/* `ai_family' not supported. */
#define EAI_SERVICE	-8	/* SERVICE not supported for `ai_socktype'. */
#define EAI_ADDRFAMILY	-9	/* Address family for NAME not supported. */

extern int *__h_errno_location(void);
extern void endprotoent(void);
extern void endservent(void);
extern void freeaddrinfo(struct addrinfo *__ai);
extern const char *gai_strerror(int __ecode);
extern int getaddrinfo(const char *__name, const char *__service,
		       const struct addrinfo *__req,
		       struct addrinfo **__pai);
extern struct hostent *gethostbyaddr(const void *__addr, socklen_t __len,
				     int __type);
extern int gethostbyaddr_r(const void *__addr, socklen_t __len, int __type,
			   struct hostent *__result_buf, char *__buf,
			   size_t __buflen, struct hostent **__result,
			   int *__h_errnop);
extern struct hostent *gethostbyname(const char *__name);
extern struct hostent *gethostbyname2(const char *__name, int __af);
extern int gethostbyname2_r(const char *__name, int __af,
			    struct hostent *__result_buf, char *__buf,
			    size_t __buflen, struct hostent **__result,
			    int *__h_errnop);
extern int gethostbyname_r(const char *__name,
			   struct hostent *__result_buf, char *__buf,
			   size_t __buflen, struct hostent **__result,
			   int *__h_errnop);
extern struct protoent *getprotobyname(const char *__name);
extern int getprotobyname_r(const char *__name,
			    struct protoent *__result_buf, char *__buf,
			    size_t __buflen, struct protoent **__result);
extern struct protoent *getprotobynumber(int __proto);
extern int getprotobynumber_r(int __proto, struct protoent *__result_buf,
			      char *__buf, size_t __buflen,
			      struct protoent **__result);
extern struct protoent *getprotoent(void);
extern int getprotoent_r(struct protoent *__result_buf, char *__buf,
			 size_t __buflen, struct protoent **__result);
extern struct servent *getservbyname(const char *__name,
				     const char *__proto);
extern int getservbyname_r(const char *__name, const char *__proto,
			   struct servent *__result_buf, char *__buf,
			   size_t __buflen, struct servent **__result);
extern struct servent *getservbyport(int __port, const char *__proto);
extern int getservbyport_r(int __port, const char *__proto,
			   struct servent *__result_buf, char *__buf,
			   size_t __buflen, struct servent **__result);
extern struct servent *getservent(void);
extern int getservent_r(struct servent *__result_buf, char *__buf,
			size_t __buflen, struct servent **__result);
extern void setprotoent(int __stay_open);
extern void setservent(int __stay_open);

12.4.30. netinet/icmp6.h


#define ICMP6_FILTER_WILLBLOCK(type,filterp)	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0)
#define ICMP6_FILTER_WILLPASS(type,filterp)	((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0)
#define ICMP6_FILTER_SETPASS(type,filterp)	((((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))))
#define ICMP6_FILTER_SETBLOCK(type,filterp)	((((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31))))
#define ICMP6_DST_UNREACH_NOROUTE	0
#define ICMP6_PARAMPROB_HEADER	0
#define ICMP6_TIME_EXCEED_TRANSIT	0
#define ICMP6_RR_FLAGS_PREVDONE	0x08
#define ICMP6_RR_FLAGS_SPECSITE	0x10
#define ICMP6_RR_PCOUSE_RAFLAGS_AUTO	0x10
#define ICMP6_RR_FLAGS_FORCEAPPLY	0x20
#define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK	0x20
#define ND_OPT_PI_FLAG_RADDR	0x20
#define ND_RA_FLAG_HOME_AGENT	0x20
#define ICMP6_RR_FLAGS_REQRESULT	0x40
#define ND_OPT_PI_FLAG_AUTO	0x40
#define ND_RA_FLAG_OTHER	0x40
#define ICMP6_INFOMSG_MASK	0x80
#define ICMP6_RR_FLAGS_TEST	0x80
#define ND_OPT_PI_FLAG_ONLINK	0x80
#define ND_RA_FLAG_MANAGED	0x80
#define ICMP6_DST_UNREACH	1
#define ICMP6_DST_UNREACH_ADMIN	1
#define ICMP6_FILTER	1
#define ICMP6_FILTER_BLOCK	1
#define ICMP6_PARAMPROB_NEXTHEADER	1
#define ICMP6_TIME_EXCEED_REASSEMBLY	1
#define ND_OPT_SOURCE_LINKADDR	1
#define RPM_PCO_ADD	1
#define ICMP6_ECHO_REQUEST	128
#define ICMP6_ECHO_REPLY	129
#define MLD_LISTENER_QUERY	130
#define MLD_LISTENER_REPORT	131
#define MLD_LISTENER_REDUCTION	132
#define ND_ROUTER_SOLICIT	133
#define ND_ROUTER_ADVERT	134
#define ND_NEIGHBOR_SOLICIT	135
#define ND_NEIGHBOR_ADVERT	136
#define ND_REDIRECT	137
#define ICMP6_ROUTER_RENUMBERING	138
#define ICMP6_DST_UNREACH_BEYONDSCOPE	2
#define ICMP6_FILTER_PASS	2
#define ICMP6_PACKET_TOO_BIG	2
#define ICMP6_PARAMPROB_OPTION	2
#define ND_OPT_TARGET_LINKADDR	2
#define RPM_PCO_CHANGE	2
#define ICMP6_DST_UNREACH_ADDR	3
#define ICMP6_FILTER_BLOCKOTHERS	3
#define ICMP6_TIME_EXCEEDED	3
#define ND_OPT_PREFIX_INFORMATION	3
#define RPM_PCO_SETGLOBAL	3
#define ICMP6_DST_UNREACH_NOPORT	4
#define ICMP6_FILTER_PASSONLY	4
#define ICMP6_PARAM_PROB	4
#define ND_OPT_REDIRECTED_HEADER	4
#define ND_OPT_MTU	5
#define ND_OPT_RTR_ADV_INTERVAL	7
#define ND_OPT_HOME_AGENT_INFO	8
#define icmp6_id	icmp6_data16[0]
#define icmp6_maxdelay	icmp6_data16[0]
#define icmp6_seq	icmp6_data16[1]
#define icmp6_mtu	icmp6_data32[0]
#define icmp6_pptr	icmp6_data32[0]
#define icmp6_data16	icmp6_dataun.icmp6_un_data16
#define icmp6_data32	icmp6_dataun.icmp6_un_data32
#define icmp6_data8	icmp6_dataun.icmp6_un_data8
#define ICMP6_FILTER_SETPASSALL(filterp)	memset (filterp, 0, sizeof (struct icmp6_filter));
#define ICMP6_FILTER_SETBLOCKALL(filterp)	memset (filterp, 0xFF, sizeof (struct icmp6_filter));
#define mld_cksum	mld_icmp6_hdr.icmp6_cksum
#define mld_code	mld_icmp6_hdr.icmp6_code
#define mld_maxdelay	mld_icmp6_hdr.icmp6_data16[0]
#define mld_reserved	mld_icmp6_hdr.icmp6_data16[1]
#define mld_type	mld_icmp6_hdr.icmp6_type
#define nd_na_cksum	nd_na_hdr.icmp6_cksum
#define nd_na_code	nd_na_hdr.icmp6_code
#define nd_na_flags_reserved	nd_na_hdr.icmp6_data32[0]
#define nd_na_type	nd_na_hdr.icmp6_type
#define nd_ns_cksum	nd_ns_hdr.icmp6_cksum
#define nd_ns_code	nd_ns_hdr.icmp6_code
#define nd_ns_reserved	nd_ns_hdr.icmp6_data32[0]
#define nd_ns_type	nd_ns_hdr.icmp6_type
#define nd_ra_cksum	nd_ra_hdr.icmp6_cksum
#define nd_ra_code	nd_ra_hdr.icmp6_code
#define nd_ra_router_lifetime	nd_ra_hdr.icmp6_data16[1]
#define nd_ra_curhoplimit	nd_ra_hdr.icmp6_data8[0]
#define nd_ra_flags_reserved	nd_ra_hdr.icmp6_data8[1]
#define nd_ra_type	nd_ra_hdr.icmp6_type
#define nd_rd_cksum	nd_rd_hdr.icmp6_cksum
#define nd_rd_code	nd_rd_hdr.icmp6_code
#define nd_rd_reserved	nd_rd_hdr.icmp6_data32[0]
#define nd_rd_type	nd_rd_hdr.icmp6_type
#define nd_rs_cksum	nd_rs_hdr.icmp6_cksum
#define nd_rs_code	nd_rs_hdr.icmp6_code
#define nd_rs_reserved	nd_rs_hdr.icmp6_data32[0]
#define nd_rs_type	nd_rs_hdr.icmp6_type
#define rr_cksum	rr_hdr.icmp6_cksum
#define rr_code	rr_hdr.icmp6_code
#define rr_seqnum	rr_hdr.icmp6_data32[0]
#define rr_type	rr_hdr.icmp6_type

struct icmp6_filter {
    uint32_t icmp6_filt[8];
};
struct icmp6_hdr {
    uint8_t icmp6_type;
    uint8_t icmp6_code;
    uint16_t icmp6_cksum;
    union {
	uint32_t icmp6_un_data32[1];
	uint16_t icmp6_un_data16[2];
	uint8_t icmp6_un_data8[4];
    } icmp6_dataun;
};
struct nd_router_solicit {
    struct icmp6_hdr nd_rs_hdr;
};
struct nd_router_advert {
    struct icmp6_hdr nd_ra_hdr;
    uint32_t nd_ra_reachable;
    uint32_t nd_ra_retransmit;
};
struct nd_neighbor_solicit {
    struct icmp6_hdr nd_ns_hdr;
    struct in6_addr nd_ns_target;
};
struct nd_neighbor_advert {
    struct icmp6_hdr nd_na_hdr;
    struct in6_addr nd_na_target;
};
struct nd_redirect {
    struct icmp6_hdr nd_rd_hdr;
    struct in6_addr nd_rd_target;
    struct in6_addr nd_rd_dst;
};
struct nd_opt_hdr {
    uint8_t nd_opt_type;
    uint8_t nd_opt_len;
};
struct nd_opt_prefix_info {
    uint8_t nd_opt_pi_type;
    uint8_t nd_opt_pi_len;
    uint8_t nd_opt_pi_prefix_len;
    uint8_t nd_opt_pi_flags_reserved;
    uint32_t nd_opt_pi_valid_time;
    uint32_t nd_opt_pi_preferred_time;
    uint32_t nd_opt_pi_reserved2;
    struct in6_addr nd_opt_pi_prefix;
};
struct nd_opt_rd_hdr {
    uint8_t nd_opt_rh_type;
    uint8_t nd_opt_rh_len;
    uint16_t nd_opt_rh_reserved1;
    uint32_t nd_opt_rh_reserved2;
};
struct nd_opt_mtu {
    uint8_t nd_opt_mtu_type;
    uint8_t nd_opt_mtu_len;
    uint16_t nd_opt_mtu_reserved;
    uint32_t nd_opt_mtu_mtu;
};
struct mld_hdr {
    struct icmp6_hdr mld_icmp6_hdr;
    struct in6_addr mld_addr;
};
struct icmp6_router_renum {
    struct icmp6_hdr rr_hdr;
    uint8_t rr_segnum;
    uint8_t rr_flags;
    uint16_t rr_maxdelay;
    uint32_t rr_reserved;
};
struct rr_pco_match {
    uint8_t rpm_code;
    uint8_t rpm_len;
    uint8_t rpm_ordinal;
    uint8_t rpm_matchlen;
    uint8_t rpm_minlen;
    uint8_t rpm_maxlen;
    uint16_t rpm_reserved;
    struct in6_addr rpm_prefix;
};
struct rr_pco_use {
    uint8_t rpu_uselen;
    uint8_t rpu_keeplen;
    uint8_t rpu_ramask;
    uint8_t rpu_raflags;
    uint32_t rpu_vltime;
    uint32_t rpu_pltime;
    uint32_t rpu_flags;
    struct in6_addr rpu_prefix;
};
struct rr_result {
    uint16_t rrr_flags;
    uint8_t rrr_ordinal;
    uint8_t rrr_matchedlen;
    uint32_t rrr_ifid;
    struct in6_addr rrr_prefix;
};
struct nd_opt_adv_interval {
    uint8_t nd_opt_adv_interval_type;
    uint8_t nd_opt_adv_interval_len;
    uint16_t nd_opt_adv_interval_reserved;
    uint32_t nd_opt_adv_interval_ival;
};
struct nd_opt_home_agent_info {
    uint8_t nd_opt_home_agent_info_type;
    uint8_t nd_opt_home_agent_info_len;
    uint16_t nd_opt_home_agent_info_reserved;
    int16_t nd_opt_home_agent_info_preference;
    uint16_t nd_opt_home_agent_info_lifetime;
};

12.4.31. netinet/igmp.h


#define IGMP_MEMBERSHIP_QUERY	0x11
#define IGMP_V1_MEMBERSHIP_REPORT	0x12
#define IGMP_DVMRP	0x13
#define IGMP_PIM	0x14
#define IGMP_TRACE	0x15
#define IGMP_V2_MEMBERSHIP_REPORT	0x16
#define IGMP_V2_LEAVE_GROUP	0x17
#define IGMP_MTRACE_RESP	0x1e
#define IGMP_MTRACE	0x1f
#define IGMP_DELAYING_MEMBER	1
#define IGMP_v1_ROUTER	1
#define IGMP_MAX_HOST_REPORT_DELAY	10
#define IGMP_TIMER_SCALE	10
#define IGMP_IDLE_MEMBER	2
#define IGMP_v2_ROUTER	2
#define IGMP_LAZY_MEMBER	3
#define IGMP_SLEEPING_MEMBER	4
#define IGMP_AWAKENING_MEMBER	5
#define IGMP_MINLEN	8
#define IGMP_HOST_MEMBERSHIP_QUERY	IGMP_MEMBERSHIP_QUERY
#define IGMP_HOST_MEMBERSHIP_REPORT	IGMP_V1_MEMBERSHIP_REPORT
#define IGMP_HOST_LEAVE_MESSAGE	IGMP_V2_LEAVE_GROUP
#define IGMP_HOST_NEW_MEMBERSHIP_REPORT	IGMP_V2_MEMBERSHIP_REPORT

struct igmp {
    u_int8_t igmp_type;
    u_int8_t igmp_code;
    u_int16_t igmp_cksum;
    struct in_addr igmp_group;
};

12.4.32. netinet/in.h


#define IPPROTO_IP	0
#define IPPROTO_ICMP	1
#define IPPROTO_UDP	17
#define IPPROTO_IGMP	2
#define IPPROTO_RAW	255
#define IPPROTO_IPV6	41
#define IPPROTO_ICMPV6	58
#define IPPROTO_TCP	6

typedef uint16_t in_port_t;

struct in_addr {
    uint32_t s_addr;
};
typedef uint32_t in_addr_t;

#define INADDR_NONE	((in_addr_t) 0xffffffff)
#define INADDR_BROADCAST	(0xffffffff)
#define INADDR_ANY	0
#define INADDR_LOOPBACK	0x7f000001	/* 127.0.0.1 */

#define s6_addr16	in6_u.u6_addr16
#define s6_addr32	in6_u.u6_addr32
#define s6_addr	in6_u.u6_addr8

struct in6_addr {
    union {
	uint8_t u6_addr8[16];
	uint16_t u6_addr16[8];
	uint32_t u6_addr32[4];
    } in6_u;
};

#define IN6ADDR_ANY_INIT	{ { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
#define IN6ADDR_LOOPBACK_INIT	{ { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } } }

#define IN_MULTICAST(a)	((((in_addr_t)(a))&0xf0000000)==0xe0000000)
#define INET_ADDRSTRLEN	16

struct sockaddr_in {
    sa_family_t sin_family;
    unsigned short sin_port;
    struct in_addr sin_addr;
    unsigned char sin_zero[8];
};

#define IN6_IS_ADDR_LINKLOCAL(a)	((((const uint32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfe800000))
#define IN6_IS_ADDR_SITELOCAL(a)	((((const uint32_t *) (a))[0] & htonl (0xffc00000)) == htonl (0xfec00000))
#define IN6_ARE_ADDR_EQUAL(a,b)	((((const uint32_t *) (a))[0] == ((const uint32_t *) (b))[0]) && (((const uint32_t *) (a))[1] == ((const uint32_t *) (b))[1]) && (((const uint32_t *) (a))[2] == ((const uint32_t *) (b))[2]) && (((const uint32_t *) (a))[3] == ((const uint32_t *) (b))[3]))
#define IN6_IS_ADDR_V4COMPAT(a)	((((const uint32_t *) (a))[0] == 0) && (((const uint32_t *) (a))[1] == 0) && (((const uint32_t *) (a))[2] == 0) && (ntohl (((const uint32_t *) (a))[3]) > 1))
#define IN6_IS_ADDR_V4MAPPED(a)	((((const uint32_t *) (a))[0] == 0) && (((const uint32_t *) (a))[1] == 0) && (((const uint32_t *) (a))[2] == htonl (0xffff)))
#define IN6_IS_ADDR_UNSPECIFIED(a)	(((const uint32_t *) (a))[0] == 0 && ((const uint32_t *) (a))[1] == 0 && ((const uint32_t *) (a))[2] == 0 && ((const uint32_t *) (a))[3] == 0)
#define IN6_IS_ADDR_LOOPBACK(a)	(((const uint32_t *) (a))[0] == 0 && ((const uint32_t *) (a))[1] == 0 && ((const uint32_t *) (a))[2] == 0 && ((const uint32_t *) (a))[3] == htonl (1))
#define IN6_IS_ADDR_MULTICAST(a)	(((const uint8_t *) (a))[0] == 0xff)
#define IN6_IS_ADDR_MC_NODELOCAL(a)	(IN6_IS_ADDR_MULTICAST(a) && ((((const uint8_t *) (a))[1] & 0xf) == 0x1))
#define IN6_IS_ADDR_MC_LINKLOCAL(a)	(IN6_IS_ADDR_MULTICAST(a) && ((((const uint8_t *) (a))[1] & 0xf) == 0x2))
#define IN6_IS_ADDR_MC_SITELOCAL(a)	(IN6_IS_ADDR_MULTICAST(a) && ((((const uint8_t *) (a))[1] & 0xf) == 0x5))
#define IN6_IS_ADDR_MC_ORGLOCAL(a)	(IN6_IS_ADDR_MULTICAST(a) && ((((const uint8_t *) (a))[1] & 0xf) == 0x8))
#define IN6_IS_ADDR_MC_GLOBAL(a)	(IN6_IS_ADDR_MULTICAST(a) && ((((const uint8_t *) (a))[1] & 0xf) == 0xe))
#define INET6_ADDRSTRLEN	46

struct sockaddr_in6 {
    unsigned short sin6_family;	/* AF_INET6 */
    uint16_t sin6_port;		/* Transport layer port # */
    uint32_t sin6_flowinfo;	/* IPv6 flow information */
    struct in6_addr sin6_addr;	/* IPv6 address */
    uint32_t sin6_scope_id;	/* scope id (new in RFC2553) */
};

#define SOL_IP	0
#define IP_TOS	1		/* IP type of service and precedence */
#define IPV6_UNICAST_HOPS	16
#define IPV6_MULTICAST_IF	17
#define IPV6_MULTICAST_HOPS	18
#define IPV6_MULTICAST_LOOP	19
#define IP_TTL	2		/* IP time to live */
#define IPV6_JOIN_GROUP	20
#define IPV6_LEAVE_GROUP	21
#define IPV6_V6ONLY	26
#define IP_MULTICAST_IF	32	/* set/get IP multicast i/f */
#define IP_MULTICAST_TTL	33	/* set/get IP multicast ttl */
#define IP_MULTICAST_LOOP	34	/* set/get IP multicast loopback */
#define IP_ADD_MEMBERSHIP	35	/* add an IP group membership */
#define IP_DROP_MEMBERSHIP	36	/* drop an IP group membership */
#define IP_OPTIONS	4	/* IP per-packet options */
#define IPV6_ADD_MEMBERSHIP	IPV6_JOIN_GROUP
#define IPV6_DROP_MEMBERSHIP	IPV6_LEAVE_GROUP

struct ipv6_mreq {
    struct in6_addr ipv6mr_multiaddr;	/* IPv6 multicast address of group */
    int ipv6mr_interface;	/* local IPv6 address of interface */
};
struct ip_mreq {
    struct in_addr imr_multiaddr;	/* IP multicast address of group */
    struct in_addr imr_interface;	/* local IP address of interface */
};
extern int bindresvport(int, struct sockaddr_in *);
extern const struct in6_addr in6addr_any;
extern const struct in6_addr in6addr_loopback;

12.4.33. netinet/in_systm.h


typedef u_int16_t n_short;
typedef u_int32_t n_long;
typedef u_int32_t n_time;

12.4.34. netinet/ip.h


#define IPOPT_CLASS(o)	((o) & IPOPT_CLASS_MASK)
#define IPOPT_COPIED(o)	((o) & IPOPT_COPY)
#define IPOPT_NUMBER(o)	((o) & IPOPT_NUMBER_MASK)
#define IPOPT_EOL	0
#define IPOPT_OPTVAL	0
#define IPOPT_TS_TSONLY	0
#define IPOPT_CONTROL	0x00
#define IPOPT_SECUR_UNCLASS	0x0000
#define IPOPT_NUMBER_MASK	0x1f
#define IP_OFFMASK	0x1fff
#define IPOPT_RESERVED1	0x20
#define IP_MF	0x2000
#define IPOPT_DEBMEAS	0x40
#define IP_DF	0x4000
#define IPOPT_CLASS_MASK	0x60
#define IPOPT_RESERVED2	0x60
#define IPOPT_SECUR_TOPSECRET	0x6bc5
#define IPOPT_SECUR_EFTO	0x789a
#define IPOPT_COPY	0x80
#define IP_RF	0x8000
#define IPOPT_SECUR_RESTR	0xaf13
#define IPOPT_SECUR_MMMM	0xbc4d
#define IPOPT_SECUR_SECRET	0xd788
#define IPOPT_SECUR_CONFID	0xf135
#define IPOPT_NOP	1
#define IPOPT_OLEN	1
#define IPOPT_TS_TSANDADDR	1
#define IPTTLDEC	1
#define IPOPT_SECURITY	130
#define IPOPT_LSRR	131
#define IPOPT_SATID	136
#define IPOPT_SSRR	137
#define IPOPT_RA	148
#define IPOPT_OFFSET	2
#define MAXTTL	255
#define IPOPT_TS_PRESPEC	3
#define IPOPT_MINOFF	4
#define IPVERSION	4
#define MAX_IPOPTLEN	40
#define IP_MSS	576
#define IPFRAGTTL	60
#define IPDEFTTL	64
#define IP_MAXPACKET	65535
#define IPOPT_TS	68
#define IPOPT_RR	7
#define IPOPT_MEASUREMENT	IPOPT_DEBMEAS
#define IPOPT_END	IPOPT_EOL
#define IPOPT_NOOP	IPOPT_NOP
#define IPOPT_SID	IPOPT_SATID
#define IPOPT_SEC	IPOPT_SECURITY
#define IPOPT_TIMESTAMP	IPOPT_TS

#define IPTOS_TOS(tos)	((tos) & IPTOS_TOS_MASK)
#define IPTOS_LOWCOST	0x02
#define IPTOS_RELIABILITY	0x04
#define IPTOS_THROUGHPUT	0x08
#define IPTOS_LOWDELAY	0x10
#define IPTOS_TOS_MASK	0x1e
#define IPTOS_MINCOST	IPTOS_LOWCOST

#define IPTOS_PREC(tos)	((tos) & IPTOS_PREC_MASK)
#define IPTOS_PREC_MASK	0xe0

12.4.35. netinet/ip6.h


#define IP6OPT_TYPE(o)	((o) & 0xc0)
#define IP6OPT_PAD1	0
#define IP6OPT_TYPE_SKIP	0x00
#define IP6OPT_TUNNEL_LIMIT	0x04
#define IP6OPT_ROUTER_ALERT	0x05
#define IP6OPT_TYPE_MUTABLE	0x20
#define IP6OPT_TYPE_DISCARD	0x40
#define IP6OPT_TYPE_FORCEICMP	0x80
#define IP6OPT_TYPE_ICMP	0xc0
#define IP6OPT_JUMBO	0xc2
#define IP6OPT_NSAP_ADDR	0xc3
#define IP6OPT_PADN	1
#define IP6OPT_JUMBO_LEN	6
#define ip6_flow	ip6_ctlun.ip6_un1.ip6_un1_flow
#define ip6_hlim	ip6_ctlun.ip6_un1.ip6_un1_hlim
#define ip6_hops	ip6_ctlun.ip6_un1.ip6_un1_hlim
#define ip6_nxt	ip6_ctlun.ip6_un1.ip6_un1_nxt
#define ip6_plen	ip6_ctlun.ip6_un1.ip6_un1_plen
#define ip6_vfc	ip6_ctlun.ip6_un2_vfc

struct ip6_hdrctl {
    uint32_t ip6_un1_flow;
    uint16_t ip6_un1_plen;
    uint8_t ip6_un1_nxt;
    uint8_t ip6_un1_hlim;
};
struct ip6_hdr {
    struct in6_addr ip6_src;
    struct in6_addr ip6_dst;
};
struct ip6_ext {
    uint8_t ip6e_nxt;
    uint8_t ip6e_len;
};
struct ip6_hbh {
    uint8_t ip6h_nxt;
    uint8_t ip6h_len;
};
struct ip6_dest {
    uint8_t ip6d_nxt;
    uint8_t ip6d_len;
};
struct ip6_rthdr {
    uint8_t ip6r_nxt;
    uint8_t ip6r_len;
    uint8_t ip6r_type;
    uint8_t ip6r_segleft;
};
struct ip6_frag {
    uint8_t ip6f_nxt;
    uint8_t ip6f_reserved;
    uint16_t ip6f_offlg;
    uint32_t ip6f_ident;
};
struct ip6_opt {
    uint8_t ip6o_type;
    uint8_t ip6o_len;
};
struct ip6_opt_jumbo {
    uint8_t ip6oj_type;
    uint8_t ip6oj_len;
    uint8_t ip6oj_jumbo_len[4];
};
struct ip6_opt_nsap {
    uint8_t ip6on_type;
    uint8_t ip6on_len;
    uint8_t ip6on_src_nsap_len;
    uint8_t ip6on_dst_nsap_len;
};
struct ip6_opt_tunnel {
    uint8_t ip6ot_type;
    uint8_t ip6ot_len;
    uint8_t ip6ot_encap_limit;
};
struct ip6_opt_router {
    uint8_t ip6or_type;
    uint8_t ip6or_len;
    uint8_t ip6or_value[2];
};

12.4.36. netinet/ip_icmp.h


#define ICMP_INFOTYPE(type)	((type) == ICMP_ECHOREPLY || (type) == ICMP_ECHO || (type) == ICMP_ROUTERADVERT || (type) == ICMP_ROUTERSOLICIT || (type) == ICMP_TSTAMP || (type) == ICMP_TSTAMPREPLY || (type) == ICMP_IREQ || (type) == ICMP_IREQREPLY || (type) == ICMP_MASKREQ || (type) == ICMP_MASKREPLY)
#define ICMP_ADVLEN(p)	(8 + ((p)->icmp_ip.ip_hl << 2) + 8)
#define ICMP_TSLEN	(8 + 3 * sizeof (n_time))
#define ICMP_ADVLENMIN	(8 + sizeof (struct ip) + 8)
#define ICMP_ECHOREPLY	0
#define ICMP_EXC_TTL	0
#define ICMP_NET_UNREACH	0
#define ICMP_REDIRECT_NET	0
#define ICMP_REDIR_NET	0
#define ICMP_TIMXCEED_INTRANS	0
#define ICMP_UNREACH_NET	0
#define ICMP_EXC_FRAGTIME	1
#define ICMP_HOST_UNREACH	1
#define ICMP_PARAMPROB_OPTABSENT	1
#define ICMP_REDIRECT_HOST	1
#define ICMP_REDIR_HOST	1
#define ICMP_TIMXCEED_REASS	1
#define ICMP_UNREACH_HOST	1
#define ICMP_HOST_ANO	10
#define ICMP_ROUTERSOLICIT	10
#define ICMP_UNREACH_HOST_PROHIB	10
#define ICMP_NET_UNR_TOS	11
#define ICMP_TIME_EXCEEDED	11
#define ICMP_TIMXCEED	11
#define ICMP_UNREACH_TOSNET	11
#define ICMP_HOST_UNR_TOS	12
#define ICMP_MASKLEN	12
#define ICMP_PARAMETERPROB	12
#define ICMP_PARAMPROB	12
#define ICMP_UNREACH_TOSHOST	12
#define ICMP_PKT_FILTERED	13
#define ICMP_TIMESTAMP	13
#define ICMP_TSTAMP	13
#define ICMP_UNREACH_FILTER_PROHIB	13
#define ICMP_PREC_VIOLATION	14
#define ICMP_TIMESTAMPREPLY	14
#define ICMP_TSTAMPREPLY	14
#define ICMP_UNREACH_HOST_PRECEDENCE	14
#define ICMP_INFO_REQUEST	15
#define ICMP_IREQ	15
#define ICMP_PREC_CUTOFF	15
#define ICMP_UNREACH_PRECEDENCE_CUTOFF	15
#define NR_ICMP_UNREACH	15
#define ICMP_INFO_REPLY	16
#define ICMP_IREQREPLY	16
#define ICMP_ADDRESS	17
#define ICMP_MASKREQ	17
#define ICMP_ADDRESSREPLY	18
#define ICMP_MASKREPLY	18
#define ICMP_MAXTYPE	18
#define NR_ICMP_TYPES	18
#define ICMP_PROT_UNREACH	2
#define ICMP_REDIRECT_TOSNET	2
#define ICMP_REDIR_NETTOS	2
#define ICMP_UNREACH_PROTOCOL	2
#define ICMP_DEST_UNREACH	3
#define ICMP_PORT_UNREACH	3
#define ICMP_REDIRECT_TOSHOST	3
#define ICMP_REDIR_HOSTTOS	3
#define ICMP_UNREACH	3
#define ICMP_UNREACH_PORT	3
#define ICMP_FRAG_NEEDED	4
#define ICMP_SOURCEQUENCH	4
#define ICMP_SOURCE_QUENCH	4
#define ICMP_UNREACH_NEEDFRAG	4
#define ICMP_REDIRECT	5
#define ICMP_SR_FAILED	5
#define ICMP_UNREACH_SRCFAIL	5
#define ICMP_NET_UNKNOWN	6
#define ICMP_UNREACH_NET_UNKNOWN	6
#define ICMP_HOST_UNKNOWN	7
#define ICMP_UNREACH_HOST_UNKNOWN	7
#define ICMP_ECHO	8
#define ICMP_HOST_ISOLATED	8
#define ICMP_MINLEN	8
#define ICMP_UNREACH_ISOLATED	8
#define ICMP_NET_ANO	9
#define ICMP_ROUTERADVERT	9
#define ICMP_UNREACH_NET_PROHIB	9
#define icmp_data	icmp_dun.id_data
#define icmp_ip	icmp_dun.id_ip.idi_ip
#define icmp_mask	icmp_dun.id_mask
#define icmp_radv	icmp_dun.id_radv
#define icmp_otime	icmp_dun.id_ts.its_otime
#define icmp_rtime	icmp_dun.id_ts.its_rtime
#define icmp_ttime	icmp_dun.id_ts.its_ttime
#define icmp_gwaddr	icmp_hun.ih_gwaddr
#define icmp_id	icmp_hun.ih_idseq.icd_id
#define icmp_seq	icmp_hun.ih_idseq.icd_seq
#define icmp_nextmtu	icmp_hun.ih_pmtu.ipm_nextmtu
#define icmp_pmvoid	icmp_hun.ih_pmtu.ipm_void
#define icmp_pptr	icmp_hun.ih_pptr
#define icmp_lifetime	icmp_hun.ih_rtradv.irt_lifetime
#define icmp_num_addrs	icmp_hun.ih_rtradv.irt_num_addrs
#define icmp_wpa	icmp_hun.ih_rtradv.irt_wpa
#define icmp_void	icmp_hun.ih_void

struct icmphdr {
    u_int8_t type;
    u_int8_t code;
    u_int16_t checksum;
    union {
	struct {
	    u_int16_t id;
	    u_int16_t sequence;
	} echo;
	u_int32_t gateway;
	struct {
	    u_int16_t __unused;
	    u_int16_t mtu;
	} frag;
    } un;
};
struct icmp_ra_addr {
    u_int32_t ira_addr;
    u_int32_t ira_preference;
};
struct ih_idseq {
    u_int16_t icd_id;
    u_int16_t icd_seq;
};
struct ih_pmtu {
    u_int16_t ipm_void;
    u_int16_t ipm_nextmtu;
};
struct ih_rtradv {
    u_int8_t irt_num_addrs;
    u_int8_t irt_wpa;
    u_int16_t irt_lifetime;
};
struct icmp {
    u_int8_t icmp_type;
    u_int8_t icmp_code;
    u_int16_t icmp_cksum;
    union {
	u_int16_t ih_pptr;
	struct in_addr ih_gwaddr;
	struct ih_idseq ih_idseq;
	u_int32_t ih_void;
	struct ih_pmtu ih_pmtu;
	struct ih_rtradv ih_rtradv;
    } icmp_hun;
    union {
	struct {
	    u_int32_t its_otime;
	    u_int32_t its_rtime;
	    u_int32_t its_ttime;
	} id_ts;
	struct {
	    struct ip idi_ip;
	} id_ip;
	struct icmp_ra_addr id_radv;
	u_int32_t id_mask;
	u_int8_t id_data[1];
    } icmp_dun;
};

12.4.37. netinet/tcp.h


#define TCPOLEN_TSTAMP_APPA	(TCPOLEN_TIMESTAMP+2)
#define TCPOPT_TSTAMP_HDR	(TCPOPT_NOP<<24|TCPOPT_NOP<<16|TCPOPT_TIMESTAMP<<8|TCPOLEN_TIMESTAMP)
#define TCPOPT_EOL	0
#define TCPI_OPT_TIMESTAMPS	1
#define TCPOPT_NOP	1
#define TCP_NODELAY	1
#define TCPOLEN_TIMESTAMP	10
#define TCP_WINDOW_CLAMP	10
#define TCP_INFO	11
#define TCP_QUICKACK	12
#define TCP_CONGESTION	13
#define TCP_MAX_WINSHIFT	14
#define TCPI_OPT_SACK	2
#define TCPOLEN_SACK_PERMITTED	2
#define TCPOPT_MAXSEG	2
#define TCP_MAXSEG	2
#define TCPOLEN_WINDOW	3
#define TCPOPT_WINDOW	3
#define TCP_CORK	3
#define TCPI_OPT_WSCALE	4
#define TCPOLEN_MAXSEG	4
#define TCPOPT_SACK_PERMITTED	4
#define TCP_KEEPIDLE	4
#define TCPOPT_SACK	5
#define TCP_KEEPINTVL	5
#define TCP_MSS	512
#define SOL_TCP	6
#define TCP_KEEPCNT	6
#define TCP_MAXWIN	65535
#define TCP_SYNCNT	7
#define TCPI_OPT_ECN	8
#define TCPOPT_TIMESTAMP	8
#define TCP_LINGER2	8
#define TCP_DEFER_ACCEPT	9

enum tcp_ca_state {
    TCP_CA_Open,
    TCP_CA_Disorder,
    TCP_CA_CWR,
    TCP_CA_Recovery,
    TCP_CA_Loss
};
struct tcp_info {
    uint8_t tcpi_state;
    uint8_t tcpi_ca_state;
    uint8_t tcpi_retransmits;
    uint8_t tcpi_probes;
    uint8_t tcpi_backoff;
    uint8_t tcpi_options;
    uint8_t tcpi_snd_wscale:4;
    uint8_t tcpi_rcv_wscale:4;
    uint32_t tcpi_rto;
    uint32_t tcpi_ato;
    uint32_t tcpi_snd_mss;
    uint32_t tcpi_rcv_mss;
    uint32_t tcpi_unacked;
    uint32_t tcpi_sacked;
    uint32_t tcpi_lost;
    uint32_t tcpi_retrans;
    uint32_t tcpi_fackets;
    uint32_t tcpi_last_data_sent;
    uint32_t tcpi_last_ack_sent;
    uint32_t tcpi_last_data_recv;
    uint32_t tcpi_last_ack_recv;
    uint32_t tcpi_pmtu;
    uint32_t tcpi_rcv_ssthresh;
    uint32_t tcpi_rtt;
    uint32_t tcpi_rttvar;
    uint32_t tcpi_snd_ssthresh;
    uint32_t tcpi_snd_cwnd;
    uint32_t tcpi_advmss;
    uint32_t tcpi_reordering;
};
enum {
    TCP_ESTABLISHED = 1,
    TCP_SYN_SENT = 2,
    TCP_SYN_RECV = 3,
    TCP_FIN_WAIT1 = 4,
    TCP_FIN_WAIT2 = 5,
    TCP_TIME_WAIT = 6,
    TCP_CLOSE = 7,
    TCP_CLOSE_WAIT = 8,
    TCP_LAST_ACK = 9,
    TCP_LISTEN = 10,
    TCP_CLOSING = 11
};

12.4.38. netinet/udp.h


#define SOL_UDP	17

struct udphdr {
    u_int16_t source;
    u_int16_t dest;
    u_int16_t len;
    u_int16_t check;
};

12.4.39. nl_types.h


#define NL_CAT_LOCALE	1
#define NL_SETD	1

typedef void *nl_catd;

typedef int nl_item;
extern int catclose(nl_catd __catalog);
extern char *catgets(nl_catd __catalog, int __set, int __number,
		     const char *__string);
extern nl_catd catopen(const char *__cat_name, int __flag);

12.4.40. poll.h


extern int poll(struct pollfd *__fds, nfds_t __nfds, int __timeout);

12.4.41. pty.h


extern int forkpty(int *__amaster, char *__name,
		   const struct termios *__termp,
		   const struct winsize *__winp);
extern int openpty(int *__amaster, int *__aslave, char *__name,
		   const struct termios *__termp,
		   const struct winsize *__winp);

12.4.42. pwd.h


struct passwd {
    char *pw_name;
    char *pw_passwd;
    uid_t pw_uid;
    gid_t pw_gid;
    char *pw_gecos;
    char *pw_dir;
    char *pw_shell;
};
extern void endpwent(void);
extern struct passwd *getpwent(void);
extern int getpwent_r(struct passwd *__resultbuf, char *__buffer,
		      size_t __buflen, struct passwd **__result);
extern struct passwd *getpwnam(const char *__name);
extern int getpwnam_r(const char *__name, struct passwd *__resultbuf,
		      char *__buffer, size_t __buflen,
		      struct passwd **__result);
extern struct passwd *getpwuid(uid_t __uid);
extern int getpwuid_r(uid_t __uid, struct passwd *__resultbuf,
		      char *__buffer, size_t __buflen,
		      struct passwd **__result);
extern void setpwent(void);

12.4.43. regex.h


#define RE_DUP_MAX	(0x7fff)

typedef unsigned long int reg_syntax_t;

typedef struct re_pattern_buffer {
    unsigned char *buffer;
    unsigned long int allocated;
    unsigned long int used;
    reg_syntax_t syntax;
    char *fastmap;
    char *translate;
    size_t re_nsub;
    unsigned int can_be_null:1;
    unsigned int regs_allocated:2;
    unsigned int fastmap_accurate:1;
    unsigned int no_sub:1;
    unsigned int not_bol:1;
    unsigned int not_eol:1;
    unsigned int newline_anchor:1;
} regex_t;
typedef int regoff_t;
typedef struct {
    regoff_t rm_so;
    regoff_t rm_eo;
} regmatch_t;

#define REG_ICASE	(REG_EXTENDED<<1)
#define REG_NEWLINE	(REG_ICASE<<1)
#define REG_NOSUB	(REG_NEWLINE<<1)
#define REG_EXTENDED	1

#define REG_NOTEOL	(1<<1)
#define REG_NOTBOL	1

typedef enum {
    REG_ENOSYS = -1,
    REG_NOERROR = 0,
    REG_NOMATCH = 1,
    REG_BADPAT = 2,
    REG_ECOLLATE = 3,
    REG_ECTYPE = 4,
    REG_EESCAPE = 5,
    REG_ESUBREG = 6,
    REG_EBRACK = 7,
    REG_EPAREN = 8,
    REG_EBRACE = 9,
    REG_BADBR = 10,
    REG_ERANGE = 11,
    REG_ESPACE = 12,
    REG_BADRPT = 13,
    REG_EEND = 14,
    REG_ESIZE = 15,
    REG_ERPAREN = 16
} reg_errcode_t;
extern int regcomp(regex_t * __preg, const char *__pattern, int __cflags);
extern size_t regerror(int __errcode, const regex_t * __preg,
		       char *__errbuf, size_t __errbuf_size);
extern int regexec(const regex_t * __preg, const char *__string,
		   size_t __nmatch, regmatch_t __pmatch[], int __eflags);
extern void regfree(regex_t * __preg);

12.4.44. rpc/auth.h


#define auth_destroy(auth)	((*((auth)->ah_ops->ah_destroy))(auth))

enum auth_stat {
    AUTH_OK = 0,
    AUTH_BADCRED = 1,		/* bogus credentials (seal broken) */
    AUTH_REJECTEDCRED = 2,	/* client should begin new session */
    AUTH_BADVERF = 3,		/* bogus verifier (seal broken) */
    AUTH_REJECTEDVERF = 4,	/* verifier expired or was replayed */
    AUTH_TOOWEAK = 5,		/* Rpc calls return an enum clnt_stat. */
    AUTH_INVALIDRESP = 6,	/* bogus response verifier */
    AUTH_FAILED = 7		/* some unknown reason */
};

union des_block {
    struct {
	u_int32_t high;
	u_int32_t low;
    } key;
    char c[8];
};

struct opaque_auth {
    enum_t oa_flavor;		/* flavor of auth */
    caddr_t oa_base;		/* address of more auth stuff */
    u_int oa_length;		/* not to exceed MAX_AUTH_BYTES */
};

typedef struct AUTH {
    struct opaque_auth ah_cred;
    struct opaque_auth ah_verf;
    union des_block ah_key;
    struct auth_ops *ah_ops;
    caddr_t ah_private;
} AUTH;

struct auth_ops {
    void (*ah_nextverf) (struct AUTH *);
    int (*ah_marshal) (struct AUTH *, XDR *);	/* nextverf & serialize */
    int (*ah_validate) (struct AUTH *, struct opaque_auth *);	/* validate verifier */
    int (*ah_refresh) (struct AUTH *);	/* refresh credentials */
    void (*ah_destroy) (struct AUTH *);	/* Rpc calls return an enum clnt_stat. */
};
extern struct AUTH *authnone_create(void);
extern int key_decryptsession(char *, union des_block *);
extern bool_t xdr_opaque_auth(XDR *, struct opaque_auth *);

12.4.45. rpc/clnt.h


#define clnt_control(cl,rq,in)	((*(cl)->cl_ops->cl_control)(cl,rq,in))
#define clnt_abort(rh)	((*(rh)->cl_ops->cl_abort)(rh))
#define clnt_destroy(rh)	((*(rh)->cl_ops->cl_destroy)(rh))
#define clnt_freeres(rh,xres,resp)	((*(rh)->cl_ops->cl_freeres)(rh,xres,resp))
#define clnt_geterr(rh,errp)	((*(rh)->cl_ops->cl_geterr)(rh, errp))
#define NULLPROC	((u_long)0)	/* By convention, procedure 0 takes null arguments and returns */
#define CLSET_TIMEOUT	1	/* set timeout (timeval) */
#define CLGET_XID	10	/* Get xid */
#define CLSET_XID	11	/* Set xid */
#define CLGET_VERS	12	/* Get version number */
#define CLSET_VERS	13	/* Set version number */
#define CLGET_PROG	14	/* Get program number */
#define CLSET_PROG	15	/* Set program number */
#define CLGET_TIMEOUT	2	/* get timeout (timeval) */
#define CLGET_SERVER_ADDR	3	/* get server's address (sockaddr) */
#define CLSET_RETRY_TIMEOUT	4	/* set retry timeout (timeval) */
#define CLGET_RETRY_TIMEOUT	5	/* get retry timeout (timeval) */
#define CLGET_FD	6	/* get connections file descriptor */
#define CLGET_SVC_ADDR	7	/* get server's address (netbuf) */
#define CLSET_FD_CLOSE	8	/* close fd while clnt_destroy */
#define CLSET_FD_NCLOSE	9	/* Do not close fd while clnt_destroy */
#define clnt_call(rh, proc, xargs, argsp, xres, resp, secs)	\
	((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))

enum clnt_stat {
    RPC_SUCCESS = 0,		/* call succeeded */
    RPC_CANTENCODEARGS = 1,	/* can't encode arguments */
    RPC_CANTDECODERES = 2,	/* can't decode results */
    RPC_CANTSEND = 3,		/* failure in sending call */
    RPC_CANTRECV = 4,		/* failure in receiving result */
    RPC_TIMEDOUT = 5,		/* call timed out */
    RPC_VERSMISMATCH = 6,	/* rpc versions not compatible */
    RPC_AUTHERROR = 7,		/* authentication error */
    RPC_PROGUNAVAIL = 8,	/* program not available */
    RPC_PROGVERSMISMATCH = 9,	/* program version mismatched */
    RPC_PROCUNAVAIL = 10,	/* procedure unavailable */
    RPC_CANTDECODEARGS = 11,	/* decode arguments error */
    RPC_SYSTEMERROR = 12,	/* generic "other problem" */
    RPC_NOBROADCAST = 21,	/* Broadcasting not supported */
    RPC_UNKNOWNHOST = 13,	/* unknown host name */
    RPC_UNKNOWNPROTO = 17,	/* unknown protocol */
    RPC_UNKNOWNADDR = 19,	/* Remote address unknown */
    RPC_RPCBFAILURE = 14,	/* portmapper failed in its call */
    RPC_PROGNOTREGISTERED = 15,	/* remote program is not registered */
    RPC_N2AXLATEFAILURE = 22,	/* Name to addr translation failed */
    RPC_FAILED = 16,
    RPC_INTR = 18,
    RPC_TLIERROR = 20,
    RPC_UDERROR = 23,
    RPC_INPROGRESS = 24,
    RPC_STALERACHANDLE = 25
};
struct rpc_err {
    enum clnt_stat re_status;
    union {
	int RE_errno;
	enum auth_stat RE_why;
	struct {
	    u_long low;
	    u_long high;
	} RE_vers;
	struct {
	    long int s1;
	    long int s2;
	} RE_lb;
    } ru;
};

typedef struct CLIENT {
    struct AUTH *cl_auth;
    struct clnt_ops *cl_ops;
    caddr_t cl_private;
} CLIENT;

struct clnt_ops {
    enum clnt_stat (*cl_call) (struct CLIENT *, u_long, xdrproc_t, caddr_t,
			       xdrproc_t, caddr_t, struct timeval);
    void (*cl_abort) (void);
    void (*cl_geterr) (struct CLIENT *, struct rpc_err *);
     bool_t(*cl_freeres) (struct CLIENT *, xdrproc_t, caddr_t);
    void (*cl_destroy) (struct CLIENT *);
     bool_t(*cl_control) (struct CLIENT *, int, char *);
};
extern int callrpc(const char *__host, const u_long __prognum,
		   const u_long __versnum, const u_long __procnum,
		   const xdrproc_t __inproc, const char *__in,
		   const xdrproc_t __outproc, char *__out);
extern struct CLIENT *clnt_create(const char *__host, const u_long __prog,
				  const u_long __vers, const char *__prot);
extern void clnt_pcreateerror(const char *__msg);
extern void clnt_perrno(enum clnt_stat __num);
extern void clnt_perror(struct CLIENT *__clnt, const char *__msg);
extern char *clnt_spcreateerror(const char *__msg);
extern char *clnt_sperrno(enum clnt_stat __num);
extern char *clnt_sperror(struct CLIENT *__clnt, const char *__msg);
extern struct CLIENT *clntraw_create(u_long __prog, u_long __vers);
extern struct CLIENT *clnttcp_create(struct sockaddr_in *__raddr,
				     u_long __prog, u_long __version,
				     int *__sockp, u_int __sendsz,
				     u_int __recvsz);
extern struct CLIENT *clntudp_bufcreate(struct sockaddr_in *__raddr,
					u_long __program, u_long __version,
					struct timeval __wait_resend,
					int *__sockp, u_int __sendsz,
					u_int __recvsz);
extern struct CLIENT *clntudp_create(struct sockaddr_in *__raddr,
				     u_long __program, u_long __version,
				     struct timeval __wait_resend,
				     int *__sockp);

12.4.46. rpc/pmap_clnt.h


extern u_short pmap_getport(struct sockaddr_in *__address,
			    const u_long __program, const u_long __version,
			    u_int __protocol);
extern bool_t pmap_set(const u_long __program, const u_long __vers,
		       int __protocol, u_short __port);
extern bool_t pmap_unset(u_long __program, u_long __vers);

12.4.47. rpc/rpc_msg.h


enum msg_type {
    CALL = 0,
    REPLY = 1
};
enum reply_stat {
    MSG_ACCEPTED = 0,
    MSG_DENIED = 1
};
enum accept_stat {
    SUCCESS = 0,
    PROG_UNAVAIL = 1,
    PROG_MISMATCH = 2,
    PROC_UNAVAIL = 3,
    GARBAGE_ARGS = 4,
    SYSTEM_ERR = 5
};
enum reject_stat {
    RPC_MISMATCH = 0,
    AUTH_ERROR = 1
};

#define ar_results	ru.AR_results
#define ar_vers	ru.AR_versions

struct accepted_reply {
    struct opaque_auth ar_verf;
    enum accept_stat ar_stat;
    union {
	struct {
	    unsigned long int low;
	    unsigned long int high;
	} AR_versions;
	struct {
	    caddr_t where;
	    xdrproc_t proc;
	} AR_results;
    } ru;
};

#define rj_vers	ru.RJ_versions
#define rj_why	ru.RJ_why

struct rejected_reply {
    enum reject_stat rj_stat;
    union {
	struct {
	    unsigned long int low;
	    unsigned long int high;
	} RJ_versions;
	enum auth_stat RJ_why;	/* why authentication did not work */
    } ru;
};

#define rp_acpt	ru.RP_ar
#define rp_rjct	ru.RP_dr

struct reply_body {
    enum reply_stat rp_stat;
    union {
	struct accepted_reply RP_ar;
	struct rejected_reply RP_dr;
    } ru;
};

struct call_body {
    unsigned long int cb_rpcvers;	/* must be equal to two */
    unsigned long int cb_prog;
    unsigned long int cb_vers;
    unsigned long int cb_proc;
    struct opaque_auth cb_cred;
    struct opaque_auth cb_verf;	/* protocol specific - provided by client */
};

#define rm_call	ru.RM_cmb
#define rm_reply	ru.RM_rmb
#define acpted_rply	ru.RM_rmb.ru.RP_ar
#define rjcted_rply	ru.RM_rmb.ru.RP_dr

struct rpc_msg {
    unsigned long int rm_xid;
    enum msg_type rm_direction;
    union {
	struct call_body RM_cmb;
	struct reply_body RM_rmb;
    } ru;
};
extern bool_t xdr_accepted_reply(XDR *, struct accepted_reply *);
extern bool_t xdr_callhdr(XDR * __xdrs, struct rpc_msg *__cmsg);
extern bool_t xdr_callmsg(XDR * __xdrs, struct rpc_msg *__cmsg);
extern bool_t xdr_rejected_reply(XDR *, struct rejected_reply *);
extern bool_t xdr_replymsg(XDR * __xdrs, struct rpc_msg *__rmsg);

12.4.48. rpc/svc.h


#define svc_getcaller(x)	(&(x)->xp_raddr)
#define svc_destroy(xprt)	(*(xprt)->xp_ops->xp_destroy)(xprt)
#define svc_recv(xprt,msg)	(*(xprt)->xp_ops->xp_recv)((xprt), (msg))
#define svc_reply(xprt,msg)	(*(xprt)->xp_ops->xp_reply) ((xprt), (msg))
#define svc_stat(xprt)	(*(xprt)->xp_ops->xp_stat)(xprt)
#define RPC_ANYSOCK	-1
#define svc_freeargs(xprt,xargs, argsp)	\
	(*(xprt)->xp_ops->xp_freeargs)((xprt), (xargs), (argsp))
#define svc_getargs(xprt,xargs, argsp)	\
	(*(xprt)->xp_ops->xp_getargs)((xprt), (xargs), (argsp))

enum xprt_stat {
    XPRT_DIED,
    XPRT_MOREREQS,
    XPRT_IDLE
};

typedef struct SVCXPRT {
    int xp_sock;
    u_short xp_port;
    struct xp_ops *xp_ops;
    int xp_addrlen;
    struct sockaddr_in xp_raddr;
    struct opaque_auth xp_verf;
    caddr_t xp_p1;
    caddr_t xp_p2;
    char xp_pad[256];
} SVCXPRT;

struct svc_req {
    rpcprog_t rq_prog;
    rpcvers_t rq_vers;
    rpcproc_t rq_proc;
    struct opaque_auth rq_cred;
    caddr_t rq_clntcred;
    SVCXPRT *rq_xprt;
};

typedef void (*__dispatch_fn_t) (struct svc_req *, SVCXPRT *);

struct xp_ops {
    bool_t(*xp_recv) (SVCXPRT * __xprt, struct rpc_msg * __msg);
    enum xprt_stat (*xp_stat) (SVCXPRT * __xprt);
     bool_t(*xp_getargs) (SVCXPRT * __xprt, xdrproc_t __xdr_args,
			  caddr_t args_ptr);
     bool_t(*xp_reply) (SVCXPRT * __xprt, struct rpc_msg * __msg);
     bool_t(*xp_freeargs) (SVCXPRT * __xprt, xdrproc_t __xdr_args,
			   caddr_t args_ptr);
    void (*xp_destroy) (SVCXPRT * __xprt);
};
extern void svc_getreqset(fd_set * __readfds);
extern bool_t svc_register(SVCXPRT * __xprt, rpcprog_t __prog,
			   rpcvers_t __vers, __dispatch_fn_t __dispatch,
			   rpcprot_t __protocol);
extern void svc_run(void);
extern bool_t svc_sendreply(SVCXPRT * xprt, xdrproc_t __xdr_results,
			    caddr_t __xdr_location);
extern void svcerr_auth(SVCXPRT * __xprt, enum auth_stat __why);
extern void svcerr_decode(SVCXPRT * __xprt);
extern void svcerr_noproc(SVCXPRT * __xprt);
extern void svcerr_noprog(SVCXPRT * __xprt);
extern void svcerr_progvers(SVCXPRT * __xprt, rpcvers_t __low_vers,
			    rpcvers_t __high_vers);
extern void svcerr_systemerr(SVCXPRT * __xprt);
extern void svcerr_weakauth(SVCXPRT * __xprt);
extern SVCXPRT *svcraw_create(void);
extern SVCXPRT *svctcp_create(int __sock, u_int __sendsize,
			      u_int __recvsize);
extern SVCXPRT *svcudp_create(int __sock);

12.4.49. rpc/types.h


typedef int bool_t;
typedef int enum_t;
typedef unsigned long int rpcprog_t;
typedef unsigned long int rpcvers_t;
typedef unsigned long int rpcproc_t;
typedef unsigned long int rpcprot_t;

12.4.50. rpc/xdr.h


#define XDR_DESTROY(xdrs)	 \
   do { if ((xdrs)->x_ops->x_destroy) (*(xdrs)->x_ops->x_destroy)(xdrs); \
      } while (0)
#define xdr_destroy(xdrs)	 \
   do { if ((xdrs)->x_ops->x_destroy) (*(xdrs)->x_ops->x_destroy)(xdrs); \
      } while (0)
#define XDR_GETBYTES(xdrs,addr,len)	(*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
#define xdr_getbytes(xdrs,addr,len)	(*(xdrs)->x_ops->x_getbytes)(xdrs, addr, len)
#define XDR_GETINT32(xdrs,int32p)	(*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
#define xdr_getint32(xdrs,int32p)	(*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
#define XDR_GETLONG(xdrs,longp)	(*(xdrs)->x_ops->x_getlong)(xdrs, longp)
#define xdr_getlong(xdrs,longp)	(*(xdrs)->x_ops->x_getlong)(xdrs, longp)
#define XDR_GETPOS(xdrs)	(*(xdrs)->x_ops->x_getpostn)(xdrs)
#define xdr_getpos(xdrs)	(*(xdrs)->x_ops->x_getpostn)(xdrs)
#define XDR_INLINE(xdrs,len)	(*(xdrs)->x_ops->x_inline)(xdrs, len)
#define xdr_inline(xdrs,len)	(*(xdrs)->x_ops->x_inline)(xdrs, len)
#define XDR_PUTBYTES(xdrs,addr,len)	(*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
#define xdr_putbytes(xdrs,addr,len)	(*(xdrs)->x_ops->x_putbytes)(xdrs, addr, len)
#define XDR_PUTINT32(xdrs,int32p)	(*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
#define xdr_putint32(xdrs,int32p)	(*(xdrs)->x_ops->x_putint32)(xdrs, int32p)
#define XDR_PUTLONG(xdrs,longp)	(*(xdrs)->x_ops->x_putlong)(xdrs, longp)
#define xdr_putlong(xdrs,longp)	(*(xdrs)->x_ops->x_putlong)(xdrs, longp)
#define XDR_SETPOS(xdrs,pos)	(*(xdrs)->x_ops->x_setpostn)(xdrs, pos)
#define xdr_setpos(xdrs,pos)	(*(xdrs)->x_ops->x_setpostn)(xdrs, pos)

enum xdr_op {
    XDR_ENCODE,
    XDR_DECODE,
    XDR_FREE
};
typedef struct XDR {
    enum xdr_op x_op;
    struct xdr_ops *x_ops;
    caddr_t x_public;
    caddr_t x_private;
    caddr_t x_base;
    int x_handy;
} XDR;

struct xdr_ops {
    bool_t(*x_getlong) (XDR * __xdrs, long int *__lp);
    bool_t(*x_putlong) (XDR * __xdrs, long int *__lp);
    bool_t(*x_getbytes) (XDR * __xdrs, caddr_t __addr, u_int __len);
    bool_t(*x_putbytes) (XDR * __xdrs, char *__addr, u_int __len);
    u_int(*x_getpostn) (XDR * __xdrs);
    bool_t(*x_setpostn) (XDR * __xdrs, u_int __pos);
    int32_t *(*x_inline) (XDR * __xdrs, int __len);
    void (*x_destroy) (XDR * __xdrs);
     bool_t(*x_getint32) (XDR * __xdrs, int32_t * __ip);
     bool_t(*x_putint32) (XDR * __xdrs, int32_t * __ip);
};

typedef bool_t(*xdrproc_t) (XDR *, void *, ...);

struct xdr_discrim {
    int value;
    xdrproc_t proc;
};
extern bool_t xdr_array(XDR * _xdrs, caddr_t * __addrp, u_int * __sizep,
			u_int __maxsize, u_int __elsize,
			xdrproc_t __elproc);
extern bool_t xdr_bool(XDR * __xdrs, bool_t * __bp);
extern bool_t xdr_bytes(XDR * __xdrs, char **__cpp, u_int * __sizep,
			u_int __maxsize);
extern bool_t xdr_char(XDR * __xdrs, char *__cp);
extern bool_t xdr_double(XDR * __xdrs, double *__dp);
extern bool_t xdr_enum(XDR * __xdrs, enum_t * __ep);
extern bool_t xdr_float(XDR * __xdrs, float *__fp);
extern void xdr_free(xdrproc_t __proc, char *__objp);
extern bool_t xdr_int(XDR * __xdrs, int *__ip);
extern bool_t xdr_long(XDR * __xdrs, long int *__lp);
extern bool_t xdr_opaque(XDR * __xdrs, caddr_t __cp, u_int __cnt);
extern bool_t xdr_pointer(XDR * __xdrs, char **__objpp, u_int __obj_size,
			  xdrproc_t __xdr_obj);
extern bool_t xdr_reference(XDR * __xdrs, caddr_t * __xpp, u_int __size,
			    xdrproc_t __proc);
extern bool_t xdr_short(XDR * __xdrs, short *__sp);
extern bool_t xdr_string(XDR * __xdrs, char **__cpp, u_int __maxsize);
extern bool_t xdr_u_char(XDR * __xdrs, u_char * __cp);
extern bool_t xdr_u_int(XDR * __xdrs, u_int * __up);
extern bool_t xdr_u_long(XDR * __xdrs, u_long * __ulp);
extern bool_t xdr_u_short(XDR * __xdrs, u_short * __usp);
extern bool_t xdr_union(XDR * __xdrs, enum_t * __dscmp, char *__unp,
			const struct xdr_discrim *__choices,
			xdrproc_t dfault);
extern bool_t xdr_vector(XDR * __xdrs, char *__basep, u_int __nelem,
			 u_int __elemsize, xdrproc_t __xdr_elem);
extern bool_t xdr_void(void);
extern bool_t xdr_wrapstring(XDR * __xdrs, char **__cpp);
extern void xdrmem_create(XDR * __xdrs, caddr_t __addr, u_int __size,
			  enum xdr_op __xop);
extern void xdrrec_create(XDR * __xdrs, u_int __sendsize, u_int __recvsize,
			  caddr_t __tcp_handle, int (*__readit) (char *,
								 char *,
								 int),
			  int (*__writeit) (char *, char *, int));
extern bool_t xdrrec_endofrecord(XDR * __xdrs, bool_t __sendnow);
extern bool_t xdrrec_eof(XDR * __xdrs);
extern bool_t xdrrec_skiprecord(XDR * __xdrs);
extern void xdrstdio_create(XDR * __xdrs, FILE * __file,
			    enum xdr_op __xop);

12.4.51. sched.h


#define __CPU_ALLOC_SIZE(count)	((((count) + __NCPUBITS - 1) / __NCPUBITS) * 8)
#define __CPUELT(cpu)	((cpu) / __NCPUBITS)
#define __CPUMASK(cpu)	((__cpu_mask) 1 << ((cpu) % __NCPUBITS))
#define __NCPUBITS	(8 * sizeof (__cpu_mask))
#define SCHED_OTHER	0
#define SCHED_FIFO	1
#define __CPU_SETSIZE	1024
#define SCHED_RR	2
#define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) 	\
  (__extension__\
   ({ cpu_set_t *__dest = (destset); \
     cpu_set_t *__arr1 = (srcset1); \
     cpu_set_t *__arr2 = (srcset2); \
     size_t __imax = (setsize) / sizeof (__cpu_mask); \
     size_t __i; \
     for (__i = 0; __i < __imax; ++__i)\
       __dest->__bits[__i] = __arr1->__bits[__i] op __arr2->__bits[__i]; \
 __dest; }))
#define __CPU_SET_S(cpu, setsize, cpusetp)	\
  (__extension__\
   ({ size_t __cpu = (cpu); \
     __cpu < 8 * (setsize) \
     ? ((cpusetp)->__bits[__CPUELT (__cpu)] |= __CPUMASK (__cpu)) : 0; }))
#define __CPU_ISSET_S(cpu, setsize, cpusetp)	\
  (__extension__\
   ({ size_t __cpu = (cpu); \
     __cpu < 8 * (setsize)\
     ? (((cpusetp)->__bits[__CPUELT (__cpu)] & __CPUMASK (__cpu))) != 0 \
 : 0; }))
#define __CPU_CLR_S(cpu, setsize, cpusetp)	\
  (__extension__\
   ({ size_t __cpu = (cpu); \
     __cpu < 8 * (setsize)\
     ? ((cpusetp)->__bits[__CPUELT (__cpu)] &= ~__CPUMASK (__cpu)) : 0; }))
#define __CPU_ZERO_S(setsize, cpusetp)	\
  do {\
    size_t __i; \
    size_t __imax = (setsize) / sizeof (__cpu_mask); \
    cpu_set_t *__arr = (cpusetp); \
    for (__i = 0; __i < __imax; ++__i)\
       __arr->__bits[__i] = 0; \
  } while (0)
#define CPU_ALLOC_SIZE(count)	__CPU_ALLOC_SIZE (count)
#define CPU_CLR(cpu, cpusetp)	__CPU_CLR_S (cpu, sizeof (cpu_set_t), cpusetp)
#define CPU_ISSET(cpu, cpusetp)	__CPU_ISSET_S (cpu, sizeof (cpu_set_t), cpusetp)
#define CPU_AND_S(setsize, destset, srcset1, srcset2)	__CPU_OP_S (setsize, destset, srcset1, srcset2, &)
#define CPU_XOR_S(setsize, destset, srcset1, srcset2)	__CPU_OP_S (setsize, destset, srcset1, srcset2, ^)
#define CPU_OR_S(setsize, destset, srcset1, srcset2)	__CPU_OP_S (setsize, destset, srcset1, srcset2, |)
#define CPU_AND(destset, srcset1, srcset2)	__CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, &)
#define CPU_XOR(destset, srcset1, srcset2)	__CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, ^)
#define CPU_OR(destset, srcset1, srcset2)	__CPU_OP_S (sizeof (cpu_set_t), destset, srcset1, srcset2, |)
#define CPU_SETSIZE	__CPU_SETSIZE
#define CPU_SET(cpu, cpusetp)	__CPU_SET_S (cpu, sizeof (cpu_set_t), cpusetp)
#define CPU_ZERO(cpusetp)	__CPU_ZERO_S (sizeof (cpu_set_t), cpusetp)

struct sched_param {
    int sched_priority;
};
typedef unsigned long int __cpu_mask;
typedef struct {
    __cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS];
} cpu_set_t;
extern int sched_get_priority_max(int __algorithm);
extern int sched_get_priority_min(int __algorithm);
extern int sched_getaffinity(pid_t __pid, size_t __cpusetsize,
			     cpu_set_t * __cpuset);
extern int sched_getparam(pid_t __pid, struct sched_param *__param);
extern int sched_getscheduler(pid_t __pid);
extern int sched_rr_get_interval(pid_t __pid, struct timespec *__t);
extern int sched_setaffinity(pid_t __pid, size_t __cpusetsize,
			     const cpu_set_t * __cpuset);
extern int sched_setparam(pid_t __pid, const struct sched_param *__param);
extern int sched_setscheduler(pid_t __pid, int __policy,
			      const struct sched_param *__param);
extern int sched_yield(void);

12.4.52. search.h


typedef struct entry {
    char *key;
    void *data;
} ENTRY;
typedef enum {
    FIND,
    ENTER
} ACTION;
struct _ENTRY;
typedef enum {
    preorder,
    postorder,
    endorder,
    leaf
} VISIT;
struct hsearch_data {
    struct _ENTRY *table;
    unsigned int size;
    unsigned int filled;
};

typedef void (*__action_fn_t) (const void *__nodep, VISIT __value,
			       int __level);
extern int hcreate(size_t __nel);
extern int hcreate_r(size_t __nel, struct hsearch_data *__htab);
extern void hdestroy(void);
extern void hdestroy_r(struct hsearch_data *__htab);
extern ENTRY *hsearch(ENTRY __item, ACTION __action);
extern int hsearch_r(ENTRY __item, ACTION __action, ENTRY * *__retval,
		     struct hsearch_data *__htab);
extern void insque(void *__elem, void *__prev);
extern void *lfind(const void *__key, const void *__base, size_t * __nmemb,
		   size_t __size, __compar_fn_t __compar);
extern void *lsearch(const void *__key, void *__base, size_t * __nmemb,
		     size_t __size, __compar_fn_t __compar);
extern void remque(void *__elem);
extern void *tdelete(const void *__key, void **__rootp,
		     __compar_fn_t __compar);
extern void *tfind(const void *__key, void *const *__rootp,
		   __compar_fn_t __compar);
extern void *tsearch(const void *__key, void **__rootp,
		     __compar_fn_t __compar);
extern void twalk(const void *__root, __action_fn_t __action);

12.4.53. setjmp.h


#define setjmp(env)	_setjmp(env)
#define sigsetjmp(a,b)	__sigsetjmp(a,b)

struct __jmp_buf_tag {
    __jmp_buf __jmpbuf;
    int __mask_was_saved;
    sigset_t __saved_mask;
};

typedef struct __jmp_buf_tag jmp_buf[1];
typedef jmp_buf sigjmp_buf;
extern int __sigsetjmp(jmp_buf __env, int __savemask);
extern void _longjmp(jmp_buf __env, int __val);
extern int _setjmp(jmp_buf __env);
extern void longjmp(jmp_buf __env, int __val);
extern void siglongjmp(sigjmp_buf __env, int __val);

12.4.54. signal.h


#define sigpause __xpg_sigpause

#define _SIGSET_NWORDS	(1024/(8*sizeof(unsigned long)))
#define SIGRTMAX	(__libc_current_sigrtmax ())
#define SIGRTMIN	(__libc_current_sigrtmin ())
#define NSIG	65
#define SIG_BLOCK	0	/* Block signals. */
#define SIG_UNBLOCK	1	/* Unblock signals. */
#define SIG_SETMASK	2	/* Set the set of blocked signals. */

typedef int sig_atomic_t;

typedef void (*sighandler_t) (int);

#define SIG_HOLD	((sighandler_t) 2)	/* Request that signal be held. */
#define SIG_DFL	((sighandler_t)0)	/* Request for default signal handling. */
#define SIG_IGN	((sighandler_t)1)	/* Request that signal be ignored. */
#define SIG_ERR	((sighandler_t)-1)	/* Return value from signal() in case of error. */

#define SIGHUP	1		/* Hangup. */
#define SIGINT	2		/* Terminal interrupt signal. */
#define SIGQUIT	3		/* Terminal quit signal. */
#define SIGILL	4		/* Illegal instruction. */
#define SIGTRAP	5		/* Trace/breakpoint trap. */
#define SIGABRT	6		/* Process abort signal. */
#define SIGIOT	6		/* IOT trap */
#define SIGBUS	7		/* Access to an undefined portion of a memory object. */
#define SIGFPE	8		/* Erroneous arithmetic operation. */
#define SIGKILL	9		/* Kill (cannot be caught or ignored). */
#define SIGUSR1	10		/* User-defined signal 1. */
#define SIGSEGV	11		/* Invalid memory reference. */
#define SIGUSR2	12		/* User-defined signal 2. */
#define SIGPIPE	13		/* Write  on a pipe with no one to read it. */
#define SIGALRM	14		/* Alarm clock. */
#define SIGTERM	15		/* Termination signal. */
#define SIGSTKFLT	16	/* Stack fault. */
#define SIGCHLD	17		/* Child process terminated, stopped, or continued. */
#define SIGCLD	SIGCHLD		/* Same as SIGCHLD */
#define SIGCONT	18		/* Continue executing, if stopped. */
#define SIGSTOP	19		/* Stop executing (cannot be caught or ignored). */
#define SIGTSTP	20		/* Terminal stop signal. */
#define SIGTTIN	21		/* Background process attempting read. */
#define SIGTTOU	22		/* Background process attempting write. */
#define SIGURG	23		/* High bandwidth data is available at a socket. */
#define SIGXCPU	24		/* CPU time limit exceeded. */
#define SIGXFSZ	25		/* File size limit exceeded. */
#define SIGVTALRM	26	/* Virtual timer expired. */
#define SIGPROF	27		/* Profiling timer expired. */
#define SIGWINCH	28	/* Window size change. */
#define SIGIO	29		/* I/O now possible. */
#define SIGPOLL	SIGIO		/* Pollable event. */
#define SIGPWR	30		/* Power failure restart */
#define SIGSYS	31		/* Bad system call. */
#define SIGUNUSED	31

#define SV_ONSTACK	(1<<0)	/* Take the signal on the signal stack. */
#define SV_INTERRUPT	(1<<1)	/* Do not restart system calls. */
#define SV_RESETHAND	(1<<2)	/* Reset handler to SIG_DFL on receipt. */

typedef union sigval {
    int sival_int;
    void *sival_ptr;
} sigval_t;

#define SIGEV_SIGNAL	0	/* Notify via signal. */
#define SIGEV_NONE	1	/* Other notification: meaningless. */
#define SIGEV_THREAD	2	/* Deliver via thread creation. */
#define SIGEV_MAX_SIZE	64

typedef struct sigevent {
    sigval_t sigev_value;
    int sigev_signo;
    int sigev_notify;
    union {
	int _pad[SIGEV_PAD_SIZE];
	struct {
	    void (*_function) (sigval_t);
	    void *_attribute;
	} _sigev_thread;
    } _sigev_un;
} sigevent_t;

#define SI_MAX_SIZE	128
#define si_pid	_sifields._kill._pid
#define si_uid	_sifields._kill._uid
#define si_value	_sifields._rt._sigval
#define si_int	_sifields._rt._sigval.sival_int
#define si_ptr	_sifields._rt._sigval.sival_ptr
#define si_status	_sifields._sigchld._status
#define si_stime	_sifields._sigchld._stime
#define si_utime	_sifields._sigchld._utime
#define si_addr	_sifields._sigfault._addr
#define si_band	_sifields._sigpoll._band
#define si_fd	_sifields._sigpoll._fd
#define si_timer1	_sifields._timer._timer1
#define si_timer2	_sifields._timer._timer2

typedef struct siginfo {
    int si_signo;		/* Signal number. */
    int si_errno;
    int si_code;		/* Signal code. */
    union {
	int _pad[SI_PAD_SIZE];
	struct {
	    pid_t _pid;
	    uid_t _uid;
	} _kill;
	struct {
	    unsigned int _timer1;
	    unsigned int _timer2;
	} _timer;
	struct {
	    pid_t _pid;
	    uid_t _uid;
	    sigval_t _sigval;
	} _rt;
	struct {
	    pid_t _pid;
	    uid_t _uid;
	    int _status;
	    clock_t _utime;
	    clock_t _stime;
	} _sigchld;
	struct {
	    void *_addr;
	} _sigfault;
	struct {
	    int _band;
	    int _fd;
	} _sigpoll;
    } _sifields;
} siginfo_t;

#define SI_QUEUE	-1	/* Sent by sigqueue. */
#define SI_TIMER	-2	/* Sent by timer expiration. */
#define SI_MESGQ	-3	/* Sent by real time mesq state change. */
#define SI_ASYNCIO	-4	/* Sent by AIO completion. */
#define SI_SIGIO	-5	/* Sent by queued SIGIO. */
#define SI_TKILL	-6	/* Sent by tkill. */
#define SI_ASYNCNL	-60	/* Sent by asynch name lookup completion. */
#define SI_USER	0		/* Sent by kill, sigsend, raise. */
#define SI_KERNEL	0x80	/* Sent by kernel. */

#define ILL_ILLOPC	1	/* Illegal opcode. */
#define ILL_ILLOPN	2	/* Illegal operand. */
#define ILL_ILLADR	3	/* Illegal addressing mode. */
#define ILL_ILLTRP	4	/* Illegal trap. */
#define ILL_PRVOPC	5	/* Privileged opcode. */
#define ILL_PRVREG	6	/* Privileged register. */
#define ILL_COPROC	7	/* Coprocessor error. */
#define ILL_BADSTK	8	/* Internal stack error. */

#define FPE_INTDIV	1	/* Integer divide by zero. */
#define FPE_INTOVF	2	/* Integer overflow. */
#define FPE_FLTDIV	3	/*  Floating-point divide by zero. */
#define FPE_FLTOVF	4	/* Floating-point overflow. */
#define FPE_FLTUND	5	/*  Floating-point underflow. */
#define FPE_FLTRES	6	/*  Floating-point inexact result. */
#define FPE_FLTINV	7	/* Invalid floating-point operation. */
#define FPE_FLTSUB	8	/* Subscript out of range. */

#define SEGV_MAPERR	1	/* Address not mapped to object. */
#define SEGV_ACCERR	2	/*  Invalid permissions for mapped object. */

#define BUS_ADRALN	1	/*  Invalid address alignment. */
#define BUS_ADRERR	2	/*  Nonexistent physical address. */
#define BUS_OBJERR	3	/*  Object-specific hardware error. */

#define TRAP_BRKPT	1	/*  Process breakpoint. */
#define TRAP_TRACE	2	/*  Process trace trap. */

#define CLD_EXITED	1	/* Child has exited. */
#define CLD_KILLED	2	/* Child has terminated abnormally and did not create a core fi */
#define CLD_DUMPED	3	/* Child has terminated abnormally and created a core file. */
#define CLD_TRAPPED	4	/*  Traced child has trapped. */
#define CLD_STOPPED	5	/* Child has stopped. */
#define CLD_CONTINUED	6	/* Stopped child has continued. */

#define POLL_IN	1		/*  Data input available. */
#define POLL_OUT	2	/*  Output buffers available. */
#define POLL_MSG	3	/*  Input message available. */
#define POLL_ERR	4	/*  I/O error. */
#define POLL_PRI	5	/* High priority input available. */
#define POLL_HUP	6	/*  Device disconnected. */

typedef struct {
    unsigned long int sig[_SIGSET_NWORDS];
} sigset_t;

#define SA_INTERRUPT	0x20000000
#define sa_handler	__sigaction_handler._sa_handler
#define sa_sigaction	__sigaction_handler._sa_sigaction
#define SA_ONSTACK	0x08000000	/* Use signal stack by using `sa_restorer`. */
#define SA_RESETHAND	0x80000000	/* Reset to SIG_DFL on entry to handler. */
#define SA_NOCLDSTOP	0x00000001	/* Don't send SIGCHLD when children stop. */
#define SA_SIGINFO	0x00000004	/* Invoke signal-catching function with three arguments instead of one. */
#define SA_NODEFER	0x40000000	/* Don't automatically block the signal when its handler is being executed. */
#define SA_RESTART	0x10000000	/* Restart syscall on signal return. */
#define SA_NOCLDWAIT	0x00000002	/* Don't create zombie on child death. */
#define SA_NOMASK	SA_NODEFER
#define SA_ONESHOT	SA_RESETHAND

typedef struct sigaltstack {
    void *ss_sp;
    int ss_flags;
    size_t ss_size;
} stack_t;

#define SS_ONSTACK	1
#define SS_DISABLE	2

extern int __libc_current_sigrtmax(void);
extern int __libc_current_sigrtmin(void);
extern sighandler_t __sysv_signal(int __sig, sighandler_t __handler);
extern int __xpg_sigpause(int);
extern char *const _sys_siglist[];
extern sighandler_t bsd_signal(int __sig, sighandler_t __handler);
extern int kill(pid_t __pid, int __sig);
extern int killpg(pid_t __pgrp, int __sig);
extern void psignal(int __sig, const char *__s);
extern int pthread_kill(pthread_t, int);
extern int pthread_sigmask(int, const sigset_t *, sigset_t *);
extern int raise(int __sig);
extern int sigaction(int __sig, const struct sigaction *__act,
		     struct sigaction *__oact);
extern int sigaddset(sigset_t * __set, int __signo);
extern int sigaltstack(const struct sigaltstack *__ss,
		       struct sigaltstack *__oss);
extern int sigandset(sigset_t * __set, const sigset_t * __left,
		     const sigset_t * __right);
extern int sigdelset(sigset_t * __set, int __signo);
extern int sigemptyset(sigset_t * __set);
extern int sigfillset(sigset_t * __set);
extern int sighold(int __sig);
extern int sigignore(int __sig);
extern int siginterrupt(int __sig, int __interrupt);
extern int sigisemptyset(const sigset_t * __set);
extern int sigismember(const sigset_t * __set, int __signo);
extern sighandler_t signal(int __sig, sighandler_t __handler);
extern int sigorset(sigset_t * __set, const sigset_t * __left,
		    const sigset_t * __right);
extern int sigpending(sigset_t * __set);
extern int sigprocmask(int __how, const sigset_t * __set,
		       sigset_t * __oset);
extern int sigqueue(pid_t __pid, int __sig, const union sigval __val);
extern int sigrelse(int __sig);
extern int sigreturn(struct sigcontext *__scp);
extern sighandler_t sigset(int __sig, sighandler_t __disp);
extern int sigsuspend(const sigset_t * __set);
extern int sigtimedwait(const sigset_t * __set, siginfo_t * __info,
			const struct timespec *__timeout);
extern int sigwait(const sigset_t * __set, int *__sig);
extern int sigwaitinfo(const sigset_t * __set, siginfo_t * __info);

12.4.55. spawn.h


#define POSIX_SPAWN_RESETIDS	0x01
#define POSIX_SPAWN_SETPGROUP	0x02
#define POSIX_SPAWN_SETSIGDEF	0x04
#define POSIX_SPAWN_SETSIGMASK	0x08
#define POSIX_SPAWN_SETSCHEDPARAM	0x10
#define POSIX_SPAWN_SETSCHEDULER	0x20

typedef struct {
    int __allocated;
    int __used;
    struct __spawn_action *__actions;
    int __pad[16];
} posix_spawn_file_actions_t;
typedef struct {
    short __flags;
    pid_t __pgrp;
    sigset_t __sd;
    sigset_t __ss;
    struct sched_param __sp;
    int __policy;
    int __pad[16];
} posix_spawnattr_t;
extern int posix_spawn(pid_t * __pid, const char *__path,
		       const posix_spawn_file_actions_t * __file_actions,
		       const posix_spawnattr_t * __attrp,
		       char *const argv[], char *const envp[]);
extern int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *
					     __file_actions, int __fd);
extern int posix_spawn_file_actions_adddup2(posix_spawn_file_actions_t *
					    __file_actions, int __fd,
					    int __newfd);
extern int posix_spawn_file_actions_addopen(posix_spawn_file_actions_t *
					    __file_actions, int __fd,
					    const char *__path,
					    int __oflag, mode_t __mode);
extern int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *
					    __file_actions);
extern int posix_spawn_file_actions_init(posix_spawn_file_actions_t *
					 __file_actions);
extern int posix_spawnattr_destroy(posix_spawnattr_t * __attr);
extern int posix_spawnattr_getflags(const posix_spawnattr_t * __attr,
				    short int *__flags);
extern int posix_spawnattr_getpgroup(const posix_spawnattr_t * __attr,
				     pid_t * __pgroup);
extern int posix_spawnattr_getschedparam(const posix_spawnattr_t * __attr,
					 struct sched_param *__schedparam);
extern int posix_spawnattr_getschedpolicy(const posix_spawnattr_t * __attr,
					  int *__schedpolicy);
extern int posix_spawnattr_getsigdefault(const posix_spawnattr_t * __attr,
					 sigset_t * __sigdefault);
extern int posix_spawnattr_getsigmask(const posix_spawnattr_t * __attr,
				      sigset_t * __sigmask);
extern int posix_spawnattr_init(posix_spawnattr_t * __attr);
extern int posix_spawnattr_setflags(posix_spawnattr_t * _attr,
				    short int __flags);
extern int posix_spawnattr_setpgroup(posix_spawnattr_t * __attr,
				     pid_t __pgroup);
extern int posix_spawnattr_setschedparam(posix_spawnattr_t * __attr,
					 const struct sched_param
					 *__schedparam);
extern int posix_spawnattr_setschedpolicy(posix_spawnattr_t * __attr,
					  int __schedpolicy);
extern int posix_spawnattr_setsigdefault(posix_spawnattr_t * __attr,
					 const sigset_t * __sigdefault);
extern int posix_spawnattr_setsigmask(posix_spawnattr_t * __attr,
				      const sigset_t * __sigmask);
extern int posix_spawnp(pid_t * __pid, const char *__file,
			const posix_spawn_file_actions_t * __file_actions,
			const posix_spawnattr_t * __attrp,
			char *const argv[], char *const envp[]);

12.4.56. stddef.h


#define offsetof(TYPE,MEMBER)	((size_t)&((TYPE*)0)->MEMBER)
#ifndef NULL
#  ifdef __cplusplus
#    define NULL        (0L)
#  else
#    define NULL        ((void*) 0)
#  endif
#endif

12.4.57. stdint.h


#define INT16_C(c)	c
#define INT32_C(c)	c
#define INT8_C(c)	c
#define UINT16_C(c)	c
#define UINT8_C(c)	c
#define UINT32_C(c)	c ## U

#define INT8_MIN	(-128)
#define INT_FAST8_MIN	(-128)
#define INT_LEAST8_MIN	(-128)
#define INT32_MIN	(-2147483647-1)
#define INT_LEAST32_MIN	(-2147483647-1)
#define SIG_ATOMIC_MIN	(-2147483647-1)
#define INT16_MIN	(-32767-1)
#define INT_LEAST16_MIN	(-32767-1)
#define INT64_MIN	(-__INT64_C(9223372036854775807)-1)
#define INTMAX_MIN	(-__INT64_C(9223372036854775807)-1)
#define INT_FAST64_MIN	(-__INT64_C(9223372036854775807)-1)
#define INT_LEAST64_MIN	(-__INT64_C(9223372036854775807)-1)
#define WINT_MIN	(0u)
#define INT8_MAX	(127)
#define INT_FAST8_MAX	(127)
#define INT_LEAST8_MAX	(127)
#define INT32_MAX	(2147483647)
#define INT_LEAST32_MAX	(2147483647)
#define SIG_ATOMIC_MAX	(2147483647)
#define UINT8_MAX	(255)
#define UINT_FAST8_MAX	(255)
#define UINT_LEAST8_MAX	(255)
#define INT16_MAX	(32767)
#define INT_LEAST16_MAX	(32767)
#define UINT32_MAX	(4294967295U)
#define UINT_LEAST32_MAX	(4294967295U)
#define WINT_MAX	(4294967295u)
#define UINT16_MAX	(65535)
#define UINT_LEAST16_MAX	(65535)
#define INT64_MAX	(__INT64_C(9223372036854775807))
#define INTMAX_MAX	(__INT64_C(9223372036854775807))
#define INT_FAST64_MAX	(__INT64_C(9223372036854775807))
#define INT_LEAST64_MAX	(__INT64_C(9223372036854775807))
#define UINT64_MAX	(__UINT64_C(18446744073709551615))
#define UINTMAX_MAX	(__UINT64_C(18446744073709551615))
#define UINT_FAST64_MAX	(__UINT64_C(18446744073709551615))
#define UINT_LEAST64_MAX	(__UINT64_C(18446744073709551615))

typedef signed char int8_t;
typedef short int16_t;
typedef int int32_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
typedef signed char int_least8_t;
typedef short int int_least16_t;
typedef int int_least32_t;
typedef unsigned char uint_least8_t;
typedef unsigned short uint_least16_t;
typedef unsigned int uint_least32_t;
typedef signed char int_fast8_t;
typedef unsigned char uint_fast8_t;

12.4.58. stdio.h


#define EOF	(-1)
#define P_tmpdir	"/tmp"
#define FOPEN_MAX	16
#define L_tmpnam	20
#define TMP_MAX	238328
#define FILENAME_MAX	4096
#define BUFSIZ	8192
#define L_ctermid	9
#define L_cuserid	9

typedef struct {
    off_t __pos;
    mbstate_t __state;
} fpos_t;
typedef struct {
    off64_t __pos;
    mbstate_t __state;
} fpos64_t;

typedef struct _IO_FILE FILE;

#define _IOFBF	0
#define _IOLBF	1
#define _IONBF	2

extern char *__fgets_chk(char *, size_t, int, FILE *);
extern char *__fgets_unlocked_chk(char *, size_t, int, FILE *);
extern size_t __fpending(FILE *);
extern int __printf_chk(int, const char *, ...);
extern int __snprintf_chk(char *, size_t, int, size_t, const char *, ...);
extern int __sprintf_chk(char *, int, size_t, const char *, ...);
extern int __vprintf_chk(int, const char *, va_list);
extern int __vsnprintf_chk(char *, size_t, int, size_t, const char *,
			   va_list);
extern int __vsprintf_chk(char *, int, size_t, const char *, va_list);
extern char *const _sys_errlist[];
extern int asprintf(char **__ptr, const char *__fmt, ...);
extern void clearerr(FILE * __stream);
extern void clearerr_unlocked(FILE * __stream);
extern int dprintf(int __fd, const char *__fmt, ...);
extern int fclose(FILE * __stream);
extern FILE *fdopen(int __fd, const char *__modes);
extern int feof(FILE * __stream);
extern int feof_unlocked(FILE * __stream);
extern int ferror(FILE * __stream);
extern int ferror_unlocked(FILE * __stream);
extern int fflush(FILE * __stream);
extern int fflush_unlocked(FILE * __stream);
extern int fgetc(FILE * __stream);
extern int fgetc_unlocked(FILE * __stream);
extern int fgetpos(FILE * __stream, fpos_t * __pos);
extern int fgetpos64(FILE * __stream, fpos64_t * __pos);
extern char *fgets(char *__s, int __n, FILE * __stream);
extern char *fgets_unlocked(char *__s, int __n, FILE * __stream);
extern int fileno(FILE * __stream);
extern int fileno_unlocked(FILE * __stream);
extern void flockfile(FILE * __stream);
extern FILE *fmemopen(void *__s, size_t __len, const char *__modes);
extern FILE *fopen(const char *__filename, const char *__modes);
extern FILE *fopen64(const char *__filename, const char *__modes);
extern int fprintf(FILE * __stream, const char *__format, ...);
extern int fputc(int __c, FILE * __stream);
extern int fputc_unlocked(int __c, FILE * __stream);
extern int fputs(const char *__s, FILE * __stream);
extern int fputs_unlocked(const char *__s, FILE * __stream);
extern size_t fread(void *__ptr, size_t __size, size_t __n,
		    FILE * __stream);
extern size_t fread_unlocked(void *__ptr, size_t __size, size_t __n,
			     FILE * __stream);
extern FILE *freopen(const char *__filename, const char *__modes,
		     FILE * __stream);
extern FILE *freopen64(const char *__filename, const char *__modes,
		       FILE * __stream);
extern int fscanf(FILE * __stream, const char *__format, ...);
extern int fseek(FILE * __stream, long int __off, int __whence);
extern int fseeko(FILE * __stream, off_t __off, int __whence);
extern int fseeko64(FILE * __stream, loff_t __off, int __whence);
extern int fsetpos(FILE * __stream, const fpos_t * __pos);
extern int fsetpos64(FILE * __stream, const fpos64_t * __pos);
extern long int ftell(FILE * __stream);
extern off_t ftello(FILE * __stream);
extern loff_t ftello64(FILE * __stream);
extern int ftrylockfile(FILE * __stream);
extern void funlockfile(FILE * __stream);
extern size_t fwrite(const void *__ptr, size_t __size, size_t __n,
		     FILE * __s);
extern size_t fwrite_unlocked(const void *__ptr, size_t __size, size_t __n,
			      FILE * __stream);
extern int getc(FILE * __stream);
extern int getc_unlocked(FILE * __stream);
extern int getchar(void);
extern int getchar_unlocked(void);
extern ssize_t getdelim(char **__lineptr, size_t * __n, int __delimiter,
			FILE * __stream);
extern ssize_t getline(char **__lineptr, size_t * __n, FILE * __stream);
extern int getw(FILE * __stream);
extern FILE *open_memstream(char **__bufloc, size_t * __sizeloc);
extern int pclose(FILE * __stream);
extern void perror(const char *__s);
extern FILE *popen(const char *__command, const char *__modes);
extern int printf(const char *__format, ...);
extern int putc(int __c, FILE * __stream);
extern int putc_unlocked(int __c, FILE * __stream);
extern int putchar(int __c);
extern int putchar_unlocked(int __c);
extern int puts(const char *__s);
extern int putw(int __w, FILE * __stream);
extern int remove(const char *__filename);
extern int renameat(int __oldfd, const char *__old, int __newfd,
		    const char *__new);
extern void rewind(FILE * __stream);
extern int scanf(const char *__format, ...);
extern void setbuf(FILE * __stream, char *__buf);
extern void setbuffer(FILE * __stream, char *__buf, size_t __size);
extern int setvbuf(FILE * __stream, char *__buf, int __modes, size_t __n);
extern int snprintf(char *__s, size_t __maxlen, const char *__format, ...);
extern int sprintf(char *__s, const char *__format, ...);
extern int sscanf(const char *__s, const char *__format, ...);
extern FILE *stderr;
extern FILE *stdin;
extern FILE *stdout;
extern char *tempnam(const char *__dir, const char *__pfx);
extern FILE *tmpfile(void);
extern FILE *tmpfile64(void);
extern char *tmpnam(char *__s);
extern int ungetc(int __c, FILE * __stream);
extern int vasprintf(char **__ptr, const char *__f, va_list __arg);
extern int vdprintf(int __fd, const char *__fmt, va_list __arg);
extern int vfprintf(FILE * __s, const char *__format, va_list __arg);
extern int vfscanf(FILE * __s, const char *__format, va_list __arg);
extern int vprintf(const char *__format, va_list __arg);
extern int vscanf(const char *__format, va_list __arg);
extern int vsnprintf(char *__s, size_t __maxlen, const char *__format,
		     va_list __arg);
extern int vsprintf(char *__s, const char *__format, va_list __arg);
extern int vsscanf(const char *__s, const char *__format, va_list __arg);

12.4.59. stdlib.h


#define MB_CUR_MAX	(__ctype_get_mb_cur_max())
#define EXIT_SUCCESS	0
#define EXIT_FAILURE	1
#define RAND_MAX	2147483647

struct drand48_data {
    unsigned short __x[3];
    unsigned short __old_x[3];
    unsigned short __c;
    unsigned short __init;
    unsigned long long int __a;
};
typedef int (*__compar_fn_t) (const void *, const void *);
struct random_data {
    int32_t *fptr;		/* Front pointer. */
    int32_t *rptr;		/* Rear pointer. */
    int32_t *state;		/* Array of state values. */
    int rand_type;		/* Type of random number generator. */
    int rand_deg;		/* Degree of random number generator. */
    int rand_sep;		/* Distance between front and rear. */
    int32_t *end_ptr;		/* Pointer behind state table. */
};

typedef struct {
    int quot;
    int rem;
} div_t;

typedef struct {
    long int quot;
    long int rem;
} ldiv_t;

typedef struct {
    long long int quot;
    long long int rem;
} lldiv_t;
extern void _Exit(int __status);
extern size_t __ctype_get_mb_cur_max(void);
extern size_t __mbstowcs_chk(wchar_t *, const char *, size_t, size_t);
extern char *__realpath_chk(const char *, char *, size_t);
extern double __strtod_internal(const char *, char **, int);
extern float __strtof_internal(const char *, char **, int);
extern long int __strtol_internal(const char *, char **, int, int);
extern long double __strtold_internal(const char *, char **, int);
extern long long int __strtoll_internal(const char *, char **, int, int);
extern unsigned long int __strtoul_internal(const char *, char **, int,
					    int);
extern unsigned long long int __strtoull_internal(const char *, char **,
						  int, int);
extern size_t __wcstombs_chk(char *, const wchar_t *, size_t, size_t);
extern int __wctomb_chk(char *, wchar_t, size_t);
extern long int a64l(const char *__s);
extern void abort(void);
extern int abs(int __x);
extern int atexit(void (*__func) (void));
extern double atof(const char *__nptr);
extern int atoi(const char *__nptr);
extern long int atol(const char *__nptr);
extern long long int atoll(const char *__nptr);
extern void *bsearch(const void *__key, const void *__base, size_t __nmemb,
		     size_t __size, __compar_fn_t __compar);
extern void *calloc(size_t __nmemb, size_t __size);
extern div_t div(int __numer, int __denom);
extern double drand48(void);
extern int drand48_r(struct drand48_data *__buffer, double *__result);
extern char *ecvt(double __value, int __ndigit, int *__decpt, int *__sign);
extern char **environ;
extern double erand48(unsigned short __xsubi[3]);
extern int erand48_r(unsigned short __xsubi[3],
		     struct drand48_data *__buffer, double *__result);
extern void exit(int __status);
extern char *fcvt(double __value, int __ndigit, int *__decpt, int *__sign);
extern void free(void *__ptr);
extern char *gcvt(double __value, int __ndigit, char *__buf);
extern char *getenv(const char *__name);
extern int getloadavg(double __loadavg[], int __nelem);
extern int getsubopt(char **__optionp, char *const *__tokens,
		     char **__valuep);
extern int grantpt(int __fd);
extern char *initstate(unsigned int __seed, char *__statebuf,
		       size_t __statelen);
extern int initstate_r(unsigned int __seed, char *__statebuf,
		       size_t __statelen, struct random_data *__buf);
extern long int jrand48(unsigned short __xsubi[3]);
extern int jrand48_r(unsigned short __xsubi[3],
		     struct drand48_data *__buffer, long int *__result);
extern char *l64a(long int __n);
extern long int labs(long int __x);
extern void lcong48(unsigned short __param[7]);
extern int lcong48_r(unsigned short __param[7],
		     struct drand48_data *__buffer);
extern ldiv_t ldiv(long int __numer, long int __denom);
extern long long int llabs(long long int __x);
extern lldiv_t lldiv(long long int __numer, long long int __denom);
extern long int lrand48(void);
extern int lrand48_r(struct drand48_data *__buffer, long int *__result);
extern void *malloc(size_t __size);
extern int mblen(const char *__s, size_t __n);
extern size_t mbstowcs(wchar_t * __pwcs, const char *__s, size_t __n);
extern int mbtowc(wchar_t * __pwc, const char *__s, size_t __n);
extern char *mkdtemp(char *__template);
extern int mkstemp64(char *__template);
extern char *mktemp(char *__template);
extern long int mrand48(void);
extern int mrand48_r(struct drand48_data *__buffer, long int *__result);
extern long int nrand48(unsigned short __xsubi[3]);
extern int nrand48_r(unsigned short __xsubi[3],
		     struct drand48_data *__buffer, long int *__result);
extern int posix_memalign(void **__memptr, size_t __alignment,
			  size_t __size);
extern int posix_openpt(int __oflag);
extern char *ptsname(int __fd);
extern int putenv(char *__string);
extern void qsort(void *__base, size_t __nmemb, size_t __size,
		  const __compar_fn_t __compar);
extern int rand(void);
extern int rand_r(unsigned int *__seed);
extern long int random(void);
extern int random_r(struct random_data *__buf, int32_t * __result);
extern void *realloc(void *__ptr, size_t __size);
extern char *realpath(const char *__name, char *__resolved);
extern unsigned short *seed48(unsigned short __seed16v[3]);
extern int seed48_r(unsigned short __seed16v[3],
		    struct drand48_data *__buffer);
extern int setenv(const char *__name, const char *__value, int __replace);
extern char *setstate(char *__statebuf);
extern int setstate_r(char *__statebuf, struct random_data *__buf);
extern void srand(unsigned int __seed);
extern void srand48(long int __seedval);
extern int srand48_r(long int __seedval, struct drand48_data *__buffer);
extern void srandom(unsigned int __seed);
extern int srandom_r(unsigned int __seed, struct random_data *__buf);
extern double strtod(const char *__nptr, char **__endptr);
extern float strtof(const char *__nptr, char **__endptr);
extern long int strtol(const char *__nptr, char **__endptr, int __base);
extern long double strtold(const char *__nptr, char **__endptr);
extern long long int strtoll(const char *__nptr, char **__endptr,
			     int __base);
extern long long int strtoq(const char *__nptr, char **__endptr,
			    int __base);
extern unsigned long int strtoul(const char *__nptr, char **__endptr,
				 int __base);
extern unsigned long long int strtoull(const char *__nptr, char **__endptr,
				       int __base);
extern unsigned long long int strtouq(const char *__nptr, char **__endptr,
				      int __base);
extern int system(const char *__command);
extern int unlockpt(int __fd);
extern int unsetenv(const char *__name);
extern size_t wcstombs(char *__s, const wchar_t * __pwcs, size_t __n);
extern int wctomb(char *__s, wchar_t __wchar);

12.4.60. string.h


#define strerror_r __xpg_strerror_r

extern void *__memcpy_chk(void *, const void *, size_t, size_t);
extern void *__memmove_chk(void *, const void *, size_t, size_t);
extern void *__mempcpy(void *__dest, const void *__src, size_t __n);
extern void *__mempcpy_chk(void *, const void *, size_t, size_t);
extern void *__memset_chk(void *, int, size_t, size_t);
extern char *__stpcpy(char *__dest, const char *__src);
extern char *__stpcpy_chk(char *, const char *, size_t);
extern char *__strcat_chk(char *, const char *, size_t);
extern char *__strcpy_chk(char *, const char *, size_t);
extern char *__strncat_chk(char *, const char *, size_t, size_t);
extern char *__strncpy_chk(char *, const char *, size_t, size_t);
extern char *__strtok_r(char *__s, const char *__delim, char **__save_ptr);
extern int __xpg_strerror_r(int, char *, size_t);
extern void *memccpy(void *__dest, const void *__src, int __c, size_t __n);
extern void *memchr(const void *__s, int __c, size_t __n);
extern int memcmp(const void *__s1, const void *__s2, size_t __n);
extern void *memcpy(void *__dest, const void *__src, size_t __n);
extern void *memmem(const void *__haystack, size_t __haystacklen,
		    const void *__needle, size_t __needlelen);
extern void *memmove(void *__dest, const void *__src, size_t __n);
extern void *memrchr(const void *__s, int __c, size_t __n);
extern void *memset(void *__s, int __c, size_t __n);
extern char *stpcpy(char *__dest, const char *__src);
extern char *stpncpy(char *__dest, const char *__src, size_t __n);
extern char *strcasestr(const char *__haystack, const char *__needle);
extern char *strcat(char *__dest, const char *__src);
extern char *strchr(const char *__s, int __c);
extern int strcmp(const char *__s1, const char *__s2);
extern int strcoll(const char *__s1, const char *__s2);
extern char *strcpy(char *__dest, const char *__src);
extern size_t strcspn(const char *__s, const char *__reject);
extern char *strdup(const char *__s);
extern char *strerror(int __errnum);
extern size_t strlen(const char *__s);
extern char *strncat(char *__dest, const char *__src, size_t __n);
extern int strncmp(const char *__s1, const char *__s2, size_t __n);
extern char *strncpy(char *__dest, const char *__src, size_t __n);
extern char *strndup(const char *__string, size_t __n);
extern size_t strnlen(const char *__string, size_t __maxlen);
extern char *strpbrk(const char *__s, const char *__accept);
extern char *strrchr(const char *__s, int __c);
extern char *strsep(char **__stringp, const char *__delim);
extern char *strsignal(int __sig);
extern size_t strspn(const char *__s, const char *__accept);
extern char *strstr(const char *__haystack, const char *__needle);
extern char *strtok(char *__s, const char *__delim);
extern char *strtok_r(char *__s, const char *__delim, char **__save_ptr);
extern size_t strxfrm(char *__dest, const char *__src, size_t __n);

12.4.61. strings.h


extern int bcmp(const void *__s1, const void *__s2, size_t __n);
extern void bcopy(const void *__src, void *__dest, size_t __n);
extern void bzero(void *__s, size_t __n);
extern int ffs(int __i);
extern char *index(const char *__s, int __c);
extern char *rindex(const char *__s, int __c);
extern int strcasecmp(const char *__s1, const char *__s2);
extern int strncasecmp(const char *__s1, const char *__s2, size_t __n);

12.4.62. sys/epoll.h


#define EPOLL_CTL_ADD	1	/* Add a file decriptor to the interface. */
#define EPOLL_CTL_DEL	2	/* Remove a file decriptor from the interface. */
#define EPOLL_CTL_MOD	3	/* Change file decriptor epoll_event structure. */
#define EPOLLIN	1
#define EPOLLPRI	2
#define EPOLLOUT	4
#define EPOLLERR	8
#define EPOLLHUP	16
#define EPOLLRDHUP	0x2000
#define EPOLLONESHOT	(1 << 30)
#define EPOLLET	(1 << 31)

typedef union epoll_data {
    void *ptr;
    int fd;
    uint32_t u32;
    uint64_t u64;
} epoll_data_t;

struct epoll_event {
    uint32_t events;
    epoll_data_t data;
};
extern int epoll_create(int __size);
extern int epoll_ctl(int __epfd, int __op, int __fd,
		     struct epoll_event *__event);
extern int epoll_wait(int __epfd, struct epoll_event *__events,
		      int __maxevents, int __timeout);

12.4.63. sys/file.h


#define LOCK_SH	1
#define LOCK_EX	2
#define LOCK_NB	4
#define LOCK_UN	8

extern int flock(int __fd, int __operation);

12.4.64. sys/inotify.h


#define IN_ACCESS	0x00000001
#define IN_MODIFY	0x00000002
#define IN_ATTRIB	0x00000004
#define IN_CLOSE_WRITE	0x00000008
#define IN_CLOSE_NOWRITE	0x00000010
#define IN_OPEN	0x00000020
#define IN_MOVED_FROM	0x00000040
#define IN_MOVED_TO	0x00000080
#define IN_CREATE	0x00000100
#define IN_DELETE	0x00000200
#define IN_DELETE_SELF	0x00000400
#define IN_MOVE_SELF	0x00000800
#define IN_UNMOUNT	0x00002000
#define IN_Q_OVERFLOW	0x00004000
#define IN_IGNORED	0x00008000
#define IN_ISDIR	0x40000000
#define IN_ONESHOT	0x80000000
#define IN_CLOSE	(IN_CLOSE_WRITE | IN_CLOSE_NOWRITE)
#define IN_MOVE	(IN_MOVED_FROM | IN_MOVED_TO)
#define IN_ALL_EVENTS	 \
   (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
  IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | IN_MOVED_TO | IN_CREATE | \
 IN_DELETE | IN_DELETE_SELF | IN_MOVE_SELF)

struct inotify_event {
    int wd;
    uint32_t mask;
    uint32_t cookie;
    uint32_t len;
    char name[];
};
extern int inotify_add_watch(int __fd, const char *__name,
			     uint32_t __mask);
extern int inotify_init(void);
extern int inotify_rm_watch(int __fd, int __wd);

12.4.65. sys/ioctl.h


struct winsize {
    unsigned short ws_row;	/* Rows, in characters. */
    unsigned short ws_col;	/* Columns, in characters. */
    unsigned short ws_xpixel;	/* Horizontal pixels. */
    unsigned short ws_ypixel;	/* Vertical pixels. */
};
extern int ioctl(int __fd, unsigned long int __request, ...);

12.4.66. sys/ipc.h


#define IPC_PRIVATE	((key_t)0)
#define IPC_RMID	0
#define IPC_CREAT	00001000
#define IPC_EXCL	00002000
#define IPC_NOWAIT	00004000
#define IPC_SET	1
#define IPC_STAT	2

extern key_t ftok(const char *__pathname, int __proj_id);

12.4.67. sys/mman.h


#define MAP_FAILED	((void*)-1)
#define POSIX_MADV_NORMAL	0
#define PROT_NONE	0x0
#define MAP_SHARED	0x01
#define MAP_PRIVATE	0x02
#define PROT_READ	0x1
#define MAP_FIXED	0x10
#define PROT_WRITE	0x2
#define MAP_ANONYMOUS	0x20
#define PROT_EXEC	0x4
#define MREMAP_MAYMOVE	1
#define MS_ASYNC	1
#define POSIX_MADV_RANDOM	1
#define MREMAP_FIXED	2
#define MS_INVALIDATE	2
#define POSIX_MADV_SEQUENTIAL	2
#define POSIX_MADV_WILLNEED	3
#define MS_SYNC	4
#define POSIX_MADV_DONTNEED	4
#define MAP_ANON	MAP_ANONYMOUS

extern int mlock(const void *__addr, size_t __len);
extern int mlockall(int __flags);
extern void *mmap(void *__addr, size_t __len, int __prot, int __flags,
		  int __fd, off_t __offset);
extern void *mmap64(void *__addr, size_t __len, int __prot, int __flags,
		    int __fd, off64_t __offset);
extern int mprotect(void *__addr, size_t __len, int __prot);
extern void *mremap(void *__addr, size_t __old_len, size_t __new_len,
		    int __flags, ...);
extern int msync(void *__addr, size_t __len, int __flags);
extern int munlock(const void *__addr, size_t __len);
extern int munlockall(void);
extern int munmap(void *__addr, size_t __len);
extern int posix_madvise(void *__addr, size_t __len, int __advice);
extern int shm_open(const char *__name, int __oflag, mode_t __mode);
extern int shm_unlink(const char *__name);

12.4.68. sys/msg.h


#define MSG_NOERROR	010000

extern int msgctl(int __msqid, int __cmd, struct msqid_ds *__buf);
extern int msgget(key_t __key, int __msgflg);
extern ssize_t msgrcv(int __msqid, void *__msgp, size_t __msgsz,
		      long int __msgtyp, int __msgflg);
extern int msgsnd(int __msqid, const void *__msgp, size_t __msgsz,
		  int __msgflg);

12.4.69. sys/param.h


#define NOFILE	256
#define MAXPATHLEN	4096

12.4.70. sys/poll.h


#define POLLIN	0x0001		/* There is data to read */
#define POLLPRI	0x0002		/* There is urgent data to read */
#define POLLOUT	0x0004		/* Writing now will not block */
#define POLLERR	0x0008		/* Error condition */
#define POLLHUP	0x0010		/* Hung up */
#define POLLNVAL	0x0020	/* Invalid request: fd not open */
#define POLLRDNORM	0x0040	/* Normal data may be read */
#define POLLRDBAND	0x0080	/* Priority data may be read */
#define POLLWRNORM	0x0100	/* Writing now will not block */
#define POLLWRBAND	0x0200	/* Priority data may be written */

struct pollfd {
    int fd;			/* File descriptor to poll. */
    short events;		/* Types of events poller cares about. */
    short revents;		/* Types of events that actually occurred. */
};
typedef unsigned long int nfds_t;

12.4.71. sys/ptrace.h


enum __ptrace_setoptions {
    PTRACE_O_TRACESYSGOOD = 0x00000001,
    PTRACE_O_TRACEFORK = 0x00000002,
    PTRACE_O_TRACEVFORK = 0x00000004,
    PTRACE_O_TRACECLONE = 0x00000008,
    PTRACE_O_TRACEEXEC = 0x00000010,
    PTRACE_O_TRACEVFORKDONE = 0x00000020,
    PTRACE_O_TRACEEXIT = 0x00000040,
    PTRACE_O_MASK = 0x0000007f
};
enum __ptrace_eventcodes {
    PTRACE_EVENT_FORK = 1,
    PTRACE_EVENT_VFORK = 2,
    PTRACE_EVENT_CLONE = 3,
    PTRACE_EVENT_EXEC = 4,
    PTRACE_EVENT_VFORK_DONE = 5,
    PTRACE_EVENT_EXIT = 6
};
extern long int ptrace(enum __ptrace_request, ...);

12.4.72. sys/resource.h


#define RUSAGE_CHILDREN	(-1)
#define RLIM_INFINITY	(~0UL)
#define RLIM_SAVED_CUR	-1
#define RLIM_SAVED_MAX	-1
#define RLIMIT_CPU	0
#define RUSAGE_SELF	0
#define RLIMIT_FSIZE	1
#define RLIMIT_LOCKS	10
#define RLIM_NLIMITS	11
#define RLIMIT_DATA	2
#define RLIMIT_STACK	3
#define RLIMIT_CORE	4
#define RLIMIT_RSS	5
#define RLIMIT_NPROC	6
#define RLIMIT_NOFILE	7
#define RLIMIT_MEMLOCK	8
#define RLIMIT_AS	9

typedef unsigned long int rlim_t;
typedef unsigned long long int rlim64_t;
typedef int __rlimit_resource_t;

struct rlimit {
    rlim_t rlim_cur;		/* The current (soft) limit. */
    rlim_t rlim_max;		/* The hard limit. */
};
struct rlimit64 {
    rlim64_t rlim_cur;		/* The current (soft) limit. */
    rlim64_t rlim_max;		/* The hard limit. */
};

struct rusage {
    struct timeval ru_utime;	/* Total amount of user time used. */
    struct timeval ru_stime;	/* Total amount of system time used. */
    long int ru_maxrss;		/* Maximum resident set size (in kilobytes). */
    long int ru_ixrss;		/* Amount of sharing of text segment memory        with other p */
    long int ru_idrss;		/* Amount of data segment memory used (kilobyte-seconds). */
    long int ru_isrss;		/* Amount of stack memory used (kilobyte-seconds). */
    long int ru_minflt;		/* Number of soft page faults (i.e. those serviced by reclaimin */
    long int ru_majflt;		/* Number of hard page faults (i.e. those that required I/O). */
    long int ru_nswap;		/* Number of times a process was swapped out of physical memory */
    long int ru_inblock;	/* Number of input operations via the file system.  Note: This */
    long int ru_oublock;	/* Number of output operations via the file system. */
    long int ru_msgsnd;		/* Number of IPC messages sent. */
    long int ru_msgrcv;		/* Number of IPC messages received. */
    long int ru_nsignals;	/* Number of signals delivered. */
    long int ru_nvcsw;		/* Number of voluntary context switches, i.e. because the proce */
    long int ru_nivcsw;		/* Number of involuntary context switches, i.e. a higher priori */
};

enum __priority_which {
    PRIO_PROCESS = 0,		/* WHO is a process ID. */
    PRIO_PGRP = 1,		/* WHO is a process group ID. */
    PRIO_USER = 2		/* WHO is a user ID. */
};

#define PRIO_PGRP	PRIO_PGRP
#define PRIO_PROCESS	PRIO_PROCESS
#define PRIO_USER	PRIO_USER

typedef enum __priority_which __priority_which_t;
extern int getpriority(__priority_which_t __which, id_t __who);
extern int getrlimit(__rlimit_resource_t __resource,
		     struct rlimit *__rlimits);
extern int getrlimit64(id_t __resource, struct rlimit64 *__rlimits);
extern int getrusage(int __who, struct rusage *__usage);
extern int setpriority(__priority_which_t __which, id_t __who, int __prio);
extern int setrlimit(__rlimit_resource_t __resource,
		     const struct rlimit *__rlimits);
extern int setrlimit64(__rlimit_resource_t __resource,
		       const struct rlimit64 *__rlimits);

12.4.73. sys/select.h


#define NFDBITS	(8 * sizeof (long))

extern int pselect(int __nfds, fd_set * __readfds, fd_set * __writefds,
		   fd_set * __exceptfds, const struct timespec *__timeout,
		   const sigset_t * __sigmask);

12.4.74. sys/sem.h


#define SEM_UNDO	0x1000
#define GETPID	11
#define GETVAL	12
#define GETALL	13
#define GETNCNT	14
#define GETZCNT	15
#define SETVAL	16
#define SETALL	17

struct sembuf {
    short sem_num;
    short sem_op;
    short sem_flg;
};
extern int semctl(int __semid, int __semnum, int __cmd, ...);
extern int semget(key_t __key, int __nsems, int __semflg);
extern int semop(int __semid, struct sembuf *__sops, size_t __nsops);

12.4.75. sys/sendfile.h


extern ssize_t sendfile(int __out_fd, int __in_fd, off_t * __offset,
			size_t __count);
extern ssize_t sendfile64(int __out_fd, int __in_fd, off64_t * __offset,
			  size_t __count);

12.4.76. sys/shm.h


#define SHM_RDONLY	010000
#define SHM_W	0200
#define SHM_RND	020000
#define SHM_R	0400
#define SHM_REMAP	040000
#define SHM_LOCK	11
#define SHM_UNLOCK	12

extern int __getpagesize(void);
extern void *shmat(int __shmid, const void *__shmaddr, int __shmflg);
extern int shmctl(int __shmid, int __cmd, struct shmid_ds *__buf);
extern int shmdt(const void *__shmaddr);
extern int shmget(key_t __key, size_t __size, int __shmflg);

12.4.77. sys/socket.h


#define CMSG_FIRSTHDR(msg)	((size_t) (msg)->msg_controllen >= sizeof(struct cmsghdr) ? (struct cmsghdr *)(msg)->msg_control : (struct cmsghdr *) NULL)
#define CMSG_LEN(len)	(CMSG_ALIGN(sizeof(struct cmsghdr))+(len))
#define SCM_RIGHTS	0x01
#define SOL_SOCKET	1
#define SOMAXCONN	128
#define SOL_RAW	255
#define CMSG_ALIGN(len)	\
	(((len)+sizeof(size_t)-1)&(size_t)~(sizeof(size_t)-1))
#define CMSG_DATA(cmsg)	\
	((unsigned char *) (cmsg) + CMSG_ALIGN(sizeof(struct cmsghdr)))
#define CMSG_SPACE(len)	\
	(CMSG_ALIGN(sizeof(struct cmsghdr))+CMSG_ALIGN(len))
#define CMSG_NXTHDR(mhdr,cmsg)	\
        (((cmsg) == NULL) ? CMSG_FIRSTHDR(mhdr) : \
         (((u_char *)(cmsg) + CMSG_ALIGN((cmsg)->cmsg_len) \
                            + CMSG_ALIGN(sizeof(struct cmsghdr)) > \
           (u_char *)((mhdr)->msg_control) + (mhdr)->msg_controllen) ? \
          (struct cmsghdr *)NULL : \
          (struct cmsghdr *)((u_char *)(cmsg) + CMSG_ALIGN((cmsg)->cmsg_len))))

struct linger {
    int l_onoff;
    int l_linger;
};
struct cmsghdr {
    size_t cmsg_len;
    int cmsg_level;
    int cmsg_type;
};
struct iovec {
    void *iov_base;
    size_t iov_len;
};

typedef unsigned short sa_family_t;
typedef unsigned int socklen_t;

struct sockaddr {
    sa_family_t sa_family;
    char sa_data[14];
};
struct sockaddr_storage {
    sa_family_t ss_family;
    __ss_aligntype __ss_align;
    char __ss_padding[(128 - (2 * sizeof(__ss_aligntype)))];
};

struct msghdr {
    void *msg_name;
    int msg_namelen;
    struct iovec *msg_iov;
    size_t msg_iovlen;
    void *msg_control;
    size_t msg_controllen;
    unsigned int msg_flags;
};

#define AF_UNSPEC	0
#define AF_UNIX	1
#define AF_INET6	10
#define AF_INET	2

#define PF_INET	AF_INET
#define PF_INET6	AF_INET6
#define PF_UNIX	AF_UNIX
#define PF_UNSPEC	AF_UNSPEC

#define SOCK_STREAM	1
#define SOCK_PACKET	10
#define SOCK_DGRAM	2
#define SOCK_RAW	3
#define SOCK_RDM	4
#define SOCK_SEQPACKET	5

#define SO_DEBUG	1
#define SO_OOBINLINE	10
#define SO_NO_CHECK	11
#define SO_PRIORITY	12
#define SO_LINGER	13
#define SO_BSDCOMPAT	14
#define SO_REUSEADDR	2
#define SO_TYPE	3
#define SO_ACCEPTCONN	30
#define SO_ERROR	4
#define SO_DONTROUTE	5
#define SO_BROADCAST	6
#define SO_SNDBUF	7
#define SO_RCVBUF	8
#define SO_KEEPALIVE	9

#define SIOCGIFNAME	0x8910
#define SIOCGIFCONF	0x8912
#define SIOCGIFFLAGS	0x8913
#define SIOCGIFADDR	0x8915
#define SIOCGIFDSTADDR	0x8917
#define SIOCGIFBRDADDR	0x8919
#define SIOCGIFNETMASK	0x891b
#define SIOCGIFMTU	0x8921
#define SIOCGIFHWADDR	0x8927

#define SHUT_RD	0
#define SHUT_WR	1
#define SHUT_RDWR	2

#define MSG_WAITALL	0x100
#define MSG_TRUNC	0x20
#define MSG_NOSIGNAL	0x4000
#define MSG_EOR	0x80
#define MSG_OOB	1
#define MSG_PEEK	2
#define MSG_DONTROUTE	4
#define MSG_CTRUNC	8

extern ssize_t __recv_chk(int, void *, size_t, size_t, int);
extern ssize_t __recvfrom_chk(int, void *, size_t, size_t, int,
			      struct sockaddr *, socklen_t *);
extern int accept(int __fd, struct sockaddr *__addr,
		  socklen_t * __addr_len);
extern int bind(int __fd, const struct sockaddr *__addr, socklen_t __len);
extern int connect(int __fd, const struct sockaddr *__addr,
		   socklen_t __len);
extern int getnameinfo(const struct sockaddr *__sa, socklen_t __salen,
		       char *__host, socklen_t __hostlen, char *__serv,
		       socklen_t __servlen, unsigned int __flags);
extern int getpeername(int __fd, struct sockaddr *__addr,
		       socklen_t * __len);
extern int getsockname(int __fd, struct sockaddr *__addr,
		       socklen_t * __len);
extern int getsockopt(int __fd, int __level, int __optname, void *__optval,
		      socklen_t * __optlen);
extern int listen(int __fd, int __n);
extern ssize_t recv(int __fd, void *__buf, size_t __n, int __flags);
extern ssize_t recvfrom(int __fd, void *__buf, size_t __n, int __flags,
			struct sockaddr *__addr, socklen_t * __addr_len);
extern ssize_t recvmsg(int __fd, struct msghdr *__message, int __flags);
extern ssize_t send(int __fd, const void *__buf, size_t __n, int __flags);
extern ssize_t sendmsg(int __fd, const struct msghdr *__message,
		       int __flags);
extern ssize_t sendto(int __fd, const void *__buf, size_t __n, int __flags,
		      const struct sockaddr *__addr, socklen_t __addr_len);
extern int setsockopt(int __fd, int __level, int __optname,
		      const void *__optval, socklen_t __optlen);
extern int shutdown(int __fd, int __how);
extern int sockatmark(int __fd);
extern int socket(int __domain, int __type, int __protocol);
extern int socketpair(int __domain, int __type, int __protocol,
		      int __fds[2]);

12.4.78. sys/stat.h


#define S_ISBLK(m)	(((m)&S_IFMT)==S_IFBLK)
#define S_ISCHR(m)	(((m)&S_IFMT)==S_IFCHR)
#define S_ISDIR(m)	(((m)&S_IFMT)==S_IFDIR)
#define S_ISFIFO(m)	(((m)&S_IFMT)==S_IFIFO)
#define S_ISLNK(m)	(((m)&S_IFMT)==S_IFLNK)
#define S_ISREG(m)	(((m)&S_IFMT)==S_IFREG)
#define S_ISSOCK(m)	(((m)&S_IFMT)==S_IFSOCK)
#define S_TYPEISMQ(buf)	((buf)->st_mode - (buf)->st_mode)
#define S_TYPEISSEM(buf)	((buf)->st_mode - (buf)->st_mode)
#define S_TYPEISSHM(buf)	((buf)->st_mode - (buf)->st_mode)
#define S_IRWXU	(S_IREAD|S_IWRITE|S_IEXEC)
#define S_IROTH	(S_IRGRP>>3)
#define S_IRGRP	(S_IRUSR>>3)
#define S_IRWXO	(S_IRWXG>>3)
#define S_IRWXG	(S_IRWXU>>3)
#define S_IWOTH	(S_IWGRP>>3)
#define S_IWGRP	(S_IWUSR>>3)
#define S_IXOTH	(S_IXGRP>>3)
#define S_IXGRP	(S_IXUSR>>3)
#define S_ISVTX	01000
#define S_IXUSR	0x0040
#define S_IWUSR	0x0080
#define S_IRUSR	0x0100
#define S_ISGID	0x0400
#define S_ISUID	0x0800
#define S_IFIFO	0x1000
#define S_IFCHR	0x2000
#define S_IFDIR	0x4000
#define S_IFBLK	0x6000
#define S_IFREG	0x8000
#define S_IFLNK	0xa000
#define S_IFSOCK	0xc000
#define S_IFMT	0xf000
#define st_atime	st_atim.tv_sec
#define st_ctime	st_ctim.tv_sec
#define st_mtime	st_mtim.tv_sec
#define S_IREAD	S_IRUSR
#define S_IWRITE	S_IWUSR
#define S_IEXEC	S_IXUSR

extern int __fxstat(int __ver, int __fildes, struct stat *__stat_buf);
extern int __fxstat64(int __ver, int __fildes, struct stat64 *__stat_buf);
extern int __fxstatat(int __ver, int __fildes, const char *__filename,
		      struct stat *__stat_buf, int __flag);
extern int __fxstatat64(int __ver, int __fildes, const char *__filename,
			struct stat64 *__stat_buf, int __flag);
extern int __lxstat(int __ver, const char *__filename,
		    struct stat *__stat_buf);
extern int __lxstat64(int __ver, const char *__filename,
		      struct stat64 *__stat_buf);
extern int __xmknod(int __ver, const char *__path, mode_t __mode,
		    dev_t * __dev);
extern int __xmknodat(int __ver, int __fd, const char *__path,
		      mode_t __mode, dev_t * __dev);
extern int __xstat(int __ver, const char *__filename,
		   struct stat *__stat_buf);
extern int __xstat64(int __ver, const char *__filename,
		     struct stat64 *__stat_buf);
extern int chmod(const char *__file, mode_t __mode);
extern int fchmod(int __fd, mode_t __mode);
extern int fchmodat(int __fd, const char *__file, mode_t mode, int __flag);
extern int fstat(int __fd, struct stat *__buf);
extern int fstat64(int __fd, struct stat64 *__buf);
extern int fstatat(int __fd, const char *__file, struct stat *__buf,
		   int __flag);
extern int fstatat64(int __fd, const char *__file, struct stat64 *__buf,
		     int __flag);
extern int lstat(const char *__file, struct stat *__buf);
extern int lstat64(const char *__file, struct stat64 *__buf);
extern int mkdir(const char *__path, mode_t __mode);
extern int mkdirat(int __fd, const char *__path, mode_t __mode);
extern int mkfifo(const char *__path, mode_t __mode);
extern int mkfifoat(int __fd, const char *__path, mode_t __mode);
extern int mknod(const char *__path, mode_t __mode, dev_t __dev);
extern int mknodat(int __fd, const char *__path, mode_t __mode,
		   dev_t __dev);
extern int stat(const char *__file, struct stat *__buf);
extern int stat64(const char *__file, struct stat64 *__buf);
extern mode_t umask(mode_t __mask);

12.4.79. sys/statfs.h


#define NFS_SUPER_MAGIC	0x6969

extern int fstatfs(int __fildes, struct statfs *__buf);
extern int fstatfs64(int __fildes, struct statfs64 *__buf);
extern int statfs(const char *__file, struct statfs *__buf);
extern int statfs64(const char *__file, struct statfs64 *__buf);

12.4.80. sys/statvfs.h


extern int fstatvfs(int __fildes, struct statvfs *__buf);
extern int fstatvfs64(int __fildes, struct statvfs64 *__buf);
extern int statvfs(const char *__file, struct statvfs *__buf);
extern int statvfs64(const char *__file, struct statvfs64 *__buf);

12.4.81. sys/sysinfo.h


struct sysinfo {
    long int uptime;		/* Seconds since boot */
    unsigned long int loads[3];	/* 1, 5, and 15 minute load averages */
    unsigned long int totalram;	/* Total usable main memory size */
    unsigned long int freeram;	/* Available memory size */
    unsigned long int sharedram;	/* Amount of shared memory */
    unsigned long int bufferram;	/* Memory used by buffers */
    unsigned long int totalswap;	/* Total swap space size */
    unsigned long int freeswap;	/* Swap space still available */
    unsigned short procs;	/* Number of current processes */
    unsigned short pad;		/* Padding for m68k */
    unsigned long int totalhigh;	/* Total high memory size */
    unsigned long int freehigh;	/* Available high memory size */
    unsigned int mem_unit;	/* Memory unit size in bytes */
    char _f[20 - 2 * sizeof(long) - sizeof(int)];	/* Padding for libc5 */
};
extern int sysinfo(struct sysinfo *info);

12.4.82. sys/time.h


#define ITIMER_REAL	0
#define ITIMER_VIRTUAL	1
#define ITIMER_PROF	2

struct timezone {
    int tz_minuteswest;
    int tz_dsttime;
};

typedef int __itimer_which_t;

struct timespec {
    time_t tv_sec;
    long int tv_nsec;
};

struct timeval {
    time_t tv_sec;
    suseconds_t tv_usec;
};

struct itimerval {
    struct timeval it_interval;
    struct timeval it_value;
};
extern int adjtime(const struct timeval *__delta,
		   struct timeval *__olddelta);
extern int getitimer(__itimer_which_t __which, struct itimerval *__value);
extern int gettimeofday(struct timeval *__tv, struct timezone *__tz);
extern int setitimer(__itimer_which_t __which,
		     const struct itimerval *__new,
		     struct itimerval *__old);
extern int utimes(const char *__file, const struct timeval *__tvp);

12.4.83. sys/timeb.h


struct timeb {
    time_t time;		/* Seconds since epoch, as from time. */
    unsigned short millitm;	/* Additional milliseconds. */
    short timezone;		/* Minutes west of GMT. */
    short dstflag;		/* Nonzero if Daylight Savings Time used. */
};
extern int ftime(struct timeb *__timebuf);

12.4.84. sys/times.h


struct tms {
    clock_t tms_utime;
    clock_t tms_stime;
    clock_t tms_cutime;
    clock_t tms_cstime;
};
extern clock_t times(struct tms *__buffer);

12.4.85. sys/types.h


#ifndef FALSE
#define FALSE	0
#endif
#ifndef TRUE
#define TRUE	1
#endif
#define FD_SETSIZE	1024
#define FD_ZERO(fdsetp)	bzero(fdsetp, sizeof(*(fdsetp)))
#define FD_ISSET(d,set)	\
  (((set)->fds_bits[((d)/(8*sizeof(long)))]&(1L<<((d)%(8*sizeof(long)))))!=0)
#define FD_CLR(d,set)	\
  ((set)->fds_bits[((d)/(8*sizeof(long)))]&=~(1L<<((d)%(8*sizeof(long)))))
#define FD_SET(d,set)	\
  ((set)->fds_bits[((d)/(8*sizeof(long)))]|=(1L<<((d)%(8*sizeof(long)))))

typedef unsigned char u_int8_t;
typedef unsigned short u_int16_t;
typedef unsigned int u_int32_t;
typedef unsigned long long int u_int64_t;
typedef unsigned int uid_t;
typedef int pid_t;
typedef long int off_t;
typedef int key_t;
typedef long int suseconds_t;
typedef unsigned int u_int;
typedef struct {
    int __val[2];
} fsid_t;
typedef unsigned int useconds_t;
typedef long int blksize_t;
typedef long int fd_mask;
typedef void *timer_t;
typedef int clockid_t;

typedef unsigned int id_t;

typedef unsigned long long int ino64_t;
typedef long long int loff_t;
typedef long int blkcnt_t;
typedef unsigned long int fsblkcnt_t;
typedef unsigned long int fsfilcnt_t;
typedef long long int blkcnt64_t;
typedef unsigned long long int fsblkcnt64_t;
typedef unsigned long long int fsfilcnt64_t;
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned long int u_long;

typedef unsigned long int ino_t;
typedef unsigned int gid_t;
typedef unsigned long long int dev_t;
typedef unsigned int mode_t;
typedef unsigned long int nlink_t;
typedef char *caddr_t;

typedef struct {
    unsigned long int fds_bits[__FDSET_LONGS];
} fd_set;

typedef long int clock_t;
typedef long int time_t;

12.4.86. sys/uio.h


extern ssize_t readv(int __fd, const struct iovec *__iovec, int __count);
extern ssize_t writev(int __fd, const struct iovec *__iovec, int __count);

12.4.87. sys/un.h


#define UNIX_PATH_MAX	108

struct sockaddr_un {
    sa_family_t sun_family;	/* AF_UNIX */
    char sun_path[UNIX_PATH_MAX];
};

12.4.88. sys/utsname.h


#define SYS_NMLN	65

struct utsname {
    char sysname[65];
    char nodename[65];
    char release[65];
    char version[65];
    char machine[65];
    char domainname[65];
};
extern int uname(struct utsname *__name);

12.4.89. sys/wait.h


#define WIFSIGNALED(status)	(!WIFSTOPPED(status) && !WIFEXITED(status))
#define WIFSTOPPED(status)	(((status) & 0xff) == 0x7f)
#define WEXITSTATUS(status)	(((status) & 0xff00) >> 8)
#define WTERMSIG(status)	((status) & 0x7f)
#define WCOREDUMP(status)	((status) & 0x80)
#define WIFEXITED(status)	(WTERMSIG(status) == 0)
#define WNOHANG	0x00000001
#define WUNTRACED	0x00000002
#define WCOREFLAG	0x80
#define WSTOPSIG(status)	WEXITSTATUS(status)

typedef enum {
    P_ALL,
    P_PID,
    P_PGID
} idtype_t;
extern pid_t wait(int *__stat_loc);
extern pid_t wait4(pid_t __pid, int *__stat_loc, int __options,
		   struct rusage *__usage);
extern int waitid(idtype_t __idtype, id_t __id, siginfo_t * __infop,
		  int __options);
extern pid_t waitpid(pid_t __pid, int *__stat_loc, int __options);

12.4.90. syslog.h


#define LOG_MAKEPRI(fac, pri)	(((fac) << 3) | (pri))
#define LOG_PRI(p)	((p) & LOG_PRIMASK)	/* extract priority */
#define LOG_EMERG	0	/* system is unusable */
#define LOG_PRIMASK	0x07	/* mask to extract priority part */
#define LOG_ALERT	1	/* action must be taken immediately */
#define LOG_CRIT	2	/* critical conditions */
#define LOG_ERR	3		/* error conditions */
#define LOG_WARNING	4	/* warning conditions */
#define LOG_NOTICE	5	/* normal but significant condition */
#define LOG_INFO	6	/* informational */
#define LOG_DEBUG	7	/* debug-level messages */

#define LOG_FAC(p)	(((p) & LOG_FACMASK) >> 3)	/* facility of pri */
#define LOG_KERN	(0<<3)	/* kernel messages */
#define LOG_AUTHPRIV	(10<<3)	/* security/authorization messages (private) */
#define LOG_FTP	(11<<3)		/* ftp daemon */
#define LOG_USER	(1<<3)	/* random user-level messages */
#define LOG_MAIL	(2<<3)	/* mail system */
#define LOG_DAEMON	(3<<3)	/* system daemons */
#define LOG_AUTH	(4<<3)	/* security/authorization messages */
#define LOG_SYSLOG	(5<<3)	/* messages generated internally by syslogd */
#define LOG_LPR	(6<<3)		/* line printer subsystem */
#define LOG_NEWS	(7<<3)	/* network news subsystem */
#define LOG_UUCP	(8<<3)	/* UUCP subsystem */
#define LOG_CRON	(9<<3)	/* clock daemon */
#define LOG_FACMASK	0x03f8	/* mask to extract facility part */

#define LOG_LOCAL0	(16<<3)	/* reserved for local use */
#define LOG_LOCAL1	(17<<3)	/* reserved for local use */
#define LOG_LOCAL2	(18<<3)	/* reserved for local use */
#define LOG_LOCAL3	(19<<3)	/* reserved for local use */
#define LOG_LOCAL4	(20<<3)	/* reserved for local use */
#define LOG_LOCAL5	(21<<3)	/* reserved for local use */
#define LOG_LOCAL6	(22<<3)	/* reserved for local use */
#define LOG_LOCAL7	(23<<3)	/* reserved for local use */

#define LOG_UPTO(pri)	((1 << ((pri)+1)) - 1)	/* all priorities through pri */
#define LOG_MASK(pri)	(1 << (pri))	/* mask for one priority */

#define LOG_PID	0x01		/* log the pid with each message */
#define LOG_CONS	0x02	/* log on the console if errors in sending */
#define LOG_ODELAY	0x04	/* delay open until first syslog() (default) */
#define LOG_NDELAY	0x08	/* don't delay open */
#define LOG_NOWAIT	0x10	/* don't wait for console forks: DEPRECATED */
#define LOG_PERROR	0x20	/* log to stderr as well */

extern void __syslog_chk(int, int, const char *, ...);
extern void __vsyslog_chk(int, int, const char *, va_list);
extern void closelog(void);
extern void openlog(const char *__ident, int __option, int __facility);
extern int setlogmask(int __mask);
extern void syslog(int __pri, const char *__fmt, ...);
extern void vsyslog(int __pri, const char *__fmt, va_list __ap);

12.4.91. tar.h


#define REGTYPE	'0'
#define LNKTYPE	'1'
#define SYMTYPE	'2'
#define CHRTYPE	'3'
#define BLKTYPE	'4'
#define DIRTYPE	'5'
#define FIFOTYPE	'6'
#define CONTTYPE	'7'
#define AREGTYPE	'\0'
#define TVERSION	"00"
#define TOEXEC	00001
#define TOWRITE	00002
#define TOREAD	00004
#define TGEXEC	00010
#define TGWRITE	00020
#define TGREAD	00040
#define TUEXEC	00100
#define TUWRITE	00200
#define TUREAD	00400
#define TSVTX	01000
#define TSGID	02000
#define TSUID	04000
#define TVERSLEN	2
#define TMAGLEN	6
#define TMAGIC	"ustar"

12.4.92. termios.h


#define TCIFLUSH	0
#define TCOOFF	0
#define TCSANOW	0
#define BS0	0000000
#define CR0	0000000
#define FF0	0000000
#define NL0	0000000
#define TAB0	0000000
#define VT0	0000000
#define OPOST	0000001
#define OCRNL	0000010
#define ONOCR	0000020
#define ONLRET	0000040
#define OFILL	0000100
#define OFDEL	0000200
#define NL1	0000400
#define TCOFLUSH	1
#define TCOON	1
#define TCSADRAIN	1
#define TCIOFF	2
#define TCIOFLUSH	2
#define TCSAFLUSH	2
#define TCION	3

typedef unsigned int speed_t;
typedef unsigned char cc_t;
typedef unsigned int tcflag_t;

#define NCCS	32

struct termios {
    tcflag_t c_iflag;		/* input mode flags */
    tcflag_t c_oflag;		/* output mode flags */
    tcflag_t c_cflag;		/* control mode flags */
    tcflag_t c_lflag;		/* local mode flags */
    cc_t c_line;		/* line discipline */
    cc_t c_cc[NCCS];		/* control characters */
    speed_t c_ispeed;		/* input speed */
    speed_t c_ospeed;		/* output speed */
};

#define VINTR	0
#define VQUIT	1
#define VLNEXT	15
#define VERASE	2
#define VKILL	3
#define VEOF	4

#define IGNBRK	0000001
#define BRKINT	0000002
#define IGNPAR	0000004
#define PARMRK	0000010
#define INPCK	0000020
#define ISTRIP	0000040
#define INLCR	0000100
#define IGNCR	0000200
#define ICRNL	0000400
#define IXANY	0004000
#define IMAXBEL	0020000

#define CS5	0000000

#define ECHO	0000010

#define B0	0000000
#define B50	0000001
#define B75	0000002
#define B110	0000003
#define B134	0000004
#define B150	0000005
#define B200	0000006
#define B300	0000007
#define B600	0000010
#define B1200	0000011
#define B1800	0000012
#define B2400	0000013
#define B4800	0000014
#define B9600	0000015
#define B19200	0000016
#define B38400	0000017

extern speed_t cfgetispeed(const struct termios *__termios_p);
extern speed_t cfgetospeed(const struct termios *__termios_p);
extern void cfmakeraw(struct termios *__termios_p);
extern int cfsetispeed(struct termios *__termios_p, speed_t __speed);
extern int cfsetospeed(struct termios *__termios_p, speed_t __speed);
extern int cfsetspeed(struct termios *__termios_p, speed_t __speed);
extern int tcdrain(int __fd);
extern int tcflow(int __fd, int __action);
extern int tcflush(int __fd, int __queue_selector);
extern int tcgetattr(int __fd, struct termios *__termios_p);
extern pid_t tcgetsid(int __fd);
extern int tcsendbreak(int __fd, int __duration);
extern int tcsetattr(int __fd, int __optional_actions,
		     const struct termios *__termios_p);

12.4.93. time.h


#define CLK_TCK	((clock_t)sysconf(2))
#define timerclear(tvp)	((tvp)->tv_sec = (tvp)->tv_usec = 0)
#define timerisset(tvp)	((tvp)->tv_sec || (tvp)->tv_usec)
#define CLOCK_REALTIME	0
#define CLOCK_MONOTONIC	1
#define TIMER_ABSTIME	1
#define CLOCKS_PER_SEC	1000000l
#define CLOCK_PROCESS_CPUTIME_ID	2
#define CLOCK_THREAD_CPUTIME_ID	3
#define timeradd(a,b,result)	\
  do { \
    (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \
    (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
    if ((result)->tv_usec >= 1000000) \
      { \
        ++(result)->tv_sec; \
        (result)->tv_usec -= 1000000; \
      } \
  } while (0)
#define timersub(a,b,result)	\
  do { \
    (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \
    (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \
    if ((result)->tv_usec < 0) { \
      --(result)->tv_sec; \
      (result)->tv_usec += 1000000; \
    } \
  } while (0)
#define timercmp(a,b,CMP)	\
 (((a)->tv_sec == (b)->tv_sec) ? \
  ((a)->tv_usec CMP (b)->tv_usec) : \
  ((a)->tv_sec CMP (b)->tv_sec))

struct tm {
    int tm_sec;
    int tm_min;
    int tm_hour;
    int tm_mday;
    int tm_mon;
    int tm_year;
    int tm_wday;
    int tm_yday;
    int tm_isdst;
    long int tm_gmtoff;
    char *tm_zone;
};
struct itimerspec {
    struct timespec it_interval;
    struct timespec it_value;
};

extern int __daylight;
extern long int __timezone;
extern char *__tzname[];
extern char *asctime(const struct tm *__tp);
extern char *asctime_r(const struct tm *__tp, char *__buf);
extern clock_t clock(void);
extern int clock_getcpuclockid(pid_t __pid, clockid_t * __clock_id);
extern int clock_getres(clockid_t __clock_id, struct timespec *__res);
extern int clock_gettime(clockid_t __clock_id, struct timespec *__tp);
extern int clock_nanosleep(clockid_t __clock_id, int __flags,
			   const struct timespec *__req,
			   struct timespec *__rem);
extern int clock_settime(clockid_t __clock_id,
			 const struct timespec *__tp);
extern char *ctime(const time_t * __timer);
extern char *ctime_r(const time_t * __timer, char *__buf);
extern int daylight;
extern double difftime(time_t __time1, time_t __time0);
extern struct tm *getdate(const char *__string);
extern int getdate_err;
extern struct tm *gmtime(const time_t * __timer);
extern struct tm *gmtime_r(const time_t * __timer, struct tm *__tp);
extern struct tm *localtime(const time_t * __timer);
extern struct tm *localtime_r(const time_t * __timer, struct tm *__tp);
extern time_t mktime(struct tm *__tp);
extern int nanosleep(const struct timespec *__requested_time,
		     struct timespec *__remaining);
extern int stime(const time_t * __when);
extern size_t strftime(char *__s, size_t __maxsize, const char *__format,
		       const struct tm *__tp);
extern char *strptime(const char *__s, const char *__fmt, struct tm *__tp);
extern time_t time(time_t * __timer);
extern int timer_create(clockid_t __clock_id, struct sigevent *__evp,
			timer_t * __timerid);
extern int timer_delete(timer_t __timerid);
extern int timer_getoverrun(timer_t __timerid);
extern int timer_gettime(timer_t __timerid, struct itimerspec *__value);
extern int timer_settime(timer_t __timerid, int __flags,
			 const struct itimerspec *__value,
			 struct itimerspec *__ovalue);
extern long int timezone;
extern char *tzname[];
extern void tzset(void);

12.4.94. ucontext.h


extern int getcontext(ucontext_t * __ucp);
extern void makecontext(ucontext_t * __ucp, void (*__func) (void),
			int __argc, ...);
extern int setcontext(const struct ucontext *__ucp);
extern int swapcontext(ucontext_t * __oucp, const struct ucontext *__ucp);

12.4.95. ulimit.h


#define UL_GETFSIZE	1
#define UL_SETFSIZE	2

extern long int ulimit(int __cmd, ...);

12.4.96. unistd.h


#define SEEK_SET	0
#define STDIN_FILENO	0
#define SEEK_CUR	1
#define STDOUT_FILENO	1
#define SEEK_END	2
#define STDERR_FILENO	2

typedef long long int off64_t;

#define F_OK	0
#define X_OK	1
#define W_OK	2
#define R_OK	4

#define _POSIX_VDISABLE	'\0'
#define _POSIX_CHOWN_RESTRICTED	1
#define _POSIX_JOB_CONTROL	1
#define _POSIX_NO_TRUNC	1
#define _POSIX_SHELL	1
#define _POSIX2_C_BIND	200112L
#define _POSIX2_VERSION	200112L
#define _POSIX_FSYNC	200112L
#define _POSIX_MAPPED_FILES	200112L
#define _POSIX_MEMLOCK	200112L
#define _POSIX_MEMLOCK_RANGE	200112L
#define _POSIX_MEMORY_PROTECTION	200112L
#define _POSIX_SEMAPHORES	200112L
#define _POSIX_SHARED_MEMORY_OBJECTS	200112L
#define _POSIX_THREADS	200112L
#define _POSIX_THREAD_PROCESS_SHARED	200112L
#define _POSIX_TIMERS	200112L
#define _POSIX_VERSION	200112L

#define _PC_LINK_MAX	0
#define _PC_MAX_CANON	1
#define _PC_ASYNC_IO	10
#define _PC_PRIO_IO	11
#define _PC_FILESIZEBITS	13
#define _PC_REC_INCR_XFER_SIZE	14
#define _PC_REC_MIN_XFER_SIZE	16
#define _PC_REC_XFER_ALIGN	17
#define _PC_ALLOC_SIZE_MIN	18
#define _PC_MAX_INPUT	2
#define _PC_2_SYMLINKS	20
#define _PC_NAME_MAX	3
#define _PC_PATH_MAX	4
#define _PC_PIPE_BUF	5
#define _PC_CHOWN_RESTRICTED	6
#define _PC_NO_TRUNC	7
#define _PC_VDISABLE	8
#define _PC_SYNC_IO	9

#define _SC_ARG_MAX	0
#define _SC_CHILD_MAX	1
#define _SC_PRIORITY_SCHEDULING	10
#define _SC_XOPEN_XPG4	100
#define _SC_CHAR_BIT	101
#define _SC_CHAR_MAX	102
#define _SC_CHAR_MIN	103
#define _SC_INT_MAX	104
#define _SC_INT_MIN	105
#define _SC_LONG_BIT	106
#define _SC_WORD_BIT	107
#define _SC_MB_LEN_MAX	108
#define _SC_NZERO	109
#define _SC_TIMERS	11
#define _SC_SSIZE_MAX	110
#define _SC_SCHAR_MAX	111
#define _SC_SCHAR_MIN	112
#define _SC_SHRT_MAX	113
#define _SC_SHRT_MIN	114
#define _SC_UCHAR_MAX	115
#define _SC_UINT_MAX	116
#define _SC_ULONG_MAX	117
#define _SC_USHRT_MAX	118
#define _SC_NL_ARGMAX	119
#define _SC_ASYNCHRONOUS_IO	12
#define _SC_NL_LANGMAX	120
#define _SC_NL_MSGMAX	121
#define _SC_NL_NMAX	122
#define _SC_NL_SETMAX	123
#define _SC_NL_TEXTMAX	124
#define _SC_XBS5_ILP32_OFF32	125
#define _SC_XBS5_ILP32_OFFBIG	126
#define _SC_XBS5_LP64_OFF64	127
#define _SC_XBS5_LPBIG_OFFBIG	128
#define _SC_XOPEN_LEGACY	129
#define _SC_PRIORITIZED_IO	13
#define _SC_XOPEN_REALTIME	130
#define _SC_XOPEN_REALTIME_THREADS	131
#define _SC_ADVISORY_INFO	132
#define _SC_BARRIERS	133
#define _SC_BASE	134
#define _SC_C_LANG_SUPPORT	135
#define _SC_C_LANG_SUPPORT_R	136
#define _SC_CLOCK_SELECTION	137
#define _SC_CPUTIME	138
#define _SC_THREAD_CPUTIME	139
#define _SC_SYNCHRONIZED_IO	14
#define _SC_DEVICE_IO	140
#define _SC_DEVICE_SPECIFIC	141
#define _SC_DEVICE_SPECIFIC_R	142
#define _SC_FD_MGMT	143
#define _SC_FIFO	144
#define _SC_PIPE	145
#define _SC_FILE_ATTRIBUTES	146
#define _SC_FILE_LOCKING	147
#define _SC_FILE_SYSTEM	148
#define _SC_MONOTONIC_CLOCK	149
#define _SC_FSYNC	15
#define _SC_MULTI_PROCESS	150
#define _SC_SINGLE_PROCESS	151
#define _SC_NETWORKING	152
#define _SC_READER_WRITER_LOCKS	153
#define _SC_SPIN_LOCKS	154
#define _SC_REGEXP	155
#define _SC_REGEX_VERSION	156
#define _SC_SHELL	157
#define _SC_SIGNALS	158
#define _SC_SPAWN	159
#define _SC_MAPPED_FILES	16
#define _SC_SPORADIC_SERVER	160
#define _SC_THREAD_SPORADIC_SERVER	161
#define _SC_SYSTEM_DATABASE	162
#define _SC_SYSTEM_DATABASE_R	163
#define _SC_TIMEOUTS	164
#define _SC_TYPED_MEMORY_OBJECTS	165
#define _SC_USER_GROUPS	166
#define _SC_USER_GROUPS_R	167
#define _SC_2_PBS	168
#define _SC_2_PBS_ACCOUNTING	169
#define _SC_MEMLOCK	17
#define _SC_2_PBS_LOCATE	170
#define _SC_2_PBS_MESSAGE	171
#define _SC_2_PBS_TRACK	172
#define _SC_SYMLOOP_MAX	173
#define _SC_STREAMS	174
#define _SC_2_PBS_CHECKPOINT	175
#define _SC_V6_ILP32_OFF32	176
#define _SC_V6_ILP32_OFFBIG	177
#define _SC_V6_LP64_OFF64	178
#define _SC_V6_LPBIG_OFFBIG	179
#define _SC_MEMLOCK_RANGE	18
#define _SC_HOST_NAME_MAX	180
#define _SC_TRACE	181
#define _SC_TRACE_EVENT_FILTER	182
#define _SC_TRACE_INHERIT	183
#define _SC_TRACE_LOG	184
#define _SC_LEVEL1_ICACHE_SIZE	185
#define _SC_LEVEL1_ICACHE_ASSOC	186
#define _SC_LEVEL1_ICACHE_LINESIZE	187
#define _SC_LEVEL1_DCACHE_SIZE	188
#define _SC_LEVEL1_DCACHE_ASSOC	189
#define _SC_MEMORY_PROTECTION	19
#define _SC_LEVEL1_DCACHE_LINESIZE	190
#define _SC_LEVEL2_CACHE_SIZE	191
#define _SC_LEVEL2_CACHE_ASSOC	192
#define _SC_LEVEL2_CACHE_LINESIZE	193
#define _SC_LEVEL3_CACHE_SIZE	194
#define _SC_LEVEL3_CACHE_ASSOC	195
#define _SC_LEVEL3_CACHE_LINESIZE	196
#define _SC_LEVEL4_CACHE_SIZE	197
#define _SC_LEVEL4_CACHE_ASSOC	198
#define _SC_LEVEL4_CACHE_LINESIZE	199
#define _SC_CLK_TCK	2
#define _SC_MESSAGE_PASSING	20
#define _SC_SEMAPHORES	21
#define _SC_SHARED_MEMORY_OBJECTS	22
#define _SC_AIO_LISTIO_MAX	23
#define _SC_IPV6	235
#define _SC_RAW_SOCKETS	236
#define _SC_AIO_MAX	24
#define _SC_AIO_PRIO_DELTA_MAX	25
#define _SC_DELAYTIMER_MAX	26
#define _SC_MQ_OPEN_MAX	27
#define _SC_MQ_PRIO_MAX	28
#define _SC_VERSION	29
#define _SC_NGROUPS_MAX	3
#define _SC_PAGESIZE	30
#define _SC_PAGE_SIZE	30
#define _SC_RTSIG_MAX	31
#define _SC_SEM_NSEMS_MAX	32
#define _SC_SEM_VALUE_MAX	33
#define _SC_SIGQUEUE_MAX	34
#define _SC_TIMER_MAX	35
#define _SC_BC_BASE_MAX	36
#define _SC_BC_DIM_MAX	37
#define _SC_BC_SCALE_MAX	38
#define _SC_BC_STRING_MAX	39
#define _SC_OPEN_MAX	4
#define _SC_COLL_WEIGHTS_MAX	40
#define _SC_EQUIV_CLASS_MAX	41
#define _SC_EXPR_NEST_MAX	42
#define _SC_LINE_MAX	43
#define _SC_RE_DUP_MAX	44
#define _SC_CHARCLASS_NAME_MAX	45
#define _SC_2_VERSION	46
#define _SC_2_C_BIND	47
#define _SC_2_C_DEV	48
#define _SC_2_FORT_DEV	49
#define _SC_STREAM_MAX	5
#define _SC_2_FORT_RUN	50
#define _SC_2_SW_DEV	51
#define _SC_2_LOCALEDEF	52
#define _SC_PII	53
#define _SC_PII_XTI	54
#define _SC_PII_SOCKET	55
#define _SC_PII_INTERNET	56
#define _SC_PII_OSI	57
#define _SC_POLL	58
#define _SC_SELECT	59
#define _SC_TZNAME_MAX	6
#define _SC_IOV_MAX	60
#define _SC_UIO_MAXIOV	60
#define _SC_PII_INTERNET_STREAM	61
#define _SC_PII_INTERNET_DGRAM	62
#define _SC_PII_OSI_COTS	63
#define _SC_PII_OSI_CLTS	64
#define _SC_PII_OSI_M	65
#define _SC_T_IOV_MAX	66
#define _SC_THREADS	67
#define _SC_THREAD_SAFE_FUNCTIONS	68
#define _SC_GETGR_R_SIZE_MAX	69
#define _SC_JOB_CONTROL	7
#define _SC_GETPW_R_SIZE_MAX	70
#define _SC_LOGIN_NAME_MAX	71
#define _SC_TTY_NAME_MAX	72
#define _SC_THREAD_DESTRUCTOR_ITERATIONS	73
#define _SC_THREAD_KEYS_MAX	74
#define _SC_THREAD_STACK_MIN	75
#define _SC_THREAD_THREADS_MAX	76
#define _SC_THREAD_ATTR_STACKADDR	77
#define _SC_THREAD_ATTR_STACKSIZE	78
#define _SC_THREAD_PRIORITY_SCHEDULING	79
#define _SC_SAVED_IDS	8
#define _SC_THREAD_PRIO_INHERIT	80
#define _SC_THREAD_PRIO_PROTECT	81
#define _SC_THREAD_PROCESS_SHARED	82
#define _SC_NPROCESSORS_CONF	83
#define _SC_NPROCESSORS_ONLN	84
#define _SC_PHYS_PAGES	85
#define _SC_AVPHYS_PAGES	86
#define _SC_ATEXIT_MAX	87
#define _SC_PASS_MAX	88
#define _SC_XOPEN_VERSION	89
#define _SC_REALTIME_SIGNALS	9
#define _SC_XOPEN_XCU_VERSION	90
#define _SC_XOPEN_UNIX	91
#define _SC_XOPEN_CRYPT	92
#define _SC_XOPEN_ENH_I18N	93
#define _SC_XOPEN_SHM	94
#define _SC_2_CHAR_TERM	95
#define _SC_2_C_VERSION	96
#define _SC_2_UPE	97
#define _SC_XOPEN_XPG2	98
#define _SC_XOPEN_XPG3	99

#define _CS_PATH	0
#define _POSIX_REGEXP	1
#define _CS_XBS5_ILP32_OFF32_CFLAGS	1100
#define _CS_XBS5_ILP32_OFF32_LDFLAGS	1101
#define _CS_XBS5_ILP32_OFF32_LIBS	1102
#define _CS_XBS5_ILP32_OFF32_LINTFLAGS	1103
#define _CS_XBS5_ILP32_OFFBIG_CFLAGS	1104
#define _CS_XBS5_ILP32_OFFBIG_LDFLAGS	1105
#define _CS_XBS5_ILP32_OFFBIG_LIBS	1106
#define _CS_XBS5_ILP32_OFFBIG_LINTFLAGS	1107
#define _CS_XBS5_LP64_OFF64_CFLAGS	1108
#define _CS_XBS5_LP64_OFF64_LDFLAGS	1109
#define _CS_XBS5_LP64_OFF64_LIBS	1110
#define _CS_XBS5_LP64_OFF64_LINTFLAGS	1111
#define _CS_XBS5_LPBIG_OFFBIG_CFLAGS	1112
#define _CS_XBS5_LPBIG_OFFBIG_LDFLAGS	1113
#define _CS_XBS5_LPBIG_OFFBIG_LIBS	1114
#define _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS	1115

#define _XOPEN_XPG4	1
#define _XOPEN_VERSION	500

#define F_ULOCK	0
#define F_LOCK	1
#define F_TLOCK	2
#define F_TEST	3

extern size_t __confstr_chk(int, char *, size_t, size_t);
extern char **__environ;
extern char *__getcwd_chk(char *, size_t, size_t);
extern int __getgroups_chk(int, gid_t *, size_t);
extern int __gethostname_chk(char *, size_t, size_t);
extern int __getlogin_r_chk(char *, size_t, size_t);
extern pid_t __getpgid(pid_t __pid);
extern ssize_t __pread64_chk(int, void *, size_t, off64_t, size_t);
extern ssize_t __pread_chk(int, void *, size_t, off_t, size_t);
extern ssize_t __read_chk(int, void *, size_t, size_t);
extern ssize_t __readlink_chk(const char *, char *, size_t, size_t);
extern int __ttyname_r_chk(int, char *, size_t, size_t);
extern char **_environ;
extern void _exit(int __status);
extern int access(const char *__name, int __type);
extern int acct(const char *__name);
extern unsigned int alarm(unsigned int __seconds);
extern int brk(void *__addr);
extern int chdir(const char *__path);
extern int chown(const char *__file, uid_t __owner, gid_t __group);
extern int chroot(const char *__path);
extern int close(int __fd);
extern size_t confstr(int __name, char *__buf, size_t __len);
extern char *crypt(const char *__key, const char *__salt);
extern char *ctermid(char *__s);
extern char *cuserid(char *__s);
extern int daemon(int __nochdir, int __noclose);
extern int dup(int __fd);
extern int dup2(int __fd, int __fd2);
extern void encrypt(char *__block, int __edflag);
extern int execl(const char *__path, const char *__arg, ...);
extern int execle(const char *__path, const char *__arg, ...);
extern int execlp(const char *__file, const char *__arg, ...);
extern int execv(const char *__path, char *const __argv[]);
extern int execve(const char *__path, char *const __argv[],
		  char *const __envp[]);
extern int execvp(const char *__file, char *const __argv[]);
extern int faccessat(int __fd, const char *__file, int __type, int __flag);
extern int fchdir(int __fd);
extern int fchown(int __fd, uid_t __owner, gid_t __group);
extern int fchownat(int __fd, const char *__file, uid_t __owner,
		    gid_t __group, int __flag);
extern int fdatasync(int __fildes);
extern int fexecve(int __fd, char *const __argv[], char *const __envp[]);
extern pid_t fork(void);
extern long int fpathconf(int __fd, int __name);
extern int fsync(int __fd);
extern int ftruncate(int __fd, off_t __length);
extern int ftruncate64(int __fd, off64_t __length);
extern char *getcwd(char *__buf, size_t __size);
extern int getdomainname(char *__name, size_t __len);
extern int getdtablesize(void);
extern gid_t getegid(void);
extern uid_t geteuid(void);
extern gid_t getgid(void);
extern int getgroups(int __size, gid_t __list[]);
extern long int gethostid(void);
extern int gethostname(char *__name, size_t __len);
extern char *getlogin(void);
extern int getlogin_r(char *__name, size_t __name_len);
extern int getopt(int ___argc, char *const ___argv[],
		  const char *__shortopts);
extern int getpagesize(void);
extern pid_t getpgid(pid_t __pid);
extern pid_t getpgrp(void);
extern pid_t getpid(void);
extern pid_t getppid(void);
extern pid_t getsid(pid_t __pid);
extern uid_t getuid(void);
extern char *getwd(char *__buf);
extern int isatty(int __fd);
extern int lchown(const char *__file, uid_t __owner, gid_t __group);
extern int link(const char *__from, const char *__to);
extern int linkat(int __fromfd, const char *__from, int __tofd,
		  const char *__to, int __flags);
extern int lockf(int __fd, int __cmd, off_t __len);
extern int lockf64(int __fd, int __cmd, off64_t __len);
extern off_t lseek(int __fd, off_t __offset, int __whence);
extern loff_t lseek64(int __fd, loff_t __offset, int __whence);
extern int mkstemp(char *__template);
extern int nice(int __inc);
extern char *optarg;
extern int opterr;
extern int optind;
extern int optopt;
extern long int pathconf(const char *__path, int __name);
extern int pause(void);
extern int pipe(int __pipedes[2]);
extern ssize_t pread(int __fd, void *__buf, size_t __nbytes,
		     off_t __offset);
extern ssize_t pread64(int __fd, void *__buf, size_t __nbytes,
		       off64_t __offset);
extern ssize_t pwrite(int __fd, const void *__buf, size_t __n,
		      off_t __offset);
extern ssize_t pwrite64(int __fd, const void *__buf, size_t __n,
			off64_t __offset);
extern ssize_t read(int __fd, void *__buf, size_t __nbytes);
extern ssize_t readlink(const char *__path, char *__buf, size_t __len);
extern ssize_t readlinkat(int __fd, const char *__path, char *__buf,
			  size_t __len);
extern int rename(const char *__old, const char *__new);
extern int rmdir(const char *__path);
extern void *sbrk(intptr_t __delta);
extern int select(int __nfds, fd_set * __readfds, fd_set * __writefds,
		  fd_set * __exceptfds, struct timeval *__timeout);
extern int setegid(gid_t __gid);
extern int seteuid(uid_t __uid);
extern int setgid(gid_t __gid);
extern int sethostname(const char *__name, size_t __len);
extern void setkey(const char *__key);
extern int setpgid(pid_t __pid, pid_t __pgid);
extern int setpgrp(void);
extern int setregid(gid_t __rgid, gid_t __egid);
extern int setreuid(uid_t __ruid, uid_t __euid);
extern pid_t setsid(void);
extern int setuid(uid_t __uid);
extern unsigned int sleep(unsigned int __seconds);
extern void swab(const void *__from, void *__to, ssize_t __n);
extern int symlink(const char *__from, const char *__to);
extern int symlinkat(const char *__from, int __tofd, const char *__to);
extern void sync(void);
extern long int sysconf(int __name);
extern pid_t tcgetpgrp(int __fd);
extern int tcsetpgrp(int __fd, pid_t __pgrp_id);
extern int truncate(const char *__file, off_t __length);
extern int truncate64(const char *__file, off64_t __length);
extern char *ttyname(int __fd);
extern int ttyname_r(int __fd, char *__buf, size_t __buflen);
extern unsigned int ualarm(useconds_t __value, useconds_t __interval);
extern int unlink(const char *__name);
extern int unlinkat(int __fd, const char *__name, int __flag);
extern int usleep(useconds_t __useconds);
extern pid_t vfork(void);
extern ssize_t write(int __fd, const void *__buf, size_t __n);

12.4.97. utime.h


struct utimbuf {
    time_t actime;
    time_t modtime;
};
extern int utime(const char *__file, const struct utimbuf *__file_times);

12.4.98. utmp.h


#define UT_HOSTSIZE	256
#define UT_LINESIZE	32
#define UT_NAMESIZE	32
#define ut_addr	ut_addr_v6[0]
#define ut_time	ut_tv.tv_sec
#define ut_name	ut_user		/* Backwards compatability */

struct exit_status {
    short e_termination;	/* Process termination status. */
    short e_exit;		/* Process exit status. */
};

#define EMPTY	0		/* No valid user accounting information. */
#define RUN_LVL	1		/* The system's runlevel. */
#define BOOT_TIME	2	/* Time of system boot. */
#define NEW_TIME	3	/* Time after system clock changed. */
#define OLD_TIME	4	/* Time when system clock changed. */
#define INIT_PROCESS	5	/* Process spawned by the init process. */
#define LOGIN_PROCESS	6	/* Session leader of a logged in user. */
#define USER_PROCESS	7	/* Normal process. */
#define DEAD_PROCESS	8	/* Terminated process. */
#define ACCOUNTING	9

extern void endutent(void);
extern struct utmp *getutent(void);
extern int getutent_r(struct utmp *__buffer, struct utmp **__result);
extern void login(const struct utmp *__entry);
extern int login_tty(int __fd);
extern int logout(const char *__ut_line);
extern void logwtmp(const char *__ut_line, const char *__ut_name,
		    const char *__ut_host);
extern void setutent(void);
extern int utmpname(const char *__file);

12.4.99. utmpx.h


extern void endutxent(void);
extern struct utmpx *getutxent(void);
extern struct utmpx *getutxid(const struct utmpx *__id);
extern struct utmpx *getutxline(const struct utmpx *__line);
extern struct utmpx *pututxline(const struct utmpx *__utmpx);
extern void setutxent(void);

12.4.100. wchar.h


#define WEOF	(0xffffffffu)
#define WCHAR_MAX	0x7FFFFFFF
#define WCHAR_MIN	0x80000000

extern wchar_t *__fgetws_chk(wchar_t *, size_t, int, FILE *);
extern wchar_t *__fgetws_unlocked_chk(wchar_t *, size_t, int, FILE *);
extern int __fwprintf_chk(FILE *, int, const wchar_t *, ...);
extern size_t __mbsnrtowcs_chk(wchar_t *, const char **, size_t, size_t,
			       mbstate_t *, size_t);
extern size_t __mbsrtowcs_chk(wchar_t *, const char **, size_t,
			      mbstate_t *, size_t);
extern int __swprintf_chk(wchar_t *, size_t, int, size_t, const wchar_t *,
			  ...);
extern int __vfwprintf_chk(FILE *, int, const wchar_t *, va_list);
extern int __vswprintf_chk(wchar_t *, size_t, int, size_t, const wchar_t *,
			   va_list);
extern int __vwprintf_chk(int, const wchar_t *, va_list);
extern wchar_t *__wcpcpy_chk(wchar_t *, const wchar_t *, size_t);
extern wchar_t *__wcpncpy_chk(wchar_t *, const wchar_t *, size_t, size_t);
extern size_t __wcrtomb_chk(char *, wchar_t, mbstate_t *, size_t);
extern wchar_t *__wcscat_chk(wchar_t *, const wchar_t *, size_t);
extern wchar_t *__wcscpy_chk(wchar_t *, const wchar_t *, size_t);
extern wchar_t *__wcsncat_chk(wchar_t *, const wchar_t *, size_t, size_t);
extern wchar_t *__wcsncpy_chk(wchar_t *, const wchar_t *, size_t, size_t);
extern size_t __wcsnrtombs_chk(char *, const wchar_t * *, size_t, size_t,
			       mbstate_t *, size_t);
extern size_t __wcsrtombs_chk(char *, const wchar_t * *, size_t,
			      mbstate_t *, size_t);
extern double __wcstod_internal(const wchar_t *, wchar_t * *, int);
extern float __wcstof_internal(const wchar_t *, wchar_t * *, int);
extern long int __wcstol_internal(const wchar_t *, wchar_t * *, int, int);
extern long double __wcstold_internal(const wchar_t *, wchar_t * *, int);
extern unsigned long int __wcstoul_internal(const wchar_t *, wchar_t * *,
					    int, int);
extern wchar_t *__wmemcpy_chk(wchar_t *, const wchar_t *, size_t, size_t);
extern wchar_t *__wmemmove_chk(wchar_t *, const wchar_t *, size_t, size_t);
extern wchar_t *__wmempcpy_chk(wchar_t *, const wchar_t *, size_t, size_t);
extern wchar_t *__wmemset_chk(wchar_t *, wchar_t, size_t, size_t);
extern int __wprintf_chk(int, const wchar_t *, ...);
extern wint_t btowc(int __c);
extern wint_t fgetwc(FILE * __stream);
extern wint_t fgetwc_unlocked(FILE * __stream);
extern wchar_t *fgetws(wchar_t * __ws, int __n, FILE * __stream);
extern wchar_t *fgetws_unlocked(wchar_t * __ws, int __n, FILE * __stream);
extern wint_t fputwc(wchar_t __wc, FILE * __stream);
extern wint_t fputwc_unlocked(wchar_t __wc, FILE * __stream);
extern int fputws(const wchar_t * __ws, FILE * __stream);
extern int fputws_unlocked(const wchar_t * __ws, FILE * __stream);
extern int fwide(FILE * __fp, int __mode);
extern int fwprintf(FILE * __stream, const wchar_t * __format, ...);
extern int fwscanf(FILE * __stream, const wchar_t * __format, ...);
extern wint_t getwc(FILE * __stream);
extern wint_t getwc_unlocked(FILE * __stream);
extern wint_t getwchar(void);
extern wint_t getwchar_unlocked(void);
extern size_t mbrlen(const char *__s, size_t __n, mbstate_t * __ps);
extern size_t mbrtowc(wchar_t * __pwc, const char *__s, size_t __n,
		      mbstate_t * __p);
extern int mbsinit(const mbstate_t * __ps);
extern size_t mbsnrtowcs(wchar_t * __dst, const char **__src, size_t __nmc,
			 size_t __len, mbstate_t * __ps);
extern size_t mbsrtowcs(wchar_t * __dst, const char **__src, size_t __len,
			mbstate_t * __ps);
extern FILE *open_wmemstream(wchar_t * *__bufloc, size_t * __sizeloc);
extern wint_t putwc(wchar_t __wc, FILE * __stream);
extern wint_t putwc_unlocked(wchar_t __wc, FILE * __stream);
extern wint_t putwchar(wchar_t __wc);
extern wint_t putwchar_unlocked(wchar_t __wc);
extern int swprintf(wchar_t * __s, size_t __n, const wchar_t * __format,
		    ...);
extern int swscanf(const wchar_t * __s, const wchar_t * __format, ...);
extern wint_t ungetwc(wint_t __wc, FILE * __stream);
extern int vfwprintf(FILE * __s, const wchar_t * __format, va_list __arg);
extern int vfwscanf(FILE * __s, const wchar_t * __format, va_list __arg);
extern int vswprintf(wchar_t * __s, size_t __n, const wchar_t * __format,
		     va_list __arg);
extern int vswscanf(const wchar_t * __s, const wchar_t * __format,
		    va_list __arg);
extern int vwprintf(const wchar_t * __format, va_list __arg);
extern int vwscanf(const wchar_t * __format, va_list __arg);
extern wchar_t *wcpcpy(wchar_t * __dest, const wchar_t * __src);
extern wchar_t *wcpncpy(wchar_t * __dest, const wchar_t * __src,
			size_t __n);
extern size_t wcrtomb(char *__s, wchar_t __wc, mbstate_t * __ps);
extern int wcscasecmp(const wchar_t * __s1, const wchar_t * __s2);
extern wchar_t *wcscat(wchar_t * __dest, const wchar_t * __src);
extern wchar_t *wcschr(const wchar_t * __wcs, wchar_t __wc);
extern int wcscmp(const wchar_t * __s1, const wchar_t * __s2);
extern int wcscoll(const wchar_t * __s1, const wchar_t * __s2);
extern wchar_t *wcscpy(wchar_t * __dest, const wchar_t * __src);
extern size_t wcscspn(const wchar_t * __wcs, const wchar_t * __reject);
extern wchar_t *wcsdup(const wchar_t * __s);
extern size_t wcsftime(wchar_t * __s, size_t __maxsize,
		       const wchar_t * __format, const struct tm *__tp);
extern size_t wcslen(const wchar_t * __s);
extern int wcsncasecmp(const wchar_t * __s1, const wchar_t * __s2,
		       size_t __n);
extern wchar_t *wcsncat(wchar_t * __dest, const wchar_t * __src,
			size_t __n);
extern int wcsncmp(const wchar_t * __s1, const wchar_t * __s2, size_t __n);
extern wchar_t *wcsncpy(wchar_t * __dest, const wchar_t * __src,
			size_t __n);
extern size_t wcsnlen(const wchar_t * __s, size_t __maxlen);
extern size_t wcsnrtombs(char *__dst, const wchar_t * *__src, size_t __nwc,
			 size_t __len, mbstate_t * __ps);
extern wchar_t *wcspbrk(const wchar_t * __wcs, const wchar_t * __accept);
extern wchar_t *wcsrchr(const wchar_t * __wcs, wchar_t __wc);
extern size_t wcsrtombs(char *__dst, const wchar_t * *__src, size_t __len,
			mbstate_t * __ps);
extern size_t wcsspn(const wchar_t * __wcs, const wchar_t * __accept);
extern wchar_t *wcsstr(const wchar_t * __haystack,
		       const wchar_t * __needle);
extern double wcstod(const wchar_t * __nptr, wchar_t * *__endptr);
extern float wcstof(const wchar_t * __nptr, wchar_t * *__endptr);
extern wchar_t *wcstok(wchar_t * __s, const wchar_t * __delim,
		       wchar_t * *__ptr);
extern long int wcstol(const wchar_t * __nptr, wchar_t * *__endptr,
		       int __base);
extern long double wcstold(const wchar_t * __nptr, wchar_t * *__endptr);
extern long long int wcstoll(const wchar_t * __nptr, wchar_t * *__endptr,
			     int __base);
extern long long int wcstoq(const wchar_t * __nptr, wchar_t * *__endptr,
			    int __base);
extern unsigned long int wcstoul(const wchar_t * __nptr,
				 wchar_t * *__endptr, int __base);
extern unsigned long long int wcstoull(const wchar_t * __nptr,
				       wchar_t * *__endptr, int __base);
extern unsigned long long int wcstouq(const wchar_t * __nptr,
				      wchar_t * *__endptr, int __base);
extern wchar_t *wcswcs(const wchar_t * __haystack,
		       const wchar_t * __needle);
extern int wcswidth(const wchar_t * __s, size_t __n);
extern size_t wcsxfrm(wchar_t * __s1, const wchar_t * __s2, size_t __n);
extern int wctob(wint_t __c);
extern int wcwidth(wchar_t __c);
extern wchar_t *wmemchr(const wchar_t * __s, wchar_t __c, size_t __n);
extern int wmemcmp(const wchar_t * __s1, const wchar_t * __s2, size_t __n);
extern wchar_t *wmemcpy(wchar_t * __s1, const wchar_t * __s2, size_t __n);
extern wchar_t *wmemmove(wchar_t * __s1, const wchar_t * __s2, size_t __n);
extern wchar_t *wmemset(wchar_t * __s, wchar_t __c, size_t __n);
extern int wprintf(const wchar_t * __format, ...);
extern int wscanf(const wchar_t * __format, ...);

12.4.101. wctype.h


typedef unsigned long int wctype_t;
typedef unsigned int wint_t;
typedef const int32_t *wctrans_t;
typedef struct {
    int count;
    wint_t value;
} __mbstate_t;

typedef __mbstate_t mbstate_t;
extern int iswalnum(wint_t __wc);
extern int iswalpha(wint_t __wc);
extern int iswblank(wint_t __wc);
extern int iswcntrl(wint_t __wc);
extern int iswctype(wint_t __wc, wctype_t __desc);
extern int iswdigit(wint_t __wc);
extern int iswgraph(wint_t __wc);
extern int iswlower(wint_t __wc);
extern int iswprint(wint_t __wc);
extern int iswpunct(wint_t __wc);
extern int iswspace(wint_t __wc);
extern int iswupper(wint_t __wc);
extern int iswxdigit(wint_t __wc);
extern wint_t towctrans(wint_t __wc, wctrans_t __desc);
extern wint_t towlower(wint_t __wc);
extern wint_t towupper(wint_t __wc);
extern wctrans_t wctrans(const char *__property);
extern wctype_t wctype(const char *__property);

12.4.102. wordexp.h


enum {
    WRDE_DOOFFS = 1,
    WRDE_APPEND = 2,
    WRDE_NOCMD = 4,
    WRDE_REUSE = 8,
    WRDE_SHOWERR = 16,
    WRDE_UNDEF = 32
};

typedef struct {
    size_t we_wordc;
    char **we_wordv;
    size_t we_offs;
} wordexp_t;

enum {
    WRDE_NOSYS = -1,
    WRDE_NOSPACE = 1,
    WRDE_BADCHAR = 2,
    WRDE_BADVAL = 3,
    WRDE_CMDSUB = 4,
    WRDE_SYNTAX = 5
};
extern int wordexp(const char *__words, wordexp_t * __pwordexp,
		   int __flags);
extern void wordfree(wordexp_t * __wordexp);

12.5. Interface Definitions for libc

Table of Contents
_IO_feof -- alias for feof
_IO_getc -- alias for getc
_IO_putc -- alias for putc
_IO_puts -- alias for puts
__assert_fail -- abort the program after false assertion
__chk_fail -- terminate a function in case of buffer overflow
__confstr_chk -- get configuration dependent string variables, with buffer overflow checking
__ctype_b_loc -- accessor function for __ctype_b array for ctype functions
__ctype_get_mb_cur_max -- maximum length of a multibyte character in the current locale
__ctype_tolower_loc -- accessor function for __ctype_b_tolower array for ctype tolower() function
__ctype_toupper_loc -- accessor function for __ctype_b_toupper() array for ctype toupper() function
__cxa_atexit -- register a function to be called by exit or when a shared library is unloaded
__cxa_finalize -- call destructors of global (or local static) C++ objects and exit functions registered with atexit
__daylight -- external daylight savings time flag
__environ -- alias for environ - user environment
__errno_location -- address of errno variable
__fgets_chk -- string input, with buffer overflow checking
__fgets_unlocked_chk -- non-locking string input, with buffer overflow checking
__fgetws_chk -- read a wide-character string from a FILE stream, with buffer overflow checking
__fgetws_unlocked_chk -- read a wide-character string from a FILE stream in a non-locking manner, with stack checking
__fpending -- returns in bytes the amount of output pending on a stream
__fprintf_chk -- convert formatted output, with stack checking
__fwprintf_chk -- convert formatted wide-character output, with stack checking
__fxstatat -- get file status relative to directory file descriptor
__fxstatat64, fstatat64 -- get file status relative to a directory file descriptor (Large File Support)
__getcwd_chk -- get current working directory, with buffer overflow checking
__getgroups_chk -- get list of supplementary group IDs, with buffer overflow checking
__gethostname_chk -- get host name, with buffer overflow checking
__getlogin_r_chk -- get user name, with buffer overflow checking (reentrant)
__getpagesize -- alias for getpagesize - get current page size
__getpgid -- get the process group id
__h_errno_location -- address of h_errno variable
__isinf -- test for infinity
__isinff -- test for infinity
__isinfl -- test for infinity
__isnan -- test for infinity
__isnanf -- test for infinity
__isnanl -- test for infinity
__libc_current_sigrtmax -- return number of available real-time signal with lowest priority
__libc_current_sigrtmin -- return number of available real-time signal with highest priority
__libc_start_main -- initialization routine
__mbsnrtowcs_chk -- convert a multibyte string to a wide-character string, with buffer overflow checking
__mbsrtowcs_chk -- convert a multibyte string to a wide-character string, with buffer overflow checking
__mbstowcs_chk -- convert a multibyte string to a wide-character string, with buffer overflow checking
__memcpy_chk -- copy memory area, with buffer overflow checking
__memmove_chk -- copy memory area, with buffer overflow checking
__mempcpy -- copy given number of bytes of source to destination
__mempcpy_chk -- copy memory area, with buffer overflow checking
__memset_chk -- fill memory with a constant byte, using buffer overflow checking
__pread64_chk -- read from a file descriptor at a given offset, with buffer overflow checking
__pread_chk -- read from a file descriptor at a given offset, with buffer overflow checking
__printf_chk -- format and print data, with stack checking
__rawmemchr -- scan memory
__read_chk -- read from a file descriptor, with buffer overflow checking
__readlink_chk -- display value of a symbolic link, with buffer overflow checking
__realpath_chk -- return the canonicalized absolute pathname, with buffer overflow checking
__recv_chk -- receive a message from a socket, with buffer overflow checking
__recvfrom_chk -- receive a message from a socket, with buffer overflow checking
__register_atfork -- alias for register_atfork
__sigsetjmp -- save stack context for non-local goto
__snprintf_chk -- convert formatted output, with buffer overflow checking
__sprintf_chk -- convert formatted output, with stack checking
__stack_chk_fail -- terminate a function in case of stack overflow
__stpcpy -- alias for stpcpy
__stpcpy_chk -- copy a string returning a pointer to its end, with buffer overflow checking
__stpncpy_chk -- copy a fixed-size string, returning a pointer to its end, with buffer overflow checking
__strcat_chk -- concatenate two strings, with buffer overflow checking
__strcpy_chk -- copy a string, with buffer overflow checking
__strdup -- alias for strdup
__strncat_chk -- concatenate two strings, with buffer overflow checking
__strncpy_chk -- copy a string, with buffer overflow checking
__strtod_internal -- underlying function for strtod
__strtof_internal -- underlying function for strtof
__strtok_r -- alias for strtok_r
__strtol_internal -- alias for strtol
__strtold_internal -- underlying function for strtold
__strtoll_internal -- underlying function for strtoll
__strtoul_internal -- underlying function for strtoul
__strtoull_internal -- underlying function for strtoull
__swprintf_chk -- convert formatted wide-character output, with stack checking
__sysconf -- get configuration information at runtime
__syslog_chk -- send messages to the system logger, with stack checking
__sysv_signal -- signal handling
__timezone -- external variable containing timezone
__ttyname_r_chk -- return name of a terminal, with buffer overflow checking (reentrant)
__tzname -- external variable containing the timezone names
__vfprintf_chk -- convert formatted output, with stack checking
__vfwprintf_chk -- convert formatted wide-character output, with stack checking
__vprintf_chk -- convert formatted output, with stack checking
__vsnprintf_chk -- convert formatted output, with stack checking
__vsprintf_chk -- convert formatted output, with stack checking
__vswprintf_chk -- convert formatted wide-character output, with stack checking
__vsyslog_chk -- send messages to the system logger, with stack checking
__vwprintf_chk -- convert formatted wide-character output, with stack checking
__wcpcpy_chk -- copy a wide-character string, returning a pointer to its end, with buffer overflow checking
__wcpncpy_chk -- copy a fixed-size string of wide characters, returning a pointer to its end, with buffer overflow checking
__wcrtomb_chk -- convert a wide character to a multibyte sequence, with buffer overflow checking
__wcscat_chk -- concatenate two wide-character strings, with buffer overflow checking
__wcscpy_chk -- copy a wide-character string, with buffer overflow checking
__wcsncat_chk -- concatenate two wide-character strings, with buffer overflow checking
__wcsncpy_chk -- copy a fixed-size string of wide characters, with buffer overflow checking
__wcsnrtombs_chk -- convert a wide-character string to a multibyte string, with buffer overflow checking
__wcsrtombs_chk -- convert a wide-character string to a multibyte string, with buffer overflow checking
__wcstod_internal -- underlying function for wcstod
__wcstof_internal -- underlying function for wcstof
__wcstol_internal -- underlying function for wcstol
__wcstold_internal -- underlying function for wcstold
__wcstombs_chk -- convert a wide-character string to a multibyte string, with buffer overflow checking
__wcstoul_internal -- underlying function for wcstoul
__wctomb_chk -- convert a wide character to a multibyte sequence, with buffer overflow checking
__wmemcpy_chk -- copy an array of wide-characters, with buffer overflow checking
__wmemmove_chk -- copy an array of wide-characters, with buffer overflow checking
__wmempcpy_chk -- copy memory area, with buffer overflow checking
__wmemset_chk -- fill an array of wide-characters with a constant wide character, with buffer overflow checking
__wprintf_chk -- convert formatted wide-character output, with stack checking
__xmknod -- make a special file
__xmknodat -- make a special file relative to a directory file descriptor
__xpg_basename -- return the last component of a file name
__xpg_sigpause -- remove a signal from the signal mask and suspend the thread
__xpg_strerror_r -- return string describing error number
__xstat -- get File Status
__xstat64 -- get File Status
_environ -- alias for environ - user environment
_nl_msg_cat_cntr -- new catalog load counter
_sys_errlist -- array containing the "C" locale strings used by strerror()
_sys_siglist -- array containing the names of the signal names
acct -- switch process accounting on or off
adjtime -- correct the time to allow synchronization of the system clock
alphasort64 -- Comparison function for directory scanning (Large File Support)
asprintf -- write formatted output to a dynamically allocated string
backtrace, backtrace_symbols, backtrace_symbols_fd -- runtime stack back tracing
basename -- return the last component of a file name
bind_textdomain_codeset -- specify encoding for message retrieval
bindresvport -- bind socket to privileged IP port
bindtextdomain -- specify the location of a message catalog
cfmakeraw -- get and set terminal attributes
cfsetspeed -- set terminal input and output data rate
clearerr_unlocked -- non-thread-safe clearerr
daemon -- run in the background
dcgettext -- perform domain and category specific lookup in message catalog
dcngettext -- perform domain and category specific lookup in message catalog with plural
dgettext -- perform lookup in message catalog for the current LC_MESSAGES locale
dl_iterate_phdr -- iterate over a program's loaded shared objects
dngettext -- perform lookup in message catalog for the current locale
drand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
duplocale -- provide new handle for selection of locale
endutent -- access utmp file entries
epoll_create -- open an epoll file descriptor
epoll_ctl -- control an epoll file descriptor
epoll_wait -- wait for I/O events on an epoll file descriptor
erand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
err -- display formatted error messages
error -- print error message
errx -- display formatted error message and exit
fcntl -- file control
feof_unlocked -- non-thread-safe feof
ferror_unlocked -- non-thread-safe ferror
fflush_unlocked -- non thread safe fflush
fgetc_unlocked -- non-thread-safe fgetc
fgets_unlocked -- non-thread-safe fgets
fgetwc_unlocked -- non thread safe fgetwc
fgetws_unlocked -- non-thread-safe fgetws
fileno_unlocked -- non-thread-safe fileno
flock -- apply or remove an advisory lock on an open file
fputc_unlocked -- non-thread-safe fputc
fputs_unlocked -- non-thread-safe fputs
fputwc_unlocked -- non-thread-safe fputwc
fputws_unlocked -- non-thread-safe fputws
fread_unlocked -- non-thread-safe fread
freelocale -- free a locale object
fscanf -- convert formatted input
fstatfs -- (deprecated)
fstatfs64 -- (deprecated)
fwrite_unlocked -- non-thread-safe fwrite
fwscanf -- convert formatted input
getdomainname -- get NIS domain name (DEPRECATED).
getdtablesize -- get file descriptor table size (DEPRECATED)
getgrent_r -- reentrantly get entry in group file
getgrouplist -- get groups a user belongs to
gethostbyaddr_r -- find network host database entry matching host name (DEPRECATED)
gethostbyname2 -- find network host database entry matching host name (DEPRECATED)
gethostbyname2_r -- find network host database entry matching host name (DEPRECATED)
gethostbyname_r -- find network host database entry matching host name (DEPRECATED)
getloadavg -- get system load averages
getopt -- parse command line options
getopt_long -- parse command line options
getopt_long_only -- parse command line options
getpagesize -- get memory page size (DEPRECATED)
getprotobyname_r -- retrieve information from the network protocol database by protocol name, reentrantly
getprotobynumber_r -- retrieve information from the network protocol database by protocol number, reentrantly
getprotoent_r -- read the next entry of the protocol database, reentrantly
getpwent_r -- reentrantly get entry in passwd file
getservbyname_r -- retrieve information from the network services database by service name, reentrantly
getservbyport_r -- retrieve information from the network services database by service port, reentrantly
getservent_r -- read the next entry of the network services database, reentrantly
getsockopt -- get socket options
gettext -- search message catalogs for a string
getutent -- access user accounting database entries
getutent_r -- access user accounting database entries
getwc_unlocked -- non-thread-safe getwc
getwchar_unlocked -- non-thread-safe getwchar
glob64 -- find pathnames matching a pattern (Large File Support)
globfree64 -- free memory from glob64() (Large File Support)
gnu_get_libc_version, gnu_get_libc_release -- get glibc-specific version and release
hcreate_r -- allocate space for a hash search table, reentrantly
hdestroy_r -- dispose of a hash search table, reentrantly
hsearch_r -- search a hash table, reentrantly
inet_aton -- Internet address manipulation routine
initgroups -- initialize the supplementary group access list
initstate_r -- reentrantly initialize a state array for random number generator functions
inotify_add_watch -- add a watch to a watch list
inotify_init -- instantiate inotify
inotify_rm_watch -- remove a watch from an inotify watch list
ioctl -- control device
sockio -- socket ioctl commands
ttyio -- tty ioctl commands
jrand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
kill -- send a signal
lcong48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
link -- create a link to a file
lrand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
mbsnrtowcs -- convert a multibyte string to a wide character string
memmem -- locate bytes
memrchr -- scan memory for a character
mkstemp64 -- create a unique temporary file (Large File Support)
mrand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
mremap -- remap a virtual memory address
newlocale -- allocate a locale object
ngettext -- search message catalogs for plural string
nrand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
openat64 -- open a file relative to a directory file descriptor (Large File Support)
pmap_getport -- find the port number assigned to a service registered with a portmapper.
pmap_set -- establishes mapping to machine's RPC Bind service.
pmap_unset --  destroys RPC Binding
posix_fadvise64 -- File advisory information (Large File Support)
posix_fallocate64 -- file space control (Large File Support)
pread64 -- read from a file (Large File Support)
psignal -- print signal message
ptrace -- process trace
putwc_unlocked -- non-thread-safe putwc
putwchar_unlocked -- non-thread-safe putwchar
pwrite64 -- write on a file (Large File Support)
random_r -- reentrantly generate pseudorandom numbers in a uniform distribution
readdir64_r -- read a directory (Large File Support)
regexec -- regular expression matching
scandir64 -- scan a directory (Large File Support)
scanf -- convert formatted input
sched_getaffinity -- retrieve the affinity mask of a process
sched_setaffinity -- set the CPU affinity mask for a process
sched_setscheduler -- set scheduling policy and parameters
seed48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
sendfile -- transfer data between two file descriptors
sendfile64 -- transfer data between two file descriptors (Large File Support)
setbuffer -- stream buffering operation
setgroups -- set list of supplementary group IDs
sethostname -- set host name
setsockopt -- set socket options
setstate_r -- reentrantly change the state array used by random number generator functions
setutent -- access user accounting database entries
sigandset -- build a new signal set by combining the two input sets using logical AND
sigisemptyset -- check for empty signal set
sigorset -- build a new signal set by combining the two input sets using logical OR
sigpause -- remove a signal from the signal mask and suspend the thread (deprecated)
sigreturn -- return from signal handler and cleanup stack frame
srand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution
srandom_r -- reentrantly set the seed for a new sequence of pseudorandom numbers
sscanf -- convert formatted input
statfs -- (deprecated)
statfs64 -- (deprecated)
stime -- set time
stpcpy -- copy a string returning a pointer to its end
stpncpy -- copy a fixed-size string, returning a pointer to its end
strcasestr -- locate a substring ignoring case
strerror_r -- return string describing error number
strndup -- return a malloc'd copy of at most the specified number of bytes of a string
strnlen -- determine the length of a fixed-size string
strptime -- parse a time string
strsep -- extract token from string
strsignal -- return string describing signal
strtoq -- convert string value to a long or quad_t integer
strtouq -- convert a string to an unsigned long long
svc_register -- register Remote Procedure Call interface
svc_run -- waits for RPC requests to arrive and calls service procedure
svc_sendreply -- called by RPC service's dispatch routine
svctcp_create -- create a TCP/IP-based RPC service transport
svcudp_create --  create a UDP-based RPC service transport
swscanf -- convert formatted input
sysconf -- Get configuration information at runtime
sysinfo -- return system information
system -- execute a shell command
textdomain -- set the current default message domain
unlink -- remove a directory entry
uselocale -- set locale for thread
utmpname -- set user accounting database
vasprintf -- write formatted output to a dynamically allocated string
vdprintf -- write formatted output to a file descriptor
verrx -- display formatted error message and exit
vfscanf -- convert formatted input
vfwscanf -- convert formatted input
vscanf -- convert formatted input
vsscanf -- convert formatted input
vswscanf -- convert formatted input
vsyslog -- log to system log
vwscanf -- convert formatted input
wait4 -- wait for process termination, BSD style
warn -- formatted error messages
warnx -- formatted error messages
wcpcpy -- copy a wide character string, returning a pointer to its end
wcpncpy -- copy a fixed-size string of wide characters, returning a pointer to its end
wcscasecmp -- compare two wide-character strings, ignoring case
wcsdup -- duplicate a wide-character string
wcsncasecmp -- compare two fixed-size wide-character strings, ignoring case
wcsnlen -- determine the length of a fixed-size wide-character string
wcsnrtombs -- convert a wide character string to a multi-byte string
wcstoq -- convert wide string to long long int representation
wcstouq -- convert wide string to unsigned long long int representation
wscanf -- convert formatted input
xdr_u_int -- library routines for external data representation
xdrstdio_create -- library routines for external data representation

The interfaces defined on the following pages are included in libc and are defined by this specification. Unless otherwise noted, these interfaces shall be included in the source standard.

Other interfaces listed in Section 12.3 shall behave as described in the referenced base document.

_IO_feof

Name

_IO_feof -- alias for feof

Synopsis

int _IO_feof(_IO_FILE * __fp);

Description

_IO_feof() tests the end-of-file indicator for the stream pointed to by __fp, returning a non-zero value if it is set.

_IO_feof() is not in the source standard; it is only in the binary standard.

_IO_getc

Name

_IO_getc -- alias for getc

Synopsis

int _IO_getc(_IO_FILE * __fp);

Description

_IO_getc() reads the next character from __fp and returns it as an unsigned char cast to an int, or EOF on end-of-file or error.

_IO_getc() is not in the source standard; it is only in the binary standard.

_IO_putc

Name

_IO_putc -- alias for putc

Synopsis

int _IO_putc(int __c, _IO_FILE * __fp);

Description

_IO_putc() writes the character __c, cast to an unsigned char, to __fp.

_IO_putc() is not in the source standard; it is only in the binary standard.

_IO_puts

Name

_IO_puts -- alias for puts

Synopsis

int _IO_puts(const char * __c);

Description

_IO_puts() writes the string __s and a trailing newline to stdout.

_IO_puts() is not in the source standard; it is only in the binary standard.

__assert_fail

Name

__assert_fail -- abort the program after false assertion

Synopsis

void __assert_fail(const char * assertion, const char * file, unsigned int line, const char * function);

Description

The __assert_fail() function is used to implement the assert() interface of POSIX 1003.1-2001 (ISO/IEC 9945-2003). The __assert_fail() function shall print the given file filename, line line number, function function name and a message on the standard error stream in an unspecified format, and abort program execution via the abort() function. For example:

a.c:10: foobar: Assertion a == b failed.

If function is NULL, __assert_fail() shall omit information about the function.

assertion, file, and line shall be non-NULL.

The __assert_fail() function is not in the source standard; it is only in the binary standard. The assert() interface is not in the binary standard; it is only in the source standard. The assert() may be implemented as a macro.

__chk_fail

Name

__chk_fail -- terminate a function in case of buffer overflow

Synopsis

#include <libc.h>

void __chk_fail(void);

Description

The interface __chk_fail() shall abort the function that called it with a message that a buffer overflow has been detected. The program that called the function shall then exit.

Application Usage (informative)

The interface __chk_fail() does not check for a buffer overflow itself. It merely reports one when invoked.

__confstr_chk

Name

__confstr_chk -- get configuration dependent string variables, with buffer overflow checking

Synopsis

#include <unistd.h>

size_t __confstr_chk(int name, char * buf, size_t len, size_t buflen);

Description

The interface __confstr_chk() shall function in the same way as the interface confstr(), except that __confstr_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter buflen specifies the size of the buffer buf. If len exceeds buflen, the function shall abort, and the program calling it shall exit.

The __confstr_chk() function is not in the source standard; it is only in the binary standard.

__ctype_b_loc

Name

__ctype_b_loc -- accessor function for __ctype_b array for ctype functions

Synopsis

#include <ctype.h>

const unsigned short * * __ctype_b_loc (void);

Description

The __ctype_b_loc() function shall return a pointer into an array of characters in the current locale that contains characteristics for each character in the current character set. The array shall contain a total of 384 characters, and can be indexed with any signed or unsigned char (i.e. with an index value between -128 and 255). If the application is multithreaded, the array shall be local to the current thread.

This interface is not in the source standard; it is only in the binary standard.

Return Value

The __ctype_b_loc() function shall return a pointer to the array of characters to be used for the ctype() family of functions (see <ctype.h>).

__ctype_get_mb_cur_max

Name

__ctype_get_mb_cur_max -- maximum length of a multibyte character in the current locale

Synopsis

size_t __ctype_get_mb_cur_max(void);

Description

__ctype_get_mb_cur_max() returns the maximum length of a multibyte character in the current locale.

__ctype_get_mb_cur_max() is not in the source standard; it is only in the binary standard.

__ctype_tolower_loc

Name

__ctype_tolower_loc -- accessor function for __ctype_b_tolower array for ctype tolower() function

Synopsis

#include <ctype.h>

int32_t * * __ctype_tolower_loc(void);

Description

The __ctype_tolower_loc() function shall return a pointer into an array of characters in the current locale that contains lower case equivalents for each character in the current character set. The array shall contain a total of 384 characters, and can be indexed with any signed or unsigned char (i.e. with an index value between -128 and 255). If the application is multithreaded, the array shall be local to the current thread.

This interface is not in the source standard; it is only in the binary standard.

Return Value

The __ctype_tolower_loc() function shall return a pointer to the array of characters to be used for the ctype() family of functions (see <ctype.h>).

__ctype_toupper_loc

Name

__ctype_toupper_loc -- accessor function for __ctype_b_toupper() array for ctype toupper() function

Synopsis

#include <ctype.h>

int32_t * * __ctype_toupper_loc(void);

Description

The __ctype_toupper_loc() function shall return a pointer into an array of characters in the current locale that contains upper case equivalents for each character in the current character set. The array shall contain a total of 384 characters, and can be indexed with any signed or unsigned char (i.e. with an index value between -128 and 255). If the application is multithreaded, the array shall be local to the current thread.

This interface is not in the source standard; it is only in the binary standard.

Return Value

The __ctype_toupper_loc() function shall return a pointer to the array of characters to be used for the ctype() family of functions (see <ctype.h>).

__cxa_atexit

Name

__cxa_atexit -- register a function to be called by exit or when a shared library is unloaded

Synopsis

int __cxa_atexit(void (*func) (void *), void * arg, void * dso_handle);

Description

As described in the Itanium™ C++ ABI, __cxa_atexit() registers a destructor function to be called by exit() or when a shared library is unloaded. When a shared library is unloaded, any destructor function associated with that shared library, identified by dso_handle, shall be called with the single argument arg, and then that function shall be removed, or marked as complete, from the list of functions to run at exit(). On a call to exit(), any remaining functions registered shall be called with the single argument arg. Destructor functions shall always be called in the reverse order to their registration (i.e. the most recently registered function shall be called first),

The __cxa_atexit() function is used to implement atexit(), as described in POSIX 1003.1-2001 (ISO/IEC 9945-2003). Calling atexit(func) from the statically linked part of an application shall be equivalent to __cxa_atexit(func, NULL, NULL).

__cxa_atexit() is not in the source standard; it is only in the binary standard.

Note: atexit() is not in the binary standard; it is only in the source standard.

__cxa_finalize

Name

__cxa_finalize -- call destructors of global (or local static) C++ objects and exit functions registered with atexit

Synopsis

void __cxa_finalize(void * d);

Description

As described in the Itanium® C++ ABI, the C runtime library shall maintain a list of termination function entries containing the following information:

  • A pointer to a termination function.

  • An operand to be passed to the function.

  • A handle identifying the home shared library of the entry.

The list is populated by entries of two kinds:

  • Destructors of global (or local static) C++ objects that require destruction on exit.

  • Functions registered by the user with atexit().

In the former case an entry consists of a pointer to the destructor, a pointer to the corresponding object and a handle for the home shared library of the object. In the latter case the pointer to the function is the pointer passed to atexit(), while the other pointers are NULL.

When __cxa_finalize(d) is called, it shall walk the termination function list, calling each in turn if d matches the handle of the termination function entry. If d is NULL, it shall call all the termination funtions. Multiple calls to __cxa_finalize shall not result in calling termination function entries multiple times; the implementation may either remove entries or mark them finished. The termination functions shall always be called in the reverse order of their registration (i.e. the most recently registered function shall be called first).

An application shall not call __cxa_finalize() directly. The implementation shall arrange for__cxa_finalize() to be called during early shared library unload (e.g. dlclose()) with a handle to the shared library. When the main program calls exit, the implementation shall cause any remaining __cxa_atexit-registered functions to be called, either by calling __cxa_finalize(NULL), or by walking the registration list itself.

__cxa_finalize() is not in the source standard; it is only in the binary standard.

__daylight

Name

__daylight -- external daylight savings time flag

Synopsis

int __daylight;

Description

The external variable __daylight shall implement the daylight savings time flag daylight as specified in POSIX 1003.1-2001 (ISO/IEC 9945-2003). __daylight has the same specification as daylight.

__environ

Name

__environ -- alias for environ - user environment

Synopsis

extern char **__environ;

Description

The external variable __environ shall implement the environment variable environ as specified in POSIX 1003.1-2001 (ISO/IEC 9945-2003). __environ has the same specification as environ.

__errno_location

Name

__errno_location -- address of errno variable

Synopsis

int * __errno_location(void);

Description

The __errno_location() function shall return the address of the errno variable for the current thread.

__errno_location() is not in the source standard; it is only in the binary standard.

__fgets_chk

Name

__fgets_chk -- string input, with buffer overflow checking

Synopsis

#include <stdio.h>

char * __fgets_chk(char * s, size_t size, int strsize, FILE * stream);

Description

The interface __fgets_chk() shall function in the same way as the interface fgets(), except that __fgets_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter strsize specifies the size of the object pointed to by stream.

The __fgets_chk() function is not in the source standard; it is only in the binary standard.

__fgets_unlocked_chk

Name

__fgets_unlocked_chk -- non-locking string input, with buffer overflow checking

Synopsis

#include <stdio.h>

char * __fgets_unlocked_chk(char * s, size_t size, int strsize, FILE * stream);

Description

The interface __fgets_unlocked_chk() shall function in the same way as the interface fgets_unlocked(), except that __fgets_unlocked_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter strsize specifies the size of the object pointed to by stream.

The __fgets_unlocked_chk() function is not in the source standard; it is only in the binary standard.

__fgetws_chk

Name

__fgetws_chk -- read a wide-character string from a FILE stream, with buffer overflow checking

Synopsis

#include <wchar.h>

wchar_t * __fgetws_chk(wchar_t * ws, size_t size, int strsize, FILE * stream);

Description

The interface __fgetws_chk() shall function in the same way as the interface fgetws(), except that __fgetws_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter strsize specifies the size of the object pointed to by stream.

The __fgetws_chk() function is not in the source standard; it is only in the binary standard.

__fgetws_unlocked_chk

Name

__fgetws_unlocked_chk -- read a wide-character string from a FILE stream in a non-locking manner, with stack checking

Synopsis

#include <wchar.h>

wchar_t * __fgetws_unlocked_chk(wchar_t * ws, size_t strsize, int n, FILE * stream);

Description

The interface __fgetws_unlocked_chk() shall function in the same way as the interface fgetws_unlocked(), except that __fgetws_unlocked_chk() shall check for stack overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter strsize specifies the size of the object pointed to by stream.

The __fgetws_unlocked_chk() function is not in the source standard; it is only in the binary standard.

__fpending

Name

__fpending -- returns in bytes the amount of output pending on a stream

Synopsis

size_t __fpending(FILE * stream);

Description

__fpending() returns the amount of output in bytes pending on a stream.

__fpending() is not in the source standard; it is only in the binary standard.

__fprintf_chk

Name

__fprintf_chk -- convert formatted output, with stack checking

Synopsis

#include <libc.h>

int __fprintf_chk(FILE * stream, int flag, const char * format);

Description

The interface __fprintf_chk() shall function in the same way as the interface fprintf(), except that __fprintf_chk() shall check for stack overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The __fprintf_chk() function is not in the source standard; it is only in the binary standard.

__fwprintf_chk

Name

__fwprintf_chk -- convert formatted wide-character output, with stack checking

Synopsis

#include <wchar.h>

int __fwprintf_chk(FILE * stream, int flag, const wchar_t * format);

Description

The interface __fwprintf_chk() shall function in the same way as the interface fwprintf(), except that __fwprintf_chk() shall check for stack overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The __fwprintf_chk() function is not in the source standard; it is only in the binary standard.

__fxstatat

Name

__fxstatat -- get file status relative to directory file descriptor

Synopsis

#include <fcntl.h>
#include <sys/stat.h>

int __fxstatat(int ver, int dirfd, const char * path, struct stat * stat_buf, int flags);

Description

The __fxstatat() function shall implement the fstatat() function. The behavior of __fxstatat() for values of ver other than _STAT_VER is undefined. See Data Definitions in the architecture specific part of this specification for the correct value of _STAT_VER.

__fxstatat(_STAT_VER, dirfd, stat_buf, flags) shall behave as fstatat(dirfd, stat_buf, flags) as specified by POSIX 1003.1-2008 (ISO/IEC 9945-2009).

__fxstatat() is not in the source standard; it is only in the binary standard.

Note: The fstatat() function is not in the binary standard; it is only in the source standard.

__fxstatat64, fstatat64

Name

__fxstatat64, fstatat64 -- get file status relative to a directory file descriptor (Large File Support)

Synopsis

#include <fcntl.h>
#include <sys/stat.h>

int __fxstatat64(int ver, int dirfd, const char * path, struct stat64 * stat_buf, int flags);

int fstatat64(int dirfd, const char * file, struct stat64 * buf, int flag);

Description

fstatat64() is a large-file version of the fstatat() function as defined in POSIX 1003.1-2008 (ISO/IEC 9945-2009). It differs from fstatat() only in that the buf parameter refers to a large-file version of the stat structure.

The __fxstatat64() function shall implement the fstatat64() function. The behavior of __fxstatat64() for values of ver other than _STAT_VER is undefined. See Data Definitions in the architecture specific part of this specification for the correct value of _STAT_VER.

__fxstatat64(_STAT_VER, dirfd, stat_buf, flags) shall behave as fstatat64(dirfd, stat_buf, flags)

__fxstatat64() is not in the source standard; it is only in the binary standard.

Note: The fstatat64() function is not in the binary standard; it is only in the source standard.

__getcwd_chk

Name

__getcwd_chk -- get current working directory, with buffer overflow checking

Synopsis

#include <unistd.h>

char * __getcwd_chk(char * buf, size_t len, size_t buflen);

Description

The interface __getcwd_chk() shall function in the same way as the interface getcwd(), except that __getcwd_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter buflen specifies the size of the buffer buf. If len exceeds buflen, the function shall abort, and the program calling it shall exit.

The __getcwd_chk() function is not in the source standard; it is only in the binary standard.

__getgroups_chk

Name

__getgroups_chk -- get list of supplementary group IDs, with buffer overflow checking

Synopsis

#include <unistd.h>

int __getgroups_chk(int size, gid_t * list, size_t listlen);

Description

The interface __getgroups_chk() shall function in the same way as the interface getgroups(), except that __getgroups_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter listlen specifies the size in bytes of the object list.

The __getgroups_chk() function is not in the source standard; it is only in the binary standard.

__gethostname_chk

Name

__gethostname_chk -- get host name, with buffer overflow checking

Synopsis

#include <unistd.h>

int __gethostname_chk(char * buf, size_t buflen, size_t maxlen);

Description

The interface __gethostname_chk() shall function in the same way as the interface gethostname(), except that __gethostname_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter buflen specifies the size of the buffer buf. If buflen exceeds maxlen, the function shall abort, and the program calling it shall exit.

The __gethostname_chk() function is not in the source standard; it is only in the binary standard.

__getlogin_r_chk

Name

__getlogin_r_chk -- get user name, with buffer overflow checking (reentrant)

Synopsis

#include <unistd.h>

int __getlogin_r_chk(char * buf, size_t buflen, size_t maxlen);

Description

The interface __getlogin_r_chk() shall function in the same way as the interface getlogin_r(), except that __getlogin_r_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter buflen specifies the size of the buffer buf. If buflen exceeds maxlen, the function shall abort, and the program calling it shall exit.

The __getlogin_r_chk() function is not in the source standard; it is only in the binary standard.

__getpagesize

Name

__getpagesize -- alias for getpagesize - get current page size

Synopsis

int __getpagesize(void);

Description

__getpagesize() is an alias for getpagesize() - get current page size.

__getpagesize() has the same specification as getpagesize().

__getpagesize() is not in the source standard; it is only in the binary standard.

__getpgid

Name

__getpgid -- get the process group id

Synopsis

pid_t __getpgid(pid_t pid);

Description

__getpgid() has the same specification as getpgid().

__getpgid() is not in the source standard; it is only in the binary standard.

__h_errno_location

Name

__h_errno_location -- address of h_errno variable

Synopsis

int * __h_errno_location(void);

Description

__h_errno_location() returns the address of the h_errno variable, where h_errno is as specified in POSIX 1003.1-2001 (ISO/IEC 9945-2003).

__h_errno_location() is not in the source standard; it is only in the binary standard. Note that h_errno itself is only in the source standard; it is not in the binary standard.

__isinf

Name

__isinf -- test for infinity

Synopsis

int __isinf(double arg);

Description

__isinf() has the same specification as isinf() in POSIX 1003.1-2001 (ISO/IEC 9945-2003), except that the argument type for __isinf() is known to be double.

__isinf() is not in the source standard; it is only in the binary standard.

__isinff

Name

__isinff -- test for infinity

Synopsis

int __isinff(float arg);

Description

__isinff() has the same specification as isinf() in POSIX 1003.1-2001 (ISO/IEC 9945-2003) except that the argument type for __isinff() is known to be float.

__isinff() is not in the source standard; it is only in the binary standard.

__isinfl

Name

__isinfl -- test for infinity

Synopsis

int __isinfl(long double arg);

Description

__isinfl() has the same specification as isinf() in the POSIX 1003.1-2001 (ISO/IEC 9945-2003), except that the argument type for __isinfl() is known to be long double.

__isinfl() is not in the source standard; it is only in the binary standard.

__isnan

Name

__isnan -- test for infinity

Synopsis

int __isnan(double arg);

Description

__isnan() has the same specification as isnan() in POSIX 1003.1-2001 (ISO/IEC 9945-2003), except that the argument type for __isnan() is known to be double.

__isnan() is not in the source standard; it is only in the binary standard.

__isnanf

Name

__isnanf -- test for infinity

Synopsis

int __isnanf(float arg);

Description

__isnanf() has the same specification as isnan() in POSIX 1003.1-2001 (ISO/IEC 9945-2003), except that the argument type for __isnanf() is known to be float.

__isnanf() is not in the source standard; it is only in the binary standard.

__isnanl

Name

__isnanl -- test for infinity

Synopsis

int __isnanl(long double arg);

Description

__isnanl() has the same specification as isnan() in POSIX 1003.1-2001 (ISO/IEC 9945-2003), except that the argument type for __isnanl() is known to be long double.

__isnanl() is not in the source standard; it is only in the binary standard.

__libc_current_sigrtmax

Name

__libc_current_sigrtmax -- return number of available real-time signal with lowest priority

Synopsis

int __libc_current_sigrtmax(void);

Description

__libc_current_sigrtmax() returns the number of an available real-time signal with the lowest priority.

__libc_current_sigrtmax() is not in the source standard; it is only in the binary standard.

__libc_current_sigrtmin

Name

__libc_current_sigrtmin -- return number of available real-time signal with highest priority

Synopsis

int __libc_current_sigrtmin(void);

Description

__libc_current_sigrtmin() returns the number of an available real-time signal with the highest priority.

__libc_current_sigrtmin() is not in the source standard; it is only in the binary standard.

__libc_start_main

Name

__libc_start_main -- initialization routine

Synopsis

int __libc_start_main(int (*main) (int, char **, char **), int argc, char ** ubp_av, void (*init) (void), void (*fini) (void), void (*rtld_fini) (void), void (*stack_end));

Description

The __libc_start_main() function shall perform any necessary initialization of the execution environment, call the main function with appropriate arguments, and handle the return from main(). If the main() function returns, the return value shall be passed to the exit() function.

Note: While this specification is intended to be implementation independent, process and library initialization may include:

  • performing any necessary security checks if the effective user ID is not the same as the real user ID.

  • initialize the threading subsystem.

  • registering the rtld_fini to release resources when this dynamic shared object exits (or is unloaded).

  • registering the fini handler to run at program exit.

  • calling the initializer function (*init)().

  • calling main() with appropriate arguments.

  • calling exit() with the return value from main().

This list is an example only.

__libc_start_main() is not in the source standard; it is only in the binary standard.

See Also

The section on Process Initialization in each of the architecture specific parts of ISO/IEC 23360.

__mbsnrtowcs_chk

Name

__mbsnrtowcs_chk -- convert a multibyte string to a wide-character string, with buffer overflow checking

Synopsis

#include <wchar.h>

size_t __mbsnrtowcs_chk(wchar_t * dest, const char * * src, size_t nmc, size_t len, mbstate_t * ps, size_t destlen);

Description

The interface __mbsnrtowcs_chk() shall function in the same way as the interface mbsnrtowcs(), except that __mbsnrtowcs_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object dest. If len exceeds destlen, the function shall abort, and the program calling it shall exit.

The __mbsnrtowcs_chk() function is not in the source standard; it is only in the binary standard.

__mbsrtowcs_chk

Name

__mbsrtowcs_chk -- convert a multibyte string to a wide-character string, with buffer overflow checking

Synopsis

#include <wchar.h>

size_t __mbsrtowcs_chk(wchar_t * dest, const char * * src, size_t len, mbstate_t * ps, size_t destlen);

Description

The interface __mbsrtowcs_chk() shall function in the same way as the interface mbsrtowcs(), except that __mbsrtowcs_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object dest. If len exceeds destlen, the function shall abort, and the program calling it shall exit.

The __mbsrtowcs_chk() function is not in the source standard; it is only in the binary standard.

__mbstowcs_chk

Name

__mbstowcs_chk -- convert a multibyte string to a wide-character string, with buffer overflow checking

Synopsis

#include <stdlib.h>

size_t __mbstowcs_chk(wchar_t * dest, const char * src, size_t len, size_t destlen);

Description

The interface __mbstowcs_chk() shall function in the same way as the interface mbstowcs(), except that __mbstowcs_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object dest. If len exceeds destlen, the function shall abort, and the program calling it shall exit.

The __mbstowcs_chk() function is not in the source standard; it is only in the binary standard.

__memcpy_chk

Name

__memcpy_chk -- copy memory area, with buffer overflow checking

Synopsis

#include <string.h>

void * __memcpy_chk(void * dest, const void * src, size_t len, size_t destlen);

Description

The interface __memcpy_chk() shall function in the same way as the interface memcpy(), except that __memcpy_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object dest. If len exceeds destlen, the function shall abort, and the program calling it shall exit.

The __memcpy_chk() function is not in the source standard; it is only in the binary standard.

__memmove_chk

Name

__memmove_chk -- copy memory area, with buffer overflow checking

Synopsis

#include <string.h>

void * __memmove_chk(void * dest, const void * src, size_t len, size_t destlen);

Description

The interface __memmove_chk() shall function in the same way as the interface memmove(), except that __memmove_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object dest. If len exceeds destlen, the function shall abort, and the program calling it shall exit.

The __memmove_chk() function is not in the source standard; it is only in the binary standard.

__mempcpy

Name

__mempcpy -- copy given number of bytes of source to destination

Synopsis

#include <string.h>

void * __mempcpy(void * restrict dest, const void * restrict src, size_t n);

Description

__mempcpy() copies n bytes of src to dest, returning a pointer to the byte after the last written byte.

If copying takes place between objects that overlap, the behavior is undefined.

If either dest or src is a null pointer, the behavior is undefined.

If n is 0 and the other parameters are valid, the return value is dest.

__mempcpy() is not in the source standard; it is only in the binary standard.

__mempcpy_chk

Name

__mempcpy_chk -- copy memory area, with buffer overflow checking

Synopsis

#include <string.h>

void * __mempcpy_chk(void * dest, const void * src, size_t len, size_t destlen);

Description

The interface __mempcpy_chk() shall function in the same way as the interface mempcpy(), except that __mempcpy_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object dest. If len exceeds destlen, the function shall abort, and the program calling it shall exit.

The __mempcpy_chk() function is not in the source standard; it is only in the binary standard.

__memset_chk

Name

__memset_chk -- fill memory with a constant byte, using buffer overflow checking

Synopsis

#include <string.h>

void * __memset_chk(void * dest, int c, size_t len, size_t destlen);

Description

The interface __memset_chk() shall function in the same way as the interface memset(), except that __memset_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object dest. If len exceeds destlen, the function shall abort, and the program calling it shall exit.

The __memset_chk() function is not in the source standard; it is only in the binary standard.

__pread64_chk

Name

__pread64_chk -- read from a file descriptor at a given offset, with buffer overflow checking

Synopsis

#include <unistd.h>

ssize_t __pread64_chk(int fd, void * buf, size_t nbytes, off64_t offset, size_t buflen);

Description

The interface __pread64_chk() shall function in the same way as the interface pread64(), except that __pread64_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter buflen specifies the size of the buffer buf. If nbytes exceeds buflen, the function shall abort, and the program calling it shall exit.

The __pread64_chk() function is not in the source standard; it is only in the binary standard.

__pread_chk

Name

__pread_chk -- read from a file descriptor at a given offset, with buffer overflow checking

Synopsis

#include <unistd.h>

ssize_t __pread_chk(int fd, void * buf, size_t nbytes, off_t offset, size_t buflen);

Description

The interface __pread_chk() shall function in the same way as the interface pread(), except that __pread_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter buflen specifies the size of the buffer buf. If nbytes exceeds buflen, the function shall abort, and the program calling it shall exit.

The __pread_chk() function is not in the source standard; it is only in the binary standard.

__printf_chk

Name

__printf_chk -- format and print data, with stack checking

Synopsis

#include <stdio.h>

int __printf_chk(int flag, const char * format);

Description

The interface __printf_chk() shall function in the same way as the interface printf(), except that __printf_chk() shall check for stack overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The __printf_chk() function is not in the source standard; it is only in the binary standard.

__rawmemchr

Name

__rawmemchr -- scan memory

Synopsis

#include <string.h>

void * __rawmemchr(const void * s, int c);

Description

The __rawmemchr() function shall locate the first occurrence of c (converted to an unsigned char) in the object pointed to by s. If the byte does not occur in the object, then the behavior is undefined.

__rawmemchr() is a weak alias for rawmemchr(). It is similar to memchr(), but it has no length limit.

__rawmemchr() is not in the source standard; it is only in the binary standard.

Return Value

The __rawmemchr() function shall return a pointer to the located byte.

__read_chk

Name

__read_chk -- read from a file descriptor, with buffer overflow checking

Synopsis

#include <unistd.h>

ssize_t __read_chk(int fd, void * buf, size_t nbytes, size_t buflen);

Description

The interface __read_chk() shall function in the same way as the interface read(), except that __read_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter buflen specifies the size of the buffer buf. If nbytes exceeds buflen, the function shall abort, and the program calling it shall exit.

The __read_chk() function is not in the source standard; it is only in the binary standard.

__readlink_chk

Name

__readlink_chk -- display value of a symbolic link, with buffer overflow checking

Synopsis

#include <unistd.h>

ssize_t __readlink_chk(const char * path, char * buf, size_t len, size_t buflen);

Description

The interface __readlink_chk() shall function in the same way as the interface readlink(), except that __readlink_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter buflen specifies the size of the buffer buf. If len exceeds buflen, the function shall abort, and the program calling it shall exit.

The __readlink_chk() function is not in the source standard; it is only in the binary standard.

__realpath_chk

Name

__realpath_chk -- return the canonicalized absolute pathname, with buffer overflow checking

Synopsis

#include <stdlib.h>

char * __realpath_chk(const char * path, char * resolved_path, size_t resolved_len);

Description

The interface __realpath_chk() shall function in the same way as the interface realpath(), except that __realpath_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter resolved_len specifies the size of the string resolved_path. If resolved_len is less than PATH_MAX, then the function shall abort, and the program calling it shall exit.

The __realpath_chk() function is not in the source standard; it is only in the binary standard.

__recv_chk

Name

__recv_chk -- receive a message from a socket, with buffer overflow checking

Synopsis

#include <sys/socket.h>

ssize_t __recv_chk(int fd, void * buf, size_t len, size_t buflen, int flag);

Description

The interface __recv_chk() shall function in the same way as the interface recv(), except that __recv_chk() shall check for buffer overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the buffer, parameter values, and so on.

The parameter buflen specifies the size of the buffer buf. If len exceeds buflen, the function shall abort, and the program calling it shall exit.

The __recv_chk() function is not in the source standard; it is only in the binary standard.

__recvfrom_chk

Name

__recvfrom_chk -- receive a message from a socket, with buffer overflow checking

Synopsis

#include <sys/socket.h>

ssize_t __recvfrom_chk(int fd, void * buf, size_t len, size_t buflen, int flag, struct sockaddr * from, socklen_t * fromlen);

Description

The interface __recvfrom_chk() shall function in the same way as the interface recvfrom(), except that __recvfrom_chk() shall check for buffer overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the buffer, parameter values, and so on.

The parameter buflen specifies the size of the buffer buf. If len exceeds buflen, the function shall abort, and the program calling it shall exit.

The __recvfrom_chk() function is not in the source standard; it is only in the binary standard.

__register_atfork

Name

__register_atfork -- alias for register_atfork

Synopsis

int __register_atfork(void (*prepare) (void), void (*parent) (void), void (*child) (void), void *__dso_handle);

Description

__register_atfork() implements pthread_atfork() as specified in POSIX 1003.1-2001 (ISO/IEC 9945-2003). The additional parameter __dso_handle allows a shared object to pass in it's handle so that functions registered by __register_atfork() can be unregistered by the runtime when the shared object is unloaded.

__sigsetjmp

Name

__sigsetjmp -- save stack context for non-local goto

Synopsis

int __sigsetjmp(jmp_buf env, int savemask);

Description

__sigsetjmp() has the same behavior as sigsetjmp() as specified by POSIX 1003.1-2001 (ISO/IEC 9945-2003).

__sigsetjmp() is not in the source standard; it is only in the binary standard.

__snprintf_chk

Name

__snprintf_chk -- convert formatted output, with buffer overflow checking

Synopsis

#include <stdio.h>

int __snprintf_chk(char * str, size_t maxlen, int flag, size_t strlen, const char * format);

Description

The interface __snprintf_chk() shall function in the same way as the interface snprintf(), except that __snprintf_chk() shall check for buffer overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the buffer, parameter values, and so on.

The parameter strlen specifies the size of the buffer str. If strlen is less than maxlen, the function shall abort, and the program calling it shall exit.

The __snprintf_chk() function is not in the source standard; it is only in the binary standard.

__sprintf_chk

Name

__sprintf_chk -- convert formatted output, with stack checking

Synopsis

#include <stdio.h>

int __sprintf_chk(char * str, int flag, size_t strlen, const char * format);

Description

The interface __sprintf_chk() shall function in the same way as the interface sprintf(), except that __sprintf_chk() shall check for stack overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The parameter strlen specifies the size of the string str. If strlen is zero, the function shall abort, and the program calling it shall exit.

The __sprintf_chk() function is not in the source standard; it is only in the binary standard.

__stack_chk_fail

Name

__stack_chk_fail -- terminate a function in case of stack overflow

Synopsis

#include <libc.h>

void __stack_chk_fail(void);

Description

The interface __stack_chk_fail() shall abort the function that called it with a message that a stack overflow has been detected. The program that called the function shall then exit.

Application Usage (informative)

The interface __stack_chk_fail() does not check for a stack overflow itself. It merely reports one when invoked.

__stpcpy

Name

__stpcpy -- alias for stpcpy

Synopsis

#include <string.h>

char * __stpcpy(char * dest, const char * src);

Description

The __stpcpy() function has the same specification as the stpcpy().

__stpcpy() is not in the source standard; it is only in the binary standard.

__stpcpy_chk

Name

__stpcpy_chk -- copy a string returning a pointer to its end, with buffer overflow checking

Synopsis

#include <string.h>

char * __stpcpy_chk(char * dest, const char * src, size_t destlen);

Description

The interface __stpcpy_chk() shall function in the same way as the interface stpcpy(), except that __stpcpy_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object pointed to by dest.

The __stpcpy_chk() function is not in the source standard; it is only in the binary standard.

__stpncpy_chk

Name

__stpncpy_chk -- copy a fixed-size string, returning a pointer to its end, with buffer overflow checking

Synopsis

#include <libc.h>

char * __stpncpy_chk(char * dest, const char * src, size_t n, size_t destlen);

Description

The interface __stpncpy_chk() shall function in the same way as the interface stpncpy(), except that __stpncpy_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object pointed to by dest. If n exceeds destlen, the function shall abort, and the program calling it shall exit.

The __stpncpy_chk() function is not in the source standard; it is only in the binary standard.

__strcat_chk

Name

__strcat_chk -- concatenate two strings, with buffer overflow checking

Synopsis

#include <string.h>

char * __strcat_chk(char * dest, const char * src, size_t destlen);

Description

The interface __strcat_chk() shall function in the same way as the interface strcat(), except that __strcat_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object pointed to by dest.

The __strcat_chk() function is not in the source standard; it is only in the binary standard.

__strcpy_chk

Name

__strcpy_chk -- copy a string, with buffer overflow checking

Synopsis

#include <string.h>

char * __strcpy_chk(char * dest, const char * src, size_t destlen);

Description

The interface __strcpy_chk() shall function in the same way as the interface strcpy(), except that __strcpy_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object pointed to by dest.

The __strcpy_chk() function is not in the source standard; it is only in the binary standard.

__strdup

Name

__strdup -- alias for strdup

Synopsis

char * __strdup(const char * string);

Description

__strdup() has the same specification as strdup().

__strdup() is not in the source standard; it is only in the binary standard.

__strncat_chk

Name

__strncat_chk -- concatenate two strings, with buffer overflow checking

Synopsis

#include <string.h>

char * __strncat_chk(char * s1, const char * s2, size_t n, size_t s1len);

Description

The interface __strncat_chk() shall function in the same way as the interface strncat(), except that __strncat_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter s1len specifies the size of the object pointed to by s1.

The __strncat_chk() function is not in the source standard; it is only in the binary standard.

__strncpy_chk

Name

__strncpy_chk -- copy a string, with buffer overflow checking

Synopsis

#include <string.h>

char * __strncpy_chk(char * s1, const char * s2, size_t n, size_t s1len);

Description

The interface __strncpy_chk() shall function in the same way as the interface strncpy(), except that __strncpy_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter s1len specifies the size of the object pointed to by s1.

The __strncpy_chk() function is not in the source standard; it is only in the binary standard.

__strtod_internal

Name

__strtod_internal -- underlying function for strtod

Synopsis

double __strtod_internal(const char * __nptr, char * * __endptr, int __group);

Description

__group shall be 0 or the behavior of __strtod_internal() is undefined.

__strtod_internal(__nptr, __endptr, 0)() has the same specification as strtod(__nptr, __endptr)().

__strtod_internal() is not in the source standard; it is only in the binary standard.

__strtof_internal

Name

__strtof_internal -- underlying function for strtof

Synopsis

float __strtof_internal(const char * __nptr, char * * __endptr, int __group);

Description

__group shall be 0 or the behavior of __strtof_internal() is undefined.

__strtof_internal(__nptr, __endptr, 0)() has the same specification as strtof(__nptr, __endptr)().

__strtof_internal() is not in the source standard; it is only in the binary standard.

__strtok_r

Name

__strtok_r -- alias for strtok_r

Synopsis

char * __strtok_r(char * restrict s, const char * restrict delim, char * * restrict save_ptr);

Description

__strtok_r() has the same specification as strtok_r().

__strtok_r() is not in the source standard; it is only in the binary standard.

__strtol_internal

Name

__strtol_internal -- alias for strtol

Synopsis

long int __strtol_internal(const char * __nptr, char * * __endptr, int __base, int __group);

Description

__group shall be 0 or the behavior of __strtol_internal() is undefined.

__strtol_internal(__nptr, __endptr, __base, 0) has the same specification as strtol(__nptr, __endptr, __base).

__strtol_internal() is not in the source standard; it is only in the binary standard.

__strtold_internal

Name

__strtold_internal -- underlying function for strtold

Synopsis

long double __strtold_internal(const char * __nptr, char * * __endptr, int __group);

Description

__group shall be 0 or the behavior of __strtold_internal() is undefined.

__strtold_internal(__nptr, __endptr, 0) has the same specification as strtold(__nptr, __endptr).

__strtold_internal() is not in the source standard; it is only in the binary standard.

__strtoll_internal

Name

__strtoll_internal -- underlying function for strtoll

Synopsis

long long __strtoll_internal(const char * __nptr, char * * __endptr, int __base, int __group);

Description

__group shall be 0 or the behavior of __strtoll_internal() is undefined.

__strtoll_internal(__nptr, __endptr, __base, 0) has the same specification as strtoll(__nptr, __endptr, __base).

__strtoll_internal() is not in the source standard; it is only in the binary standard.

__strtoul_internal

Name

__strtoul_internal -- underlying function for strtoul

Synopsis

unsigned long int __strtoul_internal(const char * __nptr, char * * __endptr, int __base, int __group);

Description

__group shall be 0 or the behavior of __strtoul_internal() is undefined.

__strtoul_internal(__nptr, __endptr, __base, 0) has the same specification as strtoul(__nptr, __endptr, __base).

__strtoul_internal() is not in the source standard; it is only in the binary standard.

__strtoull_internal

Name

__strtoull_internal -- underlying function for strtoull

Synopsis

unsigned long long __strtoull_internal(const char * __nptr, char * * __endptr, int __base, int __group);

Description

__group shall be 0 or the behavior of __strtoull_internal() is undefined.

__strtoull_internal(__nptr, __endptr, __base, 0) has the same specification as strtoull(__nptr, __endptr, __base).

__strtoull_internal() is not in the source standard; it is only in the binary standard.

__swprintf_chk

Name

__swprintf_chk -- convert formatted wide-character output, with stack checking

Synopsis

#include <wchar.h>

int __swprintf_chk(wchar_t * s, size_t n, int flag, size_t slen, const wchar_t * format);

Description

The interface __swprintf_chk() shall function in the same way as the interface swprintf(), except that __swprintf_chk() shall check for stack overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The parameter slen specifies the size of the object pointed to by s. If slen is less than maxlen, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The __swprintf_chk() function is not in the source standard; it is only in the binary standard.

__sysconf

Name

__sysconf -- get configuration information at runtime

Synopsis

#include <unistd.h>

long __sysconf(int name);

Description

__sysconf() gets configuration information at runtime.

__sysconf() is weak alias to sysconf().

__sysconf() has the same specification as sysconf().

__sysconf() is not in the source standard; it is only in the binary standard.

__syslog_chk

Name

__syslog_chk -- send messages to the system logger, with stack checking

Synopsis

#include <syslog.h>

void __syslog_chk(int priority, int flag, const char * format);

Description

The interface __syslog_chk() shall function in the same way as the interface syslog(), except that __syslog_chk() shall check for stack overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The __syslog_chk() function is not in the source standard; it is only in the binary standard.

__sysv_signal

Name

__sysv_signal -- signal handling

Synopsis

__sighandler_t __sysv_signal(int sig, __sighandler_t handler);

Description

__sysv_signal() has the same behavior as signal() as specified by POSIX 1003.1-2001 (ISO/IEC 9945-2003).

__sysv_signal() is not in the source standard; it is only in the binary standard.

__timezone

Name

__timezone -- external variable containing timezone

Synopsis

long int __timezone;

Description

The external variable __timezone shall implement the timezone variable timezone as specified in POSIX 1003.1-2001 (ISO/IEC 9945-2003). __timezone has the same specification as timezone.

__ttyname_r_chk

Name

__ttyname_r_chk -- return name of a terminal, with buffer overflow checking (reentrant)

Synopsis

#include <unistd.h>

int __ttyname_r_chk(int fd, char * buf, size_t buflen, size_t nreal);

Description

The interface __ttyname_r_chk() shall function in the same way as the interface ttyname_r(), except that __ttyname_r_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter buflen specifies the size of the object pointed to by buf. If buflen exceeds nreal, the function shall abort and the program calling it shall exit.

The __ttyname_r_chk() function is not in the source standard; it is only in the binary standard.

__tzname

Name

__tzname -- external variable containing the timezone names

Synopsis

char * __tzname[2];

Description

The external variable __tzname shall implement the timezone name variable tzname as specified in POSIX 1003.1-2001 (ISO/IEC 9945-2003) function tzset(). __tzname has the same specification as tzname.

__vfprintf_chk

Name

__vfprintf_chk -- convert formatted output, with stack checking

Synopsis

#include <libc.h>

int __vfprintf_chk(FILE * fp, int flag, const char * format, va_list ap);

Description

The interface __vfprintf_chk() shall function in the same way as the interface vfprintf(), except that __vfprintf_chk() shall check for stack overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The __vfprintf_chk() function is not in the source standard; it is only in the binary standard.

__vfwprintf_chk

Name

__vfwprintf_chk -- convert formatted wide-character output, with stack checking

Synopsis

#include <wchar.h>

int __vfwprintf_chk(FILE * fp, int flag, const wchar_t * format, va_list ap);

Description

The interface __vfwprintf_chk() shall function in the same way as the interface vfwprintf(), except that __vfwprintf_chk() shall check for stack overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The __vfwprintf_chk() function is not in the source standard; it is only in the binary standard.

__vprintf_chk

Name

__vprintf_chk -- convert formatted output, with stack checking

Synopsis

#include <stdio.h>

int __vprintf_chk(int flag, const char * format, va_list ap);

Description

The interface __vprintf_chk() shall function in the same way as the interface vprintf(), except that __vprintf_chk() shall check for stack overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The __vprintf_chk() function is not in the source standard; it is only in the binary standard.

__vsnprintf_chk

Name

__vsnprintf_chk -- convert formatted output, with stack checking

Synopsis

#include <stdio.h>

int __vsnprintf_chk(char * s, size_t maxlen, int flag, size_t slen, const char * format, va_list args);

Description

The interface __vsnprintf_chk() shall function in the same way as the interface vsnprintf(), except that __vsnprintf_chk() shall check for stack overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The parameter slen specifies the size of the object pointed to by s. If slen is less than maxlen, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The __vsnprintf_chk() function is not in the source standard; it is only in the binary standard.

__vsprintf_chk

Name

__vsprintf_chk -- convert formatted output, with stack checking

Synopsis

#include <stdio.h>

int __vsprintf_chk(char * s, int flag, size_t slen, const char * format, va_list args);

Description

The interface __vsprintf_chk() shall function in the same way as the interface vsprintf(), except that __vsprintf_chk() shall check for stack overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The parameter slen specifies the size of the object pointed to by s. If its value is zero, the function shall abort and the program calling it shall exit.

The __vsprintf_chk() function is not in the source standard; it is only in the binary standard.

__vswprintf_chk

Name

__vswprintf_chk -- convert formatted wide-character output, with stack checking

Synopsis

#include <wchar.h>

int __vswprintf_chk(wchar_t * s, size_t maxlen, int flag, size_t slen, const wchar_t * format, va_list args);

Description

The interface __vswprintf_chk() shall function in the same way as the interface vswprintf(), except that __vswprintf_chk() shall check for stack overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The parameter slen specifies the size of the object pointed to by s. If slen is less than maxlen, the function shall abort and the program calling it shall exit.

The __vswprintf_chk() function is not in the source standard; it is only in the binary standard.

__vsyslog_chk

Name

__vsyslog_chk -- send messages to the system logger, with stack checking

Synopsis

#include <syslog.h>

void __vsyslog_chk(int priority, int flag, const char * format, va_list ap);

Description

The interface __vsyslog_chk() shall function in the same way as the interface vsyslog(), except that __vsyslog_chk() shall check for stack overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The __vsyslog_chk() function is not in the source standard; it is only in the binary standard.

__vwprintf_chk

Name

__vwprintf_chk -- convert formatted wide-character output, with stack checking

Synopsis

#include <wchar.h>

int __vwprintf_chk(int flag, const wchar_t * format, va_list ap);

Description

The interface __vwprintf_chk() shall function in the same way as the interface vwprintf(), except that __vwprintf_chk() shall check for stack overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The __vwprintf_chk() function is not in the source standard; it is only in the binary standard.

__wcpcpy_chk

Name

__wcpcpy_chk -- copy a wide-character string, returning a pointer to its end, with buffer overflow checking

Synopsis

#include <wchar.h>

wchar_t * __wcpcpy_chk(wchar_t * dest, const wchar_t * src, size_t destlen);

Description

The interface __wcpcpy_chk() shall function in the same way as the interface wcpcpy(), except that __wcpcpy_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object pointed to by dest.

The __wcpcpy_chk() function is not in the source standard; it is only in the binary standard.

__wcpncpy_chk

Name

__wcpncpy_chk -- copy a fixed-size string of wide characters, returning a pointer to its end, with buffer overflow checking

Synopsis

#include <wchar.h>

wchar_t * __wcpncpy_chk(wchar_t * dest, const wchar_t * src, size_t n, size_t destlen);

Description

The interface __wcpncpy_chk() shall function in the same way as the interface wcpncpy(), except that __wcpncpy_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object pointed to by dest. If n exceeds destlen, the function shall abort and the program calling it shall exit.

The __wcpncpy_chk() function is not in the source standard; it is only in the binary standard.

__wcrtomb_chk

Name

__wcrtomb_chk -- convert a wide character to a multibyte sequence, with buffer overflow checking

Synopsis

#include <wchar.h>

size_t __wcrtomb_chk(char * s, wchar_t wchar, mbstate_t * ps, size_t buflen);

Description

The interface __wcrtomb_chk() shall function in the same way as the interface wcrtomb(), except that __wcrtomb_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter buflen specifies the size of the object pointed to by s. If it is less than MB_CUR_MAX, then the function shall abort and the program calling it shall exit.

The __wcrtomb_chk() function is not in the source standard; it is only in the binary standard.

__wcscat_chk

Name

__wcscat_chk -- concatenate two wide-character strings, with buffer overflow checking

Synopsis

#include <wchar.h>

wchar_t * __wcscat_chk(wchar_t * dest, const wchar_t * src, size_t destlen);

Description

The interface __wcscat_chk() shall function in the same way as the interface wcscat(), except that __wcscat_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object pointed to by dest.

The __wcscat_chk() function is not in the source standard; it is only in the binary standard.

__wcscpy_chk

Name

__wcscpy_chk -- copy a wide-character string, with buffer overflow checking

Synopsis

#include <wchar.h>

wchar_t * __wcscpy_chk(wchar_t * dest, const wchar_t * src, size_t n);

Description

The interface __wcscpy_chk() shall function in the same way as the interface wcscpy(), except that __wcscpy_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The __wcscpy_chk() function is not in the source standard; it is only in the binary standard.

__wcsncat_chk

Name

__wcsncat_chk -- concatenate two wide-character strings, with buffer overflow checking

Synopsis

#include <wchar.h>

wchar_t * __wcsncat_chk(wchar_t * dest, const wchar_t * src, size_t n, size_t destlen);

Description

The interface __wcsncat_chk() shall function in the same way as the interface wcsncat(), except that __wcsncat_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object pointed to by dest.

The __wcsncat_chk() function is not in the source standard; it is only in the binary standard.

__wcsncpy_chk

Name

__wcsncpy_chk -- copy a fixed-size string of wide characters, with buffer overflow checking

Synopsis

#include <wchar.h>

wchar_t * __wcsncpy_chk(wchar_t * dest, const wchar_t * src, size_t n, size_t destlen);

Description

The interface __wcsncpy_chk() shall function in the same way as the interface wcsncpy(), except that __wcsncpy_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object pointed to by dest. If len exceeds destlen, the function shall abort and the program calling it shall exit.

The __wcsncpy_chk() function is not in the source standard; it is only in the binary standard.

__wcsnrtombs_chk

Name

__wcsnrtombs_chk -- convert a wide-character string to a multibyte string, with buffer overflow checking

Synopsis

#include <wchar.h>

size_t __wcsnrtombs_chk(char * dest, const wchar_t * * src, size_t nwc, size_t len, mbstate_t * ps, size_t destlen);

Description

The interface __wcsnrtombs_chk() shall function in the same way as the interface wcsnrtombs(), except that __wcsnrtombs_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object pointed to by dest. If len exceeds destlen, the function shall abort and the program calling it shall exit.

The __wcsnrtombs_chk() function is not in the source standard; it is only in the binary standard.

__wcsrtombs_chk

Name

__wcsrtombs_chk -- convert a wide-character string to a multibyte string, with buffer overflow checking

Synopsis

#include <wchar.h>

size_t __wcsrtombs_chk(char * dest, const wchar_t * * src, size_t len, mbstate_t * ps, size_t destlen);

Description

The interface __wcsrtombs_chk() shall function in the same way as the interface wcsrtombs(), except that __wcsrtombs_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object pointed to by dest. If len exceeds destlen, the function shall abort and the program calling it shall exit.

The __wcsrtombs_chk() function is not in the source standard; it is only in the binary standard.

__wcstod_internal

Name

__wcstod_internal -- underlying function for wcstod

Synopsis

double __wcstod_internal(const wchar_t * nptr, wchar_t * * endptr, int group);

Description

group shall be 0 or the behavior of __wcstod_internal() is undefined.

__wcstod_internal(nptr, endptr, 0) shall behave as wcstod(nptr, endptr) as specified by POSIX 1003.1-2001 (ISO/IEC 9945-2003).

__wcstod_internal() is not in the source standard; it is only in the binary standard.

__wcstof_internal

Name

__wcstof_internal -- underlying function for wcstof

Synopsis

float __wcstof_internal(const wchar_t * nptr, wchar_t * * endptr, int group);

Description

group shall be 0 or the behavior of __wcstof_internal() is undefined.

__wcstof_internal(nptr, endptr, 0) shall behave as wcstof(nptr, endptr) as specified in POSIX 1003.1-2001 (ISO/IEC 9945-2003).

__wcstof_internal() is not in the source standard; it is only in the binary standard.

__wcstol_internal

Name

__wcstol_internal -- underlying function for wcstol

Synopsis

long __wcstol_internal(const wchar_t * nptr, wchar_t * * endptr, int base, int group);

Description

group shall be 0 or the behavior of __wcstol_internal() is undefined.

__wcstol_internal(nptr, endptr, base, 0) shall behave as wcstol(nptr, endptr, base) as specified by POSIX 1003.1-2001 (ISO/IEC 9945-2003).

__wcstol_internal() is not in the source standard; it is only in the binary standard.

__wcstold_internal

Name

__wcstold_internal -- underlying function for wcstold

Synopsis

long double __wcstold_internal(const wchar_t * nptr, wchar_t * * endptr, int group);

Description

group shall be 0 or the behavior of __wcstold_internal() is undefined.

__wcstold_internal(nptr, endptr, 0) shall behave as wcstold(nptr, endptr) as specified by POSIX 1003.1-2001 (ISO/IEC 9945-2003).

__wcstold_internal() is not in the source standard; it is only in the binary standard.

__wcstombs_chk

Name

__wcstombs_chk -- convert a wide-character string to a multibyte string, with buffer overflow checking

Synopsis

#include <stdlib.h>

size_t __wcstombs_chk(char * dest, const wchar_t * src, size_t len, size_t destlen);

Description

The interface __wcstombs_chk() shall function in the same way as the interface wcstombs(), except that __wcstombs_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object pointed to by dest. If len exceeds destlen, the function shall abort and the program calling it shall exit.

The __wcstombs_chk() function is not in the source standard; it is only in the binary standard.

__wcstoul_internal

Name

__wcstoul_internal -- underlying function for wcstoul

Synopsis

unsigned long __wcstoul_internal(const wchar_t * restrict nptr, wchar_t * * restrict endptr, int base, int group);

Description

group shall be 0 or the behavior of __wcstoul_internal() is undefined.

__wcstoul_internal(nptr, endptr, base, 0)() shall behave as wcstoul(nptr, endptr, base)() as specified by POSIX 1003.1-2001 (ISO/IEC 9945-2003).

__wcstoul_internal() is not in the source standard; it is only in the binary standard.

__wctomb_chk

Name

__wctomb_chk -- convert a wide character to a multibyte sequence, with buffer overflow checking

Synopsis

#include <stdlib.h>

int __wctomb_chk(char * s, wchar_t wchar, size_t buflen);

Description

The interface __wctomb_chk() shall function in the same way as the interface wctomb(), except that __wctomb_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter buflen specifies the size of the object pointed to by s. If it is less than MB_CUR_MAX, then the function shall abort and the program calling it shall exit.

The __wctomb_chk() function is not in the source standard; it is only in the binary standard.

__wmemcpy_chk

Name

__wmemcpy_chk -- copy an array of wide-characters, with buffer overflow checking

Synopsis

#include <wchar.h>

wchar_t * __wmemcpy_chk(wchar_t * s1, const wchar_t * s2, size_t n, size_t ns1);

Description

The interface __wmemcpy_chk() shall function in the same way as the interface wmemcpy(), except that __wmemcpy_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter ns1 specifies the size of the object pointed to by s1. If n exceeds ns1, the function shall abort and the program calling it shall exit.

The __wmemcpy_chk() function is not in the source standard; it is only in the binary standard.

__wmemmove_chk

Name

__wmemmove_chk -- copy an array of wide-characters, with buffer overflow checking

Synopsis

#include <wchar.h>

wchar_t * __wmemmove_chk(wchar_t * s1, const wchar_t * s2, size_t n, size_t ns1);

Description

The interface __wmemmove_chk() shall function in the same way as the interface wmemmove(), except that __wmemmove_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter ns1 specifies the size of the object pointed to by s1. If n exceeds ns1, the function shall abort and the program calling it shall exit.

The __wmemmove_chk() function is not in the source standard; it is only in the binary standard.

__wmempcpy_chk

Name

__wmempcpy_chk -- copy memory area, with buffer overflow checking

Synopsis

#include <wchar.h>

wchar_t * __wmempcpy_chk(wchar_t * s1, const wchar_t * s2, size_t n, size_t ns1);

Description

The interface __wmempcpy_chk() shall function in the same way as the interface wmempcpy(), except that __wmempcpy_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter ns1 specifies the size of the object pointed to by s1. If n exceeds ns1, the function shall abort and the program calling it shall exit.

The __wmempcpy_chk() function is not in the source standard; it is only in the binary standard.

__wmemset_chk

Name

__wmemset_chk -- fill an array of wide-characters with a constant wide character, with buffer overflow checking

Synopsis

#include <wchar.h>

wchar_t * __wmemset_chk(wchar_t * s, wchar_t c, size_t n, size_t destlen);

Description

The interface __wmemset_chk() shall function in the same way as the interface wmemset(), except that __wmemset_chk() shall check for buffer overflow before computing a result. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

The parameter destlen specifies the size of the object pointed to by s. If n exceeds destlen, the function shall abort and the program calling it shall exit.

The __wmemset_chk() function is not in the source standard; it is only in the binary standard.

__wprintf_chk

Name

__wprintf_chk -- convert formatted wide-character output, with stack checking

Synopsis

#include <wchar.h>

int __wprintf_chk(int flag, const wchar_t * format);

Description

The interface __wprintf_chk() shall function in the same way as the interface wprintf(), except that __wprintf_chk() shall check for stack overflow before computing a result, depending on the value of the flag parameter. If an overflow is anticipated, the function shall abort and the program calling it shall exit.

In general, the higher the value of flag, the more security measures this interface shall take in the form of checking the stack, parameter values, and so on.

The __wprintf_chk() function is not in the source standard; it is only in the binary standard.

__xmknod

Name

__xmknod -- make a special file

Synopsis

#include <sys/stat.h>

int __xmknod(int ver, const char * path, mode_t mode, dev_t * dev);

Description

The __xmknod() function shall implement the mknod() interface. The behavior of __xmknod() for values of ver other than _MKNOD_VER is undefined. See Data Definitions in the architecture specific part of this specification for the correct value of _MKNOD_VER.

__xmknod(_MKNOD_VER, path, mode, dev) shall behave as mknod(path, mode, dev) as specified by POSIX 1003.1-2001 (ISO/IEC 9945-2003).

The __xmknod() function is not in the source standard; it is only in the binary standard.

Note: The mknod() function is not in the binary standard; it is only in the source standard.

__xmknodat

Name

__xmknodat -- make a special file relative to a directory file descriptor

Synopsis

#include <sys/stat.h>

int __xmknodat(int ver, int dirfd, const char * path, mode_t path, dev_t * dev);

Description

The __xmknodat() function shall implement the mknodat() function. The behavior of __xmknodat() for values of ver other than _MKNOD_VER is undefined. See Data Definitions in the architecture specific part of this specification for the correct value of _MKNOD_VER.

__xmknodat(_MKNOD_VER, dirfd, path, mode, dev) shall behave as mknodat(dirfd, path, mode, dev) as specified by POSIX 1003.1-2008 (ISO/IEC 9945-2009).

The __xmknodat() function is not in the source standard; it is only in the binary standard.

Note: The mknodat() function is not in the binary standard; it is only in the source standard.

__xpg_basename

Name

__xpg_basename -- return the last component of a file name

Synopsis

#include <libgen.h>

char * __xpg_basename(const char * path);

Description

The __xpg_basename() function shall return a pointer to the final component of the pathname named by path, as described in POSIX 1003.1-2001 (ISO/IEC 9945-2003) basename().

This function is not in the source standard, it is only in the binary standard.

__xpg_sigpause

Name

__xpg_sigpause -- remove a signal from the signal mask and suspend the thread

Synopsis

#include <signal.h>

int __xpg_sigpause(int sig);

Description

The __xpg_sigpause() function shall implement the sigpause() described in POSIX 1003.1-2001 (ISO/IEC 9945-2003).

This function is not in the source standard, it is only in the binary standard.

__xpg_strerror_r

Name

__xpg_strerror_r -- return string describing error number

Synopsis

#include <string.h>

int __xpg_strerror_r(int errnum, char * buf, size_t buflen);

Description

The __xpg_strerror_r() function shall map the error number in errnum to a locale-dependent error message string and shall return the string in the buffer pointed to by strerrbuf, with length buflen, as described in POSIX 1003.1-2001 (ISO/IEC 9945-2003) strerror_r().

This function is not in the source standard, it is only in the binary standard.

__xstat

Name

__xstat -- get File Status

Synopsis

#include <sys/stat.h>
#include <unistd.h>

int __xstat(int ver, const char * path, struct stat * stat_buf);

int __lxstat(int ver, const char * path, struct stat * stat_buf);

int __fxstat(int ver, int fildes, struct stat * stat_buf);

Description

The functions __xstat(), __lxstat(), and __fxstat() shall implement the functions stat(), lstat(), and fstat() respectively.

The behavior of these functions for values of ver other than _STAT_VER is undefined. See Data Definitions in the architecture specific part of this specification for the correct value of _STAT_VER.

__xstat(_STAT_VER, path, stat_buf) shall implement stat(path, stat_buf) as specified by POSIX 1003.1-2001 (ISO/IEC 9945-2003).

__lxstat(_STAT_VER, path, stat_buf) shall implement lstat(path, stat_buf) as specified by POSIX 1003.1-2001 (ISO/IEC 9945-2003).

__fxstat(_STAT_VER, fildes, stat_buf) shall implement fstat(fildes, stat_buf) as specified by POSIX 1003.1-2001 (ISO/IEC 9945-2003).

__xstat(), __lxstat(), and __fxstat() are not in the source standard; they are only in the binary standard.

stat(), lstat(), and fstat() are not in the binary standard; they are only in the source standard.

__xstat64

Name

__xstat64 -- get File Status

Synopsis

#define _LARGEFILE_SOURCE 1
#include <sys/stat.h>
#include <unistd.h>

int __xstat64(int ver, const char * path, struct stat64 * stat_buf);

int __lxstat64(int ver, const char * path, struct stat64 * stat_buf);

int __fxstat64(int ver, int fildes, struct stat64 * stat_buf);

Description

The functions __xstat64(), __lxstat64(), and __fxstat64() shall implement the functions stat64(), lstat64(), and fstat64() respectively.

The behavior of these functions for values of ver other than _STAT_VER is undefined. See Data Definitions in the architecture specific part of this specification for the correct value of _STAT_VER.

__xstat64(_STAT_VER, path, stat_buf) shall behave as stat64(path, stat_buf) as specified by Large File Support.

__lxstat64(_STAT_VER, path, stat_buf) shall behave as lstat64(path, stat_buf) as specified by Large File Support.

__fxstat64(_STAT_VER, fildes, stat_buf) shall behave as fstat64(fildes, stat_buf) as specified by Large File Support.

__xstat64(), __lxstat64(), and __fxstat64() are not in the source standard; they are only in the binary standard.

stat64(), lstat64(), and fstat64() are not in the binary standard; they are only in the source standard.

_environ

Name

_environ -- alias for environ - user environment

Synopsis

extern char * *_environ;

Description

_environ is an alias for environ - user environment.

_nl_msg_cat_cntr

Name

_nl_msg_cat_cntr -- new catalog load counter

Synopsis

#include <libintl.h>

extern int _nl_msg_cat_cntr;

Description

The global variable _nl_msg_cat_cntr is incremented each time a new catalog is loaded. This variable is only in the binary standard; it is not in the source standard.

_sys_errlist

Name

_sys_errlist -- array containing the "C" locale strings used by strerror()

Synopsis

#include <stdio.h>

extern const char *const _sys_errlist[];

Description

_sys_errlist is an array containing the "C" locale strings used by strerror(). This normally should not be used directly. strerror() provides all of the needed functionality.

_sys_siglist

Name

_sys_siglist -- array containing the names of the signal names

Synopsis

#include <signal.h>

extern const char *const _sys_siglist[NSIG];

Description

_sys_siglist is an array containing signal description strings ordered by signal number.

The _sys_siglist array is only in the binary standard; it is not in the source standard. Applications wishing to access signal descriptions should use the strsignal() function.

acct

Name

acct -- switch process accounting on or off

Synopsis

#include <dirent.h>

int acct(const char * filename);

Description

When filename is the name of an existing file, acct() turns accounting on and appends a record to filename for each terminating process. When filename is NULL, acct() turns accounting off.

Return Value

On success, 0 is returned. On error, -1 is returned and the global variable errno is set appropriately.

Errors

ENOSYS 

BSD process accounting has not been enabled when the operating system kernel was compiled. The kernel configuration parameter controlling this feature is CONFIG_BSD_PROCESS_ACCT.

ENOMEM 

Out of memory.

EPERM 

The calling process has no permission to enable process accounting.

EACCES 

filename is not a regular file.

EIO 

Error writing to the filename.

EUSERS 

There are no more free file structures or we run out of memory.

adjtime

Name

adjtime -- correct the time to allow synchronization of the system clock

Synopsis

#include <time.h>

int adjtime(const struct timeval * delta, struct timeval * olddelta);

Description

adjtime() makes small adjustments to the system time as returned by gettimeofday()(2), advancing or retarding it by the time specified by the timeval delta. If delta is negative, the clock is slowed down by incrementing it more slowly than normal until the correction is complete. If delta is positive, a larger increment than normal is used. The skew used to perform the correction is generally a fraction of one percent. Thus, the time is always a monotonically increasing function. A time correction from an earlier call to adjtime() may not be finished when adjtime() is called again. If olddelta is non-NULL, the structure pointed to will contain, upon return, the number of microseconds still to be corrected from the earlier call.

adjtime() may be used by time servers that synchronize the clocks of computers in a local area network. Such time servers would slow down the clocks of some machines and speed up the clocks of others to bring them to the average network time.

Appropriate privilege is required to adjust the system time.

Return Value

On success, 0 is returned. On error, -1 is returned and the global variable errno is set appropriately.

Errors

EFAULT 

An argument points outside the process's allocated address space.

EPERM 

The process does not have appropriate privilege.

alphasort64

Name

alphasort64 -- Comparison function for directory scanning (Large File Support)

Synopsis

#include <dirent.h>

int alphasort64(const struct dirent64 ** d1, const struct dirent64 ** d2);

Description

alpahsort64() is a large-file version of the alphasort() function as defined in POSIX 1003.1-2008 (ISO/IEC 9945-2009). If differs only in that the d1 and d2 parameters are of type dirent64 instead of type dirent.

asprintf

Name

asprintf -- write formatted output to a dynamically allocated string

Synopsis

#include <stdio.h>

int asprintf(char ** restrict ptr, const char * restrict format, ...);

Description

The asprintf() function shall behave as sprintf(), except that the output string shall be dynamically allocated space of sufficient length to hold the resulting string. The address of this dynamically allocated string shall be stored in the location referenced by ptr.

Return Value

Refer to fprintf().

Errors

Refer to fprintf().

backtrace, backtrace_symbols, backtrace_symbols_fd

Name

backtrace, backtrace_symbols, backtrace_symbols_fd -- runtime stack back tracing

Synopsis

#include <execinfo.h>

int backtrace(void **array, int size);

char **backtrace_symbols(void *const *array, int size);

void backtrace_symbols_fd(void *const *array, int size, int fd);

Description

backtrace() obtains a backtrace for the current thread as a list of pointers filled in to array. The size parameter describes the number of elements that will fit into array, backtrace() will truncate the list if necessary. A backtrace is a list of currently active function calls in a thread; each function call allocates a new stack frame and backtrace() obtains the return address from each stack frame.

backtrace_symbols() translates the information obtained from backtrace() into an array of strings. array is a pointer to an array of addresses as obtained from backtrace(). size is the number of entries in array, and should be the return value of the call to backtrace(). The strings contain the function name if it can be determined, a hedxadecimal offset into the function, and the actual return address in hexadecimal. Note that the pointer returned by backtrace_symbols() is obtained by an internal call to malloc() and should be freed when no longer needed.

backtrace_symbols_fd() performs the same transformation as backtrace_symbols() given the same argument pair array, size, but writes the strings to the file descriptor contained in fd. This avoids the allocation of string space.

Return Value

backtrace() returns the number of entries placed into array, no more than size. If the value is less than size, the full backtrace was returned; else it may have been truncated.

On success, backtrace_symbols() returns a pointer to an array of strings, which will have size entries. On error, NULL is returned.

Errors

No errors are defined for these functions. If backtrace_symbols_fd() fails, it will be due to a failure in the call to malloc(), and errno will be set accordingly.

Notes

The ability to obtain useful backtrace information, in particular function names, is dependent on a number of factors at the time of program construction, such as compiler optimization options. Even if the program itself is constructed so as to make symbols visible, the call trace may descend into system libraries which have not been so constructed.

Inlined functions do not have stack frames, and functions declared as static are not exposed and so will not be available in the backtrace.

See Also

malloc()

basename

Name

basename -- return the last component of a file name

Synopsis

#include <libgen.h>

char * basename(const char * path);

Description

In the source standard, basename() is implemented as a macro causing it to behave as described in POSIX 1003.1-2001 (ISO/IEC 9945-2003), and is equivalent to the function __xpg_basename(). If the macro is undefined, basename() from the binary standard is used, with differences as described here:

The string identified by path shall not be modified.

If path is "/", or ends with a trailing '/' character, the basename() function shall return a pointer to an empty string.

Return Value

On success, the basename() function shall return a pointer to the final component of path. Otherwise, it shall return a null pointer.

See Also

__xpg_basename()

bind_textdomain_codeset

Name

bind_textdomain_codeset -- specify encoding for message retrieval

Synopsis

#include <libintl.h>

char * bind_textdomain_codeset (const char * domainname , const char * codeset );

Description

The bind_textdomain_codeset() function can be used to specify the output codeset for message catalogs for domain domainname. The codeset argument shall be a valid codeset name which can be used tor the iconv_open function, or a null pointer. If the codeset argument is the null pointer, then function returns the currently selected codeset for the domain with the name domainname. It shall return a null pointer if no codeset has yet been selected.

Each successive call to bind_textdomain_codeset() function overrrides the settings made by the preceding call with the same domainname.

The bind_textdomain_codeset() function shall return a pointer to a string containing the name of the selected codeset. The string shall be allocated internally in the function and shall not be changed or freed by the user.

Parameters

domainname 

The domainname argument is applied to the currently active LC_MESSAGE locale. It is equivalent in syntax and meaning to the domainname argument to textdomain, except that the selection of the domain is valid only for the duration of the call.

codeset 

The name of the output codeset for the selected domain, or NULL to select the current codeset.

If domainname is the null pointer, or is an empty string, bind_textdomain_codeset() shall fail, but need not set errno.

Return Value

Returns the currently selected codeset name. It returns a null pointer if no codeset has yet been selected.

Errors

ENOMEM 

Insufficient memory available to allocate return value.

See Also

gettext, dgettext, ngettext, dngettext, dcgettext, dcngettext, textdomain, bindtextdomain

bindresvport

Name

bindresvport -- bind socket to privileged IP port

Synopsis

#include <sys/types.h>
#include <rpc/rpc.h>

int bindresvport(int sd, struct sockaddr_in * sin);

Description

If the process has appropriate privilege, the bindresvport() function shall bind a socket to an anonymous privileged IP port, that is, arbitrarily selected from the range 512 through 1023.

If the bind is successful and sin is not NULL, and the port number bound to is returned in the sin_port member of sin. Any caller-supplied value of sin_port is ignored.

If sin is NULL, the address family is taken to be AF_INET and an available privileged port is bound to. Since there is no sockaddr_in structure, the port number chosen cannot be returned. The getsockname() may be used to query for this information.

Return Value

On success, 0 is returned. On error, -1 is returned and errno is set to indicate the error.

Errors

bindresvport() may fail in the same way as bind() in POSIX 1003.1-2001 (ISO/IEC 9945-2003). The following additional or differing failures may occur:

EADDRINUSE 

All privileged ports are in use.

EAFNOSUPPORT 

The specified address is not a valid address for the address family of the specified socket, or the address family is not supported.

EPFNOSUPPORT 

The same meaning as EAFNOSUPPORT. Some older implementations may return this error instead.

Note: At this time, only AF_INET is supported. Applications should be prepared for either the EAFNOSUPPORT or EPFNOSUPPORT error to be indicated.

bindtextdomain

Name

bindtextdomain -- specify the location of a message catalog

Synopsis

#include <libintl.h>

char * bindtextdomain(const char * domainname, const char * dirname);

Description

The bindtextdomain() shall set the the base directory of the hierarchy containing message catalogs for a given message domain.

The bindtextdomain() function specifies that the domainname message catalog can be found in the dirname directory hierarchy, rather than in the system default locale data base.

If dirname is not NULL, the base directory for message catalogs belonging to domain domainname shall be set to dirname. If dirname is NULL, the base directory for message catalogs shall not be altered.

The function shall make copies of the argument strings as needed.

dirname can be an absolute or relative pathname.

Note: Applications that wish to use chdir() should always use absolute pathnames to avoid misadvertently selecting the wrong or non-existant directory.

If domainname is the null pointer, or is an empty string, bindtextdomain() shall fail, but need not set errno.

The bindtextdomain() function shall return a pointer to a string containing the name of the selected directory. The string shall be allocated internally in the function and shall not be changed or freed by the user.

Return Value

On success, bindtextdomain() shall return a pointer to a string containing the directory pathname currently bound to the domain. On failure, a NULL pointer is returned, and the global variable errno may be set to indicate the error.

Errors

ENOMEM 

Insufficient memory was available.

See Also

gettext, dgettext, ngettext, dngettext, dcgettext, dcngettext, textdomain, bind_textdomain_codeset

cfmakeraw

Name

cfmakeraw -- get and set terminal attributes

Synopsis

#include <termios.h>

void cfmakeraw(struct termios * termios_p);

Description

The cfmakeraw() function shall set the attributes of the termios structure referenced by termios_p as follows:

  termios_p->c_iflag &= ~(IGNBRK|BRKINT|PARMRK|ISTRIP
                          |INLCR|IGNCR|ICRNL|IXON);

  termios_p->c_oflag &= ~OPOST;

  termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);

  termios_p->c_cflag &= ~(CSIZE|PARENB);

  termios_p->c_cflag |= CS8;

termios_p shall point to a termios structure that contains the following members:

  tcflag_t c_iflag;      /* input modes */
  tcflag_t c_oflag;      /* output modes */
  tcflag_t c_cflag;      /* control modes */
  tcflag_t c_lflag;      /* local modes */
  cc_t c_cc[NCCS];       /* control chars */

cfsetspeed

Name

cfsetspeed -- set terminal input and output data rate

Synopsis

#include <termios.h>

int cfsetspeed(struct termios *t, speed_t speed);

Description

The cfsetspeed() function shall set the input and output speeds in t to the value specified by speed. The effects of the function on the terminal as described below do not become effective, nor are all errors detected, until the tcsetattr() function is called. Certain values for baud rates set in termios and passed to tcsetattr() have special meanings.

Return Value

On success, 0 is returned. On error, -1 is returned and the global variable errno is set appropriately.

Errors

EINVAL 

Invalid speed argument

clearerr_unlocked

Name

clearerr_unlocked -- non-thread-safe clearerr

Description

clearerr_unlocked() is the same as clearerr(), except that it need not be thread-safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

daemon

Name

daemon -- run in the background

Synopsis

#include <unistd.h>

int daemon(int nochdir, int noclose);

Description

The daemon() function shall create a new process, detached from the controlling terminal. If successful, the calling process shall exit and the new process shall continue to execute the application in the background. If nochdir evaluates to true, the current directory shall not be changed. Otherwise, daemon() shall change the current working directory to the root (`/'). If noclose evaluates to true the standard input, standard output, and standard error file descriptors shall not be altered. Otherwise, daemon() shall close the standard input, standard output and standard error file descriptors and reopen them attached to /dev/null.

Return Value

On error, -1 is returned, and the global variable errno is set to any of the errors specified for the library functions fork() and setsid().

dcgettext

Name

dcgettext -- perform domain and category specific lookup in message catalog

Synopsis

#include <libintl.h>
#include <locale.h>

char * dcgettext(const char * domainname, const char * msgid, int category);

Description

The dcgettext() function is a domain specified version of gettext().

The dcgettext() function shall lookup the translation in the current locale of the message identified by msgid in the domain specified by domainname and in the locale category specified by category. If domainname is NULL, the current default domain shall be used. The msgid argument shall be a NULL-terminated string to be matched in the catalogue. category shall specify the locale category to be used for retrieving message strings. The category parameter shall be one of LC_CTYPE, LC_COLLATE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, or LC_TIME. The default domain shall not be changed by a call to dcgettext().

Return Value

If a translation was found in one of the specified catalogs, it shall be converted to the current locale's codeset and returned. The resulting NULL-terminated string shall be allocated by the dcgettext function, and must not be modified or freed. If no translation was found, or category was invalid, msgid shall be returned.

Errors

dcgettext() shall not modify the errno global variable.

See Also

gettext, dgettext, ngettext, dngettext, dcngettext, textdomain, bindtextdomain, bind_textdomain_codeset

dcngettext

Name

dcngettext -- perform domain and category specific lookup in message catalog with plural

Synopsis

#include <libintl.h>
#include <locale.h>

char * dcngettext(const char * domainname, const char * msgid1, const char * msgid2, unsigned long int n, int category);

Description

The dcngettext() function is a domain specific version of gettext, capable of returning either a singular or plural form of the message. The dcngettext() function shall lookup the translation in the current locale of the message identified by msgid1 in the domain specified by domainname and in the locale category specified by category. If domainname is NULL, the current default domain shall be used. The msgid1 argument shall be a NULL-terminated string to be matched in the catalogue. category shall specify the locale category to be used for retrieving message strings. The category parameter shall be one of LC_CTYPE, LC_COLLATE, LC_MESSAGES, LC_MONETARY, LC_NUMERIC, or LC_TIME. The default domain shall not be changed by a call to dcngettext(). If n is 1 then the singular version of the message is returned, otherwise one of the plural forms is returned, depending on the value of n and the current locale settings.

Return Value

If a translation corresponding to the value of n was found in one of the specified catalogs for msgid1, it shall be converted to the current locale's codeset and returned. The resulting NULL-terminated string shall be allocated by the dcngettext() function, and must not be modified or freed. If no translation was found, or category was invalid, msgid1 shall be returned if n has the value 1, otherwise msgid2 shall be returned.

Errors

dcngettext() shall not modify the errno global variable.

See Also

gettext, dgettext, ngettext, dngettext, dcgettext, textdomain, bindtextdomain, bind_textdomain_codeset

dgettext

Name

dgettext -- perform lookup in message catalog for the current LC_MESSAGES locale

Synopsis

#include <libintl.h>

char * dgettext(const char * domainname, const char * msgid);

Description

dgettext() is a domain specified version of gettext().

The dgettext() function shall search the currently selected message catalogs in the domain domainname for a string identified by the string msgid. If a string is located, that string shall be returned. The domain specified by domainname applies to the currently active LC_MESSAGE locale. The default domain shall not be changed by a call to dgettext().

Note: The usage of domainanme is equivalent in syntax and meaning to the textdomain() function's application of domainname, except that the selection of the domain in dgettext() is valid only for the duration of the call.

The dgettext() function is equivalent to dcgettext(domainname, msgid, LC_MESSAGES).

Return Value

On success of a msgid query, the translated NULL-terminated string is returned. On error, the original msgid is returned. The length of the string returned is undetermined until dgettext() is called.

Errors

dgettext() shall not modify the errno global variable.

See Also

gettext, dgettext, ngettext, dngettext, dcgettext, dcngettext, textdomain, bindtextdomain, bind_textdomain_codeset

dl_iterate_phdr

Name

dl_iterate_phdr -- iterate over a program's loaded shared objects

Synopsis

#include <link.h>

int dl_iterate_phdr(int(*callback) (struct dl_phdr_info *, size_t, void *), void *data);

Description

dl_iterate_phdr() allows a program to iterate over the shared objects it has loaded. The function described by the callback parameter is called once for each loaded shared object, allowing an action to be taken for each one. callback is called with three arguments which are filled in by the implementation: a pointer to a structure of type dl_phdr_info containing information about the shared object; an integer size of the structure; and a copy of the data argument to dl_iterate_phdr(). If callback returns a non-zero value, dl_iterate_phdr() will stop processing, even if there are unprocessed shared objects. The order of processing is unspecified.

The dl_phdr_info structure has the following members (note that on 64-bit architectures the types here shown as Elf32_type will instead be Elf64_type):

    Elf32_Addr dlpi_addr;
    const char *dlpi_name;
    const Elf32_Phdr *dlpi_phdr;
    Elf32_Half dlpi_phnum;
    unsigned long long int dlpi_adds;
    unsigned long long int dlpi_subs;
    size_t dlpi_tls_modid;
    void *dlpi_tls_data;

dlpi_addr contains the base address of the shared object.

dlpi_name is a null-terminated string giving the pathname from which the shared object was loaded.

dlpi_phdr is a pointer to an array of program headers for this shared object, while dlpi_phnum is the number of entries in this array.

dlpi_adds and dlpi_subs are incremented when shared objects are added or removed, respectively.

dlpi_tls_modid contains the module ID used in TLS relocations, if there is a PT_TLS segment. Otherwise the value shall be zero.

dlpi_tls_data contains the address of the calling thread's instance of this module's PT_TLS segment, if there is one and it has been allocated in the calling thread. Otherwise the value shall be a null pointer.

Some implementations may not provide all fields in dl_phdr_info, although the first four are always mandatory. Applications are advised to have the callback function check the size parameter before examining the later members.

Return Value

The dl_iterate_phdr() function returns whatever value was returned by the last call to callback. This will be zero if processing completed normally, since processing does not continue unless the callback function returns zero.

Errors

No errors are defined by dl_iterate_phdr(); as noted the callback function must use a zero return to indicate success but may assign any meaning it wishes to non-zero returns.

dngettext

Name

dngettext -- perform lookup in message catalog for the current locale

Synopsis

#include <libintl.h>

char * dngettext(const char * domainname, const char * msgid1, const char * msgid2, unsigned long int n);

Description

dngettext() shall be equivalent to a call to

dcngettext(domainname, msgid1, msgid2, n, LC_MESSAGES)
See dcngettext() for more information.

See Also

gettext, dgettext, ngettext, dcgettext, dcngettext, textdomain, bindtextdomain, bind_textdomain_codeset

drand48_r

Name

drand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution

Synopsis

#include <stdlib.h>

int drand48_r(struct drand48_data * buffer, double * result);

Description

The interface drand48_r() shall function in the same way as the interface drand48(), except that drand48_r() shall use the data in buffer instead of the global random number generator state.

Before it is used, buffer must be initialized, for example, by calling lcong48_r(), seed48_r(), or srand48_r(), or by filling it with zeroes.

duplocale

Name

duplocale -- provide new handle for selection of locale

Synopsis

#include <locale.h>

locale_t duplocale(locale_t locale);

Description

The duplocale() function shall provide a new locale object based on the locale object provided in locale, suitable for use in the newlocale() or uselocale() functions. The new object may be released by calling freelocale().

Return Value

On success, the duplocale() function shall return a locale object. Otherwise, it shall return NULL, and set errno to indicate the error.

Errors

The duplocale() function shall fail if:

ENOMEM 

Insufficient memory.

See Also

setlocale(), freelocale(), newlocale(), uselocale()

endutent

Name

endutent -- access utmp file entries

Synopsis

#include <utmp.h>

void endutent(void);

Description

endutent() closes the utmp file. It should be called when the user code is done accessing the file with the other functions.

epoll_create

Name

epoll_create -- open an epoll file descriptor

Synopsis

#include <sys/epoll.h>

int epoll_create(int size);

Description

The epoll API, which consists of the interfaces epoll_create(), epoll_ctl(), and epoll_wait(), shall support all file descriptors compatible with poll(). These interfaces shall be usable in either level-triggered or edge-triggered mode. In level-triggered mode, epoll has similar semantics to poll(), and can be used as a faster replacement for it. In edge-triggered mode, epoll shall only report events for a file descriptor when changes occur on it.

The epoll_create() interface shall open an epoll file descriptor by allocating an event backing store of approximately size size. The size parameter is a hint to the kernel about how large the event storage should be, not a rigidly-defined maximum size.

Return Value

On success, epoll_create() shall return the file descriptor, a non-negative integer that shall be used for subsequent epoll calls. It should be closed with the close() function.

On failure, epoll_create() shall return -1 and set errno as follows.

Errors

EINVAL 

The size parameter is not positive.

ENFILE 

The maximum number of open files has been reached by the system.

ENOMEM 

Not enough memory to create the kernel object.

See Also

close(), epoll_ctl(), epoll_wait(), poll().

epoll_ctl

Name

epoll_ctl -- control an epoll file descriptor

Synopsis

#include <sys/epoll.h>

int epoll_ctl(int epfd, int op, int fd, struct epoll_event * event);

Description

The interface epoll_ctl() shall control an epoll file descriptor.

The parameter epfd shall specify the epoll file descriptor to control.

The parameter op shall specify the operation to perform on the specified target file descriptor.

The parameter fd shall specify the target file descriptor on which to perform the specified operation.

The parameter event shall specify the object associated with the target file descriptor. The events member of the event parameter is a bit set composed of the event types listed below.

Event types

EPOLLERR 

An error condition occurred on the target file descriptor. It shall not be necessary to set this event in events; this interface shall always wait for it.

EPOLLET 

This event shall set edge-triggered behavior for the target file descriptor. The default epoll behavior shall be level-triggered.

EPOLLHUP 

A hang up occurred on the target file descriptor. It shall not be necessary to set this event in events; this interface shall always wait for it.

EPOLLIN 

The file is accessible to read() operations.

EPOLLONESHOT 

This event shall set one-shot behavior for the target file descriptor. After epoll_wait() retrieves an event, the file descriptor shall be disabled and epoll shall not report any other events. To reenable the file descriptor with a new event mask, the user should invoke epoll_ctl() with EPOLL_CTL_MOD in the op parameter.

EPOLLOUT 

The file is accessible to write() operations.

EPOLLPRI 

Urgent data exists for read() operations.

EPOLLRDHUP 

A stream socket peer closed the connection, or else the peer shut down the writing half of the connection.

Values of the op parameter

EPOLL_CTL_ADD 

Associate event with the file described by fd, and add fd to the epoll descriptor epfd.

EPOLL_CTL_DEL 

Remove fd from epfd, and ignore event, which can be NULL.

EPOLL_CTL_MOD 

Change the event event associated with fd.

Return Value

On success, epoll_ctl() shall return 0.

On failure, epoll_ctl() shall return -1 and set errno as follows.

Errors

EBADF 

The parameter epfd or the parameter fd is an invalid file descriptor.

EEXIST 

The parameter op was EPOLL_CTL_ADD, but the file descriptor fd is already in epfd.

EINVAL 

The parameter epfd is invalid, or it is the same as fd, or the operation specified by the parameter op is unsupported.

ENOENT 

The parameter op was EPOLL_CTL_MOD or EPOLL_CTL_DEL, but the file descriptor fd is not in epfd.

ENOMEM 

Not enough memory for the operation specified by the parameter op.

EPERM 

The file specified by fd does not support epoll.

See Also

close(), epoll_create(), epoll_wait(), poll().

epoll_wait

Name

epoll_wait -- wait for I/O events on an epoll file descriptor

Synopsis

#include <sys/epoll.h>

int epoll_wait(int epfd, struct epoll_event * events, int maxevents, int timeout);

Description

The interface epoll_wait() shall wait for events on the epoll file descriptor specified by the parameter epfd.

Upon success, the output parameter events shall refer to an area of memory containing epoll_event structures available to the caller. The data members of these structures shall contain the data set by the user with the interface epoll_ctl(). The events members shall contain the event bit field that was returned.

The parameter maxevents shall specify the maximum number of events that epoll_wait() may return in the output parameter events. The value of this parameter should be greater than 0.

The parameter timeout shall specify the maximum number of milliseconds that epoll_wait() shall wait for events. If the value of this parameter is 0, then epoll_wait() shall return immediately, even if no events are available, in which case the return code shall be 0. If the value of timeout is -1, then epoll_wait() shall block until either a requested event occurs or the call is interrupted.

Return Value

On success, epoll_wait() shall return the number of file descriptors that are ready for the I/O that was requested, or else 0 if no descriptors became ready during timeout.

On failure, epoll_wait() shall return -1 and set errno as follows.

Errors

EBADF 

The parameter epfd is not a valid file descriptor.

EFAULT 

The area of memory referenced by the parameter events cannot be accessed with write permissions.

EINTR 

The call was interrupted by a signal handler before the timeout expired or any requested event took place.

EINVAL 

The parameter epfd is not a valid epoll file descriptor, or else the parameter maxevents is less than or equal to 0.

See Also

close(), epoll_ctl(), epoll_create(), poll().

erand48_r

Name

erand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution

Synopsis

#include <stdlib.h>

int erand48_r(unsigned short[3] xsubi, struct drand48_data * buffer, double * result);

Description

The interface erand48_r() shall function in the same way as the interface erand48(), except that erand48_r() shall use the data in buffer instead of the global random number generator state.

Before it is used, buffer must be initialized, for example, by calling lcong48_r(), seed48_r(), or srand48_r(), or by filling it with zeroes.

err

Name

err -- display formatted error messages

Synopsis

#include <err.h>

void err(int eval, const char * fmt, ...);

Description

The err() function shall display a formatted error message on the standard error stream. First, err() shall write the last component of the program name, a colon character, and a space character. If fmt is non-NULL, it shall be used as a format string for the printf() family of functions, and err() shall write the formatted message, a colon character, and a space. Finally, the error message string affiliated with the current value of the global variable errno shall be written, followed by a newline character.

The err() function shall not return, the program shall terminate with the exit value of eval.

See Also

error(), errx()

Return Value

None.

Errors

None.

error

Name

error -- print error message

Synopsis

#include <err.h>

void error(int exitstatus, int errnum, const char * format, ...);

Description

error() shall print a message to standard error.

error() shall build the message from the following elements in their specified order:

  1. the program name. If the application has provided a function named error_print_progname(), error() shall call this to supply the program name; otherwise, error() uses the content of the global variable program_name.

  2. the colon and space characters, then the result of using the printf-style format and the optional arguments.

  3. if errnum is nonzero, error() shall add the colon and space characters, then the result of strerror(errnum).

  4. a newline.

If exitstatus is nonzero, error() shall call exit(exitstatus).

See Also

err(), errx()

errx

Name

errx -- display formatted error message and exit

Synopsis

#include <err.h>

void errx(int eval, const char * fmt, ...);

Description

The errx() function shall display a formatted error message on the standard error stream. The last component of the program name, a colon character, and a space shall be output. If fmt is non-NULL, it shall be used as the format string for the printf() family of functions, and the formatted error message, a colon character, and a space shall be output. The output shall be followed by a newline character.

errx() does not return, but shall exit with the value of eval.

Return Value

None.

Errors

None.

See Also

error(), err()

fcntl

Name

fcntl -- file control

Description

fcntl() is as specified in POSIX 1003.1-2001 (ISO/IEC 9945-2003), but with differences as listed below.

Implementation may set O_LARGEFILE

According to POSIX 1003.1-2001 (ISO/IEC 9945-2003), only an application sets fcntl() flags, for example O_LARGEFILE. However, this specification also allows an implementation to set the O_LARGEFILE flag in the case where the programming environment is one of _POSIX_V6_ILP32_OFFBIG, _POSIX_V6_LP64_OFF64, _POSIX_V6_LPBIG_OFFBIG. See getconf and c99 in POSIX 1003.1-2001 (ISO/IEC 9945-2003) for a description of these environments. Thus, calling fcntl() with the F_GETFL command may return O_LARGEFILE as well as flags explicitly set by the application in the case that both the implementation and the application support an off_t of at least 64 bits.

Additional flags

In addition to the available values for cmd, as documented in POSIX 1003.1-2001 (ISO/IEC 9945-2003), this specification permits the following constants.

F_GETSIG shall get the number of the signal to be sent when input or output can occur. If the value is 0, then SIGIO shall be sent. Otherwise, the value retrieved shall be the signal sent, and the signal handler can discover more information when installed with the SA_SIGINFO flag.

F_SETSIG shall set the number of the signal to be sent when input or output can occur. If the value is 0, then SIGIO shall be sent. Otherwise, the value set shall be the signal to be sent, and the signal handler can discover more information when installed with the SA_SIGINFO flag.

F_GETLK64 is analogous to the F_GETLK constant in POSIX 1003.1-2001 (ISO/IEC 9945-2003), but shall provide a 64-bit interface on non-64-bit architectures. It is identical to F_GETLK on a 64-bit machine, but is provided in 64-bit environments for source code consistency among architectures.

F_SETLK64 is analogous to the F_SETLK constant in POSIX 1003.1-2001 (ISO/IEC 9945-2003), but shall provide a 64-bit interface on non-64-bit architectures. It is identical to F_SETLK on a 64-bit machine, but is provided in 64-bit environments for source code consistency among architectures.

F_SETLKW64 is analogous to the F_SETLKW constant in POSIX 1003.1-2001 (ISO/IEC 9945-2003), but provides a 64-bit interface on non-64-bit architectures. It is identical to F_SETLKW on a 64-bit machine, but is provided in 64-bit environments for source code consistency among architectures.

feof_unlocked

Name

feof_unlocked -- non-thread-safe feof

Description

feof_unlocked() is the same as feof(), except that it need not be thread-safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

ferror_unlocked

Name

ferror_unlocked -- non-thread-safe ferror

Description

ferror_unlocked() is the same as ferror(), except that it need not be thread-safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

fflush_unlocked

Name

fflush_unlocked -- non thread safe fflush

Description

fflush_unlocked() is the same as fflush() except that it need not be thread safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

fgetc_unlocked

Name

fgetc_unlocked -- non-thread-safe fgetc

Description

fgetc_unlocked() is the same as fgetc(), except that it need not be thread-safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

fgets_unlocked

Name

fgets_unlocked -- non-thread-safe fgets

Description

fgets_unlocked() is the same as fgets(), except that it need not be thread-safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

fgetwc_unlocked

Name

fgetwc_unlocked -- non thread safe fgetwc

Description

fgetwc_unlocked() is the same as fgetwc() except that it need not be thread safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

fgetws_unlocked

Name

fgetws_unlocked -- non-thread-safe fgetws

Description

fgetws_unlocked() is the same as fgetws(), except that it need not be thread-safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

fileno_unlocked

Name

fileno_unlocked -- non-thread-safe fileno

Description

fileno_unlocked() is the same as fileno(), except that it need not be thread-safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

flock

Name

flock -- apply or remove an advisory lock on an open file

Synopsis

int flock(int fd, int operation);

Description

flock() applies or removes an advisory lock on the open file fd. Valid operation types are:

LOCK_SH 

Shared lock. More than one process may hold a shared lock for a given file at a given time.

LOCK_EX 

Exclusive lock. Only one process may hold an exclusive lock for a given file at a given time.

LOCK_UN 

Unlock.

LOCK_NB 

Don't block when locking. May be specified (by oring) along with one of the other operations.

A single file may not simultaneously have both shared and exclusive locks.

Return Value

On success, 0 is returned. On error, -1 is returned and the global variable errno is set appropriately.

Errors

EWOULDBLOCK 

The file is locked and the LOCK_NB flag was selected.

EBADF 

fd is not a not an open file descriptor.

EINTR 

While waiting to acquire a lock, the call was interrupted by delivery of a signal caught by a handler.

EINVAL 

The operation is invalid.

ENOLCK 

The implementation ran out of memory for allocating lock records.

fputc_unlocked

Name

fputc_unlocked -- non-thread-safe fputc

Description

fputc_unlocked() is the same as fputc(), except that it need not be thread-safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

fputs_unlocked

Name

fputs_unlocked -- non-thread-safe fputs

Description

fputs_unlocked() is the same as fputs(), except that it need not be thread-safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

fputwc_unlocked

Name

fputwc_unlocked -- non-thread-safe fputwc

Description

fputwc_unlocked() is the same as fputwc(), except that it need not be thread-safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

fputws_unlocked

Name

fputws_unlocked -- non-thread-safe fputws

Description

fputws_unlocked() is the same as fputws(), except that it need not be thread-safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

fread_unlocked

Name

fread_unlocked -- non-thread-safe fread

Description

fread_unlocked() is the same as fread(), except that it need not be thread-safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

freelocale

Name

freelocale -- free a locale object

Synopsis

#include <locale.h>

void freelocale(locale_t locale);

Description

The freelocale() function shall free the locale object locale, and release any resources associated with it.

Return Value

None.

Errors

None defined.

See Also

setlocale(), newlocale(), duplocale(), uselocale()

fscanf

Name

fscanf -- convert formatted input

Description

The scanf() family of functions shall behave as described in POSIX 1003.1-2001 (ISO/IEC 9945-2003), except as noted below.

Differences

The %s, %S and %[ conversion specifiers shall accept an option length modifier a, which shall cause a memory buffer to be allocated to hold the string converted. In such a case, the argument corresponding to the conversion specifier should be a reference to a pointer value that will receive a pointer to the allocated buffer. If there is insufficient memory to allocate a buffer, the function may set errno to ENOMEM and a conversion error results.

Note: This directly conflicts with the ISO C (1999) usage of %a as a conversion specifier for hexadecimal float values. While this conversion specifier should be supported, a format specifier such as "%aseconds" will have a different meaning on an LSB conforming system.

fstatfs

Name

fstatfs -- (deprecated)

Synopsis

#include <sys/statfs.h>

int fstatfs(int fd, struct statfs * buf);

Description

The fstatfs() function returns information about a mounted file system. The file system is identified by fd, a file descriptor of an open file within the mounted filesystem. The results are placed in the structure pointed to by buf.

Fields that are undefined for a particular file system shall be set to 0.

Note: Application developers should use the fstatvfs() function to obtain general file system information. Applications should only use the fstatfs() function if they must determine the file system type, which need not be provided by fstatvfs().

Return Value

On success, the fstatfs() function shall return 0 and set the fields of the structure idenfitied by buf accordingly. On error, the fstatfs() function shall return -1 and set errno accordingly.

Errors

EBADF 

fd is not a valid open file descriptor.

EFAULT 

buf points to an invalid address.

EIO 

An I/O error occurred while reading from or writing to the file system.

ENOSYS 

The filesystem fd is open on does not support statfs().

fstatfs64

Name

fstatfs64 -- (deprecated)

Synopsis

#include <sys/statfs.h>

int fstatfs64(int fd, struct statfs64 * buf);

Description

The fstatfs64() function returns information about a mounted file system. The file system is identified by fd, a file descriptor of an open file within the mounted filesystem. The results are placed in the structure pointed to by buf.

Fields that are undefined for a particular file system shall be set to 0.

fstatfs64() is a large-file version of the fstatfs() function.

Note: Application developers should use the fstatvfs64() function to obtain general file system information. Applications should only use the fstatfs64() function if they must determine the file system type, which need not be provided by fstatvfs64().

Return Value

On success, the fstatfs64() function shall return 0 and set the fields of the structure idenfitied by buf accordingly. On error, the fstatfs64() function shall return -1 and set errno accordingly.

Errors

See fstatfs().

fwrite_unlocked

Name

fwrite_unlocked -- non-thread-safe fwrite

Description

fwrite_unlocked() is the same as fwrite(), except that it need not be thread-safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

fwscanf

Name

fwscanf -- convert formatted input

Description

The scanf() family of functions shall behave as described in POSIX 1003.1-2001 (ISO/IEC 9945-2003), except as noted below.

Differences

The %s, %S and %[ conversion specifiers shall accept an option length modifier a, which shall cause a memory buffer to be allocated to hold the string converted. In such a case, the argument corresponding to the conversion specifier should be a reference to a pointer value that will receive a pointer to the allocated buffer. If there is insufficient memory to allocate a buffer, the function may set errno to ENOMEM and a conversion error results.

Note: This directly conflicts with the ISO C (1999) usage of %a as a conversion specifier for hexadecimal float values. While this conversion specifier should be supported, a format specifier such as "%aseconds" will have a different meaning on an LSB conforming system.

getdomainname

Name

getdomainname -- get NIS domain name (DEPRECATED).

Synopsis

#include <unistd.h>

int getdomainname (char * name , size_t namelen );

Description

If the Network Information System (NIS) is in use, getdomainname() shall copy the NIS domain name to the supplied buffer identified by name, with maximum length namelen. If the NIS domain name is not currently set, getdomainname() shall copy the string "(none)" to the name. If namelen is less than the length of the string to be copied, getdomainname() shall either truncate the string to namelen characters and place it in name (without a terminating null character), or shall fail with EINVAL.

Note: The NIS domain name is not the same as the domain portion of a fully qualified domain name (for example, in DNS).

The LSB does not include other NIS functions, nor does it specify how NIS may affect other database functions. No conforming application can make use of this information beyond noting whether or not the domain name has been set. If the name is set to a value other than the string "(none)", the application should not imply that NIS is in use. Similarly, if it is set to "(none)", the application should not assume that NIS is not in use, although NIS functionality may be restricted in this case.

Return Value

On success, getdomainname() shall return 0. Otherwise, it shall return -1 and set errno to indicate the error.

Errors

EINVAL 

name is a null pointer.

EINVAL 

The buffer identified by name and namelen is of insufficient size to store the NIS domain name string, and the implementation considers this an error.

Future Directions

The LSB does not include other NIS interfaces, and a future version of this specification may remove this interface. Application developers should avoid using this interface where possible.

getdtablesize

Name

getdtablesize -- get file descriptor table size (DEPRECATED)

Synopsis

#include <unistd.h>

int getdtablesize (void );

Description

The function getdtablesize() returns the number of files a process can have open.

Note: The getdtablesize() function is deprecated. Portable applications should call sysconf() with the _SC_OPEN_MAX option instead.

Return Value

The getdtablesize() function returns the current soft limit as if obtained by a call to sysconf() with the _SC_OPEN_MAX option.

Errors

No errors are defined.

getgrent_r

Name

getgrent_r -- reentrantly get entry in group file

Synopsis

#include <grp.h>

int getgrent_r(struct group * gbuf, char * buf, size_t buflen, struct group * * gbufp);

Description

The reentrant interface getgrent_r() shall function in the same way as the interface getgrent(), except that getgrent_r() shall return the group name, group password, and group members in buffers provided by the caller, rather than as a pointer to static storage.

The parameter gbuf contains the struct group that was read from the stream, if any.

The parameter buf contains additional strings, if any.

The parameter buflen specifies the size of buf.

The parameter *gbufp returns a pointer to the struct group in *gbuf.

Return Value

On success, getgrent_r() shall return 0, and *gbufp shall contain a pointer to the result.

On failure, *gbufp shall contain NULL, and getgrent_r() shall return an error as follows.

Errors

ENOENT 

No more group entries.

ERANGE 

Not enough buffer space. Specify a larger buffer and try again.

getgrouplist

Name

getgrouplist -- get groups a user belongs to

Synopsis

#include <grp.h>

int getgrouplist(const char * user, gid_t group, gid_t * groups, int * ngroups);

Description

The getgrouplist() function shall fill in the array groups with the supplementary groups for the user specified by user. On entry, ngroups shall refer to an integer containing the maximum number of elements in the groups array. The group group shall also be included in the values returned in groups. It is expected that group would be specified as the user's primary group from the password file (obtainable via getpwnam() or a similar function).

Return Value

If on entry the value referenced by ngroups was greater than or equal to the number of supplementary group identifiers to be copied to the array identified by groups, getgrouplist() shall return the number of group identifiers actually copied, and shall set the value referenced by ngroups to this value.

If on entry the value referenced by ngroups was less than the number of supplementary group identifiers, getgrouplist() shall return -1. The initial ngroups entries in groups shall be overwritten.

If the number of groups exceeds the input ngroups value, then as well as returning -1, ngroups shall be set to the number of groups that would have been placed in groups if it had been large enough.

Note: In such a case, the caller can use the information returned to make a further getgrouplist() call with a correctly sized groups array.

If user does not refer to a valid user on the system, then the behavior of this function is undefined.

Errors

None defined.

See Also

getgroups()

gethostbyaddr_r

Name

gethostbyaddr_r -- find network host database entry matching host name (DEPRECATED)

Synopsis

#include <netdb.h>

int gethostbyaddr_r(const void * restrict addr, socklen_t len, int type, struct hostent * restrict result_buf, char * restrict buf, size_t buflen, struct hostent * * restrict result, int * h_errnop);

Description

Note: The gethostbyaddr_r() function is deprecated; applications should use getaddrinfo() instead.

gethostbyaddr_r() is a reentrant version of gethostbyaddr() that searches the network host database for a host address match.

The gethostbyaddr_r() function shall search the network host database for an entry of address family type with the host with address addr. The len argument contains the length of the address referenced by addr.

If type is AF_INET, the addr argument shall be an in_addr structure. If type is AF_INET6, the addr argument shall be an in6_addr structure. If type is any other value, the behavior is unspecified.

The application must provide a buffer for the gethostbyaddr_r() to use during the lookup process. The buffer is referenced by buf, and is of size buflen. If the buffer is not of sufficient size, gethostbyaddr_r() may fail and return ERANGE. If a matching entry is found in the database, gethostbyaddr_r() shall copy the relevant information to the application supplied hostent structure referenced by result_buf, and return a pointer to this structure in *result. If no matching entry is found, *result shall be set to a null pointer. Additional error information shall be set in the variable referenced by h_errnop.

Return Value

On success, the gethostbyaddr_r() function shall return zero. If the return value was ERANGE, the size of the buffer buf, indicated by buflen, was too small. If the gethostbyaddr_r() function returns returns any other value, then the variable referenced by h_errnop shall be set to indicate the cause as for gethostbyaddr().

gethostbyname2

Name

gethostbyname2 -- find network host database entry matching host name (DEPRECATED)

Synopsis

int gethostbyname2(const char * restrict name, int af);

Description

Note: The gethostbyname2() function is deprecated; applications should use getaddrinfo() instead.

The gethostbyname2() function shall search the network host database for an entry with name name. This function is similar to the gethostbyname() function but additionally allows the search to be restricted to a particular address family specified by af.

Return Value

On success, the gethostbyname2() function shall return a pointer to a hostent structure if the requested entry was found, and a null pointer otherwise.

On unsuccessful completion, gethostbyname2() shall set h_errno as for gethostbyname() in POSIX 1003.1-2001 (ISO/IEC 9945-2003).

Errors

The gethostbyname2() shall set h_errno as for gethostbyname() in POSIX 1003.1-2001 (ISO/IEC 9945-2003).

gethostbyname2_r

Name

gethostbyname2_r -- find network host database entry matching host name (DEPRECATED)

Synopsis

int gethostbyname2_r(const char * restrict name, int af, struct hostent * restrict result_buf, char * restrict buf, size_t buflen, struct hostent ** restrict result, int * restrict h_errnop);

Description

Note: The gethostbyname2_r() function is deprecated; applications should use getaddrinfo() instead.

The gethostbyname2_r() function shall search the network host database for an entry with name name. gethostbyname2_r() is a reentrant version of gethostbyname2(). These functions are similar to the gethostbyname() and gethostbyname_r() functions but additionally allow the search to be restricted to a particular address family specified by af.

The application must provide a buffer for the gethostbyname2_r() function to use during the lookup process. The buffer is referenced by buf, and is of size buflen. If the buffer is not of sufficient size, gethostbyname_r() may fail and return ERANGE. If a matching entry is found in the database, gethostbyname_r() shall copy the relevant information to the application-supplied hostent structure referenced by result_buf, and return a pointer to this structure in *result. If no matching entry is found, *result shall be set to a null pointer. Additional error information shall be set in the variable referenced by h_errnop.

Return Value

On success, the gethostbyname2_r() function shall return zero. If the return value was ERANGE, the size of the buffer buf, indicated by buflen, was too small. If the gethostbyname2_r() function returns returns any other value, then the variable referenced by h_errnop shall be set to indicate the cause as for gethostbyname_r().

gethostbyname_r

Name

gethostbyname_r -- find network host database entry matching host name (DEPRECATED)

Synopsis

int gethostbyname_r(const char * restrict name, struct hostent * restrict result_buf, char * restrict buf, size_t buflen, struct hostent ** restrict result, int * restrict h_errnop);

Description

Note: The gethostbyname_r() function is deprecated; applications should use getaddrinfo() instead.

gethostbyname_r() is a reentrant version of gethostbyname() that searches the network host database for a host name match.

The gethostbyname_r() function shall search the network host database for an entry with name name.

The application must provide a buffer for the gethostbyname_r() to use during the lookup process. The buffer is referenced by buf, and is of size buflen. If the buffer is not of sufficient size, gethostbyname_r() may fail and return ERANGE. If a matching entry is found in the database, gethostbyname_r() shall copy the relevant information to the application supplied hostent structure referenced by result_buf, and return a pointer to this structure in *result. If no matching entry is found, *result shall be set to a null pointer. Additional error information shall be set in the variable referenced by h_errnop.

Return Value

On success, the gethostbyname_r() function shall return zero. If the return value was ERANGE, the size of the buffer buf, indicated by buflen, was too small. If the gethostbyname_r() function returns returns any other value, then the variable referenced by h_errnop shall be set to indicate the cause as for gethostbyname().

getloadavg

Name

getloadavg -- get system load averages

Synopsis

#include <stdlib.h>

int getloadavg(double loadavg[], int nelem);

Description

getloadavg() returns the number of processes in the system run queue averaged over various periods of time. Up to nelem samples are retrieved and assigned to successive elements of loadavg[]. The system imposes a maximum of 3 samples, representing averages over the last 1, 5, and 15 minutes, respectively.

Return Value

If the load average could not be obtained, -1 is returned. Otherwise, the number of samples actually retrieved is returned.

getopt

Name

getopt -- parse command line options

Synopsis

#include <unistd.h>

int getopt(int argc, char * const argv[], const char * optstring);

extern char *optarg;
extern int optind, opterr, optopt;

Description

The getopt() function shall parse command line arguments as described in POSIX 1003.1-2001 (ISO/IEC 9945-2003), with the following exceptions, where LSB and POSIX specifications vary. LSB systems shall implement the modified behaviors described below.

Argument Ordering

The getopt() function can process command line arguments referenced by argv in one of three ways:

PERMUTE 

the order of arguments in argv is altered so that all options (and their arguments) are moved in front of all of the operands. This is the default behavior.

Note: This behavior has undefined results if argv is not modifiable. This is to support historic behavior predating the use of const and ISO C (1999). The function prototype was aligned with POSIX 1003.1-2001 (ISO/IEC 9945-2003) despite the fact that it modifies argv, and the library maintainers are unwilling to change this.

REQUIRE_ORDER 

The arguments in argv are processed in exactly the order given, and option processing stops when the first non-option argument is reached, or when the element of argv is "--". This ordering can be enforced either by setting the environment variable POSIXLY_CORRECT, or by setting the first character of optstring to '+'.

RETURN_IN_ORDER 

The order of arguments is not altered, and all arguments are processed. Non-option arguments (operands) are handled as if they were the argument to an option with the value 1 ('\001'). This ordering is selected by setting the first character of optstring to '-';

Option Characteristics

LSB specifies that:

  • an element of argv that starts with "-" (and is not exactly "-" or "--") is an option element.

  • characters of an option element, aside from the initial "-", are option characters.

POSIX specifies that:

  • applications using getopt() shall obey the following syntax guidelines:

    • option name is a single alphanumeric character from the portable character set

    • option is preceded by the '-' delimiter character

    • options without option-arguments should be accepted when grouped behind one '-' delimiter

    • each option and option-argument is a separate argument

    • option-arguments are not optional

    • all options should precede operands on the command line

    • the argument "--" is accepted as a delimiter indicating the end of options and the consideration of subsequent arguments, if any, as operands

  • historical implementations of getopt() support other characters as options as an allowed extension, but applications that use extensions are not maximally portable.

  • support for multi-byte option characters is only possible when such characters can be represented as type int.

  • applications that call any utility with a first operand starting with '-' should usually specify "--" to mark the end of the options. Standard utilities that do not support this guideline indicate that fact in the OPTIONS section of the utility description.

Extensions

LSB specifies that:

  • if a character is followed by two colons, the option takes an optional argument; if there is text in the current argv element, it is returned in optarg, otherwise optarg is set to 0.

  • if optstring contains W followed by a semi-colon (;), then -W foo is treated as the long option --foo.

    Note: See getopt_long() for a description of long options.

  • The first character of optstring shall modify the behavior of getopt() as follows:

    • if the first character is '+', then REQUIRE_ORDER processing shall be in effect (see above)

    • if the first character is '-', then RETURN_IN_ORDER processing shall be in effect (see above)

    • if the first character is ':', then getopt() shall return ':' instead of '?' to indicate a missing option argument, and shall not print any diagnostic message to stderr.

POSIX specifies that:

  • the -W option is reserved for implementation extensions.

Return Values

LSB specifies the following additional getopt() return values:

  • '\001' is returned if RETURN_IN_ORDER argument ordering is in effect, and the next argument is an operand, not an option. The argument is available in optarg.

Any other return value has the same meaning as for POSIX.

POSIX specifies the following getopt() return values:

  • the next option character is returned, if found successfully.

  • ':' is returned if a parameter is missing for one of the options and the first character of optstring is ':'.

  • '?' is returned if an unknown option character not in optstring is encountered, or if getopt() detects a missing argument and the first character of optstring is not ':'.

  • -1 is returned for the end of the option list.

Environment Variables

LSB specifies that:

  • if the variable POSIXLY_CORRECT is set, option processing stops as soon as a non-option argument is encountered.

  • the variable _[PID]_GNU_nonoption_argv_flags_ (where [PID] is the process ID for the current process), contains a space separated list of arguments that should not be treated as arguments even though they appear to be so.

    Rationale: This was used by bash 2.0 to communicate to GNU libc which arguments resulted from wildcard expansion and so should not be considered as options. This behavior was removed in bash version 2.01, but the support remains in GNU libc.

    This behavior is DEPRECATED in this version of the LSB; future revisions of this specification may not include this requirement.

getopt_long

Name

getopt_long -- parse command line options

Synopsis

#define _GNU_SOURCE
#include <getopt.h>

int getopt_long(int argc, char * const argv[], const char * opstring, const struct option * longopts, int * longindex);

Description

getopt_long() works like getopt() except that it also accepts long options, started out by two dashes. Long option names may be abbreviated if the abbreviation is unique or is an exact match for some defined option. A long option may take a parameter, of the form --arg=param or --arg param.

longopts is a pointer to the first element of an array of struct option declared in getopt.h as:

  struct option {
             const char *name;
             int has_arg;
             int *flag;
             int val;
  };

The fields in this structure have the following meaning:

name 

The name of the long option.

has_arg 

One of:

no_argument (or 0) if the option does not take an argument,
required_argument (or 1) if the option requires an argument, or
optional_argument (or 2) if the option takes an optional argument.

flag 

specifies how results are returned for a long option. If flag is NULL, then getopt_long() shall return val. (For example, the calling program may set val to the equivalent short option character.) Otherwise, getopt_long() returns 0, and flag shall point to a variable which shall be set to val if the option is found, but left unchanged if the option is not found.

val 

The value to return, or to load into the variable pointed to by flag.

If longindex is not NULL, it points to a variable which is set to the index of the long option relative to longopts.

Return Value

getopt_long() returns the option character if a short option was found successfully, or ":" if there was a missing parameter for one of the options, or "?" for an unknown option character, or -1 for the end of the option list.

For a long option, getopt_long() returns val if flag is NULL, and 0 otherwise. Error and -1 returns are the same as for getopt(), plus "?" for an ambiguous match or an extraneous parameter.

getopt_long_only

Name

getopt_long_only -- parse command line options

Synopsis

#define _GNU_SOURCE
#include <getopt.h>

int getopt_long_only(int argc, char * const argv[], const char * optstring, const struct option * longopts, int * longindex);

Description

getopt_long_only() is like getopt_long(), but "-" as well as "--" can indicate a long option. If an option that starts with "-" (not "--") doesn't match a long option, but does match a short option, it is parsed as a short option instead.

Note: The getopt_long_only() function is intended only for supporting certain programs whose command line syntax was designed before the Utility Syntax Guidelines of POSIX 1003.1-2001 (ISO/IEC 9945-2003) were developed. New programs should generally call getopt_long() instead, which provides the --option syntax for long options, which is preferred by GNU and consistent with POSIX 1003.1-2001 (ISO/IEC 9945-2003).

Return Value

getopt_long_only() returns the option character if the option was found successfully, or ":" if there was a missing parameter for one of the options, or "?" for an unknown option character, or -1 for the end of the option list.

getopt_long_only() also returns the option character when a short option is recognized. For a long option, they return val if flag is NULL, and 0 otherwise. Error and -1 returns are the same as for getopt(), plus "?" for an ambiguous match or an extraneous parameter.

getpagesize

Name

getpagesize -- get memory page size (DEPRECATED)

Synopsis

#include <unistd.h>

int getpagesize (void );

Description

The function getpagesize() returns the number of bytes in a meory page.

Note: The getpagesize() function is deprecated. Portable applications should use sysconf(_SC_PAGE_SIZE) instead.

Return Value

The getpagesize() function returns the current page size.

Errors

No errors are defined.

getprotobyname_r

Name

getprotobyname_r -- retrieve information from the network protocol database by protocol name, reentrantly

Synopsis

#include <netdb.h>

int getprotobyname_r(const char * name, struct protoent * result_buf, char * buf, size_t buflen, struct protoent * * result);

Description

The getprotobyname_r() function is a reentrant version of the getprotobyname() function.

The getprotobyname_r() function shall search the network protocol database for an entry with the name name.

If a matching entry is found in the database, this function shall copy the relevant information to the application-supplied protoent structure referenced by result_buf, and return a pointer to this structure in *result. If no matching entry is found, *result shall be set to a null pointer.

The array buf shall contain the string fields referenced by the protoent structure that was returned. The parameter buflen shall specify the array's size. 1024 bytes should be enough for most uses.

Return Value

On success, the getprotobyname_r() function shall return 0. If the return value was ERANGE, the size of the buffer buf, indicated by buflen, was too small.

getprotobynumber_r

Name

getprotobynumber_r -- retrieve information from the network protocol database by protocol number, reentrantly

Synopsis

#include <netdb.h>

int getprotobynumber_r(int proto, struct protoent * result_buf, char * buf, size_t buflen, struct protoent * * result);

Description

The getprotobynumber_r() function is a reentrant version of the getprotobynumber() function.

The getprotobynumber_r() function shall search the network protocol database for an entry with protocol number proto.

If a matching entry is found in the database, this function shall copy the relevant information to the application-supplied protoent structure referenced by result_buf, and return a pointer to this structure in *result. If no matching entry is found, *result shall be set to a null pointer.

The array buf shall contain the string fields referenced by the protoent structure that was returned. The parameter buflen shall specify the array's size. 1024 bytes should be enough for most uses.

Return Value

On success, the getprotobynumber_r() function shall return 0. If the return value was ERANGE, the size of the buffer buf, indicated by buflen, was too small.

getprotoent_r

Name

getprotoent_r -- read the next entry of the protocol database, reentrantly

Synopsis

#include <netdb.h>

int getprotoent_r(struct protoent * result_buf, char * buf, size_t buflen, struct protoent * * result);

Description

The getprotoent_r() function is a reentrant version of the getprotoent() function.

The getprotoent_r() function shall search the network protocol database for the next entry.

If the next entry is found in the database, this function shall copy the relevant information to the application-supplied protoent structure referenced by result_buf, and return a pointer to this structure in *result. If no next entry is found, *result shall be set to a null pointer.

The array buf shall contain the string fields referenced by the protoent structure that was returned. The parameter buflen shall specify the array's size. 1024 bytes should be enough for most uses.

Return Value

On success, the getprotoent_r() function shall return zero.

If the return value was ENOENT, there were no more entries in the database.

If the return value was ERANGE, the size of the buffer buf, indicated by buflen, was too small.

getpwent_r

Name

getpwent_r -- reentrantly get entry in passwd file

Synopsis

#include <pwd.h>

int getpwent_r(struct passwd * pwbuf, char * buf, size_t buflen, struct passwd * * pwbufp);

Description

The reentrant interface getpwent_r() shall function in the same way as the interface getpwent(), except that getpwent_r() shall return the user name, user password, GECOS field, home directory, and shell program in buffers provided by the caller, rather than as a pointer to static storage.

The parameter pwbuf contains the struct passwd that was read from the stream, if any.

The parameter buf contains additional strings, if any.

The parameter buflen specifies the size of buf.

The parameter *pwbufp returns a pointer to the struct passwd in *pwbuf.

Return Value

On success, getpwent_r() shall return 0, and *pwbufp shall contain a pointer to the result.

On failure, *pwbufp shall contain NULL, and getpwent_r() shall return an error as follows.

Errors

ENOENT 

No more password entries.

ERANGE 

Not enough buffer space. Specify a larger buffer and try again.

getservbyname_r

Name

getservbyname_r -- retrieve information from the network services database by service name, reentrantly

Synopsis

#include <netdb.h>

int getservbyname_r(const char * name, const char * proto, struct servent * result_buf, char * buf, size_t buflen, struct servent * * result);

Description

The getservbyname_r() function is a reentrant version of the getservbyname() function.

The getservbyname_r() function shall search the network services database for an entry with the name name. The proto parameter shall restrict the search to entries with the specified protocol. If proto is NULL, getservbyname_r() may return entries with any protocol.

If a matching entry is found in the database, this function shall copy the relevant information to the application-supplied servent structure referenced by result_buf, and return a pointer to this structure in *result. If no matching entry is found, *result shall be set to a null pointer.

The array buf shall contain the string fields referenced by the servent structure that was returned. The parameter buflen shall specify the array's size. 1024 bytes should be enough for most uses.

Return Value

On success, the getservbyname_r() function shall return zero. If the return value was ERANGE, the size of the buffer buf, indicated by buflen, was too small.

getservbyport_r

Name

getservbyport_r -- retrieve information from the network services database by service port, reentrantly

Synopsis

#include <netdb.h>

int getservbyport_r(int port, const char * proto, struct servent * result_buf, char * buf, size_t buflen, struct servent * * result);

Description

The getservbyport_r() function is a reentrant version of the getservbyport() function.

The getservbyport_r() function shall search the network services database for an entry with the port port. The proto parameter shall restrict the search to entries with the specified protocol. If proto is NULL, getservbyport_r() may return entries with any protocol.

If a matching entry is found in the database, this function shall copy the relevant information to the application-supplied servent structure referenced by result_buf, and return a pointer to this structure in *result. If no matching entry is found, *result shall be set to a null pointer.

The array buf shall contain the string fields referenced by the servent structure that was returned. The parameter buflen shall specify the array's size. 1024 bytes should be enough for most uses.

Return Value

On success, the getservbyport_r() function shall return zero. If the return value was ERANGE, the size of the buffer buf, indicated by buflen, was too small.

getservent_r

Name

getservent_r -- read the next entry of the network services database, reentrantly

Synopsis

#include <netdb.h>

int getservent_r(struct servent * result_buf, char * buf, size_t buflen, struct servent * * result);

Description

The getservent_r() function is a reentrant version of the getservent() function.

The getservent_r() function shall search the network services database for the next entry.

If the next entry is found in the database, this function shall copy the relevant information to the application-supplied servent structure referenced by result_buf, and return a pointer to this structure in *result. If no next entry is found, *result shall be set to a null pointer.

The array buf shall contain the string fields referenced by the servent structure that was returned. The parameter buflen shall specify the array's size. 1024 bytes should be enough for most uses.

Return Value

On success, the getservent_r() function shall return 0.

If the return value was ENOENT, there were no more entries in the database.

If the return value was ERANGE, the size of the buffer buf, indicated by buflen, was too small.

getsockopt

Name

getsockopt -- get socket options

Synopsis

#include <sys/socket.h>
#include <netinet/ip.h>

int getsockopt(int socket, int level, int option_name, void * restrict option_value, socklen_t * restrict option_len);

Description

The getsockopt() function shall behave as specified in POSIX 1003.1-2001 (ISO/IEC 9945-2003), with the following extensions.

IP Protocol Level Options

If the level parameter is IPPROTO_IP, the following values shall be supported for option_name (see RFC 791:Internet Protocol for further details):

IP_OPTIONS 

Get the Internet Protocol options sent with every packet from this socket. The option_value shall point to a memory buffer in which the options shall be placed; on entry option_len shall point to an integer value indicating the maximum size of the memory buffer, in bytes. On successful return, the value referenced by option_len shall be updated to the size of data copied to the buffer. For IPv4, the maximum length of options is 40 bytes.

IP_TTL 

Get the current unicast Internet Protocol Time To Live value used when sending packets with this socket. The option_value shall point to a buffer large enough to hold the time to live value (at least 1 byte), and option_len shall point to an integer value holding the maximum size of that buffer. On successful return, the value referenced by option_len shall be updated to contain the number of bytes copied into the buffer, which shall be no larger than the initial value, and option_value shall point to an integer containing the time to live value.

IP_TOS 

Get the Internet Protocol type of service indicator used when sending packets with this socket. The option_value shall point to a buffer large enough to hold the type of service indicator (at least 1 byte), and option_len shall point to an integer value holding the maximum size of that buffer. On successful return, the value referenced by option_len shall be updated to contain the number of bytes copied into the buffer, which shall be no larger than the initial value, and option_value shall point to an integer containing the time to live value.

gettext

Name

gettext -- search message catalogs for a string

Synopsis

#include <libintl.h>

char * gettext(const char * msgid);

Description

The gettext() function shall search the currently selected message catalogs for a string identified by the string msgid. If a string is located, that string shall be returned.

The gettext() function is equivalent to dcgettext(NULL, msgid, LC_MESSAGES).

Return Value

If a string is found in the currently selected message catalogs for msgid, then a pointer to that string shall be returned. Otherwise, a pointer to msgid shall be returned.

Applications shall not modify the string returned by gettext().

Errors

None.

The gettext() function shall not modify errno.

See Also

dgettext, ngettext, dngettext, dcgettext, dcngettext, textdomain, bindtextdomain, bind_textdomain_codeset

getutent

Name

getutent -- access user accounting database entries

Synopsis

#include <utmp.h>

struct utmp *getutent(void);

Description

The getutent() function shall read the next entry from the user accounting database.

Return Value

Upon successful completion, getutent() shall return a pointer to a utmp structure containing a copy of the requested entry in the user accounting database. Otherwise, a null pointer shall be returned. The return value may point to a static area which is overwritten by a subsequent call to getutent().

Errors

None defined.

getutent_r

Name

getutent_r -- access user accounting database entries

Synopsis

int getutent_r(struct utmp * buffer, struct utmp ** result);

Description

The getutent_r() function is a reentrant version of the getutent() function. On entry, buffer should point to a user supplied buffer to which the next entry in the database will be copied, and result should point to a location where the result will be stored.

Return Value

On success, getutent_r() shall return 0 and set the location referenced by result to a pointer to buffer. Otherwise, getutent_r() shall return -1 and set the location referenced by result to NULL.

getwc_unlocked

Name

getwc_unlocked -- non-thread-safe getwc

Description

getwc_unlocked() is the same as getwc(), except that it need not be thread-safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

getwchar_unlocked

Name

getwchar_unlocked -- non-thread-safe getwchar

Description

getwchar_unlocked() is the same as getwchar(), except that it need not be thread-safe. That is, it may only be invoked in the ways which are legal for getc_unlocked().

glob64

Name

glob64 -- find pathnames matching a pattern (Large File Support)

Synopsis

#include <glob.h>

int glob64(const char * pattern, int flags, int (*errfunc) (const char *, int), glob64_t * pglob);

Description

glob64() is a large-file version of the glob() function defined in POSIX 1003.1-2001 (ISO/IEC 9945-2003). It shall search for pathnames matching pattern according to the rules used by the shell, /bin/sh. No tilde expansion or parameter substitution is done; see wordexp().

The results of a glob64() call are stored in the structure pointed to by pglob, which is a glob64_t declared in glob.h with the following members:

typedef struct
{
  size_t gl_pathc;
  char **gl_pathv;
  size_t gl_offs;
  int gl_flags;
  void (*gl_closedir) (void *);
  struct dirent64 *(*gl_readdir64) (void *);
  void *(*gl_opendir) (const char *);
  int (*gl_lstat) (const char *, struct stat *);
  int (*gl_stat) (const char *, struct stat *);
}
glob64_t;

Structure members with the same name as corresponding members of a glob_t as defined in POSIX 1003.1-2001 (ISO/IEC 9945-2003) shall have the same purpose.

Other members are defined as follows:

gl_flags 

reserved for internal use

gl_closedir 

pointer to a function capable of closing a directory opened by gl_opendir

gl_readdir64 

pointer to a function capable of reading entries in a large directory

gl_opendir 

pointer to a function capable of opening a large directory

gl_stat 

pointer to a function capable of returning file status for a large file

gl_lstat 

pointer to a function capable of returning file status information for a large file or symbolic link

A large file or large directory is one with a size which cannot be represented by a variable of type off_t.

Return Value

On success, 0 is returned. Other possible returns are:

GLOB_NOSPACE 

out of memory

GLOB_ABORTED 

read error

GLOB_NOMATCH 

no match found

globfree64

Name

globfree64 -- free memory from glob64() (Large File Support)

Synopsis

#include <glob.h>

void globfree64(glob64_t * pglob);

Description

globfree64() frees the dynamically allocated storage from an earlier call to glob64().

globfree64() is a large-file version of the globfree() function defined in POSIX 1003.1-2001 (ISO/IEC 9945-2003).

gnu_get_libc_version, gnu_get_libc_release

Name

gnu_get_libc_version, gnu_get_libc_release -- get glibc-specific version and release

Synopsis

#include <gnu/libc-version.h>

const char * gnu_get_libc_version(void);

const char * gnu_get_libc_release(void);

Description

gnu_get_libc_version() returns a string that identifies the version of the C library running the program making the call.

gnu_get_libc_release() returns a string indicates the release status of the C library running the program making the call. This will be a string such as "stable".

Return Value

The functions return strings. The contents of these strings are unspecified.

Errors

No errors are defined.

Notes

These functions are specific to GNU libc (glibc). This specification does not require the implementation of libc to be glibc, although it requires these functions.

The string returned by gnu_get_libc_version() will be a dotted version string, which may have meaning to developers otherwise familiar with glibc. These functions have been requested to aid in portability of software which also runs in non-LSB contexts, but decisions based on the return value should be tempered by an understanding of what the behavioral requirements of this specification are. That is, it may or may not be useful to discover that a running system, for example, has version "2.10.1" if that implies different behavior than described by this specification.

hcreate_r

Name

hcreate_r -- allocate space for a hash search table, reentrantly

Synopsis

#include <search.h>

int hcreate_r(size_t nel, struct hsearch_data * htab);

Description

The hcreate_r() function is a reentrant version of the hcreate() function.

hcreate_r() shall initialize the object referenced by htab with a hash table containing at least nel elements. Unlike its non-reentrant equivalent, hcreate(), the hcreate_r() function may work with more than one hash table.

The memory for the htab object may be dynamically allocated. It must be initialized with 0 before hcreate_r() is called.

Return Value

On success, hcreate_r() shall return a non-zero value.

On failure, hcreate_r() shall return 0. This usually happens because not enough memory was available.

hdestroy_r

Name

hdestroy_r -- dispose of a hash search table, reentrantly

Synopsis

#include <search.h>

void hdestroy_r(struct hsearch_data * htab);

Description

The hdestroy_r() function is a reentrant version of the hdestroy() function.

hdestroy_r() frees the resources allocated by hcreate_r() for the object htab.

hsearch_r

Name

hsearch_r -- search a hash table, reentrantly

Synopsis

#include <search.h>

int hsearch_r(ENTRY item, ACTION action, ENTRY * * retval, struct hsearch_data * htab);

Description

The hsearch_r() is a reentrant version of the hsearch() function, but instead of operating on a single global hash table, hsearch_r() operates on the table described by the object that htab references. This object can be initialized with the function hcreate_r().

Unlike the hsearch() function, hsearch_r() returns a pointer to the found entry in the variable referred to by retval, rather than directly.

Return Value

On success, hsearch_r() shall return a non-zero value.

On failure, hsearch_r() shall return 0 and set errno to an appropriate value.

Errors

ENOMEM 

action was set to ENTER, but the table was full.

ESRCH 

action was set to FIND, but no matching element was found in the table.

inet_aton

Name

inet_aton -- Internet address manipulation routine

Synopsis

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

int anet_iton(const char * cp, struct in_addr * inp);

Description

inet_aton() converts the Internet host address cp from the standard IPv4 numbers-and-dots notation into binary data and stores it in the structure that inp points to.

inet_aton() returns a nonzero value if the address is valid, 0 if not.

Note: Note that on some LSB architectures, the host byte order is Least Significant Byte first, whereas the network byte order, as used on the Internet, is Most Significant Byte first.

initgroups

Name

initgroups -- initialize the supplementary group access list

Synopsis

#include <grp.h>
#include <sys/types.h>

int initgroups(const char * user, gid_t group);

Description

If the process has appropriate privilege, the initgroups() function shall initialize the Supplementary Group IDs for the current process by reading the group database and using all groups of which user is a member. The additional group group is also added to the list.

Return Value

On success, 0 is returned. On error, -1 is returned and the global variable errno is set appropriately.

Errors

EPERM 

The calling process does not have sufficient privileges.

ENOMEM 

Insufficient memory to allocate group information structure.

See Also

setgroups()

initstate_r

Name

initstate_r -- reentrantly initialize a state array for random number generator functions

Synopsis

#include <stdlib.h>

int initstate_r(unsigned int seed, char * statebuf, size_t statelen, struct random_data * buffer);

Description

The interface initstate_r() shall function in the same way as the interface initstate(), except that initstate_r() shall use the data in buffer instead of the global random number generator state.

inotify_add_watch

Name

inotify_add_watch -- add a watch to a watch list

Synopsis

#include <sys/inotify.h>

int inotify_add_watch(int fd, const char * path, uint32_t mask);

Description

inotify_add_watch() shall add a watch to, or modify an existing watch on, the watch list of the inotify instance specified by the file descriptor fd, for the file specified by path, to monitor the events specified by the bitmask mask. The caller must have read access to the file.

Return Value

On success, inotify_add_watch() shall return the unique, non-negative watch descriptor associated with the file path and the inotify instance specified by the file descriptor fd.

If path was already on the watch list, then inotify_add_watch() shall return the existing watch descriptor.

If path was not already on the watch list, then inotify_add_watch() shall allocate a new watch descriptor.

inotify_add_watch() shall not work recursively. Monitoring subdirectories of path shall require adding watches to them.

On failure, inotify_add_watch() shall return -1 and set errno to an appropriate value.

Errors

EACCESS 

The caller does not have read access to path.

EBADF 

The file descriptor fd is invalid.

EFAULT 

path is outside of the address space accessible by the process.

EINVAL 

mask contains no legal events, or fd is not a valid inotify file descriptor.

ENOMEM 

There is not enough kernel memory available.

ENOSPC 

The maximum number of watches has been created for this user, or the kernel cannot allocate a resource.

Application Usage

Reading

The function read() can be used to determine which inotify events have occurred. A blocking file descriptor will make read() block until at least one event has occurred.

If successful, read() will return at least one of the following inotify_event structures in a buffer:

struct inotify_event {
    int      wd;
    uint32_t mask;
    uint32_t cookie;
    uint32_t len;
    char     path[];
};
  

wd is a watch descriptor that specifies the watch associated with the event. It is obtained from a previous invocation of inotify_add_watch().

mask is a bit mask describing inotify events. See the section on masks below.

cookie is an integer associating related inotify events. The integer value is unique, and currently only enables the application to associate IN_MOVE_FROM and IN_MOVE_TO rename events.

len is a count of the bytes in path, including null bytes. This means that the total length of an inotify_event structure is

sizeof(inotify_event)+len
  

path is only returned when an event occurs for a file within a watched directory. This string is null-terminated, and it may contain more null bytes so that future reads will be aligned properly on an address boundary.

In kernels before 2.6.21, read() returns 0 when the buffer given to it is too small to return data about the next event. In subsequent kernels, it fails with the error EINVAL.

For a given file descriptor, the inotify events are returned in an ordered queue. Events on a file descriptor will always be returned in the correct order of occurrence. If two or more inotify events for a given file descriptor have identical values for all fields, then only one inotify_event will be returned to represent all of them.

The number of bytes that can be read from an inotify file descriptor can be determined by making a FIONREAD ioctl() call.

Masks

The mask argument of inotify_add_watch() and the mask field of the inotify_event structure are bit masks that specify inotify events. The bits in the list below can be set in the mask argument of inotify_add_watch() and returned in the mask field of inotify_event.

IN_ACCESS 

File was read.

IN_ALL_EVENTS 

Bit mask of all events in this list.

IN_ATTRIB 

File's metadata changed (including timestamps and permissions).

IN_CLOSE 

Same as

IN_CLOSE_WRITE | IN_CLOSE_NOWRITE
  

IN_CLOSE_WRITE 

File that was opened for writing was closed.

IN_CLOSE_NOWRITE 

File that was not opened for writing was closed.

IN_CREATE 

File or directory was created in a watched directory.

IN_DELETE 

File or directory was deleted in a watched directory.

IN_DELETE_SELF 

Watched file or directory was deleted.

IN_MODIFY 

File was changed.

IN_MOVE 

Same as

IN_MOVED_FROM | IN_MOVED_TO
  

IN_MOVE_SELF 

Watched file or directory was moved

IN_MOVED_FROM 

File was moved out of watched directory.

IN_MOVED_TO 

File was moved into watched directory.

IN_OPEN 

File was opened.

All of the events above, except for IN_DELETE_SELF and IN_MOVE_SELF, cause the name field of the inotify_event structure to contain the name of the file or directory being monitored.

The following bit is valid for inotify_add_watch() only.

IN_ONESHOT 

Monitor path for an event, and then remove it from the watch list.

The following bits are valid for the inotify_event structure only.

IN_IGNORED 

Watch was removed, either explicitly (via inotify_rm_watch()) or implicitly (file deletion or file system unmounting).

IN_ISDIR 

Object being watched is a directory.

IN_Q_OVERFLOW 

The event queue overflowed (wd is set to -1).

IN_UNMOUNT 

File system of object being watched was unmounted.

Notes

It is possible to monitor file descriptors with the functions epoll(), poll(), and select().

When all of the file descriptors that point to an inotify instance have been closed, the instance and its associated resources and watches are freed by the kernel.

See Also

inotify_init(), inotify_rm_watch()

inotify_init

Name

inotify_init -- instantiate inotify

Synopsis

#include <sys/inotify.h>

int inotify_init(void);

Description

inotify_init() shall create one instance of inotify.

Return Value

On success, inotify_init() shall return a file descriptor pointing to the new inotify instance.

On failure, inotify_init() shall return -1 and set errno to an appropriate value.

Errors

EMFILE 

The maximum number of inotify instances has been created for this user.

ENFILE 

The maximum number of file descriptors has been created on the system.

ENOMEM 

There is not enough kernel memory available.

See Also

inotify_add_watch(), inotify_rm_watch()

inotify_rm_watch

Name

inotify_rm_watch -- remove a watch from an inotify watch list

Synopsis

#include <sys/inotify.h>

int inotify_rm_watch(int fd, int wd);

Description

inotify_rm_watch() shall remove the watch associated with the watch descriptor wd from the watch list of the inotify instance associated with the file descriptor fd.

If a watch is removed, its watch descriptor shall generate the IN_IGNORED event.

Return Value

On success, inotify_rm_watch() shall return 0.

On failure, inotify_rm_watch() shall return -1 and set errno to an appropriate value.

Errors

EBADF 

The file descriptor fd is invalid.

EINVAL 

wd is invalid, or fd is not a valid inotify file descriptor.

See Also

inotify_add_watch(), inotify_init()

ioctl

Name

ioctl -- control device

Synopsis

#include <sys/ioctl.h>

int ioctl (int fildes , int request , ...);

Description

The ioctl() function shall manipulate the underlying device parameters of special files. fildes shall be an open file descriptor referring to a special file. The ioctl() function shall take three parameters; the type and value of the third parameter is dependent on the device and request.

Conforming LSB applications shall not call ioctl() except in situations explicitly stated in this specification.

Return Value

On success, 0 is returned. An ioctl() may use the return value as an output parameter and return a non-negative value on success. On error, -1 is returned and the global variable errno is set appropriately.

Errors

EBADF 

fildes is not a valid descriptor.

EFAULT 

The third parameter references an inaccessible memory area.

ENOTTY 

fildes is not associated with a character special device.

ENOTTY  

The specified request does not apply to the kind of object that fildes references.

EINVAL  

request or the third parameter is not valid.

Relationship to POSIX (Informative)

It should be noted that POSIX 1003.1-2001 (ISO/IEC 9945-2003) contains an interface named ioctl(). The LSB only defines behavior when fildes refers to a socket (see sockio) or terminal device (see ttyio), while POSIX 1003.1-2001 (ISO/IEC 9945-2003) only defines behavior when fildes refers to a STREAMS device. An implementation may support both behaviors; the LSB does not require any STREAMS support.

sockio

Name

sockio -- socket ioctl commands

Synopsis

#include <sys/ioctl.h>
#include <sys/socket.h>
#include <net/if.h>
#include <netinet/in.h>

int ioctl(int sockfd, int request, void * argp);

Description

Socket ioctl() commands are a subset of the ioctl() calls, which can perform a variety of functions on sockets. sockfd shall be an open file descriptor referring to a socket (see the socket() or accept() functions).

Socket ioctl() commands apply to the underlying network interfaces, and affect the entire system, not just the file descriptor used to issue the ioctl().

The following values for request are accepted:

SIOCGIFCONF (Deprecated)

Get the interface configuration list for the system.

Note: The SIOCGIFCONF interface is superceded by the if_nameindex() family of functions (see POSIX 1003.1-2001 (ISO/IEC 9945-2003)). A future version of this specification may withdraw this value for request.

argp shall point to a ifconf structure, as described in <net/if.h>. Before calling, the caller shall set the ifc_ifcu.ifcu_req field to point to an array of ifreq structures, and set ifc_len to the size in bytes of this allocated array. Upon return, ifc_len will contain the size in bytes of the array which was actually used. If it is the same as the length upon calling, the caller should assume that the array was too small and try again with a larger array.

On success, SIOCGIFCONF shall return a nonnegative value.

Rationale: Historical UNIX systems disagree on the meaning of the return value.

SIOCGIFFLAGS

Get the interface flags for the indicated interface. argp shall point to a ifreq structure. Before calling, the caller should fill in the ifr_name field with the interface name, and upon return, the ifr_ifru.ifru_flags field is set with the interface flags.

SIOCGIFADDR

Get the interface address for the given interface. argp shall point to a ifreq structure. Before calling, the caller should fill in the ifr_name field with the interface name, and upon return, the ifr_ifru.ifru_addr field is set with the interface address.

SIOCGIFBRDADDR

Get the interface broadcast address for the given interface. argp shall point to a ifreq structure. Before calling, the caller should fill in the ifr_name field with the interface name, and upon return, the ifr_ifru.ifru_broadcast field is set with the interface broadcast address.

SIOCGIFDSTADDR

Get the point-to-point address for the given interface. argp shall point to a ifreq structure. Before calling, the caller should fill in the ifr_name field with the interface name, and upon return, the ifr_dstaddr field is set with the point-to-point address.

SIOCGIFNAME

Get the name of an interface. argp shall point to a ifreq structure. Before calling, the caller should fill in the ifr_ifindex field with the number (index) of the interface, and upon return, the ifr_name field is set with the interface name.

SIOCGIFNETMASK

Get the network mask for the given interface. argp shall point to a ifreq structure. Before calling, the caller should fill in the ifr_name field with the interface name, and upon return, the ifr_ifru.ifru_netmask field is set with the network mask.

SIOCGIFMTU

Get the Maximum Transmission Unit (MTU) size for the given interface. argp shall point to a ifreq structure. Before calling, the caller should fill in the ifr_name field with the interface name, and upon return, the ifr_ifru.ifru_mtu field is set with the MTU. Note: The range of valid values for MTU varies for an interface depending on the interface type.

FIONREAD

Get the amount of queued unread data in the receive buffer. argp shall point to an integer where the result is to be placed.

Note: Some implementations may also support the use of FIONREAD on other types of file descriptor. However, the LSB only specifies its behavior for a socket related file descriptor.

Return Value

On success, if request is SIOCGIFCONF, a non-negative integer shall be returned. If request is not SIOCGIFCONF, on success 0 is returned. On error, -1 is returned and the global variable errno is set appropriately.

Errors

EBADF 

sockfd is not a valid descriptor.

EFAULT 

argp references an inaccessible memory area.

ENOTTY 

The specified request does not apply to the kind of object that the descriptor sockfd references.

EINVAL 

Either request or argp is invalid.

ENOTCONN 

The operation is only defined on a connected socket, but the socket wasn't connected.

ttyio

Name

ttyio -- tty ioctl commands

Synopsis

#include <sys/ioctl.h>
#include <fcntl.h>

int ioctl(int fd, unsigned long request, int * argp);

Description

Tty ioctl commands are a subset of the ioctl() calls, which can perform a variety of functions on tty devices. fd shall be an open file descriptor referring to a terminal device.

The following ioctl()s are provided:

TIOCGWINSZ 

Get the size attributes of the terminal or pseudo-terminal identified by fd. On entry, argp shall reference a winsize structure. On return, the structure will have ws_row set to the number of rows of text (i.e. lines of text) that can be viewed on the device, and ws_col set to the number of columns (i.e. text width).

Note: The number of columns stored in ws_col assumes that the terminal device is using a mono-spaced font.

Return Value

On success, 0 is returned. On error, -1 is returned and the global variable errno is set appropriately.

Errors

EBADF 

fd is not a valid descriptor.

EFAULT 

argp references an inaccessible memory area.

EINVAL 

request and argp are not valid.

jrand48_r

Name

jrand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution

Synopsis

#include <stdlib.h>

int jrand48_r(unsigned short[3] xsubi, struct drand48_data * buffer, long int * result);

Description

The interface jrand48_r() shall function in the same way as the interface jrand48(), except that jrand48_r() shall use the data in buffer instead of the global random number generator state.

Before it is used, buffer must be initialized, for example, by calling lcong48_r(), seed48_r(), or srand48_r(), or by filling it with zeroes.

kill

Name

kill -- send a signal

Synopsis

#include <signal.h>

int kill(pid_t pid, int sig);

Description

kill() is as specified in the POSIX 1003.1-2001 (ISO/IEC 9945-2003), but with differences as listed below.

Process ID -1 doesn't affect calling process

If pid is specified as -1, sig shall not be sent to the calling process. Other than this, the rules in the POSIX 1003.1-2001 (ISO/IEC 9945-2003) apply.

Rationale: This was a deliberate Linus decision after an unpopular experiment in including the calling process in the 2.5.1 kernel. See "What does it mean to signal everybody?", Linux Weekly News, 20 December 2001, http://lwn.net/2001/1220/kernel.php3

lcong48_r

Name

lcong48_r -- reentrantly generate pseudorandom numbers in a uniform distribution

Synopsis

#include <libc.h>

int lcong48_r(unsigned short[7] param, struct drand48_data * buffer);

Description

The interface lcong48_r() shall function in the same way as the interface lcong48(), except that lcong48_r() shall use the data in buffer instead of the global random number generator state.

link

Name

link -- create a link to a file

Synopsis

#include <unistd.h>

int link(const char * path1, const char * path2);

Description

The link() function shall behave as specified in POSIX 1003.1-2001 (ISO/IEC 9945-2003), except with differences as listed below.

Need Not Follow Symlinks

POSIX 1003.1-2001 (ISO/IEC 9945-2003) specifies that pathname resolution shall follow symbolic links during pathname resolution unless the function is required to act on the symbolic link itself, or certain arguments direct that the function act on the symbolic link itself. The link() function in POSIX 1003.1-2001 (ISO/IEC 9945-2003) contains no such requirement to operate on a symbolic link. However, a conforming LSB implementation need not follow a symbolic link for the path1 argument.

lrand48_r

Name

lrand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution

Synopsis

#include <stdlib.h>

int lrand48_r(struct drand48_data * buffer, long int * result);

Description

The interface lrand48_r() shall function in the same way as the interface lrand48(), except that lrand48_r() shall use the data in buffer instead of the global random number generator state.

Before it is used, buffer must be initialized, for example, by calling lcong48_r(), seed48_r(), or srand48_r(), or by filling it with zeroes.

mbsnrtowcs

Name

mbsnrtowcs -- convert a multibyte string to a wide character string

Synopsis

#include <wchar.h>

size_t mbsnrtowcs(wchar_t * dest, const char * * src, size_t nms, size_t len, mbstate_t * ps);

Description

mbsnrtowcs() is like mbsrtowcs(), except that the number of bytes to be converted, starting at src, is limited to nms.

If dest is not a NULL pointer, mbsnrtowcs() converts at most nms bytes from the multibyte string src to a wide-character string starting at dest. At most, len wide characters are written to dest. The shift state ps is updated.

The conversion is effectively performed by repeatedly calling:

 
mbrtowc(dest, *src, n, ps)
where n is some positive number, as long as this call succeeds, and then incrementing dest by one and src by the number of bytes consumed.

The conversion can stop for three reasons:

  • An invalid multibyte sequence has been encountered. In this case src is left pointing to the invalid multibyte sequence, (size_t)(-1) is returned, and errno is set to EILSEQ.

  • The nms limit forces a stop, or len non-L'\0' wide characters have been stored at dest. In this case, src is left pointing to the next multibyte sequence to be converted, and the number of wide characters written to dest is returned.

  • The multibyte string has been completely converted, including the terminating '\0' (which has the side effect of bringing back ps to the initial state). In this case, src is set to NULL, and the number of wide characters written to dest, excluding the terminating L'\0' character, is returned.

If dest is NULL, len is ignored, and the conversion proceeds as above, except that the converted wide characters are not written out to memory, and that no destination length limit exists.

In both of the above cases, if ps is a NULL pointer, a static anonymous state only known to mbsnrtowcs() is used instead.

The programmer shall ensure that there is room for at least len wide characters at dest.

Return Value

mbsnrtowcs() returns the number of wide characters that make up the converted part of the wide character string, not including the terminating null wide character. If an invalid multibyte sequence was encountered, (size_t)(-1) is returned, and the global variable errno is set to EILSEQ.

Notes

The behavior of mbsnrtowcs() depends on the LC_CTYPE category of the current locale.

Passing NULL as ps is not multi-thread safe.

memmem

Name

memmem -- locate bytes

Synopsis

#define _GNU_SOURCE
#include <string.h>

void * memmem(const void * haystack, size_t haystacklen, const void * needle, size_t needlelen);

Description

memmem() finds the start of the first occurrence of the byte array referenced by needle of length needlelen in the memory area haystack of length haystacklen.

Return Value

If needle is found, memmem() returns a pointer to it. If needlelen is 0, memmem returns haystack. If needle is not found in haystack, memmem() returns NULL.

Notes

Earlier versions of the C library (prior to glibc 2.1) contained a memmem() with various problems, and application developers should treat this function with care.

memrchr

Name

memrchr -- scan memory for a character

Synopsis

#include <string.h>

void * memrchr(const void * s, int c, size_t n);

Description

The memrchr() function shall locate the last occurence of c (converted to an unsigned char) in the initial n bytes (each interpreted as an unsigned char) of the object pointed to by s.

Return Value

The memrchr() shall return a pointer to the located byte, or a null pointer if the byte does not occur in the object.

Errors

No errors are defined.

See Also

memchr()

mkstemp64

Name

mkstemp64 -- create a unique temporary file (Large File Support)

Synopsis

#include <stdio.h>
#include <stdlib.h>

int mkstemp64(char * template);

Description

mkstemp64() shall generates a unique temporary file name from template. The last six characters of template shall be XXXXXX and these are replaced with a string that makes the file name unique; the file is then created and an open file descriptor returned as described for mkstemp().

mkstemp64() is a large-file version of the mkstemp() function as defined in POSIX 1003.1-2001 (ISO/IEC 9945-2003). The only difference is that the temporary file is opened with open64() instead of with open().

Return Value

On success, mkstemp64() returns the file descriptor of the temporary file. Otherwise mkstemp64() shall return -1 and set errno to indicate the error.

Errors

See mkstemp() for possible error values.

mrand48_r

Name

mrand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution

Synopsis

#include <stdlib.h>

int mrand48_r(struct drand48_data * buffer, long int * result);

Description

The interface mrand48_r() shall function in the same way as the interface mrand48(), except that mrand48_r() shall use the data in buffer instead of the global random number generator state.

Before it is used, buffer must be initialized, for example, by calling lcong48_r(), seed48_r(), or srand48_r(), or by filling it with zeroes.

mremap

Name

mremap -- remap a virtual memory address

Synopsis

#include <sys/mman.h>

void * mremap(void * old_address, size_t old_size, size_t new_size, int flags);

Description

The mremap() function expands (or shrinks) an existing memory mapping, potentially moving it at the same time, depending on the flags argument and the available virtual address space.

old_address is the old address of the virtual memory block to be resized. Note that old_address must be page aligned. old_size is the old size of the virtual memory block. new_size is the requested size of the virtual memory block after the resize.

In Linux the memory is divided into pages. A user process has (one or) several linear virtual memory segments. Each virtual memory segment has one or more mappings to real memory pages (in the page table). Each virtual memory segment has its own protection (access rights), which may cause a segmentation violation if the memory is accessed incorrectly (e.g., writing to a read-only segment). Accessing virtual memory outside of the segments will also cause a segmentation violation.

mremap() uses the Linux page table scheme. mremap() changes the mapping between virtual addresses and memory pages. This can be used to implement a very efficient form of realloc().

The flags bit-mask argument may be 0, or include the following flag:

MREMAP_MAYMOVE 

By default, if there is not sufficient space to expand a mapping at its current location, then mremap() fails. If this flag is specified, then the kernel is permitted to relocate the mapping to a new virtual address, if necessary. If the mapping is relocated, then absolute pointers into the old mapping location become invalid (offsets relative to the starting address of the mapping should be employed).

MREMAP_FIXED 

This flag serves a similar purpose to the MAP_FIXED flag of mmap(). If this flag is specified, then mremap()accepts a fifth argument, void *new_address, which specifies a pagealigned address to which the mapping must be moved. Any previous mapping at the address range specified by new_address and new_size is unmapped. If MREMAP_FIXED is specified, then MREMAP_MAYMOVE must also be specified.

If the memory segment specified by old_address and old_size is locked (using mlock() or similar), then this lock is maintained when the segment is resized and/or relocated. As a consequence, the amount of memory locked by the process may change.

Return Value

The mremap() function returns a pointer to the new virtual memory area on success. On error, the value MAP_FAILED is returned, and errno is set appropriately.

Errors

EAGAIN 

The caller tried to expand a memory segment that is locked, but this was not possible without exceeding the RLIMIT_MEMLOCK resource limit.

EFAULT 

"Segmentation fault." Some address in the range old_address to old_address+old_size is an invalid virtual memory address for this process. You can also get EFAULT even if there exist mappings that cover the whole address space requested, but those mappings are of different types.

EINVAL 

An invalid argument was given. Possible causes are: old_address was not page aligned; a value other than MREMAP_MAYMOVE or MREMAP_FIXED was specified in flags; new_size was zero; new_size or new_address was invalid; or the new address range specified by new_address and new_size overlapped the old address range specified by old_address and old_size; or MREMAP_FIXED was specified without also specifying MREMAP_MAYMOVE.

ENOMEM 

The memory area cannot be expanded at the current virtual address, and the MREMAP_MAYMOVE flag is not set in flags, or, there is not enough (virtual) memory available.

newlocale

Name

newlocale -- allocate a locale object

Synopsis

#include <locale.h>

locale_t newlocale(int category_mask, const char * locale, locale_t base);

Description

The newlocale() function shall initialize a locale object. If base is NULL, then newlocale() shall first allocate the object; otherwise it shall use the locale object referenced by base.

The object shall be initialized for the locale named by locale, and for the categories selected in category_mask. The category_mask value is a bitwise inclusive OR of the required LC_name_MASK values, or the value LC_ALL_MASK.

Return Value

On success, the newlocale() function shall return the initialized locale object. Otherwise, it shall return NULL, and set errno to indicate the error.

Errors

The newlocale() function shall fail if:

ENOMEM 

Insufficient memory.

EINVAL 

An invalid category_mask was provided, or the locale was NULL.

ENOENT 

For any of the categories in category_mask, the locale data is not available.

Application Usage (Informative)

The only portable way to allocate a locale object is to call newlocale() with a NULL base. The allocated object may be reinitialized to a new locale by passing it back to newlocale(). The new object may be released by calling freelocale().

See Also

setlocale(), freelocale(), duplocale(), uselocale()

ngettext

Name

ngettext -- search message catalogs for plural string

Synopsis

#include <libintl.h>

char * ngettext(const char * msgid1, const char * msgid2, unsigned long int n);

Description

The ngettext() function shall search the currently selected message catalogs for a string matching the singular string msgid1. If a string is located, and if n is 1, that string shall be returned. If n is not 1, a pluralized version (dependent on n) of the string shall be returned.

The ngettext() function is equivalent to dcngettext(NULL, msgid1, msgid2, n, LC_MESSAGES)().

Return Value

If a string is found in the currently selected message catalogs for msgid1, then if n is 1 a pointer to the located string shall be returned. If n is not 1, a pointer to an appropriately pluralized version of the string shall be returned. If no message could be found in the currently selected mesage catalogs, then if n is 1, a pointer to msgid1 shall be returned, otherwise a pointer to msgid2 shall be returned.

Applications shall not modify the string returned by ngettext().

Errors

None.

The ngettext() function shall not modify errno.

See Also

gettext, dgettext, ngettext, dngettext, dcgettext, dcngettext, textdomain, bindtextdomain, bind_textdomain_codeset

nrand48_r

Name

nrand48_r -- reentrantly generate pseudorandom numbers in a uniform distribution

Synopsis

#include <stdlib.h>

int nrand48_r(unsigned short[3] xsubi, struct drand48_data * buffer, long int * result);

Description

The interface nrand48_r() shall function in the same way as the interface nrand48(), except that nrand48_r() shall use the data in buffer instead of the global random number generator state.

Before it is used, buffer must be initialized, for example, by calling lcong48_r(), seed48_r(), or srand48_r(), or by filling it with zeroes.

openat64

Name

openat64 -- open a file relative to a directory file descriptor (Large File Support)

Synopsis

#include <fcntl.h>

int openat64(int fd, const char * path, int oflag, ...);

Description

openat64() shall establish a connection between a file and a file descriptor. It shall be identical open64() except in the case where path specifies a relative path. In this case, the file to be opened shall be determined relative to the directory associated with the file descriptor fd instead of the current working directory.

openat64() is a large-file version of the openat() function as defined in POSIX 1003.1-2008 (ISO/IEC 9945-2009). It differs from openat() in the same way that open64() differs from open(), that the open is done in large-file mode.

Return Value

On success, openat64() returns a new file descriptor. Otherwise openat64() shall return -1 and set errno to indicate the error.

Errors

See openat() for possible error values.

pmap_getport

Name

pmap_getport -- find the port number assigned to a service registered with a portmapper.

Synopsis

#include <rpc/pmap_clnt.h>

u_short * pmap_getport(struct sockaddr_in * address, const u_long program, const u_long * version, u_int protocol);

Description

The pmap_getport() function shall return the port number assigned to a service registered with a RPC Binding service running on a given target system, using the protocol described in RFC 1833: Binding Protocols for ONC RPC Version 2. The pmap_getport() function shall be called given the RPC program number program, the program version version, and transport protocol protocol. Conforming implementations shall support both IPPROTO_UDP and IPPROTO_TCP protocols. On entry, address shall specify the address of the system on which the portmapper to be contacted resides. The value of address->sin_port shall be ignored, and the standard value for the portmapper port shall always be used.

Note: Security and network restrictions may prevent a conforming application from contacting a remote RPC Binding Service.

Return Value

On success, the pmap_getport() function shall return the port number in host byte order of the RPC application registered with the remote portmapper. On failure, if either the program was not registered or the remote portmapper service could not be reached, the pmap_getport() function shall return 0. If the remote portmap service could not be reached, the status is left in the global variable rpc_createerr.

pmap_set

Name

pmap_set -- establishes mapping to machine's RPC Bind service.

Synopsis

#include <rpc/pmap_clnt.h>

bool_t pmap_set(const u_long program, const u_long version, int protocol, u_short port);

Description

pmap_set() establishes a mapping between the triple [program,version,protocol] and port on the machine's RPC Bind service. The value of protocol is most likely IPPROTO_UDP or IPPROTO_TCP. Automatically done by svc_register().

Return Value

pmap_set() returns non-zero if it suceeds, 0 otherwise.

pmap_unset

Name

pmap_unset --  destroys RPC Binding

Synopsis


#include <rpc/pmap_clnt.h>

bool_t pmap_unset(u_long prognum, u_long versnum);

Description

As a user interface to the RPC Bind service, pmap_unset() destroys all mapping between the triple [prognum,versnum, *] and ports on the machine's RPC Bind service.

Return Value

pmap_unset() returns non-zero if it succeeds, zero otherwise.

posix_fadvise64

Name

posix_fadvise64 -- File advisory information (Large File Support)

Synopsis

#include <fcntl.h>

int posix_fadvise64(int fd, off64_t offset, off64_t len, int advice);

Description

The posix_fadvise64() function is a large-file version of the posix_fadvise() function defined in POSIX 1003.1-2001 (ISO/IEC 9945-2003). It shall advise the implementation on the expected behavior of the application with respect to the data in the file associated with the open file descriptor, fd, starting at offset and continuing for len bytes. The specified range need not currently exist in the file. If len is zero, all data following offset is specified. The implementation may use this information to optimize handling of the specified data. The posix_fadvise() function shall have no effect on the semantics of other operations on the specified data, although it may affect the performance of other operations.

The advice to be applied to the data is specified by the advice parameter, as specified in posix_fadvise().

Return Value

On success, posix_fadvise64() shall return 0. Otherwise an error number shall be returned to indicate the error. See posix_fadvise() for possible error values.

posix_fallocate64

Name

posix_fallocate64 -- file space control (Large File Support)

Synopsis

#include <fcntl.h>

int posix_fallocate64(int fd, off64_t offset, off64_t len);

Description

The posix_fallocate64() function is a large file version of posix_fallocate(). It shall behave as posix_fallocate() in POSIX 1003.1-2001 (ISO/IEC 9945-2003), except that the offset and len arguments are off64_t objects rather than off_t.

Return Value

See posix_fallocate().

Errors

See posix_fallocate().

pread64

Name

pread64 -- read from a file (Large File Support)

Synopsis

#include <unistd.h>

ssize_t pread64(int fd, void * buf, size_t count, off64_t