Open System Services Programmer's Guide
Function and Macro Behavior
A function or macro that can be called in both the Guardian and OSS environments might or might
not behave in the same way in each environment. Behavior can be classified into three categories:
• Identical behavior
Many of the functions and macros behave the same way in each environment because they
take environment-independent parameters. For example, string functions such as strcat()
are identical in the Guardian and OSS environments. The malloc() function can allocate
a block of memory in a Guardian module and the free() function can free the same block
of memory in an OSS module.
• Nearly identical behavior
Some functions and macros behave nearly the same in each environment. Functions and
macros with nearly identical behavior also take environment-independent parameters. For
example, mathematical functions such as sinh() generate an exception on arithmetic overflow
in the Guardian environment but not in the OSS environment.
• Different behavior
Some functions and macros behave differently in each environment because they take or return
environment-specific parameters. For example, the Guardian C and OSS tmpnam() functions
are both declared as:
char *tmpnam(char *s)
The Guardian C tmpnam() function returns a valid Guardian filename, and the OSS
tmpnam() function returns a valid OSS pathname.
Although the name of a function or macro can be the same in the Guardian and OSS
environments, each environment can have a function with different syntax and semantics. For
example, the Guardian C open() function is declared as:
int open(char *file_name, int flags [, int security]
[, int depth] [, int pext] [, int sext]);
The OSS open() function is declared as:
int open(char *path, int oflag [, mode_t mode]);
Not only does the Guardian C open() function require a name in Guardian filename syntax
and the OSS open() function require a name in OSS pathname syntax, the functions have
different calling sequences. Also, you cannot pass an OSS file descriptor to the Guardian C
open() function (or to any Guardian C function), and vice versa.
An OSS function or macro that can operate on Guardian objects is limited in what it can do
when compared to the corresponding Guardian C function or macro. For example, the OSS
open() function can open some types of Guardian files (by specifying the file as an OSS
pathname in the /G file system), but the Guardian C open() function can open additional
types of Guardian files.
Using the API Interoperability Table
Some functions and macros in the Guardian and OSS APIs can interoperate completely between
the Guardian and OSS environments: that is, they can be called from either a Guardian or OSS
module, can execute as part of a Guardian or OSS process, and can operate on Guardian or
OSS objects. Some functions and macros are more limited in their interoperability between
environments.
For each function or macro listed in Table 77 (page 482), the level of interoperability it provides is
indicated by the following information:
• Specification or standard where the function or macro is defined.
• Whether the function or macro can be called from a Guardian module, an OSS module, a
Guardian process, or an OSS process.
478 API Interoperability in TNS Processes