[prev in list] [next in list] [prev in thread] [next in thread]
List: glibc-alpha
Subject: Re: [PATCH] add __ASSUME_MREMAP
From: Pino Toscano <toscano.pino () tiscali ! it>
Date: 2013-01-17 0:28:14
Message-ID: 201301170128.19006.toscano.pino () tiscali ! it
[Download RAW message or body]
[Attachment #2 (multipart/mixed)]
Alle giovedì 17 gennaio 2013, Roland McGrath ha scritto:
> > I see, malloc-sysdep.h seems a better fit then, assuming it is fine
> > using it outside of malloc itself.
>
> It's not ideal but I don't have a real problem with it.
OK, will propose the libio change when done with the malloc part.
> > Yes, that is what my patch does. Attached there is a new version of
> > it, updated after your feedback.
>
> Send a patch that only touches malloc.
Updated patch attached.
Thanks,
--
Pino Toscano
["have_mremap.diff" (text/x-patch)]
Add HAVE_MREMAP for mremap usage
Introduce (only on Linux) and use a HAVE_MREMAP symbol to advertize mremap
availability.
Move the malloc-sysdep.h include from arena.c to malloc.c, since what is
provided by malloc-sysdep.h is needed earlier in malloc.c, before the inclusion
of arena.c.
2013-01-17 Pino Toscano <toscano.pino@tiscali.it>
* sysdeps/unix/sysv/linux/malloc-sysdep.h (HAVE_MREMAP): New define.
* malloc/malloc.c: Include <unistd.h> and <malloc-sysdep.h>.
[!HAVE_MREMAP]: Remove [defined linux] case.
* malloc/arena.c: Do not include <malloc-sysdep.h>.
--- a/malloc/arena.c
+++ b/malloc/arena.c
@@ -19,9 +19,6 @@
#include <stdbool.h>
-/* Get the implementation for check_may_shrink_heap. */
-#include <malloc-sysdep.h>
-
/* Compile-time constants. */
#define HEAP_MIN_SIZE (32*1024)
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -168,7 +168,7 @@
Compilation Environment options:
- HAVE_MREMAP 0 unless linux defined
+ HAVE_MREMAP 0
Changing default word sizes:
@@ -214,8 +214,10 @@
#include <stddef.h> /* for size_t */
#include <stdlib.h> /* for getenv(), abort() */
+#include <unistd.h> /* for __libc_enable_secure */
#include <malloc-machine.h>
+#include <malloc-sysdep.h>
#include <atomic.h>
#include <_itoa.h>
@@ -490,19 +492,13 @@ void *(*__morecore)(ptrdiff_t) = __defau
/*
Define HAVE_MREMAP to make realloc() use mremap() to re-allocate
- large blocks. This is currently only possible on Linux with
- kernel versions newer than 1.3.77.
+ large blocks.
*/
#ifndef HAVE_MREMAP
-#ifdef linux
-#define HAVE_MREMAP 1
-#else
#define HAVE_MREMAP 0
#endif
-#endif /* HAVE_MREMAP */
-
/*
This version of malloc supports the standard SVID/XPG mallinfo
--- a/sysdeps/unix/sysv/linux/malloc-sysdep.h
+++ b/sysdeps/unix/sysv/linux/malloc-sysdep.h
@@ -55,3 +55,5 @@ check_may_shrink_heap (void)
return may_shrink_heap;
}
+
+#define HAVE_MREMAP 1
["signature.asc" (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic