Skip to content

feat: limited ProcFDUsage support on darwin#161

Open
stevendanna wants to merge 1 commit intoelastic:masterfrom
stevendanna:darwin-proc-fd-usage
Open

feat: limited ProcFDUsage support on darwin#161
stevendanna wants to merge 1 commit intoelastic:masterfrom
stevendanna:darwin-proc-fd-usage

Conversation

@stevendanna
Copy link
Copy Markdown

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
Copy Markdown

cla-checker-service Bot commented Jun 18, 2021

💚 CLA has been signed

@elasticmachine
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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