Page MenuHomeFreeBSD

bhyve/snapshot: use SOCK_DGRAM instead of SOCK_STREAM
ClosedPublic

Authored by rew on Feb 28 2021, 10:09 AM.

Details

Summary

The unix domain socket that the save/restore feature uses is a stream
socket, switch to using a datagram socket instead.

  • change socket type from SOCK_STREAM to SOCK_DGRAM

Currently, struct checkpoint_op is the data that gets sent across the
socket. My idea (at the moment) is that checkpoint_op will be swapped
out for a more generic approach - I'm planning to do that in a separate
review.

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

rew requested review of this revision.Feb 28 2021, 10:09 AM

Generally looks good, just a minor nit about displaying errors.

usr.sbin/bhyve/snapshot.c
1488

This probably needs to use the helper macro for errors which adds \r when needed if bhyve's stdin/stdout are in raw mode for use as the serial console. It's true that the perror's in this file are also broken for the same reason, but it would be good to fix this in the new changes at least. I think the macro is something like EPRINTLN() IIRC.

use EPRINTLN for display error messages..

changed fprintf and perror to use EPRINTLN, I only changed them in
the areas where I was close to a fprintf/perror.

jhb added inline comments.
usr.sbin/bhyvectl/bhyvectl.c
1716

Maybe fix this one as well since you are already touching the line.

This revision is now accepted and ready to land.Mar 3 2021, 10:11 PM
usr.sbin/bhyvectl/bhyvectl.c
1716

perror() is only broken for bhyve(8), no?

This one is in bhyvectl(8).

usr.sbin/bhyvectl/bhyvectl.c
1716

Oh yes, my bad!