From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io0-f193.google.com ([209.85.223.193]:32995 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751696AbcGRTNu (ORCPT ); Mon, 18 Jul 2016 15:13:50 -0400 Received: by mail-io0-f193.google.com with SMTP id y195so11609874iod.0 for ; Mon, 18 Jul 2016 12:13:50 -0700 (PDT) MIME-Version: 1.0 From: Peter Chen Date: Mon, 18 Jul 2016 12:13:30 -0700 Message-ID: Subject: Getting the file path of a file descriptor To: linux-fsdevel@vger.kernel.org Content-Type: text/plain; charset=UTF-8 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Hi, 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(). 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. Thanks, Peter