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