Name
tryread_until — Read data in growbuf
sized chunks
Synopsis
#include "ec_growbuf.h"
| int **tryread_until** (
| event, | |
| | needmask, | |
| | mtc, | |
| | until)
; | |
Event * <var class="pdparam">event</var>
;
int * <var class="pdparam">needmask</var>
;
minimal_tryread_construct * <var class="pdparam">mtc</var>
;
const char * <var class="pdparam">until</var>
;
Description
Read data in growbuf
sized chunks.
Note
All events are assumed to be non-blocking, so the read and write semantics are non-blocking.
The actual system call happening underneath can be either a 'read' or 'write' depending on the IO driver being used (for example, TLS).
- event
-
An event.
- needmask
-
The mask.
- mtc
-
The address of a “minimal_tryread_construct” struct.
- until
-
An integer value, often
TRYREAD_UNTIL_CRLFDOTCRLF
orTRYREAD_UNTIL_CRLF
.
This function returns the number of bytes successfully read or -1
if there is an error. If there is an error, then errno
is set appropriately (example, EAGAIN, E2BIG, ENOMEM
).
It is only legal to call this function in the Scheduler
thread.