aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/accept4.c69
-rw-r--r--sysdeps/unix/sysv/linux/ia64/configure4
-rw-r--r--sysdeps/unix/sysv/linux/ia64/configure.ac4
-rw-r--r--sysdeps/unix/sysv/linux/ia64/kernel-features.h7
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h11
5 files changed, 18 insertions, 77 deletions
diff --git a/sysdeps/unix/sysv/linux/accept4.c b/sysdeps/unix/sysv/linux/accept4.c
index 53afd7a510..0592f43dd6 100644
--- a/sysdeps/unix/sysv/linux/accept4.c
+++ b/sysdeps/unix/sysv/linux/accept4.c
@@ -22,75 +22,20 @@
#include <sysdep-cancel.h>
#include <sys/syscall.h>
+#include <socketcall.h>
#include <kernel-features.h>
+int
+accept4 (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len, int flags)
+{
/* Do not use the accept4 syscall on socketcall architectures unless
it was added at the same time as the socketcall support or can be
assumed to be present. */
#if defined __ASSUME_SOCKETCALL \
&& !defined __ASSUME_ACCEPT4_SYSCALL_WITH_SOCKETCALL \
&& !defined __ASSUME_ACCEPT4_SYSCALL
-# undef __NR_accept4
-#endif
-
-#ifdef __NR_accept4
-int
-accept4 (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len, int flags)
-{
- return SYSCALL_CANCEL (accept4, fd, addr.__sockaddr__, addr_len, flags);
-}
-#elif defined __NR_socketcall
-# include <socketcall.h>
-# ifdef __ASSUME_ACCEPT4_SOCKETCALL
-int
-accept4 (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len, int flags)
-{
return SOCKETCALL_CANCEL (accept4, fd, addr.__sockaddr__, addr_len, flags);
-}
-# else
-static int have_accept4;
-
-int
-accept4 (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len, int flags)
-{
- if (__glibc_likely (have_accept4 >= 0))
- {
- int ret = SOCKETCALL_CANCEL (accept4, fd, addr.__sockaddr__, addr_len,
- flags);
- /* The kernel returns -EINVAL for unknown socket operations.
- We need to convert that error to an ENOSYS error. */
- if (__builtin_expect (ret < 0, 0)
- && have_accept4 == 0
- && errno == EINVAL)
- {
- /* Try another call, this time with the FLAGS parameter
- cleared and an invalid file descriptor. This call will not
- cause any harm and it will return immediately. */
- ret = SOCKETCALL_CANCEL (invalid, -1);
- if (errno == EINVAL)
- {
- have_accept4 = -1;
- __set_errno (ENOSYS);
- }
- else
- {
- have_accept4 = 1;
- __set_errno (EINVAL);
- }
- return -1;
- }
- return ret;
- }
- __set_errno (ENOSYS);
- return -1;
-}
-# endif /* __ASSUME_ACCEPT4_SOCKETCALL */
-#else /* __NR_socketcall */
-int
-accept4 (int fd, __SOCKADDR_ARG addr, socklen_t *addr_len, int flags)
-{
- __set_errno (ENOSYS);
- return -1;
-}
-stub_warning (accept4)
+#else
+ return SYSCALL_CANCEL (accept4, fd, addr.__sockaddr__, addr_len, flags);
#endif
+}
diff --git a/sysdeps/unix/sysv/linux/ia64/configure b/sysdeps/unix/sysv/linux/ia64/configure
index 1d4e5d18d6..3cf72371ef 100644
--- a/sysdeps/unix/sysv/linux/ia64/configure
+++ b/sysdeps/unix/sysv/linux/ia64/configure
@@ -2,3 +2,7 @@
# Local configure fragment for sysdeps/unix/sysv/linux/ia64
ldd_rewrite_script=$dir/ldd-rewrite.sed
+
+# First version with support for the accept4 system call.
+# Linux 3.3 includes it as well.
+arch_minimum_kernel=3.2.18
diff --git a/sysdeps/unix/sysv/linux/ia64/configure.ac b/sysdeps/unix/sysv/linux/ia64/configure.ac
index 4fb564721b..94a578c12d 100644
--- a/sysdeps/unix/sysv/linux/ia64/configure.ac
+++ b/sysdeps/unix/sysv/linux/ia64/configure.ac
@@ -2,3 +2,7 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
# Local configure fragment for sysdeps/unix/sysv/linux/ia64
ldd_rewrite_script=$dir/ldd-rewrite.sed
+
+# First version with support for the accept4 system call.
+# Linux 3.3 includes it as well.
+arch_minimum_kernel=3.2.18
diff --git a/sysdeps/unix/sysv/linux/ia64/kernel-features.h b/sysdeps/unix/sysv/linux/ia64/kernel-features.h
index ac9403e869..cda0ad6150 100644
--- a/sysdeps/unix/sysv/linux/ia64/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/ia64/kernel-features.h
@@ -22,13 +22,8 @@
#include_next <kernel-features.h>
-/* Support for the accept4 syscall was added in 3.3. */
-#if __LINUX_KERNEL_VERSION < 0x030300
-# undef __ASSUME_ACCEPT4_SYSCALL
-# undef __ASSUME_ACCEPT4
-#endif
-
#define __ASSUME_RECV_SYSCALL 1
#define __ASSUME_SEND_SYSCALL 1
+#define __ASSUME_ACCEPT4_SYSCALL 1
#endif /* _KERNEL_FEATURES_H */
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index fd936c5366..b981466f34 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -75,18 +75,11 @@
architectures using a separate syscall rather than socketcall that
syscall was only added later, and some architectures first had
socketcall support then a separate syscall. Define
- __ASSUME_ACCEPT4_SOCKETCALL if glibc uses socketcall on this
- architecture and accept4 is available through socketcall,
__ASSUME_ACCEPT4_SYSCALL if it is available through a separate
- syscall, __ASSUME_ACCEPT4_SYSCALL_WITH_SOCKETCALL if it became
+ syscall, and __ASSUME_ACCEPT4_SYSCALL_WITH_SOCKETCALL if it became
available through a separate syscall at the same time as through
- socketcall, and __ASSUME_ACCEPT4 if the accept4 function is known
- to work. */
-#ifdef __ASSUME_SOCKETCALL
-# define __ASSUME_ACCEPT4_SOCKETCALL 1
-#endif
+ socketcall. */
#define __ASSUME_ACCEPT4_SYSCALL 1
-#define __ASSUME_ACCEPT4 1
/* Support for the FUTEX_CLOCK_REALTIME flag was added in 2.6.29. */
#define __ASSUME_FUTEX_CLOCK_REALTIME 1