xref: /illumos-gate/usr/src/uts/common/sys/systeminfo.h (revision c3937c08b16d32677a7dc955a81325f2e7a61b5d)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23  * Copyright 2017 RackTop Systems.
24  * Copyright 2020 Oxide Computer Company
25  *
26  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
27  * Use is subject to license terms.
28  */
29 
30 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
31 /*	  All Rights Reserved	*/
32 
33 
34 #ifndef _SYS_SYSTEMINFO_H
35 #define	_SYS_SYSTEMINFO_H
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 #if defined(_KERNEL) || defined(_FAKE_KERNEL)
42 extern char architecture[];
43 extern char architecture_32[];
44 extern char hw_serial[];	/* machine's 32-bit hostid; a decimal string */
45 extern char hw_provider[];
46 extern char srpc_domain[];
47 extern char platform[];
48 #endif	/* _KERNEL || _FAKE_KERNEL */
49 
50 /*
51  * Commands to sysinfo(2)
52  *
53  * Values for sysinfo(2) commands are to be assigned by the following
54  * algorithm:
55  *
56  *    1 -  256	Unix International assigned numbers for `get' style commands.
57  *  257 -  512	Unix International assigned numbers for `set' style commands
58  *		where the value is selected to be the value for the
59  *		corresponding `get' command plus 256.
60  *  513 -  768	illumos-defined `get' style commands.
61  *  769 - 1024	illumos-defined `set' style commands where the value is
62  *		selected to be the value for the corresponding `get' command
63  *		plus 256.
64  *
65  * These values have be registered
66  * with Unix International can't be corrected now.  The status of a command
67  * as published or unpublished does not alter the algorithm.
68  */
69 
70 /* UI defined `get' commands (1-256) */
71 #define	SI_SYSNAME		1	/* return name of operating system */
72 #define	SI_HOSTNAME		2	/* return name of node */
73 #define	SI_RELEASE		3	/* return release of operating system */
74 #define	SI_VERSION		4	/* return version field of utsname */
75 #define	SI_MACHINE		5	/* return kind of machine */
76 #define	SI_ARCHITECTURE		6	/* return instruction set arch */
77 #define	SI_HW_SERIAL		7	/* return hardware serial number */
78 #define	SI_HW_PROVIDER		8	/* return hardware manufacturer */
79 #define	SI_SRPC_DOMAIN		9	/* return secure RPC domain */
80 
81 /* UI defined `set' commands (257-512) */
82 #define	SI_SET_HOSTNAME		258	/* set name of node */
83 #define	SI_SET_SRPC_DOMAIN	265	/* set secure RPC domain */
84 
85 /* illumos-defined `get' commands (513-768) */
86 #define	SI_PLATFORM		513	/* return platform identifier */
87 #define	SI_ISALIST		514	/* return supported isa list */
88 #define	SI_DHCP_CACHE		515	/* return kernel-cached DHCPACK */
89 #define	SI_ARCHITECTURE_32	516	/* basic 32-bit SI_ARCHITECTURE */
90 #define	SI_ARCHITECTURE_64	517	/* basic 64-bit SI_ARCHITECTURE */
91 #define	SI_ARCHITECTURE_K	518	/* kernel SI_ARCHITECTURE equivalent */
92 #define	SI_ARCHITECTURE_NATIVE	519	/* SI_ARCHITECTURE of the caller */
93 #define	SI_ADDRESS_WIDTH	520	/* number of bits in native address */
94 
95 /* illumos-defined `set' commands (769-1024) (none currently assigned) */
96 
97 
98 #define	HW_INVALID_HOSTID	0xFFFFFFFF	/* an invalid hostid */
99 #define	HW_HOSTID_LEN		11		/* minimum buffer size needed */
100 						/* to hold a decimal or hex */
101 						/* hostid string */
102 #define	DOM_NM_LN		64		/* maximum length of domain */
103 						/* name */
104 
105 #if !defined(_KERNEL)
106 int sysinfo(int, char *, long);
107 #endif
108 
109 #ifdef	__cplusplus
110 }
111 #endif
112 
113 #endif /* _SYS_SYSTEMINFO_H */
114