dedump.c revision ca9327a6de44d69ddab3668cc1e143ce781387a3
/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI" /* SVr3.2H */
/*
* Dump STREAMS module. Could be used anywhere on a stream to
* print all message headers and data on to the console.
*/
/*
* Raw buffer dumping routine. Displays the contents of the first message in
* message chain `mp', using the "traditional" dump format.
*
* For instance, "Hello STREAMS, panicked lately?" would be displayed as:
*
* RD 30001dbb240 M_DATA 48656C6C 6F205354 5245414D 532C2070 Hello STREAMS, p
* 616E6963 6B656420 6C617465 6C793F anicked lately?
*
* If the character being displayed is not printable, a '.' is shown.
*/
#define DEDUMP_HEXPERBLK 4
static void
{
uchar_t c;
for (;;) {
/*
* We're either out of data or we've filled a complete
* line. In either case, print out what we've got --
* but first NUL-terminate asc[] and pad out hex[]
* with spaces.
*/
/*
* If we're out of data, bail. Otherwise, reset asci
* and hexi for another lap around. Also, set hdrp to
* the pad since we only want to show the header once.
*/
break;
asci = 0;
hexi = 0;
}
if ((i % DEDUMP_HEXPERBLK) == 0)
}
}
static void
{
}
static void
{
}
static void
{
}
static void
{
}
static void
{
(void) printf("%s cmd %x cred %p id %u flag %x count %ld rval %d "
}
static void
{
}
static void
{
(void) printf("%s cmd %x cred %p id %u flag %x priv %p addr %p size "
}
static void
{
}
typedef struct msgfmt {
char m_desc[15];
} msgfmt_t;
};
/*ARGSUSED1*/
static int
{
if (!sflag)
return (ENXIO);
if (q->q_ptr)
return (0); /* already attached */
qprocson(q);
return (0);
}
/*ARGSUSED1*/
static int
{
qprocsoff(q);
return (0);
}
/*
* Common put procedure for upstream and downstream.
*/
static int
{
return (0);
}
struct module_info dedump_minfo = {
};
struct qinit dedumprinit = {
};
struct qinit dedumpwinit = {
};
struct streamtab dedumpinfo = {
};
"dedump",
};
static struct modlstrmod modlstrmod = {
};
static struct modlinkage modlinkage = {
};
int
_init(void)
{
int i;
/*
* Sort msgfmt[] so that msgfmt[n] describes message type n.
*/
for (i = 255; i != 0; i--) {
}
/*
* Fill hdrpad[] with as many spaces as will fit.
*/
return (mod_install(&modlinkage));
}
int
_fini(void)
{
return (mod_remove(&modlinkage));
}
int
{
}