summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/skalibs/djbunix.h4
-rw-r--r--src/include/skalibs/iobuffer.h120
-rw-r--r--src/include/skalibs/stddjb.h1
-rw-r--r--src/libstddjb/fd_cat.c26
-rw-r--r--src/libstddjb/fd_catn.c39
-rw-r--r--src/libstddjb/iobuffer_fill.c14
-rw-r--r--src/libstddjb/iobuffer_flush.c14
-rw-r--r--src/libstddjb/iobuffer_init.c17
-rw-r--r--src/libstddjb/iobuffer_kfromu.c38
-rw-r--r--src/libstddjb/iobuffer_salvage.c19
-rw-r--r--src/libstddjb/iobuffer_ufromk.c40
-rw-r--r--src/libstddjb/iobufferk_fill.c56
-rw-r--r--src/libstddjb/iobufferk_finish.c45
-rw-r--r--src/libstddjb/iobufferk_flush.c67
-rw-r--r--src/libstddjb/iobufferk_init.c74
-rw-r--r--src/libstddjb/iobufferk_isworking.c47
-rw-r--r--src/libstddjb/iobufferu_fill.c11
-rw-r--r--src/libstddjb/iobufferu_finish.c9
-rw-r--r--src/libstddjb/iobufferu_flush.c11
-rw-r--r--src/libstddjb/iobufferu_init.c16
20 files changed, 27 insertions, 641 deletions
diff --git a/src/include/skalibs/djbunix.h b/src/include/skalibs/djbunix.h
index 45c5eb0..2d98074 100644
--- a/src/include/skalibs/djbunix.h
+++ b/src/include/skalibs/djbunix.h
@@ -27,8 +27,8 @@ extern void fd_close (int) ;
 extern int fd_chmod (int, unsigned int) ;
 extern int fd_chown (int, uid_t, gid_t) ;
 extern int fd_sync (int) ;
-extern int fd_cat (int, int) ;
-extern size_t fd_catn (int, int, size_t) ;
+extern off_t fd_cat (int, int) ;
+extern off_t fd_catn (int, int, off_t) ;
 extern int fd_ensure_open (int, int) ;
 #define fd_sanitize() (fd_ensure_open(0, 0) && fd_ensure_open(1, 1) && fd_ensure_open(2, 1))
 extern void fd_shutdown (int, int) ;
