writev.c 834 B

12345678910111213141516171819202122232425262728
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * writev() for uClibc
  4. *
  5. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.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(writev)(int fd, const struct iovec *vector, int count)
  15. {
  16. ssize_t bytes_written = INLINE_SYSCALL(writev, 3, fd, vector, count);
  17. if (bytes_written >= 0 || errno != EINVAL || count <= UIO_FASTIOV)
  18. return bytes_written;
  19. /* glibc tries again, but we do not. */
  20. /* return __atomic_writev_replacement (fd, vector, count); */
  21. return -1;
  22. }
  23. CANCELLABLE_SYSCALL(ssize_t, writev, (int fd, const struct iovec *vector, int count), (fd, vector, count))