diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /third_party/rust/ioctl-sys/examples/smoke.rs | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/rust/ioctl-sys/examples/smoke.rs')
-rw-r--r-- | third_party/rust/ioctl-sys/examples/smoke.rs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/third_party/rust/ioctl-sys/examples/smoke.rs b/third_party/rust/ioctl-sys/examples/smoke.rs new file mode 100644 index 0000000000..1508123491 --- /dev/null +++ b/third_party/rust/ioctl-sys/examples/smoke.rs @@ -0,0 +1,23 @@ +#[macro_use] +extern crate ioctl_sys; + +ioctl!(bad kiocsound with 0x4B2F); +ioctl!(none drm_ioctl_set_master with b'd', 0x1e); +ioctl!(read ev_get_version with b'E', 0x01; u32); +ioctl!(write ev_set_repeat with b'E', 0x03; [u32; 2]); + +ioctl!(try none drm_ioctl_set_master2 with b'd', 0x1e); +ioctl!(try read ev_get_version2 with b'E', 0x01; u32); +ioctl!(try read0 ev_get_version3 with b'E', 0x01; u32); +ioctl!(try write ev_set_repeat2 with b'E', 0x03; [u32; 2]); + +fn main() { + let mut x = 0; + let ret = unsafe { ev_get_version(0, &mut x) }; + println!("returned {}, x = {}", ret, x); + let mut x2 = 0; + let ret2 = unsafe { ev_get_version2(0, &mut x2) }; + println!("returned {:?}, x = {}", ret2, x2); + let ret3 = unsafe { ev_get_version3(0) }; + println!("returned {:?}", ret3); +} |