WYRDTEK Home Features Reference Downloads About


Reference/es_rb

struct es_rb is an opaque data structure representing a read-buffer. A read-buffer is used for buffered reading from a file descriptor. It is meant to be used as a wrapper over the read() system call:

It is inefficient to make repeated calls to read() to retrieve many small items of data. It is more efficient to read a large amount of data into a buffer and then partition and process that buffer piece by piece.

The read-buffer facilitates this by presenting a read()-like interface that can be called repeatedly for small items of data but which, under the covers, is only making a handful of read() system calls and buffering the results.
es_rb_new Construct a new read-buffer with respect to a file-descriptor.
es_rb_delete Destroy a read-buffer.
es_rb_read Read data from read-buffer into user-supplied buffer.
es_rb_reset Reset and switch read-buffer to read from a new file-descriptor.

[Back To Reference]