//===-- Wrapper over SYS_statx syscall ------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLVM_LIBC_SRC_SYS_STAT_LINUX_KERNEL_STATX_H #define LLVM_LIBC_SRC_SYS_STAT_LINUX_KERNEL_STATX_H #include "src/__support/OSUtil/syscall.h" // For internal syscall function. #include "src/__support/common.h" #include "src/__support/macros/config.h" #include <stdint.h> #include <sys/stat.h> #include <sys/syscall.h> // For syscall numbers. // It is safe to include this kernel header as it is designed to be // included from user programs without causing any name pollution. #include <linux/kdev_t.h> namespace { // The type definitions in the internal namespace match kernel's definition of // the statx_timestamp and statx types in linux/stat.h. We define equivalent // types here instead of including that header file to avoid name mixup between // linux/stat.h and the libc's stat.h. struct statx_timestamp { … }; struct statx_buf { … }; // The below mask value is based on the definition of a similarly // named macro in linux/stat.h. When this flag is passed for the // mask argument to the statx syscall, all fields except the // stx_btime field will be filled in. constexpr unsigned int STATX_BASIC_STATS_MASK = …; } // Anonymous namespace namespace LIBC_NAMESPACE_DECL { LIBC_INLINE int statx(int dirfd, const char *__restrict path, int flags, struct stat *__restrict statbuf) { … } } // namespace LIBC_NAMESPACE_DECL #endif // LLVM_LIBC_SRC_SYS_STAT_LINUX_KERNEL_STATX_H