xref: /titanic_50/usr/src/cmd/ttymon/tmstruct.h (revision ed5289f91b9bf164dccd6c75398362be77a4478d)
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.4	*/
27 
28 /*
29  * /etc/ttydefs structure
30  */
31 struct Gdef {
32 	char		*g_id;		/* id for modes & speeds 	*/
33 	char		*g_iflags;	/* initial terminal flags 	*/
34 	char		*g_fflags;	/* final terminal flags 	*/
35 	short		g_autobaud;	/* autobaud indicator 		*/
36 	char		*g_nextid;	/* next id if this speed is wrong */
37 };
38 
39 /*
40  *	pmtab structure + internal data for ttymon
41  */
42 struct pmtab {
43 	/* the following fields are from pmtab			*/
44 	char	*p_tag;		/* port/service tag		*/
45 	long	p_flags;	/* flags			*/
46 	char	*p_identity;	/* id for service to run as	*/
47 	char	*p_res1;	/* reserved field		*/
48 	char	*p_res2;	/* reserved field		*/
49 	char	*p_res3;	/* reserved field		*/
50 	char	*p_device;	/* full path name of device	*/
51 	long	p_ttyflags;	/* ttyflags			*/
52 	int	p_count;	/* wait_read count		*/
53 	char	*p_server;	/* full service cmd line	*/
54 	int	p_timeout;	/* timeout for input 		*/
55 	char	*p_ttylabel;	/* ttylabel in /etc/ttydefs	*/
56 	char	*p_modules;	/* modules to push		*/
57 	char	*p_prompt;	/* prompt message		*/
58 	char	*p_dmsg;	/* disable message		*/
59 	char	*p_termtype;	/* terminal type		*/
60 	char	*p_softcar;	/* use softcarrier		*/
61 
62 	/* the following fields are for ttymon internal use	*/
63 	int	p_status;	/* status of entry 		*/
64 	int	p_fd;		/* fd for the open device	*/
65 	pid_t	p_pid;		/* pid of child on the device 	*/
66 	int 	p_inservice;	/* service invoked		*/
67 	int	p_respawn;	/* respawn count in this series */
68 	long	p_time;		/* start time of a series	*/
69 	uid_t	p_uid;		/* uid of p_identity		*/
70 	gid_t	p_gid;		/* gid of p_identity		*/
71 	char	*p_dir;		/* home dir of p_identity	*/
72 	struct	pmtab	*p_next;
73 };
74 
75 /*
76  *	valid flags for p_flags field of pmtab
77  */
78 #define	X_FLAG	0x1	/* port/service disabled 		*/
79 #define U_FLAG  0x2	/* create utmp entry for the service 	*/
80 
81 /*
82  *	valid flags for p_ttyflags field of pmtab
83  */
84 #define C_FLAG	0x1	/* invoke service on carrier		*/
85 #define H_FLAG	0x2	/* hangup the line			*/
86 #define B_FLAG	0x4	/* bi-directional line			*/
87 #define R_FLAG	0x8	/* do wait_read				*/
88 #define I_FLAG	0x10	/* initialize only			*/
89 
90 /*
91  *	autobaud enabled flag
92  */
93 #define A_FLAG	0x20	/* autobaud flag			*/
94 
95 /*
96  *	values for p_status field of pmtab
97  */
98 #define		NOTVALID	0	/* entry is not valid		*/
99 #define		VALID		1	/* entry is valid		*/
100 #define		CHANGED		2	/* entry is valid but changed 	*/
101 #define		GETTY		3	/* entry is for ttymon express	*/
102 
103 #define	ALLOC_PMTAB \
104 	((struct pmtab *)calloc((unsigned)1, \
105 		(unsigned)sizeof(struct pmtab)))
106 
107 #define	PNULL	((struct pmtab *)NULL)
108