Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/uart_emul.c
Context not available. | |||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include <sys/types.h> | #include <sys/types.h> | ||||
#include <sys/capsicum.h> | |||||
#include <dev/ic/ns16550.h> | #include <dev/ic/ns16550.h> | ||||
#include <stdio.h> | #include <stdio.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <assert.h> | #include <assert.h> | ||||
#include <err.h> | |||||
#include <errno.h> | |||||
#include <fcntl.h> | #include <fcntl.h> | ||||
#include <termios.h> | #include <termios.h> | ||||
#include <unistd.h> | #include <unistd.h> | ||||
Context not available. | |||||
#include <stdbool.h> | #include <stdbool.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <pthread.h> | #include <pthread.h> | ||||
#include <sysexits.h> | |||||
#include "mevent.h" | #include "mevent.h" | ||||
#include "uart_emul.h" | #include "uart_emul.h" | ||||
Context not available. | |||||
{ | { | ||||
int fd; | int fd; | ||||
int retval; | int retval; | ||||
cap_rights_t rights; | |||||
u_long cmds[] = {TIOCGETA, TIOCSETA, TIOCGWINSZ}; | |||||
retval = -1; | retval = -1; | ||||
Context not available. | |||||
sc->tty.opened = true; | sc->tty.opened = true; | ||||
retval = 0; | retval = 0; | ||||
} | } | ||||
cap_rights_init(&rights, CAP_READ, CAP_WRITE, CAP_FCNTL, CAP_FSTAT, | |||||
CAP_IOCTL, CAP_EVENT); | |||||
if (cap_rights_limit(fd, &rights) == -1 && errno != ENOSYS) | |||||
errx(EX_OSERR, "Unable to apply rights for sandbox"); | |||||
if (cap_ioctls_limit(fd, cmds, nitems(cmds)) == -1 && errno != ENOSYS) | |||||
errx(EX_OSERR, "Unable to apply rights for sandbox"); | |||||
return (retval); | return (retval); | ||||
} | } | ||||
Context not available. |