summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/qemu
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/qemu')
-rw-r--r--meta/recipes-devtools/qemu/qemu/chardev-connect-socket-to-a-spawned-command.patch46
1 files changed, 31 insertions, 15 deletions
diff --git a/meta/recipes-devtools/qemu/qemu/chardev-connect-socket-to-a-spawned-command.patch b/meta/recipes-devtools/qemu/qemu/chardev-connect-socket-to-a-spawned-command.patch
index 32809d3085..6e6bf95c18 100644
--- a/meta/recipes-devtools/qemu/qemu/chardev-connect-socket-to-a-spawned-command.patch
+++ b/meta/recipes-devtools/qemu/qemu/chardev-connect-socket-to-a-spawned-command.patch
@@ -54,10 +54,11 @@ diff --git a/chardev/char-socket.c b/chardev/char-socket.c
54index 53eda8ef00..f566107c35 100644 54index 53eda8ef00..f566107c35 100644
55--- a/chardev/char-socket.c 55--- a/chardev/char-socket.c
56+++ b/chardev/char-socket.c 56+++ b/chardev/char-socket.c
57@@ -852,6 +852,66 @@ static gboolean socket_reconnect_timeout(gpointer opaque) 57@@ -852,6 +852,68 @@ static gboolean socket_reconnect_timeout(gpointer opaque)
58 return false; 58 return false;
59 } 59 }
60 60
61+#ifndef _WIN32
61+static void chardev_open_socket_cmd(Chardev *chr, 62+static void chardev_open_socket_cmd(Chardev *chr,
62+ const char *cmd, 63+ const char *cmd,
63+ Error **errp) 64+ Error **errp)
@@ -117,42 +118,49 @@ index 53eda8ef00..f566107c35 100644
117+ object_unref(OBJECT(sioc)); 118+ object_unref(OBJECT(sioc));
118+ } 119+ }
119+} 120+}
121+#endif
120+ 122+
121 static void qmp_chardev_open_socket(Chardev *chr, 123 static void qmp_chardev_open_socket(Chardev *chr,
122 ChardevBackend *backend, 124 ChardevBackend *backend,
123 bool *be_opened, 125 bool *be_opened,
124@@ -859,6 +919,7 @@ static void qmp_chardev_open_socket(Chardev *chr, 126@@ -859,6 +921,9 @@
125 { 127 {
126 SocketChardev *s = SOCKET_CHARDEV(chr); 128 SocketChardev *s = SOCKET_CHARDEV(chr);
127 ChardevSocket *sock = backend->u.socket.data; 129 ChardevSocket *sock = backend->u.socket.data;
130+#ifndef _WIN32
128+ const char *cmd = sock->cmd; 131+ const char *cmd = sock->cmd;
132+#endif
129 bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; 133 bool do_nodelay = sock->has_nodelay ? sock->nodelay : false;
130 bool is_listen = sock->has_server ? sock->server : true; 134 bool is_listen = sock->has_server ? sock->server : true;
131 bool is_telnet = sock->has_telnet ? sock->telnet : false; 135 bool is_telnet = sock->has_telnet ? sock->telnet : false;
132@@ -926,7 +987,12 @@ static void qmp_chardev_open_socket(Chardev *chr, 136@@ -925,7 +990,14 @@
137 } else if (reconnect > 0) {
133 s->reconnect_time = reconnect; 138 s->reconnect_time = reconnect;
134 } 139 }
135 140-
136- if (s->reconnect_time) { 141+#ifndef _WIN32
137+ if (cmd) { 142+ if (cmd) {
138+ chardev_open_socket_cmd(chr, cmd, errp); 143+ chardev_open_socket_cmd(chr, cmd, errp);
139+ 144+
140+ /* everything ready (or failed permanently) before we return */ 145+ /* everything ready (or failed permanently) before we return */
141+ *be_opened = true; 146+ *be_opened = true;
142+ } else if (s->reconnect_time) { 147+ } else
148+#endif
149 if (s->reconnect_time) {
143 sioc = qio_channel_socket_new(); 150 sioc = qio_channel_socket_new();
144 tcp_chr_set_client_ioc_name(chr, sioc); 151 tcp_chr_set_client_ioc_name(chr, sioc);
145 qio_channel_socket_connect_async(sioc, s->addr, 152@@ -985,10 +1057,26 @@
146@@ -985,11 +1051,22 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend,
147 const char *host = qemu_opt_get(opts, "host"); 153 const char *host = qemu_opt_get(opts, "host");
148 const char *port = qemu_opt_get(opts, "port"); 154 const char *port = qemu_opt_get(opts, "port");
149 const char *tls_creds = qemu_opt_get(opts, "tls-creds"); 155 const char *tls_creds = qemu_opt_get(opts, "tls-creds");
156+#ifndef _WIN32
150+ const char *cmd = qemu_opt_get(opts, "cmd"); 157+ const char *cmd = qemu_opt_get(opts, "cmd");
158+#endif
151 SocketAddressLegacy *addr; 159 SocketAddressLegacy *addr;
152 ChardevSocket *sock; 160 ChardevSocket *sock;
153 161
154 backend->type = CHARDEV_BACKEND_KIND_SOCKET; 162 backend->type = CHARDEV_BACKEND_KIND_SOCKET;
155- if (!path) { 163+#ifndef _WIN32
156+ if (cmd) { 164+ if (cmd) {
157+ /* 165+ /*
158+ * Here we have to ensure that no options are set which are incompatible with 166+ * Here we have to ensure that no options are set which are incompatible with
@@ -163,24 +171,33 @@ index 53eda8ef00..f566107c35 100644
163+ error_setg(errp, "chardev: socket: cmd does not support any additional options"); 171+ error_setg(errp, "chardev: socket: cmd does not support any additional options");
164+ return; 172+ return;
165+ } 173+ }
166+ } else if (!path) { 174+ } else
175+#endif
176 if (!path) {
167 if (!host) { 177 if (!host) {
168 error_setg(errp, "chardev: socket: no host given"); 178 error_setg(errp, "chardev: socket: no host given");
169 return; 179@@ -1021,13 +1109,24 @@
170@@ -1021,13 +1098,14 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend,
171 sock->has_reconnect = true; 180 sock->has_reconnect = true;
172 sock->reconnect = reconnect; 181 sock->reconnect = reconnect;
173 sock->tls_creds = g_strdup(tls_creds); 182 sock->tls_creds = g_strdup(tls_creds);
183+#ifndef _WIN32
174+ sock->cmd = g_strdup(cmd); 184+ sock->cmd = g_strdup(cmd);
185+#endif
175 186
176 addr = g_new0(SocketAddressLegacy, 1); 187 addr = g_new0(SocketAddressLegacy, 1);
177- if (path) { 188+#ifndef _WIN32
178+ if (path || cmd) { 189+ if (path || cmd) {
190+#else
191 if (path) {
192+#endif
179 UnixSocketAddress *q_unix; 193 UnixSocketAddress *q_unix;
180 addr->type = SOCKET_ADDRESS_LEGACY_KIND_UNIX; 194 addr->type = SOCKET_ADDRESS_LEGACY_KIND_UNIX;
181 q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); 195 q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1);
182- q_unix->path = g_strdup(path); 196+#ifndef _WIN32
183+ q_unix->path = cmd ? g_strdup_printf("cmd:%s", cmd) : g_strdup(path); 197+ q_unix->path = cmd ? g_strdup_printf("cmd:%s", cmd) : g_strdup(path);
198+#else
199 q_unix->path = g_strdup(path);
200+#endif
184 } else { 201 } else {
185 addr->type = SOCKET_ADDRESS_LEGACY_KIND_INET; 202 addr->type = SOCKET_ADDRESS_LEGACY_KIND_INET;
186 addr->u.inet.data = g_new(InetSocketAddress, 1); 203 addr->u.inet.data = g_new(InetSocketAddress, 1);
@@ -223,4 +240,3 @@ index ae19dcd1ed..6de0f29bcd 100644
223 '*wait' : 'bool', 240 '*wait' : 'bool',
224-- 241--
2252.14.1 2422.14.1
226