Lines Matching refs:str
49 static int copyvec(evStream *str, const struct iovec *iov, int iocnt);
50 static void consume(evStream *str, size_t bytes);
51 static void done(evContext opaqueCtx, evStream *str);
137 evStream *str = id.opaque; in evTimeRW() local
141 str->timer = timer; in evTimeRW()
142 str->flags |= EV_STR_TIMEROK; in evTimeRW()
148 evStream *str = id.opaque; in evUntimeRW() local
152 str->flags &= ~EV_STR_TIMEROK; in evUntimeRW()
212 copyvec(evStream *str, const struct iovec *iov, int iocnt) { in copyvec() argument
215 str->iovOrig = (struct iovec *)memget(sizeof(struct iovec) * iocnt); in copyvec()
216 if (str->iovOrig == NULL) { in copyvec()
220 str->ioTotal = 0; in copyvec()
222 str->iovOrig[i] = iov[i]; in copyvec()
223 str->ioTotal += iov[i].iov_len; in copyvec()
225 str->iovOrigCount = iocnt; in copyvec()
226 str->iovCur = str->iovOrig; in copyvec()
227 str->iovCurCount = str->iovOrigCount; in copyvec()
228 str->ioDone = 0; in copyvec()
234 consume(evStream *str, size_t bytes) { in consume() argument
236 if (bytes < (size_t)str->iovCur->iov_len) { in consume()
237 str->iovCur->iov_len -= bytes; in consume()
238 str->iovCur->iov_base = (void *) in consume()
239 ((u_char *)str->iovCur->iov_base + bytes); in consume()
240 str->ioDone += bytes; in consume()
243 bytes -= str->iovCur->iov_len; in consume()
244 str->ioDone += str->iovCur->iov_len; in consume()
245 str->iovCur++; in consume()
246 str->iovCurCount--; in consume()
253 done(evContext opaqueCtx, evStream *str) { in done() argument
257 str->prevDone = ctx->strLast; in done()
258 ctx->strLast->nextDone = str; in done()
259 ctx->strLast = str; in done()
262 ctx->strDone = ctx->strLast = str; in done()
264 evDeselectFD(opaqueCtx, str->file); in done()
265 str->file.opaque = NULL; in done()
272 evStream *str = uap; in writable() local
277 bytes = writev(fd, str->iovCur, str->iovCurCount); in writable()
279 if ((str->flags & EV_STR_TIMEROK) != 0) in writable()
280 evTouchIdleTimer(opaqueCtx, str->timer); in writable()
281 consume(str, bytes); in writable()
284 str->ioDone = -1; in writable()
285 str->ioErrno = errno; in writable()
288 if (str->ioDone == -1 || str->ioDone == str->ioTotal) in writable()
289 done(opaqueCtx, str); in writable()
295 evStream *str = uap; in readable() local
300 bytes = readv(fd, str->iovCur, str->iovCurCount); in readable()
302 if ((str->flags & EV_STR_TIMEROK) != 0) in readable()
303 evTouchIdleTimer(opaqueCtx, str->timer); in readable()
304 consume(str, bytes); in readable()
307 str->ioDone = 0; in readable()
310 str->ioDone = -1; in readable()
311 str->ioErrno = errno; in readable()
315 if (str->ioDone <= 0 || str->ioDone == str->ioTotal) in readable()
316 done(opaqueCtx, str); in readable()