Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 27 Aug 2001 04:15:56 -0700
From:      Dima Dorfman <dima@unixfreak.org>
To:        "Eugene L. Vorokov" <vel@bugz.infotecs.ru>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: problem with unloading device driver 
Message-ID:  <20010827111601.BA49D3E2F@bazooka.unixfreak.org>
In-Reply-To: <200108270943.f7R9hf901857@bugz.infotecs.ru>; from vel@bugz.infotecs.ru on "Mon, 27 Aug 2001 13:43:41 %2B0400 (MSD)"

next in thread | previous in thread | raw e-mail | index | archive | help
"Eugene L. Vorokov" <vel@bugz.infotecs.ru> wrote:
> Hello,
> 
> I have a module which adds new device. It does make_dev() and then simulates
> mknod() syscall, so that /dev/name is always automatically created.
> Also I have a daemon which reads from and writes to this device. The daemon
> opens the device once and then holds it open. When my module unloads,
> it simulates unlink() and then does detsroy_dev(). I just noticed that
> when I unload my module, the first write() by daemon to the fd associated with
> that device causes system to crash.  Trace looks like this:

You're unloading your module while something still has an fd
associated with a device it provides?  How do you expect that to work?
The right thing to do would be to keep track of how many times your
device has been opened, and fail to unload (return an error from the
modevent handler) if something still has it open.

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010827111601.BA49D3E2F>