From 1367418899513629d1994894143eb37b9048c850 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Thu, 15 Jan 2015 19:20:48 +0000 Subject: - Move seekablepipe from s6-networking to here - Version tag: 2.0.1.0, release candidate --- INSTALL | 2 +- doc/index.html | 5 +++-- doc/seekablepipe.html | 36 ++++++++++++++++++++++++++++++ doc/upgrade.html | 13 +++++++++-- package/deps.mak | 3 +++ package/info | 2 +- package/modes | 1 + package/targets.mak | 3 ++- src/skaembutils/deps-exe/seekablepipe | 1 + src/skaembutils/seekablepipe.c | 41 +++++++++++++++++++++++++++++++++++ 10 files changed, 100 insertions(+), 7 deletions(-) create mode 100644 doc/seekablepipe.html create mode 100644 src/skaembutils/deps-exe/seekablepipe create mode 100644 src/skaembutils/seekablepipe.c diff --git a/INSTALL b/INSTALL index cef1e34..00d050d 100644 --- a/INSTALL +++ b/INSTALL @@ -6,7 +6,7 @@ Build Instructions - A POSIX-compliant C development environment - GNU make version 4.0 or later - - skalibs version 2.1.0.0 or later: http://skarnet.org/software/skalibs/ + - skalibs version 2.2.0.0 or later: http://skarnet.org/software/skalibs/ This software will run on any operating system that implements POSIX.1-2008, available at: diff --git a/doc/index.html b/doc/index.html index b5ba202..5d00821 100644 --- a/doc/index.html +++ b/doc/index.html @@ -60,7 +60,7 @@ the package is now used to host specific utilities such as
  • A POSIX-compliant system with a standard C development environment
  • GNU make, version 4.0 or later
  • skalibs version -2.1.0.0 or later
  • +2.2.0.0 or later

    Licensing

    @@ -74,7 +74,7 @@ the package is now used to host specific utilities such as @@ -143,6 +143,7 @@ the previous versions of s6-portable-utils and the current one.
  • The s6-unquote-filter program
  • The s6-unquote program
  • The s6-update-symlinks program
  • +
  • The seekablepipe program
  • Related resources

    diff --git a/doc/seekablepipe.html b/doc/seekablepipe.html new file mode 100644 index 0000000..e8fe453 --- /dev/null +++ b/doc/seekablepipe.html @@ -0,0 +1,36 @@ + + + + + s6-portable-utils: the seekablepipe program + + + + + + +

    +s6-portable-utils
    +Software
    +skarnet.org +

    + +

    The seekablepipe program

    + +seekablepipe turns the reading end of a pipe into a seekable +file descriptor, using a temporary file. + +

    Interface

    + +
    +     writer | seekablepipe tmpfile reader [ args ... ]
    +
    + +

    +seekablepipe writes writer's output to tmpfile, +which is unlinked as soon as it is created. Then it execs into +reader, reading from a file descriptor on tmpfile. +

    + + + diff --git a/doc/upgrade.html b/doc/upgrade.html index 6ea3b7e..70d8b07 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -17,10 +17,19 @@

    What has changed in s6-portable-utils

    +

    in 2.0.1.0

    + + +

    in 2.0.0.1

    in 2.0.0.0

    @@ -31,7 +40,7 @@ build system. See the enclosed INSTALL file for details.
  • slashpackage is not activated by default.
  • shared libraries are not used by default.
  • -
  • skalibs dependency bumped to 2.0.0.0
  • +
  • skalibs dependency bumped to 2.0.0.0.
  • diff --git a/package/deps.mak b/package/deps.mak index 6ef1cf4..adbca33 100644 --- a/package/deps.mak +++ b/package/deps.mak @@ -41,6 +41,7 @@ src/skaembutils/s6-uniquename.o src/skaembutils/s6-uniquename.lo: src/skaembutil src/skaembutils/s6-unquote-filter.o src/skaembutils/s6-unquote-filter.lo: src/skaembutils/s6-unquote-filter.c src/skaembutils/s6-unquote.o src/skaembutils/s6-unquote.lo: src/skaembutils/s6-unquote.c src/skaembutils/s6-update-symlinks.o src/skaembutils/s6-update-symlinks.lo: src/skaembutils/s6-update-symlinks.c +src/skaembutils/seekablepipe.o src/skaembutils/seekablepipe.lo: src/skaembutils/seekablepipe.c s6-basename: private EXTRA_LIBS := s6-basename: src/skaembutils/s6-basename.o -lskarnet @@ -120,3 +121,5 @@ s6-unquote-filter: private EXTRA_LIBS := s6-unquote-filter: src/skaembutils/s6-unquote-filter.o -lskarnet s6-update-symlinks: private EXTRA_LIBS := ${SOCKET_LIB} ${TAINNOW_LIB} s6-update-symlinks: src/skaembutils/s6-update-symlinks.o -lskarnet +seekablepipe: private EXTRA_LIBS := +seekablepipe: src/skaembutils/seekablepipe.o -lskarnet diff --git a/package/info b/package/info index 327e4a7..9ea8651 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=s6-portable-utils -version=2.0.0.1 +version=2.0.1.0 category=admin package_macro_name=S6_PORTABLE_UTILS diff --git a/package/modes b/package/modes index f32d538..2e8bf85 100644 --- a/package/modes +++ b/package/modes @@ -37,3 +37,4 @@ s6-uniquename 0755 s6-unquote 0755 s6-unquote-filter 0755 s6-update-symlinks 0755 +seekablepipe 0755 diff --git a/package/targets.mak b/package/targets.mak index e811c1f..09fe7b1 100644 --- a/package/targets.mak +++ b/package/targets.mak @@ -37,7 +37,8 @@ s6-true \ s6-uniquename \ s6-unquote \ s6-unquote-filter \ -s6-update-symlinks +s6-update-symlinks \ +seekablepipe SBIN_TARGETS := LIBEXEC_TARGETS := diff --git a/src/skaembutils/deps-exe/seekablepipe b/src/skaembutils/deps-exe/seekablepipe new file mode 100644 index 0000000..e7187fe --- /dev/null +++ b/src/skaembutils/deps-exe/seekablepipe @@ -0,0 +1 @@ +-lskarnet diff --git a/src/skaembutils/seekablepipe.c b/src/skaembutils/seekablepipe.c new file mode 100644 index 0000000..611f227 --- /dev/null +++ b/src/skaembutils/seekablepipe.c @@ -0,0 +1,41 @@ +/* ISC license. */ + +#include +#include +#include +#include + +#define USAGE "seekablepipe tempfile prog..." + +#define N 8192 + +int main (int argc, char const *const *argv, char const *const *envp) +{ + iobuffer b ; + int fdr, fdw ; + int r ; + PROG = "seekablepipe" ; + if (argc < 3) strerr_dieusage(100, USAGE) ; + fdw = open_trunc(argv[1]) ; + if (fdw < 0) + strerr_diefu2sys(111, "create temporary ", argv[1]) ; + fdr = open_readb(argv[1]) ; + if (fdr < 0) + strerr_diefu3sys(111, "open ", argv[1], " for reading") ; + if (unlink(argv[1]) < 0) + strerr_diefu2sys(111, "unlink ", argv[1]) ; + if (ndelay_off(fdw) < 0) + strerr_diefu1sys(111, "set fdw blocking") ; + if (!iobuffer_init(&b, 0, fdw)) + strerr_diefu1sys(111, "iobuffer_init") ; + while ((r = iobuffer_fill(&b)) > 0) + if (!iobuffer_flush(&b)) + strerr_diefu2sys(111, "write to ", argv[1]) ; + if (r < 0) strerr_diefu1sys(111, "read from stdin") ; + iobuffer_finish(&b) ; + fd_close(fdw) ; + if (fd_move(0, fdr) < 0) + strerr_diefu1sys(111, "move fdr to stdin") ; + pathexec_run(argv[2], argv+2, envp) ; + strerr_dieexec(111, argv[2]) ; +} -- cgit v1.2.3