Mercurial > hg > nginx
annotate auto/lib/pcre/make @ 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 | 78f8ac479735 |
children | 0b5f12d5c531 |
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:
297
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:
297
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:
297
diff
changeset
|
4 |
274
a1ea1ecc3eac
nginx-0.0.2-2004-03-01-23:00:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
5 |
467 | 6 case "$NGX_CC_NAME" in |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
7 |
6397
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5360
diff
changeset
|
8 msvc) |
467 | 9 ngx_makefile=makefile.msvc |
503 | 10 ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC" |
2838
ecdc41bf2047
backout r2833: CURDIR was set to Unix style path
Igor Sysoev <igor@sysoev.ru>
parents:
2832
diff
changeset
|
11 ngx_pcre="PCRE=\"$PCRE\"" |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
12 ;; |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
13 |
6397
78f8ac479735
Win32: simplified and improved handling of MSVC versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5360
diff
changeset
|
14 owc) |
467 | 15 ngx_makefile=makefile.owc |
503 | 16 ngx_opt="CPU_OPT=\"$CPU_OPT\"" |
2838
ecdc41bf2047
backout r2833: CURDIR was set to Unix style path
Igor Sysoev <igor@sysoev.ru>
parents:
2832
diff
changeset
|
17 ngx_pcre=`echo PCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"` |
297
ee394e997c77
nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
295
diff
changeset
|
18 ;; |
ee394e997c77
nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
295
diff
changeset
|
19 |
467 | 20 bcc) |
21 ngx_makefile=makefile.bcc | |
503 | 22 ngx_opt="-DCPU_OPT=\"$CPU_OPT\"" |
2838
ecdc41bf2047
backout r2833: CURDIR was set to Unix style path
Igor Sysoev <igor@sysoev.ru>
parents:
2832
diff
changeset
|
23 ngx_pcre=`echo \-DPCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"` |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
24 ;; |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
25 |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
26 *) |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
27 ngx_makefile= |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
28 ;; |
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
29 |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
30 esac |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
31 |
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
32 |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
33 if [ -n "$ngx_makefile" ]; then |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
34 |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
35 cat << END >> $NGX_MAKEFILE |
297
ee394e997c77
nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
295
diff
changeset
|
36 |
5342
b3f6290a9401
Configure: pcre.lib dependencies fix.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
37 `echo "$PCRE/pcre.lib: $PCRE/pcre.h $NGX_MAKEFILE" \ |
b3f6290a9401
Configure: pcre.lib dependencies fix.
Maxim Dounin <mdounin@mdounin.ru>
parents:
4412
diff
changeset
|
38 | sed -e "s/\//$ngx_regex_dirsep/g"` |
2840
22c4c012c8c9
switch Win32 building to modern PCRE versions (starting from 7.1)
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
39 \$(MAKE) -f auto/lib/pcre/$ngx_makefile $ngx_pcre $ngx_opt |
297
ee394e997c77
nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
295
diff
changeset
|
40 |
2840
22c4c012c8c9
switch Win32 building to modern PCRE versions (starting from 7.1)
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
41 `echo "$PCRE/pcre.h:" | sed -e "s/\//$ngx_regex_dirsep/g"` |
22c4c012c8c9
switch Win32 building to modern PCRE versions (starting from 7.1)
Igor Sysoev <igor@sysoev.ru>
parents:
2838
diff
changeset
|
42 \$(MAKE) -f auto/lib/pcre/$ngx_makefile $ngx_pcre pcre.h |
297
ee394e997c77
nginx-0.0.3-2004-03-29-21:43:58 import
Igor Sysoev <igor@sysoev.ru>
parents:
295
diff
changeset
|
43 |
467 | 44 END |
45 | |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
46 else |
282
30310107dbc9
nginx-0.0.2-2004-03-09-22:47:07 import
Igor Sysoev <igor@sysoev.ru>
parents:
274
diff
changeset
|
47 |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
48 cat << END >> $NGX_MAKEFILE |
467 | 49 |
1164
d201e0461c3c
fix make dependecies: pcre-6.5+ already has pcre.h
Igor Sysoev <igor@sysoev.ru>
parents:
523
diff
changeset
|
50 $PCRE/pcre.h: $PCRE/Makefile |
d201e0461c3c
fix make dependecies: pcre-6.5+ already has pcre.h
Igor Sysoev <igor@sysoev.ru>
parents:
523
diff
changeset
|
51 |
d201e0461c3c
fix make dependecies: pcre-6.5+ already has pcre.h
Igor Sysoev <igor@sysoev.ru>
parents:
523
diff
changeset
|
52 $PCRE/Makefile: $NGX_MAKEFILE |
467 | 53 cd $PCRE \\ |
523 | 54 && if [ -f Makefile ]; then \$(MAKE) distclean; fi \\ |
467 | 55 && CC="\$(CC)" CFLAGS="$PCRE_OPT" \\ |
4388
005fc2d5e84f
Added support for regex study and PCRE JIT (ticket #41) optimizations on
Valentin Bartenev <vbart@nginx.com>
parents:
2840
diff
changeset
|
56 ./configure --disable-shared $PCRE_CONF_OPT |
467 | 57 |
1164
d201e0461c3c
fix make dependecies: pcre-6.5+ already has pcre.h
Igor Sysoev <igor@sysoev.ru>
parents:
523
diff
changeset
|
58 $PCRE/.libs/libpcre.a: $PCRE/Makefile |
467 | 59 cd $PCRE \\ |
60 && \$(MAKE) libpcre.la | |
61 | |
62 END | |
63 | |
5360
3d2d3e1cf427
Win32: MinGW GCC compatibility.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5342
diff
changeset
|
64 fi |