ttymon(1M) ttymon(1M)
NAME
ttymon - port monitor for terminal ports
SYNOPSIS
/usr/lib/saf/ttymon
/usr/lib/saf/ttymon -g [-d device] [-h] [-t timeout] [-l ttylabel]
[-p prompt] [-m modules]
DESCRIPTION
ttymon is a STREAMS-based TTY port monitor. Its function is to monitor
ports, to set terminal modes, baud rates, and STREAMS modules for
ports, and to connect users or applications to services associated
with the ports. Normally, ttymon is configured to run under the Ser-
vice Access Controller (SAC), as part of the Service Access Facility
(SAF). It is configured using the sacadm(1M) command. Each instance of
ttymon can monitor multiple ports. The ports monitored by an instance
of ttymon are specified in the port monitor's administrative file. The
administrative file is configured using the pmadm(1M) and ttyadm(1M)
commands. When an instance of ttymon is invoked by the sac(1M) com-
mand, it starts to monitor its ports. For each port, ttymon first ini-
tializes the STREAMS modules for the line disciplines, if they are
specified, and the speed and terminal settings. The values used for
initialization are taken from the appropriate entry in the TTY set-
tings file. This file is maintained by the sttydefs(1M) command.
Default STREAMS modules for ports are usually set up by the autopush
command of the Autopush Facility.
ttymon then writes the prompt and waits for user input. If the user
indicates that the speed is inappropriate by pressing the BREAK key,
ttymon tries the next speed and writes the prompt again. When valid
input is received, ttymon interprets the per-service configuration
file for the port, if one exists, creates a utmp entry if required,
establishes the service environment, and then invokes the service
associated with the port. Valid input consists of a string of at least
one non-newline character, terminated by a carriage return. After the
service terminates, ttymon cleans up the utmp entry, if one exists,
and returns the port to its initial state.
If the pre-prompt-config flag is set for a connection, the configura-
tion file is interpreted before the prompt is output and is not inter-
preted before the service starts.
If autobaud is enabled for a port, ttymon will try to determine the
baud rate on the port automatically. Users must enter a carriage
return before ttymon can recognize the baud rate and print the prompt.
Currently, the baud rates that can be determined by autobaud are 110,
1200, 2400, 4800, and 9600.
Page 1 Reliant UNIX 5.44 Printed 11/98
ttymon(1M) ttymon(1M)
If a port is configured as a bidirectional port, ttymon will allow
users to connect to a service, and, if the port is free, will allow
uucico, cu or ct to use it for dialing out. If a port is bidirec-
tional, ttymon will wait to read a character before it prints a
prompt.
If the connect-on-carrier flag is set for a port, ttymon will immedi-
ately invoke the port's associated service when a connection request
is received. The prompt message will not be sent.
If a port is disabled, ttymon will not start any service on that port.
If a disabled message is specified, ttymon will send out the disabled
message when a connection request is received. If ttymon is disabled,
all ports under that instance of ttymon will also be disabled.
Service invocation
The service ttymon invokes for a port is specified in the ttymon
administrative file. ttymon will scan the character string giving the
service to be invoked for this port, looking for a %d or a %% two-
character sequence. If %d is found, ttymon will modify the service
command to be executed by replacing those two characters by the full
path name of this port (the device name). If %% is found, they will be
replaced by a single %.
When the service is invoked, the file descriptors 0, 1, and 2 are
opened to the port device for reading and writing. The service is
invoked with the user ID, group ID and current HOME directory set to
that of the user name under which the service was registered with
ttymon. Two environment variables, HOME and TTYPROMPT, are added to
the service's environment by ttymon. HOME is set to the HOME directory
of the user name under which the service is invoked. TTYPROMPT is set
to the prompt string configured for the service on the port. This is
provided so that a service invoked by ttymon has a means of determin-
ing if a prompt was actually issued by ttymon and, if so, what that
prompt actually was.
If NONE is specified for the service, no service is started. ttymon
only keeps the interface open in this case until a SIGHUP occurs on
the interface. Then the connection is reset to the initial state.
See ttyadm(1M) for options that can be set for ports monitored by
ttymon under the Service Access Controller.
Repeated service start
Three variables in /etc/default/ttymon can influence the repeated
start of services or the initialization of connections. If SPAWNLIMIT
is positive and a SPAWMLIMIT service often has to be initialized
within SPAWNINTERVAL seconds, it is suspended for SPAWNINHIBIT
seconds before another attempt is made to initialize the connection.
If SPAWNINHIBIT = 0, the service is suspended until someone enters
the command sacadm -p pmtag -x.
Page 2 Reliant UNIX 5.44 Printed 11/98
ttymon(1M) ttymon(1M)
Environment variables
ttymon can be configured using environment variables. The variables
are set preferably in the monitor-specific configuration file
/etc/saf/pmtag/config [see doconfig(3C)]. The following variables are
recognized:
TMSERVREPORT If "off" is set, starting a service is not logged
in the log file. The default is "on".
TMOPENTIME Time in milliseconds that the initialization of a
connection may require. If the initialization can-
not be completed in this time, the connection is
closed and another attempt may be made at a later
stage. If TMOPENTIME is not set, TMOPENTIME =
1900 is set.
TMDELAYTIME Time in seconds that a service is suspended if an
error occurred on the relevant connection before
another attempt could be made to initialize the
connection. The value must not be negative. If this
is not the case or TMDELAYTIME is not set,
TMDELAYTIME = 5 is set. Please note that the
repeated start of services in the case of errors is
influenced by this variable, see section above.
Page 3 Reliant UNIX 5.44 Printed 11/98
ttymon(1M) ttymon(1M)
Invoking a stand-alone ttymon process
A special invocation of ttymon is provided with the -g option. This
form of the command should only be called by applications that need to
set the correct baud rate and terminal settings on a port and then
connect to login service, but that cannot be pre-configured under the
SAC. The following combinations of options can be used with -g:
-d device device is the full path name of the port to which ttymon
is to attach. If this option is not specified, file
descriptor 0 must be set up by the invoking process to a
TTY port.
-h If the -h flag is not set, ttymon will force a hangup on
the line by setting the speed to zero before setting the
speed to the default or specified speed.
-t timeout Specifies that ttymon should exit if no one types any-
thing in timeout seconds after the prompt is sent.
-l ttylabel ttylabel is a link to a speed and TTY definition in the
ttydefs file. This definition tells ttymon at what speed
to run initially, what the initial TTY settings are, and
what speed to try next if the user indicates that the
speed is inappropriate by pressing the BREAK key. The
default speed is 9600 baud.
-p prompt Allows the user to specify a prompt string. The default
prompt is "Login: ".
-m modules When initializing the port, ttymon will pop all modules
on the port, and then push modules in the order speci-
fied. modules is a comma-separated list of pushable
modules. Default modules on the ports are usually set up
by the Autopush Facility.
NOTES
If a port is monitored by more than one ttymon, it is possible for the
ttymons to send out prompt messages in such a way that they compete
for input.
If variables are being set for the pre-prompt-config flag in the
monitor-specific configuration file, then this should take place
before the first run or runwait command.
SEE ALSO
pmadm(1M), sac(1M), sacadm(1M), sttydefs(1M), ttyadm(1M).
Page 4 Reliant UNIX 5.44 Printed 11/98