diff options
author | Rich Felker <dalias@aerifal.cx> | 2014-06-19 23:01:15 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2014-06-19 23:01:15 -0400 |
commit | acb7e049b8c70b9e6ad57e8601373f9c991a0da4 (patch) | |
tree | ecba8b37b99eafecade1f60b5b8e14e4e6d4be73 /src/network/recvmmsg.c | |
parent | 39201d07e41ca4cf5f8c35d4663767aa3f75208f (diff) | |
download | musl-acb7e049b8c70b9e6ad57e8601373f9c991a0da4.tar.gz musl-acb7e049b8c70b9e6ad57e8601373f9c991a0da4.tar.bz2 musl-acb7e049b8c70b9e6ad57e8601373f9c991a0da4.tar.xz musl-acb7e049b8c70b9e6ad57e8601373f9c991a0da4.zip |
implement sendmmsg and recvmmsg
these are not pure syscall wrappers because they have to work around
kernel API bugs on 64-bit archs. the workarounds could probably be
made somewhat more efficient, but at the cost of more complexity. this
may be revisited later.
Diffstat (limited to 'src/network/recvmmsg.c')
-rw-r--r-- | src/network/recvmmsg.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/network/recvmmsg.c b/src/network/recvmmsg.c new file mode 100644 index 00000000..58b1b2f6 --- /dev/null +++ b/src/network/recvmmsg.c @@ -0,0 +1,15 @@ +#define _GNU_SOURCE +#include <sys/socket.h> +#include <limits.h> +#include "syscall.h" + +int recvmmsg(int fd, struct mmsghdr *msgvec, unsigned int vlen, unsigned int flags, struct timespec *timeout) +{ +#if LONG_MAX > INT_MAX + struct mmsghdr *mh = msgvec; + unsigned int i; + for (i = vlen; i; i--, mh++) + mh->msg_hdr.__pad1 = mh->msg_hdr.__pad2 = 0; +#endif + return syscall_cp(SYS_recvmmsg, fd, msgvec, vlen, flags, timeout); +} |