Skip to content

Commit 2e2a23f

Browse files
committed
ext/posix: adding POSIX_SC_OPEN_MAX constant.
returns the number of file descriptors that a process can handle. e.g. useful after pcntl_fork() to close all the file descriptors up to that boundary.
1 parent cf5ded9 commit 2e2a23f

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

ext/posix/posix.stub.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,13 @@
303303
*/
304304
const POSIX_PC_SYMLINK_MAX = UNKNOWN;
305305
#endif
306+
#ifdef _SC_OPEN_MAX
307+
/**
308+
* @var int
309+
* @cvalue _SC_OPEN_MAX
310+
*/
311+
const POSIX_SC_OPEN_MAX = UNKNOWN;
312+
#endif
306313

307314
function posix_kill(int $process_id, int $signal): bool {}
308315

ext/posix/posix_arginfo.h

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/posix/tests/posix_sysconf.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ posix
77
var_dump(posix_sysconf(-1));
88
var_dump(posix_errno() != 0);
99
var_dump(posix_sysconf(POSIX_SC_NPROCESSORS_ONLN));
10+
var_dump(posix_sysconf(POSIX_SC_OPEN_MAX) >= 256);
1011
?>
1112
--EXPECTF--
1213
int(-1)

0 commit comments

Comments
 (0)