diff options
author | bors <bors@rust-lang.org> | 2023-02-12 02:27:05 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2023-02-12 02:27:05 +0000 |
commit | 4dc004192b54f93871418a9e17a7d30554c601e3 (patch) | |
tree | 7ccfcf3de02c5c7e42e9b21a141bbb99daecdc8a /src | |
parent | 17adcf2811720173562d25b4aa5a7d4e4aa1bf46 (diff) | |
parent | c40f8e43480ef37f65235fdcb1465adeb9685b9f (diff) | |
download | rust-libc-4dc004192b54f93871418a9e17a7d30554c601e3.tar.gz |
Auto merge of #3109 - voskh0d:master, r=JohnTitor
linux: add more constants and FUTEX_OP for futex
Add FUTEX_BITSET_MATCH_ANY, FUTEX_OP_* constant and a const fonction, FUTEX_OP() to replace the macro in C.
Diffstat (limited to 'src')
-rw-r--r-- | src/unix/linux_like/linux/mod.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/unix/linux_like/linux/mod.rs b/src/unix/linux_like/linux/mod.rs index 3481dcc044..b505f39e66 100644 --- a/src/unix/linux_like/linux/mod.rs +++ b/src/unix/linux_like/linux/mod.rs @@ -3456,6 +3456,27 @@ pub const FUTEX_PRIVATE_FLAG: ::c_int = 128; pub const FUTEX_CLOCK_REALTIME: ::c_int = 256; pub const FUTEX_CMD_MASK: ::c_int = !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME); +pub const FUTEX_BITSET_MATCH_ANY: ::c_int = 0xffffffff; + +pub const FUTEX_OP_SET: ::c_int = 0; +pub const FUTEX_OP_ADD: ::c_int = 1; +pub const FUTEX_OP_OR: ::c_int = 2; +pub const FUTEX_OP_ANDN: ::c_int = 3; +pub const FUTEX_OP_XOR: ::c_int = 4; + +pub const FUTEX_OP_OPARG_SHIFT: ::c_int = 8; + +pub const FUTEX_OP_CMP_EQ: ::c_int = 0; +pub const FUTEX_OP_CMP_NE: ::c_int = 1; +pub const FUTEX_OP_CMP_LT: ::c_int = 2; +pub const FUTEX_OP_CMP_LE: ::c_int = 3; +pub const FUTEX_OP_CMP_GT: ::c_int = 4; +pub const FUTEX_OP_CMP_GE: ::c_int = 5; + +pub fn FUTEX_OP(op: ::c_int, oparg: ::c_int, cmp: ::c_int, cmparg: ::c_int) -> ::c_int { + ((op & 0xf) << 28) | ((cmp & 0xf) << 24) | ((oparg & 0xfff) << 12) | (cmparg & 0xfff) +} + // linux/reboot.h pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead; pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793; |