diff options
Diffstat (limited to 'src/pies.c')
-rw-r--r-- | src/pies.c | 85 |
1 files changed, 22 insertions, 63 deletions
@@ -77,3 +77,5 @@ static struct config_syntax config_syntax_tab[] = { [CONF_INETD] = { "inetd", inetd_config_parse }, +#if PIES_SYSVINIT_ENABLED [CONF_INITTAB] = { "inittab", inittab_parse }, +#endif }; @@ -1207,52 +1209,2 @@ _cb_flags (enum grecs_callback_command cmd, -static int -_cb_initdefault (enum grecs_callback_command cmd, - grecs_node_t *node, - void *varptr, void *cb_data) -{ - grecs_locus_t *locus = &node->locus; - grecs_value_t *value = node->v.value; - int *val = varptr; - - if (grecs_assert_node_value_type (cmd, node, GRECS_TYPE_STRING)) - return 1; - if (strlen (value->v.string) != 1) - { - grecs_error (locus, 0, _("argument must be a single character")); - return 1; - } - if (!is_valid_runlevel (value->v.string[0])) - { - grecs_error (locus, 0, _("not a valid runlevel")); - return 1; - } - *val = toupper (value->v.string[0]); - return 0; -} - -static int -_cb_runlevels (enum grecs_callback_command cmd, - grecs_node_t *node, - void *varptr, void *cb_data) -{ - grecs_locus_t *locus = &node->locus; - grecs_value_t *value = node->v.value; - char **sptr = varptr, *p; - - if (grecs_assert_node_value_type (cmd, node, GRECS_TYPE_STRING)) - return 1; - for (p = value->v.string; *p; p++) - { - if (!is_valid_runlevel (*p)) - { - grecs_error (locus, 0, _("not a valid runlevel: %c"), *p); - return 1; - } - } - *sptr = grecs_strdup (value->v.string); - for (p = *sptr; *p; p++) - *p = toupper (*p); - return 0; -} - struct grecs_keyword component_keywords[] = { @@ -1296,2 +1248,3 @@ struct grecs_keyword component_keywords[] = { _cb_flags }, +#if PIES_SYSVINIT_ENABLED {"runlevels", @@ -1301,3 +1254,4 @@ struct grecs_keyword component_keywords[] = { NULL, offsetof (struct component, runlevels), - _cb_runlevels }, + cb_runlevels }, +#endif {"pass-fd-socket", @@ -1724,2 +1678,3 @@ struct grecs_keyword pies_keywords[] = { }, +#if PIES_SYSVINIT_ENABLED {"initdefault", @@ -1728,4 +1683,5 @@ struct grecs_keyword pies_keywords[] = { grecs_type_string, GRECS_DFLT, - &initdefault, 0, _cb_initdefault, + NULL, 0, cb_initdefault, }, +#endif {"shutdown-timeout", @@ -1861,3 +1817,3 @@ pies_read_config (void) - if (init_process) + if (SYSVINIT_ACTIVE) err = 0; @@ -1900,3 +1856,3 @@ sig_handler (int sig) { - if (init_process && sysvinit_sigtrans (sig, &action)) + if (SYSVINIT_ACTIVE && sysvinit_sigtrans (sig, &action)) return; @@ -2280,3 +2236,3 @@ set_conf_file_names (const char *base) { - if (init_process) + if (SYSVINIT_ACTIVE) { @@ -2340,3 +2296,3 @@ main (int argc, char **argv) /* Set default logging */ - if (init_process) + if (SYSVINIT_ACTIVE) { @@ -2375,3 +2331,3 @@ main (int argc, char **argv) - if (init_process || !DEFAULT_PREPROCESSOR) + if (SYSVINIT_ACTIVE || !DEFAULT_PREPROCESSOR) grecs_preprocessor = NULL; @@ -2453,3 +2409,3 @@ main (int argc, char **argv) - if (init_process) + if (SYSVINIT_ACTIVE) { @@ -2493,3 +2449,3 @@ main (int argc, char **argv) - if (!init_process) + if (!SYSVINIT_ACTIVE) { @@ -2518,3 +2474,3 @@ main (int argc, char **argv) case ACTION_RESTART: - if (pies_master_argv[0][0] != '/' || init_process) + if (pies_master_argv[0][0] != '/' || SYSVINIT_ACTIVE) { @@ -2534,3 +2490,3 @@ main (int argc, char **argv) component_config_commit (); - if (init_process) + if (SYSVINIT_ACTIVE) sysvinit_runlevel_setup (PIES_COMP_DEFAULT); @@ -2544,3 +2500,3 @@ main (int argc, char **argv) case ACTION_STOP: - if (init_process) + if (SYSVINIT_ACTIVE) { @@ -2553,2 +2509,3 @@ main (int argc, char **argv) debug (1, ("ctrl-alt-del")); + if (SYSVINIT_ACTIVE) sysvinit_runlevel_setup (PIES_COMP_MASK (pies_comp_ctrlaltdel)); @@ -2560,2 +2517,3 @@ main (int argc, char **argv) debug (1, ("kbrequest")); + if (SYSVINIT_ACTIVE) sysvinit_runlevel_setup (PIES_COMP_MASK (pies_comp_kbrequest)); @@ -2567,2 +2525,3 @@ main (int argc, char **argv) debug (1, ("SIGPWR")); + if (SYSVINIT_ACTIVE) sysvinit_power (); @@ -2584,3 +2543,3 @@ main (int argc, char **argv) } - while (init_process || action == ACTION_CONT); + while (SYSVINIT_ACTIVE || action == ACTION_CONT); |