sysinfo(2)


sysinfo -- get and set system information strings

Synopsis

   #include <sys/systeminfo.h>
   

int sysinfo(int command, char *buf, size_t count);

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 where an appropriate _SET_ command is available. count is the size of the buffer.

The confstr(3C) and sysconf(3C) routines provide a similar class of configuration information.

The following are valid command arguments:


SI_ARCHITECTURE
Copy into the array pointed to by buf a string describing the instruction set architecture of the current system, for example, ``mc68030'', ``i80486''. These names may not match predefined names in the C language compilation system.

SI_BUSTYPES
Copy a comma-separated list of strings describing the installed bus types on the system into the array pointed to by buf.

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 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_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 system call is executed. Note that this may be implemented in Read-Only Memory, via 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 operating system implementations.

SI_INITTAB
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.

SI_KERNEL_STAMP
Copy a string that represents the manufacturer's date stamp for the currently running operating system kernel into the array pointed to by buf.

SI_MACHINE
Copy into the array pointed to by buf the string that would be returned by uname in the ``machine'' field, for example, i486.

SI_OS_BASE
Copy a string that represents the base revision level of the currently running operating system into the array pointed to by buf.

SI_OS_PROVIDER
Copy a string that represents the name of the manufacturer of the currently running operating system base into the array pointed to by buf.

SI_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.2, 4.0, 3.2.

SI_SET_HW_PROVIDER
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_HW_PROVIDER. This command requires appropriate privilege.

SI_SET_HW_SERIAL
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_HW_SERIAL. This command requires appropriate privilege.

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 appropriate privilege.

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.

SI_SRPC_DOMAIN
Copies the Secure Remote Procedure Call domain name into the array pointed to by buf.

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, for example, UNIX_SV.

SI_USER_LIMIT
Copy a string that represents the maximum number of users currently configured into the operating system into the array pointed to by buf. This is a number or the keyword ``unlimited''.

SI_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.

Return values

On success, sysinfo returns the number of bytes required to hold the complete information requested and the terminating null character. If this value is no greater than the value passed in count, the entire string was copied into buf; if this value is greater than count, the string copied into buf has been truncated to count-1 bytes plus a terminating null character.

On failure, sysinfo returns -1 and sets errno to identify the error.

Errors

In the following conditions, sysinfo fails and sets errno to:

EPERM
The process does not have appropriate privilege for a SET command.

EINVAL
buf does not point to a valid address, or the data for a SET command exceeds the limits established by the implementation.

References

confstr(3C), gethostid(3bsd), gethostname(3bsd), sysconf(3C), System(4dsp), uname(2)
``What system is this?'' in Porting, integration, and compatibility

Notices

There is in many cases no corresponding programmatic interface to set these values; such strings are typically settable only by the system administrator modifying entries in the master.d 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.


© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 25 April 2004