From: Ozgur Sefik Altunyurt <altunyurt@itu.edu.tr>
Cc: linux prg <linux-c-programming@vger.kernel.org>
Subject: Re: how to the filename
Date: Thu, 14 Apr 2005 14:31:25 -0700 [thread overview]
Message-ID: <425EE12D.90801@itu.edu.tr> (raw)
In-Reply-To: <1113472539.5952.62.camel@localhost.localdomain>
kaushal wrote:
>Hello all,
>
hi
> How can I get the filename/pathname given the open file descriptor?Does
>fstat provide this feature internally?Can somebody give the code snippet
>for this.
>
sorry no code snippet :)
IINW a way of doing this may be by getting the process id (PID) of the
program that opened the file and getting the relevant file name from the
/proc/$(PID)/fd/$(FILE_DESCRIPTOR)
or in a more technical way you may use "current->files->fd[fd]"
structure (please refer to asm/current.h and linux/sched.h )
which IMHO requires some more extra working on linux/{proc_fs.h, fs.h,
sched.h}..
by the way i don't know exactly how you can get the filename from the
file descriptor :)
i'm just suggesting..
Ozgur
prev parent reply other threads:[~2005-04-14 21:31 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-14 9:56 how to the filename kaushal
2005-04-14 10:37 ` Steve Graegert
2005-04-14 11:39 ` kaushal
2005-04-14 12:07 ` Steve Graegert
2005-04-15 1:45 ` Ron Michael Khu
2005-04-15 4:39 ` kaushal
2005-04-15 6:19 ` Steve Graegert
2005-04-15 6:42 ` kaushal
2005-04-15 6:59 ` Steve Graegert
2005-04-15 6:36 ` Steve Graegert
2005-04-15 6:43 ` kaushal
2005-04-15 7:04 ` Steve Graegert
2005-04-15 9:54 ` kaushal
2005-04-14 21:10 ` Glynn Clements
2005-04-14 21:31 ` Ozgur Sefik Altunyurt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=425EE12D.90801@itu.edu.tr \
--to=altunyurt@itu.edu.tr \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.