Mercurial > hg > nginx-quic
annotate src/os/unix/ngx_files.h @ 3015:26ac108cfc39
bump version
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 10 Aug 2009 12:49:06 +0000 |
parents | d24b1739cf9d |
children | 6060225e9261 6b8284fc958d |
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 |
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
|
4 */ |
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 |
8
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
6
diff
changeset
|
7 #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
|
8 #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
|
9 |
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
57
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
11 #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
|
12 #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
|
13 |
a499e0d1f16e
nginx-0.0.1-2003-01-30-10:28:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
26
diff
changeset
|
14 |
2234
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
15 typedef int ngx_fd_t; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
16 typedef struct stat ngx_file_info_t; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
17 typedef ino_t ngx_file_uniq_t; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
18 |
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 typedef struct { |
2933 | 21 DIR *dir; |
22 struct dirent *de; | |
23 struct stat info; | |
2234
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
24 |
2933 | 25 unsigned type:8; |
26 unsigned valid_info:1; | |
27 unsigned valid_type:1; | |
2234
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
28 } ngx_dir_t; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
29 |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
30 |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
31 typedef struct { |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
32 size_t n; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
33 glob_t pglob; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
34 u_char *pattern; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
35 ngx_log_t *log; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
36 ngx_uint_t test; |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
37 } ngx_glob_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 |
26
53cb81681040
nginx-0.0.1-2002-12-15-09:25:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
24
diff
changeset
|
40 #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
|
41 #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
|
42 |
3
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
43 |
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
44 |
1975 | 45 #ifdef __CYGWIN__ |
46 | |
2126
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
1980
diff
changeset
|
47 #define NGX_HAVE_CASELESS_FILESYSTEM 1 |
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
1980
diff
changeset
|
48 |
1975 | 49 #define ngx_open_file(name, mode, create, access) \ |
50 open((const char *) name, mode|create|O_BINARY, access) | |
51 | |
52 #else | |
53 | |
1048
c4f666fc3a7e
ngx_open_file(name, access, create) > ngx_open_file(name, mode, create, access)
Igor Sysoev <igor@sysoev.ru>
parents:
1046
diff
changeset
|
54 #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
|
55 open((const char *) name, mode|create, access) |
1975 | 56 |
57 #endif | |
58 | |
5
62b1a364857c
nginx-0.0.1-2002-08-23-20:14:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
3
diff
changeset
|
59 #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
|
60 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
75
diff
changeset
|
61 #define NGX_FILE_RDONLY O_RDONLY |
1054 | 62 #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
|
63 #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
|
64 #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
|
65 #define NGX_FILE_OPEN 0 |
2686
9e0ae986b587
adopt NGX_FILE_TRUNCATE for win32
Igor Sysoev <igor@sysoev.ru>
parents:
2629
diff
changeset
|
66 #define NGX_FILE_TRUNCATE O_CREAT|O_TRUNC |
2629
367b29612a00
Win32 appends synchronized if only FILE_APPEND_DATA and SYNCHRONIZE are set
Igor Sysoev <igor@sysoev.ru>
parents:
2615
diff
changeset
|
67 #define NGX_FILE_APPEND O_WRONLY|O_APPEND |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
75
diff
changeset
|
68 |
1048
c4f666fc3a7e
ngx_open_file(name, access, create) > ngx_open_file(name, mode, create, access)
Igor Sysoev <igor@sysoev.ru>
parents:
1046
diff
changeset
|
69 #define NGX_FILE_DEFAULT_ACCESS 0644 |
2592
3a8a53c0c42f
a prelimiary proxy cache support
Igor Sysoev <igor@sysoev.ru>
parents:
2550
diff
changeset
|
70 #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
|
71 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
75
diff
changeset
|
72 |
24
77c7629a2627
nginx-0.0.1-2002-12-10-21:05:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
8
diff
changeset
|
73 #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
|
74 #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
|
75 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
75
diff
changeset
|
76 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
77 #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
|
78 #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
|
79 |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
80 |
633 | 81 ngx_fd_t ngx_open_tempfile(u_char *name, ngx_uint_t persistent, |
1046 | 82 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
|
83 #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
|
84 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
75
diff
changeset
|
85 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
86 ssize_t ngx_read_file(ngx_file_t *file, u_char *buf, size_t size, off_t offset); |
2180 | 87 #if (NGX_HAVE_PREAD) |
88 #define ngx_read_file_n "pread()" | |
89 #else | |
5
62b1a364857c
nginx-0.0.1-2002-08-23-20:14:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
3
diff
changeset
|
90 #define ngx_read_file_n "read()" |
2180 | 91 #endif |
3
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
92 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
93 ssize_t ngx_write_file(ngx_file_t *file, u_char *buf, size_t size, |
497 | 94 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
|
95 |
17ab1af8c3dd
nginx-0.0.1-2003-04-11-20:01:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
96 ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *ce, |
497 | 97 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
|
98 |
17ab1af8c3dd
nginx-0.0.1-2003-04-11-20:01:14 import
Igor Sysoev <igor@sysoev.ru>
parents:
57
diff
changeset
|
99 |
1055 | 100 #define ngx_read_fd read |
101 #define ngx_read_fd_n "read()" | |
102 | |
2302
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2259
diff
changeset
|
103 /* |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2259
diff
changeset
|
104 * 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
|
105 * 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
|
106 * 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
|
107 */ |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2259
diff
changeset
|
108 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
|
109 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
|
110 { |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2259
diff
changeset
|
111 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
|
112 } |
2abf14c952a2
compatibility with glibc 2.3, warn_unused_result attribute for write()
Igor Sysoev <igor@sysoev.ru>
parents:
2259
diff
changeset
|
113 |
1055 | 114 #define ngx_write_fd_n "write()" |
115 | |
2769
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2758
diff
changeset
|
116 |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2758
diff
changeset
|
117 #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
|
118 |
9d986c4e796f
introduce ngx_write_console() to support OEM code pages
Igor Sysoev <igor@sysoev.ru>
parents:
2758
diff
changeset
|
119 |
571 | 120 #define ngx_linefeed(p) *p++ = LF; |
121 #define NGX_LINEFEED_SIZE 1 | |
122 | |
123 | |
633 | 124 #define ngx_rename_file(o, n) rename((const char *) o, (const char *) n) |
681 | 125 #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
|
126 |
c42be4185301
nginx-0.0.1-2003-11-03-01:56:18 import
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
127 |
669 | 128 #define ngx_change_file_access(n, a) chmod((const char *) n, a) |
681 | 129 #define ngx_change_file_access_n "chmod()" |
130 | |
131 | |
132 ngx_int_t ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s); | |
133 #define ngx_set_file_time_n "utimes()" | |
669 | 134 |
135 | |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
136 #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
|
137 #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
|
138 |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
139 #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
|
140 #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
|
141 |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
142 #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
|
143 #define ngx_is_file(sb) (S_ISREG((sb)->st_mode)) |
669 | 144 #define ngx_is_link(sb) (S_ISLNK((sb)->st_mode)) |
145 #define ngx_is_exec(sb) ((sb)->st_mode & S_IXUSR) | |
1053
b9fa23cda4cc
ngx_file_access() and ngx_de_access()
Igor Sysoev <igor@sysoev.ru>
parents:
1048
diff
changeset
|
146 #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
|
147 #define ngx_file_size(sb) (sb)->st_size |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
148 #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
|
149 #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
|
150 |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
151 |
2126
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
1980
diff
changeset
|
152 #if (NGX_HAVE_CASELESS_FILESYSTEM) |
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
1980
diff
changeset
|
153 |
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
1980
diff
changeset
|
154 #define ngx_filename_cmp(s1, s2, n) strncasecmp((char *) s1, (char *) s2, n) |
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
1980
diff
changeset
|
155 |
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
1980
diff
changeset
|
156 #else |
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
1980
diff
changeset
|
157 |
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
1980
diff
changeset
|
158 #define ngx_filename_cmp ngx_memcmp |
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
1980
diff
changeset
|
159 |
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
1980
diff
changeset
|
160 #endif |
5e954395a15e
case insensitive file system location support provided by locale only
Igor Sysoev <igor@sysoev.ru>
parents:
1980
diff
changeset
|
161 |
336
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
333
diff
changeset
|
162 |
2259 | 163 #define ngx_realpath(p, r) realpath((char *) p, (char *) r) |
164 #define ngx_realpath_n "realpath()" | |
2758 | 165 #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
|
166 #define ngx_getcwd_n "getcwd()" |
2744 | 167 #define ngx_path_separator(c) ((c) == '/') |
168 | |
336
ca9a7f8c86da
nginx-0.0.3-2004-05-18-19:29:08 import
Igor Sysoev <igor@sysoev.ru>
parents:
333
diff
changeset
|
169 #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
|
170 |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
171 #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
|
172 |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
173 |
467 | 174 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
|
175 #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
|
176 |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
177 |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
178 #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
|
179 #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
|
180 |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
181 |
2234
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
182 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
|
183 #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
|
184 |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
185 |
669 | 186 #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
|
187 #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
|
188 |
3
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
189 |
290
87e73f067470
nginx-0.0.2-2004-03-16-10:10:12 import
Igor Sysoev <igor@sysoev.ru>
parents:
278
diff
changeset
|
190 #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
|
191 #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
|
192 |
d5f50cefc322
nginx-0.0.1-2003-11-14-19:52:04 import
Igor Sysoev <igor@sysoev.ru>
parents:
184
diff
changeset
|
193 |
1089
b2e6eb425770
use ngx_dir_access() to enable search bits for directory
Igor Sysoev <igor@sysoev.ru>
parents:
1055
diff
changeset
|
194 #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
|
195 |
b2e6eb425770
use ngx_dir_access() to enable search bits for directory
Igor Sysoev <igor@sysoev.ru>
parents:
1055
diff
changeset
|
196 |
457 | 197 #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
|
198 #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
|
199 #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
|
200 #else |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
201 #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
|
202 #endif |
497 | 203 #define ngx_de_info(name, dir) stat((const char *) name, &(dir)->info) |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
204 #define ngx_de_info_n "stat()" |
497 | 205 #define ngx_de_link_info(name, dir) lstat((const char *) name, &(dir)->info) |
206 #define ngx_de_link_info_n "lstat()" | |
2234
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
207 |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
208 #if (NGX_HAVE_D_TYPE) |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
209 |
2550
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
210 #if (NGX_LINUX) |
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
211 |
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
212 /* XFS on Linux does not set dirent.d_type */ |
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
213 |
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
214 #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
|
215 (((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
|
216 #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
|
217 (((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
|
218 #define ngx_de_is_link(dir) \ |
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
219 (((dir)->type) ? ((dir)->type == DT_LINK) : (S_ISLNK((dir)->info.st_mode))) |
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
220 |
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
221 #else |
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
222 |
2234
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
223 #define ngx_de_is_dir(dir) ((dir)->type == DT_DIR) |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
224 #define ngx_de_is_file(dir) ((dir)->type == DT_REG) |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
225 #define ngx_de_is_link(dir) ((dir)->type == DT_LINK) |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
226 |
2550
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
227 #endif /* NGX_LINUX */ |
5e87ddb4764f
XFS on Linux does not set dirent.d_type,
Igor Sysoev <igor@sysoev.ru>
parents:
2302
diff
changeset
|
228 |
2234
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
229 #else |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
230 |
186
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
231 #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
|
232 #define ngx_de_is_file(dir) (S_ISREG((dir)->info.st_mode)) |
497 | 233 #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
|
234 |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
235 #endif |
c7c319896bb4
*) autoconfigure struct dirent capabilities
Igor Sysoev <igor@sysoev.ru>
parents:
2232
diff
changeset
|
236 |
1053
b9fa23cda4cc
ngx_file_access() and ngx_de_access()
Igor Sysoev <igor@sysoev.ru>
parents:
1048
diff
changeset
|
237 #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
|
238 #define ngx_de_size(dir) (dir)->info.st_size |
c1f3a3c7c5db
nginx-0.0.1-2003-11-17-00:49:42 import
Igor Sysoev <igor@sysoev.ru>
parents:
185
diff
changeset
|
239 #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
|
240 |
34a521b1a148
nginx-0.0.1-2002-08-20-18:48:28 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
241 |
727 | 242 ngx_int_t ngx_open_glob(ngx_glob_t *gl); |
243 #define ngx_open_glob_n "glob()" | |
244 ngx_int_t ngx_read_glob(ngx_glob_t *gl, ngx_str_t *name); | |
245 void ngx_close_glob(ngx_glob_t *gl); | |
246 | |
247 | |
611 | 248 ngx_err_t ngx_trylock_fd(ngx_fd_t fd); |
249 ngx_err_t ngx_lock_fd(ngx_fd_t fd); | |
250 ngx_err_t ngx_unlock_fd(ngx_fd_t fd); | |
251 | |
252 #define ngx_trylock_fd_n "fcntl(F_SETLK, F_WRLCK)" | |
253 #define ngx_lock_fd_n "fcntl(F_SETLKW, F_WRLCK)" | |
254 #define ngx_unlock_fd_n "fcntl(F_SETLK, F_UNLCK)" | |
255 | |
256 | |
2129 | 257 #if (NGX_HAVE_O_DIRECT) |
258 | |
2248
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
259 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
|
260 #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
|
261 |
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
262 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
|
263 #define ngx_directio_off_n "fcntl(!O_DIRECT)" |
2129 | 264 |
265 #elif (NGX_HAVE_F_NOCACHE) | |
266 | |
2248
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
267 #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
|
268 #define ngx_directio_on_n "fcntl(F_NOCACHE, 1)" |
2129 | 269 |
2143 | 270 #elif (NGX_HAVE_DIRECTIO) |
271 | |
2248
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
272 #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
|
273 #define ngx_directio_on_n "directio(DIRECTIO_ON)" |
2143 | 274 |
2129 | 275 #else |
276 | |
2248
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
277 #define ngx_directio_on(fd) 0 |
1adec90a0e46
disable directio for unaligned reads in Linux
Igor Sysoev <igor@sysoev.ru>
parents:
2234
diff
changeset
|
278 #define ngx_directio_on_n "ngx_directio_on_n" |
2129 | 279 |
280 #endif | |
281 | |
2615 | 282 size_t ngx_fs_bsize(u_char *name); |
283 | |
284 | |
2743
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2686
diff
changeset
|
285 #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
|
286 #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
|
287 #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
|
288 |
d8316f307b6a
issue start up errors and warning on both stderr and error_log
Igor Sysoev <igor@sysoev.ru>
parents:
2686
diff
changeset
|
289 |
8
708f8bb772ec
nginx-0.0.1-2002-09-02-18:48:24 import
Igor Sysoev <igor@sysoev.ru>
parents:
6
diff
changeset
|
290 #endif /* _NGX_FILES_H_INCLUDED_ */ |