xref: /titanic_41/usr/src/cmd/smbsrv/dtrace/cifs.d (revision 581cede61ac9c14d8d4ea452562a567189eead78)
1 #!/usr/sbin/dtrace -s
2 /*
3  * CDDL HEADER START
4  *
5  * The contents of this file are subject to the terms of the
6  * Common Development and Distribution License (the "License").
7  * You may not use this file except in compliance with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #pragma ident	"%Z%%M%	%I%	%E% SMI"
28 
29 /*
30 #pragma D option flowindent
31 */
32 
33 /*
34  * Usage:	./cifs.d -p `pgrep smbd`
35  *
36  * On multi-processor systems, it may be easier to follow the output
37  * if run on a single processor: see psradm.  For example, to disable
38  * the second processor on a dual-processor system:	psradm -f 1
39  */
40 
41 BEGIN
42 {
43 	printf("CIFS Trace Started");
44 	printf("\n\n");
45 }
46 
47 END
48 {
49 	printf("CIFS Trace Ended");
50 	printf("\n\n");
51 }
52 
53 sdt:smbsrv::-smb_op*-start
54 {
55 	sr = (struct smb_request *)arg0;
56 
57 	printf("cmd=%d [uid=%d tid=%d]",
58 	    sr->smb_com, sr->smb_uid, sr->smb_tid);
59 
60 	self->status = 0;
61 }
62 
63 sdt:smbsrv::-smb_op*-done
64 {
65 	sr = (struct smb_request *)arg0;
66 
67 	printf("cmd[%d]: status=0x%08x (class=%d code=%d)",
68 	    sr->smb_com, sr->smb_error.status,
69 	    sr->smb_error.errcls, sr->smb_error.errcode);
70 
71 	self->status = sr->smb_error.status;
72 }
73 
74 sdt:smbsrv::-smb_op-SessionSetupX-start
75 {
76 	sr = (struct smb_request *)arg0;
77 
78 	printf("[%s] %s",
79 	    (sr->session->s_local_port == 139) ? "NBT" : "TCP",
80 	    (sr->session->s_local_port == 139) ?
81 	    stringof(sr->session->workstation) : "");
82 }
83 
84 sdt:smbsrv::-smb_op-SessionSetupX-done,
85 sdt:smbsrv::-smb_op-LogoffX-start
86 {
87 	sr = (struct smb_request *)arg0;
88 
89 	printf("uid %d: %s/%s", sr->smb_uid,
90 	    stringof(sr->uid_user->u_domain),
91 	    stringof(sr->uid_user->u_name));
92 }
93 
94 sdt:smbsrv::-smb_op-TreeConnectX-start
95 {
96 	tcon = (struct tcon *)arg1;
97 
98 	printf("[%s] %s",
99                 stringof(tcon->service),
100                 stringof(tcon->path));
101 }
102 
103 sdt:smbsrv::-smb_op-TreeConnectX-done,
104 sdt:smbsrv::-smb_op-TreeDisconnect-start
105 {
106 	sr = (struct smb_request *)arg0;
107 
108 	printf("tid %d: %s", sr->smb_tid,
109 	    stringof(sr->tid_tree->t_sharename));
110 	discard(self->status);
111 }
112 
113 sdt:smbsrv::-smb_op-Open-start,
114 sdt:smbsrv::-smb_op-OpenX-start,
115 sdt:smbsrv::-smb_op-Create-start,
116 sdt:smbsrv::-smb_op-CreateNew-start,
117 sdt:smbsrv::-smb_op-CreateTemporary-start,
118 sdt:smbsrv::-smb_op-CreateDirectory-start,
119 sdt:smbsrv::-smb_op-NtCreateX-start,
120 sdt:smbsrv::-smb_op-NtTransactCreate-start
121 {
122 	op =  (struct open_param *)arg1;
123 
124 	printf("%s", stringof(op->fqi.path));
125 }
126 
127 sdt:smbsrv::-smb_op-Open-done,
128 sdt:smbsrv::-smb_op-OpenX-done,
129 sdt:smbsrv::-smb_op-Create-done,
130 sdt:smbsrv::-smb_op-CreateNew-done,
131 sdt:smbsrv::-smb_op-CreateTemporary-done,
132 sdt:smbsrv::-smb_op-CreateDirectory-done,
133 sdt:smbsrv::-smb_op-NtCreateX-done,
134 sdt:smbsrv::-smb_op-NtTransactCreate-done
135 {
136 	sr = (struct smb_request *)arg0;
137 
138 	printf("%s: fid=%u",
139 	    stringof(sr->arg.open.fqi.path), sr->smb_fid);
140 }
141 
142 sdt:smbsrv::-smb_op-Read-start,
143 sdt:smbsrv::-smb_op-LockAndRead-start,
144 sdt:smbsrv::-smb_op-ReadX-start,
145 sdt:smbsrv::-smb_op-ReadRaw-start,
146 sdt:smbsrv::-smb_op-Write-start,
147 sdt:smbsrv::-smb_op-WriteAndClose-start,
148 sdt:smbsrv::-smb_op-WriteAndUnlock-start,
149 sdt:smbsrv::-smb_op-WriteX-start,
150 sdt:smbsrv::-smb_op-WriteRaw-start
151 {
152 	sr = (struct smb_request *)arg0;
153 	rw =  (smb_rw_param_t *)arg1;
154 
155 	printf("fid=%d: %u bytes at offset %u",
156 	    sr->smb_fid, rw->rw_count, rw->rw_offset);
157 }
158 
159 sdt:smbsrv::-smb_op-Read-done,
160 sdt:smbsrv::-smb_op-LockAndRead-done,
161 sdt:smbsrv::-smb_op-ReadX-done,
162 sdt:smbsrv::-smb_op-ReadRaw-done
163 /self->status == 0/
164 {
165 	sr = (struct smb_request *)arg0;
166 	rw =  (smb_rw_param_t *)arg1;
167 
168 	printf("fid=%d: %u bytes at offset %u",
169 	    sr->smb_fid, rw->rw_count, rw->rw_offset);
170 }
171 
172 sdt:smbsrv::-smb_op-Rename-start
173 {
174 	p = (struct dirop *)arg1;
175 
176 	printf("%s to %s",
177 	     stringof(p->fqi.path), stringof(p->dst_fqi.path));
178 }
179 
180 sdt:smbsrv::-smb_op-CheckDirectory-start,
181 sdt:smbsrv::-smb_op-CreateDirectory-start,
182 sdt:smbsrv::-smb_op-DeleteDirectory-start,
183 sdt:smbsrv::-smb_op-Delete-start
184 {
185 	p = (struct dirop *)arg1;
186 
187 	printf("%s", stringof(p->fqi.path));
188 }
189 
190 /*
191 smb_dispatch_request:entry,
192 smb_dispatch_request:return,
193 smb_pre_*:return,
194 smb_com_*:return,
195 smb_post_*:return,
196 smbsr_error:return,
197 smbsr_errno:return
198 {
199 }
200 
201 smb_pre_*:entry,
202 smb_com_*:entry,
203 smb_post_*:entry
204 {
205 	sr = (struct smb_request *)arg0;
206 
207 	printf("cmd=%d [uid=%d tid=%d]",
208 	    sr->smb_com, sr->smb_uid, sr->smb_tid);
209 }
210 
211 smbsr_error:entry
212 {
213     printf("status=0x%08x class=%d, code=%d\n", arg1, arg2, arg3);
214 }
215 
216 smbsr_errno:entry
217 {
218     printf("errno=%d\n", arg1);
219 }
220 */
221