From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Un3Ei-0000fj-RT for qemu-devel@nongnu.org; Thu, 13 Jun 2013 04:50:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Un3Ee-0006W7-U5 for qemu-devel@nongnu.org; Thu, 13 Jun 2013 04:50:28 -0400 Received: from mout.web.de ([212.227.15.14]:51348) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Un3Ee-0006VL-K7 for qemu-devel@nongnu.org; Thu, 13 Jun 2013 04:50:24 -0400 Message-ID: <51B987BB.4090600@web.de> Date: Thu, 13 Jun 2013 10:50:03 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1370445949-6666-1-git-send-email-mjt@msgid.tls.msk.ru> In-Reply-To: <1370445949-6666-1-git-send-email-mjt@msgid.tls.msk.ru> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v2] create qemu_openpty_raw() helper function and move it to a separate file List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Tokarev Cc: Paolo Bonzini , Anthony Liguori , qemu-devel@nongnu.org, Brad Smith Am 05.06.2013 17:25, 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 , > and other rather specific system headers out of qemu-common.h, > which isn't a place for such specific headers really. > > Signed-off-by: Michael Tokarev > --- > Changes since v1: > > - added a forgotten #include 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. > > And one extra comment. I especially took existing > code and used it almost unmodified, to have one > code moving change, with all other possible > improvements/cleanups to follow later. > > 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 Git complains about a trailing white line in the new file. And unfortunately it doesn't build as-is: CC util/qemu-openpty.o /home/andreas/QEMU/qemu/util/qemu-openpty.c:54: warning: ‘struct winsize’ declared inside parameter list /home/andreas/QEMU/qemu/util/qemu-openpty.c:54: warning: its scope is only this definition or declaration, which is probably not what you want /home/andreas/QEMU/qemu/util/qemu-openpty.c:54: warning: ‘struct termios’ declared inside parameter list /home/andreas/QEMU/qemu/util/qemu-openpty.c: In function ‘openpty’: /home/andreas/QEMU/qemu/util/qemu-openpty.c:75: warning: implicit declaration of function ‘tcgetattr’ /home/andreas/QEMU/qemu/util/qemu-openpty.c:75: warning: nested extern declaration of ‘tcgetattr’ /home/andreas/QEMU/qemu/util/qemu-openpty.c:83: error: ‘TIOCSWINSZ’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:83: error: (Each undeclared identifier is reported only once /home/andreas/QEMU/qemu/util/qemu-openpty.c:83: error: for each function it appears in.) /home/andreas/QEMU/qemu/util/qemu-openpty.c: At top level: /home/andreas/QEMU/qemu/util/qemu-openpty.c:94: warning: ‘struct termios’ declared inside parameter list /home/andreas/QEMU/qemu/util/qemu-openpty.c: In function ‘cfmakeraw’: /home/andreas/QEMU/qemu/util/qemu-openpty.c:96: error: dereferencing pointer to incomplete type /home/andreas/QEMU/qemu/util/qemu-openpty.c:97: error: ‘IGNBRK’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:97: error: ‘BRKINT’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:97: error: ‘PARMRK’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:97: error: ‘ISTRIP’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:97: error: ‘INLCR’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:97: error: ‘IGNCR’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:97: error: ‘ICRNL’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:97: error: ‘IXON’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:98: error: dereferencing pointer to incomplete type /home/andreas/QEMU/qemu/util/qemu-openpty.c:98: error: ‘OPOST’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:99: error: dereferencing pointer to incomplete type /home/andreas/QEMU/qemu/util/qemu-openpty.c:99: error: ‘ECHO’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:99: error: ‘ECHONL’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:99: error: ‘ICANON’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:99: error: ‘ISIG’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:99: error: ‘IEXTEN’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:100: error: dereferencing pointer to incomplete type /home/andreas/QEMU/qemu/util/qemu-openpty.c:100: error: ‘CSIZE’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:100: error: ‘PARENB’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:101: error: dereferencing pointer to incomplete type /home/andreas/QEMU/qemu/util/qemu-openpty.c:101: error: ‘CS8’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:103: error: dereferencing pointer to incomplete type /home/andreas/QEMU/qemu/util/qemu-openpty.c:103: error: ‘VMIN’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:104: error: dereferencing pointer to incomplete type /home/andreas/QEMU/qemu/util/qemu-openpty.c:104: error: ‘VTIME’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c: In function ‘qemu_openpty_raw’: /home/andreas/QEMU/qemu/util/qemu-openpty.c:111: error: storage size of ‘tty’ isn’t known /home/andreas/QEMU/qemu/util/qemu-openpty.c:127: warning: implicit declaration of function ‘tcsetattr’ /home/andreas/QEMU/qemu/util/qemu-openpty.c:127: warning: nested extern declaration of ‘tcsetattr’ /home/andreas/QEMU/qemu/util/qemu-openpty.c:127: error: ‘TCSAFLUSH’ undeclared (first use in this function) /home/andreas/QEMU/qemu/util/qemu-openpty.c:111: warning: unused variable ‘tty’ make: *** [util/qemu-openpty.o] Fehler 1 Unfortunately don't have time right now to investigate further. Andreas