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>.
This commit is contained in:
parent
a85ef14c30
commit
13b5465e81
@ -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
|
||||
#
|
||||
|
@ -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;
|
||||
|
@ -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>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user