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 committed 2012-09-26 12:18:54 +02:00
1 parent 75eb5cc043
commit c49d89dfe0
13 files changed
+198 -131

No files matched your search

+5 -1
View File
@@ -42,6 +42,8 @@ typedef enum {
#define FINIT_SHM_ID 0x494E4954 /* "INIT", see ascii(7) */
#define MAX_ARG_LEN 64
#define MAX_STR_LEN 64
#define MAX_USER_LEN 16
#define MAX_NUM_FDS 64 /* Max number of I/O plugins */
#define MAX_NUM_SVC 64 /* Enough? */
#define MAX_NUM_SVC_ARGS 16
@@ -55,6 +57,7 @@ typedef struct svc {
char cmd[MAX_ARG_LEN];
char args[MAX_NUM_SVC_ARGS][MAX_ARG_LEN];
char descr[MAX_STR_LEN];
char username[MAX_USER_LEN];
/* Public */
int delayed_reload; /* For external service plugin. */
plugin_svc_t *plugin;
@@ -94,7 +97,7 @@ svc_t *svc_find_by_id (int id);
svc_t *svc_find_by_name (char *name);
svc_t *svc_iterator (int restart);
int svc_register (char *line);
int svc_register (char *line, char *username);
int svc_id_by_name (char *name);
svc_cmd_t svc_enabled (svc_t *svc, int dynamic);
int svc_start (svc_t *svc);
@@ -102,6 +105,7 @@ int svc_start_by_name (char *name);
int svc_stop (svc_t *svc);
int svc_reload (svc_t *svc);
void svc_start_all (void);
void svc_monitor (void);
#endif /* FINIT_SVC_H_ */