Using the chroot Command with Shared Libraries

Some users may use the chroot super-user command while developing and using shared libraries. This affects the path name that the linker stores in the executable file. For example, if you chroot to the directory /users/hyperturbo and develop an application there that uses the shared library libhype.so in the same directory, ld records the path name of the library as /libhype.so. If you then exit from the chrooted directory and attempt to run the application, the dynamic loader cannot find the shared library because it is actually stored in /users/hyperturbo/libhype.so, not in /libhype.so.

Conversely, if you move a program that uses shared libraries into a chrooted environment, you must have a copy of the dynamic loader, dld.so, and all required shared libraries in the correct locations.

Profiling Limitations

Profiling with the prof(1) and gprof(1) commands and the monitor library function is only possible on a contiguous chunk of the main program (a.out). Since shared libraries are not contiguous with the main program in virtual memory, they cannot be profiled. You can still profile the main program, though. If profiling of libraries is required, relink the application with the archive version of the library, using the -aarchive option.

Summary of HP-UX Libraries

What libraries your system has depends on what components were purchased. For example, if you did not purchase Starbase Display List, you cannot have the Starbase Display List library on your system.

HP-UX library routines are described in detail in sections 2 and 3 of the HP-UX Reference. Routines in section 2 are known as system calls, because they provide low-level system services; they are found in libc. Routines in section 3 are other "higher-level" library routines and are found in several different libraries including libc.

Each library routine, or group of library routines, is documented on a man page. Man pages are sorted alphabetically by routine name and have the general form routine(nL), where:

routine

is the name of the routine, or group of closely related routines, being documented.

nis the HP-UX Reference section number: 2 for system calls, 3 for other library routines.

L

is a letter designating the library in which the routine is stored.

For example, the printf(3S) manpage describes the standard input/output libc routines printf, nl_printf, fprintf, nl_fprintf, sprintf, and nl_sprintf. And the pipe(2) manpage describes the pipe system call.

The major library groups defined in the HP-UXReference are shown below:

NOTE: Certain language-specific libraries are not documented in the HP-UX Reference; instead, they are documented with the appropriate language documentation. For example, all FORTRAN intrinsics (MAX, MOD, and so forth) are documented in the HP FORTRAN/9000 Programmer's Reference.

Group

Description

(2)These functions are known as system calls. They provide low-level access to operating system services, such as opening files, setting up signal handlers, and process control. These routines are located in libc.

(3C) These are standard C library routines located in libc.

Summary of HP-UX Libraries 117