-
Notifications
You must be signed in to change notification settings - Fork 654
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
Provide and emulate ptsname_r on macOS and iOS by using the TIOCPTYGNAME syscall. #742
Provide and emulate ptsname_r on macOS and iOS by using the TIOCPTYGNAME syscall. #742
Conversation
@nelsonjchen This isn't something that's currently done in |
…AME syscall. This provides a thread-safe alternative to ptsname() and compatibility for existing projects using ptsname_r() on macOS.
aba3de9
to
e7670a8
Compare
I'm not sure how the availability of My use case is that I would like to write a Rust application that simulates a device on the other end of a serial port in macOS and Linux. If I want to use the "UI" of this simulated device, I would need to know what the corresponding slave terminal device is and would need some form of With I too have some doubts about this PR and I couldn't find any precedent so I figure it might be good to just use this issue to set some precedent for I think I'm at least the third person using Rust to want a simple As cited in the code, this is derived from two other examples of this kind of code out there:
|
My feeling is that this wrapper is outside of the scope of nix. However, you raise an interesting point. Since mutable global variables are always considered |
On some platforms, `ptsname()` mutates global variables and mutating global variables is always considered `unsafe` by Rust. Reference: nix-rust#742 (comment)
On some platforms, `ptsname()` mutates global variables and mutating global variables is always considered `unsafe` by Rust. Reference: nix-rust#742 (comment)
On some platforms, `ptsname()` mutates global variables and mutating global variables is always considered `unsafe` by Rust. Reference: nix-rust#742 (comment)
On all platforms, `ptsname()` mutates global variables and mutating global variables is always considered `unsafe` by Rust. Reference: nix-rust#742 (comment)
`ptsname()` mutates global variables and mutating global variables is always considered `unsafe` by Rust. Reference: nix-rust#742 (comment)
`ptsname()` mutates global variables and mutating global variables is always considered `unsafe` by Rust. Reference: nix-rust#742 (comment)
744: Mark and document pty::ptsname() as unsafe r=asomers a=nelsonjchen On some platforms, `ptsname()` mutates global variables and mutating global variables is always considered `unsafe` by Rust. Reference: #742 (comment)
I'm also in agreement that |
`ptsname()` mutates global variables and mutating global variables is always considered `unsafe` by Rust. Reference: nix-rust#742 (comment)
I've since moved this into its own external library. |
This provides a thread-safe alternative to ptsname() and compatibility for existing projects using
ptsname_r()
on macOS.So, I'm not sure if this belongs in
nix
. Would this fall under the "but to unify what can" aspect?