readv.c 874 B

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