Pidfd_getfd() syscall

Any particular reason why we don’t support `pidfd_getfd()` syscall?

`os.pidfd_open` and `signal.pidfd_send_signal` exist, so it looks like an simple omission.

There was a thread 4 years ago that got two upvotes but didn’t get anywhere:

People just hijack it with `ctypes` right now. Quick findings from Github:

I can do a PR immediately if there’s interest.

Adding os.pidfd_getfd(pidfd, targetfd, flags=0) sounds like a reasonable addition. FD_CLOEXEC should be used by default to respect PEP 446. The tricky part is to write good documentation and write tests.

Well, so far, nobody opened an issue to propose adding this function to Python stdlib.

1 Like