Skip to content

Add missing futex operations #1097

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/backend/libc/thread/futex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,18 @@ pub enum FutexOperation {
TrylockPi = bitcast!(c::FUTEX_TRYLOCK_PI),
/// `FUTEX_WAIT_BITSET`
WaitBitset = bitcast!(c::FUTEX_WAIT_BITSET),
/// `FUTEX_WAKE_BITSET`
WakeBitset = bitcast!(c::FUTEX_WAKE_BITSET),
/// `FUTEX_WAIT_REQUEUE_PI`
WaitRequeuePi = bitcast!(c::FUTEX_WAIT_REQUEUE_PI),
/// `FUTEX_CMP_REQUEUE_PI`
CmpRequeuePi = bitcast!(c::FUTEX_CMP_REQUEUE_PI),
/// `FUTEX_LOCK_PI2`
LockPi2 = bitcast!(c::FUTEX_LOCK_PI2),
}

/// `FUTEX_WAITERS`
pub const FUTEX_WAITERS: u32 = 0x80000000;

/// `FUTEX_OWNER_DIED`
pub const FUTEX_OWNER_DIED: u32 = 0x40000000;
14 changes: 14 additions & 0 deletions src/backend/linux_raw/thread/futex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,18 @@ pub enum FutexOperation {
TrylockPi = linux_raw_sys::general::FUTEX_TRYLOCK_PI,
/// `FUTEX_WAIT_BITSET`
WaitBitset = linux_raw_sys::general::FUTEX_WAIT_BITSET,
/// `FUTEX_WAKE_BITSET`
WakeBitset = linux_raw_sys::general::FUTEX_WAKE_BITSET,
/// `FUTEX_WAIT_REQUEUE_PI`
WaitRequeuePi = linux_raw_sys::general::FUTEX_WAIT_REQUEUE_PI,
/// `FUTEX_CMP_REQUEUE_PI`
CmpRequeuePi = linux_raw_sys::general::FUTEX_CMP_REQUEUE_PI,
/// `FUTEX_LOCK_PI2`
LockPi2 = linux_raw_sys::general::FUTEX_LOCK_PI2,
}

/// `FUTEX_WAITERS`
pub const FUTEX_WAITERS: u32 = linux_raw_sys::general::FUTEX_WAITERS;

/// `FUTEX_OWNER_DIED`
pub const FUTEX_OWNER_DIED: u32 = linux_raw_sys::general::FUTEX_OWNER_DIED;
5 changes: 5 additions & 0 deletions src/thread/futex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ use crate::{backend, io};

pub use backend::thread::futex::{FutexFlags, FutexOperation};

/// `FUTEX_WAITERS`
pub const FUTEX_WAITERS: u32 = backend::thread::futex::FUTEX_WAITERS;
/// `FUTEX_OWNER_DIED`
pub const FUTEX_OWNER_DIED: u32 = backend::thread::futex::FUTEX_OWNER_DIED;

/// `futex(uaddr, op, val, utime, uaddr2, val3)`
///
/// # References
Expand Down
2 changes: 1 addition & 1 deletion src/thread/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ mod setns;
#[cfg(not(target_os = "redox"))]
pub use clock::*;
#[cfg(linux_kernel)]
pub use futex::{futex, FutexFlags, FutexOperation};
pub use futex::{futex, FutexFlags, FutexOperation, FUTEX_OWNER_DIED, FUTEX_WAITERS};
#[cfg(linux_kernel)]
pub use id::{
gettid, set_thread_gid, set_thread_groups, set_thread_res_gid, set_thread_res_uid,
Expand Down
Loading