Section 6.2. General Differences


6.2. General Differences

With major operating systems such as HP-UX, Solaris, AIX, and Linux embracing standards set forth by standards bodies such as ANSI, ISO, and POSIX, it would seem that porting between platforms should be easy. When it comes to application programming interface (API) implementation, these operating systems have implemented the majority of the standard APIs from the different standards bodies. From a compiler standpoint, these operating systems support the latest compiler standards, too. Unfortunately, other factors such as programming syntax (brought about by the use of old compilers implementing draft standards), use of platform-specific APIs, and use of early releases of third-party libraries, to name a few, may prevent an easy migration of software applications from HP-UX to Linux.

6.2.1. C Language

Both the HP-UX C compiler and GCC support ANSI C, but syntax and semantics differences may still prevent an error-free compilation in Linux. Within GCC, other standards can be selected by using the -ansi, -std=89, -std=iso9899:1990, -std=c99,[3] or -std=iso9899:1999 options.

[3] GCC has incomplete support for C99. See http://gcc.gnu.org/gcc-3.4/c99status.html.

6.2.2. C++ Language

Starting with GNU g++ version 3.4.0, GNU g++ claims[4] to be much closer to the ISO/ANSI C++ standards. This means, among other things, that a lot of invalid constructs that used to be accepted in previous versions will now be rejected. HP's aC++ compiler implements ANSI C++ standards and also claims to implement them more completely. The HP-UX C++ compiler ships with the standard C++ and Roguewave STL library and Tools.h++, whereas GNU only ships with libstdc++. Overall, there should be minimal differences in standards compliance when migrating from the latest version of HP-UX aC++ to GNU g++.

[4] http://gcc.gnu.org/gcc-3.4/changes.html#cplusplus

6.2.3. GNU C/C++ Language

The GNU Compiler Collection (GCC) is available for HP-UX 11i. Applications compiled with GCC on HP-UX will make porting and migration easier on Linux. Take care when using different versions of the GCC compiler when migrating from HP-UX to Linux. Applications that compile cleanly on older versions of GCC might not compile as well on new versions because of changes in programming standards specifically in the C++ language.

6.2.4. Java Language

The HP-UX SDK for the Java platform provides the Java 2 (version 1.4) programming tools and runtime environment. The Java environment is available for Linux through the Blackdown Java SDK (www.blackdown.org). As of this writing, Blackdown has released Java version 1.4.2 and is working on release version 1.5. Other Linux Java SDKs are available for download from the Sun and IBM Web sites. Refer to Chapter 2, "Scoping," for more information about the Java environment in Linux.

6.2.5. Threads

HP-UX 11i v2 supports the POSIX threads implementation. Previous versions of HP-UX supported what is known as CMA threads, which are also known as DCE pthreads. Applications using HP-UX CMA threads will need some major changes to use POSIX threads on Linux.

6.2.6. Standards Comparison

Almost all Linux distributors acknowledge the value that standardization and portability provide, and they work with the various Linux implementers/maintainers to meet those standards. The primary Linux industry standard is the Linux Standard Base (LSB), which is a project overseen by the Free Standards Group (FSG). The LSB is based heavily on the IEEE POSIX and Open Group Single UNIX Specification standards, but it also documents those places where Linux is not UNIX- or POSIX-compatible. Most and all of the major Linux distributors have certified to the LSB.

The LSB, in addition to providing a source code API specification, provides an Application Binary Interface (ABI) specification for each of several common Linux hardware platforms.[5] The goal of the ABI is to ensure binary portability, for LSB-portable applications, between Linux distributions on that hardware platform. Distributors must certify to the ABI as well as the API. Independent software vendors (ISVs) can also certify their applications as "LSB portable" using tools provided by the FSG.

[5] The ABI would also allow the linking of object files even if they are compiled by different compilers.

Table 6-1 compares HP-UX-supported standards to the Linux-supported standards based on the LSB specification version 2.0.1.

Table 6-1. Supported Standards on HP-UX and Linux

Standard

HP-UX 11i v2

Linux

IEEE POSIX 1003.1-2001 Base Function

Supported

Supported

IEEE POSIX 1003.1 Threads (pthreads)

Supported

Supported

Single UNIX Specification Base function (this is sometimes known as XPG5 or XPG6)

Supported

Supported as described in the LSB

IEEE POSIX 1003.1c-1996 POSIX system calls

Supported

Supported

IEEE POSIX 1003.1-2001 Real-time scheduler, clocks and timers, asynchronous I/O, semaphores, memory locking, message queues, real-time signals, shared memory

Supported

Asynchronous I/O, real-time signals, shared memory, semaphores

IEEE POSIX 1003.4a Draft 4 User Threads

On older HP-UX releases only

Not supported

IEEE POSIX 1003.1-2001 (Commands and Utilities)

Supported

Supported

System V Interface Definition (SVID3)

Supported

Referenced[6]

File System Directory Layout

System V.4 (SVR4)

Filesystem Hierarchy Standard www.pathname.com/fhs/

X11 Window System, Font Server, and Clients

X11R6.3

X11R6.4

OSF/Motif

V2.1

Supported through third-party libraries (see lesstiff, www.lesstif.org)[7]

RPC function interfaces

Supported

Supported

NFS+ Diskless and ONC+, NFS+, version 4.2

 

Referenced standards: SVID Issue 4, SVID Issue 3

OSF/Motif Application Environment Specification (AES)

Supported

Supported through third-party products[8]

LP64, 64-bit data model

Supported

Supported


[6] A referenced standard means that not all interfaces within the standard are supported.

[7] Not included within the LSB specification

[8] See Open Motif, www.opengroup.org/openmotif/faq.html

Although there is standardization within Linux, Linux itself is not totally compliant with either the IEEE POSIX or Open Group SUS specifications.[9] This means that applications that may be totally portable under these common commercial UNIX standards may still need some work to move successfully to Linux. However, this work will be much less than for an application that meets no standards at all, or that uses HP-UX-specific UNIX extensions.

[9] Conflicts between ISO/IEC 9945 (POSIX) and the Linux Standard Base (www.opengroup.org/personal/ajosey/tr01-04-2005.txt)




UNIX to Linux Porting. A Comprehensive Reference
UNIX to Linux Porting: A Comprehensive Reference
ISBN: 0131871099
EAN: 2147483647
Year: 2004
Pages: 175

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net