Vous êtes sur la page 1sur 12

AS 3976.

11991
ISO/IEC 9945-1: 1990

This is a free 11 page sample. Access the full version at http://infostore.saiglobal.com.

Australian Standard
Information processingPortable Operating System Interface (POSIX) Part 1: System Application Program Interface (API) C Language
[ISO/IEC title: Information technologyPortable Operating System Interface (POSIX)Part 1: System Application Program Interface (API) [C Language]]

This Australian Standard was prepared by Committee IT/9, Information Systems Vocabulary and Software. It was approved on behalf of the Council of Standards Australia on 31 July 1991 and published on 23 September 1991.

This is a free 11 page sample. Access the full version at http://infostore.saiglobal.com.

The following interests are represented on Committee IT/9: Attorney-Generals Department AUSTEL Australian Bankers Association Australian Bureau of Statistics Australian Chamber of Manufactures Australian Computer Society Australian Computer Users Association Department of Defence Department of Finance Landata Telecom Australia Universities and colleges

Review of Australian Standards. To keep abreast of progress in industry, Australian Standards are subject to periodic review and are kept up to date by the issue of amendments or new editions as necessary. It is important therefore that Standards users ensure that they are in possession of the latest edition, and any amendments thereto. Full details of all Australian Standards and related publications will be found in the Standards Australia Catalogue of Publications; this information is supplemented each month by the magazine The Australian Standard, which subscribing members receive, and which gives details of new publications, new editions and amendments, and of withdrawn Standards. Suggestions for improvements to Australian Standards, addressed to the head office of Standards Australia, are welcomed. Notification of any inaccuracy or ambiguity found in an Australian Standard should be made without delay in order that the matter may be investigated and appropriate action taken.

AS 3976.11991

This is a free 11 page sample. Access the full version at http://infostore.saiglobal.com.

Australian Standard
Information processingPortable Operating System Interface (POSIX) Part 1: System Application Program Interface (API) C Language

First published as AS 3976.11991.

PUBLISHED BY STANDARDS AUSTRALIA (STANDARDS ASSOCIATION OF AUSTRALIA) 1 THE CRESCENT, HOMEBUSH, NSW 2140
ISBN 0 7262 7084 9

ii PREFACE
This Standard was prepared by the Standards Australia Committee on Information Systems Vocabulary and Software. It is identical with and has been reproduced from ISO/IEC 9945-1: 1990 Information technologyPortable Operating System Interface (POSIX), Part 1: System Application Program Interface (API) [C Language]. Under arrangements made between Standards Australia and the international Standards bodies, ISO and IEC, as well as certain other Standards organizations, users of this Australian Standard are advised of the following: (a) Copyright is vested in Standards Australia. (b) The number of this Standard is not reproduced on each page; its identity is shown only on the cover and title pages. For the purposes of this Australian Standard, the ISO/IEC text should be modified as follows:
This is a free 11 page sample. Access the full version at http://infostore.saiglobal.com.

(i) Terminology The words Australian Standard should replace the words International Standard wherever they appear. (ii) References The references to International Standards should be replaced by references to Australian Standards as follows: Reference to International Standard ISO/IEC 646 Information processingISO 7-bit coded character set for information interchange Australian Standard AS 1776 Information processing7-bit coded character set for information interchange 3955 Information processingProgramming LanguagesC

9899 Information technologyProgramming LanguagesC

Copyright STANDARDS AUSTRALIA Users of Standards are reminded that copyright subsists in all Standards Australia publications and software. Except where the Copyright Act allows and except where provided for below no publications or software produced by Standards Australia may be reproduced, stored in a retrieval system in any form or transmitted by any means without prior permission in writing from Standards Australia. Permission may be conditional on an appropriate royalty payment. Requests for permission and information on commercial software royalties should be directed to the head office of Standards Australia. Standards Australia will permit up to 10 percent of the technical content pages of a Standard to be copied for use exclusively in-house by purchasers of the Standard without payment of a royalty or advice to Standards Australia. Standards Australia will also permit the inclusion of its copyright material in computer software programs for no royalty payment provided such programs are used exclusively in-house by the creators of the programs. Care should be taken to ensure that material used is from the current edition of the Standard and that it is updated whenever the Standard is amended or revised. The number and date of the Standard should therefore be clearly identified. The use of material in print form or in computer software programs to be used commercially, with or without payment, or in commercial contracts is subject to the payment of a royalty. This policy may be varied by Standards Australia at any time.

