aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2018-07-05 17:17:35 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2018-07-05 19:17:11 +0200
commit75526aa1e85a8bacb50e917971010d06137a3610 (patch)
tree33adc0e2410d8af36148a2901c0a20000e0cdaf5
parent0d05349094ced7eeb487e572beb90fa44dd2ebe0 (diff)
supervision: Exclude conditionaly the supervision
Exclude from the binder the part related to the supervision when the supervisor is excluded from the build. Change-Id: I41193122d63e47b9f0db7f113f88d2d63b783027 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--coverage/bin/Makefile2
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--src/afb-supervision.c4
-rw-r--r--src/main-afb-daemon.c6
4 files changed, 14 insertions, 3 deletions
diff --git a/coverage/bin/Makefile b/coverage/bin/Makefile
index 3cabefa1..b851ed6c 100644
--- a/coverage/bin/Makefile
+++ b/coverage/bin/Makefile
@@ -26,7 +26,7 @@ cflags = -I$(incdir) \
-ldl -lrt -lpthread
afb_lib_src = $(shell ls $(srcdir)/*.c | egrep -v '/afs-|/main-|-fake' )
-afb_clib_src = $(shell ls $(srcdir)/*.c | egrep -v '/afs-|/main-|-fake|afb-supervision' )
+afb_clib_src = $(shell ls $(srcdir)/*.c | egrep -v '/afs-|/main-|-fake' )
afb_daemon_srcs = $(srcdir)/main-afb-daemon.c $(afb_lib_src)
afb_daemon_defs = '-DAFB_VERSION="cov"' -DAGL_DEVEL -DWITH_MONITORING_OPTION '-DBINDING_INSTALL_DIR="fake"'
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ed59ac0c..c457d235 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -54,7 +54,6 @@ SET(AFB_LIB_SOURCES
afb-proto-ws.c
afb-session.c
afb-stub-ws.c
- afb-supervision.c
afb-systemd.c
afb-trace.c
afb-websock.c
@@ -90,6 +89,10 @@ IF(INCLUDE_DBUS_TRANSPARENCY)
ADD_DEFINITIONS(-DWITH_DBUS_TRANSPARENCY)
SET(AFB_LIB_SOURCES ${AFB_LIB_SOURCES} afb-api-dbus.c)
ENDIF()
+IF(INCLUDE_SUPERVISOR)
+ ADD_DEFINITIONS(-DWITH_SUPERVISION)
+ SET(AFB_LIB_SOURCES ${AFB_LIB_SOURCES} afb-supervision.c)
+ENDIF()
ADD_LIBRARY(afb-lib STATIC ${AFB_LIB_SOURCES})
diff --git a/src/afb-supervision.c b/src/afb-supervision.c
index 79a9d3fd..be823b3d 100644
--- a/src/afb-supervision.c
+++ b/src/afb-supervision.c
@@ -14,6 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+#if defined(WITH_SUPERVISION)
+
#define _GNU_SOURCE
#define AFB_BINDING_PRAGMA_NO_VERBOSE_MACRO
@@ -395,3 +398,4 @@ static void on_supervision_call(void *closure, struct afb_xreq *xreq)
}
}
+#endif
diff --git a/src/main-afb-daemon.c b/src/main-afb-daemon.c
index 49eaf61c..8be78af6 100644
--- a/src/main-afb-daemon.c
+++ b/src/main-afb-daemon.c
@@ -56,7 +56,9 @@
#include "afb-hook.h"
#include "afb-debug.h"
#include "process-name.h"
-#include "afb-supervision.h"
+#if defined(WITH_SUPERVISION)
+# include "afb-supervision.h"
+#endif
/*
if SELF_PGROUP == 0 the launched command is the group leader
@@ -577,10 +579,12 @@ static void start(int signum, void *arg)
ERROR("failed to setup monitor");
goto error;
}
+#if defined(WITH_SUPERVISION)
if (afb_supervision_init() < 0) {
ERROR("failed to setup supervision");
goto error;
}
+#endif
/* install hooks */
if (main_config->tracereq)