static int faf_poll_init_epfd(void) { long pid; int epfd; if (faf_poll_epfd >= 0) goto out; epfd = (int) sys_epoll_create(FAF_POLL_NR_FD); if (epfd < 0) goto err_epfd; pid = kernel_thread(faf_poll_thread, (void *)(long)epfd, CLONE_FILES); if (pid < 0) goto err_thread; faf_poll_epfd = epfd; out: return 0; err_thread: sys_close(epfd); epfd = (int)pid; err_epfd: return epfd; }
struct file *cpt_open_epolldev(struct cpt_file_image *fi, unsigned flags, struct cpt_context *ctx) { struct file *file; int efd; /* Argument "size" is ignored, use just 1 */ efd = sys_epoll_create(1); if (efd < 0) return ERR_PTR(efd); file = fget(efd); sys_close(efd); return file; }