Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/rfb.c
Context not available. | |||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/capsicum.h> | |||||
#include <sys/socket.h> | #include <sys/socket.h> | ||||
#include <sys/select.h> | #include <sys/select.h> | ||||
#include <sys/time.h> | #include <sys/time.h> | ||||
Context not available. | |||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <assert.h> | #include <assert.h> | ||||
#include <err.h> | |||||
#include <errno.h> | |||||
#include <pthread.h> | #include <pthread.h> | ||||
#include <pthread_np.h> | #include <pthread_np.h> | ||||
#include <signal.h> | #include <signal.h> | ||||
Context not available. | |||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <sysexits.h> | |||||
#include <unistd.h> | #include <unistd.h> | ||||
#include <zlib.h> | #include <zlib.h> | ||||
Context not available. | |||||
struct rfb_softc *rc; | struct rfb_softc *rc; | ||||
struct sockaddr_in sin; | struct sockaddr_in sin; | ||||
int on = 1; | int on = 1; | ||||
cap_rights_t rights; | |||||
rc = calloc(1, sizeof(struct rfb_softc)); | rc = calloc(1, sizeof(struct rfb_softc)); | ||||
Context not available. | |||||
return (-1); | return (-1); | ||||
} | } | ||||
cap_rights_init(&rights, CAP_ACCEPT, CAP_BIND, CAP_EVENT, CAP_LISTEN, CAP_READ, CAP_SETSOCKOPT, CAP_WRITE); | |||||
if (cap_rights_limit(rc->sfd, &rights) == -1 && errno != ENOSYS) | |||||
errx(EX_OSERR, "Unable to apply rights for sandbox"); | |||||
setsockopt(rc->sfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); | setsockopt(rc->sfd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on)); | ||||
sin.sin_len = sizeof(sin); | sin.sin_len = sizeof(sin); | ||||
Context not available. |