Skip to content

Expose PIDFD_NONBLOCK as os.PIDFD_NONBLOCK #93312

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

Closed
kumaraditya303 opened this issue May 28, 2022 · 3 comments
Closed

Expose PIDFD_NONBLOCK as os.PIDFD_NONBLOCK #93312

kumaraditya303 opened this issue May 28, 2022 · 3 comments
Labels
type-feature A feature request or enhancement

Comments

@kumaraditya303
Copy link
Contributor

kumaraditya303 commented May 28, 2022

Feature or enhancement

Expose PIDFD_NONBLOCK as os.PIDFD_NONBLOCK to be used with os.waitid.

Pitch

pidfd_open returns a nonblocking file descriptor if PIDFD_NONBLOCK is supplied as flag. If the process
referred to by the file descriptor has not yet terminated,
then an attempt to wait on the file descriptor using
waitid(2) will immediately return the error EAGAIN rather
than blocking.

Linked PRs

@kumaraditya303 kumaraditya303 added the type-feature A feature request or enhancement label May 28, 2022
@kumaraditya303
Copy link
Contributor Author

Fixed by #93313

@n6koma7a
Copy link

n6koma7a commented Dec 3, 2024

according to documentation it should be available, yet it is not there:

python3.13 Wed 04 Dec 2024 01:57:39 AM +03
Python 3.13.0 (main, Oct 8 2024, 00:00:00) [GCC 14.2.1 20240912 (Red Hat 14.2.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.

import os
os.PIDFD_NONBLOCK
Traceback (most recent call last):
File "", line 1, in
os.PIDFD_NONBLOCK
AttributeError: module 'os' has no attribute 'PIDFD_NONBLOCK'. Did you mean: 'EFD_NONBLOCK'?

@vstinner
Copy link
Member

vstinner commented Dec 4, 2024

AttributeError: module 'os' has no attribute 'PIDFD_NONBLOCK'

Correct, something is wrong. I wrote #127593 to fix the constant.

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Dec 5, 2024
vstinner added a commit that referenced this issue Dec 5, 2024
#127631)

gh-93312: Include <sys/pidfd.h> to get PIDFD_NONBLOCK (#127593)

(cherry picked from commit fcbe6ec)
vstinner added a commit that referenced this issue Dec 5, 2024
…) (#127630)

gh-93312: Include <sys/pidfd.h> to get PIDFD_NONBLOCK (GH-127593)
(cherry picked from commit fcbe6ec)

Co-authored-by: Victor Stinner <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

3 participants