Mercurial > hg > nginx-vendor-0-7
annotate src/core/ngx_shmtx.h @ 326:9fc4ab6673f9 NGINX_0_6_7
nginx 0.6.7
*) Change: now the paths specified in the "include",
"auth_basic_user_file", "perl_modules", "ssl_certificate",
"ssl_certificate_key", and "ssl_client_certificate" directives are
relative to directory of nginx configuration file nginx.conf, but
not to nginx prefix directory.
*) Change: the --sysconfdir=PATH option in configure was canceled.
*) Change: the special make target "upgrade1" was defined for online
upgrade of 0.1.x versions.
*) Feature: the "server_name" and "valid_referers" directives support
regular expressions.
*) Feature: the "server" directive in the "upstream" context supports
the "backup" parameter.
*) Feature: the ngx_http_perl_module supports the
$r->discard_request_body.
*) Feature: the "add_header Last-Modified ..." directive changes the
"Last-Modified" response header line.
*) Bugfix: if an response different than 200 was returned to an request
with body and connection went to the keep-alive state after the
request, then nginx returned 400 for the next request.
*) Bugfix: a segmentation fault occurred in worker process if invalid
address was set in the "auth_http" directive.
*) Bugfix: now nginx uses default listen backlog value 511 on all
platforms except FreeBSD.
Thanks to Jiang Hong.
*) Bugfix: a worker process may got caught in an endless loop, if an
"server" inside "upstream" block was marked as "down"; bug appeared
in 0.6.6.
*) Bugfix: now Solaris sendfilev() is not used to transfer the client
request body to FastCGI-server via the unix domain socket.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 15 Aug 2007 00:00:00 +0400 |
parents | 5bef04fc3fd5 |
children | bb941a2996a6 |
rev | line source |
---|---|
160 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #ifndef _NGX_SHMTX_H_INCLUDED_ | |
8 #define _NGX_SHMTX_H_INCLUDED_ | |
9 | |
10 | |
11 #include <ngx_config.h> | |
12 #include <ngx_core.h> | |
13 | |
14 | |
15 typedef struct { | |
16 #if (NGX_HAVE_ATOMIC_OPS) | |
17 ngx_atomic_t *lock; | |
18 #else | |
19 ngx_fd_t fd; | |
20 u_char *name; | |
21 #endif | |
22 } ngx_shmtx_t; | |
23 | |
24 | |
258 | 25 ngx_int_t ngx_shmtx_create(ngx_shmtx_t *mtx, void *addr, u_char *name); |
160 | 26 |
27 | |
28 #if (NGX_HAVE_ATOMIC_OPS) | |
29 | |
30 static ngx_inline ngx_uint_t | |
31 ngx_shmtx_trylock(ngx_shmtx_t *mtx) | |
32 { | |
274 | 33 return (*mtx->lock == 0 && ngx_atomic_cmp_set(mtx->lock, 0, ngx_pid)); |
160 | 34 } |
35 | |
36 #define ngx_shmtx_lock(mtx) ngx_spinlock((mtx)->lock, ngx_pid, 1024) | |
37 | |
38 #define ngx_shmtx_unlock(mtx) (void) ngx_atomic_cmp_set((mtx)->lock, ngx_pid, 0) | |
39 | |
40 #define ngx_shmtx_destory(mtx) | |
41 | |
42 | |
43 #else | |
44 | |
45 static ngx_inline ngx_uint_t | |
46 ngx_shmtx_trylock(ngx_shmtx_t *mtx) | |
47 { | |
48 ngx_err_t err; | |
49 | |
50 err = ngx_trylock_fd(mtx->fd); | |
51 | |
52 if (err == 0) { | |
53 return 1; | |
54 } | |
55 | |
56 if (err == NGX_EAGAIN) { | |
57 return 0; | |
58 } | |
59 | |
258 | 60 ngx_log_abort(err, ngx_trylock_fd_n " failed"); |
286 | 61 |
62 return 0; | |
160 | 63 } |
64 | |
65 | |
66 static ngx_inline void | |
67 ngx_shmtx_lock(ngx_shmtx_t *mtx) | |
68 { | |
69 ngx_err_t err; | |
70 | |
71 err = ngx_lock_fd(mtx->fd); | |
72 | |
73 if (err == 0) { | |
74 return; | |
75 } | |
76 | |
258 | 77 ngx_log_abort(err, ngx_lock_fd_n " failed"); |
160 | 78 } |
79 | |
80 | |
81 static ngx_inline void | |
82 ngx_shmtx_unlock(ngx_shmtx_t *mtx) | |
83 { | |
84 ngx_err_t err; | |
85 | |
86 err = ngx_unlock_fd(mtx->fd); | |
87 | |
88 if (err == 0) { | |
89 return; | |
90 } | |
91 | |
258 | 92 ngx_log_abort(err, ngx_unlock_fd_n " failed"); |
160 | 93 } |
94 | |
95 | |
96 void ngx_shmtx_destory(ngx_shmtx_t *mtx); | |
97 | |
98 #endif | |
99 | |
100 | |
101 #endif /* _NGX_SHMTX_H_INCLUDED_ */ |