search for: threadlocal_buff

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

Did you mean: threadlocal_buffer
2019 Apr 23
1
Re: [PATCH nbdkit v2 2/2] server: Use a thread-local pread/pwrite buffer to avoid leaking heap data.
...1 + > server/protocol.c | 16 +++++++++------- > server/threadlocal.c | 37 +++++++++++++++++++++++++++++++++++++ > 3 files changed, 47 insertions(+), 7 deletions(-) > > if (cmd == NBD_CMD_READ || cmd == NBD_CMD_WRITE) { > - buf = malloc (count); > + buf = threadlocal_buffer ((size_t) count); > if (buf == NULL) { > - out_of_memory: > - perror ("malloc"); > error = ENOMEM; Old code called perror() when nbdkit_extents_new() failed... > if (cmd == NBD_CMD_WRITE && > skip_over_write_b...
2019 Apr 23
0
[PATCH nbdkit v2 2/2] server: Use a thread-local pread/pwrite buffer to avoid leaking heap data.
.....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_request_send_reply (struct connection...
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
2020 Feb 11
1
Re: [PATCH nbdkit 1/3] server: Add GET_CONN macro, alias for threadlocal_get_conn ().
...> 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? For example, patch 3 has: -typedef void (*...
2020 Aug 06
2
[PATCH nbdkit] Experiment with parallel python plugin
...ount -= limit; } + free(zero_buffer); + done: if (r != -1 && need_flush) r = plugin_flush (b, handle, 0, err); diff --git a/server/threadlocal.c b/server/threadlocal.c index 90230028..04c82842 100644 --- a/server/threadlocal.c +++ b/server/threadlocal.c @@ -195,13 +195,16 @@ threadlocal_buffer (size_t size) if (threadlocal->buffer_size < size) { void *ptr; + int err; - ptr = realloc (threadlocal->buffer, size); - if (ptr == NULL) { + err = posix_memalign (&ptr, 4096, size); + if (err != 0) { nbdkit_error ("threadlocal_buffer: realloc:...
2020 Aug 06
0
[PATCH nbdkit] Experiment with parallel python plugin
...ount -= limit; } + free(zero_buffer); + done: if (r != -1 && need_flush) r = plugin_flush (b, handle, 0, err); diff --git a/server/threadlocal.c b/server/threadlocal.c index 90230028..04c82842 100644 --- a/server/threadlocal.c +++ b/server/threadlocal.c @@ -195,13 +195,16 @@ threadlocal_buffer (size_t size) if (threadlocal->buffer_size < size) { void *ptr; + int err; - ptr = realloc (threadlocal->buffer, size); - if (ptr == NULL) { + err = posix_memalign (&ptr, 4096, size); + if (err != 0) { nbdkit_error ("threadlocal_buffer: realloc:...
2020 Aug 06
0
Re: [PATCH nbdkit] Experiment with parallel python plugin
...gt; + > done: > if (r != -1 && need_flush) > r = plugin_flush (b, handle, 0, err); > diff --git a/server/threadlocal.c b/server/threadlocal.c > index 90230028..04c82842 100644 > --- a/server/threadlocal.c > +++ b/server/threadlocal.c > @@ -195,13 +195,16 @@ threadlocal_buffer (size_t size) > > if (threadlocal->buffer_size < size) { > void *ptr; > + int err; > > - ptr = realloc (threadlocal->buffer, size); > - if (ptr == NULL) { > + err = posix_memalign (&ptr, 4096, size); > + if (err != 0) { >...
2020 Feb 11
0
[PATCH nbdkit 1/3] server: Add GET_CONN macro, alias for threadlocal_get_conn ().
...rnal.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 diff --git a/server/public.c b/server/pu...
2019 Sep 18
1
[PATCH nbdkit] server: Remove useless thread local sockaddr.
...d 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 instance_num; - struct sockaddr addr;...
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 Mar 26
0
[PATCH nbdkit 5/9 patch split 5/5] server: Indirect slow path, non-self-contained functions through the server.
...void *dl, struct nbdkit_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 (s...
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
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 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.
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