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

[Xen-changelog] [xen-unstable] xenstored: add NO_SOCKETS compilation option



# HG changeset patch
# User Alex Zeffertt <alex.zeffertt@xxxxxxxxxxxxx>
# Date 1328812413 0
# Node ID d847e5c4b6c9b7cd9c7cf449dfd87ffb077a50fa
# Parent  674fcff272be09962eba636361623f3874906ace
xenstored: add NO_SOCKETS compilation option

Add option for compiling xenstored without unix sockets to support
running on mini-OS

Signed-off-by: Diego Ongaro <diego.ongaro@xxxxxxxxxx>
Signed-off-by: Alex Zeffertt <alex.zeffertt@xxxxxxxxxxxxx>
Signed-off-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---


diff -r 674fcff272be -r d847e5c4b6c9 tools/xenstore/xenstored_core.c
--- a/tools/xenstore/xenstored_core.c   Thu Feb 09 18:33:33 2012 +0000
+++ b/tools/xenstore/xenstored_core.c   Thu Feb 09 18:33:33 2012 +0000
@@ -19,9 +19,11 @@
 
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/select.h>
+#ifndef NO_SOCKETS
 #include <sys/socket.h>
-#include <sys/select.h>
 #include <sys/un.h>
+#endif
 #include <sys/time.h>
 #include <time.h>
 #include <unistd.h>
@@ -320,8 +322,10 @@
        FD_ZERO(inset);
        FD_ZERO(outset);
 
-       set_fd(sock,               inset, &max);
-       set_fd(ro_sock,            inset, &max);
+       if (sock != -1)
+               set_fd(sock, inset, &max);
+       if (ro_sock != -1)
+               set_fd(ro_sock, inset, &max);
        set_fd(reopen_log_pipe[0], inset, &max);
 
        if (xce_handle != NULL)
@@ -1345,6 +1349,11 @@
        return new;
 }
 
+#ifdef NO_SOCKETS
+static void accept_connection(int sock, bool canwrite)
+{
+}
+#else
 static int writefd(struct connection *conn, const void *data, unsigned int len)
 {
        int rc;
@@ -1399,6 +1408,7 @@
        } else
                close(fd);
 }
+#endif
 
 #define TDB_FLAGS 0
 
@@ -1698,6 +1708,13 @@
        umask(0);
 }
 
+#ifdef NO_SOCKETS
+static void init_sockets(int **psock, int **pro_sock)
+{
+       static int minus_one = -1;
+       *psock = *pro_sock = &minus_one;
+}
+#else
 static int destroy_fd(void *_fd)
 {
        int *fd = _fd;
@@ -1743,6 +1760,7 @@
 
 
 }
+#endif
 
 static void usage(void)
 {
@@ -1938,10 +1956,10 @@
                        reopen_log();
                }
 
-               if (FD_ISSET(*sock, &inset))
+               if (*sock != -1 && FD_ISSET(*sock, &inset))
                        accept_connection(*sock, true);
 
-               if (FD_ISSET(*ro_sock, &inset))
+               if (*ro_sock != -1 && FD_ISSET(*ro_sock, &inset))
                        accept_connection(*ro_sock, false);
 
                if (evtchn_fd != -1 && FD_ISSET(evtchn_fd, &inset))

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.