Information technology — Portable Operating System Interface (POSIX) — Part 2: System Interfaces

ISO/IEC 9945 (parts 1 to 4):2003 defines a standard operating system interface and environment, including a command interpreter (or "shell"), and common utility programs to support applications portability at the source code level. ISO/IEC 9945-1:2003 is a minor revision and, together with ISO/IEC 9945-2:2003, ISO/IEC 9945-3:2003 and ISO/IEC 9945-4:2003, cancels and replaces ISO/IEC 9945-1:2002, ISO/IEC 9945-2:2002, ISO/IEC 9945-3:2002 and ISO/IEC 9945-4:2002. ISO/IEC 9945 (parts 1 to 4):2003 is the single common revision to ISO/IEC 9945-1:1996 (IEEE Std 1003.1-1996), ISO/IEC 9945-2:1993 (IEEE Std 1003.2-1992), and the Base Specifications of The Open Group Single UNIX® Specification, Version 2. ISO/IEC 9945 (parts 1 to 4):2003 is intended to be used by both applications developers and system implementors and comprises four major components (each in an associated volume). General terms, concepts, and interfaces common to all volumes of ISO/IEC 9945 (parts 1 to 4):2003, including utility conventions and C-language header definitions, are included in the Base Definitions volume (ISO/IEC 9945-1:2003). Definitions for system service functions and subroutines, language-specific system services for the C programming language, function issues, including portability, error handling, and error recovery, are included in the System Interfaces volume (ISO/IEC 9945-2:2003). Definitions for a standard source code-level interface to command interpretation services (a "shell") and common utility programs for application programs are included in the Shell and Utilities volume (ISO/IEC 9945-3:2003). Extended rationale that did not fit well into the rest of the document structure, containing historical information concerning the contents of ISO/IEC 9945 (parts 1 to 4):2003 and why features were included or discarded by the standard developers, is included in the Rationale (Informative) volume (ISO/IEC 9945-4:2003). The following areas are outside the scope of ISO/IEC 9945 (parts 1 to 4):2003: Graphics interfaces Database management system interfaces Record I/O considerations Object or binary code portability System configuration and resource availability ISO/IEC 9945 (parts 1 to 4):2003 describes the external characteristics and facilities that are of importance to applications developers, rather than the internal construction techniques employed to achieve these capabilities. Special emphasis is placed on those functions and facilities that are needed in a wide variety of commercial applications.

Technologies de l'information — Interface pour la portabilité des systèmes (POSIX) — Partie 2: Interfaces systèmes

General Information

Status
Withdrawn
Publication Date
17-Aug-2003
Withdrawal Date
17-Aug-2003
Current Stage
9599 - Withdrawal of International Standard
Completion Date
15-Sep-2009
Ref Project

Relations

Buy Standard

Standard
ISO/IEC 9945-2:2003 - Information technology -- Portable Operating System Interface (POSIX)
English language
1696 pages
sale 15% off
Preview
sale 15% off
Preview

Standards Content (Sample)

INTERNATIONAL ISO/IEC
STANDARD 9945-2
System Interfaces,
IEEE Std 1003.1™, 2003 Edition
The Open Group Technical Standard
Includes IEEE Std 1003.1™-2001 and IEEE Std 1003.1™-2001/Cor 1-2002
Third edition
2003-08-15
Information technology — Portable
®
Operating System Interface (POSIX ) —

Part 2:

System Interfaces
Technologies de l'information — Interface pour la portabilité des systèmes
®
(POSIX ) —
Partie 2: Interfaces systèmes





Reference number
ISO/IEC 9945-2:2003(E)
System Interfaces, IEEE Std 1003.1, 2003 Edition
The Open Group Technical Standard, Issue 6

