 |
Solaris to HP-UX Porting
Guide
This guide provides information about porting applications from
Solaris 8 to HP-UX 11i v2 or higher.
Copyright © 2005 Hewlett-Packard Development
Company, L.P.
Hewlett-Packard acknowledges the following trademarks for company
names or products mentioned within the Solaris to
HP-UX Porting Guide:
HP-UX Release 11i and later on all HP computers are UNIX 95
branded products.
Intel® Itanium® Processor Family is a trademark of Intel
Corporation in the US and other countries and is used under
license.
Adobe™ and Adobe Acrobat™ are trademarks of Adobe Systems
Incorporated.
BSD™ is a trademark of the University of California.
POSIX® is a registered trademark of IEEE®.
Motif®, OSF/1®, UNIX®, X Window System®, X/Open® and The Open
Group® are trademarks or registered trademarks of The Open
Group.
Java™ is a U.S. trademark of Sun Microsystems, Inc.
Sun®, SunOS®, Solaris®, Sun Microsystems®, the Sun logo®, NFS®,
ONC®, SMCC®, the SMCC logo®, SunSoft®, the SunSoft logo®,
OpenWindows®, and DeskSet®, are registered trademarks of Sun
Microsystems, Inc.
All SPARC™ trademarks are trademarks or registered trademarks of
Sparc International, Inc. SPARCstation, SPARCcenter, and
SPARCclassic are licensed exclusively to Sun Microsystems, Inc.
Products bearing SPARC trademarks are based upon an architecture
developed by Sun Microsystems, Inc.
Oracle® is a registered U.S. trademark of Oracle Corporation,
Redwood City, California.
Informix® is a registered U.S. trademark of Informix Corporation,
Menlo Park, California.
AT&T® is a registered trademark of AT&T in the USA and
other countries.
Confidential computer software. Valid license from HP and/or its
subsidiaries required for possession, use, or copying. Consistent
with FAR 12.211 and 12.212, Commercial Computer Software, Computer
Software Documentation, and Technical Data for Commercial Items are
licensed to the U.S. Government under vendor's standard commercial
license.
Neither HP nor any of its subsidiaries shall be liable for
technical or editorial errors or omissions contained herein. The
information is provided “as is” without warranty of any kind and is
subject to change without notice. The warranties for HP products are
set forth in the express limited warranty statements accompanying
such products. Nothing herein should be construed as constituting an
additional warranty.
This guide provides information and hints on porting from Solaris
8 to HP-UX 11i v2 or higher. HP recommends Chapter 2. Development
environment , for all developers and key
decision-makers in your organization. The remaining chapters provide
in-depth technical information about specific porting areas.
This guide is for developers who need to migrate applications
from Solaris 8 to HP-UX 11i v2 or higher, and assumes that you have
software development experience on Solaris.
The book contains the following chapters and appendixes.
HP welcomes any comments and suggestions you have on this guide.
You can send comments to:
http://devresource.hp.com/drc/contact_hp.jsp
We will not respond to system problems or technical support
inquiries. Please address technical questions to your local system
vendor or to the appropriate HP technical support office.
Information provided with the software media explains how to send
problem reports to HP.
This guide uses the following conventions:
Chapter 1. Porting effort and
considerations
Porting is the process of taking software that runs on one
operating system and computer architecture and making it run on
another operating system or architecture. In some cases, where the
operating systems or architectures are closely related, or when the
source code of the software has particularly been designed to be
portable, the port really is straightforward: recompile the sources
and run the validation tests to verify that the new program operates
just like the original.
However, there are usually difficulties in following this
straightforward model so there are more steps to the porting
process.
The HP-UX Software Transition Kit (STK) tools and documents can
help you quickly identify and resolve interoperability problems in
your source code and scripts. For more information on the STK, go
to:
http://www.hp.com/go/STK
A good approach to determining effort and feasibility is to
examine each aspect of porting and estimate the minimum and maximum
effort required to accomplish each task. The minimum effort for a
task should be at least as much as that required to accomplish the
task on the original platform. Testing, for instance, will probably
take as much time on HP-UX as it does on Solaris. To determine the
feasibility, make sure each step can be accomplished, and that the
maximum effort falls within your resource budget.
The emergence and adoption of standards such as POSIX.1, UNIX 95,
and UNIX 98 has led to a convergence in programming APIs. This has
greatly reduced the difficulty of porting but has not eliminated it.
First, conformance to a standard is an ongoing process of ever
closer approximation. Once a high degree of conformance is achieved,
the remaining rare discrepancies are often found only after someone
doing a port stumbles on an area that may have been ambiguous in the
standard or was not exactly covered by a conformance suite, but was
nevertheless implemented in different ways on the two platforms.
Second, some behaviors were left undefined by the standards.
Applications that rely on a particular vendor’s implementation of
undefined behavior or on a particular vendor’s extensions to a
standard will require additional effort when porting.
The following outline lists the stages of a typical porting
project:
-
Identify the tools, products, and
development environment your application relies on.
-
Assess the likely impact of how the various
porting issues affect your application.
-
Clean up the code, identifying and removing
architectural dependencies and nonstandard practices if possible.
-
Compile the code, preferably using ANSI
error-checking switches to flag potential issues. Fix any problems
found at compile time.
-
Run the application with a broad set of test
cases, and debug and fix any run-time problems that are detected.
-
Recompile the code and repeat the process,
as necessary.
Most of the coding practices in this guide are not specific to
any one vendor or operating system. They are simply good, standard
coding practices. A number of books are available that cover similar
ground. Some of the better ones include:
-
The C Programming Language, Second Edition,
by Brian W. Kernighan and Dennis M. Ritchie; Prentice-Hall
Software Series, Prentice-Hall, Inc.
-
C Traps and Pitfalls, by Andrew Koenig;
Addison-Wesley Publishing Company
If you want assistance migrating your application to HP-UX 11i,
HP has Partner Technology Access Centers that offer application
certification and porting services to ISVs. Visit the Developer and
Solution Partner Program (DSPP) Web site at the following URL:
http://www.hp.com/dspp/
The availability of third-party software is often the biggest
obstacle when planning a porting project. You must determine the
availability and cost of third-party software for the target
operating system. This may include build environment tools,
third-party libraries, and automated testing tools. See Table A-3,
“HP-UX Porting and Archive Centre Site and Mirrors” for
information about tools that are freely available on HP-UX 11i.
All common commands and utilities specified in the POSIX standard
are supported by Solaris and HP-UX. Primary differences usually
involve options that are supported on one platform but not on the
other, the location of files, or environment variables that affect
the behavior of a command or utility.
For example, on Solaris the historical behavior and location of a
utility was not changed when the utility's behavior conflicted with
a standard. A standard-conforming version of the utility is provided
in /usr/xpg4/bin. On HP-UX, the utility's
location was not modified and the behavior is determined from the
UNIX95 environment variable.
The following sections discuss language and programming issues
you may encounter when compiling your software.
C language |
 |
Porting code from Solaris to HP-UX may require changes to the
code due to syntax and semantic differences in how the C language is
implemented by Solaris versus HP-UX. Both HP-UX and Sun C compilers
support ANSI C (ANSI/ISO 9899-1990), which provides a very closely
related C on either platform. In addition, K&R C on both
platforms is largely similar, but not as close as ANSI C. The
cross-platform compatibility of your C source code can be estimated
by one of the following strategies:
-
When porting to Itanium®-based systems, use
the file-scanning utilities in the Solaris to HP-UX Software
Transition Kit (STK) to assess the portability of your code.
-
On Solaris, try compiling with the -Xc option of the Sun C compiler to see how many
potential problems exist with converting to strict ANSI C.
-
On HP-UX 11i, try compiling with the HP ANSI
C compiler in its default mode (non-Strict ANSI C with the -Ae option) to determine if fewer problems
exist.
You can decide whether to make ANSI-related changes to your
source code based on which approach will give you fewer
problems.
C++ language |
 |
Sun C++ versions 5 and higher implement the same ANSI C++
standard as HP's aC++ compiler, although aC++ generally implements
that standard more completely. Language differences should be
minimal.
GNU C/C++ language |
 |
The GNU Compiler Collection (gcc) is
available for Solaris and HP-UX 11i. If your application is
currently using gcc on Solaris, continued use
on HP-UX 11i will make your migration easier. However,
performance-sensitive applications should give serious consideration
to using the native HP compilers as the resulting executables will
most likely have significantly better performance than the same
application built with the GNU Compiler Collection. See Table A-3,
“HP-UX Porting and Archive Centre Site and Mirrors” for
information on where to obtain GNU tools for HP-UX 11i.
Java language |
 |
The HP-UX SDK for the Java platform provides the Java 2
programming tools and run-time environment which allow you to deploy
Version 1.4 technology with the best performance on HP-UX 11i
systems.
Programming pitfalls |
 |
The following practices can create additional work that will need
to be done to successfully port your application:
-
Using undocumented interfaces.
-
Relying on behaviors that are undefined in
the language and operating system standards
-
Using kernel-intrusive functions or
accessing system-related environment variables.
-
Using proprietary libraries, such as Solaris
threads and OpenWin.
-
Writing code specific to a compiler instead
of the ANSI standard.
Threads |
 |
HP-UX 11i v2 supports the MxN thread model. This model provides
the following features:
-
Supports a larger number of threads
-
Reduces kernel resource consumption
-
Increases performance (faster context
switch, thread creation, and synchronization)
If you use Sun's POSIX threads, the effort to port to HP POSIX
threads will be minimal, if any. If you use proprietary Sun threads,
HP recommends that you change all of your thread-related code.
Alternatively, you can use the Solaris Compatibility Thread Library
(STL) to port applications that use the Solaris threads API to other
systems that have a POSIX threads library. For more information on
STL, refer to the Open Source software development website:
http://sourceforge.net/projects/sctl/
See Chapter 6. Threads
and Multiprocessing for more information on threads.
The time and expense required to port or acquire testing tools
must be factored into the porting assessment. If you have developed
automated test tools, then these tools will need to be ported to
HP-UX 11i. If you are using testing tools provided by a third party,
then you will need to check on the availability of these tools on
HP-UX 11i. Manual test procedures should be reviewed to ensure the
steps and commands are the same on both systems.
Debuggers are different on HP-UX and Solaris, but they have much
of the same functionality. The main debugger on HP-UX is WDB, which
is an HP-supported implementation of the GDB debugger. The latest
version, WDB 4.2.01, works on programs compiled for the Intel
Itanium® architecture. For more information, see Chapter 5. Other
development tools .
Because Solaris and HP-UX both conform to many of the same
industry standards, you are presumably porting to HP-UX for its
reliability and performance. Optimization is therefore an important
step in the porting process, and will allow you to take full
advantage of your HP platform. Optimization can be as simple as
using the appropriate compiler flag or as complex as performing a
comprehensive performance analysis using HP Caliper.
Thread analysis and performance analysis tools are different on
HP-UX and Solaris, although they have much of the same
functionality. Your porting staff will require some time to
familiarize themselves with each new tool. For more information, see
Chapter 6. Threads
and Multiprocessing .
If you have a software package that is distributed to multiple
sites, you may want to package it in HP-UX Software Distributor (SD)
format, which allows you to manage the software with the SD software
management toolset. For more information on packaging in SD format,
see Chapter 10 (Creating Software Packages) in the Software
Distributor Administration Guide for HP-UX 11i or by accessing
the swpackage(1M) manpage. These
documents and additional information can be found at the product’s
Web site:
http://h20293.www2.hp.com/
In addition, the Software Depot Cookbook can be found at:
http://docs.hp.com/en/SD/cookbook.html
A new application called Software Package Builder (SPB) is
available to help you create a Product Specification File (PSF) that
is required for packaging in SD format. HP delivers SPB as a
customer selectable software for all operating environments
beginning with the HP-UX 11i v2 release and the HP-UX 11i v1
September 2003 release. Additional information on SPB can be found
at the product’s Web site:
http://software.hp.com/products/SPB/
The RPM format is another package format to consider. RPM is not
supported on either Solaris or HP-UX 11i, but it is available for
both. RPM is not included with HP-UX 11i. For more information on
RPM, go to:
http://www.rpm.org/
Appendix B. Porting
Checklist provides a porting checklist to help you
start the porting process. For detailed methods on how to plan a
port, see the HP-UX Software Transition Kit at:
http://www.hp.com/go/softwareinfo/STK
For the Solaris to HP-UX Software Transition Kit, see:
http://devrsrc1.external.hp.com/STKS/
Chapter 2. Development
environment
This chapter provides an overview of the development environment
for HP-UX 11i v2.
HP-UX conforms to many common standards. Table 2-1,
“HP-UX and solaris standards” provides a comparison of standards
conformance between HP-UX and Solaris.
Table 2-1. HP-UX and solaris
standards
| Standard |
Solaris 8 |
HP-UX 11i v2 |
| IEEE POSIX 1003.1c kernel threads |
Yes |
Yes |
| Single UNIX Specification, Version 2 (UNIX 98) |
Yes |
No |
| IEEE POSIX 1003.1c-1996 POSIX system calls |
Yes |
Yes |
| IEEE POSIX 1003.1b Real-time scheduler, clocks and timers,
synchronous I/O, semaphores, APIs |
Yes |
Yes |
| IEEE POSIX 1003.4a Draft 4 User Threads |
No |
Deprecated |
| IEEE POSIX 1003.1b Asynchronous I/O, Memory Locking,
Message Queues, Real-Time Signals, Shared Memory |
Yes |
Yes |
| IEEE POSIX 1003.2 (Commands and Utilities) |
Yes |
Yes |
| X/Open Portability Guide (XPG3, XPG4) |
Yes |
Yes |
| System V Interface Definition (SVID3) |
Yes |
Yes |
| System V.4 (SVR4) File System Directory Layout |
Yes |
Yes |
| X11 Window System, Font Server, and Clients |
V 6.4 |
R 6.3 |
| OSF/Motif |
V 2.1 |
V 2.1 |
| NFS+ Diskless and ONC+, NFS+, version 4.2 |
Yes |
Yes |
| OSF/Motif Application Environment Specification (AES) |
No |
Yes |
| LP64, 64-bit data model |
Solaris 8 |
Yes |
This section provides an overview of the compilers supported on
HP-UX 11i:
-
HP C
-
HP ANSI C
-
HP aC++
-
Java
-
HP Fortran
-
COBOL
Table 2-2,
“HP-UX 11i compilers” provides an overview of these supported
HP-UX 11i compilers.
Table 2-2. HP-UX 11i compilers
| Compiler |
Path |
Notes |
| HP ANSI C |
/opt/ansic/bin/cc |
The HP ANSI C compiler plus extensions for HP-UX 11i v2.
HP ANSI C does not include K&R support. |
| C89 |
/opt/ansic/bin/c89 |
The C89 compiler. c89 is equivalent
to invoking cc with the -Aa option. |
| HP aC++ |
/opt/aCC/bin/aCC |
ISO/IEC 14882 Standard for the C++ Programming Language
(the international standard for C++). OpenMP Supported. |
| HP Fortran |
/opt/fortran90/bin/f90 |
Fortran 90 and Fortran 95 compliant
compiler. |
To verify the product number and version for your compiler, enter
the /usr/bin/what (or cc -V) command. For example:
% what /opt/aCC/bin/aCC
/opt/aCC/bin/aCC:
HP aC++/C for Itanium®-based systems B3910B
A.05.50 [May 15 2003] |
HP aC++ and HP ANSI C/C89 compilers |
 |
