comparison src/os/unix/ngx_linux_sendfile_chain.c @ 232:d8f5c91a5c07 NGINX_0_4_1

nginx 0.4.1 *) Bugfix: the DragonFlyBSD compatibility. Thanks to Pavel Nazarov. *) Workaround: of bug in 64-bit Linux sendfile(), when file is more than 2G. *) Feature: now on Linux nginx uses O_NOATIME flag for static requests. Thanks to Yusuf Goolamabbas.
author Igor Sysoev <http://sysoev.ru>
date Thu, 14 Sep 2006 00:00:00 +0400
parents 36af50a5582d
children 30862655219e
comparison
equal deleted inserted replaced
231:8024b0d52263 232:d8f5c91a5c07
14 * offsets only, and the including <sys/sendfile.h> breaks the compiling, 14 * offsets only, and the including <sys/sendfile.h> breaks the compiling,
15 * if off_t is 64 bit wide. So we use own sendfile() definition, where offset 15 * if off_t is 64 bit wide. So we use own sendfile() definition, where offset
16 * parameter is int32_t, and use sendfile() for the file parts below 2G only, 16 * parameter is int32_t, and use sendfile() for the file parts below 2G only,
17 * see src/os/unix/ngx_linux_config.h 17 * see src/os/unix/ngx_linux_config.h
18 * 18 *
19 * Linux 2.4.21 has a new sendfile64() syscall #239. 19 * Linux 2.4.21 has the new sendfile64() syscall #239.
20 *
21 * On Linux up to 2.6.16 sendfile() does not allow to pass the count parameter
22 * more than 2G-1 bytes even on 64-bit platforms: it returns EINVAL,
23 * so we limit it to 2G-1 bytes.
20 */ 24 */
25
26 #define NGX_SENDFILE_LIMIT 2147483647L
21 27
22 28
23 #if (IOV_MAX > 64) 29 #if (IOV_MAX > 64)
24 #define NGX_HEADERS 64 30 #define NGX_HEADERS 64
25 #else 31 #else
52 if (!wev->ready) { 58 if (!wev->ready) {
53 return in; 59 return in;
54 } 60 }
55 61
56 62
57 /* the maximum limit size is the maximum size_t value - the page size */ 63 /* the maximum limit size is 2G-1 - the page size */
58 64
59 if (limit == 0 || limit > NGX_MAX_SIZE_T_VALUE - ngx_pagesize) { 65 if (limit == 0 || limit > NGX_SENDFILE_LIMIT - ngx_pagesize) {
60 limit = NGX_MAX_SIZE_T_VALUE - ngx_pagesize; 66 limit = NGX_SENDFILE_LIMIT - ngx_pagesize;
61 } 67 }
62 68
63 69
64 send = 0; 70 send = 0;
65 71