15 while (s == -1 && errno == EINTR);
26 assert (! buffers || into);
35 std::vector<iovec> bufs (buffers);
38 bufs [
i].iov_len = into [
i].
size ();
39 bufs [
i].iov_base = (caddr_t) into [
i].
data ();
45 while (n == -1 && errno == EINTR);
64 while (s == -1 && errno == EINTR);
66 if (s == -1 && errno != EWOULDBLOCK)
67 throwStorageError (
"FileWriteError",
"Calling IOChannel::write()",
"write()", errno);
69 return s >= 0 ? s : 0;
75 assert (! buffers || from);
84 std::vector<iovec> bufs (buffers);
87 bufs [
i].iov_len = from [
i].
size ();
88 bufs [
i].iov_base = (caddr_t) from [
i].
data ();
94 while (n == -1 && errno == EINTR);
98 throwStorageError (
"FileWriteError",
"Calling IOChannel::writev()",
"writev()", errno);
112 int off = value ? ~0 : ~(O_NDELAY |
O_NONBLOCK);
115 if ((mode = fcntl (
fd (), F_GETFL, 0)) == -1
116 || fcntl (
fd (), F_SETFL, (mode & off) | on) == -1)
117 throwStorageError (
"FileSetBlockingError",
"Calling IOChannel::setBlocking()",
"fcntl()", errno);
118 #elif defined FIONBIO
120 if (ioctl (
fd (), FIONBIO, &value) == -1)
121 throwStorageError (
"FileSetBlockingError",
"Calling IOChannel::setBlocking()",
"ioctl()", errno);
130 if ((mode = fcntl (
fd (), F_GETFL, 0)) == -1)
131 throwStorageError (
"FileIsBlockingError",
"Calling IOChannel::isBlocking()",
"fcntl()", errno);
134 #else // ! O_NONBLOCK
146 if (error) *error = errno;
tuple ret
prodAgent to be discontinued
void throwStorageError(const char *category, 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)
virtual bool isBlocking(void) const
virtual IOFD fd(void) const
virtual IOSize readv(IOBuffer *into, IOSize buffers)