Am 13.06.2013 18:04, schrieb Michael 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 <m...@tls.msk.ru> > --- > Changes since v1: > > - added a forgotten #include <termios.h> for *BSD, > which was recently added into qemu-common.h by > Brad Smith, and which I intended to use in > qemu-openpty.c too, but somehow forgot. > > Changes since v2: > > - verified build on solaris (openindiana) and added > #include <termios.h> there too, > > - removed trailing newline
Tested-by: Andreas Färber <andreas.faer...@web.de> on OpenIndiana 151a. Thanks, Andreas > This is trivial enough to warrant a -trivial tree. > The diffstat below is large because of the comments > in the new file. > > include/qemu-common.h | 15 +----- > qemu-char.c | 77 ++-------------------------- > ui/gtk.c | 12 ++--- > util/Makefile.objs | 2 +- > util/qemu-openpty.c | 135 > +++++++++++++++++++++++++++++++++++++++++++++++++ > 5 files changed, 146 insertions(+), 95 deletions(-) > create mode 100644 util/qemu-openpty.c