Hi Lennart,
ack from me (code review only)
Thanks,
Minh
On 20/10/17 21:44, Lennart Lund wrote:
Add gcov handling in ntfimcn, create_gcov_flush_thread
Also refacor handling of configure handling for gcov functionality,
create_gcov_flush_thread
---
src/base/Makefile.am | 6 +++++-
src/base/daemon.c | 3 +--
src/base/osaf_gcov.c | 7 -------
src/base/osaf_gcov.h | 4 ++++
src/ntf/ntfimcnd/ntfimcn_main.c | 4 ++++
5 files changed, 14 insertions(+), 10 deletions(-)
diff --git a/src/base/Makefile.am b/src/base/Makefile.am
index 54234691c..d0d67bbf0 100644
--- a/src/base/Makefile.am
+++ b/src/base/Makefile.am
@@ -60,7 +60,6 @@ lib_libopensaf_core_la_SOURCES += \
src/base/osaf_timerfd.c \
src/base/osaf_unicode.c \
src/base/osaf_utility.c \
- src/base/osaf_gcov.c \
src/base/patricia.c \
src/base/process.cc \
src/base/saf_edu.c \
@@ -75,6 +74,11 @@ lib_libopensaf_core_la_SOURCES += \
src/base/unix_server_socket.cc \
src/base/unix_socket.cc
+if ENABLE_GCOV
+lib_libopensaf_core_la_SOURCES += \
+ src/base/osaf_gcov.c
+endif
+
nodist_EXTRA_lib_libopensaf_core_la_SOURCES = dummy.cc
noinst_HEADERS += \
diff --git a/src/base/daemon.c b/src/base/daemon.c
index c88cbe710..27170d779 100644
--- a/src/base/daemon.c
+++ b/src/base/daemon.c
@@ -400,9 +400,8 @@ void daemonize(int argc, char *argv[])
create_fifofile(fifo_file);
-#ifdef ENABLE_GCOV
+ /* Enable code coverage logging. (if --enable-gcov in configure) */
create_gcov_flush_thread();
-#endif
/* Create the process PID file */
if (__create_pidfile(__pidfile) != 0)
diff --git a/src/base/osaf_gcov.c b/src/base/osaf_gcov.c
index 916b49791..e7d6ca4a8 100644
--- a/src/base/osaf_gcov.c
+++ b/src/base/osaf_gcov.c
@@ -26,11 +26,6 @@
#include <syslog.h>
#include <stdlib.h>
-#ifdef HAVE_CONFIG_H
-#include "osaf/config.h"
-#endif
-
-#ifdef ENABLE_GCOV
// default multicast group for gcov collection
#define DFLT_MULTICAST_GROUP "239.0.0.1"
#define DFLT_MULTICAST_PORT "4712"
@@ -195,5 +190,3 @@ void create_gcov_flush_thread(void) {
pthread_attr_destroy(&attr);
}
-
-#endif // ENABLE_GCOV
diff --git a/src/base/osaf_gcov.h b/src/base/osaf_gcov.h
index fb9c81732..6dc1b47c1 100644
--- a/src/base/osaf_gcov.h
+++ b/src/base/osaf_gcov.h
@@ -31,6 +31,10 @@ extern "C" {
extern void create_gcov_flush_thread(void);
+#else // gcov not enabled
+
+inline void create_gcov_flush_thread(void) {}
+
#endif
#ifdef __cplusplus
diff --git a/src/ntf/ntfimcnd/ntfimcn_main.c b/src/ntf/ntfimcnd/ntfimcn_main.c
index 156414aeb..691dfba53 100644
--- a/src/ntf/ntfimcnd/ntfimcn_main.c
+++ b/src/ntf/ntfimcnd/ntfimcn_main.c
@@ -27,6 +27,7 @@
#include <unistd.h>
#include <errno.h>
+#include "base/osaf_gcov.h"
#include "base/os_defs.h"
#include "base/ncs_osprm.h"
#include "base/logtrace.h"
@@ -153,6 +154,9 @@ int main(int argc, char **argv)
imcn_exit(EXIT_FAILURE);
}
+ // Enable code coverage logging. (if --enable-gcov in configure)
+ create_gcov_flush_thread();
+
/*
* Initiate polling
*/
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel