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

implement process:NumFDs for Windows #1712

Merged
merged 2 commits into from
Sep 24, 2024

Conversation

al-online
Copy link
Contributor

I found that gopsutil does not have a method to get the number of handles for a process, so I implemented it myself and would like to submit a pull request.

@shirou
Copy link
Owner

shirou commented Sep 23, 2024

I have confirmed that it works on my Windows machine, and it seems to be functioning correctly. Thank you.

However, file descriptors (FD) on Unix-like systems and handles on Windows are not exactly the same. Because of this, psutil provides a separate function called num_handles().

It would be possible for gopsutil to prepare a platform-specific struct like ExWindows, but that would add complexity.

The differences between FDs and handles are not that significant, so it seems like we just need to be mindful of how they are used. Therefore, how about adding a comment like, "On Windows, this returns the number of handles, not number of FDs" on the NumFDsWithContext in process_windows.go?

@al-online
Copy link
Contributor Author

Sure, this clarification is indeed necessary, and I am willing to add the comment!

Copy link
Owner

@shirou shirou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the update and your great contribution!

@shirou shirou merged commit fdc3c05 into shirou:master Sep 24, 2024
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants