nginx-quic/src/os/win32/ngx_files.h

89 lines
3.2 KiB
C
Raw Normal View History

2002-09-02 10:48:24 -04:00
#ifndef _NGX_FILES_H_INCLUDED_
#define _NGX_FILES_H_INCLUDED_
2002-08-20 10:48:28 -04:00
#include <ngx_config.h>
2003-06-03 11:42:58 -04:00
#include <ngx_core.h>
2003-01-30 04:28:09 -03:00
2002-08-20 10:48:28 -04:00
/* INVALID_FILE_ATTRIBUTES specified but not defined at least in MSVC6SP2 */
2002-08-20 10:48:28 -04:00
#ifndef INVALID_FILE_ATTRIBUTES
2003-06-03 11:42:58 -04:00
#define INVALID_FILE_ATTRIBUTES 0xFFFFFFFF
2002-08-20 10:48:28 -04:00
#endif
2002-12-15 03:25:09 -03:00
#define NGX_INVALID_FILE INVALID_HANDLE_VALUE
#define NGX_FILE_ERROR 0
2002-08-20 10:48:28 -04:00
2003-06-02 11:24:30 -04:00
#define ngx_open_file(name, access, create) \
2003-06-03 11:42:58 -04:00
CreateFile(name, access, \
2002-08-20 10:48:28 -04:00
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, \
2003-06-02 11:24:30 -04:00
NULL, create, FILE_FLAG_BACKUP_SEMANTICS, NULL)
2002-12-15 18:08:04 -03:00
/*
2002-08-20 10:48:28 -04:00
NULL, OPEN_EXISTING, 0, NULL)
2002-12-15 18:08:04 -03:00
*/
2003-06-02 11:24:30 -04:00
#define ngx_open_file_n "CreateFile()"
#define NGX_FILE_RDONLY GENERIC_READ
#define NGX_FILE_RDWR GENERIC_READ|GENERIC_WRITE
#define NGX_FILE_CREATE_OR_OPEN OPEN_ALWAYS
#define NGX_FILE_OPEN OPEN_EXISTING
2003-06-03 11:42:58 -04:00
#define NGX_FILE_APPEND 0
int ngx_file_append_mode(ngx_fd_t fd);
#define ngx_file_append_mode_n "SetFilePointer()"
2003-06-02 11:24:30 -04:00
2002-08-20 10:48:28 -04:00
2003-04-11 12:01:14 -04:00
#define ngx_open_tempfile(name, persistent) \
CreateFile(name, \
GENERIC_READ|GENERIC_WRITE, \
FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, \
NULL, \
CREATE_NEW, \
persistent ? 0: \
FILE_ATTRIBUTE_TEMPORARY|FILE_FLAG_DELETE_ON_CLOSE, \
NULL);
2003-05-20 11:37:55 -04:00
#define ngx_open_tempfile_n "CreateFile()"
2002-12-15 03:25:09 -03:00
#define ngx_close_file CloseHandle
#define ngx_close_file_n "CloseHandle()"
2002-08-20 10:48:28 -04:00
2003-04-11 12:01:14 -04:00
#define ngx_mkdir(name) CreateDirectory(name, NULL)
#define ngx_mkdir_n "CreateDirectory()"
2002-08-20 10:48:28 -04:00
int ngx_file_type(char *filename, ngx_file_info_t *fi);
2002-12-15 03:25:09 -03:00
#define ngx_file_type_n "GetFileAttributes"
2002-08-20 10:48:28 -04:00
2003-05-30 10:27:59 -04:00
#define ngx_stat_fd(fd, fi) GetFileInformationByHandle(fd, fi)
#define ngx_stat_fd_n "GetFileInformationByHandle"
2002-08-20 10:48:28 -04:00
2002-12-15 03:25:09 -03:00
#define ngx_is_dir(fi) (fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
#define ngx_is_file(fi) !(fi.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
2002-08-20 10:48:28 -04:00
#define ngx_file_size(fi) \
2002-12-15 03:25:09 -03:00
(((off_t) fi.nFileSizeHigh << 32) | fi.nFileSizeLow)
2002-08-20 10:48:28 -04:00
#define ngx_file_uniq(fi) (*(ngx_file_uniq_t *) &fi.nFileIndexHigh)
2002-08-20 10:48:28 -04:00
2003-11-11 15:13:43 -03:00
/* 116444736000000000 is commented in src/os/win32/ngx_time.c */
2002-08-20 10:48:28 -04:00
2002-12-15 03:25:09 -03:00
#define ngx_file_mtime(fi) \
(time_t) (((((unsigned __int64) fi.ftLastWriteTime.dwHighDateTime << 32) \
| fi.ftLastWriteTime.dwLowDateTime) \
- 116444736000000000) / 10000000)
2002-08-20 10:48:28 -04:00
2003-01-30 04:28:09 -03:00
ssize_t ngx_read_file(ngx_file_t *file, char *buf, size_t size, off_t offset);
2003-05-30 10:27:59 -04:00
#define ngx_read_file_n "ReadFile()"
#define STDERR_FILENO (HANDLE) 2
2002-09-02 10:48:24 -04:00
#endif /* _NGX_FILES_H_INCLUDED_ */