summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Polakov <apolyakov@beget.ru>2015-12-01 15:29:05 +0300
committerroot <admin@beget.ru>2015-12-02 12:22:01 +0300
commit30baed0f7ee9bb9f451c7cf317444b4f4e54fc62 (patch)
treeaa5907a40042e2d55b07754287aa92d4d6e5046a
parent6a13db97fb0fabb542e6459d4113cb190805a126 (diff)
downloadrust-libc-30baed0f7ee9bb9f451c7cf317444b4f4e54fc62.tar.gz
Add getxattr()/setxattr()/listxattr()/removexattr() variations
-rw-r--r--libc-test/build.rs4
-rw-r--r--src/unix/notbsd/linux/mod.rs24
2 files changed, 28 insertions, 0 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs
index 8795a85b4f..e2a0818d46 100644
--- a/libc-test/build.rs
+++ b/libc-test/build.rs
@@ -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");
diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs
index ac6d8cca32..866a9fe534 100644
--- a/src/unix/notbsd/linux/mod.rs
+++ b/src/unix/notbsd/linux/mod.rs
@@ -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! {