]> sourceware.org Git - glibc.git/commitdiff
Linux: Assume and consolidate getsockname wire-up syscall
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 18 Oct 2022 19:28:44 +0000 (16:28 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 20 Feb 2023 13:20:37 +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
sysdeps/unix/sysv/linux/getsockname.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

index 7dbfde0dae1dab4317a01ceccb3e08e3fc7a3057..e89ce91ac0bab5a3620f15570a6dedb0a5cc5728 100644 (file)
@@ -1,5 +1,4 @@
 # File name    Caller  Syscall name    # args  Strong name     Weak names
 
 # Socket APIs
-getsockname    -       getsockname     i:ipp   __getsockname   getsockname
 getpeername    -       getpeername     i:ipp   __getpeername   getpeername
index 38e6f2dac6f8cec3c28dfa6227012e46df88fcbb..61973fa5cd7bb09a374246c34a383a109afcc7ad 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
 __getsockname (int fd, __SOCKADDR_ARG addr, socklen_t *len)
 {
 #ifdef __ASSUME_GETSOCKNAME_SYSCALL
-  return INLINE_SYSCALL (getsockname, 3, fd, addr.__sockaddr__, len);
+  return INLINE_SYSCALL_CALL (getsockname, fd, addr.__sockaddr__, len);
 #else
   return SOCKETCALL (getsockname, fd, addr.__sockaddr__, len);
 #endif
index 334a31a0e509a4c125233dfb76b935487a444fd3..1c5cbd335152a3edf42ffee5c151de7ad6c2aa70 100644 (file)
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
 #endif
 
@@ -42,6 +41,7 @@
 # undef __ASSUME_SOCKETPAIR_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_SHUTDOWN_SYSCALL
+# undef __ASSUME_GETSOCKNAME_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
index 4b5c4afbc141a6a18956cac06618acc3c99afe0f..4a4d624aeb2945a0e1275b25a8a6be2bfcd962c3 100644 (file)
@@ -84,6 +84,7 @@
 #define __ASSUME_SOCKETPAIR_SYSCALL    1
 #define __ASSUME_LISTEN_SYSCALL                1
 #define __ASSUME_SHUTDOWN_SYSCALL      1
+#define __ASSUME_GETSOCKNAME_SYSCALL   1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
index 2d9b225249428df669de042c6460a818ea0271f4..e57f09a74e2bea27a8cc0085f8d2b83a9e0577d7 100644 (file)
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
 #endif
 
@@ -44,6 +43,7 @@
 # undef __ASSUME_SOCKETPAIR_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_SHUTDOWN_SYSCALL
+# undef __ASSUME_GETSOCKNAME_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
index e5bfa05491e0082061574decec743ffc824f24ec..10eff5674368a6242efb3834ade7ecc530f5f1b4 100644 (file)
@@ -19,7 +19,6 @@
 
 /* All supported kernel versions for MicroBlaze have these syscalls.  */
 #define __ASSUME_CONNECT_SYSCALL       1
-#define __ASSUME_GETSOCKNAME_SYSCALL   1
 #define __ASSUME_GETPEERNAME_SYSCALL   1
 #define __ASSUME_SEND_SYSCALL          1
 #define __ASSUME_RECV_SYSCALL          1
index 2b3cbd05c187df9a498c7fb4c6f62678a7461325..231742a5c3f1975e6dff46e623fc09bd19ebc2d7 100644 (file)
@@ -19,7 +19,6 @@
 
 /* New syscalls added for PowerPC in 2.6.37.  */
 #define __ASSUME_CONNECT_SYSCALL       1
-#define __ASSUME_GETSOCKNAME_SYSCALL   1
 #define __ASSUME_GETPEERNAME_SYSCALL   1
 #define __ASSUME_SEND_SYSCALL          1
 #define __ASSUME_RECV_SYSCALL          1
index 7ca9393942b0339825ba1449173f78b000d95490..058b211e551e615464bc70017ef34522dcfd3e8f 100644 (file)
@@ -19,7 +19,6 @@
 
 /* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION >= 0x040300
-# define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
 #endif
 
@@ -44,6 +43,7 @@
 # undef __ASSUME_SOCKETPAIR_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
 # undef __ASSUME_SHUTDOWN_SYSCALL
+# undef __ASSUME_GETSOCKNAME_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
index 931f1c883497f7d5511ff5747aa06587f5a43bd8..76e2de7bf50aa113156d672d2e72ce80e110f223 100644 (file)
@@ -24,7 +24,6 @@
 
 /* These syscalls were added for SH in 2.6.37.  */
 #define __ASSUME_CONNECT_SYSCALL       1
-#define __ASSUME_GETSOCKNAME_SYSCALL   1
 #define __ASSUME_GETPEERNAME_SYSCALL   1
 #define __ASSUME_SEND_SYSCALL          1
 #define __ASSUME_RECV_SYSCALL          1
index 279fa93a3b3e0eb186b6fa7d7f88e65704cc4449..f71aa8ca3857471e7304530a4e4525870262b511 100644 (file)
 # undef __ASSUME_SETSOCKOPT_SYSCALL
 #endif
 
+/* There syscalls were added for 32-bit in compat syscall table only
+   in 4.20 (but present for 64-bit in all supported kernel versions).  */
+#if !defined __arch64__ && __LINUX_KERNEL_VERSION < 0x041400
+# undef __ASSUME_GETSOCKNAME_SYSCALL
+#endif
+
 /* These syscalls were added for both 32-bit and 64-bit in 4.4.  */
 #if __LINUX_KERNEL_VERSION < 0x040400
 # undef __ASSUME_BIND_SYSCALL
This page took 0.055066 seconds and 5 git commands to generate.