[PATCH spice-server v4 15/20] windows: Disable code not working on Windows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



- global signals;
- CLOEXEC flag;
- mmap and statistics;
- IPTOS_LOWDELAY flag;
- Unix sockets;
- sharing file descriptors through Unix sockets;
- TCP_CORK flag.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/red-channel-client.c     |  2 ++
 server/red-stream.c             | 11 ++++++++++-
 server/red-stream.h             |  2 ++
 server/red-worker.c             |  6 ++++++
 server/reds.c                   |  7 ++++++-
 server/sound.c                  |  5 +++--
 server/stat-file.c              |  2 ++
 server/tests/basic-event-loop.c |  2 ++
 server/tests/replay.c           |  2 ++
 tools/Makefile.am               |  2 ++
 10 files changed, 37 insertions(+), 4 deletions(-)

diff --git a/server/red-channel-client.c b/server/red-channel-client.c
index 375a60b3..9ee0ec6c 100644
--- a/server/red-channel-client.c
+++ b/server/red-channel-client.c
@@ -627,6 +627,7 @@ static void red_channel_client_restore_main_sender(RedChannelClient *rcc)
 
 static void red_channel_client_msg_sent(RedChannelClient *rcc)
 {
+#ifndef _WIN32
     int fd;
 
     if (spice_marshaller_get_fd(rcc->priv->send_data.marshaller, &fd)) {
@@ -640,6 +641,7 @@ static void red_channel_client_msg_sent(RedChannelClient *rcc)
         if (fd != -1)
             close(fd);
     }
+#endif
 
     red_channel_client_clear_sent_item(rcc);
 
diff --git a/server/red-stream.c b/server/red-stream.c
index 8f36d1d4..3641f0ce 100644
--- a/server/red-stream.c
+++ b/server/red-stream.c
@@ -41,7 +41,7 @@
 #include "reds.h"
 
 // compatibility for *BSD systems
-#ifndef TCP_CORK
+#if !defined(TCP_CORK) && !defined(_WIN32)
 #define TCP_CORK TCP_NOPUSH
 #endif
 
@@ -102,6 +102,7 @@ struct RedStreamPrivate {
     SpiceCoreInterfaceInternal *core;
 };
 
+#ifndef _WIN32
 /**
  * Set TCP_CORK on socket
  */
@@ -111,6 +112,12 @@ static int socket_set_cork(int socket, int enabled)
     SPICE_VERIFY(sizeof(enabled) == sizeof(int));
     return setsockopt(socket, IPPROTO_TCP, TCP_CORK, &enabled, sizeof(enabled));
 }
+#else
+static inline int socket_set_cork(int socket, int enabled)
+{
+    return -1;
+}
+#endif
 
 static ssize_t stream_write_cb(RedStream *s, const void *buf, size_t size)
 {
@@ -318,6 +325,7 @@ int red_stream_get_no_delay(RedStream *stream)
     return red_socket_get_no_delay(stream->socket);
 }
 
+#ifndef _WIN32
 int red_stream_send_msgfd(RedStream *stream, int fd)
 {
     struct msghdr msgh = { 0, };
@@ -360,6 +368,7 @@ int red_stream_send_msgfd(RedStream *stream, int fd)
 
     return r;
 }
