mdb_io.h revision 843e19887f64dde75055cf8842fc4db2171eff45
/*
* 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
*/
/*
* Copyright 2007 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _MDB_IO_H
#define _MDB_IO_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _MDB
#include <setjmp.h>
#include <stdarg.h>
#include <stdio.h>
struct mdb_arg; /* Argument structure */
typedef struct mdb_iob_stack {
typedef struct mdb_iob_ctx {
void *ctx_rptr; /* Read-side client data */
void *ctx_wptr; /* Write-side client data */
void *ctx_data; /* Pointer to client data */
#define MDB_IOB_RDIOB 0 /* Index for pipe's read-side iob */
typedef void mdb_table_print_f(void *);
#define MDB_TBL_DONE 0
#define MDB_TBL_PRNT 1
#define MDB_TBL_FUNC 2
extern void mdb_io_rele(mdb_io_t *);
extern void mdb_io_destroy(mdb_io_t *);
extern void mdb_iob_destroy(mdb_iob_t *);
extern void mdb_iob_flush(mdb_iob_t *);
extern void mdb_iob_nlflush(mdb_iob_t *);
extern void mdb_iob_discard(mdb_iob_t *);
extern void mdb_iob_clearlines(mdb_iob_t *);
extern void mdb_iob_printf(mdb_iob_t *, const char *, ...);
const struct mdb_arg *);
extern void mdb_iob_puts(mdb_iob_t *, const char *);
extern void mdb_iob_putc(mdb_iob_t *, int);
extern void mdb_iob_tab(mdb_iob_t *);
extern void mdb_iob_nl(mdb_iob_t *);
extern int mdb_iob_getc(mdb_iob_t *);
extern int mdb_iob_ungetc(mdb_iob_t *, int);
extern int mdb_iob_eof(mdb_iob_t *);
extern int mdb_iob_err(mdb_iob_t *);
extern int mdb_iob_ctl(mdb_iob_t *, int, void *);
extern const char *mdb_iob_name(mdb_iob_t *);
extern void mdb_iob_stack_create(mdb_iob_stack_t *);
extern void mdb_iob_stack_destroy(mdb_iob_stack_t *);
extern const char *mdb_iob_format2str(const char *);
/*
* Available i/o backend constructors for common MDB code. These are
* implemented in the corresponding .c files.
*/
extern mdb_io_t *mdb_fdio_create(int);
extern mdb_io_t *mdb_strio_create(const char *);
extern mdb_io_t *mdb_nullio_create(void);
/*
* Functions for testing whether the given iob is of a given backend type:
*/
extern int mdb_iob_isastr(mdb_iob_t *);
extern int mdb_iob_isatty(mdb_iob_t *);
extern int mdb_iob_isapipe(mdb_iob_t *);
extern void mdb_table_print(uint_t, const char *, ...);
extern int mdb_setupterm(const char *, mdb_io_t *, int *);
#endif /* _MDB */
#ifdef __cplusplus
}
#endif
#endif /* _MDB_IO_H */