Linux Standard Base Core Specification 3.0Preview1

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 are 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

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

Linux is a trademark of Linus Torvalds.

UNIX a registered trademark of the Open Group in the United States and other countries.

LSB is a trademark of the Free Standards Group in the USA and other countries.

AMD is a trademark of Advanced Micro Devices, Inc.

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

OpenGL is a registered trademark of Silicon Graphics, Inc.

Table of Contents
Specification Introduction
ELF Specification
Linux Standard Base Specification
Linux Packaging Specification
Free Documentation License

Foreword

This is version 3.0Preview1 of the Linux Standard Base Core Specification. An implementation of this version of the specification may not claim to be an implementation of the Linux Standard Base unless it has successfully completed the compliance process as defined by the Free Standards Group.


Introduction

The LSB defines a binary interface for application programs that are compiled and packaged for LSB-conforming implementations on many different hardware architectures. Since a binary specification shall include information specific to the computer processor architecture for which it is intended, it is not possible for a single document to specify the interface for all possible LSB-conforming implementations. Therefore, the LSB is a family of specifications, rather than a single one.

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:

  • The first number (x) is the major version number. All versions with the same major version number should share binary compatibility. Any addition or deletion of a new library results in a new version number. Interfaces marked as deprecated may be removed from the specification at a major version change.

  • The second number (y) is the minor version number. Individual interfaces may be added if all certified implementations already had that (previously undocumented) interface. Interfaces may be marked as deprecated at a minor version change. Other minor changes may be permitted at the discretion of the LSB workgroup.

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


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") describing those parts of the interface that remain constant across all implementations of the LSB, and an architecture-specific specification ("LSB-arch") describing the parts of the interface that vary by processor architecture. Together, the LSB-generic and the architecture-specific supplement for a single hardware architecture provide a complete interface specification for compiled application programs on systems that share a common hardware architecture.

The LSB-generic document shall be used in conjunction with an architecture-specific supplement. Whenever a section of the LSB-generic specification shall be supplemented by architecture-specific information, the LSB-generic document includes a reference to the architecture supplement. Architecture supplements 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 shall provide 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 Standards Base (LSB). This module provides the fundamental system interfaces, libraries, and runtime environment upon which all conforming applications and libraries depend.

Interfaces described in this module are mandatory except where explicitly listed otherwise. Core interfaces may be supplemented by other modules; all modules are built upon the core.


Chapter 2. Normative References

The specifications listed below are referenced in whole or in part by the Linux Standard Base. In this specification, where only a particular section of one of these references is identified, then the normative reference is to that section alone, and the rest of the referenced document is informative.

Table 2-1. Normative References

NameTitleURL
DWARF Debugging Information FormatDWARF Debugging Information Format, Revision 2.0.0 (July 27, 1993)http://www.eagercon.com/dwarf/dwarf-2.0.0.pdf
Filesystem Hierarchy StandardFilesystem Hierarchy Standard (FHS) 2.3http://www.pathname.com/fhs/
Gdk 2.6.2 Reference ManualGdk 2.6.2 Reference Manualhttp://www.gtk.org/api/2.6/gdk/index.html
Gdk-pixbuf 2.6.2 Reference ManualGdk-pixbuf 2.6.2 Reference Manualhttp://www.gtk.org/api/2.6/gdk-pixbuf/index.html
Glib 2.6.2 Reference ManualGlib 2.6.2 Reference Manualhttp://www.gtk.org/api/2.6/glib/index.html
Gobject 2.6.2 Reference ManualGobject 2.6.2 Reference Manualhttp://www.gtk.org/api/2.6/gobject/index.html
Gtk 2.6.2 Reference ManualGtk 2.6.2 Reference Manualhttp://www.gtk.org/api/2.6/gtk/index.html
IEEE Std 754-1985IEEE Standard 754 for Binary Floating-Point Arithmetichttp://www.ieee.org/
ISO C (1999)ISO/IEC 9899: 1999, Programming Languages --C
ISO POSIX (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/
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
Large File SupportLarge File Supporthttp://www.UNIX-systems.org/version2/whatsnew/lfs20mar.html
Li18nux Globalization SpecificationLI18NUX 2000 Globalization Specification, Version 1.0 with Amendment 4http://www.li18nux.org/docs/html/LI18NUX-2000-amd4.htm
Linux Allocated Device RegistryLINUX ALLOCATED DEVICEShttp://www.lanana.org/docs/device-list/devices.txt
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 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
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
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
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 Edition
System V ABISystem V Application Binary Interface, Edition 4.1http://www.caldera.com/developers/devspecs/gabi41.pdf
System V ABI UpdateSystem V Application Binary Interface - DRAFT - 17 December 2003http://www.caldera.com/developers/gabi/2003-12-17/contents.html
this specificationLinux Standard Basehttp://www.linuxbase.org/spec/
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

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 architecture-specific specification.

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
libpamlibpam.so.0
libgcc_slibgcc_s.so.1

Table 3-2. Standard Library Names defined in the Architecture Specific Supplement

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 shall satisfy the following requirements:

  • The implementation shall implement fully the architecture described in the hardware manual for the target processor architecture.

  • 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 shall satisfy the following requirements:

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

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

  • It employs 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 is stated in the application's documentation.

  • It does 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 is in turn an LSB conforming application.

    • The use of that interface or data format, as well as its source, is 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 does 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. Definitions

For the purposes of this document, the following definitions, as specified in the ISO/IEC Directives, Part 2, 2001, 4th Edition, apply:

can

be able to; there is a possibility of; it is possible to

cannot

be unable to; there is no possibilty of; it is not possible to

may

is permitted; is allowed; is permissible

need not

it is not required that; no...is required

shall

is to; is required to; it is required that; has to; only...is permitted; it is necessary

shall not

is not allowed [permitted] [acceptable] [permissible]; is required to be not; is required that...be not; is not to be

should

it is recommended that; ought to

should not

it is not recommended that; ought not to


Chapter 5. Terminology

For the purposes of this document, the following terms apply:

archLSB

The architectural part of the LSB Specification which describes the specific parts of the interface that are platform specific. The archLSB is complementary to the gLSB.

Binary Standard

The total set of interfaces that are available to be used in the compiled binary code of a conforming application.

gLSB

The common part of the LSB Specification that describes those parts of the interface that remain constant across all hardware implementations of the LSB.

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

The set of interfaces that are available to be used in the source code of a conforming application.

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.

Other terms and definitions used in this document shall have the same meaning as defined in Chapter 3 of the Base Definitions volume of ISO POSIX (2003).


Chapter 6. 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) [1]

refers to the interface named forkpty() with symbol version GLIBC_2.0 that is defined in the first of the listed references below the table.


Chapter 7. Relationship To ISO/IEC 9945 POSIX

This specification includes many interfaces described in ISO POSIX (2003). Unless otherwise specified, such interfaces should behave exactly as described in that specification. Any conflict between the requirements described here and the ISO POSIX (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 ISO POSIX (2003) into a single place. It is the long term plan of the LSB to converge 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.

I. Low Level System Information


Chapter 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.


Chapter 2. Machine Interface

2.1. Data Representation

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


2.1.1. Fundamental Types

In addition to the fundamental types specified in the Architecture specific ELF documents, a 1 byte data type is defined here.

Table 2-1. Scalar Types

TypeCC++sizeofAlignment (bytes)Architecture Representation
Integral_Boolbool11byte


Chapter 3. 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.


Chapter 4. Sections

4.1. Introduction

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


4.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 4-1, drawn from the System V ABI, or one of the additional values specified in Table 4-2.

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


4.2.1. ELF Section Types

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

Table 4-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 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. 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 the Chapter 5 for details.
SHT_HIPROC0x7fffffffValues in this inclusive range are reserved for processor-specific semantics.
SHT_HIUSER0xffffffffThis value specifies the upper bound of the range of indexes reserved for application programs. Section types between SHT_LOUSER and SHT_HIUSER can be used by the application, without conflicting with current or future system-defined section types.
SHT_INIT_ARRAY0xeThis section contains an array of pointers to initialization functions, as described in `Initialization and Termination Functions' in Chapter 5. Each pointer in the array is taken as a parameterless procedure with a void return.
SHT_LOPROC0x70000000Values in this inclusive range are reserved for processor-specific semantics.
SHT_LOUSER0x80000000This value specifies the lower bound of the range of indexes reserved for application programs.
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 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. 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"
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. `Relocation' b
SHT_SHLIB0xaThis section type is reserved but has unspecified semantics.
SHT_STRTAB0x3The section holds a string table. An object file may have multiple string table sections. See `String Table' below 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.


4.2.2. Additional Section Types

The following additional section types are defined here.

Table 4-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.


Chapter 5. Special Sections

5.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.


5.1.1. ELF Special Sections

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

Table 5-1. 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
.rodata1SHT_PROGBITSSHF_ALLOC
.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 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 for more information.

.dynsym

This section holds the dynamic linking symbol table, as described in `Symbol Table'. See Chapter 5 for more information.

.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 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 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 describes of the System V Application Binary Interface, Edition 4.1.

.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 for more information.

.rodata1

This section hold sread-only data that typically contribute to a non-writable segment in the process image. See `Program Header' in Chapter 5 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; otherwi

.symtab

This section holds a symbol table, as `Symbol Table'. in this chapter 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.


5.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 5-2. Additional Special Sections

NameTypeAttributes
.ctorsSHT_PROGBITSSHF_ALLOC+SHF_WRITE
.dtorsSHT_PROGBITSSHF_ALLOC+SHF_WRITE
.eh_frameSHT_PROGBITSSHF_ALLOC
.eh_frame_hdrSHT_PROGBITSSHF_ALLOC
.gnu.versionSHT_GNU_versymSHF_ALLOC
.gnu.version_dSHT_GNU_verdefSHF_ALLOC
.gnu.version_rSHT_GNU_verneedSHF_ALLOC
.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.

.dtors

This section contains a list of global destructor function pointers.

.eh_frame

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

.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.

.gnu.version

This section contains the Symbol Version Table.

.gnu.version_d

This section contains the Version Definitions.

.gnu.version_r

This section contains the Version Requirments.

.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.

.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.


Chapter 6. Symbol Mapping

6.1. Introduction

This chapter defines how names are mapped from the source symbol to the object symbol.


6.2. Symbol Mapping

Symbols in a source program are translated by the compilation system into symbols that exist in the object file. The rules for this translation are defined here.


6.2.1. C Language

External C symbols have the same names in C and object files' symbol tables.


Chapter 7. DWARF Extensions

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

Table 7-1. 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) 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_def_cfa_offset_sf instruction takes an unsigned LEB128 operand representing an argument size.
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.

Chapter 8. EH Frame

This chapter will contain a formal description of the contents of the .eh_frame_hdr section.


Chapter 9. EH Frame Header

9.1. Introduction

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 the DWARF Exception Header Encoding described below.

Table 9-1. .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.


9.2. DWARF Exception Header Encoding

The DWARF Exception Header Encoding is used to describe the type of data used in the .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 9-2. DWARF Exception Header value format

NameValueMeaning
DW_EH_PE_omit0xffNo value is present.
DW_EH_PE_uleb1280x01Unsigned value is encoded using the Little Endian Base 128 (LEB128) as defined by DWARF Debugging Information Format.
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.
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 9-3. DWARF Exception Header application

NameValueMeaning
DW_EH_PE_absptr0x00Value is used with no modification.
DW_EH_PE_pcrel0x10Value is reletive to the current program counter.
DW_EH_PE_datarel0x30Value is reletive to the beginning of the .eh_frame_hdr section.
DW_EH_PE_omit0xffNo value is present.

Chapter 10. Symbol Versioning

