blob: 940818d9b80af3bdd570cefabd5a91160cb0992a (
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
39
40
|
/* ISC license. */
#include <skalibs/sysdeps.h>
#ifdef SKALIBS_HASSPLICE
#include <sys/types.h>
#include <skalibs/iobuffer.h>
int iobuffer_ufromk (iobufferu *u, iobufferk *k)
{
int in = u->b[0].fd ;
u->b[0].fd = k->p[0] ;
while (k->n)
{
ssize_t r = iobufferu_fill(u) ;
if (r <= 0) goto err ;
k->n -= r ;
}
u->b[0].fd = in ;
return 1 ;
err:
u->b[0].fd = in ;
return 0 ;
}
#else
#include <errno.h>
#include <skalibs/iobuffer.h>
int iobuffer_ufromk (iobufferu *u, iobufferk *k)
{
(void)u ;
(void)k ;
return (errno = ENOSYS, 0) ;
}
#endif
|