Skip to content

Commit

Permalink
Auto merge of rust-lang#592 - PlasmaPower:xattr-flags, r=alexcrichton
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed May 8, 2017
2 parents c1187f3 + 1a06678 commit c8c5d64
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
28 changes: 28 additions & 0 deletions src/unix/bsd/apple/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"),
Expand Down
3 changes: 3 additions & 0 deletions src/unix/notbsd/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit c8c5d64

Please sign in to comment.