<dd>call the callback on all worker slots</dd>
<dt>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)</dt>
- <dd>create a new slotmem with each item size is item_size. <code>name</code> is the filename for the persistant store of
+ <dd>create a new slotmem with each item size is item_size. <code>name</code> is the filename for the persistent store of
the shared memory. Values are:
<dl>
- <dt><code>anonymous</code></dt>
+ <dt><code>"none"</code></dt>
+ <dd><code>Does not persist shared memory in file.</code></dd>
+ <dt><code>"anonymous"</code></dt>
<dd><code>$server_root/logs/anonymous.slotmem</code></dd>
- <dt><code>:module_name.c</code></dt>
- <dd><code>$server_root/logs/module_name.c.slotmem</code></dd>
+ <dt><code>":file-name"</code></dt>
+ <dd><code>$server_root/logs/file-name.slotmem</code></dd>
<dt><code>"absolute-file-name"</code></dt>
<dd><code>$absolute-file-name.slotmem</code></dd>
</dl>
}
/*
- * Persiste the slotmem in a file
+ * Persist the slotmem in a file
* slotmem name and file name.
+ * none : no persistent data
* anonymous : $server_root/logs/anonymous.slotmem
- * :module.c : $server_root/logs/module.c.slotmem
+ * :rel_name : $server_root/logs/rel_name.slotmem
* abs_name : $abs_name.slotmem
*
*/
{
const char *storename;
const char *fname;
- if (strcmp(slotmemname, "anonymous") == 0)
+ if (strcasecmp(slotmemname, "none") == 0)
+ return NULL;
+ else if (strcasecmp(slotmemname, "anonymous") == 0)
fname = ap_server_root_relative(pool, "logs/anonymous");
else if (slotmemname[0] == ':') {
const char *tmpname;
storename = store_filename(slotmem->gpool, slotmem->name);
- rv = apr_file_open(&fp, storename, APR_CREATE | APR_READ | APR_WRITE,
- APR_OS_DEFAULT, slotmem->gpool);
- if (APR_STATUS_IS_EEXIST(rv)) {
- apr_file_remove(storename, slotmem->gpool);
+ if (storename) {
rv = apr_file_open(&fp, storename, APR_CREATE | APR_READ | APR_WRITE,
APR_OS_DEFAULT, slotmem->gpool);
+ if (APR_STATUS_IS_EEXIST(rv)) {
+ apr_file_remove(storename, slotmem->gpool);
+ rv = apr_file_open(&fp, storename, APR_CREATE | APR_READ | APR_WRITE,
+ APR_OS_DEFAULT, slotmem->gpool);
+ }
+ if (rv != APR_SUCCESS) {
+ return;
+ }
+ nbytes = (slotmem->desc.size * slotmem->desc.num) +
+ (slotmem->desc.num * sizeof(char));
+ apr_file_write(fp, slotmem->base, &nbytes);
+ apr_file_close(fp);
}
- if (rv != APR_SUCCESS) {
- return;
- }
- nbytes = (slotmem->desc.size * slotmem->desc.num) +
- (slotmem->desc.num * sizeof(char));
- apr_file_write(fp, slotmem->base, &nbytes);
- apr_file_close(fp);
}
/* should be apr_status_t really */
apr_status_t rv;
storename = store_filename(pool, name);
- rv = apr_file_open(&fp, storename, APR_READ | APR_WRITE, APR_OS_DEFAULT,
- pool);
- if (rv == APR_SUCCESS) {
- apr_finfo_t fi;
- if (apr_file_info_get(&fi, APR_FINFO_SIZE, fp) == APR_SUCCESS) {
- if (fi.size == nbytes) {
- apr_file_read(fp, ptr, &nbytes);
- }
- else {
- apr_file_close(fp);
- apr_file_remove(storename, pool);
- return;
+
+ if (storename) {
+ rv = apr_file_open(&fp, storename, APR_READ | APR_WRITE, APR_OS_DEFAULT,
+ pool);
+ if (rv == APR_SUCCESS) {
+ apr_finfo_t fi;
+ if (apr_file_info_get(&fi, APR_FINFO_SIZE, fp) == APR_SUCCESS) {
+ if (fi.size == nbytes) {
+ apr_file_read(fp, ptr, &nbytes);
+ }
+ else {
+ apr_file_close(fp);
+ apr_file_remove(storename, pool);
+ return;
+ }
}
+ apr_file_close(fp);
}
- apr_file_close(fp);
}
}