xref: /illumos-gate/usr/src/cmd/ttymon/tmstruct.h (revision d67944fb)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*d67944fbSScott Rotondo  * Common Development and Distribution License (the "License").
6*d67944fbSScott Rotondo  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
21*d67944fbSScott Rotondo /*
22*d67944fbSScott Rotondo  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23*d67944fbSScott Rotondo  * Use is subject to license terms.
24*d67944fbSScott Rotondo  */
25*d67944fbSScott Rotondo 
267c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
277c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate 
30*d67944fbSScott Rotondo #ifndef	_TMSTRUCT_H
31*d67944fbSScott Rotondo #define	_TMSTRUCT_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate /*
347c478bd9Sstevel@tonic-gate  * /etc/ttydefs structure
357c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate struct Gdef {
377c478bd9Sstevel@tonic-gate 	char		*g_id;		/* id for modes & speeds 	*/
387c478bd9Sstevel@tonic-gate 	char		*g_iflags;	/* initial terminal flags 	*/
397c478bd9Sstevel@tonic-gate 	char		*g_fflags;	/* final terminal flags 	*/
407c478bd9Sstevel@tonic-gate 	short		g_autobaud;	/* autobaud indicator 		*/
417c478bd9Sstevel@tonic-gate 	char		*g_nextid;	/* next id if this speed is wrong */
427c478bd9Sstevel@tonic-gate };
437c478bd9Sstevel@tonic-gate 
447c478bd9Sstevel@tonic-gate /*
457c478bd9Sstevel@tonic-gate  *	pmtab structure + internal data for ttymon
467c478bd9Sstevel@tonic-gate  */
477c478bd9Sstevel@tonic-gate struct pmtab {
487c478bd9Sstevel@tonic-gate 	/* the following fields are from pmtab			*/
497c478bd9Sstevel@tonic-gate 	char	*p_tag;		/* port/service tag		*/
507c478bd9Sstevel@tonic-gate 	long	p_flags;	/* flags			*/
517c478bd9Sstevel@tonic-gate 	char	*p_identity;	/* id for service to run as	*/
527c478bd9Sstevel@tonic-gate 	char	*p_res1;	/* reserved field		*/
537c478bd9Sstevel@tonic-gate 	char	*p_res2;	/* reserved field		*/
547c478bd9Sstevel@tonic-gate 	char	*p_res3;	/* reserved field		*/
557c478bd9Sstevel@tonic-gate 	char	*p_device;	/* full path name of device	*/
567c478bd9Sstevel@tonic-gate 	long	p_ttyflags;	/* ttyflags			*/
577c478bd9Sstevel@tonic-gate 	int	p_count;	/* wait_read count		*/
587c478bd9Sstevel@tonic-gate 	char	*p_server;	/* full service cmd line	*/
597c478bd9Sstevel@tonic-gate 	int	p_timeout;	/* timeout for input 		*/
607c478bd9Sstevel@tonic-gate 	char	*p_ttylabel;	/* ttylabel in /etc/ttydefs	*/
617c478bd9Sstevel@tonic-gate 	char	*p_modules;	/* modules to push		*/
627c478bd9Sstevel@tonic-gate 	char	*p_prompt;	/* prompt message		*/
637c478bd9Sstevel@tonic-gate 	char	*p_dmsg;	/* disable message		*/
647c478bd9Sstevel@tonic-gate 	char	*p_termtype;	/* terminal type		*/
657c478bd9Sstevel@tonic-gate 	char	*p_softcar;	/* use softcarrier		*/
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate 	/* the following fields are for ttymon internal use	*/
687c478bd9Sstevel@tonic-gate 	int	p_status;	/* status of entry 		*/
697c478bd9Sstevel@tonic-gate 	int	p_fd;		/* fd for the open device	*/
707c478bd9Sstevel@tonic-gate 	pid_t	p_pid;		/* pid of child on the device 	*/
717c478bd9Sstevel@tonic-gate 	int 	p_inservice;	/* service invoked		*/
727c478bd9Sstevel@tonic-gate 	int	p_respawn;	/* respawn count in this series */
737c478bd9Sstevel@tonic-gate 	long	p_time;		/* start time of a series	*/
747c478bd9Sstevel@tonic-gate 	uid_t	p_uid;		/* uid of p_identity		*/
757c478bd9Sstevel@tonic-gate 	gid_t	p_gid;		/* gid of p_identity		*/
767c478bd9Sstevel@tonic-gate 	char	*p_dir;		/* home dir of p_identity	*/
777c478bd9Sstevel@tonic-gate 	struct	pmtab	*p_next;
787c478bd9Sstevel@tonic-gate };
797c478bd9Sstevel@tonic-gate 
807c478bd9Sstevel@tonic-gate /*
817c478bd9Sstevel@tonic-gate  *	valid flags for p_flags field of pmtab
827c478bd9Sstevel@tonic-gate  */
837c478bd9Sstevel@tonic-gate #define	X_FLAG	0x1	/* port/service disabled 		*/
84*d67944fbSScott Rotondo #define	U_FLAG  0x2	/* create utmp entry for the service 	*/
857c478bd9Sstevel@tonic-gate 
867c478bd9Sstevel@tonic-gate /*
877c478bd9Sstevel@tonic-gate  *	valid flags for p_ttyflags field of pmtab
887c478bd9Sstevel@tonic-gate  */
89*d67944fbSScott Rotondo #define	C_FLAG	0x1	/* invoke service on carrier		*/
90*d67944fbSScott Rotondo #define	H_FLAG	0x2	/* hangup the line			*/
91*d67944fbSScott Rotondo #define	B_FLAG	0x4	/* bi-directional line			*/
92*d67944fbSScott Rotondo #define	R_FLAG	0x8	/* do wait_read				*/
93*d67944fbSScott Rotondo #define	I_FLAG	0x10	/* initialize only			*/
947c478bd9Sstevel@tonic-gate 
957c478bd9Sstevel@tonic-gate /*
967c478bd9Sstevel@tonic-gate  *	autobaud enabled flag
977c478bd9Sstevel@tonic-gate  */
98*d67944fbSScott Rotondo #define	A_FLAG	0x20	/* autobaud flag			*/
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate /*
1017c478bd9Sstevel@tonic-gate  *	values for p_status field of pmtab
1027c478bd9Sstevel@tonic-gate  */
103*d67944fbSScott Rotondo #define	NOTVALID	0	/* entry is not valid		*/
104*d67944fbSScott Rotondo #define	VALID		1	/* entry is valid		*/
105*d67944fbSScott Rotondo #define	CHANGED		2	/* entry is valid but changed 	*/
106*d67944fbSScott Rotondo #define	GETTY		3	/* entry is for ttymon express	*/
1077c478bd9Sstevel@tonic-gate 
1087c478bd9Sstevel@tonic-gate #define	ALLOC_PMTAB \
1097c478bd9Sstevel@tonic-gate 	((struct pmtab *)calloc((unsigned)1, \
110*d67944fbSScott Rotondo 		(unsigned)sizeof (struct pmtab)))
1117c478bd9Sstevel@tonic-gate 
1127c478bd9Sstevel@tonic-gate #define	PNULL	((struct pmtab *)NULL)
113*d67944fbSScott Rotondo 
114*d67944fbSScott Rotondo #endif /* _TMSTRUCT_H */
115