+static void Tvbpollevents(int events) {
+ const char *delim= "";
+
+ events &= (POLLIN|POLLOUT|POLLPRI);
+ if (!events) { Tvba("0"); return; }
+ if (events & POLLIN) { Tvba("POLLIN"); delim= "|"; }
+ if (events & POLLOUT) { Tvba(delim); Tvba("POLLOUT"); delim= "|"; }
+ if (events & POLLPRI) { Tvba(delim); Tvba("POLLPRI"); }
+}
+
+void Tvbpollfds(const struct pollfd *fds, int nfds) {
+ const char *comma= "";
+
+ Tvba("[");
+ while (nfds>0) {
+ Tvba(comma);
+ Tvbf("{fd=%d, events=",fds->fd);
+ Tvbpollevents(fds->events);
+ Tvba(", revents=");
+ Tvbpollevents(fds->revents);
+ Tvba("}");
+ comma= ", ";
+ nfds--; fds++;
+ }
+ Tvba("]");
+}
+