diff --git a/src/include/skalibs/iobuffer.h b/src/include/skalibs/iobuffer.h
deleted file mode 100644
index 3259c03..0000000
--- a/src/include/skalibs/iobuffer.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* ISC license. */
-
-#ifndef SKALIBS_IOBUFFER_H
-#define SKALIBS_IOBUFFER_H
-
-#define IOBUFFER_SIZE 65536U
-
- /* iobufferu */
-
-#include <sys/types.h>
-
-#include <skalibs/buffer.h>
-#include <skalibs/djbunix.h>
-
-#define IOBUFFERU_SIZE (IOBUFFER_SIZE+1)
-
-typedef struct iobufferu_s iobufferu, *iobufferu_ref ;
-struct iobufferu_s
-{
-  buffer b[2] ;
-  char *buf ;
-} ;
-
-extern int iobufferu_init (iobufferu *, int, int) ;
-extern ssize_t iobufferu_fill (iobufferu *) ;
-extern int iobufferu_flush (iobufferu *) ;
-extern void iobufferu_finish (iobufferu *) ;
-
-#define iobufferu_len(u) buffer_len(&(u)->b[0])
-#define iobufferu_available(u) buffer_available(&(u)->b[1])
-#define iobufferu_isempty(u) buffer_isempty(&(u)->b[0])
-#define iobufferu_isfull(u) buffer_isfull(&(u)->b[1])
-#define iobufferu_fd(u, h) buffer_fd((u)->b[h])
-#define iobufferu_isreadable(u) iobufferu_available(u)
-#define iobufferu_iswritable(u) iobufferu_len(u)
-#define iobufferu_nonblock(u, h) ndelay_on(iobufferu_fd(u, h))
-#define iobufferu_block(u, h) ndelay_off(iobufferu_fd(u, h))
-#define iobufferu_nbstate(u, h, j) (j ? iobufferu_nonblock(u, h) : iobufferu_block(u, h))
-
-
- /* iobufferk */
-
-#define IOBUFFERK_SIZE IOBUFFER_SIZE
-
-typedef struct iobufferk_s iobufferk, *iobufferk_ref ;
-struct iobufferk_s
-{
-  int fd[2] ;
-  int p[2] ;
-  unsigned int n ;
-  unsigned int type : 2 ;
-  unsigned int nb : 2 ;
-} ;
-
-typedef int iobufferk_output_func (iobufferk *) ;
-typedef iobufferk_output_func *iobufferk_output_func_ref ;
-typedef ssize_t iobufferk_input_func (iobufferk *) ;
-typedef iobufferk_input_func *iobufferk_input_func_ref ;
-typedef void iobufferk_finish_func (iobufferk *) ;
-typedef iobufferk_finish_func *iobufferk_finish_func_ref ;
-
-extern iobufferk_output_func iobufferk_isworking ;
-
-extern int iobufferk_init (iobufferk *, int, int) ;
-extern iobufferk_input_func_ref const iobufferk_fill_f[4] ;
-extern iobufferk_output_func_ref const iobufferk_flush_f[4] ;
-extern iobufferk_finish_func_ref const iobufferk_finish_f[4] ;
-
-#define iobufferk_fill(k) (*iobufferk_fill_f[(k)->type])(k)
-#define iobufferk_flush(k) (*iobufferk_flush_f[(k)->type])(k)
-#define iobufferk_finish(k) (*iobufferk_finish_f[(k)->type])(k)
-#define iobufferk_len(k) ((k)->n)
-#define iobufferk_available(k) (IOBUFFERK_SIZE - (k)->n)
-#define iobufferk_isempty(k) (!iobufferk_len(k))
-#define iobufferk_isfull(k) (!iobufferk_available(k))
-#define iobufferk_fd(k, h) ((k)->fd[h])
-#define iobufferk_isreadable(k) iobufferk_available(k)
-#define iobufferk_iswritable(k) iobufferk_len(k)
-#define iobufferk_nonblock(k, h) ((k)->nb |= (1 << (h)), 0)
-#define iobufferk_block(k, h) ((k)->nb &= (3 - (1 << (h))), 0)
-#define iobufferk_nbstate(k, h, j) (j ? iobufferk_nonblock(k, h) : iobufferk_block(k, h))
-
-
- /* iobuffer */
-
-typedef union iobufferku_u iobufferku, *iobufferku_ref ;
-union iobufferku_u
-{
-  iobufferk k ;
-  iobufferu u ;
-} ;
-
-typedef struct iobuffer_s iobuffer, *iobuffer_ref ;
-struct iobuffer_s
-{
-  iobufferku x ;
-  unsigned int isk : 1 ;
-} ;
-
-extern int iobuffer_ufromk (iobufferu *, iobufferk *) ;
-extern int iobuffer_kfromu (iobufferk *, iobufferu *) ;
-extern int iobuffer_salvage (iobuffer *) ;
-
-extern int iobuffer_init (iobuffer *, int, int) ;
-extern ssize_t iobuffer_fill (iobuffer *) ;
-extern int iobuffer_flush (iobuffer *) ;
-
-#define iobuffer_finish(b) ((b)->isk ? iobufferk_finish(&(b)->x.k) : iobufferu_finish(&(b)->x.u))
-#define iobuffer_len(b) ((b)->isk ? iobufferk_len(&(b)->x.k) : iobufferu_len(&(b)->x.u))
-#define iobuffer_available(b) ((b)->isk ? iobufferk_available(&(b)->x.k) : iobufferu_available(&(b)->x.u))
-#define iobuffer_isempty(b) ((b)->isk ? iobufferk_isempty(&(b)->x.k) : iobufferu_isempty(&(b)->x.u))
-#define iobuffer_isfull(b) ((b)->isk ? iobufferk_isfull(&(b)->x.k) : iobufferu_isfull(&(b)->x.u))
-#define iobuffer_fd(b, h) ((b)->isk ? iobufferk_fd(&(b)->x.k, h) : iobufferu_fd(&(b)->x.u, h))
-#define iobuffer_isreadable(b) ((b)->isk ? iobufferk_isreadable(&(b)->x.k) : iobufferu_isreadable(&(b)->x.u))
-#define iobuffer_iswritable(b) ((b)->isk ? iobufferk_iswritable(&(b)->x.k) : iobufferu_iswritable(&(b)->x.u))
-#define iobuffer_nonblock(b, h) ((b)->isk ? iobufferk_nonblock(&(b)->x.k, h) : iobufferu_nonblock(&(b)->x.u, h))
-#define iobuffer_block(b, h) ((b)->isk ? iobufferk_block(&(b)->x.k, h) : iobufferu_block(&(b)->x.u, h))
-#define iobuffer_nbstate(b, h, j) ((b)->isk ? iobufferk_nbstate(&(b)->x.k, h, j) : iobufferu_nbstate(&(b)->x.u, h, j))
-
-#endif
diff --git a/src/include/skalibs/stddjb.h b/src/include/skalibs/stddjb.h
index ad80a66..4f0d739 100644
--- a/src/include/skalibs/stddjb.h
+++ b/src/include/skalibs/stddjb.h
@@ -34,7 +34,6 @@
 #include <skalibs/gccattributes.h>
 #include <skalibs/genalloc.h>
 #include <skalibs/genwrite.h>
