mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 13:33:09 +07:00
Plugin and API init/exit for conformance
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -372,6 +372,11 @@ error:
|
||||
return 1;
|
||||
}
|
||||
|
||||
int api_exit(void)
|
||||
{
|
||||
return shutdown(api_watcher.fd, SHUT_RDWR) ||
|
||||
close(api_watcher.fd);
|
||||
}
|
||||
|
||||
/**
|
||||
* Local Variables:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user