View | Details | Raw Unified | Return to bug 43471
Collapse All | Expand All

(-)trunk/server/scoreboard.c (-18 / +6 lines)
Lines 177-215 Link Here
177
 * a scoreboard shared between processes using any IPC technique,
177
 * a scoreboard shared between processes using any IPC technique,
178
 * not just a shared memory segment
178
 * not just a shared memory segment
179
 */
179
 */
180
static apr_status_t open_scoreboard(apr_pool_t *pconf)
180
static apr_status_t open_scoreboard(apr_pool_t *p)
181
{
181
{
182
#if APR_HAS_SHARED_MEMORY
182
#if APR_HAS_SHARED_MEMORY
183
    apr_status_t rv;
183
    apr_status_t rv;
184
    char *fname = NULL;
184
    char *fname = NULL;
185
    apr_pool_t *global_pool;
186
185
187
    /* We don't want to have to recreate the scoreboard after
188
     * restarts, so we'll create a global pool and never clean it.
189
     */
190
    rv = apr_pool_create(&global_pool, NULL);
191
    if (rv != APR_SUCCESS) {
192
        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
193
                     "Fatal error: unable to create global pool "
194
                     "for use by the scoreboard");
195
        return rv;
196
    }
197
198
    /* The config says to create a name-based shmem */
186
    /* The config says to create a name-based shmem */
199
    if (ap_scoreboard_fname) {
187
    if (ap_scoreboard_fname) {
200
        /* make sure it's an absolute pathname */
188
        /* make sure it's an absolute pathname */
201
        fname = ap_server_root_relative(pconf, ap_scoreboard_fname);
189
        fname = ap_server_root_relative(p, ap_scoreboard_fname);
202
        if (!fname) {
190
        if (!fname) {
203
            ap_log_error(APLOG_MARK, APLOG_CRIT, APR_EBADPATH, NULL,
191
            ap_log_error(APLOG_MARK, APLOG_CRIT, APR_EBADPATH, NULL,
204
                         "Fatal error: Invalid Scoreboard path %s",
192
                         "Fatal error: Invalid Scoreboard path %s",
205
                         ap_scoreboard_fname);
193
                         ap_scoreboard_fname);
206
            return APR_EBADPATH;
194
            return APR_EBADPATH;
207
        }
195
        }
208
        return create_namebased_scoreboard(global_pool, fname);
196
        return create_namebased_scoreboard(p, fname);
209
    }
197
    }
210
    else { /* config didn't specify, we get to choose shmem type */
198
    else { /* config didn't specify, we get to choose shmem type */
211
        rv = apr_shm_create(&ap_scoreboard_shm, scoreboard_size, NULL,
199
        rv = apr_shm_create(&ap_scoreboard_shm, scoreboard_size, NULL,
212
                            global_pool); /* anonymous shared memory */
200
                            p); /* anonymous shared memory */
213
        if ((rv != APR_SUCCESS) && (rv != APR_ENOTIMPL)) {
201
        if ((rv != APR_SUCCESS) && (rv != APR_ENOTIMPL)) {
214
            ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
202
            ap_log_error(APLOG_MARK, APLOG_CRIT, rv, NULL,
215
                         "Unable to create or access scoreboard "
203
                         "Unable to create or access scoreboard "
Lines 220-228 Link Here
220
        else if (rv == APR_ENOTIMPL) {
208
        else if (rv == APR_ENOTIMPL) {
221
            /* Make sure it's an absolute pathname */
209
            /* Make sure it's an absolute pathname */
222
            ap_scoreboard_fname = DEFAULT_SCOREBOARD;
210
            ap_scoreboard_fname = DEFAULT_SCOREBOARD;
223
            fname = ap_server_root_relative(pconf, ap_scoreboard_fname);
211
            fname = ap_server_root_relative(p, ap_scoreboard_fname);
224
212
225
            return create_namebased_scoreboard(global_pool, fname);
213
            return create_namebased_scoreboard(p, fname);
226
        }
214
        }
227
    }
215
    }
228
#endif /* APR_HAS_SHARED_MEMORY */
216
#endif /* APR_HAS_SHARED_MEMORY */

Return to bug 43471