-#include <skalibs/iobuffer.h>
 #include <skalibs/iopause.h>
 #include <skalibs/lolstdio.h>
 #include <skalibs/netstring.h>
diff --git a/src/libstddjb/fd_cat.c b/src/libstddjb/fd_cat.c
index 4acc08a..d9d5c99 100644
--- a/src/libstddjb/fd_cat.c
+++ b/src/libstddjb/fd_cat.c
@@ -1,27 +1,23 @@
 /* ISC license. */
 
-#include <sys/types.h>
+#include <unistd.h>
 
-#include <skalibs/iobuffer.h>
+#include <skalibs/allreadwrite.h>
 #include <skalibs/djbunix.h>
 
-int fd_cat (int from, int to)
+#define BSIZE 65536
+
+off_t fd_cat (int from, int to)
 {
-  iobuffer b ;
-  size_t n = 0 ;
-  if (!iobuffer_init(&b, from, to)) return -1 ;
+  off_t n = 0 ;
+  char buf[BSIZE] ;
   for (;;)
   {
-    ssize_t r = iobuffer_fill(&b) ;
-    if (r < 0) goto err ;
-    else if (!r) break ;
-    if (!iobuffer_flush(&b)) goto err ;
+    ssize_t r = fd_read(from, buf, BSIZE) ;
+    if (r == -1) return -1 ;
+    if (!r) break ;
+    if (allwrite(to, buf, r) < r) return -1 ;
     n += r ;
   }
-  iobuffer_finish(&b) ;
   return n ;
-
- err:
-  iobuffer_finish(&b) ;
-  return -1 ;
 }
diff --git a/src/libstddjb/fd_catn.c b/src/libstddjb/fd_catn.c
index c2ddd7a..182a054 100644
--- a/src/libstddjb/fd_catn.c
+++ b/src/libstddjb/fd_catn.c
@@ -1,39 +1,28 @@
 /* ISC license. */
 
-#include <sys/types.h>
+#include <unistd.h>
 #include <errno.h>
+
 #include <skalibs/allreadwrite.h>
-#include <skalibs/iobuffer.h>
 #include <skalibs/djbunix.h>
 
