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

Oh yes ... but I thought kernel should know that I unloaded the driver
and close associated fd's, returning some error code when a program still
tries to operate on them. Anyway, I now return EBUSY, and it works fine.
Thanks !

Regards,
Eugene


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to