xref: /illumos-gate/usr/src/cmd/smbsrv/fksmbd/Watch-fksmb.d (revision 8459c777fc1aaabb2f7dad05de1313aa169417cd)
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 "fksmb$pid" dtrace provider.
18  * Traces all SMB commands using the probes:
19  *	start, done
20  * all of which have two args:
21  *	args[0]: char * (probe-name)
22  *	args[1]: ulong (struct smb_request *)
23  *
24  * Note: the "userland" type classifier causes dtrace to
25  * automatically copyin the struct for us.  (Nice!)
26  */
27 
28 fksmb$target:::smb_start
29 {
30 	this->pn = copyinstr(arg0);
31 	this->sr = (userland pid`smb_request_t *)arg1;
32 
33 	printf(" %s mid=0x%x uid=0x%x tid=0x%x\n",
34 	    this->pn,
35 	    this->sr->smb_mid,
36 	    this->sr->smb_uid,
37 	    this->sr->smb_tid);
38 }
39 
40 fksmb$target:::smb_done
41 {
42 	this->pn = copyinstr(arg0);
43 	this->sr = (userland pid`smb_request_t *)arg1;
44 
45 	printf(" %s mid=0x%x status=0x%x\n",
46 	    this->pn,
47 	    this->sr->smb_mid,
48 	    this->sr->smb_error.status);
49 }
50 
51 fksmb$target:::smb2_start
52 {
53 	this->pn = copyinstr(arg0);
54 	this->sr = (userland pid`smb_request_t *)arg1;
55 
56 	printf(" %s mid=0x%x uid=0x%x tid=0x%x\n",
57 	    this->pn,
58 	    this->sr->smb2_messageid,
59 	    this->sr->smb2_ssnid,
60 	    this->sr->smb_tid);
61 }
62 
63 fksmb$target:::smb2_done
64 {
65 	this->pn = copyinstr(arg0);
66 	this->sr = (userland pid`smb_request_t *)arg1;
67 
68 	printf(" %s mid=0x%x status=0x%x\n",
69 	    this->pn,
70 	    this->sr->smb2_messageid,
71 	    this->sr->smb2_status);
72 }
73