[libc-commits] [libc] [libc] Add <sys/statfs.h> header and entrypoints. (PR #213108)
Jeff Bailey via libc-commits
libc-commits at lists.llvm.org
Fri Jul 31 01:18:38 PDT 2026
================
@@ -0,0 +1,33 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Linux implementation of fstatfs.
+///
+//===----------------------------------------------------------------------===//
+
+#include "src/sys/statfs/fstatfs.h"
+#include "src/__support/OSUtil/linux/syscall_wrappers/fstatfs.h"
+#include "src/__support/common.h"
+#include "src/__support/libc_errno.h"
+#include "src/__support/macros/config.h"
+#include "src/__support/macros/null_check.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(int, fstatfs, (int fd, struct statfs *buf)) {
+ LIBC_CRASH_ON_NULLPTR(buf);
----------------
kaladron wrote:
We don't need the LIBC_CRASH_ON_NULLPTR here because the kernel will gracefully handle it. We only need it if we're doing something with buf in our own code. (Here and below)
https://github.com/llvm/llvm-project/pull/213108
More information about the libc-commits
mailing list