Service Access Facility

Team-Fly    

Solaris™ Operating Environment Boot Camp
By David Rhodes, Dominic Butler
Table of Contents
Chapter 14.  Connecting Serial Devices


The Service Access Facility (SAF) is used to control access to specific services on the machine. The main SAF program is the Service Access Controller (/usr/lib/saf/sac), which is responsible for managing the overall process, including spawning the individual daemons known as "port monitors."

Port Monitors

These, as their name suggests, are programs that monitor a port for incoming connection requests. Currently, two of these are supplied as standard, although the SAF can be extended to allow it to support custom monitors that have been written for specific applications. The supplied ones are listed here:

  • ttymon (this monitors the serial ports)

  • listen (this monitors the network ports)

Each port monitor needs to be "added" to the SAF and, after that, needs further configuration to be able to support any services. Since this chapter deals with serial devices, we will only configure the serial port monitor here (ttymon). After adding it to the SAF, we'll configure it to support two services: one for a terminal and one for a modem.

When a port monitor is added it has a name associated with it. This is known as the port monitor "tag" and is used to reference it later. The default tag used for the serial ports is "zsmon" (because the serial ports use the "zs" driver).

SAF Hierarchy

Before we go any further, let's look at how the SAF processes are started along with the hierarchy they use. This will show how sac determines which port monitors are available, and how each of these discovers the settings it should apply.

The examples below contain typical configuration data. We don't need to be too concerned about their contents just now, as we'll look at this in more detail as we progress through the chapter.

First, the main daemon, sac, is started automatically at boot-time using the /etc/inittab entry shown below:

 hydrogen# grep sac /etc/inittab sc:234:respawn:/usr/lib/saf/sac t 300 hydrogen# 

Once started, it determines its configuration by checking the hierarchy generated beneath /etc/saf, an example of which is shown here:

 hydrogen# cd /etc/saf hydrogen# ls -l total 6 prw-------   1 root   root       0 Nov 19 13:41 _cmdpipe prw-------   1 root   root       0 Nov 19 15:26 _sacpipe -r--r--r--   1 root   other     52 Nov 19 15:11 _sactab -rw-r--r--   1 root   sys       45 Aug 27  2000 _sysconfig drwxr-xr-x   2 root   other    512 Nov 19 15:11 zsmon hydrogen# 

Next sac reads the file named _sysconfig. Often this is empty, as in our case, but it can be edited to set any system-wide configuration details if we wish:

 hydrogen# cat _sysconfig # This is the per-system configuration file hydrogen# 

After that, it reads its main configuration file, /etc/saf/_sactab. This contains the current SAF version number along with an entry for each port monitor that has been added to the system:

 hydrogen# cat /etc/saf/_sactab # VERSION=1 zsmon:ttymon::0:/usr/lib/saf/ttymon # hydrogen# 

This example defines a port monitor tag named "zsmon" and specifies that the port monitor type used for this tag will be ttymon. As shown in the /etc/saf listing earlier, a directory is created for each port monitor tag defined in /etc/saf/_sactab. This means a directory named zsmon has been created. If we take a look in there we'll see the following contents:

 hydrogen# cd /etc/saf/zsmon hydrogen# ls -l total 4 -rw-r--r--   1 root     other     4 Mar  9 14:06 _pid prw-------   1 root     other     0 Mar  9 14:12 _pmpipe -r--r--r--   1 root     other   248 Mar  9 14:20 _pmtab hydrogen# 

The _pmtab file contains all the settings that need to be applied by the port monitorttymon, in this case. It contains colon-separated strings, which can be quite hard work to decipher. The following example has two services configured, one named "ttya" and the other named "ttyb":

[View full width]

hydrogen# cat _pmtab # VERSION=1 ttya:u:root:reserved:reserved:reserved:/dev/term/a:I::/usr/bin/login::9600:ldterm, graphics/ccc.gifttcompat:ttya login\: ::tvi925:y:# ttyb:u:root:reserved:reserved:reserved:/dev/term/b:I::/usr/bin/login::9600:ldterm, graphics/ccc.gifttcompat:ttyb login\: ::tvi925:y:# hydrogen#

Now that we've seen the files that define the SAF hierarchy, let's look at how the SAF processes tie together by showing which daemons are spawned along with their related configuration files (Figure 14.5).

Figure 14.5. The SAF process, using "zsmon" as an example.

graphics/14fig05.gif

SAF Log Location

If we take a quick look in /var, we'll see a similar hierarchy to /etc/saf has been generated there, but this time for the log files:

 hydrogen# cd /var/saf hydrogen# ls -l total 74 -rw-rw-rw-   1 root     root       36335 Nov 19 15:13 _log drwxr-xr-x   2 root     other        512 Nov 19 15:11 zsmon hydrogen# helium# cd zsmon helium# ls -l total 4 -r--r--r--   1 root     root        1785 Nov 19 15:14 log hydrogen# 

Administration Programs

A number of programs are provided to administer the SAF, which are as follows:

  • sacadm (used to control sac and its related port monitors)

  • pmadm (used to control a port monitor's services)

For each type of port monitor there is also a "helper" program. This is used to provide port monitor specific information that has been formatted so that it can be easily passed onto both sacadm and pmadm. The helper program for ttymon is named ttyadm, while the one for listen is named nlsadmin. We'll look at ttyadm in more detail when we use it later to create our services.


    Team-Fly    
    Top
     



    Solaris Operating Environment Boot Camp
    Solaris Operating Environment Boot Camp
    ISBN: 0130342874
    EAN: 2147483647
    Year: 2002
    Pages: 301

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net