Lines Matching refs:str

46 static int	copyvec(evStream *str, const struct iovec *iov, int iocnt);
47 static void consume(evStream *str, size_t bytes);
48 static void done(evContext opaqueCtx, evStream *str);
134 evStream *str = id.opaque; in evTimeRW() local
138 str->timer = timer; in evTimeRW()
139 str->flags |= EV_STR_TIMEROK; in evTimeRW()
145 evStream *str = id.opaque; in evUntimeRW() local
149 str->flags &= ~EV_STR_TIMEROK; in evUntimeRW()
209 copyvec(evStream *str, const struct iovec *iov, int iocnt) { in copyvec() argument
212 str->iovOrig = (struct iovec *)memget(sizeof(struct iovec) * iocnt); in copyvec()
213 if (str->iovOrig == NULL) { in copyvec()
217 str->ioTotal = 0; in copyvec()
219 str->iovOrig[i] = iov[i]; in copyvec()
220 str->ioTotal += iov[i].iov_len; in copyvec()
222 str->iovOrigCount = iocnt; in copyvec()
223 str->iovCur = str->iovOrig; in copyvec()
224 str->iovCurCount = str->iovOrigCount; in copyvec()
225 str->ioDone = 0; in copyvec()
231 consume(evStream *str, size_t bytes) { in consume() argument
233 if (bytes < (size_t)str->iovCur->iov_len) { in consume()
234 str->iovCur->iov_len -= bytes; in consume()
235 str->iovCur->iov_base = (void *) in consume()
236 ((u_char *)str->iovCur->iov_base + bytes); in consume()
237 str->ioDone += bytes; in consume()
240 bytes -= str->iovCur->iov_len; in consume()
241 str->ioDone += str->iovCur->iov_len; in consume()
242 str->iovCur++; in consume()
243 str->iovCurCount--; in consume()
250 done(evContext opaqueCtx, evStream *str) { in done() argument
254 str->prevDone = ctx->strLast; in done()
255 ctx->strLast->nextDone = str; in done()
256 ctx->strLast = str; in done()
259 ctx->strDone = ctx->strLast = str; in done()
261 evDeselectFD(opaqueCtx, str->file); in done()
262 str->file.opaque = NULL; in done()
269 evStream *str = uap; in writable() local
274 bytes = writev(fd, str->iovCur, str->iovCurCount); in writable()
276 if ((str->flags & EV_STR_TIMEROK) != 0) in writable()
277 evTouchIdleTimer(opaqueCtx, str->timer); in writable()
278 consume(str, bytes); in writable()
281 str->ioDone = -1; in writable()
282 str->ioErrno = errno; in writable()
285 if (str->ioDone == -1 || str->ioDone == str->ioTotal) in writable()
286 done(opaqueCtx, str); in writable()
292 evStream *str = uap; in readable() local
297 bytes = readv(fd, str->iovCur, str->iovCurCount); in readable()
299 if ((str->flags & EV_STR_TIMEROK) != 0) in readable()
300 evTouchIdleTimer(opaqueCtx, str->timer); in readable()
301 consume(str, bytes); in readable()
304 str->ioDone = 0; in readable()
307 str->ioDone = -1; in readable()
308 str->ioErrno = errno; in readable()
312 if (str->ioDone <= 0 || str->ioDone == str->ioTotal) in readable()
313 done(opaqueCtx, str); in readable()