summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1999-04-24 21:04:04 +0000
committerpeter <peter@FreeBSD.org>1999-04-24 21:04:04 +0000
commit552af2f2dc72bea78b269f6590489b03d4e92f30 (patch)
tree02a61588a371a11dc44a10edae8bfe819143011b /sbin
parent55287e726035b74a97ccf03a87c86b6dc10bf35c (diff)
downloadFreeBSD-src-552af2f2dc72bea78b269f6590489b03d4e92f30.zip
FreeBSD-src-552af2f2dc72bea78b269f6590489b03d4e92f30.tar.gz
The infrastructure to build these fellows has been replaced with kld.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/modload/Makefile42
-rw-r--r--sbin/modload/modload.8121
-rw-r--r--sbin/modload/modload.c404
-rw-r--r--sbin/modload/pathnames.h5
-rw-r--r--sbin/modunload/Makefile42
-rw-r--r--sbin/modunload/modunload.874
-rw-r--r--sbin/modunload/modunload.c125
-rw-r--r--sbin/modunload/pathnames.h3
8 files changed, 0 insertions, 816 deletions
diff --git a/sbin/modload/Makefile b/sbin/modload/Makefile
deleted file mode 100644
index bff8935..0000000
--- a/sbin/modload/Makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Makefile for modload
-#
-# 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.
-#
-# $Id$
-#
-
-PROG= modload
-MAN8= modload.8
-
-.include <bsd.prog.mk>
diff --git a/sbin/modload/modload.8 b/sbin/modload/modload.8
deleted file mode 100644
index 151f05c..0000000
--- a/sbin/modload/modload.8
+++ /dev/null
@@ -1,121 +0,0 @@
-.\" Copyright (c) 1993 Christopher G. Demetriou
-.\" 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. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
-.\"
-.\" $Id: modload.8,v 1.10 1997/02/22 14:32:39 peter Exp $
-.\"
-.Dd September 22, 1994
-.Dt MODLOAD 8
-.Os
-.Sh NAME
-.Nm modload
-.Nd load a kernel module
-.Sh SYNOPSIS
-.Nm modload
-.Op Fl dquv
-.Op Fl A Ar kernel
-.Op Fl e Ar entry
-.Op Fl p Ar postinstall
-.Op Fl o Ar output_file
-.Ar input_file
-.Sh DESCRIPTION
-The
-.Nm
-utility loads a loadable kernel module into a running system.
-The input file is an object file (.o file).
-.Pp
-The options to
-.Nm
-are as follows:
-.Bl -tag -width indent
-.It Fl d
-Debug. Used to debug
-.Nm
-itself.
-.It Fl q
-Be very quiet.
-.It Fl u
-Delete the loaded module
-.Pq Ar output_file
-after loading. If the output file was not specified, this option causes the
-temporary file to be kept rather than deleted.
-.It Fl v
-Print comments about the loading process.
-.It Fl A Ar kernel
-Specify the file that is passed to the linker
-to resolve module references to external symbols.
-The symbol file must be for the currently running
-kernel or the module is likely to crash the system.
-.It Fl e Ar entry
-Specify the module entry point.
-This is passed by
-.Nm
-to
-.Xr ld 1
-when the module is linked.
-The default module entry point name is the module name with `_mod' appended.
-.It Fl p Ar postinstall
-Specify the name of a shell script or program that will
-be executed if the module is successfully loaded. It
-is always passed the module id (in decimal) and module
-type (in hexadecimal) as the first two arguments.
-For loadable drivers, the third argument is
-the block or character major device number.
-For a loadable system call, the third argument is the system
-call number.
-.It Fl o Ar output_file
-Specify the name of the output file that is produced by
-the linker. If this option is not specified, a file in the /tmp directory
-is used with the name generated from the module name with a `.out' extension.
-.El
-.Sh FILES
-.Bl -tag -width /usr/include/sys/lkm.h -compact
-.It Pa /kernel
-default file passed to the linker to resolve external
-references in the module
-.It Pa /usr/include/sys/lkm.h
-file containing definitions of module types
-.\" .It Pa output file.
-.\" default output file name
-.Sh DIAGNOSTICS
-The
-.Nm
-utility exits with a status of 0 on success
-and with a nonzero status if an error occurs.
-.Sh SEE ALSO
-.Xr ld 1 ,
-.Xr lkm 4 ,
-.Xr modstat 8 ,
-.Xr modunload 8
-.Sh HISTORY
-The
-.Nm
-command was designed to be similar in functionality
-to the corresponding command in
-.Tn "SunOS 4.1.3" .
-.Sh AUTHORS
-.An Terrence R. Lambert Aq terry@cs.weber.edu
-.Sh BUGS
-The loadable device driver framework can
-only reserve either a character or block device entry, not both.
diff --git a/sbin/modload/modload.c b/sbin/modload/modload.c
deleted file mode 100644
index 4ef53fa..0000000
--- a/sbin/modload/modload.c
+++ /dev/null
@@ -1,404 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef lint
-static const char rcsid[] =
- "$Id: modload.c,v 1.22 1998/07/06 07:07:41 charnier Exp $";
-#endif /* not lint */
-
-#include <a.out.h>
-#include <err.h>
-#include <errno.h>
-#include <limits.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <sys/param.h>
-#include <sys/ioccom.h>
-#include <sys/lkm.h>
-#include <sys/file.h>
-#include <sys/wait.h>
-#include "pathnames.h"
-
-#define min(a, b) ((a) < (b) ? (a) : (b))
-
-int debug = 0;
-int verbose = 0;
-int quiet = 0;
-int dounlink = 0;
-
-/*
- * Expected linker options:
- *
- * -A executable to link against
- * -e entry point
- * -o output file
- * -T address to link to in hex (assumes it's a page boundry)
- * <target> object file
- */
-
-void
-linkcmd(kernel, entry, outfile, address, object)
- char *kernel, *entry, *outfile;
- u_int address; /* XXX */
- char *object;
-{
- char addrbuf[32], entrybuf[_POSIX2_LINE_MAX];
- pid_t pid;
- int status;
-
- snprintf(entrybuf, sizeof entrybuf, "_%s", entry);
- snprintf(addrbuf, sizeof addrbuf, "%x", address);
-
- if (debug)
- printf("%s -A %s -e %s -o %s -T %s %s\n",
- _PATH_LD, kernel, entrybuf, outfile,
- addrbuf, object);
-
- pid = fork();
- if(pid < 0) {
- err(18, "fork");
- }
-
- if(pid == 0) {
- execl(_PATH_LD, "ld", "-aout", "-A", kernel, "-e", entrybuf,
- "-o", outfile, "-T", addrbuf, object, (char *)0);
- exit(128 + errno);
- }
-
- waitpid(pid, &status, 0);
-
- if(WIFSIGNALED(status)) {
- errx(1, "%s got signal: %s", _PATH_LD,
- sys_siglist[WTERMSIG(status)]);
- }
-
- if(WEXITSTATUS(status) > 128) {
- errno = WEXITSTATUS(status) - 128;
- err(1, "exec(%s)", _PATH_LD);
- }
-
- if(WEXITSTATUS(status) != 0) {
- errx(1, "%s: return code %d", _PATH_LD, WEXITSTATUS(status));
- }
-
-}
-
-void
-usage()
-{
-
- fprintf(stderr,
- "usage: modload [-d] [-v] [-q] [-u] [-A <kernel>] [-e <entry]\n");
- fprintf(stderr,
- " [-p <postinstall>] [-o <output file>] <input file>\n");
- exit(1);
-}
-
-int fileopen = 0;
-#define DEV_OPEN 0x01
-#define MOD_OPEN 0x02
-#define PART_RESRV 0x04
-int devfd, modfd;
-struct lmc_resrv resrv;
-
-void
-cleanup()
-{
- if (fileopen & PART_RESRV) {
- /*
- * Free up kernel memory
- */
- if (ioctl(devfd, LMUNRESRV, 0) == -1)
- warn("can't release slot 0x%08x memory", resrv.slot);
- }
-
- if (fileopen & DEV_OPEN)
- close(devfd);
-
- if (fileopen & MOD_OPEN)
- close(modfd);
-
- fileopen = 0;
-}
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int c;
- char *kname = (char *)getbootfile();
- char *entry = NULL;
- char *post = NULL;
- char *out = NULL;
- char *modobj;
- char modout[80], *p;
- struct exec info_buf;
- u_int modsize; /* XXX */
- u_int modentry; /* XXX */
-
- struct lmc_loadbuf ldbuf;
- int sz, bytesleft;
- char buf[MODIOBUF];
-
- while ((c = getopt(argc, argv, "dvquA:e:p:o:")) != -1) {
- switch (c) {
- case 'd':
- debug = 1;
- break; /* debug */
- case 'v':
- verbose = 1;
- break; /* verbose */
- case 'u':
- dounlink = 1;
- break;
- case 'q':
- quiet = 1;
- break;
- case 'A':
- kname = optarg;
- break; /* kernel */
- case 'e':
- entry = optarg;
- break; /* entry point */
- case 'p':
- post = optarg;
- break; /* postinstall */
- case 'o':
- out = optarg;
- break; /* output file */
- case '?':
- usage();
- default:
- printf("default!\n");
- break;
- }
- }
- argc -= optind;
- argv += optind;
-
- if (argc != 1)
- usage();
-
- modobj = argv[0];
-
- atexit(cleanup);
-
- /*
- * Open the virtual device device driver for exclusive use (needed
- * to write the new module to it as our means of getting it in the
- * kernel).
- */
- if ((devfd = open(_PATH_LKM, O_RDWR, 0)) == -1)
- err(3, _PATH_LKM);
- fileopen |= DEV_OPEN;
-
- p = strrchr(modobj, '.');
- if (!p || strcmp(p, ".o"))
- errx(2, "module object must end in .o");
-
- if (!out) {
- p = strrchr(modobj, '/');
- if (p)
- p++; /* skip over '/' */
- else
- p = modobj;
- snprintf(modout, sizeof modout, "%s%sut", _PATH_TMP, p);
- out = modout;
- /*
- * reverse meaning of -u - if we've generated a /tmp
- * file, remove it automatically...
- */
- dounlink = !dounlink;
- }
-
- if (!entry) { /* calculate default entry point */
- entry = strrchr(modobj, '/');
- if (entry)
- entry++; /* skip over '/' */
- else
- entry = modobj;
- entry = strdup(entry); /* so we can modify it */
- if (!entry)
- errx(1, "Could not allocate memory");
- entry[strlen(entry) - 2] = '\0'; /* chop off .o */
- }
-
- (void) unlink(out);
- modfd = open(out, O_RDWR | O_CREAT | O_EXCL, 0600);
- if(modfd < 0) {
- err(1, "creating %s", out);
- }
- close(modfd);
-
- /*
- * Prelink to get file size
- */
- linkcmd(kname, entry, out, 0, modobj);
-
- /*
- * Pre-open the 0-linked module to get the size information
- */
- if ((modfd = open(out, O_RDONLY, 0)) == -1)
- err(4, out);
- fileopen |= MOD_OPEN;
-
- /*
- * Get the load module post load size... do this by reading the
- * header and doing page counts.
- */
- if (read(modfd, &info_buf, sizeof(struct exec)) == -1)
- err(3, "read `%s'", out);
-
- /*
- * Close the dummy module -- we have our sizing information.
- */
- close(modfd);
- fileopen &= ~MOD_OPEN;
-
- /*
- * Magic number...
- */
- if (N_BADMAG(info_buf))
- errx(4, "not an a.out format file");
-
- /*
- * Calculate the size of the module
- */
- modsize = info_buf.a_text + info_buf.a_data + info_buf.a_bss;
-
- /*
- * Reserve the required amount of kernel memory -- this may fail
- * to be successful.
- */
- resrv.size = modsize; /* size in bytes */
- resrv.name = modout; /* objname w/o ".o" */
- resrv.slot = -1; /* returned */
- resrv.addr = 0; /* returned */
- if (ioctl(devfd, LMRESERV, &resrv) == -1)
- err(9, "can't reserve memory");
- fileopen |= PART_RESRV;
-
- /*
- * Relink at kernel load address
- */
- linkcmd(kname, entry, out, resrv.addr, modobj);
-
- /*
- * Open the relinked module to load it...
- */
- if ((modfd = open(out, O_RDONLY, 0)) == -1)
- err(4, out);
- fileopen |= MOD_OPEN;
-
- /*
- * Reread the header to get the actual entry point *after* the
- * relink.
- */
- if (read(modfd, &info_buf, sizeof(struct exec)) == -1)
- err(3, "read `%s'", out);
-
- /*
- * Get the entry point (for initialization)
- */
- modentry = info_buf.a_entry; /* place to call */
-
- /*
- * Seek to the text offset to start loading...
- */
- if (lseek(modfd, N_TXTOFF(info_buf), 0) == -1)
- err(12, "lseek");
-
- /*
- * Transfer the relinked module to kernel memory in chunks of
- * MODIOBUF size at a time.
- */
- for (bytesleft = info_buf.a_text + info_buf.a_data;
- bytesleft > 0;
- bytesleft -= sz) {
- sz = min(bytesleft, MODIOBUF);
- read(modfd, buf, sz);
- ldbuf.cnt = sz;
- ldbuf.data = buf;
- if (ioctl(devfd, LMLOADBUF, &ldbuf) == -1)
- err(11, "error transferring buffer");
- }
-
- /*
- * Save ourselves before disaster (potentially) strikes...
- */
- sync();
-
- /*
- * Trigger the module as loaded by calling the entry procedure;
- * this will do all necessary table fixup to ensure that state
- * is maintained on success, or blow everything back to ground
- * zero on failure.
- */
- if (ioctl(devfd, LMREADY, &modentry) == -1)
- err(14, "error initializing module");
-
- /*
- * Success!
- */
- fileopen &= ~PART_RESRV; /* loaded */
- if(!quiet) printf("Module loaded as ID %d\n", resrv.slot);
-
- if (dounlink && unlink(out))
- err(17, "unlink(%s)", out);
-
- if (post) {
- struct lmc_stat sbuf;
- char id[16], type[16], offset[16];
-
- sbuf.id = resrv.slot;
- if (ioctl(devfd, LMSTAT, &sbuf) == -1)
- err(15, "error fetching module stats for post-install");
- sprintf(id, "%d", sbuf.id);
- sprintf(type, "0x%x", sbuf.type);
- sprintf(offset, "%lu", sbuf.offset);
- /* XXX the modload docs say that drivers can install bdevsw &
- cdevsw, but the interface only supports one at a time. sigh. */
-
- /* Free resources before calling post-install program */
- cleanup();
-
- execl(post, post, id, type, offset, 0);
- err(16, "can't exec '%s'", post);
- }
-
- return 0;
-}
diff --git a/sbin/modload/pathnames.h b/sbin/modload/pathnames.h
deleted file mode 100644
index 4359013..0000000
--- a/sbin/modload/pathnames.h
+++ /dev/null
@@ -1,5 +0,0 @@
-/* $Id$ */
-#include <paths.h>
-
-#define _PATH_LKM "/dev/lkm"
-#define _PATH_LD "/usr/bin/ld"
diff --git a/sbin/modunload/Makefile b/sbin/modunload/Makefile
deleted file mode 100644
index 9d923a3..0000000
--- a/sbin/modunload/Makefile
+++ /dev/null
@@ -1,42 +0,0 @@
-#
-# Makefile for modunload
-#
-# 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.
-#
-# $Id$
-#
-
-PROG= modunload
-MAN8= modunload.8
-
-.include <bsd.prog.mk>
diff --git a/sbin/modunload/modunload.8 b/sbin/modunload/modunload.8
deleted file mode 100644
index 0b69267..0000000
--- a/sbin/modunload/modunload.8
+++ /dev/null
@@ -1,74 +0,0 @@
-.\" Copyright (c) 1993 Christopher G. Demetriou
-.\" 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. The name of the author may not be used to endorse or promote products
-.\" derived from this software without specific prior written permission
-.\"
-.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
-.\"
-.\" $Id: modunload.8,v 1.7 1997/02/22 14:32:42 peter Exp $
-.\"
-.Dd June 7, 1993
-.Dt MODUNLOAD 8
-.Os
-.Sh NAME
-.Nm modunload
-.Nd unload a kernel module
-.Sh SYNOPSIS
-.Nm modunload
-.Op Fl i Ar module_id
-.Op Fl n Ar module_name
-.Sh DESCRIPTION
-The
-.Nm
-utility unloads a loadable kernel module from a running system.
-The
-.Ar module_id
-or
-.Ar module_name
-is the ID or name of the module as shown by
-.Xr modstat 8 .
-.Pp
-One of the following options must be specified:
-.Bl -tag -width indent
-.It Fl i Ar module_id
-Unload the module with the ID
-.Ar module_id .
-.It Fl n Ar module_name
-Unload the module with the name
-.Ar module_name .
-.El
-.Sh DIAGNOSTICS
-The
-.Nm
-utility exits with a status of 0 on success
-and with a nonzero status if an error occurs.
-.Sh SEE ALSO
-.Xr lkm 4 ,
-.Xr modload 8 ,
-.Xr modstat 8
-.Sh HISTORY
-The
-.Nm
-command was designed to be similar in functionality
-to the corresponding command in
-.Tn "SunOS 4.1.3" .
-.Sh AUTHORS
-.An Terrence R. Lambert Aq terry@cs.weber.edu
diff --git a/sbin/modunload/modunload.c b/sbin/modunload/modunload.c
deleted file mode 100644
index b09f8c9..0000000
--- a/sbin/modunload/modunload.c
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.
- */
-
-#ifndef lint
-static const char rcsid[] =
- "$Id$";
-#endif /* not lint */
-
-#include <err.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/param.h>
-#include <sys/ioctl.h>
-#include <sys/lkm.h>
-#include <sys/file.h>
-#include <sys/errno.h>
-#include "pathnames.h"
-
-void
-usage()
-{
-
- fprintf(stderr, "usage: modunload [-i <module id>] [-n <module name>]\n");
- exit(1);
-}
-
-int devfd;
-
-void
-cleanup()
-{
-
- close(devfd);
-}
-
-int
-main(argc, argv)
- int argc;
- char *argv[];
-{
- int c;
- int modnum = -1;
- char *modname = NULL;
- struct lmc_unload ulbuf;
-
- while ((c = getopt(argc, argv, "i:n:")) != -1) {
- switch (c) {
- case 'i':
- modnum = atoi(optarg);
- break; /* number */
- case 'n':
- modname = optarg;
- break; /* name */
- case '?':
- usage();
- default:
- printf("default!\n");
- break;
- }
- }
- argc -= optind;
- argv += optind;
-
- if (argc != 0 || (modnum == -1 && modname == NULL))
- usage();
-
-
- /*
- * Open the virtual device device driver for exclusive use (needed
- * to ioctl() to retrieve the loaded module(s) status).
- */
- if ((devfd = open(_PATH_LKM, O_RDWR, 0)) == -1)
- err(2, _PATH_LKM);
-
- atexit(cleanup);
-
- /*
- * Unload the requested module.
- */
- ulbuf.name = modname;
- ulbuf.id = modnum;
-
- if (ioctl(devfd, LMUNLOAD, &ulbuf) == -1) {
- switch (errno) {
- case EINVAL: /* out of range */
- errx(3, "id out of range");
- case ENOENT: /* no such entry */
- errx(3, "no such module");
- default: /* other error (EFAULT, etc) */
- err(5, "LMUNLOAD");
- }
- }
-
- return 0;
-}
diff --git a/sbin/modunload/pathnames.h b/sbin/modunload/pathnames.h
deleted file mode 100644
index 81f70f2..0000000
--- a/sbin/modunload/pathnames.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#include <paths.h>
-
-#define _PATH_LKM "/dev/lkm"
OpenPOWER on IntegriCloud