The HP aC++ compiler for Itanium® systems, A.05.50, supports much
of the ISO/IEC 14882 Standards for the C Programming Language (the
International Standard for C++). When invoked as a C compiler, it
supports the American National Standard for Information Systems –
Programming Language C, ANSI X3.159–1989 (the ANSI C 89 standard).
The compiler also provides partial C99 compliance when used in C
mode. The K&R compilation mode is not available with this
compiler.
Beginning with HP-UX 11i v1.6, C language compilation support has
migrated from the HP C compiler to a common HP aC++ compiler, which
compiles both C and C++ source code. As a result, the bundled C
compiler in /usr/ccs/bin/cc_bundled is
replaced with a driver that invokes the HP aC++ compiler in ANSI C
mode.
In addition, the C89 compiler has also been integrated into HP
aC++. There is no merged C and C++ compiler on HP-UX 11i v1.
Included with HP-UX 11i v2 is the librwtool_v2 library, which corresponds to Rogue
Wave’s Tools.h++ version 7.1.1. Older versions of the Tools.h++
library are available with versions of HP-UX prior to HP-UX 11i v2.
With the librwtool_v2 library, you can use
the functionality of Tools.h++ in C++ applications compiled for use
with the -AA option (the option that selects
the Standard C++ run time, as opposed to the classic C++ run-time.
Previously, the functionality of Tools.h++ was only available to
programs that were compiled for the classic C++ run time (-AP). To use this library with -AA, link with -lrwtool_v2.
The transition link from /usr/bin/cc may
be removed in the future. Therefore, HP recommends that you include
the contents of the /etc/PATH file in the
PATH variable of your shell.
The HP aC++ header files are now delivered as part of the HP-UX
11i v1.6 and higher operating systems. This is done to facilitate
users who wish to use the GNU compiler (gcc)
without installing the HP aC++ compiler.
For more information on HP aC++, go to:
http://www.hp.com/go/hpc++
HP C/ANSI C developer’s bundle |
 |
The C compiler on HP-UX 11i v1 is a separate product from the C++
compiler. The compiler supports both ANSI C (C89) and K&R
dialects as well as partial C99 compiliance. For detailed
documentation on the compiler, go to:
http://docs.hp.com/hpux/dev/index.html#c
For information on the HP C/ANSI C developer’s bundle, go to:
http://www.hp.com/go/ansic
Java 2 platform |
 |
The Java 2 Standard Edition (J2SE) products for HP-UX 11i provide
solutions to develop and deploy Java applications with the best
performance on HP servers and workstations. As a Java licensee, the
HP releases of updated SDKs closely follow the releases of new
versions of the SDK by Sun Microsystems. The latest Java 2 release
for HP-UX 11i v2 at the time of this writing is SDK Version
1.4.2.03, which supports the HotSpot virtual machine and includes
the Run Time Environment (RTE).
The default virtual machine (VM) for Java on the HP platforms is
32-bit VM. You can enable the 64-bit Hotspot VM using the -d64 flag on the command line. This option is not
available on Java versions prior to 1.4.1.
For current information on the latest Java SDK and RTE releases
as well as Java development tools, browser plug-ins, and
enhancements on HP platforms, go to:
http://www.hp.com/go/java
FORTRAN |
 |
The FORTRAN compiler for HP-UX 11i v2 is HP Fortran, which
conforms to the Fortran 95 (ISO/IEC 1539-1997) language standard. It
leverages the Edinburgh Portable Compiler (EPC) f90 frontend and
supports the full OpenMP V2.0 language standard.
The HP Fortran compiler provides a common source base for all
HP-UX 11i v2 operating systems, and supports user directives to
guide explicit data prefetching, compile-time inlining, and common
math library functions. The compiler is complemented by the
high-performance math run-time library and a linear algebra package
(assembly coded). It is validated against all major Mechanical
Computer Aided Engineering (MCAE) applications.
HP Fortran Version 2.7 for HP-UX 11i v2 contains
performance-tuning enhancements. To display the product number and
the release version of your HP Fortran compiler, enter the what command:
% what /opt/fortran90/bin/f90
/opt/fortran90/bin/f90:
HP F90 v2.7
HP-UX f90 B.11.23.%58 (Itanium-based host and target)
Wed Jan 15 13:07:14 2003 CST |
To read the online release notes for HP Fortran, go to:
http://docs.hp.com/hpux/dev/index.html#Fortran
They are also available in the /opt/fortran90/newconfig/RelNotes/ directory.
For information on HP Fortran for HP-UX 11i, go to:
http://www.hp.com/go/fortran
COBOL |
 |
Micro Focus provides a native COBOL compiler, Micro Focus Server
Express V2.2, for HP-UX 11i and HP-UX 11i v2. Existing applications
compiled with Server Express for other UNIX platforms can be made
available on HP-UX without source code modification. For product
information, go to:
http://www.microfocus.com/
Acucorp, Inc., an international provider of legacy extension
solutions for COBOL applications, provides support for Sun Solaris
and HP-UX 11i with their Extend Product Suite. The object files
produced by ACUCOBOL-GT are 100 percent portable across all
platforms.
For more information on the Acucorp COBOL product offferings, go
to:
http://www.acucorp.com/
For more information on COBOL for HP releases, go to:
http://www.hp.com/go/cobol
On HP-UX 11i, the /usr/include/ and /opt/aCC/include*/ paths contain the primary
header file trees. By default, these paths are searched by the C and
C++ compilers. The aCC software package is optional. It includes the
-fast option that selects the optimum
combination of compilation options for speed.
Table 2-3,
“Header file paths” lists the header file paths and their
descriptions.
Table 2-3. Header file paths
| Path |
Description |
| /usr/include |
The system’s general-use C and C++ include files |
| /usr/include/X11R6/ |
X11 Release 6 |
| /usr/include/Motif2.1/ |
Motif Version 2.1 |
| /opt/aCC/include*/ |
HP aC++ include files (automatically searched by HP aC++)
|
| /opt/ansic/include*/ |
The ANSI C include files for HP-UX 11i v1
only |
System libraries are usually kept in the /usr/lib path. When dynamically linking, the
linker uses the .sl, or shared libraries.
Shared libraries are versioned with a numerical suffix. The .sl library is typically a link to the latest
library version. The /usr/lib directory
contains links to the development versions of the X11 and Motif
libraries. To link with Motif 2.1 and/or X11 R6, the only link path
you need is -L/usr/lib. Table 2-4,
“64-Bit library paths” and Table 2-5,
“32-Bit library paths” list the library paths and their
descriptions for 64- and 32-bit library paths, respectively.
Table 2-4. 64-Bit library paths
| Path |
Description |
| /usr/lib/hpux64/ |
System libraries |
| /usr/lib/hpux64/X11R6/ |
Current X11 Release 6 libraries |
| /usr/lib/hpux64/Motif2.1/ |
X11 Motif libraries |
| /opt/langtools/hpux64/lib/ |
Language tools libraries |
| /usr/ccs/lib/hpux64/ |
Compiler
libraries |
Table 2-5. 32-Bit library paths
| Path |
Description |
| /usr/lib/hpux32/ |
System libraries |
| /usr/lib/hpux32/X11R6/ |
Current X11 Release 6 libraries |
| /usr/lib/hpux32/Motif2.1/ |
X11 Motif libraries |
| /opt/langtools/hpux32/lib/ |
Language tools libraries |
| /usr/ccs/lib/hpux32/ |
Compiler
libraries |
You may obtain HP-UX patches in several different ways:
-
Research and download patches according to
your own personal patch management strategy by using HP’s Patch
Management tools available from the IT Resource Center (ITRC):
http://www1.itrc.hp.com/
Choose proven patches for stability, new
patches for cutting-edge functionality, or HP’s highest rated
patches.
-
The Extension SoftWare (XSW) CD-ROMs. These
CD-ROMs are distributed regularly. They contain bundles for each
of the hardware operating system releases currently supported. The
bundles are updated at regular intervals to keep pace with the
current patches available. Whenever such an update happens all the
patches in the bundle undergo extensive coexistence testing.
http://www1.itrc.hp.com/
-
The HP Enterprise Response Centers provide
HP-UX 11i patches that are tailored by engineers assisting you in
solving problems. You must have a support agreement with HP to use
the Response Centers.
When installing software on your HP-UX 11i system, be sure to
read the release notes for each software component you install, and
verify that the recommended and required patches are installed.
Software packages currently installed on a system can be listed
using /usr/sbin/swlist. Check the
patch-related manpages for more information: swlist(1M), swinstall(1M), and swremove(1M).
For a document describing HP’s patching process for HP-UX 11i, go
to:
http://devresource.hp.com/drc/STK/docs/archive/hpuxpatching.jsp
Chapter 3. C
and C++ compilers
Both Sun and HP provide C and C++ compilers in an optional
software package that can be purchased from the respective
companies. By default, the optional compilers for Solaris are
installed under /opt/SUNWspro/bin and the
optional compilers for HP-UX are installed under /opt/aCC/bin. The information in this chapter
refers to these compilers rather than the BSD Compatibility Package
C compiler on Solaris and the bundled C complier or the ANSI C
compiler on HP-UX.
This chapter discusses porting considerations for the C and C++
compilers available for Solaris 8 and HP-UX 11i v2. The HP-UX 11i v2
compilers all generate 32-bit objects by default so it will be to
use the +DD64 compiler option to build a
64-bit program.
Both Sun and HP C compilers support the ANSI C (ANSI/ISO
9899-1990) standard. Write your code in strict conformance with ANSI
C whenever possible to provide the greatest level of portability,
and the most consistent behavior across all platforms.
The C compiler on Solaris and the C compiler on HP-UX can
generate either 32-bit ELF objects or 64-bit ELF objects. The
default on both operating systems is 32-bit ELF objects. On HP-UX,
use the +DD64 compiler option when compiling
64-bit applications.
For more information on the HP C compiler, refer to the HP
ANSI C Online Help and Release Notes:
http://docs.hp.com/hpux/dev/index.html#C
For more information on the compilers, refer to the aCC/cc(1) man page.
Language differences |
 |
The HP-UX 11i C compiler, in its default mode (-Ae), supports ANSI C with HP extensions. The Sun C
compiler, in its default mode, supports ANSI C plus K&R C
compatibility extensions. This means that ANSI C is not strictly
enforced in the default mode. If you use the Solaris -Xa option or no option, the degree of compliance
in your code with the ANSI standard may vary. If there are K&R C
extensions in your code, you have at least two possible
strategies:
-
On Solaris, try compiling with the -Xc option of the Sun compiler to see how many
potential problems exist when converting to strict ANSI C.
-
On HP-UX 11i, try compiling with the HP ANSI
C compiler in its default mode (non-Strict ANSI C).
If the Sun C compiler is invoked in strict ANSI
mode with the -Xs option, the HP C compiler
should be invoked with the corresponding -Ae
option.
Default behavior |
 |
The default behavior of each compiler differs slightly. Table 3-1,
“Compiler behavior differences” lists several behaviors that are
the default on one compiler, but require an option on the other
compiler.
Table 3-1. Compiler behavior
differences
| Description |
Sun cc Option |
HP cc Option |
| Built-in path for dynamic library lookup uses $LD_LIBRARY_PATH |
Default |
Default |
| Built-in path for dynamic library lookup ignores $LD_LIBRARY_PATH |
-i |
+noenvvar |
| Build the executable for the generic platform |
Default |
Default |
| Build the executable for the current platform |
-native |
+DSnative |
| Do not perform automatic loop parallelization |
Default |
+Onoautopar |
| Perform automatic loop parallelization |
-xparallel |
Default[a] |
C compiler options |
 |
Table 3-2,
“Solaris and HP-UX C compiler options” provides quick references
for comparing HP and Sun C version 5.5 compiler options.
Table 3-2. Solaris and HP-UX C compiler
options
| Solaris cc Option |
HP-UX cc Option |
Description |
| -# |
-v |
Shows each invoked component |
| -### |
none |
Shows each invoked component; does not execute |
| -Aname[(tokens)] |
Not applicable |
Associates name with tokens |
| -Bstatic |
|
Searches static libraries |
| -Bdynamic |
|
Searches dynamic libraries |
| -C |
Same |
Prevents the preprocessor from removing comments |
| -c |
Same |
Produces a .o file only |
| -Dname[=tokens] |
Same |
Defines a symbol |
| -dy |
-Wl, -dynamic |
Specifies dynamic linking (default) |
| -dn |
-Wl, -noshared |
Specifies static linking |
| -dalign |
Not applicable |
Generates double-word load/store instructions |
| -E |
Same |
Preprocess only |
| -erroff=t |
-wn |
Suppresses cc warning
messages |
| -errtags=[yes|no] |
Not applicable |
Shows message tags |
| -fast |
Same |
Selects the optimum combination of compilation options for
speed.
All of the following Solaris options are set when using the
-fast option:
| -native |
| -xO2 |
| -xlibmil |
| -nofstore |
| -dalign |
| -fsimple=1 |
| -fns |
| -ftrap=%none |
| -O | |
| -fd |
-M0 |
Reports old-style function definitions |
| -flags |
+help |
Prints a summary of each compiler option |
| -fnonstd |
+FPVZO |
Hardware trap FPEs; equivalent to -fns
-trap=common |
| -fns |
Not applicable |
Turns on SPARC nonstandard floating-point mode |
| -fprecision=p |
Not applicable |
Initializes rounding precision mode bits (5.x) |
| -fround=r |
See fesetround(3M) |
Sets FP rounding mode |
| -fsimple[=n] |
Not applicable |
FP optimization |
| -fsingle |
Not applicable |
FP optimization |
| -fstore |
Not applicable |
FP optimization (x86 only) |
| -ftrap=t |
| -ftrap=common |
| -fns | |
|
Sets the IEEE 754 trapping mode |
| -G |
Use ld -b |
Creates a shared object |
| -g |
Same |
Generates debug info |
| -H |
-Wp,-h |
Prints header files |
| -h name |
Use ld +h name |
Names a shared library (for versioning) |
| -Idir |
Same |
Specifies an include file |
| -i |
Default -Wl,+s |
Ignores LD_LIBRARY_PATH |
| -keeptmp |
None |
Retains temporary files |
| -KPIC |
+Z |
Produces position-independent code |
| -Kpic |
+z |
Produces position-independent code |
| -Ldir |
Same |
Specifies a library search directory |
| -lname |
Same |
Loads a library |
| -mc |
None |
Removes duplicate strings from the .comment section |
| -misalign |
+u1 |
Assumes only byte alignment |
| -misalign2 |
+u2 |
Assumes only half-word alignment |
| -mr[,string] |
None |
Removes all strings from the .comment section, (and inserts string) |
| -mt |
Same |
Multithreaded; equivalent to: -D_REENTRANT -lthread |
| -native |
+DSnative |
Generates code for native hardware |
| -nofstore |
Not applicable |
FP optimization |
| -noqueue |
Not applicable |
Does not queue if a license is not available |
| -O |
Same |
Same as -xO2 |
| -o file |
Same |
Output file filename |
| -P |
Same |
Preprocess only; no line numbers |
| -p |
Same |
Profile with prof(1) |
| -Q[y|n] |
None |
Print identification information for each tool
invoked |
| -qp |
-p |
Profile with prof(1) |
| -Rdir[:dir] |
-Wl,+b,dir[:dir] |
Run-time library search path |
| -S |
Same |
Produces an assembly source file |
| -s |
Same |
Removes symbolic debugging information |
| -Uname |
Same |
Undefines a symbol |
| -V |
Same |
Prints the name and version ID of each pass |
| -v |
None |
Performs stricter semantic checks |
| -Wc,arg |
Same |
Hands off an argument to a specified component |
| -w |
Same |
Suppresses compiler warning messages |
|
(strictest
ANSI) |
|
Specifies the degree of ANSI compliance |
| -x386 |
Not applicable |
(x86 only) |
| -x486 |
Not applicable |
(x86 only) |
| -xa |
Not applicable |
Profile with tcov(1) |
| -xarch=a |
DAarchitecture |
Limits the set of instructions the compiler may use |
| -xautopar |
+Oautopar (default) |
Automatically parallelizes for multiple processors |
| -xcache=c |
Not applicable |
Defines cache properties for optimizer |
| -xCC |
None |
Accepts C++-style comments |
| -xcg89 |
DAarchitecture |
-xcg89 is a macro for
|
| -xcg92 |
DAarchitecture |
-xcg92 is a macro for
| -xarch=v8 |
| -xchip=super |
| -xcache=... | |
| -xchip=c |
DAarchitecture |
Specifies the target processor for the optimizer |
| -xdepend |
Not applicable |
Performs loop dependency analysis |
| -xe |
Default at +O2 and above |
Checks syntax and semantics only |
| -xexplicitpar |
| -xautopar |
| -xexplicitpar | (only) |
| +Oautopar |
| (default) |
| +Onoautopar | |
Parallelizes code based on #pragmas |
| -xF |
Not applicable |
Prepares for performance analysis using
analyzer(1) |
| -xhelp=f |
+help |
Displays online help information |
| -xild[off|on] |
Not applicable |
Turns the incremental linker off (on) |
| -xinline=[f1,...,fn] |
+Oinline=[f1,...,fn] |
Inlines the listed functions |
| -xinline= |
+Onoinline |
Does not inline functions |
| -xlibmieee |
None |
Forces IEEE 754-style return values |
| -xlibmil |
+Olibcalls |
Inlines some library routines |
| -xlic_lib=l |
Not applicable |
Links with a licensed Sun library (5.x) |
| -xlicinfo |
Not applicable |
Returns licensing information |
| -xloopinfo |
+Oreport=loop |
Shows which loops are parallelized and which are not |
| -xM[1] |
Use makedepend(1) |
Generates makefile dependencies |
| -xMerge |
None |
Directs the compiler to merge the data segment with the
text segment for assembler |
| -xmaxopt=n |
Not applicable |
Limits the level of #pragma opt
(5.x) |
| -xnolib |
None |
Does not link any default libraries |
| -xnolibmil |
None |
Resets -fast to not include inline
templates |
| -xO[1|2|3|4|5] |
+O[0|1|2|3|4] |
Specifies the optimization level |
| -xP |
None |
Prints prototypes for all K&R C functions |
| -xparallel |
+Oparallel |
Parallelizes loops both automatically and as explicitly
specified by the programmer |
| -xpentium |
Not applicable |
(x86 only) |
| -xprefetch[=yes|=no] |
+O[no]dataprefetch |
Generates data prefetch instructions (5.x) |
| -xpg |
-G |
Profiles with gprof(1) |
| -xprofile=collect |
+Oprofile=collect |
Collects data for a profile. This option is used with the
-xprofile=use[:name] option. |
| -xprofile=use[:name] |
+Oprofile=usefilename |
Uses a profile to optimize the program. This option is
used with the -xprofile=collect
option. |
| -xprofile=tcov |
None |
Produces a test coverage analysis of a compiled
program. |
| -xreduction |
Not applicable |
Turns on reduction recognition during automatic
parallelization |
| -xregs=r |
Not applicable |
Specifies the usage of registers |
| -xrestrict=f |
None |
Treats pointer-valued function parameters as restricted
pointers |
| -xs |
Not applicable |
Disables auto-read for dbx |
| -xsafe=mem |
Not applicable |
Allows the compiler to assume that no memory-based traps
occur |
| -xsb |
None |
Generates symbol table information for SourceBrowser |
| -xsbfast |
None |
Same as -xsb, but does not compile
code |
| -xsfpconst |
Not applicable |
FP optimization |
| -xspace |
+Osize |
Does no optimizations that increase code size |
| -xstrconst |
Default |
Inserts string literals into the text segment |
| -xtarget=t |
+DAarchitecture |
Specifies the target system for instruction set and
optimization |
| -xtemp=dir |
Use $TMPDIR |
Sets the temporary directory |
| -xtime |
Use time(1) |
Reports execution time for each component |
| -xtransition |
-M0 |
Issues warnings for K&R C and Sun ANSI C
differences |
| -xunroll=n |
+Oloop_unroll=n |
Specifies loop unrolling level |
| -xvpara |
Not applicable |
Warns about loops that have #pragma
MP directives |
| -Yc,
dir |
None |
Specifies a new directory dir for the location of
component c |
| -YA, dir |
None |
Sets default search directory for components |
| -YI, dir |
-Idir |
Sets default search directory for include files |
| -YP, dir |
-Ldir |
Sets default search directory for libraries |
| -YS, dir |
-Ldir |
Sets default search directory for startup objects |
| -Zll |
Not applicable |
Creates the program database for lock_lint |
| -Zlp |
Not applicable |
Profiles with looptool(1) |
| -Ztha |
Not applicable |
Profiles with Thread Analyzer
(4.x) |
C compiler options equivalent |
 |
Table 3-3,
“Solaris cc options and their HP-UX equivalent” lists the
Solaris and HP-UX cc options that are the
same, the Solaris cc options that have no
HP-UX equivalent, and the Solaris cc options
that are not required or needed.
Table 3-3. Solaris cc options and their
HP-UX equivalent
| Solaris cc Option |
Description |
HP-UX cc Option Equivalent |
| -### |
Shows each invoked component, but does do not execute
them |
No equivalent |
| -Aname[(tokens)] |
Associates name with tokens |
Not required or needed |
| |
|
|
| -C |
Prevents preprocessor from removing comments |
Same |
| -c |
Produces a .o file only |
Same |
| -dalign |
Generates double-word load/store instructions |
Not required or needed |
| Dname[=tokens] |
Defines a symbol |
Same |
| |
|
|
| -E |
Preprocess only |
Same |
| -errtags=[yes|no] |
Shows message tags |
Not required or needed |
| |
|
|
| -fast |
Equivalent to:
| -native |
| -xO2 |
| -xlibmil |
| -xlibmil |
| -nofstore |
| -dalign |
| -fsimple=1 |
| -fns |
| -ftrap=%none |
| -O | |
No equivalents |
| -fns |
Turns on SPARC nonstandard floating-point mode |
Not required or needed |
| -fprecision=p |
Initializes rounding precision mode bits (5.x) |
Not required or needed |
| -fsimple[=n] |
Floating point optimization |
Not required or needed |
| -fsingle |
Floating point optimization |
Not required or needed |
| -fstore |
Floating point optimization (x86 only) |
Not required or needed |
| |
|
|
| -g |
Generates symbol table information for the debugger |
Same |
| -Idir |
Specifies an include file |
Same |
| -keeptmp |
Retains temporary files instead of deleting them |
No equivalent |
| |
|
|
| -Ldir |
Specifies a library search directory |
Same |
| -lname |
Loads library |
Same |
| -mc |
Removes duplicate strings from the .comment section |
No equivalent |
| -mr[,string] |
Removes all strings from the .comment section, [and inserts string] |
No equivalent |
| -nofstore |
Floating point optimization |
Not required or needed |
| -noqueue |
Does not queue if a license is not available |
Not required or needed |
| |
|
|
| -O |
Same as -xO2 |
Same |
| -o filename |
Output file filename |
Same |
| -P |
Preprocess only; no line numbers |
Same |
| -p |
Profiles with prof(1) |
Same |
| -Q[y|n] |
Prints identification information for each tool invoked |
No equivalent |
| -S |
Produces an assembly source file |
Same |
| -s |
Removes symbolic debugging information |
Same |
| -Uname |
Undefines a symbol |
Same |
| -V |
Prints the name and version ID of each pass |
Same |
| -v |
Performs stricter semantic checks |
Same |
| -v |
Performs stricter semantic checks |
No equivalent |
| -Wc,arg |
Hands off an argument to a specified component |
Same |
| -w |
Suppresses compiler warning messages |
Same |
| -x386 |
(x86 only) |
Not required or needed |
| -x486 |
(x86 only) |
Not required or needed |
| -xa |
Profiles with tcov(1) |
Not required or needed |
| -xcache=c |
Defines cache properties for the optimizer |
Not required or needed |
| -xCC |
Accepts C++-style comments |
No equivalent |
| -xe |
Checks syntax and semantics only |
No equivalent |
| -xdepend |
Performs loop dependency analysis |
Not required or needed |
| -xF |
Prepares for performance analysis using
analyzer(1) |
Not required or needed |
| -xild[off|on] |
Turns the incremental linker off (on) |
Not required or needed |
| -xlibmieee |
Forces IEEE 754-style return values |
No equivalent |
| -xlic_lib=l |
Links with a licensed Sun library (5.x) |
Not required or needed |
| -xlicinfo |
Returns licensing information |
Not required or needed |
| -xmaxopt=n |
Limits the level of #pragma opt
(5.x) |
Not required or needed |
| -xMerge |
Directs the compiler to merge the data segment with the
text segment for assembler |
No equivalent |
| -xnolib |
Does not link any default libraries |
No equivalent |
| -xnolibmil |
Resets -fast to not include inline
templates |
No equivalent |
| -xP |
Prints prototypes for all K&R C functions |
No equivalent |
| -xpentium |
(x86 only) |
Not required or needed |
| -xrestrict=f |
Treats pointer-valued function parameters as restricted
pointers |
No equivalent |
| -xreduction |
Turns on reduction recognition during automatic
parallelization |
Not required or needed |
| -xregs=r |
Specifies the usage of registers |
Not required or needed |
| -xs |
Disables auto-read for dbx |
Not required or needed |
| -xsafe=mem |
Allows the compiler to assume that no memory-based traps
occur |
Not required or needed |
| -xsfpconst |
Floating point optimization |
Not required or needed |
| -xvpara |
Warns about loops that have #pragma
multiprocessor directives |
Not required or needed |
| -Yc,
dir |
Specifies a new directory dir for the location of
component c |
No equivalent |
| -YA, dir |
Sets the default search directory for components |
No equivalent |
| -Zll |
Creates the program database for lock_lint |
Not required or needed |
| -Zlp |
Profiles with looptool(1) |
Not required or needed |
| -Ztha |
Profiles with Thread Analyzer (4.x) |
Not required or needed |
The Sun and HP C++ compilers both support the ANSI/ISO/IEC
14882-1998 standard. Write your code to be in strict conformance
with ANSI C++ whenever possible to provide the greatest level of
portability, and the most consistent behavior across all
platforms.
For more information on the HP C++ compiler, refer to the HP
aC++ Programmer’s Guide and Release Notes. Go to the
documentation link on the HP aC++ Home Page:
http://www.hp.com/go/hpc++
Language differences |
 |
The Sun and HP C++ compilers both support ANSI C++ in their
default modes. For HP aC++, use the -Aa
option to enable ANSI C++ standard features like Koenig lookup and
standard scoping rules for variables declared in conditional
statements like for loops.
If the -compat=4 option is used, or Sun C++
compiler Version 4.x is used, no corresponding compatibility mode
exists on the HP aC++ compiler, and changes to the code may have to
be made.
Default behavior |
 |
The default options for each compiler differ slightly. The most
notable differences are the same as those for the C compilers (see
Table 3-1,
“Compiler behavior differences”).
C++ compiler options |
 |
Table 3-4,
“Sun and HP C++ compiler options” provides a quick reference
that compares the HP and Sun C++ compiler options. The C++ compiler
for HP-UX is aCC; the C++ compiler for Solaris is CC.
Table 3-4. Sun and HP C++ compiler
options
| Solaris CCOption |
HP aCC Option |
Description |
| -386 |
Not applicable |
(x86 only) |
| -486 |
Not applicable |
(x86 only) |
| -a |
None |
Profiles with tcov(1); same as -xa |
| -Bstatic |
|
Searches static libraries |
| -Bdynamic |
|
Searches dynamic libraries |
| -c |
Same |
Produces a .o file only |
| -cg[89|92] |
+DAarchitecture |
Same as -xcg[89|92] |
|
|
None |
Sets the major release compatibility mode of the compiler
(5.x) |
| +d |
Same |
Prevents the compiler from expanding inline
functions |
| Dname[=def] |
Same |
Defines a symbol |
| -dy |
|
Specifies dynamic linking (default) |
| -dn |
|
Specifies static linking |
| -dalign |
Not applicable |
Generates double-word load/store instructions |
| -dryrun |
+dryrun |
Displays the options passed, but does not execute |
| -E |
Same |
Preprocess only |
| +e[0|1] |
None |
Controls virtual table generation |
| -fast |
Same |
Equivalent to:
| -native |
| -xO2 |
| -xlibmil |
| -nofstore |
| -dalign |
| -fsimple=1 |
| -fns |
| -ftrap=%none |
| -O | |
| -features |
None |
Enables/disables various C++ language features (5.x) |
| -flags |
+help |
Prints a summary of each compiler option |
| -fnofma |
Not applicable |
(PowerPC only) |
| -fnonstd |
-Wl,+FPVZO |
Hardware trap FPEs, equivalent to:
|
| -fns |
Not applicable |
Turns on SPARC nonstandard floating-point mode |
| -fround=r |
See fesetround(3M) |
Sets FP rounding mode |
| -fsimple |
Not applicable |
FP optimization |
| -fstore |
Not applicable |
FP optimization (x86 only) |
| -ftrap=t |
| -ftrap=common
-fns | |
|
Sets the IEEE 754 trapping mode |
| -G |
-b |
Creates a shared object |
| -g |
-g +b |
Generates debug info, disables inlining |
| -g0 |
-g |
Generates debug information but does not disable
inlining |
| -H |
-Wp,-h |
Prints header files |
| -help |
+help |
Same as -flags |
| -hname |
use ld +h name |
Names a shared library (for versioning) |
| -iUse LD_LIBRARY_PATH: |
Default -Wl,+s |
Ignores LD_LIBRARY_PATH |
| -inline=rlst |
None |
Inline functions listed in rlst |
| -instance=a |
None |
Controls template instances (5.x) |
| -Ipathname |
Same |
Specifies an include directory |
| -keeptmp |
None |
Retains temporary files |
| -KPIC |
+Z |
Produces position-independent code |
| -Kpic |
+z |
Produces position-independent code |
| -Ldir |
Same |
Specifies a library search directory |
| -llib |
Same |
Loads a library |
| -libmieee |
None |
Forces IEEE 754–style return values |
| -libmil |
+Olibcalls |
Inlines some library routines |
| -library=l[,...l] |
Use -ll |
Loads CC libraries (5.x) |
| -migration |
Not applicable |
Explains where to get information about migrating code to
C++ 5.0 |
| -misalign |
+u1 |
Assumes only byte alignment |
| -mt |
| -D_POSIX_C_SOURCE=199506L |
| -D_REENTRANT |
| -lpthread | |
Multithreaded, changes some libraries and passes -D_REENTRANT |
| -native |
Default |
Generates code for native hardware |
| -nocx |
Not applicable |
Does not link with -lcx (4.2 only)
|
| -noex |
+noeh |
Does not generate code that supports C++ exceptions |
| -nofstore |
Not applicable |
FP optimization |
| -nolib |
None |
Does not link any default libraries |
| -nolibmil |
None |
Resets -fast to not include inline
templates |
| -noqueue |
Not applicable |
Does not queue if a license is not available |
| -noqueue |
Not applicable |
Does not queue if a license is not available |
| -norunpath |
Use chatr +b disable file |
Does not build shared library path into the
executable |
| -O[1|2|3|4|5] |
+O[1|2|3|4] |
Specifies optimization level |
| -o file |
Same |
Outputs file filename |
| +p |
-DNDEBUG |
Disables assert statements |
| -P |
Same |
Preprocesses only, no line numbers |
| -p |
None |
Profiles with prof |
| -pentium |
Not applicable |
(x86 only) |
| -pg |
-G |
Profiles with gprof |
| -PIC |
+Z |
Produces position-independent code |
| -pic |
+z |
Produces position-independent code |
| -pta |
None |
Instantiates whole template classes |
| -ptipath |
-Ipath |
Specifies search directory for template source |
| -pto |
None |
Instantiates generated templates in the compilation
unit |
| -ptrdatabase-path |
None |
Specifies the template build repository directories |
| -ptv |
+inst_v |
Turns on the verbose or verify mode |
| -Qoption|-qoption] p o |
Not applicable |
Similar to -Wc,a -tx |
| -qp |
-p |
Same as the -p option |
| -qproduce |
[-E|-c|-S] |
Specifies compilation intermediate |
| -R: (-xMerge) |
-N |
Merges the data segment with the text segment |
| -readme |
+help |
Displays the README file |
| -R pathname |
-Wl,+b,dir[:dir] |
Run-time library search path |
| -S |
Same |
Produces an assembly source file |
| -s |
Same |
Removes symbolic debugging information |
| -sb |
None |
Generates symbol table information for SourceBrowser |
| -sbfast |
None |
Same as -sb, but does not compile
code |
| -staticlib=l[,...l] |
Use -Wl,-nosharedy -nocode |
Statically links CC libraries (5.x) |
| -temp=dir |
Use $TMPDIR |
Sets the temporary directory |
| -template=wholeclass |
None |
Enables/disables template options (5.x) |
| -time |
+time |
Reports execution time for each component |
| -Uname |
Same |
Undefines a symbol |
| -unroll=n |
+Oloop_unroll=n |
Specifies loop unrolling level |
| -V |
Same |
Prints the name and version ID of each pass |
| -v |
Same |
Enables verbose mode |
| -vdelx |
None |
use _vector_deletex_ (5.x) |
| -v |
Same |
Enables verbose mode |
| -verbose=v[,...v] |
| -verbose=template |
| -verbose=diags |
| -verbose=version |
| -verbose=all | |
| +inst_v |
| -v |
| -V |
| +inst_v |
| -v |
| -V | |
Controls compiler verbosity (5.x); verbose template output
same as -v same as -V |
| +w |
Same |
Warns about all questionable constructs |
| +w2 |
Not applicable |
Prints even more warnings (5.x) |
| -w |
Same |
Suppresses compiler warning messages |
| -x601 |
Not applicable |
(PowerPC only) |
| -x603 |
Not applicable |
(PowerPC only) |
| -x604 |
Not applicable |
(PowerPC only) |
| -xa |
Not applicable |
Profiles with tcov |
| -xar |
None |
Creates archive libraries; adds templates to archive as
needed |
| -xarch=a |
+DAarchitecture |
Limits the set of instructions the compiler may use |
| -xcache=c |
Not applicable |
Defines cache properties for the optimizer |
| -xcg89 |
+DAarchitecture |
-xcg89 is a macro for:
| -xarch=v7 |
| -xchip=old |
| -xcache=... | |
| -xcg92 |
+DAarchitecture |
-xcg92 is a macro for:
| -xarch=v8 |
| -xchip=super |
| -xcache=... | |
| -xchip=c |
+DAarchitecture |
Specifies the target processor for optimizer |
| -xcode=a |
Not applicable |
Specifies the code address space (5.x) |
| -xF |
Not applicable |
Prepares for performance analysis using analyzer |
| -xhelp=flags |
+help |
Same as -help |
| -xild[off|on] |
Not applicable |
Turns the incremental linker off (on) |
| -xinline=rlst |
None |
Inlines the functions listed by rlst |
| -xlibmieee |
None |
Forces IEEE 754-style return values |
| -xlibmil |
+Olibcalls |
Inlines some library routines |
| -xlibmopt |
None |
Uses optimized math libraries |
| -xlic_lib=l[,...l] |
Not applicable |
Links with a licensed library |
| -xlicinfo |
Not applicable |
Returns licensing information |
| -Xm |
None |
Allows the use of the $ character in identifier
names |
| -xM[1] |
+M |
Generates makefile dependencies |
| -xMerge |
-N |
Merges data segments into text segments |
| -xnolib |
None |
Does not link any default libraries |
| -xnolibmil |
None |
Resets -fast to not include inline
templates |
| -xnolibmopt |
None |
Resets -fast and does not use the
optimized math library (5.x) |
| -xOlevel |
+O[0|1|2|3|4] |
Specifies optimization level |
| -xpg |
-G |
Profiles with gprof |
| -xprefetch[=yes|=no] |
+O[no]dataprefetch |
Generates data prefetch instructions (5.x) |
| -xprofile=collect |
| -xprofile=use[:name] |
| -xprofile=tcov | |
| +Oprofile=collect |
| +Oprofile=use[filename] |
| None | |
Collects data for a profile or uses a profile to
optimize |
| -xregs=r |
Not applicable |
Specifies the usage of registers |
| -xs |
Not applicable |
Disables auto-read for dbx |
| -xsafe=mem |
Not applicable |
Allows the compiler to assume that no memory-based traps
occur |
| -xsb |
None |
Generates symbol table information for SourceBrowser |
| -xsbfast |
None |
Same as -xsb but does not compile
code |
| -xspace |
+Osize |
Does no optimizations that increase code size |
| -xtarget=t |
+DAarchitecture |
Specifies the target system for the instruction set and
optimization |
| -xtime |
+time |
Reports execution time for each component |
| -xtransition |
-M0 |
Issues warnings for K&R C and Sun ANSI C
differences |
| -xunroll=n |
+Oloop_unroll=n |
Specifies loop unrolling level |
| -xwe |
+We nnn[,nnn] |
Converts warnings to errors |
| -Ztha |
Not applicable |
Profiles with Thread Analyzer (4.x) |
| -ztext |
Not applicable |
Forces fatal errors for remaining
relocations |
Table 3-5. Sun C++ options and HP-UX aCC
equivalents
| Solaris cc Option |
HP aCC Option |
Description |
| -# |
-v |
Shows each invoked component |
| -Bstatic |
|
Searches static libraries |
| -Bdynamic |
|
Searches dynamic libraries |
| -dy |
|
Specifies dynamic linking (default) |
| -dn |
|
Specifies static linking |
| -erroff=t |
-wn |
Suppresses C++ warning messages |
| -fd |
--M0 |
Reports old-style function definitions |
| -flags |
+help |
Prints a summary of each compiler option |
| -fnonstd |
-Wl,+FPVZO |
Hardware trap FPEs, equivalent to -fns-trap=common |
| -fround=r |
See fesetround |
Sets FP rounding mode |
| -ftrap=t |
| -ftrap=common |
| -fns | |
|
Sets the IEEE 754 trapping mode |
| -G |
Use ld -b |
Creates a shared object |
| -H |
-Wp,-h |
Prints header files |
| -hname |
Use ld +h name |
Names a shared library (for versioning) |
| -i |
Default |
Ignores LD_LIBRARY_PATH |
| -KPIC |
+Z |
Produces position-independent code |
| -Kpic |
+z |
Produces position-independent code |
| -misalign |
+u1 |
Assumes only byte alignment |
| -misalign2 |
+u2 |
Assumes only half-word alignment |
| -mt |
| -D_POSIX_C_SOURCE=199506L |
| -D_REENTRANT |
| -lpthread | |
Multithreaded; changes some libraries and passes -D_REENTRANT |
| -native |
Default |
Generates code for native hardware |
| -qp |
-p |
Same as the -p option |
| -R pathname |
-Wl,+b,dir[:dir] |
Run-time library search path |
| --X[a|c|s|t] |
-A[a|c|e] |
Specifies degree of ANSI compliance |
| -Xc |
-Aa |
Strict ANSI compliance |
| -xarch=a |
+DAarchitecture |
Limits the set of instructions that the compiler may
use |
| -xautopar |
+Oautopar (default) |
Automatically parallelizes for multiple processors |
| -xcg89 |
+DAarchitecture |
-xcg89 is a macro for:
| -xarch=v7 |
| -xchip=old |
| -xcache=... | |
| -xcg92 |
+DAarchitecture |
-xcg92 is a macro for:
| -xarch=v8 |
| -xchip=super |
| -xcache=... | |
| -xchip=c |
+DAarchitecture |
Specifies target processor for optimizer |
|
|
+Oautopar (default) |
Parallelizes code both explicitly and automatically |
| -xexplicitpar |
+Onoautopar |
Parallelizes code based on #pragmas
only |
| -xhelp=flags |
+help |
Same as -help |
| -xild[off|on] |
Not applicable |
Turns the incremental linker off (on) |
| -xinline=rlst |
None |
Inlines functions listed by rlst |
| -xlibmieee |
None |
Forces IEEE 754-style return values |
| -xlibmil |
+Olibcalls |
Inlines some library routines |
| -xlibmopt |
None |
Uses optimized math libraries |
| -xlic_lib=l[,...l] |
Not applicable |
Links with a licensed library |
| -xlicinfo |
Not applicable |
Returns licensing information |
| -Xm |
None |
Allows use of the $ character in identifier names |
| -xM[1] |
+M |
Generates makefile dependencies |
| -xMerge |
-N |
Merges data segments into text segments |
| -xnolib |
None |
Does not link any default libraries |
| -xnolibmil |
None |
Resets -fast to not include inline
templates |
| -xnolibmopt |
None |
Resets -fast, and does not use the
optimized math library (5.x) |
| -xOlevel |
+O[0|1|2|3|4] |
Specifies the optimization level |
| -xpg |
-G |
Profiles with gprof |
| -xprefetch[=yes|=no] |
+O[no]dataprefetch |
Generates data prefetch instructions. (5.x) |
| -xprofile=collect |
| -xprofile=use[:name] |
| -xprofile=tcov | |
| +Oprofile=collect |
| +Oprofile=use[:filename] |
| None | |
Collects data for a profile or use profile to
optimize |
| -xregs=r |
Not applicable |
Specifies the usage of registers |
| -xs |
Not applicable |
Disables auto-read for dbx |
| -xsafe=mem |
Not applicable |
Allows the compiler to assume that no memory-based traps
occur |
| -xsb |
None |
Generates symbol table information for SourceBrowser |
| -xsbfast |
None |
Same as -xsb but does not compile
code |
| -xspace |
+Osize |
Does no optimizations that increase code size |
| -xtarget=t |
+DAarchitecture |
Specifies the target system for the instruction set and
optimization |
| -xtime |
+time |
Reports execution time for each component |
| -xtransition |
-M0 |
Issues warnings for K&R C and Sun ANSI C
differences |
| -xunroll=n |
+Oloop_unroll=n |
Specifies loop unrolling level |
| -xwe |
+We nnn[,nnn] |
Converts warnings to errors |
| -Ztha |
Not applicable |
Profiles with Thread Analyzer (4.x) |
| -ztext |
Not applicable |
Forces fatal errors for remaining
relocations |
Templates |
 |
Template features of the HP and Sun C++ compilers are very
similar. Both allow template specializations and template arguments
to be omitted when the compiler can infer them. The default
instantiation mechanisms operate in a similar manner. Explicit
instantiation through a template declaration works the same.
However, there are a few differences that arise from differing
degrees of implementation of the ANSI standard.
Sun C++ 5.x recognizes the typename
keyword, but does not implement it or enforce its use. HP aC++
implements and enforces the use of this keyword.
In a template, a name with a parameter-dependent qualifier is not
taken to be a type unless it is explicitly declared as one with the
typename keyword. Because typename is not implemented by the Solaris
compiler, it may be used where it is not allowed, or may not be
present where required. The best way to fix typename problems when porting is to adhere to
the ANSI standard. This will provide the most robust code and allow
you to compile on both platforms.
You need to explicitly declare a type or a member function type
using the typename keyword when all of the
following are true:
-
The code is inside a template.
-
The name is qualified (that is, it has a :: token in it).
-
The qualifier to the left of the :: token depends on a template parameter.
If you are implementing a library that provides templates, you
may need to instantiate the whole template instead of just those
parts referenced. With the Sun C++ compiler, you do this through
explicit instantiation or through the -template=wholeclass command-line argument. With
the HP aC++ compiler, you do this through explicit
instantiation.
If you rely on a template repository, the template instantiation
mechanism on Solaris uses a repository. If you referred to a
template repository, or the directories Templates.DB, SunWS_cache,
SunWS_config, or specifically the file SunWs_config/CC_tmpl_opt or used CCadmin -clean to clear the repository, you will
not need to do this on HP-UX. Use explicit instantiation
instead.
Other template variations may include but are not limited to:
-
HP aC++ implements template members
-
Template partial specialization
-
Template partial ordering whereas the
Solaris C++ compiler may not
The HP aC++ compiler allows non-type template arguments in
accordance with the ANSI standard, but the Solaris C++ compiler
issues an error message
Exception handling |
 |
Exception handling is very similar, including the standard
exception classes. If you used -noex or -features=no%except on Solaris to disable exception
handling, use +noeh to disable exception
handling on HP-UX.
Other compiler issues |
 |
Sun C++ supports covariant return types on virtual functions. HP
aC++ does not support covariant return types with multiple
inheriting types. Future errors generated by the aC++ compiler
indicate code practices that are not ANSI compliant, or not yet
strictly enforced. Such errors indicate problems with the code that
will become compile-time errors when that portion of the ANSI
standard is enforced. These errors should be fixed.
The ANSI C standard specifies exactly which names (for example,
variable names, function names, type definition names) are reserved.
The intention is to make it easier to port programs from one
implementation to another without unexpected collisions in names.
For example, since the ANSI C standard does not reserve the open identifier, an ANSI C program may define and
use a function named open without colliding
with the open(2) system call in different
operating systems.
Name space implementation is very similar on both platforms.
HP header file and library implementation of
name spaces |
 |
The HP header files and libraries have been designed to support
several different name spaces. On HP-UX systems, five name spaces
are available:
-
UNIX 98
-
UNIX 95
-
XPG4
-
POSIX
-
ANSI C
The HP library implementation has been designed with the
assumption that many existing programs will use more routines than
those allowed by the ANSI C standard.
If a program calls, but does not define, a routine that is not in
the ANSI C name space (for example, open),
the library will resolve that reference. This allows a clean name
space and backward compatibility.
The HP header file implementation uses preprocessor conditional
compilation directives to select the name space. In non-ANSI mode,
the HP-UX name space is the default. Table 3-6,
“Name space selection in ANSI mode on HP-UX” provides
information on how to select a name space from a command line or
from within a program using the defined libraries on HP-UX.
Table 3-6. Name space selection in ANSI
mode on HP-UX
| HP-UX 11i Definition |
Standard |
| -D_HPUX_SOURCE (Default for -Ae) |
Proprietary interfaces |
| -D_XOPEN_SOURCE=500 or -DUNIX_STD=98 |
UNIX 98 |
| -D_XOPEN_SOURCE_EXTENDED |
UNIX 95 |
| -D_XOPEN_SOURCE |
XPG4 |
| -D_POSIX_SOURCE |
POSIX |
| Default for -Aa and -c89 |
ANSI C |
In ANSI mode, the default is the ANSI C name space. You can use
the macro names _POSIX_SOURCE, _XOPEN_SOURCE, and _HPUX_SOURCE to select other name spaces. The
name space may need to be relaxed to make existing programs compile
in ANSI mode. To accomplish this, define the _HPUX_SOURCE macro. Also, _HPUX_SOURCE is defined if the -Ae option or default option is used.
By default, both the Sun and HP-UX compilers build an executable
for the platform on which the executable is compiled. The compilers
on Itanium®-based systems generate executables appropriate for all
Itanium®-based systems. Based on your customer support requirements,
you may want to change these defaults.
If you expect your program to run only on the platform on which
you are compiling, you do not need any additional compilation
options. If you are compiling your software on a system and wish to
have your software run on older HP platforms, use the +DAarchitecture option to designate which
platform/processor for which to build your executable. Possible
values for this option are:
-
+DA1.1
-
+DA2.0
-
+DA2.0W
-
+DAmodel
The +DA option is not required for
Itanium®-based systems. Use the model command
to determine the model number of the current platform.
Use the +DSmodel option to specify which
instruction scheduler to use for the executable. Unlike the +DA option, the +DS option
will not prevent executables from running on older implementations
than the one specified. The default is to use the instruction
scheduler for the architecture indicated by the +DA option, which by default is the architecture
of the build system, and the generic case on Itanium®-based systems.
The model can be one of the following:
-
A model number
-
Architecture designation
-
Processor name
Refer to the HP-UX system file /opt/langtools/lib/sched.models for a detailed
list of model numbers and processor names.
On Itanium®-based systems, the model can be one of the following:
-
A processor name (for example, Itanium and
Itanium2)
-
"native", which uses the compilation
system's processor type
-
"blended" (the default), which tunes for the
best performance on a combination of processors
The instruction scheduler optimization performs the following
tasks:
-
Reordering the instructions in a basic block
to improve memory pipelining.
-
Following a branch instruction with an
instruction that can be executed as the branch occurs, where
possible.
-
Scheduling floating-point instructions.
Because there are no compatibility issues, HP recommends that you
use the scheduler for the newest processor you intend to support.
While it will not allow you to take full advantage of the newer
processor features, using the scheduler will provide a performance
improvement over not using it when running on newer hardware.
Building 32- or 64-Bit binaries |
 |
