Is there some implicit locking of device methods?

Bartosz Fabianowski freebsd at chillt.de
Wed Apr 27 21:14:39 UTC 2011


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


More information about the freebsd-hackers mailing list