summaryrefslogtreecommitdiff
path: root/lib/thread.c
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2019-06-12 22:36:45 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2019-06-13 15:14:04 -0400
commita0b36ae6733dfe44d192382b8fd583df30d555fd (patch)
tree033abc884ee6d3c9d85a05cc428c8a3b6d2ae62b /lib/thread.c
parent1ef14bee7aa063a939a3bffb11e2931c23fdf8f5 (diff)
lib: Add function name to `show thread poll`
When displaying `show thread poll` data add the function we are supposed to call when the poll event happens. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib/thread.c')
-rw-r--r--lib/thread.c29
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/thread.c b/lib/thread.c
index 9d00d7c52d..fc2de09df0 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -307,6 +307,7 @@ static void show_thread_poll_helper(struct vty *vty, struct thread_master *m)
{
const char *name = m->name ? m->name : "main";
char underline[strlen(name) + 1];
+ struct thread *thread;
uint32_t i;
memset(underline, '-', sizeof(underline));
@@ -316,11 +317,31 @@ static void show_thread_poll_helper(struct vty *vty, struct thread_master *m)
vty_out(vty, "----------------------%s\n", underline);
vty_out(vty, "Count: %u/%d\n", (uint32_t)m->handler.pfdcount,
m->fd_limit);
- for (i = 0; i < m->handler.pfdcount; i++)
- vty_out(vty, "\t%6d fd:%6d events:%2d revents:%2d\n", i,
- m->handler.pfds[i].fd,
- m->handler.pfds[i].events,
+ for (i = 0; i < m->handler.pfdcount; i++) {
+ vty_out(vty, "\t%6d fd:%6d events:%2d revents:%2d\t\t", i,
+ m->handler.pfds[i].fd, m->handler.pfds[i].events,
m->handler.pfds[i].revents);
+
+ if (m->handler.pfds[i].events & POLLIN) {
+ thread = m->read[m->handler.pfds[i].fd];
+
+ if (!thread)
+ vty_out(vty, "ERROR ");
+ else
+ vty_out(vty, "%s ", thread->funcname);
+ } else
+ vty_out(vty, " ");
+
+ if (m->handler.pfds[i].events & POLLOUT) {
+ thread = m->write[m->handler.pfds[i].fd];
+
+ if (!thread)
+ vty_out(vty, "ERROR\n");
+ else
+ vty_out(vty, "%s\n", thread->funcname);
+ } else
+ vty_out(vty, "\n");
+ }
}
DEFUN (show_thread_poll,