1 SYSINFO(2)                       System Calls                       SYSINFO(2)
   2 
   3 
   4 
   5 NAME
   6        sysinfo - get and set system information strings
   7 
   8 SYNOPSIS
   9        #include <sys/systeminfo.h>
  10 
  11        int sysinfo(int command, char *buf, long count);
  12 
  13 
  14 DESCRIPTION
  15        The sysinfo() function copies information relating to the operating
  16        system on which the process is executing into the buffer pointed to by
  17        buf. It can also set certain information where appropriate commands are
  18        available. The count parameter indicates the size of the buffer.
  19 
  20 
  21        The POSIX P1003.1 interface (see standards(5)) sysconf(3C) provides a
  22        similar class of configuration information, but returns an integer
  23        rather than a string.
  24 
  25 
  26        The values for command are as follows:
  27 
  28        SI_SYSNAME
  29 
  30            Copy into the array pointed to by buf the string that would be
  31            returned by uname(2) in the sysname field. This is the name of the
  32            implementation of the operating system, for example, SunOS or UTS.
  33 
  34 
  35        SI_HOSTNAME
  36 
  37            Copy into the array pointed to by buf a string that names the
  38            present host machine. This is the string that would be returned by
  39            uname() in the nodename field. This hostname or nodename is often
  40            the name the machine is known by locally. The hostname is the name
  41            of this machine as a node in some network. Different networks might
  42            have different names for the node, but presenting the nodename to
  43            the appropriate network directory or name-to-address mapping
  44            service should produce a transport end point address. The name
  45            might not be fully qualified. Internet host names can be up to 256
  46            bytes in length (plus the terminating null).
  47 
  48 
  49        SI_SET_HOSTNAME
  50 
  51            Copy the null-terminated contents of the array pointed to by buf
  52            into the string maintained by the kernel whose value will be
  53            returned by succeeding calls to sysinfo() with the command
  54            SI_HOSTNAME. This command requires that {PRIV_SYS_ADMIN} is
  55            asserted in the effective set of the calling process.
  56 
  57 
  58        SI_RELEASE
  59 
  60            Copy into the array pointed to by buf the string that would be
  61            returned by uname(2) in the release field. Typical values might be
  62            5.2 or 4.1.
  63 
  64 
  65        SI_VERSION
  66 
  67            Copy into the array pointed to by buf the string that would be
  68            returned by uname(2) in the version field. The syntax and semantics
  69            of this string are defined by the system provider.
  70 
  71 
  72        SI_MACHINE
  73 
  74            Copy into the array pointed to by buf the string that would be
  75            returned by uname(2) in the machine field, for example, sun4u.
  76 
  77 
  78        SI_ARCHITECTURE
  79 
  80            Copy into the array pointed to by buf a string describing the basic
  81            instruction set architecture of the current system, for example,
  82            sparc, mc68030, m32100, or i386. These names might not match
  83            predefined names in the C language compilation system.
  84 
  85 
  86        SI_ARCHITECTURE_64
  87 
  88            Copy into the array pointed to by buf a string describing the
  89            64-bit instruction set architecture of the current system, for
  90            example, sparcv9 or amd64.  These names might not match predefined
  91            names in the C language compilation system.  This subcode is not
  92            recognized on systems that do not allow a 64-bit application to
  93            run.
  94 
  95 
  96        SI_ARCHITECTURE_32
  97 
  98            Copy into the array pointed to by buf a string describing the
  99            32-bit instruction set architecture of the current system, for
 100            example, sparc or i386.  These names might not match predefined
 101            names in the C language compilation system.
 102 
 103 
 104        SI_ARCHITECTURE_K
 105 
 106            Copy into the array pointed to by buf a string describing the
 107            kernel instruction set architecture of the current system for
 108            example sparcv9 or i386.  These names might not match predefined
 109            names in the C language compilation system.
 110 
 111 
 112        SI_ARCHITECTURE_NATIVE
 113 
 114            Copy into the array pointed to by buf a string describing the
 115            native instruction set architecture of the current system, for
 116            example sparcv9 or i386.  These names might not match predefined
 117            names in the C language compilation system.
 118 
 119 
 120        SI_ISALIST
 121 
 122            Copy into the array pointed to by buf the names of the variant
 123            instruction set architectures executable on the current system.
 124 
 125            The names are space-separated and are ordered in the sense of best
 126            performance.  That is, earlier-named instruction sets might contain
 127            more instructions than later-named instruction sets; a program that
 128            is compiled for an earlier-named instruction set will most likely
 129            run faster on this machine than the same program compiled for a
 130            later-named instruction set.
 131 
 132            Programs compiled for an instruction set that does not appear in
 133            the list will most likely experience performance degradation or not
 134            run at all on this machine.
 135 
 136            The instruction set names known to the system are listed in
 137            isalist(5); these names might not match predefined names or
 138            compiler options in the C language compilation system.
 139 
 140            This command is obsolete and might be removed in a future release.
 141            See getisax(2) and the Linker and Libraries Guide for a better way
 142            to handle instruction set extensions.
 143 
 144 
 145        SI_PLATFORM
 146 
 147            Copy into the array pointed to by buf a string describing the
 148            specific model of the hardware platform, for example, SUNW,Sun-
 149            Blade-1500, SUNW,Sun-Fire-T200, or i86pc.
 150 
 151 
 152        SI_HW_PROVIDER
 153 
 154            Copies the name of the hardware manufacturer into the array pointed
 155            to by buf.
 156 
 157 
 158        SI_HW_SERIAL
 159 
 160            Copy into the array pointed to by buf a string which is the ASCII
 161            representation of the hardware-specific serial number of the
 162            physical machine on which the function is executed. This might be
 163            implemented in Read-Only Memory, using software constants set when
 164            building the operating system, or by other means, and might contain
 165            non-numeric characters. If the function is executed within a non-
 166            global zone that emulates a host identifier, then the ASCII
 167            representation of the zone's host identifier is copied into the
 168            array pointed to by buf. It is anticipated that manufacturers will
 169            not issue the same "serial number" to more than one physical
 170            machine. The pair of strings returned by SI_HW_PROVIDER and
 171            SI_HW_SERIAL is not guaranteed to be unique across all vendor's
 172            SVR4 implementations and could change over the lifetime of a given
 173            system.
 174 
 175 
 176        SI_SRPC_DOMAIN
 177 
 178            Copies the Secure Remote Procedure Call domain name into the array
 179            pointed to by buf.
 180 
 181 
 182        SI_SET_SRPC_DOMAIN
 183 
 184            Set the string to be returned by sysinfo() with the SI_SRPC_DOMAIN
 185            command to the value contained in the array pointed to by buf. This
 186            command requires that {PRIV_SYS_ADMIN} is asserted in the effective
 187            set of the calling process.
 188 
 189 
 190        SI_DHCP_CACHE
 191 
 192            Copy into the array pointed to by buf an ASCII string consisting of
 193            the ASCII hexadecimal encoding of the name of the interface
 194            configured by boot(1M) followed by the DHCPACK reply from the
 195            server. This command is intended for use only by the dhcpagent(1M)
 196            DHCP client daemon for the purpose of adopting the DHCP maintenance
 197            of the interface configured by boot.
 198 
 199 
 200 RETURN VALUES
 201        Upon successful completion, the value returned indicates the buffer
 202        size in bytes required to hold the complete value and the terminating
 203        null character.  If this value is no greater than the value passed in
 204        count, the entire string was copied. If this value is greater than
 205        count, the string copied into buf has been truncated to  count-1 bytes
 206        plus a terminating null character.
 207 
 208 
 209        Otherwise, -1 is returned and errno is set to indicate the error.
 210 
 211 ERRORS
 212        The sysinfo() function will fail if:
 213 
 214        EFAULT
 215                  The buf argument does not point to a valid address.
 216 
 217 
 218        EINVAL
 219                  The count argument for a non-SET command is less than 0 or
 220                  the data for a SET command exceeds the limits established by
 221                  the implementation.
 222 
 223 
 224        EPERM
 225                  The {PRIV_SYS_ADMIN} was not asserted in the effective set of
 226                  the calling process.
 227 
 228 
 229 USAGE
 230        In many cases there is no corresponding programming interface to set
 231        these values; such strings are typically settable only by the system
 232        administrator modifying entries in the /etc/system directory or the
 233        code provided by the particular OEM reading a serial number or code out
 234        of read-only memory, or hard-coded in the version of the operating
 235        system.
 236 
 237 
 238        A good estimation for count is 257, which is likely to cover all
 239        strings returned by this interface in typical installations.
 240 
 241 SEE ALSO
 242        boot(1M), dhcpagent(1M), getisax(2), uname(2), gethostid(3C),
 243        gethostname(3C), sysconf(3C), isalist(5), privileges(5), standards(5),
 244        zones(5)
 245 
 246 
 247        Linker and Libraries Guide
 248 
 249 
 250 
 251                                September 7, 2015                    SYSINFO(2)