summaryrefslogtreecommitdiff
path: root/nDPId-test.c
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2021-11-13 17:30:21 +0100
committerToni Uhlig <matzeton@googlemail.com>2021-11-13 17:30:21 +0100
commitd389f04135354bb67ca7495bf97790e817e570e4 (patch)
treea8fa7a376d5fe5e20d6d2e88ed709cea741259b4 /nDPId-test.c
parent9075706714f44e6bc984154992746b5b03bb380b (diff)
MemoryProfiling: Advanced flow usage logging.
* nDPId-test: disable #include <syslog.h> if NO_MAIN macro defined * nDPId-test: mock syslog flags and functions * gitlab-ci: force -Werror Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'nDPId-test.c')
-rw-r--r--nDPId-test.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/nDPId-test.c b/nDPId-test.c
index 38dcd9be7..d83fcac42 100644
--- a/nDPId-test.c
+++ b/nDPId-test.c
@@ -3,6 +3,19 @@
#include <stdarg.h>
#include <unistd.h>
+/*
+ * Mock some syslog variables and functions.
+ * This way, we do not spam any syslog daemon on the host.
+ */
+#define LOG_DAEMON 0x1
+#define LOG_ERR 0x2
+#define LOG_CONS 0x4
+#define LOG_PERROR 0x8
+
+static void openlog(const char *ident, int option, int facility);
+static void syslog(int p, const char * format, ...);
+static void closelog(void);
+
#define NO_MAIN 1
#include "nDPIsrvd.c"
#include "nDPId.c"
@@ -63,7 +76,14 @@ static pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER;
goto error; \
} while (0);
-void mock_syslog_stderr(int p, const char * format, ...)
+static void openlog(const char *ident, int option, int facility)
+{
+ (void)ident;
+ (void)option;
+ (void)facility;
+}
+
+static void syslog(int p, const char * format, ...)
{
va_list ap;
@@ -76,6 +96,10 @@ void mock_syslog_stderr(int p, const char * format, ...)
va_end(ap);
}
+static void closelog(void)
+{
+}
+
static int setup_pipe(int pipefd[PIPE_COUNT])
{
if (pipe(pipefd) != 0)