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-22
Using OSS Function Calls
standard Guardian security mechanisms and by Safeguard for Guardian disk file and
process access.
Using the opendir() and readdir() Functions
The opendir() function call can be used for OSS and Guardian directories. Using
readdir() on the /G, /G/vol, and /G/vol/subvol directories returns all entries,
even files inaccessible through OSS interfaces, such as Enscribe structured files and
SQL tables and views. The first readdir() call after opendir() or rewinddir()
causes the file system to retrieve a block of directory entries from an OSS name
server.
For both Guardian and OSS directories, if files are added to a directory after a block of
entries is obtained from an OSS name server, it is possible that no entry is returned for
the new files. The same applies for deleted files.
Using the read() and write() Functions
The read() and write() function calls read and write to OSS and Guardian files. In
the OSS environment, the maximum buffer size that can be read using read() or
written using write() is the value of the SSIZE_MAX constant (52 kilobytes).
SSIZE_MAX is defined in the limits.h file.
Using the rename() and rmdir() Functions
The rename() and rmdir() function calls are not allowed on /G, /dev, /dev/tty,
/dev/null, or /lost+found in the root directory of an OSS fileset. The rename()
function cannot be used on directories in the Guardian file system, but it can be used
on Guardian permanent disk files, provided the name arguments specify the same
volume and the caller has Guardian write access to the file. Subvolumes in the
Guardian file system can be removed, but volumes cannot.
Using socket() and Related Functions
Calls to the OSS sockets functions for AF_INET and AF_INET6 connections can use
an alternate transport provider process if such a process has been started. The default
transport provider process for AF_INET sockets is $ZTC0. An alternate transport
provider process can be named by setting the Guardian MAP DEFINE
=TCPIP^PROCESS^NAME for the sockets application before starting the application
or by calling the socket_transport_name_set() function while the application is
running. The current transport provider process name can be determined by calling the
socket_transport_name_get() function. If you want to use Parallel Library
TCP/IP or NonStop TCP/IPv6, use one of these methods to specify a TCPSAM or
TCP6SAM process name for the transport service provider. For information about how
to determine the name of a TCPSAM or TCP6SAM process, refer to the TCP/IP
(Parallel Library) Configuration and Management Manual or the TCP/IPv6
Configuration and Management Manual