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

-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" 
in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to