diff mbox series

[uclibc-ng-devel,20/32,FDPIC] nptl: Do not use madvise

Message ID 20180704155605.1892-21-christophe.lyon@st.com
State Accepted
Headers show
Series FDPIC ABI for ARM | expand

Commit Message

Christophe Lyon July 4, 2018, 3:55 p.m. UTC
start_thread() uses it, but it is not supported on MMU-less systems.

	* libpthread/nptl/pthread_create.c (start_thread): Call madvise
	only if __ARCH_USE_MMU__ is defined.

Signed-off-by: Mickaël Guêné <mickael.guene@st.com>
Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
diff mbox series

Patch

diff --git a/libpthread/nptl/pthread_create.c b/libpthread/nptl/pthread_create.c
index 3064b40..5a7957d 100644
--- a/libpthread/nptl/pthread_create.c
+++ b/libpthread/nptl/pthread_create.c
@@ -373,8 +373,12 @@  start_thread (void *arg)
   size_t freesize = ((char *) pd->stackblock - sp) & ~pagesize_m1;
 #endif
   assert (freesize < pd->stackblock_size);
+
+  /* madvise is not supported on MMU-less systems. */
+#ifdef  __ARCH_USE_MMU__
   if (freesize > PTHREAD_STACK_MIN)
     madvise (pd->stackblock, freesize - PTHREAD_STACK_MIN, MADV_DONTNEED);
+#endif
 
   /* If the thread is detached free the TCB.  */
   if (IS_DETACHED (pd))