]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
debug: Use separate log group for watcher_t
authorTobias Brunner <tobias@strongswan.org>
Tue, 27 May 2025 09:27:41 +0000 (11:27 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 27 May 2025 15:41:02 +0000 (17:41 +0200)
This component produces a lot of messages that make debugging job
handling difficult.

src/libstrongswan/processing/watcher.c
src/libstrongswan/utils/debug.c
src/libstrongswan/utils/debug.h

index a86ec0910d1c6dad739c5a75220e34c81609bb80..e0b547d8adc19c23476d29617d529a901a5d8ff9 100644 (file)
@@ -189,7 +189,7 @@ static void update_and_unlock(private_watcher_t *this)
 
        if (error)
        {
-               DBG1(DBG_JOB, "notifying watcher failed: %s", strerror(error));
+               DBG1(DBG_WCH, "notifying watcher failed: %s", strerror(error));
        }
 }
 
@@ -251,13 +251,13 @@ static void notify_end(notify_data_t *data)
 
        if (removed)
        {
-               DBG3(DBG_JOB, "removed fd %d[%s%s] from watcher after callback", data->fd,
+               DBG3(DBG_WCH, "removed fd %d[%s%s] from watcher after callback", data->fd,
                         data->event & WATCHER_READ ? "r" : "",
                         data->event & WATCHER_WRITE ? "w" : "");
        }
        else if (updated)
        {
-               DBG3(DBG_JOB, "updated fd %d[%s%s] to %d[%s%s] after callback", data->fd,
+               DBG3(DBG_WCH, "updated fd %d[%s%s] to %d[%s%s] after callback", data->fd,
                         (updated | data->event) & WATCHER_READ ? "r" : "",
                         (updated | data->event) & WATCHER_WRITE ? "w" : "", data->fd,
                         updated & WATCHER_READ ? "r" : "",
@@ -417,7 +417,7 @@ static job_requeue_t watch(private_watcher_t *this)
 #if DEBUG_LEVEL >= 3
        if (logbuf[0])
        {
-               DBG3(DBG_JOB, "observing fds:%s", logbuf);
+               DBG3(DBG_WCH, "observing fds:%s", logbuf);
        }
 #endif
 
@@ -429,7 +429,7 @@ static job_requeue_t watch(private_watcher_t *this)
                ssize_t len;
                job_t *job;
 
-               DBG2(DBG_JOB, "watcher is observing %d fds", count-1);
+               DBG2(DBG_WCH, "watcher is observing %d fds", count-1);
                thread_cleanup_push((void*)activate_all, this);
                old = thread_cancelability(TRUE);
 
@@ -455,14 +455,14 @@ static job_requeue_t watch(private_watcher_t *this)
                                        {
                                                if (errno != EAGAIN && errno != EWOULDBLOCK)
                                                {
-                                                       DBG1(DBG_JOB, "reading watcher notify failed: %s",
+                                                       DBG1(DBG_WCH, "reading watcher notify failed: %s",
                                                                 strerror(errno));
                                                }
                                                break;
                                        }
                                }
                                this->pending = FALSE;
-                               DBG2(DBG_JOB, "watcher got notification, rebuilding");
+                               DBG2(DBG_WCH, "watcher got notification, rebuilding");
                                break;
                        }
 
@@ -506,7 +506,7 @@ static job_requeue_t watch(private_watcher_t *this)
 #if DEBUG_LEVEL >= 2
                        if (logbuf[0])
                        {
-                               DBG2(DBG_JOB, "events on fds:%s", logbuf);
+                               DBG2(DBG_WCH, "events on fds:%s", logbuf);
                        }
 #endif
 
@@ -525,7 +525,7 @@ static job_requeue_t watch(private_watcher_t *this)
                {
                        if (!this->pending && errno != EINTR)
                        {       /* complain only if no pending updates */
-                               DBG1(DBG_JOB, "watcher poll() error: %s", strerror(errno));
+                               DBG1(DBG_WCH, "watcher poll() error: %s", strerror(errno));
                        }
                        break;
                }
@@ -546,7 +546,7 @@ METHOD(watcher_t, add, void,
                .data = data,
        );
 
-       DBG3(DBG_JOB, "adding fd %d[%s%s] to watcher", fd,
+       DBG3(DBG_WCH, "adding fd %d[%s%s] to watcher", fd,
                 events & WATCHER_READ ? "r" : "",
                 events & WATCHER_WRITE ? "w" : "");
 
@@ -605,7 +605,7 @@ METHOD(watcher_t, remove_, void,
        {
                update_and_unlock(this);
 
-               DBG3(DBG_JOB, "removed fd %d[%s%s] from watcher", fd,
+               DBG3(DBG_WCH, "removed fd %d[%s%s] from watcher", fd,
                         found & WATCHER_READ ? "r" : "",
                         found & WATCHER_WRITE ? "w" : "");
        }
index a5d478421e83c5218556d6f6568dbb712bad68fc..51e54749df2343f844b0b80bfb713d3f8a087f9c 100644 (file)
@@ -24,6 +24,7 @@ ENUM(debug_names, DBG_DMN, DBG_ANY,
        "IKE",
        "CHD",
        "JOB",
+       "WCH",
        "CFG",
        "KNL",
        "NET",
@@ -46,6 +47,7 @@ ENUM(debug_lower_names, DBG_DMN, DBG_ANY,
        "ike",
        "chd",
        "job",
+       "wch",
        "cfg",
        "knl",
        "net",
index 06d43ebbff237ba663c08d7fc4e33e21b5d8be1d..51865a8cf80be4942ba49ebf30795bd38533ba2d 100644 (file)
@@ -43,6 +43,8 @@ enum debug_t {
        DBG_CHD,
        /** job processing */
        DBG_JOB,
+       /** file descriptor watcher */
+       DBG_WCH,
        /** configuration backends */
        DBG_CFG,
        /** kernel interface */