Mercurial > hg > nginx-vendor-0-8
annotate src/core/ngx_shmtx.c @ 258:6ae1357b7b7c NGINX_0_4_14
nginx 0.4.14
*) Feature: the "proxy_pass_error_message" directive in IMAP/POP3 proxy.
*) Feature: now configure detects system PCRE library on FreeBSD,
Linux, and NetBSD.
*) Bugfix: ngx_http_perl_module did not work with perl built with the
threads support; bug appeared in 0.3.38.
*) Bugfix: ngx_http_perl_module did not work if perl was called
recursively.
*) Bugfix: nginx ignored a host name in an request line.
*) Bugfix: a worker process may got caught in an endless loop, if a
FastCGI server sent too many data to the stderr.
*) Bugfix: the $upstream_response_time variable may be negative if the
system time was changed backward.
*) Bugfix: the "Auth-Login-Attempt" parameter was not sent to IMAP/POP3
proxy authentication server when POP3 was used.
*) Bugfix: a segmentation fault might occur if connect to IMAP/POP3
proxy authentication server failed.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 27 Nov 2006 00:00:00 +0300 |
parents | 73e8476f9142 |
children | 3dbecd747fbb |
rev | line source |
---|---|
160 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #include <ngx_config.h> | |
8 #include <ngx_core.h> | |
9 | |
10 | |
11 #if (NGX_HAVE_ATOMIC_OPS) | |
12 | |
13 | |
14 ngx_int_t | |
258 | 15 ngx_shmtx_create(ngx_shmtx_t *mtx, void *addr, u_char *name) |
160 | 16 { |
17 mtx->lock = addr; | |
18 | |
19 return NGX_OK; | |
20 } | |
21 | |
22 #else | |
23 | |
24 | |
25 ngx_int_t | |
258 | 26 ngx_shmtx_create(ngx_shmtx_t *mtx, void *addr, u_char *name) |
160 | 27 { |
28 if (mtx->name) { | |
29 | |
30 if (ngx_strcmp(name, mtx->name) == 0) { | |
31 mtx->name = name; | |
32 return NGX_OK; | |
33 } | |
34 | |
35 ngx_shmtx_destory(mtx); | |
36 } | |
37 | |
38 mtx->fd = ngx_open_file(name, NGX_FILE_RDWR, NGX_FILE_CREATE_OR_OPEN); | |
39 | |
40 if (mtx->fd == NGX_INVALID_FILE) { | |
258 | 41 ngx_log_error(NGX_LOG_EMERG, ngx_cycle->log, ngx_errno, |
160 | 42 ngx_open_file_n " \"%s\" failed", name); |
43 return NGX_ERROR; | |
44 } | |
45 | |
46 if (ngx_delete_file(name) == NGX_FILE_ERROR) { | |
258 | 47 ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, ngx_errno, |
160 | 48 ngx_delete_file_n " \"%s\" failed", name); |
49 } | |
50 | |
51 mtx->name = name; | |
52 | |
53 return NGX_OK; | |
54 } | |
55 | |
56 | |
57 void | |
58 ngx_shmtx_destory(ngx_shmtx_t *mtx) | |
59 { | |
60 if (ngx_close_file(mtx->fd) == NGX_FILE_ERROR) { | |
258 | 61 ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, ngx_errno, |
160 | 62 ngx_close_file_n " \"%s\" failed", mtx->name); |
63 } | |
64 } | |
65 | |
66 | |
67 #endif |