xref: /titanic_41/usr/src/cmd/saf/structs.h (revision 0a47c91c895e274dd0990009919e30e984364a8b)
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 2009 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	_STRUCTS_H
31 #define	_STRUCTS_H
32 
33 #include <sac.h>
34 #include "misc.h"
35 
36 /*
37  * error messages
38  */
39 
40 struct errmsg {
41 	char *e_str;			/* error string */
42 	int e_exitcode;			/* and associated exit status */
43 };
44 
45 
46 /*
47  * everything we need to know about a port monitor
48  */
49 
50 struct	sactab {
51 	long	sc_flags;		/* flags */
52 	pid_t	sc_pid;			/* pid of PM */
53 	int	sc_rsmax;		/* max # of restarts */
54 	int	sc_rscnt;		/* # of restarts */
55 	int	sc_fd;			/* _pmpipe fd */
56 	int	sc_ok;			/* true if responded to last sanity poll */
57 	int	sc_valid;		/* true if entry is "current" */
58 	char	*sc_cmd;		/* command */
59 	char	*sc_comment;		/* comment associated with entry */
60 	struct	sactab	*sc_next;	/* next in list */
61 	short	sc_exit;		/* exit status */
62 	char	sc_maxclass;		/* largest class instruction this PM
63 					   understands.  This is currently
64 					   a place holder for future messages */
65 	unchar	sc_sstate;		/* SAC's idea of PM's state */
66 	unchar	sc_lstate;		/* SAC's idea of last valid state -
67 					   used for failure recovery - note:
68 					   SAC will set this field to ENABLED,
69 					   DISABLED, or NOTRUNNING as appropriate */
70 	unchar	sc_pstate;		/* PM's last reported state - note:
71 					   SAC will set this field to STARTING,
72 					   NOTRUNNING, or FAILED as appropriate */
73 	char	sc_tag[PMTAGSIZE + 1];	/* port monitor tag */
74 	char	sc_type[PMTYPESIZE + 1];/* port monitor type */
75 	char	sc_utid[IDLEN];		/* utmp id of PM */
76 };
77 
78 /*
79  * defn's for sc_sstate, sc_pstate, and sc_lstate
80  */
81 
82 #define	NOTRUNNING	0	/* PM not running */
83 #define	STARTING	1	/* PM starting, must be same as PM_STARTING */
84 #define	ENABLED		2	/* PM enabled, must be same as PM_ENABLED */
85 #define	DISABLED	3	/* PM disabled, must be same as PM_DISABLED */
86 #define	STOPPING	4	/* PM stopping, must be same as PM_STOPPING */
87 #define	FAILED		5	/* PM has failed */
88 #define	UNKNOWN		6	/* in recovery, state unknown */
89 
90 /*
91  * defn's for sc_flags
92  */
93 
94 #define	D_FLAG	0x1
95 #define	X_FLAG	0x2
96 
97 #endif /* _STRUCTS_H */
98