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
Interoperating Between Programming Environments
Open System Services Porting Guide—520573-006
5-7
Process-Management Interoperability
using HP extension functions such as tdm_fork() and tdm_spawn(), discussed in
the next subsection.
tdm_fork(), tdm_execve set, and tdm_spawn() Functions
A number of process-creation functions specific to HP are available in the OSS
environment to pass Guardian attributes from the parent process to the child process:
tdm_fork(), tdm_execve(), tdm_execvep(), and tdm_spawn(). For more
information about these functions, refer to the corresponding reference pages either
online or in the Open System Services System Calls Reference Manual.
These functions allow control of Guardian attributes in the child process. Typically,
these HP functions are used to run the child process in a processor other than the one
on which the parent process is running. In addition, these functions pass certain
POSIX inheritance attributes to the child process, give an OSS process a process
name, or run the process under the control of a choice of symbolic debuggers.
PROCESS_LAUNCH_ Procedure
All of the procedures and functions in Table 5-2 on page 5-6 can be called from the
OSS environment. However, fork(), the exec set of functions, tdm_fork(),
tdm_execve(), tdm_execvep(), and tdm_spawn() can be called only from the
OSS environment. From Table 5-2, only PROCESS_LAUNCH_ can be used to create
a Guardian process; the others create OSS processes.
The Guardian PROCESS_LAUNCH_ and PROCESS_SPAWN_ procedures obey the
Guardian MOM and ancestor relationships, but the OSS functions obey the UNIX
parent and child process relationships. See Using Process-Creation Calls on
page 6-13, for a discussion of the UNIX parent and child process relationship.
Guardian MOM and ancestors are notified of child termination using system messages
on $RECEIVE. OSS parents are notified of child termination using the SIGCHLD signal
and wait status.
PROCESS_SPAWN_ Procedure
This process-creation procedure is mainly used by Guardian programs that need to
create OSS processes. The osh utility uses PROCESS_SPAWN_ to start a Korn shell.
OSS scripts can also be run by executing this procedure.
The PROCESS_SPAWN_ procedure can be called either from the Guardian or OSS
environments. Various open timeout and nowait creation options are available with this
procedure. Note that the files are opened in the child process and are not propagated
or shared.
Process-Management Interoperability
In general, you should manage OSS processes with OSS functions, which makes your
applications more portable. However, there might be cases in which you want to use
Guardian procedures to manage OSS processes, or to use OSS functions to manage