[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] create qemu_openpty_raw() helper function an
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH v2] create qemu_openpty_raw() helper function and move it to a separate file |
Date: |
Thu, 13 Jun 2013 10:50:03 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 |
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 <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.
>
> Signed-off-by: Michael Tokarev <address@hidden>
> ---
> 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.
>
> 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