---------------------- Page: 1 ----------------------
ISO/IEC 9945-2:2003(E)
System Interfaces, IEEE Std 1003.1, 2003 Edition
The Open Group Technical Standard, Issue 6
PDF disclaimer
This PDF file may contain embedded typefaces. In accordance with Adobe's licensing policy, this file may be printed or viewed but shall not
be edited unless the typefaces which are embedded are licensed to and installed on the computer performing the editing. In downloading this
file, parties accept therein the responsibility of not infringing Adobe's licensing policy. The ISO Central Secretariat accepts no liability in this
area.
Adobe is a trademark of Adobe Systems Incorporated.
Details of the software products used to create this PDF file can be found in the General Info relative to the file; the PDF-creation parameters
were optimized for printing. Every care has been taken to ensure that the file is suitable for use by ISO member bodies. In the unlikely event
that a problem relating to it is found, please inform the Central Secretariat at the address given below.


ISO
Case postale 56 • CH-1211 Geneva 20
Tel. + 41 22 749 01 11
Fax + 41 22 749 09 47
E-mail copyright@iso.org

---------------------- Page: 2 ----------------------
ISO/IEC 9945-2:2003(E)

IEEE Std 1003.1™, 2003 Edition

The Open Group Technical Standard
Base Specifications, Issue 6

Includes IEEE Std 1003.1™-2001 and IEEE Std 1003.1™-2001/Cor 1-2002





Information Technology —
®
Portable Operating System Interface (POSIX )

Part 2: System Interfaces





Sponsor

Portable Applications Standards Committee
of the
IEEE Computer Society

and

The Open Group






Adopted as an International Standard by the
International Organization for Standardization
and by the
International Electrotechnical Commission

---------------------- Page: 3 ----------------------
ISO/IEC 9945-2:2003(E)
System Interfaces, IEEE Std 1003.1, 2003 Edition
The Open Group Technical Standard, Issue 6


International Standard ISO/IEC 9945-2:2003(E)

ISO (the International Organization for Standardization) and IEC (the International Electrotechnical Commission)
form the specialized system for worldwide standardization. National bodies that are members of ISO or IEC
participate in the development of International Standards through technical committees established by the
respective organization to deal with particular fields of technical activity. ISO and IEC technical committees
collaborate in fields of mutual interest. Other international organizations, governmental and non-governmental, in
liaison with ISO and IEC, also take part in the work. In the field of information technology, ISO and IEC have
established a joint technical committee, ISO/IEC JTC 1.

International Standards are drafted in accordance with the rules given in the ISO/IEC Directives, Part 2.

The main task of the joint technical committee is to prepare International Standards. Draft International
Standards adopted by the joint technical committee are circulated to national bodies for voting. Publication as an
International Standard requires approval by at least 75% of the national bodies casting a vote.

Attention is drawn to the possibility that some of the elements of this part of ISO/IEC 9945 may be the subject of
patent rights. ISO and IEC shall not be held responsible for identifying any or all such patent rights.

ISO/IEC 9945-2 was prepared by Joint Technical Committee ISO/IEC JTC 1, Information technology,
Subcommittee SC 22, Programming languages, their environments and system software interfaces.

This third edition of ISO/IEC 9945-2 is a minor revision and, together with ISO/IEC 9945-1, ISO/IEC 9945-3, and
ISO/IEC 9945-4, cancels and replaces ISO/IEC 9945-1:2002 and ISO/IEC 9945-2:2002, ISO/IEC 9945-3:2002
and ISO/IEC 9945-4:2002.

ISO/IEC 9945 consists of the following parts, under the general title Information technology — Portable
®
Operating System Interface (POSIX ):
• Part 1: Base Definitions
• Part 2: System Interfaces
• Part 3: Shell and Utilities
• Part 4: Rationale











International Organization for Standardization/International Electrotechnical Commission
Case postale 56 • CH-1211 Genève 20 • Switzerland

---------------------- Page: 4 ----------------------
Abstract
This standard is simultaneously ISO/IEC 9945: 2003, IEEE Std 1003.1-2001, and forms the core of the Single UNIX Specification,
Version 3.
The IEEE Std 1003.1, 2003 Edition includes IEEE Std 1003.1-2001/Cor 1-2002 incorporated into IEEE Std 1003.1-2001 (base
document). The Corrigendum addresses problems discovered since the approval of IEEE Std 1003.1-2001. These changes are mainly
due to resolving integration issues raised by the merger of the base documents that were incorporated into IEEE Std 1003.1-2001,
TM TM
which is the single common revision to IEEE Std 1003.1 -1996, IEEE Std 1003.2 -1992, ISO/IEC 9945-1: 1996, ISO/IEC 9945-2: 1993,

