Add support for `openpty`
kchibisov opened this issue · 3 comments
kchibisov commented
I think it's the only thing left to use rustix
instead of nix
in alacritty_terminal
crate. Given that termios
is already provided it should be straight forward.
sunfishcode commented
openpty
is a little tricky because it's not a single syscall on Linux. It's about 4 to 6 syscalls. Rustix usually tries to avoid higher-level APIs like this.
From a brief survey, I think an approach like this might make sense:
- Rustix could add a
rusix::pty
which containsopenpt
,ptsname
,unlockpt
,grantpt
, andioctl_tiocgptpeer
functions, on platforms where they can be supported. - There could be a new separate crate that provides an
openpty
-like API which is backed by rustix'sopenpt
/ptsname
/ioctl_tiocgptpeer
/unlockpt
/openat
/tcsetwinsize
/tcsetattr
on Linux and backed bylibc::openpty
on other platforms.
sunfishcode commented
I've now posted #673 adding support for openpt
et al in rustix, and I created a rustix-openpty repo with a simple implementation of an openpty
function that uses it, here: https://github.com/sunfishcode/rustix-openpty
kchibisov commented
Thanks!