xref: /illumos-gate/usr/src/cmd/ttymon/tmstruct.h (revision 902bba37)
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
5d67944fbSScott Rotondo  * Common Development and Distribution License (the "License").
6d67944fbSScott 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  */
21d67944fbSScott Rotondo /*
22d67944fbSScott Rotondo  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
23d67944fbSScott Rotondo  * Use is subject to license terms.
24d67944fbSScott Rotondo  */
25d67944fbSScott Rotondo 
267c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
273bb2c156SToomas Soome /*	  All Rights Reserved	*/
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate 
30d67944fbSScott Rotondo #ifndef	_TMSTRUCT_H
31d67944fbSScott Rotondo #define	_TMSTRUCT_H
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate /*
347c478bd9Sstevel@tonic-gate  * /etc/ttydefs structure
357c478bd9Sstevel@tonic-gate  */
367c478bd9Sstevel@tonic-gate struct Gdef {
373bb2c156SToomas Soome 	char		*g_id;		/* id for modes & speeds	*/
383bb2c156SToomas Soome 	char		*g_iflags;	/* initial terminal flags	*/
393bb2c156SToomas Soome 	char		*g_fflags;	/* final terminal flags		*/
403bb2c156SToomas Soome 	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	*/
593bb2c156SToomas Soome 	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	*/
683bb2c156SToomas Soome 	int	p_status;	/* status of entry		*/
697c478bd9Sstevel@tonic-gate 	int	p_fd;		/* fd for the open device	*/
703bb2c156SToomas Soome 	pid_t	p_childpid;	/* pid of child on the device	*/
713bb2c156SToomas Soome 	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	*/
77*902bba37SToomas Soome 	char	*p_ttymode;	/* mode line for serial device	*/
787c478bd9Sstevel@tonic-gate 	struct	pmtab	*p_next;
797c478bd9Sstevel@tonic-gate };
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate /*
827c478bd9Sstevel@tonic-gate  *	valid flags for p_flags field of pmtab
837c478bd9Sstevel@tonic-gate  */
843bb2c156SToomas Soome #define	X_FLAG	0x1	/* port/service disabled		*/
853bb2c156SToomas Soome #define	U_FLAG  0x2	/* create utmp entry for the service	*/
867c478bd9Sstevel@tonic-gate 
877c478bd9Sstevel@tonic-gate /*
887c478bd9Sstevel@tonic-gate  *	valid flags for p_ttyflags field of pmtab
897c478bd9Sstevel@tonic-gate  */
90d67944fbSScott Rotondo #define	C_FLAG	0x1	/* invoke service on carrier		*/
91d67944fbSScott Rotondo #define	H_FLAG	0x2	/* hangup the line			*/
92d67944fbSScott Rotondo #define	B_FLAG	0x4	/* bi-directional line			*/
93d67944fbSScott Rotondo #define	R_FLAG	0x8	/* do wait_read				*/
94d67944fbSScott Rotondo #define	I_FLAG	0x10	/* initialize only			*/
957c478bd9Sstevel@tonic-gate 
967c478bd9Sstevel@tonic-gate /*
977c478bd9Sstevel@tonic-gate  *	autobaud enabled flag
987c478bd9Sstevel@tonic-gate  */
99d67944fbSScott Rotondo #define	A_FLAG	0x20	/* autobaud flag			*/
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate /*
1027c478bd9Sstevel@tonic-gate  *	values for p_status field of pmtab
1037c478bd9Sstevel@tonic-gate  */
104d67944fbSScott Rotondo #define	NOTVALID	0	/* entry is not valid		*/
105d67944fbSScott Rotondo #define	VALID		1	/* entry is valid		*/
1063bb2c156SToomas Soome #define	CHANGED		2	/* entry is valid but changed	*/
107d67944fbSScott Rotondo #define	GETTY		3	/* entry is for ttymon express	*/
1087c478bd9Sstevel@tonic-gate 
1097c478bd9Sstevel@tonic-gate #define	ALLOC_PMTAB \
1107c478bd9Sstevel@tonic-gate 	((struct pmtab *)calloc((unsigned)1, \
111d67944fbSScott Rotondo 		(unsigned)sizeof (struct pmtab)))
1127c478bd9Sstevel@tonic-gate 
113d67944fbSScott Rotondo #endif /* _TMSTRUCT_H */
114