> From: Maksim Rayskiy <[email protected]>
> 
> pread() and pwrite() are mandatory cancellation points.
> copypasted from sh implementation

please take care about all archs, it is not OK, that only some of
them got the cancellation support (or adapt my patch from future branch that 
generalized it for all archs)

Thanks, Peter

> Signed-off-by: Maksim Rayskiy <[email protected]>
> ---
>  libc/sysdeps/linux/mips/pread_write.c |   26 ++++++++++++++++++++++++--
>  1 files changed, 24 insertions(+), 2 deletions(-)
> 
> diff --git a/libc/sysdeps/linux/mips/pread_write.c
> b/libc/sysdeps/linux/mips/pread_write.c
> index ea6b15f..03b45de 100644
> --- a/libc/sysdeps/linux/mips/pread_write.c
> +++ b/libc/sysdeps/linux/mips/pread_write.c
> @@ -35,6 +35,11 @@ extern __typeof(pwrite64) __libc_pwrite64;
>  
>  #include <bits/kernel_types.h>
>  
> +#ifdef __UCLIBC_HAS_THREADS_NATIVE__
> +#include "sysdep-cancel.h"
> +#else
> +#define SINGLE_THREAD_P 1
> +#endif
>  
>  #ifdef __NR_pread
>  
> @@ -54,7 +59,16 @@ static __inline__ _syscall6(ssize_t, __syscall_pread,
> int, fd, void *, buf,
>  
>  ssize_t __libc_pread(int fd, void *buf, size_t count, off_t offset)
>  {
> -     
> return(__syscall_pread(fd,buf,count,0,__LONG_LONG_PAIR(offset>>31,offset)));
> +     if (SINGLE_THREAD_P)
> +             
> return(__syscall_pread(fd,buf,count,0,__LONG_LONG_PAIR(offset>>31,offset)));
> +
> +#ifdef __UCLIBC_HAS_THREADS_NATIVE__
> +     int oldtype = LIBC_CANCEL_ASYNC ();
> +     int result = __syscall_pread(fd, buf, count, 0,
> __LONG_LONG_PAIR(offset>>31,offset));
> +     LIBC_CANCEL_RESET (oldtype);
> +     return result;
> +#endif
> +
>  }
>  weak_alias(__libc_pread,pread)
>  
> @@ -98,7 +112,15 @@ static __inline__ _syscall6(ssize_t, __syscall_pwrite,
> int, fd, const void *, bu
>  
>  ssize_t __libc_pwrite(int fd, const void *buf, size_t count, off_t
> offset)
>  {
> -     
> return(__syscall_pwrite(fd,buf,count,0,__LONG_LONG_PAIR(offset>>31,offset)));
> +     if (SINGLE_THREAD_P)
> +             
> return(__syscall_pwrite(fd,buf,count,0,__LONG_LONG_PAIR(offset>>31,offset)));
> +
> +#ifdef __UCLIBC_HAS_THREADS_NATIVE__
> +     int oldtype = LIBC_CANCEL_ASYNC ();
> +     int result = __syscall_pwrite(fd, buf, count, 0,
> __LONG_LONG_PAIR(offset>>31,offset));
> +     LIBC_CANCEL_RESET (oldtype);
> +     return result;
> +#endif
>  }
>  weak_alias(__libc_pwrite,pwrite)
>  
> -- 
> 1.7.4.1
> 
> 
> _______________________________________________
> uClibc mailing list
> [email protected]
> http://lists.busybox.net/mailman/listinfo/uclibc

-- 
NEU: FreePhone - kostenlos mobil telefonieren und surfen!                       
Jetzt informieren: http://www.gmx.net/de/go/freephone
_______________________________________________
uClibc mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/uclibc

Reply via email to