[Spice-commits] configure.ac server/net-utils.c server/red-worker.c server/sound.c server/tests

Frediano Ziglio fziglio at kemper.freedesktop.org
Mon Jan 15 16:53:52 UTC 2018


 configure.ac                     |    2 +-
 server/net-utils.c               |    5 ++++-
 server/red-worker.c              |    6 ++++++
 server/sound.c                   |    2 ++
 server/tests/test-display-base.c |    2 +-
 5 files changed, 14 insertions(+), 3 deletions(-)

New commits:
commit 7a25e46c8b9897beecd26ec7937953888fe3c186
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Wed Jan 10 08:50:06 2018 +0000

    Minor compatibility with FreeBSD system
    
    Some additional header are needed to avoid undefined types.
    SOL_TCP and IPPROTO_TCP have the same value in Linux but SOL_TCP
    is not defined in FreeBSD.
    Provide pthread_setname_np using pthread_set_name_np (same parameters).
    
    Patch is based on a patch from Oleg Ginzburg <olevole at olevole.ru>
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/configure.ac b/configure.ac
index 9e4868bc..9eb9bb49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,7 +49,7 @@ AM_PROG_CC_C_O
 AC_C_BIGENDIAN
 PKG_PROG_PKG_CONFIG
 
-AC_CHECK_HEADERS([sys/time.h execinfo.h linux/sockios.h])
+AC_CHECK_HEADERS([sys/time.h execinfo.h linux/sockios.h pthread_np.h])
 AC_CHECK_DECL([TCP_KEEPIDLE], [have_tcp_keepidle="yes"],,
               [#include <netinet/tcp.h>])
 AS_IF([test "x$have_tcp_keepidle" = "xyes"],
diff --git a/server/net-utils.c b/server/net-utils.c
index 06fb8b13..90dbbed5 100644
--- a/server/net-utils.c
+++ b/server/net-utils.c
@@ -23,6 +23,9 @@
 #include <fcntl.h>
 #include <stdbool.h>
 #include <string.h>
+#include <sys/types.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
 #include <netinet/ip.h>
 #include <netinet/tcp.h>
 #include <sys/socket.h>
@@ -54,7 +57,7 @@ bool red_socket_set_keepalive(int fd, bool enable, int timeout)
     }
 
 #ifdef HAVE_TCP_KEEPIDLE
-    if (setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, &timeout, sizeof(timeout)) == -1) {
+    if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &timeout, sizeof(timeout)) == -1) {
         if (errno != ENOTSUP) {
             spice_printerr("setsockopt for keepalive timeout failed, %s", strerror(errno));
             return false;
diff --git a/server/red-worker.c b/server/red-worker.c
index 21622b1e..387f500e 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -47,6 +47,12 @@
 #include "cursor-channel.h"
 #include "tree.h"
 
+// compatibility for FreeBSD
+#ifdef HAVE_PTHREAD_NP_H
+#include <pthread_np.h>
+#define pthread_setname_np pthread_set_name_np
+#endif
+
 #define CMD_RING_POLL_TIMEOUT 10 //milli
 #define CMD_RING_POLL_RETRIES 1
 
diff --git a/server/sound.c b/server/sound.c
index 68f3484d..8ba2485c 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -22,6 +22,8 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <limits.h>
+#include <sys/types.h>
+#include <netinet/in.h>
 #include <sys/socket.h>
 #include <netinet/ip.h>
 #include <netinet/tcp.h>
diff --git a/server/tests/test-display-base.c b/server/tests/test-display-base.c
index c74a2289..a86a8b67 100644
--- a/server/tests/test-display-base.c
+++ b/server/tests/test-display-base.c
@@ -22,7 +22,7 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <signal.h>
-#include <wait.h>
+#include <sys/wait.h>
 #include <sys/select.h>
 #include <sys/types.h>
 #include <getopt.h>


More information about the Spice-commits mailing list