diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-03-17 02:47:40 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-03-17 02:47:40 +0000 |
commit | b29f763ee1d32e8a12867a9338e5b79e0b241950 (patch) | |
tree | 9e74ec3845b2a63354413f9a42599a41e54ad519 /src/common | |
parent | db4fccef84526888c555a8afd42668d8c28709a4 (diff) | |
download | tor-b29f763ee1d32e8a12867a9338e5b79e0b241950.tar tor-b29f763ee1d32e8a12867a9338e5b79e0b241950.tar.gz |
r18850@catbus: nickm | 2008-03-16 22:35:38 -0400
Use 8k pages in openbsd malloc code on alpha. Bug and solution found by weasel. Also, when initializing openbsd malloc code, check that compiled page size matches output of getpagesize().
svn:r14056
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/OpenBSD_malloc_Linux.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/common/OpenBSD_malloc_Linux.c b/src/common/OpenBSD_malloc_Linux.c index da240c8e7..7252ead78 100644 --- a/src/common/OpenBSD_malloc_Linux.c +++ b/src/common/OpenBSD_malloc_Linux.c @@ -96,7 +96,7 @@ static pthread_mutex_t gen_mutex = PTHREAD_MUTEX_INITIALIZER; #define _MALLOC_LOCK() {pthread_mutex_lock(&gen_mutex);} #define _MALLOC_UNLOCK() {pthread_mutex_unlock(&gen_mutex);} -#if defined(__sparc__) +#if defined(__sparc__) || defined(__alpha__) #define malloc_pageshift 13U #endif /* __sparc__ */ @@ -787,6 +787,13 @@ malloc_init(void) " Will not be able to dump malloc stats on exit"); #endif /* MALLOC_STATS */ + if (malloc_pagesize != getpagesize()) { + wrterror("malloc() replacement compiled with a different " + "page size from what we're running with. Failing."); + errno = ENOMEM; + return; + } + /* Allocate one page for the page directory. */ page_dir = (struct pginfo **)MMAP(malloc_pagesize); |