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 UNIX Applications to the OSS Environment
Open System Services Porting Guide—520573-006
7-27
Calling Guardian Procedures
Calls on page 6-13 provides information about when to use these process-creation
functions. The HP extension process-creation functions are as follows:
Using the tdm_fork() and tdm_execve Set of Functions
The tdm_fork() function and the tdm_execve set of functions perform the same
actions as fork() and the exec set of functions with the addition that many Guardian
process attributes and OSS process attributes can be specified when the new process
is created or the new program is executed.
tdm_fork() and the tdm_exec set of functions use the same parameters as fork()
and the exec set of functions, respectively, plus two new parameters. The first new
parameter is a pointer to an input structure, containing Guardian process attributes to
assign to the new process. The input structure is defined in the tdmext.h header file,
including default initialization values for this structure. The initialized values can then
be modified as appropriate for the call. The second new parameter is a pointer to an
output structure, which is defined along with its default initialization values in the
tdmext.h header file.
Upon successful execution of tdm_fork() or the tdm_execve set of functions, the
output structure contains the Guardian process handle and OSS process ID (PID) of
the created process. If the call is not successful, detailed error information is included
in the output structure. The default OSS attributes and default Guardian attributes are
inherited by the child process. Some Guardian attributes that can be specified for the
child process include process priority, processor number, process name (system
generated or programmer specified), home terminal, swap files, and debug options.
Using the tdm_spawn Set of Functions
The tdm_spawn set of functions uses the same input parameters used by the
tdm_execve set of functions with the addition of two parameters. The first parameter
specifies which file descriptors that were open in the parent process remain open in the
child process. The second parameter points to an inheritance structure that specifies
which OSS process attributes are inherited by the child process, including default
signals, signal mask, and process group.
Calling Guardian Procedures
Many of the more than 300 Guardian procedures can be called directly from an OSS
C program by including sections from the cextdecs.h header file in the source code
of the program. You must declare system procedures before calling them so the OSS
tdm_execve() Executes a file with HP extensions
tdm_execvep() Executes a file with HP extensions
tdm_fork() Creates a new process with HP extensions
tdm_spawn() Executes a new process with HP extensions
tdm_spawnp() Executes a new process with HP extensions