[libc-commits] [libc] [libc] Add protocol family constants (PR #206911)

Pavel Labath via libc-commits libc-commits at lists.llvm.org
Wed Jul 1 01:56:23 PDT 2026


https://github.com/labath created https://github.com/llvm/llvm-project/pull/206911

These aren't in POSIX, but are in 4.2BSD and they're still widely used.

>From 18f26b4c2922ac19992fb9386726f7d93f84a7d9 Mon Sep 17 00:00:00 2001
From: Pavel Labath <pavel at labath.sk>
Date: Wed, 1 Jul 2026 08:49:25 +0000
Subject: [PATCH] [libc] Add protocol family constants

These aren't in POSIX, but are in 4.2BSD and they're still widely used.
---
 libc/include/llvm-libc-macros/linux/sys-socket-macros.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libc/include/llvm-libc-macros/linux/sys-socket-macros.h b/libc/include/llvm-libc-macros/linux/sys-socket-macros.h
index 1d38d840aa342..5478521be02b6 100644
--- a/libc/include/llvm-libc-macros/linux/sys-socket-macros.h
+++ b/libc/include/llvm-libc-macros/linux/sys-socket-macros.h
@@ -18,6 +18,13 @@
 #define AF_INET 2   // Internet IPv4 Protocol
 #define AF_INET6 10 // IP version 6
 
+// 4.2BSD protocol families
+#define PF_UNSPEC AF_UNSPEC
+#define PF_UNIX AF_UNIX
+#define PF_LOCAL AF_LOCAL
+#define PF_INET AF_INET
+#define PF_INET6 AF_INET6
+
 #define SOCK_STREAM 1
 #define SOCK_DGRAM 2
 #define SOCK_RAW 3



More information about the libc-commits mailing list