iii CONTENTS
Page

Section 1.1 1.2 1.3 Section 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8 2.9

1: General . . . . . . . . Scope . . . . . . . . . . . . Normative References Conformance . . . . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . .

. . . .

1 1 2 2

This is a free 11 page sample. Access the full version at http://infostore.saiglobal.com.

2: Terminology and General Requirements Conventions . . . . . . . . . . . . . . . . . . . . . . Definitions . . . . . . . . . . . . . . . . . . . . . . . General Concepts . . . . . . . . . . . . . . . . . . Error Numbers . . . . . . . . . . . . . . . . . . . . Primitive System Data Types . . . . . . . . . . Environment Description . . . . . . . . . . . . . C Language Definitions . . . . . . . . . . . . . . Numerical Limits . . . . . . . . . . . . . . . . . . Symbolic Constants . . . . . . . . . . . . . . . . .

.. 9 .. 9 . 10 . 21 . 23 . 27 . 27 . 29 . 34 . 37 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 41 41 42 46 47 49 51 51 56 57 58 60 62 62 63 63 64 65 67 67 67 68 68 68 70 71 72 72 72 73

Section 3: Process Primitives . . . . . . . . . . . . . . . . 3.1 Process Creation and Execution . . . . . . . . . 3.1.1 Process Creation . . . . . . . . . . . . . . . 3.1.2 Execute a File . . . . . . . . . . . . . . . . 3.2 Process Termination . . . . . . . . . . . . . . . . . 3.2.1 Wait for Process Termination . . . . . 3.2.2 Terminate a Process . . . . . . . . . . . . 3.3 Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3.1 Signal Concepts . . . . . . . . . . . . . . . 3.3.2 Send a Signal to a Process . . . . . . . . 3.3.3 Manipulate Signal Sets . . . . . . . . . . 3.3.4 Examine and Change Signal Action . 3.3.5 Examine and Change Blocked Signals 3.3.6 Examine Pending Signals . . . . . . . . . 3.3.7 Wait for a Signal . . . . . . . . . . . . . . 3.4 Timer Operations . . . . . . . . . . . . . . . . . . . 3.4.1 Schedule Alarm . . . . . . . . . . . . . . . 3.4.2 Suspend Process Execution . . . . . . . 3.4.3 Delay Process Execution . . . . . . . . .

Section 4: Process Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1 Process Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.1.1 Get Process and Parent Process IDs . . . . . . . . . . . . . . . . . . . . . . . 4.2 User Identification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.1 Get Real User, Effective User, Real Group, and Effective Group IDs 4.2.2 Set User and Group IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.3 Get Supplementary Group IDs . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2.4 Get User Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3 Process Groups . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.1 Get Process Group ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.3.2 Create Session and Set Process Group ID . . . . . . . . . . . . . . . . . . . 4.3.3 Set Process Group ID for Job Control . . . . . . . . . . . . . . . . . . . . . .

iv
Page

4.4 4.5

4.6 4.7

4.8
This is a free 11 page sample. Access the full version at http://infostore.saiglobal.com.

System Identification . . . . . . . . . . . . . . . 4.4.1 Get System Name . . . . . . . . . . . . Time . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5.1 Get System Time . . . . . . . . . . . . 4.5.2 Get Process Times . . . . . . . . . . . Environment Variables . . . . . . . . . . . . . . 4.6.1 Environment Access . . . . . . . . . . Terminal Identification . . . . . . . . . . . . . . 4.7.1 Generate Terminal Pathname . . . . 4.7.2 Determine Terminal Device Name Configurable System Variables . . . . . . . . 4.8.1 Get Configurable System Variables

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

74 74 75 75 76 77 77 78 78 79 80 80 83 83 83 83 86 86 87 88 88 91 91 92 94 94 95 96 96 98 99 101 101 103 104 106 107 108 110 110 113 113 113 114 114 115 115 116 116 118

