diff options
author | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-08-24 02:58:45 +0000 |
---|---|---|
committer | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-08-24 02:58:45 +0000 |
commit | 01f422c12f5799a44832eb26967a906edfc2ba55 (patch) | |
tree | 1e8bdcaab1f4da088cc1c490bf96c361a663e0c4 /libc/sysdeps/linux/common/writev.c | |
parent | d2db9bdb4c79afcd4b09353346cd4eaf63b6cd2c (diff) | |
download | uClibc-alpine-01f422c12f5799a44832eb26967a906edfc2ba55.tar.bz2 uClibc-alpine-01f422c12f5799a44832eb26967a906edfc2ba55.tar.xz |
Well, this is everything for my NPTL implementation. The 'uClibc-nptl' branch is now the exact code that I have. I am going to re-run tests now to verify everything one more time. The next step after that is to merge from trunk with the latest stuff from Mike and Peter.
Diffstat (limited to 'libc/sysdeps/linux/common/writev.c')
-rw-r--r-- | libc/sysdeps/linux/common/writev.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/common/writev.c b/libc/sysdeps/linux/common/writev.c index 4979fade9..cfb758974 100644 --- a/libc/sysdeps/linux/common/writev.c +++ b/libc/sysdeps/linux/common/writev.c @@ -2,6 +2,7 @@ /* * writev() for uClibc * + * Copyright (C) 2006 by Steven J. Hill <sjhill@realitydiluted.com> * Copyright (C) 2000-2004 by Erik Andersen <andersen@codepoet.org> * * GNU Library General Public License (LGPL) version 2 or later. @@ -9,5 +10,42 @@ #include "syscalls.h" #include <sys/uio.h> + +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ +#include <errno.h> +#include <sysdep-cancel.h> + +/* We should deal with kernel which have a smaller UIO_FASTIOV as well + as a very big count. */ +static ssize_t __writev (int fd, const struct iovec *vector, int count) +{ + ssize_t bytes_written; + + bytes_written = INLINE_SYSCALL (writev, 3, fd, vector, count); + + if (bytes_written >= 0 || errno != EINVAL || count <= UIO_FASTIOV) + return bytes_written; + + /* glibc tries again, but we do not. */ + //return __atomic_writev_replacement (fd, vector, count); + + return -1; +} + +ssize_t writev (int fd, const struct iovec *vector, int count) +{ + if (SINGLE_THREAD_P) + return __writev (fd, vector, count); + + int oldtype = LIBC_CANCEL_ASYNC (); + + ssize_t result = __writev (fd, vector, count); + + LIBC_CANCEL_RESET (oldtype); + + return result; +} +#else _syscall3(ssize_t, writev, int, filedes, const struct iovec *, vector, int, count); +#endif |