Skip to content

Commit 460ca55

Browse files
Alexander Polakovroot
Alexander Polakov
authored and
root
committed
Add getxattr()/setxattr()/listxattr()/removexattr() variations
1 parent 0af5e23 commit 460ca55

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

libc-test/build.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ fn main() {
104104
}
105105
}
106106

107+
if linux {
108+
cfg.header("sys/xattr.h");
109+
}
110+
107111
if linux || android {
108112
cfg.header("netpacket/packet.h");
109113
cfg.header("net/ethernet.h");

src/unix/notbsd/linux/mod.rs

Lines changed: 24 additions & 0 deletions
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)