Section 5: Files and Directions . . . . . . . . . . . . . . . . . . . . . . 5.1 Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1.1 Format of Directory Entries . . . . . . . . . . . . . . 5.1.2 Directory Operations . . . . . . . . . . . . . . . . . . . 5.2 Working Directory . . . . . . . . . . . . . . . . . . . . . . . . . 5.2.1 Change Current Working Directory . . . . . . . . . 5.2.2 Get Working Directory Pathname . . . . . . . . . . 5.3 General File Creation . . . . . . . . . . . . . . . . . . . . . . . . 5.3.1 Open a File . . . . . . . . . . . . . . . . . . . . . . . . . 5.3.2 Create a New File or Rewrite an Existing One . 5.3.3 Set File Creation Mask . . . . . . . . . . . . . . . . . 5.3.4 Link to a File . . . . . . . . . . . . . . . . . . . . . . . . 5.4 Special File Creation . . . . . . . . . . . . . . . . . . . . . . . . 5.4.1 Make a Directory . . . . . . . . . . . . . . . . . . . . . 5.4.2 Make a FIFO Special File . . . . . . . . . . . . . . . 5.5 File Removal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.5.1 Remove Directory Entries . . . . . . . . . . . . . . . 5.5.2 Remove a Directory . . . . . . . . . . . . . . . . . . . 5.5.3 Rename a File . . . . . . . . . . . . . . . . . . . . . . . 5.6 File Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . 5.6.1 File Characteristics: Header and Data Structure 5.6.2 Get File Status . . . . . . . . . . . . . . . . . . . . . . . 5.6.3 Check File Accessibility . . . . . . . . . . . . . . . . 5.6.4 Change File Modes . . . . . . . . . . . . . . . . . . . . 5.6.5 Change Owner and Group of a File . . . . . . . . 5.6.6 Set File Access and Modification Times . . . . . 5.7 Configurable Pathname Variables . . . . . . . . . . . . . . . 5.7.1 Get Configurable Pathname Variables . . . . . . . Section 6: Input and Output Primitives . . . . . . . . 6.1 Pipes . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1.1 Create an Inter-Process Channel . . 6.2 File Descriptor Manipulation . . . . . . . . . 6.2.1 Duplicate an Open File Descriptor 6.3 File Descriptor Deassignment . . . . . . . . . 6.3.1 Close a File . . . . . . . . . . . . . . . . 6.4 Input and Output . . . . . . . . . . . . . . . . . . 6.4.1 Read from a File . . . . . . . . . . . . 6.4.2 Write to a File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

v
Page

6.5

Control Operations on Files . . . . . . . . . . . . . . . . . 6.5.1 Data Definitions for File Control Operations 6.5.2 File Control . . . . . . . . . . . . . . . . . . . . . . . 6.5.3 Reposition Read/Write File Offset . . . . . . .

. . . .

. . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

121 121 121 127 129 129 129 129 129 130 130 131 132 132 133 133 135 135 135 135 136 137 138 139 140 141 141 141 142 142 142 142 143 143 145 147 148 151 151 152 154 155 156 157 158 162 162 162 162

This is a free 11 page sample. Access the full version at http://infostore.saiglobal.com.

