Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
06a73ce
Add initial poll API
bukka Aug 15, 2025
e785ff5
Add poll mechanism build checks and fix build
bukka Aug 16, 2025
10c74f9
Fix port and select backend and improve config
bukka Aug 16, 2025
53b0148
poll: restructure and refactore error handling and other bits
bukka Aug 16, 2025
d4cba93
poll: use zend memory allocator
bukka Aug 16, 2025
b69ffd4
poll: split init from create
bukka Aug 16, 2025
f23a9f7
poll: use pefree instead of free everywhere
bukka Aug 16, 2025
2545a9c
poll: declare PHPAPI
bukka Aug 16, 2025
8b0d70e
poll: fix kqueue build
bukka Aug 18, 2025
15c6f87
Add initial streams polling API
bukka Aug 19, 2025
b00b6a8
poll: add missing private constructor
bukka Aug 19, 2025
1bec44b
poll: add initial test
bukka Aug 19, 2025
b0c46ad
poll: reorganize stubs so functions are added
bukka Aug 19, 2025
dd93779
poll: do not dtor stream event property
bukka Aug 20, 2025
d63e098
poll: split the basic test to multiple eparated scenarios
bukka Aug 20, 2025
1c7ee2e
poll: fix returned events
bukka Aug 20, 2025
668b1b9
poll: rewrite kevent to track changed events
bukka Aug 20, 2025
0d5c918
poll: refactore kevent to get rid of long term batching
bukka Aug 20, 2025
2fc7e5c
poll: add modify and write test
bukka Aug 20, 2025
3182dc8
poll: optimize and refactore all apis to better handle max_events
bukka Aug 21, 2025
6fe4989
poll: use common logic for fd tracking
bukka Aug 21, 2025
12add43
poll: use custom allocation macros that can fail on persistent
bukka Aug 21, 2025
122c385
poll: add Windows build config changes
bukka Aug 21, 2025
8f18b88
poll: support poll creation by backend name
bukka Aug 21, 2025
1895c2f
poll: clean up and update tests to allow backend selection
bukka Aug 21, 2025
0167c47
poll: refactore, simplify and extend tests
bukka Aug 21, 2025
6d2e04d
poll: fix kqueue removal logic
bukka Aug 22, 2025
b95d283
poll: check stream map before deleting for better error
bukka Aug 22, 2025
d677ea5
poll: extend and simplify tests
bukka Aug 22, 2025
10a43e9
poll: add suitable max events callback to get right number of events …
bukka Aug 22, 2025
eb20335
poll: group kqueue events and correctly count max events
bukka Aug 22, 2025
8b5383e
poll: make the kqueue one shot logic consistent with epoll
bukka Aug 22, 2025
74b8bca
poll: refactore and simplify oneshot kqueue logic
bukka Aug 23, 2025
945d43b
poll: improve and extend error handling with some helpers
bukka Aug 23, 2025
3b51d12
poll: extend and clean up tests
bukka Aug 23, 2025
29839bf
poll: rewrite tests to expect events in any order
bukka Aug 23, 2025
6508a7f
poll: support backend specific events in event expectation
bukka Aug 23, 2025
b558f19
poll: extend and fix edge tests
bukka Aug 23, 2025
ee34010
poll: refactore and optimize fd table
bukka Aug 23, 2025
f769a1a
poll: refactore poll logic to use more optimally fd table
bukka Aug 23, 2025
05bac66
poll: remove incorrect edge triggering simulation
bukka Aug 23, 2025
47e33de
poll: fix test reporting of unpexpected events when array present
bukka Aug 24, 2025
ccd5a58
poll: fix, refactore and simplify poll backend
bukka Aug 24, 2025
089f160
Make poll always available
bukka Aug 24, 2025
ca835b0
poll: remove select backend as it is broken and not needed
bukka Aug 24, 2025
87ad5ab
poll: fix compilation issues
bukka Aug 24, 2025
86b1f38
poll: use STREAM_POLL_WRITE|STREAM_POLL_HUP as default for HOP
bukka Aug 24, 2025
5a7cc15
poll: use php_pollfd instead of struct pollfd
bukka Aug 24, 2025
3adfbc2
poll: remove select backend constants and fix backend name test
bukka Aug 24, 2025
eb417a1
poll: add stream poll classes to reflection getClassName test
bukka Aug 24, 2025
f8d180d
poll: update arginfo
bukka Aug 24, 2025
a340c67
poll: introduce php_poll_msleep for win compat
bukka Aug 24, 2025
4e50859
Drop IOCP backend as it is not suitable
bukka Sep 19, 2025
5e0c91f
poll: add wsapoll backend with additional tests and fix Win compat
bukka Sep 21, 2025
4621203
poll: fix wsapoll CS
bukka Sep 21, 2025
a8634ed
poll: fix wsapoll and poll compatibility
bukka Sep 21, 2025
59d31da
poll: add raw events support to allow lower overhead on kqueue
bukka Sep 22, 2025
b4ef6fc
poll: add actually kqueue implementation for raw_events
bukka Sep 22, 2025
1c65448
poll: add initial obj migration
bukka Sep 23, 2025
1f596d9
poll: add primary implementation and tests for objective polling
bukka Sep 24, 2025
004b170
poll: fix failed addition
bukka Sep 24, 2025
e606d3b
poll: fix poll testing helpers
bukka Sep 24, 2025
ea97955
poll: fix missing stream addref or return from getStream
bukka Sep 24, 2025
e047bb7
poll: fix raw event check
bukka Sep 24, 2025
a73fc9b
poll: drop compat flag as it does not make sense for watchers
bukka Sep 24, 2025
94267ad
poll: remove unused compat variable
bukka Sep 24, 2025
d02dfff
poll: update classes in ReflectionExtension::getClassNames
bukka Sep 25, 2025
3cecec0
poll: fix error overwriting
bukka Oct 28, 2025
897bd24
poll: fix and extend kqueue fd tracking
bukka Oct 28, 2025
e24fc05
poll: expect kqueue without error on rw close with data
bukka Oct 28, 2025
a81dff5
poll: add one shot mixed test
bukka Oct 28, 2025
8ad5b9e
poll: remove buggy ET emulation from event port
bukka Oct 29, 2025
84a7987
poll: extend backend test to show current backend
bukka Oct 29, 2025
007f3ad
poll: remove HUP expectation for eventport
bukka Oct 29, 2025
288b3ca
poll: add handling for eventport unfired events
bukka Oct 29, 2025
a748bd4
poll: fix handling for eventport unfired oneshot events
bukka Oct 29, 2025
af92ad8
poll: ignore port_getn timeout error for eventport
bukka Oct 29, 2025
d86d2e1
poll: change eventport logic to not pre-associate
bukka Oct 29, 2025
138377a
poll: differentiate eventport for HUP events
bukka Oct 29, 2025
5df9926
poll: fix association error handling for eventport
bukka Oct 29, 2025
29fbc88
poll: fix hup tests that are now correctly handled
bukka Oct 29, 2025
d00d82f
poll: use PollBackend enum for backends
bukka Oct 30, 2025
1ccab4e
poll: add PollBackend to Reflection test
bukka Oct 30, 2025
ec30065
poll: fix uninitialized backend_obj
bukka Oct 30, 2025
cfb8db3
poll: fix typo in kqueue backend name check
bukka Oct 30, 2025
2ccfd94
poll: make PollWatcher::__construct private
bukka Oct 30, 2025
7f78a13
poll: remove POLLRDBAND mapping from wsapoll
bukka Dec 23, 2025
3e8bac3
poll: optimize poll add and remove for those using fd table
bukka Dec 23, 2025
85d84b7
poll: namespace and extend api including new event enum
bukka Dec 23, 2025
d1f87a4
poll: fix missing addref for enum array
bukka Dec 23, 2025
ed152b3
poll: update ReflectionExtension getClassNames test
bukka Dec 23, 2025
a4933d4
poll: update the backend name in tests
bukka Dec 23, 2025
88587f7
poll: fix backend type
bukka Dec 26, 2025
914cdea
poll: introduce multiple structured exceptions
bukka Dec 26, 2025
36968c8
poll: update again ReflectionExtension getClassNames test
bukka Dec 26, 2025
e6b9ae5
poll: use value error for setting invalid backend
bukka Dec 27, 2025
dc190e3
poll: add microseconds wait timeout and internally use timespec
bukka Feb 22, 2026
8bd0b4a
poll: make Handle::getFileDescriptor abstract
bukka Feb 22, 2026
b553541
poll: use generic notation for some return arrays
bukka Feb 22, 2026
d48b64f
poll: introduce BackendUnavailableException
bukka Feb 22, 2026
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
44 changes: 44 additions & 0 deletions build/php.m4
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,50 @@ 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_CHECK_FUNCS([epoll_pwait2], [], [], [#include <sys/epoll.h>])
])

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,24 @@ foreach ($classNames as $className) {
--EXPECT--
AssertionError
Directory
Io\IoException
Io\Poll\Backend
Io\Poll\BackendUnavailableException
Io\Poll\Context
Io\Poll\Event
Io\Poll\FailedContextInitializationException
Io\Poll\FailedHandleAddException
Io\Poll\FailedPollOperationException
Io\Poll\FailedPollWaitException
Io\Poll\FailedWatcherModificationException
Io\Poll\Handle
Io\Poll\HandleAlreadyWatchedException
Io\Poll\InactiveWatcherException
Io\Poll\InvalidHandleException
Io\Poll\PollException
Io\Poll\Watcher
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 @@ -44,6 +44,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 @@ -418,6 +418,7 @@ PHP_NEW_EXTENSION([standard], m4_normalize([
image.c
incomplete_class.c
info.c
io_poll.c
iptc.c
levenshtein.c
libavifinfo/avifinfo.c
Expand Down
5 changes: 3 additions & 2 deletions ext/standard/config.w32
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,15 @@ EXTENSION("standard", "array.c base64.c basic_functions.c browscap.c \
crypt_sha512.c php_crypt_r.c " + (TARGET_ARCH != 'arm64'? " crc32_x86.c" : "") + " \
datetime.c dir.c dl.c dns.c dns_win32.c exec.c \
file.c filestat.c formatted_print.c fsock.c head.c html.c image.c \
info.c iptc.c link.c mail.c math.c md5.c metaphone.c microtime.c \
info.c io_poll.c iptc.c link.c mail.c math.c md5.c metaphone.c microtime.c \
net.c pack.c pageinfo.c quot_print.c soundex.c \
string.c scanf.c syslog.c type.c uniqid.c url.c var.c \
versioning.c assert.c strnatcmp.c levenshtein.c incomplete_class.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 */,
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
Loading