Solaris Application Programming, 1/e - Chapter 4 - Parent Directory
Solaris Application Programming, 1/e - Chapter 4 - Parent Directory
Solaris Application Programming, 1/e - Chapter 4 - Parent Directory
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
4.4 PROCESS- AND PROCESSOR-SPECIFIC TOOLS 81<br />
Example 4.43 Call Count for the ls Command Using truss (continued )<br />
stat .000 1<br />
fstat .000 3<br />
ioctl .000 3<br />
execve .000 1<br />
fcntl .000 1<br />
mmap .000 7<br />
munmap .000 1<br />
memcntl .000 1<br />
resolvepath .000 5<br />
getdents64 .000 3<br />
lstat64 .000 1<br />
fstat64 .000 2<br />
-------- ------ ---sys<br />
totals: .002 87 3<br />
usr time: .001<br />
elapsed: .020<br />
It is also possible to run truss on an existing process. This will generate the same<br />
output as invoking truss on the process initially. This is useful for checking whether<br />
a process is still doing something. Example 4.44 shows the command line to do this.<br />
$ truss -p <br />
Example 4.44 Attaching truss to an Existing Process<br />
It is also possible to use truss to print out the calls within an application. The -u<br />
flag takes the names of the libraries of interest, or a.out to represent the application.<br />
The tool will then report calls made by these modules, as shown in Example 4.45.<br />
Example 4.45 truss Used to Show Calls Made within an <strong>Application</strong><br />
% truss -u a.out bzip2<br />
execve("bzip2", 0xFFBFFB84, 0xFFBFFB8C) argc = 1<br />
-> atexit(0x2be04, 0x44800, 0x0, 0x0)<br />
-> mutex_lock(0x456e8, 0x0, 0x0, 0x0)<br />
-> _return_zero(0x456e8, 0x0, 0x0, 0x0)<br />
mutex_unlock(0x456e8, 0x1, 0x0, 0x0)<br />
-> _return_zero(0x456e8, 0x1, 0x0, 0x0)<br />
_check_threaded(0x44a68, 0x0, 0x0, 0x0)<br />
-> thr_main(0x0, 0x0, 0x0, 0x0)<br />
-> _return_negone(0x0, 0x0, 0x0, 0x0)<br />