MCPcopy Create free account
hub / github.com/bytecodealliance/rustix / lgetxattr

Function lgetxattr

src/fs/xattr.rs:65–78  ·  view source on GitHub ↗
(
    path: P,
    name: Name,
    mut value: Buf,
)

Source from the content-addressed store, hash-verified

63/// [Linux]: https://man7.org/linux/man-pages/man2/lgetxattr.2.html
64#[inline]
65pub fn lgetxattr<P: path::Arg, Name: path::Arg, Buf: Buffer<u8>>(
66 path: P,
67 name: Name,
68 mut value: Buf,
69) -> io::Result<Buf::Output> {
70 path.into_with_c_str(|path| {
71 name.into_with_c_str(|name| {
72 // SAFETY: `lgetxattr` behaves.
73 let len = unsafe { backend::fs::syscalls::lgetxattr(path, name, value.parts_mut())? };
74 // SAFETY: `lgetxattr` behaves.
75 unsafe { Ok(value.assume_init(len)) }
76 })
77 })
78}
79
80/// `fgetxattr(fd, name, value.as_ptr(), value.len())`—Get extended
81/// filesystem attributes on an open file descriptor.

Callers

nothing calls this directly

Calls 3

into_with_c_strMethod · 0.80
parts_mutMethod · 0.80
assume_initMethod · 0.80

Tested by

no test coverage detected