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