blob: c158abe384a4d54593b90c420e7ad7019d94bb1e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
/* ISC license. */
#include <errno.h>
#include <skalibs/buffer.h>
#include <skalibs/cbuffer.h>
int buffer_fill (buffer *b)
{
siovec_t v[2] ;
register int r ;
if (buffer_isfull(b)) return (errno = ENOBUFS, -1) ;
buffer_wpeek(b, v) ;
r = (*b->op)(b->fd, v, 2, b->aux) ;
if (r <= 0) return r ;
cbuffer_WSEEK(&b->c, r) ;
return r ;
}
|