[php-src] poll-cleanup: cli: Convert to php_pollfd_for_ms from select
Calvin Buckley <[email protected]> Fri, 24 Jul 2026 06:04:58 +0000
| Newsgroups | gmane.comp.php.cvs.general |
|---|---|
| Message-ID | <[email protected]> |
Author: Calvin Buckley (NattyNarwhal)
Date: 2026-07-24T03:03:27-03:00
Commit: https://github.com/php/php-src/commit/cf6f4b30c2d6e2ed3d86622af533df3ae20a8a30
Raw diff: https://github.com/php/php-src/commit/cf6f4b30c2d6e2ed3d86622af533df3ae20a8a30.diff
cli: Convert to php_pollfd_for_ms from select
This is not a poll call, but it is functionally the same as one; convert
it to the single fd polling function which is clearer to read.
Changed paths:
M sapi/cli/php_cli.c
Diff:
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index e5e573d1533c..99581733dc93 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -78,12 +78,6 @@
#include "php_cli_process_title.h"
#include "php_cli_process_title_arginfo.h"
-#ifndef PHP_WIN32
-# define php_select(m, r, w, e, t) select(m, r, w, e, t)
-#else
-# include "win32/select.h"
-#endif
-
#if defined(PHP_WIN32) && defined(HAVE_OPENSSL_EXT)
# include "openssl/applink.c"
#endif
@@ -218,20 +212,8 @@ static void print_extensions(void) /* {{{ */
#ifdef PHP_WRITE_STDOUT
static inline bool sapi_cli_select(php_socket_t fd)
{
- fd_set wfd;
- struct timeval tv;
- int ret;
-
- FD_ZERO(&wfd);
-
- PHP_SAFE_FD_SET(fd, &wfd);
-
- tv.tv_sec = (long)FG(default_socket_timeout);
- tv.tv_usec = 0;
-
- ret = php_select(fd+1, NULL, &wfd, NULL, &tv);
-
- return ret != -1;
+ int timeout = FG(default_socket_timeout) * 1000;
+ return php_pollfd_for_ms(fd, POLLOUT, timeout) != -1;
}
#endif