From: Tobias Brunner Date: Tue, 27 May 2025 09:27:41 +0000 (+0200) Subject: debug: Use separate log group for watcher_t X-Git-Tag: 6.0.2dr1~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2b1f0e8c6e6ab8ae858d05fe1365e1f1095aaf41;p=thirdparty%2Fstrongswan.git debug: Use separate log group for watcher_t This component produces a lot of messages that make debugging job handling difficult. --- diff --git a/src/libstrongswan/processing/watcher.c b/src/libstrongswan/processing/watcher.c index a86ec0910d..e0b547d8ad 100644 --- a/src/libstrongswan/processing/watcher.c +++ b/src/libstrongswan/processing/watcher.c @@ -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" : ""); } diff --git a/src/libstrongswan/utils/debug.c b/src/libstrongswan/utils/debug.c index a5d478421e..51e54749df 100644 --- a/src/libstrongswan/utils/debug.c +++ b/src/libstrongswan/utils/debug.c @@ -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", diff --git a/src/libstrongswan/utils/debug.h b/src/libstrongswan/utils/debug.h index 06d43ebbff..51865a8cf8 100644 --- a/src/libstrongswan/utils/debug.h +++ b/src/libstrongswan/utils/debug.h @@ -43,6 +43,8 @@ enum debug_t { DBG_CHD, /** job processing */ DBG_JOB, + /** file descriptor watcher */ + DBG_WCH, /** configuration backends */ DBG_CFG, /** kernel interface */