]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Linux: Assume and consolidate shutdown wire-up syscall
authorAdhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Wed, 19 Oct 2022 22:14:27 +0000 (19:14 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Wed, 7 Dec 2022 17:17:28 +0000 (14:17 -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/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/shutdown.c
sysdeps/unix/sysv/linux/sparc/kernel-features.h

index 706893f2454d21e3884eea8fd6b081b634d11d85..7dbfde0dae1dab4317a01ceccb3e08e3fc7a3057 100644 (file)
@@ -3,4 +3,3 @@
 # Socket APIs
 getsockname    -       getsockname     i:ipp   __getsockname   getsockname
 getpeername    -       getpeername     i:ipp   __getpeername   getpeername
-shutdown       -       shutdown        i:ii    __shutdown      shutdown
index a79ec679cc42a0fff8bace4d7c362b1c094ec43e..ddf9ec0e5f2fa2c8895d726825cf39ab33f96c4e 100644 (file)
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
-# define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
 #include_next <kernel-features.h>
 
 #undef __ASSUME_ACCEPT_SYSCALL
 
+/* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION < 0x040300
 # undef __ASSUME_ACCEPT4_SYSCALL
 # undef __ASSUME_SENDMSG_SYSCALL
@@ -41,6 +41,7 @@
 # undef __ASSUME_SOCKET_SYSCALL
 # undef __ASSUME_SOCKETPAIR_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
+# undef __ASSUME_SHUTDOWN_SYSCALL
 #endif
 
 /* i686 only supports ipc syscall before 5.1.  */
index d1769b2d9960e98e31373b90ace44b3ae3278da7..e63bd4b4fcd2d247842c6bda710a95df8c8f3e51 100644 (file)
@@ -83,6 +83,7 @@
 #define __ASSUME_SOCKET_SYSCALL                1
 #define __ASSUME_SOCKETPAIR_SYSCALL    1
 #define __ASSUME_LISTEN_SYSCALL                1
+#define __ASSUME_SHUTDOWN_SYSCALL      1
 
 /* Support for SysV IPC through wired syscalls.  All supported architectures
    either support ipc syscall and/or all the ipc correspondent syscalls.  */
index a65fa63c5e0abf2c222dc2eb1f48fed73433205c..55b8958fb28b04be0880a7e1e6bcb9dbee41aa55 100644 (file)
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
-# define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
 #include_next <kernel-features.h>
 
 #undef __ASSUME_ACCEPT_SYSCALL
 
+/* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION < 0x040300
 # undef __ASSUME_ACCEPT4_SYSCALL
 # undef __ASSUME_RECVMMSG_SYSCALL
@@ -43,6 +43,7 @@
 # undef __ASSUME_SOCKET_SYSCALL
 # undef __ASSUME_SOCKETPAIR_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
+# undef __ASSUME_SHUTDOWN_SYSCALL
 #endif
 
 /* No support for PI futexes or robust mutexes before 3.10 for m68k.  */
index e19e6bb6ba8d5629786e146fb3acb940971e810f..9ee6c621eefd8458cd0d020e1185ffb0c63a5f89 100644 (file)
@@ -23,7 +23,6 @@
 #define __ASSUME_GETPEERNAME_SYSCALL   1
 #define __ASSUME_SEND_SYSCALL          1
 #define __ASSUME_RECV_SYSCALL          1
-#define __ASSUME_SHUTDOWN_SYSCALL      1
 
 #include_next <kernel-features.h>
 
index eb73a91a5da4e6cd6898830fb1c55268300a810b..ad9eb340b59c260c3033757def45d0bacceb725f 100644 (file)
@@ -23,7 +23,6 @@
 #define __ASSUME_GETPEERNAME_SYSCALL   1
 #define __ASSUME_SEND_SYSCALL          1
 #define __ASSUME_RECV_SYSCALL          1
-#define __ASSUME_SHUTDOWN_SYSCALL      1
 
 /* Define this if your 32-bit syscall API requires 64-bit register
    pairs to start with an even-number register.  */
index 3daee3f13212836405c93d4f65aa047daffb4e8a..e47c628f51d97f734cd0af1c22e409c50a7e0e40 100644 (file)
 #if __LINUX_KERNEL_VERSION >= 0x040300
 # define __ASSUME_GETSOCKNAME_SYSCALL        1
 # define __ASSUME_GETPEERNAME_SYSCALL        1
-# define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
 #include_next <kernel-features.h>
 
 #undef __ASSUME_ACCEPT_SYSCALL
 
+/* Direct socketcalls available with kernel 4.3.  */
 #if __LINUX_KERNEL_VERSION < 0x040300
 # undef __ASSUME_ACCEPT4_SYSCALL
 # undef __ASSUME_RECVMMSG_SYSCALL
@@ -43,6 +43,7 @@
 # undef __ASSUME_SOCKET_SYSCALL
 # undef __ASSUME_SOCKETPAIR_SYSCALL
 # undef __ASSUME_LISTEN_SYSCALL
+# undef __ASSUME_SHUTDOWN_SYSCALL
 #endif
 
 /* s390 only supports ipc syscall before 5.1.  */
index 23eadf84e07f34e0c27e80ff7a5cff01cc783a08..0ab656d58e4a4df0b8185b45e8b2a0fd7cb49ba9 100644 (file)
@@ -28,7 +28,6 @@
 #define __ASSUME_GETPEERNAME_SYSCALL   1
 #define __ASSUME_SEND_SYSCALL          1
 #define __ASSUME_RECV_SYSCALL          1
-#define __ASSUME_SHUTDOWN_SYSCALL      1
 
 #include_next <kernel-features.h>
 
index 26772c9b2842c4e87540874cbe35215c62ce5121..4cee357b9b1c1e4afd598b7983380c1e7399bcaa 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
 __shutdown (int fd, int how)
 {
 #ifdef __ASSUME_SHUTDOWN_SYSCALL
-  return INLINE_SYSCALL (shutdown, 2, fd, how);
+  return INLINE_SYSCALL_CALL (shutdown, fd, how);
 #else
   return SOCKETCALL (shutdown, fd, how);
 #endif
index 7070aaa1aeb099ada2c16f6d033bf626463dc8c5..12e98a9f9524df8b4daff2ffa92bc77c8cc9c769 100644 (file)
@@ -40,8 +40,6 @@
 # undef __ASSUME_SENDTO_SYSCALL
 # undef __ASSUME_GETSOCKOPT_SYSCALL
 # undef __ASSUME_SETSOCKOPT_SYSCALL
-#else
-# define __ASSUME_SHUTDOWN_SYSCALL           1
 #endif
 
 /* These syscalls were added for both 32-bit and 64-bit in 4.4.  */