The HP compilers provide special options to build for either 32-
or 64-bit binaries. These options also help the linker find the
right libraries and toggle the appropriate changes in header files.
You can compile 64-bit applications on a 32-bit platform, but they
cannot be executed or debugged. On a 64-bit platform, either 32- or
64-bit applications may be compiled and debugged.
The default behavior on HP-UX is to build 32-bit binaries. This
can be explicitly enforced by using the +DA2.0N, +DA1.1, or +DD32 options. Building a 64-bit binary requires
special options, +DA2.0W or +DD64, which must be used on all source files.
All source files and libraries must be compiled in the same manner,
and it is not possible to mix 32- and 64-bit objects within an
executable.
Access to 64-bit HP-UX information from 32-bit applications
should use pstat wrappers or macros (not /dev/kmem). For 32-bit applications, use nlist64 for executable symbol table information.
There is a new option to shmget for
64-bit applications, IPC_SHARE32, which must
be used to indicate that a shared memory segment for a 64-bit
application will also be shared with 32-bit applications. You do not
need this option for 32-bit applications. The mmap interface also has a similar option, MAP_ADDR32, to map shared files between 32- and
64-bit processes.
The HP-UX Software Transition Kit (STK) tools and documents can
help you quickly identify and resolve potential 32- and 64-bit
interoperability problems in your source code and scripts. For more
information on the STK, go to:
http://www.hp.com/go/STK
HP and Sun compilers offer similar levels of optimization.
Optimization is performed primarily by the compiler backend, so it
is virtually the same for both the C and C++ compilers on each
platform. Sun compilers offer five levels of optimization through
the -xOn
option where n is 1-5. HP
compilers offer five levels of optimization through the +On option
where n is 0-4. When porting from
Solaris to HP-UX, two additional optimization options may be
helpful:
Table 3-7,
“Compiler optimization - levels and descriptions” provides a
comparison of optimization levels. Note that each level includes all
the optimizations of the previous level. Although the optimization
levels of Sun and HP compilers are not identical, they are
substantially similar.
Table 3-7. Compiler optimization -
levels and descriptions
| Solaris Level |
HP-UX Level |
Solaris Description |
HP-UX Description |
| -xO1 |
+O0 |
Does basic local optimization (peephole). |
Constant folding and simple register assignment. Compiles
fastest. |
| -xO2 or -xO |
+O1 |
Basic local and global optimizations. This is induction
variable elimination, local and global common subexpression
elimination, algebraic simplification, copy propagation,
constant propagation, loop-invariant optimization, register
allocation, basic block merging, tail recursion elimination,
dead code elimination, tail call elimination, and complex
expression expansion. In general, the -xO2 level results in minimum code size. |
Instruction scheduling and optimizations that can be
performed on small sections of code. Produces faster programs
than level 0. Compiles faster than level 2. |
| -xO3 |
+O2 or -O |
Optimization of references or definitions for external
variables. Loop unrolling and software pipelining are also
performed. This level does not trace the effects of pointer
assignments. When compiling either device drivers, or programs
that modify external variables from within signal handlers,
you may need to use the volatile type qualifier to protect the
object from optimization. In general, the -xO3 level results in increased code size. |
Optimizations performed over entire functions in a single
file. Optimizes loops in order to reduce pipeline stalls.
Performs scalar replacement, analysis of data-flow, memory
usage, loops, and expressions. Can produce faster run-time
code than level 1 if programs use loops extensively. Compiles
faster than level 3. Loop-oriented floating-point intensive
applications may see run times reduced by 50 percent.
Operating system and interactive applications that use the
already optimized system libraries can achieve 30 percent to
50 percent additional improvement. |
| -xO4 |
+O3 |
Automatically inlines functions contained in the same
file; this usually improves execution speed. This level traces
the effects of pointer assignments, and usually results in
increased code size. |
Full optimization across all subprograms within a single
file. Includes subprogram inlining. Can produce faster
run-time code than level 2 on code that frequently calls small
functions. Links faster than level 4. |
| -xO5 |
+O4 |
Uses optimization algorithms that take more compilation
time or that do not have as high a certainty of improving
execution time. Optimization at this level is more likely to
improve performance if it is done with profile feedback. |
Full optimizations across the entire application program.
Includes global and static variable optimization and inlining
across the entire program. Optimizations are performed at link
time. Produces faster run-time code than level 3 if programs
use many global variables or if there are many opportunities
for inlining procedure calls. |
Note that -O is a synonym for "-xO2 or -xO" for Solaris as
it is for HP-UX.
Chapter 4. Linkers and
loaders
The ld link editors on HP-UX and Solaris
differ significantly, as is shown most clearly in the number and
semantics of command-line options. This chapter provides tables that
describe all of the available options to help you port your link
commands and to optimize your applications. Differences in shared
library versioning and run-time link editing are also discussed. You
will find helpful hints and advice to help your port go as smoothly
as possible.
The term linker is generally used in this document to
refer to the link editor.
This section describes a methodical approach for porting your
application to link on HP-UX. Since changes in linker options can
cause significant changes in application behavior, allow time to
test your application thoroughly. Avoiding link-time errors is
important, but not enough to assure a successful port.
For more information on linking your application on HP-UX, see
the HP-UX Linker and Libraries Guide:
http://docs.hp.com/en/B2355-90730/B2355-90730.html
-
Analyze your application
You can expect to do more work if the
application you are porting has any of these attributes:
-
Uses Solaris mapfile library
versioning
-
Uses Solaris filter and auxiliary filter
file functionality
-
Relies on linker load order behavior to
specify which definition of a symbol is used
-
Uses Solaris binding behavior options,
particularly visibility options, that are not available on
HP-UX
-
Uses explicit location information in
Solaris mapfiles
-
Has demanding run-time performance
requirements
-
Plan your approach
If you are porting programs or sets of
libraries from Solaris to HP-UX that use dynamic linking, and you
are able to choose your HP-UX platform, going directly to the
HP-UX 11.0 64-bit linker will make your port easier. If you must
also support code developed on or for HP-UX with the 32-bit
linker, you can still use the 64-bit linker, which has a
compatibility mode. You can thus postpone updating everything to
the 64-bit linker for a while. Eventually, however, the 32-bit
linker will become obsolete (when 32-bit files go to the ELF(3) format). Therefore,
at best, the port from a 32-bit linker to a 64-bit linker is
delayed rather than eliminated.
Try to avoid HP-UX linker functionality
that is obsolete or on the path to obsolescence. In particular,
avoid #pragma internal library versioning
and using -A and -R
dynamic linking. You can use the HP-UX +vcompatwarnings or +vallcompatwarnings linker flags to check your
linker usage for compatibility problems.
On HP-UX, you must use library-level versioning
if you need to version shared libraries. If you need to support
several past revisions in your first port, you must make separate
versions of the source files. If you are expecting to version
shared libraries in the future, you can set up the initial version
libfoo.0 as your first ported version.
This will make porting easier in the future.
-
Make code changes where necessary
Complicated versioning and symbol-hiding
mechanisms may require source code changes. Changes may be
required if you are doing programmatic run-time linking, and will
certainly be required if you must use the HP-UX 32-bit linker and
shl_load.
Code changes can improve the run-time
performance of your application. The HP-UX
Linker and Libraries Guide describes these techniques.
-
Analyze your makefiles
Look over all your link lines. Are you
using options that are either unavailable on HP-UX or have
different semantics? Most linker functionality you are currently
using is also available on HP-UX, but some may be specified by
different options. Use the tables in this document to look for
trouble areas and find the options you need.
Recall that the environment variable to
pass options to ld is LDOPTS on HP-UX. You can also use a linker
options file, or you can hide options from the compile step by
using the -Wl, mechanism.
Recall that the shared library suffix is .sl on HP-UX, and that library version
suffixes replace this suffix rather than appending to it.
-
Build and test
Build your shared and archive libraries, and
then build your executables. If you are using library-level
versioning, make sure the symbolic links are in place before
linking the programs. Test your applications thoroughly,
particularly where multiple symbol definition and symbol hiding
are used.
-
Tune library load performance
HP-UX provides advice and several tools to help
you improve load time for shared libraries. The HP-UX Linker and Libraries User's Guide has a
chapter on performance tuning, which discusses:
-
Linker options to improve performance
-
Recommended code changes to increase
locality of the reference
-
The use of fastbind
to write symbol information directly into the executable
-
Using profile-based optimization (for
32-bit SOM files)
The HP-UX 11i linker provides the following new features:
Lazy loading of shared libraries
The +lazyload loading is deferred until a
reference is made to that library during execution. Both the +lazyload and +nolazyload
options may appear on the link line at the same time. For lazy
loading of libraries, a library must not be:
The linker will silently convert such libraries into +nolazyload libraries.
Dependent libraries of +lazyload shared
libraries will not be processed during link time, unless they are
explicitly specified on the link line.
Direct binding support
The -B direct option creates a direct link
between symbol references and shared libraries by recording the name
of the resolved shared library during symbol resolution. This
information is used during run time to quickly resolve symbols
without searching through all currently loaded libraries.
HP-UX 11i v2 introduces some new symbol resolution binding
controls for shared libraries. Three options are available for
direct binding: on, off, and lazy; the default is off. Direct
binding (-B direct) records the library name
from which each symbol is resolved. This improves startup time by
allowing the loader to resolve the symbols quickly rather than
searching through all loaded shared libraries. Disabling direct
binding (-B nodirect) will record only a hint
for use later by the loader, which will attempt to resolve the
symbol by searching all loaded libraries. The final option, -B lazydirect, is a combination of the other two.
Lazy binding will only record library/symbol pairs (-B direct) for those libraries marked for lazy
loading. See the previous discussion of +[no]lazyload.
In porting from Solaris to HP-UX, you will need to thoroughly
understand the link command lines in your makefiles. Though a few
common options exist, such as -l, -L, and -o, even the option
to create a shared library differs between the platforms, as does
the suffix of the resulting file (.sl on
HP-UX and .so on Solaris). The default
shared library suffix on HP-UX 11i v2 is .so.
The HP-UX 64-bit linker links ELF
(elf(3E)) files. The object format for HP-UX 11i v2 is ELF, so you can use the +DD64 option to generate LP64 code.
The run-time linker (dld.sl in HP-UX, and
ld.so.1 on Solaris) locates and binds shared
libraries during program execution. It is used both for shared
libraries specified at link time and for shared libraries mapped
during code execution.
Shared-library versioning provides the capability to change the
interface or implementation of a particular shared library. It will
not break compatibility with executables or other shared libraries
that were linked against an earlier version of that library.
Library-level versioning is done by providing separate files with
the same basename but different suffixes, each file representing one
of the library versions. This technique is also called external
versioning in the Solaris documentation. The linker places the
location of the correct version of the shared library inside the
executable, which allows the run-time linker to find and use it.
There are two forms of shared-library versioning: library-level
versioning and internal versioning.
The following example demonstrates the process of library-level
versioning for the second version of libfoo.sl on HP-UX 11i v2. Although suffixes
differ, the procedure is identical on HP-UX and Solaris.
-
Link the desired version of the shared
library, using the following linker options in the link command
line, which sets the internal name and the output name to the
versioned name.:
+h libfoo.sl.2 -o libfoo.sl.2 |
-
Install the version of the library to its
proper location; for example, /usr/lib.
-
When you are preparing to link an executable
that should be using this version, you must symbolically link the
nonversioned name to this version; for example:
ln -s libfoo.sl.2 libfoo.sl |
Usually the nonversioned (.sl) name is symbolically linked to the latest
version, but you have the option of using any previous
version.
-
Link the executable by specifying -lfoo.
-
At run time, the executable will find and
map to libfoo.sl.2, even if libfoo.sl is now symbolically linked to a
different version of the library.
-
Solaris library-level versioning works
exactly the same as on HP-UX, except that the options in step 1
are entered as:
-h libfoo.so.2 -o libfoo.so.2 |
Note that the option to specify the internal name is +h on HP-UX and -h on
Solaris.
The only shared-library versioning supported by the HP-UX linker
is library-level (external) versioning. Solaris also supports
internal versioning of shared libraries by using mapfiles, where the
differences in interface between library versions are defined.
If you are porting a mapfile-versioned library from Solaris to
HP-UX, you must use library-level versioning to provide this
functionality. Because Solaris mapfile versioning also determines
whether symbols are global or local, you will need to use the HP-UX
+e, -h, or other ld options to establish symbols as local or
global.
Both the HP-UX 64-bit run-time linker and Solaris run-time linker
load library dependencies breadth-first. The HP-UX 32-bit run-time
linker loads library dependencies depth-first. Note that the HP-UX
32-bit run-time linker loads the library dependencies first. If you
use this linker rather than the recommended 64-bit run-time linker,
you may see a difference in behavior if you rely on load order for
symbol resolution of specific initialization and termination
function execution order.
The run-time linker, ld.so.1, is supported
on both HP-UX and Solaris. Dynamic run-time linking is done by
programmatic library calls.
Table 4-1,
“Supported run-time calls” lists the dlopen family of run-time calls that the Solaris
and HP-UX 64-bit linkers support.
Table 4-1. Supported run-time
calls
| Call |
Description |
| dlopen |
Loads a dependent shared library with breadth-first
dependency searching. |
| dlerror |
Prints the last error message. |
| dlsym |
Returns the address of a symbol in a shared
library. |
| dlget |
Retrieves information on a loaded module, given its index
(load order), and returns its handle. |
| dlmodinfo |
Returns information on a loaded module, based on a memory
address. |
| dlgetname |
Returns the name of a loaded module, given its
handle. |
| dlclose |
Unloads a shared library, and all its dependent libraries,
unless they are also the dependencies of another loaded
module. |
These calls are used programmatically to locate and bind to
shared libraries during execution.
Using dlopen |
 |
The dlopen function makes an executable
object file available to the calling program. The class of files
eligible for this operation and the manner of their construction are
implementation-defined. These files are executable objects such as
shared libraries, relocatable files, or programs. Note that some
implementations permit the construction of dependencies between such
objects that are embedded within files.
Compiler option
Include dlfcn.h and use the CC command
line option -ldl .
Initializers and terminators
Use the init/fini
functions. Initialization functions for dependent shared libraries
are run in reverse load order on HP-UX. Initialization functions are
run in reverse topological order on Solaris. When shared libraries
are unloaded, termination functions are run in forward load order on
HP-UX and forward topological order on Solaris.
Binding modes and visibility
Binding can be RTLD_NOW or RTLD_LAZY, indicating when function symbols are
bound: when loaded or when first referenced from the executable. The
default is RTLD_LAZY.
Default visibility of symbols in a library loaded at run time is
RTLD_LOCAL, which means that only libraries
loaded at the same time can see the symbols. Visibility can be made
RTLD_GLOBAL in the dlopen call. Solaris also supports the
following:
-
RTLD_GROUP:
dependencies are satisfied only from libraries loaded at the same
time.
-
RTLD_PARENT: the
object making the dlopen call makes its
symbols available to the module being loaded.
-
RTLD_WORLD: only
global symbols are available.
Other Solaris options that can be specified are:
Specifying search paths for the run-time
linker |
 |
There are a number of different ways to specify search paths used
by the run-time linker. Table 4-2,
“Comparison of specifying search paths” summarizes the steps
taken by the run-time linker to search for run-time loaded
libraries. As soon as an appropriate library is found, the run-time
linker stops searching.
Table 4-2. Comparison of specifying
search paths
| Order |
Solaris 7 |
HP-UX 32-bit |
HP-UX 64-bit |
| 1 |
If the path contains a slash, it is used as is. |
Same. |
Same. |
| 2 |
The LD_LIBRARY_PATH environment
variable is used, provided that the appropriate security
precautions are met. |
Not applicable. |
The LD_LIBRARY_PATH environment
variable is used, provided that the appropriate security
precautions are met. |
| 3 |
Not applicable. |
If +s is specified at link time,
the SHLIB_PATH environment variable is
used when set. |
The SHLIB_PATH environment variable
is used when set. |
| 4 |
The RPATH specified with the -R option at link time is used. |
The embedded path recorded in the load module (or
inherited from any parent load module) is used, but only if
+b is set. |
The RPATH (equivalent of the 32-bit
embedded path) recorded in the load module is used. |
| 5 |
/usr/lib is searched. |
No default directories are searched. |
The /usr/lib/pa20_64 and /usr/ccs/lib/pa20_64 directories are
searched. |
In Table 4-2,
“Comparison of specifying search paths”, the HP-UX 64-bit column
describes the HP-UX 64-bit linker +std
behavior; the +compat behavior is the same as
the HP-UX 32-bit linker. The HP-UX 32-bit linker embeds the full
path to the shared library in the program. This means you must be
cautious about moving the shared library after the program is
linked.
Be careful when specifying a relative path for the Solaris and
HP-UX 64-bit linkers. Recall that the program may be executed in a
different file system location from where it was linked. HP
recommends using either full paths or basenames with one of the
previous search methods.
Table 4-3,
“HP-UX linker-related tools” and Table 4-4,
“Solaris linker-related tools” show a variety of tools that are
available on either platform to analyze and modify shared libraries
and executables. The HP-UX chatr tool is
particularly useful to modify attributes of executables or libraries
without relinking.
Table 4-3. HP-UX linker-related
tools
| Tool |
Description |
| chatr |
Displays or modifies internal attributes of an object
file. Note the syntax differences between 32-bit and 64-bit
usage. |
| elfdump |
Displays the contents of an ELF file. |
| fastbind |
Improves startup time of programs with shared libraries by
writing binding information into the executable. |
| dd |
64-bit linker: lists dynamic dependencies specified at
link time. Is available for both the 64-bit and 32-bit linkers
on HP-UX 11i v2. |
| order |
Finds ordering relationships for libraries; you can use
this information to promote one-pass linking by ld, speeding up link times. |
| nm |
Displays the symbol table of an object; note some
differences in options for SOM or ELF object files. |
| size |
Prints the sizes of object file elements. |
| strip |
Strips symbol and debugging
information. |
Table 4-4. Solaris linker-related
tools
| Tool |
Description |
| dump |
Displays the contents of an ELF file. |
| elfdump |
Displays the contents of an ELF file. |
| ldd |
Lists dynamic dependencies specified at link time. |
| pvs |
Displays version IDs and entire hierarchies of version
dependencies in a shared object. |
| mcs |
Manipulates the comment section of an object file. |
| nm |
Displays the symbol table of an object. |
| size |
Prints the sizes of object file elements. |
| strip |
Strips symbol and debugging
information. |
Solaris also has the following linker support libraries, which
you can use to debug difficult linker problems: ld-support, rtld-support,
and rtld_debugger.
The following general problems can occur when you develop link
command lines for your makefiles:
-
Some link options cause the compiler to
report an error unless protected in some way. This occurs because
ld is generally called by the
compilers.
-
Extremely long command lines that go past
the shell limit. This occurs when you have too many libraries or
object files to list.
There are a couple of techniques to overcome these problems,
which are discussed here.
Solving the compiler problem
Both Solaris and HP-UX compilers support sending options directly
to the linker without being interpreted by the compiler. On HP-UX
11i v2, this is done by using the -Wl,option, which can appear as many
times as needed on the command line.
The Solaris linker reads values from the LD_OPTIONS environment variable, which allows you
to pass values into the link step that would otherwise cause errors
or unwanted behavior from the compiler. The HP-UX linker reads the
LDOPTS environment variable instead, for
which the setting is put ahead of any command-line arguments.
Solving the command line problem
Both Solaris and HP-UX support reading in options to the linker
from a file at link time to avoid problems with an extremely long
command line. The option is -c filename. The options file
supports comments in the form of lines that start with #, which can
be very helpful in documenting linker options. You may want to use
the file technique to document complicated sets of linker
options.
Be careful when porting linker command-line options in your
makefiles. A particular functionality can be specified by different
flags on the two platforms, and some identical flags perform
different functions. In no case does this kind of ambiguity exist
between options on the 32-bit and 64-bit linkers on HP-UX. However,
some options exist only in one or the other.
Table 4-5,
“All Solaris standalone options” through Table 4-12,
“HP-UX 32-Bit linker options only with arguments” summarize the
command-line options for ld. The tables are
arranged specifically for convenience in porting from Solaris as
follows:
Table 4-5. All Solaris standalone
options
| Option |
Solaris Behavior |
HP-UX Behavior |
| -a |
In static mode, gives errors for undefined references
(default). |
Uses +no allowunsats. |
| -b |
In dynamic mode, does not do special processing to enable
sharing. |
Creates a shared library. |
| -i |
Ignores $LD_LIBRARY_PATH when
linking. |
Uses +noenvvar for 64-bit
linker. |
| -m |
Produces memory-map listing on stdout. |
Same. |
| -r |
Combines relocatable object files to produce one
relocatable object file. |
Same. |
| -s |
Strips debug information, and any symbolic information not
needed in shared objects or executables. |
Same. |
| -t |
Turns off warning about multiply defined symbols. |
Prints a trace of each input file as ld processes it. |
| -z allextract | defaultextract |
weakextract |
Extracts all references from an archive library (whether
needed or not); goes back to default behavior (extracts only
needed references); extracts needed and weak references from
an archive library. |
Uses +[no]forceload for 64-bit
linker; uses -Fl to forceload a library
for 32-bit linker; weak references not available. |
| -z combreloc |
Combines multiple relocation sections (Solaris 7 only). |
Not applicable. |
| -z [no]defs |
Does [does not] force a fatal error if undefined symbols
remain (defs is the default for
executable; nodefs is the default for
shared library). |
Uses +[no]allowunsats; defaults are
the same. |
| -z ignore | record |
Ignores or records dynamic dependencies not referenced in
the link. |
Not applicable. |
| -z initfirst |
Marks this object to be initialized first. |
Not applicable. |
| -z [no]lazyload |
Enables marking of dependencies for lazy or immediate
loading (Solaris 7 only). |
See "Background
information on linker differences" . |
| -z loadfltr |
Processes filters at once, not when referenced (filters
are objects that have had a filter applied to them). |
Not applicable. |
| -z muldefs |
Allows multiple symbol definitions (take the first
one). |
Multiple definitions are allowed with +allowdups. |
| -z nodelete |
Marks an object as nondeletable (cannot be unloaded). |
Uses -B nodelete. |
| -z nodlopen |
Marks an object as not able to load with dlopen. |
Not applicable. |
| -z nopartial |
Expands any partially initialized symbols (Solaris 7
only). |
Not applicable. |
| -z noversion |
Does not record versioning sections. |
Not applicable. |
| -z now |
Binds all procedures at load time, not later. |
Uses B immediate. |
| -z origin |
Marks an object as requiring immediate $ORIGIN processing (Solaris 7 only). |
Not applicable. |
| -z redlocsym |
Eliminates all local symbols except for SECT symbols (Solaris 7 only). |
Uses -G or -x. |
| -z text |
Forces a fatal error for relocations in text segment. |
Not applicable. |
| -z textwarn | textoff |
Enables [disables] warning for relocations in text segment
(Solaris 7 only). |
Not applicable. |
| -G |
Produces a shared library. |
Strips all unloadable data (such as debug
information). |
| -V |
Reports linker version. |
Same. |
Table 4-6. HP-UX 64-Bit and 32-Bit
linker standalone options
| Option |
Description |
| -d |
Forces definition of common storage; used with -r. |
| -v |
Outputs verbose messages from linker. |
| -x |
Strips only local symbols. |
| -z |
Causes -SIGSEGV on run time -NULL dereference. |
| -I |
Instruments code to collect profiling data. |
| -O |
Turns on linker optimizations. |
| -P |
Does profile-based optimization using a data file. |
| -Pd |
Reorders the functions that can be debugged. |
| -Z |
Allows run-time dereferencing of NULL pointers (default). |
| +fb |
Runs fastbind on the
executable. |
| +fbu |
Passes -u to fastbind to allow undefined symbols. |
| +[no]copyobjdebug |
Does or does not copy objdebug
space from the object files to the executable. |
| +gst |
Uses a hash table for the global symbol table. |
| +help |
Brings up online help for the linker. |
| +hideallsymbols |
Does not export any symbols. |
| +k |
Does not create an executable when link errors
occur. |
| +n |
Loads all the object modules first, then searches the
archive and shared libraries, and repeats this until there are
no unsatisfied symbols. |
| +v[no] shlbunsats |
Enables [disables] printing of a list of unsatisfied
symbols used by shared libraries. |
| +vallcompatwarnings |
Shows more detail in warnings for linker compatibility
issues. |
| +v[no]compatwarnings |
Enables [disables] linker compatibility warnings. |
| +O[no]fastaccess |
Enables [disables] linker rearrangement of data. |
| +O[no]procelim |
Enables [disables] linker removal of dead code. |
| +OselectiveO3 |
Instructs that any procedures not on +O4 list to be compiled on +O3. |
Table 4-7. HP-UX 64-Bit linker
standalone options
| Option |
Description |
| -dynamic |
Creates a program that can use shared libraries. |
| -noshared |
Forces the linker to create a fully archive-bound
executable. |
| +[no]allowunsats |
Enables [disables] reporting errors for unsatisfied
symbols. |
| +compat |
Uses 32-bit compatibility mode. |
| +[no]forceload |
Enables [disables] forced loading of all objects. |
| +nodefaultmap |
Does not use the default mapfile. |
| +nodynhash |
Does not create the .dynhash
section when using +gst. |
| +noenvvar |
Does not look at $LD_LIBRARY_PATH
and $SHLIB_PATH. |
| +nosectionmerge |
When using -r, does not merge the
procedures. |
| +std |
Uses standard 64-bit linker behavior (the opposite of +compat). |
| +stripunwind |
Does not output the unwind table. |
| +tools |
Links for CXperf performance
analysis. |
Table 4-8. HP-UX 32-Bit linker
standalone options
| Option |
Description |
| -n |
Generates an executable with SHARE_MAGIC; text is shared, data is not;
everything is loaded at startup. |
| -q |
Generates an executable with DEMAND_MAGIC; text is shared, data is not;
pages are loaded as needed. |
| -E |
Exports all symbols. |
| -Fl |
Forces the load all libraries, whether referenced or
not. |
| -Fw |
Does not emit unwind information. |
| -Fz |
Disables the linker feature that moves some calls in $$dyncall_external$$ to $$dyncall$$. |
| -N |
Generates an executable with EXEC_MAGIC; unshared executable. |
| -Q |
Creates a EXEC_MAGIC or SHARE_MAGIC executable, depending on
whether -N or -n
is set. |
| -S |
Generates an IPL auxiliary header instead of an HP-UX
auxiliary header. |
| -T |
Saves load data in a temporary file. |
| +dpv |
Displays verbose messages on dead procedure
renaming. |
| +nosmartbind |
Does not use SmartBind. |
| +s |
Executable uses $SHLIB_PATH when
running. |
Table 4-9. Comparison of Solaris and
HP-UX linker options with arguments
| Option |
Solaris Argument |
Solaris Behavior |
HP-UX Argument |
HP-UX Behavior |
| -dflag |
y | n |
-dn static mode; -dy dynamic mode |
Not applicable |
Uses -dynamic and -noshared |
| -e epsym |
Entry point symbol |
Exports epsym as an
entry point (only allowed for executables) |
Same |
Same |
| -f filename |
File name |
Specifies this shared object as an auxiliary of the named
shared object |
Not applicable |
Not applicable |
| -h arg |
File path |
Sets internal name of library for use in dynamic
loading |
You can hide data symbols as well as function symbols |
Hide this symbol in the output file |
| -llib |
Library basename to which is prepended
lib; archive or shared is chosen based on other
options |
Adds specified library to the link |
Same |
Same |
| -o output |
File name |
Outputs file name |
Same |
Same |
| -u sym |
Symbol |
Enters sym as undefined
symbol, forcing load of an object module |
Same |
Same |
| -z instruction |
Instruction to ld |
See Table 4-5,
“All Solaris standalone options” |
Not applicable |
Not applicable |
| -B bind |
dynamic | static; eliminate; group;
local; reduce;
symbolic |
More than one option can be used; controls binding
behavior |
immediate; restricted; deferred; symbolic;
nonfatal; verbose; nodelete,
and group options |
Similar |
| -D arg |
Comma-separated list of tokens, which can be args, basic, detail, entry, files, help, libs, map, reloc, sections, segments, support,
symbols, version |
Forces ld to print detailed
debugging information (must be passed through $LD_OPTIONS). |
Offset address in memory. |
Sets origin of data segment. See +b
for the HP-UX equivalent of -R. |
| -F filename |
File name |
Specifies this shared object as a filter of the named
shared object |
+filter |
Different but provides a similar type of
functionality |
| -I filename |
Utility name |
Uses the named utility as the interpreter; default is ld.so.1 |
Utility |
Uses +interp |
| -Llibdir |
Directory that contains libraries |
Adds directory to search path used to find libraries,
ahead of default directories |
Same |
Same |
| -M mapfile |
File name |
Reads text file as versioning instructions to ld; also can be used to specify where to
put symbols |
Not applicable |
Use k for instructions on where to
put symbols (64-bit linker only) |
| -N symbol |
Symbol name |
Adds entry to DT_NEEDED table. |
Not applicable |
Not applicable |
| -Q flag |
y | n |
y: add identification string for
ld version |
Not applicable |
Not applicable |
| -R arg |
Path |
Colon-separated list of library directories used by the
run-time linker |
Offset location in memory. |
Sets origin of text segment |
| -YP dirlist |
Colon-separated list of directories |
Changes default directories used for finding libraries |
Not applicable |
See Table 4-2,
“Comparison of specifying search
paths” |
Table 4-10. HP-UX 64-Bit and 32-Bit
linker options with arguments
| Option |
Argument |
Behavior |
| -a search |
archive; shared; default; archive_shared; shared_archive |
Toggles whether archive or shared libraries are used in
link; default equals shared. |
| -c filename |
File containing linker options |
Linker reads options from this file. |
| -l lib |
Library name with suffix, to which lib is prepended |
Adds specified library to the link. |
| -y sym |
Symbol |
Indicates source files in which the symbol appears. |
| -PD file |
File name |
Saves link order data into file. |
| -PF file |
File name |
Uses file to specify link
order. |
| +b pathlist |
Colon-separated list of directories |
Executable uses list at run time to find -l specified libraries to load; double colon
(::) appearing in list means to use the path stored in the
executable. |
| +df file |
Flow file |
Uses this flow file for profile based optimization. |
| +e sym |
Symbol |
Exports this symbol and hides all others (for shared
library or program). |
| +ee sym |
Symbol |
Exports this symbol but does not hide all others. |
| +gstsize n |
Integer |
Sets global symbol hash array size. |
| +h name |
Library name |
Sets internal name of library for use in dynamic
loading. |
| +pd size |
Page size |
Requests a particular virtual memory page size for
data. |
| +pgm file |
File name |
Specifies actual name of executable for profile-based
optimization. |
| +pi size |
Page size |
Requests a particular virtual memory page size for
instructions. |
| +vtype type |
Type of output: files, libraries, sections,
symbols, all |
Gets detailed link debugging information. |
| +fp flag |
V | v | Z | z | O | o | U | u | I | i |
D | d |
Specifies error behavior for floating-point numbers; see
ld(1) for descriptions of behavior. |
| +I sym |
Symbol |
Specifies initializer to be used when shared library is
loaded or unloaded. |
| +Oreusedir=dir |
File name |
Path to directory for object code reuse. |
| +Oselectpercent=percent |
Percentage |
Passes first percent% routines to
optimizer. |
| +Oselectivesize=size |
Integer |
Passes first size routines to
optimizer. |
Table 4-11. HP-UX 64-Bit linker options
only with arguments
| Option |
Argument |
Behavior |
| -k filename |
Mapfile name |
Path to mapfile, which describes the output file memory
layout. |
| +fini funcname |
Function name |
Specifies termination function. |
| +init funcname |
Function name |
Specifies initialization function. |
| +interp filename |
Path to utility |
Uses this as interpreter instead of dld.sl. |
Table 4-12. HP-UX 32-Bit linker options
only with arguments
| Option |
Argument |
Behavior |
| -A name |
File name |
Reserves space for the symbols from the file in the symbol
table; program cannot load shared libraries. |
| -C n |
Positive integer |
Sets the maximum parameter checking to n, which refers to the level at which
parameter and return type checking is done. The compilers now
take care of this checking. |
| +cdp oldpath:newpath |
Colon-separated pair of directory paths |
Replaces the recorded path for shared libraries in the
executable. |
| +gstbuckets n |
Integer |
Requests the number of buckets for global symbol hash
table. |
This section contains several tips to keep in mind as you are
porting your applications. Inconsistencies, danger areas, and
general suggestions are included.
Watch out for passive symbol definition
Complicated symbol-hiding mechanisms in sets of dependent
libraries may fail or need significant work to port to HP-UX. The
most fragile are those that rely on undocumented linker behavior. HP
recommends simplifying these mechanisms, if at all possible, on all
supported platforms.
Decide how you want to export symbols
Specifying -B symbolic causes the HP-UX
32-bit linker to optimize all paths in the library, and also export
all functions. The +e epsym option overrides this
behavior, exporting only the specified symbol. You can also export
all functions with -E. You can hide symbols by
using -h sym. It is better not to use
both -h and +e in the
same command line as it is confusing. You cannot use mapfiles to
control symbol exporting on HP-UX.
Do not use the -A and -R options to do
dynamic linking
For the HP-UX 32-bit linker, you can use -A
and -R to do dynamic linking, but if you use
them you will be unable to link with shared libraries. This older
method is likely to become obsolete in the near future, and HP
recommends that you not use it. The benefits of using shared
libraries far outweighs the benefits of using -A.
Do not use mapfiles on HP-UX unless you are
a systems programmer
You can use a mapfile to explicitly describe the output file
memory layout. This functionality is designed to be used by systems
programmers, not application developers. It is specified with the
-k file
option. You can easily link an executable that will not execute, and
the problem can be very difficult to diagnose. Solaris also supports
this functionality in mapfiles, specified by -M file. Solaris mapfiles are also
used to specify internal library versioning directives, which are
not supported in HP-UX.
Note differences in dependency ordering
The Solaris linker figures and uses a topological ordering of
libraries during a link, rather than link order as given by -l options on the command line. HP-UX uses link
order. Ordering determines when initialization and termination
functions for each library are called, as well as the order in which
symbol definitions are found. If order is important for the
libraries you are porting to function properly, determine the
correct order for HP-UX and change the link
command as needed. Prior to release 2.6, Solaris performed
load-order searching, setting the LD_BREADTH
environment variable to a nonzero value will restore this
behavior.
Note differences in initializers and
terminators
The HP-UX 64-bit and Solaris run-time linkers both support the
init/fini style of
initialization and termination functions. Initialization and
termination functions are identified in the source code with #pragma init or #pragma
fini. On the ld command line that links
the load module, you need to specify the name of the functions with
+init epsym
or +fini epsym.
Do not use shl_load and _thread
together
On HP-UX, if you use the _thread variable,
or thread local storage (TLS) in a shared library, executables will
not be able to dynamically load your shared library.
On HP-UX 11i version 1.6, the /usr/lib/hpux64/dld.so shared library is the
64-bit dynamic loader. In programs that use shared libraries, dld.so is automatically invoked at startup time.
dld.so supports static and dynamic TLS model
shared libraries compiled with the +tls=static and +tls=dynamic compiler options.
Shared libraries built with +tls=dynamic
can be loaded using the dlopen and shl_load system calls. Attempting to load a +tls=static shared library results in an error
stating that you cannot shl_load, a library
containing TLS.
Check for file permissions
An HP-UX shared library should have read and execute permissions,
but no write permissions, for fastest binding. For example, ls -l /usr/lib/libc.1 returns:
-rwxr-xr-x 1 root bin 1158072 Nov 7 00:44 /usr/lib/libc.so.1 |
Note that your date and size may vary.
Find an alternative to filtering
Solaris supports an explicit "filter" mechanism — a special
shared object consisting of a symbol table but no implementation.
The -F and -f linker
options are used to specify a shared object that contains the
definitions for the symbols.
Find an alternative to weak symbols
In Solaris, symbols can be set with a pragma to be weak, which
means that these symbols are always overridden by any global
definition. If an undefined weak symbol is never satisfied by a
global definition, it is set to 0 before the program starts
execution. HP_SECONDARY_DEF symbols are
similar to Solaris weak symbols, but there are some differences. You
can use the _HP_SECONDARY_DEF pragma to
connect a weak and a strong definition (for example, _fopen and fopen). The
weak definition can be overridden by other strong definitions.
Watch out for reserved symbols
Table 4-13,
“Reserved linker symbols” lists some of the reserved symbols for
the Solaris, HP-UX 64-bit, and HP-UX 32-bit linkers.
Table 4-13. Reserved linker
symbols
| Solaris |
HP-UX 32-Bit |
HP-UX 64-Bit |
| _etext |
_etext |
_etext |
| _edata |
_edata |
_edata |
| _end |
_end |
_end |
| |
__tdsize |
__TLS_SIZE |
| |
__SYSTEM_ID |
|
| |
_FPU_STATUS |
|
| |
|
_DYNAMIC |
| |
|
_GLOBAL_OFFSET_TABLE_ |
| |
|
_PROCEDURE_LINEAGE_TABLE_ |
Chapter 5. Other
development tools
Tools other than compilers are also required for a complete
development environment. This chapter discusses some of these other
tools frequently used by developers.
Solaris provides three versions of the make command:
-
/usr/ccs/bin/make:
Solaris version. For more information, refer to the Sun
make(1S) manpage.
-
/usr/xpg4/bin/make:
XPG4-UNIX version with support added for statefiles. For more
information, refer to the Sun make(1S) manpage.
-
/usr/ccs/lib/svr4.make: System V version. For
more information, refer to the Sun sysV-make(1)
manpage.
HP-UX 11i provides one version of the make
command, /usr/ccs/bin/make, which is
symbolically linked to /usr/bin/make. The
HP-UX 11i make command conforms to the SVID2,
SVID3, XPG2, XPG3, XPG4, and POSIX.2 standards. Refer to the HP-UX
11i make(1) man page for more information.
The GNU implementation of make, commonly
referred to as gmake, is also available on
HP-UX 11i and Solaris. Environments utilizing GNU make on Solaris are encouraged to continue using
it on HP-UX 11i. For more information on GNU make and Open Source applications, see Chapter 9. Freeware,
Open Source, Public Domain Software .
HP-UX, Solaris, and GNU makefile
similarities |
 |
