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