Skip to content

Add support for openpty #671

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

Closed
kchibisov opened this issue May 16, 2023 · 3 comments
Closed

Add support for openpty #671

kchibisov opened this issue May 16, 2023 · 3 comments

Comments

@kchibisov
Copy link

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
Copy link
Member

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 contains openpt, ptsname, unlockpt, grantpt, and ioctl_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's openpt/ptsname/ioctl_tiocgptpeer/unlockpt/openat/tcsetwinsize/tcsetattr on Linux and backed by libc::openpty on other platforms.

@sunfishcode
Copy link
Member

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
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants