From: Michael Tremer Date: Mon, 9 Dec 2024 16:39:51 +0000 (+0000) Subject: daemon: Create a cgroup for the daemon X-Git-Tag: 0.9.30~737 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ab52c5d12e37c81fa8750fd843b6aa1fdef63827;p=pakfire.git daemon: Create a cgroup for the daemon Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/daemon.c b/src/libpakfire/daemon.c index 5488b9c92..f7f2b099e 100644 --- a/src/libpakfire/daemon.c +++ b/src/libpakfire/daemon.c @@ -27,6 +27,7 @@ #include #include +#include #include #include #include @@ -59,6 +60,9 @@ struct pakfire_daemon { // Timer for submitting stats sd_event_source* stats_timer; + // cgroup + struct pakfire_cgroup* cgroup; + // Jobs struct pakfire_job* jobs[MAX_JOBS]; unsigned int running_jobs; @@ -680,6 +684,8 @@ static void pakfire_daemon_free(struct pakfire_daemon* daemon) { sd_event_source_unref(daemon->stats_timer); if (daemon->client) pakfire_httpclient_unref(daemon->client); + if (daemon->cgroup) + pakfire_cgroup_unref(daemon->cgroup); if (daemon->control) pakfire_xfer_unref(daemon->control); if (daemon->loop) @@ -714,6 +720,11 @@ int pakfire_daemon_create(struct pakfire_daemon** daemon, struct pakfire_ctx* ct if (r) goto ERROR; + // Create the cgroup + r = pakfire_cgroup_create(&d->cgroup, d->ctx, "pakfire-daemon", 0); + if (r < 0) + goto ERROR; + // Create the HTTP client r = pakfire_httpclient_create(&d->client, d->ctx, d->loop); if (r < 0)