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
OSS Porting Considerations
Open System Services Porting Guide—520573-006
6-6
Using Message Queues
overhead is much higher than for other IPC mechanisms. The following tradeoffs exist
for the use of sockets:
•
If you must have source compatibility with portability and POSIX standard socket
semantics, use OSS sockets.
•
If you require improved performance with socket-like semantics but portability is
not a primary consideration, consider making minor code changes to your program
to use Guardian sockets. Refer to the TCP/IP Programming Manual for more
information about Guardian sockets programming.
•
If you require even higher performance and can abandon portability and sockets
semantics, consider recoding your program to use $RECEIVE. Refer to the
Guardian Programmer’s Guide for more information about programs that use
$RECEIVE.
•
If you require maximum performance with portability and can abandon sockets
semantics, use OSS pipes or FIFO files. OSS pipes and FIFOs typically provide a
direct data path without intervening system processes.
Using Message Queues
Messages are classified according to their queueing priority: normal (nonpriority),
priority, or high priority. A message belongs to a particular priority band that determines
its ordering when placed on a queue. Message queues are an optional feature of the
XPG4 specifications. HP implements message queues in the OSS environment with
the services of the msgctl(), msgget(), msgrcv(), and msgsnd() function calls:
•
msgctl() performs message control operations such as queries, removal of
identifiers, and modifying qualities of message identifiers.
•
msgget() creates or returns the identifier for a message queue.
•
msgrcv() reads a message from a queue associated with the msgqid parameter.
•
msgsnd() sends a message to the queue associated with the msgqid parameter.
There is no message-queue support between the Guardian and OSS environments
with the OSS message-queue function calls.
The services provided by message queues also can be provided using other OSS IPC
mechanisms that are generally available on all UNIX systems. The following IPC
mechanisms can be used if you need to modify your application program to provide the
equivalent feature: pipes, FIFOs, and OSS sockets.
If the code you are porting uses message queues, you can redesign your code to use
the Guardian message system. The Guardian message system is available through
the use of $RECEIVE and the WRITEREAD Guardian procedure call.
The semantics of all these alternatives to message queues are different, so this must
be considered when redesigning this portion of your code. The NonStop system
supports both user-level (recommended) and system-level routines.