diff options
Diffstat (limited to '')
| -rw-r--r-- | src/os/unix/freebsd/ngx_rfork_thread.c (renamed from src/os/freebsd/ngx_os_thread.c) | 4 | ||||
| -rw-r--r-- | src/os/unix/freebsd/ngx_rfork_thread.h (renamed from src/os/freebsd/ngx_os_thread.h) | 0 | ||||
| -rw-r--r-- | src/os/unix/freebsd/ngx_sendfile.c (renamed from src/os/unix/ngx_sendfile.c) | 6 | ||||
| -rw-r--r-- | src/os/unix/ngx_errno.h | 1 | ||||
| -rw-r--r-- | src/os/unix/ngx_file.h | 29 | ||||
| -rw-r--r-- | src/os/unix/ngx_sendfile.h | 2 | ||||
| -rw-r--r-- | src/os/unix/ngx_sendv.c | 1 | ||||
| -rw-r--r-- | src/os/unix/ngx_sendv.h | 1 | ||||
| -rw-r--r-- | src/os/unix/ngx_socket.h | 3 | ||||
| -rw-r--r-- | src/os/unix/ngx_stat.h | 19 | ||||
| -rw-r--r-- | src/os/unix/ngx_time.h | 2 | ||||
| -rw-r--r-- | src/os/unix/ngx_types.h | 2 |
12 files changed, 45 insertions, 25 deletions
diff --git a/src/os/freebsd/ngx_os_thread.c b/src/os/unix/freebsd/ngx_rfork_thread.c index f40956e20..acd5ec6e2 100644 --- a/src/os/freebsd/ngx_os_thread.c +++ b/src/os/unix/freebsd/ngx_rfork_thread.c @@ -17,7 +17,7 @@ int *__error() } -int ngx_create_os_thread(ngx_os_tid_t *tid, void *stack, +int ngx_create_thread(ngx_os_tid_t *tid, void *stack, int (*func)(void *arg), void *arg, ngx_log_t log) { int id, err; @@ -35,7 +35,7 @@ int ngx_create_os_thread(ngx_os_tid_t *tid, void *stack, } -int ngx_create_os_thread_env(int n, size_t size, ngx_log_t log) +int ngx_create_thread_env(int n, size_t size, ngx_log_t log) { char *addr; diff --git a/src/os/freebsd/ngx_os_thread.h b/src/os/unix/freebsd/ngx_rfork_thread.h index bd500e1a4..bd500e1a4 100644 --- a/src/os/freebsd/ngx_os_thread.h +++ b/src/os/unix/freebsd/ngx_rfork_thread.h diff --git a/src/os/unix/ngx_sendfile.c b/src/os/unix/freebsd/ngx_sendfile.c index 2bc157361..31915e405 100644 --- a/src/os/unix/ngx_sendfile.c +++ b/src/os/unix/freebsd/ngx_sendfile.c @@ -1,6 +1,8 @@ #include <ngx_config.h> #include <ngx_types.h> +#include <ngx_file.h> +#include <ngx_socket.h> #include <ngx_errno.h> #include <ngx_log.h> #include <ngx_sendv.h> @@ -56,8 +58,8 @@ int ngx_sendfile(ngx_socket_t s, } } - ngx_log_debug(log, "ngx_sendfile: %d, @%qd %d:%qd" _ - rc _ offset _ nbytes _ *sent); + ngx_log_debug(log, "ngx_sendfile: %d, @%qd %qd:%d" _ + rc _ offset _ *sent _ nbytes); return 0; } diff --git a/src/os/unix/ngx_errno.h b/src/os/unix/ngx_errno.h index c14a977fa..2649fe9b4 100644 --- a/src/os/unix/ngx_errno.h +++ b/src/os/unix/ngx_errno.h @@ -10,6 +10,7 @@ typedef int ngx_err_t; #define NGX_ENOENT ENOENT #define NGX_EINTR EINTR #define NGX_EAGAIN EWOULDBLOCK +#define NGX_EADDRINUSE EADDRINUSE #define ngx_errno errno #define ngx_socket_errno errno diff --git a/src/os/unix/ngx_file.h b/src/os/unix/ngx_file.h new file mode 100644 index 000000000..0e05b8424 --- /dev/null +++ b/src/os/unix/ngx_file.h @@ -0,0 +1,29 @@ +#ifndef _NGX_FILE_H_INCLUDED_ +#define _NGX_FILE_H_INCLUDED_ + + +#include <sys/types.h> +#include <sys/stat.h> + +typedef int ngx_file_t; +typedef struct stat ngx_file_info_t; + + +#define ngx_open_file open +#define ngx_open_file_n "open" + +#define NGX_FILE_RDONLY O_RDONLY + + +#define ngx_file_type(file, sb) stat(file, sb) +#define ngx_file_type_n "stat" + +#define ngx_stat_fd(fd, sb) fstat(fd, sb) +#define ngx_stat_fd_n "fstat" + +#define ngx_is_dir(sb) (S_ISDIR(sb.st_mode)) +#define ngx_file_size(sb) sb.st_size +#define ngx_file_mtime(sb) sb.st_mtime + + +#endif /* _NGX_FILE_H_INCLUDED_ */ diff --git a/src/os/unix/ngx_sendfile.h b/src/os/unix/ngx_sendfile.h index a347c6c50..0a0a25e76 100644 --- a/src/os/unix/ngx_sendfile.h +++ b/src/os/unix/ngx_sendfile.h @@ -3,6 +3,8 @@ #include <ngx_types.h> +#include <ngx_file.h> +#include <ngx_socket.h> #include <ngx_log.h> #include <ngx_sendv.h> diff --git a/src/os/unix/ngx_sendv.c b/src/os/unix/ngx_sendv.c index bd95d7a7d..22838c2bb 100644 --- a/src/os/unix/ngx_sendv.c +++ b/src/os/unix/ngx_sendv.c @@ -1,5 +1,6 @@ #include <ngx_types.h> +#include <ngx_socket.h> #include <ngx_sendv.h> ssize_t ngx_sendv(ngx_socket_t s, ngx_iovec_t *iovec, int n, size_t *sent) diff --git a/src/os/unix/ngx_sendv.h b/src/os/unix/ngx_sendv.h index 16c24039b..5906e423b 100644 --- a/src/os/unix/ngx_sendv.h +++ b/src/os/unix/ngx_sendv.h @@ -3,6 +3,7 @@ #include <ngx_types.h> +#include <ngx_socket.h> typedef struct iovec ngx_iovec_t; #define ngx_iov_base iov_base diff --git a/src/os/unix/ngx_socket.h b/src/os/unix/ngx_socket.h index 18c07f9b0..e9e797474 100644 --- a/src/os/unix/ngx_socket.h +++ b/src/os/unix/ngx_socket.h @@ -12,5 +12,8 @@ typedef int ngx_socket_t; #define ngx_nonblocking(s) fcntl(s, F_SETFL, O_NONBLOCK) #define ngx_nonblocking_n "fcntl (O_NONBLOCK)" +#define ngx_close_socket close +#define ngx_close_socket_n "close" + #endif /* _NGX_SOCKET_H_INCLUDED_ */ diff --git a/src/os/unix/ngx_stat.h b/src/os/unix/ngx_stat.h deleted file mode 100644 index f42edff13..000000000 --- a/src/os/unix/ngx_stat.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef _NGX_STAT_H_INCLUDED_ -#define _NGX_STAT_H_INCLUDED_ - - -#include <sys/types.h> -#include <sys/stat.h> - -typedef struct stat ngx_stat_t; - -#define ngx_is_dir(sb) (S_ISDIR(sb.st_mode)) - -#define ngx_stat(file, sb) stat(file, sb) -#define ngx_stat_n "stat" - -#define ngx_fstat(file, fd, sb) fstat(fd, sb) -#define ngx_fstat_n "stat" - - -#endif /* _NGX_STAT_H_INCLUDED_ */ diff --git a/src/os/unix/ngx_time.h b/src/os/unix/ngx_time.h index b262da7cf..f81ee4efc 100644 --- a/src/os/unix/ngx_time.h +++ b/src/os/unix/ngx_time.h @@ -14,6 +14,8 @@ typedef struct tm ngx_tm_t; #define ngx_tm_year tm_year #define ngx_tm_wday tm_wday +#define ngx_msleep(ms) usleep(ms * 1000) + void ngx_localtime(ngx_tm_t *tm); u_int ngx_msec(void); diff --git a/src/os/unix/ngx_types.h b/src/os/unix/ngx_types.h index ebcbb1fac..94417cba9 100644 --- a/src/os/unix/ngx_types.h +++ b/src/os/unix/ngx_types.h @@ -5,8 +5,6 @@ #include <ngx_config.h> -typedef int ngx_file_t; -typedef int ngx_socket_t; #endif /* _NGX_TYPES_H_INCLUDED_ */ |
