Go Solo 2
The Authorized Guide to Version 2 of the Single UNIX® Specification
ISBN: 0-13-575689-8
Document Number: X909P
Published in the U.K. by The Open Group.
____________________________________________________
Contents
____________________________________________________
About the Authors... xv
About The Open Group.. xvii
The Business Case for Open Systems. xxi
About This Document .... xxxi
Part 1 Introduction .... 1
Chapter 1 The Single UNIX Specification ... 3
1.1 Introduction... 3
1.2 History and Timeline ... 5
1.2.1 Timeline..... 7
1.3 The Single UNIX Specification (1994) ...... 8
1.4 The Single UNIX Specification, Version 2 ... 10
1.5 The X/Open UNIX Brand.... 11
1.6 Summary ...... 12
Chapter 2 Product Standards and Brands...... 13
2.1 The Brand..... 13
2.2 Product Standards ...... 13
2.2.1 Components ..... 14
2.2.2 Profiles ...... 15
2.3 Conformance Statements .. 15
2.4 Testing.. 15
2.5 UNIX 98 16
2.5.1 The UNIX 98 Product Standard...... 16
2.5.2 The UNIX 98 Workstation Product Standard. 17
Chapter 3 The Single UNIX Environment. 19
3.1 Introduction... 19
3.2 Formal Standards Alignment...... 20
3.3 Portability Codes.. 20
3.4 Common Directories and Devices ..... 22
3.5 Environment Variables 22
3.6 YACC Grammars as Specifications... 23
3.7 Regular Expressions... 23
3.8 File Access ... 24
3.9 Programming Environment. 24
3.9.1 C-language Support. 24
3.9.2 Feature Test Macros and Name Space Issues ..... 24
3.9.3 Error Numbers .. 25
3.9.4 Standard I/O Streams ..... 25
3.9.5 STREAMS . 25
3.9.6 Interprocess Communication... 26
3.9.7 Realtime .... 26
3.9.8 Threads ..... 26
3.9.9 General Terminal Interface...... 26
3.9.10 How to Read an XSH Reference Page.. 27
3.10 Commands and Utilities Environment 27
3.10.1 X/Open Shell Command Language 27
3.10.2 Symbolic Links.. 28
3.10.3 File Format Notation. 28
3.10.4 How to Read an XCU Reference Page.. 28
3.11 X/Open Networking Services ..... 29
3.12 X/Open Curses Interfaces.. 29
3.13 Internationalization...... 30
Chapter 4 System Interfaces .. 31
4.1 Feature Groups.... 31
4.2 POSIX.1 System Interfaces 32
4.3 ISO C Standard Library...... 34
4.4 POSIX.2 C-language Interfaces . 35
4.5 IPC Interfaces...... 35
4.6 General Base Interfaces .... 36
4.7 Application Internationalization Support.... 39
4.8 Encryption .... 41
4.9 Legacy.. 41
Chapter 5 Commands and Utilities...... 43
5.1 Options in XCU.... 43
5.2 Functional Overview.... 43
Chapter 6 Networking Interfaces . 47
6.1 Functional Overview.... 47
6.1.1 X/Open Transport Interface (XTI) ... 47
6.1.2 Sockets Interfaces ... 48
6.1.3 IP Address Resolution Interface..... 48
6.2 Networking Services, Issue 5 Migration.... 48
6.2.1 Change of size_t to socklen_t . 48
6.2.2 Introduction of t_scalar_t and t_uscalar_t for XTI . 49
6.2.3 Introduction of uint16_t and uint32_t for Sockets.. 49
6.2.4 Thread-safety ... 49
6.2.5 Scatter/Gather Support ... 50
Chapter 7 Terminal Interfaces 51
7.1 Functional Overview.... 51
Part 2 What s New in Version 2. 53
Chapter 8 Overview ..... 55
8.1 Introduction... 55
8.2 New Interfaces in XSH, Issue 5.. 56
8.2.1 POSIX Realtime Extension ..... 56
8.2.1.1 Functional Overview..... 56
8.2.1.2 Mandatory Functionality 57
8.2.1.3 Optional Functionality... 57
8.2.2 POSIX Threads Extension ...... 58
8.2.2.1 Functional Overview..... 58
8.2.2.2 Mandatory Functionality 58
8.2.2.3 Optional Functionality... 59
8.2.3 X/Open Threads Extension ..... 60
8.2.4 Dynamic Linking Extensions ... 60
8.2.5 ISO C Amendment 1 (MSE).... 61
8.2.6 Data Size Neutrality and 64-bit Support. 61
8.2.7 Large File Support ... 61
8.2.8 Miscellaneous ... 61
8.3 Major Changes in XCU, Issue 5 . 62
8.3.1 Legacy 62
8.3.2 Large File Support ... 62
8.3.3 New Utilities...... 62
8.4 New Interfaces in Networking Services, Issue 5 ...... 63
8.5 New Curses Interfaces 63
Chapter 9 POSIX Realtime ...... 65
9.1 Introduction... 65
9.2 Realtime Signals.. 69
9.3 Synchronized Input and Output.. 70
9.4 Asynchronous Input and Output. 71
9.5 Semaphores . 72
9.6 Memory Locking .. 75
9.7 Memory Mapped Files and Shared Memory .... 76
9.8 Priority Scheduling...... 78
9.9 High-resolution Clocks and Timers.... 79
9.10 Message Passing. 80
Chapter 10 POSIX Threads. 83
10.1 Introduction... 83
10.2 Thread Management... 85
10.3 Thread-specific Data... 87
10.4 Thread Cancellation.... 89
10.5 Thread Synchronization ..... 90
10.6 Thread Execution Scheduling..... 92
10.7 Thread Synchronization Scheduling .. 94
10.8 Process Creation . 95
10.9 Signal Interfaces .. 96
10.10 Thread Creation... 98
10.11 Blocking Functions...... 98
10.12 Thread-safe POSIX.1 and C-language Functions .... 99
10.13 Redefinition of errno.... 102
Chapter 11 X/Open Threads...... 103
11.1 Introduction... 103
11.2 The Aspen Group. 103
11.3 Extended Mutex Attributes . 104
11.4 Read-Write Locks and Attributes 106
11.5 Thread Concurrency Level. 108
11.6 Thread Stack Guard Size... 108
11.7 Parallel I/O.... 109
11.8 Functional Overview.... 109
Chapter 12 Dynamic Linking..... 113
12.1 Introduction... 113
12.2 Functional Overview.... 113
Chapter 13 ISO C Amendment 1 (MSE) 115
13.1 Introduction... 115
13.2 Extended Characters .. 115
13.2.1 Multibyte Characters 116
13.3 Headers 118
13.4 Character Classification ..... 119
13.5 Mapping Functions...... 121
13.6 Number Conversion Functions ... 122
13.7 String Handling .... 122
13.8 The Input/Output Model ..... 125
13.8.1 Wide-character Input Functions...... 125
13.8.2 Wide-character Output Functions ... 126
13.9 Conversion Functions . 127
13.10 Miscellaneous Functions .... 130
13.11 Compatibility Issues.... 130
Chapter 14 Data Size Neutrality and 64-bit Support..... 133
14.1 Introduction... 133
14.2 64-bit Data Models...... 134
14.3 Data Size Neutrality .... 138
14.3.1 System Interface Definitions, Issue 5 (XBD). 138
14.3.2 System Interfaces and Headers, Issue 5 (XSH) ... 138
14.3.3 Commands and Utilities, Issue 5 (XCU) 141
14.4 Porting Issues...... 142
14.4.1 General...... 142
14.4.2 Declarations...... 142
14.4.3 Assignments and Function Parameters . 143
14.4.4 External Interfaces... 144
14.4.5 Format Strings .. 144
14.4.6 Constants .. 144
14.4.7 Pointers ..... 144
14.4.8 Sizeof( ) ..... 145
14.4.9 Structures and Unions .... 145
Chapter 15 Large File Support . 147
15.1 Introduction... 147
15.2 Changes to XBD, Issue4, Version 2 .. 147
15.3 Changes to XSH, Issue4, Version 2 .. 148
15.4 Changes to XCU, Issue4, Version 2 .. 154
15.5 Rationale for Changes 156
15.5.1 Functions not Modified.... 156
15.5.2 Functions Modified... 156
15.5.3 General Porting Suggestions... 161
15.5.4 Considerations for Utilities in Support of Files of Arbitrary Size.. 162
15.6 Further Information ..... 163
Chapter 16 Year 2000: The Millennium Rollover.... 165
16.1 Introduction... 165
16.2 Preparation... 166
16.3 API Usage .... 166
16.4 Command Usage. 167
Chapter 17 POSIX Software Administration..... 169
17.1 Introduction... 169
17.2 History .. 170
17.3 Scope of POSIX .. 171
17.3.1 Components ..... 171
17.3.2 Distributed Roles ..... 172
17.4 Defining and Creating Software Packages ...... 173
17.4.1 Defining Software Structures... 174
17.4.2 Compatibility Matching.... 176
17.4.3 Dependencies... 176
17.4.4 Control Scripts .. 177
17.4.5 Packaging Software . 178
17.5 Distributing, Installing and Managing Software 179
17.5.1 Command Overview 179
17.5.2 Copying Software .... 182
17.5.3 Installing Software ... 182
17.5.4 Requesting Responses from the User... 186
17.5.5 Configuring Software ...... 186
17.5.6 Listing Software 186
17.5.7 Verifying Software.... 186
17.5.8 Modifying Software .. 187
17.5.9 Removing Software.. 187
17.6 Extensions to the Standard 187
17.6.1 Distributed Interoperability 187
17.6.2 Patching .... 188
17.6.3 Other Extensions ..... 188
Part 3 Migration ... 189
Chapter 18 Program Migration and Portability 191
18.1 Feature Groups.... 191
18.2 The Compilation Environment .... 192
18.3 Determining the Platform Support ..... 193
18.4 Functional Duplication. 195
18.5 Other Programming Considerations .. 197
18.5.1 Argument Type Changes. 198
18.5.2 Prototype Changes and Movement 198
18.5.3 Process Environment Access.. 198
18.5.4 Pseudo-terminals..... 198
18.6 Interprocess Communication (IPC) ... 201
18.7 STREAMS .... 201
18.8 Threads-safety..... 201
18.9 Makefile Portability...... 203
Chapter 19 Interface Tables ...... 205
19.1 System Service Table . 205
19.2 Commands and Utilities Table.... 232
Chapter 20 System Interfaces .. 237
Chapter 21 Headers 377
21.1 Header and Name Space Rules. 377
21.1.1 ISO C Headers . 377
21.1.2 POSIX.1 and POSIX.2 Headers..... 378
21.1.3 X/Open UNIX Headers.... 379
21.2 Names Safe to Use..... 379
21.2.1 ISO C Reserved Names.. 380
21.2.2 X/Open Reserved Names 380
21.3 Header Migration Information..... 383
Chapter 22 Utilities. 405
22.1 Introduction... 405
22.2 Utility Migration Information 405
Chapter 23 C-language Migration .. 439
23.1 Introduction... 439
23.2 Compiler 439
23.3 Function Prototypes .... 440
23.3.1 Function Declarations ..... 440
23.3.2 Writing New Code .... 441
23.3.3 Updating Existing Code... 442
23.3.4 Mixing Old and New Styles ..... 442
23.3.5 Variable Number of Arguments ...... 444
23.4 Promotion ..... 446
23.4.1 Converting Types..... 446
23.4.2 Background ...... 446
23.4.3 Using a Cast..... 446
23.4.4 Same Result..... 447
23.4.5 Integral Constants.... 447
23.5 Tokenization and Preprocessing. 448
23.5.1 ISO C Translation Phases 448
23.5.2 Digraph Sequences . 449
23.5.3 Trigraph Sequences. 449
23.5.4 Common Usage C Translation Phases.. 449
23.5.5 Logical Source Lines 450
23.5.6 Macro Replacement. 450
23.5.7 String Literal Production.. 450
23.5.8 Token Pasting ... 451
23.5.9 New Macros...... 451
23.5.10 Changes to define... 452
23.6 Types.... 452
23.6.1 Using Type Qualifiers ...... 452
23.6.2 Incomplete Types..... 454
23.6.3 Compatible and Composite Types.. 457
23.7 Expressions .. 459
23.7.1 Common Usage C Rearrangement 459
23.7.2 ISO C Rules...... 460
23.7.3 Advantages of Rearrangement 460
23.7.4 Other Changes to Expressions 461
23.7.5 Scope of Identifiers .. 461
23.8 Internationalization...... 462
23.8.1 Multi-byte Characters...... 462
23.8.2 Encoding Variations . 463
23.8.3 Wide-character Codes .... 463
23.8.4 Conversion Functions ..... 463
23.8.5 Features of the C Language.... 464
Part 4 Case Studies .. 467
Chapter 24 The Creation of OpenEdition MVS 469
24.1 Introduction... 469
24.2 Fork and the Process Model 471
24.3 Exec and Contents Supervision . 473
24.4 Signals.. 475
24.5 Synchronous Signal Delivery...... 476
24.6 Asynchronous Signal Delivery.... 477
24.7 Security 479
24.8 Thread Support.... 480
24.9 Interprocess Communication...... 482
24.10 Further Information ..... 485
Chapter 25 The Mainframe Operating System BS2000/OSD ... 487
25.1 Introduction... 487
25.2 The POSIX Subsystem ...... 488
25.2.1 Process Concept ..... 488
25.2.2 POSIX Filesystem.... 489
25.2.3 Coexistence of Interfaces 489
25.2.4 User Access ..... 489
25.2.5 ASCII versus EBCDIC .... 490
25.2.6 Implementation of Network Interfaces ... 490
25.3 Shell ..... 490
25.4 Libraries 491
25.5 Synergy between BS2000 and POSIX ..... 491
25.6 Porting of Open Software to BS2000. 492
25.6.1 The Porting Procedure .... 492
25.7 Porting Experience...... 493
25.7.1 RCS Source Management System. 493
25.7.2 ARCIS Document Server 493
25.7.3 WWW Server.... 494
25.8 Summary of Porting Experience. 494
Chapter 26 OpenNT 495
26.1 A Brief History of OPENNT.. 495
26.2 The OPENNT Extended POSIX Subsystem Architecture. 497
26.2.1 Architecture ...... 497
26.2.2 The Windows NT Filesystem... 498
26.3 Performance Issues.... 499
26.4 The WindowsNT Security Model and OPENNT. 500
26.5 Interoperability with the Win32 Subsystem ...... 501
26.5.1 NTFS. 502
26.5.2 The Desktop and User Interface..... 502
26.5.3 Win32 Application Execution... 502
26.5.4 OPENNT Sockets and Win32 Winsock... 503
26.5.5 X11R5 Clients and X11R6 Server .. 503
26.6 Early Applications Porting Experiences .... 503
26.6.1 4.4BSD-Lite Source Code 503
26.6.2 GNU Code. 504
26.6.3 Perl 5.0...... 504
26.6.4 xv ...... 504
26.6.5 Apache ...... 505
26.7 In Summary .. 505
Part 5 Appendices ..... 507
Appendix A CD-ROM Instructions... 509
A.1 Contents 509
A.2 Web Browsers ..... 510
A.3 The HTML Version...... 510
A.4 The PDF Version.. 511
Appendix B Go Solo 2 CD-ROM Terms and Conditions 513
Appendix C Glossary...... 515
Appendix D Referenced Documents ...... 549
Index..... 553