Merge pull request #87 from polachok/xattr

Add getxattr()/setxattr() variations
This commit is contained in:
Alex Crichton 2015-12-02 08:59:59 -08:00
commit 9042478bb4
2 changed files with 28 additions and 0 deletions

View file

@ -109,6 +109,10 @@ fn main() {
}
}
if linux {
cfg.header("sys/xattr.h");
}
if linux || android {
cfg.header("netpacket/packet.h");
cfg.header("net/ethernet.h");

View file

@ -334,6 +334,30 @@ extern {
len: ::off_t) -> ::c_int;
pub fn readahead(fd: ::c_int, offset: ::off64_t,
count: ::size_t) -> ::ssize_t;
pub fn getxattr(path: *const c_char, name: *const c_char,
value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
pub fn lgetxattr(path: *const c_char, name: *const c_char,
value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
pub fn fgetxattr(filedes: ::c_int, name: *const c_char,
value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
pub fn setxattr(path: *const c_char, name: *const c_char,
value: *const ::c_void, size: ::size_t,
flags: ::c_int) -> ::c_int;
pub fn lsetxattr(path: *const c_char, name: *const c_char,
value: *const ::c_void, size: ::size_t,
flags: ::c_int) -> ::c_int;
pub fn fsetxattr(filedes: ::c_int, name: *const c_char,
value: *const ::c_void, size: ::size_t,
flags: ::c_int) -> ::c_int;
pub fn listxattr(path: *const c_char, list: *mut c_char,
size: ::size_t) -> ::ssize_t;
pub fn llistxattr(path: *const c_char, list: *mut c_char,
size: ::size_t) -> ::ssize_t;
pub fn flistxattr(filedes: ::c_int, list: *mut c_char,
size: ::size_t) -> ::ssize_t;
pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int;
pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int;
pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int;
}
cfg_if! {