xref: /illumos-gate/usr/src/uts/common/sys/systeminfo.h (revision 6112cec5)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
55679c89fSjv227347  * Common Development and Distribution License (the "License").
65679c89fSjv227347  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22ba3594baSGarrett D'Amore  * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23f06dce2cSAndrew Stormont  * Copyright 2017 RackTop Systems.
24*6112cec5SJoshua M. Clulow  * Copyright 2020 Oxide Computer Company
25ba3594baSGarrett D'Amore  *
265679c89fSjv227347  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
277c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
287c478bd9Sstevel@tonic-gate  */
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
317c478bd9Sstevel@tonic-gate /*	  All Rights Reserved	*/
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #ifndef _SYS_SYSTEMINFO_H
357c478bd9Sstevel@tonic-gate #define	_SYS_SYSTEMINFO_H
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
387c478bd9Sstevel@tonic-gate extern "C" {
397c478bd9Sstevel@tonic-gate #endif
407c478bd9Sstevel@tonic-gate 
41f06dce2cSAndrew Stormont #if defined(_KERNEL) || defined(_FAKE_KERNEL)
427c478bd9Sstevel@tonic-gate extern char architecture[];
437c478bd9Sstevel@tonic-gate extern char architecture_32[];
445679c89fSjv227347 extern char hw_serial[];	/* machine's 32-bit hostid; a decimal string */
457c478bd9Sstevel@tonic-gate extern char hw_provider[];
467c478bd9Sstevel@tonic-gate extern char srpc_domain[];
477c478bd9Sstevel@tonic-gate extern char platform[];
48f06dce2cSAndrew Stormont #endif	/* _KERNEL || _FAKE_KERNEL */
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate /*
517c478bd9Sstevel@tonic-gate  * Commands to sysinfo(2)
527c478bd9Sstevel@tonic-gate  *
537c478bd9Sstevel@tonic-gate  * Values for sysinfo(2) commands are to be assigned by the following
547c478bd9Sstevel@tonic-gate  * algorithm:
557c478bd9Sstevel@tonic-gate  *
567c478bd9Sstevel@tonic-gate  *    1 -  256	Unix International assigned numbers for `get' style commands.
577c478bd9Sstevel@tonic-gate  *  257 -  512	Unix International assigned numbers for `set' style commands
587c478bd9Sstevel@tonic-gate  *		where the value is selected to be the value for the
597c478bd9Sstevel@tonic-gate  *		corresponding `get' command plus 256.
60*6112cec5SJoshua M. Clulow  *  513 -  768	illumos-defined `get' style commands.
61*6112cec5SJoshua M. Clulow  *  769 - 1024	illumos-defined `set' style commands where the value is
627c478bd9Sstevel@tonic-gate  *		selected to be the value for the corresponding `get' command
637c478bd9Sstevel@tonic-gate  *		plus 256.
647c478bd9Sstevel@tonic-gate  *
657c478bd9Sstevel@tonic-gate  * These values have be registered
667c478bd9Sstevel@tonic-gate  * with Unix International can't be corrected now.  The status of a command
677c478bd9Sstevel@tonic-gate  * as published or unpublished does not alter the algorithm.
687c478bd9Sstevel@tonic-gate  */
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate /* UI defined `get' commands (1-256) */
717c478bd9Sstevel@tonic-gate #define	SI_SYSNAME		1	/* return name of operating system */
727c478bd9Sstevel@tonic-gate #define	SI_HOSTNAME		2	/* return name of node */
737c478bd9Sstevel@tonic-gate #define	SI_RELEASE		3	/* return release of operating system */
747c478bd9Sstevel@tonic-gate #define	SI_VERSION		4	/* return version field of utsname */
757c478bd9Sstevel@tonic-gate #define	SI_MACHINE		5	/* return kind of machine */
767c478bd9Sstevel@tonic-gate #define	SI_ARCHITECTURE		6	/* return instruction set arch */
777c478bd9Sstevel@tonic-gate #define	SI_HW_SERIAL		7	/* return hardware serial number */
787c478bd9Sstevel@tonic-gate #define	SI_HW_PROVIDER		8	/* return hardware manufacturer */
797c478bd9Sstevel@tonic-gate #define	SI_SRPC_DOMAIN		9	/* return secure RPC domain */
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate /* UI defined `set' commands (257-512) */
827c478bd9Sstevel@tonic-gate #define	SI_SET_HOSTNAME		258	/* set name of node */
837c478bd9Sstevel@tonic-gate #define	SI_SET_SRPC_DOMAIN	265	/* set secure RPC domain */
847c478bd9Sstevel@tonic-gate 
85*6112cec5SJoshua M. Clulow /* illumos-defined `get' commands (513-768) */
867c478bd9Sstevel@tonic-gate #define	SI_PLATFORM		513	/* return platform identifier */
877c478bd9Sstevel@tonic-gate #define	SI_ISALIST		514	/* return supported isa list */
887c478bd9Sstevel@tonic-gate #define	SI_DHCP_CACHE		515	/* return kernel-cached DHCPACK */
897c478bd9Sstevel@tonic-gate #define	SI_ARCHITECTURE_32	516	/* basic 32-bit SI_ARCHITECTURE */
907c478bd9Sstevel@tonic-gate #define	SI_ARCHITECTURE_64	517	/* basic 64-bit SI_ARCHITECTURE */
917c478bd9Sstevel@tonic-gate #define	SI_ARCHITECTURE_K	518	/* kernel SI_ARCHITECTURE equivalent */
927c478bd9Sstevel@tonic-gate #define	SI_ARCHITECTURE_NATIVE	519	/* SI_ARCHITECTURE of the caller */
93*6112cec5SJoshua M. Clulow #define	SI_ADDRESS_WIDTH	520	/* number of bits in native address */
947c478bd9Sstevel@tonic-gate 
95*6112cec5SJoshua M. Clulow /* illumos-defined `set' commands (769-1024) (none currently assigned) */
967c478bd9Sstevel@tonic-gate 
977c478bd9Sstevel@tonic-gate 
985679c89fSjv227347 #define	HW_INVALID_HOSTID	0xFFFFFFFF	/* an invalid hostid */
995679c89fSjv227347 #define	HW_HOSTID_LEN		11		/* minimum buffer size needed */
1005679c89fSjv227347 						/* to hold a decimal or hex */
1015679c89fSjv227347 						/* hostid string */
1025679c89fSjv227347 #define	DOM_NM_LN		64		/* maximum length of domain */
1035679c89fSjv227347 						/* name */
1047c478bd9Sstevel@tonic-gate 
1057c478bd9Sstevel@tonic-gate #if !defined(_KERNEL)
1067c478bd9Sstevel@tonic-gate int sysinfo(int, char *, long);
1077c478bd9Sstevel@tonic-gate #endif
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1107c478bd9Sstevel@tonic-gate }
1117c478bd9Sstevel@tonic-gate #endif
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate #endif /* _SYS_SYSTEMINFO_H */
114