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

feat: limited ProcFDUsage support on darwin #161

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stevendanna
Copy link

This adds support for ProcFDUsage on darwin when the requested PID
matches that of the current process.

On MacOS, while you can get the open file descriptors for other
processes (via proc_pidinfo), I don't know of a clean way to get the
current rlimit data for another process.

However, for the current process, we can retrieve the rlimits via the
getrlimit system call.

I've used /dev/fd to count open files rather than proc_pidinfo
because I think the code is a bit more straight forward than the
under-documented proc_pidinfo call.

It's totally understandable if you would prefer to avoid this kind
of conditional behavior.

@cla-checker-service
Copy link

cla-checker-service bot commented Jun 18, 2021

💚 CLA has been signed

@elasticmachine
Copy link

elasticmachine commented Jun 18, 2021

❕ Build Aborted

The PR is not allowed to run in the CI yet

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Reason: The PR is not allowed to run in the CI yet

  • Start Time: 2021-11-09T14:25:03.349+0000

  • Duration: 3 min 12 sec

  • Commit: 1fcb209

@stevendanna
Copy link
Author

I'll look into getting the CLA signed. I'll need to check with my employer so it might take a little bit of time.

This adds support for ProcFDUsage on darwin when the requested PID
matches that of the current process.

On MacOS, while you can get the open file descriptors for other
processes (via `proc_pidinfo`), I don't know of a clean way to get the
current rlimit data for another process.

However, for the current process, we can retrieve the rlimits via the
`getrlimit` system call.

I've used /dev/fd to count open files rather than `proc_pidinfo`
because I think the code is a bit more straight forward than the
under-documented `proc_pidinfo` call.
@stevendanna
Copy link
Author

Apologies on the delay getting the CLA signed. Should be good to go now.

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

Successfully merging this pull request may close these issues.

2 participants