Skip to content

Commit

Permalink
Add missing futex constants
Browse files Browse the repository at this point in the history
  • Loading branch information
danielschemmel committed Jul 26, 2024
1 parent e8d9949 commit 2660b1b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
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

0 comments on commit 2660b1b

Please sign in to comment.