3 * This file and its contents are supplied under the terms of the
4 * Common Development and Distribution License ("CDDL"), version 1.0.
5 * You may only use this file in accordance with the terms of version
8 * A full copy of the text of the CDDL should have accompanied this
9 * source. A copy of the CDDL is also available via the Internet at
10 * http://www.illumos.org/license/CDDL.
14 * Copyright 2014 Nexenta Systems, Inc. All rights reserved.
18 * User-level dtrace for smbd. Watch everything it does.
19 * Usage: dtrace -s smbd-all.d -p `pgrep smbd`
22 #
pragma D option flowindent
28 * Trace everything in smbd
30 pid
$target
:*smbd
::entry
,
31 pid
$target
:libmlsvc
.so
.1::entry
,
32 pid
$target
:libmlrpc
.so
.1::entry
,
33 pid
$target
:libsmbns
.so
.1::entry
,
34 pid
$target
:libsmb
.so
.1::entry
,
35 pid
$target
:libads
.so
.1::entry
41 * If traced and not masked, print entry/return
43 pid
$target
:*smbd
::entry
,
44 pid
$target
:libmlsvc
.so
.1::entry
,
45 pid
$target
:libmlrpc
.so
.1::entry
,
46 pid
$target
:libsmbns
.so
.1::entry
,
47 pid
$target
:libsmb
.so
.1::entry
,
48 pid
$target
:libads
.so
.1::entry
49 /self
->trace
> 0 && self
->mask
== 0/
51 printf("\t0x%x", arg0
);
52 printf("\t0x%x", arg1
);
53 printf("\t0x%x", arg2
);
54 printf("\t0x%x", arg3
);
55 printf("\t0x%x", arg4
);
56 printf("\t0x%x", arg5
);
60 * Mask (don't print) all function calls below these functions.
61 * These make many boring, repetitive function calls like
62 * smb_mbtowc, smb_msgbuf_has_space, ...
64 * Also, libmlrpc has rather deep call stacks, particularly under
65 * ndr_encode_decode_common(), so this stops traces below there.
66 * Remove that from the mask actions to see the details.
68 pid
$target
::ht_findfirst
:entry
,
69 pid
$target
::ht_findnext
:entry
,
70 pid
$target
::ndr_encode_decode_common
:entry
,
71 pid
$target
::smb_msgbuf_decode
:entry
,
72 pid
$target
::smb_msgbuf_encode
:entry
,
73 pid
$target
::smb_strlwr
:entry
,
74 pid
$target
::smb_strupr
:entry
,
75 pid
$target
::smb_wcequiv_strlen
:entry
81 * Get some of the smbd debug messages, etc.
83 pid
$target
:libsmb
.so
.1:smb_trace
:entry
84 /self
->trace
> 0 && self
->mask
== 0/
86 printf("%s", copyinstr(arg0
));
89 pid
$target
:libsmb
.so
.1:smb_syslog
:entry
90 /self
->trace
> 0 && self
->mask
== 0/
92 printf("%s", copyinstr(arg1
));
95 pid
$target
:libc_hwcap1
.so
.1:syslog
:entry
96 /self
->trace
> 0 && self
->mask
== 0/
98 printf("%s", copyinstr(arg1
));
102 * Now inverses of above, unwind order.
105 pid
$target
::ht_findfirst
:return,
106 pid
$target
::ht_findnext
:return,
107 pid
$target
::ndr_encode_decode_common
:return,
108 pid
$target
::smb_msgbuf_decode
:return,
109 pid
$target
::smb_msgbuf_encode
:return,
110 pid
$target
::smb_strlwr
:return,
111 pid
$target
::smb_strupr
:return,
112 pid
$target
::smb_wcequiv_strlen
:return
117 pid
$target
:*smbd
::return,
118 pid
$target
:libmlsvc
.so
.1::return,
119 pid
$target
:libmlrpc
.so
.1::return,
120 pid
$target
:libsmbns
.so
.1::return,
121 pid
$target
:libsmb
.so
.1::return,
122 pid
$target
:libads
.so
.1::return
123 /self
->trace
> 0 && self
->mask
== 0/
125 printf("\t0x%x", arg1
);
128 pid
$target
:*smbd
::return,
129 pid
$target
:libmlsvc
.so
.1::return,
130 pid
$target
:libmlrpc
.so
.1::return,
131 pid
$target
:libsmbns
.so
.1::return,
132 pid
$target
:libsmb
.so
.1::return,
133 pid
$target
:libads
.so
.1::return