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
This commit is contained in:
ths 2007-06-25 11:48:07 +00:00
parent 1cd548eeee
commit aec62507bb

29
vl.c
View file

@ -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
#else /* _WIN32 */
#endif /* !defined(_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