TRACE(4,F) AIX Technical Reference TRACE(4,F)
-------------------------------------------------------------------------------
trace
PURPOSE
Supports the event-tracing device driver.
SYNOPSIS
#include <sys/trace.h>
DESCRIPTION
The /dev/unixtrace and /dev/appltrace files are special files that allow event
records generated within the kernel or application programs to be passed to a
user program so that the activity of a driver or other system routines can be
monitored for debugging purposes. They are found in all AIX systems.
The trace driver supports open, close, read, and ioctl system calls. The ioctl
system call is invoked as follows:
#include <sys/trace.h>
ioctl(fildes, cmd, &arg);
int fildes, cmd;
struct tr_struct {
unsigned operation; /* TRCSET or TRCRSET */
unsigned channels; /* enabled channels */
ushort entsize; /* reserved */
struct trace_event * bufaddr; /* reserved */
ulong bufsize; /* buffer size to use */
union { /* reserved */
ushort vm_quit;
struct {
char vmid;
unsigned intr_on_quit : 1;
unsigned mpx_no : 7;
} xvf;
} vf;
} arg;
Valid values of the cmd parameter are:
TRCSETC Sets trace parameters. If operation is TRCSET, then this command
instructs the driver to use the parameters provided in structure arg
to enable tracing. bufsize indicates the size of the buffer to
allocate (in number of 1K blocks) and cannot be changed once it is
set. The channels field is a bit map indicating active and inactive
channels. As an example, bit 0 corresponds to channel 31, bit 1
corresponds to channel 30, and bit 31 corresponds to channel 0. If
Processed November 7, 1990 TRACE(4,F) 1
TRACE(4,F) AIX Technical Reference TRACE(4,F)
operation is TRCRSET, then this command instructs the driver to
disable all tracing.
TRCGETC Returns the current status of the trace in the structure indicated by
arg.
The records returned from the trace device are structures with the following
format:
struct trace_event {
time_t stamp; /* time stamp */
short timeext; /* time stamp extension */
short seqno[2]; /* two 16-bit sequence number digits */
short hookid; /* channel no. and trace event code */
unsigned pid; /* process id */
short iodn; /* always -1 */
short iocn; /* always -1 */
union {
char xcdata[20]; /* more data, depending on code */
int xidata[5];
} xdata;
};
The following subchannels are assigned:
Channel
Number Assignment
22 Process system calls (acct, alarm, brk, exec, fork, fstat, getgid,
getgroups, getpid, getuid, kill, lockf, nice, pause, pipe, plock,
profil, ptrace, reboot, setgid, setgroups, setpgrp, setuid, times,
ulimit, usrinfo, wait)
23 Directory handling system calls (chdir, chroot, link, mknod,
unlink)
24 I/O system calls (access, chmod, chown, close, creat, dup, fclear,
fcntl, fsync, ftrunc, ioctl, lseek, open, read, umask, uname,
utime, write)
25 File system system calls (mount, stat, sync, ustat, umount)
26 Time system calls (stime, time)
27 Signal system calls (signal, sigblock, sigpause, sigsetmask,
sigstack, sigvec)
28 Semaphore system calls (semctl, semget, semop)
29 Message system calls (msgctl, msgget, msgop)
Processed November 7, 1990 TRACE(4,F) 2
TRACE(4,F) AIX Technical Reference TRACE(4,F)
Channel
Number Assignment
30 Shared memory system calls (shmctl, shmget, shmop)
31 User-defined events
FILES
/dev/unixtrace
/dev/appltrace
RELATED INFORMATION
In this book: "trace_on," "trcunix," and "rasconf."
The trace command in AIX Operating System Commands Reference.
The discussion of trace in AIX Programming Tools and Interfaces.
Processed November 7, 1990 TRACE(4,F) 3