supervision: Exclude conditionaly the supervision 41/15041/1
authorJosé Bollo <jose.bollo@iot.bzh>
Thu, 5 Jul 2018 15:17:35 +0000 (17:17 +0200)
committerJosé Bollo <jose.bollo@iot.bzh>
Thu, 5 Jul 2018 17:17:11 +0000 (19:17 +0200)
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>
coverage/bin/Makefile
src/CMakeLists.txt
src/afb-supervision.c
src/main-afb-daemon.c

index 3cabefa..b851ed6 100644 (file)
@@ -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"'
index ed59ac0..c457d23 100644 (file)
@@ -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})
 
index 79a9d3f..be823b3 100644 (file)
@@ -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
index 49eaf61..8be78af 100644 (file)
@@ -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)