diff options
author | Juro Bystricky <juro.bystricky@intel.com> | 2018-01-11 13:16:57 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-01-13 10:15:20 +0000 |
commit | bc112b8368eb3842ccb2430fdf17e736ea39a742 (patch) | |
tree | 2a084bd43d2892988654c7deb4bcc4cf9c3508e4 /meta/recipes-devtools/qemu | |
parent | 979587c2bc0251bc5f9822184a1e75a2b19d29b9 (diff) | |
download | poky-bc112b8368eb3842ccb2430fdf17e736ea39a742.tar.gz |
qemu-2.10.1.bb: support mingw build
The patch chardev-connect-socket-to-a-spawned-command.patch calls
"socketpair". This function is missing in mingw, so the patch
needs to be modified accordingly, otherwise we end up with a broken
mingw build.
While it is possible to simply remove the patch on a recipe level for
mingw platform, it makes more sense to modify the patch itself.
(From OE-Core rev: fd978a5ddf6938404f2043c9f9ede47dcdb47180)
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/qemu')
-rw-r--r-- | meta/recipes-devtools/qemu/qemu/chardev-connect-socket-to-a-spawned-command.patch | 37 |
1 files changed, 29 insertions, 8 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 49d4af2e5e..4f8539757a 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 | |||
@@ -55,10 +55,11 @@ diff --git a/chardev/char-socket.c b/chardev/char-socket.c | |||
55 | index 1ae730a4..c366a02a 100644 | 55 | index 1ae730a4..c366a02a 100644 |
56 | --- a/chardev/char-socket.c | 56 | --- a/chardev/char-socket.c |
57 | +++ b/chardev/char-socket.c | 57 | +++ b/chardev/char-socket.c |
58 | @@ -854,6 +854,66 @@ static gboolean socket_reconnect_timeout(gpointer opaque) | 58 | @@ -854,6 +854,68 @@ static gboolean socket_reconnect_timeout(gpointer opaque) |
59 | return false; | 59 | return false; |
60 | } | 60 | } |
61 | 61 | ||
62 | +#ifndef _WIN32 | ||
62 | +static void chardev_open_socket_cmd(Chardev *chr, | 63 | +static void chardev_open_socket_cmd(Chardev *chr, |
63 | + const char *cmd, | 64 | + const char *cmd, |
64 | + Error **errp) | 65 | + Error **errp) |
@@ -118,42 +119,51 @@ index 1ae730a4..c366a02a 100644 | |||
118 | + object_unref(OBJECT(sioc)); | 119 | + object_unref(OBJECT(sioc)); |
119 | + } | 120 | + } |
120 | +} | 121 | +} |
122 | +#endif | ||
121 | + | 123 | + |
122 | static void qmp_chardev_open_socket(Chardev *chr, | 124 | static void qmp_chardev_open_socket(Chardev *chr, |
123 | ChardevBackend *backend, | 125 | ChardevBackend *backend, |
124 | bool *be_opened, | 126 | bool *be_opened, |
125 | @@ -861,6 +921,7 @@ static void qmp_chardev_open_socket(Chardev *chr, | 127 | @@ -861,6 +923,9 @@ static void qmp_chardev_open_socket(Chardev *chr, |
126 | { | 128 | { |
127 | SocketChardev *s = SOCKET_CHARDEV(chr); | 129 | SocketChardev *s = SOCKET_CHARDEV(chr); |
128 | ChardevSocket *sock = backend->u.socket.data; | 130 | ChardevSocket *sock = backend->u.socket.data; |
131 | +#ifndef _WIN32 | ||
129 | + const char *cmd = sock->cmd; | 132 | + const char *cmd = sock->cmd; |
133 | +#endif | ||
130 | bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; | 134 | bool do_nodelay = sock->has_nodelay ? sock->nodelay : false; |
131 | bool is_listen = sock->has_server ? sock->server : true; | 135 | bool is_listen = sock->has_server ? sock->server : true; |
132 | bool is_telnet = sock->has_telnet ? sock->telnet : false; | 136 | bool is_telnet = sock->has_telnet ? sock->telnet : false; |
133 | @@ -928,7 +989,12 @@ static void qmp_chardev_open_socket(Chardev *chr, | 137 | @@ -928,7 +993,15 @@ static void qmp_chardev_open_socket(Chardev *chr, |
134 | s->reconnect_time = reconnect; | 138 | s->reconnect_time = reconnect; |
135 | } | 139 | } |
136 | 140 | ||
137 | - if (s->reconnect_time) { | 141 | - if (s->reconnect_time) { |
142 | +#ifndef _WIN32 | ||
138 | + if (cmd) { | 143 | + if (cmd) { |
139 | + chardev_open_socket_cmd(chr, cmd, errp); | 144 | + chardev_open_socket_cmd(chr, cmd, errp); |
140 | + | 145 | + |
141 | + /* everything ready (or failed permanently) before we return */ | 146 | + /* everything ready (or failed permanently) before we return */ |
142 | + *be_opened = true; | 147 | + *be_opened = true; |
143 | + } else if (s->reconnect_time) { | 148 | + } else |
149 | +#endif | ||
150 | + if (s->reconnect_time) { | ||
144 | sioc = qio_channel_socket_new(); | 151 | sioc = qio_channel_socket_new(); |
145 | tcp_chr_set_client_ioc_name(chr, sioc); | 152 | tcp_chr_set_client_ioc_name(chr, sioc); |
146 | qio_channel_socket_connect_async(sioc, s->addr, | 153 | qio_channel_socket_connect_async(sioc, s->addr, |
147 | @@ -987,11 +1053,22 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, | 154 | @@ -987,11 +1060,27 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, |
148 | const char *host = qemu_opt_get(opts, "host"); | 155 | const char *host = qemu_opt_get(opts, "host"); |
149 | const char *port = qemu_opt_get(opts, "port"); | 156 | const char *port = qemu_opt_get(opts, "port"); |
150 | const char *tls_creds = qemu_opt_get(opts, "tls-creds"); | 157 | const char *tls_creds = qemu_opt_get(opts, "tls-creds"); |
158 | +#ifndef _WIN32 | ||
151 | + const char *cmd = qemu_opt_get(opts, "cmd"); | 159 | + const char *cmd = qemu_opt_get(opts, "cmd"); |
160 | +#endif | ||
152 | SocketAddressLegacy *addr; | 161 | SocketAddressLegacy *addr; |
153 | ChardevSocket *sock; | 162 | ChardevSocket *sock; |
154 | 163 | ||
155 | backend->type = CHARDEV_BACKEND_KIND_SOCKET; | 164 | backend->type = CHARDEV_BACKEND_KIND_SOCKET; |
156 | - if (!path) { | 165 | - if (!path) { |
166 | +#ifndef _WIN32 | ||
157 | + if (cmd) { | 167 | + if (cmd) { |
158 | + /* | 168 | + /* |
159 | + * Here we have to ensure that no options are set which are incompatible with | 169 | + * Here we have to ensure that no options are set which are incompatible with |
@@ -164,24 +174,35 @@ index 1ae730a4..c366a02a 100644 | |||
164 | + error_setg(errp, "chardev: socket: cmd does not support any additional options"); | 174 | + error_setg(errp, "chardev: socket: cmd does not support any additional options"); |
165 | + return; | 175 | + return; |
166 | + } | 176 | + } |
167 | + } else if (!path) { | 177 | + } else |
178 | +#endif | ||
179 | + if (!path) { | ||
168 | if (!host) { | 180 | if (!host) { |
169 | error_setg(errp, "chardev: socket: no host given"); | 181 | error_setg(errp, "chardev: socket: no host given"); |
170 | return; | 182 | return; |
171 | @@ -1023,13 +1100,14 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, | 183 | @@ -1023,13 +1112,24 @@ static void qemu_chr_parse_socket(QemuOpts *opts, ChardevBackend *backend, |
172 | sock->has_reconnect = true; | 184 | sock->has_reconnect = true; |
173 | sock->reconnect = reconnect; | 185 | sock->reconnect = reconnect; |
174 | sock->tls_creds = g_strdup(tls_creds); | 186 | sock->tls_creds = g_strdup(tls_creds); |
187 | +#ifndef _WIN32 | ||
175 | + sock->cmd = g_strdup(cmd); | 188 | + sock->cmd = g_strdup(cmd); |
189 | +#endif | ||
176 | 190 | ||
177 | addr = g_new0(SocketAddressLegacy, 1); | 191 | addr = g_new0(SocketAddressLegacy, 1); |
178 | - if (path) { | 192 | +#ifndef _WIN32 |
179 | + if (path || cmd) { | 193 | + if (path || cmd) { |
194 | +#else | ||
195 | if (path) { | ||
196 | +#endif | ||
180 | UnixSocketAddress *q_unix; | 197 | UnixSocketAddress *q_unix; |
181 | addr->type = SOCKET_ADDRESS_LEGACY_KIND_UNIX; | 198 | addr->type = SOCKET_ADDRESS_LEGACY_KIND_UNIX; |
182 | q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); | 199 | q_unix = addr->u.q_unix.data = g_new0(UnixSocketAddress, 1); |
183 | - q_unix->path = g_strdup(path); | 200 | - q_unix->path = g_strdup(path); |
201 | +#ifndef _WIN32 | ||
184 | + q_unix->path = cmd ? g_strdup_printf("cmd:%s", cmd) : g_strdup(path); | 202 | + q_unix->path = cmd ? g_strdup_printf("cmd:%s", cmd) : g_strdup(path); |
203 | +#else | ||
204 | + q_unix->path = g_strdup(path); | ||
205 | +#endif | ||
185 | } else { | 206 | } else { |
186 | addr->type = SOCKET_ADDRESS_LEGACY_KIND_INET; | 207 | addr->type = SOCKET_ADDRESS_LEGACY_KIND_INET; |
187 | addr->u.inet.data = g_new(InetSocketAddress, 1); | 208 | addr->u.inet.data = g_new(InetSocketAddress, 1); |