NetBSD Problem Report #481

From gnats  Sat Sep 17 07:36:54 1994
Received: from pain.lcs.mit.edu (pain.lcs.mit.edu [128.52.46.239]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id HAA15526 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Sat, 17 Sep 1994 07:36:53 -0700
Message-Id: <199409171427.KAA03925@kolvir.blrc.ma.us>
Date: Sat, 17 Sep 1994 10:27:40 -0400
From: John Kohl <jtk@kolvir.blrc.ma.us>
Reply-To: jtk@kolvir.blrc.ma.us
To: gnats-bugs@netbsd.org
Subject: modload doesn't do postloading; modload doesn't fix up symbol output file name
X-Send-Pr-Version: 3.2

>Number:         481
>Category:       bin
>Synopsis:       modload doesn't do post-load work, nor does it fix the symbol output file name
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 17 07:50:01 +0000 1994
>Closed-Date:    Sun Sep 18 19:54:23 +0000 1994
>Last-Modified:  
>Originator:     John Kohl
>Release:        NetBSD-1.0_BETA
>Organization:
>Environment:
i486/33, NetBSD-1.0_BETA (Sep 17th), i486/33
System: NetBSD kolvir 1.0_BETA NetBSD 1.0_BETA (KOLVIR) #16: Thu Sep 15 22:03:20 EDT 1994 jtk@kolvir:/u1/NetBSD-1.0/src/sys/arch/i386/compile/KOLVIR i386


>Description:
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.

>How-To-Repeat:
run modload -o symfile -p post_script module.o.  Note that post_script
isn't called.

run modload module.o.  Note that module.o gets unlinked and you get an
error.

>Fix:
Apply these patches:

===================================================================
RCS file: sbin/modload/RCS/modload.c,v
retrieving revision 1.1
diff -c -r1.1 sbin/modload/modload.c
*** 1.1	1994/09/17 13:46:43
--- sbin/modload/modload.c	1994/09/17 14:22:42
***************
*** 212,218 ****
  		errx(2, "module object must end in .o");
  	if (out == NULL) {
  		out = modout;
! 		*p == 0;
  	}

  	/*
--- 212,218 ----
  		errx(2, "module object must end in .o");
  	if (out == NULL) {
  		out = modout;
! 		*p = 0;
  	}

  	/*
***************
*** 331,335 ****
--- 331,350 ----
  	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;
  }
===================================================================
RCS file: sbin/modload/RCS/modload.8,v
retrieving revision 1.1
diff -c -r1.1 sbin/modload/modload.8
*** 1.1	1994/09/17 14:00:37
--- sbin/modload/modload.8	1994/09/17 14:22:50
***************
*** 73,80 ****
  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 a loadable system call, the third argument is the system
  call number.
  .It Fl o Ar output_file
--- 73,80 ----
  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
***************
*** 112,115 ****
  .El
  .Sh BUGS
  Loadable streams modules and loadable execution interpreters
! are not currently supported.
--- 112,116 ----
  .El
  .Sh BUGS
  Loadable streams modules and loadable execution interpreters
! are not currently supported.  The loadable device driver framework can
! only reserve either a character or block device entry, not both.

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mycroft 
State-Changed-When: Sun Sep 18 12:54:23 PDT 1994 
State-Changed-Why:  
Done. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.