and the Base Specifications of The Open Group Single UNIX Specification, Version 2.
This standard defines a standard operating system interface and environment, including a command interpreter (or ‘‘shell’’), and
common utility programs to support applications portability at the source code level. This standard is intended to be used by both
applications developers and system implementors and comprises four major components (each in an associated volume):
• General terms, concepts, and interfaces common to all volumes of this standard, including utility conventions and C-language
header definitions, are included in the Base Definitions volume.
• Definitions for system service functions and subroutines, language-specific system services for the C programming language,
function issues, including portability, error handling, and error recovery, are included in the System Interfaces volume.
• Definitions for a standard source code-level interface to command interpretation services (a ‘‘shell’’) and common utility
programs for application programs are included in the Shell and Utilities volume.
• Extended rationale that did not fit well into the rest of the document structure, which contains historical information concerning
the contents of this standard and why features were included or discarded by the standard developers, is included in the
Rationale (Informative) volume.
The following areas are outside the scope of this standard:
• Graphics interfaces
• Database management system interfaces
• Record I/O considerations
• Object or binary code portability
• System configuration and resource availability
This standard describes the external characteristics and facilities that are of importance to applications developers, rather than the
internal construction techniques employed to achieve these capabilities. Special emphasis is placed on those functions and facilities
that are needed in a wide variety of commercial applications.
Keywords
application program interface (API), argument, asynchronous, basic regular expression (BRE), batch job, batch system, built-in
utility, byte, child, command language interpreter, CPU, extended regular expression (ERE), FIFO, file access control mechanism,

input/output (I/O), job control, network, portable operating system interface (POSIX ), parent, shell, stream, string, synchronous,
system, thread, X/Open System Interface (XSI)
System Interfaces, Issue 6 — Copyright  2001-2003, IEEE and The Open Group. All rights reserved. i

---------------------- Page: 5 ----------------------
Copyright 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc. and The Open Group. All rights reserved. This
printing is by the International Organization for Standardization with special permission of the Institute of Electrical and Electronics
Engineers, Inc. and The Open Group. Published in Switzerland.
System Interfaces, Issue 6
Published 31 March 2003 by the Institute of Electrical and Electronics Engineers, Inc.
3 Park Avenue, New York, NY 10016-5997, U.S.A.
ISBN: 0-7381-3436-8 PDF 0-7381-3564-X/SS95078 CD-ROM 0-7381-3563-1/SE95078
Printed in the United States of America by the IEEE.
Published 31 March 2003 by The Open Group
Apex Plaza, Forbury Road, Reading, Berkshire RG1 1AX, U.K.
Document Number: C032
ISBN: 1-931624-24-0
Printed in the U.K. by The Open Group.
All rights reserved. No part of this publication may be reproduced in any form, in an electronic retrieval system or otherwise,
without prior written permission from both the IEEE and The Open Group.
Portions of this standard are derived with permission from copyrighted material owned by Hewlett-Packard Company,
International Business Machines Corporation, Novell Inc., The Open Software Foundation, and Sun Microsystems, Inc.
Permissions
Authorization to photocopy portions of this standard for internal or personal use is granted provided that the appropriate fee is paid
to the Copyright Clearance Center or the equivalent body outside of the U.S. Permission to make multiple copies for educational
purposes in the U.S. requires agreement and a license fee to be paid to the Copyright Clearance Center.
Beyond these provisions, permission to reproduce all or any part of this standard must be with the consent of both copyright holders
and may be subject to a license fee. Both copyright holders will need to be satisfied that the other has granted permission. Requests
to the copyright holders should be sent by email to austin-group-permissions@opengroup.org
.
Feedback
This standard has been prepared by the Austin Group. Feedback relating to the material contained in this standard may be
submitted using the Austin Group web site at http://www.opengroup.org/austin/defectform.html.
ii System Interfaces, Issue 6 — Copyright  2001-2003, IEEE and The Open Group. All rights reserved.

