Skip to content

Commit 6c6fb56

Browse files
committed
Introduce Io\Poll userspace API
It makes use of internal polling API and exposes its functionality to user space. Closes phpGH-19572
1 parent 2d15108 commit 6c6fb56

33 files changed

Lines changed: 2453 additions & 3 deletions

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ PHP NEWS
9292
. Fixed UConverter::transcode() silently truncating from_subst and to_subst
9393
option lengths greater than 127 bytes. (Weilin Du)
9494

95+
- IO:
96+
. Added new polling API. (Jakub Zelenka)
97+
9598
- JSON:
9699
. Enriched JSON last error / exception message with error location.
97100
(Juan Morales)

UPGRADING

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,10 @@ PHP 8.6 UPGRADE NOTES
197197
IntlNumberRangeFormatter::IDENTITY_FALLBACK_RANGE identity fallbacks.
198198
It is supported from icu 63.
199199

200+
- IO:
201+
. Added new polling API.
202+
RFC: https://wiki.php.net/rfc/poll_api
203+
200204
- JSON:
201205
. Added extra info about error location to the JSON error messages returned
202206
from json_last_error_msg() and JsonException message.
@@ -351,6 +355,23 @@ PHP 8.6 UPGRADE NOTES
351355
. enum StreamErrorMode
352356
. enum StreamErrorCode
353357
RFC: https://wiki.php.net/rfc/stream_errors
358+
. Io\Poll\Context
359+
. Io\Poll\Watcher
360+
. enum Io\Poll\Backend
361+
. enum Io\Poll\Event
362+
. interface Io\Poll\Handle
363+
. Io\IoException
364+
. Io\Poll\PollException
365+
. Io\Poll\FailedPollOperationException
366+
. Io\Poll\FailedContextInitializationException
367+
. Io\Poll\FailedHandleAddException
368+
. Io\Poll\FailedWatcherModificationException
369+
. Io\Poll\FailedPollWaitException
370+
. Io\Poll\BackendUnavailableException
371+
. Io\Poll\InactiveWatcherException
372+
. Io\Poll\HandleAlreadyWatchedException
373+
. Io\Poll\InvalidHandleException
374+
. StreamPollHandle
354375

355376
========================================
356377
8. Removed Extensions and SAPIs

ext/reflection/tests/ReflectionExtension_getClassNames_basic.phpt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@ foreach ($classNames as $className) {
1414
--EXPECT--
1515
AssertionError
1616
Directory
17+
Io\IoException
18+
Io\Poll\Backend
19+
Io\Poll\BackendUnavailableException
20+
Io\Poll\Context
21+
Io\Poll\Event
22+
Io\Poll\FailedContextInitializationException
23+
Io\Poll\FailedHandleAddException
24+
Io\Poll\FailedPollOperationException
25+
Io\Poll\FailedPollWaitException
26+
Io\Poll\FailedWatcherModificationException
27+
Io\Poll\Handle
28+
Io\Poll\HandleAlreadyWatchedException
29+
Io\Poll\InactiveWatcherException
30+
Io\Poll\InvalidHandleException
31+
Io\Poll\PollException
32+
Io\Poll\Watcher
1733
RoundingMode
1834
SortDirection
1935
StreamBucket
@@ -22,5 +38,6 @@ StreamErrorCode
2238
StreamErrorMode
2339
StreamErrorStore
2440
StreamException
41+
StreamPollHandle
2542
__PHP_Incomplete_Class
2643
php_user_filter

ext/standard/basic_functions.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ PHP_MINIT_FUNCTION(basic) /* {{{ */
302302
BASIC_MINIT_SUBMODULE(browscap)
303303
BASIC_MINIT_SUBMODULE(standard_filters)
304304
BASIC_MINIT_SUBMODULE(user_filters)
305+
BASIC_MINIT_SUBMODULE(poll)
305306
BASIC_MINIT_SUBMODULE(password)
306307
BASIC_MINIT_SUBMODULE(image)
307308

ext/standard/basic_functions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ PHP_MINFO_FUNCTION(basic);
4242

4343
ZEND_API void php_get_highlight_struct(zend_syntax_highlighter_ini *syntax_highlighter_ini);
4444

45+
PHP_MINIT_FUNCTION(poll);
4546
PHP_MINIT_FUNCTION(user_filters);
4647
PHP_RSHUTDOWN_FUNCTION(user_filters);
4748
PHP_RSHUTDOWN_FUNCTION(browscap);

ext/standard/config.m4

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ PHP_NEW_EXTENSION([standard], m4_normalize([
418418
image.c
419419
incomplete_class.c
420420
info.c
421+
io_poll.c
421422
iptc.c
422423
levenshtein.c
423424
libavifinfo/avifinfo.c

ext/standard/config.w32

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,15 @@ EXTENSION("standard", "array.c base64.c basic_functions.c browscap.c \
2828
crypt_sha512.c php_crypt_r.c " + (TARGET_ARCH != 'arm64'? " crc32_x86.c" : "") + " \
2929
datetime.c dir.c dl.c dns.c dns_win32.c exec.c \
3030
file.c filestat.c formatted_print.c fsock.c head.c html.c image.c \
31-
info.c iptc.c link.c mail.c math.c md5.c metaphone.c microtime.c \
31+
info.c io_poll.c iptc.c link.c mail.c math.c md5.c metaphone.c microtime.c \
3232
net.c pack.c pageinfo.c quot_print.c soundex.c \
3333
string.c scanf.c syslog.c type.c uniqid.c url.c var.c \
3434
versioning.c assert.c strnatcmp.c levenshtein.c incomplete_class.c \
3535
url_scanner_ex.c ftp_fopen_wrapper.c http_fopen_wrapper.c \
3636
php_fopen_wrapper.c credits.c css.c var_unserializer.c ftok.c sha1.c \
3737
user_filters.c uuencode.c filters.c proc_open.c password.c \
38-
streamsfuncs.c http.c flock_compat.c hrtime.c", false /* never shared */,
38+
streamsfuncs.c http.c flock_compat.c hrtime.c",
39+
false /* never shared */,
3940
'/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');
4041
ADD_SOURCES("ext/standard/libavifinfo", "avifinfo.c", "standard");
4142
PHP_STANDARD = "yes";

0 commit comments

Comments
 (0)