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


Change subject: logging_vty: Set 'gsmtap log nonblocking-io' as default
......................................................................

logging_vty: Set 'gsmtap log nonblocking-io' as default

Apps using a VTY are expected to be using an event loop, and hence
should not be using blocking operations which would stall the event
loop.

If user fears losing messages (eg, when enabling a lot of DEBUG),
then the taget can still be switched to "wq" at the expense of
losing performance, or increasing the kernel UDP socket sndbuf by means
of sysctl net.core.wmem_{default,max}.

Related: OS#6213
Related: OS#6794
Change-Id: Ifca8a821e13ec1327ab2476b0db91078fcff948b
---
M src/vty/logging_vty.c
1 file changed, 7 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/03/41703/1

diff --git a/src/vty/logging_vty.c b/src/vty/logging_vty.c
index 1c030b5..77b09d8 100644
--- a/src/vty/logging_vty.c
+++ b/src/vty/logging_vty.c
@@ -815,13 +815,13 @@
        "log gsmtap [HOSTNAME] [(nonblocking-io|blocking-io|wq)]",
        LOG_STR "Logging via GSMTAP\n"
        "Host name to send the GSMTAP logging to (UDP port 4729)\n"
-       "Use non-blocking, synchronous I/O (may lose msgs if UDP sndbuf becomes 
full)\n"
-       "Use blocking, synchronous I/O (only for debug purposes or when 
blocking is acceptable) (default)\n"
+       "Use non-blocking, synchronous I/O (may lose msgs if UDP sndbuf becomes 
full) (default)\n"
+       "Use blocking, synchronous I/O (only for debug purposes or when 
blocking is acceptable)\n"
        "Use Tx workqueue, asynchronous I/O (may lose msgs if queue becomes 
full)\n")
 {
        const char *hostname = argc > 0 ? argv[0] : "127.0.0.1";
        bool ofd_wq_mode = argc > 1 && (strcmp(argv[1], "wq") == 0);
-       bool nonblocking_io = argc > 1 && (strcmp(argv[1], "nonblocking-io") == 
0);
+       bool blocking_io = argc > 1 && (strcmp(argv[1], "blocking-io") == 0);
        struct log_target *tgt;

        log_tgt_mutex_lock();
@@ -835,7 +835,7 @@
                                hostname, VTY_NEWLINE);
                        RET_WITH_UNLOCK(CMD_WARNING);
                }
-               if (!ofd_wq_mode && nonblocking_io) {
+               if (!ofd_wq_mode && !blocking_io) {
                        int rc = 
gsmtap_source_set_nonblock(tgt->tgt_gsmtap.gsmtap_inst, 1);
                        if (rc != 0)
                                vty_out(vty, "%% Unable to configre GSMTAP log 
for %s as nonblocking-io%s",
@@ -850,7 +850,7 @@
                }
                if (!ofd_wq_mode) {
                        int fd = gsmtap_inst_fd2(tgt->tgt_gsmtap.gsmtap_inst);
-                       if (fd > 0 && osmo_sock_get_nonblock(fd) != 
nonblocking_io) {
+                       if (fd > 0 && !osmo_sock_get_nonblock(fd) != 
blocking_io) {
                                vty_out(vty, "%% Remove and re-add the log 
gsmtap target in order to "
                                        "change between blocking and 
non-blocking IO%s", VTY_NEWLINE);
                                RET_WITH_UNLOCK(CMD_WARNING);
@@ -1071,8 +1071,8 @@
                        pars = " wq";
                } else {
                        int fd = gsmtap_inst_fd2(tgt->tgt_gsmtap.gsmtap_inst);
-                       if (fd > 0 && osmo_sock_get_nonblock(fd))
-                               pars = " nonblocking-io";
+                       if (fd > 0 && !osmo_sock_get_nonblock(fd))
+                               pars = " blocking-io";
                        else
                                pars = "";
                }

--
To view, visit https://gerrit.osmocom.org/c/libosmocore/+/41703?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: Ifca8a821e13ec1327ab2476b0db91078fcff948b
Gerrit-Change-Number: 41703
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>

Reply via email to