writev.c 809 B

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