17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5*ca9327a6Smeem * Common Development and Distribution License (the "License").
6*ca9327a6Smeem * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate *
87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate * and limitations under the License.
127c478bd9Sstevel@tonic-gate *
137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate *
197c478bd9Sstevel@tonic-gate * CDDL HEADER END
207c478bd9Sstevel@tonic-gate */
217c478bd9Sstevel@tonic-gate /*
22*ca9327a6Smeem * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
237c478bd9Sstevel@tonic-gate * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate */
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" /* SVr3.2H */
277c478bd9Sstevel@tonic-gate
287c478bd9Sstevel@tonic-gate /*
297c478bd9Sstevel@tonic-gate * Dump STREAMS module. Could be used anywhere on a stream to
307c478bd9Sstevel@tonic-gate * print all message headers and data on to the console.
317c478bd9Sstevel@tonic-gate */
327c478bd9Sstevel@tonic-gate
337c478bd9Sstevel@tonic-gate #include <sys/types.h>
347c478bd9Sstevel@tonic-gate #include <sys/param.h>
357c478bd9Sstevel@tonic-gate #include <sys/systm.h>
367c478bd9Sstevel@tonic-gate #include <sys/stream.h>
377c478bd9Sstevel@tonic-gate #include <sys/stropts.h>
387c478bd9Sstevel@tonic-gate #include <sys/errno.h>
397c478bd9Sstevel@tonic-gate #include <sys/cmn_err.h>
407c478bd9Sstevel@tonic-gate #include <sys/ddi.h>
417c478bd9Sstevel@tonic-gate #include <sys/strsun.h>
427c478bd9Sstevel@tonic-gate
437c478bd9Sstevel@tonic-gate #include <sys/conf.h>
447c478bd9Sstevel@tonic-gate #include <sys/modctl.h>
457c478bd9Sstevel@tonic-gate
467c478bd9Sstevel@tonic-gate static char hdr[100]; /* current message header */
477c478bd9Sstevel@tonic-gate static char hdrpad[100]; /* pad of same length as hdr[] */
487c478bd9Sstevel@tonic-gate
497c478bd9Sstevel@tonic-gate /*
507c478bd9Sstevel@tonic-gate * Raw buffer dumping routine. Displays the contents of the first message in
517c478bd9Sstevel@tonic-gate * message chain `mp', using the "traditional" dump format.
527c478bd9Sstevel@tonic-gate *
537c478bd9Sstevel@tonic-gate * For instance, "Hello STREAMS, panicked lately?" would be displayed as:
547c478bd9Sstevel@tonic-gate *
557c478bd9Sstevel@tonic-gate * RD 30001dbb240 M_DATA 48656C6C 6F205354 5245414D 532C2070 Hello STREAMS, p
567c478bd9Sstevel@tonic-gate * 616E6963 6B656420 6C617465 6C793F anicked lately?
577c478bd9Sstevel@tonic-gate *
587c478bd9Sstevel@tonic-gate * If the character being displayed is not printable, a '.' is shown.
597c478bd9Sstevel@tonic-gate */
607c478bd9Sstevel@tonic-gate
617c478bd9Sstevel@tonic-gate #define DEDUMP_HEXPERBLK 4
627c478bd9Sstevel@tonic-gate #define DEDUMP_HEXLEN (sizeof ("11223344") * 4)
637c478bd9Sstevel@tonic-gate #define DEDUMP_ASCLEN (sizeof ("0123456789ABCDEF") - 1)
647c478bd9Sstevel@tonic-gate
657c478bd9Sstevel@tonic-gate static void
dedump_raw(mblk_t * mp)667c478bd9Sstevel@tonic-gate dedump_raw(mblk_t *mp)
677c478bd9Sstevel@tonic-gate {
687c478bd9Sstevel@tonic-gate char hex[DEDUMP_HEXLEN + 1], asc[DEDUMP_ASCLEN + 1];
697c478bd9Sstevel@tonic-gate int hexi = 0, asci = 0, i = 0;
707c478bd9Sstevel@tonic-gate uchar_t c;
717c478bd9Sstevel@tonic-gate char *hdrp = hdr;
727c478bd9Sstevel@tonic-gate
737c478bd9Sstevel@tonic-gate hex[DEDUMP_HEXLEN] = '\0';
747c478bd9Sstevel@tonic-gate
757c478bd9Sstevel@tonic-gate for (;;) {
767c478bd9Sstevel@tonic-gate if (i == MBLKL(mp) || (i != 0 && (i % DEDUMP_ASCLEN) == 0)) {
777c478bd9Sstevel@tonic-gate /*
787c478bd9Sstevel@tonic-gate * We're either out of data or we've filled a complete
797c478bd9Sstevel@tonic-gate * line. In either case, print out what we've got --
807c478bd9Sstevel@tonic-gate * but first NUL-terminate asc[] and pad out hex[]
817c478bd9Sstevel@tonic-gate * with spaces.
827c478bd9Sstevel@tonic-gate */
837c478bd9Sstevel@tonic-gate asc[asci] = '\0';
847c478bd9Sstevel@tonic-gate (void) memset(hex + hexi, ' ', DEDUMP_HEXLEN - hexi);
857c478bd9Sstevel@tonic-gate (void) printf("%s %s %s\n", hdrp, hex, asc);
867c478bd9Sstevel@tonic-gate
877c478bd9Sstevel@tonic-gate /*
887c478bd9Sstevel@tonic-gate * If we're out of data, bail. Otherwise, reset asci
897c478bd9Sstevel@tonic-gate * and hexi for another lap around. Also, set hdrp to
907c478bd9Sstevel@tonic-gate * the pad since we only want to show the header once.
917c478bd9Sstevel@tonic-gate */
927c478bd9Sstevel@tonic-gate if (i == MBLKL(mp))
937c478bd9Sstevel@tonic-gate break;
947c478bd9Sstevel@tonic-gate asci = 0;
957c478bd9Sstevel@tonic-gate hexi = 0;
967c478bd9Sstevel@tonic-gate hdrp = hdrpad;
977c478bd9Sstevel@tonic-gate }
987c478bd9Sstevel@tonic-gate
997c478bd9Sstevel@tonic-gate c = mp->b_rptr[i++];
1007c478bd9Sstevel@tonic-gate
1017c478bd9Sstevel@tonic-gate hexi += snprintf(hex + hexi, 3, "%02X", c);
1027c478bd9Sstevel@tonic-gate if ((i % DEDUMP_HEXPERBLK) == 0)
1037c478bd9Sstevel@tonic-gate hex[hexi++] = ' ';
1047c478bd9Sstevel@tonic-gate asc[asci++] = (c >= 32 && c <= 126) ? c : '.';
1057c478bd9Sstevel@tonic-gate }
1067c478bd9Sstevel@tonic-gate }
1077c478bd9Sstevel@tonic-gate
1087c478bd9Sstevel@tonic-gate static void
dedump_char(mblk_t * mp)1097c478bd9Sstevel@tonic-gate dedump_char(mblk_t *mp)
1107c478bd9Sstevel@tonic-gate {
1117c478bd9Sstevel@tonic-gate (void) printf("%s 0x%x\n", hdr, *(uchar_t *)mp->b_rptr);
1127c478bd9Sstevel@tonic-gate }
1137c478bd9Sstevel@tonic-gate
1147c478bd9Sstevel@tonic-gate static void
dedump_int(mblk_t * mp)1157c478bd9Sstevel@tonic-gate dedump_int(mblk_t *mp)
1167c478bd9Sstevel@tonic-gate {
1177c478bd9Sstevel@tonic-gate (void) printf("%s %d\n", hdr, *(int *)mp->b_rptr);
1187c478bd9Sstevel@tonic-gate }
1197c478bd9Sstevel@tonic-gate
1207c478bd9Sstevel@tonic-gate static void
dedump_ssize(mblk_t * mp)1217c478bd9Sstevel@tonic-gate dedump_ssize(mblk_t *mp)
1227c478bd9Sstevel@tonic-gate {
1237c478bd9Sstevel@tonic-gate (void) printf("%s %ld\n", hdr, *(ssize_t *)mp->b_rptr);
1247c478bd9Sstevel@tonic-gate }
1257c478bd9Sstevel@tonic-gate
1267c478bd9Sstevel@tonic-gate static void
dedump_cmdblk(mblk_t * mp)127*ca9327a6Smeem dedump_cmdblk(mblk_t *mp)
128*ca9327a6Smeem {
129*ca9327a6Smeem struct cmdblk *cbp = (struct cmdblk *)mp->b_rptr;
130*ca9327a6Smeem
131*ca9327a6Smeem (void) printf("%s cmd %x cred %p len %u error %d\n", hdr, cbp->cb_cmd,
132*ca9327a6Smeem (void *)cbp->cb_cr, cbp->cb_len, cbp->cb_error);
133*ca9327a6Smeem }
134*ca9327a6Smeem
135*ca9327a6Smeem static void
dedump_iocblk(mblk_t * mp)1367c478bd9Sstevel@tonic-gate dedump_iocblk(mblk_t *mp)
1377c478bd9Sstevel@tonic-gate {
1387c478bd9Sstevel@tonic-gate struct iocblk *ic = (struct iocblk *)mp->b_rptr;
1397c478bd9Sstevel@tonic-gate
1407c478bd9Sstevel@tonic-gate (void) printf("%s cmd %x cred %p id %u flag %x count %ld rval %d "
1417c478bd9Sstevel@tonic-gate "err %d\n", hdr, ic->ioc_cmd, (void *)ic->ioc_cr, ic->ioc_id,
1427c478bd9Sstevel@tonic-gate ic->ioc_flag, ic->ioc_count, ic->ioc_rval, ic->ioc_error);
1437c478bd9Sstevel@tonic-gate }
1447c478bd9Sstevel@tonic-gate
1457c478bd9Sstevel@tonic-gate static void
dedump_stroptions(mblk_t * mp)1467c478bd9Sstevel@tonic-gate dedump_stroptions(mblk_t *mp)
1477c478bd9Sstevel@tonic-gate {
1487c478bd9Sstevel@tonic-gate struct stroptions *so = (struct stroptions *)mp->b_rptr;
1497c478bd9Sstevel@tonic-gate
1507c478bd9Sstevel@tonic-gate (void) printf("%s flag %x readopt %d wroff %u\n", hdr,
1517c478bd9Sstevel@tonic-gate so->so_flags, so->so_readopt, so->so_wroff);
1527c478bd9Sstevel@tonic-gate
1537c478bd9Sstevel@tonic-gate (void) printf("%s minpsz %ld maxpsz %ld hiwat %lu lowat %lu\n", hdrpad,
1547c478bd9Sstevel@tonic-gate so->so_minpsz, so->so_maxpsz, so->so_hiwat, so->so_lowat);
1557c478bd9Sstevel@tonic-gate
1567c478bd9Sstevel@tonic-gate (void) printf("%s band %u erropt %u maxblk %ld copyopt %u\n", hdrpad,
1577c478bd9Sstevel@tonic-gate so->so_band, so->so_erropt, so->so_maxblk, so->so_copyopt);
1587c478bd9Sstevel@tonic-gate }
1597c478bd9Sstevel@tonic-gate
1607c478bd9Sstevel@tonic-gate static void
dedump_copyreq(mblk_t * mp)1617c478bd9Sstevel@tonic-gate dedump_copyreq(mblk_t *mp)
1627c478bd9Sstevel@tonic-gate {
1637c478bd9Sstevel@tonic-gate struct copyreq *cq = (struct copyreq *)mp->b_rptr;
1647c478bd9Sstevel@tonic-gate
1657c478bd9Sstevel@tonic-gate (void) printf("%s cmd %x cred %p id %u flag %x priv %p addr %p size "
1667c478bd9Sstevel@tonic-gate "%lu\n", hdr, cq->cq_cmd, (void *)cq->cq_cr, cq->cq_id, cq->cq_flag,
1677c478bd9Sstevel@tonic-gate (void *)cq->cq_private, (void *)cq->cq_addr, cq->cq_size);
1687c478bd9Sstevel@tonic-gate }
1697c478bd9Sstevel@tonic-gate
1707c478bd9Sstevel@tonic-gate static void
dedump_copyresp(mblk_t * mp)1717c478bd9Sstevel@tonic-gate dedump_copyresp(mblk_t *mp)
1727c478bd9Sstevel@tonic-gate {
1737c478bd9Sstevel@tonic-gate struct copyresp *cp = (struct copyresp *)mp->b_rptr;
1747c478bd9Sstevel@tonic-gate
1757c478bd9Sstevel@tonic-gate (void) printf("%s cmd %x cred %p id %u flag %x priv %p rval %p\n", hdr,
1767c478bd9Sstevel@tonic-gate cp->cp_cmd, (void *)cp->cp_cr, cp->cp_id, cp->cp_flag,
1777c478bd9Sstevel@tonic-gate (void *)cp->cp_private, (void *)cp->cp_rval);
1787c478bd9Sstevel@tonic-gate }
1797c478bd9Sstevel@tonic-gate
1807c478bd9Sstevel@tonic-gate typedef struct msgfmt {
1817c478bd9Sstevel@tonic-gate uchar_t m_type;
1827c478bd9Sstevel@tonic-gate char m_desc[15];
1837c478bd9Sstevel@tonic-gate void (*m_print)(mblk_t *);
1847c478bd9Sstevel@tonic-gate } msgfmt_t;
1857c478bd9Sstevel@tonic-gate
1867c478bd9Sstevel@tonic-gate static msgfmt_t msgfmt[256] = {
1877c478bd9Sstevel@tonic-gate { M_DATA, "M_DATA ", dedump_raw },
1887c478bd9Sstevel@tonic-gate { M_PROTO, "M_PROTO ", dedump_raw },
1897c478bd9Sstevel@tonic-gate { M_BREAK, "M_BREAK ", dedump_raw },
1907c478bd9Sstevel@tonic-gate { M_PASSFP, "M_PASSFP ", dedump_raw },
1917c478bd9Sstevel@tonic-gate { M_EVENT, "M_EVENT ", dedump_raw },
1927c478bd9Sstevel@tonic-gate { M_SIG, "M_SIG ", dedump_char },
1937c478bd9Sstevel@tonic-gate { M_DELAY, "M_DELAY ", dedump_int },
1947c478bd9Sstevel@tonic-gate { M_CTL, "M_CTL ", dedump_raw },
1957c478bd9Sstevel@tonic-gate { M_IOCTL, "M_IOCTL ", dedump_iocblk },
1967c478bd9Sstevel@tonic-gate { M_SETOPTS, "M_SETOPTS ", dedump_stroptions },
1977c478bd9Sstevel@tonic-gate { M_RSE, "M_RSE ", dedump_raw },
1987c478bd9Sstevel@tonic-gate { M_IOCACK, "M_IOCACK ", dedump_iocblk },
1997c478bd9Sstevel@tonic-gate { M_IOCNAK, "M_IOCNAK ", dedump_iocblk },
2007c478bd9Sstevel@tonic-gate { M_PCPROTO, "M_PCPROTO ", dedump_raw },
2017c478bd9Sstevel@tonic-gate { M_PCSIG, "M_PCSIG ", dedump_char },
2027c478bd9Sstevel@tonic-gate { M_READ, "M_READ ", dedump_ssize },
2037c478bd9Sstevel@tonic-gate { M_FLUSH, "M_FLUSH ", dedump_char },
2047c478bd9Sstevel@tonic-gate { M_STOP, "M_STOP ", dedump_raw },
2057c478bd9Sstevel@tonic-gate { M_START, "M_START ", dedump_raw },
2067c478bd9Sstevel@tonic-gate { M_HANGUP, "M_HANGUP ", dedump_raw },
2077c478bd9Sstevel@tonic-gate { M_ERROR, "M_ERROR ", dedump_char },
2087c478bd9Sstevel@tonic-gate { M_COPYIN, "M_COPYIN ", dedump_copyreq },
2097c478bd9Sstevel@tonic-gate { M_COPYOUT, "M_COPYOUT ", dedump_copyreq },
2107c478bd9Sstevel@tonic-gate { M_IOCDATA, "M_IOCDATA ", dedump_copyresp },
2117c478bd9Sstevel@tonic-gate { M_PCRSE, "M_PCRSE ", dedump_raw },
2127c478bd9Sstevel@tonic-gate { M_STOPI, "M_STOPI ", dedump_raw },
2137c478bd9Sstevel@tonic-gate { M_STARTI, "M_STARTI ", dedump_raw },
2147c478bd9Sstevel@tonic-gate { M_PCEVENT, "M_PCEVENT ", dedump_raw },
2157c478bd9Sstevel@tonic-gate { M_UNHANGUP, "M_UNHANGUP", dedump_raw },
216*ca9327a6Smeem { M_CMD, "M_CMD ", dedump_cmdblk },
2177c478bd9Sstevel@tonic-gate };
2187c478bd9Sstevel@tonic-gate
2197c478bd9Sstevel@tonic-gate /*ARGSUSED1*/
2207c478bd9Sstevel@tonic-gate static int
dedumpopen(queue_t * q,dev_t * devp,int oflag,int sflag,cred_t * crp)2217c478bd9Sstevel@tonic-gate dedumpopen(queue_t *q, dev_t *devp, int oflag, int sflag, cred_t *crp)
2227c478bd9Sstevel@tonic-gate {
2237c478bd9Sstevel@tonic-gate if (!sflag)
2247c478bd9Sstevel@tonic-gate return (ENXIO);
2257c478bd9Sstevel@tonic-gate
2267c478bd9Sstevel@tonic-gate if (q->q_ptr)
2277c478bd9Sstevel@tonic-gate return (0); /* already attached */
2287c478bd9Sstevel@tonic-gate
2297c478bd9Sstevel@tonic-gate qprocson(q);
2307c478bd9Sstevel@tonic-gate return (0);
2317c478bd9Sstevel@tonic-gate }
2327c478bd9Sstevel@tonic-gate
2337c478bd9Sstevel@tonic-gate /*ARGSUSED1*/
2347c478bd9Sstevel@tonic-gate static int
dedumpclose(queue_t * q,int flag,cred_t * crp)2357c478bd9Sstevel@tonic-gate dedumpclose(queue_t *q, int flag, cred_t *crp)
2367c478bd9Sstevel@tonic-gate {
2377c478bd9Sstevel@tonic-gate qprocsoff(q);
2387c478bd9Sstevel@tonic-gate return (0);
2397c478bd9Sstevel@tonic-gate }
2407c478bd9Sstevel@tonic-gate
2417c478bd9Sstevel@tonic-gate /*
2427c478bd9Sstevel@tonic-gate * Common put procedure for upstream and downstream.
2437c478bd9Sstevel@tonic-gate */
2447c478bd9Sstevel@tonic-gate static int
dedumpput(queue_t * q,mblk_t * mp)2457c478bd9Sstevel@tonic-gate dedumpput(queue_t *q, mblk_t *mp)
2467c478bd9Sstevel@tonic-gate {
2477c478bd9Sstevel@tonic-gate unsigned char type = DB_TYPE(mp);
2487c478bd9Sstevel@tonic-gate ssize_t hdrlen;
2497c478bd9Sstevel@tonic-gate
2507c478bd9Sstevel@tonic-gate hdrlen = snprintf(hdr, sizeof (hdr), "%s %p %10s ",
2517c478bd9Sstevel@tonic-gate (q->q_flag & QREADR) ? "RD" : "WR", (void *)q, msgfmt[type].m_desc);
2527c478bd9Sstevel@tonic-gate
2537c478bd9Sstevel@tonic-gate hdrpad[hdrlen] = '\0';
2547c478bd9Sstevel@tonic-gate msgfmt[type].m_print(mp);
2557c478bd9Sstevel@tonic-gate hdrpad[hdrlen] = ' ';
2567c478bd9Sstevel@tonic-gate
2577c478bd9Sstevel@tonic-gate putnext(q, mp);
2587c478bd9Sstevel@tonic-gate return (0);
2597c478bd9Sstevel@tonic-gate }
2607c478bd9Sstevel@tonic-gate
2617c478bd9Sstevel@tonic-gate struct module_info dedump_minfo = {
2627c478bd9Sstevel@tonic-gate 0xaaa, "dedump", 0, INFPSZ, 0, 0
2637c478bd9Sstevel@tonic-gate };
2647c478bd9Sstevel@tonic-gate
2657c478bd9Sstevel@tonic-gate struct qinit dedumprinit = {
2667c478bd9Sstevel@tonic-gate dedumpput, NULL, dedumpopen, dedumpclose, NULL, &dedump_minfo, NULL
2677c478bd9Sstevel@tonic-gate };
2687c478bd9Sstevel@tonic-gate
2697c478bd9Sstevel@tonic-gate struct qinit dedumpwinit = {
2707c478bd9Sstevel@tonic-gate dedumpput, NULL, NULL, NULL, NULL, &dedump_minfo, NULL
2717c478bd9Sstevel@tonic-gate };
2727c478bd9Sstevel@tonic-gate
2737c478bd9Sstevel@tonic-gate struct streamtab dedumpinfo = {
2747c478bd9Sstevel@tonic-gate &dedumprinit, &dedumpwinit, NULL, NULL,
2757c478bd9Sstevel@tonic-gate };
2767c478bd9Sstevel@tonic-gate
2777c478bd9Sstevel@tonic-gate static struct fmodsw fsw = {
2787c478bd9Sstevel@tonic-gate "dedump",
2797c478bd9Sstevel@tonic-gate &dedumpinfo,
2807c478bd9Sstevel@tonic-gate D_MP | D_MTPERMOD /* just to serialize printfs */
2817c478bd9Sstevel@tonic-gate };
2827c478bd9Sstevel@tonic-gate
2837c478bd9Sstevel@tonic-gate static struct modlstrmod modlstrmod = {
2847c478bd9Sstevel@tonic-gate &mod_strmodops, "dump streams module", &fsw
2857c478bd9Sstevel@tonic-gate };
2867c478bd9Sstevel@tonic-gate
2877c478bd9Sstevel@tonic-gate static struct modlinkage modlinkage = {
2887c478bd9Sstevel@tonic-gate MODREV_1, &modlstrmod, NULL
2897c478bd9Sstevel@tonic-gate };
2907c478bd9Sstevel@tonic-gate
2917c478bd9Sstevel@tonic-gate int
_init(void)2927c478bd9Sstevel@tonic-gate _init(void)
2937c478bd9Sstevel@tonic-gate {
2947c478bd9Sstevel@tonic-gate int i;
2957c478bd9Sstevel@tonic-gate msgfmt_t mf;
2967c478bd9Sstevel@tonic-gate
2977c478bd9Sstevel@tonic-gate /*
2987c478bd9Sstevel@tonic-gate * Sort msgfmt[] so that msgfmt[n] describes message type n.
2997c478bd9Sstevel@tonic-gate */
3007c478bd9Sstevel@tonic-gate for (i = 255; i != 0; i--) {
3017c478bd9Sstevel@tonic-gate mf = msgfmt[i];
3027c478bd9Sstevel@tonic-gate msgfmt[i].m_type = i;
3037c478bd9Sstevel@tonic-gate (void) sprintf(msgfmt[i].m_desc, "M_BOGUS_0x%x", i);
3047c478bd9Sstevel@tonic-gate msgfmt[i].m_print = dedump_raw;
3057c478bd9Sstevel@tonic-gate if (mf.m_desc[0] != 0)
3067c478bd9Sstevel@tonic-gate msgfmt[mf.m_type] = mf;
3077c478bd9Sstevel@tonic-gate }
3087c478bd9Sstevel@tonic-gate
3097c478bd9Sstevel@tonic-gate /*
3107c478bd9Sstevel@tonic-gate * Fill hdrpad[] with as many spaces as will fit.
3117c478bd9Sstevel@tonic-gate */
3127c478bd9Sstevel@tonic-gate (void) memset(hdrpad, ' ', sizeof (hdrpad) - 1);
3137c478bd9Sstevel@tonic-gate hdrpad[sizeof (hdrpad) - 1] = '\0';
3147c478bd9Sstevel@tonic-gate
3157c478bd9Sstevel@tonic-gate return (mod_install(&modlinkage));
3167c478bd9Sstevel@tonic-gate }
3177c478bd9Sstevel@tonic-gate
3187c478bd9Sstevel@tonic-gate int
_fini(void)3197c478bd9Sstevel@tonic-gate _fini(void)
3207c478bd9Sstevel@tonic-gate {
3217c478bd9Sstevel@tonic-gate return (mod_remove(&modlinkage));
3227c478bd9Sstevel@tonic-gate }
3237c478bd9Sstevel@tonic-gate
3247c478bd9Sstevel@tonic-gate int
_info(struct modinfo * modinfop)3257c478bd9Sstevel@tonic-gate _info(struct modinfo *modinfop)
3267c478bd9Sstevel@tonic-gate {
3277c478bd9Sstevel@tonic-gate return (mod_info(&modlinkage, modinfop));
3287c478bd9Sstevel@tonic-gate }
329