Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
95f52f7
Add initial poll API
bukka Aug 15, 2025
5f0e47d
Add poll mechanism build checks and fix build
bukka Aug 16, 2025
28d6efe
Fix port and select backend and improve config
bukka Aug 16, 2025
61542e3
poll: restructure and refactore error handling and other bits
bukka Aug 16, 2025
6ab3e3d
poll: use zend memory allocator
bukka Aug 16, 2025
6563a68
poll: split init from create
bukka Aug 16, 2025
420b2fc
poll: use pefree instead of free everywhere
bukka Aug 16, 2025
a883c2c
poll: declare PHPAPI
bukka Aug 16, 2025
dd63ce5
poll: fix kqueue build
bukka Aug 18, 2025
29f8cd5
Add initial streams polling API
bukka Aug 19, 2025
2acdcc2
poll: add missing private constructor
bukka Aug 19, 2025
7f27ddb
poll: add initial test
bukka Aug 19, 2025
3ba4df9
poll: reorganize stubs so functions are added
bukka Aug 19, 2025
7baeb9b
poll: do not dtor stream event property
bukka Aug 20, 2025
0a468b6
poll: split the basic test to multiple eparated scenarios
bukka Aug 20, 2025
4c3d2f6
poll: fix returned events
bukka Aug 20, 2025
0b53b16
poll: rewrite kevent to track changed events
bukka Aug 20, 2025
7c0fdb9
poll: refactore kevent to get rid of long term batching
bukka Aug 20, 2025
b21421a
poll: add modify and write test
bukka Aug 20, 2025
bacac28
poll: optimize and refactore all apis to better handle max_events
bukka Aug 21, 2025
ecc128c
poll: use common logic for fd tracking
bukka Aug 21, 2025
5deac43
poll: use custom allocation macros that can fail on persistent
bukka Aug 21, 2025
2d96199
poll: add Windows build config changes
bukka Aug 21, 2025
d0e478e
poll: support poll creation by backend name
bukka Aug 21, 2025
0784da7
poll: clean up and update tests to allow backend selection
bukka Aug 21, 2025
1713340
poll: refactore, simplify and extend tests
bukka Aug 21, 2025
514c1b0
poll: fix kqueue removal logic
bukka Aug 22, 2025
f31ecd0
poll: check stream map before deleting for better error
bukka Aug 22, 2025
1fdb97a
poll: extend and simplify tests
bukka Aug 22, 2025
19a9f45
poll: add suitable max events callback to get right number of events …
bukka Aug 22, 2025
28b4f7e
poll: group kqueue events and correctly count max events
bukka Aug 22, 2025
d0bc5d3
poll: make the kqueue one shot logic consistent with epoll
bukka Aug 22, 2025
c17a895
poll: refactore and simplify oneshot kqueue logic
bukka Aug 23, 2025
571a6d1
poll: improve and extend error handling with some helpers
bukka Aug 23, 2025
5ff0e2b
poll: extend and clean up tests
bukka Aug 23, 2025
3210f07
poll: rewrite tests to expect events in any order
bukka Aug 23, 2025
0c21080
poll: support backend specific events in event expectation
bukka Aug 23, 2025
30c313e
poll: extend and fix edge tests
bukka Aug 23, 2025
a7237e9
poll: refactore and optimize fd table
bukka Aug 23, 2025
69e69c3
poll: refactore poll logic to use more optimally fd table
bukka Aug 23, 2025
d78e387
poll: remove incorrect edge triggering simulation
bukka Aug 23, 2025
c1fa7a0
poll: fix test reporting of unpexpected events when array present
bukka Aug 24, 2025
6812a3e
poll: fix, refactore and simplify poll backend
bukka Aug 24, 2025
0811150
Make poll always available
bukka Aug 24, 2025
8dc9259
poll: remove select backend as it is broken and not needed
bukka Aug 24, 2025
d12dc81
poll: fix compilation issues
bukka Aug 24, 2025
a0e7be9
poll: use STREAM_POLL_WRITE|STREAM_POLL_HUP as default for HOP
bukka Aug 24, 2025
731b40b
poll: use php_pollfd instead of struct pollfd
bukka Aug 24, 2025
020c8fd
poll: remove select backend constants and fix backend name test
bukka Aug 24, 2025
6112a23
poll: add stream poll classes to reflection getClassName test
bukka Aug 24, 2025
350c347
poll: update arginfo
bukka Aug 24, 2025
c96dd1c
poll: introduce php_poll_msleep for win compat
bukka Aug 24, 2025
142354d
Drop IOCP backend as it is not suitable
bukka Sep 19, 2025
f72a9c2
poll: add wsapoll backend with additional tests and fix Win compat
bukka Sep 21, 2025
efc989f
poll: fix wsapoll CS
bukka Sep 21, 2025
6fe24fd
poll: fix wsapoll and poll compatibility
bukka Sep 21, 2025
bb6312a
poll: add raw events support to allow lower overhead on kqueue
bukka Sep 22, 2025
5bca345
poll: add actually kqueue implementation for raw_events
bukka Sep 22, 2025
e272078
poll: add initial obj migration
bukka Sep 23, 2025
04fdcd8
poll: add primary implementation and tests for objective polling
bukka Sep 24, 2025
f9993bf
poll: fix failed addition
bukka Sep 24, 2025
224fb60
poll: fix poll testing helpers
bukka Sep 24, 2025
248063a
poll: fix missing stream addref or return from getStream
bukka Sep 24, 2025
62c77c6
poll: fix raw event check
bukka Sep 24, 2025
fe46946
poll: drop compat flag as it does not make sense for watchers
bukka Sep 24, 2025
c41c7e6
poll: remove unused compat variable
bukka Sep 24, 2025
6853773
poll: update classes in ReflectionExtension::getClassNames
bukka Sep 25, 2025
b297d07
poll: fix error overwriting
bukka Oct 28, 2025
c8c0a50
poll: fix and extend kqueue fd tracking
bukka Oct 28, 2025
709b5ca
poll: expect kqueue without error on rw close with data
bukka Oct 28, 2025
ef78a97
poll: add one shot mixed test
bukka Oct 28, 2025
70126fc
poll: remove buggy ET emulation from event port
bukka Oct 29, 2025
69d21fb
poll: extend backend test to show current backend
bukka Oct 29, 2025
6ae469c
poll: remove HUP expectation for eventport
bukka Oct 29, 2025
e168f07
poll: add handling for eventport unfired events
bukka Oct 29, 2025
b712255
poll: fix handling for eventport unfired oneshot events
bukka Oct 29, 2025
1bf473e
poll: ignore port_getn timeout error for eventport
bukka Oct 29, 2025
1fb2bf2
poll: change eventport logic to not pre-associate
bukka Oct 29, 2025
a319fac
poll: differentiate eventport for HUP events
bukka Oct 29, 2025
b9aee04
poll: fix association error handling for eventport
bukka Oct 29, 2025
d027c6c
poll: fix hup tests that are now correctly handled
bukka Oct 29, 2025
c87f212
poll: use PollBackend enum for backends
bukka Oct 30, 2025
f55bea1
poll: add PollBackend to Reflection test
bukka Oct 30, 2025
70c3940
poll: fix uninitialized backend_obj
bukka Oct 30, 2025
efce95d
poll: fix typo in kqueue backend name check
bukka Oct 30, 2025
22689ad
poll: make PollWatcher::__construct private
bukka Oct 30, 2025
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
42 changes: 42 additions & 0 deletions build/php.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,48 @@ int main(void) {
])
])

