summaryrefslogtreecommitdiffstats
path: root/vendor/rustix/src/termios
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /vendor/rustix/src/termios
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/rustix/src/termios')
-rw-r--r--vendor/rustix/src/termios/tty.rs21
-rw-r--r--vendor/rustix/src/termios/types.rs28
2 files changed, 33 insertions, 16 deletions
diff --git a/vendor/rustix/src/termios/tty.rs b/vendor/rustix/src/termios/tty.rs
index 56aab9fcf..b14e602cd 100644
--- a/vendor/rustix/src/termios/tty.rs
+++ b/vendor/rustix/src/termios/tty.rs
@@ -51,23 +51,26 @@ fn _ttyname(dirfd: BorrowedFd<'_>, mut buffer: Vec<u8>) -> io::Result<CString> {
loop {
match backend::termios::syscalls::ttyname(dirfd, buffer.spare_capacity_mut()) {
Err(io::Errno::RANGE) => {
- buffer.reserve(buffer.capacity() + 1); // use `Vec` reallocation strategy to grow capacity exponentially
+ // Use `Vec` reallocation strategy to grow capacity
+ // exponentially.
+ buffer.reserve(buffer.capacity() + 1);
}
Ok(len) => {
- // SAFETY: assume the backend returns the length of the string excluding the
- // NUL.
+ // SAFETY: Assume the backend returns the length of the string
+ // excluding the NUL.
unsafe {
buffer.set_len(len + 1);
}
// SAFETY:
- // - "ttyname_r stores this pathname in the buffer buf"
- // - [POSIX definition 3.271: Pathname]: "A string that is used to identify a
- // file."
- // - [POSIX definition 3.375: String]: "A contiguous sequence of bytes
- // terminated by and including the first null byte."
+ // - “ttyname_r stores this pathname in the buffer buf”
+ // - [POSIX definition 3.271: Pathname]: “A string that is used
+ // to identify a file.”
+ // - [POSIX definition 3.375: String]: “A contiguous sequence
+ // of bytes terminated by and including the first null byte.”
//
- // Thus, there will be a single NUL byte at the end of the string.
+ // Thus, there will be a single NUL byte at the end of the
+ // string.
//
// [POSIX definition 3.271: Pathname]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_271
// [POSIX definition 3.375: String]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_375
diff --git a/vendor/rustix/src/termios/types.rs b/vendor/rustix/src/termios/types.rs
index 0c44ed2e8..720352442 100644
--- a/vendor/rustix/src/termios/types.rs
+++ b/vendor/rustix/src/termios/types.rs
@@ -289,11 +289,12 @@ bitflags! {
target_os = "aix",
target_os = "emscripten",
target_os = "haiku",
+ target_os = "hurd",
target_os = "redox",
)))]
const IUTF8 = c::IUTF8;
- /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
const _ = !0;
}
}
@@ -508,7 +509,7 @@ bitflags! {
)))]
const VT1 = c::VT1;
- /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
const _ = !0;
}
}
@@ -566,12 +567,13 @@ bitflags! {
target_os = "aix",
target_os = "emscripten",
target_os = "haiku",
+ target_os = "hurd",
target_os = "nto",
target_os = "redox",
)))]
const CMSPAR = c::CMSPAR;
- /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
const _ = !0;
}
}
@@ -637,7 +639,7 @@ bitflags! {
/// `IEXTEN`
const IEXTEN = c::IEXTEN;
- /// <https://docs.rs/bitflags/latest/bitflags/#externally-defined-flags>
+ /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
const _ = !0;
}
}
@@ -806,7 +808,18 @@ pub mod speed {
/// Translate from a `c::speed_t` code to an arbitrary integer speed value
/// `u32`.
- #[cfg(not(any(linux_kernel, bsd)))]
+ ///
+ /// On BSD platforms, integer speed values are already the same as their
+ /// encoded values, and on Linux platforms, we use `TCGETS2`/`TCSETS2`
+ /// and the `c_ispeed`/`c_ospeed`` fields, except that on Linux on
+ /// PowerPC on QEMU, `TCGETS2`/`TCSETS2` don't set `c_ispeed`/`c_ospeed`.
+ #[cfg(not(any(
+ bsd,
+ all(
+ linux_kernel,
+ not(any(target_arch = "powerpc", target_arch = "powerpc64"))
+ )
+ )))]
pub(crate) const fn decode(encoded_speed: c::speed_t) -> Option<u32> {
match encoded_speed {
c::B0 => Some(0),
@@ -1131,6 +1144,7 @@ impl SpecialCodeIndex {
solarish,
target_os = "aix",
target_os = "haiku",
+ target_os = "hurd",
target_os = "nto",
)))]
pub const VSWTC: Self = Self(c::VSWTC as usize);
@@ -1263,8 +1277,8 @@ fn termios_layouts() {
check_renamed_struct_renamed_field!(Termios, termios, local_modes, c_lflag);
check_renamed_struct_renamed_field!(Termios, termios, special_codes, c_cc);
- // On everything except PowerPC, `termios` matches `termios2` except for
- // the addition of `c_ispeed` and `c_ospeed`.
+ // On everything except PowerPC, `termios` matches `termios2` except
+ // for the addition of `c_ispeed` and `c_ospeed`.
#[cfg(not(any(target_arch = "powerpc", target_arch = "powerpc64")))]
const_assert_eq!(
memoffset::offset_of!(Termios, input_speed),