[PATCH] net/slirp: libslirp 4.8.0 compatibility

Michael Tokarev posted 1 patch 2 months ago
There is a newer version of this series
net/slirp.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
[PATCH] net/slirp: libslirp 4.8.0 compatibility
Posted by Michael Tokarev 2 months ago
This updates the code in net/slirp.c to be compatible with
libslirp 4.8.0, which deprecated slirp_pollfds_fill()
and started using slirp_os_socket type for sockets
(which is a 64-bit integer on win64).

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
I don't remember if this change has already been proposed.

 net/slirp.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/net/slirp.c b/net/slirp.c
index eb9a456ed4..5d6d059a95 100644
--- a/net/slirp.c
+++ b/net/slirp.c
@@ -314,7 +314,12 @@ static int slirp_poll_to_gio(int events)
     return ret;
 }
 
-static int net_slirp_add_poll(int fd, int events, void *opaque)
+#if SLIRP_CONFIG_VERSION_MAX < 6 /* < 4.8.0 compatibility */
+# define slirp_os_socket int
+# define slirp_pollfds_fill_socket slirp_pollfds_fill
+#endif
+
+static int net_slirp_add_poll(slirp_os_socket fd, int events, void *opaque)
 {
     GArray *pollfds = opaque;
     GPollFD pfd = {
@@ -363,8 +368,8 @@ static void net_slirp_poll_notify(Notifier *notifier, void *data)
 
     switch (poll->state) {
     case MAIN_LOOP_POLL_FILL:
-        slirp_pollfds_fill(s->slirp, &poll->timeout,
-                           net_slirp_add_poll, poll->pollfds);
+        slirp_pollfds_fill_socket(s->slirp, &poll->timeout,
+                                  net_slirp_add_poll, poll->pollfds);
         break;
     case MAIN_LOOP_POLL_OK:
     case MAIN_LOOP_POLL_ERR:
-- 
2.39.5