trace_on
Purpose
Checks whether trace channel is enabled.
Library
Run-time Services Library (librts.a)
Syntax
int trace_on (chanmask)
unsigned long chanmask;
Description
The trace_on subroutine queries the application trace
device driver to determine whether a given trace channel
is enabled. trace_on allows a program to avoid the
unnecessary overhead of setting up the trace message when
its trace channel is disabled. trace_on is a C run-time
subroutine and should be used by application programs,
but not by device drivers.
The chanmask parameter is a mask with the bit corre-
sponding to the channel number set. It can be formed by
the expression "(1 << 31 - "channum")". User programs
can use only channel number 31, which means that the
value of chanmask must be "1" for user programs.
Making repeated calls to the trace device driver involves
significant overhead, so call trace_on only once: either
at the start of processing or just before the first trace
point in the program.
If the application trace device driver is not already
open, trace_on opens it.
Upon successful completion, trace_on returns 1 if the
channel is enabled, or 0 if the channel is disabled. If
the trace_on subroutine fails, a message is written to
the standard error output, and a value of -1 is returned.
File
/dev/appltrace
Related Information
In this book: "trcunix," and "trace."
The discussion of trsave in Device Driver Development
Guide.
The trace command in AIX Operating System Commands Refer-
ence.
The discussion of trace in AIX Operating System Program-
ming Tools and Interfaces.