sysinfo(2) DG/UX R4.11MU05 sysinfo(2)
NAME
sysinfo - get and set system information strings
SYNOPSIS
#include <sys/systeminfo.h>
long sysinfo (int command, char *buf, long count);
where:
command Specifies a particular operation for sysinfo to perform.
buf A pointer to a buffer where system information will be
written. If command specifies a set operation, then buf
will point to a string that sysinfo will use to set a
system variable.
count The length in bytes of the buffer pointed to by buf to get
system information. If length is zero, then nothing is
written to buf and sysinfo can be used to determine the
buffer size in bytes required to hold the complete string
for command.
DESCRIPTION
Sysinfo copies information relating to the system on which the
process is executing into the buffer pointed to by buf; sysinfo can
also set certain information as specified by commands.
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 you can specify are as follows:
SI_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, e.g., dgux.
SI_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 [see uname(2)] in the nodename field.
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).
SI_SET_HOSTNAME
Copy the null-terminated contents of the array pointed to by
buf into the string maintained by the kernel whose value will
be returned by succeeding calls to sysinfo with the command
SI_HOSTNAME. This command requires that the effective user
id be 0. The calling process must have appropriate privilege
to successfully execute this command.
SI_RELEASE
Copy into the array pointed to by buf the string that would
be returned by uname [see uname(2)] in the release field. A
typical value might be 5.4.
SI_VERSION
Copy into the array pointed to by buf the string that would
be returned by uname [see uname(2)] in the version field.
The syntax and semantics of this string are defined by the
system provider.
SI_MACHINE
Copy into the array pointed to by buf the string that would
be returned by uname [see uname(2)] in the machine
field,e.g., AViiON.
SI_ARCHITECTURE
Copy into the array pointed to by buf a string describing the
instruction set architecture of the current system, e.g.,
mc88100. These names may not match predefined names in the C
language compilation system.
SI_HW_PROVIDER
Copies the name of the hardware manufacturer into the array
pointed to by buf, e.g., Data General.
SI_HW_SERIAL
Copy into the array pointed to by buf a string which is the
ASCII representation of the unique, hardware-specific
hexadecimal serial number of the physical machine on which
the system call is executed. A serial number of FFFFFFFF
represents an invalid serial number.
RETURN VALUE
Upon successful completion, the return value indicates the buffer
size in bytes required to hold the complete string value and the
terminating null character. If this value is no greater than the
value passed in count, the entire string was copied; if this value is
greater than count and count is greater than zero, the string copied
into buf has been truncated to count-1 bytes plus a terminating null
character.
Otherwise, a value of -1 is returned and errno is set to indicate the
error.
DIAGNOSTICS
Sysinfo will fail if one or both of the following are true:
EPERM The process does not have appropriate privilege for a SET
commands.
EINVAL buf does not point to a valid address, or the data for a SET
command exceeds the limits established by the implementation.
EINVAL count is less than zero for a GET command.
A good starting guess for count is 257, which is likely to cover all
strings returned by this interface in typical installations.
SEE ALSO
uname(2), sysconf(2), gethostname(2), gethostid(2), cap_defaults(5).
NOTE
For many of the system information variables, no programmatic
interface exists that allows a user set their values. Such strings
are settable only by the system administrator modifying entries in
the master.d directory.
For systems supporting the DG/UX Capability Option, appropriate
privilege is defined as having one or more specific capabilities
enabled in the effective capability set of the calling process. See
cap_defaults(5) for the default capability for this system call.
On generic DG/UX systems, appropriate privilege means that the
process has an effective UID of root. See the
appropriate_privilege(5) man page for more information.
Licensed material--property of copyright holder(s)