[libc-commits] [libc] [libc] Add syscall wrappers for prlimit64 and sysinfo (PR #204141)
Jeff Bailey via libc-commits
libc-commits at lists.llvm.org
Wed Jun 17 05:57:52 PDT 2026
https://github.com/kaladron updated https://github.com/llvm/llvm-project/pull/204141
>From 56c34b2b5f18bd95dff78ef4af3f64400634b349 Mon Sep 17 00:00:00 2001
From: Jeff Bailey <jbailey at raspberryginger.com>
Date: Tue, 16 Jun 2026 12:45:49 +0100
Subject: [PATCH] [libc] Add syscall wrapper for sysinfo
---
.../linux/syscall_wrappers/CMakeLists.txt | 11 ++++++
.../OSUtil/linux/syscall_wrappers/sysinfo.h | 34 +++++++++++++++++++
2 files changed, 45 insertions(+)
create mode 100644 libc/src/__support/OSUtil/linux/syscall_wrappers/sysinfo.h
diff --git a/libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt b/libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt
index 731e5a1d462ab..a52be9676a3ca 100644
--- a/libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt
+++ b/libc/src/__support/OSUtil/linux/syscall_wrappers/CMakeLists.txt
@@ -774,3 +774,14 @@ add_header_library(
libc.include.sys_syscall
)
+add_header_library(
+ sysinfo
+ HDRS
+ sysinfo.h
+ DEPENDS
+ libc.src.__support.OSUtil.osutil
+ libc.src.__support.common
+ libc.src.__support.error_or
+ libc.src.__support.macros.config
+ libc.include.sys_syscall
+)
diff --git a/libc/src/__support/OSUtil/linux/syscall_wrappers/sysinfo.h b/libc/src/__support/OSUtil/linux/syscall_wrappers/sysinfo.h
new file mode 100644
index 0000000000000..7487d05353c5b
--- /dev/null
+++ b/libc/src/__support/OSUtil/linux/syscall_wrappers/sysinfo.h
@@ -0,0 +1,34 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+/// Syscall wrapper for sysinfo.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC___SUPPORT_OSUTIL_SYSCALL_WRAPPERS_SYSINFO_H
+#define LLVM_LIBC_SRC___SUPPORT_OSUTIL_SYSCALL_WRAPPERS_SYSINFO_H
+
+#include "src/__support/OSUtil/linux/syscall.h" // For syscall_checked
+#include "src/__support/common.h"
+#include "src/__support/error_or.h"
+#include "src/__support/macros/config.h"
+#include <linux/sysinfo.h> // For struct sysinfo
+#include <sys/syscall.h> // For syscall numbers
+
+namespace LIBC_NAMESPACE_DECL {
+namespace linux_syscalls {
+
+LIBC_INLINE ErrorOr<int> sysinfo(struct ::sysinfo *info) {
+ return syscall_checked<int>(SYS_sysinfo, info);
+}
+
+} // namespace linux_syscalls
+} // namespace LIBC_NAMESPACE_DECL
+
+#endif // LLVM_LIBC_SRC___SUPPORT_OSUTIL_SYSCALL_WRAPPERS_SYSINFO_H
More information about the libc-commits
mailing list