10.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.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.3. Version Definitions

Symbol definitions are contained in the special section .gnu.version_d which has a section type of SHT_GNU_verdef. The number of entries in this section is contained in the DT_VERDEFNUM entry of the Dynamic Section. The sh_link member of the section header points to the section that contains the strings referenced by this section.

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.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.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.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.


Chapter 11. 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.

III. Dynamic Linking


Chapter 12. 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 supplemented by this document and an architecture-specific LSB specification.

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


Chapter 13. 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 13-1. Linux Segment Types

NameValue
PT_GNU_EH_FRAME0x6474e550
PT_GNU_STACK0x6474e551

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.


Chapter 14. Dynamic Entries

14.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 14-1. Dynamic Structure

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


14.2. Dynamic Entries


14.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_HASH

Address of symbol hash table

DT_HIPROC

End of processor-specific

DT_INIT

Address of init function

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_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_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


14.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_FINI_ARRAY

The address of an array of pointers to termination functions.

DT_FINI_ARRAYSZ

Size in bytes of DT_FINI_ARRAY

DT_HIOS

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

DT_INIT_ARRAY

The address of an array of pointers to initialization functions.

DT_INIT_ARRAYSZ

Size in bytes of DT_INIT_ARRAY

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_RUNPATH

null-terminated library search path string

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.

Table of Contents
I. Base Libraries
1. Libraries
1.1. Introduction
1.2. Program Interpreter
1.3. Interfaces for libc
1.4. Data Definitions for libc
1.5. Interface Definitions for libc
1.6. Interfaces for libm
1.7. Data Definitions for libm
1.8. Interface Definitions for libm
1.9. Interfaces for libpthread
1.10. Data Definitions for libpthread
1.11. Interface Definitions for libpthread
1.12. Interfaces for libgcc_s
1.13. Data Definitions for libgcc_s
1.14. Interfaces for libdl
1.15. Data Definitions for libdl
1.16. Interface Definitions for libdl
1.17. Interfaces for libcrypt
1.18. Interfaces for libpam
1.19. Data Definitions for libpam
1.20. Interface Definitions for libpam
II. Utility Libraries
2. Utility Libraries
2.1. Introduction
2.2. Interfaces for libz
2.3. Data Definitions for libz
2.4. Interface Definitions for libz
2.5. Interfaces for libncurses
2.6. Data Definitions for libncurses
2.7. Interfaces for libutil
2.8. Interface Definitions for libutil
III. Commands and Utilities
3. Commands and Utilities
3.1. Commands and Utilities
3.2. Command Behavior
IV. Execution Environment
4. File System Hierarchy
4.1. /dev
4.2. User Accounting Databases
4.3. Path For System Administration Utilities
5. Additional Recommendations
5.1. Minimal granted Directory and File permissions
5.2. Recommendations for applications on ownership and permissions
6. Additional Behaviors
6.1. Mandatory Optional Behaviors
7. Localization
7.1. Introduction
7.2. Regular Expressions
7.3. Pattern Matching Notation
V. System Initialization
8. System Initialization
8.1. Cron Jobs
8.2. Init Script Actions
8.3. Comment Conventions for Init Scripts
8.4. Installation and Removal of init.d Files
8.5. Run Levels
8.6. Facility Names
8.7. Script Names
8.8. Init Script Functions
VI. Users & Groups
9. Users & Groups
9.1. User and Group Database
9.2. User & Group Names
9.3. UID Ranges
9.4. Rationale
A. Alphabetical Listing of Interfaces
A.1. libc
A.2. libcrypt
A.3. libdl
A.4. libm
A.5. libncurses
A.6. libpam
A.7. libpthread
A.8. libutil
A.9. libz
List of Tables
1-1. libc Definition
1-2. libc - RPC Function Interfaces
1-3. libc - System Calls Function Interfaces
1-4. libc - Standard I/O Function Interfaces
1-5. libc - Standard I/O Data Interfaces
1-6. libc - Signal Handling Function Interfaces
1-7. libc - Signal Handling Data Interfaces
1-8. libc - Localization Functions Function Interfaces
1-9. libc - Localization Functions Data Interfaces
1-10. libc - Socket Interface Function Interfaces
1-11. libc - Wide Characters Function Interfaces
1-12. libc - String Functions Function Interfaces
1-13. libc - IPC Functions Function Interfaces
1-14. libc - Regular Expressions Function Interfaces
1-15. libc - Character Type Functions Function Interfaces
1-16. libc - Time Manipulation Function Interfaces
1-17. libc - Time Manipulation Data Interfaces
1-18. libc - Terminal Interface Functions Function Interfaces
1-19. libc - System Database Interface Function Interfaces
1-20. libc - Language Support Function Interfaces
1-21. libc - Large File Support Function Interfaces
1-22. libc - Standard Library Function Interfaces
1-23. libc - Standard Library Data Interfaces
1-24. libm Definition
1-25. libm - Math Function Interfaces
1-26. libm - Math Data Interfaces
1-27. libpthread Definition
1-28. libpthread - Realtime Threads Function Interfaces
1-29. libpthread - Posix Threads Function Interfaces
1-30. libgcc_s Definition
1-31. libdl Definition
1-32. libdl - Dynamic Loader Function Interfaces
1-33. libcrypt Definition
1-34. libcrypt - Encryption Function Interfaces
1-35. libpam Definition
1-36. libpam - Pluggable Authentication API Function Interfaces
2-1. libz Definition
2-2. libz - Compression Library Function Interfaces
2-3. libncurses Definition
2-4. libncurses - Curses Function Interfaces
2-5. libncurses - Curses Data Interfaces
2-6. libutil Definition
2-7. libutil - Utility Functions Function Interfaces
3-1. Commands And Utilities
3-2. Built In Utilities
3-1. Escape Sequences
9-1. Required User & Group Names
9-2. Optional User & Group Names
A-1. libc Function Interfaces
A-2. libc Data Interfaces
A-3. libcrypt Function Interfaces
A-4. libdl Function Interfaces
A-5. libm Function Interfaces
A-6. libm Data Interfaces
A-7. libncurses Function Interfaces
A-8. libncurses Data Interfaces
A-9. libpam Function Interfaces
A-10. libpthread Function Interfaces
A-11. libutil Function Interfaces
A-12. libz Function Interfaces

I. Base Libraries

Table of Contents
1. Libraries

Chapter 1. Libraries

1.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

  • libcrypt

  • libpam


1.2. Program Interpreter

The Program Interpreter is specified in the appropriate architecture-specific LSB specification.


1.3. Interfaces for libc

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

Table 1-1. libc Definition

Library:libc
SONAME:See archLSB.

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

Large File Support
this specification
SUSv2
ISO POSIX (2003)
SVID Issue 3
SVID Issue 4


1.3.1. RPC


1.3.1.1. Interfaces for RPC

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

Table 1-2. libc - RPC Function Interfaces

authnone_create [1]svc_getreqset [2]svcudp_create [3]xdr_int [2]xdr_u_long [2]
clnt_create [1]svc_register [3]xdr_accepted_reply [2]xdr_long [2]xdr_u_short [2]
clnt_pcreateerror [1]svc_run [3]xdr_array [2]xdr_opaque [2]xdr_union [2]
clnt_perrno [1]svc_sendreply [3]xdr_bool [2]xdr_opaque_auth [2]xdr_vector [2]
clnt_perror [1]svcerr_auth [2]xdr_bytes [2]xdr_pointer [2]xdr_void [2]
clnt_spcreateerror [1]svcerr_decode [2]xdr_callhdr [2]xdr_reference [2]xdr_wrapstring [2]
clnt_sperrno [1]svcerr_noproc [2]xdr_callmsg [2]xdr_rejected_reply [2]xdrmem_create [2]
clnt_sperror [1]svcerr_noprog [2]xdr_char [2]xdr_replymsg [2]xdrrec_create [2]
key_decryptsession [2]svcerr_progvers [2]xdr_double [2]xdr_short [2]xdrrec_eof [2]
pmap_getport [3]svcerr_systemerr [2]xdr_enum [2]xdr_string [2] 
pmap_set [3]svcerr_weakauth [2]xdr_float [2]xdr_u_char [2] 
pmap_unset [3]svctcp_create [3]xdr_free [2]xdr_u_int [3] 

Referenced Specification(s)


1.3.2. System Calls


1.3.2.1. Interfaces for System Calls

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

Table 1-3. libc - System Calls Function Interfaces

__fxstat [1]fchmod [2]getwd [2]read [2]setrlimit [2]
__getpgid [1]fchown [2]initgroups [1]readdir [2]setrlimit64 [3]
__lxstat [1]fcntl [1]ioctl [1]readdir_r [2]setsid [2]
__xmknod [1]fdatasync [2]kill [1]readlink [2]setuid [2]
__xstat [1]flock [1]killpg [2]readv [2]sleep [2]
access [2]fork [2]lchown [2]rename [2]statvfs [2]
acct [1]fstatvfs [2]link [1]rmdir [2]stime [1]
alarm [2]fsync [2]lockf [2]sbrk [4]symlink [2]
brk [4]ftime [2]lseek [2]sched_get_priority_max [2]sync [2]
chdir [2]ftruncate [2]mkdir [2]sched_get_priority_min [2]sysconf [2]
chmod [2]getcontext [2]mkfifo [2]sched_getparam [2]time [2]
chown [2]getegid [2]mlock [2]sched_getscheduler [2]times [2]
chroot [4]geteuid [2]mlockall [2]sched_rr_get_interval [2]truncate [2]
clock [2]getgid [2]mmap [2]sched_setparam [2]ulimit [2]
close [2]getgroups [2]mprotect [2]sched_setscheduler [2]umask [2]
closedir [2]getitimer [2]msync [2]sched_yield [2]uname [2]
creat [2]getloadavg [1]munlock [2]select [2]unlink [1]
dup [2]getpagesize [4]munlockall [2]setcontext [2]utime [2]
dup2 [2]getpgid [2]munmap [2]setegid [2]utimes [2]
execl [2]getpgrp [2]nanosleep [2]seteuid [2]vfork [2]
execle [2]getpid [2]nice [2]setgid [2]wait [2]
execlp [2]getppid [2]open [2]setitimer [2]wait4 [1]
execv [2]getpriority [2]opendir [2]setpgid [2]waitpid [1]
execve [2]getrlimit [2]pathconf [2]setpgrp [2]write [2]
execvp [2]getrusage [2]pause [2]setpriority [2]writev [2]
exit [2]getsid [2]pipe [2]setregid [2] 
fchdir [2]getuid [2]poll [2]setreuid [2] 

Referenced Specification(s)

[4]. SUSv2


1.3.3. Standard I/O


1.3.3.1. Interfaces for Standard I/O

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

Table 1-4. libc - Standard I/O Function Interfaces

_IO_feof [1]fgetpos [2]fsetpos [2]putchar [2]sscanf [1]
_IO_getc [1]fgets [2]ftell [2]putchar_unlocked [2]telldir [2]
_IO_putc [1]fgetwc_unlocked [1]ftello [2]puts [2]tempnam [2]
_IO_puts [1]fileno [2]fwrite [2]putw [3]ungetc [2]
asprintf [1]flockfile [2]getc [2]remove [2]vasprintf [1]
clearerr [2]fopen [2]getc_unlocked [2]rewind [2]vdprintf [1]
ctermid [2]fprintf [2]getchar [2]rewinddir [2]vfprintf [2]
fclose [2]fputc [2]getchar_unlocked [2]scanf [1]vprintf [2]
fdopen [2]fputs [2]getw [3]seekdir [2]vsnprintf [2]
feof [2]fread [2]pclose [2]setbuf [2]vsprintf [2]
ferror [2]freopen [2]popen [2]setbuffer [1] 
fflush [2]fscanf [1]printf [2]setvbuf [2] 
fflush_unlocked [1]fseek [2]putc [2]snprintf [2] 
fgetc [2]fseeko [2]putc_unlocked [2]sprintf [2] 

