Revert new experimental libev backend due to time constraints

Due to time constraints I had to revert the new libev backend to the
service, I/O and signals monitor.  Employed instead is the tried and
tested signals based service monitor, with a small extension for an
additional I/O monitor using poll() for the I/O plugins to use.

Tried restoring the startx finit.conf directive on top of the service
implementation. However, it's currently not usable to run /usr/bin/startx
for any other user than root. I recommend using the examples/finit.conf
and run /usr/sbin/gdm instead.

finit.c:
        New run_loop() function, replaces libev ev_run().

helpers.c:
        Refactor start_process() into svc_start().

plugin.c:
        Add fds[] array for use in the io_monitor() called by the
        new run_loop().

signal.c:
        Ignore SIGCHLD. Handled by waitpid() in svc_monitor() now,
        which is called by the new run_loop().

svc.c:
        svc_register(): Optional @username parsing for the command line.
        svc_monitor(): Replaced libev callback with waitpid()
        svc_start(): Refactored to use most of helpers.c:start_process()

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2012-09-26 12:18:54 +02:00
parent 75eb5cc043
commit c49d89dfe0
13 changed files with 198 additions and 131 deletions
+14 -7
View File
@@ -22,10 +22,11 @@
* THE SOFTWARE.
*/
#include <ctype.h>
#include <sys/mount.h>
#include <ctype.h>
#include <dirent.h>
#include <linux/fs.h>
#include <sys/stat.h> /* umask(), mkdir() */
#include "finit.h"
#include "helpers.h"
@@ -60,10 +61,18 @@ static void parse_kernel_cmdline(void)
}
}
static int run_loop(void)
{
while (1) {
svc_monitor();
io_monitor();
}
return 0;
}
int main(int UNUSED(args), char *argv[])
{
struct ev_loop *loop = ev_default_loop(0);
/*
* Initial setup of signals, ignore all until we're up.
*/
@@ -133,7 +142,7 @@ int main(int UNUSED(args), char *argv[])
* Load plugins and run first level hooks.
*/
_d("Loading plugins ...");
load_plugins(loop, PLUGIN_PATH);
load_plugins(PLUGIN_PATH);
_d("Running first level hooks ...");
run_hooks(HOOK_BASEFS_UP);
@@ -183,9 +192,7 @@ int main(int UNUSED(args), char *argv[])
* Enter main loop to monior /dev/initctl and services
*/
_d("Entering main loop ...");
ev_run(loop, 0);
return 0;
return run_loop();
}
/**