Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)

Local headers: define common data structures and symbols
Macros: defined here with comments to describe the macros.
File scope variables: those that are shared by several functions in the same file.
External variables: those defined in other modules but used in current module.
External functions: list external functions used by each module.
Structures and unions: define structures used in current file.
Signal catching functions: keep signal catching functions in this area.
Functions: define functions before use.
Main: if present, place the main() function last.
Porting Is Easier When Standards Are Used
The OSS environment is based upon standards available in the open systems community. These
standards include the POSIX standards, XPG4 interface specifications, and the ISO/ANSI C
compiler language standard. The prime purpose of these standards is to define a consistent interface
and environment for application programs. Using standard interfaces enhances the portability of
your applications to open systems environments.
The following subsections describe the relevant standards:
“POSIX Standards and OSS Conformance” (page 24)
“XPG4 Specifications and OSS Compliance” (page 25)
“OSS Compliance With UNIX 98 and Other Open Group Technical Standards” (page 26)
“ISO/ANSI C Standard and the HP NonStop C Compiler” (page 26)
POSIX Standards and OSS Conformance
POSIX (Portable Operating System Interface) is a group of formal standards introduced by the IEEE
in the mid-1980s. POSIX is a whole family of formal standards defining the interface between
applications and a set of system libraries. The OSS environment is nearly completely compliant
with the 1990 editions of the basic POSIX.1 and POSIX.2 standards. For more information, refer
to the ISO/IEC 9945-1 POSIX.1 Standard and ISO/IEC 9945-2 POSIX.2 Standard documents.
POSIX.1 Standard
POSIX.1 defines interface standards that make up the application program interfaces (APIs). It
defines the APIs to be used by portable programs, the system call interface, and the C run-time
routine interfaces for portable programs. If programs use only those APIs, they are guaranteed to
be portable to other POSIX-conforming environments.
The following provides an overview of the contents of the POSIX.1 standard:
The interfaces commonly used in UNIX systems
Process functions, commonly used in open systems that are UNIX-based; for example, fork(),
the exec set of functions, and kill()
Process functions and process environment functions
Functions involved in reading and writing directories, reading, and writing files and opening
and closing files
Input and output functions
Device-specific and class-specific functions
Language-specific services for C
24 Introduction to Porting