|
@@ -1101,6 +1101,22 @@ static void pty_chr_rearm_timer(CharDriverState *chr, int ms)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void pty_chr_update_read_handler(CharDriverState *chr)
|
|
|
|
+{
|
|
|
|
+ PtyCharDriver *s = chr->opaque;
|
|
|
|
+ GPollFD pfd;
|
|
|
|
+
|
|
|
|
+ pfd.fd = g_io_channel_unix_get_fd(s->fd);
|
|
|
|
+ pfd.events = G_IO_OUT;
|
|
|
|
+ pfd.revents = 0;
|
|
|
|
+ g_poll(&pfd, 1, 0);
|
|
|
|
+ if (pfd.revents & G_IO_HUP) {
|
|
|
|
+ pty_chr_state(chr, 0);
|
|
|
|
+ } else {
|
|
|
|
+ pty_chr_state(chr, 1);
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
|
|
static int pty_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
|
|
{
|
|
{
|
|
PtyCharDriver *s = chr->opaque;
|
|
PtyCharDriver *s = chr->opaque;
|
|
@@ -1153,22 +1169,6 @@ static gboolean pty_chr_read(GIOChannel *chan, GIOCondition cond, void *opaque)
|
|
return TRUE;
|
|
return TRUE;
|
|
}
|
|
}
|
|
|
|
|
|
-static void pty_chr_update_read_handler(CharDriverState *chr)
|
|
|
|
-{
|
|
|
|
- PtyCharDriver *s = chr->opaque;
|
|
|
|
- GPollFD pfd;
|
|
|
|
-
|
|
|
|
- pfd.fd = g_io_channel_unix_get_fd(s->fd);
|
|
|
|
- pfd.events = G_IO_OUT;
|
|
|
|
- pfd.revents = 0;
|
|
|
|
- g_poll(&pfd, 1, 0);
|
|
|
|
- if (pfd.revents & G_IO_HUP) {
|
|
|
|
- pty_chr_state(chr, 0);
|
|
|
|
- } else {
|
|
|
|
- pty_chr_state(chr, 1);
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static void pty_chr_state(CharDriverState *chr, int connected)
|
|
static void pty_chr_state(CharDriverState *chr, int connected)
|
|
{
|
|
{
|
|
PtyCharDriver *s = chr->opaque;
|
|
PtyCharDriver *s = chr->opaque;
|