search for: rbuflen

Displaying 7 results from an estimated 7 matches for "rbuflen".

Did you mean: buflen
2018 Sep 10
1
question on nbdkit sh plugin
...calls the script. It can + * optionally write to the script'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 si...
2019 Jul 31
0
[nbdkit PATCH 9/8] sh: Document CLOEXEC considerations
...ins/sh/call.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...
2019 Aug 02
0
[nbdkit PATCH v2 14/17] sh: Use pipe2 with CLOEXEC when possible
...that the following 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; +...
2019 Jan 02
0
[PATCH nbdkit v2 1/2] Annotate internal function parameters with attribute((nonnull)).
...dex 204a404..b5916b0 100644 --- a/plugins/sh/call.h +++ b/plugins/sh/call.h @@ -42,9 +42,13 @@ typedef enum exit_code { RET_FALSE = 3 /* script exited with code 3 meaning false */ } exit_code; -extern exit_code call (const char **argv); -extern exit_code call_read (char **rbuf, size_t *rbuflen, const char **argv); -extern exit_code call_write (const char *wbuf, size_t wbuflen, const char **argv); +extern exit_code call (const char **argv) + __attribute__((__nonnull__ (1))); +extern exit_code call_read (char **rbuf, size_t *rbuflen, const char **argv) + __attribute__((__nonnull__ (1, 2,...
2019 Jan 02
4
[PATCH nbdkit v2 0/2] Use of attribute(()).
v1 was here: https://www.redhat.com/archives/libguestfs/2019-January/msg00008.html In v2 I have provided two patches: The first patch extends attribute((nonnull)) to most internal functions, but not to the external API. The second patch uses a macro so that attribute((format)) is only used in the public API on GCC or Clang. At least in theory these headers could be used by a C compiler which
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):