mirror of
https://github.com/troglobit/finit.git
synced 2026-10-15 10:29:35 +00:00
Refactor, ensure pre:/post:/ready: scripts run in the same cgroup
Related to issue #361. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
2135639508
commit
63b5db38df
1 file changed
+9
-8
+9
-8
@@ -560,6 +560,15 @@ static pid_t service_fork(svc_t *svc)
|
||||
source_env(svc);
|
||||
}
|
||||
|
||||
if (pid > 1) {
|
||||
char grnam[80];
|
||||
|
||||
if (svc_is_tty(svc))
|
||||
cgroup_user("getty", pid);
|
||||
else
|
||||
cgroup_service(group_name(svc, grnam, sizeof(grnam)), pid, &svc->cgroup);
|
||||
}
|
||||
|
||||
return pid;
|
||||
}
|
||||
|
||||
@@ -643,16 +652,8 @@ static int service_start(svc_t *svc)
|
||||
goto fail;
|
||||
}
|
||||
if (pid > 1) {
|
||||
char grnam[80];
|
||||
|
||||
svc->pid = pid;
|
||||
svc->start_time = jiffies();
|
||||
|
||||
if (svc_is_tty(svc))
|
||||
cgroup_user("getty", pid);
|
||||
else
|
||||
cgroup_service(group_name(svc, grnam, sizeof(grnam)), pid, &svc->cgroup);
|
||||
|
||||
} else if (pid == 0) {
|
||||
char *args[MAX_NUM_SVC_ARGS + 1];
|
||||
int status;
|
||||
|
||||
Reference in new issue
Block a user