Section 5.2. General Differences


5.2. General Differences

A common misconception is that the more familiar you are with the code you are porting, the more successful the port will be. In fact, first and foremost, your biggest advantage is how familiar you are with the source build environment. Familiarity with the code is second, although not required. On the other hand, not being familiar with the ported code will not hinder the porting effort. Instead, having a good knowledge of ANSI C/C++, ISO, and POSIX standards will give you a greater advantage than knowing the code. These skills are needed to help you assess and troubleshoot the code when you have to make surgical and strategic changes in the existing code. This section will help you build on those analytical skills so that you make the correct changes when necessary.

Although both AIX and GNU claim to adhere to ANSI, ISO, and POSIX standards, there are some differences. This section covers those differences between the two platforms and their development environments. Although some example codes are used to clarify points, most of the material covered in this section relates to differences in system calls, compiler and linker invocation, and library creation.

5.2.1. C Language

Both the AIX C compiler and GCC support the ANSI C (ANSI/ISO 9899-1990) standard, 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, or -std=iso9899:1990 options.

5.2.2. C++ Language

Starting with GNU g++ version 3.4.0, GNU g++ claims[3] 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. The AIX xlC (C++) compiler implements the latest ANSI C++ standards (including the Standard Template Library, STL) in libC. A GNU g++ compilers implements the latest ANSI C++ standards and STL in the libstdc++ library. For both AIX and GNU, to use the STL you just include the appropriate template library. Overall, this means that although some differences do exist between AIX and GNU, there are minimal differences in standards compliance when migrating from the latest version of AIX C++ to GNU g++. In short, applications written with standards in mind are easier to migrate than those that are not.

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

5.2.3. GNU C/C++ Language

The GNU Compiler Collection (gcc) is available for AIX. Applications compiled with gcc on AIX make porting and migration easier on Linux. You should be careful when using different versions of the GCC compiler when migrating from AIX 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.

5.2.4. Java Language

The AIX 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 Sun and IBM Web sites.

5.2.5. Threads

AIX 5L supports the POSIX threads implementation. Previous versions of AIX prior to release 5L supported DCE pthreads. Applications using DCE threads will need some major changes to use POSIX threads on Linux. Refer to Section 5.16, Posix Threads, for more information on differences between AIX and Linux.

5.2.6. Standards Comparison

Almost all Linux distributors acknowledge the values that standardization and portability provide, and 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 (whose most recent version at this time is LSB 3.0) is based heavily on the IEEE POSIX and Open Group Single UNIX Specification standards, but also documents those places where Linux is not UNIX- or POSIX-compatible. Most (and all the major) Linux distributors have certified to the LSB.

The LSB, in addition to providing a source code API specification, also provides a binary interface (ABI) specification for each of several common Linux hardware platforms. 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 Service Vendors (ISVs) can also certify their applications as "LSB portable" using tools provided by the FSG.

Although there is standardization within Linux, Linux itself is not totally compliant with either the IEEE POSIX or Open Group SUS specifications. 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. Still, considerably less work would be required than for an application that meets no standards at all or that uses AIX-specific UNIX extensions.

Table 5-1 compares AIX supported standards to the Linux supported standards based on the LSB specification version 2.0.1.

Table 5-1. Supported Standards on AIX and Linux

Standard

AIX

Linux

IEEE POSIX 1003.1-2001 Base Function

Supported

Supported as described in the LSB

IEEE POSIX 1003.1 Threads (pthreads)

Supported

Supported

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

Supported

Supported as described in the LSB

IEEE POSIX 1003.1b 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 earlier release of AIX prior to 5L only

Not supported

IEEE POSIX 1003.1-2001 (Commands and Utilities)

Supported

Supported

System V Interface Definition (SVID3)

Supported

Referenced[4]

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 lesstif, www.lesstif.org)[5]

RPC function interfaces NFS+ Diskless and ONC+, NFS+, version 4.2

Supported

Supported Referenced standards, SVID Issue 4, SVID Issue 3

OSF/Motif Application Environment Specification (AES)

Supported

Supported through third-party products[6]

LP64, 64-bit data model

Supported

Supported


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

[5] Not included within the LSB specification

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

With the exception of IEEE POSIX 1003.4a Draft 4 user threads, both AIX and Linux fully support standards.[7] Draft 4 user threads are DCE threads, which are an earlier version of POSIX threads. Because over the years AIX has been available longer than Linux, some earlier versions of AIX support DCE threads, whereas Linux support of threads starts with Native POSIX Threads Library (NPTL), which claims to be more compliant with regular POSIX threads. NPTL is discussed in detail in Chapter 3, "Analysis."

[7] Conflicts between ISO/IEC 9945 (POSIX) and the LSB




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