All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Frank Filz" <ffilzlnx@mindspring.com>
To: "'Peter Chen'" <peter.feifan.chen@gmail.com>,
	<linux-fsdevel@vger.kernel.org>
Subject: RE: Getting the file path of a file descriptor
Date: Mon, 18 Jul 2016 13:27:36 -0700	[thread overview]
Message-ID: <008c01d1e132$d2ba63a0$782f2ae0$@mindspring.com> (raw)
In-Reply-To: <CAMGYKAcKB5aK=Kh8ogXBY3CHAm_c8W4PTuq1NRnEjKvj4W3_iA@mail.gmail.com>

>   I was wondering if I intercepted the system call such as read(). Can I get the
> file path of the file descriptor somehow from the kernel process's internal
> data structures or some helper functions? For example if I had previously
> opened a file "abcd.txt", and then called read on it, I would like to get the
> filepath "abcd.txt" from the fd for the read().

There may be zero to N paths to an open file descriptor...

>    Also aside, I was wondering if it was all possible to get the file path of the
> executable of the process itself. So if I was running a program such as "ping",
> when I intercept the system calls of the program, I want to know the filepath
> of the ping program.

Argv[0], and that is the specific name the executable was invoked by (some utilities actually use this to behave differently based on execution name...).

Frank



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus


  reply	other threads:[~2016-07-18 20:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-18 19:13 Getting the file path of a file descriptor Peter Chen
2016-07-18 20:27 ` Frank Filz [this message]
2016-07-19  1:33   ` Peter Chen
2016-07-19  1:59 ` Al Viro

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='008c01d1e132$d2ba63a0$782f2ae0$@mindspring.com' \
    --to=ffilzlnx@mindspring.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=peter.feifan.chen@gmail.com \
    /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.