TRACE(4) — UNIX 3.0
NAME
trace − event-tracing driver
DESCRIPTION
Trace is a special file that allows UNIX kernel drivers to transfer event records to a user program, so that the activity of the driver may be monitored for debugging purposes.
An event record is generated from within a kernel driver by executing the following function:
trsave(dev, chno, buf, cnt)
chardev, chno, ∗buf, cnt;
Dev is the minor device number of the trace driver; chno is an integer between 1 and 16, inclusive, identifying the data stream to which the record belongs; buf is a buffer containing the bytes that make up a single event record; and cnt is the number of bytes in buf. Calls to trsave will result in data being saved in a clist buffer, provided that some user program has opened the trace minor device number dev and has activated channel chno. Event records prefaced by chno and cnt are stored in a clist queue until a system-defined maximum ( TRQMAX) is reached; event records are discarded while the queue is full. The clist queue is emptied by a user program reading the trace driver. The trace driver returns an integral number of event records; the read count must, therefore, be at least equal to the size of a record plus two, to allow for the chno and cnt bytes added to the event record by the trsave routine.
The trace driver supports open, close, read, and ioctl system calls. To activate a channel, ioctl is used as follows:
#include <ioctl.h>
ioctl(fildes, VPMTRCO, chno)
SEE ALSO
May 16, 1980