Re: struct file --> pid ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Avishay,

On 7/24/07, Avishay Traeger <atraeger@xxxxxxxxxxxxx> 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

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux