Chapter 4 Setting Up and Maintaining the ToolTalk Processes
Note –
The ToolTalk database server program must be installed on all
machines which store files that contain ToolTalk objects or files that are
the subject of ToolTalk messages.
Location of the ToolTalk Service Files
The ToolTalk binaries and library are located in /usr/openwin with symbolic links located in /usr/dt. This
ensures that users of either Common Desktop Environment (CDE) or OpenWindowsTM (OW) get the same version of ToolTalk. Online man
pages and ToolTalk demo program source are located in /usr/openwin.
Table 4–1 describes
the ToolTalk Service files.
Table 4–1 ToolTalk Service Files
|
File/location
|
Description
|
|
ttsession
|
Communicates with other ttsessions
on the network to deliver messages.
|
|
rpc.ttdbserverd
|
Stores and manages ToolTalk object
specs and information on files referenced in ToolTalk messages.
|
|
ttcp ttmv ttrm ttrmdir
tttar
|
These
commands are standard operating system shell commands that inform the ToolTalk
service when files that contain ToolTalk objects or files that are the subject
of ToolTalk messages are copied, moved, or removed.
|
|
ttdbck
|
A database check and recovery tool
for the ToolTalk databases.
|
|
tt_type_comp
|
This is a compiler for ptypes and otypes.
It compiles the ptype and otype files and automatically installs them in the
ToolTalk Types database.
|
|
ttce2xdr
|
Converts ToolTalk type data from the
Classing Engine database format to the XDR-database format.
|
|
ttsnoop
|
This is a Motif application that enables
you to register ToolTalk patterns and/or send ToolTalk messages, and to generally
observe ToolTalk message traffic. It is useful both for debugging existing
applications and as a tutor in understanding how different parts of a pattern
filter incoming messages.
|
|
tttrace
|
tttrace is analogous
to truss(1). It is an application that can be used in two
ways. It enables you to trace either the message-passing and pattern-matching
occurring in a given ttsession, or it can be used to provide
a per-program trace of all calls into the ToolTalk API.
|
|
libtt.so.2
|
This is the application programming
interface (API) library.
|
|
tttk.h and tt_c.h (located in /usr/dt/include/Tt)
|
Header files that contain the ToolTalk
functions used by applications to send and receive messages.
|
|
/usr/openwin/man/man1
|
ToolTalk
man pages for the user commands such as ttsession, ttdbck, tt_type_comp, and so on.
|
|
/usr/openwin/man/man1m
|
ToolTalk
man pages for the ToolTalk administrative commands suc such as rpc.ttdbserverd, ttdbck, and so on.
|
|
/usr/openwin/man/man3
|
ToolTalk
man pages for the ToolTalk API calls.
|
|
/usr/openwin/man/man4
|
ToolTalk
man pages for the ToolTalk message sets, and for configuration files used
for by ttsession(1) and rpc.ttdbserverd(1m)
|
|
/usr/openwin/man/man5
|
ToolTalk
man pages for the ToolTalk include files.
|
|
ttsample, edit_demo, and Makefile (located in /usr/openwin/share/src/tooltalk/demo)
|
Source code for simple ToolTalk demo programs.
|
Version
All ToolTalk commands support a -v option that prints
the version string.
Requirements
The software required by the ToolTalk service includes ONC RPC.
Environment Variables
This section addresss ToolTalk and related environment variables.
ToolTalk Environment Variables
There are several ToolTalk environment variables that may be set. Table 4–2 describes these variables.
Table 4–2 Environment Variables
|
Variable
|
Description
|
|
TTSESSION_CMD
|
Overrides the standard options specified
when tools automatically start ttsession. If this variable
is set, all ToolTalk clients use this command to automatically start their X sessions.
|
|
TT_ARG_TRACE_WIDTH
|
Defines the number of characters of argument and context values to print when
in trace mode. The default is to print the first 40 characters.
|
|
TT_FILE
|
ttsession places
a pathname in this variable when a tool is invoked by a message scoped to
the defined file.
|
|
TT_HOSTNAME_MAP
|
Points to
a map file. The defined map file is read into the ToolTalk client for redirecting
host machines.
|
|
TT_PARTITION_MAP
|
Points to
a map file. The defined map file is read into the ToolTalk client for redirecting
file partitions.
|
|
TT_SESSION
|
ttsession communicates
its session identifier to the tools that it starts. If this variable is set,
the ToolTalk client library uses its value as the default session identifier.
The string stored in this variable can be passed to tt_default_session_set.
|
|
TT_TOKEN
|
Notifies the ToolTalk client library
that it has been started by ttsession; the client can then
confirm to ttsession that the start was successful.
|
|
TT_TRACE_SCRIPT
|
Tells libtt to turn on client-side tracing as specified in the trace script
for tttrace(1).
|
|
TTPATH
|
Tells the ToolTalk service where the ToolTalk Types databases
used by tt_type_comp(1) and rpc.ttdbserverd(1M)
reside.
|
|
CEPATH
|
Tells the Classing Engine where the ToolTalk Types databases
reside.
|
|
DISPLAY
|
Causes ttsession to communicate
its session identifier to the tools that it starts if the TT_SESSION variable is not set.
If the DISPLAY variable
is set, the ToolTalk client library uses its value as the default session
identifier. This variable is typically set when ttsession
is auto-started while running under OpenWindows.
NOTE: Under the
Solaris operating environment, this variable may not be passed across to some
accounts. That is, if you are logged on the console as User A
and switch-user to User B, ttsession
may not autostart when you attempt to run a ToolTalk program that normally
autostarts ttsession. To avoid this problem, either manually
set the this variable or include it in your .login file.
|
|
DTMOUNTPOINT
|
If set, the value of this environment variable will be used in place of /net in pathnames constructed to answer tt_host_netfile_file()(3) queries, by rpc.ttdbserverd(1M).
|
A process is given a modified environment when it is automatically started
by the ToolTalk service. The modified environment includes the environment
variables $TT_SESSION, $TT_TOKEN, and any contexts in the start-message
whose keyword begins with the dollar sign symbol ($). Optionally, the environment
variable $TT_FILE may also be
included in the modified environment if it is a file-scoped message.
Note –
If the tt_open call will be invoked by a child
process, the parent process must propagate the modified environment to that
child process.
Other Environment Variables
The TMPDIR environment variable
is another environment variable that you can set to manipulate the ToolTalk
development environment. For example, the following line
redirects files to the /var/tmp directory.
Environment Variables Required to Start Programs on Remote Hosts
The start string is always executed on the host
on which ttsession is running; however, the executed process
can start another process on another host.
To do this, first make your start string be similar to the following:
Next, to make sure myprog is placed in the right
session and receives its initial message, you need to propagate the important
ToolTalk environment variables. The ttrsh shell script
shown in Example 4–1 propagates
these environment variables.
Example 4–1 Propagating ToolTalk Environment Variables
#! /bin/sh
# Runs a command remotely in background, by pointing stdout and stderr
# at /dev/null. By running this through the Bourne shell at the other end,
# we get rid of the rsh and rshd.
#set -x
user=
debug=
HOST=${HOST-`hostname`}
if [ "$1" = "-debug" ]; then
debug=1
shift
fi
if [ $# -lt 2 -o "$1" = "-h" -o "$1" = "-help" ];
then
echo "Usage: ttrsh [-debug] remotehost [-l username] \
remotecommand"
echo "Usage: ttrsh [-h | -help]"
exit 1
else
host=$1
shift
if test "$1" = "-l" ; then
shift
user=$1
shift
fi
fi
xhostname=`expr "$DISPLAY" : "\([^:]*\).*"`
xscreen=`expr "$DISPLAY" : "[^:]*\(.*\)"`
if test x$xscreen = x; then
xscreen=":0.0"
fi
if test x$xhostname = x -o x$xhostname = x"unix";
then
DISPLAY=$HOST$xscreen
fi
if [ "$user" = "" ]; then
userOption=""
else
userOption="-l $user"
fi
if [ $debug ]; then
outputRedirect=
else
outputRedirect='> /dev/null 2>&1 &'
fi
(
echo "OPENWINHOME=$OPENWINHOME;export OPENWINHOME;\
TT_SESSION=$TT_SESSION;export TT_SESSION;\
TT_TOKEN=$TT_TOKEN;export TT_TOKEN;TT_FILE=$TT_FILE;\
export TT_FILE;DISPLAY=$DISPLAY;export DISPLAY;($*)" \
$outputRedirect | rsh $host $userOption /bin/sh &
) &
Using Context Slots to Create Environment Variables
Message contexts have a special
meaning when the ToolTalk service starts an application. If the name of a
context slot begins with a dollar sign ($), the ToolTalk service interprets
the value as an environment variable. For example, the following uses the
value of context slot $CON1.
start "my_application $CON1"
|
Installing the ToolTalk Database Server
The ToolTalk Database server is used to store three types of information:
-
ToolTalk objects specs.
-
ToolTalk session IDs of sessions with clients that have joined
a file using the tt_file_join call.
-
File-scoped messages that are queued because the message disposition
is TT_QUEUED and a handler that can handle the message
has not yet been started.
In addition, the ToolTalk Database server answers queries for the ToolTalk
filename mapping API calls (tt_host_file_netfile() and tt_host_netfile_file()).
Note –
The ToolTalk database server does not store
messages that are scoped to file-in-session.
The ToolTalk service requires that a database server run on each machine
that stores files that contain ToolTalk objects or files that are the subject
of ToolTalk messages. When an application attempts to reference a file on
a machine that does not contain a database server, an error similar to the
following message is displayed:
% Error: Tool Talk database server on integral is not running: tcp
|
where integral is the hostname and tcp is the application protocol. This error message indicates that
the connection failed. A failed connection can also be caused by network problems.
Confirming that the rpc.ttdbserverd is installed on a system.
All machines should have the SUNWtltk and SUNWdtcor packages installed if
they contain files referenced in ToolTalk messages. To confirm that rpc.ttdbserverd is installed on a system:
-
Login to the system.
-
Use pkginfo(1) to determine that the SUNWtltk and
SUNWdtcor packages are installed.
Caution – The /etc/inetd.conf config line below
is installed by the SUNWdtcor Solaris package. If a system does not have
SUNWtltk installed, you should make sure that SUNWdtcor is present before
installing SUNWtltk. Do not copy a Solaris 7 (SunOS 5.7
or compatible) server onto a machine running the Solaris 1.0 (SunOS 4.0/4.1
or compatible) operating environment.
-
Check that the /etc/inetd.conf file contains the
following line.
100083/1 tli rpc/tcp wait root /usr/openwin/bin/rpc.ttdbserverd
|
If you find that rpc.ttdbserverd is not present,
then you can install it by adding the SUNWtltlk and SUNWdtcor packages using pkgadd(1M). After adding the packages have inetd reread its configuration
file:
# ps -ef | grep inetd # kill -HUP inetd-pid
|
Note –
inetd-pid is from the ps
listing.
Confirming that the rpc.ttdbserverd is running on a system.
To determine if the ToolTalk database server is actually running on
a specific system, you can use the rpcinfo(1M) command:
% rpcinfo -T tcp -t <hostname> 100083
program 100083 version 1 ready and waiting
%
|
Note –
hostname is from hostname(1).
From the Solaris Distribution CD-Rom
To install the ToolTalk software package from the Solaris distribution
cd-rom, use the pkgadd command. The package name for the ToolTalk software
is SUNWt/tk; the developer's package name is SUNWt/tkd; and the manpage package name is SUNWt/tkm.
Running the New ToolTalk Database Server
Once a newer version of the ToolTalk database server has been run on a machine,
you cannot revert to a previous version of the ToolTalk database server. Any
attempt to run a previous version of the ToolTalk database server displays
the following error message:
rpc.ttdbserverd[pid #: rpc.ttdbserverd version (1.0.x)
does not match the version (1.1) of the database tables.
Please install an rpc.ttdbserverd version 1.1 (or greater).
|
Redirecting the ToolTalk Database Server
You can
redirect both database host machines and the file system partitions.
-
Redirecting a database host machine allows a ToolTalk client
to physically access ToolTalk data from a machine that is not running a ToolTalk
database server.
-
Redirecting a file system partition allows a ToolTalk database
to logically read and write ToolTalk data from and to a read-only file system
partition (for example, a CD-Rom) by physically accessing a different file
system partition. Redirecting a file system partition also is done if a system
administrator wants all ToolTalk databases to reside on a single local partition
instead of one per local partition, which is the default.
Redirecting the Host Machine
When you
redirect a database host machine, a ToolTalk client can physically access
ToolTalk data from a machine that is not running a ToolTalk database server.
To redirect the host machine, you need to map the hostnames of the machines
the ToolTalk client is to access. On the machine running the ToolTalk client
that is making the database query:
-
Create a hostname_map file.
For example:
# Map first host machine
oldhostname1 newhostname1
# Map second host machine
oldhostname2 newhostname2
|
where oldhostname is the name of the machine the
ToolTalk client needs to access and newhostname is the
name of a machine that is running the ToolTalk database server.
-
Store the file in the same location at which the ToolTalk Types databases
are stored.
The map files have the same order of precedence as the ToolTalk Types
databases (see tt_type_comp(1).
Note –
A file defined in the TT_HOSTNAME_MAP environment variable has a higher precedence than the map in
the user database.
The map file is read into a ToolTalk client when the client makes a tt_open call. For detailed information on host redirection see hostname_map(4).
Redirecting the File System Partition
When you redirect a file system partition, a ToolTalk database
can logically read and write ToolTalk data from and to a read-only file system
partition by physically accessing a different file system partition. To redirect
a file partition, you need to map the partitions to where the ToolTalk database
will write. On the machine running the ToolTalk database server:
-
Create a partition_map file.
For example:
# Map first partition
/cdrom /usr
# Map second partition
/sr0/export/home /export/home
|
maps the read-only partition /cdrom to /usr, a read-write partition; and maps the read-only partition /sr0/export/home to /export/home, a read-write
partition.
-
Store the map file in the same location at which the system ToolTalk
Types databases are stored.
Note –
A file partition defined in the TT_PARTITION_MAP environment variable has a higher precedence
than the file partition defined in this map file.
The map file is read when the ToolTalk database server is started, or
when the database server receives a USR2 signal. For detailed
information on partition redirection see partition_map(4).