xref: /onnv-gate/usr/src/cmd/saf/structs.h (revision 9694:78fafb281255)
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
5*9694SScott.Rotondo@Sun.COM  * Common Development and Distribution License (the "License").
6*9694SScott.Rotondo@Sun.COM  * 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  */
21*9694SScott.Rotondo@Sun.COM /*
22*9694SScott.Rotondo@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23*9694SScott.Rotondo@Sun.COM  * Use is subject to license terms.
24*9694SScott.Rotondo@Sun.COM  */
25*9694SScott.Rotondo@Sun.COM 
260Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
270Sstevel@tonic-gate /*	  All Rights Reserved  	*/
280Sstevel@tonic-gate 
290Sstevel@tonic-gate 
30*9694SScott.Rotondo@Sun.COM #ifndef	_STRUCTS_H
31*9694SScott.Rotondo@Sun.COM #define	_STRUCTS_H
320Sstevel@tonic-gate 
33*9694SScott.Rotondo@Sun.COM #include <sac.h>
34*9694SScott.Rotondo@Sun.COM #include "misc.h"
350Sstevel@tonic-gate 
360Sstevel@tonic-gate /*
370Sstevel@tonic-gate  * error messages
380Sstevel@tonic-gate  */
390Sstevel@tonic-gate 
400Sstevel@tonic-gate struct errmsg {
410Sstevel@tonic-gate 	char *e_str;			/* error string */
420Sstevel@tonic-gate 	int e_exitcode;			/* and associated exit status */
430Sstevel@tonic-gate };
440Sstevel@tonic-gate 
450Sstevel@tonic-gate 
460Sstevel@tonic-gate /*
470Sstevel@tonic-gate  * everything we need to know about a port monitor
480Sstevel@tonic-gate  */
490Sstevel@tonic-gate 
500Sstevel@tonic-gate struct	sactab {
510Sstevel@tonic-gate 	long	sc_flags;		/* flags */
520Sstevel@tonic-gate 	pid_t	sc_pid;			/* pid of PM */
530Sstevel@tonic-gate 	int	sc_rsmax;		/* max # of restarts */
540Sstevel@tonic-gate 	int	sc_rscnt;		/* # of restarts */
550Sstevel@tonic-gate 	int	sc_fd;			/* _pmpipe fd */
560Sstevel@tonic-gate 	int	sc_ok;			/* true if responded to last sanity poll */
570Sstevel@tonic-gate 	int	sc_valid;		/* true if entry is "current" */
580Sstevel@tonic-gate 	char	*sc_cmd;		/* command */
590Sstevel@tonic-gate 	char	*sc_comment;		/* comment associated with entry */
600Sstevel@tonic-gate 	struct	sactab	*sc_next;	/* next in list */
610Sstevel@tonic-gate 	short	sc_exit;		/* exit status */
620Sstevel@tonic-gate 	char	sc_maxclass;		/* largest class instruction this PM
630Sstevel@tonic-gate 					   understands.  This is currently
640Sstevel@tonic-gate 					   a place holder for future messages */
650Sstevel@tonic-gate 	unchar	sc_sstate;		/* SAC's idea of PM's state */
660Sstevel@tonic-gate 	unchar	sc_lstate;		/* SAC's idea of last valid state -
670Sstevel@tonic-gate 					   used for failure recovery - note:
680Sstevel@tonic-gate 					   SAC will set this field to ENABLED,
690Sstevel@tonic-gate 					   DISABLED, or NOTRUNNING as appropriate */
700Sstevel@tonic-gate 	unchar	sc_pstate;		/* PM's last reported state - note:
710Sstevel@tonic-gate 					   SAC will set this field to STARTING,
720Sstevel@tonic-gate 					   NOTRUNNING, or FAILED as appropriate */
730Sstevel@tonic-gate 	char	sc_tag[PMTAGSIZE + 1];	/* port monitor tag */
740Sstevel@tonic-gate 	char	sc_type[PMTYPESIZE + 1];/* port monitor type */
750Sstevel@tonic-gate 	char	sc_utid[IDLEN];		/* utmp id of PM */
760Sstevel@tonic-gate };
770Sstevel@tonic-gate 
780Sstevel@tonic-gate /*
790Sstevel@tonic-gate  * defn's for sc_sstate, sc_pstate, and sc_lstate
800Sstevel@tonic-gate  */
810Sstevel@tonic-gate 
82*9694SScott.Rotondo@Sun.COM #define	NOTRUNNING	0	/* PM not running */
83*9694SScott.Rotondo@Sun.COM #define	STARTING	1	/* PM starting, must be same as PM_STARTING */
84*9694SScott.Rotondo@Sun.COM #define	ENABLED		2	/* PM enabled, must be same as PM_ENABLED */
85*9694SScott.Rotondo@Sun.COM #define	DISABLED	3	/* PM disabled, must be same as PM_DISABLED */
86*9694SScott.Rotondo@Sun.COM #define	STOPPING	4	/* PM stopping, must be same as PM_STOPPING */
87*9694SScott.Rotondo@Sun.COM #define	FAILED		5	/* PM has failed */
88*9694SScott.Rotondo@Sun.COM #define	UNKNOWN		6	/* in recovery, state unknown */
890Sstevel@tonic-gate 
900Sstevel@tonic-gate /*
910Sstevel@tonic-gate  * defn's for sc_flags
920Sstevel@tonic-gate  */
930Sstevel@tonic-gate 
94*9694SScott.Rotondo@Sun.COM #define	D_FLAG	0x1
95*9694SScott.Rotondo@Sun.COM #define	X_FLAG	0x2
96*9694SScott.Rotondo@Sun.COM 
97*9694SScott.Rotondo@Sun.COM #endif /* _STRUCTS_H */
98