1 /* ISC license. */
2 
3 #include <skalibs/sysdeps.h>
4 
5 #ifdef SKALIBS_HASSPLICE
6 
7 #include <skalibs/nonposix.h>
8 #include <errno.h>
9 #include <fcntl.h>
10 #include <skalibs/iobuffer.h>
11 
iobufferk_isworking(iobufferk * k)12 int iobufferk_isworking (iobufferk *k)
13 {
14  /* for now splice() with a length of 0 returns 0 no matter what, so this */
15  /* test is useless. splice() should test the underlying filesystems even */
16  /* if the length is 0. */
17 
18 # if 0
19 
20   int e = errno ;
21   if (splice(k->fd[0], 0, k->p[1], 0, 0, 0) < 0) goto no ;
22   if (splice(k->p[0], 0, k->fd[1], 0, 0, 0) < 0) goto no ;
23   errno = e ;
24   return 1 ;
25  no:
26   errno = e ;
27   return 0 ;
28 
29 # else
30 
31   (void)k ;
32   return 1 ;
33 
34 # endif
35 }
36 
37 #else
38 
39 #include <skalibs/iobuffer.h>
40 
iobufferk_isworking(iobufferk * k)41 int iobufferk_isworking (iobufferk *k)
42 {
43   (void)k ;
44   return 0 ;
45 }
46 
47 #endif
48