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-9
Process-Termination Interoperability
Process-Termination Interoperability
When a process calls PROCESS_SPAWN_ to create a process, the parent process is
treated as a Guardian process, regardless of whether the caller is an OSS or Guardian
process. In this case, the parent process receives process-termination notification
through Guardian system messages (instead of the SIGCHLD signal, which is normal
notification for OSS processes). The parent process reads system messages from
$RECEIVE, which is a special file through which a process receives system messages
or messages from other processes.
The exit() and _exit() function calls can be issued by either an OSS process or a
Guardian process. If the parent process is an OSS process, the normal SIGCHLD
signal is sent to notify the parent process of the death of one of its child processes.
Child processes of a terminated process are assigned a parent process ID of 1. For
more information about the exit function, refer to the exit(3) reference page either
online or in the Open System Services Library Calls Reference Manual. For more
information about the _exit function, refer to the _exit(2) reference page either
online or in the Open System Services System Calls Reference Manual.
File Interoperability
You access OSS files in the OSS environment as you would access UNIX files. The
OSS environment also allows you to access a limited set of files in the Guardian
environment, which means that you can create applications for NonStop systems that
use data in Guardian files and that take advantage of OSS portability and other OSS
features.
Use OSS file system functions to manipulate OSS files if you want your program to be
portable to other UNIX environments. However, it may be necessary to manipulate
Guardian files using the OSS API, or to manipulate OSS files using the Guardian API.
The FILENAME_TO_PATHNAME_ and PATHNAME_TO_FILENAME_ Guardian
mapping procedures provide the link between OSS pathnames and Guardian
filenames. These two procedures are discussed more in Guardian Procedure Calls for
Interoperability on page 7-26.
Accessing Files From the OSS API
OSS functions are tailored to the OSS environment and work more efficiently than
Guardian procedures on OSS files. You can access three types of Guardian files with
OSS functions:
•
Odd-unstructured files (file types 0, 100, and 180). These files permit reading and
writing of both even and odd byte counts and positioning to both even and odd
byte addresses. Unstructured files do not have a built-in record structure.
•
EDIT files (file type 101). These files are unstructured. You can access them only
for reading.
•
Telnet processes.