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

Table Of Contents
Porting UNIX Applications to the OSS Environment
Open System Services Porting Guide520573-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.