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-16
Object Type Being Manipulated
remove(), tmpfile(), and tmpnam(). These functions have an explicit per-
environment name: for example, fopen_oss() and fopen_guardian().
By calling the OSS variant of the function (for example, fopen_oss()) explicitly from
a Guardian program, the correct version of the function is called for the action to be
taken.
You can write a module that can fit into either a Guardian or OSS program. The
fread(), fwrite(), printf(), and perror() functions will work regardless of the
underlying file environment. A stream must still be opened using the appropriate-
environment version of fopen(), however.
Although ISO/ANSI C allows the user not to use header files, any Guardian program
that contains any type of interoperable code must use the header files provided with
the system to get appropriate function prototypes and defines.
Object Type Being Manipulated
Both process and file objects exist in the Guardian and OSS environments. The
functions tend to operate on objects of their own type. All Guardian functions can
manipulate Guardian objects in a Guardian program. Some OSS functions can
manipulate Guardian objects in a Guardian program. All OSS functions that can be
used in a Guardian program can manipulate OSS objects. A general rule is that
operations on an object of environment type X obey the rules of environment X,
regardless of the API in use. Thus, operations on OSS files obey POSIX.1 security
rules, whether manipulated by Guardian or OSS functions.
A Guardian process using Guardian functions can operate on Guardian objects without
restriction, but cross-object use is subject to conditions. These conditions are
documented in the appropriate reference pages. An OSS function called from a
Guardian process can operate on a Guardian object, but this use is not recommended.
In such cases, the operation is governed by the restrictions of the API (for example,
can you name the given object using the expected syntax?) and by the attributes of the
Guardian process (for example, do you have enough security to do this request?).
Language or C Environment Type
The language in which the Guardian program is written and whether the program is
CRE-compliant affect what can operate or interoperate in the Guardian environment.
Modules of C code can be mixed with modules written in other languages, typically
TAL. Programs with a C main() function are CRE-compliant. Normally, the Guardian
and OSS C functions exist inside programs that are defined to be CRE-compliant. CRE
provides the framework for such things as file I/O, errno, the data heap, and so on.
By default, all C programs are CRE-compliant.
All OSS functions are provided only in C language (prototype) form, and can only be
called directly from C code. However, routines in Guardian programs can be in other
languages, such as TAL, which is not always CRE-compliant. However, it is possible to
call OSS functions from a Guardian program consisting of modules written in C and in
TAL. Refer to the C/C++ Programmer’s Guide and the Open System Services