cvs: pecl /apc apc_cache.c apc_main.c
| From: | Rasmus Lerdorf | Date: | Thu, 16 Sep 2004 16:49:27 +0000 |
| Subject: | cvs: pecl /apc apc_cache.c apc_main.c | ||
| Groups: | php.pecl.cvs | ||
| Request: | Send a blank email to pecl-cvs+get-1843@lists.php.net to get a copy of this message | ||
rasmus Thu Sep 16 12:49:27 2004 EDT
Modified files:
/pecl/apc apc_cache.c apc_main.c
Log:
Differentiate between a cache_inser failing due to running out of
shared memory or just failing normally because a newer entry exists.
Fixes Bug #2348
http://cvs.php.net/diff.php/pecl/apc/apc_cache.c?r1=3.71&r2=3.72&ty=u
Index: pecl/apc/apc_cache.c
diff -u pecl/apc/apc_cache.c:3.71 pecl/apc/apc_cache.c:3.72
--- pecl/apc/apc_cache.c:3.71 Tue Sep 14 13:34:28 2004
+++ pecl/apc/apc_cache.c Thu Sep 16 12:49:27 2004
@@ -15,7 +15,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: apc_cache.c,v 3.71 2004/09/14 17:34:28 rasmus Exp $ */
+/* $Id: apc_cache.c,v 3.72 2004/09/16 16:49:27 rasmus Exp $ */
#include "apc_cache.h"
#include "apc_lock.h"
@@ -346,7 +346,7 @@
if ((*slot = make_slot(key, value, *slot, t)) == NULL) {
UNLOCK(cache);
- return 0;
+ return -1;
}
UNLOCK(cache);
http://cvs.php.net/diff.php/pecl/apc/apc_main.c?r1=3.21&r2=3.22&ty=u
Index: pecl/apc/apc_main.c
diff -u pecl/apc/apc_main.c:3.21 pecl/apc/apc_main.c:3.22
--- pecl/apc/apc_main.c:3.21 Sun Sep 12 09:20:56 2004
+++ pecl/apc/apc_main.c Thu Sep 16 12:49:27 2004
@@ -14,7 +14,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: apc_main.c,v 3.21 2004/09/12 13:20:56 rasmus Exp $ */
+/* $Id: apc_main.c,v 3.22 2004/09/16 16:49:27 rasmus Exp $ */
#include "apc_php.h"
#include "apc_main.h"
@@ -130,7 +130,7 @@
apc_cache_key_t key;
apc_cache_entry_t* cache_entry;
zend_op_array* op_array;
- int num_functions, num_classes;
+ int num_functions, num_classes, ret;
zend_op_array* alloc_op_array;
apc_function_t* alloc_functions;
apc_class_t* alloc_classes;
@@ -215,10 +215,12 @@
}
HANDLE_UNBLOCK_INTERRUPTIONS();
- if (!apc_cache_insert(APCG(cache), key, cache_entry, t)) {
+ if ((ret = apc_cache_insert(APCG(cache), key, cache_entry, t)) != 1) {
apc_cache_free_entry(cache_entry);
- apc_cache_expunge(APCG(cache),t);
- apc_log(APC_WARNING, "(apc_cache_insert) unable to cache '%s': insufficient
" "shared memory available", h->opened_path);
+ if(ret==-1) {
+ apc_cache_expunge(APCG(cache),t);
+ apc_log(APC_WARNING, "(apc_cache_insert) unable to cache '%s':
insufficient " "shared memory available", h->opened_path);
+ }
}
return op_array;