about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux/readv.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-04-03 18:50:34 +0000
committerUlrich Drepper <drepper@redhat.com>2009-04-03 18:50:34 +0000
commit7166c77ad06b44571398d641e00153145da04a2b (patch)
treeabc0e871405d2d7230f0e0993262f61cb225b8a0 /sysdeps/unix/sysv/linux/readv.c
parent2dbe6afe7c13af9790f2d37d3be3c8fa3262bd27 (diff)
downloadglibc-7166c77ad06b44571398d641e00153145da04a2b.tar.gz
glibc-7166c77ad06b44571398d641e00153145da04a2b.tar.xz
glibc-7166c77ad06b44571398d641e00153145da04a2b.zip
* sysdeps/unix/sysv/linux/readv.c (__libc_readv): Fix calling of
	compatibility code.
	* sysdeps/unix/sysv/linux/writev.c (__libc_writev): Likewise.

2009-04-01  Ulrich Drepper  <drepper@redhat.com>
Diffstat (limited to 'sysdeps/unix/sysv/linux/readv.c')
-rw-r--r--sysdeps/unix/sysv/linux/readv.c41
1 files changed, 16 insertions, 25 deletions
diff --git a/sysdeps/unix/sysv/linux/readv.c b/sysdeps/unix/sysv/linux/readv.c
index d12fa49373..bff4a3ff74 100644
--- a/sysdeps/unix/sysv/linux/readv.c
+++ b/sysdeps/unix/sysv/linux/readv.c
@@ -37,42 +37,33 @@ static ssize_t __atomic_readv_replacement (int, __const struct iovec *,
 #endif
 
 
-/* We should deal with kernel which have a smaller UIO_FASTIOV as well
-   as a very big count.  */
-static ssize_t
-do_readv (int fd, const struct iovec *vector, int count)
-{
-  ssize_t bytes_read;
-
-  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
-}
-
-
 ssize_t
 __libc_readv (fd, vector, count)
      int fd;
      const struct iovec *vector;
      int count;
 {
-  if (SINGLE_THREAD_P)
-    return do_readv (fd, vector, count);
+  ssize_t result;
 
-  int oldtype = LIBC_CANCEL_ASYNC ();
+  if (SINGLE_THREAD_P)
+    result = INLINE_SYSCALL (readv, 3, fd, CHECK_N (vector, count), count);
+  else
+    {
+      int oldtype = LIBC_CANCEL_ASYNC ();
 
-  int result = do_readv (fd, vector, count);
+      result = INLINE_SYSCALL (readv, 3, fd, CHECK_N (vector, count), count);
 
-  LIBC_CANCEL_RESET (oldtype);
+      LIBC_CANCEL_RESET (oldtype);
+    }
 
+#ifdef __ASSUME_COMPLETE_READV_WRITEV
   return result;
+#else
+  if (result >= 0 || errno != EINVAL || count <= UIO_FASTIOV)
+    return result;
+
+  return __atomic_readv_replacement (fd, vector, count);
+#endif
 }
 strong_alias (__libc_readv, __readv)
 weak_alias (__libc_readv, readv)