blob: 91525a5da0befd6f8dd9ae62e23d51e1c72bba46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
/* ISC license. */
#include <skalibs/sysdeps.h>
#ifdef SKALIBS_HASSPLICE
#include <skalibs/nonposix.h>
#include <fcntl.h>
#include <sys/uio.h>
#include <skalibs/buffer.h>
#include <skalibs/iobuffer.h>
int iobuffer_kfromu (iobufferk *k, iobufferu *u)
{
struct iovec v[2] ;
ssize_t r ;
buffer_rpeek(&u->b[0], v) ;
r = vmsplice(k->p[1], v, 2, 0) ;
if (r < 0) return 0 ;
k->n += r ;
buffer_rseek(&u->b[0], r) ;
u->b[1].c.p = u->b[0].c.p ;
return iobufferu_isempty(u) ;
}
#else
#include <errno.h>
#include <skalibs/iobuffer.h>
int iobuffer_kfromu (iobufferk *k, iobufferu *u)
{
(void)k ;
(void)u ;
return (errno = ENOSYS, 0) ;
}
#endif
|