[libc-commits] [libc] [libc] Implement if_nametoindex and if_indextoname (PR #206082)

via libc-commits libc-commits at lists.llvm.org
Fri Jun 26 08:17:11 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/hdr/types/struct_ifreq.h libc/include/llvm-libc-macros/linux/net-if-macros.h libc/include/llvm-libc-macros/net-if-macros.h libc/include/llvm-libc-types/struct_ifreq.h libc/src/net/if_indextoname.h libc/src/net/if_nametoindex.h libc/src/net/linux/if_indextoname.cpp libc/src/net/linux/if_nametoindex.cpp libc/test/src/net/linux/if_indextoname_test.cpp libc/test/src/net/linux/if_nametoindex_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/src/net/linux/if_nametoindex.cpp b/libc/src/net/linux/if_nametoindex.cpp
index ecc64ea9a..507e7f59f 100644
--- a/libc/src/net/linux/if_nametoindex.cpp
+++ b/libc/src/net/linux/if_nametoindex.cpp
@@ -14,6 +14,7 @@
 #include "src/net/if_nametoindex.h"
 #include "hdr/errno_macros.h"
 #include "hdr/net_if_macros.h"
+#include "hdr/sys_ioctl_macros.h"
 #include "hdr/sys_socket_macros.h"
 #include "hdr/types/struct_ifreq.h"
 #include "src/__support/CPP/string_view.h"
@@ -23,7 +24,6 @@
 #include "src/__support/common.h"
 #include "src/__support/libc_errno.h"
 #include "src/__support/macros/null_check.h"
-#include "hdr/sys_ioctl_macros.h"
 #include "src/string/memory_utils/inline_memcpy.h"
 
 namespace LIBC_NAMESPACE_DECL {
diff --git a/libc/test/src/net/linux/if_nametoindex_test.cpp b/libc/test/src/net/linux/if_nametoindex_test.cpp
index fc74b38ec..353b781a0 100644
--- a/libc/test/src/net/linux/if_nametoindex_test.cpp
+++ b/libc/test/src/net/linux/if_nametoindex_test.cpp
@@ -11,8 +11,8 @@
 ///
 //===----------------------------------------------------------------------===//
 
-#include "src/net/if_nametoindex.h"
 #include "hdr/errno_macros.h"
+#include "src/net/if_nametoindex.h"
 #include "test/UnitTest/ErrnoCheckingTest.h"
 #include "test/UnitTest/Test.h"
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/206082


More information about the libc-commits mailing list