Port monitor requirements
To implement a port monitor, several requirements must be met.
These are summarized here.
In addition to the port monitor itself, an administrative command must
be supplied.
Initial environment
When a port monitor is started, it expects an initial execution environment
in which:
-
it will have no file descriptors open
-
it will not be a process group leader
-
it will have an entry in /etc/utmp of type LOGIN_PROCESS
-
an environment variable, ISTATE,
will be set to ``enabled'' or ``disabled''
to show the port monitor's correct initial state
-
an environment variable, PMTAG, will be set to the
port monitor's assigned tag
-
the directory that contains
the port monitor's administrative files will be its current directory
-
the port monitor will be able to create private files in the directory
/var/saf/pmtag,
where pmtag
is the port monitor's tag
-
the port monitor will be running with user ID 0 (root)
Important files
Relative to its current directory, the following key files
exist for a port monitor:
_config-
The port monitor's
configuration script.
The port monitor configuration script is run by the SAC.
The SAC is started by
init(1M)
as a result
of an entry in
/etc/inittab
that calls
sac(1M).
_pid-
The file into which the port monitor writes its process ID.
_pmtab-
The port monitor's administrative file.
This file contains information about the ports and services
for which the port monitor is responsible.
_pmpipe-
The FIFO through which the port monitor
will receive messages from the SAC.
svctag-
The per-service configuration script for the service with the tag svctag.
../_sacpipe-
The FIFO through which the port monitor will send messages to the SAC.
Responsibilities
A port monitor is responsible for performing the tasks described below in addition to
its port monitor-specific function.
A port monitor must perform the following
miscellaneous tasks during its normal
operation:
-
Write its process id into the file _pid and place an advisory lock on
the file.
-
Terminate gracefully on receipt of the signal SIGTERM.
-
Follow the protocol for message exchange with the SAC.
A port monitor must perform the following
tasks during service invocation:
-
Create a utmp entry if the requested service has the u
flag set in _pmtab.
NOTE:
Port monitors may ignore this flag if creating a utmp entry for the
service does not make sense because of the manner in which the service is
to be invoked.
On the other hand, some services may not start properly unless utmp entries
have been created for them.
-
Interpret the per-service configuration script for the requested service,
if it exists,
by calling the
doconfig(3iac)
library routine.
© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004