From 1fa6f95135cfec036d7f3104816ff2c00208f54c Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Wed, 5 Jul 2017 20:57:56 +0200
Subject: priod: systemd unit, configuration
---
CMakeLists.txt | 14 ++++++++++----
priod.c | 2 ++
priod.conf.example | 9 +++++++++
priod.service.in | 9 +++++++++
4 files changed, 30 insertions(+), 4 deletions(-)
create mode 100644 priod.conf.example
create mode 100644 priod.service.in
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 07b0f51..0d53c25 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -72,13 +72,19 @@ set (SYSTEMD_UNITDIR /lib/systemd/system
configure_file (${PROJECT_SOURCE_DIR}/fancontrol-ng.service.in
${PROJECT_BINARY_DIR}/fancontrol-ng.service @ONLY)
-# System-wide unit files should be installed under /lib and not /usr/lib
-install (FILES ${PROJECT_BINARY_DIR}/fancontrol-ng.service
- DESTINATION "${SYSTEMD_UNITDIR}")
install (FILES fancontrol-ng.conf.example
DESTINATION ${CMAKE_INSTALL_DATADIR}/fancontrol-ng)
-# TODO: priod is also going to need a systemd unit file
+configure_file (${PROJECT_SOURCE_DIR}/priod.service.in
+ ${PROJECT_BINARY_DIR}/priod.service @ONLY)
+install (FILES priod.conf.example
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/priod)
+
+# System-wide unit files should be installed under /lib and not /usr/lib
+install (FILES
+ ${PROJECT_BINARY_DIR}/fancontrol-ng.service
+ ${PROJECT_BINARY_DIR}/priod.service
+ DESTINATION "${SYSTEMD_UNITDIR}")
if (WITH_GDM)
install (TARGETS gdm-switch-user DESTINATION ${CMAKE_INSTALL_BINDIR})
diff --git a/priod.c b/priod.c
index 8606593..07d2de0 100644
--- a/priod.c
+++ b/priod.c
@@ -522,6 +522,8 @@ main (int argc, char *argv[])
ctx.proc_event.user_data = &ctx;
poller_fd_set (&ctx.proc_event, POLLIN);
+ // TODO: iterate through current /proc processes and apply politics
+
ctx.polling = true;
while (ctx.polling)
poller_run (&ctx.poller);
diff --git a/priod.conf.example b/priod.conf.example
new file mode 100644
index 0000000..5b74120
--- /dev/null
+++ b/priod.conf.example
@@ -0,0 +1,9 @@
+# The command name can be a basename or a full path
+"Xorg" = {
+ # OOM killer favorization (-1000..1000)
+ oom_score_adj = -500
+ # CPU scheduling priority (-20..19)
+ prio = -5
+ # I/O scheduling priority (0..7)
+ ioprio = 0
+}
diff --git a/priod.service.in b/priod.service.in
new file mode 100644
index 0000000..9647fb6
--- /dev/null
+++ b/priod.service.in
@@ -0,0 +1,9 @@
+[Unit]
+Description=priod
+
+[Service]
+ExecStart=@CMAKE_INSTALL_FULL_BINDIR@/priod @CMAKE_INSTALL_FULL_SYSCONFDIR@/priod.conf
+Restart=on-abort
+
+[Install]
+WantedBy=default.target
--
cgit v1.2.3-70-g09d2