summaryrefslogtreecommitdiff
path: root/libc/unistd/exec.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2004-02-17 10:40:47 +0000
committerManuel Novoa III <mjn3@codepoet.org>2004-02-17 10:40:47 +0000
commit3aa16a1146c008ed07750a30dc2f68c3a7d010c5 (patch)
tree94980e12d7d47c1e981026442e70cad119202878 /libc/unistd/exec.c
parent93915a08a4887ba96e0dfd0a9791ff8c576e4d41 (diff)
Sigh... Fall back to alloca() if munmap is broken (uClinux).
Diffstat (limited to 'libc/unistd/exec.c')
-rw-r--r--libc/unistd/exec.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c
index 666a8192b..21f335da9 100644
--- a/libc/unistd/exec.c
+++ b/libc/unistd/exec.c
@@ -17,6 +17,8 @@
/* Jan 1, 2004
* Initial version of a SUSv3 compliant exec*() functions.
+ * Feb 17, 2004
+ * Sigh... Fall back to alloca() if munmap() is broken on uClinux.
*/
/* NOTE: Strictly speaking, there could be problems from accessing
@@ -41,10 +43,10 @@
extern char *__strchrnul(const char *s, int c);
/**********************************************************************/
-#ifdef __ARCH_HAS_MMU__
+#if defined(__ARCH_HAS_MMU__) || defined(__UCLIBC_UCLINUX_BROKEN_MUNMAP__)
/* We have an MMU, so use alloca() to grab space for buffers and
- * arg lists. */
+ * arg lists. Also fall back to alloca() if munmap() is broken. */
# define EXEC_ALLOC_SIZE(VAR) /* nothing to do */
# define EXEC_ALLOC(SIZE,VAR) alloca((SIZE))
@@ -65,11 +67,7 @@ extern char *__strchrnul(const char *s, int c);
extern void *__exec_alloc(size_t size);
extern void __exec_free(void *ptr, size_t size);
-#endif
-/**********************************************************************/
-#ifdef L___exec_alloc
-
-#ifndef __ARCH_HAS_MMU__
+# ifdef L___exec_alloc
void *__exec_alloc(size_t size)
{
@@ -87,7 +85,7 @@ void __exec_free(void *ptr, size_t size)
}
}
-#endif
+# endif
#endif
/**********************************************************************/