summaryrefslogtreecommitdiffstats
path: root/share/examples/lkm
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1995-08-12 17:26:37 +0000
committerjoerg <joerg@FreeBSD.org>1995-08-12 17:26:37 +0000
commit13b5465e8159059191903095fbaf94522f402482 (patch)
tree08694c83109e186fe634439cef90053cad70b54b /share/examples/lkm
parenta85ef14c30bb816052d67429f6ca15999eb309f3 (diff)
downloadFreeBSD-src-13b5465e8159059191903095fbaf94522f402482.zip
FreeBSD-src-13b5465e8159059191903095fbaf94522f402482.tar.gz
Make this example actually compile again. Rename the module so that
it will get a unique .o file name, and convert the module's Makefile to use <bsd.mod.mk>.
Diffstat (limited to 'share/examples/lkm')
-rw-r--r--share/examples/lkm/syscall/module/Makefile29
-rw-r--r--share/examples/lkm/syscall/module/newsyscall.c6
-rw-r--r--share/examples/lkm/syscall/test/Makefile6
3 files changed, 14 insertions, 27 deletions
diff --git a/share/examples/lkm/syscall/module/Makefile b/share/examples/lkm/syscall/module/Makefile
index 7090e86..602b7a8 100644
--- a/share/examples/lkm/syscall/module/Makefile
+++ b/share/examples/lkm/syscall/module/Makefile
@@ -35,31 +35,14 @@
# SUCH DAMAGE.
#
-SRCS=newsyscall.c
-OBJS=$(SRCS:.c=.o)
+BINDIR= /tmp
+SRCS= mycall.c newsyscall.c
+KMOD= new_syscall
+NOMAN= none
-KSRCS=mycall.c
-KOBJS=mycall.o
-
-MODOBJ=combined.o
-
-KMOD=newsyscall
-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/syscall/module/newsyscall.c b/share/examples/lkm/syscall/module/newsyscall.c
index 3b690c2..69d1f09 100644
--- a/share/examples/lkm/syscall/module/newsyscall.c
+++ b/share/examples/lkm/syscall/module/newsyscall.c
@@ -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>
@@ -58,7 +60,7 @@ static struct sysent newent = {
0, mycall /* # of args, function pointer*/
};
-MOD_SYSCALL( "newsyscall", -1, &newent)
+MOD_SYSCALL( "new_syscall", -1, &newent)
/*
@@ -101,7 +103,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).
*/
-newsyscall( lkmtp, cmd, ver)
+new_syscall( lkmtp, cmd, ver)
struct lkm_table *lkmtp;
int cmd;
int ver;
diff --git a/share/examples/lkm/syscall/test/Makefile b/share/examples/lkm/syscall/test/Makefile
index 7399c2f..419a19c 100644
--- a/share/examples/lkm/syscall/test/Makefile
+++ b/share/examples/lkm/syscall/test/Makefile
@@ -38,6 +38,8 @@
PROG= testsyscall
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 +50,7 @@ load:
@echo "system console each time it is run."
@echo
@echo
- /sbin/modstat -n newsyscall
+ ${MODSTAT} -n new_syscall
@echo
@./testsyscall
@@ -57,7 +59,7 @@ unload:
@echo "has been successfully unloaded by building 'unload' in"
@echo "the 'module' subdirectory."
@echo
- /sbin/modstat -n newsyscall
+ ${MODSTAT} -n new_syscall
.include <bsd.prog.mk>
OpenPOWER on IntegriCloud