Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6501

How to get the inode structure of the /proc/pid/fd/n file of an opened file in kernel?

$
0
0

For a given fd number, I know I can get the inode structure of the opened file by calling fget_raw. But what I actually want to get is the inode structure of the file /proc/pid/fd/n, which is actually another file in procfs.

This may be done by calling path_lookup with a spliced path of proc/pid/fd/n, but I think it's not the best way of doing this. Is there a way to get the inode directly from a fd number or a file structure? I think such process should occur when a close syscall is made, because a close call should get the /proc/pid/fs/n entry in order to delete it, but I can't locate related code.

I'm doing this because I want to get the time when the socket was opened.


Viewing all articles
Browse latest Browse all 6501

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>