xref: /titanic_41/usr/src/cmd/ttymon/tmstruct.h (revision 82629e3015252bf18319ba3815c773df23e21436)
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 (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
27 /*	  All Rights Reserved  	*/
28 
29 
30 #ifndef	_TMSTRUCT_H
31 #define	_TMSTRUCT_H
32 
33 /*
34  * /etc/ttydefs structure
35  */
36 struct Gdef {
37 	char		*g_id;		/* id for modes & speeds 	*/
38 	char		*g_iflags;	/* initial terminal flags 	*/
39 	char		*g_fflags;	/* final terminal flags 	*/
40 	short		g_autobaud;	/* autobaud indicator 		*/
41 	char		*g_nextid;	/* next id if this speed is wrong */
42 };
43 
44 /*
45  *	pmtab structure + internal data for ttymon
46  */
47 struct pmtab {
48 	/* the following fields are from pmtab			*/
49 	char	*p_tag;		/* port/service tag		*/
50 	long	p_flags;	/* flags			*/
51 	char	*p_identity;	/* id for service to run as	*/
52 	char	*p_res1;	/* reserved field		*/
53 	char	*p_res2;	/* reserved field		*/
54 	char	*p_res3;	/* reserved field		*/
55 	char	*p_device;	/* full path name of device	*/
56 	long	p_ttyflags;	/* ttyflags			*/
57 	int	p_count;	/* wait_read count		*/
58 	char	*p_server;	/* full service cmd line	*/
59 	int	p_timeout;	/* timeout for input 		*/
60 	char	*p_ttylabel;	/* ttylabel in /etc/ttydefs	*/
61 	char	*p_modules;	/* modules to push		*/
62 	char	*p_prompt;	/* prompt message		*/
63 	char	*p_dmsg;	/* disable message		*/
64 	char	*p_termtype;	/* terminal type		*/
65 	char	*p_softcar;	/* use softcarrier		*/
66 
67 	/* the following fields are for ttymon internal use	*/
68 	int	p_status;	/* status of entry 		*/
69 	int	p_fd;		/* fd for the open device	*/
70 	pid_t	p_pid;		/* pid of child on the device 	*/
71 	int 	p_inservice;	/* service invoked		*/
72 	int	p_respawn;	/* respawn count in this series */
73 	long	p_time;		/* start time of a series	*/
74 	uid_t	p_uid;		/* uid of p_identity		*/
75 	gid_t	p_gid;		/* gid of p_identity		*/
76 	char	*p_dir;		/* home dir of p_identity	*/
77 	struct	pmtab	*p_next;
78 };
79 
80 /*
81  *	valid flags for p_flags field of pmtab
82  */
83 #define	X_FLAG	0x1	/* port/service disabled 		*/
84 #define	U_FLAG  0x2	/* create utmp entry for the service 	*/
85 
86 /*
87  *	valid flags for p_ttyflags field of pmtab
88  */
89 #define	C_FLAG	0x1	/* invoke service on carrier		*/
90 #define	H_FLAG	0x2	/* hangup the line			*/
91 #define	B_FLAG	0x4	/* bi-directional line			*/
92 #define	R_FLAG	0x8	/* do wait_read				*/
93 #define	I_FLAG	0x10	/* initialize only			*/
94 
95 /*
96  *	autobaud enabled flag
97  */
98 #define	A_FLAG	0x20	/* autobaud flag			*/
99 
100 /*
101  *	values for p_status field of pmtab
102  */
103 #define	NOTVALID	0	/* entry is not valid		*/
104 #define	VALID		1	/* entry is valid		*/
105 #define	CHANGED		2	/* entry is valid but changed 	*/
106 #define	GETTY		3	/* entry is for ttymon express	*/
107 
108 #define	ALLOC_PMTAB \
109 	((struct pmtab *)calloc((unsigned)1, \
110 		(unsigned)sizeof (struct pmtab)))
111 
112 #define	PNULL	((struct pmtab *)NULL)
113 
114 #endif /* _TMSTRUCT_H */
115