---------------------- Page: 6 ----------------------
IEEE
IEEE Standards documents are developed within the IEEE Societies and the Standards Coordinating Committees of the IEEE
Standards Association (IEEE-SA) Standards Board. The IEEE develops its standards through a consensus development process,
approved by the American National Standards Institute, which brings together volunteers representing varied viewpoints and
interests to achieve the final product. Volunteers are not necessarily members of the Institute and serve without compensation.
While the IEEE administers the process and establishes rules to promote fairness in the consensus development process, the IEEE
does not independently evaluate, test, or verify the accuracy of any of the information contained in its standards.
Use of an IEEE Standard is wholly voluntary. The IEEE disclaims liability for any personal injury, property, or other damage, of any
nature whatsoever, whether special, indirect, consequential, or compensatory, directly or indirectly resulting from the publication,
use of, or reliance upon this, or any other IEEE Standard document.
The IEEE does not warrant or represent the accuracy or content of the material contained herein, and expressly disclaims any
express or implied warranty, including any implied warranty of merchantability or fitness for a specific purpose, or that the use
of the material contained herein is free from patent infringement. IEEE Standards documents are supplied ‘‘AS IS’’.
The existence of an IEEE Standard does not imply that there are no other ways to produce, test, measure, purchase, market, or
provide other goods and services related to the scope of the IEEE Standard. Furthermore, the viewpoint expressed at the time a
standard is approved and issued is subject to change brought about through developments in the state of the art and comments
received from users of the standard. Every IEEE Standard is subjected to review at least every five years for revision or
reaffirmation. When a document is more than five years old and has not been reaffirmed, it is reasonable to conclude that its
contents, although still of some value, do not wholly reflect the present state of the art. Users are cautioned to check to determine
that they have the latest edition of any IEEE Standard.
In publishing and making this document available, the IEEE is not suggesting or rendering professional or other services for, or on
behalf of, any person or entity. Nor is the IEEE undertaking to perform any duty owed by any other person or entity to another. Any
person utilizing this, and any other IEEE Standards document, should rely upon the advice of a competent professional in
determining the exercise of reasonable care in any given circumstances.
Interpretations: Occasionally questions may arise regarding the meaning of portions of standards as they relate to specific
applications. When the need for interpretations is brought to the attention of the IEEE, the Institute will initiate action to prepare
appropriate responses. Since IEEE Standards represent a consensus of concerned interests, it is important to ensure that any
interpretation has also received the concurrence of a balance of interests. For this reason, IEEE and the members of its societies and
Standards Coordinating Committees are not able to provide an instant response to interpretation requests except in those cases
where the matter has previously received formal consideration.
Comments for revision of IEEE Standards are welcome from any interested party, regardless of membership affiliation with the
1
IEEE. Suggestions for changes in documents should be in the form of a proposed change of text, together with appropriate
supporting comments. Comments on standards and requests for interpretations should be addressed to:
Secretary, IEEE-SA Standards Board, 445 Hoes Lane, P.O. Box 1331, Piscataway, NJ 08855-1331, U.S.A.
__________________________________________________________________________________________________________________
LLAttention is called to the possibility that implementation of this standard may require use of subject matter covered by patent
LL
rights. By publication of this standard, no position is taken with respect to the existence or validity of any patent rights in
LL
connection therewith. The IEEE shall not be responsible for identifying patents for which a license may be required by an IEEELL
LStandard or for conducting inquiries into the legal validity or scope of those patents that are brought to its attention.L
LL
A patent holder has filed a statement of assurance that it will grant licenses under these rights without compensation or underLL
Lreasonable rates and non-discriminatory, reasonable terms and conditions to all applicants desiring to obtain such licenses. TheL
LLIEEE makes no representation as to the reasonableness of rates and/or terms and conditions of the license agreements offered by
LL
patent holders. Further information may be obtained from the IEEE Standards Department.
_LL_________________________________________________________________________________________________________________LL
Authorization to photocopy portions of any individual standard for internal or personal use is granted in the U.S. by the Institute of
2
Electrical and Electronics Engineers, Inc., provided that the appropriate fee is paid to the Copyright Clearance Center. Permission to
photocopy portions of any individual standard for educational classroom use can also be obtained through the Copyright Clearance
Center. To arrange for payment of the licensing fee, please contact:
Copyright Clearance Center, Customer Service, 222 Rosewood Drive, Danvers, MA 01923, U.S.A., Tel.: +1 978 750 8400
Amendments, corrigenda, and interpretations for this standard, or information about the IEEE standards development process, may
be found at http://standards.ieee.org.
Full catalog and ordering information on all IEEE publications is available from the IEEE Online Catalog & Store at
http://shop.ieee.org/store.
________________________
1. For this standard, please send comments via the Austin Group as requested on page iii.
2. Please refer to the special provisions for this standard on page iii concerning permissions from both copyright holders and arrangements to cover photocopying and
reproduction across the world, as well as by commercial organizations wishing to license the material for use in product documentation.
System Interfaces, Issue 6 — Copyright  2001-2003, IEEE and The Open Group. All rights reserved. iii

