Thanks! Just some follow up questions: (1) What about if I want the absolute path from root? (2) How do I access argv[0] of the process? Would this be an abs path? On Mon, Jul 18, 2016 at 1:27 PM, Frank Filz <ffilzlnx@xxxxxxxxxxxxxx> wrote: >> 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 > -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html