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