From 0d0a148121dcb8edd49cad900f27141336576f9d Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Sun, 28 Feb 2016 20:42:50 +0200 Subject: Synchronize changes in runlevel with configuration reloads State transition algorithm used this far could cause spurious component wakeups in some cases. Consider the following scenario: being in runlevel N, the configuration is changed so that a component X is added at runlevel N. Then a change to runlevel N+1 is initiated. What happens then is that X is woken up (still being in runlevel N) and terminated shortly afterwards, upon entering runlevel N+1. To avoid this, configuration must be reloaded after runlevel changes. * src/ctl.c (res_runlevel): Don't initiate ACTION_RELOAD after setting the runlevel. * src/pies.c (main): Begin main event loop with call to pies_pause. * src/pies.h (pies_set_hook): New proto. (inittrans): Remove proto. * src/socket.c (pies_set_hook): New function. (pies_pause): Call pies_pause_hook if defined. * src/sysvinit.c (inittrans): Change to static. If transition was initiated by user (e.g. by invoking telinit), schedule ACTION_RELOAD. (sysvinit_begin): Set inittrans as pies_hook --- src/pies.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pies.h') diff --git a/src/pies.h b/src/pies.h index 6fce820..4eb2aca 100644 --- a/src/pies.h +++ b/src/pies.h @@ -417,6 +417,7 @@ struct component *component_depmap_next (pies_depmap_pos_t pos); +void pies_set_hook (int (*f) (void)); void pies_pause (void); enum @@ -531,7 +532,6 @@ struct inetd_builtin *inetd_builtin_lookup (const char *service, int socktype); /* sysvinit.c */ void sysvinit_begin (void); -int inittrans (void); int is_comp_wait (struct component *comp); int is_valid_runlevel (int c); int console_open (int mode); -- cgit v1.2.1