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