*/
#define _GNU_SOURCE
-#define NO_BINDING_VERBOSE_MACRO
+#define AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO
#include <stdlib.h>
+#include <stdio.h>
#include <stdint.h>
#include <signal.h>
#include <string.h>
#include "afb-session.h"
#include "verbose.h"
#include "afb-common.h"
+#include "afb-monitor.h"
#include "afb-hook.h"
#include "sd-fds.h"
killpg(0, SIGTERM);
else if (childpid > 0)
killpg(childpid, SIGTERM);
- exit(0);
}
static void on_sigterm(int signum, siginfo_t *info, void *uctx)
struct afb_session *session;
};
-static void startup_call_reply(struct afb_xreq *xreq, int iserror, struct json_object *obj)
+static void startup_call_reply(struct afb_xreq *xreq, int status, struct json_object *obj)
{
struct startup_req *sreq = CONTAINER_OF_XREQ(struct startup_req, xreq);
- if (!iserror)
+ if (status >= 0)
NOTICE("startup call %s returned %s", sreq->current->value, json_object_get_string(obj));
else {
ERROR("startup call %s ERROR! %s", sreq->current->value, json_object_get_string(obj));
| job for starting the daemon
+--------------------------------------------------------- */
-static void start()
+static void start(int signum)
{
struct afb_hsrv *hsrv;
+ if (signum) {
+ ERROR("start aborted: received signal %s", strsignal(signum));
+ exit(1);
+ }
+
// ------------------ sanity check ----------------------------------------
if (config->httpdPort <= 0) {
ERROR("no port is defined");
ERROR("can't create main api set");
goto error;
}
+ if (afb_monitor_init() < 0) {
+ ERROR("failed to setup monitor");
goto error;
}
afb_hook_create_xreq(NULL, NULL, NULL, config->tracereq, NULL, NULL);
if (config->traceditf)
afb_hook_create_ditf(NULL, config->traceditf, NULL, NULL);
+ if (config->tracesvc)
+ afb_hook_create_svc(NULL, config->tracesvc, NULL, NULL);
+ if (config->traceevt)
+ afb_hook_create_evt(NULL, config->traceevt, NULL, NULL);
/* load bindings */
apiset_start_list(config->dbus_clients, afb_api_dbus_add_client, "the afb-dbus client");