[LTP] [PATCH] pathconf01: Allow EINVAL where POSIX leaves support unspecified
Andrea Cervesato
andrea.cervesato@suse.com
Mon Oct 12 18:20:22 CEST 2026
Hi Wake,
> POSIX lists two EINVAL cases for pathconf(). It shall fail with EINVAL
> when the value of name is not valid. It may also fail with EINVAL when
> "the implementation does not support an association of the variable
> name with the specified file".
>
> The test always calls pathconf() on a directory. For a directory, POSIX
> leaves it unspecified whether _PC_MAX_CANON, _PC_MAX_INPUT and
> _PC_VDISABLE (note 2), _PC_ASYNC_IO, _PC_PRIO_IO and _PC_SYNC_IO
> (note 8) and the _PC_REC_* names (note 10) are supported, so EINVAL is
> allowed for them.
>
> Bionic before Android 15 returns -1 and sets errno to EINVAL for
> _PC_REC_INCR_XFER_SIZE and _PC_REC_MAX_XFER_SIZE, which makes the test
> fail.
>
> Report EINVAL as TCONF for these names. EINVAL for the other names is
> still a failure.
>
> Also print the name and errno on failure, so it is clear which name
> failed.
>
> Signed-off-by: Wake Liu <wakel@google.com>
> ---
> .../kernel/syscalls/pathconf/pathconf01.c | 36 ++++++++++++-------
> 1 file changed, 23 insertions(+), 13 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/pathconf/pathconf01.c b/testcases/kernel/syscalls/pathconf/pathconf01.c
> index 5af45e417..635c356bc 100644
> --- a/testcases/kernel/syscalls/pathconf/pathconf01.c
> +++ b/testcases/kernel/syscalls/pathconf/pathconf01.c
> @@ -19,24 +19,26 @@ static char *path;
> static struct tcase {
> int value;
> char *name;
> + /* POSIX leaves support for a directory unspecified */
> + int einval_ok;
Usually, in these cases, it's better to define an array of errno we might
have when we trigger the syscall in a certain way. And then we use
TST_EXP_ARR_FAIL() on it.
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
More information about the ltp
mailing list