From 2dbe6afe7c13af9790f2d37d3be3c8fa3262bd27 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 3 Apr 2009 17:23:13 +0000 Subject: * 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 --- sysdeps/unix/sysv/linux/readv.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'sysdeps/unix/sysv/linux/readv.c') diff --git a/sysdeps/unix/sysv/linux/readv.c b/sysdeps/unix/sysv/linux/readv.c index 250c00a..d12fa49 100644 --- a/sysdeps/unix/sysv/linux/readv.c +++ b/sysdeps/unix/sysv/linux/readv.c @@ -1,5 +1,5 @@ /* readv 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 #include #include +#include static ssize_t __atomic_readv_replacement (int, __const struct iovec *, int) internal_function; @@ -45,10 +46,14 @@ do_readv (int fd, const struct iovec *vector, int count) bytes_read = INLINE_SYSCALL (readv, 3, fd, CHECK_N (vector, count), count); +#ifdef __ASSUME_COMPLETE_READV_WRITEV + return bytes_read; +#else if (bytes_read >= 0 || errno != EINVAL || count <= UIO_FASTIOV) return bytes_read; return __atomic_readv_replacement (fd, vector, count); +#endif } @@ -72,5 +77,7 @@ __libc_readv (fd, vector, count) strong_alias (__libc_readv, __readv) weak_alias (__libc_readv, readv) -#define __libc_readv static internal_function __atomic_readv_replacement -#include +#ifndef __ASSUME_COMPLETE_READV_WRITEV +# define __libc_readv static internal_function __atomic_readv_replacement +# include +#endif -- cgit v1.1