The recent save/restore functionality in bhyve(8) also introduced a unix domain
socket that is used by bhyvectl(8).
This patch moves the unix domain socket code into a separate file so that it could
be used without enabling the save/restore functionality. The socket code has been
moved to ipc.c and ipc.h. The code in ipc.c was copied from snapshot.c with
This splits up init_checkpoint_thread() into init_snapshot() and init_ipc().
init_ipc() creates the unix domain socket and a thread to handle requests.
init_snapshot() initializes mutex/cond variables used by the save/restore functionality.
- expose vm_checkpoint() through snapshot.h
- socket path is now '/var/run/bhyve/$vmname' instead of '/var/run/bhyve/checkpoint/$vmname'
The socket is still protected behind #ifdef BHYVE_SNAPSHOT guards.
The checkpoint_xxx variables probably deserved to be renamed.
I do have a patch that extends from this review that brings the unix domain socket in
front of the #ifdef BHYVE_SNAPSHOT guards. Also, it hooks up bhyvectl(8) to send
a message (other than suspend/checkpoint) to bhyve(8) over the socket. I mention it
because that's my motivation for splitting up the socket and save/restore code.