about summary refs log tree commit diff
path: root/nptl/pt-readv.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-12-08 08:25:05 +0000
committerUlrich Drepper <drepper@redhat.com>2002-12-08 08:25:05 +0000
commitbdb04f922004ff8433591f138e40c09722836c45 (patch)
tree965b2db38d2cd7f9fb5114a10d53e3ddcc2bfad4 /nptl/pt-readv.c
parent3335502bec2220c7d1e89929d489c1a91a1d862b (diff)
downloadglibc-bdb04f922004ff8433591f138e40c09722836c45.tar.gz
glibc-bdb04f922004ff8433591f138e40c09722836c45.tar.xz
glibc-bdb04f922004ff8433591f138e40c09722836c45.zip
Update.
	* scripts/output-format.sed: Fix bug in one of the s expressions
	which used / for one too many things.
Diffstat (limited to 'nptl/pt-readv.c')
-rw-r--r--nptl/pt-readv.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/nptl/pt-readv.c b/nptl/pt-readv.c
index 9f6e653d4f..e81c8306a1 100644
--- a/nptl/pt-readv.c
+++ b/nptl/pt-readv.c
@@ -24,9 +24,11 @@
 #include "pthreadP.h"
 
 
-/* Not all versions of the kernel support the large number of records.  */
+/* Not all versions of the kernel support extremely the large number
+   of records.  */
 #ifndef UIO_FASTIOV
-# define UIO_FASTIOV	8	/* 8 is a safe number.  */
+/* 1024 is what the kernels with NPTL support use.  */
+# define UIO_FASTIOV	1024
 #endif
 
 
@@ -36,21 +38,29 @@ readv (fd, vector, count)
      const struct iovec *vector;
      int count;
 {
-  int oldtype;
-  ssize_t result;
-
-  CANCEL_ASYNC (oldtype);
+  int oldtype = CANCEL_ASYNC ();
 
+  ssize_t result;
 #ifdef INTERNAL_SYSCALL
   result = INTERNAL_SYSCALL (readv, 3, fd, vector, count);
-  if (INTERNAL_SYSCALL_ERROR_P (result)
-      && __builtin_expect (count > UIO_FASTIOV, 0))
-#elif defined INLINE_SYSCALL
+  if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (result), 0))
+    {
+      if (count <= UIO_FASTIOV)
+	{
+	  __set_errno (INTERNAL_SYSCALL_ERRNO (result));
+	  result = -1;
+	}
+      else
+	result = __libc_readv (fd, vector, count);
+    }
+#else
+# if defined INLINE_SYSCALL
   result = INLINE_SYSCALL (readv, 3, fd, vector, count);
   if (result < 0 && errno == EINVAL
       && __builtin_expect (count > UIO_FASTIOV, 0))
-#endif
+# endif
     result = __libc_readv (fd, vector, count);
+#endif
 
   CANCEL_RESET (oldtype);