Sun Microsystems, Inc.
spacerspacer
spacer www.sun.com docs.sun.com |
spacer
black dot
 
 
12.  Managing Serial Ports With the Service Access Facility (Tasks) Overall Administration: sacadm Command SAC Initialization Process  Previous   Contents   Next 
   
 

Port Monitor Service Administrator: pmadm Command

The pmadm command enables you to administer port monitors' services. In particular, you use the pmadm command to add or remove a service and to enable or disable a service. You can also install or replace per-service configuration scripts, or print information about a service.

Each instance of a service must be uniquely identified by a port monitor and a port. When you use the pmadm command to administer a service, you specify a particular port monitor via the pmtag argument, and a particular port via the svctag argument.

For each port monitor type, the SAF requires a specialized command to format port monitor-specific configuration data. This data is used by the pmadm command. For ttymon and listen type port monitors, these specialized commands are ttyadm and nlsadmin, respectively.

A Port Monitor at Work: ttymon

Whenever you attempt to log in by using a directly connected modem or alphanumeric terminal, ttymon goes to work, as follows.

As shown in the following figure, the init process is the first process to be started at boot time. Consulting its administrative file (/etc/inittab), the init process starts other processes as they are needed. Listed among those processes is the SAC.

SAC, in turn, automatically starts the port monitors designated in its administrative file (/etc/saf/_sactab). The following figure shows only a single ttymon port monitor.

After the ttymon port monitor has been started, it monitors the serial port lines for service requests.

Figure 12-1 How ttymon Helps Process a Login Request

When someone attempts to log in by using an alphanumeric terminal or a modem, the serial port driver passes the activity to the operating system. The ttymon port monitor notes the serial port activity, and attempts to establish a communications link. The ttymon port monitor determines what data transfer rate, line discipline, and handshaking protocol are required to communicate with the device.

Having established the proper parameters for communication with the modem or terminal, the ttymon port monitor passes these parameters to the login program and transfers control to it.

Port Initialization Process

When an instance of the ttymon port monitor is invoked by SAC, ttymon starts to monitor its ports. For each port, the ttymon port monitor first initializes 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 /etc/ttydefs file.

The ttymon port monitor then writes the prompt and waits for user input. If the user indicates that the speed is inappropriate by pressing the Break key, the ttymon port monitor tries the next speed and writes the prompt again.

If autobaud is enabled for a port, the ttymon port monitor tries to determine the baud rate on the port automatically. Users must press Return before the ttymon port monitor can recognize the baud rate and print the prompt.

When valid input is received, the ttymon port monitor interprets the per-service configuration file for the port, creates an /etc/utmpx entry if required, establishes the service environment, and invokes the service associated with the port.

After the service terminates, the ttymon port monitor cleans up the /etc/utmpx entry, if one exists, and returns the port to its initial state.

Bidirectional Service

If a port is configured for bidirectional service, the ttymon port monitor will:

  • Allow users to connect to a service

  • Allow the uucico, cu, or ct commands to use the port for dialing out (if the port's free)

  • Wait to read a character before printing a prompt

  • Invoke the port's associated service, without sending the prompt message, when a connection is requested (if the connect-on-carrier flag is set)

Port Monitors: TTY Monitor and Network Listener

Though SAF provides a generic means for administering any future or third-party port monitors, only two are implemented in the Solaris environment: ttymon and listen.

TTY Port Monitor: ttymon

The ttymon port monitor is STREAMS-based. It monitors ports; sets terminal modes, baud rates, and line disciplines; and invokes the login process. (It provides Solaris users the same services that getty did under previous versions of SunOS 4.1 software.)

The ttymon port monitor runs under the SAC program. It is configured using the sacadm command. Each instance of ttymon can monitor multiple ports. These ports are specified in the port monitor's administrative file. The administrative file is configured using the pmadm and ttyadm commands.

ttymon and the Console Port

Console services are not managed by the Service Access Controller nor any explicit ttymon administration file. An entry in the /etc/inittab file is used to manage the console port using ttymon in express mode, which is a special ttymon mode that is invoked directly by a command that requires login service.

The default console entry in the /etc/inittab file looks like this:

co:234:respawn:/usr/lib/saf/ttymon -g -h -p "`uname -n` console login: "
 -T terminal_type -d /dev/console -l console -m ldterm,ttcompat

co:234:respawn:

co identifies the entry as the console; 234 identifies the run levels for the action, respawn, which means the console entry should be restarted if it fails or doesn't exist at run levels 2, 3, and 4.

/usr/lib/saf/ttymon -g -h

The -g option is used so the correct baud rate and terminal setting can be set on a port and connect to a login service without being preconfigured by the SAC. The -h option forces a line hangup by setting the line speed to zero before setting the default or specified speed.

-p "`uname -n` console login:

Identifies the prompt string for the console port.

-t terminal_type

Identifies the terminal type of the console.

-d /dev/console -l console -m ldterm,ttcompat

The -d option identifies the console device; the -l option identifies the ttylabel in the /etc/ttydefs file. The -m option identifies the STREAMS modules to be pushed.

Special ttymon-Specific Administrative Command: ttyadm

The ttymon administrative file is updated by sacadm and pmadm, as well as by the ttyadm command. The ttyadm command formats ttymon-specific information and writes it to the standard output, providing a means for presenting formatted ttymon-specific data to the sacadm and pmadm commands.

Thus, ttyadm does not administer ttymon directly; rather, it complements the generic administrative commands, sacadm and pmadm. For more information, see ttyadm(1M).

Network Listener Service: listen

The listen port monitor runs under SAC. It monitors the network for service requests, accepts requests when they arrive, and invokes servers in response to those service requests.

The listen port monitor is configured using the sacadm command. Each instance of listen can provide multiple services. These services are specified in the port monitor's administrative file. This administrative file is configured using the pmadm and nlsadmin commands.

The network listener process can be used with any connection-oriented transport provider that conforms to the Transport Layer Interface (TLI) specification. In the Solaris environment, listen port monitors can provide additional network services not provided by the inetd service.

Special listen-Specific Administrative Command: nlsadmin

The listen port monitor's administrative file is updated by sacadm and pmadm, as well as by the nlsadmin command. The nlsadmin command formats listen-specific information and writes it to the standard output, providing a means of presenting formatted listen-specific data to the sacadm and pmadm commands.

Thus, nlsadmin does not administer listen directly. Rather, it complements the generic administrative commands, sacadm and pmadm.

Each network can have at least one instance of the network listener process associated with it. Each network is configured separately. The nlsadmin command controls the operational states of listen port monitors.

The nlsadmin command can establish a listen port monitor for a given network, configure the specific attributes of that port monitor, and start and kill the monitor. The nlsadmin command can also report on the listen port monitors on a machine.

For more information, see nlsadmin(1M).

Administering ttymon Port Monitors

Use the sacadm command to add, list, remove, kill, start, enable, disable, enable, and remove a ttymon port monitor.


Note - You must be superuser to perform the following procedures.


How to Add a ttymon Port Monitor

To add a ttymon port monitor, type the following:

# sacadm -a -p mbmon -t ttymon -c /usr/lib/saf/ttymon -v `ttyadm
-V` -y "TTY Ports a & b"

-a

The add port monitor flag.

-p

Specifies the pmtag mbmon as the port monitor tag.

-t

Specifies the port monitor type as ttymon.

-c

Defines the command string used to start the port monitor.

-v

Specifies the version number of the port monitor.

-y

Defines a comment to describe this instance of the port monitor.

 
 
 
  Previous   Contents   Next