]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Linux: Assume and consolidate bind wire-up syscall
authorAdhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Wed, 19 Oct 2022 22:14:21 +0000 (19:14 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 7 Dec 2022 16:42:05 +0000 (13:42 -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/bind.c
sysdeps/unix/sysv/linux/generic/syscalls.list
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 83992a5dbda6d7be2da164dee77dd9ad7bde81bf..97a42c497fa21e796791a9cd29fd686803736fcf 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
 __bind (int fd, __CONST_SOCKADDR_ARG addr, socklen_t len)
 {
 #ifdef __ASSUME_BIND_SYSCALL
-  return INLINE_SYSCALL (bind, 3, fd, addr.__sockaddr__, len);
+  return INLINE_SYSCALL_CALL (bind, fd, addr.__sockaddr__, len);
 #else
   return SOCKETCALL (bind, fd, addr.__sockaddr__, len, 0, 0, 0);
 #endif
index f573f27c8bd385190fd41a18bbbf04b128453443..889b62bbea7f4d5ba898beaa8bcad8b32b8dce98 100644 (file)
@@ -3,7 +3,6 @@
 # Socket APIs
 socket         -       socket          i:iii   __socket        socket
 socketpair     -       socketpair      i:iiif  __socketpair    socketpair
-bind           -       bind            i:ipi   __bind          bind
 listen         -       listen          i:ii    __listen        listen
 getsockname    -       getsockname     i:ipp   __getsockname   getsockname
 getpeername    -       getpeername     i:ipp   __getpeername   getpeername
index 87d610cd6668811ddd3a5a44ecce925670041d38..babb0ff83d02bd68873a6372b39f96705660d38d 100644 (file)
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_BIND_SYSCALL               1
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
@@ -41,6 +40,7 @@
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
+# undef __ASSUME_BIND_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
index 74adc3956b4e2ebb9a5caf1f07b86a47cf845117..3dc93f5b11317e9ab80a707b243c7633b4f0bf0a 100644 (file)
@@ -79,6 +79,7 @@
 #define __ASSUME_SENDMMSG_SYSCALL      1
 #define __ASSUME_GETSOCKOPT_SYSCALL    1
 #define __ASSUME_SETSOCKOPT_SYSCALL    1
+#define __ASSUME_BIND_SYSCALL          1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
index d807ac9cfdfc2c8281f7a2b87884c28784b8cd4f..37209378b9809c2ea4aeb7ea90a2ef8102960b02 100644 (file)
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_BIND_SYSCALL               1
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
@@ -43,6 +42,7 @@
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
+# undef __ASSUME_BIND_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
index 8ae3cdcd963cce989c60780356d564aaa4f1e83c..7fff6dd9021554db1e526ca6b36a0e369aa09d39 100644 (file)
@@ -19,7 +19,6 @@
 
 /* All supported kernel versions for MicroBlaze have these syscalls.  */
 #define __ASSUME_SOCKET_SYSCALL                1
-#define __ASSUME_BIND_SYSCALL          1
 #define __ASSUME_CONNECT_SYSCALL       1
 #define __ASSUME_LISTEN_SYSCALL                1
 #define __ASSUME_GETSOCKNAME_SYSCALL   1
index 894f29d3816a1ee2d238c6ebbe70543fc789693b..af4555bb1d9915a517766e055a483d17de41ab41 100644 (file)
@@ -19,7 +19,6 @@
 
 /* New syscalls added for PowerPC in 2.6.37.  */
 #define __ASSUME_SOCKET_SYSCALL        1
-#define __ASSUME_BIND_SYSCALL          1
 #define __ASSUME_CONNECT_SYSCALL       1
 #define __ASSUME_LISTEN_SYSCALL                1
 #define __ASSUME_GETSOCKNAME_SYSCALL   1
index a457c84ba1916f5b4b2d9aa2605573527bf23be1..ae8dc626b255fac662541244483493d005bb0ea0 100644 (file)
@@ -21,7 +21,6 @@
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_SOCKET_SYSCALL             1
 # define __ASSUME_SOCKETPAIR_SYSCALL         1
-# define __ASSUME_BIND_SYSCALL               1
 # define __ASSUME_LISTEN_SYSCALL             1
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
@@ -43,6 +42,7 @@
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
+# undef __ASSUME_BIND_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
index 545bef40fd43fb6f88501b9b5b8c0921a247c470..2883da92b29fd8fbecb789c200e6a47cd7969e57 100644 (file)
@@ -24,7 +24,6 @@
 
 /* These syscalls were added for SH in 2.6.37.  */
 #define __ASSUME_SOCKET_SYSCALL                1
-#define __ASSUME_BIND_SYSCALL          1
 #define __ASSUME_CONNECT_SYSCALL       1
 #define __ASSUME_LISTEN_SYSCALL                1
 #define __ASSUME_GETSOCKNAME_SYSCALL   1
index 6cbe189b2f116eb9517ac4c127c34c64a6d8469a..2b7056c0fb83b6dc6193212a79072bdd6143eb22 100644 (file)
 
 /* These syscalls were added for both 32-bit and 64-bit in 4.4.  */
 #if __LINUX_KERNEL_VERSION >= 0x040400
-# define __ASSUME_BIND_SYSCALL               1
 # define __ASSUME_LISTEN_SYSCALL             1
 #endif
 
+#if __LINUX_KERNEL_VERSION < 0x040400
+# undef __ASSUME_BIND_SYSCALL
+#endif
+
 #ifdef __arch64__
 /* sparc64 defines __NR_pause,  however it is not supported (ENOSYS).
    Undefine so pause.c can use a correct alternative.  */