ia64/xen-unstable

changeset 10951:155385a02d0b

[qemu] Write the port number where the vnc server is listening to xenstore.

Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com>
author chris@kneesaa.uk.xensource.com
date Thu Aug 03 19:14:41 2006 +0100 (2006-08-03)
parents 955f02563a13
children 646092d50e82
files tools/ioemu/vl.c tools/ioemu/vl.h tools/ioemu/xenstore.c
line diff
     1.1 --- a/tools/ioemu/vl.c	Thu Aug 03 18:34:03 2006 +0100
     1.2 +++ b/tools/ioemu/vl.c	Thu Aug 03 19:14:41 2006 +0100
     1.3 @@ -5954,6 +5954,7 @@ int main(int argc, char **argv)
     1.4  	vnc_display_init(ds, vnc_display);
     1.5  	if (vncviewer)
     1.6  	    vnc_start_viewer(vnc_display);
     1.7 +	xenstore_write_vncport(vnc_display);
     1.8      } else {
     1.9  #if defined(CONFIG_SDL)
    1.10          sdl_display_init(ds, full_screen);
     2.1 --- a/tools/ioemu/vl.h	Thu Aug 03 18:34:03 2006 +0100
     2.2 +++ b/tools/ioemu/vl.h	Thu Aug 03 19:14:41 2006 +0100
     2.3 @@ -1111,6 +1111,7 @@ void xenstore_parse_domain_config(int do
     2.4  int xenstore_fd(void);
     2.5  void xenstore_process_event(void *opaque);
     2.6  void xenstore_check_new_media_present(int timeout);
     2.7 +void xenstore_write_vncport(int vnc_display);
     2.8  
     2.9  
    2.10  void kqemu_record_dump(void);
     3.1 --- a/tools/ioemu/xenstore.c	Thu Aug 03 18:34:03 2006 +0100
     3.2 +++ b/tools/ioemu/xenstore.c	Thu Aug 03 19:14:41 2006 +0100
     3.3 @@ -185,3 +185,31 @@ void xenstore_process_event(void *opaque
     3.4      free(image);
     3.5      free(vec);
     3.6  }
     3.7 +
     3.8 +void xenstore_write_vncport(int display)
     3.9 +{
    3.10 +    char *buf = NULL, *path;
    3.11 +    char *portstr = NULL;
    3.12 +
    3.13 +    if (xsh == NULL)
    3.14 +	return;
    3.15 +
    3.16 +    path = xs_get_domain_path(xsh, domid);
    3.17 +    if (path == NULL) {
    3.18 +        fprintf(logfile, "xs_get_domain_path() error\n");
    3.19 +        goto out;
    3.20 +    }
    3.21 +
    3.22 +    if (pasprintf(&buf, "%s/console/vnc-port", path) == -1)
    3.23 +	goto out;
    3.24 +
    3.25 +    if (pasprintf(&portstr, "%d", 5900 + display) == -1)
    3.26 +	goto out;
    3.27 +
    3.28 +    if (xs_write(xsh, XBT_NULL, buf, portstr, strlen(portstr)) == 0)
    3.29 +        fprintf(logfile, "xs_write() vncport failed\n");
    3.30 +
    3.31 + out:
    3.32 +    free(portstr);
    3.33 +    free(buf);
    3.34 +}