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 2018 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 /*
  23  * If traced, print entry/return
  24  */
  25 pid$target:fksmbcl::entry,
  26 pid$target:libsmbfs.so.1::entry,
  27 pid$target:libfksmbfs.so.1::entry,
  28 pid$target:libfknsmb.so.1::entry,
  29 pid$target:libfakekernel.so.1::entry
  30 {
  31   printf("\t0x%x", arg0);
  32   printf("\t0x%x", arg1);
  33   printf("\t0x%x", arg2);
  34   printf("\t0x%x", arg3);
  35   printf("\t0x%x", arg4);
  36   printf("\t0x%x", arg5);
  37 }
  38 
  39 pid$target:fksmbcl::return,
  40 pid$target:libsmbfs.so.1::return,
  41 pid$target:libfksmbfs.so.1::return,
  42 pid$target:libfknsmb.so.1::return,
  43 pid$target:libfakekernel.so.1::entry
  44 {
  45   printf("\t0x%x", arg1);
  46 }
  47 
  48 pid$target::smbfslookup:entry
  49 {
  50         printf("\tname = %s\n", copyinstr(arg1));
  51 }
  52 
  53 pid$target:libfknsmb.so.1:smb_dtrace2:entry
  54 /copyinstr(arg0) == "debugmsg2"/
  55 {
  56         this->f = copyinstr(arg1);
  57         this->m = copyinstr(arg2);
  58         printf("\n\t debugmsg2: %s: %s ", this->f, this->m);
  59 }
  60 
  61 pid$target:libfknsmb.so.1:smb_dtrace3:entry
  62 /copyinstr(arg0) == "debugmsg3"/
  63 {
  64         this->f = copyinstr(arg1);
  65         this->m = copyinstr(arg2);
  66         printf("\n\t debugmsg3: %s: %s ", this->f, this->m);
  67         trace(arg3);
  68 }