Skip to content

Commit 9042478

Browse files
committed
Merge pull request rust-lang#87 from polachok/xattr
Add getxattr()/setxattr() variations
2 parents 6a13db9 + 30baed0 commit 9042478

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

libc-test/build.rs

+4
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ fn main() {
109109
}
110110
}
111111

112+
if linux {
113+
cfg.header("sys/xattr.h");
114+
}
115+
112116
if linux || android {
113117
cfg.header("netpacket/packet.h");
114118
cfg.header("net/ethernet.h");

src/unix/notbsd/linux/mod.rs

+24
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,30 @@ extern {
334334
len: ::off_t) -> ::c_int;
335335
pub fn readahead(fd: ::c_int, offset: ::off64_t,
336336
count: ::size_t) -> ::ssize_t;
337+
pub fn getxattr(path: *const c_char, name: *const c_char,
338+
value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
339+
pub fn lgetxattr(path: *const c_char, name: *const c_char,
340+
value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
341+
pub fn fgetxattr(filedes: ::c_int, name: *const c_char,
342+
value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
343+
pub fn setxattr(path: *const c_char, name: *const c_char,
344+
value: *const ::c_void, size: ::size_t,
345+
flags: ::c_int) -> ::c_int;
346+
pub fn lsetxattr(path: *const c_char, name: *const c_char,
347+
value: *const ::c_void, size: ::size_t,
348+
flags: ::c_int) -> ::c_int;
349+
pub fn fsetxattr(filedes: ::c_int, name: *const c_char,
350+
value: *const ::c_void, size: ::size_t,
351+
flags: ::c_int) -> ::c_int;
352+
pub fn listxattr(path: *const c_char, list: *mut c_char,
353+
size: ::size_t) -> ::ssize_t;
354+
pub fn llistxattr(path: *const c_char, list: *mut c_char,
355+
size: ::size_t) -> ::ssize_t;
356+
pub fn flistxattr(filedes: ::c_int, list: *mut c_char,
357+
size: ::size_t) -> ::ssize_t;
358+
pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int;
359+
pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int;
360+
pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int;
337361
}
338362

339363
cfg_if! {

0 commit comments

Comments
 (0)