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
This commit is contained in:
David Greenman 1994-09-18 04:12:13 +00:00
parent 63f5112ede
commit f3932b979d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=2844
2 changed files with 22 additions and 6 deletions

View File

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

View File

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