xref: /titanic_44/usr/src/cmd/smbsrv/dtrace/cifs.d (revision 96d9f183facd90dbbc2268c9a51689be0b6a0b46)
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 2010 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*
28 #pragma D option flowindent
29 */
30 
31 /*
32  * Usage:	./cifs.d -p `pgrep smbd`
33  *
34  * On multi-processor systems, it may be easier to follow the output
35  * if run on a single processor: see psradm.  For example, to disable
36  * the second processor on a dual-processor system:	psradm -f 1
37  */
38 
39 BEGIN
40 {
41 	printf("CIFS Trace Started");
42 	printf("\n\n");
43 }
44 
45 END
46 {
47 	printf("CIFS Trace Ended");
48 	printf("\n\n");
49 }
50 
51 sdt:smbsrv::-smb_op*-start
52 {
53 	sr = (struct smb_request *)arg0;
54 
55 	printf("cmd=%d [uid=%d tid=%d]",
56 	    sr->smb_com, sr->smb_uid, sr->smb_tid);
57 
58 	self->status = 0;
59 }
60 
61 sdt:smbsrv::-smb_op*-done
62 {
63 	sr = (struct smb_request *)arg0;
64 
65 	printf("cmd[%d]: status=0x%08x (class=%d code=%d)",
66 	    sr->smb_com, sr->smb_error.status,
67 	    sr->smb_error.errcls, sr->smb_error.errcode);
68 
69 	self->status = sr->smb_error.status;
70 }
71 
72 sdt:smbsrv::-smb_op-SessionSetupX-start
73 {
74 	sr = (struct smb_request *)arg0;
75 
76 	printf("[%s] %s",
77 	    (sr->session->s_local_port == 139) ? "NBT" : "TCP",
78 	    (sr->session->s_local_port == 139) ?
79 	    stringof(sr->session->workstation) : "");
80 }
81 
82 sdt:smbsrv::-smb_op-SessionSetupX-done,
83 sdt:smbsrv::-smb_op-LogoffX-start
84 {
85 	sr = (struct smb_request *)arg0;
86 
87 	printf("uid %d: %s/%s", sr->smb_uid,
88 	    stringof(sr->uid_user->u_domain),
89 	    stringof(sr->uid_user->u_name));
90 }
91 
92 sdt:smbsrv::-smb_op-TreeConnectX-start
93 {
94 	tcon = (struct tcon *)arg1;
95 
96 	printf("[%s] %s",
97                 stringof(tcon->service),
98                 stringof(tcon->path));
99 }
100 
101 sdt:smbsrv::-smb_op-TreeConnectX-done,
102 sdt:smbsrv::-smb_op-TreeDisconnect-start
103 {
104 	sr = (struct smb_request *)arg0;
105 
106 	printf("tid %d: %s", sr->smb_tid,
107 	    stringof(sr->tid_tree->t_sharename));
108 	discard(self->status);
109 }
110 
111 sdt:smbsrv::-smb_op-Open-start,
112 sdt:smbsrv::-smb_op-OpenX-start,
113 sdt:smbsrv::-smb_op-Create-start,
114 sdt:smbsrv::-smb_op-CreateNew-start,
115 sdt:smbsrv::-smb_op-CreateTemporary-start,
116 sdt:smbsrv::-smb_op-CreateDirectory-start,
117 sdt:smbsrv::-smb_op-NtCreateX-start,
118 sdt:smbsrv::-smb_op-NtTransactCreate-start
119 {
120 	op =  (struct open_param *)arg1;
121 
122 	printf("%s", stringof(op->fqi.fq_path.pn_path));
123 }
124 
125 sdt:smbsrv::-smb_op-Open-done,
126 sdt:smbsrv::-smb_op-OpenX-done,
127 sdt:smbsrv::-smb_op-Create-done,
128 sdt:smbsrv::-smb_op-CreateNew-done,
129 sdt:smbsrv::-smb_op-CreateTemporary-done,
130 sdt:smbsrv::-smb_op-CreateDirectory-done,
131 sdt:smbsrv::-smb_op-NtCreateX-done,
132 sdt:smbsrv::-smb_op-NtTransactCreate-done
133 {
134 	sr = (struct smb_request *)arg0;
135 
136 	printf("%s: fid=%u",
137 	    stringof(sr->arg.open.fqi.fq_path.pn_path), sr->smb_fid);
138 }
139 
140 sdt:smbsrv::-smb_op-Read-start,
141 sdt:smbsrv::-smb_op-LockAndRead-start,
142 sdt:smbsrv::-smb_op-ReadX-start,
143 sdt:smbsrv::-smb_op-ReadRaw-start,
144 sdt:smbsrv::-smb_op-Write-start,
145 sdt:smbsrv::-smb_op-WriteAndClose-start,
146 sdt:smbsrv::-smb_op-WriteAndUnlock-start,
147 sdt:smbsrv::-smb_op-WriteX-start,
148 sdt:smbsrv::-smb_op-WriteRaw-start
149 {
150 	sr = (struct smb_request *)arg0;
151 	rw =  (smb_rw_param_t *)arg1;
152 
153 	printf("fid=%d: %u bytes at offset %u",
154 	    sr->smb_fid, rw->rw_count, rw->rw_offset);
155 }
156 
157 sdt:smbsrv::-smb_op-Read-done,
158 sdt:smbsrv::-smb_op-LockAndRead-done,
159 sdt:smbsrv::-smb_op-ReadX-done,
160 sdt:smbsrv::-smb_op-ReadRaw-done
161 /self->status == 0/
162 {
163 	sr = (struct smb_request *)arg0;
164 	rw =  (smb_rw_param_t *)arg1;
165 
166 	printf("fid=%d: %u bytes at offset %u",
167 	    sr->smb_fid, rw->rw_count, rw->rw_offset);
168 }
169 
170 sdt:smbsrv::-smb_op-Rename-start
171 {
172 	p = (struct dirop *)arg1;
173 
174 	printf("%s to %s",
175 	     stringof(p->fqi.fq_path.pn_path),
176 		 stringof(p->dst_fqi.fq_path.pn_path));
177 }
178 
179 sdt:smbsrv::-smb_op-CheckDirectory-start,
180 sdt:smbsrv::-smb_op-CreateDirectory-start,
181 sdt:smbsrv::-smb_op-DeleteDirectory-start,
182 sdt:smbsrv::-smb_op-Delete-start
183 {
184 	p = (struct dirop *)arg1;
185 
186 	printf("%s", stringof(p->fqi.fq_path.pn_path));
187 }
188 
189 /*
190 smb_dispatch_request:entry,
191 smb_dispatch_request:return,
192 smb_pre_*:return,
193 smb_com_*:return,
194 smb_post_*:return,
195 smbsr_error:return,
196 smbsr_errno:return
197 {
198 }
199 
200 smb_pre_*:entry,
201 smb_com_*:entry,
202 smb_post_*:entry
203 {
204 	sr = (struct smb_request *)arg0;
205 
206 	printf("cmd=%d [uid=%d tid=%d]",
207 	    sr->smb_com, sr->smb_uid, sr->smb_tid);
208 }
209 
210 smbsr_error:entry
211 {
212     printf("status=0x%08x class=%d, code=%d\n", arg1, arg2, arg3);
213 }
214 
215 smbsr_errno:entry
216 {
217     printf("errno=%d\n", arg1);
218 }
219 */
220