Полезная информация

UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: trueChapter 2
UNIX Commands
Next: Reference: tset
 

truss

truss [options] arguments

Trace system calls, signals, and machine faults while executing arguments. arguments is either a UNIX command or, if -p is specified, a list of process IDs representing the processes to run. The options -m, -t, -v, -x, -s, -r, and -w accept a comma-separated list of arguments. A ! reverses the sense of the list, telling truss to ignore those elements of the list during the trace. (In the C shell, use a backslash before !.) The optional ! and corresponding description are shown in brackets.

Options

-a

Display parameters passed by each exec call.

-c

Count the traced items rather than listing them.

-e

Display values of environment variables passed by each exec call.

-f

Follow child processes. Useful for tracing shell scripts.

-i

List sleeping system calls only once, upon completion.

-m[!]faults

Trace [exclude from trace] the list of machine faults. faults are names or numbers, as listed in <sys/fault.h> (default is -mall -m!fltpage).

-o outfile

Send trace output to outfile, not standard error.

-p

Trace one or more process IDs instead of a command.

-r[!]file_descriptors

Display [don't display] the I/O buffer of read system calls for file_descriptors (default is -r!all).

-s[!]signals

Trace [exclude from trace] the list of signals. signals are names or numbers, as listed in <sys/signal.h> (default is -sall).

-t[!]system_calls

Trace [exclude from trace] the list of system_calls. system_calls are names or numbers, as listed in Section 2, "System Calls," of the UNIX Programmer's Reference Manual (default is -tall).

-v[!]system_calls

Verbose mode. Same as -t, but list also the contents of any structures passed to system_calls (default is -v!all).

-w[!]file_descriptors

Display [don't display] the I/O buffer of write system calls for file_descriptors (default is -w!all).

-x[!]system_calls

Same as -t, but display the system call arguments as raw code (hexadecimal) (default is -x!all).

Examples

Trace system calls open and close for lp command:

truss -t open,close lp files > truss.out

Trace the make command, including its child processes, and store the output in make.trace:

truss -f -o make.trace make target


Previous: Reference: trueUNIX in a Nutshell: System V EditionNext: Reference: tset
Reference: trueBook IndexReference: tset

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System