Mercurial > hg > nginx
comparison src/os/win32/ngx_shmem.c @ 2716:d5896f6608e8
move zone name from ngx_shm_zone_t to ngx_shm_t to use Win32 shared memory
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 16 Apr 2009 19:25:09 +0000 |
parents | 5dac8c7fb71b |
children | b3b8c66bd520 |
comparison
equal
deleted
inserted
replaced
2715:a5845475a903 | 2716:d5896f6608e8 |
---|---|
6 | 6 |
7 #include <ngx_config.h> | 7 #include <ngx_config.h> |
8 #include <ngx_core.h> | 8 #include <ngx_core.h> |
9 | 9 |
10 | 10 |
11 /* | |
12 * TODO: | |
13 * maping name or inheritable handle | |
14 */ | |
15 | |
16 ngx_int_t | 11 ngx_int_t |
17 ngx_shm_alloc(ngx_shm_t *shm) | 12 ngx_shm_alloc(ngx_shm_t *shm) |
18 { | 13 { |
19 shm->handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, | 14 shm->handle = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, |
20 0, shm->size, NULL); | 15 0, shm->size, (char *) shm->name.data); |
21 | 16 |
22 if (shm->handle == NULL) { | 17 if (shm->handle == NULL) { |
23 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, | 18 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, |
24 "CreateFileMapping(%uz) failed", shm->size); | 19 "CreateFileMapping(%uz, %s) failed", |
20 shm->size, shm->name.data); | |
25 return NGX_ERROR; | 21 return NGX_ERROR; |
26 } | 22 } |
27 | 23 |
28 shm->addr = MapViewOfFile(shm->handle, FILE_MAP_WRITE, 0, 0, 0); | 24 shm->addr = MapViewOfFile(shm->handle, FILE_MAP_WRITE, 0, 0, 0); |
29 | 25 |