mirror of
https://github.com/mii443/qemu.git
synced 2025-12-09 14:08:32 +00:00
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>
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user