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-13
Using Process-Creation Calls
versions of the UNIX operating system in addition to the OSS environment. See
Predefined Preprocessor Symbols on page 7-15, which discusses conditional
compilation of system-dependent code.
Using Process-Creation Calls
This subsection discusses the OSS process-creation functions: fork(),
tdm_fork(), and the exec, tdm_execve, and tdm_spawn sets of functions. It
compares process-creation functions between UNIX and OSS environments and
discusses methods to improve performance. For detailed descriptions of each OSS
process-creation function, refer to the online reference pages or to the Open System
Services System Calls Reference Manual.
If your program uses a lot of process-creation function calls (or script files which
contain a great deal of short commands, each requiring a process creation), your
program will experience more overhead than it might experience on other UNIX
systems. This is because the process-creation overhead is higher on Open System
Services than it is on most UNIX systems. You might wish to consider redesigning your
program to make it run more efficiently.
Using fork() and the exec Set of Functions in UNIX
In UNIX environments, a process uses the fork() function call to create another
process. The process that issues fork() is known as the “parent process”; the
process created by fork() is known as the “child process.”
When you use the fork() function call, you usually call one of the exec set of
functions immediately after it. Creating processes this way is somewhat inefficient.
First, the existing process (the parent) calls the fork() function, producing a new
process (the child), which is a copy of the parent process. One of these processes
(normally, the child) then calls one of the exec set of functions. Calling one of the
exec set of functions determines what you want to run within that process and
overlays the new process with a copy of the new process image—note the redundancy
of new process creations. This redundancy is more apparent in the OSS environment,
because there is more processor cross-checking performed than done in a UNIX
environment and because calling one of the exec set of functions in the UNIX
environment does not create a new process.
Using fork() and the exec Set of Functions in OSS
In the OSS environment, you can use fork() and the exec set of functions as you
would in the UNIX environment, or you can use comparable versions of these functions
that are HP extensions: tdm_fork() and the tdm_execve set of functions. The OSS
process-creation functions are similar to their UNIX counterparts, except that creating
processes in the OSS environment also gives the processes Guardian attributes.
Because OSS processes have Guardian attributes, Guardian procedures can access,
manage, and control OSS processes.