aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-25 11:48:07 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-25 11:48:07 +0000
commitaec62507bb6a14b02575f40ec84f617b935043d3 (patch)
treeb9fb996d8b39e493fb2830a08edcce9da0e3b9c4
parent1cd548eeee110dd1eff11e4434b2cf71c429405e (diff)
Enable serial (tty) support on Solaris host, by Marion Hakanson.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3018 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r--vl.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/vl.c b/vl.c
index 22ded6bf01..172b5ab155 100644
--- a/vl.c
+++ b/vl.c
@@ -1764,17 +1764,19 @@ static CharDriverState *qemu_chr_open_stdio(void)
return chr;
}
-#if defined(__linux__)
+#if defined(__linux__) || defined(__sun__)
static CharDriverState *qemu_chr_open_pty(void)
{
struct termios tty;
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);
@@ -1921,7 +1923,14 @@ static CharDriverState *qemu_chr_open_tty(const char *filename)
qemu_chr_reset(chr);
return chr;
}
+#else /* ! __linux__ && ! __sun__ */
+static CharDriverState *qemu_chr_open_pty(void)
+{
+ return NULL;
+}
+#endif /* __linux__ || __sun__ */
+#if defined(__linux__)
typedef struct {
int fd;
int mode;
@@ -2064,17 +2073,10 @@ static CharDriverState *qemu_chr_open_pp(const char *filename)
return chr;
}
+#endif /* __linux__ */
-#else
-static CharDriverState *qemu_chr_open_pty(void)
-{
- return NULL;
-}
-#endif
-
-#endif /* !defined(_WIN32) */
+#else /* _WIN32 */
-#ifdef _WIN32
typedef struct {
int max_size;
HANDLE hcom, hrecv, hsend;
@@ -2440,7 +2442,7 @@ static CharDriverState *qemu_chr_open_win_file_out(const char *file_out)
return qemu_chr_open_win_file(fd_out);
}
-#endif
+#endif /* !_WIN32 */
/***********************************************************/
/* UDP Net console */
@@ -2954,16 +2956,15 @@ CharDriverState *qemu_chr_open(const char *filename)
} 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
-#endif
-#ifdef _WIN32
+#else /* !_WIN32 */
if (strstart(filename, "COM", NULL)) {
return qemu_chr_open_win(filename);
} else