Skip to content

Commit a3e79eb

Browse files
committed
Auto merge of rust-lang#594 - PlasmaPower:linux-enoattr, r=alexcrichton
Add ENOATTR for Linux It's defined differently for OSX and *BSD, so having a Linux definition is helpful for cross-platform code.
2 parents a285387 + 98889cf commit a3e79eb

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

libc-test/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,10 @@ fn main() {
404404
"MADV_MERGEABLE" | "MADV_UNMERGEABLE" | "MADV_HWPOISON" | "IPV6_ADD_MEMBERSHIP" | "IPV6_DROP_MEMBERSHIP" | "IPV6_MULTICAST_LOOP" | "IPV6_V6ONLY" |
405405
"MAP_STACK" | "RTLD_DEEPBIND" | "SOL_IPV6" | "SOL_ICMPV6" if uclibc => true,
406406

407+
// Defined by libattr not libc on linux (hard to test).
408+
// See constant definition for more details.
409+
"ENOATTR" if linux => true,
410+
407411
_ => false,
408412
}
409413
});

src/unix/notbsd/linux/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,11 @@ pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4;
700700
pub const XATTR_CREATE: ::c_int = 0x1;
701701
pub const XATTR_REPLACE: ::c_int = 0x2;
702702

703+
// On Linux, libc doesn't define this constant, libattr does instead.
704+
// We still define it for Linux as it's defined by libc on other platforms,
705+
// and it's mentioned in the man pages for getxattr and setxattr.
706+
pub const ENOATTR: ::c_int = ::ENODATA;
707+
703708
f! {
704709
pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
705710
for slot in cpuset.bits.iter_mut() {

0 commit comments

Comments
 (0)