1 /* vi: set sw=4 ts=4: */
2 /*
3 * readv() for uClibc
4 *
5 * Copyright (C) 2006 by Steven J. Hill <sjhill@realitydiluted.com>
6 * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org>
7 *
8 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
9 */
10
11 #include <sys/syscall.h>
12 #include <sys/uio.h>
13 #include <cancel.h>
14
15 /* We should deal with kernel which have a smaller UIO_FASTIOV as well
16 as a very big count. */
__NC(readv)17 static ssize_t __NC(readv)(int fd, const struct iovec *vector, int count)
18 {
19 ssize_t bytes_read = INLINE_SYSCALL(readv, 3, fd, vector, count);
20
21 if (bytes_read >= 0 || errno != EINVAL || count <= UIO_FASTIOV)
22 return bytes_read;
23
24 /* glibc tries again, but we do not. */
25 /* return __atomic_readv_replacement (fd, vector, count); */
26
27 return -1;
28 }
29 CANCELLABLE_SYSCALL(ssize_t, readv, (int fd, const struct iovec *vector, int count),
30 (fd, vector, count))
31