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

pid_exists(0) lies on POSIX #457

Closed
giampaolo opened this issue May 23, 2014 · 2 comments
Closed

pid_exists(0) lies on POSIX #457

giampaolo opened this issue May 23, 2014 · 2 comments

Comments

@giampaolo
Copy link
Owner

From g.rodola on December 17, 2013 14:55:37

>>> import psutil
>>> 0 in psutil.get_pids()
False
>>> psutil.pid_exists(0)
True
>>> 

This is similar to issue 23 of 4 years ago.
This happens because internally we use os.kill() and according to "man 2 kill":

> If pid equals 0, then sig is sent to every process 
> in the process group of the calling process.

...which is definitively not what we want.
In case of PID 0 we should just "return 0 in get_pids()".

Original issue: http://code.google.com/p/psutil/issues/detail?id=457

@giampaolo giampaolo self-assigned this May 23, 2014
@giampaolo
Copy link
Owner Author

From g.rodola on December 17, 2013 06:41:14

Fixed in revision 0fe8e5eb7fbe .

Status: FixedInHG
Labels: Milestone-1.3.0

@giampaolo
Copy link
Owner Author

From g.rodola on March 10, 2014 04:36:50

Closing out as fixed as 2.0.0 version is finally out.

Status: Fixed
Labels: -Milestone-1.3.0 Milestone-2.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant