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.
This commit is contained in:
parent
39201d07e4
commit
acb7e049b8
3 changed files with 55 additions and 0 deletions
15
src/network/recvmmsg.c
Normal file
15
src/network/recvmmsg.c
Normal file
|
|
@ -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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue