aboutsummaryrefslogtreecommitdiffstats
path: root/tools/xenstore
diff options
context:
space:
mode:
authorAlex Zeffertt <alex.zeffertt@eu.citrix.com>2012-02-09 18:33:33 +0000
committerAlex Zeffertt <alex.zeffertt@eu.citrix.com>2012-02-09 18:33:33 +0000
commit179daa44debfdac406d7590c81dff60d97e788c9 (patch)
tree1ec0cabd6a4253b73b646fb548970657c25a8db7 /tools/xenstore
parentf3d9cbbbebca0580c54a935b15365a67d2639446 (diff)
downloadxen-179daa44debfdac406d7590c81dff60d97e788c9.tar.gz
xen-179daa44debfdac406d7590c81dff60d97e788c9.tar.bz2
xen-179daa44debfdac406d7590c81dff60d97e788c9.zip
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@citrix.com> Signed-off-by: Alex Zeffertt <alex.zeffertt@eu.citrix.com> Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> Acked-by: Ian Campbell <ian.campbell@citrix.com> Cc: Ian Jackson <ian.jackson@eu.citrix.com> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Committed-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Diffstat (limited to 'tools/xenstore')
-rw-r--r--tools/xenstore/xenstored_core.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c
index 0e7d43f2e9..c1ee932914 100644
--- a/tools/xenstore/xenstored_core.c
+++ b/tools/xenstore/xenstored_core.c
@@ -19,9 +19,11 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/socket.h>
#include <sys/select.h>
+#ifndef NO_SOCKETS
+#include <sys/socket.h>
#include <sys/un.h>
+#endif
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
@@ -320,8 +322,10 @@ static int initialize_set(fd_set *inset, fd_set *outset, int sock, int ro_sock,
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 @@ struct connection *new_connection(connwritefn_t *write, connreadfn_t *read)
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 @@ static void accept_connection(int sock, bool canwrite)
} else
close(fd);
}
+#endif
#define TDB_FLAGS 0
@@ -1698,6 +1708,13 @@ static void daemonize(void)
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 @@ static void init_sockets(int **psock, int **pro_sock)
}
+#endif
static void usage(void)
{
@@ -1938,10 +1956,10 @@ int main(int argc, char *argv[])
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))