Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux: add more constants and FUTEX_OP for futex #3109

Merged
merged 2 commits into from
Feb 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions libc-test/semver/linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -724,13 +724,27 @@ FIONCLEX
FIONREAD
FLUSHO
FOPEN_MAX
FUTEX_BITSET_MATCH_ANY
FUTEX_CLOCK_REALTIME
FUTEX_CMD_MASK
FUTEX_CMP_REQUEUE
FUTEX_CMP_REQUEUE_PI
FUTEX_FD
FUTEX_LOCK_PI
FUTEX_LOCK_PI2
FUTEX_OP
FUTEX_OP_ADD
FUTEX_OP_ANDN
FUTEX_OP_CMP_EQ
FUTEX_OP_CMP_GE
FUTEX_OP_CMP_GT
FUTEX_OP_CMP_LE
FUTEX_OP_CMP_LT
FUTEX_OP_CMP_NE
FUTEX_OP_OPARG_SHIFT
FUTEX_OP_OR
FUTEX_OP_SET
FUTEX_OP_XOR
FUTEX_PRIVATE_FLAG
FUTEX_REQUEUE
FUTEX_TRYLOCK_PI
Expand Down
21 changes: 21 additions & 0 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down