Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion build/php.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1396,7 +1396,11 @@ AC_DEFUN([PHP_POLL_MECHANISMS],
AC_DEFINE([HAVE_EPOLL], [1], [Define if epoll is available])
poll_mechanisms="$poll_mechanisms epoll"

AC_CHECK_FUNCS([epoll_pwait2], [], [], [#include <sys/epoll.h>])
AC_CHECK_FUNCS([epoll_pwait2], [],
[AC_CHECK_DECL([epoll_pwait2],
[AC_DEFINE([HAVE_EPOLL_PWAIT2], [1])],
[],
[#include <sys/epoll.h>])])
])

AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
Expand Down
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1817,6 +1817,7 @@ AC_DEFINE([HAVE_BUILD_DEFS_H], [1],

PHP_ADD_BUILD_DIR([
main
main/poll
main/streams
scripts
scripts/man1
Expand Down
10 changes: 5 additions & 5 deletions ext/standard/io_poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static const char *php_io_poll_backend_type_to_name(php_poll_backend_type type)

static php_socket_t php_stream_poll_handle_get_fd(php_poll_handle_object *handle)
{
php_stream_poll_handle_data *data = (php_stream_poll_handle_data *) handle->handle_data;
php_stream_poll_handle_data *data = handle->handle_data;
php_socket_t fd;

if (!data || !data->stream) {
Expand All @@ -241,13 +241,13 @@ static php_socket_t php_stream_poll_handle_get_fd(php_poll_handle_object *handle

static int php_stream_poll_handle_is_valid(php_poll_handle_object *handle)
{
php_stream_poll_handle_data *data = (php_stream_poll_handle_data *) handle->handle_data;
php_stream_poll_handle_data *data = handle->handle_data;
return data && data->stream && !php_stream_eof(data->stream);
}

static void php_stream_poll_handle_cleanup(php_poll_handle_object *handle)
{
php_stream_poll_handle_data *data = (php_stream_poll_handle_data *) handle->handle_data;
php_stream_poll_handle_data *data = handle->handle_data;
if (data) {
if (data->res) {
zend_list_delete(data->res);
Expand Down Expand Up @@ -508,7 +508,7 @@ PHP_METHOD(StreamPollHandle, getStream)
ZEND_PARSE_PARAMETERS_NONE();

php_poll_handle_object *intern = PHP_POLL_HANDLE_OBJ_FROM_ZV(getThis());
php_stream_poll_handle_data *data = (php_stream_poll_handle_data *) intern->handle_data;
php_stream_poll_handle_data *data = intern->handle_data;

if (!data || !data->stream) {
RETURN_NULL();
Expand Down Expand Up @@ -851,7 +851,7 @@ PHP_METHOD(Io_Poll_Context, wait)
RETURN_THROWS();
}

php_poll_event *events = emalloc(sizeof(php_poll_event) * max_events);
php_poll_event *events = safe_emalloc(max_events, sizeof(*events), 0);
int num_events = php_poll_wait(intern->ctx, events, (int) max_events, timeout);

if (num_events < 0) {
Expand Down