[PATCH v4 1/5] eal: unify logging code for FreeBsd and Linux
Stephen Hemminger
stephen at networkplumber.org
Mon Jun 26 20:42:12 CEST 2023
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 at 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%)
diff --git a/doc/guides/freebsd_gsg/freebsd_eal_parameters.rst b/doc/guides/freebsd_gsg/freebsd_eal_parameters.rst
index fba467a2ce92..9270d9fa3bfc 100644
--- a/doc/guides/freebsd_gsg/freebsd_eal_parameters.rst
+++ b/doc/guides/freebsd_gsg/freebsd_eal_parameters.rst
@@ -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
diff --git a/lib/eal/freebsd/eal.c b/lib/eal/freebsd/eal.c
index 7008303e112a..6df6873e3889 100644
--- a/lib/eal/freebsd/eal.c
+++ b/lib/eal/freebsd/eal.c
@@ -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.
diff --git a/lib/eal/linux/meson.build b/lib/eal/linux/meson.build
index 5af456db9edb..e99ebed25692 100644
--- a/lib/eal/linux/meson.build
+++ b/lib/eal/linux/meson.build
@@ -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',
diff --git a/lib/eal/linux/eal_log.c b/lib/eal/unix/eal_log.c
similarity index 100%
rename from lib/eal/linux/eal_log.c
rename to lib/eal/unix/eal_log.c
diff --git a/lib/eal/unix/meson.build b/lib/eal/unix/meson.build
index cc7d67dd321d..37d07594df29 100644
--- a/lib/eal/unix/meson.build
+++ b/lib/eal/unix/meson.build
@@ -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',
--
2.39.2
More information about the dev
mailing list