blob: b3a1bf22c512abdffc48a6652917dd6e9b50c4c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
/* ISC license. */
#include <sys/types.h>
#include <sys/uio.h>
#include <errno.h>
#include <skalibs/buffer.h>
ssize_t buffer_fill (buffer *b)
{
struct iovec v[2] ;
ssize_t r ;
if (buffer_isfull(b)) return (errno = ENOBUFS, -1) ;
buffer_wpeek(b, v) ;
r = (*b->op)(b->fd, v, 2) ;
if (r <= 0) return r ;
buffer_wseek(b, r) ;
return r ;
}
|