mirror of
https://github.com/servalproject/serval-dna.git
synced 2025-05-02 16:52:55 +00:00
DEBUG_IO logging for all poll() invocations
This commit is contained in:
parent
c7488de510
commit
9eeaeb9dab
10
fdqueue.c
10
fdqueue.c
@ -19,6 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||||||
|
|
||||||
#include "serval.h"
|
#include "serval.h"
|
||||||
#include "strbuf.h"
|
#include "strbuf.h"
|
||||||
|
#include "strbuf_helpers.h"
|
||||||
#include <poll.h>
|
#include <poll.h>
|
||||||
|
|
||||||
#define MAX_WATCHED_FDS 128
|
#define MAX_WATCHED_FDS 128
|
||||||
@ -170,15 +171,20 @@ int fd_poll()
|
|||||||
{
|
{
|
||||||
struct call_stats call_stats;
|
struct call_stats call_stats;
|
||||||
fd_func_enter(&call_stats);
|
fd_func_enter(&call_stats);
|
||||||
|
r = poll(fds, fdcount, ms);
|
||||||
|
if (debug & DEBUG_IO) {
|
||||||
strbuf b = strbuf_alloca(1024);
|
strbuf b = strbuf_alloca(1024);
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < fdcount; ++i) {
|
for (i = 0; i < fdcount; ++i) {
|
||||||
if (i)
|
if (i)
|
||||||
strbuf_puts(b, ", ");
|
strbuf_puts(b, ", ");
|
||||||
strbuf_sprintf(b, "%d:%04x:%04x", fds[i].fd, fds[i].events, fds[i].revents);
|
strbuf_sprintf(b, "%d:", fds[i].fd);
|
||||||
|
strbuf_append_poll_events(b, fds[i].events);
|
||||||
|
strbuf_putc(b, ':');
|
||||||
|
strbuf_append_poll_events(b, fds[i].revents);
|
||||||
}
|
}
|
||||||
r = poll(fds, fdcount, ms);
|
|
||||||
DEBUGF("poll(fds=(%s), fdcount=%d, ms=%d) = %d", strbuf_str(b), fdcount, ms, r);
|
DEBUGF("poll(fds=(%s), fdcount=%d, ms=%d) = %d", strbuf_str(b), fdcount, ms, r);
|
||||||
|
}
|
||||||
fd_func_exit(&call_stats, &poll_stats);
|
fd_func_exit(&call_stats, &poll_stats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user