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

Doesn't handle processes with spaces in name #120

Closed
jimmidyson opened this issue Dec 7, 2015 · 1 comment
Closed

Doesn't handle processes with spaces in name #120

jimmidyson opened this issue Dec 7, 2015 · 1 comment

Comments

@jimmidyson
Copy link
Contributor

As per http://man7.org/linux/man-pages/man5/proc.5.html, the second field is the filename of the executable in parentheses:

  1. comm %s
    The filename of the executable, in parentheses.
    This is visible whether or not the executable is
    swapped out.

In the case of spaces in the filename (as I observed today) /proc/[pid]/stat looks like:

1591 (Plex Media Serv) S 1 1591 1591 0 -1 1077952768 19063 0 306 0 257 95 0 0 20 0 17 0 1353 596594688 13330 18446744073709551615 1 1 0 0 0 0 0 4097 17646 18446744073709551615 0 0 17 4 0 0 69 0 0 0 0 0 0 0 0 0 0

Rather than hard coding the field numbers they should be offset from the field ending in ).

@shirou
Copy link
Owner

shirou commented Dec 7, 2015

Thank you very much!

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

No branches or pull requests

2 participants