diff options
author | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-06-15 13:11:31 +0100 |
---|---|---|
committer | kaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk> | 2006-06-15 13:11:31 +0100 |
commit | 76f880fe7dc70b529cca572dcb0ae9815a76afff (patch) | |
tree | 36052febe9557e84b01d422b28d4fb96bef0eaec /tools/xenstore/xenstored_core.c | |
parent | a8bdc8130ef1242b2db60cad430ad1ba336cf102 (diff) | |
download | xen-76f880fe7dc70b529cca572dcb0ae9815a76afff.tar.gz xen-76f880fe7dc70b529cca572dcb0ae9815a76afff.tar.bz2 xen-76f880fe7dc70b529cca572dcb0ae9815a76afff.zip |
[TOOLS] Introduce xc_evtchn_*() interface for interacting with /dev/xen/evtchn.
No longer open the device as non-blocking: all reads immediately follow
a select() on the device indicating it's ready to read.
Signed-off-by: John Levon <john.levon@sun.com>
Diffstat (limited to 'tools/xenstore/xenstored_core.c')
-rw-r--r-- | tools/xenstore/xenstored_core.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_core.c index ec31977cdd..25330f9906 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -54,7 +54,7 @@ #include "hashtable.h" -extern int eventchn_fd; /* in xenstored_domain.c */ +extern int xce_handle; /* in xenstored_domain.c */ static bool verbose = false; LIST_HEAD(connections); @@ -353,8 +353,11 @@ static int initialize_set(fd_set *inset, fd_set *outset, int sock, int ro_sock) set_fd(sock, inset, &max); set_fd(ro_sock, inset, &max); - set_fd(eventchn_fd, inset, &max); set_fd(reopen_log_pipe[0], inset, &max); + + if (xce_handle != -1) + set_fd(xc_evtchn_fd(xce_handle), inset, &max); + list_for_each_entry(i, &connections, list) { if (i->domain) continue; @@ -1769,6 +1772,7 @@ int main(int argc, char *argv[]) bool outputpid = false; bool no_domain_init = false; const char *pidfile = NULL; + int evtchn_fd = -1; while ((opt = getopt_long(argc, argv, "DE:F:HNPS:T:RLVW:", options, NULL)) != -1) { @@ -1907,6 +1911,9 @@ int main(int argc, char *argv[]) signal(SIGUSR1, stop_failtest); #endif + if (xce_handle != -1) + evtchn_fd = xc_evtchn_fd(xce_handle); + /* Get ready to listen to the tools. */ max = initialize_set(&inset, &outset, *sock, *ro_sock); @@ -1934,7 +1941,7 @@ int main(int argc, char *argv[]) if (FD_ISSET(*ro_sock, &inset)) accept_connection(*ro_sock, false); - if (eventchn_fd > 0 && FD_ISSET(eventchn_fd, &inset)) + if (evtchn_fd != -1 && FD_ISSET(evtchn_fd, &inset)) handle_event(); list_for_each_entry(i, &connections, list) { |