Open System Services Porting Guide (G06.24+, H06.03+)
Table Of Contents
- What’s New in This Manual
- About This Manual
- 1 Introduction to Porting
- 2 The Development Environment
- 3 Useful Porting Tools
- 4 Interoperating Between User Environments
- Purpose of Interoperability
- The OSS User Environment
- OSS Commands for the Guardian User
- Guardian Commands for the UNIX User
- OSS Pathname and Guardian Filename Conversions
- Running the OSS Shell and Commands From TACL
- Running Guardian Commands From the OSS Shell
- Running OSS Processes With Guardian Attributes
- Using OSS Commands to Manage Guardian Objects
- 5 Interoperating Between Programming Environments
- 6 OSS Porting Considerations
- 7 Porting UNIX Applications to the OSS Environment
- 8 Migrating Guardian Applications to the OSS Environment
- General Migration Guidelines
- C Compiler Issues for Guardian Programs
- Using New and Extended Guardian Procedures
- Using OSS Functions in a Guardian Program
- Interoperating With OSS Programs
- Starting an OSS Program From the Guardian Environment
- C Compiler Considerations for OSS Programs
- Porting a Guardian Program to the OSS Environment
- How Arguments Are Passed to the C or C++ Program
- Differences in the Two Run-Time Environments
- Which Run-Time Routines Are Available
- Use of Common Run-Time Environment (CRE) Functions
- Replacing Guardian Procedure Calls With Equivalent OSS Functions
- Which IPC Mechanisms Can Be Used
- Interactions Between Guardian and OSS Functions
- 9 Porting From Specific UNIX Systems
- 10 Native Migration Overview
- 11 Porting or Migrating Sockets Applications
- 12 Porting Threaded Applications
- A Equivalent OSS and UNIX Commands for Guardian Users
- B Equivalent Guardian Commands for OSS and UNIX Users
- C Equivalent Inspect Debugging Commands for dbx Commands
- D Equivalent Native Inspect Debugging Commands for dbx Commands
- E Standard POSIX Threads Functions: Differences Between the Previous and Current Standards
- Glossary
- Index
Porting or Migrating Sockets Applications
Open System Services Porting Guide—520573-006
11-6
Differences Between OSS Sockets and Guardian
Sockets
LISTNER cannot directly activate OSS programs. To activate an application in the
OSS environment the same way that LISTNER activates Guardian programs,
either start the application using inetd or write a small program to interface with
the LISTNER process. The latter program would start the real application in the
OSS environment, passing the port number and IP address from LISTNER to the
OSS application. For further information on LISTNER, refer to the TCP/IP
Programming Manual or the IPX/SPX Programming Manual. For more information
on inetd, refer to Starting an OSS Server Process on page 6-26.
The most important difference between OSS sockets and Guardian sockets is the way
in which socket input/output is performed.
•
When a Guardian sockets application performs waited I/O, control is not returned
to the application until a socket I/O call completes. This behavior is the same as
that of an OSS sockets application using blocking sockets.
•
If a Guardian sockets application uses nowait I/O for sockets, you must modify it to
use OSS sockets functions.
Guardian concurrent processing uses function calls that are nowait analogs of
standard sockets library calls; these analogous functions include socket_nw(),
recv_nw(), and send_nw(). To perform nowait I/O, a Guardian application:
°
Creates a socket using socket_nw()
°
Performs reads or writes with the other nowait functions (each input/output
operation requires a separate preallocated buffer)
°
Tests Guardian file numbers for I/O completion
You have three choices when migrating a Guardian nowait I/O application to use
OSS sockets:
°
You can rewrite the application to use only blocking sockets. This option is
usually not a good choice for applications that need to handle multiple requests
concurrently. Refer to the requester2 sample program in the Open System
Services Programmer’s Guide for a blocking sockets application.
°
You can modify the application to use blocking sockets in a nonblocking
manner. An OSS sockets application can perform concurrent operations by:
•
Testing the OSS sockets file descriptors using the select() function at
certain points during processing for their readiness for read or write
operations
•
Performing reads or writes on any OSS sockets that are ready
Refer to the server2 sample program in the Open System Services
Programmer’s Guide for an application that uses blocking sockets in a
nonblocking manner.
°
You can modify the application to use nonblocking sockets. An OSS sockets
application can perform concurrent operations by: