monitor: Command-line flag to enable control mode

This commit adds a flag called 'control' to the '-monitor'
command-line option. This flag enables control mode.

The syntax is:

qemu [...] -monitor control,<device>

Where <device> is a chardev (excluding 'vc', for obvious reasons).

For example:

$ qemu [...] -monitor control,tcp:localhost:4444,server

Will run QEMU in control mode, waiting for a client TCP connection
on localhost port 4444.

NOTE: I've tried using QemuOpts for this, but turns out that it
will try to parse the device part, which should be untouched.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Luiz Capitulino 2009-11-26 22:58:52 -02:00 committed by Anthony Liguori
parent 418173c72f
commit adcb181afe
4 changed files with 29 additions and 6 deletions

View file

@ -3535,6 +3535,24 @@ static void monitor_event(void *opaque, int event)
* End:
*/
const char *monitor_cmdline_parse(const char *cmdline, int *flags)
{
const char *dev;
if (strstart(cmdline, "control,", &dev)) {
if (strstart(dev, "vc", NULL)) {
fprintf(stderr, "qemu: control mode is for low-level interaction ");
fprintf(stderr, "cannot be used with device 'vc'\n");
exit(1);
}
*flags &= ~MONITOR_USE_READLINE;
*flags |= MONITOR_USE_CONTROL;
return dev;
}
return cmdline;
}
void monitor_init(CharDriverState *chr, int flags)
{
static int is_first_init = 1;