search for: threadlocal_set_conn

Displaying 15 results from an estimated 15 matches for "threadlocal_set_conn".

Did you mean: threadlocal_get_conn
2020 Feb 11
1
Re: [PATCH nbdkit 1/3] server: Add GET_CONN macro, alias for threadlocal_get_conn ().
...(-) > > 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? For example, patch 3 has: -typedef void (*connection_close_function) (struct connection *) __at...
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
2020 Feb 11
1
Re: [PATCH nbdkit 3/3] server: Remove explicit connection parameter, use TLS instead.
...nstead use the value stored > in thread-local storage. > > This assumes a 1-1 mapping between the connection and the current > thread which is true in *most* places. Occasionally we still have the > explicit connection pointer, especially just before we launch a thread > or call threadlocal_set_conn. > --- > server/internal.h | 191 +++++++++---------- > server/backend.c | 160 +++++++++------- > server/connections.c | 68 ++++--- > server/crypto.c | 14 +- > server/filters.c...
2020 Feb 11
0
[PATCH nbdkit 1/3] server: Add GET_CONN macro, alias for threadlocal_get_conn ().
...iles 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 diff --git a/server/public.c b/server/public.c index 418945fe..8fa7e21b 100644 --- a/server...
2019 Aug 27
0
[nbdkit PATCH] server: Enforce sane stdin/out/err
...ol listen_stdin; extern const char *selinux_label; extern int threads; extern int tls; diff --git a/server/connections.c b/server/connections.c index c173df8d..0184afea 100644 --- a/server/connections.c +++ b/server/connections.c @@ -366,6 +366,18 @@ free_connection (struct connection *conn) threadlocal_set_conn (NULL); conn->close (conn); + if (listen_stdin) { + int fd; + + /* Restore something to stdin/out so the rest of our code can + * continue to assume that all new fds will be above stderr. + * Swap directions to get EBADF on improper use of stdin/out. + */ + fd = open (&q...
2020 Feb 11
5
[PATCH nbdkit 0/3] server: Remove explicit connection parameter.
The third patch is a large but mechanical change which gets rid of passing around struct connection * entirely within the server, preferring instead to reference the connection through thread-local storage. I hope this is a gateway to simplifying other parts of the code. Rich.
2020 Mar 26
0
[PATCH nbdkit 5/9 patch split 5/5] server: Indirect slow path, non-self-contained functions through the server.
...dkit_plugin *(*plugin_init) (void)) __attribute__((__nonnull__ (2, 3, 4))); +extern void do_nbdkit_set_error (int err); /* filters.c */ extern struct backend *filter_register (struct backend *next, size_t index, @@ -515,6 +517,11 @@ extern void *threadlocal_buffer (size_t size); extern void threadlocal_set_conn (struct connection *conn); extern struct connection *threadlocal_get_conn (void); +/* public.c */ +extern int do_nbdkit_nanosleep (unsigned sec, unsigned nsec); +extern const char *do_nbdkit_export_name (void); +extern int do_nbdkit_peer_name (struct sockaddr *addr, socklen_t *addrlen); + /* Ma...
2020 Feb 11
4
[PATCH nbdkit v2 0/3] server: Remove explicit connection parameter.
v1 was here: https://www.redhat.com/archives/libguestfs/2020-February/msg00081.html v2 replaces struct connection *conn = GET_CONN; with GET_CONN; which sets conn implicitly and asserts that it is non-NULL. If we actually want to test if conn is non-NULL or behave differently, then you must use threadlocal_get_conn() instead, and some existing uses do that. Rich.
2019 Sep 12
4
[PATCH nbdkit v2 0/3] Access export name from plugins.
The previous incomplete patch was here: https://www.redhat.com/archives/libguestfs/2019-September/msg00049.html based on earlier discussion here: https://www.redhat.com/archives/libguestfs/2019-September/msg00047.html In v2: - The previous patch was incomplete. This version completes it by adding tests and extending nbdkit-sh-plugin. - nbdkit_export_name now returns NULL for error,
2020 Jul 21
4
[PATCH nbdkit] server: Pass the export name through filter .open calls.
...-356,6 +356,8 @@ free_connection (struct connection *conn) pthread_mutex_destroy (&conn->write_lock); pthread_mutex_destroy (&conn->status_lock); + free (conn->exportname_from_set_meta_context); + free (conn->exportname); free (conn->handles); free (conn); threadlocal_set_conn (NULL); diff --git a/server/filters.c b/server/filters.c index 2d705e1e..7d268096 100644 --- a/server/filters.c +++ b/server/filters.c @@ -238,7 +238,7 @@ plugin_magic_config_key (struct backend *b) } static void * -filter_open (struct backend *b, int readonly) +filter_open (struct backend *b,...
2020 Feb 11
0
[PATCH nbdkit 3/3] server: Remove explicit connection parameter, use TLS instead.
...inter around everywhere, and instead use the value stored in thread-local storage. This assumes a 1-1 mapping between the connection and the current thread which is true in *most* places. Occasionally we still have the explicit connection pointer, especially just before we launch a thread or call threadlocal_set_conn. --- server/internal.h | 191 +++++++++---------- server/backend.c | 160 +++++++++------- server/connections.c | 68 ++++--- server/crypto.c | 14 +- server/filters.c | 270 +++++++++++++-------------...
2020 Mar 26
9
[PATCH nbdkit 5/9 patch split 1/5] Create libnbdkit.so.
This is the previous 5/9 patch posted earlier today, split into reviewable chunks. This passes bisection with -x 'make && make check', but I didn't work very hard on the commit messages, so I refer you back to the original patch to explain how it works: https://www.redhat.com/archives/libguestfs/2020-March/msg00248.html Rich.
2020 Aug 18
15
[PATCH nbdkit 0/9] Port to Windows.
Also available here: https://github.com/rwmjones/nbdkit/tree/2020-windows-mingw This is the port to Windows using native Windows APIs (not MSYS or Cygwin). This patch series is at the point where it basically now works. I can run the server with the memory plugin, and access it remotely using guestfish, creating filesystems and so on without any apparent problems. Nevertheless there are many
2020 Mar 26
15
[PATCH nbdkit 0/9] Create libnbdkit.so
This creates libnbdkit.so as discussed in the following thread: https://www.redhat.com/archives/libguestfs/2020-March/thread.html#00203 test-delay-shutdown.sh fails for unclear reasons. This series starts by reverting "tests: Don't strand hung nbdkit processes" which is because several other tests fail randomly unless I revert this patch. I didn't investigate this yet so it
2020 Aug 20
15
[PATCH nbdkit 0/13] Port to Windows without using a separate library.
Also available here: https://github.com/rwmjones/nbdkit/tree/2020-windows-mingw-nolib After a lot of work I have made the port to Windows work without using a separate library. Instead, on Windows only, we build an "import library" (library of stubs) which resolves references to nbdkit_* functions in the main program and fixes up the plugin, basically the first technique outlined in