[libvirt-users] Obtaining the PID of a domain's QEMU process from C
Cole Robinson
crobinso at redhat.com
Fri Mar 8 19:00:07 UTC 2019
On 2/28/19 8:31 PM, Shawn Anastasio wrote:
> Hello all,
>
> I'm currently writing a C program that uses the libvirt API and I need a
> way to obtain the pid of a given domain's QEMU process.
>
> Specifically, I'm writing an ivshmem server that uses SO_PEERCRED to get
> the pid of clients that connect to it, and I would like to use that pid
> to look up the domain in libvirt to determine the proper domain ID to
> return to the client.
>
> As far as I can tell, libvirt doesn't expose this information in an easy
> to access manner. Of course it is possible to call `ps` and grep for the
> information I'm looking for, but I was hoping for a cleaner solution.
>
> If anybody knows how to do this, advice would be greatly appreciated.
>
> Thanks in advance,
There isn't any libvirt API for getting the qemu pid, so I think going
outside libvirt is your only option
- Cole
More information about the libvirt-users
mailing list