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

Function getxattr

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

Source from the content-addressed store, hash-verified

39/// [Apple]: https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getxattr.2.html
40#[inline]
41pub fn getxattr<P: path::Arg, Name: path::Arg, Buf: Buffer<u8>>(
42 path: P,
43 name: Name,
44 mut value: Buf,
45) -> io::Result<Buf::Output> {
46 path.into_with_c_str(|path| {
47 name.into_with_c_str(|name| {
48 // SAFETY: `getxattr` behaves.
49 let len = unsafe { backend::fs::syscalls::getxattr(path, name, value.parts_mut())? };
50 // SAFETY: `getxattr` behaves.
51 unsafe { Ok(value.assume_init(len)) }
52 })
53 })
54}
55
56/// `lgetxattr(path, name, value.as_ptr(), value.len())`—Get extended
57/// filesystem attributes, without following symlinks in the last path

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