sys/socket/scm: add more socket message control helper

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2021-09-02 22:27:42 +08:00 committed by Xiang Xiao
parent e10b546006
commit e8d7779ab1

View file

@ -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: */