25 lines · cpp
1//===-- Linux implementation of pathconf ----------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9#include "src/unistd/pathconf.h"10#include "src/__support/libc_errno.h"11#include "src/__support/macros/config.h"12#include "src/sys/statvfs/linux/statfs_utils.h"13#include "src/unistd/linux/pathconf_utils.h"14 15namespace LIBC_NAMESPACE_DECL {16 17LLVM_LIBC_FUNCTION(long, pathconf, (const char *path, int name)) {18 if (cpp::optional<statfs_utils::LinuxStatFs> result =19 statfs_utils::linux_statfs(path))20 return pathconfig(result.value(), name);21 return -1;22}23 24} // namespace LIBC_NAMESPACE_DECL25