Referenced Specification(s)

[3]. SUSv2

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

Table 1-5. libc - Standard I/O Data Interfaces

stderr [1]stdin [1]stdout [1]  

Referenced Specification(s)


1.3.4. Signal Handling


1.3.4.1. Interfaces for Signal Handling

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

Table 1-6. libc - Signal Handling Function Interfaces

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

Referenced Specification(s)

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

Table 1-7. libc - Signal Handling Data Interfaces

_sys_siglist [1]    

Referenced Specification(s)


1.3.5. Localization Functions


1.3.5.1. Interfaces for Localization Functions

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

Table 1-8. libc - Localization Functions Function Interfaces

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

Referenced Specification(s)

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

Table 1-9. libc - Localization Functions Data Interfaces

_nl_msg_cat_cntr [1]    

Referenced Specification(s)


1.3.6. Socket Interface


1.3.6.1. Interfaces for Socket Interface

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

Table 1-10. libc - Socket Interface Function Interfaces

__h_errno_location [1]gethostname [2]if_nameindex [2]send [2]socket [2]
accept [2]getpeername [2]if_nametoindex [2]sendmsg [2]socketpair [2]
bind [2]getsockname [2]listen [2]sendto [2] 
bindresvport [1]getsockopt [1]recv [2]setsockopt [1] 
connect [2]if_freenameindex [2]recvfrom [2]shutdown [2] 
gethostid [2]if_indextoname [2]recvmsg [2]sockatmark [2] 

Referenced Specification(s)


1.3.7. Wide Characters


1.3.7.1. Interfaces for Wide Characters

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

Table 1-11. libc - Wide Characters Function Interfaces

__wcstod_internal [1]mbsinit [2]vwscanf [1]wcsnlen [1]wcstoumax [2]
__wcstof_internal [1]mbsnrtowcs [1]wcpcpy [1]wcsnrtombs [1]wcstouq [1]
__wcstol_internal [1]mbsrtowcs [2]wcpncpy [1]wcspbrk [2]wcswcs [2]
__wcstold_internal [1]mbstowcs [2]wcrtomb [2]wcsrchr [2]wcswidth [2]
__wcstoul_internal [1]mbtowc [2]wcscasecmp [1]wcsrtombs [2]wcsxfrm [2]
btowc [2]putwc [2]wcscat [2]wcsspn [2]wctob [2]
fgetwc [2]putwchar [2]wcschr [2]wcsstr [2]wctomb [2]
fgetws [2]swprintf [2]wcscmp [2]wcstod [2]wctrans [2]
fputwc [2]swscanf [1]wcscoll [2]wcstof [2]wctype [2]
fputws [2]towctrans [2]wcscpy [2]wcstoimax [2]wcwidth [2]
fwide [2]towlower [2]wcscspn [2]wcstok [2]wmemchr [2]
fwprintf [2]towupper [2]wcsdup [1]wcstol [2]wmemcmp [2]
fwscanf [1]ungetwc [2]wcsftime [2]wcstold [2]wmemcpy [2]
getwc [2]vfwprintf [2]wcslen [2]wcstoll [2]wmemmove [2]
getwchar [2]vfwscanf [1]wcsncasecmp [1]wcstombs [2]wmemset [2]
mblen [2]vswprintf [2]wcsncat [2]wcstoq [1]wprintf [2]
mbrlen [2]vswscanf [1]wcsncmp [2]wcstoul [2]wscanf [1]
mbrtowc [2]vwprintf [2]wcsncpy [2]wcstoull [2] 

Referenced Specification(s)


1.3.8. String Functions


1.3.8.1. Interfaces for String Functions

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

Table 1-12. libc - String Functions Function Interfaces

__mempcpy [1]bzero [2]strcasestr [1]strncat [2]strtok [2]
__rawmemchr [1]ffs [2]strcat [2]strncmp [2]strtok_r [2]
__stpcpy [1]index [2]strchr [2]strncpy [2]strtold [2]
__strdup [1]memccpy [2]strcmp [2]strndup [1]strtoll [2]
__strtod_internal [1]memchr [2]strcoll [2]strnlen [1]strtoq [1]
__strtof_internal [1]memcmp [2]strcpy [2]strpbrk [2]strtoull [2]
__strtok_r [1]memcpy [2]strcspn [2]strptime [1]strtoumax [2]
__strtol_internal [1]memmove [2]strdup [2]strrchr [2]strtouq [1]
__strtold_internal [1]memrchr [1]strerror [2]strsep [1]strxfrm [2]
__strtoll_internal [1]memset [2]strerror_r [1]strsignal [1]swab [2]
__strtoul_internal [1]rindex [2]strfmon [2]strspn [2] 
__strtoull_internal [1]stpcpy [1]strftime [2]strstr [2] 
bcmp [2]stpncpy [1]strlen [2]strtof [2] 
bcopy [2]strcasecmp [2]strncasecmp [2]strtoimax [2] 

Referenced Specification(s)


1.3.9. IPC Functions


1.3.9.1. Interfaces for IPC Functions

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

Table 1-13. libc - IPC Functions Function Interfaces

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

Referenced Specification(s)


1.3.10. Regular Expressions


1.3.10.1. Interfaces for Regular Expressions

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

Table 1-14. libc - Regular Expressions Function Interfaces

regcomp [1]regerror [1]regexec [2]regfree [1] 

Referenced Specification(s)


1.3.11. Character Type Functions


1.3.11.1. Interfaces for Character Type Functions

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

Table 1-15. libc - Character Type Functions Function Interfaces

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

Referenced Specification(s)


1.3.12. Time Manipulation


1.3.12.1. Interfaces for Time Manipulation

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

Table 1-16. libc - Time Manipulation Function Interfaces

adjtime [1]ctime [2]gmtime [2]localtime_r [2]ualarm [2]
asctime [2]ctime_r [2]gmtime_r [2]mktime [2] 
asctime_r [2]difftime [2]localtime [2]tzset [2] 

Referenced Specification(s)

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

Table 1-17. libc - Time Manipulation Data Interfaces

__daylight [1]__tzname [1]timezone [2]  
__timezone [1]daylight [2]tzname [2]  

Referenced Specification(s)


1.3.13. Terminal Interface Functions


1.3.13.1. Interfaces for Terminal Interface Functions

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

Table 1-18. libc - Terminal Interface Functions Function Interfaces

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

Referenced Specification(s)


1.3.14. System Database Interface


1.3.14.1. Interfaces for System Database Interface

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

Table 1-19. libc - System Database Interface Function Interfaces

endgrent [1]getgrgid_r [1]getprotoent [1]getservent [1]setgroups [2]
endprotoent [1]getgrnam [1]getpwent [1]getutent [2]setprotoent [1]
endpwent [1]getgrnam_r [1]getpwnam [1]getutent_r [2]setpwent [1]
endservent [1]getgrouplist [2]getpwnam_r [1]getutxent [1]setservent [1]
endutent [3]gethostbyaddr [1]getpwuid [1]getutxid [1]setutent [2]
endutxent [1]gethostbyname [1]getpwuid_r [1]getutxline [1]setutxent [1]
getgrent [1]getprotobyname [1]getservbyname [1]pututxline [1]utmpname [2]
getgrgid [1]getprotobynumber [1]getservbyport [1]setgrent [1] 

Referenced Specification(s)

[3]. SUSv2


1.3.15. Language Support


1.3.15.1. Interfaces for Language Support

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

Table 1-20. libc - Language Support Function Interfaces

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

Referenced Specification(s)


1.3.16. Large File Support


1.3.16.1. Interfaces for Large File Support

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

Table 1-21. libc - Large File Support Function Interfaces

__fxstat64 [1]fopen64 [2]ftello64 [2]lseek64 [2]readdir64 [2]
__lxstat64 [1]freopen64 [2]ftruncate64 [2]mkstemp64 [2]statvfs64 [2]
__xstat64 [1]fseeko64 [2]ftw64 [2]mmap64 [2]tmpfile64 [2]
creat64 [2]fsetpos64 [2]getrlimit64 [2]nftw64 [2]truncate64 [2]
fgetpos64 [2]fstatvfs64 [2]lockf64 [2]open64 [2] 

Referenced Specification(s)


1.3.17. Standard Library


1.3.17.1. Interfaces for Standard Library

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

Table 1-22. libc - Standard Library Function Interfaces

_Exit [1]dirname [1]glob [1]lsearch [1]srand48 [1]
__assert_fail [2]div [1]glob64 [2]makecontext [1]srandom [1]
__cxa_atexit [2]drand48 [1]globfree [1]malloc [1]strtod [1]
__errno_location [2]ecvt [1]globfree64 [2]memmem [2]strtol [1]
__fpending [2]erand48 [1]grantpt [1]mkstemp [1]strtoul [1]
__getpagesize [2]err [2]hcreate [1]mktemp [1]swapcontext [1]
__isinf [2]error [2]hdestroy [1]mrand48 [1]syslog [1]
__isinff [2]errx [2]hsearch [1]nftw [1]system [2]
__isinfl [2]fcvt [1]htonl [1]nrand48 [1]tdelete [1]
__isnan [2]fmtmsg [1]htons [1]ntohl [1]tfind [1]
__isnanf [2]fnmatch [1]imaxabs [1]ntohs [1]tmpfile [1]
__isnanl [2]fpathconf [1]imaxdiv [1]openlog [1]tmpnam [1]
__sysconf [2]free [1]inet_addr [1]perror [1]tsearch [1]
_exit [1]freeaddrinfo [1]inet_ntoa [1]posix_memalign [1]ttyname [1]
_longjmp [1]ftrylockfile [1]inet_ntop [1]posix_openpt [1]ttyname_r [1]
_setjmp [1]ftw [1]inet_pton [1]ptsname [1]twalk [1]
a64l [1]funlockfile [1]initstate [1]putenv [1]unlockpt [1]
abort [1]gai_strerror [1]insque [1]qsort [1]unsetenv [1]
abs [1]gcvt [1]isatty [1]rand [1]usleep [1]
atof [1]getaddrinfo [1]isblank [1]rand_r [1]verrx [2]
atoi [1]getcwd [1]jrand48 [1]random [1]vfscanf [2]
atol [1]getdate [1]l64a [1]realloc [1]vscanf [2]
atoll [1]getenv [1]labs [1]realpath [1]vsscanf [2]
basename [1]getlogin [1]lcong48 [1]remque [1]vsyslog [2]
bsearch [1]getnameinfo [1]ldiv [1]seed48 [1]warn [2]
calloc [1]getopt [2]lfind [1]setenv [1]warnx [2]
closelog [1]getopt_long [2]llabs [1]sethostname [2]wordexp [1]
confstr [1]getopt_long_only [2]lldiv [1]setlogmask [1]wordfree [1]
cuserid [3]getsubopt [1]longjmp [1]setstate [1] 
daemon [2]gettimeofday [1]lrand48 [1]srand [1] 

Referenced Specification(s)

[3]. SUSv2

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

Table 1-23. libc - Standard Library Data Interfaces

__environ [1]_sys_errlist [1]getdate_err [2]opterr [2]optopt [2]
_environ [1]environ [2]optarg [2]optind [2] 

Referenced Specification(s)


1.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.

These definitions are intended to supplement those provided in the referenced underlying specifications.

This specification uses ISO/IEC 9899 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.


1.4.1. ctype.h


