about summary refs log tree commit diff
path: root/nptl/pt-writev.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-writev.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-writev.c')
-rw-r--r--nptl/pt-writev.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/nptl/pt-writev.c b/nptl/pt-writev.c
index c1dda350aa..99e876c902 100644
--- a/nptl/pt-writev.c
+++ b/nptl/pt-writev.c
@@ -26,7 +26,8 @@
 
 /* Not all versions of the kernel support 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 +37,29 @@ writev (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 (writev, 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_writev (fd, vector, count);
+    }
+#else
+# if defined INLINE_SYSCALL
   result = INLINE_SYSCALL (writev, 3, fd, vector, count);
   if (result < 0 && errno == EINVAL
       && __builtin_expect (count > UIO_FASTIOV, 0))
-#endif
+# endif
     result = __libc_writev (fd, vector, count);
+#endif
 
   CANCEL_RESET (oldtype);