search for: have_accept4

Displaying 8 results from an estimated 8 matches for "have_accept4".

2019 Aug 02
1
[nbdkit PATCH] server: Restrict thread model when no atomic CLOEXEC
...5 @@ exit_status_to_nbd_error (int status, const char *cmd) */ int set_cloexec (int fd) { -#if defined SOCK_CLOEXEC && defined HAVE_MKOSTEMP && defined HAVE_PIPE2 +#if (defined SOCK_CLOEXEC && defined HAVE_MKOSTEMP && defined HAVE_PIPE2 && \ + defined HAVE_ACCEPT4) nbdkit_error ("prefer creating fds with CLOEXEC atomically set"); close (fd); errno = EBADF; return -1; #else -# if defined SOCK_CLOEXEC || defined HAVE_MKOSTEMP || defined HAVE_PIPE2 +# if (defined SOCK_CLOEXEC || defined HAVE_MKOSTEMP || defined HAVE_PIPE2 || \ + !def...
2019 Aug 02
2
Re: [nbdkit PATCH v2 10/17] plugins: Add .fork_safe field
On Fri, Aug 02, 2019 at 02:26:11PM -0500, Eric Blake wrote: > Allow a plugin field to declare whether a parallel plugin can tolerate > windows where fds are not CLOEXEC, or must take precautions to avoid > leaking fds if the plugin may fork. For safety reasons, the flag > defaults to off, but many in-tree plugins can set it to on (most > commonly because they don't fork after
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):
2019 Sep 18
1
[PATCH nbdkit] server: Remove useless thread local sockaddr.
...ckaddr (&data->addr, data->addrlen); handle_single_connection (data->sock, data->sock); @@ -299,12 +296,9 @@ accept_connection (int listen_sock) } thread_data->instance_num = instance_num++; - thread_data->addrlen = sizeof thread_data->addr; again: #ifdef HAVE_ACCEPT4 - thread_data->sock = accept4 (listen_sock, - &thread_data->addr, &thread_data->addrlen, - SOCK_CLOEXEC); + thread_data->sock = accept4 (listen_sock, NULL, NULL, SOCK_CLOEXEC); #else /* If we were fully parallel,...
2019 Nov 02
2
[PATCH nbdkit] server: Use GCC hints to move debug and error handling code out of hot paths.
...ff --git a/server/plugins.c b/server/plugins.c index 87daaf2..65f6817 100644 --- a/server/plugins.c +++ b/server/plugins.c @@ -71,7 +71,7 @@ plugin_thread_model (struct backend *b) #if !(defined SOCK_CLOEXEC && defined HAVE_MKOSTEMP && defined HAVE_PIPE2 && \ defined HAVE_ACCEPT4) if (thread_model > NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS) { - nbdkit_debug ("system lacks atomic CLOEXEC, serializing to avoid fd leaks"); + debug ("system lacks atomic CLOEXEC, serializing to avoid fd leaks"); thread_model = NBDKIT_THREAD_MODEL_SERIALIZE_...
2019 Aug 02
0
[nbdkit PATCH v2 10/17] plugins: Add .fork_safe field
...5b0 100644 --- a/server/plugins.c +++ b/server/plugins.c @@ -90,6 +90,15 @@ plugin_thread_model (struct backend *b) int thread_model = p->plugin._thread_model; int r; + /* For now, we leak fds on all platforms; once that is fixed, this + * restriction can be limited to only occur when !HAVE_ACCEPT4. + */ + if (p->plugin._thread_model > NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS && + p->plugin.fork_safe == 0) { + nbdkit_debug (".fork_safe not set, serializing to avoid fd leaks"); + thread_model = NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS; + } + if...
2020 Mar 19
5
[nbdkit PATCH 0/2] More caching of initial setup
When I added .can_FOO caching in 1.16, I missed the case that the sh plugin itself was calling .can_flush twice in some situations (in order to default .can_fua). Then right after, I regressed it to call .can_zero twice (in order to default .can_fast_zero). I also missed that .thread_model could use better caching, because at the time, I did not add testsuite coverage. Fix that now. Eric Blake
2020 Aug 15
3
[PATCH EXPERIMENTAL nbdkit 0/2] Port to Windows using mingw.
The patches following do indeed allow you to compile nbdkit.exe, but it does not actually work yet. I'm posting this experimental series more as a work in progress and to get feedback. Note this does not require Windows itself to build or test. You can cross-compile it using mingw64-* packages on Fedora or Debian, and test it [spoiler alert: it fails] using Wine. Rich.