1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
6 *
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
10 */
11
12 /*
13 * Copyright 2017 Nexenta Systems, Inc. All rights reserved.
14 */
15
16 /*
17 * Example using the "smb" dtrace provider.
18 * Traces all SMB commands.
19 *
20 * All these probes provide:
21 * args[0] conninfo_t
22 * args[1] smbopinfo_t
23 * Some also provide one of: (not used here)
24 * args[2] smb_name_args_t
25 * args[2] smb_open_args_t
26 * args[2] smb_rw_args_t
27 */
28
29 /*
30 * Unfortunately, trying to write this as:
31 * smb:::op-*-start {}
32 * smb:::op-*-done {}
33 * fails to compile with this complaint:
34 * dtrace: failed to compile script smb-trace.d: line 42:
35 * args[ ] may not be referenced because probe description
36 * smb:::op-*-start matches an unstable set of probes
37 *
38 * Not clear why listing them all is necessary,
39 * but that works.
40 */
41
42 smb:::op-CheckDirectory-start,
43 smb:::op-Close-start,
44 smb:::op-CloseAndTreeDisconnect-start,
45 smb:::op-ClosePrintFile-start,
46 smb:::op-Create-start,
47 smb:::op-CreateDirectory-start,
48 smb:::op-CreateNew-start,
49 smb:::op-CreateTemporary-start,
50 smb:::op-Delete-start,
51 smb:::op-DeleteDirectory-start,
52 smb:::op-Echo-start,
53 smb:::op-Find-start,
54 smb:::op-FindClose-start,
55 smb:::op-FindClose2-start,
56 smb:::op-FindUnique-start,
57 smb:::op-Flush-start,
58 smb:::op-GetPrintQueue-start,
59 smb:::op-Invalid-start,
60 smb:::op-Ioctl-start,
61 smb:::op-LockAndRead-start,
62 smb:::op-LockByteRange-start,
63 smb:::op-LockingX-start,
64 smb:::op-LogoffX-start,
65 smb:::op-Negotiate-start,
66 smb:::op-NtCancel-start,
67 smb:::op-NtCreateX-start,
68 smb:::op-NtRename-start,
69 smb:::op-NtTransact-start,
70 smb:::op-NtTransactCreate-start,
71 smb:::op-NtTransactSecondary-start,
72 smb:::op-Open-start,
73 smb:::op-OpenPrintFile-start,
74 smb:::op-OpenX-start,
75 smb:::op-ProcessExit-start,
76 smb:::op-QueryInformation-start,
77 smb:::op-QueryInformation2-start,
78 smb:::op-QueryInformationDisk-start,
79 smb:::op-Read-start,
80 smb:::op-ReadRaw-start,
81 smb:::op-ReadX-start,
82 smb:::op-Rename-start,
83 smb:::op-Search-start,
84 smb:::op-Seek-start,
85 smb:::op-SessionSetupX-start,
86 smb:::op-SetInformation-start,
87 smb:::op-SetInformation2-start,
88 smb:::op-Transaction-start,
89 smb:::op-Transaction2-start,
90 smb:::op-Transaction2Secondary-start,
91 smb:::op-TransactionSecondary-start,
92 smb:::op-TreeConnect-start,
93 smb:::op-TreeConnectX-start,
94 smb:::op-TreeDisconnect-start,
95 smb:::op-UnlockByteRange-start,
96 smb:::op-Write-start,
97 smb:::op-WriteAndClose-start,
98 smb:::op-WriteAndUnlock-start,
99 smb:::op-WritePrintFile-start,
100 smb:::op-WriteRaw-start,
101 smb:::op-WriteX-start
102 {
103 printf("clnt=%s mid=0x%x uid=0x%x tid=0x%x\n",
104 args[0]->ci_remote,
105 args[1]->soi_mid,
106 args[1]->soi_uid,
107 args[1]->soi_tid);
108 }
109
110
111 smb:::op-CheckDirectory-done,
112 smb:::op-Close-done,
113 smb:::op-CloseAndTreeDisconnect-done,
114 smb:::op-ClosePrintFile-done,
115 smb:::op-Create-done,
116 smb:::op-CreateDirectory-done,
117 smb:::op-CreateNew-done,
118 smb:::op-CreateTemporary-done,
119 smb:::op-Delete-done,
120 smb:::op-DeleteDirectory-done,
121 smb:::op-Echo-done,
122 smb:::op-Find-done,
123 smb:::op-FindClose-done,
124 smb:::op-FindClose2-done,
125 smb:::op-FindUnique-done,
126 smb:::op-Flush-done,
127 smb:::op-GetPrintQueue-done,
128 smb:::op-Invalid-done,
129 smb:::op-Ioctl-done,
130 smb:::op-LockAndRead-done,
131 smb:::op-LockByteRange-done,
132 smb:::op-LockingX-done,
133 smb:::op-LogoffX-done,
134 smb:::op-Negotiate-done,
135 smb:::op-NtCancel-done,
136 smb:::op-NtCreateX-done,
137 smb:::op-NtRename-done,
138 smb:::op-NtTransact-done,
139 smb:::op-NtTransactCreate-done,
140 smb:::op-NtTransactSecondary-done,
141 smb:::op-Open-done,
142 smb:::op-OpenPrintFile-done,
143 smb:::op-OpenX-done,
144 smb:::op-ProcessExit-done,
145 smb:::op-QueryInformation-done,
146 smb:::op-QueryInformation2-done,
147 smb:::op-QueryInformationDisk-done,
148 smb:::op-Read-done,
149 smb:::op-ReadRaw-done,
150 smb:::op-ReadX-done,
151 smb:::op-Rename-done,
152 smb:::op-Search-done,
153 smb:::op-Seek-done,
154 smb:::op-SessionSetupX-done,
155 smb:::op-SetInformation-done,
156 smb:::op-SetInformation2-done,
157 smb:::op-Transaction-done,
158 smb:::op-Transaction2-done,
159 smb:::op-Transaction2Secondary-done,
160 smb:::op-TransactionSecondary-done,
161 smb:::op-TreeConnect-done,
162 smb:::op-TreeConnectX-done,
163 smb:::op-TreeDisconnect-done,
164 smb:::op-UnlockByteRange-done,
165 smb:::op-Write-done,
166 smb:::op-WriteAndClose-done,
167 smb:::op-WriteAndUnlock-done,
168 smb:::op-WritePrintFile-done,
169 smb:::op-WriteRaw-done,
170 smb:::op-WriteX-done
171 {
172 printf("clnt=%s mid=0x%x status=0x%x\n",
173 args[0]->ci_remote,
174 args[1]->soi_mid,
175 args[1]->soi_status);
176 }