enum
{
  _ISupper, _ISlower, _ISalpha, _ISdigit, _ISxdigit, _ISspace, _ISprint,
    _ISgraph, _ISblank, _IScntrl, _ISpunct, _ISalnum
}
 ;

1.4.2. 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];
}
 ;

1.4.3. errno.h

ISO POSIX (2003) requires that each error value shall be unique, with permission for EAGAIN and EWOULDBLOCK possibly having the same value. This specification also requires that ENOTSUP and EOPNOTSUPP have the same value.

Note: A defect report against ISO POSIX (2003) has been filed to request that specification also permit these two symbols to have the same value.


#define errno	(*__errno_location())

#define EPERM	1
#define ECHILD	10
#define ENETDOWN	100
#define ENETUNREACH	101
#define ENETRESET	102
#define ECONNABORTED	103
#define ECONNRESET	104
#define ENOBUFS	105
#define EISCONN	106
#define ENOTCONN	107
#define ESHUTDOWN	108
#define ETOOMANYREFS	109
#define EAGAIN	11
#define ETIMEDOUT	110
#define ECONNREFUSED	111
#define EHOSTDOWN	112
#define EHOSTUNREACH	113
#define EALREADY	114
#define EINPROGRESS	115
#define ESTALE	116
#define EUCLEAN	117
#define ENOTNAM	118
#define ENAVAIL	119
#define ENOMEM	12
#define EISNAM	120
#define EREMOTEIO	121
#define EDQUOT	122
#define ENOMEDIUM	123
#define EMEDIUMTYPE	124
#define ECANCELED	125
#define EACCES	13
#define EFAULT	14
#define ENOTBLK	15
#define EBUSY	16
#define EEXIST	17
#define EXDEV	18
#define ENODEV	19
#define ENOENT	2
#define ENOTDIR	20
#define EISDIR	21
#define EINVAL	22
#define ENFILE	23
#define EMFILE	24
#define ENOTTY	25
#define ETXTBSY	26
#define EFBIG	27
#define ENOSPC	28
#define ESPIPE	29
#define ESRCH	3
#define EROFS	30
#define EMLINK	31
#define EPIPE	32
#define EDOM	33
#define ERANGE	34
#define EDEADLK	35
#define ENAMETOOLONG	36
#define ENOLCK	37
#define ENOSYS	38
#define ENOTEMPTY	39
#define EINTR	4
#define ELOOP	40
#define ENOMSG	42
#define EIDRM	43
#define ECHRNG	44
#define EL2NSYNC	45
#define EL3HLT	46
#define EL3RST	47
#define ELNRNG	48
#define EUNATCH	49
#define EIO	5
#define ENOANO	55
#define EBADRQC	56
#define EBADSLT	57
#define EBFONT	59
#define ENXIO	6
#define ENOSTR	60
#define ENODATA	61
#define ETIME	62
#define ENOSR	63
#define ENONET	64
#define ENOPKG	65
#define EREMOTE	66
#define ENOLINK	67
#define EADV	68
#define ESRMNT	69
#define E2BIG	7
#define ECOMM	70
#define EPROTO	71
#define EMULTIHOP	72
#define EDOTDOT	73
#define EBADMSG	74
#define EOVERFLOW	75
#define ENOTUNIQ	76
#define EBADFD	77
#define EREMCHG	78
#define ELIBACC	79
#define ENOEXEC	8
#define ELIBBAD	80
#define ELIBSCN	81
#define ELIBMAX	82
#define ELIBEXEC	83
#define EILSEQ	84
#define ERESTART	85
#define ESTRPIPE	86
#define EUSERS	87
#define ENOTSOCK	88
#define EDESTADDRREQ	89
#define EBADF	9
#define EMSGSIZE	90
#define EPROTOTYPE	91
#define ENOPROTOOPT	92
#define EPROTONOSUPPORT	93
#define ESOCKTNOSUPPORT	94
#define EOPNOTSUPP	95
#define EPFNOSUPPORT	96
#define EAFNOSUPPORT	97
#define EADDRINUSE	98
#define EADDRNOTAVAIL	99
#define EWOULDBLOCK	EAGAIN
#define ENOTSUP	EOPNOTSUPP

1.4.4. fcntl.h


#define O_RDONLY	00
#define O_ACCMODE	0003
#define O_WRONLY	01
#define O_CREAT	0100
#define O_TRUNC	01000
#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

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 F_DUPFD	0
#define F_RDLCK	0
#define F_GETFD	1
#define F_WRLCK	1
#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

1.4.5. fmtmsg.h


#define MM_HARD	1
#define MM_NRECOV	128
#define MM_UTIL	16
#define MM_SOFT	2
#define MM_OPSYS	32
#define MM_FIRM	4
#define MM_RECOVER	64
#define MM_APPL	8

#define MM_NOSEV	0
#define MM_HALT	1
#define MM_ERROR	2

#define MM_NULLLBL	((char *) 0)

1.4.6. fnmatch.h


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

1.4.7. 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, FTW_MOUNT, FTW_CHDIR, FTW_DEPTH
}
 ;

struct FTW
{
  int base;
  int level;
}
 ;

typedef int (*__ftw_func_t) (char *__filename, struct stat * __status,
			     int __flag);
typedef int (*__ftw64_func_t) (char *__filename, struct stat64 * __status,
			       int __flag);
typedef int (*__nftw_func_t) (char *__filename, struct stat * __status,
			      int __flag, struct FTW * __info);
typedef int (*__nftw64_func_t) (char *__filename, struct stat64 * __status,
				int __flag, struct FTW * __info);

1.4.8. getopt.h


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

struct option
{
  char *name;
  int has_arg;
  int *flag;
  int val;
}
 ;

1.4.9. 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_readdir64) (void *);
  void *(*gl_opendir) (const char *);
  int (*gl_lstat) (const char *, struct stat *);
  int (*gl_stat) (const char *, struct stat *);
}
glob64_t;

1.4.10. grp.h


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

1.4.11. iconv.h


typedef void *iconv_t;

1.4.12. inttypes.h


typedef lldiv_t imaxdiv_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;

1.4.13. langinfo.h


#define ABDAY_1	0x20000
#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

1.4.14. limits.h


#define LLONG_MIN	(-LLONG_MAX-1LL)
#define ULLONG_MAX	18446744073709551615ULL
#define OPEN_MAX	256
#define PATH_MAX	4096
#define LLONG_MAX	9223372036854775807LL
#define SSIZE_MAX	LONG_MAX

#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 __INT_MAX__	2147483647
#define UINT_MAX	4294967295U

#define LONG_MIN	(-LONG_MAX-1L)

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

1.4.15. 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

typedef 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];
}
 *__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)

1.4.16. net/if.h


#define IF_NAMESIZE	16

#define IFF_UP	0x01
#define IFF_BROADCAST	0x02
#define IFF_DEBUG	0x04
#define IFF_LOOPBACK	0x08
#define IFF_POINTOPOINT	0x10
#define IFF_PROMISC	0x100
#define IFF_MULTICAST	0x1000
#define IFF_NOTRAILERS	0x20
#define IFF_RUNNING	0x40
#define IFF_NOARP	0x80

struct if_nameindex
{
  unsigned int if_index;
  char *if_name;
}
 ;

struct ifaddr
{
  struct sockaddr ifa_addr;
  union
  {
    struct sockaddr ifu_broadaddr;
    struct sockaddr ifu_dstaddr;
  }
  ifa_ifu;
  void *ifa_ifp;
  void *ifa_next;
}
 ;
#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;
}
 ;

struct ifconf
{
  int ifc_len;
  union
  {
    caddr_t ifcu_buf;
    struct ifreq *ifcu_req;
  }
  ifc_ifcu;
}
 ;

1.4.17. netdb.h


#define NETDB_INTERNAL	-1
#define NETDB_SUCCESS	0
#define HOST_NOT_FOUND	1
#define IPPORT_RESERVED	1024
#define NI_MAXHOST	1025
#define TRY_AGAIN	2
#define NO_RECOVERY	3
#define NI_MAXSERV	32
#define NO_DATA	4
#define h_addr	h_addr_list[0]
#define NO_ADDRESS	NO_DATA

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
#define AI_CANONNAME	0x0002
#define AI_NUMERICHOST	0x0004

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
#define EAI_MEMORY	-10
#define EAI_SYSTEM	-11
#define EAI_NONAME	-2
#define EAI_AGAIN	-3
#define EAI_FAIL	-4
#define EAI_NODATA	-5
#define EAI_FAMILY	-6
#define EAI_SOCKTYPE	-7
#define EAI_SERVICE	-8
#define EAI_ADDRFAMILY	-9

1.4.18. 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

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 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 INET6_ADDRSTRLEN	46

struct sockaddr_in6
{
  unsigned short sin6_family;
  uint16_t sin6_port;
  uint32_t sin6_flowinfo;
  struct in6_addr sin6_addr;
  uint32_t sin6_scope_id;
}
 ;
#define SOL_IP	0
#define IP_TOS	1
#define IPV6_UNICAST_HOPS	16
#define IPV6_MULTICAST_IF	17
#define IPV6_MULTICAST_HOPS	18
#define IPV6_MULTICAST_LOOP	19
#define IP_TTL	2
#define IPV6_JOIN_GROUP	20
#define IPV6_LEAVE_GROUP	21
#define IPV6_V6ONLY	26
#define IP_MULTICAST_IF	32
#define IP_MULTICAST_TTL	33
#define IP_MULTICAST_LOOP	34
#define IP_ADD_MEMBERSHIP	35
#define IP_DROP_MEMBERSHIP	36
#define IP_OPTIONS	4

struct ipv6_mreq
{
  struct in6_addr ipv6mr_multiaddr;
  int ipv6mr_interface;
}
 ;
struct ip_mreq
{
  struct in_addr imr_multiaddr;
  struct in_addr imr_interface;
}
 ;

1.4.19. netinet/ip.h


#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_MASK	0xe0

1.4.20. netinet/tcp.h


#define TCP_NODELAY	1
#define SOL_TCP	6

1.4.21. netinet/udp.h


#define SOL_UDP	17

1.4.22. nl_types.h


#define NL_CAT_LOCALE	1
#define NL_SETD	1

typedef void *nl_catd;

typedef int nl_item;

1.4.23. pty.h


struct winsize
{
  unsigned short ws_row;
  unsigned short ws_col;
  unsigned short ws_xpixel;
  unsigned short ws_ypixel;
}
 ;

1.4.24. 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;
}
 ;

1.4.25. regex.h


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, REG_NOERROR, REG_NOMATCH, REG_BADPAT, REG_ECOLLATE, REG_ECTYPE,
    REG_EESCAPE, REG_ESUBREG, REG_EBRACK, REG_EPAREN, REG_EBRACE, REG_BADBR,
    REG_ERANGE, REG_ESPACE, REG_BADRPT, REG_EEND, REG_ESIZE, REG_ERPAREN
}
reg_errcode_t;

1.4.26. rpc/auth.h


enum auth_stat
{
  AUTH_OK, AUTH_BADCRED = 1, AUTH_REJECTEDCRED = 2, AUTH_BADVERF =
    3, AUTH_REJECTEDVERF = 4, AUTH_TOOWEAK = 5, AUTH_INVALIDRESP =
    6, AUTH_FAILED = 7
}
 ;

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

struct opaque_auth
{
  enum_t oa_flavor;
  caddr_t oa_base;
  u_int oa_length;
}
 ;

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 *);
  int (*ah_validate) (struct AUTH *, struct opaque_auth *);
  int (*ah_refresh) (struct AUTH *);
  void (*ah_destroy) (struct AUTH *);
}
 ;

