diff --git a/src/pkg/runtime/netpoll_epoll.c b/src/pkg/runtime/netpoll_epoll.c index d6ef0d1446c..9b5980700ec 100644 --- a/src/pkg/runtime/netpoll_epoll.c +++ b/src/pkg/runtime/netpoll_epoll.c @@ -57,6 +57,7 @@ runtime·netpollclose(int32 fd) G* runtime·netpoll(bool block) { + static int32 lasterr; EpollEvent events[128], *ev; int32 n, i, waitms, mode; G *gp; @@ -69,8 +70,10 @@ runtime·netpoll(bool block) retry: n = runtime·epollwait(epfd, events, nelem(events), waitms); if(n < 0) { - if(n != -EINTR) - runtime·printf("epollwait failed with %d\n", -n); + if(n != -EINTR && n != lasterr) { + lasterr = n; + runtime·printf("runtime: epollwait on fd %d failed with %d\n", epfd, -n); + } goto retry; } gp = nil; diff --git a/src/pkg/runtime/netpoll_kqueue.c b/src/pkg/runtime/netpoll_kqueue.c index ad721e293ee..0ed03d31fa3 100644 --- a/src/pkg/runtime/netpoll_kqueue.c +++ b/src/pkg/runtime/netpoll_kqueue.c @@ -71,6 +71,7 @@ runtime·netpollclose(int32 fd) G* runtime·netpoll(bool block) { + static int32 lasterr; Kevent events[64], *ev; Timespec ts, *tp; int32 n, i; @@ -88,8 +89,10 @@ runtime·netpoll(bool block) retry: n = runtime·kevent(kq, nil, 0, events, nelem(events), tp); if(n < 0) { - if(n != -EINTR) - runtime·printf("kqueue failed with %d\n", -n); + if(n != -EINTR && n != lasterr) { + lasterr = n; + runtime·printf("runtime: kevent on fd %d failed with %d\n", kq, -n); + } goto retry; } for(i = 0; i < n; i++) {