summaryrefslogtreecommitdiff
path: root/src/libstddjb/iobufferk_flush.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-09-25 19:48:26 +0000
committerLaurent Bercot <ska@appnovation.com>2021-09-25 19:48:26 +0000
commitf268a8871a061395633d943e6f177fa8f8008963 (patch)
treec01e2ddf63e4934ced4eb34764b520bd47070e08 /src/libstddjb/iobufferk_flush.c
parent754da814c32de5fbbd8b065e9f106cbb7bfc8ae6 (diff)
downloadskalibs-f268a8871a061395633d943e6f177fa8f8008963.tar.xz
Axe iobuffer
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libstddjb/iobufferk_flush.c')
-rw-r--r--src/libstddjb/iobufferk_flush.c67
1 files changed, 0 insertions, 67 deletions
diff --git a/src/libstddjb/iobufferk_flush.c b/src/libstddjb/iobufferk_flush.c
deleted file mode 100644
index 3f8d657..0000000
--- a/src/libstddjb/iobufferk_flush.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* ISC license. */
-
-#include <skalibs/sysdeps.h>
-
-#ifdef SKALIBS_HASSPLICE
-
-#include <skalibs/nonposix.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <skalibs/iobuffer.h>
-
-static int iobufferk_flush_0 (iobufferk *k)
-{
- while (k->n)
- {
- ssize_t r = splice(k->fd[0], 0, k->p[1], 0, k->n, 0) ;
- if (r < 0) return 0 ;
- else if (!r) break ;
- k->n -= r ;
- }
- return 1 ;
-}
-
-static int fakeflush (iobufferk *k)
-{
- k->n = 0 ;
- return 1 ;
-}
-
-static int iobufferk_flush_3 (iobufferk *k)
-{
- while (k->n)
- {
- ssize_t r = splice(k->p[0], 0, k->fd[1], 0, k->n, SPLICE_F_MORE | (k->nb & 2 ? SPLICE_F_NONBLOCK : 0)) ;
- if (r < 0)
- {
- if (errno == EINVAL) errno = ENOSYS ;
- return 0 ;
- }
- else if (!r) return (errno = EPIPE, 0) ;
- k->n -= r ;
- }
- return 1 ;
-}
-
-iobufferk_output_func_ref const iobufferk_flush_f[4] =
-{
- &iobufferk_flush_0, &fakeflush, &fakeflush, &iobufferk_flush_3
-} ;
-
-#else
-
-#include <errno.h>
-#include <skalibs/iobuffer.h>
-
-static int iobufferk_onosys (iobufferk *k)
-{
- (void)k ;
- return (errno = ENOSYS, -1) ;
-}
-
-iobufferk_output_func_ref const iobufferk_flush_f[4] =
-{
- &iobufferk_onosys, &iobufferk_onosys, &iobufferk_onosys, &iobufferk_onosys
-} ;
-
-#endif