]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Linux: Assume and consolidate getpeername wire-up syscall
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 18 Oct 2022 19:29:48 +0000 (16:29 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 20 Feb 2023 13:20:44 +0000 (10:20 -0300)
And disable if kernel does not support it.

Checked on x86_64-linux-gnu and i686-linux-gnu.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Carlos O'Donell <carlos@redhat.com>
sysdeps/unix/sysv/linux/generic/syscalls.list [deleted file]
sysdeps/unix/sysv/linux/getpeername.c
sysdeps/unix/sysv/linux/i386/kernel-features.h
sysdeps/unix/sysv/linux/kernel-features.h
sysdeps/unix/sysv/linux/m68k/kernel-features.h
sysdeps/unix/sysv/linux/microblaze/kernel-features.h
sysdeps/unix/sysv/linux/powerpc/kernel-features.h
sysdeps/unix/sysv/linux/s390/kernel-features.h
sysdeps/unix/sysv/linux/sh/kernel-features.h
sysdeps/unix/sysv/linux/sparc/kernel-features.h

diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
deleted file mode 100644 (file)
index e89ce91..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# File name    Caller  Syscall name    # args  Strong name     Weak names
-
-# Socket APIs
-getpeername    -       getpeername     i:ipp   __getpeername   getpeername
index eb49d40d3a7509eb3ab954d8474acfc5944d059b..827fd631dc20dd84640e327f25ca0de2904799b8 100644 (file)
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-#include <errno.h>
-#include <signal.h>
 #include <sys/socket.h>
-
 #include <socketcall.h>
-#include <kernel-features.h>
-#include <sys/syscall.h>
 
 int
 __getpeername (int fd, __SOCKADDR_ARG addr, socklen_t *len)
 {
 #ifdef __ASSUME_GETPEERNAME_SYSCALL
-  return INLINE_SYSCALL (getpeername, 3, fd, addr.__sockaddr__, len);
+  return INLINE_SYSCALL_CALL (getpeername, fd, addr.__sockaddr__, len);
 #else
   return SOCKETCALL (getpeername, fd, addr.__sockaddr__, len);
 #endif
index 1c5cbd335152a3edf42ffee5c151de7ad6c2aa70..ed7efa30979ef12b887fb235edde3b65c9f86597 100644 (file)
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* Direct socketcalls available with kernel 4.3.  */
-#if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_GETPEERNAME_SYSCALL        1
-#endif
-
 #include_next <kernel-features.h>
 
 #undef __ASSUME_ACCEPT_SYSCALL
@@ -42,6 +37,7 @@
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_SHUTDOWN_SYSCALL
 # undef __ASSUME_GETSOCKNAME_SYSCALL
+# undef __ASSUME_GETPEERNAME_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
index 4a4d624aeb2945a0e1275b25a8a6be2bfcd962c3..07b440f4eea364b05fa49bf71ceebf78f80efe13 100644 (file)
@@ -85,6 +85,7 @@
 #define __ASSUME_LISTEN_SYSCALL                1
 #define __ASSUME_SHUTDOWN_SYSCALL      1
 #define __ASSUME_GETSOCKNAME_SYSCALL   1
+#define __ASSUME_GETPEERNAME_SYSCALL   1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
index e57f09a74e2bea27a8cc0085f8d2b83a9e0577d7..d0155783b7f77ae5ed1b5eef7507c07ea412f92a 100644 (file)
    License along with the GNU C Library.  If not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* Direct socketcalls available with kernel 4.3.  */
-#if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_GETPEERNAME_SYSCALL        1
-#endif
-
 #include_next <kernel-features.h>
 
 #undef __ASSUME_ACCEPT_SYSCALL
@@ -44,6 +39,7 @@
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_SHUTDOWN_SYSCALL
 # undef __ASSUME_GETSOCKNAME_SYSCALL
+# undef __ASSUME_GETPEERNAME_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
index 10eff5674368a6242efb3834ade7ecc530f5f1b4..3d6270b633aef5f00357432da9d12cb0360017ca 100644 (file)
@@ -19,7 +19,6 @@
 
 /* All supported kernel versions for MicroBlaze have these syscalls.  */
 #define __ASSUME_CONNECT_SYSCALL       1
-#define __ASSUME_GETPEERNAME_SYSCALL   1
 #define __ASSUME_SEND_SYSCALL          1
 #define __ASSUME_RECV_SYSCALL          1
 
index 231742a5c3f1975e6dff46e623fc09bd19ebc2d7..e092d3bd24082f8caa8561af0a19e0d584fb5a93 100644 (file)
@@ -19,7 +19,6 @@
 
 /* New syscalls added for PowerPC in 2.6.37.  */
 #define __ASSUME_CONNECT_SYSCALL       1
-#define __ASSUME_GETPEERNAME_SYSCALL   1
 #define __ASSUME_SEND_SYSCALL          1
 #define __ASSUME_RECV_SYSCALL          1
 
index 058b211e551e615464bc70017ef34522dcfd3e8f..fb87a57a15391bb6a983bd18997bdc6ffc90346b 100644 (file)
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* Direct socketcalls available with kernel 4.3.  */
-#if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_GETPEERNAME_SYSCALL        1
-#endif
-
 #include_next <kernel-features.h>
 
 #undef __ASSUME_ACCEPT_SYSCALL
@@ -44,6 +39,7 @@
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_SHUTDOWN_SYSCALL
 # undef __ASSUME_GETSOCKNAME_SYSCALL
+# undef __ASSUME_GETPEERNAME_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
index 76e2de7bf50aa113156d672d2e72ce80e110f223..953fa8dff010a34efd452f2bf0c731809ace61dc 100644 (file)
@@ -24,7 +24,6 @@
 
 /* These syscalls were added for SH in 2.6.37.  */
 #define __ASSUME_CONNECT_SYSCALL       1
-#define __ASSUME_GETPEERNAME_SYSCALL   1
 #define __ASSUME_SEND_SYSCALL          1
 #define __ASSUME_RECV_SYSCALL          1
 
index f71aa8ca3857471e7304530a4e4525870262b511..98c938c16d9e48b2430a2240a95d8d970a7c95a8 100644 (file)
@@ -46,6 +46,7 @@
    in 4.20 (but present for 64-bit in all supported kernel versions).  */
 #if !defined __arch64__ && __LINUX_KERNEL_VERSION < 0x041400
 # undef __ASSUME_GETSOCKNAME_SYSCALL
+# undef __ASSUME_GETPEERNAME_SYSCALL
 #endif
 
 /* These syscalls were added for both 32-bit and 64-bit in 4.4.  */