diff mbox series

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

Message ID 1691208482-5464-1-git-send-email-xuyang2018.jy@fujitsu.com
State Changes Requested
Headers show
Series [1/3] include/faccessat.h: Add header file faccessat.h | expand

Commit Message

Yang Xu \(Fujitsu\) Aug. 5, 2023, 4:07 a.m. UTC
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

Comments

Cyril Hrubis Aug. 10, 2023, 2:29 p.m. UTC | #1
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.
Yang Xu \(Fujitsu\) Aug. 21, 2023, 11:26 a.m. UTC | #2
Hi Cyril

> 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.
> 

I agree with your suggestion, and I will remove faccessat.h in the v2 
version. After this is merged, I will also drop those unnecessary 
fallback definition.
diff mbox series

Patch

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
+
+#endif /* FACCESSAT_H */