[LTP] [PATCH 1/3] include/faccessat.h: Add header file faccessat.h

Cyril Hrubis chrubis@suse.cz
Thu Aug 10 16:29:09 CEST 2023


Hi!
> Signed-off-by: Yang Xu <xuyang2018.jy@fujitsu.com>
> ---
>  include/lapi/faccessat.h | 21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
>  create mode 100644 include/lapi/faccessat.h
> 
> diff --git a/include/lapi/faccessat.h b/include/lapi/faccessat.h
> new file mode 100644
> index 000000000..f3318fd7a
> --- /dev/null
> +++ b/include/lapi/faccessat.h
> @@ -0,0 +1,21 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (c) 2023 FUJITSU LIMITED. All rights reserved.
> + * Copyright (c) Linux Test Project, 2003-2023
> + * Author: Yang Xu <xuyang2018.jy@fujitsu.com>
> + */
> +
> +#ifndef FACCESSAT_H
> +#define FACCESSAT_H
> +
> +#include <sys/types.h>
> +#include "lapi/syscalls.h"
> +
> +#ifndef HAVE_FACCESSAT
> +int faccessat(int dirfd, const char *pathname, int mode, int flags)
> +{
> +	return tst_syscall(__NR_faccessat, dirfd, pathname, mode, flags);
> +}
> +#endif

I guess that this will not work without:

diff --git a/configure.ac b/configure.ac
index e4aa2cadf..7beca3d9f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -92,6 +92,7 @@ AC_CHECK_FUNCS_ONCE([ \
     epoll_pwait \
     epoll_pwait2 \
     execveat \
+    faccessat \
     fallocate \
     fchownat \
     fsconfig \


However looking at man faccessat, it was added into glibc 2.10 and since
the oldest glibc we support is 2.17 (see
doc/supported-kernel-libc-versions.txt) we can as well completely drop
this fallback definition.

-- 
Cyril Hrubis
chrubis@suse.cz


More information about the ltp mailing list