Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50b3afd9 authored by Paul Eastham's avatar Paul Eastham
Browse files

Add "slow_start" keyword to init

This keyword will cause init to wait a few seconds before exec'ing
the target binary.  Maybe only useful for hacks and debugging.

Change-Id: I85caa0bcbc0be7e48bd21eb9e31e039c0740c8d5
parent 7e06476f
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -196,6 +196,10 @@ void service_start(struct service *svc, const char *dynamic_args)
        char tmp[32];
        int fd, sz;

        if (svc->flags & SVC_SLOW_START) {
            sleep(5);
        }

        if (properties_inited()) {
            get_property_workspace(&fd, &sz);
            sprintf(tmp, "%d,%d", dup(fd), sz);
+1 −0
Original line number Diff line number Diff line
@@ -69,6 +69,7 @@ struct svcenvinfo {
#define SVC_RESTARTING  0x08  /* waiting to restart */
#define SVC_CONSOLE     0x10  /* requires console */
#define SVC_CRITICAL    0x20  /* will reboot into recovery if keeps crashing */
#define SVC_SLOW_START  0x40  /* wait a few seconds before starting */

#define NR_SVC_SUPP_GIDS 12    /* twelve supplementary groups */

+4 −0
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ int lookup_keyword(const char *s)
        if (!strcmp(s, "etkey")) return K_setkey;
        if (!strcmp(s, "etprop")) return K_setprop;
        if (!strcmp(s, "etrlimit")) return K_setrlimit;
        if (!strcmp(s, "low_start")) return K_slow_start;
        if (!strcmp(s, "ocket")) return K_socket;
        if (!strcmp(s, "tart")) return K_start;
        if (!strcmp(s, "top")) return K_stop;
@@ -564,6 +565,9 @@ static void parse_line_service(struct parse_state *state, int nargs, char **args
    case K_critical:
        svc->flags |= SVC_CRITICAL;
        break;
    case K_slow_start:
        svc->flags |= SVC_SLOW_START;
        break;
    case K_setenv: { /* name value */
        struct svcenvinfo *ei;
        if (nargs < 2) {
+1 −0
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ enum {
    KEYWORD(setkey,      COMMAND, 0, do_setkey)
    KEYWORD(setprop,     COMMAND, 2, do_setprop)
    KEYWORD(setrlimit,   COMMAND, 3, do_setrlimit)
    KEYWORD(slow_start,  OPTION,  0, 0)
    KEYWORD(socket,      OPTION,  0, 0)
    KEYWORD(start,       COMMAND, 1, do_start)
    KEYWORD(stop,        COMMAND, 1, do_stop)