17f3c40a6SNhat Nguyen //===-- Linux implementation of pathconf ----------------------------------===// 27f3c40a6SNhat Nguyen // 37f3c40a6SNhat Nguyen // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 47f3c40a6SNhat Nguyen // See https://llvm.org/LICENSE.txt for license information. 57f3c40a6SNhat Nguyen // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 67f3c40a6SNhat Nguyen // 77f3c40a6SNhat Nguyen //===----------------------------------------------------------------------===// 87f3c40a6SNhat Nguyen 97f3c40a6SNhat Nguyen #include "src/unistd/pathconf.h" 10*5ff3ff33SPetr Hosek #include "src/__support/macros/config.h" 117f3c40a6SNhat Nguyen #include "src/errno/libc_errno.h" 127f3c40a6SNhat Nguyen #include "src/sys/statvfs/linux/statfs_utils.h" 137f3c40a6SNhat Nguyen #include "src/unistd/linux/pathconf_utils.h" 147f3c40a6SNhat Nguyen 15*5ff3ff33SPetr Hosek namespace LIBC_NAMESPACE_DECL { 167f3c40a6SNhat Nguyen 177f3c40a6SNhat Nguyen LLVM_LIBC_FUNCTION(long, pathconf, (const char *path, int name)) { 187f3c40a6SNhat Nguyen if (cpp::optional<statfs_utils::LinuxStatFs> result = 197f3c40a6SNhat Nguyen statfs_utils::linux_statfs(path)) 207f3c40a6SNhat Nguyen return pathconfig(result.value(), name); 217f3c40a6SNhat Nguyen return -1; 227f3c40a6SNhat Nguyen } 237f3c40a6SNhat Nguyen 24*5ff3ff33SPetr Hosek } // namespace LIBC_NAMESPACE_DECL 25