I can imagine many apps that might want to proxy async traffic thru
stdin/stdout, what is the intended general solution for this with epoll?
FWIW in my app I'm just assuming that fd0 is a dup of fd1 if EPOLL_CTL_ADD
on fd1 fails with EEXISTS, then I EPOLL_CTL_MOD on fd0 to add the write event.
This seems like a bit of a hack tho.
Example, 2nd ADD fails with EEXIST:
int
main(int ac, char **av)
{
int pfd;
struct epoll_event ev;
pfd = epoll_create(10);
ev.events = EPOLLIN | EPOLLET;
ev.data.u32 = 0xdeadbee0;
if (epoll_ctl(pfd, EPOLL_CTL_ADD, 0, &ev) < 0) {
perror("EPOLL_CTL_ADD stdin");
exit(1);
}
ev.events = EPOLLOUT | EPOLLET;
ev.data.u32 = 0xdeadbee1;
if (epoll_ctl(pfd, EPOLL_CTL_ADD, 1, &ev) < 0) {
perror("EPOLL_CTL_ADD stdout");
exit(1);
}
}
-Eric Varsanyi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/