Skip to content

Commit 703c2db

Browse files
Enable statx for musl
1 parent c1d2b8e commit 703c2db

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

libc-test/build.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5525,9 +5525,9 @@ fn test_aix(target: &str) {
55255525
});
55265526

55275527
cfg.type_name(move |ty, is_struct, is_union| match ty {
5528-
"DIR" => ty.to_string(),
5529-
"FILE" => ty.to_string(),
5530-
"ACTION" => ty.to_string(),
5528+
"DIR" => ty.to_string(),
5529+
"FILE" => ty.to_string(),
5530+
"ACTION" => ty.to_string(),
55315531

55325532
// 'sigval' is a struct in Rust, but a union in C.
55335533
"sigval" => format!("union sigval"),
@@ -5614,9 +5614,9 @@ fn test_aix(target: &str) {
56145614
// POSIX-compliant versions in the system libc. As a result,
56155615
// function pointer comparisons between the C and Rust sides
56165616
// would fail.
5617-
"getpwuid_r" | "getpwnam_r" | "getgrgid_r" | "getgrnam_r"
5618-
| "aio_cancel" | "aio_error" | "aio_fsync" | "aio_read"
5619-
| "aio_return" | "aio_suspend" | "aio_write" | "select" => true,
5617+
"getpwuid_r" | "getpwnam_r" | "getgrgid_r" | "getgrnam_r" | "aio_cancel"
5618+
| "aio_error" | "aio_fsync" | "aio_read" | "aio_return" | "aio_suspend"
5619+
| "aio_write" | "select" => true,
56205620

56215621
// 'getdtablesize' is a constant in the AIX header but it is
56225622
// a real function in libc which the Rust side is resolved to.
@@ -5633,7 +5633,6 @@ fn test_aix(target: &str) {
56335633
}
56345634
});
56355635

5636-
56375636
cfg.volatile_item(|i| {
56385637
use ctest::VolatileItemKind::*;
56395638
match i {

libc-test/test/cmsg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ mod t {
7070
for cmsg_len in 0..64 {
7171
// Address must be a multiple of 0x4 for testing on AIX.
7272
if cfg!(target_os = "aix") && cmsg_len % std::mem::size_of::<cmsghdr>() != 0 {
73-
continue;
73+
continue;
7474
}
7575
for next_cmsg_len in 0..32 {
7676
unsafe {

src/unix/aix/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
use crate::in_addr_t;
2-
use crate::in_port_t;
31
use crate::prelude::*;
2+
use crate::{in_addr_t, in_port_t};
43

54
pub type caddr_t = *mut c_char;
65
pub type clockid_t = c_longlong;

src/unix/linux_like/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ cfg_if! {
239239
}
240240

241241
cfg_if! {
242-
if #[cfg(any(target_env = "gnu", target_os = "android"))] {
242+
if #[cfg(any(target_env = "gnu", target_os = "android", target_env = "musl"))] {
243243
s! {
244244
pub struct statx {
245245
pub stx_mask: crate::__u32,
@@ -1709,7 +1709,7 @@ cfg_if! {
17091709
}
17101710

17111711
cfg_if! {
1712-
if #[cfg(any(target_env = "gnu", target_os = "android"))] {
1712+
if #[cfg(any(target_env = "gnu", target_os = "android", target_env = "musl"))] {
17131713
pub const AT_STATX_SYNC_TYPE: c_int = 0x6000;
17141714
pub const AT_STATX_SYNC_AS_STAT: c_int = 0x0000;
17151715
pub const AT_STATX_FORCE_SYNC: c_int = 0x2000;
@@ -2206,7 +2206,7 @@ cfg_if! {
22062206

22072207
// The statx syscall, available on some libcs.
22082208
cfg_if! {
2209-
if #[cfg(any(target_env = "gnu", target_os = "android"))] {
2209+
if #[cfg(any(target_env = "gnu", target_os = "android", target_env = "musl"))] {
22102210
extern "C" {
22112211
pub fn statx(
22122212
dirfd: c_int,

0 commit comments

Comments
 (0)