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
Porting UNIX Applications to the OSS Environment
Open System Services Porting Guide—520573-006
7-28
Calling Guardian Procedures
C compiler generates the appropriate interface code to call the Guardian system
procedures. The cextdecs.h header file contains function prototype declarations for
the Guardian procedures that can be called directly from a C program by specifying the
C names for the procedures in uppercase characters and providing a section for each
procedure using the SECTION pragma.
The Guardian procedures require nonstandard C syntax to describe the interfaces.
Code that calls Guardian procedures needs to be compiled with the -Wextensions
option; for example:
c89 -Wextensions foo.c
Many Guardian procedures return values that can be used directly in a C program.
Other Guardian procedures use condition codes, such as TAL procedures returning
_cc_status. You must include the tal.h header file to use these Guardian
procedures in your C program in the OSS environment. See Checking the Condition
Code on page 10-8.
For those Guardian procedures which use structure declarations, the use of the
appropriate header files in your programs is strongly recommended.
The most commonly used header files are:
To use Guardian procedures in your C program, you can specify only the names of the
procedures you want to include as section names. The following sample code
demonstrates using Guardian procedures in a C program:
#include <tal.h>
#include <cextdecs.h(FILE_OPEN_, READX)>
_cc_status CC;
...
retcode = FILE_OPEN_(pathname, , &filenum, 1, , , , 040);
...
CC = READX(filenum, buffer, 1024);
if (_status_eq(CC)) {
...
} else
...
The syntax of a Guardian procedure call determines whether a parameter is required
or optional. Refer to the Guardian Procedure Calls Reference Manual and the
Guardian Programmer’s Guide for more information on using Guardian procedures.
Refer to the Open System Services Programmer’s Guide for details on which Guardian
procedures can be called from C programs running in the OSS environment.
/G/system/zsysdefs/zsysc System data structures and literals
/G/system/zsysdefs/zfilc File system data structures and literals
/G/system/zsysdefs/zspic System program interface data structures and
literals