Section 7: Device- and Class-Specific Functions . . . . . . . . . . 7.1 General Terminal Interface . . . . . . . . . . . . . . . . . . . . 7.1.1 Interface Characteristics . . . . . . . . . . . . . . . . . 7.1.1.1 Opening a Terminal Device File . . . 7.1.1.2 Process Groups . . . . . . . . . . . . . . . 7.1.1.3 The Controlling Terminal . . . . . . . . 7.1.1.4 Terminal Access Control . . . . . . . . . 7.1.1.5 Input Processing and Reading Data . 7.1.1.6 Canonical Mode Input Processing . . 7.1.1.7 Noncanonical Mode Input Processing 7.1.1.8 Writing Data and Output Processing . 7.1.1.9 Special Characters . . . . . . . . . . . . . 7.1.1.10 Modem Disconnect . . . . . . . . . . . . . 7.1.1.11 Closing a Terminal Device File . . . . 7.1.2 Parameters That Can Be Set . . . . . . . . . . . . . . 7.1.2.1 termios Structure . . . . . . . . . . . . . . 7.1.2.2 Input Modes . . . . . . . . . . . . . . . . . 7.1.2.3 Output Modes . . . . . . . . . . . . . . . . 7.1.2.4 Control Modes . . . . . . . . . . . . . . . . 7.1.2.5 Local Modes . . . . . . . . . . . . . . . . . 7.1.2.6 Special Control Characters . . . . . . . 7.1.2.7 Baud Rate Values . . . . . . . . . . . . . 7.1.3 Baud Rate Functions . . . . . . . . . . . . . . . . . . . 7.1.3.1 Synopsis . . . . . . . . . . . . . . . . . . . . 7.1.3.2 Description . . . . . . . . . . . . . . . . . . 7.1.3.3 Returns . . . . . . . . . . . . . . . . . . . . . 7.1.3.4 Errors . . . . . . . . . . . . . . . . . . . . . . 7.1.3.5 Cross-References . . . . . . . . . . . . . . 7.2 General Terminal Interface Control Functions 7.2.1 Get and Set State . . . . . . . . . . . . . . 7.2.2 Line Control Functions . . . . . . . . . . 7.2.3 Get Foreground Process Group ID . . 7.2.4 Set Foreground Process Group ID . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Section 8: Language-Specific Services for the C Programming Language 8.1 Referenced C Language Routines . . . . . . . . . . . . . . . . . . . . . . 8.1.1 Extensions to Time Functions . . . . . . . . . . . . . . . . . . . 8.1.2 Extensions to setlocale () Function . . . . . . . . . . . . . . . . 8.2 C Language Input/Output Functions . . . . . . . . . . . . . . . . . . . . 8.2.1 Map a Stream Pointer to a File Descriptor . . . . . . . . . . . 8.2.2 Open a Stream on a File Descriptor . . . . . . . . . . . . . . . 8.2.3 Interactions of Other FILE-Type C Functions . . . . . . . . 8.2.4 Operations on Files the remove () Function . . . . . . . . 8.3 Other C Language Functions . . . . . . . . . . . . . . . . . . . . . . . . . 8.3.1 Nonlocal Jumps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8.3.2 Set Time Zone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

vi
Page

Section 9: System Databases . . . . . . . 9.1 System Databases . . . . . . . . . 9.2 Database Access . . . . . . . . . . 9.2.1 Group Database Access 9.2.2 User Database Access .

. . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . . . . . . . . . . .

165 165 166 166 167 169 169 169 173 177 179 179 181 182 185 185 196 226 246 253 264 273 283 293 294 301 313 313 314 315 315 315 317 318 321 327

Section 10: Data Interchange Format . . 10.1 Archive/Interchange File Format 10.1.1 Extended tar Format . . . 10.1.2 Extended cpio Format . . 10.1.3 Multiple Volumes . . . . .
This is a free 11 page sample. Access the full version at http://infostore.saiglobal.com.

Annex A (informative) Bibliography . . . . . . . . . . . . . . . A.1 Related Open Systems Standards . . . . . . . . . . . . A.2 Other Standards . . . . . . . . . . . . . . . . . . . . . . . A.3 Historical Documentation and Introductory Texts

Annex B (informative) Rationale and Notes . . . . . . . . . . . . . . . . . . . B.1 Scope and Normative References . . . . . . . . . . . . . . . . . . . . B.2 Definitions and General Requirements . . . . . . . . . . . . . . . . . B.3 Process Primitives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.4 Process Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.5 Files and Directories . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.6 Input and Output Primitives . . . . . . . . . . . . . . . . . . . . . . . . B.7 Device- and Class-Specific Functions . . . . . . . . . . . . . . . . . B.8 Language-Specific Services for the C Programming Language B.9 System Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B.10 Data Interchange Format . . . . . . . . . . . . . . . . . . . . . . . . . .

Annex C (informative) Header Contents Samples . . . . . . . . . . . . . . . . . . . . . . . . . . Annex D (informative) Profiles . . . . . . . . . . . . . . D.1 Definitions . . . . . . . . . . . . . . . . . . . . . . D.2 Options in This Part of ISO/IEC 9945 . . . D.3 Related Standards . . . . . . . . . . . . . . . . . D.4 Related Activities . . . . . . . . . . . . . . . . . D.5 Relationship to IEEE Draft Project 1003.0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

Annex E (informative) Sample National Profile . . . . . . . . . . . . . . . . . . . . . . . . . . . . E.1 (Example) Profile for Denmark . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Identifier Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Alphabetic Topical Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TABLES Table 2-1 Primitive System Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 2-2 Reserved Header Symbols . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

27 31

vii
Page

