[NGINX] accept4() support SOCK_CLOEXEC flag
张翔
hawkxiang.cpp at gmail.com
Wed Dec 16 07:05:44 UTC 2020
# HG changeset patch
# User Zhang Xiang <hawkxiang.cpp at gmail.com>
# Date 1608099124 -28800
# Wed Dec 16 14:12:04 2020 +0800
# Node ID a685d9c04acdb4ec71fd9f176415917c217af630
# Parent 82228f955153527fba12211f52bf102c90f38dfb
Event: accept4() support SOCK_CLOEXEC flag
The close-on-exec flag on the new FD can be set via SOCK_CLOEXEC
diff -r 82228f955153 -r a685d9c04acd auto/unix
--- a/auto/unix Tue Dec 15 17:41:39 2020 +0300
+++ b/auto/unix Wed Dec 16 14:12:04 2020 +0800
@@ -510,7 +510,7 @@
ngx_feature_incs="#include <sys/socket.h>"
ngx_feature_path=
ngx_feature_libs=
-ngx_feature_test="accept4(0, NULL, NULL, SOCK_NONBLOCK)"
+ngx_feature_test="accept4(0, NULL, NULL, SOCK_NONBLOCK | SOCK_CLOEXEC)"
. auto/feature
if [ $NGX_FILE_AIO = YES ]; then
diff -r 82228f955153 -r a685d9c04acd src/event/ngx_event_accept.c
--- a/src/event/ngx_event_accept.c Tue Dec 15 17:41:39 2020 +0300
+++ b/src/event/ngx_event_accept.c Wed Dec 16 14:12:04 2020 +0800
@@ -57,7 +57,7 @@
#if (NGX_HAVE_ACCEPT4)
if (use_accept4) {
- s = accept4(lc->fd, &sa.sockaddr, &socklen, SOCK_NONBLOCK);
+ s = accept4(lc->fd, &sa.sockaddr, &socklen, SOCK_NONBLOCK |
SOCK_CLOEXEC);
} else {
s = accept(lc->fd, &sa.sockaddr, &socklen);
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20201216/9b8f9ff2/attachment.htm>
More information about the nginx-devel
mailing list