[v4,1/5] 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
source tree.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
.../freebsd_gsg/freebsd_eal_parameters.rst | 27 +++++++++++++++++++
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 +
5 files changed, 35 insertions(+), 1 deletion(-)
rename lib/eal/{linux => unix}/eal_log.c (100%)
@@ -18,3 +18,30 @@ FreeBSD-specific EAL parameters
-------------------------------
There are currently no FreeBSD-specific EAL command-line parameters available.
+
+Other options
+~~~~~~~~~~~~~
+
+* ``--syslog <syslog facility>``
+
+ Set syslog facility. Valid syslog facilities are::
+
+ auth
+ cron
+ daemon
+ ftp
+ kern
+ lpr
+ mail
+ news
+ syslog
+ user
+ uucp
+ local0
+ local1
+ local2
+ local3
+ local4
+ local5
+ local6
+ local7
@@ -52,6 +52,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)
@@ -759,6 +760,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',