Print this page
NEX-16818 Add fksmbcl development tool
NEX-17264 SMB client test tp_smbutil_013 fails after NEX-14666
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Matt Barden <matt.barden@nexenta.com>
and: (fix ref leaks)
NEX-5665 SMB2 oplock leases
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-5665 SMB2 oplock leases
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Evan Layton <evan.layton@nexenta.com>
Reviewed by: Roman Strashkin <roman.strashkin@nexenta.com>
NEX-5566 libsqlite always rebuilds after illumos 6648
Reviewed by: Steve Peng <steve.peng@nexenta.com>
NEX-5357 recursive mutex detection in libfakekernel
Reviewed by: Matt Barden <matt.barden@nexenta.com>
NEX-4083 Upstream changes from illumos 5917 and 5995
Reviewed by: Matt Barden <matt.barden@nexenta.com>
Reviewed by: Kevin Crowe <kevin.crowe@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
SMB-70 Hang during boot after SMB-50
SMB-50 User-mode SMB server
 Includes work by these authors:
 Thomas Keiser <thomas.keiser@nexenta.com>
 Albert Lee <trisk@nexenta.com>


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2012 by Delphix. All rights reserved.
  24  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  25  * Copyright 2017 RackTop Systems.
  26  */
  27 
  28 #include <sys/param.h>
  29 #include <sys/types.h>
  30 #include <sys/varargs.h>
  31 #include <sys/systm.h>
  32 #include <sys/cmn_err.h>
  33 #include <sys/log.h>
  34 
  35 #include <fakekernel.h>
  36 
  37 void    abort(void) __NORETURN;

  38 
  39 char *volatile panicstr;
  40 va_list  panicargs;
  41 char panicbuf[512];
  42 
  43 volatile int aok;
  44 
  45 static const int
  46 ce_flags[CE_IGNORE] = { SL_NOTE, SL_NOTE, SL_WARN, SL_FATAL };
  47 static const char
  48 ce_prefix[CE_IGNORE][10] = { "", "NOTICE: ", "WARNING: ", "" };
  49 static const char
  50 ce_suffix[CE_IGNORE][2] = { "", "\n", "\n", "" };
  51 
  52 
  53 /*
  54  * This function is just a stub, exported NODIRECT so that
  55  * comsumers like fksmbd can provide their own.
  56  * (One that actually prints the messages.)
  57  *


  82 
  83         if (strchr("^!?", fmt[0]) != NULL) {
  84                 if (fmt[0] == '^')
  85                         flags |= SL_CONSONLY;
  86                 else if (fmt[0] == '!')
  87                         flags |= SL_LOGONLY;
  88                 fmt++;
  89         }
  90 
  91         bufend = bufp + bufsize;
  92         msgp = bufp;
  93         msgp += snprintf(msgp, bufend - msgp, "[fake_kernel] ");
  94         msgp += snprintf(msgp, bufend - msgp, prefix);
  95         msgp += vsnprintf(msgp, bufend - msgp, fmt, adx);
  96         msgp += snprintf(msgp, bufend - msgp, suffix);
  97         len = msgp - bufp;
  98 
  99         fakekernel_putlog(bufp, len, flags);
 100 }
 101 


















 102 /*
 103  * "User-level crash dump", if you will.
 104  */
 105 void
 106 vpanic(const char *fmt, va_list adx)
 107 {
 108         va_list tmpargs;
 109 
 110         panicstr = (char *)fmt;
 111         va_copy(panicargs, adx);
 112 
 113         va_copy(tmpargs, adx);
 114         fakekernel_cprintf(fmt, tmpargs, SL_FATAL, "fatal: ", "\n");
 115 
 116         /* Call libc`assfail() so that mdb ::status works */
 117         (void) vsnprintf(panicbuf, sizeof (panicbuf), fmt, adx);
 118         assfail(panicbuf, "(panic)", 0);

 119 
 120         abort();        /* avoid "noreturn" warnings */
 121 }
 122 
 123 void
 124 panic(const char *fmt, ...)
 125 {
 126         va_list adx;
 127 
 128         va_start(adx, fmt);
 129         vpanic(fmt, adx);
 130         va_end(adx);
 131 }
 132 
 133 void
 134 fm_panic(const char *fmt, ...)
 135 {
 136         va_list adx;
 137 
 138         va_start(adx, fmt);


 145 {
 146 
 147         if (ce == CE_PANIC)
 148                 vpanic(fmt, adx);
 149         if (ce >= CE_IGNORE)
 150                 return;
 151 
 152         fakekernel_cprintf(fmt, adx, ce_flags[ce] | SL_CONSOLE,
 153             ce_prefix[ce], ce_suffix[ce]);
 154 }
 155 
 156 /*PRINTFLIKE2*/
 157 void
 158 cmn_err(int ce, const char *fmt, ...)
 159 {
 160         va_list adx;
 161 
 162         va_start(adx, fmt);
 163         vcmn_err(ce, fmt, adx);
 164         va_end(adx);







 165 }


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  23  * Copyright (c) 2012 by Delphix. All rights reserved.
  24  * Copyright 2017 Nexenta Systems, Inc.  All rights reserved.
  25  * Copyright 2017 RackTop Systems.
  26  */
  27 
  28 #include <sys/param.h>
  29 #include <sys/types.h>
  30 #include <sys/varargs.h>
  31 #include <sys/systm.h>
  32 #include <sys/cmn_err.h>
  33 #include <sys/log.h>
  34 
  35 #include <fakekernel.h>
  36 
  37 void    abort(void) __NORETURN;
  38 void    debug_enter(char *);
  39 
  40 char *volatile panicstr;
  41 va_list  panicargs;
  42 char panicbuf[512];
  43 
  44 volatile int aok;
  45 
  46 static const int
  47 ce_flags[CE_IGNORE] = { SL_NOTE, SL_NOTE, SL_WARN, SL_FATAL };
  48 static const char
  49 ce_prefix[CE_IGNORE][10] = { "", "NOTICE: ", "WARNING: ", "" };
  50 static const char
  51 ce_suffix[CE_IGNORE][2] = { "", "\n", "\n", "" };
  52 
  53 
  54 /*
  55  * This function is just a stub, exported NODIRECT so that
  56  * comsumers like fksmbd can provide their own.
  57  * (One that actually prints the messages.)
  58  *


  83 
  84         if (strchr("^!?", fmt[0]) != NULL) {
  85                 if (fmt[0] == '^')
  86                         flags |= SL_CONSONLY;
  87                 else if (fmt[0] == '!')
  88                         flags |= SL_LOGONLY;
  89                 fmt++;
  90         }
  91 
  92         bufend = bufp + bufsize;
  93         msgp = bufp;
  94         msgp += snprintf(msgp, bufend - msgp, "[fake_kernel] ");
  95         msgp += snprintf(msgp, bufend - msgp, prefix);
  96         msgp += vsnprintf(msgp, bufend - msgp, fmt, adx);
  97         msgp += snprintf(msgp, bufend - msgp, suffix);
  98         len = msgp - bufp;
  99 
 100         fakekernel_putlog(bufp, len, flags);
 101 }
 102 
 103 /* ARGSUSED */
 104 void
 105 vzprintf(zoneid_t zoneid, const char *fmt, va_list adx)
 106 {
 107         fakekernel_cprintf(fmt, adx, SL_CONSOLE | SL_NOTE, "", "");
 108 }
 109 
 110 /*PRINTFLIKE2*/
 111 void
 112 zprintf(zoneid_t zoneid, const char *fmt, ...)
 113 {
 114         va_list adx;
 115 
 116         va_start(adx, fmt);
 117         vzprintf(zoneid, fmt, adx);
 118         va_end(adx);
 119 }
 120 
 121 /*
 122  * "User-level crash dump", if you will.
 123  */
 124 void
 125 vpanic(const char *fmt, va_list adx)
 126 {
 127         va_list tmpargs;
 128 
 129         panicstr = (char *)fmt;
 130         va_copy(panicargs, adx);
 131 
 132         va_copy(tmpargs, adx);
 133         fakekernel_cprintf(fmt, tmpargs, SL_FATAL, "fatal: ", "\n");
 134 
 135         /* Call libc`assfail() so that mdb ::status works */
 136         (void) vsnprintf(panicbuf, sizeof (panicbuf), fmt, adx);
 137         debug_enter(panicbuf);
 138         (void) assfail(panicbuf, "(panic)", 0);
 139 
 140         abort();        /* avoid "noreturn" warnings */
 141 }
 142 
 143 void
 144 panic(const char *fmt, ...)
 145 {
 146         va_list adx;
 147 
 148         va_start(adx, fmt);
 149         vpanic(fmt, adx);
 150         va_end(adx);
 151 }
 152 
 153 void
 154 fm_panic(const char *fmt, ...)
 155 {
 156         va_list adx;
 157 
 158         va_start(adx, fmt);


 165 {
 166 
 167         if (ce == CE_PANIC)
 168                 vpanic(fmt, adx);
 169         if (ce >= CE_IGNORE)
 170                 return;
 171 
 172         fakekernel_cprintf(fmt, adx, ce_flags[ce] | SL_CONSOLE,
 173             ce_prefix[ce], ce_suffix[ce]);
 174 }
 175 
 176 /*PRINTFLIKE2*/
 177 void
 178 cmn_err(int ce, const char *fmt, ...)
 179 {
 180         va_list adx;
 181 
 182         va_start(adx, fmt);
 183         vcmn_err(ce, fmt, adx);
 184         va_end(adx);
 185 }
 186 
 187 /* ARGSUSED */
 188 void
 189 debug_enter(char *str)
 190 {
 191         /* Just a place for a break point. */
 192 }