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-12
Virtual Memory Management
•
An attempt is made to use memory that has already been freed.
Virtual Memory Management
The Kernel-Managed Swap Facility (KMSF) manages virtual memory for TNS/R and
TNS/E native processes. Native processes use kernel-managed swap space rather
than a user-specified swap file. The global data, heap, main stack, and SRL or DLL
instance data are swapped to system-managed swap files for native processes. The
space guarantee attribute (pe_space_guarantee) of a process can be used by
KMSF to reserve space in system swap files. If the requested space is not available at
process creation, an error is returned, and the process is not started.
For more information on KMSF, refer to the Kernel-Managed Swap Facility (KMSF)
Manual.
Considering Design Trade-Offs
Because of the way in which some of the UNIX features are implemented in the OSS
environment, there may be some performance implications in using these features.
The NonStop operating system uses a loosely coupled multiprocessing architecture;
therefore, different design alternatives might need to be considered in porting UNIX
programs to the OSS environment.
When you must modify code to move it to another environment, you weigh standards
and portability against extensions and performance. If your main priority is portability,
you should conform to the POSIX standards as much as possible. If your program can
use a standard set of interfaces, follow the XPG4 specifications because most UNIX
platforms conform to them.
If performance is a priority, consider the changes discussed under Using Interprocess
Communication (IPC) Mechanisms on page 6-3. Then consider using some of the HP
extensions, which take advantage of the NonStop system architecture. For example,
you can use almost all the Guardian procedure calls in your C program in the OSS
environment. However, the more you use the HP extensions and Guardian procedures,
the less portable your program becomes to other UNIX environments.
If you use the HP extensions, do one of the following:
•
Put the system-dependent code in isolated modules where possible. This practice
allows you to replace the isolated code in future porting. You can use the make
utility to build and link in the correct modules for the environment in which your
program will run. See Using HP Extensions on page 7-25, which discusses placing
extensions in separate modules to get both portable code and high performance.
•
Use the conditional compilation feature (#ifdef and related feature-test macros)
of the HP C compiler for NonStop systems to create a program that contains the
system-dependent code only when the program is compiled for execution on a
NonStop system. This practice allows you to write and maintain portable cross-
platform code when your site has the same application on systems running