diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 93020fa7..d6ed62da 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,13 +23,6 @@ jobs: - { target: x86_64-pc-windows-msvc, os: windows-latest } - { target: i686-pc-windows-msvc, os: windows-latest } features: ["", "force-inprocess", "async"] - include: - - features: "" - platform: { target: x86_64-pc-windows-msvc, os: windows-latest } - - features: "" - platform: { target: i686-pc-windows-msvc, os: windows-latest } - - features: "memfd" - platform: { target: x86_64-unknown-linux-gnu, os: ubuntu-latest } steps: - uses: actions/checkout@v4 diff --git a/Cargo.toml b/Cargo.toml index 646b4001..7fd5f50a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,6 @@ harness = false [features] default = [] force-inprocess = [] -memfd = [] async = ["futures", "futures-test"] win32-trace = [] diff --git a/src/lib.rs b/src/lib.rs index 1e0a7d1a..cd91515f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,12 +19,6 @@ //! The `inprocess` backend is a dummy back-end, that behaves like the real ones, //! but doesn't actually work between processes. //! -//! ## `memfd` -//! -//! Use [memfd_create] to back [OsIpcSharedMemory] on Linux. [memfd_create] was -//! introduced in kernel version 3.17. __WARNING:__ Enabling this feature with kernel -//! version less than 3.17 will cause panics on any use of [IpcSharedMemory]. -//! //! ## `unstable` //! //! [IpcReceiver]: ipc/struct.IpcReceiver.html @@ -32,7 +26,6 @@ //! [IpcReceiverSet]: ipc/struct.IpcReceiverSet.html //! [IpcSharedMemory]: ipc/struct.IpcSharedMemory.html //! [OsIpcSharedMemory]: platform/struct.OsIpcSharedMemory.html -//! [memfd_create]: http://man7.org/linux/man-pages/man2/memfd_create.2.html #[cfg(any( feature = "force-inprocess", @@ -40,11 +33,7 @@ target_os = "android", target_os = "ios" ))] -#[cfg(all( - feature = "memfd", - not(feature = "force-inprocess"), - target_os = "linux" -))] +#[cfg(all(not(feature = "force-inprocess"), target_os = "linux"))] #[cfg(feature = "async")] use futures; diff --git a/src/platform/unix/mod.rs b/src/platform/unix/mod.rs index fcd536ce..7ff1cd4e 100644 --- a/src/platform/unix/mod.rs +++ b/src/platform/unix/mod.rs @@ -1120,29 +1120,11 @@ fn new_msghdr(iovec: &mut [iovec], cmsg_buffer: *mut cmsghdr, cmsg_space: MsgCon msghdr } -#[cfg(not(all(target_os = "linux", feature = "memfd")))] -fn create_shmem(name: CString, length: usize) -> c_int { - unsafe { - // NB: the FreeBSD man page for shm_unlink states that it requires - // write permissions, but testing shows that read-write is required. - let fd = libc::shm_open( - name.as_ptr(), - libc::O_CREAT | libc::O_RDWR | libc::O_EXCL, - 0o600, - ); - assert!(fd >= 0); - assert!(libc::shm_unlink(name.as_ptr()) == 0); - assert!(libc::ftruncate(fd, length as off_t) == 0); - fd - } -} - -#[cfg(all(feature = "memfd", target_os = "linux"))] fn create_shmem(name: CString, length: usize) -> c_int { unsafe { let fd = libc::memfd_create(name.as_ptr(), libc::MFD_CLOEXEC); assert!(fd >= 0); - assert!(libc::ftruncate(fd, length as off_t) == 0); + assert_eq!(libc::ftruncate(fd, length as off_t), 0); fd } }