HP 9000 Networking XTI Programmer's Guide

40
API Tracing Using Environment Variables
Enable API Tracing
API tracing for XTI also allows you to control tracing via environment
variables. When using this method, you do not need to write any special
code in your application to take advantage of API tracing.
The following is an example of this mechanism for XTI:
% XTI_TRACE=io; export XTI_TRACE
% active -L foo -N addr -R zzz
Fri Oct 9 10:43:06 1992 - t_open()
name = "/dev/ositpi"
oflag = 0x2
tinfo->addr = 55
tinfo->options = 160
tinfo->tsdu = -1
tinfo->etsdu = 16
tinfo->connect = 32
tinfo->discon = 64
tinfo->servtype = 1
Fri Oct 9 10:43:07 1992 t_open() = 3
t_open: OK
Fri Oct 9 10:43:07 1992 - t_alloc()
fd = 3
fields = 0x1
struct_type = T_BIND
Fri Oct 9 10:43:07 1992 t_alloc() = 0x400038D8
....
This example shows the environment variable, XTI_TRACE, being set to
the ASCII characters "io" (meaning input and output parameters). For
csh(1) users the setenv(1) command should be used. The program is then
invoked and the API tracing is automatically enabled to the level specified in
the environment variable.
The program shown does not require any special user code for handling the
environment variables, or controlling the API tracing global variables. The
mechanism works by having the XTI library itself test the environment
variables on the first valid XTI call (always t_open) and then set the global
API trace variables according to the value of the environment variables. If
no environment variables are present, then no API tracing takes place.