Mercurial > hg > nginx
annotate auto/lib/perl/conf @ 7583:efd71d49bde0
Events: available bytes calculation via ioctl(FIONREAD).
This makes it possible to avoid looping for a long time while working
with a fast enough peer when data are added to the socket buffer faster
than we are able to read and process them (ticket #1431). This is
basically what we already do on FreeBSD with kqueue, where information
about the number of bytes in the socket buffer is returned by
the kevent() call.
With other event methods rev->available is now set to -1 when the socket
is ready for reading. Later in ngx_recv() and ngx_recv_chain(), if
full buffer is received, real number of bytes in the socket buffer is
retrieved using ioctl(FIONREAD). Reading more than this number of bytes
ensures that even with edge-triggered event methods the event will be
triggered again, so it is safe to stop processing of the socket and
switch to other connections.
Using ioctl(FIONREAD) only after reading a full buffer is an optimization.
With this approach we only call ioctl(FIONREAD) when there are at least
two recv()/readv() calls.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Thu, 17 Oct 2019 16:02:19 +0300 |
parents | 30b6f1ff192b |
children |
rev | line source |
---|---|
599 | 1 |
2 # Copyright (C) Igor Sysoev | |
4412 | 3 # Copyright (C) Nginx, Inc. |
599 | 4 |
5 | |
6 echo "checking for perl" | |
7 | |
8 | |
9 NGX_PERL_VER=`$NGX_PERL -v 2>&1 | grep '^This is perl' 2>&1 \ | |
10 | sed -e 's/^This is perl, \(.*\)/\1/'` | |
11 | |
12 if test -n "$NGX_PERL_VER"; then | |
13 echo " + perl version: $NGX_PERL_VER" | |
14 | |
6821
30b6f1ff192b
Perl: removed special environment handling for the perl module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6700
diff
changeset
|
15 if [ "`$NGX_PERL -e 'use 5.008006; print "OK"'`" != "OK" ]; then |
599 | 16 echo |
6821
30b6f1ff192b
Perl: removed special environment handling for the perl module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6700
diff
changeset
|
17 echo "$0: error: perl 5.8.6 or higher is required" |
599 | 18 echo |
19 | |
20 exit 1; | |
21 fi | |
22 | |
4866
fac1cc762969
Configure: additional test for ExtUtils::Embed perl module presence.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
23 if [ "`$NGX_PERL -MExtUtils::Embed -e 'print "OK"'`" != "OK" ]; then |
fac1cc762969
Configure: additional test for ExtUtils::Embed perl module presence.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
24 echo |
fac1cc762969
Configure: additional test for ExtUtils::Embed perl module presence.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
25 echo "$0: error: perl module ExtUtils::Embed is required" |
fac1cc762969
Configure: additional test for ExtUtils::Embed perl module presence.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
26 echo |
fac1cc762969
Configure: additional test for ExtUtils::Embed perl module presence.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
27 |
fac1cc762969
Configure: additional test for ExtUtils::Embed perl module presence.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
28 exit 1; |
fac1cc762969
Configure: additional test for ExtUtils::Embed perl module presence.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
29 fi |
fac1cc762969
Configure: additional test for ExtUtils::Embed perl module presence.
Andrey Belov <defan@nginx.com>
parents:
4412
diff
changeset
|
30 |
6700
0d2956dfc4e6
Perl: pass additional linker options to perl module.
Konstantin Pavlov <thresh@nginx.com>
parents:
6419
diff
changeset
|
31 NGX_PM_CFLAGS=`$NGX_PERL -MExtUtils::Embed -e ccopts` |
0d2956dfc4e6
Perl: pass additional linker options to perl module.
Konstantin Pavlov <thresh@nginx.com>
parents:
6419
diff
changeset
|
32 NGX_PM_LDFLAGS=`$NGX_PERL -MConfig -e 'print $Config{lddlflags}'` |
0d2956dfc4e6
Perl: pass additional linker options to perl module.
Konstantin Pavlov <thresh@nginx.com>
parents:
6419
diff
changeset
|
33 |
681 | 34 NGX_PERL_CFLAGS="$CFLAGS `$NGX_PERL -MExtUtils::Embed -e ccopts`" |
35 | |
36 # gcc 4.1/4.2 warn about unused values in pTHX_ | |
37 NGX_PERL_CFLAGS=`echo $NGX_PERL_CFLAGS \ | |
38 | sed -e 's/-Wunused-value/-Wno-unused-value/'` | |
39 # icc8 warns 'declaration hides parameter "my_perl"' in ENTER and LEAVE | |
40 NGX_PERL_CFLAGS=`echo $NGX_PERL_CFLAGS \ | |
41 | sed -e 's/-wd171/-wd171 -wd1599/'` | |
42 | |
599 | 43 ngx_perl_ldopts=`$NGX_PERL -MExtUtils::Embed -e ldopts` |
44 | |
5145
f6777aef5b2f
Configure: fixed perl module make rules.
Ruslan Ermilov <ru@nginx.com>
parents:
4866
diff
changeset
|
45 ngx_perl_dlext=`$NGX_PERL -MConfig -e 'print $Config{dlext}'` |
5743
dde2ae4701e1
Configure: restored "nginx/" missed in 6e4bb1d6679d.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5739
diff
changeset
|
46 ngx_perl_libdir="src/http/modules/perl/blib/arch/auto" |
dde2ae4701e1
Configure: restored "nginx/" missed in 6e4bb1d6679d.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5739
diff
changeset
|
47 ngx_perl_module="$ngx_perl_libdir/nginx/nginx.$ngx_perl_dlext" |
5145
f6777aef5b2f
Configure: fixed perl module make rules.
Ruslan Ermilov <ru@nginx.com>
parents:
4866
diff
changeset
|
48 |
599 | 49 if $NGX_PERL -V:usemultiplicity | grep define > /dev/null; then |
50 have=NGX_HAVE_PERL_MULTIPLICITY . auto/have | |
51 echo " + perl interpreter multiplicity found" | |
52 fi | |
53 | |
872
1c4a5b3f9110
Axe several perl interpreter instances: they may be useful in currently
Igor Sysoev <igor@sysoev.ru>
parents:
681
diff
changeset
|
54 if $NGX_PERL -V:useithreads | grep undef > /dev/null; then |
599 | 55 # FreeBSD port wants to link with -pthread non-threaded perl |
56 ngx_perl_ldopts=`echo $ngx_perl_ldopts | sed 's/ -pthread//'` | |
57 fi | |
58 | |
5722
baf2816d556d
Configure: workaround for system perl on OS X (ticket #576).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5145
diff
changeset
|
59 if [ "$NGX_SYSTEM" = "Darwin" ]; then |
baf2816d556d
Configure: workaround for system perl on OS X (ticket #576).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5145
diff
changeset
|
60 # OS X system perl wants to link universal binaries |
5739 | 61 ngx_perl_ldopts=`echo $ngx_perl_ldopts \ |
6308
7e241b36819d
Configure: improved workaround for system perl on OS X.
Ruslan Ermilov <ru@nginx.com>
parents:
5743
diff
changeset
|
62 | sed -e 's/-arch i386//' -e 's/-arch x86_64//'` |
5722
baf2816d556d
Configure: workaround for system perl on OS X (ticket #576).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5145
diff
changeset
|
63 fi |
baf2816d556d
Configure: workaround for system perl on OS X (ticket #576).
Maxim Dounin <mdounin@mdounin.ru>
parents:
5145
diff
changeset
|
64 |
6419 | 65 if [ $USE_PERL = YES ]; then |
66 CORE_LINK="$CORE_LINK $ngx_perl_ldopts" | |
67 fi | |
68 | |
69 NGX_LIB_PERL="$ngx_perl_ldopts" | |
599 | 70 |
71 if test -n "$NGX_PERL_MODULES"; then | |
72 have=NGX_PERL_MODULES value="(u_char *) \"$NGX_PERL_MODULES\"" | |
73 . auto/define | |
950
9581fba9ea12
fix for nginx.pm default installation
Igor Sysoev <igor@sysoev.ru>
parents:
872
diff
changeset
|
74 NGX_PERL_MODULES_MAN=$NGX_PERL_MODULES/man3 |
599 | 75 fi |
76 | |
77 else | |
78 echo | |
6821
30b6f1ff192b
Perl: removed special environment handling for the perl module.
Maxim Dounin <mdounin@mdounin.ru>
parents:
6700
diff
changeset
|
79 echo "$0: error: perl 5.8.6 or higher is required" |
599 | 80 echo |
81 | |
82 exit 1; | |
83 fi |