[06/26] Linux: statx syscall number is always available

Message ID acfb96832ad33b9e21e39c9a0e252e279f512dc5.1581279333.git.fweimer@redhat.com
State Committed
Delegated to: Carlos O'Donell
Headers

Commit Message

Florian Weimer Feb. 9, 2020, 8:20 p.m. UTC
  Due to the built-in tables, __NR_statx is always defined.
---
 sysdeps/unix/sysv/linux/statx.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
  

Comments

Adhemerval Zanella Feb. 27, 2020, 11:06 p.m. UTC | #1
On 09/02/2020 17:20, Florian Weimer wrote:
> Due to the built-in tables, __NR_statx is always defined.

LGTM, thanks. 

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>

> ---
>  sysdeps/unix/sysv/linux/statx.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/sysdeps/unix/sysv/linux/statx.c b/sysdeps/unix/sysv/linux/statx.c
> index a119b7a29e..9721fc12a5 100644
> --- a/sysdeps/unix/sysv/linux/statx.c
> +++ b/sysdeps/unix/sysv/linux/statx.c
> @@ -25,17 +25,14 @@ int
>  statx (int fd, const char *path, int flags,
>         unsigned int mask, struct statx *buf)
>  {
> -#ifdef __NR_statx
>    int ret = INLINE_SYSCALL_CALL (statx, fd, path, flags, mask, buf);
> -# ifdef __ASSUME_STATX
> +#ifdef __ASSUME_STATX
>    return ret;
> -# else
> +#else
>    if (ret == 0 || errno != ENOSYS)
>      /* Preserve non-error/non-ENOSYS return values.  */
>      return ret;
> -# endif
> -#endif
> -#ifndef __ASSUME_STATX
> -  return statx_generic (fd, path, flags, mask, buf);
> +  else
> +    return statx_generic (fd, path, flags, mask, buf);
>  #endif
>  }
>
  

Patch

diff --git a/sysdeps/unix/sysv/linux/statx.c b/sysdeps/unix/sysv/linux/statx.c
index a119b7a29e..9721fc12a5 100644
--- a/sysdeps/unix/sysv/linux/statx.c
+++ b/sysdeps/unix/sysv/linux/statx.c
@@ -25,17 +25,14 @@  int
 statx (int fd, const char *path, int flags,
        unsigned int mask, struct statx *buf)
 {
-#ifdef __NR_statx
   int ret = INLINE_SYSCALL_CALL (statx, fd, path, flags, mask, buf);
-# ifdef __ASSUME_STATX
+#ifdef __ASSUME_STATX
   return ret;
-# else
+#else
   if (ret == 0 || errno != ENOSYS)
     /* Preserve non-error/non-ENOSYS return values.  */
     return ret;
-# endif
-#endif
-#ifndef __ASSUME_STATX
-  return statx_generic (fd, path, flags, mask, buf);
+  else
+    return statx_generic (fd, path, flags, mask, buf);
 #endif
 }