[libc-commits] [libc] [libc] add proc number parser and sysconf wrapper (PR #194159)
via libc-commits
libc-commits at lists.llvm.org
Sat Apr 25 09:41:17 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- libc/src/__support/OSUtil/linux/syscall_wrappers/sched_getaffinity.h libc/src/__support/OSUtil/linux/sysinfo.h libc/test/src/__support/OSUtil/linux/sysinfo_test.cpp libc/include/llvm-libc-macros/linux/unistd-macros.h libc/src/unistd/linux/sysconf.cpp libc/test/src/unistd/sysconf_test.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/libc/test/src/__support/OSUtil/linux/sysinfo_test.cpp b/libc/test/src/__support/OSUtil/linux/sysinfo_test.cpp
index e4e54ff12..ff5d5dca1 100644
--- a/libc/test/src/__support/OSUtil/linux/sysinfo_test.cpp
+++ b/libc/test/src/__support/OSUtil/linux/sysinfo_test.cpp
@@ -19,7 +19,8 @@
namespace LIBC_NAMESPACE_DECL {
static int write_test_file(cpp::string_view path, cpp::string_view contents) {
- int fd = LIBC_NAMESPACE::open(path.data(), O_WRONLY | O_CREAT | O_TRUNC, 0600);
+ int fd =
+ LIBC_NAMESPACE::open(path.data(), O_WRONLY | O_CREAT | O_TRUNC, 0600);
if (fd < 0)
return fd;
@@ -39,8 +40,9 @@ TEST(LlvmLibcOSUtilSysinfoTest, PossibleCpuCountMatchesHostSysconf) {
sysinfo::parse_nproc_from(sysinfo::POSSIBLE_NPROC_PATH);
ASSERT_TRUE(static_cast<bool>(parsed));
EXPECT_EQ(*parsed, static_cast<size_t>(cpu_count));
- EXPECT_EQ(sysinfo::parse_nproc_with_fallback_from(sysinfo::POSSIBLE_NPROC_PATH),
- static_cast<size_t>(cpu_count));
+ EXPECT_EQ(
+ sysinfo::parse_nproc_with_fallback_from(sysinfo::POSSIBLE_NPROC_PATH),
+ static_cast<size_t>(cpu_count));
}
TEST(LlvmLibcOSUtilSysinfoTest, OnlineCpuCountMatchesHostSysconf) {
@@ -82,7 +84,8 @@ TEST(LlvmLibcOSUtilSysinfoTest, SyntheticCpuLists) {
EXPECT_EQ(static_cast<bool>(parsed), static_cast<bool>(test_case.expected));
if (parsed)
EXPECT_EQ(*parsed, *test_case.expected);
- EXPECT_GT(sysinfo::parse_nproc_with_fallback_from(test_file_path), size_t(0));
+ EXPECT_GT(sysinfo::parse_nproc_with_fallback_from(test_file_path),
+ size_t(0));
}
ASSERT_EQ(LIBC_NAMESPACE::unlink(test_file_path.data()), 0);
``````````
</details>
https://github.com/llvm/llvm-project/pull/194159
More information about the libc-commits
mailing list