chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[Patch 3/3] Add cgroups initialization and handling
[elogind.git]
/
src
/
login
/
logind.c
diff --git
a/src/login/logind.c
b/src/login/logind.c
index de6fbfbd442ea97c0b025e76b208748cdfdba5e0..586d92fcaf0b1f630fcb16a4a0f2bdfd34ca9433 100644
(file)
--- a/
src/login/logind.c
+++ b/
src/login/logind.c
@@
-35,6
+35,7
@@
#include "formats-util.h"
#include "label.h"
#include "label.h"
#include "formats-util.h"
#include "label.h"
#include "label.h"
+#include "cgroup.h"
static void manager_free(Manager *m);
static void manager_free(Manager *m);
@@
-46,6
+47,8
@@
static Manager *manager_new(void) {
if (!m)
return NULL;
if (!m)
return NULL;
+ m->pin_cgroupfs_fd = -1;
+
m->console_active_fd = -1;
m->reserve_vt_fd = -1;
m->console_active_fd = -1;
m->reserve_vt_fd = -1;
@@
-77,6
+80,9
@@
static Manager *manager_new(void) {
m->user_units = hashmap_new(&string_hash_ops);
m->session_units = hashmap_new(&string_hash_ops);
m->user_units = hashmap_new(&string_hash_ops);
m->session_units = hashmap_new(&string_hash_ops);
+ m->running_as = MANAGER_SYSTEM;
+ m->test_run = false;
+
if (!m->devices || !m->seats || !m->sessions || !m->users || !m->inhibitors || !m->buttons || !m->user_units || !m->session_units)
goto fail;
if (!m->devices || !m->seats || !m->sessions || !m->users || !m->inhibitors || !m->buttons || !m->user_units || !m->session_units)
goto fail;
@@
-84,6
+90,11
@@
static Manager *manager_new(void) {
if (!m->kill_exclude_users)
goto fail;
if (!m->kill_exclude_users)
goto fail;
+ /* Make cgroups */
+ r = manager_setup_cgroup(m);
+ if (r < 0)
+ goto fail;
+
m->udev = udev_new();
if (!m->udev)
goto fail;
m->udev = udev_new();
if (!m->udev)
goto fail;
@@
-171,6
+182,8
@@
static void manager_free(Manager *m) {
safe_close(m->reserve_vt_fd);
safe_close(m->reserve_vt_fd);
+ manager_shutdown_cgroup(m, true);
+
strv_free(m->kill_only_users);
strv_free(m->kill_exclude_users);
strv_free(m->kill_only_users);
strv_free(m->kill_exclude_users);