History | View | Annotate | Download (93 kB)
qemu-char: fix win32 build
96c6384776d631839a9c8fe02bf135f9ba22586c did not adjustWin32 #ifdeffery properly, breaking build in later commits. Fix.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>Tested-by: Igor Mitsyanko <i.mitsyanko@gmail.com>Message-id: 0ba5565b1ed44380c57d4a5fab86e9549f581ebf.1362822910.git.blauwirbel@gmail.com...
qemu-char: move baum registration to baum.c
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 1b24baa1ec3a174d5cad31e079d829904b53077b.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: move msmouse registeration to msmouse.c
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: b47d1153b0d7669743c9a6bb98ce30f4cf7f876b.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: move text console init to console.c
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 17cefde0a8d7807294bab95e93c3328a20d3f2ed.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: add watch support
This allows a front-end to request for a callback when the backendis writable again.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 96f93c0f741064604bbb6389ce962191120af8b7.1362505276.git.amit.shah@redhat.com...
qemu-char: add pty watch
This lets ptys support adding front end watchs.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 23380f37b22d407ba0b9e080f6ea0d66b279f2d2.1362505276.git.amit.shah@redhat.com...
char: add gio watch fn for tcp backends
Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: b50e668c4f4146a654c5d4412440eb9e589f2c02.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: use a glib timeout instead of qemu-timer
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 05a883ce5a98275b976bf0124610599859c2b7da.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: remove use of QEMUTimer in favor of glib idle function
qemu-char is now independent of the QEMU main loop.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 3cda0bbcfb94912df8a767983a52bb71a4a3231d.1362505276.git.amit.shah@redhat.com...
qemu-char: make char drivers dynamically registerable
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 0ff4f5f2b8b7afdb85a0c241403ad73f472f0b81.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: move spice registration to spice-qemu-char.c
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 49a8d12eeb117e5530b2fab02af7681b54f9245c.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: tcp: make use GIOChannel
I didn't bother switching to g_io_channel_read/write because we need to usesendmsg on Unix. No problem though since we're using an unbuffered channel.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>...
qemu-char: convert fd_chr to use a GIOChannel
This uses the newly introduced IOWatchPoll source.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 0cb5d14510ee835a0ebc23676d10a2cce9280da5.1362505276.git.amit.shah@redhat.com...
qemu-char: convert pty to GIOChannel
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 339eebf3c59a450b0354056e9ac4b41f67230831.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: convert UDP to GIOChannel
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>Message-id: 775a2bd666a3d1fa008656bf97191b7573c6ffb5.1362505276.git.amit.shah@redhat.comSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: remove dead/confusing logic with nb_stdio_clients
This code is very old dating back to 2007. What is puzzling is thatSTDIO_MAX_CLIENTS was always #define to 1 meaning that all of the code to dealwith more than one client was unreachable.
Just remove the whole mess of it....
char: add IOWatchPoll support
This is a special GSource that supports CharDriverState stylepoll callbacks.
For reviewability and bisectability, this code is #if 0'd out in thispatch to avoid unused warnings since all of the functions are static.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>...
move socket_set_nodelay to osdep.c
Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
console: allow VCs to be overridden by UI
We want to expose VCs using a VteTerminal widget. We need access to provide ourown CharDriverState in order to do this.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Message-id: 1361367806-4599-3-git-send-email-aliguori@us.ibm.com
qapi: Flatten away ChardevPort
Simplifies the schema and the code.
QMP command
{ "execute" : "chardev-add", "arguments" : { "id" : "ser0", "backend" : { "type" : "port", "data" : { "type": "serial",...
error: Strip trailing '\n' from error string arguments (again)
Commit 6daf194d and be62a2eb got rid of a bunch, but they keep comingback. Tracked down with this Coccinelle semantic patch:
r expression err, eno, cls, fmt; position p; @@ (...
r
qmp: Drop wasteful zero-initialization in qmp_memchar_read()
Signed-off-by: Markus Armbruster <armbru@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: Fix chardev "memory" not to drop IAC characters
Undocumented misfeature, get rid of it while we can.
qemu-char: Drop undocumented chardev "memory" compatibility syntax
This is a new device, so there's no compatibility to maintain, and itsuse case isn't common enough to justify shorthand syntax.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>...
qemu-char: General chardev "memory" code cleanup
Inline trivial cirmem_chr_is_empty() into its only caller.
Rename qemu_chr_cirmem_count() to cirmem_count().
Fast ring buffer index wraparound. Without this, there's no point inrestricting size to a power two....
qemu-char: Saner naming of memchar stuff & doc fixes
New device, has never been released, so we can still improve thingswithout worrying about compatibility.
Naming is a mess. The code calls the device driver CirMemCharDriver,the public API calls it "memory", "memchardev", or "memchar", and the...
qemu-char: Support suffixed ringbuf size arguments like "size=64K"
qmp: Plug memory leaks in memchar-write, memchar-read
qmp: Drop superfluous special case "empty" in qmp_memchar_read()
qmp: Fix design bug and read beyond buffer in memchar-write
Command memchar-write takes data and size parameter. Begs thequestion what happens when data doesn't match size.
With format base64, qmp_memchar_write() copies the full data argument,regardless of size argument....
qmp: Clean up design of memchar-read
The data returned has a well-defined size, which makes the sizereturned along with it redundant at best. Drop it.
qmp: Use generic errors in memchar-read, memchar-write
New errors should be generic unless there's a real use case for richerrors.
qmp: Clean up type usage in qmp_memchar_write(), qmp_memchar_read()
Const-correctness, consistently use standard C types instead of mixingthem with GLib types.
Merge remote-tracking branch 'luiz/queue/qmp' into staging
qemu-char: Avoid unused variable warning in some configs
Avoid unused variable warnings:qemu-char.c: In function 'qmp_chardev_open_port':qemu-char.c:3132: warning: unused variable 'fd'qemu-char.c:3132: warning: unused variable 'flags'
in configurations with neither HAVE_CHARDEV_TTY nor...
QAPI: Introduce memchar-read QMP command
Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
qemu-char: Add new char backend CirMemCharDriver
QAPI: Introduce memchar-write QMP command
chardev: add qmp hotplug commands, with null chardev support
Add chardev-add and chardev-remove qmp commands. Hotplugginga null chardev is supported for now, more will be added later.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
chardev: add file chardev support to chardev-add (qmp)
Add support for file chardevs. Output file is mandatory,input file is optional.
chardev: add serial chardev support to chardev-add (qmp)
Similar to file, except that no separate in/out files are supportedbecause it's pointless for direct device access. Also the specialtty ioctl hooks (pass through linespeed settings etc) are activated...
chardev: add parallel chardev support to chardev-add (qmp)
Also alias the old parport name to parallel for -chardev.
chardev: add socket chardev support to chardev-add (qmp)
qemu_chr_open_socket is split into two functions. All initializationafter creating the socket file handler is split away into the newqemu_chr_open_socket_fd function.
chr->filename doesn't get filled from QemuOpts any more. Qemu gathers...
chardev: add pty chardev support to chardev-add (qmp)
The ptsname is returned directly, so there is no need touse query-chardev to figure the pty device path.
chardev: add error reporting for qemu_chr_new_from_opts
chardev: fix QemuOpts lifecycle
qemu_chr_new_from_opts handles QemuOpts release now, so callers don'thave to worry. It will either be saved in CharDriverState, thenreleased in qemu_chr_delete, or in the error case released instantly.
chardev: reduce chardev ifdef mess a bit
qemu-option: move standard option definitions out of qemu-config.c
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
pty: unbreak libvirt
Commit 586502189edf9fd0f89a83de96717a2ea826fdb0 breaks libvirt ptysupport because it tried to figure the pts name from stderr output.
Fix this by moving the label to the end of the line, this way thelibvirt parser does still recognise the message. libvirt looks...
disallow -daemonize usage of stdio (curses display, -nographic, -serial stdio etc)
Curses display requires stdin/out to stay on the terminal,so -daemonize makes no sense in this case. Instead ofleaving display uninitialized like is done since 995ee2bf469de6bb,...
qemu-char: Inherit ptys and improve output from -serial pty
Changes since V1: - Avoid crashing since qemu_opts_id() may return null on some systems according to Markus's suggestion.
When controlling a qemu instance from another program, it'shard to know which serial port or monitor device is redirected...
Merge remote-tracking branch 'bonzini/header-dirs' into staging
softmmu: move remaining include files to include/ subdirectories
softmmu: move include files to include/sysemu/
misc: move include files to include/qemu/
monitor: move include files to include/monitor/
ui: move files to ui/ and include/ui/
net: do not include net.h everywhere
spice-qemu-char: add spiceport chardev
Add a new spice chardev to allow arbitrary communication between thehost and the Spice client via the spice server.
Examples:
This allows the Spice client to have a special port for the qemumonitor:
... -chardev spiceport,name=org.qemu.monitor,id=monitorport...
chardev: Use real-time clock for open timer
The vm clock may be stopped, and then we won't get open events anymore.Seen with QMP sessions.
Reported-by: Dietmar Maurer <dietmar@proxmox.com>Tested-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>...
chardev: Use timer instead of bottom-half to postpone open event
As the block layer may decide to flush bottom-halfs while the machine isstill initializing (e.g. to read geometry data from the disk), ourpostponed open event may be processed before the last frontend...
qemu-sockets: add error propagation to inet_dgram_opts
Before:
$ qemu-system-x86_64 -monitor udp:localhost:631@localhost:631 inet_dgram_opts: bind(ipv4,127.0.0.1,631): OK inet_dgram_opts failed chardev: opening backend "udp" failed
After:...
qemu-char: ask and print error information from qemu-sockets
$ qemu-system-x86_64 -monitor tcp:localhost:6000 (starts despite error)
$ qemu-system-x86_64 -monitor tcp:foo.bar:12345 getaddrinfo(foo.bar,12345): Name or service not known...
qemu-sockets: add Error ** to all functions
This lets me adjust the clients to do proper error propagation first,thus avoiding temporary regressions in the quality of the error messages.
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qemu-sockets: add nonblocking connect for Unix sockets
This patch mostly mimics what was done to TCP sockets, but simplerbecause there is only one address to try. It also includes a free EINTRbug fix.
Fix address handling in inet_nonblocking_connect
getaddrinfo can give us a list of addresses, but we only try toconnect to the first one. If that fails we never proceed tothe next one. This is common on desktop setups that often have ipv6configured but not actually working....
Separate inet_connect into inet_connect (blocking) and inet_nonblocking_connect
No need to add non blocking parameters to the blocking inet_connectadd block parameter for inet_connect_opts instead of using QemuOpt "block".
Signed-off-by: Orit Wasserman <owasserm@redhat.com>...
Revert 455aa1e08 and c3767ed0eb
commit c3767ed0eb5d0bb25fe409ae5dec06e3411ff1b6 qemu-char: (Re-)connect for tcp_chr_write() unconnected writing
Has no hope of working because tcp_chr_connect() does not actually connect.
455aa1e08 just fixes the SEGV with server() but the attempt to connect a client...
qemu-char: BUGFIX, don't call FD_ISSET with negative fd
tcp_chr_connect(), unlike for example udp_chr_update_read_handler() doesnot check if the fd it is using is valid (>= 0) before passing it toqemu_set_fd_handler2(). If using e.g. a TCP serial port, which is not...
socket: don't attempt to reconnect a TCP socket in server mode
Commit c3767ed0eb5d0bb25fe409ae5dec06e3411ff1b6 introduced a possible SEGV whenusing a socket chardev with server=on because it assumes that all TCP socketsare in client mode.
This patch adds a check to only reconnect when in client mode....
qemu-char: (Re-)connect for tcp_chr_write() unconnected writing
tcp_chr_write() did not deal with writing to an unconnectedconnection and return the original length of the data, it'snot right and would cause false writing. So (re-)connect itand return 0 for this situation....
qemu-char: Add MSG_CMSG_CLOEXEC flag to recvmsg
Set the close-on-exec flag for the file descriptor receivedvia SCM_RIGHTS.
Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
net: inet_connect(), inet_connect_opts(): add in_progress argument
It's used to indicate the special case where a valid file-descriptoris returned (ie. success) but the connection can't be completedw/o blocking.
This is needed because QERR_SOCKET_CONNECT_IN_PROGRESS is not...
do not include <libutil.h> needlessly or if it doesn't exist
<libutil.h> and <util.h> on *BSD (some have one, some another)were #included just for openpty() declaration. The only filewhere this function is actually used is qemu-char.c.
In vl.c and net/tap-bsd.c, none of functions declared in libutil.h...
qemu-option: qemu_opts_create(): use error_set()
This commit converts qemu_opts_create() from qerror_report() toerror_set().
Currently, most calls to qemu_opts_create() can't fail, so mostcallers don't need any changes.
The two cases where code checks for qemu_opts_create() erros are:...
sockets: change inet_connect() to support nonblock socket
Add a bool argument to inet_connect() to assign if set socketto block/nonblock, and delete original argument 'socktype'that is unused.Add a new argument to inet_connect()/inet_connect_opts(),to pass back connect error by error class....
sockets: use error class to pass listen error
Add a new argument in inet_listen()/inet_listen_opts()to pass back listen error.
Change nbd, qemu-char, vnc to use new interface.
Signed-off-by: Amos Kong <akong@redhat.com>Reviewed-by: Orit Wasserman <owasserm@redhat.com>...
qemu-char: Fix crash when switching consoles
qemu-system-arm (and other system emulations) crashes with SDL whenthe user switches consoles (Alt-Ctrl-F4).
We already check for NULL pointers in qemu_chr_fe_ioctl,qemu_chr_be_can_write and other functions, so do this also...
Kick io-thread on qemu_chr_accept_input
Once a chr frontend is able to receive input again, we need to informthe io-thread about this fact. Otherwise, main_loop_wait may continue toselect without the related backend file descriptor in its set. This can...
qemu-char: Use qemu_open() to avoid leaking fds to children
Fixed silently in commit aad04cd0, but that just got reverted.Re-apply the fixes, plus one missed instance: parport on Linux.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Markus Armbruster <armbru@redhat.com>...
qemu-char: Re-apply style fixes from just reverted aad04cd0
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: qemu_chr_open_fd() can't fail, don't check
Cleaned up silently in commit aad04cd0, but that just got reverted.Re-apply this part.
Revert "qemu-char: Print strerror message on failure" and deps
The commit's purpose is laudable:
The only way for chardev drivers to communicate an error was to return a NULL pointer, which resulted in an error message that said that something went wrong, but not why....
qdev: nuke qdev_init_chardev()
I'm sure the intentions were good here, but there's no reason this should be inqdev. Move it to qemu-char where it belongs.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qemu-char: rename qemu_chr_event to qemu_chr_be_event and make it public
Rename qemu_chr_event to qemu_chr_be_event, since it is only to becalled by backends and make it public so that it can be used by chardevcode which lives outside of qemu-char.c
Signed-off-by: Hans de Goede <hdegoede@redhat.com>...
qemu-char: Plug memory leak on qemu_chr_open_pty() error path
Spotted by Coverity.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Add stdio char device on windows
Simple implementation of an stdio char device on Windows.
Signed-off-by: Fabien Chouteau <chouteau@adacore.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
qemu-char: Fix use of free() instead of g_free()
cppcheck reported these errors:
qemu-char.c:1667: error: Mismatching allocation and deallocation: sqemu-char.c:1668: error: Mismatching allocation and deallocation: chrqemu-char.c:1769: error: Mismatching allocation and deallocation: s...
qapi: Convert query-chardev
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>Tested-by: Michael Roth <mdroth@linux.vnet.ibm.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
qemu-char: use qemu_set_fd_handler/2 consistently
Now that qemu_set_fd_handler and qemu_set_fd_handler2 have differentimplementations, one using qemu iohandlers and the other glib, it is notsafe to mix the two when inserting/deleting handlers.
Fixes kvm-autotest....
char: rename qemu_chr_get_msgfd() -> qemu_chr_fe_get_msgfd()
char: remove qemu_chr_send_event()
It's dead code.
char: rename qemu_chr_open() -> qemu_chr_new()
char: qemu_chr_open_opts() -> qemu_chr_new_from_opts()
char: rename qemu_chr_close() -> qemu_chr_delete()
char: qemu_chr_ioctl() -> qemu_chr_fe_ioctl()
char: rename qemu_chr_set_echo() -> qemu_chr_fe_set_echo()
char: rename qemu_chr_can_read() -> qemu_chr_be_can_read()
char: rename qemu_chr_guest_open() -> qemu_chr_fe_open()
char: rename qemu_chr_guest_close() -> qemu_chr_fe_close()