summaryrefslogtreecommitdiff
path: root/src/OS/os.c-GNU
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2019-12-17 20:35:28 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2019-12-18 00:07:22 +0000
commit2791749f220602482c2cce772e6520c54218c0dd (patch)
tree63f24cfce6199d0ced7bfe06f1456a797c3b1760 /src/OS/os.c-GNU
parentf8f40a64d41c4d47b974810320ab257e2eac0cf3 (diff)
GNU/Hurd: retry EINTR returns from pipe I/O
Replaces: a76f64c3d4
Diffstat (limited to 'src/OS/os.c-GNU')
-rw-r--r--src/OS/os.c-GNU35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/OS/os.c-GNU b/src/OS/os.c-GNU
index e5d6ff66c..06226839b 100644
--- a/src/OS/os.c-GNU
+++ b/src/OS/os.c-GNU
@@ -52,4 +52,39 @@ return -1;
}
#endif /* OS_LOAD_AVERAGE */
+
+ssize_t
+os_pipe_read(int fd, void * buf, size_t count)
+{
+for (int rc, retries = 10; retries > 0; retries--)
+ {
+ if ((rc = read(fd, buf, count) >= 0) break;
+ if (rc != -1 || errno != EINTR) break;
+ }
+return rc;
+}
+
+
+ssize_t
+os_pipe_write(int fd, void * buf, size_t count)
+{
+for (int rc, retries = 10; retries > 0; retries--)
+ {
+ if ((rc = write(fd, buf, count) >= 0) break;
+ if (rc != -1 || errno != EINTR) break;
+ }
+return rc;
+}
+
+ssize_t
+os_pipe_writev(int fd, const struct iovec * iov, int iovcnt
+{
+for (int rc, retries = 10; retries > 0; retries--)
+ {
+ if ((rc = writev(fd, iov, iovcnt) >= 0) break;
+ if (rc != -1 || errno != EINTR) break;
+ }
+return rc;
+}
+
/* End of os.c-GNU */