diff options
author | bors <bors@rust-lang.org> | 2017-05-08 14:10:43 +0000 |
---|---|---|
committer | bors <bors@rust-lang.org> | 2017-05-08 14:10:43 +0000 |
commit | c8c5d648459b17894b6520b517b793cb0041fcea (patch) | |
tree | 87461618463f01101e16e7b0be900670ca270ef4 | |
parent | c1187f30640f1f28b77d38f350a9e5c45bc4a897 (diff) | |
parent | 1a06678e30afce3e52b1ca3794fee966cf7d9ef5 (diff) | |
download | rust-libc-c8c5d648459b17894b6520b517b793cb0041fcea.tar.gz |
Auto merge of #592 - PlasmaPower:xattr-flags, r=alexcrichton
Define XATTR flags, and add XATTR functions for OSX
As found in:
http://elixir.free-electrons.com/linux/latest/source/include/uapi/linux/xattr.h
https://opensource.apple.com/source/xnu/xnu-2050.7.9/bsd/sys/xattr.h
-rw-r--r-- | libc-test/build.rs | 1 | ||||
-rw-r--r-- | src/unix/bsd/apple/mod.rs | 28 | ||||
-rw-r--r-- | src/unix/notbsd/linux/mod.rs | 3 |
3 files changed, 32 insertions, 0 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs index 1221c752a0..4b5b42e238 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -145,6 +145,7 @@ fn main() { cfg.header("mach/mach_time.h"); cfg.header("malloc/malloc.h"); cfg.header("util.h"); + cfg.header("sys/xattr.h"); if target.starts_with("x86") { cfg.header("crt_externs.h"); } diff --git a/src/unix/bsd/apple/mod.rs b/src/unix/bsd/apple/mod.rs index 6652bb8c09..6f0c55b22b 100644 --- a/src/unix/bsd/apple/mod.rs +++ b/src/unix/bsd/apple/mod.rs @@ -1516,6 +1516,13 @@ pub const P_ALL: idtype_t = 0; pub const P_PID: idtype_t = 1; pub const P_PGID: idtype_t = 2; +pub const XATTR_NOFOLLOW: ::c_int = 0x0001; +pub const XATTR_CREATE: ::c_int = 0x0002; +pub const XATTR_REPLACE: ::c_int = 0x0004; +pub const XATTR_NOSECURITY: ::c_int = 0x0008; +pub const XATTR_NODEFAULT: ::c_int = 0x0010; +pub const XATTR_SHOWCOMPRESSION: ::c_int = 0x0020; + f! { pub fn WSTOPSIG(status: ::c_int) -> ::c_int { status >> 8 @@ -1665,6 +1672,27 @@ extern { pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int; pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int; + pub fn getxattr(path: *const ::c_char, name: *const ::c_char, + value: *mut ::c_void, size: ::size_t, position: u32, + flags: ::c_int) -> ::ssize_t; + pub fn fgetxattr(filedes: ::c_int, name: *const ::c_char, + value: *mut ::c_void, size: ::size_t, position: u32, + flags: ::c_int) -> ::ssize_t; + pub fn setxattr(path: *const ::c_char, name: *const ::c_char, + value: *const ::c_void, size: ::size_t, position: u32, + flags: ::c_int) -> ::c_int; + pub fn fsetxattr(filedes: ::c_int, name: *const ::c_char, + value: *const ::c_void, size: ::size_t, position: u32, + flags: ::c_int) -> ::c_int; + pub fn listxattr(path: *const ::c_char, list: *mut ::c_char, + size: ::size_t, flags: ::c_int) -> ::ssize_t; + pub fn flistxattr(filedes: ::c_int, list: *mut ::c_char, + size: ::size_t, flags: ::c_int) -> ::ssize_t; + pub fn removexattr(path: *const ::c_char, name: *const ::c_char, + flags: ::c_int) -> ::c_int; + pub fn fremovexattr(filedes: ::c_int, name: *const ::c_char, + flags: ::c_int) -> ::c_int; + pub fn initgroups(user: *const ::c_char, basegroup: ::c_int) -> ::c_int; #[cfg_attr(all(target_os = "macos", target_arch = "x86"), diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 3827207891..1d308a3bea 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -697,6 +697,9 @@ pub const PR_CAP_AMBIENT_RAISE: ::c_int = 2; pub const PR_CAP_AMBIENT_LOWER: ::c_int = 3; pub const PR_CAP_AMBIENT_CLEAR_ALL: ::c_int = 4; +pub const XATTR_CREATE: ::c_int = 0x1; +pub const XATTR_REPLACE: ::c_int = 0x2; + f! { pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () { for slot in cpuset.bits.iter_mut() { |