-size_t fd_catn (int from, int to, size_t n)
+#define BSIZE 65536
+
+off_t fd_catn (int from, int to, off_t n)
 {
-  size_t w = 0 ;
-  if (n >= IOBUFFER_SIZE)
+  off_t w = 0 ;
+  char buf[BSIZE] ;
+  while (n >= BSIZE)
   {
-    iobuffer b ;
-    if (!iobuffer_init(&b, from, to)) return 0 ;
-    while (n >= IOBUFFER_SIZE)
-    {
-      ssize_t r = iobuffer_fill(&b) ;
-      if (r <= 0)
-      {
-        iobuffer_finish(&b) ;
-        if (!r) errno = EPIPE ;
-        return w ;
-      }
-      if (!iobuffer_flush(&b))
-      {
-        iobuffer_finish(&b) ;
-        return w ;
-      }
-      n -= r ; w += r ;
-    }
-    iobuffer_finish(&b) ;
+    ssize_t r = fd_read(from, buf, BSIZE) ;
+    if (r == -1) return w ;
+    if (!r) return (errno = EPIPE, w) ;
+    if (allwrite(to, buf, r) < r) return w ;
+    n -= r ; w += r ;
   }
 
+  if (n)
   {
-    char buf[n] ;
     size_t r = allread(from, buf, n) ;
     size_t v = 0 ;
     if (r) v = allwrite(to, buf, r) ;
diff --git a/src/libstddjb/iobuffer_fill.c b/src/libstddjb/iobuffer_fill.c
deleted file mode 100644
index b99e22d..0000000
--- a/src/libstddjb/iobuffer_fill.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* ISC license. */
-
-#include <errno.h>
-#include <skalibs/iobuffer.h>
-
-ssize_t iobuffer_fill (iobuffer_ref b)
-{
-  if (b->isk)
-  {
-    ssize_t r = iobufferk_fill(&b->x.k) ;
-    if (r >= 0 || errno != ENOSYS || !iobuffer_salvage(b)) return r ;
-  }
-  return iobufferu_fill(&b->x.u) ;
-}
diff --git a/src/libstddjb/iobuffer_flush.c b/src/libstddjb/iobuffer_flush.c
deleted file mode 100644
index 93efc9d..0000000
--- a/src/libstddjb/iobuffer_flush.c
+++ /dev/null
@@ -1,14 +0,0 @@
-/* ISC license. */
-
-#include <errno.h>
-#include <skalibs/iobuffer.h>
-
-int iobuffer_flush (iobuffer *b)
-{
-  if (b->isk)
-  {
-    if (iobufferk_flush(&b->x.k)) return 1 ;
-    if (errno != ENOSYS || !iobuffer_salvage(b)) return 0 ;
-  }
-  return iobufferu_flush(&b->x.u) ;
-}
diff --git a/src/libstddjb/iobuffer_init.c b/src/libstddjb/iobuffer_init.c
deleted file mode 100644
index fc699a0..0000000
--- a/src/libstddjb/iobuffer_init.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/* ISC license. */
-
-#include <skalibs/iobuffer.h>
-
-int iobuffer_init (iobuffer *b, int fdin, int fdout)
-{
-  if (!iobufferk_init(&b->x.k, fdin, fdout)) goto user ;
-  if (!iobufferk_isworking(&b->x.k)) goto fk ;
-  b->isk = 1 ;
-  return 1 ;
- fk:
-  iobufferk_finish(&b->x.k) ;
- user:
-  if (!iobufferu_init(&b->x.u, fdin, fdout)) return 0 ;
-  b->isk = 0 ;
-  return 1 ;
-}
diff --git a/src/libstddjb/iobuffer_kfromu.c b/src/libstddjb/iobuffer_kfromu.c
deleted file mode 100644
index 91525a5..0000000
--- a/src/libstddjb/iobuffer_kfromu.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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
diff --git a/src/libstddjb/iobuffer_salvage.c b/src/libstddjb/iobuffer_salvage.c
deleted file mode 100644
index 6f2c5d8..0000000
--- a/src/libstddjb/iobuffer_salvage.c
+++ /dev/null
@@ -1,19 +0,0 @@
-/* ISC license. */
-
-#include <skalibs/iobuffer.h>
-
-int iobuffer_salvage (iobuffer *b)
-{
-  iobufferu u ;
-  if (!b->isk) return 1 ;
-  if (!iobufferu_init(&u, b->x.k.fd[0], b->x.k.fd[1])) return 0 ;
-  if (!iobuffer_ufromk(&u, &b->x.k)) goto err ;
-  iobufferk_finish(&b->x.k) ;
-  b->x.u = u ;
-  b->isk = 0 ;
-  return 1 ;
-
-err:
-  iobufferu_finish(&u) ;
-  return 0 ;
-}
diff --git a/src/libstddjb/iobuffer_ufromk.c b/src/libstddjb/iobuffer_ufromk.c
deleted file mode 100644
index 940818d..0000000
--- a/src/libstddjb/iobuffer_ufromk.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* 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
diff --git a/src/libstddjb/iobufferk_fill.c b/src/libstddjb/iobufferk_fill.c
deleted file mode 100644
index c24ceba..0000000
--- a/src/libstddjb/iobufferk_fill.c
+++ /dev/null
@@ -1,56 +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 ssize_t iobufferk_tee (iobufferk *k)
-{
-  ssize_t r = tee(k->fd[0], k->fd[1], IOBUFFERK_SIZE - k->n, k->nb & 1 ? SPLICE_F_NONBLOCK : 0) ;
-  if (r > 0) k->n += r ;
-  return r ;
-}
-
-static ssize_t iobufferk_splice (iobufferk *k)
-{
-  ssize_t r = splice(k->fd[0], 0, k->fd[1], 0, IOBUFFERK_SIZE, k->nb ? SPLICE_F_NONBLOCK : 0) ;
-  if (r > 0) k->n += r ;
-  if ((r < 0) && (errno == EINVAL)) errno = ENOSYS ;
-  return r ;
-}
-
-static ssize_t iobufferk_fill_3 (iobufferk *k)
-{
-  ssize_t r = splice(k->fd[0], 0, k->p[1], 0, IOBUFFERK_SIZE - k->n, k->nb & 1 ? SPLICE_F_NONBLOCK : 0) ;
-  if (r > 0) k->n += r ;
-  if ((r < 0) && (errno == EINVAL)) errno = ENOSYS ;
-  return r ;
-}
-
-iobufferk_input_func_ref const iobufferk_fill_f[4] =
-{
-  &iobufferk_tee, &iobufferk_splice, &iobufferk_splice, &iobufferk_fill_3
-} ;
-
-#else
-
-#include <errno.h>
-#include <skalibs/iobuffer.h>
-
-static ssize_t iobufferk_inosys (iobufferk *k)
-{
-  (void)k ;
-  return (errno = ENOSYS, -1) ;
-}
-
-iobufferk_input_func_ref const iobufferk_fill_f[4] =
-{
-  &iobufferk_inosys, &iobufferk_inosys, &iobufferk_inosys, &iobufferk_inosys
-} ;
-
-#endif
diff --git a/src/libstddjb/iobufferk_finish.c b/src/libstddjb/iobufferk_finish.c
deleted file mode 100644
index 1640836..0000000
--- a/src/libstddjb/iobufferk_finish.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* ISC license. */
-
-#include <skalibs/sysdeps.h>
-
-#ifdef SKALIBS_HASSPLICE
-
-#include <skalibs/djbunix.h>
-#include <skalibs/iobuffer.h>
-
-static void iobufferk_nop (iobufferk *k)
-{
-  (void)k ;
-}
-
-static void iobufferk_finish_0 (iobufferk *k)
-{
-  fd_close(k->p[1]) ;
-}
-
-static void iobufferk_finish_3 (iobufferk *k)
-{
-  fd_close(k->p[1]) ;
-  fd_close(k->p[0]) ;
-}
-
-iobufferk_finish_func_ref const iobufferk_finish_f[4] =
-{
-  &iobufferk_finish_0, &iobufferk_nop, &iobufferk_nop, &iobufferk_finish_3
-} ;
-
-#else
-
-#include <skalibs/iobuffer.h>
-
-static void iobufferk_nop (iobufferk *k)
-{
-  (void)k ;
-}
-
-iobufferk_finish_func_ref const iobufferk_finish_f[4] =
-{
-  &iobufferk_nop, &iobufferk_nop, &iobufferk_nop, &iobufferk_nop
-} ;
-
-#endif
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
diff --git a/src/libstddjb/iobufferk_init.c b/src/libstddjb/iobufferk_init.c
deleted file mode 100644
index b7a91d7..0000000
--- a/src/libstddjb/iobufferk_init.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* ISC license. */
-
-#include <skalibs/sysdeps.h>
-
-#ifdef SKALIBS_HASSPLICE
-
-#include <sys/stat.h>
-#include <fcntl.h>
-
-#include <skalibs/djbunix.h>
-#include <skalibs/iobuffer.h>
-
-static int iobufferk_init_0 (iobufferk *k)
-{
-  int fd = openc_write("/dev/null") ;
-  if (fd < 0) return 0 ;
-  k->p[0] = -1 ;
-  k->p[1] = fd ;
-  return 1 ;
-}
-
-static int iobufferk_nofd (iobufferk *k)
-{
-  k->p[0] = k->p[1] = -1 ;
-  return 1 ;
-}
-
-static int iobufferk_init_3 (iobufferk *k)
-{
-  return (pipecoe(k->p) >= 0) ;
-}
-
-static iobufferk_output_func_ref iobufferk_init_f[4] =
-{
-  &iobufferk_init_0, &iobufferk_nofd, &iobufferk_nofd, &iobufferk_init_3
-} ;
-
-int iobufferk_init (iobufferk *k, int fdin, int fdout)
-{
-  iobufferk tmp ;
-  struct stat st ;
-  int r ;
-  if (fstat(fdin, &st) < 0) return 0 ;
-  r = fcntl(fdin, F_GETFL) ;
-  if (r < 0) return 0 ;
-  tmp.type = !S_ISFIFO(st.st_mode) ;
-  tmp.nb = !!(r & O_NONBLOCK) ;
-  if (fstat(fdout, &st) < 0) return 0 ;
-  r = fcntl(fdout, F_GETFL) ;
-  if (r < 0) return 0 ;
-  tmp.type |= (!S_ISFIFO(st.st_mode) << 1) ;
-  tmp.nb |= (r & O_NONBLOCK) ? 2 : 0 ;
-  tmp.fd[0] = fdin ;
-  tmp.fd[1] = fdout ;
-  tmp.n = 0 ;
-  if (!(*iobufferk_init_f[tmp.type])(&tmp)) return 0 ;
-  *k = tmp ;
-  return 1 ;
-}
-
-#else
-
-#include <errno.h>
-#include <skalibs/iobuffer.h>
-
-int iobufferk_init (iobufferk *k, int fdin, int fdout)
-{
-  (void)k ;
-  (void)fdin ;
-  (void)fdout ;
-  return (errno = ENOSYS, 0) ;
-}
-
-#endif
diff --git a/src/libstddjb/iobufferk_isworking.c b/src/libstddjb/iobufferk_isworking.c
deleted file mode 100644
index 119d130..0000000
--- a/src/libstddjb/iobufferk_isworking.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* ISC license. */
-
-#include <skalibs/sysdeps.h>
-
-#ifdef SKALIBS_HASSPLICE
-
-#include <skalibs/nonposix.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <skalibs/iobuffer.h>
-
-int iobufferk_isworking (iobufferk *k)
-{
- /* for now splice() with a length of 0 returns 0 no matter what, so this */
- /* test is useless. splice() should test the underlying filesystems even */
- /* if the length is 0. */
-
-# if 0
-
-  int e = errno ;
-  if (splice(k->fd[0], 0, k->p[1], 0, 0, 0) < 0) goto no ;
-  if (splice(k->p[0], 0, k->fd[1], 0, 0, 0) < 0) goto no ;
-  errno = e ;
-  return 1 ;
- no:
-  errno = e ;
-  return 0 ;
-
-# else
-
-  (void)k ;
-  return 1 ;
-
-# endif
-}
-
-#else
-
-#include <skalibs/iobuffer.h>
-
-int iobufferk_isworking (iobufferk *k)
-{
-  (void)k ;
-  return 0 ;
-}
-
-#endif
diff --git a/src/libstddjb/iobufferu_fill.c b/src/libstddjb/iobufferu_fill.c
deleted file mode 100644
index 7867444..0000000
--- a/src/libstddjb/iobufferu_fill.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* ISC license. */
-
-#include <skalibs/buffer.h>
-#include <skalibs/iobuffer.h>
-
-ssize_t iobufferu_fill (iobufferu *b)
-{
-  ssize_t r = buffer_fill(&b->b[0]) ;
-  b->b[1].c.n = b->b[0].c.n ;
-  return r ;
-}
diff --git a/src/libstddjb/iobufferu_finish.c b/src/libstddjb/iobufferu_finish.c
deleted file mode 100644
index 612ec18..0000000
--- a/src/libstddjb/iobufferu_finish.c
+++ /dev/null
@@ -1,9 +0,0 @@
-/* ISC license. */
-
-#include <skalibs/alloc.h>
-#include <skalibs/iobuffer.h>
-
-void iobufferu_finish (iobufferu *b)
-{
-  alloc_free(b->buf) ;
-}
diff --git a/src/libstddjb/iobufferu_flush.c b/src/libstddjb/iobufferu_flush.c
deleted file mode 100644
index ad0fd9e..0000000
--- a/src/libstddjb/iobufferu_flush.c
+++ /dev/null
@@ -1,11 +0,0 @@
-/* ISC license. */
-
-#include <skalibs/buffer.h>
-#include <skalibs/iobuffer.h>
-
-int iobufferu_flush (iobufferu *b)
-{
-  int r = buffer_flush(&b->b[1]) ;
-  b->b[0].c.p = b->b[1].c.p ;
-  return r ;
-}
diff --git a/src/libstddjb/iobufferu_init.c b/src/libstddjb/iobufferu_init.c
deleted file mode 100644
index affd01b..0000000
--- a/src/libstddjb/iobufferu_init.c
+++ /dev/null
@@ -1,16 +0,0 @@
-/* ISC license. */
-
-#include <skalibs/alloc.h>
-#include <skalibs/allreadwrite.h>
-#include <skalibs/buffer.h>
-#include <skalibs/iobuffer.h>
-
-int iobufferu_init (iobufferu *b, int fdin, int fdout)
-{
-  char *x = alloc(IOBUFFERU_SIZE) ;
-  if (!x) return 0 ;
-  b->buf = x ;
-  buffer_init(&b->b[0], &fd_readv, fdin, x, IOBUFFERU_SIZE) ;
-  buffer_init(&b->b[1], &fd_writev, fdout, x, IOBUFFERU_SIZE) ;
-  return 1 ;
-}