xref: /titanic_50/usr/src/cmd/smbsrv/dtrace/smbd-doorsvc.d (revision ed81dd52230eff1a7c7625caad21af232c36f6cb)
1 #!/usr/sbin/dtrace -s
2 /*
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
6  * 1.0 of the CDDL.
7  *
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.
11  */
12 
13 /*
14  * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
15  */
16 
17 /*
18  * User-level dtrace for smbd
19  * Usage: dtrace -s smbd-doorsvc.d -p `pgrep smbd`
20  */
21 
22 #pragma D option flowindent
23 
24 self int trace;
25 self int mask;
26 
27 /*
28  * smbd_door_dispatch_op() is the logical top of smbd door service calls.
29  */
30 pid$target:*smbd:smbd_door_dispatch_op:entry
31 {
32 	self->trace++;
33 }
34 
35 /*
36  * If traced and not masked, print entry/return
37  */
38 pid$target:*smbd::entry,
39 pid$target:libmlsvc.so.1::entry,
40 pid$target:libmlrpc.so.1::entry,
41 pid$target:libsmbns.so.1::entry,
42 pid$target:libsmb.so.1::entry,
43 pid$target:libsmbfs.so.1::entry
44 /self->trace > 0 && self->mask == 0/
45 {
46 	printf("\t0x%x", arg0);
47 	printf("\t0x%x", arg1);
48 	printf("\t0x%x", arg2);
49 	printf("\t0x%x", arg3);
50 	printf("\t0x%x", arg4);
51 	printf("\t0x%x", arg5);
52 }
53 
54 /*
55  * Mask (don't print) all function calls below these functions.
56  * These make many boring, repetitive function calls like
57  * smb_mbtowc, smb_msgbuf_has_space, ...
58  */
59 pid$target::smb_msgbuf_decode:entry,
60 pid$target::smb_msgbuf_encode:entry,
61 pid$target::smb_strlwr:entry,
62 pid$target::smb_strupr:entry,
63 pid$target::smb_wcequiv_strlen:entry
64 {
65 	self->mask++;
66 }
67 
68 /*
69  * Now inverses of above, unwind order.
70  */
71 
72 pid$target::smb_msgbuf_decode:return,
73 pid$target::smb_msgbuf_encode:return,
74 pid$target::smb_strlwr:return,
75 pid$target::smb_strupr:return,
76 pid$target::smb_wcequiv_strlen:return
77 {
78 	self->mask--;
79 }
80 
81 pid$target:*smbd::return,
82 pid$target:libmlsvc.so.1::return,
83 pid$target:libmlrpc.so.1::return,
84 pid$target:libsmbns.so.1::return,
85 pid$target:libsmb.so.1::return,
86 pid$target:libsmbfs.so.1::return
87 /self->trace > 0 && self->mask == 0/
88 {
89 	printf("\t0x%x", arg1);
90 }
91 
92 pid$target:*smbd:smbd_door_dispatch_op:return
93 {
94 	self->trace--;
95 }
96