AC_DEFUN([PHP_POLL_MECHANISMS],
[
AC_MSG_CHECKING([for polling mechanisms])
poll_mechanisms=""

AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <sys/epoll.h>
], [
int fd = epoll_create(1);
return fd;
])], [
AC_DEFINE([HAVE_EPOLL], [1], [Define if epoll is available])
poll_mechanisms="$poll_mechanisms epoll"
])

AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <sys/event.h>
#include <sys/time.h>
], [
int kq = kqueue();
return kq;
])], [
AC_DEFINE([HAVE_KQUEUE], [1], [Define if kqueue is available])
poll_mechanisms="$poll_mechanisms kqueue"
])

AC_COMPILE_IFELSE([AC_LANG_PROGRAM([
#include <port.h>
], [
int port = port_create();
return port;
])], [
AC_DEFINE([HAVE_EVENT_PORTS], [1], [Define if event ports are available])
poll_mechanisms="$poll_mechanisms eventport"
])

dnl Set poll mechanisms including poll that is always available
poll_mechanisms="$poll_mechanisms poll"

AC_MSG_RESULT([$poll_mechanisms])
])

dnl ----------------------------------------------------------------------------
dnl Library/function existence and build sanity checks.
dnl ----------------------------------------------------------------------------
Expand Down
12 changes: 12 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ AC_CHECK_HEADERS(m4_normalize([
])

PHP_FOPENCOOKIE
PHP_POLL_MECHANISMS
PHP_BROKEN_GETCWD
AS_VAR_IF([GCC], [yes], [PHP_BROKEN_GCC_STRLEN_OPT])

Expand Down Expand Up @@ -1688,6 +1689,17 @@ PHP_ADD_SOURCES_X([main],
[PHP_FASTCGI_OBJS],
[no])

PHP_ADD_SOURCES([main/poll], m4_normalize([
poll_backend_epoll.c
poll_backend_eventport.c
poll_backend_kqueue.c
poll_backend_poll.c
poll_core.c
poll_fd_table.c
poll_handle.c
]),
[-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])

PHP_ADD_SOURCES([main/streams], m4_normalize([
cast.c
filter.c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ foreach ($classNames as $className) {
--EXPECT--
AssertionError
Directory
PollBackend
PollContext
PollException
PollHandle
PollWatcher
RoundingMode
StreamBucket
StreamPollHandle
__PHP_Incomplete_Class
php_user_filter
1 change: 1 addition & 0 deletions ext/standard/basic_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
BASIC_MINIT_SUBMODULE(browscap)
BASIC_MINIT_SUBMODULE(standard_filters)
BASIC_MINIT_SUBMODULE(user_filters)
BASIC_MINIT_SUBMODULE(poll)
BASIC_MINIT_SUBMODULE(password)
BASIC_MINIT_SUBMODULE(image)

Expand Down
1 change: 1 addition & 0 deletions ext/standard/basic_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ PHP_MINFO_FUNCTION(basic);

ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini);

PHP_MINIT_FUNCTION(poll);
PHP_MINIT_FUNCTION(user_filters);
PHP_RSHUTDOWN_FUNCTION(user_filters);
PHP_RSHUTDOWN_FUNCTION(browscap);
Expand Down
1 change: 1 addition & 0 deletions ext/standard/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ PHP_NEW_EXTENSION([standard], m4_normalize([
pageinfo.c
password.c
php_fopen_wrapper.c
poll.c
proc_open.c
quot_print.c
scanf.c
Expand Down
3 changes: 2 additions & 1 deletion ext/standard/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ EXTENSION("standard", "array.c base64.c basic_functions.c browscap.c \
url_scanner_ex.c ftp_fopen_wrapper.c http_fopen_wrapper.c \
php_fopen_wrapper.c credits.c css.c var_unserializer.c ftok.c sha1.c \
user_filters.c uuencode.c filters.c proc_open.c password.c \
streamsfuncs.c http.c flock_compat.c hrtime.c", false /* never shared */,
poll.c streamsfuncs.c http.c flock_compat.c hrtime.c",
false /* never shared */,
'/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
ADD_SOURCES("ext/standard/libavifinfo", "avifinfo.c", "standard");
PHP_STANDARD = "yes";
Expand Down
Loading