device driver: cdesw questions?
avg at icyb.net.ua
Wed Jan 21 03:20:56 PST 2009
I am writing a driver that would use per-open private data (among other
Do I have to use D_TRACKCLOSE flag in this case?
In general I am a little bit confused about when d_close is invoked.
Supposing D_TRACKCLOSE is not set and multiple programs concurrently
open, use and close a device - when d_close is called - when one program
closes its last descriptor tied to the device or when the system-wide
last such descriptor is closed?
I also would like the driver to provide a select capability quite
similar to that of network (e.g. TCP) sockets using d_poll. I.e. a
userland program should be able to query when it can write data to the
device without blocking and when it can read data without blocking, plus
when an error occurred in the device/driver, so there is no point in
At this moment I am thoroughly confused by meaning of various event
masks described in poll(2). E.g. what is normal priority, non-zero
priority and high priority.
Which flags should I care about if all data is the same priority for me?
Which flag(s) should I set when I'd like to communicate an error
condition (e.g. similar to TCP connection reset)?
More information about the freebsd-hackers