I've just posted a note describing the following on the qemu-discuss list
at opensolaris.org;  So apologies if you have to read of it twice.

I'll repeat here my thanks to those involved in making QEMU available.
It's proving to be very useful.

Attached is a patch which enables the serial code for connecting to Unix
tty serial ports on a Solaris host.  It's really nothing more than a
bit of tinkering with "#if" statements, and a bit of reordering some
code, all of which should continue to work on the related Linux hosts.
I've verified that it works well enough to support hotsync of a Palm
PDA with a Windows guest hosted on Solaris-10U3_x86 (32bit).

The patch is made against a tarball currently on the opensolaris.org
QEMU downloads area, which is based on an SVN snapshot dated 2007/06/12
(vl.c was dated 10-June-2007).  Please do let me know if things in vl.c
have diverged enough to make integrating the patch inconvenient, and
I'll try again after the dust has settled.

Regards,

Marion

--- ./vl.c.0	Sun Jun 10 12:21:04 2007
+++ ./vl.c	Sun Jun 17 16:16:15 2007
@@ -1761,7 +1761,7 @@
     return chr;
 }
 
-#if defined(__linux__)
+#if defined(__linux__) || defined(__sun__)
 static CharDriverState *qemu_chr_open_pty(void)
 {
     struct termios tty;
@@ -1768,10 +1768,12 @@
     char slave_name[1024];
     int master_fd, slave_fd;
     
+#if defined(__linux__)
     /* Not satisfying */
     if (openpty(&master_fd, &slave_fd, slave_name, NULL, NULL) < 0) {
         return NULL;
     }
+#endif
     
     /* Disabling local echo and line-buffered output */
     tcgetattr (master_fd, &tty);
@@ -1919,6 +1921,7 @@
     return chr;
 }
 
+#if defined(__linux__)
 typedef struct {
     int fd;
     int mode;
@@ -2061,8 +2064,9 @@
 
     return chr;
 }
+#endif /* __linux__ */
 
-#else
+#else  /*! __linux__ && ! __sun__ */
 static CharDriverState *qemu_chr_open_pty(void)
 {
     return NULL;
@@ -2951,11 +2955,11 @@
     } else if (!strcmp(filename, "stdio")) {
         return qemu_chr_open_stdio();
     } else 
-#endif
 #if defined(__linux__)
     if (strstart(filename, "/dev/parport", NULL)) {
         return qemu_chr_open_pp(filename);
     } else 
+#endif
     if (strstart(filename, "/dev/", NULL)) {
         return qemu_chr_open_tty(filename);
     } else 

Reply via email to