diff options
author | han_mao@c-sky.com <han_mao@c-sky.com> | 2018-12-13 09:37:12 +0800 |
---|---|---|
committer | Waldemar Brodkorb <wbrodkorb@conet.de> | 2018-12-14 10:50:50 +0100 |
commit | 7b1c4fa9bd8df64c8002ea4e613c8952bdfefbdd (patch) | |
tree | f3d1dd498d6555feb89b970c9b0f5940505416e3 | |
parent | 358b7807d7278eaf9cd0cc6e7168d533fbd0b707 (diff) |
several patches for uclibc ng
I've got several patches to fix ltp/openmp/uclibc-ng-test testcase fail on
c-sky.
- fix a ltp testcase.
- fix the problem that pthread creat will fail when libomp is linked before
libc, the variable pagesize is not init.
- fix tst-cancel4 and tst-cancel16. tst-cancelx4 and tst-cancelx16 still fail
with this patch applied, cleanup handler is not called for open/creat/fcntl,
seems some thing wrong with unwind, I haven't check the rootcause yet.
-rw-r--r-- | libc/sysdeps/linux/common/__syscall_fcntl64.c | 2 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/ftruncate.c | 4 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/openat.c | 15 | ||||
-rw-r--r-- | libpthread/nptl/Makefile.in | 3 | ||||
-rw-r--r-- | libpthread/nptl/init.c | 5 |
5 files changed, 27 insertions, 2 deletions
diff --git a/libc/sysdeps/linux/common/__syscall_fcntl64.c b/libc/sysdeps/linux/common/__syscall_fcntl64.c index 0c13d152f..696b1ff41 100644 --- a/libc/sysdeps/linux/common/__syscall_fcntl64.c +++ b/libc/sysdeps/linux/common/__syscall_fcntl64.c @@ -30,7 +30,7 @@ int fcntl64(int fd, int cmd, ...) arg = va_arg(list, long); va_end(list); - if (SINGLE_THREAD_P || (cmd != F_SETLKW64)) + if (SINGLE_THREAD_P || (cmd != F_SETLKW && cmd != F_SETLKW64)) return __NC(fcntl64)(fd, cmd, arg); # ifdef __NEW_THREADS oldtype = LIBC_CANCEL_ASYNC(); diff --git a/libc/sysdeps/linux/common/ftruncate.c b/libc/sysdeps/linux/common/ftruncate.c index b9a69714f..637050777 100644 --- a/libc/sysdeps/linux/common/ftruncate.c +++ b/libc/sysdeps/linux/common/ftruncate.c @@ -15,7 +15,11 @@ int ftruncate(int fd, __off_t length) { # if __WORDSIZE == 32 +# if defined(__UCLIBC_SYSCALL_ALIGN_64BIT__) + return INLINE_SYSCALL(ftruncate64, 4, fd, 0, OFF_HI_LO(length)); +# else return INLINE_SYSCALL(ftruncate64, 3, fd, OFF_HI_LO(length)); +# endif # else return ftruncate64(fd, length); # endif diff --git a/libc/sysdeps/linux/common/openat.c b/libc/sysdeps/linux/common/openat.c index f71567cdc..62451df4c 100644 --- a/libc/sysdeps/linux/common/openat.c +++ b/libc/sysdeps/linux/common/openat.c @@ -9,6 +9,7 @@ #include <sys/syscall.h> #include <fcntl.h> #include <stdarg.h> +#include <cancel.h> #ifdef __NR_openat # define __NR___syscall_openat __NR_openat @@ -16,13 +17,25 @@ static __inline__ _syscall4(int, __syscall_openat, int, fd, const char *, file, int __openat(int fd, const char *file, int o_flag, ...) { +#ifdef __NEW_THREADS + int oldtype, result; +#endif va_list ap; mode_t mode; va_start(ap, o_flag); mode = va_arg(ap, int); va_end(ap); - return __syscall_openat(fd, file, o_flag, mode); + + if (SINGLE_THREAD_P) + return __syscall_openat(fd, file, o_flag, mode); + +#ifdef __NEW_THREADS + oldtype = LIBC_CANCEL_ASYNC (); + result = __syscall_openat(fd, file, o_flag, mode); + LIBC_CANCEL_RESET (oldtype); + return result; +#endif } strong_alias_untyped(__openat,openat) diff --git a/libpthread/nptl/Makefile.in b/libpthread/nptl/Makefile.in index bd220ba8f..52381b8c6 100644 --- a/libpthread/nptl/Makefile.in +++ b/libpthread/nptl/Makefile.in @@ -146,15 +146,18 @@ CFLAGS-clock_nanosleep.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-close.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-connect.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-creat.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-creat64.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-fdatasync.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-fsync.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-lockf.c = -fexceptions +CFLAGS-lockf64.c = -fexceptions CFLAGS-msgrcv.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-msgsnd.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-msync.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-nanosleep.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-open64.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-open.c = -fexceptions -fasynchronous-unwind-tables +CFLAGS-openat.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-pause.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-poll.c = -fexceptions -fasynchronous-unwind-tables CFLAGS-ppoll.c = -fexceptions -fasynchronous-unwind-tables diff --git a/libpthread/nptl/init.c b/libpthread/nptl/init.c index 74d30c739..4959d5ed8 100644 --- a/libpthread/nptl/init.c +++ b/libpthread/nptl/init.c @@ -292,7 +292,12 @@ __pthread_initialize_minimal_internal (void) /* Make sure it meets the minimum size that allocate_stack (allocatestack.c) will demand, which depends on the page size. */ + #ifdef SHARED + extern size_t GLRO(dl_pagesize); + const uintptr_t pagesz = GLRO(dl_pagesize); + #else const uintptr_t pagesz = sysconf (_SC_PAGESIZE); + #endif const size_t minstack = pagesz + __static_tls_size + MINIMAL_REST_STACK; if (limit.rlim_cur < minstack) limit.rlim_cur = minstack; |