Add gamemode_query_status and teach gamemoded '-s'

This allows the client to query the daemon about the status of gamemode.

	Returns the following:
		 0 if gamemode is inactive
		 1 if gamemode is active
		 2 if gamemode is active and this client is registered
		-1 if the query failed

	Passing -s to gamemoded will simply query and print the current status.

	Allows for more comprehensive testing when using 'gamemoded -r' as well as more reactionary program behaviour
This commit is contained in:
Marc Di Luzio
2018-04-25 14:39:05 +01:00
parent 966c207a33
commit 4f3bc2c9a2
8 changed files with 140 additions and 4 deletions

View File

@ -73,3 +73,13 @@ bool game_mode_context_register(GameModeContext *self, pid_t pid);
* @returns True if the client was removed, and existed.
*/
bool game_mode_context_unregister(GameModeContext *self, pid_t pid);
/**
* Query the current status of gamemode
*
* @param pid Process ID for the remote client
* @returns Positive if gamemode is active
* 1 if gamemode is active but the client is not registered
* 2 if gamemode is active and the client is registered
*/
int game_mode_context_query_status(GameModeContext *self, pid_t pid);