10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*9694SScott.Rotondo@Sun.COM * Common Development and Distribution License (the "License"). 6*9694SScott.Rotondo@Sun.COM * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 21*9694SScott.Rotondo@Sun.COM /* 22*9694SScott.Rotondo@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 23*9694SScott.Rotondo@Sun.COM * Use is subject to license terms. 24*9694SScott.Rotondo@Sun.COM */ 25*9694SScott.Rotondo@Sun.COM 260Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 270Sstevel@tonic-gate /* All Rights Reserved */ 280Sstevel@tonic-gate 290Sstevel@tonic-gate 30*9694SScott.Rotondo@Sun.COM #ifndef _TMSTRUCT_H 31*9694SScott.Rotondo@Sun.COM #define _TMSTRUCT_H 320Sstevel@tonic-gate 330Sstevel@tonic-gate /* 340Sstevel@tonic-gate * /etc/ttydefs structure 350Sstevel@tonic-gate */ 360Sstevel@tonic-gate struct Gdef { 370Sstevel@tonic-gate char *g_id; /* id for modes & speeds */ 380Sstevel@tonic-gate char *g_iflags; /* initial terminal flags */ 390Sstevel@tonic-gate char *g_fflags; /* final terminal flags */ 400Sstevel@tonic-gate short g_autobaud; /* autobaud indicator */ 410Sstevel@tonic-gate char *g_nextid; /* next id if this speed is wrong */ 420Sstevel@tonic-gate }; 430Sstevel@tonic-gate 440Sstevel@tonic-gate /* 450Sstevel@tonic-gate * pmtab structure + internal data for ttymon 460Sstevel@tonic-gate */ 470Sstevel@tonic-gate struct pmtab { 480Sstevel@tonic-gate /* the following fields are from pmtab */ 490Sstevel@tonic-gate char *p_tag; /* port/service tag */ 500Sstevel@tonic-gate long p_flags; /* flags */ 510Sstevel@tonic-gate char *p_identity; /* id for service to run as */ 520Sstevel@tonic-gate char *p_res1; /* reserved field */ 530Sstevel@tonic-gate char *p_res2; /* reserved field */ 540Sstevel@tonic-gate char *p_res3; /* reserved field */ 550Sstevel@tonic-gate char *p_device; /* full path name of device */ 560Sstevel@tonic-gate long p_ttyflags; /* ttyflags */ 570Sstevel@tonic-gate int p_count; /* wait_read count */ 580Sstevel@tonic-gate char *p_server; /* full service cmd line */ 590Sstevel@tonic-gate int p_timeout; /* timeout for input */ 600Sstevel@tonic-gate char *p_ttylabel; /* ttylabel in /etc/ttydefs */ 610Sstevel@tonic-gate char *p_modules; /* modules to push */ 620Sstevel@tonic-gate char *p_prompt; /* prompt message */ 630Sstevel@tonic-gate char *p_dmsg; /* disable message */ 640Sstevel@tonic-gate char *p_termtype; /* terminal type */ 650Sstevel@tonic-gate char *p_softcar; /* use softcarrier */ 660Sstevel@tonic-gate 670Sstevel@tonic-gate /* the following fields are for ttymon internal use */ 680Sstevel@tonic-gate int p_status; /* status of entry */ 690Sstevel@tonic-gate int p_fd; /* fd for the open device */ 700Sstevel@tonic-gate pid_t p_pid; /* pid of child on the device */ 710Sstevel@tonic-gate int p_inservice; /* service invoked */ 720Sstevel@tonic-gate int p_respawn; /* respawn count in this series */ 730Sstevel@tonic-gate long p_time; /* start time of a series */ 740Sstevel@tonic-gate uid_t p_uid; /* uid of p_identity */ 750Sstevel@tonic-gate gid_t p_gid; /* gid of p_identity */ 760Sstevel@tonic-gate char *p_dir; /* home dir of p_identity */ 770Sstevel@tonic-gate struct pmtab *p_next; 780Sstevel@tonic-gate }; 790Sstevel@tonic-gate 800Sstevel@tonic-gate /* 810Sstevel@tonic-gate * valid flags for p_flags field of pmtab 820Sstevel@tonic-gate */ 830Sstevel@tonic-gate #define X_FLAG 0x1 /* port/service disabled */ 84*9694SScott.Rotondo@Sun.COM #define U_FLAG 0x2 /* create utmp entry for the service */ 850Sstevel@tonic-gate 860Sstevel@tonic-gate /* 870Sstevel@tonic-gate * valid flags for p_ttyflags field of pmtab 880Sstevel@tonic-gate */ 89*9694SScott.Rotondo@Sun.COM #define C_FLAG 0x1 /* invoke service on carrier */ 90*9694SScott.Rotondo@Sun.COM #define H_FLAG 0x2 /* hangup the line */ 91*9694SScott.Rotondo@Sun.COM #define B_FLAG 0x4 /* bi-directional line */ 92*9694SScott.Rotondo@Sun.COM #define R_FLAG 0x8 /* do wait_read */ 93*9694SScott.Rotondo@Sun.COM #define I_FLAG 0x10 /* initialize only */ 940Sstevel@tonic-gate 950Sstevel@tonic-gate /* 960Sstevel@tonic-gate * autobaud enabled flag 970Sstevel@tonic-gate */ 98*9694SScott.Rotondo@Sun.COM #define A_FLAG 0x20 /* autobaud flag */ 990Sstevel@tonic-gate 1000Sstevel@tonic-gate /* 1010Sstevel@tonic-gate * values for p_status field of pmtab 1020Sstevel@tonic-gate */ 103*9694SScott.Rotondo@Sun.COM #define NOTVALID 0 /* entry is not valid */ 104*9694SScott.Rotondo@Sun.COM #define VALID 1 /* entry is valid */ 105*9694SScott.Rotondo@Sun.COM #define CHANGED 2 /* entry is valid but changed */ 106*9694SScott.Rotondo@Sun.COM #define GETTY 3 /* entry is for ttymon express */ 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate #define ALLOC_PMTAB \ 1090Sstevel@tonic-gate ((struct pmtab *)calloc((unsigned)1, \ 110*9694SScott.Rotondo@Sun.COM (unsigned)sizeof (struct pmtab))) 1110Sstevel@tonic-gate 1120Sstevel@tonic-gate #define PNULL ((struct pmtab *)NULL) 113*9694SScott.Rotondo@Sun.COM 114*9694SScott.Rotondo@Sun.COM #endif /* _TMSTRUCT_H */ 115