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

Allow prefer_regex and avoid_regex to match cmdline #11

Closed
schumar opened this issue Nov 29, 2018 · 6 comments
Closed

Allow prefer_regex and avoid_regex to match cmdline #11

schumar opened this issue Nov 29, 2018 · 6 comments
Labels
enhancement New feature or request

Comments

@schumar
Copy link

schumar commented Nov 29, 2018

I'd rather have nohang kill a single Firefox tab instead of the whole browser. Sadly, both processes have the same name, so I can't use prefer_regex for that.

If nohang would give me some way to also match the cmdline-params (can get those from /proc/$pid/cmdline), I would be able to give processes with an -childID "preferred" treatment :)

Not sure if this should require extra config-options (enable_cmdline, prefer_cmdline_regex,...) are just be included in the standard behaviour.

@hakavlad
Copy link
Owner

hakavlad commented Nov 29, 2018

Thank you for this question! I plan to improve support regex matching in future.
This section should be completely redesigned.
I would like the configuration to look like this:

$MODIFY_BADNESS_BY_RE_MATCH_UID         -200  ///  333|33|1000
$MODIFY_BADNESS_BY_RE_MATCH_UID        -2000  ///  0
$MODIFY_BADNESS_BY_RE_MATCH_CMDLIME      100  ///  /usr/lib/firefox/firefox
$MODIFY_BADNESS_BY_RE_MATCH_USERNAME     300  ///  user1|user2
$MODIFY_BADNESS_BY_RE_MATCH_PROCESSNAME -400  ///  Xorg|sshd

@hakavlad
Copy link
Owner

hakavlad commented Nov 29, 2018

One of the problems is that cmdlines sometimes contain null byte.

@schumar
Copy link
Author

schumar commented Nov 29, 2018

That NUL is used to separate the arguments. I guess it would be perfectly ok to just replace all NULs with SPCs (can't think of a case right now where I need to differentiate between a program called foo wih a parameter bar baz and a program called foo bar with a parameter baz)

@hakavlad
Copy link
Owner

hakavlad commented Dec 2, 2018

@schumar
adding cmdline re matching in progress, https://github.com/hakavlad/nohang#changelog

@hakavlad
Copy link
Owner

hakavlad commented Dec 9, 2018

@schumar Done. Welcome to testing!

@hakavlad hakavlad added the enhancement New feature or request label Dec 10, 2018
@hakavlad
Copy link
Owner

matching with UID also implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants