Displaying 16 results from an estimated 16 matches for "instance_num".
Did you mean:
instance_name
2019 Sep 18
1
[PATCH nbdkit] server: Remove useless thread local sockaddr.
...), 33 deletions(-)
diff --git a/server/internal.h b/server/internal.h
index 1f72b01..c31bb34 100644
--- a/server/internal.h
+++ b/server/internal.h
@@ -431,10 +431,6 @@ extern void threadlocal_set_name (const char *name)
extern const char *threadlocal_get_name (void);
extern void threadlocal_set_instance_num (size_t instance_num);
extern size_t threadlocal_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 th...
2017 Nov 17
0
[nbdkit PATCH 4/4] sockets: Fix lifetime of thread_data
...handle_single_connection (data->sock, data->sock);
+ free (data);
return NULL;
}
@@ -270,18 +271,25 @@ accept_connection (int listen_sock)
int err;
pthread_attr_t attrs;
pthread_t thread;
- struct thread_data thread_data;
+ struct thread_data *thread_data;
static size_t instance_num = 1;
- thread_data.instance_num = instance_num++;
- thread_data.addrlen = sizeof thread_data.addr;
+ thread_data = malloc (sizeof *thread_data);
+ if (!thread_data) {
+ perror ("malloc");
+ return;
+ }
+
+ thread_data->instance_num = instance_num++;
+ thread_data->addr...
2017 Nov 17
7
[nbdkit PATCH 0/4] thread-safety issues prior to parallel handling
These patches should be ready to go in now; I will also post my
work-in-progress for enabling full parallel handling that depends
on these, but with that series, I was still getting crashes or
hangs with test-socket-activation (I think I've nailed all the
crashes I've seen, but the hang is rather insidious; see my other
email
2017 Jan 26
0
[nbdkit PATCH v2 4/6] plugins: Add new nbdkit_set_error() utility function
...c
@@ -131,3 +131,9 @@ nbdkit_error (const char *fs, ...)
errno = err;
}
+
+void
+nbdkit_set_error (int err)
+{
+ tls_set_error (err);
+}
diff --git a/src/internal.h b/src/internal.h
index cb15bab..f0c7768 100644
--- a/src/internal.h
+++ b/src/internal.h
@@ -123,6 +123,8 @@ extern void tls_set_instance_num (size_t instance_num);
extern void tls_set_sockaddr (struct sockaddr *addr, socklen_t addrlen);
extern const char *tls_get_name (void);
extern size_t tls_get_instance_num (void);
+extern void tls_set_error (int err);
+extern int tls_get_error (void);
/*extern void tls_get_sockaddr ();*/
/* ut...
2019 Nov 04
3
[PATCH nbdkit 0/3] server: Fix crash on close.
This fixes the long-standing crash on close when nbdkit exits.
I did try first to fix threads so we're using a proper thread pool,
but that's difficult to implement. So this does the minimal change
needed to fix the crash instead.
There are still two segfaults that happen during running the test
suite. One is deliberately caused (tests/test-captive.sh). The other
appears to be an
2017 Nov 17
0
[nbdkit PATCH 2/4] threadlocal: Copy thread name
...* Copyright (C) 2013-2017 Red Hat Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -55,7 +55,7 @@
*/
struct threadlocal {
- const char *name; /* Can be NULL. */
+ char *name; /* Can be NULL. */
size_t instance_num; /* Can be 0. */
struct sockaddr *addr;
socklen_t addrlen;
@@ -69,6 +69,7 @@ free_threadlocal (void *threadlocalv)
{
struct threadlocal *threadlocal = threadlocalv;
+ free (threadlocal->name);
free (threadlocal->addr);
free (threadlocal);
}
@@ -104,8 +105,16 @@ thr...
2019 May 30
0
[PATCH nbdkit 2/2] server: Disable Nagle's algorithm.
...gt;
#include <netdb.h>
-#include <poll.h>
-#include <errno.h>
-#include <assert.h>
#ifdef HAVE_LIBSELINUX
#include <selinux/selinux.h>
@@ -273,6 +275,7 @@ accept_connection (int listen_sock)
pthread_t thread;
struct thread_data *thread_data;
static size_t instance_num = 1;
+ const int flag = 1;
thread_data = malloc (sizeof *thread_data);
if (!thread_data) {
@@ -293,6 +296,11 @@ accept_connection (int listen_sock)
return;
}
+ /* Disable Nagle's algorithm on this socket. However we don't want
+ * to fail if this doesn't work.
+...
2019 May 30
2
[PATCH nbdkit 1/2] nbd: Fix -Werror=maybe-uninitialized warning.
GCC is concerned that if we never go round the loop then fd will be
uninitialized. By asserting that getaddrinfo set result != NULL we
can avoid this.
nbd.c: In function ‘nbd_open_handle’:
nbd.c:974:5: error: ‘fd’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
974 | close (fd);
| ^~~~~~~~~~
nbd.c:954:7: note: ‘fd’ was declared here
954 | int fd;
2018 Nov 29
6
[nbdkit PATCH 0/3] Fix %m usage on BSD
Our use of "%m" in various error messages is testament to the
project's initial life on Linux - but other than Cygwin, I know
of no other platforms supporting that glibc extension.
We COULD audit the code and manually turn "%m" into
"%s"/strerror(errno), but that's a lot of churn. Instead, let's
fix the few outliers that can't be easily wrapped, then
2017 Jan 26
10
[nbdkit PATCH v2 0/6] bind .zero to Python
Fix some things I noticed while reviewing v1, and follow Rich's
idea to add a new nbdkit_set_error() utility function with a
binding for Python users to request a particular error (rather
than being forced to live with whatever stale value is in errno
after all the intermediate binding glue code).
I could not easily find out how to register a C function callable
from perl bindings, and have
2017 Jan 27
6
[nbdkit PATCH v3 0/4] bind .zero to Python
This cleans up the existing code base with regards to implicit
use of errno from language bindings, then rebases the previous
work in python on top of that.
I'm still playing with the perl bindings, but got further after
reading 'perldoc perlembed'.
Eric Blake (4):
plugins: Don't use bogus errno from non-C plugins
plugins: Add new nbdkit_set_error() utility function
python:
2019 Jan 02
0
[PATCH nbdkit v2 1/2] Annotate internal function parameters with attribute((nonnull)).
...nnull__ (1)));
/* threadlocal.c */
extern void threadlocal_init (void);
extern void threadlocal_new_server_thread (void);
-extern void threadlocal_set_name (const char *name);
+extern void threadlocal_set_name (const char *name)
+ __attribute__((__nonnull__ (1)));
extern void threadlocal_set_instance_num (size_t instance_num);
-extern void threadlocal_set_sockaddr (const struct sockaddr *addr, socklen_t addrlen);
+extern void threadlocal_set_sockaddr (const struct sockaddr *addr,
+ socklen_t addrlen)
+ __attribute__((__nonnull__ (1)));
extern const char *threa...
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
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.
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):