1.4.27. 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_call(rh, proc, xargs, argsp, xres, resp, secs)	((*(rh)->cl_ops->cl_call)(rh, proc, xargs, argsp, xres, resp, secs))
#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)
#define CLSET_TIMEOUT	1
#define CLGET_XID	10
#define CLSET_XID	11
#define CLGET_VERS	12
#define CLSET_VERS	13
#define CLGET_PROG	14
#define CLSET_PROG	15
#define CLGET_TIMEOUT	2
#define CLGET_SERVER_ADDR	3
#define CLSET_RETRY_TIMEOUT	4
#define CLGET_RETRY_TIMEOUT	5
#define CLGET_FD	6
#define CLGET_SVC_ADDR	7
#define CLSET_FD_CLOSE	8
#define CLSET_FD_NCLOSE	9

enum clnt_stat
{
  RPC_SUCCESS, RPC_CANTENCODEARGS = 1, RPC_CANTDECODERES = 2, RPC_CANTSEND =
    3, RPC_CANTRECV = 4, RPC_TIMEDOUT = 5, RPC_VERSMISMATCH =
    6, RPC_AUTHERROR = 7, RPC_PROGUNAVAIL = 8, RPC_PROGVERSMISMATCH =
    9, RPC_PROCUNAVAIL = 10, RPC_CANTDECODEARGS = 11, RPC_SYSTEMERROR =
    12, RPC_NOBROADCAST = 21, RPC_UNKNOWNHOST = 13, RPC_UNKNOWNPROTO =
    17, RPC_UNKNOWNADDR = 19, RPC_RPCBFAILURE = 14, RPC_PROGNOTREGISTERED =
    15, RPC_N2AXLATEFAILURE = 22, 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 *);
}
 ;

1.4.28. rpc/rpc_msg.h


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

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;
}
 ;

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;
  }
  ru;
}
 ;

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;
  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;
}
 ;

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;
}
 ;

1.4.29. rpc/svc.h


#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))
#define RPC_ANYSOCK	-1

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);
}
 ;

1.4.30. 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;

1.4.31. rpc/xdr.h


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;
}
 ;

1.4.32. sched.h


#define SCHED_OTHER	0
#define SCHED_FIFO	1
#define SCHED_RR	2

struct sched_param
{
  int sched_priority;
}
 ;

1.4.33. search.h


typedef struct entry
{
  char *key;
  void *data;
}
ENTRY;
typedef enum
{
  FIND, ENTER
}
ACTION;
typedef enum
{
  preorder, postorder, endorder, leaf
}
VISIT;

typedef void (*__action_fn_t) (void *__nodep, VISIT __value, int __level);

1.4.34. 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;

1.4.35. signal.h


#define _SIGSET_NWORDS	(1024/(8*sizeof(unsigned long)))
#define SIGRTMAX	(__libc_current_sigrtmax ())
#define SIGRTMIN	(__libc_current_sigrtmin ())
#define SIG_BLOCK	0
#define SIG_UNBLOCK	1
#define SIG_SETMASK	2
#define NSIG	65

typedef int sig_atomic_t;

typedef void (*sighandler_t) (int);
#define SIG_HOLD	((sighandler_t) 2)
#define SIG_ERR	((sighandler_t)-1)
#define SIG_DFL	((sighandler_t)0)
#define SIG_IGN	((sighandler_t)1)

#define SIGHUP	1
#define SIGUSR1	10
#define SIGSEGV	11
#define SIGUSR2	12
#define SIGPIPE	13
#define SIGALRM	14
#define SIGTERM	15
#define SIGSTKFLT	16
#define SIGCHLD	17
#define SIGCONT	18
#define SIGSTOP	19
#define SIGINT	2
#define SIGTSTP	20
#define SIGTTIN	21
#define SIGTTOU	22
#define SIGURG	23
#define SIGXCPU	24
#define SIGXFSZ	25
#define SIGVTALRM	26
#define SIGPROF	27
#define SIGWINCH	28
#define SIGIO	29
#define SIGQUIT	3
#define SIGPWR	30
#define SIGSYS	31
#define SIGUNUSED	31
#define SIGILL	4
#define SIGTRAP	5
#define SIGABRT	6
#define SIGIOT	6
#define SIGBUS	7
#define SIGFPE	8
#define SIGKILL	9
#define SIGCLD	SIGCHLD
#define SIGPOLL	SIGIO

#define SV_ONSTACK	(1<<0)
#define SV_INTERRUPT	(1<<1)
#define SV_RESETHAND	(1<<2)

typedef union sigval
{
  int sival_int;
  void *sival_ptr;
}
sigval_t;
#define SIGEV_SIGNAL	0
#define SIGEV_NONE	1
#define SIGEV_THREAD	2
#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 (*sigev_thread_func) (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;
  int si_errno;
  int si_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
#define SI_TIMER	-2
#define SI_MESGQ	-3
#define SI_ASYNCIO	-4
#define SI_SIGIO	-5
#define SI_TKILL	-6
#define SI_ASYNCNL	-60
#define SI_USER	0
#define SI_KERNEL	0x80

#define ILL_ILLOPC	1
#define ILL_ILLOPN	2
#define ILL_ILLADR	3
#define ILL_ILLTRP	4
#define ILL_PRVOPC	5
#define ILL_PRVREG	6
#define ILL_COPROC	7
#define ILL_BADSTK	8

#define FPE_INTDIV	1
#define FPE_INTOVF	2
#define FPE_FLTDIV	3
#define FPE_FLTOVF	4
#define FPE_FLTUND	5
#define FPE_FLTRES	6
#define FPE_FLTINV	7
#define FPE_FLTSUB	8

#define SEGV_MAPERR	1
#define SEGV_ACCERR	2

#define BUS_ADRALN	1
#define BUS_ADRERR	2
#define BUS_OBJERR	3

#define TRAP_BRKPT	1
#define TRAP_TRACE	2

#define CLD_EXITED	1
#define CLD_KILLED	2
#define CLD_DUMPED	3
#define CLD_TRAPPED	4
#define CLD_STOPPED	5
#define CLD_CONTINUED	6

#define POLL_IN	1
#define POLL_OUT	2
#define POLL_MSG	3
#define POLL_ERR	4
#define POLL_PRI	5
#define POLL_HUP	6

typedef struct
{
  unsigned long int sig[_SIGSET_NWORDS];
}
sigset_t;
#define SA_NOCLDSTOP	0x00000001
#define SA_NOCLDWAIT	0x00000002
#define SA_SIGINFO	0x00000004
#define SA_ONSTACK	0x08000000
#define SA_RESTART	0x10000000
#define SA_INTERRUPT	0x20000000
#define SA_NODEFER	0x40000000
#define SA_RESETHAND	0x80000000
#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

1.4.36. stddef.h


#define offsetof(TYPE,MEMBER)	((size_t)& ((TYPE*)0)->MEMBER)
#define NULL	(0L)

typedef int wchar_t;

1.4.37. stdio.h


#define EOF	(-1)
#define P_tmpdir	"/tmp"
#define FOPEN_MAX	16
#define L_tmpnam	20
#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

1.4.38. stdlib.h


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

typedef int (*__compar_fn_t) (const void *, const void *);
struct random_data
{
  int32_t *fptr;
  int32_t *rptr;
  int32_t *state;
  int rand_type;
  int rand_deg;
  int rand_sep;
  int32_t *end_ptr;
}
 ;

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;

1.4.39. sys/file.h


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

1.4.40. 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

1.4.41. sys/mman.h


#define MAP_FAILED	((void*)-1)
#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 MS_ASYNC	1
#define MS_INVALIDATE	2
#define MS_SYNC	4
#define MAP_ANON	MAP_ANONYMOUS

1.4.42. sys/msg.h


#define MSG_NOERROR	010000

1.4.43. sys/param.h


#define NOFILE	256
#define MAXPATHLEN	4096

1.4.44. sys/poll.h


#define POLLIN	0x0001
#define POLLPRI	0x0002
#define POLLOUT	0x0004
#define POLLERR	0x0008
#define POLLHUP	0x0010
#define POLLNVAL	0x0020

struct pollfd
{
  int fd;
  short events;
  short revents;
}
 ;
typedef unsigned long int nfds_t;

1.4.45. sys/resource.h


#define RUSAGE_CHILDREN	(-1)
#define RUSAGE_BOTH	(-2)
#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_DATA	2
#define RLIMIT_STACK	3
#define RLIMIT_CORE	4
#define RLIMIT_NOFILE	7
#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;
  rlim_t rlim_max;
}
 ;
struct rlimit64
{
  rlim64_t rlim_cur;
  rlim64_t rlim_max;
}
 ;

struct rusage
{
  struct timeval ru_utime;
  struct timeval ru_stime;
  long int ru_maxrss;
  long int ru_ixrss;
  long int ru_idrss;
  long int ru_isrss;
  long int ru_minflt;
  long int ru_majflt;
  long int ru_nswap;
  long int ru_inblock;
  long int ru_oublock;
  long int ru_msgsnd;
  long int ru_msgrcv;
  long int ru_nsignals;
  long int ru_nvcsw;
  long int ru_nivcsw;
}
 ;

enum __priority_which
{
  PRIO_PROCESS, PRIO_PGRP = 1, PRIO_USER = 2
}
 ;
#define PRIO_PGRP	PRIO_PGRP
#define PRIO_PROCESS	PRIO_PROCESS
#define PRIO_USER	PRIO_USER

typedef enum __priority_which __priority_which_t;

1.4.46. 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;
}
 ;

1.4.47. 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

1.4.48. sys/socket.h


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

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_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 SIOCGIFFLAGS	0x8913
#define SIOCGIFADDR	0x8915
#define SIOCGIFNETMASK	0x891b

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

#define MSG_WAITALL	0x100
#define MSG_TRUNC	0x20
#define MSG_EOR	0x80
#define MSG_OOB	1
#define MSG_PEEK	2
#define MSG_CTRUNC	8

1.4.49. 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

1.4.50. 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;
}
 ;

1.4.51. sys/timeb.h


struct timeb
{
  time_t time;
  unsigned short millitm;
  short timezone;
  short dstflag;
}
 ;

1.4.52. sys/times.h


struct tms
{
  clock_t tms_utime;
  clock_t tms_stime;
  clock_t tms_cutime;
  clock_t tms_cstime;
}
 ;

1.4.53. sys/types.h


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

typedef signed char int8_t;
typedef short int16_t;
typedef int int32_t;
typedef unsigned char u_int8_t;
typedef unsigned short u_int16_t;
typedef unsigned int u_int32_t;
typedef unsigned int uid_t;
typedef int pid_t;
typedef unsigned 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 unsigned long int blksize_t;
typedef long int fd_mask;
typedef int 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 unsigned long int blkcnt_t;
typedef unsigned long int fsblkcnt_t;
typedef unsigned long int fsfilcnt_t;
typedef unsigned 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;

1.4.54. sys/un.h


#define UNIX_PATH_MAX	108

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

1.4.55. 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];
}
 ;

1.4.56. 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;

1.4.57. syslog.h


#define LOG_EMERG	0
#define LOG_PRIMASK	0x07
#define LOG_ALERT	1
#define LOG_CRIT	2
#define LOG_ERR	3
#define LOG_WARNING	4
#define LOG_NOTICE	5
#define LOG_INFO	6
#define LOG_DEBUG	7

#define LOG_KERN	(0<<3)
#define LOG_AUTHPRIV	(10<<3)
#define LOG_FTP	(11<<3)
#define LOG_USER	(1<<3)
#define LOG_MAIL	(2<<3)
#define LOG_DAEMON	(3<<3)
#define LOG_AUTH	(4<<3)
#define LOG_SYSLOG	(5<<3)
#define LOG_LPR	(6<<3)
#define LOG_NEWS	(7<<3)
#define LOG_UUCP	(8<<3)
#define LOG_CRON	(9<<3)
#define LOG_FACMASK	0x03f8

