Skip to contentSkip to conversation

[6717] monitor: Introduce MONITOR_USE_READLINE flag (Jan Kiszka)

Qemu-devel Anthony Liguori 1 participant 1 message Mar 5, 2009

lore
Share & tools
lore
#0 lore raw

Revision: 6717

          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6717
Author:   aliguori
Date:     2009-03-05 23:01:51 +0000 (Thu, 05 Mar 2009)

Log Message:
-----------
monitor: Introduce MONITOR_USE_READLINE flag (Jan Kiszka)

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.

Modified Paths:
--------------
trunk/migration.c
trunk/monitor.c
trunk/monitor.h
trunk/qemu-char.c
trunk/vl.c

Modified: trunk/migration.c
===================================================================

migration.c +5 -2
@@ -128,8 +128,11 @@
 void migrate_fd_monitor_suspend(FdMigrationState *s)
 {
     s->mon_resume = cur_mon;
-    monitor_suspend(cur_mon);
-    dprintf("suspending monitor\n");
+    if (monitor_suspend(cur_mon) == 0)
+        dprintf("suspending monitor\n");
+    else
+        monitor_printf(cur_mon, "terminal does not allow synchronous "
+                       "migration, continuing detached\n");
 }
 
 void migrate_fd_error(FdMigrationState *s)

Modified: trunk/monitor.c
===================================================================

monitor.c +37 -10

94 lines not on this page · raw message

Modified: trunk/monitor.h
===================================================================

monitor.h +2 -1
@@ -9,10 +9,11 @@
 
 /* flags for monitor_init */
 #define MONITOR_IS_DEFAULT    0x01
+#define MONITOR_USE_READLINE  0x02
 
 void monitor_init(CharDriverState *chr, int flags);
 
-void monitor_suspend(Monitor *mon);
+int monitor_suspend(Monitor *mon);
 void monitor_resume(Monitor *mon);
 
 void monitor_read_bdrv_key_start(Monitor *mon, BlockDriverState *bs,

Modified: trunk/qemu-char.c
===================================================================

qemu-char.c +1 -1
@@ -2130,7 +2130,7 @@
         chr = qemu_chr_open(label, p, NULL);
         if (chr) {
             chr = qemu_chr_open_mux(chr);
-            monitor_init(chr, 0);
+            monitor_init(chr, MONITOR_USE_READLINE);
         } else {
             printf("Unable to open driver: %s\n", p);
         }

Modified: trunk/vl.c
===================================================================

vl.c +1 -1
@@ -5684,7 +5684,7 @@
     qemu_chr_initial_reset();
 
     if (monitor_device && monitor_hd)
-        monitor_init(monitor_hd, MONITOR_IS_DEFAULT);
+        monitor_init(monitor_hd, MONITOR_USE_READLINE | MONITOR_IS_DEFAULT);
 
     for(i = 0; i < MAX_SERIAL_PORTS; i++) {
         const char *devname = serial_devices[i];