mirror of
https://github.com/troglobit/finit.git
synced 2026-11-03 13:28:27 +00:00
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:
1 parent
d373068619
commit
c85e28b971
3 files changed
+9
-1
No files matched your search
@@ -389,6 +389,8 @@ pid_t run_getty(char *tty, char *baud, char *term, int noclear, int nowait, stru
|
|||||||
speed_t speed;
|
speed_t speed;
|
||||||
int rc = 1;
|
int rc = 1;
|
||||||
|
|
||||||
|
sched_yield();
|
||||||
|
|
||||||
speed = stty_parse_speed(baud);
|
speed = stty_parse_speed(baud);
|
||||||
prepare_tty(tty, speed, "tty", rlimit);
|
prepare_tty(tty, speed, "tty", rlimit);
|
||||||
if (activate_console(noclear, nowait)) {
|
if (activate_console(noclear, nowait)) {
|
||||||
@@ -412,6 +414,8 @@ pid_t run_getty2(char *tty, char *cmd, char *args[], int noclear, int nowait, st
|
|||||||
if (!pid) {
|
if (!pid) {
|
||||||
int rc = 1;
|
int rc = 1;
|
||||||
|
|
||||||
|
sched_yield();
|
||||||
|
|
||||||
/* Dunno speed, tell stty() to not mess with it */
|
/* Dunno speed, tell stty() to not mess with it */
|
||||||
prepare_tty(tty, B0, "getty", rlimit);
|
prepare_tty(tty, B0, "getty", rlimit);
|
||||||
if (activate_console(noclear, nowait)) {
|
if (activate_console(noclear, nowait)) {
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#define FINIT_HELPERS_H_
|
#define FINIT_HELPERS_H_
|
||||||
|
|
||||||
#include <mntent.h>
|
#include <mntent.h>
|
||||||
|
#include <sched.h> /* sched_yield() */
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|||||||
+4
-1
@@ -25,7 +25,6 @@
|
|||||||
#include "config.h" /* Generated by configure script */
|
#include "config.h" /* Generated by configure script */
|
||||||
|
|
||||||
#include <ctype.h> /* isblank() */
|
#include <ctype.h> /* isblank() */
|
||||||
#include <sched.h> /* sched_yield() */
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/prctl.h>
|
#include <sys/prctl.h>
|
||||||
#include <sys/resource.h>
|
#include <sys/resource.h>
|
||||||
@@ -196,6 +195,8 @@ static int lredirect(svc_t *svc)
|
|||||||
char *tag = basename(svc->cmd);
|
char *tag = basename(svc->cmd);
|
||||||
char *prio = "daemon.info";
|
char *prio = "daemon.info";
|
||||||
|
|
||||||
|
sched_yield();
|
||||||
|
|
||||||
fds = open(ptsname(fd), O_RDONLY);
|
fds = open(ptsname(fd), O_RDONLY);
|
||||||
close(fd);
|
close(fd);
|
||||||
if (fds == -1)
|
if (fds == -1)
|
||||||
@@ -445,6 +446,8 @@ static int service_start(svc_t *svc)
|
|||||||
#endif
|
#endif
|
||||||
char *args[MAX_NUM_SVC_ARGS + 1];
|
char *args[MAX_NUM_SVC_ARGS + 1];
|
||||||
|
|
||||||
|
sched_yield();
|
||||||
|
|
||||||
/* Set configured limits */
|
/* Set configured limits */
|
||||||
for (int i = 0; i < RLIMIT_NLIMITS; i++) {
|
for (int i = 0; i < RLIMIT_NLIMITS; i++) {
|
||||||
if (setrlimit(i, &svc->rlimit[i]) == -1)
|
if (setrlimit(i, &svc->rlimit[i]) == -1)
|
||||||
|
|||||||
Reference in new issue
Block a user