[libc-commits] [libc] [libc] Add if_nameindex and if_freenameindex as an experimental entrypoint (PR #208438)
Pavel Labath via libc-commits
libc-commits at lists.llvm.org
Wed Jul 15 05:51:02 PDT 2026
================
@@ -0,0 +1,148 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+/// Internal templatized implementation of if_nameindex for Linux.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_NET_LINUX_IF_NAMEINDEX_H
+#define LLVM_LIBC_SRC_NET_LINUX_IF_NAMEINDEX_H
+
+#include "hdr/errno_macros.h"
+#include "hdr/net_if_macros.h"
+#include "hdr/sys_socket_macros.h"
+#include "hdr/types/socklen_t.h"
+#include "hdr/types/ssize_t.h"
+#include "hdr/types/struct_if_nameindex.h"
+#include "src/__support/CPP/new.h"
+#include "src/__support/CPP/scope.h"
+#include "src/__support/CPP/span.h"
+#include "src/__support/alloc-checker.h"
+#include "src/__support/common.h"
+#include "src/__support/error_or.h"
+#include "src/string/memory_utils/inline_memcpy.h"
+#include "src/string/string_utils.h"
+
+#include <linux/netlink.h>
+#include <linux/rtnetlink.h>
----------------
labath wrote:
Are you sure about that? The way I see it, there's nothing to proxy to. These are structures/constants that only exist in the linux kernel header tree. Glibc does not (re)expose these structures through its own headers, so regardless of the build mode we will eventually need to end up including these files.
We're also not exposing these structures, as we're including this just for our internal consumption. The public api is if_nameindex, which doesn't reference this.
https://github.com/llvm/llvm-project/pull/208438
More information about the libc-commits
mailing list