fix buit-in web server on ppc64 (fdset usage) https://bugs.php.net/64128

This commit is contained in:
Remi Collet 2013-02-01 19:12:36 +01:00
parent c8d6917486
commit 61028a22b2
2 changed files with 59 additions and 1 deletions

51
php-5.4.11-select.patch Normal file
View File

@ -0,0 +1,51 @@
diff -up php-5.4.11/sapi/cli/php_cli_server.c.select php-5.4.11/sapi/cli/php_cli_server.c
--- php-5.4.11/sapi/cli/php_cli_server.c.select 2013-01-16 02:10:30.000000000 -0500
+++ php-5.4.11/sapi/cli/php_cli_server.c 2013-02-01 12:12:04.650950760 -0500
@@ -710,10 +710,9 @@ static void php_cli_server_poller_remove
if (fd == poller->max_fd) {
while (fd > 0) {
fd--;
- if (((unsigned int *)&poller->rfds)[fd / (8 * sizeof(unsigned int))] || ((unsigned int *)&poller->wfds)[fd / (8 * sizeof(unsigned int))]) {
+ if (PHP_SAFE_FD_ISSET(fd, &poller->rfds) || PHP_SAFE_FD_ISSET(fd, &poller->wfds)) {
break;
}
- fd -= fd % (8 * sizeof(unsigned int));
}
poller->max_fd = fd;
}
@@ -772,23 +771,20 @@ static int php_cli_server_poller_iter_on
}
#else
- php_socket_t fd = 0;
+ php_socket_t fd;
const php_socket_t max_fd = poller->max_fd;
- const unsigned int *pr = (unsigned int *)&poller->active.rfds,
- *pw = (unsigned int *)&poller->active.wfds,
- *e = pr + (max_fd + (8 * sizeof(unsigned int)) - 1) / (8 * sizeof(unsigned int));
- unsigned int mask;
- while (pr < e && fd <= max_fd) {
- for (mask = 1; mask; mask <<= 1, fd++) {
- int events = (*pr & mask ? POLLIN: 0) | (*pw & mask ? POLLOUT: 0);
- if (events) {
- if (SUCCESS != callback(opaque, fd, events)) {
- retval = FAILURE;
- }
- }
+
+ for (fd=0 ; fd<=max_fd ; fd++) {
+ if (PHP_SAFE_FD_ISSET(fd, &poller->active.rfds)) {
+ if (SUCCESS != callback(opaque, fd, POLLIN)) {
+ retval = FAILURE;
+ }
+ }
+ if (PHP_SAFE_FD_ISSET(fd, &poller->active.wfds)) {
+ if (SUCCESS != callback(opaque, fd, POLLOUT)) {
+ retval = FAILURE;
+ }
}
- pr++;
- pw++;
}
#endif
return retval;

View File

@ -58,7 +58,7 @@
Summary: PHP scripting language for creating dynamic web sites Summary: PHP scripting language for creating dynamic web sites
Name: php Name: php
Version: 5.4.12 Version: 5.4.12
Release: 0.1.RC1%{?dist} Release: 0.2.RC1%{?dist}
# All files licensed under PHP version 3.01, except # All files licensed under PHP version 3.01, except
# Zend is licensed under Zend # Zend is licensed under Zend
# TSRM is licensed under BSD # TSRM is licensed under BSD
@ -86,6 +86,8 @@ Patch8: php-5.4.7-libdb.patch
# Fixes for extension modules # Fixes for extension modules
# https://bugs.php.net/63171 no odbc call during timeout # https://bugs.php.net/63171 no odbc call during timeout
Patch21: php-5.4.7-odbctimer.patch Patch21: php-5.4.7-odbctimer.patch
# https://bugs.php.net/64128 buit-in web server is broken on ppc64
Patch22: php-5.4.11-select.patch
# Functional changes # Functional changes
Patch40: php-5.4.0-dlopen.patch Patch40: php-5.4.0-dlopen.patch
@ -658,6 +660,7 @@ support for using the enchant library to PHP.
%patch8 -p1 -b .libdb %patch8 -p1 -b .libdb
%patch21 -p1 -b .odbctimer %patch21 -p1 -b .odbctimer
%patch22 -p1 -b .select
%patch40 -p1 -b .dlopen %patch40 -p1 -b .dlopen
%patch41 -p1 -b .easter %patch41 -p1 -b .easter
@ -1403,6 +1406,10 @@ fi
%changelog %changelog
* Fri Feb 1 2013 Remi Collet <rcollet@redhat.com> 5.4.12-0.2.RC1
- fix buit-in web server on ppc64 (fdset usage)
https://bugs.php.net/64128
* Thu Jan 31 2013 Remi Collet <rcollet@redhat.com> 5.4.12-0.1.RC1 * Thu Jan 31 2013 Remi Collet <rcollet@redhat.com> 5.4.12-0.1.RC1
- update to 5.4.12RC1 - update to 5.4.12RC1