xref: /onnv-gate/usr/src/uts/common/sys/uadmin.h (revision 9862:e8921084ee49)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52267Sdp  * Common Development and Distribution License (the "License").
62267Sdp  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
229160SSherry.Moore@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
270Sstevel@tonic-gate /*	  All Rights Reserved  	*/
280Sstevel@tonic-gate 
290Sstevel@tonic-gate 
300Sstevel@tonic-gate #ifndef _SYS_UADMIN_H
310Sstevel@tonic-gate #define	_SYS_UADMIN_H
320Sstevel@tonic-gate 
330Sstevel@tonic-gate 
340Sstevel@tonic-gate #if !defined(_ASM)
350Sstevel@tonic-gate #include <sys/types.h>
360Sstevel@tonic-gate #include <sys/cred.h>
370Sstevel@tonic-gate #endif
380Sstevel@tonic-gate 
390Sstevel@tonic-gate #ifdef	__cplusplus
400Sstevel@tonic-gate extern "C" {
410Sstevel@tonic-gate #endif
420Sstevel@tonic-gate 
430Sstevel@tonic-gate #define	A_REBOOT	1
440Sstevel@tonic-gate #define	A_SHUTDOWN	2
450Sstevel@tonic-gate #define	A_FREEZE	3	/* For freeze and thaw */
460Sstevel@tonic-gate #define	A_REMOUNT	4
470Sstevel@tonic-gate #define	A_DUMP		5
480Sstevel@tonic-gate #define	A_FTRACE	15
490Sstevel@tonic-gate #define	A_SWAPCTL	16
500Sstevel@tonic-gate /*			17-21	   reserved for obsolete interface */
516878Sbrendan #define	A_SDTTEST	22	/* DTrace sdt:::test */
529160SSherry.Moore@Sun.COM #define	A_CONFIG	23	/* For system configuration */
530Sstevel@tonic-gate 
546681Sjohnlev #define	AD_UNKNOWN	-1	/* no method */
550Sstevel@tonic-gate #define	AD_HALT		0	/* halt the processor */
560Sstevel@tonic-gate #define	AD_BOOT		1	/* multi-user reboot */
570Sstevel@tonic-gate #define	AD_IBOOT	2	/* multi-user reboot, ask for name of file */
580Sstevel@tonic-gate #define	AD_SBOOT	3	/* single-user reboot */
590Sstevel@tonic-gate #define	AD_SIBOOT	4	/* single-user reboot, ask for name of file */
600Sstevel@tonic-gate #define	AD_POWEROFF	6	/* software poweroff */
610Sstevel@tonic-gate #define	AD_NOSYNC	7	/* do not sync filesystems on next A_DUMP */
627656SSherry.Moore@Sun.COM #define	AD_FASTREBOOT	8	/* bypass firmware and boot loader */
637656SSherry.Moore@Sun.COM #define	AD_FASTREBOOT_DRYRUN	9	/* Fast reboot Dry run */
640Sstevel@tonic-gate 
650Sstevel@tonic-gate /*
660Sstevel@tonic-gate  * Functions reserved for A_FREEZE (may not be available on all platforms)
675295Srandyf  * Note:  AD_COMPRESS, AD_CHECK and AD_FORCE are now obsolete
685295Srandyf  *	The first two are succeeded by AD_SUSPEND_TO_DISK and
695295Srandyf  *		AD_CHECK_SUSPEND_TO_DISK respectively.
705295Srandyf  *	AD_FORCE should not be used by any new application
715295Srandyf  *
725295Srandyf  *	We maintain compatibility with the earlier interfaces:
735295Srandyf  *	AD_COMPRESS and AD_CHECK, by preserving those values
745295Srandyf  *	in the corresponding new interfaces
750Sstevel@tonic-gate  */
765295Srandyf 
770Sstevel@tonic-gate #define	AD_COMPRESS	0	/* store state file compressed during CPR */
780Sstevel@tonic-gate #define	AD_FORCE	1	/* force to do AD_COMPRESS */
790Sstevel@tonic-gate #define	AD_CHECK	2	/* test if CPR module is available */
805295Srandyf #define	AD_SUSPEND_TO_DISK	   AD_COMPRESS	/* A_FREEZE, CPR or ACPI S4 */
815295Srandyf #define	AD_CHECK_SUSPEND_TO_DISK   AD_CHECK	/* A_FREEZE, CPR/S4 capable? */
825295Srandyf #define	AD_SUSPEND_TO_RAM	   20		/* A_FREEZE, S3 */
835295Srandyf #define	AD_CHECK_SUSPEND_TO_RAM	   21		/* A_FREEZE, S3 capable? */
845295Srandyf 
850Sstevel@tonic-gate /*
860Sstevel@tonic-gate  * NOTE: the following defines comprise an Unstable interface.  Their semantics
870Sstevel@tonic-gate  * may change or they may be removed completely in a later release
880Sstevel@tonic-gate  */
890Sstevel@tonic-gate #define	AD_REUSEINIT	3	/* prepare for AD_REUSABLE */
900Sstevel@tonic-gate #define	AD_REUSABLE	4	/* create reusable statefile */
910Sstevel@tonic-gate #define	AD_REUSEFINI	5	/* revert to normal CPR mode (not reusable) */
920Sstevel@tonic-gate 
930Sstevel@tonic-gate #define	AD_FTRACE_START	1
940Sstevel@tonic-gate #define	AD_FTRACE_STOP	2
950Sstevel@tonic-gate 
962267Sdp /*
979160SSherry.Moore@Sun.COM  * Functions of A_CONFIG.  Unstable interface.
989160SSherry.Moore@Sun.COM  */
999160SSherry.Moore@Sun.COM #define	AD_UPDATE_BOOT_CONFIG	1	/* Update boot config variables */
1009160SSherry.Moore@Sun.COM 
1019160SSherry.Moore@Sun.COM /*
1022267Sdp  * When 'mdep' (the second argument to uadmin(2)) is initialized for A_REBOOT,
1032267Sdp  * A_SHUTDOWN or A_DUMP, it represents the boot arguments string of at most
1042267Sdp  * 256 characters.
1052267Sdp  */
1062267Sdp #define	BOOTARGS_MAX	256
1072267Sdp 
1089160SSherry.Moore@Sun.COM #if !defined(_KERNEL)
1099160SSherry.Moore@Sun.COM /*
1109160SSherry.Moore@Sun.COM  * FMRI for boot-config service.
1119160SSherry.Moore@Sun.COM  */
1129160SSherry.Moore@Sun.COM #define	FMRI_BOOT_CONFIG \
1139160SSherry.Moore@Sun.COM 	"svc:/system/boot-config:default"
1149160SSherry.Moore@Sun.COM 
1159160SSherry.Moore@Sun.COM /*
1169160SSherry.Moore@Sun.COM  * Property group that contains all Fast Reboot configuration properties.
1179160SSherry.Moore@Sun.COM  */
1189160SSherry.Moore@Sun.COM #define	BOOT_CONFIG_PG_PARAMS		"config"
1199160SSherry.Moore@Sun.COM 
1209160SSherry.Moore@Sun.COM /*
1219160SSherry.Moore@Sun.COM  * Property group that contains all Fast Reboot blacklisting information.
1229160SSherry.Moore@Sun.COM  */
1239160SSherry.Moore@Sun.COM #define	BOOT_CONFIG_PG_FBBLACKLIST	"fastreboot_blacklist"
1249160SSherry.Moore@Sun.COM 
125*9862SSherry.Moore@Sun.COM /*
126*9862SSherry.Moore@Sun.COM  * Non-persistent property group which contains all the properties that
127*9862SSherry.Moore@Sun.COM  * will override settings in the BOOT_CONFIG_PG_PARAMS property group.
128*9862SSherry.Moore@Sun.COM  */
129*9862SSherry.Moore@Sun.COM #define	BOOT_CONFIG_PG_OVR		"config_ovr"
130*9862SSherry.Moore@Sun.COM 
1319160SSherry.Moore@Sun.COM #endif	/* _KERNEL */
1329160SSherry.Moore@Sun.COM 
1339160SSherry.Moore@Sun.COM /*
1349160SSherry.Moore@Sun.COM  * Flag representations of fastboot configuration.
1359160SSherry.Moore@Sun.COM  */
1369160SSherry.Moore@Sun.COM #define	UA_FASTREBOOT_DEFAULT	0x01
1379160SSherry.Moore@Sun.COM #define	UA_FASTREBOOT_ONPANIC	0x02
1389160SSherry.Moore@Sun.COM 
139*9862SSherry.Moore@Sun.COM #define	FASTREBOOT_DEFAULT		"fastreboot_default"
1409160SSherry.Moore@Sun.COM #define	FASTREBOOT_ONPANIC		"fastreboot_onpanic"
1419160SSherry.Moore@Sun.COM #define	FASTREBOOT_ONPANIC_CMDLINE	"fastreboot_onpanic_cmdline"
1429160SSherry.Moore@Sun.COM 
1439160SSherry.Moore@Sun.COM #define	FASTREBOOT_ONPANIC_NOTSET(p)	\
1449160SSherry.Moore@Sun.COM 	(strcmp((p), "false") == 0 ||	\
1459160SSherry.Moore@Sun.COM 	strcmp((p), "no") == 0 ||	\
1469160SSherry.Moore@Sun.COM 	strcmp((p), "0") == 0)
1479160SSherry.Moore@Sun.COM 
1489160SSherry.Moore@Sun.COM #define	FASTREBOOT_ONPANIC_ISSET(p)	\
1499160SSherry.Moore@Sun.COM 	(strcmp((p), "true") == 0 ||	\
1509160SSherry.Moore@Sun.COM 	strcmp((p), "yes") == 0 ||	\
1519160SSherry.Moore@Sun.COM 	strcmp((p), "1") == 0)
1529160SSherry.Moore@Sun.COM 
1530Sstevel@tonic-gate #if !defined(_ASM)
1540Sstevel@tonic-gate 
1550Sstevel@tonic-gate #if defined(_KERNEL)
1560Sstevel@tonic-gate extern kmutex_t ualock;
157136Sachartre extern void mdboot(int, int, char *, boolean_t);
1580Sstevel@tonic-gate extern void mdpreboot(int, int, char *);
1590Sstevel@tonic-gate extern int kadmin(int, int, void *, cred_t *);
1600Sstevel@tonic-gate extern void killall(zoneid_t);
1610Sstevel@tonic-gate #endif
1620Sstevel@tonic-gate 
1630Sstevel@tonic-gate #if defined(__STDC__)
1640Sstevel@tonic-gate extern int uadmin(int, int, uintptr_t);
1650Sstevel@tonic-gate #else
1660Sstevel@tonic-gate extern int uadmin();
1670Sstevel@tonic-gate #endif
1680Sstevel@tonic-gate 
1690Sstevel@tonic-gate #endif	/* _ASM */
1700Sstevel@tonic-gate 
1710Sstevel@tonic-gate #ifdef	__cplusplus
1720Sstevel@tonic-gate }
1730Sstevel@tonic-gate #endif
1740Sstevel@tonic-gate 
1750Sstevel@tonic-gate #endif	/* _SYS_UADMIN_H */
176