aboutsummaryrefslogtreecommitdiff
path: root/util/qemu-openpty.c
AgeCommit message (Collapse)Author
2014-06-11util/qemu-openpty: fix build with musl libc by include termios.h as fallbackNatanael Copa
Include termios.h as POSIX fallback when not glibc, bsd or solaris. POSIX says that termios.h should define struct termios and TCAFLUSH. http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/termios.h.html This fixes the following compile errors with musl libc: util/qemu-openpty.c: In function 'qemu_openpty_raw': util/qemu-openpty.c:112:20: error: storage size of 'tty' isn't known struct termios tty; ^ ... util/qemu-openpty.c:128:24: error: 'TCSAFLUSH' undeclared (first use in this function) tcsetattr(*aslave, TCSAFLUSH, &tty); ^ Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2013-06-14create qemu_openpty_raw() helper function and move it to a separate fileMichael Tokarev
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>