6253 F_GETLK doesn't always return lock owner
[illumos-gate.git] / usr / src / man / man1m / ttymon.1m
blobbf36448ff92a36a4c32e9051416cee9131692725
1 '\" te
2 .\" Copyright 1989 AT&T
3 .\" Copyright (C) 2004, Sun Microsystems, Inc.
4 .\" All Rights Reserved
5 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
6 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
7 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
8 .TH TTYMON 1M "Feb 22, 2005"
9 .SH NAME
10 ttymon \- port monitor for terminal ports
11 .SH SYNOPSIS
12 .LP
13 .nf
14 \fB/usr/lib/saf/ttymon\fR
15 .fi
17 .LP
18 .nf
19 \fB/usr/lib/saf/ttymon\fR \fB-g\fR [\fB-d\fR \fIdevice\fR] [\fB-h\fR] [\fB-t\fR \fItimeout\fR]
20      [\fB-l\fR \fIttylabel\fR] [\fB-p\fR \fIprompt\fR] [\fB-m\fR \fImodules\fR] [\fB-T\fR \fItermtype\fR]
21 .fi
23 .SH DESCRIPTION
24 .sp
25 .LP
26 \fBttymon\fR is a STREAMS-based TTY port monitor. Its function is to monitor
27 ports, to set terminal modes, baud rates, and line disciplines for the ports,
28 and to connect users or applications to services associated with the ports.
29 Normally, \fBttymon\fR is configured to run under the Service Access
30 Controller, \fBsac\fR(1M), as part of the Service Access Facility (SAF). It is
31 configured using the \fBsacadm\fR(1M) command. Each instance of \fBttymon\fR
32 can monitor multiple ports. The ports monitored by an instance of \fBttymon\fR
33 are specified in the port monitor's administrative file. The administrative
34 file is configured using the \fBpmadm\fR(1M) and \fBttyadm\fR(1M) commands.
35 When an instance of \fBttymon\fR is invoked by the \fBsac\fR command, it starts
36 to monitor its ports. For each port, \fBttymon\fR first initializes the line
37 disciplines, if they are specified, and the speed and terminal settings. For
38 ports with entries in \fB/etc/logindevperm\fR, device owner, group and
39 permissions are set. (See \fBlogindevperm\fR(4).) The values used for
40 initialization are taken from the appropriate entry in the TTY settings file.
41 This file is maintained by the \fBsttydefs\fR(1M) command. Default line
42 disciplines on ports are usually set up by the \fBautopush\fR(1M) command of
43 the Autopush Facility.
44 .sp
45 .LP
46 \fBttymon\fR then writes the prompt and waits for user input. If the user
47 indicates that the speed is inappropriate by pressing the BREAK key,
48 \fBttymon\fR tries the next speed and writes the prompt again. When valid input
49 is received, \fBttymon\fR interprets the per-service configuration file for the
50 port, if one exists, creates a \fButmpx\fR entry if required (see
51 \fButmpx\fR(4)), establishes the service environment, and then invokes the
52 service associated with the port. Valid input consists of a string of at least
53 one non-newline character, terminated by a carriage return. After the service
54 terminates, \fBttymon\fR cleans up the \fButmpx\fR entry, if one exists, and
55 returns the port to its initial state.
56 .sp
57 .LP
58 If \fIautobaud\fR is enabled for a port, \fBttymon\fR will try to determine the
59 baud rate on the port automatically. Users must enter a carriage return before
60 \fBttymon\fR can recognize the baud rate and print the prompt. Currently, the
61 baud rates that can be determined by \fIautobaud\fR are \fB110\fR, \fB1200\fR,
62 \fB2400\fR, \fB4800\fR, and \fB9600\fR.
63 .sp
64 .LP
65 If a port is configured as a bidirectional port, \fBttymon\fR will allow users
66 to connect to a service, and, if the port is free, will allow \fBuucico\fR(1M),
67 \fBcu\fR(1C), or \fBct\fR(1C) to use it for dialing out. If a port is
68 bidirectional, \fBttymon\fR will wait to read a character before it prints a
69 prompt.
70 .sp
71 .LP
72 If the \fIconnect-on-carrier\fR flag is set for a port, \fBttymon\fR will
73 immediately invoke the port's associated service when a connection request is
74 received. The prompt message will not be sent.
75 .sp
76 .LP
77 If a port is disabled, \fBttymon\fR will not start any service on that port. If
78 a disabled message is specified, \fBttymon\fR will send out the disabled
79 message when a connection request is received. If \fBttymon\fR is disabled, all
80 ports under that instance of \fBttymon\fR will also be disabled.
81 .SS "Service Invocation"
82 .sp
83 .LP
84 The service \fBttymon\fR invokes for a port is specified in the \fBttymon\fR
85 administrative file. \fBttymon\fR will scan the character string giving the
86 service to be invoked for this port, looking for a \fB%d\fR or a \fB%%\fR
87 two-character sequence. If \fB%d\fR is found, \fBttymon\fR will modify the
88 service command to be executed by replacing those two characters by the full
89 path name of this port (the device name). If \fB%%\fR is found, they will be
90 replaced by a single \fB%\fR. When the service is invoked, file descriptor
91 \fB0\fR, \fB1\fR, and \fB2\fR are opened to the port device for reading and
92 writing. The service is invoked with the user ID, group ID and current home
93 directory set to that of the user name under which the service was registered
94 with \fBttymon\fR. Two environment variables, \fBHOME\fR and \fBTTYPROMPT\fR,
95 are added to the service's environment by \fBttymon\fR. \fBHOME\fR is set to
96 the home directory of the user name under which the service is invoked.
97 \fBTTYPROMPT\fR is set to the prompt string configured for the service on the
98 port. This is provided so that a service invoked by \fBttymon\fR has a means of
99 determining if a prompt was actually issued by \fBttymon\fR and, if so, what
100 that prompt actually was.
103 See \fBttyadm\fR(1M) for options that can be set for ports monitored by
104 \fBttymon\fR under the Service Access Controller.
105 .SS "System Console Invocation"
108 The invocation of ttymon on the system console is managed under \fBsmf\fR(5) by
109 the service \fBsvc:/system/console-login\fR. It provides a number of properties
110 within the property group \fBttymon\fR to control the invocation, as follows:
112 .in +2
114 NAME                  TYPE               TTYMON OPTION
115 ----------------------------------------------------------
116 device                astring            [-d device]
117 nohangup              boolean            [-h]
118 label                 astring            [-l label]
119 modules               astring            [-m module1,module2]
120 prompt                astring            [-p prompt]
121 timeout               count              [-t timeout]
122 terminal_type         astring            [-T termtype]
124 .in -2
129 If any value is the empty string or an integer set to zero, then the option is
130 not passed to the ttymon invocation. The \fB-g\fR option is always specified
131 for this invocation. The \fB-d\fR option always defaults to \fB/dev/console\fR
132 if it is not set.
135 See \fBEXAMPLES\fR.
136 .SH SECURITY
139 \fBttymon\fR uses \fBpam\fR(3PAM) for session management. The \fBPAM\fR
140 configuration policy, listed through \fB/etc/pam.conf\fR, specifies the modules
141 to be used for \fBttymon\fR. Here is a partial \fBpam.conf\fR file with entries
142 for \fBttymon\fR using the UNIX session management module.
144 .in +2
146 ttymon session  required /usr/lib/security/pam_unix_session.so.1
148 .in -2
152 If there are no entries for the \fBttymon\fR service, then the entries for the
153 "other" service will be used.
154 .SH OPTIONS
157 The following options are supported:
159 .ne 2
161 \fB\fB-g\fR\fR
163 .RS 14n
164 A special invocation of \fBttymon\fR is provided with the \fB-g\fR option. This
165 form of the command should only be called by applications that need to set the
166 correct baud rate and terminal settings on a port and then connect to
167 \fBlogin\fR service, but that cannot be pre-configured under the SAC. The
168 following combinations of options can be used with \fB-g\fR:
172 .ne 2
174 \fB\fB-d\fR\fIdevice\fR\fR
176 .RS 14n
177 \fIdevice\fR is the full path name of the port to which \fBttymon\fR is to
178 attach. If this option is not specified, file descriptor \fB0\fR must be set up
179 by the invoking process to a TTY port.
183 .ne 2
185 \fB\fB-h\fR\fR
187 .RS 14n
188 If the -h flag is not set, \fBttymon\fR will force a hangup on the line by
189 setting the speed to zero before setting the speed to the default or specified
190 speed.
194 .ne 2
196 \fB\fB-l\fR\fIttylabel\fR\fR
198 .RS 14n
199 \fIttylabel\fR is a link to a speed and TTY definition in the \fBttydefs\fR
200 file. This definition tells \fBttymon\fR at what speed to run initially, what
201 the initial TTY settings are, and what speed to try next if the user indicates
202 that the speed is inappropriate by pressing the BREAK key. The default speed is
203 9600 baud.
207 .ne 2
209 \fB\fB-m\fR\fImodules\fR\fR
211 .RS 14n
212 When initializing the port, \fBttymon\fR will pop all modules on the port, and
213 then push \fImodules\fR in the order specified. \fImodules\fR is a
214 comma-separated list of pushable modules. Default modules on the ports are
215 usually set up by the Autopush Facility.
219 .ne 2
221 \fB\fB-p\fR\fIprompt\fR\fR
223 .RS 14n
224 Allows the user to specify a prompt string. The default prompt is \fBLogin:\fR.
228 .ne 2
230 \fB\fB-t\fR\fItimeout\fR\fR
232 .RS 14n
233 Specifies that \fBttymon\fR should exit if no one types anything in
234 \fItimeout\fR seconds after the prompt is sent.
238 .ne 2
240 \fB\fB-T\fR\fItermtype\fR\fR
242 .RS 14n
243 Sets the \fBTERM\fR environment variable to \fItermtype\fR.
246 .SH EXAMPLES
248 \fBExample 1 \fRSetting the Terminal Type
251 The following example sets the value of the terminal type (\fB-T\fR) option for
252 the system console \fBttymon\fR invocation:
255 .in +2
257         svccfg -s svc:/system/console-login setprop \e
258             ttymon/terminal_type = "xterm"
259         svcadm refresh svc:/system/console-login:default
261 .in -2
264 .SH ENVIRONMENT VARIABLES
267 If any of the \fBLC_*\fR variables ( \fBLC_CTYPE\fR, \fBLC_MESSAGES\fR,
268 \fBLC_TIME\fR, \fBLC_COLLATE\fR, \fBLC_NUMERIC\fR, and \fBLC_MONETARY\fR ) (see
269 \fBenviron\fR(5)) are not set in the environment, the operational behavior of
270 \fBttymon\fR for each corresponding locale category is determined by the value
271 of the \fBLANG\fR environment variable. If \fBLC_ALL\fR is set, its contents
272 are used to override both the \fBLANG\fR and the other \fBLC_*\fR variables. If
273 none of the above variables is set in the environment, the "C" (U.S. style)
274 locale determines how \fBttymon\fR behaves.
276 .ne 2
278 \fB\fBLC_CTYPE\fR\fR
280 .RS 12n
281 Determines how \fBttymon\fR handles characters. When \fBLC_CTYPE\fR is set to a
282 valid value, \fBttymon\fR can display and handle text and filenames containing
283 valid characters for that locale. \fBttymon\fR can display and handle Extended
284 Unix Code (EUC) characters where any individual character can be 1, 2, or 3
285 bytes wide. \fBttymon\fR can also handle EUC characters of 1, 2, or more column
286 widths. In the "C" locale, only characters from ISO 8859-1 are valid.
289 .SH FILES
291 .ne 2
293 \fB\fB/etc/logindevperm\fR\fR
295 .RS 21n
301 The command-line syntax is Stable. The SMF properties are Evolving.
302 .SH SEE ALSO
305 \fBct\fR(1C), \fBcu\fR(1C), \fBautopush\fR(1M), \fBpmadm\fR(1M), \fBsac\fR(1M),
306 \fBsacadm\fR(1M), \fBsttydefs\fR(1M), \fBttyadm\fR(1M), \fBuucico\fR(1M),
307 \fBpam\fR(3PAM), \fBlogindevperm\fR(4), \fBpam.conf\fR(4), \fButmpx\fR(4),
308 \fBattributes\fR(5), \fBenviron\fR(5), \fBpam_authtok_check\fR(5),
309 \fBpam_authtok_get\fR(5), \fBpam_authtok_store\fR(5), \fBpam_dhkeys\fR(5),
310 \fBpam_passwd_auth\fR(5), \fBpam_unix_account\fR(5), \fBpam_unix_auth\fR(5),
311 \fBpam_unix_session\fR(5), \fBsmf\fR(5)
314 \fI\fR
315 .SH NOTES
318 If a port is monitored by more than one \fBttymon\fR, it is possible for the
319 \fBttymon\fRs to send out prompt messages in such a way that they compete for
320 input.
323 The \fBpam_unix\fR(5) module is no longer supported. Similar functionality is
324 provided by \fBpam_authtok_check\fR(5), \fBpam_authtok_get\fR(5),
325 \fBpam_authtok_store\fR(5), \fBpam_dhkeys\fR(5), \fBpam_passwd_auth\fR(5),
326 \fBpam_unix_account\fR(5), \fBpam_unix_auth\fR(5), and
327 \fBpam_unix_session\fR(5).