/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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
*/
/*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* These routines simply provide wrappers around malloc(3C) and free(3C)
* for now. In the future we hope to provide a userland equivalent to
* the kmem allocator, including cache allocators.
*/
#include <strings.h>
#include <stdlib.h>
#include <poll.h>
#ifdef _KMDB
#include <kmdb/kmdb_fault.h>
#endif
#include <mdb/mdb_debug.h>
#include <mdb/mdb_stdlib.h>
#include <mdb/mdb_frame.h>
#include <mdb/mdb_umem.h>
#ifdef DEBUG
#else
int mdb_umem_flags = 0;
#endif
struct mdb_mblk {
};
/*ARGSUSED*/
static void *
{
#ifdef _KMDB
/*
* kmdb has a fixed, dedicated VA range in which to play. This range
* won't change size while the debugger is running, regardless of how
* long we wait. As a result, the only sensible course of action is
* to fail the request. If we're here, however, the request was made
* with UM_SLEEP. The caller is thus not expecting a NULL back. We'll
* have to fail the current dcmd set.
*/
warn("failed to allocate %lu bytes -- recovering\n",
}
#else
/*
* mdb, on the other hand, can afford to wait, as someone may actually
* free something.
*/
char buf[64];
"[ sleeping for %lu bytes of free memory ... ]",
do {
if (align != 0)
else
return (ptr);
}
#endif
/*NOTREACHED*/
return (NULL);
}
static void
{
}
/*
* If we're compiled in debug mode, we use this function (gratuitously
* stolen from kmem.c) to set uninitialized and freed regions to
* special bit patterns.
*/
static void
{
/* LINTED - alignment of bufend */
buf += 4;
}
}
void *
{
void *ptr;
return (NULL);
return (NULL);
if (align != 0)
else
}
return (ptr);
}
void *
{
}
void *
{
return (ptr);
}
void
{
if (mdb_umem_flags & UMF_DEBUG)
}
}
void
{
}
void
{
}
}