fixeria has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmocore/+/41685?usp=email )


Change subject: logging: change gsmtap target to use wqueue by default
......................................................................

logging: change gsmtap target to use wqueue by default

In b72867f0 ("logging: Change stderr + file target to use non-blocking
write") the `stderr` and `file` targets were changed to use the write
queue in order to avoid blocking.  Do the same for the `gsmtap` logging
target, which can also be blocking under some circumstances.

Change-Id: I9d8c953a5b467ce4396d2d20ca6fa72a749723c0
Related: OS#6794, OS#4311
---
M include/osmocom/core/logging.h
M src/core/logging_gsmtap.c
M src/vty/logging_vty.c
3 files changed, 14 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/85/41685/1

diff --git a/include/osmocom/core/logging.h b/include/osmocom/core/logging.h
index 9d4f1fb..de493a7 100644
--- a/include/osmocom/core/logging.h
+++ b/include/osmocom/core/logging.h
@@ -353,6 +353,7 @@
                        struct gsmtap_inst *gsmtap_inst;
                        const char *ident;
                        const char *hostname;
+                       bool ofd_wq_mode;
                } tgt_gsmtap;

                struct {
diff --git a/src/core/logging_gsmtap.c b/src/core/logging_gsmtap.c
index 7775c27..b275ae7 100644
--- a/src/core/logging_gsmtap.c
+++ b/src/core/logging_gsmtap.c
@@ -156,6 +156,7 @@
        target->tgt_gsmtap.gsmtap_inst = gti;
        target->tgt_gsmtap.ident = talloc_strdup(target, ident);
        target->tgt_gsmtap.hostname = talloc_strdup(target, host);
+       target->tgt_gsmtap.ofd_wq_mode = ofd_wq_mode;

        target->type = LOG_TGT_TYPE_GSMTAP;
        target->raw_output = _gsmtap_raw_output;
diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c
index 678ae68..947da49 100644
--- a/src/vty/logging_vty.c
+++ b/src/vty/logging_vty.c
@@ -810,9 +810,10 @@
 }

 DEFUN(cfg_log_gsmtap, cfg_log_gsmtap_cmd,
-       "log gsmtap [HOSTNAME]",
+       "log gsmtap [HOSTNAME] [blocking-io]",
        LOG_STR "Logging via GSMTAP\n"
-       "Host name to send the GSMTAP logging to (UDP port 4729)\n")
+       "Host name to send the GSMTAP logging to (UDP port 4729)\n"
+       "Use blocking, synchronous I/O\n")
 {
        const char *hostname = argc ? argv[0] : "127.0.0.1";
        struct log_target *tgt;
@@ -820,8 +821,12 @@
        log_tgt_mutex_lock();
        tgt = log_target_find(LOG_TGT_TYPE_GSMTAP, hostname);
        if (!tgt) {
+               bool ofd_wq_mode = true;
+               if (argc > 1 && !strcmp(argv[1], "blocking-io"))
+                       ofd_wq_mode = false;
                tgt = log_target_create_gsmtap(hostname, GSMTAP_UDP_PORT,
-                                              host.app_info->name, false,
+                                              host.app_info->name,
+                                              ofd_wq_mode,
                                               true);
                if (!tgt) {
                        vty_out(vty, "%% Unable to create GSMTAP log for %s%s",
@@ -1039,8 +1044,10 @@
                        log_target_rb_avail_size(tgt), VTY_NEWLINE);
                break;
        case LOG_TGT_TYPE_GSMTAP:
-               vty_out(vty, "log gsmtap %s%s",
-                       tgt->tgt_gsmtap.hostname, VTY_NEWLINE);
+               if (tgt->tgt_gsmtap.ofd_wq_mode)
+                       vty_out(vty, "log gsmtap %s%s", 
tgt->tgt_gsmtap.hostname, VTY_NEWLINE);
+               else
+                       vty_out(vty, "log gsmtap %s blocking-io%s", 
tgt->tgt_gsmtap.hostname, VTY_NEWLINE);
                break;
        case LOG_TGT_TYPE_SYSTEMD:
                vty_out(vty, "log systemd-journal%s%s",

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41685?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I9d8c953a5b467ce4396d2d20ca6fa72a749723c0
Gerrit-Change-Number: 41685
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>

Reply via email to