[libc-commits] [libc] [libc] Add sys/xattr.h and entrypoints flistxattr, listxattr, and llistxattr. (PR #224357)
Alex Strelnikov via libc-commits
libc-commits at lists.llvm.org
Thu Sep 17 11:12:42 PDT 2026
================
@@ -7,27 +7,30 @@
//===----------------------------------------------------------------------===//
///
/// \file
-/// Syscall wrapper for flock.
+/// Syscall wrapper for flistxattr.
///
//===----------------------------------------------------------------------===//
-#ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_SYSCALL_WRAPPERS_FLOCK_H
-#define LLVM_LIBC_SRC___SUPPORT_OSUTIL_SYSCALL_WRAPPERS_FLOCK_H
+#ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_SYSCALL_WRAPPERS_FLISTXATTR_H
+#define LLVM_LIBC_SRC___SUPPORT_OSUTIL_SYSCALL_WRAPPERS_FLISTXATTR_H
-#include "src/__support/OSUtil/linux/syscall.h" // For syscall_checked
+#include "src/__support/OSUtil/linux/syscall.h"
#include "src/__support/common.h"
#include "src/__support/error_or.h"
#include "src/__support/macros/config.h"
-#include <sys/syscall.h> // For syscall numbers
+#include <sys/syscall.h>
namespace LIBC_NAMESPACE_DECL {
namespace linux_syscalls {
-LIBC_INLINE ErrorOr<int> flock(int fd, int op) {
- return syscall_checked<int>(SYS_flock, fd, op);
+LIBC_INLINE ErrorOr<ssize_t> flistxattr(int fd, char *list, size_t size) {
+ ssize_t ret = syscall_impl<ssize_t>(SYS_flistxattr, fd, list, size);
+ if (ret < 0)
+ return Error(-static_cast<int>(ret));
+ return ret;
----------------
strel-12 wrote:
Done.
https://github.com/llvm/llvm-project/pull/224357
More information about the libc-commits
mailing list