/*
* 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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* DTrace Memory Buffer Routines
*
* The routines in this file are used to create an automatically resizing
* memory buffer that can be written to like a file. Memory buffers are
* used to construct DOF to ioctl() to dtrace(7D), and provide semantics that
* simplify caller code. Specifically, any allocation errors result in an
* error code being set inside the buffer which is maintained persistently and
* propagates to another buffer if the buffer in error is concatenated. These
* semantics permit callers to execute a large series of writes without needing
* to check for errors and then perform a single check before using the buffer.
*/
#include <sys/sysmacros.h>
#include <strings.h>
#include <dt_impl.h>
#include <dt_buf.h>
void
{
if (len == 0)
else
bp->dbu_resizes = 0;
}
void
{
dt_dprintf("dt_buf_destroy(%s): size=%lu resizes=%u\n",
}
void
{
else
}
void
{
return; /* write silently fails */
}
uint_t r = 1;
new_len *= 2;
r++;
}
return;
}
bp->dbu_resizes += r;
}
}
void
{
} else {
}
}
{
}
{
}
int
{
}
void *
{
}
void *
{
}
return (buf);
}