confstr(3S) confstr(3S)
confstr - get configurable variables
#include <unistd.h>
size_t confstr (int name, char *buf, size_t len);
confstr copies information relating to the UNIX system on which the
process is executing into the buffer pointed to by buf. len is the size
of the buffer.
The POSIX P1003.1 interface sysconf [see sysconf(2)] provides a similar
class of configuration information, but returns an integer rather than a
string.
The commands available are:
_CS_SYSNAME Copy into the array pointed to by buf the string that would
be returned by uname [see uname(2)] in the sysname field.
This is the name of the implementation of the operating
system, for example, System V or UTS.
_CS_HOSTNAME Copy into the array pointed to by buf a string that names
the present host machine. This is the string that would be
returned by uname in the nodename field. This hostname or
nodename is often the name the machine is known by locally.
The hostname is the name of this machine as a node in some
network; different networks may have different names for
the node, but presenting the nodename to the appropriate
network Directory or name-to-address mapping service should
produce a transport end point address. The name may not be
fully qualified.
Internet host names may be up to 256 bytes in length (plus
the terminating null).
_CS_RELEASE Copy into the array pointed to by buf the string that would
be returned by uname in the release field. Typical values
might be 4.0 or 3.2.
_CS_VERSION Copy into the array pointed to by buf the string that would
be returned by uname in the version field. The syntax and
semantics of this string are defined by the system
provider. Under IRIX, this is the date and time that the
system was generated and has the form mmddhhmm.
_CSMACHINE Copy into the array pointed to by buf the string that would
be returned by uname in the machine field, for example,
IP27 or IP30.
Page 1
confstr(3S) confstr(3S)
_CS_ARCHITECTURE
Copy into the array pointed to by buf a string describing
the instruction set architecture of the current system, for
example, MIPS-II, m32100, or i80486. These names may not
match predefined names in the C language compilation
system.
_CS_HW_PROVIDER
Copies the name of the hardware manufacturer into the array
pointed to by buf.
_CS_HW_SERIAL Copy into the array pointed to by buf a string which is the
ASCII representation of the 32 bit hardware-specific
identifier of the physical machine on which the system call
is executed. Note that this may be implemented in ReadOnly
Memory, via software constants set when building the
operating system, or by other means, and may contain nonnumeric
characters. It is anticipated that manufacturers
will not issue the same ``32-bit identifier'' to more than
one physical machine. The pair of strings returned by
_CS_HW_PROVIDER and _CS_HW_SERIAL is likely to be unique
across all vendor's System V implementations.
_CS_INITTAB_NAME
Copy into the array pointed to by buf a string that is the
pathname of the inittab file used by the currently running
bootable operating system. This is the same as the file
specified by the INITTAB keyword found in the system file
[see system(4)].
_MIPS_CS_VENDOR
Copy into the array pointed to by buf a string which is the
name of the company providing the system. The vendor is the
company actually selling the product rather than the
company which built the product. Eg: "Silicon Graphics
Inc".
_MIPS_CS_OS_PROVIDER
Copy into the array pointed to by buf a string which is the
name of the company providing the operating system. This is
the name of the company which built the operating system.
Eg: "Silicon Graphics Inc".
_MIPS_CS_OS_NAME
Copy into the array pointed to by buf a string which is the
name of the operating system. Eg: "IRIX".
_MIPS_CS_HW_NAME
Copy into the array pointed to by buf a string which is the
name of the hardware platform. This is the name of the
platform in the pricelist. Eg: "IP19"
Page 2
confstr(3S) confstr(3S)
_MIPS_CS_NUM_PROCESSORS
Copy into the array pointed to by buf a string which is the
ASCII representation of the number of configured
processors. Eg: "16"
_MIPS_CS_HOSTID
Copy into the array pointed to by buf a string which is the
ASCII representation of the host id in hex. This example
uses sgi.sgi.com, which has an internet address of
192.26.75.5. Eg: "c01a4b05"
_MIPS_CS_OSREL_MAJ
Copy into the array pointed to by buf a string which is the
ASCII representation of the OS major release number.
_MIPS_CS_OSREL_MIN
Copy into the array pointed to by buf a string which is the
ASCII representation of the OS minor release number.
_MIPS_CS_OSREL_PATCH
Copy into the array pointed to by buf a string which is the
ASCII representation of the OS patch release number.
_MIPS_CS_PROCESSORS
Copy into the array pointed to by buf a string which is the
processor type. In the case of a multiprocessor, this will
be a comma separated list with _MIPS_CS_NUM_PROCESSORS
entries.
_MIPS_CS_AVAIL_PROCESSORS
Copy into the array pointed to by buf a string which is the
ASCII representation of the number of processors available
for running unrestricted processes.
_MIPS_CS_SERIAL
This is the same as _CS_HW_SERIAL.
_CS_XBS5_ILP32_OFF32_CFLAGS
Copy into the array pointed to by buf a string which can be
given as compilation options to cc for a 32-bit programming
model.
_CS_XBS5_ILP32_OFF32_LDFLAGS
Copy into the array pointed to by buf a string which can be
given as linking options to cc for a 32-bit programming
model.
_CS_XBS5_ILP32_OFF32_LIBS
Copy into the array pointed to by buf a string which can be
given as library options to cc for a 32-bit programming
model.
Page 3
confstr(3S) confstr(3S)
_CS_XBS5_ILP32_OFF32_LINTFLAGS
Copy into the array pointed to by buf a string which can be
given as options to lint for a 32-bit programming model.
_CS_XBS5_ILP32_OFFBIG_CFLAGS
Copy into the array pointed to by buf a string which can be
given as compilation options to cc for a 32-bit with long
off_t programming model.
_CS_XBS5_ILP32_OFFBIG_LDFLAGS
Copy into the array pointed to by buf a string which can be
given as linking options to cc for a 32-bit with long off_t
programming model.
_CS_XBS5_ILP32_OFFBIG_LIBS
Copy into the array pointed to by buf a string which can be
given as library options to cc for a 32-bit with long off_t
programming model.
_CS_XBS5_ILP32_OFFBIG_LINTFLAGS
Copy into the array pointed to by buf a string which can be
given as options to lint for a 32-bit with long off_t
programming model.
_CS_XBS5_LP64_OFF64_CFLAGS
Copy into the array pointed to by buf a string which can be
given as compilation options to cc for a 64-bit programming
model.
_CS_XBS5_LP64_OFF64_LDFLAGS
Copy into the array pointed to by buf a string which can be
given as linking options to cc for a 64-bit programming
model.
_CS_XBS5_LP64_OFF64_LIBS
Copy into the array pointed to by buf a string which can be
given as library options to cc for a 64-bit programming
model.
_CS_XBS5_LP64_OFF64_LINTFLAGS
Copy into the array pointed to by buf a string which can be
given as options to lint for a 64-bit programming model.
_CS_XBS5_LPBIG_OFFBIG_CFLAGS
Copy into the array pointed to by buf a string which can be
given as compilation options to cc for a 64-bit or greater
programming model.
_CS_XBS5_LPBIG_OFFBIG_LDFLAGS
Copy into the array pointed to by buf a string which can be
given as linking options to cc for a 64-bit or greater
programming model.
Page 4
confstr(3S) confstr(3S)
_CS_XBS5_LPBIG_OFFBIG_LIBS
Copy into the array pointed to by buf a string which can be
given as library options to cc for a 64-bit or greater
programming model.
_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS
Copy into the array pointed to by buf a string which can be
given as options to lint for a 64-bit or greater
programming model.
confstr fails if the following is true:
EINVAL buf does not point to a valid address.
Upon successful completion, the value returned indicates the buffer size
in bytes required to hold the complete value and the terminating null
character. If this value is no greater than the value passed in len, the
entire string was copied; if this value is greater than len, the string
copied into buf has been truncated to len-1 bytes plus a terminating null
character.
Otherwise, a value of -1 is returned and errno is set to indicate the
error.
A good starting guess for len is 257, which is likely to cover all
strings returned by this interface in typical installations.
uname(2), gethostname(3), gethostid(3), sysconf(3C), <unistd.h>,
<regexp.h>
PPPPaaaaggggeeee 5555 [ Back ]
|