-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[WasmFS] Stub ioctl()/terminal support #16677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
system/lib/wasmfs/syscalls.cpp
Outdated
| static bool isTTY(int fd) { | ||
| // TODO: Full TTY support. For now, just see stdin/out/err as terminals and | ||
| // nothing else. | ||
| return fd == STDIN_FILENO || fd == STDOUT_FILENO || fd == STDERR_FILENO; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we at least check for File equality with /dev/stdin, etc? That will be more robust against the standard streams being moved or reassigned, etc. Even better would be to add a virtual method to File and have our stream implementations override it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea to check for equality on the singleton objects, done.
We could add a virtual method to File, but I'm not sure what it should look like - "isTTY"? Or should it be more general and represent all types of special devices? As our earliest adopters of WasmFS won't be using TTY support, I think it's best to defer work on that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I was imagining isTTY, but passing on that for now seems fine.
We don't have TTY support in emscripten anyhow, so most of this just
does nothing. We also do not yet have a concept of TTYs in wasmfs,
so just recognize stdin/out/err as such. This is enough for basic things,
gets some tests passing, and is almost at parity with the old FS (it had
the ability to create new terminals and mark them as such).