From 455ea0c72e7aa3e23371c9d35d592ee6d6da91fc Mon Sep 17 00:00:00 2001 From: Christian Kellner Date: Tue, 2 Jul 2019 17:24:15 +0200 Subject: [PATCH] daemon: getters for properties of GameModeClient Add getters for all two properties of GameModeCLient: the process id and the executable path. --- daemon/gamemode-context.c | 19 +++++++++++++++++++ daemon/gamemode.h | 10 ++++++++++ 2 files changed, 29 insertions(+) diff --git a/daemon/gamemode-context.c b/daemon/gamemode-context.c index d04fdcc..d53b0f8 100644 --- a/daemon/gamemode-context.c +++ b/daemon/gamemode-context.c @@ -41,6 +41,7 @@ POSSIBILITY OF SUCH DAMAGE. #include "build-config.h" +#include #include #include #include @@ -646,6 +647,24 @@ void game_mode_client_ref(GameModeClient *client) atomic_fetch_add_explicit(&client->refcount, 1, memory_order_seq_cst); } +/** + * The process identifier of the client. + */ +pid_t game_mode_client_get_pid(GameModeClient *client) +{ + assert(client != NULL); + return client->pid; +} + +/** + * The path to the executable of client. + */ +const char *game_mode_client_get_executable(GameModeClient *client) +{ + assert(client != NULL); + return client->executable; +} + /* Internal refresh config function (assumes no contention with reaper thread) */ static void game_mode_reload_config_internal(GameModeContext *self) { diff --git a/daemon/gamemode.h b/daemon/gamemode.h index 3901be8..1fa45ef 100644 --- a/daemon/gamemode.h +++ b/daemon/gamemode.h @@ -59,6 +59,16 @@ void game_mode_client_unref(GameModeClient *client); */ void game_mode_client_ref(GameModeClient *client); +/** + * The process identifier of the client. + */ +pid_t game_mode_client_get_pid(GameModeClient *client); + +/** + * The path to the executable of client. + */ +const char *game_mode_client_get_executable(GameModeClient *client); + /** * Return the singleton instance */