/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <alloca.h>
#include <stdio.h>
#include <unistd.h>
#include <dlfcn.h>
#include <thread.h>
#include <pthread.h>
#include <ctype.h>
#include <scsi/libsmp_plugin.h>
#include "smp_impl.h"
int
{
char *msg;
abort();
/*NOTREACHED*/
_exit(1);
/*NOTREACHED*/
return (0);
}
int
{
_smp_errno = err;
_smp_errmsg[0] = '\0';
return (-1);
}
/*
* Internal routine for setting both _smp_errno and _smp_errmsg. We save
* and restore the UNIX errno across this routing so the caller can use either
* smp_set_errno(), smp_error(), or smp_verror() without this value changing.
*/
int
{
size_t n;
char *errmsg;
/*
* To allow the existing error message to itself be used in an error
* message, we put the new error message into a buffer on the stack,
* and then copy it into lsh_errmsg. We also need to set the errno,
* but because the call to smp_set_errno() is destructive to
* lsh_errmsg, we do this after we print into our temporary buffer
* (in case _smp_errmsg is part of the error message) and before we
* copy the temporary buffer on to _smp_errmsg (to prevent our new
* message from being nuked by the call to smp_set_errno()).
*/
(void) smp_set_errno(err);
return (-1);
}
int
{
return (smp_set_errno(err));
return (err);
}
smp_errno(void)
{
return (_smp_errno);
}
const char *
smp_errmsg(void)
{
if (_smp_errmsg[0] == '\0')
sizeof (_smp_errmsg));
return (_smp_errmsg);
}
/*ARGSUSED*/
void *
{
void *mem;
if (size == 0) {
(void) smp_set_errno(ESMP_ZERO_LENGTH);
return (NULL);
}
(void) smp_set_errno(ESMP_NOMEM);
return (mem);
}
void *
{
void *mem;
return (NULL);
return (mem);
}
char *
{
return (NULL);
}
void
{
}
/*
* argument and return a newly-allocated copy of it.
*/
char *
{
const char *p;
char *r;
;
if (len == 0)
return (NULL);
;
if (len == 0)
return (NULL);
if (r == NULL)
return (NULL);
r[len] = '\0';
return (r);
}
int
{
if (version != LIBSMP_VERSION)
return (smp_error(ESMP_VERSION,
"library version %d does not match requested version %d",
return (0);
}
void
smp_fini(void)
{
}