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 2017 Nexenta Systems, Inc. All rights reserved. 15 */ 16 17 /* 18 * User-level dtrace for fksmbcl 19 * Usage: dtrace -s Watch-fksmbcl.d -p $PID 20 */ 21 22 self int trace; 23 24 /* 25 * Trace almost everything 26 */ 27 pid$target:fksmbcl::entry 28 { 29 self->trace++; 30 } 31 32 pid$target:fksmbcl::return 33 { 34 self->trace--; 35 } 36 37 /* 38 * If traced, print entry/return 39 */ 40 pid$target:fksmbcl::entry, 41 pid$target:libsmbfs.so.1::entry, 42 pid$target:libfksmbfs.so.1::entry, 43 pid$target:libfknsmb.so.1::entry, 44 pid$target:libfakekernel.so.1::entry 45 /self->trace > 0/ 46 { 47 printf("\t0x%x", arg0); 48 printf("\t0x%x", arg1); 49 printf("\t0x%x", arg2); 50 printf("\t0x%x", arg3); 51 printf("\t0x%x", arg4); 52 printf("\t0x%x", arg5); 53 } 54 55 pid$target:fksmbcl::return, 56 pid$target:libsmbfs.so.1::return, 57 pid$target:libfksmbfs.so.1::return, 58 pid$target:libfknsmb.so.1::return, 59 pid$target:libfakekernel.so.1::entry 60 /self->trace > 0/ 61 { 62 printf("\t0x%x", arg1); 63 } 64 65 pid$target::smbfslookup:entry 66 { 67 printf("\tname = %s\n", copyinstr(arg1)); 68 } 69 70 pid$target:libfknsmb.so.1:smb_dtrace2:entry 71 /copyinstr(arg0) == "debugmsg2"/ 72 { 73 this->f = copyinstr(arg1); 74 this->m = copyinstr(arg2); 75 printf("\n\t debugmsg2: %s: %s ", this->f, this->m); 76 } 77 78 pid$target:libfknsmb.so.1:smb_dtrace3:entry 79 /copyinstr(arg0) == "debugmsg3"/ 80 { 81 this->f = copyinstr(arg1); 82 this->m = copyinstr(arg2); 83 printf("\n\t debugmsg3: %s: %s ", this->f, this->m); 84 trace(arg3); 85 } 86