-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tty: handle corner cases on stdin and stdout
epoll_ctl would generally return EPERM after redirecting standard streams to /dev/null or closing them. It turns out that /dev/null and /dev/full, among others, are not supported by epoll -- in particular /dev/null is always write-ready, and /dev/full is always read-ready. Confusingly, closing stdin, stdout, or stderr causes glibc to reopen /dev/full for stdin and /dev/null for stdout and stderr. Another thing to consider is that epoll does not support regular files either, because linux consider those to always be read-write-ready (independent of whether or not the disk will actually end up blocking). We now handle these corner cases by using an eventfd to emulate these unsupported file descriptors.
- Loading branch information
Showing
2 changed files
with
59 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters