1 #include <sys/param.h> 2 #include <sys/socket.h> 3 4 // Since the cmsg(3) macros are macros instead of functions, they aren't 5 // available to FFI. libc must reimplement them, which is error-prone. This 6 // file provides FFI access to the actual macros so they can be tested against 7 // the Rust reimplementations. 8 cmsg_firsthdr(struct msghdr * msgh)9struct cmsghdr *cmsg_firsthdr(struct msghdr *msgh) { 10 return CMSG_FIRSTHDR(msgh); 11 } 12 cmsg_nxthdr(struct msghdr * msgh,struct cmsghdr * cmsg)13struct cmsghdr *cmsg_nxthdr(struct msghdr *msgh, struct cmsghdr *cmsg) { 14 return CMSG_NXTHDR(msgh, cmsg); 15 } 16 cmsg_space(size_t length)17size_t cmsg_space(size_t length) { 18 return CMSG_SPACE(length); 19 } 20 cmsg_len(size_t length)21size_t cmsg_len(size_t length) { 22 return CMSG_LEN(length); 23 } 24 cmsg_data(struct cmsghdr * cmsg)25unsigned char *cmsg_data(struct cmsghdr *cmsg) { 26 return CMSG_DATA(cmsg); 27 } 28 29