xref: /titanic_50/usr/src/cmd/ttymon/ttymon.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
23*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
24*7c478bd9Sstevel@tonic-gate 
25*7c478bd9Sstevel@tonic-gate 
26*7c478bd9Sstevel@tonic-gate #ident	"%Z%%M%	%I%	%E% SMI"	/* SVr4.0 1.7	*/
27*7c478bd9Sstevel@tonic-gate 
28*7c478bd9Sstevel@tonic-gate 
29*7c478bd9Sstevel@tonic-gate #define		FALSE		0
30*7c478bd9Sstevel@tonic-gate #define		TRUE		1
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #define		SUCCESS		0
33*7c478bd9Sstevel@tonic-gate #define		FAILURE		-1	/* initialize device failed	*/
34*7c478bd9Sstevel@tonic-gate #define		LOCKED		-2	/* device is locked by others 	*/
35*7c478bd9Sstevel@tonic-gate #define		SESSION		-3	/* device has active session 	*/
36*7c478bd9Sstevel@tonic-gate #define		UNACCESS	-4	/* device not accessible	*/
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate 
39*7c478bd9Sstevel@tonic-gate #define		ACTIVE		1
40*7c478bd9Sstevel@tonic-gate #define		FINISHED	0
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate /*
43*7c478bd9Sstevel@tonic-gate  *	flags to indicate the field of /etc/ttydefs
44*7c478bd9Sstevel@tonic-gate  *	Note: order is important because it corresponds to
45*7c478bd9Sstevel@tonic-gate  *	      the order of fields in the file
46*7c478bd9Sstevel@tonic-gate  */
47*7c478bd9Sstevel@tonic-gate #define		T_TTYLABEL	1
48*7c478bd9Sstevel@tonic-gate #define		T_IFLAGS	2
49*7c478bd9Sstevel@tonic-gate #define		T_FFLAGS	3
50*7c478bd9Sstevel@tonic-gate #define		T_AUTOBAUD	4
51*7c478bd9Sstevel@tonic-gate #define		T_NEXTLABEL	5
52*7c478bd9Sstevel@tonic-gate 
53*7c478bd9Sstevel@tonic-gate /*
54*7c478bd9Sstevel@tonic-gate  *	flags to indicate the field of pmtab
55*7c478bd9Sstevel@tonic-gate  *	Note: order is important because it corresponds to
56*7c478bd9Sstevel@tonic-gate  *	      the order of fields in the file
57*7c478bd9Sstevel@tonic-gate  */
58*7c478bd9Sstevel@tonic-gate #define		P_TAG		1
59*7c478bd9Sstevel@tonic-gate #define		P_FLAGS		2
60*7c478bd9Sstevel@tonic-gate #define		P_IDENTITY	3
61*7c478bd9Sstevel@tonic-gate #define		P_RES1		4
62*7c478bd9Sstevel@tonic-gate #define		P_RES2		5
63*7c478bd9Sstevel@tonic-gate #define		P_RES3		6
64*7c478bd9Sstevel@tonic-gate #define		P_DEVICE	7
65*7c478bd9Sstevel@tonic-gate #define		P_TTYFLAGS	8
66*7c478bd9Sstevel@tonic-gate #define		P_COUNT		9
67*7c478bd9Sstevel@tonic-gate #define		P_SERVER	10
68*7c478bd9Sstevel@tonic-gate #define		P_TIMEOUT	11
69*7c478bd9Sstevel@tonic-gate #define		P_TTYLABEL	12
70*7c478bd9Sstevel@tonic-gate #define		P_MODULES	13
71*7c478bd9Sstevel@tonic-gate #define		P_PROMPT	14
72*7c478bd9Sstevel@tonic-gate #define		P_DMSG		15
73*7c478bd9Sstevel@tonic-gate #define		P_TERMTYPE	16
74*7c478bd9Sstevel@tonic-gate #define		P_SOFTCAR	17
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate /*
77*7c478bd9Sstevel@tonic-gate  *	termio mode
78*7c478bd9Sstevel@tonic-gate  */
79*7c478bd9Sstevel@tonic-gate #define		RAW	0x1	/* raw mode		*/
80*7c478bd9Sstevel@tonic-gate #define		CANON	0x2	/* canonical mode	*/
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate /*
83*7c478bd9Sstevel@tonic-gate  *	return value for peeking input data
84*7c478bd9Sstevel@tonic-gate  */
85*7c478bd9Sstevel@tonic-gate #define		GOODNAME	1
86*7c478bd9Sstevel@tonic-gate #define		NONAME		0
87*7c478bd9Sstevel@tonic-gate #define		BADSPEED	-1
88*7c478bd9Sstevel@tonic-gate 
89*7c478bd9Sstevel@tonic-gate #define	MAXID		15	/* Maximum length the "g_id" and "g_nextid" \
90*7c478bd9Sstevel@tonic-gate 				 * strings can take.  Longer ones will be \
91*7c478bd9Sstevel@tonic-gate 				 * truncated. \
92*7c478bd9Sstevel@tonic-gate 				 */
93*7c478bd9Sstevel@tonic-gate 
94*7c478bd9Sstevel@tonic-gate #define	MAXARGS		64	/* Maximum number of arguments that can be \
95*7c478bd9Sstevel@tonic-gate 				 * passed to "login" \
96*7c478bd9Sstevel@tonic-gate 				 */
97*7c478bd9Sstevel@tonic-gate 
98*7c478bd9Sstevel@tonic-gate #define	SPAWN_LIMIT	15	/* respawn allowed within SPAWN_INTERVAL */
99*7c478bd9Sstevel@tonic-gate #define	SPAWN_INTERVAL	(2*60)
100*7c478bd9Sstevel@tonic-gate 
101*7c478bd9Sstevel@tonic-gate #define		UUCP		"uucp"	/* owner of bi-directional devices */
102*7c478bd9Sstevel@tonic-gate #define		TTY		"tty"	/* group name of all devices 	   */
103*7c478bd9Sstevel@tonic-gate #define		ROOTUID		0		/* root uid		*/
104*7c478bd9Sstevel@tonic-gate 
105*7c478bd9Sstevel@tonic-gate #define	LOGDIR		"/var/saf/"		/* home dir of all saf log */
106*7c478bd9Sstevel@tonic-gate #define	LOGFILE		"log"			/* log file 		*/
107*7c478bd9Sstevel@tonic-gate #define	OLOGFILE	"o.log"			/* saved log file	*/
108*7c478bd9Sstevel@tonic-gate #define	TLOGFILE	"t.log"			/* temp log file	*/
109*7c478bd9Sstevel@tonic-gate #define	PIDFILE		"_pid"			/* pid file 		*/
110*7c478bd9Sstevel@tonic-gate #define	PMTABFILE	"_pmtab"		/* pmtab file 		*/
111*7c478bd9Sstevel@tonic-gate #define	PMPIPE		"_pmpipe"		/* pmpipe 		*/
112*7c478bd9Sstevel@tonic-gate #define	SACPIPE		"../_sacpipe"		/* sacpipe 		*/
113*7c478bd9Sstevel@tonic-gate #define	TTYDEFS		"/etc/ttydefs"		/* ttydefs file 	*/
114*7c478bd9Sstevel@tonic-gate #define	CONSOLE		"/dev/syscon"		/* /dev/console		*/
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate #ifdef	DEBUG
117*7c478bd9Sstevel@tonic-gate #define	DBGFILE		"debug"			/* debug file 		*/
118*7c478bd9Sstevel@tonic-gate #define	EX_DBG		"/var/saf/tm_debug"
119*7c478bd9Sstevel@tonic-gate 					/* debug file for ttymon express*/
120*7c478bd9Sstevel@tonic-gate #endif
121*7c478bd9Sstevel@tonic-gate 
122*7c478bd9Sstevel@tonic-gate #ifdef	SYS_NAME
123*7c478bd9Sstevel@tonic-gate #define	ISSUEFILE	"/etc/issue"		/*file to print before prompt */
124*7c478bd9Sstevel@tonic-gate #endif
125*7c478bd9Sstevel@tonic-gate 
126*7c478bd9Sstevel@tonic-gate #define	PMTAB_VERS	1		/* pmtab version number		*/
127*7c478bd9Sstevel@tonic-gate #define	TTYDEFS_VERS	1		/* /etc/ttydefs version number	*/
128*7c478bd9Sstevel@tonic-gate 
129*7c478bd9Sstevel@tonic-gate #define	MAXDEFS		100		/* max entries Gdef table can have */
130*7c478bd9Sstevel@tonic-gate 
131*7c478bd9Sstevel@tonic-gate /*
132*7c478bd9Sstevel@tonic-gate  * - ttymon reserves 7 fd for the following use:
133*7c478bd9Sstevel@tonic-gate  * - pid, log, pmpipe, sacpipe, pmtab, PCpipe[0], PCpipe[1].
134*7c478bd9Sstevel@tonic-gate  * - if DEBUG is on, reserve one more for debug file
135*7c478bd9Sstevel@tonic-gate  * - fd for each file
136*7c478bd9Sstevel@tonic-gate  *	pid		0
137*7c478bd9Sstevel@tonic-gate  *	sacpipe		1
138*7c478bd9Sstevel@tonic-gate  *	pmpipe		2
139*7c478bd9Sstevel@tonic-gate  *	log		3
140*7c478bd9Sstevel@tonic-gate  *	PCpipe[0]	4
141*7c478bd9Sstevel@tonic-gate  *	PCpipe[1]	5
142*7c478bd9Sstevel@tonic-gate  *	debug		6
143*7c478bd9Sstevel@tonic-gate  *	pmtab		floating, any fd will do
144*7c478bd9Sstevel@tonic-gate  */
145*7c478bd9Sstevel@tonic-gate #ifdef	DEBUG
146*7c478bd9Sstevel@tonic-gate #define	FILE_RESERVED	8
147*7c478bd9Sstevel@tonic-gate #else
148*7c478bd9Sstevel@tonic-gate #define	FILE_RESERVED	7
149*7c478bd9Sstevel@tonic-gate #endif
150*7c478bd9Sstevel@tonic-gate 
151*7c478bd9Sstevel@tonic-gate #define	TM_MAXCLASS	1	/* maxclass of SAC msg ttymon understands */
152*7c478bd9Sstevel@tonic-gate 
153*7c478bd9Sstevel@tonic-gate /*
154*7c478bd9Sstevel@tonic-gate  * flag value for strcheck()
155*7c478bd9Sstevel@tonic-gate  */
156*7c478bd9Sstevel@tonic-gate #define	NUM		0
157*7c478bd9Sstevel@tonic-gate #define	ALNUM		1
158*7c478bd9Sstevel@tonic-gate 
159*7c478bd9Sstevel@tonic-gate #define	ALARMTIME	60
160