-/**
- * initalize the supervision
- */
-static int init(const char *spec)
-{
- int rc, fd;
-
- /* check argument */
- if (!spec) {
- ERROR("invalid socket spec");
- return -1;
- }
-
- rc = afb_session_init(100, 600, "");
- /* TODO check that value */
-
- /* create the apisets */
- main_apiset = afb_apiset_create(supervisor_apiname, 0);
- if (!main_apiset) {
- ERROR("Can't create supervisor's apiset");
- return -1;
- }
- empty_apiset = afb_apiset_create(supervision_apiname, 0);
- if (!empty_apiset) {
- ERROR("Can't create supervision apiset");
- return -1;
- }
-
-
- /* init the main apiset */
- rc = afb_init_supervision_api();
- if (rc < 0) {
- ERROR("Can't create supervision's apiset: %m");
- return -1;
- }
-
- /* create the supervision socket */
- fd = create_supervision_socket(supervision_socket_path);
- if (fd < 0)
- return fd;
-
- /* listen the socket */
- rc = listen(fd, 5);
- if (rc < 0) {
- ERROR("refused to listen on socket");
- return rc;
- }
-
- /* integrate the socket to the loop */
- rc = sd_event_add_io(afb_common_get_event_loop(),
- NULL, fd, EPOLLIN,
- listening, NULL);
- if (rc < 0) {
- ERROR("handling socket event isn't possible");
- return rc;
- }
-
- /* adds the server socket */
- rc = afb_api_ws_add_server(spec, main_apiset);
- if (rc < 0) {
- ERROR("can't start the server socket");
- return -1;
- }
- return 0;
-}
-
-/* start should not be null but */
-static void start(int signum, void *arg)
-{
- char *xpath = arg;
- int rc;
-
- if (signum)
- exit(1);
-
- rc = init(xpath);
- if (rc)
- exit(1);
-
- sd_notify(1, "READY=1");
-
- discover_supervised();
-}
-
-/**
- * initalize the supervision
- */
-int main(int ac, char **av)
-{
- verbosity = Verbosity_Level_Debug;
- /* enter job processing */
- jobs_start(3, 0, 10, start, av[1]);
- WARNING("hoops returned from jobs_enter! [report bug]");
- return 1;
-}
-
-/*********************************************************************************************************/