]> xenbits.xensource.com Git - qemu-xen-4.3-testing.git/commitdiff
implement qemu_chr_open_pty for stubdoms
authorIan Jackson <ian.jackson@eu.citrix.com>
Thu, 18 Jun 2009 14:22:16 +0000 (15:22 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Thu, 18 Jun 2009 14:22:16 +0000 (15:22 +0100)
this is an updated version of the patch "implement qemu_chr_open_pty for
stubdoms": qemu_chr_open_pty is now based on posix_openpt instead of
openpty(void).

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
[ This depends on the corresponding minios change, which is
  19790:01ad2654815a ]

qemu-char.c

index 819b8817dd691d3bbd3145d85f416d56088bab9f..7a6a33da29e5181a59d5b1ed324778fca0c812ea 100644 (file)
@@ -1120,6 +1120,26 @@ static CharDriverState *qemu_chr_open_tty(const char *filename)
     qemu_chr_reset(chr);
     return chr;
 }
+#elif CONFIG_STUBDOM
+#include <fcntl.h>
+static CharDriverState *qemu_chr_open_pty(void)
+{
+    CharDriverState *chr;
+    int fd;
+
+    fd = posix_openpt(O_RDWR|O_NOCTTY);
+    if (fd < 0)
+        return NULL;
+
+    chr = qemu_chr_open_fd(fd, fd);
+    if (!chr) {
+        close(fd);
+        return NULL;
+    }
+
+    qemu_chr_reset(chr);
+    return chr;
+}
 #else  /* ! __linux__ && ! __sun__ */
 static CharDriverState *qemu_chr_open_pty(void)
 {