Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/pci_e82545.c
Show All 37 Lines | |||||
#endif | #endif | ||||
#include <sys/limits.h> | #include <sys/limits.h> | ||||
#include <sys/ioctl.h> | #include <sys/ioctl.h> | ||||
#include <sys/uio.h> | #include <sys/uio.h> | ||||
#include <net/ethernet.h> | #include <net/ethernet.h> | ||||
#include <netinet/in.h> | #include <netinet/in.h> | ||||
#include <netinet/tcp.h> | #include <netinet/tcp.h> | ||||
#ifndef WITHOUT_CAPSICUM | |||||
#include <capsicum_helpers.h> | |||||
#endif | |||||
#include <err.h> | #include <err.h> | ||||
#include <errno.h> | #include <errno.h> | ||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#include <md5.h> | #include <md5.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <sysexits.h> | #include <sysexits.h> | ||||
▲ Show 20 Lines • Show All 2,181 Lines • ▼ Show 20 Lines | #endif | ||||
if (ioctl(sc->esc_tapfd, FIONBIO, &opt) < 0) { | if (ioctl(sc->esc_tapfd, FIONBIO, &opt) < 0) { | ||||
WPRINTF("tap device O_NONBLOCK failed: %d\n", errno); | WPRINTF("tap device O_NONBLOCK failed: %d\n", errno); | ||||
close(sc->esc_tapfd); | close(sc->esc_tapfd); | ||||
sc->esc_tapfd = -1; | sc->esc_tapfd = -1; | ||||
} | } | ||||
#ifndef WITHOUT_CAPSICUM | #ifndef WITHOUT_CAPSICUM | ||||
cap_rights_init(&rights, CAP_EVENT, CAP_READ, CAP_WRITE); | cap_rights_init(&rights, CAP_EVENT, CAP_READ, CAP_WRITE); | ||||
if (cap_rights_limit(sc->esc_tapfd, &rights) == -1 && errno != ENOSYS) | if (caph_rights_limit(sc->esc_tapfd, &rights) == -1) | ||||
errx(EX_OSERR, "Unable to apply rights for sandbox"); | errx(EX_OSERR, "Unable to apply rights for sandbox"); | ||||
#endif | #endif | ||||
sc->esc_mevp = mevent_add(sc->esc_tapfd, | sc->esc_mevp = mevent_add(sc->esc_tapfd, | ||||
EVF_READ, | EVF_READ, | ||||
e82545_tap_callback, | e82545_tap_callback, | ||||
sc); | sc); | ||||
if (sc->esc_mevp == NULL) { | if (sc->esc_mevp == NULL) { | ||||
▲ Show 20 Lines • Show All 137 Lines • Show Last 20 Lines |