[QUESTION] How to use qmp?
Hello I am exposing qmp on qemu using the example in the readme, but qemu can't find my socket. I am running inside a docker container
Dockerfile:
---
version: '3'
services:
readmem:
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Rome
pull_policy: build
build:
context: .
dockerfile: "./Dockerfile"
volumes:
- /tmp/qmp-my-vm.sock:/tmp/qmp-my-vm.sock
restart: "unless-stopped"
container_name: readmem
As you can see, the socket is mapped on /tmp/qmp-my-vm.sock.
Now how to tell the connector where my socket is?
const char *conn_name = argc > 1? argv[1]: "qemu";
const char *conn_arg = argc > 2? argv[2]: "";
const char *os_name = argc > 2? argv[2]: "win32";
const char *os_arg = argc > 4? argv[4]: "";
ConnectorInstance<> connector, *conn = conn_name[0] ? &connector : nullptr;
OsInstance<> os;
if (conn) {
if (inventory_create_connector(inventory, conn_name, conn_arg, &connector)) {
printf("unable to initialize connector\n");
inventory_free(inventory);
} else { other code ...}
}
EDIT: I am on cpp, using official https://github.com/memflow/memflow-cmake-example/ .
I ended up hacking this in via env var, not sure if/when I'll turn that into a proper argument though .-.
I personally needed it for different reasons though - I'm just not using the -qmp arg so the qemu arg parser failed to find it among: -chardev socket,id=qmpsock,path=/path/to/qmp,server=on,wait=off -mon qmpsock,id=qmp,mode=control
(can't recall if this was deprecated or just the more explicit/verbose syntax?)