newbie trouble with destroy_dev

Ricky Charlet RCharlet at adaranet.com
Wed Sep 22 19:22:29 UTC 2010


Howdy,

                My goal is to destroy a character device which is currently open for read. Is that allowable? I'm hoping the userland program doing the reading will simply get a read error back (possibly with no data or truncated data).

                My experience so far is that I crash the box.

                I'm using BSD 8.0.  My program with the driver is a kernel module. Upon using the `kldunload` utility, the d_close() method is called.  I have tried these logic flows:

Test 1
---------------------
 Unhook my packet-filter-hooks
 cv_broadcast;
cv_destory
mMtx_destroy
destroy_dev
free associated buffers

Test 2
--------------------
Unhook my packet-filter-hooks
 cv_broadcast;
cv_destory
mMtx_destroy
destroy_dev_sched_cb
free associated buffers

  Test 3
----------------------
Unhook my packet-filter-hooks
 cv_broadcast;
cv_destory
mMtx_destroy
free associated buffers


                In all cases I get a kernel crash and the system reboots. Note that the userland program has the associated charater device open and is in a for-ever loop reading the fd.

                I'm a newbie and have not yet attached a debugger. I'll go start reading about that and trying it out while I hopefully await replies.

---
Ricky Charlet
Adara Networks<http://www.adaranet.com/welcome.html>
USA 408-433-4942



More information about the freebsd-drivers mailing list