Index: sys/compat/cloudabi/cloudabi_fd.c =================================================================== --- sys/compat/cloudabi/cloudabi_fd.c +++ sys/compat/cloudabi/cloudabi_fd.c @@ -97,11 +97,15 @@ cloudabi_sys_fd_create1(struct thread *td, struct cloudabi_sys_fd_create1_args *uap) { + struct filecaps fcaps = {}; struct socket_args socket_args = { .domain = AF_UNIX, }; switch (uap->type) { + case CLOUDABI_FILETYPE_POLL: + cap_rights_init(&fcaps.fc_rights, CAP_FSTAT, CAP_KQUEUE); + return (kern_kqueue(td, 0, &fcaps)); case CLOUDABI_FILETYPE_SOCKET_DGRAM: socket_args.type = SOCK_DGRAM; return (sys_socket(td, &socket_args)); Index: sys/compat/linux/linux_event.c =================================================================== --- sys/compat/linux/linux_event.c +++ sys/compat/linux/linux_event.c @@ -205,7 +205,7 @@ { int error; - error = kern_kqueue(td, flags); + error = kern_kqueue(td, flags, NULL); if (error) return (error); Index: sys/kern/kern_event.c =================================================================== --- sys/kern/kern_event.c +++ sys/kern/kern_event.c @@ -738,11 +738,11 @@ sys_kqueue(struct thread *td, struct kqueue_args *uap) { - return (kern_kqueue(td, 0)); + return (kern_kqueue(td, 0, NULL)); } int -kern_kqueue(struct thread *td, int flags) +kern_kqueue(struct thread *td, int flags, struct filecaps *fcaps) { struct filedesc *fdp; struct kqueue *kq; @@ -760,7 +760,7 @@ } fdp = p->p_fd; - error = falloc(td, &fp, &fd, flags); + error = falloc_caps(td, &fp, &fd, flags, fcaps); if (error) goto done2; Index: sys/sys/syscallsubr.h =================================================================== --- sys/sys/syscallsubr.h +++ sys/sys/syscallsubr.h @@ -126,7 +126,7 @@ int kern_kevent_fp(struct thread *td, struct file *fp, int nchanges, int nevents, struct kevent_copyops *k_ops, const struct timespec *timeout); -int kern_kqueue(struct thread *td, int flags); +int kern_kqueue(struct thread *td, int flags, struct filecaps *fcaps); int kern_kldload(struct thread *td, const char *file, int *fileid); int kern_kldstat(struct thread *td, int fileid, struct kld_file_stat *stat); int kern_kldunload(struct thread *td, int fileid, int flags);