HP-UX Reference (11i v2 04/09) - 2 System Calls (vol 5)
s
sysconf(2) sysconf(2)
ZZZZ Library-specific number
q 0=32PA 1=64PA 2=32EM 3=64EM 4-9=Reserved
N 0 = archive library
1-9 = System V version of shared library
RETURN VALUE
Upon successful completion,
sysconf() returns the value of the named variable. If the value of name
is not recognized,
sysconf() returns −1 and sets
errno to [EINVAL]. If the value in name is defined
but is not supported in this environment,
sysconf() returns −1, but does not change errno.
CPU_IS_PA_RISC()
returns positive nonzero if cpuvers is an HP PA-RISC processor; zero if not.
ERRORS
If
sysconf() fails, the value of errno
(see errno(2)) is set to:
[EINVAL] The value of name is not valid.
EXAMPLES
The following example determines the number of times the system clock ticks each second:
#include <unistd.h>
long ticks;
...
ticks = sysconf(_SC_CLK_TCK);
The following example determines if the current processor is an HP PA-RISC machine:
#include <unistd.h>
if (CPU_IS_PA_RISC(sysconf(_SC_CPU_VERSION)))
...
WARNINGS
CPU_IS_PA_RISC()
is implemented as a macro.
Normally, the values returned from
sysconf() do not change during the lifetime of the calling process.
However, the value of the symbolic constant _POSIX_VERSION
and thus the value of
sysconf(_SC_VERSION)
can vary under certain circumstances. If either of the feature test macros
_POSIX1_1988 or _XPG3 is defined by the programmer prior to including <unistd.h>, the value of
_POSIX_VERSION is defined as
198808, in conformance with POSIX.1-1988, FIPS 151-1, and XPG3.
Otherwise, the value of
_POSIX_VERSION
is defined as 199009, in conformance with POSIX.1-1990.
Similarly, the value of the symbolic constant
_XOPEN_VERSION
and thus the value of
sysconf(_SC_XOPEN_VERSION)
can vary under certain circumstances. If the feature test macro
_XPG3 is defined by the programmer prior to including <unistd.h>, the value of _XOPEN_VERSION
is defined as 3, in conformance with XPG3. Otherwise, the value of _XOPEN_VERSION is defined as
4,
in conformance with XPG4.
See stdsyms (5) for more information about these feature test macros.
Any application that has a dependency on libdld.sl is a potential user of both archived and shared libc.
Applications that comprise both archived and shared components where
sysconf(_SC_LIBC_VERSION) may be invoked from both the archived and shared components may
get inconsistent return values from sysconf().
AUTHOR
sysconf() was developed by HP and POSIX.
CPU_IS_PA_RISC() was developed by HP.
SEE ALSO
getconf(1), exec(2), fork(2), getrlimit(2), pathconf(2), times(2), atexit(3), clock(3C), regcomp(3C), limits(5),
stdsyms(5), thread_safety(5), unistd(5).
HP Process Resource Manager: prmconfig(1) in HP Process Resource Manager User’s Guide .
HP-UX 11i Version 2: September 2004 − 8 − Hewlett-Packard Company Section 2−−433