This simply tests the current functionality of the gamemode_client tools by calling each function in turn and checking the values return correctly.
Requires the gamemode service to currently be running and installed on the system.
This adds 10-gamemode.conf as a limits.d configuration file and with-pam-group meson option to allow renicing as an unpriviledged user being part of the specified group.
Signed-off-by: Térence Clastres <t.clastres@gmail.com>
Signed-off-by: Kai Krakow <kai@kaishome.de>
If the internet connection is down, the default timeout of wget is
unreasonably long. If formatcheck is used as a pre-commit hook, this
blocks usage of git for a long time although we probably have
git-clang-format available.
Signed-off-by: Kai Krakow <kai@kaishome.de>
Testing showed that wine processes may provoke some concerning logs
multiple times. Let's explain this a little more so no questions from
worried users show up.
Signed-off-by: Kai Krakow <kai@kaishome.de>
Returning a bool is not useful if we want to create some log information
from this. It now returns NULL or a client pointer which is compatible
with all of the current users.
When dereferencing the returned pointer, a read lock must be acquired
around using the returned result as the client may be deallocated from
heap otherwise.
Signed-off-by: Kai Krakow <kai@kaishome.de>
Be careful using this as it may introduce some non-obvious pitfalls.
This saves us from a heap allocation in some code locations.
Signed-off-by: Kai Krakow <kai@kaishome.de>
This function can look up arbitrary environment variables from a running
PID (given we have access permissions which should be usually true).
Signed-off-by: Kai Krakow <kai@kaishome.de>
Let's use our new safe_snprintf() helper. It's designed to make
thread-safe usage easy and will also be used by the next commits.
Reported-by: Alex Smith <alex@alex-smith.me.uk>
Signed-off-by: Kai Krakow <kai@kaishome.de>
GameMode can do a pretty expensive lookup function now for the exe.
Let's spare some CPU cycles by detecting a duplicate PID early. Nothing
makes use of the exe path at this stage.
Signed-off-by: Kai Krakow <kai@kaishome.de>
When running wine games, there's good chance the executable is already
gone when GameMode decided to add it to the list. Let's silently bail
out here. It probably grabs a non-matching PID anyway in this moment.
Signed-off-by: Kai Krakow <kai@kaishome.de>