mirror of
https://github.com/troglobit/finit.git
synced 2026-11-29 21:08:21 +00:00
Minor refactor, create FINIT_CGPATH in finit.h to reduce duplicaiton
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
e84911fe52
commit
464bc831a5
2 files changed
+13
-8
No files matched your search
+9
-8
@@ -27,6 +27,7 @@
|
|||||||
#include <lite/lite.h>
|
#include <lite/lite.h>
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
|
|
||||||
|
#include "finit.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
@@ -70,27 +71,27 @@ void cgroup_init(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Default cgroups for process monitoring */
|
/* Default cgroups for process monitoring */
|
||||||
if (mkdir("/sys/fs/cgroup/finit", 0755) && EEXIST != errno)
|
if (mkdir(FINIT_CGPATH, 0755) && EEXIST != errno)
|
||||||
goto fail;
|
goto fail;
|
||||||
if (mount("none", "/sys/fs/cgroup/finit", "cgroup", opts, "none,name=finit")) {
|
if (mount("none", FINIT_CGPATH, "cgroup", opts, "none,name=finit")) {
|
||||||
_pe("Failed mounting Finit cgroup hierarchy");
|
_pe("Failed mounting Finit cgroup hierarchy");
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up reaper and enable callbacks */
|
/* Set up reaper and enable callbacks */
|
||||||
echo("/sys/fs/cgroup/finit/release_agent", 0, FINIT_LIBPATH_ "/cgreaper.sh");
|
echo(FINIT_CGPATH "/release_agent", 0, FINIT_LIBPATH_ "/cgreaper.sh");
|
||||||
echo("/sys/fs/cgroup/finit/notify_on_release", 0, "1");
|
echo(FINIT_CGPATH "/notify_on_release", 0, "1");
|
||||||
|
|
||||||
/* Default groups, PID 1, services, and user/login processes */
|
/* Default groups, PID 1, services, and user/login processes */
|
||||||
if (mkdir("/sys/fs/cgroup/finit/init", 0755) && EEXIST != errno)
|
if (mkdir(FINIT_CGPATH "/init", 0755) && EEXIST != errno)
|
||||||
goto fail;
|
goto fail;
|
||||||
if (mkdir("/sys/fs/cgroup/finit/system", 0755) && EEXIST != errno)
|
if (mkdir(FINIT_CGPATH "/system", 0755) && EEXIST != errno)
|
||||||
goto fail;
|
goto fail;
|
||||||
if (mkdir("/sys/fs/cgroup/finit/user", 0755) && EEXIST != errno)
|
if (mkdir(FINIT_CGPATH "/user", 0755) && EEXIST != errno)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* Move ourselves to init */
|
/* Move ourselves to init */
|
||||||
echo("/sys/fs/cgroup/finit/init/cgroup.procs", 0, "1");
|
echo(FINIT_CGPATH "/init/cgroup.procs", 0, "1");
|
||||||
|
|
||||||
/* We have signal, main screen turn on! */
|
/* We have signal, main screen turn on! */
|
||||||
cg_init = 1;
|
cg_init = 1;
|
||||||
|
|||||||
@@ -45,6 +45,10 @@
|
|||||||
#define _PATH_VARRUN "/var/run/"
|
#define _PATH_VARRUN "/var/run/"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef FINIT_CGPATH
|
||||||
|
#define FINIT_CGPATH "/sys/fs/cgroup/finit"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define LOGIT_PATH FINIT_LIBPATH_ "/logit"
|
#define LOGIT_PATH FINIT_LIBPATH_ "/logit"
|
||||||
|
|
||||||
#define CMD_SIZE 256
|
#define CMD_SIZE 256
|
||||||
|
|||||||
Reference in new issue
Block a user