Skip to content

Commit 32a93eb

Browse files
committed
Add xattr functions for OSX
1 parent c1187f3 commit 32a93eb

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ fn main() {
145145
cfg.header("mach/mach_time.h");
146146
cfg.header("malloc/malloc.h");
147147
cfg.header("util.h");
148+
cfg.header("sys/xattr.h");
148149
if target.starts_with("x86") {
149150
cfg.header("crt_externs.h");
150151
}

src/unix/bsd/apple/mod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1665,6 +1665,23 @@ extern {
16651665
pub fn getpriority(which: ::c_int, who: ::id_t) -> ::c_int;
16661666
pub fn setpriority(which: ::c_int, who: ::id_t, prio: ::c_int) -> ::c_int;
16671667

1668+
pub fn getxattr(path: *const c_char, name: *const c_char,
1669+
value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
1670+
pub fn fgetxattr(filedes: ::c_int, name: *const c_char,
1671+
value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
1672+
pub fn setxattr(path: *const c_char, name: *const c_char,
1673+
value: *const ::c_void, size: ::size_t,
1674+
flags: ::c_int) -> ::c_int;
1675+
pub fn fsetxattr(filedes: ::c_int, name: *const c_char,
1676+
value: *const ::c_void, size: ::size_t,
1677+
flags: ::c_int) -> ::c_int;
1678+
pub fn listxattr(path: *const c_char, list: *mut c_char,
1679+
size: ::size_t) -> ::ssize_t;
1680+
pub fn flistxattr(filedes: ::c_int, list: *mut c_char,
1681+
size: ::size_t) -> ::ssize_t;
1682+
pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int;
1683+
pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int;
1684+
16681685
pub fn initgroups(user: *const ::c_char, basegroup: ::c_int) -> ::c_int;
16691686

16701687
#[cfg_attr(all(target_os = "macos", target_arch = "x86"),

0 commit comments

Comments
 (0)