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
1 changed files with 15 additions and 14 deletions

29
vl.c
View File

@ -1764,17 +1764,19 @@ static CharDriverState *qemu_chr_open_stdio(void)
return chr; return chr;
} }
#if defined(__linux__) #if defined(__linux__) || defined(__sun__)
static CharDriverState *qemu_chr_open_pty(void) static CharDriverState *qemu_chr_open_pty(void)
{ {
struct termios tty; struct termios tty;
char slave_name[1024]; char slave_name[1024];
int master_fd, slave_fd; int master_fd, slave_fd;
#if defined(__linux__)
/* Not satisfying */ /* Not satisfying */
if (openpty(&master_fd, &slave_fd, slave_name, NULL, NULL) < 0) { if (openpty(&master_fd, &slave_fd, slave_name, NULL, NULL) < 0) {
return NULL; return NULL;
} }
#endif
/* Disabling local echo and line-buffered output */ /* Disabling local echo and line-buffered output */
tcgetattr (master_fd, &tty); tcgetattr (master_fd, &tty);
@ -1921,7 +1923,14 @@ static CharDriverState *qemu_chr_open_tty(const char *filename)
qemu_chr_reset(chr); qemu_chr_reset(chr);
return chr; return chr;
} }
#else /* ! __linux__ && ! __sun__ */
static CharDriverState *qemu_chr_open_pty(void)
{
return NULL;
}
#endif /* __linux__ || __sun__ */
#if defined(__linux__)
typedef struct { typedef struct {
int fd; int fd;
int mode; int mode;
@ -2064,17 +2073,10 @@ static CharDriverState *qemu_chr_open_pp(const char *filename)
return chr; return chr;
} }
#endif /* __linux__ */
#else #else /* _WIN32 */
static CharDriverState *qemu_chr_open_pty(void)
{
return NULL;
}
#endif
#endif /* !defined(_WIN32) */
#ifdef _WIN32
typedef struct { typedef struct {
int max_size; int max_size;
HANDLE hcom, hrecv, hsend; 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); return qemu_chr_open_win_file(fd_out);
} }
#endif #endif /* !_WIN32 */
/***********************************************************/ /***********************************************************/
/* UDP Net console */ /* UDP Net console */
@ -2954,16 +2956,15 @@ CharDriverState *qemu_chr_open(const char *filename)
} else if (!strcmp(filename, "stdio")) { } else if (!strcmp(filename, "stdio")) {
return qemu_chr_open_stdio(); return qemu_chr_open_stdio();
} else } else
#endif
#if defined(__linux__) #if defined(__linux__)
if (strstart(filename, "/dev/parport", NULL)) { if (strstart(filename, "/dev/parport", NULL)) {
return qemu_chr_open_pp(filename); return qemu_chr_open_pp(filename);
} else } else
#endif
if (strstart(filename, "/dev/", NULL)) { if (strstart(filename, "/dev/", NULL)) {
return qemu_chr_open_tty(filename); return qemu_chr_open_tty(filename);
} else } else
#endif #else /* !_WIN32 */
#ifdef _WIN32
if (strstart(filename, "COM", NULL)) { if (strstart(filename, "COM", NULL)) {
return qemu_chr_open_win(filename); return qemu_chr_open_win(filename);
} else } else