HP-UX, Solaris, and GNU all define the same basic set of suffixes
and implicit rules for makefile. The
following macros, variables, and options are the same:
-
Built-in targets: .DEFAULT, .PRECIOUS, .SILENT, .IGNORE, .SUFFIXES
-
Dynamic macros: $@,
$%, $*, $<, $?
-
Variables: CC, CFLAGS, CPPFLAGS, FC, FFLAGS, LEX, LFLAGS, YACC, YFLAGS, LD, LDFLAGS
-
Options: -d, -e, -f makefile, -i, -k, -n, -p, -q, -r, -s, -S, -t
Options for the make command |
 |
The following options from the Solaris default make command are not available on HP-UX 11i: [-dd] [-D] [-DD] [-V] [-K statefile]. The Solaris
make command option -p
has different behavior on HP-UX 11i. Table 5-1,
“Solaris and HP-UX make option comparison” compares the HP-UX
11i and Solaris make options that are
different or unavailable.
Table 5-1. Solaris and HP-UX make option
comparison
| Option |
Solaris |
HP-UX |
| -dd |
Displays dependency check and processing. |
Not available. |
| -D |
Displays the text of makefiles read in. |
Not available. |
| -DD |
Displays the text of makefiles, make.rules file, state file and all hidden
dependency reports |
Not available. |
| -P |
Reports dependencies rather than building them. |
Updates in parallel more than one target at a time. |
| -V |
Puts make into SysV mode. |
Not available. |
| -K statefile |
Uses statefile to override implicit
rules and pre-defined macros. |
Not available. |
If the make command -f option is not used, both Solaris make and HP-UX make
command look for makefiles in the following sequence:
-
./makefile, ./Makefile
-
s.makefile, SCCS/s.makefile
-
s.Makefile, SCCS/s.Makefile
Both Solaris and HP-UX assume SCCS as the default for file source
control. If the makefile is under source control, then make will attempt to checkout a copy before
building.
Special-function targets and make
rules |
 |
What Solaris documentation refers to as special-function targets,
HP-UX documentation calls built-in targets. However, the
functionality is unchanged; both platforms provide the .DEFAULT, .PRECIOUS, .SILENT, .IGNORE, .SUFFIXES targets.
Table 5-2,
“Solaris special-Function Targets not Available on HP-UX” lists
the Solaris special-function targets that are not available on
HP-UX.
Table 5-2. Solaris special-Function
Targets not Available on HP-UX
| Construct |
Solaris make |
HP-UX make |
| POSIX Mode |
.POSIX |
Default |
| Make Success Target |
.DONE |
None |
| Make Fail Target |
.FAILED |
None |
| Keep State |
.KEEP_STATE |
None |
| Keep State File |
.KEEP_STATE_FILE |
None |
| Version Checking |
.MAKE_VERSION |
None |
| Forced Initial Targets |
.INIT |
None |
The .SUFFIXES target has different
defaults between Solaris 8 and HP-UX 11i. Table 5-3,
“Comparison of Default .SUFFIX Rules” gives a comparison.
Table 5-3. Comparison of Default .SUFFIX
Rules
| Solaris 8 |
HP-UX 11i |
| .o |
.o |
| .s .s~ .S .S~ |
.s .s~ |
| .c .c~ |
.c .c~ |
| .f .f~ .F.F~ |
.f .f~ |
| .ftn .ftn~ |
— |
| .f90 .f90~ |
— |
| .r .r~ |
.r .r~ |
| .y .y~ .Y .Y~ |
.y .y~ .Y .Y~ |
| .l .l~ .L .L~ |
.l .l~ .L .L~ |
| .ln |
— |
| .p .p~ |
.p .p~ |
| .sh .sh~ |
.sh .sh~ |
| .h .h~ |
.h .h~ .H .H~ |
| .C .C~ .cc .cc~ .cps .cps~ |
.C .C~ .cxx .cxx~ .cpp .cpp~ .cc
.cc~ |
| .def .def~ |
— |
| .sym |
— |
| .mod .mod~ |
— |
| .java .java~ |
— |
| .class |
— |
On HP-UX, you can specify additional suffixes in a makefile as
the dependents list for .SUFFIXES. These
additional values are added to the default values. Multiple suffix
lists accumulate. The order of the suffix list is significant. Refer
to man(1) for more information.
The list of suffixes built into make on
any machine can be displayed with the following command:
make -fp - 2>/dev/null
</dev/null
The list of suffixes built into a user makefile mymakefile can be displayed with the following
command:
make -fp mymakefile 2>/dev/null
</dev/null
HP provides three supported debuggers on HP-UX 11i:
-
The Wildebeest Debugger (WDB/GDB): The HP
WDB debugger is an HP-supported implementation of the GDB
debugger. It also supports source-level debugging of object files
written in HP ANSI C, HP aC++, HP Fortran, as well as gcc and g++. WDB 4.0
also contains support for run-time memory checking and core
dumping.
-
Absolute Debugger (abd): The adb debugger operates on assembly language
programs. It allows you to look at object files and core files
that result from aborted programs, to print output files in a
variety of formats, to patch files, and to run programs with
embedded breakpoints. The HP-UX 11i v2 adb debugger incorporates
the following new features: support for Lazyfp, Dual pdir,
debugging MxN threads in a process and core, debugging INIT and
MCA crash dumps, and debugging a shared library for an attached
process.
-
Q4: Q4 is a crash dump analysis and
kernel-debugging tool. It is the designated successor to QDB.
Unlike QDB, which can manipulate and print only the kernel data
structures that have been hardcoded into them, Q4 can manipulate
and print any kernel data structure that appears in the kernel's
symbol debug information.
The HP Kernel Debugger (KWDB) is a source-level kernel and driver
debugger for the HP-UX operating system. KWDB is based on WDB, the
user-space debugger. It also incorporates all the features of Q4.
Although KWDB is included in HP-UX 11i v2, HP does not provide
support for it.
Locating Debug Information |
 |
When the linker links object files, the Solaris 8 default
behavior is for the compiler to leave debug information in the
object files, not in the final executable. This is the same default
on HP-UX 11i v2. By default, HP-UX compiler sets +objdebug.
On Solaris 8, you specify the -xs compiler
option to force the compiler to put debug information into the final
executable at link time. This behavior is the default on HP-UX 11i
v1. To achieve the same behavior on HP-UX 11i v2, use the +noobjdebug option.
Solaris supports two debug formats: STABS and DWARF. You specify
the -xdebugformat compiler option to select
which format to be used when creating an executable. On HP-UX IPF
platforms, the default debug format is DWARF when using the
system-supplied compiler. To create executables with the STABS
format, you need to use gcc with the -gstabs option.
There is no need to change the debug format of an executable file
unless you maintain software that reads debugger, or object file,
information.
Debugging Shared Libraries |
 |
Shared library debugging is disabled by default on HP-UX 11i. To
debug shared libraries you must either:
-
Start the program from the debugger. For
example:
% gdb
./a.out
-
Or, enable shared library debugging in the
executable you are running.
The debugger will not be able to place breakpoints in shared
library routines unless the process has a private copy of the shared
library. If you start a program under the debugger, then the right
things happen and the process will get private copies of shared
libraries, enabling you to debug them. However, if you attach to a
running process, then you may receive a message that the debugger is
unable to write breakpoints.
Debugging on HP-UX with WDB |
 |
The HP WDB 4.2 debugger is an HP-supported implementation of the
GNU debugger, gdb version 5.0. It supports
source-level debugging of programs written in HP C, HP aC++, and
Fortran 90 on HP-UX Release B.11.20 and later. This release only
works on programs compiled for the Itanium® architecture.
The most recently released version of HP WDB is available at:
http://www.hp.com/go/wdb/
This section describes the behavior and some of the more commonly
used features of WDB.
| |
Deferred Watchpoints |
 |
When you try to set a watchpoint in an expression, HP WDB places
a deferred watchpoint if it cannot evaluate the expression. The
watchpoint is automatically enabled whenever the expression can be
evaluated during the program's execution. This is especially useful
when placing the watchpoints on unallocated addresses.
| |
Thread Information |
 |
The WDB info threads command output now
shows the priority of a thread along with other thread information.
For example:
(gdb) info threads
* 4 system thread 65949 Priority:152 0x4000a40:2 in myfunction() at source.c:11
3 system thread 65947 Priority:151 0x200000007ee869b0:0 in __ksleep+0x30
() from /usr/lib/hpux32/libc.so.1
2 system thread 65946 Priority:137 0x200000007eff4d10:1 in _asm_break+0x1
() from /usr/lib/hpux32/dld.so
1 system thread 65942 Priority:152 0x200000007eff4d10:1 in _asm_break+0x1
() from /usr/lib/hpux32/dld.so |
| |
List of Substitution Rules |
 |
A new command, pathmap, allows you to
define a list of substitution rules to be applied to path names to
identify object files and the corresponding source files. The pathmap command, however, may not find source
files if the object files are not available.
This minimizes or eliminates the need to specify multiple objectdir commands when object files are moved
from the compilation directories, or when compilation directories
are mounted over NFS.
To use this feature, your program must be compiled with the +objdebug option, which is the default. For
information on how pathmap works, enter
help pathmap at the HP WDB prompt.
| |
Mismatches Between a Library |
 |
HP WDB automatically detects mismatches between a library in a
core file and the library used by HP WDB when it is invoked on the
core file. Core library mismatch detection requires dld.so version B.12.21 on both the system used
for compiling and the system used for debugging.
The debugger shows a list of the mismatched libraries. You must
then provide the location of the correct libraries. For example, you
can set the GDB_SHLIB_PATH environment
variable to point to the correct directories.
A core library mismatch can occur when a core file is produced on
one computer and debugged on another. The libraries used by the
executable when it produced the core file on one computer may not be
the same on another. Libraries that might cause this problem include
libc and libm. They
may also include libraries specific to your executable.
| |
Batch Mode Memory Leak Detection |
 |
HP WDB supports batch mode memory leak detection, also called
batch Run Time Checking (RTC). You can specify the batch mode
configuration through a configuration file called rtcconfig.
The configuration file supports these variables:
| heap=on|off |
|
To enable leak detection. |
| leaks=on|off |
|
To enable heap info. |
| scramble_blocks=on|off |
| |
|
To enable block scrambling. |
| min_leak_size=block_size |
| |
|
Minimum block size to use for leak
detection. |
| frame_count=no_frames |
| |
|
Number of frames to be printed for leak
context. |
| output_dir=output_data_dir |
| |
|
Name of the output data
directory. |
| files=file1:file2:...|fileN> |
| |
|
Executables for which memory leak
detection is enabled. |
Batch mode leak detection stops the application at the end, when
libraries are being unloaded, and invokes HP WDB to print the leak
or heap data.
To use batch memory leak detection:
-
Create an rtcconfig
file in the current directory.
-
Define a BATCH_RTC
environment variable. If you are using the Korn or POSIX shell,
enter export BATCH_RTC=on.
-
Start the target application by defining LD_PRELOAD of librtc.
For example:
LD_PRELOAD=/opt/langtools/lib/hpux32/librtc.sl application_name
LD_PRELOAD=/opt/langtools/lib/hpux64/librtc.sl application_name |
-
At the end of the run, an output data file
is created in the directory output_data_dir
if output_data_dir is defined in the rtcconfig file or if it is defined in the
current directory.
HP WDB creates output data file for each
run. It creates a separate file for leak detection and heap
information.
The naming convention for output files is
file_name.pid.suffix.
The value for suffix can
be either leaks or heap.
Batch memory leak detection uses these environment variables:
| GDBRTC_CONFIG |
|
Specifies the location of rtcconfig. |
| BATCH_RTC |
|
Enables or disable batch memory leak
detection. |
| GDB_SERVER |
|
By default, memory leak detection uses
/opt/langtools/bin/gdb to print the
output. You can override this executable by setting GDB_SERVER. |
| |
Alternate Root Functionality |
 |
HP WDB supports alternate root functionality, which is helpful
when you do not want to use the system-installed HP WDB or its
components.
The WDB_ROOT environment variable
specifies the alternate root for HP WDB. You must specify a
structure similar to the default /opt/langtools used for HP WDB. You can use the
environment variable GDB_ROOT to specify an
alternate root for GDB.
If you specify WDB_ROOT and GDB_ROOT, the value for GDB_ROOT is ignored.
HP WDB supports the following environment variables shown in Table 5-4,
“Supported Environment Variables” to override the location of
different components of HP WDB.
Table 5-4. Supported Environment
Variables
| Defined Variable |
WDB Location |
GDB Location |
librtc.sl Location |
| None |
/opt/langtools/bin |
/opt/langtools/bin |
/opt/langtools/lib |
| WDB_ROOT |
$WDB_ROOT/bin |
$WDB_ROOT/bin |
$WDB_ROOT/lib |
| GDB_ROOT |
Not applicable |
$GDB_ROOT/bin |
/opt/langtools/bin |
| GDB_SERVER |
Not applicable |
$GDB_SERVER |
Not applicable |
| LIBRTC_SERVER |
Not applicable |
Not applicable |
$LIBRTC_SERVER |
| |
Printing of Locals and Global
Variables |
 |
HP WDB cannot print the local and static variables declared in a
module that has been stripped. However, it prints the exported
symbols because exported symbols are not stripped by the strip command; they remain in .dynsym file.
HP WDB can access the globals or locals defined in other
nonstripped shared libraries loaded into the stripped executable
when you are in the appropriate scope.
| |
Using Breakpoints |
 |
HP WDB places breakpoints using symbol names in the unstripped
shared libraries loaded into the stripped executable. However, in
stripped binaries, it cannot insert breakpoints using line numbers
or symbolic names of the symbols not in the export list.
HP WDB can also backtrace properly stripped frames; however,
arguments will not be displayed, just like binaries that are
compiled without the -g option. For fully
stripped binaries, program counters (PCs) will be displayed but
function names will not.
A known problem is that HP WDB displays improper function names
instead of unknown_procedure for the symbols
that are not known.
HP WDB versions earlier than 4.2 cannot backtrace through
stripped binaries.
| |
Command-Line Calls |
 |
Command-line calls to the nonstripped library work correctly when
called while stopped in a stripped binary or elsewhere. Command-line
calls to the functions (exported symbols) in the stripped binary
work correctly.
| |
Debugging at the Machine-Instruction
Level |
 |
The commands in the following sections let you debug at the
machine level.
The result of the disassemble command is the assembler's dump for
all of the assembly code lines from the start of the function in
which this address is located. The disassem
command of WDB does not take any count argument. If there is only a
single argument to disassem, it has to be a
valid memory address. If you have the source code for the program,
the best way to produce assembly code is to use cc's -S option, which
writes out the assembly language code into a file with a .s extension.
To dump assembler code for the entire function, enter:
(gdb)disas <name of function>
To dump assembler code for the specified frame, enter:
(gdb)disas <begin_address> <end_address>
To dump assembler code, enter:
(gdb)disas <single_address>
The following example uses the WDB x/i
command to examine the machine-level instruction at a specified
address and register value:
(gdb) x/i 0x20000000792993c0 0x20000000792993c0:0 :
mov.m r31=ar.k7
Use the x/i command to examine the
individual assembly code corresponding to an address. Note that for
examining the memory contents of an associated address, both examine and x are valid
commands on Solaris; however, there is no examine command in WDB. HP WDB cannot display
disassembly for fully archived stripped binaries.
To break at the start of the function, enter:
(gdb) break <function>
To break at the exact address, enter:
(gdb) break <address>
To break at the line number in the current source file, enter:
(gdb) break <number>
To break at the line number in a specified source file, enter:
(gdb) break <filename:number>
To look at all the breakpoints set so far, enter:
(gdb) info breakpoints
To disable a breakpoint, enter one of the following commands:
(gdb) disable <breakpoint_number>
(gdb) dis <breakpoint_number>
To enable a breakpoint, enter one of the following commands:
(gdb) enable <breakpoint_number>
(gdb) en
<breakpoint_number>
You can use the b command as an alias for
break or breakpoints.
Substituting b in all the previous examples
will suffice. There is no WDB equivalent to the Solaris stopi command. Use the WDB break command to get a specific memory
address, and then use the x/i
command to see its associated assembly code.
Both the Solaris nexti command
and the WDB nexti command step one
machine instruction at a time. The difference is that Solaris dbx shows the memory address with the associated
machine instruction; WDB shows the memory address being stepped
through with the associated source code line.
To see all integer registers, enter one of the following
commands:
(gdb) info registers
(gdb) i
r
To see all registers, including floating-point registers, enter
one of the following commands:
(gdb) info all
(gdb) i
all
To see a specific register, enter one of the following
commands:
(gdb) info register $pc
(gdb) i
r $pc
For more information on the Intel®
Itanium® registers, go to:
http://www.intel.com/design/itanium/manuals.htm
To avoid repeatedly entering the same command, press the Enter
key to repeat the last command executed.
The WDB r command is short for both run and rerun on
Solaris.
The following additional commands are available when you invoke
the command line gdb with both the -xdb and -tui options:
| fr, gr, sr |
|
Show floating-point, general, special
registers. |
| td |
|
Toggles between source and disassembly
display. |
| tf |
|
Toggles floating-point register display
precision. |
| ts |
|
Toggles between split
(Source/Disassembly/Command) and Source/Command or
Disassembly/Command. |
| u |
|
Updates the screen to the current
execution point. |
Use the help command to see a
brief online description of the command:
(gdb) help <command_name>
Tuning the performance of an application on a new platform is a
critical piece of the porting process. Profiling tools to determine
bottlenecks in performance are a key piece in tuning performance.
This section discusses some of the tools available for profiling
your applications on HP-UX 11i.
HP Caliper |
 |
HP Caliper is a general-purpose performance analysis tool, as
well as a profile-based optimization tool invoked by HP compilers.
HP Caliper works with any Itanium®-based binary and does not require
your applications to have any special preparation to enable
performance measurements.
The latest HP Caliper 3.5 includes support for Itanium®
processors running HP-UX 11i v2 or later operating systems with the
following major features:
-
Kernel-level profiling of target
application, including CPU event and cycles measuring.
-
Allows users to choose to save
data-cache-miss information to a program's profile data file
instead of arc and stride data.
-
Disassembly listings (template types,
symbolic branch targets, branch targets as function offsets,
optional marked branch target instructions)
-
Performance data aggregation across multiple
runs of an application.
-
Reports in CSV (comma-separated values)
format for importing into spreadsheets.
-
Process selection options to measure
multiple auto-invoked processes using a single HP Caliper
process.
-
Full support for AAS executables
(applications using Adaptive Address Space).
-
Easy inclusion and exclusion of specific
load modules, such as libc, when measuring
performance.
| |
Optimizing with the Compiler |
 |
Caliper works with the HP compiler to optimize a user's
application, as follows:
-
Compile your program with the option +Oprofile=collect:
> cc -Aa +03 +Oprofile=collect program.c |
-
Run a.out so that
Caliper can generate the flow.data file in
the current directory:
-
Use flow.data file
as input to the compiler on subsequent recompiles:
> cc -Aa +03 +Oprofile=use program.c |
For large applications, compare the performance results by
running the executable obtained from the previous steps against
running the executable obtained from regular compilation. For
detailed performance comparison, run Caliper on the executable with
a configuration file, such as total_cpu.
| |
Performing a Call Graph Profile
Analysis |
 |
Caliper can produce a call graph profile report similar to gprof, which includes results like the
following:
-
Total execution times for each function in
the program.
-
Call counts for each function in the
program.
-
Cycle information, member functions, time
spent in a function, and call counts.
In the following example, Caliper analyses the file a.out and stores the analysis in the file caliper_output:
$ caliper cgprof -o caliper_output
a.out
You can use the results from Caliper outputs to determine the hot
spots in a program, giving you opportunities to enhance its
performance. For more usage and Caliper options, refer to the HP
Caliper User Guide, or use the caliper
--help command to access the online help.
HP Prospect |
 |
HP Prospect is a performance analysis tool available on HP-UX 11i
v1.5 or later operating systems.
HP Prospect is used to gather a statistical profile of all
processes running on a system as well as a profile of the system
itself. Prospect also gathers system call information for all
processes. Prospect does this by using the Kernel Instrumentation
(KI), the Kernel Timing Clocks (KTC), and by knowing about kernel
memory. Prospect does this without any special build requirements.
Prospect is very nonintrusive, generally requiring approximately
1 to 5 percent of the CPU when measuring, and approximately 15
percent after the run is done for analysis. Processes can run at
full speed and results skewing is minimal.
Kernel profiling is possible with the -V
kernel feature introduced with Prospect revision 2.1.0. There is no
requirement for a debug kernel build for this feature; the kernel
runs at full speed and under true load conditions.
GlancePlus |
 |
GlancePlus is an important component of the HP OpenView
GlancePlus Pak. GlancePlus is a real-time diagnostic tool. It can
collect approximately 1000 metrics at adjustable intervals down to
one second. GlancePlus is intended to provide a large amount of
detail information, collected at short intervals. You can use this
level of data to analyze current performance problems, bottlenecks
in the system, and give the information on why the system, an
application, or a process is having a problem.
Since collection of data is more frequent, and for a wider
variety of metrics, GlancePlus may introduce more overhead to the
system. The concept is that GlancePlus will be run at a short
interval when you are attempting to resolve a current problem and
need the quantity of metrics at a short interval to do this. In this
case the slight increase in overhead is acceptable.
Chapter 6. Threads and
Multiprocessing
The strategy for porting a threaded application to HP-UX depends
on which Sun threads package you are using. The available threads
implementations on Solaris include POSIX threads implementation,
Solaris UI threads implementation, and an alternative lightweight
process (LWP) threads implementation.
Solaris POSIX pthreads are a more portable
implementation of threads based on the POSIX thread standard
1003.1c. You are using POSIX threads if you link with -lpthread and use thread APIs prefixed with pthread_.
Solaris UNIX International (UI) threads refers to the SVR4.2MP UI
thread extensions developed by Sun and codified into the UNIX System
V SVID by the old UNIX International body. Solaris UI threads are
Sun's proprietary, nonportable implementation of threading. You are
using Solaris UI threads if you link with -lthread and use thread APIs prefixed with thr_.
Solaris LWP threads is an alternative threads implementation that
enables applications to create all threads attached to an LWP as
bound threads. You are using LWP threads if you link with -R/usr/lib/lwp on the compile line, or setting
the LD_LIBRARY_PATH variable to point to /usr/lib/lwp.
Only POSIX threads are supported on HP-UX 11i v2 and higher. Any
new application development should be done using the standard POSIX
threads implementation.
For more information on threads, refer to the POSIX Threads on HP-UX 11i white paper:
http://devresource.hp.com/drc/resources/pthread_wp_jul2004.pdf
HP-UX does not support libthread; you must
use HP-UX libpthread. The following sections
describe the differences and equivalences for the libthread and libpthread
thread packages.
Equivalent Library Routines |
 |
The libthread package only exists on
Solaris. Any application having dependency on interface routines
defined in this library will need to be identified in the code
migration. A number of the Solaris libthread
interface routines can be replaced by their functionally equivalent
HP-UX libpthread routines. To compile
successfully, you will also need to include pthread.h in your header files and modify the
existing makefiles to link with -l pthread on
HP-UX. See "Library
and Build Issues" for more information.
Table 6-1,
“Comparing Solaris libthread and HP-UX libpthread Routines”
lists the HP-UX libpthread equivalents to
Solaris libthread routines. More details on
each of these routines are in the HP-UX STK-S package, available
at:
http://devresource.hp.com/STKS/
Table 6-1. Comparing Solaris libthread
and HP-UX libpthread Routines
| Solaris libthread |
HP-UX libpthread |
| thr_create |
pthread_create |
| thr_exit |
pthread_exit |
| thr_join |
pthread_join |
| thr_kill |
pthread_kill |
| thr_self |
pthread_self |
| thr_yield |
sched_yield |
| thr_sigsetmask |
pthread_sigmask |
| thr_getprio |
pthread_getschedparam |
| thr_setprio |
pthread_setschedparam |
| thr_getconcurrency |
pthread_getconcurrency |
| thr_setconcurrency |
pthread_setconcurrency |
| thr_suspend |
pthread_suspend |
| thr_continue |
pthread_continue |
| thr_keycreate |
pthread_key_createpthread_key_delete |
| thr_setspecific |
pthread_setspecific |
| thr_getspecific |
pthread_getspecific |
| mutex_init |
pthread_mutex_init |
| mutex_destroy |
pthread_mutex_destroy |
| mutex_lock |
pthread_mutex_lock |
| mutex_trylock |
pthread_mutex_trylock |
| mutex_unlock |
pthread_mutex_unlock |
| cond_init |
pthread_cond_init |
| cond_destroy |
pthread_cond_destroy |
| cond_broadcast |
pthread_cond_broadcast |
| cond_signal |
pthread_cond_signal |
| cond_timedwait |
pthread_cond_timedwait |
| cond_wait |
pthread_cond_wait |
| rwlock_init |
pthread_rwlock_init |
| rwlock_destroy |
pthread_rwlock_destroy |
| rw_rdlock |
pthread_rw_rdlock |
| rw_tryrdlock |
pthread_rw_tryrdlock |
| rw_wrlock |
pthread_rw_wrlock |
| rw_trywrlock |
pthread_rw_trywrlock |
| rw_unlock |
pthread_rw_unlock |
| sema_init |
sem_init |
| sema_destroy |
sem_destroy |
| sema_post |
sem_post |
| sema_wait |
sem_wait |
| sema_trywait |
sem_trywait |
Thread Creation and Modifiable Thread
Attributes |
 |
