mirror of https://github.com/F-Stack/f-stack.git
Nginx: hijack `recvmsg`.
Since Nginx calls `recvmsg` in stream with udp, we must hijack this function, so that the network IO can pass through f-stack.
This commit is contained in:
parent
f6a681c496
commit
ab555adef4
|
@ -109,6 +109,7 @@ static ssize_t (*real_send)(int, const void *, size_t, int);
|
||||||
static ssize_t (*real_sendto)(int, const void *, size_t, int,
|
static ssize_t (*real_sendto)(int, const void *, size_t, int,
|
||||||
const struct sockaddr*, socklen_t);
|
const struct sockaddr*, socklen_t);
|
||||||
static ssize_t (*real_sendmsg)(int, const struct msghdr*, int);
|
static ssize_t (*real_sendmsg)(int, const struct msghdr*, int);
|
||||||
|
static ssize_t (*real_recvmsg)(int, struct msghdr *, int);
|
||||||
static ssize_t (*real_writev)(int, const struct iovec *, int);
|
static ssize_t (*real_writev)(int, const struct iovec *, int);
|
||||||
static ssize_t (*real_readv)(int, const struct iovec *, int);
|
static ssize_t (*real_readv)(int, const struct iovec *, int);
|
||||||
|
|
||||||
|
@ -292,6 +293,16 @@ sendmsg(int sockfd, const struct msghdr *msg, int flags)
|
||||||
return SYSCALL(sendmsg)(sockfd, msg, flags);
|
return SYSCALL(sendmsg)(sockfd, msg, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags)
|
||||||
|
{
|
||||||
|
if(is_fstack_fd(sockfd)){
|
||||||
|
sockfd = restore_fstack_fd(sockfd);
|
||||||
|
return ff_recvmsg(sockfd, msg, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
return SYSCALL(recvmsg)(sockfd, msg, flags);
|
||||||
|
}
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
recv(int sockfd, void *buf, size_t len, int flags)
|
recv(int sockfd, void *buf, size_t len, int flags)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue