Manual page for sysinfo(2)
sysinfo - get and set system information strings
SYNOPSIS
#include <sys/systeminfo.h>
long sysinfo(int command,
char *buf,
long count);
DESCRIPTION
sysinfo()
copies information relating to the operating system
on which the process is executing into the buffer pointed to by
buf.
sysinfo()
can also set certain information where
appropriate
commands
are available.
count
is the size of the buffer.
The POSIX P1003.1 interface
sysconf.3c
provides a similar class of configuration information,
but returns an integer rather than a string.
The
commands
available are:
- SI_SYSNAME
-
Copy into the array pointed to by
buf
the string that would be returned by
uname.2
in the
sysname field.
This is the name of the implementation of the operating system, for example,
SunOS or UTS.
- 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.2
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).
- 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 super-user.
- SI_RELEASE
-
Copy into the array pointed to by
buf
the string that would be returned by
uname.2
in the
release field.
Typical values might be
5.2 or 4.1.
- SI_VERSION
-
Copy into the array pointed to by
buf
the string that would be returned by
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.2
in the
machine field,
for example,
sun4c, sun4d,
or
sun4m.
- SI_ARCHITECTURE
-
Copy into the array pointed to by
buf
a string describing the instruction set architecture of the
current system, for example,
sparc, mc68030, m32100,
or i386.
These names may not match predefined names in the C language compilation system.
- SI_PLATFORM
-
Copy into the array pointed to by buf
a string describing the specific model of the hardware platform,
for example,
SUNW,Sun_4_75, SUNW,SPARCsystem-600, or i86pc.
- SI_HW_PROVIDER
-
Copies the name of the hardware manufacturer into the array
pointed to by
buf.
- SI_HW_SERIAL
-
Copy into the array pointed to by
buf
a string which is the ASCII representation of the
hardware-specific serial number of the physical machine on which the
function is executed.
Note that this may be implemented in Read-Only Memory, using software
constants set when building the operating system, or by other means,
and may contain non-numeric characters.
It is anticipated that manufacturers will not issue the same
``serial number'' to more than one physical machine.
The pair of strings returned by
SI_HW_PROVIDER
and
SI_HW_SERIAL
is likely to be unique across all vendor's SVR4 implementations.
- SI_SRPC_DOMAIN
-
Copies the Secure Remote Procedure Call
domain name into the array pointed to by
buf.
- SI_SET_SRPC_DOMAIN
-
Set the string to be returned by
sysinfo()
with the
SI_SRPC_DOMAIN
command to the value contained in the array pointed to by
buf.
This command requires that the effective-user-id be super-user.
RETURN VALUES
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
count,
the entire string was copied.
If this value is greater than
count,
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.
ERRORS
sysinfo()
will fail if one or more of the following are true:
- EFAULT
-
buf
does not point to a valid address.
- EINVAL
-
The data for a SET command exceeds the limits established by the implementation.
- EPERM
-
The effective user of the calling process is not super-user.
USAGE
In many cases there is no corresponding programmatic
interface to set these values;
such strings are typically settable only by the system administrator
modifying entries in the
/etc/system
directory or the code provided by
the particular OEM reading a serial number or code out of read-only memory,
or hard-coded in the version of the operating system.
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
gethostid.3c
gethostname.3c
sysconf.3c
Created by unroff & hp-tools.
© by Hans-Peter Bischof. All Rights Reserved (1997).
Last modified 21/April/97