mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-05 09:01:07 +00:00
* sysdeps/unix/sysv/linux/readv.c (__libc_readv): Fix calling of
compatibility code. * sysdeps/unix/sysv/linux/writev.c (__libc_writev): Likewise. 2009-04-01 Ulrich Drepper <drepper@redhat.com>
This commit is contained in:
parent
2dbe6afe7c
commit
7166c77ad0
@ -1,5 +1,9 @@
|
|||||||
2009-04-03 Ulrich Drepper <drepper@redhat.com>
|
2009-04-03 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
|
* sysdeps/unix/sysv/linux/readv.c (__libc_readv): Fix calling of
|
||||||
|
compatibility code.
|
||||||
|
* sysdeps/unix/sysv/linux/writev.c (__libc_writev): Likewise.
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/kernel-features.h: Define
|
* sysdeps/unix/sysv/linux/kernel-features.h: Define
|
||||||
__ASSUME_COMPLETE_READV_WRITEV.
|
__ASSUME_COMPLETE_READV_WRITEV.
|
||||||
* sysdeps/unix/sysv/linux/readv.c: No need for userlevel fallback
|
* sysdeps/unix/sysv/linux/readv.c: No need for userlevel fallback
|
||||||
@ -41,7 +45,7 @@
|
|||||||
(R_SPARC_NUM): Update.
|
(R_SPARC_NUM): Update.
|
||||||
From Dave Miller <davem@davemloft.net>.
|
From Dave Miller <davem@davemloft.net>.
|
||||||
|
|
||||||
c2009-04-01 Ulrich Drepper <drepper@redhat.com>
|
2009-04-01 Ulrich Drepper <drepper@redhat.com>
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/sys/eventfd.h (EFD_SEMAPHORE): Define.
|
* sysdeps/unix/sysv/linux/sys/eventfd.h (EFD_SEMAPHORE): Define.
|
||||||
|
|
||||||
|
@ -37,42 +37,33 @@ static ssize_t __atomic_readv_replacement (int, __const struct iovec *,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* We should deal with kernel which have a smaller UIO_FASTIOV as well
|
|
||||||
as a very big count. */
|
|
||||||
static ssize_t
|
|
||||||
do_readv (int fd, const struct iovec *vector, int count)
|
|
||||||
{
|
|
||||||
ssize_t bytes_read;
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
__libc_readv (fd, vector, count)
|
__libc_readv (fd, vector, count)
|
||||||
int fd;
|
int fd;
|
||||||
const struct iovec *vector;
|
const struct iovec *vector;
|
||||||
int count;
|
int count;
|
||||||
{
|
{
|
||||||
if (SINGLE_THREAD_P)
|
ssize_t result;
|
||||||
return do_readv (fd, vector, count);
|
|
||||||
|
|
||||||
|
if (SINGLE_THREAD_P)
|
||||||
|
result = INLINE_SYSCALL (readv, 3, fd, CHECK_N (vector, count), count);
|
||||||
|
else
|
||||||
|
{
|
||||||
int oldtype = LIBC_CANCEL_ASYNC ();
|
int oldtype = LIBC_CANCEL_ASYNC ();
|
||||||
|
|
||||||
int result = do_readv (fd, vector, count);
|
result = INLINE_SYSCALL (readv, 3, fd, CHECK_N (vector, count), count);
|
||||||
|
|
||||||
LIBC_CANCEL_RESET (oldtype);
|
LIBC_CANCEL_RESET (oldtype);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __ASSUME_COMPLETE_READV_WRITEV
|
||||||
return result;
|
return result;
|
||||||
|
#else
|
||||||
|
if (result >= 0 || errno != EINVAL || count <= UIO_FASTIOV)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
return __atomic_readv_replacement (fd, vector, count);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
strong_alias (__libc_readv, __readv)
|
strong_alias (__libc_readv, __readv)
|
||||||
weak_alias (__libc_readv, readv)
|
weak_alias (__libc_readv, readv)
|
||||||
|
@ -37,42 +37,33 @@ static ssize_t __atomic_writev_replacement (int, const struct iovec *,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* We should deal with kernel which have a smaller UIO_FASTIOV as well
|
|
||||||
as a very big count. */
|
|
||||||
static ssize_t
|
|
||||||
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);
|
|
||||||
|
|
||||||
#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
|
ssize_t
|
||||||
__libc_writev (fd, vector, count)
|
__libc_writev (fd, vector, count)
|
||||||
int fd;
|
int fd;
|
||||||
const struct iovec *vector;
|
const struct iovec *vector;
|
||||||
int count;
|
int count;
|
||||||
{
|
{
|
||||||
if (SINGLE_THREAD_P)
|
ssize_t result;
|
||||||
return do_writev (fd, vector, count);
|
|
||||||
|
|
||||||
|
if (SINGLE_THREAD_P)
|
||||||
|
result = INLINE_SYSCALL (writev, 3, fd, CHECK_N (vector, count), count);
|
||||||
|
else
|
||||||
|
{
|
||||||
int oldtype = LIBC_CANCEL_ASYNC ();
|
int oldtype = LIBC_CANCEL_ASYNC ();
|
||||||
|
|
||||||
ssize_t result = do_writev (fd, vector, count);
|
result = INLINE_SYSCALL (writev, 3, fd, CHECK_N (vector, count), count);
|
||||||
|
|
||||||
LIBC_CANCEL_RESET (oldtype);
|
LIBC_CANCEL_RESET (oldtype);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __ASSUME_COMPLETE_READV_WRITEV
|
||||||
return result;
|
return result;
|
||||||
|
#else
|
||||||
|
if (result >= 0 || errno != EINVAL || count <= UIO_FASTIOV)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
return __atomic_writev_replacement (fd, vector, count);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
strong_alias (__libc_writev, __writev)
|
strong_alias (__libc_writev, __writev)
|
||||||
weak_alias (__libc_writev, writev)
|
weak_alias (__libc_writev, writev)
|
||||||
|
Loading…
Reference in New Issue
Block a user