#include <errno.h>
#ifdef HAVE_POLL_H
#include <poll.h>
+#else
+# ifdef HAVE_SYS_POLL_H
+# include <sys/poll.h>
+# endif
#endif
#include <string.h>
#include <unistd.h>
res = (f) (fd, s + pos, n - pos);
switch (res) {
case -1:
-#ifdef EWOULDBLOCK
- if (errno == EINTR || errno == EWOULDBLOCK)
-#else
if (errno == EINTR)
-#endif
continue;
+#ifdef EWOULDBLOCK
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
+#else
if (errno == EAGAIN) {
+#endif
(void)poll(&pfd, 1, -1);
continue;
}
res = (f) (fd, iov, iovcnt);
switch (res) {
case -1:
-#ifdef EWOULDBLOCK
- if (errno == EINTR || errno == EWOULDBLOCK)
-#else
if (errno == EINTR)
-#endif
continue;
+#ifdef EWOULDBLOCK
+ if (errno == EAGAIN || errno == EWOULDBLOCK) {
+#else
if (errno == EAGAIN) {
+#endif
(void)poll(&pfd, 1, -1);
continue;
}