]> xenbits.xensource.com Git - xen.git/commitdiff
[qemu] Write the port number where the vnc server is listening to xenstore.
authorchris@kneesaa.uk.xensource.com <chris@kneesaa.uk.xensource.com>
Thu, 3 Aug 2006 18:14:41 +0000 (19:14 +0100)
committerchris@kneesaa.uk.xensource.com <chris@kneesaa.uk.xensource.com>
Thu, 3 Aug 2006 18:14:41 +0000 (19:14 +0100)
Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
tools/ioemu/vl.c
tools/ioemu/vl.h
tools/ioemu/xenstore.c

index 1f2edace32debde2765c36feb23543cf874169cb..34ae60df0b62e1138d610bcbdb2a06cf7d91d1b0 100644 (file)
@@ -5954,6 +5954,7 @@ int main(int argc, char **argv)
        vnc_display_init(ds, vnc_display);
        if (vncviewer)
            vnc_start_viewer(vnc_display);
+       xenstore_write_vncport(vnc_display);
     } else {
 #if defined(CONFIG_SDL)
         sdl_display_init(ds, full_screen);
index 28990cb8ddb9767504c5316fea37c52946df4d97..517209fb795e12327d068c04ad1379c346ef4592 100644 (file)
@@ -1111,6 +1111,7 @@ void xenstore_parse_domain_config(int domid);
 int xenstore_fd(void);
 void xenstore_process_event(void *opaque);
 void xenstore_check_new_media_present(int timeout);
+void xenstore_write_vncport(int vnc_display);
 
 
 void kqemu_record_dump(void);
index e1c20bb1805bf31cd60485d32f1fd0c3a7ea814f..fde469305a7743a4b590c768dcdbc8927f25ebdd 100644 (file)
@@ -185,3 +185,31 @@ void xenstore_process_event(void *opaque)
     free(image);
     free(vec);
 }
+
+void xenstore_write_vncport(int display)
+{
+    char *buf = NULL, *path;
+    char *portstr = NULL;
+
+    if (xsh == NULL)
+       return;
+
+    path = xs_get_domain_path(xsh, domid);
+    if (path == NULL) {
+        fprintf(logfile, "xs_get_domain_path() error\n");
+        goto out;
+    }
+
+    if (pasprintf(&buf, "%s/console/vnc-port", path) == -1)
+       goto out;
+
+    if (pasprintf(&portstr, "%d", 5900 + display) == -1)
+       goto out;
+
+    if (xs_write(xsh, XBT_NULL, buf, portstr, strlen(portstr)) == 0)
+        fprintf(logfile, "xs_write() vncport failed\n");
+
+ out:
+    free(portstr);
+    free(buf);
+}