On Sat, Dec 05, 2009 at 08:28:38PM -0500, Ted Unangst wrote:
> On Sat, Dec 5, 2009 at 6:12 PM, Vladimir Kirillov <pro...@uaoug.org.ua> wrote:
> > So, is there a way (an interface) to find out from the character
> > device driver which struct file is it in it's current instance?
> >
> > Or am I digging into the wrong direction?
> 
> Option 2. :)
> 
> The way devices work, you can't reliably tell who has it open.  open
> and close are only called for two events, the first open and the last
> close.  In between, all sorts of things can happen.

I was sure it was *every* open, and the *last* close only. looking at
miscfs/specfs confirms this to me. It makes these things somewhat
fiddly, still.

> 
> If you need to know who opened a tun, I'd look into fstat.  While not
> ideal, that at least will always give you correct information.  Your
> current approach simply cannot work with the way things are designed.
> 

-0-
-- 
Dawn, n.:
        The time when men of reason go to bed.
                -- Ambrose Bierce, "The Devil's Dictionary"

Reply via email to