Mercurial > hg > nginx-quic
annotate src/os/unix/ngx_files.h @ 5707:31dd63dcb9ea
Events: use eventfd() instead of syscall(SYS_eventfd) if possible.
This fixes --with-file-aio support on systems that lack eventfd()
syscall, notably aarch64 Linux.
The syscall(SYS_eventfd) may still be necessary on systems that
have eventfd() syscall in the kernel but lack it in glibc, e.g.
as seen in the current CentOS 5 release.
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Fri, 23 May 2014 16:37:05 +0400 |
parents | f1dfe7ff4511 |
children | ccad84a174e0 |
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:
336
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:
336
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:
336
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:
336
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:
336
diff
changeset
|
7 |
8
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
6
diff
changeset
|
8 #ifndef _NGX_FILES_H_INCLUDED_ |
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
6
diff
changeset
|
9 #define _NGX_FILES_H_INCLUDED_ |
3
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
12 #include <ngx_config.h> |
278
0ba4821f4460
nginx-0.0.2-2004-03-04-10:04:55 import
Igor Sysoev <igor@sysoev.ru>
parents:
195
diff
changeset
|
13 #include <ngx_core.h> |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
14 |
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
15 |
2234
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
16 typedef int ngx_fd_t; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
17 typedef struct stat ngx_file_info_t; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
18 typedef ino_t ngx_file_uniq_t; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
19 |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
20 |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
21 typedef struct { |
3651 | 22 u_char *name; |
23 size_t size; | |
24 void *addr; | |
25 ngx_fd_t fd; | |
26 ngx_log_t *log; | |
27 } ngx_file_mapping_t; | |
28 | |
29 | |
30 typedef struct { | |
2933 | 31 DIR *dir; |
32 struct dirent *de; | |
33 struct stat info; | |
2234
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
34 |
2933 | 35 unsigned type:8; |
36 unsigned valid_info:1; | |
2234
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
37 } ngx_dir_t; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
38 |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
39 |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
40 typedef struct { |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
41 size_t n; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
42 glob_t pglob; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
43 u_char *pattern; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
44 ngx_log_t *log; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
45 ngx_uint_t test; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
46 } ngx_glob_t; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
47 |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
48 |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
49 #define NGX_INVALID_FILE -1 |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
50 #define NGX_FILE_ERROR -1 |
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
51 |
3
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
52 |
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
53 |
1975 | 54 #ifdef __CYGWIN__ |
55 | |
5631
f1dfe7ff4511
Added #ifndef around NGX_HAVE_CASELESS_FILESYSTEM define.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5389
diff
changeset
|
56 #ifndef NGX_HAVE_CASELESS_FILESYSTEM |
2126
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
1980
diff
changeset
|
57 #define NGX_HAVE_CASELESS_FILESYSTEM 1 |
5631
f1dfe7ff4511
Added #ifndef around NGX_HAVE_CASELESS_FILESYSTEM define.
Maxim Dounin <mdounin@mdounin.ru>
parents:
5389
diff
changeset
|
58 #endif |
2126
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
1980
diff
changeset
|
59 |
1975 | 60 #define ngx_open_file(name, mode, create, access) \ |
61 open((const char *) name, mode|create|O_BINARY, access) | |
62 | |
63 #else | |
64 | |
1048
c4f666fc3a7e
ngx_open_file(name, access, create) > ngx_open_file(name, mode, create, access)
Igor Sysoev <igor@sysoev.ru>
parents:
1046
diff
changeset
|
65 #define ngx_open_file(name, mode, create, access) \ |
c4f666fc3a7e
ngx_open_file(name, access, create) > ngx_open_file(name, mode, create, access)
Igor Sysoev <igor@sysoev.ru>
parents:
1046
diff
changeset
|
66 open((const char *) name, mode|create, access) |
1975 | 67 |
68 #endif | |
69 | |
5
62b1a364857c
nginx-0.0.1-2002-08-23-20:14:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
3
diff
changeset
|
70 #define ngx_open_file_n "open()" |
62b1a364857c
nginx-0.0.1-2002-08-23-20:14:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
3
diff
changeset
|
71 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
75
diff
changeset
|
72 #define NGX_FILE_RDONLY O_RDONLY |
1054 | 73 #define NGX_FILE_WRONLY O_WRONLY |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
75
diff
changeset
|
74 #define NGX_FILE_RDWR O_RDWR |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
75
diff
changeset
|
75 #define NGX_FILE_CREATE_OR_OPEN O_CREAT |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
75
diff
changeset
|
76 #define NGX_FILE_OPEN 0 |
5262 | 77 #define NGX_FILE_TRUNCATE (O_CREAT|O_TRUNC) |
78 #define NGX_FILE_APPEND (O_WRONLY|O_APPEND) | |
3497
ac281bc4c187
use non-blocking open() not to hang on FIFO files, etc.
Igor Sysoev <igor@sysoev.ru>
parents:
3322
diff
changeset
|
79 #define NGX_FILE_NONBLOCK O_NONBLOCK |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
75
diff
changeset
|
80 |
4475 | 81 #if (NGX_HAVE_OPENAT) |
82 #define NGX_FILE_NOFOLLOW O_NOFOLLOW | |
4488
d33ce8cd0d70
Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
4485
diff
changeset
|
83 |
d33ce8cd0d70
Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
4485
diff
changeset
|
84 #if defined(O_DIRECTORY) |
d33ce8cd0d70
Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
4485
diff
changeset
|
85 #define NGX_FILE_DIRECTORY O_DIRECTORY |
d33ce8cd0d70
Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
4485
diff
changeset
|
86 #else |
d33ce8cd0d70
Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
4485
diff
changeset
|
87 #define NGX_FILE_DIRECTORY 0 |
4475 | 88 #endif |
89 | |
4488
d33ce8cd0d70
Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
4485
diff
changeset
|
90 #if defined(O_SEARCH) |
5262 | 91 #define NGX_FILE_SEARCH (O_SEARCH|NGX_FILE_DIRECTORY) |
4488
d33ce8cd0d70
Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
4485
diff
changeset
|
92 |
d33ce8cd0d70
Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
4485
diff
changeset
|
93 #elif defined(O_EXEC) |
5262 | 94 #define NGX_FILE_SEARCH (O_EXEC|NGX_FILE_DIRECTORY) |
4488
d33ce8cd0d70
Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
4485
diff
changeset
|
95 |
5356
acd51b0f6fd4
Disable symlinks: use O_PATH to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
5262
diff
changeset
|
96 #elif (NGX_HAVE_O_PATH) |
acd51b0f6fd4
Disable symlinks: use O_PATH to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
5262
diff
changeset
|
97 #define NGX_FILE_SEARCH (O_PATH|O_RDONLY|NGX_FILE_DIRECTORY) |
acd51b0f6fd4
Disable symlinks: use O_PATH to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
5262
diff
changeset
|
98 |
4488
d33ce8cd0d70
Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
4485
diff
changeset
|
99 #else |
5262 | 100 #define NGX_FILE_SEARCH (O_RDONLY|NGX_FILE_DIRECTORY) |
4488
d33ce8cd0d70
Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
4485
diff
changeset
|
101 #endif |
d33ce8cd0d70
Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
4485
diff
changeset
|
102 |
d33ce8cd0d70
Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
4485
diff
changeset
|
103 #endif /* NGX_HAVE_OPENAT */ |
d33ce8cd0d70
Disable symlinks: use O_SEARCH|O_DIRECTORY to open path components.
Valentin Bartenev <vbart@nginx.com>
parents:
4485
diff
changeset
|
104 |
1048
c4f666fc3a7e
ngx_open_file(name, access, create) > ngx_open_file(name, mode, create, access)
Igor Sysoev <igor@sysoev.ru>
parents:
1046
diff
changeset
|
105 #define NGX_FILE_DEFAULT_ACCESS 0644 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2550
diff
changeset
|
106 #define NGX_FILE_OWNER_ACCESS 0600 |
1048
c4f666fc3a7e
ngx_open_file(name, access, create) > ngx_open_file(name, mode, create, access)
Igor Sysoev <igor@sysoev.ru>
parents:
1046
diff
changeset
|
107 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
75
diff
changeset
|
108 |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
109 #define ngx_close_file close |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
110 #define ngx_close_file_n "close()" |
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
111 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
75
diff
changeset
|
112 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
113 #define ngx_delete_file(name) unlink((const char *) name) |
185
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
114 #define ngx_delete_file_n "unlink()" |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
115 |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
116 |
633 | 117 ngx_fd_t ngx_open_tempfile(u_char *name, ngx_uint_t persistent, |
1046 | 118 ngx_uint_t access); |
74
17ab1af8c3dd
nginx-0.0.1-2003-04-11-20:01:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
119 #define ngx_open_tempfile_n "open()" |
17ab1af8c3dd
nginx-0.0.1-2003-04-11-20:01:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
120 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
75
diff
changeset
|
121 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
122 ssize_t ngx_read_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset); |
2180 | 123 #if (NGX_HAVE_PREAD) |
124 #define ngx_read_file_n "pread()" | |
125 #else | |
5
62b1a364857c
nginx-0.0.1-2002-08-23-20:14:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
3
diff
changeset
|
126 #define ngx_read_file_n "read()" |
2180 | 127 #endif |
3
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
128 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
129 ssize_t ngx_write_file(ngx_file_t *file, u_char *buf, size_t size, |
497 | 130 off_t offset); |
74
17ab1af8c3dd
nginx-0.0.1-2003-04-11-20:01:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
131 |
17ab1af8c3dd
nginx-0.0.1-2003-04-11-20:01:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
132 ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *ce, |
497 | 133 off_t offset, ngx_pool_t *pool); |
74
17ab1af8c3dd
nginx-0.0.1-2003-04-11-20:01:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
134 |
17ab1af8c3dd
nginx-0.0.1-2003-04-11-20:01:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
135 |
1055 | 136 #define ngx_read_fd read |
137 #define ngx_read_fd_n "read()" | |
138 | |
2302
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2259
diff
changeset
|
139 /* |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2259
diff
changeset
|
140 * we use inlined function instead of simple #define |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2259
diff
changeset
|
141 * because glibc 2.3 sets warn_unused_result attribute for write() |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2259
diff
changeset
|
142 * and in this case gcc 4.3 ignores (void) cast |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2259
diff
changeset
|
143 */ |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2259
diff
changeset
|
144 static ngx_inline ssize_t |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2259
diff
changeset
|
145 ngx_write_fd(ngx_fd_t fd, void *buf, size_t n) |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2259
diff
changeset
|
146 { |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2259
diff
changeset
|
147 return write(fd, buf, n); |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2259
diff
changeset
|
148 } |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2259
diff
changeset
|
149 |
1055 | 150 #define ngx_write_fd_n "write()" |
151 | |
2769
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2758
diff
changeset
|
152 |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2758
diff
changeset
|
153 #define ngx_write_console ngx_write_fd |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2758
diff
changeset
|
154 |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2758
diff
changeset
|
155 |
571 | 156 #define ngx_linefeed(p) *p++ = LF; |
157 #define NGX_LINEFEED_SIZE 1 | |
4283
f72496073689
Introduction of simple ngx_write_stderr() instead of ngx_log_stderr()
Igor Sysoev <igor@sysoev.ru>
parents:
3970
diff
changeset
|
158 #define NGX_LINEFEED "\x0a" |
571 | 159 |
160 | |
633 | 161 #define ngx_rename_file(o, n) rename((const char *) o, (const char *) n) |
681 | 162 #define ngx_rename_file_n "rename()" |
170
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
163 |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
164 |
669 | 165 #define ngx_change_file_access(n, a) chmod((const char *) n, a) |
681 | 166 #define ngx_change_file_access_n "chmod()" |
167 | |
168 | |
169 ngx_int_t ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s); | |
170 #define ngx_set_file_time_n "utimes()" | |
669 | 171 |
172 | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
173 #define ngx_file_info(file, sb) stat((const char *) file, sb) |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
174 #define ngx_file_info_n "stat()" |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
175 |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
176 #define ngx_fd_info(fd, sb) fstat(fd, sb) |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
177 #define ngx_fd_info_n "fstat()" |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
178 |
3501
423ff11e3018
use lstat() for WebDAV DELETE, COPY, and MOVE to handle symlinks
Igor Sysoev <igor@sysoev.ru>
parents:
3497
diff
changeset
|
179 #define ngx_link_info(file, sb) lstat((const char *) file, sb) |
423ff11e3018
use lstat() for WebDAV DELETE, COPY, and MOVE to handle symlinks
Igor Sysoev <igor@sysoev.ru>
parents:
3497
diff
changeset
|
180 #define ngx_link_info_n "lstat()" |
423ff11e3018
use lstat() for WebDAV DELETE, COPY, and MOVE to handle symlinks
Igor Sysoev <igor@sysoev.ru>
parents:
3497
diff
changeset
|
181 |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
182 #define ngx_is_dir(sb) (S_ISDIR((sb)->st_mode)) |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
183 #define ngx_is_file(sb) (S_ISREG((sb)->st_mode)) |
669 | 184 #define ngx_is_link(sb) (S_ISLNK((sb)->st_mode)) |
3281 | 185 #define ngx_is_exec(sb) (((sb)->st_mode & S_IXUSR) == S_IXUSR) |
1053
b9fa23cda4cc
ngx_file_access() and ngx_de_access()
Igor Sysoev <igor@sysoev.ru>
parents:
1048
diff
changeset
|
186 #define ngx_file_access(sb) ((sb)->st_mode & 0777) |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
187 #define ngx_file_size(sb) (sb)->st_size |
4498
569ea17767bf
Workaround for fs_size on ZFS (ticket #46).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4488
diff
changeset
|
188 #define ngx_file_fs_size(sb) ngx_max((sb)->st_size, (sb)->st_blocks * 512) |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
189 #define ngx_file_mtime(sb) (sb)->st_mtime |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
190 #define ngx_file_uniq(sb) (sb)->st_ino |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
191 |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
192 |
3651 | 193 ngx_int_t ngx_create_file_mapping(ngx_file_mapping_t *fm); |
194 void ngx_close_file_mapping(ngx_file_mapping_t *fm); | |
195 | |
196 | |
4558
8865fd1f3aa5
Fixed unconditional MAX_PATH usage (ticket #22).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4498
diff
changeset
|
197 #define ngx_realpath(p, r) (u_char *) realpath((char *) p, (char *) r) |
2259 | 198 #define ngx_realpath_n "realpath()" |
2758 | 199 #define ngx_getcwd(buf, size) (getcwd((char *) buf, size) != NULL) |
336
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
333
diff
changeset
|
200 #define ngx_getcwd_n "getcwd()" |
2744 | 201 #define ngx_path_separator(c) ((c) == '/') |
202 | |
4558
8865fd1f3aa5
Fixed unconditional MAX_PATH usage (ticket #22).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4498
diff
changeset
|
203 |
8865fd1f3aa5
Fixed unconditional MAX_PATH usage (ticket #22).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4498
diff
changeset
|
204 #if defined(PATH_MAX) |
8865fd1f3aa5
Fixed unconditional MAX_PATH usage (ticket #22).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4498
diff
changeset
|
205 |
8865fd1f3aa5
Fixed unconditional MAX_PATH usage (ticket #22).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4498
diff
changeset
|
206 #define NGX_HAVE_MAX_PATH 1 |
336
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
333
diff
changeset
|
207 #define NGX_MAX_PATH PATH_MAX |
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
333
diff
changeset
|
208 |
4558
8865fd1f3aa5
Fixed unconditional MAX_PATH usage (ticket #22).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4498
diff
changeset
|
209 #else |
8865fd1f3aa5
Fixed unconditional MAX_PATH usage (ticket #22).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4498
diff
changeset
|
210 |
8865fd1f3aa5
Fixed unconditional MAX_PATH usage (ticket #22).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4498
diff
changeset
|
211 #define NGX_MAX_PATH 4096 |
8865fd1f3aa5
Fixed unconditional MAX_PATH usage (ticket #22).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4498
diff
changeset
|
212 |
8865fd1f3aa5
Fixed unconditional MAX_PATH usage (ticket #22).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4498
diff
changeset
|
213 #endif |
8865fd1f3aa5
Fixed unconditional MAX_PATH usage (ticket #22).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4498
diff
changeset
|
214 |
8865fd1f3aa5
Fixed unconditional MAX_PATH usage (ticket #22).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4498
diff
changeset
|
215 |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
216 #define NGX_DIR_MASK_LEN 0 |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
217 |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
218 |
467 | 219 ngx_int_t ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir); |
185
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
220 #define ngx_open_dir_n "opendir()" |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
221 |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
222 |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
223 #define ngx_close_dir(d) closedir((d)->dir) |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
224 #define ngx_close_dir_n "closedir()" |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
225 |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
226 |
2234
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
227 ngx_int_t ngx_read_dir(ngx_dir_t *dir); |
185
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
228 #define ngx_read_dir_n "readdir()" |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
229 |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
230 |
669 | 231 #define ngx_create_dir(name, access) mkdir((const char *) name, access) |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
232 #define ngx_create_dir_n "mkdir()" |
74
17ab1af8c3dd
nginx-0.0.1-2003-04-11-20:01:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
233 |
3
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
234 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
235 #define ngx_delete_dir(name) rmdir((const char *) name) |
185
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
236 #define ngx_delete_dir_n "rmdir()" |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
237 |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
238 |
1089
b2e6eb425770
use ngx_dir_access() to enable search bits for directory
Igor Sysoev <igor@sysoev.ru>
parents:
1055
diff
changeset
|
239 #define ngx_dir_access(a) (a | (a & 0444) >> 2) |
b2e6eb425770
use ngx_dir_access() to enable search bits for directory
Igor Sysoev <igor@sysoev.ru>
parents:
1055
diff
changeset
|
240 |
b2e6eb425770
use ngx_dir_access() to enable search bits for directory
Igor Sysoev <igor@sysoev.ru>
parents:
1055
diff
changeset
|
241 |
457 | 242 #define ngx_de_name(dir) ((u_char *) (dir)->de->d_name) |
2234
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
243 #if (NGX_HAVE_D_NAMLEN) |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
244 #define ngx_de_namelen(dir) (dir)->de->d_namlen |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
245 #else |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
246 #define ngx_de_namelen(dir) ngx_strlen((dir)->de->d_name) |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
247 #endif |
3200
26784c34e8be
*) reset cached dirent.d_type after stat()
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
248 |
26784c34e8be
*) reset cached dirent.d_type after stat()
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
249 static ngx_inline ngx_int_t |
26784c34e8be
*) reset cached dirent.d_type after stat()
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
250 ngx_de_info(u_char *name, ngx_dir_t *dir) |
26784c34e8be
*) reset cached dirent.d_type after stat()
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
251 { |
26784c34e8be
*) reset cached dirent.d_type after stat()
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
252 dir->type = 0; |
26784c34e8be
*) reset cached dirent.d_type after stat()
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
253 return stat((const char *) name, &dir->info); |
26784c34e8be
*) reset cached dirent.d_type after stat()
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
254 } |
26784c34e8be
*) reset cached dirent.d_type after stat()
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
255 |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
256 #define ngx_de_info_n "stat()" |
497 | 257 #define ngx_de_link_info(name, dir) lstat((const char *) name, &(dir)->info) |
258 #define ngx_de_link_info_n "lstat()" | |
2234
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
259 |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
260 #if (NGX_HAVE_D_TYPE) |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
261 |
3200
26784c34e8be
*) reset cached dirent.d_type after stat()
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
262 /* |
26784c34e8be
*) reset cached dirent.d_type after stat()
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
263 * some file systems (e.g. XFS on Linux and CD9660 on FreeBSD) |
26784c34e8be
*) reset cached dirent.d_type after stat()
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
264 * do not set dirent.d_type |
26784c34e8be
*) reset cached dirent.d_type after stat()
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
265 */ |
2550
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
266 |
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
267 #define ngx_de_is_dir(dir) \ |
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
268 (((dir)->type) ? ((dir)->type == DT_DIR) : (S_ISDIR((dir)->info.st_mode))) |
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
269 #define ngx_de_is_file(dir) \ |
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
270 (((dir)->type) ? ((dir)->type == DT_REG) : (S_ISREG((dir)->info.st_mode))) |
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
271 #define ngx_de_is_link(dir) \ |
3200
26784c34e8be
*) reset cached dirent.d_type after stat()
Igor Sysoev <igor@sysoev.ru>
parents:
3178
diff
changeset
|
272 (((dir)->type) ? ((dir)->type == DT_LNK) : (S_ISLNK((dir)->info.st_mode))) |
2550
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
273 |
2234
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
274 #else |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
275 |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
276 #define ngx_de_is_dir(dir) (S_ISDIR((dir)->info.st_mode)) |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
277 #define ngx_de_is_file(dir) (S_ISREG((dir)->info.st_mode)) |
497 | 278 #define ngx_de_is_link(dir) (S_ISLNK((dir)->info.st_mode)) |
2234
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
279 |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
280 #endif |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
281 |
1053
b9fa23cda4cc
ngx_file_access() and ngx_de_access()
Igor Sysoev <igor@sysoev.ru>
parents:
1048
diff
changeset
|
282 #define ngx_de_access(dir) (((dir)->info.st_mode) & 0777) |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
283 #define ngx_de_size(dir) (dir)->info.st_size |
4498
569ea17767bf
Workaround for fs_size on ZFS (ticket #46).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4488
diff
changeset
|
284 #define ngx_de_fs_size(dir) \ |
569ea17767bf
Workaround for fs_size on ZFS (ticket #46).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4488
diff
changeset
|
285 ngx_max((dir)->info.st_size, (dir)->info.st_blocks * 512) |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
286 #define ngx_de_mtime(dir) (dir)->info.st_mtime |
3
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
287 |
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
288 |
727 | 289 ngx_int_t ngx_open_glob(ngx_glob_t *gl); |
290 #define ngx_open_glob_n "glob()" | |
291 ngx_int_t ngx_read_glob(ngx_glob_t *gl, ngx_str_t *name); | |
292 void ngx_close_glob(ngx_glob_t *gl); | |
293 | |
294 | |
611 | 295 ngx_err_t ngx_trylock_fd(ngx_fd_t fd); |
296 ngx_err_t ngx_lock_fd(ngx_fd_t fd); | |
297 ngx_err_t ngx_unlock_fd(ngx_fd_t fd); | |
298 | |
299 #define ngx_trylock_fd_n "fcntl(F_SETLK, F_WRLCK)" | |
300 #define ngx_lock_fd_n "fcntl(F_SETLKW, F_WRLCK)" | |
301 #define ngx_unlock_fd_n "fcntl(F_SETLK, F_UNLCK)" | |
302 | |
303 | |
3178 | 304 #if (NGX_HAVE_F_READAHEAD) |
305 | |
306 #define NGX_HAVE_READ_AHEAD 1 | |
307 | |
308 #define ngx_read_ahead(fd, n) fcntl(fd, F_READAHEAD, (int) n) | |
309 #define ngx_read_ahead_n "fcntl(fd, F_READAHEAD)" | |
310 | |
311 #elif (NGX_HAVE_POSIX_FADVISE) | |
312 | |
313 #define NGX_HAVE_READ_AHEAD 1 | |
314 | |
3322
e19df6e65352
fix posix_fadvise() error handling
Igor Sysoev <igor@sysoev.ru>
parents:
3294
diff
changeset
|
315 ngx_int_t ngx_read_ahead(ngx_fd_t fd, size_t n); |
3178 | 316 #define ngx_read_ahead_n "posix_fadvise(POSIX_FADV_SEQUENTIAL)" |
317 | |
318 #else | |
319 | |
320 #define ngx_read_ahead(fd, n) 0 | |
321 #define ngx_read_ahead_n "ngx_read_ahead_n" | |
322 | |
323 #endif | |
324 | |
325 | |
2129 | 326 #if (NGX_HAVE_O_DIRECT) |
327 | |
2248
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
328 ngx_int_t ngx_directio_on(ngx_fd_t fd); |
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
329 #define ngx_directio_on_n "fcntl(O_DIRECT)" |
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
330 |
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
331 ngx_int_t ngx_directio_off(ngx_fd_t fd); |
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
332 #define ngx_directio_off_n "fcntl(!O_DIRECT)" |
2129 | 333 |
334 #elif (NGX_HAVE_F_NOCACHE) | |
335 | |
2248
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
336 #define ngx_directio_on(fd) fcntl(fd, F_NOCACHE, 1) |
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
337 #define ngx_directio_on_n "fcntl(F_NOCACHE, 1)" |
2129 | 338 |
2143 | 339 #elif (NGX_HAVE_DIRECTIO) |
340 | |
2248
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
341 #define ngx_directio_on(fd) directio(fd, DIRECTIO_ON) |
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
342 #define ngx_directio_on_n "directio(DIRECTIO_ON)" |
2143 | 343 |
2129 | 344 #else |
345 | |
2248
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
346 #define ngx_directio_on(fd) 0 |
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
347 #define ngx_directio_on_n "ngx_directio_on_n" |
2129 | 348 |
349 #endif | |
350 | |
2615 | 351 size_t ngx_fs_bsize(u_char *name); |
352 | |
353 | |
4475 | 354 #if (NGX_HAVE_OPENAT) |
355 | |
356 #define ngx_openat_file(fd, name, mode, create, access) \ | |
357 openat(fd, (const char *) name, mode|create, access) | |
358 | |
359 #define ngx_openat_file_n "openat()" | |
360 | |
361 #define ngx_file_at_info(fd, name, sb, flag) \ | |
362 fstatat(fd, (const char *) name, sb, flag) | |
363 | |
364 #define ngx_file_at_info_n "fstatat()" | |
365 | |
4485
f7d131008e9c
Disable symlinks: added explicit cast of AT_FDCWD (ticket #111).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4475
diff
changeset
|
366 #define NGX_AT_FDCWD (ngx_fd_t) AT_FDCWD |
f7d131008e9c
Disable symlinks: added explicit cast of AT_FDCWD (ticket #111).
Maxim Dounin <mdounin@mdounin.ru>
parents:
4475
diff
changeset
|
367 |
4475 | 368 #endif |
369 | |
370 | |
2743
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2686
diff
changeset
|
371 #define ngx_stderr STDERR_FILENO |
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2686
diff
changeset
|
372 #define ngx_set_stderr(fd) dup2(fd, STDERR_FILENO) |
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2686
diff
changeset
|
373 #define ngx_set_stderr_n "dup2(STDERR_FILENO)" |
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2686
diff
changeset
|
374 |
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2686
diff
changeset
|
375 |
3052
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
2933
diff
changeset
|
376 #if (NGX_HAVE_FILE_AIO) |
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
2933
diff
changeset
|
377 |
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
2933
diff
changeset
|
378 ssize_t ngx_file_aio_read(ngx_file_t *file, u_char *buf, size_t size, |
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
2933
diff
changeset
|
379 off_t offset, ngx_pool_t *pool); |
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
2933
diff
changeset
|
380 |
3294
04cfc09b8b8d
export aio presence knowledge to prevent using "aio sendfile",
Igor Sysoev <igor@sysoev.ru>
parents:
3281
diff
changeset
|
381 extern ngx_uint_t ngx_file_aio; |
04cfc09b8b8d
export aio presence knowledge to prevent using "aio sendfile",
Igor Sysoev <igor@sysoev.ru>
parents:
3281
diff
changeset
|
382 |
3052
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
2933
diff
changeset
|
383 #endif |
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
2933
diff
changeset
|
384 |
6060225e9261
FreeBSD and Linux AIO support
Igor Sysoev <igor@sysoev.ru>
parents:
2933
diff
changeset
|
385 |
8
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
6
diff
changeset
|
386 #endif /* _NGX_FILES_H_INCLUDED_ */ |