Skip to content

Commit dee3951

Browse files
committed
posix detects posix_pathconf api.
alpine linux throws undefined reference at build time, thus not assuming it s necessarily available. Closes GH-10350.
1 parent 948cb47 commit dee3951

File tree

6 files changed

+26
-2
lines changed

6 files changed

+26
-2
lines changed

ext/posix/config.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ if test "$PHP_POSIX" = "yes"; then
1010

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

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

1515
AC_MSG_CHECKING([for working ttyname_r() implementation])
1616
AC_RUN_IFELSE([AC_LANG_SOURCE([[

ext/posix/posix.c

+2
Original file line numberDiff line numberDiff line change
@@ -1197,6 +1197,7 @@ PHP_FUNCTION(posix_sysconf)
11971197
RETURN_LONG(sysconf(conf_id));
11981198
}
11991199

1200+
#ifdef HAVE_POSIX_PATHCONF
12001201
PHP_FUNCTION(posix_pathconf)
12011202
{
12021203
zend_long name, ret;
@@ -1257,3 +1258,4 @@ PHP_FUNCTION(posix_fpathconf)
12571258

12581259
RETURN_LONG(ret);
12591260
}
1261+
#endif

ext/posix/posix.stub.php

+2
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,8 @@ function posix_initgroups(string $username, int $group_id): bool {}
428428

429429
function posix_sysconf(int $conf_id): int {}
430430

431+
#ifdef HAVE_POSIX_PATHCONF
431432
function posix_pathconf(string $path, int $name): int|false {}
432433
/** @param resource|int $file_descriptor */
433434
function posix_fpathconf($file_descriptor, int $name): int|false {}
435+
#endif

ext/posix/posix_arginfo.h

+13-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/posix/tests/posix_fpathconf.phpt

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
Test posix_fpathconf
33
--EXTENSIONS--
44
posix
5+
--SKIPIF--
6+
<?php
7+
if (!function_exists("posix_pathconf")) die("skip only platforms with posix_pathconf");
8+
?>
59
--FILE--
610
<?php
711
var_dump(posix_fpathconf(-1, POSIX_PC_PATH_MAX));

ext/posix/tests/posix_pathconf.phpt

+4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
Test posix_pathconf
33
--EXTENSIONS--
44
posix
5+
--SKIPIF--
6+
<?php
7+
if (!function_exists("posix_pathconf")) die("skip only platforms with posix_pathconf");
8+
?>
59
--FILE--
610
<?php
711
try {

0 commit comments

Comments
 (0)