From owner-freebsd-hackers  Sat May  1  8:17:21 1999
Delivered-To: freebsd-hackers@freebsd.org
Received: from trem.cnt.org.br (trem.cnt.org.br [200.19.123.1])
	by hub.freebsd.org (Postfix) with ESMTP id 60B80150C0
	for <hackers@freebsd.org>; Sat,  1 May 1999 08:17:16 -0700 (PDT)
	(envelope-from ormonde@aker.com.br)
Received: from fire2 ([10.2.0.14])
	by trem.cnt.org.br (8.8.7/8.8.7) with SMTP id MAA08349
	for <hackers@freebsd.org>; Sat, 1 May 1999 12:04:40 -0300 (EST)
	(envelope-from ormonde@aker.com.br)
Message-Id: <3.0.3.32.19990501122021.0069eac8@cnt.org.br>
X-Sender: ormonde@cnt.org.br
X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.3 (32)
Date: Sat, 01 May 1999 12:20:21 -0300
To: hackers@freebsd.org
From: Rodrigo Ormonde <ormonde@aker.com.br>
Subject: Problems with a device KLD module
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Sender: owner-freebsd-hackers@FreeBSD.ORG
Precedence: bulk
X-Loop: FreeBSD.ORG

  I wrote a device kld module for FreeBSD 3.1. The module is working fine,
however there are two problems I was unable to solve:

  1 - I can load the module several times using kldload, which should not
be possible (the old lkm interface didn't let this happen).
      In order to prevent the module for being loaded twice, I wrote the
events function to return EBUSY when receiving the MOD_LOAD command if the
module was already loaded, but it didn't work.

  2 - I can unload the module even if the device it is controlling is being
used by an application. In this case, when I kill the application (after
unloading the module) the kernel panics.
      I tried to return EBUSY when receiving the MOD_UNLOAD command, in
order to prevent the module of being unloaded. This worked in part: the
kldunload reported the module was busy and didn't unloaded it, however, the
device no longer operated. No applications were able to access it anymore.

  Does anyone know how to prevent a kld module of being loaded twice and
how to prevent it of being unloaded when the device it controls is in use ?

  Please send a copy of the answers directly to me, I'm not on the list.

  Thanks in advance,

--
Rodrigo de La Rocque Ormonde
e-mail: ormonde@aker.com.br
Aker Consultoria e Informatica LTDA - http:///www.aker.com.br

--> Turn your PC into a workstation. Use FreeBSD <--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message