Saturday, April 2, 2016

truss - trace system calls and signals in Sun Solaris

truss is used
To trace system calls and signals in Sun Solaris:

# truss [-fcaeildD] [ - [tTvx] [!] syscall ,...] [ - [sS] [!] signal ,...] [ - [mM] [!] fault ,...] [ - [rw] [!] fd ,...] [ - [uU] [!] lib ,... : [:] [!] func ,...] [-o outfile] command | -p pid...

where:

-p : interprets the command arguments to truss as a list of process-ids for existing processes rather than as a command to be executed.

-f : follows all children created by fork() or vfork() and includes their signals, faults, and system calls in the trace output.

-c : counts traced system calls, faults, and signals rather than displaying the trace line-by-line. A summary report is produced after the traced command terminates or when truss is interrupted.

-a : shows the argument strings that are passed in each exec() system call.

-e : shows the environment strings that are passed in each exec() system call.

-i : do not display interruptible sleeping system calls.

-l : includes the id of the responsible lightweight process (LWP) with each line of trace output.

-d : includes a time stamp on each line of trace output.

-D : includes a time delta on each line of trace output.

-t : system calls to trace or exclude.

-T : system calls that stop the process.

-v : verbose.

-x : displays the arguments to the specified system calls (if traced by -t) in raw form, usually hexadecimal, rather than symbolically.

-s : signals to trace or exclude.

-S : signals that stop the process.

-m : machine faults to trace or exclude.

-M : machine faults that stop the process.

-r : shows the full contents of the I/O buffer for each read() on any of the specified file descriptors.

-w : shows the contents of the I/O buffer for each write() on any of the specified file descriptors.

-u : user-level function call tracing.

-U : user-level function calls that stop the process.

-o : file to be used for the trace output. By default, the output goes to standard error.

Example trace of the find command:

# truss find . -print >find.out

Example trace of the open, close, read, and write system calls:

# truss -t open,close,read,write find . -print >find.out

Example trace of the spell.sh script on the file truss.out:

# truss -f -o truss.out spell.sh document

Example to verbosely trace the system call activity of process #1, init:

# truss -p -v all 1
Example

truss -p 1234

 # truss -rall -wall -f -p
 # truss -rall -wall lsnrctl start
 # truss -aef lsnrctl dbsnmp_start


truss -p 1234

Unix message files record all system problems like disk errors, swap errors, NFS problems, etc. Monitor the following files on your system to detect system problems:

  # tail -f /var/adm/SYSLOG
  # tail -f /var/adm/messages
  # tail -f /var/log/syslog

No comments :

Post a Comment