recvmsg.c 428 字节
Newer Older
R
Rich Felker 已提交
1
#include <sys/socket.h>
2
#include <limits.h>
R
Rich Felker 已提交
3 4 5 6 7 8
#include "syscall.h"
#include "libc.h"

ssize_t recvmsg(int fd, struct msghdr *msg, int flags)
{
	ssize_t r;
9 10 11 12 13 14 15 16
#if LONG_MAX > INT_MAX
	struct msghdr h, *orig = msg;
	if (msg) {
		h = *msg;
		h.__pad1 = h.__pad2 = 0;
		msg = &h;
	}
#endif
R
Rich Felker 已提交
17
	CANCELPT_BEGIN;
18
	r = socketcall(recvmsg, fd, msg, flags, 0, 0, 0);
R
Rich Felker 已提交
19
	CANCELPT_END;
20 21 22
#if LONG_MAX > INT_MAX
	if (orig) *orig = h;
#endif
R
Rich Felker 已提交
23 24
	return r;
}