public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] Linux: Assume and consolidate shutdown wire-up syscall
@ 2022-12-07 19:16 Adhemerval Zanella
  0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2022-12-07 19:16 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=127945c561535be3975d418fa8f85334a76c298c

commit 127945c561535be3975d418fa8f85334a76c298c
Author: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
Date:   Wed Oct 19 19:14:27 2022 -0300

    Linux: Assume and consolidate shutdown wire-up syscall
    
    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>

Diff:
---
 sysdeps/unix/sysv/linux/generic/syscalls.list        | 1 -
 sysdeps/unix/sysv/linux/i386/kernel-features.h       | 3 ++-
 sysdeps/unix/sysv/linux/kernel-features.h            | 1 +
 sysdeps/unix/sysv/linux/m68k/kernel-features.h       | 3 ++-
 sysdeps/unix/sysv/linux/microblaze/kernel-features.h | 1 -
 sysdeps/unix/sysv/linux/powerpc/kernel-features.h    | 1 -
 sysdeps/unix/sysv/linux/s390/kernel-features.h       | 3 ++-
 sysdeps/unix/sysv/linux/sh/kernel-features.h         | 1 -
 sysdeps/unix/sysv/linux/shutdown.c                   | 7 +------
 sysdeps/unix/sysv/linux/sparc/kernel-features.h      | 2 --
 10 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/generic/syscalls.list b/sysdeps/unix/sysv/linux/generic/syscalls.list
index 706893f245..7dbfde0dae 100644
--- a/sysdeps/unix/sysv/linux/generic/syscalls.list
+++ b/sysdeps/unix/sysv/linux/generic/syscalls.list
@@ -3,4 +3,3 @@
 # Socket APIs
 getsockname	-	getsockname	i:ipp	__getsockname	getsockname
 getpeername	-	getpeername	i:ipp	__getpeername	getpeername
-shutdown	-	shutdown	i:ii	__shutdown	shutdown
diff --git a/sysdeps/unix/sysv/linux/i386/kernel-features.h b/sysdeps/unix/sysv/linux/i386/kernel-features.h
index a79ec679cc..ddf9ec0e5f 100644
--- a/sysdeps/unix/sysv/linux/i386/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/i386/kernel-features.h
@@ -21,13 +21,13 @@
 #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.  */
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index d1769b2d99..e63bd4b4fc 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -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.  */
diff --git a/sysdeps/unix/sysv/linux/m68k/kernel-features.h b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
index a65fa63c5e..55b8958fb2 100644
--- a/sysdeps/unix/sysv/linux/m68k/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/m68k/kernel-features.h
@@ -21,13 +21,13 @@
 #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.  */
diff --git a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
index e19e6bb6ba..9ee6c621ee 100644
--- a/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/microblaze/kernel-features.h
@@ -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>
 
diff --git a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
index eb73a91a5d..ad9eb340b5 100644
--- a/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/powerpc/kernel-features.h
@@ -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.  */
diff --git a/sysdeps/unix/sysv/linux/s390/kernel-features.h b/sysdeps/unix/sysv/linux/s390/kernel-features.h
index 3daee3f132..e47c628f51 100644
--- a/sysdeps/unix/sysv/linux/s390/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/s390/kernel-features.h
@@ -21,13 +21,13 @@
 #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.  */
diff --git a/sysdeps/unix/sysv/linux/sh/kernel-features.h b/sysdeps/unix/sysv/linux/sh/kernel-features.h
index 23eadf84e0..0ab656d58e 100644
--- a/sysdeps/unix/sysv/linux/sh/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sh/kernel-features.h
@@ -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>
 
diff --git a/sysdeps/unix/sysv/linux/shutdown.c b/sysdeps/unix/sysv/linux/shutdown.c
index 26772c9b28..4cee357b9b 100644
--- a/sysdeps/unix/sysv/linux/shutdown.c
+++ b/sysdeps/unix/sysv/linux/shutdown.c
@@ -15,19 +15,14 @@
    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
diff --git a/sysdeps/unix/sysv/linux/sparc/kernel-features.h b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
index 7070aaa1ae..12e98a9f95 100644
--- a/sysdeps/unix/sysv/linux/sparc/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/sparc/kernel-features.h
@@ -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.  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-07 19:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-07 19:16 [glibc] Linux: Assume and consolidate shutdown wire-up syscall Adhemerval Zanella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).