From e321c206a88f222a599c222626b265c8ba3b7112 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Mon, 22 Jun 2020 09:39:08 +0200 Subject: Improve task descriptions --- announce.c | 2 +- cfgdir.c | 2 +- main.c | 15 +++++++-------- server.c | 4 ++-- uring.c | 11 +++++++---- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/announce.c b/announce.c index f85ba1e..9944851 100644 --- a/announce.c +++ b/announce.c @@ -128,7 +128,7 @@ announce_init(struct cfg *cfg) if (sfd < 0) die("socket: %m"); - uring_task_init(cfg, &aev->task, "aev", uring_parent(cfg), announce_free); + uring_task_init(cfg, &aev->task, "announce", uring_parent(cfg), announce_free); uring_task_set_fd(&aev->task, afd); aev->mcast_fd = sfd; cfg->aev = aev; diff --git a/cfgdir.c b/cfgdir.c index 8f6d9a3..3e8cef3 100644 --- a/cfgdir.c +++ b/cfgdir.c @@ -555,7 +555,7 @@ cfgdir_init(struct cfg *cfg) if (iwd < 0) die("inotify_add_watch: %m"); - uring_task_init(cfg, &iev->task, "iev", uring_parent(cfg), inotify_free); + uring_task_init(cfg, &iev->task, "server_config", uring_parent(cfg), inotify_free); uring_task_set_fd(&iev->task, ifd); cfg->iev = iev; uring_read(cfg, &iev->task, iev->buf, sizeof(iev->buf), inotify_cb); diff --git a/main.c b/main.c index 66ed1b4..3b1d02b 100644 --- a/main.c +++ b/main.c @@ -385,7 +385,7 @@ cfg_init(int argc, char **argv) cfg->uid = geteuid(); cfg->gid = getegid(); - uring_task_init(cfg, &cfg->task, "cfg", NULL, cfg_free); + uring_task_init(cfg, &cfg->task, "main", NULL, cfg_free); list_init(&cfg->servers); while (true) { @@ -544,7 +544,6 @@ cfg_apply(struct cfg *cfg) } struct signalfd_ev { - //struct signalfd_siginfo buf; struct cfg *cfg; struct uring_task task; struct uring_task_buf tbuf; @@ -573,9 +572,9 @@ dump_tree(struct cfg *cfg) if (!debug_enabled(DBG_REF)) return; - debug(DBG_REF, "\n\n"); - debug(DBG_REF, "Dumping Tree"); - debug(DBG_REF, "============"); + info("\n\n"); + info("Dumping Tree"); + info("============"); uring_task_refdump(&cfg->task); uring_refdump(cfg->uev); idle_refdump(cfg->idle); @@ -587,8 +586,8 @@ dump_tree(struct cfg *cfg) cfgdir_refdump(cfg->iev); list_for_each_entry(server, &cfg->servers, list) server_refdump(server); - debug(DBG_REF, "============"); - debug(DBG_REF, "\n\n"); + info("============"); + info("\n\n"); } static void @@ -725,7 +724,7 @@ signalfd_init(struct cfg *cfg) debug(DBG_SIG, "using pipe fds %i -> %i", sev->pipe[PIPE_WR], sev->pipe[PIPE_RD]); - uring_task_init(cfg, &sev->task, "sev", uring_parent(cfg), signalfd_free); + uring_task_init(cfg, &sev->task, "signal", uring_parent(cfg), signalfd_free); uring_task_set_fd(&sev->task, sev->pipe[PIPE_RD]); uring_task_set_buf(&sev->task, &sev->tbuf); cfg->sev = sev; diff --git a/server.c b/server.c index 145bcf9..1151cc4 100644 --- a/server.c +++ b/server.c @@ -923,7 +923,7 @@ server_new(struct cfg *cfg, const char *name) verbose("Adding server %s", name); server = zmalloc(sizeof(*server)); if (!server) { - error("malloc"); + error("malloc: %m"); return NULL; } @@ -935,7 +935,7 @@ server_new(struct cfg *cfg, const char *name) server->start_method = SERVER_START_METHOD_UNDEFINED; server->idle_timeout = 0; - uring_task_init(cfg, &server->task, "server", uring_parent(cfg), server_free); + uring_task_init(cfg, &server->task, server->name, uring_parent(cfg), server_free); uring_task_set_buf(&server->task, &server->tbuf); uring_task_init(cfg, &server->ann_task, "announce", &server->task, server_announce_free); diff --git a/uring.c b/uring.c index 88309f8..9430ca9 100644 --- a/uring.c +++ b/uring.c @@ -55,6 +55,9 @@ uring_task_refdump(struct uring_task *task) assert_return(task); + if (!debug_enabled(DBG_REF)) + return; + buf[0] = '\0'; for (tmp = task; tmp; tmp = tmp->parent) { size_t prefix; @@ -76,9 +79,9 @@ uring_task_refdump(struct uring_task *task) memcpy(dst, tmp->name, strlen(tmp->name)); } - debug(DBG_REF, "%s (0x%p parent 0x%p free 0x%p fd %i ref %u)", - buf, task, task->parent, task->free, task->fd, - task->refcount); + info("%s (0x%p parent 0x%p free 0x%p fd %i ref %u)", + buf, task, task->parent, task->free, task->fd, + task->refcount); } /* @@ -607,7 +610,7 @@ uring_init(struct cfg *cfg) debug(DBG_UR, "uring initialized, features: 0x%08x", uev->uring_params.features); - uring_task_init(cfg, &uev->task, "uev", &cfg->task, uring_free); + uring_task_init(cfg, &uev->task, "io_uring", &cfg->task, uring_free); cfg->uev = uev; uev->cfg = cfg; } -- cgit v1.2.3