summaryrefslogtreecommitdiffstats
path: root/qemu-char.c
Commit message (Collapse)AuthorAgeFilesLines
* char: Emit 'CLOSED' events on char device closeAmit Shah2009-08-241-0/+10
| | | | | | | | Notify users of the char interface whenever the file / connection is closed. Signed-off-by: Amit Shah <amit.shah@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* More NULL pointer fixesBlue Swirl2009-08-011-2/+2
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Fix typo WIN32 -> _WIN32Anthony Liguori2009-07-271-1/+1
| | | | | | This was spotted by Juan Quintela Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* rename HOST_BSD to CONFIG_BSDJuan Quintela2009-07-271-1/+1
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* kill drives_tableGerd Hoffmann2009-07-271-3/+3
| | | | | | | | | | | | | | First step cleaning up the drives handling. This one does nothing but removing drives_table[], still it became seriously big. drive_get_index() is gone and is replaced by drives_get() which hands out DriveInfo pointers instead of a table index. This needs adaption in *tons* of places all over. The drives are now maintained as linked list. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add SCM_RIGHTS support to unix socket character devicesMark McLoughlin2009-07-271-1/+54
| | | | | | | | | | | If a file descriptor is passed via a message with SCM_RIGHTS ancillary data on a unix socket, store the file descriptor for use in the chr_read() handler. Close the file descriptor if it was not used. The qemu_chr_get_msgfd() API provides access to the passed descriptor. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Make tcp_chr_read() use recvmsg()Mark McLoughlin2009-07-271-1/+24
| | | | | | | | | Split out tcp_chr_recv() out of tcp_chr_read() and implement it on non-win32 using recvmsg(). This is needed for a subsequent patch which implements SCM_RIGHTS support. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* mux-term: Fix timestamp associationJan Kiszka2009-06-161-3/+9
| | | | | | | | So far a new timestamp was generated *after* a full line had been printed. Fix this. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* mux-term: Localize timestampsJan Kiszka2009-06-161-10/+10
| | | | | | | | As we can have multiple multiplexed terminals, timestamp control and tracking should better take place per MuxDriver. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Win32: Don't remove const attribute in type casts.Stefan Weil2009-06-131-1/+1
| | | | | | | | | Type casts removing the const attribute are bad because they hide the fact that the argument remains const. They also result in a compiler warning (at least with MS-C). Signed-off-by: Stefan Weil <weil@mail.berlios.de>
* Fix mingw32 build warningsBlue Swirl2009-06-131-3/+3
| | | | | | | | Work around buffer and ioctlsocket argument type signedness problems Suppress a prototype which is unused on mingw32 Expand a macro to avoid warnings from some GCC versions Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Refactor how display drivers are selectedAnthony Liguori2009-05-211-3/+3
| | | | | | | | | | | My previous commit, f92f8afebe, broke -vnc (spotted by Glauber Costa). This is because it's necessary to tell when the no special display parameters have been passed and default to SDL or VNC appropriately. This refactors the display selection logic to be less complicated which has the effect of fixing the regression mentioned above. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix OpenSolaris gcc4 warnings: iovec type mismatches, missing 'static'blueswir12009-04-131-3/+3
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7103 c046a42c-6fe2-441c-8c8c-71466251a162
* char: Fix closing of various char devices (Jan Kiszka)aliguori2009-03-281-2/+19
| | | | | | | | | | | | | | This patch fixes several issues around closing char devices. Affected were pty (timer was left behind, even running), udp (no close handling at all) and tcp (missing async IO handler cleanup). The bugs either caused segfaults or stalled the qemu process. So far, hot-unplugging USB serial adapters suffered from this. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6911 c046a42c-6fe2-441c-8c8c-71466251a162
* Rename _BSD to HOST_BSD so that it's more obvious that it's defined by configureblueswir12009-03-081-1/+1
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6775 c046a42c-6fe2-441c-8c8c-71466251a162
* Support for DragonFly BSD (Hasso Tepper)blueswir12009-03-071-5/+9
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6746 c046a42c-6fe2-441c-8c8c-71466251a162
* monitor: Introduce MONITOR_USE_READLINE flag (Jan Kiszka)aliguori2009-03-051-1/+1
| | | | | | | | | | | | This allows to create monitor terminals that do not make use of the interactive readline back-end but rather send complete commands. The pass-through monitor interface of the gdbstub will be an example. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6717 c046a42c-6fe2-441c-8c8c-71466251a162
* monitor: Improve mux'ed console experience (Jan Kiszka)aliguori2009-03-051-2/+9
| | | | | | | | | | | | | | | Up to now, you never really knew if you already switched the console after pressing CTRL-A C or if you mistyped it again. This patch clarifies the situation by providing a prompt in a new line and injecting a linebreak when switching away again. For this purpose, the two events CHR_EVENT_MUX_IN and CHR_EVENT_MUX_OUT are introduced and distributed on focus switches. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6716 c046a42c-6fe2-441c-8c8c-71466251a162
* monitor: Decouple terminals (Jan Kiszka)aliguori2009-03-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently all registered (and activate) monitor terminals work in broadcast mode: Everyone sees what someone else types on some other terminal and what the monitor reports back. This model is broken when you have a management monitor terminal that is automatically operated and some other terminal used for independent guest inspection. Such additional terminals can be multiplexed device channels or a gdb frontend connected to QEMU's stub. Therefore, this patch decouples the buffers and states of all monitor terminals, allowing the user to operate them independently. It finally starts to use the 'mon' parameter that was introduced earlier with the API rework. It also defines the default monitor: the first instantance that has the MONITOR_IS_DEFAULT flag set, and that is the monitor created via the "-monitor" command line switch (or "vc" if none is given). As the patch requires to rework the monitor suspension interface, it also takes the freedom to make it "truely" suspending (so far suspending meant suppressing the prompt, but inputs were still processed). Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6715 c046a42c-6fe2-441c-8c8c-71466251a162
* monitor: Drop banner hiding (Jan Kiszka)aliguori2009-03-051-1/+1
| | | | | | | | | | | | There is no use for the hide/show banner option, and it is applied inconsistently anyway (or what makes the difference between -serial mon:stdio and -nographic for the monitor?). So drop this mode. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6713 c046a42c-6fe2-441c-8c8c-71466251a162
* monitor: Rework API (Jan Kiszka)aliguori2009-03-051-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor the monitor API and prepare it for decoupled terminals: term_print functions are renamed to monitor_* and all monitor services gain a new parameter (mon) that will once refer to the monitor instance the output is supposed to appear on. However, the argument remains unused for now. All monitor command callbacks are also extended by a mon parameter so that command handlers are able to pass an appropriate reference to monitor output services. For the case that monitor outputs so far happen without clearly identifiable context, the global variable cur_mon is introduced that shall once provide a pointer either to the current active monitor (while processing commands) or to the default one. On the mid or long term, those use case will be obsoleted so that this variable can be removed again. Due to the broad usage of the monitor interface, this patch mostly deals with converting users of the monitor API. A few of them are already extended to pass 'mon' from the command handler further down to internal functions that invoke monitor_printf. At this chance, monitor-related prototypes are moved from console.h to a new monitor.h. The same is done for the readline API. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6711 c046a42c-6fe2-441c-8c8c-71466251a162
* char-mux: Use separate input buffers (Jan Kiszka)aliguori2009-03-051-10/+14
| | | | | | | | | | | | | | | | | | | | Currently, the intermediate input buffer of mux'ed character devices records data across all sub-devices. This has the side effect that we easily leak data recorded over one sub-devices to another once we switch the focus. Avoid data loss and confusion by defining exclusive buffers. Note: In contrast to the original author's claim, the buffering concept still breaks down when the fifo of the currently active sub-device is full. As we cannot accept futher data from this point on without risking to loose it, we will also miss escape sequences, just like without all that buffering. In short: There is no reliable escape sequence handling without infinite buffers or the risk of loosing some data. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6701 c046a42c-6fe2-441c-8c8c-71466251a162
* char: Fix initial reset (Jan Kiszka)aliguori2009-03-051-4/+16
| | | | | | | | | | | | | | | Recent changes to the graphical console initialization broke the initial CHR_EVENT_RESET distribution. The reset BHs generated on char device initialization are now already consumed during machine init (ide init ... -> qemu_aio_wait -> qemu_bh_poll). Therefore, this patch moves the initial qemu_chr_reset calls into a separate funtion which is called after machine init. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6700 c046a42c-6fe2-441c-8c8c-71466251a162
* qemu_chr_open_tcp: allow ipv4 and ipv6 optionsaurel322009-02-091-0/+4
| | | | | | | | | | Those new options are parsed in qemu-sockets.c. Allow them instead of printing "Unknown option". Signed-off-by: Sebastian Herbszt <herbszt@gmx.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6584 c046a42c-6fe2-441c-8c8c-71466251a162
* QEMU Microsoft serial mouse emulationaurel322009-02-081-0/+3
| | | | | | | | | | Adds "msmouse" character device, which emulates a serial mouse. Use it with -serial msmouse. Signed-Off-By: Lubomir Rintel <lkundrak@v3.sk> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6559 c046a42c-6fe2-441c-8c8c-71466251a162
* fix use of host serial portaurel322009-02-081-8/+19
| | | | | | | | Signed-off-by: David Ahern <daahern@cisco.com> Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6556 c046a42c-6fe2-441c-8c8c-71466251a162
* toplevel: remove error handling from qemu_malloc() callers (Avi Kivity)aliguori2009-02-051-59/+0
| | | | | | | | Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6531 c046a42c-6fe2-441c-8c8c-71466251a162
* monitor-mux: fix timestamp prefixes (Jan Kiszka)aliguori2009-01-221-2/+2
| | | | | | | | | | | rt_clock returns milliseconds. Fix mux'ed monitor terminal timestamps accordingly. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6399 c046a42c-6fe2-441c-8c8c-71466251a162
* add an init function parameter to qemu_chr_open()aurel322009-01-181-2/+3
| | | | | | | | | And use it for the malta emulation. Fix segfault introduced in revision 6352. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6365 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix character devices after DisplayState refactoringaliguori2009-01-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The DisplayState refactoring changed the machine init function to create a DisplayState for each VGA device instead of being passed an existing DisplayState. This change is critical to enable multiple graphics device support. Unfortunately, the serial/parallel/console code is structured today to run before machine init to fill out the CharDriverState table which the machine init function uses to determine whether to create the required devices. Since a 'vc' is a type of CharDriverState, the CharDriverState code requires that a DisplayState exist before it runs creating a circular dependency. To fix this, this splits the creation of the initial CharDriverState from the initialization of the text console. We can then in a second step associate a DisplayState with all TextConsoles. This allows us to create the CharDriverState's first, machine init, then associate the TextConsoles with a DisplayState. This code screams for more cleanup. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6352 c046a42c-6fe2-441c-8c8c-71466251a162
* graphical_console_init change (Stefano Stabellini)aliguori2009-01-161-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Patch 5/7 This patch changes the graphical_console_init function to return an allocated DisplayState instead of a QEMUConsole. This patch contains just the graphical_console_init change and few other modifications mainly in console.c and vl.c. It was necessary to move the display frontends (e.g. sdl and vnc) initialization after machine->init in vl.c. This patch does *not* include any required changes to any device, these changes come with the following patches. Patch 6/7 This patch changes the QEMUMachine init functions not to take a DisplayState as an argument because is not needed any more; In few places the graphic hardware initialization function was called only if DisplayState was not NULL, now they are always called. Apart from these cases, the rest are all mechanical substitutions. Patch 7/7 This patch updates the graphic device code to use the new graphical_console_init function. As for the previous patch, in few places graphical_console_init was called only if DisplayState was not NULL, now it is always called. Apart from these cases, the rest are all mechanical substitutions. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6344 c046a42c-6fe2-441c-8c8c-71466251a162
* Make OpenBSD sparc-softmmu compile warning freeblueswir12009-01-141-3/+3
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6299 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix warning from sparseaurel322008-11-301-1/+0
| | | | | | | | | Remove unnecessary declaration for errno (this fixes a warning from sparse) Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5833 c046a42c-6fe2-441c-8c8c-71466251a162
* Native FreeBSD parallel port (Juergen Lock)blueswir12008-11-221-0/+65
| | | | git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5779 c046a42c-6fe2-441c-8c8c-71466251a162
* fix some variable initizalization issues (Stefano Stabellini)aliguori2008-11-121-0/+1
| | | | | | | | | | | this patch fixes two variable initialization issues. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5705 c046a42c-6fe2-441c-8c8c-71466251a162
* sockets: switch over tcp/telnet/unix serial line to new helper functions ↵aliguori2008-11-111-74/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (Gerd Hoffman) This switches the tcp, telnet and unix socket support for character devices (serial/parallel, ...) to the new socket helpers. Thereby they gain IPv6 support and also get ability to search for a free tcp port. Syntax is the same as for vnc, using a to= option, like this: -serial tcp:localhost:5000,to=5099,server This will check the 5000 -> 5099 port range (inclusive) for a free tcp port. Likewise you can get auto-allocated unix sockets by specifying an empty path: -serial unix:,server qemu will create a randomly named socket in $TMPDIR then. tcp also got new "ipv4" and "ipv6" options to make qemu try only the specified internet protocol version. You can use the "info chardev" command added by the first patch in this series to figure the tcp port / unix socket actually allocated. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5697 c046a42c-6fe2-441c-8c8c-71466251a162
* sockets: helper functions for qemu (Gerd Hoffman)aliguori2008-11-111-2/+2
| | | | | | | | | | | | | | | | | | | This patch creates a new source file qemu-sockets.c with a bunch of helper functions to create listening and connected sockets. New features of this code are (a) support for searching for a free port in a given range and (b) support for IPv6. The following patches put that code into use. Compile fixes for Windows added by Anthony Liguori Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5695 c046a42c-6fe2-441c-8c8c-71466251a162
* Fix some build issues for BSD.blueswir12008-11-071-6/+12
| | | | | | | Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5646 c046a42c-6fe2-441c-8c8c-71466251a162
* qemu-char: include hw/baum.haurel322008-11-011-0/+2
| | | | | | | | Fix a warning introduced in r5580 when brlapi is enabled. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5584 c046a42c-6fe2-441c-8c8c-71466251a162
* Remove extraneous inline keyword.aliguori2008-10-311-1/+1
| | | | | | | | | | Spotted by Blue Swirl. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5582 c046a42c-6fe2-441c-8c8c-71466251a162
* Move CharDriverState code out of vl.caliguori2008-10-311-0/+2202
The motivating goal behind this is to allow other tools to use the CharDriver code. This patch is pure code motion except for the Makefile changes and the copyright/header in qemu-char.c. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5580 c046a42c-6fe2-441c-8c8c-71466251a162
OpenPOWER on IntegriCloud