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
This commit is contained in:
Joerg Wunsch 1995-07-27 09:45:28 +00:00
parent b124e4f284
commit f4734ea953
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9732
5 changed files with 28 additions and 33 deletions

View File

@ -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
#

View File

@ -37,6 +37,7 @@
*/
#include <sys/param.h>
#include <sys/ioctl.h>
#include <sys/proc.h>
#include <sys/systm.h>

View File

@ -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;

View File

@ -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>

View File

@ -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);