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-29
Which Run-Time Routines Are Available
•
Opening the standard input, output, and error files (stdin, stdout, stderr)
The arguments for the program are set up in an argument array that is accessible from
the main program. The run-time library also saves information in the environment array
for Guardian processes. The environment array contains environment parameters from
PARAM messages. The Guardian C run-time library includes functions that allow the
retrieval of the process startup message, the PARAM message, and the ASSIGN
messages. In the Guardian environment, the CRE automatically opens three standard
files (stdin, stdout, stderr).
The startup procedures are somewhat different in the OSS environment. The standard
files are controlled by the OSS file system, not the CRE. Also, because OSS
processes do not use startup messages, information is passed to a new OSS process
mainly by use of program arguments and environment variables. These differences
must be taken into consideration when migrating a Guardian program to the OSS
environment. The environment information saved by the C library during program
startup can be accessed by calling the getenv() library function and by declaring
parameters to the main() function. Your program can access both the environment
and argument arrays using the parameters passed to main().
The Guardian and OSS C run-time libraries consist of two overlapping sets of
procedures in the following areas
•
malloc() and free()
•
getenv() or putenv() and **environ
•
errno
•
stdin, stdout, and stderr file pointers
•
ANSI file input and output
•
Routines in the embedded set
•
Unified CRE Master Control Block (MCB)
All of these procedures can run equally well, and are interchangeable, in Guardian or
OSS processes. They have only one implementation, or if there are two, the
implementations are so coordinated as to make the difference invisible. These
implementations involve the same set of type definitions, flags, literals, and so on, in
the header files for the objects which are interoperable.
Which Run-Time Routines Are Available
There are two implementations of some of the file system routines: one for the
Guardian environment and one for the OSS environment. The set of procedures that
operate on Guardian objects but are callable from Guardian or OSS processes, for
example fopen($A.B.C,...), is different from the set of procedures that operate on
OSS objects but are callable from Guardian or OSS processes, for example,
fopen (/a/b/c/d , ... ).
The Guardian and OSS run-time environments are defined by facilities available
through the use of the CRE and by the more than 300 predefined macros and
functions available in the C run-time library. The C run-time library provides the
complete set of functions specified by the ISO/ANSI C standard and additional