search for: ebuflen

Displaying 5 results from an estimated 5 matches for "ebuflen".

Did you mean: buflen
2018 Sep 10
1
question on nbdkit sh plugin
...s stdin and read from the script's + * stdout and stderr. It returns the raw error code and does no error + * processing. + */ +static int +call3 (const char *wbuf, size_t wbuflen, /* sent to stdin */ + char **rbuf, size_t *rbuflen, /* read from stdout */ + char **ebuf, size_t *ebuflen, /* read from stderr */ + const char **argv) /* script + parameters */ +{ ... + + execvp (argv[0], (char **) argv); + perror (argv[0]); + _exit (EXIT_FAILURE); + } perror() is not async-safe, but since nbdkit may be multithreaded, calling a non-async-safe functi...
2019 Jul 31
0
[nbdkit PATCH 9/8] sh: Document CLOEXEC considerations
....c | 4 ++++ plugins/sh/sh.c | 3 +++ 2 files changed, 7 insertions(+) diff --git a/plugins/sh/call.c b/plugins/sh/call.c index 871de5c6..da2651d4 100644 --- a/plugins/sh/call.c +++ b/plugins/sh/call.c @@ -94,6 +94,10 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin */ *rbuflen = *ebuflen = 0; rbufalloc = ebufalloc = 0; + /* As long as we use NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS, we + * don't have to worry about CLOEXEC, because we know no other + * thread is competing to fork at the same time as this one. + */ if (pipe (in_fd) == -1) { nbdkit_error (&qu...
2019 Aug 02
0
[nbdkit PATCH v2 14/17] sh: Use pipe2 with CLOEXEC when possible
...llowing conditions are @@ -32,6 +32,8 @@ #include <config.h> +#include <assert.h> +#include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <inttypes.h> @@ -94,6 +96,27 @@ call3 (const char *wbuf, size_t wbuflen, /* sent to stdin */ *rbuflen = *ebuflen = 0; rbufalloc = ebufalloc = 0; +#ifdef HAVE_PIPE2 + if (pipe2 (in_fd, O_CLOEXEC) == -1) { + nbdkit_error ("%s: pipe2: %m", script); + goto error; + } + if (pipe2 (out_fd, O_CLOEXEC) == -1) { + nbdkit_error ("%s: pipe2: %m", script); + goto error; + } + if (...
2019 Jul 31
13
[nbdkit PATCH 0/8] fd leak safety
There's enough here to need a review; some of it probably needs backporting to stable-1.12. This probably breaks tests on Haiku or other platforms that have not been as on-the-ball about atomic CLOEXEC; feel free to report issues that arise, and I'll help come up with workarounds (even if we end up leaving a rare fd leak on less-capable systems). Meanwhile, I'm still working on my
2019 Aug 02
23
[nbdkit PATCH v2 00/17] fd leak safety
This is a major rewrite compared to my v1 series, where I've tried a lot harder to ensure that we still accommodate building on Haiku (although I have not actually yet fired up a Haiku VM to try it for myself). I also managed to make the sh plugin fully parallel, on capable platforms. See also my question on patch 10 on whether I've picked the best naming convention. Eric Blake (17):