Mercurial > hg > nginx
comparison src/os/win32/ngx_shmem.c @ 605:5dac8c7fb71b release-0.3.24
nginx-0.3.24-RELEASE import
*) Workaround: for bug in FreeBSD kqueue.
*) Bugfix: now a response generated by the "post_action" directive is
not transferred to a client.
*) Bugfix: the memory leaks were occurring if many log files were used.
*) Bugfix: the first "proxy_redirect" directive was working inside one
location.
*) Bugfix: on 64-bit platforms segmentation fault may occurred on start
if the many names were used in the "server_name" directives; the bug
had appeared in 0.3.18.
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 01 Feb 2006 18:22:15 +0000 |
parents | |
children | d5896f6608e8 |
comparison
equal
deleted
inserted
replaced
604:f4a6e8f250a8 | 605:5dac8c7fb71b |
---|---|
1 | |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #include <ngx_config.h> | |
8 #include <ngx_core.h> | |
9 | |
10 | |
11 /* | |
12 * TODO: | |
13 * maping name or inheritable handle | |
14 */ | |
15 | |
16 ngx_int_t | |
17 ngx_shm_alloc(ngx_shm_t *shm) | |
18 { | |
19 shm->handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, | |
20 0, shm->size, NULL); | |
21 | |
22 if (shm->handle == NULL) { | |
23 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, | |
24 "CreateFileMapping(%uz) failed", shm->size); | |
25 return NGX_ERROR; | |
26 } | |
27 | |
28 shm->addr = MapViewOfFile(shm->handle, FILE_MAP_WRITE, 0, 0, 0); | |
29 | |
30 if (shm->addr == NULL) { | |
31 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, | |
32 "MapViewOfFile(%uz) failed", shm->size); | |
33 | |
34 if (CloseHandle(shm->handle) == 0) { | |
35 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, | |
36 "CloseHandle() failed"); | |
37 } | |
38 | |
39 return NGX_ERROR; | |
40 } | |
41 | |
42 return NGX_OK; | |
43 } | |
44 | |
45 | |
46 void | |
47 ngx_shm_free(ngx_shm_t *shm) | |
48 { | |
49 if (UnmapViewOfFile(shm->addr) == 0) { | |
50 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, | |
51 "UnmapViewOfFile(%p) failed", shm->addr); | |
52 } | |
53 | |
54 if (CloseHandle(shm->handle) == 0) { | |
55 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, | |
56 "CloseHandle() failed"); | |
57 } | |
58 } |