---------------------- Page: 7 ----------------------
The Open Group
The Open Group, a vendor and technology-neutral consortium, is committed to delivering greater business efficiency by bringing
together buyers and suppliers of information technology to lower the time, cost, and risks associated with integrating new
technology across the enterprise.
The Open Group’s mission is to offer all organizations concerned with open information infrastructures a forum to share knowledge,
integrate open initiatives, and certify approved products and processes in a manner in which they continue to trust our impartiality.
In the global eCommerce world of today, no single economic entity can achieve independence while still ensuring interoperability.
The assurance that products will interoperate with each other across differing systems and platforms is essential to the success of
eCommerce and business workflow. The Open Group, with its proven testing and certification program, is the international
guarantor of interoperability in the new century.
The Open Group provides opportunities to exchange information and shape the future of IT. The Open Group’s members include
some of the largest and most influential organizations in the world. The flexible structure of The Open Groups membership allows
for almost any organization, no matter what their size, to join and have a voice in shaping the future of the IT world.
More information is available on The Open Group web site at http://www.opengroup.org.
The Open Group has over 15 years’ experience in developing and operating certification programs and has extensive experience
developing and facilitating industry adoption of test suites used to validate conformance to an open standard or specification. The
Open Group portfolio of test suites includes the Westwood family of tests for this standard and the associated certification program
for Version 3 of the Single UNIX Specification, as well tests for CDE, CORBA, Motif, Linux, LDAP, POSIX.1, POSIX.2, POSIX
Realtime, Sockets, UNIX, XPG4, XNFS, XTI, and X11. The Open Group test tools are essential for proper development and
maintenance of standards-based products, ensuring conformance of products to industry-standard APIs, applications portability,
and interoperability. In-depth testing identifies defects at the earliest possible point in the development cycle, saving costs in
development and quality assurance.
More information is available at http://www.opengroup.org/testing.
The Open Group publishes a wide range of technical documentation, the main part of which is focused on development of Technical
and Product Standards and Guides, but which also includes white papers, technical studies, branding and testing documentation,
and business titles. Full details and a catalog are available at http://www.opengroup.org/pubs.
As with all live documents, Technical Standards and Specifications require revision to align with new developments and associated
international standards. To distinguish between revised specifications which are fully backwards compatible and those which are
not:
• A new Version indicates there is no change to the definitive information contained in the previous publication of that title, but
additions/extensions are included. As such, it replaces the previous publication.

A new Issue indicates there is substantive change to the definitive information contained in the previous publication of that title,
and there may also be additions/extensions. As such, both previous and new documents are maintained as current publications.
Readers should note that Corrigenda may apply to any publication. Corrigenda information is published at
http://www.opengroup.org/corrigenda.
Full catalog and ordering information on all Open Group publications is available at http://www.opengroup.org/pubs.
iv System Interfaces, Issue 6 — Copyright  2001-2003, IEEE and The Open Group. All rights reserved.

