Deleted Added
full compact
truss.1 (153963) truss.1 (162792)
1.\" $FreeBSD: head/usr.bin/truss/truss.1 153963 2006-01-02 08:36:25Z brian $
1.\" $FreeBSD: head/usr.bin/truss/truss.1 162792 2006-09-29 15:20:48Z ru $
2.\"
2.\"
3.Dd September 3, 2004
3.Dd January 2, 2004
4.Dt TRUSS 1
5.Os
6.Sh NAME
7.Nm truss
8.Nd trace system calls
9.Sh SYNOPSIS
10.Nm
11.Op Fl faedDS
12.Op Fl o Ar file
13.Op Fl s Ar strsize
14.Fl p Ar pid
15.Nm
16.Op Fl faedDS
17.Op Fl o Ar file
18.Op Fl s Ar strsize
19command
20.Op args
21.Sh DESCRIPTION
22The
23.Nm
24utility traces the system calls called by the specified process or program.
25Output is to the specified output file, or standard error by default.
26It does this by stopping and restarting the process being monitored via
27.Xr procfs 5 .
28.Pp
29The options are as follows:
30.Bl -tag -width indent
31.It Fl f
32Trace descendants of the original traced process created by
33.Xr fork 2 ,
34.Xr vfork 2 ,
35etc.
36.It Fl a
37Show the argument strings that are passed in each
38.Xr execve 2
39system call.
40.It Fl e
41Show the environment strings that are passed in each
42.Xr execve 2
43system call.
44.It Fl d
45Include timestamps in the output showing the time elapsed
46since the trace was started.
47.It Fl D
48Include timestamps in the output showing the time elapsed
49since the last recorded event.
50.It Fl S
51Do not display information about signals received by the process.
52(Normally,
53.Nm
54displays signal as well as system call events.)
55.It Fl o Ar file
56Print the output to the specified
57.Ar file
58instead of standard error.
59.It Fl s Ar strsize
60Display strings using at most
61.Ar strsize
62characters.
63If the buffer is larger,
4.Dt TRUSS 1
5.Os
6.Sh NAME
7.Nm truss
8.Nd trace system calls
9.Sh SYNOPSIS
10.Nm
11.Op Fl faedDS
12.Op Fl o Ar file
13.Op Fl s Ar strsize
14.Fl p Ar pid
15.Nm
16.Op Fl faedDS
17.Op Fl o Ar file
18.Op Fl s Ar strsize
19command
20.Op args
21.Sh DESCRIPTION
22The
23.Nm
24utility traces the system calls called by the specified process or program.
25Output is to the specified output file, or standard error by default.
26It does this by stopping and restarting the process being monitored via
27.Xr procfs 5 .
28.Pp
29The options are as follows:
30.Bl -tag -width indent
31.It Fl f
32Trace descendants of the original traced process created by
33.Xr fork 2 ,
34.Xr vfork 2 ,
35etc.
36.It Fl a
37Show the argument strings that are passed in each
38.Xr execve 2
39system call.
40.It Fl e
41Show the environment strings that are passed in each
42.Xr execve 2
43system call.
44.It Fl d
45Include timestamps in the output showing the time elapsed
46since the trace was started.
47.It Fl D
48Include timestamps in the output showing the time elapsed
49since the last recorded event.
50.It Fl S
51Do not display information about signals received by the process.
52(Normally,
53.Nm
54displays signal as well as system call events.)
55.It Fl o Ar file
56Print the output to the specified
57.Ar file
58instead of standard error.
59.It Fl s Ar strsize
60Display strings using at most
61.Ar strsize
62characters.
63If the buffer is larger,
64.Qq ...
64.Dq Li ...
65will be displayed at the end of the string.
66The default
67.Ar strsize
68is 32.
69.It Fl p Ar pid
70Follow the process specified by
71.Ar pid
72instead of a new command.
73.It Ar command Op args
74Execute
75.Ar command
76and trace the system calls of it.
77(The
78.Fl p
79and
80.Ar command
81options are mutually exclusive.)
82.El
83.Pp
84The
85.Xr procctl 8
86utility can be used to clear tracepoints in a stuck process
87left behind if
88.Nm
89terminates abnormally.
90.Sh EXAMPLES
91# Follow the system calls used in echoing "hello"
92.Dl $ truss /bin/echo hello
93# Do the same, but put the output into a file
94.Dl $ truss -o /tmp/truss.out /bin/echo hello
95# Follow an already-running process
96.Dl $ truss -p 1
97.Sh SEE ALSO
98.Xr kdump 1 ,
99.Xr ktrace 1 ,
100.Xr procfs 5 ,
101.Xr procctl 8
102.Sh HISTORY
103The
104.Nm
105command was written by
106.An Sean Eric Fagan
107for
108.Fx .
109It was modeled after
110similar commands available for System V Release 4 and SunOS.
65will be displayed at the end of the string.
66The default
67.Ar strsize
68is 32.
69.It Fl p Ar pid
70Follow the process specified by
71.Ar pid
72instead of a new command.
73.It Ar command Op args
74Execute
75.Ar command
76and trace the system calls of it.
77(The
78.Fl p
79and
80.Ar command
81options are mutually exclusive.)
82.El
83.Pp
84The
85.Xr procctl 8
86utility can be used to clear tracepoints in a stuck process
87left behind if
88.Nm
89terminates abnormally.
90.Sh EXAMPLES
91# Follow the system calls used in echoing "hello"
92.Dl $ truss /bin/echo hello
93# Do the same, but put the output into a file
94.Dl $ truss -o /tmp/truss.out /bin/echo hello
95# Follow an already-running process
96.Dl $ truss -p 1
97.Sh SEE ALSO
98.Xr kdump 1 ,
99.Xr ktrace 1 ,
100.Xr procfs 5 ,
101.Xr procctl 8
102.Sh HISTORY
103The
104.Nm
105command was written by
106.An Sean Eric Fagan
107for
108.Fx .
109It was modeled after
110similar commands available for System V Release 4 and SunOS.