Converted "streams" pseudo-device into a KLD

This commit is contained in:
Mark Newton 1999-02-22 11:44:46 +00:00
parent ed720ec3dc
commit 86e9118bcc
3 changed files with 41 additions and 5 deletions

View File

@ -146,6 +146,35 @@ typedef struct streams_softc *sc_p;
static sc_p sca[NSTREAMS];
static void
streamsattach(void *dummy)
{
cdevsw_add_generic(CDEV_MAJOR, CDEV_MAJOR, &streams_cdevsw);
}
static int
streams_modevent(module_t mod, int type, void *unused)
{
switch (type) {
case MOD_LOAD:
streamsattach(NULL);
return 0;
case MOD_UNLOAD:
cdevsw[CDEV_MAJOR] = NULL; /* clean up cdev */
return 0;
default:
break;
}
return 0;
}
static moduledata_t streams_mod = {
"streams",
streams_modevent,
0
};
DECLARE_MODULE(streams, streams_mod, SI_SUB_DRIVERS, SI_ORDER_ANY);
/*
* We only need open() and close() routines. open() calls socreate()
* to allocate a "real" object behind the stream and mallocs some state

View File

@ -1,4 +1,4 @@
# $Id: Makefile,v 1.49 1999/01/30 06:31:51 newton Exp $
# $Id: Makefile,v 1.50 1999/02/03 04:18:25 semenu Exp $
# XXX present but broken: ip_mroute_mod
# XXX not yet completed porting: acd
@ -9,7 +9,8 @@ SUBDIR= ccd cd9660 coda fdesc if_disc if_ppp if_sl if_tun ipfw kernfs \
# XXX some of these can move to the general case when de-i386'ed
.if ${MACHINE_ARCH} == "i386"
SUBDIR+=atapi coff fpu gnufpu ibcs2 joy linux lkm pcic splash syscons vesa svr4
SUBDIR+=atapi coff fpu gnufpu ibcs2 joy linux lkm pcic splash streams \
syscons vesa svr4
.endif
.include <bsd.subdir.mk>

View File

@ -1,12 +1,18 @@
#!/bin/sh
# $Id$
# $Id: svr4.sh,v 1.1 1999/01/30 06:29:48 newton Exp $
FOUND=`kldstat -v | egrep 'svr4elf'`
STREAMS=`kldstat -v | egrep 'streams'`
SVR4=`kldstat -v | egrep 'svr4elf'`
if [ "x$FOUND" != x ] ; then
if [ "x$SVR4" != x ] ; then
echo SysVR4 driver already loaded
exit 1
else
if [ "x$STREAMS" = x ] ; then
kldload streams
echo "Loaded SysVR4 STREAMS driver"
fi
kldload svr4
echo "Loaded SysVR4 emulator"
fi