[libc-commits] [libc] [libc] Implement getifaddrs for link-level (AF_PACKET) entries (PR #246355)

Pavel Labath via libc-commits libc-commits at lists.llvm.org
Fri Nov 27 00:24:58 PST 2026


================
@@ -12,15 +12,18 @@
 //===----------------------------------------------------------------------===//
 
 #include "src/ifaddrs/freeifaddrs.h"
+#include "hdr/stdint_proxy.h"
 #include "hdr/types/struct_ifaddrs.h"
+#include "src/__support/CPP/new.h"
 #include "src/__support/common.h"
 #include "src/__support/macros/config.h"
 
 namespace LIBC_NAMESPACE_DECL {
 
-LLVM_LIBC_FUNCTION(void, freeifaddrs, ([[maybe_unused]] struct ifaddrs * ifa)) {
-  // TODO: Implement freeifaddrs.
-  return;
+LLVM_LIBC_FUNCTION(void, freeifaddrs, (struct ifaddrs * ifa)) {
+  // ifa was allocated in net::getifaddrs() as a single contiguous uint8_t[]
+  // buffer holding all the list elements and the data they point to.
+  delete[] reinterpret_cast<uint8_t *>(ifa);
----------------
labath wrote:

This one.

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


More information about the libc-commits mailing list