diff options
author | Carmelo Amoroso <carmelo.amoroso@st.com> | 2007-11-22 16:09:55 +0000 |
---|---|---|
committer | Carmelo Amoroso <carmelo.amoroso@st.com> | 2007-11-22 16:09:55 +0000 |
commit | f90eda6523848d835adbe7bef598a86a72b1b22a (patch) | |
tree | ed6b799ce413dbd67251144be47f7cfe8a5fb746 /libc/sysdeps/linux/common/msync.c | |
parent | 0957a1a07cba013759ac2067979e6792f804af90 (diff) | |
download | uClibc-alpine-f90eda6523848d835adbe7bef598a86a72b1b22a.tar.bz2 uClibc-alpine-f90eda6523848d835adbe7bef598a86a72b1b22a.tar.xz |
Push back changes to add cancellation handling.
It still needs to reach an agreement on the final
solution, anyway this code have been put int to be shared
for the mips-sh4 merge
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Diffstat (limited to 'libc/sysdeps/linux/common/msync.c')
-rw-r--r-- | libc/sysdeps/linux/common/msync.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/common/msync.c b/libc/sysdeps/linux/common/msync.c index 494d4afd3..8882a4c91 100644 --- a/libc/sysdeps/linux/common/msync.c +++ b/libc/sysdeps/linux/common/msync.c @@ -11,7 +11,27 @@ #include <unistd.h> #include <sys/mman.h> +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ +#include <sysdep-cancel.h> +#else +#define SINGLE_THREAD_P 1 +#endif + +#define __NR___syscall_msync __NR_msync +static inline _syscall3(int, __syscall_msync, void *, addr, size_t, length, + int, flags); + extern __typeof(msync) __libc_msync; -#define __NR___libc_msync __NR_msync -_syscall3(int, __libc_msync, void *, addr, size_t, length, int, flags); +int __libc_msync(void * addr, size_t length, int flags) +{ + if (SINGLE_THREAD_P) + return __syscall_msync(addr, length, flags); + +#ifdef __UCLIBC_HAS_THREADS_NATIVE__ + int oldtype = LIBC_CANCEL_ASYNC (); + int result = __syscall_msync(addr, length, flags); + LIBC_CANCEL_RESET (oldtype); + return result; +#endif +} weak_alias(__libc_msync,msync) |