#define LOG_LOCAL0	(16<<3)
#define LOG_LOCAL1	(17<<3)
#define LOG_LOCAL2	(18<<3)
#define LOG_LOCAL3	(19<<3)
#define LOG_LOCAL4	(20<<3)
#define LOG_LOCAL5	(21<<3)
#define LOG_LOCAL6	(22<<3)
#define LOG_LOCAL7	(23<<3)

#define LOG_UPTO(pri)	((1 << ((pri)+1)) - 1)
#define LOG_MASK(pri)	(1 << (pri))

#define LOG_PID	0x01
#define LOG_CONS	0x02
#define LOG_ODELAY	0x04
#define LOG_NDELAY	0x08
#define LOG_NOWAIT	0x10
#define LOG_PERROR	0x20

1.4.58. 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;
  tcflag_t c_oflag;
  tcflag_t c_cflag;
  tcflag_t c_lflag;
  cc_t c_line;
  cc_t c_cc[NCCS];
  speed_t c_ispeed;
  speed_t c_ospeed;
}
 ;
#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

1.4.59. time.h


#define CLK_TCK	((clock_t)__sysconf(2))
#define CLOCK_REALTIME	0
#define TIMER_ABSTIME	1
#define CLOCKS_PER_SEC	1000000l

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;
}
 ;

1.4.60. ulimit.h


#define UL_GETFSIZE	1
#define UL_SETFSIZE	2

1.4.61. unistd.h

The LSB requires _XOPEN_REALTIME to be defined to 1, but does not require all the set of functions required by the ISO POSIX (2003) XSI Option Group _XOPEN_REALTIME. For example, the asynchronous input/output functions are optional for LSB conforming systems.


#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 _POSIX_FSYNC	200112
#define _POSIX_MAPPED_FILES	200112
#define _POSIX_MEMLOCK	200112
#define _POSIX_MEMLOCK_RANGE	200112
#define _POSIX_MEMORY_PROTECTION	200112
#define _POSIX_SEMAPHORES	200112
#define _POSIX_SHARED_MEMORY_OBJECTS	200112
#define _POSIX_TIMERS	200112
#define _POSIX2_C_BIND	200112L
#define _POSIX_THREADS	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_TIMERS	11
#define _SC_ASYNCHRONOUS_IO	12
#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_CLOCK_SELECTION	137
#define _SC_CPUTIME	138
#define _SC_THREAD_CPUTIME	139
#define _SC_SYNCHRONIZED_IO	14
#define _SC_MONOTONIC_CLOCK	149
#define _SC_FSYNC	15
#define _SC_READER_WRITER_LOCKS	153
#define _SC_SPIN_LOCKS	154
#define _SC_REGEXP	155
#define _SC_SHELL	157
#define _SC_SPAWN	159
#define _SC_MAPPED_FILES	16
#define _SC_SPORADIC_SERVER	160
#define _SC_THREAD_SPORADIC_SERVER	161
#define _SC_TIMEOUTS	164
#define _SC_TYPED_MEMORY_OBJECTS	165
#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_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_MEMORY_PROTECTION	19
#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_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_EXPR_NEST_MAX	42
#define _SC_LINE_MAX	43
#define _SC_RE_DUP_MAX	44
#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_TZNAME_MAX	6
#define _SC_IOV_MAX	60
#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_ATEXIT_MAX	87
#define _SC_PASS_MAX	88
#define _SC_XOPEN_VERSION	89
#define _SC_REALTIME_SIGNALS	9
#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 _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 F_ULOCK	0
#define F_LOCK	1
#define F_TLOCK	2
#define F_TEST	3

1.4.62. utime.h


struct utimbuf
{
  time_t actime;
  time_t modtime;
}
 ;

1.4.63. utmp.h


#define UT_HOSTSIZE	256
#define UT_LINESIZE	32
#define UT_NAMESIZE	32

struct exit_status
{
  short e_termination;
  short e_exit;
}
 ;

#define EMPTY	0
#define RUN_LVL	1
#define BOOT_TIME	2
#define NEW_TIME	3
#define OLD_TIME	4
#define INIT_PROCESS	5
#define LOGIN_PROCESS	6
#define USER_PROCESS	7
#define DEAD_PROCESS	8
#define ACCOUNTING	9

1.4.64. wchar.h


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

1.4.65. 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;

1.4.66. wordexp.h


enum
{
  WRDE_DOOFFS, WRDE_APPEND, WRDE_NOCMD, WRDE_REUSE, WRDE_SHOWERR, WRDE_UNDEF,
    __WRDE_FLAGS
}
 ;

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

enum
{
  WRDE_NOSYS, WRDE_NOSPACE, WRDE_BADCHAR, WRDE_BADVAL, WRDE_CMDSUB,
    WRDE_SYNTAX
}
 ;

1.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
__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
__daylight -- Daylight savings time flag
__environ -- alias for environ - user environment
__errno_location -- address of errno variable
__fpending -- returns in bytes the amount of output pending on a stream
__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
__lxstat -- inline wrapper around call to lxstat
__mempcpy -- copy given number of bytes of source to destination
__rawmemchr -- scan memory
__register_atfork -- alias for register_atfork
__sigsetjmp -- save stack context for non-local goto
__stpcpy -- copy a string returning a pointer to its end
__strdup -- alias for strdup
__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
__sysconf -- get configuration information at runtime
__sysv_signal -- signal handling
__timezone -- global variable containing timezone
__tzname -- global variable containing the timezone
__wcstod_internal -- underlying function for wcstod
__wcstof_internal -- underlying function for wcstof
__wcstol_internal -- underlying function for wcstol
__wcstold_internal -- underlying function for wcstold
__wcstoul_internal -- underlying function for wcstoul
__xmknod -- make block or character special file
__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
asprintf -- write formatted output to a dynamically allocated string
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
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
dngettext -- perform lookup in message catalog for the current locale
duplocale -- provide new handle for selection of locale
err -- display formatted error messages
error -- print error message
errx -- display formatted error message and exit
fcntl -- file control
fflush_unlocked -- non thread safe fflush
fgetwc_unlocked -- non thread safe fgetwc
flock -- apply or remove an advisory lock on an open file
freelocale -- free a locale object
fscanf -- convert formatted input
fwscanf -- convert formatted input
getgrouplist -- get network group entry
getloadavg -- get system load averages
getopt -- parse command line options
getopt_long -- parse command line options
getopt_long_only -- parse command line options
getsockopt -- get socket options
gettext -- Search message catalogs for a string
getutent -- access user accounting database entries
getutent_r -- access user accounting database entries
glob64 -- find pathnames matching a pattern (Large File Support)
globfree64 -- free memory from glob64() (Large File Support)
initgroups -- initialize the supplementary group access list
ioctl -- control device
sockio -- socket ioctl commands
ttyio -- tty ioctl commands
kill -- send a signal
link -- create a link to a file
mbsnrtowcs -- convert a multibyte string to a wide character string
memmem -- locate bytes
memrchr -- scan memory for a character
newlocale -- allocate a locale object
ngettext -- Search message catalogs for plural string
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
psignal -- print signal message
regexec -- regular expression matching
scanf -- convert formatted input
setbuffer -- stream buffering operation
setgroups -- set list of supplementary group IDs
sethostname -- set host name
setsockopt -- set socket options
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
sigreturn -- return from signal handler and cleanup stack frame
sscanf -- convert formatted input
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 -- reentrant version of strerror
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 -- Creates a TCP/IP-based RPC service transport.
svcudp_create --  Creates a UDP-based RPC service transport.
swscanf -- convert formatted input
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
waitpid -- wait for child process
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

