mirror of https://github.com/xqemu/xqemu.git
sclpconsolelm: remove bogus check for -EAGAIN
The write_console_data() method in sclpconsole-lm.c checks whether the return value of qemu_chr_fe_write() has the value of -EAGAIN and if so then increments the buffer offset by the value of EAGAIN. Fortunately qemu_chr_fe_write() will never return EAGAIN directly, rather it returns -1 with errno set to EAGAIN, so this broken code path was not reachable. The behaviour on EAGAIN was stil bad though, causing the write_console_data() to busy_wait repeatedly calling qemu_chr_fe_write() with no sleep between iters. Just remove all this loop logic and replace with a call to qemu_chr_fe_write_all(). Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Daniel P. Berrange <berrange@redhat.com> Message-Id: <1473170165-540-3-git-send-email-berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
b72981b910
commit
7983e82933
|
@ -191,9 +191,6 @@ static int read_event_data(SCLPEvent *event, EventBufferHeader *evt_buf_hdr,
|
||||||
*/
|
*/
|
||||||
static int write_console_data(SCLPEvent *event, const uint8_t *buf, int len)
|
static int write_console_data(SCLPEvent *event, const uint8_t *buf, int len)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
|
||||||
const uint8_t *buf_offset;
|
|
||||||
|
|
||||||
SCLPConsoleLM *scon = SCLPLM_CONSOLE(event);
|
SCLPConsoleLM *scon = SCLPLM_CONSOLE(event);
|
||||||
|
|
||||||
if (!scon->chr) {
|
if (!scon->chr) {
|
||||||
|
@ -201,21 +198,9 @@ static int write_console_data(SCLPEvent *event, const uint8_t *buf, int len)
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
buf_offset = buf;
|
/* XXX this blocks entire thread. Rewrite to use
|
||||||
while (len > 0) {
|
* qemu_chr_fe_write and background I/O callbacks */
|
||||||
ret = qemu_chr_fe_write(scon->chr, buf, len);
|
return qemu_chr_fe_write_all(scon->chr, buf, len);
|
||||||
if (ret == 0) {
|
|
||||||
/* a pty doesn't seem to be connected - no error */
|
|
||||||
len = 0;
|
|
||||||
} else if (ret == -EAGAIN || (ret > 0 && ret < len)) {
|
|
||||||
len -= ret;
|
|
||||||
buf_offset += ret;
|
|
||||||
} else {
|
|
||||||
len = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int process_mdb(SCLPEvent *event, MDBO *mdbo)
|
static int process_mdb(SCLPEvent *event, MDBO *mdbo)
|
||||||
|
|
Loading…
Reference in New Issue