Skip to content

Add getxattr()/setxattr() variations #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
24 changes: 24 additions & 0 deletions src/unix/notbsd/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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! {
Expand Down