tony2001                                 Mon, 11 Jan 2010 13:03:19 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=293403

Log:
rewrite code to make use of private event base instead of the global one

Changed paths:
    U   php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm.c
    U   php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm.h
    U   php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_children.c
    U   php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_children.h
    U   php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.c
    U   php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_events.c
    U   php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_events.h
    U   php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_main.c
    U   php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_process_ctl.c
    U   php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_process_ctl.h
    U   php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_request.c
    U   php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_stdio.c
    U   php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_stdio.h

Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm.c
===================================================================
--- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm.c	2010-01-11 12:37:42 UTC (rev 293402)
+++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm.c	2010-01-11 13:03:19 UTC (rev 293403)
@@ -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 @@
 		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 @@

 /*	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 @@
 	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 @@
 	}

 	/* run event loop forever */
-	fpm_event_loop();
+	fpm_event_loop(base);

 run_child: /* only workers reach this point */


Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm.h
===================================================================
--- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm.h	2010-01-11 12:37:42 UTC (rev 293402)
+++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm.h	2010-01-11 13:03:19 UTC (rev 293403)
@@ -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;

Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_children.c
===================================================================
--- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_children.c	2010-01-11 12:37:42 UTC (rev 293402)
+++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_children.c	2010-01-11 13:03:19 UTC (rev 293403)
@@ -171,7 +171,7 @@
 }
 /* }}} */

-void fpm_children_bury() /* {{{ */
+void fpm_children_bury(struct event_base *base) /* {{{ */
 {
 	int status;
 	pid_t pid;
@@ -277,12 +277,12 @@

 					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_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 @@
 		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 @@
 			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_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);
 }
 /* }}} */


Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_children.h
===================================================================
--- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_children.h	2010-01-11 12:37:42 UTC (rev 293402)
+++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_children.h	2010-01-11 13:03:19 UTC (rev 293403)
@@ -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;


Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.c
===================================================================
--- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.c	2010-01-11 12:37:42 UTC (rev 293402)
+++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_conf.c	2010-01-11 13:03:19 UTC (rev 293403)
@@ -515,7 +515,7 @@
 		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 @@
 			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;

Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_events.c
===================================================================
--- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_events.c	2010-01-11 12:37:42 UTC (rev 293402)
+++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_events.c	2010-01-11 13:03:19 UTC (rev 293403)
@@ -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 @@
 {
 	char c;
 	int res;
+	struct event_base *base = (struct event_base *)arg;

 	do {
 		do {
@@ -46,22 +46,22 @@
 		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 @@
 			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 @@
 }
 /* }}} */

-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 @@
 }
 /* }}} */

-void fpm_event_exit_loop() /* {{{ */
+void fpm_event_exit_loop(struct event_base *base) /* {{{ */
 {
-	event_loopbreak();
+	event_base_loopbreak(base);
 }
 /* }}} */


Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_events.h
===================================================================
--- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_events.h	2010-01-11 12:37:42 UTC (rev 293402)
+++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_events.h	2010-01-11 13:03:19 UTC (rev 293403)
@@ -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

Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_main.c
===================================================================
--- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_main.c	2010-01-11 12:37:42 UTC (rev 293402)
+++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_main.c	2010-01-11 13:03:19 UTC (rev 293403)
@@ -173,6 +173,7 @@
 #endif
 	HashTable user_config_cache;
 	char *error_header;
+	struct event_base *event_base;
 } php_cgi_globals_struct;

 /* {{{ user_config_cache
@@ -1744,11 +1745,11 @@
 		}
 	}

-	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 @@

 			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 {

Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_process_ctl.c
===================================================================
--- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_process_ctl.c	2010-01-11 12:37:42 UTC (rev 293402)
+++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_process_ctl.c	2010-01-11 13:03:19 UTC (rev 293403)
@@ -52,13 +52,15 @@

 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 @@
 		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_action_next() /* {{{ */
+static void fpm_pctl_action_next(struct event_base *base) /* {{{ */
 {
 	int sig, timeout;

@@ -200,11 +203,11 @@

 	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 @@
 			/* 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_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_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 @@
 			}
 			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 @@
 	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 @@
 		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 @@
 	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 @@
 		}
 	}

-	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);
 }
 /* }}} */

Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_process_ctl.h
===================================================================
--- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_process_ctl.h	2010-01-11 12:37:42 UTC (rev 293402)
+++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_process_ctl.h	2010-01-11 13:03:19 UTC (rev 293403)
@@ -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);

Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_request.c
===================================================================
--- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_request.c	2010-01-11 12:37:42 UTC (rev 293402)
+++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_request.c	2010-01-11 13:03:19 UTC (rev 293403)
@@ -4,6 +4,7 @@

 #include "fpm_config.h"

+#include "fpm.h"
 #include "fpm_php.h"
 #include "fpm_str.h"
 #include "fpm_clock.h"

Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_stdio.c
===================================================================
--- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_stdio.c	2010-01-11 12:37:42 UTC (rev 293402)
+++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_stdio.c	2010-01-11 13:03:19 UTC (rev 293403)
@@ -195,7 +195,7 @@
 }
 /* }}} */

-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 @@
 	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;
 }
 /* }}} */

Modified: php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_stdio.h
===================================================================
--- php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_stdio.h	2010-01-11 12:37:42 UTC (rev 293402)
+++ php/php-src/branches/PHP_5_3_FPM/sapi/fpm/fpm/fpm_stdio.h	2010-01-11 13:03:19 UTC (rev 293403)
@@ -12,7 +12,7 @@
 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);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to