4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
25 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
26 /* All Rights Reserved */
31 #include <sys/resource.h>
39 FILE *Logfp
= NULL
; /* for log file */
40 int Lckfd
; /* for pid file */
41 int Sfd
, Pfd
; /* for sacpipe and pmpipe */
42 int PCpipe
[2]; /* pipe between Parent & Children */
44 FILE *Debugfp
= NULL
; /* for debug file */
47 char State
= PM_STARTING
; /* current state */
48 char *Istate
; /* initial state */
49 char *Tag
; /* port monitor tag */
50 int Maxfiles
; /* Max number of open files */
51 int Maxfds
; /* Max no of devices ttymon can monitor */
53 int Reread_flag
= FALSE
; /* reread pmtab flag */
55 int Retry
; /* retry open_device flag */
57 struct pmtab
*PMtab
= NULL
; /* head pointer to pmtab linked list */
58 int Nentries
= 0; /* # of entries in pmtab linked list */
60 struct Gdef Gdef
[MAXDEFS
]; /* array to hold entries in /etc/ttydefs */
61 int Ndefs
= 0; /* highest index to Gdef that was used */
62 long Mtime
= 0; /* last modification time of ttydefs */
64 struct pollfd
*Pollp
; /* ptr to an array of poll struct */
65 int Npollfd
; /* size of the pollfd array */
67 struct Gdef DEFAULT
= { /* default terminal settings */
73 * next label is set to 4800 so we can start searching ttydefs.
74 * if 4800 is not in ttydefs, we will loop back to use DEFAULT
79 uid_t Uucp_uid
= 5; /* owner's uid for bi-directional ports */
80 gid_t Tty_gid
= 7; /* group id for all tty devices */
83 * Nlocked - number of ports that are either locked or have active
84 * sessions not under this ttymon.
88 /* original rlimit value */
92 * places to remember original signal dispositions and masks
95 sigset_t Origmask
; /* original signal mask */
96 struct sigaction Sigalrm
; /* SIGALRM */
97 struct sigaction Sigcld
; /* SIGCLD */
98 struct sigaction Sigint
; /* SIGINT */
99 struct sigaction Sigpoll
; /* SIGPOLL */
100 struct sigaction Sigquit
; /* SIGQUIT */
101 struct sigaction Sigterm
; /* SIGTERM */
103 struct sigaction Sigusr1
; /* SIGUSR1 */
104 struct sigaction Sigusr2
; /* SIGUSR2 */
107 struct strbuf
*peek_ptr
;
109 int Logmaxsz
= 1000000; /* Log Max Size */
111 int Splflag
= 0; /* serialize Log file manipulation */