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-2
Scope of Portability
•
Porting Analysis on page 7-3
•
Design Trade-Offs on page 7-3
•
Equivalent Features on page 7-4
•
Standard Functions on page 7-4
•
Equivalent Functions on page 7-4
•
Single-Processor Versus Multiprocessor Systems on page 7-4
•
HP Extensions on page 7-5
•
Programming for Portability on page 7-5
Scope of Portability
Scope of portability refers to the number of target platforms on which the program
currently runs or will run. To ensure that the program stays portable to the UNIX
environment from which you are porting, you must make sure that you do not use
extensions specific to HP, if possible. If the UNIX program uses only standard POSIX
and ISO/ANSI C functions, keeping the program portable will be easier. You should
make the decision about the scope of portability of your program first, before you take
the actual steps of porting the source code to the OSS environment.
If the program already uses vendor-specific extensions, place these extensions in
separately compilable modules or include them in #ifdef directives. If you use some
HP extensions to take advantage of the OSS environment, place the extensions in a
separate module to keep the program portable. If you make significant changes to the
program to take advantage of the OSS environment and do not plan to keep the
program portable to the UNIX environment from which it was ported, you have more
flexibility in rewriting parts of the program. You should still, however, put extensions in
separate source modules or within #ifdef directives, whenever possible.
Levels of Portability
There are three levels of portability to consider when porting a program from a UNIX
environment to the OSS environment: compiler, data-file, and operating environment.
Portability Through Compiler Compatibility
Compiler compatibility exists when any operating-system-independent portions of
C code have identical execution semantics on different systems. C compilers fulfilling
the ISO/ANSI C specification are usually sufficiently compatible. (Most porting
difficulties occur because of underlying hardware differences when the C compilers on
the two systems are compatible.) Porting programs written in Common C to the OSS
environment is discussed in OSS C Programming Considerations on page 7-10.
Portability Through Data-File Compatibility
Data-file compatibility exists when binary data images corresponding to any C structure
or data type can be exchanged between systems. Such compatibility requires that data
type sizes, structure padding conventions, byte orders within multibyte data, and
floating-point representations all be compatible among the systems involved.