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-19
Using Files
Using Files
Guardian and OSS processes can share a file. The file can be an OSS file or a
Guardian file and can be accessed through Guardian procedures or C functions in a
Guardian program. In an OSS program, the file can be accessed using a C run-time
function. If one process completes the writing of a file before the other process reads
the file, no synchronization problems occur. However, if the Guardian and OSS
process wish to share the file at the same time, a synchronization method must be
used. Guardian file locking for Guardian files and OSS file locking for OSS files can be
used to synchronize access. Guardian semaphores are another mechanism that can
be used, because Guardian semaphores can be invoked in both Guardian and OSS
programs. See the Guardian Programmer’s Guide for further information on
communicating using files.
Using Queue Files
The use of queue files is a particularly efficient mechanism for communication between
OSS programs and Guardian programs. A queue file is a special file that can be written
by multiple writers and read by multiple readers, in a first-in, first-out order. This is
particularly useful for the construction of parallel servers, each running in a separate
processor, reading requests from one centralized queue and servicing them in the
order that the requests are written to the queue. The Guardian DP queue file provides
the synchronization mechanism itself. Along with the performance and ease of
programming advantages comes the disadvantages that they lack any management
and fault tolerant features.
Using Shared Memory
In the Guardian environment, both flat and selectable memory segments can be
created and shared. Guardian processes can share and synchronize access to
memory using Guardian shared memory and semaphore functions. Guardian
processes cannot use OSS functions to share and synchronize access to memory with
other Guardian or OSS processes. OSS processes can share and synchronize access
to memory with other OSS processes using OSS shared memory and semaphore
functions.
A Guardian process can only share and synchronize access to memory with an OSS
process by using the Guardian functions. Only flat segments can be shared between
Guardian and OSS processes. The distinction between flat and selectable segments,
and how to use these shared memory segments, is discussed in detail in the Open
System Services Programmer’s Guide. Using shared memory is an efficient IPC
mechanism that can be used when large amounts of data need to be shared between
an OSS process and a Guardian process running on the same processor.
Using Semaphores
Guardian semaphores are binary semaphores available to Guardian and OSS
programs. OSS semaphores are counting semaphores and are oriented towards