mirror of
https://github.com/troglobit/finit.git
synced 2026-10-28 12:30:44 +00:00
cgroup: minor refactor/simplify
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
31cae6a56d
commit
084b4ce8d3
1 file changed
+1
-11
+1
-11
@@ -31,8 +31,6 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
static int cg_init = 0;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Called by Finit at early boot to mount initial cgroups
|
* Called by Finit at early boot to mount initial cgroups
|
||||||
*/
|
*/
|
||||||
@@ -93,8 +91,6 @@ void cgroup_init(void)
|
|||||||
/* Move ourselves to init */
|
/* Move ourselves to init */
|
||||||
echo(FINIT_CGPATH "/init/cgroup.procs", 0, "1");
|
echo(FINIT_CGPATH "/init/cgroup.procs", 0, "1");
|
||||||
|
|
||||||
/* We have signal, main screen turn on! */
|
|
||||||
cg_init = 1;
|
|
||||||
fail:
|
fail:
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
@@ -118,17 +114,11 @@ static int move_pid(char *group, char *name, char *id, int pid)
|
|||||||
|
|
||||||
int cgroup_user(char *name)
|
int cgroup_user(char *name)
|
||||||
{
|
{
|
||||||
if (!cg_init)
|
return move_pid("finit/user", name, NULL, getpid());
|
||||||
return 0;
|
|
||||||
|
|
||||||
return move_pid("finit/user", name, "0", getpid());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int cgroup_service(char *nm, char *id, int pid)
|
int cgroup_service(char *nm, char *id, int pid)
|
||||||
{
|
{
|
||||||
if (!cg_init)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (pid <= 0) {
|
if (pid <= 0) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in new issue
Block a user