Refactor: introduce telinit and a new initctl tool w/ API

- Reduce size of `helpers.c`, for linking against new `initctl` tool,
  by moving out functions to `pid.c` and `exec.c`
- Add `AF_UNIX` API to Finit, to complement old `/dev/initctl` FIFO
- Let old FIFO API be used by init/telinit: `init <q | 1-9>`
- Move all advanced initctl code from `client.c` to `initctl.c`, yes
  its a bit confusing to call the *new* tool the same as the old FIFO
  but this is more in line with what, e.g Upstart does.
- Move all advanced server side code from `plugins/initctl.c` to `api.c`
- Update TODO with upcoming inetd syntax change and dynamic events.
- Temporarily fix display of inetd services from `initctl status -v`

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2015-06-13 12:26:16 +02:00
1 parent 66edb42e06
commit 1a1f24721f
15 files changed
+934 -731

No files matched your search

+21
View File
@@ -53,11 +53,29 @@ char *console = NULL;
uev_ctx_t *ctx = NULL; /* Main loop context */
static int banner(void)
{
if (!verbose)
return 0;
delline();
#ifdef INIT_HEADING
echo("%s", INIT_HEADING);
#else
echo("Finit v" VERSION);
echo("===================================================================");
#endif
return 0;
}
int main(int argc, char* argv[])
{
uev_ctx_t loop;
/*
* finit/init/telinit client tool uses /dev/initctl pipe
* for compatibility but initctl client tool uses socket
*/
if (getpid() != 1)
return client(argc, argv);
@@ -190,6 +208,9 @@ int main(int argc, char* argv[])
if (quiet)
verbose = 0;
/* Start new initctl API responder */
api_init(&loop);
/*
* Enter main loop to monior /dev/initctl and services
*/