Remove support for service callback plugins

This patch removes the now heavily outdated (and non-working) support
for callback plugins.  I.e. plugins that attach themselves to services
listed in /etc/finit.conf and can be queried to determine if a service
should be started or stopped.

The Finit3 support for adding/removing services at runtime with plain
text *.conf files in /etc/finit.d and `initctl reload`, this old, and
rather cumbersome service callback feature, is not longer supported.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2016-09-13 21:20:06 +02:00
parent 6b237b7b00
commit 5a3397419f
5 changed files with 8 additions and 63 deletions
+7 -20
View File
@@ -1,10 +1,11 @@
Hooks, Callbacks & Plugins
==========================
Hooks & Plugins
===============
Finit provides only the bare necessities for starting and supervising
processes, with an emphasis on *bare* — for your convenience it does
however come with support for hooks, service callbacks and plugins that
can used to extend finit with.
Finit can be extended to add general functionality in the form of I/O
monitors, built-in inetd services, or hook plugins.
The following sections detail existing plugins and hook points. For
more information, see the plugins listed below.
Plugins
@@ -124,20 +125,6 @@ they are called I/O plugins and are called from the finit main loop when
more help and ideas.
Callbacks
---------
Callback plugins are called by finit right before a process is started,
or restarted if it exits. The callback runs as a separate process and
receives a pointer to the `svc_t` of the service, with all command line
parameters free to modify as needed.
All the callback needs to do is respond with one of: `SVC_STOP (0)`
tells Finit to *not* start the service, `SVC_START (1)` to start the
service, or `SVC_RELOAD (2)` to have finit signal the process with
`SIGHUP`.
<!--
-- Local Variables:
-- mode: markdown
-14
View File
@@ -109,20 +109,6 @@ int plugin_unregister(plugin_t *plugin)
#ifndef ENABLE_STATIC
TAILQ_REMOVE(&plugins, plugin, link);
if (plugin->svc.cb) {
svc_t *svc;
/* Unregister plugin callback for all matching services */
for (svc = svc_iterator(1); svc; svc = svc_iterator(0)) {
if (strcmp(svc->cmd, plugin->name))
continue;
svc->cb = NULL;
svc->dynamic = 0;
svc->dynamic_stop = 0;
}
}
_d("%s exiting ...", plugin->name);
free(plugin->name);
#else
-7
View File
@@ -100,13 +100,6 @@ typedef struct plugin {
* NOTE: Must match cmd for services or inetd plugins! */
char *name;
/* Service callback to be called once per lap of runloop. */
struct {
int dynamic; /* Callback wants external events as well. */
int dynamic_stop; /* Callback allows dynamic events to stop. */
svc_cmd_t (*cb)(svc_t *svc, int event, void *event_arg);
} svc;
/* List of hook callbacks. */
struct {
void *arg; /* Optional argument to callback func. */
-7
View File
@@ -608,13 +608,6 @@ recreate:
while ((cmd = strtok(NULL, " ")))
strlcpy(svc->args[i++], cmd, sizeof(svc->args[0]));
svc->args[i][0] = 0;
plugin = plugin_find(svc->cmd);
if (plugin && plugin->svc.cb) {
svc->cb = plugin->svc.cb;
svc->dynamic = plugin->svc.dynamic;
svc->dynamic_stop = plugin->svc.dynamic_stop;
}
}
svc->runlevels = conf_parse_runlevels(runlevels);
+1 -15
View File
@@ -33,11 +33,7 @@
#include "inetd.h"
#include "helpers.h"
typedef enum {
SVC_STOP = 0, /* Disabled */
SVC_START, /* Enabled */
SVC_RELOAD /* Enabled, needs restart */
} svc_cmd_t;
typedef int svc_cmd_t;
typedef enum {
SVC_TYPE_FREE = 0, /* Free to allocate */
@@ -113,16 +109,6 @@ typedef struct svc {
char cmd[MAX_ARG_LEN];
char args[MAX_NUM_SVC_ARGS][MAX_ARG_LEN];
char desc[MAX_STR_LEN];
/* For external plugins. If @cb is set, a plugin is loaded.
* @dynamic: Set by plugins that want dynamic events.
* @dynamic_stop: Set by plugins that allow dyn. events to stop it as well.
* @private: Can be used freely by plugin, e.g., to store "states".
*/
int dynamic;
int dynamic_stop;
int private;
svc_cmd_t (*cb)(struct svc *svc, int event, void *event_arg);
} svc_t;
typedef struct svc_map svc_map_t;