Table of Contents
To use TDL, the TDL environment must be set. To use the implicit version protection function, the TMAX environment must be set. This chapter describes how to set each environment and use its tools.
The TDL directory consists of the config directory for environment files, the mod directory for soon-to-be-updated libraries, and the run directory for updated libraries.
If the $TDLDIR is not specified as the TDL root path, the path configured in the $TMAXDIR environment variable must be used. If a user wants to specify a different path, the $TDLDIR environment variable must be configured. Also, TDL needs to be used in the local client, $TDLDIR must be configured.
The TDL 2.x version does not have config but tdl.cfg in the $TDLDIR.
To use TDL, the TDL configuration file and the environment related to TDL must be set at Tmax.
The basic grammar of configuration is "parameter = value" and spaces are not allowed within the line. If the first character of the line is '#', the line will be annotated.
The TDL configuration file is $TMAXDIR/config/tdl.cfg and the following describes examples and items of the TDL environment file.
# shared memory version (1|2|3|4) VERSION=2 # shared memory key SHMKEY=0x90000 # shared memory and file creation permission IPCPERM=0750 # number of dynamic loadable modules, rouded up to powers of 2 MAXMODULES=256 # shared memory backup BACKUP=log/dlog/tdl.bak # path of a command file for searching export functions #COMMAND=tdlcmd # path of a log directory LOGDIR=log/dlog # running mode (single|master|slave) MODE=single # mornitoring statistics MONITOR=Y # language of tdl application [C | COBOL | IBMCOBOL | PL1 | MIXED] LANG=C # path of a file including addresses for accessing remote tdl nodes #RACFILE=tdl.rac # tdl domain ID DOMAINID=1 # multiple run, mod dir DIRMAPPINGLIST=(mod:run),(mod2:run2),(mod2:run2) # HASHFUNC=[ LOOKUP2 | LOOKUP3 | SUPERFASTHASH | TDLHASH | MURMURHASH ] # HASHFUNC=MURMURHASH
Item | Description |
---|---|
VERSION | Configures a version to run TDL. Select one among 1, 2, 3, and 4. (The default: 1) For more information, refer to "VERSION Item". |
SHMKEY | Configures a shared memory key value used for running TDL. |
IPCPERM | Configures the permission of the dynamic module and shared memory of the run directory. |
MAXMODULES | The maximum number of dynamic modules. Used by being rounded off to 2^n. Can change without relocation of the modules. For more information, refer to "Chapter 4. Example". |
BACKUP | Specifies the shared memory backup file. During tdlinit and tdlupdate, the shared memory is automatically backed up to the specified file. If a relative path, the path begins at $TDLDIR or $TMAXDIR. $TDLDIR of the path information takes precedence. |
COMMAND | Specifies the location of the script file to automatically extract a function to export from the library. If a relative path, the path begins at $TDLDIR/config or $TMAXDIR/config. $TDLDIR of the path information takes precedence. |
LOGDIR | Specifies the error and information message logging directory. The log file name is "tdllog.mmddyyyy" format. If a relative path, the path begins at $TDLDIR or $TMAXDIR. $TDLDIR of the path information takes precedence. |
MODE | Configures one of a master, slave, and single in the multi nodes or domains. (The default: single) |
MONITOR | Option to collect TDL statistics information(Y|N). (The default: N) If set to 'Y', AVG/MIN/MAX and CPU AVG/MIN/MAX, performing time by module are collected. Can be queried through the 'tdlshm –S' option. |
LANG | Selects one from C, COBOL, IBMCOBOL, PL1, and MIXED for TDL applications using a language. If not selected, it is set to C. The extension of the module is determined by the OS. |
RACFILE | Specifies a file with the racd address of all the nodes in the multi nodes or domains. If a relative path, the path begins at $TDLDIR/config or $TMAXDIR/config. $TDLDIR of the path information takes precedence. For an example of RACFILE, refer to "RACFILE Example". |
DOMAINID | ID for a TDL domain and must be configured differently per domain. (The default: 0) |
DIRMAPPINGLIST | Configures if two run directories or more are used. Pairs of the mod directories and run directories are separated by parenthesis and a colon(:) and can be set up to 10 pairs. Applied from Tmax v5.0 sp1 fix#2. |
HASHFUNC | Configures by selecting a type of HASH internally used in TDL(Index configuration for each module). Applied from Tmax v5.0 sp2. |
TDL can operate the system in the form of four VERSIONs. VERSION values can be configured through VERSION parameters of the TDL environment file(tdl.cfg).
VERSION 1
The VERSION is set to 1 and has only one function per library. The function name must match the library name. (The function name must be unique as a whole.)
VERSION 2
The VERSION is set to 2 and the library can have multiple functions. But functions to be exported are supported by the following. (The function name must be unique as a whole.)
Specification of Export Files
A user specifies a function to export from the library by including an export file ("library name.exp") in the mod directory. This method is recommended as the automatic extraction may export functions that are not supposed to be exported.
A export file specifies one function per line. If the first character of the line is '#', the line will be annotated.
The following is an example.
# mylibrary myfunction1 myfunction2 myfunction3
Automatic Extraction of Export Function
Automatically extracts functions to be exported. If the export file is not specified, the function is automatically extracted. Internally, nm is used and a user can redefine the nm script. The script must be written in one line. If the first character of the line is '#', the line will be annotated. If the last character of the line is '\', the line will lead up to the following line. "$(LIB)" is a macro variable that indicates the library name.
The following is an example.
# for HP32 nm $(LIB) | awk -F"|" '{if ($3 == "extern" && $4 == "code ") {print $1}}' | grep -ve "^_" # for HP64 nm $(LIB) | awk -F"|" '{if ($4 == "FUNC " && $7 == " .text") {print $8}}' | grep -ve "^_" # for IBM32 nm $(LIB) | awk '{if ($2 == "D") {print $1}}' # for IBM64 nm -X64 $(LIB) | awk '{if ($2 == "D") {print $1}}' # for SUN nm $(LIB) | awk -F"|" '{if ($4 == "FUNC ") {print $8}}' | grep -v "^_" # for linux nm $(LIB) | awk '{if ($2 == "T") {print $3}}' | grep -v "^_" (*But, the above script is noly an example and the modification is needed depending on the actual platform.)
The above script can be used by using the COMMAND parameter of the TDL environment file(tdl.cfg) or the –x option from the management tool. Also, functions that are automatically extracted from the system can be identified in advance through tdlnm.
VERSION 3
The VERSION is set to 3. The library name and function name are used for a key. Therefore, unlike VERSION 1 and 2, it is acceptable for the function name to be unique only within the library. But the VERSION 3 requires tdlcall2(), tdlcall2v(), and tdlcall2s() to be used.
VERSION 4
The VERSION is set to 4. The library name, class name, and name space are used. This is used in C++ and does not use tdlcall but a separate interface. For more information, refer to "Chapter 4. Example".
Save the configured file with ".rac" extension as follows. Configure the file name for the RACFILE item.
hostname1 192.168.1.1 3333 hostname2 192.168.1.2 3333 hostname3 192.168.1.3 3333
To use the implicit version protection, TDL must be configured at DOMAIN or NODE clause.
*DOMAIN tmax ..., TDL = Y *NODE tmax1 ..., TDL = Y
DOMAIN Clause
Item | Description |
---|---|
TDL | Option to use the TDL implicit version protection(Y|N). (The default: N) |
NODE Clause
item | Description |
---|---|
TDL | Option to use the TDL implicit version protection(Y|N). If not configured, the TDL value of the DOMAIN clause will be used. |
The following are the management tools that TDL provides. They are located in the following path.
$TMAXDIR/bin
Command | Description |
---|---|
tdlinit | Performs initialization of TDL shared memories and dynamic modules. |
tdlclean | Cleans up the run directory's older version of the library files or unnecessary files. |
tdlnm | Queries the list of functions to be automatically exported for the specified library. |
tdlrm | Management tool to completely remove shared memories when TDL is no longer used. |
tdlshm | Queries information about TDL shared memories or configures whether to activate statistics monitoring and modules. |
tdlsync | Performs synchronization of TDL shared memories and backup files. |
tdlupdate | Updates the specified dynamic module. |
The tdlinit command initializes a TDL shared memory and dynamic modules. This command is executed only once when Tmax is installed and before Tmax starts. This command can be executed only in a master node in a multi-node environment.
Usage
$ tdlinit [-p TDL root directory path] [-x export function extraction script file path] [-f] [-b] [-B backup file path] [-i] [-v | -V] [-h]
Option | Description |
---|---|
[ -p TDL root directory path ] | A TDL root directory. Default value: $TDLDIR or $TMAXDIR. |
[ -x export function extraction script file path ] | The path of a script file that extracts an export function. |
[ -f ] | Initializes already existing shared memory by force. |
[ -b ] | Restores shared memory from a backup file. |
[ -B backup file path ] | Restores shared memory from a specified backup file. |
[ -i ] | Checks a run directory after a backup. Used with [-b] or [-B] options. |
[ -v | -V ] | Shows version information. |
[ -h ] | Shows command Help. |
Examples
The following initializes shared memory and modules using a TDL configuration file <tdl.cfg>:
$ tdlinit
The following backs up shared memory from a backup file in the event of a system failure or restart:
$ tdlinit -b
Note
A script file that extracts an export function is required when a VERSION is set to 4.
/* Example of exp file */ /* dlib.exp */ #! dlib.so TmaxSoft::Airplain Car
The tdlclean command removes outdated library files and unnecessary files in a run directory. To remove a dynamic module from shared memory, use [-m] or [-M] options.
Usage
$ tdlclean [-p TDL root directory path] [-m library name] [-M function name] [-b] [-d yyyymmddhhmi] [-D "n hour|day"] [-N number] [-v | -V] [-h]
Option | Description |
---|---|
[ -p TDL root directory path ] | A TDL root directory. Default value: $TDLDIR or $TMAXDIR. |
[ -m library name ] | Removes a specified library from a TDL shared memory and relevant files from a run directory. |
[ -M function name ] | Removes a specified function from shared memory. Relevant files in a run directory are not removed. If VERSION is set to 1, the result of this option will be the same as a [-m] option. |
[ -b ] | A shared memory file is not backed up even if a BACKUP parameter is specified in a TDL configuration file <tdl.cfg>. Cannot be used with [-m] or [-M] options. |
[ -d yyyymmddhhmi ] | Removes all outdated library files created before a specified date and time (yyyymmddhhmi). Cannot be used with [-m] or [-M] options. |
[ -D "n hour|day" ] | Removes all outdated library files created before a specified hour or day. Cannot be used with [-m] or [-M] options. |
[ -N number ] | Removes outdated library files except for a specified number of outdated libraries. Cannot be used with [-m] or [-M] options. |
[ -v | -V ] | Shows version information. |
[ -h ] | Shows command Help. |
Examples
The following removes outdated library files:
$ tdlclean
The following removes library files that were created before 00:00 on February 1st, 2009:
$ tdlclean –d 200902010000
The following removes library files older than five days:
$ tdlclean -D "5 day"
The following removes mylibrary from a TDL shared memory and outdated files:
$ tdlclean -m mylibrary
The tdlnm command retrieves a list of functions that are automatically exported to a specified library when a VERSION is set to 2 or higher.
Usage
$ tdlnm [-p TDL root directory path] [-x export function extraction script file path] [-m library name] [-v | -V] [-h]
Option | Description |
---|---|
[ -p TDL root directory path] | A TDL root directory. Default value: $TDLDIR or $TMAXDIR. |
[ -x export function extraction script file path ] | The path of script file that extracts an export function. |
[ -m library name ] | A library that retrieves a list of automatic export functions. |
[ -v | -V ] | Shows version information. |
[ -h ] | Shows command Help. |
Example
The following retrieves a list of export functions of a mylibrary file:
$ tdlnm -m mylibrary
The tdlrm command removes shared memory when a TDL is no longer used. tdlcall() cannot be called after this command is executed.
Usage
$ tdlrm [-p TDL root directory path] [-v | -V] [-h]
Option | Description |
---|---|
[ -p TDL root directory path ] | A TDL root directory. Default value: $TDLDIR or $TMAXDIR. |
[ -v | -V ] | Shows version information. |
[ -h ] | Shows command Help. |
Example
The following removes a TDL shared memory:
$ tdlrm
The tdlshm command retrieves information about a TDL shared memory and enables/disables statistics monitoring and modules.
Usage
$ tdlshm [-p TDL root directory path] [-r] [-S] [-n node name] [-m function name] [-M library name] [-C] [-c start_index end_index] [-s e|d|r] [-u e|d] [-I mincol] [-v | -V] [-h]
Option | Description |
---|---|
[ -p TDL root directory path ] | A TDL root directory. Default value: $TDLDIR or $TMAXDIR. |
[ -r ] | Retrieves information about modules that are currently synchronizing updates in a multi-node environment. |
[ -S ] | Retrieves information about dynamic module statistics. Statistics include runtime AVG/MIN/MAX and CPU AVG/MIN/MAX for each module. |
[ -n node name ] | A node to be retrieved in the multi-node environment. |
[ -m function name ] | A function to be retrieved. |
[ -M library name ] | A library to be retrieved. |
[ -C ] | Executes a dlopen and dlsym for all modules. |
[ -c start_index end_index ] | Executes a dlopen and dlsym for modules within a specified index range. |
[ -s e|d|r ] | Dynamic module statistics monitoring.
|
[ -u e|d ] | A Dynamic module.
This option must be used with [-m] or [-M] options because only a single module can be set at one time.
|
[ -I minimum collision count ] | Displays a comparison count when buckets are searched due to hash collisions for each module. Information about modules with a collision count greater than or equal to a value is displayed. This option can be used with [-p], [-m], [-M], and [-r] options. The value must be 0 or greater. |
[ -I mincol ] | Displays a comparison count, in a "Collision=n" format, when a hash collision occurs in a module. If n is 0, only one comparison was found. mincol is a minimum comparison count. The value must be greater than 0. When displaying each module, only information about modules with a comparison count greater than a specified value are displayed. Set mincol to a large value to quickly find a function with a high comparison count. This option can be used with [-p], [-m], [-M], and [-r] options. |
[ -v | -V ] | Shows version information. |
[ -h ] | Shows command Help. |
Examples
The following is the basic usage of tdlshm:
$ tdlshm TDLDIR = /home/jeffry/tmax LOGDIR = /home/jeffry/tmax/log/dlog
- BACKUP = /home/jeffry/tmax/log/dlog/tdl.bak VERSION = 2, SHMKEY = 0x90000,
- IPCPERM = 0750 MAXMODULES = 256, CURMODULES = 3, Global SEQNO = 45e27d28,
- MONITOR = Y MODE = SINGLE, DOMAINID = 1 Index = 125, Funcname = myfunction1,
- Libname = myfunction1, Seqno = 45e27d28, Active = Y Index = 126,
- Funcname = myfunction2, Libname = myfunction2, Seqno = 45e27d28, Active = Y,
- Index = 127, Funcname = myfunction3, Libname = myfunction3, Seqno = 45e27d28,
Active = Y
The following retrieves information about TDL statistics:
$ tdlshm -S TDLDIR = /home/jeffry/tmax LOGDIR = /home/jeffry/tmax/log/dlog
- BACKUP = /home/jeffry/tmax/log/dlog/tdl.bak VERSION = 2, SHMKEY = 0x90000,
- IPCPERM = 0750 MAXMODULES = 256, CURMODULES = 3, Global SEQNO = 45e27d28,
- MONITOR = Y MODE = SINGLE, DOMAINID = 1 Index = 125, Funcname = myfunction1,
- Libname = myfunction1, Seqno = 45e27d28, Active = Y Count = 0 SVC: Avg = 0.000,
- MinTime = 0.000, Maxtime = 0.000 CPU: Avg = 0.000, MinTime = 0.000,
- Maxtime = 0.000 Index = 126, Funcname = myfunction2, Libname = myfunction2,
- Seqno = 45e27d28, Active = Y Count = 0 SVC: Avg = 0.000, MinTime = 0.000,
- Maxtime = 0.000 CPU: Avg = 0.000, MinTime = 0.000, Maxtime = 0.000 Index = 127,
- Funcname = myfunction3, Libname = myfunction3, Seqno = 45e27d28, Active = Y
- Count = 0 SVC: Avg = 0.000, MinTime = 0.000, Maxtime = 0.000 CPU: Avg = 0.000,
- MinTime = 0.000, Maxtime = 0.000
The following is the result when [-s] or [-u] options are used:
$ tdlshm -s r
$ tdlshm -s e -m myfunction
$ tdlshm -s d -m myfunction
$ tdlshm -u e -m myfunction
$ tdlshm -u d -m myfunction
The following is the result when [-C] or [-c] options are used:
$ tdlshm -C
$ tdlshm -c 0 1024
$ tdlshm -c 1024
The tdlsync command synchronizes a backup file with a TDL shared memory. This command is necessary when automatic backup is disabled.
Usage
$ tdlsync [-p TDL root directory path] [-B backup file path] [-v | -V] [-h]
Option | Description |
---|---|
[ -p TDL root directory path ] | A TDL root directory. Default value: $TDLDIR or $TMAXDIR. |
[ -B backup file path ] | A backup file path. |
[ -v | -V ] | Shows version information. |
[ -h ] | Shows command Help. |
Example
The following example backs up shared memory with a file specified as a BACKUP in a TDL configuration file <tdl.cfg>:
$ tdlsync
The tdlupdate command updates a specified dynamic module. A library name must be specified with a [-m] option. If a specified library is already registered, the library will be updated. If the library is not registered, it will be added. This command can be executed only in a master node in a multi-node environment.
Usage
$ tdlupdate [-p TDL root directory path] [-x export export function extraction script file path] [-f] [-m library name] [-b] [-c] [-l file name] [-v | -V] [-h]
Option | Description |
---|---|
[ -p TDL root directory path ] | A TDL root directory. Default value: $TDLDIR or $TMAXDIR. |
[ -x export function extraction script file path ] | The path of a script file that extracts an export function. |
[ -f ] | Updates a function by force even if a function with the same name exists in another library when a VERSION is set to 2. |
[ -m library name ] | A library to be updated. |
[ -b ] | Does not backup a shared memory file even if a BACKUP is specified in a TDL configuration file. |
[ -c ] | Executes version synchronization between nodes in a multi-node environment. |
[ -l file name ] | Creates a file that contains a list of modules to be updated, and then updates the modules. The module delimiter is a comma (,) or a newline. |
[ -v | -V ] | Shows version information. |
[ -h ] | Shows command Help. |
Examples
The following updates a <mylibrary.so> file:
$ tdlupdate -m mylibrary
The following updates multiple modules. The delimiter is a comma (,), and spaces are not allowed. There is no limit to the number of modules, but the maximum number is 1024 in a multi-node environment.
$ tdlupdate -m mylibrary,mylibrary2,mylibrary3
The following creates a file that contains a list of modules to be updated, and then updates the modules. There is no limit to the number of modules in the file, but the maximum number is 1024 in a multi-node environment.
$ tdlupdate -l update.list
The following is an <update.list> file. A comma (,) and newline can be used as a delimiter:
mylibrary,mylibrary2 mylibrary3
The following synchronizes nodes when there is an inconsistency in shared memory in a multi-node environment:
$ tdlupdate -c
Note
A script file that extracts an export function is required when a VERSION is set to 4:
/* Example of exp file */ /* dlib.exp */ #! dlib.so TmaxSoft::Airplain Car