+#endif
 
 ssize_t red_stream_writev(RedStream *s, const struct iovec *iov, int iovcnt)
 {
diff --git a/server/red-stream.h b/server/red-stream.h
index 9a7cc617..ca6dc71a 100644
--- a/server/red-stream.h
+++ b/server/red-stream.h
@@ -67,7 +67,9 @@ int red_stream_get_family(const RedStream *stream);
 bool red_stream_is_plain_unix(const RedStream *stream);
 bool red_stream_set_no_delay(RedStream *stream, bool no_delay);
 int red_stream_get_no_delay(RedStream *stream);
+#ifndef _WIN32
 int red_stream_send_msgfd(RedStream *stream, int fd);
+#endif
 
 /**
  * Set auto flush flag.
diff --git a/server/red-worker.c b/server/red-worker.c
index c74ae888..82e71f06 100644
--- a/server/red-worker.c
+++ b/server/red-worker.c
@@ -1360,22 +1360,28 @@ static void *red_worker_main(void *arg)
 
 bool red_worker_run(RedWorker *worker)
 {
+#ifndef _WIN32
     sigset_t thread_sig_mask;
     sigset_t curr_sig_mask;
+#endif
     int r;
 
     spice_return_val_if_fail(worker, FALSE);
     spice_return_val_if_fail(!worker->thread, FALSE);
 
+#ifndef _WIN32
     sigfillset(&thread_sig_mask);
     sigdelset(&thread_sig_mask, SIGILL);
     sigdelset(&thread_sig_mask, SIGFPE);
     sigdelset(&thread_sig_mask, SIGSEGV);
     pthread_sigmask(SIG_SETMASK, &thread_sig_mask, &curr_sig_mask);
+#endif
     if ((r = pthread_create(&worker->thread, NULL, red_worker_main, worker))) {
         spice_error("create thread failed %d", r);
     }
+#ifndef _WIN32
     pthread_sigmask(SIG_SETMASK, &curr_sig_mask, NULL);
+#endif
     pthread_setname_np(worker->thread, "SPICE Worker");
 
     return r == 0;
diff --git a/server/reds.c b/server/reds.c
index 3404d5a2..1fdf9e84 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2652,9 +2652,11 @@ static int reds_init_socket(const char *addr, int portnr, int family)
     static const int on=1, off=0;
     struct addrinfo ai,*res,*e;
     char port[33];
-    int slisten, rc, len;
+    int slisten, rc;
 
     if (family == AF_UNIX) {
+#ifndef _WIN32
+        int len;
         struct sockaddr_un local = { 0, };
 
         if ((slisten = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
@@ -2673,6 +2675,9 @@ static int reds_init_socket(const char *addr, int portnr, int family)
         }
 
         goto listen;
+#else
+        return -1;
+#endif
     }
 
     memset(&ai,0, sizeof(ai));
diff --git a/server/sound.c b/server/sound.c
index 44b27dec..c08b8bcf 100644
--- a/server/sound.c
+++ b/server/sound.c
@@ -775,7 +775,6 @@ static void record_channel_send_item(RedChannelClient *rcc, G_GNUC_UNUSED RedPip
 
 static bool snd_channel_client_config_socket(RedChannelClient *rcc)
 {
-    int tos;
     RedStream *stream = red_channel_client_get_stream(rcc);
     RedClient *red_client = red_channel_client_get_client(rcc);
     MainChannelClient *mcc = red_client_get_main(red_client);
@@ -791,7 +790,8 @@ static bool snd_channel_client_config_socket(RedChannelClient *rcc)
     }
 #endif
 
-    tos = IPTOS_LOWDELAY;
+#ifdef IPTOS_LOWDELAY
+    int tos = IPTOS_LOWDELAY;
     if (setsockopt(stream->socket, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) == -1) {
         if (errno != ENOTSUP) {
             red_channel_warning(red_channel_client_get_channel(rcc),
@@ -799,6 +799,7 @@ static bool snd_channel_client_config_socket(RedChannelClient *rcc)
                                 strerror(errno));
         }
     }
+#endif
 
     red_stream_set_no_delay(stream, !main_channel_client_is_low_bandwidth(mcc));
 
diff --git a/server/stat-file.c b/server/stat-file.c
index b2c199f3..e5a89e22 100644
--- a/server/stat-file.c
+++ b/server/stat-file.c
@@ -19,6 +19,7 @@
 #include <config.h>
 #endif
 
+#ifndef _WIN32
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -236,3 +237,4 @@ void stat_file_remove_counter(RedStatFile *stat_file, uint64_t *counter)
 {
     stat_file_remove(stat_file, (SpiceStatNode *)(counter - SPICE_OFFSETOF(SpiceStatNode, value)));
 }
+#endif
diff --git a/server/tests/basic-event-loop.c b/server/tests/basic-event-loop.c
index 607a5a5e..e331e852 100644
--- a/server/tests/basic-event-loop.c
+++ b/server/tests/basic-event-loop.c
@@ -68,12 +68,14 @@ void basic_event_loop_quit(void)
 
 static void ignore_sigpipe(void)
 {
+#ifndef _WIN32
     struct sigaction act;
 
     memset(&act, 0, sizeof(act));
     sigfillset(&act.sa_mask);
     act.sa_handler = SIG_IGN;
     sigaction(SIGPIPE, &act, NULL);
+#endif
 }
 
 static SpiceTimer* base_timer_add(SpiceTimerFunc func, void *opaque)
diff --git a/server/tests/replay.c b/server/tests/replay.c
index f7d26fec..6367ce21 100644
--- a/server/tests/replay.c
+++ b/server/tests/replay.c
@@ -411,10 +411,12 @@ int main(int argc, char **argv)
     }
     g_strfreev(file);
     file = NULL;
+#ifndef _WIN32
     if (fcntl(fileno(fd), FD_CLOEXEC) < 0) {
         perror("fcntl failed");
         exit(1);
     }
+#endif
     fseek(fd, 0L, SEEK_END);
     total_size = ftell(fd);
     fseek(fd, 0L, SEEK_SET);
diff --git a/tools/Makefile.am b/tools/Makefile.am
index cfb0a213..702fcdd1 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -10,6 +10,7 @@ AM_LDFLAGS = \
 	$(LIBRT) \
 	$(NULL)
 
+if !OS_WIN32
 noinst_PROGRAMS = \
 	reds_stat \
 	$(NULL)
@@ -17,6 +18,7 @@ noinst_PROGRAMS = \
 reds_stat_SOURCES = \
 	reds_stat.c \
 	$(NULL)
+endif
 
 EXTRA_DIST = \
 	meson.build \
-- 
2.20.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]