summaryrefslogtreecommitdiff
path: root/src/sys/termios.rs
AgeCommit message (Collapse)Author
2022-12-09refactor: take AsFd by valueSteve Lau
2022-12-08feat: I/O safety for 'sys/termios' & 'pty'Steve Lau
2022-11-06Reformat everythingAlex Saveau
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
2022-10-08Fix clippy warnings on nightlyRyan Zoeller
Clippy is now smarter about detecting unnecessary casts and useless conversions, which means we need to be more explicit about when the conversions are needed for a subset of platforms. Required changes found by repeatedly running the following command against a list of the supported platforms. `xargs -t -I {} sh -c "cargo clippy -Zbuild-std --target {} --all-targets -- -D warnings || exit 255"` I removed the casts it complained about, and then restored them with an `#[allow]` if a later target needed the cast.
2022-08-22add line field to Termios structTerts Diepraam
2022-08-09remove deprecated itemsSteveLauC
2022-08-04fix clippy assertions_on_result_statesMichael Baikov
https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_result_states
2022-05-14add haiku supportAl Hoang
* enabled as much functionality and defines that match updated libc definitions for haiku
2022-02-27Define _POSIX_VDISABLE on Android to fix doc testRyan Zoeller
2021-12-20feature-gate most Nix functionsVincent Dagonneau
Using features reduces build time and size for consumer crates. By default all features are enabled.
2021-08-09Optionally implement TryFrom in libc_enum!Alan Somers
This saves code in several separate places that need to do this separately. At the same time, remove a few uses of mem::transmute that were implementing TryFrom or similar functionality. Issue #373
2021-08-09Remove some actually unsupported termios iflags on redoxNoah
2021-07-24Mark most C-derived enums as non_exhaustiveAlan Somers
Since libc may add new variants at any time, Nix's consumers should not use exhaustive match patterns. Fixes #1182
2021-07-07Overhaul Nix's error typesAlan Somers
For many of Nix's consumers it be convenient to easily convert a Nix error into a std::io::Error. That's currently not possible because of the InvalidPath, InvalidUtf8, and UnsupportedOperation types that have no equivalent in std::io::Error. However, very few of Nix's public APIs actually return those unusual errors. So a more useful API would be for Nix's standard error type to implement Into<std::io::Error>. This commit makes Error a simple NewType around Errno. For most functions it's a drop-in replacement. There are only three exceptions: * clearenv now returns a bespoke error type. It was the only Nix function whose error couldn't be cleanly mapped onto an Errno. * sys::signal::signal now returns Error(Errno::ENOTSUP) instead of Error::UnsupportedOperation when the user passes an incompatible argument to `handler`. * When a NixPath exceeds PATH_MAX, it will now return Error(Errno::ENAMETOOLONG) instead of Error::InvalidPath. In the latter two cases there is now some abiguity about whether the error code was generated by Nix or by the OS. But I think the ambiguity is worth it for the sake of being able to implement Into<io::Error>. This commit also introduces Error::Sys() as a migration aid. Previously that as an enum variant. Now it's a function, but it will work in many of the same contexts as the original. Fixes #1155
2021-05-13Use https instead of httpRyan Zoeller
2021-03-21illumos and Solaris supportJason King
Co-authored-by: Dominik Hassler <hadfl@omnios.org> Co-authored-by: Joshua M. Clulow <josh@sysmgr.org>
2020-06-04Limit internal termios API to pub(crate)Bryant Mairs
2020-05-31Convert the crate to edition 2018Alan Somers
2020-05-17Add termio supportXavier L'Heureux
2019-12-01Remove some obsolete comments.Alan Somers
ignore really is the correct things to do for these doc tests. compile_fail should only be used for examples that demonstrate a compile failure by design, not for stuff that only works on one platform.
2019-12-01impl TryFrom<libc::speed_t> for BaudRateAlan Somers
The old From implementation was actually falliable, and would panic on failure.
2019-12-01Remove the last use of mem::uninitializedAlan Somers
Replace it with mem::zeroed. It isn't perfect, but it's better than it was. Issue #1115
2019-11-02sys: termios: Use associated constants for VMIN and VTIME on sparc64John Paul Adrian Glaubitz
2019-11-01sys: termios: Fix inverted logic for [cfg()] conditional for sparc64John Paul Adrian Glaubitz
The fix for #1149 has the logic for the [cfg()] conditional inverted so that the aliases for VMIN and VTIME are defined on targets that are not linux-sparc64.
2019-11-01sys: termios: Define VMIN and VTIME as VEOF and VEOL on sparc64John Paul Adrian Glaubitz
On sparc64, glibc defines VMIN as VEOF and VTIME as VEOL for termios, so we need to inherit these alias definitions for nix-rust as well. Fixes #1149
2019-09-19Where relevant, replace equality checks in assert! with assert_eq!Xavier L'Heureux
`assert_eq!` gives more debug info when the test fails by default than `assert!`. This should help make debugging easier.
2019-09-03Replace most instances of mem::uninitialized with mem::MaybeUninitAlan Somers
Only two instances remain: * For the deprecated sys::socket::CmsgSpace::new. We should probably just remove that method. * For sys::termios::Termios::default_uninit. This will require some more thought. Fixes #1096
2019-06-09Add extra traits for all typesBryant Mairs
Derive Clone, Copy, Eq, Hash, and PartialEq for all types. Not all traits are supported by all types, which is why many are missing some.
2018-12-08Replace try! with ?Alan Somers
try! is not available in Rust 2018
2018-12-01Remove duplicate termios constantsBryant Mairs
These constants have the same value on sparc64, so need to be removed as enums in Rust can't have multiple names for the same value.
2018-12-01Fix baud rate constants on sparc64-linuxBryant Mairs
2018-11-28Prefer `map(drop)` to `map(|_| ())`Alan Somers
I previously advocated for the latter syntax on stylistic grounds. But it generates less efficient code, because it creates a new lambda function for each usage. The optimizer does not combine them. This change saves about 6KB of code.
2018-02-12Add cfmakesane() on FreeBSDGreg V
2018-01-28Fix B460800 and B921600 baud rates for netbsdBryant Mairs
2018-01-28Require Debug impls for all typesBryant Mairs
2018-01-28Deny unused qualificationsBryant Mairs
2018-01-25Consistently use `Termios` in commentsBryant Mairs
2018-01-25Don't use map(drop) as it's hard to understandBryant Mairs
.map(drop) makes it seem like there is a need to drop the type at that point when really all you're doing is trying to erase the type information and return an empty tuple. So do that explicitly instead of throwing drop in there.
2018-01-25Support arbitrary baud rates on BSDsBryant Mairs
2017-12-20Remove unnecessary '@ _'Bryant Mairs
2017-12-04Stop reexporting `Errno` and its variantsJonas Schievink
cc #664 (unsure if this is everything needed)
2017-12-02Upgrade to Bitflags 1.0Bryant Mairs
The libc_bitflags! macro was replaced with a non-recursive one supporting only public structs. I could not figure out how to make the old macro work with the upgrade, so I reworked part of the bitflags! macro directly to suit our needs, much as the original recursive macro was made. There are no uses of this macro for non-public structs, so this is not a problem for internal code.
2017-08-16Match libc_bitflags! syntax to upstream bitflags!Bryant Mairs
2017-07-10Add tcgetsid()Bryant Mairs
2017-07-10Add cfmakeraw and cfsetspeedBryant Mairs
2017-07-10Use libc types for termiosBryant Mairs
This also removes the incorrect TCSASOFT definition as an enum type because it's actually a bitfield.
2017-07-04Allow nix to compile on android targetsroblabla
2017-06-18Update bitflags to 0.9equal-l2
2017-04-09Removed unused libc imports in termios.Zac Berkowitz
2017-04-09Fixes nix-rust/nix#532Zac Berkowitz