If you have some sort of state that needs to get created on first
open and then removed on last close [...] I would still depend on the
cdevpriv destructor and use a reference count between open() and the
destructor to know when to cleanup shared state.

Yes, this is what I am doing. I am maintaining a list of all file descriptors open on the device. Once the length of that list reaches zero, I do global clean-up in the cdevpriv destructor.
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscr...@freebsd.org"

Reply via email to