diff options
author | Ulrich Drepper <drepper@redhat.com> | 2009-04-03 17:23:13 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2009-04-03 17:23:13 +0000 |
commit | 2dbe6afe7c13af9790f2d37d3be3c8fa3262bd27 (patch) | |
tree | 6080f12475eef12e39f1df2cfd6be163fa5c82db /sysdeps/unix/sysv/linux/writev.c | |
parent | a065c0076a1b76b9eb375ae051176e9bf518816a (diff) | |
download | glibc-2dbe6afe7c13af9790f2d37d3be3c8fa3262bd27.tar.gz glibc-2dbe6afe7c13af9790f2d37d3be3c8fa3262bd27.tar.xz glibc-2dbe6afe7c13af9790f2d37d3be3c8fa3262bd27.zip |
* sysdeps/unix/sysv/linux/kernel-features.h: Define
__ASSUME_COMPLETE_READV_WRITEV. * sysdeps/unix/sysv/linux/readv.c: No need for userlevel fallback with modern kernels. * sysdeps/unix/sysv/linux/writev.c: Likewise. * sysdeps/posix/readv.c: Since read is a cancellation point we have to free a possible malloced buffer in case of cancellation. * sysdeps/posix/writev.c: Likewise for write. c2009-04-01 Ulrich Drepper <drepper@redhat.com>
Diffstat (limited to 'sysdeps/unix/sysv/linux/writev.c')
-rw-r--r-- | sysdeps/unix/sysv/linux/writev.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sysdeps/unix/sysv/linux/writev.c b/sysdeps/unix/sysv/linux/writev.c index 05978665fa..398a841bb3 100644 --- a/sysdeps/unix/sysv/linux/writev.c +++ b/sysdeps/unix/sysv/linux/writev.c @@ -1,5 +1,5 @@ /* writev supports all Linux kernels >= 2.0. - Copyright (C) 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 1997,1998,2000,2002,2003,2009 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -25,6 +25,7 @@ #include <sysdep-cancel.h> #include <sys/syscall.h> #include <bp-checks.h> +#include <kernel-features.h> static ssize_t __atomic_writev_replacement (int, const struct iovec *, int) internal_function; @@ -43,12 +44,17 @@ do_writev (int fd, const struct iovec *vector, int count) { ssize_t bytes_written; - bytes_written = INLINE_SYSCALL (writev, 3, fd, CHECK_N (vector, count), count); + bytes_written = INLINE_SYSCALL (writev, 3, fd, CHECK_N (vector, count), + count); +#ifdef __ASSUME_COMPLETE_READV_WRITEV + return bytes_written; +#else if (bytes_written >= 0 || errno != EINVAL || count <= UIO_FASTIOV) return bytes_written; return __atomic_writev_replacement (fd, vector, count); +#endif } ssize_t @@ -71,5 +77,7 @@ __libc_writev (fd, vector, count) strong_alias (__libc_writev, __writev) weak_alias (__libc_writev, writev) -#define __libc_writev static internal_function __atomic_writev_replacement -#include <sysdeps/posix/writev.c> +#ifndef __ASSUME_COMPLETE_READV_WRITEV +# define __libc_writev static internal_function __atomic_writev_replacement +# include <sysdeps/posix/writev.c> +#endif |