Klaus Demo nginx / a0951d5
fix win32 ngx_read_fd() and ngx_write_fd() Igor Sysoev 14 years ago
2 changed file(s) with 30 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
173173 }
174174
175175
176 ssize_t
177 ngx_read_fd(ngx_fd_t fd, void *buf, size_t size)
178 {
179 u_long n;
180
181 if (ReadFile(fd, buf, size, &n, NULL) != 0) {
182 return (size_t) n;
183 }
184
185 return -1;
186 }
187
188
189 ssize_t
190 ngx_write_fd(ngx_fd_t fd, void *buf, size_t size)
191 {
192 u_long n;
193
194 if (WriteFile(fd, buf, size, &n, NULL) != 0) {
195 return (size_t) n;
196 }
197
198 return -1;
199 }
200
201
176202 ngx_int_t
177203 ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to, ngx_pool_t *pool)
178204 {
6767 #define ngx_close_file_n "CloseHandle()"
6868
6969
70 #define ngx_read_fd(fd, buf, size) ReadFile(fd, buf, size, NULL, NULL)
70 ssize_t ngx_read_fd(ngx_fd_t fd, void *buf, size_t size);
7171 #define ngx_read_fd_n "ReadFile()"
7272
73 #define ngx_write_fd(fd, buf, size) WriteFile(fd, buf, size, NULL, NULL)
73
74 ssize_t ngx_write_fd(ngx_fd_t fd, void *buf, size_t size);
7475 #define ngx_write_fd_n "WriteFile()"
76
7577
7678 #define ngx_linefeed(p) *p++ = CR; *p++ = LF;
7779 #define NGX_LINEFEED_SIZE 2