[libc-commits] [libc] [libc] Add struct cmsghdr and associated macros (PR #193756)

Jeff Bailey via libc-commits libc-commits at lists.llvm.org
Thu Apr 23 07:50:30 PDT 2026


================
@@ -50,4 +50,23 @@
 #define SHUT_WR 1
 #define SHUT_RDWR 2
 
+#define SCM_RIGHTS 1
+
+#define CMSG_ALIGN(len) (((len) + sizeof(size_t) - 1) & ~(sizeof(size_t) - 1))
+#define CMSG_LEN(len) (sizeof(struct cmsghdr) + (len))
+#define CMSG_SPACE(len) (sizeof(struct cmsghdr) + CMSG_ALIGN(len))
+
+#define CMSG_FIRSTHDR(msg)                                                     \
----------------
kaladron wrote:

It might not be worth it, your call.  I just get itchy thinking about the times I get confusing things out of macros where a compiler error could have told me how I was holding it wrong. =)

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


More information about the libc-commits mailing list