Skip to content

Commit ebd710e

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

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

libc-test/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ fn main() {
114114
cfg.header("linux/netlink.h");
115115
}
116116
cfg.header("sched.h");
117+
cfg.header("sys/xattr.h");
117118
}
118119

119120
if freebsd {

src/unix/notbsd/linux/mod.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,18 @@ 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, value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
338+
pub fn lgetxattr(path: *const c_char, name: *const c_char, value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
339+
pub fn fgetxattr(filedes: ::c_int, name: *const c_char, value: *mut ::c_void, size: ::size_t) -> ::ssize_t;
340+
pub fn setxattr(path: *const c_char, name: *const c_char, value: *const ::c_void, size: ::size_t, flags: ::c_int) -> ::c_int;
341+
pub fn lsetxattr(path: *const c_char, name: *const c_char, value: *const ::c_void, size: ::size_t, flags: ::c_int) -> ::c_int;
342+
pub fn fsetxattr(filedes: ::c_int, name: *const c_char, value: *const ::c_void, size: ::size_t, flags: ::c_int) -> ::c_int;
343+
pub fn listxattr(path: *const c_char, list: *mut c_char, size: ::size_t) -> ::ssize_t;
344+
pub fn llistxattr(path: *const c_char, list: *mut c_char, size: ::size_t) -> ::ssize_t;
345+
pub fn flistxattr(filedes: ::c_int, list: *mut c_char, size: ::size_t) -> ::ssize_t;
346+
pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int;
347+
pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int;
348+
pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int;
337349
}
338350

339351
cfg_if! {

0 commit comments

Comments
 (0)