Skip to content

posix detects posix_pathconf api. #10350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion ext/posix/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if test "$PHP_POSIX" = "yes"; then

AC_CHECK_HEADERS([sys/mkdev.h sys/sysmacros.h])

AC_CHECK_FUNCS(seteuid setegid setsid getsid getpgid ctermid mkfifo mknod setrlimit getrlimit getgroups makedev initgroups getgrgid_r)
AC_CHECK_FUNCS(seteuid setegid setsid getsid getpgid ctermid mkfifo mknod setrlimit getrlimit getgroups makedev initgroups getgrgid_r posix_pathconf)

AC_MSG_CHECKING([for working ttyname_r() implementation])
AC_RUN_IFELSE([AC_LANG_SOURCE([[
Expand Down
2 changes: 2 additions & 0 deletions ext/posix/posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,7 @@ PHP_FUNCTION(posix_sysconf)
RETURN_LONG(sysconf(conf_id));
}

#ifdef HAVE_POSIX_PATHCONF
PHP_FUNCTION(posix_pathconf)
{
zend_long name, ret;
Expand Down Expand Up @@ -1257,3 +1258,4 @@ PHP_FUNCTION(posix_fpathconf)

RETURN_LONG(ret);
}
#endif
2 changes: 2 additions & 0 deletions ext/posix/posix.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,8 @@ function posix_initgroups(string $username, int $group_id): bool {}

function posix_sysconf(int $conf_id): int {}

#ifdef HAVE_POSIX_PATHCONF
function posix_pathconf(string $path, int $name): int|false {}
/** @param resource|int $file_descriptor */
function posix_fpathconf($file_descriptor, int $name): int|false {}
#endif
14 changes: 13 additions & 1 deletion ext/posix/posix_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions ext/posix/tests/posix_fpathconf.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Test posix_fpathconf
--EXTENSIONS--
posix
--SKIPIF--
<?php
if (!function_exists("posix_pathconf")) die("skip only platforms with posix_pathconf");
?>
--FILE--
<?php
var_dump(posix_fpathconf(-1, POSIX_PC_PATH_MAX));
Expand Down
4 changes: 4 additions & 0 deletions ext/posix/tests/posix_pathconf.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
Test posix_pathconf
--EXTENSIONS--
posix
--SKIPIF--
<?php
if (!function_exists("posix_pathconf")) die("skip only platforms with posix_pathconf");
?>
--FILE--
<?php
try {
Expand Down