diff options
author | Michael Tokarev <mjt@tls.msk.ru> | 2013-06-05 18:44:54 +0400 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2013-06-14 14:28:43 +0400 |
commit | 4efeabbbe8441cc327052304976c7b9b86309d72 (patch) | |
tree | e6c6b096c593681097bc4025a618f607eef50142 /include/qemu-common.h | |
parent | 520b6dd4d03742e285cc68cca308a2a74261c410 (diff) |
create qemu_openpty_raw() helper function and move it to a separate file
In two places qemu uses openpty() which is very system-dependent,
and in both places the pty is switched to raw mode as well.
Make a wrapper function which does both steps, and move all the
system-dependent complexity into a separate file, together
with static/local implementations of openpty() and cfmakeraw()
from qemu-char.c.
It is in a separate file, not part of oslib-posix.c, because
openpty() often resides in -lutil which is not linked to
every program qemu builds.
This change removes #including of <pty.h>, <termios.h>
and other rather specific system headers out of qemu-common.h,
which isn't a place for such specific headers really.
This version has been verified to build correctly on Linux,
OpenBSD, FreeBSD and OpenIndiana. On the latter it lets qemu
to be built with gtk gui which were not possible there due to
missing openpty() and cfmakeraw().
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Tested-by: Andreas Färber <andreas.faerber@web.de>
Diffstat (limited to 'include/qemu-common.h')
-rw-r--r-- | include/qemu-common.h | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/include/qemu-common.h b/include/qemu-common.h index ed8b6e2005..3c913758c9 100644 --- a/include/qemu-common.h +++ b/include/qemu-common.h @@ -42,19 +42,6 @@ #include <signal.h> #include "glib-compat.h" -#if defined(__GLIBC__) -# include <pty.h> -#elif defined CONFIG_BSD -# include <termios.h> -# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) -# include <libutil.h> -# else -# include <util.h> -# endif -#elif defined CONFIG_SOLARIS -# include <stropts.h> -#endif - #ifdef _WIN32 #include "sysemu/os-win32.h" #endif @@ -235,6 +222,8 @@ ssize_t qemu_recv_full(int fd, void *buf, size_t count, int flags) #ifndef _WIN32 int qemu_pipe(int pipefd[2]); +/* like openpty() but also makes it raw; return master fd */ +int qemu_openpty_raw(int *aslave, char *pty_name); #endif #ifdef _WIN32 |