Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
a7deac1
Add initial poll API
bukka Aug 15, 2025
35c653f
Add poll mechanism build checks and fix build
bukka Aug 16, 2025
b23ec6e
Fix port and select backend and improve config
bukka Aug 16, 2025
a35ed01
poll: restructure and refactore error handling and other bits
bukka Aug 16, 2025
02b45e1
poll: use zend memory allocator
bukka Aug 16, 2025
b335f8c
poll: split init from create
bukka Aug 16, 2025
4e5b58c
poll: use pefree instead of free everywhere
bukka Aug 16, 2025
1fb62e3
poll: declare PHPAPI
bukka Aug 16, 2025
52f8c34
poll: fix kqueue build
bukka Aug 18, 2025
cbeeadb
Add initial streams polling API
bukka Aug 19, 2025
08caffb
poll: add missing private constructor
bukka Aug 19, 2025
91cb37a
poll: add initial test
bukka Aug 19, 2025
7504bb9
poll: reorganize stubs so functions are added
bukka Aug 19, 2025
0d4407b
poll: do not dtor stream event property
bukka Aug 20, 2025
b0cb038
poll: split the basic test to multiple eparated scenarios
bukka Aug 20, 2025
39c69b7
poll: fix returned events
bukka Aug 20, 2025
ec3ac45
poll: rewrite kevent to track changed events
bukka Aug 20, 2025
6e5af01
poll: refactore kevent to get rid of long term batching
bukka Aug 20, 2025
ca2bc8c
poll: add modify and write test
bukka Aug 20, 2025
eebfaa1
poll: optimize and refactore all apis to better handle max_events
bukka Aug 21, 2025
f123855
poll: use common logic for fd tracking
bukka Aug 21, 2025
04ad23c
poll: use custom allocation macros that can fail on persistent
bukka Aug 21, 2025
0fb6bf9
poll: add Windows build config changes
bukka Aug 21, 2025
1ef78d8
poll: support poll creation by backend name
bukka Aug 21, 2025
9b71afe
poll: clean up and update tests to allow backend selection
bukka Aug 21, 2025
2c5bc50
poll: refactore, simplify and extend tests
bukka Aug 21, 2025
f69c528
poll: fix kqueue removal logic
bukka Aug 22, 2025
0f585b1
poll: check stream map before deleting for better error
bukka Aug 22, 2025
8a9a25b
poll: extend and simplify tests
bukka Aug 22, 2025
bf81ea0
poll: add suitable max events callback to get right number of events …
bukka Aug 22, 2025
712dce1
poll: group kqueue events and correctly count max events
bukka Aug 22, 2025
3c1f4e4
poll: make the kqueue one shot logic consistent with epoll
bukka Aug 22, 2025
565d2ae
poll: refactore and simplify oneshot kqueue logic
bukka Aug 23, 2025
cf89e58
poll: improve and extend error handling with some helpers
bukka Aug 23, 2025
5ff3f74
poll: extend and clean up tests
bukka Aug 23, 2025
8a142b7
poll: rewrite tests to expect events in any order
bukka Aug 23, 2025
710b9db
poll: support backend specific events in event expectation
bukka Aug 23, 2025
10417a3
poll: extend and fix edge tests
bukka Aug 23, 2025
6a33342
poll: refactore and optimize fd table
bukka Aug 23, 2025
b2df7ec
poll: refactore poll logic to use more optimally fd table
bukka Aug 23, 2025
02bcf73
poll: remove incorrect edge triggering simulation
bukka Aug 23, 2025
c8b14f3
poll: fix test reporting of unpexpected events when array present
bukka Aug 24, 2025
715a034
poll: fix, refactore and simplify poll backend
bukka Aug 24, 2025
e173a08
Make poll always available
bukka Aug 24, 2025
3dfb4b3
poll: remove select backend as it is broken and not needed
bukka Aug 24, 2025
ae27bfc
poll: fix compilation issues
bukka Aug 24, 2025
5bb14b8
poll: use STREAM_POLL_WRITE|STREAM_POLL_HUP as default for HOP
bukka Aug 24, 2025
112162f
poll: use php_pollfd instead of struct pollfd
bukka Aug 24, 2025
627e114
poll: remove select backend constants and fix backend name test
bukka Aug 24, 2025
64e17d9
poll: add stream poll classes to reflection getClassName test
bukka Aug 24, 2025
7c4743e
poll: update arginfo
bukka Aug 24, 2025
0490f59
poll: introduce php_poll_msleep for win compat
bukka Aug 24, 2025
2ec9a79
Drop IOCP backend as it is not suitable
bukka Sep 19, 2025
815aacb
poll: add wsapoll backend with additional tests and fix Win compat
bukka Sep 21, 2025
e5e1d13
poll: fix wsapoll CS
bukka Sep 21, 2025
6a4b99c
poll: fix wsapoll and poll compatibility
bukka Sep 21, 2025
d89145c
poll: add raw events support to allow lower overhead on kqueue
bukka Sep 22, 2025
5fd314b
poll: add actually kqueue implementation for raw_events
bukka Sep 22, 2025
ce4c945
poll: add initial obj migration
bukka Sep 23, 2025
4882c92
poll: add primary implementation and tests for objective polling
bukka Sep 24, 2025
8138687
poll: fix failed addition
bukka Sep 24, 2025
7c726a9
poll: fix poll testing helpers
bukka Sep 24, 2025
7d0e7fd
poll: fix missing stream addref or return from getStream
bukka Sep 24, 2025
eefe5a5
poll: fix raw event check
bukka Sep 24, 2025
bead59a
poll: drop compat flag as it does not make sense for watchers
bukka Sep 24, 2025
4a0e33c
poll: remove unused compat variable
bukka Sep 24, 2025
7dff9d7
poll: update classes in ReflectionExtension::getClassNames
bukka Sep 25, 2025
c24da17
poll: fix error overwriting
bukka Oct 28, 2025
b38f339
poll: fix and extend kqueue fd tracking
bukka Oct 28, 2025
f6f6f1e
poll: expect kqueue without error on rw close with data
bukka Oct 28, 2025
4b5cddf
poll: add one shot mixed test
bukka Oct 28, 2025
188a190
poll: remove buggy ET emulation from event port
bukka Oct 29, 2025
5ffe79f
poll: extend backend test to show current backend
bukka Oct 29, 2025
235b60d
poll: remove HUP expectation for eventport
bukka Oct 29, 2025
6811522
poll: add handling for eventport unfired events
bukka Oct 29, 2025
ea31351
poll: fix handling for eventport unfired oneshot events
bukka Oct 29, 2025
b5a5eca
poll: ignore port_getn timeout error for eventport
bukka Oct 29, 2025
ec2c543
poll: change eventport logic to not pre-associate
bukka Oct 29, 2025
7f1e654
poll: differentiate eventport for HUP events
bukka Oct 29, 2025
8680502
poll: fix association error handling for eventport
bukka Oct 29, 2025
4267497
poll: fix hup tests that are now correctly handled
bukka Oct 29, 2025
09f1f4f
poll: use PollBackend enum for backends
bukka Oct 30, 2025
093a1de
poll: add PollBackend to Reflection test
bukka Oct 30, 2025
735b00e
poll: fix uninitialized backend_obj
bukka Oct 30, 2025
178c1fa
poll: fix typo in kqueue backend name check
bukka Oct 30, 2025
0fc9ddb
poll: make PollWatcher::__construct private
bukka Oct 30, 2025
4cb90cb
poll: remove POLLRDBAND mapping from wsapoll
bukka Dec 23, 2025
07ce3c5
poll: optimize poll add and remove for those using fd table
bukka Dec 23, 2025
327e7df
poll: namespace and extend api including new event enum
bukka Dec 23, 2025
fd8e862
poll: fix missing addref for enum array
bukka Dec 23, 2025
ece92c7
poll: update ReflectionExtension getClassNames test
bukka Dec 23, 2025
1d55dce
poll: update the backend name in tests
bukka Dec 23, 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,14 @@ foreach ($classNames as $className) {
--EXPECT--
AssertionError
Directory
Io\Poll\Backend
Io\Poll\Context
Io\Poll\Event
Io\Poll\Handle
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 @@ -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 @@ -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