Mercurial > hg > nginx-quic
annotate src/os/unix/ngx_darwin_config.h @ 8867:5119c8150478
Fixed runtime handling of systems without EPOLLRDHUP support.
In 7583:efd71d49bde0 (nginx 1.17.5) along with introduction of the
ioctl(FIONREAD) support proper handling of systems without EPOLLRDHUP
support in the kernel (but with EPOLLRDHUP in headers) was broken.
Before the change, rev->available was never set to 0 unless
ngx_use_epoll_rdhup was also set (that is, runtime test for EPOLLRDHUP
introduced in 6536:f7849bfb6d21 succeeded). After the change,
rev->available might reach 0 on systems without runtime EPOLLRDHUP
support, stopping further reading in ngx_readv_chain() and ngx_unix_recv().
And, if EOF happened to be already reported along with the last event,
it is not reported again by epoll_wait(), leading to connection hangs
and timeouts on such systems.
This affects Linux kernels before 2.6.17 if nginx was compiled
with newer headers, and, more importantly, emulation layers, such as
DigitalOcean's App Platform's / gVisor's epoll emulation layer.
Fix is to explicitly check ngx_use_epoll_rdhup before the corresponding
rev->pending_eof tests in ngx_readv_chain() and ngx_unix_recv().
author | Marcus Ball <marcus.ball@live.com> |
---|---|
date | Mon, 30 May 2022 02:38:07 +0300 |
parents | 9fb994513776 |
children |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
374
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
374
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
4412 | 4 * Copyright (C) Nginx, Inc. |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
374
diff
changeset
|
5 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
374
diff
changeset
|
6 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
374
diff
changeset
|
7 |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
8 #ifndef _NGX_DARWIN_CONFIG_H_INCLUDED_ |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
9 #define _NGX_DARWIN_CONFIG_H_INCLUDED_ |
455 | 10 |
1576 | 11 |
6978
9fb994513776
Enabled IPV6_RECVPKTINFO / IPV6_PKTINFO on macOS.
Sergey Kandaurov <pluknet@nginx.com>
parents:
6380
diff
changeset
|
12 #define __APPLE_USE_RFC_3542 /* IPV6_PKTINFO */ |
9fb994513776
Enabled IPV6_RECVPKTINFO / IPV6_PKTINFO on macOS.
Sergey Kandaurov <pluknet@nginx.com>
parents:
6380
diff
changeset
|
13 |
9fb994513776
Enabled IPV6_RECVPKTINFO / IPV6_PKTINFO on macOS.
Sergey Kandaurov <pluknet@nginx.com>
parents:
6380
diff
changeset
|
14 |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 #include <sys/types.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
16 #include <sys/time.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
17 #include <unistd.h> |
455 | 18 #include <inttypes.h> |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
19 #include <stdarg.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
20 #include <stddef.h> /* offsetof() */ |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
21 #include <stdio.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
22 #include <stdlib.h> |
5389
72e31d88defa
Added ngx_filename_cmp() with "/" sorted to the left.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
23 #include <ctype.h> |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
24 #include <errno.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
25 #include <string.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
26 #include <signal.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
27 #include <pwd.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
28 #include <grp.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
29 #include <dirent.h> |
727 | 30 #include <glob.h> |
2633
34389dfc2061
fix MacOSX building, broken in r2616
Igor Sysoev <igor@sysoev.ru>
parents:
2128
diff
changeset
|
31 #include <sys/mount.h> /* statfs() */ |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
32 |
455 | 33 #include <sys/filio.h> /* FIONBIO */ |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
34 #include <sys/ioctl.h> |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
35 #include <sys/uio.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
36 #include <sys/stat.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
37 #include <fcntl.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
38 |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
39 #include <sys/wait.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
40 #include <sys/mman.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
41 #include <sys/resource.h> |
374
213f17e9f776
nginx-0.0.7-2004-07-02-09:47:00 import
Igor Sysoev <igor@sysoev.ru>
parents:
355
diff
changeset
|
42 #include <sched.h> |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
43 |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
44 #include <sys/socket.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
45 #include <netinet/in.h> |
455 | 46 #include <netinet/tcp.h> /* TCP_NODELAY */ |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
47 #include <arpa/inet.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
48 #include <netdb.h> |
479 | 49 #include <sys/un.h> |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
50 |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
51 #include <sys/sysctl.h> |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
52 #include <xlocale.h> |
1576 | 53 |
6380
7142b04337d6
Dynamic modules: dlopen() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5714
diff
changeset
|
54 #include <dlfcn.h> |
7142b04337d6
Dynamic modules: dlopen() support.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5714
diff
changeset
|
55 |
1576 | 56 |
455 | 57 #ifndef IOV_MAX |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
58 #define IOV_MAX 64 |
455 | 59 #endif |
60 | |
61 | |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
62 #include <ngx_auto_config.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
63 |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
64 |
3909
0daede16d68b
use POSIX semaphores in shmtx instead of sched_yield()
Igor Sysoev <igor@sysoev.ru>
parents:
2633
diff
changeset
|
65 #if (NGX_HAVE_POSIX_SEM) |
0daede16d68b
use POSIX semaphores in shmtx instead of sched_yield()
Igor Sysoev <igor@sysoev.ru>
parents:
2633
diff
changeset
|
66 #include <semaphore.h> |
0daede16d68b
use POSIX semaphores in shmtx instead of sched_yield()
Igor Sysoev <igor@sysoev.ru>
parents:
2633
diff
changeset
|
67 #endif |
0daede16d68b
use POSIX semaphores in shmtx instead of sched_yield()
Igor Sysoev <igor@sysoev.ru>
parents:
2633
diff
changeset
|
68 |
0daede16d68b
use POSIX semaphores in shmtx instead of sched_yield()
Igor Sysoev <igor@sysoev.ru>
parents:
2633
diff
changeset
|
69 |
469 | 70 #if (NGX_HAVE_POLL) |
355
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
71 #include <poll.h> |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
72 #endif |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
73 |
0fb6c53fb135
nginx-0.0.7-2004-06-15-21:47:16 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
74 |
469 | 75 #if (NGX_HAVE_KQUEUE) |
455 | 76 #include <sys/event.h> |
77 #endif | |
78 | |
79 | |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
80 #define NGX_LISTEN_BACKLOG -1 |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
81 |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
82 |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
83 #ifndef NGX_HAVE_INHERITED_NONBLOCK |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
84 #define NGX_HAVE_INHERITED_NONBLOCK 1 |
455 | 85 #endif |
86 | |
87 | |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
88 #ifndef NGX_HAVE_CASELESS_FILESYSTEM |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
89 #define NGX_HAVE_CASELESS_FILESYSTEM 1 |
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
90 #endif |
1377
0d57c150115b
set default listen() backlog to 511 on all platforms except FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
727
diff
changeset
|
91 |
0d57c150115b
set default listen() backlog to 511 on all platforms except FreeBSD
Igor Sysoev <igor@sysoev.ru>
parents:
727
diff
changeset
|
92 |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
93 #define NGX_HAVE_OS_SPECIFIC_INIT 1 |
4223
1b779cb69dc8
malloc() debugging on MacOSX.
Igor Sysoev <igor@sysoev.ru>
parents:
4097
diff
changeset
|
94 #define NGX_HAVE_DEBUG_MALLOC 1 |
455 | 95 |
96 | |
601 | 97 extern char **environ; |
98 | |
99 | |
2128
345a014436d4
*) move Darwin support to separate files
Igor Sysoev <igor@sysoev.ru>
parents:
2006
diff
changeset
|
100 #endif /* _NGX_DARWIN_CONFIG_H_INCLUDED_ */ |