ToolTalk User's Guide
この本のみを検索
PDF 文書ファイルをダウンロードする

Setting Up and Maintaining the ToolTalk Processes

4


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.

4.1 Location of the ToolTalk Service Files

The ToolTalk directories and files are:
/tt/bin/
  ttsession
  rpc.ttdbserverd

  • 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.
/tt/bin/
  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.
/tt/bin/
  ttdbck

  • ttdbck is a database check and recovery tool for the ToolTalk databases.
/tt/bin/
  tt_type_comp

  • tt_type_comp is a compiler for ptypes and otypes. It compiles the ptype and otype files and automatically installs them in the ToolTalk Types database.
/tt/bin/
  ttce2xdr

  • ttce2xdr converts ToolTalk type data from the Classing Engine database format to the XDR-database format.
/tt/lib
  libtt.so.1
  libtt.a

/tt/share/include/desktop/
  tt_c.h

  • These files are the application programming interface (API) libraries and header file that contain the ToolTalk functions used by applications to send and receive messages.
/tt/man/man1/
  install_tt.1
  tt_type_comp.1
  ttcp.1
  ttmv.1
  ttrm.1
  ttrmdir.1
  ttsession.1
  tttar.1

/tt/man/man1m/
  rpc.ttdbserverd.1m
  ttce2xdr.1m
  ttdbck.1m
  ttdbserverd.1m

/tt/man/man3/
  ttapi.3

/tt/demo/
  CoEd.6
  edit.demo.6
  ttsample1.6
  ttsnoop.6

  • These are the man pages for the ToolTalk binary files, type compiler, enhanced shell commands, API, and database check utility.

4.2 Version

All ToolTalk commands except the ttce2xdr command support a -v option that prints the version string.

4.3 Requirements

The software required by the ToolTalk service includes ONC RPC.

4.4 Environment Variables

ToolTalk Environment Variables

There are several ToolTalk environment variables that may be set:
  • SUN_TTSESSION_CMD
  • _SUN_TT_ARG_TRACE_WIDTH
  • _SUN_TT_FILE
  • _SUN_TT_HOSTNAME_MAP
  • _SUN_TT_PARTITION_MAP
  • _SUN_TT_SESSION
  • _SUN_TT_TOKEN
  • TTPATH
  • DISPLAY
  • CEPATH
Table 4-1 describes these variables.
Table 4-1
VariableDescription
SUN_TTSESSION_CMDOverrides 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.
_SUN_TT_ARG_TRACE_WIDTHDefines the number of characters of argument and context values to print when in trace mode. The default is to print the first 40 characters.
_SUN_TT_FILEttsession places a pathname in this variable when a tool is invoked by a message scoped to the defined file.
_SUN_TT_HOSTNAME_MAPPoints to a map file. The defined map file is read into the ToolTalk client for redirecting host machines.
_SUN_TT_PARTITION_MAPPoints to a map file. The defined map file is read into the ToolTalk client for redirecting file partitions.
_SUN_TT_SESSIONttsession 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.

NOTE: The string stored in this variable can be passed to tt_default_session_set.

_SUN_TT_TOKENNotifies the ToolTalk client library that it has been started by ttsession; the client
can then confirm to ttsession that the start was successful.
TTPATHTells the ToolTalk service where the ToolTalk Types databases reside. The format of this variable is: userDB[:systemDB[:networkDB]]
CEPATHTells the Classing Engine where the ToolTalk Types databases reside.
DISPLAYCauses ttsession to communicate its session identifier to the tools that it starts if the _SUN_TT_SESSION variable is not set.

If the DISPLAY variable is set, the ToolTalk client library uses its value as the default session identifier.

A process is given a modified environment when it is automatically started by the ToolTalk service. The modified environment includes the environment variables $_SUN_TT_SESSION, $_SUN_TT_TOKEN, and any contexts in the start-message whose keyword begins with the dollar sign symbol ($). Optionally, the environment variable $_SUN_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:

  TMPDIR=/var/tmp  

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:

  # rsh farhost myprog  

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 Code Example 4-1 propagates these environment variables.
Code Example 4-1 Propagating ToolTalk Environment Variables

  #! /bin/sh  
  # This command runs a command remotely in the background, by pointing  
  # stdout and stderr at /dev/null.  
  # By running this through the Bourne shell at the other end, and  
  # we get rid of the rsh and rshd which otherwise hand around at either  
  # end.  
  # Hacked from a posting by clyde@emx.utexas.edu to list.xpert  
  #  

Code Example 4-1 Propagating ToolTalk Environment Variables (Continued)

  #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;\  
  _SUN_TT_SESSION=$_SUN_TT_SESSION;export _SUN_TT_SESSION;\  

Code Example 4-1 Propagating ToolTalk Environment Variables (Continued)

  _SUN_TT_TOKEN=$_SUN_TT_TOKEN;export _SUN_TT_TOKEN;_SUN_TT_FILE=$_SUN_TT_FILE;\  
  export _SUN_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,

  start "my_application $CON1"  

uses the value of context slot $CON1.

4.5 Installing the ToolTalk Database Server

The ToolTalk Database server is used to store three types of information:
  1. ToolTalk objects specs.

  2. ToolTalk session IDs of sessions with clients that have joined a file using the tt_file_join call.

  3. 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.


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.

When the ToolTalk Service is Installed Elsewhere on the System

To install the ToolTalk database server from another machine on the system that already has the ToolTalk service installed:
  1. Login as superuser.

  2. Copy the database server image from a machine that has the ToolTalk software installed to the machine that does not.

    For example:


 # rcp client:/tt/bin/rpc.ttdbserverd /tt/bin/rpc.ttdbserverd  

where client is the machine where the ToolTalk binaries are located.

CAUTION Caution - Before you copy the database server image, verify that the operating systems are the same levels.

  1. Check that the /etc/inetd.conf file contains the following line.


 # 100083/1 stream rpc/tcp wait root /tt/rpc.ttdbserverd rpc.ttdbserverd  

  1. Cause inetd to reread the configuration file. (inetd-pid in the following example is from the ps listing.)


 # ps -ef | grep inetd  
 # kill -HUP inetd-pid  

4.6 Running the New ToolTalk Database Server

Once the new 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: Any data written using a ToolTalk 1.0.x DB server  
   after using a new ToolTalk DB server will be ignored.  

4.7 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.
  • Redirect 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 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:
  1. 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.
  1. 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 (usr, system, or network) databases.


Note - A file defined in the _SUN_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.

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:
  1. 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.
  1. Store the map file in the same location at which the system ToolTalk Types databases are stored.


Note - A file partition defined in the _SUN_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 receives a USR2 signal.