xref: /illumos-gate/usr/src/cmd/saf/structs.h (revision d67944fbe3fa0b31893a7116a09b0718eecf6078)
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
5*d67944fbSScott Rotondo  * Common Development and Distribution License (the "License").
6*d67944fbSScott Rotondo  * 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  */
21*d67944fbSScott Rotondo /*
22*d67944fbSScott Rotondo  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23*d67944fbSScott Rotondo  * Use is subject to license terms.
24*d67944fbSScott Rotondo  */
25*d67944fbSScott Rotondo 
267c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
277c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate 
30*d67944fbSScott Rotondo #ifndef	_STRUCTS_H
31*d67944fbSScott Rotondo #define	_STRUCTS_H
327c478bd9Sstevel@tonic-gate 
33*d67944fbSScott Rotondo #include <sac.h>
34*d67944fbSScott Rotondo #include "misc.h"
357c478bd9Sstevel@tonic-gate 
367c478bd9Sstevel@tonic-gate /*
377c478bd9Sstevel@tonic-gate  * error messages
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate struct errmsg {
417c478bd9Sstevel@tonic-gate 	char *e_str;			/* error string */
427c478bd9Sstevel@tonic-gate 	int e_exitcode;			/* and associated exit status */
437c478bd9Sstevel@tonic-gate };
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate /*
477c478bd9Sstevel@tonic-gate  * everything we need to know about a port monitor
487c478bd9Sstevel@tonic-gate  */
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate struct	sactab {
517c478bd9Sstevel@tonic-gate 	long	sc_flags;		/* flags */
527c478bd9Sstevel@tonic-gate 	pid_t	sc_pid;			/* pid of PM */
537c478bd9Sstevel@tonic-gate 	int	sc_rsmax;		/* max # of restarts */
547c478bd9Sstevel@tonic-gate 	int	sc_rscnt;		/* # of restarts */
557c478bd9Sstevel@tonic-gate 	int	sc_fd;			/* _pmpipe fd */
567c478bd9Sstevel@tonic-gate 	int	sc_ok;			/* true if responded to last sanity poll */
577c478bd9Sstevel@tonic-gate 	int	sc_valid;		/* true if entry is "current" */
587c478bd9Sstevel@tonic-gate 	char	*sc_cmd;		/* command */
597c478bd9Sstevel@tonic-gate 	char	*sc_comment;		/* comment associated with entry */
607c478bd9Sstevel@tonic-gate 	struct	sactab	*sc_next;	/* next in list */
617c478bd9Sstevel@tonic-gate 	short	sc_exit;		/* exit status */
627c478bd9Sstevel@tonic-gate 	char	sc_maxclass;		/* largest class instruction this PM
637c478bd9Sstevel@tonic-gate 					   understands.  This is currently
647c478bd9Sstevel@tonic-gate 					   a place holder for future messages */
657c478bd9Sstevel@tonic-gate 	unchar	sc_sstate;		/* SAC's idea of PM's state */
667c478bd9Sstevel@tonic-gate 	unchar	sc_lstate;		/* SAC's idea of last valid state -
677c478bd9Sstevel@tonic-gate 					   used for failure recovery - note:
687c478bd9Sstevel@tonic-gate 					   SAC will set this field to ENABLED,
697c478bd9Sstevel@tonic-gate 					   DISABLED, or NOTRUNNING as appropriate */
707c478bd9Sstevel@tonic-gate 	unchar	sc_pstate;		/* PM's last reported state - note:
717c478bd9Sstevel@tonic-gate 					   SAC will set this field to STARTING,
727c478bd9Sstevel@tonic-gate 					   NOTRUNNING, or FAILED as appropriate */
737c478bd9Sstevel@tonic-gate 	char	sc_tag[PMTAGSIZE + 1];	/* port monitor tag */
747c478bd9Sstevel@tonic-gate 	char	sc_type[PMTYPESIZE + 1];/* port monitor type */
757c478bd9Sstevel@tonic-gate 	char	sc_utid[IDLEN];		/* utmp id of PM */
767c478bd9Sstevel@tonic-gate };
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate /*
797c478bd9Sstevel@tonic-gate  * defn's for sc_sstate, sc_pstate, and sc_lstate
807c478bd9Sstevel@tonic-gate  */
817c478bd9Sstevel@tonic-gate 
827c478bd9Sstevel@tonic-gate #define	NOTRUNNING	0	/* PM not running */
83*d67944fbSScott Rotondo #define	STARTING	1	/* PM starting, must be same as PM_STARTING */
84*d67944fbSScott Rotondo #define	ENABLED		2	/* PM enabled, must be same as PM_ENABLED */
85*d67944fbSScott Rotondo #define	DISABLED	3	/* PM disabled, must be same as PM_DISABLED */
86*d67944fbSScott Rotondo #define	STOPPING	4	/* PM stopping, must be same as PM_STOPPING */
877c478bd9Sstevel@tonic-gate #define	FAILED		5	/* PM has failed */
887c478bd9Sstevel@tonic-gate #define	UNKNOWN		6	/* in recovery, state unknown */
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate /*
917c478bd9Sstevel@tonic-gate  * defn's for sc_flags
927c478bd9Sstevel@tonic-gate  */
937c478bd9Sstevel@tonic-gate 
947c478bd9Sstevel@tonic-gate #define	D_FLAG	0x1
957c478bd9Sstevel@tonic-gate #define	X_FLAG	0x2
96*d67944fbSScott Rotondo 
97*d67944fbSScott Rotondo #endif /* _STRUCTS_H */
98