about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/syscalls.list4
-rw-r--r--sysdeps/unix/sysv/linux/alpha/ioperm.c1
-rw-r--r--sysdeps/unix/sysv/linux/i386/sysdep.S5
-rw-r--r--sysdeps/unix/sysv/linux/readv.c32
-rw-r--r--sysdeps/unix/sysv/linux/writev.c31
5 files changed, 32 insertions, 41 deletions
diff --git a/sysdeps/unix/syscalls.list b/sysdeps/unix/syscalls.list
index 9a2325c35c..5ececa058c 100644
--- a/sysdeps/unix/syscalls.list
+++ b/sysdeps/unix/syscalls.list
@@ -31,7 +31,7 @@ profil		-	profil		4	profil
 ptrace		-	ptrace		4	ptrace
 read		-	read		3	__libc_read	__read read
 readlink	-	readlink	3	__readlink	readlink
-readv		-	readv		3	readv
+readv		-	readv		3	__readv		readv
 reboot		-	reboot		1	reboot
 rename		-	rename		2	rename
 rmdir		-	rmdir		1	__rmdir		rmdir
@@ -62,4 +62,4 @@ uname		-	uname		1	uname
 unlink		-	unlink		1	__unlink	unlink
 utimes		-	utimes		2	__utimes	utimes
 write		-	write		3	__libc_write	__write write
-writev		-	writev		3	writev
+writev		-	writev		3	__writev	writev
diff --git a/sysdeps/unix/sysv/linux/alpha/ioperm.c b/sysdeps/unix/sysv/linux/alpha/ioperm.c
index b39f39a0d7..63bf17588a 100644
--- a/sysdeps/unix/sysv/linux/alpha/ioperm.c
+++ b/sysdeps/unix/sysv/linux/alpha/ioperm.c
@@ -35,6 +35,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <ctype.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
diff --git a/sysdeps/unix/sysv/linux/i386/sysdep.S b/sysdeps/unix/sysv/linux/i386/sysdep.S
index 4b86d1dfe7..a686495818 100644
--- a/sysdeps/unix/sysv/linux/i386/sysdep.S
+++ b/sysdeps/unix/sysv/linux/i386/sysdep.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997 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
@@ -45,6 +45,9 @@ _errno = errno	/* This name is expected by hj's libc.so.5 startup code.  */
    The code for Linux is almost identical to the canonical Unix/i386
    code, except that the error number in %eax is negated.  */
 
+#undef CALL_MCOUNT
+#define CALL_MCOUNT /* Don't insert the profiling call, it clobbers %eax.  */
+
 ENTRY (__syscall_error)
 	negl %eax
 
diff --git a/sysdeps/unix/sysv/linux/readv.c b/sysdeps/unix/sysv/linux/readv.c
index c8ff55ab45..2c215ce920 100644
--- a/sysdeps/unix/sysv/linux/readv.c
+++ b/sysdeps/unix/sysv/linux/readv.c
@@ -23,6 +23,8 @@
 #include <sys/uio.h>
 
 extern ssize_t __syscall_readv __P ((int, __const struct iovec *, int));
+static ssize_t __atomic_readv_replacement __P ((int, __const struct iovec *,
+						int));
 
 
 /* Not all versions of the kernel support the large number of records.  */
@@ -34,7 +36,7 @@ extern ssize_t __syscall_readv __P ((int, __const struct iovec *, int));
 /* We should deal with kernel which have a smaller UIO_FASTIOV as well
    as a very big count.  */
 ssize_t
-readv (fd, vector, count)
+__readv (fd, vector, count)
      int fd;
      const struct iovec *vector;
      int count;
@@ -44,25 +46,15 @@ readv (fd, vector, count)
 
   bytes_read = __syscall_readv (fd, vector, count);
 
-  if (bytes_read < 0 && errno == EINVAL && count > UIO_FASTIOV)
-    {
-      int i;
+  if (bytes_read >= 0 || errno != EINVAL || count <= UIO_FASTIOV)
+    return bytes_read;
 
-      /* Restore the old error value as if nothing happened.  */
-      __set_errno (errno_saved);
+  /* Restore the old error value as if nothing happened.  */
+  __set_errno (errno_saved);
 
-      bytes_read = 0;
-      for (i = 0; i < count; i += UIO_FASTIOV)
-	{
-	  ssize_t bytes = __syscall_readv (fd, vector + i,
-					   MIN (count - i, UIO_FASTIOV));
-
-	  if (bytes < 0)
-	    return bytes;
-
-	  bytes_read += bytes;
-	}
-    }
-
-  return bytes_read;
+  return __atomic_readv_replacement (fd, vector, count);
 }
+weak_alias (__readv, readv)
+
+#define __readv static __atomic_readv_replacement
+#include <sysdeps/posix/readv.c>
diff --git a/sysdeps/unix/sysv/linux/writev.c b/sysdeps/unix/sysv/linux/writev.c
index d147186b51..31e794fb04 100644
--- a/sysdeps/unix/sysv/linux/writev.c
+++ b/sysdeps/unix/sysv/linux/writev.c
@@ -23,6 +23,9 @@
 #include <sys/uio.h>
 
 extern ssize_t __syscall_writev __P ((int, const struct iovec *, int));
+static ssize_t __atomic_writev_replacement __P ((int, const struct iovec *,
+						 int));
+
 
 /* Not all versions of the kernel support the large number of records.  */
 #ifndef UIO_FASTIOV
@@ -33,7 +36,7 @@ extern ssize_t __syscall_writev __P ((int, const struct iovec *, int));
 /* We should deal with kernel which have a smaller UIO_FASTIOV as well
    as a very big count.  */
 ssize_t
-writev (fd, vector, count)
+__writev (fd, vector, count)
      int fd;
      const struct iovec *vector;
      int count;
@@ -43,23 +46,15 @@ writev (fd, vector, count)
 
   bytes_written = __syscall_writev (fd, vector, count);
 
-  if (bytes_written < 0 && errno == EINVAL && count > UIO_FASTIOV)
-    {
-      int i;
-
-      /* Restore the old error value as if nothing happened.  */
-      __set_errno (errno_saved);
+  if (bytes_written >= 0 || errno != EINVAL || count <= UIO_FASTIOV)
+    return bytes_written;
 
-      bytes_written = 0;
-      for (i = 0; i < count; i += UIO_FASTIOV)
-	{
-	  ssize_t bytes = __syscall_writev (fd, vector + i,
-					    MIN (count - i, UIO_FASTIOV));
+  /* Restore the old error value as if nothing happened.  */
+  __set_errno (errno_saved);
 
-	  if (bytes < 0)
-	    return bytes_written > 0 ? bytes_written : bytes;
-	}
-    }
-
-  return bytes_written;
+  return __atomic_writev_replacement (fd, vector, count);
 }
+weak_alias (__writev, writev)
+
+#define __writev static __atomic_writev_replacement
+#include <sysdeps/posix/writev.c>