1sysinfo(2) System Calls sysinfo(2)
2
3
4
6 sysinfo - get and set system information strings
7
9 #include <sys/systeminfo.h>
10
11 int sysinfo(int command, char *buf, long count);
12
13
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 sysnamefield. 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 nodenamefield. 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 ser‐
44 vice should produce a transport end point address. The name might
45 not be fully qualified. Internet host names can be up to 256 bytes
46 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 SI_HOST‐
54 NAME. This command requires that {PRIV_SYS_ADMIN} is asserted in
55 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 versionfield. 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 prede‐
83 fined 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 ker‐
107 nel instruction set architecture of the current system for example
108 sparcv9 or i386. These names might not match predefined names in
109 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 isal‐
137 ist(5); these names might not match predefined names or compiler
138 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 spe‐
148 cific 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 physi‐
162 cal machine on which the function is executed. This might be imple‐
163 mented 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 repre‐
167 sentation of the zone's host identifier is copied into the array
168 pointed to by buf. It is anticipated that manufacturers will not
169 issue the same "serial number" to more than one physical machine.
170 The pair of strings returned by SI_HW_PROVIDER and SI_HW_SERIAL is
171 not guaranteed to be unique across all vendor's SVR4 implementa‐
172 tions and could change over the lifetime of a given system.
173
174
175 SI_SRPC_DOMAIN
176
177 Copies the Secure Remote Procedure Call domain name into the array
178 pointed to by buf.
179
180
181 SI_SET_SRPC_DOMAIN
182
183 Set the string to be returned by sysinfo() with the SI_SRPC_DOMAIN
184 command to the value contained in the array pointed to by buf. This
185 command requires that {PRIV_SYS_ADMIN} is asserted in the effective
186 set of the calling process.
187
188
189 SI_DHCP_CACHE
190
191 Copy into the array pointed to by buf an ASCII string consisting of
192 the ASCII hexidecimal encoding of the name of the interface config‐
193 ured by boot(1M) followed by the DHCPACK reply from the server.
194 This command is intended for use only by the dhcpagent(1M) DHCP
195 client daemon for the purpose of adopting the DHCP maintenance of
196 the interface configured by boot.
197
198
200 Upon successful completion, the value returned indicates the buffer
201 size in bytes required to hold the complete value and the terminating
202 null character. If this value is no greater than the value passed in
203 count, the entire string was copied. If this value is greater than
204 count, the string copied into buf has been truncated to count−1 bytes
205 plus a terminating null character.
206
207
208 Otherwise, −1 is returned and errno is set to indicate the error.
209
211 The sysinfo() function will fail if:
212
213 EFAULT The buf argument does not point to a valid address.
214
215
216 EINVAL The count argument for a non-SET command is less than 0 or
217 the data for a SET command exceeds the limits established by
218 the implementation.
219
220
221 EPERM The {PRIV_SYS_ADMIN} was not asserted in the effective set of
222 the calling process.
223
224
226 In many cases there is no corresponding programming interface to set
227 these values; such strings are typically settable only by the system
228 administrator modifying entries in the /etc/system directory or the
229 code provided by the particular OEM reading a serial number or code out
230 of read-only memory, or hard-coded in the version of the operating sys‐
231 tem.
232
233
234 A good estimation for count is 257, which is likely to cover all
235 strings returned by this interface in typical installations.
236
238 boot(1M), dhcpagent(1M), getisax(2), uname(2), gethostid(3C), gethost‐
239 name(3C), sysconf(3C), isalist(5), privileges(5), standards(5),
240 zones(5)
241
242
243 Linker and Libraries Guide
244
245
246
247SunOS 5.11 29 Jan 2009 sysinfo(2)