readv.c 899 B

123456789101112131415161718192021222324252627282930
  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. #include <sys/syscall.h>
  11. #include <sys/uio.h>
  12. #include <cancel.h>
  13. /* We should deal with kernel which have a smaller UIO_FASTIOV as well
  14. as a very big count. */
  15. static ssize_t __NC(readv)(int fd, const struct iovec *vector, int count)
  16. {
  17. ssize_t bytes_read = INLINE_SYSCALL(readv, 3, fd, vector, count);
  18. if (bytes_read >= 0 || errno != EINVAL || count <= UIO_FASTIOV)
  19. return bytes_read;
  20. /* glibc tries again, but we do not. */
  21. /* return __atomic_readv_replacement (fd, vector, count); */
  22. return -1;
  23. }
  24. CANCELLABLE_SYSCALL(ssize_t, readv, (int fd, const struct iovec *vector, int count),
  25. (fd, vector, count))