Skip to contentSkip to conversation

qemu: implement qemu_chr_open_pty for stubdoms

PATCH New Stefano Stabellini 1 participant 1 message Jun 11, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qemu: implement qemu_chr_open_pty for stubdoms

This patchs implements qemu_chr_open_pty for stubdoms.

---

qemu-char.c +20 -0
index 819b881..177abb9 100644
@@ -1120,6 +1120,26 @@ static CharDriverState *qemu_chr_open_tty(const char *filename)
     qemu_chr_reset(chr);
     return chr;
 }
+#elif CONFIG_STUBDOM
+#include <lib.h>
+static CharDriverState *qemu_chr_open_pty(void)
+{
+    CharDriverState *chr;
+    int fd;
+
+    fd = openpty();
+    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)
 {