Subject: bin/4701: Target "unload" fails in
To: None <gnats-bugs@gnats.netbsd.org>
From: None <hauke@Espresso.Rhein-Neckar.DE>
List: netbsd-bugs
Date: 12/16/1997 21:25:07
>Number:         4701
>Category:       bin
>Synopsis:       Target "unload" fails in <bsd.kmod.mk>
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 16 13:50:01 1997
>Last-Modified:
>Originator:     Hauke Fath (Ghost in the Machine)
>Organization:
Huh?
>Release:        1.3 beta (Sources from 14 Dec 1997)
>Environment:
	
System: NetBSD 1.3_BETA (W48) #5: Sun Dec 14 17:03:30 CET 1997 mac68k

>Description:
	The targets "load" and "unload" in /usr/share/mk/bsd.kmod.mk
are not in sync over the naming of the entry point of an LKM.

Quoted from $NetBSD: bsd.kmod.mk,v 1.22.2.1 1997/11/04 21:51:30 thorpej Exp $:

	.if !target(load)
	load:   ${PROG}
	        /sbin/modload -o ${KMOD} -e${KMOD}_lkmentry ${PROG}
	.endif

	.if !target(unload)
	unload: ${PROG}
	        /sbin/modunload -n ${KMOD}
	.endif
 

>How-To-Repeat:
	

[hauke@q700] /<5>lkm/iwm # make load
/sbin/modload -o IWM -eIWM_lkmentry IWM.o
Module loaded as ID 0
[hauke@q700] /<5>lkm/iwm # modstat
Type    Id  Off Loadaddr Size Info     Rev Module Name
MISC      0   0 06ce6000 0018  6cea044   1 IWM_lkmentry
[hauke@q700] /<5>lkm/iwm # make unload
/sbin/modunload -n IWM
modunload: id out of range
*** Error code 3

Stop.
[hauke@q700] /<5>lkm/iwm #  

	When called without "-e" option, modload (as in "$NetBSD:
modload.c,v 1.18 1997/09/16 08:37:10 mrg Exp $") tries to find the
entry points "xxxinit" and "${ModuleName}_lkmentry". Thus, calling
modload(8) with "-e ${ModuleName}_lkmentry" is redundant.

modunload(8), on the other hand, when called with "-n ${ModuleName}"
should be given the name that was specified when loading the module
(see also `man modunload`).


>Fix:
[hauke@q700] /<1>sbin/modload > diff /mo/share/mk/bsd.kmod.mk /usr/share/mk/bsd.kmod.mk
84c84
<       /sbin/modunload -n ${KMOD}
---
>       /sbin/modunload -n ${KMOD}_lkmentry
[hauke@q700] /<1>sbin/modload >

 
>Audit-Trail:
>Unformatted: