From: Amaury Denoyelle Date: Tue, 4 Aug 2026 14:54:19 +0000 (+0200) Subject: MINOR: list: define watcher_is_attached() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=32c2757c7fb6840500b835d9df8e52a8cbcf509d;p=thirdparty%2Fhaproxy.git MINOR: list: define watcher_is_attached() Define an utility function to report if a watcher is currently attached on a target. This will notably be used to implement a new CLI command "show default-server". --- diff --git a/include/haproxy/list.h b/include/haproxy/list.h index 95cc78a75..e4c75dc6f 100644 --- a/include/haproxy/list.h +++ b/include/haproxy/list.h @@ -272,6 +272,12 @@ static __inline void watcher_init(struct watcher *w, void *pptr, size_t attach_o w->off = attach_off; } +/* Returns true if is currently tracking a target else false. */ +static __inline int watcher_is_attached(const struct watcher *w) +{ + return MT_LIST_INLIST(&w->el); +} + /* Tracks via watcher. Invalid if is already attached. */ static __inline void watcher_attach(struct watcher *w, void *target) {