On Wed, 2007-07-25 at 11:43 +0900, NAHieu wrote:
> Hi Avishay,
> 
> On 7/24/07, Avishay Traeger <[EMAIL PROTECTED]> wrote:
> > On Tue, 2007-07-24 at 19:12 +0900, NAHieu wrote:
> > > Hello,
> > >
> > > Given a file pointer (struct file *), what is the most effecient way
> > > to find out the pid of the process that manages this file pointer?
> > >
> > > I look into the file structure, but still havent seen any way to do that.
> > >
> > > There is one solution: traverse all the processes in the system, and
> > > compare my file pointer with their list of files, but that seems so
> > > ineffective, so I dont like that.
> > >
> > > Thank you,
> > > Hieu
> >
> > I haven't tested this, but what about file->f_owner.pid?
> >
> 
> Interesting, but that points to "struct pid", not pid. And I dont see
> how I can extract pid from it.
> 
> Any idea?
> 
> Thanks,
> Hieu

I think you want 'nr' in struct pid.  Try that.  There is also a rather
long comment above the struct that could prove useful to you.

Avishay


--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [EMAIL PROTECTED]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to