[12/26] Linux: Clean up preadv, pwritev system call names

Message ID 73e1a225ad623b0dff1bdd99574030bbe32a16a8.1581279333.git.fweimer@redhat.com
State New
Headers show
Series
  • Linux cleanups enabled by built-in system call tables
Related show

Commit Message

Florian Weimer Feb. 9, 2020, 8:20 p.m.
The names __NR_preadv64, __NR_pwritev64 appear to be a glibc invention.
With the built-in tables, __NR_preadv and __NR_pwritev are always defined.
---
 sysdeps/unix/sysv/linux/preadv.c    |  6 ------
 sysdeps/unix/sysv/linux/preadv64.c  | 10 ++--------
 sysdeps/unix/sysv/linux/pwritev.c   |  6 ------
 sysdeps/unix/sysv/linux/pwritev64.c | 10 ++--------
 4 files changed, 4 insertions(+), 28 deletions(-)

-- 
2.24.1

Comments

Adhemerval Zanella Feb. 27, 2020, 11:19 p.m. | #1
On 09/02/2020 17:20, Florian Weimer wrote:
> The names __NR_preadv64, __NR_pwritev64 appear to be a glibc invention.

> With the built-in tables, __NR_preadv and __NR_pwritev are always defined.


LGTM, thanks. 

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


> ---

>  sysdeps/unix/sysv/linux/preadv.c    |  6 ------

>  sysdeps/unix/sysv/linux/preadv64.c  | 10 ++--------

>  sysdeps/unix/sysv/linux/pwritev.c   |  6 ------

>  sysdeps/unix/sysv/linux/pwritev64.c | 10 ++--------

>  4 files changed, 4 insertions(+), 28 deletions(-)

> 

> diff --git a/sysdeps/unix/sysv/linux/preadv.c b/sysdeps/unix/sysv/linux/preadv.c

> index 2a55d8c142..9fccb917a1 100644

> --- a/sysdeps/unix/sysv/linux/preadv.c

> +++ b/sysdeps/unix/sysv/linux/preadv.c

> @@ -22,10 +22,6 @@

>  

>  # ifdef __ASSUME_PREADV

>  

> -#  ifndef __NR_preadv

> -#   define __NR_preadv __NR_preadv64

> -#  endif

> -

>  ssize_t

>  preadv (int fd, const struct iovec *vector, int count, off_t offset)

