Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/mevent.c
Context not available. | |||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <assert.h> | #include <assert.h> | ||||
#include <err.h> | |||||
#include <errno.h> | #include <errno.h> | ||||
#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 <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/capsicum.h> | |||||
#include <sys/event.h> | #include <sys/event.h> | ||||
#include <sys/time.h> | #include <sys/time.h> | ||||
Context not available. | |||||
int mfd; | int mfd; | ||||
int numev; | int numev; | ||||
int ret; | int ret; | ||||
cap_rights_t rights; | |||||
mevent_tid = pthread_self(); | mevent_tid = pthread_self(); | ||||
mevent_set_name(); | mevent_set_name(); | ||||
Context not available. | |||||
mfd = kqueue(); | mfd = kqueue(); | ||||
assert(mfd > 0); | assert(mfd > 0); | ||||
cap_rights_init(&rights, CAP_KQUEUE); | |||||
if (cap_rights_limit(mfd, &rights) == -1 && errno != ENOSYS) | |||||
errx(EX_OSERR, "Unable to apply rights for sandbox"); | |||||
/* | /* | ||||
* Open the pipe that will be used for other threads to force | * Open the pipe that will be used for other threads to force | ||||
* the blocking kqueue call to exit by writing to it. Set the | * the blocking kqueue call to exit by writing to it. Set the | ||||
Context not available. | |||||
exit(0); | exit(0); | ||||
} | } | ||||
cap_rights_remove(&rights, &rights); | |||||
cap_rights_init(&rights, CAP_READ, CAP_WRITE, CAP_EVENT); | |||||
if (cap_rights_limit(mevent_pipefd[0], &rights) == -1 && errno != ENOSYS) | |||||
errx(EX_OSERR, "Unable to apply rights for sandbox"); | |||||
if (cap_rights_limit(mevent_pipefd[1], &rights) == -1 && errno != ENOSYS) | |||||
errx(EX_OSERR, "Unable to apply rights for sandbox"); | |||||
/* | /* | ||||
* Add internal event handler for the pipe write fd | * Add internal event handler for the pipe write fd | ||||
*/ | */ | ||||
Context not available. |