Lines Matching refs:str

43 static int	copyvec(evStream *str, const struct iovec *iov, int iocnt);
44 static void consume(evStream *str, size_t bytes);
45 static void done(evContext opaqueCtx, evStream *str);
131 evStream *str = id.opaque; in evTimeRW() local
135 str->timer = timer; in evTimeRW()
136 str->flags |= EV_STR_TIMEROK; in evTimeRW()
142 evStream *str = id.opaque; in evUntimeRW() local
146 str->flags &= ~EV_STR_TIMEROK; in evUntimeRW()
206 copyvec(evStream *str, const struct iovec *iov, int iocnt) { in copyvec() argument
209 str->iovOrig = (struct iovec *)memget(sizeof(struct iovec) * iocnt); in copyvec()
210 if (str->iovOrig == NULL) { in copyvec()
214 str->ioTotal = 0; in copyvec()
216 str->iovOrig[i] = iov[i]; in copyvec()
217 str->ioTotal += iov[i].iov_len; in copyvec()
219 str->iovOrigCount = iocnt; in copyvec()
220 str->iovCur = str->iovOrig; in copyvec()
221 str->iovCurCount = str->iovOrigCount; in copyvec()
222 str->ioDone = 0; in copyvec()
228 consume(evStream *str, size_t bytes) { in consume() argument
230 if (bytes < (size_t)str->iovCur->iov_len) { in consume()
231 str->iovCur->iov_len -= bytes; in consume()
232 str->iovCur->iov_base = (void *) in consume()
233 ((u_char *)str->iovCur->iov_base + bytes); in consume()
234 str->ioDone += bytes; in consume()
237 bytes -= str->iovCur->iov_len; in consume()
238 str->ioDone += str->iovCur->iov_len; in consume()
239 str->iovCur++; in consume()
240 str->iovCurCount--; in consume()
247 done(evContext opaqueCtx, evStream *str) { in done() argument
251 str->prevDone = ctx->strLast; in done()
252 ctx->strLast->nextDone = str; in done()
253 ctx->strLast = str; in done()
256 ctx->strDone = ctx->strLast = str; in done()
258 evDeselectFD(opaqueCtx, str->file); in done()
259 str->file.opaque = NULL; in done()
266 evStream *str = uap; in writable() local
271 bytes = writev(fd, str->iovCur, str->iovCurCount); in writable()
273 if ((str->flags & EV_STR_TIMEROK) != 0) in writable()
274 evTouchIdleTimer(opaqueCtx, str->timer); in writable()
275 consume(str, bytes); in writable()
278 str->ioDone = -1; in writable()
279 str->ioErrno = errno; in writable()
282 if (str->ioDone == -1 || str->ioDone == str->ioTotal) in writable()
283 done(opaqueCtx, str); in writable()
289 evStream *str = uap; in readable() local
294 bytes = readv(fd, str->iovCur, str->iovCurCount); in readable()
296 if ((str->flags & EV_STR_TIMEROK) != 0) in readable()
297 evTouchIdleTimer(opaqueCtx, str->timer); in readable()
298 consume(str, bytes); in readable()
301 str->ioDone = 0; in readable()
304 str->ioDone = -1; in readable()
305 str->ioErrno = errno; in readable()
309 if (str->ioDone <= 0 || str->ioDone == str->ioTotal) in readable()
310 done(opaqueCtx, str); in readable()