Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for /proc/[pid]/fdinfo/[fd] #107

Closed
pirxthepilot opened this issue Sep 1, 2018 · 5 comments
Closed

Support for /proc/[pid]/fdinfo/[fd] #107

pirxthepilot opened this issue Sep 1, 2018 · 5 comments

Comments

@pirxthepilot
Copy link
Contributor

Hello,

Any plans to support reading the contents of /proc/[pid]/fdinfo/[fd]? If not, but you think it's a good idea, I can try and submit a PR for it.

Thanks!

@SuperQ
Copy link
Member

SuperQ commented Sep 1, 2018

Can you describe what you're looking to use this for? This library is mostly focused around metrics extractions. I'm asking because it seems like the cardinality of the fdinfo data is very high.

@pirxthepilot
Copy link
Contributor Author

In my case I would like to keep track of the number of inotify watches. From the proc man page:

              For inotify file descriptors (see inotify(7)), we see (since
              Linux 3.8) the following fields:

                  pos: 0
                  flags:    00
                  mnt_id:   11
                  inotify wd:2 ino:7ef82a sdev:800001 mask:800afff ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle:2af87e00220ffd73
                  inotify wd:1 ino:192627 sdev:800001 mask:800afff ignored_mask:0 fhandle-bytes:8 fhandle-type:1 f_handle:27261900802dfd73

              Each of the lines beginning with "inotify" displays informa‐
              tion about one file or directory that is being monitored.  The
              fields in this line are as follows:

              wd     A watch descriptor number (in decimal).

              ino    The inode number of the target file (in hexadecimal).

              sdev   The ID of the device where the target file resides (in
                     hexadecimal).

              mask   The mask of events being monitored for the target file
                     (in hexadecimal).

@grobie
Copy link
Member

grobie commented Sep 3, 2018

@pirxthepilot I'd be happy to reasonable PR to add this functionality.

@pirxthepilot
Copy link
Contributor Author

@grobie awesome, thank you! I'll work on it and try to submit a PR within the next week. Do you recommend adding the functionality in proc.go, or a new file altogether?

@pgier
Copy link
Collaborator

pgier commented Jun 27, 2019

Fixed in #115

@pgier pgier closed this as completed Jun 27, 2019
bobrik pushed a commit to bobrik/procfs that referenced this issue Jan 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants