Standards
Standards / Extensions |
C or C++ |
Dependencies |
XPG4
XPG4.2
Single UNIX Specification, Version 3
|
both |
|
Format
#define _XOPEN_SOURCE
#include <unistd.h>
size_t confstr(int name, char *buf, size_t len);
General description
The confstr() function
provides a method for applications to get configuration-defined string
values. Its use and purpose are similar to the sysconf() function,
but it is used where string values rather than numeric values are
returned.
The
name argument represents
the system variable to be queried. It may be any one of the following
symbolic constants, defined in <unistd.h>:
- _CS_PATH
- Request the value
of the PATH environment variable that will find all standard
utilities.
- _CS_POSIX_V6_ILP32_OFF32_CFLAGS
- Request the value of the set of initial options to be given to
the c99 utility to build an application using a programming model
with 32-bit types.
- _CS_POSIX_V6_ILP32_OFF32_LDFLAGS
- Request the value of the set of final options to be given to the
c99 utility to build an application using a programming model with
32-bit types.
- _CS_POSIX_V6_ILP32_OFF32_LIBS
- Request the value of the set of libraries to be given to the c99
utility to build an application using a programming model with 32-bit
int, long, pointer, and off_t types.
- _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS
- Request the value of the set of initial options to be given to
the c99 utility to build an application using a programming model
with 32-bit int, long, and pointer types, and an off_t type using
at least 64 bits.
- _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS
- Request the value of the set of final options to be given to
the c99 utility to build an application using a programming model
with 32-bit int, long, and pointer types, and an off_t type using
at least 64 bits.
- CS_POSIX_V6_ILP32_OFFBIG_LIBS
- Request the value of the set of libraries to be given to the
c99 utility to build an application using a programming model with
32-bit int, long, and pointer types, and an off_t type using at least
64 bits.
- _CS_POSIX_V6_LP64_OFF64_CFLAGS
- Request the value of the set of initial options to be given to
the c99 utility to build an application using a programming model
with 32-bit int and 64-bit long, pointer, and off_t types.
- _CS_POSIX_V6_LP64_OFF64_LDFLAGS
- Request the value of the set of final options to be given to the
c99 utility to build an application using a programming model with
32-bit int and 64-bit long, pointer, and off_t types.
- _CS_POSIX_V6_LP64_OFF64_LIBS
- Request the value of the set of libraries to be given to the
c99 utility to build an application using a programming model with
32-bit int and 64-bit long, pointer, and off_t types.
- _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS
- Request the value of the set of initial options to be given to
the c99 utility to build an application using a programming model
with an int type using at least 32 bits and long, pointer, and off_t
types using at least 64 bits.
- _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS
- Request the value of the set of final options to be given to
the c99 utility to build an application using a programming model
with an int type using at least 32 bits and long, pointer, and off_t
types using at least 64 bits.
- _CS_POSIX_V6_LPBIG_OFFBIG_LIBS
- Request the value of the set of libraries to be given to the c99
utility to build an application using a programming model with an
int type using at least 32 bits and long, pointer, and off_t types
using at least 64 bits.
- _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS
- Request the list of names of programming environments supported
by the implementation in which the widths of the blksize_t, cc_t,
mode_t, nfds_t, pid_t, ptrdiff_t, size_t, speed_t, ssize_t, suseconds_t,
tcflag_t, useconds_t, wchar_t, and wint_t types are no greater than
the width of type long.
z/OS® UNIX services
use the following constant:
- _CS_SHELL
- Request the
fully qualified name of the default shell.
If the len argument
is not zero, and if the name argument has
a configuration-defined value, confstr() copies that value into the
buffer pointed to by the buf argument.
If the value to be returned is longer than len bytes,
including the . terminating NULL, then confstr() truncates the string
to len-1 bytes and NULL-terminates the results.
The application can detect that the string was truncated by comparing
the value returned by confstr() with len.
If
the len argument is zero, and the buf argument
is a NULL pointer, then confstr() still returns the integer value
defined below, but does not return a string. If the len argument
is zero, but the buf argument is not a NULL
pointer the results are unspecified.
Returned value
If name has
a configuration-defined value, confstr() returns the size of the buffer
that would be needed to hold the entire configuration-defined string
value. If this return value is greater than len,
the string returned in buf is truncated.
If name does
not have a configuration-defined value, confstr() returns 0 and leaves
errno unchanged.
If
name is not valid,
confstr() returns 0 and sets errno to one of the following values:
- Error Code
- Description
- EINVAL
- The value of the name argument is not
valid.