[libc-commits] [libc] [libc] Add struct cmsghdr and associated macros (PR #193756)
Pavel Labath via libc-commits
libc-commits at lists.llvm.org
Mon Apr 27 01:54:04 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) \
----------------
labath wrote:
I'm still finding my way around here, so my call may not be worth much, but I'm going to leave this like this. I've looked at the FD_SET macros and they are also implemented without functions even though they have similar complexity, so this would be at least consistent with that. I'm certainly open to redoing this in the future.
https://github.com/llvm/llvm-project/pull/193756
More information about the libc-commits
mailing list