Skip to content

Commit 4dc0041

Browse files
committed
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.
2 parents 17adcf2 + c40f8e4 commit 4dc0041

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

libc-test/semver/linux.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,13 +724,27 @@ FIONCLEX
724724
FIONREAD
725725
FLUSHO
726726
FOPEN_MAX
727+
FUTEX_BITSET_MATCH_ANY
727728
FUTEX_CLOCK_REALTIME
728729
FUTEX_CMD_MASK
729730
FUTEX_CMP_REQUEUE
730731
FUTEX_CMP_REQUEUE_PI
731732
FUTEX_FD
732733
FUTEX_LOCK_PI
733734
FUTEX_LOCK_PI2
735+
FUTEX_OP
736+
FUTEX_OP_ADD
737+
FUTEX_OP_ANDN
738+
FUTEX_OP_CMP_EQ
739+
FUTEX_OP_CMP_GE
740+
FUTEX_OP_CMP_GT
741+
FUTEX_OP_CMP_LE
742+
FUTEX_OP_CMP_LT
743+
FUTEX_OP_CMP_NE
744+
FUTEX_OP_OPARG_SHIFT
745+
FUTEX_OP_OR
746+
FUTEX_OP_SET
747+
FUTEX_OP_XOR
734748
FUTEX_PRIVATE_FLAG
735749
FUTEX_REQUEUE
736750
FUTEX_TRYLOCK_PI

src/unix/linux_like/linux/mod.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3456,6 +3456,27 @@ pub const FUTEX_PRIVATE_FLAG: ::c_int = 128;
34563456
pub const FUTEX_CLOCK_REALTIME: ::c_int = 256;
34573457
pub const FUTEX_CMD_MASK: ::c_int = !(FUTEX_PRIVATE_FLAG | FUTEX_CLOCK_REALTIME);
34583458

3459+
pub const FUTEX_BITSET_MATCH_ANY: ::c_int = 0xffffffff;
3460+
3461+
pub const FUTEX_OP_SET: ::c_int = 0;
3462+
pub const FUTEX_OP_ADD: ::c_int = 1;
3463+
pub const FUTEX_OP_OR: ::c_int = 2;
3464+
pub const FUTEX_OP_ANDN: ::c_int = 3;
3465+
pub const FUTEX_OP_XOR: ::c_int = 4;
3466+
3467+
pub const FUTEX_OP_OPARG_SHIFT: ::c_int = 8;
3468+
3469+
pub const FUTEX_OP_CMP_EQ: ::c_int = 0;
3470+
pub const FUTEX_OP_CMP_NE: ::c_int = 1;
3471+
pub const FUTEX_OP_CMP_LT: ::c_int = 2;
3472+
pub const FUTEX_OP_CMP_LE: ::c_int = 3;
3473+
pub const FUTEX_OP_CMP_GT: ::c_int = 4;
3474+
pub const FUTEX_OP_CMP_GE: ::c_int = 5;
3475+
3476+
pub fn FUTEX_OP(op: ::c_int, oparg: ::c_int, cmp: ::c_int, cmparg: ::c_int) -> ::c_int {
3477+
((op & 0xf) << 28) | ((cmp & 0xf) << 24) | ((oparg & 0xfff) << 12) | (cmparg & 0xfff)
3478+
}
3479+
34593480
// linux/reboot.h
34603481
pub const LINUX_REBOOT_MAGIC1: ::c_int = 0xfee1dead;
34613482
pub const LINUX_REBOOT_MAGIC2: ::c_int = 672274793;

0 commit comments

Comments
 (0)