summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
Diffstat (limited to 'share')
-rw-r--r--share/lkm/Makefile17
-rw-r--r--share/lkm/README219
-rw-r--r--share/lkm/misc/Makefile49
-rw-r--r--share/lkm/misc/README89
-rw-r--r--share/lkm/misc/module/Makefile66
-rw-r--r--share/lkm/misc/module/misccall.c77
-rw-r--r--share/lkm/misc/module/miscmod.c188
-rw-r--r--share/lkm/misc/test/Makefile67
-rw-r--r--share/lkm/misc/test/testmisc.c61
-rw-r--r--share/lkm/syscall/Makefile50
-rw-r--r--share/lkm/syscall/README69
-rw-r--r--share/lkm/syscall/module/Makefile66
-rw-r--r--share/lkm/syscall/module/mycall.c76
-rw-r--r--share/lkm/syscall/module/newsyscall.c114
-rw-r--r--share/lkm/syscall/test/Makefile67
-rw-r--r--share/lkm/syscall/test/testsyscall.c61
16 files changed, 0 insertions, 1336 deletions
diff --git a/share/lkm/Makefile b/share/lkm/Makefile
deleted file mode 100644
index d727fe73ec2..00000000000
--- a/share/lkm/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
-# $OpenBSD: Makefile,v 1.4 2005/11/24 12:08:15 pedro Exp $
-#
-#
-
-FILES= README syscall misc
-NOOBJ= noobj
-
-all clean cleandir depend lint tags:
-
-install:
- find ${FILES} -follow -name CVS -prune -o -type f -print | \
- cpio -pdumL ${DESTDIR}${BINDIR}/lkm
- chown -R ${BINOWN}:${BINGRP} ${DESTDIR}${BINDIR}/lkm
- find ${DESTDIR}${BINDIR}/lkm -type f -print0 | xargs -0r chmod a=rX
- find ${DESTDIR}${BINDIR}/lkm -type d -print0 | xargs -0r chmod u=rwX,go=rX
-
-.include <bsd.prog.mk>
diff --git a/share/lkm/README b/share/lkm/README
deleted file mode 100644
index f3571db4925..00000000000
--- a/share/lkm/README
+++ /dev/null
@@ -1,219 +0,0 @@
-# $OpenBSD: README,v 1.5 2003/07/09 07:44:29 tedu Exp $
-#
-# Copyright (c) 1993 Terrence R. Lambert.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by Terrence R. Lambert.
-# 4. The name Terrence R. Lambert may not be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-#
-# THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-#
-
-0.0 README
-
- README file for the loadable kernel modules interface.
-
- Direct questions and comments to:
-
- Terry Lambert
- terry@cs.weber.edu
-
- Please do *not* mail me at Novell.
-
-
-1.0 About this build hierarchy
-
- This is the build hierarchy for the loadable kernel modules
- (lkm) command line interface and test suite (including a
- set of sample code for each possible module type).
-
- The procedures in this file assume you have installed the
- kernel portions of the lkm system and have rebooted your
- machine so that they are ready for use.
-
- If you have not done this, then there is no reason for you to
- continue; please take the time to install the lkm system into
- your kernel at this time.
-
-
-2.0 Compiler warnings
-
- Some compiler warnings will occur due to inclusion of kernel
- and non-kernel header files in the same program that have had
- the same function names ANSIfied and the prototypes for the
- kernel and libc functions conflict. This needs to be resolved
- by fixing the header files, which I haven't bothered to do (the
- main conflict was "printf", and I made a dirty hack to get
- around it until the header files have been fixed).
-
-
-3.0 Usage warnings
-
- Loading a bogus module will kill your machine, but if you are
- doing development, this will end up happening (hopefully)
- less frequently than changing, recompiling, installing, and
- rebooting would normally occur. This should speed development
- considerably for a lot of the in-kernel work that is currently
- taking place.
-
-
-4.0 Loadable module types supported
-
- There are six loadable modules types supported; five of these are
- specific module types; the sixth is to allow the user to make
- their own loader as part of the module and allow them to replace
- or extend appropriate tables in the kernel.
-
-
-4.1 System call modules
-
- System calls as loadable modules use one of two approaches.
-
- If the system call slot is unspecified (-1), it will attempt
- to locate (and allocate) the next free call slot that points
- to the address of the "lkmnosys" function (an alias for the
- "nosys" function). It replaces this with the user's call;
- the user can tell which slot was allocated using the "modstat"
- command (the call slot is indicated by the value of "Off").
-
- If the system call slot is specified, it will replace that
- specific call (assuming it is in range of the entries in the
- sysent[] table). Care should be taken when replacing system
- calls. Good candidates are calls that the user is attempting
- to repair or make POSIX compliant. It is possible to replace
- all calls, although care should be taken with the "ioctl()"
- call, as it is the interface for the lkm loader.
-
- When unloaded, the system call module replaces the previous
- contents of the call slot. If this was an allocable slot, it
- is now reallocable; if it was a particular call slot, the
- previous function is restored.
-
- The directory ./sample/syscall contains a sample implementation
- of a loadable system call.
-
-
-4.2 Virtual file system modules
-
- A virtual file system can be loaded as a module. The example
- provided is for the "kernfs" file system; this is the code in
- NetBSD's /sys/kernfs combined in a single object with another
- piece of code giving a module entry point for the file system;
- with very little effort, any file system can be set up this way
- (although I suggest you leave "ufs" statically linked, since
- it is necessary for booting).
-
- The critical section of loading a VFS is to get the entry in
- the right slot and mounted.
-
- Because of the dependency on the vfssw[] table index during
- the mount, we can't simply mix and match file systems except
- in their predefined locations with regard to mount. This
- means that there are changes to vfssw[] and mount coming
- down the road (which will end up incrementing the lkm version
- and introducing an incompatibility as far as file system modules
- are concerned).
-
- The directory ./sample/vfs contains the sample implementation
- of the loadable kernfs vfs.
-
-
-4.3 Device driver modules
-
- The major issue to deal with when creating device drivers is
- ensuring the creation of the device node. The current approach
- to this is executing a module specific shell script upon a
- successful load.
-
- A potentially better solution is encoding the device name in
- the device switch, or, better, providing a functional interface
- to the init routine, and then using a "/devices" file system
- to export devices to the file system name space. Of course,
- the default "/dev" directory would have to be maintained for
- compatibility (probably using symbolic links).
-
- This distribution does not contain a loadable device driver
- example. A potentially beneficial example could be made of
- the "lpa" interruptless printer driver.
-
-
-4.4 Streams modules
-
- Streams module support has been removed from this release; when
- the streams implementation is ready, it will be restored as a
- patch.
-
- Please do not ask me for early availability on my streams
- implementation; until I have some non-proprietary modules
- to distribute, I'm putting work on it on the back burner
- while I finish shared libraries.
-
-
-4.5 Execution interpreters
-
- Execution interpreters allow loading of programs with magic
- numbers other than the default numbers supported by NetBSD.
- This allows user space development of changes in exec format
- to support, among other things, shared libraries.
-
- Another potential use requires changing the references to
- the "sysent[]" system call table from direct references to
- indirect through a pointer in the proc struct. This allows
- the execution interpreter to, among other things, support
- (statically linked) executables from other environments,
- like XENIX, SVR3, SVR4, and Linux.
-
- There is no example of a loadable execution interpreter
- provided with this distribution.
-
-
-4.6 Miscellaneous modules
-
- Miscellaneous modules are modules for which there is not a
- current, well-defined, or well-used interface for extension.
- They are provided for extension, and the user is expected to
- write their own loader to handle the kernel pointer/table
- manipulation to "wire in" their loaded module (and "unwire"
- it on unload).
-
- One example of a "miscellaneous module" might be a loader for
- card-specific VGA drivers or alternate terminal emulations in
- an appropriately layered console driver.
-
- The table manipulations required are specific to the console
- interface, yet a loadable module may be used if code is written
- to tell it how to manipulate the interfaces within the internal
- console interfaces.
-
- An example of a "miscellaneous module" is provided to show how
- to write "miscellaneous modules"; it duplicates the functionality
- of the "system call" module type, and is not intended to be
- seriously used, as it could interfere with the "system call"
- module type. The sample code is located in ./sample/misc.
-
-
-
-5.0 END OF DOCUMENT
diff --git a/share/lkm/misc/Makefile b/share/lkm/misc/Makefile
deleted file mode 100644
index af1f7969cfb..00000000000
--- a/share/lkm/misc/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2000/03/02 14:46:36 todd Exp $
-#
-# Makefile for sample loadable system call
-#
-# 25 May 93 Terry Lambert Original
-#
-# Copyright (c) 1993 Terrence R. Lambert.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by Terrence R. Lambert.
-# 4. The name Terrence R. Lambert may not be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-#
-# THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-#
-
-SUBDIR= module test
-
-load: _SUBDIRUSE
-
-unload: _SUBDIRUSE
-
-.include <bsd.subdir.mk>
-
-#
-# EOF -- This file has not been truncated.
-#
diff --git a/share/lkm/misc/README b/share/lkm/misc/README
deleted file mode 100644
index 2dba2f3e8d0..00000000000
--- a/share/lkm/misc/README
+++ /dev/null
@@ -1,89 +0,0 @@
-# $OpenBSD: README,v 1.2 2000/03/02 14:46:36 todd Exp $
-#
-# Copyright (c) 1993 Terrence R. Lambert.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by Terrence R. Lambert.
-# 4. The name Terrence R. Lambert may not be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-#
-# THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-#
-
-1.0 Overview
-
- This is the README file for the sample miscellaneous module
- that mimics the loaded system call.
-
- A miscellaneous module may be used to load any data or
- program into the kernel that can be made available by
- modifying a table, pointer, or other kernel data to inform
- the kernel that the module should be used instead of the
- previous code/data path.
-
- Generally, it is assumed that a loadable module is one of
- a set of similar modules (such as a file system or console
- terminal emulation), and that the reference is through a
- table (such as vfssw[]), and that a "special" value is
- assigned to the slots which are allowed to be replaced.
- This is not enforced, so you may use the "miscellaneous"
- module any way you see fit.
-
- As with the loadable system calls, it may be desirable to
- allow the module loader to replace an *existing* entry to
- try out changes to kernel code without rebuilding and
- booting from the new kernel.
-
-
-2.0 Directions
-
- To test the module, do the following:
-
- cd module
- make load
-
- A load message (the copyright) will be printed on the console.
-
- cd ../test
- make load
-
- The system call prints a message on the console when called.
- This message will be printed when running "make load" in
- the "test" subdirectory.
-
-
-3.0 Recovering resources
-
- The miscellaneous module consumes 8 pages of memory when
- loaded; it can be freed up by unloading it. To unload it,
- type the following from the directory this file is in:
-
- cd module
- make unload
-
- The miscellaneous module will be unloaded by name.
-
-
-4.0 END OF DOCUMENT
diff --git a/share/lkm/misc/module/Makefile b/share/lkm/misc/module/Makefile
deleted file mode 100644
index 978f9d49c61..00000000000
--- a/share/lkm/misc/module/Makefile
+++ /dev/null
@@ -1,66 +0,0 @@
-# $OpenBSD: Makefile,v 1.3 2000/03/02 14:46:36 todd Exp $
-#
-# Makefile for miscmod
-#
-# 05 Jun 93 Terry Lambert Original
-#
-# Copyright (c) 1993 Terrence R. Lambert.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by Terrence R. Lambert.
-# 4. The name Terrence R. Lambert may not be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-#
-# THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-#
-
-SRCS=miscmod.c
-OBJS=$(SRCS:.c=.o)
-
-KSRCS=misccall.c
-KOBJS=misccall.o
-
-MODOBJ=combined.o
-
-KMOD=miscmod
-CFLAGS+= -D_KERNEL -I/sys
-
-all: $(MODOBJ)
-
-clean:
- rm -f $(OBJS) $(KOBJS) $(MODOBJ) $(KMOD)
-
-load:
- modload -o $(KMOD) -e$(KMOD) $(MODOBJ)
-
-unload:
- modunload -n $(KMOD)
-
-$(MODOBJ): $(OBJS) $(KOBJS)
- $(LD) -r -o $(MODOBJ) $(OBJS) $(KOBJS)
-
-#
-# EOF -- This file has not been truncated
-#
diff --git a/share/lkm/misc/module/misccall.c b/share/lkm/misc/module/misccall.c
deleted file mode 100644
index 4c2726d5e72..00000000000
--- a/share/lkm/misc/module/misccall.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* $OpenBSD: misccall.c,v 1.2 2000/03/02 14:46:36 todd Exp $ */
-/*
- * misccall.c
- *
- * 05 Jun 93 Terry Lambert Split out of newsyscall.c
- *
- * Copyright (c) 1993 Terrence R. Lambert.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Terrence R. Lambert.
- * 4. The name Terrence R. Lambert may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/systm.h>
-
-
-/*
- * This is the actual code for system call... it can be static because
- * we've externed it up above... the only plae it needs to be referenced
- * is the sysent we are interested in.
- *
- * To write your own system call using this as a template, you could strip
- * out this code and use the rest as a prototype module, changing only the
- * function names and the number of arguments to the call in the module
- * specific "sysent".
- *
- * You would have to use the "-R" option of "ld" to ensure a linkable file
- * if you were to do this, since you would need to combine multiple ".o"
- * files into a single ".o" file for use by "modload".
- */
-int
-misccall( p, uap, retval)
-struct proc *p;
-void *uap;
-int retval[];
-{
- /*
- * Our new system call simply prints a message; it takes no
- * arguments.
- */
-
- printf( "\nI am a loaded system call using the miscellaneous\n");
- printf( "module loader interface and a kernel printf!\n");
- printf( "I will print this message each time I am called!\n");
-
- return( 0); /* success (or error code from errno.h)*/
-}
-
-/*
- * EOF -- This file has not been truncated.
- */
diff --git a/share/lkm/misc/module/miscmod.c b/share/lkm/misc/module/miscmod.c
deleted file mode 100644
index c3026269c0a..00000000000
--- a/share/lkm/misc/module/miscmod.c
+++ /dev/null
@@ -1,188 +0,0 @@
-/* $OpenBSD: miscmod.c,v 1.5 2009/11/13 22:10:06 deraadt Exp $ */
-/*
- * Makefile for miscmod
- *
- * 05 Jun 93 Terry Lambert Split mycall.c out
- * 25 May 93 Terry Lambert Original
- *
- * Copyright (c) 1993 Terrence R. Lambert.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Terrence R. Lambert.
- * 4. The name Terrence R. Lambert may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/mount.h>
-#include <sys/exec.h>
-#include <sys/lkm.h>
-#include <sys/file.h>
-#include <sys/errno.h>
-#include <sys/syscall.h>
-
-
-extern int misccall();
-
-/*
- * These two entries define our system call and module information. We
- * have 0 arguments to our system call.
- */
-static struct sysent newent = {
- 0, 0, 0, misccall /* # of args, args size, flags, fn pointer*/
-};
-
-/*
- * Miscellaneous modules must have their own save areas...
- */
-static struct sysent oldent; /* save are for old callslot entry*/
-
-MOD_MISC( "miscmod")
-
-
-/*
- * This function is called each time the module is loaded or unloaded.
- * Since we are a miscellaneous module, we have to provide whatever
- * code is necessary to patch ourselves into the area we are being
- * loaded to change.
- *
- * For the system call table, we duplicate the code in the kern_lkm.c
- * file for patching into the system call table. We can tell what
- * has been allocated, etc. by virtue of the fact that we know the
- * criteria used by the system call loader interface. We still
- * kick out the copyright to the console here (to give an example).
- *
- * The stat information is basically common to all modules, so there
- * is no real issue involved with stat; we will leave it lkm_nofunc(),
- * since we don't have to do anything about it.
- */
-static int
-miscmod_handle( lkmtp, cmd)
-struct lkm_table *lkmtp;
-int cmd;
-{
- int i;
- struct lkm_misc *args = lkmtp->private.lkm_misc;
- int err = 0; /* default = success*/
- extern int sys_lkmnosys(); /* allocable slot*/
-
- switch( cmd) {
- case LKM_E_LOAD:
-
- /*
- * Don't load twice! (lkmexists() is exported by kern_lkm.c)
- */
- if( lkmexists( lkmtp))
- return( EEXIST);
-
- /*
- * This is where we would express a slot preference if
- * we had one; since we don't, we will simply duplicate
- * the "auto" code and forget the other.
- */
-
- /*
- * Search the table looking for a slot...
- */
- for( i = 0; i < SYS_MAXSYSCALL; i++)
- if( sysent[ i].sy_call == sys_lkmnosys)
- break; /* found it!*/
- /* out of allocable slots?*/
- if( i == SYS_MAXSYSCALL) {
- err = ENFILE;
- break;
- }
-
- /* save old -- we must provide our own data area*/
- bcopy( &sysent[ i], &oldent, sizeof( struct sysent));
-
- /* replace with new*/
- bcopy( &newent, &sysent[ i], sizeof( struct sysent));
-
- /* done!*/
- args->lkm_offset = i; /* slot in sysent[]*/
-
-
- /* if we make it to here, print copyright on console*/
- printf( "\nSample Loaded miscellaneous module (system call)\n");
- printf( "Copyright (c) 1993\n");
- printf( "Terrence R. Lambert\n");
- printf( "All rights reserved\n");
-
- break; /* Success*/
-
- case LKM_E_UNLOAD:
- /* current slot...*/
- i = args->lkm_offset;
-
- /* replace current slot contents with old contents*/
- bcopy( &oldent, &sysent[ i], sizeof( struct sysent));
-
- break; /* Success*/
-
- default: /* we only understand load/unload*/
- err = EINVAL;
- break;
- }
-
- return( err);
-}
-
-
-/*
- * External entry point; should generally match name of .o file. The
- * arguments are always the same for all loaded modules. The "load",
- * "unload", and "stat" functions in "DISPATCH" will be called under
- * their respective circumstances. If no function is desired, lkm_nofunc()
- * should be supplied. They are called with the same arguments (cmd is
- * included to allow the use of a single function, ver is included for
- * version matching between modules and the kernel loader for the modules).
- *
- * Since we expect to link in the kernel and add external symbols to
- * the kernel symbol name space in a future version, generally all
- * functions used in the implementation of a particular module should
- * be static unless they are expected to be seen in other modules or
- * to resolve unresolved symbols alread existing in the kernel (the
- * second case is not likely to ever occur).
- *
- * 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)
-struct lkm_table *lkmtp;
-int cmd;
-int ver;
-{
- DISPATCH(lkmtp,cmd,ver,miscmod_handle,miscmod_handle,lkm_nofunc);
-}
-
-
-/*
- * EOF -- This file has not been truncated.
- */
diff --git a/share/lkm/misc/test/Makefile b/share/lkm/misc/test/Makefile
deleted file mode 100644
index 6a2e0d1a5e1..00000000000
--- a/share/lkm/misc/test/Makefile
+++ /dev/null
@@ -1,67 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2000/03/02 14:46:36 todd Exp $
-#
-# Makefile for testmisc
-#
-# 05 Jun 93 Terry Lambert Original
-#
-# Copyright (c) 1993 Terrence R. Lambert.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by Terrence R. Lambert.
-# 4. The name Terrence R. Lambert may not be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-#
-# THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-#
-
-PROG= testmisc
-NOMAN=
-
-load:
- @echo "This test program will call the sample system call;"
- @echo "the "offset requested will be shown as 'Off' in the"
- @echo "status display below. If no modules are loaded, an"
- @echo "error '3' will be reported."
- @echo
- @echo "The sample system call will display a message on the"
- @echo "system console each time it is run."
- @echo
- @echo
- modstat -n miscmod
- @echo
- @./testmisc
-
-unload:
- @echo "This test program will cause an error '3' if the call"
- @echo "has been successfully unloaded by building 'unload' in"
- @echo "the 'module' subdirectory."
- @echo
- modstat -n miscmod
-
-.include <bsd.prog.mk>
-
-#
-# EOF -- This file has not been truncated.
-#
diff --git a/share/lkm/misc/test/testmisc.c b/share/lkm/misc/test/testmisc.c
deleted file mode 100644
index e2cd336f2fd..00000000000
--- a/share/lkm/misc/test/testmisc.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $OpenBSD: testmisc.c,v 1.3 2001/11/20 13:59:50 kevlo Exp $ */
-/*
- * testmisc.c
- *
- * Test program to call the sample loaded miscellaneous system call.
- *
- * 05 Jun 93 Terry Lambert Original
- *
- *
- * Copyright (c) 1993 Terrence R. Lambert.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Terrence R. Lambert.
- * 4. The name Terrence R. Lambert may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-#include <stdio.h>
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- char buf[80];
- int err = 0;
-
- printf("Table offset as reported by modstat: ");
- if (fgets(buf, sizeof(buf), stdin) == NULL) {
- printf("[ABORT]\n");
- exit(1);
- }
-
- if (err = syscall(atoi(buf) /* no arguments*/))
- perror("syscall");
-
- exit(err);
-}
diff --git a/share/lkm/syscall/Makefile b/share/lkm/syscall/Makefile
deleted file mode 100644
index 636a6b8dce7..00000000000
--- a/share/lkm/syscall/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2000/03/02 14:46:37 todd Exp $
-#
-# Makefile for sample loadable system call
-#
-# 25 May 93 Terry Lambert Original
-#
-# Copyright (c) 1993 Terrence R. Lambert.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by Terrence R. Lambert.
-# 4. The name Terrence R. Lambert may not be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-#
-# THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-#
-
-# Makefile for sample loadable system call
-SUBDIR= module test
-
-load: _SUBDIRUSE
-
-unload: _SUBDIRUSE
-
-.include <bsd.subdir.mk>
-
-#
-# EOF -- This file has not been truncated.
-#
diff --git a/share/lkm/syscall/README b/share/lkm/syscall/README
deleted file mode 100644
index 0ea1fffcb5e..00000000000
--- a/share/lkm/syscall/README
+++ /dev/null
@@ -1,69 +0,0 @@
-# $OpenBSD: README,v 1.3 2000/03/02 14:46:37 todd Exp $
-#
-# Copyright (c) 1993 Terrence R. Lambert.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by Terrence R. Lambert.
-# 4. The name Terrence R. Lambert may not be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-#
-# THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-#
-
-1.0 Overview
-
- This is the README file for the sample loaded system call.
-
-
-2.0 Directions
-
- To test the module, do the following:
-
- cd module
- make load
-
- A load message (the copyright) will be printed on the console.
-
- cd ../test
- make load
-
- The system call prints a message on the console when called.
- This message will be printed when running "make load" in
- the "test" subdirectory.
-
-
-3.0 Recovering resources
-
- The system call consumes 8 pages of memory when loaded; it
- can be freed up by unloading it. To unload it, type the
- following from the directory this file is in:
-
- cd module
- make unload
-
- The system call will be unloaded by name.
-
-
-4.0 END OF DOCUMENT
diff --git a/share/lkm/syscall/module/Makefile b/share/lkm/syscall/module/Makefile
deleted file mode 100644
index eca53759e96..00000000000
--- a/share/lkm/syscall/module/Makefile
+++ /dev/null
@@ -1,66 +0,0 @@
-# $OpenBSD: Makefile,v 1.3 2000/03/02 14:46:37 todd Exp $
-#
-# Makefile for newsyscall
-#
-# 05 Jun 93 Terry Lambert Original
-#
-# Copyright (c) 1993 Terrence R. Lambert.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by Terrence R. Lambert.
-# 4. The name Terrence R. Lambert may not be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-#
-# THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-#
-
-SRCS=newsyscall.c
-OBJS=$(SRCS:.c=.o)
-
-KSRCS=mycall.c
-KOBJS=mycall.o
-
-MODOBJ=combined.o
-
-KMOD=newsyscall
-CFLAGS+= -D_KERNEL -I/sys
-
-all: $(MODOBJ)
-
-clean:
- rm -f $(OBJS) $(KOBJS) $(MODOBJ) $(KMOD)
-
-load:
- modload -o $(KMOD) -e$(KMOD) $(MODOBJ)
-
-unload:
- modunload -n $(KMOD)
-
-$(MODOBJ): $(OBJS) $(KOBJS)
- $(LD) -r -o $(MODOBJ) $(OBJS) $(KOBJS)
-
-#
-# EOF -- This file has not been truncated
-#
diff --git a/share/lkm/syscall/module/mycall.c b/share/lkm/syscall/module/mycall.c
deleted file mode 100644
index 53c55715523..00000000000
--- a/share/lkm/syscall/module/mycall.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/* $OpenBSD: mycall.c,v 1.2 2000/03/02 14:46:37 todd Exp $ */
-/*
- * mycall.c
- *
- * 05 Jun 93 Terry Lambert Split out of newsyscall.c
- *
- * Copyright (c) 1993 Terrence R. Lambert.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Terrence R. Lambert.
- * 4. The name Terrence R. Lambert may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/systm.h>
-
-
-/*
- * This is the actual code for system call... it can be static because
- * we've externed it up above... the only plae it needs to be referenced
- * is the sysent we are interested in.
- *
- * To write your own system call using this as a template, you could strip
- * out this code and use the rest as a prototype module, changing only the
- * function names and the number of arguments to the call in the module
- * specific "sysent".
- *
- * You would have to use the "-R" option of "ld" to ensure a linkable file
- * if you were to do this, since you would need to combine multiple ".o"
- * files into a single ".o" file for use by "modload".
- */
-int
-mycall( p, uap, retval)
-struct proc *p;
-void *uap;
-int retval[];
-{
- /*
- * Our new system call simply prints a message; it takes no
- * arguments.
- */
-
- printf( "\nI am a loaded system call using the kernel printf!\n");
- printf( "I will print this message each time I am called!\n");
-
- return( 0); /* success (or error code from errno.h)*/
-}
-
-/*
- * EOF -- This file has not been truncated.
- */
diff --git a/share/lkm/syscall/module/newsyscall.c b/share/lkm/syscall/module/newsyscall.c
deleted file mode 100644
index b4b6a9c0ace..00000000000
--- a/share/lkm/syscall/module/newsyscall.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* $OpenBSD: newsyscall.c,v 1.4 2009/11/13 22:10:09 deraadt Exp $ */
-/*
- * Makefile for newsyscall
- *
- * 05 Jun 93 Terry Lambert Split mycall.c out
- * 25 May 93 Terry Lambert Original
- *
- * Copyright (c) 1993 Terrence R. Lambert.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Terrence R. Lambert.
- * 4. The name Terrence R. Lambert may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/systm.h>
-#include <sys/conf.h>
-#include <sys/mount.h>
-#include <sys/exec.h>
-#include <sys/lkm.h>
-#include <sys/file.h>
-#include <sys/errno.h>
-
-
-extern int mycall();
-
-/*
- * These two entries define our system call and module information. We
- * have 0 arguments to our system call.
- */
-static struct sysent newent = {
- 0, 0, 0, mycall /* # of args, args size, flags, fn. pointer */
-};
-
-MOD_SYSCALL( "newsyscall", -1, &newent)
-
-
-/*
- * This function is called each time the module is loaded. Technically,
- * we could have made this "lkm_nofunc" in the "DISPATCH" in "newsyscall()",
- * but it's a convenient place to kick a copyright out to the console.
- */
-static int
-newsyscall_load( lkmtp, cmd)
-struct lkm_table *lkmtp;
-int cmd;
-{
- if( cmd == LKM_E_LOAD) { /* print copyright on console*/
- printf( "\nSample Loaded system call\n");
- printf( "Copyright (c) 1993\n");
- printf( "Terrence R. Lambert\n");
- printf( "All rights reserved\n");
- }
-
- return( 0);
-}
-
-
-/*
- * External entry point; should generally match name of .o file. The
- * arguments are always the same for all loaded modules. The "load",
- * "unload", and "stat" functions in "DISPATCH" will be called under
- * their respective circumstances. If no function is desired, lkm_nofunc()
- * should be supplied. They are called with the same arguments (cmd is
- * included to allow the use of a single function, ver is included for
- * version matching between modules and the kernel loader for the modules).
- *
- * Since we expect to link in the kernel and add external symbols to
- * the kernel symbol name space in a future version, generally all
- * functions used in the implementation of a particular module should
- * be static unless they are expected to be seen in other modules or
- * to resolve unresolved symbols alread existing in the kernel (the
- * second case is not likely to ever occur).
- *
- * 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)
-struct lkm_table *lkmtp;
-int cmd;
-int ver;
-{
- DISPATCH(lkmtp,cmd,ver,newsyscall_load,lkm_nofunc,lkm_nofunc);
-}
-
-
-/*
- * EOF -- This file has not been truncated.
- */
diff --git a/share/lkm/syscall/test/Makefile b/share/lkm/syscall/test/Makefile
deleted file mode 100644
index 0b52de49e7d..00000000000
--- a/share/lkm/syscall/test/Makefile
+++ /dev/null
@@ -1,67 +0,0 @@
-# $OpenBSD: Makefile,v 1.2 2000/03/02 14:46:38 todd Exp $
-#
-# Makefile for testsyscall
-#
-# 25 May 93 Terry Lambert Original
-#
-# Copyright (c) 1993 Terrence R. Lambert.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. All advertising materials mentioning features or use of this software
-# must display the following acknowledgement:
-# This product includes software developed by Terrence R. Lambert.
-# 4. The name Terrence R. Lambert may not be used to endorse or promote
-# products derived from this software without specific prior written
-# permission.
-#
-# THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
-# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
-# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
-# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-#
-#
-
-PROG= testsyscall
-NOMAN=
-
-load:
- @echo "This test program will call the sample system call;"
- @echo "the "offset requested will be shown as 'Off' in the"
- @echo "status display below. If no modules are loaded, an"
- @echo "error '3' will be reported."
- @echo
- @echo "The sample system call will display a message on the"
- @echo "system console each time it is run."
- @echo
- @echo
- modstat -n newsyscall
- @echo
- @./testsyscall
-
-unload:
- @echo "This test program will cause an error '3' if the call"
- @echo "has been successfully unloaded by building 'unload' in"
- @echo "the 'module' subdirectory."
- @echo
- modstat -n newsyscall
-
-.include <bsd.prog.mk>
-
-#
-# EOF -- This file has not been truncated.
-#
diff --git a/share/lkm/syscall/test/testsyscall.c b/share/lkm/syscall/test/testsyscall.c
deleted file mode 100644
index 2df65ac4952..00000000000
--- a/share/lkm/syscall/test/testsyscall.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* $OpenBSD: testsyscall.c,v 1.3 2001/11/20 13:59:52 kevlo Exp $ */
-/*
- * testsyscall.c
- *
- * Test program to call the sample loaded system call.
- *
- * 23 May 93 Terry Lambert Original
- *
- *
- * Copyright (c) 1993 Terrence R. Lambert.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by Terrence R. Lambert.
- * 4. The name Terrence R. Lambert may not be used to endorse or promote
- * products derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY TERRENCE R. LAMBERT ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE TERRENCE R. LAMBERT BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- */
-#include <stdio.h>
-
-int
-main(argc, argv)
- int argc;
- char* argv[];
-{
- char buf[80];
- int err = 0;
-
- printf("Table offset as reported by modstat: ");
- if (fgets(buf, sizeof(buf), stdin) == NULL) {
- printf("[ABORT]\n");
- exit(1);
- }
-
- if(err = syscall(atoi(buf) /* no arguments*/))
- perror("syscall");
-
- exit(err);
-}