xref: /titanic_44/usr/src/uts/common/sys/uadmin.h (revision 47b4653e9ff2a8aebb64f9e357713fd04108674b)
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 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
27 /*	  All Rights Reserved  	*/
28 
29 
30 #ifndef _SYS_UADMIN_H
31 #define	_SYS_UADMIN_H
32 
33 
34 #if !defined(_ASM)
35 #include <sys/types.h>
36 #include <sys/cred.h>
37 #endif
38 
39 #ifdef	__cplusplus
40 extern "C" {
41 #endif
42 
43 #define	A_REBOOT	1
44 #define	A_SHUTDOWN	2
45 #define	A_FREEZE	3	/* For freeze and thaw */
46 #define	A_REMOUNT	4
47 #define	A_DUMP		5
48 #define	A_FTRACE	15
49 #define	A_SWAPCTL	16
50 /*			17-21	   reserved for obsolete interface */
51 #define	A_SDTTEST	22	/* DTrace sdt:::test */
52 
53 #define	AD_UNKNOWN	-1	/* no method */
54 #define	AD_HALT		0	/* halt the processor */
55 #define	AD_BOOT		1	/* multi-user reboot */
56 #define	AD_IBOOT	2	/* multi-user reboot, ask for name of file */
57 #define	AD_SBOOT	3	/* single-user reboot */
58 #define	AD_SIBOOT	4	/* single-user reboot, ask for name of file */
59 #define	AD_POWEROFF	6	/* software poweroff */
60 #define	AD_NOSYNC	7	/* do not sync filesystems on next A_DUMP */
61 #define	AD_FASTREBOOT	8	/* bypass firmware and boot loader */
62 #define	AD_FASTREBOOT_DRYRUN	9	/* Fast reboot Dry run */
63 
64 
65 /*
66  * Functions reserved for A_FREEZE (may not be available on all platforms)
67  * Note:  AD_COMPRESS, AD_CHECK and AD_FORCE are now obsolete
68  *	The first two are succeeded by AD_SUSPEND_TO_DISK and
69  *		AD_CHECK_SUSPEND_TO_DISK respectively.
70  *	AD_FORCE should not be used by any new application
71  *
72  *	We maintain compatibility with the earlier interfaces:
73  *	AD_COMPRESS and AD_CHECK, by preserving those values
74  *	in the corresponding new interfaces
75  */
76 
77 #define	AD_COMPRESS	0	/* store state file compressed during CPR */
78 #define	AD_FORCE	1	/* force to do AD_COMPRESS */
79 #define	AD_CHECK	2	/* test if CPR module is available */
80 #define	AD_SUSPEND_TO_DISK	   AD_COMPRESS	/* A_FREEZE, CPR or ACPI S4 */
81 #define	AD_CHECK_SUSPEND_TO_DISK   AD_CHECK	/* A_FREEZE, CPR/S4 capable? */
82 #define	AD_SUSPEND_TO_RAM	   20		/* A_FREEZE, S3 */
83 #define	AD_CHECK_SUSPEND_TO_RAM	   21		/* A_FREEZE, S3 capable? */
84 
85 /*
86  * NOTE: the following defines comprise an Unstable interface.  Their semantics
87  * may change or they may be removed completely in a later release
88  */
89 #define	AD_REUSEINIT	3	/* prepare for AD_REUSABLE */
90 #define	AD_REUSABLE	4	/* create reusable statefile */
91 #define	AD_REUSEFINI	5	/* revert to normal CPR mode (not reusable) */
92 
93 #define	AD_FTRACE_START	1
94 #define	AD_FTRACE_STOP	2
95 
96 /*
97  * When 'mdep' (the second argument to uadmin(2)) is initialized for A_REBOOT,
98  * A_SHUTDOWN or A_DUMP, it represents the boot arguments string of at most
99  * 256 characters.
100  */
101 #define	BOOTARGS_MAX	256
102 
103 #if !defined(_ASM)
104 
105 #if defined(_KERNEL)
106 extern kmutex_t ualock;
107 extern void mdboot(int, int, char *, boolean_t);
108 extern void mdpreboot(int, int, char *);
109 extern int kadmin(int, int, void *, cred_t *);
110 extern void killall(zoneid_t);
111 #endif
112 
113 #if defined(__STDC__)
114 extern int uadmin(int, int, uintptr_t);
115 #else
116 extern int uadmin();
117 #endif
118 
119 #endif	/* _ASM */
120 
121 #ifdef	__cplusplus
122 }
123 #endif
124 
125 #endif	/* _SYS_UADMIN_H */
126