On both platforms, the configuration of a set of attributes
defines the behavior of a thread. All attributes are either
user-defined or set to default at thread creation time for each new
thread. This section describes the default attribute value
differences and related functions to modify these thread attributes
dynamically.
Threads are created by the thr_create
routine using the Solaris libthread package,
and by the pthread_create routine using the
HP-UX libpthread package.
The thr_create routine either creates a
default thread or a thread whose attributes are defined by the
options and arguments passed to the thr_create routine. If any of these arguments
are passed in as NULL, the default setting in
Table 6-2,
“Default Threads Attribute Values” will take place when creating
a new thread.
The pthread_create routine creates a
thread with attributes defined by an object, pthread_attr. If pthread_attr is NULL, the
default values in Table 6-2,
“Default Threads Attribute Values” will take place when creating
a new thread.
Table 6-2. Default Threads Attribute
Values
| Attribute |
Solaris 8 (libthread) |
HP-UX 11i v2 (libpthread) |
| contentionscope |
Flags = NULLContention scope is
within the process. |
PTHREAD_SCOPE_PROCESS |
| detachstate |
Flags = NULLThread can be joined by
other threads. |
PTHREAD_CREATE_JOINABLE |
| stackaddr |
Stack_base = NULLAllocated by the
system. |
NULL |
| stacksize |
Stack_size = NULLDefault is 1 MB in
a 32-bit process, and 2 MB in a 64-bit process. |
256 KB |
| concurrency |
Flags = NULLDetermined by the
system. |
Determined by the system |
| suspended |
Flags = NULLCan be run, not
suspended. |
Not suspended |
| daemon |
Flags = NULLNot a daemon. |
Not
applicable |
Solaris libthread and HP-UX libpthread provide you with the ability to
customize thread attributes. The difference is that attribute
customization is done at thread creation time with Solaris UI
threads, while with HP-UX POSIX threads, the customization is done
before calling the pthread_create routine.
Solaris UI thread attributes are changed by passing in the
appropriate options, shown in Table 6-3,
“Thread Attributes Modification Functions”, to the thr_create routine.
Since POSIX thread attributes are defined in the object pthread_attr, customizing thread attributes with
POSIX threads requires you to first initialize the object, and then
use the functions in Table 6-3,
“Thread Attributes Modification Functions” to change the default
attributes, and finally create the new thread by passing the
initialized and changed object to the pthread_create routine.
For example:
pthread_attr_t attr;
/*initialize attr with default attributes*/
pthread_attr_init(&attr);
/* change contention scope attribute to system-wide resource competition */
pthread_attr_setscope(&attr, PTHREAD_SCOPE_SYSTEM);
pthread_create(&tid, &attr, start_func, arg); |
HP recommends that for POSIX thread creation, all attribute
objects be initialized and modified in the early stages of program
execution.
Table 6-3. Thread Attributes
Modification Functions
| Attribute |
Solaris 8 (libthread) |
HP-UX 11i v2 (libpthread) |
| contentionscope |
THR_BOUND: Flag to thr_create |
| PTHREAD_SCOPE_SYSTEM |
| pthread_attr_setscope |
| pthread_attr_getscope | |
| detachstate |
THR_DETACH:Flag to thr_create |
pthread_attr:=PTHREAD_CREATE_DETACHED
Object to
| pthread_attr_setdetachstate |
| pthread_attr_getdetachstate | |
| Concurrency |
THR_NEW_LWP:Flag to thr_create |
| pthread_getconcurrency |
| pthread_setconcurrency | |
| stack_size |
size_t stack_size: Variable to thr_create. THR_MIN_STACK is the minimum size. |
| pthread_attr_getstacksize |
| pthread_attr_setstacksize |
| PTHREAD_STACK_MIN is the
minimum size. | |
| stack_addr |
void* stack_base: Variable to thr_create |
| pthread_attr_setstackaddr |
| pthread_attr_getstackaddr | |
| suspended |
THR_SUSPENDED: Flag to thr_create |
Not applicable |
| Daemon |
THR_DAEMON: Flag to thr_create |
Not applicable |
| inheritsched |
Not applicable |
| pthread_attr_getinheritsched |
| pthread_attr_setinheritsched | |
| schedpolicy |
Not applicable |
| pthread_attr_getschedparam |
| pthread_attr_getschedparam |
| pthread_attr_getschedpolicy |
| pthread_attr_setschedpolicy | |
| guardsize |
Not applicable |
| pthread_attr_getguardsize |
| pthread_attr_setguardsize | |
| processor |
Not applicable |
| pthread_attr_getprocessor_np |
| pthread_attr_setprocessor_np | |
| binding_type |
Not applicable |
| pthread_processor_bind_np |
| Pthread_pset_bind_np | |
Although Solaris and HP-UX pthread
libraries implement the same POSIX 1003.1c standard, there are minor
differences due to unspecified parts of the standard and different
degrees of implementation. Table 6-4,
“Default pthread Attribute Values” shows the different default
values for a pthread_attr object.
Table 6-4. Default pthread Attribute
Values
| Attribute |
Solaris 8 (libpthread) |
HP-UX 11i v2 (libpthread) |
| contentionScope |
PHTREAD_SCOPE_PROCESS |
PTHREAD_SCOPE_PROCESS |
| detachstate |
PHTREAD_CREATE_JOINABLE |
PTHREAD_CREATE_JOINABLE |
| stacksize |
NULL The default is 1 MB in a
32–bit process, and 2 MB in a 64–bit process. |
256 KB |
| priority |
0 |
Not applicable |
| inheritsched |
PTHREAD_EXPLICIT_SCHED |
PTHREAD_INHERIT_SCHED |
| schedpolicy |
SCHED_OTHER |
SCHED_TIMESHARE |
| guardsize |
PAGESIZE (8 KB) |
PAGESIZE (4 KB) |
| processor |
Not applicable |
PTHREAD_SPUINHERIT_NP |
| Binding_type |
Not applicable |
PTHREAD_BIND_ADVISORY_NP |
Table 6-5,
“pthread Attribute Modification Functions” lists the standard
POSIX attribute modification functions that exist on both Solaris 8
and HP-UX 11i v2. These functions have identical interface and
equivalent functionality. HP-UX libpthread
also offers a few system-specific functions to tune HP-UX specific
thread attributes.
Table 6-5. pthread Attribute
Modification Functions
| API |
Difference |
| pthread_attr_init |
Initialize thread attributes to different default values.
See Table 6-3. |
| pthread_attr_destroy |
Compatible. |
| pthread_attr_getdetachstate |
| pthread_attr_setdetachstate | |
Compatible. |
| pthread_attr_getguardsize |
| pthread_attr_setguardsize | |
Default value of guardsize is PAGESIZE on both platforms; however, the
actual value of PAGESIZE is
implementation-dependent. |
| pthread_attr_getinheritsched |
| pthread_attr_setinheritsched | |
Compatible. |
| pthread_attr_getprocessor_np |
| pthread_attr_setprocessor_np | |
HP extension. |
| pthread_attr_getschedparam |
| pthread_attr_setschedparam | |
Compatible. |
| pthread_attr_getschedpolicy |
| pthread_attr_setschedpolicy | |
Compatible. |
| pthread_attr_getscope |
| pthread_attr_setscope | |
Compatible. |
| pthread_attr_getstackaddr |
| pthread_attr_setstackaddr | |
Compatible. |
| pthread_attr_getstacksize |
| pthread_attr_setstacksize | |
Compatible. |
Since Solaris libpthread and HP-UX libpthread both implement the POSIX 1003.1c
standard, the majority of the library routines have identical
interfaces and equivalent functionality. Table 6-6,
“pthread API Differences Between Solaris 8 and HP-UX 11i V2” and
Table 6-7,
“Synchronization Mechanisms” describe some of the implementation
differences between the same pthread
functions on both platforms.
Table 6-6. pthread API Differences
Between Solaris 8 and HP-UX 11i V2
| API |
Difference |
| pthread_create |
ENOMEM errno is not defined on
HP-UX. Use EAGAIN on HP-UX. |
| pthread_exit |
Compatible. |
| pthread_join |
If called by more than one thread, on HP-UX: one thread
returns undefined behavior for the others. If called by more
than one thread on Solaris, one thread returns and the others
return the ESRCH errno. |
| pthread_detach |
Compatible. |
| pthread_default_stacksize_np |
HP extension. |
| pthread_key_create |
The following values in /usr/include/sys/unistd.h are
different:
Solaris:
| _SC_THREAD_KEYS_MAX =
572 |
| _SC_THREAD_DESTRUCTOR_ITERATIONS =
568 |
HP:
| _SC_THREAD_KEYS_MAX =
431 |
| _SC_THREAD_DESTRUCTOR_ITERATIONS =
430 | |
| pthread_key_delete |
Compatible. |
| pthread_getspecific |
| pthread_setspecific | |
Compatible. |
| pthread_cancel |
Compatible. For more information on cancellation points,
refer to pthread(3T) on HP-UX. |
| pthread_testcancel |
Compatible. |
| pthread_setcancelstate |
Same default value: PTHREAD_CANCEL_ENABLE |
| pthread_setcanceltype |
Same default value: PTHREAD_CANCEL_DEFERRED |
| pthread_cleanup_pop |
Compatible. |
| pthread_cleanup_push |
Compatible. |
| pthread_suspend |
HP extension. |
| pthread_continue |
HP extension. |
| pthread_resume_np |
HP extension. |
| pthread_num_processor_np |
HP extension. |
| pthread_processor_bind_np |
HP extension. |
| pthread_processor_id_np |
HP extension. |
| pthread_getconcurrency |
| pthread_setconcurrency | |
POSIX extension on both Solaris and HP-UX. Compatible
between two systems. |
| pthread_getschedparam |
| pthread_setschedparam | |
Solaris: The priority values returned by pthread_getschedparam reflect any
temporary adjustment.
HP: The priority values returned by pthread_getschedparam represent the actual
scheduling (not any temporary) values. |
| sched_get_priority_max |
| sched_get_priority_min | |
See the legal values in <sched.h> on both systems. HP-UX has
no equivalence for the Solaris values SCHED_SYS, SCHED_IA
and _SCHED_NEXT. |
| sched_yield |
Solaris: On failure, returns -1,
but sets no errno value. HP: On failure, returns -1, sets ENOSYS. |
| pthread_kill |
Compatible. |
| pthread_sigmask |
Solaris: Unknown.
HP: If pending unblocked signal, at least one such signal
is delivered before function returns. |
| pthread_atfork |
Different #include file on HP-UX.
The order in which fork handlers are called are identical on
both systems. The prepare handler is called in LIFO,
parent/child handlers are called in FIFO. |
| pthread_equal |
Compatible. |
| pthread_once |
Compatible. |
| pthread_self |
Compatible. |
Table 6-7. Synchronization
Mechanisms
| API |
Difference |
| pthread_mutex_init |
Compatible.
Same default mutex attribute:
| PTHREAD_PROCESS_PRIVATE |
| PTHREAD_MUTEX_DEFAULT |
|
| pthread_mutex_destroy |
Compatible. |
| pthread_mutex_lock |
| pthread_mutex_trylock |
|
All four mutex types on Solaris are supported on HP-UX and
behave the same.
HP also has an extension mutex type: PTHREAD_MUTEX_NO_OWNER_NP
The Solaris errno extensions EOWNERDEAD and ENOTRECOVERABLE are not defined on
HP-UX. |
| pthread_mutex_unlock |
Compatible. |
| pthread_mutex_getprioceiling |
| pthread_mutex_setprioceiling | |
Scheduling priority may be changed. See sched_getpriority_max. |
| pthread_mutexattr_init |
Compatible.
Same default mutex attribute:
| PTHREAD_PROCESS_PRIVATE
|
| PTHREAD_MUTEX_DEFAULT | |
| pthread_mutexattr_destroy |
Compatible. |
| pthread_mutexattr_getprotocol |
| pthread_mutexattr_setprotocol | |
Compatible.
Same default: PTHREAD_PRIO_NONE |
| pthread_mutexattr_getpshared |
| pthread_mutexattr_setpshared | |
Compatible.
Same default: PTHREAD_PROCESS_PRIVATE. |
| pthread_mutexattr_gettype |
| pthread_mutexattr_settype | |
All four mutex types on Solaris are supported on HP-UX and
behave the same.
HP also has an extension mutex type: PTHREAD_MUTEX_NO_OWNER_NP. |
| pthread_mutexattr_getspin_np |
| pthread_mutexattr_setspin_np | |
HP extension |
| pthread_mutex_getyieldfreq_np |
| pthread_mutex_setyieldfreq_np | |
HP extension. |
| pthread_cond_init |
Compatible. |
| pthread_cond_destroy |
Compatible. |
| pthread_cond_signal |
Compatible. |
| pthread_cond_broadcast |
Compatible. |
| pthread_cond_wait |
Compatible. |
| pthread_cond_timedwait |
Compatible. |
| pthread_condattr_init |
Compatible with the same default: PTHREAD_PROCESS_PRIVATE |
| pthread_condattr_destroy |
Compatible. |
| pthread_condattr_getpshared |
| pthread_condattr_setpshared | |
Compatible with the same default attribute value: PTHREAD_PROCESS_PRIVATE. |
| pthread_rwlock_init |
Compatible. |
| pthread_rwlock_destroy |
Compatible. |
| pthread_rwlock_rdlock |
Compatible. |
| pthread_rwlock_tryrdlock |
Compatible. |
| pthread_rwlock_wrlock |
Compatible. |
| pthread_rwlock_trywrlock |
Compatible. |
| pthread_rwlock_unlock |
Compatible. |
| pthread_rwlockattr_init |
Compatible. |
| pthread_rwlockattr_destroy |
Compatible. |
| pthread_rwlockattr_getpshared |
| pthread_rwlockattr_setpshared | |
Compatible with the same default attribute value: PTHREAD_PROCESS_PRIVATE |
| sem_init |
Compatible.
Note that HP also allows semaphore re-initialization if and
only if the value argument is the same as the existing
semaphore value. |
| sem_destroy |
Compatible. |
| sem_post |
Solaris: if _POSIX_PRIORITY_SCHEDULING is defined, the
highest priority waiters will be unblocked; if not, the choice
of waiters to be unblocked is undefined.
HP-UX: if waiters have real-time priority, the
highest priority waiters will be unblocked; otherwise, waiter
at the head of the channel queue is unblocked. |
| sem_wait |
Compatible. |
| sem_trywait |
Compatible. |
| sem_open |
Compatible. |
| sem_getvalue |
Compatible. |
| sem_close |
Compatible. |
| sem_unlink |
Compatible. |
HP-UX 11i v1.6 and higher support an MxN threading model as well
as the older kernel (1x1) thread model. This increases the
similarity with Solaris 8, which is also based on two-level
scheduling and supports both MxN and 1x1 threading model.
In the 1x1 model, each user thread of a process corresponds to
exactly one thread in the kernel. The scheduling of all threads is
done by the kernel. One drawback is the large overhead for each
kernel thread when applications create a large number of threads.
In the MxN model, threads created by a process do not directly
correspond to a scheduled entity in the kernel; rather, a single
process may have multiple scheduled entities. Thread scheduling ends
up being split between user space and the kernel. The pthreads library (in user space) assigns user
threads onto kernel-scheduled entities, which in turn are scheduled
onto available processors by the kernel.
The MxN model allows applications to:
-
Support a larger number of threads.
-
Reduce kernel resource consumption.
-
Increase performance, due to faster context
switch, thread creation and synchronization.
On HP-UX 11i v2 or higher, use -DPTHREAD_COMPAT_MODE to retain the 1x1 thread
model.
Beware of the following differences between 1x1 and MxN threads
on HP-UX:
-
PTHREAD_SCOPE_PROCESS
becomes the default thread attribute for contention scope.
-
Scheduling policy from the sched_setparam and sched_setscheduler routines affect all
underlying activations. Internal helper threads may be created by
libpthread.
In addition, kernel entities used for
scheduling unbound threads may be cached by libpthread and may also show up in the output
of the pstat_getlwp and pstat_getproc routines. Therefore, an
application should not make any assumptions about the number of
kernel entities used by a multithreaded process.
-
Not supported for threads created with the
PTHREAD_SCOPE_PROCESS attribute are:
-
Per-thread interval timers in the setitimer and getitimer routines
-
The sigstack, sigaltstack, and sigspace routines
-
The pthread_launch_policy_np
routine
The HP-UX pthread
implementation also includes the X/Open thread APIs, and
additionally provides a number of nonportable thread calls
(suffixed with _np), which provide nearly a
superset of Solaris threads.
This section describes the library routines that have different
thread-safe levels on HP-UX than on Solaris, as well as
thread-related build and debug options.
Thread-Safe Libraries and Reentrant
Functions |
 |
Async-Signal-Safe describes whether a library routine can be
safely called from a signal handler. Using a lock mechanism,
Async-Signal-Safe routines will not cause threads to be in a
deadlock situation if interrupted by a signal.
Table 6-8,
“Differences in Async-Signal-Safe Routines ” describes the
Async-Signal-Safe level differences between Solaris 8 and HP-UX 11i
v2. APIs are only listed here if they exist on both platforms, and
the safety level on HP-UX 11i v2 is lower than the safety level on
Solaris 8.
Table 6-8. Differences in
Async-Signal-Safe Routines
| Function |
Solaris Safety Level |
HP-UX Safety Level |
| aio_error() |
Async-Signal-Safe |
Unsafe |
| aio_return() |
Async-Signal-Safe |
Unsafe |
| aio_suspend() |
Async-Signal-Safe |
Unsafe |
| clock_gettime() |
Async-Signal-Safe |
Unsafe |
| fdatasync() |
Async-Signal-Safe |
Unsafe |
| fsync() |
Async-Signal-Safe |
Unsafe |
| sem_post() |
Async-Signal-Safe |
Unsafe |
| timer_getoverrun() |
Async-Signal-Safe |
Unsafe |
| timer_gettime() |
Async-Signal-Safe |
Unsafe |
| timer_settime() |
Async-Signal-Safe |
Unsafe |
Table 6-9,
“Interfaces Not Thread-safe on HP-UX 11i v2” lists all the
routines that are part of libc, libpthread, and libgen
that are not thread-safe on HP-UX 11i v2.
Table 6-9. Interfaces Not Thread-safe on
HP-UX 11i v2
| bgets |
endmntent |
getchar_unlocked |
putc_unlocked |
| bufsplit |
fattach |
getopt |
putchar_unlocked |
| copylist |
fdetach |
inet_ntop |
setmntent |
| dbmclose |
fetch |
inet_pton |
store |
| dbminit |
firstkey |
isastream |
strord |
| delete |
getc_unlocked |
nextkey |
strtold |
On both Solaris 8 and HP-UX 11i v2, if an
interface has a _r counterpart, the then _r interface is thread-safe and the non-_r interface is not thread-safe.
For more information, see thread_safety(5) for HP-UX
systems.
Building Multithreaded Applications |
 |
On both Solaris and HP-UX platforms, multithreaded applications
must be compiled and linked with the choice of threads library. On
HP-UX 11i v2, the following compiler options and defines are related
to building a multithreaded program with the pthread library:
| -mt |
|
Enables multithreading, which
automatically sets the following compile-time defines and link
option: -D_REENTRANT-D_POSIX_C_SOURCE_199506L-lpthread |
| -Aa |
|
Specifies ANSI C mode compilation, which
limits the available interfaces. |
| +tls=mode |
|
Controls whether Thread Local Storage
(TLS) is referenced dynamically (default) or statically.
|
| -D_THREAD_SAFE |
|
Links with the thread-safe versions of
cout, cin, cerr, and clog
routines if the application is not using locks. |
| -D_XOPEN_SOURCE_EXTENDED |
| |
|
Includes X/Open interfaces. |
| -D_HPUX_SOURCE |
|
Includes HP-UX sources. |
| -DRWSTD_MULTI_THREAD |
| |
|
Required to use the multithreading
capability of the Rogue Wave Standard C++ library 2.2.1
supported on HP-UX. |
| -DRW_MULTI_THREAD |
| |
|
Required to use the Rogue Wave Tools.h++
7.0.6 library. |
Table 6-10,
“Build Matrix for Multithreaded Programs” compares what is
needed to build a threaded application for each platform.
Table 6-10. Build Matrix for
Multithreaded Programs
| Thread Package |
Compiler Flags/Defines |
Link Library |
#include File |
| Solaris UI threads |
-D_REENTRANT -mt |
-lthread |
thread.h |
| Solaris pthreads |
-D_REENTRANT -mt |
-lpthread |
pthread.h |
| HP-UX pthreads (HP C Compiler prior to 11i v1.6) |
-D_POSIX_C_SOURCE=199506L |
-lpthread |
pthread.h |
| HP-UX pthreads (compiler on and after 11i v1.6) |
-mt |
-lpthread |
pthread.h |
The following example shows the compile line to compile prog.c on HP-UX 11i v2 for C++ applications:
aCC -mt prog.C for C++ applications |
The following example shows the compile line to compile prog.c on HP-UX 11i v2 for C applications:
cc -mt prog.c for C applications |
Multithreaded Application
Performance |
 |
On HP-UX, applications with many threads (many more threads than
processors) that frequently contend for mutexes may suffer
performance degradation due to process scheduling that can result in
process (thread) priority inversion. In normal timesharing
scheduling, a process priority will become weaker the longer it runs
and stronger the longer it is blocked until eventually a running
process can get preempted.
A running thread holding a mutex can get preempted by a thread
trying to obtain a lock on the mutex, which immediately is blocked
and cannot run, maintining its strong priority value. The thread
holding the mutex still has a weak priority and does not get enough
run time to release the mutex.
HP-UX has alternate process scheduling algorithms that a process
can set using the rtsched command
or the sched_setscheduler API (with the
required privilege). The non-aging scheduler (SCHED_NOAGE) can be used to avoid the priority
inversion, restoring good performance. The SCHED_NOAGE scheduler is a variation of the
normal timesharing scheduler in which process or thread priorities
do not age and a process is not preempted until its time slice runs
out.
For example, a command could be run using the alternate SCHED_NOAGE scheduler:
rtsched -s SCHED_NOAGE -p 178 command |
For more information, see the rtsched(1)
manpage.
You can also do this with the sched_setscheduler API, for example:
#include <sched.h>
struct sched_param schedParam;
int sched_stat;
schedParam.sched_priority = sched_get_priority_max(SCHED_NOAGE);
sched_stat = sched_setscheduler(0, SCHED_NOAGE, &schedParam); |
To use either the rtsched
command or sched_setscheduler, the user must
either be root or a member of a group having
PRIV_RTSCHED access (see setprivgrp(1M)).
Debugging |
 |
WDB supports setting breakpoints on a particular thread,
traversing between threads, choosing to continue to debug either a
parent or child after a fork, and other thread-specific actions. WDB
stops all threads if one is stopped. Single-stepping a particular
thread does not lock-step the other threads, which may execute one
or many instructions, and reach a breakpoint or signal.
HP WDB 4.2 is the recommended debugger for Itanium®-based systems running HP-UX 11i v1.6
or later. This version of the WDB has the capability to show a
thread's priority along with other debug information.
For more information, see the WDB home page at:
http://www.hp.com/go/WDB
False cache-line sharing is a form of cache thrashing. It occurs
whenever two or more threads in a parallel program are assigning
values to different data elements in the same cache line. To avoid
false cache sharing in parallel programs, put data accessed by
different threads far away (> 64 bytes) from each other. Aligning
such data on a 64-byte boundary should be sufficient.
You can configure the maximum number of threads per process. The
max_thread_proc kernel parameter controls the
number of threads per process and must be changed by the system
administrator.
Chapter 7. System Libraries and
APIs
This chapter discusses the differences in system libraries, their
associated APIs, and some information on developing your own
libraries. For more information on system libraries and APIs, see
the manpages, release notes, the HP-UX Linker and
Libraries User's Guide, and the STK Web site.
The 64-bit libraries on HP-UX 11i v1 and all libraries on HP-UX
11i v1.6 and later use the ELF (Executable and Linking Format)
standard for both 32-bit (ELF32) and 64-bit (ELF64) applications.
HP-UX 11i v1.6 and higher do not provide system libraries in
archive format, and the use of archive libraries has been deprecated
in HP-UX 11i v1. This change was introduced to reduce the number of
issues caused by symbol collisions between archived and shared
libraries. HP-UX 11i and Solaris both use dynamically bound
applications by default.
This section discusses some APIs that are available on Solaris
and not available or have different behaviors on HP-UX 11i. Many of
these are BSD-specific APIs that have been replaced by POSIX
interfaces or areas where the standard is not specific.
Details on specific APIs can be found in the appropriate
manpages. HP-UX 11i uses both numbers and letters to provide a finer
granularity. Table 7-1,
“System APIs Library Availability” describes the major manpage
groups for HP-UX 11i APIs.
Table 7-1. System APIs Library
Availability
| Reference Section |
Description |
Location |
| 2 |
System calls |
libc |
| 3C |
Standard libc routines |
libc |
| 3S |
Standard I/O routines |
libc |
| 3M |
The math library |
libm |
| 3G |
The graphics library |
Graphics library |
| 3I |
The instrumentation library |
Instrumentation support library |
| 3X |
Various specialized libraries |
Library names documented in the
manpages |
Library Comparison |
 |
The system run-time library (libc)
provides similar functionality on both Solaris and HP-UX 11i. Both
Solaris and HP-UX 11i provide UNIX 95 and at least partial UNIX 98
compliance. Applications developed based on these standards are
highly portable. Due to the size, a direct comparison of all APIs is
beyond the scope of this guide. The Solaris to HP-UX Software
Transition kit includes an API analyzer that can be used for this
task. The Solaris to HP-UX Software Transition kit is available for
download at:
http://devrsrc1.external.hp.com/STKS/
See Appendix C. Library
Equivalence for a list of library equivalence between
Solaris and HP-UX.
Statically linking libc is not supported
on HP-UX 11i v1 and is not available on HP-UX 11i v1.6 and higher.
On HP-UX 11i, the libdl library is
automatically linked in by libc. A small
archive library, libcres.a, is provided if
you are running performance-critical applications and wish to link
statically.
Beginning with HP-UX 11i v1.5, the linking with libcres.a is handled automatically when an
application includes the appropriate header file for the provided
API, for example, string.h for strcpy. It is required to include the relevant
header files to take advantage of the library. When the header files
are not included, libcres routines are not
linked in, even if this library is explicitly linked.
The functions included in libcres.a are
as follows:
The functions in libcres
cannot be preempted but libc functions can
be. Therefore, user libraries cannot contain functions with these
names when using libcres. Detailed
information on the use of libcres.a is
available from the libcres.a(5) manpage.
The math library (libm) on HP-UX 11i v2
provides C99 math compliance. HP aC++ provides support for float (32-bit), double
(64-bit), extended (80-bit), and long double (128-bit) floating-point
calculations. The extended type is not
enabled by default and requires the -fpwidetypes option.
By default, HP-UX 11i does not set the errno value for the math functions, allowing for
better performance. Applications requiring this functionality should
use the +Olibmerrno option. HP Fortran also
uses libm for its math functions; support is
included for real*4 (32-bit), real*8 (64-bit), and real*16 (128-bit) floating-point
calculations.
Memory Management |
 |
The return value of malloc when passed a
zero size is undefined by the standards. Both Solaris and HP-UX
return a valid pointer in this case.
It is possible for 64-bit and 32-bit applications to share a
memory region. On Solaris, applications share VM resources using the
shmget function with the SHM_SHARE_MMU option. HP-UX provides additional
options for shmget and mmap to request 32-bit addressable memory
regions.
On HP-UX 11i, if a 64-bit application requests a shared memory
segment using the shmget function with the
IPC_SHARE32, the segment allocated will be
directly accessible by both 32- and 64-bit applications. A similar
function is also available for mmap. The mmap MAP_ADDR32 option
will return a 32-bit addressable memory region.
The shmget(2) and mmap(2) manpages contain more
information on the sharing of memory between 32- and 64-bit
applications.
String Manipulation |
 |
The string manipulation routines may encounter different behavior
on HP-UX 11i than on Solaris. Most of these interfaces can be
affected by the state of the Zero Page, the page of memory beginning
at address 0. Solaris will trigger a fatal segmentation fault (SEGV) if a NULL pointer is passed to these APIs.
On HP-UX 11i, reading and writing to the Zero Page is allowed by
default. This behavior is controlled by the -z/-Z options. If Zero Page
reads and writes are allowed, then the string routines will act as
though they were handed a zero-length string. To reduce the
differences in these APIs between Solaris and HP-UX 11i, use the
-z linker option. However, as this is not the
default on HP-UX 11i, third-party libraries and applications may not
have been tested with this configuration.
Process Tracing |
 |
The ptrace function has been deprecated
in HP-UX 11i v1 and is not available on HP-UX 11i v2. There is no
replacement interface; however, the ttrace(2) and the
pstat(2) family of functions may be able to provide
functional equivalents.
System Information |
 |
The uname(2) system API and the uname(1)
command return the system node name. The length of these fields is
not defined by any standard. HP-UX 11i uses an 8-byte
null-terminated string. If the node name is longer than eight
characters, then the value returned by the uname function or command will be truncated on
HP-UX 11i. To avoid this problem, use system names that have eight
characters or less. The node name field is expected to be expanded
in a future release of HP-UX 11i.
The utsname structure on HP-UX 11i also
contains an additional member: __idnumber.
The __idnumber field contains a unique
identification number within that class of hardware, possibly a
hardware or software serial number. This field contains a null
string if there is no identification number.
On Itanium®-based systems, this
number may not be unique. To get a unique ID, use the _CS_MACHINE_IDENT option of
confstr(3C).
Loading an additional shared library during execution can be done
in the same manner for both HP-UX 11i and Solaris by using dlopen. However, there are differences in the
process as well as some different APIs are also available.
HP-UX 11i requires that to use dlopen, or
any of the dl* routines, you must link with
libdl (-ldl).
The dladdr(3C), dlerror(3C), and
dlclose(3C) functions are functionally compatible between
Solaris 8 and HP-UX 11i. The Dl_info
structure on HP-UX has three more additional field members than
Solaris. These three additional fields enable the dladdr function on HP-UX to return not only just
the closest symbol name associated with the address, but also the
symbol size, binding information, and symbol type information.
The Solaris functions dldump, dlinfo, and dlmopen are
not available on HP-UX 11i.
This section discusses issues related to the development and
support of nonsystem libraries. Developing libraries requires a
complete understanding of the linker and loader environments.
Additional issues that may affect your library are discussed in Chapter 4. Linkers
and loaders .
Versioning Shared Libraries |
 |
On HP-UX 11i, System V library-level versioning must be used.
HP-UX 11i does not automatically set the internal name of a
shared object. You must specify the +h option
on the linker command line to set the internal library name. If
there is no internal name provided in the library, the linker places
the primary name of the file (it does not traverse symbolic links)
in the dependency list of the executable. This means that the
application will not use versioned forms of the library, and will
always use the file the symbolic link references at the time of
execution.
The internal library name is set to include the version number.
After linking the versioned library name to the .so name, link your application normally by
specifying -lfoo. The linker uses the
internally stored name of the library. If it is not available, the
actual file name is used to construct the application or library's
dependency information. Symbolic links are not traversed before
storing the library name.
In the future, the loader will still find libfoo.so.2 using the stored name from the
dependency information, even if libfoo.so is
now linked to another file. Example 7-1,
“Library-Level Versioning” shows an example of library-level
versioning.
Example 7-1. Library-Level
Versioning
% ld -b foo.o +h libfoo.so.2 -o libfoo.so.2
% ln -s libfoo.so.2 libfoo.so
% cc +DD64 -lfoo hello.c -o hello |
Libraries that provide support for multiple versions will require
a new method; multiple libraries will need to be provided. These may
be actual files or symbolic links to a central library, which is
versioned as the highest level supported. Example 7-2,
“Library-Level Versioning For Multiple Version Support” shows an
example of library-level versioning for multiple version support.
Example 7-2. Library-Level Versioning
For Multiple Version Support
% ld -b foo.o +h libfoo.so.3 -o libfoo.so.3
% ln -s libfoo.so.3 libfoo.so
% ln -s libfoo.so.3 libfoo.so.2
% ln -s libfoo.so.3 libfoo.so.1 |
This allows applications requiring prior versions of the
libraries to still run, while newly developed applications will
still be linked against the latest version. Extra care must be taken
to ensure that the newer version of the library is completely
compatible with previous versions if this method of versioning is
used.
Dependencies |
 |
If you wish to ensure that your library includes all its
dependent libraries (and resolves all symbols) without building an
application, there are ways to determine if your library is
complete. Use the +allowunsats and +noallowunsats linker options.
By default, when building a library, unresolved symbols are
allowed and not reported. For example:
$ cc -b -o libhello.so hello.c |
The +allowunsats option reports unresolved
symbols as warnings:
$ cc -b -o libhello.so -Wl,+allowunsats hello.c
ld: (Warning) Unsatisfied symbol "printf" in file hello.o
ld: (Warning) Unsatisfied symbol "close" in file hello.o
ld: (Warning) Unsatisfied symbol "write" in file hello.o
ld: (Warning) Unsatisfied symbol "open" in file hello.o
ld: (Warning) Unsatisfied symbol "read" in file hello.o
5 warnings. |
+noallowunsats reports the unresolved
symbols as fatal errors:
$ cc -b -o libhello.so -Wl,+noallowunsats hello.c
ld: Unsatisfied symbol "printf" in file hello.o
ld: Unsatisfied symbol "close" in file hello.o
ld: Unsatisfied symbol "write" in file hello.o
ld: Unsatisfied symbol "open" in file hello.o
ld: Unsatisfied symbol "read" in file hello.o
5 errors. |
Another option is to use the ldd tool. The ldd option -r will
attempt to resolve all text and data symbols. Any unresolved symbols
will be reported. For example:
$ ldd -r libhello.so
symbol not found: printf (./libhello.so)
symbol not found: close (./libhello.so)
symbol not found: write (./libhello.so)
symbol not found: open (./libhello.so)
symbol not found: read (./libhello.so) |
Library Permissions |
 |
Shared libraries on HP-UX 11i must have execute permission to be
mapped at run time. Shared libraries that do not have execute
permission will cause the following run-time error:
/usr/lib/hpux32/dld.so: Mmap failed for library<./libB.so> :
Permission denied. |
Support for Weak Symbols |
 |
The ELF file format provides support for global, local, and weak symbols. Creating these symbols requires
support from the compiler. The HP C and HP C++ compilers do not
provide support for weak symbols.
The HP-UX 11i v2 assembler (/usr/ccs/bin/as) provides support using the .weak directive. Example 7-3,
“Weak Function Binding Using ASM” defines weakfunc to be a weak binding to func. Details on the assembler can be found in
the Itanium™
Architecture Assembly Language Reference Guide.
Example 7-3. Weak Function Binding Using
ASM
.radix C
.psr abi64
.psr msb
.section .text, "ax","progbits"
.global func
.proc func,weakfunc
.weak weakfunc
func:
weakfunc:
add r10 = -48, sp
add r8 = 0, r0
br.ret.dptk.few rp ;;
.endp func |
The init/fini Routines |
 |
The routines used to handle initialization and cleanup
(finalization) are referred to as the init
and fini routines, respectively. HP-UX 11i
uses compiler pragmas and linker options to determine that functions
are init or fini
routines. This section discusses how to implement init/fini routines on
HP-UX 11i.
The init routines are called prior to
program startup, or when a shared library is loaded. These routines
are defined to take no arguments and return no value. You can
specify init routines by using:
#pragma init "init1"
void init1(void) {
⋮
} |
You can also specify them on the link line:
ld -b +init init1 +h libfoo.so -o
libfoo.so foo.o
The fini routines are called upon return
from user code or when a shared library is unloaded. Like init routines, these routines are also defined to
take no arguments and return no value. You can specify fini routines by using:
#pragma fini "fini1"
void fini1(void) {
⋮
} |
You can also specify them using the link line:
ld -b +fini fini1 +h libfoo.so -o
libfoo.so foo.o
| |
Execution Order |
 |
