xref: /titanic_51/usr/src/cmd/smbsrv/dtrace/smbsrv.d (revision b3700b074e637f8c6991b70754c88a2cfffb246b)
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  * Developer dtrace program for smbsrv
19  * Usage: dtrace -s smbsrv.d
20  */
21 
22 #pragma D option flowindent
23 
24 self int trace;
25 self int mask;
26 
27 /*
28  * Trace almost everything
29  */
30 fbt:smbsrv::entry
31 {
32 	self->trace++;
33 }
34 
35 /*
36  * If traced and not masked, print entry/return
37  */
38 fbt:smbsrv::entry
39 /self->trace > 0 && self->mask == 0/
40 {
41 	printf("\t0x%x", arg0);
42 	printf("\t0x%x", arg1);
43 	printf("\t0x%x", arg2);
44 	printf("\t0x%x", arg3);
45 	printf("\t0x%x", arg4);
46 	printf("\t0x%x", arg5);
47 }
48 
49 /*
50  * Mask (don't print) all function calls below these functions.
51  * These make many boring, repetitive function calls like
52  * smb_mbtowc, mbc_marshal_...
53  */
54 fbt::smb_mbc_vdecodef:entry,
55 fbt::smb_mbc_vencodef:entry,
56 fbt::smb_msgbuf_decode:entry,
57 fbt::smb_msgbuf_encode:entry,
58 fbt::smb_strlwr:entry,
59 fbt::smb_strupr:entry,
60 fbt::smb_wcequiv_strlen:entry
61 {
62 	self->mask++;
63 }
64 
65 /*
66  * Now inverses of above, unwind order.
67  */
68 
69 fbt::smb_mbc_vdecodef:return,
70 fbt::smb_mbc_vencodef:return,
71 fbt::smb_msgbuf_decode:return,
72 fbt::smb_msgbuf_encode:return,
73 fbt::smb_strlwr:return,
74 fbt::smb_strupr:return,
75 fbt::smb_wcequiv_strlen:return
76 {
77 	self->mask--;
78 }
79 
80 fbt:smbsrv::return
81 /self->trace > 0 && self->mask == 0/
82 {
83 	printf("\t0x%x", arg1);
84 }
85 
86 fbt:smbsrv::return
87 {
88 	self->trace--;
89 }
90