From 6a46fbd9cb52d5a9e7e009849a175aef83142f73 Mon Sep 17 00:00:00 2001 From: John Nunley Date: Mon, 10 Jul 2023 18:23:38 -0700 Subject: [PATCH] Fix shm issue --- x11rb-async/Cargo.toml | 1 + x11rb-async/examples/shared_memory_async.rs | 2 +- x11rb-protocol/src/utils.rs | 12 +++--------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/x11rb-async/Cargo.toml b/x11rb-async/Cargo.toml index df913726..be351fc1 100644 --- a/x11rb-async/Cargo.toml +++ b/x11rb-async/Cargo.toml @@ -98,6 +98,7 @@ all-features = true [dev-dependencies] async-executor = "1.5.0" +libc = "0.2.147" tracing-subscriber = { version = "0.3", features = ["env-filter"] } [[example]] diff --git a/x11rb-async/examples/shared_memory_async.rs b/x11rb-async/examples/shared_memory_async.rs index a7a5fdb5..ef4a3bc3 100644 --- a/x11rb-async/examples/shared_memory_async.rs +++ b/x11rb-async/examples/shared_memory_async.rs @@ -4,7 +4,7 @@ use std::os::unix::io::AsRawFd; use std::ptr::null_mut; use async_executor::LocalExecutor; -use nix::libc::{mmap, MAP_FAILED, MAP_SHARED, PROT_READ, PROT_WRITE}; +use libc::{mmap, MAP_FAILED, MAP_SHARED, PROT_READ, PROT_WRITE}; use x11rb_async::connection::Connection; use x11rb_async::errors::{ConnectionError, ReplyError, ReplyOrIdError}; diff --git a/x11rb-protocol/src/utils.rs b/x11rb-protocol/src/utils.rs index f55a2d3b..a0632698 100644 --- a/x11rb-protocol/src/utils.rs +++ b/x11rb-protocol/src/utils.rs @@ -46,15 +46,9 @@ mod raw_fd_container { } } - impl From for RawFdContainer { - fn from(fd: OwnedFd) -> Self { - Self::new(fd) - } - } - - impl From for OwnedFd { - fn from(fd: RawFdContainer) -> Self { - fd.0 + impl> From for RawFdContainer { + fn from(fd: T) -> Self { + Self::new(fd.into()) } }