HP-UX 11i relies on the order of command-line options, and the
order in that the routines are defined in the source, to provide a
strongly defined means of ordering init/fini routines.
The order in which the init and fini routines are executed is determined by the
order of discovery. The init routines are run
in reverse order of discovery; fini routines
are run in the order they were discovered. Discovery is defined by
the order of the link line, the order of the linker options, and the
order of the functions in the source files. Functions specified on
the link line using +init or +fini are considered discovered in the order they
are specified and before any functions specified using the pragma
directives.
| |
init/fini Usage |
 |
The examples in this section consist of three shared libraries,
lib1.so, lib2.so,
and lib3.so. None of these libraries depend
on another, and the executable (init_test)
depends on all three libraries.
Example 7-4,
“lib1.c Listing” uses the compiler pragmas to specify
initializers and cleanup routines.
Example 7-4. lib1.c Listing
#include <stdio.h>
#pragma init "lib1_init1"
#pragma init "lib1_init2"
#pragma fini "lib1_fini1"
#pragma fini "lib1_fini2"
void lib1() {
printf("lib1\n");
}
void lib1_init1() {
printf("lib1 init1\n");
}
void lib1_init2() {
printf("lib1 init2\n");
}
void lib1_fini2() {
printf("lib1 fini2\n");
}
void lib1_fini1() {
printf("lib1 fini1\n");
} |
Example 7-5,
“lib2.c Listing” uses the linker options to specify initializer
and cleanup routines.
Example 7-5. lib2.c Listing
#include <stdio.h>
void lib2() {
printf("lib2\n");
}
void lib2_init() {
printf("lib2 init\n");
}
void lib2_fini() {
printf("lib2 fini\n");
} |
Example 7-6,
“lib3.c Listing” uses both the linker options and the compiler
pragmas to specify initializer and cleanup routines.
Example 7-6. lib3.c Listing
#include <stdio.h>
void lib3() {
printf("lib3\n");
}
#pragma init "lib3_init"
void lib3_init() {
printf("lib3 init\n");
}
#pragma fini "lib3_fini"
void lib3_fini() {
printf("lib3 fini\n");
}
void lib3_init2() {
printf("lib3 init2\n");
}
void lib3_fini2() {
printf("lib3 fini2\n");
} |
Example 7-7,
“Building init/fini Sample” shows the impact of using or not
using the pragmas. While it gives you more control as to the order
of execution of the init/fini routines, the compile/link line becomes
increasingly complex.
Example 7-7. Building init/fini
Sample
% cc +DD64 -b -Wl,+h,lib1.so -o lib1.so lib1.c
% cc +DD64 -Wl,+init,lib2_init -Wl,+fini,lib2_fini -b \
-Wl,+h,lib2.so -o lib2.so lib2.c
% cc +DD64 -b -Wl,+h,lib3.so -o lib3.so \
-Wl,+init,lib3_init2 -Wl,+fini,lib3_fini2 lib3.c
% cc +DD64 -L. -o init_test1 init_test.c -l3 -l2 -l1
% cc +DD64 -L. -o init_test2 init_test.c -l1 -l2 -l3 |
The order in which these libraries appear on the final
application link line is also important. The order of execution for
init/fini routines is
determined by link order. Example 7-8,
“Sample Run Order 1”, init_test1, shows one possible execution
order.
Example 7-8. Sample Run Order 1
$ cc +DD64 -L. -o init_test1 init_test.c -l3 -l2 -l1
$ ./init_test1
lib1 init2
lib1 init1
lib2 init
lib3 init2
lib3 init
lib1
lib2
lib3
lib3 fini
lib3 fini2
lib2 fini
lib1 fini2
lib1 fini1 |
Example 7-9,
“Sample Run Order 2”, init_test2, shows another possible
execution order.
Example 7-9. Sample Run Order 2
$ cc +DD64 -L. -o init_test2 init_test.c -l1 -l2 -l3
$ ./init_test2
lib3 init2
lib3 init
lib2 init
lib1 init2
lib1 init1
lib1
lib2
lib3
lib1 fini2
lib1 fini1
lib2 fini
lib3 fini
lib3 fini2 |
Note that in Example 7-8,
“Sample Run Order 1”, lib1 is the first
to be initialized. In Example 7-9,
“Sample Run Order 2”, lib3 is the first
to be initialized.
In cases where the libraries result in circular dependencies, the
order in which the initialization routines are run is undetermined.
The order within a library will not change; however, the order
between libraries may change between runs or even between the init and fini sequences of
a single run.
Chapter 8. Shells and
Utilities
Both HP-UX and Solaris support POSIX 1003.2 and Open Group
XPG4/SUS standards for commands. On HP-UX, user level
standards-based commands are located in the /usr/bin directory. Each platform also provides
a wide variety of open source or user-contributed commands and
utilities. Many widely used nonstandard commands are installed in
the /usr/contrib/bin directory on HP-UX. A
typical PATH specification for HP-UX looks
like the following:
/usr/bin:/opt/ansic/bin:/usr/ccs/bin:/usr/contrib/bin:
/usr/contrib/Q4/bin:/opt/perl/bin:/opt/hparray/bin:
/opt/fcms/bin:/opt/mozillan |
On Solaris systems, if there is a conflict between the
standards-specified behavior and the historical Solaris behavior,
the original behavior is unmodified. Instead, a new version of the
command that conforms to the standard is provided in the /usr/xpg4/bin directory. Solaris users may have
included this directory in their PATH
environment variable used in shell script.
This chapter discusses the behavioral differences of various
shell programming languages.
Command programming shells execute commands read from a terminal
or a file. Both Solaris and HP-UX support multiple shells; many of
the options, special commands, and environment variables are the
same on both systems. However, there are some differences, which are
identified in this chapter, along with possible solutions.
This chapter focuses on the Bourne, POSIX, Korn, and C shells.
Other shells are mentioned for completeness, but any differences for
the other shells are not identified.
The Korn shell (ksh) and the C shell (csh) are supported on Solaris and HP-UX. The GNU
Bourne Again shell (bash) and the TC shell
(tcsh) are available for HP-UX in the
Technical Computing Open Source Product. This product bundle is
described in "HP
Precompiled Software" . Both bash
and tcsh are available on Solaris.
Starting with HP-UX 11i v1.5, the Bourne shell has been replaced
with the POSIX shell. The POSIX shell is the default shell on HP-UX.
The Bourne shell is the default shell on Solaris. Therefore, /usr/bin/sh will invoke the POSIX shell on HP-UX
and the Bourne shell on Solaris.
The shells include the built-in command umask, which sets or displays the file mode
creation mask. On Solaris, the system default mask value is 022. On HP-UX, login
changes the mask to 0 for nonsecured logins.
Table 8-1,
“Solaris /usr/bin and /usr/xpg4/bin Shells” lists the shells
available on Solaris in the /usr/bin and the
/usr/xpg4/bin directories. If a shell is not
supplied by HP-UX, an alternative shell is suggested.
Table 8-1. Solaris /usr/bin and
/usr/xpg4/bin Shells
| Solaris Shell Path |
Shell Name |
HP-UX Shell |
| /usr/bin/sh |
Bourne shell |
POSIX shell |
| /usr/xpg4/bin/sh |
Link to /usr/bin/ksh |
Path not available; use the POSIX shell |
| /usr/bin/jsh |
Job shell |
Path not available; use the POSIX shell |
| /usr/bin/ksh |
Korn shell |
Korn shell |
| /usr/bin/csh |
C shell |
C shell |
| /usr/bin/bash |
GNU Bourne Again shell |
/opt/OpenSource/bin/bash |
| /usr/bin/tcsh |
TC shell |
/opt/OpenSource/bin/tcsh |
| /usr/bin/zsh |
Z shell |
Path not available; use the POSIX
shell. |
HP-UX and Solaris both provide the CDE ksh shell (dtksh) in the /usr/dt/bin
directory. The Key shell (keysh) is only
available on HP-UX.
The executable /usr/bin/sh is the Bourne
shell on Solaris; it is the POSIX shell on HP-UX. In most cases, the
POSIX shell is a superset of the Bourne shell. The POSIX shell
provides several features and options that are not available in the
Bourne shell. This section highlights the differences between the
Bourne shell on Solaris and the POSIX shell on HP-UX. For more
information on the Bourne shell, refer to the sh(1) manpage
on Solaris. For information on the POSIX shell, refer to the
sh-posix(1) manpage on HP-UX.
Special Commands |
 |
The Bourne shell and the POSIX shell both provide the . <filename> special command to read
and execute commands from the specified file. The POSIX shell
supports optional arguments for the .<filename> command. The Bourne shell
does not support this and the optional arguments are ignored by the
Bourne shell.
The cd [arg] special command is
supported by both the Bourne and POSIX shells. The POSIX shell
supports -L and -P for
the cd special command and it
supports cd old new. These options
are not available with the Bourne shell.
The chdir [ dir] special
command is only supported in the Bourne shell. An error is returned
if this command is specified in the POSIX shell. Alternatively, you
can use the POSIX shell builtin, cd.
Both shells support the export
[name] command. However, the POSIX shell supports the -p option and export
name=value. These options are not available when using the
Bourne shell.
The ouput from the hash command
is different in the Bourne and POSIX shells. The Bourne shell
displays three columns of information: hits,
cost, and command. The
POSIX shell only displays the information from the command column.
The default behavior for the pwd command is different when the working
directory is a symbolic link. The Bourne shell always displays the
absolute path name. By default, the POSIX shell displays the name of
the symbolic link. Also, the -L and -P options are available for the POSIX shell.
These options are not available in the Bourne shell. The following
example shows the output when the current directory is the symbolic
link /usr/tmp->../var/tmp. When porting
Bourne shell scripts that depend on pwd reporting the absolute path name,
pwd can be aliased to pwd -P or the /usr/bin/pwd command.
Bourne shell POSIX shell
------------ -----------
$pwd $pwd
/var/tmp /usr/tmp
$pwd -L
/usr/tmp
$pwd -P
/var/tmp |
In the Bourne shell, you cannot use the unset command to remove PATH, PS1, PS2, MAILCHECK, and IFS. These can be removed when using the POSIX
shell. However, HP recommends that you not unset any of the
variables used by the shell. Additionally, the POSIX shell supports
the -f and -v options
for the unset command. These options are not
supported by the Bourne shell.
The version of the Korn shell (/usr/bin/ksh) on both Solaris and HP-UX is the
Korn 88 shell. Most of the functionality is the same on both
platforms. This section highlights the differences between ksh on Solaris and HP-UX. Refer to the
ksh(1) manpage on either platform to learn more about the
functionality of the Korn shell.
Environment Variables |
 |
On Solaris, the ROWS and COLUMNS environment variables are not
automatically set. You can assign a value to it. On HP-UX, depending
on the terminal type, the Korn shell automatically sets a value for
COLUMNS. In a graphical user interface
environment, the value automatically changes when the shell detects
that the window size has changed.
Exported Aliases |
 |
The same set of exported aliases are compiled into ksh on both platforms, and the values can be
redefined on both platforms. However, on Solaris, hash is a shell built-in and it is an exported
alias on HP-UX.
Array Size |
 |
One-dimensional arrays are supported on both platforms. On
Solaris, subscripts can be in the range of 0 through 4095. On HP-UX,
subscripts can be in the range of 0 through 1023.
Conditional Expressions |
 |
All of the conditional expressions provided on both platforms are
the same with one exception. The -e file is
only available in ksh on the Solaris
platform. On HP-UX, you can use the -a file
to replace the -e file, or you can use the
POSIX shell on HP-UX. The -e file in the
POSIX shell provides the same functionality as the -e file in ksh on
Solaris.
Special Commands |
 |
The alias special command has the same
functionality and arguments on both platforms. However, there is a
slight difference in the output when printing the list of aliases.
On Solaris, the value of the alias is surrounded by single quotes.
On HP-UX, the value of the alias is displayed without any quote
characters.
The C shell (/usr/bin/csh) is available on
both Solaris and HP-UX. Many of the features are the same on both
platforms. This section highlights the differences. For more
information on the C shell, refer to the csh(1) manpage on
either platform.
Options |
 |
You can invoke the C shell with command-line options. On Solaris,
the -b option is valid and indicates that the
remaining command-line options should not be interpreted as C shell
options. This option is not available on HP-UX and it is ignored by
the C shell on HP-UX. The -T option is valid
on HP-UX but it is ignored by Solaris.
Built-in Commands |
 |
A resource name may be used with the limit
and unlimit built-in commands. The resource
names on Solaris and HP-UX are the same with one exception. On
Solaris, memorysize is used to display or set
the maximum size of virtual memory. This is not a valid resource
name on HP-UX. HP-UX uses the memoryuse
resource name to display or set the maximum size to which a process'
resident set size can grow. The memoryuse
command is not a valid resource name on Solaris.
The output for the time built-in command
displays additional information on Solaris. On HP-UX, time displays the user time, the system
time, the real time, and utilization percentage. For example:
On Solaris, the example is:
1.0u 0.1s 1:21:34 0% 0+0k 0+0io 0pf+0w |
This displays the same information as the HP-UX time built-in plus the average amount of
unshared data space, the number of block input and output
operations, page faults, and the number of swaps.
The output for the umask built-in command
is slightly different. On Solaris, a leading 0 is not displayed
along with the umask value. On HP-UX, a
leading 0 is displayed. For example, if the umask is set to 222, then
the umask built-in on Solaris will display
222. On HP-UX, umask
will display 0222.
Chapter 9. Freeware, Open
Source, Public Domain Software
Many development environments utilize both commercial and freely
available tools. This chapter discusses the availability and
development of freely available (Open Source, public domain, and
others) applications and libraries.
Like many other operating systems today, HP-UX 11i provides
precompiled bundles of commonly used free software packages. The
following sections describe some of these packages.
Technical Computing Open Source
Product |
 |
The Technical Computing Open Source Product bundle provides some
of the most commonly requested Open Source tools. This software is
provided for free and is not supported by HP. HP is not responsible
for the ported defects from the Open Source communities. However, HP
will report the defects to the related Open Source community and
incorporate the appropriate defect repairs for each new release.
The Technical Computing Open Source Product bundle is installed
as part of the technical computing environment. As such, the Minimum
Technical Computing (MTOE), Technical Computing (TCOE), and Mission
Critical (MCOE) operating environments will install the bundle by
default. The bundle includes binaries, documentation, and libraries.
The included libraries are intended for use only by the included
binaries and not for development purposes. The applications included
are shown in Table 9-1,
“Technical Computing Open Source Applications”.
Table 9-1. Technical Computing Open
Source Applications
| Application |
Path
Location |
| Bourne Again Shell |
/opt/OpenSource/bin/bash |
| GNU make |
/opt/OpenSource/bin/make |
| CDRecord |
/opt/OpenSource/bin/cdrecord, /opt/OpenSource/bin/mkisofs |
| GNU Emacs |
/opt/OpenSource/bin/emacs |
| GNU Less |
/opt/OpenSource/bin/less |
| extended C Shell (TENEX-like C Shell) |
/opt/OpenSource/bin/tcsh |
| Vi IMproved |
/opt/OpenSource/bin/vim |
HP-UX Internet Express |
 |
HP-UX Internet Express is a package that provides Open Source
components provided in other HP-UX Operating Environments (OEs) as
well as many components not provided anywhere else. HP-UX Internet
Express contains two sets of components. The first set, shown in Table 9-2,
“Non-OE Open Source Components”, is a collection of over 30
non-OE Open Source Web, Internet, and security components that have
been tested and qualified on HP-UX. The second set of components,
shown in Table 9-3,
“OE Open Source Components”, is a selection of Open Source
software products available in various HP-UX OEs and fully supported
by HP unless stated otherwise.
HP is not responsible for the ported defects from the Open Source
communities. However, HP will report the defects to the related Open
Source community and incorporate the appropriate defect repairs for
each new release.
Table 9-2. Non-OE Open Source
Components
| Calamaris |
Curl |
Cyrus IMAP |
| Cyrus SASL |
DanteSOCKS |
Fetchmail |
| Horde |
Hypermail |
IMP |
| Jabber |
Libpcap |
Majordomo |
| MySQL |
Net::SSLeay |
OpenLDAP |
| OpenSSL |
Perl-LDAP |
Pine |
| PostgreSQL |
ProcMail |
ProFTPD |
| Qpopper |
SOAP |
Squid |
| Stunnel |
TCPdump |
UDDI4J |
| UW-IMAP |
Xalan-C |
Xerces-C |
Table 9-3. OE Open Source
Components
| /dev/random |
Auth_ldap |
Bastille |
| Batik |
BIND |
bootpd |
| Bourne Again Shell (bash) |
CDRecord/XCDRoast |
Cocoon |
| DNS |
elm |
FOP |
| Gated |
GNU base |
GNU Emacs |
| GNU LIBC (partial) |
GNU make (gmake) |
GNU zip (gzip) |
| HP-UX IPFilter |
Jakarta Tomcat |
Kerberos Client |
| Less |
mailx |
Mod_frontpage |
| mod_ssl |
Mozilla browser |
NTP |
| Perl |
PHP |
Samba |
| Secure Apache Web Server |
Secure Shell (ssh) |
Sendmail |
| SLP |
SNIA |
TCP Wrappers |
| Tcsh |
Vi IMproved (VIM) |
wu-ftp |
| Xalan-J |
Xerces-J |
|
HP-UX Internet Express is available for download from:
http://h20293.www2.hp.com/portal/swdepot/displayProductsList.do?category=ISS
Ximian GNOME |
 |
Ximian GNOME for HP-UX is a modern, highly customizable desktop
environment that runs on top of the X Window System as an
alternative to CDE. Ximian GNOME for HP-UX is a feature-rich desktop
environment comprising the sawfish window manager, the GTK+ graphics
libraries, and a set of core applications that work together to
provide a seamless user experience and a portable development
platform.
The current release does not include all of the features of the
latest versions of GNOME available for other platforms. This release
is based on GNOME version 1.4. Later versions of GNOME are now
available on Linux and some other platforms. This product is not
supported; therefore, it is not recommended for mission-critical or
production environments.
For more information or to download a kit see:
http://www.software.hp.com/products/GNOME/
Mozilla |
 |
Beginning with HP-UX 11i v2, the Mozilla Web browser is included
on the OS media and is the recommended browser for HP-UX. Packages
are available for HP-UX 11.0, HP-UX 11i v1, and later. For
additional information or to download the latest kit see:
http://www.hp.com/go/mozilla
The Mozilla package requires that the Ximian GNOME GTK+ libraries
be installed prior to installing Mozilla. These libraries are
provided strictly for use by Mozilla and are not intended for
development.
Additional Software |
 |
Table 9-4,
“Freeware Status and Availability” contains a listing of
additional freeware packages available for HP-UX 11i. HP does not
support any of these products. They are provided here exclusively
for your convenience. The abbreviation HPPD is used in the table to
indicate the package is available from the HP-UX Porting and Archive
Centre. See "Application
Archives" for more information.
Table 9-4. Freeware Status and
Availability
The growth of the Internet has provided developers and system
administrators with numerous locations from which to collect
precompilied tools and libraries. These collections allow you to
locate required resources without having to search the entire
Internet.
HP provides several such archives for both source and binary
distributions:
-
OpenSource.hp.com hosts a number of Open
Source software projects that run on various HP platforms
including Linux and HP-UX at:
http://opensource.hp.com/
-
The Developer Solution Partner Portal (DSPP)
program maintains a list of available Open Source and Public
Domain software packages that have been requested by partners
at:
http://www.hp.com/dspp >> technical
resources >> open source tools list
-
The software depot Web site provides bundles
such as Mozilla, Ximian GNOME, and GTK+ for HP-UX at:
http://software.hp.com/
The HP-UX Porting and Archive Centre is a third-party archive,
not maintained by HP, of open source and public domain software for
HP-UX. The archive contains over 2000 precompiled and source
packages. You can access this collection at the primary site:
http://hpux.connect.org.uk/
There are also multiple mirrors for this site. These additional
resources are listed in Table A-3,
“HP-UX Porting and Archive Centre Site and Mirrors”. For the
best results, HP recommends that you use the mirror closest to
you.
Many portable programs achieve at least part of their portability
by using the GNU autoconf tool. If
the source directory contains a file named configure, you will often find that typing the
following is all that is required to get an error-free build:
By default, this will produce a 32-bit executable.
In most cases, when the sources are in C, you can produce a
64-bit executable by setting the CCOPTS
environment variable to the value +DD64 before
you run the configure script.
Sometimes, when working with older packages, the configure script needs help determining the
correct description for the host it is running on. You can supply it
like this:
% ./configure --host=ia64-hp-hpux11.22 |
You can also obtain the latest version of the GNU config.guess and config.sub scripts from the following Web
locations to replace the ones that came with the package:
Additional information on the GNU autoconf tool is available at:
http://www.gnu.org/software/autoconf
Chapter 10. Internationalization
Support
This chapter discusses internationalization (also known as I18N)
and localization (also known as L10N) for Solaris 8 and HP-UX 11i
V2. Both Solaris 8 and H-UX 11i V2 have extensive I18N and L10N
support providing coverage for approximately 30 languages. This
chapter provides only a high level description of some key features
of both platforms. When porting custom code, be sure to check vendor
specific documentation and use the Software Transition Kit for
Solaris to HP-UX to help identify specific code changes that may be
necessary.
Solaris Version 8 supports Unicode Version 3.0. Note that Solaris
Version 9 supports Unicode Version 3.1. This is significant because
Unicode Version 3.1 contains about 94,000 characters, as compared to
Version 3.0, which contains approximately 49,000 characters and
Version 2.1, which contains almost 39,000 characters. HP-UX 11i v2
supports Unicode Version 3.0. Earlier HP-UX 11i versions support
Version 2.1. Unicode provides three encoding forms:
-
UTF-8, a multibyte-compatible encoding,
which does not have any endian issues
-
UTF-16 (also sometimes called UCS-2) in
which code units are 16 bits each
-
UTF-32 (sometimes called UCS-4) in which
code units are 32 bits each
In general, data is in one of these forms for both platforms
during internal processing only, and it is not stored to disk.
Rather, it is stored to disk in UTF-8 form. This means that you can
exchange UTF-8 data between the two platforms without endian
problems.
The X/Open UNIX standard does not require an operating system to
supply any particular codesets in addition to ASCII. The standard
does specify requirements for the interfaces that manipulate
characters so that programs can handle characters from whatever
codeset is available on a given system. Both Solaris 8 and HP-UX 11i
provide commands and APIs for such manipulation.
Table 10-1,
“Table 17–1: Encoding Methods” lists the supported codesets and
encoding methods on Solaris 8 and their compatible codesets and
encoding methods on HP-UX 11i, if available. If a particular
encoding is not available, check the codeset conversion capabilities
on the target platform.
Table 10-1. Table 17–1: Encoding
Methods
| Solaris 8 |
HP-UX 11i
v2.0 |
| ISO 8859-1 (Latin-1) |
ISO 8859-1 (Latin-1) |
| ISO 8859-2 (Latin-2) |
ISO 8859-2 (Latin-2) |
| ISO 8859-3 (Latin-3) |
Not available |
| ISO 8859-5 (Latin-Cyrillic) |
ISO 8859-5 (Latin-Cyrillic) |
| ISO 8859-6 (Latin-Arabic) |
Not available |
| ISO 8859-7 (Latin-Greek) |
ISO 8859-7 (Latin-Greek) |
| ISO 8859-8 (Latin-Hebrew) |
ISO 8859-8 (Latin-Hebrew) |
|
ISO 8859-9 (Latin-Turkish) (Latin-5) |
ISO 8859-9 (Latin-Turkish) (Latin-5) |
| ISO 8859-13 (Latin-7 - Baltic Rim) |
Not available |
| ISO 8859-15 (Latin-9) |
ISO 8859-15 (Latin-9) |
| Japanese Extended UNIX Code (EUC) |
Japanese Extended UNIX Code (EUC) |
| Korean Extended UNIX Code (EUC) |
Korean Extended UNIX Code (EUC) |
| Simplified Chinese Extended UNIX Code (EUC) |
Simplified Chinese Extended UNIX Code (EUC) |
| Shift JIS |
Shift JIS |
| PC Kanji |
Not Available |
| Korean KSC5601 |
Not Available |
| Thai API Consortium/Thai Industrial Standard (TIS620) |
Thai API Consortium/Thai Industrial Standard (TIS620)
|
| KOI8-R |
Not Available |
| Traditional Chinese Extended UNIX Code |
Traditional Chinese Extended UNIX Code |
| Big-5 |
Big-5 |
| GBK |
GBK |
| GB18030-2000 |
GB18030-2000 |
In addition to common European language input methods, both
Solaris and HP-UX 11i support varieties of input methods for Asian
languages. The following sections discuss Solaris input methods and
their equivalents on HP-UX 11i, if available.
The Solaris operating system supports the X Input and Output
Methods (XIM and XOM), with functions implemented according to the
X11R6 specification. Solaris 8 introduced the Internet Intranet
Input Method Server (iiim). This input method supports all European
and Asian UTF-8 based locales. Although HP-UX does not support this
input method server, there is support in existing input methods for
UTF-8 based locales.
Solaris and HP-UX 11i include support for Japanese, simplified
Chinese, traditional Chinese, and Korean. There are third-party
products that support other input methods on both Solaris and HP-UX
11i.
Solaris 8 introduced the Internet Intranet Input Method Server
(iiim). This input method supports all European and Asian UTF-8
based locales. Although HP-UX does not support this input method
server, there is support in existing input methods for UTF-8 based
locales.
Japanese Input |
 |
HP-UX 11i uses the xjim input server. HP-UX 11i v2 also provides
ATOK X to input Japanese. Table 10-2,
“Japanese Input Support Comparison” compares the Japanese input
support for these input servers.
Table 10-2. Japanese Input Support
Comparison
| Solaris |
HP-UX |
| ATOK 12 |
ATOK X |
| ATOK 8 |
ATOK 8 - To be discontinued |
| Wnn6 |
Not Supported
|
Simplified Chinese |
 |
HP-UX 11i uses the xsim input server. Table 10-3,
“Simplified Chinese Input Support Comparison” compares the
simplified Chinese input support for this input server.
Table 10-3. Simplified Chinese Input
Support Comparison
| Solaris |
HP-UX |
| New QuanPin |
ABC IM Supports |
| New ShuangPin |
ABC IM Supports |
| ShuangPin |
ABC IM Supports |
| GB2312 NeiMa |
GB2312 NeiMa |
| QuanPin |
QuanPin |
| GB18030 NeiMa |
GB18030 NeiMa |
| WangMa Wubi |
WangMa Wubi |
| English_Chinese |
Not Supported |
| GBK NeiMa |
Not Supported |
Traditional Chinese |
 |
HP-UX 11i uses the xtim input server. Table 10-4,
“Traditional Chinese Input Support Comparison” compares the
traditional Chinese input support for this input server.
Table 10-4. Traditional Chinese Input
Support Comparison
| Solaris |
HP-UX |
| ChuYin |
ChuYin |
| TsangChieh |
TsangChieh |
| CheinI |
ShuChan |
| EUC NeiMa |
EUC NeiMa |
| BIG5 NeiMa |
BIG5 NeiMa |
| BIG5_HKSCS NeiMa |
BIG5_HKSCS NeiMa |
| English-Chinese |
Not Supported |
| New ChuYin |
Not Supported |
| Array |
Not Supported |
| Boshiamy |
Not Supported |
| DaYi |
Not Supported |
Korean |
 |
HP-UX 11i uses the xkim input server. Table 10-5,
“Korean Input Support Comparison” compares the Korean input
support for this input server.
Table 10-5. Korean Input Support
Comparison
| Solaris |
HP-UX |
| Hangul |
Hangul |
| Hanja |
HanJa |
| ASCII |
ASCII |
| Special Symbols |
HEX Code |
Both Solaris 8 and HP-UX 11i v2.0 support a wide range of codeset
converters. See the /usr/lib/iconv/ and /usr/lib/iconv_data/ directories for a list of
the converters installed on a Solaris 8 system. On HP-UX 11i
systems, the /usr/lib/nls/iconv/config.iconv
file lists the available converters and their aliases. The actual
converters are under /usr/lib/nls/iconv/tables and /usr/lib/nls/iconv/methods. The iconv utility converts data from a named
input encoding to a named output encoding. See the iconv reference pages for more information
about codeset converters on both platforms.
Solaris 8 provides the geniconvtbl
utility that allows users to create their own codeset conversion
tables. There is no comparable utility on HP-UX. Refer to the HP-UX
documentation for more information.
Individual languages and countries have varying requirements for
the way data should be processed or presented. Internationalized
systems such as Solaris and HP-UX 11i define locales that hold
collections of rules and data specific to a language, region, and
codeset or encoding method. Users can choose the locale that meets
their cultural and linguistic needs.
The default locale on Solaris 8 is en_US.ISO8859-1. On HP-Ux 11i,
the default local is the C (or POSIX) locale. As with other locales,
the collation order is slightly different. Additionally, while each
vendor adheres to the ISO standards for encoding formats, there are
no standards governing the content of locales specific to collation,
date/time formats, and others. When porting code you may get
unexpected results when using a similarly named locale.
In many cases, there are multiple locales for a single language.
For example, Solaris provides three Japanese locales, while HP-UX
11i provides four. Table D-1,
“Supported Locales” lists the names of all the supported locales
for Solaris and their compatible names on HP-UX 11i.
Part of an internationalized system is the ability to provide
program text to users in the languages of their choice. Solaris 8
and HP-UX 11i include messaging systems that make it possible to
separate program text from source code so that text can be
translated into multiple languages. The collection of program text
from a given program is called a message catalog.
Both Solaris 8 and HP-UX 11i provide a set of standard common
interfaces and commands to create and access message catalogs based
on specifications from The Open Group (XPG4). More widely used on
Solaris, however, is a message catalog system that is now also
specified in the Linux Standard Base specifications called gettext.
The gettext message-handling functions,
though not a part of the base operating system, are available from
the HP Linux Portability Kit. You can alse get the same
functionality as the functions on Solaris systems from the GNU gettext package.
Download and install one of the following packages:
X and Motif applications, which include a graphical user
interface (GUI), usually access X resource files, rather than
message catalogs, for the small segments of text that belong to the
title bars, menus, buttons, and simple messages for a particular
window. Motif applications can also use a User Interface Language
(UIL) file, along with a text library file, to access help, error
messages, and other kinds of text. However, both X and Motif
applications can access text in message catalogs as well. The
Solaris X Window System supported version is Version 11 Release 6.3
while the HP-UX 11i supported version is Release 6.2. Motif Version
2.1 is available on Solaris and HP-UX 11i. See the related
references for more information.
Complex Text Languages (CTL), such as Arabic, Hebrew, and Thai,
often require great care when building applications that support
them. On Solaris 8, applications may require little or no change due
to the introduction of CTL services based on the Open Group Portable
Layout Services specification. An application using these services
must be linked with the latest (default) Motif library and also have
-DSUN_CTL specificed for
compilation purposes. If you are using these services, it is
important that you read the HP-UX 11i V2 I18N documentation to learn
how to port your application.
Chapter 11. Run-Time
Environment
This chapter provides an overview of the run-time environment for
HP-UX 11i.
HP-UX 11i and Solaris provide environment variables that may
change the run-time behavior of an application. This section
discusses those environmental variables.
Changing the library resolution at execution time is sometimes
needed. For example, testing an application with a new version of
your library without having to relink. The LD_LIBRARY_PATH environment
variable provides this capability. Both HP-UX 11i and Solaris check
this variable by default. Both also provide a means of not checking
it. HP-UX 11i uses the +noenvvar link-time
option to achieve the same goal. In addition to LD_LIBRARY_PATH, HP-UX 11i also checks the SHLIB_PATH
environment variable; this test can be disabled using +noenvvar.
Debugging load-time bugs can be problematic. To assist in
debugging, options to the loader are provided to give feedback as
the loader creates the completed memory image. HP-UX 11i uses _HP_DLDOPTS.
For more information on the options passed to the loader, see the ld(4) manpage.
While both HP-UX 11i and Solaris share many of the concepts of
per-process limits, the default values for these limits are very
different. Per-process limits, such as the maximum size of the data
segment or stack segment of a program, are controlled by tunable
variables in the kernel. Commands such as the limit command in the C shell, or the
ulimit command in other shells,
are typically how these limits are set. The kernel controls the
maximum allowable values for these limits.
Both systems have the concepts of hard and soft limits for the
stack and data segment sizes. However, on HP-UX 11i, the values for
both the hard and soft limits are set to the same initial values.
Your shell may impose lower values for the soft limits; there are no
kernel parameters for the soft limits. For both HP-UX and Solaris,
you may increase or decrease the value of the soft limits such that
the maximum value can be no greater than the hard limit.
Both systems control these resource limits through tunable kernel
variables. Solaris contains distinct variables to control the soft
and hard limits for process data segment size and process stack
segment size. HP-UX 11i only contains variables for the hard limits.
However, HP-UX 11i contains two versions of these hard limit
variables: one for 32-bit programs and one for 64-bit programs.
Table 11-1,
“HP-UX 11i Default Process Resource Limits” and Title not
available list the default values for the resource limits controlled
by the ulimit command (and the setrlimit function) on both Solaris and HP-UX
11i.
Table 11-1. HP-UX 11i Default Process
Resource Limits
| Name |
HP-UX 11i
32-bit Applications |
HP-UX 11i 64-bit Applications |
Solaris Applications |
| cputime |
unlimited |
unlimited |
unlimited |
| filesize |
unlimited |
unlimited |
unlimited |
| datasize |
256 MB |
1 GB |
unlimited |
| stacksize |
8 MB |
256 MB |
unlimited |
| coredumpsize |
unlimited |
unlimited |
unlimited |
| descriptors |
1024 |
1024 |
1024 |
| memoryuse |
unlimited |
unlimited |
unlimited |
Run-time limits affect a program's run-time capabilities, but are
not controlled on a per-process basis. These limits, such as the
number of threads per process, are kernel tunable parameters. Table 11-2,
“Default Run-Time Limits” describes and lists some of the more
important limits that affect a process.
Table 11-2. Default Run-Time
Limits
| HP-UX 11i |
Description |
| Name |
Default |
|
| maxfiles |
60 |
Soft file limit per process |
| maxfiles_lim |
1024[a] |
Hard file limit per process |
| Not Available |
|
Maximum number of threads per user |
| max_thread_proc |
256[a] |
Maximum number of threads allowed in each process |
| maxuprc |
256[a] |
Maximum number of user processes |
| nfile |
8192 |
Maximum number of open files system wide |
| nflocks |
200 |
Maximum number of file locks system wide |
Refer to sysconf(2) for more information
on these system limits.
Applications that create files can be affected by the system
defaults for directory permissions and the umask(1) settings. This
section discusses some of the more commonly used settings.
Solaris sets a system wide default umask
of 022 in /etc/profile. By default, HP-UX
11i does not set a system wide umask, a
default of 000 is used. This difference may or may not affect your
application. The creation of configuration, log, and other files
should be verified for expected permissions. Applications should
utilize the umask(2)
system call to ensure that the current umask
setting is set as expected for maximum portablity.
chown(1) on Solaris and HP-UX
11i is similar. The chown(1)
command on HP-UX 11i follows the System V standard and allows a
non-root user to change ownership of a file. The setuid and setgid bits are
reset to prevent a user from compromising system security.
The default system permissions on certain directories may also
affect your application's installer or other temporary files. On
HP-UX 11i v2, the default permissions and ownership on /usr/local/ are 555 (dr-xr-xr-x) with an ownership of bin:bin. This setting differs from Solaris which
uses 755 (drwxr-xr-x), root:other for /usr/local/.
The nobody (60001) user account and nobody (60001) user group are frequently used to
run daemons and protect associated files on Solaris. On HP-UX 11i
the accounts are nobody(-2) and nogroup(-2).
The HP-UX 11i environment does not allow users to login or set
user, su(1), to the nobody account. Further, files cannot be assigned
( chown(1) ), to either the nobody or nogroup IDs.
Installation tools should create a unique user and group to control
ownership and access to the installed files.
Use the useradd(1M), groupadd(1M), and passwd(1), command-line
utilities to create accounts easily. Note that the system default
location for home directories on HP-UX 11i is /home. The system default shell used when
creating users is /sbin/sh not /bin/sh as on Solaris. This shell is more
restrictive than the POSIX shell (/bin/sh).
Example 11-1,
“Creating a Locked Account” shows how to use these commands to
create a new group and user without login privileges.
Example 11-1. Creating a Locked
Account
#!/bin/sh
#
# Usage: create_account <user> <group>
#
groupadd $2
if [ $? != 0 -a $? != 9 ] ; then
# 0 = success, 9 = group already exists
echo "Error creating group"
exit -1
fi
useradd -s /bin/sh -g $2 $1
if [ $? != 0 -a $? != 9 ] ; then
# 0 = success, 9 = user already exists
echo "Error creating user"
exit -1
fi
passwd -l $1 |
This will create a user account with a shell of /bin/sh, a home directory of /home/<user> and a primary group of <group>. The account is also locked so no
direct access is possible, this account can only be accessed by root
using the su(1)
command. The groupadd and useradd commands return nonzero on error
and should be tested.
The following sections discuss the differences in signals and
exceptions between Solaris and HP-UX 11i.
Signals |
 |
