Mercurial > hg > nginx
annotate auto/types/typedef @ 7138:05bd1baabf87 stable-1.12
Core: disabled SO_REUSEPORT when testing config (ticket #1300).
When closing a socket with SO_REUSEPORT, Linux drops all connections waiting
in this socket's listen queue. Previously, it was believed to only result
in connection resets when reconfiguring nginx to use smaller number of worker
processes. It also results in connection resets during configuration
testing though.
Workaround is to avoid using SO_REUSEPORT when testing configuration. It
should prevent listening sockets from being created if a conflicting socket
already exists, while still preserving detection of other possible errors.
It should also cover UDP sockets.
The only downside of this approach seems to be that a configuration testing
won't be able to properly report the case when nginx was compiled with
SO_REUSEPORT, but the kernel is not able to set it. Such errors will be
reported on a real start instead.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Tue, 11 Jul 2017 19:59:56 +0300 |
parents | e3faa5fb7772 |
children |
rev | line source |
---|---|
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
1 |
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
2 # Copyright (C) Igor Sysoev |
4412 | 3 # Copyright (C) Nginx, Inc. |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
370
diff
changeset
|
4 |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
193
diff
changeset
|
5 |
455 | 6 echo $ngx_n "checking for $ngx_type ...$ngx_c" |
7 | |
8 cat << END >> $NGX_AUTOCONF_ERR | |
193
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 |
455 | 10 ---------------------------------------- |
11 checking for $ngx_type | |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
12 |
455 | 13 END |
14 | |
15 ngx_found=no | |
16 | |
17 for ngx_try in $ngx_type $ngx_types | |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
193
diff
changeset
|
18 do |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
19 |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
20 cat << END > $NGX_AUTOTEST.c |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
21 |
370
54f76b0b8dca
nginx-0.0.7-2004-06-27-22:01:57 import
Igor Sysoev <igor@sysoev.ru>
parents:
279
diff
changeset
|
22 #include <sys/types.h> |
279
b79f021a644a
nginx-0.0.2-2004-03-04-19:34:23 import
Igor Sysoev <igor@sysoev.ru>
parents:
252
diff
changeset
|
23 #include <signal.h> |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
24 #include <sys/socket.h> |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
25 #include <sys/time.h> |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
26 #include <sys/resource.h> |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
27 #include <netinet/in.h> |
455 | 28 $NGX_INCLUDE_INTTYPES_H |
193
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
29 |
6624
e3faa5fb7772
Configure: fix build with -Werror=old-style-definition.
Piotr Sikora <piotrsikora@google.com>
parents:
6499
diff
changeset
|
30 int main(void) { |
4559
62d8db8c7157
Fixed more gcc46 warnings in configure tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4543
diff
changeset
|
31 $ngx_try i = 0; |
62d8db8c7157
Fixed more gcc46 warnings in configure tests.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4543
diff
changeset
|
32 return (int) i; |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
33 } |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
34 |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
35 END |
193
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
36 |
583 | 37 ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \ |
38 -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs" | |
39 | |
455 | 40 eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1" |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
41 |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
42 if [ -x $NGX_AUTOTEST ]; then |
455 | 43 if [ $ngx_try = $ngx_type ]; then |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
44 echo " found" |
455 | 45 ngx_found=yes |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
193
diff
changeset
|
46 else |
455 | 47 echo ", $ngx_try used" |
48 ngx_found=$ngx_try | |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
193
diff
changeset
|
49 fi |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
193
diff
changeset
|
50 fi |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
193
diff
changeset
|
51 |
455 | 52 if [ $ngx_found = no ]; then |
6499
e20bf454e58b
Configure: improved multiple types handling in auto/types/typedef.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6498
diff
changeset
|
53 if [ $ngx_try = $ngx_type ]; then |
e20bf454e58b
Configure: improved multiple types handling in auto/types/typedef.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6498
diff
changeset
|
54 echo $ngx_n " $ngx_try not found$ngx_c" |
e20bf454e58b
Configure: improved multiple types handling in auto/types/typedef.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6498
diff
changeset
|
55 else |
e20bf454e58b
Configure: improved multiple types handling in auto/types/typedef.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6498
diff
changeset
|
56 echo $ngx_n ", $ngx_try not found$ngx_c" |
e20bf454e58b
Configure: improved multiple types handling in auto/types/typedef.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6498
diff
changeset
|
57 fi |
193
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
58 |
455 | 59 echo "----------" >> $NGX_AUTOCONF_ERR |
60 cat $NGX_AUTOTEST.c >> $NGX_AUTOCONF_ERR | |
61 echo "----------" >> $NGX_AUTOCONF_ERR | |
62 echo $ngx_test >> $NGX_AUTOCONF_ERR | |
63 echo "----------" >> $NGX_AUTOCONF_ERR | |
6498
82a76258a142
Configure: fixed autotest source code logging.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5309
diff
changeset
|
64 fi |
455 | 65 |
6498
82a76258a142
Configure: fixed autotest source code logging.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5309
diff
changeset
|
66 rm -rf $NGX_AUTOTEST* |
82a76258a142
Configure: fixed autotest source code logging.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5309
diff
changeset
|
67 |
82a76258a142
Configure: fixed autotest source code logging.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5309
diff
changeset
|
68 if [ $ngx_found != no ]; then |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
193
diff
changeset
|
69 break |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
193
diff
changeset
|
70 fi |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
193
diff
changeset
|
71 done |
193
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
72 |
455 | 73 if [ $ngx_found = no ]; then |
210
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
74 echo |
00cafae0bdf1
nginx-0.0.1-2003-12-14-23:10:27 import
Igor Sysoev <igor@sysoev.ru>
parents:
196
diff
changeset
|
75 echo "$0: error: can not define $ngx_type" |
455 | 76 |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
193
diff
changeset
|
77 exit 1 |
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
193
diff
changeset
|
78 fi |
193
dd66383796a5
nginx-0.0.1-2003-11-20-20:36:43 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
79 |
455 | 80 if [ $ngx_found != yes ]; then |
81 echo "typedef $ngx_found $ngx_type;" >> $NGX_AUTO_CONFIG_H | |
195
8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
Igor Sysoev <igor@sysoev.ru>
parents:
193
diff
changeset
|
82 fi |