aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/kernel-features.h7
-rw-r--r--sysdeps/unix/sysv/linux/readv.c13
-rw-r--r--sysdeps/unix/sysv/linux/writev.c16
3 files changed, 29 insertions, 7 deletions
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 29afe27..9053df1 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -462,6 +462,13 @@
# define __ASSUME_SET_ROBUST_LIST 1
#endif
+/* Pessimistically assume that 2.6.18 introduced real handling of
+ large numbers of requests to readv and writev and that we don't
+ need a fallback. It likely worked for much longer. */
+#if __LINUX_KERNEL_VERSION >= 0x020612
+# define __ASSUME_COMPLETE_READV_WRITEV 1
+#endif
+
/* Support for PI futexes was added in 2.6.18. */
#if __LINUX_KERNEL_VERSION >= 0x020612
# define __ASSUME_FUTEX_LOCK_PI 1
diff --git a/sysdeps/unix/sysv/linux/readv.c b/sysdeps/unix/sysv/linux/readv.c
index 250c00a..d12fa49 100644
--- a/sysdeps/unix/sysv/linux/readv.c
+++ b/sysdeps/unix/sysv/linux/readv.c
@@ -1,5 +1,5 @@
/* readv supports all Linux kernels >= 2.0.
- Copyright (C) 1997,1998,2000,2002,2003 Free Software Foundation, Inc.
+ Copyright (C) 1997,1998,2000,2002,2003,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -25,6 +25,7 @@
#include <sysdep-cancel.h>
#include <sys/syscall.h>
#include <bp-checks.h>
+#include <kernel-features.h>
static ssize_t __atomic_readv_replacement (int, __const struct iovec *,
int) internal_function;
@@ -45,10 +46,14 @@ do_readv (int fd, const struct iovec *vector, int count)
bytes_read = INLINE_SYSCALL (readv, 3, fd, CHECK_N (vector, count), count);
+#ifdef __ASSUME_COMPLETE_READV_WRITEV
+ return bytes_read;
+#else
if (bytes_read >= 0 || errno != EINVAL || count <= UIO_FASTIOV)
return bytes_read;
return __atomic_readv_replacement (fd, vector, count);
+#endif
}
@@ -72,5 +77,7 @@ __libc_readv (fd, vector, count)
strong_alias (__libc_readv, __readv)
weak_alias (__libc_readv, readv)
-#define __libc_readv static internal_function __atomic_readv_replacement
-#include <sysdeps/posix/readv.c>
+#ifndef __ASSUME_COMPLETE_READV_WRITEV
+# define __libc_readv static internal_function __atomic_readv_replacement
+# include <sysdeps/posix/readv.c>
+#endif
diff --git a/sysdeps/unix/sysv/linux/writev.c b/sysdeps/unix/sysv/linux/writev.c
index 0597866..398a841 100644
--- a/sysdeps/unix/sysv/linux/writev.c
+++ b/sysdeps/unix/sysv/linux/writev.c
@@ -1,5 +1,5 @@
/* writev supports all Linux kernels >= 2.0.
- Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1997,1998,2000,2002,2003,2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -25,6 +25,7 @@
#include <sysdep-cancel.h>
#include <sys/syscall.h>
#include <bp-checks.h>
+#include <kernel-features.h>
static ssize_t __atomic_writev_replacement (int, const struct iovec *,
int) internal_function;
@@ -43,12 +44,17 @@ do_writev (int fd, const struct iovec *vector, int count)
{
ssize_t bytes_written;
- bytes_written = INLINE_SYSCALL (writev, 3, fd, CHECK_N (vector, count), count);
+ bytes_written = INLINE_SYSCALL (writev, 3, fd, CHECK_N (vector, count),
+ count);
+#ifdef __ASSUME_COMPLETE_READV_WRITEV
+ return bytes_written;
+#else
if (bytes_written >= 0 || errno != EINVAL || count <= UIO_FASTIOV)
return bytes_written;
return __atomic_writev_replacement (fd, vector, count);
+#endif
}
ssize_t
@@ -71,5 +77,7 @@ __libc_writev (fd, vector, count)
strong_alias (__libc_writev, __writev)
weak_alias (__libc_writev, writev)
-#define __libc_writev static internal_function __atomic_writev_replacement
-#include <sysdeps/posix/writev.c>
+#ifndef __ASSUME_COMPLETE_READV_WRITEV
+# define __libc_writev static internal_function __atomic_writev_replacement
+# include <sysdeps/posix/writev.c>
+#endif