vmd(8): fix vmctl client "wait" state corruption
authordv <dv@openbsd.org>
Mon, 26 Apr 2021 22:58:27 +0000 (22:58 +0000)
committerdv <dv@openbsd.org>
Mon, 26 Apr 2021 22:58:27 +0000 (22:58 +0000)
commite73ceaac631a7349c16d777f6a8343d4054f6df9
treedd8e139aa54f4935a5d34b6cfe8684bd17dcd153
parent397b0c358a4a9503e93d7e794c4520e2d88dbce5
vmd(8): fix vmctl client "wait" state corruption

Adds queue-based tracking of waiting client state to fix the cause of
state corruption when a vmctl(8) user cancels a wait and restarts it.
The socket fd value for the control process client was being used to
track the waiting party, but this also prevented multiple waiting
clients.

This moves all the state tracking of who to notify of a vm's stopping
to the control process and no longer requires the parent process to
track it in the global environment state.

Future work will be needed to smooth out the difference between the
IMSG_VMDOP_TERMINATE_VM_{EVENT,RESPONSE} events instead of needing to
translate before relaying to the vmctl(8) client.

Tested by Mischa Peters (thanks!)

ok mlarkin@
usr.sbin/vmd/control.c
usr.sbin/vmd/vmd.c
usr.sbin/vmd/vmm.c