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

OSProcess not showing process name #1364

Closed
dazhitchman opened this issue Oct 15, 2020 · 5 comments
Closed

OSProcess not showing process name #1364

dazhitchman opened this issue Oct 15, 2020 · 5 comments
Assignees
Labels
good first issue Good issues for new contributors to work on PR welcome Not maintainer's priority to do but will accept contributions!

Comments

@dazhitchman
Copy link

The OSProcess fails to get the name of the running process if the running user doesn't have permission to the /proc/{pid}/cmdline
e.g. this process ( as reported by ps -ef )
root 6 2 0 Oct14 ? 00:00:00 [kworker/0:0H-kblockd]
returns en empty string for the name of the process
(LinusOSProcess.java:337) --> this.name = status.getOrDefault("Name", "");

The name is available in the /proc/{pid}/stat file which is already parsed into the statArray.
e.g.
6 (kworker/0:0H-kblockd) I 2 0 0 0 -1 69238880 0 0 0 0 0 0 0 0 0 -20 1 0 20 0 0 18446744073709551615 0 0 0 0 0 0 0 2147483647 0 0 0 0 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0

It would be trivial to extract the process name from the stat file when the cmdline access returns null

@dbwiddis
Copy link
Member

The name and command line are two different things. /proc/[pid]/cmdline is the full command line including path and arguments. The name comes from /proc/[pid]/status. Does that file have permission issues?

I'm fine with using /proc/[pid]/stat as a backup.

FYI the stat array is numeric and ignores the name, but we do have the string stat. The same backup should be used for the process State, which also pulls from /proc/[pid]/status but could be parsed from stat as a backup.

@dbwiddis dbwiddis added good first issue Good issues for new contributors to work on hacktoberfest Issues we're happy for new #Hacktoberfest2020 participants to do PR welcome Not maintainer's priority to do but will accept contributions! labels Oct 15, 2020
@Jimmy-653
Copy link
Contributor

I'd like to work on this, I won't be able to start before sunday, but im confident to finish it on sunday aswell.

@dbwiddis
Copy link
Member

Sounds good. I would like to cut a release on Sunday for the Windows processor bugfixes, but I'll hold off for this one as well!

@dbwiddis
Copy link
Member

Fixed in #1368

@oshi oshi deleted a comment from dazhitchman Oct 17, 2020
@oshi oshi deleted a comment from dazhitchman Oct 17, 2020
@dazhitchman
Copy link
Author

dazhitchman commented Oct 17, 2020 via email

@dbwiddis dbwiddis removed the hacktoberfest Issues we're happy for new #Hacktoberfest2020 participants to do label Oct 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good issues for new contributors to work on PR welcome Not maintainer's priority to do but will accept contributions!
Projects
None yet
Development

No branches or pull requests

3 participants