Yield execution in forked children back to PID 1

- Speeds up start-up a bit
 - Ensures the child is moved to its cgroup as soon as possible

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2021-04-09 18:59:33 +02:00
1 parent d373068619
commit c85e28b971
3 files changed
+9 -1

No files matched your search

+4 -1
View File
@@ -25,7 +25,6 @@
#include "config.h" /* Generated by configure script */
#include <ctype.h> /* isblank() */
#include <sched.h> /* sched_yield() */
#include <string.h>
#include <sys/prctl.h>
#include <sys/resource.h>
@@ -196,6 +195,8 @@ static int lredirect(svc_t *svc)
char *tag = basename(svc->cmd);
char *prio = "daemon.info";
sched_yield();
fds = open(ptsname(fd), O_RDONLY);
close(fd);
if (fds == -1)
@@ -445,6 +446,8 @@ static int service_start(svc_t *svc)
#endif
char *args[MAX_NUM_SVC_ARGS + 1];
sched_yield();
/* Set configured limits */
for (int i = 0; i < RLIMIT_NLIMITS; i++) {
if (setrlimit(i, &svc->rlimit[i]) == -1)