The following interfaces 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 above for libc 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 ISO POSIX (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.

__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

__cxa_atexit() registers a function to be called by exit or when a shared library is unloaded.

The __cxa_atexit() function is used to implement atexit(), as described in ISO POSIX (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. atexit() is not in the binary standard; it is only in the source standard.

__daylight

Name

__daylight -- Daylight savings time flag

Synopsis

int __daylight;

Description

The integer variable __daylight shall implement the daylight savings time flag daylight as specified in the ISO POSIX (2003) header file <time.h>.

__daylight is not in the source standard; it is only in the binary standard. daylight is not in the binary standard; it is 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.

__environ has the same specification as environ.

__environ is not in the source standard; it is only in the binary standard.

__errno_location

Name

__errno_location -- address of errno variable

Synopsis

int * __errno_location(void);

Description

__errno_location() 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

#include <stdio_ext.h>

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.

__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 ISO POSIX (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 ISO POSIX (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 ISO POSIX (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 ISO POSIX (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 ISO POSIX (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 ISO POSIX (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 ISO POSIX (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 initialize the process, call the main function with appropriate arguments, and handle the return from main().

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

__lxstat

Name

__lxstat -- inline wrapper around call to lxstat

Synopsis

#include <ctype.h>

int __lxstat(int version, char * __path, struct stat __statbuf);

Description

__lxstat() is an inline wrapper around call to lxstat().

__lxstat() 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>

ptr_t __mempcpy(ptr_t restrict dest, const ptr_t restrict src, size_t n);

Description

__mempcpy() copies n bytes of source to destination, returning pointer to bytes after the last written byte.

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

__rawmemchr

Name

__rawmemchr -- scan memory

Synopsis

#include <string.h>

ptr_t __rawmemchr(const ptr_t s, int c);

Description

__rawmemchr() searches in s for c.

__rawmemchr() is a weak alias to 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.

__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 ISO POSIX (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 ISO POSIX (2003).

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

__stpcpy

Name

__stpcpy -- copy a string returning a pointer to its end

Synopsis

#include <string.h>

char * __stpcpy(char * dest, const char * src);

Description

__stpcpy() copies the string src (including the terminating /0 character) to the array dest. The strings may not overlap, and dest must be large enough to receive the copy.

Return Value

__stpcpy() returns a pointer to the end of the string dest (that is, the address of the terminating NULL character) rather than the beginning.

__stpcpy() has the same specification as stpcpy().

__stpcpy() 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.

__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.

__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.

__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 ISO POSIX (2003).

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

__timezone

Name

 -- global variable containing timezone

Synopsis

long int __timezone;

Description

__timezone() has the same specification as timezone() in the ISO POSIX (2003)

__tzname

Name

 -- global variable containing the timezone

Synopsis

char * __tzname[2];

Description

__tzname has the same specification as tzname in the ISO POSIX (2003).

Note that the array size of 2 is explicit in the ISO POSIX (2003), but not in the SUSv2.

__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) has the same specification as wcstod(nptr, endptr).

__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) has the same specification as wcstof(nptr, endptr).

__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) has the same specification as wcstol(nptr, endptr, base).

__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) has the same specification as wcstold(nptr, endptr).

__wcstold_internal() 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)() has the same specification as wcstoul(nptr, endptr, base)().

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

__xmknod

Name

__xmknod -- make block or character special file

Synopsis

int __xmknod(int ver, const char * path, mode_t mode, dev_t * dev);

Description

The __xmknod() shall implement the mknod() interface from ISO POSIX (2003).

__xmknod(1, path, mode, dev) has the same specification as mknod(path, mode, dev).

ver shall be 1 or the behavior of __xmknod() is undefined.

The __xmknod() function is not in the source standard; it is only in the binary standard. The mknod() function is not in the binary standard; it is only in the source 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 ISO POSIX (2003) functions stat(), lstat(), and fstat() respectively.

ver shall be 3 or the behavior of these functions is undefined.

__xstat(3, path, stat_buf) shall behave as stat(path, stat_buf) as specified by ISO POSIX (2003).

__lxstat(3, path, stat_buf) shall behave as lstat(path, stat_buf) as specified by ISO POSIX (2003).

__fxstat(3, fildes, stat_buf) shall behave as fstat(fildes, stat_buf) as specified by ISO POSIX (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 Large File Support functions stat64(), lstat64(), and fstat64() respectively.

ver shall be 3 or the behavior of these functions is undefined.

__xstat64(3, path, stat_buf) shall behave as stat(path, stat_buf) as specified by Large File Support.

__lxstat64(3, path, stat_buf) shall behave as lstat(path, stat_buf) as specified by Large File Support.

__fxstat64(3, fildes, stat_buf) shall behave as fstat(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

_nl_msg_cat_cntr is incremented each time a new catalong is loaded. It is a variable defined in loadmsgcat.c and is used by Message catalogs for internationalization.

_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 the names of the signal names.

The _sys_siglist array is only in the binary standard; it is not in the source standard. Applications wishing to access the names of signals 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.

The adjtime() is restricted to the super-user.

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's effective user ID is not that of the super-user.

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().

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.

The bind_textdomain_codeset() function returns a pointer to a string containing the name of the selected codeset. The string is allocated internally in the function and shall not be changed 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 a privileged IP port.

Return Value

On success, 0 is returned. On error, -1 is returned and the global variable errno is set appropriately.

Errors

EPERM

The process did not have appropriate privilege.

EPFNOSUPPORT

Address of sin did not match address family of sd.

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

cfsetspeed() sets the baud rate values in the termios structure. 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.

Getting and Setting the Baud Rate

Input and output baud rates are found in the termios structure. The unsigned integer speed_t is typdef'd in the include file termios.h. The value of the integer corresponds directly to the baud rate being represented; however, the following symbolic values are defined.

  #define B0      0
  #define B50     50
  #define B75     75
  #define B110    110
  #define B134    134
  #define B150    150
  #define B200    200
  #define B300    300
  #define B600    600
  #define B1200   1200
  #define B1800   1800
  #define B2400   2400
  #define B4800   4800
  #define B9600   9600
  #define B19200  19200
  #define B38400  38400
  #ifndef _POSIX_SOURCE
  #define EXTA    19200
  #define EXTB    38400
  #endif  /*_POSIX_SOURCE */

cfsetspeed() sets both the input and output baud rates in the termios structure referenced by t to speed.

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

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 dcgettext(). 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().

Parameters

domainname

dgettext() applies domainname to the currently active LC_MESSAGE locale. This usage 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.

msgid

a NULL-terminated string to be matched in the catalogue with respect to a specific domain and the current locale.

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() will not modify the errno global variable.

See Also

gettext, dgettext, ngettext, dngettext, dcgettext, dcngettext, textdomain, bindtextdomain, bind_textdomain_codeset

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 dgettext() for more information.

See Also

gettext, dgettext, ngettext, dcgettext, dcngettext, textdomain, bindtextdomain, bind_textdomain_codeset

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()

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

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 ISO POSIX (2003), but with differences as listed below.

Implementation may set O_LARGEFILE

According to ISO POSIX (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 ISO POSIX (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.

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().

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().

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.

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 ISO POSIX (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.

fwscanf

Name

fwscanf -- convert formatted input

Description

The scanf() family of functions shall behave as described in ISO POSIX (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.

getgrouplist

Name

getgrouplist -- get network group entry

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 gid_t members in the groups array. The group group shall also be included. On success, the value referred to by ngroups shall be updated to contain the number of gid_t objects copied.

Return Value

On success, if there was sufficient room to copy all the supplementatry group identifiers to the array identified by groups, getgrouplist() shall return the number of gid_t objects copied, and the value referenced by ngroups shall be updated. If there was not sufficient room to copy all the supplementary group identifiers, grouplist() shall return -1, and update the value referenced by ngroups to the number actually copied.

If user does not refer to a valid user on the system, getgrouplist() shall return 0, and set the value referenced by ngroups to 0.

Errors

None defined.

See Also

getgroups()

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.

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 ISO POSIX (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 ISO POSIX (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.

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 ISO POSIX (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 ISO POSIX (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.

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 ISO POSIX (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.

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

The glob64() function is a large-file version of the glob() defined in ISO POSIX (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 ISO POSIX (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 64-bit version of globfree().

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()

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 ISO POSIX (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 ISO POSIX (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/socket.h>
#include <net/if.h>
#include <netinet/in.h>

int ioctl(int sockfd, int request, char * 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 ISO POSIX (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.

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.

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.

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 <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 tty. argp is a pointer to a winsize structure.

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.

kill

Name

kill -- send a signal

Synopsis

#include <signal.h>

int kill(pid_t pid, int sig);

Description

kill() is as specified in the ISO POSIX (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 ISO POSIX (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

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 ISO POSIX (2003), except with differences as listed below.

Need Not Follow Symlinks

ISO POSIX (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 ISO POSIX (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.

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 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

memmem() returns a pointer to the beginning of the byte array, or NULL if the byte array is not found.

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()

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.

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 (dependant 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

pmap_getport

Name

pmap_getport -- Find the port number assigned to a service registered with a portmapper.

Synopsis

#include <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 1 if it suceeds, 0 otherwise.

pmap_unset

Name

pmap_unset --  Destroys RPC Binding

Synopsis


#include <rpc/rpc.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 1 if it succeeds, zero otherwise.

psignal

Name

psignal -- print signal message

Synopsis

#include <signal.h>

void psignal(int sig, const char * s);

extern const char *const sys_siglist[]

Description

The psignal() function shall display a message on the stderr stream. If s is not the null pointer, and does not point to an empty string (e.g. "\0"), the message shall consist of the string s, a colon, a space, and a string describing the signal number sig; otherwise psignal() shall display only a message describing the signal number sig. If sig is invalid, the message displayed shall indicate an unknown signal.

The array sys_siglist holds the signal description strings indexed by signal number.

Return Value

psignal() returns no value.

regexec

Name

regexec -- regular expression matching

Description

The regexec() function shall behave as specified in ISO POSIX (2003), except with differences as listed below.

Differences

Certain aspects of regular expression matching are optional; see Internationalization and Regular Expressions.

scanf

Name

scanf -- convert formatted input

Description

The scanf() family of functions shall behave as described in ISO POSIX (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.

setbuffer

Name

setbuffer -- stream buffering operation

Synopsis

#include <stdio.h>

void setbuffer(FILE * stream, char * buf, size_t size);

Description

setbuffer() is an alias for the call to setvbuf(). It works the same, except that the size of the buffer in setbuffer() is up to the caller, rather than being determined by the default BUFSIZ.

setgroups

Name

setgroups -- set list of supplementary group IDs

Synopsis

#include <grp.h>

int setgroups(size_t size, const gid_t * list);

Description

If the process has appropriate privilege, the setgroups() function shall set the supplementary group IDs for the current process. list shall reference an array of size group IDs. A process may have at most NGROUPS_MAX supplementary group IDs.

Return Value

On successful completion, 0 is returned. On error, -1 is returned and the errno is set to indicate the error.

Errors

EFAULT

list has an invalid address.

EPERM

The process does not have appropriate privileges.

EINVAL

size is greater than NGROUPS_MAX.

sethostname

Name

sethostname -- set host name

Synopsis

#include <unistd.h>
#include <sys/param.h.h>
#include <sys/utsname.h>

int sethostname(const char * name, size_t len);

Description

If the process has appropriate privileges, the sethostname() function shall change the host name for the current macine. The name shall point to a null-terminated string of at most len bytes that holds the new hostname.

If the symbol HOST_NAME_MAX is defined, or if sysconf(_SC_HOST_NAME_MAX)() returns a value greater than 0, this value shall represent the maximum length of the new hostname. Otherwise, if the symbol MAXHOSTLEN is defined, this value shall represent the maximum length for the new hostname. If none of these values are defined, the maximum length shall be the size of the nodename field of the utsname structure.

Return Value

On success, 0 is returned. On error, -1 is returned and the global variable errno is set appropriately.

Errors

EINVAL

len is negative or larger than the maximum allowed size.

EPERM

the process did not have appropriate privilege.

EFAULT

name is an invalid address.

Rationale

ISO POSIX (2003) guarantees that:

Maximum length of a host name (not including the terminating null) as returned from the gethostname() function shall be at least 255 bytes.

The glibc C library does not currently define HOST_NAME_MAX, and although it provides the name _SC_HOST_NAME_MAX a call to sysconf() returns -1 and does not alter errno in this case (indicating that there is no restriction on the hostname length). However, the glibc manual idicates that some implementations may have MAXHOSTNAMELEN as a means of detecting the maximum length, while the Linux kernel at release 2.4 and 2.6 stores this hostname in the utsname structure. While the glibc manual suggests simply shortening the name until sethostname() succeeds, the LSB requires that one of the first four mechanisms works. Future versions of glibc may provide a more reasonable result from sysconf(_SC_HOST_NAME_MAX).

setsockopt

Name

setsockopt -- set socket options

Synopsis

#include <sys/socket.h>
#include <netinet/ip.h>

int setsockopt(int socket, int level, int option_name, const void * option_value, socklen_t option_len);

Description

The setsockopt() function shall behave as specified in ISO POSIX (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

Set the Internet Protocol options sent with every packet from this socket. The option_value shall point to a memory buffer containing the options and option_len shall contain the size in bytes of that buffer. For IPv4, the maximum length of options is 40 bytes.

IP_TOS

Set the Type of Service flags to use when sending packets with this socket. The option_value shall point to a value containing the type of service value. The least significant two bits of the value shall contain the new Type of Service indicator. Use of other bits in the value is unspecified. The option_len parameter shall hold the size, in bytes, of the buffer referred to by option_value.

IP_TTL

Set the current unicast Internet Protocol Time To Live value used when sending packets with this socket. The option_value shall point to a value containing the time to live value, which shall be between 1 and 255. The option_len parameter shall hold the size, in bytes, of the buffer referred to by option_value.

setutent

Name

setutent -- access user accounting database entries

Synopsis

#include <utmp.h>

void setutent(void);

Description

The setutent() function shall reset the user accounting database such that the next call to getutent() shall be return the first record in the database. It is recommended to call it before any of the other functions that operate on the user accounting databases (e.g. getutent())

Return Value

None.

sigandset

Name

sigandset -- build a new signal set by combining the two input sets using logical AND

Synopsis

#include <signal.h>

int sigandset(sigset_t * set, const sigset_t * left, const sigset_t * right);

Description

The sigandset() shall combine the two signal sets referenced by left and right, using a logical AND operation, and shall place the result in the location referenced by set, The resulting signal set shall contain only signals that are in both the set referenced by left and the set referenced by right.

Return Value

On success, sigandset() shall return 0. Otherise, sigandset() shall return -1 and set errno to indicate the error.

Errors

EINVAL

One or more of set, left, or right was a null pointer.

See Also

sigorset()

sigisemptyset

Name

sigisemptyset -- check for empty signal set

Synopsis

#include <signal.h>

int sigisemptyset(const sigset_t * set);

Description

The sigisemptyset() function shall check for empty signal set referenced by set.

Return Value

The sigisemptyset() function shall return a positive non-zero value if the signal set referenced by set is empty, or zero if this set is empty. On error, sigisemptyset() shall return -1 and set errno to indicate the error.

Errors

EINVAL

set is a null pointer.

sigorset

Name

sigorset -- build a new signal set by combining the two input sets using logical OR

Synopsis

#include <signal.h>

int sigorset(sigset_t * set, const sigset_t * left, const sigset_t * right);

Description

The sigorset() shall combine the two signal sets referenced by left and right, using a logical OR operation, and shall place the result in the location referenced by set, The resulting signal set shall contain only signals that are in either the set referenced by left or the set referenced by right.

Return Value

On success, sigorset() shall return 0. Otherise, sigorset() shall return -1 and set errno to indicate the error.

Errors

EINVAL

One or more of set, left, or right was a null pointer.

See Also

sigorset()

sigreturn

Name

sigreturn -- return from signal handler and cleanup stack frame

Synopsis

int sigreturn(struct sigcontext * scp);

Description

The sigreturn() function is used by the system to cleanup after a signal handler has returned. This function is not in the source standard; it is only in the binary standard.

Return Value

sigreturn() never returns.

sscanf

Name

sscanf -- convert formatted input

Description

The scanf() family of functions shall behave as described in ISO POSIX (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.

stime

Name

stime -- set time

Synopsis

#define _SVID_SOURCE
#include <time.h>

int stime(const time_t * t);

Description

If the process has appropriate privilege, the stime() function shall set the system's idea of the time and date. Time, referenced by t, is measured in seconds from the epoch (defined in ISO POSIX (2003) as 00:00:00 UTC January 1, 1970).

Return Value

On success, stime() shall return 0. Otherwise, stime() shall return -1 and errno shall be set to indicate the error.

Errors

EPERM

The process does not have appropriate privilege.

EINVAL

t is a null pointer.

stpcpy

Name

stpcpy -- copy a string returning a pointer to its end

Synopsis

#include <string.h>

char * stpcpy(char * restrict dest, const char * restrict src);

Description

The stpcpy() function shall copy the string pointed to by src (including the terminating '\0' character) to the array pointed to by dest. The strings may not overlap, and the destination string dest shall be large enough to receive the copy.

Return Value

stpcpy() returns a pointer to the end of the string dest (that is, the address of the terminating '\0' character) rather than the beginning.

Example

This program uses stpcpy() to concatenate foo and bar to produce foobar, which it then prints.

  #include <string.h>

  int
  main (void)
  {
    char buffer[256];
    char *to = buffer;
    to = stpcpy (to, "foo");
    to = stpcpy (to, "bar");
    printf ("%s\n", buffer);
  }

stpncpy

Name

stpncpy -- copy a fixed-size string, returning a pointer to its end

Synopsis

#include <string.h>

char * stpncpy(char * restrict dest, const char * restrict src, size_t n);

Description

The stpncpy() function shall copy at most n characters from the string pointed to by src, including the terminating \0 character, to the array pointed to by dest. Exactly n characters are written at dest. If the length strlen()(src) is smaller than n, the remaining characters in dest are filled with \0 characters. If the length strlen()(src) is greater than or equal to n, dest will not be \0 terminated.

The strings may not overlap.

The programmer shall ensure that there is room for at least n characters at dest.

Return Value

The stpncpy() function shall return a pointer to the terminating NULL in dest, or, if dest is not NULL-terminated, dest + n.

strcasestr

Name

strcasestr -- locate a substring ignoring case

Synopsis

#include <string.h>

char * strcasestr(const char * s1, const char * s2);

Description

The strcasestr() shall behave as strstr(), except that it shall ignore the case of both strings. The strcasestr() function shall be locale aware; that is strcasestr() shall behave as if both strings had been converted to lower case in the current locale before the comparison is performed.

Return Value

Upon successful completion, strcasestr() shall return a pointer to the located string or a null pointer if the string is not found. If s2 points to a string with zero length, the function shall return s1.

strerror_r

Name

strerror_r -- reentrant version of strerror

Synopsis

#include <string.h>

char * strerror_r(int errnum, char * buf, size_t buflen);

Description

The strerror_r() shall behave as specified in ISO POSIX (2003), except as described below.

Returns String, not Error Value

The strerror_r() function shall return a pointer to the string corresponding to errno. The returned pointer may point within the buffer buf (at most buflen bytes).

Return Value

On success, strerror_r() shall return a pointer to the generated message string (determined by the setting of the LC_MESSAGES category in the current locale). Otherwise, strerror_r() shall return the string corresponding to "Unknown error".

strndup

Name

strndup -- return a malloc'd copy of at most the specified number of bytes of a string

Synopsis

#include <string.h>

char * strndup(const char * string, size_t n);

Description

The strndup() function shall return a malloc()'d copy of at most n bytes of string. The resultant string shall be terminated even if no NULL terminator appears before string+n.

Return Value

On success, strndup() shall return a pointer to a newly allocated block of memory containing a copy of at most n bytes of string. Otherwise, strndup() shall return NULL and set errno to indicate the error.

Errors

ENOMEM

Insufficient memory available.

strnlen

Name

strnlen -- determine the length of a fixed-size string

Synopsis

#include <string.h>

size_t strnlen(const char * s, size_t maxlen);

Description

strnlen() returns the number of characters in the string s, not including the terminating \0 character, but at most maxlen. In doing this, strnlen() looks only at the first maxlen characters at s and never beyond s + maxlen.

Return Value

strnlen() returns strlen(s), if that is less than maxlen, or maxlen if there is no \0 character among the first maxlen characters pointed to by s.

strptime

Name

strptime -- parse a time string

Description

The strptime() shall behave as specified in the ISO POSIX (2003) with differences as listed below.

Number of leading zeroes may be limited

The ISO POSIX (2003) specifies fields for which "leading zeros are permitted but not required"; however, applications shall not expect to be able to supply more leading zeroes for these fields than would be implied by the range of the field. Implementations may choose to either match an input with excess leading zeroes, or treat this as a non-matching input. For example, %j has a range of 001 to 366, so 0, 00, 000, 001, and 045 are acceptable inputs, but inputs such as 0000, 0366 and the like are not.

Rationale

glibc developers consider it appropriate behavior to forbid excess leading zeroes. When trying to parse a given input against several format strings, forbidding excess leading zeroes could be helpful. For example, if one matches 0011-12-26 against %m-%d-%Y and then against %Y-%m-%d, it seems useful for the first match to fail, as it would be perverse to parse that date as November 12, year 26. The second pattern parses it as December 26, year 11.

The ISO POSIX (2003) is not explicit that an unlimited number of leading zeroes are required, although it may imply this. The LSB explicitly allows implementations to have either behavior. Future versions of this standard may require implementations to forbid excess leading zeroes.

An Interpretation Request is currently pending against ISO POSIX (2003) for this matter.

strsep

Name

strsep -- extract token from string

Synopsis

#include <string.h>

char * strsep(char * * stringp, const char * delim);

Description

The strsep() function shall find the first token in the string referenced by the pointer stringp, using the characters in delim as delimiters.

If stringp is NULL, strsep() shall return NULL and do nothing else.

If stringp is non-NULL, strsep() shall find the first token in the string referenced by stringp, where tokens are delimited by characters in the string delim. This token shall be terminated with a \0 character by overwriting the delimiter, and stringp shall be updated to point past the token. In case no delimiter was found, the token is taken to be the entire string referenced by stringp, and the location referenced by stringp is made NULL.

Return Value

strsep() shall return a pointer to the beginning of the token.

Notes

The strsep() function was introduced as a replacement for strtok(), since the latter cannot handle empty fields. However, strtok() conforms to ISO C (1999) and to ISO POSIX (2003) and hence is more portable.

See Also

strtok(), strtok_r().

strsignal

Name

strsignal -- return string describing signal

Synopsis

#define _GNU_SOURCE
#include <string.h>

char * strsignal(int sig);

extern const char * const sys_siglist[];

Description

The strsignal() function shall return a pointer to a string describing the signal number sig. The string can only be used until the next call to strsignal().

The array sys_siglist holds the signal description strings indexed by signal number. This array should not be accessed directly by applications.

Return Value

If sig is a valid signal number, strsignal() shall return a pointer to the appropriate description string. Otherwise, strsignal() shall return either a pointer to the string "unknown signal", or a null pointer.

Although the function is not declared as returning a pointer to a constant character string, applications shall not modify the returned string.

strtoq

Name

strtoq -- convert string value to a long or quad_t integer

Synopsis

#include <sys/types.h>
#include <stdlib.h>
#include <limits.h>

long long strtoq(const char * nptr, char * * endptr, int base);

Description

strtoq() converts the string nptr to a quadt value. The conversion is done according to the given base, which shall be between 2 and 36 inclusive, or be the special value 0.

nptr may begin with an arbitrary amount of white space (as determined by isspace()(3)), followed by a single optional + or - sign character. If base is 0 or 16, the string may then include a 0x prefix, and the number will be read in base 16; otherwise, a 0 base is taken as 10 (decimal), unless the next character is 0, in which case it is taken as 8 (octal).

The remainder of the string is converted to a long value in the obvious manner, stopping at the first character which is not a valid digit in the given base. (In bases above 10, the letter A in either upper or lower case represents 10, B represents 11, and so forth, with Z representing 35.)

Return Value

strtoq() returns the result of the conversion, unless the value would underflow or overflow. If an underflow occurs, strtoq() returns QUAD_MIN. If an overflow occurs, strtoq() returns QUAD_MAX. In both cases, the global variable errno is set to ERANGE.

Errors

ERANGE

The given string was out of range; the value converted has been clamped.

strtouq

Name

strtouq -- convert a string to an unsigned long long

Synopsis

#include <sys/types.h>
#include <stdlib.h>
#include <limits.h>

unsigned long long strtouq(const char * nptr, char * * endptr, int base);

Description

strtouq() converts the string nptr to an unsigned long long value. The conversion is done according to the given base, which shall be between 2 and 36 inclusive, or be the special value 0.

nptr may begin with an arbitrary amount of white space (as determined by isspace()(3)), followed by a single optional + or - sign character. If base is 0 or 16, the string may then include a 0x prefix, and the number will be read in base 16; otherwise, a 0 base is taken as 10 (decimal), unless the next character is 0, in which case it is taken as 8 (octal).

The remainder of the string is converted to an unsigned long value in the obvious manner, stopping at the end of the string or at the first character that does not produce a valid digit in the given base. (In bases above 10, the letter A in either upper or lower case represents 10, B represents 11, and so forth, with Z representing 35.)

Return Value

On success, strtouq() returns either the result of the conversion or, if there was a leading minus sign, the negation of the result of the conversion, unless the original (non-negated) value would overflow. In the case of an overflow the function returns UQUAD_MAX and the global variable errno is set to ERANGE.

Errors

ERANGE

The given string was out of range; the value converted has been clamped.

svc_register

Name

svc_register -- Register Remote Procedure Call Interface

Synopsis

#include <rpc/rpc.h>

bool_t svc_register(SVCXPRT * xprt, rpcprog_t prognum, rpcvers_t versnum, __dispatch_fn_t dispatch, rpcprot_t protocol);

Description

The svc_register() function shall associate the program identified by prognum at version versnum with the service dispatch procedure, dispatch. If protocol is zero, the service is not registered with the portmap service. If protocol is non-zero, then a mapping of the triple [prognum, versnum, protocol] to xprt->xp_port is established with the local portmap service. The procedure dispatch has the following form:

int dispatch(struct svc_req * request, SVCXPRT * xprt);

Return Value

svc_register() returns 1 if it succeeds, and zero otherwise.

svc_run

Name

svc_run -- Waits for RPC requests to arrive and calls service procedure.

Synopsis

#include <rpc/svc.h>

void svc_run(void);

Description

The svc_run() function shall wait for RPC requests to arrive, read and unpack each request, and dispatch it to the appropriate registered handler. Under normal conditions, svc_run() shall not return; it shall only return if serious errors occur that prevent further processing.

svc_sendreply

Name

svc_sendreply -- called by RPC service's dispatch routine

Synopsis

bool_t svc_sendreply(SVCXPRT *xprt, xdrproc_t outproc, caddr_t out);