---------------------- Page: 8 ----------------------
Contents
Chapter 1 Introduction. 1
 1.1  Scope. 1
 1.2  Conformance . 1
 1.3  Normative References . 1
 1.4  Change History . 1
 1.5  Terminology. 1
 1.6  Definitions . 3
 1.7  Relationship to Other Formal Standards . 3
 1.8  Portability . 3
 1.8.1   Codes. 3
 1.9  Format of Entries. 11
Chapter 2 General Information . 13
 2.1  Use and Implementation of Functions . 13
 2.2  The Compilation Environment. 13
 2.2.1   POSIX.1 Symbols . 13
 2.2.1.1     The _POSIX_C_SOURCE Feature Test Macro. 14
 2.2.1.2     The _XOPEN_SOURCE Feature Test Macro. 14
 2.2.2   The Name Space. 14
 2.3  Error Numbers. 21
 2.3.1   Additional Error Numbers. 28
 2.4  Signal Concepts. 28
 2.4.1   Signal Generation and Delivery. 28
 2.4.2   Realtime Signal Generation and Delivery . 29
 2.4.3   Signal Actions. 30
 2.4.4   Signal Effects on Other Functions . 34
 2.5  Standard I/O Streams. 34
 2.5.1   Interaction of File Descriptors and Standard I/O Streams. 35
 2.5.2   Stream Orientation and Encoding Rules . 36
 2.6  STREAMS . 38
 2.6.1   Accessing STREAMS. 39
 2.7  XSI Interprocess Communication . 39
 2.7.1   IPC General Description. 40
 2.8  Realtime . 41
 2.8.1   Realtime Signals. 41
 2.8.2   Asynchronous I/O . 41
 2.8.3   Memory Management . 43
 2.8.3.1     Memory Locking. 43
 2.8.3.2     Memory Mapped Files. 43
 2.8.3.3     Memory Protection. 43
 2.8.3.4     Typed Memory Objects . 44
 2.8.4   Process Scheduling . 44
System Interfaces, Issue 6 — Copyright  2001-2003, IEEE and The Open Group. All rights reserved. v

---------------------- Page: 9 ----------------------
Contents
 2.8.5   Clocks and Timers . 48
 2.9  Threads. 50
 2.9.1   Thread-Safety. 50
 2.9.2   Thread IDs. 51
 2.9.3   Thread Mutexes. 51
 2.9.4   Thread Scheduling. 52
 2.9.5   Thread Cancellation . 54
 2.9.5.1     Cancelability States . 54
 2.9.5.2     Cancellation Points. 55
 2.9.5.3     Thread Cancellation Cleanup Handlers . 57
 2.9.5.4     Async-Cancel Safety. 57
 2.9.6   Thread Read-Write Locks. 58
 2.9.7   Thread Interactions with Regular File Operations . 58
 2.10  Sockets. 58
 2.10.1   Address Families. 58
 2.10.2   Addressing . 59
 2.10.3   Protocols . 59
 2.10.4   Routing. 59
 2.10.5   Interfaces. 59
 2.10.6   Socket Types. 59
 2.10.7   Socket I/O Mode. 60
 2.10.8   Socket Owner. 60
 2.10.9   Socket Queue Limits . 60
 2.10.10   Pending Error. 60
 2.10.11   Socket Receive Queue. 61
 2.10.12   Socket Out-of-Band Data State . 61
 2.10.13   Connection Indication Queue . 62
 2.10.14   Signals . 62
 2.10.15   Asynchronous Errors . 62
 2.10.16   Use of Options. 63
 2.10.17   Use of Sockets for Local UNIX Connections. 66
 2.10.17.1     Headers . 66
 2.10.18   Use of Sockets over Internet Protocols. 66
 2.10.19   Use of Sockets over Internet Protocols Based on IPv4. 67
 2.10.19.1     Headers . 67
 2.10.20   Use of Sockets over Internet Pr
...

Questions, Comments and Discussion

Ask us and Technical Secretary will try to provide an answer. You can facilitate discussion about the standard in here.