History | View | Annotate | Download (77.1 kB)
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_read() -> qemu_chr_be_write()
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()
char: rename qemu_chr_write() -> qemu_chr_fe_write()
char: rename qemu_chr_printf() -> qemu_chr_fe_printf()
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Wrap recv to avoid warnings
Avoid warnings like these by wrapping recv(): CC slirp/ip_icmp.o/src/qemu/slirp/ip_icmp.c: In function 'icmp_receive':/src/qemu/slirp/ip_icmp.c:418:5: error: passing argument 2 of 'recv' from incompatible pointer type [-Werror]...
Fix chrdev return value conversion
6e1db57b2ac9025c2443c665a0d9e78748637b26 didn'tconvert brlapi or win32 chrdevs, breaking build for those.
Fix by converting the chrdevs.
Acked-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Introduce a 'client_add' monitor command accepting an open FD
Allow client connections for VNC and socket based characterdevices to be passed in over the monitor using SCM_RIGHTS.
One intended usage scenario is to start QEMU with VNC on aUNIX domain socket. An unprivileged user which cannot access...
qemu-char: Print strerror message on failure
The only way for chardev drivers to communicate an error was to return a NULLpointer, which resulted in an error message that said that something wentwrong, but not why.
This patch changes the interface to return 0/-errno and updates...
Fix compilation warning due to missing header for sigaction (followup)
This patch removes all references to signal.h when qemu-common.h is includedas they become redundant.
Signed-off-by: Alexandre Raymond <cerbere@gmail.com>Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
char: Detect chardev release by NULL handlers as well as NULL opaque
Juan says he prefers these extra checks to ensure a user of a chardev isreleasing it.
Requested-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>
char: Allow devices to use a single multiplexed chardev.
This fixes regression caused by commit2d6c1ef40f3678ab47a4d14fb5dadaa486bfcda6("char: Prevent multiple devices opening same chardev"):
-nodefaults -nographic -chardev stdio,id=stdio,mux=on,signal=off \...
chardev: Allow frontends to notify backends of guest open / close
Some frontends know when the guest has opened the "channel" and is activelylistening to it, for example virtio-serial. This patch adds 2 new qemu-chardevfunctions which can be used by frontends to signal guest open / close, and...
Merge remote branch 'amit/for-anthony' into staging
char: Prevent multiple devices opening same chardev
Prevent:
-chardev socket,path=/tmp/foo,server,nowait,id=c0 \-device virtserialport,chardev=c0,id=vs0 \-device virtserialport,chardev=c0,id=vs1
Reported-by: Mike Cao <bcao@redhat.com>Signed-off-by: Amit Shah <amit.shah@redhat.com>
change all rt_clock references to use millisecond resolution accessors
This was done with:
sed -i '/get_clock\>.*rt_clock/s/get_clock\>/get_clock_ms/' \ $(git grep -l 'get_clock\>.*rt_clock' ) sed -i '/new_timer\>.*rt_clock/s/new_timer\>/new_timer_ms/' \...
Fix conversions from pointer to int and vice versa
Here the int values fds0, sigfd, s, sock and fd are convertedto void pointers which are later converted back to an int value.
These conversions should always use intptr_t instead of unsigned long.
They are needed for environments where sizeof(long) != sizeof(void *)....
qemu-char: Check for missing backend name
Check if the backend option is missing before searching the backendtable. This fixes a NULL pointer dereference when QEMU is invoked withthe following invalid command-line:
$ qemu -chardev id=foo,path=/tmp/socket...
fix QemuOpts leak
Now that no backend's open function saves the passed QemuOpts, fix a leakin the qemu_chr_open backwards-compatible parser.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
remove broken code for tty
This code is taking the settings for a serial port and moving it tofd 0 when qemu exits. This is likely just cut-and-paste, rip it.
add qemu_chr_set_echo
move atexit(term_exit) and O_NONBLOCK to qemu_chr_open_stdio
In the next patch, term_init will be changed to enable or disableecho at will. Move extraneous stuff out of it.
add set_echo implementation for qemu_chr_stdio
This also requires moving QemuOpts out of term_init.
Clearing ISIG is independent of whether echo is enabled or disabled.
spice: add chardev (v5)
Adding a chardev backend for spice, where spice determines whatto do with it based on the name attribute given during chardev creation.For usage by spice vdagent in conjunction with a properly namedvirtio-serial device, and future smartcard channel usage....
qemu-char: Introduce Memory driver
This driver handles in-memory chardev operations. That's, all writesto this driver are stored in an internal buffer and it doesn't talkto the external world in any way.
Right now it's very simple: it supports only writes. But it can be...
Fold send_all() wrapper unix_write() into one function
The current send_all() wrapper for POSIX calls does nothing but callunix_write(). Merge them to simplify the code.
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
QemuOpts: make most qemu_*_opts static
Switch tree to lookup-by-name using qemu_find_opts().Also hook up virtfs options so qemu_find_opts works for them too.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Fix mingw32 build
Don't define qemu_chr_open_eventfd() on Windows.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
RESEND: Inter-VM shared memory PCI device
resend for bug fix related to removal of irqfd
Support an inter-vm shared memory device that maps a shared-memory object as aPCI device in the guest. This patch also supports interrupts between guest bycommunicating over a unix domain socket. This patch applies to the qemu-kvm...
block: Decouple block device "commit all" from DriveInfo
do_commit() and mux_proc_byte() iterate over the list of drivesdefined with drive_init(). This misses host block devices defined byother means. Such means don't exist now, but will be introduced later...
blockdev: Collect block device code in new blockdev.c
Anything that moves hundreds of lines out of vl.c can't be all bad.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Monitor: Drop QMP documentation from code
Previous commit added QMP documentation to the qemu-monitor.hxfile, it's is a copy of this information.
While it's good to keep it near code, maintaining two copies ofthe same information is too hard and has little benefit as we...
stash away SCM_RIGHTS fd until a getfd command arrives
If there is already a fd in s->msgfd before recvmsg it isclosed by parts that this patch does not touch. So, onlyone descriptor can be "leaked" by attaching it to a commandother than getfd.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
Always notify consumers of char devices if they're open
When using virtio-console on s390, the input doesn't work.
The root of the problem is rather simple. What happens is the following:
1) create character device for stdio 2) char device is done creating, sends OPENED event...
fix function signature of qemu_chr_open_pty on !linux
Signed-off-By: Riku Voipio <riku.voipio@nokia.com>Signed-off-By: Juha Riihimäki <juha.riihimaki@nokia.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Restore terminal monitor attributes - addition
Patch 2d753894c7553d6a05e8fdbed5f4704398919a35 was missing this check,when running monitor as /dev/tty and other serial device, i.e: qemu -monitor /dev/tty -serial /dev/pts/1
Without this patch any serial device will override the monitor stored...
Fix some compilation warnings on FreeBSD hosts
Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Revert "Convert atexit users to exit_notifier"
This reverts commit d7234f4d7e373a708e1df9ab565a71b71b189025.
Conflicts:
hw/xen_machine_pv.c
This should have never been committed.
Convert atexit users to exit_notifier
All of these users have global state so we really don't see a benefit fromexit_notifier. However, using exit_notifier means that there's one lessjustification for having global state in the first place.
rename IOCanRWHandler to IOCanReadHandler
It was always only used for reads
Signed-off-by: Juan Quintela <quintela@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Fix corner case in chardev udp: parameter
The missing '' broke 'udp::<port>:<port>' parsing.
' broke 'udp::<port>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Restore terminal attributes for tty based monitor
Patch http://permalink.gmane.org/gmane.comp.emulators.qemu/63472 handleclose when using tty devices (like /dev/ttyS0),yet tty based monitor are not restoring terminal attributes (as donewith stdio based monitor), when closing qemu after that command:...
qemu-char.c: drop debug printfs from qemu_chr_parse_compat
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>Acked-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
add close callback for tty-based char device
v1 -> v2 coding style changes
Add a tty close callback. Right now if a guest device that is connectedto a tty-based chardev in the host is removed, the tty is not closed.With this patch it is closed.
Example use case is connecting an emulated USB serial cable in the guest...
Do not ignore error, if open file failed (-serial /dev/tty)
In case, when qemu is executed with option like-serial /dev/ttyS0, report if there are problems withopening of devices. At now errors are silently ignoring.
Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru>...
char: Remove redundant qemu_chr_generic_open() call.
qemu_chr_open_fd() calls qemu_chr_generic_open(),so qemu_chr_open_tty() doesn't need to call it.
Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
char: Convert qemu_chr_info() to QObject
Each device is represented by a QDict. The returned QObject is a QListof all devices.
This commit should not change user output.
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
un-static qemu_chr_parse_compat()