summaryrefslogtreecommitdiff
path: root/xio.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2013-06-04 10:11:55 +0200
committerDaniel Borkmann <dborkman@redhat.com>2013-06-04 10:11:55 +0200
commit78a23a4d5ab27c8af26c0e232c099a0c16907649 (patch)
tree7abfec64bdb1c639faca541512e95b6f3bfa9aad /xio.c
parent22e4551cb007312ef808669aa70cad10a7657136 (diff)
xio: add ioexact operations
Break this out so that we only need to have sigint non-static where it is really needed. Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Diffstat (limited to 'xio.c')
-rw-r--r--xio.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/xio.c b/xio.c
index efc4ed4..be9d4cc 100644
--- a/xio.c
+++ b/xio.c
@@ -109,51 +109,3 @@ ssize_t write_or_die(int fd, const void *buf, size_t len)
return ret;
}
-
-extern volatile sig_atomic_t sigint;
-
-ssize_t read_exact(int fd, void *buf, size_t len, int mayexit)
-{
- ssize_t num = 0, written;
-
- while (len > 0 && !sigint) {
- if ((written = read(fd, buf, len)) < 0) {
- if (errno == EAGAIN && num > 0)
- continue;
- if (mayexit)
- return -1;
- else
- continue;
- }
- if (!written)
- return 0;
- len -= written;
- buf += written;
- num += written;
- }
-
- return num;
-}
-
-ssize_t write_exact(int fd, void *buf, size_t len, int mayexit)
-{
- ssize_t num = 0, written;
-
- while (len > 0 && !sigint) {
- if ((written = write(fd, buf, len)) < 0) {
- if (errno == EAGAIN && num > 0)
- continue;
- if (mayexit)
- return -1;
- else
- continue;
- }
- if (!written)
- return 0;
- len -= written;
- buf += written;
- num += written;
- }
-
- return num;
-}