diff options
author | joerg <joerg@FreeBSD.org> | 1995-07-27 09:45:28 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1995-07-27 09:45:28 +0000 |
commit | 7cccd0e4ec8808c8954fd54d10d748567d9cb0e7 (patch) | |
tree | c4ac1fb31564136e84366d486dc1110e394a3cbb /share | |
parent | 39a85a58ed8d6e8e315fe2b097174f032de724c4 (diff) | |
download | FreeBSD-src-7cccd0e4ec8808c8954fd54d10d748567d9cb0e7.zip FreeBSD-src-7cccd0e4ec8808c8954fd54d10d748567d9cb0e7.tar.gz |
Make this bugger actually compile and work again:
o a couple of header files have been missing
o convert the LKM Makefile to use <bsd.kmod.mk>
o rename the module to ``misc_mod'' (as opposed to ``miscmod''), so
the module name can be made identical to the module's file name,
avoiding the clash with one of the component's .o file names
o modstat(1/8) has been moved meanwhile
Diffstat (limited to 'share')
-rw-r--r-- | share/examples/lkm/misc/module/Makefile | 32 | ||||
-rw-r--r-- | share/examples/lkm/misc/module/misccall.c | 1 | ||||
-rw-r--r-- | share/examples/lkm/misc/module/miscmod.c | 14 | ||||
-rw-r--r-- | share/examples/lkm/misc/test/Makefile | 9 | ||||
-rw-r--r-- | share/examples/lkm/misc/test/testmisc.c | 5 |
5 files changed, 28 insertions, 33 deletions
diff --git a/share/examples/lkm/misc/module/Makefile b/share/examples/lkm/misc/module/Makefile index 562a75d..edb2998 100644 --- a/share/examples/lkm/misc/module/Makefile +++ b/share/examples/lkm/misc/module/Makefile @@ -34,32 +34,16 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # +# $Id$ +# +BINDIR= /tmp +SRCS= misccall.c miscmod.c +KMOD= misc_mod +NOMAN= none -SRCS=miscmod.c -OBJS=$(SRCS:.c=.o) - -KSRCS=misccall.c -KOBJS=misccall.o - -MODOBJ=combined.o - -KMOD=miscmod -CFLAGS= -DKERNEL -I/sys/sys -I/sys - -all: $(MODOBJ) - -clean: - rm -f $(OBJS) $(KOBJS) $(MODOBJ) $(KMOD) - -load: - /sbin/modload -o $(KMOD) -e$(KMOD) $(MODOBJ) - -unload: - /sbin/modunload -n $(KMOD) - -$(MODOBJ): $(OBJS) $(KOBJS) - $(LD) -r -o $(MODOBJ) $(OBJS) $(KOBJS) +CLEANFILES+= ${KMOD} +.include <bsd.kmod.mk> # # EOF -- This file has not been truncated # diff --git a/share/examples/lkm/misc/module/misccall.c b/share/examples/lkm/misc/module/misccall.c index 86741c4..5cadafc 100644 --- a/share/examples/lkm/misc/module/misccall.c +++ b/share/examples/lkm/misc/module/misccall.c @@ -37,6 +37,7 @@ */ #include <sys/param.h> #include <sys/ioctl.h> +#include <sys/proc.h> #include <sys/systm.h> diff --git a/share/examples/lkm/misc/module/miscmod.c b/share/examples/lkm/misc/module/miscmod.c index cc992aa..0f5a38f 100644 --- a/share/examples/lkm/misc/module/miscmod.c +++ b/share/examples/lkm/misc/module/miscmod.c @@ -1,6 +1,6 @@ /* 25 May 93*/ /* - * Makefile for miscmod + * miscmod.c * * 05 Jun 93 Terry Lambert Split mycall.c out * 25 May 93 Terry Lambert Original @@ -38,10 +38,12 @@ */ #include <sys/param.h> #include <sys/ioctl.h> +#include <sys/proc.h> #include <sys/systm.h> #include <sys/conf.h> #include <sys/mount.h> #include <sys/exec.h> +#include <sys/sysent.h> #include <sys/lkm.h> #include <a.out.h> #include <sys/file.h> @@ -63,7 +65,12 @@ static struct sysent newent = { */ static struct sysent oldent; /* save are for old callslot entry*/ -MOD_MISC( "miscmod") +/* + * Number of syscall entries for a.out executables + */ +#define nsysent (aout_sysvec.sv_size) + +MOD_MISC( "misc_mod") /* @@ -90,7 +97,6 @@ int cmd; int i; struct lkm_misc *args = lkmtp->private.lkm_misc; int err = 0; /* default = success*/ - extern int nsysent; /* init_sysent.c*/ extern int lkmnosys(); /* allocable slot*/ switch( cmd) { @@ -175,7 +181,7 @@ int cmd; * The entry point should return 0 unless it is refusing load (in which * case it should return an errno from errno.h). */ -miscmod( lkmtp, cmd, ver) +misc_mod( lkmtp, cmd, ver) struct lkm_table *lkmtp; int cmd; int ver; diff --git a/share/examples/lkm/misc/test/Makefile b/share/examples/lkm/misc/test/Makefile index 466e4ac..61bbf37 100644 --- a/share/examples/lkm/misc/test/Makefile +++ b/share/examples/lkm/misc/test/Makefile @@ -34,10 +34,13 @@ # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF # SUCH DAMAGE. # - +# $Id$ +# PROG= testmisc NOMAN= +MODSTAT= /usr/bin/modstat + load: @echo "This test program will call the sample system call;" @echo "the "offset requested will be shown as 'Off' in the" @@ -48,7 +51,7 @@ load: @echo "system console each time it is run." @echo @echo - /sbin/modstat -n miscmod + ${MODSTAT} -n misc_mod @echo @./testmisc @@ -57,7 +60,7 @@ unload: @echo "has been successfully unloaded by building 'unload' in" @echo "the 'module' subdirectory." @echo - /sbin/modstat -n miscmod + ${MODSTAT} -n misc_mod .include <bsd.prog.mk> diff --git a/share/examples/lkm/misc/test/testmisc.c b/share/examples/lkm/misc/test/testmisc.c index 622857d..83f3338 100644 --- a/share/examples/lkm/misc/test/testmisc.c +++ b/share/examples/lkm/misc/test/testmisc.c @@ -46,12 +46,13 @@ main() int err = 0; printf( "Table offset as reported by modstat: "); - if( gets( buf) == NULL) { + fflush( stdout); + if( fgets( buf, 80, stdin) == NULL) { printf( "[ABORT]\n"); exit( 1); } - if( err = syscall( atoi( buf) /* no arguments*/)) + if(( err = syscall( atoi( buf) /* no arguments*/))) perror( "syscall"); exit( err); |