Nginx: hijack `shutdown`.

In some cases, nginx will call `ngx_shutdown_socket`, so we need to hijack `shutdown`.
This commit is contained in:
whl739 2018-06-21 17:22:59 +08:00
parent 86036c745d
commit a29bb116db
1 changed files with 13 additions and 0 deletions

View File

@ -117,6 +117,8 @@ static ssize_t (*real_readv)(int, const struct iovec *, int);
static ssize_t (*real_read)(int, void *, size_t);
static ssize_t (*real_write)(int, const void *, size_t);
static int (*real_shutdown)(int, int);
static int (*real_ioctl)(int, int, void *);
static int (*real_gettimeofday)(struct timeval *tv, struct timezone *tz);
@ -444,6 +446,17 @@ close(int sockfd)
return SYSCALL(close)(sockfd);
}
int
shutdown(int sockfd, int how)
{
if(is_fstack_fd(sockfd)){
sockfd = restore_fstack_fd(sockfd);
return ff_close(sockfd);
}
return SYSCALL(shutdown)(sockfd, how);
}
ssize_t
writev(int sockfd, const struct iovec *iov, int iovcnt)
{