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
Migrating Guardian Applications to the OSS
Environment
Open System Services Porting Guide—520573-006
8-15
Process Target Type
Process Target Type
The target of a module, chosen at compile time, determines the environment of the
routines being selected. The chosen target interacts with special toggles (feature-test
macros) in the header files to select particular implementations appropriate for the
target. Usually, all modules of a program have the same environment and are bound
together into a program that runs as a process of that environment.
To include OSS functions in a Guardian program, separate compilation of modules
containing OSS functions may be necessary. Because the environment of the process
is determined by the environment of the module containing the main() function
(Guardian in this case), the Guardian program may consist of mixed environment
modules. The target type defines the set of process attributes a process has. Because
Guardian processes have a subset of the attributes associated with OSS processes,
Guardian processes cannot use all of the OSS functions.
Guardian programs can include:
•
Single-environment (Guardian) functions
•
Per-environment functions
•
Opposite-environment (OSS) functions
•
Both-environment functions
In some cases, there is only one version of a function, and it is intended for use only
within a single environment. For example, waitpid() can be used only in an OSS
program, and fopen_std_file() can be used only in a Guardian program. Thus,
OSS functions that fall into this category cannot be used in Guardian programs.
Both targets also contain per-environment functions with the same name but with
different implementations in each environment. The versions are usually simply
incompatible. For example, for TNS processes, there are both OSS (G-series only) and
Guardian versions of raise() and setjmp(); Guardian programs must use the
Guardian versions of these functions; otherwise unpredictable results are possible.
There is one version of the C run-time library for the native environment, so there is
more API interoperability. Refer to the API interoperability tables in the Open System
Services Programmer’s Guide.
Use of Environment-Specific Functions
Sometimes there are two different implementations of a function, one for each
environment, but either of these opposite-environment functions can be used within a
single program. For example, a Guardian process can call an OSS function such as
fopen(). Users of such functions should not expect these opposite-environment
functions to perform exactly as they would within same-environment processes or on
same-environment objects.
The syntax of the calling sequence can be different for opposite-environment functions.
The semantics is usually also different: for example, Guardian fopen() expects a
Guardian filename, and OSS fopen() expects an OSS pathname. These
environment-specific functions are fopen(), fclose(), freopen(), rename(),