gamemode: Add a value clamping helper

Signed-off-by: Kai Krakow <kai@kaishome.de>
This commit is contained in:
Kai Krakow 2018-09-30 17:36:34 +02:00
parent c9031e4a75
commit a91a2e7739

View File

@ -44,6 +44,7 @@ POSSIBILITY OF SUCH DAMAGE.
#include <signal.h>
#include <stdatomic.h>
#include <string.h>
#include <sys/param.h>
#include <sys/resource.h>
#include <sys/sysinfo.h>
#include <systemd/sd-daemon.h>
@ -59,6 +60,10 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#define NICE_DEFAULT_PRIORITY -4
/* Value clamping helper.
*/
#define CLAMP(lbound, ubound, value) MIN(MIN(lbound, ubound), MAX(MAX(lbound, ubound), value))
/**
* The GameModeClient encapsulates the remote connection, providing a list
* form to contain the pid and credentials.