diff options
author | Daniel Mueller <deso@posteo.net> | 2019-05-24 18:07:22 -0700 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2019-05-24 18:07:22 -0700 |
commit | 82cf43dd887801b8b22b8aae8c02854d921915d5 (patch) | |
tree | b1bf3710bd07fe83e396a5db8563f3e6c5e85689 /libc/libc-test/src | |
parent | 06722702ea35434189d7de2b13a00209b2ebbd6d (diff) | |
download | nitrocli-82cf43dd887801b8b22b8aae8c02854d921915d5.tar.gz nitrocli-82cf43dd887801b8b22b8aae8c02854d921915d5.tar.bz2 |
Update libc crate to 0.2.55
This change updates the libc crate to version 0.2.55.
Import subrepo libc/:libc at caf17a0641d29dc624621177f5756804dd180c13
Diffstat (limited to 'libc/libc-test/src')
-rw-r--r-- | libc/libc-test/src/cmsg.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libc/libc-test/src/cmsg.c b/libc/libc-test/src/cmsg.c new file mode 100644 index 0000000..a8b1c37 --- /dev/null +++ b/libc/libc-test/src/cmsg.c @@ -0,0 +1,28 @@ +#include <sys/param.h> +#include <sys/socket.h> + +// Since the cmsg(3) macros are macros instead of functions, they aren't +// available to FFI. libc must reimplement them, which is error-prone. This +// file provides FFI access to the actual macros so they can be tested against +// the Rust reimplementations. + +struct cmsghdr *cmsg_firsthdr(struct msghdr *msgh) { + return CMSG_FIRSTHDR(msgh); +} + +struct cmsghdr *cmsg_nxthdr(struct msghdr *msgh, struct cmsghdr *cmsg) { + return CMSG_NXTHDR(msgh, cmsg); +} + +size_t cmsg_space(size_t length) { + return CMSG_SPACE(length); +} + +size_t cmsg_len(size_t length) { + return CMSG_LEN(length); +} + +unsigned char *cmsg_data(struct cmsghdr *cmsg) { + return CMSG_DATA(cmsg); +} + |