Commit aec62507bb6a14b02575f40ec84f617b935043d3
1 parent
1cd548ee
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
Showing
1 changed file
with
15 additions
and
14 deletions
vl.c
| ... | ... | @@ -1764,17 +1764,19 @@ static CharDriverState *qemu_chr_open_stdio(void) |
| 1764 | 1764 | return chr; |
| 1765 | 1765 | } |
| 1766 | 1766 | |
| 1767 | -#if defined(__linux__) | |
| 1767 | +#if defined(__linux__) || defined(__sun__) | |
| 1768 | 1768 | static CharDriverState *qemu_chr_open_pty(void) |
| 1769 | 1769 | { |
| 1770 | 1770 | struct termios tty; |
| 1771 | 1771 | char slave_name[1024]; |
| 1772 | 1772 | int master_fd, slave_fd; |
| 1773 | 1773 | |
| 1774 | +#if defined(__linux__) | |
| 1774 | 1775 | /* Not satisfying */ |
| 1775 | 1776 | if (openpty(&master_fd, &slave_fd, slave_name, NULL, NULL) < 0) { |
| 1776 | 1777 | return NULL; |
| 1777 | 1778 | } |
| 1779 | +#endif | |
| 1778 | 1780 | |
| 1779 | 1781 | /* Disabling local echo and line-buffered output */ |
| 1780 | 1782 | tcgetattr (master_fd, &tty); |
| ... | ... | @@ -1921,7 +1923,14 @@ static CharDriverState *qemu_chr_open_tty(const char *filename) |
| 1921 | 1923 | qemu_chr_reset(chr); |
| 1922 | 1924 | return chr; |
| 1923 | 1925 | } |
| 1926 | +#else /* ! __linux__ && ! __sun__ */ | |
| 1927 | +static CharDriverState *qemu_chr_open_pty(void) | |
| 1928 | +{ | |
| 1929 | + return NULL; | |
| 1930 | +} | |
| 1931 | +#endif /* __linux__ || __sun__ */ | |
| 1924 | 1932 | |
| 1933 | +#if defined(__linux__) | |
| 1925 | 1934 | typedef struct { |
| 1926 | 1935 | int fd; |
| 1927 | 1936 | int mode; |
| ... | ... | @@ -2064,17 +2073,10 @@ static CharDriverState *qemu_chr_open_pp(const char *filename) |
| 2064 | 2073 | |
| 2065 | 2074 | return chr; |
| 2066 | 2075 | } |
| 2076 | +#endif /* __linux__ */ | |
| 2067 | 2077 | |
| 2068 | -#else | |
| 2069 | -static CharDriverState *qemu_chr_open_pty(void) | |
| 2070 | -{ | |
| 2071 | - return NULL; | |
| 2072 | -} | |
| 2073 | -#endif | |
| 2074 | - | |
| 2075 | -#endif /* !defined(_WIN32) */ | |
| 2078 | +#else /* _WIN32 */ | |
| 2076 | 2079 | |
| 2077 | -#ifdef _WIN32 | |
| 2078 | 2080 | typedef struct { |
| 2079 | 2081 | int max_size; |
| 2080 | 2082 | HANDLE hcom, hrecv, hsend; |
| ... | ... | @@ -2440,7 +2442,7 @@ static CharDriverState *qemu_chr_open_win_file_out(const char *file_out) |
| 2440 | 2442 | |
| 2441 | 2443 | return qemu_chr_open_win_file(fd_out); |
| 2442 | 2444 | } |
| 2443 | -#endif | |
| 2445 | +#endif /* !_WIN32 */ | |
| 2444 | 2446 | |
| 2445 | 2447 | /***********************************************************/ |
| 2446 | 2448 | /* UDP Net console */ |
| ... | ... | @@ -2954,16 +2956,15 @@ CharDriverState *qemu_chr_open(const char *filename) |
| 2954 | 2956 | } else if (!strcmp(filename, "stdio")) { |
| 2955 | 2957 | return qemu_chr_open_stdio(); |
| 2956 | 2958 | } else |
| 2957 | -#endif | |
| 2958 | 2959 | #if defined(__linux__) |
| 2959 | 2960 | if (strstart(filename, "/dev/parport", NULL)) { |
| 2960 | 2961 | return qemu_chr_open_pp(filename); |
| 2961 | 2962 | } else |
| 2963 | +#endif | |
| 2962 | 2964 | if (strstart(filename, "/dev/", NULL)) { |
| 2963 | 2965 | return qemu_chr_open_tty(filename); |
| 2964 | 2966 | } else |
| 2965 | -#endif | |
| 2966 | -#ifdef _WIN32 | |
| 2967 | +#else /* !_WIN32 */ | |
| 2967 | 2968 | if (strstart(filename, "COM", NULL)) { |
| 2968 | 2969 | return qemu_chr_open_win(filename); |
| 2969 | 2970 | } else | ... | ... |