summaryrefslogtreecommitdiffstats
path: root/atomicio.c
diff options
context:
space:
mode:
Diffstat (limited to 'atomicio.c')
-rw-r--r--atomicio.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/atomicio.c b/atomicio.c
index f32ff85..575bf89 100644
--- a/atomicio.c
+++ b/atomicio.c
@@ -34,6 +34,10 @@
#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>
@@ -57,13 +61,13 @@ atomicio(ssize_t (*f) (int, void *, size_t), int fd, void *_s, size_t n)
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;
}
@@ -103,13 +107,13 @@ atomiciov(ssize_t (*f) (int, const struct iovec *, int), int fd,
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;
}
OpenPOWER on IntegriCloud