aboutsummaryrefslogtreecommitdiffstats
path: root/src/io.c
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2012-02-06 19:44:47 -0500
committerBrian Cully <github.20.shmit@spamgourmet.com>2012-02-06 19:46:56 -0500
commit50f3c688a7cd4819680dbd19b9933c6cb5e62ca7 (patch)
tree5d9bf2edac40d874ec05bafc1e1e38b443879ce3 /src/io.c
parentd3b118481833acd44d724c06ce8c9d6b6ff2838a (diff)
downloadmysqlerl-50f3c688a7cd4819680dbd19b9933c6cb5e62ca7.tar.gz
mysqlerl-50f3c688a7cd4819680dbd19b9933c6cb5e62ca7.zip
Move most files into lib, add top-level makefile
Diffstat (limited to 'src/io.c')
-rw-r--r--src/io.c59
1 files changed, 0 insertions, 59 deletions
diff --git a/src/io.c b/src/io.c
deleted file mode 100644
index dcc055f..0000000
--- a/src/io.c
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2008, Brian Cully <bjc@kublai.com>
- */
-
-#include "io.h"
-#include "log.h"
-
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/uio.h>
-#include <unistd.h>
-
-int
-restartable_read(unsigned char *buf, size_t buflen)
-{
- ssize_t rc, readb;
-
- rc = 0;
- READLOOP:
- while (rc < buflen) {
- readb = read(STDIN_FILENO, buf + rc, buflen - rc);
- if (readb == -1) {
- if (errno == EAGAIN || errno == EINTR)
- goto READLOOP;
-
- return -1;
- } else if (readb == 0) {
- logmsg("ERROR: EOF trying to read additional %d bytes from "
- "standard input", buflen - rc);
- return -1;
- }
-
- rc += readb;
- }
-
- return rc;
-}
-
-int
-restartable_write(const unsigned char *buf, size_t buflen)
-{
- ssize_t rc, wroteb;
-
- rc = 0;
- WRITELOOP:
- while (rc < buflen) {
- wroteb = write(STDOUT_FILENO, buf + rc, buflen - rc);
- if (wroteb == -1) {
- if (errno == EAGAIN || errno == EINTR)
- goto WRITELOOP;
-
- return -1;
- }
-
- rc += wroteb;
- }
-
- return rc;
-}