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
OSS Porting Considerations
Open System Services Porting Guide—520573-006
6-2
Memory Mapped Files
If you must recode your program to achieve feature equivalence in the OSS
environment, always try to conform to the POSIX standards and XPG4 specifications;
see Porting Is Easier When Standards Are Used on page 1-2. When porting code that
uses extensions, use functional equivalents from the POSIX standards to avoid
propagating extensions to the OSS environment.
Memory Mapped Files
Mapped files provide a mechanism for a process to access files by directly
incorporating file data into the address space of the process. After a file is mapped into
a process address space, the data can be manipulated as memory. If more than one
process maps a file, its contents are shared among them. This feature is implemented
in UNIX System V Release 4 (SVR4) but is not part of the XPG4 specifications.
In general, most UNIX programmers do not use this feature, but if your program does
use mapped files, you will have to redesign it to use a less transparent file access
mechanism, because mapped files are not supported in the OSS environment.
Multiple Threads in Applications
Multithreading is a programming model that enables multiple threads of execution in a
process’s address space. Also, multithreading allows many sequential processing
tasks to execute concurrently within a process (for example, a terminal control
process). Multithreaded applications take advantage of a shared-memory,
multiprocessor system.
Guardian and OSS environments do not support multithreading. One way to support
multithreaded applications is to use the user-level multithreading package provided as
Standard POSIX Threads (T1248).
Standard POSIX Threads is a set of services and tools that supports the creation, use,
and maintenance of distributed applications in a heterogeneous computing
environment. Standard POSIX Threads provides interoperability and security among
different environments.
An alternative to using multithreaded applications is to redesign your application
without using threads by using the select() function and nonblocking I/O (nowait I/O
in Guardian terminology). Usually, this redesign involves changing the logic of your
application.
The STREAMS Feature
STREAMS is a programming feature that allows you to insert modules into your
communications stream, providing a uniform mechanism for implementing networking
services and other character-based I/O. The STREAMS interface provides direct
access to networking protocol modules and supports device drivers.
STREAMS is an optional feature of XPG4 and is not supported in the OSS
environment. You must use an alternative feature, such as Guardian sockets, or
redesign your program.