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

Properly handle PID type in C #1672

Merged
merged 47 commits into from Jan 28, 2020
Merged

Properly handle PID type in C #1672

merged 47 commits into from Jan 28, 2020

Conversation

giampaolo
Copy link
Owner

On UNIX, PIDs almost always use pid_t type. pid_t most of the times is an int, but on some systems it may be a long long. We never bumped into such a case, but it's good to fix it anyway, and refactor code so that PID is parsed by using a common routine (so that if it's broken we only have one place to fix). By doing so we also standardize all PyArg_ParseTuple calls which sometimes assume long and sometimes assume int (this was the cause of segfault of my Cygwin branch).

On Windows, PIDs are almost always DWORDs, but Python source code uses pid_t anyway (it's compatible).

Platforms converted in this PR are Linux, FreeBSD and Windows (for the others, I have currently don't have a virtual box image to test against).

This issue affected Python as well:
https://bugs.python.org/issue1983

@giampaolo giampaolo merged commit 994c429 into master Jan 28, 2020
@giampaolo giampaolo deleted the win-pid-type branch January 28, 2020 23:08
giampaolo added a commit that referenced this pull request Feb 9, 2020
…stems where pid_t size can't be determined at runtime pid_t is an int
giampaolo added a commit that referenced this pull request Feb 13, 2020
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.

None yet

1 participant