Mercurial > hg > nginx-ranges
comparison src/os/unix/ngx_shmem.c @ 188:af37b7cb6698 NGINX_0_3_41
nginx 0.3.41
*) Feature: the -v switch.
*) Bugfix: the segmentation fault may occurred if the SSI page has
remote subrequests.
*) Bugfix: in FastCGI handling.
*) Bugfix: if the perl modules path was not set using
--with-perl_modules_path=PATH or the "perl_modules", then the
segmentation fault was occurred.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Fri, 21 Apr 2006 00:00:00 +0400 |
parents | bb61aa162c6b |
children |
comparison
equal
deleted
inserted
replaced
187:c0ed72c62dfa | 188:af37b7cb6698 |
---|---|
11 #if (NGX_HAVE_MAP_ANON) | 11 #if (NGX_HAVE_MAP_ANON) |
12 | 12 |
13 ngx_int_t | 13 ngx_int_t |
14 ngx_shm_alloc(ngx_shm_t *shm) | 14 ngx_shm_alloc(ngx_shm_t *shm) |
15 { | 15 { |
16 shm->addr = mmap(NULL, shm->size, | 16 shm->addr = (u_char *) mmap(NULL, shm->size, |
17 PROT_READ|PROT_WRITE, MAP_ANON|MAP_SHARED, -1, 0); | 17 PROT_READ|PROT_WRITE, |
18 MAP_ANON|MAP_SHARED, -1, 0); | |
18 | 19 |
19 if (shm->addr == MAP_FAILED) { | 20 if (shm->addr == MAP_FAILED) { |
20 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, | 21 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, |
21 "mmap(MAP_ANON|MAP_SHARED, %uz) failed", shm->size); | 22 "mmap(MAP_ANON|MAP_SHARED, %uz) failed", shm->size); |
22 return NGX_ERROR; | 23 return NGX_ERROR; |
27 | 28 |
28 | 29 |
29 void | 30 void |
30 ngx_shm_free(ngx_shm_t *shm) | 31 ngx_shm_free(ngx_shm_t *shm) |
31 { | 32 { |
32 if (munmap(shm->addr, shm->size) == -1) { | 33 if (munmap((void *) shm->addr, shm->size) == -1) { |
33 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, | 34 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, |
34 "munmap(%p, %uz) failed", shm->addr, shm->size); | 35 "munmap(%p, %uz) failed", shm->addr, shm->size); |
35 } | 36 } |
36 } | 37 } |
37 | 38 |
48 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, | 49 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, |
49 "open(\"/dev/zero\") failed"); | 50 "open(\"/dev/zero\") failed"); |
50 return NGX_ERROR; | 51 return NGX_ERROR; |
51 } | 52 } |
52 | 53 |
53 shm->addr = mmap(NULL, shm->size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); | 54 shm->addr = (u_char *) mmap(NULL, shm->size, PROT_READ|PROT_WRITE, |
55 MAP_SHARED, fd, 0); | |
54 | 56 |
55 if (shm->addr == MAP_FAILED) { | 57 if (shm->addr == MAP_FAILED) { |
56 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, | 58 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, |
57 "mmap(/dev/zero, MAP_SHARED, %uz) failed", shm->size); | 59 "mmap(/dev/zero, MAP_SHARED, %uz) failed", shm->size); |
58 } | 60 } |
67 | 69 |
68 | 70 |
69 void | 71 void |
70 ngx_shm_free(ngx_shm_t *shm) | 72 ngx_shm_free(ngx_shm_t *shm) |
71 { | 73 { |
72 if (munmap(shm->addr, shm->size) == -1) { | 74 if (munmap((void *) shm->addr, shm->size) == -1) { |
73 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, | 75 ngx_log_error(NGX_LOG_ALERT, shm->log, ngx_errno, |
74 "munmap(%p, %uz) failed", shm->addr, shm->size); | 76 "munmap(%p, %uz) failed", shm->addr, shm->size); |
75 } | 77 } |
76 } | 78 } |
77 | 79 |