Developers are encouraged to convert to sigaction whenever possible. HP-UX fully
supports sigaction(2) as defined in the
UNIX 95 standard. The used of sigaction
provides a more comprehensive and reliable mechanism for controlling
signals. Additionally, the signal handling behavior is identical
between the systems.
Structured Exceptions |
 |
Exception processing differs from signal handling in that control
is transferred from a point in the execution of a program to an
exception handler. Unlike signals, the exception handler is located
inline at a location beyond the point of the exception; a signal
handler is invoked as a function out of context.
HP aC++ provides try-block exception handling as defined by the
C++ standard.
Alignment Faults |
 |
HP-UX PA-RISC and Itanium®
processors require that data be aligned on its natural boundary.
That is, a 32-bit integer must be aligned on a 32-bit boundary, a
64-bit integer on a 64-bit boundary, and floating-point types on
their natural boundaries. If the system tries to access data that is
not properly aligned, the system will cause an exception. Example 11-2,
“Unaligned Data Access” shows an example of code which accesses
unaligned data.
Example 11-2. Unaligned Data
Access
#include <stdio.h>
/* example of an unaligned access */
struct {
int a;
int b;
int c;
} ab = { 1, 2, 3};
int main()
{
long *pb; /* pointer to a long */
printf("loading unaligned object\n");
/* assign pointer to second byte of the structure */
pb = (long *)((char *)&ab + 1);
/* This will cause an alignment exception */
*pb = 0;
printf("a:%d, b:%d, c:%d\n", ab.a, ab.b, ab.c);
return 0;
} |
On both PA-RISC and Itanium®
processors, HP-UX 11i does not provide, by default, code to perform
unaligned access fixups. A SIGBUS is raised
by the operating system for each unaligned access. This allows the
application to catch the signal and emulate the data access itself
or to fatally exit, the default behavior for SIGBUS. Applications can enable default handling
of alignment fixups by linking against an additional library: libunalign on Itanium®-based systems and libhppa.a on PA-RISC systems. Additionally they
must enable the handler by calling allow_unaligned_data_access. More information on
the handling of unaligned data is available in the HP aC++ and HP ANSI C version A.05.36 Compiler
Online Programmer's Guide and HP aC++ Version
A.03.33 Online Programmer's Guide guides available on:
http://docs.hp.com/hpux/dev/index.html
The compilers always allocate memory with the correct alignment.
Memory managers (malloc, mmap, and others) should return values aligned
to at least the largest type (int, long, double) supported on
the operating system. The most frequent cause of alignment faults is
the misuse of the C cast operator, assigning a pointer from a
smaller type (char) to a larger type (int).
The HP C compiler on HP-UX 11i v1 does not have support for
accessing unaligned data safely. The HP ANSI C compiler on Itanium®-based systems and the HP aC++
compiler on both platforms provide the UNALIGN pragma, which affects the next typedef declaration. Additional declarations are
not affected, only the first typedef in
global scope following the pragma is affected. Variables accessed
using the defined type are treated as unaligned data. Example 11-3,
“Unaligned Access on HP-UX 11i” shows an example of using the
UNALIGN pragma.
Example 11-3. Unaligned Access on HP-UX
11i
#pragma UNALIGN 1
typedef int ua_int; // ua_int is type int with 1 byte alignment
typedef int a_int; // a_int is type int with natural alignment |
While the generated code is larger and slower, it will allow you
to access the data without throwing an alignment fault.
Floating-Point Exceptions |
 |
In the Itanium® architecture there is
no concept of asynchronous interrupts. The Itanium® architecture provides precise
exceptions. That is, a processor behaves as if it were not pipelined
and Itanium® processor instructions are
executed one at a time.
Any interrupt raised by the execution of an instruction is
handled at execution time, in sequential instruction order. If
multiple interrupts occur in one instruction bundle (a bundle
contains three instructions), then the instruction in the lowest
numbered-instruction slot will be raised. This also applies to
parallel floating-point operations.
On Itanium® processors, interrupts
are delivered in priority order, higher priority exceptions are
flagged first and results delivered according to the requirements of
that exception. Lower priority exceptions are not flagged, even if
they occur. For example, dividing an SNaN (Signaling NaN) by zero
causes an invalid operation exception due to the SNaN and not a
divide-by-zero exception. The exception disabled result is the QNaN
(Quiet NaN) definite, not infinity as would be required by a
divide-by-zero exception. However, because of the frequent
occurrence of inexact exceptions, they accompany underflow or
overflow exceptions.
HP-UX 11i handles the five standard IEEE floating-point
exceptions:
-
Overflow
-
Underflow
-
Invalid operation
-
Division by zero
-
Inexact result
The HP-UX 11i math libraries deal with exceptions for the more
complex operations, such as the transcendental functions. These
types of exceptions depend on compiler options and are not discussed
in this guide. See the HP-UX 11i Floating-Point
Guide for more information on math libraries.
Both Solaris and HP-UX 11i exception behavior is IEEE; it ignores
all exceptions. For portability, we recommend that you use IEEE
floating point when possible.
As defined by the IEEE standard, traps for the five standard
exceptions are disabled by default. These traps can be enabled in
HP-UX 11i by several mechanisms:
| |
+FP Compiler Option |
 |
The +FPflags option is available
on all compilers. Table 11-3,
“+FP Option Arguments” lists the +FP
options.
Table 11-3. +FP Option Arguments
| Value |
Behavior |
| V |
Enables traps on invalid floating-point
operations. |
| v |
Disables traps on invalid floating-point
operations. |
| Z |
Enables traps on divide by zero. |
| z |
Disables traps on divide by zero. |
| O |
Enables traps on floating-point overflow. |
| o |
Disables traps on floating-point overflow. |
| U |
Enables traps on floating-point underflow. |
| u |
Disables traps on floating-point underflow. |
| I |
Enables traps on floating-point operations that
produce inexact results. |
| i |
Disables traps on floating-point operations that
produce inexact results. |
| D |
Enables flush-to-zero (fast underflow) mode for
denormalized values. (Selecting this value enables
flush-to-zero mode only if it is available on the processor
that is used at run time.) |
| d |
Disables
flush-to-zero (fast underflow) mode for denormalized
values. |
| N |
Enables trap on
Denormal|Unnormal operand floating-point operation. Available
on Itanium® processors
only. |
| n |
Disables trap on Denormal|Unnormal operand floating-point
operation. Available on Itanium®
processors only. |
The flags enable (uppercase letter) or disable (lowercase letter)
one of the floating-point exceptions. This option allows you to
enable an application to flush all denormals to zero. This is a
common industry standard extension to the IEEE actions. For example,
to enable flush-to-zero mode and disable all other exceptions, the
command is:
% cc +DD64 +FPvzouiD foobar.c |
The default action when exceptions are enabled with this option
is to dump core. However, this action gives no further information
about the exception that caused the core dump.
| |
+fp_exception HP Fortran Option |
 |
The +fp_exception option in HP Fortran is
used to trap four floating-point exceptions:
-
Invalid operation
-
Division by zero
-
Underflow
-
Overflow
Few applications actually use the inexact result information
because it happens quite often and gives little information. The
+fp_exception option is similar to the +FP option, but gives more information. The +fp_exception option provides the type of exception
and the virtual address of the offending statement, and it also
aborts the application instead of causing it to dump core.
If the +fp_exception or +T options are used with the +FP option in FORTRAN applications, the +fp_exception is always processed before the +FP option. However, the +fp_exception does not turn off any of the
exceptions enabled by the +FP option.
As in the case of the +FP option, the +fp_exception option is similar to the Compaq C
-fptm options and the Compaq Fortran -check and -fpe options.
| |
fesettrapenable Function |
 |
Use the fesettrapenable(3) function to
enable one or more traps from within an application. This allows you
to be selective inside the application when dealing with exceptions.
This function has the same default action as +FP, in that the application dumps core. The
similar Solaris function is ieee_flags.
| |
User Handling of FP Exceptions |
 |
If the default action of either dumping core or aborting the
application is not desired, then you must provide exception-handling
routines. For C, use the standard signal-handling sigaction(3) function to
install a signal handler for floating-point exceptions. This handler
must access the various floating-point status register flags to
decode the signal, since all floating-point exceptions are signaled
by the signal SIGFP.
The ON statement allows FORTRAN programs
to handle floating-point exceptions. One of the components of the
ON statement is the type of exception to
handle, which reduces the complexity of the handler as individual
handlers can be written for each type of exception when compared to
that required for the SIGFP signal.
| |
Detecting Exceptions without Enabling
Traps |
 |
Use the fetestexcept(3) function from
within an application to determine which of a specified
subset of the floating-point exception flags are set. If
an exception occurs when the corresponding exception trap
enable flag is not set (that is, the trap will not be detected),
then the system sets the corresponding exception flag. This
flag stays set until it is explicitly cleared. This allows
you to periodically check the trap enable flags to see if
any floating-point exceptions have occurred in the application
and then take the appropriate actions.
Be careful when using this function at higher levels of
optimization (level 2 and above). Optimizations may change the order
of instructions in the application. As a result, in optimized code a
function call may not occur at the location in the application where
you intended it to be located. Use the FLOAT_TRAPS_ON pragma to suppress optimization
for sections of an application. This allows the call to fetestexcept(3) to be
precisely located in the application.
For more information, see the Intel® Itanium®
Architecture Software Developer's Manual, Volume 1, Section 5
and the HP-UX Floating-Point Guide, Sections
5 and 6.
Chapter 12. Kernel and Driver
Interfaces
Kernel modules (device drivers, file systems, and others) are
usually specific to their operating system, and sometimes they are
even version-specific. Therefore, they are among the most difficult
interfaces to port as the interface to the kernel is rarely
compatible between operating systems. This chapter discusses what
functionality is available on HP-UX 11i and how kernel-dependent
applications developed for Solaris are affected. It will also
provide some suggestions for API replacements for HP-UX 11i.
Both Solaris and HP-UX 11i support the dynamic loading and
unloading of kernel modules or subsystems. Both platforms also allow
these modules to contain configurable attributes that may be queried
and changed while the kernel is running.
Solaris refers to loadable modules as Loadable Kernel Subsystems;
HP-UX 11i uses the term Dynamic Loadable Kernel Modules (DLKM). Table 12-1,
“Kernel Loadable Module Commands: HP-UX 11i v1.6 and Earlier”
and Table 12-2,
“Kernel Loadable Module Commands: HP-UX 11i v2 and Later”
compare the Solaris andHP-UX 11i commands used to load modules.
There are two separate tables because the commands used to manage
loadable kernel modules are in transition and are different in HP-UX
11i v2 and later.
Table 12-1. Kernel Loadable Module
Commands: HP-UX 11i v1.6 and Earlier
| HP-UX 11i v1.6 and Earlier |
Description |
| kmadmin -L |
Loads a module to the running kernel. |
| kmadmin -U (or -u) |
Unloads a kernel module. |
| kmtune |
Queries, sets, or resets system parameters. |
| kmsystem |
Configures a module to be loaded at the next system
boot. |
| config -M |
Configures a module for dynamic loading and generates some
files. |
| kmupdate |
Updates the kernel with loadable module. |
| kmmodreg |
Registers the DLKM with the
kernel. |
Table 12-2. Kernel Loadable Module
Commands: HP-UX 11i v2 and Later
| HP-UX 11i v2 and Later |
Description |
| kcmodule
modulename=loaded |
Loads a module to the running kernel. |
| kcmodule
modulename=unused |
Unloads a kernel module. |
| kctune |
Queries, sets, or resets system parameters. |
| kcmodule |
Configures a module to be loaded at the next system
boot. |
| kconfig |
Configures a module for dynamic loading and generates some
files. |
| kcmodule |
Updates the kernel with loadable module. |
| kcmodule |
Registers the DLKM with the
kernel. |
In HP-UX 11i v2 and later, the kcweb Web-based kernel administration
utility is also capable of managing dynamically loadable kernel
modules and kernel tunables. Also, the administration commands are
much simpler in that many operations that previously required a
kernel rebuild and system reboot no longer require that.
The steps involved to build loadable kernel modules are very
similar between the two platforms and are well documented.
See the steps in the HP-UX 11i Managing and
Developing Dynamically Loadable Kernel Modules manual for more
information on loadable modules for HP-UX 11i:
http://docs.hp.com/en/dlkm-62001/index.html
Table 12-3,
“Kernel Loadable Module APIs” shows the HP-UX 11i system
functions used to load, unload, query, and configure loadable kernel
modules. These functions are implemented as macros on HP-UX 11i.
Table 12-3. Kernel Loadable Module
APIs
| HP-UX 11i |
Description |
| modload(2) |
Loads a kernel module. |
| moduload(2) |
Unloads a kernel module. |
| modstat(2) |
Gets the values of selected attributes. |
| modstat(2) |
Obtains information about a loaded module. |
| modpath(2) |
Allows users to modify the search path used to locate
object files for dynamic
loading. |
Chapter 13. Graphics
Issues
This chapter discusses issues related to porting X Window System
and OpenGL applications from Solaris to HP-UX 11i.
On HP-UX 11i the X Window System development kit is not installed
by default as part of the base operating system. Under HP-UX 11i the
necessary files for X Windows System development are included in the
HP-UX Developer's Toolkit, and it will need to be installed by the
system administrator. The HP-UX Developer's Toolkit is available
at:
http://h20293.www2.hp.com/portal/swdepot/displayProductsList.do?category=DTDC
On HP-UX 11i, X Window System applications can also be built as
either 32- or 64-bit applications. You need to specify at compile
and link time whether it should be a 32- or 64-bit application.
Required Include Files |
 |
At compilation time, you may specify an additional include directory, /usr/include/X11R6/, in your compilation options
for X Version 11 header files. For example:
% cc +DD64 -I/usr/include/X11R6 -c foo foo.c |
However, this is not strictly necessary. You may see this done in
other applications already ported to HP-UX 11i in existing Makefiles. In previous versions of HP-UX 11i, it
was possible to develop applications for either X11R5 or X11R6 and
you needed to explicitly specify which version of the X include
files you wanted. In HP-UX 11i, only the X11R6 development
environment is supported. Symbolic links for the old development
environment directory structures are in place for compatibility.
Required Libraries |
 |
When linking an X Window System application, it is not necessary
to specify any additional library search paths to the linker. The
linker will find the correct X Window System API libraries in its
normal search path, whether the application is being built as a
32-bit application or a 64-bit application. The correct search path
directory is implicitly passed to the linker based on whether the
user passed the +DD64 option to the compiler
and linker on the command line.
The following additional libraries for graphic support can be
found in the HP-UX Developer's Toolkit (X11MotifDevKit):
-
libX11.so
-
libXaw.so
-
libXext.so
-
libXi.so
-
libXIE.so
-
libXm.so
-
libXmu.so
-
libXt.so
If you are porting from Solaris, note that properly coded X
Window System applications should not make any assumptions about
what the default Visual Class or pixel depth
of the RootWindow of the Display is.
Historically, many HP-UX 11i workstations shipped with graphics
cards configured with an 8-bit PseudoColor
visual as the default visual (used by CDE and most applications)
with TrueColor visuals available for
applications to use if they wished. Therefore, if an application
being ported uses the default Visual of a Display, check to ensure that the application
does not make any assumptions about the class and depth of that
default Visual. If it assumes that a TrueColor Visual is the default, the application
may have to be modified to either work correctly with a default PseudoColor Visual, or to choose another
appropriate nondefault Visual at runtime.
On HP-UX 11i v2, the Common Desktop Environment (CDE) is actually
a set of PA-RISC executables and libraries run under the Aries
binary translator. No native Itanium®
executables or libraries are included with the operating system.
Consequently, any application that links in any CDE libraries (such
as libDtSvc, libDtTerm, libDtWidget,
and others) must be built on PA-RISC systems. These applications
will also have to be run on Itanium®
under Aries like the rest of the CDE environment.
Developing OpenGL applications on HP-UX 11i requires installing
an optional software bundle. The HP-UX 11.00 graphics technical
computing environment provides the OpenGL libraries and header files
needed to develop OpenGL based applications on PA-RISC systems.
HP-UX 11i v2 includes the OpenGL development files on the base OS
DVD, the HP-UX Graphics3D Run Time Environment (Graphics3D) package provides the required
libraries and header files.
The HP-UX 11.00 graphics technical computing environment is
available for download at:
http://h20293.www2.hp.com/portal/swdepot/displayProductsList.do?category=ER
Solaris and HP-UX support extensions; check your program
extensions.
Required Include Files |
 |
The OpenGL Developers Toolkit is installed under the /opt/graphics/ directory. OpenGL applications
will need to specify an include directory of
/opt/graphics/OpenGL/include/, in addition
to the standard X11 Release 6 include paths
in the compilation flags. For example:
% cc +DD64 -I/opt/graphics/OpenGL/include -c foo.o foo.c |
Required Libraries |
 |
OpenGL applications being linked should specify the appropriate
OpenGL library directory, /opt/graphics/OpenGL/lib/hpux{32|64}/, as an
additional library directory (-L ) to the
linker. For example:
% cc +DD64 -I/opt/graphics/OpenGL/include \
-L/opt/graphics/OpenGL/lib/hpux64 -o foo foo.c \
-lGLU -lGL -lXm -lXt -lXext -lX11-lm |
The following additional libraries for OpenGL support can be
found in the HP-UX OpenGL Run Time Environment and Developer's Kit
(GraphicsOpenGL):
-
libGL.so
-
libGLU.so
-
libGLw.so
HP 3D Technology for the Java Platform version 1.3 is available
for both PA-RISC and Itanium®
platforms. 3D Technology for Java is a set of Java class libraries,
layered on top of OpenGL, that allows development of 3D graphics
applications in Java. HP 3D Technology for Java is a standard
component of the Technical Computing Operating Environment.
HP-UX Developer's Toolkit:
http://h20293.www2.hp.com/portal/swdepot/displayProductsList.do?category=DTDC
HP-UX 11.00 Graphics Technical Computing Environment:
http://h20293.www2.hp.com/portal/swdepot/displayProductsList.do?category=ER
HP 3D Technology for Java:
http://www.hp.com/go/java
Chapter 14. Clustering
Considerations
This chapter discusses the clustering technology that HP-UX
offers.
A Serviceguard cluster is a networked grouping of servers (host
systems known as nodes) having sufficient redundancy of software and
hardware that a single point of failure (SPOF) will not
significantly disrupt service. Application services (individual
HP-UX 11i processes) and all the resources needed to support the
application are grouped together in packages. In the event of a
single service, node, network, or other resource failure,
Serviceguard can automatically transfer control of the package to
another node within the cluster, allowing services to remain
available with minimal interruption.
These application packages are the basic units that are managed
and moved within an enterprise cluster. Packages can be moved from
node to node with simple operator commands, allowing scheduled
maintenance and workload balancing.
HP Serviceguard combines multiple UNIX servers into an entity
called an enterprise cluster. The servers (nodes) of a cluster are
connected in a loosely coupled manner, each maintaining its own
separate processor(s), memory, and operating system. The cluster
allows application services to continue if a hardware or software
failure occurs. In the event of a failure of a component, the
redundant component takes over, protecting users from software
failures as well as from SPU, disk, or LAN component failures.
Simple operator commands allow scheduled maintenance to be
performed on one node of a cluster while other nodes continue to
provide support for critical applications. When the maintenance is
complete, the node rejoins the cluster and assumes its normal
workload of application packages. This same method can also be used
to perform rolling operating system upgrades across a cluster.
Application packages provide powerful and flexible workload
balancing mechanisms after a node failure. The net effect of this is
the provision of a virtually seamless service to the users.
Serviceguard allows multiple servers to be configured in a
cluster for automatic failover. Each Serviceguard cluster has a
minimum of two LAN connections between the servers in the cluster
that are typically used to carry data and heartbeat messages between
the cluster nodes. Heartbeat messages may travel over:
-
Ethernet
-
Fast Ethernet
-
FDDI
-
token ring
-
Gigabit Ethernet
-
serial lines
At a minimum, use one LAN connection to exclusively carry
heartbeat messages. Use the other LAN connection, in addition to its
use in connecting clients to the cluster, to provide redundancy for
heartbeat messages. You can add more LANs to increase redundancy and
performance. Each node in the cluster has its own private disk for
the operating system and its required data.
In addition to the private disk, the cluster nodes are connected
to shared-disk storage. If the shared disks are SCSI disks, there
can be no more than four nodes sharing a disk. If the shared disks
are Fibre Channel connected or are HP StorageWorks XP Disk Arrays,
all nodes can access the shared disks. Concurrent data access is not
supported.
In configuring the cluster, you may choose to designate all
servers in a Serviceguard cluster as active, or choose some as
active and some as standby servers. If you designate some of the
servers as standby servers, you can take advantage of either
Serviceguard's Rotating Standby or Automatic Failback features. With
Rotating Standby, when the failed system is repaired and rejoins the
cluster, it becomes the new standby system.
Automatic failback allows applications to return to the systems
on which they were originally configured. Serviceguard also allows
for online configuration changes to the cluster, such as adding
nodes, application packages, or disk volumes to the running
cluster.
Cluster Monitoring |
 |
HP offers system- and cluster-monitoring software as part of the
Mission Critical Operating Environment bundle. HP Event Monitoring
Service (EMS) is a system-monitoring application that works with
Serviceguard and provides real-time monitoring and notification of
error conditions. If EMS determines that a component has exceeded a
predefined error threshold, EMS will trigger a failover. HP provides
application programming interfaces (APIs) and a development kit for
EMS, allowing you to write and customize your own monitors.
Failover Scripts |
 |
HP provides scripts, or agents, through its Enterprise Cluster
Master Toolkit to enable integration of various applications with
Serviceguard. When a prepackaged script is not available for a
particular application, you or HP consultants can do the integration
by using the Serviceguard package control script templates. To make
customization easier, HP has a library of templates that have been
developed for hundreds of applications.
Integrated Solutions |
 |
Serviceguard integration with key server virtualization
technologies including HP Workload Manager, on-demand solutions
(including Pay per Use and Instant Capacity on Demand) and
partitioning, creates a unique offering called the Virtual Server
Environment (VSE). VSE consists of dynamically sized virtual
servers. Each of these servers intelligently expands or contracts
based on the service level objectives of the applications hosted on
the server. VSE manages a pool of resources and moves resources
dynamically and automatically to meet the resource needs of the
highest priority applications before fulfilling the requests of
lower priority applications.
In the management process, the VSE moves resources out of
underutilized virtual servers or reroutes applications to
underutilized virtual servers – the set service levels will follow
the application accordingly. This creates improved return on IT
investments, better asset utilization, operational and
administrative cost savings, improved quality of IT service, and a
significant improvement in an organization's agility and ability to
react to unforeseen business events.
Serviceguard Extension for SAP R/3 |
 |
For SAP R/3 customers, HP has additional offerings to ensure that
there is no SPOF for enterprise-wide SAP implementations.
Serviceguard Extension for SAP (SGeSAP) provides a high-availability
failover environment for the SAP central instance. (Oracle,
Informix, and DB2 are supported as the backend relational database
management systems [RDBMSs] with SAP.) This product is a toolkit
that provides automated failover for SAP mySAP components based on
SAP WAS, SAP LiveCache, and SAP R/3.
On HP-UX 11i v2, the SGeSAP Toolkit Version B.03.09 will provide
the same functionality as B.03.08 provides for PA-RISC systems
running HP-UX 11i v1. Note that on its initial release not all SAP
products are supported on HP-UX 11i v2; therefore, they will not be
supported with SGeSAP for HP-UX 11i v2. When SAP completes the
availability of their products on HP-UX 11i v2, support for SGeSAP
will be added for those products, too.
Contact SAP for SAP/R3 availability and HP for availability of
the SAP extension scripts on Itanium®-based systems.
Serviceguard Extension for RAC |
 |
Serviceguard Extension for RAC (SGeRAC for short and formally
known as Serviceguard OPS Edition) version A.11.15.00 is an add-on
product to Serviceguard that provides a framework for using Oracle
Parallel Server (OPS) and Oracle 9i Real Application
Cluster (RAC) software. It supports the maximum number of cluster
nodes supported on the target platform when running Oracle
9i RAC. SGeRAC includes the:
The package manager ensures that applications and the resources
on which they are dependent fail over as a unit. Serviceguard
Extension for RAC also offers customers the flexibility to use HP
Shared LVM (SLVM) or Veritas Cluster Volume Manager (CVM). HP Shared
LVM is an enhancement to the LVM subsystem and a free component of
SGeRAC that allows common logical volumes to be shared between
nodes. It defines a cluster by grouping many devices into a single
volume group that is then managed as a single entity. This
simplifies the management of a large database, and improves database
performance.
Veritas CVM, an enhanced version of the Veritas volume manager
(VxVM), is also supported by Serviceguard Extension for RAC and
requires the purchase of an additional license. It allows you to
modify and add nodes to a cluster without shutting the cluster down,
and adds an enhanced set of volume management features. To activate
a disk group on more than a two-node Serviceguard Extension for RAC
cluster, the full CVM license is required. Veritas CVM is limited to
only supporting the Oracle 9i RAC cluster configuration.
Use HP Shared LVM to configure the root logical volumes and cluster
lock disk.
Each system or CPU of an enterprise cluster must license one copy
of Serviceguard Extension for RAC. Oracle 9i Real
Application Cluster software is purchased separately from Oracle
Corporation. For more information and a list of new features, see
the Serviceguard Extension for RAC A.11.15.00 Release Notes at:
http://docs.hp.com/hpux/ha/
Serviceguard NFS Toolkit |
 |
Serviceguard NFS A.11.23.01 is a toolkit that includes
configuration files and control scripts, and allows you to use
Serviceguard to set up highly available NFS servers. Also included
is a special monitor script that is used to monitor the health of
NFS services. If a service fails, the monitor will issue a restart
on the local node or trigger a node switch. You need purchase only
one toolkit per cluster, not one per node.
Serviceguard Manager |
 |
HP provides Serviceguard Manager version A.03.00, a Java-based
GUI that allows monitoring and control of Serviceguard clusters from
a single workstation. You can use Serviceguard Manager from the
OpenView Network Node Manager (NNM), OpenView IT Operations (ITO),
or a standalone workstation and support clusters on different
subnets.
The Serviceguard Manager interface is available in five languages
and can display several sessions, where each session represents a
connection. Intuitive color-codes and badges help systems
administrators quickly identify an issue or potential issue within
the cluster and resolve the problem, which maximizes application
availability.
For more details, see the Serviceguard Manager Version A.03.00
Release Notes, available at:
http://docs.hp.com/hpux/ha/#Serviceguard
Quorum Service |
 |
Two-node clusters typically present unique problems in terms of
preserving data integrity when there is a node failure or a network
failure. The cluster nodes exchange heartbeat messages over the LANs
connecting them. If a message is not received from a node that is a
cluster member within a certain period of time, the cluster attempts
to reform itself. If there is a network failure, or if the network
is too congested so that heartbeats are missed, both nodes will
attempt to reform the cluster. In addition, if you had two very
large nodes in a cluster and one failed, the cluster would be left
with just 50 percent of its total processing power.
With a three-node or larger cluster, the portion of the original
cluster with the most number of nodes is allowed to reform the
cluster, and the nodes in the disconnected subnet are removed from
cluster membership. In a two-node cluster, each cluster node
represents exactly half of the cluster. If both nodes were to
succeed in their attempts to reform the cluster, data corruption to
the shared disks could easily occur since both nodes could have
applications running that need to access the same data.
To prevent this, HP introduced the concept of a cluster lock as a
tiebreaker. The cluster lock is implemented by means of a lock disk,
an area on a shared disk volume. Only one node at a time is allowed
to own the cluster lock. The node that wins the cluster lock is
allowed to reform the cluster with itself as the only node. The
other cluster node is not allowed to reform the cluster and, without
network communications, cannot rejoin the cluster.
The disk is dedicated to the quorum function and cannot be used
to hold any data. Serviceguard provides Quorum Service software as
an alternative to the cluster lock disk. The Quorum Service is a
process that runs on an HP-UX 11i host outside of the cluster(s)
that it provides services to. The Quorum Service, which provides the
functions of a lock disk, may be used in clusters with any number of
nodes, and an individual quorum service may provide tie-breaking
services to as many as 50 clusters containing up to a total of 100
nodes. The Quorum Service is a separate product provided on the
"Serviceguard Distributed Components" CD.
On HP-UX 11i v2, the Quorum Service version A.2.0 runs on both
HP-UX and Linux and supports multiple HP-UX and/or Linux Clusters.
The Quorum Service can be configured in a package in a cluster.
For more details, see the Serviceguard Quorum Service A.2.0
Release Notes, available at:
http://docs.hp.com/en/ha.html#Quorum%20Server
Geographically Dispersed Cluster
Solutions |
 |
