[libc-commits] [libc] [libc] implement pathconf/fpathconf (PR #87165)
Schrodinger ZHU Yifan via libc-commits
libc-commits at lists.llvm.org
Sat Mar 30 11:56:58 PDT 2024
================
@@ -0,0 +1,60 @@
+//===-- Linux implementation of fpathconf ---------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/unistd/fsync.h"
+
+#include "src/__support/OSUtil/syscall.h" // For internal syscall function.
+#include "src/__support/common.h"
+
+#include "src/errno/libc_errno.h"
+#include <sys/syscall.h> // For syscall numbers.
+
+namespace LIBC_NAMESPACE {
+
+static long pathconfig(const struct statvfs &s, int name) {
+ switch (name) {
+ case _PC_LINK_MAX:
+ return _POSIX_LINK_MAX;
+
+ case _PC_MAX_CANON:
+ return _POSIX_MAX_CANON;
+
+ case _PC_MAX_INPUT:
+ return _POSIX_MAX_INPUT;
+
+ case _PC_NAME_MAX:
+ return _POSIX_NAME_MAX;
----------------
SchrodingerZhu wrote:
As suggested in POSIX.1-2017, one should try not to use fixed constant here.
https://github.com/llvm/llvm-project/pull/87165
More information about the libc-commits
mailing list