Open System Services Porting Guide (G06.24+, H06.03+)

Table Of Contents
OSS Porting Considerations
Open System Services Porting Guide520573-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.