Enterprise customers who require protection beyond a single data
center can take advantage of HP's Geographically Dispersed Cluster
Solutions (also referred to as Disaster Tolerant Solutions).
Serviceguard also offers this extended distance protection by
separating its data centers up to 100 km by using Dense Wavelength
Division Multiplexing (DWDM) along with Mirrordisk/UX for
software-based data replication. This solution is referred to as
Extended Campus Cluster. Serviceguard is the foundation for two
additional solutions, including MetroCluster and Continental
Clusters, which offer robustness and flexibility for customers
requiring greater performance and greater distance protection.
Cluster Interconnects |
 |
The Serviceguard interconnect between servers is made up of two
industry-standard LANs. Using LAN connections in a cluster yields a
maximum of 640MB/sec communication between the servers in a
Serviceguard cluster.
For Oracle RAC clusters, we recommend using Hyperfabric, HP's
high-speed interconnect, where the message passing done by the
database will benefit from the high-speed link.
Table 14-1,
“Supported Cluster Interconnect Technologies” shows the
supported interconnects.
Table 14-1. Supported Cluster
Interconnect Technologies
| Interconnect |
HP Serviceguard
A.11.15 |
| Ethernet |
Supported |
| Fast Ethernet |
Supported |
| Gigabit Ethernet |
Supported |
| FDDI |
Supported |
| HyperFabric2 (up to 2.4 Gb/sec) |
Supported |
| Token Ring |
Supported |
| Memory Channel (100 MB/sec) |
Not Available |
| Serial lines |
Supported |
High-Availability Agents |
 |
Table 14-2,
“High-Availability Agents (Scripts) for Third-Party
Applications” lists some of the high-availability agents, or
scripts, available from vendors offered with their clustering
solutions. These agents make the application cluster-aware and
generally provide graceful failover capability. Applications can be
integrated by either scripts or APIs. Failure recovery is performed
by either restarting the application on the local node or moving it
to another functional node in the cluster. The scripts can have
dependencies between applications to force an ordered startup,
shutdown, or ordered relocation of applications. This functionality
is available by a separate scripting toolkit with Serviceguard.
Table 14-2. High-Availability Agents
(Scripts) for Third-Party Applications
| Available Agents |
HP Serviceguard
A.11.15 |
| Oracle 8 |
PA-RISC only |
| Oracle 9i |
Yes |
| Oracle RAC |
Yes |
| Informix |
Yes |
| Sybase |
Yes |
| IBM DB2 |
Yes |
| Netscape FastTrack/Enterprise |
No |
| Netscape Directory Server |
No |
| Netscape Collaboration Server |
No |
| Netscape Mail Server |
No |
| Apache Web Server |
No[a] |
| Zeus Web Server |
No[a] |
| BEA/Tuxedo |
Yes |
| Baan |
No[a] |
| SAP R/3 |
Yes |
| PeopleSoft |
No[a] |
| Candle |
No[a] |
| Oracle Financials, Manufacturing |
No[a] |
| Unicenter TNG |
No[a] |
| Network File System (NFS) |
Yes |
| Domain Naming System (DNS) |
No[a] |
| SAMBA PC Service |
No[a] |
Additional information about Serviceguard and related
high-availability topics may be found on HP's high-availability Web
page:
http://www.hp.com/go/ha
Online versions of user guides and white papers are available
from the HP-UX 11i High Availability Documentation Web page at:
http://docs.hp.com/hpux/ha/
Appendix A. Additional
Resources
Hewlett-Packard has a large and growing presence on the Internet.
This appendix lists some of the ftp sites, archives, user groups,
patch servers, and Web pages available to HP users through the
Internet. This information should by no means be considered
comprehensive.
Like many other operating systems, HP-UX 11i provides precompiled
bundles of commonly used free software packages. This software is
provided for free and is not supported by HP. HP is not responsible
for the ported defects from the Open Source communities. However, HP
will report the defects to the related Open Source community and
incorporate the appropriate defect repairs for each new release.
The Technical Computing Open Source Product bundle is installed
as part of the technical computing environment. As such, the Minimum
Technical Computing (MTOE), Technical Computing (TCOE), and Mission
Critical (MCOE) operating environments will install the bundle by
default. The bundle includes binaries, documentation, and libraries.
The included libraries are intended for use only by the included
binaries and not for development purposes. The applications included
are shown in Table A-1,
“Technical Computing Open Source Applications”.
Table A-1. Technical Computing Open
Source Applications
| Applications |
Location |
| Bourne Again Shell |
/opt/OpenSource/bin/bash |
| GNU make |
/opt/OpenSource/bin/make |
| CDRecord |
/opt/OpenSource/bin/cdrecord,
/opt/OpenSource/bin/mkisofs |
| GNU Emacs |
/opt/OpenSource/bin/emacs |
| GNU Less |
/opt/OpenSource/bin/less |
| extended C Shell (TENEX-like C Shell) |
/opt/OpenSource/bin/tcsh
|
For more information on these Open Source applications, refer to
the associated manpages installed under /opt/OpenSource/man.
Table A-2,
“HP Web Sites that Discuss Porting Issues” lists the HP Web
sites relevant to porting issues.
Table A-2. HP Web Sites that Discuss
Porting Issues
| Web Site |
Description |
| HP Corporate Home Page |
Companywide information:
http://www.hp.com/ |
| HP Developer and solution partner portal |
Access to product and technology information for
developers:
http://www.hp.com/dspp |
| HP Developer's Resource |
Information resource for software developers:
http://devresource.hp.com/drc/index.jsp |
| HP Online Technical Documentation |
HP reference pages, white papers, and manuals:
http://docs.hp.com/ |
| HP Software Depot |
Online store providing instant access to HP software for
free trial and purchase:
http://software.hp.com/ |
| HP Patches |
Search, browse, and retrieve HP patches, and access the HP
Patch Catalog through the HP IT Resource Center. Registration
is required, but it is free.
http://www2.itrc.hp.com/service/patch/mainPage.do |
| Solaris Software Transition Kits |
Documents and tools for transitioning software from Solaris
8 to HP-UX 11i:
http://devrsrc1.external.hp.com/STKS/ |
| HP Computer Languages and Tools home page |
Compilers, debuggers, and performance analysis tools:
http://www.hp.com/go/lang/ |
| HP Education |
Site for all HP training classes:
http://education.hp.com/ |
| IT Resource Center |
IT knowledge, tools, and services:
http://itresourcecenter.hp.com/ |
| ITRC Maintenance/Support |
HP Electronic Support Center-U.S:
http://us-support.external.hp.com/common/bin/doc.pl |
| ITRC Maintenance/Support Europe |
HP Electronic Support Center-Europe:
http://europe-support.external.hp.com/common/bin/doc.pl |
| ITRC Education |
ITRC site for HP education from seminars to online
training:
http://education.itresourcecenter.hp.com/ |
| HP Intel® Itanium® home page |
HP's Future of Computing Web site:
http://www.hp.com/products1/itanium/ |
| HP Enterprise Computing home page |
HP's Large Enterprise Business Web site:
http://www.hp.com/enterprise |
Established by the University of Liverpool in England, this is
the primary HP-UX public domain software site. The Centre is a joint
initiative sponsored by the Department of Computer Science at the
University of Liverpool and Hewlett-Packard. The centre and its
official archive sites port public domain software to run under
HP-UX systems, and act as a repository for this software
worldwide.
Table A-3,
“HP-UX Porting and Archive Centre Site and Mirrors” lists the
sites and mirrors.
Table A-3. HP-UX Porting and Archive
Centre Site and Mirrors
| Interex |
|
Interex is the International Association
of Hewlett-Packard Computing Professionals. It is an
independent, not-for-profit association providing information,
education, and advocacy services to over 20,000 members
worldwide.
http://www.interex.org/ |
| Interex
Netherlands |
| |
|
A user group intended for end users,
system and network administrators, programmers, consultants,
and managers in the Netherlands. Interex Netherlands is a
merger of HP DutchWorks and Dutch Users Group HP.
http://hpux.its.tudelft.nl/ |
| HP/Works
|
|
HP/Works - The HP Technical Computing
User Group, is an independent group, supporting all users of
HP computer systems running the HP-UX, DOMAIN, or NT operating
systems throughout Europe. Services include special interest
groups, training at discounted rates, technical workshops,
technical conferences and meetings, contributed software
libraries, quarterly technical newsletter, technical
help-line, and dialog with HP.
http://www.hpworks.org.uk/ |
As of January 1999, the comp.sys.hp.*
hierarchy consisted of the following subgroups:
-
news://comp.sys.hp.hardware/ — Discussion of
Hewlett-Packard systems hardware, including workstations,
Xterminals, mainframes, printers, and any other hardware questions
except HP calculators, which are discussed in comp.sys.hp48.
-
news://comp.sys.hp.apps/ — Discussion of software
and applications running on any HP platform, although HP-UX and
MPE-specific software solutions are discussed in the corresponding
comp.sys.hp.hpux and comp.sys.hp.mpe newsgroups.
-
news://comp.sys.hp.hpux/ — Discussion of system
administration and other issues pertaining to the HP-UX operating
system.
-
news://comp.sys.hp.misc/ — Discussion of issues
not covered in any other comp.sys.hp.*
newsgroup.
For the latest HP aC++ news and update information subscribe to
the cxx-dev list server (like a notes group).
Send a message to:
mailto:%20majordomo@cxx.cup.hp.com
Include the command subscribe list-name in the body of the message.
Available list-names are:
-
cxx-dev-announce —
C++ Development Announcements
-
cxx-dev — C++
Development Discussion List
-
cxx-dev-digest — C++
Development Discussion List
-
hpux-devtools-announce — Announcements about
other development issues
-
hpux-devtools —
Development tools discussion list
-
caliper — Caliper
users
-
caliper-announce —
Caliper announcements
Appendix B. Porting
Checklist
When filled in, this checklist organizes in one place the answers
to many of the questions related to a porting effort.
-
What is the name of the application to be
ported?
-
What is the primary reason for porting the
application?
-
In one sentence, describe what the
application does:
-
On what operating systems does the current
application run? Give specific versions as reported by the
software where you can.
-
To what operating system(s) will the
application be ported?
-
List all languages and versions that are
used to construct the application (examples: Perl 5.004, Java
2):
-
List all layered, proprietary, and
third-party products the application depends on for proper
operation (examples: Oracle9i database, OpenGL,
Apache):
-
Do you have all of the source code files
required to build the application? Yes No
-
What is the quantity of source code? You can
specify in terms of lines of code or megabytes of uncompressed
source files.
-
What is the quantity of data associated with
this application? Can you characterize its structure (examples:
formatted, in a database, or unformatted binary)?
-
When was the last time the application
environment was completely recompiled and rebuilt from source?
-
Is the application rebuilt regularly? How
frequently?
-
Is the application actively maintained by
developers who know it well?
-
How is a new build of the application tested
or verified for proper operation?
-
Do you have performance characterization
tools to assist with optimization?
-
Will these tests, validation suites, or
performance tools need to be ported?
-
Which source-code and configuration
management tools are used (examples: make, SCCS, RCS)?
-
Do you have a development and test
environment separate from your production systems?
Yes No
-
What procedures are in place for rolling in
a new version of the application into
production?
Appendix C. Library
Equivalence
Table C-1,
“Solaris libraries and equivalent on HP-UX” shows the Solaris
library names and their HP-UX equivalence where the names are
different:
Table C-1. Solaris libraries and
equivalent on HP-UX
| lib4014.so* |
libcurses.so |
| libaio.so* |
libc.so |
| libbsdmalloc.so* |
libc.so |
| libc.so |
libc.so |
| libc.so |
libCsup.so |
| libc.so |
libI077.a |
| libc.so |
libI077.so |
| libc.so |
libm.so |
| libcrypt.so* |
libc.so |
| libform.so* |
libc.so |
| libgss.so |
libdcekt.so |
| libgss.so |
libgss.so |
| libgss.so |
libgssapi_krb5.so |
| libmalloc.so* |
libc.so |
| libmapmalloc.so* |
libc.so |
| libmd5.so* |
libnsl.so |
| libmenu.so* |
libc.so |
| libmtmalloc.so* |
libc.so |
| libnsl.so |
libc.so |
| libnsl.so |
libnsl.so |
| libnsl.so |
librpcsvc.so |
| libnsl.so |
libxti.so |
| libplot.so* |
libcurses.so |
| libproc.so* |
libc.so |
| librac.so* |
libnsl.so |
| libresolv.so* |
libc.so |
| libresolv.so* |
libkrb5.so |
| librt.so |
libc.so |
| librt.so |
librt.so |
| libsec.so |
libc.so |
| libsocket.so* |
libc.so |
| libsocket.so* |
libipv6.so |
| libsocket.so* |
libxnet.so |
| libthread.so* |
libc.so |
| libthread.so* |
libnsl.so |
| libtnfprobe.so* |
libc.so |
| libtnfprobe.so* |
libpthread.so |
| libvt.so* |
libcurses.so |
* Solaris specific library names.
Appendix D. Supported
Locales
Note that locales that use the UTF-8 or Latin-9 (ISO8859-15)
codesets support the euro characters, while locales with an @euro suffix define the local currency sign to
be the euro character.
On HP-UX 11i v2, some system support for Latin and South American
utf8 locale binaries are not delivered due to disk space
considerations. However, source files for the locales are provided
under /usr/lib/nls/loc/src, and you may
build these binaries by using the localedef command. See the localedef(1M) reference pages for more
information.
Table D-1,
“Supported Locales” lists the names of all the supported locales
for Solaris and their compatible names on HP-UX 11i.
Table D-1. Supported Locales
| Language |
HP-UX 11i |
| Arabic (Algeria) |
|
| Arabic (Saudi Arabia) |
| ar_SA.iso88596 |
| ar_SA.arabic8 | |
| Bulgarian |
|
| C |
| C |
| C.iso88591 |
| C.iso885915 |
| C.iso885915@euro (HP 11i v1.6 and higher only) |
| C.utf8 | |
| Catalan |
|
| Chinese (People's Republic of China) |
| zh_CN.utf8 |
| zh_CN.hp15CN |
| zh_CN.gb18030 | |
| Chinese (Hong Kong) |
| zh_HK.hkbig5 |
| zh_HK.big5 (HP-UX 11i v1 only) |
| zh_HK.utf8 | |
| Chinese (Taiwan) |
| zh_TW.big5 |
| zh_TW.ccdc |
| zh_TW.eucTW |
| zh_TW.utf8 | |
| Croatian |
|
| Czech |
|
| Danish |
| da_DK.iso88591 |
| da_DK.iso885915@euro |
| da_DK.roman8 | |
| Dutch |
| nl_NL.iso88591 |
| nl_NL.iso885915@euro |
| nl_NL.roman8 | |
| English with Euro |
|
| English (Great Britian) |
| en_GB.iso88591 |
| en_GB.iso885915@euro |
| en_GB.roman8 | |
| English (United States) |
| en_US.iso88591 |
| en_US.roman8 | |
| Finnish |
| fi_FI.iso88591 |
| fi_FI.iso885915@euro |
| fi_FI.roman8 | |
| Flemish |
|
| French (Belgium) |
|
| French (Canada) |
| fr_CA.iso88591 |
| fr_CA.iso885915 |
| fr_CA.iso885915@euro (HP-UX 11i v1.6 and higher
only) |
| fr_CA.roman8 |
| fr_CA.utf8 | |
| French (France) |
| fr_FR.iso88591 |
| fr_FR.iso885915@euro |
| fr_FR.roman8 |
| fr_FR.utf8 | |
| French (Switzerland) |
|
| German (Germany) |
| de_DE.iso88591 |
| de_DE.iso885915@euro |
| de_DE.roman8 |
| de_DE.utf8 | |
| German (Switzerland) |
|
| Greek |
| el_GR.iso88597 |
| el_GR.greek8 |
| el_GR.utf8 | |
| Hebrew |
| iw_IL.hebrew8 |
| iw_IL.iso88598 | |
| Hebrew (deprecated) |
|
| Hungarian |
|
| Icelandic |
| is_IS.iso88591 |
| is_IS.iso885915@euro |
| is_IS.roman8 | |
| Italian |
| it_IT.iso88591 |
| it_IT.iso885915@euro |
| it_IT.roman8 |
| it_IT.utf8 | |
| Japanese |
| ja_JP.SJIS |
| ja_JP.eucJP |
| ja_JP.kana8 |
| ja_JP.utf8 | |
| Korean |
|
| Lithuanian |
|
| Norwegian |
| no_NO.iso88591 |
| no_NO.iso885915@euro |
| no_NO.roman8 | |
| POSIX |
|
| Polish |
|
| Portuguese (Brazil) |
| pt_BR.iso88591 (HP-UX 11i v2 only) |
| pt_BR.iso885915 (HP-UX 11i v2 only) |
| pt_BR.utf8 (HP-UX 11i v2
only) | |
| Portuguese (Portugal) |
| pt_PT.iso88591 |
| pt_PT.iso885915@euro |
| pt_PT.roman8 | |
| Rumanian |
|
| Russian |
|
| Slovak |
|
| Slovene |
|
| Spanish (Argentina) |
| es_AR.iso88591 (HP-UX 11i v2 only) |
| es_AR.iso885915 (HP-UX 11i v2 only) |
| es_AR.utf8 (HP-UX 11i v2
only) | |
| Spanish (Bolivia) |
| es_BO.iso88591 (HP-UX 11i v2 only) |
| es_BO.iso885915 (HP-UX 11i v2
only) | |
| Spanish (Chile) |
| es_CL.iso88591 (HP-UX 11i v2 only) |
| es_CL.iso885915 (HP-UX 11i v2 only) |
| es_CL.uft8 (HP-UX 11i v2
only) | |
| Spanish (Columbia) |
| es_CO.iso88591 (HP-UX 11i v2 only) |
| es_CO.iso885915 (HP-UX 11i v2 only) |
| es_CO.utf8 (HP-UX 11i v2
only) | |
| Spanish (Costa Rica) |
| es_CR.iso88591 (HP-UX 11i v2 only) |
| es_CR.iso885915 (HP-UX 11i v2
only) | |
| Spanish (Ecuador) |
| es_EC.iso88591 (HP-UX 11i v2 only) |
| es_EC.iso885915 (HP-UX 11i v2
only) | |
| Spanish (El Salvador) |
| es_SV.iso88591 (HP-UX 11i v2 only) |
| es_SV.iso885915 (HP-UX 11i v2
only) | |
| Spanish (Guatemala) |
| es_GT.iso88591 (HP-UX 11i v2 only) |
| es_GT.iso885915 (HP-UX 11i v2
only) | |
| Spanish (Mexico) |
| es_MX.iso88591 (HP-UX 11i v2 only) |
| es_MX.iso885915 (HP-UX 11i v2 only) |
| es_MX.utf8 (HP-UX 11i v2
only) | |
| Spanish (Nicaragua) |
| es_NI.iso88591 (HP-UX 11i v2 only) |
| es_NI.iso885915 (HP-UX 11i v2
only) | |
| Spanish (Panama) |
| es_PA.iso88591 (HP-UX 11i v2 only) |
| es_PA.iso885915 (HP-UX 11i v2
only) | |
| Spanish (Paraguay) |
| es_PY.iso88591 (HP-UX 11i v2 only) |
| es_PY.iso885915 (HP-UX 11i v2
only) | |
| Spanish (Peru) |
| es_PE.iso88591 (HP-UX 11i v2 only) |
| es_PE.iso885915 (HP-UX 11i v2 only) |
| es_PE.utf8 (HP-UX 11i v2
only) | |
| Spanish (Puerto Rico) |
| es_PR.iso88591 (HP-UX 11i v2 only) |
| es_PR.iso885915 (HP-UX 11i v2 only) |
| es_PR.utf8 (HP-UX 11i v2
only) | |
| Spanish (Spain) |
| es_ES.iso88591 |
| es_ES.iso885915@euro |
| es_ES.roman8 |
| es_ES.utf8 | |
| Spanish (Uraguay) |
| es_UY.iso88591 (HP-UX 11i v2 only) |
| es_UY.iso885915 (HP-UX 11i v2 only) |
| es_UY.utf8 (HP-UX 11i v2
only) | |
| Spanish (Venezuela) |
| es_VE.iso88591 (HP-UX 11i v2 only) |
| es_VE.iso885915 (HP-UX 11i v2 only) |
| es_VE.utf8 (HP-UX 11i v2
only) | |
| Swedish |
| sv_SE.iso88591 |
| sv_SE.iso885915@euro |
| sv_SE.roman8 |
| sv_SE.utf8 | |
| Thai |
|
| Turkish |
| tr_TR.iso88599 |
| tr_TR.turkish8 | |
| Universal |
|
C
- C, HP
C/ANSI C developer’s bundle
-
- compiler, C
compilers
- C compiler
-
- architecture-specific issues
-
- building 32–bit binaries, Building
32- or 64-Bit binaries
- building 64–bit binaries, Building
32- or 64-Bit binaries
- model numbers, Architecture-Specific
issues
- processor names, Architecture-Specific
issues
- building an executable, Architecture-Specific
issues
- compilation flags, Architecture-Specific
issues
- default behavior, Default
behavior
- directives, Compiler
directives and name spaces in HP C
- header files, HP
header file and library implementation of name spaces
- language differences, Language
differences
- libraries, HP
header file and library implementation of name spaces
- name space implementation, HP
header file and library implementation of name spaces
- options, C
compiler options
- C shell, C
Shell (csh)
- C++ compiler, C++
compilers
-
- default behavior, Default
behavior
- exception handling, Exception
handling
- implementing a library
-
- templates, Templates
- language differences, Language
differences
- options, C++
compiler options
- other issues, Other
compiler issues
- templates, Templates
-
- variations, Templates
- cache trashing, Cache
Thrashing
- CAE, Internationalization
Support
- catalogs
-
- message, Message
Catalogs
- CDE (see Common Desktop Environment)
- checklist for porting applications, Porting
Checklist
- child process
-
- tracing, Process
Tracing
- cleanup routines (see fini routines)
- COBOL compiler, COBOL
- code set
-
- converters, Codeset
Converters
- geniconvtbl, Codeset
Converters
- iconv, Codeset
Converters
- codeset, Locales
- command
-
- make, Makefiles
- Common Applications Environment (see CAE)
- Common Desktop Environment, Run-Time
Considerations
- compiler, Compiler
overview
-
- aC++, HP
aC++ and HP ANSI C/C89 compilers
- ANSI C, HP
aC++ and HP ANSI C/C89 compilers
- ANSI C89, HP
aC++ and HP ANSI C/C89 compilers
- architecture-specific issues, Architecture-Specific
issues
- C, HP
C/ANSI C developer’s bundle, C
compilers
- C++, C++
compilers
- COBOL, COBOL
- Fortran, FORTRAN
- Java 2, Java
2 platform
- language differences, Language
differences, Language
differences
- licensing, Compiler
overview
- optimization, Optimization
-
- flags, Optimization
- overview, Compiler
overview
- support, Compiler
overview
- compilers
-
- floating point compiler options, +FP
Compiler Option
- compiling
-
- C language, C
language
- C++ language, C++
language
- GNU C/C++ language, GNU
C/C++ language
- Java language, Java
language
- OpenGL applications, Compiling
and Linking OpenGL Applications
- software, Compiling
the software
- X Window System applications, Compiling
and Linking X Window System Applications
- configure, Building
Portable Software
-
- config.guess, Building
Portable Software
- config.sub, Building
Portable Software
- converters
-
- code set, Codeset
Converters
D
- debuggers
-
- differences, Debugging
- debugging tools, Debugging
Tools
-
- ADB, Debugging
Tools
- locating information, Locating
Debug Information
- Q4, Debugging
Tools
- shared libraries, Debugging
Shared Libraries
- WDB, Debugging
Tools, Debugging
on HP-UX with WDB
- development environment
-
- overview, Development
environment
- development tools
-
- debugging, Debugging
Tools
- makefile, Makefiles
- other, Other
development tools
- directory permissions
-
- system defaults, Permissions
and umask
- DLKM, Loadable
Kernel Modules
-
- APIs, Loadable
Kernel Modules
- dlopen, Using
dlopen
- dynamic library loading, Dynamic
Library Loading
- Dynamic Loadable Kernel Modules (see DLKM)
L
- L10N (see localization)
- ld
-
- command-line options, Command-line
options
- link editor, Linkers
and loaders
- LD_LIBRARY_PATH, Environment
Variables
- libpthread, Comparing
Solaris libthread and HP-UX libpthread, Comparing
Solaris libpthread and HP-UX libpthread
-
- comparing, Comparing
Solaris libpthread and HP-UX libpthread
- comparing with libthread, Equivalent
Library Routines
- libraries, Versioning
Shared Libraries
-
- (see also shared libraries)
- comparing libthread and libpthread, Comparing
Solaris libthread and HP-UX libpthread
- dynamic loading of, Dynamic
Library Loading
- libpthread, Comparing
Solaris libthread and HP-UX libpthread, Comparing
Solaris libpthread and HP-UX libpthread
- libthread, Comparing
Solaris libthread and HP-UX libpthread
- OpenGL required libraries, Required
Libraries
- pthread, Comparing
Solaris libpthread and HP-UX libpthread
- thread-safe, Thread-Safe
Libraries and Reentrant Functions
- X Window required libraries, Required
Libraries
- libthread, Comparing
Solaris libthread and HP-UX libpthread
-
- comparing with libpthread, Equivalent
Library Routines
- linker, Linkers
and loaders
-
- command-line options, Command-line
options
- differences, Background
information on linker differences
- direct binding support, Background
information on linker differences
- dynamic, Run-Time
linking
- lazy loading of shared libraries, Background
information on linker differences
- passing options, Passing
options to the linker
- run-time, Run-Time
linking
- search for loaded libraries, Specifying
search paths for the run-time linker
- specifying search path, Specifying
search paths for the run-time linker
- tools, Linker-related
tools
-
- analyze and modify executables, Linker-related
tools
- analyze and modify shared libraries, Linker-related
tools
- using dlopen, Using
dlopen
- weak symbols, Support
for Weak Symbols
- linking
-
- OpenGL applications, Compiling
and Linking OpenGL Applications
- X Window System applications, Compiling
and Linking X Window System Applications
- loadable kernel modules, Loadable
Kernel Modules
- loadable kernel subsystems, Loadable
Kernel Modules
-
- APIs, Loadable
Kernel Modules
- loader, Linkers
and loaders
-
- dynamic library loading, Dynamic
Library Loading
- environment variables, Environment
Variables
- locale, Locales
- locales, Locales
- localization, Internationalization
Support, Locales,
Message
Catalogs
-
- messages, Message
Catalogs
M
- make command, Makefiles
-
- options, Options
for the make command
- rules, Special-function
targets and make rules
- makefile, Makefiles
-
- similarities, HP-UX,
Solaris, and GNU makefile similarities
- malloc, Memory
Management
- memory
-
- management, Memory
Management
- mapped, Memory
Management
- shared, Memory
Management
- message catalogs, Message
Catalogs
- messages
-
- localization, Message
Catalogs
- mmap, Memory
Management
- Motif, Internationalization
Support
- multiprocessing, Threads
and Multiprocessing
O
- open source software, Freeware,
Open Source, Public Domain Software
- Open Source Software Collection, Freeware,
Open Source, Public Domain Software, Additional
Software
- OPEN3D, Compiling
and Linking OpenGL Applications
- OpenGL, Graphics
Issues, Compiling
and Linking OpenGL Applications
-
- include files, Required
Include Files
- optimization, Optimization,
Performance,
Optimization, and Profiling
-
- comparing levels, Optimization
- flags, Optimization
- OSSC, Freeware,
Open Source, Public Domain Software, Additional
Software
P
- patches
-
- obtaining, Patches
for HP-UX
- performance, Performance,
Optimization, and Profiling
- performance tool
-
- GlancePlus, GlancePlus
- HP Caliper, HP
Caliper
- HP Prospect, HP
Prospect
- pixel depth
-
- X Window System applications, Run-Time
Considerations
- porting
-
- assistance, Porting
services
- center, The
HP-UX Porting and Archive Centre
- debuggers, Debugging
- mapfile-versioned library, Versioning
shared libraries
- methodical approach, Linking
your application on HP-UX
- optimization, Optimization
- process, Porting
effort and considerations
- references, References
- software package, Packaging
- stages, Porting
process
- testing tools, Testing
and test scripts
- threaded applications, Threads
and Multiprocessing
- tips, Precautions
and advice
- transition kit, References
- porting checklist, Porting
Checklist
- POSIX shell, Bourne
Shell and POSIX Shell (sh)
- PowerStorm, Compiling
and Linking OpenGL Applications
- pragma
-
- UNALIGN, Alignment
Faults
- profiling, Performance,
Optimization, and Profiling
- PseudoColor
-
- X Window System applications, Run-Time
Considerations
- pthread, Comparing
Solaris libpthread and HP-UX libpthread
-
- API differences, Standard
POSIX 1003.1c pthread Interfaces
- attribute modification functions, Comparing
Solaris libpthread and HP-UX libpthread
- default attribute values, Comparing
Solaris libpthread and HP-UX libpthread
- ptrace, Process
Tracing
- public domain software, Freeware,
Open Source, Public Domain Software
S
- scripts
-
- cluster high availability scripts, High-Availability
Agents
- Serviceguard, Clustering
Considerations
- shared libraries
-
- versioning, Versioning
shared libraries, Versioning
Shared Libraries
- shared memory, Memory
Management
- shell, Shells
and Utilities
-
- Bourne, Bourne
Shell and POSIX Shell (sh)
- C, C
Shell (csh)
- Korn, Korn
Shell (ksh)
- POSIX, Bourne
Shell and POSIX Shell (sh)
- support, Available
Shells
- SHLIB_PATH, Environment
Variables
- shmget, Memory
Management
- software package
-
- aCC, Header
file and system library paths
- special-function targets, Special-function
targets and make rules
-
- availability, Special-function
targets and make rules
- standards
-
- comparison, Standards
comparison
- string
-
- functions, String
Manipulation
- strings, String
Manipulation
- symbols
-
- linker support for weak symbols, Support
for Weak Symbols
- system libraries, Header
file and system library paths
-
- location, Header
file and system library paths
- shared, Header
file and system library paths
T
- Technical Computing Open Source Product, Technical
Computing Open Source Product
- templates, Templates
-
- features, Templates
- third-party software
-
- availability, Third-party
software and tools
- thread, Threads,
Threads
and Multiprocessing
-
- attribute modification functions, Thread
Creation and Modifiable Thread Attributes
- build issues, Library
and Build Issues
- creating, Thread
Creation and Modifiable Thread Attributes
- debugging, Debugging
- default attribute values, Thread
Creation and Modifiable Thread Attributes
- library issues, Library
and Build Issues
- model, Threads,
Thread
Scheduling on HP-UX 11i v2
- modifying attributes, Thread
Creation and Modifiable Thread Attributes
- scheduling, Thread
Scheduling on HP-UX 11i v2
- tools
-
- linker, Linker-related
tools
- tracing
-
- child process, Process
Tracing
- TruColor
-
- X Window System applications, Run-Time
Considerations
W
- WDB debugger, Debugging
Tools, Debugging
on HP-UX with WDB
-
- alternate root functionality, Alternate
Root Functionality
- batch mode memory leak detection, Batch
Mode Memory Leak Detection
- command-line calls, Command-Line
Calls
- debugging at the machine-instruction level, Debugging
at the Machine-Instruction Level
-
- command shortcuts, WDB
Quick Points
- using the break command, The
break Command
- using the disassem command, The
disassemble Command
- using the examine command, The
x/i Command
- using the regs command, The
regs command
- deferred watchpoints, Deferred
Watchpoints
- list of substitution rules, List
of Substitution Rules
- mismatches between a library, Mismatches
Between a Library
- printing of locals and global variables, Printing
of Locals and Global Variables
- thread information, Thread
Information
- using breakpoints, Using
Breakpoints
X
- X (see X Window System)
-
- Version 11 (see X Window System)
- X Window System, Graphics
Issues, Required
Libraries
-
- applications, Run-Time
Considerations
- CDE, Run-Time
Considerations
- compiling applications, Compiling
and Linking X Window System Applications
- Display, Run-Time
Considerations
- localization, X/Motif
Applications
- PseudoColor, Run-Time
Considerations
- RootWindow, Run-Time
Considerations
- TrueColor, Run-Time
Considerations
- Visual Class, Run-Time
Considerations
- X11 (see X Window System)
- X11R5, Required
Include Files
- X11R6, Required
Include Files
- Xt, Internationalization
Support, X/Motif
Applications
| |