Lines Matching refs:str
47 static int copyvec(evStream *str, const struct iovec *iov, int iocnt);
48 static void consume(evStream *str, size_t bytes);
49 static void done(evContext opaqueCtx, evStream *str);
135 evStream *str = id.opaque; in evTimeRW() local
139 str->timer = timer; in evTimeRW()
140 str->flags |= EV_STR_TIMEROK; in evTimeRW()
146 evStream *str = id.opaque; in evUntimeRW() local
150 str->flags &= ~EV_STR_TIMEROK; in evUntimeRW()
210 copyvec(evStream *str, const struct iovec *iov, int iocnt) { in copyvec() argument
213 str->iovOrig = (struct iovec *)memget(sizeof(struct iovec) * iocnt); in copyvec()
214 if (str->iovOrig == NULL) { in copyvec()
218 str->ioTotal = 0; in copyvec()
220 str->iovOrig[i] = iov[i]; in copyvec()
221 str->ioTotal += iov[i].iov_len; in copyvec()
223 str->iovOrigCount = iocnt; in copyvec()
224 str->iovCur = str->iovOrig; in copyvec()
225 str->iovCurCount = str->iovOrigCount; in copyvec()
226 str->ioDone = 0; in copyvec()
232 consume(evStream *str, size_t bytes) { in consume() argument
234 if (bytes < (size_t)str->iovCur->iov_len) { in consume()
235 str->iovCur->iov_len -= bytes; in consume()
236 str->iovCur->iov_base = (void *) in consume()
237 ((u_char *)str->iovCur->iov_base + bytes); in consume()
238 str->ioDone += bytes; in consume()
241 bytes -= str->iovCur->iov_len; in consume()
242 str->ioDone += str->iovCur->iov_len; in consume()
243 str->iovCur++; in consume()
244 str->iovCurCount--; in consume()
251 done(evContext opaqueCtx, evStream *str) { in done() argument
255 str->prevDone = ctx->strLast; in done()
256 ctx->strLast->nextDone = str; in done()
257 ctx->strLast = str; in done()
260 ctx->strDone = ctx->strLast = str; in done()
262 evDeselectFD(opaqueCtx, str->file); in done()
263 str->file.opaque = NULL; in done()
270 evStream *str = uap; in writable() local
275 bytes = writev(fd, str->iovCur, str->iovCurCount); in writable()
277 if ((str->flags & EV_STR_TIMEROK) != 0) in writable()
278 evTouchIdleTimer(opaqueCtx, str->timer); in writable()
279 consume(str, bytes); in writable()
282 str->ioDone = -1; in writable()
283 str->ioErrno = errno; in writable()
286 if (str->ioDone == -1 || str->ioDone == str->ioTotal) in writable()
287 done(opaqueCtx, str); in writable()
293 evStream *str = uap; in readable() local
298 bytes = readv(fd, str->iovCur, str->iovCurCount); in readable()
300 if ((str->flags & EV_STR_TIMEROK) != 0) in readable()
301 evTouchIdleTimer(opaqueCtx, str->timer); in readable()
302 consume(str, bytes); in readable()
305 str->ioDone = 0; in readable()
308 str->ioDone = -1; in readable()
309 str->ioErrno = errno; in readable()
313 if (str->ioDone <= 0 || str->ioDone == str->ioTotal) in readable()
314 done(opaqueCtx, str); in readable()