[v3,1/2] eal: unify logging code for FreeBsd and Linux
Checks
Commit Message
FreeBSD logging code was not using syslog and did not have
the same options as Linux. Move the log writing code to common
tree.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/eal/freebsd/eal.c | 7 +++++++
lib/eal/linux/meson.build | 1 -
lib/eal/{linux => unix}/eal_log.c | 0
lib/eal/unix/meson.build | 1 +
4 files changed, 8 insertions(+), 1 deletion(-)
rename lib/eal/{linux => unix}/eal_log.c (100%)
@@ -51,6 +51,7 @@
#include "eal_hugepages.h"
#include "eal_options.h"
#include "eal_memcfg.h"
+#include "eal_log.h"
#include "eal_trace.h"
#define MEMSIZE_IF_NO_HUGE_PAGE (64ULL * 1024ULL * 1024ULL)
@@ -744,6 +745,12 @@ rte_eal_init(int argc, char **argv)
#endif
}
+ if (eal_log_init(getprogname(), internal_conf->syslog_facility) < 0) {
+ rte_eal_init_alert("Cannot init logging.");
+ rte_errno = ENOMEM;
+ return -1;
+ }
+
/* in secondary processes, memory init may allocate additional fbarrays
* not present in primary processes, so to avoid any potential issues,
* initialize memzones first.
@@ -11,7 +11,6 @@ sources += files(
'eal_hugepage_info.c',
'eal_interrupts.c',
'eal_lcore.c',
- 'eal_log.c',
'eal_memalloc.c',
'eal_memory.c',
'eal_thread.c',
similarity index 100%
rename from lib/eal/linux/eal_log.c
rename to lib/eal/unix/eal_log.c
@@ -6,6 +6,7 @@ sources += files(
'eal_file.c',
'eal_filesystem.c',
'eal_firmware.c',
+ 'eal_log.c',
'eal_unix_memory.c',
'eal_unix_thread.c',
'eal_unix_timer.c',