Add EINVAL to TCGETS2/TCSETS2 fallback triggers#1573
Add EINVAL to TCGETS2/TCSETS2 fallback triggers#1573NiltonVolpato wants to merge 3 commits intobytecodealliance:mainfrom
Conversation
|
Could this be considered a bug in CheerpX/WebVM? Either for lacking |
|
Sorry for the late response. My interpretation of the ioctl man pages is also that ENOTTY is a more appropriate error to be returned, in this case. That doesn't seem obvious to everyone, though, since there other platforms that are already special cased. But I agree that if CheerpX could fix that, then it would be ideal. As observed libc seems to fallback to the old ioctl calls anyway. And I also haven't had problems executing other C programs with raw access to the terminal, or Rust programs not using reedline (which indirectly depends on rustix) I created leaningtech/webvm#214 |
This adds
EINVALto the error codes that trigger fallback fromTCGETS2/TCSETS2to the legacyTCGETS/TCSETSioctls.Motivation
Some emulated and virtualized environments don't implement
TCGETS2/TCSETS2and returnEINVALrather thanENOTTYorEACCES. This includes CheerpX/WebVM (x86-to-WebAssembly virtualization in the browser).The fallback logic already exists for
ENOTTYandEACCES. This change simply addsEINVALas another trigger.Reproducing
cargo build --target i686-unknown-linux-musl --release -F termios,ptyRunning on https://webvm.io/ outputs:
With this change, the fallback to
TCGETSsucceeds.Changes
tcgetattr: addErrno::INVALto fallback match armtcsetattr: addErrno::INVALto fallback match arm