diff options
author | Antony Dovgal <tony2001@php.net> | 2010-01-11 13:03:19 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2010-01-11 13:03:19 +0000 |
commit | 71b6810ecfb550cd2d9188621a613e758f40a1ea (patch) | |
tree | 0d83c37366c135f4175c9ccf22d321827fcaeb00 | |
parent | 918731b6086bfd5e50d5588db079c5efcf9d6d9e (diff) | |
download | php-git-71b6810ecfb550cd2d9188621a613e758f40a1ea.tar.gz |
rewrite code to make use of private event base instead of the global one
-rw-r--r-- | sapi/fpm/fpm/fpm.c | 10 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm.h | 6 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_children.c | 22 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_children.h | 6 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_conf.c | 4 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_events.c | 42 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_events.h | 8 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_main.c | 7 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_process_ctl.c | 35 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_process_ctl.h | 2 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_request.c | 1 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_stdio.c | 6 | ||||
-rw-r--r-- | sapi/fpm/fpm/fpm_stdio.h | 2 |
13 files changed, 81 insertions, 70 deletions
diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c index 2a34ca66f6..34292b5d48 100644 --- a/sapi/fpm/fpm/fpm.c +++ b/sapi/fpm/fpm/fpm.c @@ -23,7 +23,7 @@ struct fpm_globals_s fpm_globals; -int fpm_init(int argc, char **argv, char *config) /* {{{ */ +int fpm_init(int argc, char **argv, char *config, struct event_base **base) /* {{{ */ { fpm_globals.argc = argc; fpm_globals.argv = argv; @@ -39,7 +39,7 @@ int fpm_init(int argc, char **argv, char *config) /* {{{ */ 0 > fpm_children_init_main() || 0 > fpm_sockets_init_main() || 0 > fpm_worker_pool_init_main() || - 0 > fpm_event_init_main()) { + 0 > fpm_event_init_main(base)) { return -1; } @@ -55,7 +55,7 @@ int fpm_init(int argc, char **argv, char *config) /* {{{ */ /* children: return listening socket parent: never return */ -int fpm_run(int *max_requests) /* {{{ */ +int fpm_run(int *max_requests, struct event_base *base) /* {{{ */ { struct fpm_worker_pool_s *wp; @@ -63,7 +63,7 @@ int fpm_run(int *max_requests) /* {{{ */ for (wp = fpm_worker_all_pools; wp; wp = wp->next) { int is_parent; - is_parent = fpm_children_create_initial(wp); + is_parent = fpm_children_create_initial(wp, base); if (!is_parent) { goto run_child; @@ -71,7 +71,7 @@ int fpm_run(int *max_requests) /* {{{ */ } /* run event loop forever */ - fpm_event_loop(); + fpm_event_loop(base); run_child: /* only workers reach this point */ diff --git a/sapi/fpm/fpm/fpm.h b/sapi/fpm/fpm/fpm.h index a78e75f707..ba43904481 100644 --- a/sapi/fpm/fpm/fpm.h +++ b/sapi/fpm/fpm/fpm.h @@ -6,9 +6,11 @@ #define FPM_H 1 #include <unistd.h> +#include <sys/types.h> /* for event.h below */ +#include <event.h> -int fpm_run(int *max_requests); -int fpm_init(int argc, char **argv, char *config); +int fpm_run(int *max_requests, struct event_base *base); +int fpm_init(int argc, char **argv, char *config, struct event_base **base); struct fpm_globals_s { pid_t parent_pid; diff --git a/sapi/fpm/fpm/fpm_children.c b/sapi/fpm/fpm/fpm_children.c index 32cf1cc5a7..294f82a6bd 100644 --- a/sapi/fpm/fpm/fpm_children.c +++ b/sapi/fpm/fpm/fpm_children.c @@ -171,7 +171,7 @@ int fpm_children_free(struct fpm_child_s *child) /* {{{ */ } /* }}} */ -void fpm_children_bury() /* {{{ */ +void fpm_children_bury(struct event_base *base) /* {{{ */ { int status; pid_t pid; @@ -277,12 +277,12 @@ void fpm_children_bury() /* {{{ */ zlog(ZLOG_STUFF, ZLOG_WARNING, "failed processes threshold (%d in %d sec) is reached, initiating reload", fpm_global_config.emergency_restart_threshold, fpm_global_config.emergency_restart_interval); - fpm_pctl(FPM_PCTL_STATE_RELOADING, FPM_PCTL_ACTION_SET); + fpm_pctl(FPM_PCTL_STATE_RELOADING, FPM_PCTL_ACTION_SET, base); } } if (restart_child) { - fpm_children_make(wp, 1 /* in event loop */, 1, 0); + fpm_children_make(wp, 1 /* in event loop */, 1, 0, base); if (fpm_globals.is_child) { break; @@ -340,15 +340,15 @@ static void fpm_child_resources_use(struct fpm_child_s *child) /* {{{ */ } /* }}} */ -static void fpm_parent_resources_use(struct fpm_child_s *child) /* {{{ */ +static void fpm_parent_resources_use(struct fpm_child_s *child, struct event_base *base) /* {{{ */ { fpm_shm_slots_parent_use_slot(child); - fpm_stdio_parent_use_pipes(child); + fpm_stdio_parent_use_pipes(child, base); fpm_child_link(child); } /* }}} */ -int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop, int nb_to_spawn, int is_debug) /* {{{ */ +int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop, int nb_to_spawn, int is_debug, struct event_base *base) /* {{{ */ { int enough = 0; pid_t pid; @@ -378,12 +378,12 @@ int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop, int nb_to switch (pid) { case 0 : + event_reinit(base); /* reinitialize event base after fork() */ fpm_child_resources_use(child); fpm_globals.is_child = 1; if (in_event_loop) { - fpm_event_exit_loop(); + fpm_event_exit_loop(base); } - event_init(); /* reopen epoll descriptor */ fpm_child_init(wp); return 0; @@ -398,7 +398,7 @@ int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop, int nb_to default : child->pid = pid; fpm_clock_get(&child->started); - fpm_parent_resources_use(child); + fpm_parent_resources_use(child, base); zlog(ZLOG_STUFF, is_debug ? ZLOG_DEBUG : ZLOG_NOTICE, "[pool %s] child %d started", wp->config->name, (int) pid); } @@ -409,9 +409,9 @@ int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop, int nb_to } /* }}} */ -int fpm_children_create_initial(struct fpm_worker_pool_s *wp) /* {{{ */ +int fpm_children_create_initial(struct fpm_worker_pool_s *wp, struct event_base *base) /* {{{ */ { - return fpm_children_make(wp, 0 /* not in event loop yet */, 0, 1); + return fpm_children_make(wp, 0 /* not in event loop yet */, 0, 1, base); } /* }}} */ diff --git a/sapi/fpm/fpm/fpm_children.h b/sapi/fpm/fpm/fpm_children.h index 3be32fbe33..d881842690 100644 --- a/sapi/fpm/fpm/fpm_children.h +++ b/sapi/fpm/fpm/fpm_children.h @@ -11,11 +11,11 @@ #include "fpm_worker_pool.h" -int fpm_children_create_initial(struct fpm_worker_pool_s *wp); +int fpm_children_create_initial(struct fpm_worker_pool_s *wp, struct event_base *base); int fpm_children_free(struct fpm_child_s *child); -void fpm_children_bury(); +void fpm_children_bury(struct event_base *base); int fpm_children_init_main(); -int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop, int nb_to_spawn, int is_debug); +int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop, int nb_to_spawn, int is_debug, struct event_base *base); struct fpm_child_s; diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c index 6840fce20a..6cc4185c06 100644 --- a/sapi/fpm/fpm/fpm_conf.c +++ b/sapi/fpm/fpm/fpm_conf.c @@ -515,7 +515,7 @@ static int fpm_conf_process_all_pools() /* {{{ */ if (wp->config->pm->status && *wp->config->pm->status) { int i; char *status = wp->config->pm->status; - struct fpm_status_s fpm_status; + /* struct fpm_status_s fpm_status; */ if (*status != '/') { zlog(ZLOG_STUFF, ZLOG_ERROR, "[pool %s] the status page '%s' must start with a '/'", wp->config->name, status); @@ -541,7 +541,7 @@ static int fpm_conf_process_all_pools() /* {{{ */ fpm_status_update_accepted_conn(wp->shm_status, 0); fpm_status_update_activity(wp->shm_status, -1, -1, -1, 1); fpm_status_set_pm(wp->shm_status, wp->config->pm->style); - //memset(&fpm_status.last_update, 0, sizeof(fpm_status.last_update)); + /* memset(&fpm_status.last_update, 0, sizeof(fpm_status.last_update)); */ } } return 0; diff --git a/sapi/fpm/fpm/fpm_events.c b/sapi/fpm/fpm/fpm_events.c index 4844a17042..20ae31bff8 100644 --- a/sapi/fpm/fpm/fpm_events.c +++ b/sapi/fpm/fpm/fpm_events.c @@ -8,8 +8,6 @@ #include <errno.h> #include <stdlib.h> /* for putenv */ #include <string.h> -#include <sys/types.h> /* for event.h below */ -#include <event.h> #include "fpm.h" #include "fpm_process_ctl.h" @@ -22,7 +20,8 @@ static void fpm_event_cleanup(int which, void *arg) /* {{{ */ { - event_base_free(0); + struct event_base *base = (struct event_base *)arg; + event_base_free(base); } /* }}} */ @@ -30,6 +29,7 @@ static void fpm_got_signal(int fd, short ev, void *arg) /* {{{ */ { char c; int res; + struct event_base *base = (struct event_base *)arg; do { do { @@ -46,22 +46,22 @@ static void fpm_got_signal(int fd, short ev, void *arg) /* {{{ */ switch (c) { case 'C' : /* SIGCHLD */ zlog(ZLOG_STUFF, ZLOG_DEBUG, "received SIGCHLD"); - fpm_children_bury(); + fpm_children_bury(base); break; case 'I' : /* SIGINT */ zlog(ZLOG_STUFF, ZLOG_DEBUG, "received SIGINT"); zlog(ZLOG_STUFF, ZLOG_NOTICE, "Terminating ..."); - fpm_pctl(FPM_PCTL_STATE_TERMINATING, FPM_PCTL_ACTION_SET); + fpm_pctl(FPM_PCTL_STATE_TERMINATING, FPM_PCTL_ACTION_SET, base); break; case 'T' : /* SIGTERM */ zlog(ZLOG_STUFF, ZLOG_DEBUG, "received SIGTERM"); zlog(ZLOG_STUFF, ZLOG_NOTICE, "Terminating ..."); - fpm_pctl(FPM_PCTL_STATE_TERMINATING, FPM_PCTL_ACTION_SET); + fpm_pctl(FPM_PCTL_STATE_TERMINATING, FPM_PCTL_ACTION_SET, base); break; case 'Q' : /* SIGQUIT */ zlog(ZLOG_STUFF, ZLOG_DEBUG, "received SIGQUIT"); zlog(ZLOG_STUFF, ZLOG_NOTICE, "Finishing ..."); - fpm_pctl(FPM_PCTL_STATE_FINISHING, FPM_PCTL_ACTION_SET); + fpm_pctl(FPM_PCTL_STATE_FINISHING, FPM_PCTL_ACTION_SET, base); break; case '1' : /* SIGUSR1 */ zlog(ZLOG_STUFF, ZLOG_DEBUG, "received SIGUSR1"); @@ -74,7 +74,7 @@ static void fpm_got_signal(int fd, short ev, void *arg) /* {{{ */ case '2' : /* SIGUSR2 */ zlog(ZLOG_STUFF, ZLOG_DEBUG, "received SIGUSR2"); zlog(ZLOG_STUFF, ZLOG_NOTICE, "Reloading in progress ..."); - fpm_pctl(FPM_PCTL_STATE_RELOADING, FPM_PCTL_ACTION_SET); + fpm_pctl(FPM_PCTL_STATE_RELOADING, FPM_PCTL_ACTION_SET, base); break; } @@ -86,36 +86,38 @@ static void fpm_got_signal(int fd, short ev, void *arg) /* {{{ */ } /* }}} */ -int fpm_event_init_main() /* {{{ */ +int fpm_event_init_main(struct event_base **base) /* {{{ */ { - event_init(); + *base = event_base_new(); - zlog(ZLOG_STUFF, ZLOG_NOTICE, "libevent: using %s", event_get_method()); + zlog(ZLOG_STUFF, ZLOG_NOTICE, "libevent: using %s", event_base_get_method(*base)); - if (0 > fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_event_cleanup, 0)) { + if (0 > fpm_cleanup_add(FPM_CLEANUP_ALL, fpm_event_cleanup, *base)) { return -1; } return 0; } /* }}} */ -int fpm_event_loop() /* {{{ */ +int fpm_event_loop(struct event_base *base) /* {{{ */ { static struct event signal_fd_event; - event_set(&signal_fd_event, fpm_signals_get_fd(), EV_PERSIST | EV_READ, &fpm_got_signal, 0); + event_set(&signal_fd_event, fpm_signals_get_fd(), EV_PERSIST | EV_READ, &fpm_got_signal, base); + event_base_set(base, &signal_fd_event); event_add(&signal_fd_event, 0); - fpm_pctl_heartbeat(-1, 0, 0); - fpm_pctl_perform_idle_server_maintenance_heartbeat(-1, 0, 0); + fpm_pctl_heartbeat(-1, 0, base); + fpm_pctl_perform_idle_server_maintenance_heartbeat(-1, 0, base); zlog(ZLOG_STUFF, ZLOG_NOTICE, "ready to handle connections"); - event_loop(0); + event_base_dispatch(base); return 0; } /* }}} */ -int fpm_event_add(int fd, struct event *ev, void (*callback)(int, short, void *), void *arg) /* {{{ */ +int fpm_event_add(int fd, struct event_base *base, struct event *ev, void (*callback)(int, short, void *), void *arg) /* {{{ */ { event_set(ev, fd, EV_PERSIST | EV_READ, callback, arg); + event_base_set(base, ev); return event_add(ev, 0); } /* }}} */ @@ -126,9 +128,9 @@ int fpm_event_del(struct event *ev) /* {{{ */ } /* }}} */ -void fpm_event_exit_loop() /* {{{ */ +void fpm_event_exit_loop(struct event_base *base) /* {{{ */ { - event_loopbreak(); + event_base_loopbreak(base); } /* }}} */ diff --git a/sapi/fpm/fpm/fpm_events.h b/sapi/fpm/fpm/fpm_events.h index d5a45ce860..7a5a9a53b0 100644 --- a/sapi/fpm/fpm/fpm_events.h +++ b/sapi/fpm/fpm/fpm_events.h @@ -5,12 +5,12 @@ #ifndef FPM_EVENTS_H #define FPM_EVENTS_H 1 -void fpm_event_exit_loop(); -int fpm_event_loop(); -int fpm_event_add(int fd, struct event *ev, void (*callback)(int, short, void *), void *arg); +void fpm_event_exit_loop(struct event_base *base); +int fpm_event_loop(struct event_base *base); +int fpm_event_add(int fd, struct event_base *base, struct event *ev, void (*callback)(int, short, void *), void *arg); int fpm_event_del(struct event *ev); void fpm_event_fire(struct event *ev); -int fpm_event_init_main(); +int fpm_event_init_main(struct event_base **base); #endif diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c index e2cc0d873f..a750521fb0 100644 --- a/sapi/fpm/fpm/fpm_main.c +++ b/sapi/fpm/fpm/fpm_main.c @@ -173,6 +173,7 @@ typedef struct _php_cgi_globals_struct { #endif HashTable user_config_cache; char *error_header; + struct event_base *event_base; } php_cgi_globals_struct; /* {{{ user_config_cache @@ -1744,11 +1745,11 @@ consult the installation file that came with this distribution, or visit \n\ } } - if (0 > fpm_init(argc, argv, fpm_config)) { + if (0 > fpm_init(argc, argv, fpm_config, &CGIG(event_base))) { return FAILURE; } - fcgi_fd = fpm_run(&max_requests); + fcgi_fd = fpm_run(&max_requests, CGIG(event_base)); parent = 0; fcgi_set_is_fastcgi(1); @@ -1780,8 +1781,6 @@ consult the installation file that came with this distribution, or visit \n\ if (!strcasecmp(SG(request_info).request_method, "GET") && fpm_status_handle_status(SG(request_info).request_uri, SG(request_info).query_string, &status_buffer, &status_content_type)) { if (status_buffer) { - int i; - if (status_content_type) { sapi_add_header_ex(status_content_type, strlen(status_content_type), 1, 1 TSRMLS_CC); } else { diff --git a/sapi/fpm/fpm/fpm_process_ctl.c b/sapi/fpm/fpm/fpm_process_ctl.c index b2fcb704e4..d63fb4a5cd 100644 --- a/sapi/fpm/fpm/fpm_process_ctl.c +++ b/sapi/fpm/fpm/fpm_process_ctl.c @@ -52,13 +52,15 @@ static struct event pctl_event; static void fpm_pctl_action(int fd, short which, void *arg) /* {{{ */ { + struct event_base *base = (struct event_base *)arg; + evtimer_del(&pctl_event); memset(&pctl_event, 0, sizeof(pctl_event)); - fpm_pctl(FPM_PCTL_STATE_UNSPECIFIED, FPM_PCTL_ACTION_TIMEOUT); + fpm_pctl(FPM_PCTL_STATE_UNSPECIFIED, FPM_PCTL_ACTION_TIMEOUT, base); } /* }}} */ -static int fpm_pctl_timeout_set(int sec) /* {{{ */ +static int fpm_pctl_timeout_set(int sec, struct event_base *base) /* {{{ */ { struct timeval tv = { .tv_sec = sec, .tv_usec = 0 }; @@ -66,7 +68,8 @@ static int fpm_pctl_timeout_set(int sec) /* {{{ */ evtimer_del(&pctl_event); } - evtimer_set(&pctl_event, &fpm_pctl_action, 0); + evtimer_set(&pctl_event, &fpm_pctl_action, base); + event_base_set(base, &pctl_event); evtimer_add(&pctl_event, &tv); return 0; } @@ -174,7 +177,7 @@ static void fpm_pctl_kill_all(int signo) /* {{{ */ } /* }}} */ -static void fpm_pctl_action_next() /* {{{ */ +static void fpm_pctl_action_next(struct event_base *base) /* {{{ */ { int sig, timeout; @@ -200,11 +203,11 @@ static void fpm_pctl_action_next() /* {{{ */ fpm_pctl_kill_all(sig); fpm_signal_sent = sig; - fpm_pctl_timeout_set(timeout); + fpm_pctl_timeout_set(timeout, base); } /* }}} */ -void fpm_pctl(int new_state, int action) /* {{{ */ +void fpm_pctl(int new_state, int action, struct event_base *base) /* {{{ */ { switch (action) { case FPM_PCTL_ACTION_SET : @@ -236,7 +239,7 @@ void fpm_pctl(int new_state, int action) /* {{{ */ /* fall down */ case FPM_PCTL_ACTION_TIMEOUT : - fpm_pctl_action_next(); + fpm_pctl_action_next(base); break; case FPM_PCTL_ACTION_LAST_CHILD_EXITED : fpm_pctl_action_last(); @@ -252,14 +255,14 @@ int fpm_pctl_can_spawn_children() /* {{{ */ } /* }}} */ -int fpm_pctl_child_exited() /* {{{ */ +int fpm_pctl_child_exited(struct event_base *base) /* {{{ */ { if (fpm_state == FPM_PCTL_STATE_NORMAL) { return 0; } if (!fpm_globals.running_children) { - fpm_pctl(FPM_PCTL_STATE_UNSPECIFIED, FPM_PCTL_ACTION_LAST_CHILD_EXITED); + fpm_pctl(FPM_PCTL_STATE_UNSPECIFIED, FPM_PCTL_ACTION_LAST_CHILD_EXITED, base); } return 0; } @@ -311,7 +314,7 @@ static void fpm_pctl_check_request_timeout(struct timeval *now) /* {{{ */ } /* }}} */ -static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{ */ +static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now, struct event_base *base) /* {{{ */ { struct fpm_worker_pool_s *wp; struct fpm_child_s *last_idle_child = NULL; @@ -389,7 +392,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{ } wp->warn_max_children = 0; - fpm_children_make(wp, 1, i, 1); + fpm_children_make(wp, 1, i, 1, base); /* if it's a child, stop here without creating the next event * this event is reserved to the master process @@ -416,6 +419,7 @@ void fpm_pctl_heartbeat(int fd, short which, void *arg) /* {{{ */ static struct event heartbeat; struct timeval tv = { .tv_sec = 0, .tv_usec = 130000 }; struct timeval now; + struct event_base *base = (struct event_base *)arg; if (which == EV_TIMEOUT) { evtimer_del(&heartbeat); @@ -423,7 +427,8 @@ void fpm_pctl_heartbeat(int fd, short which, void *arg) /* {{{ */ fpm_pctl_check_request_timeout(&now); } - evtimer_set(&heartbeat, &fpm_pctl_heartbeat, 0); + evtimer_set(&heartbeat, &fpm_pctl_heartbeat, base); + event_base_set(base, &heartbeat); evtimer_add(&heartbeat, &tv); } /* }}} */ @@ -433,12 +438,13 @@ void fpm_pctl_perform_idle_server_maintenance_heartbeat(int fd, short which, voi static struct event heartbeat; struct timeval tv = { .tv_sec = 0, .tv_usec = FPM_IDLE_SERVER_MAINTENANCE_HEARTBEAT }; struct timeval now; + struct event_base *base = (struct event_base *)arg; if (which == EV_TIMEOUT) { evtimer_del(&heartbeat); fpm_clock_get(&now); if (fpm_pctl_can_spawn_children()) { - fpm_pctl_perform_idle_server_maintenance(&now); + fpm_pctl_perform_idle_server_maintenance(&now, base); /* if it's a child, stop here without creating the next event * this event is reserved to the master process @@ -449,7 +455,8 @@ void fpm_pctl_perform_idle_server_maintenance_heartbeat(int fd, short which, voi } } - evtimer_set(&heartbeat, &fpm_pctl_perform_idle_server_maintenance_heartbeat, 0); + evtimer_set(&heartbeat, &fpm_pctl_perform_idle_server_maintenance_heartbeat, base); + event_base_set(base, &heartbeat); evtimer_add(&heartbeat, &tv); } /* }}} */ diff --git a/sapi/fpm/fpm/fpm_process_ctl.h b/sapi/fpm/fpm/fpm_process_ctl.h index 23245cc993..8834d5f3b8 100644 --- a/sapi/fpm/fpm/fpm_process_ctl.h +++ b/sapi/fpm/fpm/fpm_process_ctl.h @@ -12,7 +12,7 @@ struct fpm_child_s; -void fpm_pctl(int new_state, int action); +void fpm_pctl(int new_state, int action, struct event_base *base); int fpm_pctl_can_spawn_children(); int fpm_pctl_kill(pid_t pid, int how); void fpm_pctl_heartbeat(int fd, short which, void *arg); diff --git a/sapi/fpm/fpm/fpm_request.c b/sapi/fpm/fpm/fpm_request.c index 693bf8347b..8dda9d1463 100644 --- a/sapi/fpm/fpm/fpm_request.c +++ b/sapi/fpm/fpm/fpm_request.c @@ -4,6 +4,7 @@ #include "fpm_config.h" +#include "fpm.h" #include "fpm_php.h" #include "fpm_str.h" #include "fpm_clock.h" diff --git a/sapi/fpm/fpm/fpm_stdio.c b/sapi/fpm/fpm/fpm_stdio.c index 9726936b33..808f04a44b 100644 --- a/sapi/fpm/fpm/fpm_stdio.c +++ b/sapi/fpm/fpm/fpm_stdio.c @@ -195,7 +195,7 @@ int fpm_stdio_prepare_pipes(struct fpm_child_s *child) /* {{{ */ } /* }}} */ -int fpm_stdio_parent_use_pipes(struct fpm_child_s *child) /* {{{ */ +int fpm_stdio_parent_use_pipes(struct fpm_child_s *child, struct event_base *base) /* {{{ */ { if (0 == child->wp->config->catch_workers_output) { /* not required */ return 0; @@ -207,8 +207,8 @@ int fpm_stdio_parent_use_pipes(struct fpm_child_s *child) /* {{{ */ child->fd_stdout = fd_stdout[0]; child->fd_stderr = fd_stderr[0]; - fpm_event_add(child->fd_stdout, &child->ev_stdout, fpm_stdio_child_said, child); - fpm_event_add(child->fd_stderr, &child->ev_stderr, fpm_stdio_child_said, child); + fpm_event_add(child->fd_stdout, base, &child->ev_stdout, fpm_stdio_child_said, child); + fpm_event_add(child->fd_stderr, base, &child->ev_stderr, fpm_stdio_child_said, child); return 0; } /* }}} */ diff --git a/sapi/fpm/fpm/fpm_stdio.h b/sapi/fpm/fpm/fpm_stdio.h index d3d61e46be..5d53a26e88 100644 --- a/sapi/fpm/fpm/fpm_stdio.h +++ b/sapi/fpm/fpm/fpm_stdio.h @@ -12,7 +12,7 @@ int fpm_stdio_init_final(); int fpm_stdio_init_child(struct fpm_worker_pool_s *wp); int fpm_stdio_prepare_pipes(struct fpm_child_s *child); void fpm_stdio_child_use_pipes(struct fpm_child_s *child); -int fpm_stdio_parent_use_pipes(struct fpm_child_s *child); +int fpm_stdio_parent_use_pipes(struct fpm_child_s *child, struct event_base *base); int fpm_stdio_discard_pipes(struct fpm_child_s *child); int fpm_stdio_open_error_log(int reopen); |