[LTP] [PATCH v3 3/5] Add fchmodat2 fallback definition

Petr Vorel pvorel@suse.cz
Tue Jul 30 11:14:58 CEST 2024


Hi Andrea,

...
> +static inline int fchmodat2(
> +	int dfd, const char *filename, mode_t mode, int flags)
IMHO more consistent is:
static inline int fchmodat2(int dfd, const char *filename, mode_t mode, int flags)

But more important, you need to have as first two params: const char *file,
const int lineno, e.g.:

#define SAFE_FCHMODAT2(path, mode) \
	safe_access(__FILE__, __LINE__, (filename), (mode), (flags))

static inline int fchmodat2(const char *file, const int lineno, int dfd, const
	    char *filename, mode_t mode, int flags)
{
...
#

This way instead of this:
../../../../include/lapi/stat.h:239: TBROK: fchmodat2(3,symlink,416,256) error: EOPNOTSUPP (95)
we get file and line of the test (common approach, see lib/tst_safe_macros.c
include/tst_safe_macros.h).

Kind regards,
Petr

> +{
> +	int ret;
> +
> +	ret = tst_syscall(__NR_fchmodat2, dfd, filename, mode, flags);
> +	if (ret == -1)
> +		tst_brk(TBROK | TERRNO, "%s(%d,%s,%d,%d) error",
> +			__func__, dfd, filename, mode, flags);
> +
> +	return ret;
> +}


More information about the ltp mailing list