* [Qemu-devel] [PATCH v2 1/3] xen: fix usage of ENODATA
2014-05-23 15:57 [Qemu-devel] [PATCH v2 0/3] qemu-freebsd: fixes for running Xen guests Roger Pau Monne
@ 2014-05-23 15:57 ` Roger Pau Monne
2014-05-23 15:57 ` [Qemu-devel] [PATCH v2 2/3] tap-bsd: implement a FreeBSD only version of tap_open Roger Pau Monne
2014-05-23 15:57 ` [Qemu-devel] [PATCH v2 3/3] serial: poll the serial console with G_IO_HUP Roger Pau Monne
2 siblings, 0 replies; 12+ messages in thread
From: Roger Pau Monne @ 2014-05-23 15:57 UTC (permalink / raw)
To: qemu-devel, xen-devel; +Cc: Anthony Perard, Stefano Stabellini, Roger Pau Monne
ENODATA doesn't exist on FreeBSD, so ENODATA errors returned by the
hypervisor are translated to ENOENT.
Also, the error code is returned in errno if the call returns -1, so
compare the error code with the value in errno instead of the value
returned by the function.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: xen-devel@lists.xenproject.org
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Anthony Perard <anthony.perard@citrix.com>
---
Changes since v1:
- Define ENODATA to ENOENT for platforms that don't have ENODATA.
---
xen-hvm.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/xen-hvm.c b/xen-hvm.c
index a64486c..a414105 100644
--- a/xen-hvm.c
+++ b/xen-hvm.c
@@ -499,11 +499,14 @@ static void xen_sync_dirty_bitmap(XenIOState *state,
start_addr >> TARGET_PAGE_BITS, npages,
bitmap);
if (rc < 0) {
- if (rc != -ENODATA) {
+#ifndef ENODATA
+#define ENODATA ENOENT
+#endif
+ if (errno == ENODATA) {
memory_region_set_dirty(framebuffer, 0, size);
DPRINTF("xen: track_dirty_vram failed (0x" TARGET_FMT_plx
", 0x" TARGET_FMT_plx "): %s\n",
- start_addr, start_addr + size, strerror(-rc));
+ start_addr, start_addr + size, strerror(errno));
}
return;
}
--
1.7.7.5 (Apple Git-26)
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH v2 2/3] tap-bsd: implement a FreeBSD only version of tap_open
2014-05-23 15:57 [Qemu-devel] [PATCH v2 0/3] qemu-freebsd: fixes for running Xen guests Roger Pau Monne
2014-05-23 15:57 ` [Qemu-devel] [PATCH v2 1/3] xen: fix usage of ENODATA Roger Pau Monne
@ 2014-05-23 15:57 ` Roger Pau Monne
[not found] ` <20140527132943.GD31463@stefanha-thinkpad.redhat.com>
2014-05-23 15:57 ` [Qemu-devel] [PATCH v2 3/3] serial: poll the serial console with G_IO_HUP Roger Pau Monne
2 siblings, 1 reply; 12+ messages in thread
From: Roger Pau Monne @ 2014-05-23 15:57 UTC (permalink / raw)
To: qemu-devel, xen-devel
Cc: Anthony Liguori, Stefano Stabellini, Stefan Hajnoczi,
Roger Pau Monne
The current behaviour of tap_open for BSD systems differ greatly from
it's Linux counterpart. Since FreeBSD supports interface renaming and
tap device cloning by opening /dev/tap, implement a FreeBSD specific
version of tap_open that behaves like it's Linux counterpart.
This is specially important for toolstacks that use Qemu (like Xen
libxl), in order to have a unified behaviour across suported
platforms.
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: xen-devel@lists.xenproject.org
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
---
net/tap-bsd.c | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 69 insertions(+), 1 deletions(-)
diff --git a/net/tap-bsd.c b/net/tap-bsd.c
index 90f8a02..bf91bd0 100644
--- a/net/tap-bsd.c
+++ b/net/tap-bsd.c
@@ -27,12 +27,13 @@
#include "sysemu/sysemu.h"
#include "qemu/error-report.h"
-#ifdef __NetBSD__
+#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <sys/ioctl.h>
#include <net/if.h>
#include <net/if_tap.h>
#endif
+#ifndef __FreeBSD__
int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
int vnet_hdr_required, int mq_required)
{
@@ -108,6 +109,73 @@ int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
return fd;
}
+#else /* __FreeBSD__ */
+
+#define PATH_NET_TAP "/dev/tap"
+
+int tap_open(char *ifname, int ifname_size, int *vnet_hdr,
+ int vnet_hdr_required, int mq_required)
+{
+ int fd, s, ret;
+ struct ifreq ifr;
+
+ TFR(fd = open(PATH_NET_TAP, O_RDWR));
+ if (fd < 0) {
+ error_report("could not open %s: %s", PATH_NET_TAP, strerror(errno));
+ return -1;
+ }
+
+ memset(&ifr, 0, sizeof(ifr));
+
+ ret = ioctl(fd, TAPGIFNAME, (void *)&ifr);
+ if (ret < 0) {
+ error_report("could not get tap interface name");
+ goto error;
+ }
+
+ if (ifname[0] != '\0') {
+ /* User requested the interface to have a specific name */
+ s = socket(AF_LOCAL, SOCK_DGRAM, 0);
+ if (s < 0) {
+ error_report("could not open socket to set interface name");
+ goto error;
+ }
+ ifr.ifr_data = ifname;
+ ret = ioctl(s, SIOCSIFNAME, (void *)&ifr);
+ close(s);
+ if (ret < 0) {
+ error_report("could not set tap interface name");
+ goto error;
+ }
+ } else {
+ pstrcpy(ifname, ifname_size, ifr.ifr_name);
+ }
+
+ if (*vnet_hdr) {
+ /* BSD doesn't have IFF_VNET_HDR */
+ *vnet_hdr = 0;
+
+ if (vnet_hdr_required && !*vnet_hdr) {
+ error_report("vnet_hdr=1 requested, but no kernel "
+ "support for IFF_VNET_HDR available");
+ goto error;
+ }
+ }
+ if (mq_required) {
+ error_report("mq_required requested, but not kernel support"
+ "for IFF_MULTI_QUEUE available");
+ goto error;
+ }
+
+ fcntl(fd, F_SETFL, O_NONBLOCK);
+ return fd;
+
+error:
+ close(fd);
+ return -1;
+}
+#endif /* __FreeBSD__ */
+
int tap_set_sndbuf(int fd, const NetdevTapOptions *tap)
{
return 0;
--
1.7.7.5 (Apple Git-26)
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [Qemu-devel] [PATCH v2 3/3] serial: poll the serial console with G_IO_HUP
2014-05-23 15:57 [Qemu-devel] [PATCH v2 0/3] qemu-freebsd: fixes for running Xen guests Roger Pau Monne
2014-05-23 15:57 ` [Qemu-devel] [PATCH v2 1/3] xen: fix usage of ENODATA Roger Pau Monne
2014-05-23 15:57 ` [Qemu-devel] [PATCH v2 2/3] tap-bsd: implement a FreeBSD only version of tap_open Roger Pau Monne
@ 2014-05-23 15:57 ` Roger Pau Monne
2014-06-13 15:35 ` Roger Pau Monné
2 siblings, 1 reply; 12+ messages in thread
From: Roger Pau Monne @ 2014-05-23 15:57 UTC (permalink / raw)
To: qemu-devel, xen-devel
Cc: Paolo Bonzini, Peter Crosthwaite, Michael Tokarev,
Andreas Färber, Roger Pau Monne
On FreeBSD polling a master pty while the other end is not connected
with G_IO_OUT only results in an endless wait. This is different from
the Linux behaviour, that returns immediately. In order to demonstrate
this, I have the following example code:
http://xenbits.xen.org/people/royger/test_poll.c
When executed on Linux:
$ ./test_poll
In callback
On FreeBSD instead, the callback never gets called:
$ ./test_poll
So, in order to workaround this, poll the source with G_IO_HUP (which
makes the code behave the same way on both Linux and FreeBSD).
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Cc: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: Michael Tokarev <mjt@tls.msk.ru>
Cc: "Andreas Färber" <afaerber@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: xen-devel@lists.xenproject.org
---
Changes since v1:
- Fix other users of qemu_chr_fe_add_watch to use G_IO_HUP.
---
hw/char/serial.c | 2 +-
hw/char/virtio-console.c | 3 ++-
hw/usb/redirect.c | 2 +-
monitor.c | 2 +-
4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/hw/char/serial.c b/hw/char/serial.c
index f4d167f..2a2c9e5 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -246,7 +246,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
serial_receive1(s, &s->tsr, 1);
} else if (qemu_chr_fe_write(s->chr, &s->tsr, 1) != 1) {
if (s->tsr_retry >= 0 && s->tsr_retry < MAX_XMIT_RETRY &&
- qemu_chr_fe_add_watch(s->chr, G_IO_OUT, serial_xmit, s) > 0) {
+ qemu_chr_fe_add_watch(s->chr, G_IO_OUT|G_IO_HUP, serial_xmit, s) > 0) {
s->tsr_retry++;
return FALSE;
}
diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
index 6c8be0f..38e290a 100644
--- a/hw/char/virtio-console.c
+++ b/hw/char/virtio-console.c
@@ -69,7 +69,8 @@ static ssize_t flush_buf(VirtIOSerialPort *port,
if (!k->is_console) {
virtio_serial_throttle_port(port, true);
if (!vcon->watch) {
- vcon->watch = qemu_chr_fe_add_watch(vcon->chr, G_IO_OUT,
+ vcon->watch = qemu_chr_fe_add_watch(vcon->chr,
+ G_IO_OUT|G_IO_HUP,
chr_write_unblocked, vcon);
}
}
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 287a505..06e757d 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -284,7 +284,7 @@ static int usbredir_write(void *priv, uint8_t *data, int count)
r = qemu_chr_fe_write(dev->cs, data, count);
if (r < count) {
if (!dev->watch) {
- dev->watch = qemu_chr_fe_add_watch(dev->cs, G_IO_OUT,
+ dev->watch = qemu_chr_fe_add_watch(dev->cs, G_IO_OUT|G_IO_HUP,
usbredir_write_unblocked, dev);
}
if (r < 0) {
diff --git a/monitor.c b/monitor.c
index 593679a..ae1c539 100644
--- a/monitor.c
+++ b/monitor.c
@@ -304,7 +304,7 @@ void monitor_flush(Monitor *mon)
mon->outbuf = tmp;
}
if (mon->watch == 0) {
- mon->watch = qemu_chr_fe_add_watch(mon->chr, G_IO_OUT,
+ mon->watch = qemu_chr_fe_add_watch(mon->chr, G_IO_OUT|G_IO_HUP,
monitor_unblocked, mon);
}
}
--
1.7.7.5 (Apple Git-26)
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v2 3/3] serial: poll the serial console with G_IO_HUP
2014-05-23 15:57 ` [Qemu-devel] [PATCH v2 3/3] serial: poll the serial console with G_IO_HUP Roger Pau Monne
@ 2014-06-13 15:35 ` Roger Pau Monné
2014-06-30 11:00 ` Roger Pau Monné
0 siblings, 1 reply; 12+ messages in thread
From: Roger Pau Monné @ 2014-06-13 15:35 UTC (permalink / raw)
To: qemu-devel, xen-devel
Cc: Paolo Bonzini, Peter Crosthwaite, Michael Tokarev,
Andreas Färber
Ping?
On 23/05/14 17:57, Roger Pau Monne wrote:
> On FreeBSD polling a master pty while the other end is not connected
> with G_IO_OUT only results in an endless wait. This is different from
> the Linux behaviour, that returns immediately. In order to demonstrate
> this, I have the following example code:
>
> http://xenbits.xen.org/people/royger/test_poll.c
>
> When executed on Linux:
>
> $ ./test_poll
> In callback
>
> On FreeBSD instead, the callback never gets called:
>
> $ ./test_poll
>
> So, in order to workaround this, poll the source with G_IO_HUP (which
> makes the code behave the same way on both Linux and FreeBSD).
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> Cc: Michael Tokarev <mjt@tls.msk.ru>
> Cc: "Andreas Färber" <afaerber@suse.de>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: xen-devel@lists.xenproject.org
> ---
> Changes since v1:
> - Fix other users of qemu_chr_fe_add_watch to use G_IO_HUP.
> ---
> hw/char/serial.c | 2 +-
> hw/char/virtio-console.c | 3 ++-
> hw/usb/redirect.c | 2 +-
> monitor.c | 2 +-
> 4 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/hw/char/serial.c b/hw/char/serial.c
> index f4d167f..2a2c9e5 100644
> --- a/hw/char/serial.c
> +++ b/hw/char/serial.c
> @@ -246,7 +246,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
> serial_receive1(s, &s->tsr, 1);
> } else if (qemu_chr_fe_write(s->chr, &s->tsr, 1) != 1) {
> if (s->tsr_retry >= 0 && s->tsr_retry < MAX_XMIT_RETRY &&
> - qemu_chr_fe_add_watch(s->chr, G_IO_OUT, serial_xmit, s) > 0) {
> + qemu_chr_fe_add_watch(s->chr, G_IO_OUT|G_IO_HUP, serial_xmit, s) > 0) {
> s->tsr_retry++;
> return FALSE;
> }
> diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
> index 6c8be0f..38e290a 100644
> --- a/hw/char/virtio-console.c
> +++ b/hw/char/virtio-console.c
> @@ -69,7 +69,8 @@ static ssize_t flush_buf(VirtIOSerialPort *port,
> if (!k->is_console) {
> virtio_serial_throttle_port(port, true);
> if (!vcon->watch) {
> - vcon->watch = qemu_chr_fe_add_watch(vcon->chr, G_IO_OUT,
> + vcon->watch = qemu_chr_fe_add_watch(vcon->chr,
> + G_IO_OUT|G_IO_HUP,
> chr_write_unblocked, vcon);
> }
> }
> diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
> index 287a505..06e757d 100644
> --- a/hw/usb/redirect.c
> +++ b/hw/usb/redirect.c
> @@ -284,7 +284,7 @@ static int usbredir_write(void *priv, uint8_t *data, int count)
> r = qemu_chr_fe_write(dev->cs, data, count);
> if (r < count) {
> if (!dev->watch) {
> - dev->watch = qemu_chr_fe_add_watch(dev->cs, G_IO_OUT,
> + dev->watch = qemu_chr_fe_add_watch(dev->cs, G_IO_OUT|G_IO_HUP,
> usbredir_write_unblocked, dev);
> }
> if (r < 0) {
> diff --git a/monitor.c b/monitor.c
> index 593679a..ae1c539 100644
> --- a/monitor.c
> +++ b/monitor.c
> @@ -304,7 +304,7 @@ void monitor_flush(Monitor *mon)
> mon->outbuf = tmp;
> }
> if (mon->watch == 0) {
> - mon->watch = qemu_chr_fe_add_watch(mon->chr, G_IO_OUT,
> + mon->watch = qemu_chr_fe_add_watch(mon->chr, G_IO_OUT|G_IO_HUP,
> monitor_unblocked, mon);
> }
> }
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v2 3/3] serial: poll the serial console with G_IO_HUP
2014-06-13 15:35 ` Roger Pau Monné
@ 2014-06-30 11:00 ` Roger Pau Monné
2014-06-30 12:23 ` Paolo Bonzini
0 siblings, 1 reply; 12+ messages in thread
From: Roger Pau Monné @ 2014-06-30 11:00 UTC (permalink / raw)
To: qemu-devel, xen-devel
Cc: Paolo Bonzini, Peter Crosthwaite, Michael Tokarev,
Andreas Färber
Do I need to resend this? it's been more than a month without review.
Roger.
On 13/06/14 17:35, Roger Pau Monné wrote:
> Ping?
>
> On 23/05/14 17:57, Roger Pau Monne wrote:
>> On FreeBSD polling a master pty while the other end is not connected
>> with G_IO_OUT only results in an endless wait. This is different from
>> the Linux behaviour, that returns immediately. In order to demonstrate
>> this, I have the following example code:
>>
>> http://xenbits.xen.org/people/royger/test_poll.c
>>
>> When executed on Linux:
>>
>> $ ./test_poll
>> In callback
>>
>> On FreeBSD instead, the callback never gets called:
>>
>> $ ./test_poll
>>
>> So, in order to workaround this, poll the source with G_IO_HUP (which
>> makes the code behave the same way on both Linux and FreeBSD).
>>
>> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
>> Cc: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>> Cc: Michael Tokarev <mjt@tls.msk.ru>
>> Cc: "Andreas Färber" <afaerber@suse.de>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: xen-devel@lists.xenproject.org
>> ---
>> Changes since v1:
>> - Fix other users of qemu_chr_fe_add_watch to use G_IO_HUP.
>> ---
>> hw/char/serial.c | 2 +-
>> hw/char/virtio-console.c | 3 ++-
>> hw/usb/redirect.c | 2 +-
>> monitor.c | 2 +-
>> 4 files changed, 5 insertions(+), 4 deletions(-)
>>
>> diff --git a/hw/char/serial.c b/hw/char/serial.c
>> index f4d167f..2a2c9e5 100644
>> --- a/hw/char/serial.c
>> +++ b/hw/char/serial.c
>> @@ -246,7 +246,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
>> serial_receive1(s, &s->tsr, 1);
>> } else if (qemu_chr_fe_write(s->chr, &s->tsr, 1) != 1) {
>> if (s->tsr_retry >= 0 && s->tsr_retry < MAX_XMIT_RETRY &&
>> - qemu_chr_fe_add_watch(s->chr, G_IO_OUT, serial_xmit, s) > 0) {
>> + qemu_chr_fe_add_watch(s->chr, G_IO_OUT|G_IO_HUP, serial_xmit, s) > 0) {
>> s->tsr_retry++;
>> return FALSE;
>> }
>> diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
>> index 6c8be0f..38e290a 100644
>> --- a/hw/char/virtio-console.c
>> +++ b/hw/char/virtio-console.c
>> @@ -69,7 +69,8 @@ static ssize_t flush_buf(VirtIOSerialPort *port,
>> if (!k->is_console) {
>> virtio_serial_throttle_port(port, true);
>> if (!vcon->watch) {
>> - vcon->watch = qemu_chr_fe_add_watch(vcon->chr, G_IO_OUT,
>> + vcon->watch = qemu_chr_fe_add_watch(vcon->chr,
>> + G_IO_OUT|G_IO_HUP,
>> chr_write_unblocked, vcon);
>> }
>> }
>> diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
>> index 287a505..06e757d 100644
>> --- a/hw/usb/redirect.c
>> +++ b/hw/usb/redirect.c
>> @@ -284,7 +284,7 @@ static int usbredir_write(void *priv, uint8_t *data, int count)
>> r = qemu_chr_fe_write(dev->cs, data, count);
>> if (r < count) {
>> if (!dev->watch) {
>> - dev->watch = qemu_chr_fe_add_watch(dev->cs, G_IO_OUT,
>> + dev->watch = qemu_chr_fe_add_watch(dev->cs, G_IO_OUT|G_IO_HUP,
>> usbredir_write_unblocked, dev);
>> }
>> if (r < 0) {
>> diff --git a/monitor.c b/monitor.c
>> index 593679a..ae1c539 100644
>> --- a/monitor.c
>> +++ b/monitor.c
>> @@ -304,7 +304,7 @@ void monitor_flush(Monitor *mon)
>> mon->outbuf = tmp;
>> }
>> if (mon->watch == 0) {
>> - mon->watch = qemu_chr_fe_add_watch(mon->chr, G_IO_OUT,
>> + mon->watch = qemu_chr_fe_add_watch(mon->chr, G_IO_OUT|G_IO_HUP,
>> monitor_unblocked, mon);
>> }
>> }
>>
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [Qemu-devel] [PATCH v2 3/3] serial: poll the serial console with G_IO_HUP
2014-06-30 11:00 ` Roger Pau Monné
@ 2014-06-30 12:23 ` Paolo Bonzini
0 siblings, 0 replies; 12+ messages in thread
From: Paolo Bonzini @ 2014-06-30 12:23 UTC (permalink / raw)
To: Roger Pau Monné, qemu-devel, xen-devel
Cc: Peter Crosthwaite, Michael Tokarev, Andreas Färber
Il 30/06/2014 13:00, Roger Pau Monné ha scritto:
> Do I need to resend this? it's been more than a month without review.
I'll send a pull request for it.
Sorry for the delay.
Paolo
> On 13/06/14 17:35, Roger Pau Monné wrote:
>> Ping?
>>
>> On 23/05/14 17:57, Roger Pau Monne wrote:
>>> On FreeBSD polling a master pty while the other end is not connected
>>> with G_IO_OUT only results in an endless wait. This is different from
>>> the Linux behaviour, that returns immediately. In order to demonstrate
>>> this, I have the following example code:
>>>
>>> http://xenbits.xen.org/people/royger/test_poll.c
>>>
>>> When executed on Linux:
>>>
>>> $ ./test_poll
>>> In callback
>>>
>>> On FreeBSD instead, the callback never gets called:
>>>
>>> $ ./test_poll
>>>
>>> So, in order to workaround this, poll the source with G_IO_HUP (which
>>> makes the code behave the same way on both Linux and FreeBSD).
>>>
>>> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
>>> Cc: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>> Cc: Michael Tokarev <mjt@tls.msk.ru>
>>> Cc: "Andreas Färber" <afaerber@suse.de>
>>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>>> Cc: xen-devel@lists.xenproject.org
>>> ---
>>> Changes since v1:
>>> - Fix other users of qemu_chr_fe_add_watch to use G_IO_HUP.
>>> ---
>>> hw/char/serial.c | 2 +-
>>> hw/char/virtio-console.c | 3 ++-
>>> hw/usb/redirect.c | 2 +-
>>> monitor.c | 2 +-
>>> 4 files changed, 5 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/hw/char/serial.c b/hw/char/serial.c
>>> index f4d167f..2a2c9e5 100644
>>> --- a/hw/char/serial.c
>>> +++ b/hw/char/serial.c
>>> @@ -246,7 +246,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
>>> serial_receive1(s, &s->tsr, 1);
>>> } else if (qemu_chr_fe_write(s->chr, &s->tsr, 1) != 1) {
>>> if (s->tsr_retry >= 0 && s->tsr_retry < MAX_XMIT_RETRY &&
>>> - qemu_chr_fe_add_watch(s->chr, G_IO_OUT, serial_xmit, s) > 0) {
>>> + qemu_chr_fe_add_watch(s->chr, G_IO_OUT|G_IO_HUP, serial_xmit, s) > 0) {
>>> s->tsr_retry++;
>>> return FALSE;
>>> }
>>> diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c
>>> index 6c8be0f..38e290a 100644
>>> --- a/hw/char/virtio-console.c
>>> +++ b/hw/char/virtio-console.c
>>> @@ -69,7 +69,8 @@ static ssize_t flush_buf(VirtIOSerialPort *port,
>>> if (!k->is_console) {
>>> virtio_serial_throttle_port(port, true);
>>> if (!vcon->watch) {
>>> - vcon->watch = qemu_chr_fe_add_watch(vcon->chr, G_IO_OUT,
>>> + vcon->watch = qemu_chr_fe_add_watch(vcon->chr,
>>> + G_IO_OUT|G_IO_HUP,
>>> chr_write_unblocked, vcon);
>>> }
>>> }
>>> diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
>>> index 287a505..06e757d 100644
>>> --- a/hw/usb/redirect.c
>>> +++ b/hw/usb/redirect.c
>>> @@ -284,7 +284,7 @@ static int usbredir_write(void *priv, uint8_t *data, int count)
>>> r = qemu_chr_fe_write(dev->cs, data, count);
>>> if (r < count) {
>>> if (!dev->watch) {
>>> - dev->watch = qemu_chr_fe_add_watch(dev->cs, G_IO_OUT,
>>> + dev->watch = qemu_chr_fe_add_watch(dev->cs, G_IO_OUT|G_IO_HUP,
>>> usbredir_write_unblocked, dev);
>>> }
>>> if (r < 0) {
>>> diff --git a/monitor.c b/monitor.c
>>> index 593679a..ae1c539 100644
>>> --- a/monitor.c
>>> +++ b/monitor.c
>>> @@ -304,7 +304,7 @@ void monitor_flush(Monitor *mon)
>>> mon->outbuf = tmp;
>>> }
>>> if (mon->watch == 0) {
>>> - mon->watch = qemu_chr_fe_add_watch(mon->chr, G_IO_OUT,
>>> + mon->watch = qemu_chr_fe_add_watch(mon->chr, G_IO_OUT|G_IO_HUP,
>>> monitor_unblocked, mon);
>>> }
>>> }
>>>
>>
>>
>
^ permalink raw reply [flat|nested] 12+ messages in thread