Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2004-06-06 23:49:18 +0400
committerIgor Sysoev <igor@sysoev.ru>2004-06-06 23:49:18 +0400
commit0ab91b901299ac41e3867ebec7e04e5082a4c8b4 (patch)
treeb89e863c141bc482c85c351f84d9dca1d3570789 /src/os/win32
parent6e1bbd78967660b49e3a120bbeec6382ed193d5f (diff)
nginx-0.0.3-2004-06-06-23:49:18 import
Diffstat (limited to 'src/os/win32')
-rw-r--r--src/os/win32/ngx_alloc.c36
-rw-r--r--src/os/win32/ngx_alloc.h18
-rw-r--r--src/os/win32/ngx_win32_init.c4
3 files changed, 58 insertions, 0 deletions
diff --git a/src/os/win32/ngx_alloc.c b/src/os/win32/ngx_alloc.c
new file mode 100644
index 000000000..591e61bcb
--- /dev/null
+++ b/src/os/win32/ngx_alloc.c
@@ -0,0 +1,36 @@
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+
+
+int ngx_pagesize;
+
+
+void *ngx_alloc(size_t size, ngx_log_t *log)
+{
+ void *p;
+
+ if (!(p = malloc(size))) {
+ ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
+ "malloc() " SIZE_T_FMT " bytes failed", size);
+ }
+
+ ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0,
+ "malloc: " PTR_FMT ":" SIZE_T_FMT, p, size);
+
+ return p;
+}
+
+
+void *ngx_calloc(size_t size, ngx_log_t *log)
+{
+ void *p;
+
+ p = ngx_alloc(size, log);
+
+ if (p) {
+ ngx_memzero(p, size);
+ }
+
+ return p;
+}
diff --git a/src/os/win32/ngx_alloc.h b/src/os/win32/ngx_alloc.h
new file mode 100644
index 000000000..d6ea00a2b
--- /dev/null
+++ b/src/os/win32/ngx_alloc.h
@@ -0,0 +1,18 @@
+#ifndef _NGX_ALLOC_H_INCLUDED_
+#define _NGX_ALLOC_H_INCLUDED_
+
+
+#include <ngx_config.h>
+#include <ngx_core.h>
+
+
+void *ngx_alloc(size_t size, ngx_log_t *log);
+void *ngx_calloc(size_t size, ngx_log_t *log);
+
+#define ngx_free free
+#define ngx_memalign(alignment, size, log) ngx_alloc(size, log)
+
+extern int ngx_pagesize;
+
+
+#endif /* _NGX_ALLOC_H_INCLUDED_ */
diff --git a/src/os/win32/ngx_win32_init.c b/src/os/win32/ngx_win32_init.c
index c4ffc1121..7a25b2845 100644
--- a/src/os/win32/ngx_win32_init.c
+++ b/src/os/win32/ngx_win32_init.c
@@ -40,6 +40,7 @@ int ngx_os_init(ngx_log_t *log)
DWORD bytes;
SOCKET s;
WSADATA wsd;
+ SYSTEM_INFO si;
OSVERSIONINFOEX osvi;
ngx_osviex_stub_t *osviex_stub;
@@ -121,6 +122,9 @@ int ngx_os_init(ngx_log_t *log)
}
}
+ GetSystemInfo(&si);
+ ngx_pagesize = si.dwPageSize;
+
/* init Winsock */