Return-Path: X-Original-To: apmail-httpd-cvs-archive@www.apache.org Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9FD3ADE02 for ; Tue, 18 Sep 2012 11:00:07 +0000 (UTC) Received: (qmail 81417 invoked by uid 500); 18 Sep 2012 11:00:07 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 81320 invoked by uid 500); 18 Sep 2012 11:00:07 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 81309 invoked by uid 99); 18 Sep 2012 11:00:06 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Sep 2012 11:00:06 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 Sep 2012 11:00:05 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 92C4E23888EA; Tue, 18 Sep 2012 10:59:21 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1387088 - in /httpd/httpd/trunk: docs/manual/mod/mod_slotmem_shm.xml include/ap_slotmem.h modules/slotmem/mod_slotmem_shm.c Date: Tue, 18 Sep 2012 10:59:21 -0000 To: cvs@httpd.apache.org From: jim@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120918105921.92C4E23888EA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jim Date: Tue Sep 18 10:59:20 2012 New Revision: 1387088 URL: http://svn.apache.org/viewvc?rev=1387088&view=rev Log: Add in new type CLEARINUSE which allows the inuse table to be cleared upon storage. This may be expected/wanted/required by some applications Modified: httpd/httpd/trunk/docs/manual/mod/mod_slotmem_shm.xml httpd/httpd/trunk/include/ap_slotmem.h httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c Modified: httpd/httpd/trunk/docs/manual/mod/mod_slotmem_shm.xml URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/manual/mod/mod_slotmem_shm.xml?rev=1387088&r1=1387087&r2=1387088&view=diff ============================================================================== --- httpd/httpd/trunk/docs/manual/mod/mod_slotmem_shm.xml (original) +++ httpd/httpd/trunk/docs/manual/mod/mod_slotmem_shm.xml Tue Sep 18 10:59:20 2012 @@ -51,11 +51,11 @@
call the callback on all worker slots
apr_status_t create(ap_slotmem_instance_t **new, const char *name, apr_size_t item_size, unsigned int item_num, ap_slotmem_type_t type, apr_pool_t *pool)
-
create a new slotmem with each item size is item_size. name is the filename for the persistent store of - the shared memory. Values are: +
create a new slotmem with each item size is item_size. name is used to generate a filename for the persistent store of + the shared memory if configured. Values are:
"none"
-
Does not persist shared memory in file.
+
Anonymous shared memory and no persistent store
"file-name"
[DefaultRuntimeDir]/file-name
"/absolute-file-name"
Modified: httpd/httpd/trunk/include/ap_slotmem.h URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ap_slotmem.h?rev=1387088&r1=1387087&r2=1387088&view=diff ============================================================================== --- httpd/httpd/trunk/include/ap_slotmem.h (original) +++ httpd/httpd/trunk/include/ap_slotmem.h Tue Sep 18 10:59:20 2012 @@ -62,10 +62,14 @@ typedef unsigned int ap_slotmem_type_t; * AP_SLOTMEM_TYPE_NOTMPSAFE: * * AP_SLOTMEM_TYPE_PREALLOC: Access to slots require they be grabbed 1st + * + * AP_SLOTMEM_TYPE_CLEARINUSE: If persisting, clear 'inuse' array before + * storing */ -#define AP_SLOTMEM_TYPE_PERSIST (1 << 0) -#define AP_SLOTMEM_TYPE_NOTMPSAFE (1 << 1) -#define AP_SLOTMEM_TYPE_PREGRAB (1 << 2) +#define AP_SLOTMEM_TYPE_PERSIST (1 << 0) +#define AP_SLOTMEM_TYPE_NOTMPSAFE (1 << 1) +#define AP_SLOTMEM_TYPE_PREGRAB (1 << 2) +#define AP_SLOTMEM_TYPE_CLEARINUSE (1 << 3) typedef struct ap_slotmem_instance_t ap_slotmem_instance_t; Modified: httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c?rev=1387088&r1=1387087&r2=1387088&view=diff ============================================================================== --- httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c (original) +++ httpd/httpd/trunk/modules/slotmem/mod_slotmem_shm.c Tue Sep 18 10:59:20 2012 @@ -43,8 +43,9 @@ #endif #endif -#define AP_SLOTMEM_IS_PREGRAB(t) (t->desc.type & AP_SLOTMEM_TYPE_PREGRAB) -#define AP_SLOTMEM_IS_PERSIST(t) (t->desc.type & AP_SLOTMEM_TYPE_PERSIST) +#define AP_SLOTMEM_IS_PREGRAB(t) (t->desc.type & AP_SLOTMEM_TYPE_PREGRAB) +#define AP_SLOTMEM_IS_PERSIST(t) (t->desc.type & AP_SLOTMEM_TYPE_PERSIST) +#define AP_SLOTMEM_IS_CLEARINUSE(t) (t->desc.type & AP_SLOTMEM_TYPE_CLEARINUSE) /* The description of the slots to reuse the slotmem */ typedef struct { @@ -152,6 +153,25 @@ static const char *slotmem_filename(apr_ return fname; } +static void slotmem_clearinuse(ap_slotmem_instance_t *slot) +{ + unsigned int i; + char *inuse; + + if (!slot) { + return; + } + + inuse = slot->inuse; + + for (i = 0; i < slot->desc.num; i++, inuse++) { + if (*inuse) { + *inuse = 0; + (*slot->num_free)++; + } + } +} + static void store_slotmem(ap_slotmem_instance_t *slotmem) { apr_file_t *fp; @@ -175,6 +195,9 @@ static void store_slotmem(ap_slotmem_ins if (rv != APR_SUCCESS) { return; } + if (AP_SLOTMEM_IS_CLEARINUSE(slotmem)) { + slotmem_clearinuse(slotmem); + } nbytes = (slotmem->desc.size * slotmem->desc.num) + (slotmem->desc.num * sizeof(char)) + AP_UNSIGNEDINT_OFFSET; /* XXX: Error handling */