MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / test_int_setter

Function test_int_setter

tests/io/ioctl.rs:15–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13#[cfg(all(target_os = "linux", feature = "fs"))]
14#[test]
15fn test_int_setter() {
16 use rustix::fs::{open, Mode, OFlags};
17 use rustix::ioctl::{ioctl, IntegerSetter, Opcode};
18
19 const TUNSETOFFLOAD: Opcode = 0x4004_54D0;
20
21 let tun = open("/dev/net/tun", OFlags::RDWR, Mode::empty()).unwrap();
22
23 // SAFETY: `TUNSETOFFLOAD` is defined for TUN.
24 unsafe {
25 let code = IntegerSetter::<TUNSETOFFLOAD>::new_usize(0);
26 assert!(ioctl(&tun, code).is_err());
27 }
28}

Callers

nothing calls this directly

Calls 1

openFunction · 0.50

Tested by

no test coverage detected