From f3932b979ddbc8d84debe4a058d04b55186669cf Mon Sep 17 00:00:00 2001 From: David Greenman Date: Sun, 18 Sep 1994 04:12:13 +0000 Subject: [PATCH] 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 --- sbin/modload/modload.8 | 9 +++++---- sbin/modload/modload.c | 19 +++++++++++++++++-- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/sbin/modload/modload.8 b/sbin/modload/modload.8 index 2fe712987762..36d099ba5a46 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 4fea21b68656..c7c4ab9dbb25 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 @@ -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; }