Skip to content

Commit 676a4f8

Browse files
committed
linux: Move membarrier.h constants to src/new
(backport <#4915>) (cherry picked from commit 68d3a77)
1 parent 0803fae commit 676a4f8

File tree

6 files changed

+33
-16
lines changed

6 files changed

+33
-16
lines changed

libc-test/build.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,7 +1737,6 @@ fn test_dragonflybsd(target: &str) {
17371737
"sem_t" => true,
17381738
// mqd_t is a pointer on DragonFly
17391739
"mqd_t" => true,
1740-
17411740
_ => false,
17421741
}
17431742
});
@@ -4653,16 +4652,23 @@ fn test_linux(target: &str) {
46534652
});
46544653

46554654
let c_enums = [
4656-
"tpacket_versions",
4657-
"proc_cn_mcast_op",
4658-
"proc_cn_event",
4655+
"membarrier_cmd",
46594656
"pid_type",
4657+
"proc_cn_event",
4658+
"proc_cn_mcast_op",
4659+
"tpacket_versions",
46604660
];
46614661
cfg.alias_is_c_enum(move |e| c_enums.contains(&e));
46624662

46634663
// FIXME(libc): `pid_type` and `proc_cn_event` is hidden.
46644664
cfg.skip_c_enum(|e| e == "pid_type" || e == "proc_cn_event");
46654665

4666+
cfg.skip_signededness(move |c| match c {
4667+
// FIXME(1.0): uses the enum default signedness
4668+
"membarrier_cmd" => true,
4669+
_ => false,
4670+
});
4671+
46664672
cfg.skip_fn(move |function| {
46674673
let name = function.ident();
46684674
// skip those that are manually verified

libc-test/semver/linux.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4086,6 +4086,7 @@ madvise
40864086
major
40874087
makedev
40884088
memalign
4089+
membarrier_cmd
40894090
memmem
40904091
memrchr
40914092
mincore
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//! Header: `uapi/linux/membarrier.h`
2+
3+
use crate::prelude::*;
4+
5+
c_enum! {
6+
// FIXME(1.0): incorrect repr signedness, this should be removed in a breaking change.
7+
#[repr(c_int)]
8+
pub enum membarrier_cmd {
9+
pub MEMBARRIER_CMD_QUERY = 0,
10+
pub MEMBARRIER_CMD_GLOBAL = 1 << 0,
11+
pub MEMBARRIER_CMD_GLOBAL_EXPEDITED = 1 << 1,
12+
pub MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED = 1 << 2,
13+
pub MEMBARRIER_CMD_PRIVATE_EXPEDITED = 1 << 3,
14+
pub MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED = 1 << 4,
15+
pub MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE = 1 << 5,
16+
pub MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE = 1 << 6,
17+
pub MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ = 1 << 7,
18+
pub MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ = 1 << 8,
19+
}
20+
}

src/new/linux_uapi/linux/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
55
pub(crate) mod can;
66
pub(crate) mod keyctl;
7+
pub(crate) mod membarrier;
78
pub(crate) mod netlink;

src/new/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ cfg_if! {
181181
pub use linux::can::raw::*;
182182
pub use linux::can::*;
183183
pub use linux::keyctl::*;
184+
pub use linux::membarrier::*;
184185
pub use linux::netlink::*;
185186
#[cfg(target_env = "gnu")]
186187
pub use net::route::*;

src/unix/linux_like/linux/mod.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,18 +1557,6 @@ pub const MPOL_F_NUMA_BALANCING: c_int = 1 << 13;
15571557
pub const MPOL_F_RELATIVE_NODES: c_int = 1 << 14;
15581558
pub const MPOL_F_STATIC_NODES: c_int = 1 << 15;
15591559

1560-
// linux/membarrier.h
1561-
pub const MEMBARRIER_CMD_QUERY: c_int = 0;
1562-
pub const MEMBARRIER_CMD_GLOBAL: c_int = 1 << 0;
1563-
pub const MEMBARRIER_CMD_GLOBAL_EXPEDITED: c_int = 1 << 1;
1564-
pub const MEMBARRIER_CMD_REGISTER_GLOBAL_EXPEDITED: c_int = 1 << 2;
1565-
pub const MEMBARRIER_CMD_PRIVATE_EXPEDITED: c_int = 1 << 3;
1566-
pub const MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED: c_int = 1 << 4;
1567-
pub const MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE: c_int = 1 << 5;
1568-
pub const MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_SYNC_CORE: c_int = 1 << 6;
1569-
pub const MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ: c_int = 1 << 7;
1570-
pub const MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ: c_int = 1 << 8;
1571-
15721560
pub const PTHREAD_MUTEX_INITIALIZER: crate::pthread_mutex_t = crate::pthread_mutex_t {
15731561
size: [0; crate::__SIZEOF_PTHREAD_MUTEX_T],
15741562
};

0 commit comments

Comments
 (0)