wez Fri Sep 17 10:36:55 2004 EDT Modified files: /php-src/main network.c /php-src/main/streams xp_socket.c /php-src/win32/build config.w32 Log: Make new poll stuff work on win32 (and still be safe on unix) http://cvs.php.net/diff.php/php-src/main/network.c?r1=1.112&r2=1.113&ty=u Index: php-src/main/network.c diff -u php-src/main/network.c:1.112 php-src/main/network.c:1.113 --- php-src/main/network.c:1.112 Fri Sep 17 08:44:56 2004 +++ php-src/main/network.c Fri Sep 17 10:36:54 2004 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: network.c,v 1.112 2004/09/17 12:44:56 wez Exp $ */ +/* $Id: network.c,v 1.113 2004/09/17 14:36:54 wez Exp $ */ /*#define DEBUG_MAIN_NETWORK 1*/ @@ -1047,7 +1047,7 @@ php_socket_t max_fd = SOCK_ERR; unsigned int i, n; struct timeval tv; - + /* check the highest numbered descriptor */ for (i = 0; i < nfds; i++) { if (ufds[i].fd > max_fd) @@ -1061,19 +1061,14 @@ FD_ZERO(&eset); for (i = 0; i < nfds; i++) { - if (ufds[i].fd >= FD_SETSIZE) { - /* unsafe to set */ - ufds[i].revents = POLLNVAL; - continue; - } if (ufds[i].events & PHP_POLLREADABLE) { - FD_SET(ufds[i].fd, &rset); + PHP_SAFE_FD_SET(ufds[i].fd, &rset); } if (ufds[i].events & POLLOUT) { - FD_SET(ufds[i].fd, &wset); + PHP_SAFE_FD_SET(ufds[i].fd, &wset); } if (ufds[i].events & POLLPRI) { - FD_SET(ufds[i].fd, &eset); + PHP_SAFE_FD_SET(ufds[i].fd, &eset); } } @@ -1081,30 +1076,24 @@ tv.tv_sec = timeout / 1000; tv.tv_usec = (timeout - (tv.tv_sec * 1000)) * 1000; } - n = select(max_fd + 1, &rset, &wset, &eset, timeout >= 0 ? &tv : NULL); if (n >= 0) { for (i = 0; i < nfds; i++) { - if (ufds[i].fd >= FD_SETSIZE) { - continue; - } - ufds[i].revents = 0; - if (FD_ISSET(ufds[i].fd, &rset)) { + if (PHP_SAFE_FD_ISSET(ufds[i].fd, &rset)) { /* could be POLLERR or POLLHUP but can't tell without probing */ ufds[i].revents |= POLLIN; } - if (FD_ISSET(ufds[i].fd, &wset)) { + if (PHP_SAFE_FD_ISSET(ufds[i].fd, &wset)) { ufds[i].revents |= POLLOUT; } - if (FD_ISSET(ufds[i].fd, &eset)) { + if (PHP_SAFE_FD_ISSET(ufds[i].fd, &eset)) { ufds[i].revents |= POLLPRI; } } } - return n; } http://cvs.php.net/diff.php/php-src/main/streams/xp_socket.c?r1=1.29&r2=1.30&ty=u Index: php-src/main/streams/xp_socket.c diff -u php-src/main/streams/xp_socket.c:1.29 php-src/main/streams/xp_socket.c:1.30 --- php-src/main/streams/xp_socket.c:1.29 Fri Sep 17 08:44:56 2004 +++ php-src/main/streams/xp_socket.c Fri Sep 17 10:36:55 2004 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: xp_socket.c,v 1.29 2004/09/17 12:44:56 wez Exp $ */ +/* $Id: xp_socket.c,v 1.30 2004/09/17 14:36:55 wez Exp $ */ #include "php.h" #include "ext/standard/file.h" @@ -126,6 +126,9 @@ sock->timeout_event = 1; if (retval >= 0) + break; + + if (php_socket_errno() != EINTR) break; } } http://cvs.php.net/diff.php/php-src/win32/build/config.w32?r1=1.31&r2=1.32&ty=u Index: php-src/win32/build/config.w32 diff -u php-src/win32/build/config.w32:1.31 php-src/win32/build/config.w32:1.32 --- php-src/win32/build/config.w32:1.31 Fri Sep 17 08:44:56 2004 +++ php-src/win32/build/config.w32 Fri Sep 17 10:36:55 2004 @@ -1,5 +1,5 @@ // vim:ft=javascript -// $Id: config.w32,v 1.31 2004/09/17 12:44:56 wez Exp $ +// $Id: config.w32,v 1.32 2004/09/17 14:36:55 wez Exp $ // "Master" config file; think of it as a configure.in // equivalent. @@ -218,7 +218,7 @@ /* this allows up to 256 sockets to be select()ed in a single * call to select(), instead of the usual 64 */ ARG_ENABLE('fd-setsize', "Set maximum number of sockets for select(2)", "256"); -AC_DEFINE('FD_SETSIZE', PHP_FD_SETSIZE); +ADD_FLAG("CFLAGS", "/D FD_SETSIZE=" + parseInt(PHP_FD_SETSIZE)); ARG_ENABLE("memory-limit", "Enable memory limit checking code", "no");
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php