aboutsummaryrefslogtreecommitdiffstats
path: root/tools/console
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-04-20 15:38:29 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-04-20 15:38:29 +0100
commit33ac804deb5db50e6c5280b3f5b9af2cf1552177 (patch)
tree19b3b8312390f9b1a010ba151156b264a5673245 /tools/console
parent5aa2a526e22772446e1d182c487aa6ebcff11660 (diff)
downloadxen-33ac804deb5db50e6c5280b3f5b9af2cf1552177.tar.gz
xen-33ac804deb5db50e6c5280b3f5b9af2cf1552177.tar.bz2
xen-33ac804deb5db50e6c5280b3f5b9af2cf1552177.zip
xenconsoled: Fixes to domain management.
Event-channel setup: Re-bind if the connection becomes unbound (e.g., due to 'slow' domain suspend cancellation), even if the remote port identifier has not changed. Domain logging: Only open log file once (don't leak fds) and fix a small memory leak. Evtchn changes based on a patch by Jiri Denemark <jdenemar@redhat.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'tools/console')
-rw-r--r--tools/console/daemon/io.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/console/daemon/io.c b/tools/console/daemon/io.c
index de712affe3..2475963a58 100644
--- a/tools/console/daemon/io.c
+++ b/tools/console/daemon/io.c
@@ -288,6 +288,7 @@ static int create_domain_log(struct domain *dom)
namepath = s;
strcat(namepath, "/name");
data = xs_read(xs, XBT_NULL, namepath, &len);
+ free(namepath);
if (!data)
return -1;
if (!len) {
@@ -548,9 +549,6 @@ static int domain_create_ring(struct domain *dom)
}
free(type);
- if ((ring_ref == dom->ring_ref) && (remote_port == dom->remote_port))
- goto out;
-
if (ring_ref != dom->ring_ref) {
if (dom->interface != NULL)
munmap(dom->interface, getpagesize());
@@ -565,6 +563,16 @@ static int domain_create_ring(struct domain *dom)
dom->ring_ref = ring_ref;
}
+ /* Go no further if port has not changed and we are still bound. */
+ if (remote_port == dom->remote_port) {
+ xc_evtchn_status_t status = {
+ .dom = DOMID_SELF,
+ .port = dom->local_port };
+ if ((xc_evtchn_status(xc, &status) == 0) &&
+ (status.status == EVTCHNSTAT_interdomain))
+ goto out;
+ }
+
dom->local_port = -1;
dom->remote_port = -1;
if (dom->xce_handle != -1)
@@ -601,7 +609,7 @@ static int domain_create_ring(struct domain *dom)
}
}
- if (log_guest)
+ if (log_guest && (dom->log_fd == -1))
dom->log_fd = create_domain_log(dom);
out: