[Libguestfs] [libnbd PATCH v3 19/19] socket activation: set LISTEN_FDNAMES

Laszlo Ersek lersek at redhat.com
Thu Mar 23 12:10:16 UTC 2023


When the user calls nbd_set_socket_activation_name before calling
nbd_connect_system_socket_activation, pass the name down to the server
through LISTEN_FDNAMES.  This has no effect unless the new API has
been called to set the socket name to a non-empty string.

https://lists.nongnu.org/archive/html/qemu-devel/2023-01/msg06114.html

[Original commit message and upstream discussion reference by Rich Jones;
at
<https://listman.redhat.com/archives/libguestfs/2023-January/030558.html>
/ msgid <20230130225521.1771496-5-rjones at redhat.com>.]

Signed-off-by: Laszlo Ersek <lersek at redhat.com>
Reviewed-by: Richard W.M. Jones <rjones at redhat.com>
---

Notes:
    v4:
    
    - pick up Rich's R-b
    
    - resolve rebase conflict near the
      prepare_socket_activation_environment() call site, due to keeping
      set_error() internal to that callee, in patch "socket activation:
      clean up responsibilities of prep.sock.act.env.()"

 generator/states-connect-socket-activation.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/generator/states-connect-socket-activation.c b/generator/states-connect-socket-activation.c
index 10ccc3119299..f9dbd433ce00 100644
--- a/generator/states-connect-socket-activation.c
+++ b/generator/states-connect-socket-activation.c
@@ -185,7 +185,7 @@  CONNECT_SA.START:
   struct sockaddr_un addr;
   struct execvpe execvpe_ctx;
   size_t num_vars;
-  struct sact_var sact_var[2];
+  struct sact_var sact_var[3];
   size_t pid_ofs;
   string_vector env;
   pid_t pid;
@@ -245,6 +245,9 @@  CONNECT_SA.START:
                  "LISTEN_PID=", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", &pid_ofs);
   SACT_VAR_PUSH (sact_var, &num_vars,
                  "LISTEN_FDS=", "1", NULL);
+  if (h->sact_name != NULL)
+    SACT_VAR_PUSH (sact_var, &num_vars,
+                   "LISTEN_FDNAMES=", h->sact_name, NULL);
   if (prepare_socket_activation_environment (&env, sact_var, num_vars) == -1)
     /* prepare_socket_activation_environment() calls set_error() internally */
     goto uninit_execvpe;


More information about the Libguestfs mailing list