Re: File descriptor -> name?
Alan Corey wrote: | Is there a way to get the name of a file that's open when all you've | got is a file descriptor? | | I'm working on porting something, that I didn't write. with directories | full of source. I'm seeing a problem with an ioctl being the wrong type, | but I'm looking at the code where it happens, I can't see what the file | descriptor passed in is pointing to. Seems like there should be a way. | |Alan | I guess fstat(1) is your friend. --steffen Forza Figa!
Re: File descriptor -> name?
that will potentially show up more than one file, not the one that was opened On Sat, May 5, 2012 at 3:49 AM, Stuart Henderson wrote: > On 2012-05-05, Andres Perera wrote: >> not in obsd >> >> plan 9/linux keep the name as it was opened >> >> think about hardlinks, unlinking and how the kernel only stores the inode # > > find(1) can search by inode number, so if you can identify that via ktrace > and if the file still exists, you can use "find /root/of/fs -inum 1234"
Re: File descriptor -> name?
On 2012-05-05, Andres Perera wrote: > not in obsd > > plan 9/linux keep the name as it was opened > > think about hardlinks, unlinking and how the kernel only stores the inode # find(1) can search by inode number, so if you can identify that via ktrace and if the file still exists, you can use "find /root/of/fs -inum 1234"
Re: File descriptor -> name?
On Sat, May 05, 2012 at 00:14, Alan Corey wrote: > Is there a way to get the name of a file that's open when all you've > got is a file descriptor? > > I'm working on porting something, that I didn't write. with directories > full of source. I'm seeing a problem with an ioctl being the wrong type, > but I'm looking at the code where it happens, I can't see what the file > descriptor passed in is pointing to. Seems like there should be a way. If you ktrace the process, you can look back to see how the fd is created.
Re: File descriptor -> name?
not in obsd plan 9/linux keep the name as it was opened think about hardlinks, unlinking and how the kernel only stores the inode # On Fri, May 4, 2012 at 11:44 PM, Alan Corey wrote: > Is there a way to get the name of a file that's open when all you've got is > a file descriptor? > > I'm working on porting something, that I didn't write. with directories full > of source. B I'm seeing a problem with an ioctl being the wrong type, but I'm > looking at the code where it happens, I can't see what the file descriptor > passed in is pointing to. B Seems like there should be a way. > > B Alan
File descriptor -> name?
Is there a way to get the name of a file that's open when all you've got is a file descriptor? I'm working on porting something, that I didn't write. with directories full of source. I'm seeing a problem with an ioctl being the wrong type, but I'm looking at the code where it happens, I can't see what the file descriptor passed in is pointing to. Seems like there should be a way. Alan