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