I have a device driver and I want it to be opened by only one process exactly.
What structures do I have to use to actually set this property?
Freebsd OS, C language, Kernel Device drivers
Any tips on it?
I have a device driver and I want it to be opened by only
Share
You could track this inside your device driver; and reject the open. I.e. do some book keeping (is_open=true on open, is_open=false on close/loss).
Or you could simply use the normal locking semantics of open() itself – if needed in conjunction with exclusive mode and/or fcntl/flock.