Path: blob/main/core/kernel/src/wasm/posix/epoll.ts
1068 views
/*12See https://en.wikipedia.org/wiki/Epoll34This is a stub implementation of epoll that doesn't do anything in terms5of actually detecting file changes, but also appears not broken to the user.6It's very reasonable that we could implement a real version of epoll.7For linux it could just be a lightweight wrapper around real epoll, and for8other environments, something else depending on constraints.910This is used by the tail coreutils command to watch a file...11*/1213export default function epoll({ sleep }: { sleep? }) {14return {15// int epoll_create(int flags);16epoll_create: (_size: number): number => {17return 0;18},19// int epoll_create1(int flags);20epoll_create1: (_flags: number): number => {21return 0;22},2324// int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);25epoll_ctl: (26_epfd: number,27_op: number,28_fd: number,29_epoll_event_ptr: number30): number => {31return 0;32},3334// int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout);35epoll_wait: (36_epfd: number,37_epoll_event_ptr: number,38_maxevents: number,39timeout: number40): number => {41// if blocking sleep is available, we wait timeout *milliseconds*, then return 042sleep?.(timeout);43return 0;44},45};46}474849