1 bitflags! { 2 pub struct FutexArg: u32 { 3 const FUTEX_WAIT = 0; 4 const FUTEX_WAKE = 1; 5 const FUTEX_FD = 2; 6 const FUTEX_REQUEUE = 3; 7 const FUTEX_CMP_REQUEUE = 4; 8 const FUTEX_WAKE_OP = 5; 9 const FUTEX_LOCK_PI = 6; 10 const FUTEX_UNLOCK_PI = 7; 11 const FUTEX_TRYLOCK_PI = 8; 12 const FUTEX_WAIT_BITSET = 9; 13 const FUTEX_WAKE_BITSET = 10; 14 const FUTEX_WAIT_REQUEUE_PI = 11; 15 const FUTEX_CMP_REQUEUE_PI = 12; 16 const FUTEX_LOCK_PI2 = 13; 17 } 18 19 pub struct FutexFlag: u32 { 20 const FLAGS_MATCH_NONE = 0x01; 21 const FLAGS_SHARED = 0x01; 22 const FLAGS_CLOCKRT = 0x02; 23 const FLAGS_HAS_TIMEOUT = 0x04; 24 const FUTEX_PRIVATE_FLAG = 128; 25 const FUTEX_CLOCK_REALTIME = 256; 26 const FUTEX_CMD_MASK = !(Self::FUTEX_PRIVATE_FLAG.bits() | Self::FUTEX_CLOCK_REALTIME.bits()); 27 } 28 29 pub struct FutexOP: u32 { 30 const FUTEX_OP_SET = 0; 31 const FUTEX_OP_ADD = 1; 32 const FUTEX_OP_OR = 2; 33 const FUTEX_OP_ANDN = 3; 34 const FUTEX_OP_XOR = 4; 35 const FUTEX_OP_OPARG_SHIFT = 8; 36 } 37 38 pub struct FutexOpCMP: u32 { 39 const FUTEX_OP_CMP_EQ = 0; 40 const FUTEX_OP_CMP_NE = 1; 41 const FUTEX_OP_CMP_LT = 2; 42 const FUTEX_OP_CMP_LE = 3; 43 const FUTEX_OP_CMP_GT = 4; 44 const FUTEX_OP_CMP_GE = 5; 45 } 46 } 47 48 #[allow(dead_code)] 49 pub const FUTEX_WAITERS: u32 = 0x80000000; 50 #[allow(dead_code)] 51 pub const FUTEX_OWNER_DIED: u32 = 0x40000000; 52 #[allow(dead_code)] 53 pub const FUTEX_TID_MASK: u32 = 0x3fffffff; 54 pub const FUTEX_BITSET_MATCH_ANY: u32 = 0xffffffff; 55