linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* How Linux /proc filesystem convert a fd to the actual pathname?
@ 2007-08-21  2:58 Xin Zhao
  2007-08-21  5:32 ` Jan Engelhardt
  2007-08-21  6:03 ` Kevin Hao
  0 siblings, 2 replies; 4+ messages in thread
From: Xin Zhao @ 2007-08-21  2:58 UTC (permalink / raw)
  To: linux-kernel, linux-fsdevel

Hi,

In the Linux proc filesystem,  /proc/[pid]/fd is a link to the
actually the actual pathname of the opened file.

I am curious how Linux convert an fd to the pathname?  Does it
recursively walk back from current dentry to the root?

Can someone point me to the right place in the kernel where this
functionality is implemented?

Many thanks in advance!

-x

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How Linux /proc filesystem convert a fd to the actual pathname?
  2007-08-21  2:58 How Linux /proc filesystem convert a fd to the actual pathname? Xin Zhao
@ 2007-08-21  5:32 ` Jan Engelhardt
  2007-08-21  6:03 ` Kevin Hao
  1 sibling, 0 replies; 4+ messages in thread
From: Jan Engelhardt @ 2007-08-21  5:32 UTC (permalink / raw)
  To: Xin Zhao; +Cc: linux-kernel, linux-fsdevel


>In the Linux proc filesystem,  /proc/[pid]/fd is a link to the
>actually the actual pathname of the opened file.
>
>I am curious how Linux convert an fd to the pathname?  Does it
>recursively walk back from current dentry to the root?

AFAICS the fd has a pointer to the vma of the file (don't ask me why), 
which in turn has a 'struct file' pointer, which in turn has the 
required 'struct dentry' in it.


	Jan
-- 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How Linux /proc filesystem convert a fd to the actual pathname?
  2007-08-21  2:58 How Linux /proc filesystem convert a fd to the actual pathname? Xin Zhao
  2007-08-21  5:32 ` Jan Engelhardt
@ 2007-08-21  6:03 ` Kevin Hao
  2007-08-21  6:41   ` Xin Zhao
  1 sibling, 1 reply; 4+ messages in thread
From: Kevin Hao @ 2007-08-21  6:03 UTC (permalink / raw)
  To: Xin Zhao; +Cc: linux-kernel, linux-fsdevel

> I am curious how Linux convert an fd to the pathname?  Does it
> recursively walk back from current dentry to the root?
Using d_path.
> Can someone point me to the right place in the kernel where this
> functionality is implemented?
do_proc_readlink may be the function you want.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How Linux /proc filesystem convert a fd to the actual pathname?
  2007-08-21  6:03 ` Kevin Hao
@ 2007-08-21  6:41   ` Xin Zhao
  0 siblings, 0 replies; 4+ messages in thread
From: Xin Zhao @ 2007-08-21  6:41 UTC (permalink / raw)
  To: Kevin Hao; +Cc: linux-kernel, linux-fsdevel

Thanks! That perfectly answered my question.

-x

On 8/21/07, Kevin Hao <haokexin@gmail.com> wrote:
> > I am curious how Linux convert an fd to the pathname?  Does it
> > recursively walk back from current dentry to the root?
> Using d_path.
> > Can someone point me to the right place in the kernel where this
> > functionality is implemented?
>
 may be the function you want.
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-08-21  6:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-21  2:58 How Linux /proc filesystem convert a fd to the actual pathname? Xin Zhao
2007-08-21  5:32 ` Jan Engelhardt
2007-08-21  6:03 ` Kevin Hao
2007-08-21  6:41   ` Xin Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).