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

(-)os/unix/unixd.c (+24 lines)
Lines 437-447 AP_DECLARE(apr_status_t) ap_unixd_accept(void **ac Link Here
437
/* Unixes MPMs' */
437
/* Unixes MPMs' */
438
438
439
static ap_unixd_mpm_retained_data *retained_data = NULL;
439
static ap_unixd_mpm_retained_data *retained_data = NULL;
440
static apr_status_t retained_data_cleanup(void *unused)
441
{
442
    (void)unused;
443
    retained_data = NULL;
444
    return APR_SUCCESS;
445
}
446
440
AP_DECLARE(ap_unixd_mpm_retained_data *) ap_unixd_mpm_get_retained_data()
447
AP_DECLARE(ap_unixd_mpm_retained_data *) ap_unixd_mpm_get_retained_data()
441
{
448
{
442
    if (!retained_data) {
449
    if (!retained_data) {
443
        retained_data = ap_retained_data_create("ap_unixd_mpm_retained_data",
450
        retained_data = ap_retained_data_create("ap_unixd_mpm_retained_data",
444
                                                sizeof(*retained_data));
451
                                                sizeof(*retained_data));
452
        apr_pool_pre_cleanup_register(ap_pglobal, NULL, retained_data_cleanup);
445
        retained_data->mpm_state = AP_MPMQ_STARTING;
453
        retained_data->mpm_state = AP_MPMQ_STARTING;
446
    }
454
    }
447
    return retained_data;
455
    return retained_data;
Lines 449-454 AP_DECLARE(ap_unixd_mpm_retained_data *) ap_unixd_ Link Here
449
457
450
static void sig_term(int sig)
458
static void sig_term(int sig)
451
{
459
{
460
    if (!retained_data) {
461
        /* Main process (ap_pglobal) is dying */
462
        return;
463
    }
452
    retained_data->mpm_state = AP_MPMQ_STOPPING;
464
    retained_data->mpm_state = AP_MPMQ_STOPPING;
453
    if (retained_data->shutdown_pending
465
    if (retained_data->shutdown_pending
454
            && (retained_data->is_ungraceful
466
            && (retained_data->is_ungraceful
Lines 465-470 static void sig_term(int sig) Link Here
465
477
466
static void sig_restart(int sig)
478
static void sig_restart(int sig)
467
{
479
{
480
    if (!retained_data) {
481
        /* Main process (ap_pglobal) is dying */
482
        return;
483
    }
468
    retained_data->mpm_state = AP_MPMQ_STOPPING;
484
    retained_data->mpm_state = AP_MPMQ_STOPPING;
469
    if (retained_data->restart_pending
485
    if (retained_data->restart_pending
470
            && (retained_data->is_ungraceful
486
            && (retained_data->is_ungraceful
Lines 481-486 static void sig_restart(int sig) Link Here
481
497
482
static apr_status_t unset_signals(void *unused)
498
static apr_status_t unset_signals(void *unused)
483
{
499
{
500
    if (!retained_data) {
501
        /* Main process (ap_pglobal) is dying */
502
        return APR_SUCCESS;
503
    }
484
    retained_data->shutdown_pending = retained_data->restart_pending = 0;
504
    retained_data->shutdown_pending = retained_data->restart_pending = 0;
485
    retained_data->was_graceful = !retained_data->is_ungraceful;
505
    retained_data->was_graceful = !retained_data->is_ungraceful;
486
    retained_data->is_ungraceful = 0;
506
    retained_data->is_ungraceful = 0;
Lines 494-499 AP_DECLARE(void) ap_unixd_mpm_set_signals(apr_pool Link Here
494
    struct sigaction sa;
514
    struct sigaction sa;
495
#endif
515
#endif
496
516
517
    if (!one_process) {
518
        ap_fatal_signal_setup(ap_server_conf, pconf);
519
    }
520
497
    /* Signals' handlers depend on retained data */
521
    /* Signals' handlers depend on retained data */
498
    (void)ap_unixd_mpm_get_retained_data();
522
    (void)ap_unixd_mpm_get_retained_data();
499
523
(-)server/main.c (-5 / +28 lines)
Lines 273-278 static int abort_on_oom(int retcode) Link Here
273
    return retcode; /* unreachable, hopefully. */
273
    return retcode; /* unreachable, hopefully. */
274
}
274
}
275
275
276
/* Deregister all hooks when clearing pconf (pre_cleanup).
277
 * TODO: have a hook to deregister and run them from here?
278
 *       ap_clear_auth_internal() is already a candidate.
279
 */
280
static apr_status_t deregister_all_hooks(void *unused)
281
{
282
    (void)unused;
283
    ap_clear_auth_internal();
284
    apr_hook_deregister_all();
285
    return APR_SUCCESS;
286
}
287
288
static void reset_process_pconf(process_rec *process)
289
{
290
    if (process->pconf) {
291
        apr_pool_clear(process->pconf);
292
    }
293
    else {
294
        apr_pool_create(&process->pconf, process->pool);
295
        apr_pool_tag(process->pconf, "pconf");
296
    }
297
    apr_pool_pre_cleanup_register(process->pconf, NULL, deregister_all_hooks);
298
}
299
276
static process_rec *init_process(int *argc, const char * const * *argv)
300
static process_rec *init_process(int *argc, const char * const * *argv)
277
{
301
{
278
    process_rec *process;
302
    process_rec *process;
Lines 317-324 static process_rec *init_process(int *argc, const Link Here
317
    process = apr_palloc(cntx, sizeof(process_rec));
341
    process = apr_palloc(cntx, sizeof(process_rec));
318
    process->pool = cntx;
342
    process->pool = cntx;
319
343
320
    apr_pool_create(&process->pconf, process->pool);
344
    process->pconf = NULL;
321
    apr_pool_tag(process->pconf, "pconf");
345
    reset_process_pconf(process);
346
322
    process->argc = *argc;
347
    process->argc = *argc;
323
    process->argv = *argv;
348
    process->argv = *argv;
324
    process->short_name = apr_filepath_name_get((*argv)[0]);
349
    process->short_name = apr_filepath_name_get((*argv)[0]);
Lines 721-729 int main(int argc, const char * const argv[]) Link Here
721
746
722
    do {
747
    do {
723
        ap_main_state = AP_SQ_MS_DESTROY_CONFIG;
748
        ap_main_state = AP_SQ_MS_DESTROY_CONFIG;
724
        apr_hook_deregister_all();
749
        reset_process_pconf(process);
725
        apr_pool_clear(pconf);
726
        ap_clear_auth_internal();
727
750
728
        ap_main_state = AP_SQ_MS_CREATE_CONFIG;
751
        ap_main_state = AP_SQ_MS_CREATE_CONFIG;
729
        ap_config_generation++;
752
        ap_config_generation++;
(-)server/mpm/event/event.c (-3 lines)
Lines 2880-2888 static int event_run(apr_pool_t * _pconf, apr_pool Link Here
2880
        ap_scoreboard_image->global->running_generation = retained->mpm->my_generation;
2880
        ap_scoreboard_image->global->running_generation = retained->mpm->my_generation;
2881
    }
2881
    }
2882
2882
2883
    if (!one_process) {
2884
        ap_fatal_signal_setup(ap_server_conf, pconf);
2885
    }
2886
    ap_unixd_mpm_set_signals(pconf, one_process);
2883
    ap_unixd_mpm_set_signals(pconf, one_process);
2887
2884
2888
    /* Don't thrash since num_buckets depends on the
2885
    /* Don't thrash since num_buckets depends on the
(-)server/mpm/prefork/prefork.c (-3 lines)
Lines 863-871 static int prefork_run(apr_pool_t *_pconf, apr_poo Link Here
863
        ap_scoreboard_image->global->running_generation = retained->mpm->my_generation;
863
        ap_scoreboard_image->global->running_generation = retained->mpm->my_generation;
864
    }
864
    }
865
865
866
    if (!one_process) {
867
        ap_fatal_signal_setup(ap_server_conf, pconf);
868
    }
869
    ap_unixd_mpm_set_signals(pconf, one_process);
866
    ap_unixd_mpm_set_signals(pconf, one_process);
870
867
871
    if (one_process) {
868
    if (one_process) {
(-)server/mpm/worker/worker.c (-3 lines)
Lines 1671-1679 static int worker_run(apr_pool_t *_pconf, apr_pool Link Here
1671
        ap_scoreboard_image->global->running_generation = retained->mpm->my_generation;
1671
        ap_scoreboard_image->global->running_generation = retained->mpm->my_generation;
1672
    }
1672
    }
1673
1673
1674
    if (!one_process) {
1675
        ap_fatal_signal_setup(ap_server_conf, pconf);
1676
    }
1677
    ap_unixd_mpm_set_signals(pconf, one_process);
1674
    ap_unixd_mpm_set_signals(pconf, one_process);
1678
1675
1679
    /* Don't thrash since num_buckets depends on the
1676
    /* Don't thrash since num_buckets depends on the
(-)server/mpm_unix.c (+29 lines)
Lines 1009-1014 AP_DECLARE(apr_status_t) ap_fatal_signal_child_set Link Here
1009
    return APR_SUCCESS;
1009
    return APR_SUCCESS;
1010
}
1010
}
1011
1011
1012
/* We can't call sig_coredump (ap_log_error) once pconf is destroyed, so
1013
 * avoid double faults by restoring each default signal handler on cleanup.
1014
 */
1015
static apr_status_t fatal_signal_cleanup(void *unused)
1016
{
1017
    (void)unused;
1018
1019
    apr_signal(SIGSEGV, SIG_DFL);
1020
#ifdef SIGBUS
1021
    apr_signal(SIGBUS, SIG_DFL);
1022
#endif /* SIGBUS */
1023
#ifdef SIGABORT
1024
    apr_signal(SIGABORT, SIG_DFL);
1025
#endif /* SIGABORT */
1026
#ifdef SIGABRT
1027
    apr_signal(SIGABRT, SIG_DFL);
1028
#endif /* SIGABRT */
1029
#ifdef SIGILL
1030
    apr_signal(SIGILL, SIG_DFL);
1031
#endif /* SIGILL */
1032
#ifdef SIGFPE
1033
    apr_signal(SIGFPE, SIG_DFL);
1034
#endif /* SIGFPE */
1035
1036
    return APR_SUCCESS;
1037
}
1038
1012
AP_DECLARE(apr_status_t) ap_fatal_signal_setup(server_rec *s,
1039
AP_DECLARE(apr_status_t) ap_fatal_signal_setup(server_rec *s,
1013
                                               apr_pool_t *in_pconf)
1040
                                               apr_pool_t *in_pconf)
1014
{
1041
{
Lines 1071-1076 AP_DECLARE(apr_status_t) ap_fatal_signal_setup(ser Link Here
1071
1098
1072
    pconf = in_pconf;
1099
    pconf = in_pconf;
1073
    parent_pid = my_pid = getpid();
1100
    parent_pid = my_pid = getpid();
1101
    apr_pool_cleanup_register(pconf, NULL, fatal_signal_cleanup,
1102
                              fatal_signal_cleanup);
1074
1103
1075
    return APR_SUCCESS;
1104
    return APR_SUCCESS;
1076
}
1105
}
(-)server/util_expr_scan.c (-22 / +8 lines)
Lines 54-59 typedef int flex_int32_t; Link Here
54
typedef unsigned char flex_uint8_t; 
54
typedef unsigned char flex_uint8_t; 
55
typedef unsigned short int flex_uint16_t;
55
typedef unsigned short int flex_uint16_t;
56
typedef unsigned int flex_uint32_t;
56
typedef unsigned int flex_uint32_t;
57
#endif /* ! C99 */
57
58
58
/* Limits of integral types. */
59
/* Limits of integral types. */
59
#ifndef INT8_MIN
60
#ifndef INT8_MIN
Lines 84-91 typedef unsigned int flex_uint32_t; Link Here
84
#define UINT32_MAX             (4294967295U)
85
#define UINT32_MAX             (4294967295U)
85
#endif
86
#endif
86
87
87
#endif /* ! C99 */
88
89
#endif /* ! FLEXINT_H */
88
#endif /* ! FLEXINT_H */
90
89
91
#ifdef __cplusplus
90
#ifdef __cplusplus
Lines 159-173 typedef void* yyscan_t; Link Here
159
158
160
/* Size of default input buffer. */
159
/* Size of default input buffer. */
161
#ifndef YY_BUF_SIZE
160
#ifndef YY_BUF_SIZE
162
#ifdef __ia64__
163
/* On IA-64, the buffer size is 16k, not 8k.
164
 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
165
 * Ditto for the __ia64__ case accordingly.
166
 */
167
#define YY_BUF_SIZE 32768
168
#else
169
#define YY_BUF_SIZE 16384
161
#define YY_BUF_SIZE 16384
170
#endif /* __ia64__ */
171
#endif
162
#endif
172
163
173
/* The state buf must be large enough to hold one state per character in the main buffer.
164
/* The state buf must be large enough to hold one state per character in the main buffer.
Lines 611-617 static yyconst flex_int16_t yy_chk[319] = Link Here
611
            PERROR("String too long");              \
602
            PERROR("String too long");              \
612
    } while (0)
603
    } while (0)
613
604
614
#line 615 "util_expr_scan.c"
605
#line 606 "util_expr_scan.c"
615
606
616
#define INITIAL 0
607
#define INITIAL 0
617
#define str 1
608
#define str 1
Lines 747-758 static int input (yyscan_t yyscanner ); Link Here
747
    
738
    
748
/* Amount of stuff to slurp up with each read. */
739
/* Amount of stuff to slurp up with each read. */
749
#ifndef YY_READ_BUF_SIZE
740
#ifndef YY_READ_BUF_SIZE
750
#ifdef __ia64__
751
/* On IA-64, the buffer size is 16k, not 8k */
752
#define YY_READ_BUF_SIZE 16384
753
#else
754
#define YY_READ_BUF_SIZE 8192
741
#define YY_READ_BUF_SIZE 8192
755
#endif /* __ia64__ */
756
#endif
742
#endif
757
743
758
/* Copy whatever the last rule matched to the standard output. */
744
/* Copy whatever the last rule matched to the standard output. */
Lines 760-766 static int input (yyscan_t yyscanner ); Link Here
760
/* This used to be an fputs(), but since the string might contain NUL's,
746
/* This used to be an fputs(), but since the string might contain NUL's,
761
 * we now use fwrite().
747
 * we now use fwrite().
762
 */
748
 */
763
#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
749
#define ECHO fwrite( yytext, yyleng, 1, yyout )
764
#endif
750
#endif
765
751
766
/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
752
/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
Lines 771-777 static int input (yyscan_t yyscanner ); Link Here
771
	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
757
	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
772
		{ \
758
		{ \
773
		int c = '*'; \
759
		int c = '*'; \
774
		size_t n; \
760
		int n; \
775
		for ( n = 0; n < max_size && \
761
		for ( n = 0; n < max_size && \
776
			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
762
			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
777
			buf[n] = (char) c; \
763
			buf[n] = (char) c; \
Lines 882-888 YY_DECL Link Here
882
 /*
868
 /*
883
  * Whitespaces
869
  * Whitespaces
884
  */
870
  */
885
#line 886 "util_expr_scan.c"
871
#line 872 "util_expr_scan.c"
886
872
887
    yylval = yylval_param;
873
    yylval = yylval_param;
888
874
Lines 1519-1525 YY_RULE_SETUP Link Here
1519
#line 398 "util_expr_scan.l"
1505
#line 398 "util_expr_scan.l"
1520
YY_FATAL_ERROR( "flex scanner jammed" );
1506
YY_FATAL_ERROR( "flex scanner jammed" );
1521
	YY_BREAK
1507
	YY_BREAK
1522
#line 1523 "util_expr_scan.c"
1508
#line 1509 "util_expr_scan.c"
1523
case YY_STATE_EOF(INITIAL):
1509
case YY_STATE_EOF(INITIAL):
1524
case YY_STATE_EOF(regex):
1510
case YY_STATE_EOF(regex):
1525
	yyterminate();
1511
	yyterminate();
Lines 2251-2258 YY_BUFFER_STATE ap_expr_yy_scan_string (yyconst ch Link Here
2251
2237
2252
/** Setup the input buffer state to scan the given bytes. The next call to ap_expr_yylex() will
2238
/** Setup the input buffer state to scan the given bytes. The next call to ap_expr_yylex() will
2253
 * scan from a @e copy of @a bytes.
2239
 * scan from a @e copy of @a bytes.
2254
 * @param yybytes the byte buffer to scan
2240
 * @param bytes the byte buffer to scan
2255
 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2241
 * @param len the number of bytes in the buffer pointed to by @a bytes.
2256
 * @param yyscanner The scanner object.
2242
 * @param yyscanner The scanner object.
2257
 * @return the newly allocated buffer state object.
2243
 * @return the newly allocated buffer state object.
2258
 */
2244
 */

Return to bug 61558