blob: 2b06ac7921b09f03f9e71a47da508b13b9e1aabb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/* ISC license. */
#include <sys/types.h>
#include <sys/uio.h>
#include <skalibs/functypes.h>
#include <skalibs/allreadwrite.h>
#include <skalibs/siovec.h>
size_t allreadwritev (iovfunc_t_ref op, int fd, struct iovec const *v, unsigned int vlen)
{
size_t written = 0 ;
struct iovec vv[vlen] ;
unsigned int i = 0 ;
for (; i < vlen ; i++) vv[i] = v[i] ;
while (siovec_len(vv, vlen))
{
register ssize_t w = (*op)(fd, vv, vlen) ;
if (w <= 0) break ;
w = siovec_seek(vv, vlen, w) ;
written += w ;
}
return written ;
}
|