Path: blob/main/cddl/contrib/opensolaris/lib/libdtrace/common/dt_buf.h
39562 views
/*1* CDDL HEADER START2*3* The contents of this file are subject to the terms of the4* Common Development and Distribution License, Version 1.0 only5* (the "License"). You may not use this file except in compliance6* with the License.7*8* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE9* or http://www.opensolaris.org/os/licensing.10* See the License for the specific language governing permissions11* and limitations under the License.12*13* When distributing Covered Code, include this CDDL HEADER in each14* file and include the License file at usr/src/OPENSOLARIS.LICENSE.15* If applicable, add the following below this CDDL HEADER, with the16* fields enclosed by brackets "[]" replaced with your own identifying17* information: Portions Copyright [yyyy] [name of copyright owner]18*19* CDDL HEADER END20*/21/*22* Copyright 2005 Sun Microsystems, Inc. All rights reserved.23* Use is subject to license terms.24*/2526#ifndef _DT_BUF_H27#define _DT_BUF_H2829#pragma ident "%Z%%M% %I% %E% SMI"3031#ifdef __cplusplus32extern "C" {33#endif3435#include <dtrace.h>3637typedef struct dt_buf {38const char *dbu_name; /* string name for debugging */39uchar_t *dbu_buf; /* buffer base address */40uchar_t *dbu_ptr; /* current buffer location */41size_t dbu_len; /* buffer size in bytes */42int dbu_err; /* errno value if error */43int dbu_resizes; /* number of resizes */44} dt_buf_t;4546extern void dt_buf_create(dtrace_hdl_t *, dt_buf_t *, const char *, size_t);47extern void dt_buf_destroy(dtrace_hdl_t *, dt_buf_t *);48extern void dt_buf_reset(dtrace_hdl_t *, dt_buf_t *);4950extern void dt_buf_write(dtrace_hdl_t *, dt_buf_t *,51const void *, size_t, size_t);5253extern void dt_buf_concat(dtrace_hdl_t *, dt_buf_t *,54const dt_buf_t *, size_t);5556extern size_t dt_buf_offset(const dt_buf_t *, size_t);57extern size_t dt_buf_len(const dt_buf_t *);5859extern int dt_buf_error(const dt_buf_t *);60extern void *dt_buf_ptr(const dt_buf_t *);6162extern void *dt_buf_claim(dtrace_hdl_t *, dt_buf_t *);6364#ifdef __cplusplus65}66#endif6768#endif /* _DT_BUF_H */697071