search for: sa_sockpath

Displaying 10 results from an estimated 10 matches for "sa_sockpath".

2019 Sep 26
1
Re: [PATCH libnbd 2/2] api: Implement local command with systemd socket activation.
.../* Use /tmp instead of TMPDIR because we must ensure the path is > + * short enough to store in the sockaddr_un. On some platforms this > + * may cause problems so we may need to revisit it. XXX > + */ > + h->sa_tmpdir = strdup ("/tmp/libnbdXXXXXX"); > + h->sa_sockpath = strdup ("/tmp/libnbdXXXXXX/sock"); > + if (h->sa_tmpdir == NULL || h->sa_sockpath == NULL) { > + SET_NEXT_STATE (%.DEAD); > + set_error (errno, "strdup"); > + return 0; > + } > + > + if (mkdtemp (h->sa_tmpdir) == NULL) { > + SET_...
2019 Sep 26
5
[PATCH libnbd 1/2] lib: Avoid killing subprocess twice.
If the user calls nbd_kill_subprocess, we shouldn't kill the process again when we close the handle (since the process has likely gone and we might be killing a different process). --- lib/handle.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/handle.c b/lib/handle.c index 2af25fe..5ad818e 100644 --- a/lib/handle.c +++ b/lib/handle.c @@ -315,6 +315,8 @@
2019 Oct 01
2
Re: [PATCH libnbd v2 2/2] api: Implement local command with systemd socket activation.
...} > + if (mkdtemp (h->sa_tmpdir) == NULL) { > + SET_NEXT_STATE (%.DEAD); > + set_error (errno, "mkdtemp"); > + /* Avoid cleanup in nbd_close. */ > + free (h->sa_tmpdir); > + h->sa_tmpdir = NULL; > + return 0; > + } > + > + h->sa_sockpath = strdup ("/tmp/libnbdXXXXXX/sock"); > + if (h->sa_sockpath == NULL) { > + SET_NEXT_STATE (%.DEAD); > + set_error (errno, "strdup"); > + return 0; > + } > + > + len = strlen (h->sa_tmpdir); > + memcpy (h->sa_sockpath, h->sa_tmpdir...
2019 Sep 30
4
[PATCH libnbd v2 0/2] Implement systemd socket activation.
v1 was posted here: https://www.redhat.com/archives/libguestfs/2019-September/thread.html#00337 v2: - Drop the first patch. - Hopefully fix the multiple issues with fork-safety and general behaviour on error paths. Note this requires execvpe for which there seems to be no equivalent on FreeBSD, except some kind of tedious path parsing (but can we assign to environ?) Rich.
2019 Sep 26
2
Re: [PATCH libnbd 2/2] api: Implement local command with systemd socket activation.
...* short enough to store in the sockaddr_un. On some platforms this > + * may cause problems so we may need to revisit it. XXX > + */ Is the use of socketpair() any better than creating a socket under /tmp? > + h->sa_tmpdir = strdup ("/tmp/libnbdXXXXXX"); > + h->sa_sockpath = strdup ("/tmp/libnbdXXXXXX/sock"); > + if (h->sa_tmpdir == NULL || h->sa_sockpath == NULL) { > + SET_NEXT_STATE (%.DEAD); > + set_error (errno, "strdup"); > + return 0; > + } > + > + if (mkdtemp (h->sa_tmpdir) == NULL) { > + SET_...
2019 Sep 26
0
[PATCH libnbd 2/2] api: Implement local command with systemd socket activation.
...ert (h->argv[0]); + + /* Use /tmp instead of TMPDIR because we must ensure the path is + * short enough to store in the sockaddr_un. On some platforms this + * may cause problems so we may need to revisit it. XXX + */ + h->sa_tmpdir = strdup ("/tmp/libnbdXXXXXX"); + h->sa_sockpath = strdup ("/tmp/libnbdXXXXXX/sock"); + if (h->sa_tmpdir == NULL || h->sa_sockpath == NULL) { + SET_NEXT_STATE (%.DEAD); + set_error (errno, "strdup"); + return 0; + } + + if (mkdtemp (h->sa_tmpdir) == NULL) { + SET_NEXT_STATE (%.DEAD); + set_error (err...
2019 Sep 30
0
[PATCH libnbd v2 2/2] api: Implement local command with systemd socket activation.
...ror (errno, "strdup"); + return 0; + } + if (mkdtemp (h->sa_tmpdir) == NULL) { + SET_NEXT_STATE (%.DEAD); + set_error (errno, "mkdtemp"); + /* Avoid cleanup in nbd_close. */ + free (h->sa_tmpdir); + h->sa_tmpdir = NULL; + return 0; + } + + h->sa_sockpath = strdup ("/tmp/libnbdXXXXXX/sock"); + if (h->sa_sockpath == NULL) { + SET_NEXT_STATE (%.DEAD); + set_error (errno, "strdup"); + return 0; + } + + len = strlen (h->sa_tmpdir); + memcpy (h->sa_sockpath, h->sa_tmpdir, len); + + s = socket (AF_UNIX, SOCK_S...
2019 Oct 01
0
Re: [PATCH libnbd v2 2/2] api: Implement local command with systemd socket activation.
...es. > >--- a/lib/handle.c > >+++ b/lib/handle.c > >@@ -129,6 +129,16 @@ nbd_close (struct nbd_handle *h) > > free_cmd_list (h->cmds_in_flight); > > free_cmd_list (h->cmds_done); > > nbd_internal_free_string_list (h->argv); > >+ if (h->sa_sockpath) { > >+ if (h->pid > 0) > >+ kill (h->pid, SIGTERM); > >+ unlink (h->sa_sockpath); > >+ free (h->sa_sockpath); > >+ } > >+ if (h->sa_tmpdir) { > >+ rmdir (h->sa_tmpdir); > >+ free (h->sa_tmpdir); > >...
2019 Sep 27
0
Re: [PATCH libnbd 2/2] api: Implement local command with systemd socket activation.
...s until it is killed. In nbdkit and qemu-nbd we are using the latter one. ... > If we fail here or later, do/should we try to clean up the > /tmp/libnbdXXX directory created earlier? > > /me reads ahead - nbd_close tries to address it > > Still, if we fail at this point, h->sa_sockpath is set but not yet > created [1] I modified the code so that it doesn't try to delete literal /tmp/libnbdXXXXXX on some error paths and should be more robust. > >+ close (s); > >+ } > >+ else { > >+ /* We must unset CLOEXEC on the fd. (dup2 above do...
2020 Oct 27
6
[PATCH libnbd 0/5] info: --map: Coalesce adjacent extents of the same type.
This adds coalescing of adjacent extents of the same type, as mentioned by Eric Blake in the commit message here: https://github.com/libguestfs/libnbd/commit/46072f6611f80245846a445766da071e457b00cd The patch series is rather long because it detours through adding the <vector.h> library from nbdkit into libnbd and replacing ad hoc uses of realloc, char ** etc in various places. Rich.