search for: threadlocal_get_error

Displaying 20 results from an estimated 25 matches for "threadlocal_get_error".

2020 Feb 11
1
Re: [PATCH nbdkit 1/3] server: Add GET_CONN macro, alias for threadlocal_get_conn ().
...ternal.h | 1 + > server/public.c | 6 +++--- > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/server/internal.h b/server/internal.h > index a1fa7309..1e7b4cf0 100644 > --- a/server/internal.h > +++ b/server/internal.h > @@ -493,6 +493,7 @@ extern int threadlocal_get_error (void); > extern void *threadlocal_buffer (size_t size); > extern void threadlocal_set_conn (struct connection *conn); > extern struct connection *threadlocal_get_conn (void); > +#define GET_CONN (threadlocal_get_conn ()) Do we want any checking, such as whether this is non-NULL?...
2019 Apr 23
0
[PATCH nbdkit v2 2/2] server: Use a thread-local pread/pwrite buffer to avoid leaking heap data.
...internal.h b/server/internal.h index 837cd4a..817f022 100644 --- a/server/internal.h +++ b/server/internal.h @@ -350,6 +350,7 @@ extern void threadlocal_set_sockaddr (const struct sockaddr *addr, /*extern void threadlocal_get_sockaddr ();*/ extern void threadlocal_set_error (int err); extern int threadlocal_get_error (void); +extern void *threadlocal_buffer (size_t size); /* Declare program_name. */ #if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME == 1 diff --git a/server/protocol.c b/server/protocol.c index 3f89f6d..9e8eea5 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -611,7 +611,7 @@ protocol_recv...
2019 Aug 02
0
[nbdkit PATCH 3/3] plugins: Match docs for .errno_is_preserved
...t;. + +=back + =head1 THREADS Each nbdkit plugin must declare its maximum thread safety model by diff --git a/server/plugins.c b/server/plugins.c index 8eed2dd8..7da2329e 100644 --- a/server/plugins.c +++ b/server/plugins.c @@ -492,7 +492,7 @@ get_error (struct backend_plugin *p) { int ret = threadlocal_get_error (); - if (!ret && p->plugin.errno_is_preserved) + if (!ret && p->plugin.errno_is_preserved == 1) ret = errno; return ret ? ret : EIO; } -- 2.20.1
2020 Feb 11
0
[PATCH nbdkit 1/3] server: Add GET_CONN macro, alias for threadlocal_get_conn ().
..., add a short alias for it. --- server/internal.h | 1 + server/public.c | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/server/internal.h b/server/internal.h index a1fa7309..1e7b4cf0 100644 --- a/server/internal.h +++ b/server/internal.h @@ -493,6 +493,7 @@ extern int threadlocal_get_error (void); extern void *threadlocal_buffer (size_t size); extern void threadlocal_set_conn (struct connection *conn); extern struct connection *threadlocal_get_conn (void); +#define GET_CONN (threadlocal_get_conn ()) /* Declare program_name. */ #if HAVE_DECL_PROGRAM_INVOCATION_SHORT_NAME == 1 d...
2017 Nov 14
7
[PATCH 0/3] Alternate way to avoid race conditions when nbdkit exits.
This fixes the race conditions for me, using the test described here: https://www.redhat.com/archives/libguestfs/2017-September/msg00226.html Rich.
2019 Apr 23
4
[PATCH nbdkit v2 0/2] Be careful not to leak server heap memory to the client.
Version 1 was here: https://www.redhat.com/archives/libguestfs/2019-April/msg00144.html Version 2 makes a couple of much larger changes: The OCaml patch changes the API of the pread method so it matches what other language bindings are already doing, ie. get the language plugin to return a newly allocated buffer, check it is long enough, copy out the data. The server patch implements a
2018 Feb 01
0
[nbdkit PATCH v2 1/3] backend: Rework internal/filter error return semantics
...h> +#include <assert.h> #include <pthread.h> @@ -912,18 +913,6 @@ validate_request (struct connection *conn, return true; /* Command validates. */ } -/* Grab the appropriate error value. - */ -static int -get_error (struct connection *conn) -{ - int ret = threadlocal_get_error (); - - if (!ret && backend->errno_is_preserved (backend)) - ret = errno; - return ret ? ret : EIO; -} - /* This is called with the request lock held to actually execute the * request (by calling the plugin). Note that the request fields have * been validated already in 'v...
2019 Sep 18
1
[PATCH nbdkit] server: Remove useless thread local sockaddr.
...adlocal_get_instance_num (void); -extern void threadlocal_set_sockaddr (const struct sockaddr *addr, - socklen_t addrlen) - __attribute__((__nonnull__ (1))); -/*extern void threadlocal_get_sockaddr ();*/ extern void threadlocal_set_error (int err); extern int threadlocal_get_error (void); extern void *threadlocal_buffer (size_t size); diff --git a/server/sockets.c b/server/sockets.c index dfaa3ea..3514c69 100644 --- a/server/sockets.c +++ b/server/sockets.c @@ -260,8 +260,6 @@ free_listening_sockets (int *socks, size_t nr_socks) struct thread_data { int sock; size_t...
2018 Jan 17
0
[PATCH 5/9] connections: Allow multiple handles to be stored in the connection object.
...connection *conn, return 0; if (p->plugin.zero) { errno = 0; - result = p->plugin.zero (connection_get_handle (conn), + result = p->plugin.zero (connection_get_handle (conn, 0), count, offset, may_trim); if (result == -1) { err = threadlocal_get_error (); @@ -446,7 +447,7 @@ plugin_zero (struct backend *b, struct connection *conn, } while (count) { - result = p->plugin.pwrite (connection_get_handle (conn), + result = p->plugin.pwrite (connection_get_handle (conn, 0), buf, limit, offset); i...
2018 Mar 22
1
[nbdkit PATCH] plugins: Add .can_zero callback
...100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -355,25 +355,24 @@ plugin_can_trim (struct backend *b, struct connection *conn) return p->plugin.trim || p->plugin._trim_old; } -/* Grab the appropriate error value. - */ -static int -get_error (struct backend_plugin *p) -{ - int ret = threadlocal_get_error (); - - if (!ret && p->plugin.errno_is_preserved) - ret = errno; - return ret ? ret : EIO; -} - static int plugin_can_zero (struct backend *b, struct connection *conn) { + struct backend_plugin *p = container_of (b, struct backend_plugin, backend); + + assert (connection_get_ha...
2019 Aug 02
5
[nbdkit PATCH 0/3] sh plugin fixes
I'm pushing the first one as blatantly obvious. The second one is also simple enough, but not enough of a bug for me to push tonight. The third is something I noticed while working on sh, but is really more about docs vs. plugins in general. There, we could either change the code to match the docs (breaking backwards behavior for a plugin that set .errno_is_preserved=2) [what my patch did],
2018 Jan 19
0
[nbdkit PATCH v2 08/13] connections: Allow multiple handles to be stored in the connection object.
...connection *conn, return 0; if (p->plugin.zero) { errno = 0; - result = p->plugin.zero (connection_get_handle (conn), + result = p->plugin.zero (connection_get_handle (conn, 0), count, offset, may_trim); if (result == -1) { err = threadlocal_get_error (); @@ -469,7 +470,7 @@ plugin_zero (struct backend *b, struct connection *conn, } while (count) { - result = p->plugin.pwrite (connection_get_handle (conn), + result = p->plugin.pwrite (connection_get_handle (conn, 0), buf, limit, offset); if...
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
...ndshake_newstyle (struct connection *conn) return -1; /* Finish the newstyle handshake. */ - r = plugin_get_size (conn); + r = backend->get_size (backend, conn); if (r == -1) return -1; if (r < 0) { @@ -848,7 +850,7 @@ get_error (struct connection *conn) { int ret = threadlocal_get_error (); - if (!ret && plugin_errno_is_preserved ()) + if (!ret && backend->errno_is_preserved (backend)) ret = errno; return ret ? ret : EIO; } @@ -881,28 +883,28 @@ handle_request (struct connection *conn, switch (cmd) { case NBD_CMD_READ: - if (plugin_pread...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
...ndshake_newstyle (struct connection *conn) return -1; /* Finish the newstyle handshake. */ - r = plugin_get_size (conn); + r = backend->get_size (backend, conn); if (r == -1) return -1; if (r < 0) { @@ -848,7 +850,7 @@ get_error (struct connection *conn) { int ret = threadlocal_get_error (); - if (!ret && plugin_errno_is_preserved ()) + if (!ret && backend->errno_is_preserved (backend)) ret = errno; return ret ? ret : EIO; } @@ -881,28 +883,28 @@ handle_request (struct connection *conn, switch (cmd) { case NBD_CMD_READ: - if (plugin_pread...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
...ndshake_newstyle (struct connection *conn) return -1; /* Finish the newstyle handshake. */ - r = plugin_get_size (conn); + r = backend->get_size (backend, conn); if (r == -1) return -1; if (r < 0) { @@ -848,7 +850,7 @@ get_error (struct connection *conn) { int ret = threadlocal_get_error (); - if (!ret && plugin_errno_is_preserved ()) + if (!ret && backend->errno_is_preserved (backend)) ret = errno; return ret ? ret : EIO; } @@ -881,28 +883,28 @@ handle_request (struct connection *conn, switch (cmd) { case NBD_CMD_READ: - if (plugin_pread...
2018 Jan 28
3
[nbdkit PATCH 0/2] RFC: tweak error handling, add log filter
Here's what I'm currently playing with; I'm not ready to commit anything until I rebase my FUA work on top of this, as I only want to break filter ABI once between releases. Eric Blake (2): backend: Rework internal/filter error return semantics filters: Add log filter TODO | 2 - docs/nbdkit-filter.pod | 84 +++++++-- docs/nbdkit.pod
2018 Jan 16
4
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend
v1 -> v2: - Fixed everything mentioned in the review. Rich.
2018 Jan 16
6
[PATCH nbdkit 0/3] Refactor plugin_* functions into a backend struct.
Somewhat invasive but mostly mechanical change to how plugins are called. This patch is in preparation for adding a second backend subtype for filters. Rich.
2019 Aug 03
5
[nbdkit PATCH 0/3] More responsive shutdown
We noticed while writing various libnbd tests that when the delay filter is in use, there are scenarios where we had to resort to SIGKILL to get rid of nbdkit, because it was non-responsive to SIGINT. I'm still trying to figure out the best way to add testsuite coverage of this, but already proved to myself that it works from the command line, under two scenarios that both used to cause long
2018 Feb 01
6
[nbdkit PATCH v2 0/3] add log, blocksize filters
Since v1: add the blocksize filter, add testsuite coverage of the log filter, several fixes to the log filter based on what adding tests revealed I'm still working on FUA flag support patches on top of this; the patches should all be committed in the same release, as we want to minimize the number of releases that cause a filter ABI/API bump Eric Blake (3): backend: Rework internal/filter