summaryrefslogtreecommitdiffstats
path: root/sbin/modload
diff options
context:
space:
mode:
authordg <dg@FreeBSD.org>1994-09-18 04:12:13 +0000
committerdg <dg@FreeBSD.org>1994-09-18 04:12:13 +0000
commitd7b47a496164bd3580e10be65c2836b28339fd5a (patch)
treeb4871487dca37581ec1a20bf22029936fe5a1859 /sbin/modload
parent02c768e8ae094275d384b056dffc71dffdac138f (diff)
downloadFreeBSD-src-d7b47a496164bd3580e10be65c2836b28339fd5a.zip
FreeBSD-src-d7b47a496164bd3580e10be65c2836b28339fd5a.tar.gz
Various fixes:
modload doesn't honor it's -p argument. It also will destroy the input file when you don't specify an output symbol file with -o. Submitted by: John Kohl
Diffstat (limited to 'sbin/modload')
-rw-r--r--sbin/modload/modload.89
-rw-r--r--sbin/modload/modload.c19
2 files changed, 22 insertions, 6 deletions
diff --git a/sbin/modload/modload.8 b/sbin/modload/modload.8
index 2fe7129..36d099b 100644
--- a/sbin/modload/modload.8
+++ b/sbin/modload/modload.8
@@ -23,7 +23,7 @@
.\" (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.2 1994/08/19 13:28:20 davidg Exp $
+.\" $Id: modload.8,v 1.3 1994/08/19 13:39:20 davidg Exp $
.\"
.Dd June 7, 1993
.Dt MODLOAD 8
@@ -73,8 +73,8 @@ 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 and fourth arguments are
-the block major and character major numbers respectively.
+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
@@ -112,4 +112,5 @@ Terrence R. Lambert, terry@cs.weber.edu
.El
.Sh BUGS
Loadable streams modules and loadable execution interpreters
-are not currently supported.
+are not currently supported. 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
index 4fea21b..c7c4ab9 100644
--- a/sbin/modload/modload.c
+++ b/sbin/modload/modload.c
@@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: modload.c,v 1.1 1994/08/19 12:07:14 davidg Exp $
+ * $Id: modload.c,v 1.2 1994/08/19 13:28:21 davidg Exp $
*/
#include <stdio.h>
@@ -212,7 +212,7 @@ main(argc, argv)
errx(2, "module object must end in .o");
if (out == NULL) {
out = modout;
- *p == 0;
+ *p = 0;
}
/*
@@ -331,5 +331,20 @@ main(argc, argv)
fileopen &= ~PART_RESRV; /* loaded */
printf("Module loaded as ID %d\n", resrv.slot);
+ 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, "%d", sbuf.offset);
+ /* XXX the modload docs say that drivers can install bdevsw &
+ cdevsw, but the interface only supports one at a time. sigh. */
+ execl(post, post, id, type, offset, 0);
+ err(16, "can't exec '%s'", post);
+ }
return 0;
}
OpenPOWER on IntegriCloud