Re: diff: ifconfig tun to print opener pid

2009-12-08 Thread Ted Unangst
On Tue, Dec 8, 2009 at 10:44 AM, Owain Ainsworth wrote: >> 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 th

Re: diff: ifconfig tun to print opener pid

2009-12-08 Thread Owain Ainsworth
On Sat, Dec 05, 2009 at 08:28:38PM -0500, Ted Unangst wrote: > On Sat, Dec 5, 2009 at 6:12 PM, Vladimir Kirillov 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 di

Re: diff: ifconfig tun to print opener pid

2009-12-05 Thread Ted Unangst
On Sat, Dec 5, 2009 at 6:12 PM, Vladimir Kirillov 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 w

Re: diff: ifconfig tun to print opener pid

2009-12-05 Thread Vladimir Kirillov
Hello, Philip! On 12:48 Fri 04 Dec, Philip Guenther wrote: > > @@ -372,6 +374,7 @@ tunopen(dev_t dev, int flag, int mode, s > >s = splnet(); > >ifp->if_flags |= IFF_RUNNING; > >tun_link_state(tp); > > + tp->tun_proc = p; > > Ick, holding a pointer to a struct proc fr

Re: diff: ifconfig tun to print opener pid

2009-12-04 Thread Philip Guenther
On Thu, Dec 3, 2009 at 11:34 PM, Vladimir Kirillov wrote: > Here's a diff for tun to make it keep record and display the > pid of tunnel owner process in ifconfig. > I'm sure it would be a handy feature, hope you'll like it. > @@ -88,16 +88,17 @@ > #include > > struct tun_softc { > -

Re: diff: ifconfig tun to print opener pid

2009-12-04 Thread Vadim Zhukov
On 4 December 2009 c. 11:44:00 Vladimir Kirillov wrote: > On 09:34 Fri 04 Dec, Otto Moerbeek wrote: > > > The main problem with this code is that ENOTTY is the wrong errno > > > to return. ENOTTY has a very specific meaning. > > > > It's hard to pick the right one. ESRCH seems close, but is for the

Re: diff: ifconfig tun to print opener pid

2009-12-04 Thread Vladimir Kirillov
On 09:34 Fri 04 Dec, Otto Moerbeek wrote: > > The main problem with this code is that ENOTTY is the wrong errno to > > return. ENOTTY has a very specific meaning. > > It's hard to pick the right one. ESRCH seems close, but is for the > reverse situation (you're requesting info for a pid taht does

Re: diff: ifconfig tun to print opener pid

2009-12-04 Thread Otto Moerbeek
On Fri, Dec 04, 2009 at 08:57:18AM +0100, Claudio Jeker wrote: > On Thu, Dec 03, 2009 at 11:50:52PM -0800, patrick keshishian wrote: > > On Fri, Dec 04, 2009 at 09:34:31AM +0200, Vladimir Kirillov wrote: > > > Hello t...@! > > > > > > Here's a diff for tun to make it keep record and display the >

Re: diff: ifconfig tun to print opener pid

2009-12-03 Thread Claudio Jeker
On Thu, Dec 03, 2009 at 11:50:52PM -0800, patrick keshishian wrote: > On Fri, Dec 04, 2009 at 09:34:31AM +0200, Vladimir Kirillov wrote: > > Hello t...@! > > > > Here's a diff for tun to make it keep record and display the > > pid of tunnel owner process in ifconfig. > > I'm sure it would be a han

Re: diff: ifconfig tun to print opener pid

2009-12-03 Thread patrick keshishian
On Fri, Dec 04, 2009 at 09:34:31AM +0200, Vladimir Kirillov wrote: > Hello t...@! > > Here's a diff for tun to make it keep record and display the > pid of tunnel owner process in ifconfig. > I'm sure it would be a handy feature, hope you'll like it. [dd] > @@ -561,6 +566,15 @@ tun_ioctl(struct if

diff: ifconfig tun to print opener pid

2009-12-03 Thread Vladimir Kirillov
Hello t...@! Here's a diff for tun to make it keep record and display the pid of tunnel owner process in ifconfig. I'm sure it would be a handy feature, hope you'll like it. It looks like this: tun1: flags=9843 mtu 1500 lladdr 00:bd:8e:68:8e:02 description: vpn priority: 0