Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/snapshot.c
Show First 20 Lines • Show All 1,511 Lines • ▼ Show 20 Lines | |||||
int | int | ||||
init_checkpoint_thread(struct vmctx *ctx) | init_checkpoint_thread(struct vmctx *ctx) | ||||
{ | { | ||||
struct checkpoint_thread_info *checkpoint_info = NULL; | struct checkpoint_thread_info *checkpoint_info = NULL; | ||||
struct sockaddr_un addr; | struct sockaddr_un addr; | ||||
int socket_fd; | int socket_fd; | ||||
pthread_t checkpoint_pthread; | pthread_t checkpoint_pthread; | ||||
int err; | int err; | ||||
#ifndef WITHOUT_CAPSICUM | |||||
cap_rights_t rights; | |||||
#endif | |||||
markj: There should be a newline between variable declarations and code. | |||||
Done Inline ActionsDone. gusev.vitaliy_gmail.com: Done. | |||||
memset(&addr, 0, sizeof(addr)); | memset(&addr, 0, sizeof(addr)); | ||||
socket_fd = socket(PF_UNIX, SOCK_STREAM, 0); | socket_fd = socket(PF_UNIX, SOCK_STREAM, 0); | ||||
if (socket_fd < 0) { | if (socket_fd < 0) { | ||||
EPRINTLN("Socket creation failed: %s", strerror(errno)); | EPRINTLN("Socket creation failed: %s", strerror(errno)); | ||||
err = -1; | err = -1; | ||||
goto fail; | goto fail; | ||||
Show All 14 Lines | #endif | ||||
} | } | ||||
if (listen(socket_fd, 10) < 0) { | if (listen(socket_fd, 10) < 0) { | ||||
EPRINTLN("ipc socket listen: %s\n", strerror(errno)); | EPRINTLN("ipc socket listen: %s\n", strerror(errno)); | ||||
err = errno; | err = errno; | ||||
goto fail; | goto fail; | ||||
} | } | ||||
#ifndef WITHOUT_CAPSICUM | |||||
cap_rights_init(&rights, CAP_ACCEPT, CAP_READ, CAP_RECV, CAP_WRITE, | |||||
CAP_SEND, CAP_GETSOCKOPT); | |||||
if (caph_rights_limit(socket_fd, &rights) == -1) | |||||
errx(EX_OSERR, "Unable to apply rights for sandbox"); | |||||
#endif | |||||
checkpoint_info = calloc(1, sizeof(*checkpoint_info)); | checkpoint_info = calloc(1, sizeof(*checkpoint_info)); | ||||
checkpoint_info->ctx = ctx; | checkpoint_info->ctx = ctx; | ||||
checkpoint_info->socket_fd = socket_fd; | checkpoint_info->socket_fd = socket_fd; | ||||
err = pthread_create(&checkpoint_pthread, NULL, checkpoint_thread, | err = pthread_create(&checkpoint_pthread, NULL, checkpoint_thread, | ||||
checkpoint_info); | checkpoint_info); | ||||
if (err != 0) | if (err != 0) | ||||
goto fail; | goto fail; | ||||
▲ Show 20 Lines • Show All 141 Lines • Show Last 20 Lines |
There should be a newline between variable declarations and code.