You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2021/09/15 04:04:06 UTC
[incubator-nuttx] branch master updated: sys/socket/scm: add more
socket message control helper
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new e8d7779 sys/socket/scm: add more socket message control helper
e8d7779 is described below
commit e8d7779ab1b82fa9de8f61f44a6528a29a0cddf9
Author: chao.an <an...@xiaomi.com>
AuthorDate: Thu Sep 2 22:27:42 2021 +0800
sys/socket/scm: add more socket message control helper
Signed-off-by: chao.an <an...@xiaomi.com>
---
include/sys/socket.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/sys/socket.h b/include/sys/socket.h
index 57e2376..3653999 100644
--- a/include/sys/socket.h
+++ b/include/sys/socket.h
@@ -260,6 +260,14 @@
(FAR struct cmsghdr *)NULL)
#define CMSG_FIRSTHDR(msg) \
__CMSG_FIRSTHDR((msg)->msg_control, (msg)->msg_controllen)
+#define CMSG_OK(mhdr, cmsg) ((cmsg)->cmsg_len >= sizeof(struct cmsghdr) && \
+ (cmsg)->cmsg_len <= (unsigned long) \
+ ((mhdr)->msg_controllen - \
+ ((char *)(cmsg) - (char *)(mhdr)->msg_control)))
+#define for_each_cmsghdr(cmsg, msg) \
+ for (cmsg = CMSG_FIRSTHDR(msg); \
+ cmsg; \
+ cmsg = CMSG_NXTHDR(msg, cmsg))
/* "Socket"-level control message types: */