14 while (s == -1 && errno == EINTR);
25 assert (! buffers || into);
34 std::vector<iovec> bufs (buffers);
37 bufs [
i].iov_len = into [
i].
size ();
38 bufs [
i].iov_base = (caddr_t) into [
i].
data ();
44 while (n == -1 && errno == EINTR);
63 while (s == -1 && errno == EINTR);
65 if (s == -1 && errno != EWOULDBLOCK)
68 return s >= 0 ? s : 0;
74 assert (! buffers || from);
83 std::vector<iovec> bufs (buffers);
86 bufs [
i].iov_len = from [
i].
size ();
87 bufs [
i].iov_base = (caddr_t) from [
i].
data ();
93 while (n == -1 && errno == EINTR);
111 int off = value ? ~0 : ~(O_NDELAY |
O_NONBLOCK);
114 if ((mode = fcntl (
fd (), F_GETFL, 0)) == -1
115 || fcntl (
fd (), F_SETFL, (mode & off) | on) == -1)
117 #elif defined FIONBIO
119 if (ioctl (
fd (), FIONBIO, &value) == -1)
129 if ((mode = fcntl (
fd (), F_GETFL, 0)) == -1)
133 #else // ! O_NONBLOCK
145 if (error) *error = errno;
void throwStorageError(const char *context, const char *call, int error)
virtual IOSize writev(const IOBuffer *from, IOSize buffers)
bool sysclose(IOFD fd, int *error=0)
virtual IOSize write(const void *from, IOSize n)
virtual void setBlocking(bool value)
static std::string from(" from ")
virtual bool isBlocking(void) const
virtual IOFD fd(void) const
virtual IOSize readv(IOBuffer *into, IOSize buffers)