qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <andreas.faerber@web.de>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Anthony Liguori <aliguori@us.ibm.com>,
	qemu-devel@nongnu.org, Brad Smith <brad@comstyle.com>
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	[thread overview]
Message-ID: <51B987BB.4090600@web.de> (raw)
In-Reply-To: <1370445949-6666-1-git-send-email-mjt@msgid.tls.msk.ru>

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 <mjt@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.
> 
> 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

      parent reply	other threads:[~2013-06-13  8:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-05 15:25 [Qemu-devel] [PATCH v2] create qemu_openpty_raw() helper function and move it to a separate file Michael Tokarev
2013-06-07 15:05 ` Brad Smith
2013-06-11 12:57 ` Michael Tokarev
2013-06-12 23:49   ` Brad Smith
2013-06-13  6:57     ` Michael Tokarev
2013-06-13  8:50 ` Andreas Färber [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51B987BB.4090600@web.de \
    --to=andreas.faerber@web.de \
    --cc=aliguori@us.ibm.com \
    --cc=brad@comstyle.com \
    --cc=mjt@tls.msk.ru \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).