ngx_open_file(name, access, create) > ngx_open_file(name, mode, create, access)
Igor Sysoev
15 years ago
75 | 75 |
|
76 | 76 |
/* open configuration file */
|
77 | 77 |
|
78 | |
fd = ngx_open_file(filename->data, NGX_FILE_RDONLY, NGX_FILE_OPEN);
|
|
78 |
fd = ngx_open_file(filename->data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
|
79 | 79 |
if (fd == NGX_INVALID_FILE) {
|
80 | 80 |
ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
|
81 | 81 |
ngx_open_file_n " \"%s\" failed",
|
311 | 311 |
}
|
312 | 312 |
|
313 | 313 |
file[i].fd = ngx_open_file(file[i].name.data, NGX_FILE_RDWR,
|
314 | |
NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);
|
|
314 |
NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND,
|
|
315 |
NGX_FILE_DEFAULT_ACCESS);
|
315 | 316 |
|
316 | 317 |
ngx_log_debug3(NGX_LOG_DEBUG_CORE, log, 0,
|
317 | 318 |
"log: %p %d \"%s\"",
|
|
848 | 849 |
trunc = ngx_test_config ? 0 : NGX_FILE_TRUNCATE;
|
849 | 850 |
|
850 | 851 |
file.fd = ngx_open_file(file.name.data, NGX_FILE_RDWR,
|
851 | |
NGX_FILE_CREATE_OR_OPEN|trunc);
|
|
852 |
NGX_FILE_CREATE_OR_OPEN|trunc,
|
|
853 |
NGX_FILE_DEFAULT_ACCESS);
|
852 | 854 |
|
853 | 855 |
if (file.fd == NGX_INVALID_FILE) {
|
854 | 856 |
ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
|
|
958 | 960 |
}
|
959 | 961 |
|
960 | 962 |
fd = ngx_open_file(file[i].name.data, NGX_FILE_RDWR,
|
961 | |
NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);
|
|
963 |
NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND,
|
|
964 |
NGX_FILE_DEFAULT_ACCESS);
|
962 | 965 |
|
963 | 966 |
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
|
964 | 967 |
"reopen file \"%s\", old:%d new:%d",
|
208 | 208 |
ngx_stderr_fileno = GetStdHandle(STD_ERROR_HANDLE);
|
209 | 209 |
|
210 | 210 |
ngx_stderr.fd = ngx_open_file(NGX_ERROR_LOG_PATH, NGX_FILE_RDWR,
|
211 | |
NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND);
|
|
211 |
NGX_FILE_CREATE_OR_OPEN|NGX_FILE_APPEND, 0);
|
212 | 212 |
|
213 | 213 |
if (ngx_stderr.fd == NGX_INVALID_FILE) {
|
214 | 214 |
ngx_message_box("nginx", MB_OK, ngx_errno,
|
132 | 132 |
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
133 | 133 |
}
|
134 | 134 |
|
135 | |
fd = ngx_open_file(alcf->user_file.data, NGX_FILE_RDONLY, NGX_FILE_OPEN);
|
|
135 |
fd = ngx_open_file(alcf->user_file.data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
|
136 | 136 |
|
137 | 137 |
if (fd == NGX_INVALID_FILE) {
|
138 | 138 |
ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
|
108 | 108 |
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
109 | 109 |
}
|
110 | 110 |
|
111 | |
fd = ngx_open_file(path.data, NGX_FILE_RDONLY, NGX_FILE_OPEN);
|
|
111 |
fd = ngx_open_file(path.data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
|
112 | 112 |
|
113 | 113 |
if (fd == NGX_INVALID_FILE) {
|
114 | 114 |
err = ngx_errno;
|
244 | 244 |
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
245 | 245 |
}
|
246 | 246 |
|
247 | |
fd = ngx_open_file(ctx->path.data, NGX_FILE_RDONLY, NGX_FILE_OPEN);
|
|
247 |
fd = ngx_open_file(ctx->path.data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
|
248 | 248 |
|
249 | 249 |
if (fd == (ngx_fd_t) NGX_AGAIN) {
|
250 | 250 |
ctx->current = i;
|
125 | 125 |
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
126 | 126 |
}
|
127 | 127 |
|
128 | |
fd = ngx_open_file(path.data, NGX_FILE_RDONLY, NGX_FILE_OPEN);
|
|
128 |
fd = ngx_open_file(path.data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
|
129 | 129 |
|
130 | 130 |
if (fd == NGX_INVALID_FILE) {
|
131 | 131 |
err = ngx_errno;
|
16 | 16 |
|
17 | 17 |
|
18 | 18 |
|
19 | |
#define ngx_open_file(name, access, create) \
|
20 | |
open((const char *) name, access|create, 0644)
|
|
19 |
#define ngx_open_file(name, mode, create, access) \
|
|
20 |
open((const char *) name, mode|create, access)
|
21 | 21 |
#define ngx_open_file_n "open()"
|
22 | 22 |
|
23 | 23 |
#define NGX_FILE_RDONLY O_RDONLY
|
|
26 | 26 |
#define NGX_FILE_OPEN 0
|
27 | 27 |
#define NGX_FILE_TRUNCATE O_TRUNC
|
28 | 28 |
#define NGX_FILE_APPEND O_APPEND
|
|
29 |
|
|
30 |
#define NGX_FILE_DEFAULT_ACCESS 0644
|
29 | 31 |
|
30 | 32 |
|
31 | 33 |
#define ngx_close_file close
|
27 | 27 |
|
28 | 28 |
|
29 | 29 |
|
30 | |
#define ngx_open_file(name, access, create) \
|
31 | |
CreateFile((const char *) name, access, \
|
|
30 |
#define ngx_open_file(name, mode, create, access) \
|
|
31 |
CreateFile((const char *) name, mode, \
|
32 | 32 |
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, \
|
33 | 33 |
NULL, create, FILE_FLAG_BACKUP_SEMANTICS, NULL)
|
34 | 34 |
/*
|
|
41 | 41 |
#define NGX_FILE_CREATE_OR_OPEN OPEN_ALWAYS
|
42 | 42 |
#define NGX_FILE_OPEN OPEN_EXISTING
|
43 | 43 |
#define NGX_FILE_APPEND 0
|
|
44 |
|
|
45 |
#define NGX_FILE_DEFAULT_ACCESS 0
|
44 | 46 |
|
45 | 47 |
|
46 | 48 |
ngx_int_t ngx_file_append_mode(ngx_fd_t fd);
|