Plugin and API init/exit for conformance

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2016-07-28 23:48:39 +02:00
parent 08e46782e5
commit 0710fdd2a3
4 changed files with 24 additions and 6 deletions
+5
View File
@@ -372,6 +372,11 @@ error:
return 1;
}
int api_exit(void)
{
return shutdown(api_watcher.fd, SHUT_RDWR) ||
close(api_watcher.fd);
}
/**
* Local Variables:
+1 -3
View File
@@ -231,13 +231,11 @@ int main(int argc, char* argv[])
#endif
run_interactive(SETUP_DEVFS, "Populating device tree");
#ifndef ENABLE_STATIC
/*
* Load plugins first, finit.conf may contain references to
* features implemented by plugins.
*/
plugin_load_all(&loop, PLUGIN_PATH);
#endif
plugin_init(&loop, PLUGIN_PATH);
/*
* Parse /etc/finit.conf, main configuration file
+9 -1
View File
@@ -298,7 +298,7 @@ static void check_plugin_depends(plugin_t *plugin)
}
#endif /* ENABLE_STATIC */
int plugin_load_all(uev_ctx_t *ctx, char *path)
int plugin_init(uev_ctx_t *ctx, char *path)
{
int fail = 0;
#ifndef ENABLE_STATIC
@@ -343,6 +343,14 @@ exit:
return fail;
}
void plugin_exit(void)
{
plugin_t *p, *tmp;
PLUGIN_ITERATOR(p, tmp)
plugin_unregister(p);
}
/**
* Local Variables:
* indent-tabs-mode: t
+9 -2
View File
@@ -28,16 +28,23 @@
#include "svc.h"
#include "plugin.h"
uev_ctx_t *ctx; /* Main loop context */
/*
* Main loop context
*/
uev_ctx_t *ctx;
int api_init (uev_ctx_t *ctx);
int api_exit (void);
int client (int argc, char *argv[]);
void service_monitor (pid_t lost);
void plugin_run_hook (hook_point_t no, void *arg);
void plugin_run_hooks (hook_point_t no);
int plugin_load_all (uev_ctx_t *ctx, char *path);
int plugin_init (uev_ctx_t *ctx, char *path);
void plugin_exit (void);
#endif /* FINIT_PRIVATE_H_ */