>  {


Ok.

> @@ -37,12 +33,10 @@ static ssize_t __atomic_preadv_replacement (int, const struct iovec *,

>  ssize_t

>  preadv (int fd, const struct iovec *vector, int count, off_t offset)

>  {

> -#  ifdef __NR_preadv

>    ssize_t result = SYSCALL_CANCEL (preadv, fd, vector, count,

>  				   LO_HI_LONG (offset));

>    if (result >= 0 || errno != ENOSYS)

>      return result;

> -#  endif

>    return __atomic_preadv_replacement (fd, vector, count, offset);

>  }

>  #  define PREADV static __atomic_preadv_replacement


Ok.

> diff --git a/sysdeps/unix/sysv/linux/preadv64.c b/sysdeps/unix/sysv/linux/preadv64.c

> index fb471f0d9d..9fe43522a5 100644

> --- a/sysdeps/unix/sysv/linux/preadv64.c

> +++ b/sysdeps/unix/sysv/linux/preadv64.c

> @@ -20,14 +20,10 @@

>  

>  #ifdef __ASSUME_PREADV

>  

> -# ifndef __NR_preadv64

> -#  define __NR_preadv64 __NR_preadv

> -# endif

> -

>  ssize_t

>  preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)

>  {

> -  return SYSCALL_CANCEL (preadv64, fd, vector, count, LO_HI_LONG (offset));

> +  return SYSCALL_CANCEL (preadv, fd, vector, count, LO_HI_LONG (offset));

>  }

>  #else

>  static ssize_t __atomic_preadv64_replacement (int, const struct iovec *,


Ok.

> @@ -35,12 +31,10 @@ static ssize_t __atomic_preadv64_replacement (int, const struct iovec *,

>  ssize_t

>  preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)

>  {

> -#ifdef __NR_preadv64

> -  ssize_t result = SYSCALL_CANCEL (preadv64, fd, vector, count,

> +  ssize_t result = SYSCALL_CANCEL (preadv, fd, vector, count,

>  				   LO_HI_LONG (offset));

>    if (result >= 0 || errno != ENOSYS)

>      return result;

> -#endif

>    return __atomic_preadv64_replacement (fd, vector, count, offset);

>  }

>  # define PREADV static __atomic_preadv64_replacement


Ok.

> diff --git a/sysdeps/unix/sysv/linux/pwritev.c b/sysdeps/unix/sysv/linux/pwritev.c

> index 7abe47be06..d6cb3c8d5c 100644

> --- a/sysdeps/unix/sysv/linux/pwritev.c

> +++ b/sysdeps/unix/sysv/linux/pwritev.c

> @@ -22,10 +22,6 @@

>  

>  # ifdef __ASSUME_PREADV

>  

> -#  ifndef __NR_pwritev

> -#   define __NR_pwritev __NR_pwritev64

> -#  endif

> -

>  ssize_t

>  pwritev (int fd, const struct iovec *vector, int count, off_t offset)

>  {


Ok.

> @@ -37,12 +33,10 @@ static ssize_t __atomic_pwritev_replacement (int, const struct iovec *,

>  ssize_t

>  pwritev (int fd, const struct iovec *vector, int count, off_t offset)

>  {

> -#  ifdef __NR_pwritev

>    ssize_t result = SYSCALL_CANCEL (pwritev, fd, vector, count,

>  				   LO_HI_LONG (offset));

>    if (result >= 0 || errno != ENOSYS)

>      return result;

> -#  endif

>    return __atomic_pwritev_replacement (fd, vector, count, offset);

>  }

>  #  define PWRITEV static __atomic_pwritev_replacement


Ok.

> diff --git a/sysdeps/unix/sysv/linux/pwritev64.c b/sysdeps/unix/sysv/linux/pwritev64.c

> index 9bb0399c44..08bda27d4f 100644

> --- a/sysdeps/unix/sysv/linux/pwritev64.c

> +++ b/sysdeps/unix/sysv/linux/pwritev64.c

> @@ -20,14 +20,10 @@

>  

>  #ifdef __ASSUME_PWRITEV

>  

> -# ifndef __NR_pwritev64

> -#  define __NR_pwritev64 __NR_pwritev

> -# endif

> -

>  ssize_t

>  pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset)

>  {

> -  return SYSCALL_CANCEL (pwritev64, fd, vector, count, LO_HI_LONG (offset));

> +  return SYSCALL_CANCEL (pwritev, fd, vector, count, LO_HI_LONG (offset));

>  }

>  #else

>  static ssize_t __atomic_pwritev64_replacement (int, const struct iovec *,


Ok.

> @@ -35,12 +31,10 @@ static ssize_t __atomic_pwritev64_replacement (int, const struct iovec *,

>  ssize_t

>  pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset)

>  {

> -#ifdef __NR_pwritev64

> -  ssize_t result = SYSCALL_CANCEL (pwritev64, fd, vector, count,

> +  ssize_t result = SYSCALL_CANCEL (pwritev, fd, vector, count,

>  				   LO_HI_LONG (offset));

>    if (result >= 0 || errno != ENOSYS)

>      return result;

> -#endif

>    return __atomic_pwritev64_replacement (fd, vector, count, offset);

>  }

>  # define PWRITEV static __atomic_pwritev64_replacement

> 


Ok.

Patch

diff --git a/sysdeps/unix/sysv/linux/preadv.c b/sysdeps/unix/sysv/linux/preadv.c
index 2a55d8c142..9fccb917a1 100644
--- a/sysdeps/unix/sysv/linux/preadv.c
+++ b/sysdeps/unix/sysv/linux/preadv.c
@@ -22,10 +22,6 @@ 
 
 # ifdef __ASSUME_PREADV
 
-#  ifndef __NR_preadv
-#   define __NR_preadv __NR_preadv64
-#  endif
-
 ssize_t
 preadv (int fd, const struct iovec *vector, int count, off_t offset)
 {
@@ -37,12 +33,10 @@  static ssize_t __atomic_preadv_replacement (int, const struct iovec *,
 ssize_t
 preadv (int fd, const struct iovec *vector, int count, off_t offset)
 {
-#  ifdef __NR_preadv
   ssize_t result = SYSCALL_CANCEL (preadv, fd, vector, count,
 				   LO_HI_LONG (offset));
   if (result >= 0 || errno != ENOSYS)
     return result;
-#  endif
   return __atomic_preadv_replacement (fd, vector, count, offset);
 }
 #  define PREADV static __atomic_preadv_replacement
diff --git a/sysdeps/unix/sysv/linux/preadv64.c b/sysdeps/unix/sysv/linux/preadv64.c
index fb471f0d9d..9fe43522a5 100644
--- a/sysdeps/unix/sysv/linux/preadv64.c
+++ b/sysdeps/unix/sysv/linux/preadv64.c
@@ -20,14 +20,10 @@ 
 
 #ifdef __ASSUME_PREADV
 
-# ifndef __NR_preadv64
-#  define __NR_preadv64 __NR_preadv
-# endif
-
 ssize_t
 preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
 {
-  return SYSCALL_CANCEL (preadv64, fd, vector, count, LO_HI_LONG (offset));
+  return SYSCALL_CANCEL (preadv, fd, vector, count, LO_HI_LONG (offset));
 }
 #else
 static ssize_t __atomic_preadv64_replacement (int, const struct iovec *,
@@ -35,12 +31,10 @@  static ssize_t __atomic_preadv64_replacement (int, const struct iovec *,
 ssize_t
 preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
 {
-#ifdef __NR_preadv64
-  ssize_t result = SYSCALL_CANCEL (preadv64, fd, vector, count,
+  ssize_t result = SYSCALL_CANCEL (preadv, fd, vector, count,
 				   LO_HI_LONG (offset));
   if (result >= 0 || errno != ENOSYS)
     return result;
-#endif
   return __atomic_preadv64_replacement (fd, vector, count, offset);
 }
 # define PREADV static __atomic_preadv64_replacement
diff --git a/sysdeps/unix/sysv/linux/pwritev.c b/sysdeps/unix/sysv/linux/pwritev.c
index 7abe47be06..d6cb3c8d5c 100644
--- a/sysdeps/unix/sysv/linux/pwritev.c
+++ b/sysdeps/unix/sysv/linux/pwritev.c
@@ -22,10 +22,6 @@ 
 
 # ifdef __ASSUME_PREADV
 
-#  ifndef __NR_pwritev
-#   define __NR_pwritev __NR_pwritev64
-#  endif
-
 ssize_t
 pwritev (int fd, const struct iovec *vector, int count, off_t offset)
 {
@@ -37,12 +33,10 @@  static ssize_t __atomic_pwritev_replacement (int, const struct iovec *,
 ssize_t
 pwritev (int fd, const struct iovec *vector, int count, off_t offset)
 {
-#  ifdef __NR_pwritev
   ssize_t result = SYSCALL_CANCEL (pwritev, fd, vector, count,
 				   LO_HI_LONG (offset));
   if (result >= 0 || errno != ENOSYS)
     return result;
-#  endif
   return __atomic_pwritev_replacement (fd, vector, count, offset);
 }
 #  define PWRITEV static __atomic_pwritev_replacement
diff --git a/sysdeps/unix/sysv/linux/pwritev64.c b/sysdeps/unix/sysv/linux/pwritev64.c
index 9bb0399c44..08bda27d4f 100644
--- a/sysdeps/unix/sysv/linux/pwritev64.c
+++ b/sysdeps/unix/sysv/linux/pwritev64.c
@@ -20,14 +20,10 @@ 
 
 #ifdef __ASSUME_PWRITEV
 
-# ifndef __NR_pwritev64
-#  define __NR_pwritev64 __NR_pwritev
-# endif
-
 ssize_t
 pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset)
 {
-  return SYSCALL_CANCEL (pwritev64, fd, vector, count, LO_HI_LONG (offset));
+  return SYSCALL_CANCEL (pwritev, fd, vector, count, LO_HI_LONG (offset));
 }
 #else
 static ssize_t __atomic_pwritev64_replacement (int, const struct iovec *,
@@ -35,12 +31,10 @@  static ssize_t __atomic_pwritev64_replacement (int, const struct iovec *,
 ssize_t
 pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset)
 {
-#ifdef __NR_pwritev64
-  ssize_t result = SYSCALL_CANCEL (pwritev64, fd, vector, count,
+  ssize_t result = SYSCALL_CANCEL (pwritev, fd, vector, count,
 				   LO_HI_LONG (offset));
   if (result >= 0 || errno != ENOSYS)
     return result;
-#endif
   return __atomic_pwritev64_replacement (fd, vector, count, offset);
 }
 # define PWRITEV static __atomic_pwritev64_replacement