Skip to content

Commit a7fb0fc

Browse files
committed
io: Use php_pollfd_for_ms for single fd poll
1 parent a9e97c2 commit a7fb0fc

2 files changed

Lines changed: 2 additions & 11 deletions

File tree

main/io/php_io.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
#include <winsock2.h>
2424
#else
2525
#include <unistd.h>
26-
#include <poll.h>
2726
#endif
2827

2928
static php_io php_io_instance = {
@@ -106,13 +105,9 @@ static int php_io_generic_wait_for_data(php_io_fd *fd)
106105
? -1
107106
: (int) (fd->timeout.tv_sec * 1000 + fd->timeout.tv_usec / 1000);
108107

109-
struct pollfd pfd;
110-
pfd.fd = fd->fd;
111-
pfd.events = POLLIN;
112-
113108
int ret;
114109
do {
115-
ret = poll(&pfd, 1, timeout_ms);
110+
ret = php_pollfd_for_ms(fd->fd, POLLIN, timeout_ms);
116111
} while (ret == -1 && errno == EINTR);
117112

118113
return ret;

main/io/php_io_copy_linux.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,9 @@ static inline int php_io_linux_wait_for_data(php_io_fd *fd)
5454
timeout_ms = ptimeout->tv_sec * 1000 + ptimeout->tv_usec / 1000;
5555
}
5656

57-
struct pollfd pfd;
58-
pfd.fd = fd->fd;
59-
pfd.events = POLLIN;
60-
6157
int ret;
6258
do {
63-
ret = poll(&pfd, 1, timeout_ms);
59+
ret = php_pollfd_for_ms(fd->fd, POLLIN, timeout_ms);
6460
} while (ret == -1 && errno == EINTR);
6561

6662
return ret;

0 commit comments

Comments
 (0)