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-7
Using Pipes and FIFO Files
Refer to the corresponding reference pages, either online or in the Open System
Services System Calls Reference Manual, for details on using OSS message-queue
functions.
Message Queues and Process Creation Functions
The message-queue identifiers returned by the msgget() function are not associated
with any process, and information about the identifiers is not maintained in the context
of any user process. These message-queue identifiers are global to the system, so the
following do not handle the message-queue identifiers, as they do for file descriptors
and other process attributes:
•
The fork() function
•
The exec set of functions
•
The tdm_fork() function
•
The tdm_execve set of functions
•
The tdm_spawn set of functions
Using Pipes and FIFO Files
A pipe redirects the output of one process to the input of another; a pipe is an
unnamed FIFO file. Pipes are created programmatically by invoking the pipe()
function (discussed in this subsection), or interactively with the shell pipe character (|).
Refer to the Open System Services User’s Guide for information on creating pipes
interactively.
FIFO files are always read and written in a first-in, first-out (FIFO) manner. FIFOs are
named pipe files, and they can appear only in the OSS name space. (They have the
same meaning as in the UNIX file systems.) This subsection discusses creating pipes
and FIFO files in the OSS environment, as well as performance considerations.
Pipe Implementation for Single-Processor System
A parent process can create a pipe by calling the pipe() function, which returns a
pair of file descriptors: one for writing and one for reading. The parent process calls
fork() or tdm_fork() to create a child process in the same processor. The child
process shares all the parent’s file descriptors. When the parent process creates a
pipe, the pipe management is done in the same processor in which the parent is
running. If the child process is created in the same processor, all pipe I/O between the
two processes is handled within that processor.
When the parent and child processes are in the same processor, there is very little
processing involved to create a pipe: it is all done in memory with a pipe buffer.
Because there is no interaction with the OSS pipe server, the operation is quick and
uses very few system resources.