Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)
7 Porting UNIX Applications to the OSS Environment
Many application programs have been written for the UNIX environment. As UNIX standards have
developed, popular UNIX environments have been brought into conformance with these standards.
UNIX programs that use these standard interfaces should be easy to port to the OSS environment.
However, many UNIX environments still support old system interfaces for backward compatibility,
and have added proprietary extensions of their own. To the degree that UNIX programs still use
these old system interfaces and vendor-specific extensions, these programs can take some additional
effort to port to the OSS environment or other UNIX environments.
ISO/ANSI C has been a standard for the C language for many years. Most new UNIX application
programs are being written in the ISO/ANSI C language, making these programs very portable
to environments, such as OSS, that support the C standard. However, because UNIX programs
written in Common C still exist, most compiler vendors support an option that enables the compilation
of these older programs.
This chapter is intended for UNIX C or C++ programmers interested in porting C or C++ programs
from a UNIX environment to the OSS environment. It provides guidelines for performing a port,
an overview of the basic differences between the UNIX and OSS programming environments, and
a description of the rich set of functions offered by the OSS environment.
The topics for this chapter are:
• “General Porting Guidelines” (page 107)
• “Using Functional Equivalents” (page 111)
• “Differences Between OSS and UNIX Environments” (page 112)
• “OSS C Programming Considerations” (page 115)
• “Using HP Extensions” (page 129)
• “Using the OSS Internationalization Subsystem” (page 134)
Beginning with the H06.24 and J06.13 RVUs, 64-bit OSS applications are supported. For
information about 64-bit OSS applications, see the 64-Bit Support in OSS and Guardian chapter
in the Open System Services Programmer's Guide.
General Porting Guidelines
There are a number of issues you must take into consideration when porting a UNIX application
program to the OSS environment. Obviously, if a program is originally written to be portable to
multiple environments, the porting of the UNIX program to the OSS environment should be easy.
However, this compatibility is not always the case.
Before highlighting specific considerations for porting between the OSS and UNIX environments,
the following general issues are discussed:
• “Scope of Portability” (page 108)
• “Levels of Portability” (page 108)
• “Porting Analysis” (page 108)
• “Design Trade-Offs” (page 109)
• “Equivalent Features” (page 109)
• “Standard Functions” (page 109)
• “Equivalent Functions” (page 109)
• “Single-Processor Versus Multiprocessor Systems” (page 110)
General Porting Guidelines 107