Lines Matching refs:str

36 static int	copyvec(evStream *str, const struct iovec *iov, int iocnt);
37 static void consume(evStream *str, size_t bytes);
38 static void done(evContext opaqueCtx, evStream *str);
122 evStream *str = id.opaque; in evTimeRW() local
126 str->timer = timer; in evTimeRW()
127 str->flags |= EV_STR_TIMEROK; in evTimeRW()
133 evStream *str = id.opaque; in evUntimeRW() local
137 str->flags &= ~EV_STR_TIMEROK; in evUntimeRW()
197 copyvec(evStream *str, const struct iovec *iov, int iocnt) { in copyvec() argument
200 str->iovOrig = (struct iovec *)memget(sizeof(struct iovec) * iocnt); in copyvec()
201 if (str->iovOrig == NULL) { in copyvec()
205 str->ioTotal = 0; in copyvec()
207 str->iovOrig[i] = iov[i]; in copyvec()
208 str->ioTotal += iov[i].iov_len; in copyvec()
210 str->iovOrigCount = iocnt; in copyvec()
211 str->iovCur = str->iovOrig; in copyvec()
212 str->iovCurCount = str->iovOrigCount; in copyvec()
213 str->ioDone = 0; in copyvec()
219 consume(evStream *str, size_t bytes) { in consume() argument
221 if (bytes < (size_t)str->iovCur->iov_len) { in consume()
222 str->iovCur->iov_len -= bytes; in consume()
223 str->iovCur->iov_base = (void *) in consume()
224 ((u_char *)str->iovCur->iov_base + bytes); in consume()
225 str->ioDone += bytes; in consume()
228 bytes -= str->iovCur->iov_len; in consume()
229 str->ioDone += str->iovCur->iov_len; in consume()
230 str->iovCur++; in consume()
231 str->iovCurCount--; in consume()
238 done(evContext opaqueCtx, evStream *str) { in done() argument
242 str->prevDone = ctx->strLast; in done()
243 ctx->strLast->nextDone = str; in done()
244 ctx->strLast = str; in done()
247 ctx->strDone = ctx->strLast = str; in done()
249 evDeselectFD(opaqueCtx, str->file); in done()
250 str->file.opaque = NULL; in done()
257 evStream *str = uap; in writable() local
262 bytes = writev(fd, str->iovCur, str->iovCurCount); in writable()
264 if ((str->flags & EV_STR_TIMEROK) != 0) in writable()
265 evTouchIdleTimer(opaqueCtx, str->timer); in writable()
266 consume(str, bytes); in writable()
269 str->ioDone = -1; in writable()
270 str->ioErrno = errno; in writable()
273 if (str->ioDone == -1 || str->ioDone == str->ioTotal) in writable()
274 done(opaqueCtx, str); in writable()
280 evStream *str = uap; in readable() local
285 bytes = readv(fd, str->iovCur, str->iovCurCount); in readable()
287 if ((str->flags & EV_STR_TIMEROK) != 0) in readable()
288 evTouchIdleTimer(opaqueCtx, str->timer); in readable()
289 consume(str, bytes); in readable()
292 str->ioDone = 0; in readable()
295 str->ioDone = -1; in readable()
296 str->ioErrno = errno; in readable()
300 if (str->ioDone <= 0 || str->ioDone == str->ioTotal) in readable()
301 done(opaqueCtx, str); in readable()