xref: /third_party/rust/crates/rustix/tests/io/ioctl.rs
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/rust/crates/rustix/tests/io/
1b8a62b91Sopenharmony_ci// `is_read_write` is not yet implemented on Windows. And `ioctl_fionread`
2b8a62b91Sopenharmony_ci// on Windows doesn't work on files.
3b8a62b91Sopenharmony_ci#[cfg(not(windows))]
4b8a62b91Sopenharmony_ci#[test]
5b8a62b91Sopenharmony_cifn test_ioctls() {
6b8a62b91Sopenharmony_ci    let file = std::fs::File::open("Cargo.toml").unwrap();
7b8a62b91Sopenharmony_ci
8b8a62b91Sopenharmony_ci    #[cfg(all(feature = "fs", feature = "net"))]
9b8a62b91Sopenharmony_ci    assert_eq!(rustix::io::is_read_write(&file).unwrap(), (true, false));
10b8a62b91Sopenharmony_ci
11b8a62b91Sopenharmony_ci    assert_eq!(
12b8a62b91Sopenharmony_ci        rustix::io::ioctl_fionread(&file).unwrap(),
13b8a62b91Sopenharmony_ci        file.metadata().unwrap().len()
14b8a62b91Sopenharmony_ci    );
15b8a62b91Sopenharmony_ci}
16

Indexes created Thu Nov 07 10:32:03 CST 2024