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