diff options
Diffstat (limited to 'src/os')
-rw-r--r-- | src/os/unix/ngx_files.c | 18 | ||||
-rw-r--r-- | src/os/unix/ngx_files.h | 8 | ||||
-rw-r--r-- | src/os/win32/nginx_icon16.xpm | 24 | ||||
-rw-r--r-- | src/os/win32/nginx_icon32.xpm | 39 | ||||
-rw-r--r-- | src/os/win32/nginx_tray.xpm | 24 | ||||
-rw-r--r-- | src/os/win32/ngx_files.c | 27 | ||||
-rw-r--r-- | src/os/win32/ngx_files.h | 7 |
7 files changed, 141 insertions, 6 deletions
diff --git a/src/os/unix/ngx_files.c b/src/os/unix/ngx_files.c index 575831390..1801045ab 100644 --- a/src/os/unix/ngx_files.c +++ b/src/os/unix/ngx_files.c @@ -221,6 +221,24 @@ ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *cl, off_t offset, ngx_int_t +ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s) +{ + struct timeval tv[2]; + + tv[0].tv_sec = s; + tv[0].tv_usec = 0; + tv[1].tv_sec = s; + tv[1].tv_usec = 0; + + if (utimes((char *) name, tv) != -1) { + return NGX_OK; + } + + return NGX_ERROR; +} + + +ngx_int_t ngx_open_dir(ngx_str_t *name, ngx_dir_t *dir) { dir->dir = opendir((const char *) name->data); diff --git a/src/os/unix/ngx_files.h b/src/os/unix/ngx_files.h index dffef52a5..ff2515699 100644 --- a/src/os/unix/ngx_files.h +++ b/src/os/unix/ngx_files.h @@ -58,11 +58,15 @@ ssize_t ngx_write_chain_to_file(ngx_file_t *file, ngx_chain_t *ce, #define ngx_rename_file(o, n) rename((const char *) o, (const char *) n) -#define ngx_rename_file_n "rename" +#define ngx_rename_file_n "rename()" #define ngx_change_file_access(n, a) chmod((const char *) n, a) -#define ngx_change_file_access_n "chmod" +#define ngx_change_file_access_n "chmod()" + + +ngx_int_t ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s); +#define ngx_set_file_time_n "utimes()" #define ngx_file_info(file, sb) stat((const char *) file, sb) diff --git a/src/os/win32/nginx_icon16.xpm b/src/os/win32/nginx_icon16.xpm new file mode 100644 index 000000000..8996864db --- /dev/null +++ b/src/os/win32/nginx_icon16.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char * nginx_xpm[] = { +"16 16 2 2", +/* colors */ +" c none", +"GG c #009900", +/* pixels */ +" ", +" GGGGGGGGGGGGGGGG ", +" GGGGGGGGGGGGGGGG ", +" GGGGGGGGGGGGGGGGGGGG ", +" GGGGGG GGGGGG ", +" GGGGGG GGGGGG ", +" GGGGGG ", +" GGGGGG GGGGGGGGGGGGGGGG ", +" GGGGGG GGGGGGGGGGGGGGGGGG ", +" GGGGGG GGGGGGGGGGGGGG ", +" GGGGGG GGGGGG ", +" GGGGGG GGGGGG ", +" GGGGGGGGGGGGGGGGGGGG ", +" GGGGGGGGGGGGGGGG ", +" GGGGGGGGGGGGGGGG ", +" " +}; diff --git a/src/os/win32/nginx_icon32.xpm b/src/os/win32/nginx_icon32.xpm new file mode 100644 index 000000000..eb2663884 --- /dev/null +++ b/src/os/win32/nginx_icon32.xpm @@ -0,0 +1,39 @@ +/* XPM */ +static char * nginx_xpm[] = { +"32 32 2 2", +/* colors */ +" c none", +"GG c #009900", +/* pixels */ +" ", +" ", +" ", +" ", +" GGGGGGGGGGGGGGGGGGGGGGGGGGGG ", +" GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ", +" GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ", +" GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ", +" GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ", +" GGGGGGGGGG GGGGGGGGGG ", +" GGGGGGGGGG GGGGGGGGGG ", +" GGGGGGGGGG GGGGGGGGGG ", +" GGGGGGGGGG GGGGGGGGGG ", +" GGGGGGGGGG ", +" GGGGGGGGGG ", +" GGGGGGGGGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ", +" GGGGGGGGGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ", +" GGGGGGGGGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ", +" GGGGGGGGGG GGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ", +" GGGGGGGGGG GGGGGGGGGGGGGGGGGGGGGGGGGG ", +" GGGGGGGGGG GGGGGGGGGG ", +" GGGGGGGGGG GGGGGGGGGG ", +" GGGGGGGGGG GGGGGGGGGG ", +" GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ", +" GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ", +" GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ", +" GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG ", +" GGGGGGGGGGGGGGGGGGGGGGGGGGGG ", +" ", +" ", +" ", +" " diff --git a/src/os/win32/nginx_tray.xpm b/src/os/win32/nginx_tray.xpm new file mode 100644 index 000000000..6a8a6ea17 --- /dev/null +++ b/src/os/win32/nginx_tray.xpm @@ -0,0 +1,24 @@ +/* XPM */ +static char * nginx_xpm[] = { +"16 16 2 2", +/* colors */ +" c none", +"GG c #008000", +/* pixels */ +" ", +" GGGGGGGGGGGGGGGG ", +" GGGGGGGGGGGGGGGG ", +" GGGGGGGGGGGGGGGGGGGG ", +" GGGGGG GGGGGG ", +" GGGGGG GGGGGG ", +" GGGGGG ", +" GGGGGG GGGGGGGGGGGGGGGG ", +" GGGGGG GGGGGGGGGGGGGGGGGG ", +" GGGGGG GGGGGGGGGGGGGG ", +" GGGGGG GGGGGG ", +" GGGGGG GGGGGG ", +" GGGGGGGGGGGGGGGGGGGG ", +" GGGGGGGGGGGGGGGG ", +" GGGGGGGGGGGGGGGG ", +" " +}; diff --git a/src/os/win32/ngx_files.c b/src/os/win32/ngx_files.c index dcffca7ea..aee87043b 100644 --- a/src/os/win32/ngx_files.c +++ b/src/os/win32/ngx_files.c @@ -261,6 +261,27 @@ ngx_file_info(char *file, ngx_file_info_t *sb) ngx_int_t +ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s) +{ + uint64_t intervals; + FILETIME ft; + + /* 116444736000000000 is commented in src/os/win32/ngx_time.c */ + + intervals = s * 10000000 + 116444736000000000; + + ft.dwLowDateTime = (DWORD) intervals; + ft.dwHighDateTime = (DWORD) (intervals >> 32); + + if (SetFileTime(fd, NULL, NULL, &ft) != 0) { + return NGX_OK; + } + + return NGX_ERROR; +} + + +ngx_int_t ngx_file_info(u_char *file, ngx_file_info_t *sb) { /* Win95 */ @@ -301,11 +322,11 @@ ngx_read_dir(ngx_dir_t *dir) return NGX_OK; } - if (FindNextFile(dir->dir, &dir->fd) == 0) { - return NGX_ERROR; + if (FindNextFile(dir->dir, &dir->fd) != 0) { + return NGX_OK; } - return NGX_OK; + return NGX_ERROR; } diff --git a/src/os/win32/ngx_files.h b/src/os/win32/ngx_files.h index b1c72300a..c42c055f3 100644 --- a/src/os/win32/ngx_files.h +++ b/src/os/win32/ngx_files.h @@ -80,12 +80,17 @@ ngx_int_t ngx_win32_rename_file(ngx_str_t *from, ngx_str_t *to, ngx_pool_t *pool); + +ngx_int_t ngx_set_file_time(u_char *name, ngx_fd_t fd, time_t s); +#define ngx_set_file_time_n "SetFileTime()" + + ngx_int_t ngx_file_info(u_char *filename, ngx_file_info_t *fi); #define ngx_file_info_n "GetFileAttributesEx()" #define ngx_fd_info(fd, fi) GetFileInformationByHandle(fd, fi) -#define ngx_fd_info_n "GetFileInformationByHandle" +#define ngx_fd_info_n "GetFileInformationByHandle()" #define ngx_is_dir(fi) ((fi)->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) |