Table 2-3 Minimum Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 2-4 Run-Time Increasable Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 2-5 Run-Time Invariant Values (Possibly Indeterminate) . . . . . . . . . . . . . . . . Table 2-6 Pathname Variable Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 2-7 Invariant Value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 2-8 Symbolic Constants for the access() Function . . . . . . . . . . . . . . . . . . . .
This is a free 11 page sample. Access the full version at http://infostore.saiglobal.com.

35 35 36 36 37 38 38 38 39 52 52 75 80 101 111 122 122 122 122 122 123 123 125 126 136 136

Table 2-9 Symbolic Constants for the lseek() Function . . . . . . . . . . . . . . . . . . . . . Table 2-10 Compile-Time Symbolic Constants . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 2-11 Execution-Time Symbolic Constants . . . . . . . . . . . . . . . . . . . . . . . . . . Table 3-1 Required Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 3-2 Job Control Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 4-1 uname() Structure Members . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 4-2 Configurable System Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 5-1 stat Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 5-2 Configurable Pathname Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 6-1 cmd Values for fcntl() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 6-2 File Descriptor Flags Used for fcntl() . . . . . . . . . . . . . . . . . . . . . . . . . Table 6-3 l_type Values for Record Locking With fcntl() . . . . . . . . . . . . . . . . . . Table 6-4 oflag Values for open() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 6-5 File Status Flags Used for open () and fcntl () . . . . . . . . . . . . . . . . . . . Table 6-6 File Access Modes Used for open() and fcntl () . . . . . . . . . . . . . . . . . . Table 6-7 Mask for Use With File Access Modes . . . . . . . . . . . . . . . . . . . . . . . . Table 6-8 flock Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 6-9 fcntl() Return Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 7-1 termios Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 7-2 termios c_iflag Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

viii
Page

Table 7-3 termios c_cflag Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 7-4 termios c_lflag Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 7-5 termios c_cc Special Control Characters . . . . . . . . . . . . . . . . . . . . . . . Table 7-6 termios Baud Rate Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 9-1 group Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 9-2 passwd Structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
This is a free 11 page sample. Access the full version at http://infostore.saiglobal.com.

138 139 140 141 166 167 170 174 175 222

Table 10-1 tar Header Block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 10-2 - Byte-Oriented cpio Archive Entry . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table 10-3 - Values for cpio c_mode Field . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table B-1 - Suggested Feature Test Macros . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

AUSTRALIAN STANDARD

Information processingPortable Operating System Interface (POSIX) Part 1: System Application Program Interface (API) C Language
This is a free 11 page sample. Access the full version at http://infostore.saiglobal.com.

Section 1: General 1.1 Scope


This part of ISO/IEC 9945 defines a standard operating system interface and environment to support application portability at the source-code level. It is intended to be used by both application developers and system implementors. This part of ISO/IEC 9945 comprises four major components: (1) (2) (3) (4) Terminology, concepts, and definitions and specifications that govern structures, headers, environment variables, and related requirements Definitions for system service interfaces and subroutines Language-specific system services for the C programming language Interface issues, including portability, error handling, and error recovery

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

The following areas are outside of the scope of this part of ISO/IEC 9945: (1) (2) (3) (4) (5) User interface (shell) and associated commands Networking protocols and system call interfaces to those protocols Graphics interfaces Database management system interfaces Record I/O considerations

1.1 Scope
COPYRIGHT

This is a free preview. Purchase the entire publication at the link below:

This is a free 11 page sample. Access the full version at http://infostore.saiglobal.com.

AS 3976.1-1991, Information processing - Portable Operating System Interface (POSIX) System Application Program Interface (API) C Language

Looking for additional Standards? Visit SAI Global Infostore Subscribe to our Free Newsletters about Australian Standards in Legislation; ISO, IEC, BSI and more Do you need to Manage Standards Collections Online? Learn about LexConnect, All Jurisdictions, Standards referenced in Australian legislation Do you want to know when a Standard has changed? Want to become an SAI Global Standards Sales Affiliate? Learn about other SAI Global Services: LOGICOM Military Parts and Supplier Database Metals Infobase Database of Metal Grades, Standards and Manufacturers Materials Infobase Database of Materials, Standards and Suppliers Database of European Law, CELEX and Court Decisions

Need to speak with a Customer Service Representative - Contact Us